feat(companion): add platform stream passthrough helpers
This commit is contained in:
@@ -4,6 +4,8 @@ import type {
|
||||
CanvasGetResult,
|
||||
CanvasListResult,
|
||||
CanvasPutResult,
|
||||
CompanionEventPredicate,
|
||||
CompanionTypedEventHandler,
|
||||
CompanionRuntimeClient,
|
||||
DeleteCanvasArtifactInput,
|
||||
GetCanvasArtifactInput,
|
||||
@@ -217,6 +219,20 @@ export class MacOSCompanionClient {
|
||||
return this.runtime.clearCanvasArtifacts(this.resolveSessionId(sessionId));
|
||||
}
|
||||
|
||||
subscribeAgentStream<TData = unknown>(
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeAgentStream(handler);
|
||||
}
|
||||
|
||||
waitForAgentStream<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<TData> {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
private resolveSessionId(sessionId?: string): string {
|
||||
const resolved = sessionId ?? this.defaultSessionId;
|
||||
if (!resolved) {
|
||||
@@ -368,6 +384,20 @@ export class IOSCompanionClient {
|
||||
return this.runtime.clearCanvasArtifacts(this.resolveSessionId(sessionId));
|
||||
}
|
||||
|
||||
subscribeAgentStream<TData = unknown>(
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeAgentStream(handler);
|
||||
}
|
||||
|
||||
waitForAgentStream<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<TData> {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
private resolveSessionId(sessionId?: string): string {
|
||||
const resolved = sessionId ?? this.defaultSessionId;
|
||||
if (!resolved) {
|
||||
@@ -517,6 +547,20 @@ export class AndroidCompanionClient {
|
||||
return this.runtime.clearCanvasArtifacts(this.resolveSessionId(sessionId));
|
||||
}
|
||||
|
||||
subscribeAgentStream<TData = unknown>(
|
||||
handler: CompanionTypedEventHandler<TData>,
|
||||
): () => void {
|
||||
return this.runtime.subscribeAgentStream(handler);
|
||||
}
|
||||
|
||||
waitForAgentStream<TData = unknown>(options?: {
|
||||
timeoutMs?: number;
|
||||
predicate?: CompanionEventPredicate<TData>;
|
||||
signal?: AbortSignal;
|
||||
}): Promise<TData> {
|
||||
return this.runtime.waitForAgentStream(options);
|
||||
}
|
||||
|
||||
private resolveSessionId(sessionId?: string): string {
|
||||
const resolved = sessionId ?? this.defaultSessionId;
|
||||
if (!resolved) {
|
||||
|
||||
Reference in New Issue
Block a user