@braidhq/server 0.1.0 → 0.2.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 (385) hide show
  1. package/README.md +134 -106
  2. package/dist/app.d.ts +7 -15
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +72 -45
  5. package/dist/app.js.map +1 -1
  6. package/dist/authMode.d.ts +39 -0
  7. package/dist/authMode.d.ts.map +1 -0
  8. package/dist/authMode.js +50 -0
  9. package/dist/authMode.js.map +1 -0
  10. package/dist/composeApp.d.ts +79 -0
  11. package/dist/composeApp.d.ts.map +1 -0
  12. package/dist/composeApp.js +136 -0
  13. package/dist/composeApp.js.map +1 -0
  14. package/dist/composeFsApp.d.ts +27 -0
  15. package/dist/composeFsApp.d.ts.map +1 -0
  16. package/dist/{composeFs.js → composeFsApp.js} +118 -125
  17. package/dist/composeFsApp.js.map +1 -0
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/_shared/env.d.ts +10 -0
  23. package/dist/infrastructure/_shared/env.d.ts.map +1 -0
  24. package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
  25. package/dist/infrastructure/_shared/env.js.map +1 -0
  26. package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
  27. package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
  28. package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
  29. package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
  30. package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
  31. package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
  32. package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
  33. package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
  34. package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
  35. package/dist/infrastructure/_shared/paths.js.map +1 -0
  36. package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
  37. package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
  38. package/dist/infrastructure/auth/AccessPolicy.js +35 -42
  39. package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
  40. package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
  41. package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
  42. package/dist/infrastructure/auth/SessionStore.js +15 -18
  43. package/dist/infrastructure/auth/SessionStore.js.map +1 -1
  44. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +79 -0
  45. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
  46. package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +1 -1
  47. package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
  48. package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
  49. package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
  50. package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
  51. package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
  52. package/dist/infrastructure/history/commitMessage.js +90 -0
  53. package/dist/infrastructure/history/commitMessage.js.map +1 -0
  54. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
  55. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
  56. package/dist/infrastructure/{fs/FsClarifyTicketRepository.js → hitl/FsClarificationRepository.js} +15 -15
  57. package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
  58. package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
  59. package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +7 -8
  60. package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
  61. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
  62. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
  63. package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
  64. package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
  65. package/dist/infrastructure/model/FsModelSerializer.d.ts +96 -0
  66. package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
  67. package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
  68. package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
  69. package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
  70. package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
  71. package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
  72. package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
  73. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
  74. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
  75. package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
  76. package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
  77. package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
  78. package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
  79. package/dist/infrastructure/secrets/SecretStore.js +4 -4
  80. package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
  81. package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
  82. package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
  83. package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
  84. package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
  85. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
  86. package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
  87. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
  88. package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
  89. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
  90. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
  91. package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
  92. package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
  93. package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
  94. package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
  95. package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
  96. package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
  97. package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
  98. package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
  99. package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
  100. package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
  101. package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
  102. package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
  103. package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
  104. package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
  105. package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
  106. package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
  107. package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
  108. package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
  109. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
  110. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
  111. package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
  112. package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
  113. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
  114. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
  115. package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
  116. package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
  117. package/dist/infrastructure/{fs → source}/intentScan.d.ts +4 -0
  118. package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
  119. package/dist/infrastructure/{fs → source}/intentScan.js +18 -16
  120. package/dist/infrastructure/source/intentScan.js.map +1 -0
  121. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
  122. package/dist/infrastructure/users/UserDirectoryFromRegistry.js +2 -2
  123. package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
  124. package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
  125. package/dist/infrastructure/users/UserRegistryFile.js +6 -8
  126. package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
  127. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
  128. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
  129. package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
  130. package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
  131. package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
  132. package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
  133. package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
  134. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
  135. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
  136. package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
  137. package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
  138. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
  139. package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
  140. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
  141. package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
  142. package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
  143. package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
  144. package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
  145. package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
  146. package/dist/middleware/auth.d.ts +27 -17
  147. package/dist/middleware/auth.d.ts.map +1 -1
  148. package/dist/middleware/auth.js +59 -53
  149. package/dist/middleware/auth.js.map +1 -1
  150. package/dist/middleware/cors.d.ts.map +1 -1
  151. package/dist/middleware/cors.js +4 -1
  152. package/dist/middleware/cors.js.map +1 -1
  153. package/dist/middleware/error.d.ts.map +1 -1
  154. package/dist/middleware/error.js +15 -13
  155. package/dist/middleware/error.js.map +1 -1
  156. package/dist/middleware/workspaceAccess.d.ts +23 -19
  157. package/dist/middleware/workspaceAccess.d.ts.map +1 -1
  158. package/dist/middleware/workspaceAccess.js +31 -26
  159. package/dist/middleware/workspaceAccess.js.map +1 -1
  160. package/dist/policy/CapabilityCheck.d.ts +5 -5
  161. package/dist/policy/PermissionRegistry.d.ts +11 -9
  162. package/dist/policy/PermissionRegistry.d.ts.map +1 -1
  163. package/dist/policy/PermissionRegistry.js +10 -8
  164. package/dist/policy/PermissionRegistry.js.map +1 -1
  165. package/dist/policy/ViewerContext.d.ts +13 -11
  166. package/dist/policy/ViewerContext.d.ts.map +1 -1
  167. package/dist/policy/checks.d.ts +9 -9
  168. package/dist/policy/checks.d.ts.map +1 -1
  169. package/dist/policy/checks.js +14 -11
  170. package/dist/policy/checks.js.map +1 -1
  171. package/dist/policy/defaultRegistry.d.ts +3 -4
  172. package/dist/policy/defaultRegistry.d.ts.map +1 -1
  173. package/dist/policy/defaultRegistry.js +3 -4
  174. package/dist/policy/defaultRegistry.js.map +1 -1
  175. package/dist/policy/index.d.ts +2 -2
  176. package/dist/policy/index.d.ts.map +1 -1
  177. package/dist/policy/index.js +1 -1
  178. package/dist/policy/index.js.map +1 -1
  179. package/dist/policy/resolveViewer.d.ts +9 -9
  180. package/dist/policy/resolveViewer.js +9 -9
  181. package/dist/routes/_shared.d.ts +93 -153
  182. package/dist/routes/_shared.d.ts.map +1 -1
  183. package/dist/routes/_shared.js +9 -5
  184. package/dist/routes/_shared.js.map +1 -1
  185. package/dist/routes/admin.d.ts +1 -1
  186. package/dist/routes/admin.d.ts.map +1 -1
  187. package/dist/routes/admin.js +13 -12
  188. package/dist/routes/admin.js.map +1 -1
  189. package/dist/routes/auth.d.ts +12 -10
  190. package/dist/routes/auth.d.ts.map +1 -1
  191. package/dist/routes/auth.js +32 -34
  192. package/dist/routes/auth.js.map +1 -1
  193. package/dist/routes/clarifications.d.ts +8 -0
  194. package/dist/routes/clarifications.d.ts.map +1 -0
  195. package/dist/routes/clarifications.js +243 -0
  196. package/dist/routes/clarifications.js.map +1 -0
  197. package/dist/routes/edges.d.ts.map +1 -1
  198. package/dist/routes/edges.js +2 -6
  199. package/dist/routes/edges.js.map +1 -1
  200. package/dist/routes/history.d.ts.map +1 -1
  201. package/dist/routes/history.js +12 -10
  202. package/dist/routes/history.js.map +1 -1
  203. package/dist/routes/nodes.d.ts.map +1 -1
  204. package/dist/routes/nodes.js +4 -8
  205. package/dist/routes/nodes.js.map +1 -1
  206. package/dist/routes/oauth.d.ts +6 -7
  207. package/dist/routes/oauth.d.ts.map +1 -1
  208. package/dist/routes/oauth.js +6 -7
  209. package/dist/routes/oauth.js.map +1 -1
  210. package/dist/routes/proposals.d.ts +2 -2
  211. package/dist/routes/proposals.d.ts.map +1 -1
  212. package/dist/routes/proposals.js +30 -28
  213. package/dist/routes/proposals.js.map +1 -1
  214. package/dist/routes/reactorCycles.d.ts +7 -0
  215. package/dist/routes/reactorCycles.d.ts.map +1 -0
  216. package/dist/routes/reactorCycles.js +60 -0
  217. package/dist/routes/reactorCycles.js.map +1 -0
  218. package/dist/routes/runs.d.ts.map +1 -1
  219. package/dist/routes/runs.js +22 -19
  220. package/dist/routes/runs.js.map +1 -1
  221. package/dist/routes/skillInputOptions.d.ts +2 -2
  222. package/dist/routes/skillInputOptions.d.ts.map +1 -1
  223. package/dist/routes/skillInputOptions.js +43 -45
  224. package/dist/routes/skillInputOptions.js.map +1 -1
  225. package/dist/routes/skills.d.ts +19 -1
  226. package/dist/routes/skills.d.ts.map +1 -1
  227. package/dist/routes/skills.js +139 -7
  228. package/dist/routes/skills.js.map +1 -1
  229. package/dist/routes/sourceLoaders.d.ts.map +1 -1
  230. package/dist/routes/sourceLoaders.js +1 -0
  231. package/dist/routes/sourceLoaders.js.map +1 -1
  232. package/dist/routes/sourceUnitObservations.d.ts +20 -0
  233. package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
  234. package/dist/routes/sourceUnitObservations.js +80 -0
  235. package/dist/routes/sourceUnitObservations.js.map +1 -0
  236. package/dist/routes/sourceWebhooks.d.ts +26 -0
  237. package/dist/routes/sourceWebhooks.d.ts.map +1 -0
  238. package/dist/routes/sourceWebhooks.js +301 -0
  239. package/dist/routes/sourceWebhooks.js.map +1 -0
  240. package/dist/routes/users.d.ts +0 -2
  241. package/dist/routes/users.d.ts.map +1 -1
  242. package/dist/routes/users.js +15 -33
  243. package/dist/routes/users.js.map +1 -1
  244. package/dist/routes/workspaceEvents.d.ts +5 -4
  245. package/dist/routes/workspaceEvents.d.ts.map +1 -1
  246. package/dist/routes/workspaceEvents.js +7 -6
  247. package/dist/routes/workspaceEvents.js.map +1 -1
  248. package/dist/routes/workspaceMembers.d.ts +1 -1
  249. package/dist/routes/workspaceMembers.d.ts.map +1 -1
  250. package/dist/routes/workspaceMembers.js +2 -2
  251. package/dist/routes/workspaceMembers.js.map +1 -1
  252. package/dist/routes/workspaces.d.ts +21 -10
  253. package/dist/routes/workspaces.d.ts.map +1 -1
  254. package/dist/routes/workspaces.js +97 -69
  255. package/dist/routes/workspaces.js.map +1 -1
  256. package/dist/server.js +6 -70
  257. package/dist/server.js.map +1 -1
  258. package/dist/startServer.d.ts +17 -0
  259. package/dist/startServer.d.ts.map +1 -0
  260. package/dist/startServer.js +81 -0
  261. package/dist/startServer.js.map +1 -0
  262. package/dist/startup.d.ts +28 -0
  263. package/dist/startup.d.ts.map +1 -0
  264. package/dist/startup.js +94 -0
  265. package/dist/startup.js.map +1 -0
  266. package/package.json +9 -9
  267. package/dist/composeFs.d.ts +0 -55
  268. package/dist/composeFs.d.ts.map +0 -1
  269. package/dist/composeFs.js.map +0 -1
  270. package/dist/composition.d.ts +0 -133
  271. package/dist/composition.d.ts.map +0 -1
  272. package/dist/composition.js +0 -113
  273. package/dist/composition.js.map +0 -1
  274. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
  275. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
  276. package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
  277. package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
  278. package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
  279. package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
  280. package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
  281. package/dist/infrastructure/agent/mcpConfig.js +0 -55
  282. package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
  283. package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
  284. package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
  285. package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
  286. package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
  287. package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
  288. package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
  289. package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
  290. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
  291. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
  292. package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
  293. package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
  294. package/dist/infrastructure/env.d.ts +0 -11
  295. package/dist/infrastructure/env.d.ts.map +0 -1
  296. package/dist/infrastructure/env.js.map +0 -1
  297. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
  298. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
  299. package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
  300. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
  301. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
  302. package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
  303. package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
  304. package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
  305. package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
  306. package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
  307. package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
  308. package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
  309. package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
  310. package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
  311. package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
  312. package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
  313. package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
  314. package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
  315. package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
  316. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
  317. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
  318. package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
  319. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
  320. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
  321. package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
  322. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
  323. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
  324. package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
  325. package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
  326. package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
  327. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
  328. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
  329. package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
  330. package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
  331. package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
  332. package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
  333. package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
  334. package/dist/infrastructure/fs/frontmatter.js.map +0 -1
  335. package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
  336. package/dist/infrastructure/fs/intentScan.js.map +0 -1
  337. package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
  338. package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
  339. package/dist/infrastructure/fs/paths.d.ts.map +0 -1
  340. package/dist/infrastructure/fs/paths.js.map +0 -1
  341. package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
  342. package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
  343. package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
  344. package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
  345. package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
  346. package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
  347. package/dist/infrastructure/git/commitMessage.js +0 -71
  348. package/dist/infrastructure/git/commitMessage.js.map +0 -1
  349. package/dist/infrastructure/orphanReaper.d.ts +0 -18
  350. package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
  351. package/dist/infrastructure/orphanReaper.js.map +0 -1
  352. package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
  353. package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
  354. package/dist/infrastructure/users/ensureLocalUser.js +0 -38
  355. package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
  356. package/dist/middleware/requireAdmin.d.ts +0 -10
  357. package/dist/middleware/requireAdmin.d.ts.map +0 -1
  358. package/dist/middleware/requireAdmin.js +0 -24
  359. package/dist/middleware/requireAdmin.js.map +0 -1
  360. package/dist/middleware/userId.d.ts +0 -16
  361. package/dist/middleware/userId.d.ts.map +0 -1
  362. package/dist/middleware/userId.js +0 -27
  363. package/dist/middleware/userId.js.map +0 -1
  364. package/dist/policy/Capability.d.ts +0 -12
  365. package/dist/policy/Capability.d.ts.map +0 -1
  366. package/dist/policy/Capability.js +0 -31
  367. package/dist/policy/Capability.js.map +0 -1
  368. package/dist/routes/clarify.d.ts +0 -9
  369. package/dist/routes/clarify.d.ts.map +0 -1
  370. package/dist/routes/clarify.js +0 -274
  371. package/dist/routes/clarify.js.map +0 -1
  372. package/dist/routes/decisions.d.ts +0 -7
  373. package/dist/routes/decisions.d.ts.map +0 -1
  374. package/dist/routes/decisions.js +0 -68
  375. package/dist/routes/decisions.js.map +0 -1
  376. package/dist/routes/sourceUnitStates.d.ts +0 -7
  377. package/dist/routes/sourceUnitStates.d.ts.map +0 -1
  378. package/dist/routes/sourceUnitStates.js +0 -45
  379. package/dist/routes/sourceUnitStates.js.map +0 -1
  380. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
  381. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
  382. /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
  383. /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
  384. /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
  385. /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
