text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>//! Native macOS permission checks via FFI. //! //! Each function returns one of: `"granted"`,<|fim_suffix|>", script]).output(); match output { Ok(out) => { let s = String::from_utf8_lossy(&out.stdout).trim().to_string(); match s.as_str() { "3" => "gran...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! ZeroClaw Desktop — main entry point. //! //! Prevents an additional console <|fim_suffix|>indow on Windows in release. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { zeroclaw_desktop::run(); } <|fim_middle|>w<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Mobile entry point for ZeroClaw Desktop (i<|fim_suffix|>ntry_point] fn main() { zeroclaw_desktop::run(); } <|fim_middle|>OS/Android). #[tauri::mobile_e<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>t!(Arc::ptr_eq(&s1, &s2)); } #[tokio::test] async fn shared_state_concurrent_read_write() { let state = shared_state(); // Write from one handle. { let mut s = state.write().await; s.connected = true; s.agent_status = AgentStatus::W...
fim
zeroclaw-labs/zeroclaw
rust
//! Tray menu event handling. use tauri::{AppHandle, Manager, Runtime, menu::MenuEvent}; pub fn handle_menu_event<R: Runtime>(app: &AppHandle<R>, event: MenuEvent) { match event.id().as_ref() { "show" => show_main_window(app, None), "chat" => show_main_window(app, Some("/agent")), "quit" =...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Tray icon management — swap icon based on connection/agent status. use crate::state::AgentStatus; use tauri::image::Image; /// Embedded tray icon PNGs (22x22, RGBA). const ICON_IDLE: &[u8] = include_bytes!("../../icons/tray-idle.png"); const ICON_WORKING: &[u8] = include_bytes!("../../icons/tray-wor...
fim
zeroclaw-labs/zeroclaw
rust
//! Tray menu construction. use tauri::{ App, Runtime, menu::{Menu, MenuItemBuilder, PredefinedMenuItem}, }; pub fn create_tray_menu<R: Runtime>(app: &App<R>) -> Result<Menu<R>, tauri::Error> { let show = MenuItemBuilder::with_id("show", "Show Dashboard").build(app)?; let chat = MenuItemBuilder::with_...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>le_menu_event) .on_tray_icon_event(|tray, event| { if let TrayIconEvent::Click { button, .. } = event && button == tauri::tray::MouseButton::Left { let app = tray.app_handle(); if let Some(window) = app.get_webview_window("mai...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Windows-specific integrations. #[cfg(target_os = "windows")<|fim_suffix|>ons; <|fim_middle|>] pub mod permissi<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Windows permission probes. //! //! We surface privacy state from CapabilityAccessManager and admin status for //! input monitoring style hooks. use std::process::Command; use std::sync::{Mutex, OnceLock}; use std::time::{Duration, Instant}; #[derive(Clone)] struct WindowsPrivacySnapshot { microp...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ring, { let Some(v) = tui.and_then(|roles| roles.get(key)).and_then(Value::as_str) else { return fallback(); }; rgb_literal(v).unwrap_or_else(|| panic!("theme {id} tui.{key} = {v:?} is not #rrggbb")) } /// Convert a `#rrggbb` hex string to a `Color::Rgb(r, g, b)` literal. Returns /// ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use std::sync::Arc; use crossterm::event::{KeyEvent, MouseEvent}; use ratatui::layout::Rect; use crate::chat; use crate::client::RpcClient; /// ACP pane — displayed as "Code" in the UI; internal name kept for historical reasons. pub(crate) struct Acp { inner: chat::Chat, } impl Acp { pub(crate...
fim
zeroclaw-labs/zeroclaw
rust
use std::sync::Arc; use std::sync::Mutex; use std::time::Duration; use anyhow::Result; use crossterm::event::{self, Event, KeyEventKind, MouseEventKind}; use ratatui::{ layout::{Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, text::{Line, Span}, widgets::{Block, Borders, Clear, P...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Client-side file attachment preparation. //! //! Validates files, detects MIME types, and builds `FileEntry` JSON //! values for the `session/prompt` RPC call. Transport-aware: sends //! `path` over Unix sockets, `data_b64` over WSS. //! //! Shared between Chat and ACP panes. use std::path::PathBuf; ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> method::LOCALES_FETCH, serde_json::json!({ "locale": locale, "catalog": catalog }), ) .await } pub async fn config_sections(&self) -> Result<Vec<ConfigSectionEntry>> { let result: ConfigSectionsResult = self .call(method::CONFIG_SECTIONS...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>_like_file_path("/tmp/test")); } #[test] fn looks_like_path_rejects() { assert!(!looks_like_file_path("")); assert!(!looks_like_file_path("hello world")); assert!(!looks_like_file_path("relative/path.txt")); assert!(!looks_like_file_path("/path/one\n/path/two")...
fim
zeroclaw-labs/zeroclaw
rust
//! Terminal colour-depth detection and RGB down-conversion. //! //! ratatui emits `Color::Rgb` as 24-bit `\e[38;2;…m` SGR sequences //! unconditionally. Terminals that cap at 256 colours (older macOS //! Terminal.app, and tmux/screen advertising `screen-256color`) either //! ignore or mangle those sequences, producing...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>m", KeyPreset { build: vim_rows }), ("emacs", KeyPreset { build: emacs_rows }), ( "arrows_only", KeyPreset { build: arrows_only_rows, }, ), ]; pub fn preset_names() -> impl Iterator<Item = &'static str> { KEY_PRESETS.iter().map(|(n, _)| *n) } pub fn pr...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>t("serializing config for set_prop")?; let segments: Vec<&str> = path.split('.').collect(); let (leaf, parents) = segments .split_last() .ok_or_else(|| anyhow::Error::msg("empty config path"))?; let mut cursor = &mut root; for seg in parents { cursor = cursor ...
fim
zeroclaw-labs/zeroclaw
rust
use std::time::Instant; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind}; use ratatui::{ layout::{Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, text::{Line, Span}, widgets::{Block, Borders, List, ListItem, ListState, Paragraph, Wrap}, }; use ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use inkjet::constants::HIGHLIGHT_NAMES; use inkjet::tree_sitter_highlight::HighlightEvent; use inkjet::{Highlighter, Language}; use ratatui::style::{Color, Modifier, Style}; use ratatui::text::{Line, Span}; use similar::{ChangeTag, TextDiff}; // Diff background / foreground palette const ADD_BG: Color = ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> constructor's `load_entries()` will issue an `fs/list_dir` RPC // request. Read it from the channel and reply with a fake listing. let line = rx .recv() .await .expect("expected an RPC request from load_entries"); let req: serde_json::Value = ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use fluent::{FluentArgs, FluentBundle, FluentResource}; use std::collections::{HashMap, HashSet}; use std::path::PathBuf; use std::sync::{Mutex, OnceLock}; use unic_langid::LanguageIdentifier; static STRINGS: OnceLock<HashMap<String, String>> = OnceLock::new(); static FTL_SOURCES: OnceLock<FtlSources> = ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>0), (1, 2)); } #[test] fn visual_to_cursor_basic() { assert_eq!(visual_to_cursor("hello", 0, 0, 10), 0); assert_eq!(visual_to_cursor("hello", 0, 3, 10), 3); assert_eq!(visual_to_cursor("hello", 0, 5, 10), 5); } #[test] fn visual_to_cursor_wrap() { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>n notify(&self, method: &'static str, params: Value) { let n = JsonRpcNotification::new(method, params); if let Ok(s) = serde_json::to_string(&n) { let _ = self.writer_tx.send(s).await; } } pub async fn request( &self, method: &str, para...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>on", AttachClipboard [] => "attach clipboard", } } keyactions! { pub enum ModalAction ("modal") { Confirm [Chord::key(KeyCode::Enter), Chord::char('y'), Chord::char('Y')] => "confirm", Cancel [Chord::key(KeyCode::Esc), Chord::char('n'), Chord::char('N')] => "cancel", ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> // A user who hand-bound `shift+?` as a workaround keeps working: // SHIFT is redundant on a char key, so it's stripped from both // sides of the comparison. let chord = Chord::with(KeyCode::Char('?'), KeyModifiers::SHIFT); let event = KeyEvent::new(KeyCode::Char('?'), ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Keymap abstraction for zerocode. //! //! Each leaf action enum carries its own default bindings inline.<|fim_suffix|> rejection. pub fn reserved_reason(chord: &Chord) -> Option<&'static str> { reserved_chords() .iter() .find_map(|(c, reason)| (c == chord).then_some(*reason)) } pub...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Runtime keybinding overrides. //! //! A single process-global table, keyed by each action enum's `TAG`, //! mapping a variant's snake_case name to its overridden chords. Read //! only inside the generated `resolved_bindings()`, so every consumer's //! `from_ch<|fim_suffix|>s-wide `ACTIVE` table; seria...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>/input primitives; consumers of the binary itself should //! depend on `apps/zerocode/src/main.rs` directly. //! //! Also exposes the JSON-RPC transport + wire-shape mirrors the TUI //! uses internally — exposed publicly only so the wire-drift //! integration test can reach them. // Bare `tokio::spawn` i...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use std::collections::BTreeMap; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseEvent, MouseEventKind}; use ratatui::{ layout::{Constraint, Direction, Layout, Rect}, style::{Color, Modifier, Style}, text::{Line, Span}, widgets::{Block, Borders, List, ListItem, ListState, Para...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>// `apps/zerocode` is a standalone TUI client, not daemon-path code. // It speaks JSON-RPC to whatever ZeroClaw daemon is at the configured // address; the daemon owns attribution, the TUI owns its session id. // Bare `tokio::spawn` is the right primitive here — the workspace-wide // `zeroclaw_spawn::spaw...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Reusable mouse interaction helpers for the TUI. //! //! Pure geometry + timing utilities. No pane-specific logic lives here. use std::io::Write; use std::time::Instant; use ratatui::layout::Rect; // ── Hit testing ────────────────────────────────────────────────── /// Check whether `(col, row)` is...
fim
zeroclaw-labs/zeroclaw
rust
//! ZeroClaw TUI colour palette and style helpers. //! //! Shared between the onboarding UI (lib target) and the main chat TUI (binary //! target). Not every helper is used by both targets. #![allow(dead_code)] use std::sync::{LazyLock, RwLock}; use ratatui::style::{Color, Modifier, Style}; #[derive(Debug, Clone, Co...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>!(TurnStatus::Idle.label(now), " > "); } #[test] fn approval_label_has_no_dots() { // No dots even as time passes — it's a static "blocked" state. let past = Instant::now() - Duration::from_secs(5); assert_eq!( TurnStatus::WaitingForApproval.label(past), ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#![allow(dead_code)] /// A single help entry: one or more keys that trigger the same action. /// /// The renderer joins keys with " / " so you don't have to format manually. /// An entry with all-empty keys/action renders as a blank spacer row. /// /// Keys are owned `String`s so callers can pass live ch...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Hand-maintained mirrors for every type that crosses the JSON-RPC //! wire between `zerocode` and the ZeroClaw daemon. //! //! These mirrors exist so `apps/zerocode/Cargo.toml` carries zero //! workspace dependencies in `[dependencies]`. The TUI talks JSON-RPC //! to whatever daemon is at the configure...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>.tls.skip_verify_routes.join("\n"), ConnField::SkipVerify => String::new(), }; self.conn_edit = Some(ConnEdit { field, buf }); } fn persist_conn_field(&mut self, field: ConnField) { let value = match field { ConnField::Uri => toml::Value::String(sel...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Performance benchmarks for ZeroClaw hot paths. //! //! Benchmarks cover: //! - Tool dispatch (XML parsing, native parsing) //! - Memory store/recall cycles (SQLite backend) //! - Agent turn cycle (full orchestration loop) //! //! Run: `cargo bench` //! //! Ref: <https://github.com/zeroclaw-labs/...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>; } <|fim_prefix|>fn main() { println!("cargo:rerun-if-cha<|fim_middle|>nged=build.rs")<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>able: // // println!("cargo:rustc-link-search=native=crates/aardvark-sys/vendor"); // println!("cargo:rustc-link-lib=dylib=aardvark"); // println!("cargo:rerun-if-changed=vendor/aardvark.h"); // // let bindings = bindgen::Builder::default() // .header("vendor/aard...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>d. pub fn find_devices() -> Vec<u16> { let Some(lib) = lib() else { eprintln!("[aardvark-sys] find_devices: library not loaded"); return Vec::new(); }; let mut ports = [0u16; 16]; let n: i32 = unsafe { let f: std::result::Result<Symbo...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>whisper_model: "base".to_string(), whisper_path: PathBuf::from("/usr/local/bin/whisper-cpp"), piper_path: PathBuf::from("/usr/local/bin/piper"), piper_voice: "en_US-lessac-medium".to_string(), }, sensors: SensorConfig { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> let degrees = args["distance"].as_f64().unwrap_or(90.0); let radians = degrees.to_radians(); let duration = (radians / max_rotation * 1000.0) as u64; ( 0.0, 0.0, -max_rotation, ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Emote Tool - LED expressions and sound effects //! //! Control LED matrix/strips for robot "expressions" and play sounds. //! Makes the robot more engaging for kids! use crate::config::RobotConfig; use crate::traits::{Tool, ToolResult}; use anyhow::Result; use async_trait::async_trait; use serde_json...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! # ZeroClaw Robot Kit //! //! A standalone robotics toolkit that integrates with ZeroClaw for AI-powered robots. //! //! ## Features //! //! - **Drive**: Omni-directional motor control (ROS2, serial, GPIO, mock) //! - **Look**: Camera capture + vision model description (Ollama) //! - **Listen**: Speech...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> tokio::process::Command::new(whisper_path) .args([ "-m", model_path.to_str().unwrap(), "-f", audio_path.to_str().unwrap(), "--no-timestamps", "-otxt", // Output as text ]) ....
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> .unwrap_or("Describe what you see in this image. Be specific about people, objects, and the environment."); match self.describe_image(&image_path, prompt).await { Ok(description) => Ok(ToolResult { success: true, output:...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Safety System - Collision avoidance, watchdogs, and emergency stops //! //! This module runs INDEPENDENTLY of the AI brain to ensure safety //! even if the LLM makes bad decisions or hangs. //! //! ## Safety Layers //! //! 1. **Pre-move checks** - Verify <|fim_suffix|>E-stop self.state.can...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> if scan.forward_clear { "CLEAR" } else { "BLOCKED" }, if motion.detected { format!("DETECTED ({:?})", motion.sensors_triggered) } else { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Speak Tool - Text-to-speech via Piper //! //! Converts text to speech using Piper TTS (fast, offline, runs on Pi). //! Plays audio through the speaker. use crate::config::RobotConfig; use crate::traits::{Tool, ToolResult}; use anyhow::Result; use async_trait::async_trait; use serde_json::{Value, json...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>sync fn safety_movement_request_denied_close() { let config = test_safety_config(); let (monitor, _rx) = SafetyMonitor::new(config); // Close obstacle monitor.update_obstacle_distance(0.2, 0).await; let result = monitor.request_movement("forward", 1.0).await; ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Tool trait definition //! //! This defines the interface that all robot tools implement. //! It is compatible with ZeroClaw's Tool trait but standalone. use async_trait::async_trait; use serde::{Deserialize, Serialize}; use serde_json::Value; /// Result of a tool execution #[derive(Debug, Clone, Ser...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>/// Streaming events emitted during an agent turn. /// /// Used by the gateway WebSocket handler to relay real-time updates to clients. /// Consumers that pattern-match on [`TurnEvent::ToolCall`] or /// [`TurnEvent::ToolResult`] should preserve the stable `id` field for /// call/result correlation. #[deri...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>nthropic)).composite_prefix(), Some("model_provider"), ); assert!(Role::Agent.composite_prefix().is_none()); } #[test] fn role_attribution_field() { assert_eq!(Role::Agent.attribution_field(), Some("agent_alias")); assert_eq!( Role::Tool...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde::{Deserialize, Serialize}; use tokio_util::sync::CancellationToken; use crate::media::MediaAttachment; // ── Channel approval types ────────────────────────────────────── /// Compact description of a tool call presented to the user for approval. #[derive(Debug, C...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::Value; use std::time::Duration; use crate::channel::ChannelMessage; use crate::model_provider::{ChatMessage, ChatResponse}; use crate::tool::ToolResult; /// Result of a modifying hook — continue with (possibly modified) data, or cancel. #[derive(Debug, Clone...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Shared JSON-RPC 2.0 types for the ACP server and runtime RPC layer. //! //! Extracted from `zeroclaw-channels::orchestrator::acp_server` so both the //! ACP stdio channel and the Unix socket RPC transport can share the same //! wire types without cross-crate dependency. use serde::{Deserialize, Seria...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>} <|fim_prefix|>//! ZeroClaw API layer — trait definitions and shared types. //! //! This crate defines the fundamental abstractions that all ZeroClaw subsystems //! depend on. No implementations, no heavy dependencies. Every other crate in //! the workspace depends on this. The compiler enforces that no ...
fim
zeroclaw-labs/zeroclaw
rust
/// Classifies an attachment by MIME type or file extension. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum MediaKind { Audio, Image, Video, Unknown, } /// A single media attachment on an inbound message. #[derive(Debug, Clone)] pub struct MediaAttachment { /// Original file name (e.g. `voic...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde::{Deserialize, Serialize}; /// Filter criteria for bulk memory export (GDPR Art. 20 data portability). #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct ExportFilter { pub namespace: Option<String>, pub session_id: Option<String>, pub ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use crate::tool::ToolSpec; use async_trait::async_trait; use futures_util::{StreamExt, stream}; use serde::{Deserialize, Serialize}; use std::fmt::Write; use std::sync::Arc; pub const MAX_BUDGET_TOKENS: u32 = 128_000; /// Anthropic's documented minimum for extended-thinking `budget_tokens`. /// Requests ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use std::time::Duration; /// Token usage breakdown for a single agent turn. #[derive(Debug, Clone, serde::Serialize)] pub struct TurnTokenUsage { pub input_tokens: u64, pub output_tokens: u64, } /// Discrete events emitted by the agent runtime for observability. /// /// Each variant represents a...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Peripheral trait — hardware boards (STM32, RPi GPIO) that expose tools. //! //! Peripherals are the agent's "arms and legs": remote devices that run minimal //! firmware and expo<|fim_suffix|>s peripheral. /// /// Should uniquely identify a specific device instance, including an index /// ...
fim
zeroclaw-labs/zeroclaw
rust
use std::path::{Path, PathBuf}; /// Runtime adapter that abstracts platform differences for the agent. /// /// Implement this trait to port the agent to a new execution environment. /// The adapter declares platform capabilities (shell access, filesystem, /// long-running processes) and provides platform-specific impl...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> assert!(enum_values.contains(&json!("user"))); assert!(enum_values.contains(&json!("guest"))); } #[test] fn test_strip_null_from_union() { let schema = json!({ "oneOf": [ { "type": "string" }, { "type": "null" } ] ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> as alphanumeric. assert_eq!(sanitize_session_key("user_Алиса"), "user_Алиса"); } } <|fim_prefix|>//! Session key normalization shared across infra and memory backends. //! //! Channel orchestration uses two identifiers derived from a `ChannelMessage`: //! one ends up as a JSONL filename (via ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> parameters: self.parameters_schema(), } } } #[cfg(test)] mod tests { use super::*; #[test] fn ephemeral_warning_names_cause_and_fix() { assert!(EPHEMERAL_WORKSPACE_WARNING.contains("EPHEMERAL WORKSPACE")); assert!(EPHEMERAL_WORKSPACE_WARNING.contains("tmpfs")); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Voice Activity Detection trait and event types. /// Result of processing a chunk of audio samples through a VAD. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum VadEvent { /// No speech detected; continue listening. Silence, /// Speech has just started. SpeechStart, /// Spee...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>wrap().unwrap(); assert_eq!(result, Some("Option B".to_string())); } #[tokio::test] async fn request_choice_handles_cancel_outcome() { let (rpc, mut rx) = make_rpc(); let rpc_for_resp = Arc::clone(&rpc); let ch = AcpChannel::new("acp", "sess-1", Arc::clone(&rpc...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Shared `allowed_users` matching used by every chat channel. //! //! Each channel (Slack, Discord, IRC, Telegram, Matrix, …) carries an //! `allowed_users: Vec<String>` allowlist with the same semantics: //! //! - `["*"]` (or any list containing `"*"`) means "anyone". //! - Empty list means "deny every...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> let cert_chain = match &self.ca_cert { Some(path) => Some(std::fs::read_to_string(path)?), None => None, }; let identity = self.build_client_identity()?; Connection::connect_with_config( &self.amqp_url, props, O...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::{Result, bail}; use async_trait::async_trait; use parking_lot::Mutex; use serde::{Deserialize, Serialize}; use std::time::{Duration, Instant}; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; /// Bluesky channel — polls for mentions via AT Protocol and replies as posts. pub ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> let response = self .client .get(format!("{}/phone_numbers", Self::TELNYX_API_URL)) .header("Authorization", format!("Bearer {}", self.api_key)) .send() .await; match response { Ok(resp) => resp.status().is_success(), ...
fim
zeroclaw-labs/zeroclaw
rust
use async_trait::async_trait; use tokio::io::{self, AsyncBufReadExt, BufReader}; use uuid::Uuid; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; /// CLI channel — stdin/stdout, always available, zero deps pub struct CliChannel { alias: String, } impl CliChannel { pub fn new(alias: impl Into...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use futures_util::{SinkExt, StreamExt}; use std::collections::HashMap; use std::sync::Arc; use tokio::sync::RwLock; use tokio_tungstenite::tungstenite::Message; use uuid::Uuid; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; const DINGTALK_BOT_CALLBACK_TOP...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>string(), smtp_username: Some(" ".to_string()), smtp_password: Some("".to_string()), ..Default::default() }; let channel = EmailChannel::new(config, "email_test_alias", empty_resolver()); let creds = channel.smtp_credentials(); let expe...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Gmail Pub/Sub push notification channel. //! //! Instead of polling via IMAP, this channel uses Google's Gmail Pub/Sub push //! notifications. Google sends a POST to our webhook endpoint whenever the //! user's mailbox changes. The notification body contains a base64-encoded //! JSON payload with `e...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use directories::UserDirs; use rusqlite::{Connection, OpenFlags}; use std::sync::Arc; use tokio::sync::mpsc; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; /// Extract plain text from an iMessage `attributedBody` typedstream blob. /// /// Modern macOS (Ve...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>types::CertificateDer<'_>, _dss: &rustls::DigitallySignedStruct, ) -> Result<rustls::client::danger::HandshakeSignatureValid, rustls::Error> { Ok(rustls::client::danger::HandshakeSignatureValid::assertion()) } fn supported_verify_schemes(&self) -> Vec<rustls::SignatureScheme> ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ub mod link_enricher; pub mod transcription; pub mod tts; // Feature-gated channels #[cfg(feature = "channel-amqp")] pub mod amqp; #[cfg(feature = "channel-bluesky")] pub mod bluesky; #[cfg(feature = "channel-clawdtalk")] pub mod clawdtalk; #[cfg(feature = "channel-dingtalk")] pub mod dingtalk; #[cfg(fea...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64}; use hmac::{Hmac, Mac}; use parking_lot::RwLock; use sha2::Sha256; use std::collections::HashMap; use std::sync::Arc; use uuid::Uuid; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; use ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Link enricher: auto-detects URLs in inbound messages, fetches their content, //! and prepends summaries so the agent has link context without explicit tool calls. use regex::Regex; use std::net::IpAddr; use std::sync::LazyLock; use std::time::Duration; /// Configuration for the link enricher pipelin...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> "handle": "1234567890", "is_me": false }, "chat": { "id": "chat-789" }, "parts": [{ "type": "text", "value": "Hi" }] } }); let msgs = ch.parse_webhook_payload(&payload); assert_eq!(msgs.len(), 1)...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>iled_channels_match_expected_schema_names() { let cfg = ChannelsConfig::default(); let actual: BTreeSet<_> = compiled_channels(&cfg) .into_iter() .map(|info| info.name) .collect(); let expected: BTreeSet<_> = CHANNEL_COMPILE_SPECS .it...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::{Context, Result, bail}; use async_trait::async_trait; use parking_lot::Mutex; use std::collections::{HashMap, HashSet}; use std::sync::Arc; use std::time::{Duration, Instant}; use tokio::sync::OnceCell; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; const MAX_MATTERMOST_A...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>hannel::new( "https://mochat.example.com/".into(), "tok".into(), "mochat_test_alias", Arc::new(Vec::new), 5, ); assert_eq!(ch.api_url, "https://mochat.example.com"); } #[test] fn test_user_allowed_wildcard() { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>e rate-limit always fires immediately. let channel = NextcloudTalkChannel::new( "https://cloud.example.com".into(), "app-token".into(), "zeroclaw".into(), "nextcloud_talk_test_alias", Arc::new(|| vec!["user_a".into()]), ) ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> .with_attrs( ::serde_json::json!({"error": format!("{}", e)}) ), "Failed to unwrap NIP-17 gift wrap" ); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::{Result, bail}; use async_trait::async_trait; use std::collections::HashSet; use std::sync::Arc; use tokio::sync::RwLock; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; const NOTION_API_BASE: &str = "https://api.notion.com/v1"; const NOTION_VERSION: &str = "2022-06-28"; co...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Automatic media understanding pipeline for inbound channel messages. //! //! Pre-processes media attachments (audio, images, video) before the agent sees //! the message, enriching the text with human-readable annotations: //! //! - **Audio**: transcribed via the existing [`super::transcription`] infr...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! MQTT → SOP event fan-in listener. //! //! This is NOT a `Channel` trait implementor — it routes MQTT messages //! to the SOP engine via `dispatch_sop_event`, not to the chat loop. use std::sync::{Arc, Mutex}; use anyhow::Result; use rumqttc::{AsyncClient, Event, MqttOptions, Packet, QoS, Transport};...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>fn listen(&self, _tx: tokio::sync::mpsc::Sender<ChannelMessage>) -> Result<()> { Ok(()) } } /// A slow inner send must not let a second concurrent send to the same /// recipient take a second immediate path. The `in_flight` marker forces /// the racing send to enqueue,...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use base64::Engine as _; use futures_util::{SinkExt, StreamExt}; use serde::Deserialize; use serde_json::json; use sha2::{Digest, Sha256}; use std::collections::{HashMap, HashSet}; use std::path::{Path, PathBuf}; use std::sync::Arc; use tokio::sync::RwLock; use tokio_tungsten...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> .iter() .map(|s| format!("r/{s}")) .collect::<Vec<_>>() .join(", ") ) }; ::zeroclaw_log::record!( INFO, ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>opaque: {}", msg.id ); // Privacy regression: the routing identity must not appear in the // generic message id, which flows into logs, memory keys, and the // LLM-facing tool context. assert!( !msg.id.contains(uuid), "UUID sender...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>anscription routes through // `TranscriptionManager` whose resolved alias comes from the per-agent // `transcription_provider` field (`agent.<X>.transcription_provider`). impl ::zeroclaw_api::attribution::Attributable for GroqProvider { fn role(&self) -> ::zeroclaw_api::attribution::Role { ::...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Multi-provider Text-to-Speech (TTS) subsystem. //! //! Supports OpenAI, ElevenLabs, Google Cloud TTS, Edge TTS (free, subprocess-based), //! and Piper TTS (local GPU-accelerated, OpenAI-compatible endpoint). //! //! per-instance configs live under `[tts_providers.<type>.<alias>]`; agents //! pick whic...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ch_channel(" ").is_none()); assert!(normalize_twitch_channel("#").is_none()); } } <|fim_prefix|>//! Twitch chat channel — thin adapter over the IRC channel. //! //! Twitch chat speaks IRC: `irc.chat.twitch.tv:6697` over TLS, with the //! OAuth token sent as `PASS oauth:{token}`. The adapter ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::collections::HashSet; use std::sync::Arc; use tokio::sync::RwLock; use uuid::Uuid; use zeroclaw_api::channel::{Channel, ChannelMessage, SendMessage}; const TWITTER_API_BASE: &str = "https://api.x.com/2"; /// X/Twitter channel — uses the Twitte...
fim
zeroclaw-labs/zeroclaw
rust