(reason: string)
| 198 | } |
| 199 | |
| 200 | async cancelAll(reason: string): Promise<void> { |
| 201 | const entries = Array.from(this.pending.entries()); |
| 202 | this.pending.clear(); |
| 203 | |
| 204 | for (const [id, pending] of entries) { |
| 205 | pending.respond( |
| 206 | pending.tool === 'CursorAskQuestion' |
| 207 | ? { outcome: 'cancelled' } |
| 208 | : { outcome: 'cancelled' } |
| 209 | ); |
| 210 | |
| 211 | this.session.updateAgentState((currentState) => { |
| 212 | const requestEntry = currentState.requests?.[id]; |
| 213 | const { [id]: _, ...remaining } = currentState.requests ?? {}; |
| 214 | return { |
| 215 | ...currentState, |
| 216 | requests: remaining, |
| 217 | completedRequests: { |
| 218 | ...currentState.completedRequests, |
| 219 | [id]: { |
| 220 | tool: pending.tool, |
| 221 | arguments: pending.arguments, |
| 222 | createdAt: requestEntry?.createdAt ?? Date.now(), |
| 223 | completedAt: Date.now(), |
| 224 | status: 'canceled', |
| 225 | reason, |
| 226 | decision: 'abort' |
| 227 | } |
| 228 | } |
| 229 | } satisfies AgentState; |
| 230 | }); |
| 231 | } |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | function extractToolCallId(params: unknown): string | null { |
no test coverage detected