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