@braidhq/server 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (385) hide show
  1. package/README.md +134 -106
  2. package/dist/app.d.ts +7 -15
  3. package/dist/app.d.ts.map +1 -1
  4. package/dist/app.js +72 -45
  5. package/dist/app.js.map +1 -1
  6. package/dist/authMode.d.ts +39 -0
  7. package/dist/authMode.d.ts.map +1 -0
  8. package/dist/authMode.js +50 -0
  9. package/dist/authMode.js.map +1 -0
  10. package/dist/composeApp.d.ts +79 -0
  11. package/dist/composeApp.d.ts.map +1 -0
  12. package/dist/composeApp.js +136 -0
  13. package/dist/composeApp.js.map +1 -0
  14. package/dist/composeFsApp.d.ts +27 -0
  15. package/dist/composeFsApp.d.ts.map +1 -0
  16. package/dist/{composeFs.js → composeFsApp.js} +118 -125
  17. package/dist/composeFsApp.js.map +1 -0
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +3 -2
  21. package/dist/index.js.map +1 -1
  22. package/dist/infrastructure/_shared/env.d.ts +10 -0
  23. package/dist/infrastructure/_shared/env.d.ts.map +1 -0
  24. package/dist/infrastructure/{env.js → _shared/env.js} +5 -6
  25. package/dist/infrastructure/_shared/env.js.map +1 -0
  26. package/dist/infrastructure/_shared/frontmatter.d.ts +13 -0
  27. package/dist/infrastructure/_shared/frontmatter.d.ts.map +1 -0
  28. package/dist/infrastructure/{fs → _shared}/frontmatter.js +5 -5
  29. package/dist/infrastructure/_shared/frontmatter.js.map +1 -0
  30. package/dist/infrastructure/_shared/jsonFileStore.d.ts.map +1 -0
  31. package/dist/infrastructure/_shared/jsonFileStore.js.map +1 -0
  32. package/dist/infrastructure/{fs → _shared}/paths.d.ts +17 -10
  33. package/dist/infrastructure/_shared/paths.d.ts.map +1 -0
  34. package/dist/infrastructure/{fs → _shared}/paths.js +27 -20
  35. package/dist/infrastructure/_shared/paths.js.map +1 -0
  36. package/dist/infrastructure/auth/AccessPolicy.d.ts +33 -58
  37. package/dist/infrastructure/auth/AccessPolicy.d.ts.map +1 -1
  38. package/dist/infrastructure/auth/AccessPolicy.js +35 -42
  39. package/dist/infrastructure/auth/AccessPolicy.js.map +1 -1
  40. package/dist/infrastructure/auth/SessionStore.d.ts +22 -12
  41. package/dist/infrastructure/auth/SessionStore.d.ts.map +1 -1
  42. package/dist/infrastructure/auth/SessionStore.js +15 -18
  43. package/dist/infrastructure/auth/SessionStore.js.map +1 -1
  44. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts +79 -0
  45. package/dist/infrastructure/batch/FsBatchPlanRepository.d.ts.map +1 -0
  46. package/dist/infrastructure/{fs → batch}/FsBatchPlanRepository.js +1 -1
  47. package/dist/infrastructure/batch/FsBatchPlanRepository.js.map +1 -0
  48. package/dist/infrastructure/history/GitWorkspaceHistory.d.ts.map +1 -0
  49. package/dist/infrastructure/{git → history}/GitWorkspaceHistory.js +31 -24
  50. package/dist/infrastructure/history/GitWorkspaceHistory.js.map +1 -0
  51. package/dist/infrastructure/history/commitMessage.d.ts.map +1 -0
  52. package/dist/infrastructure/history/commitMessage.js +90 -0
  53. package/dist/infrastructure/history/commitMessage.js.map +1 -0
  54. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts +13 -0
  55. package/dist/infrastructure/hitl/FsClarificationRepository.d.ts.map +1 -0
  56. package/dist/infrastructure/{fs/FsClarifyTicketRepository.js → hitl/FsClarificationRepository.js} +15 -15
  57. package/dist/infrastructure/hitl/FsClarificationRepository.js.map +1 -0
  58. package/dist/infrastructure/hitl/FsProposalRepository.d.ts.map +1 -0
  59. package/dist/infrastructure/{fs → hitl}/FsProposalRepository.js +7 -8
  60. package/dist/infrastructure/hitl/FsProposalRepository.js.map +1 -0
  61. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts +30 -0
  62. package/dist/infrastructure/hitl/StatusedJsonStore.d.ts.map +1 -0
  63. package/dist/infrastructure/{fs/FsStatusedJsonRepository.js → hitl/StatusedJsonStore.js} +3 -3
  64. package/dist/infrastructure/hitl/StatusedJsonStore.js.map +1 -0
  65. package/dist/infrastructure/model/FsModelSerializer.d.ts +96 -0
  66. package/dist/infrastructure/model/FsModelSerializer.d.ts.map +1 -0
  67. package/dist/infrastructure/{fs/FsGraphSerializer.js → model/FsModelSerializer.js} +11 -11
  68. package/dist/infrastructure/model/FsModelSerializer.js.map +1 -0
  69. package/dist/infrastructure/oauth/GoogleOAuth.d.ts +20 -38
  70. package/dist/infrastructure/oauth/GoogleOAuth.d.ts.map +1 -1
  71. package/dist/infrastructure/oauth/GoogleOAuth.js +21 -22
  72. package/dist/infrastructure/oauth/GoogleOAuth.js.map +1 -1
  73. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts +29 -0
  74. package/dist/infrastructure/reactor/FsReactorCycleRepository.d.ts.map +1 -0
  75. package/dist/infrastructure/reactor/FsReactorCycleRepository.js +94 -0
  76. package/dist/infrastructure/reactor/FsReactorCycleRepository.js.map +1 -0
  77. package/dist/infrastructure/secrets/SecretStore.d.ts +11 -14
  78. package/dist/infrastructure/secrets/SecretStore.d.ts.map +1 -1
  79. package/dist/infrastructure/secrets/SecretStore.js +4 -4
  80. package/dist/infrastructure/secrets/SecretStore.js.map +1 -1
  81. package/dist/infrastructure/{fs → skill}/FsRunRepository.d.ts +5 -3
  82. package/dist/infrastructure/skill/FsRunRepository.d.ts.map +1 -0
  83. package/dist/infrastructure/{fs → skill}/FsRunRepository.js +11 -9
  84. package/dist/infrastructure/skill/FsRunRepository.js.map +1 -0
  85. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.d.ts +4 -13
  86. package/dist/infrastructure/skill/FsSkillRegistry.d.ts.map +1 -0
  87. package/dist/infrastructure/{fs → skill}/FsSkillRegistry.js +28 -20
  88. package/dist/infrastructure/skill/FsSkillRegistry.js.map +1 -0
  89. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts +52 -0
  90. package/dist/infrastructure/skill/SubprocessSkillRunner.d.ts.map +1 -0
  91. package/dist/infrastructure/{agent → skill}/SubprocessSkillRunner.js +107 -55
  92. package/dist/infrastructure/skill/SubprocessSkillRunner.js.map +1 -0
  93. package/dist/infrastructure/skill/asyncQueue.d.ts +20 -0
  94. package/dist/infrastructure/skill/asyncQueue.d.ts.map +1 -0
  95. package/dist/infrastructure/{agent → skill}/asyncQueue.js +2 -3
  96. package/dist/infrastructure/{agent → skill}/asyncQueue.js.map +1 -1
  97. package/dist/infrastructure/skill/lineBuffer.d.ts +15 -0
  98. package/dist/infrastructure/skill/lineBuffer.d.ts.map +1 -0
  99. package/dist/infrastructure/{agent/streamJsonParser.js → skill/lineBuffer.js} +5 -17
  100. package/dist/infrastructure/skill/lineBuffer.js.map +1 -0
  101. package/dist/infrastructure/skill/orphanReaper.d.ts +20 -0
  102. package/dist/infrastructure/skill/orphanReaper.d.ts.map +1 -0
  103. package/dist/infrastructure/{orphanReaper.js → skill/orphanReaper.js} +7 -5
  104. package/dist/infrastructure/skill/orphanReaper.js.map +1 -0
  105. package/dist/infrastructure/skill/subprocessEventStream.d.ts +16 -0
  106. package/dist/infrastructure/skill/subprocessEventStream.d.ts.map +1 -0
  107. package/dist/infrastructure/skill/subprocessEventStream.js +29 -0
  108. package/dist/infrastructure/skill/subprocessEventStream.js.map +1 -0
  109. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts +19 -0
  110. package/dist/infrastructure/source/FsSourceUnitDigest.d.ts.map +1 -0
  111. package/dist/infrastructure/{fs → source}/FsSourceUnitDigest.js +9 -9
  112. package/dist/infrastructure/source/FsSourceUnitDigest.js.map +1 -0
  113. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts +31 -0
  114. package/dist/infrastructure/source/FsSourceUnitObservationRepository.d.ts.map +1 -0
  115. package/dist/infrastructure/{fs/FsSourceUnitStateRepository.js → source/FsSourceUnitObservationRepository.js} +18 -17
  116. package/dist/infrastructure/source/FsSourceUnitObservationRepository.js.map +1 -0
  117. package/dist/infrastructure/{fs → source}/intentScan.d.ts +4 -0
  118. package/dist/infrastructure/source/intentScan.d.ts.map +1 -0
  119. package/dist/infrastructure/{fs → source}/intentScan.js +18 -16
  120. package/dist/infrastructure/source/intentScan.js.map +1 -0
  121. package/dist/infrastructure/users/UserDirectoryFromRegistry.d.ts +2 -2
  122. package/dist/infrastructure/users/UserDirectoryFromRegistry.js +2 -2
  123. package/dist/infrastructure/users/UserRegistryFile.d.ts +4 -5
  124. package/dist/infrastructure/users/UserRegistryFile.d.ts.map +1 -1
  125. package/dist/infrastructure/users/UserRegistryFile.js +6 -8
  126. package/dist/infrastructure/users/UserRegistryFile.js.map +1 -1
  127. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts +9 -6
  128. package/dist/infrastructure/users/ensureWorkspaceOwners.d.ts.map +1 -1
  129. package/dist/infrastructure/users/ensureWorkspaceOwners.js +10 -7
  130. package/dist/infrastructure/users/ensureWorkspaceOwners.js.map +1 -1
  131. package/dist/infrastructure/workspace/FsWorkspaceRepository.d.ts.map +1 -0
  132. package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.js +7 -6
  133. package/dist/infrastructure/workspace/FsWorkspaceRepository.js.map +1 -0
  134. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts +18 -0
  135. package/dist/infrastructure/workspace/WorkspaceDiscovery.d.ts.map +1 -0
  136. package/dist/infrastructure/{fs → workspace}/WorkspaceDiscovery.js +15 -11
  137. package/dist/infrastructure/workspace/WorkspaceDiscovery.js.map +1 -0
  138. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.d.ts +10 -9
  139. package/dist/infrastructure/workspace/WorkspaceRegistryFile.d.ts.map +1 -0
  140. package/dist/infrastructure/{fs → workspace}/WorkspaceRegistryFile.js +15 -17
  141. package/dist/infrastructure/workspace/WorkspaceRegistryFile.js.map +1 -0
  142. package/dist/infrastructure/workspace/productManifestWriter.d.ts +24 -0
  143. package/dist/infrastructure/workspace/productManifestWriter.d.ts.map +1 -0
  144. package/dist/infrastructure/{fs → workspace}/productManifestWriter.js +14 -26
  145. package/dist/infrastructure/workspace/productManifestWriter.js.map +1 -0
  146. package/dist/middleware/auth.d.ts +27 -17
  147. package/dist/middleware/auth.d.ts.map +1 -1
  148. package/dist/middleware/auth.js +59 -53
  149. package/dist/middleware/auth.js.map +1 -1
  150. package/dist/middleware/cors.d.ts.map +1 -1
  151. package/dist/middleware/cors.js +4 -1
  152. package/dist/middleware/cors.js.map +1 -1
  153. package/dist/middleware/error.d.ts.map +1 -1
  154. package/dist/middleware/error.js +15 -13
  155. package/dist/middleware/error.js.map +1 -1
  156. package/dist/middleware/workspaceAccess.d.ts +23 -19
  157. package/dist/middleware/workspaceAccess.d.ts.map +1 -1
  158. package/dist/middleware/workspaceAccess.js +31 -26
  159. package/dist/middleware/workspaceAccess.js.map +1 -1
  160. package/dist/policy/CapabilityCheck.d.ts +5 -5
  161. package/dist/policy/PermissionRegistry.d.ts +11 -9
  162. package/dist/policy/PermissionRegistry.d.ts.map +1 -1
  163. package/dist/policy/PermissionRegistry.js +10 -8
  164. package/dist/policy/PermissionRegistry.js.map +1 -1
  165. package/dist/policy/ViewerContext.d.ts +13 -11
  166. package/dist/policy/ViewerContext.d.ts.map +1 -1
  167. package/dist/policy/checks.d.ts +9 -9
  168. package/dist/policy/checks.d.ts.map +1 -1
  169. package/dist/policy/checks.js +14 -11
  170. package/dist/policy/checks.js.map +1 -1
  171. package/dist/policy/defaultRegistry.d.ts +3 -4
  172. package/dist/policy/defaultRegistry.d.ts.map +1 -1
  173. package/dist/policy/defaultRegistry.js +3 -4
  174. package/dist/policy/defaultRegistry.js.map +1 -1
  175. package/dist/policy/index.d.ts +2 -2
  176. package/dist/policy/index.d.ts.map +1 -1
  177. package/dist/policy/index.js +1 -1
  178. package/dist/policy/index.js.map +1 -1
  179. package/dist/policy/resolveViewer.d.ts +9 -9
  180. package/dist/policy/resolveViewer.js +9 -9
  181. package/dist/routes/_shared.d.ts +93 -153
  182. package/dist/routes/_shared.d.ts.map +1 -1
  183. package/dist/routes/_shared.js +9 -5
  184. package/dist/routes/_shared.js.map +1 -1
  185. package/dist/routes/admin.d.ts +1 -1
  186. package/dist/routes/admin.d.ts.map +1 -1
  187. package/dist/routes/admin.js +13 -12
  188. package/dist/routes/admin.js.map +1 -1
  189. package/dist/routes/auth.d.ts +12 -10
  190. package/dist/routes/auth.d.ts.map +1 -1
  191. package/dist/routes/auth.js +32 -34
  192. package/dist/routes/auth.js.map +1 -1
  193. package/dist/routes/clarifications.d.ts +8 -0
  194. package/dist/routes/clarifications.d.ts.map +1 -0
  195. package/dist/routes/clarifications.js +243 -0
  196. package/dist/routes/clarifications.js.map +1 -0
  197. package/dist/routes/edges.d.ts.map +1 -1
  198. package/dist/routes/edges.js +2 -6
  199. package/dist/routes/edges.js.map +1 -1
  200. package/dist/routes/history.d.ts.map +1 -1
  201. package/dist/routes/history.js +12 -10
  202. package/dist/routes/history.js.map +1 -1
  203. package/dist/routes/nodes.d.ts.map +1 -1
  204. package/dist/routes/nodes.js +4 -8
  205. package/dist/routes/nodes.js.map +1 -1
  206. package/dist/routes/oauth.d.ts +6 -7
  207. package/dist/routes/oauth.d.ts.map +1 -1
  208. package/dist/routes/oauth.js +6 -7
  209. package/dist/routes/oauth.js.map +1 -1
  210. package/dist/routes/proposals.d.ts +2 -2
  211. package/dist/routes/proposals.d.ts.map +1 -1
  212. package/dist/routes/proposals.js +30 -28
  213. package/dist/routes/proposals.js.map +1 -1
  214. package/dist/routes/reactorCycles.d.ts +7 -0
  215. package/dist/routes/reactorCycles.d.ts.map +1 -0
  216. package/dist/routes/reactorCycles.js +60 -0
  217. package/dist/routes/reactorCycles.js.map +1 -0
  218. package/dist/routes/runs.d.ts.map +1 -1
  219. package/dist/routes/runs.js +22 -19
  220. package/dist/routes/runs.js.map +1 -1
  221. package/dist/routes/skillInputOptions.d.ts +2 -2
  222. package/dist/routes/skillInputOptions.d.ts.map +1 -1
  223. package/dist/routes/skillInputOptions.js +43 -45
  224. package/dist/routes/skillInputOptions.js.map +1 -1
  225. package/dist/routes/skills.d.ts +19 -1
  226. package/dist/routes/skills.d.ts.map +1 -1
  227. package/dist/routes/skills.js +139 -7
  228. package/dist/routes/skills.js.map +1 -1
  229. package/dist/routes/sourceLoaders.d.ts.map +1 -1
  230. package/dist/routes/sourceLoaders.js +1 -0
  231. package/dist/routes/sourceLoaders.js.map +1 -1
  232. package/dist/routes/sourceUnitObservations.d.ts +20 -0
  233. package/dist/routes/sourceUnitObservations.d.ts.map +1 -0
  234. package/dist/routes/sourceUnitObservations.js +80 -0
  235. package/dist/routes/sourceUnitObservations.js.map +1 -0
  236. package/dist/routes/sourceWebhooks.d.ts +26 -0
  237. package/dist/routes/sourceWebhooks.d.ts.map +1 -0
  238. package/dist/routes/sourceWebhooks.js +301 -0
  239. package/dist/routes/sourceWebhooks.js.map +1 -0
  240. package/dist/routes/users.d.ts +0 -2
  241. package/dist/routes/users.d.ts.map +1 -1
  242. package/dist/routes/users.js +15 -33
  243. package/dist/routes/users.js.map +1 -1
  244. package/dist/routes/workspaceEvents.d.ts +5 -4
  245. package/dist/routes/workspaceEvents.d.ts.map +1 -1
  246. package/dist/routes/workspaceEvents.js +7 -6
  247. package/dist/routes/workspaceEvents.js.map +1 -1
  248. package/dist/routes/workspaceMembers.d.ts +1 -1
  249. package/dist/routes/workspaceMembers.d.ts.map +1 -1
  250. package/dist/routes/workspaceMembers.js +2 -2
  251. package/dist/routes/workspaceMembers.js.map +1 -1
  252. package/dist/routes/workspaces.d.ts +21 -10
  253. package/dist/routes/workspaces.d.ts.map +1 -1
  254. package/dist/routes/workspaces.js +97 -69
  255. package/dist/routes/workspaces.js.map +1 -1
  256. package/dist/server.js +6 -70
  257. package/dist/server.js.map +1 -1
  258. package/dist/startServer.d.ts +17 -0
  259. package/dist/startServer.d.ts.map +1 -0
  260. package/dist/startServer.js +81 -0
  261. package/dist/startServer.js.map +1 -0
  262. package/dist/startup.d.ts +28 -0
  263. package/dist/startup.d.ts.map +1 -0
  264. package/dist/startup.js +94 -0
  265. package/dist/startup.js.map +1 -0
  266. package/package.json +9 -9
  267. package/dist/composeFs.d.ts +0 -55
  268. package/dist/composeFs.d.ts.map +0 -1
  269. package/dist/composeFs.js.map +0 -1
  270. package/dist/composition.d.ts +0 -133
  271. package/dist/composition.d.ts.map +0 -1
  272. package/dist/composition.js +0 -113
  273. package/dist/composition.js.map +0 -1
  274. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts +0 -75
  275. package/dist/infrastructure/agent/SubprocessSkillRunner.d.ts.map +0 -1
  276. package/dist/infrastructure/agent/SubprocessSkillRunner.js.map +0 -1
  277. package/dist/infrastructure/agent/asyncQueue.d.ts +0 -22
  278. package/dist/infrastructure/agent/asyncQueue.d.ts.map +0 -1
  279. package/dist/infrastructure/agent/mcpConfig.d.ts +0 -38
  280. package/dist/infrastructure/agent/mcpConfig.d.ts.map +0 -1
  281. package/dist/infrastructure/agent/mcpConfig.js +0 -55
  282. package/dist/infrastructure/agent/mcpConfig.js.map +0 -1
  283. package/dist/infrastructure/agent/streamJsonParser.d.ts +0 -20
  284. package/dist/infrastructure/agent/streamJsonParser.d.ts.map +0 -1
  285. package/dist/infrastructure/agent/streamJsonParser.js.map +0 -1
  286. package/dist/infrastructure/agent/subprocessEventStream.d.ts +0 -26
  287. package/dist/infrastructure/agent/subprocessEventStream.d.ts.map +0 -1
  288. package/dist/infrastructure/agent/subprocessEventStream.js +0 -112
  289. package/dist/infrastructure/agent/subprocessEventStream.js.map +0 -1
  290. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts +0 -16
  291. package/dist/infrastructure/auth/ensureApprovedEmails.d.ts.map +0 -1
  292. package/dist/infrastructure/auth/ensureApprovedEmails.js +0 -20
  293. package/dist/infrastructure/auth/ensureApprovedEmails.js.map +0 -1
  294. package/dist/infrastructure/env.d.ts +0 -11
  295. package/dist/infrastructure/env.d.ts.map +0 -1
  296. package/dist/infrastructure/env.js.map +0 -1
  297. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts +0 -300
  298. package/dist/infrastructure/fs/FsBatchPlanRepository.d.ts.map +0 -1
  299. package/dist/infrastructure/fs/FsBatchPlanRepository.js.map +0 -1
  300. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts +0 -13
  301. package/dist/infrastructure/fs/FsClarifyTicketRepository.d.ts.map +0 -1
  302. package/dist/infrastructure/fs/FsClarifyTicketRepository.js.map +0 -1
  303. package/dist/infrastructure/fs/FsDecisionRepository.d.ts +0 -13
  304. package/dist/infrastructure/fs/FsDecisionRepository.d.ts.map +0 -1
  305. package/dist/infrastructure/fs/FsDecisionRepository.js +0 -56
  306. package/dist/infrastructure/fs/FsDecisionRepository.js.map +0 -1
  307. package/dist/infrastructure/fs/FsGraphSerializer.d.ts +0 -629
  308. package/dist/infrastructure/fs/FsGraphSerializer.d.ts.map +0 -1
  309. package/dist/infrastructure/fs/FsGraphSerializer.js.map +0 -1
  310. package/dist/infrastructure/fs/FsProposalRepository.d.ts.map +0 -1
  311. package/dist/infrastructure/fs/FsProposalRepository.js.map +0 -1
  312. package/dist/infrastructure/fs/FsRunRepository.d.ts.map +0 -1
  313. package/dist/infrastructure/fs/FsRunRepository.js.map +0 -1
  314. package/dist/infrastructure/fs/FsSkillRegistry.d.ts.map +0 -1
  315. package/dist/infrastructure/fs/FsSkillRegistry.js.map +0 -1
  316. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts +0 -19
  317. package/dist/infrastructure/fs/FsSourceUnitDigest.d.ts.map +0 -1
  318. package/dist/infrastructure/fs/FsSourceUnitDigest.js.map +0 -1
  319. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts +0 -30
  320. package/dist/infrastructure/fs/FsSourceUnitStateRepository.d.ts.map +0 -1
  321. package/dist/infrastructure/fs/FsSourceUnitStateRepository.js.map +0 -1
  322. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts +0 -35
  323. package/dist/infrastructure/fs/FsStatusedJsonRepository.d.ts.map +0 -1
  324. package/dist/infrastructure/fs/FsStatusedJsonRepository.js.map +0 -1
  325. package/dist/infrastructure/fs/FsWorkspaceRepository.d.ts.map +0 -1
  326. package/dist/infrastructure/fs/FsWorkspaceRepository.js.map +0 -1
  327. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts +0 -15
  328. package/dist/infrastructure/fs/WorkspaceDiscovery.d.ts.map +0 -1
  329. package/dist/infrastructure/fs/WorkspaceDiscovery.js.map +0 -1
  330. package/dist/infrastructure/fs/WorkspaceRegistryFile.d.ts.map +0 -1
  331. package/dist/infrastructure/fs/WorkspaceRegistryFile.js.map +0 -1
  332. package/dist/infrastructure/fs/frontmatter.d.ts +0 -13
  333. package/dist/infrastructure/fs/frontmatter.d.ts.map +0 -1
  334. package/dist/infrastructure/fs/frontmatter.js.map +0 -1
  335. package/dist/infrastructure/fs/intentScan.d.ts.map +0 -1
  336. package/dist/infrastructure/fs/intentScan.js.map +0 -1
  337. package/dist/infrastructure/fs/jsonFileStore.d.ts.map +0 -1
  338. package/dist/infrastructure/fs/jsonFileStore.js.map +0 -1
  339. package/dist/infrastructure/fs/paths.d.ts.map +0 -1
  340. package/dist/infrastructure/fs/paths.js.map +0 -1
  341. package/dist/infrastructure/fs/productManifestWriter.d.ts +0 -22
  342. package/dist/infrastructure/fs/productManifestWriter.d.ts.map +0 -1
  343. package/dist/infrastructure/fs/productManifestWriter.js.map +0 -1
  344. package/dist/infrastructure/git/GitWorkspaceHistory.d.ts.map +0 -1
  345. package/dist/infrastructure/git/GitWorkspaceHistory.js.map +0 -1
  346. package/dist/infrastructure/git/commitMessage.d.ts.map +0 -1
  347. package/dist/infrastructure/git/commitMessage.js +0 -71
  348. package/dist/infrastructure/git/commitMessage.js.map +0 -1
  349. package/dist/infrastructure/orphanReaper.d.ts +0 -18
  350. package/dist/infrastructure/orphanReaper.d.ts.map +0 -1
  351. package/dist/infrastructure/orphanReaper.js.map +0 -1
  352. package/dist/infrastructure/users/ensureLocalUser.d.ts +0 -15
  353. package/dist/infrastructure/users/ensureLocalUser.d.ts.map +0 -1
  354. package/dist/infrastructure/users/ensureLocalUser.js +0 -38
  355. package/dist/infrastructure/users/ensureLocalUser.js.map +0 -1
  356. package/dist/middleware/requireAdmin.d.ts +0 -10
  357. package/dist/middleware/requireAdmin.d.ts.map +0 -1
  358. package/dist/middleware/requireAdmin.js +0 -24
  359. package/dist/middleware/requireAdmin.js.map +0 -1
  360. package/dist/middleware/userId.d.ts +0 -16
  361. package/dist/middleware/userId.d.ts.map +0 -1
  362. package/dist/middleware/userId.js +0 -27
  363. package/dist/middleware/userId.js.map +0 -1
  364. package/dist/policy/Capability.d.ts +0 -12
  365. package/dist/policy/Capability.d.ts.map +0 -1
  366. package/dist/policy/Capability.js +0 -31
  367. package/dist/policy/Capability.js.map +0 -1
  368. package/dist/routes/clarify.d.ts +0 -9
  369. package/dist/routes/clarify.d.ts.map +0 -1
  370. package/dist/routes/clarify.js +0 -274
  371. package/dist/routes/clarify.js.map +0 -1
  372. package/dist/routes/decisions.d.ts +0 -7
  373. package/dist/routes/decisions.d.ts.map +0 -1
  374. package/dist/routes/decisions.js +0 -68
  375. package/dist/routes/decisions.js.map +0 -1
  376. package/dist/routes/sourceUnitStates.d.ts +0 -7
  377. package/dist/routes/sourceUnitStates.d.ts.map +0 -1
  378. package/dist/routes/sourceUnitStates.js +0 -45
  379. package/dist/routes/sourceUnitStates.js.map +0 -1
  380. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.d.ts +0 -0
  381. /package/dist/infrastructure/{fs → _shared}/jsonFileStore.js +0 -0
  382. /package/dist/infrastructure/{git → history}/GitWorkspaceHistory.d.ts +0 -0
  383. /package/dist/infrastructure/{git → history}/commitMessage.d.ts +0 -0
  384. /package/dist/infrastructure/{fs → hitl}/FsProposalRepository.d.ts +0 -0
  385. /package/dist/infrastructure/{fs → workspace}/FsWorkspaceRepository.d.ts +0 -0
