import { ClientAssembledToolCall } from "./tools.cjs";
import { StreamingMessageHandle } from "../messages.cjs";
import { AudioMedia, FileMedia, ImageMedia, VideoMedia } from "../media.cjs";
import { EventForChannel, EventForChannels, SubscribeOptions, YieldForChannel, YieldForChannels } from "../types.cjs";
import { SubagentHandle } from "./subagents.cjs";
import { SubscriptionHandle } from "../index.cjs";
import { Channel, Event, LifecycleCause, SubscribeParams, ToolsEvent } from "@langchain/protocol";

//#region src/client/stream/handles/subgraphs.d.ts
/**
 * Minimal subscription surface that {@link SubgraphHandle} and
 * {@link SubagentHandle} delegate to. Typed to match the
 * `Session.subscribe` raw-channel overloads without importing the
 * full `Session` class (avoids circular dependency).
 */
interface Subscribable {
  subscribe<TChannel extends Channel>(channel: TChannel, options?: SubscribeOptions): Promise<SubscriptionHandle<EventForChannel<TChannel>, YieldForChannel<TChannel>>>;
  subscribe<const TChannels extends readonly Channel[]>(channels: TChannels, options?: SubscribeOptions): Promise<SubscriptionHandle<EventForChannels<TChannels>, YieldForChannels<TChannels>>>;
  subscribe(params: SubscribeParams): Promise<SubscriptionHandle<Event>>;
}
/**
 * Discovered subgraph within a streaming session.
 *
 * Mirrors the in-process `SubgraphRunStream` pattern: each subgraph
 * has `name`, `index`, `namespace`, and lazy getters for projections
 * scoped to this subgraph's namespace.
 *
 * ```ts
 * for await (const sub of session.subgraphs) {
 *   for await (const msg of sub.messages) { ... }
 *   const state = await sub.output;
 * }
 * ```
 */
declare class SubgraphHandle {
  #private;
  readonly name: string;
  readonly index: number;
  readonly namespace: string[];
  /**
   * Non-empty when upstream attached a `cause` to this subgraph's
   * `lifecycle.started` event. Population is product-specific and
   * performed by stream transformers on the runtime side (e.g.
   * deepagents' `SubagentTransformer` emits
   * `{ type: "toolCall", tool_call_id }`). Generic clients should
   * treat `cause.type` as an open enum — the protocol allows future
   * variants (`send`, `edge`, ...) to be forwarded verbatim without
   * a SDK bump.
   */
  readonly cause?: LifecycleCause;
  readonly graphName?: string;
  /**
   * Raw `tool-started` event that triggered this subgraph, when
   * `cause.type === "toolCall"` and the matching event has been
   * observed on the `tools` channel.
   */
  toolStartedEvent?: ToolsEvent;
  constructor(name: string, index: number, namespace: string[], session: Subscribable, options?: {
    cause?: LifecycleCause;
    graphName?: string;
    toolStartedEvent?: ToolsEvent;
  });
  get messages(): AsyncIterable<StreamingMessageHandle>;
  get values(): AsyncIterable<unknown> & PromiseLike<unknown>;
  get toolCalls(): AsyncIterable<ClientAssembledToolCall>;
  get subgraphs(): AsyncIterable<SubgraphHandle>;
  get subagents(): AsyncIterable<SubagentHandle>;
  get audio(): AsyncIterable<AudioMedia>;
  get images(): AsyncIterable<ImageMedia>;
  get video(): AsyncIterable<VideoMedia>;
  get files(): AsyncIterable<FileMedia>;
  get output(): Promise<unknown>;
  /**
   * Create a raw channel subscription scoped to this subgraph's namespace.
   */
  subscribe<TChannel extends Channel>(channel: TChannel, options?: SubscribeOptions): Promise<SubscriptionHandle<EventForChannel<TChannel>, YieldForChannel<TChannel>>>;
  subscribe<const TChannels extends readonly Channel[]>(channels: TChannels, options?: SubscribeOptions): Promise<SubscriptionHandle<EventForChannels<TChannels>, YieldForChannels<TChannels>>>;
  subscribe(params: SubscribeParams): Promise<SubscriptionHandle<Event>>;
}
//#endregion
export { SubgraphHandle, Subscribable };
//# sourceMappingURL=subgraphs.d.cts.map