@bevel-software/platform-core-backend 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (613) hide show
  1. package/agent-guide/access-control.md +17 -0
  2. package/agent-guide/conventions.md +8 -0
  3. package/agent-guide/html-views.md +83 -0
  4. package/agent-guide/new-knowledge-base.md +24 -0
  5. package/agent-guide/tool-manuals.md +10 -0
  6. package/dist/assets.d.ts +19 -0
  7. package/dist/assets.d.ts.map +1 -1
  8. package/dist/assets.js +26 -2
  9. package/dist/assets.js.map +1 -1
  10. package/dist/core/catalog-revision.d.ts +19 -1
  11. package/dist/core/catalog-revision.d.ts.map +1 -1
  12. package/dist/core/catalog-revision.js +14 -3
  13. package/dist/core/catalog-revision.js.map +1 -1
  14. package/dist/core/create-core-server.d.ts +5 -0
  15. package/dist/core/create-core-server.d.ts.map +1 -1
  16. package/dist/core/create-core-server.js +54 -3
  17. package/dist/core/create-core-server.js.map +1 -1
  18. package/dist/core/create-core-services.d.ts +26 -0
  19. package/dist/core/create-core-services.d.ts.map +1 -1
  20. package/dist/core/create-core-services.js +100 -8
  21. package/dist/core/create-core-services.js.map +1 -1
  22. package/dist/core/lifecycle.d.ts +16 -1
  23. package/dist/core/lifecycle.d.ts.map +1 -1
  24. package/dist/core/lifecycle.js +18 -1
  25. package/dist/core/lifecycle.js.map +1 -1
  26. package/dist/core-config.d.ts +21 -0
  27. package/dist/core-config.d.ts.map +1 -1
  28. package/dist/core-config.js +22 -1
  29. package/dist/core-config.js.map +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +2 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/modules/access/access-control.interface.d.ts +8 -0
  35. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  36. package/dist/modules/access/access-control.service.d.ts +1 -0
  37. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  38. package/dist/modules/access/access-control.service.js +11 -0
  39. package/dist/modules/access/access-control.service.js.map +1 -1
  40. package/dist/modules/access/directory-sync-bot.js +1 -1
  41. package/dist/modules/access/directory-sync-bot.js.map +1 -1
  42. package/dist/modules/agent-guide/agent-guide.d.ts +6 -0
  43. package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -1
  44. package/dist/modules/agent-guide/agent-guide.js +8 -0
  45. package/dist/modules/agent-guide/agent-guide.js.map +1 -1
  46. package/dist/modules/agent-guide/index.d.ts +1 -1
  47. package/dist/modules/agent-guide/index.d.ts.map +1 -1
  48. package/dist/modules/agent-guide/index.js +1 -1
  49. package/dist/modules/agent-guide/index.js.map +1 -1
  50. package/dist/modules/agent-instructions/compose.d.ts +5 -0
  51. package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
  52. package/dist/modules/agent-instructions/compose.js +19 -2
  53. package/dist/modules/agent-instructions/compose.js.map +1 -1
  54. package/dist/modules/agent-instructions/shared-file-rules.js +19 -19
  55. package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
  56. package/dist/modules/audit/agent-audit.service.d.ts +21 -2
  57. package/dist/modules/audit/agent-audit.service.d.ts.map +1 -1
  58. package/dist/modules/audit/agent-audit.service.js +43 -2
  59. package/dist/modules/audit/agent-audit.service.js.map +1 -1
  60. package/dist/modules/audit/agent-connection.routes.d.ts +34 -0
  61. package/dist/modules/audit/agent-connection.routes.d.ts.map +1 -0
  62. package/dist/modules/audit/agent-connection.routes.js +38 -0
  63. package/dist/modules/audit/agent-connection.routes.js.map +1 -0
  64. package/dist/modules/audit/audit.contract.d.ts +24 -0
  65. package/dist/modules/audit/audit.contract.d.ts.map +1 -1
  66. package/dist/modules/audit/audit.contract.js.map +1 -1
  67. package/dist/modules/audit/index.d.ts +1 -0
  68. package/dist/modules/audit/index.d.ts.map +1 -1
  69. package/dist/modules/audit/index.js +1 -0
  70. package/dist/modules/audit/index.js.map +1 -1
  71. package/dist/modules/auth/account.routes.d.ts.map +1 -1
  72. package/dist/modules/auth/account.routes.js +10 -3
  73. package/dist/modules/auth/account.routes.js.map +1 -1
  74. package/dist/modules/auth/auth.middleware.d.ts +7 -0
  75. package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
  76. package/dist/modules/auth/auth.middleware.js +1 -1
  77. package/dist/modules/auth/auth.middleware.js.map +1 -1
  78. package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
  79. package/dist/modules/code-mode/code-mode.tool.js +11 -3
  80. package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
  81. package/dist/modules/database/core-schema.d.ts +96 -0
  82. package/dist/modules/database/core-schema.d.ts.map +1 -1
  83. package/dist/modules/database/core-schema.js +32 -3
  84. package/dist/modules/database/core-schema.js.map +1 -1
  85. package/dist/modules/embed/account-link.service.d.ts +42 -0
  86. package/dist/modules/embed/account-link.service.d.ts.map +1 -0
  87. package/dist/modules/embed/account-link.service.js +50 -0
  88. package/dist/modules/embed/account-link.service.js.map +1 -0
  89. package/dist/modules/embed/embed-link.d.ts +58 -0
  90. package/dist/modules/embed/embed-link.d.ts.map +1 -0
  91. package/dist/modules/embed/embed-link.js +160 -0
  92. package/dist/modules/embed/embed-link.js.map +1 -0
  93. package/dist/modules/embed/embed.errors.d.ts +30 -0
  94. package/dist/modules/embed/embed.errors.d.ts.map +1 -0
  95. package/dist/modules/embed/embed.errors.js +42 -0
  96. package/dist/modules/embed/embed.errors.js.map +1 -0
  97. package/dist/modules/embed/embed.interface.d.ts +204 -0
  98. package/dist/modules/embed/embed.interface.d.ts.map +1 -0
  99. package/dist/modules/embed/embed.interface.js +2 -0
  100. package/dist/modules/embed/embed.interface.js.map +1 -0
  101. package/dist/modules/embed/embed.routes.d.ts +59 -0
  102. package/dist/modules/embed/embed.routes.d.ts.map +1 -0
  103. package/dist/modules/embed/embed.routes.js +343 -0
  104. package/dist/modules/embed/embed.routes.js.map +1 -0
  105. package/dist/modules/embed/embed.service.d.ts +169 -0
  106. package/dist/modules/embed/embed.service.d.ts.map +1 -0
  107. package/dist/modules/embed/embed.service.js +627 -0
  108. package/dist/modules/embed/embed.service.js.map +1 -0
  109. package/dist/modules/embed/embed.tools.d.ts +51 -0
  110. package/dist/modules/embed/embed.tools.d.ts.map +1 -0
  111. package/dist/modules/embed/embed.tools.js +170 -0
  112. package/dist/modules/embed/embed.tools.js.map +1 -0
  113. package/dist/modules/embed/mcp-app.d.ts +64 -0
  114. package/dist/modules/embed/mcp-app.d.ts.map +1 -0
  115. package/dist/modules/embed/mcp-app.js +147 -0
  116. package/dist/modules/embed/mcp-app.js.map +1 -0
  117. package/dist/modules/embed/mcp-app.routes.d.ts +21 -0
  118. package/dist/modules/embed/mcp-app.routes.d.ts.map +1 -0
  119. package/dist/modules/embed/mcp-app.routes.js +36 -0
  120. package/dist/modules/embed/mcp-app.routes.js.map +1 -0
  121. package/dist/modules/github-app/github-app.connection.d.ts +15 -0
  122. package/dist/modules/github-app/github-app.connection.d.ts.map +1 -1
  123. package/dist/modules/github-app/github-app.connection.js +34 -3
  124. package/dist/modules/github-app/github-app.connection.js.map +1 -1
  125. package/dist/modules/kb-fs/locking-filesystem.d.ts +65 -0
  126. package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
  127. package/dist/modules/kb-fs/locking-filesystem.js +300 -0
  128. package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
  129. package/dist/modules/kb-sync/kb-sync.interface.d.ts +5 -0
  130. package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
  131. package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
  132. package/dist/modules/kb-sync/kb-sync.service.js +6 -0
  133. package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
  134. package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
  135. package/dist/modules/mcp/mcp-auth.middleware.js +2 -1
  136. package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
  137. package/dist/modules/mcp/mcp.service.d.ts +28 -1
  138. package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
  139. package/dist/modules/mcp/mcp.service.js +64 -8
  140. package/dist/modules/mcp/mcp.service.js.map +1 -1
  141. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +24 -0
  142. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
  143. package/dist/modules/mcp/oauth/bevel-oauth-provider.js +32 -4
  144. package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
  145. package/dist/modules/onboarding/onboarding.contract.d.ts +80 -0
  146. package/dist/modules/onboarding/onboarding.contract.d.ts.map +1 -0
  147. package/dist/modules/onboarding/onboarding.contract.js +7 -0
  148. package/dist/modules/onboarding/onboarding.contract.js.map +1 -0
  149. package/dist/modules/onboarding/onboarding.routes.d.ts +18 -0
  150. package/dist/modules/onboarding/onboarding.routes.d.ts.map +1 -0
  151. package/dist/modules/onboarding/onboarding.routes.js +81 -0
  152. package/dist/modules/onboarding/onboarding.routes.js.map +1 -0
  153. package/dist/modules/onboarding/starter-pack.service.d.ts +213 -0
  154. package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -0
  155. package/dist/modules/onboarding/starter-pack.service.js +492 -0
  156. package/dist/modules/onboarding/starter-pack.service.js.map +1 -0
  157. package/dist/modules/onboarding/starter-packs.d.ts +78 -0
  158. package/dist/modules/onboarding/starter-packs.d.ts.map +1 -0
  159. package/dist/modules/onboarding/starter-packs.js +156 -0
  160. package/dist/modules/onboarding/starter-packs.js.map +1 -0
  161. package/dist/modules/plugins/index.d.ts +1 -1
  162. package/dist/modules/plugins/index.d.ts.map +1 -1
  163. package/dist/modules/plugins/index.js +1 -1
  164. package/dist/modules/plugins/index.js.map +1 -1
  165. package/dist/modules/plugins/plugin-provision.service.d.ts +19 -0
  166. package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
  167. package/dist/modules/plugins/plugin-provision.service.js +18 -1
  168. package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
  169. package/dist/modules/plugins/plugins.routes.d.ts +0 -36
  170. package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
  171. package/dist/modules/plugins/plugins.routes.js +31 -0
  172. package/dist/modules/plugins/plugins.routes.js.map +1 -1
  173. package/dist/modules/settings/deployment-settings.service.d.ts +34 -0
  174. package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
  175. package/dist/modules/settings/deployment-settings.service.js +134 -1
  176. package/dist/modules/settings/deployment-settings.service.js.map +1 -1
  177. package/dist/modules/settings/repository-source.d.ts +1 -0
  178. package/dist/modules/settings/repository-source.d.ts.map +1 -1
  179. package/dist/modules/settings/repository-source.js +3 -3
  180. package/dist/modules/settings/repository-source.js.map +1 -1
  181. package/dist/modules/skills/skills.tools.d.ts.map +1 -1
  182. package/dist/modules/skills/skills.tools.js +50 -32
  183. package/dist/modules/skills/skills.tools.js.map +1 -1
  184. package/dist/modules/tool-auth/connection-key-rejection.d.ts +10 -1
  185. package/dist/modules/tool-auth/connection-key-rejection.d.ts.map +1 -1
  186. package/dist/modules/tool-auth/connection-key-rejection.js +11 -3
  187. package/dist/modules/tool-auth/connection-key-rejection.js.map +1 -1
  188. package/dist/modules/tool-auth/external-api-key.interface.d.ts +8 -0
  189. package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
  190. package/dist/modules/tool-auth/external-api-key.service.d.ts +24 -2
  191. package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
  192. package/dist/modules/tool-auth/external-api-key.service.js +59 -2
  193. package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
  194. package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
  195. package/dist/modules/tool-auth/tool-auth.middleware.js +9 -4
  196. package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
  197. package/dist/modules/tool-helpers/index.d.ts +28 -1
  198. package/dist/modules/tool-helpers/index.d.ts.map +1 -1
  199. package/dist/modules/tool-helpers/index.js +28 -1
  200. package/dist/modules/tool-helpers/index.js.map +1 -1
  201. package/dist/modules/tool-helpers/route-argument-check.d.ts +10 -0
  202. package/dist/modules/tool-helpers/route-argument-check.d.ts.map +1 -0
  203. package/dist/modules/tool-helpers/route-argument-check.js +132 -0
  204. package/dist/modules/tool-helpers/route-argument-check.js.map +1 -0
  205. package/dist/modules/tool-helpers/route-tool-schemas.d.ts +89 -0
  206. package/dist/modules/tool-helpers/route-tool-schemas.d.ts.map +1 -0
  207. package/dist/modules/tool-helpers/route-tool-schemas.js +113 -0
  208. package/dist/modules/tool-helpers/route-tool-schemas.js.map +1 -0
  209. package/dist/modules/tool-helpers/tool-def.d.ts +71 -0
  210. package/dist/modules/tool-helpers/tool-def.d.ts.map +1 -1
  211. package/dist/modules/tool-helpers/tool-def.js +70 -6
  212. package/dist/modules/tool-helpers/tool-def.js.map +1 -1
  213. package/dist/modules/tool-helpers/tool-handler.d.ts +46 -6
  214. package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
  215. package/dist/modules/tool-helpers/tool-handler.js +157 -8
  216. package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
  217. package/dist/modules/tool-helpers/tool.contract.d.ts +9 -0
  218. package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
  219. package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
  220. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
  221. package/dist/modules/tool-manuals/tool-manuals.tools.js +14 -5
  222. package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
  223. package/dist/modules/tool-registry/description-length.d.ts +6 -2
  224. package/dist/modules/tool-registry/description-length.d.ts.map +1 -1
  225. package/dist/modules/tool-registry/description-length.js +27 -5
  226. package/dist/modules/tool-registry/description-length.js.map +1 -1
  227. package/dist/modules/tool-registry/guide-first.d.ts +4 -0
  228. package/dist/modules/tool-registry/guide-first.d.ts.map +1 -1
  229. package/dist/modules/tool-registry/guide-first.js +9 -1
  230. package/dist/modules/tool-registry/guide-first.js.map +1 -1
  231. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts +53 -0
  232. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -1
  233. package/dist/modules/workflow/agent-tools/change-request-read.tools.js +97 -68
  234. package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -1
  235. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +8 -1
  236. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
  237. package/dist/modules/workflow/agent-tools/workflow.tools.js +124 -37
  238. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
  239. package/dist/modules/workflow/file-lock.service.d.ts +29 -5
  240. package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
  241. package/dist/modules/workflow/file-lock.service.js +62 -5
  242. package/dist/modules/workflow/file-lock.service.js.map +1 -1
  243. package/dist/modules/workflow/git/git.service.d.ts +72 -1
  244. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  245. package/dist/modules/workflow/git/git.service.js +172 -36
  246. package/dist/modules/workflow/git/git.service.js.map +1 -1
  247. package/dist/modules/workflow/git/node-git-runner.d.ts +15 -0
  248. package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
  249. package/dist/modules/workflow/git/node-git-runner.js +78 -6
  250. package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
  251. package/dist/modules/workflow/pending-commits.service.d.ts +15 -0
  252. package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
  253. package/dist/modules/workflow/pending-commits.service.js +25 -1
  254. package/dist/modules/workflow/pending-commits.service.js.map +1 -1
  255. package/dist/modules/workflow/pending-commits.worker.d.ts +6 -1
  256. package/dist/modules/workflow/pending-commits.worker.d.ts.map +1 -1
  257. package/dist/modules/workflow/pending-commits.worker.js +23 -6
  258. package/dist/modules/workflow/pending-commits.worker.js.map +1 -1
  259. package/dist/modules/workflow/recovery-bot.js +1 -1
  260. package/dist/modules/workflow/recovery-bot.js.map +1 -1
  261. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
  262. package/dist/modules/workflow/review-workflow/review-workflow.service.js +2 -1
  263. package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
  264. package/dist/modules/workflow/sanitize-error.d.ts +16 -0
  265. package/dist/modules/workflow/sanitize-error.d.ts.map +1 -1
  266. package/dist/modules/workflow/sanitize-error.js +45 -0
  267. package/dist/modules/workflow/sanitize-error.js.map +1 -1
  268. package/dist/modules/workflow/workflow.service.d.ts +183 -15
  269. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  270. package/dist/modules/workflow/workflow.service.js +805 -106
  271. package/dist/modules/workflow/workflow.service.js.map +1 -1
  272. package/dist/modules/workspace/agent-download.builder.d.ts +105 -0
  273. package/dist/modules/workspace/agent-download.builder.d.ts.map +1 -0
  274. package/dist/modules/workspace/agent-download.builder.js +238 -0
  275. package/dist/modules/workspace/agent-download.builder.js.map +1 -0
  276. package/dist/modules/workspace/agent-download.routes.d.ts +77 -0
  277. package/dist/modules/workspace/agent-download.routes.d.ts.map +1 -0
  278. package/dist/modules/workspace/agent-download.routes.js +156 -0
  279. package/dist/modules/workspace/agent-download.routes.js.map +1 -0
  280. package/dist/modules/workspace/agent-download.store.d.ts +225 -0
  281. package/dist/modules/workspace/agent-download.store.d.ts.map +1 -0
  282. package/dist/modules/workspace/agent-download.store.js +423 -0
  283. package/dist/modules/workspace/agent-download.store.js.map +1 -0
  284. package/dist/modules/workspace/agent-upload.store.d.ts +10 -1
  285. package/dist/modules/workspace/agent-upload.store.d.ts.map +1 -1
  286. package/dist/modules/workspace/agent-upload.store.js +16 -6
  287. package/dist/modules/workspace/agent-upload.store.js.map +1 -1
  288. package/dist/modules/workspace/file-readers/raw-mime.d.ts +6 -0
  289. package/dist/modules/workspace/file-readers/raw-mime.d.ts.map +1 -0
  290. package/dist/modules/workspace/file-readers/raw-mime.js +38 -0
  291. package/dist/modules/workspace/file-readers/raw-mime.js.map +1 -0
  292. package/dist/modules/workspace/file-readers/text-reader.d.ts +5 -5
  293. package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -1
  294. package/dist/modules/workspace/file-readers/text-reader.js +5 -8
  295. package/dist/modules/workspace/file-readers/text-reader.js.map +1 -1
  296. package/dist/modules/workspace/first-run.d.ts +111 -0
  297. package/dist/modules/workspace/first-run.d.ts.map +1 -0
  298. package/dist/modules/workspace/first-run.js +181 -0
  299. package/dist/modules/workspace/first-run.js.map +1 -0
  300. package/dist/modules/workspace/move-links.d.ts +92 -0
  301. package/dist/modules/workspace/move-links.d.ts.map +1 -0
  302. package/dist/modules/workspace/move-links.js +173 -0
  303. package/dist/modules/workspace/move-links.js.map +1 -0
  304. package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
  305. package/dist/modules/workspace/startup/steps/seed-tree.js +3 -13
  306. package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
  307. package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
  308. package/dist/modules/workspace/workspace.routes.js +63 -22
  309. package/dist/modules/workspace/workspace.routes.js.map +1 -1
  310. package/dist/modules/workspace/workspace.service.d.ts +75 -2
  311. package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
  312. package/dist/modules/workspace/workspace.service.js +197 -24
  313. package/dist/modules/workspace/workspace.service.js.map +1 -1
  314. package/dist/modules/workspace/workspace.tools.d.ts +59 -1
  315. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
  316. package/dist/modules/workspace/workspace.tools.js +443 -65
  317. package/dist/modules/workspace/workspace.tools.js.map +1 -1
  318. package/dist/modules/write-access/write-access.d.ts.map +1 -1
  319. package/dist/modules/write-access/write-access.js +9 -0
  320. package/dist/modules/write-access/write-access.js.map +1 -1
  321. package/dist/shared/domain-errors.d.ts +73 -1
  322. package/dist/shared/domain-errors.d.ts.map +1 -1
  323. package/dist/shared/domain-errors.js +86 -12
  324. package/dist/shared/domain-errors.js.map +1 -1
  325. package/dist/shared/git.contract.d.ts +10 -1
  326. package/dist/shared/git.contract.d.ts.map +1 -1
  327. package/dist/shared/git.contract.js.map +1 -1
  328. package/dist/shared/utf8-text.d.ts +15 -0
  329. package/dist/shared/utf8-text.d.ts.map +1 -0
  330. package/dist/shared/utf8-text.js +20 -0
  331. package/dist/shared/utf8-text.js.map +1 -0
  332. package/dist/tenancy/static-tenant-source.d.ts +2 -1
  333. package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
  334. package/dist/tenancy/static-tenant-source.js +9 -2
  335. package/dist/tenancy/static-tenant-source.js.map +1 -1
  336. package/mcp-app/page.html +349 -0
  337. package/migrations/0017_atlassian_account_links.sql +37 -0
  338. package/migrations/meta/0017_snapshot.json +2396 -0
  339. package/migrations/meta/_journal.json +8 -1
  340. package/package.json +5 -3
  341. package/src/__tests__/packaged-assets-ship.test.ts +16 -4
  342. package/src/assets.ts +28 -2
  343. package/src/core/__tests__/catalog-revision.test.ts +40 -0
  344. package/src/core/__tests__/gated-boot.test.ts +1 -0
  345. package/src/core/__tests__/lifecycle.test.ts +14 -0
  346. package/src/core/catalog-revision.ts +15 -2
  347. package/src/core/create-core-server.ts +67 -3
  348. package/src/core/create-core-services.ts +140 -6
  349. package/src/core/lifecycle.ts +28 -2
  350. package/src/core-config.ts +24 -1
  351. package/src/index.ts +2 -2
  352. package/src/modules/access/__tests__/access-control.service.test.ts +19 -0
  353. package/src/modules/access/access-control.interface.ts +13 -0
  354. package/src/modules/access/access-control.service.ts +16 -0
  355. package/src/modules/access/directory-sync-bot.ts +1 -1
  356. package/src/modules/agent-guide/__tests__/agent-guide.test.ts +58 -0
  357. package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +19 -1
  358. package/src/modules/agent-guide/agent-guide.ts +9 -0
  359. package/src/modules/agent-guide/index.ts +1 -0
  360. package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +14 -0
  361. package/src/modules/agent-instructions/compose.ts +17 -2
  362. package/src/modules/agent-instructions/shared-file-rules.ts +19 -19
  363. package/src/modules/audit/__tests__/agent-audit.service.test.ts +64 -4
  364. package/src/modules/audit/__tests__/agent-connection.routes.test.ts +102 -0
  365. package/src/modules/audit/agent-audit.service.ts +58 -3
  366. package/src/modules/audit/agent-connection.routes.ts +56 -0
  367. package/src/modules/audit/audit.contract.ts +26 -0
  368. package/src/modules/audit/index.ts +1 -0
  369. package/src/modules/auth/__tests__/account.routes.test.ts +5 -3
  370. package/src/modules/auth/account.routes.ts +10 -3
  371. package/src/modules/auth/auth.middleware.ts +1 -1
  372. package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +18 -2
  373. package/src/modules/code-mode/code-mode.tool.ts +13 -2
  374. package/src/modules/database/core-schema.ts +33 -3
  375. package/src/modules/embed/__tests__/account-links.migration.test.ts +98 -0
  376. package/src/modules/embed/__tests__/embed-link.test.ts +122 -0
  377. package/src/modules/embed/__tests__/embed.routes.test.ts +362 -0
  378. package/src/modules/embed/__tests__/embed.service.lock.test.ts +193 -0
  379. package/src/modules/embed/__tests__/embed.service.test.ts +805 -0
  380. package/src/modules/embed/__tests__/embed.tools.test.ts +304 -0
  381. package/src/modules/embed/__tests__/mcp-app.test.ts +207 -0
  382. package/src/modules/embed/account-link.service.ts +76 -0
  383. package/src/modules/embed/embed-link.ts +180 -0
  384. package/src/modules/embed/embed.errors.ts +43 -0
  385. package/src/modules/embed/embed.interface.ts +203 -0
  386. package/src/modules/embed/embed.routes.ts +363 -0
  387. package/src/modules/embed/embed.service.ts +705 -0
  388. package/src/modules/embed/embed.tools.ts +206 -0
  389. package/src/modules/embed/mcp-app.routes.ts +41 -0
  390. package/src/modules/embed/mcp-app.ts +173 -0
  391. package/src/modules/github-app/__tests__/github-app.test.ts +76 -0
  392. package/src/modules/github-app/github-app.connection.ts +38 -4
  393. package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +304 -0
  394. package/src/modules/kb-fs/locking-filesystem.ts +287 -0
  395. package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +35 -0
  396. package/src/modules/kb-sync/kb-sync.interface.ts +2 -0
  397. package/src/modules/kb-sync/kb-sync.service.ts +6 -0
  398. package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +68 -11
  399. package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +37 -2
  400. package/src/modules/mcp/__tests__/mcp.app.e2e.test.ts +200 -0
  401. package/src/modules/mcp/__tests__/mcp.e2e.test.ts +3 -1
  402. package/src/modules/mcp/__tests__/mcp.service.test.ts +23 -13
  403. package/src/modules/mcp/__tests__/tool-call-interface.e2e.test.ts +499 -0
  404. package/src/modules/mcp/mcp-auth.middleware.ts +2 -1
  405. package/src/modules/mcp/mcp.service.ts +81 -12
  406. package/src/modules/mcp/oauth/bevel-oauth-provider.ts +42 -4
  407. package/src/modules/onboarding/__tests__/onboarding.routes.test.ts +163 -0
  408. package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +635 -0
  409. package/src/modules/onboarding/__tests__/starter-packs.test.ts +169 -0
  410. package/src/modules/onboarding/onboarding.contract.ts +85 -0
  411. package/src/modules/onboarding/onboarding.routes.ts +85 -0
  412. package/src/modules/onboarding/starter-pack.service.ts +580 -0
  413. package/src/modules/onboarding/starter-packs.ts +182 -0
  414. package/src/modules/plugins/__tests__/plugins.tools.test.ts +25 -2
  415. package/src/modules/plugins/index.ts +1 -0
  416. package/src/modules/plugins/plugin-provision.service.ts +22 -1
  417. package/src/modules/plugins/plugins.routes.ts +29 -0
  418. package/src/modules/settings/__tests__/deployment-settings.service.test.ts +150 -1
  419. package/src/modules/settings/__tests__/repository-source.test.ts +9 -0
  420. package/src/modules/settings/deployment-settings.service.ts +131 -1
  421. package/src/modules/settings/repository-source.ts +4 -4
  422. package/src/modules/skills/__tests__/skills.tools.description.test.ts +5 -1
  423. package/src/modules/skills/skills.tools.ts +55 -35
  424. package/src/modules/tool-auth/__tests__/connection-key-rejection.test.ts +32 -0
  425. package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +65 -0
  426. package/src/modules/tool-auth/connection-key-rejection.ts +13 -3
  427. package/src/modules/tool-auth/external-api-key.interface.ts +9 -0
  428. package/src/modules/tool-auth/external-api-key.service.ts +61 -4
  429. package/src/modules/tool-auth/tool-auth.middleware.ts +13 -4
  430. package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +502 -0
  431. package/src/modules/tool-helpers/__tests__/route-argument-check.test.ts +337 -0
  432. package/src/modules/tool-helpers/index.ts +34 -1
  433. package/src/modules/tool-helpers/route-argument-check.ts +149 -0
  434. package/src/modules/tool-helpers/route-tool-schemas.ts +171 -0
  435. package/src/modules/tool-helpers/tool-def.ts +132 -7
  436. package/src/modules/tool-helpers/tool-handler.ts +196 -8
  437. package/src/modules/tool-helpers/tool.contract.ts +9 -0
  438. package/src/modules/tool-manuals/tool-manuals.tools.ts +15 -5
  439. package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +14 -1
  440. package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +23 -10
  441. package/src/modules/tool-registry/description-length.ts +34 -7
  442. package/src/modules/tool-registry/guide-first.ts +8 -1
  443. package/src/modules/workflow/__tests__/file-lock.service.deletion-gate.test.ts +104 -0
  444. package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +66 -0
  445. package/src/modules/workflow/__tests__/pending-commits.worker.test.ts +31 -2
  446. package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +110 -6
  447. package/src/modules/workflow/__tests__/sanitize-error.test.ts +89 -1
  448. package/src/modules/workflow/__tests__/workflow.routes.push-refused.test.ts +202 -0
  449. package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +6 -6
  450. package/src/modules/workflow/__tests__/workflow.service.delete-branch.test.ts +1026 -0
  451. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +468 -10
  452. package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +4 -0
  453. package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +5 -4
  454. package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +54 -2
  455. package/src/modules/workflow/agent-tools/__tests__/change-request-read.tools.test.ts +41 -5
  456. package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +127 -2
  457. package/src/modules/workflow/agent-tools/change-request-read.tools.ts +157 -122
  458. package/src/modules/workflow/agent-tools/workflow.tools.ts +129 -35
  459. package/src/modules/workflow/file-lock.service.ts +67 -5
  460. package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +164 -0
  461. package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +48 -1
  462. package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +231 -2
  463. package/src/modules/workflow/git/git.service.ts +176 -38
  464. package/src/modules/workflow/git/node-git-runner.ts +82 -7
  465. package/src/modules/workflow/pending-commits.service.ts +29 -1
  466. package/src/modules/workflow/pending-commits.worker.ts +24 -6
  467. package/src/modules/workflow/recovery-bot.ts +1 -1
  468. package/src/modules/workflow/review-workflow/review-workflow.service.ts +2 -1
  469. package/src/modules/workflow/sanitize-error.ts +50 -0
  470. package/src/modules/workflow/workflow.service.ts +879 -112
  471. package/src/modules/workspace/__tests__/agent-downloads.test.ts +823 -0
  472. package/src/modules/workspace/__tests__/first-run.test.ts +234 -0
  473. package/src/modules/workspace/__tests__/git-internals.security.test.ts +5 -2
  474. package/src/modules/workspace/__tests__/md-links.test.ts +353 -0
  475. package/src/modules/workspace/__tests__/move-links.test.ts +261 -0
  476. package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +219 -0
  477. package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -0
  478. package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +102 -0
  479. package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +52 -5
  480. package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +190 -0
  481. package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +8 -4
  482. package/src/modules/workspace/__tests__/workspace.service.test.ts +50 -8
  483. package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +44 -1
  484. package/src/modules/workspace/__tests__/workspace.tools.test.ts +409 -12
  485. package/src/modules/workspace/agent-download.builder.ts +308 -0
  486. package/src/modules/workspace/agent-download.routes.ts +183 -0
  487. package/src/modules/workspace/agent-download.store.ts +533 -0
  488. package/src/modules/workspace/agent-upload.store.ts +23 -7
  489. package/src/modules/workspace/file-readers/raw-mime.ts +40 -0
  490. package/src/modules/workspace/file-readers/text-reader.ts +5 -8
  491. package/src/modules/workspace/first-run.ts +222 -0
  492. package/src/modules/workspace/move-links.ts +237 -0
  493. package/src/modules/workspace/startup/steps/seed-tree.ts +3 -12
  494. package/src/modules/workspace/workspace.routes.ts +64 -22
  495. package/src/modules/workspace/workspace.service.ts +202 -25
  496. package/src/modules/workspace/workspace.tools.ts +492 -63
  497. package/src/modules/write-access/__tests__/write-access.test.ts +13 -0
  498. package/src/modules/write-access/write-access.ts +9 -0
  499. package/src/shared/domain-errors.ts +108 -11
  500. package/src/shared/git.contract.ts +8 -1
  501. package/src/shared/utf8-text.ts +21 -0
  502. package/src/tenancy/__tests__/static-tenant-source.test.ts +1 -0
  503. package/src/tenancy/static-tenant-source.ts +10 -2
  504. package/starter-packs/README.md +103 -0
  505. package/starter-packs/engineering/KnowledgeBase/About us.md +9 -0
  506. package/starter-packs/engineering/KnowledgeBase/Architecture.md +9 -0
  507. package/starter-packs/engineering/KnowledgeBase/Glossary.md +9 -0
  508. package/starter-packs/engineering/KnowledgeBase/How we ship.md +9 -0
  509. package/starter-packs/engineering/Plugins/engineering-starter/LICENSE +21 -0
  510. package/starter-packs/engineering/Plugins/engineering-starter/SOURCE.md +20 -0
  511. package/starter-packs/engineering/Plugins/engineering-starter/access.md +19 -0
  512. package/starter-packs/engineering/Plugins/engineering-starter/plugin.json +10 -0
  513. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/SKILL.md +171 -0
  514. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2a-startup-diagnostic.md +157 -0
  515. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2b-builder-brainstorm.md +39 -0
  516. package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-ceo-review/SKILL.md +144 -0
  517. package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-eng-review/SKILL.md +144 -0
  518. package/starter-packs/engineering/Plugins/engineering-starter/skills/review/SKILL.md +80 -0
  519. package/starter-packs/engineering/Plugins/engineering-starter/skills/review/checklist.md +184 -0
  520. package/starter-packs/engineering/pack.yaml +11 -0
  521. package/starter-packs/general/KnowledgeBase/About us.md +9 -0
  522. package/starter-packs/general/KnowledgeBase/Glossary.md +9 -0
  523. package/starter-packs/general/KnowledgeBase/How we work.md +9 -0
  524. package/starter-packs/general/Plugins/general-starter/LICENSE +202 -0
  525. package/starter-packs/general/Plugins/general-starter/SOURCE.md +10 -0
  526. package/starter-packs/general/Plugins/general-starter/access.md +19 -0
  527. package/starter-packs/general/Plugins/general-starter/plugin.json +10 -0
  528. package/starter-packs/general/Plugins/general-starter/skills/memory-management/SKILL.md +332 -0
  529. package/starter-packs/general/Plugins/general-starter/skills/productivity-start/SKILL.md +163 -0
  530. package/starter-packs/general/Plugins/general-starter/skills/productivity-update/SKILL.md +167 -0
  531. package/starter-packs/general/Plugins/general-starter/skills/task-management/SKILL.md +83 -0
  532. package/starter-packs/general/pack.yaml +10 -0
  533. package/starter-packs/operations/KnowledgeBase/Glossary.md +9 -0
  534. package/starter-packs/operations/KnowledgeBase/How we work.md +9 -0
  535. package/starter-packs/operations/KnowledgeBase/Processes.md +9 -0
  536. package/starter-packs/operations/KnowledgeBase/Tools we use.md +9 -0
  537. package/starter-packs/operations/KnowledgeBase/Vendors.md +9 -0
  538. package/starter-packs/operations/Plugins/operations-starter/LICENSE +202 -0
  539. package/starter-packs/operations/Plugins/operations-starter/SOURCE.md +10 -0
  540. package/starter-packs/operations/Plugins/operations-starter/access.md +19 -0
  541. package/starter-packs/operations/Plugins/operations-starter/plugin.json +10 -0
  542. package/starter-packs/operations/Plugins/operations-starter/skills/capacity-plan/SKILL.md +111 -0
  543. package/starter-packs/operations/Plugins/operations-starter/skills/change-request/SKILL.md +119 -0
  544. package/starter-packs/operations/Plugins/operations-starter/skills/compliance-tracking/SKILL.md +44 -0
  545. package/starter-packs/operations/Plugins/operations-starter/skills/process-doc/SKILL.md +80 -0
  546. package/starter-packs/operations/Plugins/operations-starter/skills/process-optimization/SKILL.md +39 -0
  547. package/starter-packs/operations/Plugins/operations-starter/skills/risk-assessment/SKILL.md +40 -0
  548. package/starter-packs/operations/Plugins/operations-starter/skills/runbook/SKILL.md +85 -0
  549. package/starter-packs/operations/Plugins/operations-starter/skills/status-report/SKILL.md +75 -0
  550. package/starter-packs/operations/Plugins/operations-starter/skills/vendor-review/SKILL.md +102 -0
  551. package/starter-packs/operations/pack.yaml +12 -0
  552. package/starter-packs/sales/KnowledgeBase/About us.md +9 -0
  553. package/starter-packs/sales/KnowledgeBase/Customers.md +9 -0
  554. package/starter-packs/sales/KnowledgeBase/Glossary.md +9 -0
  555. package/starter-packs/sales/KnowledgeBase/How we sell.md +9 -0
  556. package/starter-packs/sales/KnowledgeBase/Objections.md +9 -0
  557. package/starter-packs/sales/KnowledgeBase/Pricing.md +9 -0
  558. package/starter-packs/sales/Plugins/sales-starter/LICENSE +202 -0
  559. package/starter-packs/sales/Plugins/sales-starter/SOURCE.md +10 -0
  560. package/starter-packs/sales/Plugins/sales-starter/access.md +19 -0
  561. package/starter-packs/sales/Plugins/sales-starter/plugin.json +10 -0
  562. package/starter-packs/sales/Plugins/sales-starter/skills/account-context/SKILL.md +94 -0
  563. package/starter-packs/sales/Plugins/sales-starter/skills/account-plan/SKILL.md +95 -0
  564. package/starter-packs/sales/Plugins/sales-starter/skills/account-research/SKILL.md +99 -0
  565. package/starter-packs/sales/Plugins/sales-starter/skills/account-tiering/SKILL.md +101 -0
  566. package/starter-packs/sales/Plugins/sales-starter/skills/call-prep/SKILL.md +111 -0
  567. package/starter-packs/sales/Plugins/sales-starter/skills/call-summary/SKILL.md +111 -0
  568. package/starter-packs/sales/Plugins/sales-starter/skills/close-plan/SKILL.md +106 -0
  569. package/starter-packs/sales/Plugins/sales-starter/skills/competitive-intelligence/SKILL.md +102 -0
  570. package/starter-packs/sales/Plugins/sales-starter/skills/create-an-asset/SKILL.md +105 -0
  571. package/starter-packs/sales/Plugins/sales-starter/skills/crm-hygiene-check/SKILL.md +103 -0
  572. package/starter-packs/sales/Plugins/sales-starter/skills/customer-health/SKILL.md +108 -0
  573. package/starter-packs/sales/Plugins/sales-starter/skills/customer-voice/SKILL.md +94 -0
  574. package/starter-packs/sales/Plugins/sales-starter/skills/daily-briefing/SKILL.md +61 -0
  575. package/starter-packs/sales/Plugins/sales-starter/skills/deal-advance-gap/SKILL.md +102 -0
  576. package/starter-packs/sales/Plugins/sales-starter/skills/deal-review/SKILL.md +105 -0
  577. package/starter-packs/sales/Plugins/sales-starter/skills/deal-signals/SKILL.md +96 -0
  578. package/starter-packs/sales/Plugins/sales-starter/skills/deal-slip-scenario/SKILL.md +104 -0
  579. package/starter-packs/sales/Plugins/sales-starter/skills/draft-outreach/SKILL.md +116 -0
  580. package/starter-packs/sales/Plugins/sales-starter/skills/end-of-day/SKILL.md +114 -0
  581. package/starter-packs/sales/Plugins/sales-starter/skills/expansion-whitespace/SKILL.md +97 -0
  582. package/starter-packs/sales/Plugins/sales-starter/skills/forecast/SKILL.md +100 -0
  583. package/starter-packs/sales/Plugins/sales-starter/skills/handle-objection/SKILL.md +93 -0
  584. package/starter-packs/sales/Plugins/sales-starter/skills/inbox-sweep/SKILL.md +114 -0
  585. package/starter-packs/sales/Plugins/sales-starter/skills/lead-triage/SKILL.md +106 -0
  586. package/starter-packs/sales/Plugins/sales-starter/skills/log-activity/SKILL.md +111 -0
  587. package/starter-packs/sales/Plugins/sales-starter/skills/pipeline-review/SKILL.md +97 -0
  588. package/starter-packs/sales/Plugins/sales-starter/skills/renewal-radar/SKILL.md +95 -0
  589. package/starter-packs/sales/Plugins/sales-starter/skills/rep-context/SKILL.md +90 -0
  590. package/starter-packs/sales/Plugins/sales-starter/skills/route-lead/SKILL.md +111 -0
  591. package/starter-packs/sales/Plugins/sales-starter/skills/sales-setup/SKILL.md +200 -0
  592. package/starter-packs/sales/Plugins/sales-starter/skills/schedule-meeting/SKILL.md +99 -0
  593. package/starter-packs/sales/Plugins/sales-starter/skills/stakeholder-map/SKILL.md +107 -0
  594. package/starter-packs/sales/Plugins/sales-starter/skills/team-pipeline/SKILL.md +105 -0
  595. package/starter-packs/sales/Plugins/sales-starter/skills/update-opportunity/SKILL.md +112 -0
  596. package/starter-packs/sales/Plugins/sales-starter/skills/weekly-wrap/SKILL.md +90 -0
  597. package/starter-packs/sales/Plugins/sales-starter/skills/win-loss-review/SKILL.md +88 -0
  598. package/starter-packs/sales/pack.yaml +13 -0
  599. package/starter-packs/support/KnowledgeBase/Escalations.md +9 -0
  600. package/starter-packs/support/KnowledgeBase/Glossary.md +9 -0
  601. package/starter-packs/support/KnowledgeBase/Known issues.md +9 -0
  602. package/starter-packs/support/KnowledgeBase/Products.md +9 -0
  603. package/starter-packs/support/KnowledgeBase/Tone of voice.md +9 -0
  604. package/starter-packs/support/Plugins/support-starter/LICENSE +202 -0
  605. package/starter-packs/support/Plugins/support-starter/SOURCE.md +10 -0
  606. package/starter-packs/support/Plugins/support-starter/access.md +19 -0
  607. package/starter-packs/support/Plugins/support-starter/plugin.json +10 -0
  608. package/starter-packs/support/Plugins/support-starter/skills/customer-escalation/SKILL.md +246 -0
  609. package/starter-packs/support/Plugins/support-starter/skills/customer-research/SKILL.md +250 -0
  610. package/starter-packs/support/Plugins/support-starter/skills/draft-response/SKILL.md +416 -0
  611. package/starter-packs/support/Plugins/support-starter/skills/kb-article/SKILL.md +350 -0
  612. package/starter-packs/support/Plugins/support-starter/skills/ticket-triage/SKILL.md +273 -0
  613. package/starter-packs/support/pack.yaml +12 -0
