Skip to content

feat(tui): add /session-id and /session-info slash commands - #33839

Closed
EZotoff wants to merge 2 commits into
anomalyco:devfrom
EZotoff:feat/session-id-session-info-commands
Closed

feat(tui): add /session-id and /session-info slash commands#33839
EZotoff wants to merge 2 commits into
anomalyco:devfrom
EZotoff:feat/session-id-session-info-commands

Conversation

@EZotoff

@EZotoff EZotoff commented Jun 25, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #11937

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds two TUI slash commands that copy session info to the clipboard — no LLM round-trip, no plugin required.

  • /session-id copies the current session ID
  • /session-info copies Project <dir>; Session <title>; ID <session-id>

Both show up in the slash command palette under Session, use the existing useClipboard() context, and show a toast on success. They are disabled when no session is active.

The input is cleared synchronously in the run handler before the async clipboard write. This prevents the input's deferred onSubmit from sending /session-id as a prompt to the LLM after the palette selection.

Supersedes #11938 (closed by automated PR cleanup, not technical rejection). That PR only had /session-id; this adds /session-info as well.

How did you verify your code works?

  • tsgo --noEmit passes for the @opencode-ai/tui package (0 new errors)
  • Pre-push CI: 25/25 packages typecheck
  • Manual: type /session-id → session ID copied to clipboard, toast appears, no LLM activity. Same for /session-info.

Screenshots / recordings

N/A — no visual layout change, just two new palette entries and a toast.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

EZotoff added 2 commits June 24, 2026 21:17
Add two native TUI slash commands that copy session information to the
clipboard without an LLM round-trip:

/session-id   — copies the current session ID
/session-info — copies "Project <dir>; Session <title>; ID <session-id>"

Both commands appear in the slash command palette under the "Session"
category and are only enabled when a session is active. Uses the existing
Clipboard context and toast notification system.

Supersedes anomalyco#11938 (closed by automated PR cleanup, not technical rejection).
That PR covered only /session-id; this PR adds /session-info as well.

Related: anomalyco#18559 (adds output.cancelled for plugin-based cancellation),
anomalyco#15206 (CLI session info request), anomalyco#11937 (original feature request).
…ard copy

The input's onSubmit fires a double-deferred submit() via setTimeout. If the
input still contains "/session-id" when that fires, it sends the text to the
LLM as a prompt, causing unwanted agent activity.

Fix: clear input.setText("") and setStore synchronously in the run handler,
before the async clipboard.write(). When the deferred submit() fires, it hits
the empty-input guard (if (!store.prompt.input) return false) and exits.
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

feat: add /session-id command to copy session ID to clipboard

1 participant