package/README.md CHANGED
@@ -1,136 +1,164 @@
1
1
  # @braidhq/server
2
2
 
3
- REST + SSE server for Braid. Hono-based, with an OpenAPI 3 spec
4
- exposed at `GET /openapi.json` for any consumer that wants typed
5
- access to the graph operations.
3
+ Braid keeps a product's intent and its code aligned in one knowledge graph. `@braidhq/server` is the process that runs it. It wires core's ports to real filesystem, git, and vendor adapters, exposes the graph over HTTP, and drives the agents that fill it.
6
4
 
7
- ## openapi-mcp-gateway Integration
5
+ ## Role
8
6
 
9
- Skills shipped with `@braidhq/core` and `@braidhq/ontology-ddd` invoke
10
- the server through MCP tools, not curl. The wiring runs the gateway
11
- as a **per-skill stdio child of claude** — no long-running HTTP
12
- server, gateway lifecycle tracks the skill run automatically.
7
+ Server is the composition root and the presentation layer. It turns the framework into a running application.
13
8
 
14
- ```
15
- ┌──────────────────┐ /openapi.json ┌─────────────────────┐
16
- @braidhq/server │ ◀───── HTTP ────── openapi-mcp-gateway │
17
- │ (this package) │ ────── REST ────▶ │ (uvx, stdio child) │
18
- └──────────────────┘ └─────────────────────┘
19
- ▲ stdin/stdout
20
- │ MCP
21
- ┌─────────────────────┐
22
- │ spawned claude │
23
- │ subprocess (skill) │
24
- └─────────────────────┘
25
- ```
9
+ - **The Wiring**: The composition root that binds core's ports to concrete adapters, the one place infrastructure is instantiated.
10
+ - **The Adapters**: Filesystem and git implementations of core's repositories and history, plus the subprocess runner that executes skills.
11
+ - **The API**: A REST and SSE surface built on Hono, one router per resource, with authentication, workspace scoping, and an OpenAPI 3 spec at `GET /openapi.json`.
26
12
 
