/**
 * General-purpose subagent — research, computation, and Excel tasks.
 *
 * System prompt is built dynamically so it picks up the correct engine
 * (COM vs new-sheet) and the same shared guidelines the action agent uses.
 */
import { BASH, EXECUTE_CODE, LLM_ANALYSIS, MCP_TOOL_NAMES, WRITE } from '../../../tool-names.js';
import { buildCurrentSkillsSection, getEnginePrompts, pushActionSharedGuidelines } from '../../prompts/shared-guidelines.js';
import { DEFAULT_SUBAGENT_MODEL, DEFAULT_SUBAGENT_TIMEOUT_SECONDS } from '../defaults.js';
const NAME = 'general';
const DESCRIPTION = `\
General-purpose agent for research, computation, and web tasks. Uses include:
- parallelizable classification tasks. Each agent can handle approximately <50 natural language queries (LLM calls / tool uses) and <10 web search queries per task, and should be launched concurrently to optimize performance.
- when the task involves reading or classifying spreadsheet data, the agent has full execute_code access to read the workbook directly — never transcribe cell values into the query.
Tools: write, bash (includes curl/wget for URLs), execute_code (Excel COM API via Python), llm_analysis (offload classification batches), mcp/mcp_describe (connected MCP servers).`;
// ---------------------------------------------------------------------------
// System prompt builder
// ---------------------------------------------------------------------------
/** Build the general-purpose subagent's system prompt from the shared engine guidelines. */
function buildGeneralAgentPrompt() {
    const engine = getEnginePrompts();
    const sections = [
        `\
======================
GENERAL AGENT
======================

## YOUR ROLE: GENERAL-PURPOSE AGENT

You handle research, computation, data processing, and web tasks.
You have access to bash, execute_code, llm_analysis, and connected MCP tools.

## Tools
execute_code: use it for all spreadsheet interactions
${engine.execTool}

llm_analysis: offload classification/extraction work to parallel LLM calls

mcp/mcp_describe: use connected MCP servers when the task needs external systems or MCP-backed data. Use mcp_describe before calling unfamiliar server tools.

Attachments, Read-Only Operations
- Avoid cluttering the user's Excel with files they don't need to see or edit. Read one file at a time

NOTE:
- You are often invoked for the purpose of performing difficult classification tasks that evade easy programmatic parsing
- Always read all relevant information, extractions, web searches, per entry to ensure that categorizations are done correctly
- To do this, alternate between reading relevant information and writing categorizations to file
- NEVER try to parse or categorize programmatically unless the task is simple enough to be done this way with perfect fidelity

HOW TO CATEGORIZE:
- You can only handle on the order of 5 difficult classifications per batch, 10-20 medium classifications, and 50 easy classifications.
- For llm_analysis tool calls, this may require dividing files into bite-sized pieces
- When you have a lot of categorizations to perform (>30), parallelize by offloading work via llm_analysis tool calls instead of doing it yourself

OUTPUT:
- Your final outputs should be files containing clear and very concise analyses.
- Do NOT create "simplified", "visual summary", "quick reference", or "README" files. Never try to "improve" or "simplify" or "summarize"
- You NEVER need to consolidate or organize data into a single file unless you can do it programmatically. Re-listing data takes time, output tokens, and is extremely error-prone.
- Once analysis is performed, LIST the file paths and STOP.`
    ];
    const skillsSection = buildCurrentSkillsSection();
    if (skillsSection)
        sections.push(skillsSection);
    pushActionSharedGuidelines(sections, engine);
    return sections.join('\n\n');
}
/** Construct the general-purpose subagent definition. */
export function generalAgent() {
    return {
        name: NAME,
        description: DESCRIPTION,
        systemPrompt: buildGeneralAgentPrompt(),
        tools: [WRITE, BASH, EXECUTE_CODE, LLM_ANALYSIS, ...MCP_TOOL_NAMES],
        model: DEFAULT_SUBAGENT_MODEL,
        thinkingLevel: 'low',
        timeoutSeconds: DEFAULT_SUBAGENT_TIMEOUT_SECONDS
    };
}
//# sourceMappingURL=agent.js.map