style: apply prettier formatting
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { Database } from 'bun:sqlite';
|
||||
|
||||
import {
|
||||
ARBITER_AGENT_TYPE,
|
||||
REVIEWER_AGENT_TYPE,
|
||||
} from '../config.js';
|
||||
import { ARBITER_AGENT_TYPE, REVIEWER_AGENT_TYPE } from '../config.js';
|
||||
import {
|
||||
collectRegisteredAgentTypes,
|
||||
collectRegisteredAgentTypesForFolder,
|
||||
|
||||
@@ -570,22 +570,25 @@ function backfillCanonicalWorkItemServiceIds(database: Database): void {
|
||||
SET service_id = ?
|
||||
WHERE id = ?`,
|
||||
);
|
||||
const tx = database.transaction((workItemRows: StoredWorkItemServiceRow[]) => {
|
||||
for (const row of workItemRows) {
|
||||
const agentType = normalizeStoredAgentType(row.agent_type) ?? 'claude-code';
|
||||
const deliveryRole = normalizePairedRole(row.delivery_role) ?? 'owner';
|
||||
const serviceId =
|
||||
(row.service_id ? normalizeServiceId(row.service_id) : null) ??
|
||||
resolveRoleServiceShadow(deliveryRole, agentType) ??
|
||||
SERVICE_SESSION_SCOPE;
|
||||
const tx = database.transaction(
|
||||
(workItemRows: StoredWorkItemServiceRow[]) => {
|
||||
for (const row of workItemRows) {
|
||||
const agentType =
|
||||
normalizeStoredAgentType(row.agent_type) ?? 'claude-code';
|
||||
const deliveryRole = normalizePairedRole(row.delivery_role) ?? 'owner';
|
||||
const serviceId =
|
||||
(row.service_id ? normalizeServiceId(row.service_id) : null) ??
|
||||
resolveRoleServiceShadow(deliveryRole, agentType) ??
|
||||
SERVICE_SESSION_SCOPE;
|
||||
|
||||
if (row.service_id === serviceId) {
|
||||
continue;
|
||||
if (row.service_id === serviceId) {
|
||||
continue;
|
||||
}
|
||||
|
||||
update.run(serviceId, row.id);
|
||||
}
|
||||
|
||||
update.run(serviceId, row.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
tx(rows);
|
||||
}
|
||||
@@ -735,7 +738,10 @@ export function applySchemaMigrations(
|
||||
database,
|
||||
`ALTER TABLE work_items ADD COLUMN delivery_role TEXT`,
|
||||
);
|
||||
tryExecMigration(database, `ALTER TABLE work_items ADD COLUMN service_id TEXT`);
|
||||
tryExecMigration(
|
||||
database,
|
||||
`ALTER TABLE work_items ADD COLUMN service_id TEXT`,
|
||||
);
|
||||
|
||||
database.exec(
|
||||
`UPDATE service_handoffs
|
||||
@@ -766,7 +772,10 @@ export function applySchemaMigrations(
|
||||
'reviewer_agent_type',
|
||||
'arbiter_agent_type',
|
||||
]) {
|
||||
tryExecMigration(database, `ALTER TABLE channel_owner ADD COLUMN ${column} TEXT`);
|
||||
tryExecMigration(
|
||||
database,
|
||||
`ALTER TABLE channel_owner ADD COLUMN ${column} TEXT`,
|
||||
);
|
||||
}
|
||||
|
||||
backfillCanonicalPairedTaskServiceIds(database);
|
||||
@@ -1127,5 +1136,4 @@ export function applySchemaMigrations(
|
||||
} catch {
|
||||
/* columns already exist */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -86,7 +86,8 @@ function resolvePreferredWorkItemRole(
|
||||
return null;
|
||||
}
|
||||
|
||||
const inferredAgentType = inferAgentTypeFromServiceShadow(normalizedServiceId);
|
||||
const inferredAgentType =
|
||||
inferAgentTypeFromServiceShadow(normalizedServiceId);
|
||||
return inferRoleFromServiceShadow(inferredAgentType, normalizedServiceId);
|
||||
}
|
||||
|
||||
@@ -131,9 +132,7 @@ export function getOpenWorkItemFromDatabase(
|
||||
normalizedServiceId,
|
||||
preferredRole,
|
||||
preferredRole,
|
||||
) as
|
||||
| StoredWorkItemRow
|
||||
| undefined;
|
||||
) as StoredWorkItemRow | undefined;
|
||||
return row ? hydrateWorkItemRow(row) : undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user