UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

7 lines • 2.42 kB
import{c as ignoreMissingPath}from"./global-singleton-CTnqrmaI.js";import"./account-core-34NfXidI.js";import{t as createSubsystemLogger}from"./subsystem-ovCC_dQD.js";import{c as isPerAgentSessionStoreConfig,h as listGatewayOwnedAgentIds,l as resolveSessionStorePathCore,n as resolveAgentDir,u as listSqliteTargetCandidatePathsForSessionStorePath}from"./agent-scope-config-DaUbqOtM.js";import"./boundary-file-read-D9ria5A8.js";import{a as isSameOpenClawAgentDatabasePath}from"./openclaw-agent-db.paths-D0bfBkSQ.js";import"./legacy.default-agent-owner-LmfuVSwz.js";import"./session-sqlite-target-CMmf00vR.js";import{i as resolveCapturedSessionStorePath}from"./transcript-target-binding-CYuihbsT.js";import{t as listConfiguredSessionStoreAgentIds}from"./targets-configured-agents-NM3B56Py.js";import fsPromises from"node:fs/promises";import path from"node:path";import fs from"node:fs"; //!src/agents/session-dirs.ts function mapAgentSessionDirs(e,t,n){return t.filter(e=>e.isDirectory()&&(n?.(e.name)??true)).map(t=>path.join(e,t.name,`sessions`)).sort((e,t)=>e.localeCompare(t))}function resolveAgentSessionDirsFromAgentsDirSync(e,t){let n;try{n=fs.readdirSync(e,{withFileTypes:true})}catch(e){return ignoreMissingPath(e)??[]}return mapAgentSessionDirs(e,n,t)} //!src/config/sessions/targets-collision.ts const log=createSubsystemLogger(`sessions/targets`); //!src/config/sessions/targets.ts function resolveConfiguredSessionStoreTargets(e,t,n){return listConfiguredSessionStoreAgentIds(e).map(r=>({agentId:r,storePath:resolveCapturedSessionStorePath(e.session?.store,r,t,n)}))}function resolveConfiguredAgentDatabaseCandidatePaths(e,t){const n=listConfiguredSessionStoreAgentIds(e);return[.../* @__PURE__ */ new Set([...n.flatMap(n=>listSqliteTargetCandidatePathsForSessionStorePath(resolveSessionStorePathCore(e.session?.store,{agentId:n,env:t.env}),n)),...[.../* @__PURE__ */ new Set([...n,...listGatewayOwnedAgentIds(e)])].map(n=>path.join(resolveAgentDir(e,n,t.env),`openclaw-agent.sqlite`))])]}function isConfiguredAgentDatabaseTarget(e,t,n){return e.some(e=>(t===void 0||e.agentId===void 0||e.agentId===t)&&(e.path===n||fs.statSync(e.path,{throwIfNoEntry:false})&&fs.statSync(n,{throwIfNoEntry:false})&&isSameOpenClawAgentDatabasePath(e.path,n)))}export{isConfiguredAgentDatabaseTarget,resolveConfiguredAgentDatabaseCandidatePaths,resolveConfiguredSessionStoreTargets,resolveAgentSessionDirsFromAgentsDirSync as t};