@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
23 lines • 1.18 kB
TypeScript
import type { OpenCodeClient, OpenCodeEvent } from './client.js';
type Listener = (event: OpenCodeEvent) => void;
/** The session an event belongs to. Form events carry it inside the form. */
export declare function sessionOf(event: OpenCodeEvent): string | undefined;
/**
* One event subscription per OpenCode server, fanned out to the turns listening on its sessions. A
* server's stream closes when its last listener leaves; a stream that drops reconnects with backoff.
*/
export declare class OpenCodeEventHub {
private readonly streams;
/** Listen to one session's events on a server. Resolves once the server's stream is open. */
listen(serverKey: string, client: OpenCodeClient, sessionId: string, listener: Listener): Promise<() => void>;
close(): void;
/**
* The server's stream, opened on `client`. A different client for a known key (the host replaced
* the connection, e.g. a new sandbox under the same key) moves every listener to a stream on the
* new one: the old connection may be dead, and its sessions would never hear back.
*/
private streamFor;
private pump;
}
export {};
//# sourceMappingURL=event-hub.d.ts.map