@braidhq/server 0.1.0 → 0.2.1

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 (401) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +134 -106
  3. package/dist/app.d.ts +7 -15
  4. package/dist/app.d.ts.map +1 -1
  5. package/dist/app.js +74 -45
  6. package/dist/app.js.map +1 -1
  7. package/dist/authMode.d.ts +39 -0
  8. package/dist/authMode.d.ts.map +1 -0
  9. package/dist/authMode.js +50 -0
  10. package/dist/authMode.js.map +1 -0
  11. package/dist/composeApp.d.ts +80 -0
  12. package/dist/composeApp.d.ts.map +1 -0
  13. package/dist/composeApp.js +137 -0
  14. package/dist/composeApp.js.map +1 -0
  15. package/dist/composeFsApp.d.ts +27 -0
  16. package/dist/composeFsApp.d.ts.map +1 -0
  17. package/dist/{composeFs.js → composeFsApp.js} +127 -126
  18. package/dist/composeFsApp.js.map +1 -0
  19. package/dist/index.d.ts +3 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +3 -2
  22. package/dist/index.js.map +1 -1
  23. package/dist/infrastructure/_shared/env.d.ts +10 -0
  24. package/dist/infrastructure/_shared/env.d.ts.map +1 -0
  25. package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
  26. package/dist/infrastructure/_shared/env.js.map +1 -0
  27. package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
  28. package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
  29. package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
  30. package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
  31. package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
  32. package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
  33. package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
  34. package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
  35. package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
  36. package/dist/infrastructure/_shared/paths.js.map +1 -0
  37. package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
  38. package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
  39. package/dist/infrastructure/auth/AccessPolicy.js +35 -42
  40. package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
  41. package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
  42. package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
  43. package/dist/infrastructure/auth/SessionStore.js +20 -20
  44. package/dist/infrastructure/auth/SessionStore.js.map +1 -1
  45. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +14 -0
  46. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
  47. package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +9 -7
  48. package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
  49. package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
  50. package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
  51. package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
  52. package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
  53. package/dist/infrastructure/history/commitMessage.js +90 -0
  54. package/dist/infrastructure/history/commitMessage.js.map +1 -0
  55. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
  56. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
  57. package/dist/infrastructure/hitl/FsClarificationRepository.js +40 -0
  58. package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
  59. package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
  60. package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +8 -8
  61. package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
  62. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
  63. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
  64. package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
  65. package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
  66. package/dist/infrastructure/model/FsModelSerializer.d.ts +94 -0
  67. package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
  68. package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
  69. package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
  70. package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
  71. package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
  72. package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
  73. package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
  74. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
  75. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
  76. package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
  77. package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
  78. package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
  79. package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
  80. package/dist/infrastructure/secrets/SecretStore.js +4 -4
  81. package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
  82. package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
  83. package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
  84. package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
  85. package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
  86. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
  87. package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
  88. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
  89. package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
  90. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
  91. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
  92. package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
  93. package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
  94. package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
  95. package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
  96. package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
  97. package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
  98. package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
  99. package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
  100. package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
  101. package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
  102. package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
  103. package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
  104. package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
  105. package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
  106. package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
  107. package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
  108. package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
  109. package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
  110. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
  111. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
  112. package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
  113. package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
  114. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
  115. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
  116. package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
  117. package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
  118. package/dist/infrastructure/source/unitScan.d.ts +11 -0
  119. package/dist/infrastructure/source/unitScan.d.ts.map +1 -0
  120. package/dist/infrastructure/{fs/intentScan.js → source/unitScan.js} +36 -27
  121. package/dist/infrastructure/source/unitScan.js.map +1 -0
  122. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
  123. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts.map +1 -1
  124. package/dist/infrastructure/users/UserDirectoryFromRegistry.js +3 -2
  125. package/dist/infrastructure/users/UserDirectoryFromRegistry.js.map +1 -1
  126. package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
  127. package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
  128. package/dist/infrastructure/users/UserRegistryFile.js +6 -8
  129. package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
  130. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
  131. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
  132. package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
  133. package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
  134. package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
  135. package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
  136. package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
  137. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
  138. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
  139. package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
  140. package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
  141. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
  142. package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
  143. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
  144. package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
  145. package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
  146. package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
  147. package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
  148. package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
  149. package/dist/middleware/auth.d.ts +27 -17
  150. package/dist/middleware/auth.d.ts.map +1 -1
  151. package/dist/middleware/auth.js +69 -53
  152. package/dist/middleware/auth.js.map +1 -1
  153. package/dist/middleware/cors.d.ts.map +1 -1
  154. package/dist/middleware/cors.js +4 -1
  155. package/dist/middleware/cors.js.map +1 -1
  156. package/dist/middleware/error.d.ts.map +1 -1
  157. package/dist/middleware/error.js +15 -13
  158. package/dist/middleware/error.js.map +1 -1
  159. package/dist/middleware/workspaceAccess.d.ts +23 -19
  160. package/dist/middleware/workspaceAccess.d.ts.map +1 -1
  161. package/dist/middleware/workspaceAccess.js +31 -26
  162. package/dist/middleware/workspaceAccess.js.map +1 -1
  163. package/dist/policy/CapabilityCheck.d.ts +5 -5
  164. package/dist/policy/PermissionRegistry.d.ts +11 -9
  165. package/dist/policy/PermissionRegistry.d.ts.map +1 -1
  166. package/dist/policy/PermissionRegistry.js +10 -8
  167. package/dist/policy/PermissionRegistry.js.map +1 -1
  168. package/dist/policy/ViewerContext.d.ts +13 -11
  169. package/dist/policy/ViewerContext.d.ts.map +1 -1
  170. package/dist/policy/checks.d.ts +9 -9
  171. package/dist/policy/checks.d.ts.map +1 -1
  172. package/dist/policy/checks.js +14 -11
  173. package/dist/policy/checks.js.map +1 -1
  174. package/dist/policy/defaultRegistry.d.ts +3 -4
  175. package/dist/policy/defaultRegistry.d.ts.map +1 -1
  176. package/dist/policy/defaultRegistry.js +3 -4
  177. package/dist/policy/defaultRegistry.js.map +1 -1
  178. package/dist/policy/index.d.ts +2 -2
  179. package/dist/policy/index.d.ts.map +1 -1
  180. package/dist/policy/index.js +1 -1
  181. package/dist/policy/index.js.map +1 -1
  182. package/dist/policy/resolveViewer.d.ts +9 -9
  183. package/dist/policy/resolveViewer.js +9 -9
  184. package/dist/routes/_shared.d.ts +93 -153
  185. package/dist/routes/_shared.d.ts.map +1 -1
  186. package/dist/routes/_shared.js +9 -5
  187. package/dist/routes/_shared.js.map +1 -1
  188. package/dist/routes/admin.d.ts +1 -1
  189. package/dist/routes/admin.d.ts.map +1 -1
  190. package/dist/routes/admin.js +13 -12
  191. package/dist/routes/admin.js.map +1 -1
  192. package/dist/routes/auth.d.ts +12 -10
  193. package/dist/routes/auth.d.ts.map +1 -1
  194. package/dist/routes/auth.js +32 -34
  195. package/dist/routes/auth.js.map +1 -1
  196. package/dist/routes/clarifications.d.ts +8 -0
  197. package/dist/routes/clarifications.d.ts.map +1 -0
  198. package/dist/routes/clarifications.js +246 -0
  199. package/dist/routes/clarifications.js.map +1 -0
  200. package/dist/routes/edges.d.ts.map +1 -1
  201. package/dist/routes/edges.js +2 -6
  202. package/dist/routes/edges.js.map +1 -1
  203. package/dist/routes/history.d.ts.map +1 -1
  204. package/dist/routes/history.js +12 -10
  205. package/dist/routes/history.js.map +1 -1
  206. package/dist/routes/nodes.d.ts.map +1 -1
  207. package/dist/routes/nodes.js +4 -8
  208. package/dist/routes/nodes.js.map +1 -1
  209. package/dist/routes/oauth.d.ts +6 -7
  210. package/dist/routes/oauth.d.ts.map +1 -1
  211. package/dist/routes/oauth.js +6 -7
  212. package/dist/routes/oauth.js.map +1 -1
  213. package/dist/routes/ontologies.d.ts +7 -0
  214. package/dist/routes/ontologies.d.ts.map +1 -0
  215. package/dist/routes/ontologies.js +29 -0
  216. package/dist/routes/ontologies.js.map +1 -0
  217. package/dist/routes/ontology.d.ts.map +1 -1
  218. package/dist/routes/ontology.js +2 -1
  219. package/dist/routes/ontology.js.map +1 -1
  220. package/dist/routes/proposals.d.ts +2 -2
  221. package/dist/routes/proposals.d.ts.map +1 -1
  222. package/dist/routes/proposals.js +35 -30
  223. package/dist/routes/proposals.js.map +1 -1
  224. package/dist/routes/reactorCycles.d.ts +7 -0
  225. package/dist/routes/reactorCycles.d.ts.map +1 -0
  226. package/dist/routes/reactorCycles.js +60 -0
  227. package/dist/routes/reactorCycles.js.map +1 -0
  228. package/dist/routes/runs.d.ts.map +1 -1
  229. package/dist/routes/runs.js +22 -19
  230. package/dist/routes/runs.js.map +1 -1
  231. package/dist/routes/skillInputOptions.d.ts +2 -2
  232. package/dist/routes/skillInputOptions.d.ts.map +1 -1
  233. package/dist/routes/skillInputOptions.js +53 -53
  234. package/dist/routes/skillInputOptions.js.map +1 -1
  235. package/dist/routes/skills.d.ts +19 -1
  236. package/dist/routes/skills.d.ts.map +1 -1
  237. package/dist/routes/skills.js +141 -7
  238. package/dist/routes/skills.js.map +1 -1
  239. package/dist/routes/sourceLoaders.d.ts.map +1 -1
  240. package/dist/routes/sourceLoaders.js +1 -0
  241. package/dist/routes/sourceLoaders.js.map +1 -1
  242. package/dist/routes/sourceUnitObservations.d.ts +20 -0
  243. package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
  244. package/dist/routes/sourceUnitObservations.js +80 -0
  245. package/dist/routes/sourceUnitObservations.js.map +1 -0
  246. package/dist/routes/sourceWebhooks.d.ts +26 -0
  247. package/dist/routes/sourceWebhooks.d.ts.map +1 -0
  248. package/dist/routes/sourceWebhooks.js +301 -0
  249. package/dist/routes/sourceWebhooks.js.map +1 -0
  250. package/dist/routes/users.d.ts +0 -2
  251. package/dist/routes/users.d.ts.map +1 -1
  252. package/dist/routes/users.js +15 -33
  253. package/dist/routes/users.js.map +1 -1
  254. package/dist/routes/workspaceEvents.d.ts +5 -4
  255. package/dist/routes/workspaceEvents.d.ts.map +1 -1
  256. package/dist/routes/workspaceEvents.js +7 -6
  257. package/dist/routes/workspaceEvents.js.map +1 -1
  258. package/dist/routes/workspaceMembers.d.ts +1 -1
  259. package/dist/routes/workspaceMembers.d.ts.map +1 -1
  260. package/dist/routes/workspaceMembers.js +2 -2
  261. package/dist/routes/workspaceMembers.js.map +1 -1
  262. package/dist/routes/workspaces.d.ts +21 -10
  263. package/dist/routes/workspaces.d.ts.map +1 -1
  264. package/dist/routes/workspaces.js +95 -69
  265. package/dist/routes/workspaces.js.map +1 -1
  266. package/dist/server.js +6 -70
  267. package/dist/server.js.map +1 -1
  268. package/dist/serviceAccounts.d.ts +13 -0
  269. package/dist/serviceAccounts.d.ts.map +1 -0
  270. package/dist/serviceAccounts.js +26 -0
  271. package/dist/serviceAccounts.js.map +1 -0
  272. package/dist/startServer.d.ts +17 -0
  273. package/dist/startServer.d.ts.map +1 -0
  274. package/dist/startServer.js +81 -0
  275. package/dist/startServer.js.map +1 -0
  276. package/dist/startup.d.ts +28 -0
  277. package/dist/startup.d.ts.map +1 -0
  278. package/dist/startup.js +94 -0
  279. package/dist/startup.js.map +1 -0
  280. package/package.json +35 -40
  281. package/dist/composeFs.d.ts +0 -55
  282. package/dist/composeFs.d.ts.map +0 -1
  283. package/dist/composeFs.js.map +0 -1
  284. package/dist/composition.d.ts +0 -133
  285. package/dist/composition.d.ts.map +0 -1
  286. package/dist/composition.js +0 -113
  287. package/dist/composition.js.map +0 -1
  288. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
  289. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
  290. package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
  291. package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
  292. package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
  293. package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
  294. package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
  295. package/dist/infrastructure/agent/mcpConfig.js +0 -55
  296. package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
  297. package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
  298. package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
  299. package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
  300. package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
  301. package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
  302. package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
  303. package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
  304. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
  305. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
  306. package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
  307. package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
  308. package/dist/infrastructure/env.d.ts +0 -11
  309. package/dist/infrastructure/env.d.ts.map +0 -1
  310. package/dist/infrastructure/env.js.map +0 -1
  311. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
  312. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
  313. package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
  314. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
  315. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
  316. package/dist/infrastructure/fs/FsClarifyTicketRepository.js +0 -39
  317. package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
  318. package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
  319. package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
  320. package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
  321. package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
  322. package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
  323. package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
  324. package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
  325. package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
  326. package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
  327. package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
  328. package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
  329. package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
  330. package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
  331. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
  332. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
  333. package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
  334. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
  335. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
  336. package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
  337. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
  338. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
  339. package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
  340. package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
  341. package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
  342. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
  343. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
  344. package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
  345. package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
  346. package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
  347. package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
  348. package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
  349. package/dist/infrastructure/fs/frontmatter.js.map +0 -1
  350. package/dist/infrastructure/fs/intentScan.d.ts +0 -9
  351. package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
  352. package/dist/infrastructure/fs/intentScan.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.map +0 -1
  356. package/dist/infrastructure/fs/paths.js.map +0 -1
  357. package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
  358. package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
  359. package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
  360. package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
  361. package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
  362. package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
  363. package/dist/infrastructure/git/commitMessage.js +0 -71
  364. package/dist/infrastructure/git/commitMessage.js.map +0 -1
  365. package/dist/infrastructure/orphanReaper.d.ts +0 -18
  366. package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
  367. package/dist/infrastructure/orphanReaper.js.map +0 -1
  368. package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
  369. package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
  370. package/dist/infrastructure/users/ensureLocalUser.js +0 -38
  371. package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
  372. package/dist/middleware/requireAdmin.d.ts +0 -10
  373. package/dist/middleware/requireAdmin.d.ts.map +0 -1
  374. package/dist/middleware/requireAdmin.js +0 -24
  375. package/dist/middleware/requireAdmin.js.map +0 -1
  376. package/dist/middleware/userId.d.ts +0 -16
  377. package/dist/middleware/userId.d.ts.map +0 -1
  378. package/dist/middleware/userId.js +0 -27
  379. package/dist/middleware/userId.js.map +0 -1
  380. package/dist/policy/Capability.d.ts +0 -12
  381. package/dist/policy/Capability.d.ts.map +0 -1
  382. package/dist/policy/Capability.js +0 -31
  383. package/dist/policy/Capability.js.map +0 -1
  384. package/dist/routes/clarify.d.ts +0 -9
  385. package/dist/routes/clarify.d.ts.map +0 -1
  386. package/dist/routes/clarify.js +0 -274
  387. package/dist/routes/clarify.js.map +0 -1
  388. package/dist/routes/decisions.d.ts +0 -7
  389. package/dist/routes/decisions.d.ts.map +0 -1
  390. package/dist/routes/decisions.js +0 -68
  391. package/dist/routes/decisions.js.map +0 -1
  392. package/dist/routes/sourceUnitStates.d.ts +0 -7
  393. package/dist/routes/sourceUnitStates.d.ts.map +0 -1
  394. package/dist/routes/sourceUnitStates.js +0 -45
  395. package/dist/routes/sourceUnitStates.js.map +0 -1
  396. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
  397. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
  398. /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
  399. /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
  400. /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
  401. /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