@@ -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;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epository, Clock, IntentLister, ModelRepository, ModelSerializer, ProposalRepository, ReactorCycleRepository, RunRepository, SkillRegistry, SkillRunner, SourceUnitDigest, SourceUnitObservationRepository, 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
+ intentLister?: IntentLister;
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
+ intentLister?: IntentLister;
68
+ sourceUnitDigest?: SourceUnitDigest;
69
+ skillRegistry?: SkillRegistry;
70
+ skillRunner?: SkillRunner;
71
+ history?: WorkspaceHistory;
72
+ modelSerializer?: ModelSerializer;
73
+ bootstrap?: WorkspaceBootstrapService;
74
+ userDirectory?: UserDirectory;
75
+ authMode?: AuthMode;
76
+ workspacesRoot?: AbsolutePath;
77
+ }
78
+ export declare function composeApp(options?: ComposeOptions): AppDependencies;
79
+ //# 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,YAAY,EACZ,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,s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Y,CAAC,EAAE,YAAY,CAAA;IAC3B,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IAGnC,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,WAAW,CAAC,EAAE,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,CA+HxE"}
@@ -0,0 +1,136 @@
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.intentLister
57
+ ? new BatchService({
58
+ workspaceService,
59
+ skillRunner: options.skillRunner,
60
+ proposalRepository,
61
+ clarificationRepository,
62
+ historyService,
63
+ hitlService,
64
+ batchPlanRepository: options.batchPlanRepository,
65
+ intentLister: options.intentLister,
66
+ pluginRegistry,
67
+ eventBus,
68
+ workspaceLock,
69
+ clock,
70
+ sourceUnitObservationService,
71
+ })
72
+ : undefined;
73
+ // Reactor shares Batch's dependency footprint of skillRunner, intentLister,
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.intentLister && sourceUnitDigest && !(sourceUnitDigest instanceof FailingSourceUnitDigest)
81
+ ? new ReactorService({
82
+ eventBus,
83
+ workspaceService,
84
+ pluginRegistry,
85
+ skillRunner: options.skillRunner,
86
+ sourceUnitObservationService,
87
+ intentLister: options.intentLister,
88
+ digest: sourceUnitDigest,
89
+ reactorCycleRepository,
90
+ workspaceLock,
91
+ clock,
92
+ logger: createLogger('reactor'),
93
+ scheduler: new SystemScheduler(),
94
+ })
95
+ : undefined;
96
+ return {
97
+ workspaceService,
98
+ hitlService,
99
+ ...(historyService ? { historyService } : {}),
100
+ ...(batchService ? { batchService } : {}),
101
+ ...(reactorService ? { reactorService } : {}),
102
+ reactorCycleRepository,
103
+ ...(options.intentLister ? { intentLister: options.intentLister } : {}),
104
+ ...(options.sourceUnitDigest ? { sourceUnitDigest: options.sourceUnitDigest } : {}),
105
+ ...(options.bootstrap ? { bootstrap: options.bootstrap } : {}),
106
+ sourceUnitObservationService,
107
+ modelService,
108
+ modelValidationService,
109
+ sourceLoaderRunner,
110
+ eventBus,
111
+ pluginRegistry,
112
+ proposalRepository,
113
+ clarificationRepository,
114
+ modelRepository,
115
+ workspaceRepository,
116
+ skillRegistry: options.skillRegistry,
117
+ skillRunner: options.skillRunner,
118
+ runRepository: options.runRepository ?? new NoopRunRepository(),
119
+ workspacesRoot: options.workspacesRoot ?? join(tmpdir(), 'braid-workspaces'),
120
+ // `composeApp` is the test and in-memory composition entry.
121
+ // It defaults to local trust, the local-user fallback,
122
+ // so a test that wires a sessionStore still resolves a caller.
123
+ authMode: options.authMode ?? localTrust,
124
+ clock,
125
+ };
126
+ }
127
+ // Default `SourceUnitDigest` for in-memory `composeApp()` callers. Any call throws.
128
+ // Production must wire a real impl via `composeFsApp` or pass one explicitly.
129
+ // Tests that don't exercise observations stay happy,
130
+ // because the digest is never reached.
131
+ class FailingSourceUnitDigest {
132
+ async computeSha() {
133
+ throw new Error('SourceUnitDigest is not wired. Pass `sourceUnitDigest` to composeApp() (composeFsApp does this automatically).');
134
+ }
135
+ }
136
+ //# 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;AAyH1C,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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AAO,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;AAwCtF,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,CA8Q3F"}