( nextStepParams: NextStepParamsMap | undefined, toolId: string, consumedCounts: Map<string, number>, )
| 86 | } |
| 87 | |
| 88 | function consumeDynamicParams( |
| 89 | nextStepParams: NextStepParamsMap | undefined, |
| 90 | toolId: string, |
| 91 | consumedCounts: Map<string, number>, |
| 92 | ): NextStepParams | undefined { |
| 93 | const candidate = nextStepParams?.[toolId]; |
| 94 | if (!candidate) { |
| 95 | return undefined; |
| 96 | } |
| 97 | |
| 98 | if (Array.isArray(candidate)) { |
| 99 | const current = consumedCounts.get(toolId) ?? 0; |
| 100 | consumedCounts.set(toolId, current + 1); |
| 101 | return candidate[current]; |
| 102 | } |
| 103 | |
| 104 | return candidate; |
| 105 | } |
| 106 | |
| 107 | function mergeTemplateAndResponseNextSteps( |
| 108 | templateSteps: BuiltTemplateNextStep[], |
no test coverage detected