fix(context): Fix snapshot recovery across sessions. (#26939)

This commit is contained in:
joshualitt
2026-05-18 09:44:59 -07:00
committed by GitHub
parent 9d01958cdb
commit 055e0f6452
57 changed files with 3143 additions and 751 deletions
+20
View File
@@ -0,0 +1,20 @@
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { createHash } from 'node:crypto';
/**
* Derives a stable, deterministic ID from a list of source IDs.
* Used for synthetic turns like summaries to ensure that re-summarizing the same
* content produces a consistent identity.
*/
export function deriveStableId(sourceIds: string[]): string {
const sortedIds = [...sourceIds].sort();
return createHash('sha256')
.update(sortedIds.join('|'))
.digest('hex')
.slice(0, 32);
}