mirror of
https://github.com/storytold/craft-launcher.git
synced 2026-11-16 15:14:56 +00:00
Merge pull request #1432 from davidmann4/agents-gateway
feat(settings): AI agents reach every Craft app through one MCP entry, with the gateway shipped
This commit is contained in:
39 files changed
+1620
-20
No files matched your search
Generated
+59
-10
@@ -253,7 +253,7 @@ dependencies = [
|
||||
"objc2-foundation 0.3.2",
|
||||
"parking_lot",
|
||||
"percent-encoding",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
"wl-clipboard-rs",
|
||||
"x11rb",
|
||||
]
|
||||
@@ -310,11 +310,20 @@ dependencies = [
|
||||
"toml 1.1.8+spec-1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-mcp"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"craft-ai-mcp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "artcraft-launcher-native"
|
||||
version = "0.19.2"
|
||||
dependencies = [
|
||||
"artcraft-launcher-core",
|
||||
"craft-ai-agents",
|
||||
"craft-flags",
|
||||
"craft-update",
|
||||
"dirs 6.0.0",
|
||||
"dunce",
|
||||
@@ -892,7 +901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -979,6 +988,45 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-ai-agents"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-ai-integrations?rev=0d76ea02a06299a5a6eee1993863fbcafe9c2cc3#0d76ea02a06299a5a6eee1993863fbcafe9c2cc3"
|
||||
dependencies = [
|
||||
"dirs 7.0.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-ai-mcp"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-ai-integrations?rev=0d76ea02a06299a5a6eee1993863fbcafe9c2cc3#0d76ea02a06299a5a6eee1993863fbcafe9c2cc3"
|
||||
dependencies = [
|
||||
"craft-ai-agents",
|
||||
"dirs 7.0.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-atomic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=86d6e8c5b05a4dadc35ff1c8e5d2f992c687ee97#86d6e8c5b05a4dadc35ff1c8e5d2f992c687ee97"
|
||||
dependencies = [
|
||||
"rustix 1.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-flags"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=86d6e8c5b05a4dadc35ff1c8e5d2f992c687ee97#86d6e8c5b05a4dadc35ff1c8e5d2f992c687ee97"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"dirs 7.0.0",
|
||||
"toml_edit 0.25.17+spec-1.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "craft-fonts-build"
|
||||
version = "0.1.0"
|
||||
@@ -1259,7 +1307,7 @@ dependencies = [
|
||||
"libc",
|
||||
"option-ext",
|
||||
"redox_users",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1654,7 +1702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3624,7 +3672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4326,7 +4374,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.4.15",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4339,7 +4387,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.12.1",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4396,7 +4444,7 @@ dependencies = [
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"webpki-root-certs",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -4918,7 +4966,7 @@ dependencies = [
|
||||
"getrandom 0.4.3",
|
||||
"once_cell",
|
||||
"rustix 1.1.5",
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -5138,6 +5186,7 @@ dependencies = [
|
||||
"indexmap",
|
||||
"toml_datetime 1.1.2+spec-1.1.0",
|
||||
"toml_parser",
|
||||
"toml_writer",
|
||||
"winnow 1.0.4",
|
||||
]
|
||||
|
||||
@@ -5921,7 +5970,7 @@ version = "0.1.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -33,6 +33,11 @@ semver = { version = "1", features = ["serde"] }
|
||||
log = "0.4"
|
||||
# All date/time conversion goes through jiff (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md).
|
||||
jiff = "0.2"
|
||||
# Feature flags (craft-libs#1118, merged in craft-libs#1119).
|
||||
craft-flags = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "86d6e8c5b05a4dadc35ff1c8e5d2f992c687ee97" }
|
||||
# The agents switch and app list (Settings › AI agents), shared with the craft-ai-mcp gateway and
|
||||
# every Craft app. Pinned to the merge of storytold/craft-ai-integrations#197.
|
||||
craft-ai-agents = { git = "https://github.com/storytold/craft-ai-integrations", rev = "0d76ea02a06299a5a6eee1993863fbcafe9c2cc3" }
|
||||
craft-update = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "6e03f65bf45181db77ba6229716e6624db9eb25b" }
|
||||
craft-ui = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
[package]
|
||||
name = "artcraft-launcher-mcp"
|
||||
description = "The craft-ai-mcp gateway, built and shipped with the ArtCraft Launcher (Settings › AI agents)"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
publish = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "craft-ai-mcp"
|
||||
path = "src/main.rs"
|
||||
|
||||
# The gateway from storytold/craft-ai-integrations (crates/ai-mcp), pinned like the craft-libs crates.
|
||||
# Pinned to the merge of storytold/craft-ai-integrations#197.
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
craft-ai-mcp = { git = "https://github.com/storytold/craft-ai-integrations", rev = "0d76ea02a06299a5a6eee1993863fbcafe9c2cc3" }
|
||||
@@ -0,0 +1,15 @@
|
||||
//! `craft-ai-mcp`: the gateway through which MCP clients (Claude, Cursor, LM Studio) reach every
|
||||
//! installed Craft app. The ArtCraft Launcher ships it beside itself; Settings › AI agents copies
|
||||
//! it into `ArtCraft/mcp/bin` and registers that copy (`artcraft_launcher_native::agents`). The
|
||||
//! program itself is `craft_ai_mcp::cli` from storytold/craft-ai-integrations.
|
||||
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn main() -> std::process::ExitCode {
|
||||
craft_ai_mcp::cli::main(std::env::args().skip(1).collect())
|
||||
}
|
||||
|
||||
/// Desktop only: nothing to run in the browser build.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
fn main() {}
|
||||
@@ -12,6 +12,7 @@ pub mod details;
|
||||
pub mod distro;
|
||||
pub mod feed;
|
||||
pub mod hosted_catalog;
|
||||
pub mod mcp_config;
|
||||
pub mod platform;
|
||||
pub mod protocol;
|
||||
pub mod release;
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
//! The configuration an MCP client needs to start the `craft-ai-mcp` gateway, in each format
|
||||
//! clients use, for Settings › AI agents › Copy. Every format names the same one server.
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// The name the gateway's entry has in a client's configuration. Clients show it as the
|
||||
/// integration's name, so it is the suite's name.
|
||||
pub const SERVER_KEY: &str = "ArtCraft";
|
||||
|
||||
/// A configuration format MCP clients read.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub enum McpConfigFormat {
|
||||
/// `{"mcpServers": {...}}`: Claude Desktop, Cursor, LM Studio, Windsurf and most others.
|
||||
Json,
|
||||
/// VS Code's `mcp.json`: `{"servers": {...}}` with `"type": "stdio"`.
|
||||
VsCode,
|
||||
/// Codex's `config.toml`: a `[mcp_servers.<name>]` table.
|
||||
CodexToml,
|
||||
}
|
||||
|
||||
impl McpConfigFormat {
|
||||
/// Every format, in the order Settings offers them.
|
||||
pub const ALL: [McpConfigFormat; 3] = [McpConfigFormat::Json, McpConfigFormat::VsCode, McpConfigFormat::CodexToml];
|
||||
}
|
||||
|
||||
/// A TOML basic string: JSON's string escapes (`\\`, `\"`, `\uXXXX`) are valid TOML too.
|
||||
fn toml_string(s: &str) -> String {
|
||||
Value::String(s.to_string()).to_string()
|
||||
}
|
||||
|
||||
/// The configuration that starts `gateway --stdio` as [`SERVER_KEY`], in `format`.
|
||||
pub fn mcp_config(format: McpConfigFormat, gateway: &str) -> String {
|
||||
match format {
|
||||
McpConfigFormat::Json => {
|
||||
let v = json!({"mcpServers": {SERVER_KEY: {"command": gateway, "args": ["--stdio"]}}});
|
||||
serde_json::to_string_pretty(&v).unwrap_or_default()
|
||||
}
|
||||
McpConfigFormat::VsCode => {
|
||||
let v = json!({"servers": {SERVER_KEY: {"type": "stdio", "command": gateway, "args": ["--stdio"]}}});
|
||||
serde_json::to_string_pretty(&v).unwrap_or_default()
|
||||
}
|
||||
McpConfigFormat::CodexToml => {
|
||||
format!("[mcp_servers.{SERVER_KEY}]\ncommand = {}\nargs = [\"--stdio\"]\n", toml_string(gateway))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
const GW: &str = r"C:\Users\a b\AppData\Local\ArtCraft\mcp\bin\craft-ai-mcp.exe";
|
||||
|
||||
#[test]
|
||||
fn json_formats_name_the_gateway_with_stdio() {
|
||||
let v: Value = serde_json::from_str(&mcp_config(McpConfigFormat::Json, GW)).unwrap();
|
||||
assert_eq!(v["mcpServers"][SERVER_KEY]["command"], GW);
|
||||
assert_eq!(v["mcpServers"][SERVER_KEY]["args"], json!(["--stdio"]));
|
||||
let v: Value = serde_json::from_str(&mcp_config(McpConfigFormat::VsCode, GW)).unwrap();
|
||||
assert_eq!(v["servers"][SERVER_KEY]["type"], "stdio");
|
||||
assert_eq!(v["servers"][SERVER_KEY]["command"], GW);
|
||||
assert_eq!(v["servers"][SERVER_KEY]["args"], json!(["--stdio"]));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn codex_toml_escapes_the_path() {
|
||||
let t = mcp_config(McpConfigFormat::CodexToml, GW);
|
||||
assert!(t.starts_with("[mcp_servers.ArtCraft]\n"), "{t}");
|
||||
assert!(t.contains(r#"command = "C:\\Users\\a b\\AppData\\Local\\ArtCraft\\mcp\\bin\\craft-ai-mcp.exe""#), "{t}");
|
||||
assert!(t.contains("args = [\"--stdio\"]"), "{t}");
|
||||
let quoted = mcp_config(McpConfigFormat::CodexToml, "/opt/a\"b/craft-ai-mcp");
|
||||
assert!(quoted.contains(r#"command = "/opt/a\"b/craft-ai-mcp""#), "{quoted}");
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,23 @@ pub enum Command {
|
||||
},
|
||||
/// Change how the backend behaves.
|
||||
Configure(BackendOptions),
|
||||
|
||||
/// Ask for the AI agents state (the gateway, the switch, the MCP clients).
|
||||
McpState,
|
||||
/// Let AI agents use the Craft apps (writes the gateway's app list), or stop them (removes the
|
||||
/// list and the client entries the launcher added).
|
||||
McpSetAgents {
|
||||
enabled: bool,
|
||||
},
|
||||
/// Add the one gateway entry to an MCP client's configuration, or remove it.
|
||||
McpSetClient {
|
||||
client: McpClient,
|
||||
added: bool,
|
||||
},
|
||||
/// Quit an MCP client and start it again, so it loads the entry just added.
|
||||
McpRestartClient {
|
||||
client: McpClient,
|
||||
},
|
||||
}
|
||||
|
||||
/// Parent folders for new installs. Existing installations keep their recorded location.
|
||||
@@ -285,6 +302,52 @@ pub enum Event {
|
||||
/// GitHub refused more API calls until this time (Unix seconds).
|
||||
rate_limited_until: Option<i64>,
|
||||
},
|
||||
|
||||
/// The AI agents state: the gateway, the switch and the MCP clients. Sent when Settings asks,
|
||||
/// after detection and after any change.
|
||||
Mcp {
|
||||
agents: McpAgents,
|
||||
},
|
||||
/// An AI agents operation failed (e.g. writing a client configuration). Carries a short, user-facing
|
||||
/// message; the UI shows it as an error toast so a failed toggle is never silent.
|
||||
McpError {
|
||||
message: String,
|
||||
},
|
||||
}
|
||||
|
||||
/// An MCP client the launcher can add the gateway entry to.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum McpClient {
|
||||
ClaudeDesktop,
|
||||
ClaudeCode,
|
||||
Cursor,
|
||||
LmStudio,
|
||||
}
|
||||
|
||||
/// One MCP client on this machine: whether it looks installed, and whether our entry is in it.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct McpClientState {
|
||||
pub client: McpClient,
|
||||
pub name: String,
|
||||
pub installed: bool,
|
||||
pub added: bool,
|
||||
/// The launcher can quit and start it again ([`Command::McpRestartClient`]).
|
||||
pub restartable: bool,
|
||||
}
|
||||
|
||||
/// AI agents and the Craft apps: the `craft-ai-mcp` gateway (found beside the launcher?), the
|
||||
/// switch, and the MCP clients.
|
||||
#[derive(Clone, Debug, PartialEq, Default)]
|
||||
pub struct McpAgents {
|
||||
/// The `AI-MCP` feature flag: without it Settings shows nothing about agents.
|
||||
pub flag_on: bool,
|
||||
pub gateway_found: bool,
|
||||
pub enabled: bool,
|
||||
/// How many installed apps agents can reach (those with a CLI).
|
||||
pub apps: usize,
|
||||
pub clients: Vec<McpClientState>,
|
||||
/// The gateway clients start, while agents are on: what Copy puts in a configuration.
|
||||
pub gateway: Option<String>,
|
||||
}
|
||||
|
||||
/// What a backend can do on this platform.
|
||||
|
||||
@@ -18,6 +18,8 @@ local-mirror = []
|
||||
|
||||
[dependencies]
|
||||
artcraft-launcher-core = { workspace = true }
|
||||
craft-flags = { workspace = true }
|
||||
craft-ai-agents = { workspace = true }
|
||||
craft-update = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
@@ -0,0 +1,448 @@
|
||||
//! AI agents and the Craft apps: one switch in Settings, and one entry in each MCP client.
|
||||
//!
|
||||
//! With the switch on, the launcher writes the installed apps and their CLIs into
|
||||
//! `ArtCraft/mcp/apps.json` (the list the `craft-ai-mcp` gateway reads, see
|
||||
//! `docs/CRAFT-AI-MCP.md` in storytold/craft-ai-integrations), and can add one stdio entry,
|
||||
//! `ArtCraft` → `craft-ai-mcp --stdio`, to Claude Desktop, Claude Code, Cursor and LM Studio.
|
||||
//! Through that one entry an agent reaches every installed app, without one entry per app.
|
||||
//!
|
||||
//! Turning the switch off removes the list and the entries this module added. A client
|
||||
//! configuration that does not parse is never overwritten, and entries other than ours are kept.
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Mutex, MutexGuard, PoisonError};
|
||||
|
||||
use artcraft_launcher_core::protocol::{McpAgents, McpClient, McpClientState};
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
use artcraft_launcher_core::CraftApp;
|
||||
|
||||
use crate::detect;
|
||||
use crate::manifest::Manifest;
|
||||
|
||||
/// The key our entry has in a client's `mcpServers`.
|
||||
pub use artcraft_launcher_core::mcp_config::SERVER_KEY;
|
||||
/// The app list and its folder override, from `craft-ai-agents` (the one place that reads and
|
||||
/// writes them, for the launcher, the gateway and every app).
|
||||
pub use craft_ai_agents::{APPS_FILE, DIR_ENV};
|
||||
/// Largest client configuration read; anything bigger is not a configuration file.
|
||||
const MAX_CONFIG_BYTES: u64 = 64 << 20;
|
||||
|
||||
/// The app list's folder: [`DIR_ENV`], otherwise `ArtCraft/mcp` in the per-user local
|
||||
/// configuration folder (beside the AI layer's `ArtCraft/ai`).
|
||||
pub fn mcp_dir() -> Option<PathBuf> {
|
||||
craft_ai_agents::agents_dir()
|
||||
}
|
||||
|
||||
/// The app list for `services`: each app with a CLI, started as plain `<cli> mcp`. By the suite's
|
||||
/// rule that command works in the app's open window when the app runs and accepts agents, and
|
||||
/// headless otherwise, so no app needs other arguments. Apps without a CLI beside them are left out.
|
||||
pub fn app_entries(services: &[InstalledApp]) -> Vec<craft_ai_agents::AppEntry> {
|
||||
services
|
||||
.iter()
|
||||
.filter_map(|s| {
|
||||
let cli = s.cli_path.as_ref().filter(|p| p.is_absolute())?;
|
||||
Some(craft_ai_agents::AppEntry { id: s.id.clone(), name: s.name.clone(), command: cli.clone(), args: vec!["mcp".to_string()] })
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether agents are on: the app list exists in `dir`.
|
||||
pub fn enabled(dir: &Path) -> bool {
|
||||
craft_ai_agents::switched_on_in(dir)
|
||||
}
|
||||
|
||||
/// Write (or refresh) the app list in `dir`.
|
||||
pub fn write_apps(dir: &Path, services: &[InstalledApp]) -> Result<(), String> {
|
||||
craft_ai_agents::write(dir, &app_entries(services))
|
||||
}
|
||||
|
||||
/// Remove the app list in `dir`. A missing list is fine.
|
||||
pub fn remove_apps(dir: &Path) -> Result<(), String> {
|
||||
craft_ai_agents::remove(dir)
|
||||
}
|
||||
|
||||
/// Every client the launcher can add the entry to.
|
||||
pub const CLIENTS: [McpClient; 4] = [McpClient::ClaudeDesktop, McpClient::ClaudeCode, McpClient::Cursor, McpClient::LmStudio];
|
||||
|
||||
/// Where `client` keeps its MCP servers on this machine, and the folder whose presence shows the
|
||||
/// client is installed.
|
||||
pub fn client_paths(client: McpClient) -> Option<(PathBuf, PathBuf)> {
|
||||
let home = dirs::home_dir()?;
|
||||
Some(match client {
|
||||
McpClient::ClaudeDesktop => {
|
||||
let dir = claude_desktop_dir(dirs::config_dir()?, std::env::var_os("LOCALAPPDATA").map(PathBuf::from).as_deref());
|
||||
(dir.join("claude_desktop_config.json"), dir)
|
||||
}
|
||||
McpClient::ClaudeCode => (home.join(".claude.json"), home.join(".claude")),
|
||||
McpClient::Cursor => (home.join(".cursor").join("mcp.json"), home.join(".cursor")),
|
||||
McpClient::LmStudio => (home.join(".lmstudio").join("mcp.json"), home.join(".lmstudio")),
|
||||
})
|
||||
}
|
||||
|
||||
/// Claude Desktop's settings folder, where it reads `claude_desktop_config.json`, best first:
|
||||
/// 1. `%LOCALAPPDATA%\Claude-Data\<install>` (newest first): current Windows versions keep their
|
||||
/// data there, outside the Microsoft Store package, and say so in that folder's README.
|
||||
/// 2. `<config>/Claude` (`%APPDATA%\Claude`): the classic installer, and every other platform.
|
||||
/// 3. `%LOCALAPPDATA%\Packages\Claude_<id>\LocalCache\Roaming\Claude`: older Store versions, where
|
||||
/// Windows redirects the package's `%APPDATA%`. A folder whose data has moved on holds a
|
||||
/// `.user-data-left.*` marker and is skipped.
|
||||
///
|
||||
/// `local_appdata` is `None` outside Windows. With nothing found, the classic folder (not installed).
|
||||
fn claude_desktop_dir(config: PathBuf, local_appdata: Option<&Path>) -> PathBuf {
|
||||
let subdirs = |dir: PathBuf| -> Vec<PathBuf> {
|
||||
std::fs::read_dir(dir).map(|it| it.flatten().map(|e| e.path()).filter(|p| p.is_dir()).collect()).unwrap_or_default()
|
||||
};
|
||||
if let Some(local) = local_appdata {
|
||||
let mut data = subdirs(local.join("Claude-Data"));
|
||||
// Newest first; the name breaks ties so the choice is stable.
|
||||
data.sort_by_key(|d| (std::cmp::Reverse(std::fs::metadata(d).and_then(|m| m.modified()).ok()), d.clone()));
|
||||
if let Some(d) = data.into_iter().next() {
|
||||
return d;
|
||||
}
|
||||
}
|
||||
let classic = config.join("Claude");
|
||||
if classic.is_dir() {
|
||||
return classic;
|
||||
}
|
||||
let moved = |d: &Path| {
|
||||
std::fs::read_dir(d).map(|it| it.flatten().any(|e| e.file_name().to_string_lossy().starts_with(".user-data-left."))).unwrap_or(false)
|
||||
};
|
||||
let mut packaged: Vec<PathBuf> = local_appdata
|
||||
.map(|local| subdirs(local.join("Packages")))
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter(|p| p.file_name().is_some_and(|n| n.to_string_lossy().starts_with("Claude_")))
|
||||
.map(|p| p.join("LocalCache").join("Roaming").join("Claude"))
|
||||
.filter(|d| d.is_dir() && !moved(d))
|
||||
.collect();
|
||||
packaged.sort();
|
||||
packaged.into_iter().next().unwrap_or(classic)
|
||||
}
|
||||
|
||||
/// A client's display name.
|
||||
pub fn client_name(client: McpClient) -> &'static str {
|
||||
match client {
|
||||
McpClient::ClaudeDesktop => "Claude Desktop",
|
||||
McpClient::ClaudeCode => "Claude Code",
|
||||
McpClient::Cursor => "Cursor",
|
||||
McpClient::LmStudio => "LM Studio",
|
||||
}
|
||||
}
|
||||
|
||||
/// Read a client configuration: `Ok(None)` when it does not exist yet. A file that is not a JSON
|
||||
/// object is an error, so it is never replaced.
|
||||
fn read_config(path: &Path) -> Result<Option<Map<String, Value>>, String> {
|
||||
let meta = match std::fs::metadata(path) {
|
||||
Ok(m) => m,
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None),
|
||||
Err(e) => return Err(format!("couldn't read {} ({e})", path.display())),
|
||||
};
|
||||
if !meta.is_file() || meta.len() > MAX_CONFIG_BYTES {
|
||||
return Err(format!("{} is not a configuration file the launcher can change", path.display()));
|
||||
}
|
||||
let bytes = std::fs::read(path).map_err(|e| format!("couldn't read {} ({e})", path.display()))?;
|
||||
// An empty file is a fresh configuration.
|
||||
if bytes.iter().all(u8::is_ascii_whitespace) {
|
||||
return Ok(Some(Map::new()));
|
||||
}
|
||||
match serde_json::from_slice::<Value>(&bytes) {
|
||||
Ok(Value::Object(m)) => Ok(Some(m)),
|
||||
Ok(_) | Err(_) => Err(format!("{} is not valid JSON; the launcher leaves it unchanged", path.display())),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether this is the uncustomized entry for the launcher's stable gateway copy.
|
||||
/// A matching filename alone is not ownership: preserve other paths and client options.
|
||||
fn ours(entry: &Value, gateway: &Path) -> bool {
|
||||
let Value::Object(e) = entry else {
|
||||
return false;
|
||||
};
|
||||
let command_is_gateway = e.get("command").and_then(Value::as_str).is_some_and(|c| Path::new(c).is_absolute() && Path::new(c) == gateway);
|
||||
let no_env = match e.get("env") {
|
||||
None => true,
|
||||
Some(Value::Object(env)) => env.is_empty(),
|
||||
Some(_) => false,
|
||||
};
|
||||
let no_custom_options = e.keys().all(|k| matches!(k.as_str(), "command" | "args" | "env"));
|
||||
command_is_gateway && e.get("args") == Some(&json!(["--stdio"])) && no_env && no_custom_options
|
||||
}
|
||||
|
||||
/// Whether `config` holds our entry (not merely some entry named [`SERVER_KEY`]).
|
||||
pub fn registered(config: &Path, gateway: &Path) -> bool {
|
||||
matches!(read_config(config), Ok(Some(m)) if m.get("mcpServers").and_then(|s| s.get(SERVER_KEY)).is_some_and(|e| ours(e, gateway)))
|
||||
}
|
||||
|
||||
/// Add (or update) our entry in the client configuration at `config`, starting `gateway`.
|
||||
/// Everything else in the file is kept. An entry named [`SERVER_KEY`] that the launcher did not
|
||||
/// write is an error, so a person's own configuration is never replaced.
|
||||
pub fn register(config: &Path, gateway: &Path) -> Result<(), String> {
|
||||
let mut root = read_config(config)?.unwrap_or_default();
|
||||
let servers = root.entry("mcpServers").or_insert_with(|| Value::Object(Map::new()));
|
||||
let Value::Object(servers) = servers else {
|
||||
return Err(format!("`mcpServers` in {} is not an object; the launcher leaves it unchanged", config.display()));
|
||||
};
|
||||
if servers.get(SERVER_KEY).is_some_and(|e| !ours(e, gateway)) {
|
||||
return Err(format!(
|
||||
"{} already has its own `{SERVER_KEY}` entry; the launcher leaves it unchanged. Rename or remove it to add the launcher's",
|
||||
config.display()
|
||||
));
|
||||
}
|
||||
servers.insert(SERVER_KEY.to_string(), json!({"command": gateway.to_string_lossy(), "args": ["--stdio"]}));
|
||||
let text = serde_json::to_string_pretty(&Value::Object(root)).map_err(|e| e.to_string())?;
|
||||
crate::paths::write_atomic(config, text.as_bytes())
|
||||
}
|
||||
|
||||
/// Remove our entry from the client configuration at `config`. Nothing to do when the file or
|
||||
/// our entry is missing; an entry named [`SERVER_KEY`] the launcher did not write is kept.
|
||||
pub fn unregister(config: &Path, gateway: &Path) -> Result<(), String> {
|
||||
let Some(mut root) = read_config(config)? else {
|
||||
return Ok(());
|
||||
};
|
||||
let removed = match root.get_mut("mcpServers") {
|
||||
Some(Value::Object(servers)) if servers.get(SERVER_KEY).is_some_and(|e| ours(e, gateway)) => servers.remove(SERVER_KEY).is_some(),
|
||||
_ => false,
|
||||
};
|
||||
if !removed {
|
||||
return Ok(());
|
||||
}
|
||||
let text = serde_json::to_string_pretty(&Value::Object(root)).map_err(|e| e.to_string())?;
|
||||
crate::paths::write_atomic(config, text.as_bytes())
|
||||
}
|
||||
|
||||
/// An installed Craft app, with the CLI beside it that serves MCP (`<app>-cli mcp`).
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct InstalledApp {
|
||||
/// The app id (`wordcraft`), stable across versions.
|
||||
pub id: String,
|
||||
/// Display name (`WordCraft`).
|
||||
pub name: String,
|
||||
/// The detected main executable; the CLI lives beside it.
|
||||
pub location: String,
|
||||
/// The `-cli` binary. `None` when detection found the app but no CLI beside it.
|
||||
pub cli_path: Option<PathBuf>,
|
||||
}
|
||||
|
||||
/// Every installed Craft app, in suite order. Detection decides what is installed; this adds the
|
||||
/// CLI each app serves MCP from.
|
||||
pub fn installed_apps(manifest: &Manifest, snapshot: &detect::Snapshot) -> Vec<InstalledApp> {
|
||||
artcraft_launcher_core::SUITE
|
||||
.iter()
|
||||
.filter_map(|app| {
|
||||
let installed = detect::detect(app, manifest, snapshot)?;
|
||||
Some(InstalledApp {
|
||||
id: app.id.to_string(),
|
||||
name: app.name.to_string(),
|
||||
location: installed.location.clone(),
|
||||
cli_path: cli_path_for(&installed.location, app),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The `-cli` binary beside a detected main executable, under any name the app has shipped as
|
||||
/// (current first), with or without `.exe`.
|
||||
fn cli_path_for(location: &str, app: &CraftApp) -> Option<PathBuf> {
|
||||
let dir = Path::new(location).parent()?;
|
||||
for stem in app.stems() {
|
||||
for ext in ["", ".exe"] {
|
||||
let candidate = dir.join(format!("{stem}-cli{ext}"));
|
||||
if candidate.is_file() {
|
||||
return Some(candidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Names another `craft-ai-mcp` than the one beside the launcher (development, tests).
|
||||
pub const GATEWAY_PATH_ENV: &str = "ARTCRAFT_LAUNCHER_GATEWAY_PATH";
|
||||
|
||||
/// The `craft-ai-mcp` gateway the launcher ships beside itself, or [`GATEWAY_PATH_ENV`].
|
||||
pub fn locate_gateway() -> Option<PathBuf> {
|
||||
if let Some(p) = std::env::var_os(GATEWAY_PATH_ENV).filter(|p| !p.is_empty()) {
|
||||
let p = PathBuf::from(p);
|
||||
return p.is_file().then_some(p);
|
||||
}
|
||||
let dir = std::env::current_exe().ok()?.parent()?.to_path_buf();
|
||||
["craft-ai-mcp.exe", "craft-ai-mcp"].into_iter().map(|n| dir.join(n)).find(|p| p.is_file())
|
||||
}
|
||||
|
||||
/// The folder in [`mcp_dir`] that holds the gateway copy clients start.
|
||||
pub const GATEWAY_DIR: &str = "bin";
|
||||
|
||||
/// Where the gateway copy lives in `dir`.
|
||||
pub fn gateway_copy(dir: &Path) -> PathBuf {
|
||||
dir.join(GATEWAY_DIR).join(format!("craft-ai-mcp{}", std::env::consts::EXE_SUFFIX))
|
||||
}
|
||||
|
||||
/// Copy the shipped gateway `src` into `dir`, so client configurations name a path that stays
|
||||
/// valid: not one inside an AppImage mount that goes away when the launcher quits, a Flatpak
|
||||
/// sandbox path host clients can't run, or a folder an update or a move replaces. An existing
|
||||
/// copy of the same size that is not older than `src` is kept. A copy a client is running can't
|
||||
/// be replaced on Windows; then the existing copy is used and refreshed later.
|
||||
pub fn install_gateway(src: &Path, dir: &Path) -> Result<PathBuf, String> {
|
||||
let dest = gateway_copy(dir);
|
||||
let current = match (std::fs::metadata(src), std::fs::metadata(&dest)) {
|
||||
// Same size: compare the bytes (a shipped build can keep an older timestamp).
|
||||
(Ok(a), Ok(b)) => a.len() == b.len() && matches!((std::fs::read(src), std::fs::read(&dest)), (Ok(x), Ok(y)) if x == y),
|
||||
(Err(e), _) => return Err(format!("couldn't read the Craft gateway at {} ({e})", src.display())),
|
||||
_ => false,
|
||||
};
|
||||
if !current {
|
||||
let bytes = std::fs::read(src).map_err(|e| format!("couldn't read the Craft gateway at {} ({e})", src.display()))?;
|
||||
match crate::paths::write_atomic(&dest, &bytes) {
|
||||
Ok(()) => {}
|
||||
// A client still running the old copy keeps it busy on Windows: keep using it.
|
||||
Err(_) if dest.is_file() => {}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
}
|
||||
// Also for a copy with the right bytes: one that lost its execute bit couldn't be started.
|
||||
make_executable(&dest)?;
|
||||
Ok(dest)
|
||||
}
|
||||
|
||||
/// Make the gateway copy executable for everyone who may run it (`0755`) when it isn't already.
|
||||
#[cfg(unix)]
|
||||
fn make_executable(path: &Path) -> Result<(), String> {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let mode = std::fs::metadata(path).map_err(|e| format!("couldn't read {} ({e})", path.display()))?.permissions().mode();
|
||||
if mode & 0o111 == 0o111 {
|
||||
return Ok(());
|
||||
}
|
||||
std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755)).map_err(|e| format!("couldn't make {} executable ({e})", path.display()))
|
||||
}
|
||||
|
||||
/// Windows has no execute bit.
|
||||
#[cfg(not(unix))]
|
||||
fn make_executable(_path: &Path) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Serialises every change to the app list and the gateway copy. Detection refreshes them on a
|
||||
/// background thread while Settings may be turning agents off; without this, a refresh that
|
||||
/// read "on" just before the switch could write the list back after it was removed.
|
||||
static LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
fn lock() -> MutexGuard<'static, ()> {
|
||||
LOCK.lock().unwrap_or_else(PoisonError::into_inner)
|
||||
}
|
||||
|
||||
/// What Settings shows. While agents are on, the app list and the gateway copy are refreshed
|
||||
/// first, so an app installed (or a gateway updated) since then is used too; a failed refresh
|
||||
/// keeps the previous ones.
|
||||
pub fn state(services: &[InstalledApp]) -> McpAgents {
|
||||
let flag_on = flag_on();
|
||||
let dir = mcp_dir();
|
||||
let on = {
|
||||
let _guard = lock();
|
||||
let on = flag_on && dir.as_deref().is_some_and(enabled);
|
||||
if on && let Some(d) = &dir {
|
||||
let _ = write_apps(d, services);
|
||||
if let Some(src) = locate_gateway() {
|
||||
let _ = install_gateway(&src, d);
|
||||
}
|
||||
}
|
||||
on
|
||||
};
|
||||
let clients = CLIENTS
|
||||
.iter()
|
||||
.map(|c| {
|
||||
let paths = client_paths(*c);
|
||||
McpClientState {
|
||||
client: *c,
|
||||
name: client_name(*c).to_string(),
|
||||
installed: paths.as_ref().is_some_and(|(config, folder)| folder.is_dir() || config.is_file()),
|
||||
added: paths.as_ref().is_some_and(|(config, _)| dir.as_deref().is_some_and(|d| registered(config, &gateway_copy(d)))),
|
||||
restartable: restartable(*c),
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let gateway = dir.as_deref().filter(|_| on).map(gateway_copy).filter(|p| p.is_file()).map(|p| p.to_string_lossy().into_owned());
|
||||
McpAgents {
|
||||
flag_on,
|
||||
gateway_found: locate_gateway().is_some(),
|
||||
enabled: on,
|
||||
gateway,
|
||||
apps: services.iter().filter(|s| s.cli_path.as_ref().is_some_and(|p| p.is_absolute())).count(),
|
||||
clients,
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the `AI-MCP` feature flag is on (`ArtCraft/flags.toml`, `CRAFT_FLAGS`).
|
||||
pub fn flag_on() -> bool {
|
||||
craft_flags::load().enabled(&craft_flags::AI_MCP)
|
||||
}
|
||||
|
||||
const NO_FLAG: &str = "the AI-MCP feature flag is off (ArtCraft/flags.toml or CRAFT_FLAGS)";
|
||||
|
||||
const NO_GATEWAY: &str = "the Craft gateway (craft-ai-mcp) is not installed beside the launcher";
|
||||
|
||||
/// Turn agents on (copy the gateway, write the app list) or off (remove the list, every client
|
||||
/// entry this module added, and the copy). All clients are tried; the first error is returned.
|
||||
pub fn set_enabled(on: bool, services: &[InstalledApp]) -> Result<(), String> {
|
||||
let dir = mcp_dir().ok_or("couldn't find the per-user configuration folder")?;
|
||||
let _guard = lock();
|
||||
if on {
|
||||
if !flag_on() {
|
||||
return Err(NO_FLAG.into());
|
||||
}
|
||||
let src = locate_gateway().ok_or(NO_GATEWAY)?;
|
||||
install_gateway(&src, &dir)?;
|
||||
return write_apps(&dir, services);
|
||||
}
|
||||
let mut first_error = remove_apps(&dir).err();
|
||||
for c in CLIENTS {
|
||||
if let Some((config, _)) = client_paths(c)
|
||||
&& let Err(e) = unregister(&config, &gateway_copy(&dir))
|
||||
{
|
||||
first_error.get_or_insert(e);
|
||||
}
|
||||
}
|
||||
// A client still running the copy keeps it busy on Windows; it goes next time.
|
||||
let _ = std::fs::remove_file(gateway_copy(&dir));
|
||||
first_error.map_or(Ok(()), Err)
|
||||
}
|
||||
|
||||
/// Add the gateway entry to `client`, or remove it. Adding needs agents on; the entry names the
|
||||
/// gateway copy in [`mcp_dir`].
|
||||
pub fn set_client(client: McpClient, added: bool) -> Result<(), String> {
|
||||
let (config, _) = client_paths(client).ok_or("couldn't find the home folder")?;
|
||||
let dir = mcp_dir().ok_or("couldn't find the per-user configuration folder")?;
|
||||
if !added {
|
||||
return unregister(&config, &gateway_copy(&dir));
|
||||
}
|
||||
if !flag_on() {
|
||||
return Err(NO_FLAG.into());
|
||||
}
|
||||
let _guard = lock();
|
||||
if !enabled(&dir) {
|
||||
return Err("turn on \"Let AI agents use Craft apps\" first".into());
|
||||
}
|
||||
let copy = gateway_copy(&dir);
|
||||
let gateway = match locate_gateway() {
|
||||
Some(src) => install_gateway(&src, &dir)?,
|
||||
None if copy.is_file() => copy,
|
||||
None => return Err(NO_GATEWAY.into()),
|
||||
};
|
||||
register(&config, &gateway)
|
||||
}
|
||||
|
||||
/// Whether the launcher can restart `client` here: Claude Desktop on Windows and macOS. The other
|
||||
/// clients are left to the person (Claude Code runs in their terminal sessions).
|
||||
pub fn restartable(client: McpClient) -> bool {
|
||||
client == McpClient::ClaudeDesktop && (cfg!(windows) || cfg!(target_os = "macos"))
|
||||
}
|
||||
|
||||
/// Quit `client` and start it again, so it loads the entry just added.
|
||||
pub fn restart_client(client: McpClient) -> Result<(), String> {
|
||||
if !restartable(client) {
|
||||
return Err(format!("the launcher can't restart {} here; restart it yourself", client_name(client)));
|
||||
}
|
||||
crate::process::restart_claude_desktop()
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "agents_tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,264 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
|
||||
fn service(id: &str, name: &str, cli: Option<PathBuf>) -> InstalledApp {
|
||||
InstalledApp { id: id.into(), name: name.into(), location: String::new(), cli_path: cli }
|
||||
}
|
||||
|
||||
fn read(p: &Path) -> Value {
|
||||
serde_json::from_slice(&std::fs::read(p).unwrap()).unwrap()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_app_list_has_every_app_with_a_cli_started_as_plain_mcp() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let cli = |name: &str| dir.path().join(name);
|
||||
let services = [
|
||||
service("photocraft", "PhotoCraft", Some(cli("photocraft-cli.exe"))),
|
||||
service("vectorcraft", "VectorCraft", Some(cli("vectorcraft-cli.exe"))),
|
||||
service("wordcraft", "WordCraft", None),
|
||||
service("relcraft", "RelCraft", Some(PathBuf::from("relative/cli"))),
|
||||
];
|
||||
let apps = app_entries(&services);
|
||||
assert_eq!(apps.len(), 2, "apps without an absolute CLI are left out");
|
||||
assert_eq!((apps[0].id.as_str(), apps[0].name.as_str()), ("photocraft", "PhotoCraft"));
|
||||
assert_eq!(apps[0].command, cli("photocraft-cli.exe"));
|
||||
// Every app's plain `mcp` works in its open window when it may: no per-app arguments.
|
||||
assert!(apps.iter().all(|a| a.args == ["mcp"]), "{apps:?}");
|
||||
// Written in the gateway's format, which the gateway reads back the same.
|
||||
let list = dir.path().join("list");
|
||||
write_apps(&list, &services).unwrap();
|
||||
let (back, skipped) = craft_ai_agents::load(&list).unwrap().unwrap();
|
||||
assert!(skipped.is_empty(), "{skipped:?}");
|
||||
assert_eq!(back, apps);
|
||||
let v = read(&list.join(APPS_FILE));
|
||||
assert_eq!(v["version"], 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn claude_desktop_from_the_microsoft_store_is_found_in_its_package() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let (config, local) = (dir.path().join("Roaming"), dir.path().join("Local"));
|
||||
assert_eq!(claude_desktop_dir(config.clone(), Some(&local)), config.join("Claude"), "nothing installed: the usual place");
|
||||
let packaged = local.join("Packages").join("Claude_pzs8sxrjxfjjc").join("LocalCache").join("Roaming").join("Claude");
|
||||
std::fs::create_dir_all(&packaged).unwrap();
|
||||
std::fs::create_dir_all(local.join("Packages").join("Other_123")).unwrap();
|
||||
assert_eq!(claude_desktop_dir(config.clone(), Some(&local)), packaged, "only an older Store package");
|
||||
std::fs::create_dir_all(config.join("Claude")).unwrap();
|
||||
assert_eq!(claude_desktop_dir(config.clone(), Some(&local)), config.join("Claude"), "the classic install wins over the package");
|
||||
assert_eq!(claude_desktop_dir(config.clone(), None), config.join("Claude"));
|
||||
}
|
||||
|
||||
/// Current Windows versions keep their data in `%LOCALAPPDATA%\Claude-Data\<install>` and leave a
|
||||
/// marker in the package folder they moved out of: the config there is no longer read.
|
||||
#[test]
|
||||
fn claude_desktop_data_moved_to_claude_data_is_used() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let (config, local) = (dir.path().join("Roaming"), dir.path().join("Local"));
|
||||
let packaged = local.join("Packages").join("Claude_pzs8sxrjxfjjc").join("LocalCache").join("Roaming").join("Claude");
|
||||
std::fs::create_dir_all(&packaged).unwrap();
|
||||
std::fs::write(packaged.join(".user-data-left.claude_pzs8sxrjxfjjc"), "{}").unwrap();
|
||||
assert_eq!(claude_desktop_dir(config.clone(), Some(&local)), config.join("Claude"), "a package folder the data left is skipped");
|
||||
std::fs::create_dir_all(config.join("Claude")).unwrap();
|
||||
let data = local.join("Claude-Data").join("claude_pzs8sxrjxfjjc");
|
||||
std::fs::create_dir_all(&data).unwrap();
|
||||
std::fs::write(local.join("Claude-Data").join("README.txt"), "x").unwrap();
|
||||
assert_eq!(claude_desktop_dir(config.clone(), Some(&local)), data, "Claude-Data wins, its README is no install");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn switching_on_and_off() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
assert!(!enabled(dir.path()));
|
||||
write_apps(dir.path(), &[]).unwrap();
|
||||
assert!(enabled(dir.path()));
|
||||
remove_apps(dir.path()).unwrap();
|
||||
assert!(!enabled(dir.path()));
|
||||
remove_apps(dir.path()).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_broken_app_list_does_not_grant_agents_access() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
write_apps(dir.path(), &[]).unwrap();
|
||||
assert!(enabled(dir.path()));
|
||||
std::fs::write(dir.path().join(APPS_FILE), b"not json").unwrap();
|
||||
assert!(!enabled(dir.path()));
|
||||
std::fs::write(dir.path().join(APPS_FILE), br#"{"version":999,"apps":[]}"#).unwrap();
|
||||
assert!(!enabled(dir.path()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn register_creates_a_config_and_keeps_other_servers_and_keys() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let fresh = dir.path().join("new").join("mcp.json");
|
||||
let gw = dir.path().join(format!("craft-ai-mcp{}", std::env::consts::EXE_SUFFIX));
|
||||
register(&fresh, &gw).unwrap();
|
||||
assert_eq!(read(&fresh)["mcpServers"][SERVER_KEY]["args"], json!(["--stdio"]));
|
||||
assert!(registered(&fresh, &gw));
|
||||
|
||||
let existing = dir.path().join("claude.json");
|
||||
std::fs::write(&existing, r#"{"theme":"dark","mcpServers":{"other":{"command":"x"}}}"#).unwrap();
|
||||
register(&existing, &gw).unwrap();
|
||||
let v = read(&existing);
|
||||
assert_eq!(v["theme"], "dark");
|
||||
assert_eq!(v["mcpServers"]["other"]["command"], "x");
|
||||
assert_eq!(v["mcpServers"][SERVER_KEY]["command"], gw.to_string_lossy().as_ref());
|
||||
|
||||
unregister(&existing, &gw).unwrap();
|
||||
let v = read(&existing);
|
||||
assert!(v["mcpServers"].get(SERVER_KEY).is_none());
|
||||
assert_eq!(v["mcpServers"]["other"]["command"], "x");
|
||||
assert!(!registered(&existing, &gw));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_broken_config_is_never_overwritten() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let gw = dir.path().join("craft-ai-mcp");
|
||||
for (name, text) in [("bad.json", "{ not json"), ("array.json", "[1,2]"), ("servers.json", r#"{"mcpServers":[1]}"#)] {
|
||||
let p = dir.path().join(name);
|
||||
std::fs::write(&p, text).unwrap();
|
||||
assert!(register(&p, &gw).is_err(), "{name}");
|
||||
assert_eq!(std::fs::read_to_string(&p).unwrap(), text, "{name} changed");
|
||||
}
|
||||
let bad = dir.path().join("bad.json");
|
||||
assert!(unregister(&bad, &gw).is_err());
|
||||
assert!(!registered(&bad, &gw));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_empty_config_counts_as_fresh_and_a_missing_one_needs_no_unregister() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let p = dir.path().join("empty.json");
|
||||
std::fs::write(&p, " \n").unwrap();
|
||||
let gw = gateway_copy(dir.path());
|
||||
register(&p, &gw).unwrap();
|
||||
assert!(registered(&p, &gw));
|
||||
unregister(&dir.path().join("missing.json"), &gw).unwrap();
|
||||
assert!(!dir.path().join("missing.json").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unregister_leaves_a_file_without_our_entry_untouched() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let gw = gateway_copy(dir.path());
|
||||
let p = dir.path().join("c.json");
|
||||
let text = "{\"mcpServers\": {\"other\": {}}}";
|
||||
std::fs::write(&p, text).unwrap();
|
||||
unregister(&p, &gw).unwrap();
|
||||
assert_eq!(std::fs::read_to_string(&p).unwrap(), text);
|
||||
}
|
||||
|
||||
/// A person's own `ArtCraft` entry (another command, other arguments, its own environment) is
|
||||
/// never replaced by Add, and neither Remove nor turning agents off deletes it.
|
||||
#[test]
|
||||
fn an_artcraft_entry_the_launcher_did_not_write_is_kept() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let gw = dir.path().join(format!("craft-ai-mcp{}", std::env::consts::EXE_SUFFIX));
|
||||
let theirs = [
|
||||
json!({"command": "node", "args": ["my-artcraft.js"]}),
|
||||
json!({"url": "http://localhost:9000/mcp"}),
|
||||
json!({"command": gw.to_string_lossy(), "args": ["--stdio", "--verbose"]}),
|
||||
json!({"command": gw.to_string_lossy(), "args": ["--stdio"], "env": {"TOKEN": "x"}}),
|
||||
json!({"command": dir.path().join("elsewhere").join(gw.file_name().unwrap()), "args": ["--stdio"]}),
|
||||
json!({"command": gw.to_string_lossy(), "args": ["--stdio"], "cwd": "/custom"}),
|
||||
json!({"command": gw.to_string_lossy(), "args": ["--stdio"], "disabled": true}),
|
||||
json!({"command": gw.to_string_lossy(), "args": ["--stdio"], "timeout": 42}),
|
||||
json!("not an object"),
|
||||
];
|
||||
for (i, entry) in theirs.iter().enumerate() {
|
||||
let p = dir.path().join(format!("c{i}.json"));
|
||||
let text = serde_json::to_string_pretty(&json!({"mcpServers": {SERVER_KEY: entry}})).unwrap();
|
||||
std::fs::write(&p, &text).unwrap();
|
||||
assert!(!registered(&p, &gw), "{entry}");
|
||||
assert!(register(&p, &gw).is_err(), "{entry}");
|
||||
unregister(&p, &gw).unwrap();
|
||||
assert_eq!(std::fs::read_to_string(&p).unwrap(), text, "{entry} changed");
|
||||
}
|
||||
|
||||
// The exact stable gateway entry, with an empty environment a client may add, is ours.
|
||||
let p = dir.path().join("ours.json");
|
||||
std::fs::write(&p, json!({"mcpServers": {SERVER_KEY: {"command": gw.to_string_lossy(), "args": ["--stdio"], "env": {}}}}).to_string()).unwrap();
|
||||
assert!(registered(&p, &gw));
|
||||
register(&p, &gw).unwrap();
|
||||
assert_eq!(read(&p)["mcpServers"][SERVER_KEY]["command"], gw.to_string_lossy().as_ref());
|
||||
unregister(&p, &gw).unwrap();
|
||||
assert!(read(&p)["mcpServers"].get(SERVER_KEY).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_folder_in_place_of_the_config_is_an_error() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let p = dir.path().join("mcp.json");
|
||||
std::fs::create_dir(&p).unwrap();
|
||||
assert!(register(&p, &dir.path().join("gw")).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_client_has_a_name_and_paths() {
|
||||
for c in CLIENTS {
|
||||
assert!(!client_name(c).is_empty());
|
||||
if let Some((config, folder)) = client_paths(c) {
|
||||
assert!(config.is_absolute() && folder.is_absolute());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_gateway_is_copied_once_and_refreshed_when_it_changes() {
|
||||
let src_dir = tempfile::tempdir().unwrap();
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let src = src_dir.path().join("craft-ai-mcp");
|
||||
std::fs::write(&src, b"v1").unwrap();
|
||||
let copy = install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(copy, gateway_copy(dir.path()));
|
||||
assert!(copy.starts_with(dir.path()), "clients get a path in the launcher's folder, not the shipped one");
|
||||
assert_eq!(std::fs::read(©).unwrap(), b"v1");
|
||||
// Unchanged: kept as is.
|
||||
let before = std::fs::metadata(©).unwrap().modified().unwrap();
|
||||
install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(std::fs::metadata(©).unwrap().modified().unwrap(), before);
|
||||
// An update of another size replaces it.
|
||||
std::fs::write(&src, b"version 2").unwrap();
|
||||
install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(std::fs::read(©).unwrap(), b"version 2");
|
||||
// No source: an error, not a panic.
|
||||
assert!(install_gateway(&src_dir.path().join("missing"), dir.path()).is_err());
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn the_gateway_copy_is_executable() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let src_dir = tempfile::tempdir().unwrap();
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let src = src_dir.path().join("craft-ai-mcp");
|
||||
std::fs::write(&src, b"#!/bin/sh\n").unwrap();
|
||||
let copy = install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(std::fs::metadata(©).unwrap().permissions().mode() & 0o111, 0o111);
|
||||
// A copy with the right bytes that lost its execute bit gets it back instead of being reused
|
||||
// as it is: clients couldn't start it.
|
||||
std::fs::set_permissions(©, std::fs::Permissions::from_mode(0o644)).unwrap();
|
||||
let again = install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(std::fs::metadata(again).unwrap().permissions().mode() & 0o111, 0o111);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_gateway_of_the_same_size_but_other_bytes_replaces_the_copy() {
|
||||
let src_dir = tempfile::tempdir().unwrap();
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let src = src_dir.path().join("craft-ai-mcp");
|
||||
std::fs::write(&src, b"aaaa").unwrap();
|
||||
let copy = install_gateway(&src, dir.path()).unwrap();
|
||||
// A new build of the same size whose timestamp is older than the copy.
|
||||
std::fs::write(&src, b"bbbb").unwrap();
|
||||
let old = std::fs::File::options().write(true).open(&src).unwrap();
|
||||
old.set_modified(std::time::SystemTime::UNIX_EPOCH + std::time::Duration::from_secs(1_000_000)).unwrap();
|
||||
drop(old);
|
||||
install_gateway(&src, dir.path()).unwrap();
|
||||
assert_eq!(std::fs::read(©).unwrap(), b"bbbb");
|
||||
}
|
||||
@@ -357,6 +357,11 @@ impl NativeBackend {
|
||||
for app in artcraft_launcher_core::hosted_catalog::apps().iter().filter(|a| platform.is_none_or(|p| a.runs_on(p.os))) {
|
||||
report_partial(app, &shared, &paths, platform);
|
||||
}
|
||||
// Local MCP state: which installed apps can be exposed + the unified bridge.
|
||||
{
|
||||
let _mcp = MCP_WORK.lock().unwrap_or_else(PoisonError::into_inner);
|
||||
shared.emit(mcp_state(&shared));
|
||||
}
|
||||
drop(busy);
|
||||
});
|
||||
}
|
||||
@@ -1617,6 +1622,12 @@ impl Backend for NativeBackend {
|
||||
self.check(true);
|
||||
}
|
||||
}
|
||||
cmd @ (Command::McpState | Command::McpSetAgents { .. } | Command::McpSetClient { .. } | Command::McpRestartClient { .. }) => {
|
||||
// Detection can run package-manager queries for seconds (flatpak on Linux):
|
||||
// never on the UI thread that sends commands.
|
||||
let shared = self.shared.clone();
|
||||
std::thread::spawn(move || run_mcp(&shared, cmd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1651,6 +1662,44 @@ impl Backend for NativeBackend {
|
||||
}
|
||||
}
|
||||
|
||||
/// The AI agents state, from a fresh detection of the installed apps.
|
||||
fn mcp_state(shared: &Shared) -> Event {
|
||||
mcp_state_for(&detected_apps(shared))
|
||||
}
|
||||
|
||||
/// [`mcp_state`] for apps already detected.
|
||||
fn mcp_state_for(detected: &[crate::agents::InstalledApp]) -> Event {
|
||||
Event::Mcp { agents: crate::agents::state(detected) }
|
||||
}
|
||||
|
||||
/// Serialises MCP commands and every publication of the MCP state, so a state read before a
|
||||
/// command can't arrive after that command's own (newer) state.
|
||||
static MCP_WORK: Mutex<()> = Mutex::new(());
|
||||
|
||||
/// One AI agents command, on a worker thread: detection can run package-manager queries for
|
||||
/// seconds (flatpak on Linux). Commands run one at a time; the new state is sent when done.
|
||||
fn run_mcp(shared: &Shared, cmd: Command) {
|
||||
let _guard = MCP_WORK.lock().unwrap_or_else(PoisonError::into_inner);
|
||||
let apps = detected_apps(shared);
|
||||
let result = match cmd {
|
||||
Command::McpSetAgents { enabled } => crate::agents::set_enabled(enabled, &apps),
|
||||
Command::McpSetClient { client, added } => crate::agents::set_client(client, added),
|
||||
Command::McpRestartClient { client } => crate::agents::restart_client(client),
|
||||
_ => Ok(()),
|
||||
};
|
||||
if let Err(message) = result {
|
||||
shared.emit(Event::McpError { message });
|
||||
}
|
||||
shared.emit(mcp_state_for(&apps));
|
||||
}
|
||||
|
||||
/// The installed apps with their CLIs, from a fresh detection snapshot.
|
||||
fn detected_apps(shared: &Shared) -> Vec<crate::agents::InstalledApp> {
|
||||
let manifest = shared.manifest.lock().unwrap_or_else(PoisonError::into_inner).clone();
|
||||
let snapshot = crate::detect::Snapshot::take();
|
||||
crate::agents::installed_apps(&manifest, &snapshot)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||
|
||||
pub mod agents;
|
||||
pub mod backend;
|
||||
pub mod desktop_entry;
|
||||
pub mod detect;
|
||||
|
||||
@@ -516,6 +516,44 @@ fn explorer_select_arg(path: &Path) -> Option<std::ffi::OsString> {
|
||||
Some(arg)
|
||||
}
|
||||
|
||||
/// The PowerShell script that restarts Claude Desktop on Windows. Its processes are picked by
|
||||
/// install folder (the Microsoft Store package or the classic per-user install), never by name
|
||||
/// alone: `claude.exe` is also Claude Code's command-line program, whose sessions must keep running.
|
||||
/// It is started again through its Start menu entry, which works for both installs.
|
||||
pub const CLAUDE_DESKTOP_RESTART_PS: &str = r#"$ErrorActionPreference = 'Stop'
|
||||
$app = Get-StartApps | Where-Object { $_.Name -eq 'Claude' } | Select-Object -First 1
|
||||
if (-not $app) { throw 'Claude Desktop is not in the Start menu.' }
|
||||
$running = @(Get-Process -Name claude -ErrorAction SilentlyContinue | Where-Object { $_.Path -like '*\WindowsApps\Claude_*' -or $_.Path -like '*\AnthropicClaude\*' })
|
||||
$running | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
foreach ($p in $running) { $null = $p.WaitForExit(10000) }
|
||||
Start-Process ('shell:AppsFolder\' + $app.AppID)
|
||||
"#;
|
||||
|
||||
/// The AppleScript that quits Claude Desktop on macOS (as Quit in its menu does, waiting up to
|
||||
/// 10 s), before `open -a Claude` starts it again.
|
||||
pub const CLAUDE_DESKTOP_QUIT_APPLESCRIPT: &str = r#"if application "Claude" is running then
|
||||
tell application "Claude" to quit
|
||||
repeat 50 times
|
||||
if application "Claude" is not running then exit repeat
|
||||
delay 0.2
|
||||
end repeat
|
||||
end if"#;
|
||||
|
||||
/// Quit Claude Desktop and start it again, so it loads the MCP servers in its configuration.
|
||||
pub fn restart_claude_desktop() -> Result<(), String> {
|
||||
if cfg!(windows) {
|
||||
let exe = windows_system_program(r"System32\WindowsPowerShell\v1.0\powershell.exe")?;
|
||||
let mut cmd = command(exe);
|
||||
cmd.args(["-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", CLAUDE_DESKTOP_RESTART_PS]);
|
||||
run_command(cmd, "powershell", Duration::from_secs(30)).map(|_| ())
|
||||
} else if cfg!(target_os = "macos") {
|
||||
run("osascript", &["-e", CLAUDE_DESKTOP_QUIT_APPLESCRIPT], Duration::from_secs(20))?;
|
||||
run("open", &["-a", "Claude"], Duration::from_secs(10)).map(|_| ())
|
||||
} else {
|
||||
Err("restarting Claude Desktop isn't supported on this system".into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a process started from inside `path` (an exe, an AppImage, or a `.app`) is running.
|
||||
pub fn is_running(path: &Path) -> bool {
|
||||
if cfg!(windows) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use artcraft_launcher_core::protocol::{
|
||||
Backend, BackendOptions, CANCELLED, Capabilities, Command, Event, INSTALL_CANCELLED, JobPhase, LatestRelease, PAUSED, Source,
|
||||
Backend, BackendOptions, CANCELLED, Capabilities, Command, Event, INSTALL_CANCELLED, JobPhase, LatestRelease, McpAgents, PAUSED, Source,
|
||||
};
|
||||
use artcraft_launcher_core::release::Release;
|
||||
use artcraft_launcher_core::status::AppStatus;
|
||||
@@ -142,6 +142,13 @@ pub struct LauncherUi {
|
||||
pub(crate) backend: Box<dyn Backend>,
|
||||
pub settings: Settings,
|
||||
pub(crate) entries: Vec<AppEntry>,
|
||||
/// AI agents: the gateway switch and the MCP clients.
|
||||
pub(crate) mcp_agents: McpAgents,
|
||||
/// Whether we've asked for MCP state since the settings dialog last opened (reset when it closes).
|
||||
pub(crate) mcp_requested: bool,
|
||||
/// The MCP client just added here, which only loads the entry when it starts: Settings offers
|
||||
/// to restart it until that is done or the entry is removed.
|
||||
pub(crate) mcp_restart_offer: Option<artcraft_launcher_core::protocol::McpClient>,
|
||||
pub(crate) caps: Capabilities,
|
||||
pub(crate) platform: Option<Platform>,
|
||||
pub(crate) checking: bool,
|
||||
@@ -267,6 +274,9 @@ impl LauncherUi {
|
||||
.filter(|a| platform.is_none_or(|p| a.runs_on(p.os)))
|
||||
.map(AppEntry::new)
|
||||
.collect(),
|
||||
mcp_agents: McpAgents::default(),
|
||||
mcp_requested: false,
|
||||
mcp_restart_offer: None,
|
||||
caps,
|
||||
platform,
|
||||
checking: false,
|
||||
@@ -644,6 +654,16 @@ impl LauncherUi {
|
||||
self.rate_limited_until = rate_limited_until;
|
||||
true
|
||||
}
|
||||
Event::Mcp { agents } => {
|
||||
self.mcp_agents = agents;
|
||||
false
|
||||
}
|
||||
Event::McpError { message } => {
|
||||
// A failed MCP write (e.g. a full disk or an unreadable config) is surfaced so the
|
||||
// user knows their toggle did not take effect.
|
||||
self.toast(message, true);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,16 @@ impl LauncherUi {
|
||||
/// a click outside) discards the dialog.
|
||||
pub(crate) fn dialogs(&mut self, ctx: &egui::Context, host: &mut dyn Host) {
|
||||
let Some(mut dialog) = self.dialog.clone() else {
|
||||
// No dialog on screen: next time settings opens we want fresh MCP state.
|
||||
self.mcp_requested = false;
|
||||
self.alert_popup(ctx);
|
||||
return;
|
||||
};
|
||||
// Opening the settings dialog (fresh): ask for current local-service state.
|
||||
if matches!(dialog, Dialog::Settings) && !self.mcp_requested {
|
||||
self.act_command(Command::McpState);
|
||||
self.mcp_requested = true;
|
||||
}
|
||||
let t = Tokens::get(ctx);
|
||||
// An area is laid out in the size it had last frame, so dialogs can't share one id: the
|
||||
// uninstall prompt would open as tall as Settings and never shrink (#88).
|
||||
|
||||
@@ -417,3 +417,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Odemknout verzi?
|
||||
{app} is pinned to {version}. Follow the latest release instead? Aplikace {app} je uzamčena na verzi {version}. Přejít na nejnovější vydání?
|
||||
Unlock Odemknout
|
||||
|
||||
AI agents AI agenti
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Když je tato volba zapnutá, mohou aplikace AI, které používají MCP, například Claude, Cursor nebo LM Studio, pracovat přes jednu položku s každou nainstalovanou aplikací Craft. Když je vypnutá, žádný agent se k nim nedostane a položky přidané zde se odeberou.
|
||||
Quick install Rychlá instalace
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Přidá aplikace Craft do tohoto klienta. Potom klienta restartujte.
|
||||
Other clients Další klienti
|
||||
Copy the configuration and paste it into the client's MCP settings. Zkopírujte konfiguraci a vložte ji do nastavení MCP klienta.
|
||||
Copy JSON Kopírovat JSON
|
||||
Copy for VS Code Kopírovat pro VS Code
|
||||
Copy for Codex (TOML) Kopírovat pro Codex (TOML)
|
||||
Configuration copied. Konfigurace zkopírována.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} načítá své servery MCP jen při spuštění, takže aplikace Craft se objeví až po restartu. Restart zavře {client} včetně odpovědi, kterou právě píše.
|
||||
Restart {client} Restartovat {client}
|
||||
Restarting {client}… Restartuje se {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Brána Craft (craft-ai-mcp) není nainstalována vedle spouštěče.
|
||||
Let AI agents use Craft apps Povolit AI agentům používat aplikace Craft
|
||||
Apps agents can reach: {count} Aplikace dostupné agentům: {count}
|
||||
Added Přidáno
|
||||
Remove Odebrat
|
||||
Add Přidat
|
||||
|
@@ -449,3 +449,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Versionssperre aufheben?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} ist auf {version} festgelegt. Stattdessen der neuesten Version folgen?
|
||||
Unlock Entsperren
|
||||
|
||||
AI agents KI-Agenten
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Solange dies an ist, können KI-Apps mit MCP, etwa Claude, Cursor oder LM Studio, über einen Eintrag mit jeder installierten Craft-App arbeiten. Ist es aus, erreicht kein Agent sie, und die hier hinzugefügten Einträge werden entfernt.
|
||||
Quick install Schnellinstallation
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Fügt die Craft-Apps zu diesem Client hinzu. Starte den Client danach neu.
|
||||
Other clients Andere Clients
|
||||
Copy the configuration and paste it into the client's MCP settings. Kopiere die Konfiguration und füge sie in die MCP-Einstellungen des Clients ein.
|
||||
Copy JSON JSON kopieren
|
||||
Copy for VS Code Für VS Code kopieren
|
||||
Copy for Codex (TOML) Für Codex kopieren (TOML)
|
||||
Configuration copied. Konfiguration kopiert.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} lädt seine MCP-Server nur beim Start, daher erscheinen die Craft-Apps erst nach einem Neustart. Der Neustart schließt {client}, auch eine Antwort, die gerade geschrieben wird.
|
||||
Restart {client} {client} neu starten
|
||||
Restarting {client}… {client} wird neu gestartet…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Das Craft-Gateway (craft-ai-mcp) ist nicht neben dem Launcher installiert.
|
||||
Let AI agents use Craft apps KI-Agenten Craft-Apps nutzen lassen
|
||||
Apps agents can reach: {count} Apps, die Agenten erreichen: {count}
|
||||
Added Hinzugefügt
|
||||
Remove Entfernen
|
||||
Add Hinzufügen
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 16.
|
@@ -430,3 +430,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? ¿Desbloquear la versión?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} está fijado en la versión {version}. ¿Usar la versión más reciente?
|
||||
Unlock Desbloquear
|
||||
|
||||
AI agents Agentes de IA
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Mientras esto esté activado, las apps de IA que usan MCP, como Claude, Cursor o LM Studio, pueden trabajar con todas las apps Craft instaladas mediante una sola entrada. Si está desactivado, ningún agente puede llegar a ellas y se quitan las entradas añadidas aquí.
|
||||
Quick install Instalación rápida
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Añade las apps Craft a ese cliente. Reinicia el cliente después.
|
||||
Other clients Otros clientes
|
||||
Copy the configuration and paste it into the client's MCP settings. Copia la configuración y pégala en los ajustes de MCP del cliente.
|
||||
Copy JSON Copiar JSON
|
||||
Copy for VS Code Copiar para VS Code
|
||||
Copy for Codex (TOML) Copiar para Codex (TOML)
|
||||
Configuration copied. Configuración copiada.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} solo carga sus servidores MCP al iniciarse, así que las apps Craft aparecen después de reiniciarlo. Al reiniciar se cierra {client}, incluida una respuesta que esté escribiendo.
|
||||
Restart {client} Reiniciar {client}
|
||||
Restarting {client}… Reiniciando {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. La pasarela Craft (craft-ai-mcp) no está instalada junto al lanzador.
|
||||
Let AI agents use Craft apps Permitir que los agentes de IA usen las apps Craft
|
||||
Apps agents can reach: {count} Apps que los agentes pueden usar: {count}
|
||||
Added Añadida
|
||||
Remove Quitar
|
||||
Add Añadir
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 48.
|
@@ -447,3 +447,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Déverrouiller la version ?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} est fixé à la version {version}. Suivre plutôt la dernière version ?
|
||||
Unlock Déverrouiller
|
||||
|
||||
AI agents Agents IA
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Tant que cette option est activée, les apps d'IA qui utilisent MCP, comme Claude, Cursor ou LM Studio, peuvent travailler avec toutes les apps Craft installées grâce à une seule entrée. Désactivée, aucun agent ne peut les atteindre et les entrées ajoutées ici sont retirées.
|
||||
Quick install Installation rapide
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Ajoute les apps Craft à ce client. Redémarrez ensuite le client.
|
||||
Other clients Autres clients
|
||||
Copy the configuration and paste it into the client's MCP settings. Copiez la configuration et collez-la dans les réglages MCP du client.
|
||||
Copy JSON Copier le JSON
|
||||
Copy for VS Code Copier pour VS Code
|
||||
Copy for Codex (TOML) Copier pour Codex (TOML)
|
||||
Configuration copied. Configuration copiée.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} ne charge ses serveurs MCP qu'au démarrage : les apps Craft apparaissent après un redémarrage. Le redémarrage ferme {client}, y compris une réponse en cours de rédaction.
|
||||
Restart {client} Redémarrer {client}
|
||||
Restarting {client}… Redémarrage de {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. La passerelle Craft (craft-ai-mcp) n'est pas installée à côté du lanceur.
|
||||
Let AI agents use Craft apps Permettre aux agents IA d'utiliser les apps Craft
|
||||
Apps agents can reach: {count} Apps accessibles aux agents : {count}
|
||||
Added Ajoutée
|
||||
Remove Retirer
|
||||
Add Ajouter
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 50.
|
@@ -450,3 +450,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Feloldja a verzió zárolását?
|
||||
{app} is pinned to {version}. Follow the latest release instead? A(z) {app} a(z) {version} verzióra van rögzítve. Inkább a legújabb kiadást kövesse?
|
||||
Unlock Feloldás
|
||||
|
||||
AI agents AI-ügynökök
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Amíg ez be van kapcsolva, az MCP-t használó AI-alkalmazások, például a Claude, a Cursor vagy az LM Studio, egyetlen bejegyzésen át dolgozhatnak minden telepített Craft alkalmazással. Kikapcsolva egyetlen ügynök sem éri el őket, és az itt hozzáadott bejegyzések törlődnek.
|
||||
Quick install Gyors telepítés
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Hozzáadja a Craft alkalmazásokat ehhez a klienshez. Utána indítsa újra a klienst.
|
||||
Other clients Más kliensek
|
||||
Copy the configuration and paste it into the client's MCP settings. Másolja ki a konfigurációt, és illessze be a kliens MCP-beállításaiba.
|
||||
Copy JSON JSON másolása
|
||||
Copy for VS Code Másolás VS Code-hoz
|
||||
Copy for Codex (TOML) Másolás Codexhez (TOML)
|
||||
Configuration copied. Konfiguráció kimásolva.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. A(z) {client} csak induláskor tölti be az MCP-kiszolgálóit, ezért a Craft alkalmazások újraindítás után jelennek meg. Az újraindítás bezárja a(z) {client} alkalmazást, a még íródó választ is.
|
||||
Restart {client} {client} újraindítása
|
||||
Restarting {client}… {client} újraindítása…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. A Craft átjáró (craft-ai-mcp) nincs telepítve az indító mellé.
|
||||
Let AI agents use Craft apps AI-ügynökök használhatják a Craft alkalmazásokat
|
||||
Apps agents can reach: {count} Ügynökök által elérhető alkalmazások: {count}
|
||||
Added Hozzáadva
|
||||
Remove Eltávolítás
|
||||
Add Hozzáadás
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 16.
|
@@ -452,3 +452,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? バージョンの固定を解除しますか?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} は {version} に固定されています。代わりに最新リリースを使用しますか?
|
||||
Unlock 固定を解除
|
||||
|
||||
AI agents AI エージェント
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. これをオンにしている間、Claude、Cursor、LM Studio など MCP を使う AI アプリは、1 つの登録でインストール済みのすべての Craft アプリを使えます。オフにすると、どのエージェントもアクセスできなくなり、ここで追加した登録は削除されます。
|
||||
Quick install クイックインストール
|
||||
Adds the Craft apps to that client. Restart the client afterwards. そのクライアントに Craft アプリを追加します。追加後にクライアントを再起動してください。
|
||||
Other clients その他のクライアント
|
||||
Copy the configuration and paste it into the client's MCP settings. 設定をコピーして、クライアントの MCP 設定に貼り付けてください。
|
||||
Copy JSON JSON をコピー
|
||||
Copy for VS Code VS Code 用にコピー
|
||||
Copy for Codex (TOML) Codex 用にコピー (TOML)
|
||||
Configuration copied. 設定をコピーしました。
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} は起動時にのみ MCP サーバーを読み込むため、Craft アプリは再起動後に表示されます。再起動すると {client} が終了し、作成中の返信も中断されます。
|
||||
Restart {client} {client} を再起動
|
||||
Restarting {client}… {client} を再起動しています…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Craft ゲートウェイ (craft-ai-mcp) がランチャーと同じ場所にインストールされていません。
|
||||
Let AI agents use Craft apps AI エージェントに Craft アプリの使用を許可
|
||||
Apps agents can reach: {count} エージェントが使えるアプリ: {count}
|
||||
Added 追加済み
|
||||
Remove 削除
|
||||
Add 追加
|
||||
|
Can't render this file because it contains an unexpected character in line 14 and column 44.
|
@@ -448,3 +448,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? განიბლოკოს ვერსია?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} ფიქსირებულია {version} ვერსიაზე. სანაცვლოდ გამოიყენოთ უახლესი გამოშვება?
|
||||
Unlock განბლოკვა
|
||||
|
||||
AI agents AI აგენტები
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. სანამ ეს ჩართულია, MCP-ის მქონე AI აპებს, მაგალითად Claude-ს, Cursor-ს ან LM Studio-ს, ერთი ჩანაწერით შეუძლიათ ყველა დაინსტალირებულ Craft აპთან მუშაობა. გამორთვისას ვერცერთი აგენტი ვერ მიაღწევს მათ და აქ დამატებული ჩანაწერები წაიშლება.
|
||||
Quick install სწრაფი დაყენება
|
||||
Adds the Craft apps to that client. Restart the client afterwards. ამატებს Craft აპებს ამ კლიენტში. შემდეგ კლიენტი გადატვირთეთ.
|
||||
Other clients სხვა კლიენტები
|
||||
Copy the configuration and paste it into the client's MCP settings. დააკოპირეთ კონფიგურაცია და ჩასვით კლიენტის MCP პარამეტრებში.
|
||||
Copy JSON JSON-ის კოპირება
|
||||
Copy for VS Code კოპირება VS Code-ისთვის
|
||||
Copy for Codex (TOML) კოპირება Codex-ისთვის (TOML)
|
||||
Configuration copied. კონფიგურაცია დაკოპირდა.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} MCP სერვერებს მხოლოდ გაშვებისას ტვირთავს, ამიტომ Craft აპები გადატვირთვის შემდეგ გამოჩნდება. გადატვირთვა ხურავს {client}-ს, მათ შორის პასუხს, რომელსაც ახლა წერს.
|
||||
Restart {client} {client}-ის გადატვირთვა
|
||||
Restarting {client}… {client} გადაიტვირთება…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Craft კარიბჭე (craft-ai-mcp) გამშვების გვერდით არ არის დაინსტალირებული.
|
||||
Let AI agents use Craft apps AI აგენტებს Craft აპების გამოყენების ნება
|
||||
Apps agents can reach: {count} აგენტებისთვის ხელმისაწვდომი აპები: {count}
|
||||
Added დამატებულია
|
||||
Remove წაშლა
|
||||
Add დამატება
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 18.
|
@@ -451,3 +451,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Odblokować wersję?
|
||||
{app} is pinned to {version}. Follow the latest release instead? Aplikacja {app} jest przypięta do wersji {version}. Zamiast tego śledzić najnowsze wydanie?
|
||||
Unlock Odblokuj
|
||||
|
||||
AI agents Agenci AI
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Gdy ta opcja jest włączona, aplikacje AI korzystające z MCP, takie jak Claude, Cursor czy LM Studio, mogą przez jeden wpis pracować z każdą zainstalowaną aplikacją Craft. Gdy jest wyłączona, żaden agent nie ma do nich dostępu, a dodane tutaj wpisy są usuwane.
|
||||
Quick install Szybka instalacja
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Dodaje aplikacje Craft do tego klienta. Potem uruchom klienta ponownie.
|
||||
Other clients Inni klienci
|
||||
Copy the configuration and paste it into the client's MCP settings. Skopiuj konfigurację i wklej ją w ustawieniach MCP klienta.
|
||||
Copy JSON Kopiuj JSON
|
||||
Copy for VS Code Kopiuj dla VS Code
|
||||
Copy for Codex (TOML) Kopiuj dla Codex (TOML)
|
||||
Configuration copied. Skopiowano konfigurację.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} wczytuje serwery MCP tylko przy uruchomieniu, więc aplikacje Craft pojawią się po ponownym uruchomieniu. Ponowne uruchomienie zamyka {client}, także odpowiedź, którą właśnie pisze.
|
||||
Restart {client} Uruchom ponownie {client}
|
||||
Restarting {client}… Ponowne uruchamianie {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Brama Craft (craft-ai-mcp) nie jest zainstalowana obok launchera.
|
||||
Let AI agents use Craft apps Pozwól agentom AI używać aplikacji Craft
|
||||
Apps agents can reach: {count} Aplikacje dostępne dla agentów: {count}
|
||||
Added Dodano
|
||||
Remove Usuń
|
||||
Add Dodaj
|
||||
|
Can't render this file because it contains an unexpected character in line 11 and column 15.
|
@@ -437,3 +437,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Desbloquear versão?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} está fixado na versão {version}. Usar a versão mais recente?
|
||||
Unlock Desbloquear
|
||||
|
||||
AI agents Agentes de IA
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Enquanto isto estiver ativado, apps de IA que usam MCP, como Claude, Cursor ou LM Studio, podem trabalhar com todos os apps Craft instalados por meio de uma única entrada. Desativado, nenhum agente consegue alcançá-los, e as entradas adicionadas aqui são removidas.
|
||||
Quick install Instalação rápida
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Adiciona os apps Craft a esse cliente. Reinicie o cliente depois.
|
||||
Other clients Outros clientes
|
||||
Copy the configuration and paste it into the client's MCP settings. Copie a configuração e cole-a nas configurações de MCP do cliente.
|
||||
Copy JSON Copiar JSON
|
||||
Copy for VS Code Copiar para o VS Code
|
||||
Copy for Codex (TOML) Copiar para o Codex (TOML)
|
||||
Configuration copied. Configuração copiada.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. O {client} só carrega os servidores MCP ao iniciar, então os apps Craft aparecem depois de reiniciá-lo. Reiniciar fecha o {client}, inclusive uma resposta que ele ainda esteja escrevendo.
|
||||
Restart {client} Reiniciar {client}
|
||||
Restarting {client}… Reiniciando {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. O gateway Craft (craft-ai-mcp) não está instalado ao lado do inicializador.
|
||||
Let AI agents use Craft apps Permitir que agentes de IA usem os apps Craft
|
||||
Apps agents can reach: {count} Apps que os agentes alcançam: {count}
|
||||
Added Adicionado
|
||||
Remove Remover
|
||||
Add Adicionar
|
||||
|
Can't render this file because it contains an unexpected character in line 279 and column 66.
|
@@ -445,3 +445,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? Разблокировать версию?
|
||||
{app} is pinned to {version}. Follow the latest release instead? Для {app} закреплена версия {version}. Перейти на последнюю версию?
|
||||
Unlock Разблокировать
|
||||
|
||||
AI agents ИИ-агенты
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. Пока этот параметр включён, ИИ-приложения с поддержкой MCP, например Claude, Cursor или LM Studio, могут работать со всеми установленными приложениями Craft через одну запись. Когда он выключен, ни один агент не получит к ним доступ, а добавленные здесь записи удаляются.
|
||||
Quick install Быстрая установка
|
||||
Adds the Craft apps to that client. Restart the client afterwards. Добавляет приложения Craft в этот клиент. Затем перезапустите клиент.
|
||||
Other clients Другие клиенты
|
||||
Copy the configuration and paste it into the client's MCP settings. Скопируйте конфигурацию и вставьте её в настройки MCP клиента.
|
||||
Copy JSON Копировать JSON
|
||||
Copy for VS Code Копировать для VS Code
|
||||
Copy for Codex (TOML) Копировать для Codex (TOML)
|
||||
Configuration copied. Конфигурация скопирована.
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} загружает MCP-серверы только при запуске, поэтому приложения Craft появятся после перезапуска. Перезапуск закроет {client}, включая ответ, который он ещё пишет.
|
||||
Restart {client} Перезапустить {client}
|
||||
Restarting {client}… Перезапуск {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. Шлюз Craft (craft-ai-mcp) не установлен рядом с лаунчером.
|
||||
Let AI agents use Craft apps Разрешить ИИ-агентам использовать приложения Craft
|
||||
Apps agents can reach: {count} Приложения, доступные агентам: {count}
|
||||
Added Добавлено
|
||||
Remove Удалить
|
||||
Add Добавить
|
||||
|
Can't render this file because it contains an unexpected character in line 13 and column 44.
|
@@ -417,3 +417,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? 解锁版本?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} 已固定为 {version}。是否改为跟随最新版本?
|
||||
Unlock 解锁
|
||||
|
||||
AI agents AI 智能体
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. 开启后,Claude、Cursor 或 LM Studio 等使用 MCP 的 AI 应用只需一个条目,即可使用所有已安装的 Craft 应用。关闭后,任何智能体都无法访问它们,并会移除在此添加的条目。
|
||||
Quick install 快速安装
|
||||
Adds the Craft apps to that client. Restart the client afterwards. 将 Craft 应用添加到该客户端。之后请重启客户端。
|
||||
Other clients 其他客户端
|
||||
Copy the configuration and paste it into the client's MCP settings. 复制配置,并将其粘贴到客户端的 MCP 设置中。
|
||||
Copy JSON 复制 JSON
|
||||
Copy for VS Code 复制为 VS Code 格式
|
||||
Copy for Codex (TOML) 复制为 Codex 格式 (TOML)
|
||||
Configuration copied. 已复制配置。
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} 只在启动时加载 MCP 服务器,因此 Craft 应用会在重启后出现。重启会关闭 {client},包括正在生成的回复。
|
||||
Restart {client} 重启 {client}
|
||||
Restarting {client}… 正在重启 {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. 启动器旁未安装 Craft 网关 (craft-ai-mcp)。
|
||||
Let AI agents use Craft apps 允许 AI 智能体使用 Craft 应用
|
||||
Apps agents can reach: {count} 智能体可用的应用:{count}
|
||||
Added 已添加
|
||||
Remove 移除
|
||||
Add 添加
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 3.
|
@@ -408,3 +408,23 @@ anicraft Classic tweens with eight easing presets and custom ease curves, plus s
|
||||
Unlock version? 解除版本鎖定?
|
||||
{app} is pinned to {version}. Follow the latest release instead? {app} 已鎖定為 {version}。是否改為使用最新版本?
|
||||
Unlock 解除鎖定
|
||||
|
||||
AI agents AI 代理
|
||||
While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed. 開啟後,Claude、Cursor 或 LM Studio 等使用 MCP 的 AI 應用程式只需一個項目,即可使用所有已安裝的 Craft 應用程式。關閉後,任何代理都無法存取它們,並會移除在此加入的項目。
|
||||
Quick install 快速安裝
|
||||
Adds the Craft apps to that client. Restart the client afterwards. 將 Craft 應用程式加入該用戶端。之後請重新啟動用戶端。
|
||||
Other clients 其他用戶端
|
||||
Copy the configuration and paste it into the client's MCP settings. 複製設定,並將其貼到用戶端的 MCP 設定中。
|
||||
Copy JSON 複製 JSON
|
||||
Copy for VS Code 複製為 VS Code 格式
|
||||
Copy for Codex (TOML) 複製為 Codex 格式 (TOML)
|
||||
Configuration copied. 已複製設定。
|
||||
{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing. {client} 只在啟動時載入 MCP 伺服器,因此 Craft 應用程式會在重新啟動後出現。重新啟動會關閉 {client},包括正在產生的回覆。
|
||||
Restart {client} 重新啟動 {client}
|
||||
Restarting {client}… 正在重新啟動 {client}…
|
||||
The Craft gateway (craft-ai-mcp) is not installed beside the launcher. 啟動器旁未安裝 Craft 閘道 (craft-ai-mcp)。
|
||||
Let AI agents use Craft apps 允許 AI 代理使用 Craft 應用程式
|
||||
Apps agents can reach: {count} 代理可使用的應用程式:{count}
|
||||
Added 已加入
|
||||
Remove 移除
|
||||
Add 加入
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 3.
|
@@ -1,6 +1,8 @@
|
||||
//! The Settings dialog: a large card in the shape of the app page (see `sheet.rs`), with the
|
||||
//! groups of settings in boxes, two columns once the window is wide enough.
|
||||
|
||||
use artcraft_launcher_core::mcp_config::{McpConfigFormat, mcp_config};
|
||||
use artcraft_launcher_core::protocol::{Command, McpClientState};
|
||||
use artcraft_launcher_core::{Os, PackageKind};
|
||||
use egui::{RichText, Ui, vec2};
|
||||
|
||||
@@ -116,6 +118,7 @@ impl LauncherUi {
|
||||
this.settings_language(ui);
|
||||
this.settings_updates(ui);
|
||||
this.settings_appearance(ui);
|
||||
this.settings_agents(ui);
|
||||
},
|
||||
|ui| {
|
||||
let Ok(mut state) = state.try_borrow_mut() else { return };
|
||||
@@ -369,4 +372,111 @@ impl LauncherUi {
|
||||
});
|
||||
self.settings.theme = theme_choice;
|
||||
}
|
||||
|
||||
/// AI agents: one switch that lets MCP clients reach every installed Craft app through the
|
||||
/// `craft-ai-mcp` gateway (it is the person's consent: off, no agent reaches any app), then
|
||||
/// quick install (Add/Remove per MCP client found here) and the configuration to copy for any
|
||||
/// other client.
|
||||
fn settings_agents(&mut self, ui: &mut Ui) {
|
||||
// Behind the `AI-MCP` feature flag, set in `ArtCraft/flags.toml` or `CRAFT_FLAGS` only.
|
||||
if !self.caps.manage_apps || !self.mcp_agents.flag_on {
|
||||
return;
|
||||
}
|
||||
let t = Tokens::get(ui.ctx());
|
||||
sheet::panel(ui, tl!("AI agents"), |ui| {
|
||||
note(
|
||||
ui,
|
||||
tl!(
|
||||
"While this is on, AI apps that use MCP, such as Claude, Cursor or LM Studio, can work with every installed Craft app through one entry. While it is off, no agent can reach them, and the entries added here are removed."
|
||||
),
|
||||
);
|
||||
ui.add_space(8.0);
|
||||
let agents = self.mcp_agents.clone();
|
||||
if !agents.gateway_found {
|
||||
ui.label(RichText::new(tl!("The Craft gateway (craft-ai-mcp) is not installed beside the launcher.")).size(12.0).color(t.muted));
|
||||
// Turning on needs the gateway; turning off and removing entries never does.
|
||||
if !agents.enabled {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let mut on = agents.enabled;
|
||||
if ui.checkbox(&mut on, tl!("Let AI agents use Craft apps")).changed() && on != agents.enabled {
|
||||
self.act_command(Command::McpSetAgents { enabled: on });
|
||||
}
|
||||
if !agents.enabled {
|
||||
return;
|
||||
}
|
||||
ui.label(RichText::new(tl!("Apps agents can reach: {count}").replace("{count}", &agents.apps.to_string())).size(12.0).color(t.muted));
|
||||
ui.add_space(10.0);
|
||||
ui.label(RichText::new(tl!("Quick install")).strong());
|
||||
note(ui, tl!("Adds the Craft apps to that client. Restart the client afterwards."));
|
||||
ui.add_space(4.0);
|
||||
for c in &agents.clients {
|
||||
self.draw_client_row(ui, &t, c, agents.gateway_found);
|
||||
}
|
||||
if let Some(gateway) = agents.gateway.as_deref() {
|
||||
ui.add_space(10.0);
|
||||
ui.label(RichText::new(tl!("Other clients")).strong());
|
||||
note(ui, tl!("Copy the configuration and paste it into the client's MCP settings."));
|
||||
ui.add_space(4.0);
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
for format in McpConfigFormat::ALL {
|
||||
let label = match format {
|
||||
McpConfigFormat::Json => tl!("Copy JSON"),
|
||||
McpConfigFormat::VsCode => tl!("Copy for VS Code"),
|
||||
McpConfigFormat::CodexToml => tl!("Copy for Codex (TOML)"),
|
||||
};
|
||||
if ui.button(label).clicked() {
|
||||
ui.ctx().copy_text(mcp_config(format, gateway));
|
||||
self.toast(tl!("Configuration copied."), false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// One MCP client: its name, and Add or Remove (or "Not installed" when it isn't). Add is
|
||||
/// offered only while the gateway is there to add.
|
||||
fn draw_client_row(&mut self, ui: &mut Ui, t: &Tokens, c: &McpClientState, can_add: bool) {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(c.name.as_str());
|
||||
if c.added {
|
||||
ui.label(RichText::new(tl!("Added")).size(12.0).color(t.muted));
|
||||
if ui.button(tl!("Remove")).clicked() {
|
||||
self.act_command(Command::McpSetClient { client: c.client, added: false });
|
||||
self.mcp_restart_offer = None;
|
||||
}
|
||||
} else if c.installed && can_add {
|
||||
if ui.button(tl!("Add")).clicked() {
|
||||
self.act_command(Command::McpSetClient { client: c.client, added: true });
|
||||
if c.restartable {
|
||||
self.mcp_restart_offer = Some(c.client);
|
||||
}
|
||||
}
|
||||
} else if !c.installed {
|
||||
ui.label(RichText::new(tl!("Not installed")).size(12.0).color(t.muted));
|
||||
}
|
||||
});
|
||||
// A client reads its MCP servers only when it starts: right after adding, say so and offer
|
||||
// to do the restart, which people otherwise miss.
|
||||
if c.added && c.restartable && self.mcp_restart_offer == Some(c.client) {
|
||||
let name = [("client", c.name.as_str())];
|
||||
note(
|
||||
ui,
|
||||
&fmt(
|
||||
tl!(
|
||||
"{client} loads its MCP servers only when it starts, so the Craft apps appear after a restart. Restarting closes {client}, including a reply it is still writing."
|
||||
),
|
||||
&name,
|
||||
),
|
||||
);
|
||||
if ui.button(fmt(tl!("Restart {client}"), &name)).clicked() {
|
||||
self.act_command(Command::McpRestartClient { client: c.client });
|
||||
self.mcp_restart_offer = None;
|
||||
self.toast(fmt(tl!("Restarting {client}…"), &name), false);
|
||||
}
|
||||
ui.add_space(4.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4411,3 +4411,154 @@ fn launcher_version_padlock_confirms_and_returns_to_settings() {
|
||||
h.get_by_label("Launcher version");
|
||||
assert!(sent.borrow().iter().any(|c| matches!(c, Command::Configure(options) if options.launcher_version == VersionTrack::Stable)));
|
||||
}
|
||||
|
||||
/// Settings › AI agents: the switch, and Add / Remove per MCP client, each sending one command.
|
||||
#[test]
|
||||
fn ai_agents_switch_and_client_buttons_send_their_commands() {
|
||||
use artcraft_launcher_core::protocol::{McpAgents, McpClient, McpClientState};
|
||||
let client = |client, name: &str, installed, added| McpClientState { client, name: name.into(), installed, added, restartable: false };
|
||||
let mut evs = events();
|
||||
evs.push(Event::Mcp {
|
||||
agents: McpAgents {
|
||||
flag_on: true,
|
||||
gateway_found: true,
|
||||
enabled: true,
|
||||
apps: 3,
|
||||
clients: vec![
|
||||
client(McpClient::ClaudeDesktop, "Claude Desktop", true, false),
|
||||
client(McpClient::Cursor, "Cursor", true, true),
|
||||
client(McpClient::LmStudio, "LM Studio", false, false),
|
||||
],
|
||||
gateway: Some("C:/gw/craft-ai-mcp.exe".into()),
|
||||
},
|
||||
});
|
||||
let (mut h, sent) = harness_with(evs, ViewMode::Grid, egui::Theme::Dark, true, 1.0);
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Settings").click();
|
||||
h.run_steps(4);
|
||||
h.get_by_label("Apps agents can reach: 3").scroll_to_me();
|
||||
h.run_steps(6);
|
||||
snapshot(&mut h, "settings-ai-agents");
|
||||
// Other clients: the configuration in each format, copied with a note saying so.
|
||||
for label in ["Copy JSON", "Copy for VS Code", "Copy for Codex (TOML)"] {
|
||||
h.get_by_label(label).scroll_to_me();
|
||||
h.run_steps(2);
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(3);
|
||||
assert!(h.query_all_by_label("Configuration copied.").next().is_some(), "{label}");
|
||||
}
|
||||
h.get_by_label("Add").click();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Remove").click();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Let AI agents use Craft apps").click();
|
||||
h.run_steps(2);
|
||||
let sent = sent.borrow();
|
||||
assert!(sent.iter().any(|c| matches!(c, Command::McpSetClient { client: McpClient::ClaudeDesktop, added: true })));
|
||||
assert!(sent.iter().any(|c| matches!(c, Command::McpSetClient { client: McpClient::Cursor, added: false })));
|
||||
assert!(sent.iter().any(|c| matches!(c, Command::McpSetAgents { enabled: false })));
|
||||
assert!(
|
||||
!sent.iter().any(|c| matches!(c, Command::McpSetClient { client: McpClient::LmStudio, .. })),
|
||||
"a client that isn't installed has no button"
|
||||
);
|
||||
}
|
||||
|
||||
/// Adding Claude Desktop says why it must restart and offers to do it; the button sends the
|
||||
/// restart and goes away. Clients the launcher can't restart get no such offer.
|
||||
#[test]
|
||||
fn ai_agents_offer_to_restart_a_client_right_after_adding_it() {
|
||||
use artcraft_launcher_core::protocol::{McpAgents, McpClient, McpClientState};
|
||||
let agents = |added| McpAgents {
|
||||
flag_on: true,
|
||||
gateway_found: true,
|
||||
enabled: true,
|
||||
apps: 3,
|
||||
clients: vec![
|
||||
McpClientState { client: McpClient::ClaudeDesktop, name: "Claude Desktop".into(), installed: true, added, restartable: true },
|
||||
McpClientState { client: McpClient::ClaudeCode, name: "Claude Code".into(), installed: true, added, restartable: false },
|
||||
],
|
||||
gateway: Some("C:/gw/craft-ai-mcp.exe".into()),
|
||||
};
|
||||
let machine = Machine { more: vec![Event::Mcp { agents: agents(false) }], ..Default::default() };
|
||||
let (mut h, sent, queue) = versions_harness(machine, None, vec![]);
|
||||
h.get_by_label("Settings").click();
|
||||
h.run_steps(4);
|
||||
h.get_by_label("Quick install").scroll_to_me();
|
||||
h.run_steps(4);
|
||||
assert!(h.query_by_label("Restart Claude Desktop").is_none(), "nothing to restart before adding");
|
||||
let adds: Vec<_> = h.get_all_by_label("Add").collect();
|
||||
adds[0].click();
|
||||
adds[1].click();
|
||||
h.run_steps(2);
|
||||
queue.borrow_mut().push(Event::Mcp { agents: agents(true) });
|
||||
h.run_steps(4);
|
||||
h.get_by_label_contains("loads its MCP servers only when it starts");
|
||||
assert!(h.query_by_label("Restart Claude Code").is_none(), "the launcher can't restart Claude Code");
|
||||
h.get_by_label("Restart Claude Desktop").click();
|
||||
h.run_steps(4);
|
||||
assert!(sent.borrow().iter().any(|c| matches!(c, Command::McpRestartClient { client: McpClient::ClaudeDesktop })));
|
||||
assert!(h.query_by_label("Restart Claude Desktop").is_none(), "offered once");
|
||||
assert!(h.query_all_by_label("Restarting Claude Desktop…").next().is_some(), "a note says it is happening");
|
||||
}
|
||||
|
||||
/// Without the gateway beside the launcher, Settings says so and offers no switch.
|
||||
#[test]
|
||||
fn ai_agents_without_the_gateway_offer_no_switch() {
|
||||
let mut evs = events();
|
||||
evs.push(Event::Mcp { agents: artcraft_launcher_core::protocol::McpAgents { flag_on: true, ..Default::default() } });
|
||||
let (mut h, _sent) = harness_with(evs, ViewMode::Grid, egui::Theme::Dark, true, 1.0);
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Settings").click();
|
||||
h.run_steps(4);
|
||||
h.get_by_label("The Craft gateway (craft-ai-mcp) is not installed beside the launcher.");
|
||||
assert!(h.query_by_label("Let AI agents use Craft apps").is_none());
|
||||
}
|
||||
|
||||
/// When the gateway went away while agents were on, they can still be turned off and the entries
|
||||
/// removed; only adding is gone.
|
||||
#[test]
|
||||
fn ai_agents_left_on_without_the_gateway_can_still_be_turned_off() {
|
||||
use artcraft_launcher_core::protocol::{McpAgents, McpClient, McpClientState};
|
||||
let client = |client, name: &str, added| McpClientState { client, name: name.into(), installed: true, added, restartable: false };
|
||||
let mut evs = events();
|
||||
evs.push(Event::Mcp {
|
||||
agents: McpAgents {
|
||||
flag_on: true,
|
||||
gateway_found: false,
|
||||
enabled: true,
|
||||
apps: 2,
|
||||
clients: vec![client(McpClient::ClaudeDesktop, "Claude Desktop", false), client(McpClient::Cursor, "Cursor", true)],
|
||||
gateway: None,
|
||||
},
|
||||
});
|
||||
let (mut h, sent) = harness_with(evs, ViewMode::Grid, egui::Theme::Dark, true, 1.0);
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Settings").click();
|
||||
h.run_steps(4);
|
||||
h.get_by_label("Apps agents can reach: 2").scroll_to_me();
|
||||
h.run_steps(6);
|
||||
assert!(h.query_by_label("Add").is_none(), "nothing to add without the gateway");
|
||||
h.get_by_label("Remove").click();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Let AI agents use Craft apps").click();
|
||||
h.run_steps(3);
|
||||
let sent = sent.borrow();
|
||||
assert!(sent.iter().any(|c| matches!(c, Command::McpSetClient { client: McpClient::Cursor, added: false })));
|
||||
assert!(sent.iter().any(|c| matches!(c, Command::McpSetAgents { enabled: false })));
|
||||
}
|
||||
|
||||
/// With the `AI-MCP` flag off, Settings shows nothing about agents, and nothing to switch flags:
|
||||
/// they are set in `ArtCraft/flags.toml` or `CRAFT_FLAGS` only.
|
||||
#[test]
|
||||
fn ai_agents_stay_hidden_until_their_flag_is_on() {
|
||||
use artcraft_launcher_core::protocol::McpAgents;
|
||||
let mut evs = events();
|
||||
evs.push(Event::Mcp { agents: McpAgents { flag_on: false, gateway_found: true, enabled: true, apps: 3, clients: vec![], gateway: None } });
|
||||
let (mut h, _sent) = harness_with(evs, ViewMode::Grid, egui::Theme::Dark, true, 1.0);
|
||||
h.run_steps(6);
|
||||
h.get_by_label("Settings").click();
|
||||
h.run_steps(4);
|
||||
assert!(h.query_by_label("Let AI agents use Craft apps").is_none(), "no agents box without the flag");
|
||||
assert!(h.query_by_label("Experimental features").is_none(), "flags have no switches in Settings");
|
||||
assert!(h.query_by_label("AI agents (MCP)").is_none());
|
||||
}
|
||||
@@ -57,7 +57,7 @@ echo "==> ArtCraft Launcher $VERSION for FreeBSD $ARCH"
|
||||
|
||||
export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-4}"
|
||||
if [[ "$SKIP_BUILD" = 0 ]]; then
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" ${CARGO_BUILD_TARGET:+--target "$CARGO_BUILD_TARGET"})
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" -p artcraft-launcher-mcp ${CARGO_BUILD_TARGET:+--target "$CARGO_BUILD_TARGET"})
|
||||
fi
|
||||
WORK="$CARGO_TARGET_DIR/freebsd-package"
|
||||
STAGE="$WORK/$BASENAME"
|
||||
@@ -74,6 +74,8 @@ if [[ "$DRY_RUN" = 1 ]]; then
|
||||
mkdir -p "$BIN"
|
||||
printf '#!/bin/sh\necho "%s %s (dry-run stub)"\n' "$PKG" "$VERSION" >"$BIN/$PKG"
|
||||
chmod 755 "$BIN/$PKG"
|
||||
printf '#!/bin/sh\necho "craft-ai-mcp (dry-run stub)"\n' >"$BIN/craft-ai-mcp"
|
||||
chmod 755 "$BIN/craft-ai-mcp"
|
||||
fi
|
||||
|
||||
# ---- stage a /usr/local-style tree --------------------------------------------------------------
|
||||
@@ -82,6 +84,9 @@ mkdir -p "$STAGE/bin" "$STAGE/share/applications" "$STAGE/share/metainfo" "$STAG
|
||||
"$STAGE/share/doc/$PKG"
|
||||
install -m 755 "$BIN/$PKG" "$STAGE/bin/"
|
||||
strip "$STAGE/bin/$PKG" 2>/dev/null || true
|
||||
# The craft-ai-mcp gateway the launcher ships (Settings › AI agents), beside the launcher.
|
||||
install -m 755 "$BIN/craft-ai-mcp" "$STAGE/bin/"
|
||||
strip "$STAGE/bin/craft-ai-mcp" 2>/dev/null || true
|
||||
# The desktop entry, metainfo and icons are the freedesktop files Linux ships.
|
||||
install -m 644 "$LINUX/$APP_ID.desktop" "$STAGE/share/applications/$APP_ID.desktop"
|
||||
sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$ARTCRAFT_LAUNCHER_BUILD_DATE/g" \
|
||||
@@ -89,7 +94,7 @@ sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$ARTCRAFT_LAUNCHER_BUILD_DATE/g" \
|
||||
cp -R "$ROOT/assets/app-icon/hicolor" "$STAGE/share/icons/"
|
||||
copy_docs "$STAGE/share/doc/$PKG"
|
||||
|
||||
for f in "bin/$PKG" "share/applications/$APP_ID.desktop" \
|
||||
for f in "bin/$PKG" "bin/craft-ai-mcp" "share/applications/$APP_ID.desktop" \
|
||||
"share/icons/hicolor/256x256/apps/$APP_ID.png" "share/icons/hicolor/scalable/apps/$APP_ID.svg" \
|
||||
"share/doc/$PKG/LICENSE-MIT" "share/doc/$PKG/LICENSE-APACHE"; do
|
||||
if [[ ! -e "$STAGE/$f" ]]; then echo "error: $f is missing from the package" >&2; exit 1; fi
|
||||
|
||||
@@ -61,6 +61,7 @@ modules:
|
||||
buildsystem: simple
|
||||
build-commands:
|
||||
- install -Dm755 bin/artcraft-launcher /app/bin/artcraft-launcher
|
||||
- install -Dm755 bin/craft-ai-mcp /app/bin/craft-ai-mcp
|
||||
- install -Dm644 share/applications/ai.storyteller.artcraft-launcher.desktop /app/share/applications/ai.storyteller.artcraft-launcher.desktop
|
||||
# Already has the release's version and date substituted by package.sh.
|
||||
- install -Dm644 share/metainfo/ai.storyteller.artcraft-launcher.metainfo.xml /app/share/metainfo/ai.storyteller.artcraft-launcher.metainfo.xml
|
||||
|
||||
@@ -68,8 +68,9 @@ modules:
|
||||
CARGO_HOME: /run/build/artcraft-launcher/cargo
|
||||
CARGO_NET_OFFLINE: 'true'
|
||||
build-commands:
|
||||
- cargo --offline build --release --locked -p artcraft-launcher
|
||||
- cargo --offline build --release --locked -p artcraft-launcher -p artcraft-launcher-mcp
|
||||
- install -Dm755 target/release/artcraft-launcher /app/bin/artcraft-launcher
|
||||
- install -Dm755 target/release/craft-ai-mcp /app/bin/craft-ai-mcp
|
||||
- install -Dm644 NOTICE /app/share/doc/artcraft-launcher/NOTICE
|
||||
- install -Dm644 packaging/linux/ai.storyteller.artcraft-launcher.desktop /app/share/applications/ai.storyteller.artcraft-launcher.desktop
|
||||
- mkdir -p /app/share/icons && cp -R assets/app-icon/hicolor /app/share/icons/
|
||||
|
||||
@@ -70,6 +70,10 @@ contents:
|
||||
- src: ${STAGE}/usr/bin/artcraft-launcher
|
||||
dst: /usr/bin/artcraft-launcher
|
||||
file_info: { mode: 0755 }
|
||||
# The craft-ai-mcp gateway the launcher ships (Settings › AI agents).
|
||||
- src: ${STAGE}/usr/bin/craft-ai-mcp
|
||||
dst: /usr/bin/craft-ai-mcp
|
||||
file_info: { mode: 0755 }
|
||||
- src: ${STAGE}/usr/share/
|
||||
dst: /usr/share/
|
||||
type: tree
|
||||
|
||||
@@ -64,9 +64,9 @@ echo "==> ArtCraft Launcher $VERSION for Linux $ARCH ($FORMATS)"
|
||||
|
||||
if [[ "$SKIP_BUILD" = 0 ]]; then
|
||||
if [[ -n "${CROSS_TARGET:-}" ]]; then
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" --target "$CROSS_TARGET")
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" -p artcraft-launcher-mcp --target "$CROSS_TARGET")
|
||||
else
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG")
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" -p artcraft-launcher-mcp)
|
||||
fi
|
||||
fi
|
||||
BIN="$CARGO_TARGET_DIR/${CROSS_TARGET:+$CROSS_TARGET/}release"
|
||||
@@ -77,6 +77,9 @@ rm -rf "$WORK"
|
||||
# ---- stage an FHS tree (shared by every format) -------------------------------------------------
|
||||
install -Dm755 "$BIN/$PKG" "$STAGE/usr/bin/$PKG"
|
||||
"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/$PKG" 2>/dev/null || true
|
||||
# The craft-ai-mcp gateway the launcher ships (Settings › AI agents), beside the launcher.
|
||||
install -Dm755 "$BIN/craft-ai-mcp" "$STAGE/usr/bin/craft-ai-mcp"
|
||||
"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/craft-ai-mcp" 2>/dev/null || true
|
||||
install -Dm644 "$HERE/$APP_ID.desktop" "$STAGE/usr/share/applications/$APP_ID.desktop"
|
||||
mkdir -p "$STAGE/usr/share/metainfo"
|
||||
sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$ARTCRAFT_LAUNCHER_BUILD_DATE/g" \
|
||||
|
||||
@@ -16,6 +16,9 @@ check_packages() {
|
||||
mkdir -p "$work/target/$target/release"
|
||||
printf '#!/bin/sh\necho "ArtCraft Launcher packaging fixture"\n' >"$work/target/$target/release/artcraft-launcher"
|
||||
chmod +x "$work/target/$target/release/artcraft-launcher"
|
||||
# The packages ship the craft-ai-mcp gateway beside the launcher (Settings › AI agents).
|
||||
printf '#!/bin/sh\necho "craft-ai-mcp packaging fixture"\n' >"$work/target/$target/release/craft-ai-mcp"
|
||||
chmod +x "$work/target/$target/release/craft-ai-mcp"
|
||||
# A set cross target skips the version smoke execution; no target binary is run.
|
||||
(
|
||||
unset EMULATOR
|
||||
|
||||
@@ -18,6 +18,8 @@ HERE="$ROOT/packaging/macos"
|
||||
|
||||
# ---- app-specific values ----------------------------------------------------------------------
|
||||
PKG=artcraft-launcher # cargo package and binary
|
||||
GATEWAY_PKG=artcraft-launcher-mcp # cargo package of the craft-ai-mcp gateway the launcher ships
|
||||
GATEWAY_BIN=craft-ai-mcp # its binary, placed beside the launcher in Contents/MacOS
|
||||
APP_NAME="ArtCraft Launcher" # display name: bundle, executable, icon, DMG volume
|
||||
|
||||
ARCH=universal
|
||||
@@ -60,7 +62,8 @@ echo "==> $APP_NAME $VERSION for macOS ($ARCH), identity: $IDENTITY, notarize: $
|
||||
if [[ "$SKIP_BUILD" = 0 ]]; then
|
||||
args=()
|
||||
for t in "${TARGETS[@]}"; do args+=(--target "$t"); done
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" "${args[@]}")
|
||||
# The launcher and the craft-ai-mcp gateway it ships (Settings › AI agents).
|
||||
(cd "$ROOT" && cargo build --release --locked -p "$PKG" -p "$GATEWAY_PKG" "${args[@]}")
|
||||
fi
|
||||
|
||||
rm -rf "$WORK"
|
||||
@@ -69,6 +72,10 @@ inputs=()
|
||||
for t in "${TARGETS[@]}"; do inputs+=("$CARGO_TARGET_DIR/$t/release/$PKG"); done
|
||||
lipo -create -output "$WORK/bin/$PKG" "${inputs[@]}"
|
||||
lipo -info "$WORK/bin/$PKG"
|
||||
gw_inputs=()
|
||||
for t in "${TARGETS[@]}"; do gw_inputs+=("$CARGO_TARGET_DIR/$t/release/$GATEWAY_BIN"); done
|
||||
lipo -create -output "$WORK/bin/$GATEWAY_BIN" "${gw_inputs[@]}"
|
||||
lipo -info "$WORK/bin/$GATEWAY_BIN"
|
||||
|
||||
# ---- signing helpers ---------------------------------------------------------------------------
|
||||
sign() {
|
||||
@@ -117,6 +124,8 @@ echo "==> assembling $APP"
|
||||
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
|
||||
# Executable and icon carry the display name (CFBundleExecutable / CFBundleIconFile).
|
||||
cp "$WORK/bin/$PKG" "$APP/Contents/MacOS/$APP_NAME"
|
||||
# Beside the launcher, where Settings › AI agents looks for it (agents::locate_gateway).
|
||||
cp "$WORK/bin/$GATEWAY_BIN" "$APP/Contents/MacOS/$GATEWAY_BIN"
|
||||
cp "$ROOT/assets/app-icon/$PKG.icns" "$APP/Contents/Resources/$APP_NAME.icns"
|
||||
cp "$ROOT/NOTICE" "$APP/Contents/Resources/"
|
||||
sed -e "s/@VERSION@/$VERSION/g" -e "s/@SHORT_VERSION@/$SHORT_VERSION/g" \
|
||||
@@ -134,7 +143,9 @@ printf 'APPL????' >"$APP/Contents/PkgInfo"
|
||||
xattr -cr "$APP"
|
||||
|
||||
# Sign inside-out: nested code first, then the bundle itself (no --deep on the final signature).
|
||||
# Today the only nested code is the main executable; frameworks/helpers would be signed here too.
|
||||
# Nested code: the craft-ai-mcp gateway (a command-line helper, no entitlements) and the main
|
||||
# executable; frameworks/helpers would be signed here too.
|
||||
sign --options runtime "$APP/Contents/MacOS/$GATEWAY_BIN"
|
||||
sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP/Contents/MacOS/$APP_NAME"
|
||||
sign --options runtime --entitlements "$HERE/entitlements.plist" "$APP"
|
||||
codesign --verify --strict --deep --verbose=2 "$APP"
|
||||
|
||||
@@ -155,6 +155,9 @@
|
||||
<Component Id="ArtCraftLauncherApp" Directory="INSTALLFOLDER" Guid="55DCC431-EBEF-4C11-BABB-6D78CE0ECF4E">
|
||||
<File Id="ArtCraftLauncherNotice" Source="$(var.BinDir)\NOTICE" KeyPath="no" />
|
||||
<File Id="ArtCraftLauncherExe" Source="$(var.BinDir)\artcraft-launcher.exe" KeyPath="no" />
|
||||
<!-- The craft-ai-mcp gateway the launcher ships (Settings › AI agents). Every upgrade is a major
|
||||
upgrade, so a file added to this component is installed and removed with it. -->
|
||||
<File Id="ArtCraftLauncherMcpGatewayExe" Source="$(var.BinDir)\craft-ai-mcp.exe" KeyPath="no" />
|
||||
<!-- Read back by the next version's installer and by the launcher (self_update.rs). -->
|
||||
<RegistryValue Root="HKCU" Key="Software\Learning Machines LLC\ArtCraft Launcher" Name="InstallDir" Value="[INSTALLFOLDER]" Type="string" KeyPath="yes" />
|
||||
<RegistryValue Root="HKCU" Key="Software\Learning Machines LLC\ArtCraft Launcher" Name="DesktopShortcutChoice" Value="[DESKTOPSHORTCUTCHOICE]" Type="string" />
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
],
|
||||
"payloads": [
|
||||
"NOTICE",
|
||||
"artcraft-launcher.exe"
|
||||
"artcraft-launcher.exe",
|
||||
"craft-ai-mcp.exe"
|
||||
],
|
||||
"registry": [
|
||||
[
|
||||
|
||||
@@ -29,6 +29,8 @@ $Root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
||||
|
||||
# ---- app-specific values ----------------------------------------------------------------------
|
||||
$Pkg = 'artcraft-launcher' # cargo package and binary
|
||||
$GatewayPkg = 'artcraft-launcher-mcp' # cargo package of the shipped craft-ai-mcp gateway
|
||||
$GatewayExe = 'craft-ai-mcp.exe'
|
||||
$AppName = 'ArtCraft Launcher' # display name
|
||||
|
||||
function Invoke-Native([string] $What, [scriptblock] $Block) {
|
||||
@@ -67,7 +69,8 @@ if (-not $SkipBuild) {
|
||||
[Environment]::SetEnvironmentVariable($flagVar, '-C target-feature=+crt-static')
|
||||
# Fail the build (rather than warn) if the icon/VERSIONINFO can't be embedded.
|
||||
$env:ARTCRAFT_LAUNCHER_REQUIRE_WINRES = '1'
|
||||
Invoke-Native "cargo build ($Target)" { cargo build --release --locked -p $Pkg --target $Target }
|
||||
# The launcher and the craft-ai-mcp gateway it ships (Settings › AI agents).
|
||||
Invoke-Native "cargo build ($Target)" { cargo build --release --locked -p $Pkg -p $GatewayPkg --target $Target }
|
||||
}
|
||||
|
||||
$Bin = Join-Path $TargetDir "$Target\release"
|
||||
@@ -86,6 +89,11 @@ $h = Get-PeHeader (Join-Path $Bin $Exe)
|
||||
if ($h.Machine -ne $Machine) { throw "$Exe is for machine 0x$('{0:X}' -f $h.Machine), expected 0x$('{0:X}' -f $Machine) ($Arch)" }
|
||||
if ($h.Subsystem -ne 2) { throw "$Exe has PE subsystem $($h.Subsystem), expected 2 (Windows GUI)" }
|
||||
Write-Output "ok ${Exe}: $Arch, PE subsystem $($h.Subsystem)"
|
||||
# The gateway talks to MCP clients over stdin and stdout, so it stays a console program (3).
|
||||
$g = Get-PeHeader (Join-Path $Bin $GatewayExe)
|
||||
if ($g.Machine -ne $Machine) { throw "$GatewayExe is for machine 0x$('{0:X}' -f $g.Machine), expected 0x$('{0:X}' -f $Machine) ($Arch)" }
|
||||
if ($g.Subsystem -ne 3) { throw "$GatewayExe has PE subsystem $($g.Subsystem), expected 3 (console)" }
|
||||
Write-Output "ok ${GatewayExe}: $Arch, PE subsystem $($g.Subsystem)"
|
||||
|
||||
$Stage = Join-Path $TargetDir "windows-package\$Arch"
|
||||
Remove-Item -Recurse -Force $Stage -ErrorAction SilentlyContinue
|
||||
@@ -93,8 +101,10 @@ New-Item -ItemType Directory -Force -Path $Stage | Out-Null
|
||||
# Dependency font notices are required even without optional craft-fonts.
|
||||
Copy-Item -LiteralPath (Join-Path $Root 'NOTICE') -Destination $Stage
|
||||
Copy-Item (Join-Path $Bin $Exe) $Stage
|
||||
Copy-Item (Join-Path $Bin $GatewayExe) $Stage
|
||||
|
||||
& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage $Exe)
|
||||
& (Join-Path $PSScriptRoot 'sign.ps1') (Join-Path $Stage $GatewayExe)
|
||||
|
||||
# ---- MSI ---------------------------------------------------------------------------------------
|
||||
# The setup wizard's art, drawn here (System.Drawing) in getartcraft.com's style so the MSI shows
|
||||
@@ -197,6 +207,7 @@ $Portable = Join-Path $TargetDir "windows-package\$Pkg-$Version-windows-$Arch-po
|
||||
Remove-Item -Recurse -Force $Portable -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType Directory -Force -Path $Portable | Out-Null
|
||||
Copy-Item (Join-Path $Stage $Exe) $Portable
|
||||
Copy-Item (Join-Path $Stage $GatewayExe) $Portable
|
||||
foreach ($f in 'README.md', 'LICENSE-MIT', 'LICENSE-APACHE', 'NOTICE', 'ATTRIBUTION.md') {
|
||||
$p = Join-Path $Root $f
|
||||
if (Test-Path $p) { Copy-Item $p $Portable }
|
||||
|
||||
Reference in new issue
Block a user