Skip to content

feat(acp): Expose TUI Session Management Commands via ACP (#8931)#11207

Closed
xsa-dev wants to merge 18 commits intoanomalyco:devfrom
xsa-dev:feat/acp-session-management
Closed

feat(acp): Expose TUI Session Management Commands via ACP (#8931)#11207
xsa-dev wants to merge 18 commits intoanomalyco:devfrom
xsa-dev:feat/acp-session-management

Conversation

@xsa-dev
Copy link
Copy Markdown

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

Closes #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

Define TypeScript interfaces for session management operations including:
- SessionListParams/Result for listing sessions
- SessionSwitchParams for switching between sessions
- SessionCreateParams for creating new sessions
- SessionForkParams for forking sessions from specific messages
- SessionRenameParams for renaming sessions
- SessionDeleteParams for deleting sessions
- SessionInfoParams for getting session details
- SessionUndo/Redo/Compact/Export/Jump/Duplicate params
- Helper function formatSessionInfo for API responses

Issue: anomalyco#8931
Implement session management methods for the ACP protocol:
- listSessions: List all available sessions
- switchSession: Switch to an existing session
- createSession: Create a new session
- forkSession: Fork a session from a specific message
- renameSession: Rename a session
- deleteSession: Delete a session
- getSessionInfo: Get information about a specific session
- undoMessage: Undo the last message
- redoMessage: Redo a message (placeholder)
- compactSession: Compact a session
- exportSession: Export a session in various formats
- jumpToMessage: Jump to a specific message
- duplicateSession: Duplicate a session

Issue: anomalyco#8931
Update the ACP agent server to include session management tools:
- Add getSessionManagementTools() function to generate session tool definitions
- Register session tools alongside agent tools in listTools
- Add handleSessionTool() function to route session tool calls to handlers
- Handle all 13 session management operations: list, switch, create, fork, rename, delete, info, undo, redo, compact, export, jump, duplicate

Issue: anomalyco#8931
Complete implementation of session management operations:
- listSessions: List sessions from storage directory
- switchSession: Switch to existing session
- createSession: Create new session with loadSession
- forkSession: Fork from specific message
- renameSession: Rename session in storage
- deleteSession: Delete session directory
- getSessionInfo: Get session metadata
- undoMessage: Remove last user message
- redoMessage: Placeholder (needs history)
- compactSession: Use compaction module
- exportSession: Export to text/json/markdown
- jumpToMessage: Set message position marker
- duplicateSession: Copy session with new ID

Issue: anomalyco#8931
Fix syntax errors in session management integration:
- Correct import: listSessions instead of list
- Remove invalid Sessions import
- Add missing commas and line breaks
- Ensure proper TypeScript syntax

Issue: anomalyco#8931
@github-actions
Copy link
Copy Markdown
Contributor

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.

@github-actions
Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

@xsa-dev xsa-dev marked this pull request as draft January 29, 2026 21:58
Copy link
Copy Markdown
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.

🔍 Production Readiness Review: PR #11207

Critical Issues Found:

1. ⚠️ MERGE CONFLICTS DETECTED

  • mergeable_state: "dirty" - PR имеет конфликты с base-веткой anomalyco:dev
  • Требуется: git rebase или git merge main перед мерджем

2. 📋 Missing Issue Reference

  • Label needs:issue присутствует
  • Требуется: Связать с соответствующим issue или закрыть этот label

3. 📝 Draft Status

  • PR помечен как draft
  • Требуется: Перевести в Ready for Review статус

4. 🚫 Maintainer Cannot Modify

  • maintainer_can_modify: false
  • Рекомендуется: Включить эту опцию для удобства ревью

5. 📊 Changes Summary

  • 3 файла изменены
  • +2,336 добавлено
  • -1,435 удалено

Changes Overview:

  • packages/opencode/src/acp/session-types.ts - Типы для session management
  • packages/opencode/src/acp/session-handlers.ts - Обработчики для 13 команд
  • packages/opencode/src/acp/agent.ts - Регистрация tool и роутинг

Feature List (13 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

- Add 13 session management commands (list_sessions, switch_session, etc.)
- Implement session handlers for all commands
- Add TypeScript interfaces for session types
- Update agent.ts with new tool registration and MCP server setup

Co-authored-by: xsa-dev <xsa-dev@users.noreply.github.com>
- Remove deprecated createServer from MCP SDK import
- Use new McpServer({ name, version }) constructor
- Add type keyword to CallToolResult and ListToolsResult imports
- Remove deprecated createServer function from imports
- Use new McpServer({ name, version }) constructor instead
- Add type keyword to CallToolResult and ListToolsResult imports
PR anomalyco#11207 incorrectly tried to create a separate MCP server with
@modelcontextprotocol/sdk which doesn't have the expected API.

The correct approach is to use @agentclientprotocol/sdk (as in
original repository) to add session management commands as tools
to the existing ACP agent.

This reverts the incorrect implementation. Session management
commands should be added differently using AgentSideConnection API.
Reverts agent.ts to use @agentclientprotocol/sdk as in
anomalyco/opencode repository. The previous PR implementation
incorrectly used @modelcontextprotocol/sdk which doesn't have
the expected McpServer class API.
@xsa-dev xsa-dev closed this Jan 31, 2026
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)

2 participants