Skip to main content

Module browse

Module browse 

Source
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§

BrowseEntry
BrowseResult
FileReadResult
Result of reading a file from the agent workspace.

Enums§

BrowseError

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 from and to are 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.