feat(companion): add context warning stream helpers
This commit is contained in:
@@ -403,6 +403,12 @@ export class CompanionRuntimeClient {
|
||||
return this.subscribeEvent<TData>(COMPANION_EVENT_NAMES.agentTyping, handler);
|
||||
}
|
||||
|
||||
subscribeContextWarning<TData = unknown>(
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.subscribeEvent<TData>(COMPANION_EVENT_NAMES.contextWarning, handler);
|
||||
}
|
||||
|
||||
waitForEvent<TData = unknown>(
|
||||
eventName: string,
|
||||
options?: {
|
||||
@@ -475,6 +481,14 @@ export class CompanionRuntimeClient {
|
||||
return this.waitForEvent<TData>(COMPANION_EVENT_NAMES.agentTyping, options);
|
||||
}
|
||||
|
||||
waitForContextWarning<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<TData> {
|
||||
return this.waitForEvent<TData>(COMPANION_EVENT_NAMES.contextWarning, options);
|
||||
}
|
||||
|
||||
async call<T>(method: string, params?: Record<string, unknown>): Promise<T> {
|
||||
if (!this.connected) {
|
||||
if (!this.autoConnect) {
|
||||
|
||||
Reference in New Issue
Block a user