Skip to content

chat: open the chat's session in the agent's own CLI, or copy its id - #74

Merged
endrix merged 1 commit into
mainfrom
feat/open-session-natively
Oct 14, 2026
Merged

endrix merged 1 commit into
mainfrom
feat/open-session-natively

Conversation

@endrix

@endrix endrix commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Both ACP adapters reuse the agent's own session id as the ACP session id. I checked both:

  • claude-agent-acp hands the ACP id to the Claude Agent SDK as options.sessionId, so the session is the one claude --resume <id> opens.
  • I created an opencode acp session over ACP; its ses_… id appeared under that same id in opencode session list. The probe session was deleted afterwards.

Changes:

  • Connectors: a new resume template. It's built in for claude (claude --resume {sessionId}) and opencode (opencode -s {sessionId}), and a connectors file can set or clear it with resume = "...". resumeCommandFor fills in the id and shell-quotes it when needed.
  • Chat header: two new buttons when a session is shown:
    • Open this session in the agent's own CLI (terminal icon): opens a VS Code terminal in the session's directory, where Claude Code looks its sessions up, and runs the command.
    • Copy the session id.
  • If the connector has no resume command, opening copies the id instead and says why. If the session's directory is gone, the terminal opens anyway with a warning.
  • native-session.ts holds the opening logic so the run's agents can reuse it (follow-up).

Tests:

  • native-session.test.ts: the templates, quoting, connectors-file override, terminal directory, missing directory, copy fallback.
  • chat-runtime-native-session.test.ts.
  • chat-panel-native-session.test.ts.

https://claude.ai/code/session_01N33eMqpCzhDs8HDNez3Yja

Both ACP adapters keep the agent's own session id as the ACP one:
claude-agent-acp hands it to the Claude Agent SDK as `sessionId`, and
`opencode acp` returns opencode's `ses_...` id. So a connector's new
`resume` template -- `claude --resume {sessionId}`, `opencode -s {sessionId}`,
settable (or cleared) as `resume` in a connectors file -- opens the very
session the chat is in.

The session header gains two buttons: open in the agent's CLI (a VS Code
terminal in the session's directory, where Claude Code looks its sessions
up) and copy the session id. A connector without a `resume` command copies
the id instead and says so. `native-session.ts` holds the opening, for the
run's agents to share.

Claude-Session: https://claude.ai/code/session_01N33eMqpCzhDs8HDNez3Yja
@endrix
endrix merged commit f5ea594 into main Oct 14, 2026
1 check passed
@endrix
endrix deleted the feat/open-session-natively branch October 14, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant