feat(session): add /session command to browse and attach CLI sessions#30
Merged
RoundTable02 merged 2 commits intomainfrom Mar 16, 2026
Merged
feat(session): add /session command to browse and attach CLI sessions#30RoundTable02 merged 2 commits intomainfrom
RoundTable02 merged 2 commits intomainfrom
Conversation
… from Discord
Add a new /session slash command with list, attach, detach, and info
subcommands, allowing users to resume OpenCode CLI sessions from Discord
threads. Sessions display titles from the OpenCode API for easy
identification.
- Add SessionInfo interface and getSessionInfo() to sessionManager
- Update listSessions() to return {id, title} instead of just IDs
- Create session.ts with list/attach/detach/info subcommands
- Register session command in commands/index.ts
Closes #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
/sessionslash command that allows Discord users to browse, attach, and manage existing OpenCode CLI sessions directly from Discord threads — enabling seamless session resume across CLI and Discord.Related Issue
Closes #25
Type of Change
Changes Made
src/commands/session.ts—/sessioncommand with 4 subcommands:list— Lists all sessions for the channel's bound project, showing session titles, mapping status, and last-used timeattach— Presents a select menu of active sessions (labeled by title) to attach to the current threaddetach— Detaches the session from the current thread and clears the SSE clientinfo— Shows detailed session info embed including title, ID, port, status, and timestampssrc/services/sessionManager.ts:SessionInfointerface ({ id, title })listSessions()to returnSessionInfo[]with titles from the OpenCode APIgetSessionInfo()to fetch a single session's title and validate its existencesrc/commands/index.ts— Registered the newsessioncommandTesting
npm test)Checklist
Additional Notes
GET /sessionreturnstitlefield per session). This matches the OpenCode CLI's/sessionTUI which displays titles for easy identification.attachsubcommand uses Discord'sStringSelectMenuwith a 120-second timeout. Select menu labels show session titles (max 25 chars), descriptions show session ID prefix and mapping info.freshContextis automatically set tofalseso the resumed session preserves conversation history.remote-opencode deployto register the new slash command with Discord.