feat(delegate-task): add resolveMetadataModel helper for model fallback

Add helper that picks primary model with fallback to a secondary model

(e.g., categoryModel → parentContext.model). Enforces consistent

{providerID, modelID} shape.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-17 14:41:08 +09:00
parent f3af23565e
commit 3a656136b6
2 changed files with 71 additions and 0 deletions
@@ -0,0 +1,21 @@
import type { DelegatedModelConfig } from "./types"
export interface MetadataModel {
providerID: string
modelID: string
}
type ModelLike = Pick<DelegatedModelConfig, "providerID" | "modelID"> | MetadataModel
export function resolveMetadataModel(
primary: ModelLike | undefined,
fallback: ModelLike | undefined,
): MetadataModel | undefined {
if (primary) {
return { providerID: primary.providerID, modelID: primary.modelID }
}
if (fallback) {
return { providerID: fallback.providerID, modelID: fallback.modelID }
}
return undefined
}