/**
 * Built-in workflow: `implementation_plan`
 *
 * Turns a feature or refactor request into an actionable implementation plan.
 * It first frames the goal, then explores relevant code areas in parallel, and
 * finally synthesizes phased tasks with risks and validation steps.
 *
 * Args:
 *   - request: feature, bugfix, or refactor request
 *   - scope: optional repo path or subsystem hint
 */
export declare const IMPLEMENTATION_PLAN_SCRIPT = "export const meta = {\n  name: 'implementation_plan',\n  description: 'Create an actionable implementation plan from a feature, refactor, or bugfix request.',\n  whenToUse: 'User wants a technical plan before coding, especially for multi-file or unfamiliar code changes.',\n  examplePrompts: [\n    { field: 'request', text: 'Plan a refactor of the session store' },\n    { field: 'request', text: 'Design implementation steps for OAuth login' },\n  ],\n  i18n: {\n    zh: {\n      description: '\u5C06\u529F\u80FD\u3001\u91CD\u6784\u6216\u4FEE\u590D\u9700\u6C42\u8F6C\u5316\u4E3A\u53EF\u6267\u884C\u7684\u5B9E\u73B0\u8BA1\u5212\u3002',\n      whenToUse: '\u7528\u6237\u60F3\u5728\u52A8\u624B\u5199\u4EE3\u7801\u524D\u62FF\u5230\u6280\u672F\u65B9\u6848\uFF0C\u5C24\u5176\u662F\u591A\u6587\u4EF6\u6216\u4E0D\u719F\u6089\u4EE3\u7801\u7684\u6539\u52A8\u3002',\n      examplePrompts: [\n        { field: 'request', text: '\u89C4\u5212 session store \u7684\u91CD\u6784\u6B65\u9AA4' },\n        { field: 'request', text: '\u8BBE\u8BA1 OAuth \u767B\u5F55\u7684\u5B9E\u73B0\u6B65\u9AA4' },\n      ],\n    },\n  },\n  tags: ['planning', 'implementation', 'architecture'],\n  estimatedAgents: { min: 5, max: 6 },\n  phases: [\n    { title: 'Frame' },\n    { title: 'Explore' },\n    { title: 'Plan' },\n    { title: 'Validate' },\n  ],\n}\n\nconst READ_ONLY_TOOLS = ['read_file', 'grep', 'find', 'list_dir']\n\nconst request = args && typeof args === 'object' && args.request\n  ? String(args.request)\n  : 'Infer the implementation request from the current conversation context.'\n\nconst scope = args && typeof args === 'object' && args.scope\n  ? String(args.scope)\n  : '.'\n\nphase('Frame')\nconst frame = await agent(\n  'Frame this implementation request. Identify the desired outcome, non-goals, likely affected domains, and open questions. Be concrete and avoid generic advice.\\n\\n' +\n    'REQUEST:\\n' + request + '\\n\\nSCOPE HINT:\\n' + scope,\n  {\n    label: 'request framing',\n    toolset: READ_ONLY_TOOLS,\n    schema: {\n      type: 'object',\n      properties: {\n        outcome: { type: 'string' },\n        nonGoals: { type: 'array', items: { type: 'string' } },\n        affectedDomains: { type: 'array', items: { type: 'string' } },\n        openQuestions: { type: 'array', items: { type: 'string' } },\n      },\n      required: ['outcome', 'affectedDomains'],\n    },\n  },\n)\n\nconst AREAS = [\n  { key: 'entrypoints', focus: 'Routes, commands, UI pages, public APIs, and user-facing surfaces that must change.' },\n  { key: 'domain', focus: 'Core domain model, state transitions, stores, services, and invariants.' },\n  { key: 'integration', focus: 'Cross-module dependencies, config, events, async jobs, persistence, and external APIs.' },\n  { key: 'validation', focus: 'Existing tests, missing regression tests, build/type/lint commands, and release validation.' },\n]\n\nphase('Explore')\nconst explorations = await parallel(\n  AREAS.map((area) => () =>\n    agent(\n      'Explore the repository for this implementation plan through the ' + area.key + ' lens.\\n' +\n        'Focus: ' + area.focus + '\\n\\n' +\n        'REQUEST:\\n' + request + '\\n\\n' +\n        'FRAME:\\n' + JSON.stringify(frame, null, 2) + '\\n\\n' +\n        'Return concrete files/functions/modules to inspect or modify, existing patterns to follow, and constraints that affect the plan.',\n      {\n        label: area.key + ' exploration',\n        toolset: READ_ONLY_TOOLS,\n        schema: {\n          type: 'object',\n          properties: {\n            targets: {\n              type: 'array',\n              items: {\n                type: 'object',\n                properties: {\n                  path: { type: 'string' },\n                  reason: { type: 'string' },\n                },\n                required: ['path', 'reason'],\n              },\n            },\n            patterns: { type: 'array', items: { type: 'string' } },\n            constraints: { type: 'array', items: { type: 'string' } },\n          },\n          required: ['targets', 'constraints'],\n        },\n      },\n    ),\n  ),\n)\n\nphase('Plan')\nconst plan = await agent(\n  'Synthesize an implementation plan from the framing and explorations. Make it executable by an engineer or coding agent. ' +\n    'Use phased tasks, name the concrete files/modules, include sequencing/dependencies, and call out decisions that need user confirmation.\\n\\n' +\n    JSON.stringify({ request, scope, frame, explorations }, null, 2),\n  {\n    label: 'plan synthesis',\n    schema: {\n      type: 'object',\n      properties: {\n        summary: { type: 'string' },\n        phases: {\n          type: 'array',\n          items: {\n            type: 'object',\n            properties: {\n              title: { type: 'string' },\n              tasks: { type: 'array', items: { type: 'string' } },\n              files: { type: 'array', items: { type: 'string' } },\n            },\n            required: ['title', 'tasks'],\n          },\n        },\n        decisions: { type: 'array', items: { type: 'string' } },\n        risks: { type: 'array', items: { type: 'string' } },\n      },\n      required: ['summary', 'phases', 'risks'],\n    },\n  },\n)\n\nphase('Validate')\nconst validation = await agent(\n  'Create a validation checklist for this implementation plan. Include targeted tests, full commands, manual UI/API checks if relevant, and rollback/recovery notes.\\n\\n' +\n    JSON.stringify({ request, plan }, null, 2),\n  {\n    label: 'validation checklist',\n    toolset: READ_ONLY_TOOLS,\n    schema: {\n      type: 'object',\n      properties: {\n        testCommands: { type: 'array', items: { type: 'string' } },\n        manualChecks: { type: 'array', items: { type: 'string' } },\n        rollbackNotes: { type: 'array', items: { type: 'string' } },\n      },\n      required: ['testCommands', 'manualChecks'],\n    },\n  },\n)\n\nreturn {\n  ok: true,\n  request,\n  scope,\n  ...(plan ?? { summary: 'plan synthesis failed', phases: [], decisions: [], risks: [] }),\n  validation: validation ?? { testCommands: [], manualChecks: [], rollbackNotes: [] },\n}\n";
