fix: include parsed structured output in streamText end callbacks (#17717)
## Background The `streamText` structured-output replacement omitted the complete parsed output from `onEnd`/`onFinish`, preventing callback-based persistence workflows supported by `streamObject`. ## Root Cause `streamText` assembled end events exclusively from step results, while complete output parsing was only exposed through `result.output`. ## Summary - expose schema-inferred optional `output` in `onEnd`/`onFinish` - cache complete-output parsing so callbacks and `result.output` share one parse - keep `result.output` settlement independent from arbitrary callback completion - export `StreamTextEndEvent` and `StreamTextOnEndCallback` - keep telemetry events restricted to their existing shape - update docs, reproduction, focused tests, and patch changeset Callers that need to wait for asynchronous callback work can await `result.consumeStream()`. ## Testing - callback output and schema inference - reusable public callback/event types - single complete-output parse - parse failures return `undefined` to the callback while `result.output` rejects - `result.output` remains independent from active callbacks - callbacks can await `result.output` after asynchronous work - full `ai` Node and Edge suites - workspace type checking, linting, formatting, and package build - provider-independent reproduction ## Related Issues Fixes #11418 Closes #17701 Co-authored-by: pltoledo <57258959+pltoledo@users.noreply.github.com> --------- Co-authored-by: ai-sdk-factory <308175966+ai-sdk-factory@users.noreply.github.com> Co-authored-by: pltoledo <57258959+pltoledo@users.noreply.github.com> Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com> Co-authored-by: ai-sdk-factory[bot] <305873210+ai-sdk-factory[bot]@users.noreply.github.com>
L
Lars Grammel committed
6669d691c79f6161b3a03effafd44f9d4c361d03
Parent: e83d6dc
Committed by GitHub <noreply@github.com>
on 8/27/2026, 11:10:44 PM