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
//! ScriptedTool and the `ToolDef` layer for [bashkit](https://docs.rs/bashkit).
//!
//! Compose [`ToolDef`] + callback pairs into one LLM [`Tool`](bashkit::Tool)
//! that accepts a bash script. Each registered tool becomes a command inside a
//! logic-only shell, so a model can orchestrate many calls in one turn with
//! pipes, variables, loops and `jq`.
//!
//! - [`ScriptedTool`]: the LLM tool. Build with [`ScriptedTool::builder`].
//! - [`ScriptingToolSet`]: ScriptedTool plus optional discovery tool.
//! - [`ToolRegistry`]: one set of tool definitions shared by the shell,
//! embedded Python and embedded TypeScript. Install into any
//! [`BashBuilder`](bashkit::BashBuilder) with [`ToolRegistry::install`].
//! - [`ToolDefExtension`]: the shell surface alone, as a bashkit
//! [`Extension`](bashkit::Extension).
//!
//! ```rust
//! use bashkit::Tool;
//! use bashkit_scripted_tool::{ScriptedTool, ToolArgs, ToolDef};
//!
//! # tokio_test::block_on(async {
//! let tool = ScriptedTool::builder("api")
//! .tool_fn(
//! ToolDef::new("greet", "Greet a user"),
//! |args: &ToolArgs| Ok(format!("hello {}\n", args.param_str("name").unwrap_or("world"))),
//! )
//! .build();
//! let output = tool
//! .execution(serde_json::json!({"commands": "greet --name Alice"}))
//! .unwrap()
//! .execute()
//! .await
//! .unwrap();
//! assert_eq!(output.result["stdout"], "hello Alice\n");
//! # });
//! ```
//!
//! Moved out of the `bashkit` crate (formerly feature `scripted_tool`). See
//! `docs/migrating-scripted-tool.md` in the repository for the migration.
pub use ;
pub use ;