Skip to main content

rpi_tools/
lib.rs

1//! Mirrors `packages/agent/src/harness` (tools + env + session + compaction).
2//!
3//! M4 scope: `ExecutionEnv` trait + `OsExecutionEnv` + `InMemoryExecutionEnv` +
4//! file-mutation-queue + read/write/edit/bash tools + edit-diff + utils
5//! (truncate, shell-output, image, path-utils). Session/compaction arrive in M5
6//! (these live in `pi-harness`, not here).
7//!
8//! Workspace dep chain: `pi-telemetry → pi-ai → pi-agent → pi-tools →
9//! pi-harness → pi-cli`. `pi-tools` depends on `pi-agent` (for the `AgentTool`
10//! trait) and `pi-ai` (for `Tool`/content types).
11
12pub mod env;
13pub mod error;
14pub mod file_mutation_queue;
15pub mod image;
16pub mod in_memory;
17pub mod os_env;
18pub mod path_utils;
19pub mod shell_output;
20pub mod truncate;
21
22pub mod tools;
23pub use tools::{
24    create_bash_tool, create_edit_tool, create_find_tool, create_grep_tool, create_ls_tool,
25    create_powershell_tool, create_read_tool, create_write_tool, BashToolOptions,
26    ExecutionToolContext, ReadToolOptions,
27};
28
29pub use env::{
30    ExecutionEnv, FileContent, FileInfo, FileKind, FileSystem, Shell, ShellExecOptions, ShellOutput,
31};
32pub use error::{
33    io_to_file_code, io_to_file_error, ExecutionError, ExecutionErrorCode, FileError, FileErrorCode,
34};
35pub use file_mutation_queue::{
36    get_mutation_queue_key, with_file_mutation_queue, MutatingEnv, MutationQueueRegistry,
37};
38pub use image::{detect_supported_image_mime_type, encode_base64};
39pub use in_memory::{InMemoryExecutionEnv, ShellScript};
40pub use os_env::OsExecutionEnv;
41pub use path_utils::{normalize_tool_path, resolve_read_tool_path, resolve_tool_path};
42pub use truncate::{
43    format_size, split_lines_for_counting, truncate_head, truncate_line, truncate_tail,
44    TruncateLineOutput, TruncationLimit, TruncationOptions, TruncationResult, DEFAULT_MAX_BYTES,
45    DEFAULT_MAX_LINES, GREP_MAX_LINE_LENGTH,
46};