27
- ### 1. Install `uv` (one-time setup)
13
+ ## Positioning: framework kernel and worldview preset
28
14
 
29
- `openapi-mcp-gateway` is a Python package distributed via PyPI. The
30
- gateway is launched on demand by claude via `uvx` (UV's "run an
31
- ephemeral package" command), so the only thing you have to install
32
- locally is the `uv` runtime itself:
15
+ Braid is worldview-agnostic. The intent-graph engine, workspaces, proposals, HITL review, the reactor, and the authorization policy, knows nothing about software. A worldview supplies the rest: an ontology plus the storage, source loaders, and agent that serve it. The software worldview, a DDD ontology whose sources split into `intent` and `code`, is the default, not a built-in.
33
16
 
34
- ```bash
35
- # macOS
36
- brew install uv
37
- # linux / windows: see https://docs.astral.sh/uv/getting-started/installation/
38
- ```
17
+ Two layers share this package for now.
18
+
19
+ - **Kernel**: `composeApp`, routes, middleware, policy, auth mode, and the generic filesystem infrastructure. Worldview-agnostic. `composeApp` registers no plugin, a caller hands it a `PluginRegistry`. Nothing here imports a concrete ontology, storage, loader, or agent.
20
+ - **Coding preset**: `composeFsApp` assembles the default bundle, Kuzu storage, the DDD ontology, the git, github, and drive loaders, and the claude-code agent, over filesystem persistence. Its default identities live as `DEFAULT_*` constants at the head of the file.
21
+
22
+ A future app, a story world or a research-notes base, reuses the kernel and swaps the preset for its own ontology and adapters. When that second worldview arrives, the coding preset extracts into its own package, `@braidhq/preset-code`, and this package drops its plugin dependencies. Until a second worldview exists that pressure is speculative, so both layers stay here at no cost. The seam is `composeApp`: whatever the kernel reaches without a concrete plugin already belongs to it.
23
+
24
+ ## Structure
39
25
 
40
- The Braid server **preflight-checks for `uv` at boot**. If it's not
41
- found, you'll see:
26
+ The package layers outward from core. Infrastructure implements core's ports, routes expose them, and composition binds the two.
42
27
 
43
28
  ```
44
- [braid] `uv` not found on PATH; the built-in braid-core MCP gateway
45
- will not be available. Install via `brew install uv` or
46
- https://docs.astral.sh/uv/ to enable.
29
+ src/
30
+ ├── server.ts process entry, serves the app
31
+ ├── app.ts builds the Hono app, mounts middleware and routes
32
+ ├── composeApp.ts the worldview-agnostic kernel root
33
+ ├── composeFsApp.ts the coding preset, filesystem and vendor adapters
34
+ ├── startup.ts blocking per-workspace boot steps
35
+ ├── authMode.ts AuthMode strategy, localTrust and authenticated
36
+ ├── routes/ one router per resource
37
+ ├── middleware/ auth, cors, error mapping, workspace scoping
38
+ ├── policy/ authorization rules
39
+ └── infrastructure/ adapters behind core ports, one folder per domain concern
40
+ ├── hitl/ proposal and clarification stores
41
+ ├── workspace/ workspace repository, registry, discovery, PRODUCT.md writer
42
+ ├── skill/ skill registry, run store, subprocess runner and its event stream
43
+ ├── source/ source unit observations, digests, intent listing
44
+ ├── model/ graph serializer
45
+ ├── reactor/ reactor cycle store
46
+ ├── batch/ batch plan store
47
+ ├── history/ GitWorkspaceHistory, commit messages
48
+ ├── users/, auth/, secrets/, oauth/ host services, no core port
49
+ └── _shared/ cross-cutting fs plumbing, paths, json store, frontmatter
47
50
  ```
48
51
 
49
- Skills with `requiredMcpServers: ['braid-core']` will then surface
50
- as not-ready in Studio's sidebar. Other skills keep working.
51
-
52
- ### 2. That's it
53
-
54
- No environment variables to set, no separate gateway process to run.
55
- When Braid spawns a skill, the skill's mcp-config gets a stdio entry:
56
-
57
- ```jsonc
58
- {
59
- "braid-core": {
60
- "type": "stdio",
61
- "command": "uvx",
62
- "args": [
63
- "openapi-mcp-gateway",
64
- "--spec",
65
- "http://127.0.0.1:4321/openapi.json",
66
- "--transport",
67
- "stdio",
68
- "--name",
69
- "braid-core"
70
- ]
71
- }
72
- }
73
- ```
52
+ - **composeApp / composeFsApp**: The kernel root and the coding preset. `composeApp` takes a deps object, registers no plugin, and defaults every unset port to an in-memory adapter. `composeFsApp` builds the filesystem, git, and vendor adapters, registers the default plugin bundle, then hands the result to `composeApp`. Production runs the latter. See Positioning above.
53
+ - **startup**: The two boot passes, `startupBeforeServe` and `startupAfterServe`. See Startup below for the full order.
54
+ - **infrastructure**: The real adapters behind core's ports, grouped by domain concern to mirror `core/domain`, never by storage technology. Each folder owns one aggregate's adapter, so a future SQLite or Postgres store lands beside the filesystem one instead of in a separate `sql/` tree. `hitl/` persists proposals and clarifications, `workspace/` the graph and workspace files, `history/` records every change as a git commit, `skill/` runs a skill as a subprocess and streams its events back. `_shared/` holds the cross-cutting fs plumbing, its underscore marking it as the one folder that is not a domain concern, matching `routes/_shared.ts`. `users/ auth/ secrets/ oauth/` are host services with no core port.
55
+ - **routes**: One `createXxxRouter(deps)` per resource, each taking only the services it needs. Bodies validate through zod, path ids parse through their branded schema.
56
+ - **middleware**: The cross-cutting edge. Auth resolves the user, workspace middleware scopes and authorizes the request, and the error middleware maps `BraidError` subclasses to problem+json status codes.
57
+
58
+ ## Startup
59
+
60
+ The blocking phase runs inside `composeFsApp` before the server accepts a request, in two groups.
74
61
 
75
- claude spawns the gateway, the gateway pulls the spec from the
76
- running Braid server, and the REST surface becomes MCP tools for the
77
- duration of the skill run.
62
+ Provision host identity, who may use this server:
78
63
 
79
- First-time runs take an extra ~1–2 seconds (uvx caches
80
- `openapi-mcp-gateway` under `~/.cache/uv/`). Subsequent runs hit the
81
- cache.
64
+ 1. `authMode.provision` seeds what the deployment's mode needs. Local trust seeds the `local-user` fallback account, authenticated mode syncs the login allowlist to the user roster. See Auth Mode below.
82
65
 
83
- ### 3. Author skills against the MCP tools
66
+ Reconcile workspaces, register then boot each:
84
67
 
85
- Skill prompts call MCP tools by their `operationId`:
68
+ 2. `discoverCanonicalWorkspaces` registers workspaces present on disk but absent from the registry.
69
+ 3. `ensureWorkspaceOwners` gives any ownerless workspace the auth mode's default principal, or throws under authenticated mode where every workspace must have an explicit owner.
70
+ 4. `startupBeforeServe` runs the per-workspace pass. Per workspace it provisions the git repo and store, recovers a batch left running by a killed process, subscribes the reactor when the workspace opts in, and fires a catch-up sync for each loader-backed source.
86
71
 
87
- - `braid_search_nodes(workspaceId, q, type?, status?, limit?, offset?)`
88
- - `braid_get_scope(workspaceId, nodeId, depth)`
89
- - `braid_get_ontology(workspaceId)`
90
- - `braid_submit_proposal(workspaceId, operations, generatedBy, rationale)`
91
- - `braid_submit_clarify(workspaceId, question, candidates)`
92
- - `braid_mark_clarify_applied(workspaceId, clarifyTicketId, status, userId, proposalId?)`
93
- - …and the rest, one per operation in `/openapi.json`.
72
+ After `serve()`, the background phase runs cosmetic recovery that need not finish first, via `startupAfterServe`:
94
73
 
95
- Exact tool names depend on `openapi-mcp-gateway`'s naming convention
96
- (typically `<server-name>_<operationId>` with snake_case
97
- normalisation). Inspect the spec or the gateway's `tools/list`
98
- response to see live names.
74
+ 5. `reapOrphanRuns` marks runs left without a completion, from a killed process, as aborted so the UI does not show them active forever.
99
75
 
100
- ### Pinning the uv binary
76
+ Both passes live in `startup.ts`, `startupBeforeServe` before `serve()` and `startupAfterServe` after. A new blocking per-workspace step is added to `startupBeforeServe`, a new background step to `startupAfterServe`. Provisioning tied to one adapter stays next to that adapter's construction. Source loaders take part without a bespoke step, the sync in step 4 fires for any registered loader.
101
77
 
102
- For reproducibility (e.g. CI environments with multiple Python
103
- toolchains) you can pin a specific `uvx` binary via the
104
- `BRAID_UVX_BIN` env var. composeFs preflight-checks the pinned
105
- binary; if it's not executable, the gateway entry is skipped same as
106
- when `uv` is missing entirely.
78
+ ## Auth Mode
107
79
 
108
- ```bash
109
- export BRAID_UVX_BIN=/opt/homebrew/bin/uvx
80
+ One axis separates a trusted local install from an authenticated remote server, who the implicit user is. Rather than scatter that decision, an `AuthMode` strategy carries it, and the auth and ownership code reads the strategy, never a hardcoded `local-user`.
81
+
82
+ ```mermaid
83
+ classDiagram
84
+ class AuthMode {
85
+ <<interface>>
86
+ +defaultPrincipal: UserId | null
87
+ +requiresAuth: boolean
88
+ +provision(context) Promise
89
+ }
90
+ class localTrust {
91
+ <<const>>
92
+ defaultPrincipal = local-user
93
+ requiresAuth = false
94
+ provision() seeds local-user
95
+ }
96
+ class authenticated {
97
+ <<const>>
98
+ defaultPrincipal = null
99
+ requiresAuth = true
100
+ provision() syncs allowlist
101
+ }
102
+ AuthMode <|.. localTrust
103
+ AuthMode <|.. authenticated
110
104
  ```
111
105
 
112
- ### Forward compatibility (hosted Braid)
106
+ Two consumers read the strategy, neither a hardcoded account. `authMiddleware` resolves the caller, applying the Bearer gate under `requiresAuth` and falling back to `defaultPrincipal` when one is present. `ensureWorkspaceOwners` gives an ownerless workspace the principal, or throws when there is none.
107
+
108
+ `composeFsApp` picks the mode from `BRAID_LOCAL_TRUST`, local trust by default. Adding a mode, a service account or an SSO-only deployment, is a new `AuthMode`, with no change to the middleware, the ownership code, or boot.
109
+
110
+ ## Authorization
111
+
112
+ Every gated action is a capability. The server is the authoritative check, and Studio mirrors the same list to grey out affordances it cannot use. The authoritative logic is `packages/server/src/policy/checks.ts`, the matrix below is a readable mirror of it.
113
+
114
+ ### Where the decision happens
115
+
116
+ A request's permission is decided in three steps, all under `policy/`.
117
+
118
+ 1. `resolveViewer(user, member)` builds a `ViewerContext` once per request, the caller's `effectiveRole` in this workspace. It is the sole place a server admin short-circuits to an `owner` role.
119
+ 2. `workspaceAccessMiddleware` runs `resolveViewer`, stamps the viewer on the request, and rejects an outright outsider. `requirePermission(cap)` and the server-scope `requireServerCapability(cap)` are the route gates that read it.
120
+ 3. `PermissionRegistry.can(capability, viewer)` finds the capability's check and evaluates it against the viewer. An unregistered capability denies by default.
121
+
122
+ Each capability owns one pure check in `checks.ts`, a stateless const object. Plugins register their own checks on the same registry, so adding a capability never edits an existing one.
123
+
124
+ ### Capability matrix
125
+
126
+ Workspace roles resolve from membership. `admin` is the server role, which short-circuits to an `owner` effectiveRole in any workspace, so an admin holds every workspace capability below.
127
+
128
+ | Capability | owner | maintainer | member | Notes |
129
+ |---|:--:|:--:|:--:|---|
130
+ | `server.admin` | n/a | n/a | n/a | Server role `admin` only. Gates `/admin`, read from the server role, not `effectiveRole`, since a workspace owner also resolves to `owner`. |
131
+ | `workspace.create` | n/a | n/a | n/a | Server scope, resolved with no member, so only a server admin passes. |
132
+ | `workspace.read` | yes | yes | yes | Any member. |
133
+ | `workspace.write` | yes | | | Owner only. |
134
+ | `proposal.read` | yes | yes | | Owner or maintainer. |
135
+ | `proposal.write` | yes | yes | | Owner or maintainer. |
136
+ | `clarification.read` | yes | yes | | Owner or maintainer. |
137
+ | `clarification.write` | yes | yes | | Owner or maintainer. |
138
+ | `history.write` | yes | | | Owner only. |
139
+ | `skill.run` | yes | maybe | maybe | Owner always. Otherwise the skill's `allowedRoles`, overridden per member by `skillOverrides`. |
140
+
141
+ ## Boundaries
142
+
143
+ These are the rules for anyone editing server. They are enforced in review rather than by tooling.
144
+
145
+ - **Composition Only Here**: Infrastructure concretes are instantiated at the composition root, never inside a route or a service.
146
+ - **Routes Stay Thin**: A route validates input, calls one service, and shapes the response. Business rules live in core, not in the handler.
147
+ - **Adapters Implement Ports**: Every fs, git, or agent class satisfies an interface declared in core, so swapping one never touches the framework.
148
+ - **Errors Map at the Edge**: Domain code throws a `BraidError`, and the error middleware is the only place that turns it into an HTTP status.
149
+ - **Scope Through Middleware**: Workspace access is checked once in middleware, not re-derived inside each route.
150
+
151
+ ## Dependencies
113
152
 
114
- When Braid grows a hosted product where the server runs remotely:
153
+ Server sits at the outer edge, above core and the plugin packages the coding preset bundles as defaults.
115
154
 
116
- - If claude runs locally (desktop spawns it): the stdio path above
117
- still works. The local gateway just talks HTTPS to the remote
118
- `/openapi.json` and REST endpoints, with auth headers passed
119
- through workspace-level MCP server config.
120
- - If claude runs in the cloud (browser Studio): the stdio path runs
121
- server-side, gateway loopbacks to the local server.
155
+ - **Depends On**: `@braidhq/core` and `@braidhq/schema`, `hono` for HTTP, `simple-git` for history, and, only through the coding preset, the default plugin bundle of `storage-kuzu`, `agent-claude-code`, `ontology-ddd`, and `source-loader-*`. The kernel itself needs none of the plugin packages; they leave with the preset when it extracts. See Positioning.
156
+ - **Consumed By**: `cli` and the `desktop` Tauri shell, which run it as their backend.
122
157
 
123
- The `streamable-http` MCP transport stays first-class in the schema
124
- so workspaces can declare any third-party HTTP MCP server (Redmine /
125
- Notion / Linear / …) alongside the stdio braid-core. The two
126
- transports are not mutually exclusive.
158
+ ## MCP Gateway
127
159
 
128
- ## Routes That Are Not in the Spec
160
+ Skills run as coding-agent subprocesses and reach this server's REST API as MCP tools, not by curl. An off-the-shelf translator, `openapi-mcp-gateway`, reads `/openapi.json` and re-exposes each operation as a tool named `braid-core`.
129
161
 
130
- - SSE streams (`/workspaces/{ws}/runs/{runId}/events`,
131
- `/workspaces/{ws}/events`) — not invocable as one-shot MCP tools.
132
- - OAuth callbacks (`/oauth/google/callback`) — HTML response.
133
- - Workspace management (`/workspaces/*`) — admin surface for CLI
134
- and Studio, not for skills.
162
+ The gateway is spawned per skill run and torn down with it, so there is no long-lived gateway process, no open port, and no network auth to manage. The transport is an implementation detail of the runner.
135
163
 
136
- The `GET /openapi.json` test in `test/app.test.ts` pins this list.
164
+ SSE streams, the OAuth HTML callback, and the workspace-admin routes are deliberately absent from the spec, they are not one-shot MCP tools. The `GET /openapi.json` test in `test/app.test.ts` pins that boundary.
package/dist/app.d.ts CHANGED
@@ -1,24 +1,16 @@
1
- import type { AppDependencies } from './composition.js';
1
+ import type { AppDependencies } from './composeApp.js';
2
2
  import { OpenAPIHono } from '@hono/zod-openapi';
3
3
  export interface AppOptions {
4
4
  readonly corsOrigins?: readonly string[];
5
5
  /**
6
- * Base URL the OpenAPI spec advertises in its `servers[]` block. This
7
- * is what downstream consumers (openapi-mcp-gateway, Swagger UI, code
8
- * generators, …) use to dispatch REST calls. When unset, the spec is
9
- * emitted without `servers[]`, which leaves the consumer to guess.
10
- * composeFsApp threads its `apiUrl` through here so the gateway can
11
- * route REST calls back to this server without an explicit
12
- * `--base-url` flag.
6
+ * Base URL the OpenAPI spec advertises in its `servers[]` block.
7
+ * Downstream consumers use it to dispatch REST calls,
8
+ * openapi-mcp-gateway, Swagger UI, and code generators among them.
9
+ * When unset, the spec omits `servers[]` and leaves the consumer to guess.
10
+ * `composeFsApp` threads its `apiUrl` here,
11
+ * so the gateway routes calls back without an explicit base-url flag.
13
12
  */
14
13
  readonly apiUrl?: string;
15
- /**
16
- * When true (or `BRAID_LOCAL_TRUST=true`), the auth middleware lets
17
- * every request through and the embedded `userIdMiddleware` falls
18
- * back to `local-user`. Set by `composeFs` for the Tauri sidecar;
19
- * production remote servers leave it `false`.
20
- */
21
- readonly localTrust?: boolean;
22
14
  }
