MCPcopy Create free account
hub / github.com/tiann/hapi / cancelAll

Method cancelAll

cli/src/cursor/utils/cursorExtensionAdapter.ts:200–232  ·  view source on GitHub ↗
(reason: string)

Source from the content-addressed store, hash-verified

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
235function extractToolCallId(params: unknown): string | null {

Callers 4

runMainLoopMethod · 0.45
cleanupMethod · 0.45
handleAbortMethod · 0.45

Calls 2

clearMethod · 0.80
updateAgentStateMethod · 0.80

Tested by

no test coverage detected