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.ls` / `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::ls_provider().tool_manifests());
28        manifests.extend(crate::files::glob_provider().tool_manifests());
29        manifests.extend(
30            crate::shell::shell_provider(crate::shell::StandardShell::new()).tool_manifests(),
31        );
32        manifests.extend(crate::web::fetch_url_provider("").tool_manifests());
33        manifests.extend(crate::web::web_search_provider("").tool_manifests());
34        manifests
35    }
36
37    #[cfg(not(feature = "lashlang"))]
38    #[test]
39    fn default_manifests_do_not_include_lashlang_bindings() {
40        for manifest in all_manifests() {
41            assert!(
42                manifest.bindings.is_empty(),
43                "{} unexpectedly had bindings: {:?}",
44                manifest.name,
45                manifest.bindings
46            );
47        }
48    }
49
50    #[cfg(feature = "lashlang")]
51    #[test]
52    fn lashlang_manifests_include_lashlang_bindings() {
53        for manifest in all_manifests() {
54            assert!(
55                manifest
56                    .bindings
57                    .contains_key(lash_lashlang_runtime::LASHLANG_TOOL_BINDING_KEY),
58                "{} did not include a lashlang binding",
59                manifest.name
60            );
61        }
62    }
63}