openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
3 lines • 1.52 kB
JavaScript
import{r as normalizeProviderId}from"./provider-id-A-8WTtLA.mjs";import{a as normalizeOptionalAgentRuntimeId,r as isDefaultAgentRuntimeId}from"./agent-runtime-id-dWmvEQWJ.mjs";import"./model-selection-CNHinoVN.mjs";import{t as resolveCompatibleAgentRuntimeForProvider}from"./session-runtime-compat-DGwJiPrH.mjs";
//!src/auto-reply/reply/directive-handling.model-runtime.ts
function resolveModelRuntimeDirective(e){const t=e.rawRuntime?.trim();const n=t||e.sessionEntry?.agentRuntimeOverride?.trim();if(!n)return{kind:`unchanged`};const r=normalizeOptionalAgentRuntimeId(n);if(isDefaultAgentRuntimeId(r))return{kind:t?`clear`:`unchanged`};const i=normalizeProviderId(e.provider);if(!t&&e.previousProvider&&normalizeProviderId(e.previousProvider)!==i)return{kind:`clear`};const a=resolveCompatibleAgentRuntimeForProvider({provider:i,runtime:r,cfg:e.cfg});if(a)return t?{kind:`set`,runtime:a}:{kind:`unchanged`};if(!t)return{kind:`clear`};return{kind:`invalid`,runtime:n,errorText:`Runtime "${n}" is not supported for ${i||e.provider}.`}}function applyModelRuntimeDirective(e,t){if(t.kind!==`clear`&&t.kind!==`set`)return{updated:false};const n=t.kind===`set`?t.runtime:void 0;const r=e.agentRuntimeOverride!==n||e.nativeRuntimeConsent!==void 0&&e.nativeRuntimeConsent!==n;if(t.kind===`clear`)delete e.agentRuntimeOverride;if(r||t.kind===`clear`)delete e.nativeRuntimeConsent;if(t.kind===`set`)e.agentRuntimeOverride=t.runtime;return{updated:r}}export{resolveModelRuntimeDirective as n,applyModelRuntimeDirective as t};