Commit graph

1267 commits

Author SHA1 Message Date
Ben Brandt
0535f47291
sidebar: Don't block worktree archival on empty drafts (#57145)
If we have empty drafts, they don't show up in the UI, so you can't get
rid of them. But they currently blocked worktree archival. Which is
particularly troublesome with terminal agents in a few cases.

This should hopefully solve the issue for terminals, but I think I need
to do a follow-up to investigate what happens when the last draft is
closed.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-19 21:08:39 +00:00
Tom Houlé
0d832bc6d5
Implement MCP OAuth client preregistration (#52900)
In the interactive MCP OAuth flow, the MCP client registers itself with
the authorization in one of three ways:

- Client ID Metadata Document aka CIMD (recommended default). This is
already implemented: https://zed.dev/oauth/client-metadata.json.
- Dynamic Client Registration (DCR). This is the traditional method.
Also already implemented in Zed.
- Pre-registration: the client is registered out of band, typically in
the IdP or SaaS provider's UI. You get a client id and maybe a client
secret, that have to be provided by the MCP client when it wants to
exchange an access token. This is what this pull request is about.

This PR has two main parts:

- Allow users to configure a client id and optional client secret for an
MCP server in their configuration, under a new `oauth` key, and take it
into account
- Make the MCP server state and the configuration modal aware of the
intermediate states (client secret missing) and error cases stemming
from client pre-registration.

The client secret can be stored either in the system keychain or in
plain text in the MCP server configuration. The UI tries to steer user
towards the more secure option: the keychain.

<img width="715" height="201" alt="Screenshot 2026-04-10 at 16 48 06"
src="https://github.com/user-attachments/assets/5e64103e-6746-4ef0-8bd9-533d492b6912"
/>

<img width="884" height="544" alt="Screenshot 2026-04-10 at 16 47 07"
src="https://github.com/user-attachments/assets/0e35bb3c-cbc4-4e8c-a713-66323597b2e2"
/>


<img width="785" height="558" alt="Screenshot 2026-04-10 at 16 47 23"
src="https://github.com/user-attachments/assets/03339187-1508-461a-87ae-a7c2647df9a5"
/>



Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes
https://github.com/issues/assigned?issue=zed-industries%7Czed%7C52198

**Note for the reviewer: I know how busy the AI team is at the moment so
please treat this as low priority, we don't have signal that this is a
highly desired feature. It's a rather large PR, so I'm happy to pair
review / walk through it.**

Release Notes:

- Added support for OAuth client pre-registration (client id, client
secret) to the built-in MCP client.
2026-05-19 17:45:07 +00:00
Ben Brandt
ad437c93c2
sidebar: Fix stale sidebar thread header state (#57017)
There was a case where if you archived or closed all threads, you
wouldn't see the empty state again.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-19 14:43:38 +00:00
Ben Brandt
589dc95c87
agent_ui: Restore last active agent panel entry (#57150)
Makes sure we can reload the last terminal, and also keeps track more
globally what your last agent type was so we can carry that over to new
workspaces

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-19 14:07:09 +00:00
Bennet Bo Fenner
da43bdb648
agent: Support image output from MCP tools (#57134)
Release Notes:

- agent: Support image output from MCP tools
2026-05-19 12:51:42 +00:00
Kunall Banerjee
85f410004c
agent_ui: Trigger @-mention menu after opening brackets (#55504)
Typing `@` immediately after `(`, `[`, or `{` did not open the Agent
Panel’s @-mention completion menu, so `(@file)`, `[@file]`, and
`{@file}` were unusable. This has been bothering me for quite some time
now. Overall, I believe this is a QoL improvement, albeit a small one.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [ ] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [ ] Performance impact has been considered and is acceptable

Release Notes:

- Fixed the Agent Panel’s @-mention menu not appearing when `@`
immediately follows `(`, `[`, or `{`.

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-19 10:05:49 +00:00
Ben Brandt
938490639a
agent_ui: Activate workspace from terminal notifications (#57096)
We weren't activating and focusing the right thing before.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-19 09:55:02 +00:00
Bennet Bo Fenner
8708a6fa74
agent: Do not decode images during render (#56866)
Turns out we were creating an ImageDecoder on every frame (added in
#46167) when a tool returned an image as output, because we were trying
to get its dimensions. That is now cached on `ContentBlock::Image`.

Release Notes:

- N/A
2026-05-19 09:51:42 +00:00
Danilo Leal
8ca194d833
Add built-in create-skill skill (#57064)
Closes AI-266

This PR adds a built-in skill called `create-skill`, which allows the
Zed agent to have access to a skill that teaches it how to properly
create skills for Zed. You can manually invoke it as well as just
letting the model auto-invoke it in case your prompt suggests creating a
new skill.

Release Notes:

- Agent: Added a built-in skill called `create-skill` to make the Zed
agent informed about how to do that.

---------

Co-authored-by: Richard Feldman <richard@zed.dev>
2026-05-19 00:16:04 +00:00
Ben Brandt
c3951af24f
acp: Support additional session directories (#57051)
Still behind a feature flag for now for testing with various agents.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-18 18:27:54 +00:00
Danilo Leal
b9ba43c9c1
agent_ui: Add mention disambiguation (#56926)
Closes AI-261

This PR adds mention disambiguation in the agent panel, which works both
for regular @-mentions as well as for skills. Effectively, when you
mention files with the same name, the mention crease displays the next
path parent name, following a similar approach to common tabs in the
editor. For skills, the skill source is displayed (either global or from
some project).

<img width="500" alt="Screenshot 2026-05-15 at 6  32@2x"
src="https://github.com/user-attachments/assets/72c99480-cf32-42ac-9304-3f65167a1d94"
/>

Release Notes:

- Agent: Improved file and skill mention disambiguation in the agent
panel.

---------

Co-authored-by: Richard Feldman <richard@zed.dev>
2026-05-18 16:36:37 +00:00
Bennet Bo Fenner
68340172a1
agent: Remove unused LanguageModelImage APIs (#57050)
Pulled out from #56866. Will help with MCP image support

Release Notes:

- N/A
2026-05-18 12:22:22 +00:00
Ben Brandt
e1f13a84b7
sidebar: Persist terminal threads in sidebar metadata (#56966)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Persist Terminal Threads across reloads

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-18 11:18:05 +00:00
Ben Brandt
f2df3f9e18
acp: Add logout support for ACP agents (#56959)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / miri_scheduler (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Behind feature flag until we move RFD forward, but already working great
on codex

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-05-17 20:50:16 +00:00
Ben Brandt
43585afc29
agent_ui: Paste dropped paths into agent terminals (#56686)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-17 17:15:09 +00:00
Ben Brandt
23231879cd
acp: Add ACP session deletion support (#57004)
Still behind a flag until RFD progresses. But also fixes one area where
we would have called delete even if we didn't have support.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-17 17:03:17 +00:00
Ben Brandt
ce38fd67a8
agent_ui: Show title edit for terminals in agent panel (#57005)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-17 17:01:36 +00:00
MartinYe1234
6e932e40b0
agent_ui: Replace @rule mentions with @skill (#56902)
Replaces the `@rule` autocomplete entry in the agent chat input with
`@skill`, since Zed Rules are being deprecated in favor of Skills.
Behavior matches the old `@rule` flow: selecting a skill inserts a Skill
mention crease that loads the skill file as context, and the entry only
appears when there are available skills.

The underlying `MentionUri::Rule` parsing/handling is left in place so
previously saved rule mentions still load correctly — only the
autocomplete surface area was migrated.

Release Notes:

- Replaced the `@rule` autocomplete entry with `@skill` in the agent
chat input.
2026-05-15 18:52:44 +00:00
MartinYe1234
33c5ce69ef
Hide Rules UI when Skills feature flag is enabled (#56782)
Hides the legacy Rules surfaces when the `skills` feature flag is
enabled, since Rules are surfaced through the Skills UI in that case:

- The **Rules** entry in the agent panel's ellipsis (triple-dot)
dropdown menu is hidden.
- The `assistant: open rules library` command palette action is hidden.

The `@rules` autocomplete in the chat input is intentionally left alone
for now.

### Implementation notes

`cx.has_flag::<SkillsFeatureFlag>()` reads from a global feature-flag
store that is populated asynchronously from the server:

- **Command palette**: `update_command_palette_filter` is already re-run
via `cx.on_flags_ready` once flags arrive, so the filter is reapplied
with the correct value. No new wiring needed.
- **Dropdown menu**: the popover's menu closure runs on every open, so
the latest flag value is reflected at click time.

Release Notes:

- N/A
2026-05-15 17:14:16 +00:00
Richard Feldman
bd725ced65
Dismiss Settings overlay when invoking New Thread (#56818)
When the Agent Panel had the Settings overlay open on top of the
ephemeral new-draft thread, pressing **Cmd-N** (or clicking *Start New
Thread* in Settings) silently did nothing — the action ran, but the
Settings overlay stayed painted on top.

The bug was in `AgentPanel::activate_draft`. Every other `activate_*`
path goes through `set_base_view`, which clears the overlay. But
`activate_draft` has an early return for the case where the base view
already holds the requested draft, and that early return only refocused
— it never touched `overlay_view`. So when the user was already on the
draft and the Settings overlay was on top, "new thread" had nothing
visible to do.

Fix: in that early-return branch, if an overlay is currently open, clear
it (which also handles focusing and emits `ActiveViewChanged`).

Added a regression test that puts the panel on the draft, sets the
Settings overlay, dispatches `NewThread`, and asserts the overlay is
gone. The test directly toggles `set_overlay(OverlayView::Configuration,
…)` rather than calling `open_configuration`, because the latter builds
provider configuration views and panics on the fake LM provider's
`unimplemented!()` `configuration_view` — and the bug being exercised
lives entirely in the overlay/base-view bookkeeping.

Closes AI-237

Release Notes:

- Fixed pressing "New Thread" (or Cmd-N) doing nothing when the Agent
Panel's Settings view was open
2026-05-15 15:41:16 +00:00
Ruy Vieira
02a3503a8e
agent_ui: Allow toggling profile selector during generation (#56784)
The idle guard prevented the keybinding from working while the agent was
generating, even though the profile selector button in the UI remained
clickable. Changing the profile affects future messages, not the
in-flight response, so there is no reason to block it.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #56704

Release Notes:

- Fixed the `agent: toggle profile selector` keybinding being ignored
while the agent was generating a response.

---------

Co-authored-by: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
2026-05-15 13:49:21 +00:00
Anthony Eid
3115298f98
agent_panel: Hide thread title edit button outside thread view (#56833)
Hide the edit thread title button unless the visible agent panel surface
is a thread.

Release Notes:

- N/A
2026-05-15 12:47:03 +00:00
Danilo Leal
23584b825c
agent_ui: Fix slash characters being intercepted as commands (#56862)
Follow up to https://github.com/zed-industries/zed/pull/56689. This PR
fixes an error where any instance of a slash character in the message
editor was going through the slash command validation. The fix makes the
validation get triggered only if the slash character is the very first
thing typed in the message. This follow the approach Slack, Discord, and
other apps that contain slash commands use. Also tweaked the messaging a
little bit so it's crystal clear what's happening.

Release Notes:

- N/A
2026-05-15 12:14:35 +00:00
Cameron Mcloughlin
bf68bf79ff
agent: Make fast mode more obvious (#56825)
Makes the fast mode toggle more obvious when it's enabled

<img width="154" height="34" alt="image"
src="https://github.com/user-attachments/assets/0468c9bd-a2c8-4368-9b19-7e068360f5d5"
/>

<img width="154" height="34" alt="image"
src="https://github.com/user-attachments/assets/d35199ce-b22e-4323-94d7-1dd8afaa8f04"
/>


Release Notes:

- N/A or Added/Fixed/Improved ...
2026-05-15 10:10:49 +00:00
Danilo Leal
700b0b5de6
agent_ui: Render skills as creases (#56689)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Closes AI-230

This PR makes skills, added as /-mentions, be rendered in the agent
panel as creases, like anything you'd @-mention. Naturally, clicking on
the crease button opens the corresponding skill file in a buffer.

It turned out to be quite a bit of plumbing to make this work,
particularly as I am also introducing an interface to display dividers
and headers in the completion menu. This was relevant to me to add
because it sets a good foundation to convert many agent panel-related
actions as slash commands.

Release Notes:

- N/A

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
2026-05-14 22:20:34 +00:00
Richard Feldman
5f5dd7ae30
Migrate Rules to global Skills and AGENTS.md (#56672)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
Adds a one-time, idempotent startup migration that moves every user Rule
out of the `PromptStore` LMDB database into the new Skills + AGENTS.md
world, in a single pass:

- **Non-Default Rules → global Skills.** Each one becomes
`~/.agents/skills/<slug>/SKILL.md` with `disable-model-invocation:
true`, preserving the original behavior that non-Default Rules were only
ever invoked when the user named them. They're now invokable via
`/skill-name` (and still `@`-mentions).
- **Default Rules → global AGENTS.md.** Each one is appended to
`paths::agents_file()` (e.g. `~/.config/zed/AGENTS.md` on macOS/Linux,
`%APPDATA%\Zed\AGENTS.md` on Windows) under an `## H2` heading
containing the rule's title. Default Rules used to be auto-included in
every conversation; the global AGENTS.md is loaded into the system
prompt of every conversation, so the behavior is preserved.
- **Customized built-in prompts → global AGENTS.md** (currently just the
commit-message prompt). If the user has edited a built-in away from
Zed's shipped `default_content()`, the edited body is appended at the
top of the AGENTS.md block. Uncustomized built-ins (still on the shipped
default) are skipped so we don't pollute AGENTS.md with text the user
never wrote.

The migration is gated on the `skills` feature flag — users without the
flag never have their Rules touched in any way. A single global KVP flag
(`rules_to_skills_migration_done`) short-circuits the migration on
subsequent launches, so it runs at most once per machine even across
release channels. A process-lifetime `AtomicBool` guard additionally
prevents racing duplicate spawns when the underlying `cx.on_flags_ready`
callback fires multiple times at startup.

Migration is intentionally non-destructive: rule rows in the LMDB
database stay in place. Users can still see and edit them through the
existing UI, and a downgrade to a Zed build without skills support won't
lose anything.

Slug generation (`agent_skills::slugify_skill_name`) lowercases ASCII
letters, turns spaces into dashes, and drops every other
non-alphanumeric character entirely — so `foo!bar` becomes `foobar`, not
`foo-bar`. `&` is special-cased to become `and` (so `rock&roll` →
`rock-and-roll`). Slug collisions and pre-existing skill directories are
handled by appending `-2`, `-3`, etc.

A title-bar onboarding banner ("Skills have replaced Rules") surfaces
for every user on the `skills` feature flag. Clicking it opens a small
`AlertModal`-based explainer that summarizes the two destinations and
points users at the new `/skill-name` slash command (and notes that
`@`-mentions still work).

Closes AI-227
Closes AI-232

Release Notes:

- N/A
2026-05-14 16:30:08 +00:00
Ben Brandt
d4a3e0d5c9
sidebar: Track terminal agent thread telemetry (#56723)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-14 14:47:30 +00:00
Ben Brandt
cad7406d52
agent_ui: Require an open project for agent panel (#56577)
A bit brute force, but it works.

<img width="1106" height="988" alt="image"
src="https://github.com/user-attachments/assets/d23f9a80-01c5-4ad3-a280-faf8b8bc9dbe"
/>


Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-14 01:24:30 +00:00
Ben Brandt
ffe4f4f5be
agent_ui: Fix full-width thread view layout (#56684)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #56677

Release Notes:

- Agent: Fix squashed message editor when `limit_content_width=false`
2026-05-13 21:29:21 +00:00
Ben Brandt
a7f037d94b
sidebar: Remove agent panel terminal feature flag (#56678)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Add the ability to create Terminal Threads in the Sidebar and Agent
Panel.
2026-05-13 21:21:52 +00:00
Smit Barmase
7ef2aff7c8
agent_ui: Fix Agent Panel terminal New Thread panic (#56645)
Fixes a panic when `agent::NewThread` creates an Agent Panel terminal
while the workspace is already being updated.

Release Notes:

- N/A
2026-05-13 14:38:09 +00:00
Ben Brandt
8109e55acf
sidebar: Omit placeholder agent terminal titles (#56612)
there was a "flicker" because it was showing "Terminal" for a
split-second

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-13 13:58:10 +00:00
Cameron Mcloughlin
2301e61d2a
agent_ui: Mermaid diagrams (#56430)
Adds mermaid diagrams to the agent UI

Defaults to rendering the diagram, toggle to switch back to code.

<img width="605" height="837" alt="image"
src="https://github.com/user-attachments/assets/ed87f4e3-77f3-4602-b783-65eda909ad01"
/>
<img width="615" height="334" alt="image"
src="https://github.com/user-attachments/assets/1a422c83-fed4-4099-b895-b5a16e9d2222"
/>


Also makes markdown preview markdown rendering use theme colors:

Before:
<img width="593" height="781" alt="image"
src="https://github.com/user-attachments/assets/8598ca42-d44a-426b-ac4a-fb3cd1288780"
/>

<img width="593" height="781" alt="image"
src="https://github.com/user-attachments/assets/737fdd62-0a37-48dd-a13a-4e11bf80f038"
/>


Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-13 09:57:17 +00:00
Richard Feldman
fe9f956460
Restrict tools from editing sensitive agents folders (#56456)
Treat `.agents/skills/` (project-local) and `~/.agents/skills/` (global)
as **sensitive paths**, on par with `.zed/` and the global config
directory. The agent's built-in editing tools (`edit_file`,
`write_file`, `create_directory`, `delete_path`, `move_path`,
`copy_path`) now require explicit user authorization before modifying
anything inside those paths, because the contents of skill files control
agent behavior.

This protection is worth landing on its own, ahead of Zed adding its own
skills support: other agents (e.g. Claude Code) already write skill
files into these locations, so a Zed installation may already have
skills on disk that should not be silently editable by the agent.

Also tightens the **pre-existing `.zed/` check** to compare path
components case-insensitively. macOS and Windows use case-insensitive
filesystems by default, so without this fix a malicious settings author
could bypass the local-settings classifier with `.ZED/settings.json`
(the canonicalized inode would match, but the path-component comparison
would miss it). The new `.agents/skills/` check has the same hazard and
now shares a single `component_matches_ignore_ascii_case` helper with
the `.zed/` check.

Introduces the `agent_skills` crate, scoped for now to just the path
constants and helpers (`global_skills_dir`,
`project_skills_relative_path`, `SKILL_FILE_NAME`) so the
tool-permission machinery can recognize the agent skills tree without
depending on a skill discovery / parsing / loading layer. Those will
land in follow-up PRs.

Closes AI-217

Release Notes:

- Agent: Require user confirmation before letting tools modify files
inside `.agents/skills/` (per-project) or `~/.agents/skills/` (global),
so skills installed by any agent are protected from unsolicited edits

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martinye022@gmail.com>
Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-12 22:47:51 +00:00
Matthias Endler
064a17fd12
agent_ui: Fix panic when multiple rewrite tool uses share a char offset counter (#52458)
## Context

The process_tool_use closure used a single chars_read_so_far counter
shared across all REWRITE_SECTION_TOOL_NAME tool use events. When the
LLM produced multiple separate rewrite tool uses (different IDs), the
counter from the first tool use carried over into the second. If the
second tool use had a shorter replacement_text, the slice indexing
panicked with index out of bounds.

(This caused my first ever Zed panic today.)

Fix by tracking bytes-read per tool use ID using a HashMap keyed on
LanguageModelToolUseId. Also replace the direct slice index with .get()
so any remaining out-of-bounds case is handled gracefully instead of
panicking.

Looks like it hasn't been reported yet. At least I couldn't find any
related issues.

## How to Review

I hope the fix is pretty self-explanatory. We keep track of multiple
rewrite tools, which explains the extra ceremony around getting the
right character count, but apart from that it's pretty straightforward.

The performance impact should be neglible because:

1. Once the completion stream ends (or the task is dropped/cancelled),
the entire Arc<Mutex<HashMap>> is freed.
2. The number of entries is tiny. In a single completion request the LLM
will produce at most a handful of
REWRITE_SECTION_TOOL_NAME tool uses. Each entry is just an Arc<str> key
+ usize value.

So the HashMap grows for the duration of one handle_completion call and
is then dropped wholesale.

## Self-Review Checklist

<!-- Check before requesting review: -->
- [X] I've reviewed my own diff for quality, security, and reliability
- [X] Unsafe blocks (if any) have justifying comments
- [X] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable

Release Notes:

- Fixed an out-of-bounds panic when the AI produced multiple inline
rewrites in a single completion.
2026-05-12 21:35:17 +00:00
Cameron Mcloughlin
4074eabb3d
agent_ui: Images (#56427)
Adds images to the agent panel

Release Notes:

- N/A or Added/Fixed/Improved ...

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-12 21:03:27 +00:00
Danilo Leal
a1306744da
Add some refinements to the draft thread UX (#56482)
Here are the overall changes I'm adding in this PR:

- Don't create a new thread when switching to a new external agent while
in parked draft state
- Include parked draft threads in the thread switcher
- Add the draft thread item in the sidebar when navigating away from a
draft, as opposed to only on cmd-n/new thread
- Upon deleting content from a parked draft, remove its entry from the
sidebar. From this point on, we convert that draft back into the
ephemeral state so it behaves the same way as a fresh new draft would.

Release Notes:

- N/A
2026-05-12 13:01:55 +00:00
sunwukk990
fddfc3fbee
acp: Prevent registry loading from hanging indefinitely (#56108)
Helps #51567
Refs #54531

Summary:

- Add total timeouts for ACP Registry JSON fetches and icon fetches,
including response body reads.
- Download registry icons concurrently and keep icon failures non-fatal,
so a blocked icon CDN does not delay registry availability by one
timeout per agent.
- Surface the stored registry fetch error in the ACP Registry empty
state and add a retry action.

This addresses cases where the registry request, or one of the icon
requests, never finishes. It does not make blocked networks succeed, but
it prevents the UI from sitting on `Loading registry...` indefinitely
and gives the user something actionable instead.

Test plan:

- `git diff --check HEAD~1..HEAD`
- `cargo fmt --check --package project --package agent_ui`
- `cargo check -p project`
- `cargo check -p agent_ui`
- `cargo test -p project --features test-support registry_refresh_`

Release Notes:

- Fixed the ACP Registry getting stuck on loading when registry or icon
requests hang.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
2026-05-12 08:52:12 +00:00
Danilo Leal
21277b3b98
agent_panel: Make thread title editing more discoverable (#56485)
Some checks are pending
Congratsbot / check-author (push) Waiting to run
Congratsbot / congrats (push) Blocked by required conditions
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / orchestrate (push) Waiting to run
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
This PR adds an edit icon button in the thread title to better
promote/communicate that that's an editable label.


https://github.com/user-attachments/assets/efd69efc-ad9b-4c48-9640-e21b09d70226

Release Notes:

- N/A
2026-05-12 04:25:47 +00:00
Bennet Bo Fenner
bf423dfc45
Support renaming ACP threads (#56446)
Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54689

Release Notes:

- Support editing the thread title for external agent threads
2026-05-11 19:21:10 +00:00
Mikayla Maki
bbe23cc40b
Bring back draft threads (#54292)
Self-Review Checklist:

- [ ] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
2026-05-11 16:23:33 +00:00
Ben Brandt
d9275898be
agent_ui: Fix double hint for keybinding (#56442)
Release Notes:

- N/A
2026-05-11 16:13:31 +00:00
Ben Brandt
1c884d13d3
agent_ui: Terminal notifications (#56424)
Use notifications + dings when the terminal needs your attention

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

---------

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-11 14:44:19 +00:00
Ben Brandt
17b90b45d3
agent_ui: Propagate font size actions from agent panel (#56419)
When the visible surface does not use agent font settings, bubble resize
and reset actions to the workspace so terminal font sizing still works.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-11 13:49:50 +00:00
Ben Brandt
cb715fb374
agent_ui: Restrict agent toolbar width only for threads (#56410)
For all other modes, we want full-width view

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-11 13:29:09 +00:00
Ben Brandt
0efac164b3
agent_ui: Avoid setting unchanged terminal titles (#56417)
If the user just clicked but didn't change it, let the terminal continue
to update it

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A

Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
2026-05-11 13:28:59 +00:00
Ben Brandt
7d3989602d
sidebar: Add terminals to thread switcher (#56388)
Some checks are pending
Congratsbot / congrats (push) Blocked by required conditions
Congratsbot / check-author (push) Waiting to run
deploy_nightly_docs / deploy_docs (push) Waiting to run
run_tests / extension_tests (push) Blocked by required conditions
run_tests / tests_pass (push) Blocked by required conditions
run_tests / check_scripts (push) Blocked by required conditions
run_tests / orchestrate (push) Waiting to run
run_tests / check_postgres_and_protobuf_migrations (push) Blocked by required conditions
run_tests / check_style (push) Waiting to run
run_tests / clippy_windows (push) Blocked by required conditions
run_tests / clippy_linux (push) Blocked by required conditions
run_tests / clippy_mac (push) Blocked by required conditions
run_tests / clippy_mac_x86_64 (push) Blocked by required conditions
run_tests / run_tests_windows (push) Blocked by required conditions
run_tests / run_tests_linux (push) Blocked by required conditions
run_tests / run_tests_mac (push) Blocked by required conditions
run_tests / doctests (push) Blocked by required conditions
run_tests / check_workspace_binaries (push) Blocked by required conditions
run_tests / build_visual_tests_binary (push) Blocked by required conditions
run_tests / check_wasm (push) Blocked by required conditions
run_tests / check_dependencies (push) Blocked by required conditions
run_tests / check_docs (push) Blocked by required conditions
run_tests / check_licenses (push) Blocked by required conditions
Allow confirming a terminal entry to activate it, track terminal
access for ordering, and close selected terminals via the archive
action.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- N/A
2026-05-11 12:21:29 +00:00
Ben Brandt
26cf175930
agent_ui: Create terminal title editors lazily (#56233)
Keep terminal titles as labels until clicked, then create and focus the
editor. Drop the editor and subscription when editing ends.

Fixes a memory leak from too many title updates.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #ISSUE

Release Notes:

- N/A
2026-05-09 18:34:48 +00:00
Kirill Bulatov
40d87a8c1f
Do not send "finished" agent notification when about to send a queued message (#56157)
I wait for an agent it takes time/thinks, but I notice some odd error in
its work that I want to correct: I write a message, knowing that e.g.
Claude can read that later at some point and continue normally, and
focus away from Zed.

At some point, I get the notification I need to react to, only to
understand that the generation is ongoing still due to that delayed
message sent.

Release Notes:

- Fixed agent "finished" notification appearing right before the queued
message is sent
2026-05-08 17:13:58 +00:00
Bennet Bo Fenner
be83c952f6
agent: Allow specifying which model is used for subagents (#56203)
Closes #52042 

Release Notes:

- agent: Added setting `subagent_model` to specify which model is used
when subagent is spawned

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
2026-05-08 17:06:02 +00:00