/**
 * Workbook reader subagent — indexes spreadsheet structure.
 *
 * Ported from backend/agent/tools/subagents/workbook_reader.py.
 * Tools: execute_code (read-only, ask-mode API reference).
 */
import { EXECUTE_CODE } from '../../../tool-names.js';
import { API_TAG } from '../../agent-definition.js';
import { getEnginePrompts, pushReadOnlySharedGuidelines } from '../../prompts/shared-guidelines.js';
import { DEFAULT_SUBAGENT_MODEL, DEFAULT_SUBAGENT_TIMEOUT_SECONDS } from '../defaults.js';
const NAME = 'workbook_reader';
const DESCRIPTION = `\
Indexes spreadsheet structure. Use this to map and acquire context over large multi-sheet workbooks.
Safe, fast, and lightweight — optimized for structural mapping.
Use for: mapping sheet structure, finding section headers and their ranges, locating key cells and named ranges, identifying data patterns and formatting conventions.`;
/** Build the workbook-reader subagent's read-only spreadsheet-indexing system prompt. */
function buildSystemPrompt() {
    const engine = getEnginePrompts(API_TAG.ASK);
    const sections = [
        `\
======================
WORKBOOK READER AGENT
======================
Current date: ${new Date().toISOString().slice(0, 10)}.
You are a spreadsheet indexer. You have access to a spreadsheet engine (execute_code). Your job is to scan a workbook and return a concise structural index given the main agent's query.

## Guidelines

- **Be concise.** Use ranges (e.g. "rows 12-45") not row-by-row enumeration. Keep output under 400 words.
- **Zero interpretation.** Report labels, locations, and patterns — never explain what values mean or what should be done with them.
- **Report structure:** sheet names, section headers and their row/column ranges, which areas are populated vs empty, formatting patterns (colors, borders) that signal structure.
- **Identify key cells:** headers, labeled inputs, named ranges, merge regions, and any cells with distinctive formatting.
- **Answer the task.** If the calling agent asks a specific structural question (e.g. "which sheets contain data?" or "where are the assumption inputs?"), answer it directly using cell references.

## Tools
- execute_code: spreadsheet access. Use \`workbook\` and \`worksheet\` globals directly.
`
    ];
    pushReadOnlySharedGuidelines(sections, engine);
    return sections.join('\n\n');
}
export const workbookReaderAgent = {
    name: NAME,
    description: DESCRIPTION,
    get systemPrompt() {
        return buildSystemPrompt();
    },
    tools: [EXECUTE_CODE],
    model: DEFAULT_SUBAGENT_MODEL,
    thinkingLevel: 'low',
    timeoutSeconds: DEFAULT_SUBAGENT_TIMEOUT_SECONDS
};
//# sourceMappingURL=agent.js.map