refactor(agents): delete dead model-selection surface and consolidate compaction targets (#122474)

* refactor(agents): delete dead model-selection surface, consolidate compaction target assembly

Removes production surface with zero live callers: buildConfiguredAllowlistKeys
(orphaned since fallback allowlist filtering was split out), the
retryTransientProviderRuntimeMiss resolveModelAsync option (its gateway startup
prewarming caller was replaced by prepared runtime snapshots), the ignored
useAsyncModelResolution plumbing (kept only as a deprecated no-op field on the
plugin-SDK-shipped prepareSimpleCompletionModelForAgent), and dead facade
re-exports (inferUniqueProviderFromCatalog, ThinkLevel, ModelRefStatus).

Consolidates resolveEmbeddedCompactionTarget's five hand-built result sites into
one assembleTarget helper owning the auth-profile-drop-on-provider-change rule;
resolution precedence is unchanged and now pinned by new table-driven cases
(unique-provider inference, ambiguous literal, profile-suffix preservation).

Net -93 production LOC, -106 test LOC.

* chore(sdk): regenerate plugin SDK API baseline after facade export removals
This commit is contained in:
Peter Steinberger
2026-08-11 23:37:15 -07:00
committed by GitHub
parent 8190c326ce
commit 59ea107d09
28 changed files with 99 additions and 298 deletions
@@ -1 +1 @@
{"contentHash":"ab9f09ea675935d06a12fff912c1f9109311be8be93a5b8d982a9569d9163359","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"}
{"contentHash":"92f86077bf8bd7e0ade16592677b6e824e8ace048e40849aa5fd5cd9fe17f280","entrypoint":"agent-harness-runtime","importSpecifier":"openclaw/plugin-sdk/agent-harness-runtime"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"0c4bd22dd46955da487cb750a995732a37ffa6000e94e2381621a8dc58333246","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"}
{"contentHash":"82523c6b1d5b8bc1b0933455ef0d8f798fb938e2b0e2676a434522926fd1d1ed","entrypoint":"agent-harness","importSpecifier":"openclaw/plugin-sdk/agent-harness"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"91cc5b30ad903aea2c6c002f64d21c8236fb141a2f8f8f0ca5217d46c7e79883","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"}
{"contentHash":"b771ba5e57fca93e4b49512f7cde5cd1c1b0fe4cf247985aeae5bfd44cb54923","entrypoint":"channel-core","importSpecifier":"openclaw/plugin-sdk/channel-core"}
@@ -1 +1 @@
{"contentHash":"2c922f70f8c8155d9be8fb0fb0c6dab4b03f7d1765ad98bab4668a49f984aa5f","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"}
{"contentHash":"8bc9cfdf0f7299079e3d39ce377b1eb8cf2b4b99ff39d3f8ceee1f7ac72d0dbd","entrypoint":"channel-entry-contract","importSpecifier":"openclaw/plugin-sdk/channel-entry-contract"}
@@ -1 +1 @@
{"contentHash":"3c2ea28cb7f23bf09c7ad0cab39751fcefd46055c563d1d2ce226b628f86dc48","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"}
{"contentHash":"69ed324324c86ad863f2804fd60dfc61f6b79040ee34fa52d33d1277857db4b1","entrypoint":"channel-message","importSpecifier":"openclaw/plugin-sdk/channel-message"}
@@ -1 +1 @@
{"contentHash":"a31b1c8f7db35e0e316a59afaa46f27f076b55f11a1dc08dc7630224115038de","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"}
{"contentHash":"a98fa525383537f792dfc06ffb40d1a89cf7c5d1d381e253178f5a2ebad79276","entrypoint":"channel-outbound","importSpecifier":"openclaw/plugin-sdk/channel-outbound"}
@@ -1 +1 @@
{"contentHash":"4edbdb687dfc1780b629e3e45efd1eb183a07d3d08c14d776a2e188b76f7c49b","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"}
{"contentHash":"8fdceb1f341434d335cbbb84052651df83b29436d1016c694461b072a75121c1","entrypoint":"channel-plugin-common","importSpecifier":"openclaw/plugin-sdk/channel-plugin-common"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"cb3406cb7205502c40a8bbf80521e58fd083620bbed99213d83a804b8deb8264","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"}
{"contentHash":"121f16d39c0b147393ca289221d4b020856a661dfc989dc978b5a499bfce5222","entrypoint":"core","importSpecifier":"openclaw/plugin-sdk/core"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"78ef9651b379d1b673d6c17bc9b636cdaaf2ea4cbe44c546482d53e7b7c8fdd9","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"}
{"contentHash":"00e179ad017e2921d85f9d2ffcf5f9e1bb415984d19e6fdc62a1832dbee659b0","entrypoint":"discord","importSpecifier":"openclaw/plugin-sdk/discord"}
@@ -1 +1 @@
{"contentHash":"077ae11669eaa9cba548cae506db3c11261712b3ffc804c48a28bf159caf124c","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"}
{"contentHash":"bfde664c63043f9719c8c12ef1e144dc387c05348b0f8b26bb2156438518dc21","entrypoint":"inbound-reply-dispatch","importSpecifier":"openclaw/plugin-sdk/inbound-reply-dispatch"}
@@ -1 +1 @@
{"contentHash":"bd05a541d2ba0e7f335ed0c4d4f187bed1c04953479682616d2b6c416bbd0459","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"}
{"contentHash":"2608b548ecca0c2981d80bff3596982d74572558c0fe7eb846a971880b1563af","entrypoint":"meeting-runtime","importSpecifier":"openclaw/plugin-sdk/meeting-runtime"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"f995b2ac4652ccf6a6107700f3a15b9d8e7bd8513466704424b899a831abdb41","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"}
{"contentHash":"8220986c0c848a5fe05c909f5c0626a6ebe0800fe5517a196718d4f21d30ebb6","entrypoint":"plugin-entry","importSpecifier":"openclaw/plugin-sdk/plugin-entry"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"97a6f344d3efa2dd1f7d7620562f22bf632873648a82be69a26cad6a8bd0b762","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"}
{"contentHash":"8350a80731ab2e020c859ea1994acd004fbaa9ca9c0d92fb09acd8703bc79ed3","entrypoint":"plugin-runtime","importSpecifier":"openclaw/plugin-sdk/plugin-runtime"}
@@ -1 +1 @@
{"contentHash":"2d76a60bfd593777339ee478306234773ac9ad626c564c60c95d49f82019ae2c","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"}
{"contentHash":"f61cc543e5d007e5da4951ccc61e12fc107fed478dfc8285b37389a77d2a6224","entrypoint":"provider-catalog-runtime","importSpecifier":"openclaw/plugin-sdk/provider-catalog-runtime"}
+1 -1
View File
@@ -1 +1 @@
{"contentHash":"11c6288303d0e1b2f75ad06f5acac4fbafd94ea98eaa6212d7e0adf87db43607","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"}
{"contentHash":"f27ec37aa7c772f12aeda7b8aa969b34a7a7bb7877e6d95b26a8b3e9174f4899","entrypoint":"tool-plugin","importSpecifier":"openclaw/plugin-sdk/tool-plugin"}
@@ -1 +1 @@
{"contentHash":"9204480482168d7f4d8f9601466c147d056403b42e3ba7979cae746792c268a8","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"}
{"contentHash":"6579285290ce10e5bf4ae930bbb2d28de52672fc4c7dd0f55f0dcdc1d711d3c1","entrypoint":"webhook-ingress","importSpecifier":"openclaw/plugin-sdk/webhook-ingress"}
@@ -792,6 +792,70 @@ describe("buildEmbeddedCompactionRuntimeContext", () => {
expect(result.authProfileId).toBe("openai:default");
});
it.each([
{
name: "infers a different provider for a uniquely configured bare literal",
config: {
models: {
providers: {
anthropic: { models: [{ id: "compact-model" }] },
},
},
agents: { defaults: { compaction: { model: "compact-model" } } },
},
provider: "openai",
authProfileId: "openai:default",
expectedProvider: "anthropic",
expectedModel: "compact-model",
expectedAuthProfileId: undefined,
},
{
name: "keeps an ambiguous configured bare literal on the current provider",
config: {
models: {
providers: {
openai: { models: [{ id: "shared-model" }] },
anthropic: { models: [{ id: "shared-model" }] },
},
},
agents: { defaults: { compaction: { model: "shared-model" } } },
},
provider: "google",
authProfileId: "google:default",
expectedProvider: "google",
expectedModel: "shared-model",
expectedAuthProfileId: "google:default",
},
{
name: "preserves a multi-segment model id and trailing profile suffix",
config: {
agents: {
defaults: {
compaction: { model: "openrouter/meta-llama/llama-3.3-70b:free@work" },
},
},
},
provider: "openrouter",
authProfileId: "openrouter:default",
expectedProvider: "openrouter",
expectedModel: "meta-llama/llama-3.3-70b:free@work",
expectedAuthProfileId: "openrouter:default",
},
])("$name", (fixture) => {
const result = resolveEmbeddedCompactionTarget({
config: fixture.config as unknown as OpenClawConfig,
provider: fixture.provider,
modelId: "current-model",
authProfileId: fixture.authProfileId,
defaultProvider: fixture.provider,
defaultModel: "current-model",
});
expect(result.provider).toBe(fixture.expectedProvider);
expect(result.model).toBe(fixture.expectedModel);
expect(result.authProfileId).toBe(fixture.expectedAuthProfileId);
});
it("leaves non-openai providers unchanged", () => {
const result = resolveEmbeddedCompactionTarget({
provider: "anthropic",
@@ -150,29 +150,26 @@ export function resolveEmbeddedCompactionTarget(params: {
...(useNativeHarnessRuntime ? { nativeHarnessCompaction: true } : {}),
};
};
if (!override) {
const authProfileId = params.authProfileId ?? undefined;
const assembleTarget = (targetProvider: string | undefined, targetModel: string | undefined) => {
// A provider switch cannot inherit credentials selected for the session's
// original provider; all target paths share that boundary.
const authProfileId =
targetProvider !== provider ? undefined : (params.authProfileId ?? undefined);
return {
provider,
...resolveTargetProviders(provider, authProfileId),
model,
provider: targetProvider,
...resolveTargetProviders(targetProvider, authProfileId),
model: targetModel,
authProfileId,
};
};
if (!override) {
return assembleTarget(provider, model);
}
const slashIdx = override.indexOf("/");
if (slashIdx > 0) {
const overrideProvider = override.slice(0, slashIdx).trim();
const overrideModel = override.slice(slashIdx + 1).trim() || params.defaultModel;
// When switching provider via override, drop the primary auth profile to
// avoid sending the wrong credentials.
const authProfileId =
overrideProvider !== provider ? undefined : (params.authProfileId ?? undefined);
return {
provider: overrideProvider,
...resolveTargetProviders(overrideProvider, authProfileId),
model: overrideModel,
authProfileId,
};
return assembleTarget(overrideProvider, overrideModel);
}
const config = params.config ?? {};
const currentProvider = provider?.trim();
@@ -184,27 +181,14 @@ export function resolveEmbeddedCompactionTarget(params: {
model: override,
})
) {
const authProfileId = params.authProfileId ?? undefined;
return {
provider: currentProvider,
...resolveTargetProviders(currentProvider, authProfileId),
model: override,
authProfileId,
};
return assembleTarget(currentProvider, override);
}
const inferredLiteralProvider = inferUniqueProviderFromConfiguredModels({
cfg: config,
model: override,
});
if (inferredLiteralProvider) {
const authProfileId =
inferredLiteralProvider !== provider ? undefined : (params.authProfileId ?? undefined);
return {
provider: inferredLiteralProvider,
...resolveTargetProviders(inferredLiteralProvider, authProfileId),
model: override,
authProfileId,
};
return assembleTarget(inferredLiteralProvider, override);
}
const defaultProvider = provider || DEFAULT_PROVIDER;
const aliasResolution = resolveModelRefFromString({
@@ -217,23 +201,9 @@ export function resolveEmbeddedCompactionTarget(params: {
}),
});
if (aliasResolution?.alias) {
const resolvedProvider = aliasResolution.ref.provider;
const authProfileId =
resolvedProvider !== provider ? undefined : (params.authProfileId ?? undefined);
return {
provider: resolvedProvider,
...resolveTargetProviders(resolvedProvider, authProfileId),
model: aliasResolution.ref.model,
authProfileId,
};
return assembleTarget(aliasResolution.ref.provider, aliasResolution.ref.model);
}
const authProfileId = params.authProfileId ?? undefined;
return {
provider,
...resolveTargetProviders(provider, authProfileId),
model: override,
authProfileId,
};
return assembleTarget(provider, override);
}
function normalizeCompactionConfigKey(value: string): string {
@@ -1,128 +0,0 @@
// Coverage for retrying transient model-runtime misses during startup.
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
const discoverAuthStorageMock = vi.fn<(agentDir?: string) => { mocked: true }>(() => ({
mocked: true,
}));
const discoverModelsMock = vi.fn<
(authStorage: unknown, agentDir: string) => { find: ReturnType<typeof vi.fn> }
>(() => ({ find: vi.fn(() => null) }));
const prepareProviderDynamicModelMock = vi.fn<(params: unknown) => Promise<void>>(async () => {});
let dynamicAttempts = 0;
const runProviderDynamicModelMock = vi.fn<(params: unknown) => unknown>(() =>
// First dynamic lookup simulates startup catalog warmup; the retry path must
// resolve on the second attempt only when explicitly enabled.
dynamicAttempts > 1
? {
id: "gpt-5.4",
name: "gpt-5.4",
provider: "openai",
api: "openai-chatgpt-responses",
baseUrl: "https://chatgpt.com/backend-api",
reasoning: true,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1_050_000,
maxTokens: 128_000,
}
: undefined,
);
vi.mock("../agent-model-discovery.js", () => ({
discoverAuthStorage: discoverAuthStorageMock,
discoverModels: discoverModelsMock,
}));
vi.mock("../prepared-model-runtime.js", () => ({
getPreparedModelRuntimeSnapshot: () => undefined,
loadPreparedModelRuntimeSnapshot: async ({ agentDir }: { agentDir: string }) => {
const authStorage = discoverAuthStorageMock(agentDir);
return {
agentDir,
config: {},
createStores: () => ({
authStorage,
modelRegistry: discoverModelsMock(authStorage, agentDir),
}),
};
},
}));
vi.mock("../../plugins/provider-runtime.js", () => ({
applyProviderResolvedTransportWithPlugin: () => undefined,
buildProviderUnknownModelHintWithPlugin: () => undefined,
normalizeProviderResolvedModelWithPlugin: () => undefined,
normalizeProviderTransportWithPlugin: () => undefined,
prepareProviderDynamicModel: async () => {},
resolveExternalAuthProfilesWithPlugins: () => [],
runProviderDynamicModel: () => undefined,
shouldPreferProviderRuntimeResolvedModel: () => false,
}));
describe("resolveModelAsync startup retry", () => {
let resolveModelAsync: typeof import("./model.js").resolveModelAsync;
const runtimeHooks = {
buildProviderUnknownModelHintWithPlugin: () => undefined,
normalizeProviderResolvedModelWithPlugin: () => undefined,
normalizeProviderTransportWithPlugin: () => undefined,
prepareProviderDynamicModel: (params: unknown) => prepareProviderDynamicModelMock(params),
runProviderDynamicModel: (params: unknown) => runProviderDynamicModelMock(params),
applyProviderResolvedTransportWithPlugin: () => undefined,
};
beforeAll(async () => {
({ resolveModelAsync } = await import("./model.js"));
});
beforeEach(() => {
dynamicAttempts = 0;
prepareProviderDynamicModelMock.mockClear();
prepareProviderDynamicModelMock.mockImplementation(async () => {
dynamicAttempts += 1;
});
runProviderDynamicModelMock.mockClear();
discoverAuthStorageMock.mockClear();
discoverModelsMock.mockClear();
});
it("retries once after a transient provider-runtime miss", async () => {
const result = await resolveModelAsync(
"openai",
"gpt-5.4",
"/tmp/agent",
{},
{
agentRuntimeId: "openclaw",
retryTransientProviderRuntimeMiss: true,
runtimeHooks,
},
);
expect(result.error).toBeUndefined();
expect(result.model?.provider).toBe("openai");
expect(result.model?.id).toBe("gpt-5.4");
expect(result.model?.api).toBe("openai-chatgpt-responses");
expect(prepareProviderDynamicModelMock).toHaveBeenCalledTimes(2);
expect(runProviderDynamicModelMock).toHaveBeenCalledTimes(2);
for (const call of [prepareProviderDynamicModelMock, runProviderDynamicModelMock]) {
expect(call).toHaveBeenCalledWith(
expect.objectContaining({
context: expect.objectContaining({ agentRuntimeId: "openclaw" }),
}),
);
}
});
it("does not retry during steady-state misses", async () => {
// Normal runtime lookups should not double-hit providers after startup; that
// would add latency and duplicate plugin side effects.
const result = await resolveModelAsync("openai", "gpt-5.4", "/tmp/agent", {}, { runtimeHooks });
expect(result.model).toBeUndefined();
expect(result.error).toBe("Unknown model: openai/gpt-5.4");
expect(prepareProviderDynamicModelMock).toHaveBeenCalledTimes(1);
expect(runProviderDynamicModelMock).toHaveBeenCalledTimes(1);
});
});
@@ -380,7 +380,6 @@ function resolveModelAsyncForTest(
options?: {
allowBundledStaticCatalogFallback?: boolean;
preferBundledStaticCatalogTransport?: boolean;
retryTransientProviderRuntimeMiss?: boolean;
runtimeHooks?: ReturnType<typeof createRuntimeHooks>;
skipAgentDiscovery?: boolean;
},
@@ -62,7 +62,6 @@ type CommonModelResolutionOptions = {
type AsyncModelResolutionOptions = CommonModelResolutionOptions & {
allowBundledStaticCatalogFallback?: boolean;
preferBundledStaticCatalogTransport?: boolean;
retryTransientProviderRuntimeMiss?: boolean;
agentRuntimeId?: string;
skipAgentDiscovery?: boolean;
preparedModelRuntime?: PreparedModelRuntimeSnapshot;
@@ -412,12 +411,6 @@ export async function resolveModelAsync(
? explicitModel.model
: undefined;
model ??= await resolveDynamicAttempt();
if (!model && !explicitModel && options?.retryTransientProviderRuntimeMiss) {
// Startup can race the first provider-runtime snapshot load on a fresh
// gateway boot. Retry once before surfacing a user-visible "Unknown model"
// that disappears on the next message.
model = await resolveDynamicAttempt();
}
if (!model && !explicitModel && options?.allowBundledStaticCatalogFallback) {
model = await resolveStaticCatalogFallbackModel();
}
+1 -45
View File
@@ -275,7 +275,7 @@ export function inferUniqueProviderFromConfiguredModels(
}
/** Infer a unique provider for a bare model from a provider catalog. */
export function inferUniqueProviderFromCatalog(params: {
function inferUniqueProviderFromCatalog(params: {
catalog: readonly ModelCatalogEntry[];
model: string;
}): string | undefined {
@@ -526,50 +526,6 @@ function resolveAllowlistModelKey(
return modelKey(parsed.provider, parsed.model);
}
/** Build the exact configured model keys that constrain model visibility. */
export function buildConfiguredAllowlistKeys(
params: {
cfg: OpenClawConfig | undefined;
defaultProvider: string;
agentId?: string;
allowManifestNormalization?: boolean;
allowPluginNormalization?: boolean;
} & ModelManifestNormalizationContext,
): Set<string> | null {
const visibility = parseConfiguredModelVisibilityEntries({
cfg: params.cfg,
agentId: params.agentId,
});
if (visibility.exactModelRefs.length === 0) {
return null;
}
const aliasIndex = buildModelAliasIndex({
cfg: params.cfg ?? {},
defaultProvider: params.defaultProvider,
agentId: resolvePolicyAliasAgentId(visibility.configPath, params.agentId),
allowManifestNormalization: params.allowManifestNormalization,
allowPluginNormalization: params.allowPluginNormalization,
manifestPlugins: params.manifestPlugins,
});
const keys = new Set<string>();
for (const raw of visibility.exactModelRefs) {
const key = resolveAllowlistModelKey({
cfg: params.cfg,
raw,
defaultProvider: params.defaultProvider,
aliasIndex,
allowManifestNormalization: params.allowManifestNormalization,
allowPluginNormalization: params.allowPluginNormalization,
manifestPlugins: params.manifestPlugins,
});
if (key) {
keys.add(key);
}
}
return keys.size > 0 ? keys : null;
}
type BuildModelAliasIndexParams = {
cfg: OpenClawConfig;
defaultProvider: string;
-40
View File
@@ -11,7 +11,6 @@ import {
import { isModelKeyAllowedBySet } from "./model-selection-shared.js";
import {
buildAllowedModelSet,
buildConfiguredAllowlistKeys,
buildConfiguredModelCatalog,
inferUniqueProviderFromConfiguredModels,
getModelRefStatus,
@@ -940,45 +939,6 @@ describe("model-selection", () => {
});
});
describe("buildConfiguredAllowlistKeys", () => {
it("resolves per-agent policy aliases to the enforcement key", () => {
const cfg = {
agents: {
defaults: {
model: { primary: "openai/gpt-5.5" },
},
list: [
{
id: "research",
models: {
"anthropic/claude-sonnet-4-6": { alias: "sonnet" },
},
modelPolicy: { allow: ["sonnet"] },
},
],
},
} as OpenClawConfig;
const keys = buildConfiguredAllowlistKeys({
cfg,
defaultProvider: "openai",
agentId: "research",
});
const policy = createModelVisibilityPolicy({
cfg,
catalog: [],
defaultProvider: "openai",
defaultModel: "gpt-5.5",
agentId: "research",
});
expect(keys).toEqual(new Set(["anthropic/claude-sonnet-4-6"]));
expect(keys?.has("openai/sonnet")).toBe(false);
expect(policy.allowsKey("anthropic/claude-sonnet-4-6")).toBe(true);
expect(policy.allowsKey("openai/sonnet")).toBe(false);
});
});
describe("buildAllowedModelSet", () => {
it("keeps explicitly allowlisted models even when missing from bundled catalog", () => {
const result = buildAllowedModelSet({
+1 -8
View File
@@ -36,10 +36,8 @@ import {
} from "./model-selection-resolve.js";
import {
buildAllowedModelSetWithFallbacks,
buildConfiguredAllowlistKeys,
buildConfiguredModelCatalog,
buildModelAliasIndex,
inferUniqueProviderFromCatalog,
inferUniqueProviderFromConfiguredModels,
normalizeModelSelection,
resolveBareModelDefaultProvider,
@@ -48,23 +46,18 @@ import {
resolveModelAliasFromPair,
resolveModelRefFromString,
type ModelAliasIndex,
type ModelRefStatus,
} from "./model-selection-shared.js";
export type { ModelAliasIndex, ModelManifestNormalizationContext, ModelRef, ModelRefStatus };
export type { ThinkLevel } from "../auto-reply/thinking.shared.js";
export type { ModelAliasIndex, ModelManifestNormalizationContext, ModelRef };
export { resolveDefaultModelForAgent, resolveSubagentConfiguredModelSelection };
export {
buildConfiguredAllowlistKeys,
buildConfiguredModelCatalog,
buildModelAliasIndex,
findNormalizedProviderKey,
findNormalizedProviderValue,
inferUniqueProviderFromConfiguredModels,
inferUniqueProviderFromCatalog,
legacyModelKey,
modelKey,
normalizeModelRef,
+1 -4
View File
@@ -242,8 +242,6 @@ export async function prepareSimpleCompletionModel(params: {
preferredProfile?: string;
allowMissingApiKeyModes?: ReadonlyArray<AllowedMissingApiKeyMode>;
allowBundledStaticCatalogFallback?: boolean;
/** @deprecated Model resolution is lifecycle-backed and always asynchronous. */
useAsyncModelResolution?: boolean;
skipAgentDiscovery?: boolean;
bindAuthOwner?: boolean;
modelResolver?: typeof resolveModelAsync;
@@ -480,7 +478,7 @@ export async function prepareSimpleCompletionModelForAgent(params: {
preferredProfile?: string;
allowMissingApiKeyModes?: ReadonlyArray<AllowedMissingApiKeyMode>;
allowBundledStaticCatalogFallback?: boolean;
/** @deprecated Model resolution is lifecycle-backed and always asynchronous. */
/** @deprecated no-op; kept for plugin-SDK source compatibility, remove at next SDK-breaking window. */
useAsyncModelResolution?: boolean;
skipAgentDiscovery?: boolean;
bindAuthOwner?: boolean;
@@ -510,7 +508,6 @@ export async function prepareSimpleCompletionModelForAgent(params: {
...(params.allowBundledStaticCatalogFallback !== undefined
? { allowBundledStaticCatalogFallback: params.allowBundledStaticCatalogFallback }
: {}),
useAsyncModelResolution: params.useAsyncModelResolution,
skipAgentDiscovery: params.skipAgentDiscovery,
bindAuthOwner: params.bindAuthOwner,
modelResolver: params.modelResolver,
@@ -68,7 +68,6 @@ export async function prepareNarrationModel(params: { cfg: OpenClawConfig; agent
cfg: params.cfg,
agentId: params.agentId,
useUtilityModel: true,
useAsyncModelResolution: true,
allowMissingApiKeyModes: ["aws-sdk"],
});
if ("error" in prepared) {
@@ -927,7 +927,6 @@ export function describeTtsSummarizationContract() {
cfg,
provider: "openai",
modelId: "gpt-4.1-mini",
useAsyncModelResolution: true,
});
});
-1
View File
@@ -104,7 +104,6 @@ export async function summarizeText(
cfg,
provider: ref.provider,
modelId: ref.model,
useAsyncModelResolution: true,
});
if ("error" in prepared) {
throw new Error(prepared.error);