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