refactor(providers): flatten passthrough provider hooks

This commit is contained in:
Vincent Koc
2026-04-04 23:16:44 +09:00
parent ea2f56b4e8
commit 20d14745cf
4 changed files with 5 additions and 5 deletions

View File

@@ -316,10 +316,10 @@ export async function registerAnthropicPlugin(api: OpenClawPluginApi): Promise<v
normalizeConfig: ({ providerConfig }) => normalizeAnthropicProviderConfig(providerConfig),
applyConfigDefaults: ({ config, env }) => applyAnthropicConfigDefaults({ config, env }),
resolveDynamicModel: (ctx) => resolveAnthropicForwardCompatModel(ctx),
buildReplayPolicy: (ctx) => buildAnthropicReplayPolicy(ctx),
buildReplayPolicy: buildAnthropicReplayPolicy,
isModernModelRef: ({ modelId }) => matchesAnthropicModernModel(modelId),
resolveReasoningOutputMode: () => "native",
wrapStreamFn: (ctx) => wrapAnthropicProviderStream(ctx),
wrapStreamFn: wrapAnthropicProviderStream,
resolveDefaultThinkingLevel: ({ modelId }) =>
matchesAnthropicModernModel(modelId) &&
(modelId.toLowerCase().startsWith(ANTHROPIC_OPUS_46_MODEL_ID) ||

View File

@@ -306,7 +306,7 @@ export function buildOpenAICodexProviderPlugin(): ProviderPlugin {
supportsXHighThinking: ({ modelId }) =>
matchesExactOrPrefix(modelId, OPENAI_CODEX_XHIGH_MODEL_IDS),
isModernModelRef: ({ modelId }) => matchesExactOrPrefix(modelId, OPENAI_CODEX_MODERN_MODEL_IDS),
buildReplayPolicy: (ctx) => buildOpenAIReplayPolicy(ctx),
buildReplayPolicy: buildOpenAIReplayPolicy,
prepareExtraParams: (ctx) => {
const transport = ctx.extraParams?.transport;
if (transport === "auto" || transport === "sse" || transport === "websocket") {

View File

@@ -241,7 +241,7 @@ export function buildOpenAIProvider(): ProviderPlugin {
shouldUseOpenAIResponsesTransport({ provider, api, baseUrl })
? { api: "openai-responses", baseUrl }
: undefined,
buildReplayPolicy: (ctx) => buildOpenAIReplayPolicy(ctx),
buildReplayPolicy: buildOpenAIReplayPolicy,
prepareExtraParams: (ctx) => {
const transport = ctx.extraParams?.transport;
const hasSupportedTransport =

View File

@@ -205,7 +205,7 @@ export default defineSingleProviderPluginEntry({
tool_stream: true,
};
},
wrapStreamFn: (ctx) => wrapXaiProviderStream(ctx),
wrapStreamFn: wrapXaiProviderStream,
// Provider-specific fallback auth stays owned by the xAI plugin so core
// auth/discovery code can consume it generically without parsing xAI's
// private config layout. Callers may receive a real key from the active