Zed Improved. Aiming to improve upon Zed and make a truly delightful code editor. https://zed.dev
Find a file
tiagoq 56b99f49fd
bedrock: Fix remaining streaming delays (#33931)
Closes #26030

*Note: This is my first contribution to Zed*

This addresses a second streaming bottleneck in Bedrock that remained
after the initial fix in #28281 (released in preview 194).

The issue is in the mechanism used to convert Zed's internal `AsyncBody`
into the `SdkBody` expected by the Bedrock language provider. We are
using a non-streaming converter that buffers responses.

**How the fix works:**
The AWS SDK provides streaming-compatible converters to create `SdkBody`
instances, but these require the input body to implement the `Body`
trait from the `http-body` crate.

This PR enables streaming by implementing the required trait and
switching to the streaming-compatible converter.

**Changes (2 commits):**

 * 1st Commit - **Implement http-body Body trait for AsyncBody:**
   - Add `http-body = 1.0` dependency (already an indirect dependency)
   - Implement the `Body` trait for our existing `AsyncBody` type
- Uses `poll_frame` to read data chunks asynchronously, preserving
streaming behavior

 * 2nd Commit - **Use streaming-compatible AWS SDK converter:**
- Create `SdkBody` using `SdkBody::from_body_1_x()` with the new `Body`
trait implementation

**Details/FAQ:**

**Q: Why add another dependency?**
A: We tried to avoid adding a dependency, but the AWS SDK requires the
`Body` trait and `http-body` is where it's defined. The crate is already
an indirect dependency, making this a reasonable solution.

**Q: Why modify the shared `http_client` crate instead of just
`aws_bedrock_client`?**
A: We considered implementing the `Body` trait on a wrapper in
`aws_bedrock_client`, but since `AsyncBody` already uses `http` crate
types, extending support to the companion `http-body` crate seems
reasonable and may benefit other integrations.

**Q: How was this bottleneck discovered?**
A: After @5herlocked's initial streaming fix in #28281, I tested preview
194 and noticed streaming still had issues. I found a way to reproduce
the problem and chatted with @5herlocked about it. He immediately
pinpointed the exact location where the issue was occurring, his
diagnosis made this fix possible.

**Q: How does this relate to the previous fix?**
A: #28281 fixed buffering issues higher in the stack, but unfortunately
there was another bottleneck lower-down in the aws-http-client. This PR
addresses that separate buffering issue.

**Q: Does this use zero-copy or one-copy?**
A: The `Body` implementation includes one copy. Someone more
knowledgeable might be able to achieve a zero-copy approach, but we
opted for a conservative approach. The performance impact should not be
perceptible in typical usage.

**Testing:**
Confirmed that Bedrock streaming now works without buffering delays in a
local build.


Release Notes:

- Improved Bedrock streaming by eliminating response buffering delays

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2025-07-22 11:55:24 -04:00
.cargo windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00
.cloudflare docs: Document context servers (#21170) 2024-11-25 11:05:14 -05:00
.config collab: Add screen selector (#31506) 2025-07-21 13:44:51 +02:00
.github ci: Lint GitHub Actions workflows with actionlint (#34729) 2025-07-18 15:15:07 -04:00
.zed Ensure *.json recognized as JSONC if checkout folder not zed (#34289) 2025-07-11 14:25:09 +00:00
assets Add setting to disable all AI features (#34896) 2025-07-22 11:32:39 -04:00
crates bedrock: Fix remaining streaming delays (#33931) 2025-07-22 11:55:24 -04:00
docs Support multiple OpenAI compatible providers (#34212) 2025-07-22 12:20:07 -03:00
extensions Move Perplexity extension to dedicated repository (#34070) 2025-07-08 13:40:00 -04:00
legal ci: Check for broken links (#30844) 2025-06-06 09:39:35 +00:00
nix nix: Make zeditor symlink in package output (#31354) 2025-05-26 08:59:52 -07:00
script Add licenses.md for Windows build (#34272) 2025-07-11 19:28:48 +02:00
tooling Remove scap from workspace-hack (#34490) 2025-07-15 19:07:01 +00:00
.clinerules Initial .rules file for agent with symlinks for other rules file paths (#29014) 2025-04-17 23:41:23 +00:00
.cursorrules Initial .rules file for agent with symlinks for other rules file paths (#29014) 2025-04-17 23:41:23 +00:00
.git-blame-ignore-revs Add PR 15352 to .git-blame-ignore-revs (#30870) 2025-05-17 11:35:58 +00:00
.gitattributes Prevent GitHub from displaying comments within JSON files as errors (#7043) 2024-01-29 23:11:25 -05:00
.gitignore Account for issue types in top-ranking issues script (#33118) 2025-06-20 14:19:29 -04:00
.mailmap Update .mailmap (#30874) 2025-05-17 12:34:42 +00:00
.prettierrc ci: Add check for formatting default.json (#30034) 2025-05-06 18:55:26 +00:00
.rules gpui: Simplify Action macros + support doc comments in actions! (#33263) 2025-06-24 04:34:51 +00:00
.windsurfrules Initial .rules file for agent with symlinks for other rules file paths (#29014) 2025-04-17 23:41:23 +00:00
Cargo.lock bedrock: Fix remaining streaming delays (#33931) 2025-07-22 11:55:24 -04:00
Cargo.toml bedrock: Fix remaining streaming delays (#33931) 2025-07-22 11:55:24 -04:00
CLAUDE.md Initial .rules file for agent with symlinks for other rules file paths (#29014) 2025-04-17 23:41:23 +00:00
clippy.toml Restructure agent context (#29233) 2025-04-24 21:29:33 +00:00
CODE_OF_CONDUCT.md Remove community content from docs and point to zed.dev (#19895) 2024-10-29 09:44:58 -04:00
compose.yml Set stripe-mock version to 0.178.0 to match stripe API version used (#34786) 2025-07-20 19:39:04 +00:00
CONTRIBUTING.md Allow icon themes to provide their own file associations (#24926) 2025-02-15 00:35:13 +00:00
Cross.toml Add remote server cross compilation (#19136) 2024-10-12 23:23:56 -07:00
debug.plist WIP 2023-12-14 09:25:14 -07:00
default.nix Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
docker-compose.sql collab: Setup database for LLM service (#15882) 2024-08-06 17:18:08 -04:00
Dockerfile-collab chore: Bump Rust version to 1.88 (#33439) 2025-06-26 20:54:19 +02:00
Dockerfile-collab.dockerignore ci: Move collab to Dockerfile-collab (#18515) 2024-09-30 16:14:26 -04:00
Dockerfile-cross Add remote server cross compilation (#19136) 2024-10-12 23:23:56 -07:00
Dockerfile-cross.dockerignore Add remote server cross compilation (#19136) 2024-10-12 23:23:56 -07:00
Dockerfile-distros Support More Linux (#18480) 2024-09-30 17:46:21 -04:00
Dockerfile-distros.dockerignore Support More Linux (#18480) 2024-09-30 17:46:21 -04:00
flake.lock nix: Update to access new rust toolchain version (#33476) 2025-06-26 20:31:24 +00:00
flake.nix nix: Add job names and garnix substitutor (#31625) 2025-05-28 13:32:12 -07:00
LICENSE-AGPL Update license year (#24191) 2025-02-04 09:02:59 -05:00
LICENSE-APACHE Update license year (#24191) 2025-02-04 09:02:59 -05:00
LICENSE-GPL Licenses: change license fields in Cargo.toml to AGPL-3.0-or-later. (#5535) 2024-01-27 13:51:16 +01:00
livekit.yaml Add LiveKit server to Docker Compose (#7907) 2024-02-16 10:49:48 -05:00
lychee.toml ci: Check for broken links (#30844) 2025-06-06 09:39:35 +00:00
Procfile Refactor: Restructure collab main function to prepare for new subcommand: serve llm (#15824) 2024-08-05 12:07:38 -07:00
Procfile.postgrest Fix llm queries (#16006) 2024-08-08 17:21:38 -07:00
README.md Remove Repology badge from README (#30857) 2025-05-17 07:01:46 +00:00
renovate.json renovate: Require dependency dashboard approval for updates (#29065) 2025-04-18 18:44:30 +00:00
rust-toolchain.toml chore: Bump Rust version to 1.88 (#33439) 2025-06-26 20:54:19 +02:00
shell.nix Fix nix build (#26270) 2025-03-10 01:06:11 -07:00
typos.toml windows: Publish nightly (#24800) 2025-07-09 08:57:03 +08:00

Zed

CI

Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.


Installation

On macOS and Linux you can download Zed directly or install Zed via your local package manager.

Other platforms are not yet available:

Developing Zed

Contributing

See CONTRIBUTING.md for ways you can contribute to Zed.

Also... we're hiring! Check out our jobs page for open roles.

Licensing

License information for third party dependencies must be correctly provided for CI to pass.

We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:

  • Is it showing a no license specified error for a crate you've created? If so, add publish = false under [package] in your crate's Cargo.toml.
  • Is the error failed to satisfy license requirements for a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to the accepted array in script/licenses/zed-licenses.toml.
  • Is cargo-about unable to find the license for a dependency? If so, add a clarification field at the end of script/licenses/zed-licenses.toml, as specified in the cargo-about book.