1325
let contextAgent = parserContext?.forcedAgent ?? parserContext?.selectedAgent;
1326
if (options?.agentId) {
1328
>
if (!agent) {
1329
throw new Error(`Unknown agent: ${options.agentId}`);
1330
}
1332
>
parserContext = { ...parserContext, selectedAgent: agent, mode: options.modeInfo?.kind };
1333
>
const commandPart = options.slashCommand ? ` ${chatSubcommandLeader}${options.slashCommand}` : '';
1334
>
request = `${chatAgentLeader}${agent.name}${commandPart} ${request}`;
1335
} else if (options?.agentIdSilent && !parserContext?.forcedAgent) {
1336
// Resolve slash commands in the context of locked participant so its subcommands take precedence over global