Skip to content

Commit 9d3c81a

Browse files
feat(acp): add opt-in flag for question tool (anomalyco#13562)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
1 parent 86e545a commit 9d3c81a

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

.opencode/agent/translator.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ OPENCODE_EXPERIMENTAL_MARKDOWN
599599
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX
600600
OPENCODE_EXPERIMENTAL_OXFMT
601601
OPENCODE_EXPERIMENTAL_PLAN_MODE
602+
OPENCODE_ENABLE_QUESTION_TOOL
602603
OPENCODE_FAKE_VCS
603604
OPENCODE_GIT_BASH_PATH
604605
OPENCODE_MODEL

packages/opencode/src/acp/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ opencode acp
4444
opencode acp --cwd /path/to/project
4545
```
4646

47+
### Question Tool Opt-In
48+
49+
ACP excludes `QuestionTool` by default.
50+
51+
```bash
52+
OPENCODE_ENABLE_QUESTION_TOOL=1 opencode acp
53+
```
54+
55+
Enable this only for ACP clients that support interactive question prompts.
56+
4757
### Programmatic
4858

4959
```typescript

packages/opencode/src/flag/flag.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export namespace Flag {
3030
export declare const OPENCODE_CLIENT: string
3131
export const OPENCODE_SERVER_PASSWORD = process.env["OPENCODE_SERVER_PASSWORD"]
3232
export const OPENCODE_SERVER_USERNAME = process.env["OPENCODE_SERVER_USERNAME"]
33+
export const OPENCODE_ENABLE_QUESTION_TOOL = truthy("OPENCODE_ENABLE_QUESTION_TOOL")
3334

3435
// Experimental
3536
export const OPENCODE_EXPERIMENTAL = truthy("OPENCODE_EXPERIMENTAL")

packages/opencode/src/tool/registry.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ export namespace ToolRegistry {
9494
async function all(): Promise<Tool.Info[]> {
9595
const custom = await state().then((x) => x.custom)
9696
const config = await Config.get()
97+
const question = ["app", "cli", "desktop"].includes(Flag.OPENCODE_CLIENT) || Flag.OPENCODE_ENABLE_QUESTION_TOOL
9798

9899
return [
99100
InvalidTool,
100-
...(["app", "cli", "desktop"].includes(Flag.OPENCODE_CLIENT) ? [QuestionTool] : []),
101+
...(question ? [QuestionTool] : []),
101102
BashTool,
102103
ReadTool,
103104
GlobTool,

0 commit comments

Comments
 (0)