fix: call tasks/result to deliver side-channel messages (#1185)

This commit is contained in:
Felix Weinberger 2025-11-28 11:46:20 +00:00 • committed by GitHub
commit 42a2f41f77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1021,6 +1021,14 @@ export abstract class Protocol<SendRequestT extends Request, SendNotificationT e
return;
}
// When input_required, call tasks/result to deliver queued messages
// (elicitation, sampling) via SSE and block until terminal
if (task.status === 'input_required') {
const result = await this.getTaskResult({ taskId }, resultSchema, options);
yield { type: 'result', result };
return;
}
// Wait before polling again
const pollInterval = task.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000;
await new Promise(resolve => setTimeout(resolve, pollInterval));