@@ -0,0 +1,492 @@
1
+ /**
2
+ * "What does your team do?" — the one question a new knowledge base's admin
3
+ * is asked after choosing where the knowledge lives, and the pages and skills
4
+ * the answer adds.
5
+ *
6
+ * WHEN IT IS ASKED. Only of an admin, only until somebody has answered, and
7
+ * only while the knowledge folder is still new (`knowledgeFolderIsNew`, the
8
+ * same check the agent's first-run note makes): a knowledge base that already
9
+ * has pages has outgrown starter pages, whoever wrote them. The answer —
10
+ * a pack's id, or `none` for "I'll start from scratch" — is recorded as the
11
+ * deployment setting `starterPack`, and its presence retires the question for
12
+ * good.
13
+ *
14
+ * HOW THE PACK LANDS. As ONE commit on the default branch, authored by the
15
+ * admin who chose it ("Add starter pages and skills for Sales"), through the
16
+ * platform's own multi-file write: `LockingFilesystem.writeFiles`, the batch
17
+ * the roles admin and the synced-groups writer use. It takes every path's
18
+ * lock, writes, commits the set as one change and pushes it, and the
19
+ * protected branch's write gate applies to it as to any write — which an
20
+ * admin passes, as the root's `write: Admin` says. Nothing is overwritten: a
21
+ * path that already exists when the locks are held is left out of the batch.
22
+ *
23
+ * ONE commit across every replica, too. Before the write the admin takes a
24
+ * CLAIM — a settings row inserted only if absent, so of two admins choosing
25
+ * at once on two replicas the database lets one through and tells the other
26
+ * the pack is being added — and holds it until the answer is recorded, after
27
+ * the write landed. A write that fails releases the claim, so the question
28
+ * is asked again. A claim nobody released within `CLAIM_TTL_MS` was left by
29
+ * a process that died mid-write (a write takes seconds) and is taken over,
30
+ * so one crash never strands the question. A CLAIM IS CHECKED, NOT TRUSTED:
31
+ * a holder that outlived its claim — a clone that took minutes — may find it
32
+ * taken over and the question answered meanwhile, so right before the one
33
+ * effect, with every lock held and nothing written, the holder renews the
34
+ * claim where it still reads as its own — one statement that proves it and
35
+ * gives the effect a whole `CLAIM_TTL_MS` of its own — and checks that
36
+ * nothing is answered (`fence`); the answer is recorded only where none is. The answer itself (`starterPack`)
37
+ * is recorded once the pack is there; should that last step fail, the pack
38
+ * is added all the same — said in the log, answered as the success it is —
39
+ * and the pages close the question from then on.
40
+ *
41
+ * The pack's plugin is RUN BY the admin who applied it, the way a plugin made
42
+ * with "Create a plugin" is run by its creator: its `access.md` names them
43
+ * under read, write and owner (added to the rules the pack ships, which open
44
+ * the plugin to the team), and a pack without a manifest gets the one
45
+ * `renderPluginManifest` writes for any new plugin. A plugin folder that is
46
+ * already there — or another plugin answering to the same name, at any
47
+ * depth, by plugin discovery's own reading of the checkout — is left alone
48
+ * entirely: a pack does not write into somebody else's plugin, and never
49
+ * makes a second plugin with the name of one in a grouping folder. That
50
+ * check and the commit happen under the plugin creation's own identity lock
51
+ * (`PluginProvisionService.withIdentities`), so a creation or a deletion of
52
+ * the same name cannot slip between them.
53
+ */
54
+ import path from 'node:path';
55
+ import { PERSONAL_PLUGIN_PREFIX, PLUGIN_MANIFEST_FILE, pluginManifestName, renderPluginManifest, } from '@bevel-software/platform-shared';
56
+ import { logger } from '../../shared/logging.js';
57
+ import { PushNeedsAgentResolutionError, WorkflowDomainError } from '../../shared/domain-errors.js';
58
+ import { LockingFilesystem } from '../kb-fs/locking-filesystem.js';
59
+ import { isUntouchedStarterPage, knowledgeFolderIsNew, } from '../workspace/first-run.js';
60
+ import { pluginAccessMd, withCreatorGrants } from '../plugins/index.js';
61
+ import { NO_STARTER_PACK, loadStarterPacks, starterPackFiles, } from './starter-packs.js';
62
+ const log = logger('starter-packs');
63
+ /** The deployment setting the choice is recorded in. */
64
+ export const STARTER_PACK_SETTING = 'starterPack';
65
+ /** The claim held while a choice is written (see the module doc): `<user id> <epoch ms>`. */
66
+ export const STARTER_PACK_CLAIM_SETTING = 'starterPackClaim';
67
+ /** A claim older than this was left by a process that died mid-write: a write takes seconds, not minutes. */
68
+ export const CLAIM_TTL_MS = 10 * 60_000;
69
+ /**
70
+ * The catch-all pack, offered as "Something else": its name is that chip's
71
+ * label, so the sentences that would name the team ("for Sales") leave it out.
72
+ */
73
+ const CATCH_ALL_PACK = 'general';
74
+ /** A refusal the route passes through as its status. */
75
+ export class StarterPackError extends WorkflowDomainError {
76
+ constructor(message, status) {
77
+ super(message, status);
78
+ this.name = 'StarterPackError';
79
+ }
80
+ }
81
+ export class StarterPackService {
82
+ deps;
83
+ constructor(deps) {
84
+ this.deps = deps;
85
+ }
86
+ /** What the caller is offered, and what was chosen. */
87
+ async status(user) {
88
+ const [chosen, isAdmin, packs] = await Promise.all([
89
+ this.recordedChoice(),
90
+ this.deps.adminAccess.isAdmin(user.email),
91
+ loadStarterPacks(this.deps.disk, this.deps.packsDir),
92
+ ]);
93
+ const offered = isAdmin && chosen === null && packs.length > 0 && (await this.knowledgeIsNew(false, user.email));
94
+ const pack = chosen && chosen !== NO_STARTER_PACK ? packs.find((p) => p.id === chosen) : undefined;
95
+ return {
96
+ offered,
97
+ chosen,
98
+ packs: isAdmin ? packs.map(({ id, name, description, order }) => ({ id, name, description, order })) : [],
99
+ chosenPack: pack
100
+ ? {
101
+ id: pack.id,
102
+ name: pack.name,
103
+ firstPagePrompt: pack.firstPagePrompt,
104
+ starterPages: await this.untouchedPages(pack, user.email),
105
+ }
106
+ : null,
107
+ };
108
+ }
109
+ /**
110
+ * Record `id` as the answer and, for a pack, add what it holds. `none`
111
+ * records the skip and adds nothing. Refused with 403 for a member, 409
112
+ * once the question is no longer asked (answered, or the knowledge base
113
+ * has pages now), 404 for a pack that does not exist.
114
+ */
115
+ async choose(user, id) {
116
+ if (!(await this.deps.adminAccess.isAdmin(user.email))) {
117
+ throw new StarterPackError('Only an admin can add starter pages.', 403);
118
+ }
119
+ return this.deps.choosing.run('starter-pack', async () => {
120
+ /**
121
+ * Every value this call has written as its claim, newest first: the one
122
+ * taken, and each renewal the fence wrote — or may have written, since a
123
+ * renewal whose outcome is unknown is still this call's to release.
124
+ */
125
+ const lease = { claims: [await this.claim(user)] };
126
+ let pack = null;
127
+ let added = [];
128
+ try {
129
+ // Judged UNDER the claim, so an answer another replica recorded and
130
+ // released between this call's start and its claim — a `none`, say
131
+ // — is found here rather than written over with a pack.
132
+ if ((await this.recordedChoice()) !== null)
133
+ throw alreadyChosen();
134
+ if (!(await this.knowledgeIsNew(true, user.email))) {
135
+ throw new StarterPackError('This knowledge base already has pages, so starter pages are no longer offered.', 409);
136
+ }
137
+ pack = id === NO_STARTER_PACK ? null : ((await loadStarterPacks(this.deps.disk, this.deps.packsDir)).find((p) => p.id === id) ?? null);
138
+ if (id !== NO_STARTER_PACK && !pack)
139
+ throw new StarterPackError(`There is no starter pack "${id}".`, 404);
140
+ if (pack)
141
+ added = await this.apply(user, pack, lease);
142
+ else {
143
+ // The skip is the effect itself: fenced the same way, and recorded
144
+ // only where nothing is answered.
145
+ await this.fence(lease, user);
146
+ if (!(await this.deps.settings.recordIfAbsent(STARTER_PACK_SETTING, id, user.id)))
147
+ throw alreadyChosen();
148
+ }
149
+ }
150
+ catch (err) {
151
+ // Refused, or nothing landed: the claim goes, and the question is
152
+ // open again (or answered, as the refusal said).
153
+ await this.release(lease);
154
+ throw err;
155
+ }
156
+ if (pack) {
157
+ // The answer, kept once the pack is there (or committed and waiting
158
+ // on its push) — and only where none is: an answer another replica
159
+ // recorded in the moment since the fence is theirs to keep. Should
160
+ // this fail now, the pack IS added: said in the log, answered as the
161
+ // success it is, and the pages close the question from here on
162
+ // (`knowledgeIsNew`).
163
+ await this.deps.settings
164
+ .recordIfAbsent(STARTER_PACK_SETTING, id, user.id)
165
+ .then((recorded) => {
166
+ if (!recorded)
167
+ log.error(`starter pack "${id}" was added, but another answer was recorded meanwhile`);
168
+ })
169
+ .catch((err) => {
170
+ log.error(`starter pack "${id}" was added, but the choice could not be recorded`, { err });
171
+ });
172
+ }
173
+ await this.release(lease);
174
+ if (!pack)
175
+ return { id, name: null, pages: 0, skills: 0, summary: '' };
176
+ const pages = added.filter((p) => this.isPage(p)).length;
177
+ const skills = added.filter((p) => path.posix.basename(p) === 'SKILL.md').length;
178
+ return { id: pack.id, name: pack.name, pages, skills, summary: summaryOf(pack, pages, skills) };
179
+ });
180
+ }
181
+ /** The chosen pack as the agent's first-run note needs it, or null. */
182
+ async firstRunStarter() {
183
+ const chosen = await this.recordedChoice();
184
+ if (!chosen || chosen === NO_STARTER_PACK)
185
+ return null;
186
+ const pack = (await loadStarterPacks(this.deps.disk, this.deps.packsDir)).find((p) => p.id === chosen);
187
+ if (!pack)
188
+ return null;
189
+ const knowledgeDir = this.deps.kb.layout.knowledgeBaseDir;
190
+ const pages = new Map();
191
+ for (const file of await this.pagesOf(pack)) {
192
+ pages.set(file.repoPath.slice(knowledgeDir.length + 1), file.content);
193
+ }
194
+ return { name: pack.name, suggestedPages: pack.suggestedPages, pages };
195
+ }
196
+ /** The recorded answer, read from the database so every replica agrees. */
197
+ async recordedChoice() {
198
+ return (await this.deps.settings.reload(STARTER_PACK_SETTING)) || null;
199
+ }
200
+ /**
201
+ * Take the claim or be refused: a live one is another admin's choice in
202
+ * flight, here or on another replica. One older than `CLAIM_TTL_MS` was
203
+ * left by a process that died mid-write and is taken over — through the
204
+ * same insert-if-absent, so two take-overs at once still end with one
205
+ * holder.
206
+ */
207
+ async claim(user) {
208
+ const { settings } = this.deps;
209
+ const value = `${user.id} ${Date.now()}`;
210
+ if (await settings.recordIfAbsent(STARTER_PACK_CLAIM_SETTING, value, user.id))
211
+ return value;
212
+ const held = await settings.reload(STARTER_PACK_CLAIM_SETTING);
213
+ const since = Number(held.split(' ').pop());
214
+ if (Number.isFinite(since) && Date.now() - since < CLAIM_TTL_MS)
215
+ throw beingAdded();
216
+ // The take-over replaces THAT claim, in one statement: two replicas that
217
+ // both read it expired cannot both succeed, since the second finds the
218
+ // first's claim where the expired one was and is refused.
219
+ log.warn('taking over a starter-pack claim nobody released', { held });
220
+ if (await settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, held, value, user.id))
221
+ return value;
222
+ // The claim moved under this read: another replica took it over — or
223
+ // its holder finished and released it, and the row is gone. One more
224
+ // try at an empty row before saying a choice is in progress.
225
+ if (await settings.recordIfAbsent(STARTER_PACK_CLAIM_SETTING, value, user.id))
226
+ return value;
227
+ throw beingAdded();
228
+ }
229
+ /**
230
+ * THE FENCE before the one effect: that the claim is still this call's,
231
+ * and that nothing has been answered. A claim is a promise with a deadline
232
+ * — one that expired while its holder was still at work (a clone that
233
+ * took minutes) is taken over, and the new holder may answer `none` — so
234
+ * the holder's own word that it holds the claim is checked against the
235
+ * database at the last moment, with every lock held and nothing written.
236
+ *
237
+ * Checked by RENEWING it, in one statement: the claim is replaced with a
238
+ * fresh one of this call's only where it still reads as this call's
239
+ * (`swapIfValue`), which both proves the claim and dates it anew, so the
240
+ * effect that follows has a whole `CLAIM_TTL_MS` before anyone may take
241
+ * the claim over — a commit takes seconds. Refused: nothing lands, and the
242
+ * claim, now a successor's, is left to them.
243
+ *
244
+ * The renewal joins the lease BEFORE it is written: a write whose outcome
245
+ * is unknown (the statement reached the database, its answer did not) may
246
+ * have landed, and a claim this call may have written is this call's to
247
+ * release, or the question would stand closed until it expired.
248
+ */
249
+ async fence(lease, user) {
250
+ const held = lease.claims[0];
251
+ const renewed = `${user.id} ${Date.now()}`;
252
+ lease.claims.unshift(renewed);
253
+ if (!(await this.deps.settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, held, renewed, user.id))) {
254
+ throw new StarterPackError('Another admin took this choice over while it was in progress; nothing was added. Try again.', 409);
255
+ }
256
+ if ((await this.recordedChoice()) !== null)
257
+ throw alreadyChosen();
258
+ }
259
+ /**
260
+ * Release one's OWN claim — never a successor's: a claim taken over after
261
+ * it expired is somebody else's now, and a late release must leave it.
262
+ * Whichever of the values this call wrote the row holds is released;
263
+ * each other value is simply not there. One that cannot be released
264
+ * expires on its own.
265
+ */
266
+ async release(lease) {
267
+ for (const claim of lease.claims) {
268
+ const released = await this.deps.settings.swapIfValue(STARTER_PACK_CLAIM_SETTING, claim, null, null).catch((err) => {
269
+ log.error('the starter-pack claim could not be released; it expires on its own', { err });
270
+ return false;
271
+ });
272
+ if (released)
273
+ return;
274
+ }
275
+ }
276
+ /**
277
+ * Whether the default branch's knowledge folder is still new. `clone`:
278
+ * whether a knowledge base not checked out yet may be (the choice writes to
279
+ * it, so it must); the status question never clones, and answers "no".
280
+ */
281
+ async knowledgeIsNew(clone, userEmail) {
282
+ const { kb, workspaceService, accessControl, disk } = this.deps;
283
+ if (!kb.isBranchModelConfigured())
284
+ return false;
285
+ const workspaceId = kb.defaultWorkspaceId();
286
+ if (!clone && !(await workspaceService.hasBootstrappedWorkspace(workspaceId)))
287
+ return false;
288
+ const ws = clone ? await workspaceService.getOrCreateForBranch(kb.defaultBranch) : { id: workspaceId };
289
+ const root = await workspaceService.getWorkspacePath(ws.id);
290
+ // As the CALLER may see it: being an admin grants no read of every page,
291
+ // and "offered" or "already has pages" must not tell them of one they
292
+ // may not read. The same gate `start_session`'s first-run note keeps —
293
+ // the knowledge folder itself first, then what is in it.
294
+ const knowledgeDir = kb.layout.knowledgeBaseDir;
295
+ const folder = await accessControl.canReadBatch(ws.id, userEmail, [knowledgeDir]);
296
+ if (folder.get(knowledgeDir) !== true)
297
+ return false;
298
+ const mayRead = async (rels) => {
299
+ const verdicts = await accessControl.canReadBatch(ws.id, userEmail, rels.map((rel) => `${knowledgeDir}/${rel}`));
300
+ return new Map(rels.map((rel) => [rel, verdicts.get(`${knowledgeDir}/${rel}`) === true]));
301
+ };
302
+ return knowledgeFolderIsNew(disk, path.join(root, kb.kbDirName), knowledgeDir, undefined, mayRead);
303
+ }
304
+ /** The pack's pages: its text files under the knowledge folder. */
305
+ async pagesOf(pack) {
306
+ const files = await starterPackFiles(this.deps.disk, pack, this.deps.kb.layout);
307
+ return files.filter((f) => f.root === 'KnowledgeBase' && typeof f.content === 'string' && this.isPage(f.repoPath));
308
+ }
309
+ /** A page: a file under the knowledge folder that is not its access rules. */
310
+ isPage(repoOrWsPath) {
311
+ const { kbDirName, layout } = this.deps.kb;
312
+ const rel = repoOrWsPath.startsWith(`${kbDirName}/`) ? repoOrWsPath.slice(kbDirName.length + 1) : repoOrWsPath;
313
+ return rel.startsWith(`${layout.knowledgeBaseDir}/`) && path.posix.basename(rel) !== 'access.md';
314
+ }
315
+ /**
316
+ * The pack's pages still as it wrote them, workspace-relative, and only
317
+ * those the caller may read: the list says a page exists and holds what
318
+ * the pack wrote, which is nothing to tell someone the page's access rules
319
+ * keep out — the same verdict the file routes give. Never clones.
320
+ */
321
+ async untouchedPages(pack, userEmail) {
322
+ const { kb, workspaceService, accessControl } = this.deps;
323
+ try {
324
+ if (!kb.isBranchModelConfigured())
325
+ return [];
326
+ const workspaceId = kb.defaultWorkspaceId();
327
+ if (!(await workspaceService.hasBootstrappedWorkspace(workspaceId)))
328
+ return [];
329
+ const root = await workspaceService.getWorkspacePath(workspaceId);
330
+ const pages = await this.pagesOf(pack);
331
+ const readable = await accessControl.canReadBatch(workspaceId, userEmail, pages.map((p) => p.repoPath));
332
+ const out = [];
333
+ for (const page of pages) {
334
+ if (!readable.get(page.repoPath))
335
+ continue;
336
+ const wsPath = `${kb.kbDirName}/${page.repoPath}`;
337
+ if (await isUntouchedStarterPage(path.join(root, ...wsPath.split('/')), page.content))
338
+ out.push(wsPath);
339
+ }
340
+ return out;
341
+ }
342
+ catch (err) {
343
+ // A courtesy for the first-page step; an unreadable clone just means
344
+ // every page counts as written.
345
+ log.debug('could not tell which starter pages are untouched', {
346
+ error: err instanceof Error ? err.message : String(err),
347
+ });
348
+ return [];
349
+ }
350
+ }
351
+ /**
352
+ * Write the pack's absent files to the default branch as one commit;
353
+ * resolve to the paths written. `lease` is this call's claim, checked and
354
+ * renewed at the last moment (see `fence`).
355
+ */
356
+ async apply(user, pack, lease) {
357
+ const { kb, workspaceService, workflow, disk } = this.deps;
358
+ const branch = kb.defaultBranch;
359
+ const ws = await workspaceService.getOrCreateForBranch(branch);
360
+ const basePath = await workspaceService.getWorkspacePath(ws.id);
361
+ const files = await starterPackFiles(disk, pack, kb.layout);
362
+ // Held from the name check to the commit: the names the pack's plugins
363
+ // would take, on the lock a creation or a deletion of one of them takes.
364
+ return this.deps.pluginLocks.withIdentities(packPluginFolders(files, kb.layout.pluginsDir), async () => {
365
+ const writes = await this.plan(user, pack, files, path.join(basePath, kb.kbDirName));
366
+ const fsys = new LockingFilesystem({ basePath, contained: true }, { workflow, workspaceId: ws.id, branch, user, kbDirName: kb.kbDirName, fileChanges: this.deps.fileChanges });
367
+ let written = [];
368
+ try {
369
+ await fsys.writeFiles(writes, commitSubjectOf(pack), [], async (candidates) => {
370
+ // With every lock held and nothing written yet: first that this
371
+ // call may still add anything at all (a check that throws refuses
372
+ // the whole batch untouched), then only what is STILL absent, so a
373
+ // page someone made a moment ago is never replaced.
374
+ await this.fence(lease, user);
375
+ const absent = [];
376
+ for (const w of candidates) {
377
+ if (!(await disk.exists(path.join(basePath, ...w.path.split('/')))))
378
+ absent.push(w);
379
+ }
380
+ written = absent.map((w) => w.path);
381
+ return absent;
382
+ });
383
+ }
384
+ catch (err) {
385
+ // The commit landed and only its push is waiting: the pending-commit
386
+ // worker retries it, and the sync banner says so. The pack IS added.
387
+ if (!(err instanceof PushNeedsAgentResolutionError))
388
+ throw err;
389
+ log.warn(`starter pack "${pack.id}" committed; its push is being retried`, { error: err.message });
390
+ }
391
+ if (written.length > 0) {
392
+ // The plugin's rules joined the access model.
393
+ this.deps.accessControl.invalidate(ws.id);
394
+ this.deps.events?.emit({ kind: 'fs-tree-changed', workspaceId: ws.id, branch });
395
+ }
396
+ return written;
397
+ });
398
+ }
399
+ /**
400
+ * The batch to write, workspace-relative: every pack file, with each plugin
401
+ * the pack carries made the admin's (see the module doc) — or left out
402
+ * whole when a plugin by that name is already there: a folder of that name
403
+ * at the plugins root, whatever it holds, or a plugin discovery lists under
404
+ * the same slug at any depth (one in a grouping folder included — the
405
+ * catalog would show two plugins of one name, and a grant would reach the
406
+ * wrong one). Refused outright when discovery could not read part of the
407
+ * checkout: a name cannot be proved free over a hole.
408
+ */
409
+ async plan(user, pack, files, repoDir) {
410
+ const { kbDirName, layout } = this.deps.kb;
411
+ const [existingFolders, discovered] = await Promise.all([
412
+ folderNames(this.deps.disk, path.join(repoDir, layout.pluginsDir)),
413
+ this.deps.pluginSource.discover(repoDir),
414
+ ]);
415
+ if (discovered.unreadable.length > 0) {
416
+ throw new StarterPackError(`Some of the knowledge base could not be read (${discovered.unreadable.join(', ')}), so the pack cannot be checked against the plugins already there. Try again.`, 503);
417
+ }
418
+ const writes = [];
419
+ const plugins = new Map();
420
+ for (const file of files) {
421
+ if (file.root !== 'Plugins') {
422
+ writes.push({ path: `${kbDirName}/${file.repoPath}`, content: file.content });
423
+ continue;
424
+ }
425
+ const folder = pluginFolderOf(file, layout.pluginsDir);
426
+ plugins.set(folder, [...(plugins.get(folder) ?? []), file]);
427
+ }
428
+ for (const [folder, pluginFiles] of plugins) {
429
+ const slug = pluginManifestName(folder);
430
+ if (slug.startsWith(PERSONAL_PLUGIN_PREFIX)) {
431
+ log.warn(`starter pack "${pack.id}": "${folder}" is a personal folder's name — plugin skipped.`);
432
+ continue;
433
+ }
434
+ const taken = existingFolders.find((name) => name.toLowerCase() === folder.toLowerCase() || pluginManifestName(name) === slug) ??
435
+ discovered.plugins.find((p) => pluginManifestName(p.name) === slug)?.folder;
436
+ if (taken) {
437
+ log.info(`starter pack "${pack.id}": a plugin "${taken}" is already there — its files are left as they are.`);
438
+ continue;
439
+ }
440
+ const root = `${layout.pluginsDir}/${folder}`;
441
+ let shippedAccess = null;
442
+ let hasManifest = false;
443
+ for (const file of pluginFiles) {
444
+ if (file.repoPath === `${root}/access.md`) {
445
+ shippedAccess = typeof file.content === 'string' ? file.content : null;
446
+ continue;
447
+ }
448
+ if (file.repoPath === `${root}/${PLUGIN_MANIFEST_FILE}`)
449
+ hasManifest = true;
450
+ writes.push({ path: `${kbDirName}/${file.repoPath}`, content: file.content });
451
+ }
452
+ writes.push({
453
+ path: `${kbDirName}/${root}/access.md`,
454
+ content: shippedAccess ? withCreatorGrants(shippedAccess, user) : pluginAccessMd(user),
455
+ });
456
+ if (!hasManifest)
457
+ writes.push({ path: `${kbDirName}/${root}/${PLUGIN_MANIFEST_FILE}`, content: renderPluginManifest(folder) });
458
+ }
459
+ return writes;
460
+ }
461
+ }
462
+ function alreadyChosen() {
463
+ return new StarterPackError('Starter pages were already chosen for this knowledge base.', 409);
464
+ }
465
+ function beingAdded() {
466
+ return new StarterPackError('Starter pages are being added right now. Try again in a moment.', 409);
467
+ }
468
+ /** The plugin folder (its first segment under the plugins root) a pack's plugin file belongs to. */
469
+ function pluginFolderOf(file, pluginsDir) {
470
+ return file.repoPath.slice(pluginsDir.length + 1).split('/')[0];
471
+ }
472
+ /** The plugin folders a pack carries, each once. */
473
+ function packPluginFolders(files, pluginsDir) {
474
+ return [...new Set(files.filter((f) => f.root === 'Plugins').map((f) => pluginFolderOf(f, pluginsDir)))];
475
+ }
476
+ /** The commit's subject: "Add starter pages and skills for Sales". */
477
+ export function commitSubjectOf(pack) {
478
+ return pack.id === CATCH_ALL_PACK ? 'Add starter pages and skills' : `Add starter pages and skills for ${pack.name}`;
479
+ }
480
+ /** "Added 4 pages and 1 skill for Sales." */
481
+ export function summaryOf(pack, pages, skills) {
482
+ const count = (n, one) => `${n} ${one}${n === 1 ? '' : 's'}`;
483
+ const parts = [pages > 0 ? count(pages, 'page') : null, skills > 0 ? count(skills, 'skill') : null].filter(Boolean);
484
+ if (parts.length === 0)
485
+ return 'Everything in this pack was already here.';
486
+ return `Added ${parts.join(' and ')}${pack.id === CATCH_ALL_PACK ? '' : ` for ${pack.name}`}.`;
487
+ }
488
+ /** The folders in `dir`, by name; none when it is not there. A folder that cannot be listed is the error: a name cannot be proved free over a hole. */
489
+ async function folderNames(disk, dir) {
490
+ return ((await disk.listDir(dir)) ?? []).filter((e) => e.isDirectory()).map((e) => e.name);
491
+ }
492
+ //# sourceMappingURL=starter-pack.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter-pack.service.js","sourceRoot":"","sources":["../../../src/modules/onboarding/starter-pack.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,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AC,CAAC,GAAG,EAAE,CAAC;IAC7E,MAAM,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,2CAA2C,CAAC;IAC3E,OAAO,SAAS,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC;AACjG,CAAC;AAED,uJAAuJ;AACvJ,KAAK,UAAU,WAAW,CAAC,IAAc,EAAE,GAAW;IACpD,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Starter packs: the pages and the plugin a new knowledge base can be filled
3
+ * with in one click, chosen by what the team does.
4
+ *
5
+ * A pack is a folder under the packs root (`starter-packs/` in this package,
6
+ * or a distribution's `STARTER_PACKS_DIR`):
7
+ *
8
+ * <id>/pack.yaml id, name, description, order, firstPagePrompt, suggestedPages
9
+ * <id>/KnowledgeBase/… pages, under the DEFAULT layout's folder names
10
+ * <id>/Plugins/<name>/… a team plugin in the normal plugin layout
11
+ * <id>/Skills/… shared skills, if a pack carries any
12
+ *
13
+ * The three folders are written under the deployment's OWN names for them
14
+ * (`KnowledgeBase/` lands in whatever `knowledgeBaseDir` is), so a pack is
15
+ * authored once and fits every layout. Anything else in a pack folder (a
16
+ * README, notes for whoever maintains it) is the pack's, not the knowledge
17
+ * base's, and is never copied.
18
+ *
19
+ * A pack that does not read as one — no `pack.yaml`, a field missing or of
20
+ * the wrong kind, an id that is not its folder's name — is passed over with
21
+ * a warning: one broken folder must not take the choice away from everyone.
22
+ *
23
+ * The disk is read through the one walk and the one probe
24
+ * (`shared/fs.contract.ts`), handed in by the caller; only a file's bytes are
25
+ * read here, which neither contract covers.
26
+ */
27
+ import { type KbLayout } from '@bevel-software/platform-shared';
28
+ import type { IFsProbe, ITreeWalker } from '../../shared/fs.contract.js';
29
+ /** The file that makes a folder a pack. */
30
+ export declare const PACK_MANIFEST = "pack.yaml";
31
+ /** The answer that chooses no pack: "Skip, I'll start from scratch". Never a pack's id. */
32
+ export declare const NO_STARTER_PACK = "none";
33
+ /** The pack's own folders, by their default-layout names, and the layout key each one is written under. */
34
+ export declare const PACK_ROOTS: ReadonlyArray<readonly [string, keyof Pick<KbLayout, 'knowledgeBaseDir' | 'pluginsDir' | 'skillsDir'>]>;
35
+ /** What a chip shows, and the order the chips come in. */
36
+ export interface StarterPackSummary {
37
+ id: string;
38
+ name: string;
39
+ description: string;
40
+ order: number;
41
+ }
42
+ export interface StarterPack extends StarterPackSummary {
43
+ /** Replaces the generic "write your first page" request for a team that chose this pack. */
44
+ firstPagePrompt: string;
45
+ /** The pages the agent's first-run note offers to draft. */
46
+ suggestedPages: string[];
47
+ /** The pack's folder, absolute. */
48
+ dir: string;
49
+ }
50
+ /** One file a pack would add, at the path it would have in the knowledge base. */
51
+ export interface StarterPackFile {
52
+ /** Repository-relative, under the deployment's layout: `KnowledgeBase/About us.md`, `Plugins/x/skills/y/SKILL.md`. */
53
+ repoPath: string;
54
+ /** Which of the pack's folders it came from, by its default name. */
55
+ root: (typeof PACK_ROOTS)[number][0];
56
+ /** The bytes to write: text with the layout placeholders filled, or the file as it is. */
57
+ content: string | Buffer;
58
+ }
59
+ /**
60
+ * Every valid pack under `root`, chip order first (then name). A root that
61
+ * is not there offers no packs; it is not an error, since a distribution may
62
+ * ship none.
63
+ */
64
+ export declare function loadStarterPacks(disk: IFsProbe, root: string): Promise<StarterPack[]>;
65
+ /** The pack in `dir`, or null (with a warning saying why) when it does not read as one. */
66
+ export declare function readStarterPack(disk: IFsProbe, dir: string): Promise<StarterPack | null>;
67
+ /** Why a parsed `pack.yaml` is not a pack, or null when it is one. */
68
+ export declare function packProblem(manifest: unknown, folder: string): string | null;
69
+ /**
70
+ * Every file the pack would add, at its path under `layout`, in walk order.
71
+ * The knowledge-base walk lists them: dot-entries are left behind (an
72
+ * editor's or an OS's droppings, never content), and so is anything that is
73
+ * not a regular file — a pack is files. A pack folder that is not there, or
74
+ * is a file where a folder was expected, holds nothing; a folder in one that
75
+ * cannot be listed is the error, since a pack with a hole is not the pack.
76
+ */
77
+ export declare function starterPackFiles(disk: ITreeWalker, pack: StarterPack, layout: Required<KbLayout>): Promise<StarterPackFile[]>;
78
+ //# sourceMappingURL=starter-packs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"starter-packs.d.ts","sourceRoot":"","sources":["../../../src/modules/onboarding/starter-packs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,EAA8B,KAAK,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAe,MAAM,6BAA6B,CAAC;AAMtF,2CAA2C;AAC3C,eAAO,MAAM,aAAa,cAAc,CAAC;AAEzC,2FAA2F;AAC3F,eAAO,MAAM,eAAe,SAAS,CAAC;AAKtC,2GAA2G;AAC3G,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,QAAQ,EAAE,kBAAkB,GAAG,Y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