@bevel-software/platform-core-backend 0.25.2 → 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 (733) hide show
  1. package/agent-guide/access-control.md +251 -0
  2. package/agent-guide/conventions.md +35 -0
  3. package/agent-guide/directory-structure.md +145 -0
  4. package/agent-guide/finding-things.md +7 -0
  5. package/agent-guide/html-views.md +83 -0
  6. package/agent-guide/introduction.md +27 -0
  7. package/agent-guide/new-knowledge-base.md +24 -0
  8. package/agent-guide/skills.md +47 -0
  9. package/agent-guide/tool-manuals.md +227 -0
  10. package/agent-guide/where-a-new-file-goes.md +36 -0
  11. package/dist/assets.d.ts +26 -0
  12. package/dist/assets.d.ts.map +1 -1
  13. package/dist/assets.js +35 -2
  14. package/dist/assets.js.map +1 -1
  15. package/dist/core/catalog-revision.d.ts +19 -1
  16. package/dist/core/catalog-revision.d.ts.map +1 -1
  17. package/dist/core/catalog-revision.js +14 -3
  18. package/dist/core/catalog-revision.js.map +1 -1
  19. package/dist/core/core-ports.d.ts +11 -0
  20. package/dist/core/core-ports.d.ts.map +1 -1
  21. package/dist/core/core-ports.js.map +1 -1
  22. package/dist/core/create-core-server.d.ts +5 -0
  23. package/dist/core/create-core-server.d.ts.map +1 -1
  24. package/dist/core/create-core-server.js +65 -3
  25. package/dist/core/create-core-server.js.map +1 -1
  26. package/dist/core/create-core-services.d.ts +35 -0
  27. package/dist/core/create-core-services.d.ts.map +1 -1
  28. package/dist/core/create-core-services.js +114 -12
  29. package/dist/core/create-core-services.js.map +1 -1
  30. package/dist/core/lifecycle.d.ts +16 -1
  31. package/dist/core/lifecycle.d.ts.map +1 -1
  32. package/dist/core/lifecycle.js +18 -1
  33. package/dist/core/lifecycle.js.map +1 -1
  34. package/dist/core-config.d.ts +21 -0
  35. package/dist/core-config.d.ts.map +1 -1
  36. package/dist/core-config.js +22 -1
  37. package/dist/core-config.js.map +1 -1
  38. package/dist/index.d.ts +1 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +2 -2
  41. package/dist/index.js.map +1 -1
  42. package/dist/modules/access/access-control.interface.d.ts +17 -0
  43. package/dist/modules/access/access-control.interface.d.ts.map +1 -1
  44. package/dist/modules/access/access-control.service.d.ts +2 -0
  45. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  46. package/dist/modules/access/access-control.service.js +27 -0
  47. package/dist/modules/access/access-control.service.js.map +1 -1
  48. package/dist/modules/access/directory-sync-bot.js +1 -1
  49. package/dist/modules/access/directory-sync-bot.js.map +1 -1
  50. package/dist/modules/agent-guide/agent-guide.d.ts +145 -0
  51. package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -0
  52. package/dist/modules/agent-guide/agent-guide.js +199 -0
  53. package/dist/modules/agent-guide/agent-guide.js.map +1 -0
  54. package/dist/modules/agent-guide/agent-guide.tools.d.ts +24 -0
  55. package/dist/modules/agent-guide/agent-guide.tools.d.ts.map +1 -0
  56. package/dist/modules/agent-guide/agent-guide.tools.js +100 -0
  57. package/dist/modules/agent-guide/agent-guide.tools.js.map +1 -0
  58. package/dist/modules/agent-guide/index.d.ts +4 -0
  59. package/dist/modules/agent-guide/index.d.ts.map +1 -0
  60. package/dist/modules/agent-guide/index.js +4 -0
  61. package/dist/modules/agent-guide/index.js.map +1 -0
  62. package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +3 -2
  63. package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
  64. package/dist/modules/agent-instructions/agent-instructions.routes.js +3 -2
  65. package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
  66. package/dist/modules/agent-instructions/compose.d.ts +14 -6
  67. package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
  68. package/dist/modules/agent-instructions/compose.js +28 -8
  69. package/dist/modules/agent-instructions/compose.js.map +1 -1
  70. package/dist/modules/agent-instructions/index.d.ts +1 -1
  71. package/dist/modules/agent-instructions/index.d.ts.map +1 -1
  72. package/dist/modules/agent-instructions/index.js +1 -1
  73. package/dist/modules/agent-instructions/index.js.map +1 -1
  74. package/dist/modules/agent-instructions/shared-file-rules.d.ts +10 -50
  75. package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
  76. package/dist/modules/agent-instructions/shared-file-rules.js +51 -104
  77. package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
  78. package/dist/modules/audit/agent-audit.service.d.ts +21 -2
  79. package/dist/modules/audit/agent-audit.service.d.ts.map +1 -1
  80. package/dist/modules/audit/agent-audit.service.js +43 -2
  81. package/dist/modules/audit/agent-audit.service.js.map +1 -1
  82. package/dist/modules/audit/agent-connection.routes.d.ts +34 -0
  83. package/dist/modules/audit/agent-connection.routes.d.ts.map +1 -0
  84. package/dist/modules/audit/agent-connection.routes.js +38 -0
  85. package/dist/modules/audit/agent-connection.routes.js.map +1 -0
  86. package/dist/modules/audit/audit.contract.d.ts +24 -0
  87. package/dist/modules/audit/audit.contract.d.ts.map +1 -1
  88. package/dist/modules/audit/audit.contract.js.map +1 -1
  89. package/dist/modules/audit/index.d.ts +1 -0
  90. package/dist/modules/audit/index.d.ts.map +1 -1
  91. package/dist/modules/audit/index.js +1 -0
  92. package/dist/modules/audit/index.js.map +1 -1
  93. package/dist/modules/auth/account.routes.d.ts.map +1 -1
  94. package/dist/modules/auth/account.routes.js +10 -3
  95. package/dist/modules/auth/account.routes.js.map +1 -1
  96. package/dist/modules/auth/auth.middleware.d.ts +7 -0
  97. package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
  98. package/dist/modules/auth/auth.middleware.js +1 -1
  99. package/dist/modules/auth/auth.middleware.js.map +1 -1
  100. package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
  101. package/dist/modules/code-mode/code-mode.tool.js +11 -3
  102. package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
  103. package/dist/modules/database/core-schema.d.ts +96 -0
  104. package/dist/modules/database/core-schema.d.ts.map +1 -1
  105. package/dist/modules/database/core-schema.js +32 -3
  106. package/dist/modules/database/core-schema.js.map +1 -1
  107. package/dist/modules/embed/account-link.service.d.ts +42 -0
  108. package/dist/modules/embed/account-link.service.d.ts.map +1 -0
  109. package/dist/modules/embed/account-link.service.js +50 -0
  110. package/dist/modules/embed/account-link.service.js.map +1 -0
  111. package/dist/modules/embed/embed-link.d.ts +58 -0
  112. package/dist/modules/embed/embed-link.d.ts.map +1 -0
  113. package/dist/modules/embed/embed-link.js +160 -0
  114. package/dist/modules/embed/embed-link.js.map +1 -0
  115. package/dist/modules/embed/embed.errors.d.ts +30 -0
  116. package/dist/modules/embed/embed.errors.d.ts.map +1 -0
  117. package/dist/modules/embed/embed.errors.js +42 -0
  118. package/dist/modules/embed/embed.errors.js.map +1 -0
  119. package/dist/modules/embed/embed.interface.d.ts +204 -0
  120. package/dist/modules/embed/embed.interface.d.ts.map +1 -0
  121. package/dist/modules/embed/embed.interface.js +2 -0
  122. package/dist/modules/embed/embed.interface.js.map +1 -0
  123. package/dist/modules/embed/embed.routes.d.ts +59 -0
  124. package/dist/modules/embed/embed.routes.d.ts.map +1 -0
  125. package/dist/modules/embed/embed.routes.js +343 -0
  126. package/dist/modules/embed/embed.routes.js.map +1 -0
  127. package/dist/modules/embed/embed.service.d.ts +169 -0
  128. package/dist/modules/embed/embed.service.d.ts.map +1 -0
  129. package/dist/modules/embed/embed.service.js +627 -0
  130. package/dist/modules/embed/embed.service.js.map +1 -0
  131. package/dist/modules/embed/embed.tools.d.ts +51 -0
  132. package/dist/modules/embed/embed.tools.d.ts.map +1 -0
  133. package/dist/modules/embed/embed.tools.js +170 -0
  134. package/dist/modules/embed/embed.tools.js.map +1 -0
  135. package/dist/modules/embed/mcp-app.d.ts +64 -0
  136. package/dist/modules/embed/mcp-app.d.ts.map +1 -0
  137. package/dist/modules/embed/mcp-app.js +147 -0
  138. package/dist/modules/embed/mcp-app.js.map +1 -0
  139. package/dist/modules/embed/mcp-app.routes.d.ts +21 -0
  140. package/dist/modules/embed/mcp-app.routes.d.ts.map +1 -0
  141. package/dist/modules/embed/mcp-app.routes.js +36 -0
  142. package/dist/modules/embed/mcp-app.routes.js.map +1 -0
  143. package/dist/modules/github-app/github-app.connection.d.ts +15 -0
  144. package/dist/modules/github-app/github-app.connection.d.ts.map +1 -1
  145. package/dist/modules/github-app/github-app.connection.js +34 -3
  146. package/dist/modules/github-app/github-app.connection.js.map +1 -1
  147. package/dist/modules/kb-fs/locking-filesystem.d.ts +65 -0
  148. package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
  149. package/dist/modules/kb-fs/locking-filesystem.js +300 -0
  150. package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
  151. package/dist/modules/kb-sync/kb-sync.interface.d.ts +5 -0
  152. package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
  153. package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
  154. package/dist/modules/kb-sync/kb-sync.service.js +6 -0
  155. package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
  156. package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
  157. package/dist/modules/mcp/mcp-auth.middleware.js +2 -1
  158. package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
  159. package/dist/modules/mcp/mcp.service.d.ts +57 -3
  160. package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
  161. package/dist/modules/mcp/mcp.service.js +177 -24
  162. package/dist/modules/mcp/mcp.service.js.map +1 -1
  163. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +24 -0
  164. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
  165. package/dist/modules/mcp/oauth/bevel-oauth-provider.js +32 -4
  166. package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
  167. package/dist/modules/mcp/tool-schema-guard.d.ts +105 -0
  168. package/dist/modules/mcp/tool-schema-guard.d.ts.map +1 -0
  169. package/dist/modules/mcp/tool-schema-guard.js +171 -0
  170. package/dist/modules/mcp/tool-schema-guard.js.map +1 -0
  171. package/dist/modules/onboarding/onboarding.contract.d.ts +80 -0
  172. package/dist/modules/onboarding/onboarding.contract.d.ts.map +1 -0
  173. package/dist/modules/onboarding/onboarding.contract.js +7 -0
  174. package/dist/modules/onboarding/onboarding.contract.js.map +1 -0
  175. package/dist/modules/onboarding/onboarding.routes.d.ts +18 -0
  176. package/dist/modules/onboarding/onboarding.routes.d.ts.map +1 -0
  177. package/dist/modules/onboarding/onboarding.routes.js +81 -0
  178. package/dist/modules/onboarding/onboarding.routes.js.map +1 -0
  179. package/dist/modules/onboarding/starter-pack.service.d.ts +213 -0
  180. package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -0
  181. package/dist/modules/onboarding/starter-pack.service.js +492 -0
  182. package/dist/modules/onboarding/starter-pack.service.js.map +1 -0
  183. package/dist/modules/onboarding/starter-packs.d.ts +78 -0
  184. package/dist/modules/onboarding/starter-packs.d.ts.map +1 -0
  185. package/dist/modules/onboarding/starter-packs.js +156 -0
  186. package/dist/modules/onboarding/starter-packs.js.map +1 -0
  187. package/dist/modules/plugins/index.d.ts +1 -1
  188. package/dist/modules/plugins/index.d.ts.map +1 -1
  189. package/dist/modules/plugins/index.js +1 -1
  190. package/dist/modules/plugins/index.js.map +1 -1
  191. package/dist/modules/plugins/plugin-provision.service.d.ts +19 -0
  192. package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
  193. package/dist/modules/plugins/plugin-provision.service.js +18 -1
  194. package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
  195. package/dist/modules/plugins/plugins.routes.d.ts +0 -36
  196. package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
  197. package/dist/modules/plugins/plugins.routes.js +31 -0
  198. package/dist/modules/plugins/plugins.routes.js.map +1 -1
  199. package/dist/modules/plugins/plugins.tools.d.ts +36 -2
  200. package/dist/modules/plugins/plugins.tools.d.ts.map +1 -1
  201. package/dist/modules/plugins/plugins.tools.js +71 -14
  202. package/dist/modules/plugins/plugins.tools.js.map +1 -1
  203. package/dist/modules/settings/deployment-settings.service.d.ts +34 -7
  204. package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
  205. package/dist/modules/settings/deployment-settings.service.js +148 -54
  206. package/dist/modules/settings/deployment-settings.service.js.map +1 -1
  207. package/dist/modules/settings/repository-source.d.ts +1 -0
  208. package/dist/modules/settings/repository-source.d.ts.map +1 -1
  209. package/dist/modules/settings/repository-source.js +3 -3
  210. package/dist/modules/settings/repository-source.js.map +1 -1
  211. package/dist/modules/settings/setup.routes.d.ts.map +1 -1
  212. package/dist/modules/settings/setup.routes.js +3 -6
  213. package/dist/modules/settings/setup.routes.js.map +1 -1
  214. package/dist/modules/skills/skills.tools.d.ts.map +1 -1
  215. package/dist/modules/skills/skills.tools.js +103 -43
  216. package/dist/modules/skills/skills.tools.js.map +1 -1
  217. package/dist/modules/tool-auth/connection-key-rejection.d.ts +10 -1
  218. package/dist/modules/tool-auth/connection-key-rejection.d.ts.map +1 -1
  219. package/dist/modules/tool-auth/connection-key-rejection.js +11 -3
  220. package/dist/modules/tool-auth/connection-key-rejection.js.map +1 -1
  221. package/dist/modules/tool-auth/external-api-key.interface.d.ts +8 -0
  222. package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
  223. package/dist/modules/tool-auth/external-api-key.service.d.ts +24 -2
  224. package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
  225. package/dist/modules/tool-auth/external-api-key.service.js +59 -2
  226. package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
  227. package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
  228. package/dist/modules/tool-auth/tool-auth.middleware.js +9 -4
  229. package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
  230. package/dist/modules/tool-helpers/index.d.ts +28 -1
  231. package/dist/modules/tool-helpers/index.d.ts.map +1 -1
  232. package/dist/modules/tool-helpers/index.js +28 -1
  233. package/dist/modules/tool-helpers/index.js.map +1 -1
  234. package/dist/modules/tool-helpers/route-argument-check.d.ts +10 -0
  235. package/dist/modules/tool-helpers/route-argument-check.d.ts.map +1 -0
  236. package/dist/modules/tool-helpers/route-argument-check.js +132 -0
  237. package/dist/modules/tool-helpers/route-argument-check.js.map +1 -0
  238. package/dist/modules/tool-helpers/route-tool-schemas.d.ts +89 -0
  239. package/dist/modules/tool-helpers/route-tool-schemas.d.ts.map +1 -0
  240. package/dist/modules/tool-helpers/route-tool-schemas.js +113 -0
  241. package/dist/modules/tool-helpers/route-tool-schemas.js.map +1 -0
  242. package/dist/modules/tool-helpers/tool-def.d.ts +71 -0
  243. package/dist/modules/tool-helpers/tool-def.d.ts.map +1 -1
  244. package/dist/modules/tool-helpers/tool-def.js +70 -6
  245. package/dist/modules/tool-helpers/tool-def.js.map +1 -1
  246. package/dist/modules/tool-helpers/tool-handler.d.ts +46 -6
  247. package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
  248. package/dist/modules/tool-helpers/tool-handler.js +157 -8
  249. package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
  250. package/dist/modules/tool-helpers/tool.contract.d.ts +9 -0
  251. package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
  252. package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
  253. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +23 -4
  254. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
  255. package/dist/modules/tool-manuals/tool-manuals.contract.js.map +1 -1
  256. package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -0
  257. package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
  258. package/dist/modules/tool-manuals/tool-manuals.service.js +14 -0
  259. package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
  260. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +7 -0
  261. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
  262. package/dist/modules/tool-manuals/tool-manuals.tools.js +77 -38
  263. package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
  264. package/dist/modules/tool-registry/description-length.d.ts +20 -16
  265. package/dist/modules/tool-registry/description-length.d.ts.map +1 -1
  266. package/dist/modules/tool-registry/description-length.js +50 -30
  267. package/dist/modules/tool-registry/description-length.js.map +1 -1
  268. package/dist/modules/tool-registry/guide-first.d.ts +27 -0
  269. package/dist/modules/tool-registry/guide-first.d.ts.map +1 -0
  270. package/dist/modules/tool-registry/guide-first.js +40 -0
  271. package/dist/modules/tool-registry/guide-first.js.map +1 -0
  272. package/dist/modules/tool-registry/tool-registry.d.ts +6 -0
  273. package/dist/modules/tool-registry/tool-registry.d.ts.map +1 -1
  274. package/dist/modules/tool-registry/tool-registry.js +9 -2
  275. package/dist/modules/tool-registry/tool-registry.js.map +1 -1
  276. package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts +449 -0
  277. package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +1 -0
  278. package/dist/modules/workflow/agent-tools/change-request-read-shape.js +481 -0
  279. package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +1 -0
  280. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts +126 -0
  281. package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -0
  282. package/dist/modules/workflow/agent-tools/change-request-read.tools.js +611 -0
  283. package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -0
  284. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +12 -1
  285. package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -1
  286. package/dist/modules/workflow/agent-tools/change-request-summary.js +5 -1
  287. package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -1
  288. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +8 -1
  289. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
  290. package/dist/modules/workflow/agent-tools/workflow.tools.js +133 -37
  291. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
  292. package/dist/modules/workflow/file-lock.service.d.ts +29 -5
  293. package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
  294. package/dist/modules/workflow/file-lock.service.js +62 -5
  295. package/dist/modules/workflow/file-lock.service.js.map +1 -1
  296. package/dist/modules/workflow/git/git.service.d.ts +282 -14
  297. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  298. package/dist/modules/workflow/git/git.service.js +627 -126
  299. package/dist/modules/workflow/git/git.service.js.map +1 -1
  300. package/dist/modules/workflow/git/merge-commit.d.ts +73 -0
  301. package/dist/modules/workflow/git/merge-commit.d.ts.map +1 -0
  302. package/dist/modules/workflow/git/merge-commit.js +89 -0
  303. package/dist/modules/workflow/git/merge-commit.js.map +1 -0
  304. package/dist/modules/workflow/git/node-git-runner.d.ts +15 -0
  305. package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
  306. package/dist/modules/workflow/git/node-git-runner.js +78 -6
  307. package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
  308. package/dist/modules/workflow/git/pull-request.service.d.ts +94 -1
  309. package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
  310. package/dist/modules/workflow/git/pull-request.service.js +332 -37
  311. package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
  312. package/dist/modules/workflow/pending-commits.service.d.ts +15 -0
  313. package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
  314. package/dist/modules/workflow/pending-commits.service.js +25 -1
  315. package/dist/modules/workflow/pending-commits.service.js.map +1 -1
  316. package/dist/modules/workflow/pending-commits.worker.d.ts +6 -1
  317. package/dist/modules/workflow/pending-commits.worker.d.ts.map +1 -1
  318. package/dist/modules/workflow/pending-commits.worker.js +23 -6
  319. package/dist/modules/workflow/pending-commits.worker.js.map +1 -1
  320. package/dist/modules/workflow/recovery-bot.js +1 -1
  321. package/dist/modules/workflow/recovery-bot.js.map +1 -1
  322. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts +35 -0
  323. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
  324. package/dist/modules/workflow/review-workflow/review-workflow.service.js +180 -13
  325. package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
  326. package/dist/modules/workflow/sanitize-error.d.ts +16 -0
  327. package/dist/modules/workflow/sanitize-error.d.ts.map +1 -1
  328. package/dist/modules/workflow/sanitize-error.js +45 -0
  329. package/dist/modules/workflow/sanitize-error.js.map +1 -1
  330. package/dist/modules/workflow/workflow.routes.d.ts +6 -2
  331. package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
  332. package/dist/modules/workflow/workflow.routes.js +7 -2
  333. package/dist/modules/workflow/workflow.routes.js.map +1 -1
  334. package/dist/modules/workflow/workflow.service.d.ts +187 -15
  335. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  336. package/dist/modules/workflow/workflow.service.js +808 -106
  337. package/dist/modules/workflow/workflow.service.js.map +1 -1
  338. package/dist/modules/workspace/agent-download.builder.d.ts +105 -0
  339. package/dist/modules/workspace/agent-download.builder.d.ts.map +1 -0
  340. package/dist/modules/workspace/agent-download.builder.js +238 -0
  341. package/dist/modules/workspace/agent-download.builder.js.map +1 -0
  342. package/dist/modules/workspace/agent-download.routes.d.ts +77 -0
  343. package/dist/modules/workspace/agent-download.routes.d.ts.map +1 -0
  344. package/dist/modules/workspace/agent-download.routes.js +156 -0
  345. package/dist/modules/workspace/agent-download.routes.js.map +1 -0
  346. package/dist/modules/workspace/agent-download.store.d.ts +225 -0
  347. package/dist/modules/workspace/agent-download.store.d.ts.map +1 -0
  348. package/dist/modules/workspace/agent-download.store.js +423 -0
  349. package/dist/modules/workspace/agent-download.store.js.map +1 -0
  350. package/dist/modules/workspace/agent-upload.store.d.ts +10 -1
  351. package/dist/modules/workspace/agent-upload.store.d.ts.map +1 -1
  352. package/dist/modules/workspace/agent-upload.store.js +16 -6
  353. package/dist/modules/workspace/agent-upload.store.js.map +1 -1
  354. package/dist/modules/workspace/file-readers/raw-mime.d.ts +6 -0
  355. package/dist/modules/workspace/file-readers/raw-mime.d.ts.map +1 -0
  356. package/dist/modules/workspace/file-readers/raw-mime.js +38 -0
  357. package/dist/modules/workspace/file-readers/raw-mime.js.map +1 -0
  358. package/dist/modules/workspace/file-readers/text-reader.d.ts +5 -5
  359. package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -1
  360. package/dist/modules/workspace/file-readers/text-reader.js +5 -8
  361. package/dist/modules/workspace/file-readers/text-reader.js.map +1 -1
  362. package/dist/modules/workspace/first-run.d.ts +111 -0
  363. package/dist/modules/workspace/first-run.d.ts.map +1 -0
  364. package/dist/modules/workspace/first-run.js +181 -0
  365. package/dist/modules/workspace/first-run.js.map +1 -0
  366. package/dist/modules/workspace/move-links.d.ts +92 -0
  367. package/dist/modules/workspace/move-links.d.ts.map +1 -0
  368. package/dist/modules/workspace/move-links.js +173 -0
  369. package/dist/modules/workspace/move-links.js.map +1 -0
  370. package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
  371. package/dist/modules/workspace/startup/steps/seed-tree.js +24 -39
  372. package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
  373. package/dist/modules/workspace/startup/steps/template-files.step.d.ts +58 -52
  374. package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
  375. package/dist/modules/workspace/startup/steps/template-files.step.js +209 -223
  376. package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
  377. package/dist/modules/workspace/startup/steps/template-source.d.ts +5 -3
  378. package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
  379. package/dist/modules/workspace/startup/steps/template-source.js +5 -3
  380. package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
  381. package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
  382. package/dist/modules/workspace/workspace.routes.js +63 -22
  383. package/dist/modules/workspace/workspace.routes.js.map +1 -1
  384. package/dist/modules/workspace/workspace.service.d.ts +75 -2
  385. package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
  386. package/dist/modules/workspace/workspace.service.js +197 -24
  387. package/dist/modules/workspace/workspace.service.js.map +1 -1
  388. package/dist/modules/workspace/workspace.tools.d.ts +68 -1
  389. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
  390. package/dist/modules/workspace/workspace.tools.js +642 -71
  391. package/dist/modules/workspace/workspace.tools.js.map +1 -1
  392. package/dist/modules/write-access/write-access.d.ts.map +1 -1
  393. package/dist/modules/write-access/write-access.js +9 -0
  394. package/dist/modules/write-access/write-access.js.map +1 -1
  395. package/dist/shared/domain-errors.d.ts +84 -1
  396. package/dist/shared/domain-errors.d.ts.map +1 -1
  397. package/dist/shared/domain-errors.js +100 -12
  398. package/dist/shared/domain-errors.js.map +1 -1
  399. package/dist/shared/git.contract.d.ts +10 -1
  400. package/dist/shared/git.contract.d.ts.map +1 -1
  401. package/dist/shared/git.contract.js.map +1 -1
  402. package/dist/shared/hidden-tools.d.ts +44 -0
  403. package/dist/shared/hidden-tools.d.ts.map +1 -0
  404. package/dist/shared/hidden-tools.js +13 -0
  405. package/dist/shared/hidden-tools.js.map +1 -0
  406. package/dist/shared/utf8-text.d.ts +15 -0
  407. package/dist/shared/utf8-text.d.ts.map +1 -0
  408. package/dist/shared/utf8-text.js +20 -0
  409. package/dist/shared/utf8-text.js.map +1 -0
  410. package/dist/tenancy/static-tenant-source.d.ts +2 -1
  411. package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
  412. package/dist/tenancy/static-tenant-source.js +9 -2
  413. package/dist/tenancy/static-tenant-source.js.map +1 -1
  414. package/kb-template/.bevelignore +0 -5
  415. package/mcp-app/page.html +349 -0
  416. package/migrations/0017_atlassian_account_links.sql +37 -0
  417. package/migrations/meta/0017_snapshot.json +2396 -0
  418. package/migrations/meta/_journal.json +8 -1
  419. package/package.json +6 -3
  420. package/src/__tests__/kb-layout-config.test.ts +10 -100
  421. package/src/__tests__/packaged-assets-ship.test.ts +66 -0
  422. package/src/assets.ts +38 -2
  423. package/src/core/__tests__/catalog-revision.test.ts +40 -0
  424. package/src/core/__tests__/gated-boot.test.ts +1 -0
  425. package/src/core/__tests__/lifecycle.test.ts +14 -0
  426. package/src/core/catalog-revision.ts +15 -2
  427. package/src/core/core-ports.ts +11 -0
  428. package/src/core/create-core-server.ts +78 -3
  429. package/src/core/create-core-services.ts +168 -10
  430. package/src/core/lifecycle.ts +28 -2
  431. package/src/core-config.ts +24 -1
  432. package/src/index.ts +2 -2
  433. package/src/modules/access/__tests__/access-control.atref-batch.test.ts +58 -0
  434. package/src/modules/access/__tests__/access-control.platform-restore.test.ts +8 -7
  435. package/src/modules/access/__tests__/access-control.service.test.ts +19 -0
  436. package/src/modules/access/__tests__/access-personal-plugin.test.ts +1 -18
  437. package/src/modules/access/access-control.interface.ts +28 -0
  438. package/src/modules/access/access-control.service.ts +37 -0
  439. package/src/modules/access/directory-sync-bot.ts +1 -1
  440. package/src/modules/agent-guide/__tests__/agent-guide.test.ts +386 -0
  441. package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +207 -0
  442. package/src/modules/agent-guide/agent-guide.tools.ts +122 -0
  443. package/src/modules/agent-guide/agent-guide.ts +300 -0
  444. package/src/modules/agent-guide/index.ts +22 -0
  445. package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +39 -118
  446. package/src/modules/agent-instructions/agent-instructions.routes.ts +3 -2
  447. package/src/modules/agent-instructions/compose.ts +26 -8
  448. package/src/modules/agent-instructions/index.ts +0 -3
  449. package/src/modules/agent-instructions/shared-file-rules.ts +50 -112
  450. package/src/modules/audit/__tests__/agent-audit.service.test.ts +64 -4
  451. package/src/modules/audit/__tests__/agent-connection.routes.test.ts +102 -0
  452. package/src/modules/audit/agent-audit.service.ts +58 -3
  453. package/src/modules/audit/agent-connection.routes.ts +56 -0
  454. package/src/modules/audit/audit.contract.ts +26 -0
  455. package/src/modules/audit/index.ts +1 -0
  456. package/src/modules/auth/__tests__/account.routes.test.ts +5 -3
  457. package/src/modules/auth/account.routes.ts +10 -3
  458. package/src/modules/auth/auth.middleware.ts +1 -1
  459. package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +18 -2
  460. package/src/modules/code-mode/code-mode.tool.ts +13 -2
  461. package/src/modules/database/core-schema.ts +33 -3
  462. package/src/modules/embed/__tests__/account-links.migration.test.ts +98 -0
  463. package/src/modules/embed/__tests__/embed-link.test.ts +122 -0
  464. package/src/modules/embed/__tests__/embed.routes.test.ts +362 -0
  465. package/src/modules/embed/__tests__/embed.service.lock.test.ts +193 -0
  466. package/src/modules/embed/__tests__/embed.service.test.ts +805 -0
  467. package/src/modules/embed/__tests__/embed.tools.test.ts +304 -0
  468. package/src/modules/embed/__tests__/mcp-app.test.ts +207 -0
  469. package/src/modules/embed/account-link.service.ts +76 -0
  470. package/src/modules/embed/embed-link.ts +180 -0
  471. package/src/modules/embed/embed.errors.ts +43 -0
  472. package/src/modules/embed/embed.interface.ts +203 -0
  473. package/src/modules/embed/embed.routes.ts +363 -0
  474. package/src/modules/embed/embed.service.ts +705 -0
  475. package/src/modules/embed/embed.tools.ts +206 -0
  476. package/src/modules/embed/mcp-app.routes.ts +41 -0
  477. package/src/modules/embed/mcp-app.ts +173 -0
  478. package/src/modules/github-app/__tests__/github-app.test.ts +76 -0
  479. package/src/modules/github-app/github-app.connection.ts +38 -4
  480. package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +304 -0
  481. package/src/modules/kb-fs/locking-filesystem.ts +287 -0
  482. package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +35 -0
  483. package/src/modules/kb-sync/kb-sync.interface.ts +2 -0
  484. package/src/modules/kb-sync/kb-sync.service.ts +6 -0
  485. package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +68 -11
  486. package/src/modules/mcp/__tests__/fake-downstream-mcp-server.ts +14 -3
  487. package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +37 -2
  488. package/src/modules/mcp/__tests__/mcp.app.e2e.test.ts +200 -0
  489. package/src/modules/mcp/__tests__/mcp.e2e.test.ts +252 -0
  490. package/src/modules/mcp/__tests__/mcp.service.test.ts +42 -24
  491. package/src/modules/mcp/__tests__/tool-call-interface.e2e.test.ts +499 -0
  492. package/src/modules/mcp/__tests__/tool-schema-guard.test.ts +266 -0
  493. package/src/modules/mcp/mcp-auth.middleware.ts +2 -1
  494. package/src/modules/mcp/mcp.service.ts +218 -31
  495. package/src/modules/mcp/oauth/bevel-oauth-provider.ts +42 -4
  496. package/src/modules/mcp/tool-schema-guard.ts +196 -0
  497. package/src/modules/onboarding/__tests__/onboarding.routes.test.ts +163 -0
  498. package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +635 -0
  499. package/src/modules/onboarding/__tests__/starter-packs.test.ts +169 -0
  500. package/src/modules/onboarding/onboarding.contract.ts +85 -0
  501. package/src/modules/onboarding/onboarding.routes.ts +85 -0
  502. package/src/modules/onboarding/starter-pack.service.ts +580 -0
  503. package/src/modules/onboarding/starter-packs.ts +182 -0
  504. package/src/modules/plugins/__tests__/plugins.tools.test.ts +177 -4
  505. package/src/modules/plugins/index.ts +1 -0
  506. package/src/modules/plugins/plugin-provision.service.ts +22 -1
  507. package/src/modules/plugins/plugins.routes.ts +29 -0
  508. package/src/modules/plugins/plugins.tools.ts +75 -15
  509. package/src/modules/settings/__tests__/deployment-settings.service.test.ts +176 -56
  510. package/src/modules/settings/__tests__/repository-source.test.ts +9 -0
  511. package/src/modules/settings/deployment-settings.service.ts +144 -55
  512. package/src/modules/settings/repository-source.ts +4 -4
  513. package/src/modules/settings/setup.routes.ts +3 -6
  514. package/src/modules/skills/__tests__/skills.tools.description.test.ts +95 -0
  515. package/src/modules/skills/skills.tools.ts +112 -46
  516. package/src/modules/tool-auth/__tests__/connection-key-rejection.test.ts +32 -0
  517. package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +65 -0
  518. package/src/modules/tool-auth/connection-key-rejection.ts +13 -3
  519. package/src/modules/tool-auth/external-api-key.interface.ts +9 -0
  520. package/src/modules/tool-auth/external-api-key.service.ts +61 -4
  521. package/src/modules/tool-auth/tool-auth.middleware.ts +13 -4
  522. package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +502 -0
  523. package/src/modules/tool-helpers/__tests__/route-argument-check.test.ts +337 -0
  524. package/src/modules/tool-helpers/index.ts +34 -1
  525. package/src/modules/tool-helpers/route-argument-check.ts +149 -0
  526. package/src/modules/tool-helpers/route-tool-schemas.ts +171 -0
  527. package/src/modules/tool-helpers/tool-def.ts +132 -7
  528. package/src/modules/tool-helpers/tool-handler.ts +196 -8
  529. package/src/modules/tool-helpers/tool.contract.ts +9 -0
  530. package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +57 -0
  531. package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +73 -4
  532. package/src/modules/tool-manuals/tool-manuals.contract.ts +24 -4
  533. package/src/modules/tool-manuals/tool-manuals.service.ts +17 -0
  534. package/src/modules/tool-manuals/tool-manuals.tools.ts +86 -38
  535. package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +173 -0
  536. package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +81 -66
  537. package/src/modules/tool-registry/description-length.ts +57 -32
  538. package/src/modules/tool-registry/guide-first.ts +41 -0
  539. package/src/modules/tool-registry/tool-registry.ts +9 -2
  540. package/src/modules/workflow/__tests__/apply-failure.test.ts +6 -1
  541. package/src/modules/workflow/__tests__/file-lock.service.deletion-gate.test.ts +104 -0
  542. package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +66 -0
  543. package/src/modules/workflow/__tests__/pending-commits.worker.test.ts +31 -2
  544. package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +110 -6
  545. package/src/modules/workflow/__tests__/sanitize-error.test.ts +89 -1
  546. package/src/modules/workflow/__tests__/workflow.routes.push-refused.test.ts +202 -0
  547. package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +6 -6
  548. package/src/modules/workflow/__tests__/workflow.service.delete-branch.test.ts +1026 -0
  549. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +468 -10
  550. package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +4 -0
  551. package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +5 -4
  552. package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +54 -2
  553. package/src/modules/workflow/agent-tools/__tests__/change-request-read-shape.test.ts +705 -0
  554. package/src/modules/workflow/agent-tools/__tests__/change-request-read.tools.test.ts +1554 -0
  555. package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +150 -4
  556. package/src/modules/workflow/agent-tools/change-request-read-shape.ts +712 -0
  557. package/src/modules/workflow/agent-tools/change-request-read.tools.ts +759 -0
  558. package/src/modules/workflow/agent-tools/change-request-summary.ts +5 -1
  559. package/src/modules/workflow/agent-tools/workflow.tools.ts +137 -35
  560. package/src/modules/workflow/file-lock.service.ts +67 -5
  561. package/src/modules/workflow/git/__tests__/git.service.appliedChange.test.ts +285 -0
  562. package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +124 -0
  563. package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +164 -0
  564. package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +334 -0
  565. package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +48 -1
  566. package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +231 -2
  567. package/src/modules/workflow/git/__tests__/pull-request.service.list-fetch.test.ts +72 -2
  568. package/src/modules/workflow/git/__tests__/pull-request.service.placeholder.test.ts +24 -2
  569. package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +620 -1
  570. package/src/modules/workflow/git/git.service.ts +714 -133
  571. package/src/modules/workflow/git/merge-commit.ts +88 -0
  572. package/src/modules/workflow/git/node-git-runner.ts +82 -7
  573. package/src/modules/workflow/git/pull-request.service.ts +380 -54
  574. package/src/modules/workflow/pending-commits.service.ts +29 -1
  575. package/src/modules/workflow/pending-commits.worker.ts +24 -6
  576. package/src/modules/workflow/recovery-bot.ts +1 -1
  577. package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +7 -1
  578. package/src/modules/workflow/review-workflow/__tests__/merge-records-own-commit.test.ts +407 -0
  579. package/src/modules/workflow/review-workflow/review-workflow.service.ts +191 -12
  580. package/src/modules/workflow/sanitize-error.ts +50 -0
  581. package/src/modules/workflow/workflow.routes.ts +7 -2
  582. package/src/modules/workflow/workflow.service.ts +886 -112
  583. package/src/modules/workspace/__tests__/agent-downloads.test.ts +823 -0
  584. package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +4 -3
  585. package/src/modules/workspace/__tests__/first-run.test.ts +234 -0
  586. package/src/modules/workspace/__tests__/git-internals.security.test.ts +5 -2
  587. package/src/modules/workspace/__tests__/md-links.test.ts +353 -0
  588. package/src/modules/workspace/__tests__/move-links.test.ts +261 -0
  589. package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +219 -0
  590. package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -0
  591. package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +102 -0
  592. package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +52 -5
  593. package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +190 -0
  594. package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +21 -10
  595. package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +8 -4
  596. package/src/modules/workspace/__tests__/workspace.service.test.ts +50 -8
  597. package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +33 -55
  598. package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +44 -1
  599. package/src/modules/workspace/__tests__/workspace.tools.test.ts +664 -34
  600. package/src/modules/workspace/agent-download.builder.ts +308 -0
  601. package/src/modules/workspace/agent-download.routes.ts +183 -0
  602. package/src/modules/workspace/agent-download.store.ts +533 -0
  603. package/src/modules/workspace/agent-upload.store.ts +23 -7
  604. package/src/modules/workspace/file-readers/raw-mime.ts +40 -0
  605. package/src/modules/workspace/file-readers/text-reader.ts +5 -8
  606. package/src/modules/workspace/first-run.ts +222 -0
  607. package/src/modules/workspace/move-links.ts +237 -0
  608. package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +191 -489
  609. package/src/modules/workspace/startup/steps/seed-tree.ts +23 -38
  610. package/src/modules/workspace/startup/steps/template-files.step.ts +217 -249
  611. package/src/modules/workspace/startup/steps/template-source.ts +5 -3
  612. package/src/modules/workspace/workspace.routes.ts +64 -22
  613. package/src/modules/workspace/workspace.service.ts +202 -25
  614. package/src/modules/workspace/workspace.tools.ts +707 -68
  615. package/src/modules/write-access/__tests__/write-access.test.ts +13 -0
  616. package/src/modules/write-access/write-access.ts +9 -0
  617. package/src/shared/domain-errors.ts +123 -11
  618. package/src/shared/git.contract.ts +8 -1
  619. package/src/shared/hidden-tools.ts +45 -0
  620. package/src/shared/utf8-text.ts +21 -0
  621. package/src/tenancy/__tests__/static-tenant-source.test.ts +1 -0
  622. package/src/tenancy/static-tenant-source.ts +10 -2
  623. package/starter-packs/README.md +103 -0
  624. package/starter-packs/engineering/KnowledgeBase/About us.md +9 -0
  625. package/starter-packs/engineering/KnowledgeBase/Architecture.md +9 -0
  626. package/starter-packs/engineering/KnowledgeBase/Glossary.md +9 -0
  627. package/starter-packs/engineering/KnowledgeBase/How we ship.md +9 -0
  628. package/starter-packs/engineering/Plugins/engineering-starter/LICENSE +21 -0
  629. package/starter-packs/engineering/Plugins/engineering-starter/SOURCE.md +20 -0
  630. package/starter-packs/engineering/Plugins/engineering-starter/access.md +19 -0
  631. package/starter-packs/engineering/Plugins/engineering-starter/plugin.json +10 -0
  632. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/SKILL.md +171 -0
  633. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2a-startup-diagnostic.md +157 -0
  634. package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2b-builder-brainstorm.md +39 -0
  635. package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-ceo-review/SKILL.md +144 -0
  636. package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-eng-review/SKILL.md +144 -0
  637. package/starter-packs/engineering/Plugins/engineering-starter/skills/review/SKILL.md +80 -0
  638. package/starter-packs/engineering/Plugins/engineering-starter/skills/review/checklist.md +184 -0
  639. package/starter-packs/engineering/pack.yaml +11 -0
  640. package/starter-packs/general/KnowledgeBase/About us.md +9 -0
  641. package/starter-packs/general/KnowledgeBase/Glossary.md +9 -0
  642. package/starter-packs/general/KnowledgeBase/How we work.md +9 -0
  643. package/starter-packs/general/Plugins/general-starter/LICENSE +202 -0
  644. package/starter-packs/general/Plugins/general-starter/SOURCE.md +10 -0
  645. package/starter-packs/general/Plugins/general-starter/access.md +19 -0
  646. package/starter-packs/general/Plugins/general-starter/plugin.json +10 -0
  647. package/starter-packs/general/Plugins/general-starter/skills/memory-management/SKILL.md +332 -0
  648. package/starter-packs/general/Plugins/general-starter/skills/productivity-start/SKILL.md +163 -0
  649. package/starter-packs/general/Plugins/general-starter/skills/productivity-update/SKILL.md +167 -0
  650. package/starter-packs/general/Plugins/general-starter/skills/task-management/SKILL.md +83 -0
  651. package/starter-packs/general/pack.yaml +10 -0
  652. package/starter-packs/operations/KnowledgeBase/Glossary.md +9 -0
  653. package/starter-packs/operations/KnowledgeBase/How we work.md +9 -0
  654. package/starter-packs/operations/KnowledgeBase/Processes.md +9 -0
  655. package/starter-packs/operations/KnowledgeBase/Tools we use.md +9 -0
  656. package/starter-packs/operations/KnowledgeBase/Vendors.md +9 -0
  657. package/starter-packs/operations/Plugins/operations-starter/LICENSE +202 -0
  658. package/starter-packs/operations/Plugins/operations-starter/SOURCE.md +10 -0
  659. package/starter-packs/operations/Plugins/operations-starter/access.md +19 -0
  660. package/starter-packs/operations/Plugins/operations-starter/plugin.json +10 -0
  661. package/starter-packs/operations/Plugins/operations-starter/skills/capacity-plan/SKILL.md +111 -0
  662. package/starter-packs/operations/Plugins/operations-starter/skills/change-request/SKILL.md +119 -0
  663. package/starter-packs/operations/Plugins/operations-starter/skills/compliance-tracking/SKILL.md +44 -0
  664. package/starter-packs/operations/Plugins/operations-starter/skills/process-doc/SKILL.md +80 -0
  665. package/starter-packs/operations/Plugins/operations-starter/skills/process-optimization/SKILL.md +39 -0
  666. package/starter-packs/operations/Plugins/operations-starter/skills/risk-assessment/SKILL.md +40 -0
  667. package/starter-packs/operations/Plugins/operations-starter/skills/runbook/SKILL.md +85 -0
  668. package/starter-packs/operations/Plugins/operations-starter/skills/status-report/SKILL.md +75 -0
  669. package/starter-packs/operations/Plugins/operations-starter/skills/vendor-review/SKILL.md +102 -0
  670. package/starter-packs/operations/pack.yaml +12 -0
  671. package/starter-packs/sales/KnowledgeBase/About us.md +9 -0
  672. package/starter-packs/sales/KnowledgeBase/Customers.md +9 -0
  673. package/starter-packs/sales/KnowledgeBase/Glossary.md +9 -0
  674. package/starter-packs/sales/KnowledgeBase/How we sell.md +9 -0
  675. package/starter-packs/sales/KnowledgeBase/Objections.md +9 -0
  676. package/starter-packs/sales/KnowledgeBase/Pricing.md +9 -0
  677. package/starter-packs/sales/Plugins/sales-starter/LICENSE +202 -0
  678. package/starter-packs/sales/Plugins/sales-starter/SOURCE.md +10 -0
  679. package/starter-packs/sales/Plugins/sales-starter/access.md +19 -0
  680. package/starter-packs/sales/Plugins/sales-starter/plugin.json +10 -0
  681. package/starter-packs/sales/Plugins/sales-starter/skills/account-context/SKILL.md +94 -0
  682. package/starter-packs/sales/Plugins/sales-starter/skills/account-plan/SKILL.md +95 -0
  683. package/starter-packs/sales/Plugins/sales-starter/skills/account-research/SKILL.md +99 -0
  684. package/starter-packs/sales/Plugins/sales-starter/skills/account-tiering/SKILL.md +101 -0
  685. package/starter-packs/sales/Plugins/sales-starter/skills/call-prep/SKILL.md +111 -0
  686. package/starter-packs/sales/Plugins/sales-starter/skills/call-summary/SKILL.md +111 -0
  687. package/starter-packs/sales/Plugins/sales-starter/skills/close-plan/SKILL.md +106 -0
  688. package/starter-packs/sales/Plugins/sales-starter/skills/competitive-intelligence/SKILL.md +102 -0
  689. package/starter-packs/sales/Plugins/sales-starter/skills/create-an-asset/SKILL.md +105 -0
  690. package/starter-packs/sales/Plugins/sales-starter/skills/crm-hygiene-check/SKILL.md +103 -0
  691. package/starter-packs/sales/Plugins/sales-starter/skills/customer-health/SKILL.md +108 -0
  692. package/starter-packs/sales/Plugins/sales-starter/skills/customer-voice/SKILL.md +94 -0
  693. package/starter-packs/sales/Plugins/sales-starter/skills/daily-briefing/SKILL.md +61 -0
  694. package/starter-packs/sales/Plugins/sales-starter/skills/deal-advance-gap/SKILL.md +102 -0
  695. package/starter-packs/sales/Plugins/sales-starter/skills/deal-review/SKILL.md +105 -0
  696. package/starter-packs/sales/Plugins/sales-starter/skills/deal-signals/SKILL.md +96 -0
  697. package/starter-packs/sales/Plugins/sales-starter/skills/deal-slip-scenario/SKILL.md +104 -0
  698. package/starter-packs/sales/Plugins/sales-starter/skills/draft-outreach/SKILL.md +116 -0
  699. package/starter-packs/sales/Plugins/sales-starter/skills/end-of-day/SKILL.md +114 -0
  700. package/starter-packs/sales/Plugins/sales-starter/skills/expansion-whitespace/SKILL.md +97 -0
  701. package/starter-packs/sales/Plugins/sales-starter/skills/forecast/SKILL.md +100 -0
  702. package/starter-packs/sales/Plugins/sales-starter/skills/handle-objection/SKILL.md +93 -0
  703. package/starter-packs/sales/Plugins/sales-starter/skills/inbox-sweep/SKILL.md +114 -0
  704. package/starter-packs/sales/Plugins/sales-starter/skills/lead-triage/SKILL.md +106 -0
  705. package/starter-packs/sales/Plugins/sales-starter/skills/log-activity/SKILL.md +111 -0
  706. package/starter-packs/sales/Plugins/sales-starter/skills/pipeline-review/SKILL.md +97 -0
  707. package/starter-packs/sales/Plugins/sales-starter/skills/renewal-radar/SKILL.md +95 -0
  708. package/starter-packs/sales/Plugins/sales-starter/skills/rep-context/SKILL.md +90 -0
  709. package/starter-packs/sales/Plugins/sales-starter/skills/route-lead/SKILL.md +111 -0
  710. package/starter-packs/sales/Plugins/sales-starter/skills/sales-setup/SKILL.md +200 -0
  711. package/starter-packs/sales/Plugins/sales-starter/skills/schedule-meeting/SKILL.md +99 -0
  712. package/starter-packs/sales/Plugins/sales-starter/skills/stakeholder-map/SKILL.md +107 -0
  713. package/starter-packs/sales/Plugins/sales-starter/skills/team-pipeline/SKILL.md +105 -0
  714. package/starter-packs/sales/Plugins/sales-starter/skills/update-opportunity/SKILL.md +112 -0
  715. package/starter-packs/sales/Plugins/sales-starter/skills/weekly-wrap/SKILL.md +90 -0
  716. package/starter-packs/sales/Plugins/sales-starter/skills/win-loss-review/SKILL.md +88 -0
  717. package/starter-packs/sales/pack.yaml +13 -0
  718. package/starter-packs/support/KnowledgeBase/Escalations.md +9 -0
  719. package/starter-packs/support/KnowledgeBase/Glossary.md +9 -0
  720. package/starter-packs/support/KnowledgeBase/Known issues.md +9 -0
  721. package/starter-packs/support/KnowledgeBase/Products.md +9 -0
  722. package/starter-packs/support/KnowledgeBase/Tone of voice.md +9 -0
  723. package/starter-packs/support/Plugins/support-starter/LICENSE +202 -0
  724. package/starter-packs/support/Plugins/support-starter/SOURCE.md +10 -0
  725. package/starter-packs/support/Plugins/support-starter/access.md +19 -0
  726. package/starter-packs/support/Plugins/support-starter/plugin.json +10 -0
  727. package/starter-packs/support/Plugins/support-starter/skills/customer-escalation/SKILL.md +246 -0
  728. package/starter-packs/support/Plugins/support-starter/skills/customer-research/SKILL.md +250 -0
  729. package/starter-packs/support/Plugins/support-starter/skills/draft-response/SKILL.md +416 -0
  730. package/starter-packs/support/Plugins/support-starter/skills/kb-article/SKILL.md +350 -0
  731. package/starter-packs/support/Plugins/support-starter/skills/ticket-triage/SKILL.md +273 -0
  732. package/starter-packs/support/pack.yaml +12 -0
  733. package/kb-template/AGENTS.md +0 -730
