ToolsのTracker実装

This commit is contained in:
2026-04-13 04:26:27 +09:00
parent 5bc4a6d6d6
commit 9b9e37cc84
14 changed files with 442 additions and 358 deletions
+7 -6
View File
@@ -7,15 +7,16 @@
//! - [`ScopedFs`] — pod-lifetime, expresses the write-block boundary for
//! the current scope. Derived from the manifest and shareable across
//! sessions.
//! - [`ReadTracker`] — session-lifetime, enforces the "read before edit"
//! policy via content hashes. Recreated fresh per session.
//! - [`Tracker`] — session-lifetime, enforces the "read before edit"
//! policy via content hashes and tracks the recency of touched files.
//! Recreated fresh per session.
//!
//! The Pod layer owns both instances and passes them to
//! [`builtin_tools`] when registering tools on a `Worker`.
pub mod error;
pub mod read_tracker;
pub mod scoped_fs;
pub mod tracker;
mod edit;
mod glob;
@@ -28,19 +29,19 @@ pub use error::ToolsError;
pub use glob::glob_tool;
pub use grep::grep_tool;
pub use read::read_tool;
pub use read_tracker::ReadTracker;
pub use scoped_fs::ScopedFs;
pub use tracker::Tracker;
pub use write::write_tool;
/// Register all builtin tools, wiring them to a shared `ScopedFs`
/// (pod-lifetime) and `ReadTracker` (session-lifetime).
/// (pod-lifetime) and `Tracker` (session-lifetime).
///
/// All returned factories share the same tracker instance so that
/// `Read` / `Write` / `Edit` see a consistent history across tool
/// invocations within a single session.
pub fn builtin_tools(
fs: ScopedFs,
tracker: ReadTracker,
tracker: Tracker,
) -> Vec<llm_worker::tool::ToolDefinition> {
vec![
read_tool(fs.clone(), tracker.clone()),