@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,69 @@
1
+ import type { LanguageModel } from 'ai';
2
+ /** Which container harness runs an agent for a model. */
3
+ export type HarnessKind = 'pi' | 'claude-code' | 'codex';
4
+ export interface ModelRef {
5
+ /** Provider id, e.g. `openai`, `anthropic`, `workers-ai`, `mock`. */
6
+ provider: string;
7
+ /** Model id within the provider, e.g. `gpt-4o-mini`. */
8
+ model: string;
9
+ /**
10
+ * The container harness that runs this model. Absent ⇒ the default Pi harness
11
+ * (reached through the LLM proxy). `claude-code` / `codex` are subscription
12
+ * harnesses authenticated with a stored OAuth token, talking direct to the
13
+ * vendor — the executor leases a pool token instead of minting a proxy session.
14
+ */
15
+ harness?: HarnessKind;
16
+ /**
17
+ * The total context window for THIS flavour, in tokens, as published by the provider
18
+ * that actually serves it — the combined input + output the model can process in one
19
+ * request, NOT a max-output limit. It is per-flavour because the SAME catalog model
20
+ * can be served with a different window depending on where it runs, in EITHER
21
+ * direction: Cloudflare may cap below the vendor's full window (e.g. GLM-5.2 is 256K
22
+ * on Cloudflare vs 1M on a Z.ai subscription), match it (Kimi K2.6 is 256K both on
23
+ * Cloudflare and direct), or even exceed a direct sibling (the Cloudflare R1 distill
24
+ * serves 80K while the direct flagship chat model is 64K). Set it from the serving
25
+ * provider's own model docs, not a general spec sheet. Surfaced in the picker so a
26
+ * user sees the window the selected flavour will really give them. Absent ⇒ unknown.
27
+ */
28
+ contextTokens?: number;
29
+ }
30
+ /**
31
+ * Degrade a model ref that demands a container-only subscription harness
32
+ * (`claude-code` / `codex`) to an inline-servable `fallback`. Such a ref names a
33
+ * vendor with NO provider key (the credential is a pooled subscription token used
34
+ * only inside the per-run container), so resolving it through a {@link ModelProvider}
35
+ * for an INLINE LLM call would fail. A block's model is shared by every step of its
36
+ * pipeline (container AND inline), so this is the single seam every inline path (the
37
+ * inline agent executor, the requirements reviewer/rework) routes a pinned
38
+ * subscription model through: the container steps keep the harness, the inline steps
39
+ * fall back to a provider model. A `pi` (or absent) harness is already inline-servable
40
+ * and passes through unchanged.
41
+ */
42
+ export declare function inlineModelRef(ref: ModelRef, fallback: ModelRef): ModelRef;
43
+ export interface ModelProvider {
44
+ /** Resolve a model handle the AI SDK can call, or throw if unconfigured. */
45
+ resolve(ref: ModelRef): LanguageModel;
46
+ }
47
+ /**
48
+ * The credential scope a run draws model-provider keys from: the workspace, its
49
+ * owning account, and the run initiator's own user keys are merged into one pool.
50
+ */
51
+ export interface ModelScope {
52
+ workspaceId: string;
53
+ /** The workspace's owning account id (resolved automatically when omitted). */
54
+ accountId?: string | null;
55
+ /** The run initiator's `usr_*` id, to also draw from their personal keys. */
56
+ userId?: string | null;
57
+ }
58
+ /**
59
+ * Resolves a {@link ModelProvider} bound to a run's credential scope. Direct-provider
60
+ * API keys live in the DB (account/workspace/user scoped), so the provider can no
61
+ * longer be a single process-wide instance built from env: each inline LLM call asks
62
+ * for the provider for its scope, which leases the configured keys for that
63
+ * workspace+account+user. `resolve` itself stays synchronous (keys are leased up
64
+ * front when the scoped provider is built).
65
+ */
66
+ export interface ModelProviderResolver {
67
+ forScope(scope: ModelScope): Promise<ModelProvider>;
68
+ }
69
+ //# sourceMappingURL=model-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-provider.d.ts","sourceRoot":"","sources":["../../src/ports/model-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAOvC,yDAAyD;AACzD,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,aAAa,GAAG,OAAO,CAAA;AAExD,MAAM,WAAW,QAAQ;IACvB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAA;IAChB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAE1E;AAED,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,aAAa,CAAA;CACtC;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;CACpD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Degrade a model ref that demands a container-only subscription harness
3
+ * (`claude-code` / `codex`) to an inline-servable `fallback`. Such a ref names a
4
+ * vendor with NO provider key (the credential is a pooled subscription token used
5
+ * only inside the per-run container), so resolving it through a {@link ModelProvider}
6
+ * for an INLINE LLM call would fail. A block's model is shared by every step of its
7
+ * pipeline (container AND inline), so this is the single seam every inline path (the
8
+ * inline agent executor, the requirements reviewer/rework) routes a pinned
9
+ * subscription model through: the container steps keep the harness, the inline steps
10
+ * fall back to a provider model. A `pi` (or absent) harness is already inline-servable
11
+ * and passes through unchanged.
12
+ */
13
+ export function inlineModelRef(ref, fallback) {
14
+ return ref.harness && ref.harness !== 'pi' ? fallback : ref;
15
+ }
16
+ //# sourceMappingURL=model-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-provider.js","sourceRoot":"","sources":["../../src/ports/model-provider.ts"],"names":[],"mappings":"AAqCA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAAC,GAAa,EAAE,QAAkB;IAC9D,OAAO,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAA;AAC7D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Notification } from '../domain/types.js';
2
+ export interface NotificationChannel {
3
+ /** Deliver (or re-deliver, on resolve) a notification to this channel's medium. */
4
+ deliver(workspaceId: string, notification: Notification): Promise<void>;
5
+ }
6
+ /** Fan a notification out to every configured channel, isolating per-channel failures. */
7
+ export declare class CompositeNotificationChannel implements NotificationChannel {
8
+ private readonly channels;
9
+ constructor(channels: NotificationChannel[]);
10
+ deliver(workspaceId: string, notification: Notification): Promise<void>;
11
+ }
12
+ /** The no-op channel: delivers nothing (tests, or a deployment with no channels wired). */
13
+ export declare class NoopNotificationChannel implements NotificationChannel {
14
+ deliver(): Promise<void>;
15
+ }
16
+ //# sourceMappingURL=notification-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-channel.d.ts","sourceRoot":"","sources":["../../src/ports/notification-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AActD,MAAM,WAAW,mBAAmB;IAClC,mFAAmF;IACnF,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACxE;AAED,0FAA0F;AAC1F,qBAAa,4BAA6B,YAAW,mBAAmB;IAC1D,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAArC,YAA6B,QAAQ,EAAE,mBAAmB,EAAE,EAAI;IAE1D,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAU5E;CACF;AAED,2FAA2F;AAC3F,qBAAa,uBAAwB,YAAW,mBAAmB;IAC3D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAG;CAClC"}
@@ -0,0 +1,22 @@
1
+ /** Fan a notification out to every configured channel, isolating per-channel failures. */
2
+ export class CompositeNotificationChannel {
3
+ channels;
4
+ constructor(channels) {
5
+ this.channels = channels;
6
+ }
7
+ async deliver(workspaceId, notification) {
8
+ await Promise.all(this.channels.map(async (channel) => {
9
+ try {
10
+ await channel.deliver(workspaceId, notification);
11
+ }
12
+ catch {
13
+ // Best-effort: one channel failing must not block the others or the caller.
14
+ }
15
+ }));
16
+ }
17
+ }
18
+ /** The no-op channel: delivers nothing (tests, or a deployment with no channels wired). */
19
+ export class NoopNotificationChannel {
20
+ async deliver() { }
21
+ }
22
+ //# sourceMappingURL=notification-channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-channel.js","sourceRoot":"","sources":["../../src/ports/notification-channel.ts"],"names":[],"mappings":"AAmBA,0FAA0F;AAC1F,MAAM,OAAO,4BAA4B;IACV,QAAQ;IAArC,YAA6B,QAA+B;wBAA/B,QAAQ;IAA0B,CAAC;IAEhE,KAAK,CAAC,OAAO,CAAC,WAAmB,EAAE,YAA0B;QAC3D,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YAClC,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAA;YAClD,CAAC;YAAC,MAAM,CAAC;gBACP,4EAA4E;YAC9E,CAAC;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;CACF;AAED,2FAA2F;AAC3F,MAAM,OAAO,uBAAuB;IAClC,KAAK,CAAC,OAAO,KAAmB,CAAC;CAClC"}
@@ -0,0 +1,15 @@
1
+ import type { Notification, NotificationType } from '../domain/types.js';
2
+ export interface NotificationRepository {
3
+ /** A notification by id, or null if it does not exist. */
4
+ get(workspaceId: string, id: string): Promise<Notification | null>;
5
+ /** All currently-open notifications for a workspace (newest first), for the inbox + snapshot. */
6
+ listOpen(workspaceId: string): Promise<Notification[]>;
7
+ /**
8
+ * The open notification of `type` for `blockId`, if any — used to de-duplicate so
9
+ * a re-driven run doesn't stack identical cards on the same block.
10
+ */
11
+ findOpenByBlock(workspaceId: string, blockId: string, type: NotificationType): Promise<Notification | null>;
12
+ /** Create or replace a notification (keyed by id). */
13
+ upsert(workspaceId: string, notification: Notification): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=notification-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/notification-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAMxE,MAAM,WAAW,sBAAsB;IACrC,0DAA0D;IAC1D,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAClE,iGAAiG;IACjG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAA;IACtD;;;OAGG;IACH,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;IAC/B,sDAAsD;IACtD,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=notification-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notification-repositories.js","sourceRoot":"","sources":["../../src/ports/notification-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export interface PasswordHasher {
2
+ /** Hash a plaintext password, returning a self-describing PHC-like string. */
3
+ hash(password: string): Promise<string>;
4
+ /** Constant-time verify a plaintext password against a stored hash. */
5
+ verify(password: string, stored: string): Promise<boolean>;
6
+ /**
7
+ * Whether a stored hash was produced with weaker-than-current parameters (a
8
+ * different scheme or a lower iteration count) and should be transparently
9
+ * re-hashed after the next successful login. A malformed value returns true so the
10
+ * caller upgrades it. Used to migrate password cost upward without a flag day.
11
+ */
12
+ needsRehash(stored: string): boolean;
13
+ }
14
+ //# sourceMappingURL=password-hasher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-hasher.d.ts","sourceRoot":"","sources":["../../src/ports/password-hasher.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,cAAc;IAC7B,8EAA8E;IAC9E,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,uEAAuE;IACvE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC1D;;;;;OAKG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;CACrC"}
@@ -0,0 +1,9 @@
1
+ // Port for password hashing used by the email/password login provider. The facade
2
+ // supplies a Web Crypto implementation (PBKDF2-HMAC-SHA256 with a random per-record
3
+ // salt) that runs identically on Cloudflare workerd and Node — native argon2/bcrypt
4
+ // modules do NOT run in a Workers isolate, so the runtimes would diverge.
5
+ //
6
+ // `hash` returns a self-describing PHC-like string that embeds the algorithm,
7
+ // iteration count, and salt, so `verify` can re-derive without any external params.
8
+ export {};
9
+ //# sourceMappingURL=password-hasher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password-hasher.js","sourceRoot":"","sources":["../../src/ports/password-hasher.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,oFAAoF;AACpF,oFAAoF;AACpF,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,oFAAoF"}
@@ -0,0 +1,7 @@
1
+ export interface PersonalSecretCipher {
2
+ /** Seal plaintext under a key derived from `password`, returning an opaque envelope. */
3
+ seal(plaintext: string, password: string): Promise<string>;
4
+ /** Open an envelope produced by {@link seal}; throws if `password` is wrong/tampered. */
5
+ open(envelope: string, password: string): Promise<string>;
6
+ }
7
+ //# sourceMappingURL=personal-secret-cipher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-secret-cipher.d.ts","sourceRoot":"","sources":["../../src/ports/personal-secret-cipher.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC1D,yFAAyF;IACzF,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC1D"}
@@ -0,0 +1,12 @@
1
+ // Port for the SECOND, password-derived encryption layer used by individual-usage
2
+ // subscriptions. Distinct from {@link SecretCipher} (the system layer): this seals a
3
+ // plaintext under a key derived from the user's PERSONAL PASSWORD, which is never
4
+ // stored. The facade supplies a Web Crypto implementation (PBKDF2 → AES-256-GCM) with
5
+ // a self-describing envelope that embeds the per-record salt + IV.
6
+ //
7
+ // `open` throws when the password is wrong (the AEAD auth check fails and a magic
8
+ // header mismatch is detected), which the service maps to a `wrong_password`
9
+ // credential-required error. The system layer is applied on top of this envelope so
10
+ // the at-rest credential needs BOTH the system key AND the user's password to recover.
11
+ export {};
12
+ //# sourceMappingURL=personal-secret-cipher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-secret-cipher.js","sourceRoot":"","sources":["../../src/ports/personal-secret-cipher.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qFAAqF;AACrF,kFAAkF;AAClF,sFAAsF;AACtF,mEAAmE;AACnE,EAAE;AACF,kFAAkF;AAClF,6EAA6E;AAC7E,oFAAoF;AACpF,uFAAuF"}
@@ -0,0 +1,72 @@
1
+ import type { SubscriptionVendor } from './provider-subscription-repositories.js';
2
+ /**
3
+ * A user's personal subscription credential at rest. `tokenCipher` is the
4
+ * double-encrypted envelope: `system.encrypt(personal.seal(rawToken, password))`.
5
+ * `expiresAt` is the subscription's own end date (for renewal warnings + a hard
6
+ * block once lapsed), distinct from an activation's short TTL.
7
+ */
8
+ export interface PersonalSubscriptionRecord {
9
+ id: string;
10
+ /** Internal user id (`usr_*`) of the owner. */
11
+ userId: string;
12
+ vendor: SubscriptionVendor;
13
+ label: string;
14
+ /** Double-encrypted credential (password layer inside the system layer). */
15
+ tokenCipher: string;
16
+ /** Subscription's own expiry (null = no fixed end date). */
17
+ expiresAt: number | null;
18
+ createdAt: number;
19
+ updatedAt: number;
20
+ /** When a run last activated this credential (null = never). */
21
+ lastUsedAt: number | null;
22
+ /** Tombstone when the user removes it. */
23
+ deletedAt: number | null;
24
+ }
25
+ export interface PersonalSubscriptionRepository {
26
+ /** The user's live credential for a vendor, or null. */
27
+ getByUserVendor(userId: string, vendor: SubscriptionVendor): Promise<PersonalSubscriptionRecord | null>;
28
+ /** Every live credential the user owns (metadata for the status surface). */
29
+ listByUser(userId: string): Promise<PersonalSubscriptionRecord[]>;
30
+ /** Insert or replace the user's credential for a vendor (one per user+vendor). */
31
+ upsert(record: PersonalSubscriptionRecord): Promise<void>;
32
+ /** Stamp `lastUsedAt` when a run activates the credential. */
33
+ markUsed(userId: string, vendor: SubscriptionVendor, at: number): Promise<void>;
34
+ /** Tombstone the user's credential for a vendor. */
35
+ softDelete(userId: string, vendor: SubscriptionVendor, at: number): Promise<void>;
36
+ /**
37
+ * Live credentials whose subscription `expiresAt` is at/after `now` but at/before
38
+ * `before` (the advance-warning horizon) — the renewal-nudge sweep reads these.
39
+ * Excludes ones with no expiry.
40
+ */
41
+ listExpiring(now: number, before: number): Promise<PersonalSubscriptionRecord[]>;
42
+ }
43
+ /**
44
+ * A per-run, system-key-only activation of a personal credential. Scoped to one
45
+ * execution (`executionId`) + its owner; `tokenCipher` is `system.encrypt(rawToken)`
46
+ * so the durable driver/executor can decrypt it for every step of that run without
47
+ * the password. `expiresAt` is the activation TTL (longer than a run normally needs,
48
+ * refreshed on user interaction, and the row is deleted when the run completes).
49
+ */
50
+ export interface SubscriptionActivationRecord {
51
+ id: string;
52
+ executionId: string;
53
+ userId: string;
54
+ vendor: SubscriptionVendor;
55
+ /** System-key-only ciphertext of the raw token. */
56
+ tokenCipher: string;
57
+ createdAt: number;
58
+ expiresAt: number;
59
+ }
60
+ export interface SubscriptionActivationRepository {
61
+ /** The live (unexpired) activation for a run+user+vendor, or null. */
62
+ get(executionId: string, userId: string, vendor: SubscriptionVendor, now: number): Promise<SubscriptionActivationRecord | null>;
63
+ /** Create or replace the activation for a run+user+vendor. */
64
+ upsert(record: SubscriptionActivationRecord): Promise<void>;
65
+ /** Extend an existing activation's TTL (refresh on interaction). No-op if absent. */
66
+ refresh(executionId: string, userId: string, vendor: SubscriptionVendor, expiresAt: number): Promise<void>;
67
+ /** Delete every activation for a finished run. */
68
+ deleteByExecution(executionId: string): Promise<void>;
69
+ /** Delete activations whose TTL has passed (the expiry sweep). Returns the count. */
70
+ deleteExpired(now: number): Promise<number>;
71
+ }
72
+ //# sourceMappingURL=personal-subscription-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-subscription-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/personal-subscription-repositories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAmBjF;;;;;GAKG;AACH,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAA;IACV,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,kBAAkB,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAA;IACnB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,8BAA8B;IAC7C,wDAAwD;IACxD,eAAe,CACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAA;IAC7C,6EAA6E;IAC7E,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAA;IACjE,kFAAkF;IAClF,MAAM,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACzD,8DAA8D;IAC9D,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/E,oDAAoD;IACpD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjF;;;;OAIG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAA;CACjF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC3C,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,kBAAkB,CAAA;IAC1B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,gCAAgC;IAC/C,sEAAsE;IACtE,GAAG,CACD,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAA;IAC/C,8DAA8D;IAC9D,MAAM,CAAC,MAAM,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D,qFAAqF;IACrF,OAAO,CACL,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kBAAkB,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,kDAAkD;IAClD,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrD,qFAAqF;IACrF,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CAC5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=personal-subscription-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-subscription-repositories.js","sourceRoot":"","sources":["../../src/ports/personal-subscription-repositories.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The normalised mergeability of a PR:
3
+ * - `mergeable` — merges cleanly into its base (nothing to resolve).
4
+ * - `conflicted` — conflicts with its base and needs resolution.
5
+ * - `unknown` — GitHub has not finished computing mergeability yet (it is
6
+ * computed asynchronously), so the caller should poll again.
7
+ */
8
+ export type MergeabilityVerdict = 'mergeable' | 'conflicted' | 'unknown';
9
+ export interface MergeabilityReport {
10
+ /** The PR head commit these refer to; null when no open PR/branch is resolved. */
11
+ headSha: string | null;
12
+ /** The mergeability verdict; see {@link MergeabilityVerdict}. */
13
+ verdict: MergeabilityVerdict;
14
+ }
15
+ export interface PullRequestMergeabilityProvider {
16
+ /**
17
+ * Resolve the block's open PR and report whether it merges cleanly into its base.
18
+ * Returns `headSha: null` (verdict `unknown`) when no PR/branch is resolved — the
19
+ * engine treats that as "nothing to gate" and advances. Returns `unknown` with a
20
+ * head sha while GitHub is still computing mergeability, so the gate re-polls.
21
+ */
22
+ getMergeability(workspaceId: string, blockId: string): Promise<MergeabilityReport>;
23
+ }
24
+ //# sourceMappingURL=pr-mergeability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-mergeability.d.ts","sourceRoot":"","sources":["../../src/ports/pr-mergeability.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,YAAY,GAAG,SAAS,CAAA;AAExE,MAAM,WAAW,kBAAkB;IACjC,kFAAkF;IAClF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,iEAAiE;IACjE,OAAO,EAAE,mBAAmB,CAAA;CAC7B;AAED,MAAM,WAAW,+BAA+B;IAC9C;;;;;OAKG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAA;CACnF"}
@@ -0,0 +1,7 @@
1
+ // Port for "can this block's PR be merged into its base, or does it conflict?".
2
+ // The execution engine's `conflicts` gate calls this — and ONLY this — to decide
3
+ // whether to dispatch the conflict-resolver before the merge step. Modelled as a
4
+ // port so core stays free of GitHub specifics; the worker implements it against
5
+ // the PR's lazily-computed `mergeable`/`mergeable_state`, and tests supply a fake.
6
+ export {};
7
+ //# sourceMappingURL=pr-mergeability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-mergeability.js","sourceRoot":"","sources":["../../src/ports/pr-mergeability.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,mFAAmF"}
@@ -0,0 +1,10 @@
1
+ export interface PullRequestMerger {
2
+ /**
3
+ * Merge the open pull request recorded on `blockId` (from its `pullRequest`
4
+ * ref). Resolves once the remote reports the merge succeeded. Throws if the
5
+ * block has no PR, the merge is blocked (e.g. failing required checks, conflicts)
6
+ * or the API call fails — the caller leaves the block awaiting a manual merge.
7
+ */
8
+ mergeForBlock(workspaceId: string, blockId: string): Promise<void>;
9
+ }
10
+ //# sourceMappingURL=pr-merger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-merger.d.ts","sourceRoot":"","sources":["../../src/ports/pr-merger.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACnE"}
@@ -0,0 +1,8 @@
1
+ // Port for actually merging a block's pull request on the remote (GitHub). The
2
+ // execution engine calls this — and ONLY this — when a task should transition to
3
+ // `done`, so "done" provably means "the PR was merged" rather than a board-only
4
+ // status flip. Modelled as a port so core stays free of GitHub specifics; the
5
+ // worker implements it by resolving the block's repo target + open PR and calling
6
+ // `GitHubClient.mergePullRequest`, and tests supply a fake.
7
+ export {};
8
+ //# sourceMappingURL=pr-merger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-merger.js","sourceRoot":"","sources":["../../src/ports/pr-merger.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iFAAiF;AACjF,gFAAgF;AAChF,8EAA8E;AAC9E,kFAAkF;AAClF,4DAA4D"}
@@ -0,0 +1,71 @@
1
+ /** The scope a stored API key belongs to. */
2
+ export type ApiKeyScope = 'account' | 'workspace' | 'user';
3
+ /** The direct providers that own a poolable API key (NOT subscription vendors). */
4
+ export type ApiKeyProvider = 'openai' | 'anthropic' | 'qwen' | 'deepseek' | 'moonshot' | 'openrouter' | 'litellm';
5
+ /** A (scope, scopeId) pair — the addressing of a pool segment. */
6
+ export interface ApiKeyScopeRef {
7
+ scope: ApiKeyScope;
8
+ /** The workspace id, account id, or `usr_*` user id, per scope. */
9
+ scopeId: string;
10
+ }
11
+ /**
12
+ * One API key in a scope's pool. `keyCipher` is the SecretCipher envelope of the
13
+ * raw vendor key. Usage counters are scoped to the current rolling window (reset
14
+ * when `windowStartedAt` ages out), mirroring the subscription pool.
15
+ */
16
+ export interface ProviderApiKeyRecord {
17
+ id: string;
18
+ scope: ApiKeyScope;
19
+ /** workspace id | account id | `usr_*` user id, per `scope`. */
20
+ scopeId: string;
21
+ provider: ApiKeyProvider;
22
+ label: string;
23
+ /** Ciphertext of the raw API key (SecretCipher envelope). */
24
+ keyCipher: string;
25
+ createdAt: number;
26
+ /** When this key was last leased (null = never used). */
27
+ lastUsedAt: number | null;
28
+ /** Start of the current rolling usage window (null = no usage recorded yet). */
29
+ windowStartedAt: number | null;
30
+ inputTokens: number;
31
+ outputTokens: number;
32
+ requestCount: number;
33
+ /** Set when the key is removed (tombstone). */
34
+ deletedAt: number | null;
35
+ }
36
+ export interface ProviderApiKeyRepository {
37
+ /**
38
+ * All live keys for one (scope, scopeId), oldest first. Filtered to a single
39
+ * `provider` when given, else every provider in the scope (one query, not N).
40
+ */
41
+ listByScope(scope: ApiKeyScope, scopeId: string, provider?: ApiKeyProvider): Promise<ProviderApiKeyRecord[]>;
42
+ /**
43
+ * All live keys for one provider across MANY scope segments — the merged-pool
44
+ * read used by lease(). Returns rows from every matching (scope, scopeId).
45
+ */
46
+ listForPool(scopes: ApiKeyScopeRef[], provider: ApiKeyProvider): Promise<ProviderApiKeyRecord[]>;
47
+ /** Distinct providers that have ≥1 live key across the given scope segments. */
48
+ listConfiguredProviders(scopes: ApiKeyScopeRef[]): Promise<ApiKeyProvider[]>;
49
+ /** Fetch one live key by id (scoped to its segment). */
50
+ getById(scope: ApiKeyScope, scopeId: string, id: string): Promise<ProviderApiKeyRecord | null>;
51
+ /** Insert a new key. */
52
+ add(record: ProviderApiKeyRecord): Promise<void>;
53
+ /**
54
+ * Stamp `lastUsedAt` on the leased key. Keyed by ROW ID alone: a leased row may
55
+ * belong to any of the three scopes merged at lease time, so there is no single
56
+ * scope to filter by. Ids are opaque (`apikey_*`) and never exposed cross-tenant.
57
+ */
58
+ markLeased(id: string, at: number): Promise<void>;
59
+ /**
60
+ * Fold a completed call's usage into the key's rolling-window counters (keyed by
61
+ * row id, see markLeased). When `windowStartedAt` is null or older than
62
+ * `windowMs`, the window resets to `at` and the counters start from this call.
63
+ */
64
+ recordUsage(id: string, usage: {
65
+ inputTokens: number;
66
+ outputTokens: number;
67
+ }, at: number, windowMs: number): Promise<void>;
68
+ /** Tombstone a key (scoped to its segment). */
69
+ softDelete(scope: ApiKeyScope, scopeId: string, id: string, at: number): Promise<void>;
70
+ }
71
+ //# sourceMappingURL=provider-api-key-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-api-key-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/provider-api-key-repositories.ts"],"names":[],"mappings":"AAcA,6CAA6C;AAC7C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,CAAA;AAE1D,mFAAmF;AACnF,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,WAAW,GACX,MAAM,GACN,UAAU,GACV,UAAU,GACV,YAAY,GACZ,SAAS,CAAA;AAEb,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,WAAW,CAAA;IAClB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,WAAW,CAAA;IAClB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,cAAc,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,WAAW,CACT,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAA;IAClC;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAA;IAChG,gFAAgF;IAChF,uBAAuB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAA;IAC5E,wDAAwD;IACxD,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAA;IAC9F,wBAAwB;IACxB,GAAG,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;;;OAIG;IACH,WAAW,CACT,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EACpD,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,+CAA+C;IAC/C,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvF"}
@@ -0,0 +1,15 @@
1
+ // Persistence port for the direct-provider API-key pool. Unlike subscription
2
+ // tokens (Claude Code / Codex harness credentials, scoped per workspace+vendor),
3
+ // these are raw vendor API keys (OpenAI/Anthropic/Qwen/DeepSeek/Moonshot) that
4
+ // authenticate the LLM proxy + inline model calls. They are onboarded via the UI
5
+ // and stored encrypted in the DB (a SecretCipher envelope — never plaintext),
6
+ // replacing the old deployment-env onboarding.
7
+ //
8
+ // A key is stored at one of three SCOPES — account, workspace, or user. When a
9
+ // run in a workspace needs a provider key, the candidate pool is the UNION of the
10
+ // workspace's keys, its owning account's keys, and the run initiator's own user
11
+ // keys; the least-loaded key wins (usage-aware rotation, identical to the
12
+ // subscription pool). Both runtimes implement this (Cloudflare D1 + Node/local
13
+ // Postgres) so behaviour is identical everywhere.
14
+ export {};
15
+ //# sourceMappingURL=provider-api-key-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-api-key-repositories.js","sourceRoot":"","sources":["../../src/ports/provider-api-key-repositories.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,8EAA8E;AAC9E,+CAA+C;AAC/C,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,gFAAgF;AAChF,0EAA0E;AAC1E,+EAA+E;AAC/E,kDAAkD"}
@@ -0,0 +1,51 @@
1
+ /** The vendors whose subscription harnesses we support. */
2
+ export type SubscriptionVendor = 'claude' | 'codex' | 'glm' | 'kimi' | 'deepseek';
3
+ /**
4
+ * One subscription credential in a workspace's pool. `tokenCipher` is the
5
+ * SecretCipher envelope of the raw secret: a `CLAUDE_CODE_OAUTH_TOKEN` string
6
+ * for `claude`, or the full `auth.json` text for `codex`. Usage counters are
7
+ * scoped to the current rolling window (reset when `windowStartedAt` ages out).
8
+ */
9
+ export interface ProviderSubscriptionTokenRecord {
10
+ id: string;
11
+ workspaceId: string;
12
+ vendor: SubscriptionVendor;
13
+ label: string;
14
+ /** Ciphertext of the credential (SecretCipher envelope). */
15
+ tokenCipher: string;
16
+ createdAt: number;
17
+ /** When this token was last leased for a job (null = never used). */
18
+ lastUsedAt: number | null;
19
+ /** Start of the current rolling usage window (null = no usage recorded yet). */
20
+ windowStartedAt: number | null;
21
+ /** Input tokens consumed in the current window. */
22
+ inputTokens: number;
23
+ /** Output tokens consumed in the current window. */
24
+ outputTokens: number;
25
+ /** Job count in the current window. */
26
+ requestCount: number;
27
+ /** Set when the workspace removes the token (tombstone). */
28
+ deletedAt: number | null;
29
+ }
30
+ export interface ProviderSubscriptionTokenRepository {
31
+ /** All live tokens for a workspace + vendor, oldest first. */
32
+ listByVendor(workspaceId: string, vendor: SubscriptionVendor): Promise<ProviderSubscriptionTokenRecord[]>;
33
+ /** Fetch one live token by id (scoped to the workspace). */
34
+ getById(workspaceId: string, id: string): Promise<ProviderSubscriptionTokenRecord | null>;
35
+ /** Insert a new pool token. */
36
+ add(record: ProviderSubscriptionTokenRecord): Promise<void>;
37
+ /** Stamp `lastUsedAt` on the leased token (scoped to the workspace). */
38
+ markLeased(workspaceId: string, id: string, at: number): Promise<void>;
39
+ /**
40
+ * Fold a completed job's usage into the token's rolling-window counters (scoped to
41
+ * the workspace). When `windowStartedAt` is null or older than `windowMs`, the
42
+ * window resets to `at` and the counters start from this run.
43
+ */
44
+ recordUsage(workspaceId: string, id: string, usage: {
45
+ inputTokens: number;
46
+ outputTokens: number;
47
+ }, at: number, windowMs: number): Promise<void>;
48
+ /** Tombstone a token. */
49
+ softDelete(workspaceId: string, id: string, at: number): Promise<void>;
50
+ }
51
+ //# sourceMappingURL=provider-subscription-repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-subscription-repositories.d.ts","sourceRoot":"","sources":["../../src/ports/provider-subscription-repositories.ts"],"names":[],"mappings":"AAcA,2DAA2D;AAC3D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAA;AAEjF;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAC9C,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,kBAAkB,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,qEAAqE;IACrE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,gFAAgF;IAChF,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAA;IACpB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAA;IACpB,4DAA4D;IAC5D,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CACzB;AAED,MAAM,WAAW,mCAAmC;IAClD,8DAA8D;IAC9D,YAAY,CACV,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,+BAA+B,EAAE,CAAC,CAAA;IAC7C,4DAA4D;IAC5D,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC,CAAA;IACzF,+BAA+B;IAC/B,GAAG,CAAC,MAAM,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3D,wEAAwE;IACxE,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE;;;;OAIG;IACH,WAAW,CACT,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,EACpD,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAAA;IAChB,yBAAyB;IACzB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACvE"}
@@ -0,0 +1,15 @@
1
+ // Persistence port for the provider-subscription token pool. A workspace can
2
+ // connect one or more subscription credentials per vendor (a Claude
3
+ // Pro/Max OAuth token, a ChatGPT Plus/Pro `auth.json` bundle) so the
4
+ // Claude Code / Codex harnesses can authenticate inside a per-run container
5
+ // without an API key. Rows are scoped by workspace + vendor; the credential is
6
+ // stored as opaque ciphertext (see the SecretCipher port) — this record never
7
+ // holds the plaintext token.
8
+ //
9
+ // The pool is leased with usage-aware rotation: each row carries rolling-window
10
+ // usage counters that the dispatch path updates after a run, so the least-loaded
11
+ // token is preferred (round-robin by lastUsedAt is only the tiebreaker). Both
12
+ // runtimes implement this (Cloudflare D1 + Node/local Postgres) so the harness
13
+ // behaves identically everywhere.
14
+ export {};
15
+ //# sourceMappingURL=provider-subscription-repositories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-subscription-repositories.js","sourceRoot":"","sources":["../../src/ports/provider-subscription-repositories.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,oEAAoE;AACpE,qEAAqE;AACrE,4EAA4E;AAC5E,+EAA+E;AAC/E,8EAA8E;AAC9E,6BAA6B;AAC7B,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,+EAA+E;AAC/E,kCAAkC"}
@@ -0,0 +1,46 @@
1
+ import type { PipelineSchedule, ScheduleRun } from '../domain/types.js';
2
+ /** A due schedule the sweeper should fire, paired with its owning workspace. */
3
+ export interface DueSchedule {
4
+ workspaceId: string;
5
+ schedule: PipelineSchedule;
6
+ }
7
+ export interface PipelineScheduleRepository {
8
+ /** A schedule by id, or null if it does not exist. */
9
+ get(workspaceId: string, id: string): Promise<PipelineSchedule | null>;
10
+ /** The schedule whose reused block is `blockId`, or null. */
11
+ getByBlock(workspaceId: string, blockId: string): Promise<PipelineSchedule | null>;
12
+ /** All schedules for a workspace (for the snapshot + UI). */
13
+ list(workspaceId: string): Promise<PipelineSchedule[]>;
14
+ /**
15
+ * All schedules owned by a service, regardless of which workspace created them. Backs
16
+ * the in-org board: a schedule on a shared service shows on every workspace that mounts
17
+ * it. (Matches the schedule's `service_id` column.)
18
+ */
19
+ listByService(serviceId: string): Promise<PipelineSchedule[]>;
20
+ /**
21
+ * Every schedule owned by ANY of the given services, in a single (chunked) query — the
22
+ * batched form of {@link PipelineScheduleRepository.listByService} used to compose a board's
23
+ * schedules from all the services it mounts without one round-trip per mount. Empty input →
24
+ * empty.
25
+ */
26
+ listByServices(serviceIds: string[]): Promise<PipelineSchedule[]>;
27
+ /**
28
+ * Every enabled schedule across ALL workspaces whose `nextRunAt <= asOf`. The
29
+ * sweeper fires each one; the engine skips any whose block already has an active
30
+ * run. Ordered by `nextRunAt` ascending.
31
+ */
32
+ listDue(asOf: number): Promise<DueSchedule[]>;
33
+ /** Create or replace a schedule (keyed by id). */
34
+ upsert(workspaceId: string, schedule: PipelineSchedule): Promise<void>;
35
+ /** Remove a schedule by id (no-op if absent). Does not touch its run history. */
36
+ remove(workspaceId: string, id: string): Promise<void>;
37
+ /** Record a fire of a schedule. */
38
+ insertRun(workspaceId: string, run: ScheduleRun): Promise<void>;
39
+ /** Patch a run (e.g. set `status`/`finishedAt`/`outcome`). */
40
+ updateRun(workspaceId: string, runId: string, patch: Partial<Pick<ScheduleRun, 'status' | 'finishedAt' | 'outcome' | 'executionId'>>): Promise<void>;
41
+ /** A schedule's run history (most recent first). */
42
+ listRuns(workspaceId: string, scheduleId: string): Promise<ScheduleRun[]>;
43
+ /** Delete all run history started before `before` (retention). Returns rows removed. */
44
+ pruneRunsBefore(before: number): Promise<number>;
45
+ }
46
+ //# sourceMappingURL=recurring-repositories.d.ts.map