feat(acp): enable question tool for ACP clients#13750
Open
Leoyzen wants to merge 5 commits intoanomalyco:devfrom
Open
feat(acp): enable question tool for ACP clients#13750Leoyzen wants to merge 5 commits intoanomalyco:devfrom
Leoyzen wants to merge 5 commits intoanomalyco:devfrom
Conversation
Add test suite for ACP question tool mapping: - question.asked event triggers requestPermission - Option mapping from question to permission format - User selection handling with sdk.question.reply - User cancellation handling with sdk.question.reject - Multiple questions uses only first question (Phase 1) - Dismissed outcome rejection handling Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Enable QuestionTool for ACP client mode by adding "acp" to the Flag.OPENCODE_CLIENT check alongside existing "app", "cli", "desktop". This allows ACP clients (like Zed) to use the question tool and see question events mapped to native permission UI. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Add question.asked event handler to ACP Agent: - Maps question options to PermissionOption format - Always includes Cancel option with reject_once kind - Uses permission queue for sequential per-session handling - Calls sdk.question.reply when user selects an option - Calls sdk.question.reject when user cancels or on error - Supports single-select only (Phase 1), uses first question Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found a potential related PR: Related PR:
This PR appears to be related to your current PR #13750 as it also addresses ACP question tool functionality. The PR #13562 involves adding an opt-in flag for the question tool, which may be complementary or overlapping with the feature being enabled in PR #13750. You should verify if #13562 is:
Otherwise, no duplicate PRs were found with the exact same scope. |
fc44ea4 to
0d73d60
Compare
Modify question.asked handler to support multi-question scenarios: - Call request_permission separately for each question - Use index suffix for unique toolCallId (question-id-0, question-id-1...) - Collect all answers and reply once after last question - Maintain permission queue for sequential execution This allows ACP clients like Zed to display questions sequentially, with users answering one at a time. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
0d73d60 to
330db24
Compare
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.
Summary
Enable question tool support for ACP (Agent Client Protocol) clients like Zed. This allows ACP-compatible editors to handle AI assistant questions through their native permission UI.
Fixes #13752
What Changed
For ACP Users (Zed, etc.)
When the AI assistant asks a question (e.g., "Which test file should I create?"), ACP clients now display it as a native permission prompt with selectable options:
Implementation Details
Registry Update -
QuestionToolis now available for ACP modeapp,cli,desktopclientsacpclient typeEvent Handler - New
question.askedevent handler in ACP AgentPermissionOptionformatResponse Flow
sdk.question.reply()with the labelsdk.question.reject()Scope & Limitations
This implements Phase 1 with the following constraints:
Multi-select and text input support will come in a future update.
Testing
test/acp/question.test.tsbun test test/acp/- 12 tests passingVerification