@cat-factory/node-server 0.18.6 → 0.20.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.
@@ -1 +1 @@
1
- {"version":3,"file":"drizzle.d.ts","sourceRoot":"","sources":["../../src/repositories/drizzle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,2BAA2B,EAE3B,iBAAiB,EAKjB,yBAAyB,EAKzB,kBAAkB,EAGlB,eAAe,EACf,KAAK,EAEL,mBAAmB,EAEnB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,EAC7B,iCAAiC,EAEjC,yBAAyB,EACzB,6BAA6B,EAE7B,qBAAqB,EACrB,iCAAiC,EAEjC,uBAAuB,EAIvB,kBAAkB,EAElB,0BAA0B,EAG1B,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EAGjB,2BAA2B,EAC3B,aAAa,EAEb,uBAAuB,EAIvB,iBAAiB,EAGjB,wBAAwB,EAIxB,oBAAoB,EAGpB,yBAAyB,EAGzB,cAAc,EAGd,mBAAmB,EAEnB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAa5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AA6nDhD;;;;;;;GAOG;AACH,qBAAa,kCAAmC,YAAW,2BAA2B;IACxE,OAAO,CAAC,QAAQ,CAAC,EAAE;IAA/B,YAA6B,EAAE,EAAE,SAAS,EAAI;IAExC,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAaxF;IAEK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAO5E;IAEK,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,OAAO,CA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AS,EAAE,KAAK,EAAE,KAAK,GAAG,gBAAgB,CA8BvF"}
@@ -1,7 +1,7 @@
1
1
  import { LLM_WARNING_FINISH_REASONS } from '@cat-factory/kernel';
2
- import { blockInsertValues, blockPatchToColumns, rowToBlock, rowToExecution, executionToDetail, rowToPipeline, rowToWorkspace, } from '@cat-factory/server';
3
- import { and, desc, eq, gte, inArray, isNull, lt, or, sql } from 'drizzle-orm';
4
- import { accountInvitations, accounts, agentRuns, blocks, consensusSessions, observabilityConnections, emailConnections, llmCallMetrics, memberships, mergeThresholdPresets, releaseHealthConfigs, pipelineScheduleRuns, pipelineSchedules, pipelines, requirementReviews, clarityReviews, services, tokenUsage, trackerSettings, modelPresets, userIdentities, users, workspaceFragmentDefaults, workspaceServices, workspaceSettings, workspaces, } from '../db/schema.js';
2
+ import { blockInsertValues, blockPatchToColumns, rowToBlock, rowToExecution, executionToDetail, rowToPipeline, rowToSandboxExperiment, rowToSandboxFixture, rowToSandboxGrade, rowToSandboxPromptVersion, rowToSandboxRun, rowToWorkspace, } from '@cat-factory/server';
3
+ import { and, desc, eq, gte, inArray, isNull, lt, ne, or, sql } from 'drizzle-orm';
4
+ import { accountInvitations, accountSettings, accounts, agentRuns, blocks, consensusSessions, incidentEnrichmentConnections, observabilityConnections, emailConnections, llmCallMetrics, memberships, mergeThresholdPresets, releaseHealthConfigs, pipelineScheduleRuns, pipelineSchedules, pipelines, requirementReviews, clarityReviews, sandboxPromptVersions, sandboxFixtures, sandboxExperiments, sandboxRuns, sandboxGrades, services, tokenUsage, trackerSettings, modelPresets, userIdentities, users, workspaceFragmentDefaults, workspaceServices, workspaceSettings, workspaces, } from '../db/schema.js';
5
5
  // Drizzle/Postgres implementations of the core kernel repository ports. The
6
6
  // row<->domain mapping is the SAME shared mapping the Cloudflare D1 repos use
7
7
  // (@cat-factory/server), so behaviour matches across stores; this layer only owns
@@ -711,6 +711,21 @@ class DrizzleTokenUsageRepository {
711
711
  costEstimate: row?.cost ?? 0,
712
712
  };
713
713
  }
