UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.66 kB
import{s as e,x as t}from"./openclaw-state-read-sqlite-database-admission-Ck6VG7rE.mjs";import{a as n}from"./openclaw-state-read-record-coerce-D1s3ReAs.mjs";import{a as r,i}from"./openclaw-state-read-kysely-sync-DQyYiAw5.mjs";import{o as a}from"./openclaw-state-read-openclaw-state-db-schema-helpers-BkqUYEFY.mjs";import{isMainThread as o}from"node:worker_threads";const s={name:`auth-profiles.rows`,read:e=>n(e)?e:void 0};function publishAuthProfileRowsChanged(e){t(e,s,{})}const c={name:`model-catalog.remote`,read:e=>n(e)?e:void 0},l={name:`state.tts-prefs-path`,read(e){if(!n(e))return;let t=e.row;if(t===void 0)return{row:void 0};if(n(t)&&typeof t.value_json==`string`&&typeof t.updated_at_ms==`number`)return{row:{value_json:t.value_json,updated_at_ms:t.updated_at_ms}}}};function publishConfigMachineStateRow(e,n,r){n===`tts.prefsPath`?t(e,l,{row:r}):n===`authProfiles.store`||n===`authProfiles.state`?publishAuthProfileRowsChanged(e):(n===`modelCatalog.remote.v3`||n===`modelCatalog.remote.v2`||n===`modelCatalog.remote`)&&t(e,c,{})}function normalizeConfigMachineStateKey(e){let t=e.trim();if(!t)throw Error(`config machine state key must not be empty`);return t}function readConfigMachineStateRowInDatabase(t,n){let s=normalizeConfigMachineStateKey(n),c=s===`tts.prefsPath`?e(t,l):void 0;if(c)return c.row;if(!a(t,`config_machine_state`))return;let u=r(t),d=i(t,u.selectFrom(`config_machine_state`).select([`value_json`,`updated_at_ms`]).where(`state_key`,`=`,s));return o&&s===`tts.prefsPath`&&publishConfigMachineStateRow(t,s,d),d}export{publishConfigMachineStateRow as n,readConfigMachineStateRowInDatabase as r,normalizeConfigMachineStateKey as t};