import { HttpAgent } from "@ag-ui/client"; import type { BaseEvent, RunAgentInput } from "@ag-ui/core"; import type { Observable } from "rxjs"; /** * An `HttpAgent` that tolerates the AG-UI event streams real agents emit. * * @deprecated Pass a plain `HttpAgent` instead. Channels now tolerate these * streams by default — `createChannel` coerces the offending field on the wire * (opt out with `sanitizeAgentEvents: false`), so nothing needs a special agent * class. This class is kept, unchanged, so existing code keeps working; it will * be removed once `@ag-ui/langgraph` stops emitting the null (OSS-691). Note it * still replaces the whole stock transform, so it also forgoes protobuf * content-type negotiation and the graceful `AbortError` → `RUN_ERROR` * conversion that the default path keeps. * * `@ag-ui/client`'s stock transform re-validates every streamed event against a * strict Zod schema. Some events that `@ag-ui/langgraph` legitimately emits fail * it (notably a `TOOL_CALL_START` whose `parentMessageId` is `null`: "Expected * string, received null"), and a single rejected event aborts the entire run. * That breaks LangGraph interrupts / human-in-the-loop on Teams, where the tool * call that triggers the interrupt carries exactly that shape. * * The bridge talks to a trusted runtime, so rather than re-validate its output * we use the same SSE parse the stock path wraps (`parseSSEStream`) and coerce * the known nullable-string fields. This deliberately drops the stock * transform's *entire* strict Zod re-validation step (not just the offending * field). This is acceptable only because the runtime is trusted and `runHttpRequest` * still throws on transport/HTTP errors. The first coercion logs a one-time * breadcrumb so the workaround is visible in production. Revert to the stock * transform (`transformHttpEventStream`) once upstream makes the fields * nullable. * * Pointing a Teams bot at a LangGraph (or any other AG-UI) agent needs no * special class: * * ```ts * import { HttpAgent } from "@ag-ui/client"; * const agent = new HttpAgent({ url: process.env.AGENT_URL! }); * ``` */ export declare class SanitizingHttpAgent extends HttpAgent { run(input: RunAgentInput): Observable; } //# sourceMappingURL=sanitizing-http-agent.d.ts.map