@bevel-software/platform-core-backend 0.11.1 → 0.12.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 (443) hide show
  1. package/THIRD-PARTY-NOTICES.md +1163 -425
  2. package/dist/core/create-core-server.js +1 -1
  3. package/dist/core/create-core-server.js.map +1 -1
  4. package/dist/core/create-core-services.d.ts +3 -1
  5. package/dist/core/create-core-services.d.ts.map +1 -1
  6. package/dist/core/create-core-services.js +7 -2
  7. package/dist/core/create-core-services.js.map +1 -1
  8. package/dist/core-config.d.ts +7 -0
  9. package/dist/core-config.d.ts.map +1 -1
  10. package/dist/core-config.js +9 -0
  11. package/dist/core-config.js.map +1 -1
  12. package/dist/modules/access/access-control.service.d.ts +1 -253
  13. package/dist/modules/access/access-control.service.d.ts.map +1 -1
  14. package/dist/modules/access/access-control.service.js +3 -632
  15. package/dist/modules/access/access-control.service.js.map +1 -1
  16. package/dist/modules/access/access-declarations.d.ts +2 -2
  17. package/dist/modules/access/access-declarations.d.ts.map +1 -1
  18. package/dist/modules/access/access-declarations.js +2 -2
  19. package/dist/modules/access/access-declarations.js.map +1 -1
  20. package/dist/modules/access/access-mutation.service.d.ts +3 -3
  21. package/dist/modules/access/access-mutation.service.d.ts.map +1 -1
  22. package/dist/modules/access/access-mutation.service.js +3 -3
  23. package/dist/modules/access/access-mutation.service.js.map +1 -1
  24. package/dist/modules/access/access.routes.js +4 -4
  25. package/dist/modules/access/access.routes.js.map +1 -1
  26. package/dist/modules/access/admin-locked-commit.d.ts +2 -2
  27. package/dist/modules/access/admin-locked-commit.d.ts.map +1 -1
  28. package/dist/modules/access/admin-locked-commit.js +2 -2
  29. package/dist/modules/access/admin-locked-commit.js.map +1 -1
  30. package/dist/modules/access/admin-route-helpers.js +1 -1
  31. package/dist/modules/access/admin-route-helpers.js.map +1 -1
  32. package/dist/modules/access/capability-registry.js +1 -1
  33. package/dist/modules/access/capability-registry.js.map +1 -1
  34. package/dist/modules/access/creator-access.d.ts +1 -45
  35. package/dist/modules/access/creator-access.d.ts.map +1 -1
  36. package/dist/modules/access/creator-access.js +4 -24
  37. package/dist/modules/access/creator-access.js.map +1 -1
  38. package/dist/modules/access/groups-admin.routes.js +1 -1
  39. package/dist/modules/access/groups-admin.routes.js.map +1 -1
  40. package/dist/modules/access/groups-admin.service.d.ts +1 -1
  41. package/dist/modules/access/groups-admin.service.d.ts.map +1 -1
  42. package/dist/modules/access/groups-admin.service.js +6 -5
  43. package/dist/modules/access/groups-admin.service.js.map +1 -1
  44. package/dist/modules/access/groups-edit.js +2 -2
  45. package/dist/modules/access/groups-edit.js.map +1 -1
  46. package/dist/modules/access/reference-scan.js +1 -1
  47. package/dist/modules/access/reference-scan.js.map +1 -1
  48. package/dist/modules/access/roles-admin.service.d.ts +1 -1
  49. package/dist/modules/access/roles-admin.service.d.ts.map +1 -1
  50. package/dist/modules/access/roles-admin.service.js +8 -7
  51. package/dist/modules/access/roles-admin.service.js.map +1 -1
  52. package/dist/modules/access/roles-edit.js +1 -1
  53. package/dist/modules/access/roles-edit.js.map +1 -1
  54. package/dist/modules/access/synced-groups-committer.js +4 -4
  55. package/dist/modules/access/synced-groups-committer.js.map +1 -1
  56. package/dist/modules/access/synced-groups-writer.js +2 -2
  57. package/dist/modules/access/synced-groups-writer.js.map +1 -1
  58. package/dist/modules/access-model/access-errors.d.ts +34 -0
  59. package/dist/modules/access-model/access-errors.d.ts.map +1 -0
  60. package/dist/modules/access-model/access-errors.js +40 -0
  61. package/dist/modules/access-model/access-errors.js.map +1 -0
  62. package/dist/modules/access-model/access-grammar.d.ts +266 -0
  63. package/dist/modules/access-model/access-grammar.d.ts.map +1 -0
  64. package/dist/modules/access-model/access-grammar.js +644 -0
  65. package/dist/modules/access-model/access-grammar.js.map +1 -0
  66. package/dist/modules/access-model/access-splice.d.ts +140 -0
  67. package/dist/modules/access-model/access-splice.d.ts.map +1 -0
  68. package/dist/modules/access-model/access-splice.js +389 -0
  69. package/dist/modules/access-model/access-splice.js.map +1 -0
  70. package/dist/modules/access-model/creator.d.ts +54 -0
  71. package/dist/modules/access-model/creator.d.ts.map +1 -0
  72. package/dist/modules/access-model/creator.js +30 -0
  73. package/dist/modules/access-model/creator.js.map +1 -0
  74. package/dist/modules/access-model/group-files.d.ts +83 -0
  75. package/dist/modules/access-model/group-files.d.ts.map +1 -0
  76. package/dist/modules/access-model/group-files.js +167 -0
  77. package/dist/modules/access-model/group-files.js.map +1 -0
  78. package/dist/modules/access-model/kb-read-filter.d.ts +41 -0
  79. package/dist/modules/access-model/kb-read-filter.d.ts.map +1 -0
  80. package/dist/modules/access-model/kb-read-filter.js +60 -0
  81. package/dist/modules/access-model/kb-read-filter.js.map +1 -0
  82. package/dist/modules/access-model/render-roles-yaml.d.ts +22 -0
  83. package/dist/modules/access-model/render-roles-yaml.d.ts.map +1 -0
  84. package/dist/modules/access-model/render-roles-yaml.js +56 -0
  85. package/dist/modules/access-model/render-roles-yaml.js.map +1 -0
  86. package/dist/modules/access-model/roles-yaml-guard.d.ts +56 -0
  87. package/dist/modules/access-model/roles-yaml-guard.d.ts.map +1 -0
  88. package/dist/modules/access-model/roles-yaml-guard.js +79 -0
  89. package/dist/modules/access-model/roles-yaml-guard.js.map +1 -0
  90. package/dist/modules/admin/admin-access.service.d.ts.map +1 -1
  91. package/dist/modules/admin/admin-access.service.js +1 -1
  92. package/dist/modules/admin/admin-access.service.js.map +1 -1
  93. package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
  94. package/dist/modules/code-mode/code-mode.tool.js +7 -1
  95. package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
  96. package/dist/modules/diff/diff.routes.js +4 -4
  97. package/dist/modules/diff/diff.routes.js.map +1 -1
  98. package/dist/modules/diff/diff.service.d.ts +1 -1
  99. package/dist/modules/diff/diff.service.d.ts.map +1 -1
  100. package/dist/modules/kb-fs/branch-name.d.ts +10 -0
  101. package/dist/modules/kb-fs/branch-name.d.ts.map +1 -0
  102. package/dist/modules/kb-fs/branch-name.js +76 -0
  103. package/dist/modules/kb-fs/branch-name.js.map +1 -0
  104. package/dist/modules/kb-fs/clone-config.d.ts +61 -0
  105. package/dist/modules/kb-fs/clone-config.d.ts.map +1 -0
  106. package/dist/modules/kb-fs/clone-config.js +69 -0
  107. package/dist/modules/kb-fs/clone-config.js.map +1 -0
  108. package/dist/modules/kb-fs/file-change-notifier.d.ts +38 -0
  109. package/dist/modules/kb-fs/file-change-notifier.d.ts.map +1 -0
  110. package/dist/modules/kb-fs/file-change-notifier.js +22 -0
  111. package/dist/modules/kb-fs/file-change-notifier.js.map +1 -0
  112. package/dist/modules/kb-fs/locking-filesystem.d.ts +137 -0
  113. package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -0
  114. package/dist/modules/kb-fs/locking-filesystem.js +553 -0
  115. package/dist/modules/kb-fs/locking-filesystem.js.map +1 -0
  116. package/dist/modules/kb-fs/mutex.d.ts +11 -0
  117. package/dist/modules/kb-fs/mutex.d.ts.map +1 -0
  118. package/dist/modules/kb-fs/mutex.js +23 -0
  119. package/dist/modules/kb-fs/mutex.js.map +1 -0
  120. package/dist/modules/kb-fs/read-only-filesystem.d.ts +24 -0
  121. package/dist/modules/kb-fs/read-only-filesystem.d.ts.map +1 -0
  122. package/dist/modules/kb-fs/read-only-filesystem.js +39 -0
  123. package/dist/modules/kb-fs/read-only-filesystem.js.map +1 -0
  124. package/dist/modules/plugins/join-proposals.d.ts +1 -1
  125. package/dist/modules/plugins/join-proposals.d.ts.map +1 -1
  126. package/dist/modules/plugins/join-proposals.js +1 -1
  127. package/dist/modules/plugins/join-proposals.js.map +1 -1
  128. package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
  129. package/dist/modules/plugins/join-requests.service.js +1 -1
  130. package/dist/modules/plugins/join-requests.service.js.map +1 -1
  131. package/dist/modules/plugins/plugin-provision.service.js +3 -3
  132. package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
  133. package/dist/modules/plugins/plugins.routes.js +2 -2
  134. package/dist/modules/plugins/plugins.routes.js.map +1 -1
  135. package/dist/modules/plugins/plugins.service.js +1 -1
  136. package/dist/modules/plugins/plugins.service.js.map +1 -1
  137. package/dist/modules/secrets-vault/secrets-vault.routes.js +1 -1
  138. package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
  139. package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
  140. package/dist/modules/skills/pending-skills.service.js +1 -1
  141. package/dist/modules/skills/pending-skills.service.js.map +1 -1
  142. package/dist/modules/skills/skills.service.js +1 -1
  143. package/dist/modules/skills/skills.service.js.map +1 -1
  144. package/dist/modules/tool-helpers/tool-context.d.ts +2 -2
  145. package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -1
  146. package/dist/modules/tool-helpers/tool-context.js +4 -4
  147. package/dist/modules/tool-helpers/tool-context.js.map +1 -1
  148. package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts +1 -1
  149. package/dist/modules/tool-manuals/mcp-server-edit.service.d.ts.map +1 -1
  150. package/dist/modules/tool-manuals/mcp-server-edit.service.js +1 -1
  151. package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
  152. package/dist/modules/tool-manuals/tool-manuals.routes.d.ts +1 -1
  153. package/dist/modules/tool-manuals/tool-manuals.routes.d.ts.map +1 -1
  154. package/dist/modules/tool-manuals/tool-manuals.routes.js +1 -1
  155. package/dist/modules/tool-manuals/tool-manuals.routes.js.map +1 -1
  156. package/dist/modules/tool-manuals/tool-manuals.service.js +1 -1
  157. package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
  158. package/dist/modules/tool-manuals/tool-manuals.tools.js +1 -1
  159. package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
  160. package/dist/modules/workflow/agent-tools/workflow.tools.js +1 -1
  161. package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
  162. package/dist/modules/workflow/file-lock.service.js +1 -1
  163. package/dist/modules/workflow/file-lock.service.js.map +1 -1
  164. package/dist/modules/workflow/git/git.service.d.ts +2 -2
  165. package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
  166. package/dist/modules/workflow/git/git.service.js +5 -5
  167. package/dist/modules/workflow/git/git.service.js.map +1 -1
  168. package/dist/modules/workflow/git/pull-request.service.js +1 -1
  169. package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
  170. package/dist/modules/workflow/review-workflow/review-workflow.service.js +2 -2
  171. package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
  172. package/dist/modules/workflow/session-ontology.service.js +1 -1
  173. package/dist/modules/workflow/session-ontology.service.js.map +1 -1
  174. package/dist/modules/workflow/workflow.routes.js +2 -2
  175. package/dist/modules/workflow/workflow.routes.js.map +1 -1
  176. package/dist/modules/workflow/workflow.service.d.ts +1 -1
  177. package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
  178. package/dist/modules/workflow/workflow.service.js +4 -4
  179. package/dist/modules/workflow/workflow.service.js.map +1 -1
  180. package/dist/modules/workspace/file-readers/doc-extract.service.d.ts +71 -0
  181. package/dist/modules/workspace/file-readers/doc-extract.service.d.ts.map +1 -0
  182. package/dist/modules/workspace/file-readers/doc-extract.service.js +90 -0
  183. package/dist/modules/workspace/file-readers/doc-extract.service.js.map +1 -0
  184. package/dist/modules/workspace/file-readers/doc-extract.types.d.ts +55 -0
  185. package/dist/modules/workspace/file-readers/doc-extract.types.d.ts.map +1 -0
  186. package/dist/modules/workspace/file-readers/doc-extract.types.js +34 -0
  187. package/dist/modules/workspace/file-readers/doc-extract.types.js.map +1 -0
  188. package/dist/modules/workspace/file-readers/document-reader.d.ts +32 -0
  189. package/dist/modules/workspace/file-readers/document-reader.d.ts.map +1 -0
  190. package/dist/modules/workspace/file-readers/document-reader.js +59 -0
  191. package/dist/modules/workspace/file-readers/document-reader.js.map +1 -0
  192. package/dist/modules/workspace/file-readers/email-reader.d.ts +15 -0
  193. package/dist/modules/workspace/file-readers/email-reader.d.ts.map +1 -0
  194. package/dist/modules/workspace/file-readers/email-reader.js +19 -0
  195. package/dist/modules/workspace/file-readers/email-reader.js.map +1 -0
  196. package/dist/modules/workspace/file-readers/email-text.d.ts +51 -0
  197. package/dist/modules/workspace/file-readers/email-text.d.ts.map +1 -0
  198. package/dist/modules/workspace/file-readers/email-text.js +151 -0
  199. package/dist/modules/workspace/file-readers/email-text.js.map +1 -0
  200. package/dist/modules/workspace/file-readers/extract-docx.d.ts +13 -0
  201. package/dist/modules/workspace/file-readers/extract-docx.d.ts.map +1 -0
  202. package/dist/modules/workspace/file-readers/extract-docx.js +67 -0
  203. package/dist/modules/workspace/file-readers/extract-docx.js.map +1 -0
  204. package/dist/modules/workspace/file-readers/extract-eml.d.ts +18 -0
  205. package/dist/modules/workspace/file-readers/extract-eml.d.ts.map +1 -0
  206. package/dist/modules/workspace/file-readers/extract-eml.js +87 -0
  207. package/dist/modules/workspace/file-readers/extract-eml.js.map +1 -0
  208. package/dist/modules/workspace/file-readers/extract-msg.d.ts +17 -0
  209. package/dist/modules/workspace/file-readers/extract-msg.d.ts.map +1 -0
  210. package/dist/modules/workspace/file-readers/extract-msg.js +121 -0
  211. package/dist/modules/workspace/file-readers/extract-msg.js.map +1 -0
  212. package/dist/modules/workspace/file-readers/extract-odp.d.ts +13 -0
  213. package/dist/modules/workspace/file-readers/extract-odp.d.ts.map +1 -0
  214. package/dist/modules/workspace/file-readers/extract-odp.js +60 -0
  215. package/dist/modules/workspace/file-readers/extract-odp.js.map +1 -0
  216. package/dist/modules/workspace/file-readers/extract-ods.d.ts +10 -0
  217. package/dist/modules/workspace/file-readers/extract-ods.d.ts.map +1 -0
  218. package/dist/modules/workspace/file-readers/extract-ods.js +173 -0
  219. package/dist/modules/workspace/file-readers/extract-ods.js.map +1 -0
  220. package/dist/modules/workspace/file-readers/extract-odt.d.ts +17 -0
  221. package/dist/modules/workspace/file-readers/extract-odt.d.ts.map +1 -0
  222. package/dist/modules/workspace/file-readers/extract-odt.js +45 -0
  223. package/dist/modules/workspace/file-readers/extract-odt.js.map +1 -0
  224. package/dist/modules/workspace/file-readers/extract-pdf.d.ts +3 -0
  225. package/dist/modules/workspace/file-readers/extract-pdf.d.ts.map +1 -0
  226. package/dist/modules/workspace/file-readers/extract-pdf.js +176 -0
  227. package/dist/modules/workspace/file-readers/extract-pdf.js.map +1 -0
  228. package/dist/modules/workspace/file-readers/extract-pptx.d.ts +37 -0
  229. package/dist/modules/workspace/file-readers/extract-pptx.d.ts.map +1 -0
  230. package/dist/modules/workspace/file-readers/extract-pptx.js +288 -0
  231. package/dist/modules/workspace/file-readers/extract-pptx.js.map +1 -0
  232. package/dist/modules/workspace/file-readers/extract-xlsx.d.ts +10 -0
  233. package/dist/modules/workspace/file-readers/extract-xlsx.d.ts.map +1 -0
  234. package/dist/modules/workspace/file-readers/extract-xlsx.js +98 -0
  235. package/dist/modules/workspace/file-readers/extract-xlsx.js.map +1 -0
  236. package/dist/modules/workspace/file-readers/extraction-cache.d.ts +61 -0
  237. package/dist/modules/workspace/file-readers/extraction-cache.d.ts.map +1 -0
  238. package/dist/modules/workspace/file-readers/extraction-cache.js +135 -0
  239. package/dist/modules/workspace/file-readers/extraction-cache.js.map +1 -0
  240. package/dist/modules/workspace/file-readers/file-reader.d.ts +76 -0
  241. package/dist/modules/workspace/file-readers/file-reader.d.ts.map +1 -0
  242. package/dist/modules/workspace/file-readers/file-reader.js +55 -0
  243. package/dist/modules/workspace/file-readers/file-reader.js.map +1 -0
  244. package/dist/modules/workspace/file-readers/file-reader.registry.d.ts +13 -0
  245. package/dist/modules/workspace/file-readers/file-reader.registry.d.ts.map +1 -0
  246. package/dist/modules/workspace/file-readers/file-reader.registry.js +41 -0
  247. package/dist/modules/workspace/file-readers/file-reader.registry.js.map +1 -0
  248. package/dist/modules/workspace/file-readers/image-read.d.ts +35 -0
  249. package/dist/modules/workspace/file-readers/image-read.d.ts.map +1 -0
  250. package/dist/modules/workspace/file-readers/image-read.js +108 -0
  251. package/dist/modules/workspace/file-readers/image-read.js.map +1 -0
  252. package/dist/modules/workspace/file-readers/image-reader.d.ts +19 -0
  253. package/dist/modules/workspace/file-readers/image-reader.d.ts.map +1 -0
  254. package/dist/modules/workspace/file-readers/image-reader.js +30 -0
  255. package/dist/modules/workspace/file-readers/image-reader.js.map +1 -0
  256. package/dist/modules/workspace/file-readers/odf-text.d.ts +26 -0
  257. package/dist/modules/workspace/file-readers/odf-text.d.ts.map +1 -0
  258. package/dist/modules/workspace/file-readers/odf-text.js +116 -0
  259. package/dist/modules/workspace/file-readers/odf-text.js.map +1 -0
  260. package/dist/modules/workspace/file-readers/ooxml-text.d.ts +172 -0
  261. package/dist/modules/workspace/file-readers/ooxml-text.d.ts.map +1 -0
  262. package/dist/modules/workspace/file-readers/ooxml-text.js +439 -0
  263. package/dist/modules/workspace/file-readers/ooxml-text.js.map +1 -0
  264. package/dist/modules/workspace/file-readers/text-reader.d.ts +47 -0
  265. package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -0
  266. package/dist/modules/workspace/file-readers/text-reader.js +117 -0
  267. package/dist/modules/workspace/file-readers/text-reader.js.map +1 -0
  268. package/dist/modules/workspace/startup/kb-startup-runner.js +1 -1
  269. package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
  270. package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js +1 -1
  271. package/dist/modules/workspace/startup/steps/groups-to-plugins.step.js.map +1 -1
  272. package/dist/modules/workspace/startup/steps/roles-yaml.step.d.ts +1 -1
  273. package/dist/modules/workspace/startup/steps/roles-yaml.step.js +2 -2
  274. package/dist/modules/workspace/startup/steps/roles-yaml.step.js.map +1 -1
  275. package/dist/modules/workspace/startup/steps/seed-tree.js +1 -1
  276. package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
  277. package/dist/modules/workspace/workspace.routes.d.ts +1 -1
  278. package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
  279. package/dist/modules/workspace/workspace.routes.js +5 -4
  280. package/dist/modules/workspace/workspace.routes.js.map +1 -1
  281. package/dist/modules/workspace/workspace.service.d.ts +2 -9
  282. package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
  283. package/dist/modules/workspace/workspace.service.js +14 -15
  284. package/dist/modules/workspace/workspace.service.js.map +1 -1
  285. package/dist/modules/workspace/workspace.tools.d.ts +2 -1
  286. package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
  287. package/dist/modules/workspace/workspace.tools.js +161 -18
  288. package/dist/modules/workspace/workspace.tools.js.map +1 -1
  289. package/dist/shared/domain-errors.d.ts +202 -0
  290. package/dist/shared/domain-errors.d.ts.map +1 -0
  291. package/dist/shared/domain-errors.js +303 -0
  292. package/dist/shared/domain-errors.js.map +1 -0
  293. package/dist/shared/workspace-id.d.ts +27 -0
  294. package/dist/shared/workspace-id.d.ts.map +1 -0
  295. package/dist/shared/workspace-id.js +36 -0
  296. package/dist/shared/workspace-id.js.map +1 -0
  297. package/package.json +9 -4
  298. package/src/core/create-core-server.ts +1 -1
  299. package/src/core/create-core-services.ts +8 -2
  300. package/src/core-config.ts +9 -0
  301. package/src/modules/access/__tests__/access-control.service.test.ts +1 -1
  302. package/src/modules/access/__tests__/access-groups.test.ts +6 -5
  303. package/src/modules/access/__tests__/access-md-format.test.ts +3 -3
  304. package/src/modules/access/__tests__/access-mutation.service.test.ts +1 -1
  305. package/src/modules/access/__tests__/admin-locked-commit.test.ts +1 -1
  306. package/src/modules/access/__tests__/admin-route-helpers.test.ts +1 -1
  307. package/src/modules/access/__tests__/roles-admin.service.test.ts +2 -2
  308. package/src/modules/access/__tests__/roles-edit.test.ts +1 -1
  309. package/src/modules/access/__tests__/synced-groups-committer.test.ts +1 -1
  310. package/src/modules/access/__tests__/synced-groups-writer.test.ts +1 -1
  311. package/src/modules/access/access-control.service.ts +23 -768
  312. package/src/modules/access/access-declarations.ts +2 -2
  313. package/src/modules/access/access-mutation.service.ts +3 -3
  314. package/src/modules/access/access.routes.ts +5 -5
  315. package/src/modules/access/admin-locked-commit.ts +2 -2
  316. package/src/modules/access/admin-route-helpers.ts +1 -1
  317. package/src/modules/access/capability-registry.ts +1 -1
  318. package/src/modules/access/creator-access.ts +9 -72
  319. package/src/modules/access/groups-admin.routes.ts +1 -1
  320. package/src/modules/access/groups-admin.service.ts +6 -7
  321. package/src/modules/access/groups-edit.ts +2 -2
  322. package/src/modules/access/reference-scan.ts +1 -1
  323. package/src/modules/access/roles-admin.service.ts +8 -8
  324. package/src/modules/access/roles-edit.ts +1 -1
  325. package/src/modules/access/synced-groups-committer.ts +4 -4
  326. package/src/modules/access/synced-groups-writer.ts +2 -2
  327. package/src/modules/access-model/__tests__/access-grammar.test.ts +31 -0
  328. package/src/modules/{access → access-model}/__tests__/access-splice.test.ts +268 -268
  329. package/src/modules/{access → access-model}/access-errors.ts +1 -1
  330. package/src/modules/access-model/access-grammar.ts +778 -0
  331. package/src/modules/{access → access-model}/access-splice.ts +1 -1
  332. package/src/modules/access-model/creator.ts +79 -0
  333. package/src/modules/{access → access-model}/group-files.ts +1 -1
  334. package/src/modules/{access → access-model}/render-roles-yaml.ts +1 -1
  335. package/src/modules/{access → access-model}/roles-yaml-guard.ts +2 -2
  336. package/src/modules/admin/admin-access.service.ts +2 -1
  337. package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +30 -0
  338. package/src/modules/code-mode/code-mode.tool.ts +7 -1
  339. package/src/modules/diff/__tests__/diff.routes.rejectPathsLocked.test.ts +2 -2
  340. package/src/modules/diff/__tests__/diff.service.seed-atomicity.test.ts +3 -2
  341. package/src/modules/diff/__tests__/diff.service.test.ts +3 -2
  342. package/src/modules/diff/diff.routes.ts +4 -4
  343. package/src/modules/diff/diff.service.ts +1 -1
  344. package/src/modules/{workflow/git → kb-fs}/__tests__/branch-name.test.ts +1 -1
  345. package/src/modules/{workflow → kb-fs}/__tests__/locking-filesystem.test.ts +1 -1
  346. package/src/modules/{workflow/git → kb-fs}/branch-name.ts +1 -1
  347. package/src/modules/{workflow → kb-fs}/locking-filesystem.ts +2 -2
  348. package/src/modules/plugins/__tests__/join-requests.service.test.ts +2 -4
  349. package/src/modules/plugins/__tests__/plugin-index.service.test.ts +1 -1
  350. package/src/modules/plugins/__tests__/plugins.routes.test.ts +1 -1
  351. package/src/modules/plugins/join-proposals.ts +1 -1
  352. package/src/modules/plugins/join-requests.service.ts +2 -1
  353. package/src/modules/plugins/plugin-provision.service.ts +3 -3
  354. package/src/modules/plugins/plugins.routes.ts +2 -2
  355. package/src/modules/plugins/plugins.service.ts +1 -1
  356. package/src/modules/secrets-vault/secrets-vault.routes.ts +1 -1
  357. package/src/modules/skills/__tests__/skills.service.test.ts +1 -1
  358. package/src/modules/skills/pending-skills.service.ts +2 -1
  359. package/src/modules/skills/skills.service.ts +1 -1
  360. package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +2 -1
  361. package/src/modules/tool-helpers/tool-context.ts +6 -5
  362. package/src/modules/tool-manuals/__tests__/mcp-server-edit.service.test.ts +1 -1
  363. package/src/modules/tool-manuals/__tests__/tool-manuals.archive.route.test.ts +1 -1
  364. package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +1 -1
  365. package/src/modules/tool-manuals/__tests__/tool-manuals.mcp-oauth.test.ts +1 -1
  366. package/src/modules/tool-manuals/__tests__/tool-manuals.service.test.ts +1 -1
  367. package/src/modules/tool-manuals/mcp-server-edit.service.ts +2 -1
  368. package/src/modules/tool-manuals/tool-manuals.routes.ts +2 -1
  369. package/src/modules/tool-manuals/tool-manuals.service.ts +1 -1
  370. package/src/modules/tool-manuals/tool-manuals.tools.ts +1 -1
  371. package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +1 -1
  372. package/src/modules/workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts +1 -1
  373. package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +1 -1
  374. package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +1 -1
  375. package/src/modules/workflow/agent-tools/workflow.tools.ts +1 -1
  376. package/src/modules/workflow/file-lock.service.ts +1 -1
  377. package/src/modules/workflow/git/__tests__/git.service.accessGating.test.ts +1 -1
  378. package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +1 -1
  379. package/src/modules/workflow/git/__tests__/git.service.diffFileAtCommit.test.ts +1 -1
  380. package/src/modules/workflow/git/__tests__/git.service.diffFileBetweenBranches.test.ts +1 -1
  381. package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +1 -1
  382. package/src/modules/workflow/git/git.service.ts +5 -5
  383. package/src/modules/workflow/git/pull-request.service.ts +1 -1
  384. package/src/modules/workflow/review-workflow/__tests__/cancel-pr.test.ts +1 -1
  385. package/src/modules/workflow/review-workflow/review-workflow.service.ts +2 -2
  386. package/src/modules/workflow/session-ontology.service.ts +1 -1
  387. package/src/modules/workflow/workflow.routes.ts +2 -2
  388. package/src/modules/workflow/workflow.service.ts +5 -5
  389. package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +1 -1
  390. package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +1 -1
  391. package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -2
  392. package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +1 -1
  393. package/src/modules/workspace/__tests__/workspace.service.read-filter.test.ts +2 -5
  394. package/src/modules/workspace/__tests__/workspace.service.test.ts +13 -1
  395. package/src/modules/workspace/__tests__/workspace.tools.test.ts +501 -3
  396. package/src/modules/workspace/file-readers/__tests__/doc-extract.test.ts +1658 -0
  397. package/src/modules/workspace/file-readers/__tests__/email-extract.test.ts +485 -0
  398. package/src/modules/workspace/file-readers/__tests__/file-reader.registry.test.ts +97 -0
  399. package/src/modules/workspace/file-readers/__tests__/image-read.test.ts +100 -0
  400. package/src/modules/workspace/file-readers/doc-extract.service.ts +104 -0
  401. package/src/modules/workspace/file-readers/doc-extract.types.ts +63 -0
  402. package/src/modules/workspace/file-readers/document-reader.ts +64 -0
  403. package/src/modules/workspace/file-readers/email-reader.ts +21 -0
  404. package/src/modules/workspace/file-readers/email-text.ts +193 -0
  405. package/src/modules/workspace/file-readers/extract-docx.ts +67 -0
  406. package/src/modules/workspace/file-readers/extract-eml.ts +92 -0
  407. package/src/modules/workspace/file-readers/extract-msg.ts +134 -0
  408. package/src/modules/workspace/file-readers/extract-odp.ts +63 -0
  409. package/src/modules/workspace/file-readers/extract-ods.ts +182 -0
  410. package/src/modules/workspace/file-readers/extract-odt.ts +48 -0
  411. package/src/modules/workspace/file-readers/extract-pdf.ts +178 -0
  412. package/src/modules/workspace/file-readers/extract-pptx.ts +302 -0
  413. package/src/modules/workspace/file-readers/extract-xlsx.ts +96 -0
  414. package/src/modules/workspace/file-readers/extraction-cache.ts +142 -0
  415. package/src/modules/workspace/file-readers/file-reader.registry.ts +45 -0
  416. package/src/modules/workspace/file-readers/file-reader.ts +104 -0
  417. package/src/modules/workspace/file-readers/image-read.ts +122 -0
  418. package/src/modules/workspace/file-readers/image-reader.ts +39 -0
  419. package/src/modules/workspace/file-readers/odf-text.ts +123 -0
  420. package/src/modules/workspace/file-readers/ooxml-text.ts +477 -0
  421. package/src/modules/workspace/file-readers/text-reader.ts +131 -0
  422. package/src/modules/workspace/startup/kb-startup-runner.ts +1 -1
  423. package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +1 -1
  424. package/src/modules/workspace/startup/steps/groups-to-plugins.step.ts +1 -1
  425. package/src/modules/workspace/startup/steps/roles-yaml.step.ts +2 -2
  426. package/src/modules/workspace/startup/steps/seed-tree.ts +1 -1
  427. package/src/modules/workspace/workspace.routes.ts +6 -5
  428. package/src/modules/workspace/workspace.service.ts +14 -18
  429. package/src/modules/workspace/workspace.tools.ts +177 -15
  430. package/src/shared/__tests__/join-request.test.ts +1 -1
  431. package/src/shared/__tests__/workspace-id.test.ts +17 -0
  432. package/src/{modules/workflow/workflow.errors.ts → shared/domain-errors.ts} +6 -1
  433. package/src/shared/workspace-id.ts +36 -0
  434. /package/src/modules/{access → access-model}/__tests__/kb-read-filter.test.ts +0 -0
  435. /package/src/modules/{access → access-model}/__tests__/roles-yaml-guard.test.ts +0 -0
  436. /package/src/modules/{access → access-model}/kb-read-filter.ts +0 -0
  437. /package/src/modules/{workflow/git → kb-fs}/__tests__/clone-config.test.ts +0 -0
  438. /package/src/modules/{workflow → kb-fs}/__tests__/file-change-notifier.test.ts +0 -0
  439. /package/src/modules/{workflow/git → kb-fs}/__tests__/mutex.test.ts +0 -0
  440. /package/src/modules/{workflow/git → kb-fs}/clone-config.ts +0 -0
  441. /package/src/modules/{workflow → kb-fs}/file-change-notifier.ts +0 -0
  442. /package/src/modules/{workflow/git → kb-fs}/mutex.ts +0 -0
  443. /package/src/modules/{workflow → kb-fs}/read-only-filesystem.ts +0 -0