@@ -8,6 +8,8 @@ import {
8
8
  ListToolsRequestSchema,
9
9
  ListPromptsRequestSchema,
10
10
  GetPromptRequestSchema,
11
+ ListResourcesRequestSchema,
12
+ ReadResourceRequestSchema,
11
13
  McpError,
12
14
  ErrorCode,
13
15
  isInitializeRequest,
@@ -39,6 +41,9 @@ import {
39
41
  retiredToolMessage,
40
42
  needsAuthorizationResult,
41
43
  skillPromptText,
44
+ toListedResource,
45
+ toReadResourceResult,
46
+ type McpAppManifest,
42
47
  type ProxiedTool,
43
48
  type SkillSummary,
44
49
  type LoadedSkill,
@@ -53,6 +58,7 @@ import {
53
58
  import { EXTERNAL_KB_MANUAL_NAME } from '../tool-manuals/tool-manuals.contract.js';
54
59
  import type { IToolManualService } from '../tool-manuals/tool-manuals.contract.js';
55
60
  import type { SpillStore } from '../workspace/spill-store.js';
61
+ import type { HiddenToolSource } from '../../shared/hidden-tools.js';
56
62
  import { seedBevelHostedManualVars } from '../../shared/utcp-namespace.js';
57
63
  import type { InternalTokenService } from '../tool-auth/internal-token.service.js';
58
64
  import type { IAgentEventRecorder } from '../audit/audit.contract.js';
@@ -60,16 +66,17 @@ import { RequestAudit } from '../audit/request-audit.js';
60
66
  import { ManualFailureMemo } from './manual-failure-memo.js';
61
67
  import { DownstreamPool, POOL_KEY_SEPARATOR, type DownstreamPoolOptions, type Lease } from './downstream-pool.js';
62
68
  import { SurfaceLogThrottle } from './surface-log-throttle.js';
69
+ import { ToolSchemaGuard, type ScreenedHiddenTool } from './tool-schema-guard.js';
63
70
  import { DownstreamRefreshGuard, isDownstreamTokenRejection } from './downstream-token-refresh.js';
64
71
  import { printable } from '../../shared/printable.js';
65
72
  import {
66
73
  composeAgentInstructions,
67
74
  prefixToolDescription,
68
75
  PREFIXED_TOOLS,
69
- sharedRulesPointer,
70
76
  type AgentPreambleReader,
71
77
  type ComposedAgentInstructions,
72
78
  } from '../agent-instructions/index.js';
79
+ import { guideFirstDescription } from '../tool-registry/guide-first.js';
73
80
 
74
81
  /**
75
82
  * Configuration for the loopback proxy. `loopbackBaseUrl` is the backend's own
@@ -95,8 +102,8 @@ export interface McpProxyOptions {
95
102
  readAgentPreamble?: AgentPreambleReader;
96
103
  /**
97
104
  * The layout in effect, read per request: the shared file rules name the
98
- * managed guide, and a deployment may rename it after boot (the setup save
99
- * applies a name without a restart). A GETTER, so nothing snapshots the
105
+ * guide by the name a deployment saved for it, and the setup save applies
106
+ * a layout without a restart. A GETTER, so nothing snapshots the
100
107
  * pre-setup default. Absent, the rules name `AGENTS.md`.
101
108
  */
102
109
  kbLayout?: () => KbLayout;
@@ -166,6 +173,14 @@ interface RequestSurface {
166
173
  * They differ only when the name holds a non-word character (`my-server`).
167
174
  */
168
175
  catalogNames: ReadonlyMap<string, string>;
176
+ /**
177
+ * The tools this request's load took OFF the surface for an invalid schema,
178
+ * by the name an agent would have called them by. Carried on the surface
179
+ * rather than read back out of the guard: it is this caller's own load, so a
180
+ * call answered from it cannot answer about a schema some other caller's
181
+ * connection was shown.
182
+ */
183
+ hidden: ReadonlyMap<string, ScreenedHiddenTool>;
169
184
  }
170
185
 
171
186
  /** A manual off the surface for want of a sign-in — see {@link RequestSurface.unavailable}. */
@@ -273,6 +288,15 @@ export class McpService {
273
288
  */
274
289
  private readonly knownDownstreamTools = new Map<string, { definition: string; tools: UtcpTool[] }>();
275
290
 
291
+ /**
292
+ * The JSON Schema check on connected tools, and the memory of what it found.
293
+ * Process-wide rather than per request, because a schema's validity is a
294
+ * property of the server and not of the caller — and because the point of
295
+ * remembering is that the check runs when a server's tools are loaded, not
296
+ * once per request and never on a tool call. See {@link ToolSchemaGuard}.
297
+ */
298
+ private readonly toolSchemas = new ToolSchemaGuard();
299
+
276
300
  // The downstream connection pool for `mcp` manuals — see the class doc.
277
301
  private readonly downstream: DownstreamPool<PooledDownstream>;
278
302
 
@@ -296,6 +320,18 @@ export class McpService {
296
320
  // of a request that arrived with a key or an agent connection goes
297
321
  // through it. Optional like the others; without it nothing is recorded.
298
322
  private readonly auditRecorder?: IAgentEventRecorder,
323
+ /**
324
+ * The MCP Apps this deployment serves — the views a tool's `_meta` names
325
+ * and `resources/list` / `resources/read` answer for.
326
+ *
327
+ * Optional, and absence is a real state rather than a test convenience:
328
+ * with no manifest the endpoint declares no `resources` capability and
329
+ * every tool is listed exactly as before, which is also what a
330
+ * deployment whose packaged view could not be read must look like. A
331
+ * `resourceUri` advertised without a resource behind it would have a
332
+ * host preload a failure and show an empty frame.
333
+ */
334
+ private readonly mcpApps?: { manifest(): Promise<McpAppManifest> },
299
335
  ) {
300
336
  this.downstream = new DownstreamPool<PooledDownstream>({
301
337
  ...opts.downstreamPool,
@@ -402,10 +438,24 @@ export class McpService {
402
438
  }));
403
439
 
404
440
  const initializing = (Array.isArray(messages) ? messages : [messages]).some((m) => isInitializeRequest(m));
441
+ // The deployment's MCP Apps, read once per request. Declaring the
442
+ // `resources` capability is what permits the two handlers below, and a
443
+ // deployment with no view must not declare it — a client would then list
444
+ // resources and be told the method does not exist.
445
+ const apps = this.mcpApps ? await this.mcpApps.manifest().catch(() => null) : null;
446
+ const servesApps = (apps?.resources.length ?? 0) > 0;
405
447
  const server = new Server(
406
448
  { name: 'bevel-mcp', version: '0.1.0' },
407
449
  {
408
- capabilities: { tools: {}, prompts: {} },
450
+ capabilities: {
451
+ tools: {},
452
+ prompts: {},
453
+ // Resources exist here for ONE purpose: serving the MCP App views
454
+ // the tools carry. The knowledge base's own files are not
455
+ // resources — they are what the file TOOLS read, under the access
456
+ // rules, which a resource listing has no way to express.
457
+ ...(servesApps ? { resources: {} } : {}),
458
+ },
409
459
  // `instructions` rides the initialize result; clients that honour it
410
460
  // place the text in the model's system prompt without the model acting.
411
461
  ...(initializing ? { instructions: (await agentInstructions()).instructions } : {}),
@@ -445,7 +495,12 @@ export class McpService {
445
495
  const direct: McpTool[] = [];
446
496
  const examplePool: ProxiedTool[] = [];
447
497
  for (const t of listed) {
448
- const entry = toListedTool(t); // logs its own reason on a name/schema drop
498
+ // The MCP App view this tool's result renders in, by tool name. Not
499
+ // part of the UTCP manual the tool was discovered from (UTCP has no
500
+ // place for it), so it is joined on here — the one point where a
501
+ // discovered tool becomes a listing entry.
502
+ const ui = apps && Object.hasOwn(apps.tools, t.mcpName) ? apps.tools[t.mcpName] : undefined;
503
+ const entry = toListedTool(ui ? { ...t, ui } : t); // logs its own reason on a name/schema drop
449
504
  if (!entry) {
450
505
  dropped.push(t.mcpName);
451
506
  continue;
@@ -486,14 +541,17 @@ export class McpService {
486
541
  // different name, and one fixed example is necessarily wrong on one of the
487
542
  // two surfaces.
488
543
  //
489
- // The chain's description ends with the same pointer every file tool ends
490
- // with: what a chain does with a failure, a large result or an image is
491
- // stated once, in the shared rules, and the clients that drop
492
- // `instructions` have the description and the guide to go on. Composed
493
- // here because the guide's name is this deployment's setting.
544
+ // What a chain does with a failure, a large result or an image is
545
+ // stated once, in the shared rules — in the guide and in the handshake
546
+ // instructions — and not on the chain itself (an EMPTY pointer is how
547
+ // `mcp-core` is told the rules are served elsewhere). Like every tool of
548
+ // the platform's own, each meta-tool opens with the one sentence saying
549
+ // what to do before any of them, which is where those rules are. The
550
+ // registry puts the sentence on the tools it lists; the meta-tools are
551
+ // built here, so here it is.
494
552
  const metaTools = codeModeMetaTools(EXTERNAL_KB_MANUAL_NAME, examplePool, {
495
- sharedRulesPointer: sharedRulesPointer(this.opts.kbLayout?.()),
496
- });
553
+ sharedRulesPointer: '',
554
+ }).map((tool) => ({ ...tool, description: guideFirstDescription(tool.description) }));
497
555
  // Log only when a tool was dropped (name/schema/duplicate) — that's the
498
556
  // anomaly worth surfacing, since a downstream client would otherwise hide
499
557
  // it by rejecting the whole response.
@@ -509,8 +567,27 @@ export class McpService {
509
567
  };
510
568
  });
511
569
 
570
+ // The MCP App views. Registered only when this deployment serves one, so
571
+ // the handlers and the declared capability agree.
572
+ if (servesApps && apps) {
573
+ server.setRequestHandler(ListResourcesRequestSchema, async () => ({
574
+ resources: apps.resources.map((r) => toListedResource(r)),
575
+ }));
576
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
577
+ const resource = apps.resources.find((r) => r.uri === request.params.uri);
578
+ if (!resource) {
579
+ throw new McpError(
580
+ ErrorCode.InvalidParams,
581
+ `No resource at ${request.params.uri}. This endpoint serves the MCP App views its tools ` +
582
+ `name and nothing else: ${apps.resources.map((r) => r.uri).join(', ')}.`,
583
+ );
584
+ }
585
+ return toReadResourceResult(resource);
586
+ });
587
+ }
588
+
512
589
  server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
513
- const { client, tools, unavailable, catalogNames } = await requestSurface();
590
+ const { client, tools, unavailable, catalogNames, hidden: hiddenTools } = await requestSurface();
514
591
  const toolName = request.params.name;
515
592
  const args = request.params.arguments ?? {};
516
593
  if (META_TOOL_NAMES.has(toolName)) {
@@ -551,6 +628,24 @@ export class McpService {
551
628
  };
552
629
  const proxied = tools.find((t) => t.mcpName === toolName);
553
630
  if (!proxied) {
631
+ // A tool this process hid for an invalid schema: say that, rather than
632
+ // "Unknown tool" about a tool the agent has every reason to think
633
+ // exists. The place and the reason are deliberately NOT here — they are
634
+ // for the people who manage the server, who are the only ones who can
635
+ // act on them.
636
+ const hidden = hiddenTools.get(toolName);
637
+ if (hidden) {
638
+ // The UTCP name, as every other audit path records a tool: the
639
+ // flattened agent name loses the server segment of a multi-segment
640
+ // `<manual>.<server>.<tool>`, and an audit trail that names a
641
+ // different tool than the rest of the trail is worse than none.
642
+ if (audit) await audit.denied(hidden.utcpName, args);
643
+ return toolError(
644
+ `The "${toolName}" tool is hidden from agents because its schema is invalid, so it cannot be ` +
645
+ `called. The people who manage its server can see the place in the schema and the reason, on ` +
646
+ `the tool's page in Hexis and through \`list_tool_setup\`.`,
647
+ );
648
+ }
554
649
  // Not on the surface — but if the name belongs to a manual that is off
555
650
  // it only because this caller's sign-in is gone (and nothing in this
556
651
  // process has seen its tools yet), the honest answer is the sign-in
@@ -570,7 +665,10 @@ export class McpService {
570
665
  if (audit) await audit.denied(proxied.utcpName, args);
571
666
  return needsAuth;
572
667
  }
573
- const run = () => this.dispatch(client, proxied, request, extra);
668
+ // A tool with an MCP App view answers structured content too — the
669
+ // view reads its fields from there.
670
+ const structured = apps !== null && Object.hasOwn(apps.tools, proxied.mcpName);
671
+ const run = () => this.dispatch(client, proxied, request, extra, structured);
574
672
  return audit ? audit.call(proxied.utcpName, args, run, isErrorResult) : run();
575
673
  });
576
674
 
@@ -626,7 +724,7 @@ export class McpService {
626
724
  const manuals = await this.fetchManualTemplates(loopbackBearer);
627
725
  const catalogMs = performance.now() - started;
628
726
  const client = await this.buildClient(loopbackBearer, userId, manuals);
629
- const { tools, unavailable, catalogNames } = await this.discoverTools(client, manuals, userId);
727
+ const { tools, unavailable, catalogNames, hidden } = await this.discoverTools(client, manuals, userId);
630
728
  const totalMs = performance.now() - started;
631
729
  // Per user: on a shape change or once per interval, never per request —
632
730
  // see SurfaceLogThrottle for why both halves matter.
@@ -641,7 +739,7 @@ export class McpService {
641
739
  (decision.suppressed > 0 ? ` [+${decision.suppressed} identical rebuild(s) since last line]` : ''),
642
740
  );
643
741
  }
644
- return { client, tools, unavailable, catalogNames };
742
+ return { client, tools, unavailable, catalogNames, hidden };
645
743
  }
646
744
 
647
745
  /**
@@ -798,13 +896,37 @@ export class McpService {
798
896
  client: CodeModeUtcpClient,
799
897
  manuals: CallTemplate[],
800
898
  userId: string,
801
- ): Promise<{ tools: ProxiedTool[]; unavailable: UnavailableManual[]; catalogNames: Map<string, string> }> {
899
+ ): Promise<{
900
+ tools: ProxiedTool[];
901
+ unavailable: UnavailableManual[];
902
+ catalogNames: Map<string, string>;
903
+ hidden: Map<string, ScreenedHiddenTool>;
904
+ }> {
802
905
  const routes = new Map<string, DownstreamRoute>();
803
906
  const unavailable: UnavailableManual[] = [];
907
+ // Taken BEFORE a single manual is registered, so it ranks this load by the
908
+ // freshness of what it is about to read — see ToolSchemaGuard.beginLoad.
909
+ const loadId = this.toolSchemas.beginLoad();
804
910
  const catalogNames = new Map<string, string>();
805
911
  for (const m of manuals) {
806
912
  if (m.call_template_type === 'mcp') catalogNames.set(utcpManualName(m), String(m.name));
807
913
  }
914
+ // Every manual's catalog name, which is how the owner-facing surfaces know
915
+ // it. `catalogNames` above is the credential catalog's map and covers `mcp`
916
+ // manuals only; the schema check is about the tools of every connected
917
+ // server, so it needs the whole list. Taken HERE, before registration:
918
+ // registering a manual renames the template in place, so `m.name` read
919
+ // afterwards is the rewritten identifier and `my-server` would be recorded
920
+ // as `my_server` — a name no tool page ever looks up.
921
+ // Keyed by the rewritten name, which two manuals can share (the collision
922
+ // handled below): the KB manual's entry is the one that stays, since it is
923
+ // the one that is registered when a `.tool` collides with it.
924
+ const manualCatalogNames = new Map<string, string>();
925
+ for (const m of manuals) {
926
+ const rewritten = utcpManualName(m);
927
+ if (manualCatalogNames.get(rewritten) === EXTERNAL_KB_MANUAL_NAME) continue;
928
+ manualCatalogNames.set(rewritten, String(m.name));
929
+ }
808
930
  // The shared layer rewrites every manual name (`[^\w]` → `_`) and tools
809
931
  // route by the rewritten prefix, so two manuals whose names rewrite to one
810
932
  // identifier would silently share it. Sequential registration used to
@@ -884,11 +1006,65 @@ export class McpService {
884
1006
  if (kbFailure && !kbFailure.ok) throw new Error(`Bevel tool discovery failed: ${kbFailure.error}`);
885
1007
  if (routes.size > 0) routeToDownstream(client, routes);
886
1008
  const utcpTools = await client.getTools();
887
- return {
888
- tools: utcpTools.map((tool: UtcpTool) => flattenManualTool(tool, EXTERNAL_KB_MANUAL_NAME)),
889
- unavailable,
890
- catalogNames,
891
- };
1009
+ const flattened = utcpTools.map((tool: UtcpTool) => flattenManualTool(tool, EXTERNAL_KB_MANUAL_NAME));
1010
+ const { tools, hidden } = await this.hideInvalidSchemas(client, flattened, manualCatalogNames, userId, loadId);
1011
+ return { tools, unavailable, catalogNames, hidden };
1012
+ }
1013
+
1014
+ /**
1015
+ * Check the input schema of every tool the servers just advertised, and take
1016
+ * the invalid ones OFF the client's tool repository.
1017
+ *
1018
+ * The repository is the single place `tools/list`, `list_tools`/`tools_info`
1019
+ * and the TypeScript interfaces `call_tool_chain` generates are all built
1020
+ * from, so removing a tool here removes it from all three — which is what
1021
+ * "not offered to agents" has to mean. Its siblings are untouched: the check
1022
+ * is per tool, so one bad schema costs that tool and nothing else of the
1023
+ * server.
1024
+ *
1025
+ * A client would otherwise drop such a tool itself, silently, and the agent
1026
+ * would be left without it and without a reason. Hidden here, the reason
1027
+ * reaches the people who manage the server (see {@link ToolSchemaGuard}).
1028
+ */
1029
+ private async hideInvalidSchemas(
1030
+ client: CodeModeUtcpClient,
1031
+ tools: ProxiedTool[],
1032
+ catalogNames: ReadonlyMap<string, string>,
1033
+ userId: string,
1034
+ loadId: number,
1035
+ ): Promise<{ tools: ProxiedTool[]; hidden: Map<string, ScreenedHiddenTool> }> {
1036
+ const byManual = new Map<string, ProxiedTool[]>();
1037
+ // EVERY manual of this surface is screened, including the ones that
1038
+ // advertised nothing. A server that removed its last invalid tool, and one
1039
+ // whose tools never loaded at all (a sign-in that has gone), both come
1040
+ // through here with an empty group — and an empty group is what clears the
1041
+ // marker. Screening only the groups that have tools would leave the tool
1042
+ // page, `list_tool_setup` and the hidden-tool answer on a call all
1043
+ // reporting a defect this process can no longer see.
1044
+ for (const manual of catalogNames.values()) byManual.set(manual, []);
1045
+ for (const tool of tools) {
1046
+ const manual = catalogNames.get(tool.manualName) ?? tool.manualName;
1047
+ byManual.set(manual, [...(byManual.get(manual) ?? []), tool]);
1048
+ }
1049
+ const found = this.toolSchemas.screen(userId, loadId, byManual);
1050
+ const hidden = new Map<string, ScreenedHiddenTool>();
1051
+ for (const tool of found.values()) hidden.set(tool.name, tool);
1052
+ if (found.size === 0) return { tools, hidden };
1053
+ for (const utcpName of found.keys()) {
1054
+ await client.config.tool_repository.removeTool(utcpName);
1055
+ }
1056
+ // Logged every time rather than throttled: a hidden tool is the one thing
1057
+ // about this surface that a person has to act on, and it is rare.
1058
+ log.warn(
1059
+ `hiding ${found.size} connected tool(s) whose input schema is not valid JSON Schema: ` +
1060
+ `${[...found.values()].map((t) => `${t.name} (${t.path}: ${t.reason})`).join(', ')}`,
1061
+ );
1062
+ return { tools: tools.filter((tool) => !found.has(tool.utcpName)), hidden };
1063
+ }
1064
+
1065
+ /** The schema findings the owner-facing surfaces report — see {@link ToolSchemaGuard}. */
1066
+ get hiddenTools(): HiddenToolSource {
1067
+ return this.toolSchemas;
892
1068
  }
893
1069
 
894
1070
  /**
@@ -1244,17 +1420,23 @@ export class McpService {
1244
1420
  // payload without a `progressToken` is accepted — same approach the prior
1245
1421
  // handler used; the strict ServerNotification type requires the token.
1246
1422
  extra: { sendNotification: (n: any) => Promise<void> },
1423
+ structured = false,
1247
1424
  ): Promise<CallToolResult> {
1248
1425
  const progressToken = request.params._meta?.progressToken;
1249
- return dispatchToolCall(client, tool, request.params.arguments ?? {}, (progress, message) =>
1250
- extra.sendNotification({
1251
- method: 'notifications/progress',
1252
- params: {
1253
- ...(progressToken !== undefined ? { progressToken } : {}),
1254
- progress,
1255
- message,
1256
- },
1257
- }),
1426
+ return dispatchToolCall(
1427
+ client,
1428
+ tool,
1429
+ request.params.arguments ?? {},
1430
+ (progress, message) =>
1431
+ extra.sendNotification({
1432
+ method: 'notifications/progress',
1433
+ params: {
1434
+ ...(progressToken !== undefined ? { progressToken } : {}),
1435
+ progress,
1436
+ message,
1437
+ },
1438
+ }),
1439
+ { structured },
1258
1440
  );
1259
1441
  }
1260
1442
 
@@ -1328,6 +1510,11 @@ function templateFingerprint(template: CallTemplate): string {
1328
1510
  * until the consumer finishes or abandons it (`for await` returns the
1329
1511
  * generator, which runs the `finally`).
1330
1512
  *
1513
+ * No guard is re-installed over this wrapper, and none is needed: a routed call
1514
+ * is made on the POOLED client, which had the guards installed on it when its
1515
+ * own manual was registered (`registerManual`). Nothing in this module checks a
1516
+ * call or shapes its failure — it forwards the call and returns the answer.
1517
+ *
1331
1518
  * A call the downstream refuses for its token (401 / `invalid_token`) goes to
1332
1519
  * the route's `afterFailure`, which may refresh the token and ask for ONE retry
1333
1520
  * on a fresh connection. Retrying is safe for the same reason session recovery
@@ -20,6 +20,7 @@ import type {
20
20
  OAuthTokenRevocationRequest,
21
21
  OAuthTokens,
22
22
  } from '@modelcontextprotocol/sdk/shared/auth.js';
23
+ import type { AgentConnectedEvent } from '@bevel-software/platform-shared';
23
24
  import type { Database } from '../../database/connection.js';
24
25
  import { agentConnections, oauthAuthCodes, oauthClients, oauthTokens, users } from '../../database/schema.js';
25
26
  import type { TokenCrypto } from '../../../shared/token-crypto.js';
@@ -57,6 +58,12 @@ export interface BevelOAuthProviderDeps {
57
58
  publicFrontendUrl: string;
58
59
  /** Access-token plaintext prefix, e.g. `bevel-mcp_`. */
59
60
  tokenPrefix: string;
61
+ /**
62
+ * Where the FIRST use of an agent connection is announced to its owner
63
+ * (`agent-connected`, see {@link BevelOAuthProvider.noteConnectionUse}).
64
+ * Optional: without it the stamp is written and nobody is told.
65
+ */
66
+ events?: { emit(event: AgentConnectedEvent): void };
60
67
  }
61
68
 
62
69
  /**
@@ -511,11 +518,42 @@ export class BevelOAuthProvider implements OAuthServerProvider {
511
518
  const last = this.connectionTouchedAt.get(connectionId);
512
519
  if (last !== undefined && now - last < CONNECTION_TOUCH_INTERVAL_MS) return;
513
520
  this.connectionTouchedAt.set(connectionId, now);
514
- this.deps.db
521
+ this.stampConnectionUse(connectionId, new Date(now)).catch((err) =>
522
+ log.warn('touch connection lastUsedAt failed:', { err }),
523
+ );
524
+ }
525
+
526
+ /**
527
+ * The stamp itself, and the one thing it tells: a connection stamped for
528
+ * the FIRST time is an agent that has just reached the platform — the
529
+ * `initialize` every client sends on connecting — which is what the
530
+ * onboarding waits for, so its owner is told (`agent-connected`) for
531
+ * exactly that stamp and never again.
532
+ *
533
+ * The first stamp is CLAIMED in one statement (`… where last_used_at is
534
+ * null … returning`): of two requests racing it — a parallel
535
+ * `initialize` and `tools/list`, or two replicas — the database hands the
536
+ * row to exactly one, and only that one announces. The loser, and every
537
+ * later use, stamps the ordinary way. Both sit behind the throttle above,
538
+ * so the hot path pays nothing for them.
539
+ */
540
+ private async stampConnectionUse(connectionId: string, at: Date): Promise<void> {
541
+ const [first] = await this.deps.db
515
542
  .update(agentConnections)
516
- .set({ lastUsedAt: new Date(now) })
517
- .where(eq(agentConnections.id, connectionId))
518
- .then(undefined, (err) => log.warn('touch connection lastUsedAt failed:', { err }));
543
+ .set({ lastUsedAt: at })
544
+ .where(and(eq(agentConnections.id, connectionId), isNull(agentConnections.lastUsedAt)))
545
+ .returning({ userId: agentConnections.userId, client: agentConnections.clientName });
546
+ if (first) {
547
+ this.deps.events?.emit({
548
+ kind: 'agent-connected',
549
+ forUserId: first.userId,
550
+ client: first.client ?? 'Unnamed agent',
551
+ agentKind: 'agent',
552
+ at: at.toISOString(),
553
+ });
554
+ return;
555
+ }
556
+ await this.deps.db.update(agentConnections).set({ lastUsedAt: at }).where(eq(agentConnections.id, connectionId));
519
557
  }
520
558
 
521
559
  /**
@@ -0,0 +1,196 @@
1
+ /**
2
+ * The schema check for connected tools, and the memory of what it found.
3
+ *
4
+ * An AI client that is handed a tool whose input schema is not valid JSON
5
+ * Schema drops that tool and says nothing: it is simply missing for the agent,
6
+ * with nothing in Hexis to look at. So Hexis runs the same check itself, when a
7
+ * server's tools are LOADED, and:
8
+ *
9
+ * - keeps such a tool off every agent surface, so the agent's picture of what
10
+ * it can do matches what it can actually call;
11
+ * - remembers the finding for the people who manage that server, who are the
12
+ * only ones who can get it fixed (the tool page, `list_tool_setup`).
13
+ *
14
+ * WHEN it runs is the point. The verdict is remembered per DISTINCT SCHEMA, so
15
+ * a server whose tools are unchanged costs one hash and one map lookup per
16
+ * tool: the JSON Schema check happens when a server's tools are first loaded
17
+ * and when a refresh brings a schema this process has not seen, and never on a
18
+ * tool call — which re-derives the surface from those same unchanged schemas.
19
+ *
20
+ * It never REPAIRS anything. The proxy passes a connected server's schema
21
+ * through as sent; an invalid one is reported, and the server's owner decides.
22
+ */
23
+
24
+ import { createHash } from 'node:crypto';
25
+ import { inputSchemaDefect, schemaDefectMarker, type SchemaDefect } from '@bevel-software/platform-mcp-core';
26
+ import type { HiddenTool, HiddenToolSource } from '../../shared/hidden-tools.js';
27
+
28
+ /** What {@link ToolSchemaGuard.screen} needs of a freshly loaded tool. */
29
+ export interface ScreenedTool {
30
+ /** The UTCP name (`<manual>.<server>.<tool>`) — how the tool repository knows it. */
31
+ utcpName: string;
32
+ /** The flattened name an agent addresses it by. */
33
+ mcpName: string;
34
+ /** The input schema exactly as the connected server sent it. */
35
+ inputSchema: unknown;
36
+ }
37
+
38
+ /**
39
+ * A finding as the LOADING side needs it. The owner-facing `HiddenTool` is
40
+ * about a tool by the name an agent would have called it; the proxy also has to
41
+ * take the tool out of its repository and record it in the audit trail, and
42
+ * both of those know a tool by its UTCP name. Kept off `HiddenTool` so the
43
+ * owner-facing payload stays exactly what its surfaces declare.
44
+ */
45
+ export interface ScreenedHiddenTool extends HiddenTool {
46
+ /** The UTCP name (`<manual>.<server>.<tool>`) the tool repository knows it by. */
47
+ utcpName: string;
48
+ }
49
+
50
+ /**
51
+ * How many schema verdicts to remember. Each is a hash and a verdict, so the
52
+ * cap is about a deployment that edits servers all day rather than about size;
53
+ * past it the whole table is cleared instead of evicted entry by entry, since
54
+ * the next load simply re-checks.
55
+ */
56
+ const MAX_REMEMBERED_SCHEMAS = 5000;
57
+
58
+ /** How many callers' pictures to hold at once — see `screen` for what happens past it. Exported for the tests that fill it. */
59
+ export const MAX_REMEMBERED_CALLERS = 2000;
60
+
61
+ export class ToolSchemaGuard implements HiddenToolSource {
62
+ /** Verdict per distinct schema: `null` means valid, so `undefined` means unchecked. */
63
+ private readonly verdicts = new Map<string, SchemaDefect | null>();
64
+ /**
65
+ * The findings, per CALLER and then per manual by catalog name.
66
+ *
67
+ * Keyed by caller because that is what a load is: discovery runs on the
68
+ * requesting user's own connection to the server, and two callers can be
69
+ * shown different tools by the same server. A single table keyed by manual
70
+ * would let one caller's load erase another's finding — the owner page would
71
+ * then show a defect from whichever request happened to be last, or none at
72
+ * all. Keyed by caller, a load replaces only what that caller can see, and
73
+ * `hiddenFor` reports the union, since the finding is about the server.
74
+ */
75
+ private readonly hidden = new Map<string, Map<string, ScreenedHiddenTool[]>>();
76
+ /** The newest load whose picture has been applied, per caller — see {@link beginLoad}. */
77
+ private readonly applied = new Map<string, number>();
78
+ /** Hands out {@link beginLoad} tickets; monotonic for the life of the process. */
79
+ private loads = 0;
80
+
81
+ /** `check` is injected only by tests, to observe how often the check runs. */
82
+ constructor(private readonly check: (schema: unknown) => SchemaDefect | null = inputSchemaDefect) {}
83
+
84
+ /**
85
+ * A ticket for a load that is ABOUT TO READ a server's tools, to be handed
86
+ * back to {@link screen} with what it found.
87
+ *
88
+ * Requests overlap: a caller's surface is rebuilt on every one of them, and
89
+ * two can be dialling the same server at once. Without an order, a load that
90
+ * started while a schema was still broken could land after the load that saw
91
+ * it corrected, and put the marker back on a tool that is fine — until some
92
+ * later request happened to clear it again. The ticket is taken BEFORE the
93
+ * read, so it ranks loads by the freshness of what they saw, and `screen`
94
+ * ignores a picture older than the one already applied.
95
+ */
96
+ beginLoad(): number {
97
+ this.loads += 1;
98
+ return this.loads;
99
+ }
100
+
101
+ /**
102
+ * Screen everything one caller's request just loaded — every manual on their
103
+ * surface, with the tools that manual advertised — and replace that caller's
104
+ * whole picture. Returns the tools to keep off the agent surfaces, keyed by
105
+ * UTCP name.
106
+ *
107
+ * WHOLE is the point, and why this takes every manual rather than one. A
108
+ * manual whose group is EMPTY has nothing hidden: its server dropped the
109
+ * offending tool, or it failed to attach at all and its tools are not loaded.
110
+ * A manual absent from `groups` is no longer on this caller's surface. Either
111
+ * way the marker goes, with nothing to clear by hand — and nothing claims a
112
+ * tool is hidden for a schema this process can no longer see.
113
+ *
114
+ * `loadId` comes from {@link beginLoad}, taken before the tools were read. A
115
+ * load that is already out of date still gets its own answer — the request
116
+ * that ran it must not offer a tool it has just judged invalid — but it does
117
+ * not write that answer into what everyone else reads.
118
+ */
119
+ screen(
120
+ userId: string,
121
+ loadId: number,
122
+ groups: ReadonlyMap<string, readonly ScreenedTool[]>,
123
+ ): Map<string, ScreenedHiddenTool> {
124
+ const found = new Map<string, ScreenedHiddenTool>();
125
+ const picture = new Map<string, ScreenedHiddenTool[]>();
126
+ for (const [manual, tools] of groups) {
127
+ const ofManual: ScreenedHiddenTool[] = [];
128
+ for (const tool of tools) {
129
+ const defect = this.verdict(tool.inputSchema);
130
+ if (!defect) continue;
131
+ const hidden: ScreenedHiddenTool = {
132
+ manual,
133
+ name: tool.mcpName,
134
+ utcpName: tool.utcpName,
135
+ path: defect.path,
136
+ reason: defect.reason,
137
+ marker: schemaDefectMarker(defect),
138
+ };
139
+ found.set(tool.utcpName, hidden);
140
+ ofManual.push(hidden);
141
+ }
142
+ if (ofManual.length > 0) picture.set(manual, ofManual);
143
+ }
144
+ // Stale: a load that read the server earlier than one already applied for
145
+ // THIS caller. Its own answer stands, the shared picture does not move.
146
+ //
147
+ // Per caller, and nothing wider. An evicted caller's watermark goes with
148
+ // their picture, and that loses nothing: once nothing of theirs is held,
149
+ // whichever of their loads lands next is the newest picture this process
150
+ // has of them, and it restores the watermark that rejects any older one
151
+ // landing after it. A floor shared across callers would instead reject
152
+ // some OTHER caller's newest load for having begun before an unrelated
153
+ // eviction, and the owner's page would miss that caller's finding.
154
+ if (loadId < (this.applied.get(userId) ?? 0)) return found;
155
+ // Not about size — each entry is a handful of strings — but about a
156
+ // deployment with many callers never growing these without bound. Evicted
157
+ // one caller at a time, the longest unseen first, so every other caller's
158
+ // findings stay on the owner's page; the next load of the evicted surface
159
+ // puts its own back. (Re-inserted on every load, so a Map's insertion
160
+ // order is the order of last sight.)
161
+ while (this.applied.size >= MAX_REMEMBERED_CALLERS && !this.applied.has(userId)) {
162
+ const oldest = this.applied.keys().next().value as string;
163
+ this.applied.delete(oldest);
164
+ this.hidden.delete(oldest);
165
+ }
166
+ this.applied.delete(userId);
167
+ this.applied.set(userId, loadId);
168
+ if (picture.size > 0) this.hidden.set(userId, picture);
169
+ else this.hidden.delete(userId);
170
+ return found;
171
+ }
172
+
173
+ hiddenFor(manual: string): HiddenTool[] {
174
+ const union = new Map<string, HiddenTool>();
175
+ for (const picture of this.hidden.values()) {
176
+ for (const { manual: of, name, path, reason, marker } of picture.get(manual) ?? []) {
177
+ // One entry per distinct defect: two callers shown the same broken tool
178
+ // have found one thing, and its owner should read it once. Projected to
179
+ // the owner-facing shape, so nothing of the loading side rides along.
180
+ union.set(`${name}\u0000${path}\u0000${reason}`, { manual: of, name, path, reason, marker });
181
+ }
182
+ }
183
+ return [...union.values()];
184
+ }
185
+
186
+ /** The check itself, once per distinct schema. */
187
+ private verdict(schema: unknown): SchemaDefect | null {
188
+ const key = createHash('sha1').update(JSON.stringify(schema) ?? 'undefined').digest('hex');
189
+ const remembered = this.verdicts.get(key);
190
+ if (remembered !== undefined) return remembered;
191
+ const defect = this.check(schema);
192
+ if (this.verdicts.size >= MAX_REMEMBERED_SCHEMAS) this.verdicts.clear();
193
+ this.verdicts.set(key, defect);
194
+ return defect;
195
+ }
196
+ }