Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

chore: remove picoclaw

Vanalite6edf90eb6b6a
diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs
index 5dea4eaa3..3d6a37d27 100644
--- a/src-tauri/src/core/mod.rs
+++ b/src-tauri/src/core/mod.rs
@@ -4,7 +4,6 @@ pub mod extensions;
pub mod filesystem;
pub mod mcp;
pub mod openclaw;
-pub mod picoclaw;
pub mod server;
pub mod setup;
pub mod state;
diff --git a/src-tauri/src/core/openclaw/commands.rs b/src-tauri/src/core/openclaw/commands.rs
index 08ca915db..2756244f0 100644
--- a/src-tauri/src/core/openclaw/commands.rs
+++ b/src-tauri/src/core/openclaw/commands.rs
@@ -1065,8 +1065,7 @@ pub async fn openclaw_install() -> Result<InstallResult, String> {
let error_message = if stderr.contains("404") || stderr.contains("Not Found") || stdout.contains("404") {
format!(
"OpenClaw package '{}' is not yet available on npm. \
- Please check the OpenClaw project for installation instructions, \
- or try using PicoClaw as an alternative lightweight gateway.",
+ Please check the OpenClaw project for installation instructions.",
OPENCLAW_PACKAGE_NAME
)
} else if stderr.contains("EACCES") || stderr.contains("permission denied") {
diff --git a/src-tauri/src/core/picoclaw/commands.rs b/src-tauri/src/core/picoclaw/commands.rs
deleted file mode 100644
index 4738a3cc9..000000000
--- a/src-tauri/src/core/picoclaw/commands.rs
+++ /dev/null
@@ -1,566 +0,0 @@
-use std::path::PathBuf;
-use std::process::Stdio;
-
-use tauri::State;
-use tokio::process::Command;
-
-use crate::core::picoclaw::{
- constants::*,
- models::*,
- get_picoclaw_config_path, get_picoclaw_config_dir, get_picoclaw_binary_path,
- PicoClawState, DEFAULT_PICOCLAW_PORT,
-};
-
-/// Check if a port is available
-#[tauri::command]
-pub async fn picoclaw_check_port(port: u16) -> PortCheckResult {
- log::info!("Checking if port {} is available for PicoClaw", port);
-
- let addr = format!("127.0.0.1:{}", port);
-
- match tokio::net::TcpListener::bind(&addr).await {
- Ok(_) => PortCheckResult {
- available: true,
- port,
- error: None,
- },
- Err(e) => PortCheckResult {
- available: false,
- port,
- error: Some(format!("Port {} is in use: {}", port, e)),
- },
- }
-}
-
-/// Check if PicoClaw binary exists and get its version
-async fn check_picoclaw_binary() -> Result<Option<(String, PathBuf)>, String> {
- let binary_path = get_picoclaw_binary_path()?;
-
- if !binary_path.exists() {
- return Ok(None);
- }
-
- // Try to get version
- let output = Command::new(&binary_path)
- .arg("--version")
- .output()
- .await;
-
- match output {
- Ok(output) => {
- if output.status.success() {
- let version = String::from_utf8_lossy(&output.stdout).trim().to_string();
- Ok(Some((version, binary_path)))
- } else {
- // Binary exists but version check failed - still consider it installed
- Ok(Some(("unknown".to_string(), binary_path)))
- }
- }
- Err(_) => {
- // Binary exists but couldn't execute - might be permission issue
- Ok(Some(("unknown".to_string(), binary_path)))
- }
- }
-}
-
-/// Detect if PicoClaw is installed
-#[tauri::command]
-pub async fn picoclaw_detect() -> PicoClawStatus {
- log::info!("Detecting PicoClaw installation");
-
- let binary_info = match check_picoclaw_binary().await {
- Ok(info) => info,
- Err(e) => {
- return PicoClawStatus {
- installed: false,
- running: false,
- version: None,
- binary_path: None,
- port_available: true,
- error: Some(e),
- };
- }
- };
-
- let port_check = picoclaw_check_port(DEFAULT_PICOCLAW_PORT).await;
-
- match binary_info {
- Some((version, path)) => PicoClawStatus {
- installed: true,
- running: false, // Will be updated by status check
- version: Some(version),
- binary_path: Some(path.to_string_lossy().to_string()),
- port_available: port_check.available,
- error: None,
- },
- None => PicoClawStatus {
- installed: false,
- running: false,
- version: None,
- binary_path: None,
- port_available: port_check.available,
- error: None,
- },
- }
-}
-
-/// Download and install PicoClaw binary
-#[tauri::command]
-pub async fn picoclaw_install() -> Result<InstallResult, String> {
- log::info!("Installing PicoClaw binary");
-
- // Create config directory if it doesn't exist
- let _config_dir = get_picoclaw_config_dir()?;
-
- // Determine download URL
- let download_url = get_releases_url();
- log::info!("Downloading PicoClaw from: {}", download_url);
-
- // Download the binary
- let response = reqwest::get(&download_url)
- .await
- .map_err(|e| format!("Failed to download PicoClaw: {}", e))?;
-
- if !response.status().is_success() {
- return Ok(InstallResult {
- success: false,
- version: None,
- binary_path: None,
- error: Some(format!("Download failed with status: {}", response.status())),
- });
- }
-
- let bytes = response.bytes()
- .await
- .map_err(|e| format!("Failed to read download: {}", e))?;
-
- // Save the binary
- let binary_path = get_picoclaw_binary_path()?;
- std::fs::write(&binary_path, &bytes)
- .map_err(|e| format!("Failed to save binary: {}", e))?;
-
- // Make it executable on Unix
- #[cfg(unix)]
- {
- use std::os::unix::fs::PermissionsExt;
- let mut perms = std::fs::metadata(&binary_path)
- .map_err(|e| format!("Failed to get file metadata: {}", e))?
- .permissions();
- perms.set_mode(0o755);
- std::fs::set_permissions(&binary_path, perms)
- .map_err(|e| format!("Failed to set permissions: {}", e))?;
- }
-
- // Verify installation
- match check_picoclaw_binary().await {
- Ok(Some((version, path))) => {
- log::info!("PicoClaw installed successfully: {} at {:?}", version, path);
- Ok(InstallResult {
- success: true,
- version: Some(version),
- binary_path: Some(path.to_string_lossy().to_string()),
- error: None,
- })
- }
- Ok(None) => Ok(InstallResult {
- success: false,
- version: None,
- binary_path: None,
- error: Some("Binary was saved but verification failed".to_string()),
- }),
- Err(e) => Ok(InstallResult {
- success: false,
- version: None,
- binary_path: None,
- error: Some(e),
- }),
- }
-}
-
-/// Generate the default PicoClaw configuration
-fn generate_default_config(input: Option<PicoClawConfigInput>) -> PicoClawConfig {
- let mut config = PicoClawConfig::default();
-
- if let Some(input) = input {
- if let Some(port) = input.port {
- config.gateway.port = port;
- }
- if let Some(host) = input.host {
- config.gateway.host = host;
- }
- if let Some(base_url) = input.jan_base_url {
- config.providers.jan.api_base = base_url;
- }
- if let Some(model_id) = input.model_id {
- config.agents.defaults.model = format!("jan/{}", model_id);
- }
- }
-
- // Add default web search tool
- config.tools = ToolsConfig {
- web: Some(WebToolsConfig {
- duckduckgo: Some(DuckDuckGoConfig::default()),
- }),
- };
-
- config
-}
-
-/// Configure PicoClaw with the specified settings
-#[tauri::command]
-pub async fn picoclaw_configure(config_input: Option<PicoClawConfigInput>) -> Result<PicoClawConfig, String> {
- log::info!("Configuring PicoClaw");
-
- let config = generate_default_config(config_input);
-
- // Ensure config directory exists
- let config_dir = get_picoclaw_config_dir()?;
-
- // Create workspace directory
- let workspace_dir = config_dir.join("workspace");
- if !workspace_dir.exists() {
- std::fs::create_dir_all(&workspace_dir)
- .map_err(|e| format!("Failed to create workspace: {}", e))?;
- }
-
- // Write config file
- let config_path = get_picoclaw_config_path()?;
- let config_json = serde_json::to_string_pretty(&config)
- .map_err(|e| format!("Failed to serialize config: {}", e))?;
-
- std::fs::write(&config_path, config_json)
- .map_err(|e| format!("Failed to write config file: {}", e))?;
-
- log::info!("PicoClaw configuration written to {:?}", config_path);
- Ok(config)
-}
-
-/// Get the current PicoClaw configuration
-#[tauri::command]
-pub async fn picoclaw_get_config() -> Result<PicoClawConfig, String> {
- let config_path = get_picoclaw_config_path()?;
-
- if !config_path.exists() {
- // Return default config if no config exists
- return Ok(PicoClawConfig::default());
- }
-
- let config_json = std::fs::read_to_string(&config_path)
- .map_err(|e| format!("Failed to read config file: {}", e))?;
-
- serde_json::from_str(&config_json)
- .map_err(|e| format!("Failed to parse config: {}", e))
-}
-
-/// Start the PicoClaw gateway
-#[tauri::command]
-pub async fn picoclaw_start(state: State<'_, PicoClawState>) -> Result<(), String> {
- log::info!("Starting PicoClaw gateway");
-
- // Check if already running
- {
- let handle = state.process_handle.lock().await;
- if handle.is_some() {
- return Err("PicoClaw is already running".to_string());
- }
- }
-
- // Check if binary exists
- let binary_path = get_picoclaw_binary_path()?;
- if !binary_path.exists() {
- return Err("PicoClaw is not installed. Please install it first.".to_string());
- }
-
- // Check port availability
- let port_check = picoclaw_check_port(DEFAULT_PICOCLAW_PORT).await;
- if !port_check.available {
- return Err(format!("Port {} is already in use", DEFAULT_PICOCLAW_PORT));
- }
-
- // Ensure config exists
- let config_path = get_picoclaw_config_path()?;
- if !config_path.exists() {
- // Generate default config
- picoclaw_configure(None).await?;
- }
-
- // Start PicoClaw gateway
- let config_dir = get_picoclaw_config_dir()?;
- let mut child = Command::new(&binary_path)
- .arg("gateway")
- .current_dir(&config_dir)
- .stdout(Stdio::piped())
- .stderr(Stdio::piped())
- .spawn()
- .map_err(|e| format!("Failed to start PicoClaw: {}", e))?;
-
- // Wait a bit for the process to start
- tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
-
- // Check if process is still running
- match child.try_wait().map_err(|e| format!("Failed to check process: {}", e)) {
- Ok(Some(status)) => {
- if !status.success() {
- return Err(format!("PicoClaw failed to start: {:?}", status));
- }
- }
- Ok(None) => {
- // Process is running, store the handle
- let mut handle = state.process_handle.lock().await;
- *handle = Some(child);
- log::info!("PicoClaw gateway started successfully on port {}", DEFAULT_PICOCLAW_PORT);
- }
- Err(e) => {
- return Err(format!("Failed to check process status: {}", e));
- }
- }
-
- Ok(())
-}
-
-/// Stop the PicoClaw gateway
-#[tauri::command]
-pub async fn picoclaw_stop(state: State<'_, PicoClawState>) -> Result<(), String> {
- log::info!("Stopping PicoClaw gateway");
-
- let mut handle = state.process_handle.lock().await;
-
- if let Some(mut child) = handle.take() {
- // Try graceful shutdown first
- match child.kill().await {
- Ok(_) => {
- log::info!("PicoClaw gateway stopped");
- Ok(())
- }
- Err(e) => {
- log::warn!("Failed to stop PicoClaw gracefully: {}", e);
- // Try to force kill
- let _ = child.start_kill();
- Ok(())
- }
- }
- } else {
- // Process not tracked, try to kill by name
- #[cfg(unix)]
- {
- let output = Command::new("pkill")
- .arg("-f")
- .arg("picoclaw")
- .output()
- .await
- .map_err(|e| format!("Failed to run pkill: {}", e))?;
-
- if output.status.success() {
- Ok(())
- } else {
- Err("PicoClaw process not found".to_string())
- }
- }
-
- #[cfg(target_os = "windows")]
- {
- let output = Command::new("taskkill")
- .args(&["/F", "/IM", "picoclaw.exe"])
- .output()
- .await
- .map_err(|e| format!("Failed to run taskkill: {}", e))?;
-
- if output.status.success() {
- Ok(())
- } else {
- Err("PicoClaw process not found".to_string())
- }
- }
- }
-}
-
-/// Get the current PicoClaw status
-#[tauri::command]
-pub async fn picoclaw_status(state: State<'_, PicoClawState>) -> Result<PicoClawStatus, String> {
- log::info!("Getting PicoClaw status");
-
- // Check if process is running
- let running = {
- let mut handle = state.process_handle.lock().await;
- if let Some(ref mut child) = *handle {
- match child.try_wait() {
- Ok(Some(_)) => {
- // Process has exited, clear the handle
- *handle = None;
- false
- }
- Ok(None) => true, // Process is still running
- Err(_) => false,
- }
- } else {
- false
- }
- };
-
- // Check if binary is installed
- let binary_info = match check_picoclaw_binary().await {
- Ok(info) => info,
- Err(e) => {
- return Ok(PicoClawStatus {
- installed: false,
- running: false,
- version: None,
- binary_path: None,
- port_available: true,
- error: Some(e),
- });
- }
- };
-
- // Check port
- let port_check = picoclaw_check_port(DEFAULT_PICOCLAW_PORT).await;
-
- match binary_info {
- Some((version, path)) => Ok(PicoClawStatus {
- installed: true,
- running,
- version: Some(version),
- binary_path: Some(path.to_string_lossy().to_string()),
- port_available: port_check.available || running, // Port is "available" if we're using it
- error: None,
- }),
- None => Ok(PicoClawStatus {
- installed: false,
- running: false,
- version: None,
- binary_path: None,
- port_available: port_check.available,
- error: None,
- }),
- }
-}
-
-/// Restart the PicoClaw gateway
-#[tauri::command]
-pub async fn picoclaw_restart(state: State<'_, PicoClawState>) -> Result<(), String> {
- log::info!("Restarting PicoClaw gateway");
-
- // Stop first
- let _ = picoclaw_stop(state.clone()).await;
-
- // Wait a bit for the process to fully terminate
- tokio::time::sleep(tokio::time::Duration::from_millis(500)).await;
-
- // Start again
- picoclaw_start(state).await
-}
-
-/// Get the PicoClaw configuration directory path
-#[tauri::command]
-pub fn picoclaw_get_config_dir() -> Result<String, String> {
- let path = get_picoclaw_config_dir()?;
- Ok(path.to_string_lossy().to_string())
-}
-
-/// One-click enable PicoClaw remote access
-/// This handles detection, installation, configuration, and startup
-#[tauri::command]
-pub async fn picoclaw_enable(
- state: State<'_, PicoClawState>,
- config_input: Option<PicoClawConfigInput>,
-) -> Result<PicoClawStatus, String> {
- log::info!("Enabling PicoClaw remote access (1-click setup)");
-
- // Step 1: Detect current status
- let mut status = picoclaw_detect().await;
-
- // Step 2: Install if not installed
- if !status.installed {
- log::info!("PicoClaw not installed, installing...");
- let install_result = picoclaw_install().await?;
-
- if !install_result.success {
- return Err(install_result.error.unwrap_or_else(|| "Installation failed".to_string()));
- }
-
- status.installed = true;
- status.version = install_result.version;
- status.binary_path = install_result.binary_path;
- }
-
- // Step 3: Configure with Jan as provider
- log::info!("Configuring PicoClaw...");
- picoclaw_configure(config_input).await?;
-
- // Step 4: Start the gateway
- log::info!("Starting PicoClaw gateway...");
- picoclaw_start(state.clone()).await?;
-
- // Step 5: Return final status
- picoclaw_status(state).await
-}
-
-/// Configure Telegram channel for PicoClaw
-/// Reuses the validation logic but stores in PicoClaw config
-#[tauri::command]
-pub async fn picoclaw_telegram_configure(token: String, user_id: Option<String>) -> Result<(), String> {
- log::info!("Configuring Telegram channel for PicoClaw");
-
- // Get current config
- let mut config = picoclaw_get_config().await?;
-
- // Update Telegram configuration
- config.channels.telegram = Some(TelegramChannelConfig {
- enabled: true,
- token,
- allow_from: user_id.map(|id| vec![id]).unwrap_or_default(),
- });
-
- // Write updated config
- let config_path = get_picoclaw_config_path()?;
- let config_json = serde_json::to_string_pretty(&config)
- .map_err(|e| format!("Failed to serialize config: {}", e))?;
-
- std::fs::write(&config_path, config_json)
- .map_err(|e| format!("Failed to write config: {}", e))?;
-
- log::info!("Telegram configured for PicoClaw");
- Ok(())
-}
-
-/// Configure Discord channel for PicoClaw
-#[tauri::command]
-pub async fn picoclaw_discord_configure(token: String, user_id: Option<String>, mention_only: bool) -> Result<(), String> {
- log::info!("Configuring Discord channel for PicoClaw");
-
- // Get current config
- let mut config = picoclaw_get_config().await?;
-
- // Update Discord configuration
- config.channels.discord = Some(DiscordChannelConfig {
- enabled: true,
- token,
- allow_from: user_id.map(|id| vec![id]).unwrap_or_default(),
- mention_only,
- });
-
- // Write updated config
- let config_path = get_picoclaw_config_path()?;
- let config_json = serde_json::to_string_pretty(&config)
- .map_err(|e| format!("Failed to serialize config: {}", e))?;
-
- std::fs::write(&config_path, config_json)
- .map_err(|e| format!("Failed to write config: {}", e))?;
-
- log::info!("Discord configured for PicoClaw");
- Ok(())
-}
-
-/// Get Telegram channel configuration for PicoClaw
-#[tauri::command]
-pub async fn picoclaw_telegram_get_config() -> Result<Option<TelegramChannelConfig>, String> {
- let config = picoclaw_get_config().await?;
- Ok(config.channels.telegram)
-}
-
-/// Get Discord channel configuration for PicoClaw
-#[tauri::command]
-pub async fn picoclaw_discord_get_config() -> Result<Option<DiscordChannelConfig>, String> {
- let config = picoclaw_get_config().await?;
- Ok(config.channels.discord)
-}
diff --git a/src-tauri/src/core/picoclaw/constants.rs b/src-tauri/src/core/picoclaw/constants.rs
deleted file mode 100644
index 780de57e1..000000000
--- a/src-tauri/src/core/picoclaw/constants.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-/// PicoClaw GitHub repository owner
-pub const PICOCLAW_REPO_OWNER: &str = "pico-ai";
-
-/// PicoClaw GitHub repository name
-pub const PICOCLAW_REPO_NAME: &str = "picoclaw";
-
-/// Default PicoClaw gateway port
-pub const DEFAULT_PICOCLAW_PORT: u16 = 8080;
-
-/// Default Jan API base URL (same as OpenClaw)
-pub const DEFAULT_JAN_BASE_URL: &str = "http://localhost:1337/v1";
-
-/// Default model ID for agents
-pub const DEFAULT_MODEL_ID: &str = "llama-3.2-3b";
-
-/// Default system prompt for agents
-pub const DEFAULT_SYSTEM_PROMPT: &str = "You are a helpful AI assistant running via Jan.";
-
-/// PicoClaw binary name for different platforms
-#[cfg(target_os = "macos")]
-pub const PICOCLAW_BINARY_NAME: &str = "picoclaw";
-
-#[cfg(target_os = "windows")]
-pub const PICOCLAW_BINARY_NAME: &str = "picoclaw.exe";
-
-#[cfg(target_os = "linux")]
-pub const PICOCLAW_BINARY_NAME: &str = "picoclaw";
-
-/// Get the platform-specific binary download name
-pub fn get_binary_download_name() -> String {
- let os = std::env::consts::OS;
- let arch = std::env::consts::ARCH;
-
- let os_name = match os {
- "macos" => "darwin",
- "windows" => "windows",
- "linux" => "linux",
- _ => "linux",
- };
-
- let arch_name = match arch {
- "x86_64" => "amd64",
- "aarch64" => "arm64",
- "arm" => "arm",
- _ => "amd64",
- };
-
- if os == "windows" {
- format!("picoclaw-{}-{}.exe", os_name, arch_name)
- } else {
- format!("picoclaw-{}-{}", os_name, arch_name)
- }
-}
-
-/// Get the GitHub releases URL for PicoClaw
-pub fn get_releases_url() -> String {
- format!(
- "https://github.com/{}/{}/releases/latest/download/{}",
- PICOCLAW_REPO_OWNER,
- PICOCLAW_REPO_NAME,
- get_binary_download_name()
- )
-}
diff --git a/src-tauri/src/core/picoclaw/mod.rs b/src-tauri/src/core/picoclaw/mod.rs
deleted file mode 100644
index f036a18a0..000000000
--- a/src-tauri/src/core/picoclaw/mod.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-pub mod commands;
-pub mod constants;
-pub mod models;
-
-use std::path::PathBuf;
-use std::sync::Arc;
-
-use tokio::sync::Mutex;
-
-/// PicoClaw configuration directory
-pub fn get_picoclaw_config_dir() -> Result<PathBuf, String> {
- let home = dirs::home_dir().ok_or("Could not find home directory")?;
- let config_dir = home.join(".picoclaw");
- if !config_dir.exists() {
- std::fs::create_dir_all(&config_dir).map_err(|e| e.to_string())?;
- }
- Ok(config_dir)
-}
-
-/// PicoClaw configuration file path
-pub fn get_picoclaw_config_path() -> Result<PathBuf, String> {
- Ok(get_picoclaw_config_dir()?.join("config.json"))
-}
-
-/// PicoClaw binary path (stored in config directory)
-pub fn get_picoclaw_binary_path() -> Result<PathBuf, String> {
- Ok(get_picoclaw_config_dir()?.join(constants::PICOCLAW_BINARY_NAME))
-}
-
-/// PicoClaw gateway port
-pub const DEFAULT_PICOCLAW_PORT: u16 = constants::DEFAULT_PICOCLAW_PORT;
-
-/// PicoClaw Manager state
-pub struct PicoClawState {
- /// Process handle for the PicoClaw gateway
- pub process_handle: Arc<Mutex<Option<tokio::process::Child>>>,
-}
-
-impl Default for PicoClawState {
- fn default() -> Self {
- Self {
- process_handle: Arc::new(Mutex::new(None)),
- }
- }
-}
diff --git a/src-tauri/src/core/picoclaw/models.rs b/src-tauri/src/core/picoclaw/models.rs
deleted file mode 100644
index 15a220213..000000000
--- a/src-tauri/src/core/picoclaw/models.rs
+++ /dev/null
@@ -1,301 +0,0 @@
-use serde::{Deserialize, Serialize};
-
-use super::constants;
-
-/// PicoClaw configuration structure
-/// Matches the config.json format used by PicoClaw
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PicoClawConfig {
- /// Agents configuration
- pub agents: AgentsConfig,
- /// LLM providers configuration
- pub providers: ProvidersConfig,
- /// Channels configuration
- #[serde(default)]
- pub channels: ChannelsConfig,
- /// Tools configuration
- #[serde(default)]
- pub tools: ToolsConfig,
- /// Gateway configuration
- #[serde(default)]
- pub gateway: GatewayConfig,
-}
-
-impl Default for PicoClawConfig {
- fn default() -> Self {
- Self {
- agents: AgentsConfig::default(),
- providers: ProvidersConfig::default(),
- channels: ChannelsConfig::default(),
- tools: ToolsConfig::default(),
- gateway: GatewayConfig::default(),
- }
- }
-}
-
-/// Agents configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct AgentsConfig {
- /// Default agent settings
- pub defaults: AgentDefaults,
-}
-
-impl Default for AgentsConfig {
- fn default() -> Self {
- Self {
- defaults: AgentDefaults::default(),
- }
- }
-}
-
-/// Default agent settings
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct AgentDefaults {
- /// Workspace directory
- pub workspace: String,
- /// Default model ID (format: provider/model)
- pub model: String,
- /// Maximum tokens for responses
- pub max_tokens: u32,
- /// Temperature for generation
- pub temperature: f32,
- /// Maximum tool iterations
- pub max_tool_iterations: u32,
-}
-
-impl Default for AgentDefaults {
- fn default() -> Self {
- Self {
- workspace: "~/.picoclaw/workspace".to_string(),
- model: format!("jan/{}", constants::DEFAULT_MODEL_ID),
- max_tokens: 8192,
- temperature: 0.7,
- max_tool_iterations: 20,
- }
- }
-}
-
-/// Providers configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct ProvidersConfig {
- /// Jan provider configuration (Ollama-compatible)
- #[serde(default)]
- pub jan: JanProviderConfig,
-}
-
-impl Default for ProvidersConfig {
- fn default() -> Self {
- Self {
- jan: JanProviderConfig::default(),
- }
- }
-}
-
-/// Jan provider configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct JanProviderConfig {
- /// API base URL
- pub api_base: String,
- /// API key (empty for local Jan)
- #[serde(default)]
- pub api_key: String,
-}
-
-impl Default for JanProviderConfig {
- fn default() -> Self {
- Self {
- api_base: constants::DEFAULT_JAN_BASE_URL.to_string(),
- api_key: String::new(),
- }
- }
-}
-
-/// Channels configuration
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
-pub struct ChannelsConfig {
- /// Telegram channel configuration
- #[serde(default)]
- pub telegram: Option<TelegramChannelConfig>,
- /// Discord channel configuration
- #[serde(default)]
- pub discord: Option<DiscordChannelConfig>,
-}
-
-/// Telegram channel configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct TelegramChannelConfig {
- /// Whether the channel is enabled
- pub enabled: bool,
- /// Bot token
- pub token: String,
- /// Allowed user IDs
- #[serde(default)]
- pub allow_from: Vec<String>,
-}
-
-/// Discord channel configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct DiscordChannelConfig {
- /// Whether the channel is enabled
- pub enabled: bool,
- /// Bot token
- pub token: String,
- /// Allowed user IDs
- #[serde(default)]
- pub allow_from: Vec<String>,
- /// Whether to only respond to mentions
- #[serde(default)]
- pub mention_only: bool,
-}
-
-/// Tools configuration
-#[derive(Debug, Clone, Serialize, Deserialize, Default)]
-pub struct ToolsConfig {
- /// Web search tools configuration
- #[serde(default)]
- pub web: Option<WebToolsConfig>,
-}
-
-/// Web search tools configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct WebToolsConfig {
- /// DuckDuckGo configuration
- #[serde(default)]
- pub duckduckgo: Option<DuckDuckGoConfig>,
-}
-
-/// DuckDuckGo search configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct DuckDuckGoConfig {
- /// Whether enabled
- pub enabled: bool,
- /// Maximum results
- pub max_results: u32,
-}
-
-impl Default for DuckDuckGoConfig {
- fn default() -> Self {
- Self {
- enabled: true,
- max_results: 5,
- }
- }
-}
-
-/// Gateway configuration
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct GatewayConfig {
- /// Host to bind to
- pub host: String,
- /// Port to listen on
- pub port: u16,
-}
-
-impl Default for GatewayConfig {
- fn default() -> Self {
- Self {
- host: "127.0.0.1".to_string(),
- port: constants::DEFAULT_PICOCLAW_PORT,
- }
- }
-}
-
-/// PicoClaw status response
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PicoClawStatus {
- /// Whether PicoClaw binary is installed
- pub installed: bool,
- /// Whether the gateway is running
- pub running: bool,
- /// Installed PicoClaw version (if installed)
- pub version: Option<String>,
- /// Binary path (if installed)
- pub binary_path: Option<String>,
- /// Port status (available or in use)
- pub port_available: bool,
- /// Error message (if any)
- pub error: Option<String>,
-}
-
-/// Installation result
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct InstallResult {
- /// Whether installation was successful
- pub success: bool,
- /// Installed version (if successful)
- pub version: Option<String>,
- /// Binary path (if successful)
- pub binary_path: Option<String>,
- /// Error message (if failed)
- pub error: Option<String>,
-}
-
-/// Port check result
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PortCheckResult {
- /// Whether the port is available
- pub available: bool,
- /// The port number checked
- pub port: u16,
- /// Error message (if any)
- pub error: Option<String>,
-}
-
-/// Download progress event
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct DownloadProgress {
- /// Current bytes downloaded
- pub downloaded: u64,
- /// Total bytes to download
- pub total: u64,
- /// Progress percentage (0-100)
- pub percentage: u8,
-}
-
-/// Custom configuration input for PicoClaw
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct PicoClawConfigInput {
- /// Optional custom Jan base URL
- #[serde(rename = "janBaseUrl")]
- pub jan_base_url: Option<String>,
- /// Optional custom model ID
- #[serde(rename = "modelId")]
- pub model_id: Option<String>,
- /// Optional custom port
- pub port: Option<u16>,
- /// Optional bind host
- pub host: Option<String>,
-}
-
-/// Remote access backend type
-#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
-#[serde(rename_all = "lowercase")]
-pub enum RemoteAccessBackend {
- /// OpenClaw (full-featured, Node.js based)
- OpenClaw,
- /// PicoClaw (lightweight, Go binary)
- PicoClaw,
-}
-
-impl Default for RemoteAccessBackend {
- fn default() -> Self {
- Self::PicoClaw // Default to lightweight option
- }
-}
-
-/// Unified remote access status
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct RemoteAccessStatus {
- /// Which backend is active
- pub backend: RemoteAccessBackend,
- /// Whether the backend is installed
- pub installed: bool,
- /// Whether the gateway is running
- pub running: bool,
- /// Version string
- pub version: Option<String>,
- /// Connected channels
- pub channels: Vec<String>,
- /// Error message (if any)
- pub error: Option<String>,
-}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index bdabe91de..e08827ec9 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1,7 +1,6 @@
pub mod core;
pub mod openclaw_cli;
pub use core::openclaw::OpenClawState;
-pub use core::picoclaw::PicoClawState;
use core::{
app::commands::get_jan_data_folder_path,
@@ -210,23 +209,6 @@ pub fn run() {
core::openclaw::commands::tunnel_stop_ngrok,
core::openclaw::commands::tunnel_start_cloudflared,
core::openclaw::commands::tunnel_stop_cloudflared,
- // PicoClaw commands
- core::picoclaw::commands::picoclaw_detect,
- core::picoclaw::commands::picoclaw_install,
- core::picoclaw::commands::picoclaw_configure,
- core::picoclaw::commands::picoclaw_start,
- core::picoclaw::commands::picoclaw_stop,
- core::picoclaw::commands::picoclaw_status,
- core::picoclaw::commands::picoclaw_enable,
- core::picoclaw::commands::picoclaw_check_port,
- core::picoclaw::commands::picoclaw_get_config,
- core::picoclaw::commands::picoclaw_get_config_dir,
- // PicoClaw Telegram commands
- core::picoclaw::commands::picoclaw_telegram_configure,
- core::picoclaw::commands::picoclaw_telegram_get_config,
- // PicoClaw Discord commands
- core::picoclaw::commands::picoclaw_discord_configure,
- core::picoclaw::commands::picoclaw_discord_get_config,
]);
// Mobile: no updater commands
@@ -322,7 +304,6 @@ pub fn run() {
provider_configs: Arc::new(Mutex::new(HashMap::new())),
})
.manage(OpenClawState::default())
- .manage(PicoClawState::default())
.setup(|app| {
app.handle().plugin(
tauri_plugin_log::Builder::default()