1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! # adk-devtools
//!
//! Developer tools for ADK-Rust coding agents — `read_file`, `write_file`,
//! `edit_file`, `apply_patch`, `glob`, `grep`, and `bash` — all scoped to a sandboxed
//! [`Workspace`].
//!
//! These are the inner-loop tools a coding agent needs: read and edit files,
//! search the tree, and run commands/tests. Every operation is rooted at a
//! workspace directory and rejected if it escapes; mutations and `bash` are
//! gated by the workspace's capability flags.
//!
//! ## Quick start
//!
//! ```rust
//! use adk_devtools::{DevToolset, Workspace};
//! use std::sync::Arc;
//!
//! // `bash` is off by default; enable it only for agents that need a shell.
//! let workspace = Workspace::new("./my-repo").allow_bash(true);
//! assert!(workspace.bash_allowed());
//!
//! // Register with an agent: `LlmAgentBuilder::new("coding-agent").toolset(toolset)`.
//! let toolset = Arc::new(DevToolset::new(workspace));
//! # let _ = toolset;
//! ```
//!
//! ## Sandboxing
//!
//! [`Workspace`] enforces **path containment** (no escaping the root),
//! **read-only** mode (deny writes/bash), **opt-in bash** (off until
//! [`Workspace::allow_bash`] enables it), a **bash timeout** that a call
//! can shorten but not extend, and **secret exclusion**: `grep` and `glob` skip
//! files matching [`DEFAULT_EXCLUDE_GLOBS`] and `read_file` refuses them with
//! [`DevToolError::Excluded`]. `edit_file` requires a prior `read_file` by the same
//! session and agent, and refuses a file that changed since with
//! [`DevToolError::Stale`]: every read and write records the file's sha256 in a
//! [`ReadLedger`], which a host can persist with [`Workspace::with_read_ledger`].
//! `edit_file`, `write_file` and `apply_patch` also take `expect_sha256`, the content a
//! decision approved, and write nothing when the file differs (spec 3.1 §7.26).
//!
//! `bash` runs host-local through [`HostLauncher`] with a cleared environment plus
//! [`DEFAULT_ENV_ALLOWLIST`], so provider API keys in the agent process are not
//! visible to commands. The command reads end of file from standard input, runs in
//! a new session with no controlling terminal, and its process group is killed when
//! the shell exits, so nothing it starts outlives the call. For strong isolation,
//! give [`BashTool::with_launcher`] a [`CommandLauncher`] that wraps the script in a
//! sandbox, or run commands behind a containerized `adk-code` executor (see
//! `docs/design/coding-agent.md`). The policy vocabulary is aligned with
//! `adk-code`'s `SandboxPolicy`.
/// A process a [`CommandLauncher`] started itself in a Job Object, which
/// [`CommandLauncher::spawn_contained`] returns (Windows, spec 3.2 §10 W5).
pub use ContainedChild;
pub use DevToolError;
pub use ;
pub use ;
pub use ;
pub use DevToolset;
pub use ;