77
return true;
78
}
80
>
/**
81
>
* Like {@link respond}, but if no deferred is parked under `key`, buffer
82
>
* the value so a subsequent {@link register} / {@link registerAndFire}
83
>
* for the same key resolves immediately. Use when the completion may
84
>
* legitimately arrive before the awaiting handler registers (the
85
>
* Copilot client-tool round-trip, whose SDK handler and the workbench
86
>
* completion race).
87
>
*/
88
>
respondOrBuffer(key: string, value: T): void {
89
if (!this.respond(key, value)) {
90
this._earlyResults.set(key, value);
91
}
92
}
94
>
/** Whether a result arrived before a request registered under `key`. */
95
>
hasBufferedResult(key: string): boolean {
96
return this._earlyResults.has(key);
97
}
99
>
/**
100
>
* Resolve every parked deferred with `denyValue` and clear the registry.
101
>
*
102
>
* Designed for the permission-deny path: a "deny" answer is itself a
103
>
* successful round-trip result, so awaiting consumers receive `denyValue`
104
>
* rather than an error. Use {@link rejectAll} when callers must observe
105
>
* a thrown error instead (cancellation, dispose).
106
>
*/
107
>
denyAll(denyValue: T): void {
108
for (const [, deferred] of this._entries) {
109
if (!deferred.isSettled) {