@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
@@ -4,51 +4,56 @@ import { join } from 'node:path';
4
4
  import process from 'node:process';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { claudeCodeAgentPlugin } from '@braidhq/agent-claude-code';
7
- import { builtinSkillsRoot, createLogger, NotFoundError, PluginRegistry, ValidationError, WorkspaceBootstrap, } from '@braidhq/core';
8
- import { InMemoryWorkspaceEventBus } from '@braidhq/core/testing';
7
+ import { builtinSkillsRoot, NotFoundError, PluginRegistry, ValidationError, WorkspaceBootstrapService, } from '@braidhq/core';
8
+ import { InMemoryWorkspaceEventBus } from '@braidhq/core/in-memory';
9
9
  import { dddOntology } from '@braidhq/ontology-ddd';
10
10
  import { AgentId, AgentKind, StorageKind as StorageKindSchema } from '@braidhq/schema';
11
11
  import { createGoogleDriveLoader } from '@braidhq/source-loader-gdrive';
12
12
  import { gitLoader } from '@braidhq/source-loader-git';
13
13
  import { createGithubLoader } from '@braidhq/source-loader-github';
14
14
  import { kuzuStoragePlugin } from '@braidhq/storage-kuzu';
15
- import { composeApp } from './composition.js';
16
- import { SubprocessSkillRunner } from './infrastructure/agent/SubprocessSkillRunner.js';
15
+ import { authenticated, localTrust } from './authMode.js';
16
+ import { composeApp } from './composeApp.js';
17
+ import { parseBoolEnv } from './infrastructure/_shared/env.js';
17
18
  import { AccessPolicy } from './infrastructure/auth/AccessPolicy.js';
18
- import { ensureApprovedEmails } from './infrastructure/auth/ensureApprovedEmails.js';
19
- import { SessionStore } from './infrastructure/auth/SessionStore.js';
20
- import { parseBoolEnv } from './infrastructure/env.js';
21
- import { FsBatchPlanRepository } from './infrastructure/fs/FsBatchPlanRepository.js';
22
- import { FsClarifyTicketRepository } from './infrastructure/fs/FsClarifyTicketRepository.js';
23
- import { FsDecisionRepository } from './infrastructure/fs/FsDecisionRepository.js';
24
- import { FsGraphSerializer } from './infrastructure/fs/FsGraphSerializer.js';
25
- import { FsProposalRepository } from './infrastructure/fs/FsProposalRepository.js';
26
- import { FsRunRepository } from './infrastructure/fs/FsRunRepository.js';
27
- import { FsSkillRegistry } from './infrastructure/fs/FsSkillRegistry.js';
28
- import { FsSourceUnitDigest } from './infrastructure/fs/FsSourceUnitDigest.js';
29
- import { FsSourceUnitStateRepository } from './infrastructure/fs/FsSourceUnitStateRepository.js';
30
- import { FsWorkspaceRepository } from './infrastructure/fs/FsWorkspaceRepository.js';
31
- import { listIntentItems } from './infrastructure/fs/intentScan.js';
32
- import { discoverCanonicalWorkspaces } from './infrastructure/fs/WorkspaceDiscovery.js';
33
- import { WorkspaceRegistryFile } from './infrastructure/fs/WorkspaceRegistryFile.js';
34
- import { GitWorkspaceHistory } from './infrastructure/git/GitWorkspaceHistory.js';
19
+ import { FsSessionStore } from './infrastructure/auth/SessionStore.js';
20
+ import { FsBatchPlanRepository } from './infrastructure/batch/FsBatchPlanRepository.js';
21
+ import { GitWorkspaceHistory } from './infrastructure/history/GitWorkspaceHistory.js';
22
+ import { FsClarificationRepository } from './infrastructure/hitl/FsClarificationRepository.js';
23
+ import { FsProposalRepository } from './infrastructure/hitl/FsProposalRepository.js';
24
+ import { FsModelSerializer } from './infrastructure/model/FsModelSerializer.js';
35
25
  import { GoogleOAuth } from './infrastructure/oauth/GoogleOAuth.js';
26
+ import { FsReactorCycleRepository } from './infrastructure/reactor/FsReactorCycleRepository.js';
36
27
  import { FsSecretStore } from './infrastructure/secrets/SecretStore.js';
