text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>use async_trait::async_trait; use<|fim_suffix|>ped on timeout, // preventing zombie processes. let timeout = Duration::from_secs(self.config.timeout_secs); cmd.kill_on_drop(true); let result = tokio::time::timeout(timeout, cmd.output()).await; match result { ...
fim
zeroclaw-labs/zeroclaw
rust
// Composio Tool ModelProvider — optional managed tool surface with 1000+ OAuth integrations. // // When enabled, ZeroClaw can execute actions on Gmail, Notion, GitHub, Slack, etc. // through Composio's API without storing raw OAuth tokens locally. // // This is opt-in. Users who prefer sovereign/local-only mode skip t...
fim
zeroclaw-labs/zeroclaw
rust
use async_trait::async_trait; use serde_json::json; use std::process::Stdio; use std::sync::{Arc, OnceLock}; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; const MAX_RESULTS: usize = 1000; const MAX_OUTPUT_BYTES: usize = 1_048_576; // 1 MB const TIMEOUT_SECS: u64 = 30; /// Se...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>await? { let path = entry.path(); if path.is_dir() { count += Box::pin(count_files_older_than(&path, cutoff_epoch)).await?; } else if let Ok(meta) = fs::metadata(&path).await { let modified = meta.modified().unwrap_or(std::time::SystemTime::UNIX_EPOCH); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::fmt::Write; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_memory::Memory; /// Search Discord message history stored in discord.db. pub struct DiscordSearchTool { discord_memory: Arc<dyn Memory>, } impl Discor...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>map_err(|(e, _)| anyhow::Error::msg(format!("XOAUTH2 auth failed: {}", e))) } else { client .login(&cfg.username, &cfg.password) .await .map_err(|(e, _)| anyhow::Error::msg(format!("IMAP login failed: {}", e))) } } <|fim_prefix|>/// Shared IMAP connectio...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; use futures_util::TryStreamExt; use mail_parser::{MessageParser, MimeHeaders}; use zeroclaw_api::attribution::ToolKind; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::scattered_types::EmailConfig; use crat...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; use futures_util::TryStreamExt; use mail_parser::MessageParser; use zeroclaw_api::attribution::ToolKind; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::scattered_types::EmailConfig; use crate::email_imap::...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Human escalation tool with urgency-aware routing. //! //! Exposes `escalate_to_human` as an agent-callable tool that sends a structured //! escalation message to a messaging channel. High/critical urgency escalations //! additionally notify any channels listed in `[escalation] alert_channels`. //! Sup...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>eTemplate::new(200).set_body_bytes(b"redirected-bytes".to_vec())) .expect(0) .mount(&server) .await; let config = FileDownloadConfig { url: Some(format!("{}/download", server.uri())), ..FileDownloadConfig::default() }; le...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ed.contains(&json!("path"))); assert!(required.contains(&json!("old_string"))); assert!(required.contains(&json!("new_string"))); } #[tokio::test] async fn file_edit_replaces_single_match() { let dir = std::env::temp_dir().join("zeroclaw_test_file_edit_single"); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use futures_util::StreamExt; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::schema::FileUploadConfig; const RESPONSE_BODY_LIMIT_BYTES: usize = 4 * 1024; pub struct FileU...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> // the limit is clipped by read_response_bounded to exactly // `body_limit` bytes. The earlier `raw_body.len() > body_limit` // gate was then false, so the tool returned a clipped body with no // "[truncated]" marker — hiding from the agent that the receiver // body...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; /// Write file contents with path sandboxing pub struct FileWriteTool { security: Arc<SecurityPolicy>, /// Whether writes to the workspa...
fim
zeroclaw-labs/zeroclaw
rust
use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use std::time::Duration; use tokio::process::Command; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::policy::ToolOperation; use zeroclaw_config::schema::GeminiCliConfig; /// Environmen...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>unstaged changes /// and leaves the index intact. This is the fix for the tool's /// "stashes everything indiscriminately" bug. #[tokio::test] async fn stash_push_with_keep_index_preserves_staged() { let tmp = TempDir::new().unwrap(); bootstrap_repo(tmp.path(), &["staged.tx...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; const MAX_RESULTS: usize = 1000; /// Search for files by glob pattern within the workspace. pub struct GlobSearchTool { security: Arc<Secur...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use std::time::Duration; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::schema::GoogleWorkspaceAllowedOperation; /// Default `gws` command execution time before kill (ove...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> success: true, output: info, error: None, }); } Err(e) => { use std::fmt::Write; let _ = write!( output, ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> ); anyhow::Error::msg(format!("probe-rs attach failed: {}", e)) })?; let target = session.target(); let mut out = String::new(); for region in target.memory_map.iter() { match region { MemoryRegion::Ram(ram) => { let start = ram.range.s...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Hardware memory read tool — read actual memory/register values from Nucleo via probe-rs. //! //! Use when user asks to "read register values", "read memory at address", "dump lower memory", etc. //! Requires probe feature and Nucleo connected via USB. use async_trait::async_trait; use serde_json::jso...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use reqwest::header::{AUTHORIZATION, HeaderMap, HeaderName, HeaderValue}; use serde_json::json; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::Arc; use std::time::Duration; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::Securit...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>table) { return locale; } } } "en".to_string() } fn locale_from_table(table: toml::Table) -> Option<String> { let locale = table.get("locale")?.as_str()?.trim(); (!locale.is_empty()).then(|| normalize_locale(locale)) } fn normalize_locale(...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::Context; use async_trait::async_trait; use serde_json::json; use std::path::PathBuf; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult, with_ephemeral_workspace_warning}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::policy::ToolOperation; /// Standalone image ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> let result = tool .execute(json!({"path": png_path.to_string_lossy()})) .await .unwrap(); assert!(result.success); let canonical = tokio::fs::canonicalize(&png_path).await.unwrap(); assert!( result .output ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Knowledge management tool for capturing, searching, and reusing expertise. //! //! Exposes the knowledge graph to the agent via the `Tool` trait with actions: //! capture, search, relate, suggest, expert_find, lessons_extract, graph_stats. use async_trait::async_trait; use serde_json::json; use std::...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>od web_fetch; pub mod web_search_provider_routing; pub mod web_search_tool; pub mod wrappers; /// Canonical names of the long-term-memory tools. This is the single source /// of truth for "which tools touch the persistent memory store" — surfaces /// that need to strip memory access (e.g. ACP/Code sessio...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> async fn create_post_rejects_empty_text() { let tool = make_tool(AutonomyLevel::Full, 100); let result = tool .execute(json!({"action": "create_post", "text": " "})) .await .unwrap(); assert!(!result.success); assert!(result.error....
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::Context; use reqwest::Method; use reqwest::header::{HeaderMap, HeaderValue}; use serde_json::json; use std::path::{Path, PathBuf}; use zeroclaw_config::schema::LinkedInImageConfig; const LINKEDIN_API_BASE: &str = "https://api.linkedin.com"; const LINKEDIN_OAUTH_TOKEN_URL: &str = "https://www....
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ponse, &schema); assert!(result.is_ok()); let parsed: serde_json::Value = serde_json::from_str(&result.unwrap()).unwrap(); assert_eq!(parsed["name"], "Alice"); assert_eq!(parsed["age"], 30); } #[test] fn validate_missing_required_field() { let schema =...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! MCP (Model Context Protocol) client — connects to external tool servers. //! //! Supports multiple transports: stdio (spawn local process), HTTP, and SSE. use std::collections::HashMap; use std::sync::Arc; #[cfg(not(target_has_atomic = "64"))] use std::sync::atomic::AtomicU32; #[cfg(target_has_atomic...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Deferred MCP tool loading — stubs and activated-tool tracking. //! //! When `mcp.deferred_loading` is enabled, MCP tool schemas are NOT eagerly //! included in the LLM context window. Instead, onl<|fim_suffix|>ecs().len(), 1); } #[test] fn activated_set_resolves_unique_suffix() { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>chema":{"type":"object"}}]}"#; let result: McpToolsListResult = serde_json::from_str(json).unwrap(); assert_eq!(result.tools.len(), 2); assert_eq!(result.tools[0].name, "a"); assert_eq!(result.tools[1].name, "b"); assert!(result.tools[1].description.is_some()); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> .await .expect("execute must be non-fatal even with approved field"); // The registry returns a non-fatal error (unknown tool), not a panic/Err. assert!(!result.success); // Crucially: error must not mention `approved` as the cause. let err = result.error.un...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! MCP transport abstraction — supports stdio, SSE, and HTTP transports. use std::borrow::Cow; use anyhow::{Context, Result, bail}; use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; use tokio::process::{Child, Command}; use tokio::sync::{Mutex, Notify, oneshot}; use tokio::time::{Duration, ti...
fim
zeroclaw-labs/zeroclaw
rust
use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_memory::traits::ExportFilter; use zeroclaw_memory::{Memory, MemoryCategory}; /// Bulk-export memories as a JSON array for GDPR Art. 20 data portability. pub struct MemoryExportTool { mem...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::policy::ToolOperation; use zeroclaw_memory::Memory; /// Let the agent forget/delete a memory entry pub struct MemoryForgetT...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>(_tmp, mem) = test_mem(); mem.store_with_metadata("a", "data", MemoryCategory::Core, None, Some("ns1"), None) .await .unwrap(); mem.store_with_metadata("b", "data", MemoryCategory::Core, None, Some("ns2"), None) .await .unwrap(); le...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::fmt::Write; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_memory::Memory; /// Let the agent search its own memory pub struct MemoryRecallTool { memory: Arc<dyn Memory>, } impl MemoryRecallTool { pub fn ne...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, Tool<|fim_suffix|>mory_store" } fn description(&self) -> &str { "Store a fact, preference, or note in long-term memory. Use category 'core' for permanent facts, 'daily' for session notes...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>[ ("client_id", self.config.client_id.as_str()), ("scope", &scope), ]) .send() .await .context("ms365: failed to request device code")?; if !resp.status().is_success() { let status = resp.status(); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use anyhow::Context; const GRAPH_BASE: &str = "https://graph.microsoft.com/v1.0"; /// Build the user path segment: `/me` or `/users/{user_id}`. /// The user_id is percent-encoded to prevent path-traversal attacks. fn user_path(user_id: &str) -> String { if user_id == "me" { "/me".to_string()...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> "description": "Teams team ID (for teams_message_list/send)" }, "channel_id": { "type": "string", "description": "Teams channel ID (for teams_message_list/send)" }, "start": { ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> token_cache_encrypted: false, user_id: "me".into(), }; let json = serde_json::to_string(&config).unwrap(); let parsed: Microsoft365ResolvedConfig = serde_json::from_str(&json).unwrap(); assert_eq!(parsed.tenant_id, "test-tenant"); assert_eq!(parsed.c...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use crate::util_helpers::MaybeSet; use async_trait::async_trait; use serde_json::{Value, json}; use std::collections::BTreeMap; use std::fs; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::schema::{ClassificationRule, Config...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>e", "body"] }), risk_level: RiskLevel::Low, }] } /// All standard node capabilities. pub fn all_standard_capabilities() -> Vec<NodeCapabilityDef> { let mut caps = Vec::new(); caps.extend(camera_capabilities()); caps.extend(screen_capabilities()); caps.extend(location_c...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use serde_json::json; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::{SecurityPolicy, ToolOperation}; const NOTION_API_BASE: &str = "https://api.notion.com/v1"; const NOTION_VERSION: &str = "2022-06-28"; const NOTION_REQUEST_TIME...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> success: false, output: String::new(), error: Some(error), }); } // Extract prompt (required) let prompt = args.get("prompt").and_then(|v| v.as_str()).ok_or_else(|| { ::zeroclaw_log::record!( WARN, ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>b.pdf"})).await.unwrap(); assert!(!r2.success); assert!( r2.error .as_deref() .unwrap_or("") .contains("Failed to resolve") ); // Budget must now be exhausted. assert!( !security.record_action(...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>// Pipeline tool: collapses multi-step tool chains into a single inference call. // // The agent invokes `execute_pipeline` with a JSON payload describing steps, // and this tool executes them sequentially (or in parallel) with result // interpolation between steps. use anyhow::Result; use async_trait::a...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use async_trait::async_trait; use parking_lot::RwLock; use serde_json::json; use std::collections::HashMap; use std::sync::Arc; use zeroclaw_api::channel::{Channel, SendMessage}; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::policy::ToolOpera...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ult> { let deadlines = args .get("deadlines") .and_then(|v| v.as_str()) .unwrap_or_default(); let velocity = args .get("velocity") .and_then(|v| v.as_str()) .unwrap_or_default(); let blockers = args ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use crate::util_helpers::MaybeSet; use async_trait::async_trait; use serde_json::{Value, json}; use std::fs; use std::sync::Arc; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::schema::{ Config, ProxyConfig, ProxyScope, runtime_proxy_config...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> assert!(result.is_err()); } #[tokio::test] async fn credentials_ignore_comments() { let tmp = TempDir::new().unwrap(); let env_path = tmp.path().join(".env"); fs::write(&env_path, "# This is a comment\nPUSHOVER_TOKEN=realtoken\n# Another comment\nPUSHOVER_USER_KEY=rea...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Emoji reaction tool for cross-channel message reactions. //! //! Exposes `add_reaction` and `remove_reaction` from the [`Channel`] trait as an //! agent-callable tool. The tool holds a late-binding channel map handle that is //! populated once channels are initialized (after tool construction). This m...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> "period": "W1", "completed": "Done", "in_progress": "WIP", "blocked": "None", "next_steps": "Next" } }); let result = tool.execute(params).await.unwrap(); assert!(result.success); a...
fim
zeroclaw-labs/zeroclaw
rust
//! Report template engine for project delivery intelligence. //! //! Provides built-in templates for weekly status, sprint review, risk register, //! and milestone reports with multi-language support (EN, DE, FR, IT). use std::collections::HashMap; use std::fmt::Write as _; /// Supported report output formats. #[der...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>pty()); } #[tokio::test] async fn screenshot_rejects_shell_injection_filename() { let tool = ScreenshotTool::new(test_security()); let result = tool .execute(json!({"filename": "test'injection.png"})) .await .unwrap(); assert!(!resul...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> )]); let tool = SessionResetTool::for_agent( backend.clone(), test_security(), SessionOwnershipScope::for_agent("rowan"), ); let result = tool .execute(json!({"session_id": "telegram__alice"})) .await .unwr...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>tput: String::new(), error: Some(format!( "{browser} timed out after {} seconds", timeout.as_secs() )), }), } } } #[cfg(test)] mod tests { use super::*; use zeroclaw_config::autonomy::AutonomyLevel; ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! Built-in `tool_search` tool for on-demand MCP tool schema loading. //! //! When `mcp.deferred_loading` is enabled, this tool lets the LLM discover and //! activate deferred MCP tools. Supports two query modes: //! - `select:name1,name2` — fetch exact tools by prefixed name. //! - Free-text keyword sea...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>/// Truncate a string to `max_chars` Unicode characters, appending "..." if truncated. pub fn truncate_with_ellipsis(s: &str, max_chars: usize) -> String { <|fim_suffix|>pub enum MaybeSet<T> { Set(T), Unset, Null, } #[cfg(test)] mod tests { use super::*; #[test] fn floor_char_b...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ns("Partly cloudy")); assert!(out.contains("72%")); // humidity assert!(out.contains("18 km/h")); assert!(out.contains("WSW")); assert!(!out.contains("Forecast")); } #[test] fn format_output_imperial_current_only() { let data = make_response(); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>ttps://192.168.1.5:8080/api").is_ok()); } } <|fim_prefix|>use async_trait::async_trait; use futures_util::StreamExt; use serde_json::json; use std::sync::Arc; use std::time::Duration; use zeroclaw_api::tool::{Tool, ToolResult}; use zeroclaw_config::policy::SecurityPolicy; use zeroclaw_config::schema::...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>solution { route: WebSearchProviderRoute::Jina, canonical_provider: JINA_PROVIDER, used_fallback: false, }, // Warns for unknown model_providers, falls back to default. // Known non-default model_providers: Brave, SearXNG, Tavily, Jina. _...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>/ No boot key — forces reload from config let tool = WebSearchTool::new_with_config( "jina".to_string(), None, None, None, None, 5, 15, config_path, false, ); let key = tool....
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>d be rate-limited"); assert!(r2.error.unwrap().contains("Rate limit exceeded")); // Inner tool must NOT have been called on the blocked attempt. assert_eq!(counter.load(Ordering::SeqCst), 1); } // ── PathGuardedTool tests ───────────────────────────────────────────────── ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#!/usr/bin/env python3 """Kill stale processes occupying a TCP port (dev helper). Used by VS Code dev tasks to free the gateway port before cargo-watch restarts. Best-effort — exits 0 regardless so the real bind error surfaces naturally if the port cannot be freed. Usage: python3 dev/kill-port.py [P...
fim
zeroclaw-labs/zeroclaw
python
<|fim_prefix|>// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. (() => { // Resolve dark/light from the active theme's --color-scheme, which // pc-themes.css ...
fim
zeroclaw-labs/zeroclaw
javascript
<|fim_prefix|>/* ZeroClaw docs enhancement layer (Tier B PoC). - Right-hand page TOC built from content headings, with scroll-spy. - Hero banner injected on the landing page (introduction). - Reading-progress bar under the menu bar. No build-time coupling: everything is derived from the rendered DOM. */ (fu...
fim
zeroclaw-labs/zeroclaw
javascript
<|fim_prefix|>// Version selector injected into mdBook's menu bar. // // Detects the current version from the URL path (e.g., /v0.7.5/, /main/), // fetches /versions.json from the domain root to list all available versions, // then renders a dropdown linking to the same page in each version. (function () { // Parse t...
fim
zeroclaw-labs/zeroclaw
javascript
fn main() { embuild::espidf::sysenv::output(); } <|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! ZeroClaw ESP32 firmware — JSON-over-serial peripheral. //! //! Listens for newline-delimited JSON commands on UART0, executes gpio_read/gpio_write, //! responds with JSON. Compatible with host ZeroClaw SerialPeripheral protocol. //! //! Protocol: same as STM32 — see docs/hardware-peripherals-design.md...
fim
zeroclaw-labs/zeroclaw
rust
use embuild::espidf::sysenv::output; fn main() { output(); slint_build::compile_with_config( "ui/main.slint", slint_build::CompilerConfiguration::new() .embed_resources(slint_build::EmbedResourcesKind::EmbedForSoftwareRenderer) .with_style("material".into()), ) ....
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>lint::include_modules!(); fn main() -> anyhow::Result<()> { esp_idf_svc::sys::link_patches(); esp_idf_svc::log::EspLogger::initialize_default(); info!("Starting ZeroClaw ESP32 UI scaffold"); let window = MainWindow::new().context("failed to create MainWindow")?; window.run().context...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>Command::Capabilities) => { resp_buf.clear(); let _ = core::fmt::Write::write_str( &mut resp_buf, concat!( r#"{"id":""#, ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>d=memory.x"); } <|fim_prefix|>fn main<|fim_middle|>() { println!("cargo:rerun-if-change<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>0u8; 16]; let mut resp_buf: String<256> = String::new(); loop { let mut byte = [0u8; 1]; if uart.blocking_read(&mut byte).is_ok() { let b = byte[0]; if b == b'\n' || b == b'\r' { if !line_buf.is_empty() { let id_len = cop...
fim
zeroclaw-labs/zeroclaw
rust
# ZeroClaw Bridge — socket server for GPIO control from ZeroClaw agent # SPDX-License-Identifier: MPL-2.0 import socket import threading from arduino.app_utils import App, Bridge ZEROCLAW_PORT = 9999 def handle_client(conn): try: data = conn.recv(256).decode().strip() if not data: con...
fim
zeroclaw-labs/zeroclaw
python
<|fim_suffix|> Some(Command::GpioRead { pin }) } else if has_cmd(line, b"gpio_write") { let pin = parse_arg(line, b"pin").unwrap_or(-1); let value = parse_arg(line, b"value").unwrap_or(0); Some(Command::GpioWrite { pin, value }) } else { None ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#![no_std] pub mod<|fim_suffix|> mod parse; pub mod response; pub use command::Command; pub use parse::{copy_id, has_cmd, parse_arg}; pub use response::{write_err, write_ok}; <|fim_middle|> command; pub<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>with(suffix) { let rest = &line[i + len..]; let mut num: i32 = 0; let mut neg = false; let mut j = 0; // Skip whitespace after colon while j < rest.len() && rest[j] == b' ' { j += 1; } if j < re...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>use core::fmt::Write; use heapless::String; /// Write a successful JSON response into `buf`. /// /// Format: `{"id":"<id>","ok":true,"result":"<result>"}` pub fn write_ok<const N: usize>(buf: &mut String<N>, id: &str, result: &str) { buf.clear(); let _ = write!(buf, "{{\"id\":\"{}\",\"ok\":true,\...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#![no_main] use libfuzzer_sys::fuzz_t<|fim_suffix|> let _ = policy.validate_command_execution(s, false); } }); <|fim_middle|>arget; use zeroclaw::security::SecurityPolicy; fuzz_target!(|data: &[u8]| { if let Ok(s) = std::str::from_utf8(data) { let policy = SecurityPolicy::default(); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|> // Fuzz TOML config parsing — silently discard invalid input let _ = toml::from_str::<toml::Value>(s); } }); <|fim_prefix|>#![no_main] use libfu<|fim_middle|>zzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { if let Ok(s) = std::str::from_utf8(data) { <|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { if let Ok(s) = std::str::from_utf8(data) { // Fuzz model_provider API response deserialization let _<|fim_suffix|>erde_json::Value>(s); } }); <|fim_middle|> = serde_json::from_str::<s<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|><serde_json::Value>(s); } }); <|fim_prefix|>#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { if let Ok(s) = std::str::from_utf8(dat<|fim_middle|>a) { // Fuzz JSON tool parameter parsing — silently discard invalid input let _ = serde_json::from_str::<|endoft...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#![no_main] use libfuzzer_sys::fuzz_target; fuzz_target!(<|fim_suffix|> = serde_json::from_str::<serde_json::Value>(s); } }); <|fim_middle|>|data: &[u8]| { if let Ok(s) = std::str::from_utf8(data) { // Fuzz webhook body deserialization let _<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>l".into(), description: "Generate an image from a text prompt using fal.ai (Flux models). \ Returns the image URL and metadata." .into(), parameters_schema: json!({ "type": "object", "required": ["prompt"], "properties"...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! ZeroClaw WASM plugin: grammar and style checking via LanguageTool. //! //! A stateless tool plugin — one request → one response, no stored state. Targets //! a LanguageTool server (the public API by default, or the user's own //! **self-hosted, open-source** instance via `LANGUAGETOOL_URL`). Form-enco...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! <|fim_suffix|>t ToolMetadata { name: String, description: String, parameters_schema: serde_json::Value, } #[derive(Serialize, Deserialize)] struct ToolResult { success: bool, output: String, #[serde(skip_serializing_if = "Option::is_none")] error: Option<String>, } impl T...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>.is_empty()) .unwrap_or(""); let steps = args .get("steps") .and_then(|v| v.as_u64()) .unwrap_or(20) .clamp(1, 150); // ── Resolve the local base URL (defaults to localhost) ──────── let base = match env_read(API_URL_ENV) { Ok(u) if !u.trim().is...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#!/usr/bin/env python3 from __future__ import annotations import argparse import os import re import subprocess import sys from pathlib import Path DOC_PATH_RE = re.compile(r"\.mdx?$") URL_RE = re.compile(r"https?://[^\s<>'\"]+") INLINE_LINK_RE = re.compile(r"!?\[[^\]]*\]\(([^)]+)\)") REF_LINK_RE = re...
fim
zeroclaw-labs/zeroclaw
python
<|fim_suffix|>k: # - top-level header section (before any [table]) # - [skill] block (and its nested sub-tables) # - everything else (preserved as-is) sections: List[Tuple[Optional[str], List[str]]] = [] # current table name (None = pre-table preamble), current line buffer current_table: O...
fim
zeroclaw-labs/zeroclaw
python
<|fim_suffix|>:agent::*; <|fim_prefix|>pub u<|fim_middle|>se zeroclaw_runtime:<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>wd: /tmp")); } #[test] fn summarize_args_truncates_long_values() { let long_val = "x".repeat(200); let args = serde_json::json!({ "content": long_val }); let summary = summarize_args(&args); assert!(summary.contains('…')); assert!(summary.len() < 200); ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>#[allow(unused_imports)] pub use zeroclaw_providers::auth::*; pub mod anthropic_token { #[allow(unused_im<|fim_suffix|>n::*; } pub mod openai_oauth { #[allow(unused_imports)] pub use zeroclaw_providers::auth::openai_oauth::*; } pub mod profiles { #[allow(unused_imports)] pub use zerocl...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>"ws", "::1", 42617, None), "ws://[::1]:42617/acp" ); } #[test] fn acp_websocket_url_includes_path_prefix() { assert_eq!( acp_websocket_url("ws", "127.0.0.1", 42617, Some("/zeroclaw")), "ws://127.0.0.1:42617/zeroclaw/acp" ); } ...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_prefix|>//! `zeroclaw browse [path]` — CLI adapter over //! `zeroclaw_runtime::<|fim_suffix|> ), None => println!(" {}", console::style(&entry.name).dim()), }, } } Ok(()) } <|fim_middle|>browse::list_directory`. Thin print formatter; the //! walking + containment ru...
fim
zeroclaw-labs/zeroclaw
rust
<|fim_suffix|>bluesky::*; <|fim_prefix|>pu<|fim_middle|>b use zeroclaw_channels::<|endoftext|>
fim
zeroclaw-labs/zeroclaw
rust