@langchain/langgraph-sdk
Version:
Client library for interacting with the LangGraph API
35 lines (34 loc) • 1.57 kB
text/typescript
import { ChannelRegistry } from "../channel-registry.cjs";
import { ChannelProjectionOptions } from "./channel.cjs";
import { Channel, Event } from "@langchain/protocol";
//#region src/stream/projections/channel-effect.d.ts
/**
* Options for {@link acquireChannelEffect}. Extends
* {@link ChannelProjectionOptions} (`bufferSize`, `replay`) with the
* per-event callback and an optional error sink.
*/
interface ChannelEffectOptions extends ChannelProjectionOptions {
/** Invoked once for every event observed while attached. */
onEvent: (event: Event) => void;
/**
* Invoked when {@link onEvent} throws. When omitted, a throwing
* `onEvent` is swallowed so one bad delivery cannot wedge the shared
* store's notification loop or other consumers.
*/
onError?: (error: unknown) => void;
}
/**
* Acquire a side-effect subscription over one or more channels.
*
* @param registry - The stream's {@link ChannelRegistry}.
* @param channels - Channels to observe (e.g. `["lifecycle", "tools"]`).
* @param namespace - Resolved namespace (`[]` for the root).
* @param options - Callbacks plus projection (`bufferSize`/`replay`)
* options.
* @returns A `dispose()` function that detaches the listener and
* releases the ref-counted projection. Idempotent.
*/
declare function acquireChannelEffect(registry: ChannelRegistry, channels: readonly Channel[], namespace: readonly string[], options: ChannelEffectOptions): () => void;
//#endregion
export { ChannelEffectOptions, acquireChannelEffect };
//# sourceMappingURL=channel-effect.d.cts.map