openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 2.09 kB
JavaScript
import{t as splitTrailingAuthProfile}from"./model-ref-profile-DFGpvDZX.mjs";import{s as loadManifestMetadataSnapshot}from"./manifest-contract-eligibility-BFn2JM5T.mjs";import{b as readUtilityModelSetting}from"./model-selection-shared-CIOFxJ36.mjs";import{n as resolveDefaultModelForAgent}from"./model-selection-config-CnvHkHXn.mjs";import{f as selectUtilityModel}from"./validation-CGAl0yU4.mjs";import{o as resolveUtilityModelSelectionForAgent}from"./utility-model-CDT0xFeg.mjs";
//!src/commands/models/list.status-utility.ts
function resolveStatusUtilityModel(e){const t=readUtilityModelSetting(e.cfg,e.agentId);const n=e.gatewayCatalog?.utilityModel??resolveUtilityModelSelectionForAgent({cfg:e.cfg,agentId:e.agentId,...e.gatewayCatalog?{catalog:{entries:e.gatewayCatalog.models}}:{}});const r=t.kind===`disabled`?[]:t.fallbacks;const i=`modelRef`in n?n.modelRef??void 0:void 0;const a=`source`in n?n.source:t.kind===`disabled`?`disabled`:`none`;return{ref:i,fallbacks:r,source:a,notOffered:isUtilityModelNotOffered({...e,utilityModel:{modelRef:i,source:a}})}}function formatStatusUtilityModel(e,t){if(!e)return t.source===`disabled`?`off`:`-`;if(t.notOffered)return`${e} (${UTILITY_MODEL_NOT_OFFERED_NOTE})`;return t.source===`provider-default`?`${e} (provider default)`:e}const UTILITY_MODEL_NOT_OFFERED_NOTE=`utility model not offered; using main model`;function isUtilityModelNotOffered(e){const t=e.utilityModel?.modelRef;const n=resolveDefaultModelForAgent({cfg:e.cfg,agentId:e.agentId});if(!t||!n||e.utilityModel?.source!==`provider-default`||readUtilityModelSetting(e.cfg,e.agentId).kind!==`auto`)return false;const model=e=>splitTrailingAuthProfile(e).model.toLowerCase();const r=selectUtilityModel({cfg:e.cfg,agentId:e.agentId,catalog:{entries:[],authoritative:false},metadataSnapshot:loadManifestMetadataSnapshot({config:e.cfg})});return model(t)===`${n.provider}/${n.model}`.toLowerCase()&&!(`modelRef`in r&&model(r.modelRef)===model(t))}export{resolveStatusUtilityModel as i,formatStatusUtilityModel as n,isUtilityModelNotOffered as r,UTILITY_MODEL_NOT_OFFERED_NOTE as t};