@cat-factory/kernel 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 (318) hide show
  1. package/LICENSE +21 -0
  2. package/dist/domain/catalog.d.ts +36 -0
  3. package/dist/domain/catalog.d.ts.map +1 -0
  4. package/dist/domain/catalog.js +55 -0
  5. package/dist/domain/catalog.js.map +1 -0
  6. package/dist/domain/errors.d.ts +57 -0
  7. package/dist/domain/errors.d.ts.map +1 -0
  8. package/dist/domain/errors.js +60 -0
  9. package/dist/domain/errors.js.map +1 -0
  10. package/dist/domain/models.d.ts +204 -0
  11. package/dist/domain/models.d.ts.map +1 -0
  12. package/dist/domain/models.js +522 -0
  13. package/dist/domain/models.js.map +1 -0
  14. package/dist/domain/pipeline-registry.d.ts +19 -0
  15. package/dist/domain/pipeline-registry.d.ts.map +1 -0
  16. package/dist/domain/pipeline-registry.js +48 -0
  17. package/dist/domain/pipeline-registry.js.map +1 -0
  18. package/dist/domain/seed.d.ts +14 -0
  19. package/dist/domain/seed.d.ts.map +1 -0
  20. package/dist/domain/seed.js +369 -0
  21. package/dist/domain/seed.js.map +1 -0
  22. package/dist/domain/service-registration.d.ts +31 -0
  23. package/dist/domain/service-registration.d.ts.map +1 -0
  24. package/dist/domain/service-registration.js +37 -0
  25. package/dist/domain/service-registration.js.map +1 -0
  26. package/dist/domain/subtasks.logic.d.ts +6 -0
  27. package/dist/domain/subtasks.logic.d.ts.map +1 -0
  28. package/dist/domain/subtasks.logic.js +20 -0
  29. package/dist/domain/subtasks.logic.js.map +1 -0
  30. package/dist/domain/types.d.ts +2 -0
  31. package/dist/domain/types.d.ts.map +1 -0
  32. package/dist/domain/types.js +2 -0
  33. package/dist/domain/types.js.map +1 -0
  34. package/dist/index.d.ts +16 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +21 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/ports/account-repositories.d.ts +46 -0
  39. package/dist/ports/account-repositories.d.ts.map +1 -0
  40. package/dist/ports/account-repositories.js +2 -0
  41. package/dist/ports/account-repositories.js.map +1 -0
  42. package/dist/ports/agent-executor.d.ts +361 -0
  43. package/dist/ports/agent-executor.d.ts.map +1 -0
  44. package/dist/ports/agent-executor.js +8 -0
  45. package/dist/ports/agent-executor.js.map +1 -0
  46. package/dist/ports/agent-runs.d.ts +28 -0
  47. package/dist/ports/agent-runs.d.ts.map +1 -0
  48. package/dist/ports/agent-runs.js +2 -0
  49. package/dist/ports/agent-runs.js.map +1 -0
  50. package/dist/ports/board-operations.d.ts +15 -0
  51. package/dist/ports/board-operations.d.ts.map +1 -0
  52. package/dist/ports/board-operations.js +2 -0
  53. package/dist/ports/board-operations.js.map +1 -0
  54. package/dist/ports/board-scan-repositories.d.ts +23 -0
  55. package/dist/ports/board-scan-repositories.d.ts.map +1 -0
  56. package/dist/ports/board-scan-repositories.js +2 -0
  57. package/dist/ports/board-scan-repositories.js.map +1 -0
  58. package/dist/ports/bootstrap-repositories.d.ts +71 -0
  59. package/dist/ports/bootstrap-repositories.d.ts.map +1 -0
  60. package/dist/ports/bootstrap-repositories.js +2 -0
  61. package/dist/ports/bootstrap-repositories.js.map +1 -0
  62. package/dist/ports/bootstrap-runner.d.ts +20 -0
  63. package/dist/ports/bootstrap-runner.d.ts.map +1 -0
  64. package/dist/ports/bootstrap-runner.js +12 -0
  65. package/dist/ports/bootstrap-runner.js.map +1 -0
  66. package/dist/ports/ci-status.d.ts +23 -0
  67. package/dist/ports/ci-status.d.ts.map +1 -0
  68. package/dist/ports/ci-status.js +8 -0
  69. package/dist/ports/ci-status.js.map +1 -0
  70. package/dist/ports/clarity-review-repositories.d.ts +12 -0
  71. package/dist/ports/clarity-review-repositories.d.ts.map +1 -0
  72. package/dist/ports/clarity-review-repositories.js +2 -0
  73. package/dist/ports/clarity-review-repositories.js.map +1 -0
  74. package/dist/ports/consensus-repositories.d.ts +12 -0
  75. package/dist/ports/consensus-repositories.d.ts.map +1 -0
  76. package/dist/ports/consensus-repositories.js +2 -0
  77. package/dist/ports/consensus-repositories.js.map +1 -0
  78. package/dist/ports/document-repositories.d.ts +55 -0
  79. package/dist/ports/document-repositories.d.ts.map +1 -0
  80. package/dist/ports/document-repositories.js +2 -0
  81. package/dist/ports/document-repositories.js.map +1 -0
  82. package/dist/ports/document-source.d.ts +55 -0
  83. package/dist/ports/document-source.d.ts.map +1 -0
  84. package/dist/ports/document-source.js +2 -0
  85. package/dist/ports/document-source.js.map +1 -0
  86. package/dist/ports/email-sender.d.ts +42 -0
  87. package/dist/ports/email-sender.d.ts.map +1 -0
  88. package/dist/ports/email-sender.js +7 -0
  89. package/dist/ports/email-sender.js.map +1 -0
  90. package/dist/ports/environment-provider.d.ts +67 -0
  91. package/dist/ports/environment-provider.d.ts.map +1 -0
  92. package/dist/ports/environment-provider.js +2 -0
  93. package/dist/ports/environment-provider.js.map +1 -0
  94. package/dist/ports/environment-repositories.d.ts +64 -0
  95. package/dist/ports/environment-repositories.d.ts.map +1 -0
  96. package/dist/ports/environment-repositories.js +2 -0
  97. package/dist/ports/environment-repositories.js.map +1 -0
  98. package/dist/ports/execution-events.d.ts +72 -0
  99. package/dist/ports/execution-events.d.ts.map +1 -0
  100. package/dist/ports/execution-events.js +16 -0
  101. package/dist/ports/execution-events.js.map +1 -0
  102. package/dist/ports/fragment-repositories.d.ts +65 -0
  103. package/dist/ports/fragment-repositories.d.ts.map +1 -0
  104. package/dist/ports/fragment-repositories.js +2 -0
  105. package/dist/ports/fragment-repositories.js.map +1 -0
  106. package/dist/ports/fragment-selector.d.ts +64 -0
  107. package/dist/ports/fragment-selector.d.ts.map +1 -0
  108. package/dist/ports/fragment-selector.js +2 -0
  109. package/dist/ports/fragment-selector.js.map +1 -0
  110. package/dist/ports/github-client.d.ts +226 -0
  111. package/dist/ports/github-client.d.ts.map +1 -0
  112. package/dist/ports/github-client.js +2 -0
  113. package/dist/ports/github-client.js.map +1 -0
  114. package/dist/ports/github-provisioning.d.ts +47 -0
  115. package/dist/ports/github-provisioning.d.ts.map +1 -0
  116. package/dist/ports/github-provisioning.js +12 -0
  117. package/dist/ports/github-provisioning.js.map +1 -0
  118. package/dist/ports/github-repositories.d.ts +136 -0
  119. package/dist/ports/github-repositories.d.ts.map +1 -0
  120. package/dist/ports/github-repositories.js +2 -0
  121. package/dist/ports/github-repositories.js.map +1 -0
  122. package/dist/ports/incident-enrichment.d.ts +40 -0
  123. package/dist/ports/incident-enrichment.d.ts.map +1 -0
  124. package/dist/ports/incident-enrichment.js +30 -0
  125. package/dist/ports/incident-enrichment.js.map +1 -0
  126. package/dist/ports/index.d.ts +68 -0
  127. package/dist/ports/index.d.ts.map +1 -0
  128. package/dist/ports/index.js +11 -0
  129. package/dist/ports/index.js.map +1 -0
  130. package/dist/ports/invitation-repositories.d.ts +28 -0
  131. package/dist/ports/invitation-repositories.d.ts.map +1 -0
  132. package/dist/ports/invitation-repositories.js +2 -0
  133. package/dist/ports/invitation-repositories.js.map +1 -0
  134. package/dist/ports/llm-metrics.d.ts +142 -0
  135. package/dist/ports/llm-metrics.d.ts.map +1 -0
  136. package/dist/ports/llm-metrics.js +16 -0
  137. package/dist/ports/llm-metrics.js.map +1 -0
  138. package/dist/ports/llm-trace-sink.d.ts +84 -0
  139. package/dist/ports/llm-trace-sink.d.ts.map +1 -0
  140. package/dist/ports/llm-trace-sink.js +55 -0
  141. package/dist/ports/llm-trace-sink.js.map +1 -0
  142. package/dist/ports/local-model-repositories.d.ts +29 -0
  143. package/dist/ports/local-model-repositories.d.ts.map +1 -0
  144. package/dist/ports/local-model-repositories.js +2 -0
  145. package/dist/ports/local-model-repositories.js.map +1 -0
  146. package/dist/ports/merge-preset-repositories.d.ts +14 -0
  147. package/dist/ports/merge-preset-repositories.d.ts.map +1 -0
  148. package/dist/ports/merge-preset-repositories.js +2 -0
  149. package/dist/ports/merge-preset-repositories.js.map +1 -0
  150. package/dist/ports/model-default-repositories.d.ts +9 -0
  151. package/dist/ports/model-default-repositories.d.ts.map +1 -0
  152. package/dist/ports/model-default-repositories.js +6 -0
  153. package/dist/ports/model-default-repositories.js.map +1 -0
  154. package/dist/ports/model-provider.d.ts +69 -0
  155. package/dist/ports/model-provider.d.ts.map +1 -0
  156. package/dist/ports/model-provider.js +16 -0
  157. package/dist/ports/model-provider.js.map +1 -0
  158. package/dist/ports/notification-channel.d.ts +16 -0
  159. package/dist/ports/notification-channel.d.ts.map +1 -0
  160. package/dist/ports/notification-channel.js +22 -0
  161. package/dist/ports/notification-channel.js.map +1 -0
  162. package/dist/ports/notification-repositories.d.ts +15 -0
  163. package/dist/ports/notification-repositories.d.ts.map +1 -0
  164. package/dist/ports/notification-repositories.js +2 -0
  165. package/dist/ports/notification-repositories.js.map +1 -0
  166. package/dist/ports/password-hasher.d.ts +14 -0
  167. package/dist/ports/password-hasher.d.ts.map +1 -0
  168. package/dist/ports/password-hasher.js +9 -0
  169. package/dist/ports/password-hasher.js.map +1 -0
  170. package/dist/ports/personal-secret-cipher.d.ts +7 -0
  171. package/dist/ports/personal-secret-cipher.d.ts.map +1 -0
  172. package/dist/ports/personal-secret-cipher.js +12 -0
  173. package/dist/ports/personal-secret-cipher.js.map +1 -0
  174. package/dist/ports/personal-subscription-repositories.d.ts +72 -0
  175. package/dist/ports/personal-subscription-repositories.d.ts.map +1 -0
  176. package/dist/ports/personal-subscription-repositories.js +2 -0
  177. package/dist/ports/personal-subscription-repositories.js.map +1 -0
  178. package/dist/ports/pr-mergeability.d.ts +24 -0
  179. package/dist/ports/pr-mergeability.d.ts.map +1 -0
  180. package/dist/ports/pr-mergeability.js +7 -0
  181. package/dist/ports/pr-mergeability.js.map +1 -0
  182. package/dist/ports/pr-merger.d.ts +10 -0
  183. package/dist/ports/pr-merger.d.ts.map +1 -0
  184. package/dist/ports/pr-merger.js +8 -0
  185. package/dist/ports/pr-merger.js.map +1 -0
  186. package/dist/ports/provider-api-key-repositories.d.ts +71 -0
  187. package/dist/ports/provider-api-key-repositories.d.ts.map +1 -0
  188. package/dist/ports/provider-api-key-repositories.js +15 -0
  189. package/dist/ports/provider-api-key-repositories.js.map +1 -0
  190. package/dist/ports/provider-subscription-repositories.d.ts +51 -0
  191. package/dist/ports/provider-subscription-repositories.d.ts.map +1 -0
  192. package/dist/ports/provider-subscription-repositories.js +15 -0
  193. package/dist/ports/provider-subscription-repositories.js.map +1 -0
  194. package/dist/ports/recurring-repositories.d.ts +46 -0
  195. package/dist/ports/recurring-repositories.d.ts.map +1 -0
  196. package/dist/ports/recurring-repositories.js +2 -0
  197. package/dist/ports/recurring-repositories.js.map +1 -0
  198. package/dist/ports/release-health-repositories.d.ts +42 -0
  199. package/dist/ports/release-health-repositories.d.ts.map +1 -0
  200. package/dist/ports/release-health-repositories.js +6 -0
  201. package/dist/ports/release-health-repositories.js.map +1 -0
  202. package/dist/ports/release-health.d.ts +59 -0
  203. package/dist/ports/release-health.d.ts.map +1 -0
  204. package/dist/ports/release-health.js +8 -0
  205. package/dist/ports/release-health.js.map +1 -0
  206. package/dist/ports/repo-bootstrapper.d.ts +80 -0
  207. package/dist/ports/repo-bootstrapper.d.ts.map +1 -0
  208. package/dist/ports/repo-bootstrapper.js +2 -0
  209. package/dist/ports/repo-bootstrapper.js.map +1 -0
  210. package/dist/ports/repo-scanner.d.ts +22 -0
  211. package/dist/ports/repo-scanner.d.ts.map +1 -0
  212. package/dist/ports/repo-scanner.js +2 -0
  213. package/dist/ports/repo-scanner.js.map +1 -0
  214. package/dist/ports/repositories.d.ts +131 -0
  215. package/dist/ports/repositories.d.ts.map +1 -0
  216. package/dist/ports/repositories.js +2 -0
  217. package/dist/ports/repositories.js.map +1 -0
  218. package/dist/ports/requirement-review-repositories.d.ts +16 -0
  219. package/dist/ports/requirement-review-repositories.d.ts.map +1 -0
  220. package/dist/ports/requirement-review-repositories.js +2 -0
  221. package/dist/ports/requirement-review-repositories.js.map +1 -0
  222. package/dist/ports/runner-pool-provider.d.ts +25 -0
  223. package/dist/ports/runner-pool-provider.d.ts.map +1 -0
  224. package/dist/ports/runner-pool-provider.js +2 -0
  225. package/dist/ports/runner-pool-provider.js.map +1 -0
  226. package/dist/ports/runner-pool-repositories.d.ts +27 -0
  227. package/dist/ports/runner-pool-repositories.d.ts.map +1 -0
  228. package/dist/ports/runner-pool-repositories.js +7 -0
  229. package/dist/ports/runner-pool-repositories.js.map +1 -0
  230. package/dist/ports/runner-transport.d.ts +119 -0
  231. package/dist/ports/runner-transport.d.ts.map +1 -0
  232. package/dist/ports/runner-transport.js +2 -0
  233. package/dist/ports/runner-transport.js.map +1 -0
  234. package/dist/ports/runtime.d.ts +9 -0
  235. package/dist/ports/runtime.d.ts.map +1 -0
  236. package/dist/ports/runtime.js +5 -0
  237. package/dist/ports/runtime.js.map +1 -0
  238. package/dist/ports/sandbox-repositories.d.ts +39 -0
  239. package/dist/ports/sandbox-repositories.d.ts.map +1 -0
  240. package/dist/ports/sandbox-repositories.js +2 -0
  241. package/dist/ports/sandbox-repositories.js.map +1 -0
  242. package/dist/ports/secret-cipher.d.ts +7 -0
  243. package/dist/ports/secret-cipher.d.ts.map +1 -0
  244. package/dist/ports/secret-cipher.js +7 -0
  245. package/dist/ports/secret-cipher.js.map +1 -0
  246. package/dist/ports/service-fragment-default-repositories.d.ts +7 -0
  247. package/dist/ports/service-fragment-default-repositories.d.ts.map +1 -0
  248. package/dist/ports/service-fragment-default-repositories.js +6 -0
  249. package/dist/ports/service-fragment-default-repositories.js.map +1 -0
  250. package/dist/ports/service-repositories.d.ts +68 -0
  251. package/dist/ports/service-repositories.d.ts.map +1 -0
  252. package/dist/ports/service-repositories.js +2 -0
  253. package/dist/ports/service-repositories.js.map +1 -0
  254. package/dist/ports/slack-repositories.d.ts +61 -0
  255. package/dist/ports/slack-repositories.d.ts.map +1 -0
  256. package/dist/ports/slack-repositories.js +2 -0
  257. package/dist/ports/slack-repositories.js.map +1 -0
  258. package/dist/ports/task-repositories.d.ts +61 -0
  259. package/dist/ports/task-repositories.d.ts.map +1 -0
  260. package/dist/ports/task-repositories.js +2 -0
  261. package/dist/ports/task-repositories.js.map +1 -0
  262. package/dist/ports/task-source.d.ts +69 -0
  263. package/dist/ports/task-source.d.ts.map +1 -0
  264. package/dist/ports/task-source.js +2 -0
  265. package/dist/ports/task-source.js.map +1 -0
  266. package/dist/ports/ticket-tracker.d.ts +19 -0
  267. package/dist/ports/ticket-tracker.d.ts.map +1 -0
  268. package/dist/ports/ticket-tracker.js +8 -0
  269. package/dist/ports/ticket-tracker.js.map +1 -0
  270. package/dist/ports/token-usage.d.ts +37 -0
  271. package/dist/ports/token-usage.d.ts.map +1 -0
  272. package/dist/ports/token-usage.js +6 -0
  273. package/dist/ports/token-usage.js.map +1 -0
  274. package/dist/ports/tracker-settings-repositories.d.ts +6 -0
  275. package/dist/ports/tracker-settings-repositories.d.ts.map +1 -0
  276. package/dist/ports/tracker-settings-repositories.js +2 -0
  277. package/dist/ports/tracker-settings-repositories.js.map +1 -0
  278. package/dist/ports/url-safety-policy.d.ts +15 -0
  279. package/dist/ports/url-safety-policy.d.ts.map +1 -0
  280. package/dist/ports/url-safety-policy.js +13 -0
  281. package/dist/ports/url-safety-policy.js.map +1 -0
  282. package/dist/ports/user-repositories.d.ts +52 -0
  283. package/dist/ports/user-repositories.d.ts.map +1 -0
  284. package/dist/ports/user-repositories.js +13 -0
  285. package/dist/ports/user-repositories.js.map +1 -0
  286. package/dist/ports/webhook-verifier.d.ts +9 -0
  287. package/dist/ports/webhook-verifier.d.ts.map +1 -0
  288. package/dist/ports/webhook-verifier.js +8 -0
  289. package/dist/ports/webhook-verifier.js.map +1 -0
  290. package/dist/ports/work-runner.d.ts +19 -0
  291. package/dist/ports/work-runner.d.ts.map +1 -0
  292. package/dist/ports/work-runner.js +19 -0
  293. package/dist/ports/work-runner.js.map +1 -0
  294. package/dist/ports/workspace-settings-repositories.d.ts +8 -0
  295. package/dist/ports/workspace-settings-repositories.d.ts.map +1 -0
  296. package/dist/ports/workspace-settings-repositories.js +2 -0
  297. package/dist/ports/workspace-settings-repositories.js.map +1 -0
  298. package/dist/shared/atlassian.logic.d.ts +11 -0
  299. package/dist/shared/atlassian.logic.d.ts.map +1 -0
  300. package/dist/shared/atlassian.logic.js +148 -0
  301. package/dist/shared/atlassian.logic.js.map +1 -0
  302. package/dist/shared/markdown.logic.d.ts +5 -0
  303. package/dist/shared/markdown.logic.d.ts.map +1 -0
  304. package/dist/shared/markdown.logic.js +21 -0
  305. package/dist/shared/markdown.logic.js.map +1 -0
  306. package/dist/shared/source-registry.logic.d.ts +10 -0
  307. package/dist/shared/source-registry.logic.d.ts.map +1 -0
  308. package/dist/shared/source-registry.logic.js +17 -0
  309. package/dist/shared/source-registry.logic.js.map +1 -0
  310. package/dist/shared/tasks-prompt.logic.d.ts +16 -0
  311. package/dist/shared/tasks-prompt.logic.d.ts.map +1 -0
  312. package/dist/shared/tasks-prompt.logic.js +29 -0
  313. package/dist/shared/tasks-prompt.logic.js.map +1 -0
  314. package/dist/workspace-guard.d.ts +4 -0
  315. package/dist/workspace-guard.d.ts.map +1 -0
  316. package/dist/workspace-guard.js +5 -0
  317. package/dist/workspace-guard.js.map +1 -0
  318. package/package.json +32 -0
