refactor(providers): add family replay and tool hooks

This commit is contained in:
Vincent Koc
2026-04-04 19:27:36 +09:00
parent 4e099689c0
commit 39d2a719c9
20 changed files with 273 additions and 85 deletions

View File

@@ -1,13 +1,16 @@
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
import { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
import {
buildPassthroughGeminiSanitizingReplayPolicy,
buildProviderReplayFamilyHooks,
matchesExactOrPrefix,
} from "openclaw/plugin-sdk/provider-model-shared";
import { applyOpencodeZenConfig, OPENCODE_ZEN_DEFAULT_MODEL } from "./api.js";
const PROVIDER_ID = "opencode";
const MINIMAX_MODERN_MODEL_MATCHERS = ["minimax-m2.7"] as const;
const PASSTHROUGH_GEMINI_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
family: "passthrough-gemini",
});
function isModernOpencodeModel(modelId: string): boolean {
const lower = modelId.trim().toLowerCase();
@@ -57,7 +60,7 @@ export default definePluginEntry({
},
}),
],
buildReplayPolicy: ({ modelId }) => buildPassthroughGeminiSanitizingReplayPolicy(modelId),
...PASSTHROUGH_GEMINI_REPLAY_HOOKS,
isModernModelRef: ({ modelId }) => isModernOpencodeModel(modelId),
});
},