@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 @@
1
+ {"version":3,"file":"account-repositories.js","sourceRoot":"","sources":["../../src/ports/account-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,361 @@
1
+ import type { AgentConfigValues, AgentKind, BlockType, CloudProvider, ConsensusStepConfig, EnvironmentAccessHandle, EnvironmentStatus, InstanceSize, PullRequestRef, StepSubtasks, TaskEstimate } from '../domain/types.js';
2
+ export interface AgentRunContext {
3
+ agentKind: AgentKind;
4
+ pipelineName: string;
5
+ /**
6
+ * The workspace and execution the step belongs to. The engine always sets
7
+ * these; they are optional on the type so existing fakes that hand-build a
8
+ * context stay valid. Executors that reach beyond the LLM — e.g. the container
9
+ * executor that clones the workspace's repo and meters spend through a proxy —
10
+ * require them and fail fast when absent.
11
+ */
12
+ workspaceId?: string;
13
+ executionId?: string;
14
+ /**
15
+ * Internal user id (`usr_*`) of whoever started/retried this run. Set by the engine
16
+ * from the run's `initiatedBy`. The container executor uses it to lease the
17
+ * initiator's OWN personal (individual-usage) subscription — e.g. Claude — for the
18
+ * step, since such a credential is never shared. Absent for runs started without a
19
+ * signed-in user.
20
+ */
21
+ initiatedByUserId?: string;
22
+ /** Index of this step within the pipeline. */
23
+ stepIndex: number;
24
+ /** Whether this is the pipeline's last step (drives task finalisation). */
25
+ isFinalStep: boolean;
26
+ /**
27
+ * Consensus configuration for this step, when it is consensus-enabled in the
28
+ * pipeline (copied from the pipeline's `consensus` array onto the run's step).
29
+ * Read ONLY by the optional consensus executor (`@cat-factory/consensus`), which
30
+ * decides — possibly gated on `block.estimate` — whether to run the multi-model
31
+ * process or delegate to the standard single-actor agent. Absent ⇒ standard agent.
32
+ */
33
+ consensus?: ConsensusStepConfig | null;
34
+ block: {
35
+ /** Stable block id (set by the engine; used by repo-aware executors). */
36
+ id?: string;
37
+ title: string;
38
+ type: BlockType;
39
+ description: string;
40
+ /** Ids of selected best-practice fragments to fold into the system prompt. */
41
+ fragmentIds?: string[];
42
+ /**
43
+ * Fragment bodies the engine pre-resolved from the tenant fragment-library
44
+ * (the merged catalog + relevance selection; ADR 0006). When present these
45
+ * are folded into the system prompt verbatim, superseding `fragmentIds`'
46
+ * static resolution. Absent when the library module is not configured.
47
+ */
48
+ resolvedFragments?: {
49
+ id: string;
50
+ body: string;
51
+ }[];
52
+ /** Id of the model picked for this block (overrides the agent routing), if any. */
53
+ modelId?: string;
54
+ /**
55
+ * Requirements/RFC/PRD pages linked to this block from Confluence, supplied
56
+ * as extra context. Present only when the Confluence integration is wired and
57
+ * the block has linked documents.
58
+ */
59
+ contextDocs?: {
60
+ title: string;
61
+ url: string;
62
+ excerpt: string;
63
+ }[];
64
+ /**
65
+ * Tracker issues (Jira, …) linked to this block, supplied as extra context.
66
+ * Present only when the task-source integration is wired and the block has
67
+ * linked issues. Carries the structured fields so the prompt can render a
68
+ * status/assignee header alongside the description and recent comments.
69
+ */
70
+ contextTasks?: {
71
+ key: string;
72
+ url: string;
73
+ title: string;
74
+ status: string;
75
+ type: string;
76
+ assignee: string | null;
77
+ priority: string | null;
78
+ labels: string[];
79
+ description: string;
80
+ comments: {
81
+ author: string;
82
+ createdAt: string;
83
+ body: string;
84
+ }[];
85
+ }[];
86
+ /**
87
+ * Task-level configuration values contributed by the agents in this task's
88
+ * pipeline (a sparse id→value map; see the agent-config contracts). Folded
89
+ * into the relevant agents' prompts and job bodies — e.g. the Tester reads
90
+ * `tester.environment` (local vs ephemeral) and the Playwright agent reads
91
+ * `playwright.e2eTarget` (ci vs ephemeral). Absent when nothing is set.
92
+ */
93
+ agentConfig?: AgentConfigValues;
94
+ /**
95
+ * A pull request already opened for this block (e.g. by an earlier `coder`
96
+ * step in the same run). The Blueprinter step reads its `branch` so it commits
97
+ * the regenerated blueprint onto the implementation's branch rather than a new
98
+ * one. Absent until a step records a PR.
99
+ */
100
+ pullRequest?: PullRequestRef;
101
+ /**
102
+ * The task-estimator's triage of this block (complexity / risk / impact), when
103
+ * a `task-estimator` step has run earlier in the pipeline. Read by the consensus
104
+ * executor to gate the (expensive) multi-model process against the step's
105
+ * configured thresholds. Absent until an estimate has been produced.
106
+ */
107
+ estimate?: TaskEstimate | null;
108
+ };
109
+ /** Outputs produced by earlier steps in the same run, in order. */
110
+ priorOutputs: {
111
+ agentKind: AgentKind;
112
+ output: string;
113
+ }[];
114
+ /** Decisions resolved earlier in this run, for context. */
115
+ decisions: {
116
+ question: string;
117
+ chosen: string;
118
+ }[];
119
+ /**
120
+ * A live ephemeral environment a deployer step provisioned earlier in this run
121
+ * (resolved from the run's block). Present only when the environment
122
+ * integration is wired and a deployer step has produced a ready environment —
123
+ * this is how a downstream tester agent discovers the URL and how to reach it.
124
+ */
125
+ environment?: {
126
+ url: string | null;
127
+ status: EnvironmentStatus;
128
+ access: EnvironmentAccessHandle | null;
129
+ expiresAt: number | null;
130
+ };
131
+ /**
132
+ * Service-level (frame) configuration resolved by the engine from this run's
133
+ * service frame. Carries what the Tester's local-infra path and the
134
+ * provisioning layer need: the docker-compose path to stand up dependencies (or
135
+ * the explicit "no infra" flag), and the cloud provider + abstract instance size
136
+ * the dispatch resolves to a concrete instance-type id. Absent when no service
137
+ * frame applies.
138
+ */
139
+ service?: {
140
+ testComposePath?: string;
141
+ noInfraDependencies?: boolean;
142
+ cloudProvider?: CloudProvider;
143
+ instanceSize?: InstanceSize;
144
+ };
145
+ /**
146
+ * If this step previously raised a decision that a human has now resolved,
147
+ * the resolved decision — so the agent can finish instead of re-raising it.
148
+ */
149
+ resolvedDecision: {
150
+ question: string;
151
+ chosen: string;
152
+ } | null;
153
+ /**
154
+ * When a human reviewed this step's gated proposal and requested changes, the
155
+ * previous proposal plus their feedback. Present only on a re-run triggered by
156
+ * "Request changes"; the agent should revise its previous proposal to address
157
+ * the feedback rather than start from scratch. `comments` are GitHub-review-style
158
+ * notes on specific blocks of the proposal (a human review carries the verbatim
159
+ * `quotedSource` it targets; a companion's anchor-based comment omits it), folded
160
+ * into the prompt alongside the freeform `feedback`.
161
+ */
162
+ revision?: {
163
+ previousProposal: string;
164
+ feedback: string;
165
+ comments?: {
166
+ quotedSource?: string;
167
+ body: string;
168
+ }[];
169
+ };
170
+ }
171
+ /** A point at which the agent needs a human to choose before continuing. */
172
+ export interface AgentDecisionRequest {
173
+ question: string;
174
+ options: string[];
175
+ }
176
+ /** Token usage reported by the model for a single agent call. */
177
+ export interface AgentTokenUsage {
178
+ inputTokens: number;
179
+ outputTokens: number;
180
+ }
181
+ export interface AgentRunResult {
182
+ /** The agent's work product. Required unless `decision` is set. */
183
+ output?: string;
184
+ /** Identifier of the model that produced the output, for transparency. */
185
+ model?: string;
186
+ /** Ask a human to decide before this step can complete. */
187
+ decision?: AgentDecisionRequest;
188
+ /** Confidence in the result (0..1); used at task completion to auto-merge. */
189
+ confidence?: number;
190
+ /**
191
+ * A pull request the agent opened for its work. Reported by repo-operating
192
+ * executors (the container "implementer" agent, which pushes a branch and opens
193
+ * a PR); the engine records it on the block so the board can link to it.
194
+ */
195
+ pullRequest?: PullRequestRef;
196
+ /**
197
+ * The service → modules blueprint tree a Blueprinter step produced.
198
+ * The engine strictly validates it and reconciles it onto the board (in place).
199
+ * Carried as `unknown` so the core port stays free of the contracts schema; the
200
+ * engine parses it with the authoritative Valibot schema before use.
201
+ */
202
+ blueprintService?: unknown;
203
+ /**
204
+ * The unified, prescriptive specification doc a `spec-writer` step produced and
205
+ * committed to the implementation branch (the `spec.json` tree). The engine
206
+ * strictly validates it (against the contracts schema) and may surface it on the
207
+ * board. Carried as `unknown` so the core port stays free of the contracts schema;
208
+ * the engine parses it before use.
209
+ */
210
+ spec?: unknown;
211
+ /**
212
+ * A `merger` step's structured PR assessment (complexity / risk / impact +
213
+ * rationale). The engine validates it, compares the scores against the task's
214
+ * resolved merge preset, and either performs a real GitHub merge or raises a
215
+ * `merge_review` notification. Carried as `unknown` so the port stays free of
216
+ * the contracts schema; the engine parses it before use.
217
+ */
218
+ mergeAssessment?: unknown;
219
+ /**
220
+ * A `tester` step's structured test report (what was exercised, the per-area
221
+ * outcomes, any concerns/bugs, and the greenlight verdict). The engine validates
222
+ * it and, when the Tester withholds its greenlight, dispatches the `fixer` agent
223
+ * and re-tests — looping until greenlight or the attempt budget is spent. Carried
224
+ * as `unknown` so the port stays free of the contracts schema; the engine parses
225
+ * it before use.
226
+ */
227
+ testReport?: unknown;
228
+ /**
229
+ * An `on-call` step's structured release-regression assessment (culprit confidence,
230
+ * recommendation, rationale, evidence). The post-release-health gate dispatched the
231
+ * agent on a Datadog regression; the engine validates this, raises a
232
+ * `release_regression` notification and enriches any open incident. Carried as
233
+ * `unknown` so the port stays free of the contracts schema; the engine parses it.
234
+ */
235
+ onCallAssessment?: unknown;
236
+ /**
237
+ * Tokens the model consumed for this call. Reported by inline LLM executors so
238
+ * the spend safeguard can meter usage; absent for the container executor (whose
239
+ * proxy meters tokens itself, to avoid double-counting) and test fakes.
240
+ */
241
+ usage?: AgentTokenUsage;
242
+ }
243
+ export interface AgentExecutor {
244
+ run(context: AgentRunContext): Promise<AgentRunResult>;
245
+ /**
246
+ * Resolve the concrete model this step will run (`provider:model`) WITHOUT doing
247
+ * the work — no LLM call, no container dispatch. The engine calls it up front so a
248
+ * step's model can be surfaced to the board the moment the step starts (during the
249
+ * inline LLM query, or the container cold-boot window) rather than only once the
250
+ * result/job handle lands. Must be cheap and side-effect-free (model-ref resolution
251
+ * only). Optional: an executor that can't cheaply preview omits it, and the engine
252
+ * simply records the model later. Returns undefined when no model applies.
253
+ */
254
+ resolveModel?(context: AgentRunContext): Promise<string | undefined>;
255
+ /**
256
+ * Whether this step will run on a flat-rate subscription (quota) model — i.e. a
257
+ * Claude Code / Codex harness authenticated with a pooled subscription token. Such
258
+ * runs incur NO metered monetary LLM cost (their usage is folded into a quota, not
259
+ * the spend budget), so the engine's spend gate lets them proceed even when the
260
+ * monetary budget is exhausted. Must be cheap and side-effect-free (model-ref
261
+ * resolution only). Optional: an executor without subscription harnesses omits it
262
+ * and the engine treats every step as budget-metered (the prior behaviour).
263
+ */
264
+ isQuotaBased?(context: AgentRunContext): Promise<boolean>;
265
+ }
266
+ /** A handle to an asynchronous agent job (e.g. a long-running container run). */
267
+ export interface AgentJobHandle {
268
+ /** Opaque identifier the executor uses to address the running job when polled. */
269
+ jobId: string;
270
+ /**
271
+ * The run (execution) the job belongs to. A run executes a sequence of jobs (one
272
+ * per pipeline step) that share one per-run container, so the poll/stop site needs
273
+ * the run id — alongside the per-step {@link jobId} — to address that container
274
+ * (and to reclaim it). Set by the executor at dispatch and re-supplied by the
275
+ * engine at the poll/stop site (it always has the execution id in scope). Absent ⇒
276
+ * the job IS its own run (a single-job flow), so callers fall back to {@link jobId}.
277
+ */
278
+ runId?: string;
279
+ /**
280
+ * The model the job runs (`provider:model`), known at dispatch. Recorded on the
281
+ * step immediately so the board shows it even though the poll site — which maps
282
+ * the eventual result — has no access to the resolved model ref.
283
+ */
284
+ model?: string;
285
+ /**
286
+ * The workspace the job belongs to. The engine sets this at the poll site (it is
287
+ * in scope there) so an executor that picks a per-workspace backend — e.g. the
288
+ * container executor choosing a self-hosted runner pool over Cloudflare
289
+ * Containers — can resolve the same backend when polling, given only the job id.
290
+ */
291
+ workspaceId?: string;
292
+ /**
293
+ * For a subscription-harness job, the id of the pooled token leased for it, so
294
+ * the poll site can attribute the run's usage back to the right pool row
295
+ * (usage-aware rotation). Absent for proxy-metered Pi jobs.
296
+ */
297
+ subscriptionTokenId?: string;
298
+ /**
299
+ * The agent kind the job runs as (`coder`, `merger`, …). Carried so the poll site
300
+ * can label the job's tool spans when forwarding them to the observability trace
301
+ * sink. Optional — absent ⇒ spans are still grouped under the run, just unlabelled.
302
+ */
303
+ agentKind?: string;
304
+ }
305
+ /** The outcome of polling an {@link AgentJobHandle}. */
306
+ export type AgentJobUpdate =
307
+ /**
308
+ * Still working — the durable driver should keep polling. `subtasks`, when
309
+ * present, carries the job's latest subtask counts (the container agent reads
310
+ * these from the coding tool's todo list) so the driver can surface live
311
+ * "N/M done" progress on the step between polls.
312
+ */
313
+ {
314
+ state: 'running';
315
+ subtasks?: StepSubtasks;
316
+ }
317
+ /** Finished successfully; `result` carries the work product. */
318
+ | {
319
+ state: 'done';
320
+ result: AgentRunResult;
321
+ }
322
+ /** Finished with a failure (agent error, inactivity/max-duration watchdog, …). */
323
+ | {
324
+ state: 'failed';
325
+ error: string;
326
+ };
327
+ /**
328
+ * An executor whose work can outlive a single request. Instead of `run()`
329
+ * blocking until the work finishes — which would cap the work at one durable
330
+ * step's timeout — the driver {@link startJob}s it and then {@link pollJob}s for
331
+ * completion between durable sleeps. This lets a long coding job run for many
332
+ * minutes while every individual driver step stays short and cheaply retriable.
333
+ *
334
+ * Implemented by the container executor (whose Pi coding run can take a long
335
+ * time); inline LLM executors stay plain {@link AgentExecutor}s and run in one
336
+ * shot. `run()` remains available (it dispatches then polls internally) for
337
+ * non-durable callers and tests.
338
+ */
339
+ export interface AsyncAgentExecutor extends AgentExecutor {
340
+ /** Whether `context` should be driven as a polled job rather than run inline. */
341
+ runsAsync(context: AgentRunContext): boolean;
342
+ /**
343
+ * Start the job for `context`, or re-attach to one already running for it. Must
344
+ * be idempotent per execution so a replayed dispatch never starts a duplicate.
345
+ */
346
+ startJob(context: AgentRunContext): Promise<AgentJobHandle>;
347
+ /** Poll a previously-started job for its current state. */
348
+ pollJob(handle: AgentJobHandle): Promise<AgentJobUpdate>;
349
+ /**
350
+ * Best-effort: stop a running job and reclaim its backing resources (e.g. kill
351
+ * the per-run container), so a user cancel / block delete / orphan sweep does not
352
+ * leak a container that idles until its watchdog. Optional — backends with
353
+ * nothing to reclaim may omit it; callers must treat it as best-effort and must
354
+ * not let a failure here derail their own teardown. Idempotent: stopping an
355
+ * already-gone job is a no-op.
356
+ */
357
+ stopJob?(handle: AgentJobHandle): Promise<void>;
358
+ }
359
+ /** Narrow an executor to the async-capable interface. */
360
+ export declare function isAsyncAgentExecutor(executor: AgentExecutor): executor is AsyncAgentExecutor;
361
+ //# sourceMappingURL=agent-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.d.ts","sourceRoot":"","sources":["../../src/ports/agent-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACb,MAAM,oBAAoB,CAAA;AAW3B,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,SAAS,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAA;IACj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ACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wDAAwD;AACxD,MAAM,MAAM,cAAc;AACxB;;;;;GAKG;AACD;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;CAAE;AAC/C,gEAAgE;GAC9D;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE;AAC3C,kFAAkF;GAChF;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,iFAAiF;IACjF,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAA;IAC5C;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IAC3D,2DAA2D;IAC3D,OAAO,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IACxD;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAChD;AAED,yDAAyD;AACzD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,GAAG,QAAQ,IAAI,kBAAkB,CAO5F"}
@@ -0,0 +1,8 @@
1
+ /** Narrow an executor to the async-capable interface. */
2
+ export function isAsyncAgentExecutor(executor) {
3
+ const candidate = executor;
4
+ return (typeof candidate.runsAsync === 'function' &&
5
+ typeof candidate.startJob === 'function' &&
6
+ typeof candidate.pollJob === 'function');
7
+ }
8
+ //# sourceMappingURL=agent-executor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-executor.js","sourceRoot":"","sources":["../../src/ports/agent-executor.ts"],"names":[],"mappings":"AAoWA,yDAAyD;AACzD,MAAM,UAAU,oBAAoB,CAAC,QAAuB;IAC1D,MAAM,SAAS,GAAG,QAAuC,CAAA;IACzD,OAAO,CACL,OAAO,SAAS,CAAC,SAAS,KAAK,UAAU;QACzC,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU;QACxC,OAAO,SAAS,CAAC,OAAO,KAAK,UAAU,CACxC,CAAA;AACH,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { AgentRunKind } from '../domain/types.js';
2
+ /**
3
+ * A lightweight, kind-tagged reference to an entry in the unified `agent_runs`
4
+ * table. Used by cross-kind machinery — the cron sweeper (re-drive any stale run
5
+ * via the right durable workflow) and the unified retry endpoint (dispatch to the
6
+ * right service) — without coupling them to either flow's full record shape.
7
+ */
8
+ export interface AgentRunRef {
9
+ workspaceId: string;
10
+ id: string;
11
+ kind: AgentRunKind;
12
+ }
13
+ /**
14
+ * Read-only, kind-spanning view over `agent_runs`. The per-flow repositories
15
+ * ({@link ExecutionRepository}, BootstrapJobRepository) own writes scoped to their
16
+ * own kind; this port answers the two questions that span both kinds.
17
+ */
18
+ export interface AgentRunRepository {
19
+ /** The kind of a run (to dispatch a retry), or null if no such run exists. */
20
+ getRef(workspaceId: string, id: string): Promise<AgentRunRef | null>;
21
+ /**
22
+ * Runs of any kind still marked `running` whose lease (`updated_at`) is older
23
+ * than the given epoch-ms cutoff — candidates the durable driver may have
24
+ * dropped. Spans all workspaces so a single cron pass repairs the whole system.
25
+ */
26
+ listStale(olderThanEpochMs: number): Promise<AgentRunRef[]>;
27
+ }
28
+ //# sourceMappingURL=agent-runs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runs.d.ts","sourceRoot":"","sources":["../../src/ports/agent-runs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,YAAY,CAAA;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACpE;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;CAC5D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=agent-runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runs.js","sourceRoot":"","sources":["../../src/ports/agent-runs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { AddFrameInput, AddModuleInput, AddTaskInput, UpdateBlockInput } from '@cat-factory/contracts';
2
+ import type { Block } from '../domain/types.js';
3
+ /**
4
+ * The write-side board operations needed by integration packages (e.g.
5
+ * DocumentLinkService) that materialise external structure onto the board.
6
+ * A narrow port so the integrations package does not depend on the full
7
+ * BoardService class.
8
+ */
9
+ export interface BoardWritePort {
10
+ addFrame(workspaceId: string, input: AddFrameInput): Promise<Block>;
11
+ addModule(workspaceId: string, frameId: string, input: AddModuleInput): Promise<Block>;
12
+ addTask(workspaceId: string, containerId: string, input: AddTaskInput, createdBy?: string | null): Promise<Block>;
13
+ updateBlock(workspaceId: string, blockId: string, patch: UpdateBlockInput): Promise<Block>;
14
+ }
15
+ //# sourceMappingURL=board-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-operations.d.ts","sourceRoot":"","sources":["../../src/ports/board-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,YAAY,EACZ,gBAAgB,EACjB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IACnE,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IACtF,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,YAAY,EACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GACxB,OAAO,CAAC,KAAK,CAAC,CAAA;IACjB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;CAC3F"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=board-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-operations.js","sourceRoot":"","sources":["../../src/ports/board-operations.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { BlueprintService, BlueprintSource } from '../domain/types.js';
2
+ /** A persisted repository blueprint (the decomposition tree, projected locally). */
3
+ export interface RepoBlueprintRecord {
4
+ id: string;
5
+ workspaceId: string;
6
+ repoOwner: string;
7
+ repoName: string;
8
+ source: BlueprintSource;
9
+ /** The service → modules tree. */
10
+ service: BlueprintService;
11
+ createdAt: number;
12
+ updatedAt: number;
13
+ }
14
+ export interface RepoBlueprintRepository {
15
+ /** Insert or replace the blueprint for this (workspace, repo). */
16
+ upsert(record: RepoBlueprintRecord): Promise<void>;
17
+ get(workspaceId: string, id: string): Promise<RepoBlueprintRecord | null>;
18
+ /** The current blueprint for a repo, if one has been scanned. */
19
+ getByRepo(workspaceId: string, repoOwner: string, repoName: string): Promise<RepoBlueprintRecord | null>;
20
+ listByWorkspace(workspaceId: string): Promise<RepoBlueprintRecord[]>;
21
+ delete(workspaceId: string, id: string): Promise<void>;
22
+ }
23
+ //# sourceMappingURL=board-scan-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-scan-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/board-scan-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAQ3E,oFAAoF;AACpF,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,eAAe,CAAA;IACvB,kCAAkC;IAClC,OAAO,EAAE,gBAAgB,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,kEAAkE;IAClE,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAClD,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;IACzE,iEAAiE;IACjE,SAAS,CACP,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;IACtC,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACpE,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=board-scan-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-scan-repositories.js","sourceRoot":"","sources":["../../src/ports/board-scan-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,71 @@
1
+ import type { BootstrapFailure, BootstrapStatus, StepSubtasks } from '../domain/types.js';
2
+ /**
3
+ * A managed reference architecture: a base repo new repositories are
4
+ * bootstrapped from, plus default bootstrapper instructions.
5
+ */
6
+ export interface ReferenceArchitectureRecord {
7
+ id: string;
8
+ workspaceId: string;
9
+ name: string;
10
+ description: string;
11
+ repoOwner: string;
12
+ repoName: string;
13
+ defaultInstructions: string;
14
+ createdAt: number;
15
+ updatedAt: number;
16
+ /** Set when the entry is removed (tombstone). */
17
+ deletedAt: number | null;
18
+ }
19
+ export type ReferenceArchitectureRecordPatch = Partial<Pick<ReferenceArchitectureRecord, 'name' | 'description' | 'repoOwner' | 'repoName' | 'defaultInstructions' | 'updatedAt'>>;
20
+ export interface ReferenceArchitectureRepository {
21
+ insert(record: ReferenceArchitectureRecord): Promise<void>;
22
+ update(workspaceId: string, id: string, patch: ReferenceArchitectureRecordPatch): Promise<void>;
23
+ get(workspaceId: string, id: string): Promise<ReferenceArchitectureRecord | null>;
24
+ listByWorkspace(workspaceId: string): Promise<ReferenceArchitectureRecord[]>;
25
+ softDelete(workspaceId: string, id: string, at: number): Promise<void>;
26
+ }
27
+ /** One "bootstrap repo" run and its outcome, projected locally. */
28
+ export interface BootstrapJobRecord {
29
+ id: string;
30
+ workspaceId: string;
31
+ /** Reference architecture the run was based on, or null for a from-scratch run. */
32
+ referenceArchitectureId: string | null;
33
+ /** Denormalized reference architecture name, or null for a from-scratch run. */
34
+ referenceArchitectureName: string | null;
35
+ repoName: string;
36
+ repoOwner: string | null;
37
+ repoUrl: string | null;
38
+ instructions: string;
39
+ status: BootstrapStatus;
40
+ /** The board service frame this run materialises, or null if none was created. */
41
+ blockId: string | null;
42
+ /** Live subtask counts from the bootstrapper agent, or null until it reports. */
43
+ subtasks: StepSubtasks | null;
44
+ error: string | null;
45
+ /** Structured failure diagnostics when `status` is `failed`; null otherwise. */
46
+ failure: BootstrapFailure | null;
47
+ createdAt: number;
48
+ updatedAt: number;
49
+ }
50
+ export type BootstrapJobRecordPatch = Partial<Pick<BootstrapJobRecord, 'status' | 'repoOwner' | 'repoUrl' | 'blockId' | 'subtasks' | 'error' | 'failure' | 'updatedAt'>>;
51
+ export interface BootstrapJobRepository {
52
+ insert(record: BootstrapJobRecord): Promise<void>;
53
+ update(workspaceId: string, id: string, patch: BootstrapJobRecordPatch): Promise<void>;
54
+ get(workspaceId: string, id: string): Promise<BootstrapJobRecord | null>;
55
+ listByWorkspace(workspaceId: string): Promise<BootstrapJobRecord[]>;
56
+ /**
57
+ * Every bootstrap run belonging to a service, regardless of which workspace ran it. Backs the
58
+ * board snapshot for a service mounted from another workspace in the same org, so a shared
59
+ * service's in-flight bootstrap renders on every board that mounts it. Matches the
60
+ * `service_id` column stamped from the run's service frame.
61
+ */
62
+ listByService(serviceId: string): Promise<BootstrapJobRecord[]>;
63
+ /**
64
+ * Every bootstrap run belonging to ANY of the given services, in a single (chunked) query —
65
+ * the batched form of {@link BootstrapJobRepository.listByService} used to compose a board's
66
+ * bootstrap runs from all the services it mounts without one round-trip per mount. Empty
67
+ * input → empty.
68
+ */
69
+ listByServices(serviceIds: string[]): Promise<BootstrapJobRecord[]>;
70
+ }
71
+ //# sourceMappingURL=bootstrap-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/bootstrap-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAMzF;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB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ositories.js","sourceRoot":"","sources":["../../src/ports/bootstrap-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ export interface BootstrapRunner {
2
+ /**
3
+ * Begin durably driving the bootstrap job `jobId` for `workspaceId`. Must be
4
+ * idempotent per job id (a duplicate start, or a sweeper re-drive racing a live
5
+ * instance, is a no-op) — the persisted job record is authoritative.
6
+ */
7
+ startRun(workspaceId: string, jobId: string): Promise<void>;
8
+ /**
9
+ * Best-effort: tear down the durable driver for `jobId` (terminate its Workflows
10
+ * instance) when the run is being stopped/cancelled. Idempotent — no live
11
+ * instance to terminate is a no-op.
12
+ */
13
+ cancelRun(workspaceId: string, jobId: string): Promise<void>;
14
+ }
15
+ /** The default runner: does nothing (tests drive `pollBootstrapJob` directly). */
16
+ export declare class NoopBootstrapRunner implements BootstrapRunner {
17
+ startRun(): Promise<void>;
18
+ cancelRun(): Promise<void>;
19
+ }
20
+ //# sourceMappingURL=bootstrap-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-runner.d.ts","sourceRoot":"","sources":["../../src/ports/bootstrap-runner.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D;;;;OAIG;IACH,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC7D;AAED,kFAAkF;AAClF,qBAAa,mBAAoB,YAAW,eAAe;IACnD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;IAC5B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;CACpC"}
@@ -0,0 +1,12 @@
1
+ // Port for durably driving a "bootstrap repo" run's poll loop, mirroring
2
+ // WorkRunner for pipeline runs. After BootstrapService dispatches the container it
3
+ // asks the runner to start driving: the worker maps each run to one Cloudflare
4
+ // Workflows instance (the BootstrapWorkflow) that polls until the run reaches a
5
+ // terminal state, updating subtasks and finalising the board frame. Tests leave it
6
+ // unset and drive `pollBootstrapJob` directly, exactly as the execution tests do.
7
+ /** The default runner: does nothing (tests drive `pollBootstrapJob` directly). */
8
+ export class NoopBootstrapRunner {
9
+ async startRun() { }
10
+ async cancelRun() { }
11
+ }
12
+ //# sourceMappingURL=bootstrap-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-runner.js","sourceRoot":"","sources":["../../src/ports/bootstrap-runner.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,mFAAmF;AACnF,+EAA+E;AAC/E,gFAAgF;AAChF,mFAAmF;AACnF,kFAAkF;AAiBlF,kFAAkF;AAClF,MAAM,OAAO,mBAAmB;IAC9B,KAAK,CAAC,QAAQ,KAAmB,CAAC;IAClC,KAAK,CAAC,SAAS,KAAmB,CAAC;CACpC"}
@@ -0,0 +1,23 @@
1
+ /** One CI check for the head commit, flattened from the GitHub check-run shape. */
2
+ export interface CiCheck {
3
+ name: string;
4
+ /** GitHub check status: 'queued' | 'in_progress' | 'completed'. */
5
+ status: string;
6
+ /** GitHub conclusion when completed: 'success' | 'failure' | 'neutral' | … (null while running). */
7
+ conclusion: string | null;
8
+ }
9
+ export interface CiStatusReport {
10
+ /** The PR head commit whose checks these are; null when no PR/branch resolved. */
11
+ headSha: string | null;
12
+ /** The check runs reported for `headSha` (empty when none are configured/registered yet). */
13
+ checks: CiCheck[];
14
+ }
15
+ export interface CiStatusProvider {
16
+ /**
17
+ * Resolve the head commit of the block's open PR and list its CI check runs.
18
+ * Returns `{ headSha: null, checks: [] }` when the block has no resolvable PR
19
+ * branch yet (the engine treats this as "nothing to gate").
20
+ */
21
+ getStatus(workspaceId: string, blockId: string): Promise<CiStatusReport>;
22
+ }
23
+ //# sourceMappingURL=ci-status.d.ts.map