@@ -0,0 +1,64 @@
1
+ import type { AgentKind, BlockType } from '../domain/types.js';
2
+ /** A catalog entry as the selector sees it: metadata only, no body. */
3
+ export interface SelectableFragment {
4
+ id: string;
5
+ title: string;
6
+ summary: string;
7
+ category?: string;
8
+ tags?: string[];
9
+ appliesTo?: {
10
+ blockTypes?: BlockType[];
11
+ agentKinds?: AgentKind[];
12
+ };
13
+ }
14
+ /** What the selector knows about the run it is choosing fragments for. */
15
+ export interface FragmentSelectionContext {
16
+ /** The workspace the run belongs to, for resolving the scoped model provider. */
17
+ workspaceId: string;
18
+ agentKind: AgentKind;
19
+ blockType: BlockType;
20
+ blockTitle: string;
21
+ blockDescription: string;
22
+ /**
23
+ * Free-form signals the selector may reason over — e.g. the prior step's
24
+ * output (a coder's summary), or changed file paths when available. Kept
25
+ * generic so the engine need not fetch a diff to make selection useful.
26
+ */
27
+ signals: string[];
28
+ }
29
+ export interface FragmentSelector {
30
+ /** Return the ids of `candidates` relevant to `context`. */
31
+ select(candidates: SelectableFragment[], context: FragmentSelectionContext): Promise<string[]>;
32
+ }
33
+ /** A fragment resolved for injection: just the id and the body to fold in. */
34
+ export interface ResolvedRunFragment {
35
+ id: string;
36
+ body: string;
37
+ }
38
+ export interface FragmentResolverInput {
39
+ workspaceId: string;
40
+ agentKind: AgentKind;
41
+ blockType: BlockType;
42
+ blockTitle: string;
43
+ blockDescription: string;
44
+ /** Fragment ids pinned manually on the block (an authoritative override). */
45
+ manualIds: string[];
46
+ /** Free-form signals handed to the selector (see {@link FragmentSelectionContext}). */
47
+ signals: string[];
48
+ }
49
+ export interface FragmentRunSelection {
50
+ /** The fragments (id + body) to fold into the system prompt, in catalog order. */
51
+ fragments: ResolvedRunFragment[];
52
+ /** The ids that were selected (manual ∪ selector pick), for the execution step. */
53
+ selectedIds: string[];
54
+ }
55
+ /**
56
+ * The execution engine's view of the fragment library: resolve the fragments to
57
+ * inject for one agent run. A no-op-safe optional dependency — when the library
58
+ * module is not configured the engine never calls it and falls back to the
59
+ * static built-in catalog via the block's manual `fragmentIds`.
60
+ */
61
+ export interface FragmentResolver {
62
+ resolveForRun(input: FragmentResolverInput): Promise<FragmentRunSelection>;
63
+ }
64
+ //# sourceMappingURL=fragment-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-selector.d.ts","sourceRoot":"","sources":["../../src/ports/fragment-selector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAgB9D,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE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
1
+ export {};
2
+ //# sourceMappingURL=fragment-selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragment-selector.js","sourceRoot":"","sources":["../../src/ports/fragment-selector.ts"],"names":[],"mappings":""}
@@ -0,0 +1,226 @@
1
+ import type { CommitFilesInput, GitHubBranch, GitHubCheckRun, GitHubCommit, GitHubIssue, GitHubPullRequest, GitHubRepo, MergePullRequestInput, OpenPullRequestInput } from '../domain/types.js';
2
+ export interface GitHubRepoRef {
3
+ owner: string;
4
+ repo: string;
5
+ }
6
+ /** A page of results plus the conditional-request ETag and a rate-limit reading. */
7
+ export interface Paged<T> {
8
+ items: T[];
9
+ /** ETag to store and replay as `If-None-Match` on the next conditional GET. */
10
+ etag?: string;
11
+ /** `true` when GitHub answered 304 Not Modified (items will be empty). */
12
+ notModified?: boolean;
13
+ rateLimit?: RateLimitSnapshot;
14
+ }
15
+ /** A single observation of GitHub's rate-limit headers for one call. */
16
+ export interface RateLimitSnapshot {
17
+ installationId: number;
18
+ /** e.g. 'core' / 'graphql' / 'search'. */
19
+ resource: string;
20
+ limit: number | null;
21
+ remaining: number | null;
22
+ /** When the window resets (epoch ms). */
23
+ resetAt: number | null;
24
+ observedAt: number;
25
+ }
26
+ export interface ListOptions {
27
+ /** ISO-8601 lower bound for delta listing (GitHub `since`). */
28
+ since?: string;
29
+ /** ETag from a prior response for a conditional request. */
30
+ etag?: string;
31
+ }
32
+ export interface CommitFilesResult {
33
+ /** SHA of the new commit. */
34
+ sha: string;
35
+ }
36
+ /** A single root-level entry of a repository's tree (file or directory). */
37
+ export interface RepoEntry {
38
+ /** Path relative to the repo root, e.g. `README.md` or `src`. */
39
+ path: string;
40
+ /** GitHub content type: `file` | `dir` | `symlink` | `submodule`. */
41
+ type: string;
42
+ }
43
+ /** A directory listing entry from the contents API, carrying the blob/tree sha. */
44
+ export interface RepoContentEntry {
45
+ /** Path relative to the repo root, e.g. `guidelines/backend.md`. */
46
+ path: string;
47
+ /** Base name, e.g. `backend.md`. */
48
+ name: string;
49
+ /** `file` | `dir` | `symlink` | `submodule`. */
50
+ type: string;
51
+ /** Blob sha (file) or tree sha (dir) — powers the cheap "changed?" check. */
52
+ sha: string;
53
+ }
54
+ /** A single file's decoded UTF-8 content plus its blob sha. */
55
+ export interface RepoFileContent {
56
+ content: string;
57
+ sha: string;
58
+ }
59
+ /** A single comment on an issue, as returned by {@link GitHubClient.getIssue}. */
60
+ export interface GitHubIssueComment {
61
+ /** Commenter login, or '' when unknown. */
62
+ author: string;
63
+ /** GitHub-supplied ISO creation timestamp. */
64
+ createdAt: string;
65
+ /** Comment body (GitHub Markdown, used as-is). */
66
+ body: string;
67
+ }
68
+ /**
69
+ * One issue's full content — body + recent comments + metadata — for linking an
70
+ * issue to a board block as agent context. Distinct from the lean
71
+ * {@link GitHubIssue} projection (which omits the body/comments): this is fetched
72
+ * on demand by the task-source provider, never bulk-synced.
73
+ */
74
+ export interface GitHubIssueDetail {
75
+ number: number;
76
+ title: string;
77
+ /** Workflow state, e.g. `open` / `closed`. */
78
+ state: string;
79
+ /** Canonical web URL (GitHub `html_url`). */
80
+ url: string;
81
+ /** Issue author login, or null when unknown. */
82
+ author: string | null;
83
+ /** Assignee login, or null when unassigned. */
84
+ assignee: string | null;
85
+ labels: string[];
86
+ /** Issue body (GitHub Markdown). */
87
+ body: string;
88
+ /** Comments oldest→newest. */
89
+ comments: GitHubIssueComment[];
90
+ }
91
+ /** A single hit from searching issues across an installation's repos. */
92
+ export interface GitHubIssueSearchHit {
93
+ owner: string;
94
+ repo: string;
95
+ number: number;
96
+ title: string;
97
+ /** Workflow state, e.g. `open` / `closed`. */
98
+ state: string;
99
+ /** Canonical web URL (GitHub `html_url`). */
100
+ url: string;
101
+ }
102
+ /** A single hit from code-searching an installation's repos for a file. */
103
+ export interface GitHubCodeSearchHit {
104
+ owner: string;
105
+ repo: string;
106
+ /** Path relative to the repo root, e.g. `docs/architecture.md`. */
107
+ path: string;
108
+ /** Canonical web URL of the file on its default branch. */
109
+ url: string;
110
+ }
111
+ /** Installation metadata captured at connect time (needs the app JWT). */
112
+ export interface InstallationMeta {
113
+ accountLogin: string;
114
+ targetType: 'Organization' | 'User';
115
+ /**
116
+ * Which configured App owns this installation (ADR 0005). The adapter probes
117
+ * the registered Apps to find the owner, so the binding records the App used
118
+ * for this installation's tokens.
119
+ */
120
+ appId: string;
121
+ }
122
+ /** One installation of the App, as listed via the app JWT (GET /app/installations). */
123
+ export interface InstallationSummary {
124
+ installationId: number;
125
+ accountLogin: string;
126
+ targetType: 'Organization' | 'User';
127
+ /** The installing account's avatar, for display in the connect picker. */
128
+ accountAvatarUrl: string | null;
129
+ }
130
+ export interface GitHubClient {
131
+ /** Fetch an installation's account login + type (used by the connect flow). */
132
+ getInstallation(installationId: number): Promise<InstallationMeta>;
133
+ /** List every installation of the App (used by the connect discovery picker). */
134
+ listInstallations(): Promise<InstallationSummary[]>;
135
+ /** List every repository the installation can access (for backfill/reconcile). */
136
+ listInstallationRepos(installationId: number): Promise<Paged<GitHubRepo>>;
137
+ getRepo(installationId: number, ref: GitHubRepoRef): Promise<GitHubRepo>;
138
+ listBranches(installationId: number, ref: GitHubRepoRef, etag?: string): Promise<Paged<GitHubBranch>>;
139
+ /**
140
+ * List a repository's root-level entries. Returns an empty array for an empty
141
+ * repository (GitHub answers 404 with no default branch there). Used by repo
142
+ * bootstrapping to tell an empty/boilerplate-only target from one with real
143
+ * content before it pushes the initial commit.
144
+ */
145
+ listRootEntries(installationId: number, ref: GitHubRepoRef): Promise<RepoEntry[]>;
146
+ /**
147
+ * List a directory's entries on a ref via the contents API, each with its blob
148
+ * (file) or tree (dir) sha. Returns `[]` for a missing path/empty repo (404).
149
+ * Used by the fragment library to read a repo of Markdown guidelines and detect
150
+ * which files changed since the last sync.
151
+ */
152
+ listDirectory(installationId: number, ref: GitHubRepoRef, path: string, gitRef?: string): Promise<RepoContentEntry[]>;
153
+ /** Read a file's decoded UTF-8 content + blob sha on a ref, or null if absent. */
154
+ getFileContent(installationId: number, ref: GitHubRepoRef, path: string, gitRef?: string): Promise<RepoFileContent | null>;
155
+ listPullRequests(installationId: number, ref: GitHubRepoRef, opts?: ListOptions): Promise<Paged<GitHubPullRequest>>;
156
+ listIssues(installationId: number, ref: GitHubRepoRef, opts?: ListOptions): Promise<Paged<GitHubIssue>>;
157
+ /**
158
+ * Fetch a single issue's full content (body + comments) for linking it to a
159
+ * board block as agent context. Throws (GitHubApiError) if the issue or repo
160
+ * is not visible to the installation.
161
+ */
162
+ getIssue(installationId: number, ref: GitHubRepoRef, issueNumber: number): Promise<GitHubIssueDetail>;
163
+ /**
164
+ * Search issues visible to the installation by free text. `query` is the raw
165
+ * GitHub search text; the adapter scopes it to issues (`is:issue`) and bounds
166
+ * the result count. Used by the GitHub-issues task source's search box.
167
+ */
168
+ searchIssues(installationId: number, query: string, limit?: number): Promise<GitHubIssueSearchHit[]>;
169
+ /**
170
+ * Code-search files visible to the installation. `query` is the raw GitHub
171
+ * code-search text and MUST already carry an `org:`/`user:`/`repo:` scope
172
+ * qualifier (GitHub's code-search API rejects unscoped queries); the caller
173
+ * builds it from the installation's account. Used by the GitHub repo-doc
174
+ * document source's search box.
175
+ */
176
+ searchCode(installationId: number, query: string, limit?: number): Promise<GitHubCodeSearchHit[]>;
177
+ listCommits(installationId: number, ref: GitHubRepoRef, opts?: ListOptions & {
178
+ sha?: string;
179
+ }): Promise<Paged<GitHubCommit>>;
180
+ listCheckRuns(installationId: number, ref: GitHubRepoRef, sha: string): Promise<Paged<GitHubCheckRun>>;
181
+ createBranch(installationId: number, ref: GitHubRepoRef, name: string, fromSha: string): Promise<void>;
182
+ /** Create a commit on a branch via the Git Data API (blob → tree → commit → ref). */
183
+ commitFiles(installationId: number, ref: GitHubRepoRef, input: CommitFilesInput): Promise<CommitFilesResult>;
184
+ /**
185
+ * Create an issue. Used by the recurring tech-debt pipeline's `tracker` step to
186
+ * file the issue it raises before implementation. Returns the new issue's number
187
+ * and canonical web URL.
188
+ */
189
+ createIssue(installationId: number, ref: GitHubRepoRef, input: {
190
+ title: string;
191
+ body: string;
192
+ }): Promise<{
193
+ number: number;
194
+ url: string;
195
+ }>;
196
+ openPullRequest(installationId: number, ref: GitHubRepoRef, input: OpenPullRequestInput): Promise<GitHubPullRequest>;
197
+ updatePullRequest(installationId: number, ref: GitHubRepoRef, number: number, patch: {
198
+ title?: string;
199
+ body?: string;
200
+ state?: 'open' | 'closed';
201
+ base?: string;
202
+ }): Promise<GitHubPullRequest>;
203
+ /**
204
+ * Read a PR's lazily-computed mergeability. GitHub computes `mergeable` /
205
+ * `mergeable_state` asynchronously, so `mergeable` is `null` until it is ready;
206
+ * `mergeableState === 'dirty'` is its signal that the PR conflicts with its base.
207
+ * `headSha` is the PR head commit (null when the PR can't be read).
208
+ */
209
+ getPullRequestMergeability(installationId: number, ref: GitHubRepoRef, number: number): Promise<{
210
+ mergeable: boolean | null;
211
+ mergeableState: string;
212
+ headSha: string | null;
213
+ }>;
214
+ mergePullRequest(installationId: number, ref: GitHubRepoRef, number: number, input?: MergePullRequestInput): Promise<void>;
215
+ /**
216
+ * Delete a branch (`heads/<branch>` ref). Used to tear down a work branch once its
217
+ * PR has merged, so a later re-run of the same task starts fresh from base instead
218
+ * of resuming on already-merged commits (which a squash/rebase merge would otherwise
219
+ * re-introduce, since those commits are not ancestors of base). Idempotent from the
220
+ * caller's view: a missing branch (already deleted) is not an error.
221
+ */
222
+ deleteBranch(installationId: number, ref: GitHubRepoRef, branch: string): Promise<void>;
223
+ /** Add a comment to an issue or pull request (they share the issue-comment API). */
224
+ comment(installationId: number, ref: GitHubRepoRef, issueOrPrNumber: number, body: string): Promise<void>;
225
+ }
226
+ //# sourceMappingURL=github-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-client.d.ts","sourceRoot":"","sources":["../../src/ports/github-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX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AM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,qBAAqB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB;;;;;;OAMG;IACH,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvF,oFAAoF;IACpF,OAAO,CACL,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,aAAa,EAClB,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=github-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-client.js","sourceRoot":"","sources":["../../src/ports/github-client.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The permissions an installation token was actually granted, as reported by
3
+ * `POST /app/installations/{id}/access_tokens`. This is the intersection of the
4
+ * App's requested permissions and what the installing account approved, so it —
5
+ * not the App's registration — is the source of truth for "can this credential
6
+ * do X". Values are GitHub's permission levels; an absent key means "not
7
+ * granted".
8
+ */
9
+ export interface InstallationPermissions {
10
+ /** Repository administration — required to create repositories. */
11
+ administration?: 'read' | 'write';
12
+ /** Organization-level administration, granted to some App profiles. */
13
+ organization_administration?: 'read' | 'write';
14
+ contents?: 'read' | 'write';
15
+ [permission: string]: 'read' | 'write' | 'admin' | undefined;
16
+ }
17
+ export interface CreateRepoInput {
18
+ /** The organization login to create the repository under. */
19
+ org: string;
20
+ name: string;
21
+ private?: boolean;
22
+ description?: string;
23
+ /** Seed the repo with an initial commit (so it has a default branch). */
24
+ autoInit?: boolean;
25
+ }
26
+ /** Identifying details of a freshly-created repository. */
27
+ export interface ProvisionedRepo {
28
+ githubId: number;
29
+ owner: string;
30
+ name: string;
31
+ defaultBranch: string | null;
32
+ private: boolean;
33
+ }
34
+ export interface GitHubProvisioningClient {
35
+ /**
36
+ * The permissions the installation token actually carries. Read this before a
37
+ * privileged action so the caller can choose a path (or refuse) without
38
+ * provoking a guaranteed 403.
39
+ */
40
+ getGrantedPermissions(installationId: number): Promise<InstallationPermissions>;
41
+ /**
42
+ * Create a repository under an organization. Requires the installation to hold
43
+ * `administration: write`; otherwise GitHub answers 403.
44
+ */
45
+ createRepoInOrg(installationId: number, input: CreateRepoInput): Promise<ProvisionedRepo>;
46
+ }
47
+ //# sourceMappingURL=github-provisioning.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-provisioning.d.ts","sourceRoot":"","sources":["../../src/ports/github-provisioning.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAuB;IACtC,mEAAmE;IACnE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACjC,uEAAuE;IACvE,2BAA2B,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;CAC7D;AAED,MAAM,WAAW,eAAe;IAC9B,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,2DAA2D;AAC3D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAA;IAC/E;;;OAGG;IACH,eAAe,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;CAC1F"}
@@ -0,0 +1,12 @@
1
+ // ---------------------------------------------------------------------------
2
+ // GitHubProvisioningClient port: the *privileged* slice of the GitHub REST API
3
+ // used to create repositories and to introspect what an installation may
4
+ // actually do. Deliberately separate from `GitHubClient` (the read/write slice
5
+ // every workspace uses) because repo creation needs the elevated
6
+ // `Administration: write` grant that only the privileged App tier carries — see
7
+ // ADR 0005. Splitting the port keeps the common client implementable without
8
+ // the elevated grant, and lets the provisioner reason about capability *before*
9
+ // it acts rather than discovering a 403 mid-flight.
10
+ // ---------------------------------------------------------------------------
11
+ export {};
12
+ //# sourceMappingURL=github-provisioning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-provisioning.js","sourceRoot":"","sources":["../../src/ports/github-provisioning.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,+EAA+E;AAC/E,yEAAyE;AACzE,+EAA+E;AAC/E,iEAAiE;AACjE,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAChF,oDAAoD;AACpD,8EAA8E"}
@@ -0,0 +1,136 @@
1
+ import type { GitHubBranch, GitHubCheckRun, GitHubCommit, GitHubIssue, GitHubPullRequest, GitHubRepo } from '../domain/types.js';
2
+ import type { RateLimitSnapshot } from './github-client.js';
3
+ /**
4
+ * A GitHub App installation binding. An installation is bound to an *account*
5
+ * (migration 0017), so every workspace in that account shares it; `workspaceId`
6
+ * records the workspace that connected it (and is the binding key on the
7
+ * auth-disabled path, where `accountId` is null). The token fields are
8
+ * infrastructure detail (never sent on the wire); they live here so the auth
9
+ * adapter can read/write the cache in the same row.
10
+ */
11
+ export interface GitHubInstallation {
12
+ installationId: number;
13
+ workspaceId: string;
14
+ /** The account this installation is bound to, or null on the auth-disabled path. */
15
+ accountId: string | null;
16
+ accountLogin: string;
17
+ targetType: 'Organization' | 'User';
18
+ /**
19
+ * Which GitHub App registration owns this installation (ADR 0005). null for
20
+ * rows created before the multi-App tier — treated as the default App. An
21
+ * installation id belongs to exactly one App on GitHub, so this is immutable.
22
+ */
23
+ appId: string | null;
24
+ /** Cached installation access token, or null if none/expired. */
25
+ cachedToken: string | null;
26
+ /** Token expiry (epoch ms), or null. */
27
+ tokenExpiresAt: number | null;
28
+ createdAt: number;
29
+ /** Set when the installation is suspended/uninstalled (tombstone). */
30
+ deletedAt: number | null;
31
+ }
32
+ export interface GitHubInstallationRepository {
33
+ getByInstallationId(installationId: number): Promise<GitHubInstallation | null>;
34
+ /**
35
+ * The installation backing a workspace: its own direct binding, or one shared
36
+ * via its account. Returns null when neither exists or is tombstoned.
37
+ */
38
+ getByWorkspace(workspaceId: string): Promise<GitHubInstallation | null>;
39
+ /**
40
+ * Every workspace that an installation's webhooks should fan out to: the
41
+ * connector workspace plus all workspaces in the installation's account.
42
+ */
43
+ listWorkspacesForInstallation(installationId: number): Promise<string[]>;
44
+ /** List every live installation across accounts (used by the cron pass). */
45
+ listActive(): Promise<GitHubInstallation[]>;
46
+ upsert(installation: GitHubInstallation): Promise<void>;
47
+ updateCachedToken(installationId: number, token: string, expiresAt: number): Promise<void>;
48
+ softDelete(installationId: number, at: number): Promise<void>;
49
+ }
50
+ /** Which entity kind a sync cursor tracks for a repo. */
51
+ export type SyncCursorKind = 'branches' | 'pulls' | 'issues' | 'commits' | 'checks';
52
+ export interface SyncCursor {
53
+ etag: string | null;
54
+ lastSyncedAt: number | null;
55
+ sinceIso: string | null;
56
+ }
57
+ /** A repo whose projection has gone stale and should be reconciled. */
58
+ export interface StaleRepoRef {
59
+ workspaceId: string;
60
+ githubId: number;
61
+ installationId: number;
62
+ owner: string;
63
+ name: string;
64
+ }
65
+ export interface RepoProjectionRepository {
66
+ upsertMany(workspaceId: string, repos: GitHubRepo[]): Promise<void>;
67
+ list(workspaceId: string): Promise<GitHubRepo[]>;
68
+ get(workspaceId: string, githubId: number): Promise<GitHubRepo | null>;
69
+ /** Tombstone repos for this installation whose id is not in `seenGithubIds`. */
70
+ tombstoneMissing(workspaceId: string, installationId: number, seenGithubIds: number[], at: number): Promise<void>;
71
+ /** Link a projected repo to a board block (does not touch other fields). */
72
+ linkBlock(workspaceId: string, githubId: number, blockId: string | null): Promise<void>;
73
+ /**
74
+ * Flag (or unflag) a projected repo as a monorepo (does not touch other fields).
75
+ * Like {@link RepoProjectionRepository.linkBlock} this is board-owned state that
76
+ * sync preserves rather than overwrites.
77
+ */
78
+ setMonorepo(workspaceId: string, githubId: number, isMonorepo: boolean): Promise<void>;
79
+ /** Live repos whose `synced_at` is older than the cutoff, across all workspaces. */
80
+ listStale(olderThanEpochMs: number): Promise<StaleRepoRef[]>;
81
+ /**
82
+ * Of the given candidate workspaces, those that currently link this repo — a single
83
+ * (chunked) query backing the sync fan-out (which workspaces a one-per-org fetch must
84
+ * update), instead of one `get` per candidate. Empty input → empty result.
85
+ */
86
+ linkedWorkspaces(repoGithubId: number, candidateWorkspaceIds: string[]): Promise<string[]>;
87
+ /**
88
+ * Incremental-sync cursors are keyed by **installation** + repo (not workspace):
89
+ * a repo is fetched from GitHub once per org and the result fanned out to every
90
+ * workspace that links it, so two teams sharing a repo don't each burn an API
91
+ * round-trip. See {@link GitHubSyncService}.
92
+ */
93
+ getCursor(installationId: number, repoGithubId: number, kind: SyncCursorKind): Promise<SyncCursor | null>;
94
+ setCursor(installationId: number, repoGithubId: number, kind: SyncCursorKind, cursor: SyncCursor): Promise<void>;
95
+ }
96
+ export interface BranchProjectionRepository {
97
+ upsertMany(workspaceId: string, branches: GitHubBranch[]): Promise<void>;
98
+ listByRepo(workspaceId: string, repoGithubId: number): Promise<GitHubBranch[]>;
99
+ }
100
+ export interface PullRequestProjectionRepository {
101
+ upsertMany(workspaceId: string, pulls: GitHubPullRequest[]): Promise<void>;
102
+ listByRepo(workspaceId: string, repoGithubId: number): Promise<GitHubPullRequest[]>;
103
+ listByWorkspace(workspaceId: string): Promise<GitHubPullRequest[]>;
104
+ }
105
+ export interface IssueProjectionRepository {
106
+ upsertMany(workspaceId: string, issues: GitHubIssue[]): Promise<void>;
107
+ listByRepo(workspaceId: string, repoGithubId: number): Promise<GitHubIssue[]>;
108
+ listByWorkspace(workspaceId: string): Promise<GitHubIssue[]>;
109
+ }
110
+ export interface CommitProjectionRepository {
111
+ upsertMany(workspaceId: string, commits: GitHubCommit[]): Promise<void>;
112
+ listByRepo(workspaceId: string, repoGithubId: number, limit?: number): Promise<GitHubCommit[]>;
113
+ /**
114
+ * Retention: delete commits authored before `epochMs` (exclusive), returning
115
+ * how many were removed. Unlike the other projections this table has no
116
+ * `deleted_at` tombstone and grows step-wise during backfills, so a periodic
117
+ * pass reclaims old rows (the backfill is bounded to the same horizon, so it
118
+ * won't re-fetch what this prunes). Rows with no `authored_at` are kept.
119
+ */
120
+ deleteOlderThan(epochMs: number): Promise<number>;
121
+ }
122
+ export interface CheckRunProjectionRepository {
123
+ upsertMany(workspaceId: string, checks: GitHubCheckRun[]): Promise<void>;
124
+ listBySha(workspaceId: string, repoGithubId: number, headSha: string): Promise<GitHubCheckRun[]>;
125
+ }
126
+ export interface RateLimitRepository {
127
+ /** Append one observed rate-limit snapshot (best-effort; never throws fatally). */
128
+ record(snapshot: RateLimitSnapshot): Promise<void>;
129
+ /**
130
+ * Retention: delete snapshots observed before `epochMs` (exclusive), returning
131
+ * how many were removed. This is pure operational telemetry whose only consumer
132
+ * cares about recent headroom, so it gets the most aggressive retention window.
133
+ */
134
+ deleteOlderThan(epochMs: number): Promise<number>;
135
+ }
136
+ //# sourceMappingURL=github-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/github-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,WAAW,EACX,iBAAi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O,CAAC,IAAI,CAAC,CAAA;IACrE,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;IAC7E,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;CAC7D;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACvE,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IAC9F;;;;;;OAMG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,4BAA4B;IAC3C,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxE,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAA;CACjG;AAED,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=github-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-repositories.js","sourceRoot":"","sources":["../../src/ports/github-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ export interface IncidentMatchQuery {
2
+ workspaceId: string;
3
+ /**
4
+ * The monitor/SLO ids the regression fired on. A provider PREFERS an active incident
5
+ * whose text references one of these (the precise match), falling back to the most
6
+ * recent active incident in the window when none reference a signal (these systems
7
+ * don't reliably carry the originating monitor id).
8
+ */
9
+ signalIds: string[];
10
+ /** Release marker time (epoch ms); only incidents active since then match. */
11
+ since: number;
12
+ }
13
+ /** The investigation update posted onto a matched incident. */
14
+ export interface IncidentUpdate {
15
+ /** Short headline. */
16
+ title: string;
17
+ /** Markdown investigation summary (suspect PR, evidence, recommendation). */
18
+ body: string;
19
+ /** Web URL of the suspect PR, when known. */
20
+ prUrl?: string;
21
+ }
22
+ export interface IncidentEnrichmentProvider {
23
+ /**
24
+ * Find the active incident matching the regression and post the investigation update
25
+ * onto it, atomically per provider. A no-op when no matching incident exists. Should
26
+ * never throw for an expected miss; the caller treats any throw as best-effort.
27
+ */
28
+ enrich(query: IncidentMatchQuery, update: IncidentUpdate): Promise<void>;
29
+ }
30
+ /**
31
+ * Fans an enrichment out across several providers (PagerDuty + incident.io). Each is
32
+ * matched + posted independently and isolated: one provider throwing (or not matching)
33
+ * never blocks the others.
34
+ */
35
+ export declare class CompositeIncidentEnrichmentProvider implements IncidentEnrichmentProvider {
36
+ private readonly providers;
37
+ constructor(providers: IncidentEnrichmentProvider[]);
38
+ enrich(query: IncidentMatchQuery, update: IncidentUpdate): Promise<void>;
39
+ }
40
+ //# sourceMappingURL=incident-enrichment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incident-enrichment.d.ts","sourceRoot":"","sources":["../../src/ports/incident-enrichment.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAA;CACd;AAED,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACzE;AAED;;;;GAIG;AACH,qBAAa,mCAAoC,YAAW,0BAA0B;IACxE,OAAO,CAAC,QAAQ,CAAC,SAAS;IAAtC,YAA6B,SAAS,EAAE,0BAA0B,EAAE,EAAI;IAElE,MAAM,CAAC,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAU7E;CACF"}
@@ -0,0 +1,30 @@
1
+ // Optional port for ENRICHING (not creating) an incident that an external
2
+ // incident-management system (PagerDuty / incident.io) already opened from the
3
+ // same Datadog monitors/SLOs the post-release-health gate watches. On a regression
4
+ // the on-call agent's investigation is posted onto that incident so responders see
5
+ // "which PR, what evidence, recommended action" — the one thing those systems can't
6
+ // derive themselves. Best-effort: a missing/unmatched incident is a no-op, never
7
+ // blocking the run or the in-app notification. NOT a notification channel: those
8
+ // systems already page off the same signals, so re-alerting them would duplicate.
9
+ /**
10
+ * Fans an enrichment out across several providers (PagerDuty + incident.io). Each is
11
+ * matched + posted independently and isolated: one provider throwing (or not matching)
12
+ * never blocks the others.
13
+ */
14
+ export class CompositeIncidentEnrichmentProvider {
15
+ providers;
16
+ constructor(providers) {
17
+ this.providers = providers;
18
+ }
19
+ async enrich(query, update) {
20
+ await Promise.all(this.providers.map(async (provider) => {
21
+ try {
22
+ await provider.enrich(query, update);
23
+ }
24
+ catch {
25
+ // best-effort: isolate each provider
26
+ }
27
+ }));
28
+ }
29
+ }
30
+ //# sourceMappingURL=incident-enrichment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"incident-enrichment.js","sourceRoot":"","sources":["../../src/ports/incident-enrichment.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,+EAA+E;AAC/E,mFAAmF;AACnF,mFAAmF;AACnF,oFAAoF;AACpF,iFAAiF;AACjF,iFAAiF;AACjF,kFAAkF;AAkClF;;;;GAIG;AACH,MAAM,OAAO,mCAAmC;IACjB,SAAS;IAAtC,YAA6B,SAAuC;yBAAvC,SAAS;IAAiC,CAAC;IAExE,KAAK,CAAC,MAAM,CAAC,KAAyB,EAAE,MAAsB;QAC5D,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;YACpC,IAAI,CAAC;gBACH,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACtC,CAAC;YAAC,MAAM,CAAC;gBACP,qCAAqC;YACvC,CAAC;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;CACF"}