Download codex-rs/app-server-protocol/src/protocol/v2/fs.rs from SaylorTwift/codex: direct link, hf CLI and curl.
- Browser
- Download file 7.27 kB
-
https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/fs.rs
- Command line
-
hf download hf://SaylorTwift/codex/codex-rs/app-server-protocol/src/protocol/v2/fs.rs
-
curl -L -o fs.rs https://huggingface.co/SaylorTwift/codex/resolve/main/codex-rs/app-server-protocol/src/protocol/v2/fs.rs
7.27 kB
| use crate::JsonSchema; | |
| use crate::TS; | |
| use codex_utils_absolute_path::AbsolutePathBuf; | |
| use serde::Deserialize; | |
| use serde::Serialize; | |
| /// Read a file from the host filesystem. | |
| pub struct FsReadFileParams { | |
| /// Absolute path to read. | |
| pub path: AbsolutePathBuf, | |
| } | |
| /// Base64-encoded file contents returned by `fs/readFile`. | |
| pub struct FsReadFileResponse { | |
| /// File contents encoded as base64. | |
| pub data_base64: String, | |
| } | |
| /// Write a file on the host filesystem. | |
| pub struct FsWriteFileParams { | |
| /// Absolute path to write. | |
| pub path: AbsolutePathBuf, | |
| /// File contents encoded as base64. | |
| pub data_base64: String, | |
| } | |
| /// Successful response for `fs/writeFile`. | |
| pub struct FsWriteFileResponse {} | |
| /// Create a directory on the host filesystem. | |
| pub struct FsCreateDirectoryParams { | |
| /// Absolute directory path to create. | |
| pub path: AbsolutePathBuf, | |
| /// Whether parent directories should also be created. Defaults to `true`. | |
| pub recursive: Option<bool>, | |
| } | |
| /// Successful response for `fs/createDirectory`. | |
| pub struct FsCreateDirectoryResponse {} | |
| /// Request metadata for an absolute path. | |
| pub struct FsGetMetadataParams { | |
| /// Absolute path to inspect. | |
| pub path: AbsolutePathBuf, | |
| } | |
| /// Metadata returned by `fs/getMetadata`. | |
| pub struct FsGetMetadataResponse { | |
| /// Whether the path resolves to a directory. | |
| pub is_directory: bool, | |
| /// Whether the path resolves to a regular file. | |
| pub is_file: bool, | |
| /// Whether the path itself is a symbolic link. | |
| pub is_symlink: bool, | |
| /// File creation time in Unix milliseconds when available, otherwise `0`. | |
| pub created_at_ms: i64, | |
| /// File modification time in Unix milliseconds when available, otherwise `0`. | |
| pub modified_at_ms: i64, | |
| } | |
| /// List direct child names for a directory. | |
| pub struct FsReadDirectoryParams { | |
| /// Absolute directory path to read. | |
| pub path: AbsolutePathBuf, | |
| } | |
| /// A directory entry returned by `fs/readDirectory`. | |
| pub struct FsReadDirectoryEntry { | |
| /// Direct child entry name only, not an absolute or relative path. | |
| pub file_name: String, | |
| /// Whether this entry resolves to a directory. | |
| pub is_directory: bool, | |
| /// Whether this entry resolves to a regular file. | |
| pub is_file: bool, | |
| } | |
| /// Directory entries returned by `fs/readDirectory`. | |
| pub struct FsReadDirectoryResponse { | |
| /// Direct child entries in the requested directory. | |
| pub entries: Vec<FsReadDirectoryEntry>, | |
| } | |
| /// Remove a file or directory tree from the host filesystem. | |
| pub struct FsRemoveParams { | |
| /// Absolute path to remove. | |
| pub path: AbsolutePathBuf, | |
| /// Whether directory removal should recurse. Defaults to `true`. | |
| pub recursive: Option<bool>, | |
| /// Whether missing paths should be ignored. Defaults to `true`. | |
| pub force: Option<bool>, | |
| } | |
| /// Successful response for `fs/remove`. | |
| pub struct FsRemoveResponse {} | |
| /// Copy a file or directory tree on the host filesystem. | |
| pub struct FsCopyParams { | |
| /// Absolute source path. | |
| pub source_path: AbsolutePathBuf, | |
| /// Absolute destination path. | |
| pub destination_path: AbsolutePathBuf, | |
| /// Required for directory copies; ignored for file copies. | |
| pub recursive: bool, | |
| } | |
| /// Successful response for `fs/copy`. | |
| pub struct FsCopyResponse {} | |
| /// Start filesystem watch notifications for an absolute path. | |
| pub struct FsWatchParams { | |
| /// Connection-scoped watch identifier used for `fs/unwatch` and `fs/changed`. | |
| pub watch_id: String, | |
| /// Absolute file or directory path to watch. | |
| pub path: AbsolutePathBuf, | |
| } | |
| /// Successful response for `fs/watch`. | |
| pub struct FsWatchResponse { | |
| /// Canonicalized path associated with the watch. | |
| pub path: AbsolutePathBuf, | |
| } | |
| /// Stop filesystem watch notifications for a prior `fs/watch`. | |
| pub struct FsUnwatchParams { | |
| /// Watch identifier previously provided to `fs/watch`. | |
| pub watch_id: String, | |
| } | |
| /// Successful response for `fs/unwatch`. | |
| pub struct FsUnwatchResponse {} | |
| /// Filesystem watch notification emitted for `fs/watch` subscribers. | |
| pub struct FsChangedNotification { | |
| /// Watch identifier previously provided to `fs/watch`. | |
| pub watch_id: String, | |
| /// File or directory paths associated with this event. | |
| pub changed_paths: Vec<AbsolutePathBuf>, | |
| } | |