{"version":"2.1.228","anchor":"sdk-client-gains-fetch-middleware-and-wider-streaming-event-","canonical_anchor":"sdk-client-gains-fetch-middleware-and-wider-streaming-event-","heading":"SDK client gains fetch middleware and wider streaming event coverage","tier":"internal","area":"SDK","scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.228\/e\/sdk-client-gains-fetch-middleware-and-wider-streaming-event-","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.228","markdown":"### SDK client gains fetch middleware and wider streaming event coverage\n\nThe bundled API client can wrap network calls and understands more streaming event types.\n\n**What**\n\nThe bundled API client can now wrap its own network calls in middleware, and its streaming event filter passes through many more event types. Middleware that reads the response body is rejected with an error telling you to clone it or return a replacement.\n\n**Details**\n\n- Middleware runs around fetch and receives a parse context.\n- The rejection message is exact: middleware must use `response.clone()` to inspect the body, or `return new Response(body, response)` to consume and replace it.\n- Newly forwarded streaming events include `session.updated`, outcome-evaluation spans, agent thread messages, session thread status transitions, `event_start`\/`event_delta` and `system.message`.\n- New client namespaces: deployments, deployment runs, webhooks, dreams and tunnels.\n\n**Evidence**\n\n`middleware consumed the response body; use response.clone() to inspect it, or return new Response(body, response) to consume and replace it`\n\n- Area: SDK\n- Tier: Under the hood\n- Useful: 2\/5\n- Signal: 2\/5"}