Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(host): keep Windows plugin paths and commented disables

forwardxu8ed8aebe4ad7
diff --git a/host/src/agent/gear/connectors.rs b/host/src/agent/gear/connectors.rs
index 7528c1f3..c1fd6cb5 100644
--- a/host/src/agent/gear/connectors.rs
+++ b/host/src/agent/gear/connectors.rs
@@ -173,12 +173,12 @@ fn mcp_toml(text: &str) -> Vec<Named> {
if name.is_none() {
continue;
}
- if toml_value(trimmed, "enabled").as_deref() == Some("false") {
+ if super::toml_scalar(trimmed, "enabled").as_deref() == Some("false") {
disabled = true;
- } else if let Some(url) = toml_value(trimmed, "url") {
+ } else if let Some(url) = super::toml_scalar(trimmed, "url") {
detail = visible_url(&url);
} else if detail.is_empty()
- && let Some(command) = toml_value(trimmed, "command")
+ && let Some(command) = super::toml_scalar(trimmed, "command")
{
detail = keep_public(&split_command(&command));
}
@@ -207,13 +207,6 @@ fn toml_header(line: &str) -> Option<TomlTable> {
Some(TomlTable::Server(rest.to_owned()))
}
-fn toml_value(line: &str, key: &str) -> Option<String> {
- let rest = line.strip_prefix(key)?.trim_start();
- let rest = rest.strip_prefix('=')?.trim();
- let value = rest.trim().trim_matches(['"', '\'']).trim();
- (!value.is_empty()).then(|| value.to_owned())
-}
-
#[cfg(test)]
mod tests {
use super::*;
@@ -250,7 +243,7 @@ mod tests {
std::fs::create_dir_all(home.join(".codex")).expect("codex");
std::fs::write(
home.join(".codex/config.toml"),
- "[mcp_servers.github]\ncommand = \"github-mcp\"\nenabled = false\n\n[mcp_servers.docs]\nurl = \"https://alice:[email protected]/mcp?key=xyz\"\n\n[mcp_servers.docs.env]\nTOKEN = \"secret-token\"\n",
+ "[mcp_servers.github]\ncommand = \"github-mcp\"\nenabled = false # temporarily off\n\n[mcp_servers.docs]\nurl = \"https://alice:[email protected]/mcp?key=xyz\" # kept\n\n[mcp_servers.docs.env]\nTOKEN = \"secret-token\"\n",
)
.expect("toml");
let connectors = list("codex", &home);
diff --git a/host/src/agent/gear/mod.rs b/host/src/agent/gear/mod.rs
index 1fb67b79..c3468b45 100644
--- a/host/src/agent/gear/mod.rs
+++ b/host/src/agent/gear/mod.rs
@@ -99,3 +99,40 @@ pub(super) fn skipped_name(name: &str) -> bool {
pub(super) fn is_dir(path: &Path) -> bool {
std::fs::metadata(path).is_ok_and(|meta| meta.is_dir())
}
+
+/// `key = value` on one TOML line. A `#` comment after the value is not part of it.
+pub(super) fn toml_scalar(line: &str, key: &str) -> Option<String> {
+ let code = strip_toml_comment(line.trim());
+ let rest = code.strip_prefix(key)?.trim_start();
+ let rest = rest.strip_prefix('=')?.trim();
+ let value = rest.trim().trim_matches(['"', '\'']).trim();
+ (!value.is_empty()).then(|| value.to_owned())
+}
+
+/// Drops a trailing `#` comment. A `#` inside quotes stays.
+fn strip_toml_comment(line: &str) -> &str {
+ let mut quote = None;
+ let mut escaped = false;
+ for (i, c) in line.char_indices() {
+ if escaped {
+ escaped = false;
+ continue;
+ }
+ if c == '\\' && quote == Some('"') {
+ escaped = true;
+ continue;
+ }
+ if c == '"' || c == '\'' {
+ quote = match quote {
+ Some(open) if open == c => None,
+ None => Some(c),
+ other => other,
+ };
+ continue;
+ }
+ if c == '#' && quote.is_none() {
+ return line[..i].trim_end();
+ }
+ }
+ line
+}
diff --git a/host/src/agent/gear/plugins.rs b/host/src/agent/gear/plugins.rs
index ee4fe2e3..2bdf40d5 100644
--- a/host/src/agent/gear/plugins.rs
+++ b/host/src/agent/gear/plugins.rs
@@ -141,11 +141,7 @@ fn read_codex(home: &Path, out: &mut Vec<Named>) {
current = Some((name, market));
continue;
}
- if current.is_some()
- && trimmed
- .strip_prefix("enabled")
- .is_some_and(|rest| rest.trim().trim_start_matches('=').trim().trim_matches('"') == "false")
- {
+ if current.is_some() && super::toml_scalar(trimmed, "enabled").as_deref() == Some("false") {
disabled = true;
}
}
@@ -240,13 +236,15 @@ mod tests {
r#"{"name":"browser","description":"Drive a browser","token":"secret-token"}"#,
)
.expect("manifest");
- let index = format!(
- r#"{{"plugins":{{"browser@local":[{{"scope":"user","installPath":"{}"}}],"local-only@local":[{{"scope":"project","installPath":"{}"}}],"off@local":[{{"scope":"user","installPath":"{}"}}]}}}}"#,
- plug.display(),
- plug.display(),
- plug.display()
- );
- std::fs::write(home.join(".claude/plugins/installed_plugins.json"), index).expect("index");
+ let path = plug.to_string_lossy();
+ let index = serde_json::json!({
+ "plugins": {
+ "browser@local": [{ "scope": "user", "installPath": path }],
+ "local-only@local": [{ "scope": "project", "installPath": path }],
+ "off@local": [{ "scope": "user", "installPath": path }],
+ }
+ });
+ std::fs::write(home.join(".claude/plugins/installed_plugins.json"), index.to_string()).expect("index");
std::fs::write(
home.join(".claude/settings.json"),
r#"{"enabledPlugins":{"off@local":false,"browser@local":true}}"#,
@@ -269,7 +267,7 @@ mod tests {
std::fs::write(plug.join("plugin.json"), r#"{"name":"docs","description":"Write docs"}"#).expect("manifest");
std::fs::write(
home.join(".codex/config.toml"),
- "[plugins.\"docs@openai-bundled\"]\n\n[plugins.\"browser@openai-bundled\"]\nenabled = false\n\n[plugins.\"docs@openai-bundled\".env]\nTOKEN = \"secret-token\"\n",
+ "[plugins.\"docs@openai-bundled\"]\n\n[plugins.\"browser@openai-bundled\"]\nenabled = false # temporarily off\n\n[plugins.\"docs@openai-bundled\".env]\nTOKEN = \"secret-token\"\n",
)
.expect("config");
let plugins = list("codex", &home);