UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

34 lines (33 loc) • 1.44 kB
import { i as isSqliteWorkerError } from "../sqlite-worker-error-DEIJgRIz.mjs"; import { l as OPENCLAW_SQLITE_BUSY_TIMEOUT_MS } from "../openclaw-state-db-contract-DfPjvL0M.mjs"; import { l as runSqliteWorkerTransactionSync } from "../sqlite-transaction-BHHu6P5-.mjs"; import "../sqlite-worker-contract--dxXkOty.mjs"; import { n as prepareSessionProgressCardWrite, r as writePreparedSessionProgressCard } from "../progress-card-store-BAgqM1KQ.mjs"; import { t as bindSqliteWorkerDatabase } from "../sqlite-worker-binding-B4BB5u5i.mjs"; import { t as encodeSqliteWorkerDomainError } from "../sqlite-worker-domain-error-CGsRRv7G.mjs"; //#region src/session-cards/progress-card-store.worker.ts /** Borrows the canonical agent writer connection; reset shares its row kernel. */ function bindSqliteWorkerBackend(e, t) { const n = t.database; return bindSqliteWorkerDatabase(n, { execute(e) { const r = prepareSessionProgressCardWrite(e.input); try { return { ok: true, value: runSqliteWorkerTransactionSync(t, () => writePreparedSessionProgressCard(n, e.input.sessionKey, r), { databaseLabel: t.databasePath, operationLabel: "progress-card.put", busyTimeoutMs: OPENCLAW_SQLITE_BUSY_TIMEOUT_MS }) }; } catch (e) { if (isSqliteWorkerError(e, "closed")) throw e; return { ok: false, error: encodeSqliteWorkerDomainError(n, e) }; } } }); } //#endregion export { bindSqliteWorkerBackend };