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

@@ -21,7 +21,7 @@ export default definePluginEntry({
description: "Bundled OpenRouter provider plugin",
async register(api) {
const {
buildPassthroughGeminiSanitizingReplayPolicy,
buildProviderReplayFamilyHooks,
composeProviderStreamWrappers,
createOpenRouterWrapper,
createProviderApiKeyAuthMethod,
@@ -34,6 +34,9 @@ export default definePluginEntry({
applyOpenrouterConfig,
buildOpenrouterProvider,
} = await import("./register.runtime.js");
const PASSTHROUGH_GEMINI_REPLAY_HOOKS = buildProviderReplayFamilyHooks({
family: "passthrough-gemini",
});
function buildDynamicOpenRouterModel(
ctx: ProviderResolveDynamicModelContext,
@@ -128,7 +131,7 @@ export default definePluginEntry({
prepareDynamicModel: async (ctx) => {
await loadOpenRouterModelCapabilities(ctx.modelId);
},
buildReplayPolicy: ({ modelId }) => buildPassthroughGeminiSanitizingReplayPolicy(modelId),
...PASSTHROUGH_GEMINI_REPLAY_HOOKS,
resolveReasoningOutputMode: () => "native",
isModernModelRef: () => true,
wrapStreamFn: (ctx) => {

View File

@@ -1,6 +1,6 @@
export { createProviderApiKeyAuthMethod } from "openclaw/plugin-sdk/provider-auth-api-key";
export {
buildPassthroughGeminiSanitizingReplayPolicy,
buildProviderReplayFamilyHooks,
DEFAULT_CONTEXT_TOKENS,
} from "openclaw/plugin-sdk/provider-model-shared";
export {