({})
| 6 | let recentTaskCalls: number[] = [] |
| 7 | |
| 8 | export const ParallelGuardPlugin = async ({}) => { |
| 9 | return { |
| 10 | "tool.execute.before": async (input, output) => { |
| 11 | if (input.tool !== "task" && input.tool !== "Task") { |
| 12 | return |
| 13 | } |
| 14 | |
| 15 | const now = Date.now() |
| 16 | |
| 17 | // Track task calls within 5 second window |
| 18 | recentTaskCalls = recentTaskCalls.filter((t) => now - t < 5000) |
| 19 | recentTaskCalls.push(now) |
| 20 | |
| 21 | // If we see sequential task calls (not batched), log educational message |
| 22 | if (recentTaskCalls.length === 2) { |
| 23 | console.log( |
| 24 | "[parallel-guard] Tip: Launch multiple Task calls in ONE message for parallel execution!" |
| 25 | ) |
| 26 | } |
| 27 | }, |
| 28 | } |
| 29 | } |
nothing calls this directly
no outgoing calls
no test coverage detected