UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

22 lines • 1.48 kB
/** * An `AsyncIterable` over a generator that is handed an `AbortSignal`, aborted as soon as the * consumer calls `return()` on the iterator (a `for await` does on `break`). A generator's own * `return()` waits for its pending `await` to settle, so a subscriber parked on a wake-up that never * comes would hold its poll loop or pub/sub subscription for good; the signal lets that wait end and * the generator's `finally` run. */ export declare function interruptible<T>(source: (signal: AbortSignal) => AsyncGenerator<T, void, undefined>): AsyncIterable<T>; /** Resolves when `promise` does or `signal` aborts, whichever is first. Never rejects on abort. */ export declare function untilAborted<T>(promise: Promise<T>, signal: AbortSignal): Promise<T | undefined>; /** Waits `ms`, or less when `signal` aborts first. */ export declare function sleepUnlessAborted(ms: number, signal: AbortSignal): Promise<void>; /** * `frames`, ended as soon as `response` emits `close` — the client went away. The pending read is * abandoned and the source's iterator is told to `return()`, so a subscription on a run that writes * nothing more (parked on a person, or gone) does not outlive the connection that asked for it. */ export declare function untilClosed<T>(response: { once(event: 'close', listener: () => void): unknown; off(event: 'close', listener: () => void): unknown; }, frames: AsyncIterable<T>): AsyncIterable<T>; //# sourceMappingURL=interruptible.d.ts.map