Commit graph

1284 commits

Author SHA1 Message Date
MartinYe1234
cfd0461b5a
Prefix read_file tool output with line numbers (#56779)
Format `read_file` tool output in `cat -n` style: each line is prefixed
with its line number right-aligned in a 6-character field, followed by a
single tab, followed by the line's original content (newlines preserved,
including CRLF). Numbering reflects the actual file lines, so a ranged
read starting at line 42 emits `42` for its first line, not `1`.

For large files, content returned by `get_buffer_content_or_outline` is
**not** prefixed:

- The symbol outline path already conveys structure via its `[L100-150]`
annotations.
- The truncated first-1KB fallback (used when a file exceeds
`AUTO_OUTLINE_SIZE` and has no parseable outline) is wrapped in a
synthetic `# First 1KB of …` header, so its lines don't correspond to
real file line numbers.

Both cases are reported via `BufferContent::is_synthetic` (renamed from
`is_outline`).

Also updates the `edit_file` tool's input doc to describe the prefix
format and tell the model to strip it before constructing `old_text` /
`new_text`, preserving the original indentation that appears after the
tab.

Updates how we render `read_file` tool call outputs in the UI
(screenshots included in comments below).
Also fixes an existing bug where `read_file` tool call outputs would not
re-render their content code block when an older thread was restored
(the tool's `replay` hook was missing).

Closes AI-226

Release Notes:

- Improved how `read_file` tool output renders in the agent panel, with
a line-number gutter, and fixed it not re-rendering on restored threads

---------

Co-authored-by: zed-zippy[bot] <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-05-22 15:02:17 +00:00
Ben Brandt
dee596fa96
acp: Enable ACP additional directories (#57497)
If the agent server supports it, we pass along the multiple directories.

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 #54480

Release Notes:

- acp: External agents that support it now have access to all working
directories in a project.
2026-05-22 13:56:45 +00:00
Ben Brandt
91531fad6d
acp: Add logout support (#57492)
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:

- acp: Add Logout flow for agents that support it.
2026-05-22 12:25:26 +00:00
Danilo Leal
e2a1c4ce0c
agent_ui: Remove count for user rules in context tooltip (#57456)
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
The circular progress in the agent panel's message editor would
previously display the number of default user rules auto-embedded into
the thread. However, given default rules are all migrated to a global
AGENTS.md file, that feature doesn't make a lot of sense anymore. So,
this PR fixes it by adding a button that opens up the global file when
it exists.

Release Notes:

- N/A
2026-05-22 01:15:30 +00:00
MartinYe1234
6753eb1736
Update skill settings immediately after changes (#57447)
## Summary
- Hide deleted skills immediately in Settings while deletion completes
- Refresh the skill index after creating a skill so Settings updates
without reopening

Closes AI-299
Release Notes:

- Fixed skill management so newly created and deleted skills update in
Settings immediately.
2026-05-21 22:51:57 +00:00
MartinYe1234
f78f6da255
Make file paths in backticks clickable in agent panel (#57303)
When the agent mentions a file path inside `backticks` (e.g. ``
`src/main.rs` `` or `` `src/main.rs:42` ``), the rendered code span now
becomes a clickable link in the agent panel. Clicking opens the
referenced file in the workspace, jumping to the right line and column
when present.

## How it works

- **Shared path resolution.** Extracted `OpenTarget` and the
workspace/worktree resolution logic out of
`terminal_view::terminal_path_like_target` into a new
`workspace::path_link` module so both the terminal and the agent panel
can use the same code. Includes a `sanitize_path_text` helper ported
from the terminal's URL/punctuation handling. Pure refactor — terminal
behavior is unchanged.
- **`markdown` crate hook.** Added
`MarkdownElement::on_code_span_link(callback)`. When the callback
returns `Some(url)` for a given code span's contents, the existing
`push_link` machinery wires up cmd-hover, hit testing, and the existing
`on_url_click` callback. When it returns `None`, the code span renders
as before. The hook is opt-in, so `markdown` stays workspace-agnostic.
- **Agent panel wiring.** `render_agent_markdown` constructs an
`AgentCodeSpanResolver` that snapshots the project's visible worktree
entries plus their file extensions. `try_resolve` does a cheap
synchronous heuristic check (path must contain `/`/`\` or end in an
extension present in the workspace, can't be a URL, can't be all digits,
etc.) and then looks the candidate up in the per-worktree
`HashSet<Arc<RelPath>>`. On a hit it returns a `MentionUri::File` or
`MentionUri::Selection` URI, which the existing `thread_view::open_link`
already knows how to open at the right line.

## Edge cases handled

- Code spans inside fenced code blocks stay plain (gated on
`builder.code_block_stack.is_empty()`, matching how regular markdown
links behave).
- Trailing prose punctuation (`` `src/main.rs.` ``) is stripped before
lookup.
- Identifiers like `` `String` ``, `` `await` ``, `` `npm run dev` ``
stay plain — they don't pass the path-like heuristic.
- Cross-platform path separators handled via the per-worktree
`PathStyle`.

## Tests

- `crates/markdown` — unit test asserting code spans become links when
the callback returns `Some`, and stay plain when it doesn't.
- `crates/agent_ui` — unit test for `AgentCodeSpanResolver::try_resolve`
covering hits with and without a `:line` suffix, misses, identifiers,
and trailing punctuation.
- Existing `terminal_view` tests cover the moved resolution code
(unchanged behavior).

## Notes

- There's currently a temporary `log::info!` in
`AgentCodeSpanResolver::try_resolve` that reports per-call worktree-walk
timing and a cumulative total. Kept in for now to verify the feature
isn't being called excessively during streaming renders. Can be removed
before merge.
- Resolution is sync-only against worktree entries; absolute paths
outside the workspace are not resolved (would require an async re-render
path).

Closes AI-277

Release Notes:

- Made file paths in `backticks` clickable in the agent panel; clicking
opens the referenced file at the given line when present.
2026-05-21 22:04:32 +00:00
Danilo Leal
d61ffb8e6b
agent_ui: Add section for skills and rules in ellipsis menu (#57404)
Closes AI-291

This PR adds some new menu items in the agent panel's ellipsis menu to
make it easier to 1) create a new skill, 2) manage all existing skills
through the settings window, 3) open project and global AGENTS.md file,
if it exists.

Minor UI note: I'm adding an ellipsis character to the menu items in
which you need to do something else in a different view to fulfill the
item's label. For example, "Create Skill…" takes the ellipsis because
clicking on the menu item itself doesn't create the skill, but it takes
you to the place where you'll do that.

<img width="600" alt="Screenshot 2026-05-21 at 10  32@2x"
src="https://github.com/user-attachments/assets/1bfdd423-bd75-4c62-97ba-84130035ede8"
/>

Release Notes:

- N/A
2026-05-21 19:37:55 +00:00
Danilo Leal
7afcc87927
agent_ui: Add skills menu item in message editor's context menu (#57407)
Closes AI-295

This PR adds a skills submenu within the "add context" menu in the agent
panel's message editor. This will hopefully be yet another way to find
skills in the app.

<img width="600" alt="Screenshot 2026-05-21 at 11  24@2x"
src="https://github.com/user-attachments/assets/43652081-3929-4ca0-a32b-464077d84dd5"
/>

Release Notes:

- N/A
2026-05-21 19:29:55 +00:00
MartinYe1234
0307c7fb35
agent_ui: Fix crash when opening built-in skill mention in remote projects (#57432)
Clicking a built-in skill mention while connected to a remote project
(SSH or collab) caused Zed to abort with `called create_local_buffer on
a remote project`.

## Root cause

`agent_ui::ui::mention_crease::open_skill_file` was calling
`Project::create_local_buffer` to display the embedded read-only content
of a built-in skill:

```rust
let buffer = project.update(cx, |project, cx| {
    project.create_local_buffer(content, None, false, cx)
});
```

`Project::create_local_buffer` has an explicit panic guard for remote
projects, so any user who clicked a built-in skill mention while in an
SSH or collab project would crash Zed.

## Fix

The buffer is purely a display surface for binary-embedded skill content
— it has no on-disk backing, isn't searchable, and never needs to be
tracked by the project's buffer store. Build it directly with
`language::Buffer::local(content, cx)` instead, matching the pattern
used elsewhere in `agent_ui` (`thread_view.rs`, `message_editor.rs`,
`inline_assistant.rs`, etc.). This works for both local and remote
projects.

## Repro (before fix)

1. Connect Zed to a remote (SSH) project.
2. In the agent panel, click on a built-in skill mention (e.g. one
referencing `create-skill`).
3. Zed aborts with SIGABRT.

After the fix, the mention opens a read-only editor with the embedded
markdown content, identical behavior to local projects.

Release Notes:

- Fixed a crash when clicking a built-in skill mention in the agent
panel while connected to a remote project
2026-05-21 19:29:31 +00:00
Ben Brandt
e024200c67
agent_ui: Add keybindable action for terminal threads (#57399)
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 `agent::NewTerminalThread` for defining custom shortcuts to launch
an Agent Panel terminal thread.
2026-05-21 12:37:12 +00:00
Ben Brandt
800706d7a8
agent: Add experimental update title tool (#57395)
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-21 12:25:34 +00:00
Finn Evers
c84c22dab5
Deprecate and migrate ACP extensions (#57133)
Self-Review Checklist:

- [X] I've reviewed my own diff for quality, security, and reliability
- [N/A] 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:

- Removed support for ACP extensions. Installed ACP extensions will be
migrated to use the ACP servers as provided by the ACP registry instead.

---------

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
2026-05-21 08:32:23 +00:00
Danilo Leal
0042fb5850
markdown: Add ability to wrap/unwrap codeblock content (#57312)
This PR adds an icon button to Markdown codeblocks allowing to control
whether or not the content should be wrapped. At the moment, this is not
hard-persisted, meaning that 1) wrapping text in one codeblock instance
does not affect others, and 2) the codeblock will be reset every time
its view is recreated (i.e., closing and opening a Markdown Preview tab,
an agent thread, etc.). I intentionally kept it simple just to see how
it feels, but we can certainly consider a setting later on.

| Unwrapping | Wrapping |
|--------|--------|
| <img width="782" height="658" alt="Screenshot 2026-05-20 at 5  09
2@2x"
src="https://github.com/user-attachments/assets/e9151e91-32ba-40d4-9c65-535dec309291"
/> | <img width="736" height="604" alt="Screenshot 2026-05-20 at 5 
09@2x"
src="https://github.com/user-attachments/assets/157db6fd-ec4c-4c96-b44a-119273cbd0f9"
/> |

Release Notes:

- Added the ability to control codeblock content wrapping through the
UI.
2026-05-20 20:51:56 +00:00
Ben Brandt
1103bd8055
agent_ui: Improve agent terminal notification visibility logic (#57248)
Aligns Terminal notifications much closer to Thread notifications

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-20 12:47:18 +00:00
MartinYe1234
e2c38b5358
Replace Rules UI with Skills creation UI (#56924)
Replaces the legacy Rules creation UI with a focused "New Skill"
creation window when the `SkillsFeatureFlag` is on.

The new `skills_library` crate provides a single-skill form with:
- Name, Description, and Body fields (placeholders double as labels)
- Live validation matching the SKILL.md spec (name: 1–64 lowercase +
digits + hyphens, no leading/trailing hyphen; description: non-empty,
≤1024 chars)
- A scope dropdown listing every local worktree in the originating
workspace plus "Global"
- An Optional Parameters card with the `disable-model-invocation`
checkbox
- Save writes `<scope>/.agents/skills/<name>/SKILL.md` via
`serde_yaml_ng` (YAML-safe escaping), refuses to overwrite existing
skills, shows a success toast in the originating workspace, then closes
the window

The "Rules" entry in the agent panel triple-dot menu is renamed to
"Skills" when the flag is on. The existing `cmd-alt-l` keyboard shortcut
still works: `AgentPanel::deploy_rules_library` reroutes to
`deploy_skills_library` when the flag is on, so any persisted keymaps
and the menu's automatic shortcut lookup keep functioning without
changes to the default keymap files.

The old `rules_library` crate is intentionally left in place for this PR
— once the flag rolls out and the few remaining `OpenRulesLibrary {
prompt_to_select }` call sites (in thread_view link handlers and
@-mention crease) are migrated to an "open existing skill" flow, a
follow-up can delete the crate entirely.

15 unit tests cover the validation rules, frontmatter formatting
(including YAML-special-character round-tripping), and disk write
behavior (creates directory, refuses overwrite).

Closes AI-247

Release Notes:

- Added a new Skills creation UI that replaces the old Rules library
when the Skills feature flag is enabled.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2026-05-20 02:40:57 +00:00
Danilo Leal
1ddf7407e9
Use the announcement toast for skills support (#56873)
Closes AI-244

This PR changes the approach for announcing skills support. It uses the
announcement toast, the same thing used for parallel agents, which
observes a specific version number to be displayed. I ended up
simplifying things a bit by thinking we could rely on documentation for
more detailed information (with more extensive paths and whatnot).

Release Notes:

- N/A

---------

Co-authored-by: Richard Feldman <richard@zed.dev>
Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martinye022@gmail.com>
2026-05-20 01:26:06 +00:00
Richard Feldman
2e70059cd9
Remove Skills feature flag (#57162)
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 / check_scripts (push) Blocked by required conditions
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_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
Removes the `skills` feature flag now that Skills are ready to ship to
all users. Cleans up all `cx.has_flag::<SkillsFeatureFlag>()` gates
across the agent, agent_ui, prompt_store, and title_bar crates, drops
the now-unused `feature_flags` dependency from `prompt_store` and
`title_bar`, and removes the dead `update_flags(true, vec!["skills"])`
calls from the agent's skills tests.

Closes AI-269

Release Notes:

- Enabled Skills for all users.

---------

Co-authored-by: MartinYe1234 <52641447+MartinYe1234@users.noreply.github.com>
Co-authored-by: Martin Ye <martinye022@gmail.com>
2026-05-20 00:28:09 +00:00
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