Skip to content

feat: scope sidebar sessions to the directory, open tabs first - #4

Open
c0dn wants to merge 1 commit into
x44ylan:mainfrom
c0dn:feat/session-list-scoping
Open

c0dn wants to merge 1 commit into
x44ylan:mainfrom
c0dn:feat/session-list-scoping

Conversation

@c0dn

@c0dn c0dn commented Oct 12, 2026

Copy link
Copy Markdown

Summary

  • list only sessions from the current session's directory, re-scoping when the sidebar follows a switch
  • show open tabs first in tab order, then the 8 most recently used sessions (by max(updated, viewed)), and always keep the session in view listed
  • show open or the last-used age (5m, 3h, 2d) beside each idle session, with the spinner for running ones
  • switch by focusing the session's tab when it is open, and fall back to router navigation otherwise
  • hide archived sessions; refresh on session.created, session.renamed, session.deleted and session.idle
  • drop the module-level cache and timeout wrapper; a failed load now shows a toast instead of failing silently
  • document the new list behaviour in the README

Validation

  • npm ci --ignore-scripts
  • npm test (tsc, against @opencode/plugin 2.0.14)
  • npm run build produces dist/tui.js
  • Bun import of dist/tui.js: the plugin id resolves and orderSessions orders open tabs ahead of recent sessions

Not yet checked: a live sidebar run in OpenCode 2.0.14 on this branch.

Possible improvements

  • Tests: orderSessions and age are pure but have no unit tests; npm test only typechecks.
  • Refresh cost: every session.idle event refetches the list. A debounce, or patching the one changed session from data, would cut requests in busy workspaces.
  • Live ages: the age label only updates when the list re-renders for another reason, so it can go stale.
  • Configurable limits: RECENT_LIMIT (8) and the 26-character title cut-off are hard-coded.
  • Retry status: v2 only reports running, so the old retry indicator is gone. It can come back if the API exposes that state again.
  • Keyboard: switching is mouse-only.

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