mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-15 19:21:08 +00:00
fix(runtime): split cli provider and abort seams
This commit is contained in:
17
src/agents/model-selection-cli.ts
Normal file
17
src/agents/model-selection-cli.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { resolveRuntimeCliBackends } from "../plugins/cli-backends.runtime.js";
|
||||
import { resolvePluginSetupCliBackendRuntime } from "../plugins/setup-registry.runtime.js";
|
||||
import { normalizeProviderId } from "./model-selection-normalize.js";
|
||||
|
||||
export function isCliProvider(provider: string, cfg?: OpenClawConfig): boolean {
|
||||
const normalized = normalizeProviderId(provider);
|
||||
const cliBackends = resolveRuntimeCliBackends();
|
||||
if (cliBackends.some((backend) => normalizeProviderId(backend.id) === normalized)) {
|
||||
return true;
|
||||
}
|
||||
if (resolvePluginSetupCliBackendRuntime({ backend: normalized })) {
|
||||
return true;
|
||||
}
|
||||
const backends = cfg?.agents?.defaults?.cliBackends ?? {};
|
||||
return Object.keys(backends).some((key) => normalizeProviderId(key) === normalized);
|
||||
}
|
||||
@@ -6,8 +6,6 @@ import {
|
||||
} from "../config/model-input.js";
|
||||
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
||||
import { createSubsystemLogger } from "../logging/subsystem.js";
|
||||
import { resolveRuntimeCliBackends } from "../plugins/cli-backends.runtime.js";
|
||||
import { resolvePluginSetupCliBackendRuntime } from "../plugins/setup-registry.runtime.js";
|
||||
import {
|
||||
normalizeLowercaseStringOrEmpty,
|
||||
normalizeOptionalLowercaseString,
|
||||
@@ -76,19 +74,7 @@ export {
|
||||
parseModelRef,
|
||||
};
|
||||
export type { ModelRef };
|
||||
|
||||
export function isCliProvider(provider: string, cfg?: OpenClawConfig): boolean {
|
||||
const normalized = normalizeProviderId(provider);
|
||||
const cliBackends = resolveRuntimeCliBackends();
|
||||
if (cliBackends.some((backend) => normalizeProviderId(backend.id) === normalized)) {
|
||||
return true;
|
||||
}
|
||||
if (resolvePluginSetupCliBackendRuntime({ backend: normalized })) {
|
||||
return true;
|
||||
}
|
||||
const backends = cfg?.agents?.defaults?.cliBackends ?? {};
|
||||
return Object.keys(backends).some((key) => normalizeProviderId(key) === normalized);
|
||||
}
|
||||
export { isCliProvider } from "./model-selection-cli.js";
|
||||
|
||||
export function resolvePersistedOverrideModelRef(params: {
|
||||
defaultProvider: string;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
|
||||
import { normalizeCommandBody, type CommandNormalizeOptions } from "../commands-registry.js";
|
||||
import { normalizeCommandBody } from "../commands-registry-normalize.js";
|
||||
import type { CommandNormalizeOptions } from "../commands-registry.types.js";
|
||||
|
||||
const ABORT_TRIGGERS = new Set([
|
||||
"stop",
|
||||
|
||||
@@ -3,11 +3,8 @@ import { normalizeChannelId } from "../channels/plugins/index.js";
|
||||
import { listPairingChannels, notifyPairingApproved } from "../channels/plugins/pairing.js";
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import { resolvePairingIdLabel } from "../pairing/pairing-labels.js";
|
||||
import {
|
||||
approveChannelPairingCode,
|
||||
listChannelPairingRequests,
|
||||
type PairingChannel,
|
||||
} from "../pairing/pairing-store.js";
|
||||
import { approveChannelPairingCode, listChannelPairingRequests } from "../pairing/pairing-store.js";
|
||||
import type { PairingChannel } from "../pairing/pairing-store.types.js";
|
||||
import { defaultRuntime } from "../runtime.js";
|
||||
import {
|
||||
normalizeLowercaseStringOrEmpty,
|
||||
|
||||
Reference in New Issue
Block a user