adk_mcp_sse_stream (erlang_adk v0.10.0)
View SourceIncremental, credit-driven SSE decoder for MCP Streamable HTTP.
feed/3 never delivers more complete events than the owner has granted. Complete-but-undelivered input remains bounded inside the worker and the producer receives paused, making backpressure explicit. The worker is not linked to the owner, but monitors it and terminates immediately when the owner dies. decode/2 exposes the same parser as a pure helper for a transport process that already owns its receive loop.
Summary
Functions
-spec cancel(pid()) -> ok.
-spec credit(pid(), pos_integer()) -> ok | {error, term()}.
-spec feed(pid(), binary(), boolean()) -> {ok, non_neg_integer(), ready | paused | done} | {error, term()}.
-spec grant(map(), pos_integer()) -> {ok, map()} | {error, term()}.
-spec start(pid(), map()) -> gen_server:start_ret().
-spec start_link(pid(), map()) -> gen_server:start_ret().