261 lines
6.0 KiB
Markdown
261 lines
6.0 KiB
Markdown
# Stubbed Functions Reference
|
|
|
|
Quick reference for all stubbed functions with task IDs and signatures.
|
|
|
|
---
|
|
|
|
## File Operations
|
|
|
|
### TOOLS-FS-01: Read Text File
|
|
**File**: `src/fs/read.rs`
|
|
|
|
```rust
|
|
pub async fn read_text_file(
|
|
request: ReadTextFileRequest,
|
|
config: &SandboxConfig,
|
|
) -> ToolResult<ReadTextFileResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `ReadTextFileRequest { path: String, line: Option<usize>, limit: Option<usize> }`
|
|
- `ReadTextFileResponse { content: String }`
|
|
|
|
---
|
|
|
|
### TOOLS-FS-02: Write Text File
|
|
**File**: `src/fs/write.rs`
|
|
|
|
```rust
|
|
pub async fn write_text_file(
|
|
request: WriteTextFileRequest,
|
|
config: &SandboxConfig,
|
|
) -> ToolResult<WriteTextFileResponse>
|
|
|
|
pub fn normalize_eol(content: &str, policy: EolPolicy) -> String
|
|
```
|
|
|
|
**Types**:
|
|
- `WriteTextFileRequest { path: String, content: String }`
|
|
- `WriteTextFileResponse {}`
|
|
|
|
---
|
|
|
|
### TOOLS-FS-03: Generate Diff
|
|
**File**: `src/fs/diff.rs`
|
|
|
|
```rust
|
|
pub fn generate_diff(old_content: &str, new_content: &str, path: &Path) -> String
|
|
```
|
|
|
|
---
|
|
|
|
### TOOLS-FS-04: Edit File
|
|
**File**: `src/fs/edit.rs`
|
|
|
|
```rust
|
|
pub async fn edit_file(
|
|
request: EditFileRequest,
|
|
config: &SandboxConfig,
|
|
) -> ToolResult<EditFileResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `EditFileRequest { path: String, edits: Vec<EditOperation> }`
|
|
- `EditFileResponse { diff: String }`
|
|
- `EditOperation::Replace { old_text: String, new_text: String, replace_all: bool }`
|
|
- `EditOperation::Patch { diff: String }`
|
|
|
|
---
|
|
|
|
## Search Operations
|
|
|
|
### TOOLS-SEARCH-01: Directory Listing
|
|
**File**: `src/search/ls.rs`
|
|
|
|
```rust
|
|
pub async fn ls(request: LsRequest, config: &SearchConfig) -> ToolResult<LsResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `LsRequest { path: String }`
|
|
- `LsResponse { entries: Vec<LsEntry> }`
|
|
- `LsEntry { path: PathBuf, kind: FileKind, size: Option<u64> }`
|
|
- `FileKind: File | Dir | Symlink`
|
|
|
|
---
|
|
|
|
### TOOLS-SEARCH-02: Glob Search
|
|
**File**: `src/search/glob.rs`
|
|
|
|
```rust
|
|
pub async fn glob_search(
|
|
request: GlobRequest,
|
|
config: &SearchConfig,
|
|
) -> ToolResult<GlobResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `GlobRequest { path: String, pattern: String, exclude: Option<Vec<String>>, max_results: Option<u32> }`
|
|
- `GlobResponse { matches: Vec<PathBuf>, truncated: bool }`
|
|
|
|
---
|
|
|
|
### TOOLS-SEARCH-03: Content Search (Grep)
|
|
**File**: `src/search/grep.rs`
|
|
|
|
```rust
|
|
pub async fn grep_search(
|
|
request: GrepRequest,
|
|
config: &SearchConfig,
|
|
) -> ToolResult<GrepResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `GrepRequest { path: String, pattern: String, file_pattern: Option<String>, ignore_case: bool, context_before: u32, context_after: u32, max_results: Option<u32> }`
|
|
- `GrepResponse { matches: Vec<GrepMatch>, truncated: bool }`
|
|
- `GrepMatch { path: PathBuf, line_number: usize, line: String, context_before: Vec<String>, context_after: Vec<String> }`
|
|
|
|
---
|
|
|
|
## Terminal Operations
|
|
|
|
### TOOLS-TERM-01: Create Terminal
|
|
**File**: `src/terminal/create.rs`
|
|
|
|
```rust
|
|
pub async fn create_terminal(
|
|
request: CreateTerminalRequest,
|
|
config: &TerminalConfig,
|
|
) -> ToolResult<CreateTerminalResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `CreateTerminalRequest { command: String, args: Vec<String>, cwd: Option<String>, env: Option<Vec<EnvVar>>, output_byte_limit: Option<u64> }`
|
|
- `CreateTerminalResponse { terminal_id: String }`
|
|
- `EnvVar { name: String, value: String }`
|
|
|
|
---
|
|
|
|
### TOOLS-TERM-02: Get Terminal Output
|
|
**File**: `src/terminal/output.rs`
|
|
|
|
```rust
|
|
pub async fn get_terminal_output(
|
|
request: TerminalOutputRequest,
|
|
config: &TerminalConfig,
|
|
) -> ToolResult<TerminalOutputResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `TerminalOutputRequest { terminal_id: String }`
|
|
- `TerminalOutputResponse { output: String, truncated: bool, exit_status: Option<i32> }`
|
|
|
|
---
|
|
|
|
### TOOLS-TERM-03: Wait for Exit
|
|
**File**: `src/terminal/wait.rs`
|
|
|
|
```rust
|
|
pub async fn wait_for_terminal_exit(
|
|
request: WaitForTerminalExitRequest,
|
|
config: &TerminalConfig,
|
|
) -> ToolResult<WaitForTerminalExitResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `WaitForTerminalExitRequest { terminal_id: String }`
|
|
- `WaitForTerminalExitResponse { exit_status: i32 }`
|
|
|
|
---
|
|
|
|
### TOOLS-TERM-04: Kill Terminal
|
|
**File**: `src/terminal/kill.rs`
|
|
|
|
```rust
|
|
pub async fn kill_terminal(
|
|
request: KillTerminalCommandRequest,
|
|
config: &TerminalConfig,
|
|
) -> ToolResult<KillTerminalCommandResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `KillTerminalCommandRequest { terminal_id: String }`
|
|
- `KillTerminalCommandResponse {}`
|
|
|
|
---
|
|
|
|
### TOOLS-TERM-05: Release Terminal
|
|
**File**: `src/terminal/release.rs`
|
|
|
|
```rust
|
|
pub async fn release_terminal(
|
|
request: ReleaseTerminalRequest,
|
|
config: &TerminalConfig,
|
|
) -> ToolResult<ReleaseTerminalResponse>
|
|
```
|
|
|
|
**Types**:
|
|
- `ReleaseTerminalRequest { terminal_id: String }`
|
|
- `ReleaseTerminalResponse {}`
|
|
|
|
---
|
|
|
|
### Ring Buffer
|
|
**File**: `src/terminal/ring_buffer.rs`
|
|
|
|
```rust
|
|
impl RingBuffer {
|
|
pub fn new(capacity: usize) -> Self
|
|
}
|
|
```
|
|
|
|
**Note**: Full interface to be defined during implementation.
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
**Total Stubbed Functions**: 15 main functions + 1 helper
|
|
|
|
**File Operations**: 4 functions
|
|
- read_text_file, write_text_file, normalize_eol, generate_diff, edit_file
|
|
|
|
**Search Operations**: 3 functions
|
|
- ls, glob_search, grep_search
|
|
|
|
**Terminal Operations**: 6 functions + ring buffer
|
|
- create_terminal, get_terminal_output, wait_for_terminal_exit, kill_terminal, release_terminal, RingBuffer::new
|
|
|
|
All functions return `unimplemented!()` with clear task IDs in the panic message.
|
|
|
|
---
|
|
|
|
## Implementation Order
|
|
|
|
Recommended implementation order based on dependencies:
|
|
|
|
1. **File Operations** (UI features need these first)
|
|
- TOOLS-FS-01: read_text_file
|
|
- TOOLS-FS-02: write_text_file + normalize_eol
|
|
- TOOLS-FS-03: generate_diff
|
|
|
|
2. **Search Operations** (useful for development)
|
|
- TOOLS-SEARCH-01: ls
|
|
- TOOLS-SEARCH-02: glob_search
|
|
- TOOLS-SEARCH-03: grep_search
|
|
|
|
3. **Edit Operations** (builds on read/write)
|
|
- TOOLS-FS-04: edit_file
|
|
|
|
4. **Terminal Operations** (more complex, can be deferred)
|
|
- TOOLS-TERM-01: create_terminal + ring_buffer
|
|
- TOOLS-TERM-02: get_terminal_output
|
|
- TOOLS-TERM-03: wait_for_terminal_exit
|
|
- TOOLS-TERM-04: kill_terminal
|
|
- TOOLS-TERM-05: release_terminal
|
|
|
|
---
|
|
|
|
*Generated: 2025-11-12*
|
|
*Package: dirigent_tools v0.1.0*
|