37
- import { ensureLocalUser } from './infrastructure/users/ensureLocalUser.js';
28
+ import { FsRunRepository } from './infrastructure/skill/FsRunRepository.js';
29
+ import { FsSkillRegistry } from './infrastructure/skill/FsSkillRegistry.js';
30
+ import { SubprocessSkillRunner } from './infrastructure/skill/SubprocessSkillRunner.js';
31
+ import { FsSourceUnitDigest } from './infrastructure/source/FsSourceUnitDigest.js';
32
+ import { FsSourceUnitObservationRepository } from './infrastructure/source/FsSourceUnitObservationRepository.js';
33
+ import { listUnitItems, unitBearingRolesOf } from './infrastructure/source/unitScan.js';
38
34
  import { ensureWorkspaceOwners } from './infrastructure/users/ensureWorkspaceOwners.js';
39
35
  import { UserDirectoryFromRegistry } from './infrastructure/users/UserDirectoryFromRegistry.js';
40
36
  import { UserRegistryFile } from './infrastructure/users/UserRegistryFile.js';
37
+ import { FsWorkspaceRepository } from './infrastructure/workspace/FsWorkspaceRepository.js';
38
+ import { discoverCanonicalWorkspaces } from './infrastructure/workspace/WorkspaceDiscovery.js';
39
+ import { WorkspaceRegistryFile } from './infrastructure/workspace/WorkspaceRegistryFile.js';
40
+ import { ensureServiceAccount, REACTOR_USER_ID } from './serviceAccounts.js';
41
+ import { startupBeforeServe } from './startup.js';
42
+ // The coding preset's default plugin identities, its worldview in one place.
43
+ // A caller overrides any of these through ComposeFsOptions,
44
+ // or drops to composeApp with its own PluginRegistry for a different worldview.
45
+ const DEFAULT_STORAGE_KIND = 'kuzu';
46
+ const DEFAULT_AGENT_KIND = 'claude-code';
47
+ const DEFAULT_AGENT_MODEL = 'opus';
48
+ const DEFAULT_AGENT_EFFORT = 'high';
41
49
  /**
42
- * Opinionated production composition: real filesystem persistence for
43
- * workspaces / proposals / clarify / decisions, built-in skills loaded
44
- * from `@braidhq/core`, and a batteries-included plugin bundle (Kuzu
45
- * storage / DDD ontology / Git+GDrive source loaders / Claude Code
46
- * agent).
50
+ * Opinionated production composition, the coding preset.
51
+ * Filesystem-persists workspaces, proposals, and clarifications,
52
+ * and bundles Kuzu storage, the DDD ontology, the git, github, and drive
53
+ * loaders, and the claude-code agent.
47
54
  *
48
- * To run with a different plugin set, either:
49
- * 1. Pass `extraXxxPlugins` to add alongside defaults + flip `storageKind`
50
- * / `agentKind` to pick a different active one, OR
51
- * 2. Call `composeApp` directly with a `pluginRegistry` you built yourself.
55
+ * To run a different plugin set, either pass `extraXxxPlugins` and flip
56
+ * `storageKind` or `agentKind`, or call `composeApp` with your own registry.
52
57
  */
