Add a home-restricted folder picker to the new-chat dialog

Server: list_directory returns a directory_listing (path, home, parent,
entries with is_dir/is_git_repo/hidden, truncated) confined to the server
user's home subtree after cleaning and resolving symlinks, refusing pseudo
filesystems and capping entries at 2000. Documented in docs/cli.md.

App: "Choose folder…" in the create dialog opens a picker (full-screen page
on phones, large dialog on wide windows, Material and Cupertino) with
breadcrumbs, filter, Show hidden, git badges, dimmed files, recent folders,
inline errors and "Start chat here". The probe app gains a folder fixture
for captures.
This commit is contained in:
2026-11-01 21:51:48 +00:00
parent eadd017bdc
commit eed3806efb
25 changed files with 2333 additions and 9 deletions
+17
View File
@@ -482,6 +482,23 @@ sessions pipeline runs create. The protocol types are:
(currently 8). It is a dedicated request so the create dialog can load the
choices without first listing sessions; `chat_sessions` stays a pure session
list.
- `list_directory` backs the app's "Choose folder" picker. The request body is
`list_directory: {"path": "..."}`; `path` is optional, absolute or starting
with `~` (`~` or `~/sub`), and defaults to the server user's home. The reply
is `directory_listing: {"path", "home", "parent", "entries", "truncated"}`:
`path` is the absolute, cleaned directory (expressed under `home`), `parent` is
`null` at the home root, and each entry is
`{"name", "path", "is_dir", "is_git_repo", "hidden"}` — directories first,
then files, each group sorted case-insensitively. Files are names only (never
contents) and are not selectable; `is_git_repo` marks a directory containing
`.git`; `hidden` marks a dot-name. Listing is confined to the home subtree:
the path is cleaned and its symlinks resolved first, so `..`, an absolute path
outside home, or a symlink that escapes home is refused with an `error` frame
("... is outside the home directory ..."); a symlink entry that escapes home is
listed only as a plain name. Kernel pseudo filesystems (proc, sysfs, devfs and
similar) are refused, permission problems are reported as
`permission denied: <path>`, and a reply carries at most 2000 entries with
`truncated: true` when more exist.
- `chat_adopt` takes a `session_id` that already exists on the configured
endpoint and records it in the operator session registry, using the endpoint's
own directory and title (never a guess or the server's working directory). The