@cat-factory/node-server 0.75.3 → 0.77.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.
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +28 -5
- package/dist/container.js.map +1 -1
- package/dist/db/schema.d.ts +172 -0
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +21 -0
- package/dist/db/schema.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/realtime.d.ts +2 -1
- package/dist/realtime.d.ts.map +1 -1
- package/dist/realtime.js +3 -0
- package/dist/realtime.js.map +1 -1
- package/dist/repositories/drizzle.d.ts +17 -1
- package/dist/repositories/drizzle.d.ts.map +1 -1
- package/dist/repositories/drizzle.js +82 -1
- package/dist/repositories/drizzle.js.map +1 -1
- package/drizzle/20260705111135_gigantic_spyke/migration.sql +16 -0
- package/drizzle/20260705111135_gigantic_spyke/snapshot.json +14308 -0
- package/package.json +22 -22
|
@@ -2,7 +2,7 @@ import { LLM_WARNING_FINISH_REASONS } from '@cat-factory/kernel';
|
|
|
2
2
|
import { agentRunKindSchema, decodeInitiativeRow } from '@cat-factory/contracts';
|
|
3
3
|
import { decodeEnum, tryDecodeRows, blockInsertValues, blockPatchToColumns, parseIssueIntakeColumn, serializeIssueIntakeColumn, rowToBlock, rowToExecution, executionToDetail, rowToPipeline, rowToSandboxExperiment, rowToSandboxFixture, rowToSandboxGrade, rowToSandboxPromptVersion, rowToSandboxRun, rowToWorkspace, } from '@cat-factory/server';
|
|
4
4
|
import { and, asc, count, desc, eq, gte, inArray, isNull, lt, ne, notInArray, or, sql, } from 'drizzle-orm';
|
|
5
|
-
import { accountInvitations, passwordResetTokens, accountSettings, localSettings, accounts, agentContextSnapshots, agentRuns, blocks, consensusSessions, incidentEnrichmentConnections, observabilityConnections, packageRegistryConnections, emailConnections, llmCallMetrics, provisioningLog, memberships, mergeThresholdPresets, releaseHealthConfigs, pipelineScheduleRuns, pipelineSchedules, pipelines, requirementReviews, kaizenGradings, kaizenVerifiedCombos, clarityReviews, binaryArtifacts, brainstormSessions, initiatives, sandboxPromptVersions, sandboxFixtures, sandboxExperiments, sandboxRuns, sandboxGrades, services, tokenUsage, trackerSettings, modelPresets, userIdentities, users, workspaceFragmentDefaults, workspaceServices, workspaceSettings, workspaces, } from '../db/schema.js';
|
|
5
|
+
import { accountInvitations, passwordResetTokens, accountSettings, localSettings, accounts, agentContextSnapshots, agentRuns, blocks, consensusSessions, incidentEnrichmentConnections, observabilityConnections, packageRegistryConnections, emailConnections, llmCallMetrics, provisioningLog, memberships, mergeThresholdPresets, releaseHealthConfigs, pipelineScheduleRuns, pipelineSchedules, pipelines, requirementReviews, docInterviewSessions, kaizenGradings, kaizenVerifiedCombos, clarityReviews, binaryArtifacts, brainstormSessions, initiatives, sandboxPromptVersions, sandboxFixtures, sandboxExperiments, sandboxRuns, sandboxGrades, services, tokenUsage, trackerSettings, modelPresets, userIdentities, users, workspaceFragmentDefaults, workspaceServices, workspaceSettings, workspaces, } from '../db/schema.js';
|
|
6
6
|
// Drizzle/Postgres implementations of the core kernel repository ports. The
|
|
7
7
|
// row<->domain mapping is the SAME shared mapping the Cloudflare D1 repos use
|
|
8
8
|
// (@cat-factory/server), so behaviour matches across stores; this layer only owns
|
|
@@ -2035,6 +2035,86 @@ export class DrizzleRequirementReviewRepository {
|
|
|
2035
2035
|
.where(and(eq(requirementReviews.workspace_id, workspaceId), eq(requirementReviews.block_id, blockId)));
|
|
2036
2036
|
}
|
|
2037
2037
|
}
|
|
2038
|
+
function rowToDocInterviewSession(row) {
|
|
2039
|
+
return {
|
|
2040
|
+
id: row.id,
|
|
2041
|
+
blockId: row.block_id,
|
|
2042
|
+
status: row.status,
|
|
2043
|
+
round: row.round,
|
|
2044
|
+
maxRounds: row.max_rounds,
|
|
2045
|
+
qa: parseJsonArray(row.qa),
|
|
2046
|
+
brief: row.brief,
|
|
2047
|
+
model: row.model,
|
|
2048
|
+
createdAt: row.created_at,
|
|
2049
|
+
updatedAt: row.updated_at,
|
|
2050
|
+
};
|
|
2051
|
+
}
|
|
2052
|
+
/**
|
|
2053
|
+
* Interactive document-interview sessions over Postgres (the Drizzle mirror of the Worker's
|
|
2054
|
+
* `D1DocInterviewRepository`, migration 0040). The Q&A live as a JSON array in `qa`; the service
|
|
2055
|
+
* keeps at most one live session per block, so `getByBlock` returns the latest. Behaviourally
|
|
2056
|
+
* identical to the D1 repo so the cross-runtime conformance suite asserts the same interview
|
|
2057
|
+
* brief substitution against both stores.
|
|
2058
|
+
*/
|
|
2059
|
+
export class DrizzleDocInterviewRepository {
|
|
2060
|
+
db;
|
|
2061
|
+
constructor(db) {
|
|
2062
|
+
this.db = db;
|
|
2063
|
+
}
|
|
2064
|
+
async getByBlock(workspaceId, blockId) {
|
|
2065
|
+
const rows = await this.db
|
|
2066
|
+
.select()
|
|
2067
|
+
.from(docInterviewSessions)
|
|
2068
|
+
.where(and(eq(docInterviewSessions.workspace_id, workspaceId), eq(docInterviewSessions.block_id, blockId)))
|
|
2069
|
+
.orderBy(desc(docInterviewSessions.created_at))
|
|
2070
|
+
.limit(1);
|
|
2071
|
+
return rows[0] ? rowToDocInterviewSession(rows[0]) : null;
|
|
2072
|
+
}
|
|
2073
|
+
async get(workspaceId, id) {
|
|
2074
|
+
const rows = await this.db
|
|
2075
|
+
.select()
|
|
2076
|
+
.from(docInterviewSessions)
|
|
2077
|
+
.where(and(eq(docInterviewSessions.workspace_id, workspaceId), eq(docInterviewSessions.id, id)))
|
|
2078
|
+
.limit(1);
|
|
2079
|
+
return rows[0] ? rowToDocInterviewSession(rows[0]) : null;
|
|
2080
|
+
}
|
|
2081
|
+
async upsert(workspaceId, session) {
|
|
2082
|
+
const values = {
|
|
2083
|
+
workspace_id: workspaceId,
|
|
2084
|
+
id: session.id,
|
|
2085
|
+
block_id: session.blockId,
|
|
2086
|
+
status: session.status,
|
|
2087
|
+
round: session.round,
|
|
2088
|
+
max_rounds: session.maxRounds,
|
|
2089
|
+
qa: JSON.stringify(session.qa ?? []),
|
|
2090
|
+
brief: session.brief,
|
|
2091
|
+
model: session.model,
|
|
2092
|
+
created_at: session.createdAt,
|
|
2093
|
+
updated_at: session.updatedAt,
|
|
2094
|
+
};
|
|
2095
|
+
await this.db
|
|
2096
|
+
.insert(docInterviewSessions)
|
|
2097
|
+
.values(values)
|
|
2098
|
+
.onConflictDoUpdate({
|
|
2099
|
+
target: [docInterviewSessions.workspace_id, docInterviewSessions.id],
|
|
2100
|
+
set: {
|
|
2101
|
+
block_id: values.block_id,
|
|
2102
|
+
status: values.status,
|
|
2103
|
+
round: values.round,
|
|
2104
|
+
max_rounds: values.max_rounds,
|
|
2105
|
+
qa: values.qa,
|
|
2106
|
+
brief: values.brief,
|
|
2107
|
+
model: values.model,
|
|
2108
|
+
updated_at: values.updated_at,
|
|
2109
|
+
},
|
|
2110
|
+
});
|
|
2111
|
+
}
|
|
2112
|
+
async deleteByBlock(workspaceId, blockId) {
|
|
2113
|
+
await this.db
|
|
2114
|
+
.delete(docInterviewSessions)
|
|
2115
|
+
.where(and(eq(docInterviewSessions.workspace_id, workspaceId), eq(docInterviewSessions.block_id, blockId)));
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2038
2118
|
function rowToKaizenGrading(row) {
|
|
2039
2119
|
return {
|
|
2040
2120
|
id: row.id,
|
|
@@ -3513,6 +3593,7 @@ export function createDrizzleRepositories(db, clock) {
|
|
|
3513
3593
|
serviceRepository: new DrizzleServiceRepository(db),
|
|
3514
3594
|
workspaceMountRepository: new DrizzleWorkspaceMountRepository(db),
|
|
3515
3595
|
requirementReviewRepository: new DrizzleRequirementReviewRepository(db),
|
|
3596
|
+
docInterviewRepository: new DrizzleDocInterviewRepository(db),
|
|
3516
3597
|
kaizenGradingRepository: new DrizzleKaizenGradingRepository(db),
|
|
3517
3598
|
kaizenVerifiedComboRepository: new DrizzleKaizenVerifiedComboRepository(db),
|
|
3518
3599
|
consensusSessionRepository: new DrizzleConsensusSessionRepository(db),
|