mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-16 04:50:29 -07:00
fix(context): Fix snapshot recovery across sessions. (#26939)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user