fix(delegate-task): reject primary agents in task subagent resolution
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,27 @@
|
||||
import { findMostSpecificFallbackEntry } from "../../shared/fallback-chain-from-models"
|
||||
import type { FallbackEntry } from "../../shared/model-requirements"
|
||||
import type { DelegatedModelConfig } from "./types"
|
||||
|
||||
export function resolveEffectiveFallbackEntry(input: {
|
||||
categoryModel: DelegatedModelConfig | undefined
|
||||
configuredFallbackChain: FallbackEntry[] | undefined
|
||||
resolution:
|
||||
| { skipped: true }
|
||||
| { fallbackEntry?: FallbackEntry; matchedFallback?: boolean }
|
||||
| undefined
|
||||
}): FallbackEntry | undefined {
|
||||
const { categoryModel, configuredFallbackChain, resolution } = input
|
||||
|
||||
const resolutionSkipped = resolution && "skipped" in resolution
|
||||
const resolvedFallbackEntry = resolution && !resolutionSkipped ? resolution.fallbackEntry : undefined
|
||||
const matchedFallback = resolution && !resolutionSkipped ? resolution.matchedFallback === true : false
|
||||
|
||||
if (!matchedFallback || !categoryModel) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return resolvedFallbackEntry
|
||||
?? (configuredFallbackChain
|
||||
? findMostSpecificFallbackEntry(categoryModel.providerID, categoryModel.modelID, configuredFallbackChain)
|
||||
: undefined)
|
||||
}
|
||||
Reference in New Issue
Block a user