/**
 * Public subagent registry surface for the task tool and tests.
 *
 * Built-in agents are registered eagerly so callers always see a stable
 * catalog, even after test resets.
 */
export { cloneAgent } from './clone/agent.js';
export { DEFAULT_SUBAGENT_MODEL, DEFAULT_SUBAGENT_TIMEOUT_SECONDS, TASK_MODEL_CHOICES } from './defaults.js';
export { documentReaderAgent } from './document-reader/agent.js';
export { generalAgent } from './general/agent.js';
export { verificationAgent } from './verification/agent.js';
import { clearRegisteredSubagents, listRegisteredSubagentNames, listRegisteredSubagents, lookupRegisteredSubagent, replaceBuiltInSubagents, replaceUserSubagents } from '../agent-registry.js';
import { documentReaderAgent } from './document-reader/agent.js';
import { generalAgent } from './general/agent.js';
import { verificationAgent } from './verification/agent.js';
/** Return the canonical list of built-in subagents shipped with the runtime. */
function builtInSubagents() {
    return [documentReaderAgent, generalAgent(), verificationAgent];
}
/** Re-register the built-in subagents if the registry has been cleared. */
function ensureBuiltInsRegistered() {
    if (listRegisteredSubagents().length === 0) {
        replaceBuiltInSubagents(builtInSubagents());
    }
}
/** Reset the subagent registry to the built-in defaults (test-only utility). */
export function resetRegistry() {
    clearRegisteredSubagents();
    replaceBuiltInSubagents(builtInSubagents());
}
/** Register a user-supplied list of subagents alongside the built-ins. */
export function registerUserAgents(agents) {
    ensureBuiltInsRegistered();
    replaceUserSubagents(agents);
}
/** Return all currently registered subagents (built-in + user). */
export function getRegisteredSubagents() {
    ensureBuiltInsRegistered();
    return listRegisteredSubagents();
}
/** Look up a subagent by name. */
export function getSubagent(name) {
    ensureBuiltInsRegistered();
    return lookupRegisteredSubagent(name);
}
/** Return the names of all registered subagents. */
export function getSubagentNames() {
    ensureBuiltInsRegistered();
    return listRegisteredSubagentNames();
}
/** Build the task tool description by enumerating each registered subagent. */
export function buildTaskToolDescription() {
    const subagents = getRegisteredSubagents();
    const preamble = `\
Launch a subagent to handle a complex task autonomously. Each subagent runs in its own context window with its own set of tools (see descriptions below).

Task queries should be self-contained, clear, and concise. The subagent CANNOT see your conversation history.
Include file paths, sheet names, cell ranges, and specific instructions in the query.

When multiple tasks are needed, launch them concurrently. NEVER call them sequentially — each agent takes time to complete.

Choose foreground vs background deliberately:
- Use foreground by default when you need the subagent result before your next step.
- Use run_in_background: true for long-running autonomous work, especially independent tasks likely to take more than 5-10 minutes.
- Background subagents notify you when they complete; use send_message for follow-ups when needed.

Choose the subagent_type carefully based on the task:
- document_reader: PDFs, images, document extraction (has llm_analysis for multimodal + bash for programmatic extraction)
- general: research, computation, Excel tasks (has write + execute_code + bash + llm_analysis + MCP)
- verification: read-only adversarial auditor for review, evidence gathering, and formula/value checks`;
    const lines = [preamble];
    for (const agent of subagents) {
        lines.push('');
        lines.push('================');
        lines.push(agent.name);
        lines.push('================');
        lines.push(agent.description.trim());
    }
    return lines.join('\n');
}
resetRegistry();
//# sourceMappingURL=index.js.map