/**
 * General-purpose subagent definition — research, computation, web tasks.
 *
 * The prompt keeps the role, workflow, categorization, and output-discipline
 * sections stable while targeting embedded tools. The spreadsheet API
 * reference is rendered for the active host platform at run time.
 */
import { RUNTIME_THINKING_LEVEL } from '../../../../contracts/agent-settings.js';
import { ShortcutXLAgentModelId } from '../../../model-registry.js';
import { buildSubagentApiReferenceSection } from '../../../prompt/api-reference.js';
import { SANDBOX_FILESYSTEM } from '../../../prompt/sections.js';
import { BASH_COMMAND, EXECUTE_CODE, SANDBOX_LLM, WEB_SEARCH } from '../../tool-names.js';
import { DEFAULT_TASK_SUBAGENT_TIMEOUT_SECONDS } from '../agent-definition.js';
const SYSTEM_PROMPT_TEMPLATE = `\
======================
GENERAL AGENT
======================
Current date: {current_date}.

## YOUR ROLE: GENERAL-PURPOSE AGENT

You handle research, computation, data processing, and web tasks.
{tool_access_guidance}

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 programatically unless it is the task is simple enough to be done this way with perfect fidelity

HOW TO CATEGORIZE:
- You (as well as sandbox llm tool calls) can only handle on the order of 5 difficult classifications per batch, 10-20 medium classifications, and 50 easy classifications.
- For sandbox llm tool calls, this may require dividing files into bite-sized pieces
- When you have a lot of categorizations to perform (>30), parallelize by off-loading work via sandbox llm 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 DESCRIPTION_BODY = `\
General-purpose agent for research, computation, and web tasks. Uses include concurrent reading / writing of spreadsheets, parallelizable research and classification tasks.
- Each agent can perform roughly 50-100 search or classification tasks and should be launched concurrently to optimize performance`;
function hasNativeWebSearch(ctx) {
    return !ctx.disabledToolNames?.includes(WEB_SEARCH);
}
function buildDescription(ctx) {
    const toolNames = [WEB_SEARCH, BASH_COMMAND, SANDBOX_LLM, EXECUTE_CODE].filter((name) => !ctx.disabledToolNames?.includes(name));
    return `${DESCRIPTION_BODY}\nTools: ${toolNames.join(', ')}.`;
}
function buildToolAccessGuidance(ctx) {
    return hasNativeWebSearch(ctx)
        ? 'You have access to web search, bash, sandbox_llm, and execute_code.\nUse web search for finding information. Use bash for computation, file processing, and fetching specific URLs (curl/wget).'
        : 'You have access to bash, sandbox_llm, and execute_code.\nUse bash for web access, computation, file processing, and fetching/searching from the sandbox (curl/wget and command-line tools).';
}
const DESCRIPTION = buildDescription({});
function buildSystemPrompt(ctx) {
    const currentDate = new Date().toISOString().slice(0, 10);
    const head = SYSTEM_PROMPT_TEMPLATE.replace('{current_date}', currentDate).replace('{tool_access_guidance}', buildToolAccessGuidance(ctx));
    const apiReference = buildSubagentApiReferenceSection(ctx.platform, ctx.spreadsheetReadOnly);
    return [head, SANDBOX_FILESYSTEM, apiReference].join('\n\n');
}
export const generalSubagent = {
    name: 'general',
    description: DESCRIPTION,
    buildDescription,
    systemPrompt: buildSystemPrompt,
    tools: [WEB_SEARCH, BASH_COMMAND, SANDBOX_LLM, EXECUTE_CODE],
    model: ShortcutXLAgentModelId.ClaudeOpus48,
    thinkingLevel: RUNTIME_THINKING_LEVEL.Low,
    timeoutSeconds: DEFAULT_TASK_SUBAGENT_TIMEOUT_SECONDS
    // No `spreadsheetReadOnly`: general inherits the parent session's mode.
};
//# sourceMappingURL=general.js.map