@cat-factory/worker 0.6.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 (586) hide show
  1. package/LICENSE +21 -0
  2. package/dist/app.d.ts +22 -0
  3. package/dist/app.d.ts.map +1 -0
  4. package/dist/app.js +49 -0
  5. package/dist/app.js.map +1 -0
  6. package/dist/index.d.ts +17 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +234 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/infrastructure/ai/CloudflareModelProvider.d.ts +23 -0
  11. package/dist/infrastructure/ai/CloudflareModelProvider.d.ts.map +1 -0
  12. package/dist/infrastructure/ai/CloudflareModelProvider.js +62 -0
  13. package/dist/infrastructure/ai/CloudflareModelProvider.js.map +1 -0
  14. package/dist/infrastructure/ai/CompositeAgentExecutor.d.ts +2 -0
  15. package/dist/infrastructure/ai/CompositeAgentExecutor.d.ts.map +1 -0
  16. package/dist/infrastructure/ai/CompositeAgentExecutor.js +5 -0
  17. package/dist/infrastructure/ai/CompositeAgentExecutor.js.map +1 -0
  18. package/dist/infrastructure/ai/ContainerAgentExecutor.d.ts +2 -0
  19. package/dist/infrastructure/ai/ContainerAgentExecutor.d.ts.map +1 -0
  20. package/dist/infrastructure/ai/ContainerAgentExecutor.js +5 -0
  21. package/dist/infrastructure/ai/ContainerAgentExecutor.js.map +1 -0
  22. package/dist/infrastructure/ai/ContainerRepoBootstrapper.d.ts +2 -0
  23. package/dist/infrastructure/ai/ContainerRepoBootstrapper.d.ts.map +1 -0
  24. package/dist/infrastructure/ai/ContainerRepoBootstrapper.js +5 -0
  25. package/dist/infrastructure/ai/ContainerRepoBootstrapper.js.map +1 -0
  26. package/dist/infrastructure/ai/ContainerRepoScanner.d.ts +39 -0
  27. package/dist/infrastructure/ai/ContainerRepoScanner.d.ts.map +1 -0
  28. package/dist/infrastructure/ai/ContainerRepoScanner.js +115 -0
  29. package/dist/infrastructure/ai/ContainerRepoScanner.js.map +1 -0
  30. package/dist/infrastructure/ai/LlmFragmentSelector.d.ts +2 -0
  31. package/dist/infrastructure/ai/LlmFragmentSelector.d.ts.map +1 -0
  32. package/dist/infrastructure/ai/LlmFragmentSelector.js +4 -0
  33. package/dist/infrastructure/ai/LlmFragmentSelector.js.map +1 -0
  34. package/dist/infrastructure/ai/RunnerJobClient.d.ts +2 -0
  35. package/dist/infrastructure/ai/RunnerJobClient.d.ts.map +1 -0
  36. package/dist/infrastructure/ai/RunnerJobClient.js +5 -0
  37. package/dist/infrastructure/ai/RunnerJobClient.js.map +1 -0
  38. package/dist/infrastructure/ai/WorkersAiLlmUpstream.d.ts +28 -0
  39. package/dist/infrastructure/ai/WorkersAiLlmUpstream.d.ts.map +1 -0
  40. package/dist/infrastructure/ai/WorkersAiLlmUpstream.js +486 -0
  41. package/dist/infrastructure/ai/WorkersAiLlmUpstream.js.map +1 -0
  42. package/dist/infrastructure/ai/providerEndpoints.d.ts +17 -0
  43. package/dist/infrastructure/ai/providerEndpoints.d.ts.map +1 -0
  44. package/dist/infrastructure/ai/providerEndpoints.js +42 -0
  45. package/dist/infrastructure/ai/providerEndpoints.js.map +1 -0
  46. package/dist/infrastructure/ai/registries.d.ts +11 -0
  47. package/dist/infrastructure/ai/registries.d.ts.map +1 -0
  48. package/dist/infrastructure/ai/registries.js +14 -0
  49. package/dist/infrastructure/ai/registries.js.map +1 -0
  50. package/dist/infrastructure/auth/GitHubOAuth.d.ts +2 -0
  51. package/dist/infrastructure/auth/GitHubOAuth.d.ts.map +1 -0
  52. package/dist/infrastructure/auth/GitHubOAuth.js +3 -0
  53. package/dist/infrastructure/auth/GitHubOAuth.js.map +1 -0
  54. package/dist/infrastructure/auth/middleware.d.ts +2 -0
  55. package/dist/infrastructure/auth/middleware.d.ts.map +1 -0
  56. package/dist/infrastructure/auth/middleware.js +3 -0
  57. package/dist/infrastructure/auth/middleware.js.map +1 -0
  58. package/dist/infrastructure/auth/signing.d.ts +3 -0
  59. package/dist/infrastructure/auth/signing.d.ts.map +1 -0
  60. package/dist/infrastructure/auth/signing.js +3 -0
  61. package/dist/infrastructure/auth/signing.js.map +1 -0
  62. package/dist/infrastructure/config/agents.d.ts +6 -0
  63. package/dist/infrastructure/config/agents.d.ts.map +1 -0
  64. package/dist/infrastructure/config/agents.js +100 -0
  65. package/dist/infrastructure/config/agents.js.map +1 -0
  66. package/dist/infrastructure/config/auth.d.ts +13 -0
  67. package/dist/infrastructure/config/auth.d.ts.map +1 -0
  68. package/dist/infrastructure/config/auth.js +80 -0
  69. package/dist/infrastructure/config/auth.js.map +1 -0
  70. package/dist/infrastructure/config/cors.d.ts +2 -0
  71. package/dist/infrastructure/config/cors.d.ts.map +1 -0
  72. package/dist/infrastructure/config/cors.js +3 -0
  73. package/dist/infrastructure/config/cors.js.map +1 -0
  74. package/dist/infrastructure/config/datadog.d.ts +6 -0
  75. package/dist/infrastructure/config/datadog.d.ts.map +1 -0
  76. package/dist/infrastructure/config/datadog.js +22 -0
  77. package/dist/infrastructure/config/datadog.js.map +1 -0
  78. package/dist/infrastructure/config/documents.d.ts +5 -0
  79. package/dist/infrastructure/config/documents.d.ts.map +1 -0
  80. package/dist/infrastructure/config/documents.js +36 -0
  81. package/dist/infrastructure/config/documents.js.map +1 -0
  82. package/dist/infrastructure/config/email.d.ts +5 -0
  83. package/dist/infrastructure/config/email.d.ts.map +1 -0
  84. package/dist/infrastructure/config/email.js +12 -0
  85. package/dist/infrastructure/config/email.js.map +1 -0
  86. package/dist/infrastructure/config/environments.d.ts +5 -0
  87. package/dist/infrastructure/config/environments.d.ts.map +1 -0
  88. package/dist/infrastructure/config/environments.js +15 -0
  89. package/dist/infrastructure/config/environments.js.map +1 -0
  90. package/dist/infrastructure/config/execution.d.ts +5 -0
  91. package/dist/infrastructure/config/execution.d.ts.map +1 -0
  92. package/dist/infrastructure/config/execution.js +21 -0
  93. package/dist/infrastructure/config/execution.js.map +1 -0
  94. package/dist/infrastructure/config/fragmentLibrary.d.ts +5 -0
  95. package/dist/infrastructure/config/fragmentLibrary.d.ts.map +1 -0
  96. package/dist/infrastructure/config/fragmentLibrary.js +7 -0
  97. package/dist/infrastructure/config/fragmentLibrary.js.map +1 -0
  98. package/dist/infrastructure/config/github.d.ts +5 -0
  99. package/dist/infrastructure/config/github.d.ts.map +1 -0
  100. package/dist/infrastructure/config/github.js +25 -0
  101. package/dist/infrastructure/config/github.js.map +1 -0
  102. package/dist/infrastructure/config/index.d.ts +20 -0
  103. package/dist/infrastructure/config/index.d.ts.map +1 -0
  104. package/dist/infrastructure/config/index.js +52 -0
  105. package/dist/infrastructure/config/index.js.map +1 -0
  106. package/dist/infrastructure/config/langfuse.d.ts +10 -0
  107. package/dist/infrastructure/config/langfuse.d.ts.map +1 -0
  108. package/dist/infrastructure/config/langfuse.js +17 -0
  109. package/dist/infrastructure/config/langfuse.js.map +1 -0
  110. package/dist/infrastructure/config/observability.d.ts +10 -0
  111. package/dist/infrastructure/config/observability.d.ts.map +1 -0
  112. package/dist/infrastructure/config/observability.js +11 -0
  113. package/dist/infrastructure/config/observability.js.map +1 -0
  114. package/dist/infrastructure/config/retention.d.ts +5 -0
  115. package/dist/infrastructure/config/retention.d.ts.map +1 -0
  116. package/dist/infrastructure/config/retention.js +15 -0
  117. package/dist/infrastructure/config/retention.js.map +1 -0
  118. package/dist/infrastructure/config/runners.d.ts +5 -0
  119. package/dist/infrastructure/config/runners.d.ts.map +1 -0
  120. package/dist/infrastructure/config/runners.js +13 -0
  121. package/dist/infrastructure/config/runners.js.map +1 -0
  122. package/dist/infrastructure/config/slack.d.ts +5 -0
  123. package/dist/infrastructure/config/slack.d.ts.map +1 -0
  124. package/dist/infrastructure/config/slack.js +17 -0
  125. package/dist/infrastructure/config/slack.js.map +1 -0
  126. package/dist/infrastructure/config/spending.d.ts +4 -0
  127. package/dist/infrastructure/config/spending.d.ts.map +1 -0
  128. package/dist/infrastructure/config/spending.js +36 -0
  129. package/dist/infrastructure/config/spending.js.map +1 -0
  130. package/dist/infrastructure/config/tasks.d.ts +5 -0
  131. package/dist/infrastructure/config/tasks.d.ts.map +1 -0
  132. package/dist/infrastructure/config/tasks.js +31 -0
  133. package/dist/infrastructure/config/tasks.js.map +1 -0
  134. package/dist/infrastructure/config/utils.d.ts +6 -0
  135. package/dist/infrastructure/config/utils.d.ts.map +1 -0
  136. package/dist/infrastructure/config/utils.js +24 -0
  137. package/dist/infrastructure/config/utils.js.map +1 -0
  138. package/dist/infrastructure/container.d.ts +8 -0
  139. package/dist/infrastructure/container.d.ts.map +1 -0
  140. package/dist/infrastructure/container.js +1157 -0
  141. package/dist/infrastructure/container.js.map +1 -0
  142. package/dist/infrastructure/containers/CloudflareContainerTransport.d.ts +22 -0
  143. package/dist/infrastructure/containers/CloudflareContainerTransport.d.ts.map +1 -0
  144. package/dist/infrastructure/containers/CloudflareContainerTransport.js +129 -0
  145. package/dist/infrastructure/containers/CloudflareContainerTransport.js.map +1 -0
  146. package/dist/infrastructure/containers/ContainerInstanceRegistry.d.ts +62 -0
  147. package/dist/infrastructure/containers/ContainerInstanceRegistry.d.ts.map +1 -0
  148. package/dist/infrastructure/containers/ContainerInstanceRegistry.js +74 -0
  149. package/dist/infrastructure/containers/ContainerInstanceRegistry.js.map +1 -0
  150. package/dist/infrastructure/containers/ContainerSessionService.d.ts +2 -0
  151. package/dist/infrastructure/containers/ContainerSessionService.d.ts.map +1 -0
  152. package/dist/infrastructure/containers/ContainerSessionService.js +3 -0
  153. package/dist/infrastructure/containers/ContainerSessionService.js.map +1 -0
  154. package/dist/infrastructure/containers/ExecutionContainer.d.ts +48 -0
  155. package/dist/infrastructure/containers/ExecutionContainer.d.ts.map +1 -0
  156. package/dist/infrastructure/containers/ExecutionContainer.js +88 -0
  157. package/dist/infrastructure/containers/ExecutionContainer.js.map +1 -0
  158. package/dist/infrastructure/documents/ConfluenceProvider.d.ts +29 -0
  159. package/dist/infrastructure/documents/ConfluenceProvider.d.ts.map +1 -0
  160. package/dist/infrastructure/documents/ConfluenceProvider.js +179 -0
  161. package/dist/infrastructure/documents/ConfluenceProvider.js.map +1 -0
  162. package/dist/infrastructure/documents/GitHubDocsProvider.d.ts +42 -0
  163. package/dist/infrastructure/documents/GitHubDocsProvider.d.ts.map +1 -0
  164. package/dist/infrastructure/documents/GitHubDocsProvider.js +85 -0
  165. package/dist/infrastructure/documents/GitHubDocsProvider.js.map +1 -0
  166. package/dist/infrastructure/documents/NotionProvider.d.ts +32 -0
  167. package/dist/infrastructure/documents/NotionProvider.d.ts.map +1 -0
  168. package/dist/infrastructure/documents/NotionProvider.js +220 -0
  169. package/dist/infrastructure/documents/NotionProvider.js.map +1 -0
  170. package/dist/infrastructure/durable-objects/WorkspaceEventsHub.d.ts +20 -0
  171. package/dist/infrastructure/durable-objects/WorkspaceEventsHub.d.ts.map +1 -0
  172. package/dist/infrastructure/durable-objects/WorkspaceEventsHub.js +62 -0
  173. package/dist/infrastructure/durable-objects/WorkspaceEventsHub.js.map +1 -0
  174. package/dist/infrastructure/env.d.ts +370 -0
  175. package/dist/infrastructure/env.d.ts.map +1 -0
  176. package/dist/infrastructure/env.js +2 -0
  177. package/dist/infrastructure/env.js.map +1 -0
  178. package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts +27 -0
  179. package/dist/infrastructure/environments/HttpEnvironmentProvider.d.ts.map +1 -0
  180. package/dist/infrastructure/environments/HttpEnvironmentProvider.js +314 -0
  181. package/dist/infrastructure/environments/HttpEnvironmentProvider.js.map +1 -0
  182. package/dist/infrastructure/environments/WebCryptoSecretCipher.d.ts +2 -0
  183. package/dist/infrastructure/environments/WebCryptoSecretCipher.d.ts.map +1 -0
  184. package/dist/infrastructure/environments/WebCryptoSecretCipher.js +5 -0
  185. package/dist/infrastructure/environments/WebCryptoSecretCipher.js.map +1 -0
  186. package/dist/infrastructure/environments/sweep.d.ts +5 -0
  187. package/dist/infrastructure/environments/sweep.d.ts.map +1 -0
  188. package/dist/infrastructure/environments/sweep.js +16 -0
  189. package/dist/infrastructure/environments/sweep.js.map +1 -0
  190. package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts +25 -0
  191. package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts.map +1 -0
  192. package/dist/infrastructure/events/DurableObjectEventPublisher.js +64 -0
  193. package/dist/infrastructure/events/DurableObjectEventPublisher.js.map +1 -0
  194. package/dist/infrastructure/events/InAppNotificationChannel.d.ts +19 -0
  195. package/dist/infrastructure/events/InAppNotificationChannel.d.ts.map +1 -0
  196. package/dist/infrastructure/events/InAppNotificationChannel.js +22 -0
  197. package/dist/infrastructure/events/InAppNotificationChannel.js.map +1 -0
  198. package/dist/infrastructure/gateways/DoRealtimeGateway.d.ts +15 -0
  199. package/dist/infrastructure/gateways/DoRealtimeGateway.d.ts.map +1 -0
  200. package/dist/infrastructure/gateways/DoRealtimeGateway.js +20 -0
  201. package/dist/infrastructure/gateways/DoRealtimeGateway.js.map +1 -0
  202. package/dist/infrastructure/gateways/GitHubGateways.d.ts +27 -0
  203. package/dist/infrastructure/gateways/GitHubGateways.d.ts.map +1 -0
  204. package/dist/infrastructure/gateways/GitHubGateways.js +48 -0
  205. package/dist/infrastructure/gateways/GitHubGateways.js.map +1 -0
  206. package/dist/infrastructure/github/FetchGitHubClient.d.ts +2 -0
  207. package/dist/infrastructure/github/FetchGitHubClient.d.ts.map +1 -0
  208. package/dist/infrastructure/github/FetchGitHubClient.js +4 -0
  209. package/dist/infrastructure/github/FetchGitHubClient.js.map +1 -0
  210. package/dist/infrastructure/github/FetchGitHubProvisioningClient.d.ts +2 -0
  211. package/dist/infrastructure/github/FetchGitHubProvisioningClient.d.ts.map +1 -0
  212. package/dist/infrastructure/github/FetchGitHubProvisioningClient.js +5 -0
  213. package/dist/infrastructure/github/FetchGitHubProvisioningClient.js.map +1 -0
  214. package/dist/infrastructure/github/GitHubAppAuth.d.ts +2 -0
  215. package/dist/infrastructure/github/GitHubAppAuth.d.ts.map +1 -0
  216. package/dist/infrastructure/github/GitHubAppAuth.js +5 -0
  217. package/dist/infrastructure/github/GitHubAppAuth.js.map +1 -0
  218. package/dist/infrastructure/github/GitHubAppRegistry.d.ts +2 -0
  219. package/dist/infrastructure/github/GitHubAppRegistry.d.ts.map +1 -0
  220. package/dist/infrastructure/github/GitHubAppRegistry.js +4 -0
  221. package/dist/infrastructure/github/GitHubAppRegistry.js.map +1 -0
  222. package/dist/infrastructure/github/GitHubCiStatusProvider.d.ts +2 -0
  223. package/dist/infrastructure/github/GitHubCiStatusProvider.d.ts.map +1 -0
  224. package/dist/infrastructure/github/GitHubCiStatusProvider.js +4 -0
  225. package/dist/infrastructure/github/GitHubCiStatusProvider.js.map +1 -0
  226. package/dist/infrastructure/github/GitHubMergeabilityProvider.d.ts +2 -0
  227. package/dist/infrastructure/github/GitHubMergeabilityProvider.d.ts.map +1 -0
  228. package/dist/infrastructure/github/GitHubMergeabilityProvider.js +4 -0
  229. package/dist/infrastructure/github/GitHubMergeabilityProvider.js.map +1 -0
  230. package/dist/infrastructure/github/GitHubPullRequestMerger.d.ts +2 -0
  231. package/dist/infrastructure/github/GitHubPullRequestMerger.d.ts.map +1 -0
  232. package/dist/infrastructure/github/GitHubPullRequestMerger.js +4 -0
  233. package/dist/infrastructure/github/GitHubPullRequestMerger.js.map +1 -0
  234. package/dist/infrastructure/github/WebCryptoWebhookVerifier.d.ts +2 -0
  235. package/dist/infrastructure/github/WebCryptoWebhookVerifier.d.ts.map +1 -0
  236. package/dist/infrastructure/github/WebCryptoWebhookVerifier.js +5 -0
  237. package/dist/infrastructure/github/WebCryptoWebhookVerifier.js.map +1 -0
  238. package/dist/infrastructure/github/encoding.d.ts +2 -0
  239. package/dist/infrastructure/github/encoding.d.ts.map +1 -0
  240. package/dist/infrastructure/github/encoding.js +3 -0
  241. package/dist/infrastructure/github/encoding.js.map +1 -0
  242. package/dist/infrastructure/github/state.d.ts +2 -0
  243. package/dist/infrastructure/github/state.d.ts.map +1 -0
  244. package/dist/infrastructure/github/state.js +3 -0
  245. package/dist/infrastructure/github/state.js.map +1 -0
  246. package/dist/infrastructure/github/sync-consumer.d.ts +16 -0
  247. package/dist/infrastructure/github/sync-consumer.d.ts.map +1 -0
  248. package/dist/infrastructure/github/sync-consumer.js +130 -0
  249. package/dist/infrastructure/github/sync-consumer.js.map +1 -0
  250. package/dist/infrastructure/http/errorHandler.d.ts +2 -0
  251. package/dist/infrastructure/http/errorHandler.d.ts.map +1 -0
  252. package/dist/infrastructure/http/errorHandler.js +3 -0
  253. package/dist/infrastructure/http/errorHandler.js.map +1 -0
  254. package/dist/infrastructure/http/params.d.ts +2 -0
  255. package/dist/infrastructure/http/params.d.ts.map +1 -0
  256. package/dist/infrastructure/http/params.js +3 -0
  257. package/dist/infrastructure/http/params.js.map +1 -0
  258. package/dist/infrastructure/http/types.d.ts +12 -0
  259. package/dist/infrastructure/http/types.d.ts.map +1 -0
  260. package/dist/infrastructure/http/types.js +2 -0
  261. package/dist/infrastructure/http/types.js.map +1 -0
  262. package/dist/infrastructure/http/validation.d.ts +2 -0
  263. package/dist/infrastructure/http/validation.d.ts.map +1 -0
  264. package/dist/infrastructure/http/validation.js +3 -0
  265. package/dist/infrastructure/http/validation.js.map +1 -0
  266. package/dist/infrastructure/observability/logger.d.ts +3 -0
  267. package/dist/infrastructure/observability/logger.d.ts.map +1 -0
  268. package/dist/infrastructure/observability/logger.js +4 -0
  269. package/dist/infrastructure/observability/logger.js.map +1 -0
  270. package/dist/infrastructure/repositories/D1AccountInvitationRepository.d.ts +15 -0
  271. package/dist/infrastructure/repositories/D1AccountInvitationRepository.d.ts.map +1 -0
  272. package/dist/infrastructure/repositories/D1AccountInvitationRepository.js +63 -0
  273. package/dist/infrastructure/repositories/D1AccountInvitationRepository.js.map +1 -0
  274. package/dist/infrastructure/repositories/D1AccountRepository.d.ts +15 -0
  275. package/dist/infrastructure/repositories/D1AccountRepository.d.ts.map +1 -0
  276. package/dist/infrastructure/repositories/D1AccountRepository.js +52 -0
  277. package/dist/infrastructure/repositories/D1AccountRepository.js.map +1 -0
  278. package/dist/infrastructure/repositories/D1AgentRunRepository.d.ts +18 -0
  279. package/dist/infrastructure/repositories/D1AgentRunRepository.d.ts.map +1 -0
  280. package/dist/infrastructure/repositories/D1AgentRunRepository.js +34 -0
  281. package/dist/infrastructure/repositories/D1AgentRunRepository.js.map +1 -0
  282. package/dist/infrastructure/repositories/D1BlockRepository.d.ts +23 -0
  283. package/dist/infrastructure/repositories/D1BlockRepository.d.ts.map +1 -0
  284. package/dist/infrastructure/repositories/D1BlockRepository.js +101 -0
  285. package/dist/infrastructure/repositories/D1BlockRepository.js.map +1 -0
  286. package/dist/infrastructure/repositories/D1BootstrapJobRepository.d.ts +16 -0
  287. package/dist/infrastructure/repositories/D1BootstrapJobRepository.d.ts.map +1 -0
  288. package/dist/infrastructure/repositories/D1BootstrapJobRepository.js +209 -0
  289. package/dist/infrastructure/repositories/D1BootstrapJobRepository.js.map +1 -0
  290. package/dist/infrastructure/repositories/D1BranchProjectionRepository.d.ts +12 -0
  291. package/dist/infrastructure/repositories/D1BranchProjectionRepository.d.ts.map +1 -0
  292. package/dist/infrastructure/repositories/D1BranchProjectionRepository.js +29 -0
  293. package/dist/infrastructure/repositories/D1BranchProjectionRepository.js.map +1 -0
  294. package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.d.ts +12 -0
  295. package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.d.ts.map +1 -0
  296. package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.js +29 -0
  297. package/dist/infrastructure/repositories/D1CheckRunProjectionRepository.js.map +1 -0
  298. package/dist/infrastructure/repositories/D1ClarityReviewRepository.d.ts +19 -0
  299. package/dist/infrastructure/repositories/D1ClarityReviewRepository.d.ts.map +1 -0
  300. package/dist/infrastructure/repositories/D1ClarityReviewRepository.js +75 -0
  301. package/dist/infrastructure/repositories/D1ClarityReviewRepository.js.map +1 -0
  302. package/dist/infrastructure/repositories/D1CommitProjectionRepository.d.ts +13 -0
  303. package/dist/infrastructure/repositories/D1CommitProjectionRepository.d.ts.map +1 -0
  304. package/dist/infrastructure/repositories/D1CommitProjectionRepository.js +48 -0
  305. package/dist/infrastructure/repositories/D1CommitProjectionRepository.js.map +1 -0
  306. package/dist/infrastructure/repositories/D1ConsensusSessionRepository.d.ts +19 -0
  307. package/dist/infrastructure/repositories/D1ConsensusSessionRepository.d.ts.map +1 -0
  308. package/dist/infrastructure/repositories/D1ConsensusSessionRepository.js +88 -0
  309. package/dist/infrastructure/repositories/D1ConsensusSessionRepository.js.map +1 -0
  310. package/dist/infrastructure/repositories/D1DatadogConnectionRepository.d.ts +17 -0
  311. package/dist/infrastructure/repositories/D1DatadogConnectionRepository.d.ts.map +1 -0
  312. package/dist/infrastructure/repositories/D1DatadogConnectionRepository.js +47 -0
  313. package/dist/infrastructure/repositories/D1DatadogConnectionRepository.js.map +1 -0
  314. package/dist/infrastructure/repositories/D1DocumentConnectionRepository.d.ts +27 -0
  315. package/dist/infrastructure/repositories/D1DocumentConnectionRepository.d.ts.map +1 -0
  316. package/dist/infrastructure/repositories/D1DocumentConnectionRepository.js +89 -0
  317. package/dist/infrastructure/repositories/D1DocumentConnectionRepository.js.map +1 -0
  318. package/dist/infrastructure/repositories/D1DocumentRepository.d.ts +15 -0
  319. package/dist/infrastructure/repositories/D1DocumentRepository.d.ts.map +1 -0
  320. package/dist/infrastructure/repositories/D1DocumentRepository.js +66 -0
  321. package/dist/infrastructure/repositories/D1DocumentRepository.js.map +1 -0
  322. package/dist/infrastructure/repositories/D1EmailConnectionRepository.d.ts +13 -0
  323. package/dist/infrastructure/repositories/D1EmailConnectionRepository.d.ts.map +1 -0
  324. package/dist/infrastructure/repositories/D1EmailConnectionRepository.js +46 -0
  325. package/dist/infrastructure/repositories/D1EmailConnectionRepository.js.map +1 -0
  326. package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.d.ts +13 -0
  327. package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.d.ts.map +1 -0
  328. package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.js +48 -0
  329. package/dist/infrastructure/repositories/D1EnvironmentConnectionRepository.js.map +1 -0
  330. package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.d.ts +17 -0
  331. package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.d.ts.map +1 -0
  332. package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.js +95 -0
  333. package/dist/infrastructure/repositories/D1EnvironmentRegistryRepository.js.map +1 -0
  334. package/dist/infrastructure/repositories/D1ExecutionRepository.d.ts +28 -0
  335. package/dist/infrastructure/repositories/D1ExecutionRepository.d.ts.map +1 -0
  336. package/dist/infrastructure/repositories/D1ExecutionRepository.js +113 -0
  337. package/dist/infrastructure/repositories/D1ExecutionRepository.js.map +1 -0
  338. package/dist/infrastructure/repositories/D1FragmentSourceRepository.d.ts +15 -0
  339. package/dist/infrastructure/repositories/D1FragmentSourceRepository.d.ts.map +1 -0
  340. package/dist/infrastructure/repositories/D1FragmentSourceRepository.js +66 -0
  341. package/dist/infrastructure/repositories/D1FragmentSourceRepository.js.map +1 -0
  342. package/dist/infrastructure/repositories/D1GitHubInstallationRepository.d.ts +17 -0
  343. package/dist/infrastructure/repositories/D1GitHubInstallationRepository.d.ts.map +1 -0
  344. package/dist/infrastructure/repositories/D1GitHubInstallationRepository.js +79 -0
  345. package/dist/infrastructure/repositories/D1GitHubInstallationRepository.js.map +1 -0
  346. package/dist/infrastructure/repositories/D1IssueProjectionRepository.d.ts +13 -0
  347. package/dist/infrastructure/repositories/D1IssueProjectionRepository.d.ts.map +1 -0
  348. package/dist/infrastructure/repositories/D1IssueProjectionRepository.js +36 -0
  349. package/dist/infrastructure/repositories/D1IssueProjectionRepository.js.map +1 -0
  350. package/dist/infrastructure/repositories/D1LiveContainerRepository.d.ts +17 -0
  351. package/dist/infrastructure/repositories/D1LiveContainerRepository.d.ts.map +1 -0
  352. package/dist/infrastructure/repositories/D1LiveContainerRepository.js +40 -0
  353. package/dist/infrastructure/repositories/D1LiveContainerRepository.js.map +1 -0
  354. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts +15 -0
  355. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.d.ts.map +1 -0
  356. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js +123 -0
  357. package/dist/infrastructure/repositories/D1LlmCallMetricRepository.js.map +1 -0
  358. package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.d.ts +15 -0
  359. package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.d.ts.map +1 -0
  360. package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.js +63 -0
  361. package/dist/infrastructure/repositories/D1LocalModelEndpointRepository.js.map +1 -0
  362. package/dist/infrastructure/repositories/D1MembershipRepository.d.ts +15 -0
  363. package/dist/infrastructure/repositories/D1MembershipRepository.d.ts.map +1 -0
  364. package/dist/infrastructure/repositories/D1MembershipRepository.js +58 -0
  365. package/dist/infrastructure/repositories/D1MembershipRepository.js.map +1 -0
  366. package/dist/infrastructure/repositories/D1MergePresetRepository.d.ts +21 -0
  367. package/dist/infrastructure/repositories/D1MergePresetRepository.d.ts.map +1 -0
  368. package/dist/infrastructure/repositories/D1MergePresetRepository.js +88 -0
  369. package/dist/infrastructure/repositories/D1MergePresetRepository.js.map +1 -0
  370. package/dist/infrastructure/repositories/D1ModelDefaultsRepository.d.ts +18 -0
  371. package/dist/infrastructure/repositories/D1ModelDefaultsRepository.d.ts.map +1 -0
  372. package/dist/infrastructure/repositories/D1ModelDefaultsRepository.js +47 -0
  373. package/dist/infrastructure/repositories/D1ModelDefaultsRepository.js.map +1 -0
  374. package/dist/infrastructure/repositories/D1NotificationRepository.d.ts +20 -0
  375. package/dist/infrastructure/repositories/D1NotificationRepository.d.ts.map +1 -0
  376. package/dist/infrastructure/repositories/D1NotificationRepository.js +81 -0
  377. package/dist/infrastructure/repositories/D1NotificationRepository.js.map +1 -0
  378. package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.d.ts +28 -0
  379. package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.d.ts.map +1 -0
  380. package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.js +142 -0
  381. package/dist/infrastructure/repositories/D1PersonalSubscriptionRepository.js.map +1 -0
  382. package/dist/infrastructure/repositories/D1PipelineRepository.d.ts +15 -0
  383. package/dist/infrastructure/repositories/D1PipelineRepository.d.ts.map +1 -0
  384. package/dist/infrastructure/repositories/D1PipelineRepository.js +46 -0
  385. package/dist/infrastructure/repositories/D1PipelineRepository.js.map +1 -0
  386. package/dist/infrastructure/repositories/D1PipelineScheduleRepository.d.ts +26 -0
  387. package/dist/infrastructure/repositories/D1PipelineScheduleRepository.d.ts.map +1 -0
  388. package/dist/infrastructure/repositories/D1PipelineScheduleRepository.js +192 -0
  389. package/dist/infrastructure/repositories/D1PipelineScheduleRepository.js.map +1 -0
  390. package/dist/infrastructure/repositories/D1PromptFragmentRepository.d.ts +15 -0
  391. package/dist/infrastructure/repositories/D1PromptFragmentRepository.d.ts.map +1 -0
  392. package/dist/infrastructure/repositories/D1PromptFragmentRepository.js +90 -0
  393. package/dist/infrastructure/repositories/D1PromptFragmentRepository.js.map +1 -0
  394. package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.d.ts +21 -0
  395. package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.d.ts.map +1 -0
  396. package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.js +108 -0
  397. package/dist/infrastructure/repositories/D1ProviderApiKeyRepository.js.map +1 -0
  398. package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.d.ts +19 -0
  399. package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.d.ts.map +1 -0
  400. package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.js +78 -0
  401. package/dist/infrastructure/repositories/D1ProviderSubscriptionTokenRepository.js.map +1 -0
  402. package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.d.ts +13 -0
  403. package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.d.ts.map +1 -0
  404. package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.js +32 -0
  405. package/dist/infrastructure/repositories/D1PullRequestProjectionRepository.js.map +1 -0
  406. package/dist/infrastructure/repositories/D1RateLimitRepository.d.ts +18 -0
  407. package/dist/infrastructure/repositories/D1RateLimitRepository.d.ts.map +1 -0
  408. package/dist/infrastructure/repositories/D1RateLimitRepository.js +30 -0
  409. package/dist/infrastructure/repositories/D1RateLimitRepository.js.map +1 -0
  410. package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.d.ts +15 -0
  411. package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.d.ts.map +1 -0
  412. package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.js +77 -0
  413. package/dist/infrastructure/repositories/D1ReferenceArchitectureRepository.js.map +1 -0
  414. package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.d.ts +17 -0
  415. package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.d.ts.map +1 -0
  416. package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.js +64 -0
  417. package/dist/infrastructure/repositories/D1ReleaseHealthConfigRepository.js.map +1 -0
  418. package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts +20 -0
  419. package/dist/infrastructure/repositories/D1RepoBlueprintRepository.d.ts.map +1 -0
  420. package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js +64 -0
  421. package/dist/infrastructure/repositories/D1RepoBlueprintRepository.js.map +1 -0
  422. package/dist/infrastructure/repositories/D1RepoProjectionRepository.d.ts +20 -0
  423. package/dist/infrastructure/repositories/D1RepoProjectionRepository.d.ts.map +1 -0
  424. package/dist/infrastructure/repositories/D1RepoProjectionRepository.js +121 -0
  425. package/dist/infrastructure/repositories/D1RepoProjectionRepository.js.map +1 -0
  426. package/dist/infrastructure/repositories/D1RequirementReviewRepository.d.ts +20 -0
  427. package/dist/infrastructure/repositories/D1RequirementReviewRepository.d.ts.map +1 -0
  428. package/dist/infrastructure/repositories/D1RequirementReviewRepository.js +76 -0
  429. package/dist/infrastructure/repositories/D1RequirementReviewRepository.js.map +1 -0
  430. package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.d.ts +13 -0
  431. package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.d.ts.map +1 -0
  432. package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.js +48 -0
  433. package/dist/infrastructure/repositories/D1RunnerPoolConnectionRepository.js.map +1 -0
  434. package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.d.ts +16 -0
  435. package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.d.ts.map +1 -0
  436. package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.js +27 -0
  437. package/dist/infrastructure/repositories/D1ServiceFragmentDefaultsRepository.js.map +1 -0
  438. package/dist/infrastructure/repositories/D1ServiceRepository.d.ts +19 -0
  439. package/dist/infrastructure/repositories/D1ServiceRepository.d.ts.map +1 -0
  440. package/dist/infrastructure/repositories/D1ServiceRepository.js +114 -0
  441. package/dist/infrastructure/repositories/D1ServiceRepository.js.map +1 -0
  442. package/dist/infrastructure/repositories/D1SlackRepositories.d.ts +29 -0
  443. package/dist/infrastructure/repositories/D1SlackRepositories.d.ts.map +1 -0
  444. package/dist/infrastructure/repositories/D1SlackRepositories.js +119 -0
  445. package/dist/infrastructure/repositories/D1SlackRepositories.js.map +1 -0
  446. package/dist/infrastructure/repositories/D1TaskConnectionRepository.d.ts +27 -0
  447. package/dist/infrastructure/repositories/D1TaskConnectionRepository.d.ts.map +1 -0
  448. package/dist/infrastructure/repositories/D1TaskConnectionRepository.js +89 -0
  449. package/dist/infrastructure/repositories/D1TaskConnectionRepository.js.map +1 -0
  450. package/dist/infrastructure/repositories/D1TaskRepository.d.ts +15 -0
  451. package/dist/infrastructure/repositories/D1TaskRepository.d.ts.map +1 -0
  452. package/dist/infrastructure/repositories/D1TaskRepository.js +90 -0
  453. package/dist/infrastructure/repositories/D1TaskRepository.js.map +1 -0
  454. package/dist/infrastructure/repositories/D1TokenUsageRepository.d.ts +13 -0
  455. package/dist/infrastructure/repositories/D1TokenUsageRepository.d.ts.map +1 -0
  456. package/dist/infrastructure/repositories/D1TokenUsageRepository.js +41 -0
  457. package/dist/infrastructure/repositories/D1TokenUsageRepository.js.map +1 -0
  458. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts +12 -0
  459. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts.map +1 -0
  460. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js +32 -0
  461. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js.map +1 -0
  462. package/dist/infrastructure/repositories/D1UserRepository.d.ts +19 -0
  463. package/dist/infrastructure/repositories/D1UserRepository.d.ts.map +1 -0
  464. package/dist/infrastructure/repositories/D1UserRepository.js +108 -0
  465. package/dist/infrastructure/repositories/D1UserRepository.js.map +1 -0
  466. package/dist/infrastructure/repositories/D1WorkspaceMountRepository.d.ts +19 -0
  467. package/dist/infrastructure/repositories/D1WorkspaceMountRepository.d.ts.map +1 -0
  468. package/dist/infrastructure/repositories/D1WorkspaceMountRepository.js +115 -0
  469. package/dist/infrastructure/repositories/D1WorkspaceMountRepository.js.map +1 -0
  470. package/dist/infrastructure/repositories/D1WorkspaceRepository.d.ts +18 -0
  471. package/dist/infrastructure/repositories/D1WorkspaceRepository.d.ts.map +1 -0
  472. package/dist/infrastructure/repositories/D1WorkspaceRepository.js +77 -0
  473. package/dist/infrastructure/repositories/D1WorkspaceRepository.js.map +1 -0
  474. package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.d.ts +17 -0
  475. package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.d.ts.map +1 -0
  476. package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.js +50 -0
  477. package/dist/infrastructure/repositories/D1WorkspaceSettingsRepository.js.map +1 -0
  478. package/dist/infrastructure/repositories/chunk.d.ts +11 -0
  479. package/dist/infrastructure/repositories/chunk.d.ts.map +1 -0
  480. package/dist/infrastructure/repositories/chunk.js +17 -0
  481. package/dist/infrastructure/repositories/chunk.js.map +1 -0
  482. package/dist/infrastructure/repositories/github-mappers/branch.d.ts +11 -0
  483. package/dist/infrastructure/repositories/github-mappers/branch.d.ts.map +1 -0
  484. package/dist/infrastructure/repositories/github-mappers/branch.js +22 -0
  485. package/dist/infrastructure/repositories/github-mappers/branch.js.map +1 -0
  486. package/dist/infrastructure/repositories/github-mappers/check-run.d.ts +13 -0
  487. package/dist/infrastructure/repositories/github-mappers/check-run.d.ts.map +1 -0
  488. package/dist/infrastructure/repositories/github-mappers/check-run.js +24 -0
  489. package/dist/infrastructure/repositories/github-mappers/check-run.js.map +1 -0
  490. package/dist/infrastructure/repositories/github-mappers/commit.d.ts +12 -0
  491. package/dist/infrastructure/repositories/github-mappers/commit.d.ts.map +1 -0
  492. package/dist/infrastructure/repositories/github-mappers/commit.js +22 -0
  493. package/dist/infrastructure/repositories/github-mappers/commit.js.map +1 -0
  494. package/dist/infrastructure/repositories/github-mappers/index.d.ts +11 -0
  495. package/dist/infrastructure/repositories/github-mappers/index.d.ts.map +1 -0
  496. package/dist/infrastructure/repositories/github-mappers/index.js +14 -0
  497. package/dist/infrastructure/repositories/github-mappers/index.js.map +1 -0
  498. package/dist/infrastructure/repositories/github-mappers/installation.d.ts +16 -0
  499. package/dist/infrastructure/repositories/github-mappers/installation.d.ts.map +1 -0
  500. package/dist/infrastructure/repositories/github-mappers/installation.js +29 -0
  501. package/dist/infrastructure/repositories/github-mappers/installation.js.map +1 -0
  502. package/dist/infrastructure/repositories/github-mappers/issue.d.ts +15 -0
  503. package/dist/infrastructure/repositories/github-mappers/issue.d.ts.map +1 -0
  504. package/dist/infrastructure/repositories/github-mappers/issue.js +29 -0
  505. package/dist/infrastructure/repositories/github-mappers/issue.js.map +1 -0
  506. package/dist/infrastructure/repositories/github-mappers/pull-request.d.ts +18 -0
  507. package/dist/infrastructure/repositories/github-mappers/pull-request.d.ts.map +1 -0
  508. package/dist/infrastructure/repositories/github-mappers/pull-request.js +36 -0
  509. package/dist/infrastructure/repositories/github-mappers/pull-request.js.map +1 -0
  510. package/dist/infrastructure/repositories/github-mappers/repo.d.ts +15 -0
  511. package/dist/infrastructure/repositories/github-mappers/repo.d.ts.map +1 -0
  512. package/dist/infrastructure/repositories/github-mappers/repo.js +31 -0
  513. package/dist/infrastructure/repositories/github-mappers/repo.js.map +1 -0
  514. package/dist/infrastructure/repositories/github-mappers/serialize.d.ts +3 -0
  515. package/dist/infrastructure/repositories/github-mappers/serialize.d.ts.map +1 -0
  516. package/dist/infrastructure/repositories/github-mappers/serialize.js +4 -0
  517. package/dist/infrastructure/repositories/github-mappers/serialize.js.map +1 -0
  518. package/dist/infrastructure/repositories/github-mappers/sync-cursor.d.ts +8 -0
  519. package/dist/infrastructure/repositories/github-mappers/sync-cursor.d.ts.map +1 -0
  520. package/dist/infrastructure/repositories/github-mappers/sync-cursor.js +4 -0
  521. package/dist/infrastructure/repositories/github-mappers/sync-cursor.js.map +1 -0
  522. package/dist/infrastructure/repositories/github-mappers/upsert.d.ts +11 -0
  523. package/dist/infrastructure/repositories/github-mappers/upsert.d.ts.map +1 -0
  524. package/dist/infrastructure/repositories/github-mappers/upsert.js +18 -0
  525. package/dist/infrastructure/repositories/github-mappers/upsert.js.map +1 -0
  526. package/dist/infrastructure/repositories/mappers.d.ts +2 -0
  527. package/dist/infrastructure/repositories/mappers.d.ts.map +1 -0
  528. package/dist/infrastructure/repositories/mappers.js +4 -0
  529. package/dist/infrastructure/repositories/mappers.js.map +1 -0
  530. package/dist/infrastructure/runners/HttpRunnerPoolProvider.d.ts +2 -0
  531. package/dist/infrastructure/runners/HttpRunnerPoolProvider.d.ts.map +1 -0
  532. package/dist/infrastructure/runners/HttpRunnerPoolProvider.js +5 -0
  533. package/dist/infrastructure/runners/HttpRunnerPoolProvider.js.map +1 -0
  534. package/dist/infrastructure/runners/RunnerPoolTransport.d.ts +2 -0
  535. package/dist/infrastructure/runners/RunnerPoolTransport.d.ts.map +1 -0
  536. package/dist/infrastructure/runners/RunnerPoolTransport.js +5 -0
  537. package/dist/infrastructure/runners/RunnerPoolTransport.js.map +1 -0
  538. package/dist/infrastructure/runtime.d.ts +8 -0
  539. package/dist/infrastructure/runtime.d.ts.map +1 -0
  540. package/dist/infrastructure/runtime.js +13 -0
  541. package/dist/infrastructure/runtime.js.map +1 -0
  542. package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts +50 -0
  543. package/dist/infrastructure/tasks/GitHubIssuesProvider.d.ts.map +1 -0
  544. package/dist/infrastructure/tasks/GitHubIssuesProvider.js +91 -0
  545. package/dist/infrastructure/tasks/GitHubIssuesProvider.js.map +1 -0
  546. package/dist/infrastructure/tasks/JiraProvider.d.ts +29 -0
  547. package/dist/infrastructure/tasks/JiraProvider.d.ts.map +1 -0
  548. package/dist/infrastructure/tasks/JiraProvider.js +109 -0
  549. package/dist/infrastructure/tasks/JiraProvider.js.map +1 -0
  550. package/dist/infrastructure/workflows/BootstrapWorkflow.d.ts +21 -0
  551. package/dist/infrastructure/workflows/BootstrapWorkflow.d.ts.map +1 -0
  552. package/dist/infrastructure/workflows/BootstrapWorkflow.js +72 -0
  553. package/dist/infrastructure/workflows/BootstrapWorkflow.js.map +1 -0
  554. package/dist/infrastructure/workflows/ExecutionWorkflow.d.ts +15 -0
  555. package/dist/infrastructure/workflows/ExecutionWorkflow.d.ts.map +1 -0
  556. package/dist/infrastructure/workflows/ExecutionWorkflow.js +169 -0
  557. package/dist/infrastructure/workflows/ExecutionWorkflow.js.map +1 -0
  558. package/dist/infrastructure/workflows/GitHubBackfillWorkflow.d.ts +17 -0
  559. package/dist/infrastructure/workflows/GitHubBackfillWorkflow.d.ts.map +1 -0
  560. package/dist/infrastructure/workflows/GitHubBackfillWorkflow.js +24 -0
  561. package/dist/infrastructure/workflows/GitHubBackfillWorkflow.js.map +1 -0
  562. package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.d.ts +15 -0
  563. package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.d.ts.map +1 -0
  564. package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.js +34 -0
  565. package/dist/infrastructure/workflows/WorkflowsBootstrapRunner.js.map +1 -0
  566. package/dist/infrastructure/workflows/WorkflowsWorkRunner.d.ts +31 -0
  567. package/dist/infrastructure/workflows/WorkflowsWorkRunner.d.ts.map +1 -0
  568. package/dist/infrastructure/workflows/WorkflowsWorkRunner.js +55 -0
  569. package/dist/infrastructure/workflows/WorkflowsWorkRunner.js.map +1 -0
  570. package/dist/infrastructure/workflows/retention.d.ts +35 -0
  571. package/dist/infrastructure/workflows/retention.d.ts.map +1 -0
  572. package/dist/infrastructure/workflows/retention.js +26 -0
  573. package/dist/infrastructure/workflows/retention.js.map +1 -0
  574. package/dist/infrastructure/workflows/sweeper.d.ts +57 -0
  575. package/dist/infrastructure/workflows/sweeper.d.ts.map +1 -0
  576. package/dist/infrastructure/workflows/sweeper.js +62 -0
  577. package/dist/infrastructure/workflows/sweeper.js.map +1 -0
  578. package/migrations/0001_init.sql +677 -0
  579. package/migrations/0002_clarity_reviews.sql +19 -0
  580. package/migrations/0002_consensus.sql +38 -0
  581. package/migrations/0002_llm_reasoning_text.sql +6 -0
  582. package/migrations/0002_local_model_endpoints.sql +16 -0
  583. package/migrations/0003_pipeline_labels_archive.sql +13 -0
  584. package/migrations/0003_release_health.sql +34 -0
  585. package/migrations/0004_run_timing_task_types.sql +24 -0
  586. package/package.json +65 -0
