@braidhq/server 0.0.1 → 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 (376) hide show
  1. package/README.md +164 -0
  2. package/dist/app.d.ts +12 -3
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +154 -9
  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/composeFsApp.js +309 -0
  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/_shared/env.js +19 -0
  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/_shared/paths.d.ts +43 -0
  33. package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
  34. package/dist/infrastructure/_shared/paths.js +96 -0
  35. package/dist/infrastructure/_shared/paths.js.map +1 -0
  36. package/dist/infrastructure/auth/AccessPolicy.d.ts +87 -0
  37. package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -0
  38. package/dist/infrastructure/auth/AccessPolicy.js +177 -0
  39. package/dist/infrastructure/auth/AccessPolicy.js.map +1 -0
  40. package/dist/infrastructure/auth/SessionStore.d.ts +50 -0
  41. package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -0
  42. package/dist/infrastructure/auth/SessionStore.js +104 -0
  43. package/dist/infrastructure/auth/SessionStore.js.map +1 -0
  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/batch/FsBatchPlanRepository.js +42 -0
  47. package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
  48. package/dist/infrastructure/history/GitWorkspaceHistory.d.ts +18 -0
  49. package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
  50. package/dist/infrastructure/history/GitWorkspaceHistory.js +310 -0
  51. package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
  52. package/dist/infrastructure/history/commitMessage.d.ts +4 -0
  53. package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
  54. package/dist/infrastructure/history/commitMessage.js +90 -0
  55. package/dist/infrastructure/history/commitMessage.js.map +1 -0
  56. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
  57. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
  58. package/dist/infrastructure/hitl/FsClarificationRepository.js +39 -0
  59. package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
  60. package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
  61. package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +10 -3
  62. package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
  63. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
  64. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
  65. package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
  66. package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
  67. package/dist/infrastructure/model/FsModelSerializer.d.ts +96 -0
  68. package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
  69. package/dist/infrastructure/model/FsModelSerializer.js +60 -0
  70. package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
  71. package/dist/infrastructure/oauth/GoogleOAuth.d.ts +43 -14
  72. package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
  73. package/dist/infrastructure/oauth/GoogleOAuth.js +78 -11
  74. package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
  75. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
  76. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
  77. package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
  78. package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
  79. package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
  80. package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
  81. package/dist/infrastructure/secrets/SecretStore.js +4 -4
  82. package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
  83. package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +9 -4
  84. package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
  85. package/dist/infrastructure/skill/FsRunRepository.js +162 -0
  86. package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
  87. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
  88. package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
  89. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +38 -18
  90. package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
  91. package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.d.ts +13 -15
  92. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
  93. package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +124 -40
  94. package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
  95. package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
  96. package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
  97. package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
  98. package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
  99. package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
  100. package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
  101. package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
  102. package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
  103. package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
  104. package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
  105. package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
  106. package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
  107. package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
  108. package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
  109. package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
  110. package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
  111. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
  112. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
  113. package/dist/infrastructure/source/FsSourceUnitDigest.js +58 -0
  114. package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
  115. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
  116. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
  117. package/dist/infrastructure/source/FsSourceUnitObservationRepository.js +88 -0
  118. package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
  119. package/dist/infrastructure/source/intentScan.d.ts +13 -0
  120. package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
  121. package/dist/infrastructure/source/intentScan.js +137 -0
  122. package/dist/infrastructure/source/intentScan.js.map +1 -0
  123. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +14 -0
  124. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -0
  125. package/dist/infrastructure/users/UserDirectoryFromRegistry.js +21 -0
  126. package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -0
  127. package/dist/infrastructure/users/UserRegistryFile.d.ts +22 -0
  128. package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -0
  129. package/dist/infrastructure/users/UserRegistryFile.js +89 -0
  130. package/dist/infrastructure/users/UserRegistryFile.js.map +1 -0
  131. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +12 -0
  132. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -0
  133. package/dist/infrastructure/users/ensureWorkspaceOwners.js +25 -0
  134. package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -0
  135. package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
  136. package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +15 -5
  137. package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
  138. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
  139. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
  140. package/dist/infrastructure/workspace/WorkspaceDiscovery.js +50 -0
  141. package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
  142. package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts +42 -0
  143. package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
  144. package/dist/infrastructure/workspace/WorkspaceRegistryFile.js +160 -0
  145. package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
  146. package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
  147. package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
  148. package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -28
  149. package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
  150. package/dist/middleware/auth.d.ts +39 -0
  151. package/dist/middleware/auth.d.ts.map +1 -0
  152. package/dist/middleware/auth.js +87 -0
  153. package/dist/middleware/auth.js.map +1 -0
  154. package/dist/middleware/cors.d.ts.map +1 -1
  155. package/dist/middleware/cors.js +5 -2
  156. package/dist/middleware/cors.js.map +1 -1
  157. package/dist/middleware/error.d.ts.map +1 -1
  158. package/dist/middleware/error.js +15 -13
  159. package/dist/middleware/error.js.map +1 -1
  160. package/dist/middleware/workspaceAccess.d.ts +51 -0
  161. package/dist/middleware/workspaceAccess.d.ts.map +1 -0
  162. package/dist/middleware/workspaceAccess.js +91 -0
  163. package/dist/middleware/workspaceAccess.js.map +1 -0
  164. package/dist/policy/CapabilityCheck.d.ts +14 -0
  165. package/dist/policy/CapabilityCheck.d.ts.map +1 -0
  166. package/dist/policy/CapabilityCheck.js +2 -0
  167. package/dist/policy/CapabilityCheck.js.map +1 -0
  168. package/dist/policy/PermissionRegistry.d.ts +25 -0
  169. package/dist/policy/PermissionRegistry.d.ts.map +1 -0
  170. package/dist/policy/PermissionRegistry.js +29 -0
  171. package/dist/policy/PermissionRegistry.js.map +1 -0
  172. package/dist/policy/ViewerContext.d.ts +29 -0
  173. package/dist/policy/ViewerContext.d.ts.map +1 -0
  174. package/dist/policy/ViewerContext.js +2 -0
  175. package/dist/policy/ViewerContext.js.map +1 -0
  176. package/dist/policy/checks.d.ts +15 -0
  177. package/dist/policy/checks.d.ts.map +1 -0
  178. package/dist/policy/checks.js +55 -0
  179. package/dist/policy/checks.js.map +1 -0
  180. package/dist/policy/defaultRegistry.d.ts +9 -0
  181. package/dist/policy/defaultRegistry.d.ts.map +1 -0
  182. package/dist/policy/defaultRegistry.js +15 -0
  183. package/dist/policy/defaultRegistry.js.map +1 -0
  184. package/dist/policy/index.d.ts +8 -0
  185. package/dist/policy/index.d.ts.map +1 -0
  186. package/dist/policy/index.js +5 -0
  187. package/dist/policy/index.js.map +1 -0
  188. package/dist/policy/resolveViewer.d.ts +16 -0
  189. package/dist/policy/resolveViewer.d.ts.map +1 -0
  190. package/dist/policy/resolveViewer.js +37 -0
  191. package/dist/policy/resolveViewer.js.map +1 -0
  192. package/dist/routes/_shared.d.ts +138 -0
  193. package/dist/routes/_shared.d.ts.map +1 -0
  194. package/dist/routes/_shared.js +33 -0
  195. package/dist/routes/_shared.js.map +1 -0
  196. package/dist/routes/admin.d.ts +13 -0
  197. package/dist/routes/admin.d.ts.map +1 -0
  198. package/dist/routes/admin.js +228 -0
  199. package/dist/routes/admin.js.map +1 -0
  200. package/dist/routes/auth.d.ts +35 -0
  201. package/dist/routes/auth.d.ts.map +1 -0
  202. package/dist/routes/auth.js +168 -0
  203. package/dist/routes/auth.js.map +1 -0
  204. package/dist/routes/batch.d.ts +7 -0
  205. package/dist/routes/batch.d.ts.map +1 -0
  206. package/dist/routes/batch.js +47 -0
  207. package/dist/routes/batch.js.map +1 -0
  208. package/dist/routes/clarifications.d.ts +8 -0
  209. package/dist/routes/clarifications.d.ts.map +1 -0
  210. package/dist/routes/clarifications.js +243 -0
  211. package/dist/routes/clarifications.js.map +1 -0
  212. package/dist/routes/edges.d.ts +2 -2
  213. package/dist/routes/edges.d.ts.map +1 -1
  214. package/dist/routes/edges.js +34 -16
  215. package/dist/routes/edges.js.map +1 -1
  216. package/dist/routes/health.d.ts +2 -2
  217. package/dist/routes/health.d.ts.map +1 -1
  218. package/dist/routes/health.js +21 -3
  219. package/dist/routes/health.js.map +1 -1
  220. package/dist/routes/history.d.ts +7 -0
  221. package/dist/routes/history.d.ts.map +1 -0
  222. package/dist/routes/history.js +90 -0
  223. package/dist/routes/history.js.map +1 -0
  224. package/dist/routes/model.d.ts +2 -2
  225. package/dist/routes/model.d.ts.map +1 -1
  226. package/dist/routes/model.js +20 -4
  227. package/dist/routes/model.js.map +1 -1
  228. package/dist/routes/nodes.d.ts +2 -2
  229. package/dist/routes/nodes.d.ts.map +1 -1
  230. package/dist/routes/nodes.js +77 -25
  231. package/dist/routes/nodes.js.map +1 -1
  232. package/dist/routes/oauth.d.ts +6 -7
  233. package/dist/routes/oauth.d.ts.map +1 -1
  234. package/dist/routes/oauth.js +6 -7
  235. package/dist/routes/oauth.js.map +1 -1
  236. package/dist/routes/ontology.d.ts +2 -2
  237. package/dist/routes/ontology.d.ts.map +1 -1
  238. package/dist/routes/ontology.js +22 -5
  239. package/dist/routes/ontology.js.map +1 -1
  240. package/dist/routes/proposals.d.ts +5 -4
  241. package/dist/routes/proposals.d.ts.map +1 -1
  242. package/dist/routes/proposals.js +176 -45
  243. package/dist/routes/proposals.js.map +1 -1
  244. package/dist/routes/reactorCycles.d.ts +7 -0
  245. package/dist/routes/reactorCycles.d.ts.map +1 -0
  246. package/dist/routes/reactorCycles.js +60 -0
  247. package/dist/routes/reactorCycles.js.map +1 -0
  248. package/dist/routes/runs.d.ts.map +1 -1
  249. package/dist/routes/runs.js +66 -12
  250. package/dist/routes/runs.js.map +1 -1
  251. package/dist/routes/skillInputOptions.d.ts +10 -0
  252. package/dist/routes/skillInputOptions.d.ts.map +1 -0
  253. package/dist/routes/skillInputOptions.js +159 -0
  254. package/dist/routes/skillInputOptions.js.map +1 -0
  255. package/dist/routes/skills.d.ts +21 -3
  256. package/dist/routes/skills.d.ts.map +1 -1
  257. package/dist/routes/skills.js +223 -21
  258. package/dist/routes/skills.js.map +1 -1
  259. package/dist/routes/sourceLoaders.d.ts +7 -0
  260. package/dist/routes/sourceLoaders.d.ts.map +1 -0
  261. package/dist/routes/sourceLoaders.js +30 -0
  262. package/dist/routes/sourceLoaders.js.map +1 -0
  263. package/dist/routes/sourceUnitObservations.d.ts +20 -0
  264. package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
  265. package/dist/routes/sourceUnitObservations.js +80 -0
  266. package/dist/routes/sourceUnitObservations.js.map +1 -0
  267. package/dist/routes/sourceWebhooks.d.ts +26 -0
  268. package/dist/routes/sourceWebhooks.d.ts.map +1 -0
  269. package/dist/routes/sourceWebhooks.js +301 -0
  270. package/dist/routes/sourceWebhooks.js.map +1 -0
  271. package/dist/routes/users.d.ts +7 -0
  272. package/dist/routes/users.d.ts.map +1 -0
  273. package/dist/routes/users.js +109 -0
  274. package/dist/routes/users.js.map +1 -0
  275. package/dist/routes/workspaceEvents.d.ts +5 -4
  276. package/dist/routes/workspaceEvents.d.ts.map +1 -1
  277. package/dist/routes/workspaceEvents.js +7 -6
  278. package/dist/routes/workspaceEvents.js.map +1 -1
  279. package/dist/routes/workspaceMembers.d.ts +11 -0
  280. package/dist/routes/workspaceMembers.d.ts.map +1 -0
  281. package/dist/routes/workspaceMembers.js +81 -0
  282. package/dist/routes/workspaceMembers.js.map +1 -0
  283. package/dist/routes/workspaces.d.ts +30 -1
  284. package/dist/routes/workspaces.d.ts.map +1 -1
  285. package/dist/routes/workspaces.js +207 -63
  286. package/dist/routes/workspaces.js.map +1 -1
  287. package/dist/server.js +9 -29
  288. package/dist/server.js.map +1 -1
  289. package/dist/startServer.d.ts +17 -0
  290. package/dist/startServer.d.ts.map +1 -0
  291. package/dist/startServer.js +81 -0
  292. package/dist/startServer.js.map +1 -0
  293. package/dist/startup.d.ts +28 -0
  294. package/dist/startup.d.ts.map +1 -0
  295. package/dist/startup.js +94 -0
  296. package/dist/startup.js.map +1 -0
  297. package/package.json +49 -32
  298. package/LICENSE +0 -21
  299. package/dist/composeFs.d.ts +0 -20
  300. package/dist/composeFs.d.ts.map +0 -1
  301. package/dist/composeFs.js +0 -134
  302. package/dist/composeFs.js.map +0 -1
  303. package/dist/composition.d.ts +0 -49
  304. package/dist/composition.d.ts.map +0 -1
  305. package/dist/composition.js +0 -43
  306. package/dist/composition.js.map +0 -1
  307. package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts +0 -8
  308. package/dist/infrastructure/agent/ClaudeCodeAgentBinding.d.ts.map +0 -1
  309. package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js +0 -62
  310. package/dist/infrastructure/agent/ClaudeCodeAgentBinding.js.map +0 -1
  311. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
  312. package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
  313. package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
  314. package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
  315. package/dist/infrastructure/agent/mcpConfig.d.ts +0 -18
  316. package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
  317. package/dist/infrastructure/agent/mcpConfig.js +0 -47
  318. package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
  319. package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
  320. package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
  321. package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
  322. package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
  323. package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
  324. package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
  325. package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
  326. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
  327. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
  328. package/dist/infrastructure/fs/FsClarifyTicketRepository.js +0 -33
  329. package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
  330. package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
  331. package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
  332. package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
  333. package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
  334. package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
  335. package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
  336. package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
  337. package/dist/infrastructure/fs/FsRunRepository.js +0 -88
  338. package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
  339. package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
  340. package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
  341. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
  342. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
  343. package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
  344. package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
  345. package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
  346. package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts +0 -17
  347. package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
  348. package/dist/infrastructure/fs/WorkspaceRegistryFile.js +0 -58
  349. package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
  350. package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
  351. package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
  352. package/dist/infrastructure/fs/frontmatter.js.map +0 -1
  353. package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
  354. package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
  355. package/dist/infrastructure/fs/paths.d.ts +0 -22
  356. package/dist/infrastructure/fs/paths.d.ts.map +0 -1
  357. package/dist/infrastructure/fs/paths.js +0 -46
  358. package/dist/infrastructure/fs/paths.js.map +0 -1
  359. package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
  360. package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
  361. package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
  362. package/dist/infrastructure/orphanReaper.d.ts +0 -18
  363. package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
  364. package/dist/infrastructure/orphanReaper.js.map +0 -1
  365. package/dist/routes/clarify.d.ts +0 -8
  366. package/dist/routes/clarify.d.ts.map +0 -1
  367. package/dist/routes/clarify.js +0 -84
  368. package/dist/routes/clarify.js.map +0 -1
  369. package/dist/routes/decisions.d.ts +0 -7
  370. package/dist/routes/decisions.d.ts.map +0 -1
  371. package/dist/routes/decisions.js +0 -30
  372. package/dist/routes/decisions.js.map +0 -1
  373. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
  374. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
  375. /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
  376. /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
