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
78
79
//! Code execution tools for ADK agents.
//!
//! This module provides language-preset tool wrappers over the `adk-code` execution
//! substrate. Each tool chooses a default backend and sandbox policy automatically.
//!
//! ## Available Tools
//!
//! - [`RustCodeTool`] — Primary Rust-first code execution tool using [`RustSandboxExecutor`].
//! - [`FrontendCodeTool`] — Placeholder frontend preset for collaborative workspace examples.
//! - [`JavaScriptCodeTool`] — Secondary scripting preset for lightweight transforms.
//! - [`PythonCodeTool`] — Container-backed Python execution preset.
//!
//! ## Scope Model
//!
//! Each tool declares the authorization scopes it requires via
//! [`Tool::required_scopes()`]. When a [`ScopeGuard`](adk_auth::ScopeGuard)
//! is active, the framework checks that the calling user possesses **all**
//! declared scopes before dispatching execution.
//!
//! | Tool | Required Scopes | Rationale |
//! |------|----------------|-----------|
//! | [`RustCodeTool`] | `code:execute`, `code:execute:rust` | Sandboxed Rust execution with strict defaults |
//! | [`JavaScriptCodeTool`] | `code:execute` | In-process embedded JS, no elevated access |
//! | [`PythonCodeTool`] | `code:execute`, `code:execute:container` | Container-backed, elevated mode |
//! | [`FrontendCodeTool`] | `code:execute`, `code:execute:container` | Container-backed, elevated mode |
//!
//! ### Elevated Modes and Confirmation
//!
//! Certain execution modes go beyond the base scope and should be gated by
//! additional scopes and/or the ADK confirmation flow:
//!
//! - **Host execution** (`code:execute:host`): Runs on the local host without
//! container isolation. Confirmation is required unless explicitly disabled
//! by the deployer.
//! - **Container execution** (`code:execute:container`): Spawns an isolated
//! container. Deployers should consider confirmation gating.
//! - **Network access** (`code:network`): Enables outbound network from the
//! execution environment. Confirmation is strongly recommended.
//! - **Writable filesystem** (`code:filesystem:write`): Grants write access
//! beyond the default read-only sandbox. Confirmation is strongly
//! recommended.
//!
//! Generic command execution should **not** silently inherit the trust posture
//! of the Rust sandbox preset.
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use adk_tool::{RustCodeTool, FrontendCodeTool, JavaScriptCodeTool, PythonCodeTool};
//! use std::sync::Arc;
//!
//! // Backend specialist
//! let backend_tool = Arc::new(RustCodeTool::backend());
//!
//! // Frontend specialist (placeholder until container backend ships)
//! let frontend_tool = Arc::new(FrontendCodeTool::react());
//!
//! // Lightweight JS transforms (placeholder until EmbeddedJsExecutor ships)
//! let js_tool = Arc::new(JavaScriptCodeTool::new());
//!
//! // Python execution (placeholder until ContainerCommandExecutor ships)
//! let py_tool = Arc::new(PythonCodeTool::new());
//! ```
pub use FrontendCodeTool;
pub use JavaScriptCodeTool;
pub use PythonCodeTool;
pub use RustCodeTool;
/// Re-export [`adk_code::CodeTool`] as the recommended replacement for
/// the deprecated [`RustCodeTool`].
pub use CodeTool;