Expand description
Scoped one-level directory browser. Gateway (api_browse.rs), CLI
(src/browse.rs), and the future TUI directory picker all reach the
same canonical implementation here.
Hard-scoped to <install>/shared/ — the only place skills, knowledge
bundles, and other host-wide content live. .. traversal that escapes
the root is rejected before any I/O.
Structs§
- Browse
Entry - Browse
Result - File
Read Result - Result of reading a file from the agent workspace.
Enums§
Constants§
- AGENT_
WORKSPACE_ READ_ CAP - Hard byte cap on file-read responses. Anything larger surfaces as
BrowseError::TooLarge; the dashboard can offer a CLI hint.
Functions§
- delete_
agent_ workspace_ path - Delete a file or directory inside the agent’s workspace. Recursive for directories. Refuses to delete the workspace root itself or any of the protected bootstrap files.
- list_
agent_ workspace - One-level listing inside the agent’s workspace. Top-level entries that match the protected file/dir lists are tagged so the dashboard hides destructive affordances; server-side mutations still re-check.
- list_
directory - Browse one level of
<install>/shared/<raw>. Returns entries sorted by (kind, name) — directories first, then files, alphabetical within each. - make_
agent_ workspace_ directory - Create a directory under the agent’s workspace. Idempotent — if the path already exists as a directory, returns Ok. Rejects path traversal and refuses to create over an existing file or to overwrite a protected top-level file path.
- make_
directory - Create a new directory at
<install>/shared/<raw>. Idempotent — if the path already exists as a directory, returns Ok without re-creating. Rejects path traversal and refuses to create over an existing file. - move_
agent_ workspace_ path - Move (rename) a path inside the agent’s workspace. Both
fromandtoare relative to the workspace root; both must stay inside it. Refuses to touch protected files on either side. - read_
agent_ workspace_ file - Read a file from the agent’s workspace. Refuses paths that don’t resolve to a regular file; enforces the size cap.
- remove_
directory - Delete the directory at
<install>/shared/<raw>recursively. Refuses to remove protected top-level entries (skills/, skill-bundles/, knowledge/) or the shared root itself. Rejects path traversal.