feat(acp): enable question tool for ACP clients#13750
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>
|
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. |
|
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
|
@rekram1-node @adamdotdevin May you take a look at this pr? |
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
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