UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

44 lines (43 loc) • 1.91 kB
import { o as resolveOpenClawStateSqlitePath } from "./openclaw-state-db.paths-5PCLNGIM.mjs"; import { yt as cloneEnvWithPlatformSemantics } from "./openclaw-state-db-cache-D7C7Hg5y.mjs"; import { n as HostedCatalogSignedFeedMonotonicityError } from "./official-external-plugin-catalog-source-CkTuOl59.mjs"; import { n as captureOpenClawStateWorkerContext } from "./openclaw-state-worker-context-GPo8ZZmA.mjs"; //#region src/plugins/official-external-plugin-catalog-snapshot-store.ts /** Persists hosted official plugin catalog snapshots through the shared-state worker. */ function resolveDatabaseOptions(e) { const t = cloneEnvWithPlatformSemantics(e.env ?? process.env); if (e.stateDir) t.OPENCLAW_STATE_DIR = e.stateDir; return { env: t, path: e.stateDatabasePath || resolveOpenClawStateSqlitePath(t) }; } /** Creates a snapshot store backed by the shared `state/openclaw.sqlite` database. */ function createSqliteHostedOfficialExternalPluginCatalogSnapshotStore(e = {}) { return { async read(t) { const n = resolveDatabaseOptions(e); const r = captureOpenClawStateWorkerContext(n); const { runOpenClawStateWorkerOperation: i } = await import("./openclaw-state-worker-store-Da4Nk7Zx.mjs"); return await i(r, (e) => e.execute({ type: "plugins.catalogSnapshot.read", input: { url: t } }), { existingOnly: true }) ?? null; }, async write(t) { const n = Date.now(); const r = captureOpenClawStateWorkerContext(resolveDatabaseOptions(e)); const { runOpenClawStateWorkerOperation: i } = await import("./openclaw-state-worker-store-Da4Nk7Zx.mjs"); const a = await i(r, (e) => e.execute({ type: "plugins.catalogSnapshot.write", input: { snapshot: t, now: n } })); if (!a.ok) throw new HostedCatalogSignedFeedMonotonicityError(a.message); } }; } //#endregion export { createSqliteHostedOfficialExternalPluginCatalogSnapshotStore };