@bevel-software/platform-core-backend 0.1.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 (720) hide show
  1. package/LICENSE +202 -0
  2. package/dist/assets.d.ts +5 -0
  3. package/dist/assets.d.ts.map +1 -0
  4. package/dist/assets.js +23 -0
  5. package/dist/assets.js.map +1 -0
  6. package/dist/core/core-ports.d.ts +83 -0
  7. package/dist/core/core-ports.d.ts.map +1 -0
  8. package/dist/core/core-ports.js +12 -0
  9. package/dist/core/core-ports.js.map +1 -0
  10. package/dist/core/create-core-server.d.ts +62 -0
  11. package/dist/core/create-core-server.d.ts.map +1 -0
  12. package/dist/core/create-core-server.js +204 -0
  13. package/dist/core/create-core-server.js.map +1 -0
  14. package/dist/core/create-core-services.d.ts +95 -0
  15. package/dist/core/create-core-services.d.ts.map +1 -0
  16. package/dist/core/create-core-services.js +352 -0
  17. package/dist/core/create-core-services.js.map +1 -0
  18. package/dist/core-config.d.ts +119 -0
  19. package/dist/core-config.d.ts.map +1 -0
  20. package/dist/core-config.js +240 -0
  21. package/dist/core-config.js.map +1 -0
  22. package/dist/index.d.ts +36 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +36 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/modules/access/access-control.interface.d.ts +348 -0
  27. package/dist/modules/access/access-control.interface.d.ts.map +1 -0
  28. package/dist/modules/access/access-control.interface.js +2 -0
  29. package/dist/modules/access/access-control.interface.js.map +1 -0
  30. package/dist/modules/access/access-control.service.d.ts +323 -0
  31. package/dist/modules/access/access-control.service.d.ts.map +1 -0
  32. package/dist/modules/access/access-control.service.js +1431 -0
  33. package/dist/modules/access/access-control.service.js.map +1 -0
  34. package/dist/modules/access/access-errors.d.ts +34 -0
  35. package/dist/modules/access/access-errors.d.ts.map +1 -0
  36. package/dist/modules/access/access-errors.js +40 -0
  37. package/dist/modules/access/access-errors.js.map +1 -0
  38. package/dist/modules/access/access-mutation.service.d.ts +176 -0
  39. package/dist/modules/access/access-mutation.service.d.ts.map +1 -0
  40. package/dist/modules/access/access-mutation.service.js +307 -0
  41. package/dist/modules/access/access-mutation.service.js.map +1 -0
  42. package/dist/modules/access/access-splice.d.ts +98 -0
  43. package/dist/modules/access/access-splice.d.ts.map +1 -0
  44. package/dist/modules/access/access-splice.js +346 -0
  45. package/dist/modules/access/access-splice.js.map +1 -0
  46. package/dist/modules/access/access.routes.d.ts +10 -0
  47. package/dist/modules/access/access.routes.d.ts.map +1 -0
  48. package/dist/modules/access/access.routes.js +757 -0
  49. package/dist/modules/access/access.routes.js.map +1 -0
  50. package/dist/modules/access/creator-access.d.ts +113 -0
  51. package/dist/modules/access/creator-access.d.ts.map +1 -0
  52. package/dist/modules/access/creator-access.js +212 -0
  53. package/dist/modules/access/creator-access.js.map +1 -0
  54. package/dist/modules/access/kb-read-filter.d.ts +41 -0
  55. package/dist/modules/access/kb-read-filter.d.ts.map +1 -0
  56. package/dist/modules/access/kb-read-filter.js +60 -0
  57. package/dist/modules/access/kb-read-filter.js.map +1 -0
  58. package/dist/modules/access/roles-admin.service.d.ts +240 -0
  59. package/dist/modules/access/roles-admin.service.d.ts.map +1 -0
  60. package/dist/modules/access/roles-admin.service.js +630 -0
  61. package/dist/modules/access/roles-admin.service.js.map +1 -0
  62. package/dist/modules/access/roles-edit.d.ts +91 -0
  63. package/dist/modules/access/roles-edit.d.ts.map +1 -0
  64. package/dist/modules/access/roles-edit.js +232 -0
  65. package/dist/modules/access/roles-edit.js.map +1 -0
  66. package/dist/modules/access/roles-yaml-guard.d.ts +56 -0
  67. package/dist/modules/access/roles-yaml-guard.d.ts.map +1 -0
  68. package/dist/modules/access/roles-yaml-guard.js +79 -0
  69. package/dist/modules/access/roles-yaml-guard.js.map +1 -0
  70. package/dist/modules/admin/admin-access.routes.d.ts +18 -0
  71. package/dist/modules/admin/admin-access.routes.d.ts.map +1 -0
  72. package/dist/modules/admin/admin-access.routes.js +26 -0
  73. package/dist/modules/admin/admin-access.routes.js.map +1 -0
  74. package/dist/modules/admin/admin-access.service.d.ts +24 -0
  75. package/dist/modules/admin/admin-access.service.d.ts.map +1 -0
  76. package/dist/modules/admin/admin-access.service.js +41 -0
  77. package/dist/modules/admin/admin-access.service.js.map +1 -0
  78. package/dist/modules/admin/admin.interface.d.ts +11 -0
  79. package/dist/modules/admin/admin.interface.d.ts.map +1 -0
  80. package/dist/modules/admin/admin.interface.js +2 -0
  81. package/dist/modules/admin/admin.interface.js.map +1 -0
  82. package/dist/modules/auth/account-erasure.service.d.ts +80 -0
  83. package/dist/modules/auth/account-erasure.service.d.ts.map +1 -0
  84. package/dist/modules/auth/account-erasure.service.js +91 -0
  85. package/dist/modules/auth/account-erasure.service.js.map +1 -0
  86. package/dist/modules/auth/auth.middleware.d.ts +23 -0
  87. package/dist/modules/auth/auth.middleware.d.ts.map +1 -0
  88. package/dist/modules/auth/auth.middleware.js +68 -0
  89. package/dist/modules/auth/auth.middleware.js.map +1 -0
  90. package/dist/modules/auth/auth.routes.d.ts +25 -0
  91. package/dist/modules/auth/auth.routes.d.ts.map +1 -0
  92. package/dist/modules/auth/auth.routes.js +72 -0
  93. package/dist/modules/auth/auth.routes.js.map +1 -0
  94. package/dist/modules/auth/auth.service.d.ts +76 -0
  95. package/dist/modules/auth/auth.service.d.ts.map +1 -0
  96. package/dist/modules/auth/auth.service.js +168 -0
  97. package/dist/modules/auth/auth.service.js.map +1 -0
  98. package/dist/modules/code-mode/code-mode-names.d.ts +16 -0
  99. package/dist/modules/code-mode/code-mode-names.d.ts.map +1 -0
  100. package/dist/modules/code-mode/code-mode-names.js +30 -0
  101. package/dist/modules/code-mode/code-mode-names.js.map +1 -0
  102. package/dist/modules/code-mode/code-mode.tool.d.ts +13 -0
  103. package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -0
  104. package/dist/modules/code-mode/code-mode.tool.js +112 -0
  105. package/dist/modules/code-mode/code-mode.tool.js.map +1 -0
  106. package/dist/modules/code-mode/index.d.ts +3 -0
  107. package/dist/modules/code-mode/index.d.ts.map +1 -0
  108. package/dist/modules/code-mode/index.js +3 -0
  109. package/dist/modules/code-mode/index.js.map +1 -0
  110. package/dist/modules/database/connection.d.ts +6 -0
  111. package/dist/modules/database/connection.d.ts.map +1 -0
  112. package/dist/modules/database/connection.js +12 -0
  113. package/dist/modules/database/connection.js.map +1 -0
  114. package/dist/modules/database/core-schema.d.ts +2273 -0
  115. package/dist/modules/database/core-schema.d.ts.map +1 -0
  116. package/dist/modules/database/core-schema.js +413 -0
  117. package/dist/modules/database/core-schema.js.map +1 -0
  118. package/dist/modules/database/migrate.d.ts +10 -0
  119. package/dist/modules/database/migrate.d.ts.map +1 -0
  120. package/dist/modules/database/migrate.js +40 -0
  121. package/dist/modules/database/migrate.js.map +1 -0
  122. package/dist/modules/database/schema.d.ts +12 -0
  123. package/dist/modules/database/schema.d.ts.map +1 -0
  124. package/dist/modules/database/schema.js +12 -0
  125. package/dist/modules/database/schema.js.map +1 -0
  126. package/dist/modules/diff/diff-paths.d.ts +2 -0
  127. package/dist/modules/diff/diff-paths.d.ts.map +1 -0
  128. package/dist/modules/diff/diff-paths.js +9 -0
  129. package/dist/modules/diff/diff-paths.js.map +1 -0
  130. package/dist/modules/diff/diff.config.d.ts +8 -0
  131. package/dist/modules/diff/diff.config.d.ts.map +1 -0
  132. package/dist/modules/diff/diff.config.js +13 -0
  133. package/dist/modules/diff/diff.config.js.map +1 -0
  134. package/dist/modules/diff/diff.interface.d.ts +73 -0
  135. package/dist/modules/diff/diff.interface.d.ts.map +1 -0
  136. package/dist/modules/diff/diff.interface.js +2 -0
  137. package/dist/modules/diff/diff.interface.js.map +1 -0
  138. package/dist/modules/diff/diff.routes.d.ts +35 -0
  139. package/dist/modules/diff/diff.routes.d.ts.map +1 -0
  140. package/dist/modules/diff/diff.routes.js +228 -0
  141. package/dist/modules/diff/diff.routes.js.map +1 -0
  142. package/dist/modules/diff/diff.service.d.ts +51 -0
  143. package/dist/modules/diff/diff.service.d.ts.map +1 -0
  144. package/dist/modules/diff/diff.service.js +489 -0
  145. package/dist/modules/diff/diff.service.js.map +1 -0
  146. package/dist/modules/diff/line-diff.d.ts +16 -0
  147. package/dist/modules/diff/line-diff.d.ts.map +1 -0
  148. package/dist/modules/diff/line-diff.js +67 -0
  149. package/dist/modules/diff/line-diff.js.map +1 -0
  150. package/dist/modules/mcp/mcp-auth.middleware.d.ts +27 -0
  151. package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -0
  152. package/dist/modules/mcp/mcp-auth.middleware.js +116 -0
  153. package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -0
  154. package/dist/modules/mcp/mcp-session-store.d.ts +74 -0
  155. package/dist/modules/mcp/mcp-session-store.d.ts.map +1 -0
  156. package/dist/modules/mcp/mcp-session-store.js +131 -0
  157. package/dist/modules/mcp/mcp-session-store.js.map +1 -0
  158. package/dist/modules/mcp/mcp.routes.d.ts +24 -0
  159. package/dist/modules/mcp/mcp.routes.d.ts.map +1 -0
  160. package/dist/modules/mcp/mcp.routes.js +229 -0
  161. package/dist/modules/mcp/mcp.routes.js.map +1 -0
  162. package/dist/modules/mcp/mcp.service.d.ts +198 -0
  163. package/dist/modules/mcp/mcp.service.d.ts.map +1 -0
  164. package/dist/modules/mcp/mcp.service.js +840 -0
  165. package/dist/modules/mcp/mcp.service.js.map +1 -0
  166. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +76 -0
  167. package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -0
  168. package/dist/modules/mcp/oauth/bevel-oauth-provider.js +291 -0
  169. package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -0
  170. package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts +18 -0
  171. package/dist/modules/mcp/oauth/oauth-consent.routes.d.ts.map +1 -0
  172. package/dist/modules/mcp/oauth/oauth-consent.routes.js +52 -0
  173. package/dist/modules/mcp/oauth/oauth-consent.routes.js.map +1 -0
  174. package/dist/modules/mcp/oauth/oauth-state.d.ts +32 -0
  175. package/dist/modules/mcp/oauth/oauth-state.d.ts.map +1 -0
  176. package/dist/modules/mcp/oauth/oauth-state.js +34 -0
  177. package/dist/modules/mcp/oauth/oauth-state.js.map +1 -0
  178. package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts +92 -0
  179. package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts.map +1 -0
  180. package/dist/modules/secrets-vault/db-secrets-vault.service.js +728 -0
  181. package/dist/modules/secrets-vault/db-secrets-vault.service.js.map +1 -0
  182. package/dist/modules/secrets-vault/index.d.ts +7 -0
  183. package/dist/modules/secrets-vault/index.d.ts.map +1 -0
  184. package/dist/modules/secrets-vault/index.js +6 -0
  185. package/dist/modules/secrets-vault/index.js.map +1 -0
  186. package/dist/modules/secrets-vault/mcp-oauth-discovery.service.d.ts +63 -0
  187. package/dist/modules/secrets-vault/mcp-oauth-discovery.service.d.ts.map +1 -0
  188. package/dist/modules/secrets-vault/mcp-oauth-discovery.service.js +269 -0
  189. package/dist/modules/secrets-vault/mcp-oauth-discovery.service.js.map +1 -0
  190. package/dist/modules/secrets-vault/secrets-variable-loader.d.ts +46 -0
  191. package/dist/modules/secrets-vault/secrets-variable-loader.d.ts.map +1 -0
  192. package/dist/modules/secrets-vault/secrets-variable-loader.js +87 -0
  193. package/dist/modules/secrets-vault/secrets-variable-loader.js.map +1 -0
  194. package/dist/modules/secrets-vault/secrets-vault.contract.d.ts +210 -0
  195. package/dist/modules/secrets-vault/secrets-vault.contract.d.ts.map +1 -0
  196. package/dist/modules/secrets-vault/secrets-vault.contract.js +90 -0
  197. package/dist/modules/secrets-vault/secrets-vault.contract.js.map +1 -0
  198. package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +30 -0
  199. package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -0
  200. package/dist/modules/secrets-vault/secrets-vault.routes.js +490 -0
  201. package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -0
  202. package/dist/modules/skills/index.d.ts +5 -0
  203. package/dist/modules/skills/index.d.ts.map +1 -0
  204. package/dist/modules/skills/index.js +4 -0
  205. package/dist/modules/skills/index.js.map +1 -0
  206. package/dist/modules/skills/skills.contract.d.ts +58 -0
  207. package/dist/modules/skills/skills.contract.d.ts.map +1 -0
  208. package/dist/modules/skills/skills.contract.js +10 -0
  209. package/dist/modules/skills/skills.contract.js.map +1 -0
  210. package/dist/modules/skills/skills.routes.d.ts +15 -0
  211. package/dist/modules/skills/skills.routes.d.ts.map +1 -0
  212. package/dist/modules/skills/skills.routes.js +34 -0
  213. package/dist/modules/skills/skills.routes.js.map +1 -0
  214. package/dist/modules/skills/skills.service.d.ts +21 -0
  215. package/dist/modules/skills/skills.service.d.ts.map +1 -0
  216. package/dist/modules/skills/skills.service.js +202 -0
  217. package/dist/modules/skills/skills.service.js.map +1 -0
  218. package/dist/modules/skills/skills.tools.d.ts +15 -0
  219. package/dist/modules/skills/skills.tools.d.ts.map +1 -0
  220. package/dist/modules/skills/skills.tools.js +96 -0
  221. package/dist/modules/skills/skills.tools.js.map +1 -0
  222. package/dist/modules/tool-auth/external-api-key.errors.d.ts +14 -0
  223. package/dist/modules/tool-auth/external-api-key.errors.d.ts.map +1 -0
  224. package/dist/modules/tool-auth/external-api-key.errors.js +23 -0
  225. package/dist/modules/tool-auth/external-api-key.errors.js.map +1 -0
  226. package/dist/modules/tool-auth/external-api-key.interface.d.ts +90 -0
  227. package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -0
  228. package/dist/modules/tool-auth/external-api-key.interface.js +2 -0
  229. package/dist/modules/tool-auth/external-api-key.interface.js.map +1 -0
  230. package/dist/modules/tool-auth/external-api-key.service.d.ts +25 -0
  231. package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -0
  232. package/dist/modules/tool-auth/external-api-key.service.js +164 -0
  233. package/dist/modules/tool-auth/external-api-key.service.js.map +1 -0
  234. package/dist/modules/tool-auth/internal-token.service.d.ts +62 -0
  235. package/dist/modules/tool-auth/internal-token.service.d.ts.map +1 -0
  236. package/dist/modules/tool-auth/internal-token.service.js +85 -0
  237. package/dist/modules/tool-auth/internal-token.service.js.map +1 -0
  238. package/dist/modules/tool-auth/llm-usage-meter.d.ts +16 -0
  239. package/dist/modules/tool-auth/llm-usage-meter.d.ts.map +1 -0
  240. package/dist/modules/tool-auth/llm-usage-meter.js +6 -0
  241. package/dist/modules/tool-auth/llm-usage-meter.js.map +1 -0
  242. package/dist/modules/tool-auth/tool-auth.middleware.d.ts +101 -0
  243. package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -0
  244. package/dist/modules/tool-auth/tool-auth.middleware.js +166 -0
  245. package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -0
  246. package/dist/modules/tool-helpers/index.d.ts +19 -0
  247. package/dist/modules/tool-helpers/index.d.ts.map +1 -0
  248. package/dist/modules/tool-helpers/index.js +18 -0
  249. package/dist/modules/tool-helpers/index.js.map +1 -0
  250. package/dist/modules/tool-helpers/tool-context.d.ts +35 -0
  251. package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -0
  252. package/dist/modules/tool-helpers/tool-context.js +66 -0
  253. package/dist/modules/tool-helpers/tool-context.js.map +1 -0
  254. package/dist/modules/tool-helpers/tool-def.d.ts +33 -0
  255. package/dist/modules/tool-helpers/tool-def.d.ts.map +1 -0
  256. package/dist/modules/tool-helpers/tool-def.js +57 -0
  257. package/dist/modules/tool-helpers/tool-def.js.map +1 -0
  258. package/dist/modules/tool-helpers/tool-handler.d.ts +19 -0
  259. package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -0
  260. package/dist/modules/tool-helpers/tool-handler.js +84 -0
  261. package/dist/modules/tool-helpers/tool-handler.js.map +1 -0
  262. package/dist/modules/tool-helpers/tool.contract.d.ts +64 -0
  263. package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -0
  264. package/dist/modules/tool-helpers/tool.contract.js +24 -0
  265. package/dist/modules/tool-helpers/tool.contract.js.map +1 -0
  266. package/dist/modules/tool-helpers/validate-token.d.ts +31 -0
  267. package/dist/modules/tool-helpers/validate-token.d.ts.map +1 -0
  268. package/dist/modules/tool-helpers/validate-token.js +20 -0
  269. package/dist/modules/tool-helpers/validate-token.js.map +1 -0
  270. package/dist/modules/tool-manuals/index.d.ts +5 -0
  271. package/dist/modules/tool-manuals/index.d.ts.map +1 -0
  272. package/dist/modules/tool-manuals/index.js +5 -0
  273. package/dist/modules/tool-manuals/index.js.map +1 -0
  274. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +182 -0
  275. package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -0
  276. package/dist/modules/tool-manuals/tool-manuals.contract.js +19 -0
  277. package/dist/modules/tool-manuals/tool-manuals.contract.js.map +1 -0
  278. package/dist/modules/tool-manuals/tool-manuals.routes.d.ts +24 -0
  279. package/dist/modules/tool-manuals/tool-manuals.routes.d.ts.map +1 -0
  280. package/dist/modules/tool-manuals/tool-manuals.routes.js +102 -0
  281. package/dist/modules/tool-manuals/tool-manuals.routes.js.map +1 -0
  282. package/dist/modules/tool-manuals/tool-manuals.service.d.ts +108 -0
  283. package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -0
  284. package/dist/modules/tool-manuals/tool-manuals.service.js +710 -0
  285. package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -0
  286. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +35 -0
  287. package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -0
  288. package/dist/modules/tool-manuals/tool-manuals.tools.js +157 -0
  289. package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -0
  290. package/dist/modules/tool-registry/manual.routes.d.ts +6 -0
  291. package/dist/modules/tool-registry/manual.routes.d.ts.map +1 -0
  292. package/dist/modules/tool-registry/manual.routes.js +76 -0
  293. package/dist/modules/tool-registry/manual.routes.js.map +1 -0
  294. package/dist/modules/tool-registry/tool-registry.d.ts +23 -0
  295. package/dist/modules/tool-registry/tool-registry.d.ts.map +1 -0
  296. package/dist/modules/tool-registry/tool-registry.js +46 -0
  297. package/dist/modules/tool-registry/tool-registry.js.map +1 -0
  298. package/dist/modules/tool-registry/tool.contract.d.ts +48 -0
  299. package/dist/modules/tool-registry/tool.contract.d.ts.map +1 -0
  300. package/dist/modules/tool-registry/tool.contract.js +2 -0
  301. package/dist/modules/tool-registry/tool.contract.js.map +1 -0
  302. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +14 -0
  303. package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -0
  304. package/dist/modules/workflow/agent-tools/workflow.tools.js +437 -0
  305. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -0
  306. package/dist/modules/workflow/event-bus.d.ts +107 -0
  307. package/dist/modules/workflow/event-bus.d.ts.map +1 -0
  308. package/dist/modules/workflow/event-bus.js +224 -0
  309. package/dist/modules/workflow/event-bus.js.map +1 -0
  310. package/dist/modules/workflow/events.routes.d.ts +80 -0
  311. package/dist/modules/workflow/events.routes.d.ts.map +1 -0
  312. package/dist/modules/workflow/events.routes.js +216 -0
  313. package/dist/modules/workflow/events.routes.js.map +1 -0
  314. package/dist/modules/workflow/file-change-notifier.d.ts +38 -0
  315. package/dist/modules/workflow/file-change-notifier.d.ts.map +1 -0
  316. package/dist/modules/workflow/file-change-notifier.js +22 -0
  317. package/dist/modules/workflow/file-change-notifier.js.map +1 -0
  318. package/dist/modules/workflow/file-lock.service.d.ts +57 -0
  319. package/dist/modules/workflow/file-lock.service.d.ts.map +1 -0
  320. package/dist/modules/workflow/file-lock.service.js +202 -0
  321. package/dist/modules/workflow/file-lock.service.js.map +1 -0
  322. package/dist/modules/workflow/git/branch-name.d.ts +10 -0
  323. package/dist/modules/workflow/git/branch-name.d.ts.map +1 -0
  324. package/dist/modules/workflow/git/branch-name.js +76 -0
  325. package/dist/modules/workflow/git/branch-name.js.map +1 -0
  326. package/dist/modules/workflow/git/clone-config.d.ts +61 -0
  327. package/dist/modules/workflow/git/clone-config.d.ts.map +1 -0
  328. package/dist/modules/workflow/git/clone-config.js +69 -0
  329. package/dist/modules/workflow/git/clone-config.js.map +1 -0
  330. package/dist/modules/workflow/git/git-version.d.ts +34 -0
  331. package/dist/modules/workflow/git/git-version.d.ts.map +1 -0
  332. package/dist/modules/workflow/git/git-version.js +63 -0
  333. package/dist/modules/workflow/git/git-version.js.map +1 -0
  334. package/dist/modules/workflow/git/git.service.d.ts +427 -0
  335. package/dist/modules/workflow/git/git.service.d.ts.map +1 -0
  336. package/dist/modules/workflow/git/git.service.js +1987 -0
  337. package/dist/modules/workflow/git/git.service.js.map +1 -0
  338. package/dist/modules/workflow/git/mutex.d.ts +11 -0
  339. package/dist/modules/workflow/git/mutex.d.ts.map +1 -0
  340. package/dist/modules/workflow/git/mutex.js +23 -0
  341. package/dist/modules/workflow/git/mutex.js.map +1 -0
  342. package/dist/modules/workflow/git/pull-request.service.d.ts +124 -0
  343. package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -0
  344. package/dist/modules/workflow/git/pull-request.service.js +328 -0
  345. package/dist/modules/workflow/git/pull-request.service.js.map +1 -0
  346. package/dist/modules/workflow/locking-filesystem.d.ts +133 -0
  347. package/dist/modules/workflow/locking-filesystem.d.ts.map +1 -0
  348. package/dist/modules/workflow/locking-filesystem.js +400 -0
  349. package/dist/modules/workflow/locking-filesystem.js.map +1 -0
  350. package/dist/modules/workflow/pending-commits.service.d.ts +221 -0
  351. package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -0
  352. package/dist/modules/workflow/pending-commits.service.js +364 -0
  353. package/dist/modules/workflow/pending-commits.service.js.map +1 -0
  354. package/dist/modules/workflow/pending-commits.worker.d.ts +148 -0
  355. package/dist/modules/workflow/pending-commits.worker.d.ts.map +1 -0
  356. package/dist/modules/workflow/pending-commits.worker.js +245 -0
  357. package/dist/modules/workflow/pending-commits.worker.js.map +1 -0
  358. package/dist/modules/workflow/read-only-filesystem.d.ts +24 -0
  359. package/dist/modules/workflow/read-only-filesystem.d.ts.map +1 -0
  360. package/dist/modules/workflow/read-only-filesystem.js +39 -0
  361. package/dist/modules/workflow/read-only-filesystem.js.map +1 -0
  362. package/dist/modules/workflow/recovery-bot.d.ts +31 -0
  363. package/dist/modules/workflow/recovery-bot.d.ts.map +1 -0
  364. package/dist/modules/workflow/recovery-bot.js +64 -0
  365. package/dist/modules/workflow/recovery-bot.js.map +1 -0
  366. package/dist/modules/workflow/review-workflow/review-workflow.interface.d.ts +137 -0
  367. package/dist/modules/workflow/review-workflow/review-workflow.interface.d.ts.map +1 -0
  368. package/dist/modules/workflow/review-workflow/review-workflow.interface.js +2 -0
  369. package/dist/modules/workflow/review-workflow/review-workflow.interface.js.map +1 -0
  370. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts +26 -0
  371. package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -0
  372. package/dist/modules/workflow/review-workflow/review-workflow.service.js +636 -0
  373. package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -0
  374. package/dist/modules/workflow/sanitize-error.d.ts +29 -0
  375. package/dist/modules/workflow/sanitize-error.d.ts.map +1 -0
  376. package/dist/modules/workflow/sanitize-error.js +60 -0
  377. package/dist/modules/workflow/sanitize-error.js.map +1 -0
  378. package/dist/modules/workflow/session-ontology.policy.d.ts +52 -0
  379. package/dist/modules/workflow/session-ontology.policy.d.ts.map +1 -0
  380. package/dist/modules/workflow/session-ontology.policy.js +62 -0
  381. package/dist/modules/workflow/session-ontology.policy.js.map +1 -0
  382. package/dist/modules/workflow/session-ontology.service.d.ts +100 -0
  383. package/dist/modules/workflow/session-ontology.service.d.ts.map +1 -0
  384. package/dist/modules/workflow/session-ontology.service.js +143 -0
  385. package/dist/modules/workflow/session-ontology.service.js.map +1 -0
  386. package/dist/modules/workflow/workflow-hooks.d.ts +87 -0
  387. package/dist/modules/workflow/workflow-hooks.d.ts.map +1 -0
  388. package/dist/modules/workflow/workflow-hooks.js +35 -0
  389. package/dist/modules/workflow/workflow-hooks.js.map +1 -0
  390. package/dist/modules/workflow/workflow.errors.d.ts +171 -0
  391. package/dist/modules/workflow/workflow.errors.d.ts.map +1 -0
  392. package/dist/modules/workflow/workflow.errors.js +260 -0
  393. package/dist/modules/workflow/workflow.errors.js.map +1 -0
  394. package/dist/modules/workflow/workflow.routes.d.ts +26 -0
  395. package/dist/modules/workflow/workflow.routes.d.ts.map +1 -0
  396. package/dist/modules/workflow/workflow.routes.js +804 -0
  397. package/dist/modules/workflow/workflow.routes.js.map +1 -0
  398. package/dist/modules/workflow/workflow.service.d.ts +385 -0
  399. package/dist/modules/workflow/workflow.service.d.ts.map +1 -0
  400. package/dist/modules/workflow/workflow.service.js +1155 -0
  401. package/dist/modules/workflow/workflow.service.js.map +1 -0
  402. package/dist/modules/workspace/bevel-ignore.d.ts +25 -0
  403. package/dist/modules/workspace/bevel-ignore.d.ts.map +1 -0
  404. package/dist/modules/workspace/bevel-ignore.js +57 -0
  405. package/dist/modules/workspace/bevel-ignore.js.map +1 -0
  406. package/dist/modules/workspace/kb-seed.interface.d.ts +36 -0
  407. package/dist/modules/workspace/kb-seed.interface.d.ts.map +1 -0
  408. package/dist/modules/workspace/kb-seed.interface.js +2 -0
  409. package/dist/modules/workspace/kb-seed.interface.js.map +1 -0
  410. package/dist/modules/workspace/kb-seed.service.d.ts +70 -0
  411. package/dist/modules/workspace/kb-seed.service.d.ts.map +1 -0
  412. package/dist/modules/workspace/kb-seed.service.js +325 -0
  413. package/dist/modules/workspace/kb-seed.service.js.map +1 -0
  414. package/dist/modules/workspace/routine-write-policy.d.ts +49 -0
  415. package/dist/modules/workspace/routine-write-policy.d.ts.map +1 -0
  416. package/dist/modules/workspace/routine-write-policy.js +46 -0
  417. package/dist/modules/workspace/routine-write-policy.js.map +1 -0
  418. package/dist/modules/workspace/session-ontology.gate.d.ts +112 -0
  419. package/dist/modules/workspace/session-ontology.gate.d.ts.map +1 -0
  420. package/dist/modules/workspace/session-ontology.gate.js +161 -0
  421. package/dist/modules/workspace/session-ontology.gate.js.map +1 -0
  422. package/dist/modules/workspace/session-sink.d.ts +25 -0
  423. package/dist/modules/workspace/session-sink.d.ts.map +1 -0
  424. package/dist/modules/workspace/session-sink.js +8 -0
  425. package/dist/modules/workspace/session-sink.js.map +1 -0
  426. package/dist/modules/workspace/spill-store.d.ts +24 -0
  427. package/dist/modules/workspace/spill-store.d.ts.map +1 -0
  428. package/dist/modules/workspace/spill-store.js +87 -0
  429. package/dist/modules/workspace/spill-store.js.map +1 -0
  430. package/dist/modules/workspace/workspace.routes.d.ts +25 -0
  431. package/dist/modules/workspace/workspace.routes.d.ts.map +1 -0
  432. package/dist/modules/workspace/workspace.routes.js +1046 -0
  433. package/dist/modules/workspace/workspace.routes.js.map +1 -0
  434. package/dist/modules/workspace/workspace.service.d.ts +339 -0
  435. package/dist/modules/workspace/workspace.service.d.ts.map +1 -0
  436. package/dist/modules/workspace/workspace.service.js +1221 -0
  437. package/dist/modules/workspace/workspace.service.js.map +1 -0
  438. package/dist/modules/workspace/workspace.tools.d.ts +19 -0
  439. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -0
  440. package/dist/modules/workspace/workspace.tools.js +767 -0
  441. package/dist/modules/workspace/workspace.tools.js.map +1 -0
  442. package/dist/shared/frontmatter-id.d.ts +35 -0
  443. package/dist/shared/frontmatter-id.d.ts.map +1 -0
  444. package/dist/shared/frontmatter-id.js +68 -0
  445. package/dist/shared/frontmatter-id.js.map +1 -0
  446. package/dist/shared/fs-walk.d.ts +9 -0
  447. package/dist/shared/fs-walk.d.ts.map +1 -0
  448. package/dist/shared/fs-walk.js +34 -0
  449. package/dist/shared/fs-walk.js.map +1 -0
  450. package/dist/shared/hash-email.d.ts +11 -0
  451. package/dist/shared/hash-email.d.ts.map +1 -0
  452. package/dist/shared/hash-email.js +14 -0
  453. package/dist/shared/hash-email.js.map +1 -0
  454. package/dist/shared/kb-layout.d.ts +38 -0
  455. package/dist/shared/kb-layout.d.ts.map +1 -0
  456. package/dist/shared/kb-layout.js +102 -0
  457. package/dist/shared/kb-layout.js.map +1 -0
  458. package/dist/shared/kb-layout.test.d.ts +2 -0
  459. package/dist/shared/kb-layout.test.d.ts.map +1 -0
  460. package/dist/shared/kb-layout.test.js +67 -0
  461. package/dist/shared/kb-layout.test.js.map +1 -0
  462. package/dist/shared/ssrf.d.ts +20 -0
  463. package/dist/shared/ssrf.d.ts.map +1 -0
  464. package/dist/shared/ssrf.js +89 -0
  465. package/dist/shared/ssrf.js.map +1 -0
  466. package/dist/shared/token-crypto.d.ts +16 -0
  467. package/dist/shared/token-crypto.d.ts.map +1 -0
  468. package/dist/shared/token-crypto.js +49 -0
  469. package/dist/shared/token-crypto.js.map +1 -0
  470. package/dist/shared/ttl-cache.d.ts +16 -0
  471. package/dist/shared/ttl-cache.d.ts.map +1 -0
  472. package/dist/shared/ttl-cache.js +27 -0
  473. package/dist/shared/ttl-cache.js.map +1 -0
  474. package/dist/shared/utcp-namespace.d.ts +46 -0
  475. package/dist/shared/utcp-namespace.d.ts.map +1 -0
  476. package/dist/shared/utcp-namespace.js +82 -0
  477. package/dist/shared/utcp-namespace.js.map +1 -0
  478. package/dist/version.d.ts +17 -0
  479. package/dist/version.d.ts.map +1 -0
  480. package/dist/version.js +19 -0
  481. package/dist/version.js.map +1 -0
  482. package/kb-template/.bevelignore +21 -0
  483. package/kb-template/Agents/.gitkeep +0 -0
  484. package/kb-template/Agents/README.md +38 -0
  485. package/kb-template/CLAUDE.md +419 -0
  486. package/kb-template/Data/.gitkeep +0 -0
  487. package/kb-template/Data/README.md +39 -0
  488. package/kb-template/KnowledgeBase/.gitkeep +0 -0
  489. package/kb-template/KnowledgeBase/README.md +37 -0
  490. package/kb-template/Pipelines/.gitkeep +0 -0
  491. package/kb-template/Pipelines/README.md +38 -0
  492. package/kb-template/Skills/.gitkeep +0 -0
  493. package/kb-template/Skills/README.md +32 -0
  494. package/kb-template/Tools/.gitkeep +0 -0
  495. package/kb-template/Tools/README.md +42 -0
  496. package/kb-template/access.md +36 -0
  497. package/migrations/0000_core_init.sql +243 -0
  498. package/migrations/meta/0000_snapshot.json +1480 -0
  499. package/migrations/meta/_journal.json +13 -0
  500. package/package.json +80 -0
  501. package/src/assets.ts +25 -0
  502. package/src/core/core-ports.ts +91 -0
  503. package/src/core/create-core-server.ts +338 -0
  504. package/src/core/create-core-services.ts +501 -0
  505. package/src/core-config.ts +257 -0
  506. package/src/index.ts +69 -0
  507. package/src/modules/access/__tests__/access-control.atref-batch.test.ts +98 -0
  508. package/src/modules/access/__tests__/access-control.read-batch.test.ts +132 -0
  509. package/src/modules/access/__tests__/access-control.service.test.ts +1011 -0
  510. package/src/modules/access/__tests__/access-mutation.service.test.ts +439 -0
  511. package/src/modules/access/__tests__/access-splice.test.ts +247 -0
  512. package/src/modules/access/__tests__/access.routes.revoke.test.ts +407 -0
  513. package/src/modules/access/__tests__/creator-access.test.ts +217 -0
  514. package/src/modules/access/__tests__/grant-sources.test.ts +204 -0
  515. package/src/modules/access/__tests__/kb-read-filter.test.ts +70 -0
  516. package/src/modules/access/__tests__/roles-admin.service.test.ts +469 -0
  517. package/src/modules/access/__tests__/roles-edit.test.ts +138 -0
  518. package/src/modules/access/__tests__/roles-yaml-guard.test.ts +70 -0
  519. package/src/modules/access/__tests__/roles.routes.test.ts +234 -0
  520. package/src/modules/access/access-control.interface.ts +383 -0
  521. package/src/modules/access/access-control.service.ts +1794 -0
  522. package/src/modules/access/access-errors.ts +60 -0
  523. package/src/modules/access/access-mutation.service.ts +369 -0
  524. package/src/modules/access/access-splice.ts +413 -0
  525. package/src/modules/access/access.routes.ts +894 -0
  526. package/src/modules/access/creator-access.ts +270 -0
  527. package/src/modules/access/kb-read-filter.ts +76 -0
  528. package/src/modules/access/roles-admin.service.ts +741 -0
  529. package/src/modules/access/roles-edit.ts +248 -0
  530. package/src/modules/access/roles-yaml-guard.ts +89 -0
  531. package/src/modules/admin/admin-access.routes.ts +29 -0
  532. package/src/modules/admin/admin-access.service.ts +38 -0
  533. package/src/modules/admin/admin.interface.ts +10 -0
  534. package/src/modules/auth/account-erasure.service.ts +183 -0
  535. package/src/modules/auth/auth.middleware.ts +78 -0
  536. package/src/modules/auth/auth.routes.ts +97 -0
  537. package/src/modules/auth/auth.service.ts +199 -0
  538. package/src/modules/code-mode/code-mode-names.ts +38 -0
  539. package/src/modules/code-mode/code-mode.tool.ts +117 -0
  540. package/src/modules/code-mode/index.ts +6 -0
  541. package/src/modules/database/connection.ts +15 -0
  542. package/src/modules/database/core-schema.ts +431 -0
  543. package/src/modules/database/migrate.ts +43 -0
  544. package/src/modules/database/schema.ts +11 -0
  545. package/src/modules/diff/__tests__/diff.routes.read-gate.test.ts +87 -0
  546. package/src/modules/diff/__tests__/diff.routes.rejectPathsLocked.test.ts +150 -0
  547. package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +184 -0
  548. package/src/modules/diff/__tests__/diff.service.test.ts +202 -0
  549. package/src/modules/diff/diff-paths.ts +9 -0
  550. package/src/modules/diff/diff.config.ts +12 -0
  551. package/src/modules/diff/diff.interface.ts +78 -0
  552. package/src/modules/diff/diff.routes.ts +277 -0
  553. package/src/modules/diff/diff.service.ts +508 -0
  554. package/src/modules/diff/line-diff.ts +79 -0
  555. package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +287 -0
  556. package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +249 -0
  557. package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +253 -0
  558. package/src/modules/mcp/__tests__/mcp-session-store.test.ts +151 -0
  559. package/src/modules/mcp/__tests__/mcp.e2e.test.ts +150 -0
  560. package/src/modules/mcp/__tests__/mcp.routes.delete.test.ts +92 -0
  561. package/src/modules/mcp/__tests__/mcp.service.test.ts +414 -0
  562. package/src/modules/mcp/mcp-auth.middleware.ts +126 -0
  563. package/src/modules/mcp/mcp-session-store.ts +162 -0
  564. package/src/modules/mcp/mcp.routes.ts +263 -0
  565. package/src/modules/mcp/mcp.service.ts +973 -0
  566. package/src/modules/mcp/oauth/bevel-oauth-provider.ts +401 -0
  567. package/src/modules/mcp/oauth/oauth-consent.routes.ts +60 -0
  568. package/src/modules/mcp/oauth/oauth-state.ts +61 -0
  569. package/src/modules/secrets-vault/__tests__/connect-pending.route.test.ts +277 -0
  570. package/src/modules/secrets-vault/__tests__/db-secrets-vault.oauth.test.ts +206 -0
  571. package/src/modules/secrets-vault/__tests__/mcp-oauth-discovery.service.test.ts +178 -0
  572. package/src/modules/secrets-vault/__tests__/scopes-covered.test.ts +101 -0
  573. package/src/modules/secrets-vault/__tests__/secrets-variable-loader.test.ts +54 -0
  574. package/src/modules/secrets-vault/__tests__/tool-owner-gate.route.test.ts +143 -0
  575. package/src/modules/secrets-vault/db-secrets-vault.service.ts +792 -0
  576. package/src/modules/secrets-vault/index.ts +25 -0
  577. package/src/modules/secrets-vault/mcp-oauth-discovery.service.ts +289 -0
  578. package/src/modules/secrets-vault/secrets-variable-loader.ts +104 -0
  579. package/src/modules/secrets-vault/secrets-vault.contract.ts +270 -0
  580. package/src/modules/secrets-vault/secrets-vault.routes.ts +526 -0
  581. package/src/modules/skills/__tests__/skills.service.test.ts +176 -0
  582. package/src/modules/skills/index.ts +10 -0
  583. package/src/modules/skills/skills.contract.ts +54 -0
  584. package/src/modules/skills/skills.routes.ts +38 -0
  585. package/src/modules/skills/skills.service.ts +245 -0
  586. package/src/modules/skills/skills.tools.ts +121 -0
  587. package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +358 -0
  588. package/src/modules/tool-auth/__tests__/internal-token.service.test.ts +79 -0
  589. package/src/modules/tool-auth/__tests__/manual-auth.middleware.test.ts +88 -0
  590. package/src/modules/tool-auth/external-api-key.errors.ts +25 -0
  591. package/src/modules/tool-auth/external-api-key.interface.ts +99 -0
  592. package/src/modules/tool-auth/external-api-key.service.ts +209 -0
  593. package/src/modules/tool-auth/internal-token.service.ts +124 -0
  594. package/src/modules/tool-auth/llm-usage-meter.ts +19 -0
  595. package/src/modules/tool-auth/tool-auth.middleware.ts +220 -0
  596. package/src/modules/tool-helpers/__tests__/phase0-loopback-spike.test.ts +129 -0
  597. package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +95 -0
  598. package/src/modules/tool-helpers/__tests__/tools-surface.test.ts +146 -0
  599. package/src/modules/tool-helpers/__tests__/validate-token.test.ts +75 -0
  600. package/src/modules/tool-helpers/index.ts +18 -0
  601. package/src/modules/tool-helpers/tool-context.ts +98 -0
  602. package/src/modules/tool-helpers/tool-def.ts +73 -0
  603. package/src/modules/tool-helpers/tool-handler.ts +91 -0
  604. package/src/modules/tool-helpers/tool.contract.ts +85 -0
  605. package/src/modules/tool-helpers/validate-token.ts +50 -0
  606. package/src/modules/tool-manuals/__tests__/tool-manuals.mcp-oauth.test.ts +200 -0
  607. package/src/modules/tool-manuals/__tests__/tool-manuals.service.test.ts +499 -0
  608. package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +156 -0
  609. package/src/modules/tool-manuals/index.ts +12 -0
  610. package/src/modules/tool-manuals/tool-manuals.contract.ts +183 -0
  611. package/src/modules/tool-manuals/tool-manuals.routes.ts +110 -0
  612. package/src/modules/tool-manuals/tool-manuals.service.ts +781 -0
  613. package/src/modules/tool-manuals/tool-manuals.tools.ts +202 -0
  614. package/src/modules/tool-registry/__tests__/tool-registry.test.ts +64 -0
  615. package/src/modules/tool-registry/manual.routes.ts +87 -0
  616. package/src/modules/tool-registry/tool-registry.ts +55 -0
  617. package/src/modules/tool-registry/tool.contract.ts +52 -0
  618. package/src/modules/workflow/__tests__/event-bus.test.ts +322 -0
  619. package/src/modules/workflow/__tests__/file-change-notifier.test.ts +51 -0
  620. package/src/modules/workflow/__tests__/format-affected-owners.test.ts +67 -0
  621. package/src/modules/workflow/__tests__/locking-filesystem.test.ts +445 -0
  622. package/src/modules/workflow/__tests__/pending-commits.canonical.test.ts +36 -0
  623. package/src/modules/workflow/__tests__/pending-commits.worker.test.ts +243 -0
  624. package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +308 -0
  625. package/src/modules/workflow/__tests__/sanitize-error.test.ts +67 -0
  626. package/src/modules/workflow/__tests__/session-ontology.policy.test.ts +62 -0
  627. package/src/modules/workflow/__tests__/session-ontology.service.test.ts +200 -0
  628. package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +232 -0
  629. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +380 -0
  630. package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +340 -0
  631. package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +192 -0
  632. package/src/modules/workflow/agent-tools/workflow.tools.ts +502 -0
  633. package/src/modules/workflow/event-bus.ts +262 -0
  634. package/src/modules/workflow/events.routes.ts +266 -0
  635. package/src/modules/workflow/file-change-notifier.ts +54 -0
  636. package/src/modules/workflow/file-lock.service.ts +269 -0
  637. package/src/modules/workflow/git/__tests__/branch-name.test.ts +86 -0
  638. package/src/modules/workflow/git/__tests__/branchAuthor.test.ts +80 -0
  639. package/src/modules/workflow/git/__tests__/clone-config.test.ts +15 -0
  640. package/src/modules/workflow/git/__tests__/git-test-helpers.ts +47 -0
  641. package/src/modules/workflow/git/__tests__/git-version.failure.test.ts +24 -0
  642. package/src/modules/workflow/git/__tests__/git-version.test.ts +49 -0
  643. package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +389 -0
  644. package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +124 -0
  645. package/src/modules/workflow/git/__tests__/git.service.commitChanges.test.ts +105 -0
  646. package/src/modules/workflow/git/__tests__/git.service.commitFile.test.ts +211 -0
  647. package/src/modules/workflow/git/__tests__/git.service.createBranch.test.ts +154 -0
  648. package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +320 -0
  649. package/src/modules/workflow/git/__tests__/git.service.diffFileAtCommit.test.ts +202 -0
  650. package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +453 -0
  651. package/src/modules/workflow/git/__tests__/git.service.list-branches.test.ts +198 -0
  652. package/src/modules/workflow/git/__tests__/git.service.listTrackedFiles.test.ts +125 -0
  653. package/src/modules/workflow/git/__tests__/git.service.logForFile.test.ts +219 -0
  654. package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +145 -0
  655. package/src/modules/workflow/git/__tests__/git.service.pendingChanges.test.ts +240 -0
  656. package/src/modules/workflow/git/__tests__/git.service.postMergePull.test.ts +272 -0
  657. package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +232 -0
  658. package/src/modules/workflow/git/__tests__/git.service.readFileAtRef.test.ts +101 -0
  659. package/src/modules/workflow/git/__tests__/git.service.status.test.ts +127 -0
  660. package/src/modules/workflow/git/__tests__/mutex.test.ts +78 -0
  661. package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +225 -0
  662. package/src/modules/workflow/git/__tests__/pull-request.service.viewer-can-cancel.test.ts +101 -0
  663. package/src/modules/workflow/git/branch-name.ts +70 -0
  664. package/src/modules/workflow/git/clone-config.ts +71 -0
  665. package/src/modules/workflow/git/git-version.ts +70 -0
  666. package/src/modules/workflow/git/git.service.ts +2248 -0
  667. package/src/modules/workflow/git/mutex.ts +22 -0
  668. package/src/modules/workflow/git/pull-request.service.ts +447 -0
  669. package/src/modules/workflow/locking-filesystem.ts +489 -0
  670. package/src/modules/workflow/pending-commits.service.ts +444 -0
  671. package/src/modules/workflow/pending-commits.worker.ts +361 -0
  672. package/src/modules/workflow/read-only-filesystem.ts +54 -0
  673. package/src/modules/workflow/recovery-bot.ts +73 -0
  674. package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +560 -0
  675. package/src/modules/workflow/review-workflow/__tests__/cancel-pr.test.ts +176 -0
  676. package/src/modules/workflow/review-workflow/__tests__/merge-gate.test.ts +258 -0
  677. package/src/modules/workflow/review-workflow/review-workflow.interface.ts +199 -0
  678. package/src/modules/workflow/review-workflow/review-workflow.service.ts +806 -0
  679. package/src/modules/workflow/sanitize-error.ts +62 -0
  680. package/src/modules/workflow/session-ontology.policy.ts +70 -0
  681. package/src/modules/workflow/session-ontology.service.ts +178 -0
  682. package/src/modules/workflow/workflow-hooks.ts +101 -0
  683. package/src/modules/workflow/workflow.errors.ts +285 -0
  684. package/src/modules/workflow/workflow.routes.ts +858 -0
  685. package/src/modules/workflow/workflow.service.ts +1555 -0
  686. package/src/modules/workspace/__tests__/kb-seed.service.test.ts +213 -0
  687. package/src/modules/workspace/__tests__/routine-write-policy.test.ts +68 -0
  688. package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +237 -0
  689. package/src/modules/workspace/__tests__/spill-store.test.ts +43 -0
  690. package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +233 -0
  691. package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +176 -0
  692. package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +303 -0
  693. package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +276 -0
  694. package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +120 -0
  695. package/src/modules/workspace/__tests__/workspace.service.test.ts +565 -0
  696. package/src/modules/workspace/__tests__/workspace.tools.test.ts +504 -0
  697. package/src/modules/workspace/bevel-ignore.ts +62 -0
  698. package/src/modules/workspace/kb-seed.interface.ts +36 -0
  699. package/src/modules/workspace/kb-seed.service.ts +361 -0
  700. package/src/modules/workspace/routine-write-policy.ts +79 -0
  701. package/src/modules/workspace/session-ontology.gate.ts +189 -0
  702. package/src/modules/workspace/session-sink.ts +25 -0
  703. package/src/modules/workspace/spill-store.ts +87 -0
  704. package/src/modules/workspace/workspace.routes.ts +1114 -0
  705. package/src/modules/workspace/workspace.service.ts +1343 -0
  706. package/src/modules/workspace/workspace.tools.ts +885 -0
  707. package/src/shared/__tests__/frontmatter-id.test.ts +88 -0
  708. package/src/shared/__tests__/fs-walk.test.ts +42 -0
  709. package/src/shared/__tests__/ssrf.test.ts +53 -0
  710. package/src/shared/__tests__/utcp-namespace.test.ts +19 -0
  711. package/src/shared/frontmatter-id.ts +72 -0
  712. package/src/shared/fs-walk.ts +30 -0
  713. package/src/shared/hash-email.ts +14 -0
  714. package/src/shared/kb-layout.test.ts +88 -0
  715. package/src/shared/kb-layout.ts +101 -0
  716. package/src/shared/ssrf.ts +78 -0
  717. package/src/shared/token-crypto.ts +54 -0
  718. package/src/shared/ttl-cache.ts +27 -0
  719. package/src/shared/utcp-namespace.ts +88 -0
  720. package/src/version.ts +19 -0
