UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 1.75 kB
import{L as e}from"./disk-budget.worker-paths-DAFiPrD7.mjs";import{t}from"./disk-budget.worker-subsystem-BalNE4hU.mjs";import{a as n}from"./disk-budget.worker-openclaw-agent-db.paths-BlkaCq0b.mjs";import{n as r,t as i}from"./disk-budget.worker.js";import{h as a,s as o}from"./disk-budget.worker-agent-database-admission-CBRZjurS.mjs";import"./disk-budget.worker-legacy.default-agent-owner-CNQ3_GGg.mjs";import{i as s}from"./disk-budget.worker-session-sqlite-target-C_ZXdjNo.mjs";import{t as c}from"./disk-budget.worker-targets-configured-agents-DHALS2BR.mjs";import l from"node:fs";import"node:fs/promises";import u from"node:path";function mapAgentSessionDirs(e,t,n){return t.filter(e=>e.isDirectory()&&(n?.(e.name)??!0)).map(t=>u.join(e,t.name,`sessions`)).sort((e,t)=>e.localeCompare(t))}function resolveAgentSessionDirsFromAgentsDirSync(t,n){let r;try{r=l.readdirSync(t,{withFileTypes:!0})}catch(t){return e(t)??[]}return mapAgentSessionDirs(t,r,n)}t(`sessions/targets`);function resolveConfiguredSessionStoreTargets(e,t,n){return c(e).map(r=>({agentId:r,storePath:s(e.session?.store,r,t,n)}))}function resolveConfiguredAgentDatabaseCandidatePaths(e,t){let n=c(e);return[.../* @__PURE__ */ new Set([...n.flatMap(n=>r(i(e.session?.store,{agentId:n,env:t.env}),n)),...[.../* @__PURE__ */ new Set([...n,...a(e)])].map(n=>u.join(o(e,n,t.env),`openclaw-agent.sqlite`))])]}function isConfiguredAgentDatabaseTarget(e,t,r){return e.some(e=>(t===void 0||e.agentId===void 0||e.agentId===t)&&(e.path===r||l.statSync(e.path,{throwIfNoEntry:!1})&&l.statSync(r,{throwIfNoEntry:!1})&&n(e.path,r)))}export{isConfiguredAgentDatabaseTarget,resolveConfiguredAgentDatabaseCandidatePaths,resolveConfiguredSessionStoreTargets,resolveAgentSessionDirsFromAgentsDirSync as t};