description, kind
| description | kind |
|---|---|
| The right Sidebar's file-tree tab type for the dsh web client: the session workspace root listed one level at a time over the wire, opening files into the Sidebar by resource address. | package-reference |
@deepseek-ai/dsh-client-ui-sidebar-files
English | 中文
Summary
Browse a Session's workspace tree and open files in Sidebar previews. The root and expanded directories refresh automatically from direct-entry watches; manual reload remains available. The tab is reached from the guide and claims no resource address.
Table of Contents
What it registers
- The type —
ctx.sidebarRightTabs.register(...)with kindfiles, id@deepseek-ai/dsh-client-ui-sidebar-files, bandbuiltin, no patterns, and one guide entry (order 10, its title and description from thesidebarFilesnamespace, its glyph the shared folder icon) that opens the type. - The body — the keyed
sidebar.right.pane.tabseat under that id: a header row under the strip, then the tree. The header row is the document preview's (ui-sidebar-documentpreview): the root path, its directories greyed and its last segment in full ink, never ellipsized (a path wider than the row keeps its end and fades its start), with the visible reload control at its right. The row is copied rather than shared because a plugin bundle shares runtime code only through the platform modules; once the artifact and slot surfaces settle, one copy inui-primitivescould serve every pane header. - The chip title — the keyed
sidebar.right.pane.tab.titleseat under that id: a sharedFileTypeIconfolder glyph at 16px before the type's label. The tree's own rows never draw this sheet.
Source files under src/client/: definition.tsx (the type), store.ts (what it keeps), face.ts (Remote reads and watches), directory-node.ts (open directories and their lifetimes), FilesBody.tsx (what it draws, with its ordering and failure-line helpers), FilesTitle.tsx (the chip title), locales.ts (what it says), and index.ts (the wiring).
The tree
The root is the session's working directory, read from useSessions().byId[sessionId].cwd, and split for the header row by pathPartsOf from @deepseek-ai/dsh-util-workspace-path. Filesystem roots such as / and Windows drive roots are valid tree roots. Every level is keyed by absolute path; a child's path is its parent's joined with the entry name by /. A level is listed when it is first expanded, through remote.workspaceFiles.list(sessionId, absolutePath) on the @deepseek-ai/dsh-api-workspace-files namespace; the adapter keeps the listing's entries and truncation flag and drops its workspace-relative path. Rows are ordered directories first, then by natural, case-insensitive name; dotfiles are shown like any other entry.
| Entry type | Row |
|---|---|
directory |
Toggles; reopening lists again and restores still-present expanded descendants. Displayed entries remain cached while collapsed. |
file |
Opens dsh-resource://file/session/<sessionId>/<encoded path relative to the root>, built by fileAddressFor from @deepseek-ai/dsh-util-workspace-path from the entry's absolute path and the tree's root, through useTabInfo().tab.actions.openResource, landing in the tab's own pane. |
other |
Shown greyed and not clickable, so the directory is reported whole. |
A level cut by the endpoint's entry cap ends with a marker; an empty level says so; a level that failed shows one line per code — workspace-file/not-found, outside-workspace, not-directory — and the transport's own message otherwise. Reload refreshes the root and expanded levels in place, retaining displayed entries during reads instead of resetting the whole tree; collapsed levels are fetched again when they next open. A session without a working directory shows a single line instead of a tree.
State lives in the type's own store, bucketed by tab id: root, levels (loading / ready / failed per absolute path), expanded, autoRefresh, and scrollTop, which the body tracks locally while scrolling and commits once when it unmounts. Because the store outlives the body, switching to another sidebar tab and back remounts the tree with its levels intact and its scroll offset restored. The owner's signal ends a bucket: on abort the tab is forgotten, and neither a listing that settles afterwards nor the unmount's offset commit writes anything.
Each open DirectoryNode owns its target watch for the Tab lifetime; collapse closes that node and its hidden descendants. Expansion changes during ancestor restoration update the store and pending nodes, so restored descendants follow the latest expansion preferences. Automatic refresh defaults to enabled; its separate toggle is hidden while state, labels, styles, and toggle logic remain. Changes received during a directory read or its completion remain pending for another refresh.
Model Experience
None, as this package draws a workspace file tree in the browser and registers nothing model-facing.
KV Cache effect
None; directory listings travel over the Remote and assemble no model request.
Known Limitations and Deferred Work
- Listing only. No search, artifact filter, drag-and-drop, rename, context menu, or current-file highlight.
- One root. The tree is rooted at the session's working directory; there is no way to browse above it, and the Host refuses paths outside the workspace root anyway.
Dev Note
Working context for maintainers — click to expand
None.
Runtime invariant: No companion is published. The tab-owned face keeps directory reads and watches private, and writes displayed state through its Slot store; tab cancellation releases both. The package exposes no independent observation for a runtime comparison.