Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
AI flow: Connect an AI tool is the one in-app guide (3 steps, live server), dialogs in the app's style
islandmedb999d8d1bddf
diff --git a/changes/feat-ai-flow.md b/changes/feat-ai-flow.mdnew file mode 100644index 00000000..2cbbcbdf--- /dev/null+++ b/changes/feat-ai-flow.md@@ -0,0 +1,22 @@+---+whats_new: **Help > Connect an AI tool** is now the one guide to working with an AI tool, on one screen: pick your+ tool and copy its command, turn on **Let AI tools control this window** right there, see what happens next (the+ 6-digit code, the **AI connected** badge, **AI:** steps in Undo, what asks you first), and copy an example prompt.+ The AI blocks out a starting point; you do the art.+highlight: Connect an AI tool in three steps+changed: **Help > Connect an AI tool** is the in-app guide to live mode: 1. pick your tool (Claude Code, Claude+ Desktop, Cursor, or any other in the list) with the exact command or settings for this install, now for the+ live-mode server (`sculptforge-cli --mcp --attach`, listed as `sculptforge-live` beside a headless `sculptforge`+ entry); 2. the live-mode switch; 3. what happens next; four example prompts with Copy. The plan notes moved to a+ **Plans and sign-in** tooltip; the headless server and the Claude Desktop bundle are in the user guide.+changed: The live-mode dialogs (**Let an AI tool control this window?**, **Allow this AI step?**) look like the+ app's other dialogs: one text width, two buttons of one width (the answer first), no close box (Deny or Escape),+ the code in a large font instead of a scaled-up small one. While the approval is open the Connect window steps+ aside, so two dialogs never stack; after Approve it closes and the badge takes over.+testers:+ - Any OS, 100% and 200% UI scale: Help > Connect an AI tool fits on screen; each tool's Copy pastes a command that+ works (Claude Code: claude mcp list shows sculptforge-live).+ - Turn on step 2, ask your AI tool "Block out a creature head with horns for me to sculpt": the approval shows+ alone, the code is sharp, Approve connects and the badge shows at the bottom right.+---+Reviewers: before/after screenshots in REPORT.md.diff --git a/docs/guide/scripting.md b/docs/guide/scripting.mdindex 56460995..c58c6197 100644--- a/docs/guide/scripting.md+++ b/docs/guide/scripting.md@@ -244,15 +244,79 @@ threads.## AI agents (MCP)-`sculptforge-cli --mcp` runs SculptForge as an MCP server. An AI tool (Claude, Codex, Gemini, Grok, Cursor, VS Code-and others) gets every command as a tool and works on one scene for the session: it can open files, generate-models, sculpt strokes, remesh, paint and export. The AI tool starts `sculptforge-cli` on your computer and talks to-it over standard input and output. Nothing listens on the network, and nothing is installed into the AI tool.+An AI tool (Claude Code, Claude Desktop, Cursor and others) can work in the SculptForge window while you watch. The+AI blocks out a starting point and shows you options; you do the art. **Help > Connect an AI tool...** is the guide+in the app, on one screen; it is there while AI features are on (**Edit > Preferences > AI**). It says what this+section says, in the same words.-The easy way: **Help > Connect an AI tool...** shows, for your install, the exact command or settings for each tool-below, with Copy buttons. It is there while AI features are on (**Edit > Preferences > AI**).+### Connect an AI tool-### I have a subscription+**1. Pick your tool.** The window shows the exact command or settings for your install, with **Copy**. SculptForge+is listed as `sculptforge-live` and started as `sculptforge-cli --mcp --attach`, so it sits beside a `sculptforge`+entry you may already have (the headless server, below). Claude Code, in a terminal:++```sh+claude mcp add --scope user sculptforge-live -- /path/to/sculptforge-cli --mcp --attach+```++Claude Desktop: add this to its configuration file (**Settings > Developer > Edit Config**), then restart Claude+Desktop:++```text+{+ "mcpServers": {+ "sculptforge-live": { "command": "/path/to/sculptforge-cli", "args": ["--mcp", "--attach"] }+ }+}+```++Cursor takes the same entry in `~/.cursor/mcp.json`. For every other tool, use its setup from the table in+[Every other tool](#every-other-tool) with the name `sculptforge-live` and the arguments `--mcp --attach`; the+window writes it out for you. Where `sculptforge-cli` is on your system: [Where sculptforge-cli is](#where-sculptforge-cli-is).++**2. Let it work in this window.** Turn on **Let AI tools control this window**, right there in the window's step 2+(the same switch as in **Edit > Preferences > AI**). It is off by default, and gone while AI features are off.++**3. What happens next.**++- Ask your AI tool for something (examples below). SculptForge shows **Let an AI tool control this window?** with a+ 6-digit code: click **Approve**, or tell the AI the code. Approval lasts until it disconnects.+- While it works, the **AI connected** badge sits at the bottom right. **Disconnect** stops it (also in the command+ palette: *Disconnect AI tool*; turning the switch or AI features off disconnects it too).+- Every step lands in Undo as **AI: ...**, so you can step back.+- It asks you first (**Allow this AI step?**) before files outside the project, scripts and the network: reading or+ writing files outside the project folder and the files you picked, overwriting a file, saving over the project,+ deleting library files, running a macro or script, and anything that uses the network (Generate 3D, AI Brush, the+ brush gallery). Deny and it is told not to retry. Installing or switching packs and the AI switch itself are+ never offered.+- It sees the viewport; what it sees goes to that tool's AI service. `viewport_image` returns the viewport as you+ see it, `view_turntable` the model from 4 to 8 sides in one picture, `view_set` turns and frames your camera, and+ `stroke_screen` draws a brush stroke in screen space. With `blockout` (a Forge Sphere armature in one call),+ `measure` and `scene_overview` it can look, think and correct.++**Try asking:**++- "Block out a creature head with horns for me to sculpt."+- "Look at my model from all sides and tell me what to fix."+- "Make three rock variations I can refine."+- "Teach me: walk me through sculpting an ear, step by step."++The recipes your AI tool lists as prompts (creature head, stylised bust, game-ready, rock variations, teach me) work+here too.++How it is kept safe: the connection is a Unix socket (owner-only, in your runtime folder) or, on Windows, a named+pipe only your user account can open; there is no network port. Only one AI tool can be connected at a time,+requests are rate limited, and what the tool sends is data: tool names and values, never code to run.++### Without a window: the headless server++`sculptforge-cli --mcp` runs SculptForge as an MCP server with a scene of its own, no window needed: for batch jobs+and your own agents. The AI tool gets every command as a tool and works on that scene for the session: it can open+files, generate models, sculpt strokes, remesh, paint and export. It starts `sculptforge-cli` on your computer and+talks to it over standard input and output. Nothing listens on the network, and nothing is installed into the AI+tool. The setups below use the name `sculptforge` and `--mcp`; the Claude Desktop bundle is this server too.++#### I have a subscription| Subscription | Use | Set up ||---|---|---|@@ -272,7 +336,7 @@ below, with Copy buttons. It is there while AI features are on (**Edit > Preferean xAI API key. The xAI API's own MCP tool is remote-only too; your own code can use the function calling examplebelow (API usage is billed by xAI).-### Where sculptforge-cli is+#### Where sculptforge-cli is| Install | Command ||---|---|@@ -285,7 +349,7 @@ below, with Copy buttons. It is there while AI features are on (**Edit > PrefereIn JSON and TOML files a Windows path is written with doubled backslashes(`"C:\\Program Files\\SculptForge\\bin\\sculptforge-cli.exe"`). The window does that for you.-### Claude Desktop bundle+#### Claude Desktop bundleDownload the bundle for your system, then install it in Claude Desktop under **Settings > Extensions > Advancedsettings** ([Anthropic's guide](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)):@@ -304,7 +368,7 @@ It carries its own copy of `sculptforge-cli`. Or add SculptForge to `claude_desk}```-### Every other tool+#### Every other toolMost tools take the same `mcpServers` entry as Claude Desktop above. Each row links the vendor's page the format isfrom.@@ -337,10 +401,11 @@ Remote only, so not for SculptForge: the ChatGPT app, the Grok app, and Rovo inservers added by an admin; use Rovo Dev CLI). The OpenAI and xAI APIs' built-in MCP tools also reach only remoteservers: use the Agents SDK or plain function calling below.-### Using it+#### Using itAsk for something like "make a sphere, remesh it at 128 and export it to ~/Desktop/ball.glb". File paths are on your-machine. The agent works headless on its own scene; to see the result, open the exported file in SculptForge.+machine. The headless server works on its own scene; to see the result, open the exported file in SculptForge (or+use live mode, above, to watch it work).- **viewport_image** gives the agent a picture of the scene (a clay-shaded view of the visible Parts, any angle) tocheck each step by eye. Every tool call is one undo step, so the agent can take back what went wrong.@@ -349,7 +414,7 @@ machine. The agent works headless on its own scene; to see the result, open thebust from a reference image, a game-ready asset (retopology, UVs, baked maps and LODs for Unreal or Godot),rock variations, and a step-by-step lesson.-### Your own agent+#### Your own agentThe [OpenAI Agents SDK](https://openai.github.io/openai-agents-python/mcp/) starts the server itself:@@ -424,38 +489,6 @@ for step in interaction.steps:Never point a tool at a web app's session or cookies: use each vendor's own app, CLI or API as above.-### Live mode: an AI tool sculpts in the open window--Turn on **Edit > Preferences > AI > Let AI tools control this window** (off by default, and gone while AI features-are off), then add the attach server to your AI tool:--```sh-claude mcp add sculptforge-live -- /path/to/sculptforge-cli --mcp --attach-```--Ask it to connect ("connect to SculptForge and block out a dragon head"). SculptForge shows **Let an AI tool control-this window?** with a 6-digit code: click **Approve**, or read the code to the AI tool. The approval lasts until it-disconnects. While it works:--- an **AI connected** badge sits at the bottom right of the canvas, with **Disconnect** (also in the command palette:- *Disconnect AI tool*). Turning the switch or AI features off disconnects it too;-- every step it takes is in the undo history, labelled **AI:**, so you can step back through its work;-- it asks first (**Allow this AI step?**) before reading or writing files outside the project folder and the files- you picked, overwriting a file, saving over the project, deleting library files, running a macro or script, or- anything that uses the network (Generate 3D, AI Brush, the brush gallery). Deny and it is told not to retry.- Installing or switching packs and the AI switch itself are never offered;-- it can see: `viewport_image` returns the viewport as you see it, `view_turntable` the model from 4 to 8 sides in one- picture, `view_set` turns and frames your camera, and `stroke_screen` draws a brush stroke in screen space. With- `blockout` (a Forge Sphere armature in one call), `measure` and `scene_overview` it can look, think and correct.- What it sees goes to that tool's AI service, as anything you show it does.--The recipes your AI tool lists as prompts (creature head, stylised bust, game-ready, rock variations, teach me) work-in live mode too.--How it is kept safe: the connection is a Unix socket (owner-only, in your runtime folder) or, on Windows, a named-pipe only your user account can open; there is no network port. Only one AI tool can be connected at a time,-requests are rate limited, and what the tool sends is data: tool names and values, never code to run.-## See also- [The interface](interface.md): the command palette and Ctrl-hover helpdiff --git a/src/app/App.h b/src/app/App.hindex a3f64609..e5b4f596 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -440,7 +440,7 @@ private:bool showHelp_ = false;bool showAbout_ = false;bool showConnectAi_ = false; // Help > Connect an AI tool (PanelConnectAi.cpp; only while AI is on)- int connectPlan_ = 0; // its "I have a ... subscription" choice (connect::Plan)+ std::string connectClient_ = "claude_code"; // its "Pick your tool" choice (a connect::Client id)void drawConnectAi();// Supporting SculptForge (Support.h): the app only ever opens the membership page or its Stripe checkout links in the// browser; nothing else changes.@@ -571,6 +571,7 @@ private:void aiLinkDisconnect(const std::string& why); // the kill switch: closes the connection nowvoid aiLinkPicked(const std::string& path); // a file the user chose: an AI tool may use it without askingint aiLinkStateValue() const; // UI tests: 0 off, 1 listening, 2 waiting for approval, 3 connected, 4 asking+ std::string aiLinkClient() const; // the connected (or asking) tool's name, "" without onestd::vector<std::string> aiLinkPickedPaths_; // files the user chose this run (each connection starts with them)void aiLinkExecute(const link::AiLinkCall& call);uint32_t activePartInfoId() const;diff --git a/src/app/ConnectAi.cpp b/src/app/ConnectAi.cppindex 5b487b8c..2c7a200d 100644--- a/src/app/ConnectAi.cpp+++ b/src/app/ConnectAi.cpp@@ -38,7 +38,7 @@ struct Row {// Display order inside each plan. A client's snippets are built in clients() from its id.constexpr Row kAiClients[] = {{"claude_desktop", "Claude Desktop", Plan::Claude,- "Download the bundle for your system and install it in Claude Desktop under Settings > Extensions > Advanced settings. Or add SculptForge to its configuration file and restart it.",+ "Add this to its configuration file (Settings > Developer > Edit Config), then restart Claude Desktop.","https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop"},{"claude_code", "Claude Code", Plan::Claude, "Run once in a terminal; it signs in with your Claude plan.","https://code.claude.com/docs/en/mcp"},@@ -122,7 +122,7 @@ std::string commandLine(const Launch& l, Os os) {// One field per line, so an entry fits the window (and reads like the vendors' examples).std::string serverEntry(const Launch& l, const char* extra = nullptr) {- return std::string(" \"sculptforge\": {\n") + (extra ? std::string(" ") + extra + ",\n" : std::string()) ++ return std::string(" ") + jsonString(l.name) + ": {\n" + (extra ? std::string(" ") + extra + ",\n" : std::string()) +" \"command\": " + jsonString(l.command) + ",\n \"args\": " + jsonArray(l.args) + "\n }";}@@ -144,25 +144,25 @@ std::vector<Snippet> snippetsFor(const std::string& id, const Launch& l, Os os): "~/.config/Claude/claude_desktop_config.json";return {file(where, mcpServers)};}- if (id == "claude_code") return {terminal("claude mcp add --scope user sculptforge -- " + cmd)};+ if (id == "claude_code") return {terminal("claude mcp add --scope user " + l.name + " -- " + cmd)};if (id == "codex")- return {terminal("codex mcp add sculptforge -- " + cmd),+ return {terminal("codex mcp add " + l.name + " -- " + cmd),file(home(os, "~/.codex/config.toml", "%USERPROFILE%\\.codex\\config.toml"),- "[mcp_servers.sculptforge]\ncommand = " + jsonString(l.command) + "\nargs = " + jsonArray(l.args))};+ "[mcp_servers." + l.name + "]\ncommand = " + jsonString(l.command) + "\nargs = " + jsonArray(l.args))};if (id == "antigravity")return {file(home(os, "~/.gemini/config/mcp_config.json", "%USERPROFILE%\\.gemini\\config\\mcp_config.json"), mcpServers)};if (id == "gemini_cli") {std::string args;for (const std::string& a : l.args) args += " " + shellWord(a, os);- return {terminal("gemini mcp add --scope user sculptforge " + shellWord(l.command, os) + args)};+ return {terminal("gemini mcp add --scope user " + l.name + " " + shellWord(l.command, os) + args)};}if (id == "grok_build")- return {terminal("grok mcp add sculptforge -- " + cmd),+ return {terminal("grok mcp add " + l.name + " -- " + cmd),file(home(os, "~/.grok/config.toml", "%USERPROFILE%\\.grok\\config.toml"),- "[mcp_servers.sculptforge]\ncommand = " + jsonString(l.command) + "\nargs = " + jsonArray(l.args))};+ "[mcp_servers." + l.name + "]\ncommand = " + jsonString(l.command) + "\nargs = " + jsonArray(l.args))};if (id == "cursor") return {file(home(os, "~/.cursor/mcp.json", "%USERPROFILE%\\.cursor\\mcp.json"), mcpServers)};if (id == "vscode") {- const std::string entry = "{\"name\": \"sculptforge\", \"type\": \"stdio\", \"command\": " + jsonString(l.command) ++ const std::string entry = "{\"name\": " + jsonString(l.name) + ", \"type\": \"stdio\", \"command\": " + jsonString(l.command) +", \"args\": " + jsonArray(l.args) + "}";std::vector<Snippet> out;if (os != Os::Windows) out.push_back(terminal("code --add-mcp " + shellWord(entry, os))); // (cmd.exe quoting of JSON is not worth it)@@ -175,32 +175,32 @@ std::vector<Snippet> snippetsFor(const std::string& id, const Launch& l, Os os)return {file(home(os, "~/.config/zed/settings.json", "zed: open settings file"),wrapped("context_servers", serverEntry(l)))};if (id == "windsurf")- return {terminal("devin mcp add -s user sculptforge -- " + cmd),+ return {terminal("devin mcp add -s user " + l.name + " -- " + cmd),file(home(os, "~/.config/devin/mcp_config.json", "%APPDATA%\\devin\\mcp_config.json"), mcpServers)};- if (id == "copilot_cli") return {terminal("copilot mcp add sculptforge -- " + cmd)};+ if (id == "copilot_cli") return {terminal("copilot mcp add " + l.name + " -- " + cmd)};if (id == "cline")- return {terminal("cline mcp add sculptforge --yes -- " + cmd), file("MCP Servers > Configure", mcpServers)};+ return {terminal("cline mcp add " + l.name + " --yes -- " + cmd), file("MCP Servers > Configure", mcpServers)};if (id == "continue") {std::string yaml = "name: SculptForge\nversion: 0.0.1\nschema: v1\nmcpServers:\n - name: SculptForge\n type: stdio\n"" command: " + jsonString(l.command) + "\n args:\n";for (const std::string& a : l.args) yaml += " - " + jsonString(a) + "\n";yaml.pop_back();- return {file(".continue/mcpServers/sculptforge.yaml", yaml)};+ return {file(".continue/mcpServers/" + l.name + ".yaml", yaml)};}if (id == "kiro") return {file(home(os, "~/.kiro/settings/mcp.json", "%USERPROFILE%\\.kiro\\settings\\mcp.json"), mcpServers)};if (id == "amazon_q")- return {terminal("q mcp add --name sculptforge --command " + shellWord(l.command, os) + " --args " ++ return {terminal("q mcp add --name " + l.name + " --command " + shellWord(l.command, os) + " --args " +shellWord(jsonArray(l.args), os))};if (id == "warp") return {file("Settings > Agents > MCP servers > Add", mcpServers)};if (id == "goose") {- std::string yaml = "extensions:\n sculptforge:\n name: SculptForge\n type: stdio\n cmd: " ++ std::string yaml = "extensions:\n " + l.name + ":\n name: SculptForge\n type: stdio\n cmd: " +jsonString(l.command) + "\n args: " + jsonArray(l.args) + "\n enabled: true\n timeout: 300";return {file(home(os, "~/.config/goose/config.yaml", "Goose's config.yaml (goose configure)"), yaml)};}if (id == "opencode") {std::vector<std::string> all{l.command};all.insert(all.end(), l.args.begin(), l.args.end());- return {file("opencode.json", "{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n \"sculptforge\": "+ return {file("opencode.json", "{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"mcp\": {\n " + jsonString(l.name) + ": ""{\"type\": \"local\", \"command\": " + jsonArray(all) + ", \"enabled\": true}\n }\n}")};}if (id == "rovo_dev")@@ -210,7 +210,7 @@ std::vector<Snippet> snippetsFor(const std::string& id, const Launch& l, Os os)if (id == "jan") {std::string args;for (const std::string& a : l.args) args += (args.empty() ? "" : " ") + a;- return {{K::Fields, {}, "Server Name: sculptforge\nCommand: " + l.command + "\nArguments: " + args}};+ return {{K::Fields, {}, "Server Name: " + l.name + "\nCommand: " + l.command + "\nArguments: " + args}};}if (id == "agents_sdk")return {file("agent.py",@@ -218,7 +218,7 @@ std::vector<Snippet> snippetsFor(const std::string& id, const Launch& l, Os os)"from agents import Agent, Runner\n""from agents.mcp import MCPServerStdio\n\n""async def main():\n"- " async with MCPServerStdio(name=\"SculptForge\", client_session_timeout_seconds=60,\n"+ " async with MCPServerStdio(name=" + jsonString(l.name) + ", client_session_timeout_seconds=60,\n"" params={\"command\": " + jsonString(l.command) + ", \"args\": " +jsonArray(l.args) + "}) as sf:\n"" agent = Agent(name=\"Sculptor\", instructions=\"Use SculptForge's tools.\", mcp_servers=[sf])\n"diff --git a/src/app/ConnectAi.h b/src/app/ConnectAi.hindex 503477de..8e42ebe8 100644--- a/src/app/ConnectAi.h+++ b/src/app/ConnectAi.h@@ -12,10 +12,12 @@namespace sf::connect {-// How a client starts the server: command plus arguments, the last one "--mcp".+// How a client starts the server: command plus arguments ("--mcp", or "--mcp --attach" for live mode), and the name+// the client lists it under ("sculptforge-live" for live mode, so it sits beside a headless "sculptforge").struct Launch {std::string command;std::vector<std::string> args;+ std::string name = "sculptforge";};enum class Os { Windows, Mac, Linux };diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex ee2c3d8a..a68ff5ec 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -3540,14 +3540,10 @@ constexpr Entry kSpanish[] = {{"AI tools can't control this window", "Las herramientas de IA no pueden controlar esta ventana"},{"Allow once", "Permitir una vez"},{"Allow this AI step?", "¿Permitir este paso de IA?"},- {"An AI tool on this computer (sculptforge-cli --mcp --attach) can ask to sculpt here while you watch. You approve each connection; it can see the viewport, and what it sees goes to that tool's AI service. Files outside the project, scripts and the network ask you first. Nothing listens on the network.", "Una herramienta de IA de este equipo (sculptforge-cli --mcp --attach) puede pedir esculpir aquí mientras miras. Apruebas cada conexión; puede ver el visor, y lo que ve va al servicio de IA de esa herramienta. Los archivos fuera del proyecto, los scripts y la red te preguntan antes. Nada escucha en la red."},{"Approve", "Aprobar"},- {"Click Approve, or tell your AI tool this code. Approval lasts until it disconnects.", "Pulsa Aprobar o dile este código a tu herramienta de IA. La aprobación dura hasta que se desconecte."},- {"Code", "Código"},{"Deny", "Denegar"},{"Disconnect AI tool", "Desconectar herramienta de IA"},{"Disconnect", "Desconectar"},- {"It can run SculptForge's commands and see the viewport; what it sees goes to that tool's AI service. Every step is in Undo. Files outside the project, scripts and the network ask you first.", "Puede ejecutar los comandos de SculptForge y ver el visor; lo que ve va al servicio de IA de esa herramienta. Cada paso queda en Deshacer. Los archivos fuera del proyecto, los scripts y la red te preguntan antes."},{"Let AI tools control this window", "Permitir que herramientas de IA controlen esta ventana"},{"Let an AI tool control this window?", "¿Permitir que una herramienta de IA controle esta ventana?"},{"Live mode can't start: ", "El modo en vivo no puede iniciarse: "},@@ -3555,6 +3551,27 @@ constexpr Entry kSpanish[] = {{"Stop the AI tool controlling this window now (its steps stay in Undo).", "Detener ahora la herramienta de IA que controla esta ventana (sus pasos quedan en Deshacer)."},{"Stop the AI tool now. Its steps stay in Undo.", "Detener ahora la herramienta de IA. Sus pasos quedan en Deshacer."},{"Your AI tool asks: ", "Tu herramienta de IA pide: "},+ // The in-app guide (Help > Connect an AI tool, PanelConnectAi.cpp) and its dialogs, in the guide's words+ {"1. Pick your tool", "1. Elige tu herramienta"},+ {"2. Let it work in this window", "2. Déjala trabajar en esta ventana"},+ {"3. What happens next", "3. Qué pasa después"},+ {"Add this to its configuration file (Settings > Developer > Edit Config), then restart Claude Desktop.", "Añade esto a su archivo de configuración (Settings > Developer > Edit Config) y reinicia Claude Desktop."},+ {"An AI tool on this computer can ask to work in this window while you watch. You approve it with a 6-digit code. Every step lands in Undo. Files outside the project, scripts and the network ask you first. What it sees goes to that tool's AI service. Nothing listens on the network. To set up your tool: Help > Connect an AI tool.", "Una herramienta de IA de este equipo puede pedir trabajar en esta ventana mientras miras. La apruebas con un código de 6 dígitos. Cada paso queda en Deshacer. Los archivos fuera del proyecto, los scripts y la red te preguntan antes. Lo que ve va al servicio de IA de esa herramienta. Nada escucha en la red. Para configurar tu herramienta: Ayuda > Conectar una herramienta de IA."},+ {"Approval lasts until it disconnects. Every step lands in Undo. Files outside the project, scripts and the network ask you first. What it sees goes to that tool's AI service.", "La aprobación dura hasta que se desconecte. Cada paso queda en Deshacer. Los archivos fuera del proyecto, los scripts y la red te preguntan antes. Lo que ve va al servicio de IA de esa herramienta."},+ {"Ask your AI tool for something (below). SculptForge shows a 6-digit code: click Approve, or tell the AI the code.", "Pide algo a tu herramienta de IA (ejemplos abajo). SculptForge muestra un código de 6 dígitos: pulsa Aprobar o dile el código a la IA."},+ {"Block out a creature head with horns for me to sculpt.", "Encaja una cabeza de criatura con cuernos para que yo la esculpa."},+ {"Click Approve, or tell your AI tool this code:", "Pulsa Aprobar o dile este código a tu herramienta de IA:"},+ {"Every step lands in Undo as \"AI: ...\", so you can step back.", "Cada paso queda en Deshacer como «AI: ...», así que puedes volver atrás."},+ {"It asks you first before files outside the project, scripts and the network.", "Te pregunta antes de usar archivos fuera del proyecto, scripts o la red."},+ {"It sees the viewport; what it sees goes to that tool's AI service.", "Ve el visor; lo que ve va al servicio de IA de esa herramienta."},+ {"Look at my model from all sides and tell me what to fix.", "Mira mi modelo desde todos los lados y dime qué corregir."},+ {"Make three rock variations I can refine.", "Haz tres variaciones de roca que yo pueda pulir."},+ {"On: your AI tool can ask to connect.", "Activado: tu herramienta de IA puede pedir conectarse."},+ {"Plans and sign-in", "Planes e inicio de sesión"},+ {"Teach me: walk me through sculpting an ear, step by step.", "Enséñame: guíame paso a paso para esculpir una oreja."},+ {"The AI blocks out a starting point and shows you options; you do the art.", "La IA prepara un punto de partida y te muestra opciones; el arte lo haces tú."},+ {"Try asking", "Prueba a pedir"},+ {"While it works, the AI connected badge sits at the bottom right. Disconnect stops it.", "Mientras trabaja, el distintivo «IA conectada» queda abajo a la derecha. Desconectar la detiene."},// --- Help > Connect an AI tool (PanelConnectAi.cpp, ConnectAi.cpp) ---{"Add to Cursor's global MCP file (or .cursor/mcp.json in a project).",@@ -3583,22 +3600,14 @@ constexpr Entry kSpanish[] = {"Conectar una herramienta de IA..."},{"Copied to the clipboard","Copiado al portapapeles"},- {"Download the Claude Desktop bundle",- "Descargar el paquete para Claude Desktop"},{"Fields:","Campos:"},{"For Gemini Code Assist Standard or Enterprise, or a Gemini API key. Run once in a terminal.","Para Gemini Code Assist Standard o Enterprise, o una clave de la API de Gemini. Ejecútalo una vez en una terminal."},{"Google's CLI for personal Google accounts (free, Google AI Pro and Ultra). Add this to its MCP file, then sign in with Google.","La CLI de Google para cuentas personales de Google (gratis, Google AI Pro y Ultra). Añade esto a su archivo MCP e inicia sesión con Google."},- {"I have a subscription to",- "Tengo una suscripción a"},{"In a terminal:","En una terminal:"},- {"Let an AI assistant use SculptForge's tools: it starts sculptforge-cli on this computer and talks to it directly. Nothing listens on the network. The assistant works on its own scene and saves files where you ask; open them here to see the result.",- "Deja que un asistente de IA use las herramientas de SculptForge: inicia sculptforge-cli en este ordenador y habla con él directamente. Nada escucha en la red. El asistente trabaja en su propia escena y guarda los archivos donde le pidas; ábrelos aquí para ver el resultado."},- {"Download the bundle for your system and install it in Claude Desktop under Settings > Extensions > Advanced settings. Or add SculptForge to its configuration file and restart it.",- "Descarga el paquete para tu sistema e instálalo en Claude Desktop en Settings > Extensions > Advanced settings. O añade SculptForge a su archivo de configuración y reinícialo."},{"Other tools","Otras herramientas"},{"Program tab > Install > Edit mcp.json, then paste this.",@@ -3633,12 +3642,10 @@ constexpr Entry kSpanish[] = {"La aplicación de Grok (web, móvil, X) no llega a los programas de tu ordenador, solo a servidores HTTPS públicos: usa Grok Build. La documentación de xAI no dice qué planes incluye el inicio de sesión de Grok Build; también acepta una clave de la API de xAI."},{"Their documentation","Su documentación"},- {"This install:",- "Esta instalación:"},{"Turn this off in Preferences > AI.","Desactívalo en Preferencias > IA."},- {"Use SculptForge from Claude, ChatGPT (Codex), Gemini, Grok, Cursor, VS Code and other AI tools: the exact command or settings for this install, with Copy buttons. The tool starts SculptForge on this computer; nothing listens on the network.",- "Usa SculptForge desde Claude, ChatGPT (Codex), Gemini, Grok, Cursor, VS Code y otras herramientas de IA: el comando o los ajustes exactos para esta instalación, con botones Copiar. La herramienta inicia SculptForge en este ordenador; nada escucha en la red."},+ {"Let an AI tool (Claude Code, Claude Desktop, Cursor and others) work in this window while you watch: pick your tool, copy its command, turn on live mode. The AI blocks out a starting point; you do the art. Nothing listens on the network.",+ "Deja que una herramienta de IA (Claude Code, Claude Desktop, Cursor y otras) trabaje en esta ventana mientras miras: elige tu herramienta, copia su comando y activa el modo en vivo. La IA prepara un punto de partida; el arte lo haces tú. Nada escucha en la red."},{"User guide: AI agents","Guía del usuario: agentes de IA"},{"Your own agent in Python (uses the OpenAI API with an API key).",diff --git a/src/app/I18nTraditionalChinese.cpp b/src/app/I18nTraditionalChinese.cppindex 06b46d47..9e9ef316 100644--- a/src/app/I18nTraditionalChinese.cpp+++ b/src/app/I18nTraditionalChinese.cpp@@ -3066,14 +3066,10 @@ constexpr Entry kTraditionalChinese[] = {{"AI tools can't control this window", "AI 工具無法控制此視窗"},{"Allow once", "允許一次"},{"Allow this AI step?", "允許此 AI 步驟?"},- {"An AI tool on this computer (sculptforge-cli --mcp --attach) can ask to sculpt here while you watch. You approve each connection; it can see the viewport, and what it sees goes to that tool's AI service. Files outside the project, scripts and the network ask you first. Nothing listens on the network.", "這台電腦上的 AI 工具(sculptforge-cli --mcp --attach)可要求在你觀看時於此雕刻。每次連線都需你同意;它能看到視埠,看到的內容會傳送到該工具的 AI 服務。專案外的檔案、指令碼和網路都會先詢問你。不會在網路上監聽。"},{"Approve", "同意"},- {"Click Approve, or tell your AI tool this code. Approval lasts until it disconnects.", "按「同意」,或把這組代碼告訴你的 AI 工具。同意在其中斷連線前有效。"},- {"Code", "代碼"},{"Deny", "不同意"},{"Disconnect AI tool", "中斷 AI 工具連線"},{"Disconnect", "中斷連線"},- {"It can run SculptForge's commands and see the viewport; what it sees goes to that tool's AI service. Every step is in Undo. Files outside the project, scripts and the network ask you first.", "它可以執行 SculptForge 的指令並看到視埠;看到的內容會傳送到該工具的 AI 服務。每個步驟都在「復原」中。專案外的檔案、指令碼和網路都會先詢問你。"},{"Let AI tools control this window", "允許 AI 工具控制此視窗"},{"Let an AI tool control this window?", "允許 AI 工具控制此視窗?"},{"Live mode can't start: ", "即時模式無法啟動: "},@@ -3081,6 +3077,27 @@ constexpr Entry kTraditionalChinese[] = {{"Stop the AI tool controlling this window now (its steps stay in Undo).", "立即停止控制此視窗的 AI 工具(其步驟保留在「復原」中)。"},{"Stop the AI tool now. Its steps stay in Undo.", "立即停止 AI 工具。其步驟保留在「復原」中。"},{"Your AI tool asks: ", "你的 AI 工具要求: "},+ // The in-app guide (Help > Connect an AI tool, PanelConnectAi.cpp) and its dialogs, in the guide's words+ {"1. Pick your tool", "1. 選擇你的工具"},+ {"2. Let it work in this window", "2. 讓它在此視窗中工作"},+ {"3. What happens next", "3. 接下來會發生什麼"},+ {"Add this to its configuration file (Settings > Developer > Edit Config), then restart Claude Desktop.", "將此加入其設定檔(Settings > Developer > Edit Config),然後重新啟動 Claude Desktop。"},+ {"An AI tool on this computer can ask to work in this window while you watch. You approve it with a 6-digit code. Every step lands in Undo. Files outside the project, scripts and the network ask you first. What it sees goes to that tool's AI service. Nothing listens on the network. To set up your tool: Help > Connect an AI tool.", "這台電腦上的 AI 工具可要求在你觀看時於此視窗中工作。你以 6 位數代碼同意它。每個步驟都會進入「復原」。專案外的檔案、腳本與網路會先詢問你。它看到的內容會傳送到該工具的 AI 服務。沒有任何東西在網路上監聽。設定你的工具:說明 > 連接 AI 工具。"},+ {"Approval lasts until it disconnects. Every step lands in Undo. Files outside the project, scripts and the network ask you first. What it sees goes to that tool's AI service.", "同意在其中斷連線前有效。每個步驟都會進入「復原」。專案外的檔案、腳本與網路會先詢問你。它看到的內容會傳送到該工具的 AI 服務。"},+ {"Ask your AI tool for something (below). SculptForge shows a 6-digit code: click Approve, or tell the AI the code.", "向你的 AI 工具提出要求(範例在下方)。SculptForge 會顯示 6 位數代碼:按「同意」,或把代碼告訴 AI。"},+ {"Block out a creature head with horns for me to sculpt.", "幫我打好一個有角的生物頭部大形,讓我來雕刻。"},+ {"Click Approve, or tell your AI tool this code:", "按「同意」,或把這組代碼告訴你的 AI 工具:"},+ {"Every step lands in Undo as \"AI: ...\", so you can step back.", "每個步驟都會以「AI: ...」進入「復原」,你可以一步步復原。"},+ {"It asks you first before files outside the project, scripts and the network.", "使用專案外的檔案、腳本與網路前,它會先詢問你。"},+ {"It sees the viewport; what it sees goes to that tool's AI service.", "它能看到視埠;它看到的內容會傳送到該工具的 AI 服務。"},+ {"Look at my model from all sides and tell me what to fix.", "從各個角度看看我的模型,告訴我該修正什麼。"},+ {"Make three rock variations I can refine.", "做三種岩石變化,讓我再修飾。"},+ {"On: your AI tool can ask to connect.", "開啟:你的 AI 工具可以要求連線。"},+ {"Plans and sign-in", "方案與登入"},+ {"Teach me: walk me through sculpting an ear, step by step.", "教我:一步一步帶我雕刻耳朵。"},+ {"The AI blocks out a starting point and shows you options; you do the art.", "AI 先打好起點並提供選項;作品由你完成。"},+ {"Try asking", "試著這樣問"},+ {"While it works, the AI connected badge sits at the bottom right. Disconnect stops it.", "工作期間,「AI 已連線」標記會顯示在右下角。按「中斷連線」即可停止。"},// --- Help > Connect an AI tool (PanelConnectAi.cpp, ConnectAi.cpp) ---{"Add to Cursor's global MCP file (or .cursor/mcp.json in a project).",@@ -3109,22 +3126,14 @@ constexpr Entry kTraditionalChinese[] = {"連接 AI 工具..."},{"Copied to the clipboard","已複製到剪貼簿"},- {"Download the Claude Desktop bundle",- "下載 Claude Desktop 套件"},{"Fields:","欄位:"},{"For Gemini Code Assist Standard or Enterprise, or a Gemini API key. Run once in a terminal.","適用於 Gemini Code Assist Standard 或 Enterprise,或 Gemini API 金鑰。在終端機執行一次。"},{"Google's CLI for personal Google accounts (free, Google AI Pro and Ultra). Add this to its MCP file, then sign in with Google.","Google 為個人 Google 帳號(免費、Google AI Pro 與 Ultra)提供的 CLI。將此加入其 MCP 檔案,然後以 Google 登入。"},- {"I have a subscription to",- "我訂閱了"},{"In a terminal:","在終端機中:"},- {"Let an AI assistant use SculptForge's tools: it starts sculptforge-cli on this computer and talks to it directly. Nothing listens on the network. The assistant works on its own scene and saves files where you ask; open them here to see the result.",- "讓 AI 助理使用 SculptForge 的工具:它會在這台電腦上啟動 sculptforge-cli 並直接與之溝通。沒有任何東西在網路上監聽。助理在自己的場景中工作,並把檔案存到你指定的位置;在這裡開啟即可查看結果。"},- {"Download the bundle for your system and install it in Claude Desktop under Settings > Extensions > Advanced settings. Or add SculptForge to its configuration file and restart it.",- "下載適合你系統的套件,並在 Claude Desktop 的 Settings > Extensions > Advanced settings 中安裝。或將 SculptForge 加入其設定檔後重新啟動。"},{"Other tools","其他工具"},{"Program tab > Install > Edit mcp.json, then paste this.",@@ -3159,12 +3168,10 @@ constexpr Entry kTraditionalChinese[] = {"Grok 應用程式(網頁、手機、X)無法連到你電腦上的程式,只能連公開的 HTTPS 伺服器:請使用 Grok Build。xAI 的文件沒有說明 Grok Build 的登入包含哪些方案;它也接受 xAI API 金鑰。"},{"Their documentation","官方文件"},- {"This install:",- "此安裝:"},{"Turn this off in Preferences > AI.","可在偏好設定 > AI 中關閉。"},- {"Use SculptForge from Claude, ChatGPT (Codex), Gemini, Grok, Cursor, VS Code and other AI tools: the exact command or settings for this install, with Copy buttons. The tool starts SculptForge on this computer; nothing listens on the network.",- "從 Claude、ChatGPT(Codex)、Gemini、Grok、Cursor、VS Code 等 AI 工具使用 SculptForge:此安裝的確切命令或設定,附複製按鈕。該工具會在這台電腦上啟動 SculptForge;沒有任何東西在網路上監聽。"},+ {"Let an AI tool (Claude Code, Claude Desktop, Cursor and others) work in this window while you watch: pick your tool, copy its command, turn on live mode. The AI blocks out a starting point; you do the art. Nothing listens on the network.",+ "讓 AI 工具(Claude Code、Claude Desktop、Cursor 等)在你觀看時於此視窗中工作:選擇你的工具、複製其指令、開啟即時模式。AI 先打好起點;作品由你完成。沒有任何東西在網路上監聽。"},{"User guide: AI agents","使用者指南:AI 代理"},{"Your own agent in Python (uses the OpenAI API with an API key).",diff --git a/src/app/PanelAi.cpp b/src/app/PanelAi.cppindex 4417431c..f8ec0d0f 100644--- a/src/app/PanelAi.cpp+++ b/src/app/PanelAi.cpp@@ -83,9 +83,9 @@ void App::registerAiActions() {connect.label = "Connect an AI tool...";connect.icon = ICON_LC_PLUG;connect.palette = "Help";- connect.description = "Use SculptForge from Claude, ChatGPT (Codex), Gemini, Grok, Cursor, VS Code and other AI "- "tools: the exact command or settings for this install, with Copy buttons. The tool starts "- "SculptForge on this computer; nothing listens on the network.";+ connect.description = "Let an AI tool (Claude Code, Claude Desktop, Cursor and others) work in this window while "+ "you watch: pick your tool, copy its command, turn on live mode. The AI blocks out a starting "+ "point; you do the art. Nothing listens on the network.";connect.run = [this] { showConnectAi_ = true; };actions_.add(std::move(connect));}diff --git a/src/app/PanelAiLink.cpp b/src/app/PanelAiLink.cppindex 72ac6465..d7e05789 100644--- a/src/app/PanelAiLink.cpp+++ b/src/app/PanelAiLink.cpp@@ -24,6 +24,7 @@#include <IconsLucide.h>#include <imgui.h>+#include <algorithm>#include <atomic>#include <cmath>#include <cstring>@@ -42,6 +43,16 @@ constexpr double kApprovalSeconds = 120.0; // an unanswered Approve dialog saysdouble seconds() { return double(SDL_GetTicksNS()) * 1e-9; }+// The dialogs look like the app's others (Save changes?, Delete brush): text wrapped at one width, the answer first+// and the refusal second, both buttons one width (110 px, wider only if a translation needs it).+constexpr float kDialogWrap = 360.0f;+float dialogButtonWidth(const char* const (&labels)[2], float scale) {+ float w = 110.0f * scale;+ for (const char* l : labels)+ w = std::max(w, ImGui::CalcTextSize(l, nullptr, true).x + 2.0f * ImGui::GetStyle().FramePadding.x);+ return w;+}+Json schemaProp(const char* type, const char* description) {Json p = Json::object();p.set("type", type);@@ -263,6 +274,10 @@ void App::aiLinkPicked(const std::string& path) {aiLinkPickedPaths_.push_back(path);}+std::string App::aiLinkClient() const {+ return aiLink_ && aiLink_->session ? aiLink_->session->client() : std::string();+}+int App::aiLinkStateValue() const {if (!aiLink_) return 0;if (!aiLink_->session) return 1;@@ -276,10 +291,10 @@ void App::drawAiLinkPrefs() {if (ImGui::Checkbox(tr("Let AI tools control this window##prefs.ai_live"), &on)) setAiLiveControl(on);ui::HelpAction(*this, "prefs.ai_live");ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));- ImGui::TextWrapped("%s", tr("An AI tool on this computer (sculptforge-cli --mcp --attach) can ask to sculpt here while "- "you watch. You approve each connection; it can see the viewport, and what it sees goes "- "to that tool's AI service. Files outside the project, scripts and the network ask "- "you first. Nothing listens on the network."));+ ImGui::TextWrapped("%s", tr("An AI tool on this computer can ask to work in this window while you watch. You approve "+ "it with a 6-digit code. Every step lands in Undo. Files outside the project, scripts and "+ "the network ask you first. What it sees goes to that tool's AI service. Nothing listens "+ "on the network. To set up your tool: Help > Connect an AI tool."));ImGui::PopStyleColor();if (aiLink_ && !aiLink_->error.empty()) ImGui::TextColored(theme::danger, "%s", aiLink_->error.c_str());}@@ -628,36 +643,28 @@ void App::drawAiLink() {ImGui::SetNextWindowPos(centre, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));if (std::exchange(s.focusDialog, false)) ImGui::SetNextWindowFocus();bool open = true;- if (ImGui::Begin(tr("Let an AI tool control this window?###ailinkapprove"), &open, dialog)) {- ImGui::PushTextWrapPos(460 * sc);+ if (ImGui::Begin(tr("Let an AI tool control this window?###ailinkapprove"), nullptr, dialog)) {+ ImGui::PushTextWrapPos(kDialogWrap * sc);ImGui::TextWrapped(tr("\"%s\" on this computer asks to sculpt in this window."), s.session->client().c_str());- ImGui::Spacing();- ImGui::TextUnformatted(tr("Code"));+ ImGui::TextUnformatted(tr("Click Approve, or tell your AI tool this code:"));const std::string& code = s.session->code();- ImGui::PushFont(nullptr);- ImGui::SetWindowFontScale(2.2f);+ if (fontCardTitle_) ImGui::PushFont(fontCardTitle_); // (digits at display size, not a scaled-up 15 px)ImGui::TextColored(theme::accent, "%s %s", code.substr(0, 3).c_str(), code.substr(3).c_str());- ImGui::SetWindowFontScale(1.0f);- ImGui::PopFont();- ImGui::TextWrapped("%s", tr("Click Approve, or tell your AI tool this code. Approval lasts until it disconnects."));- ImGui::Spacing();- ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));- ImGui::TextWrapped("%s", tr("It can run SculptForge's commands and see the viewport; what it sees goes to that "- "tool's AI service. Every step is in Undo. Files outside the project, scripts "- "and the network ask you first."));- ImGui::PopStyleColor();+ if (fontCardTitle_) ImGui::PopFont();+ ImGui::TextDisabled("%s", tr("Approval lasts until it disconnects. Every step lands in Undo. Files outside the "+ "project, scripts and the network ask you first. What it sees goes to that "+ "tool's AI service."));ImGui::PopTextWrapPos();ImGui::Spacing();- ImGui::PushStyleColor(ImGuiCol_Button, theme::accent);- ImGui::PushStyleColor(ImGuiCol_ButtonHovered, theme::accentHover);- ImGui::PushStyleColor(ImGuiCol_Text, theme::textOnAccent);- const bool approve = ImGui::Button(tr("Approve##ailink"), ImVec2(140 * sc, 0));- ImGui::PopStyleColor(3);+ const char* labels[] = {tr("Approve##ailink"), tr("Deny##ailink")};+ const ImVec2 size(dialogButtonWidth(labels, sc), 0);+ const bool approve = ImGui::Button(labels[0], size);ImGui::SameLine();- if (ImGui::Button(tr("Deny##ailink"), ImVec2(120 * sc, 0)) || ImGui::IsKeyPressed(ImGuiKey_Escape)) open = false;+ if (ImGui::Button(labels[1], size) || ImGui::IsKeyPressed(ImGuiKey_Escape)) open = false;if (approve) {s.send(s.session->approve());s.approving = false;+ showConnectAi_ = false; // its steps are done; the badge takes overstatus_ = std::string(tr("AI connected: ")) + s.session->client();consoleEcho("ai_live", {}, {true, "AI connected: " + s.session->client()});}@@ -702,19 +709,22 @@ void App::drawAiLink() {if (std::exchange(s.focusDialog, false)) ImGui::SetNextWindowFocus();bool open = true;bool allow = false;- if (ImGui::Begin(tr("Allow this AI step?###ailinkconfirm"), &open, dialog)) {- ImGui::PushTextWrapPos(480 * sc);+ if (ImGui::Begin(tr("Allow this AI step?###ailinkconfirm"), nullptr, dialog)) {+ ImGui::PushTextWrapPos(kDialogWrap * sc);ImGui::TextWrapped(tr("%s wants to run:"), s.session->client().c_str());+ if (fontMono_) ImGui::PushFont(fontMono_);ImGui::TextColored(theme::accent, "%s", s.confirm->call.name.c_str());const std::string args = link::describeArgs(s.confirm->call.args);if (!args.empty()) ImGui::TextWrapped("%s", args.c_str());- ImGui::Spacing();+ if (fontMono_) ImGui::PopFont();ImGui::TextColored(theme::danger, "%s", s.confirm->reason.c_str());ImGui::PopTextWrapPos();ImGui::Spacing();- allow = ImGui::Button(tr("Allow once##ailink"), ImVec2(140 * sc, 0));+ const char* labels[] = {tr("Allow once##ailink"), tr("Deny##ailinkconfirm")};+ const ImVec2 size(dialogButtonWidth(labels, sc), 0);+ allow = ImGui::Button(labels[0], size);ImGui::SameLine();- if (ImGui::Button(tr("Deny##ailinkconfirm"), ImVec2(120 * sc, 0)) || ImGui::IsKeyPressed(ImGuiKey_Escape)) open = false;+ if (ImGui::Button(labels[1], size) || ImGui::IsKeyPressed(ImGuiKey_Escape)) open = false;}ImGui::End();if (allow) {diff --git a/src/app/PanelConnectAi.cpp b/src/app/PanelConnectAi.cppindex 2b3c66d3..3adc8b55 100644--- a/src/app/PanelConnectAi.cpp+++ b/src/app/PanelConnectAi.cpp@@ -1,17 +1,22 @@// SculptForge - open source digital sculpting// SPDX-License-Identifier: GPL-3.0-or-later//-// Help > Connect an AI tool (app/ConnectAi.h): lead with "I have a ... subscription", then for each client that plan-// signs in to, the exact command or configuration for this install with Copy buttons. Only while AI features are on-// (Preferences > AI): the action is registered in registerAiActions() and removed with the others.+// Help > Connect an AI tool (app/ConnectAi.h): the in-app guide to working with an AI tool, one screen in three steps:+// 1. pick your tool, with the exact command or configuration for this install's live-mode server (--mcp --attach)+// and Copy; 2. the live-mode switch itself; 3. what happens next (the code, the badge, AI: undo steps, what asks+// first); then example prompts. docs/guide/scripting.md "Live mode" says the same in the same words. Only while AI+// features are on (Preferences > AI): the action is registered in registerAiActions() and removed with the others.#include "app/App.h"#include "app/ConnectAi.h"#include "app/I18n.h"+#include "app/Theme.h"#include <IconsLucide.h>#include <imgui.h>+#include <algorithm>#include <filesystem>+#include <iterator>#include <string>namespace sf {@@ -74,73 +79,120 @@ void codeBox(const std::string& text, const std::string& id, ImFont* mono) {void App::drawConnectAi() {if (!showConnectAi_) return;+ if (aiLinkStateValue() == 2) return; // the Approve dialog takes its place (never two dialogs stacked)const float s = uiScale_;- ImGui::SetNextWindowSize(ImVec2(720 * s, 640 * s), ImGuiCond_FirstUseEver);- ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));+ const ImGuiViewport* vp = ImGui::GetMainViewport();+ const float w = std::min(640.0f * s, vp->WorkSize.x - 32.0f * s);+ ImGui::SetNextWindowSizeConstraints(ImVec2(w, 0), ImVec2(w, vp->WorkSize.y - 32.0f * s));+ ImGui::SetNextWindowPos(vp->GetCenter(), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));if (!ImGui::Begin((std::string(tr("Connect an AI tool")) + "###connect_ai").c_str(), &showConnectAi_,- ImGuiWindowFlags_NoCollapse)) {+ ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize)) {ImGui::End();return;}const connect::Os os = thisOs();- const connect::Launch launch = thisInstall();- ImGui::TextWrapped("%s", tr("Let an AI assistant use SculptForge's tools: it starts sculptforge-cli on this computer "- "and talks to it directly. Nothing listens on the network. The assistant works on its own "- "scene and saves files where you ask; open them here to see the result."));- ImGui::Spacing();- std::string command = launch.command;- for (const std::string& a : launch.args) command += " " + a;- ImGui::TextDisabled("%s", tr("This install:"));- ImGui::SameLine();- ImGui::TextUnformatted(command.c_str());- ImGui::SameLine();- copyButton(status_, launch.command, "install");-- ImGui::SeparatorText(tr("I have a subscription to"));- for (int p = 0; p < connect::kPlanCount; ++p) {- if (p) ImGui::SameLine();- const char* name = connect::planName(connect::Plan(p));- if (ImGui::RadioButton((std::string(p == int(connect::Plan::Other) ? tr("Other tools") : name) + "##plan" +- std::to_string(p)).c_str(),- connectPlan_ == p))- connectPlan_ = p;+ connect::Launch launch = thisInstall();+ launch.args.push_back("--attach"); // live mode: the tool works in this window (headless --mcp: the user guide)+ launch.name = "sculptforge-live";+ const std::vector<connect::Client> all = connect::clients(launch, os);+ ImGui::TextWrapped("%s", tr("The AI blocks out a starting point and shows you options; you do the art."));++ // 1. The tool: the three most asked for as buttons, every other one in a list.+ ImGui::SeparatorText(tr("1. Pick your tool"));+ static constexpr const char* kQuick[] = {"claude_code", "claude_desktop", "cursor"};+ const auto find = [&](std::string_view id) -> const connect::Client* {+ for (const connect::Client& c : all)+ if (id == c.id) return &c;+ return nullptr;+ };+ if (!find(connectClient_)) connectClient_ = kQuick[0];+ bool other = true;+ for (const char* id : kQuick) {+ if (const connect::Client* c = find(id)) {+ if (ImGui::RadioButton((std::string(c->name) + "##ai_tool." + id).c_str(), connectClient_ == id))+ connectClient_ = id;+ other &= connectClient_ != id;+ ImGui::SameLine();+ }}- const connect::Plan plan = connect::Plan(connectPlan_);- ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));- for (const char* note : connect::planNotes(plan)) ImGui::TextWrapped("%s", tr(note));- ImGui::PopStyleColor();- ImGui::Spacing();-- if (ImGui::BeginChild("##clients", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()), ImGuiChildFlags_None)) {- for (const connect::Client& c : connect::clients(launch, os)) {- if (c.plan != plan) continue;- ImGui::PushID(c.id);- ImGui::SeparatorText(c.name);- ImGui::TextWrapped("%s", tr(c.how));- if (std::string_view(c.id) == "claude_desktop" &&- ImGui::Button((std::string(ICON_LC_DOWNLOAD " ") + tr("Download the Claude Desktop bundle")).c_str()))- SDL_OpenURL(connect::bundleUrl(os).c_str());- for (size_t k = 0; k < c.snippets.size(); ++k) {- const connect::Snippet& sn = c.snippets[k];- const std::string id = std::to_string(k);- ImGui::TextDisabled("%s", sn.kind == connect::Snippet::Kind::Terminal ? tr("In a terminal:")- : sn.kind == connect::Snippet::Kind::Fields ? tr("Fields:")- : tr("Add to:"));- if (!sn.file.empty()) {- ImGui::SameLine();- ImGui::TextUnformatted(sn.file.c_str());- }- ImGui::SameLine();- copyButton(status_, sn.text, id);- codeBox(sn.text, id, fontMono_);+ if (ImGui::RadioButton((std::string(tr("Other tools")) + "##ai_tool.other").c_str(), other) && !other)+ connectClient_ = "codex";+ other = std::find(std::begin(kQuick), std::end(kQuick), connectClient_) == std::end(kQuick);+ const connect::Client& c = *find(connectClient_);+ if (other) {+ ImGui::SetNextItemWidth(std::min(320.0f * s, ImGui::GetContentRegionAvail().x));+ if (ImGui::BeginCombo("##ai_tool.list", c.name)) {+ for (const connect::Client& o : all) {+ if (std::find(std::begin(kQuick), std::end(kQuick), std::string_view(o.id)) != std::end(kQuick)) continue;+ if (ImGui::Selectable(o.name, connectClient_ == o.id)) connectClient_ = o.id;}- if (ImGui::SmallButton((std::string(ICON_LC_BOOK_OPEN " ") + tr("Their documentation")).c_str()))- SDL_OpenURL(c.docs);- ImGui::PopID();- ImGui::Spacing();+ ImGui::EndCombo();}}- ImGui::EndChild();+ ImGui::PushID(c.id);+ ImGui::TextWrapped("%s", tr(c.how));+ for (size_t k = 0; k < c.snippets.size(); ++k) {+ const connect::Snippet& sn = c.snippets[k];+ const std::string id = std::to_string(k);+ ImGui::TextDisabled("%s", sn.kind == connect::Snippet::Kind::Terminal ? tr("In a terminal:")+ : sn.kind == connect::Snippet::Kind::Fields ? tr("Fields:")+ : tr("Add to:"));+ if (!sn.file.empty()) {+ ImGui::SameLine();+ ImGui::TextUnformatted(sn.file.c_str());+ }+ ImGui::SameLine();+ copyButton(status_, sn.text, id);+ codeBox(sn.text, id, fontMono_);+ }+ if (ImGui::SmallButton((std::string(ICON_LC_BOOK_OPEN " ") + tr("Their documentation")).c_str())) SDL_OpenURL(c.docs);+ if (const std::vector<const char*> notes = connect::planNotes(c.plan); !notes.empty()) {+ ImGui::SameLine();+ ImGui::TextDisabled("%s", tr("Plans and sign-in"));+ if (ImGui::IsItemHovered()) {+ ImGui::BeginTooltip();+ ImGui::PushTextWrapPos(420.0f * s);+ for (const char* note : notes) ImGui::TextWrapped("%s", tr(note));+ ImGui::PopTextWrapPos();+ ImGui::EndTooltip();+ }+ }+ ImGui::PopID();++ // 2. The live-mode switch itself (the same one as Preferences > AI).+ ImGui::SeparatorText(tr("2. Let it work in this window"));+ bool on = aiSettings_.liveControl;+ if (ImGui::Checkbox(tr("Let AI tools control this window##connect.ai_live"), &on)) setAiLiveControl(on);+ ImGui::SameLine();+ if (aiLinkStateValue() >= 3) ImGui::TextColored(theme::accent, tr("AI connected: %s"), aiLinkClient().c_str());+ else if (aiLink_) ImGui::TextDisabled("%s", tr("On: your AI tool can ask to connect."));+ else ImGui::TextDisabled("%s", tr("Off"));++ // 3. What the user will see, in the order it happens.+ ImGui::SeparatorText(tr("3. What happens next"));+ for (const char* line : {tr("Ask your AI tool for something (below). SculptForge shows a 6-digit code: click "+ "Approve, or tell the AI the code."),+ tr("While it works, the AI connected badge sits at the bottom right. Disconnect stops it."),+ tr("Every step lands in Undo as \"AI: ...\", so you can step back."),+ tr("It asks you first before files outside the project, scripts and the network."),+ tr("It sees the viewport; what it sees goes to that tool's AI service.")}) {+ ImGui::Bullet();+ ImGui::TextWrapped("%s", line);+ }++ ImGui::SeparatorText(tr("Try asking"));+ const char* prompts[] = {tr("Block out a creature head with horns for me to sculpt."),+ tr("Look at my model from all sides and tell me what to fix."),+ tr("Make three rock variations I can refine."),+ tr("Teach me: walk me through sculpting an ear, step by step.")};+ for (int i = 0; i < int(std::size(prompts)); ++i) {+ const std::string prompt = prompts[i];+ copyButton(status_, prompt, "prompt" + std::to_string(i));+ ImGui::SameLine();+ ImGui::TextWrapped("%s", prompt.c_str());+ }++ ImGui::Separator();if (ImGui::Button(tr("User guide: AI agents"))) guide_.open("scripting.md");ImGui::SameLine();ImGui::TextDisabled("%s", tr("Turn this off in Preferences > AI."));diff --git a/tests/test_connect_ai.cpp b/tests/test_connect_ai.cppindex dbeef656..0078cb3e 100644--- a/tests/test_connect_ai.cpp+++ b/tests/test_connect_ai.cpp@@ -86,6 +86,21 @@ TEST(connect_ai_every_client_has_a_working_snippet) {CHECK(connect::bundleUrl(connect::Os::Mac).find(".mcpb") != std::string::npos);}+// The window's live-mode server (--mcp --attach) is listed as sculptforge-live in every client, beside a headless+// "sculptforge" entry the user may already have.+TEST(connect_ai_live_server_is_named) {+ const connect::Launch live{"/usr/bin/sculptforge-cli", {"--mcp", "--attach"}, "sculptforge-live"};+ CHECK(checkClients(live, connect::Os::Linux) == 0);+ int unnamed = 0;+ for (const connect::Client& c : connect::clients(live, connect::Os::Linux))+ for (const connect::Snippet& s : c.snippets)+ if (s.text.find("sculptforge-live") == std::string::npos || s.text.find("--attach") == std::string::npos) {+ std::printf(" %s: no sculptforge-live or --attach:\n%s\n", c.id, s.text.c_str());+ ++unnamed;+ }+ CHECK(unnamed == 0);+}+TEST(mcp_recipes_are_prompts) {CommandRegistry reg;Document d;diff --git a/tests/ui/ai_flow.sfui b/tests/ui/ai_flow.sfuinew file mode 100644index 00000000..ce207459--- /dev/null+++ b/tests/ui/ai_flow.sfui@@ -0,0 +1,66 @@+# The whole AI flow as a new user walks it, at 100% and 200% UI scale (the review screenshots, docs/guide/scripting.md):+# Help > Connect an AI tool, live mode on from its step 2, the approval with its code (the guide steps aside: never two+# dialogs stacked), the badge, "Allow this AI step?", Disconnect.+run ui_look look=classic layout=classic+run new_sphere subdivisions=3+run ai_features on=true+click "Help##palette.help"+click "Connect an AI tool...##help.connect_ai"+shot connect-100+click "Claude Desktop##ai_tool.claude_desktop"+shot connect-100-desktop+click "Other tools##ai_tool.other"+shot connect-100-other+click "Claude Code##ai_tool.claude_code"+click "Let AI tools control this window##connect.ai_live"+expect_value ai_link_state == 1+shot connect-100-on+ai_client connect+ai_client send {"hello":"sculptforge-live","v":1,"client":"Claude Code"}+wait_value ai_link_state == 2 5+expect_text "Let an AI tool control this window?"+expect_not "1. Pick your tool"+shot approve-100+click "Approve##ailink"+wait_value ai_link_state == 3 5+expect_value connect_ai_open == 0+shot badge-100+ai_client send {"jsonrpc":"2.0","id":6,"method":"tools/call","params":{"name":"export_glb","arguments":{"path":"/tmp/elsewhere/out.glb"}}}+wait_value ai_link_state == 4 5+shot confirm-100+click "Deny##ailinkconfirm"+wait_value ai_link_state == 3 5+click "Disconnect##ailink"+wait_value ai_link_state == 1 5+shot disconnected-100+ai_client close+# Denied: the guide comes back.+click "Help##palette.help"+click "Connect an AI tool...##help.connect_ai"+ai_client connect+ai_client send {"hello":"sculptforge-live","v":1,"client":"Claude Code"}+wait_value ai_link_state == 2 5+click "Deny##ailink"+wait_value ai_link_state == 1 5+expect_text "1. Pick your tool"+ai_client close++ui_scale 200+shot connect-200+click "Other tools##ai_tool.other"+shot connect-200-other+ai_client connect+ai_client send {"hello":"sculptforge-live","v":1,"client":"Claude Code"}+wait_value ai_link_state == 2 5+shot approve-200+click "Approve##ailink"+wait_value ai_link_state == 3 5+shot badge-200+ai_client send {"jsonrpc":"2.0","id":7,"method":"tools/call","params":{"name":"export_glb","arguments":{"path":"/tmp/elsewhere/out.glb"}}}+wait_value ai_link_state == 4 5+shot confirm-200+click "Deny##ailinkconfirm"+wait_value ai_link_state == 3 5+click "Disconnect##ailink"+wait_value ai_link_state == 1 5+ai_client closediff --git a/tests/ui/connect_ai.sfui b/tests/ui/connect_ai.sfuiindex 1b2b4705..46f6a9bd 100644--- a/tests/ui/connect_ai.sfui+++ b/tests/ui/connect_ai.sfui@@ -1,5 +1,7 @@-# Help > Connect an AI tool (PanelConnectAi.cpp): the subscription picker and, for this install, each tool's command or-# settings. Only while AI features are on (Preferences > AI). UI tests never start a browser: no docs or bundle clicks.+# Help > Connect an AI tool (PanelConnectAi.cpp): the in-app guide in three steps. 1. pick your tool: for this install,+# the live-mode server's exact command or settings (--mcp --attach, listed as sculptforge-live); 2. the live-mode+# switch, right there; 3. what happens next; example prompts with Copy. Only while AI features are on (Preferences > AI).+# UI tests never start a browser: no docs clicks.run ui_look look=classic layout=classicrun new_sphere subdivisions=3run ai_features on=true@@ -7,32 +9,36 @@ click "Help##palette.help"expect "Connect an AI tool...##help.connect_ai"click "Connect an AI tool...##help.connect_ai"expect_value connect_ai_open == 1-expect_text "This install:"-expect_text "sculptforge-cli"-# Claude first: Claude Desktop and Claude Code.-expect_text "Claude Desktop"-expect_text "claude mcp add --scope user sculptforge --"-shot connect_claude-click "ChatGPT##plan1"-expect_text "codex mcp add sculptforge --"-expect_text "The ChatGPT app only connects to remote (HTTPS) servers"-shot connect_chatgpt-click "Gemini##plan2"-expect_text "Antigravity CLI"-expect_text "mcp_config.json"-shot connect_gemini-click "Grok##plan3"-expect_text "grok mcp add sculptforge --"-shot connect_grok-click "Other tools##plan4"-expect_text "Cursor"-expect_text "context_servers"-expect_text "Rovo Dev CLI"+# Claude Code first.+expect_text "1. Pick your tool"+expect_text "claude mcp add --scope user sculptforge-live --"+expect_text "--mcp --attach"+expect_text "2. Let it work in this window"+expect_text "3. What happens next"+expect_text "Try asking"+shot connect_claude_code+click "Claude Desktop##ai_tool.claude_desktop"+expect_text "claude_desktop_config.json"+expect_text "sculptforge-live"+shot connect_claude_desktop+click "Cursor##ai_tool.cursor"+expect_text "mcp.json"+click "Other tools##ai_tool.other"+expect_text "codex mcp add sculptforge-live --"shot connect_other# Copy puts the exact text on the clipboard.-click "Copy##install"+click "Copy##prompt0"expect_status Copied to the clipboard-expect_clipboard sculptforge-cli+expect_clipboard "creature head"+click "Copy##0"+expect_clipboard "codex mcp add sculptforge-live"+# Step 2 is live mode's own switch: on here is on in Preferences > AI.+expect_value ai_link_state == 0+click "Let AI tools control this window##connect.ai_live"+expect_value ai_link_state == 1+expect_text "On: your AI tool can ask to connect."+click "Let AI tools control this window##connect.ai_live"+expect_value ai_link_state == 0# AI off: the window closes and Help no longer offers it.run ai_features on=falseexpect_value connect_ai_open == 0