import { ThreadStream } from "../client/stream/index.js"; import { StreamStore } from "./store.js"; import { RootSnapshot, StreamControllerOptions, StreamSubmitOptions } from "./types.js"; import { ChannelRegistry } from "./channel-registry.js"; import { SubagentMap } from "./discovery/subagents.js"; import { SubgraphByNodeMap, SubgraphMap } from "./discovery/subgraphs.js"; import { MessageMetadata as MessageMetadata$1, MessageMetadataMap } from "./message-metadata-tracker.js"; import { SubmissionQueueEntry, SubmissionQueueSnapshot } from "./submit-coordinator.js"; import { Channel } from "@langchain/protocol"; //#region src/stream/controller.d.ts /** * Channel set covered by the always-on root subscription. Exported so * projections (and transports) can reason about what the root pump * already delivers before opening additional server subscriptions. */ declare const ROOT_PUMP_CHANNELS: readonly Channel[]; /** * Coordinates one thread's protocol-v2 stream and exposes stable * observable projections for framework bindings. * * The controller owns the root subscription, lazily binds scoped * projections through {@link ChannelRegistry}, and normalizes protocol * events into class-message, tool-call, discovery, interrupt, and queue * stores. * * @typeParam StateType - Shape of the graph state exposed on `values`. * @typeParam InterruptType - Shape of protocol interrupt payloads. * @typeParam ConfigurableType - Shape of `config.configurable` accepted by submit. */ declare class StreamController, InterruptType = unknown, ConfigurableType extends object = Record> { #private; readonly rootStore: StreamStore>; readonly subagentStore: StreamStore; readonly subgraphStore: StreamStore; readonly subgraphByNodeStore: StreamStore; readonly messageMetadataStore: StreamStore; readonly queueStore: StreamStore>; readonly registry: ChannelRegistry; /** * Create a controller around a LangGraph client and optional initial thread. * * @param options - Runtime configuration, client, thread id, and initial state. */ constructor(options: StreamControllerOptions); /** * Promise that settles the first time {@link hydrate} finishes on * the current thread. Resolves on a clean hydration, rejects when * the thread-state fetch errors. A fresh promise is installed on * every thread swap so `` wrappers re-suspend on * `switchThread`. */ get hydrationPromise(): Promise; /** * Fetch the checkpointed thread state and seed the root snapshot. * Re-calling with a different `threadId` swaps the underlying * {@link ThreadStream}, rewires the registry to the new thread, and * resets assemblers. * * @param threadId - Optional replacement thread id; `null` clears the active thread. */ hydrate(threadId?: string | null): Promise; /** * Submit input or a resume command to the active thread. * * @param input - Input payload for a new run; `null`/`undefined` submits no input. * @param options - Per-run config, metadata, multitask behavior, and callbacks. */ submit(input: unknown, options?: StreamSubmitOptions): Promise; /** * Abort the currently tracked run and mark the controller idle. */ stop(): Promise; /** * Cancel a queued submission by id. Returns `true` when the entry * was found and removed, `false` otherwise. * * Today this only removes the entry from the client-side mirror — * once the server exposes queue cancel (roadmap A0.3) the * controller will additionally issue a cancel call against the * active transport. * * @param id - Client-side queue entry id to remove. */ cancelQueued(id: string): Promise; /** * Drop every queued submission. Server-side cancel arrives with A0.3. */ clearQueue(): Promise; /** * Respond to a pending protocol interrupt. * * @param response - Payload to send back to the interrupted namespace. * @param target - Optional explicit interrupt id and namespace; defaults to the latest unresolved interrupt. */ respond(response: unknown, target?: { interruptId: string; namespace?: string[]; }): Promise; /** * Dispose the active thread, subscriptions, registry entries, and listeners. */ dispose(): Promise; /** * StrictMode-safe lifecycle hook for framework bindings. * * React 18+ `StrictMode` intentionally mounts → unmounts → remounts * components in dev to surface effect-cleanup bugs. A naive * `useEffect(() => () => controller.dispose())` would permanently * tear the controller down on that first synthetic unmount, leaving * every subsequent `submit()` a silent no-op. * * Call {@link activate} from the bind site's effect and return the * result as the effect's cleanup. The controller uses deferred * disposal: a `release()` only schedules a dispose on the next * microtask, which is cancelled if another `activate()` arrives * before it fires (the normal StrictMode remount path). */ activate(): () => void; /** * Returns the bound {@link ThreadStream}, if one exists. Prefer * {@link StreamController.rootStore} and selector projections for * UI work; use this for low-level protocol access. */ getThread(): ThreadStream | undefined; /** * Listen for `ThreadStream` lifecycle (swap on thread-id change, * detach on dispose). The listener fires immediately with the * current thread (may be `undefined`). * * @param listener - Callback invoked immediately and on every thread swap. */ subscribeThread(listener: (thread: ThreadStream | undefined) => void): () => void; } //#endregion export { ROOT_PUMP_CHANNELS, StreamController }; //# sourceMappingURL=controller.d.ts.map