UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

57 lines (56 loc) • 2.25 kB
import { d as withPluginRuntimeRegistryScope } from "./gateway-request-scope-BvvDhs5D.mjs"; import { r as isDefaultAgentRuntimeId } from "./agent-runtime-id-D8s1CaYB.mjs"; import { t as resolveAgentHarnessPolicy } from "./policy-DzaOuofI.mjs"; import { o as resolveAutoAgentHarnessId } from "./support-LWqLDjUq.mjs"; import { t as resolveAgentHarnessAvailabilityDecision } from "./availability-C7FXoCVL.mjs"; //#region src/agents/model-catalog-decision-runtime.ts /** Public runtime and thinking consume this same route/account decision. */ function resolveCatalogDecisionRuntime(e) { const t = e.evaluation.selectedRoute; const n = { config: e.cfg, agentId: e.agentId, provider: e.entry.provider, modelId: e.entry.id, modelProvider: { api: t?.api ?? e.entry.api, baseUrl: t?.baseUrl ?? e.entry.baseUrl, requestTransportOverrides: t?.requestTransportOverrides, runtimePolicy: t?.runtimePolicy, preparedAuth: e.evaluation.selectedCredential }, preparedModelProvider: true, resolveOpenAIProviderRoutes: e.resolveOpenAIProviderRoutes }; const select = () => { const { policy: t } = resolveAgentHarnessAvailabilityDecision({ ...n, mode: "projection", agentHarnessRuntimeOverride: e.evaluation.requestedRuntimeId }); return { policy: t, runtime: t.runtime === "auto" ? resolveAutoAgentHarnessId(n) ?? "openclaw" : t.runtime }; }; const r = e.pluginRegistry ? withPluginRuntimeRegistryScope(e.pluginRegistry, select) : (() => { const t = resolveAgentHarnessPolicy({ ...n, modelApi: n.modelProvider.api, modelBaseUrl: n.modelProvider.baseUrl, requestTransportOverrides: n.modelProvider.requestTransportOverrides }); return { policy: t, runtime: e.evaluation.requestedRuntimeId ?? (t.runtime === "auto" ? "openclaw" : t.runtime) }; })(); const i = r.policy.runtimeSource === "implicit" && !r.policy.forcedByEnvironment && isDefaultAgentRuntimeId(e.evaluation.requestedRuntimeId) ? e.evaluation.runtimeAuth?.id ?? r.runtime : r.runtime; if (r.policy.runtime === "auto" && i === "openclaw" && !e.evaluation.requestedRuntimeId) return; return { id: i, source: r.policy.runtimeSource ?? "implicit" }; } //#endregion export { resolveCatalogDecisionRuntime as t };