592727b
collab: Add request stream support (#56455)
Click to expand commit body
Adds streaming RPC forwarding to collab so guests can call
`GetInitialGraphData` and `SearchCommits` against a remote host project.
Previously these requests had no forwarder registered on the server and
would fail when invoked by a guest.
This mirrors the existing single-response forwarding pattern with new
analogues:
- `StreamResponse<R>` + `MessageContext::forward_request_stream`
- `Server::add_request_stream_handler`
- `forward_read_only_project_stream_request`, registered for both
messages
Also hardens both the unary and stream handlers to send
`respond_with_error` when a handler returns `Ok` without sending/ending
a response, so the client doesn't hang waiting for a reply that will
never arrive.
I added git graph collab integration tests for this as well.
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 #55954
Release Notes:
- N/A
4c46242
agent_ui: Fix double-lease panic when pasting slash commands into MessageEditor
Click to expand commit body
Pasting text that triggers slash-command completions caused a reentrant update of MessageEditor: the paste action ran inside MessageEditor::update, which entered Editor::update to do the paste, which synchronously fired trigger_completion_on_input, whose provider then called slash_autocomplete_invoked and tried to MessageEditor::update again.
Defer the SlashAutocompleteOpened emit via cx.defer so it runs after the surrounding update tree unwinds.
Code had been assuming (erroneously, but understandably) that
LlmApiToken::acquire would give them a valid token.
This is not true, as those tokens expire and you must call refresh explicitly.
Add some helpers to do the retry for you, and rename acquire to cached to be
clearer about the intent.
0f34183
Parse SKILL.md frontmatter and lazy-load skill bodies
Click to expand commit body
Builds on AI-218 (which discovered and loaded skill paths) by adding
frontmatter parsing. The `Skill` struct now carries `name`,
`description`, and `disable_model_invocation` in memory. Skill bodies
stay on disk \u2014 they're read on demand by `read_skill_body` only when
a skill is actually materialized for the model.
- Add `parse_skill_frontmatter`: parses YAML frontmatter and validates
per the agent-skills spec (`name` matches `[a-z0-9-]{1,64}`,
`description` is 1\u20131024 chars).
- Add `load_skill_frontmatter`: chunked reader. Uses `fs.open_sync` +
inline 4KB chunks, stops as soon as the closing `---` is found (or
`MAX_SKILL_FILE_SIZE` is hit). Reads synchronously inside an async
function; production callers already wrap `load_skills_from_directory`
in `cx.background_spawn`, so blocking happens on the background
executor. See the inline comment for why `smol::unblock` doesn't fit
(it panics under `TestAppContext`).
- Add `read_skill_body`: `fs.load` + extract body. Public API but
unused in this PR \u2014 the user-facing PR consumes it.
- `load_skills_from_directory` now returns
`Vec<Result<Skill, SkillLoadError>>` so a future PR can surface
parse errors in the UI. `build_project_context` filter-maps Ok
variants for now, logging errors at `log::warn` level.
Test fixtures in agent.rs updated from placeholder bytes to valid
frontmatter; assertions strengthened from path-equality to checking
parsed `name` / `description`.
88b1a1c
Fix project panel not auto revealing multi buffer excerpts
Click to expand commit body
Have the editor push the cursor's buffer path to Project::set_active_path
on local selection changes and on focus. This drives the existing
ActiveEntryChanged consumers (project panel auto-reveal, Copilot DidFocus,
edit prediction recent paths) for multibuffer items, where the workspace
resolver only sees a None project_path.
Singleton editors take the same path; set_active_path dedups against the
workspace's own pane-event-driven calls.
Release Notes:
- Fixed the project panel not auto-revealing the file containing the
cursor when navigating between excerpts in a multibuffer (project diff,
diagnostics, project search, etc.).
71ac213
zed: Respect `--new` when opening URLs from the CLI
Click to expand commit body
`zed --new ssh://host/path/to/file` only created a new window on the first call. Subsequent invocations silently reused the existing SSH workspace for the same host, which then tried to open the new path against the existing worktree and surfaced a `DevServerProjectPathDoesNotExist` popup when the path didn't belong to any open worktree.
The CLI correctly translated `--new` to `OpenBehavior::AlwaysNew`, but the URL branch of `handle_cli_connection` dropped the `open_behavior`. `handle_open_request` then called `open_remote_project` (and `open_paths_with_positions` for `file://`) with `OpenOptions::default()`, which is `WorkspaceMatching::MatchExact`, so any existing SSH window for the same host won the match. The issue applies to `file://` URLs and `-a` / `-e` / `--reuse` for URL-shaped arguments in general; `--new` was just the most visible symptom.
The fix is making sure the translation of `OpenRequest` is uniform across plain paths and URL-shaped arguments.
Closes #52679.
Release Notes:
- Fixed `zed --new ssh://host/path` reusing an existing SSH window instead of opening a new one
The data structure for a loaded skill is now just the paths \u2014 source,
directory path, and SKILL.md path. Parsing the YAML frontmatter
(name, description, disable-model-invocation) and the body comes in a
follow-up PR.
This roughly halves the diff size of the PR by dropping:
- `parse_skill`, `extract_frontmatter`, `validate_name`, `validate_description`
- `SkillMetadata`, `SkillSummary`, `SkillLoadError`
- `MAX_SKILL_FILE_SIZE`, `MAX_SKILL_DESCRIPTIONS_SIZE`
- `load_single_skill` (no per-file parsing path)
- `merge_skills` and its test (dedup is by parsed name; not in scope)
- `SkillLoadingError`, `SkillLoadingErrorsUpdated`, and the
associated error emission in `maintain_project_context` (without
parsing, there's nothing to error on)
- The `skill_loading_errors` field on `ProjectState`
- The `anyhow`, `serde`, `serde_yaml_ng`, and `serde_json` deps of
`agent_skills`
- The workspace `serde_yaml_ng` entry (no other workspace member uses
it on this branch)
- All parsing tests
`load_skills_from_directory` now returns `Vec<Skill>` directly,
`build_project_context` returns `Task<(ProjectContext, Vec<Skill>)>`,
and `state.skills` ends up as the concatenation of global skills +
each worktree's project-local skills (no dedup since we have no
parsed name to key on).