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 image_processing;
17pub mod in_memory;
18pub mod os_env;
19pub mod path_utils;
20pub mod shell_output;
21pub mod truncate;
22
23pub mod utils {
24    pub mod git;
25    pub mod open_browser;
26}
27
28pub mod tools;
29pub use tools::{
30    create_bash_tool, create_edit_tool, create_find_tool, create_grep_tool, create_ls_tool,
31    create_powershell_tool, create_read_tool, create_write_tool, BashExecution, BashPrepare,
32    BashToolOptions, ExecutionToolContext, ProcessedImage, ReadImageProcessor, ReadToolOptions,
33};
34
35pub use env::{
36    ExecutionEnv, FileContent, FileInfo, FileKind, FileSystem, Shell, ShellExecOptions, ShellOutput,
37};
38pub use error::{
39    io_to_file_code, io_to_file_error, ExecutionError, ExecutionErrorCode, FileError, FileErrorCode,
40};
41pub use file_mutation_queue::{
42    get_mutation_queue_key, with_file_mutation_queue, MutatingEnv, MutationQueueRegistry,
43};
44pub use image::{detect_supported_image_mime_type, encode_base64};
45pub use in_memory::{InMemoryExecutionEnv, ShellScript};
46pub use os_env::{is_host_private_env, OsExecutionEnv, HOST_PRIVATE_ENV};
47pub use path_utils::{normalize_tool_path, resolve_read_tool_path, resolve_tool_path};
48pub use truncate::{
49    format_size, split_lines_for_counting, truncate_head, truncate_line, truncate_tail,
50    TruncateLineOutput, TruncationLimit, TruncationOptions, TruncationResult, DEFAULT_MAX_BYTES,
51    DEFAULT_MAX_LINES, GREP_MAX_LINE_LENGTH,
52};