UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 2.3 kB
import{r as normalizeProviderId}from"./provider-id-A-8WTtLA.mjs";import{r as resolveAgentConfig}from"./agent-scope-config-CG9CFpGX.mjs";import{r as resolveModelRuntimePolicy}from"./model-runtime-policy-DJvvlwBk.mjs";import{r as modelKey}from"./provider-registry-index-fv5AHL27.mjs";import{n as resolveConfiguredModelEntries}from"./configured-model-entries-CeK5vxAX.mjs"; //!src/agents/model-catalog-cli-wildcard.ts const CLAUDE_CLI_RUNTIME_ID=`claude-cli`;const ANTHROPIC_WILDCARD_REF=`anthropic/*`;function projectClaudeCliNativeCatalog(e,t,n=()=>[]){const r=e.providerOutcomes?.find(e=>e.provider===CLAUDE_CLI_RUNTIME_ID&&e.listedModelIds!==void 0);const i=t&&r!==void 0;const a=new Set(r?.listedModelIds??[]);const o=e.entries.filter(e=>e.provider===CLAUDE_CLI_RUNTIME_ID&&a.has(e.id));const s=new Map([...o.length?n():[],...e.staticEntries??[],...e.entries].filter(e=>e.provider===`anthropic`).map(e=>[e.id,e]));const c=[];const l=[];for(const e of o){const t=s.get(e.id);const n={...e,...t,id:e.id,provider:CLAUDE_CLI_RUNTIME_ID,name:e.name,reasoning:e.reasoning,thinkingLevelMap:e.thinkingLevelMap,input:t?.input?.filter(e=>e!==`document`)??e.input};c.push(n);if(i)l.push({...n,provider:`anthropic`})}const keep=e=>e.provider!==CLAUDE_CLI_RUNTIME_ID&&!(e.provider===`anthropic`&&i);return{...e,entries:[...e.entries.filter(keep),...i?l:c],routeVariants:[...e.routeVariants.filter(keep),...c,...l],staticEntries:e.staticEntries?.filter(e=>e.provider!==CLAUDE_CLI_RUNTIME_ID&&!(i&&e.provider===`anthropic`))}}function createUnlistedClaudeCliWildcardCheck(e){const t=resolveAgentConfig(e.cfg,e.agentId)?.models?.[ANTHROPIC_WILDCARD_REF]??e.cfg.agents?.defaults?.models?.[ANTHROPIC_WILDCARD_REF];if(normalizeProviderId(t?.agentRuntime?.id??``)!==CLAUDE_CLI_RUNTIME_ID)return()=>false;let n;let r;return(t,i)=>{if(t!==`anthropic`||normalizeProviderId(resolveModelRuntimePolicy({config:e.cfg,provider:t,modelId:i,agentId:e.agentId}).policy?.id??``)!==CLAUDE_CLI_RUNTIME_ID)return false;n??=new Set(e.outcomes()?.flatMap(e=>e.provider===CLAUDE_CLI_RUNTIME_ID&&e.listedModelIds!==void 0?e.listedModelIds:[]));r??=resolveConfiguredModelEntries({cfg:e.cfg,agentId:e.agentId}).byKey;return!n.has(i)&&!r.has(modelKey(t,i))}}export{projectClaudeCliNativeCatalog as n,createUnlistedClaudeCliWildcardCheck as t};