UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.25 kB
import{l as isRecord}from"./record-coerce-BTbqdJ3-.mjs"; //!src/agents/code-mode-session-store-replay.ts const CODE_MODE_STORE_CUSTOM_TYPE=`openclaw.code-mode-store`;function readCodeModeStoreKey(e){if(typeof e!==`string`||e.length===0||e.length>256)throw new TypeError(`Code Mode store key must be a non-empty string of at most 256 characters.`);return e}function collectCodeModeStoreWrites(e,t=false){const n=/* @__PURE__ */ new Map;for(const r of e){if(!isRecord(r)||r.type!==`custom`||r.customType!==`openclaw.code-mode-store`)continue;const e=r.data;if(!isRecord(e)||!isRecord(e.set)||!Array.isArray(e.delete)||!isRecord(e.networkContent))throw new Error(`Code Mode session store contains an invalid transcript entry; repair the session before using store/load.`);for(const[t,r]of Object.entries(e.set)){const i=e.networkContent[t];if(typeof i!==`boolean`)throw new Error(`Code Mode session store contains invalid content provenance; repair the session before using store/load.`);n.set(readCodeModeStoreKey(t),{value:r,networkContent:i})}for(const r of e.delete){const e=readCodeModeStoreKey(r);if(t)n.set(e,null);else n.delete(e)}}return n}export{collectCodeModeStoreWrites as n,readCodeModeStoreKey as r,CODE_MODE_STORE_CUSTOM_TYPE as t};