714
+ async totalsSinceForWorkspace(workspaceId, epochMs) {
715
+ const [row] = await this.db
716
+ .select({
717
+ input: sql `coalesce(sum(${tokenUsage.input_tokens}), 0)::bigint`,
718
+ output: sql `coalesce(sum(${tokenUsage.output_tokens}), 0)::bigint`,
719
+ cost: sql `coalesce(sum(${tokenUsage.cost_estimate}), 0)::float8`,
720
+ })
721
+ .from(tokenUsage)
722
+ .where(and(eq(tokenUsage.workspace_id, workspaceId), gte(tokenUsage.created_at, epochMs)));
723
+ return {
724
+ inputTokens: Number(row?.input ?? 0),
725
+ outputTokens: Number(row?.output ?? 0),
726
+ costEstimate: row?.cost ?? 0,
727
+ };
728
+ }
714
729
  async deleteOlderThan(epochMs) {
715
730
  const deleted = await this.db
716
731
  .delete(tokenUsage)
@@ -1824,6 +1839,371 @@ export class DrizzleMergePresetRepository {
1824
1839
  .where(and(eq(mergeThresholdPresets.workspace_id, workspaceId), eq(mergeThresholdPresets.id, id), eq(mergeThresholdPresets.is_default, 0)));
1825
1840
  }
1826
1841
  }