@@ -0,0 +1,81 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import process from 'node:process';
4
+ import { createLogger } from '@braidhq/core';
5
+ import { AgentEffort } from '@braidhq/schema';
6
+ import { serve } from '@hono/node-server';
7
+ import { createApp } from './app.js';
8
+ import { composeFsApp } from './composeFsApp.js';
9
+ import { startupAfterServe } from './startup.js';
10
+ /**
11
+ * Walk up from the working directory to the first `.env`, and load it,
12
+ * before anything reads process.env.
13
+ * A missing file is silent, production boots from real env, not dotfiles.
14
+ */
15
+ export function loadRootEnv() {
16
+ let dir = process.cwd();
17
+ for (;;) {
18
+ const candidate = join(dir, '.env');
19
+ if (existsSync(candidate)) {
20
+ process.loadEnvFile(candidate);
21
+ return;
22
+ }
23
+ const parent = dirname(dir);
24
+ if (parent === dir)
25
+ return;
26
+ dir = parent;
27
+ }
28
+ }
29
+ // The server's own env vars, read in one place so both entries agree.
30
+ // Each key is an optional override, an unset var falls to the preset default.
31
+ function fsOptionsFromEnv() {
32
+ return {
33
+ ...(process.env.BRAID_HOME ? { braidHome: process.env.BRAID_HOME } : {}),
34
+ ...(process.env.BRAID_AGENT_MODEL ? { agentModel: process.env.BRAID_AGENT_MODEL } : {}),
35
+ ...(process.env.BRAID_AGENT_EFFORT ? { agentEffort: AgentEffort.parse(process.env.BRAID_AGENT_EFFORT) } : {}),
36
+ };
37
+ }
38
+ /**
39
+ * Boot the coding-preset app and start serving, shared by the standalone
40
+ * entry and the cli `serve` command so both wire identically.
41
+ * Resolves once the socket is listening, then keeps running under signal handlers.
42
+ */
43
+ export async function startServer(options) {
44
+ const apiUrl = `http://localhost:${options.port}`;
45
+ const deps = await composeFsApp({ apiUrl, ...fsOptionsFromEnv() });
46
+ const app = createApp(deps, { apiUrl });
47
+ const log = createLogger('server');
48
+ const server = await new Promise((resolveBoot) => {
49
+ const handle = serve({ fetch: app.fetch, port: options.port }, ({ port }) => {
50
+ options.onListen?.(`http://localhost:${port}`);
51
+ resolveBoot(handle);
52
+ });
53
+ });
54
+ installShutdown(server, deps, log);
55
+ // Background recovery, after serve() so it never delays accepting requests.
56
+ void startupAfterServe(deps);
57
+ }
58
+ // Close the model repository on shutdown so the storage adapter flushes cleanly.
59
+ // Second signal force-quits in case close hangs.
60
+ function installShutdown(server, deps, log) {
61
+ let shuttingDown = false;
62
+ async function shutdown(signal) {
63
+ if (shuttingDown) {
64
+ log.warn({ signal }, 'received second shutdown signal, exiting now');
65
+ process.exit(1);
66
+ }
67
+ shuttingDown = true;
68
+ log.info({ signal }, 'shutting down');
69
+ server.close();
70
+ try {
71
+ await deps.modelRepository.close?.();
72
+ }
73
+ catch (err) {
74
+ log.error({ err }, 'modelRepository.close failed');
75
+ }
76
+ process.exit(0);
77
+ }
78
+ process.on('SIGINT', () => void shutdown('SIGINT'));
79
+ process.on('SIGTERM', () => void shutdown('SIGTERM'));
80
+ }
81
+ //# sourceMappingURL=startServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startServer.js","sourceRoot":"","sources":["../src/startServer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,E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CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;QACD,YAAY,GAAG,IAAI,CAAA;QACnB,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,eAAe,CAAC,CAAA;QACrC,MAAM,CAAC,KAAK,EAAE,CAAA;QACd,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,EAAE,CAAA;QACtC,CAAC;QACD,OAAO,GAAG,EAAE,CAAC;YACX,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,8BAA8B,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAA;IACnD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;AACvD,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { AppDependencies } from './composeApp.js';
2
+ /**
3
+ * The blocking startup pass, run once after composition,
4
+ * before the server accepts requests.
5
+ * Per workspace it provisions the git repo and store,
6
+ * recovers in-flight state left by a killed process,
7
+ * subscribes the reactor when the workspace opts in,
8
+ * and fires a catch-up sync for missed webhook deliveries.
9
+ *
10
+ * This is the single home for per-workspace boot steps.
11
+ * A new one is added here,
12
+ * not scattered across composition and the server entry.
13
+ * Recovery that need not finish before serving,
14
+ * such as reaping orphan runs, runs after `serve()` in `server.ts`,
15
+ * so it never delays accepting requests.
16
+ *
17
+ * Per-workspace failures are logged and tolerated,
18
+ * so one bad directory does not block the rest of the boot.
19
+ */
20
+ export declare function startupBeforeServe(deps: AppDependencies): Promise<void>;
21
+ /**
22
+ * The background startup pass, run once after `serve()`,
23
+ * so it never delays accepting requests.
24
+ * Cosmetic recovery that need not finish before the first request lives here,
25
+ * not in the blocking `startupBeforeServe`.
26
+ */
27
+ export declare function startupAfterServe(deps: AppDependencies): Promise<void>;
28
+ //# sourceMappingURL=startup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup.d.ts","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAMtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAkC7E;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB5E"}
@@ -0,0 +1,94 @@
1
+ import { spawn } from 'node:child_process';
2
+ import process from 'node:process';
3
+ import { createLogger } from '@braidhq/core';
4
+ import { reapOrphanRuns } from './infrastructure/skill/orphanReaper.js';
5
+ /**
6
+ * The blocking startup pass, run once after composition,
7
+ * before the server accepts requests.
8
+ * Per workspace it provisions the git repo and store,
9
+ * recovers in-flight state left by a killed process,
10
+ * subscribes the reactor when the workspace opts in,
11
+ * and fires a catch-up sync for missed webhook deliveries.
12
+ *
13
+ * This is the single home for per-workspace boot steps.
14
+ * A new one is added here,
15
+ * not scattered across composition and the server entry.
16
+ * Recovery that need not finish before serving,
17
+ * such as reaping orphan runs, runs after `serve()` in `server.ts`,
18
+ * so it never delays accepting requests.
19
+ *
20
+ * Per-workspace failures are logged and tolerated,
21
+ * so one bad directory does not block the rest of the boot.
22
+ */
23
+ export async function startupBeforeServe(deps) {
24
+ const log = createLogger('server').child({ mod: 'workspace-startup' });
25
+ for (const workspace of await deps.workspaceService.list()) {
26
+ try {
27
+ await deps.bootstrap?.ensure(workspace);
28
+ // Mark any batch plan left running by a previous process as failed,
29
+ // so the UI does not show a phantom spinner.
30
+ // Safe when there is no plan, or when it is already terminal.
31
+ await deps.batchService?.reconcileAfterBoot(workspace.id);
32
+ // Reactor opt-in is per workspace, subscribe only when PRODUCT.md sets it.
33
+ if (workspace.productManifest.reactor?.enabled)
34
+ await deps.reactorService?.start(workspace.id);
35
+ // Catch deliveries missed while the server was down.
36
+ // GitHub drops webhook retries after a few hours,
37
+ // so every boot fires one syncOne per loader source.
38
+ // Loaders carry a persisted cursor,
39
+ // so a caught-up source costs one empty round trip,
40
+ // a stale one fetches only the missed window.
41
+ // Fire-and-forget keeps boot fast, the reactor picks up the events.
42
+ for (const source of workspace.sources) {
43
+ if (source.kind !== 'filesystem' || !source.loader)
44
+ continue;
45
+ void deps.sourceLoaderRunner.syncOne(workspace, source.id).catch((err) => {
46
+ log.warn({ workspaceId: workspace.id, sourceId: source.id, err: err instanceof Error ? err.message : String(err) }, 'boot syncOne failed, will retry on next webhook or manual sync');
47
+ });
48
+ }
49
+ }
50
+ catch (err) {
51
+ log.warn({ err, workspaceId: workspace.id }, 'workspace startup failed, skipping');
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * The background startup pass, run once after `serve()`,
57
+ * so it never delays accepting requests.
58
+ * Cosmetic recovery that need not finish before the first request lives here,
59
+ * not in the blocking `startupBeforeServe`.
60
+ */
61
+ export async function startupAfterServe(deps) {
62
+ const log = createLogger('server').child({ mod: 'workspace-startup' });
63
+ try {
64
+ const { reaped } = await reapOrphanRuns({
65
+ workspaceRepository: deps.workspaceRepository,
66
+ runRepository: deps.runRepository,
67
+ clock: deps.clock,
68
+ });
69
+ if (reaped > 0)
70
+ log.info({ reaped }, `marked ${reaped} orphan run(s) as aborted`);
71
+ }
72
+ catch (err) {
73
+ log.error({ err }, 'orphan reaper failed');
74
+ }
75
+ // Warm the MCP gateway package so the first skill run's braid-core connects
76
+ // fast, rather than paying the uvx cold-start mid-conversation.
77
+ warmGateway();
78
+ }
79
+ // Pre-fetch the openapi-mcp-gateway package, the download that otherwise makes
80
+ // braid-core look slow to connect on the first run. Fire-and-forget and
81
+ // unref'd, a warm cache is best-effort and never gates the boot. A 30s kill
82
+ // guards a `--help` that hangs once the package is cached, and a missing uvx
83
+ // just errors out quietly. This lives in the after-serve pass, not composition,
84
+ // so it stays out of tests that build the app directly.
85
+ function warmGateway() {
86
+ const uvxBin = process.env.BRAID_UVX_BIN || 'uvx';
87
+ const child = spawn(uvxBin, ['openapi-mcp-gateway', '--help'], { stdio: 'ignore' });
88
+ child.once('error', () => { });
89
+ child.unref();
90
+ const timer = setTimeout(() => child.kill(), 30_000);
91
+ timer.unref();
92
+ child.once('exit', () => clearTimeout(timer));
93
+ }
94
+ //# sourceMappingURL=startup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup.js","sourceRoot":"","sources":["../src/startup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAEvE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAqB;IAC5D,MAAM,GAAG,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACtE,KAAK,MAAM,SAAS,IAAI,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;QAC3D,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;YACvC,oEAAoE;YACpE,6CAA6C;YAC7C,8DAA8D;YAC9D,MAAM,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;YACzD,2EAA2E;YAC3E,IAAI,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO;gBAC5C,MAAM,IAAI,CAAC,cAAc,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AAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC,CAAA;QACF,IAAI,MAAM,GAAG,CAAC;YACZ,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,UAAU,MAAM,2BAA2B,CAAC,CAAA;IACrE,CAAC;IACD,OAAO,GAAG,EAAE,CAAC;QACX,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,sBAAsB,CAAC,CAAA;IAC5C,CAAC;IAED,4EAA4E;IAC5E,gEAAgE;IAChE,WAAW,EAAE,CAAA;AACf,CAAC;AAED,+EAA+E;AAC/E,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,wDAAwD;AACxD,SAAS,WAAW;IAClB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,KAAK,CAAA;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,qBAAqB,EAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;IACnF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAC7B,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;IACpD,KAAK,CAAC,KAAK,EAAE,CAAA;IACb,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/C,CAAC"}
package/package.json CHANGED
@@ -1,49 +1,66 @@
1
1
  {
2
2
  "name": "@braidhq/server",
3
3
  "type": "module",
4
- "version": "0.0.1",
5
- "description": "Braid REST + (later) MCP server. Hono on Node 20.",
4
+ "version": "0.2.0",
5
+ "description": "REST + SSE server for Braid.",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mroops0111/braid.git",
10
+ "directory": "packages/server"
11
+ },
7
12
  "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "default": "./dist/index.js"
11
- }
13
+ ".": "./src/index.ts"
12
14
  },
13
- "main": "./dist/index.js",
14
- "types": "./dist/index.d.ts",
15
+ "main": "./src/index.ts",
16
+ "types": "./src/index.ts",
15
17
  "files": [
16
18
  "README.md",
17
19
  "dist"
18
20
  ],
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json",
23
+ "bundle": "node scripts/bundle.mjs",
24
+ "typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json",
25
+ "test": "vitest run",
26
+ "test:coverage": "vitest run --coverage",
27
+ "dev": "tsx watch src/server.ts",
28
+ "clean": "rm -rf dist bundle .turbo *.tsbuildinfo coverage"
29
+ },
19
30
  "dependencies": {
20
- "@hono/node-server": "^1.13.0",
21
- "@hono/zod-validator": "^0.4.0",
22
- "hono": "^4.6.0",
23
- "pino": "^9.5.0",
31
+ "@braidhq/agent-claude-code": "workspace:*",
32
+ "@braidhq/core": "workspace:*",
33
+ "@braidhq/ontology-ddd": "workspace:*",
34
+ "@braidhq/schema": "workspace:*",
35
+ "@braidhq/source-loader-gdrive": "workspace:*",
36
+ "@braidhq/source-loader-git": "workspace:*",
37
+ "@braidhq/source-loader-github": "workspace:*",
38
+ "@braidhq/storage-kuzu": "workspace:*",
39
+ "@hono/node-server": "^2.0.12",
40
+ "@hono/zod-openapi": "^1.5.1",
41
+ "@hono/zod-validator": "^0.9.0",
42
+ "hono": "^4.12.32",
43
+ "pino": "^10.3.1",
44
+ "simple-git": "^3.36.0",
24
45
  "yaml": "^2.9.0",
25
- "zod": "^3.24.0",
26
- "@braidhq/core": "0.0.1",
27
- "@braidhq/ontology-ddd": "0.0.1",
28
- "@braidhq/schema": "0.0.1",
29
- "@braidhq/storage-kuzu": "0.0.1",
30
- "@braidhq/source-loader-git": "0.0.1",
31
- "@braidhq/source-loader-gdrive": "0.0.1"
46
+ "zod": "^4.2.1"
32
47
  },
