Skip to content

feat(acp): Add session management commands (simplified version)#1

Merged
xsa-dev merged 7 commits intodevfrom
feat/acp-session-management-v2
Jan 31, 2026
Merged

feat(acp): Add session management commands (simplified version)#1
xsa-dev merged 7 commits intodevfrom
feat/acp-session-management-v2

Conversation

@xsa-dev
Copy link
Copy Markdown
Owner

@xsa-dev xsa-dev commented Jan 30, 2026

Closes anomalyco#8931

Summary

This PR adds 13 session management commands to the ACP (Agent Client Protocol) implementation for Zed integration.

Commands Added

Command Description
listSessions List all available sessions
switchSession Switch to existing session
createSession Create new session
forkSession Fork from specific message
renameSession Rename session
deleteSession Delete session
getSessionInfo Get session metadata
undoMessage Undo last user message
redoMessage Redo message
compactSession Compact session
exportSession Export (text/json/markdown)
jumpToMessage Jump to specific message
duplicateSession Duplicate session

Files Changed

    • TypeScript interfaces
    • Command implementations
    • Command registration

Notes

This is a simplified implementation that uses file-based storage for sessions. Future work can integrate with OpenCode's internal session storage via SDK.

Related

Original PR: anomalyco#11207 (blocked with conflicts)

- Add list_sessions, switch_session, create_session, fork_session
- Add rename_session, delete_session, get_session_info
- Add undo_message, redo_message, compact_session
- Add export_session, jump_to_message, duplicate_session
- Simplified implementation using basic Node.js modules
@github-actions
Copy link
Copy Markdown

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

- Add all session commands to availableCommands list
- Add switch case handlers for all commands
- Parse command arguments from cmd.args string
- Commands: listSessions, switchSession, createSession, forkSession,
  renameSession, deleteSession, getSessionInfo, undoMessage, redoMessage,
  compactSession, exportSession, jumpToMessage, duplicateSession
Copy link
Copy Markdown
Owner Author

@xsa-dev xsa-dev left a comment

Choose a reason for hiding this comment

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

🦥

…8931)

This PR exposes TUI Session Management Commands via ACP.

Implements 13 session management commands:
- list_sessions, switch_session, create_session
- fork_session, rename_session, delete_session
- get_session_info, undo_message, redo_message
- compact_session, export_session, jump_to_message, duplicate_session
- Merge loadAvailableModes and resolveModeState into loadSessionMode
- Simplify arguments typing in MCP client
- Remove OPENCODE_CLIENT environment variable from ACP command
@xsa-dev xsa-dev merged commit 734cc3e into dev Jan 31, 2026
2 of 5 checks passed
catatafishen pushed a commit to catatafishen/agentbridge that referenced this pull request Mar 29, 2026
OpenCode uses `session/resume` as a separate ACP method instead of
`resumeSessionId` in `session/new`. The Zod schema for session/new
has no resumeSessionId field, so the parameter was silently ignored.

Changes:
- Add `supportsSessionResume()` hook to AcpClient (default false)
- Add `resumeSession()` method that calls `session/resume` RPC with
  {sessionId, cwd, mcpServers} params
- createSession() tries session/resume first when supported, falls
  back to session/new on failure
- Only add resumeSessionId to session/new for agents that don't
  support the separate resume method
- OpenCodeClient overrides supportsSessionResume() → true
- Refactor processNewSessionResponse → processSessionResponse
  (sessionId assignment moved to caller for resume compatibility)
- Update SESSION-RESUME.md with Bug 26 and protocol documentation

Discovered via `strings` analysis of OpenCode v1.2.27 binary:
- session/resume request: {sessionId, cwd, mcpServers?}
- session/resume response: {configOptions?, models?, modes?}
- Handler: agent.unstable_resumeSession() (unstable_ prefix)

Related: anomalyco/opencode#8931, xsa-dev/anomalyco-opencode#1

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

Feature: Expose TUI Session Management Commands via ACP (for Zed integration)

1 participant