Skip to main content

zeroclaw_hardware/
catalog.rs

1//! Canonical hardware tool-name and capability catalog.
2//!
3//! Single source of truth for the names the agent sees and the docs render.
4//! `fn name()` impls and the mdBook hardware snippets both read these constants
5//! so a rename lands in one place and the rendered tables follow on the next
6//! docs build. Non-gated so xtask can walk it without the `hardware` feature.
7
8/// Built-in hardware tools always present with the `hardware` feature.
9pub const BASE_TOOLS: &[&str] = &[
10    "gpio_read",
11    "gpio_write",
12    "pico_flash",
13    "device_read_code",
14    "device_write_code",
15    "device_exec",
16];
17
18/// Tools loaded only when at least one Aardvark adapter is present at boot.
19pub const AARDVARK_TOOLS: &[&str] = &[
20    "i2c_scan",
21    "i2c_read",
22    "i2c_write",
23    "spi_transfer",
24    "gpio_aardvark",
25    "datasheet",
26];
27
28/// probe-rs backed introspection tools (in `zeroclaw-tools`).
29pub const PROBE_TOOLS: &[&str] = &[
30    "hardware_board_info",
31    "hardware_memory_map",
32    "hardware_memory_read",
33];
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38
39    #[test]
40    fn base_tool_count_matches_registry_contract() {
41        assert_eq!(BASE_TOOLS.len(), 6);
42    }
43
44    #[test]
45    fn no_duplicate_tool_names_across_sets() {
46        let mut all: Vec<&str> = BASE_TOOLS
47            .iter()
48            .chain(AARDVARK_TOOLS)
49            .chain(PROBE_TOOLS)
50            .copied()
51            .collect();
52        let before = all.len();
53        all.sort_unstable();
54        all.dedup();
55        assert_eq!(all.len(), before, "duplicate tool name across catalog sets");
56    }
57}