Skip to content

Feat/workspace tree nav - #2

Closed
charleypeng wants to merge 6 commits into
mainfrom
feat/workspace-tree-nav
Closed

charleypeng wants to merge 6 commits into
mainfrom
feat/workspace-tree-nav

Conversation

@charleypeng

Copy link
Copy Markdown
Owner

No description provided.

Replace the desktop sidebar's project switcher + time-grouped session tree
with a workspace -> folder -> sessions tree: every known working directory
renders as a collapsible folder (GET /session?roots=true across directories
+ GET /project for names and empty folders) with its ROOT sessions, active
directories show a live status dot, folders persist collapse state and offer
hover actions (open the directory picker positioned there / hide locally),
and the session menu gains Open folder with Batch actions disabled.

Sub-agent children no longer render in the sidebar; the task drawer next to
the chat now shows them (GET /session/{id}/children merged into the store,
SSE-fresh) beside the todo list, and clicking a child switches to it.
DirectoryPickerDialog gains an initialDirectory prop for the open-folder
flows. (sessions)
The first time a server with no workspace history is entered, a prompt
opens the directory picker with onboarding copy — picking a folder
persists it as the server's default workspace (per-server localStorage)
and lands on the main page in that directory (the picker's add flow).
Skipping defers the choice and is remembered, so it never nags again.

Settings → Servers shows each server's default workspace (or Not set)
with a change button that re-opens the picker positioned at the current
default. DirectoryPickerDialog gains title/hint overrides, a skip
button and an onAdded callback for these flows. (sessions)
…ve, per-workspace session creation

The workspace tree now leads with the user's DEFAULT workspace: pinned to
the top with a Default badge, separated from the rest by a divider. The
header + New session creates inside that default workspace; a new + Add
workspace button below opens the directory picker and records the picked
folder in a persisted explicit workspace list (oc-workspaces:<server>), so
an added directory survives restarts even with no sessions or project yet.

Hovering a workspace row shows [+] (create a session in that workspace's
directory) and ⋯ (menu: View folder — switches the context and shows the
workspace's files in the main pane; Remove workspace — drops the row and
forgets it in the persisted list). All state persists across restarts:
default workspace, explicit workspace list and removals. (sessions)
- default workspace picked at runtime (onboarding/Settings) now renders
  immediately via a storage-change event (memo cached the first read)
- new-session and cross-directory session picks restore the active
  session after the context re-sync even when not yet in the snapshot
  (previously the chat stayed on the "Select a session" placeholder)
- "View folder" switches the session context so every file request
  (subtree expansion, content, git status) targets the browsed directory
  (server answered for the wrong workspace: UnknownError/empty files);
  FileTree sends the browsed directory explicitly on subtree/status calls
- cross-directory roots listing (GET /session?roots=true) skips the global
  directory injection so other workspaces' sessions stay in the tree
- the tree snapshot refreshes per known workspace directory: opencode's
  /session without a directory returns only global sessions, so per-directory
  workspaces lost their sessions on every refresh
- "Remove workspace" sticks for the active folder (un-hide only reacts to
  current-directory changes; removing the current workspace clears the
  context so auto-enter picks the next visible folder)
- removing a server clears its local workspace/default/recent memory
- render the DEFAULT workspace's sessions under its row when expanded
  (the count badge showed sessions that could never be expanded)
- keep the active session across ANY session-store reset: the store
  records the last selection as a restore candidate (armed by
  setActiveSession, disarmed by deleting that session) and the shell
  re-selects it after every reset, so a server.connected SSE reconnect
  no longer strands the chat on the 'Select a session' placeholder
- stop re-syncs from overwriting the client's active directory with the
  server's per-directory /project/current (which reports a PARENT
  worktree for non-project folders) — that churn routed file/session
  requests to the wrong workspace and surfaced as UnknownError when
  expanding a file-tree folder; seed the directory only when unset and
  auto-enter the DEFAULT workspace on fresh server entry
- replace the tree snapshot wholesale on refresh (Solid setStore merges
  plain objects, so deleted sessions lingered in the tree forever)
- E2E: modernize the suite for the workspace tree (stale SessionList
  testids, onboarding seed, mock DELETE mirrors the real server, idle
  status dots on session rows), 12/12 green
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