Skip to main content

Module tools

Module tools 

Source
Expand description

Shared infrastructure and seven concrete coding tools.

Ports .references/pi/packages/coding-agent/src/core/tools/: the ordered built-in registry, read/bash/edit/write/grep/find/ls implementations, truncation, rolling-output spill, per-realpath mutation serialization, and path resolution.

Re-exports§

pub use bash::BashOperations;
pub use bash::BashSpawnContext;
pub use bash::BashSpawnHook;
pub use bash::BashTool;
pub use bash::BashToolDetails;
pub use bash::BashToolInput;
pub use bash::BashToolOptions;
pub use bash::LocalBashOperations;
pub use bash::create_bash_tool;
pub use edit::EditTool;
pub use edit::EditToolDetails;
pub use edit::EditToolInput;
pub use edit::EditToolOptions;
pub use edit::ReplaceEditInput;
pub use edit::create_edit_tool;
pub use find::FindTool;
pub use find::FindToolDetails;
pub use find::FindToolInput;
pub use find::FindToolOptions;
pub use find::create_find_tool;
pub use grep::GrepTool;
pub use grep::GrepToolDetails;
pub use grep::GrepToolInput;
pub use grep::GrepToolOptions;
pub use grep::create_grep_tool;
pub use ls::LsTool;
pub use ls::LsToolDetails;
pub use ls::LsToolInput;
pub use ls::LsToolOptions;
pub use ls::create_ls_tool;
pub use mutation_queue::MutationQueueError;
pub use mutation_queue::with_file_mutation_queue;
pub use output_accumulator::DEFAULT_TEMP_FILE_PREFIX;
pub use output_accumulator::OutputAccumulator;
pub use output_accumulator::OutputAccumulatorError;
pub use output_accumulator::OutputAccumulatorOptions;
pub use output_accumulator::OutputSnapshot;
pub use path_utils::PathResolveError;
pub use path_utils::expand_path;
pub use path_utils::path_exists;
pub use path_utils::resolve_read_path;
pub use path_utils::resolve_read_path_async;
pub use path_utils::resolve_to_cwd;
pub use read::ReadTool;
pub use read::ReadToolDetails;
pub use read::ReadToolInput;
pub use read::ReadToolOptions;
pub use read::create_read_tool;
pub use read::detect_supported_image_mime_type;
pub use truncate::DEFAULT_MAX_BYTES;
pub use truncate::DEFAULT_MAX_LINES;
pub use truncate::GREP_MAX_LINE_LENGTH;
pub use truncate::TruncatedBy;
pub use truncate::TruncatedLine;
pub use truncate::TruncationOptions;
pub use truncate::TruncationResult;
pub use truncate::format_size;
pub use truncate::truncate_head;
pub use truncate::truncate_line;
pub use truncate::truncate_line_with;
pub use truncate::truncate_tail;
pub use write::WriteTool;
pub use write::WriteToolDetails;
pub use write::WriteToolInput;
pub use write::WriteToolOptions;
pub use write::create_write_tool;

Modules§

bash
Bash tool: execute a shell command with streamed, tail-truncated output.
edit
Edit tool: exact multi-replacement file edits under the mutation queue.
edit_diff
Pure edit matching and diff helpers for the edit tool.
find
Find files by glob pattern using globset + ignore::WalkBuilder.
grep
Search file contents with native regex / literal matching.
ls
List directory contents (dotfiles included).
mutation_queue
Per-realpath serialization for file mutations (edit / write).
output_accumulator
Streaming output accumulator with bounded memory and full-output spill.
path_utils
Path expansion, cwd resolution, and macOS path-variant fallback for tool file arguments.
read
Read tool: text files and supported images.
truncate
Shared truncation utilities for tool outputs.
write
Write tool: create or overwrite a file under the mutation queue.

Structs§

UnknownToolName
Error returned by ToolName’s FromStr implementation. Display text matches TypeScript Unknown tool name: ${toolName} exactly.

Enums§

ToolName
Name of one of the seven built-in coding tools (TypeScript ToolName).

Constants§

ALL_TOOL_NAMES
Full registry order (TypeScript allToolNames insertion order and createAllToolDefinitions key order): read → bash → edit → write → grep → find → ls.
DEFAULT_ACTIVE_TOOL_NAMES
Default session-active tools (TypeScript defaultActiveToolNames / createCodingToolDefinitions): read, bash, edit, write. The full registry still contains grep/find/ls; they stay inactive until activated.
READ_ONLY_TOOL_NAMES
Read-only tool set (TypeScript createReadOnlyToolDefinitions): read, grep, find, ls.

Functions§

create_all_tool_definitions
Builds all seven tools in provider-visible registry order.
create_coding_tool_definitions
Builds the four tools enabled by default for coding sessions.
create_read_only_tool_definitions
Builds the read-only tool set in registry order.