Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(auto): 对结构化授权历史使用完整摘要重放
Dash692618bd60a8
diff --git a/apps/desktop/src/main/localDb/__tests__/autoReviewProjection.test.ts b/apps/desktop/src/main/localDb/__tests__/autoReviewProjection.test.tsindex 6e156a0957..8796676b2b 100644--- a/apps/desktop/src/main/localDb/__tests__/autoReviewProjection.test.ts+++ b/apps/desktop/src/main/localDb/__tests__/autoReviewProjection.test.ts@@ -113,13 +113,21 @@ describe('durable Auto authority projection', () => {const incremental=read(db);expect(JSON.stringify(incremental.reviewIntent)).toContain(text);expect(incremental.reviewIntent).toMatchObject({historyOmitted:true});- if(session==='worker') expect(JSON.stringify(incremental.sessionIntent)).toContain(text);+ if(session==='worker') {+ expect(JSON.stringify(incremental.sessionIntent)).toContain(text);+ expect(incremental.sessionIntent).toMatchObject({historyOmitted:true});+ }+ db.prepare('INSERT INTO messages VALUES (?,?,?,?,?,?,?,NULL)').run(+ 'resource', 'worker', 'resource', 'user', JSON.stringify({text:'use this file',files:[{}]}),+ 4, JSON.stringify({delivery:'turn',autoReviewUserText:'use this file'}));+ const afterResource = read(db);+ if(session==='worker') expect(afterResource.sessionIntent).toMatchObject({historyOmitted:true});const old=JSON.parse(stored(db).payload);db.prepare('UPDATE auto_review_projections SET version=2,payload=?').run(JSON.stringify({...old,sessionIntent:'publish',reviewIntent:'publish',reviewUnverified:false}));const restarted=open(filename,false);const rebuilt=read(restarted);- expect(rebuilt.sessionIntent).toEqual(incremental.sessionIntent);- expect(rebuilt.reviewIntent).toEqual(incremental.reviewIntent);+ expect(rebuilt.sessionIntent).toEqual(afterResource.sessionIntent);+ expect(rebuilt.reviewIntent).toEqual(afterResource.reviewIntent);expect(restarted.prepare('SELECT version FROM auto_review_projections').get()).toEqual({version:3});});it.each([diff --git a/apps/desktop/src/main/localDb/autoReviewProjection.ts b/apps/desktop/src/main/localDb/autoReviewProjection.tsindex f91f5c18dc..87ae75afe3 100644--- a/apps/desktop/src/main/localDb/autoReviewProjection.ts+++ b/apps/desktop/src/main/localDb/autoReviewProjection.ts@@ -112,6 +112,8 @@ export function readAutoReviewProjection(}, 0),});});+ // Ambiguous trigger receipts use full replay. Once history is omitted, only+ // a canonical text-only event can use the string append fast path.// The source query is evaluated by SQLite, not a reentrant database call// inside the UDF. Both summaries and the transcript commit or roll back together.db.exec(`CREATE TEMP TABLE IF NOT EXISTS auto_review_projection_batch(depth INTEGER NOT NULL);@@ -122,6 +124,16 @@ export function readAutoReviewProjection(UPDATE auto_review_projections SET payload = cindy_authority_projection_v1(CASE WHEN OLD.projected_revision = OLD.revision AND OLD.version = 3AND json_extract(NEW.payload, '$.appendEvent.role') = 'user'AND json_extract(NEW.payload, '$.appendEvent.visible') = 1+ AND (coalesce(CASE WHEN json_valid(OLD.payload) THEN json_extract(OLD.payload, '$.sessionIntent.historyOmitted') ELSE NULL END, 0) = 0+ OR CASE WHEN json_valid(json_extract(NEW.payload, '$.appendEvent.agentMeta')) THEN+ json_type(json_extract(NEW.payload, '$.appendEvent.agentMeta'), '$.autoReviewUserText') = 'text'+ AND json_extract(json_extract(NEW.payload, '$.appendEvent.agentMeta'), '$.delivery') IN ('turn','steer')+ AND json_extract(NEW.payload, '$.appendEvent.content') = json_object('text',+ json_extract(json_extract(NEW.payload, '$.appendEvent.agentMeta'), '$.autoReviewUserText'))+ ELSE 0 END)+ AND coalesce(CASE WHEN json_valid(json_extract(NEW.payload, '$.appendEvent.agentMeta'))+ THEN substr(json_extract(json_extract(NEW.payload, '$.appendEvent.agentMeta'), '$.autoReviewUserText'), 1, 19)+ ELSE NULL END, '') <> '[UI_ACTION_TRIGGER]'AND json_extract(NEW.payload, '$.appendEvent.createdAt') > (CASE WHEN json_valid(OLD.payload) THEN json_extract(OLD.payload, '$.lastEventAt') ELSE NULL END)THEN NULL ELSE (SELECT json_group_array(json_object('sessionId', session_id, 'clientId', client_id,