61
return cancelledElicitationResult();
62
}
64
>
// Observe the SDK's per-request abort signal so a host parked on
65
>
// `requestUserInput` unwinds promptly when the SDK cancels the elicitation
66
>
// (subprocess teardown, upstream abort). Mirrors `claudeCanUseTool.ts`.
67
>
const abortHandler = () => {
68
session.respondToUserInputRequest(requestId, ChatInputResponseKind.Cancel);
69
};
71
>
try {
72
>
const { response, answers } = await session.requestUserInput(chatRequest);
73
>
return elicitationResultFromAnswers(request, response, answers);
74
>
} finally {
75
>
options.signal.removeEventListener('abort', abortHandler);
76
>
}
77
}