@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,179 @@
1
+ import { ValidationError, } from '@cat-factory/kernel';
2
+ import { CONFLUENCE_DESCRIPTOR, confluenceLogic } from '@cat-factory/integrations';
3
+ // ConfluenceProvider: the document-source provider for Confluence Cloud. It
4
+ // authenticates with HTTP Basic (account email + API token), fetches a page in
5
+ // storage format, and converts the body to the Markdown the planner consumes.
6
+ // All Confluence-specific *pure* logic (ref parsing, base-URL SSRF guard,
7
+ // XHTML → Markdown) lives in `@cat-factory/integrations` so it is unit-testable; this
8
+ // class is the thin `fetch` shell around it. No SDK — fetch + `btoa` suffice.
9
+ const USER_AGENT = 'cat-factory';
10
+ /** Bound the redirect chain so a permitted first hop can't walk us anywhere. */
11
+ const MAX_REDIRECTS = 5;
12
+ /** Hard cap on the bytes read off any response body, to protect the isolate. */
13
+ const MAX_RESPONSE_BYTES = 5_000_000;
14
+ /** Carries the HTTP status so callers can surface a meaningful error. */
15
+ export class ConfluenceApiError extends Error {
16
+ status;
17
+ constructor(status, message) {
18
+ super(message);
19
+ this.status = status;
20
+ this.name = 'ConfluenceApiError';
21
+ }
22
+ }
23
+ /**
24
+ * `fetch` with redirects followed by hand so the SSRF guard runs against EVERY
25
+ * hop. With the default `redirect: 'follow'` the permitted site could 302 to an
26
+ * internal target (or downgrade https→http) and the runtime would follow it
27
+ * unchecked, leaking the Basic-auth token. We force `redirect: 'manual'`,
28
+ * re-resolve the `Location` against the current URL, and re-run the same
29
+ * `assertSafe` guard (https-only + host blocklist) before following.
30
+ */
31
+ async function safeFetch(url, init, assertSafe) {
32
+ let current = url;
33
+ for (let hop = 0;; hop++) {
34
+ assertSafe(current);
35
+ const res = await fetch(current, { ...init, redirect: 'manual' });
36
+ if (res.status >= 300 && res.status < 400) {
37
+ const location = res.headers.get('location');
38
+ if (!location)
39
+ return res;
40
+ if (hop >= MAX_REDIRECTS) {
41
+ throw new ConfluenceApiError(502, 'Confluence returned too many redirects');
42
+ }
43
+ current = new URL(location, current).toString();
44
+ continue;
45
+ }
46
+ return res;
47
+ }
48
+ }
49
+ /**
50
+ * Read a response body with a running byte cap so a hostile/huge response can't
51
+ * OOM the isolate. Checks the declared Content-Length first, then enforces the
52
+ * cap while streaming.
53
+ */
54
+ async function readCappedText(res, maxBytes) {
55
+ const declared = res.headers.get('content-length');
56
+ if (declared && Number(declared) > maxBytes) {
57
+ throw new ConfluenceApiError(502, 'Confluence response too large');
58
+ }
59
+ const body = res.body;
60
+ if (!body)
61
+ return '';
62
+ const reader = body.getReader();
63
+ const chunks = [];
64
+ let total = 0;
65
+ try {
66
+ for (;;) {
67
+ const { done, value } = await reader.read();
68
+ if (done)
69
+ break;
70
+ if (!value)
71
+ continue;
72
+ total += value.byteLength;
73
+ if (total > maxBytes) {
74
+ await reader.cancel();
75
+ throw new ConfluenceApiError(502, 'Confluence response too large');
76
+ }
77
+ chunks.push(value);
78
+ }
79
+ }
80
+ finally {
81
+ reader.releaseLock();
82
+ }
83
+ const merged = new Uint8Array(total);
84
+ let offset = 0;
85
+ for (const c of chunks) {
86
+ merged.set(c, offset);
87
+ offset += c.byteLength;
88
+ }
89
+ return new TextDecoder().decode(merged);
90
+ }
91
+ export class ConfluenceProvider {
92
+ kind = 'confluence';
93
+ descriptor = CONFLUENCE_DESCRIPTOR;
94
+ normalizeConnection(input) {
95
+ const baseUrlRaw = input.baseUrl?.trim();
96
+ const accountEmail = input.accountEmail?.trim();
97
+ const apiToken = input.apiToken?.trim();
98
+ if (!baseUrlRaw || !accountEmail || !apiToken) {
99
+ throw new ValidationError('Confluence requires a site URL, account email and API token');
100
+ }
101
+ const baseUrl = confluenceLogic.normalizeBaseUrl(baseUrlRaw);
102
+ // Guard against SSRF: the stored base URL is later fetched with the
103
+ // workspace's credentials, so it must be a public https host.
104
+ confluenceLogic.assertSafeConfluenceBaseUrl(baseUrl);
105
+ return {
106
+ credentials: { baseUrl, accountEmail, apiToken },
107
+ label: baseUrl,
108
+ };
109
+ }
110
+ parseRef(input) {
111
+ return confluenceLogic.parseConfluenceRef(input);
112
+ }
113
+ async fetchDocument(credentials, externalId) {
114
+ const base = credentials.baseUrl.replace(/\/+$/, '');
115
+ const url = `${base}/wiki/rest/api/content/${encodeURIComponent(externalId)}?expand=body.storage,version`;
116
+ const auth = btoa(`${credentials.accountEmail}:${credentials.apiToken}`);
117
+ const res = await safeFetch(url, {
118
+ method: 'GET',
119
+ headers: {
120
+ authorization: `Basic ${auth}`,
121
+ accept: 'application/json',
122
+ 'user-agent': USER_AGENT,
123
+ },
124
+ }, (u) => confluenceLogic.assertSafeConfluenceBaseUrl(u));
125
+ if (!res.ok) {
126
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
127
+ throw new ConfluenceApiError(res.status, `Confluence GET ${url} → ${res.status}: ${text.slice(0, 300)}`);
128
+ }
129
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES);
130
+ const json = (() => {
131
+ try {
132
+ return JSON.parse(text);
133
+ }
134
+ catch {
135
+ return null;
136
+ }
137
+ })();
138
+ if (!json || !json.id) {
139
+ throw new ConfluenceApiError(502, `Confluence returned an unexpected body for page ${externalId}`);
140
+ }
141
+ const linkBase = json._links?.base ?? `${base}/wiki`;
142
+ const webui = json._links?.webui ?? '';
143
+ return {
144
+ externalId: json.id,
145
+ title: json.title ?? '(untitled)',
146
+ url: `${linkBase}${webui}`,
147
+ body: confluenceLogic.confluenceStorageToMarkdown(json.body?.storage?.value ?? ''),
148
+ };
149
+ }
150
+ async search(credentials, query) {
151
+ const base = credentials.baseUrl.replace(/\/+$/, '');
152
+ const cql = encodeURIComponent(confluenceLogic.buildConfluenceSearchCql(query));
153
+ const url = `${base}/wiki/rest/api/content/search?cql=${cql}&limit=20`;
154
+ const auth = btoa(`${credentials.accountEmail}:${credentials.apiToken}`);
155
+ const res = await safeFetch(url, {
156
+ method: 'GET',
157
+ headers: {
158
+ authorization: `Basic ${auth}`,
159
+ accept: 'application/json',
160
+ 'user-agent': USER_AGENT,
161
+ },
162
+ }, (u) => confluenceLogic.assertSafeConfluenceBaseUrl(u));
163
+ if (!res.ok) {
164
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
165
+ throw new ConfluenceApiError(res.status, `Confluence search ${url} → ${res.status}: ${text.slice(0, 300)}`);
166
+ }
167
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES);
168
+ const json = (() => {
169
+ try {
170
+ return JSON.parse(text);
171
+ }
172
+ catch {
173
+ return null;
174
+ }
175
+ })();
176
+ return confluenceLogic.parseConfluenceSearchResults(json, base);
177
+ }
178
+ }
179
+ //# sourceMappingURL=ConfluenceProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfluenceProvider.js","sourceRoot":"","sources":["../../../src/infrastructure/documents/ConfluenceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAMhB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAElF,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,0EAA0E;AAC1E,sFAAsF;AACtF,8EAA8E;AAE9E,MAAM,UAAU,GAAG,aAAa,CAAA;AAChC,gFAAgF;AAChF,MAAM,aAAa,GAAG,CAAC,CAAA;AACvB,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,SAAS,CAAA;AAEpC,yEAAyE;AACzE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAEhC,MAAM;IADjB,YACW,MAAc,EACvB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;sBAHL,MAAM;QAIf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAA;IAClC,CAAC;CACF;AAED;;;;;;;GAOG;AACH,KAAK,UAAU,SAAS,CACtB,GAAW,EACX,IAAiB,EACjB,UAA+B;IAE/B,IAAI,OAAO,GAAG,GAAG,CAAA;IACjB,KAAK,IAAI,GAAG,GAAG,CAAC,GAAI,GAAG,EAAE,EAAE,CAAC;QAC1B,UAAU,CAAC,OAAO,CAAC,CAAA;QACnB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;QACjE,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YAC1C,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,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BAC1B,YAAY,EAAE,UAAU;aACzB;SACF,EACD,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC,CAAC,CACtD,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;YAC1E,MAAM,IAAI,kBAAkB,CAC1B,GAAG,CAAC,MAAM,EACV,qBAAqB,GAAG,MAAM,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAClE,CAAA;QACH,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAA;QAC1D,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE;YACjB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YACzB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC,CAAC,EAAE,CAAA;QACJ,OAAO,eAAe,CAAC,4BAA4B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IACjE,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ import { type DocumentContent, type DocumentCredentials, type DocumentSearchResult, type DocumentSourceProvider, type GitHubClient, type GitHubInstallationRepository, type NormalizedConnection } from '@cat-factory/kernel';
2
+ export interface GitHubDocsProviderDependencies {
3
+ githubClient: GitHubClient;
4
+ /** Resolves which installation owns a given repo owner (by account login). */
5
+ installations: GitHubInstallationRepository;
6
+ }
7
+ export declare class GitHubDocsProvider implements DocumentSourceProvider {
8
+ private readonly deps;
9
+ readonly kind: 'github';
10
+ readonly descriptor: {
11
+ source: "confluence" | "github" | "notion";
12
+ label: string;
13
+ icon: string;
14
+ credentialFields: {
15
+ key: string;
16
+ label: string;
17
+ help?: string | undefined;
18
+ placeholder?: string | undefined;
19
+ secret?: boolean | undefined;
20
+ }[];
21
+ refLabel: string;
22
+ refPlaceholder: string;
23
+ searchable?: boolean | undefined;
24
+ };
25
+ constructor(deps: GitHubDocsProviderDependencies);
26
+ /**
27
+ * GitHub docs piggyback on the installed GitHub App, so there is nothing to
28
+ * validate or persist — the connection is a marker. Any supplied fields are
29
+ * ignored (the connect form has none).
30
+ */
31
+ normalizeConnection(_input: DocumentCredentials): NormalizedConnection;
32
+ parseRef(input: string): string | null;
33
+ fetchDocument(_credentials: DocumentCredentials, externalId: string): Promise<DocumentContent>;
34
+ search(_credentials: DocumentCredentials, query: string, workspaceId: string): Promise<DocumentSearchResult[]>;
35
+ /**
36
+ * Find the GitHub App installation whose account owns `owner`. The
37
+ * installation token for that account is what can read the repo's contents,
38
+ * regardless of which workspace triggered the import.
39
+ */
40
+ private resolveInstallationId;
41
+ }
42
+ //# sourceMappingURL=GitHubDocsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubDocsProvider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/documents/GitHubDocsProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAA;AAc5B,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,YAAY,CAAA;IAC1B,8EAA8E;IAC9E,aAAa,EAAE,4BAA4B,CAAA;CAC5C;AAED,qBAAa,kBAAmB,YAAW,sBAAsB;IAInD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHjC,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAS;IACjC,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;MAAyB;IAE5C,YAA6B,IAAI,EAAE,8BAA8B,EAAI;IAErE;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,oBAAoB,CAErE;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAErC;IAEK,aAAa,CACjB,YAAY,EAAE,mBAAmB,EACjC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAoB1B;IAEK,MAAM,CACV,YAAY,EAAE,mBAAmB,EACjC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAkCjC;IAED;;;;OAIG;YACW,qBAAqB;CAUpC"}
@@ -0,0 +1,85 @@
1
+ import { ConflictError, ValidationError, } from '@cat-factory/kernel';
2
+ import { GITHUB_DOCS_DESCRIPTOR, githubDocsLogic } from '@cat-factory/integrations';
3
+ export class GitHubDocsProvider {
4
+ deps;
5
+ kind = 'github';
6
+ descriptor = GITHUB_DOCS_DESCRIPTOR;
7
+ constructor(deps) {
8
+ this.deps = deps;
9
+ }
10
+ /**
11
+ * GitHub docs piggyback on the installed GitHub App, so there is nothing to
12
+ * validate or persist — the connection is a marker. Any supplied fields are
13
+ * ignored (the connect form has none).
14
+ */
15
+ normalizeConnection(_input) {
16
+ return { credentials: {}, label: 'GitHub' };
17
+ }
18
+ parseRef(input) {
19
+ return githubDocsLogic.parseGitHubDocRef(input);
20
+ }
21
+ async fetchDocument(_credentials, externalId) {
22
+ const id = githubDocsLogic.parseGitHubDocExternalId(externalId);
23
+ if (!id) {
24
+ throw new ValidationError(`"${externalId}" is not a valid GitHub doc reference`);
25
+ }
26
+ const installationId = await this.resolveInstallationId(id.owner);
27
+ const file = await this.deps.githubClient.getFileContent(installationId, { owner: id.owner, repo: id.repo }, id.path);
28
+ if (!file) {
29
+ throw new ConflictError(`GitHub file "${id.path}" was not found in ${id.owner}/${id.repo}`);
30
+ }
31
+ return {
32
+ externalId: githubDocsLogic.githubDocExternalId(id),
33
+ title: githubDocsLogic.githubDocTitle(id.path),
34
+ url: githubDocsLogic.githubDocUrl(id),
35
+ body: file.content,
36
+ };
37
+ }
38
+ async search(_credentials, query, workspaceId) {
39
+ // Scope to *this workspace's* installation so docs never leak across tenants
40
+ // (a deployment may host many installations; a workspace owns exactly one).
41
+ // Code search is account-scoped anyway (GitHub requires an org/user
42
+ // qualifier), which we build from the installation's account.
43
+ const installation = await this.deps.installations.getByWorkspace(workspaceId);
44
+ if (!installation)
45
+ return [];
46
+ const scoped = githubDocsLogic.buildGitHubCodeSearchQuery(query, installation.accountLogin, installation.targetType);
47
+ const hits = await this.deps.githubClient
48
+ .searchCode(installation.installationId, scoped, 20)
49
+ .catch(() => []);
50
+ const out = [];
51
+ const seen = new Set();
52
+ for (const hit of hits) {
53
+ const externalId = githubDocsLogic.githubDocExternalId({
54
+ owner: hit.owner,
55
+ repo: hit.repo,
56
+ path: hit.path,
57
+ });
58
+ if (seen.has(externalId))
59
+ continue;
60
+ seen.add(externalId);
61
+ out.push({
62
+ source: 'github',
63
+ externalId,
64
+ title: githubDocsLogic.githubDocTitle(hit.path),
65
+ url: hit.url,
66
+ excerpt: '',
67
+ });
68
+ }
69
+ return out.slice(0, 20);
70
+ }
71
+ /**
72
+ * Find the GitHub App installation whose account owns `owner`. The
73
+ * installation token for that account is what can read the repo's contents,
74
+ * regardless of which workspace triggered the import.
75
+ */
76
+ async resolveInstallationId(owner) {
77
+ const active = await this.deps.installations.listActive();
78
+ const match = active.find((i) => i.accountLogin.toLowerCase() === owner.toLowerCase());
79
+ if (!match) {
80
+ throw new ConflictError(`No GitHub App installation found for "${owner}". Install the GitHub App on that account to link its docs.`);
81
+ }
82
+ return match.installationId;
83
+ }
84
+ }
85
+ //# sourceMappingURL=GitHubDocsProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubDocsProvider.js","sourceRoot":"","sources":["../../../src/infrastructure/documents/GitHubDocsProvider.ts"],"names":[],"mappings":"AA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EAAE,QAAQ;gBAChB,UAAU;gBACV,KAAK,EAAE,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC;gBAC/C,GAAG,EAAE,GAAG,CAAC,GAAG;gBACZ,OAAO,EAAE,EAAE;aACZ,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACzB,CAAC;IAED;;;;OAIG;IACK,KAAK,CAAC,qBAAqB,CAAC,KAAa;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,CAAA;QACzD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;QACtF,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,aAAa,CACrB,yCAAyC,KAAK,6DAA6D,CAC5G,CAAA;QACH,CAAC;QACD,OAAO,KAAK,CAAC,cAAc,CAAA;IAC7B,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ import { type DocumentContent, type DocumentCredentials, type DocumentSearchResult, type DocumentSourceProvider, type NormalizedConnection } from '@cat-factory/kernel';
2
+ /** Carries the HTTP status so callers can surface a meaningful error. */
3
+ export declare class NotionApiError extends Error {
4
+ readonly status: number;
5
+ constructor(status: number, message: string);
6
+ }
7
+ export declare class NotionProvider implements DocumentSourceProvider {
8
+ readonly kind: 'notion';
9
+ readonly descriptor: {
10
+ source: "confluence" | "github" | "notion";
11
+ label: string;
12
+ icon: string;
13
+ credentialFields: {
14
+ key: string;
15
+ label: string;
16
+ help?: string | undefined;
17
+ placeholder?: string | undefined;
18
+ secret?: boolean | undefined;
19
+ }[];
20
+ refLabel: string;
21
+ refPlaceholder: string;
22
+ searchable?: boolean | undefined;
23
+ };
24
+ normalizeConnection(input: DocumentCredentials): NormalizedConnection;
25
+ parseRef(input: string): string | null;
26
+ fetchDocument(credentials: DocumentCredentials, externalId: string): Promise<DocumentContent>;
27
+ search(credentials: DocumentCredentials, query: string): Promise<DocumentSearchResult[]>;
28
+ /** Page through a page's top-level blocks (bounded), returning them in order. */
29
+ private fetchBlocks;
30
+ private get;
31
+ }
32
+ //# sourceMappingURL=NotionProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotionProvider.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/documents/NotionProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAA;AAsB5B,yEAAyE;AACzE,qBAAa,cAAe,SAAQ,KAAK;IAErC,QAAQ,CAAC,MAAM,EAAE,MAAM;IADzB,YACW,MAAM,EAAE,MAAM,EACvB,OAAO,EAAE,MAAM,EAIhB;CACF;AAkGD,qBAAa,cAAe,YAAW,sBAAsB;IAC3D,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAS;IACjC,QAAQ,CAAC,UAAU;;;;;;;;;;;;;;MAAoB;IAEvC,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,GAAG,oBAAoB,CAMpE;IAED,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAErC;IAEK,aAAa,CACjB,WAAW,EAAE,mBAAmB,EAChC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,CAAC,CAe1B;IAEK,MAAM,CAAC,WAAW,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA6B7F;IAED,iFAAiF;YACnE,WAAW;YAqBX,GAAG;CA+BlB"}
@@ -0,0 +1,220 @@
1
+ import { ValidationError, } from '@cat-factory/kernel';
2
+ import { NOTION_DESCRIPTOR, notionLogic } from '@cat-factory/integrations';
3
+ // NotionProvider: the document-source provider for Notion. It authenticates with
4
+ // a single internal-integration token (Bearer), fetches a page for its title and
5
+ // URL, then pages through the page's top-level blocks and converts them to the
6
+ // Markdown the planner consumes. Because the API host is fixed
7
+ // (`api.notion.com`) and there is no per-site base URL, there is no SSRF surface.
8
+ // Notion-specific *pure* logic (ref parsing, block → Markdown) lives in
9
+ // `@cat-factory/integrations`; this class is the thin `fetch` shell.
10
+ const API_BASE = 'https://api.notion.com/v1';
11
+ const NOTION_API_HOST = 'api.notion.com';
12
+ const NOTION_VERSION = '2022-06-28';
13
+ const USER_AGENT = 'cat-factory';
14
+ /** Bound the block backfill so a huge page can't stall an import (100 blocks/page). */
15
+ const MAX_BLOCK_PAGES = 5;
16
+ /** Bound the redirect chain so the fixed API host can't 302 us elsewhere. */
17
+ const MAX_REDIRECTS = 5;
18
+ /** Hard cap on the bytes read off any response body, to protect the isolate. */
19
+ const MAX_RESPONSE_BYTES = 5_000_000;
20
+ /** Carries the HTTP status so callers can surface a meaningful error. */
21
+ export class NotionApiError extends Error {
22
+ status;
23
+ constructor(status, message) {
24
+ super(message);
25
+ this.status = status;
26
+ this.name = 'NotionApiError';
27
+ }
28
+ }
29
+ /**
30
+ * The Notion API host is fixed, so any redirect must stay on `api.notion.com`
31
+ * over https. A redirect off-host (e.g. to an internal address) is treated as an
32
+ * SSRF attempt and rejected. Mirrors the per-hop guard the site-configurable
33
+ * providers run.
34
+ */
35
+ function assertSafeNotionUrl(url) {
36
+ let parsed;
37
+ try {
38
+ parsed = new URL(url);
39
+ }
40
+ catch {
41
+ throw new NotionApiError(502, `Notion request URL is invalid: ${url}`);
42
+ }
43
+ if (parsed.protocol !== 'https:') {
44
+ throw new NotionApiError(502, 'Notion request must use https');
45
+ }
46
+ if (parsed.hostname.toLowerCase() !== NOTION_API_HOST) {
47
+ throw new NotionApiError(502, `Notion redirect to a disallowed host: ${parsed.hostname}`);
48
+ }
49
+ }
50
+ /**
51
+ * `fetch` with redirects followed by hand so the host guard runs against EVERY
52
+ * hop. With the default `redirect: 'follow'` a 302 from the API could be chased
53
+ * to an internal target (or downgraded to http), leaking the Bearer token. We
54
+ * force `redirect: 'manual'`, re-resolve the `Location`, and re-validate.
55
+ */
56
+ async function safeFetch(url, init) {
57
+ let current = url;
58
+ for (let hop = 0;; hop++) {
59
+ assertSafeNotionUrl(current);
60
+ const res = await fetch(current, { ...init, redirect: 'manual' });
61
+ if (res.status >= 300 && res.status < 400) {
62
+ const location = res.headers.get('location');
63
+ if (!location)
64
+ return res;
65
+ if (hop >= MAX_REDIRECTS) {
66
+ throw new NotionApiError(502, 'Notion returned too many redirects');
67
+ }
68
+ current = new URL(location, current).toString();
69
+ continue;
70
+ }
71
+ return res;
72
+ }
73
+ }
74
+ /**
75
+ * Read a response body with a running byte cap so a hostile/huge response can't
76
+ * OOM the isolate. Checks the declared Content-Length first, then enforces the
77
+ * cap while streaming.
78
+ */
79
+ async function readCappedText(res, maxBytes) {
80
+ const declared = res.headers.get('content-length');
81
+ if (declared && Number(declared) > maxBytes) {
82
+ throw new NotionApiError(502, 'Notion response too large');
83
+ }
84
+ const body = res.body;
85
+ if (!body)
86
+ return '';
87
+ const reader = body.getReader();
88
+ const chunks = [];
89
+ let total = 0;
90
+ try {
91
+ for (;;) {
92
+ const { done, value } = await reader.read();
93
+ if (done)
94
+ break;
95
+ if (!value)
96
+ continue;
97
+ total += value.byteLength;
98
+ if (total > maxBytes) {
99
+ await reader.cancel();
100
+ throw new NotionApiError(502, 'Notion response too large');
101
+ }
102
+ chunks.push(value);
103
+ }
104
+ }
105
+ finally {
106
+ reader.releaseLock();
107
+ }
108
+ const merged = new Uint8Array(total);
109
+ let offset = 0;
110
+ for (const c of chunks) {
111
+ merged.set(c, offset);
112
+ offset += c.byteLength;
113
+ }
114
+ return new TextDecoder().decode(merged);
115
+ }
116
+ export class NotionProvider {
117
+ kind = 'notion';
118
+ descriptor = NOTION_DESCRIPTOR;
119
+ normalizeConnection(input) {
120
+ const apiToken = input.apiToken?.trim();
121
+ if (!apiToken) {
122
+ throw new ValidationError('Notion requires an internal integration token');
123
+ }
124
+ return { credentials: { apiToken }, label: 'Notion workspace' };
125
+ }
126
+ parseRef(input) {
127
+ return notionLogic.parseNotionRef(input);
128
+ }
129
+ async fetchDocument(credentials, externalId) {
130
+ const page = await this.get(credentials, `/pages/${encodeURIComponent(externalId)}`);
131
+ if (!page.id) {
132
+ throw new NotionApiError(502, `Notion returned an unexpected body for page ${externalId}`);
133
+ }
134
+ const blocks = await this.fetchBlocks(credentials, page.id);
135
+ return {
136
+ externalId: page.id,
137
+ title: notionLogic.notionPageTitle(page.properties),
138
+ url: page.url ?? `https://www.notion.so/${page.id.replace(/-/g, '')}`,
139
+ body: notionLogic.notionBlocksToMarkdown(blocks),
140
+ };
141
+ }
142
+ async search(credentials, query) {
143
+ const res = await safeFetch(`${API_BASE}/search`, {
144
+ method: 'POST',
145
+ headers: {
146
+ authorization: `Bearer ${credentials.apiToken}`,
147
+ 'notion-version': NOTION_VERSION,
148
+ accept: 'application/json',
149
+ 'content-type': 'application/json',
150
+ 'user-agent': USER_AGENT,
151
+ },
152
+ body: JSON.stringify({
153
+ query,
154
+ filter: { property: 'object', value: 'page' },
155
+ page_size: 20,
156
+ }),
157
+ });
158
+ if (!res.ok) {
159
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
160
+ throw new NotionApiError(res.status, `Notion search → ${res.status}: ${text.slice(0, 300)}`);
161
+ }
162
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES);
163
+ const json = (() => {
164
+ try {
165
+ return JSON.parse(text);
166
+ }
167
+ catch {
168
+ return null;
169
+ }
170
+ })();
171
+ return notionLogic.parseNotionSearchResults(json);
172
+ }
173
+ /** Page through a page's top-level blocks (bounded), returning them in order. */
174
+ async fetchBlocks(credentials, pageId) {
175
+ const blocks = [];
176
+ let cursor;
177
+ for (let i = 0; i < MAX_BLOCK_PAGES; i++) {
178
+ const query = cursor
179
+ ? `?page_size=100&start_cursor=${encodeURIComponent(cursor)}`
180
+ : '?page_size=100';
181
+ const res = await this.get(credentials, `/blocks/${encodeURIComponent(pageId)}/children${query}`);
182
+ if (Array.isArray(res.results))
183
+ blocks.push(...res.results);
184
+ if (!res.has_more || !res.next_cursor)
185
+ break;
186
+ cursor = res.next_cursor;
187
+ }
188
+ return blocks;
189
+ }
190
+ async get(credentials, path) {
191
+ const url = `${API_BASE}${path}`;
192
+ const res = await safeFetch(url, {
193
+ method: 'GET',
194
+ headers: {
195
+ authorization: `Bearer ${credentials.apiToken}`,
196
+ 'notion-version': NOTION_VERSION,
197
+ accept: 'application/json',
198
+ 'user-agent': USER_AGENT,
199
+ },
200
+ });
201
+ if (!res.ok) {
202
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES).catch(() => '');
203
+ throw new NotionApiError(res.status, `Notion GET ${url} → ${res.status}: ${text.slice(0, 300)}`);
204
+ }
205
+ const text = await readCappedText(res, MAX_RESPONSE_BYTES);
206
+ const json = (() => {
207
+ try {
208
+ return JSON.parse(text);
209
+ }
210
+ catch {
211
+ return null;
212
+ }
213
+ })();
214
+ if (json === null) {
215
+ throw new NotionApiError(502, `Notion returned an unparseable body for ${path}`);
216
+ }
217
+ return json;
218
+ }
219
+ }
220
+ //# sourceMappingURL=NotionProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotionProvider.js","sourceRoot":"","sources":["../../../src/infrastructure/documents/NotionProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAMhB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE1E,iFAAiF;AACjF,iFAAiF;AACjF,+EAA+E;AAC/E,+DAA+D;AAC/D,kFAAkF;AAClF,wEAAwE;AACxE,qEAAqE;AAErE,MAAM,QAAQ,GAAG,2BAA2B,CAAA;AAC5C,MAAM,eAAe,GAAG,gBA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AClB,MAAM,IAAI,cAAc,CAAC,GAAG,EAAE,2CAA2C,IAAI,EAAE,CAAC,CAAA;QAClF,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ import { DurableObject } from 'cloudflare:workers';
2
+ import type { Env } from '../env';
3
+ /**
4
+ * Per-workspace pub/sub hub. Addressed by `idFromName(workspaceId)`, so every
5
+ * subscriber and every publish for a workspace converge on one instance.
6
+ *
7
+ * Uses the WebSocket Hibernation API (`ctx.acceptWebSocket` + the
8
+ * `webSocketMessage`/`webSocketClose`/`webSocketError` methods + `getWebSockets`):
9
+ * accepted sockets survive the DO being evicted from memory, so an idle workspace
10
+ * costs nothing. The handlers must be METHODS (not `addEventListener` closures)
11
+ * precisely because hibernation reconstructs the instance to deliver an event.
12
+ */
13
+ export declare class WorkspaceEventsHub extends DurableObject<Env> {
14
+ constructor(ctx: DurableObjectState, env: Env);
15
+ fetch(request: Request): Promise<Response>;
16
+ webSocketMessage(): Promise<void>;
17
+ webSocketClose(ws: WebSocket, code: number, reason: string): Promise<void>;
18
+ webSocketError(): Promise<void>;
19
+ }
20
+ //# sourceMappingURL=WorkspaceEventsHub.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceEventsHub.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/durable-objects/WorkspaceEventsHub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,GAAG,CAAC;IACxD,YAAY,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,GAAG,EAK5C;IAEc,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4BxD;IAIc,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/C;IAEc,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxF;IAEc,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAE7C;CACF"}