feat: allow hook model overrides

This commit is contained in:
Peter Steinberger
2026-01-08 09:33:27 +00:00
parent e6f8e1e531
commit 73988506fe
12 changed files with 207 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ export type HookMappingResolved = {
| "signal"
| "imessage";
to?: string;
model?: string;
thinking?: string;
timeoutSeconds?: number;
transform?: HookMappingTransformResolved;
@@ -66,6 +67,7 @@ export type HookAction =
| "signal"
| "imessage";
to?: string;
model?: string;
thinking?: string;
timeoutSeconds?: number;
};
@@ -110,6 +112,7 @@ type HookTransformResult = Partial<{
| "signal"
| "imessage";
to: string;
model: string;
thinking: string;
timeoutSeconds: number;
}> | null;
@@ -198,6 +201,7 @@ function normalizeHookMapping(
deliver: mapping.deliver,
provider: mapping.provider,
to: mapping.to,
model: mapping.model,
thinking: mapping.thinking,
timeoutSeconds: mapping.timeoutSeconds,
transform,
@@ -243,6 +247,7 @@ function buildActionFromMapping(
deliver: mapping.deliver,
provider: mapping.provider,
to: renderOptional(mapping.to, ctx),
model: renderOptional(mapping.model, ctx),
thinking: renderOptional(mapping.thinking, ctx),
timeoutSeconds: mapping.timeoutSeconds,
},
@@ -293,6 +298,7 @@ function mergeAction(
: baseAgent?.deliver,
provider: override.provider ?? baseAgent?.provider,
to: override.to ?? baseAgent?.to,
model: override.model ?? baseAgent?.model,
thinking: override.thinking ?? baseAgent?.thinking,
timeoutSeconds: override.timeoutSeconds ?? baseAgent?.timeoutSeconds,
});