openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
36 lines (35 loc) • 923 B
JavaScript
//#region src/security/context-visibility.ts
function evaluateSupplementalContextVisibility(e) {
if (e.mode === "all") return {
include: true,
reason: "mode_all"
};
if (e.senderAllowed) return {
include: true,
reason: "sender_allowed"
};
if (e.mode === "allowlist_quote" && e.kind === "quote") return {
include: true,
reason: "quote_override"
};
return {
include: false,
reason: "blocked"
};
}
function shouldIncludeSupplementalContext(e) {
return evaluateSupplementalContextVisibility(e).include;
}
function filterSupplementalContextItems(e) {
const t = e.items.filter((t) => shouldIncludeSupplementalContext({
mode: e.mode,
kind: e.kind,
senderAllowed: e.isSenderAllowed(t)
}));
return {
items: t,
omitted: e.items.length - t.length
};
}
//#endregion
export { filterSupplementalContextItems as n, shouldIncludeSupplementalContext as r, evaluateSupplementalContextVisibility as t };