53
58
  export async function composeFsApp(options = {}) {
54
59
  const braidHome = options.braidHome ?? process.env.BRAID_HOME ?? join(homedir(), '.braid');
@@ -68,19 +73,15 @@ export async function composeFsApp(options = {}) {
68
73
  : undefined;
69
74
  const registry = new WorkspaceRegistryFile(join(braidHome, 'workspaces.json'));
70
75
  const workspaceRepository = new FsWorkspaceRepository({ registry });
71
- // Server-side user roster. Distinct from any workspace's git history:
72
- // Auth and ACL belong to the host, not to the product knowledge a
73
- // workspace records. Single-user local installs get a `local-user`
74
- // bootstrapped here so `userIdMiddleware`'s default actually resolves.
76
+ // Server-side user roster, distinct from any workspace's git history.
77
+ // Auth and ACL belong to the host, not to what a workspace records.
75
78
  const userRegistry = new UserRegistryFile(join(braidHome, 'users.json'));
76
- await ensureLocalUser(userRegistry);
77
- // Phase B auth. Both files live next to `users.json` under `${BRAID_HOME}`;
78
- // never inside a workspace because access control is host state, not
79
- // workspace artifact. AccessPolicy reads env at construct time so a
80
- // running server doesn't need to be restarted when env changes mid-flight
81
- // but production deployments do restart on config changes, which is
82
- // why this is fine to read once.
83
- const sessionStore = new SessionStore(join(braidHome, 'sessions.json'));
79
+ // Auth state. Both files live next to `users.json` under `${BRAID_HOME}`,
80
+ // never inside a workspace,
81
+ // because access control is host state, not a workspace artifact.
82
+ // AccessPolicy reads env at construct time.
83
+ // Production deployments restart on config changes, so reading once is fine.
84
+ const sessionStore = new FsSessionStore(join(braidHome, 'sessions.json'));
84
85
  const accessPolicyConfig = {};
85
86
  const allowedDomains = parseCsv(process.env.BRAID_ALLOWED_DOMAINS);
86
87
  if (allowedDomains)
@@ -92,21 +93,29 @@ export async function composeFsApp(options = {}) {
92
93
  if (adminEmails)
93
94
  accessPolicyConfig.adminEmails = adminEmails;
94
95
  const accessPolicy = new AccessPolicy(join(braidHome, 'access.json'), accessPolicyConfig);
95
- // Back-fill approvedEmails for any pre-existing user accounts so the
96
- // dynamic allowlist matches the user roster on boot.
97
- await ensureApprovedEmails(userRegistry, accessPolicy);
96
+ // Boot, part one, provision host identity, who may use this server.
97
+ // Local trust is the default.
98
+ // Production sets `BRAID_LOCAL_TRUST=false` to require real authentication.
99
+ // We do not flip the default when Google OAuth env is present,
100
+ // those creds also feed the Drive loader,
101
+ // and a dev pulling from Drive should not hit Login on every reload.
102
+ const authMode = parseBoolEnv(process.env.BRAID_LOCAL_TRUST, true) ? localTrust : authenticated;
103
+ // Local trust seeds `local-user`, authenticated mode syncs the login allowlist.
104
+ await authMode.provision({ userRegistry, accessPolicy });
105
+ // The reactor is an autonomous component, so it seeds its own service account.
106
+ // Its kind=service rides onto every proposal it submits,
107
+ // so the HITL views classify it without a read-time lookup.
108
+ await ensureServiceAccount(userRegistry, REACTOR_USER_ID, 'Reactor');
98
109
  const studioUrl = process.env.BRAID_STUDIO_URL ?? 'http://localhost:5173';
99
110
  const workspaceRoots = async () => {
100
111
  const workspaces = await workspaceRepository.list();
101
112
  return new Map(workspaces.map(ws => [ws.id, ws.rootPath]));
102
113
  };
103
114
  const proposalRepository = new FsProposalRepository({ workspaceRoots });
104
- const clarifyRepository = new FsClarifyTicketRepository({ workspaceRoots });
105
- const decisionRepository = new FsDecisionRepository({ workspaceRoots });
106
- // Plugin registration. Defaults bundle first, then extras, so a caller
107
- // that passes (e.g.) `extraOntologyPlugins: [c4]` ends up with both ddd
108
- // and c4 registered; the active one is chosen per-workspace via
109
- // PRODUCT.md.ontologyId.
115
+ const clarificationRepository = new FsClarificationRepository({ workspaceRoots });
116
+ // Plugin registration. Defaults bundle first, then extras,
117
+ // so a caller passing `extraOntologyPlugins: [c4]` gets both ddd and c4.
118
+ // The active one is chosen per-workspace via PRODUCT.md.ontologyId.
110
119
  const pluginRegistry = new PluginRegistry();
111
120
  pluginRegistry.register(kuzuStoragePlugin);
112
121
  for (const plugin of options.extraStoragePlugins ?? [])
@@ -121,10 +130,11 @@ export async function composeFsApp(options = {}) {
121
130
  pluginRegistry.register(claudeCodeAgentPlugin);
122
131
  for (const plugin of options.extraAgentPlugins ?? [])
123
132
  pluginRegistry.register(plugin);
124
- // The gdrive loader is always registered so a workspace declaring a
125
- // `kind: gdrive` source doesn't crash at plugin lookup. If OAuth env
126
- // vars aren't configured, the token resolver throws an actionable
127
- // error at ingest time so the user knows exactly what to set.
133
+ // The gdrive loader is always registered,
134
+ // so a `kind: gdrive` source doesn't crash at plugin lookup.
135
+ // If OAuth env vars aren't configured,
136
+ // the token resolver throws an actionable error at provision time,
137
+ // so the user knows exactly what to set.
128
138
  const oauth = googleOAuth;
129
139
  pluginRegistry.register(createGoogleDriveLoader({
130
140
  resolveAccessToken: async ({ workspaceId, sourceId }) => {
@@ -137,7 +147,7 @@ export async function composeFsApp(options = {}) {
137
147
  throw new NotFoundError(`Google Drive source "${sourceId}" on workspace "${workspaceId}" is not connected. `
138
148
  + `Authorise via POST /oauth/google/start.`);
139
149
  }
140
- // 60-second skew so we don't hand out a token about to expire mid-request.
150
+ // 60-second skew, so we don't hand out a token about to expire mid-request.
141
151
  const stillValidUntil = new Date(stored.expiresAt).getTime() - 60_000;
142
152
  if (Date.now() < stillValidUntil)
143
153
  return stored.accessToken;
@@ -151,7 +161,7 @@ export async function composeFsApp(options = {}) {
151
161
  },
152
162
  }));
153
163
  // Resolve the active storage plugin and ask it for a ModelRepository.
154
- const storageKind = StorageKindSchema.parse(options.storageKind ?? process.env.BRAID_STORAGE_KIND ?? 'kuzu');
164
+ const storageKind = StorageKindSchema.parse(options.storageKind ?? process.env.BRAID_STORAGE_KIND ?? DEFAULT_STORAGE_KIND);
155
165
  const modelRepository = await pluginRegistry.requireStoragePlugin(storageKind).createModelRepository({ kind: storageKind, config: {} }, {
156
166
  workspaceRootPath: braidHome,
157
167
  logger: { info: () => { }, warn: () => { }, error: () => { } },
@@ -163,30 +173,33 @@ export async function composeFsApp(options = {}) {
163
173
  return root;
164
174
  },
165
175
  });
166
- // Resolve the active agent plugin and build its binding.
167
- const agentKind = AgentKind.parse(options.agentKind ?? 'claude-code');
168
- const agentBinding = pluginRegistry.requireAgentPlugin(agentKind).createBinding({
169
- id: AgentId.parse('default'),
176
+ // Server default agent.
177
+ // A skill overrides kind, model, or effort in its SKILL.md frontmatter,
178
+ // and the runner merges that onto this default at run time.
179
+ const agentKind = AgentKind.parse(options.agentKind ?? DEFAULT_AGENT_KIND);
180
+ const defaultAgent = {
181
+ id: AgentId.parse(DEFAULT_AGENT_KIND),
170
182
  kind: agentKind,
171
- model: options.agentModel ?? 'opus',
172
- effort: options.agentEffort ?? 'high',
183
+ model: options.agentModel ?? DEFAULT_AGENT_MODEL,
184
+ effort: options.agentEffort ?? DEFAULT_AGENT_EFFORT,
173
185
  extraArgs: [],
174
186
  env: {},
175
- });
187
+ };
176
188
  const runRepository = new FsRunRepository();
177
- // Built after pluginRegistry is populated so plugin-shipped SKILL.md
178
- // files mount under the `plugin` skill origin alongside builtins.
189
+ // Built after pluginRegistry is populated,
190
+ // so plugin-shipped SKILL.md files mount under the `plugin` origin,
191
+ // alongside builtins.
179
192
  const skillRegistry = new FsSkillRegistry({
180
193
  builtinSkillsRoot: builtinSkillsRoot,
181
194
  pluginRegistry,
182
195
  });
183
196
  const eventBus = new InMemoryWorkspaceEventBus();
184
- // Built-in braid-core MCP gateway: each spawned skill gets a stdio
185
- // entry that runs `uvx openapi-mcp-gateway` with --transport stdio.
186
- // The gateway lifecycle tracks the claude subprocess; no separate
187
- // long-running server. Requires `uv` to be installed on PATH; if it
188
- // isn't, skip the entry silently — skills with
189
- // `requiredMcpServers: ['braid-core']` will surface as not-ready
197
+ // Built-in braid-core MCP gateway. Each spawned skill gets a stdio entry,
198
+ // running `uvx openapi-mcp-gateway --transport stdio`.
199
+ // The gateway lifecycle tracks the claude subprocess,
200
+ // with no separate long-running server, and needs `uv` on PATH.
201
+ // If `uv` is missing, the entry is skipped.
202
+ // Skills that require `braid-core` then surface as not-ready,
190
203
  // via SkillManifest.readinessIssuesFor, with a clear pointer.
191
204
  const uvxBin = await detectUvx();
192
205
  if (!uvxBin) {
@@ -194,17 +207,20 @@ export async function composeFsApp(options = {}) {
194
207
  + 'Install via `brew install uv` or https://docs.astral.sh/uv/ to enable.');
195
208
  }
196
209
  // Build the list of reference dirs symlinked into every skill session:
197
- // - builtin `shared/` from @braidhq/core (Proposal / Clarify / Validator
198
- // format docs, content conventions, drift-detection guidance)
199
- // - whatever each registered plugin contributes (e.g. ontology-ddd's
200
- // concept doc). Plugin contributions resolve `URL` -> absolute path.
210
+ // - builtin `shared/` from @braidhq/core,
211
+ // format docs for Proposal, Clarification, Validator, content conventions,
212
+ // and drift-detection guidance.
213
+ // - whatever each registered plugin contributes,
214
+ // for example the concept doc from ontology-ddd.
215
+ // Plugin contributions resolve `URL` to an absolute path.
201
216
  const pluginReferenceDirs = pluginRegistry.pluginReferenceDirs().map((ref) => {
202
217
  const dir = typeof ref.directory === 'string' ? ref.directory : fileURLToPath(ref.directory);
203
218
  return { name: ref.name, path: dir };
204
219
  });
205
220
  const skillRunner = new SubprocessSkillRunner({
206
221
  skillRegistry,
207
- agentBinding,
222
+ buildAgentBinding: descriptor => pluginRegistry.requireAgentPlugin(descriptor.kind).createBinding(descriptor),
223
+ defaultAgent,
208
224
  apiUrl,
209
225
  runRepository,
210
226
  eventBus,
@@ -216,12 +232,13 @@ export async function composeFsApp(options = {}) {
216
232
  ...pluginReferenceDirs,
217
233
  ],
218
234
  });
219
- // Shared by WorkspaceBootstrap (boot reconciliation) and HITLService (per-mutation commits).
235
+ // Shared by WorkspaceBootstrapService (boot reconciliation),
236
+ // and HITLService (per-mutation commits).
220
237
  const history = new GitWorkspaceHistory();
221
- const graphSerializer = new FsGraphSerializer();
222
- const bootstrap = new WorkspaceBootstrap({
238
+ const modelSerializer = new FsModelSerializer();
239
+ const bootstrap = new WorkspaceBootstrapService({
223
240
  history,
224
- serializer: graphSerializer,
241
+ serializer: modelSerializer,
225
242
  modelRepository,
226
243
  });
227
244
  const workspacesRoot = join(braidHome, 'workspaces');
@@ -229,8 +246,7 @@ export async function composeFsApp(options = {}) {
229
246
  const deps = composeApp({
230
247
  workspaceRepository,
231
248
  proposalRepository,
232
- clarifyRepository,
233
- decisionRepository,
249
+ clarificationRepository,
234
250
  modelRepository,
235
251
  skillRegistry,
236
252
  skillRunner,
@@ -239,44 +255,31 @@ export async function composeFsApp(options = {}) {
239
255
  eventBus,
240
256
  workspacesRoot,
241
257
  history,
242
- graphSerializer,
258
+ modelSerializer,
243
259
  bootstrap,
244
260
  batchPlanRepository: new FsBatchPlanRepository(),
245
- intentLister: listIntentItems,
246
- sourceUnitStateRepository: new FsSourceUnitStateRepository({ workspaceRoots }),
261
+ unitLister: workspace => listUnitItems(workspace, unitBearingRolesOf(pluginRegistry, workspace)),
262
+ // The reactor has no human caller, so it acts as the `reactor` service account,
263
+ // minting a short-lived session so its API calls authenticate.
264
+ reactorToken: async () => (await sessionStore.issue(REACTOR_USER_ID, { ttlSeconds: 3600 })).token,
265
+ sourceUnitObservationRepository: new FsSourceUnitObservationRepository({ workspaceRoots }),
266
+ reactorCycleRepository: new FsReactorCycleRepository({ workspaceRoots }),
247
267
  sourceUnitDigest: new FsSourceUnitDigest(),
248
268
  userDirectory,
269
+ authMode,
249
270
  });
250
- // Pick up workspaces that exist on disk but aren't in the registry:
251
- // CLI-created ones, scaffold-orphans, copies-from-another-machine.
252
- // Registry add is idempotent so this is safe to run on every boot.
271
+ // Boot, part two, reconcile workspaces, register then boot each.
272
+ // Pick up workspaces on disk but not in the registry,
273
+ // such as CLI-created ones, scaffold orphans, or copies from another machine.
274
+ // Registry add is idempotent, safe on every boot.
253
275
  await discoverCanonicalWorkspaces(workspacesRoot, deps.workspaceService);
254
- // Phase C migration: stamp `local-user` as owner of any workspace
255
- // whose members[] is still empty (pre-Phase-C registry entries,
256
- // freshly discovered workspaces). Owner promotion via `/members`
257
- // routes can rewrite this later.
258
- await ensureWorkspaceOwners(registry);
259
- // Per-workspace failures are logged and tolerated so one bad dir doesn't block boot.
260
- const bootstrapLog = createLogger('server').child({ mod: 'workspace-bootstrap' });
261
- for (const workspace of await deps.workspaceService.list()) {
262
- try {
263
- await bootstrap.ensure(workspace);
264
- // Mark any batch plan left running by a previous process as failed so
265
- // the UI doesn't show a phantom spinner. Safe to call even when there
266
- // is no plan or when the plan is already terminal.
267
- await deps.batchService?.reconcileAfterBoot(workspace.id);
268
- }
269
- catch (err) {
270
- bootstrapLog.warn({ err, workspaceId: workspace.id }, 'workspace bootstrap failed; skipping');
271
- }
272
- }
273
- // Local trust is the default; production deployments opt into the
274
- // Bearer-token gate by setting `BRAID_LOCAL_TRUST=false`. We deliberately
275
- // DON'T flip the default just because Google OAuth env vars are
276
- // present — those same creds are also used by the Drive source
277
- // loader for ingest, so a local dev workspace pulling from Drive
278
- // would otherwise get pushed into the Login flow on every reload.
279
- const localTrust = parseBoolEnv(process.env.BRAID_LOCAL_TRUST, true);
276
+ // Give any workspace with an empty members[] its default owner,
277
+ // covering older registry entries and freshly discovered workspaces.
278
+ // Owner promotion via `/members` routes can rewrite this later.
279
+ await ensureWorkspaceOwners(registry, authMode.defaultPrincipal);
280
+ // Blocking per-workspace startup, provision, recover, subscribe, catch-up sync.
281
+ // See startup.ts, the single home for boot steps.
282
+ await startupBeforeServe(deps);
280
283
  return {
281
284
  ...deps,
282
285
  bootstrap,
@@ -286,7 +289,6 @@ export async function composeFsApp(options = {}) {
286
289
  sessionStore,
287
290
  accessPolicy,
288
291
  studioUrl,
289
- localTrust,
290
292
  ...(googleOAuth ? { googleOAuth } : {}),
291
293
  };
292
294
  }
@@ -296,14 +298,13 @@ function parseCsv(input) {
296
298
  const parts = input.split(',').map(s => s.trim()).filter(s => s.length > 0);
297
299
  return parts.length > 0 ? parts : undefined;
298
300
  }
299
- /**
300
- * Resolve the `uvx` binary path by running `uvx --version`. Returns
301
- * `'uvx'` when the call succeeds (we let `PATH` resolve it at spawn
302
- * time so we don't bake an absolute path into mcp-config), or
303
- * `undefined` when `uv` isn't installed. Honours `BRAID_UVX_BIN` for
304
- * pinning a specific binary (uv in a non-PATH location, or tests
305
- * that want to inject a stub).
306
- */
301
+ // Resolve the `uvx` binary path by running `uvx --version`.
302
+ // Returns `'uvx'` when the call succeeds.
303
+ // We let `PATH` resolve it at spawn time,
304
+ // so we don't bake an absolute path into mcp-config.
305
+ // Returns `undefined` when `uv` isn't installed.
306
+ // Honours `BRAID_UVX_BIN` for pinning a specific binary, a uv off PATH,
307
+ // or a stub injected by tests.
307
308
  async function detectUvx() {
308
309
  const pinned = process.env.BRAID_UVX_BIN;
309
310
  const command = pinned && pinned.length > 0 ? pinned : 'uvx';
@@ -313,4 +314,4 @@ async function detectUvx() {
313
314
  child.once('exit', code => resolve(code === 0 ? command : undefined));
314
315
  });
315
316
  }
316
- //# sourceMappingURL=composeFs.js.map
317
+ //# sourceMappingURL=composeFsApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeFsApp.js","sourceRoot":"","sources":["../src/composeFsApp.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EACL,iBAAiB,EACjB,aAAa,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AAS,CAAC,CAAC,CAAA;QAC7C,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACvE,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './app.js';
2
- export * from './composeFs.js';
3
- export * from './composition.js';
2
+ export * from './composeApp.js';
3
+ export * from './composeFsApp.js';
4
4
  export * from './middleware/error.js';
5
+ export * from './startServer.js';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './app.js';
2
- export * from './composeFs.js';
3
- export * from './composition.js';
2
+ export * from './composeApp.js';
3
+ export * from './composeFsApp.js';
4
4
  export * from './middleware/error.js';
5
+ export * from './startServer.js';
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Parse a boolean env var. Canonical form is `true` or `false`.
3
+ * We also accept the common YAML and shell idioms (`yes`/`no`, `on`/`off`, `1`/`0`),
4
+ * so existing `.env` files don't break on the rename.
5
+ *
6
+ * Returns `defaultValue` when the variable is unset or the literal is unrecognised.
7
+ * This silent fall-through keeps a typo in env from crashing the server boot.
8
+ */
9
+ export declare function parseBoolEnv(value: string | undefined, defaultValue: boolean): boolean;
10
+ //# sourceMappingURL=env.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/_shared/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAStF"}
@@ -1,11 +1,10 @@
1
1
  /**
2
- * Parse a boolean env var. Canonical form is `true` / `false`; we also
3
- * accept the common YAML / shell idioms (`yes` / `no`, `on` / `off`,
4
- * `1` / `0`) so existing `.env` files don't break on the rename.
2
+ * Parse a boolean env var. Canonical form is `true` or `false`.
3
+ * We also accept the common YAML and shell idioms (`yes`/`no`, `on`/`off`, `1`/`0`),
4
+ * so existing `.env` files don't break on the rename.
5
5
  *
6
- * Returns `defaultValue` when the variable is unset or the literal is
7
- * unrecognised (silent fall-through we don't want a typo in env to
8
- * crash the server boot).
6
+ * Returns `defaultValue` when the variable is unset or the literal is unrecognised.
7
+ * This silent fall-through keeps a typo in env from crashing the server boot.
9
8
  */
10
9
  export function parseBoolEnv(value, defaultValue) {
11
10
  if (value === undefined)
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../../../src/infrastructure/_shared/env.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,KAAyB,EAAE,YAAqB;IAC3E,IAAI,KAAK,KAAK,SAAS;QACrB,OAAO,YAAY,CAAA;IACrB,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IACxC,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,IAAI;QACxE,OAAO,IAAI,CAAA;IACb,IAAI,KAAK,KAAK,OAAO,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK;QACzE,OAAO,KAAK,CAAA;IACd,OAAO,YAAY,CAAA;AACrB,CAAC"}
@@ -0,0 +1,13 @@
1
+ export interface MarkdownDocument<T> {
2
+ readonly frontmatter: T;
3
+ readonly body: string;
4
+ }
5
+ /**
6
+ * Splits a markdown file into YAML frontmatter and body.
7
+ * The YAML sits between `---` delimiters on their own lines at the top.
8
+ * Keys are normalised recursively from kebab-case to camelCase,
9
+ * from the YAML convention Claude Code uses to the TS convention,
10
+ * so Zod schemas can declare fields naturally in TS.
11
+ */
12
+ export declare function parseMarkdownFrontmatter<T>(content: string): MarkdownDocument<T>;
13
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/_shared/frontmatter.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAmBhF"}
@@ -1,11 +1,11 @@
1
1
  import { parse as parseYaml } from 'yaml';
2
2
  const FRONTMATTER_DELIMITER = '---';
3
3
  /**
4
- * Splits a markdown file into YAML frontmatter + body. Wraps the YAML
5
- * between `---` delimiters on their own lines at the top of the file.
6
- * Keys are normalised from kebab-case (YAML convention, used by Claude
7
- * Code itself) to camelCase (TS convention) recursively so Zod schemas
8
- * can declare fields naturally in TS.
4
+ * Splits a markdown file into YAML frontmatter and body.
5
+ * The YAML sits between `---` delimiters on their own lines at the top.
6
+ * Keys are normalised recursively from kebab-case to camelCase,
7
+ * from the YAML convention Claude Code uses to the TS convention,
8
+ * so Zod schemas can declare fields naturally in TS.
9
9
  */
10
10
  export function parseMarkdownFrontmatter(content) {
11
11
  const lines = content.split('\n');
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/infrastructure/_shared/frontmatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAA;AAEzC,MAAM,qBAAqB,GAAG,KAAK,CAAA;AAOnC;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAI,OAAe;IACzD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,qBAAqB,EAAE,CAAC;QAC/C,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAA;IACxE,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC,CAAA;IACrB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,KAAK,qBAAqB,EAAE,CAAC;YACnD,YAAY,GAAG,KAAK,CAAA;YACpB,MAAK;QACP,CAAC;IACH,CAA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sourceRoot":"","sources":["../../../src/infrastructure/_shared/jsonFileStore.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAGlE;AAED,wBAAsB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlF;AAED,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9E;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAaxE"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonFileStore.js","sourceRoot":"","sources":["../../../src/infrastructure/_shared/jsonFileStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,CAAC,KAAK,UAAU,YAAY,CAAI,QAAgB;IACpD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAA;AAC7B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAI,QAAgB,EAAE,OAAU;IACjE,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,SAAS,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAgB,EAAE,MAAc;IAC7D,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACjD,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AAChC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,SAAiB;IACnD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;IACpD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAA;QACjE,OAAO,OAAO;aACX,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;aAC/D,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IAC9C,CAAC;IACD,OAAO,KAAK,EAAE,CAAC;QACb,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ;YACpD,OAAO,EAAE,CAAA;QACX,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
@@ -1,10 +1,10 @@
1
- import type { AbsolutePath, ClarifyStatus, ProposalStatus, WorkspaceId } from '@braidhq/schema';
1
+ import type { AbsolutePath, ClarificationStatus, ProposalStatus, WorkspaceId } from '@braidhq/schema';
2
2
  export declare const PROPOSAL_STATUSES: readonly ProposalStatus[];
3
- export declare const CLARIFY_STATUSES: readonly ClarifyStatus[];
3
+ export declare const CLARIFY_STATUSES: readonly ClarificationStatus[];
4
4
  /**
5
- * Path-prefix containment check. Both inputs must be absolute. Handles
6
- * the `/foo/bar-evil` vs `/foo/bar/` aliasing gotcha by normalising the
7
- * parent with a trailing slash before `startsWith`.
5
+ * Path-prefix containment check. Both inputs must be absolute.
6
+ * Handles the `/foo/bar-evil` vs `/foo/bar/` aliasing gotcha,
7
+ * normalising the parent with a trailing slash before `startsWith`.
8
8
  */
9
9
  export declare function isUnder(candidate: string, parent: string): boolean;
10
10
  /** `true` when `path` resolves to anything (file, dir, symlink). */
@@ -12,17 +12,24 @@ export declare function pathExists(path: string): Promise<boolean>;
12
12
  export declare function workspaceArtifactsDir(workspaceRoot: AbsolutePath): string;
13
13
  export declare function graphJsonPath(workspaceRoot: AbsolutePath): string;
14
14
  export declare function batchPlanPath(workspaceRoot: AbsolutePath): string;
15
- export declare function sourceUnitStateDir(workspaceRoot: AbsolutePath): string;
16
- export declare function sourceUnitStateFilePath(workspaceRoot: AbsolutePath, sourceId: string, relativePath: string): string;
17
- export declare function sourceUnitStateSourceDir(workspaceRoot: AbsolutePath, sourceId: string): string;
15
+ export declare function sourceUnitObservationDir(workspaceRoot: AbsolutePath): string;
16
+ export declare function sourceUnitObservationFilePath(workspaceRoot: AbsolutePath, sourceId: string, relativePath: string): string;
17
+ export declare function sourceUnitObservationSourceDir(workspaceRoot: AbsolutePath, sourceId: string): string;
18
18
  export declare function proposalsDir(workspaceRoot: AbsolutePath, status: ProposalStatus): string;
19
- export declare function clarifyDir(workspaceRoot: AbsolutePath, status: ClarifyStatus): string;
20
- export declare function decisionsDir(workspaceRoot: AbsolutePath): string;
19
+ export declare function clarificationDir(workspaceRoot: AbsolutePath, status: ClarificationStatus): string;
21
20
  export declare function viewsDir(workspaceRoot: AbsolutePath, kind: string): string;
22
21
  export declare function runsDir(workspaceRoot: AbsolutePath): string;
22
+ export declare function reactorCyclesDir(workspaceRoot: AbsolutePath): string;
23
+ export declare function reactorCycleFilePath(workspaceRoot: AbsolutePath, cycleId: string): string;
23
24
  export declare function runIndexPath(workspaceRoot: AbsolutePath): string;
24
25
  export declare function runEventsPath(workspaceRoot: AbsolutePath, runId: string): string;
25
26
  export declare function runSessionsMetadataPath(workspaceRoot: AbsolutePath): string;
27
+ /**
28
+ * claude stores conversation memory keyed by cwd,
29
+ * so resume must spawn from the same dir as the first turn.
30
+ * Keeping it in the workspace, not /tmp, stays derivable from runId,
31
+ * and survives a server restart.
32
+ */
26
33
  export declare function sessionsDir(workspaceRoot: AbsolutePath): string;
27
34
  export declare function sessionDirPath(workspaceRoot: AbsolutePath, runId: string): string;
28
35
  export declare function workspaceSkillsDir(workspaceRoot: AbsolutePath): string;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/_shared/paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAIrG,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAAuC,CAAA;AAC9F,eAAO,MAAM,gBAAgB,EAAE,SAAS,mBAAmB,EAAkD,CAAA;AAE7G;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGlE;AAED,oEAAoE;AACpE,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQ/D;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,YAAY,GAAG,MAAM,CAEzE;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,YAAY,GAAG,MAAM,CAEjE;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,YAAY,GAAG,MAAM,CAEjE;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,YAAY,GAAG,MAAM,CAE5E;AAED,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,YAAY,EAC3B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACnB,MAAM,CAQR;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,YAAY,EAC3B,QAA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