23
15
  export declare function createApp(deps: AppDependencies, options?: AppOptions): OpenAPIHono;
24
16
  //# sourceMappingURL=app.d.ts.map
package/dist/app.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA8B/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,UAAe,GAAG,WAAW,CAwKtF"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AA8B/C,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxC;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,GAAE,UAAe,GAAG,WAAW,CAqMtF"}
package/dist/app.js CHANGED
@@ -2,14 +2,12 @@ import { OpenAPIHono } from '@hono/zod-openapi';
2
2
  import { authMiddleware } from './middleware/auth.js';
3
3
  import { corsMiddleware } from './middleware/cors.js';
4
4
  import { errorHandler } from './middleware/error.js';
5
- import { userIdMiddleware } from './middleware/userId.js';
6
5
  import { workspaceAccessMiddleware } from './middleware/workspaceAccess.js';
7
6
  import { workspaceIdMiddleware } from './middleware/workspaceId.js';
8
7
  import { createAdminRouter } from './routes/admin.js';
9
8
  import { createAuthRouter } from './routes/auth.js';
10
9
  import { createBatchRouter } from './routes/batch.js';
11
- import { createClarifyRouter } from './routes/clarify.js';
12
- import { createDecisionsRouter } from './routes/decisions.js';
10
+ import { createClarificationRouter } from './routes/clarifications.js';
13
11
  import { createEdgesRouter } from './routes/edges.js';
