UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.28 kB
import{t as e}from"./transcript-async-context-CWIqzhI4.mjs";import{t}from"./transcript-session-transcript-read-fence-error-DfU0swK6.mjs";import{a as n}from"./transcript-openclaw-agent-db.paths-DbFl2s5M.mjs";const r=new e(Symbol(`sessionTranscriptReadFence`));function isSameTranscriptStore(e,t){return e===t||n(e,t)}new e(Symbol(`sessionTranscriptQuestionAnswers`));function runWithSessionTranscriptReadFence(e,t){return e?r.run(e,t):t()}function resolveSessionTranscriptReadFence(e){let t=r.getStore();return t?.agentId===e.agentId&&t.sessionId===e.sessionId?t:void 0}function resolveSqliteSessionTranscriptReadFence(e){let n=resolveSessionTranscriptReadFence(e);if(n){if(n.role!==`user`)throw new t(`Current-turn transcript admission is not a user message: ${n.entryId}`);if(!isSameTranscriptStore(e.database.path,n.storePath))throw new t(`Current-turn transcript admission belongs to a different transcript store`);if(e.sessionKey!==void 0&&e.sessionKey!==n.sessionKey)throw new t(`Current-turn transcript admission belongs to a different session key`);return{admission:n,beforeActiveMessagePosition:n.activeMessagePosition,beforeRawSeq:n.rawSeq}}}export{resolveSqliteSessionTranscriptReadFence as n,runWithSessionTranscriptReadFence as r,resolveSessionTranscriptReadFence as t};