Repository navigation
feat(bedrock): stream Converse tool arguments - #101
Merged
Merged
Conversation
Kinfe123
commented
Oct 30, 2026
Kinfe123
left a comment
Collaborator
Author
There was a problem hiding this comment.
lgtm, bedrock tool streams preserve call ids and clean up on errors.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #100.
Problem
Bedrock ConverseStream uses content-block events rather than the envelopes accepted by the existing adapters. Applications currently need their own index-to-tool-ID mapping to consume partial tool arguments with Streamfold.
Change
Add
streamfold/bedrock, reusing the shared integration and parser pool. Tool-use starts bind content block indexes to tool-use IDs, argument deltas update those calls, and block stops finalize them. Complete pending JSON is finalized at EOF. Text, reasoning, and metadata events are ignored; service error events fail the integration and abort active parsers.The event declaration accepts the AWS SDK's decoded event union directly, including its optional fields. AWS remains a development-only dependency.
Verification
node --test packages/core/src/bedrock.test.js: four focused tests pass, covering interleaved calls, immutable partial values, duplicate stops, empty arguments, EOF, truncation, byte limits, service errors, and unmatched-event diagnostics.pnpm typecheck: the actualBedrockRuntimeClient.send(new ConverseStreamCommand(...))stream compiles withreadStructuredand manual consumption.pnpm release:check: 201 JavaScript tests and 11 Rust tests pass, plus type/syntax, WASM, formatting, Clippy, and package checks.Public surface
Adds the
streamfold/bedrocksubpath,bedrock,createStructuredStream, andBedrockToolCallEvent. Updates the README, API guide, and unreleased changelog. No existing export or runtime dependency changes.