14
12
  import { healthRouter } from './routes/health.js';
15
13
  import { createHistoryRouter } from './routes/history.js';
@@ -18,38 +16,33 @@ import { createNodesRouter } from './routes/nodes.js';
18
16
  import { createOAuthRouter } from './routes/oauth.js';
19
17
  import { createOntologyRouter } from './routes/ontology.js';
20
18
  import { createProposalsRouter } from './routes/proposals.js';
19
+ import { createReactorCyclesRouter } from './routes/reactorCycles.js';
21
20
  import { createRunsRouter } from './routes/runs.js';
22
21
  import { createSkillInputOptionsRouter } from './routes/skillInputOptions.js';
23
22
  import { createSkillsRouter } from './routes/skills.js';
24
23
  import { createSourceLoadersRouter } from './routes/sourceLoaders.js';
25
- import { createSourceUnitStatesRouter } from './routes/sourceUnitStates.js';
24
+ import { createSourceUnitObservationsRouter } from './routes/sourceUnitObservations.js';
25
+ import { createGithubWebhookReceiver, createSourceWebhooksAdminRouter } from './routes/sourceWebhooks.js';
26
26
  import { createUsersRouter } from './routes/users.js';
27
27
  import { createWorkspaceEventsRouter } from './routes/workspaceEvents.js';
