fix: numeric skill names, ultrawork missing run_in_background, ZWSP agent lookups
- #3354: Coerce data.name to String in loadSkillFromPath/loadSkillFromPathAsync to prevent crash when YAML parses numeric skill names (e.g., name: 12306) - #3416: Add required run_in_background parameter to all task() examples in ultrawork prompts (default, gpt, gemini, planner) to match tool schema - #3379/#3417/#3418/#3337/#3335: Strip ZWSP (U+200B) before agent name comparisons in agent-tool-restrictions, sync-prompt-sender, tool-execute-after, tool-execute-before, oracle-verification-detector, call-omo-agent, recovery-prompt-config, and agent-variant to prevent ZWSP-prefixed display names from breaking exact-match lookups
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { stripInvisibleAgentCharacters } from "./agent-display-names"
|
||||
|
||||
/**
|
||||
* Agent tool restrictions for session.prompt calls.
|
||||
* OpenCode SDK's session.prompt `tools` parameter expects boolean values.
|
||||
@@ -45,13 +47,15 @@ const AGENT_RESTRICTIONS: Record<string, Record<string, boolean>> = {
|
||||
}
|
||||
|
||||
export function getAgentToolRestrictions(agentName: string): Record<string, boolean> {
|
||||
return AGENT_RESTRICTIONS[agentName]
|
||||
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
||||
const stripped = stripInvisibleAgentCharacters(agentName)
|
||||
return AGENT_RESTRICTIONS[stripped]
|
||||
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === stripped.toLowerCase())?.[1]
|
||||
?? {}
|
||||
}
|
||||
|
||||
export function hasAgentToolRestrictions(agentName: string): boolean {
|
||||
const restrictions = AGENT_RESTRICTIONS[agentName]
|
||||
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
||||
const stripped = stripInvisibleAgentCharacters(agentName)
|
||||
const restrictions = AGENT_RESTRICTIONS[stripped]
|
||||
?? Object.entries(AGENT_RESTRICTIONS).find(([key]) => key.toLowerCase() === stripped.toLowerCase())?.[1]
|
||||
return restrictions !== undefined && Object.keys(restrictions).length > 0
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { OhMyOpenCodeConfig } from "../config"
|
||||
import { stripInvisibleAgentCharacters } from "./agent-display-names"
|
||||
import { AGENT_MODEL_REQUIREMENTS, CATEGORY_MODEL_REQUIREMENTS } from "./model-requirements"
|
||||
|
||||
export function resolveAgentVariant(
|
||||
@@ -9,12 +10,13 @@ export function resolveAgentVariant(
|
||||
return undefined
|
||||
}
|
||||
|
||||
const stripped = stripInvisibleAgentCharacters(agentName)
|
||||
const agentOverrides = config.agents as
|
||||
| Record<string, { variant?: string; category?: string }>
|
||||
| undefined
|
||||
const agentOverride = agentOverrides
|
||||
? agentOverrides[agentName]
|
||||
?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
||||
? agentOverrides[stripped]
|
||||
?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === stripped.toLowerCase())?.[1]
|
||||
: undefined
|
||||
if (!agentOverride) {
|
||||
return undefined
|
||||
@@ -37,18 +39,19 @@ export function resolveVariantForModel(
|
||||
agentName: string,
|
||||
currentModel: { providerID: string; modelID: string },
|
||||
): string | undefined {
|
||||
const stripped = stripInvisibleAgentCharacters(agentName)
|
||||
const agentOverrides = config.agents as
|
||||
| Record<string, { variant?: string; category?: string }>
|
||||
| undefined
|
||||
const agentOverride = agentOverrides
|
||||
? agentOverrides[agentName]
|
||||
?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === agentName.toLowerCase())?.[1]
|
||||
? agentOverrides[stripped]
|
||||
?? Object.entries(agentOverrides).find(([key]) => key.toLowerCase() === stripped.toLowerCase())?.[1]
|
||||
: undefined
|
||||
if (agentOverride?.variant) {
|
||||
return agentOverride.variant
|
||||
}
|
||||
|
||||
const agentRequirement = AGENT_MODEL_REQUIREMENTS[agentName]
|
||||
const agentRequirement = AGENT_MODEL_REQUIREMENTS[stripped]
|
||||
if (agentRequirement) {
|
||||
return findVariantInChain(agentRequirement.fallbackChain, currentModel)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user