|
| 1 | +import { publisher } from '../constants' |
| 2 | +import { type SecretAgentDefinition } from '../types/secret-agent-definition' |
| 3 | + |
| 4 | +const definition: SecretAgentDefinition = { |
| 5 | + id: 'two-wave-planner', |
| 6 | + publisher, |
| 7 | + model: 'anthropic/claude-sonnet-4.5', |
| 8 | + displayName: 'Two Wave Planner', |
| 9 | + spawnerPrompt: |
| 10 | + 'Plans how to implement a list of requirements for a user request across two waves for deep refinement.', |
| 11 | + inputSchema: { |
| 12 | + params: { |
| 13 | + type: 'object', |
| 14 | + properties: { |
| 15 | + requirements: { |
| 16 | + type: 'array', |
| 17 | + items: { type: 'string' }, |
| 18 | + description: 'A list of explicit requirements to plan for, in the order they should be implemented', |
| 19 | + }, |
| 20 | + }, |
| 21 | + required: ['requirements'], |
| 22 | + }, |
| 23 | + }, |
| 24 | + outputMode: 'structured_output', |
| 25 | + toolNames: ['spawn_agents', 'set_output'], |
| 26 | + spawnableAgents: ['implementation-planner'], |
| 27 | + |
| 28 | + includeMessageHistory: true, |
| 29 | + inheritParentSystemPrompt: true, |
| 30 | + |
| 31 | + handleSteps: function* ({ params }) { |
| 32 | + const requirements: string[] = params?.requirements ?? [] |
| 33 | + |
| 34 | + yield { |
| 35 | + toolName: 'spawn_agents', |
| 36 | + input: { |
| 37 | + agents: requirements.map((requirement) => ({ |
| 38 | + agent_type: 'implementation-planner', |
| 39 | + prompt: `Research and give insights and proposals for this requirement: ${requirement}`, |
| 40 | + })), |
| 41 | + }, |
| 42 | + } |
| 43 | + |
| 44 | + const { toolResult: planResults } = yield { |
| 45 | + toolName: 'spawn_agents', |
| 46 | + input: { |
| 47 | + agents: requirements.map((requirement, idx) => ({ |
| 48 | + agent_type: 'implementation-planner', |
| 49 | + prompt: `Create a new plan for the following requirement: <requirement>${requirement}</requirement> |
| 50 | +
|
| 51 | +You can see the previous plans for the list of requirements in the message history above, including the previous plan for this requirement. Review them to: |
| 52 | +- Simplify your plan based on the broader context |
| 53 | +- Identify overlaps or conflicts with other plans |
| 54 | +- Find opportunities for code reuse across requirements |
| 55 | +- Ensure your plan integrates well with other requirements |
| 56 | +- Make your plan as concise as possible! A good plan is short and sweet.`, |
| 57 | + })), |
| 58 | + }, |
| 59 | + } |
| 60 | + |
| 61 | + const plans = planResults |
| 62 | + ? planResults.map((result) => |
| 63 | + result.type === 'json' ? result.value : '', |
| 64 | + ) |
| 65 | + : [] |
| 66 | + |
| 67 | + yield { |
| 68 | + toolName: 'set_output', |
| 69 | + input: { |
| 70 | + plans, |
| 71 | + }, |
| 72 | + } |
| 73 | + }, |
| 74 | +} |
| 75 | + |
| 76 | +export default definition |
0 commit comments