import { SubagentRunStream } from "./types.js";
import { Namespace, NativeStreamTransformer } from "@langchain/langgraph";

//#region src/agents/transformers/subagent.d.ts
interface SubagentProjection {
  subagents: AsyncIterable<SubagentRunStream>;
}
/**
 * Creates a native transformer that surfaces nested named agents on
 * `run.subagents`.
 *
 * It watches `tasks` events to record each namespace's `lc_agent_name` (set by
 * `createAgent({ name })`) and the triggering tool call, then — for any nested
 * run one level below {@link scope} that carries an `lc_agent_name` — emits a
 * typed {@link SubagentRunStream} handle.
 *
 * Each handle is backed by its own per-subagent transformer instances
 * ({@link createMessagesTransformer}, {@link createToolCallTransformer}, and a
 * nested {@link createSubagentTransformer}) scoped to the subagent's namespace.
 * Every event in the subtree is fed straight into those transformers, which
 * self-filter by namespace; the subagent's final `output` is resolved from its
 * last `values` snapshot when its `lifecycle` completes.
 *
 * Marked `__native: true` — the `subagents` projection lands directly on the
 * `GraphRunStream` instance as `run.subagents`.
 *
 * @param scope - Namespace prefix this transformer is scoped to. The root agent
 *   uses `[]`; nested handles use their subagent's namespace, so grandchild
 *   subagents are discovered recursively.
 */
declare function createSubagentTransformer(scope?: Namespace): () => NativeStreamTransformer<SubagentProjection>;
//#endregion
export { createSubagentTransformer };
//# sourceMappingURL=subagent.d.ts.map