feat(acp): handle Cursor cursor/* extension methods - #785
Merged
Merged
Conversation
Cursor's CLI sends cursor/ask_question, cursor/create_plan, cursor/update_todos, cursor/task, and cursor/generate_image as JSON-RPC requests. Without handlers, sacp replies -32601 and a live turn shows a red banner on every Task spawn. Blocking methods reuse the existing ask and plan-approval cards (same path as Grok). The other three return the documented outcome envelope so the agent is not left waiting. Refs xintaofei#783.
…chema
Review fixes on top of the cursor extension-method bridge.
* `cursor_ext`'s test module called `matches_method` without importing
`sacp::JsonRpcMessage` (the supertrait that defines it, not the
`JsonRpcRequest` the derive is named after), so `cargo test` — and
`clippy --all-targets`, which CI runs — failed to build the lib test
target. Import it.
* `build_cursor_ask_response` replied `answered` with an empty
`selectedOptionIds` whenever the user used the card's free-text "Other"
row — which single-select uses INSTEAD of an option, so it is the
ordinary path, not an edge case. Cursor then reads "the user was asked
and chose nothing" and the typed answer is dropped. `answered` is now
used only when every selected label maps to one of Cursor's option ids;
otherwise the reply is the documented `skipped` with the user's own
words in `reason`. Mirrors `pi_select_option_id`, which refuses to fake
an option id for the same reason.
* Cursor's `CursorUpdateTodosResponse` `accepted` variant is
`{ outcome, todos }` with `todos` required; the reply omitted it. Echo
back the list the request carried.
* Every ask early-return (bridge absent, ask disabled, malformed params,
card could not open) replied a bare `skipped`, which is also what a user
dismissing the card sends. Carry a structural `reason` — never payload —
so the agent can tell "the user passed" from "this host never asked".
* The question chip read a constant "Cursor" when the request carried no
`title`; use `synthesize_header`, as the grok and pi bridges do.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Owner
|
codeg work task |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #783
What
Register Cursor's ACP client-extension methods so the host no longer replies
-32601 Method not found:cursor/ask_question{ outcome: answered | skipped }cursor/create_plan{ outcome: accepted | rejected | cancelled }cursor/update_todos{ outcome: accepted }cursor/task{ outcome: completed }(echoagentId/durationMswhen present)cursor/generate_image{ outcome: generated }iffilePathis set, elserejectedSame pattern as
_x.ai/ask_user_question/_x.ai/exit_plan_mode/elicitation/create. New methods go insrc-tauri/src/acp/cursor_ext.rsplus one.on_receive_requestinconnection.rs.Disconnect / malformed plan or ask never silently
accepted—cancelled/skipped, matching the Grok disconnect replies.Test
CI: this PR's
Testworkflow (cargo test+clippy -D warningson desktop/server × linux/mac/windows).Live Cursor + Opus 5 subagents are out of unit-test scope; after merge, a Task spawn should no longer log
Method not foundforcursor/task.Files
src-tauri/src/acp/cursor_ext.rs(new)src-tauri/src/acp/connection.rssrc-tauri/src/acp/mod.rs