Q156: approval history pages back and opens each decision in full

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-09 02:01:21 -04:00
1 parent 41359e268a
commit 71ac5085cd
12 files changed
+243 -130

No files matched your search

+1 -1
View File
@@ -69,7 +69,7 @@ export const platformContracts = {
refreshComposioAccounts: z.strictObject({ orgId: id }) satisfies z.ZodType<C.RefreshComposioAccountsInput>,
grantConnector: z.strictObject({ orgId: id, agentId: id, toolkitSlug: z.string(), accountLabel: z.string(), employeeId: id }) satisfies z.ZodType<C.GrantConnectorInput>,
revokeConnector: z.strictObject({ orgId: id, agentId: id, toolkitSlug: z.string() }) satisfies z.ZodType<C.RevokeConnectorInput>,
approvalDrifts: z.strictObject({ orgId: id }),
approvalDrifts: z.strictObject({ orgId: id, approvalIds: z.array(id).max(1000) }),
runRequests: z.strictObject({ orgId: id, runId: id }),
chatThreadHistory: z.strictObject({ orgId: id, threadId: id }),
chatSpaceHistory: z.union([
+1 -1
View File
@@ -420,7 +420,7 @@ export function registerIpcHandlers(deps: IpcDeps): void {
handle("chatSpaceHistory", (input) => ok(spaceHistory(deps.connection.db, input.orgId, input.spaceId, input.beforeMessageId, "limit" in input ? { limit: input.limit } : { fromMessageId: input.fromMessageId })));
handle("approvalDrifts", (input) => {
try {
return ok(approvalDrifts(deps.connection.db, input.orgId));
return ok(approvalDrifts(deps.connection.db, input.orgId, input.approvalIds));
} catch (error) {
return fail("approval_drift_failed", error instanceof Error ? error.message : String(error));
}
+4 -6
View File
@@ -3,15 +3,13 @@ import { existsSync, readFileSync } from "node:fs";
import type { DatabaseSync } from "node:sqlite";
import { parseApprovalPin, type ApprovalDrift, type ApprovalPin } from "../../shared/approval-pin";
const CHECKED_APPROVALS = 24;
/** Approved deliverables whose content no longer matches what was approved, read from disk and the library now. */
export function approvalDrifts(db: DatabaseSync, orgId: string): Record<string, ApprovalDrift> {
/** Of the given approvals (those the reader has on screen), the approved deliverables whose content no longer matches what was approved. */
export function approvalDrifts(db: DatabaseSync, orgId: string, approvalIds: string[]): Record<string, ApprovalDrift> {
const rows = db.prepare(`
select id, subject_snapshot from approvals
where org_id = ? and state = 'approved' and kind = 'deliverable_review' and subject_snapshot is not null
order by decided_at desc limit ?
`).all(orgId, CHECKED_APPROVALS) as Array<{ id: string; subject_snapshot: string }>;
and id in (select value from json_each(?))
`).all(orgId, JSON.stringify(approvalIds)) as Array<{ id: string; subject_snapshot: string }>;
const drifts: Record<string, ApprovalDrift> = {};
for (const row of rows) {
const pin = parseApprovalPin(row.subject_snapshot);