Commit Graph
175 Commits
Author SHA1 Message Date
Finn Evers 0c27ea4a58 Restore language query watcher in dev builds (#52543)
The watcher had been broken for some time, but became even more broken
after the recent move of the queries.

This PR restores the reloading behavior for debug builds so that
languages are reloaded once a scheme file is changed.

Release Notes:

- N/A
2026-03-27 11:10:57 +01:00
ab3697f163 Extract language_core and grammars crates from language (#52238)
This extracts a `language_core` crate from the existing `language`
crate, and creates a `grammars` data crate. The goal is to separate
tree-sitter grammar infrastructure, language configuration, and LSP
adapter types from the heavier buffer/editor integration layer in
`language`.

## Motivation

The `language` crate pulls in `text`, `theme`, `settings`, `rpc`,
`task`, `fs`, `clock`, `sum_tree`, and `fuzzy` — all of which are needed
for buffer integration (`Buffer`, `SyntaxMap`, `Outline`,
`DiagnosticSet`) but not for grammar parsing or language configuration.
Extracting the core types lets downstream consumers depend on
`language_core` without pulling in the full integration stack.

## Dependency graph after extraction

```
language_core   ← gpui, lsp, tree-sitter, util, collections
grammars        ← language_core, rust_embed, tree-sitter-{rust,python,...}
language        ← language_core, text, theme, settings, rpc, task, fs, ...
languages       ← language, grammars
```

## What moved to `language_core`

- `Grammar`, `GrammarId`, and all query config/builder types
- `LanguageConfig`, `LanguageMatcher`, bracket/comment/indent config
types
- `HighlightMap`, `HighlightId` (theme-dependent free functions
`highlight_style` and `highlight_name` stay in `language`)
- `LanguageName`, `LanguageId`
- `LanguageQueries`, `QUERY_FILENAME_PREFIXES`
- `CodeLabel`, `CodeLabelBuilder`, `Symbol`
- `Diagnostic`, `DiagnosticSourceKind`
- `Toolchain`, `ToolchainScope`, `ToolchainList`, `ToolchainMetadata`
- `ManifestName`
- `SoftWrap`
- LSP data types: `BinaryStatus`, `ServerHealth`,
`LanguageServerStatusUpdate`, `PromptResponseContext`, `ToLspPosition`

## What stays in `language`

- `Buffer`, `BufferSnapshot`, `SyntaxMap`, `Outline`, `DiagnosticSet`,
`LanguageScope`
- `LspAdapter`, `CachedLspAdapter`, `LspAdapterDelegate` (reference
`Arc<Language>` and `WorktreeId`)
- `ToolchainLister`, `LanguageToolchainStore` (reference `task` and
`settings` types)
- `ManifestQuery`, `ManifestProvider`, `ManifestDelegate` (reference
`WorktreeId`)
- Parser/query cursor pools, `PLAIN_TEXT`, point conversion functions

## What the `grammars` crate provides

- Embedded `.scm` query files and `config.toml` files for all built-in
languages (via `rust_embed`)
- `load_queries(name)`, `load_config(name)`,
`load_config_for_feature(name, grammars_loaded)`, and `get_file(path)`
functions
- `native_grammars()` for tree-sitter grammar registration (behind
`load-grammars` feature)

## Pre-cleanup (also in this PR)

- Removed unused `Option<&Buffer>` from
`LspAdapter::process_diagnostics`
- Removed unused `&App` from `LspAdapter::retain_old_diagnostic`
- Removed `fs: &dyn Fs` from `ToolchainLister` trait methods
(`PythonToolchainProvider` captures `fs` at construction time instead)
- Moved `Diagnostic`/`DiagnosticSourceKind` out of `buffer.rs` into
their own module

## Backward compatibility

The `language` crate re-exports everything from `language_core`, so
existing `use language::Grammar` (etc.) continues to work unchanged. The
only downstream change required is importing `CodeLabelExt` where
`.fallback_for_completion()` is called on the now-foreign `CodeLabel`
type.

Release Notes:

- N/A

---------

Co-authored-by: Agus Zubiaga <agus@zed.dev>
Co-authored-by: Tom Houlé <tom@tomhoule.com>
2026-03-25 23:41:09 +00:00
Oleksiy Syvokon 3b0ae5f442 ep: Change beta in deltaChrF to favor precision over recall (#52422)
Also store and print more detailed information related to this metric
(precision, recall, tp/fp/fn counts)

Release Notes:

- N/A
2026-03-25 17:54:53 +02:00
Ben Kunkle 4d94c640f4 Remove Sweep Integration (#52348)
Closes #52115

## Context

Removes the third party edit prediction integration for Sweep AI ahead
of their servers shutting down.

This PR will not affect those who are already use or plan to use their
open weighted models. The code removed by this PR was required for
integrating with their proprietary API.


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

- Removed support for using the Sweep AI edit prediction provider
through their proprietary API, as the servers are shutting down
https://discord.com/channels/1100625416022138902/1100625417272045639/1480644297903575142,
https://x.com/wwzeng1/status/2033302698360180949
2026-03-25 10:23:05 -04:00
Oleksiy SyvokonandBen Kunkle 41dce038af ep: Automate distillation (#51293)
Increases timeouts, simplifies queries, and makes other changes needed to
pull data more efficiently.

Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-24 19:42:27 +02:00
Oleksiy Syvokon 5d7ce92a26 ep: Fix teacher and repair output parsers (#52213)
In some cases, we were generating a bunch of junk.

Release Notes:

- N/A
2026-03-23 14:09:37 +00:00
Oleksiy Syvokon d8ada018b4 ep: Store cumulative and average log-probabilities of predictions (#52177)
For now, the only source of logprobs is `./run.py infer`, which writes
them to under the `.predictions` struct. `ep score` copies these values
to `.score`. There is some duplication (same value stored in two
places), which is unfortunate, but can't be fixed without reworking how
scores are stored.


Release Notes:

- N/A
2026-03-23 11:22:18 +02:00
Oleksiy Syvokon a676ff474b ep: Add new prompt format (#52167)
This PR adds `v0318`, which is just like `v0316` but with bigger blocks.
It seems to perform best so far.

It also adds heuristics to avoid placing the marker token on closing
braces, which results in much nicer blocks.

Finally, it fixes a bug with inserting `<|marker_N|>` mid-line in
`v0316` and `v0317`.



Release Notes:

- N/A
2026-03-23 10:39:25 +02:00
Oleksiy Syvokon 75661977d0 ep: Initialize AppDatabase (#51922)
Follow up to #51809

Without it, ep_cli panics when initializing headless Zed.

Release Notes:

- N/A
2026-03-19 14:28:44 +02:00
Oleksiy Syvokon 67b2177aaf ep: Add two new prompt formats (#51836)
V0316 differences from V0306:
- Use `<|marker_N|><|marker_N|>` instead of `NO_EDITS`
- All intermediate markers are now emitted (should be more friendly to
speculative decoding)
- No newline padding around marker tags
- No git conflict markers; we now use SeedCoder's EOS tag instead

V0317 is like V0316, but marker numbers are relative to the cursor block
(`<|marker-2|> ... -1 ... -0 ... +1 ... <|marker+2|>`)

Release Notes:

- N/A
2026-03-18 17:02:06 +02:00
Elier 6c3c51acb9 Add stream_options.include_usage for OpenAI-compatible API token usage (#45812)
## Summary

This PR enables token usage reporting in streaming responses for
OpenAI-compatible APIs (OpenAI, xAI/Grok, OpenRouter, etc).

## Problem

Currently, the token counter UI in the Agent Panel doesn't display usage
for some OpenAI-compatible providers because they don't return usage
data during streaming by default. According to OpenAI's API
documentation, the `stream_options.include_usage` parameter must be set
to `true` to receive usage statistics in streaming responses.

## Solution

- Added StreamOptions struct with `include_usage` field to the open_ai
crate
- Added `stream_options` field to the Request struct
- Automatically set `stream_options: { include_usage: true }` when
`stream: true`
- Updated edit_prediction requests with `stream_options: None`
(non-streaming)

## Testing

Tested with xAI Grok models - token counter now correctly shows usage
after sending a message.

## References

- [OpenAI Chat Completions API -
stream_options](https://platform.openai.com/docs/api-reference/chat/create#chat-create-stream_options)
- [xAI API Documentation](https://docs.x.ai/api)
2026-03-17 10:38:14 +00:00
Ben Kunkle 99a5915576 ep: Ensure prompt is always within token limit (#51529)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-14 13:53:28 -04:00
Oleksiy Syvokon a4209265c9 ep: Add multi-region format (#51185)
This format generates fewer token while maintaining the quality:

```
Model                     Generated tokens ↓    DeltaChrF ↑
0306-seed-multi-regions   46,239                80.62
0304-seed-no-edits        110,871               80.61
0303-seed                 271,457               79.62
```

In addition to the student format, this change adds a new teacher
prompt. It seems to be worse than the original, but I haven't optimized
it at all. Keeping it for now as a base for potential improvements.


Release Notes:

- N/A
2026-03-10 13:43:27 +02:00
Ben Kunkle 96770c174d ep: Include diagnostics in ZetaPromptInput (#51141)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-09 20:24:41 -04:00
Max BrunsfeldandBen Kunkle fbf513902c zeta: Allow the server to select the editable and context ranges more flexibly (#50975)
Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-09 19:58:31 -04:00
Oleksiy Syvokon 74057925cc ep: Skip context retrieval when already performed (#51100)
Previously we didn't distinguish between an empty `.related_files[]` and
a case where context collection hadn't run yet. As a result, context
retrieval was always attempted for examples with empty `related_files`.

Release Notes:

- N/A
2026-03-09 14:42:15 +00:00
Oleksiy Syvokon 80c52fb00a ep: Make repair parser more robust (#51044)
Release Notes:

- N/A
2026-03-08 09:27:10 +00:00
Ben Kunkle 4d813fc41e ep: Add captured example fetching (#50960)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-06 15:09:36 -05:00
Oleksiy Syvokon 0a6e5009f0 ep: Unify code in parse_output and zeta_prompt (#50958)
This also fixed `ep parse-output` for newer formats

Release Notes:

- N/A
2026-03-06 22:07:54 +02:00
NeelandTom Houlé ecff44006c Refresh LLM API token on organization change (#50931)
Emit client-side organization changed events through
`RefreshLlmTokenListener` so it produces the same `RefreshLlmTokenEvent`
used for server-pushed `UserUpdated` messages.

This keeps token refresh fan-out in one place.

Closes CLO-383.

Release Notes:

- N/A

---------

Co-authored-by: Tom Houlé <tom@tomhoule.com>
2026-03-06 19:15:21 +00:00
45316a33c5 zeta: Add variable edit format (#50850)
Release Notes:

- N/A

---------

Co-authored-by: Jakub Konka <kubkon@jakubkonka.com>
Co-authored-by: Oleksiy Syvokon <oleksiy.syvokon@gmail.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-03-05 16:23:36 -08:00
Ben Kunkle 45d76e9aa4 zeta2: Don't remove redundant excerpts on the client (#50886)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-05 19:04:49 -05:00
Oleksiy Syvokon 3913e2e60b ep: Make --repetitions work with Anthropic and OpenAI batches (#50789)
Release Notes:

- N/A
2026-03-05 07:16:09 +00:00
Max Brunsfeld 2ed143dab0 Include repo_url in edit prediction requests when data collection is enabled (#50745)
Release Notes:

- N/A
2026-03-04 13:14:44 -08:00
Oleksiy Syvokon c20a66bcad ep: Collapse whitespace in deltaChrF (#50716)
Release Notes:

- N/A
2026-03-04 16:28:48 +00:00
Oleksiy Syvokon b2eaa5b760 ep: Option to configure custom Baseten environment (#50706)
Release Notes:

- N/A
2026-03-04 14:56:56 +00:00
Ben Kunkle 46f2623512 zeta2: Hashlines prompt format (#50623)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-03 16:11:32 -05:00
Oleksiy Syvokon b5c4e81489 ep: Predict by querying Baseten directly (#50626)
This can be used like `ep predict --provider
baseten:V0131GitMergeMarkersPrefix`. Since it doesn't require
load_project, it can be used with captured requests.


Release Notes:

- N/A
2026-03-03 21:09:26 +02:00
Oleksiy Syvokon 7c2dc5b249 ep: Fix fetching rated-after (#50617)
Release Notes:

- N/A
2026-03-03 17:27:52 +00:00
Max Brunsfeld 72de880838 Remove Zeta1 logic, allow choosing zeta2 experiment (#50560)
Release Notes:

- N/A
2026-03-02 22:24:55 -08:00
Ben Kunkle 135f3f546f ep_cli: Clean up snowflake fetching (#50450)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-01 21:17:49 -05:00
Ben Kunkle f0bb769d97 ep: Add settled data fetching from snowflake (#50326)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-03-01 11:20:32 -05:00
Max Brunsfeld bebf3dca6c Add edit prediction evals that test related excerpt usage (#50256)
I've also fixed a race condition with the programmatic context retrieval
in the CLI, which was causing no excerpts to be fetched for the Rust
examples.

Release Notes:

- N/A
2026-02-26 15:36:29 -08:00
Tom Houlé 881d167340 Add fast mode toggle in agent panel (#49714)
This is a staff only toggle for now, since the consequences of
activating it are not obvious and quite dire (tokens costs 6 times
more).

Also, persist thinking, thinking effort and fast mode in DbThread so the
thinking mode toggle and thinking effort are persisted.

Release Notes:

- Agent: The thinking mode toggle and thinking effort are now persisted
when selecting a thread from history.
2026-02-26 21:19:41 +01:00
Max Brunsfeld 0da25d609d Edit prediction: add some typescript evals, fix a teacher model failure mode (#50141)
In some evals, the teacher produced hallucinations, seemingly due to
context rot. This makes the zeta prompt crate's budgeted rendering
usable by the teacher, so that it can truncate the list of excerpts.

I've also cleaned up the implementation of zeta_prompt's
`format_related_files_within_budget`, and changed the behavior so that
it filters the the excerpts by priority but renders the files in their
original order.

Release Notes:

- N/A
2026-02-25 15:47:08 -08:00
Oleksiy Syvokon 94030352ab ep: Stratify by cursor_path by default (#50111)
Also, `ep split train=100` now means 100 lines, not 100 groups (repos or
cursor_paths).


Release Notes:

- N/A
2026-02-25 18:15:05 +00:00
Max Brunsfeld 4f59c67cd7 Fix incorrect cursor excerpt handling in EP CLI format-prompt (#49947)
Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-24 05:13:33 +00:00
Max BrunsfeldandBen Kunkle a98e4651a2 Fix handling of excerpt regions in EP CLI (#49936)
Previously, we were not computing excerpt regions correctly for EP
examples captured from prod. This PR fixes that, and also simplifies the
data flow in the EP CLI. Examples either come from a concise spec (like
the markdown evals), or are collected from prod. Either way, we compute
from them a `ZetaPromptInput`, and the downstream steps like
prompt-formatting and scoring are derived from that.

Release Notes:

- N/A

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
2026-02-23 17:08:09 -08:00
384e0c45e7 zeta: Consolidate logic for picking region sizes, use larger editable region (#49921)
This will not affect how Zeta 2 behaves in production until we update
Cloud to pull in the changes to the `zeta_prompt` crate. But from some
early testing, it seems to improve behavior, not worsen it, even though
the editable region size differs from the currently-deployed model's
training data.

Release Notes:

- N/A

---------

Co-authored-by: Oleksiy Syvokon <oleksiy.syvokon@gmail.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-23 12:52:33 -08:00
Oleksiy Syvokon c369192562 ep: Add a parameter to sample at most N near-duplicates (#49870)
Duplicates are defined as cursor positions that have an approximate
Jaccard similarity greater than 0.5 (over token 5-grams).

From the resulting clusters of near-duplicates, we select up to N
examples that are maximally different from each other.


Release Notes:

- N/A
2026-02-23 10:56:57 +00:00
Oleksiy Syvokon 629e7708cc ep: Fix teacher parser and other fixes (#49863)
Release Notes:

- N/A
2026-02-23 07:18:04 +00:00
Ben Kunkle 411c791bb2 ep_cli: Only compute reversals on last user edit (#49747)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-20 16:25:40 -05:00
Ben Kunkle 5d8f387863 ep_cli: Delete sync-deployments command (#49728)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-20 16:14:04 +00:00
Ben Kunkle eefb6ecebd ep_cli: Don't filter rated predictions by Zed version (#49609)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-19 22:23:24 -05:00
d249200765 Allow using Zeta through an arbitrary OpenAI-compatible self-hosted API (#49554)
Release Notes:

- Added the ability to use a self-hosted OpenAI-compatible server for
edit predictions.

---------

Co-authored-by: Ben Kunkle <ben@zed.dev>
Co-authored-by: Zed Zippy <234243425+zed-zippy[bot]@users.noreply.github.com>
2026-02-19 20:18:36 +00:00
Piotr OsiewiczandEric Holk dc4bba93ef gpui: Extract gpui_platform out of gpui (#49277)
#2874 on steroids

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A

---------

Co-authored-by: Eric Holk <eric@zed.dev>
2026-02-19 18:57:49 +01:00
Oleksiy Syvokon e823587585 ep: Fix pull examples query (#49610)
Release Notes:

- N/A
2026-02-19 15:09:03 +00:00
Oleksiy Syvokon 8ef2b9b06e ep: Parse "user accepted prediction" markers in evals (#49598)
Also:
- Add two evals
- Remove duplicated Example 6 from the teacher prompt 

Release Notes:

- N/A
2026-02-19 13:01:07 +00:00
Ben Kunkle 912f600a7b ep_cli: Filter fetched examples by can_collect_data (#49506)
Closes #ISSUE

Before you mark this PR as ready for review, make sure that you have:
- [ ] Added a solid test coverage and/or screenshots from doing manual
testing
- [ ] Done a self-review taking into account security and performance
aspects
- [ ] Aligned any UI changes with the [UI
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-02-18 12:27:04 -05:00
Oleksiy Syvokon a1ddc50bac ep: Update teacher prompt (#49489)
* More conservative predictions for prose
* Explain "user accepted prediction" in the teacher prompt
* Sonnet 4.6 support
* Don't strip comments in teacher prompt's edit history

Release Notes:

- N/A
2026-02-18 15:26:47 +00:00