@@ -33,7 +33,7 @@ import {
33
33
  canonicalEmail,
34
34
  canonicalRoleName,
35
35
  accessMdDeclaresBodyRules,
36
- } from './access-control.service.js';
36
+ } from './access-grammar.js';
37
37
 
38
38
  /**
39
39
  * Which rule block a mutation edits.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The pure half of the creator read-grant story: the creator identity, the
3
+ * grant-plan contract the creation surfaces consume, and the splice-safe
4
+ * principal for a creator. The service that DECIDES when a creation needs a
5
+ * grant (filesystem stats, access checks) is `modules/access/creator-access.ts`;
6
+ * this file carries only the types and pure helpers so downstream modules
7
+ * (kb-fs, plugins, tool-helpers) never need an edge into the access module.
8
+ */
9
+
10
+ import type { Principal } from './access-splice.js';
11
+
12
+ /**
13
+ * How a pending creation gets its creator read grant.
14
+ * - `seed-access-md`: merge the grant into `wsRelPath` (a new directory's
15
+ * own `access.md`, workspace-relative) — BEFORE or alongside the creation,
16
+ * via the caller's own lock+commit machinery. The caller MUST re-read the
17
+ * file's CURRENT text under its lock and write `apply(current)` ('' when
18
+ * absent), never a precomputed fresh file: two concurrent creators can
19
+ * both plan a seed for the same new directory, and a blind overwrite
20
+ * would silently revoke whichever grant landed first. Skip the write when
21
+ * `apply` returns the input unchanged, and call `noteAccessFileWritten`
22
+ * after a write so the resolver cache drops.
23
+ * - `frontmatter`: run the new file's content through `apply` before
24
+ * writing it, so the grant lands atomically inside the created file.
25
+ */
26
+ export type CreationGrantPlan =
27
+ | { kind: 'seed-access-md'; wsRelPath: string; apply: (current: string) => string }
28
+ | { kind: 'frontmatter'; apply: (content: string) => string };
29
+
30
+ /** The creator identity a grant is written for. */
31
+ export interface Creator {
32
+ name: string;
33
+ email: string;
34
+ }
35
+
36
+ /**
37
+ * Injection seam for the creation surfaces (routes, lock-aware filesystem,
38
+ * upload apply). Kept as an interface so callers depend on the contract, not
39
+ * the class.
40
+ */
41
+ export interface ICreatorAccess {
42
+ planForCreate(
43
+ workspaceId: string,
44
+ creator: Creator,
45
+ wsRelPath: string,
46
+ kind: 'file' | 'dir',
47
+ ): Promise<CreationGrantPlan | null>;
48
+
49
+ grantInExtractedFile(
50
+ workspaceId: string,
51
+ creator: Creator,
52
+ wsRelPath: string,
53
+ ): Promise<string | null>;
54
+
55
+ noteAccessFileWritten(workspaceId: string): void;
56
+ }
57
+
58
+ /**
59
+ * The splice-safe principal for a creator — exported because plugin
60
+ * provisioning (`PluginProvisionService`) writes the same `Name <email>`
61
+ * entries into the access.md files it seeds, and two spellings of the same
62
+ * person would read as two people.
63
+ */
64
+ export function creatorPrincipal(creator: Creator): Principal {
65
+ return { kind: 'user', email: creator.email, displayName: safeDisplayName(creator) };
66
+ }
67
+
68
+ /**
69
+ * `Name <email>`-safe display name: `validatePrincipal` rejects control
70
+ * chars, `<`, `>`, and `#`, so strip those from the user's name and fall
71
+ * back to the email local part (which the email regex already keeps free of
72
+ * `<>`/whitespace) when nothing usable remains.
73
+ */
74
+ function safeDisplayName(creator: Creator): string {
75
+ const strip = (s: string) =>
76
+ // eslint-disable-next-line no-control-regex -- same intentional control-char guard as access-splice
77
+ s.replace(/[<>#\u0000-\u001f\u007f]/g, ' ').replace(/\s+/g, ' ').trim();
78
+ return strip(creator.name) || strip(creator.email.split('@')[0] ?? '') || 'KB user';
79
+ }
@@ -6,7 +6,7 @@ import {
6
6
  canonicalEmail,
7
7
  canonicalRoleName,
8
8
  parseYamlSubset,
9
- } from './access-control.service.js';
9
+ } from './access-grammar.js';
10
10
 
11
11
  /**
12
12
  * Group files — the "who you are" half of the roles/groups split.
@@ -1,4 +1,4 @@
1
- import { parseRolesYaml } from './access-control.service.js';
1
+ import { parseRolesYaml } from './access-grammar.js';
2
2
 
3
3
  /**
4
4
  * Render a `roles.yaml` granting Admin to each email — the ONE renderer every
@@ -22,8 +22,8 @@
22
22
  */
23
23
 
24
24
  import type { FileContent } from '@mastra/core/workspace';
25
- import { parseRolesYaml } from './access-control.service.js';
26
- import { WorkflowDomainError } from '../workflow/workflow.errors.js';
25
+ import { parseRolesYaml } from './access-grammar.js';
26
+ import { WorkflowDomainError } from '../../shared/domain-errors.js';
27
27
 
28
28
  /** Repo-relative basename of the roles file (it lives at the KB repo root). */
29
29
  export const ROLES_YAML_BASENAME = 'roles.yaml';
@@ -1,5 +1,6 @@
1
1
  import type { IAccessControl } from '../access/access-control.interface.js';
2
- import { type WorkspaceService, workspaceIdForBranch } from '../workspace/workspace.service.js';
2
+ import { type WorkspaceService } from '../workspace/workspace.service.js';
3
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
3
4
  import type { IAdminAccessService } from './admin.interface.js';
4
5
 
5
6
  /**
@@ -65,3 +65,33 @@ describe('tools_info', () => {
65
65
  await expect(run(['solo.run', 'down.run'])).rejects.toThrow(/repository unavailable/);
66
66
  });
67
67
  });
68
+
69
+ /**
70
+ * The in-process agent's `call_tool_chain` shares the MCP surfaces' image
71
+ * policy: a chain result is stringified into the transcript, so an image read
72
+ * inside it must come back as an omitted-image note — never inline base64.
73
+ */
74
+ describe('call_tool_chain image scrub', () => {
75
+ it('replaces a chained image sentinel with a note before serialization', async () => {
76
+ const { createCallToolChainTool } = await import('../code-mode.tool.js');
77
+ const sentinel = {
78
+ kind: 'bevel/mcp-image@v1',
79
+ data: 'QUJDREVG',
80
+ mimeType: 'image/png',
81
+ note: '[image: Files/logo.png — image/png, 6 bytes]',
82
+ };
83
+ const chainClient = {
84
+ callToolChain: vi.fn(async () => ({ result: { pic: sentinel, ok: true }, logs: [] as string[] })),
85
+ } as unknown as CodeModeUtcpClient;
86
+ const spill = { write: vi.fn(async () => ({ ref: '__tool_chain_spill__/x.json', bytes: 1 })) };
87
+ const tool = createCallToolChainTool(chainClient, spill as never) as unknown as {
88
+ execute: (input: { code: string }) => Promise<unknown>;
89
+ };
90
+ const out = JSON.stringify(await tool.execute({ code: 'return 1' }));
91
+ expect(out).not.toContain('QUJDREVG');
92
+ expect(out).toContain('image_omitted');
93
+ expect(out).toContain('Files/logo.png');
94
+ expect(out).toContain('"ok":true');
95
+ expect(spill.write).not.toHaveBeenCalled();
96
+ });
97
+ });
@@ -2,6 +2,7 @@ import '@utcp/direct-call';
2
2
  import { createTool } from '@mastra/core/tools';
3
3
  import { z } from 'zod';
4
4
  import { CodeModeUtcpClient } from '@utcp/code-mode';
5
+ import { omitImagePayloads } from '@bevel-software/platform-mcp-core';
5
6
  import type { SpillStore } from '../workspace/spill-store.js';
6
7
  import { utcpNameToTsInterfaceName, findToolByName, AmbiguousToolNameError } from './code-mode-names.js';
7
8
 
@@ -43,7 +44,12 @@ export function createCallToolChainTool(
43
44
  const timeout = input.timeout ?? 30_000;
44
45
  const maxOutputSize = input.max_output_size ?? 200_000;
45
46
  try {
46
- const { result, logs } = await client.callToolChain(input.code, timeout);
47
+ const { result: rawResult, logs } = await client.callToolChain(input.code, timeout);
48
+ // Same policy as the MCP surfaces' `call_tool_chain` (see
49
+ // `omitImagePayloads`): a chain result is stringified JSON, so an image
50
+ // read inside it comes back as an omitted-image note instead of a
51
+ // base64 flood — images are only delivered on a direct `read_file`.
52
+ const result = omitImagePayloads(rawResult, 'result');
47
53
  const json = JSON.stringify({ success: true, result, logs });
48
54
  if (json.length <= maxOutputSize) {
49
55
  return { success: true, result, logs };
@@ -4,8 +4,8 @@ import path from 'node:path';
4
4
  import os from 'node:os';
5
5
  import type { AuthUser, IWorkflowService } from '@bevel-software/platform-shared';
6
6
  import type { IDiffService } from '../diff.interface.js';
7
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
8
- import { WorkflowValidationError } from '../../workflow/workflow.errors.js';
7
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
8
+ import { WorkflowValidationError } from '../../../shared/domain-errors.js';
9
9
  import { rejectPathsLocked } from '../diff.routes.js';
10
10
 
11
11
  /**
@@ -2,8 +2,9 @@ import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
2
2
  import fs from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import os from 'node:os';
5
- import { WorkspaceService, workspaceIdForBranch } from '../../workspace/workspace.service.js';
6
- import { WorkspaceMutex } from '../../workflow/git/mutex.js';
5
+ import { WorkspaceService } from '../../workspace/workspace.service.js';
6
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
7
+ import { WorkspaceMutex } from '../../kb-fs/mutex.js';
7
8
  import { DiffService } from '../diff.service.js';
8
9
 
9
10
  /**
@@ -2,8 +2,9 @@ import { describe, it, expect, beforeEach, afterEach } from 'vitest';
2
2
  import fs from 'node:fs/promises';
3
3
  import path from 'node:path';
4
4
  import os from 'node:os';
5
- import { WorkspaceService, workspaceIdForBranch } from '../../workspace/workspace.service.js';
6
- import { WorkspaceMutex } from '../../workflow/git/mutex.js';
5
+ import { WorkspaceService } from '../../workspace/workspace.service.js';
6
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
7
+ import { WorkspaceMutex } from '../../kb-fs/mutex.js';
7
8
  import { DiffService } from '../diff.service.js';
8
9
 
9
10
  async function mkTmpRoot(prefix: string): Promise<string> {
@@ -3,10 +3,10 @@ import type { AuthUser, IWorkflowService } from '@bevel-software/platform-shared
3
3
  import type { IDiffService } from './diff.interface.js';
4
4
  import type { AuthService } from '../auth/auth.service.js';
5
5
  import type { IAccessControl } from '../access/access-control.interface.js';
6
- import { toKbRelative, resolveReadableMap } from '../access/kb-read-filter.js';
7
- import { WorkflowDomainError, WorkflowValidationError } from '../workflow/workflow.errors.js';
8
- import { LockingFilesystem } from '../workflow/locking-filesystem.js';
9
- import { branchForWorkspaceId } from '../workspace/workspace.service.js';
6
+ import { toKbRelative, resolveReadableMap } from '../access-model/kb-read-filter.js';
7
+ import { WorkflowDomainError, WorkflowValidationError } from '../../shared/domain-errors.js';
8
+ import { LockingFilesystem } from '../kb-fs/locking-filesystem.js';
9
+ import { branchForWorkspaceId } from '../../shared/workspace-id.js';
10
10
  import '../auth/auth.middleware.js';
11
11
 
12
12
  function toHttpError(
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import type { FileDiffPayload, PendingChange, ReviewSession, ChangeKind } from '@bevel-software/platform-shared';
4
4
  import type { IDiffService } from './diff.interface.js';
5
5
  import type { WorkspaceService } from '../workspace/workspace.service.js';
6
- import type { WorkspaceMutex } from '../workflow/git/mutex.js';
6
+ import type { WorkspaceMutex } from '../kb-fs/mutex.js';
7
7
  import { BevelIgnoreStack } from '../workspace/bevel-ignore.js';
8
8
  import { isDiffable } from './diff.config.js';
9
9
  import { assertWithinDirectory } from './diff-paths.js';
@@ -4,7 +4,7 @@ import {
4
4
  assertValidRelativePath,
5
5
  isProtectedBranch,
6
6
  } from '../branch-name.js';
7
- import { BranchNameError, WorkflowValidationError } from '../../workflow.errors.js';
7
+ import { BranchNameError, WorkflowValidationError } from '../../../shared/domain-errors.js';
8
8
 
9
9
  describe('assertValidBranchName', () => {
10
10
  it.each([
@@ -5,7 +5,7 @@ import os from 'node:os';
5
5
  import type { AuthUser, IWorkflowService } from '@bevel-software/platform-shared';
6
6
  import { LocalFilesystem } from '@mastra/core/workspace';
7
7
  import { LockingFilesystem } from '../locking-filesystem.js';
8
- import { PushNeedsAgentResolutionError } from '../workflow.errors.js';
8
+ import { PushNeedsAgentResolutionError } from '../../../shared/domain-errors.js';
9
9
 
10
10
  const USER: AuthUser = {
11
11
  id: 'user-1',
@@ -1,4 +1,4 @@
1
- import { BranchNameError, WorkflowValidationError } from '../workflow.errors.js';
1
+ import { BranchNameError, WorkflowValidationError } from '../../shared/domain-errors.js';
2
2
 
3
3
  // Single source of truth for the protected-branch list lives in `@bevel-software/platform-shared` so
4
4
  // the backend guard and the frontend banner/disabling logic can't drift apart.
@@ -42,9 +42,9 @@ import {
42
42
  type WriteOptions,
43
43
  } from '@mastra/core/workspace';
44
44
  import type { AuthUser, Change, IWorkflowService } from '@bevel-software/platform-shared';
45
- import { PushNeedsAgentResolutionError } from './workflow.errors.js';
45
+ import { PushNeedsAgentResolutionError } from '../../shared/domain-errors.js';
46
46
  import type { FileChangeNotifier } from './file-change-notifier.js';
47
- import type { CreationGrantPlan, ICreatorAccess } from '../access/creator-access.js';
47
+ import type { CreationGrantPlan, ICreatorAccess } from '../access-model/creator.js';
48
48
 
49
49
  /** How many times to retry a contended acquire before giving up. */
50
50
  const ACQUIRE_RETRY_ATTEMPTS = 3;
@@ -6,10 +6,8 @@ import {
6
6
  type ChangeRequest,
7
7
  type IWorkflowService,
8
8
  } from '@bevel-software/platform-shared';
9
- import {
10
- workspaceIdForBranch,
11
- type WorkspaceService,
12
- } from '../../workspace/workspace.service.js';
9
+ import { type WorkspaceService } from '../../workspace/workspace.service.js';
10
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
13
11
  import { JoinRequestsService } from '../join-requests.service.js';
14
12
 
15
13
  /**
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
6
6
  import { PluginIndexService } from '../plugins.service.js';
7
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
7
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
8
8
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
9
9
  import type { IAccessControl } from '../../access/access-control.interface.js';
10
10
  import type { ISkillService, SkillSummary } from '../../skills/skills.contract.js';
@@ -8,7 +8,7 @@ import { describe, it, expect, afterEach, vi } from 'vitest';
8
8
 
9
9
  import { DEFAULT_BRANCH, joinBranchFor } from '@bevel-software/platform-shared';
10
10
  import type { ChangeRequest, IWorkflowService } from '@bevel-software/platform-shared';
11
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
11
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
12
12
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
13
13
  import type { IAccessControl } from '../../access/access-control.interface.js';
14
14
  import type { ISkillService, SkillSummary } from '../../skills/skills.contract.js';
@@ -3,7 +3,7 @@ import {
3
3
  parseAccessFile,
4
4
  type ParsedEntry,
5
5
  type Verb,
6
- } from '../access/access-control.service.js';
6
+ } from '../access-model/access-grammar.js';
7
7
 
8
8
  /**
9
9
  * What a join branch is PROPOSING, relative to the default branch.
@@ -5,7 +5,8 @@ import {
5
5
  type ChangeRequest,
6
6
  type IWorkflowService,
7
7
  } from '@bevel-software/platform-shared';
8
- import { workspaceIdForBranch, type WorkspaceService } from '../workspace/workspace.service.js';
8
+ import { type WorkspaceService } from '../workspace/workspace.service.js';
9
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
9
10
  import { pendingProposals, type JoinProposal } from './join-proposals.js';
10
11
 
11
12
  /** One open join change request, with what it still proposes. */
@@ -47,9 +47,9 @@ import {
47
47
  } from '@bevel-software/platform-shared';
48
48
  import type { WorkspaceService } from '../workspace/workspace.service.js';
49
49
  import type { IAccessControl } from '../access/access-control.interface.js';
50
- import { creatorPrincipal } from '../access/creator-access.js';
51
- import { spliceGrant } from '../access/access-splice.js';
52
- import { WorkspaceMutex } from '../workflow/git/mutex.js';
50
+ import { creatorPrincipal } from '../access-model/creator.js';
51
+ import { spliceGrant } from '../access-model/access-splice.js';
52
+ import { WorkspaceMutex } from '../kb-fs/mutex.js';
53
53
 
54
54
  /** Commit machinery the provision rides — the pending-commit pipeline, run inline. */
55
55
  export interface ProvisionCommitDriver {
@@ -8,8 +8,8 @@ import {
8
8
  type IWorkflowService,
9
9
  } from '@bevel-software/platform-shared';
10
10
  import type { IAccessControl } from '../access/access-control.interface.js';
11
- import { spliceGrant } from '../access/access-splice.js';
12
- import { WorkflowDomainError } from '../workflow/workflow.errors.js';
11
+ import { spliceGrant } from '../access-model/access-splice.js';
12
+ import { WorkflowDomainError } from '../../shared/domain-errors.js';
13
13
  import type { WorkspaceService } from '../workspace/workspace.service.js';
14
14
  import { pluginsWorkspaceId } from './plugins.service.js';
15
15
  import { PluginProvisionError, type PluginProvisionService } from './plugin-provision.service.js';
@@ -8,7 +8,7 @@ import {
8
8
  isPersonalPluginFolder,
9
9
  } from '@bevel-software/platform-shared';
10
10
  import type { WorkspaceService } from '../workspace/workspace.service.js';
11
- import { workspaceIdForBranch } from '../workspace/workspace.service.js';
11
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
12
12
  import type { IAccessControl } from '../access/access-control.interface.js';
13
13
  import type { ISkillService } from '../skills/skills.contract.js';
14
14
  import type { IToolManualService } from '../tool-manuals/tool-manuals.contract.js';
@@ -12,7 +12,7 @@ import {
12
12
  import type { IToolManualService, ToolManualSummary, ToolVariable } from '../tool-manuals/tool-manuals.contract.js';
13
13
  import { utcpNamespacedKey } from '../../shared/utcp-namespace.js';
14
14
  import type { IAccessControl } from '../access/access-control.interface.js';
15
- import { workspaceIdForBranch } from '../workspace/workspace.service.js';
15
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
16
16
  import '../auth/auth.middleware.js'; // Express Request augmentation (req.userId / req.userEmail)
17
17
 
18
18
  export interface SecretsVaultRoutesDeps {
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
6
6
  import { SkillService } from '../skills.service.js';
7
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
7
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
8
8
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
9
9
  import type { IAccessControl } from '../../access/access-control.interface.js';
10
10
  import { readFile as fsReadFile } from 'node:fs/promises';
@@ -4,7 +4,8 @@ import {
4
4
  type ChangeRequest,
5
5
  type IWorkflowService,
6
6
  } from '@bevel-software/platform-shared';
7
- import { workspaceIdForBranch, type WorkspaceService } from '../workspace/workspace.service.js';
7
+ import { type WorkspaceService } from '../workspace/workspace.service.js';
8
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
8
9
  import type { IAccessControl } from '../access/access-control.interface.js';
9
10
  import { hashEmail } from '../../shared/hash-email.js';
10
11
  import { resolveDeclaredId } from '../../shared/frontmatter-id.js';
@@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
3
3
  import { parseDocument } from 'yaml';
4
4
  import { DEFAULT_BRANCH, PLUGINS_DIR } from '@bevel-software/platform-shared';
5
5
  import type { WorkspaceService } from '../workspace/workspace.service.js';
6
- import { workspaceIdForBranch } from '../workspace/workspace.service.js';
6
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
7
7
  import type { IAccessControl } from '../access/access-control.interface.js';
8
8
  import { extractFrontmatter, resolveDeclaredId, dedupeById } from '../../shared/frontmatter-id.js';
9
9
  import { walkFiles } from '../../shared/fs-walk.js';
@@ -11,6 +11,7 @@ import { registerWorkspaceTools } from '../../workspace/workspace.tools.js';
11
11
  import { RoutineWritePolicyService } from '../../workspace/routine-write-policy.js';
12
12
  import { WorkflowHooks } from '../../workflow/workflow-hooks.js';
13
13
  import { SpillStore } from '../../workspace/spill-store.js';
14
+ import { DocExtractService } from '../../workspace/file-readers/doc-extract.service.js';
14
15
 
15
16
  const WS = 'target-company-state';
16
17
  let recorded: unknown[][] = [];
@@ -48,7 +49,7 @@ async function start(): Promise<string> {
48
49
  // kb (citation) tools alongside the workspace tools. Those registrations —
49
50
  // and their web_search / submit_feedback / cite_kb_node cases — moved to
50
51
  // the enterprise repo with their modules; core registers only core tools.
51
- registerWorkspaceTools(registry, router, toolAuth, th, new SpillStore('/tmp/bevel-test-spills'), accessControl, 'knowledge-base', {
52
+ registerWorkspaceTools(registry, router, toolAuth, th, new SpillStore('/tmp/bevel-test-spills'), new DocExtractService('/tmp/bevel-test-doc-extract'), accessControl, 'knowledge-base', {
52
53
  service: {} as never,
53
54
  enabled: false, // ontology boundary not under test here
54
55
  kbDirName: 'knowledge-base',
@@ -1,10 +1,11 @@
1
1
  import { LocalFilesystem } from '@mastra/core/workspace';
2
2
  import type { IWorkflowService } from '@bevel-software/platform-shared';
3
- import { LockingFilesystem } from '../workflow/locking-filesystem.js';
4
- import { ReadOnlyFilesystem } from '../workflow/read-only-filesystem.js';
5
- import { makeRolesYamlWriteValidator } from '../access/roles-yaml-guard.js';
6
- import type { ICreatorAccess } from '../access/creator-access.js';
7
- import { branchForWorkspaceId, type WorkspaceService } from '../workspace/workspace.service.js';
3
+ import { LockingFilesystem } from '../kb-fs/locking-filesystem.js';
4
+ import { ReadOnlyFilesystem } from '../kb-fs/read-only-filesystem.js';
5
+ import { makeRolesYamlWriteValidator } from '../access-model/roles-yaml-guard.js';
6
+ import type { ICreatorAccess } from '../access-model/creator.js';
7
+ import type { WorkspaceService } from '../workspace/workspace.service.js';
8
+ import { branchForWorkspaceId } from '../../shared/workspace-id.js';
8
9
  import type { WorkflowEventBus } from '../workflow/event-bus.js';
9
10
  import type { AuthService } from '../auth/auth.service.js';
10
11
  import { ToolError, type ToolContext } from './tool.contract.js';
@@ -3,7 +3,7 @@ import fs from 'node:fs/promises';
3
3
  import os from 'node:os';
4
4
  import path from 'node:path';
5
5
  import { DEFAULT_BRANCH, type AuthUser } from '@bevel-software/platform-shared';
6
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
6
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
7
7
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
8
8
  import type { IAccessControl } from '../../access/access-control.interface.js';
9
9
  import type { IToolManualService, ToolManualSummary } from '../tool-manuals.contract.js';
@@ -6,7 +6,7 @@ import express from 'express';
6
6
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
7
7
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
8
8
  import { createToolManualsAgentRoutes } from '../tool-manuals.routes.js';
9
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
9
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
10
10
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
11
11
  import type { IAccessControl } from '../../access/access-control.interface.js';
12
12
  import type { IToolManualService } from '../tool-manuals.contract.js';
@@ -7,7 +7,7 @@ import { afterEach, describe, expect, it, test, vi } from 'vitest';
7
7
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
8
8
  import { createToolManualsBrowserRoutes } from '../tool-manuals.routes.js';
9
9
  import { ToolManualService } from '../tool-manuals.service.js';
10
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
10
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
11
11
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
12
12
  import type { IAccessControl } from '../../access/access-control.interface.js';
13
13
  import type { IToolManualService, ToolManualDetail } from '../tool-manuals.contract.js';
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
6
6
  import { ToolManualService, type McpAuthDiscoveryPort } from '../tool-manuals.service.js';
7
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
7
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
8
8
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
9
9
  import type { IAccessControl } from '../../access/access-control.interface.js';
10
10
 
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os';
4
4
  import { join } from 'node:path';
5
5
  import { DEFAULT_BRANCH } from '@bevel-software/platform-shared';
6
6
  import { ToolManualService } from '../tool-manuals.service.js';
7
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
7
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
8
8
  import type { WorkspaceService } from '../../workspace/workspace.service.js';
9
9
  import type { IAccessControl } from '../../access/access-control.interface.js';
10
10
 
@@ -8,7 +8,8 @@ import {
8
8
  PLUGIN_MCP_FILE,
9
9
  type AuthUser,
10
10
  } from '@bevel-software/platform-shared';
11
- import { workspaceIdForBranch, type WorkspaceService } from '../workspace/workspace.service.js';
11
+ import type { WorkspaceService } from '../workspace/workspace.service.js';
12
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
12
13
  import { validatedVariables } from './mcp-json-discovery.js';
13
14
  import { assertSafeFetchUrl } from '../../shared/ssrf.js';
14
15
  import { containsVariableReference, findReservedVariableRef } from '../../shared/variable-refs.js';
@@ -3,7 +3,8 @@ import path from 'node:path';
3
3
  import fs from 'node:fs/promises';
4
4
  import AdmZip from 'adm-zip';
5
5
  import { DEFAULT_BRANCH, PLUGINS_DIR } from '@bevel-software/platform-shared';
6
- import { workspaceIdForBranch, type WorkspaceService } from '../workspace/workspace.service.js';
6
+ import type { WorkspaceService } from '../workspace/workspace.service.js';
7
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
7
8
  import type { IAccessControl } from '../access/access-control.interface.js';
8
9
  import '@utcp/http'; // side effect: register the 'http' call-template type
9
10
  import { CallTemplateSerializer, type CallTemplate } from '@utcp/sdk';
@@ -17,7 +17,7 @@ import {
17
17
  } from '@bevel-software/platform-shared';
18
18
  import { descriptorsFromMcpJson } from './mcp-json-discovery.js';
19
19
  import type { WorkspaceService } from '../workspace/workspace.service.js';
20
- import { workspaceIdForBranch } from '../workspace/workspace.service.js';
20
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
21
21
  import type { IAccessControl } from '../access/access-control.interface.js';
22
22
  import { assertSafeFetchUrl } from '../../shared/ssrf.js';
23
23
  import { RESERVED_VARIABLE_NAMES, findReservedVariableRef } from '../../shared/variable-refs.js';
@@ -5,7 +5,7 @@ import type { ToolContext } from '../tool-helpers/tool.contract.js';
5
5
  import { toolDef } from '../tool-helpers/tool-def.js';
6
6
  import type { ToolHandlerFactory } from '../tool-helpers/tool-handler.js';
7
7
  import type { IAccessControl } from '../access/access-control.interface.js';
8
- import { workspaceIdForBranch } from '../workspace/workspace.service.js';
8
+ import { workspaceIdForBranch } from '../../shared/workspace-id.js';
9
9
  import { utcpNamespacedKey } from '../../shared/utcp-namespace.js';
10
10
  import type { IToolManualService } from './tool-manuals.contract.js';
11
11
 
@@ -12,7 +12,7 @@ import { FileLockService } from '../file-lock.service.js';
12
12
  import { PendingCommitsService } from '../pending-commits.service.js';
13
13
  import { WorkflowService } from '../workflow.service.js';
14
14
  import type { Database } from '../../database/connection.js';
15
- import { RolesYamlPreservationError } from '../workflow.errors.js';
15
+ import { RolesYamlPreservationError } from '../../../shared/domain-errors.js';
16
16
 
17
17
  /**
18
18
  * Focused tests for the roles.yaml-preservation guard inside
@@ -10,7 +10,7 @@ import { PendingCommitsService } from '../pending-commits.service.js';
10
10
  import { WorkflowEventBus } from '../event-bus.js';
11
11
  import { WorkflowService } from '../workflow.service.js';
12
12
  import type { Database } from '../../database/connection.js';
13
- import { WorkflowValidationError } from '../workflow.errors.js';
13
+ import { WorkflowValidationError } from '../../../shared/domain-errors.js';
14
14
 
15
15
  /**
16
16
  * `commitFileWhileLocked` (autosave checkpoint) has subtler semantics
@@ -12,7 +12,7 @@ import type { IAccessControl } from '../../access/access-control.interface.js';
12
12
  import { FileLockService } from '../file-lock.service.js';
13
13
  import { PendingCommitsService } from '../pending-commits.service.js';
14
14
  import { WorkflowService } from '../workflow.service.js';
15
- import { PullRebaseConflictError } from '../workflow.errors.js';
15
+ import { PullRebaseConflictError } from '../../../shared/domain-errors.js';
16
16
  import type { Database } from '../../database/connection.js';
17
17
 
18
18
  // `deleteBranch`'s open-request guard is the only DB touch these tests
@@ -14,7 +14,7 @@ import {
14
14
  PullRebaseConflictError,
15
15
  PushNeedsAgentResolutionError,
16
16
  WorkflowValidationError,
17
- } from '../workflow.errors.js';
17
+ } from '../../../shared/domain-errors.js';
18
18
 
19
19
  /**
20
20
  * Two surfaces under test:
@@ -5,7 +5,7 @@ import { ToolError, type ToolContext, type ToolHandler } from '../../tool-helper
5
5
  import { toolDef, withBranchInput } from '../../tool-helpers/tool-def.js';
6
6
  import type { ToolHandlerFactory } from '../../tool-helpers/tool-handler.js';
7
7
  import { requireInternalSource } from '../../tool-auth/tool-auth.middleware.js';
8
- import { workspaceIdForBranch } from '../../workspace/workspace.service.js';
8
+ import { workspaceIdForBranch } from '../../../shared/workspace-id.js';
9
9
 
10
10
  // A function, not a constant: the branch model is applied during boot, and a
11
11
  // module-scope capture would freeze this at the empty set that exists before it.