/**
 * Built-in workflow: `research`
 *
 * Multi-modal research sweep on a question (args.question). Fans out search /
 * exploration / source-reading angles in parallel, then synthesises a cited
 * report. Each angle is its own subagent so source reading does not pollute the
 * parent context.
 *
 * Args:
 *   - question: research question
 *   - depth: 'quick' (2 angles) | 'standard' (4) | 'deep' (6)
 */
export declare const RESEARCH_SCRIPT = "export const meta = {\n  name: 'research',\n  description: 'Multi-angle research on a question with parallel exploration and a cited synthesis.',\n  whenToUse: 'User asks a non-trivial research question that benefits from multiple search angles or source reads.',\n  examplePrompts: [\n    { field: 'question', text: 'Compare Bun vs Node startup performance' },\n    { field: 'question', text: 'What are the trade-offs of SQLite vs Postgres for this app?' },\n  ],\n  i18n: {\n    zh: {\n      description: '\u591A\u89D2\u5EA6\u5E76\u884C\u8C03\u7814\u4E00\u4E2A\u95EE\u9898\uFF0C\u5E76\u4EA7\u51FA\u5E26\u5F15\u7528\u7684\u7EFC\u5408\u62A5\u544A\u3002',\n      whenToUse: '\u7528\u6237\u63D0\u51FA\u9700\u8981\u591A\u89D2\u5EA6\u68C0\u7D22\u3001\u9605\u8BFB\u6765\u6E90\u7684\u975E\u5E73\u51E1\u8C03\u7814\u95EE\u9898\u65F6\u3002',\n      examplePrompts: [\n        { field: 'question', text: '\u6BD4\u8F83 Bun \u4E0E Node \u7684\u542F\u52A8\u6027\u80FD' },\n        { field: 'question', text: '\u8FD9\u4E2A\u5E94\u7528\u7528 SQLite \u8FD8\u662F Postgres \u5404\u6709\u4EC0\u4E48\u6743\u8861\uFF1F' },\n      ],\n    },\n  },\n  tags: ['research', 'investigation'],\n  estimatedAgents: { min: 4, max: 8 },\n  phases: [\n    { title: 'Frame' },\n    { title: 'Sweep' },\n    { title: 'Synthesize' },\n  ],\n}\n\nconst RESEARCH_TOOLS = ['web_search', 'web_fetch', 'read_file', 'grep', 'find', 'list_dir']\n\nconst question = args && typeof args === 'object' && args.question\n  ? String(args.question)\n  : 'No explicit question supplied; infer from the most recent user turn.'\n\nconst depth = args && typeof args === 'object' && args.depth\n  ? String(args.depth)\n  : 'standard'\nconst maxAngles = depth === 'quick' ? 2 : depth === 'deep' ? 6 : 4\n\nphase('Frame')\nconst frame = await agent(\n  'Frame this research question. Return exactly ' + maxAngles + ' distinct angles worth investigating, ' +\n    'each with the single most decisive sub-question. Be concrete.\\n\\nQUESTION:\\n' +\n    question,\n  {\n    label: 'framing',\n    schema: {\n      type: 'object',\n      properties: {\n        angles: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              title: { type: 'string' },\n              key_question: { type: 'string' },\n            },\n            required: ['title', 'key_question'],\n          },\n        },\n      },\n      required: ['angles'],\n    },\n  },\n)\n\nif (!frame || !frame.angles?.length) {\n  return { ok: false, reason: 'framing failed', question, depth }\n}\n\nconst angles = frame.angles.slice(0, maxAngles)\n\nphase('Sweep')\nconst angleReports = await parallel(\n  angles.map((a) => () =>\n    agent(\n      'Investigate this angle. Use search and source-read tools liberally. Distinguish what you can confirm from what is conjecture.\\n\\n' +\n        'ANGLE: ' + a.title + '\\n' +\n        'KEY QUESTION: ' + a.key_question + '\\n\\n' +\n        'Return: 3\u20136 grounded findings (each with a 1-line claim and a source URL or file path), plus the strongest counter-evidence.',\n      {\n        label: a.title,\n        toolset: RESEARCH_TOOLS,\n        maxIterations: depth === 'deep' ? 40 : 30,\n        schema: {\n          type: 'object',\n          properties: {\n            findings: {\n              type: 'array',\n              items: {\n                type: 'object',\n                properties: {\n                  claim: { type: 'string' },\n                  source: { type: 'string' },\n                  confidence: { type: 'string', enum: ['low', 'med', 'high'] },\n                },\n                required: ['claim', 'source', 'confidence'],\n              },\n            },\n            counterEvidence: { type: 'string' },\n          },\n          required: ['findings'],\n        },\n      },\n    ),\n  ),\n)\n\nphase('Synthesize')\nconst live = angleReports.filter(Boolean)\nconst synthesis = await agent(\n  'Synthesize a cited research report from these angle-level findings. Drop unsupported or duplicate claims. Use the highest-confidence source per claim. ' +\n    'Explicitly list contradictions where angles disagree. Return: an executive summary (max 5 sentences), top findings with inline source URLs, open questions, and contradictions.\\n\\n' +\n    'QUESTION:\\n' + question + '\\n\\n' +\n    JSON.stringify({ angles, reports: live }, null, 2),\n  {\n    label: 'synthesis',\n    schema: {\n      type: 'object',\n      properties: {\n        executiveSummary: { type: 'string' },\n        topFindings: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              claim: { type: 'string' },\n              source: { type: 'string' },\n            },\n            required: ['claim', 'source'],\n          },\n        },\n        openQuestions: { type: 'array', items: { type: 'string' } },\n        contradictions: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              topic: { type: 'string' },\n              sides: { type: 'array', items: { type: 'string' } },\n            },\n            required: ['topic', 'sides'],\n          },\n        },\n      },\n      required: ['executiveSummary', 'topFindings'],\n    },\n  },\n)\n\nreturn {\n  ok: true,\n  question,\n  depth,\n  angleCount: angles.length,\n  ...(synthesis ?? { executiveSummary: 'synthesis failed', topFindings: [], contradictions: [] }),\n}\n";
