openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 2.35 kB
JavaScript
import{l as isRecord}from"./record-coerce-BTbqdJ3-.mjs";import"./utils-Dlk0IYAa.mjs";import{i as INCLUDE_KEY}from"./includes-gwK90iIZ.mjs";import{n as listAgentEntries,t as hasAgentRosterProperty}from"./agent-roster-4XrgUgPK.mjs";import"./agent-scope-config-CG9CFpGX.mjs";
//!src/config/agent-roster-provenance.ts
function rosterEntryBoundaryContainsInclude(e){if(!isRecord(e))return false;if(Object.hasOwn(e,`$include`))return true;return[e.id,e.default].some(e=>isRecord(e)&&Object.hasOwn(e,`$include`))}function authoredRosterBoundaryContainsInclude(e){if(isRecord(e)&&Object.hasOwn(e,`$include`))return true;if(Array.isArray(e))return e.some(rosterEntryBoundaryContainsInclude);if(!isRecord(e))return false;return Object.values(e).some(rosterEntryBoundaryContainsInclude)}function readRosterValue(e){if(!isRecord(e)||!isRecord(e.agents))return;if(Object.hasOwn(e.agents,`entries`))return e.agents.entries;return Object.hasOwn(e.agents,`list`)?e.agents.list:void 0}function includeContributionOwnsAgentRoster(e){if(e.path.length===0)return hasAgentRosterProperty(e.value);if(e.path.length===1&&e.path[0]===`agents`)return isRecord(e.value)&&(Object.hasOwn(e.value,`entries`)||Object.hasOwn(e.value,`list`));if(e.path[0]!==`agents`)return false;if(e.path[1]===`entries`)return e.path.length<=3||e.path[3]==="default";if(e.path[1]===`list`)return e.path.length<=3||e.path[3]===`id`||e.path[3]==="default";return false}function includeContributionOwnsBindings(e){if(e.path.length===0)return isRecord(e.value)&&Object.hasOwn(e.value,`bindings`);return e.path[0]===`bindings`}function hasResolvedRosterBeforeMigrations(e){return listAgentEntries(e.sourceConfigBeforeMigrations??{}).length>0}function configIncludeOwnsAgentRosterValues(e){const t=e.sourceConfigBeforeMigrations;if(!hasAgentRosterProperty(t))return false;if(authoredRosterBoundaryContainsInclude(readRosterValue(e.parsed)))return true;return e.includeContributesRoster===true}function configIncludeOwnsAgentRoster(e){return configIncludeOwnsAgentRosterValues({parsed:e.parsed,sourceConfigBeforeMigrations:e.sourceConfigBeforeMigrations,includeContributesRoster:e.agentRosterIncludeOwned})}export{includeContributionOwnsBindings as a,includeContributionOwnsAgentRoster as i,configIncludeOwnsAgentRosterValues as n,hasResolvedRosterBeforeMigrations as r,configIncludeOwnsAgentRoster as t};