Commit graph

333 commits

Author SHA1 Message Date
tidely
bc99a86bb7
Reduce allocations (#30693)
Removes a unnecessary string conversion and some clones

Release Notes:

- N/A
2025-05-14 18:29:28 +02:00
Danilo Leal
234d6ce5f5
agent: Fix Markdown codeblock header buttons (#30645)
Closes https://github.com/zed-industries/zed/issues/30592

Release Notes:

- agent: Fixed Markdown codeblock header buttons being pushed by long
paths/file names.
2025-05-14 10:49:02 -03:00
Tristan Hume
d01559f9bc
Add setting for enabling/disabling feedback (#30448)
This is useful for enterprises, especially in combination with #30444,
to ensure code never gets sent to Zed.

Release Notes:

- N/A
2025-05-14 15:10:31 +02:00
Oleksiy Syvokon
255d8f7cf8
agent: Overwrite files more cautiously (#30649)
1. The `edit_file` tool tended to use `create_or_overwrite` a bit too
often, leading to corruption of long files. This change replaces the
boolean flag with an `EditFileMode` enum, which helps Agent make a more
deliberate choice when overwriting files.

With this change, the pass rate of the new eval increased from 10% to
100%.

2. eval: Added ability to run eval on top of an existing thread. Threads
can now be loaded from JSON files in the `SerializedThread` format,
which makes it easy to use real threads as starting points for
tests/evals.

3. Don't try to restore tool cards when running in headless or eval mode
-- we don't have a window to properly do this.

Release Notes:

- N/A
2025-05-14 10:40:44 +03:00
Marshall Bowers
7cad943fde
agent: Remove unused max monthly spend reached error (#30615)
This PR removes the code for showing the max monthly spend limit reached
error, as it is no longer used.

Release Notes:

- N/A
2025-05-13 09:43:13 +00:00
Richard Feldman
8fdf309a4a
Have read_file support images (#30435)
This is very basic support for them. There are a number of other TODOs
before this is really a first-class supported feature, so not adding any
release notes for it; for now, this PR just makes it so that if
read_file tries to read a PNG (which has come up in practice), it at
least correctly sends it to Anthropic instead of messing up.

This also lays the groundwork for future PRs for more first-class
support for images in tool calls across more image file formats and LLM
providers.

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
Co-authored-by: Agus Zubiaga <agus@zed.dev>
2025-05-13 10:58:00 +02:00
Danilo Leal
ddc649bdb8
agent: Don't rely only on color to communicate MCP server status (#30573)
The MCP server item in the settings view has an indicator that used to
only use colors to communicate the connection status. From an
accessibility standpoint, relying on just colors is never a good idea;
there should always be a supporting element that complements color for
communicating a certain thing. In this case, I added a tooltip, when you
hover over the indicator dot, that clearly words out the status.

Release Notes:

- agent: Improved clarity of MCP server connection status in the
Settings view.
2025-05-12 11:21:22 -03:00
Danilo Leal
41b0a5cf10
agent: Add menu item in the panel menu for zooming in feature (#30554)
Release Notes:

- agent: Added a menu item in the panel's menu for the zooming in/out
feature.
2025-05-12 08:46:00 -03:00
tidely
8000151aa9
zed: Reduce clones (#30550)
A collection of small patches that reduce clones. Mostly by using owned
iterators where possible.

Release Notes:

- N/A
2025-05-12 10:09:23 +00:00
Umesh Yadav
0ad582eec4
agent: Fix inline assistant focusing behavior for cursor placement (#29998)
Ref: https://github.com/zed-industries/zed/pull/29919

This PR improves how inline assistants are detected and focused based on
cursor position.

### Problem
The current implementation has inconsistent behavior:
- When selecting text within an inline assistant's range, the assistant
properly focuses
- When placing a cursor on a line containing an assistant (without
selection), a new assistant is created instead of focusing the existing
one

### Solution
Enhanced the assistant detection logic to:
- Check if the cursor is anywhere within the line range of an existing
assistant
- Maintain the same behavior for both cursor placement and text
selection
- Convert both cursor position and assistant ranges to points for better
line-based comparison

This creates a more intuitive editing experience when working with
inline assistants, reducing the creation of duplicate assistants when
the user intends to interact with existing ones.


https://github.com/user-attachments/assets/55eb80d1-76a7-4d42-aac4-2702e85f13c4

Release Notes:

- agent: Improved inline assistant behavior to focus existing assistants
when cursor is placed on their line, matching selection behavior

---------

Co-authored-by: Bennet Bo Fenner <bennet@zed.dev>
2025-05-12 09:29:14 +00:00
Michael Sloan
4deb8cce8d
agent: Fix 10 line code blocks being expandable despite fitting (#30540)
Release Notes:

- N/A
2025-05-12 09:17:37 +00:00
Michael Sloan
5abca0f867
Fix codeblock expansion initial state + refactor (#30539)
Release Notes:

- N/A
2025-05-12 09:05:00 +00:00
Chris Kelly
ed772e6baf
agent: Allow to collapse provider sections in the settings view (#30437)
This is my first time contributing, so happy to make changes as needed.

## Problem

I found the LLM Provider settings to be pretty difficult to scan as I
was looking to enter my API credentials for a provider. Because all of
the provider configuration is exposed by default, providers that come at
the end of the list are pushed fairly far down and require scrolling. As
this list increases the problem only get worse.

## Solution

This is strictly a UI change.

* I put each provider configuration in a Disclosure that is closed by
default. This made scanning for my provider easy, and exposing the
configuration takes a single click. No scrolling is required to see all
providers on my 956px high laptop screen.
* I also added the success checkmark to authenticated providers to make
it even easier to find them to update a key or sign out.
* The `Start New Thread` had a class applied that was overriding the
default hover behavior of other buttons, so I removed it.

## Before
![CleanShot 2025-05-09 at 14 06
04@2x](https://github.com/user-attachments/assets/48d1e7ea-0dc8-4adc-845c-5227ec965130)

## After
![CleanShot 2025-05-09 at 14 33
23](https://github.com/user-attachments/assets/67e842a7-3251-46e5-ab18-7c4e600b84d8)

Release Notes:

- Improved Agent Panel settings view scannability by making each
provider block collapsible by default.

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-05-12 05:07:30 -03:00
Agus Zubiaga
f0da3b74f8
agent: Handle thread title generation errors (#30273)
The title of a (text) thread would get stuck in "Loading Summary..."
when the request to generate it failed. We now handle this case by
falling back to the default title, and letting the user manually edit
the title or retry generating it.



https://github.com/user-attachments/assets/898d26ad-d31f-4b62-9b05-519d923b1b22



Release Notes:

- agent: Handle thread title generation errors

---------

Co-authored-by: Richard Feldman <oss@rtfeldman.com>
2025-05-12 07:45:48 +00:00
tidely
b34f19a46f
agent: Reduce allocations (#30220)
Just a tiny patch to reduce allocations during context loading

Calling `.cloned()` on an iterator clones each element one by one, while
`into_iter().collect()` pre-allocates the resulting `Vec`

Release Notes:

- N/A
2025-05-11 16:14:17 +00:00
Michael Sloan
1fa19c69a6
Agent panel: Zoom support (workspace::ToggleZoom) (#30504)
Release Notes:

- Added support for zooming the agent panel via `workspace::ToggleZoom`.
2025-05-11 13:08:55 +00:00
Danilo Leal
39da72161f
agent: Make terminal command render with Markdown in the tool card (#30430)
Closes https://github.com/zed-industries/zed/issues/30411

Rendering as markdown gives us text selection and copying for free. In
the future, we may want to explore having these commands be actual
editors, allowing you to step in, change the command, and re-run it
right from there.

Release Notes:

- agent: Made the terminal command in the tool card selectable and
copyable.
2025-05-09 21:53:11 -03:00
Marshall Bowers
f29c6e5661
Update zed_llm_client to v0.8.1 (#30433)
This PR updates the `zed_llm_client` crate to v0.8.1.

The name of `Plan::Free` changed to `Plan::ZedFree` in this version.

Release Notes:

- N/A
2025-05-09 21:08:03 +00:00
Cole Miller
000077facf
agent: Fix reinsertion of creases when editing past messages (#30417)
Just noticed this got lost when main was merged in #29828.

Release Notes:

- agent: Fixed the rendering of added context when editing past messages
in a thread.
2025-05-09 20:53:30 +00:00
Danilo Leal
9afc6f6f5c
agent: Fix layout shift due to the "Generating" label (#30422)
Closes https://github.com/zed-industries/zed/issues/30238

Release Notes:

- agent: Fixed layout shift happening in the toolbar (both in the
singleton and multibuffers) due to the "Generating" label that appeared
while the agent is still generating a response.
2025-05-09 16:20:14 -03:00
Agus Zubiaga
82d271cb5b
agent: Thread history update improvements (#30415)
- Try to preserve previously selected item on update
- Do not clear list items while updating to avoid a frame with no items
rendered

Release Notes:

- agent: Preserve previously selected item in Thread History on update

---------

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
2025-05-09 16:13:50 -03:00
Cole Miller
d6ab416168
Revert "Load Profile state from Thread and tie visibility to the thread's model" (#30413)
This reverts commit 3615d6d96c.

Ultimately, we want to restore the ability to store a profile
per-thread, but for now reverting this fixes a fairly disruptive bug.

Release Notes:

- Fixed a bug causing the agent to use the wrong profile in some cases.
2025-05-09 14:09:38 -04:00
Ben Brandt
1dfddf0a29
agent: write latest profile change to default setting (#30408)
Reverts back to previous behavior where we update your settings so we
can load a new thread from your last configuration.

Release Notes:

- agent: Persist profile changes for new threads
2025-05-09 17:09:19 +00:00
Danilo Leal
00292450e0
agent: Show delete thread icon buttons on hover/focus (#30370)
This PR's main goal is to show the delete thread button when the list
item is either focused or hovered. In order to do that, we ended up
refactoring (i.e., merging) the `PastThread` and `PastContext` elements
into a single `HistoryElementEntry` that already matches to the entry
type (i.e., context or thread).

Release Notes:

- agent: Simplify the UI by showing the delete thread icon button only
on hover or focus.

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
2025-05-09 12:55:40 -03:00
Michael Sloan
863d7ccb6d
Fix agent panel scroll while editing a past message (#30394)
This is similar to the `block_mouse_down` method added in #20649 (which
has a very similar motivation), but is more comprehensive in stopping
mouse events. Since I want to cherry-pick this to the releases, keeping
this change just to the agent panel. In a follow-up will replace
existing use of `block_mouse_down` to instead use this.

Release Notes:

- N/A
2025-05-09 15:33:33 +00:00
Michael Sloan
08f516ce9a
Misc improvement of code for agent markdown codeblock (#30388)
Release Notes:

- N/A
2025-05-09 14:48:24 +00:00
Cole Miller
9cff5cfe3a
agent: Keyboard navigation improvements (#30274)
- Fix `ctrl-p` not working in the model selector
- Select first entry when opening the context picker

Release Notes:

- Fixed `menu::SelectPrevious` keybindings not working in the agent
panel's model selector.
2025-05-09 13:52:06 +00:00
Michael Sloan
0abee5668a
Fix text overlap with markdown code block in list in agent response (#30377)
Seems that `h_full` was causing it to use the height of the overall list
item for some reason.

Closes #30002 

Release Notes:

- Agent Panel: Fixed text overlap for code blocks nested in lists in
agent response.
2025-05-09 12:48:16 +00:00
Antonio Scandurra
1b593f616f
Include EditAgent's raw output when inspecting thread (#30337)
This allows us to debug the raw edits that were generated when people
report feedback, when running evals and when opening the thread as
Markdown.

Release Notes:

- Improved debug output for agent threads.
2025-05-09 06:58:45 +00:00
Max Brunsfeld
29c31f020e
Implement rendering of images with data urls in markdown (#30322)
Fixes #28266

![Screenshot 2025-05-08 at 5 08
21 PM](https://github.com/user-attachments/assets/774d2dde-3f2d-466c-8eb1-c67badbd89e4)

Release Notes:

- Added support for rendering images with data URLs in markdown. This
can show up in hover documentation provided by language servers.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2025-05-08 18:26:24 -07:00
Agus Zubiaga
9810745465
agent: Fix autoscrolling to history entry (#30321)
We were still using entry indexes to scroll, but the list now includes
the separators as items, so the indexes need to be translated

Release Notes:

- agent: Fix autoscrolling to history entry when navigating via keyboard
2025-05-08 20:48:57 -03:00
Agus Zubiaga
4b61d4ba6a
agent: Fix message editor's button positions when expanded (#30311)
Fixes an issue introduced by #29959 which caused the message editor to
overflow from the agent panel bounds, making the bottom buttons
invisible when the editor was expanded (cmd+esc).

Fixing this required changing the base structure of the agent panel, but
things seem to work as expected:


https://github.com/user-attachments/assets/fc4c97fb-f7cb-4f54-a268-c30fbcb1649f


Release Notes:

- agent: Fix message editor's button positions when expanded
2025-05-08 20:36:19 -03:00
Cole Miller
83378b856f
agent: Show checkmark for current profile, not default profile (#30314)
Closes #ISSUE

Release Notes:

- agent: Fixed a bug that caused the profile selector to display a
checkmark next to the wrong profile.
2025-05-08 18:17:55 -04:00
Kirill Bulatov
2b6280ad56
Add minimap into the editor controls (#30285)
Follow-up of https://github.com/zed-industries/zed/pull/26893

Release Notes:

- N/A
2025-05-08 17:58:24 +00:00
Antonio Scandurra
9f6809a28d
Reuse conversation cache when streaming edits (#30245)
Release Notes:

- Improved latency when the agent applies edits.
2025-05-08 14:36:34 +02:00
Bennet Bo Fenner
032022e37b
agent: Tweak wording when configuring profiles (#30027)
cc @danilo-leal 

Release Notes:

- N/A

Co-authored-by: Danilo Leal <daniloleal09@gmail.com>
2025-05-08 09:11:24 -03:00
Ben Brandt
3615d6d96c
Load Profile state from Thread and tie visibility to the thread's model (#30090)
When deciding if a model supports tools or not, we weren't reading from
the configured model in a given thread.

This also stores the profile on the thread, which matches the behavior
of the Model and Max Mode, which we also already store per thread.

Hopefully this helps alleviate some confusion.

Release Notes:

- agent: Save profile selection per-Agent thread
2025-05-07 22:36:08 -04:00
Marshall Bowers
6cc6e4d4b3
agent: Rename a number of constructs from Assistant to Agent (#30196)
This PR renames a number of constructs in the `agent` crate from the
"Assistant" terminology to "Agent".

Not comprehensive, but it's a start.

Release Notes:

- N/A
2025-05-08 01:18:51 +00:00
Marshall Bowers
6ac2f4e6a5
Remove assistant crate (#30168)
This PR removes the `assistant` crate, as it is no longer used.

Release Notes:

- N/A
2025-05-07 23:05:38 +00:00
Evan Simkowitz
607a9445fc
editor: Add minimap (#26893)
## Overview

This PR adds the minimap feature to the Zed editor, closely following
the [design from Visual Studio
Code](https://code.visualstudio.com/docs/getstarted/userinterface#_minimap).
When configured, a second instance of the editor will appear to the left
of the scrollbar. This instance is not interactive and it has a slimmed
down set of annotations, but it is otherwise just a zoomed-out version
of the main editor instance. A thumb shows the line boundaries of the
main viewport, as well as the progress through the document. Clicking on
a section of code in the minimap will jump the editor to that code.
Dragging the thumb will act like the scrollbar, moving sequentially
through the document.

![screenshot of Zed with three editors open and the minimap enabled,
showing the
slider](https://github.com/user-attachments/assets/4178d23a-a5ea-4e38-b871-06dd2a8f9560)

## New settings

This adds a `minimap` section to the editor settings with the following
keys:

### `show`

When to show the minimap in the editor.
This setting can take three values:
1. Show the minimap if the editor's scrollbar is visible: `"auto"`
2. Always show the minimap: `"always"`
3. Never show the minimap: `"never"` (default)

### `thumb`

When to show the minimap thumb.
This setting can take two values:
1. Show the minimap thumb if the mouse is over the minimap: `"hover"`
2. Always show the minimap thumb: `"always"` (default)

### `width`

The width of the minimap in pixels.

Default: `100`

### `font_size`

The font size of the minimap in pixels.

Default: `2`

## Providing feedback

In order to keep the PR focused on development updates, please use the
discussion thread for feature suggestions and usability feedback: #26894


## Features left to add

- [x] fix scrolling performance
- [x] user settings for enable/disable, width, text size, etc.
- [x] show overview of visible lines in minimap
- [x] clicking on minimap should navigate to the corresponding section
of code
- ~[ ] more prominent highlighting in the minimap editor~
- ~[ ] override scrollbar auto setting to always when minimap is set to
always show~

Release Notes:

- Added minimap for high-level overview and quick navigation of editor
contents.

---------

Co-authored-by: MrSubidubi <dev@bahn.sh>
Co-authored-by: Kirill Bulatov <kirill@zed.dev>
2025-05-07 23:11:09 +03:00
Agus Zubiaga
77ac82587a
agent: Improve consecutive tool use callout spacing (#30145)
Release Notes:

- agent: Fix "consecutive tool use limit" callout spacing
2025-05-07 17:43:04 +00:00
Finn Evers
22ad207baf
agent: Fix profile menu hover flicker after settings update (#30109)
Closes #30091
Follow-up to #29958

This PR fixes the profile menu flickering due to the documentation aside
after updating the agent dock position over the settings file.

The problem arose because the `documentation_side` could get out of sync
with the actual agent panel dock position. The `documentation_side` was
only updated whenever the user changed the agent panel position using
the UI, but not when updating the position in the settings file.

You can reproduce this easily by changing the `agent.dock` position to
the opposite site in your settings, which will make the profile menu
flicker again in some scenarios due to the de-sync.

This PR fixes this behavior by computing the position during render,
thus the actual set panel position and the documentation position can
never get out of sync

Release Notes:

- Fixed the agent profile menu flickering after updating the assistant
panel dock position in the settings.
2025-05-07 10:17:59 -07:00
Antonio Scandurra
89430a019c
Fix agent reading and editing files over SSH (#30144)
Release Notes:

- Fixed a bug that would prevent the agent from working over SSH.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Richard Feldman <oss@rtfeldman.com>
Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Cole Miller <m@cole-miller.net>
2025-05-07 17:07:01 +00:00
Danilo Leal
625e45bac0
agent: Improve onboarding modal background illustration (#30137)
Tone down the grid background a bit more so text is more legible.

Release Notes:

- N/A
2025-05-07 13:24:36 -03:00
Marshall Bowers
a34fb6f6b1
Send up Zed version with edit prediction and completion requests (#30136)
This PR makes it so we send up an `x-zed-version` header with the
client's version when making a request to llm.zed.dev for edit
predictions and completions.

Release Notes:

- N/A
2025-05-07 15:44:30 +00:00
Danilo Leal
5ca114be24
agent: Make feedback buttons more minimal (#30133)
Also swapped out the svgs for `ThumbsDown` and `ThumbsUp`, and added
`DocumentText`.

Release Notes:

- N/A
2025-05-07 12:43:46 -03:00
Richard Feldman
fcb9706022
Improve Ollama tool use (#30120)
<img width="458" alt="Screenshot 2025-05-07 at 9 37 39 AM"
src="https://github.com/user-attachments/assets/80f8a9b8-6a13-4e84-b91d-140e11475638"
/>

<img width="603" alt="Screenshot 2025-05-07 at 9 37 33 AM"
src="https://github.com/user-attachments/assets/7fe67a68-3885-4a0e-a282-aad37e92068b"
/>


Release Notes:

- Ollama models no longer require the supports_tools field in settings
(defaults to false)

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2025-05-07 15:37:06 +00:00
Ben Brandt
c19a5c2fd6
Revert "Stop generating in the Agent panel when the user edits a previous message (#29915)" (#30092)
This reverts commit ce053c9bff.

Closes #ISSUE

Release Notes:

- N/A
2025-05-07 09:57:20 +00:00
Antonio Scandurra
9711fb49dc
Fix zero-sized message editors when context strip is empty (#30079)
Release Notes:

- Fixed a bug that would cause the message composer in the agent panel
to not render when the context strip was empty.

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2025-05-07 09:02:20 +00:00
Cole Miller
03b635bb27
Avoid panic when opening thread as markdown in non-local project (#30061)
Right now `agent: open active thread as markdown` will always panic when
you try to use it over collab or when SSH remoting. This PR makes it log
an error instead (we should follow up by restoring full remote support).

Release Notes:

- Prevented `agent: open active thread as markdown` from panicking when
used in a non-local project.
2025-05-07 01:15:45 -04:00