UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

42 lines (41 loc) • 2.25 kB
import { r as isPathInside } from "./path-guards-TIjxtj6H.mjs"; import { n as normalizeAgentId } from "./agent-id-CQjtp2ft.mjs"; import "./session-key-CqAyZeVk.mjs"; import { n as listAgentEntries } from "./agent-roster-t1ooUdXp.mjs"; import { a as isSameOpenClawAgentDatabasePath } from "./openclaw-agent-db.paths-DJxv80ws.mjs"; import { f as resolveAgentWorkspaceDir } from "./agent-scope-config-DmXgFGKP.mjs"; import { o as resolveCanonicalWorkspacePath } from "./workspace-state-identity-Ce50CSIn.mjs"; import "./agent-scope-BwB8YH6y.mjs"; import { l as resolveSharedAuthStoreOwnership } from "./path-resolve-CpNl_n1M.mjs"; import { i as resolveLegacyInheritedAuthAgentId } from "./legacy-inherited-auth-dir-1Y-Cs3kS.mjs"; //#region src/agents/agent-delete-safety.ts /** True when deleting this agent database would remove the legacy shared auth store. */ function isSharedAuthStoreOwner(e) { return e.ownership.location === "legacy-main" && isSameOpenClawAgentDatabasePath(e.agentAuthDbPath, e.sharedAuthDbPath); } function formatSharedAuthStoreOwnerDeleteError(e) { return `Agent "${e}" owns the legacy shared auth store and cannot be deleted. Run openclaw doctor --fix to migrate shared auth, then retry.`; } function isInheritedAuthStoreOwner(e, t) { if (!e.agents?.defaults?.authInheritance?.agentId?.trim() && resolveSharedAuthStoreOwnership().location !== "legacy-main") return false; return t === normalizeAgentId(resolveLegacyInheritedAuthAgentId(e)); } function workspacePathsOverlap(e, t) { const n = resolveCanonicalWorkspacePath(e.replaceAll("\0", "")); const r = resolveCanonicalWorkspacePath(t.replaceAll("\0", "")); return isPathInside(r, n) || isPathInside(n, r); } /** Lists other agents whose workspaces overlap a candidate delete target. */ function findOverlappingWorkspaceAgentIds(e, t, n, r) { const i = listAgentEntries(e); const a = normalizeAgentId(t); const o = []; for (const t of i) { const i = normalizeAgentId(t.id); if (i === a) continue; if (workspacePathsOverlap(n, resolveAgentWorkspaceDir(e, i, r))) o.push(i); } return o; } //#endregion export { isSharedAuthStoreOwner as i, formatSharedAuthStoreOwnerDeleteError as n, isInheritedAuthStoreOwner as r, findOverlappingWorkspaceAgentIds as t };