@@ -0,0 +1,17 @@
1
+ import type { D1Database } from '@cloudflare/workers-types';
2
+ import type { LiveContainerRecord, LiveContainerStore } from '../containers/ContainerInstanceRegistry';
3
+ /**
4
+ * The live-container inventory over D1 (`live_containers`, migration 0022). `add`
5
+ * uses `ON CONFLICT(container_key) DO NOTHING` so a replayed dispatch preserves the
6
+ * first `started_at` — the container's true age the reaper keys off.
7
+ */
8
+ export declare class D1LiveContainerRepository implements LiveContainerStore {
9
+ private readonly db;
10
+ constructor({ db }: {
11
+ db: D1Database;
12
+ });
13
+ add(record: LiveContainerRecord): Promise<void>;
14
+ remove(containerKey: string): Promise<void>;
15
+ listStartedBefore(epochMs: number): Promise<LiveContainerRecord[]>;
16
+ }
17
+ //# sourceMappingURL=D1LiveContainerRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LiveContainerRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LiveContainerRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,yCAAyC,CAAA;AAEhD;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CASpD;IAEK,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhD;IAEK,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAoBvE;CACF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The live-container inventory over D1 (`live_containers`, migration 0022). `add`
3
+ * uses `ON CONFLICT(container_key) DO NOTHING` so a replayed dispatch preserves the
4
+ * first `started_at` — the container's true age the reaper keys off.
5
+ */
6
+ export class D1LiveContainerRepository {
7
+ db;
8
+ constructor({ db }) {
9
+ this.db = db;
10
+ }
11
+ async add(record) {
12
+ await this.db
13
+ .prepare(`INSERT INTO live_containers (container_key, kind, workspace_id, started_at)
14
+ VALUES (?, ?, ?, ?)
15
+ ON CONFLICT(container_key) DO NOTHING`)
16
+ .bind(record.containerKey, record.kind, record.workspaceId ?? null, record.startedAt)
17
+ .run();
18
+ }
19
+ async remove(containerKey) {
20
+ await this.db
21
+ .prepare('DELETE FROM live_containers WHERE container_key = ?')
22
+ .bind(containerKey)
23
+ .run();
24
+ }
25
+ async listStartedBefore(epochMs) {
26
+ const { results } = await this.db
27
+ .prepare(`SELECT container_key, kind, workspace_id, started_at FROM live_containers
28
+ WHERE started_at < ?
29
+ ORDER BY started_at`)
30
+ .bind(epochMs)
31
+ .all();
32
+ return (results ?? []).map((r) => ({
33
+ containerKey: r.container_key,
34
+ kind: r.kind,
35
+ ...(r.workspace_id != null ? { workspaceId: r.workspace_id } : {}),
36
+ startedAt: r.started_at,
37
+ }));
38
+ }
39
+ }
40
+ //# sourceMappingURL=D1LiveContainerRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LiveContainerRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LiveContainerRepository.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IACnB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAA2B;QACnC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;+CAEuC,CACxC;aACA,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC;aACpF,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,YAAoB;QAC/B,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,qDAAqD,CAAC;aAC9D,IAAI,CAAC,YAAY,CAAC;aAClB,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,OAAe;QACrC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN;;6BAEqB,CACtB;aACA,IAAI,CAAC,OAAO,CAAC;aACb,GAAG,EAKA,CAAA;QACN,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACjC,YAAY,EAAE,CAAC,CAAC,aAAa;YAC7B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,GAAG,CAAC,CAAC,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,SAAS,EAAE,CAAC,CAAC,UAAU;SACxB,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import { type LlmCallMetric, type LlmCallMetricRepository, type LlmCallMetricSummary, type LlmPromptChainTip } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /** D1-backed sink for LLM observability (see migration 0026). */
4
+ export declare class D1LlmCallMetricRepository implements LlmCallMetricRepository {
5
+ private readonly db;
6
+ constructor({ db }: {
7
+ db: D1Database;
8
+ });
9
+ record(metric: LlmCallMetric): Promise<void>;
10
+ latestChainTip(workspaceId: string, executionId: string, agentKind: string): Promise<LlmPromptChainTip | null>;
11
+ listByExecution(workspaceId: string, executionId: string, limit?: number): Promise<LlmCallMetric[]>;
12
+ summarizeByExecution(workspaceId: string, executionId: string): Promise<LlmCallMetricSummary[]>;
13
+ deleteOlderThan(epochMs: number): Promise<number>;
14
+ }
15
+ //# sourceMappingURL=D1LlmCallMetricRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LlmCallMetricRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LlmCallMetricRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAoE3D,iEAAiE;AACjE,qBAAa,yBAA0B,YAAW,uBAAuB;IACvE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAyCjD;IAEK,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAcnC;IAEK,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,EAAE,CAAC,CAY1B;IAEK,oBAAoB,CACxB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAgDjC;IAEK,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOtD;CACF"}
@@ -0,0 +1,123 @@
1
+ import { LLM_WARNING_FINISH_REASONS, } from '@cat-factory/kernel';
2
+ // `length` and `content_filter` as a SQL list literal, derived from the shared
3
+ // constant so the warning classification matches the service + the Node store.
4
+ const WARNING_REASONS_SQL = LLM_WARNING_FINISH_REASONS.map((r) => `'${r}'`).join(', ');
5
+ function rowToMetric(row) {
6
+ return {
7
+ id: row.id,
8
+ workspaceId: row.workspace_id,
9
+ executionId: row.execution_id,
10
+ agentKind: row.agent_kind,
11
+ provider: row.provider,
12
+ model: row.model,
13
+ createdAt: row.created_at,
14
+ streaming: row.streaming === 1,
15
+ messageCount: row.message_count,
16
+ toolCount: row.tool_count,
17
+ requestMaxTokens: row.request_max_tokens,
18
+ promptTokens: row.prompt_tokens,
19
+ cachedPromptTokens: row.cached_prompt_tokens,
20
+ completionTokens: row.completion_tokens,
21
+ totalTokens: row.total_tokens,
22
+ finishReason: row.finish_reason,
23
+ upstreamMs: row.upstream_ms,
24
+ overheadMs: row.overhead_ms,
25
+ totalMs: row.total_ms,
26
+ ok: row.ok === 1,
27
+ httpStatus: row.http_status,
28
+ errorMessage: row.error_message,
29
+ promptText: row.prompt_text,
30
+ promptPrefixCount: row.prompt_prefix_count,
31
+ promptHash: row.prompt_hash,
32
+ responseText: row.response_text,
33
+ reasoningText: row.reasoning_text,
34
+ };
35
+ }
36
+ /** D1-backed sink for LLM observability (see migration 0026). */
37
+ export class D1LlmCallMetricRepository {
38
+ db;
39
+ constructor({ db }) {
40
+ this.db = db;
41
+ }
42
+ async record(metric) {
43
+ await this.db
44
+ .prepare(`INSERT INTO llm_call_metrics
45
+ (id, workspace_id, execution_id, agent_kind, provider, model, created_at,
46
+ streaming, message_count, tool_count, request_max_tokens,
47
+ prompt_tokens, cached_prompt_tokens, completion_tokens, total_tokens, finish_reason,
48
+ upstream_ms, overhead_ms, total_ms, ok, http_status, error_message,
49
+ prompt_text, prompt_prefix_count, prompt_hash, response_text, reasoning_text)
50
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
51
+ .bind(metric.id, metric.workspaceId, metric.executionId, metric.agentKind, metric.provider, metric.model, metric.createdAt, metric.streaming ? 1 : 0, metric.messageCount, metric.toolCount, metric.requestMaxTokens, metric.promptTokens, metric.cachedPromptTokens, metric.completionTokens, metric.totalTokens, metric.finishReason, metric.upstreamMs, metric.overheadMs, metric.totalMs, metric.ok ? 1 : 0, metric.httpStatus, metric.errorMessage, metric.promptText, metric.promptPrefixCount, metric.promptHash, metric.responseText, metric.reasoningText)
52
+ .run();
53
+ }
54
+ async latestChainTip(workspaceId, executionId, agentKind) {
55
+ // The newest call for the conversation; one indexed row, no text columns.
56
+ const row = await this.db
57
+ .prepare(
58
+ // message_count breaks a same-millisecond createdAt tie in chain order (it
59
+ // grows monotonically as the conversation appends); id is the last resort.
60
+ `SELECT message_count, prompt_hash FROM llm_call_metrics
61
+ WHERE workspace_id = ? AND execution_id = ? AND agent_kind = ?
62
+ ORDER BY created_at DESC, message_count DESC, id DESC
63
+ LIMIT 1`)
64
+ .bind(workspaceId, executionId, agentKind)
65
+ .first();
66
+ return row ? { messageCount: row.message_count, promptHash: row.prompt_hash } : null;
67
+ }
68
+ async listByExecution(workspaceId, executionId, limit) {
69
+ // Newest first; `LIMIT -1` means "no limit" in SQLite, so an omitted cap reads all.
70
+ const { results } = await this.db
71
+ .prepare(`SELECT * FROM llm_call_metrics
72
+ WHERE workspace_id = ? AND execution_id = ?
73
+ ORDER BY created_at DESC, id DESC
74
+ LIMIT ?`)
75
+ .bind(workspaceId, executionId, limit ?? -1)
76
+ .all();
77
+ return (results ?? []).map(rowToMetric);
78
+ }
79
+ async summarizeByExecution(workspaceId, executionId) {
80
+ // Aggregate-only: deliberately selects no prompt/response text, so this stays
81
+ // cheap to run on every execution emit (it backs the live board rollups).
82
+ const { results } = await this.db
83
+ .prepare(`SELECT
84
+ agent_kind AS agent_kind,
85
+ COUNT(*) AS calls,
86
+ COALESCE(SUM(prompt_tokens), 0) AS prompt_tokens,
87
+ COALESCE(SUM(completion_tokens), 0) AS completion_tokens,
88
+ COALESCE(MAX(completion_tokens), 0) AS peak_completion_tokens,
89
+ MAX(request_max_tokens) AS max_output_tokens,
90
+ COALESCE(SUM(CASE WHEN finish_reason = 'length' THEN 1 ELSE 0 END), 0) AS truncated_calls,
91
+ COALESCE(SUM(upstream_ms), 0) AS upstream_ms,
92
+ COALESCE(SUM(overhead_ms), 0) AS overhead_ms,
93
+ COALESCE(SUM(CASE WHEN ok = 0 THEN 1 ELSE 0 END), 0) AS errors,
94
+ COALESCE(SUM(CASE WHEN ok = 1 AND finish_reason IN (${WARNING_REASONS_SQL}) THEN 1 ELSE 0 END), 0) AS warnings
95
+ FROM llm_call_metrics
96
+ WHERE workspace_id = ? AND execution_id = ?
97
+ GROUP BY agent_kind`)
98
+ .bind(workspaceId, executionId)
99
+ .all();
100
+ return (results ?? []).map((r) => ({
101
+ agentKind: r.agent_kind,
102
+ calls: r.calls,
103
+ promptTokens: r.prompt_tokens,
104
+ completionTokens: r.completion_tokens,
105
+ peakCompletionTokens: r.peak_completion_tokens,
106
+ maxOutputTokens: r.max_output_tokens,
107
+ truncatedCalls: r.truncated_calls,
108
+ upstreamMs: r.upstream_ms,
109
+ overheadMs: r.overhead_ms,
110
+ errors: r.errors,
111
+ warnings: r.warnings,
112
+ }));
113
+ }
114
+ async deleteOlderThan(epochMs) {
115
+ // Range delete on idx_llm_call_metrics_created; bounded by the rows being pruned.
116
+ const { meta } = await this.db
117
+ .prepare('DELETE FROM llm_call_metrics WHERE created_at < ?')
118
+ .bind(epochMs)
119
+ .run();
120
+ return meta.changes ?? 0;
121
+ }
122
+ }
123
+ //# sourceMappingURL=D1LlmCallMetricRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LlmCallMetricRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LlmCallMetricRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,GAK3B,MAAM,qBAAqB,CAAA;AAG5B,+EAA+E;AAC/E,+EAA+E;AAC/E,MAAM,mBAAmB,GAAG,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAgCtF,SAAS,WAAW,CAAC,GAAc;IACjC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,WAAW,EAAE,GAAG,CAAC,YAAY;Q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,CAAC,EAAE;aAC3B,OAAO,CAAC,mDAAmD,CAAC;aAC5D,IAAI,CAAC,OAAO,CAAC;aACb,GAAG,EAAE,CAAA;QACR,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { LocalModelEndpointRecord, LocalModelEndpointRepository } from '@cat-factory/kernel';
2
+ import type { LocalRunner } from '@cat-factory/contracts';
3
+ import type { D1Database } from '@cloudflare/workers-types';
4
+ /** D1-backed store of a user's locally-run model endpoints (migration 0002). */
5
+ export declare class D1LocalModelEndpointRepository implements LocalModelEndpointRepository {
6
+ private readonly db;
7
+ constructor({ db }: {
8
+ db: D1Database;
9
+ });
10
+ listByUser(userId: string): Promise<LocalModelEndpointRecord[]>;
11
+ getByUserProvider(userId: string, provider: LocalRunner): Promise<LocalModelEndpointRecord | null>;
12
+ upsert(record: LocalModelEndpointRecord): Promise<void>;
13
+ remove(userId: string, provider: LocalRunner): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=D1LocalModelEndpointRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LocalModelEndpointRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LocalModelEndpointRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAA;AACjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAmC3D,gFAAgF;AAChF,qBAAa,8BAA+B,YAAW,4BAA4B;IACjF,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAMpE;IAEK,iBAAiB,CACrB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAM1C;IAEK,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB5D;IAEK,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAKjE;CACF"}
@@ -0,0 +1,63 @@
1
+ function toRecord(row) {
2
+ return {
3
+ userId: row.user_id,
4
+ provider: row.provider,
5
+ label: row.label,
6
+ baseUrl: row.base_url,
7
+ apiKeyCipher: row.api_key_cipher,
8
+ models: parseModels(row.models),
9
+ createdAt: row.created_at,
10
+ updatedAt: row.updated_at,
11
+ };
12
+ }
13
+ function parseModels(json) {
14
+ try {
15
+ const parsed = JSON.parse(json);
16
+ return Array.isArray(parsed) ? parsed.map(String) : [];
17
+ }
18
+ catch {
19
+ return [];
20
+ }
21
+ }
22
+ /** D1-backed store of a user's locally-run model endpoints (migration 0002). */
23
+ export class D1LocalModelEndpointRepository {
24
+ db;
25
+ constructor({ db }) {
26
+ this.db = db;
27
+ }
28
+ async listByUser(userId) {
29
+ const { results } = await this.db
30
+ .prepare(`SELECT * FROM local_model_endpoints WHERE user_id = ? ORDER BY created_at ASC`)
31
+ .bind(userId)
32
+ .all();
33
+ return (results ?? []).map(toRecord);
34
+ }
35
+ async getByUserProvider(userId, provider) {
36
+ const row = await this.db
37
+ .prepare(`SELECT * FROM local_model_endpoints WHERE user_id = ? AND provider = ?`)
38
+ .bind(userId, provider)
39
+ .first();
40
+ return row ? toRecord(row) : null;
41
+ }
42
+ async upsert(record) {
43
+ await this.db
44
+ .prepare(`INSERT INTO local_model_endpoints
45
+ (user_id, provider, label, base_url, api_key_cipher, models, created_at, updated_at)
46
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
47
+ ON CONFLICT (user_id, provider) DO UPDATE SET
48
+ label = excluded.label,
49
+ base_url = excluded.base_url,
50
+ api_key_cipher = excluded.api_key_cipher,
51
+ models = excluded.models,
52
+ updated_at = excluded.updated_at`)
53
+ .bind(record.userId, record.provider, record.label, record.baseUrl, record.apiKeyCipher, JSON.stringify(record.models), record.createdAt, record.updatedAt)
54
+ .run();
55
+ }
56
+ async remove(userId, provider) {
57
+ await this.db
58
+ .prepare(`DELETE FROM local_model_endpoints WHERE user_id = ? AND provider = ?`)
59
+ .bind(userId, provider)
60
+ .run();
61
+ }
62
+ }
63
+ //# sourceMappingURL=D1LocalModelEndpointRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1LocalModelEndpointRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1LocalModelEndpointRepository.ts"],"names":[],"mappings":"AAeA,SAAS,QAAQ,CAAC,GAA0B;IAC1C,OAAO;QACL,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,QAAQ,EAAE,GAAG,CAAC,QAAuB;QACrC,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,YAAY,EAAE,GAAG,CAAC,cAAc;QAChC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;QAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACxD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,gFAAgF;AAChF,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C;aACtB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { Membership, MembershipRepository } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /** D1-backed store of account memberships (user ↔ account + roles; migration 0043). */
4
+ export declare class D1MembershipRepository implements MembershipRepository {
5
+ private readonly db;
6
+ constructor({ db }: {
7
+ db: D1Database;
8
+ });
9
+ listByUser(userId: string): Promise<Membership[]>;
10
+ listByAccount(accountId: string): Promise<Membership[]>;
11
+ get(accountId: string, userId: string): Promise<Membership | null>;
12
+ upsert(membership: Membership): Promise<void>;
13
+ remove(accountId: string, userId: string): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=D1MembershipRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1MembershipRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1MembershipRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AA2B3D,uFAAuF;AACvF,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAMtD;IAEK,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAM5D;IAEK,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAMvE;IAEK,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAalD;IAEK,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7D;CACF"}
@@ -0,0 +1,58 @@
1
+ /** Parse the CSV `roles` column into a non-empty role set (defaults to developer). */
2
+ function parseRoles(csv) {
3
+ const roles = (csv ?? '')
4
+ .split(',')
5
+ .map((r) => r.trim())
6
+ .filter((r) => r === 'admin' || r === 'developer' || r === 'product');
7
+ return roles.length > 0 ? [...new Set(roles)] : ['developer'];
8
+ }
9
+ function rowToMembership(row) {
10
+ return {
11
+ accountId: row.account_id,
12
+ userId: row.user_id,
13
+ roles: parseRoles(row.roles),
14
+ createdAt: row.created_at,
15
+ };
16
+ }
17
+ /** D1-backed store of account memberships (user ↔ account + roles; migration 0043). */
18
+ export class D1MembershipRepository {
19
+ db;
20
+ constructor({ db }) {
21
+ this.db = db;
22
+ }
23
+ async listByUser(userId) {
24
+ const { results } = await this.db
25
+ .prepare('SELECT * FROM memberships WHERE user_id = ? ORDER BY created_at ASC')
26
+ .bind(userId)
27
+ .all();
28
+ return results.map(rowToMembership);
29
+ }
30
+ async listByAccount(accountId) {
31
+ const { results } = await this.db
32
+ .prepare('SELECT * FROM memberships WHERE account_id = ? ORDER BY created_at ASC')
33
+ .bind(accountId)
34
+ .all();
35
+ return results.map(rowToMembership);
36
+ }
37
+ async get(accountId, userId) {
38
+ const row = await this.db
39
+ .prepare('SELECT * FROM memberships WHERE account_id = ? AND user_id = ?')
40
+ .bind(accountId, userId)
41
+ .first();
42
+ return row ? rowToMembership(row) : null;
43
+ }
44
+ async upsert(membership) {
45
+ await this.db
46
+ .prepare(`INSERT INTO memberships (account_id, user_id, roles, created_at) VALUES (?, ?, ?, ?)
47
+ ON CONFLICT (account_id, user_id) DO UPDATE SET roles = excluded.roles`)
48
+ .bind(membership.accountId, membership.userId, membership.roles.join(','), membership.createdAt)
49
+ .run();
50
+ }
51
+ async remove(accountId, userId) {
52
+ await this.db
53
+ .prepare('DELETE FROM memberships WHERE account_id = ? AND user_id = ?')
54
+ .bind(accountId, userId)
55
+ .run();
56
+ }
57
+ }
58
+ //# sourceMappingURL=D1MembershipRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1MembershipRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1MembershipRepository.ts"],"names":[],"mappings":"AAUA,sFAAsF;AACtF,SAAS,UAAU,CAAC,GAAkB;IACpC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC;SACtB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAoB,EAAE,CAAC,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,KAAK,SAAS,CAAC,CAAA;IACzF,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;AAC/D,CAAC;AAED,SAAS,eAAe,CAAC,GAAkB;IACzC,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC;QAC5B,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED,uFAAuF;AACvF,MAAM,OAAO,sBAAsB;IAChB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAAc;QAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CAAC,qEAAqE,CAAC;aAC9E,IAAI,CAAC,MAAM,CAAC;aACZ,GAAG,EAAiB,CAAA;QACvB,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CAAC,wEAAwE,CAAC;aACjF,IAAI,CAAC,SAAS,CAAC;aACf,GAAG,EAAiB,CAAA;QACvB,OAAO,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,SAAiB,EAAE,MAAc;QACzC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,gEAAgE,CAAC;aACzE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;aACvB,KAAK,EAAiB,CAAA;QACzB,OAAO,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,UAAsB;QACjC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;gFACwE,CACzE;aACA,IAAI,CACH,UAAU,CAAC,SAAS,EACpB,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAC1B,UAAU,CAAC,SAAS,CACrB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,MAAc;QAC5C,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CAAC,8DAA8D,CAAC;aACvE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC;aACvB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ import type { MergePresetRepository } from '@cat-factory/kernel';
2
+ import type { MergeThresholdPreset } from '@cat-factory/contracts';
3
+ import type { D1Database } from '@cloudflare/workers-types';
4
+ /**
5
+ * Merge threshold presets, one row per preset in `merge_threshold_presets`
6
+ * (migration 0024). Enforces the single-default invariant: promoting a preset to
7
+ * default demotes every other in the workspace, in one statement before the
8
+ * upsert. The default preset cannot be removed (the service keeps that rule).
9
+ */
10
+ export declare class D1MergePresetRepository implements MergePresetRepository {
11
+ private readonly db;
12
+ constructor({ db }: {
13
+ db: D1Database;
14
+ });
15
+ get(workspaceId: string, id: string): Promise<MergeThresholdPreset | null>;
16
+ list(workspaceId: string): Promise<MergeThresholdPreset[]>;
17
+ getDefault(workspaceId: string): Promise<MergeThresholdPreset | null>;
18
+ upsert(workspaceId: string, preset: MergeThresholdPreset): Promise<void>;
19
+ remove(workspaceId: string, id: string): Promise<void>;
20
+ }
21
+ //# sourceMappingURL=D1MergePresetRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1MergePresetRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1MergePresetRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAA2B,MAAM,wBAAwB,CAAA;AAC3F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAkC3D;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,qBAAqB;IACnE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAM/E;IAEK,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAQ/D;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAU1E;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+C7E;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3D;CACF"}
@@ -0,0 +1,88 @@
1
+ function rowToPreset(row) {
2
+ return {
3
+ id: row.id,
4
+ name: row.name,
5
+ maxComplexity: row.max_complexity,
6
+ maxRisk: row.max_risk,
7
+ maxImpact: row.max_impact,
8
+ ciMaxAttempts: row.ci_max_attempts,
9
+ maxRequirementIterations: row.max_requirement_iterations,
10
+ maxRequirementConcernAllowed: row.max_requirement_concern_allowed,
11
+ releaseWatchWindowMinutes: row.release_watch_window_minutes,
12
+ releaseMaxAttempts: row.release_max_attempts,
13
+ isDefault: row.is_default === 1,
14
+ createdAt: row.created_at,
15
+ };
16
+ }
17
+ /**
18
+ * Merge threshold presets, one row per preset in `merge_threshold_presets`
19
+ * (migration 0024). Enforces the single-default invariant: promoting a preset to
20
+ * default demotes every other in the workspace, in one statement before the
21
+ * upsert. The default preset cannot be removed (the service keeps that rule).
22
+ */
23
+ export class D1MergePresetRepository {
24
+ db;
25
+ constructor({ db }) {
26
+ this.db = db;
27
+ }
28
+ async get(workspaceId, id) {
29
+ const row = await this.db
30
+ .prepare(`SELECT * FROM merge_threshold_presets WHERE workspace_id = ? AND id = ?`)
31
+ .bind(workspaceId, id)
32
+ .first();
33
+ return row ? rowToPreset(row) : null;
34
+ }
35
+ async list(workspaceId) {
36
+ const { results } = await this.db
37
+ .prepare(`SELECT * FROM merge_threshold_presets WHERE workspace_id = ? ORDER BY created_at ASC`)
38
+ .bind(workspaceId)
39
+ .all();
40
+ return results.map(rowToPreset);
41
+ }
42
+ async getDefault(workspaceId) {
43
+ const row = await this.db
44
+ .prepare(`SELECT * FROM merge_threshold_presets
45
+ WHERE workspace_id = ? AND is_default = 1
46
+ ORDER BY created_at ASC LIMIT 1`)
47
+ .bind(workspaceId)
48
+ .first();
49
+ return row ? rowToPreset(row) : null;
50
+ }
51
+ async upsert(workspaceId, preset) {
52
+ // Promoting this preset to default demotes any other default first, so the
53
+ // single-default invariant holds.
54
+ if (preset.isDefault) {
55
+ await this.db
56
+ .prepare(`UPDATE merge_threshold_presets SET is_default = 0
57
+ WHERE workspace_id = ? AND id <> ?`)
58
+ .bind(workspaceId, preset.id)
59
+ .run();
60
+ }
61
+ await this.db
62
+ .prepare(`INSERT INTO merge_threshold_presets
63
+ (workspace_id, id, name, max_complexity, max_risk, max_impact, ci_max_attempts,
64
+ max_requirement_iterations, max_requirement_concern_allowed,
65
+ release_watch_window_minutes, release_max_attempts, is_default, created_at)
66
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
67
+ ON CONFLICT (workspace_id, id) DO UPDATE SET
68
+ name = excluded.name,
69
+ max_complexity = excluded.max_complexity,
70
+ max_risk = excluded.max_risk,
71
+ max_impact = excluded.max_impact,
72
+ ci_max_attempts = excluded.ci_max_attempts,
73
+ max_requirement_iterations = excluded.max_requirement_iterations,
74
+ max_requirement_concern_allowed = excluded.max_requirement_concern_allowed,
75
+ release_watch_window_minutes = excluded.release_watch_window_minutes,
76
+ release_max_attempts = excluded.release_max_attempts,
77
+ is_default = excluded.is_default`)
78
+ .bind(workspaceId, preset.id, preset.name, preset.maxComplexity, preset.maxRisk, preset.maxImpact, preset.ciMaxAttempts, preset.maxRequirementIterations, preset.maxRequirementConcernAllowed, preset.releaseWatchWindowMinutes, preset.releaseMaxAttempts, preset.isDefault ? 1 : 0, preset.createdAt)
79
+ .run();
80
+ }
81
+ async remove(workspaceId, id) {
82
+ await this.db
83
+ .prepare(`DELETE FROM merge_threshold_presets WHERE workspace_id = ? AND id = ? AND is_default = 0`)
84
+ .bind(workspaceId, id)
85
+ .run();
86
+ }
87
+ }
88
+ //# sourceMappingURL=D1MergePresetRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1MergePresetRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1MergePresetRepository.ts"],"names":[],"mappings":"AAmBA,SAAS,WAAW,CAAC,GAAmB;IACtC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,aAAa,EAAE,GAAG,CAAC,cAAc;QACjC,OAAO,EAAE,GAAG,CAAC,QAAQ;QACrB,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,aAAa,EAAE,GAAG,CAAC,eAAe;QAClC,wBAAwB,EAAE,GAAG,CAAC,0BAA0B;QACxD,4BAA4B,EAAE,GAAG,CAAC,+BAA0D;QAC5F,yBAAyB,EAAE,GAAG,CAAC,4BAA4B;QAC3D,kBAAkB,EAAE,GAAG,CAAC,oBAAoB;QAC5C,SAAS,EAAE,GAAG,CAAC,UAAU,KAAK,CAAC;QAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IACjB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,EAAU;QACvC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,yEAAyE,CAAC;aAClF,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;aACrB,KAAK,EAAkB,CAAA;QAC1B,OAAO,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN,sFA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,EAAE;aACV,OAAO,CACN,0FAA0F,CAC3F;aACA,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;aACrB,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ import type { ModelDefaultsRepository } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /**
4
+ * A workspace's per-agent-kind default models, one row per (workspace, agent kind)
5
+ * in `workspace_model_defaults` (migration 0028). `replace` rewrites the whole map
6
+ * for a workspace atomically (delete-all then insert-each in one `db.batch`), so a
7
+ * kind omitted from the new map is cleared.
8
+ */
9
+ export declare class D1ModelDefaultsRepository implements ModelDefaultsRepository {
10
+ private readonly db;
11
+ constructor({ db }: {
12
+ db: D1Database;
13
+ });
14
+ get(workspaceId: string): Promise<Record<string, string>>;
15
+ getForKind(workspaceId: string, agentKind: string): Promise<string | null>;
16
+ replace(workspaceId: string, defaults: Record<string, string>): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=D1ModelDefaultsRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1ModelDefaultsRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ModelDefaultsRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAO3D;;;;;GAKG;AACH,qBAAa,yBAA0B,YAAW,uBAAuB;IACvE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAQ9D;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQ/E;IAEK,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBlF;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A workspace's per-agent-kind default models, one row per (workspace, agent kind)
3
+ * in `workspace_model_defaults` (migration 0028). `replace` rewrites the whole map
4
+ * for a workspace atomically (delete-all then insert-each in one `db.batch`), so a
5
+ * kind omitted from the new map is cleared.
6
+ */
7
+ export class D1ModelDefaultsRepository {
8
+ db;
9
+ constructor({ db }) {
10
+ this.db = db;
11
+ }
12
+ async get(workspaceId) {
13
+ const { results } = await this.db
14
+ .prepare(`SELECT agent_kind, model_id FROM workspace_model_defaults WHERE workspace_id = ?`)
15
+ .bind(workspaceId)
16
+ .all();
17
+ const map = {};
18
+ for (const row of results)
19
+ map[row.agent_kind] = row.model_id;
20
+ return map;
21
+ }
22
+ async getForKind(workspaceId, agentKind) {
23
+ const row = await this.db
24
+ .prepare(`SELECT model_id FROM workspace_model_defaults WHERE workspace_id = ? AND agent_kind = ?`)
25
+ .bind(workspaceId, agentKind)
26
+ .first();
27
+ return row ? row.model_id : null;
28
+ }
29
+ async replace(workspaceId, defaults) {
30
+ // Rewrite the whole per-kind map atomically: clear the workspace's rows, then
31
+ // insert one per entry. Batched so the snapshot a reader sees is consistent.
32
+ const statements = [
33
+ this.db
34
+ .prepare(`DELETE FROM workspace_model_defaults WHERE workspace_id = ?`)
35
+ .bind(workspaceId),
36
+ ];
37
+ const updatedAt = Date.now();
38
+ for (const [agentKind, modelId] of Object.entries(defaults)) {
39
+ statements.push(this.db
40
+ .prepare(`INSERT INTO workspace_model_defaults (workspace_id, agent_kind, model_id, updated_at)
41
+ VALUES (?, ?, ?, ?)`)
42
+ .bind(workspaceId, agentKind, modelId, updatedAt));
43
+ }
44
+ await this.db.batch(statements);
45
+ }
46
+ }
47
+ //# sourceMappingURL=D1ModelDefaultsRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1ModelDefaultsRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ModelDefaultsRepository.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IACnB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CAAC,kFAAkF,CAAC;aAC3F,IAAI,CAAC,WAAW,CAAC;aACjB,GAAG,EAAmB,CAAA;QACzB,MAAM,GAAG,GAA2B,EAAE,CAAA;QACtC,KAAK,MAAM,GAAG,IAAI,OAAO;YAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC7D,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,SAAiB;QACrD,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CACN,yFAAyF,CAC1F;aACA,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;aAC5B,KAAK,EAAwB,CAAA;QAChC,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,QAAgC;QACjE,8EAA8E;QAC9E,6EAA6E;QAC7E,MAAM,UAAU,GAAG;YACjB,IAAI,CAAC,EAAE;iBACJ,OAAO,CAAC,6DAA6D,CAAC;iBACtE,IAAI,CAAC,WAAW,CAAC;SACrB,CAAA;QACD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QAC5B,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5D,UAAU,CAAC,IAAI,CACb,IAAI,CAAC,EAAE;iBACJ,OAAO,CACN;iCACqB,CACtB;iBACA,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CACpD,CAAA;QACH,CAAC;QACD,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACjC,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import type { NotificationRepository } from '@cat-factory/kernel';
2
+ import type { Notification, NotificationType } from '@cat-factory/contracts';
3
+ import type { D1Database } from '@cloudflare/workers-types';
4
+ /**
5
+ * Notifications, one row per notification in `notifications` (migration 0024).
6
+ * The optional structured `payload` (assessment / PR url / pipeline name) is a
7
+ * JSON column. Open notifications back the board inbox + snapshot; the engine
8
+ * de-dupes an open card per (block, type) via {@link findOpenByBlock}.
9
+ */
10
+ export declare class D1NotificationRepository implements NotificationRepository {
11
+ private readonly db;
12
+ constructor({ db }: {
13
+ db: D1Database;
14
+ });
15
+ get(workspaceId: string, id: string): Promise<Notification | null>;
16
+ listOpen(workspaceId: string): Promise<Notification[]>;
17
+ findOpenByBlock(workspaceId: string, blockId: string, type: NotificationType): Promise<Notification | null>;
18
+ upsert(workspaceId: string, notification: Notification): Promise<void>;
19
+ }
20
+ //# sourceMappingURL=D1NotificationRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1NotificationRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1NotificationRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EACV,YAAY,EAGZ,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAwC3D;;;;;GAKG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAA;KAAE,EAErC;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAMvE;IAEK,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAU3D;IAEK,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAU9B;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC3E;CACF"}