UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

30 lines (29 loc) • 1.38 kB
import { i as normalizeArrayBackedTrimmedStringList } from "./string-normalization-DLmfYZXI.mjs"; //#region src/infra/node-pairing-surface.ts function intersectNodePermissionSurface(e) { const t = []; for (const [n, r] of Object.entries(e.declared ?? {})) { const i = e.approved?.[n]; if (!r) t.push([n, false]); else if (i !== void 0) t.push([n, i]); } return t.length > 0 ? Object.fromEntries(t) : void 0; } /** Normalize capability/command lists for node approval-surface comparison. */ function normalizeNodeApprovalSurfaceList(e) { return normalizeArrayBackedTrimmedStringList(e) ?? []; } /** Compare capability/command surfaces as normalized sets, ignoring order and duplicates. */ function sameNodeApprovalSurfaceSet(e, t) { const n = new Set(normalizeNodeApprovalSurfaceList(e)); const r = new Set(normalizeNodeApprovalSurfaceList(t)); return n.size === r.size && [...n].every((e) => r.has(e)); } /** Compare node permission maps deterministically so key order cannot trigger repairs. */ function sameNodePermissionSurface(e, t) { const n = Object.entries(e ?? {}); const r = t ?? {}; return n.length === Object.keys(r).length && n.every(([e, t]) => Object.hasOwn(r, e) && r[e] === t); } //#endregion export { sameNodePermissionSurface as i, normalizeNodeApprovalSurfaceList as n, sameNodeApprovalSurfaceSet as r, intersectNodePermissionSurface as t };