28
28
  import { createTransferOwnershipRouter, createWorkspaceMembersRouter } from './routes/workspaceMembers.js';
29
29
  import { createWorkspacesRouter } from './routes/workspaces.js';
30
30
  export function createApp(deps, options = {}) {
31
31
  const app = new OpenAPIHono();
32
+ // Global middleware, every request passes these in order.
32
33
  app.use('*', options.corsOrigins
33
34
  ? corsMiddleware({ allowedOrigins: options.corsOrigins })
34
35
  : corsMiddleware());
35
- // Phase B auth gate. In local-trust mode it short-circuits and lets
36
- // the unauthenticated request through; otherwise a Bearer token is
37
- // required (Google OAuth-issued session). Public routes `/auth/*`,
38
- // `/health` — are excluded inside the middleware so the login flow
39
- // itself isn't gated.
40
- if (deps.sessionStore) {
41
- const localTrust = options.localTrust ?? deps.localTrust;
42
- app.use('*', authMiddleware({
43
- sessionStore: deps.sessionStore,
44
- localTrust,
45
- }));
46
- }
47
- // Phase A identity. Stamps `c.set('userId', ...)` from `X-Braid-User`
48
- // when the auth layer left it empty — i.e. local-trust mode, or any
49
- // public route. Bearer-authenticated requests already have a userId
50
- // by the time this runs and pass through untouched.
51
- app.use('*', userIdMiddleware);
36
+ // Identity and auth gate. Resolves the caller's `userId` from a Bearer session
37
+ // when auth is enforced, else the `X-Braid-User` header or the default principal.
38
+ // Non-public routes that lack a required Bearer token are rejected.
39
+ app.use('*', authMiddleware({
40
+ ...(deps.sessionStore ? { sessionStore: deps.sessionStore } : {}),
41
+ requireAuth: deps.authMode.requiresAuth,
42
+ defaultPrincipal: deps.authMode.defaultPrincipal,
43
+ }));
52
44
  app.onError(errorHandler);
45
+ // Host-level routes, not scoped to a single workspace.
53
46
  app.route('/health', healthRouter);
54
47
  if (deps.sessionStore && deps.accessPolicy && deps.userRegistry) {
55
48
  app.route('/auth', createAuthRouter({
@@ -59,13 +52,12 @@ export function createApp(deps, options = {}) {
59
52
  userRegistry: deps.userRegistry,
60
53
  ...(deps.googleOAuth ? { googleOAuth: deps.googleOAuth } : {}),
61
54
  studioUrl: deps.studioUrl ?? 'http://localhost:5173',
62
- localTrust: options.localTrust ?? deps.localTrust,
55
+ requiresAuth: deps.authMode.requiresAuth,
63
56
  }));
64
57
  }
65
58
  if (deps.userRegistry) {
66
59
  app.route('/users', createUsersRouter({
67
60
  userRegistry: deps.userRegistry,
68
- clock: deps.clock,
69
61
  }));
70
62
  }
71
63
  if (deps.userRegistry && deps.accessPolicy && deps.workspaceRegistry) {
@@ -80,22 +72,37 @@ export function createApp(deps, options = {}) {
80
72
  workspaceService: deps.workspaceService,
81
73
  sourceLoaderRunner: deps.sourceLoaderRunner,
82
74
  workspacesRoot: deps.workspacesRoot,
75
+ pluginRegistry: deps.pluginRegistry,
83
76
  ...(deps.bootstrap ? { bootstrap: deps.bootstrap } : {}),
84
77
  ...(deps.workspaceRegistry ? { workspaceRegistry: deps.workspaceRegistry } : {}),
85
78
  ...(deps.userRegistry ? { userRegistry: deps.userRegistry } : {}),
79
+ ...(deps.historyService ? { historyService: deps.historyService } : {}),
86
80
  }));
87
81
  app.route('/workspaces', createWorkspaceEventsRouter({ eventBus: deps.eventBus }));
88
- // Server-level plugin discovery: lets Studio render its loader dropdown
89
- // from the active PluginRegistry rather than hardcoded strings. Not
90
- // workspace-scoped because the answer is "what does this server have
91
- // installed", which is identical across workspaces.
82
+ // Server-level plugin discovery for Studio's loader dropdown,
83
+ // sourced from the active PluginRegistry, not hardcoded strings.
84
+ // Installed loaders are identical across workspaces, not scoped to one.
92
85
  app.route('/source-loaders', createSourceLoadersRouter({ pluginRegistry: deps.pluginRegistry }));
86
+ // Public webhook receivers, authenticated by per-source HMAC secrets,
87
+ // inside the handler, not by a Bearer token.
88
+ // The auth middleware exempts the `/webhooks/` prefix.
89
+ // Mounted only when a SecretStore is wired,
90
+ // without one there is nowhere to read the secrets.
91
+ if (deps.secretStore) {
92
+ app.route('/webhooks', createGithubWebhookReceiver({
93
+ workspaceService: deps.workspaceService,
94
+ sourceLoaderRunner: deps.sourceLoaderRunner,
95
+ secretStore: deps.secretStore,
96
+ pluginRegistry: deps.pluginRegistry,
97
+ }));
98
+ }
99
+ // Workspace-scoped sub-app, mounted under `/workspaces/:workspaceId` below.
93
100
  const workspaceScoped = new OpenAPIHono();
94
101
  workspaceScoped.use('*', workspaceIdMiddleware);
95
- // Workspace membership gate. Mounted only when both the workspace
96
- // registry and user registry are present (i.e. composeFsApp);
97
- // in-memory tests that compose without these stay open so existing
98
- // routes keep behaving.
102
+ // Workspace membership gate, present only in composeFsApp,
103
+ // which wires both the workspace registry and the user registry.
104
+ // In-memory tests compose without these and stay open,
105
+ // so existing routes keep behaving.
99
106
  if (deps.workspaceRegistry && deps.userRegistry) {
100
107
  workspaceScoped.use('*', workspaceAccessMiddleware({
101
108
  registry: deps.workspaceRegistry,
@@ -110,17 +117,24 @@ export function createApp(deps, options = {}) {
110
117
  hitlService: deps.hitlService,
111
118
  proposalRepository: deps.proposalRepository,
112
119
  modelRepository: deps.modelRepository,
113
- validationService: deps.validationService,
120
+ modelValidationService: deps.modelValidationService,
114
121
  workspaceService: deps.workspaceService,
115
122
  }));
116
- workspaceScoped.route('/clarify', createClarifyRouter({
123
+ workspaceScoped.route('/clarifications', createClarificationRouter({
117
124
  hitlService: deps.hitlService,
118
- clarifyRepository: deps.clarifyRepository,
119
- decisionRepository: deps.decisionRepository,
125
+ clarificationRepository: deps.clarificationRepository,
120
126
  }));
121
- workspaceScoped.route('/decisions', createDecisionsRouter({ decisionRepository: deps.decisionRepository }));
122
- workspaceScoped.route('/source-unit-states', createSourceUnitStatesRouter({
123
- sourceUnitStateService: deps.sourceUnitStateService,
127
+ workspaceScoped.route('/source-unit-states', createSourceUnitObservationsRouter({
128
+ sourceUnitObservationService: deps.sourceUnitObservationService,
129
+ ...(deps.intentLister && deps.sourceUnitDigest
130
+ ? {
131
+ diffSupport: {
132
+ workspaceService: deps.workspaceService,
133
+ intentLister: deps.intentLister,
134
+ digest: deps.sourceUnitDigest,
135
+ },
136
+ }
137
+ : {}),
124
138
  }));
125
139
  workspaceScoped.route('/ontology', createOntologyRouter({
126
140
  workspaceRepository: deps.workspaceRepository,
@@ -131,6 +145,9 @@ export function createApp(deps, options = {}) {
131
145
  skillRegistry: deps.skillRegistry,
132
146
  skillRunner: deps.skillRunner,
133
147
  workspaceRepository: deps.workspaceRepository,
148
+ sourceUnitObservationService: deps.sourceUnitObservationService,
149
+ runRepository: deps.runRepository,
150
+ pluginRegistry: deps.pluginRegistry,
134
151
  }));
135
152
  workspaceScoped.route('/runs', createRunsRouter({
136
153
  runRepository: deps.runRepository,
@@ -144,9 +161,20 @@ export function createApp(deps, options = {}) {
144
161
  if (deps.batchService) {
145
162
  workspaceScoped.route('/batch', createBatchRouter({ batchService: deps.batchService }));
146
163
  }
164
+ workspaceScoped.route('/reactor-cycles', createReactorCyclesRouter({
165
+ reactorCycleRepository: deps.reactorCycleRepository,
166
+ }));
167
+ if (deps.secretStore) {
168
+ workspaceScoped.route('/source-webhooks', createSourceWebhooksAdminRouter({
169
+ workspaceService: deps.workspaceService,
170
+ secretStore: deps.secretStore,
171
+ pluginRegistry: deps.pluginRegistry,
172
+ ...(options.apiUrl ? { apiUrl: options.apiUrl } : {}),
173
+ }));
174
+ }
147
175
  workspaceScoped.route('/skill-input-options', createSkillInputOptionsRouter({
148
176
  modelRepository: deps.modelRepository,
149
- clarifyRepository: deps.clarifyRepository,
177
+ clarificationRepository: deps.clarificationRepository,
150
178
  workspaceRepository: deps.workspaceRepository,
151
179
  pluginRegistry: deps.pluginRegistry,
152
180
  }));
@@ -169,12 +197,11 @@ export function createApp(deps, options = {}) {
169
197
  ...(deps.googleOAuth ? { google: deps.googleOAuth } : {}),
170
198
  }));
171
199
  }
172
- // OpenAPI 3 spec; consumed by openapi-mcp-gateway to surface REST
173
- // operations as MCP tools. SSE routes and the OAuth HTML callback
174
- // are intentionally absent they're mounted via app.route() with
175
- // plain Hono sub-routers so they don't register with the OpenAPI
176
- // registry. The `servers[]` block lets the gateway resolve the
177
- // upstream API base URL without an explicit --base-url flag.
200
+ // OpenAPI 3 spec, consumed by openapi-mcp-gateway, to surface REST operations as MCP tools.
201
+ // SSE routes and the OAuth HTML callback are intentionally absent,
202
+ // they mount plain Hono sub-routers, so they never register with the doc.
203
+ // The `servers[]` block lets the gateway resolve the upstream base URL,
204
+ // without an explicit --base-url flag.
178
205
  app.doc('/openapi.json', {
179
206
  openapi: '3.0.0',
180
207
  info: {
package/dist/app.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,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CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1D,CAAC,CAAC,CAAA;IACL,CAAC;IAED,4FAA4F;IAC5F,mEAAmE;IACnE,0EAA0E;IAC1E,wEAAwE;IACxE,uCAAuC;IACvC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,gBAAgB;YACvB,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,2GAA2G;SACzH;QACD,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { UserId } from '@braidhq/schema';
2
+ import type { AccessPolicy } from './infrastructure/auth/AccessPolicy.js';
3
+ import type { UserRegistryFile } from './infrastructure/users/UserRegistryFile.js';
4
+ export declare const LOCAL_USER_ID: string & import("zod").$brand<"UserId">;
5
+ export interface AuthContext {
6
+ readonly userRegistry: UserRegistryFile;
7
+ readonly accessPolicy: AccessPolicy;
8
+ }
9
+ /**
10
+ * How a deployment resolves identity.
11
+ * The one axis that separates a trusted local install,
12
+ * from an authenticated remote server.
13
+ *
14
+ * Two separate axes, not one nullable field.
15
+ * `defaultPrincipal` is the identity axis, the implicit user for an
16
+ * unauthenticated request, and the owner a workspace falls back to,
17
+ * or null when there is no implicit user.
18
+ * `requiresAuth` is the policy axis, whether a caller must present a valid
19
+ * Bearer token. The middleware reads this, never the principal's null-ness.
20
+ *
21
+ * Stateless behaviour behind an interface, so a const object per mode,
22
+ * the idiomatic strategy form when there is no constructor dependency.
23
+ */
24
+ export interface AuthMode {
25
+ readonly defaultPrincipal: UserId | null;
26
+ readonly requiresAuth: boolean;
27
+ provision: (context: AuthContext) => Promise<void>;
28
+ }
29
+ /**
30
+ * A local desktop or sidecar. One implicit user owns everything,
31
+ * so provision seeds that `local-user` admin account, idempotently.
32
+ */
33
+ export declare const localTrust: AuthMode;
34
+ /**
35
+ * A remote server. Real users authenticate against an allowlist,
36
+ * so provision back-fills `approvedEmails` from the roster, idempotently.
37
+ */
38
+ export declare const authenticated: AuthMode;
39
+ //# sourceMappingURL=authMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authMode.d.ts","sourceRoot":"","sources":["../src/authMode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAA;AAKlF,eAAO,MAAM,aAAa,yCAAmC,CAAA;AAE7D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAA;IACvC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAA;CACpC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;IACxC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAE9B,SAAS,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnD;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,QAaxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,QAS3B,CAAA"}