feat(companion): add platform single-event passthrough helpers
This commit is contained in:
@@ -252,6 +252,13 @@ export class MacOSCompanionClient {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
subscribeEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeEvent(eventName, handler);
|
||||
}
|
||||
|
||||
clearEventSubscriptions(): void {
|
||||
this.runtime.clearEventSubscriptions();
|
||||
}
|
||||
@@ -275,6 +282,17 @@ export class MacOSCompanionClient {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<TData> {
|
||||
return this.runtime.waitForEvent(eventName, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
@@ -472,6 +490,13 @@ export class IOSCompanionClient {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
subscribeEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeEvent(eventName, handler);
|
||||
}
|
||||
|
||||
clearEventSubscriptions(): void {
|
||||
this.runtime.clearEventSubscriptions();
|
||||
}
|
||||
@@ -495,6 +520,17 @@ export class IOSCompanionClient {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<TData> {
|
||||
return this.runtime.waitForEvent(eventName, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
@@ -690,6 +726,13 @@ export class AndroidCompanionClient {
|
||||
return this.runtime.subscribeEvents(handler);
|
||||
}
|
||||
|
||||
subscribeEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeEvent(eventName, handler);
|
||||
}
|
||||
|
||||
clearEventSubscriptions(): void {
|
||||
this.runtime.clearEventSubscriptions();
|
||||
}
|
||||
@@ -713,6 +756,17 @@ export class AndroidCompanionClient {
|
||||
return this.runtime.waitForAnyEvent(eventNames, options);
|
||||
}
|
||||
|
||||
waitForEvent<TData = unknown>(
|
||||
eventName: CompanionEventName | string,
|
||||
options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
): Promise<TData> {
|
||||
return this.runtime.waitForEvent(eventName, options);
|
||||
}
|
||||
|
||||
waitForAgentTyping<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
|
||||
Reference in New Issue
Block a user