openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.9 kB
JavaScript
import{r as isPathInside}from"./path-guards-DGttsOJI.mjs";import{n as normalizeAgentId}from"./agent-id-cOfqmfln.mjs";import"./session-key-BPgKfU2m.mjs";import{n as listAgentEntries}from"./agent-roster-4XrgUgPK.mjs";import{o as isSameOpenClawAgentDatabasePath}from"./openclaw-agent-db.paths-SkzMsgQ0.mjs";import{f as resolveAgentWorkspaceDir}from"./agent-scope-config-CG9CFpGX.mjs";import{s as resolveCanonicalWorkspacePath}from"./workspace-state-identity-D-_UPy3C.mjs";import"./agent-scope-Dw5XRSEh.mjs";import{l as resolveSharedAuthStoreOwnership}from"./path-resolve-TSS6dv07.mjs";import{i as resolveLegacyInheritedAuthAgentId}from"./legacy-inherited-auth-dir-9LCjV4lR.mjs";
//!src/agents/agent-delete-safety.ts
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)}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}export{isSharedAuthStoreOwner as i,formatSharedAuthStoreOwnerDeleteError as n,isInheritedAuthStoreOwner as r,findOverlappingWorkspaceAgentIds as t};