@@ -0,0 +1,419 @@
1
+ # Company Knowledge graph
2
+
3
+ This is a git-backed knowledge graph. You are the primary agent responsible for maintaining it.
4
+
5
+ ## Directory Structure
6
+
7
+ The repo holds multiple **ontologies** side-by-side under two roots — `KnowledgeBase/` (curated knowledge) and `Data/` (agent-produced records). Each ontology owns its own NodeType definitions and its own knowledge nodes:
8
+
9
+ ```
10
+ knowledge-base/
11
+ ├── KnowledgeBase/ ← all team ontologies live here
12
+ │ ├── <Ontology>/ ← one ontology (e.g. "Processes", "Product")
13
+ │ │ ├── NodeTypes/ ← node type definitions (do not modify without permission)
14
+ │ │ ├── Knowledge/ ← all knowledge nodes for this ontology
15
+ │ │ └── access.md ← optional ontology-root access control
16
+ │ └── <AnotherOntology>/
17
+ │ ├── NodeTypes/
18
+ │ └── Knowledge/
19
+ ├── Skills/ ← optional reusable agent skills (not part of the graph)
20
+ ├── Tools/ ← optional tool manuals (*.tool files; not part of the graph)
21
+ ├── Data/ ← agent-produced records, parsed like KnowledgeBase/ (dashboards read here)
22
+ ├── Agents/ ← .agent files — agent role configurations (format TBD)
23
+ ├── Pipelines/ ← .pipeline files — processes the execution layer runs (format TBD)
24
+ ├── roles.yaml ← identity → role mapping (Admin-only edits)
25
+ └── access.md ← repo-root access-control rules
26
+ ```
27
+
28
+ Ontologies live as **direct subfolders of `KnowledgeBase/`** (curated knowledge) or of `Data/` (agent-produced records). Any folder there that contains BOTH a `NodeTypes/` subfolder and a `Knowledge/` subfolder is automatically picked up as an ontology by the Bevel platform's graph parser, validator, and access-control. `Data/` may also itself be a single ontology: when `Data/` directly contains both `NodeTypes/` and `Knowledge/`, the parser treats `Data/` itself as one ontology. Folders outside those two roots (such as `Skills/` and `Tools/`) are never treated as ontologies. To add a new ontology, create the two subfolders under `KnowledgeBase/` (or `Data/`).
29
+
30
+ ### Agentic execution layer base folders (`Data/`, `Agents/`, `Pipelines/`)
31
+
32
+ Three base folders scaffold the agentic execution layer (design notes: the Bevel platform repo's `docs/agentic-execution-layer.md`):
33
+
34
+ - **`Data/`** — what agents produce and consume, split out of the curated `Knowledge/` folders: pipeline instances, work items/tickets, intermediate outputs. Dashboards and the fleet view read from here. **Parsed exactly like `KnowledgeBase/`** — its subfolders are self-contained ontologies (`NodeTypes/` + `Knowledge/`), so data records are real typed graph nodes. Instance nodes carry current state; full transcripts/logs stay plain files (no `nodeType:` frontmatter) so they never enter the graph payload.
35
+ - **`Agents/`** — `.agent` files: role definitions naming a target agent (e.g. Claude Code) and composing its configuration — skills, tools, model, permissions, hooks, identity and budget references. An `.agent` only **narrows** its identity's permissions, never widens them; secrets are referenced from the vault, never contained. MCP configs are minted per `.agent`.
36
+ - **`Pipelines/`** — `.pipeline` files: the processes the execution layer runs. Nodes are an `.agent` reference, a UTCP tool call, or a wait node; plus transitions, failure policy, and triggers.
37
+
38
+ The platform's parser scans `Data/` exactly like `KnowledgeBase/`: its subfolders that carry both `NodeTypes/` and `Knowledge/` are self-contained ontologies whose typed nodes are part of the graph — and `Data/` itself qualifies as a single ontology when it directly contains both folders. `Data/` paths are, however, exempt from the one-ontology-per-session boundary — pipeline agents read knowledge and write data records in the same session. The `.agent`/`.pipeline` file formats are still being designed. `Agents/` and `Pipelines/` are, like `Skills/` and `Tools/`, never parsed as ontologies. Each folder's `README.md` documents its structure and contents.
39
+
40
+ **Cross-ontology references are allowed.** A node in `Processes/Knowledge/...` may link to a node in `Product/Knowledge/...` (or vice versa) using a normal file-relative markdown link, e.g. `[Foo](../../Product/Knowledge/.../Foo.md)`. The parser resolves the link to a repo-root path and the validator checks the target exists across all ontologies.
41
+
42
+ ### Creating a new ontology
43
+
44
+ To add a new ontology, create a folder under `KnowledgeBase/` (curated knowledge) or `Data/` (agent-produced records) with two subfolders — `NodeTypes/` and `Knowledge/` — and seed its `NodeTypes/NodeType.md`:
45
+
46
+ 1. **Give the new ontology its own `NodeTypes/NodeType.md`.** Every ontology is **self-contained** and must carry its own copy of the meta `NodeType.md` (the type that defines all other NodeTypes). Do **not** point a new ontology's NodeTypes at another ontology's `NodeType.md` — and do not read another ontology to obtain the content. Copy the **canonical meta type below, verbatim**, into `<NewOntology>/NodeTypes/NodeType.md`. It is identical in every ontology, so it is reproduced here in full so you never have to reach into another ontology for it.
47
+
48
+ 2. **Every NodeType definition file references the meta type as a sibling.** The meta `NodeType.md` itself and each concrete type you add (e.g. `NodeTypes/Meeting.md`) live **inside** the `NodeTypes/` folder, so they all declare:
49
+
50
+ ```
51
+ ---
52
+ nodeType: "[NodeType](NodeType.md)"
53
+ ---
54
+ ```
55
+
56
+ followed by the type's `# Name`, `# Description`, and one `# Field` header per field. Concrete NodeTypes differ from the meta type only in their fields — the `nodeType:` line is the same. Use the **sibling** path `NodeType.md` (the file is already in `NodeTypes/`), **not** `NodeTypes/NodeType.md` — from inside `NodeTypes/` that resolves to a non-existent `NodeTypes/NodeTypes/NodeType.md`.
57
+
58
+ #### Canonical meta `NodeType.md`
59
+
60
+ Copy the block below verbatim into every new ontology's `NodeTypes/NodeType.md` (the outer ````` ```` ````` fence is just the wrapper — copy the content between the fences):
61
+
62
+ ````markdown
63
+ ---
64
+ nodeType: "[NodeType](NodeType.md)"
65
+ ---
66
+
67
+ # Name
68
+ The name of this node type. Must be PascalCase and unique across all node types.
69
+
70
+ # Description
71
+ A brief explanation of what this node type represents and when to use it.
72
+
73
+ # Fields
74
+ Define each field as a header in the node type file. Any header level (`#`, `##`, `###`, `####`, `#####`, `######`) can be used to represent a field or nested sub-field. The header hierarchy defines the structure of nodes of this type.
75
+
76
+ Headers are equivalent to field names in a YAML object, and the paragraph text beneath each header is the field's 'text' field value. The header hierarchy defines nesting, just as indentation does in YAML.
77
+
78
+ Each header should be followed by a description of what that field should contain. When a node of this type is created, the description is replaced with actual content.
79
+
80
+ ## Field Parameters
81
+ A header may include parameters in parentheses at the end to describe its properties. Multiple parameters are comma-separated.
82
+
83
+ ### optional
84
+ Marks the field as optional. Nodes of this type may omit it without triggering a validation error.
85
+
86
+ Example: `# Notes (optional)`
87
+
88
+ ### link
89
+ Declares how markdown links found under this heading (and any of its sub-headings) are categorised on the parsed node. The syntax is `link <category>`, where `<category>` is a free-form name such as `outbound`, `inbound`, `child`, `parent`, or `value_slice`.
90
+
91
+ Example: `# Created Output (link outbound)` — all links under this heading are stored in the node's `links["outbound"]` list.
92
+
93
+ Parameters can be combined: `# Parent (optional, link parent)`.
94
+
95
+ Links found under headings without an explicit `link` parameter default to `outbound`.
96
+
97
+ ### folder-parent
98
+ Marks the field that determines this node's **placement** on disk — where its `.md` file is filed. One field per type drives placement (the first one tagged). It works in two modes, depending on whether the field it sits on is a link:
99
+
100
+ - **On a `link` field** → the node is filed as a **child of the linked node**, inheriting that parent's path (the child-node folder convention described in `CLAUDE.md`). Example: `# Home (link architecture, folder-parent)` — the node nests under the architecture node it links to.
101
+ - **On a plain-text field** (no `link`) → the node is filed in a **subfolder named after the field's value** (its first line), appended onto the ontology's base path. Example — a nested sub-field: `## Class (folder-parent)` where a node sets `Class: product` files that node under a `product/` folder.
102
+
103
+ This is what bulk node uploads use to place each node; when a type has no `folder-parent` field, the node is placed at the explicitly supplied path instead.
104
+
105
+ # Format Rules
106
+ Every node file that uses this type must:
107
+ - Start with a YAML frontmatter block declaring the node type, fenced by `---` lines, where the value is a quoted markdown link:
108
+ ```
109
+ ---
110
+ nodeType: "[TypeName](NodeTypes/TypeName.md)"
111
+ ---
112
+ ```
113
+ The value is quoted so the markdown link remains a valid YAML string.
114
+ - Use headers at any level to match the field structure defined in the node type
115
+ - Use `[Name](relative/path/to/Name.md)` markdown links when referencing other nodes in the knowledge graph
116
+
117
+ ## Source of Information
118
+ Any heading in a node may additionally carry a **Source of Information** block — provenance recording *which sources* validate the heading's content, *what* each validates, and *when*. It is a collapsible `<details>` element whose `<summary>` reads "Source of Information", placed under the heading's content. It is metadata, **not a field**: never declare it as a `#` header, and never list it among a node type's fields.
119
+
120
+ The body is an **ordered list**; each item is `SOURCE — what it validates (YYYY-MM-DD)` — a source (a person `Name <email>`, a data artifact, a document, or a URL), what that source validates, and the validation date. At least one item is required; list several when different sources back different parts of the heading. The parser strips the block from the heading's text and links (so a URL or person reference never becomes a graph edge); the Bevel platform's validator checks each item is well-formed and computes tier ranking downstream. Example:
121
+
122
+ ```
123
+ <details><summary>Source of Information</summary>
124
+
125
+ 1. some-export.csv — ID, Name and Definition (2026-06-05)
126
+ 2. Jane Doe <jane.doe@example.com> — the Definition wording (2026-06-03)
127
+
128
+ </details>
129
+ ```
130
+ ````
131
+
132
+ ## Access control
133
+
134
+ Write access to any path is governed by `roles.yaml` (who has which role) and `access.md` files (which roles/users can write where). The access-control resolver + validation live in the Bevel platform, which checks both files for syntax, role references, and the rule that at least one Admin must exist when access is resolved.
135
+
136
+ - **Roles** in `roles.yaml` map a role name to a list of emails. Role names are case- and whitespace-insensitive (`Admin` = `admin` = `ADMIN`; `Product Team` = `product team`). The reserved name `deny` cannot be used.
137
+ - **Access rules** live in `access.md` files. Each declares a `write:` list whose entries are either grants (bare principal — a role name or `Name <email>`) or denials (lowercase `deny ` prefix + principal). Capitalised forms like `Deny` are *not* triggers; they're treated as part of a name.
138
+ - **Resolution** walks repo root → file directory, accumulating per-principal state. User-level entries trump role-level entries. A role denial removes only that role's contribution; it does not undo grants from other roles.
139
+ - **`roles.yaml` is editable only by Admin** — hard-coded in the resolver, never overridable by an `access.md`.
140
+ - **`access.md` files are picked up everywhere inside an ontology** (repo root, ontology root such as `Processes/access.md`, and any depth inside `<ontology>/Knowledge/...`).
141
+
142
+ Access rules are enforced at runtime by the Bevel platform's access-control service; a malformed `roles.yaml` or `access.md` surfaces there when access is resolved.
143
+
144
+ ### Direct writes vs change requests
145
+
146
+ File-level write access decides how a change lands on the default branch:
147
+
148
+ - A user — or an agent acting as that user — whose access resolution grants **write or owner on every file the change touches** may commit **directly** to the default branch.
149
+ - Without that access, the change goes through a **branch + change request**, approved by an owner / write-access holder of the affected files.
150
+ - Agents carry exactly their user's access, never more. Before writing to the default branch, **ask the user** whether to write directly or go through the review flow — and prefer a change request when in doubt, when the change is large, or when it touches content the user doesn't own.
151
+
152
+ ### Child node folder convention
153
+
154
+ When a node has child nodes (any field with `link child` type) that each warrant their own node file, group them in a subfolder named identically to the parent node (without the `.md` extension). The parent node file sits **next to** its subfolder, not inside it.
155
+
156
+ Example: a node `Knowledge/Foo.md` with two children lives like this:
157
+
158
+ ```
159
+ Knowledge/
160
+ ├── Foo.md ← parent node
161
+ └── Foo/
162
+ ├── Bar.md ← child of Foo
163
+ └── Baz.md ← child of Foo
164
+ ```
165
+
166
+ If any of those children themselves have children, create another identically-named subfolder one level deeper:
167
+
168
+ ```
169
+ Knowledge/
170
+ ├── Foo.md
171
+ └── Foo/
172
+ ├── Bar.md
173
+ ├── Bar/
174
+ │ └── Sub-Bar.md
175
+ └── Baz.md
176
+ ```
177
+
178
+ All links in node files use **file-relative paths**, e.g. a file at `Knowledge/Foo.md` links to its child as `[Bar](Foo/Bar.md)`. Cross-ontology links walk up to the repo root and back down into the other ontology, e.g. from `Processes/Knowledge/Process Groups/Group/Foo.md` to `Product/Knowledge/Bar.md` use `[Bar](../../../../Product/Knowledge/Bar.md)`.
179
+
180
+ ## Tool Manuals (`Tools/`)
181
+
182
+ `Tools/` holds `*.tool` files — reusable **tool manuals** that let agents call external APIs. They are **not part of the knowledge graph** (never modelled as nodes) and are access-controlled like any other file via `access.md`. Any user who can *read* a `.tool` can use its tools; anyone who can *write* it sets its shared (admin) secrets (see below). Put each manual directly under `Tools/` (subfolders are allowed for grouping).
183
+
184
+ A `.tool` file is JSON or YAML. Its `type` decides how tools are discovered:
185
+
186
+ - **`inline`** — the tools are embedded in the file (no network round-trip to list them).
187
+ - **`http`** — `url` points to an endpoint that returns a UTCP manual.
188
+ - **`mcp`** — `url` is a remote MCP server whose tools are discovered over MCP.
189
+
190
+ **The tool is the frontmatter.** A `.tool` is one `---` YAML block holding *everything* — its `id`, its access verbs (`read:`/`write:`/`owner:`/`download:`), and its config (`type`/`url`/`variables`/…) — all in the same object. Anything after the closing `---` is free-form notes the parser ignores (like a `SKILL.md` body):
191
+
192
+ ```yaml
193
+ ---
194
+ id: my_tool
195
+ write:
196
+ - Product Team
197
+ owner:
198
+ - Jane Doe <jane@x.com>
199
+ type: mcp
200
+ url: https://mcp.example.com
201
+ ---
202
+ ```
203
+
204
+ (A file with no `---` fence is the legacy form — the whole file is the object, so a bare JSON `.tool` still works.)
205
+
206
+ **`id` = variable namespace.** The `id` is the manual's stable identity: it's the UTCP namespace secrets bind to (`<id>_<VAR>`) and its route slug. It must be lowercase `snake_case` and **unique** across all `.tool` files. Resolution is `id` → `name` → the file name (so a `name:` alone works, same as the id system uses for every file). If two files collide, the one saved most recently through the app is auto-suffixed (`my_tool` → `my_tool2`). **Access** declared here gates who can use and edit that tool, exactly like a node's own frontmatter (most specific; overrides the folder `access.md`).
207
+
208
+ **Frontmatter `id` = address.** This is generic, not tool-specific: ANY `.md` or `.tool` file whose frontmatter declares an `id` (or a lowercase snake_case/kebab `name`) is addressable at `/workspace/<branch>/<id>` in the app, exactly like a knowledge node — tools, skills (`SKILL.md`), and plain notes alike. Graph nodes win an id collision; files without frontmatter stay path-addressed.
209
+
210
+ **Remote vs local (`remote`).** A tool is available to remote agents by default. Add `remote: false` for a tool that only works on the user's own machine (e.g. an mcp/http `url` on `localhost`): the hosted remote MCP endpoint then skips it and instead advertises it through the `list_local_tools` tool, which returns the `.tool`'s path so a local agent can read it and self-configure (e.g. add the MCP server to its own client).
211
+
212
+ ### Referencing secrets — `${VAR}` and the `variables` block
213
+
214
+ Anywhere a `.tool` needs a credential (an API key, a token) write a placeholder like `${API_KEY}`. At call time it is filled from the **Secrets Vault** under the key `<id>_<VAR>`, where `<id>` is the manual's resolved id (the same `id` → `name` → file-name resolution described above) — so a manual whose id is `weather` referencing `${API_KEY}` reads the secret `weather_API_KEY`. A secret is therefore bound to exactly one manual; another manual cannot read it.
215
+
216
+ Declare who provisions each variable with an optional top-level `variables` array. Each entry is `{ name, scope, label? }`:
217
+
218
+ - **`scope: admin`** (the **default**) — set **once by a writer** of this `.tool` file; the same value is shared by everyone who uses the tool. Prefer this: keep as much as possible owned by the tool author.
219
+ - **`scope: user`** — set by **each end user** for themselves (their own value, never shared).
220
+
221
+ `name` must match `[A-Za-z0-9_]+`. A referenced `${VAR}` that you don't declare defaults to `admin` — and it still SURFACES automatically: the app detects every `${VAR}` the file actually references and shows it in the secrets UI, so the `variables` block is only needed to change a variable's scope to `user`, give it a label, or declare an OAuth sign-in. Values are entered in the Secrets Vault UI (or the `.tool` editor's sidebar), never in the file itself. A malformed `variables` entry makes the whole file fail to load, so it is never silently mis-scoped.
222
+
223
+ ### Examples
224
+
225
+ An `http` manual that authenticates with a shared org key and a per-user key:
226
+
227
+ ```yaml
228
+ name: weather
229
+ type: http
230
+ url: https://api.weather.example/utcp
231
+ headers:
232
+ Authorization: Bearer ${ORG_KEY}
233
+ X-User-Key: ${USER_KEY}
234
+ variables:
235
+ - { name: ORG_KEY, scope: admin, label: "Org-wide weather.com key" }
236
+ - { name: USER_KEY, scope: user, label: "Your personal weather.com key" }
237
+ ```
238
+
239
+ An `inline` manual with one tool:
240
+
241
+ ```json
242
+ {
243
+ "name": "billing",
244
+ "type": "inline",
245
+ "variables": [{ "name": "BILLING_KEY", "scope": "admin" }],
246
+ "tools": [
247
+ {
248
+ "name": "create_invoice",
249
+ "description": "Create an invoice.",
250
+ "inputs": { "type": "object", "properties": {} },
251
+ "outputs": { "type": "object", "properties": {} },
252
+ "tool_call_template": {
253
+ "call_template_type": "http",
254
+ "http_method": "POST",
255
+ "url": "https://api.billing.example/invoices",
256
+ "headers": { "Authorization": "Bearer ${BILLING_KEY}" }
257
+ }
258
+ }
259
+ ]
260
+ }
261
+ ```
262
+
263
+ ### Adding a third-party tool
264
+
265
+ When asked to add/integrate a product as a tool (e.g. "add Notion", "wire up Linear"), **never invent an endpoint or write a placeholder URL** — a `.tool` pointing at a made-up host is useless:
266
+
267
+ 1. **Find the real endpoint from the vendor's own docs.** Prefer the vendor's official **remote MCP server** if one exists (e.g. Notion's is `https://mcp.notion.com/mcp`); otherwise fall back to their **REST API** base. Use web search/extract to confirm the exact URL, transport, and auth scheme — don't answer from memory. If you have no web access or genuinely can't find it, **ask the user** for the endpoint URL and auth instead of guessing.
268
+ 2. **Pick the type from what you found.** An MCP server → `type: mcp` with the official `url` (the MCP transport is HTTP/streamable — use the `https://…` URL, **never** `ws://`/`wss://`). A plain REST/HTTP endpoint → `type: http`. Use `type: inline` only when hand-authoring the individual HTTP calls.
269
+ 3. **An OAuth-protected MCP server needs NOTHING beyond `type: mcp` + `url`.** The app probes the server, discovers its sign-in provider (MCP authorization spec), registers itself automatically, and surfaces a per-user sign-in on the Connect page — do NOT declare `variables` or `headers` for it. Only add them for servers that use plain API keys or don't follow the spec.
270
+ 4. **For key-based auth, wire it as `variables`, never a hard-coded secret.** Reference credentials as `${VAR}` in `headers` (e.g. `Authorization: Bearer ${NOTION_TOKEN}`) and declare each in the `variables` block with a scope (`admin` = one shared value; `user` = per-user). Users fill the values in the Secrets Vault.
271
+ 5. **Set `remote: false`** only when the tool is reachable ONLY from the user's own machine (e.g. a `localhost` MCP server); otherwise leave it remote-capable.
272
+
273
+ ### Checking what an admin still needs to configure
274
+
275
+ Call the **`list_tool_setup`** tool to see, for every accessible `.tool`, what is configured and what is still missing. Use it whenever a tool isn't working, after adding a tool, or when asked "what do I need to set up?" — then EXPLAIN the remaining steps to the user rather than guessing. Per tool it reports:
276
+
277
+ - **`setup.kind`** (for `type: mcp`): `open` = no credentials needed; `oauth-auto` = the platform registered itself with the server automatically and users just authorize on the **Connect page**; `oauth-manual` = the provider does not support automatic registration, so a tool writer must configure it by hand (below).
278
+ - **Per variable**: `adminConfigured` (the shared value — or, for a sign-in, the owner-side provider setup — is done), `userConfigured` / `authorized` (the CURRENT user's own value / sign-in), and `canWrite` (whether the current user may set the tool's shared config).
279
+
280
+ The listing is scoped by the same access controls as everything else: a `.tool` the caller can't READ doesn't appear at all, and `canWrite` means write access **on that `.tool` file itself** — granted by its frontmatter `write:`/`owner:` verbs or the `access.md` chain, NOT by any platform role. The people who manage a `.tool` file are exactly the people who configure its shared secrets. To delegate a tool to someone, add them to the file's `write:` or `owner:` list (an edit you can make via change request); that alone lets them configure it.
281
+
282
+ **Agents never handle secret VALUES.** Never ask for an API key, token, or client secret in the conversation, and there is no tool to set one. Point the right person at the right surface instead:
283
+
284
+ - **Shared (admin) values and OAuth client secrets** → a tool writer pastes them into the fields on the tool's page in the app (open the `.tool` file; the setup panel is in its sidebar).
285
+ - **Per-user values and sign-ins** → each user enters/authorizes on the **Connect page**.
286
+
287
+ For **`oauth-manual`** (e.g. Google, GitHub, Slack — no dynamic client registration), walk the admin through the one-time setup:
288
+
289
+ 1. Register an OAuth app in the provider's console, with redirect URI `<backend>/api/secrets/oauth/callback`.
290
+ 2. Put the app's **client id** (public) in the `.tool` file's sign-in variable — you can do this edit for them via a change request.
291
+ 3. The admin pastes the app's **client secret** into the "Client secret" field on the tool's page — never into the file, never into the chat.
292
+ 4. Every user then authorizes on the Connect page.
293
+
294
+ ## Node Format
295
+
296
+ Read the meta type: `<ontology>/NodeTypes/NodeType.md` (every ontology has its own copy — they're identical in form).
297
+
298
+ A markdown file is treated as a **knowledge node** only when it opens with a YAML frontmatter block (fenced by `---`) that declares a `nodeType:`. Files without that frontmatter (free-form notes, scratch docs, READMEs, etc.) are ignored by the parser — they are not validated, not added to the graph, and not surfaced in the diagram. Use this when you want a markdown file in `Knowledge/` that isn't itself a typed node.
299
+
300
+ The frontmatter looks like this (the value is a quoted markdown link so it stays a valid YAML string):
301
+
302
+ ```
303
+ ---
304
+ nodeType: "[Process](../../NodeTypes/Process.md)"
305
+ ---
306
+ ```
307
+
308
+ A node's `nodeType:` link points to a NodeType definition file. The link target is the source of truth: a node in `Processes/Knowledge/Process Groups/Foo.md` with `nodeType: "[Process](../../NodeTypes/Process.md)"` is bound to the `Process` type defined in `Processes/NodeTypes/Process.md`. Two ontologies may both define a type called `Process` without colliding — each ontology's nodes resolve to that ontology's definition.
309
+
310
+ ### Source of Information (per-heading `<details>` blocks)
311
+
312
+ The provenance of a heading — *which sources* validate its content, *what* each validates, and *when* — is tracked **per heading** in a collapsible HTML `<details>` block whose `<summary>` reads "Source of Information", placed under the heading's content.
313
+
314
+ The body is an **ordered list**. Each item names a source, what that source validates, and the validation date in parentheses:
315
+
316
+ ```markdown
317
+ # Goal
318
+ To manage the buyer's shopping cart lifecycle…
319
+
320
+ <details><summary>Source of Information</summary>
321
+
322
+ 1. Jane Doe <jane.doe@example.com> — the goal and end-to-end flow (2026-06-03)
323
+ 2. PROC-1234 — Basket optimisation & awarding rework — the awarding step (2026-05-12)
324
+
325
+ </details>
326
+ ```
327
+
328
+ Each item is `SOURCE — what it validates (YYYY-MM-DD)`:
329
+ - **SOURCE** — free text identifying the source: a person (`Name <email>`), a data artifact (e.g. `some-export.csv` or a ticket key), a document, or a URL.
330
+ - **what it validates** — which part of the heading's content that source backs.
331
+ - **(YYYY-MM-DD)** — the date that source last validated it.
332
+
333
+ The separator is an em dash `—` (a plain hyphen `-` is also accepted). At least one item is required; list several items when different sources back different parts of the heading.
334
+
335
+ **Binding data sources.** A non-human source that is *ground truth* because it is backed by a binding artifact — a signed contract, code on the deployed main branch, an executed order — is marked by making **`Binding` the first word of the SOURCE**, followed by the URL/reference:
336
+
337
+ ```markdown
338
+ 1. Binding https://github.com/acme/app/commit/abc123 — the deployed payment flow (2026-06-01)
339
+ 2. Binding [Signed MSA](https://drive.example/msa.pdf) — the contracted SLA (2026-05-20)
340
+ ```
341
+
342
+ A binding source is graded higher than a plain external data source (it isn't flagged for revalidation on its own), but lower than a human with write access. The marker is the literal word `Binding` (case-insensitive) at the start; without it, the same URL is treated as an ordinary data source.
343
+
344
+ The block is parsed onto the heading's `field.sourceOfInformation` (an array of `{ source, validates, date, tier }`, where `tier` is the source's validation tier — `binding-data` / `data-source` graded from the text, refined to `owner` / `writer` / `none` for human sources when the graph is built with access resolution) and **stripped** from the field's text and graph links, so a URL or person reference never becomes an edge. It is exposed via `toDict()` for downstream consumers.
345
+
346
+ This repo is **data only** — parsing, format-checking, and tier ranking all happen in the **Bevel platform**. The backend validator (the `validate_graph` tool) **errors** on a malformed item: a line that isn't `SOURCE — what it validates (YYYY-MM-DD)`, a missing source or missing "what it validates", or an invalid date. A heading with **no** block is fine.
347
+
348
+ When you create or substantially change a heading's content, add or refresh its `Source of Information` block.
349
+
350
+ ## Critical Rules
351
+
352
+ 1. **Before creating any typed node, read the NodeType first.** Check `<ontology>/NodeTypes/<Type>.md` for the exact field names and structure. Never invent fields. (Plain markdown files without a `nodeType:` frontmatter declaration don't need this — they aren't nodes.)
353
+
354
+ 2. **File naming:** Use descriptive names in `PascalCase-With-Hyphens`. No spaces. Examples:
355
+ - `Knowledge/Weekly-Sync-2026-03-14.md`
356
+ - `Knowledge/Jane-Doe.md`
357
+ - `Knowledge/Our-Company.md`
358
+
359
+ 3. **Markdown links everywhere.** Use `[PageName](relative/path/to/PageName.md)` whenever referencing another node. Paths are **relative to the linking file's directory** (not the repo root). This ensures links work correctly on GitHub. This is what builds the knowledge graph.
360
+
361
+ 4. **Dates:** Always `YYYY-MM-DD`. Never relative dates in saved files.
362
+
363
+ 5. **No duplicates.** Search before creating. If a node exists, update it.
364
+
365
+ 6. **Preserve existing content.** Append or edit sections — never overwrite a file wholesale unless explicitly asked.
366
+
367
+ 7. **Folder structure follows hierarchy, not node type.** Use the subprocess folder convention (described above) when grouping subprocesses under a parent. Never create subfolders for arbitrary organisational purposes — only to mirror a process hierarchy. Node types are always determined by reading `nodeType:` at the top of each file, not by folder location.
368
+
369
+ ## Graph Integrity
370
+
371
+ The knowledge graph's value comes from bidirectional links between processes. Every data flow must be declared on **both sides**:
372
+
373
+ 1. **Outputs must link to consumers.** Under `# Created Output`, each `## Output Name` section must contain a markdown link to every process that consumes this output.
374
+
375
+ 2. **Inputs must link to producers.** Under `# Needed Input`, each `## Input Name` section must contain a markdown link to the process that provides this input.
376
+
377
+ 3. **Output and input headings must match.** When process A produces "Foo" consumed by process B, the `## Foo` heading should appear under A's `# Created Output` (linking to B) **and** under B's `# Needed Input` (linking to A). The heading text should be the same on both sides.
378
+
379
+ 4. **When adding or modifying a link, always update both sides.** If you add an output link from A→B, also add or update the corresponding input section in B. If you rename an output, update the matching input heading in all consumers.
380
+
381
+ 5. **When moving or renaming a file, update all references.** Search for the old path across every ontology's `Knowledge/` directory and update every link.
382
+
383
+ ## After Every Change
384
+
385
+ Graph parsing, validation, and visualisation live in the **Bevel platform**, not in
386
+ this repo. This repo is **data** — node `.md` files. There are no local build or
387
+ validation scripts to run here.
388
+
389
+ Validation runs automatically inside the app: every save/commit is validated
390
+ in-process, and an agent can validate a branch on demand via the `validate_graph`
391
+ tool. It reports the same integrity issues you must fix:
392
+
393
+ | Issue | Must fix? | Meaning | Fix |
394
+ |---|---|---|---|
395
+ | `DANGLING LINK` | **Yes** | An id-link points to an id no node has | Fix the id or create the missing node |
396
+ | `ASYMMETRY` | **Yes** | One side of a data flow links to the other, but not vice versa | Add the missing link on the other side |
397
+ | missing / duplicate / malformed `id` | **Yes** | Every node needs a unique lowercase-kebab frontmatter `id:` | Add/fix the `id:` |
398
+ | malformed Source of Information | **Yes** | A `<details>` block item isn't `SOURCE — what it validates (YYYY-MM-DD)` | Fix the item |
399
+
400
+ The process diagram is produced as a dynamically-generated HTML view from the
401
+ backend graph — there is no committed `diagram.md` to regenerate.
402
+
403
+ ## How to Query
404
+
405
+ - Find nodes by type across all ontologies: `Grep` for `nodeType:.*TypeName` recursively
406
+ - Find by content: `Grep` across each ontology's `Knowledge/` for keywords
407
+ - Follow links: when you see `[SomePage](relative/path/SomePage.md)`, read that file (paths are file-relative; cross-ontology references walk via `../` to the repo root)
408
+
409
+ ## Handling Unknown Types
410
+
411
+ If information doesn't fit any existing NodeType, ask the user whether to:
412
+ - Create a new NodeType (you can do this by creating a new file in the relevant `<ontology>/NodeTypes/` folder, following the meta `NodeType.md` format)
413
+ - Fit it into the closest existing type with a note
414
+
415
+ ## NodeType definitions are auto-discovered
416
+
417
+ The Bevel platform's graph parser derives each NodeType's shape **at runtime** from its definition in any `<ontology>/NodeTypes/*.md` file — every `# Field` header becomes part of the node's schema (link fields, sub-header child maps, plain text).
418
+
419
+ **There is nothing to hand-maintain when you add/remove/rename NodeType fields.** Just edit the `<ontology>/NodeTypes/<Type>.md` file; the parser picks up the new shape on the next run. If you add a new NodeType file, add it under the right ontology's `NodeTypes/` folder.
File without changes
@@ -0,0 +1,39 @@
1
+ # Data/
2
+
3
+ What agents **produce and consume** — split out of the curated
4
+ `KnowledgeBase/` so machine-generated records never entangle with curated
5
+ knowledge. Dashboards and the fleet view read from here.
6
+
7
+ ## Structure
8
+
9
+ Parsed **exactly like `KnowledgeBase/`**: direct subfolders are ontologies,
10
+ each self-contained with its own `NodeTypes/` and `Knowledge/`. (A repo may
11
+ also use `Data/` itself as one single ontology by giving it `NodeTypes/` +
12
+ `Knowledge/` directly.)
13
+
14
+ ```text
15
+ Data/
16
+ ├── <Domain>/ ← mirrors the team/domain split, e.g. "Engineering"
17
+ │ ├── NodeTypes/ ← types for data records (work items, instances, …)
18
+ │ └── Knowledge/ ← the data nodes themselves
19
+ └── <AnotherDomain>/
20
+ ```
21
+
22
+ ## What goes here
23
+
24
+ - **Work items / tickets**: typed nodes an agent or pipeline picks up and
25
+ drives (status, assignee, acceptance criteria).
26
+ - **Pipeline instances**: one node per run — current step, STATE, attempts,
27
+ verdicts, links to its artifacts. Updated in place per transition; the
28
+ node carries *current state*, git history carries *history*.
29
+ - **Intermediate outputs** that dashboards need.
30
+ - **Transcripts, probes, logs**: **plain files** (no `nodeType:` frontmatter)
31
+ filed as children of their instance (`<Instance>/transcripts/…`,
32
+ `<Instance>/probes/…`). Git-versioned and viewable in the app, but never
33
+ part of the graph payload — long histories stay out of dashboards' way.
34
+
35
+ Rules of thumb: executor/runner processes write here (their access is
36
+ typically scoped to Data paths); humans intervene by editing nodes, and those
37
+ edits are treated as authoritative input. Machine-owned fields (e.g. a
38
+ runner's STATE) are owned exclusively by their writer — human input goes in
39
+ the record's designated notes field instead.
File without changes
@@ -0,0 +1,37 @@
1
+ # KnowledgeBase/
2
+
3
+ Curated knowledge, organized as **ontologies** — one per team or domain.
4
+
5
+ ## Structure
6
+
7
+ ```text
8
+ KnowledgeBase/
9
+ ├── <Ontology>/ ← e.g. "Product", "Engineering"
10
+ │ ├── NodeTypes/ ← node type definitions for this ontology
11
+ │ │ └── NodeType.md ← the meta type (every ontology carries its own copy)
12
+ │ ├── Knowledge/ ← the knowledge nodes
13
+ │ └── access.md ← optional ontology-root access rules
14
+ └── <AnotherOntology>/
15
+ ```
16
+
17
+ Any direct subfolder containing BOTH `NodeTypes/` and `Knowledge/` is picked up
18
+ as an ontology by the platform's parser, validator, and access control.
19
+ Ontologies are **self-contained**: each carries its own `NodeTypes/NodeType.md`
20
+ and its own concrete types.
21
+
22
+ ## What goes here
23
+
24
+ - **Typed knowledge nodes** in `Knowledge/`: markdown files opening with a
25
+ frontmatter block declaring `nodeType:` (a quoted markdown link to the type)
26
+ and a unique lowercase-kebab `id:`. Fields are headers matching the type
27
+ definition; references to other nodes are file-relative markdown links.
28
+ - **Node type definitions** in `NodeTypes/`: one file per type, following the
29
+ meta `NodeType.md` format.
30
+ - Markdown files *without* a `nodeType:` frontmatter are ignored by the parser
31
+ (notes, scratch docs) — allowed, but invisible to the graph.
32
+
33
+ Conventions (naming, child-node folders, Source of Information blocks,
34
+ cross-ontology links) are documented in the repo-root `CLAUDE.md`.
35
+
36
+ **Not for agent output**: records produced by agents and pipelines (work
37
+ items, instances, transcripts) belong in the `Data/` base folder, not here.
File without changes
@@ -0,0 +1,38 @@
1
+ # Pipelines/
2
+
3
+ `.pipeline` files — the **processes the agentic execution layer runs**, in the
4
+ spirit of a CI workflow file: declarative definitions the executor interprets.
5
+ The executor itself encodes no process behavior; everything a run does is
6
+ defined here.
7
+
8
+ ## Structure
9
+
10
+ ```text
11
+ Pipelines/
12
+ └── <process-name>.pipeline ← one file per process
13
+ ```
14
+
15
+ (Exact file format: TBD.)
16
+
17
+ ## What a `.pipeline` defines
18
+
19
+ A sequence of **nodes**, each one of:
20
+
21
+ - an **`.agent` reference** — an agent session executes the step;
22
+ - a **UTCP tool call** — a tool from `Tools/` (or defined in-file), invoked
23
+ deterministically with no LLM;
24
+ - a **wait node** — parks the run until a condition holds; checked cheaply
25
+ every tick, never by an agent polling.
26
+
27
+ Plus, per pipeline:
28
+
29
+ - **Transitions** — where each outcome routes;
30
+ - **Failure policy** — attempt caps and loop-back targets;
31
+ - **Triggers** — what starts a run: cron, a `Data/` node reaching a status,
32
+ a webhook, or a human assigning a work item;
33
+ - Human approvals ride **change requests** — "park until approved" is a
34
+ native gate.
35
+
36
+ Pipelines may call other pipelines. Every triggered run gets a durable
37
+ **instance node under `Data/`** carrying its state, so executors stay
38
+ stateless and any step can be retried.
File without changes
@@ -0,0 +1,32 @@
1
+ # Skills/
2
+
3
+ Reusable **agent skills** — packaged instructions an agent loads when doing a
4
+ specific kind of work. Not part of the knowledge graph; access-controlled like
5
+ any other files.
6
+
7
+ ## Structure
8
+
9
+ ```text
10
+ Skills/
11
+ ├── <skill-name>/
12
+ │ ├── SKILL.md ← the skill: frontmatter (name, description) + instructions
13
+ │ └── <bundled files> ← optional templates, scripts, checklists the skill uses
14
+ └── <grouping>/ ← subfolders for organizing are allowed
15
+ └── <skill-name>/
16
+ └── SKILL.md
17
+ ```
18
+
19
+ Skills are discovered **by name** regardless of nesting (`list_skills` /
20
+ `get_skill`); bundled files are fetched with `get_skill`'s `file:` parameter.
21
+
22
+ ## What goes here
23
+
24
+ - One folder per skill, holding a `SKILL.md` whose frontmatter declares
25
+ `name:` (unique) and `description:` (when to use it). Quote the description
26
+ if it contains a colon followed by a space — unquoted, that sequence breaks
27
+ YAML parsing.
28
+ - Bundled assets next to the `SKILL.md`: HTML templates, checker scripts,
29
+ reference files. Keep them small and self-contained.
30
+
31
+ Write skills as instructions to the executing agent: what to load, what to do,
32
+ what to record, and the exact output contract expected of the run.
File without changes
@@ -0,0 +1,42 @@
1
+ # Tools/
2
+
3
+ **Tool manuals** — `.tool` files that let agents call external APIs through
4
+ the platform's UTCP registry. Not part of the knowledge graph;
5
+ access-controlled like any other files. Subfolders for grouping are allowed.
6
+
7
+ ## Structure
8
+
9
+ ```text
10
+ Tools/
11
+ ├── <tool_name>.tool ← one manual per tool/integration
12
+ └── <grouping>/
13
+ └── <other_tool>.tool
14
+ ```
15
+
16
+ ## What goes here
17
+
18
+ A `.tool` file is one YAML frontmatter block holding everything — identity,
19
+ access, and config:
20
+
21
+ ```yaml
22
+ ---
23
+ id: my_tool # lowercase snake_case, unique — the secret namespace
24
+ write:
25
+ - Product Team # who can edit the tool and set its shared secrets
26
+ type: mcp # inline | http | mcp
27
+ url: https://mcp.example.com
28
+ ---
29
+ ```
30
+
31
+ - `type: inline` embeds the tool definitions in the file; `http` points at a
32
+ UTCP manual endpoint; `mcp` points at a remote MCP server.
33
+ - **Never put secret values in the file.** Reference credentials as `${VAR}`;
34
+ values live in the Secrets Vault under `<id>_<VAR>`. Declare per-user vs
35
+ shared scope in a `variables:` block (`scope: admin` is the default).
36
+ - OAuth-protected MCP servers need nothing beyond `type: mcp` + `url` — the
37
+ platform discovers the sign-in automatically.
38
+ - Add `remote: false` only for tools reachable solely from a user's own
39
+ machine (e.g. a `localhost` MCP server).
40
+
41
+ Full syntax, secret scoping, and setup flows: repo-root `CLAUDE.md`
42
+ § "Tool Manuals".