UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

38 lines (37 loc) • 1.76 kB
import { n as normalizeConfigMachineStateKey } from "./config-machine-state-row-XCKCxfWg.mjs"; import { r as withArtifactPreservingStateReads } from "./artifact-preserving-state-reads-BfhmBr-V.mjs"; import { n as executeExistingOpenClawStateRead } from "./openclaw-state-db-readonly-B6YHb1oF.mjs"; import { r as captureOpenClawStateWorkerContext } from "./openclaw-state-worker-context-DAKL_dnZ.mjs"; import { s as createAuthProfileCredentialWriteAdmission } from "./user-model-account-authority-CRj924IP.mjs"; //#region src/state/config-machine-state-async.ts async function readConfigMachineStateAsync(e, t = {}, n = {}) { const read = () => executeExistingOpenClawStateRead(t, { type: "machineState.read", input: { key: e } }); const r = await (n.artifactPreservingReadOnly ? withArtifactPreservingStateReads(read) : read()); if (!r) return; return r.row ? JSON.parse(r.row.value_json) : void 0; } async function readVoiceWakeMachineState(e, t = {}) { const n = await executeExistingOpenClawStateRead(t, { type: e }); if (!n) return; return n.row ? { value: JSON.parse(n.row.value_json), updatedAtMs: n.row.updated_at_ms } : void 0; } async function writeConfigMachineStateAsync(e, t, n = {}) { const { runOpenClawStateWorkerOperation: r } = await import("./openclaw-state-worker-store-BURqchns.mjs"); const i = normalizeConfigMachineStateKey(e); const a = captureOpenClawStateWorkerContext(n); return r(a, (e) => e.execute({ type: "machineState.write", input: { key: i, value: t } }), i === "authProfiles.store" ? { createAdmission: createAuthProfileCredentialWriteAdmission(a) } : void 0); } //#endregion export { readVoiceWakeMachineState as n, writeConfigMachineStateAsync as r, readConfigMachineStateAsync as t };