33
48
  "devDependencies": {
34
- "tsx": "^4.19.0",
35
- "typescript": "^5.7.0",
36
- "vitest": "^2.1.0"
49
+ "@braidhq/test-utils": "workspace:*",
50
+ "esbuild": "^0.28.1",
51
+ "tsx": "^4.23.1",
52
+ "typescript": "^6.0.3",
53
+ "vitest": "^4.1.10"
37
54
  },
38
55
  "publishConfig": {
39
- "access": "public"
40
- },
41
- "scripts": {
42
- "build": "tsc -p tsconfig.json",
43
- "typecheck": "tsc -p tsconfig.json --noEmit",
44
- "test": "vitest run",
45
- "test:coverage": "vitest run --coverage",
46
- "dev": "tsx watch src/server.ts",
47
- "clean": "rm -rf dist .turbo *.tsbuildinfo coverage"
56
+ "access": "public",
57
+ "main": "./dist/index.js",
58
+ "types": "./dist/index.d.ts",
59
+ "exports": {
60
+ ".": {
61
+ "types": "./dist/index.d.ts",
62
+ "default": "./dist/index.js"
63
+ }
64
+ }
48
65
  }
49
- }
66
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 mroops0111
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,20 +0,0 @@
1
- import type { AgentEffort } from '@braidhq/schema';
2
- import type { AppDependencies } from './composition.js';
3
- export interface ComposeFsOptions {
4
- /** Where to persist registered workspace paths. Default `$BRAID_HOME` or `~/.braid`. */
5
- readonly braidHome?: string;
6
- /** URL the server reports to spawned subprocesses for REST callbacks. */
7
- readonly apiUrl?: string;
8
- /** Coding-agent model selection (default `opus`). */
9
- readonly agentModel?: string;
10
- /** Coding-agent effort tier (default `high`). */
11
- readonly agentEffort?: AgentEffort;
12
- }
13
- /**
14
- * Production composition root: real filesystem persistence for workspaces /
15
- * proposals / clarify / decisions, built-in skills loaded from `@braidhq/core`,
16
- * Claude Code subprocess agent. Model storage uses Kuzu (embedded, zero-infra)
17
- * per workspace at `<workspace>/.braid/model.kuzu`.
18
- */
19
- export declare function composeFsApp(options?: ComposeFsOptions): AppDependencies;
20
- //# sourceMappingURL=composeFs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composeFs.d.ts","sourceRoot":"","sources":["../src/composeFs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,WAAW,EAAmC,MAAM,iBAAiB,CAAA;AACjG,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AA+BvD,MAAM,WAAW,gBAAgB;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,qDAAqD;IACrD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,iDAAiD;IACjD,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAA;CACnC;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,eAAe,CA4H5E"}
package/dist/composeFs.js DELETED
@@ -1,134 +0,0 @@
1
- import { homedir } from 'node:os';
2
- import { join } from 'node:path';
3
- import process from 'node:process';
4
- import { builtinSkillsRoot, EvidenceValidator, InMemoryWorkspaceEventBus, NotFoundError, OntologyTypeValidator, OrphanEdgeValidator, PluginRegistry, StructuralValidator, } from '@braidhq/core';
5
- import { dddOntology } from '@braidhq/ontology-ddd';
6
- import { GoogleDriveLoader } from '@braidhq/source-loader-gdrive';
7
- import { GitLoader } from '@braidhq/source-loader-git';
8
- import { KuzuModelRepository } from '@braidhq/storage-kuzu';
9
- import { composeApp } from './composition.js';
10
- import { ClaudeCodeAgentBinding } from './infrastructure/agent/ClaudeCodeAgentBinding.js';
11
- import { SubprocessSkillRunner } from './infrastructure/agent/SubprocessSkillRunner.js';
12
- import { FsClarifyTicketRepository } from './infrastructure/fs/FsClarifyTicketRepository.js';
13
- import { FsDecisionRepository } from './infrastructure/fs/FsDecisionRepository.js';
14
- import { FsProposalRepository } from './infrastructure/fs/FsProposalRepository.js';
15
- import { FsRunRepository } from './infrastructure/fs/FsRunRepository.js';
16
- import { FsSkillRegistry } from './infrastructure/fs/FsSkillRegistry.js';
17
- import { FsWorkspaceRepository } from './infrastructure/fs/FsWorkspaceRepository.js';
18
- import { WorkspaceRegistryFile } from './infrastructure/fs/WorkspaceRegistryFile.js';
19
- import { GoogleOAuth } from './infrastructure/oauth/GoogleOAuth.js';
20
- import { FsSecretStore } from './infrastructure/secrets/SecretStore.js';
21
- /**
22
- * Production composition root: real filesystem persistence for workspaces /
23
- * proposals / clarify / decisions, built-in skills loaded from `@braidhq/core`,
24
- * Claude Code subprocess agent. Model storage uses Kuzu (embedded, zero-infra)
25
- * per workspace at `<workspace>/.braid/model.kuzu`.
26
- */
27
- export function composeFsApp(options = {}) {
28
- const braidHome = options.braidHome ?? process.env.BRAID_HOME ?? join(homedir(), '.braid');
29
- const apiUrl = options.apiUrl ?? 'http://localhost:4321';
30
- const secretStore = new FsSecretStore(join(braidHome, 'secrets'));
31
- const googleClientId = process.env.BRAID_GOOGLE_CLIENT_ID;
32
- const googleClientSecret = process.env.BRAID_GOOGLE_CLIENT_SECRET;
33
- const googleRedirect = process.env.BRAID_GOOGLE_REDIRECT_URI ?? `${apiUrl}/oauth/google/callback`;
34
- const googleOAuth = googleClientId && googleClientSecret
35
- ? new GoogleOAuth({ clientId: googleClientId, clientSecret: googleClientSecret, redirectUri: googleRedirect })
36
- : undefined;
37
- const registry = new WorkspaceRegistryFile(join(braidHome, 'workspaces.json'));
38
- const workspaceRepository = new FsWorkspaceRepository({ registry });
39
- const workspaceRoots = async () => {
40
- const workspaces = await workspaceRepository.list();
41
- return new Map(workspaces.map(ws => [ws.id, ws.rootPath]));
42
- };
43
- const proposalRepository = new FsProposalRepository({ workspaceRoots });
44
- const clarifyRepository = new FsClarifyTicketRepository({ workspaceRoots });
45
- const decisionRepository = new FsDecisionRepository({ workspaceRoots });
46
- const modelRepository = new KuzuModelRepository({
47
- resolveDbPath: async (workspaceId) => {
48
- const roots = await workspaceRoots();
49
- const root = roots.get(workspaceId);
50
- if (!root)
51
- throw new NotFoundError(`Workspace "${workspaceId}" not registered`);
52
- return join(root, '.braid', 'model.kuzu');
53
- },
54
- });
55
- const agentBinding = new ClaudeCodeAgentBinding({
56
- id: 'claude-default',
57
- kind: 'claude-code',
58
- model: options.agentModel ?? 'opus',
59
- effort: options.agentEffort ?? 'high',
60
- extraArgs: [],
61
- env: {},
62
- });
63
- const runRepository = new FsRunRepository();
64
- const pluginRegistry = new PluginRegistry();
65
- pluginRegistry.register(dddOntology);
66
- pluginRegistry.register(new EvidenceValidator());
67
- pluginRegistry.register(new OrphanEdgeValidator());
68
- pluginRegistry.register(new OntologyTypeValidator(dddOntology));
69
- pluginRegistry.register(new StructuralValidator(dddOntology));
70
- pluginRegistry.register(new GitLoader());
71
- if (googleOAuth) {
72
- // GoogleDriveLoader requires OAuth to be configured. We resolve the
73
- // access token per (workspaceId, sourceId): read stored tokens from
74
- // the secret store, refresh if expired, persist the rotated access
75
- // token, hand the bearer to the loader.
76
- const oauth = googleOAuth;
77
- pluginRegistry.register(new GoogleDriveLoader({
78
- resolveAccessToken: async ({ workspaceId, sourceId }) => {
79
- const key = `${workspaceId}--${sourceId}`;
80
- const stored = await secretStore.read('oauth-google', key);
81
- if (!stored) {
82
- throw new NotFoundError(`Google Drive source "${sourceId}" on workspace "${workspaceId}" is not connected. `
83
- + `Authorise via POST /oauth/google/start.`);
84
- }
85
- // 60-second skew so we don't hand out a token about to expire mid-request.
86
- const stillValidUntil = new Date(stored.expiresAt).getTime() - 60_000;
87
- if (Date.now() < stillValidUntil)
88
- return stored.accessToken;
89
- const refreshed = await oauth.refreshAccessToken(stored.refreshToken);
90
- await secretStore.write('oauth-google', key, {
91
- ...stored,
92
- accessToken: refreshed.accessToken,
93
- expiresAt: refreshed.expiresAt,
94
- });
95
- return refreshed.accessToken;
96
- },
97
- }));
98
- }
99
- // Built after pluginRegistry is populated so plugin-shipped SKILL.md
100
- // files mount under the `plugin` skill origin alongside builtins.
101
- const skillRegistry = new FsSkillRegistry({
102
- builtinSkillsRoot: builtinSkillsRoot,
103
- pluginRegistry,
104
- });
105
- const eventBus = new InMemoryWorkspaceEventBus();
106
- const skillRunner = new SubprocessSkillRunner({
107
- skillRegistry,
108
- agentBinding,
109
- apiUrl,
110
- runRepository,
111
- eventBus,
112
- referenceDirs: [
113
- { name: 'shared', path: join(builtinSkillsRoot, 'shared') },
114
- ],
115
- });
116
- const deps = composeApp({
117
- workspaceRepository,
118
- proposalRepository,
119
- clarifyRepository,
120
- decisionRepository,
121
- modelRepository,
122
- skillRegistry,
123
- skillRunner,
124
- runRepository,
125
- pluginRegistry,
126
- eventBus,
127
- });
128
- return {
129
- ...deps,
130
- secretStore,
131
- ...(googleOAuth ? { googleOAuth } : {}),
132
- };
133
- }
134
- //# sourceMappingURL=composeFs.js.map
@@ -1 +0,0 @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AI,eAAe,CAAC;QACxC,iBAAiB,EAAE,iBAAiC;QACpD,cAAc;KACf,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,yBAAyB,EAAE,CAAA;IAChD,MAAM,WAAW,GAAG,IAAI,qBAAqB,CAAC;QAC5C,aAAa;QACb,YAAY;QACZ,MAAM;QACN,aAAa;QACb,QAAQ;QACR,aAAa,EAAE;YACb,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAiB,EAAE;SAC5E;KACF,CAAC,CAAA;IAEF,MAAM,IAAI,GAAG,UAAU,CAAC;QACtB,mBAAmB;QACnB,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,eAAe;QACf,aAAa;QACb,WAAW;QACX,aAAa;QACb,cAAc;QACd,QAAQ;KACT,CAAC,CAAA;IACF,OAAO;QACL,GAAG,IAAI;QACP,WAAW;QACX,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAA;AACH,CAAC"}
@@ -1,49 +0,0 @@
1
- import type { ClarifyTicketRepository, Clock, DecisionRepository, ModelRepository, ProposalRepository, RunRepository, SkillRegistry, SkillRunner, WorkspaceEventBus, WorkspaceRepository } from '@braidhq/core';
2
- import type { GoogleOAuth } from './infrastructure/oauth/GoogleOAuth.js';
3
- import type { SecretStore } from './infrastructure/secrets/SecretStore.js';
4
- import { HITLService, ModelService, PluginRegistry, SourceLoaderRunner, ValidationService, WorkspaceService } from '@braidhq/core';
5
- export interface AppDependencies {
6
- workspaceService: WorkspaceService;
7
- hitlService: HITLService;
8
- modelService: ModelService;
9
- validationService: ValidationService;
10
- sourceLoaderRunner: SourceLoaderRunner;
11
- eventBus: WorkspaceEventBus;
12
- pluginRegistry: PluginRegistry;
13
- proposalRepository: ProposalRepository;
14
- clarifyRepository: ClarifyTicketRepository;
15
- decisionRepository: DecisionRepository;
16
- modelRepository: ModelRepository;
17
- workspaceRepository: WorkspaceRepository;
18
- skillRegistry: SkillRegistry | undefined;
19
- skillRunner: SkillRunner | undefined;
20
- runRepository: RunRepository;
21
- /** OAuth secret storage (file-based; pluggable for hosted deployments). */
22
- secretStore?: SecretStore;
23
- /**
24
- * Google OAuth client. Undefined when env vars aren't set; routes
25
- * respond with 503 in that case.
26
- */
27
- googleOAuth?: GoogleOAuth;
28
- clock: Clock;
29
- }
30
- export interface ComposeOptions {
31
- clock?: Clock;
32
- proposalRepository?: ProposalRepository;
33
- clarifyRepository?: ClarifyTicketRepository;
34
- decisionRepository?: DecisionRepository;
35
- modelRepository?: ModelRepository;
36
- workspaceRepository?: WorkspaceRepository;
37
- pluginRegistry?: PluginRegistry;
38
- skillRegistry?: SkillRegistry;
39
- skillRunner?: SkillRunner;
40
- runRepository?: RunRepository;
41
- /**
42
- * Pre-created event bus. Pass the same instance you wired into
43
- * `SubprocessSkillRunner` so subscribers see runner events. Defaults
44
- * to a fresh `InMemoryWorkspaceEventBus` for tests / in-memory boot.
45
- */
46
- eventBus?: WorkspaceEventBus;
47
- }
48
- export declare function composeApp(options?: ComposeOptions): AppDependencies;
49
- //# sourceMappingURL=composition.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,KAAK,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EACL,WAAW,EAOX,YAAY,EAEZ,cAAc,EACd,kBAAkB,EAElB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe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43 +0,0 @@
1
- import { HITLService, InMemoryClarifyTicketRepository, InMemoryDecisionRepository, InMemoryModelRepository, InMemoryProposalRepository, InMemoryWorkspaceEventBus, InMemoryWorkspaceRepository, ModelService, noopRunRepository, PluginRegistry, SourceLoaderRunner, SystemClock, ValidationService, WorkspaceService, } from '@braidhq/core';
2
- export function composeApp(options = {}) {
3
- const clock = options.clock ?? new SystemClock();
4
- const proposalRepository = options.proposalRepository ?? new InMemoryProposalRepository();
5
- const clarifyRepository = options.clarifyRepository ?? new InMemoryClarifyTicketRepository();
6
- const decisionRepository = options.decisionRepository ?? new InMemoryDecisionRepository();
7
- const modelRepository = options.modelRepository ?? new InMemoryModelRepository();
8
- const workspaceRepository = options.workspaceRepository ?? new InMemoryWorkspaceRepository();
9
- const pluginRegistry = options.pluginRegistry ?? new PluginRegistry();
10
- const eventBus = options.eventBus ?? new InMemoryWorkspaceEventBus();
11
- const workspaceService = new WorkspaceService({ workspaceRepository });
12
- const modelService = new ModelService({ modelRepository });
13
- const validationService = new ValidationService({ pluginRegistry });
14
- const sourceLoaderRunner = new SourceLoaderRunner({ pluginRegistry, clock, eventBus });
15
- const hitlService = new HITLService({
16
- proposalRepository,
17
- clarifyRepository,
18
- decisionRepository,
19
- modelRepository,
20
- validationService,
21
- clock,
22
- eventBus,
23
- });
24
- return {
25
- workspaceService,
26
- hitlService,
27
- modelService,
28
- validationService,
29
- sourceLoaderRunner,
30
- eventBus,
31
- pluginRegistry,
32
- proposalRepository,
33
- clarifyRepository,
34
- decisionRepository,
35
- modelRepository,
36
- workspaceRepository,
37
- skillRegistry: options.skillRegistry,
38
- skillRunner: options.skillRunner,
39
- runRepository: options.runRepository ?? noopRunRepository,
40
- clock,
41
- };
42
- }
43
- //# sourceMappingURL=composition.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,WAAW,EACX,+BAA+B,EAC/B,0BAA0B,EAC1B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iB;QACjB,kBAAkB;QAClB,eAAe;QACf,iBAAiB;QACjB,KAAK;QACL,QAAQ;KACT,CAAC,CAAA;IAEF,OAAO;QACL,gBAAgB;QAChB,WAAW;QACX,YAAY;QACZ,iBAAiB;QACjB,kBAAkB;QAClB,QAAQ;QACR,cAAc;QACd,kBAAkB;QAClB,iBAAiB;QACjB,kBAAkB;QAClB,eAAe;QACf,mBAAmB;QACnB,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,iBAAiB;QACzD,KAAK;KACN,CAAA;AACH,CAAC"}
@@ -1,8 +0,0 @@
1
- import type { AgentBinding, AgentSpawnInput, SpawnInvocation } from '@braidhq/core';
2
- import type { AgentBindingDescriptor } from '@braidhq/schema';
3
- export declare class ClaudeCodeAgentBinding implements AgentBinding {
4
- readonly descriptor: AgentBindingDescriptor;
5
- constructor(descriptor: AgentBindingDescriptor);
6
- resolveSpawn(input: AgentSpawnInput): SpawnInvocation;
7
- }
8
- //# sourceMappingURL=ClaudeCodeAgentBinding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClaudeCodeAgentBinding.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/agent/ClaudeCodeAgentBinding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACnF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAG7D,qBAAa,sBAAuB,YAAW,YAAY;IAC7C,QAAQ,CAAC,UAAU,EAAE,sBAAsB;gBAAlC,UAAU,EAAE,sBAAsB;IAMvD,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe;CA6CtD"}