description: "Workspace-directory picking seam for the web GUI host: the service contract, capability vocabulary, and error codes the native and browse backends implement."
English | 中文
The web GUI lets an operator choose a workspace directory with either an OS chooser or an in-app browser. Use the native option when the operator can reach the host display; use the browser option for remote clients or when directory listing and creation must stay in the app. Consumers receive the interaction kind and can present the matching workflow. Directory picking is limited to the GUI host and never affects the agent loop. The browser workflow exposes one directory tree at a time; multiple roots are unsupported.
Mount exactly one directory-picker backend and let the workspace flow drive it: the seam itself is only the service contract, so a composition without a backend has no way to pick a directory.
The native backend is the right choice when the operator sits at the host's display: directoryPicker/pick opens one OS chooser and returns the chosen absolute path, or null on cancel. The browse backend works everywhere — it lists one directory level and creates child directories from the browser, so remote clients that cannot reach an OS dialog still pick a workspace. When the host situation varies between boots, compose the adaptive chooser, which resolves the situation once at boot and mounts the matching backend.
capability() returns a discriminated union describing how an operator selects a directory: { kind: 'native', pick(signal) } for the OS chooser, or { kind: 'browse', list(path?), createDirectory(path, name) } for the in-app browser. Consumers switch on kind; a capability kind no composition implements means the UI hides the picking affordance rather than failing. Browse failures throw the typed DirectoryPickerError with a closed code set — directory-unreadable, directory-exists, or directory-create-failed — each carrying the subject path, which the picking Remote controller maps 1:1 onto wire failure codes.
DirectoryEntry rows expose the absolute path and a host-owned hidden flag (dot-prefixed on POSIX) so display policy stays client-side; clients never join path segments themselves. DirectoryListing.crumbs is the ancestor chain from the filesystem root to the listed directory — every crumb is a jump target, and the root crumb is labeled by its full path.
Read these when the seam contract is not enough: the decision record first, then the two backends and the adaptive chooser that compose it.
ctx.fs separation, and the policy decisions.None, as the GUI-host picking seam registers nothing model-facing.
None; this package neither assembles nor sends a provider request.
These limits define when the seam contract leaves a decision to a future consumer. They are current package constraints, not a task backlog.
Runtime invariant: No companion is published. This stateless Service Definition owns the capability vocabulary, while backends and the Remote controller own observations.