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:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user