@@ -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"}
@@ -0,0 +1,50 @@
1
+ import { userInfo } from 'node:os';
2
+ import process from 'node:process';
3
+ import { UserId as UserIdSchema } from '@braidhq/schema';
4
+ export const LOCAL_USER_ID = UserIdSchema.parse('local-user');
5
+ /**
6
+ * A local desktop or sidecar. One implicit user owns everything,
7
+ * so provision seeds that `local-user` admin account, idempotently.
8
+ */
9
+ export const localTrust = {
10
+ defaultPrincipal: LOCAL_USER_ID,
11
+ requiresAuth: false,
12
+ async provision({ userRegistry }) {
13
+ if (await userRegistry.get(LOCAL_USER_ID))
14
+ return;
15
+ await userRegistry.create({
16
+ id: LOCAL_USER_ID,
17
+ displayName: osUsername(),
18
+ serverRole: 'admin',
19
+ createdAt: new Date().toISOString(),
20
+ });
21
+ },
22
+ };
23
+ /**
24
+ * A remote server. Real users authenticate against an allowlist,
25
+ * so provision back-fills `approvedEmails` from the roster, idempotently.
26
+ */
27
+ export const authenticated = {
28
+ defaultPrincipal: null,
29
+ requiresAuth: true,
30
+ async provision({ userRegistry, accessPolicy }) {
31
+ for (const user of await userRegistry.list()) {
32
+ if (user.email)
33
+ await accessPolicy.approveEmail(user.email);
34
+ }
35
+ },
36
+ };
37
+ // Default display name from the OS account.
38
+ // Some sandboxed environments throw on userInfo(), so fall through.
39
+ function osUsername() {
40
+ try {
41
+ const info = userInfo();
42
+ if (info.username && info.username.length > 0)
43
+ return info.username;
44
+ }
45
+ catch {
46
+ // The userInfo lookup can throw, fall through to the env vars below.
47
+ }
48
+ return process.env.USER ?? process.env.USERNAME ?? 'local';
49
+ }
50
+ //# sourceMappingURL=authMode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authMode.js","sourceRoot":"","sources":["../src/authMode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAClC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;AA6B7D;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAa;IAClC,gBAAgB,EAAE,aAAa;IAC/B,YAAY,EAAE,KAAK;IACnB,KAAK,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE;QAC9B,IAAI,MAAM,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC;YACvC,OAAM;QACR,MAAM,YAAY,CAAC,MAAM,CAAC;YACxB,EAAE,EAAE,aAAa;YACjB,WAAW,EAAE,UAAU,EAAE;YACzB,UAAU,EAAE,OAAO;YACnB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAe;SACjD,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAa;IACrC,gBAAgB,EAAE,IAAI;IACtB,YAAY,EAAE,IAAI;IAClB,KAAK,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE;QAC5C,KAAK,MAAM,IAAI,IAAI,MAAM,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC;YAC7C,IAAI,IAAI,CAAC,KAAK;gBACZ,MAAM,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/C,CAAC;IACH,CAAC;CACF,CAAA;AAED,4CAA4C;AAC5C,oEAAoE;AACpE,SAAS,UAAU;IACjB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAA;QACvB,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC;YAC3C,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;IACD,MAAM,CAAC;QACL,qEAAqE;IACvE,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAA;AAC5D,CAAC"}
@@ -0,0 +1,80 @@
1
+ import type { BatchPlanRepository, ClarificationRepository, Clock, ModelRepository, ModelSerializer, ProposalRepository, ReactorCycleRepository, RunRepository, SkillRegistry, SkillRunner, SourceUnitDigest, SourceUnitObservationRepository, UnitLister, UserDirectory, WorkspaceBootstrapService, WorkspaceEventBus, WorkspaceHistory, WorkspaceRepository } from '@braidhq/core';
2
+ import type { AbsolutePath } from '@braidhq/schema';
3
+ import type { AuthMode } from './authMode.js';
4
+ import type { AccessPolicy } from './infrastructure/auth/AccessPolicy.js';
5
+ import type { SessionStore } from './infrastructure/auth/SessionStore.js';
6
+ import type { GoogleOAuth } from './infrastructure/oauth/GoogleOAuth.js';
7
+ import type { SecretStore } from './infrastructure/secrets/SecretStore.js';
8
+ import type { UserRegistryFile } from './infrastructure/users/UserRegistryFile.js';
9
+ import type { WorkspaceRegistryFile } from './infrastructure/workspace/WorkspaceRegistryFile.js';
10
+ import { BatchService, HistoryService, HITLService, ModelService, ModelValidationService, PluginRegistry, ReactorService, SourceLoaderRunner, SourceUnitObservationService, WorkspaceService } from '@braidhq/core';
11
+ /**
12
+ * The assembled application, what routes and middleware consume.
13
+ * A required field is always present.
14
+ * An optional field is a capability slot,
15
+ * absent under in-memory or test wiring, filled by `composeFsApp`.
16
+ */
17
+ export interface AppDependencies {
18
+ workspaceService: WorkspaceService;
19
+ hitlService: HITLService;
20
+ modelService: ModelService;
21
+ modelValidationService: ModelValidationService;
22
+ sourceLoaderRunner: SourceLoaderRunner;
23
+ sourceUnitObservationService: SourceUnitObservationService;
24
+ historyService?: HistoryService;
25
+ batchService?: BatchService;
26
+ reactorService?: ReactorService;
27
+ modelRepository: ModelRepository;
28
+ workspaceRepository: WorkspaceRepository;
29
+ proposalRepository: ProposalRepository;
30
+ clarificationRepository: ClarificationRepository;
31
+ runRepository: RunRepository;
32
+ reactorCycleRepository: ReactorCycleRepository;
33
+ unitLister?: UnitLister;
34
+ sourceUnitDigest?: SourceUnitDigest;
35
+ skillRegistry: SkillRegistry | undefined;
36
+ skillRunner: SkillRunner | undefined;
37
+ eventBus: WorkspaceEventBus;
38
+ pluginRegistry: PluginRegistry;
39
+ clock: Clock;
40
+ workspacesRoot: AbsolutePath;
41
+ bootstrap?: WorkspaceBootstrapService;
42
+ authMode: AuthMode;
43
+ userRegistry?: UserRegistryFile;
44
+ workspaceRegistry?: WorkspaceRegistryFile;
45
+ sessionStore?: SessionStore;
46
+ accessPolicy?: AccessPolicy;
47
+ secretStore?: SecretStore;
48
+ googleOAuth?: GoogleOAuth;
49
+ studioUrl?: string;
50
+ }
51
+ /**
52
+ * Every field is optional, an unset one falls to an in-memory default.
53
+ * `composeFsApp` passes the fs, git, and vendor adapters through here.
54
+ */
55
+ export interface ComposeOptions {
56
+ clock?: Clock;
57
+ eventBus?: WorkspaceEventBus;
58
+ pluginRegistry?: PluginRegistry;
59
+ modelRepository?: ModelRepository;
60
+ workspaceRepository?: WorkspaceRepository;
61
+ proposalRepository?: ProposalRepository;
62
+ clarificationRepository?: ClarificationRepository;
63
+ runRepository?: RunRepository;
64
+ reactorCycleRepository?: ReactorCycleRepository;
65
+ sourceUnitObservationRepository?: SourceUnitObservationRepository;
66
+ batchPlanRepository?: BatchPlanRepository;
67
+ unitLister?: UnitLister;
68
+ sourceUnitDigest?: SourceUnitDigest;
69
+ reactorToken?: () => Promise<string | undefined>;
70
+ skillRegistry?: SkillRegistry;
71
+ skillRunner?: SkillRunner;
72
+ history?: WorkspaceHistory;
73
+ modelSerializer?: ModelSerializer;
74
+ bootstrap?: WorkspaceBootstrapService;
75
+ userDirectory?: UserDirectory;
76
+ authMode?: AuthMode;
77
+ workspacesRoot?: AbsolutePath;
78
+ }
79
+ export declare function composeApp(options?: ComposeOptions): AppDependencies;
80
+ //# sourceMappingURL=composeApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeApp.d.ts","sourceRoot":"","sources":["../src/composeApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,EACL,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,+BAA+B,EAC/B,UAAU,EACV,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,YAAY,EAAE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AAE,WAAW,CAAA;IAIzB,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,SAAS,CAAC,EAAE,yBAAyB,CAAA;IAErC,aAAa,CAAC,EAAE,aAAa,CAAA;IAG7B,QAAQ,CAAC,EAAE,QAAQ,CAAA;IAEnB,cAAc,CAAC,EAAE,YAAY,CAAA;CAC9B;AAED,wBAAgB,UAAU,CAAC,OAAO,GAAE,cAAmB,GAAG,eAAe,CAgIxE"}
@@ -0,0 +1,137 @@
1
+ import { tmpdir } from 'node:os';
2
+ import { join } from 'node:path';
3
+ import { BatchService, createLogger, HistoryService, HITLService, ModelService, ModelValidationService, PluginRegistry, ReactorService, SourceLoaderRunner, SourceUnitObservationService, SystemClock, SystemScheduler, WorkspaceLock, WorkspaceService, } from '@braidhq/core';
4
+ import { InMemoryClarificationRepository, InMemoryModelRepository, InMemoryProposalRepository, InMemoryReactorCycleRepository, InMemorySourceUnitObservationRepository, InMemoryWorkspaceEventBus, InMemoryWorkspaceRepository, NoopRunRepository, } from '@braidhq/core/in-memory';
5
+ import { localTrust } from './authMode.js';
6
+ export function composeApp(options = {}) {
7
+ const clock = options.clock ?? new SystemClock();
8
+ const proposalRepository = options.proposalRepository ?? new InMemoryProposalRepository();
9
+ const clarificationRepository = options.clarificationRepository ?? new InMemoryClarificationRepository();
10
+ const modelRepository = options.modelRepository ?? new InMemoryModelRepository();
11
+ const workspaceRepository = options.workspaceRepository ?? new InMemoryWorkspaceRepository();
12
+ const pluginRegistry = options.pluginRegistry ?? new PluginRegistry();
13
+ const eventBus = options.eventBus ?? new InMemoryWorkspaceEventBus();
14
+ const workspaceService = new WorkspaceService({ workspaceRepository, pluginRegistry });
15
+ const modelService = new ModelService({ modelRepository });
16
+ const modelValidationService = new ModelValidationService({ pluginRegistry });
17
+ const sourceLoaderRunner = new SourceLoaderRunner({ pluginRegistry, clock, eventBus });
18
+ // Shared lock domain so HITL mutations and history restore exclude each other.
19
+ const workspaceLock = new WorkspaceLock();
20
+ const hitlService = new HITLService({
21
+ proposalRepository,
22
+ clarificationRepository,
23
+ modelRepository,
24
+ modelValidationService,
25
+ workspaceService,
26
+ clock,
27
+ eventBus,
28
+ workspaceLock,
29
+ ...(options.history ? { history: options.history } : {}),
30
+ ...(options.modelSerializer ? { modelSerializer: options.modelSerializer } : {}),
31
+ ...(options.userDirectory ? { userDirectory: options.userDirectory } : {}),
32
+ });
33
+ const historyService = options.history && options.bootstrap
34
+ ? new HistoryService({
35
+ history: options.history,
36
+ workspaceService,
37
+ workspaceLock,
38
+ bootstrap: options.bootstrap,
39
+ runRepository: options.runRepository ?? new NoopRunRepository(),
40
+ ...(options.skillRunner ? { skillRunner: options.skillRunner } : {}),
41
+ ...(options.userDirectory ? { userDirectory: options.userDirectory } : {}),
42
+ eventBus,
43
+ clock,
44
+ })
45
+ : undefined;
46
+ const sourceUnitObservationRepository = options.sourceUnitObservationRepository ?? new InMemorySourceUnitObservationRepository();
47
+ const sourceUnitDigest = options.sourceUnitDigest ?? new FailingSourceUnitDigest();
48
+ const sourceUnitObservationService = new SourceUnitObservationService({
49
+ repository: sourceUnitObservationRepository,
50
+ digest: sourceUnitDigest,
51
+ workspaceService,
52
+ clock,
53
+ });
54
+ // Batch needs SkillRunner, HistoryService, BatchPlanRepository, and a lister.
55
+ // Without them there is no batch surface.
56
+ const batchService = historyService && options.skillRunner && options.batchPlanRepository && options.unitLister
57
+ ? new BatchService({
58
+ workspaceService,
59
+ skillRunner: options.skillRunner,
60
+ proposalRepository,
61
+ clarificationRepository,
62
+ historyService,
63
+ hitlService,
64
+ batchPlanRepository: options.batchPlanRepository,
65
+ unitLister: options.unitLister,
66
+ pluginRegistry,
67
+ eventBus,
68
+ workspaceLock,
69
+ clock,
70
+ sourceUnitObservationService,
71
+ })
72
+ : undefined;
73
+ // Reactor shares Batch's dependency footprint of skillRunner, unitLister,
74
+ // and sourceUnitObservationService, plus the event bus.
75
+ // We construct it whenever those are present.
76
+ // The service stays inert until something calls `start(workspaceId)`.
77
+ // `composeFsApp` drives start on workspaces,
78
+ // whose ProductManifest.reactor.enabled is true.
79
+ const reactorCycleRepository = options.reactorCycleRepository ?? new InMemoryReactorCycleRepository();
80
+ const reactorService = options.skillRunner && options.unitLister && sourceUnitDigest && !(sourceUnitDigest instanceof FailingSourceUnitDigest)
81
+ ? new ReactorService({
82
+ eventBus,
83
+ workspaceService,
84
+ pluginRegistry,
85
+ skillRunner: options.skillRunner,
86
+ sourceUnitObservationService,
87
+ unitLister: options.unitLister,
88
+ ...(options.reactorToken ? { reactorToken: options.reactorToken } : {}),
89
+ digest: sourceUnitDigest,
90
+ reactorCycleRepository,
91
+ workspaceLock,
92
+ clock,
93
+ logger: createLogger('reactor'),
94
+ scheduler: new SystemScheduler(),
95
+ })
96
+ : undefined;
97
+ return {
98
+ workspaceService,
99
+ hitlService,
100
+ ...(historyService ? { historyService } : {}),
101
+ ...(batchService ? { batchService } : {}),
102
+ ...(reactorService ? { reactorService } : {}),
103
+ reactorCycleRepository,
104
+ ...(options.unitLister ? { unitLister: options.unitLister } : {}),
105
+ ...(options.sourceUnitDigest ? { sourceUnitDigest: options.sourceUnitDigest } : {}),
106
+ ...(options.bootstrap ? { bootstrap: options.bootstrap } : {}),
107
+ sourceUnitObservationService,
108
+ modelService,
109
+ modelValidationService,
110
+ sourceLoaderRunner,
111
+ eventBus,
112
+ pluginRegistry,
113
+ proposalRepository,
114
+ clarificationRepository,
115
+ modelRepository,
116
+ workspaceRepository,
117
+ skillRegistry: options.skillRegistry,
118
+ skillRunner: options.skillRunner,
119
+ runRepository: options.runRepository ?? new NoopRunRepository(),
120
+ workspacesRoot: options.workspacesRoot ?? join(tmpdir(), 'braid-workspaces'),
121
+ // `composeApp` is the test and in-memory composition entry.
122
+ // It defaults to local trust, the local-user fallback,
123
+ // so a test that wires a sessionStore still resolves a caller.
124
+ authMode: options.authMode ?? localTrust,
125
+ clock,
126
+ };
127
+ }
128
+ // Default `SourceUnitDigest` for in-memory `composeApp()` callers. Any call throws.
129
+ // Production must wire a real impl via `composeFsApp` or pass one explicitly.
130
+ // Tests that don't exercise observations stay happy,
131
+ // because the digest is never reached.
132
+ class FailingSourceUnitDigest {
133
+ async computeSha() {
134
+ throw new Error('SourceUnitDigest is not wired. Pass `sourceUnitDigest` to composeApp() (composeFsApp does this automatically).');
135
+ }
136
+ }
137
+ //# sourceMappingURL=composeApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeApp.js","sourceRoot":"","sources":["../src/composeApp.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,WAAW,EACX,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,+BAA+B,EAC/B,uBAAuB,EACvB,0BAA0B,EAC1B,8BAA8B,EAC9B,uCAAuC,EACvC,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AA4H1C,MAAM,UAAU,UAAU,CAAC,UAA0B,EAAE;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,WAAW,EAAE,CAAA;IAChD,MAAM,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,IAAI,IAAI,0BAA0B,EAAE,CAAA;IACzF,MAAM,uBAAuB,GAAG,OAAO,CAAC,uBAAuB,IAAI,IAAI,+BAA+B,EAAE,CAAA;IACxG,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,uBAAuB,EAAE,CAAA;IAChF,MAAM,mBAAmB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C,CAAC,CAAC,EAAE,CAAC;QACjE,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnF,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,4BAA4B;QAC5B,YAAY;QACZ,sBAAsB;QACtB,kBAAkB;QAClB,QAAQ;QACR,cAAc;QACd,kBAAkB;QAClB,uBAAuB;QACvB,eAAe;QACf,mBAAmB;QACnB,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI,iBAAiB,EAAE;QAC/D,cAAc,EAAE,OAAO,CAAC,cAAc,IAAK,IAAI,CAAC,MAAM,EAAE,EAAE,kBAAkB,CAAkB;QAC9F,4DAA4D;QAC5D,uDAAuD;QACvD,+DAA+D;QAC/D,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,UAAU;QACxC,KAAK;KACN,CAAA;AACH,CAAC;AAED,oFAAoF;AACpF,8EAA8E;AAC9E,qDAAqD;AACrD,uCAAuC;AACvC,MAAM,uBAAuB;IAC3B,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,KAAK,CACb,gHAAgH,CACjH,CAAA;IACH,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ import type { AgentPlugin, OntologyPlugin, SourceLoaderPlugin, StoragePlugin } from '@braidhq/core';
2
+ import type { AgentEffort, StorageKind } from '@braidhq/schema';
3
+ import type { AppDependencies } from './composeApp.js';
4
+ import { AgentKind } from '@braidhq/schema';
5
+ export interface ComposeFsOptions {
6
+ readonly braidHome?: string;
7
+ readonly apiUrl?: string;
8
+ readonly storageKind?: StorageKind;
9
+ readonly agentKind?: AgentKind;
10
+ readonly agentModel?: string;
11
+ readonly agentEffort?: AgentEffort;
12
+ readonly extraStoragePlugins?: readonly StoragePlugin[];
13
+ readonly extraOntologyPlugins?: readonly OntologyPlugin[];
14
+ readonly extraSourceLoaderPlugins?: readonly SourceLoaderPlugin[];
15
+ readonly extraAgentPlugins?: readonly AgentPlugin[];
16
+ }
17
+ /**
18
+ * Opinionated production composition, the coding preset.
19
+ * Filesystem-persists workspaces, proposals, and clarifications,
20
+ * and bundles Kuzu storage, the DDD ontology, the git, github, and drive
21
+ * loaders, and the claude-code agent.
22
+ *
23
+ * To run a different plugin set, either pass `extraXxxPlugins` and flip
24
+ * `storageKind` or `agentKind`, or call `composeApp` with your own registry.
25
+ */
26
+ export declare function composeFsApp(options?: ComposeFsOptions): Promise<AppDependencies>;
27
+ //# sourceMappingURL=composeFsApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeFsApp.d.ts","sourceRoot":"","sources":["../src/composeFsApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACnG,OAAO,KAAK,EAAwC,WAAW,EAAE,WAAW,EAAe,MAAM,iBAAiB,CAAA;AAClH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAgBtD,OAAO,EAAW,SAAS,EAAoC,MAAM,iBAAiB,CAAA;AAyCtF,MAAM,WAAW,gBAAgB;IAI/B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IAIxB,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAA;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAA;IAKlC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,SAAS,aAAa,EAAE,CAAA;IACvD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IACzD,QAAQ,CAAC,wBAAwB,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IACjE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,WAAW,EAAE,CAAA;CACpD;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAqR3F"}