Skip to content

feat: let ACP client expose the input/output properly#11303

Open
validatedev wants to merge 8 commits into
anomalyco:devfrom
validatedev:fix/acp-show-proper-run-command-message
Open

feat: let ACP client expose the input/output properly#11303
validatedev wants to merge 8 commits into
anomalyco:devfrom
validatedev:fix/acp-show-proper-run-command-message

Conversation

@validatedev
Copy link
Copy Markdown
Contributor

@validatedev validatedev commented Jan 30, 2026

What does this PR do?

Fixes #10998.

Old behavior: we sent a tool_call at pending with kind: "execute". As the tool ran, updates carried the content plus a completed rawOutput. Zed relied on kind: "execute" to render the blue "run command" box, but the actual command (rawInput) only appeared after completion, so you couldn't see what was running.

New behavior: the first tool_call now reflects the tool part's actual status (e.g. in_progress when the tool is already running on first observation) and carries the full rawInput — including the resolved working directory for bash — so Zed can show the command and where it's running before output lands. Subsequent tool_call_updates fill in streaming content and the final rawOutput (stdout/stderr). kind is set to other (not execute), which removes the blue run-box styling and instead exposes rawInput/rawOutput as collapsible panels.

How did you verify your code works?

By running Zed's ACP inferface via:

    "OpenCode (ACP Dev)": {
      "type": "custom",
      "command": "bun",
      "args": [
        "run",
        "--cwd",
        "/Users/validate/Developer/personal/opencode/packages/opencode",
        "--conditions=browser",
        "./src/index.ts",
        "acp",
      ],
      "env": {},
    },

Screenshot

Old Behavior

CleanShot 2026-01-30 at 01 21 56@2x

New Behavior

CleanShot 2026-04-23 at 23 30 31@2x

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rekram1-node
Copy link
Copy Markdown
Collaborator

Can you explain the changes, it looks like quite a bit

@validatedev
Copy link
Copy Markdown
Contributor Author

any update @rekram1-node @adamdotdevin? I don't have any problems with this, works much better than the old structure (aligns other Zed ACP + Zed Agent interfaces)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the ACP (Agent Client Protocol) client implementation to properly expose tool input/output information to ACP clients like Zed. The main change addresses issue #10998 where command details weren't visible in the Zed UI.

Changes:

  • Refactored tool call/result formatting into a centralized tool-format.ts module with structured formatting logic for different tool types
  • Changed tool call emission timing from pending to running state with full rawInput (command + cwd) included upfront
  • Updated tool kind from "execute" to "other" for bash/shell/terminal commands

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.

File Description
packages/opencode/src/acp/tool-format.ts New module containing centralized tool formatting logic with toolCallFromPart and toolResultFromPart functions
packages/opencode/src/acp/parse-command.ts New helper module for formatting bash/shell/terminal commands with title, kind, and locations
packages/opencode/src/acp/agent.ts Refactored to use new formatting functions; removed old toToolKind and toLocations helpers; added emittedToolCalls tracking to prevent duplicate emissions
packages/opencode/test/acp/parse-command.test.ts Added tests for ParseCommand.format function

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/src/acp/agent.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts Outdated
Comment thread packages/opencode/src/acp/tool-format.ts Outdated
Comment thread packages/opencode/src/acp/tool-format.ts Outdated
Comment thread packages/opencode/src/acp/tool-format.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/src/acp/agent.ts
Comment thread packages/opencode/test/acp/tool-format.test.ts
Comment thread packages/opencode/test/acp/tool-format.test.ts
Comment thread packages/opencode/test/acp/tool-format.test.ts
Comment thread packages/opencode/src/acp/tool-format.ts
Comment thread packages/opencode/src/acp/tool-format.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/opencode/src/acp/tool-format.ts Outdated
Comment thread packages/opencode/src/acp/agent.ts
Comment thread packages/opencode/src/acp/tool-format.ts
@validatedev
Copy link
Copy Markdown
Contributor Author

@adamdotdevin I really want this to be merged, and it works without any issues. Could you please review and/or merge if you have time? I've been waiting 3 months. The PR only affects the ACP part. I can fix it if you don't like any parts of the PR, and it fixes a real issue which should not be happening (and other providers' ACP clients do not have such issues).

@jiwangyihao
Copy link
Copy Markdown

I'm also seeing this in Zed ACP mode: bash tool calls show only the human-readable description (for example, Shows concise working tree status) but not the actual command being executed.

This makes permission review and debugging difficult, because users cannot tell which command is about to run without digging into logs. It looks like the same issue reported in #10998 and #14034; both were auto-closed, but the behavior is still relevant.

Could this PR be reviewed/merged, or could maintainers clarify what is blocking it?

@kian1991
Copy link
Copy Markdown

kian1991 commented May 7, 2026

I would also push for this. This is the only thing keeping me from fully using zed + opencode. So Bump :)

@n3m0-wits
Copy link
Copy Markdown

It looks like this has been a persistent issue that keeps getting flagged and then closed as a duplicate - but then the 'duplicates' also get closed and nothing happens.

@soar
Copy link
Copy Markdown

soar commented May 15, 2026

What are we waiting for? This needs to be fixed

…pers

- Remove parse-command.ts in favor of logic consolidated in tool-format.ts
- Rewrite tool-format helpers (toolCallFromPart, toolResultFromPart,
  permissionDisplayInfo, fenceWith) as the single source of truth for
  tool call formatting
- Adapt agent.ts to dev's post-namespace-refactor layout (flat exports
  with `export * as ACP` self-reexport, ProviderID/ModelID branded types,
  Hash.fast, InstallationVersion, ConfigMCP.Info)
- Drop listSessions `unstable_` prefix to match SDK method name
- Guard sendUsageUpdate against missing providerID/modelID
@validatedev
Copy link
Copy Markdown
Contributor Author

@rekram1-node @nexxeln @thdxr waiting to be reviewed, just fyi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run Command message won't display command ran in Zed

7 participants