Files
apes-sidebar/docs
NeedsTree b4e9924982 fix(editor): open a directory target as the folder window (#1029)
A path that resolves to a directory (a chat folder link, a sidebar_open
folder, or a directory pasted into the editor address bar) was read as a
file: the host answered 400 fs-error '"<path>" is a directory' and
EditorHost painted that raw message into the tab instead of the plugin's
folder window.

- fs.read / fs.readPage now answer a directory with the dedicated
  fs-directory wire code (src/wire.ts, readText/readPage).
- EditorHost promotes the tab to the folder window it already draws.
- The promoted root is a PLATFORM-NATIVE ABSOLUTE path, resolved against
  the session workspace root by the new resolveNativeSidebarPath helper
  (paths.ts): chat file addresses carry session-relative, forward-slash
  spellings, while the host keys every listing by its path.resolve'd
  absolute path and FileTree caches levels by the requested root. A
  relative root or a mixed-separator root lands in another cache key and
  the tree sits on its loading placeholder forever. The helper also drops
  a trailing separator (except a drive root) like path.resolve does.
- The fix covers all three entry points at once: conversation folder
  links (no meta.dir on the tab), sidebar_open folders (service.openTab
  drops the seed meta on the native resource route), and #933's
  pasted/stepped directory path.

Tests: isDirectoryReadError unit cases, the EditorHost relative-path and
Windows-root fallback render cases, resolveNativeSidebarPath win32/POSIX
cases, and the fs.readPage directory code. typecheck + build + lint pass;
targeted suites 78/78; the full suite's remaining failures reproduce on a
clean dev checkout (Windows symlink / pnpm pack / git smokes) and are
unrelated to this change. Verified in the live GUI: a folder opened after
the patch expands its tree immediately.
2026-10-22 17:58:10 +08:00
..