@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,114 @@
1
+ import { chunkForIn } from './chunk';
2
+ function rowToService(row) {
3
+ return {
4
+ id: row.id,
5
+ accountId: row.account_id,
6
+ frameBlockId: row.frame_block_id,
7
+ installationId: row.installation_id,
8
+ repoGithubId: row.repo_github_id,
9
+ directory: row.directory,
10
+ createdAt: row.created_at,
11
+ };
12
+ }
13
+ /** Account-owned services (migration 0030). The canonical, shareable board unit. */
14
+ export class D1ServiceRepository {
15
+ db;
16
+ constructor({ db }) {
17
+ this.db = db;
18
+ }
19
+ async get(id) {
20
+ const row = await this.db
21
+ .prepare(`SELECT * FROM services WHERE id = ?`)
22
+ .bind(id)
23
+ .first();
24
+ return row ? rowToService(row) : null;
25
+ }
26
+ async getByFrameBlock(frameBlockId) {
27
+ const row = await this.db
28
+ .prepare(`SELECT * FROM services WHERE frame_block_id = ?`)
29
+ .bind(frameBlockId)
30
+ .first();
31
+ return row ? rowToService(row) : null;
32
+ }
33
+ async listByAccount(accountId) {
34
+ // `IS` matches NULL too, so the legacy/unscoped org (accountId null) lists cleanly.
35
+ const { results } = await this.db
36
+ .prepare(`SELECT * FROM services WHERE account_id IS ? ORDER BY created_at`)
37
+ .bind(accountId)
38
+ .all();
39
+ return (results ?? []).map(rowToService);
40
+ }
41
+ async listByIds(ids) {
42
+ if (ids.length === 0)
43
+ return [];
44
+ const out = [];
45
+ // Chunk the IN list to stay under D1's bound-parameter limit.
46
+ for (const chunk of chunkForIn(ids)) {
47
+ const placeholders = chunk.map(() => '?').join(', ');
48
+ const { results } = await this.db
49
+ .prepare(`SELECT * FROM services WHERE id IN (${placeholders})`)
50
+ .bind(...chunk)
51
+ .all();
52
+ for (const row of results ?? [])
53
+ out.push(rowToService(row));
54
+ }
55
+ return out;
56
+ }
57
+ async getByRepo(installationId, repoGithubId) {
58
+ const row = await this.db
59
+ .prepare(`SELECT * FROM services WHERE installation_id = ? AND repo_github_id = ?`)
60
+ .bind(installationId, repoGithubId)
61
+ .first();
62
+ return row ? rowToService(row) : null;
63
+ }
64
+ async insert(service) {
65
+ await this.db
66
+ .prepare(`INSERT INTO services (id, account_id, frame_block_id, installation_id, repo_github_id, directory, created_at)
67
+ VALUES (?, ?, ?, ?, ?, ?, ?)`)
68
+ .bind(service.id, service.accountId, service.frameBlockId, service.installationId, service.repoGithubId, service.directory ?? null, service.createdAt)
69
+ .run();
70
+ }
71
+ async update(id, patch) {
72
+ const sets = [];
73
+ const binds = [];
74
+ if ('accountId' in patch) {
75
+ sets.push('account_id = ?');
76
+ binds.push(patch.accountId ?? null);
77
+ }
78
+ if ('installationId' in patch) {
79
+ sets.push('installation_id = ?');
80
+ binds.push(patch.installationId ?? null);
81
+ }
82
+ if ('repoGithubId' in patch) {
83
+ sets.push('repo_github_id = ?');
84
+ binds.push(patch.repoGithubId ?? null);
85
+ }
86
+ if ('directory' in patch) {
87
+ sets.push('directory = ?');
88
+ binds.push(patch.directory ?? null);
89
+ }
90
+ if (sets.length === 0)
91
+ return;
92
+ binds.push(id);
93
+ await this.db
94
+ .prepare(`UPDATE services SET ${sets.join(', ')} WHERE id = ?`)
95
+ .bind(...binds)
96
+ .run();
97
+ }
98
+ async delete(id) {
99
+ await this.db.prepare(`DELETE FROM services WHERE id = ?`).bind(id).run();
100
+ }
101
+ async deleteMany(ids) {
102
+ if (ids.length === 0)
103
+ return;
104
+ // Chunk the IN list to stay under D1's bound-parameter limit.
105
+ for (const chunk of chunkForIn(ids)) {
106
+ const placeholders = chunk.map(() => '?').join(', ');
107
+ await this.db
108
+ .prepare(`DELETE FROM services WHERE id IN (${placeholders})`)
109
+ .bind(...chunk)
110
+ .run();
111
+ }
112
+ }
113
+ }
114
+ //# sourceMappingURL=D1ServiceRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1ServiceRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1ServiceRepository.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAYpC,SAAS,YAAY,CAAC,GAAe;IACnC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,YAAY,EAAE,GAAG,CAAC,cAAc;QAChC,cAAc,EAAE,GAAG,CAAC,eAAe;QACnC,YAAY,EAAE,GAAG,CAAC,cAAc;QAChC,SAAS,EAAE,GAAG,CAAC,SAAS;QACxB,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CA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CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACpD,MAAM,IAAI,CAAC,EAAE;iBACV,OAAO,CAAC,qCAAqC,YAAY,GAAG,CAAC;iBAC7D,IAAI,CAAC,GAAG,KAAK,CAAC;iBACd,GAAG,EAAE,CAAA;QACV,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ import type { SlackConnectionRecord, SlackConnectionRepository, SlackMemberMappingEntry, SlackMemberMappingRepository, SlackSettingsRecord, SlackSettingsRepository } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ export declare class D1SlackConnectionRepository implements SlackConnectionRepository {
4
+ private readonly db;
5
+ constructor({ db }: {
6
+ db: D1Database;
7
+ });
8
+ getByAccount(accountId: string): Promise<SlackConnectionRecord | null>;
9
+ getByTeam(teamId: string): Promise<SlackConnectionRecord | null>;
10
+ upsert(record: SlackConnectionRecord): Promise<void>;
11
+ softDelete(accountId: string, at: number): Promise<void>;
12
+ }
13
+ export declare class D1SlackSettingsRepository implements SlackSettingsRepository {
14
+ private readonly db;
15
+ constructor({ db }: {
16
+ db: D1Database;
17
+ });
18
+ getByWorkspace(workspaceId: string): Promise<SlackSettingsRecord | null>;
19
+ upsert(record: SlackSettingsRecord): Promise<void>;
20
+ }
21
+ export declare class D1SlackMemberMappingRepository implements SlackMemberMappingRepository {
22
+ private readonly db;
23
+ constructor({ db }: {
24
+ db: D1Database;
25
+ });
26
+ getByAccount(accountId: string): Promise<SlackMemberMappingEntry[]>;
27
+ upsert(accountId: string, entries: SlackMemberMappingEntry[], at: number): Promise<void>;
28
+ }
29
+ //# sourceMappingURL=D1SlackRepositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1SlackRepositories.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1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AAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAYxE;IAEK,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW7F;CACF"}
@@ -0,0 +1,119 @@
1
+ function rowToConnection(row) {
2
+ return {
3
+ accountId: row.account_id,
4
+ teamId: row.team_id,
5
+ teamName: row.team_name,
6
+ teamIconUrl: row.team_icon_url,
7
+ botUserId: row.bot_user_id,
8
+ scopesJson: row.scopes,
9
+ tokenCipher: row.token_cipher,
10
+ createdAt: row.created_at,
11
+ deletedAt: row.deleted_at,
12
+ };
13
+ }
14
+ export class D1SlackConnectionRepository {
15
+ db;
16
+ constructor({ db }) {
17
+ this.db = db;
18
+ }
19
+ async getByAccount(accountId) {
20
+ const row = await this.db
21
+ .prepare('SELECT * FROM slack_connections WHERE account_id = ?')
22
+ .bind(accountId)
23
+ .first();
24
+ return row ? rowToConnection(row) : null;
25
+ }
26
+ async getByTeam(teamId) {
27
+ const row = await this.db
28
+ .prepare('SELECT * FROM slack_connections WHERE team_id = ? AND deleted_at IS NULL')
29
+ .bind(teamId)
30
+ .first();
31
+ return row ? rowToConnection(row) : null;
32
+ }
33
+ async upsert(record) {
34
+ await this.db
35
+ .prepare(`INSERT INTO slack_connections
36
+ (account_id, team_id, team_name, team_icon_url, bot_user_id, scopes, token_cipher, created_at, deleted_at)
37
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL)
38
+ ON CONFLICT (account_id) DO UPDATE SET
39
+ team_id = excluded.team_id,
40
+ team_name = excluded.team_name,
41
+ team_icon_url = excluded.team_icon_url,
42
+ bot_user_id = excluded.bot_user_id,
43
+ scopes = excluded.scopes,
44
+ token_cipher = excluded.token_cipher,
45
+ created_at = excluded.created_at,
46
+ deleted_at = NULL`)
47
+ .bind(record.accountId, record.teamId, record.teamName, record.teamIconUrl, record.botUserId, record.scopesJson, record.tokenCipher, record.createdAt)
48
+ .run();
49
+ }
50
+ async softDelete(accountId, at) {
51
+ await this.db
52
+ .prepare('UPDATE slack_connections SET deleted_at = ? WHERE account_id = ? AND deleted_at IS NULL')
53
+ .bind(at, accountId)
54
+ .run();
55
+ }
56
+ }
57
+ export class D1SlackSettingsRepository {
58
+ db;
59
+ constructor({ db }) {
60
+ this.db = db;
61
+ }
62
+ async getByWorkspace(workspaceId) {
63
+ const row = await this.db
64
+ .prepare('SELECT * FROM slack_settings WHERE workspace_id = ?')
65
+ .bind(workspaceId)
66
+ .first();
67
+ if (!row)
68
+ return null;
69
+ return {
70
+ workspaceId: row.workspace_id,
71
+ routesJson: row.routes,
72
+ mentionsEnabled: row.mentions_enabled === 1,
73
+ updatedAt: row.updated_at,
74
+ };
75
+ }
76
+ async upsert(record) {
77
+ await this.db
78
+ .prepare(`INSERT INTO slack_settings (workspace_id, routes, mentions_enabled, updated_at)
79
+ VALUES (?, ?, ?, ?)
80
+ ON CONFLICT (workspace_id) DO UPDATE SET
81
+ routes = excluded.routes,
82
+ mentions_enabled = excluded.mentions_enabled,
83
+ updated_at = excluded.updated_at`)
84
+ .bind(record.workspaceId, record.routesJson, record.mentionsEnabled ? 1 : 0, record.updatedAt)
85
+ .run();
86
+ }
87
+ }
88
+ export class D1SlackMemberMappingRepository {
89
+ db;
90
+ constructor({ db }) {
91
+ this.db = db;
92
+ }
93
+ async getByAccount(accountId) {
94
+ const row = await this.db
95
+ .prepare('SELECT * FROM slack_member_mappings WHERE account_id = ?')
96
+ .bind(accountId)
97
+ .first();
98
+ if (!row)
99
+ return [];
100
+ try {
101
+ const parsed = JSON.parse(row.entries);
102
+ return Array.isArray(parsed) ? parsed : [];
103
+ }
104
+ catch {
105
+ return [];
106
+ }
107
+ }
108
+ async upsert(accountId, entries, at) {
109
+ await this.db
110
+ .prepare(`INSERT INTO slack_member_mappings (account_id, entries, updated_at)
111
+ VALUES (?, ?, ?)
112
+ ON CONFLICT (account_id) DO UPDATE SET
113
+ entries = excluded.entries,
114
+ updated_at = excluded.updated_at`)
115
+ .bind(accountId, JSON.stringify(entries), at)
116
+ .run();
117
+ }
118
+ }
119
+ //# sourceMappingURL=D1SlackRepositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1SlackRepositories.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1SlackRepositories.ts"],"names":[],"mappings":"AA2BA,SAAS,eAAe,CAAC,GAAuB;IAC9C,OAAO;QACL,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,MAAM,EAAE,GAAG,CAAC,OAAO;QACnB,QAAQ,EAAE,GAAG,CAAC,SAAS;QACvB,WAAW,EAAE,GAAG,CAAC,aAAa;QAC9B,SAAS,EAAE,GAAG,CAAC,WAAW;QAC1B,UAAU,EAAE,GAAG,CAAC,MAAM;QACtB,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED,MAAM,OAAO,2BAA2B;IACrB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,sDAAsD,CAAC;aAC/D,IAAI,CAAC,SAAS,CAAC;aACf,KAAK,EAAsB,CAAA;QAC9B,OAAO,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc;QAC5B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,0EAA0E,CAAC;aACnF,IAAI,CAAC,MAAM,CAAC;aACZ,KAAK,EAAsB,C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';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /**
4
+ * D1-backed store of workspace → task-source connections (migration 0014).
5
+ *
6
+ * Source credentials (e.g. a Jira API token) are third-party secrets, so they
7
+ * are encrypted at rest with the same AES-256-GCM envelope the documents /
8
+ * environments integrations use — never written to D1 in plaintext. A row whose
9
+ * `credentials` column predates encryption (no `v1.` envelope) is still read as
10
+ * legacy plaintext JSON, then re-encrypted on the next write.
11
+ */
12
+ export declare class D1TaskConnectionRepository implements TaskConnectionRepository {
13
+ private readonly db;
14
+ private readonly cipher;
15
+ constructor({ db, cipher }: {
16
+ db: D1Database;
17
+ cipher: SecretCipher;
18
+ });
19
+ /** Decode the stored credential blob, decrypting the envelope when present. */
20
+ private decodeCredentials;
21
+ private rowToRecord;
22
+ getByWorkspace(workspaceId: string, source: TaskSourceKind): Promise<TaskConnectionRecord | null>;
23
+ listByWorkspace(workspaceId: string): Promise<TaskConnectionRecord[]>;
24
+ upsert(record: TaskConnectionRecord): Promise<void>;
25
+ softDelete(workspaceId: string, source: TaskSourceKind, at: number): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=D1TaskConnectionRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TaskConnectionRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TaskConnectionRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,YAAY,EACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAqB3D;;;;;;;;GAQG;AACH,qBAAa,0BAA2B,YAAW,wBAAwB;IACzE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,YAAY,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QAAE,EAAE,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,YAAY,CAAA;KAAE,EAGnE;IAED,+EAA+E;YACjE,iBAAiB;YAYjB,WAAW;IAWnB,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAQtC;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAQ1E;IAEK,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBxD;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvF;CACF"}
@@ -0,0 +1,89 @@
1
+ function parseCredentials(json) {
2
+ try {
3
+ const parsed = JSON.parse(json);
4
+ if (parsed && typeof parsed === 'object')
5
+ return parsed;
6
+ }
7
+ catch {
8
+ // A malformed bag is treated as empty; the import path then fails closed.
9
+ }
10
+ return {};
11
+ }
12
+ /**
13
+ * D1-backed store of workspace → task-source connections (migration 0014).
14
+ *
15
+ * Source credentials (e.g. a Jira API token) are third-party secrets, so they
16
+ * are encrypted at rest with the same AES-256-GCM envelope the documents /
17
+ * environments integrations use — never written to D1 in plaintext. A row whose
18
+ * `credentials` column predates encryption (no `v1.` envelope) is still read as
19
+ * legacy plaintext JSON, then re-encrypted on the next write.
20
+ */
21
+ export class D1TaskConnectionRepository {
22
+ db;
23
+ cipher;
24
+ constructor({ db, cipher }) {
25
+ this.db = db;
26
+ this.cipher = cipher;
27
+ }
28
+ /** Decode the stored credential blob, decrypting the envelope when present. */
29
+ async decodeCredentials(stored) {
30
+ // Legacy plaintext rows (written before encryption) lack the envelope tag.
31
+ if (!stored.startsWith('v1.'))
32
+ return parseCredentials(stored);
33
+ try {
34
+ return parseCredentials(await this.cipher.decrypt(stored));
35
+ }
36
+ catch {
37
+ // Wrong key / corrupt envelope: fail closed with an empty bag so the
38
+ // import path errors rather than leaking a decrypt exception.
39
+ return {};
40
+ }
41
+ }
42
+ async rowToRecord(row) {
43
+ return {
44
+ workspaceId: row.workspace_id,
45
+ source: row.source,
46
+ credentials: await this.decodeCredentials(row.credentials),
47
+ label: row.label,
48
+ createdAt: row.created_at,
49
+ deletedAt: row.deleted_at,
50
+ };
51
+ }
52
+ async getByWorkspace(workspaceId, source) {
53
+ const row = await this.db
54
+ .prepare('SELECT * FROM task_connections WHERE workspace_id = ? AND source = ? AND deleted_at IS NULL')
55
+ .bind(workspaceId, source)
56
+ .first();
57
+ return row ? this.rowToRecord(row) : null;
58
+ }
59
+ async listByWorkspace(workspaceId) {
60
+ const { results } = await this.db
61
+ .prepare('SELECT * FROM task_connections WHERE workspace_id = ? AND deleted_at IS NULL ORDER BY created_at DESC')
62
+ .bind(workspaceId)
63
+ .all();
64
+ return Promise.all(results.map((row) => this.rowToRecord(row)));
65
+ }
66
+ async upsert(record) {
67
+ // A workspace has a single live connection per source: clear any prior
68
+ // binding (live or tombstoned) before inserting, so reconnecting can't
69
+ // collide on the (workspace_id, source) primary key.
70
+ await this.db
71
+ .prepare('DELETE FROM task_connections WHERE workspace_id = ? AND source = ?')
72
+ .bind(record.workspaceId, record.source)
73
+ .run();
74
+ const credentials = await this.cipher.encrypt(JSON.stringify(record.credentials));
75
+ await this.db
76
+ .prepare(`INSERT INTO task_connections
77
+ (workspace_id, source, credentials, label, created_at, deleted_at)
78
+ VALUES (?, ?, ?, ?, ?, NULL)`)
79
+ .bind(record.workspaceId, record.source, credentials, record.label, record.createdAt)
80
+ .run();
81
+ }
82
+ async softDelete(workspaceId, source, at) {
83
+ await this.db
84
+ .prepare('UPDATE task_connections SET deleted_at = ? WHERE workspace_id = ? AND source = ? AND deleted_at IS NULL')
85
+ .bind(at, workspaceId, source)
86
+ .run();
87
+ }
88
+ }
89
+ //# sourceMappingURL=D1TaskConnectionRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TaskConnectionRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TaskConnectionRepository.ts"],"names":[],"mappings":"AAiBA,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAgC,CAAA;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,0EAA0E;IAC5E,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,0BAA0B;IACpB,EAAE,CAAY;IACd,MAAM,CAAc;IAErC,YAAY,EAAE,EAAE,EAAE,MAAM,EAA4C;QAClE,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,+EAA+E;IACvE,KAAK,CAAC,iBAAiB,CAAC,MAAc;QAC5C,2EAA2E;QAC3E,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC;YAAE,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAA;QAC9D,IAAI,CAAC;YACH,OAAO,gBAAgB,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QAC5D,CAAC;QAAC,MAAM,CAAC;YACP,qEAAqE;YACrE,8DAA8D;YAC9D,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,GAAsB;QAC9C,OAAO;YACL,WAAW,EAAE,GAAG,CAAC,YAAY;YAC7B,MAAM,EAAE,GAAG,CAAC,MAAwB;YACpC,WAAW,EAAE,MAAM,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;YAC1D,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,SAAS,EAAE,GAAG,CAAC,U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K,EAAE,MAAM,CAAC,SAAS,CAAC;aACpF,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,WAAmB,EAAE,MAAsB,EAAE,EAAU;QACtE,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN,yGAAyG,CAC1G;aACA,IAAI,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC;aAC7B,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,15 @@
1
+ import type { TaskRecord, TaskRepository, TaskSourceKind } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /** D1-backed store of imported issue projections, across sources (migration 0014). */
4
+ export declare class D1TaskRepository implements TaskRepository {
5
+ private readonly db;
6
+ constructor({ db }: {
7
+ db: D1Database;
8
+ });
9
+ upsert(record: TaskRecord): Promise<void>;
10
+ get(workspaceId: string, source: TaskSourceKind, externalId: string): Promise<TaskRecord | null>;
11
+ listByWorkspace(workspaceId: string): Promise<TaskRecord[]>;
12
+ listByBlock(workspaceId: string, blockId: string): Promise<TaskRecord[]>;
13
+ linkBlock(workspaceId: string, source: TaskSourceKind, externalId: string, blockId: string | null): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=D1TaskRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TaskRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TaskRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAClG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAqD3D,sFAAsF;AACtF,qBAAa,gBAAiB,YAAW,cAAc;IACrD,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,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAwC9C;IAEK,GAAG,CACP,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAQ5B;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAQhE;IAEK,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAQ7E;IAEK,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,IAAI,CAAC,CAOf;CACF"}
@@ -0,0 +1,90 @@
1
+ /** Parse a JSON column, falling back to an empty array on anything malformed. */
2
+ function parseJsonArray(json) {
3
+ try {
4
+ const parsed = JSON.parse(json);
5
+ if (Array.isArray(parsed))
6
+ return parsed;
7
+ }
8
+ catch {
9
+ // A malformed blob is treated as empty.
10
+ }
11
+ return [];
12
+ }
13
+ function rowToRecord(row) {
14
+ return {
15
+ workspaceId: row.workspace_id,
16
+ source: row.source,
17
+ externalId: row.external_id,
18
+ title: row.title,
19
+ url: row.url,
20
+ status: row.status,
21
+ type: row.type,
22
+ assignee: row.assignee,
23
+ priority: row.priority,
24
+ labels: parseJsonArray(row.labels),
25
+ description: row.description,
26
+ comments: parseJsonArray(row.comments),
27
+ excerpt: row.excerpt,
28
+ linkedBlockId: row.linked_block_id,
29
+ syncedAt: row.synced_at,
30
+ deletedAt: row.deleted_at,
31
+ };
32
+ }
33
+ /** D1-backed store of imported issue projections, across sources (migration 0014). */
34
+ export class D1TaskRepository {
35
+ db;
36
+ constructor({ db }) {
37
+ this.db = db;
38
+ }
39
+ async upsert(record) {
40
+ await this.db
41
+ .prepare(`INSERT INTO tasks
42
+ (workspace_id, source, external_id, title, url, status, type, assignee, priority,
43
+ labels, description, comments, excerpt, linked_block_id, synced_at, deleted_at)
44
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)
45
+ ON CONFLICT (workspace_id, source, external_id) DO UPDATE SET
46
+ title = excluded.title,
47
+ url = excluded.url,
48
+ status = excluded.status,
49
+ type = excluded.type,
50
+ assignee = excluded.assignee,
51
+ priority = excluded.priority,
52
+ labels = excluded.labels,
53
+ description = excluded.description,
54
+ comments = excluded.comments,
55
+ excerpt = excluded.excerpt,
56
+ linked_block_id = excluded.linked_block_id,
57
+ synced_at = excluded.synced_at,
58
+ deleted_at = NULL`)
59
+ .bind(record.workspaceId, record.source, record.externalId, record.title, record.url, record.status, record.type, record.assignee, record.priority, JSON.stringify(record.labels), record.description, JSON.stringify(record.comments), record.excerpt, record.linkedBlockId, record.syncedAt)
60
+ .run();
61
+ }
62
+ async get(workspaceId, source, externalId) {
63
+ const row = await this.db
64
+ .prepare('SELECT * FROM tasks WHERE workspace_id = ? AND source = ? AND external_id = ? AND deleted_at IS NULL')
65
+ .bind(workspaceId, source, externalId)
66
+ .first();
67
+ return row ? rowToRecord(row) : null;
68
+ }
69
+ async listByWorkspace(workspaceId) {
70
+ const { results } = await this.db
71
+ .prepare('SELECT * FROM tasks WHERE workspace_id = ? AND deleted_at IS NULL ORDER BY synced_at DESC')
72
+ .bind(workspaceId)
73
+ .all();
74
+ return results.map(rowToRecord);
75
+ }
76
+ async listByBlock(workspaceId, blockId) {
77
+ const { results } = await this.db
78
+ .prepare('SELECT * FROM tasks WHERE workspace_id = ? AND linked_block_id = ? AND deleted_at IS NULL ORDER BY synced_at DESC')
79
+ .bind(workspaceId, blockId)
80
+ .all();
81
+ return results.map(rowToRecord);
82
+ }
83
+ async linkBlock(workspaceId, source, externalId, blockId) {
84
+ await this.db
85
+ .prepare('UPDATE tasks SET linked_block_id = ? WHERE workspace_id = ? AND source = ? AND external_id = ?')
86
+ .bind(blockId, workspaceId, source, externalId)
87
+ .run();
88
+ }
89
+ }
90
+ //# sourceMappingURL=D1TaskRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TaskRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TaskRepository.ts"],"names":[],"mappings":"AAsBA,iFAAiF;AACjF,SAAS,cAAc,CAAI,IAAY;IACrC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,MAAa,CAAA;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAED,SAAS,WAAW,CAAC,GAAY;IAC/B,OAAO;QACL,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,MAAM,EAAE,GAAG,CAAC,MAAwB;QACpC,UAAU,EAAE,GAAG,CAAC,WAAW;QAC3B,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,MAAM,EAAE,cAAc,CAAS,GAAG,CAAC,MAAM,CAAC;QAC1C,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,QAAQ,EAAE,cAAc,CAAc,GAAG,CAAC,QAAQ,CAAC;QACnD,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,aAAa,EAAE,GAAG,CAAC,eAAe;QAClC,QAAQ,EAAE,GAAG,CAAC,SAAS;QACvB,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAA;AACH,CAAC;AAED,sFAAsF;AACtF,MAAM,OAAO,gBAAg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AAW,CAAC,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAmB,EAAE,OAAe;QACpD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC9B,OAAO,CACN,mHAAmH,CACpH;aACA,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;aAC1B,GAAG,EAAW,CAAA;QACjB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;IACjC,CAAC;IAED,KAAK,CAAC,SAAS,CACb,WAAmB,EACnB,MAAsB,EACtB,UAAkB,EAClB,OAAsB;QAEtB,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN,gGAAgG,CACjG;aACA,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC;aAC9C,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { TokenUsageRecord, TokenUsageRepository, TokenUsageTotals } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /** D1-backed ledger for the spend safeguard (see migration 0003). */
4
+ export declare class D1TokenUsageRepository implements TokenUsageRepository {
5
+ private readonly db;
6
+ constructor({ db }: {
7
+ db: D1Database;
8
+ });
9
+ record(usage: TokenUsageRecord): Promise<void>;
10
+ totalsSince(epochMs: number): Promise<TokenUsageTotals>;
11
+ deleteOlderThan(epochMs: number): Promise<number>;
12
+ }
13
+ //# sourceMappingURL=D1TokenUsageRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TokenUsageRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TokenUsageRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACnG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAE3D,qEAAqE;AACrE,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,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBnD;IAEK,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAiB5D;IAEK,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOtD;CACF"}
@@ -0,0 +1,41 @@
1
+ /** D1-backed ledger for the spend safeguard (see migration 0003). */
2
+ export class D1TokenUsageRepository {
3
+ db;
4
+ constructor({ db }) {
5
+ this.db = db;
6
+ }
7
+ async record(usage) {
8
+ await this.db
9
+ .prepare(`INSERT INTO token_usage
10
+ (id, workspace_id, execution_id, agent_kind, provider, model,
11
+ input_tokens, output_tokens, cost_estimate, created_at)
12
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`)
13
+ .bind(usage.id, usage.workspaceId, usage.executionId, usage.agentKind, usage.provider, usage.model, usage.inputTokens, usage.outputTokens, usage.costEstimate, usage.createdAt)
14
+ .run();
15
+ }
16
+ async totalsSince(epochMs) {
17
+ const row = await this.db
18
+ .prepare(`SELECT
19
+ COALESCE(SUM(input_tokens), 0) AS input_tokens,
20
+ COALESCE(SUM(output_tokens), 0) AS output_tokens,
21
+ COALESCE(SUM(cost_estimate), 0) AS cost_estimate
22
+ FROM token_usage
23
+ WHERE created_at >= ?`)
24
+ .bind(epochMs)
25
+ .first();
26
+ return {
27
+ inputTokens: row?.input_tokens ?? 0,
28
+ outputTokens: row?.output_tokens ?? 0,
29
+ costEstimate: row?.cost_estimate ?? 0,
30
+ };
31
+ }
32
+ async deleteOlderThan(epochMs) {
33
+ // Range delete on idx_token_usage_created; bounded by the rows being pruned.
34
+ const { meta } = await this.db
35
+ .prepare('DELETE FROM token_usage WHERE created_at < ?')
36
+ .bind(epochMs)
37
+ .run();
38
+ return meta.changes ?? 0;
39
+ }
40
+ }
41
+ //# sourceMappingURL=D1TokenUsageRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TokenUsageRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TokenUsageRepository.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,MAAM,OAAO,sBAAsB;IAChB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAuB;QAClC,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;+CAGuC,CACxC;aACA,IAAI,CACH,KAAK,CAAC,EAAE,EACR,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,SAAS,EACf,KAAK,CAAC,QAAQ,EACd,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,WAAW,EACjB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,YAAY,EAClB,KAAK,CAAC,SAAS,CAChB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAe;QAC/B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CACN;;;;;+BAKuB,CACxB;aACA,IAAI,CAAC,OAAO,CAAC;aACb,KAAK,EAA0E,CAAA;QAClF,OAAO;YACL,WAAW,EAAE,GAAG,EAAE,YAAY,IAAI,CAAC;YACnC,YAAY,EAAE,GAAG,EAAE,aAAa,IAAI,CAAC;YACrC,YAAY,EAAE,GAAG,EAAE,aAAa,IAAI,CAAC;SACtC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAAe;QACnC,6EAA6E;QAC7E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE;aAC3B,OAAO,CAAC,8CAA8C,CAAC;aACvD,IAAI,CAAC,OAAO,CAAC;aACb,GAAG,EAAE,CAAA;QACR,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,CAAA;IAC1B,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { TrackerSettings, TrackerSettingsRepository } from '@cat-factory/kernel';
2
+ import type { D1Database } from '@cloudflare/workers-types';
3
+ /** A workspace's issue-tracker selection, one row per workspace (migration 0029). */
4
+ export declare class D1TrackerSettingsRepository implements TrackerSettingsRepository {
5
+ private readonly db;
6
+ constructor({ db }: {
7
+ db: D1Database;
8
+ });
9
+ get(workspaceId: string): Promise<TrackerSettings | null>;
10
+ put(workspaceId: string, settings: TrackerSettings): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=D1TrackerSettingsRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"D1TrackerSettingsRepository.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TrackerSettingsRepository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAQ3D,qFAAqF;AACrF,qBAAa,2BAA4B,YAAW,yBAAyB;IAC3E,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,eAAe,GAAG,IAAI,CAAC,CAW9D;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvE;CACF"}
@@ -0,0 +1,32 @@
1
+ /** A workspace's issue-tracker selection, one row per workspace (migration 0029). */
2
+ export class D1TrackerSettingsRepository {
3
+ db;
4
+ constructor({ db }) {
5
+ this.db = db;
6
+ }
7
+ async get(workspaceId) {
8
+ const row = await this.db
9
+ .prepare(`SELECT * FROM tracker_settings WHERE workspace_id = ?`)
10
+ .bind(workspaceId)
11
+ .first();
12
+ if (!row)
13
+ return null;
14
+ return {
15
+ tracker: row.tracker ?? null,
16
+ jiraProjectKey: row.jira_project_key,
17
+ updatedAt: row.updated_at,
18
+ };
19
+ }
20
+ async put(workspaceId, settings) {
21
+ await this.db
22
+ .prepare(`INSERT INTO tracker_settings (workspace_id, tracker, jira_project_key, updated_at)
23
+ VALUES (?, ?, ?, ?)
24
+ ON CONFLICT (workspace_id) DO UPDATE SET
25
+ tracker = excluded.tracker,
26
+ jira_project_key = excluded.jira_project_key,
27
+ updated_at = excluded.updated_at`)
28
+ .bind(workspaceId, settings.tracker, settings.jiraProjectKey, settings.updatedAt)
29
+ .run();
30
+ }
31
+ }
32
+ //# sourceMappingURL=D1TrackerSettingsRepository.js.map