/**
 * Workbook reader subagent — read-only spreadsheet indexer.
 *
 * Pinned to `spreadsheetReadOnly: true` — the `execute_code` tool is gated
 * to the read-only surface and the in-prompt API reference is rendered with
 * the ask-mode filter, regardless of the parent's mode.
 */
import { RUNTIME_THINKING_LEVEL } from '../../../../contracts/agent-settings.js';
import { ShortcutXLAgentModelId } from '../../../model-registry.js';
import { buildSubagentApiReferenceSection } from '../../../prompt/api-reference.js';
import { EXECUTE_CODE } from '../../tool-names.js';
import { DEFAULT_TASK_SUBAGENT_TIMEOUT_SECONDS } from '../agent-definition.js';
const SYSTEM_PROMPT_TEMPLATE = `\
======================
WORKBOOK READER AGENT
======================
Current date: {current_date}.
You are a spreadsheet indexer. You have access to a web-based Excel API. 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.`;
const DESCRIPTION = `\
**⚠️ Workbook reader cannot be used to read attachments, only the main workbook**
Indexes spreadsheet structure. Use this to map and acquire context over large multi-sheet workbooks. Tools: execute_code (read spreadsheet API)`;
function buildSystemPrompt(ctx) {
    const currentDate = new Date().toISOString().slice(0, 10);
    const head = SYSTEM_PROMPT_TEMPLATE.replace('{current_date}', currentDate);
    const apiReference = buildSubagentApiReferenceSection(ctx.platform, ctx.spreadsheetReadOnly);
    return [head, apiReference].join('\n\n');
}
export const workbookReaderSubagent = {
    name: 'workbook_reader',
    description: DESCRIPTION,
    systemPrompt: buildSystemPrompt,
    tools: [EXECUTE_CODE],
    model: ShortcutXLAgentModelId.ClaudeOpus48,
    thinkingLevel: RUNTIME_THINKING_LEVEL.Low,
    timeoutSeconds: DEFAULT_TASK_SUBAGENT_TIMEOUT_SECONDS,
    // Read-only API surface, independent of parent mode.
    spreadsheetReadOnly: true
};
//# sourceMappingURL=workbook-reader.js.map