Skip to main content

lash_tools/
lib.rs

1//! Built-in tool suite for the lash agent runtime.
2//!
3//! Each module is a self-contained tool family sharing the
4//! [`lash_tool_support`] utility layer:
5//!
6//! - [`apply_patch`] — `files.patch` envelope-diff editing
7//! - [`files`] — `files.read` / `files.glob`
8//! - [`shell`] — `shell.exec` / `shell.start` / `shell.write`
9//! - [`web`] — `web.fetch` / `web.search`
10//!
11//! CLI-owned local grep lives in the separate `lash-search-tools` crate so
12//! non-CLI hosts do not inherit the fff-search build dependency.
13
14pub mod apply_patch;
15pub mod files;
16pub mod shell;
17pub mod web;
18
19#[cfg(test)]
20mod tests {
21    use lash_core::ToolProvider;
22
23    fn all_manifests() -> Vec<lash_core::ToolManifest> {
24        let mut manifests = Vec::new();
25        manifests.extend(crate::apply_patch::apply_patch_provider().tool_manifests());
26        manifests.extend(crate::files::read_file_provider().tool_manifests());
27        manifests.extend(crate::files::glob_provider().tool_manifests());
28        manifests.extend(
29            crate::shell::shell_provider(crate::shell::StandardShell::new()).tool_manifests(),
30        );
31        manifests.extend(crate::web::fetch_url_provider("").tool_manifests());
32        manifests.extend(crate::web::web_search_provider("").tool_manifests());
33        manifests
34    }
35
36    #[cfg(not(feature = "lashlang"))]
37    #[test]
38    fn default_manifests_do_not_include_lashlang_bindings() {
39        for manifest in all_manifests() {
40            assert!(
41                manifest.bindings.is_empty(),
42                "{} unexpectedly had bindings: {:?}",
43                manifest.name,
44                manifest.bindings
45            );
46        }
47    }
48
49    #[cfg(feature = "lashlang")]
50    #[test]
51    fn lashlang_manifests_include_lashlang_bindings() {
52        for manifest in all_manifests() {
53            assert!(
54                manifest
55                    .bindings
56                    .contains_key(lash_lashlang_runtime::LASHLANG_TOOL_BINDING_KEY),
57                "{} did not include a lashlang binding",
58                manifest.name
59            );
60        }
61    }
62}