Skip to content

LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。

TypeScript

fix: allow slower CLI version probes

nash_su5c87d209e32e
diff --git a/src-tauri/src/commands/claude_cli.rs b/src-tauri/src/commands/claude_cli.rs
index de6ac53d..087b76ca 100644
--- a/src-tauri/src/commands/claude_cli.rs
+++ b/src-tauri/src/commands/claude_cli.rs
@@ -20,7 +20,6 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::process::Stdio;
use std::sync::Arc;
-use std::time::Duration;
use serde::{Deserialize, Serialize};
use tauri::{AppHandle, Emitter, State};
@@ -28,7 +27,9 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::process::{Child, Command};
use tokio::sync::Mutex;
-use super::cli_resolver::{child_path_env, find_cli_command};
+use super::cli_resolver::{
+ child_path_env, cli_version_timeout_error, find_cli_command, CLI_VERSION_PROBE_TIMEOUT,
+};
const ISOLATED_MCP_CONFIG: &str = "{\"mcpServers\":{}}";
@@ -167,7 +168,7 @@ fn suppress_windows_console(_cmd: &mut Command) {
}
/// Locate `claude` on PATH and confirm it's runnable by calling
-/// `claude --version` with a short timeout. Cheap — safe to call on
+/// `claude --version` with a bounded timeout. Safe to call on
/// mount of the settings panel.
#[tauri::command]
pub async fn claude_cli_detect() -> Result<DetectResult, String> {
@@ -192,7 +193,8 @@ pub async fn claude_cli_detect() -> Result<DetectResult, String> {
if let Some(path_env) = child_path_env().await {
cmd.env("PATH", path_env);
}
- let output = tokio::time::timeout(Duration::from_secs(3), cmd.arg("--version").output()).await;
+ let output =
+ tokio::time::timeout(CLI_VERSION_PROBE_TIMEOUT, cmd.arg("--version").output()).await;
match output {
Ok(Ok(out)) if out.status.success() => {
@@ -235,7 +237,7 @@ pub async fn claude_cli_detect() -> Result<DetectResult, String> {
installed: false,
version: None,
path: Some(path_str),
- error: Some("`claude --version` timed out after 3s".to_string()),
+ error: Some(cli_version_timeout_error("claude")),
}),
}
}
diff --git a/src-tauri/src/commands/cli_resolver.rs b/src-tauri/src/commands/cli_resolver.rs
index 88b9f0b8..84c29c66 100644
--- a/src-tauri/src/commands/cli_resolver.rs
+++ b/src-tauri/src/commands/cli_resolver.rs
@@ -3,13 +3,38 @@ use std::path::PathBuf;
#[cfg(not(windows))]
use std::process::{Command, Stdio};
use std::sync::{Mutex, OnceLock};
-#[cfg(not(windows))]
use std::time::Duration;
#[cfg(not(windows))]
const LOGIN_SHELL_PATH_TIMEOUT: Duration = Duration::from_secs(10);
#[cfg(not(windows))]
const PATH_MARKER: char = '\x1e';
+pub(crate) const CLI_VERSION_PROBE_TIMEOUT: Duration = Duration::from_secs(10);
+
+pub(crate) fn cli_version_timeout_error(command: &str) -> String {
+ format!(
+ "`{command} --version` timed out after {}s",
+ CLI_VERSION_PROBE_TIMEOUT.as_secs()
+ )
+}
+
+#[cfg(test)]
+mod timeout_tests {
+ use super::{cli_version_timeout_error, CLI_VERSION_PROBE_TIMEOUT};
+
+ #[test]
+ fn cli_version_probe_allows_slow_windows_cold_starts() {
+ assert_eq!(CLI_VERSION_PROBE_TIMEOUT.as_secs(), 10);
+ assert_eq!(
+ cli_version_timeout_error("codex"),
+ "`codex --version` timed out after 10s"
+ );
+ assert_eq!(
+ cli_version_timeout_error("claude"),
+ "`claude --version` timed out after 10s"
+ );
+ }
+}
static RESOLVED_COMMANDS: OnceLock<Mutex<HashMap<String, PathBuf>>> = OnceLock::new();
diff --git a/src-tauri/src/commands/codex_cli.rs b/src-tauri/src/commands/codex_cli.rs
index 41d647b1..8a0e5092 100644
--- a/src-tauri/src/commands/codex_cli.rs
+++ b/src-tauri/src/commands/codex_cli.rs
@@ -19,7 +19,9 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
use tokio::process::{Child, Command};
use tokio::sync::Mutex;
-use super::cli_resolver::{child_path_env, find_cli_command};
+use super::cli_resolver::{
+ child_path_env, cli_version_timeout_error, find_cli_command, CLI_VERSION_PROBE_TIMEOUT,
+};
#[derive(Default)]
pub struct CodexCliState {
@@ -90,7 +92,8 @@ pub async fn codex_cli_detect() -> Result<DetectResult, String> {
if let Some(path_env) = child_path_env().await {
cmd.env("PATH", path_env);
}
- let output = tokio::time::timeout(Duration::from_secs(3), cmd.arg("--version").output()).await;
+ let output =
+ tokio::time::timeout(CLI_VERSION_PROBE_TIMEOUT, cmd.arg("--version").output()).await;
match output {
Ok(Ok(out)) if out.status.success() => {
@@ -125,7 +128,7 @@ pub async fn codex_cli_detect() -> Result<DetectResult, String> {
installed: false,
version: None,
path: Some(path_str),
- error: Some("`codex --version` timed out after 3s".to_string()),
+ error: Some(cli_version_timeout_error("codex")),
}),
}
}