{"version":3,"file":"derive-id.mjs","names":[],"sources":["../../../../../../../ai/src/memory/derive-id.ts"],"sourcesContent":["/**\n * Derive a stable memory id from its text when the caller didn't supply\n * one. Re-remembering identical text therefore lands on the same id and\n * overwrites in place rather than duplicating.\n *\n * FNV-1a variant — cheap, dependency-free, collision-resistant enough\n * for de-duplicating memory entries. NOT cryptographic: a collision\n * would merge two distinct memories, not breach security in the current\n * trust model. Mirrors the prompt hash in\n * `middleware/builtins/semantic-cache.ts`.\n */\nexport function deriveMemoryId(text: string): string {\n  let hash = 0x811c9dc5;\n\n  for (let index = 0; index < text.length; index++) {\n    hash ^= text.charCodeAt(index);\n    hash = Math.imul(hash, 0x01000193);\n  }\n\n  return (hash >>> 0).toString(16);\n}\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,eAAe,MAAsB;CACnD,IAAI,OAAO;CAEX,KAAK,IAAI,QAAQ,GAAG,QAAQ,KAAK,QAAQ,SAAS;EAChD,QAAQ,KAAK,WAAW,KAAK;EAC7B,OAAO,KAAK,KAAK,MAAM,QAAU;CACnC;CAEA,QAAQ,SAAS,EAAC,CAAE,SAAS,EAAE;AACjC"}