1842
+ // ---- Sandbox (parallel prompt/model testing surface; migration 0012) --------
1843
+ // The Drizzle mirror of the Worker's five `D1Sandbox*Repository` classes. JSON-shaped
1844
+ // fields are stored as text JSON, parsed defensively; behaviourally identical to the D1
1845
+ // repos so the cross-runtime conformance suite asserts the same Sandbox behaviour.
1846
+ export class DrizzleSandboxPromptVersionRepository {
1847
+ db;
1848
+ constructor(db) {
1849
+ this.db = db;
1850
+ }
1851
+ async get(workspaceId, id) {
1852
+ const rows = await this.db
1853
+ .select()
1854
+ .from(sandboxPromptVersions)
1855
+ .where(and(eq(sandboxPromptVersions.workspace_id, workspaceId), eq(sandboxPromptVersions.id, id)))
1856
+ .limit(1);
1857
+ return rows[0] ? rowToSandboxPromptVersion(rows[0]) : null;
1858
+ }
1859
+ async list(workspaceId) {
1860
+ const rows = await this.db
1861
+ .select()
1862
+ .from(sandboxPromptVersions)
1863
+ .where(and(eq(sandboxPromptVersions.workspace_id, workspaceId), isNull(sandboxPromptVersions.archived_at)))
1864
+ .orderBy(desc(sandboxPromptVersions.created_at));
1865
+ return rows.map((r) => rowToSandboxPromptVersion(r));
1866
+ }
1867
+ async listByKind(workspaceId, agentKind) {
1868
+ const rows = await this.db
1869
+ .select()
1870
+ .from(sandboxPromptVersions)
1871
+ .where(and(eq(sandboxPromptVersions.workspace_id, workspaceId), eq(sandboxPromptVersions.agent_kind, agentKind), isNull(sandboxPromptVersions.archived_at)))
1872
+ .orderBy(desc(sandboxPromptVersions.created_at));
1873
+ return rows.map((r) => rowToSandboxPromptVersion(r));
1874
+ }
1875
+ async upsert(workspaceId, version) {
1876
+ const values = {
1877
+ workspace_id: workspaceId,
1878
+ id: version.id,
1879
+ lineage_id: version.lineageId,
1880
+ agent_kind: version.agentKind,
1881
+ name: version.name,
1882
+ origin: version.origin,
1883
+ system_text: version.systemText,
1884
+ base_prompt_id: version.basePromptId,
1885
+ version: version.version,
1886
+ parent_id: version.parentId,
1887
+ labels: JSON.stringify(version.labels),
1888
+ created_at: version.createdAt,
1889
+ created_by: version.createdBy,
1890
+ archived_at: version.archivedAt,
1891
+ };
1892
+ await this.db
1893
+ .insert(sandboxPromptVersions)
1894
+ .values(values)
1895
+ .onConflictDoUpdate({
1896
+ target: [sandboxPromptVersions.workspace_id, sandboxPromptVersions.id],
1897
+ set: {
1898
+ lineage_id: values.lineage_id,
1899
+ agent_kind: values.agent_kind,
1900
+ name: values.name,
1901
+ origin: values.origin,
1902
+ system_text: values.system_text,
1903
+ base_prompt_id: values.base_prompt_id,
1904
+ version: values.version,
1905
+ parent_id: values.parent_id,
1906
+ labels: values.labels,
1907
+ created_by: values.created_by,
1908
+ archived_at: values.archived_at,
1909
+ },
1910
+ });
1911
+ }
1912
+ async archive(workspaceId, id, at) {
1913
+ await this.db
1914
+ .update(sandboxPromptVersions)
1915
+ .set({ archived_at: at })
1916
+ .where(and(eq(sandboxPromptVersions.workspace_id, workspaceId), eq(sandboxPromptVersions.id, id)));
1917
+ }
1918
+ }
1919
+ export class DrizzleSandboxFixtureRepository {
1920
+ db;
1921
+ constructor(db) {
1922
+ this.db = db;
1923
+ }
1924
+ async get(workspaceId, id) {
1925
+ const rows = await this.db
1926
+ .select()
1927
+ .from(sandboxFixtures)
1928
+ .where(and(eq(sandboxFixtures.workspace_id, workspaceId), eq(sandboxFixtures.id, id)))
1929
+ .limit(1);
1930
+ return rows[0] ? rowToSandboxFixture(rows[0]) : null;
1931
+ }
1932
+ async list(workspaceId) {
1933
+ const rows = await this.db
1934
+ .select()
1935
+ .from(sandboxFixtures)
1936
+ .where(eq(sandboxFixtures.workspace_id, workspaceId))
1937
+ .orderBy(sandboxFixtures.created_at);
1938
+ return rows.map((r) => rowToSandboxFixture(r));
1939
+ }
1940
+ async upsert(workspaceId, fixture) {
1941
+ const values = {
1942
+ workspace_id: workspaceId,
1943
+ id: fixture.id,
1944
+ kind: fixture.kind,
1945
+ name: fixture.name,
1946
+ payload: fixture.payload ? JSON.stringify(fixture.payload) : null,
1947
+ repo_ref: fixture.repoRef ? JSON.stringify(fixture.repoRef) : null,
1948
+ objective: fixture.objective ? JSON.stringify(fixture.objective) : null,
1949
+ origin: fixture.origin,
1950
+ created_at: fixture.createdAt,
1951
+ };
1952
+ await this.db
1953
+ .insert(sandboxFixtures)
1954
+ .values(values)
1955
+ .onConflictDoUpdate({
1956
+ target: [sandboxFixtures.workspace_id, sandboxFixtures.id],
1957
+ set: {
1958
+ kind: values.kind,
1959
+ name: values.name,
1960
+ payload: values.payload,
1961
+ repo_ref: values.repo_ref,
1962
+ objective: values.objective,
1963
+ origin: values.origin,
1964
+ },
1965
+ });
1966
+ }
1967
+ async remove(workspaceId, id) {
1968
+ await this.db
1969
+ .delete(sandboxFixtures)
1970
+ .where(and(eq(sandboxFixtures.workspace_id, workspaceId), eq(sandboxFixtures.id, id)));
1971
+ }
1972
+ }
1973
+ export class DrizzleSandboxExperimentRepository {
1974
+ db;
1975
+ constructor(db) {
1976
+ this.db = db;
1977
+ }
1978
+ async get(workspaceId, id) {
1979
+ const rows = await this.db
1980
+ .select()
1981
+ .from(sandboxExperiments)
1982
+ .where(and(eq(sandboxExperiments.workspace_id, workspaceId), eq(sandboxExperiments.id, id)))
1983
+ .limit(1);
1984
+ return rows[0] ? rowToSandboxExperiment(rows[0]) : null;
1985
+ }
1986
+ async list(workspaceId) {
1987
+ const rows = await this.db
1988
+ .select()
1989
+ .from(sandboxExperiments)
1990
+ .where(eq(sandboxExperiments.workspace_id, workspaceId))
1991
+ .orderBy(desc(sandboxExperiments.created_at));
1992
+ return rows.map((r) => rowToSandboxExperiment(r));
1993
+ }
1994
+ async upsert(workspaceId, experiment) {
1995
+ const values = {
1996
+ workspace_id: workspaceId,
1997
+ id: experiment.id,
1998
+ name: experiment.name,
1999
+ agent_kind: experiment.agentKind,
2000
+ judge_model: experiment.judgeModel,
2001
+ repeats: experiment.repeats,
2002
+ status: experiment.status,
2003
+ matrix: JSON.stringify(experiment.matrix),
2004
+ budget_tokens: experiment.budgetTokens,
2005
+ created_at: experiment.createdAt,
2006
+ created_by: experiment.createdBy,
2007
+ };
2008
+ await this.db
2009
+ .insert(sandboxExperiments)
2010
+ .values(values)
2011
+ .onConflictDoUpdate({
2012
+ target: [sandboxExperiments.workspace_id, sandboxExperiments.id],
2013
+ set: {
2014
+ name: values.name,
2015
+ agent_kind: values.agent_kind,
2016
+ judge_model: values.judge_model,
2017
+ repeats: values.repeats,
2018
+ status: values.status,
2019
+ matrix: values.matrix,
2020
+ budget_tokens: values.budget_tokens,
2021
+ created_by: values.created_by,
2022
+ },
2023
+ });
2024
+ }
2025
+ async setStatus(workspaceId, id, status) {
2026
+ await this.db
2027
+ .update(sandboxExperiments)
2028
+ .set({ status })
2029
+ .where(and(eq(sandboxExperiments.workspace_id, workspaceId), eq(sandboxExperiments.id, id)));
2030
+ }
2031
+ async claimForRun(workspaceId, id) {
2032
+ // Conditional update: only flips a non-running experiment to `running`. `.returning()`
2033
+ // reports whether this caller won the claim (empty ⇒ already running). Atomic, so
2034
+ // concurrent launches can't both clear + re-expand the grid (see the port doc).
2035
+ const rows = await this.db
2036
+ .update(sandboxExperiments)
2037
+ .set({ status: 'running' })
2038
+ .where(and(eq(sandboxExperiments.workspace_id, workspaceId), eq(sandboxExperiments.id, id), ne(sandboxExperiments.status, 'running')))
2039
+ .returning({ id: sandboxExperiments.id });
2040
+ return rows.length > 0;
2041
+ }
2042
+ }
2043
+ export class DrizzleSandboxRunRepository {
2044
+ db;
2045
+ constructor(db) {
2046
+ this.db = db;
2047
+ }
2048
+ async get(workspaceId, id) {
2049
+ const rows = await this.db
2050
+ .select()
2051
+ .from(sandboxRuns)
2052
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.id, id)))
2053
+ .limit(1);
2054
+ return rows[0] ? rowToSandboxRun(rows[0]) : null;
2055
+ }
2056
+ async listByExperiment(workspaceId, experimentId) {
2057
+ const rows = await this.db
2058
+ .select()
2059
+ .from(sandboxRuns)
2060
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.experiment_id, experimentId)))
2061
+ .orderBy(sandboxRuns.prompt_version_id, sandboxRuns.model, sandboxRuns.fixture_id, sandboxRuns.repeat_index);
2062
+ return rows.map((r) => rowToSandboxRun(r));
2063
+ }
2064
+ async listQueued(workspaceId, experimentId) {
2065
+ const rows = await this.db
2066
+ .select()
2067
+ .from(sandboxRuns)
2068
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.experiment_id, experimentId), eq(sandboxRuns.status, 'queued')))
2069
+ .orderBy(sandboxRuns.started_at, sandboxRuns.id);
2070
+ return rows.map((r) => rowToSandboxRun(r));
2071
+ }
2072
+ async upsert(workspaceId, run) {
2073
+ const values = {
2074
+ workspace_id: workspaceId,
2075
+ id: run.id,
2076
+ experiment_id: run.experimentId,
2077
+ prompt_version_id: run.promptVersionId,
2078
+ model: run.model,
2079
+ fixture_id: run.fixtureId,
2080
+ repeat_index: run.repeatIndex,
2081
+ status: run.status,
2082
+ output_text: run.outputText,
2083
+ usage: run.usage ? JSON.stringify(run.usage) : null,
2084
+ latency_ms: run.latencyMs,
2085
+ branch: run.branch,
2086
+ pr_url: run.prUrl,
2087
+ diff: run.diff,
2088
+ error: run.error,
2089
+ seed_sha: run.seedSha,
2090
+ prompt_label: run.promptLabel,
2091
+ started_at: run.startedAt,
2092
+ finished_at: run.finishedAt,
2093
+ };
2094
+ await this.db
2095
+ .insert(sandboxRuns)
2096
+ .values(values)
2097
+ .onConflictDoUpdate({
2098
+ target: [sandboxRuns.workspace_id, sandboxRuns.id],
2099
+ set: {
2100
+ experiment_id: values.experiment_id,
2101
+ prompt_version_id: values.prompt_version_id,
2102
+ model: values.model,
2103
+ fixture_id: values.fixture_id,
2104
+ repeat_index: values.repeat_index,
2105
+ status: values.status,
2106
+ output_text: values.output_text,
2107
+ usage: values.usage,
2108
+ latency_ms: values.latency_ms,
2109
+ branch: values.branch,
2110
+ pr_url: values.pr_url,
2111
+ diff: values.diff,
2112
+ error: values.error,
2113
+ seed_sha: values.seed_sha,
2114
+ prompt_label: values.prompt_label,
2115
+ started_at: values.started_at,
2116
+ finished_at: values.finished_at,
2117
+ },
2118
+ });
2119
+ }
2120
+ async setStatus(workspaceId, id, status) {
2121
+ await this.db
2122
+ .update(sandboxRuns)
2123
+ .set({ status })
2124
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.id, id)));
2125
+ }
2126
+ async removeByExperiment(workspaceId, experimentId) {
2127
+ await this.db
2128
+ .delete(sandboxRuns)
2129
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.experiment_id, experimentId)));
2130
+ }
2131
+ }
2132
+ export class DrizzleSandboxGradeRepository {
2133
+ db;
2134
+ constructor(db) {
2135
+ this.db = db;
2136
+ }
2137
+ async getByRun(workspaceId, runId) {
2138
+ const rows = await this.db
2139
+ .select()
2140
+ .from(sandboxGrades)
2141
+ .where(and(eq(sandboxGrades.workspace_id, workspaceId), eq(sandboxGrades.run_id, runId)))
2142
+ .orderBy(desc(sandboxGrades.created_at))
2143
+ .limit(1);
2144
+ return rows[0] ? rowToSandboxGrade(rows[0]) : null;
2145
+ }
2146
+ async listByExperiment(workspaceId, experimentId) {
2147
+ const rows = await this.db
2148
+ .select({ grade: sandboxGrades })
2149
+ .from(sandboxGrades)
2150
+ .innerJoin(sandboxRuns, and(eq(sandboxRuns.workspace_id, sandboxGrades.workspace_id), eq(sandboxRuns.id, sandboxGrades.run_id)))
2151
+ .where(and(eq(sandboxGrades.workspace_id, workspaceId), eq(sandboxRuns.experiment_id, experimentId)))
2152
+ .orderBy(sandboxGrades.created_at);
2153
+ return rows.map((r) => rowToSandboxGrade(r.grade));
2154
+ }
2155
+ async upsert(workspaceId, grade) {
2156
+ const values = {
2157
+ workspace_id: workspaceId,
2158
+ id: grade.id,
2159
+ run_id: grade.runId,
2160
+ judge_model: grade.judgeModel,
2161
+ scores: JSON.stringify(grade.scores),
2162
+ weighted_total: grade.weightedTotal,
2163
+ objective: grade.objective ? JSON.stringify(grade.objective) : null,
2164
+ created_at: grade.createdAt,
2165
+ };
2166
+ await this.db
2167
+ .insert(sandboxGrades)
2168
+ .values(values)
2169
+ .onConflictDoUpdate({
2170
+ target: [sandboxGrades.workspace_id, sandboxGrades.id],
2171
+ set: {
2172
+ run_id: values.run_id,
2173
+ judge_model: values.judge_model,
2174
+ scores: values.scores,
2175
+ weighted_total: values.weighted_total,
2176
+ objective: values.objective,
2177
+ },
2178
+ });
2179
+ }
2180
+ async removeByExperiment(workspaceId, experimentId) {
2181
+ // Grades carry no experiment_id; scope them through their run's experiment.
2182
+ const runIds = this.db
2183
+ .select({ id: sandboxRuns.id })
2184
+ .from(sandboxRuns)
2185
+ .where(and(eq(sandboxRuns.workspace_id, workspaceId), eq(sandboxRuns.experiment_id, experimentId)));
2186
+ await this.db
2187
+ .delete(sandboxGrades)
2188
+ .where(and(eq(sandboxGrades.workspace_id, workspaceId), inArray(sandboxGrades.run_id, runIds)));
2189
+ }
2190
+ }
2191
+ /**
2192
+ * The Sandbox's persistence as one spreadable mixin (the Drizzle analogue of the
2193
+ * Worker's `selectSandboxDeps`). The Node container spreads `...createDrizzleSandboxDeps(db)`
2194
+ * into its dependencies so the container body never enumerates the Sandbox repos — the
2195
+ * knowledge of which repos exist lives here, next to their implementations. Typed by the
2196
+ * kernel ports (not `CoreDependencies`) so this module stays free of the orchestration import.
2197
+ */
2198
+ export function createDrizzleSandboxDeps(db) {
2199
+ return {
2200
+ sandboxPromptVersionRepository: new DrizzleSandboxPromptVersionRepository(db),
2201
+ sandboxFixtureRepository: new DrizzleSandboxFixtureRepository(db),
2202
+ sandboxExperimentRepository: new DrizzleSandboxExperimentRepository(db),
2203
+ sandboxRunRepository: new DrizzleSandboxRunRepository(db),
2204
+ sandboxGradeRepository: new DrizzleSandboxGradeRepository(db),
2205
+ };
2206
+ }
1827
2207
  /**
1828
2208
  * Per-workspace runtime settings over Postgres (the Drizzle mirror of the Worker's
1829
2209
  * `D1WorkspaceSettingsRepository`, migration 0004). One row per workspace; the service
@@ -1853,11 +2233,23 @@ export class DrizzleWorkspaceSettingsRepository {
1853
2233
  perType = null;
1854
2234
  }
1855
2235
  }
2236
+ let modelPrices = null;
2237
+ if (row.spend_model_prices) {
2238
+ try {
2239
+ modelPrices = JSON.parse(row.spend_model_prices);
2240
+ }
2241
+ catch {
2242
+ modelPrices = null;
2243
+ }
2244
+ }
1856
2245
  return {
1857
2246
  waitingEscalationMinutes: row.waiting_escalation_minutes,
1858
2247
  taskLimitMode: row.task_limit_mode,
1859
2248
  taskLimitShared: row.task_limit_shared,
1860
2249
  taskLimitPerType: perType,
2250
+ spendCurrency: row.spend_currency,
2251
+ spendMonthlyLimit: row.spend_monthly_limit,
2252
+ spendModelPrices: modelPrices,
1861
2253
  };
1862
2254
  }
1863
2255
  async upsert(workspaceId, settings) {
@@ -1869,6 +2261,11 @@ export class DrizzleWorkspaceSettingsRepository {
1869
2261
  task_limit_per_type: settings.taskLimitPerType
1870
2262
  ? JSON.stringify(settings.taskLimitPerType)
1871
2263
  : null,
2264
+ spend_currency: settings.spendCurrency,
2265
+ spend_monthly_limit: settings.spendMonthlyLimit,
2266
+ spend_model_prices: settings.spendModelPrices
2267
+ ? JSON.stringify(settings.spendModelPrices)
2268
+ : null,
1872
2269
  };
1873
2270
  await this.db
1874
2271
  .insert(workspaceSettings)
@@ -1880,6 +2277,9 @@ export class DrizzleWorkspaceSettingsRepository {
1880
2277
  task_limit_mode: values.task_limit_mode,
1881
2278
  task_limit_shared: values.task_limit_shared,
1882
2279
  task_limit_per_type: values.task_limit_per_type,
2280
+ spend_currency: values.spend_currency,
2281
+ spend_monthly_limit: values.spend_monthly_limit,
2282
+ spend_model_prices: values.spend_model_prices,
1883
2283
  },
1884
2284
  });
1885
2285
  }
@@ -1941,6 +2341,122 @@ export class DrizzleObservabilityConnectionRepository {
1941
2341
  .where(eq(observabilityConnections.workspace_id, workspaceId));
1942
2342
  }
1943
2343
  }
2344
+ /**
2345
+ * A workspace's incident-enrichment connection over Postgres (the Drizzle mirror of the
2346
+ * Worker's `D1IncidentEnrichmentConnectionRepository`, migration 0013). One row per
2347
+ * workspace; both PagerDuty + incident.io credentials live in ONE sealed JSON blob
2348
+ * (encrypted by the caller), with a non-secret `summary` presence blob.
2349
+ */
2350
+ export class DrizzleIncidentEnrichmentConnectionRepository {
2351
+ db;
2352
+ constructor(db) {
2353
+ this.db = db;
2354
+ }
2355
+ async get(workspaceId) {
2356
+ const rows = await this.db
2357
+ .select()
2358
+ .from(incidentEnrichmentConnections)
2359
+ .where(eq(incidentEnrichmentConnections.workspace_id, workspaceId))
2360
+ .limit(1);
2361
+ const row = rows[0];
2362
+ if (!row)
2363
+ return null;
2364
+ return {
2365
+ workspaceId: row.workspace_id,
2366
+ credentials: row.credentials,
2367
+ summary: row.summary,
2368
+ createdAt: row.created_at,
2369
+ updatedAt: row.updated_at,
2370
+ };
2371
+ }
2372
+ async upsert(record) {
2373
+ const values = {
2374
+ workspace_id: record.workspaceId,
2375
+ credentials: record.credentials,
2376
+ summary: record.summary,
2377
+ created_at: record.createdAt,
2378
+ updated_at: record.updatedAt,
2379
+ };
2380
+ await this.db
2381
+ .insert(incidentEnrichmentConnections)
2382
+ .values(values)
2383
+ .onConflictDoUpdate({
2384
+ target: incidentEnrichmentConnections.workspace_id,
2385
+ set: {
2386
+ credentials: values.credentials,
2387
+ summary: values.summary,
2388
+ updated_at: values.updated_at,
2389
+ },
2390
+ });
2391
+ }
2392
+ async delete(workspaceId) {
2393
+ await this.db
2394
+ .delete(incidentEnrichmentConnections)
2395
+ .where(eq(incidentEnrichmentConnections.workspace_id, workspaceId));
2396
+ }
2397
+ }
2398
+ /**
2399
+ * Per-account (deployment-wide) settings over Postgres (the Drizzle mirror of the Worker's
2400
+ * `D1AccountSettingsRepository`, migration 0014). One row per account; `config` + `summary`
2401
+ * are non-secret JSON, the ONE sealed `secrets_cipher` blob is encrypted by the caller.
2402
+ */
2403
+ export class DrizzleAccountSettingsRepository {
2404
+ db;
2405
+ constructor(db) {
2406
+ this.db = db;
2407
+ }
2408
+ async getByAccount(accountId) {
2409
+ const rows = await this.db
2410
+ .select()
2411
+ .from(accountSettings)
2412
+ .where(eq(accountSettings.account_id, accountId))
2413
+ .limit(1);
2414
+ const row = rows[0];
2415
+ if (!row)
2416
+ return null;
2417
+ return {
2418
+ accountId: row.account_id,
2419
+ config: row.config,
2420
+ secretsCipher: row.secrets_cipher,
2421
+ summary: row.summary,
2422
+ createdAt: row.created_at,
2423
+ updatedAt: row.updated_at,
2424
+ };
2425
+ }
2426
+ async upsert(record) {
2427
+ const values = {
2428
+ account_id: record.accountId,
2429
+ config: record.config,
2430
+ secrets_cipher: record.secretsCipher,
2431
+ summary: record.summary,
2432
+ created_at: record.createdAt,
2433
+ updated_at: record.updatedAt,
2434
+ };
2435
+ await this.db
2436
+ .insert(accountSettings)
2437
+ .values(values)
2438
+ .onConflictDoUpdate({
2439
+ target: accountSettings.account_id,
2440
+ set: {
2441
+ config: values.config,
2442
+ secrets_cipher: values.secrets_cipher,
2443
+ summary: values.summary,
2444
+ updated_at: values.updated_at,
2445
+ },
2446
+ });
2447
+ }
2448
+ async listAll() {
2449
+ const rows = await this.db.select().from(accountSettings);
2450
+ return rows.map((row) => ({
2451
+ accountId: row.account_id,
2452
+ config: row.config,
2453
+ secretsCipher: row.secrets_cipher,
2454
+ summary: row.summary,
2455
+ createdAt: row.created_at,
2456
+ updatedAt: row.updated_at,
2457
+ }));
2458
+ }
2459
+ }
1944
2460
  function parseReleaseIds(json) {
1945
2461
  try {
1946
2462
  const parsed = JSON.parse(json);
@@ -2042,6 +2558,8 @@ export function createDrizzleRepositories(db, clock) {
2042
2558
  mergePresetRepository: new DrizzleMergePresetRepository(db),
2043
2559
  workspaceSettingsRepository: new DrizzleWorkspaceSettingsRepository(db),
2044
2560
  observabilityConnectionRepository: new DrizzleObservabilityConnectionRepository(db),
2561
+ incidentEnrichmentConnectionRepository: new DrizzleIncidentEnrichmentConnectionRepository(db),
2562
+ accountSettingsRepository: new DrizzleAccountSettingsRepository(db),
2045
2563
  releaseHealthConfigRepository: new DrizzleReleaseHealthConfigRepository(db),
2046
2564
  };
2047
2565
  }