@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
@@ -1,38 +0,0 @@
1
- import type { Workspace } from '@braidhq/core';
2
- import type { McpServerConfig } from '@braidhq/schema';
3
- export interface McpConfigFile {
4
- readonly mcpServers: Readonly<Record<string, McpServerEntry>>;
5
- }
6
- /**
7
- * Shape claude expects in `--mcp-config <file>`.
8
- *
9
- * The Streamable HTTP transport is `type: 'http'` (the claude CLI's
10
- * legacy name; predates the rename in the MCP 2025-06-18 spec). We
11
- * use the new name in PRODUCT.md to match the spec and emit the
12
- * legacy name here so claude understands.
13
- */
14
- interface McpStreamableHttpEntry {
15
- readonly type: 'http';
16
- readonly url: string;
17
- readonly headers?: Record<string, string>;
18
- }
19
- interface McpStdioEntry {
20
- readonly type: 'stdio';
21
- readonly command: string;
22
- readonly args?: readonly string[];
23
- readonly env?: Record<string, string>;
24
- }
25
- type McpServerEntry = McpStreamableHttpEntry | McpStdioEntry;
26
- export interface BuildMcpConfigOptions {
27
- /**
28
- * Extra MCP server entries injected on top of the workspace's own
29
- * `mcpServers`. Used to wire the built-in `braid-core` gateway —
30
- * see `SubprocessSkillRunner`. Workspace entries with the same id
31
- * take precedence (so a workspace can override a built-in).
32
- */
33
- extraServers?: readonly McpServerConfig[];
34
- }
35
- export declare function buildMcpConfig(workspace: Workspace, options?: BuildMcpConfigOptions): McpConfigFile;
36
- export declare function writeMcpConfigFile(workspace: Workspace, targetDir: string, options?: BuildMcpConfigOptions): Promise<string>;
37
- export {};
38
- //# sourceMappingURL=mcpConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcpConfig.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/agent/mcpConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAKtD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAA;CAC9D;AAED;;;;;;;GAOG;AACH,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC1C;AAED,UAAU,aAAa;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACtC;AAED,KAAK,cAAc,GAAG,sBAAsB,GAAG,aAAa,CAAA;AAE5D,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CAC1C;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,GAAE,qBAA0B,GAAG,aAAa,CASvG;AAED,wBAAsB,kBAAkB,CACtC,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,MAAM,CAAC,CAMjB"}
@@ -1,55 +0,0 @@
1
- import { mkdir, writeFile } from 'node:fs/promises';
2
- import { dirname, join } from 'node:path';
3
- import process from 'node:process';
4
- export function buildMcpConfig(workspace, options = {}) {
5
- const entries = {};
6
- for (const server of options.extraServers ?? []) {
7
- entries[server.id] = toEntry(server);
8
- }
9
- for (const server of workspace.mcpServers) {
10
- entries[server.id] = toEntry(server);
11
- }
12
- return { mcpServers: entries };
13
- }
14
- export async function writeMcpConfigFile(workspace, targetDir, options = {}) {
15
- const config = buildMcpConfig(workspace, options);
16
- const targetPath = join(targetDir, `.braid-mcp-${workspace.id}.json`);
17
- await mkdir(dirname(targetPath), { recursive: true });
18
- await writeFile(targetPath, `${JSON.stringify(config, null, 2)}\n`, 'utf-8');
19
- return targetPath;
20
- }
21
- function toEntry(server) {
22
- if (server.transport === 'stdio') {
23
- return {
24
- type: 'stdio',
25
- command: server.command,
26
- ...(server.args ? { args: [...server.args] } : {}),
27
- ...(server.env ? { env: resolveEnv(server.env) } : {}),
28
- };
29
- }
30
- return {
31
- type: 'http',
32
- url: server.url,
33
- ...(server.headers ? { headers: resolveEnv(server.headers) } : {}),
34
- };
35
- }
36
- /**
37
- * Replace `${VAR}` references in header / env values with the matching
38
- * parent-process env var. Throws if a referenced var is missing so the
39
- * user gets a clear error at config-write time rather than a confusing
40
- * 401 from the MCP server or a silently-misconfigured subprocess.
41
- */
42
- function resolveEnv(values) {
43
- const out = {};
44
- for (const [name, value] of Object.entries(values)) {
45
- out[name] = value.replace(/\$\{([A-Z_][A-Z0-9_]*)\}/g, (_match, varName) => {
46
- const resolved = process.env[varName];
47
- if (resolved === undefined) {
48
- throw new Error(`MCP entry "${name}": environment variable "${varName}" is not set`);
49
- }
50
- return resolved;
51
- });
52
- }
53
- return out;
54
- }
55
- //# sourceMappingURL=mcpConfig.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mcpConfig.js","sourceRoot":"","sources":["../../../src/infrastructure/agent/mcpConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,OAAO,MAAM,cAAc,CAAA;AAuClC,MAAM,UAAU,cAAc,CAAC,SAAoB,EAAE,UAAiC,EAAE;IACtF,MAAM,OAAO,GAAmC,EAAE,CAAA;IAClD,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,YAAY,IAAI,EAAE,EAAE,CAAC;QAChD,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACtC,CAAC;IACD,KAAK,MAAM,MA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QACf,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnE,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,UAAU,CAAC,MAA8B;IAChD,MAAM,GAAG,GAA2B,EAAE,CAAA;IACtC,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,2BAA2B,EAAE,CAAC,MAAM,EAAE,OAAe,EAAE,EAAE;YACjF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACrC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,4BAA4B,OAAO,cAAc,CAAC,CAAA;YACtF,CAAC;YACD,OAAO,QAAQ,CAAA;QACjB,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1,20 +0,0 @@
1
- export type LineHandler = (line: string) => void;
2
- /**
3
- * Splits a chunked text stream into newline-delimited lines, invoking the
4
- * handler exactly once per complete line. Partial lines are buffered until
5
- * the next chunk completes them. Call `flush()` after the source closes to
6
- * release any trailing line without a terminator.
7
- */
8
- export declare class LineBuffer {
9
- private readonly onLine;
10
- private buffer;
11
- constructor(onLine: LineHandler);
12
- append(chunk: string): void;
13
- flush(): void;
14
- }
15
- export interface StreamJsonEvent {
16
- readonly type: string;
17
- readonly [key: string]: unknown;
18
- }
19
- export declare function parseJsonLine(line: string): StreamJsonEvent | undefined;
20
- //# sourceMappingURL=streamJsonParser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"streamJsonParser.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/agent/streamJsonParser.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;AAEhD;;;;;GAKG;AACH,qBAAa,UAAU;IAGT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,MAAM,CAAK;gBAEU,MAAM,EAAE,WAAW;IAEhD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAY3B,KAAK,IAAI,IAAI;CAOd;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAChC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAWvE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"streamJsonParser.js","sourceRoot":"","sources":["../../../src/infrastructure/agent/streamJsonParser.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAGQ;IAFrB,MAAM,GAAG,EAAE,CAAA;IAEnB,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAEpD,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAA;QACpB,IAAI,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC5C,OAAO,YAAY,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;YAC/C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAA;YACjD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;gBACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YACnB,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC;YAC1B,OAAM;QACR,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAA;QAC7B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;QAChB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;IACxB,CAAC;CACF;AAOD,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QACtB,OAAO,SAAS,CAAA;IAClB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAoB,CAAA;QACrD,OAAO,MAAM,CAAA;IACf,CAAC;IACD,MAAM,CAAC;QACL,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC"}
@@ -1,26 +0,0 @@
1
- import type { SkillEvent } from '@braidhq/schema';
2
- import type { ChildProcess } from 'node:child_process';
3
- interface RawEvent {
4
- readonly type: string;
5
- readonly [key: string]: unknown;
6
- }
7
- /**
8
- * Wires a child's stdout / stderr to a single SkillEvent callback.
9
- * Returns `flush` so callers can drain the final un-terminated line on
10
- * `close`.
11
- */
12
- export declare function attachOutputBuffers(child: ChildProcess, onEvent: (event: SkillEvent) => void, now: () => string): {
13
- flush: () => void;
14
- };
15
- /**
16
- * Maps a single `claude --output-format stream-json` line into zero or more
17
- * `SkillEvent`s. Claude emits these envelope shapes today: `system` (init
18
- * meta, ignored except for `session_id`), `assistant` (text / tool_use
19
- * content parts), `user` (echoed tool_result, only `is_error` surfaced),
20
- * `rate_limit_*` (ignored), `result` (final outcome). Legacy flat shapes
21
- * (`text`, `tool_use`, `artifact-written`, `error`) are kept for tests and
22
- * older tools.
23
- */
24
- export declare function mapSubprocessEvents(raw: RawEvent, now: string): SkillEvent[];
25
- export {};
26
- //# sourceMappingURL=subprocessEventStream.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subprocessEventStream.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/agent/subprocessEventStream.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAItD,UAAU,QAAQ;IAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE;AAG7E;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,EACpC,GAAG,EAAE,MAAM,MAAM,GAChB;IAAE,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,CAyBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,CAyE5E"}
@@ -1,112 +0,0 @@
1
- import { SkillEvent as SkillEventSchema } from '@braidhq/schema';
2
- import { LineBuffer, parseJsonLine } from './streamJsonParser.js';
3
- /**
4
- * Wires a child's stdout / stderr to a single SkillEvent callback.
5
- * Returns `flush` so callers can drain the final un-terminated line on
6
- * `close`.
7
- */
8
- export function attachOutputBuffers(child, onEvent, now) {
9
- const stdout = new LineBuffer((line) => {
10
- const parsed = parseJsonLine(line);
11
- if (parsed === undefined)
12
- return;
13
- for (const event of mapSubprocessEvents(parsed, now()))
14
- onEvent(event);
15
- });
16
- // stderr is wrapped verbatim into a `[stderr]` message event so it
17
- // shows up in the transcript alongside model output.
18
- const stderr = new LineBuffer((line) => {
19
- onEvent(SkillEventSchema.parse({ type: 'message', text: `[stderr] ${line}` }));
20
- });
21
- child.stdout?.setEncoding('utf-8');
22
- child.stdout?.on('data', (chunk) => stdout.append(chunk));
23
- child.stderr?.setEncoding('utf-8');
24
- child.stderr?.on('data', (chunk) => stderr.append(chunk));
25
- return {
26
- flush: () => {
27
- stdout.flush();
28
- stderr.flush();
29
- },
30
- };
31
- }
32
- /**
33
- * Maps a single `claude --output-format stream-json` line into zero or more
34
- * `SkillEvent`s. Claude emits these envelope shapes today: `system` (init
35
- * meta, ignored except for `session_id`), `assistant` (text / tool_use
36
- * content parts), `user` (echoed tool_result, only `is_error` surfaced),
37
- * `rate_limit_*` (ignored), `result` (final outcome). Legacy flat shapes
38
- * (`text`, `tool_use`, `artifact-written`, `error`) are kept for tests and
39
- * older tools.
40
- */
41
- export function mapSubprocessEvents(raw, now) {
42
- const out = [];
43
- if (raw.type === 'system' && raw.subtype === 'init' && typeof raw.session_id === 'string') {
44
- out.push(SkillEventSchema.parse({ type: 'session-started', sessionId: raw.session_id }));
45
- return out;
46
- }
47
- if (raw.type === 'assistant') {
48
- for (const part of readContent(raw)) {
49
- if (part?.type === 'text' && typeof part.text === 'string' && part.text.length > 0) {
50
- out.push(SkillEventSchema.parse({ type: 'message', text: part.text }));
51
- }
52
- else if (part?.type === 'tool_use' && typeof part.name === 'string') {
53
- const event = {
54
- type: 'tool-call',
55
- tool: part.name,
56
- args: part.input ?? null,
57
- };
58
- if (typeof part.id === 'string' && part.id.length > 0)
59
- event.toolCallId = part.id;
60
- out.push(SkillEventSchema.parse(event));
61
- }
62
- }
63
- return out;
64
- }
65
- if (raw.type === 'user') {
66
- for (const part of readContent(raw)) {
67
- if (part?.type === 'tool_result' && typeof part.tool_use_id === 'string') {
68
- const output = typeof part.content === 'string'
69
- ? part.content
70
- : JSON.stringify(part.content ?? '');
71
- out.push(SkillEventSchema.parse({
72
- type: 'tool-result',
73
- toolCallId: part.tool_use_id,
74
- output,
75
- isError: part.is_error === true,
76
- }));
77
- }
78
- }
79
- return out;
80
- }
81
- if (raw.type === 'result') {
82
- const isError = raw.is_error === true;
83
- const text = typeof raw.result === 'string' ? raw.result : '';
84
- if (isError)
85
- out.push(SkillEventSchema.parse({ type: 'error', message: text || 'skill run failed', at: now }));
86
- else if (text.length > 0)
87
- out.push(SkillEventSchema.parse({ type: 'message', text }));
88
- return out;
89
- }
90
- if (raw.type === 'text' && typeof raw.text === 'string')
91
- return [SkillEventSchema.parse({ type: 'message', text: raw.text })];
92
- if (raw.type === 'tool_use' && typeof raw.name === 'string')
93
- return [SkillEventSchema.parse({ type: 'tool-call', tool: raw.name, args: raw.input ?? null })];
94
- if (raw.type === 'artifact-written' && typeof raw.artifactKind === 'string') {
95
- return [SkillEventSchema.parse({
96
- type: 'artifact-written',
97
- artifactKind: raw.artifactKind,
98
- artifactId: raw.artifactId,
99
- path: raw.path,
100
- })];
101
- }
102
- if (raw.type === 'error' && typeof raw.message === 'string')
103
- return [SkillEventSchema.parse({ type: 'error', message: raw.message, at: now })];
104
- return out;
105
- }
106
- function readContent(raw) {
107
- const message = raw.message;
108
- if (!message || !Array.isArray(message.content))
109
- return [];
110
- return message.content;
111
- }
112
- //# sourceMappingURL=subprocessEventStream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subprocessEventStream.js","sourceRoot":"","sources":["../../../src/infrastructure/agent/subprocessEventStream.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAKjE;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAmB,EACnB,OAAoC,EACpC,GAAiB;IAEjB,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;QAClC,IAAI,MAAM,KAAK,SAAS;YACtB,O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
1
- import type { UserRegistryFile } from '../users/UserRegistryFile.js';
2
- import type { AccessPolicy } from './AccessPolicy.js';
3
- /**
4
- * Back-fills `approvedEmails` from existing users.json entries.
5
- *
6
- * Without this, accounts created before the approvedEmails feature
7
- * existed (or while the invite-was-consumed bug was live) would be
8
- * stuck behind Gate-1 even though they hold a valid user record. Every
9
- * email we see in the registry must be persistently approved going
10
- * forward; this is the one-shot reconciliation.
11
- *
12
- * Idempotent: AccessPolicy.approveEmail no-ops when the email is
13
- * already there, so re-running on every boot is cheap.
14
- */
15
- export declare function ensureApprovedEmails(userRegistry: UserRegistryFile, accessPolicy: AccessPolicy): Promise<void>;
16
- //# sourceMappingURL=ensureApprovedEmails.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureApprovedEmails.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/auth/ensureApprovedEmails.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAMf"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Back-fills `approvedEmails` from existing users.json entries.
3
- *
4
- * Without this, accounts created before the approvedEmails feature
5
- * existed (or while the invite-was-consumed bug was live) would be
6
- * stuck behind Gate-1 even though they hold a valid user record. Every
7
- * email we see in the registry must be persistently approved going
8
- * forward; this is the one-shot reconciliation.
9
- *
10
- * Idempotent: AccessPolicy.approveEmail no-ops when the email is
11
- * already there, so re-running on every boot is cheap.
12
- */
13
- export async function ensureApprovedEmails(userRegistry, accessPolicy) {
14
- const users = await userRegistry.list();
15
- for (const user of users) {
16
- if (user.email)
17
- await accessPolicy.approveEmail(user.email);
18
- }
19
- }
20
- //# sourceMappingURL=ensureApprovedEmails.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ensureApprovedEmails.js","sourceRoot":"","sources":["../../../src/infrastructure/auth/ensureApprovedEmails.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,YAA8B,EAC9B,YAA0B;IAE1B,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,CAAA;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,KAAK;YACZ,MAAM,YAAY,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC/C,CAAC;AACH,CAAC"}
@@ -1,11 +0,0 @@
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.
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).
9
- */
10
- export declare function parseBoolEnv(value: string | undefined, defaultValue: boolean): boolean;
11
- //# sourceMappingURL=env.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/infrastructure/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAStF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/infrastructure/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;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"}