feat(core): transition sub-agents to XML format and improve definitions (#18555)

This commit is contained in:
N. Taylor Mullen
2026-02-08 18:25:04 -08:00
committed by GitHub
parent 375c104b32
commit cb73fbf384
10 changed files with 638 additions and 116 deletions
+15 -3
View File
@@ -9,6 +9,8 @@ import process from 'node:process';
import { homedir } from '../utils/paths.js';
import { debugLogger } from '../utils/debugLogger.js';
import type { Config } from '../config/config.js';
import * as snippets from './snippets.js';
import * as legacySnippets from './snippets.legacy.js';
export type ResolvedPath = {
isSwitch: boolean;
@@ -63,15 +65,25 @@ export function applySubstitutions(
prompt: string,
config: Config,
skillsPrompt: string,
isGemini3: boolean = false,
): string {
let result = prompt;
result = result.replace(/\${AgentSkills}/g, skillsPrompt);
result = result.replace(
/\${SubAgents}/g,
config.getAgentRegistry().getDirectoryContext(),
const activeSnippets = isGemini3 ? snippets : legacySnippets;
const subAgentsContent = activeSnippets.renderSubAgents(
config
.getAgentRegistry()
.getAllDefinitions()
.map((d) => ({
name: d.displayName || d.name,
description: d.description,
})),
);
result = result.replace(/\${SubAgents}/g, subAgentsContent);
const toolRegistry = config.getToolRegistry();
const allToolNames = toolRegistry.getAllToolNames();
const availableToolsList =