mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 18:56:55 -06:00
Reported: with the Pen there was no way to edit curves in place as Ctrl does in Illustrator on Windows (Cmd on the Mac), segments couldn't be grabbed, and the curve-editing tools felt slow and sometimes didn't take a handle. - Cmd/Ctrl held at a press with any tool but a selection tool now borrows the selection tool in the engine (Session::pointer), not in the canvas: the selection tool chosen last, or Direct Selection for the Pen, Curvature and anchor tools until one is chosen. The tool lent to isn't deactivated, so the Pen goes on drawing its path after the release while that path stays selected; it no longer draws on another open path selected meanwhile. Agents reach it with pointer_gesture mods.cmd. With Cmd held the pointer is the borrowed tool's. Choosing a tool or switching documents mid-gesture gives the tool back first. - Pen + Alt over a segment of a selected path reshapes it, as the Anchor Point tool does. - The handles shown are the handles that drag (one helper for Direct Selection, the Anchor Point tool and Pen + Alt): Direct Selection now drags the handles of a path selected as a whole (as the Pen leaves it, so Cmd + drag of a handle while drawing works), the Anchor Point tool no longer grabs handles that Show handles when multiple anchors are selected hides, the nearest handle wins, and a handle shorter than the tolerance leaves its anchor to be picked. The anchor tools pick within Selection & Anchor Display > Tolerance instead of a fixed 4 px. - path.reshapeSegment keeps a smooth anchor at either end smooth (its other handle turns with the moved one) instead of kinking it. - A dragged handle gathered its smart guide targets from the whole document on every pointer move (21 ms per move on 20,000 paths): HandleSnap now gathers them once per drag (1 ms). vectorcraft-cli perf measures handle and segment drags on a 5,000-anchor path. - catalog::is_selection_tool and catalog::edits_anchors replace the UI's own lists. - Tests in tools, engine and MCP (headless pointer_gesture); docs/mcp.md, control-protocol.md, ROADMAP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
1.7 KiB
Rust
61 lines
1.7 KiB
Rust
//! VectorCraft's MCP server.
|
|
//!
|
|
//! [Model Context Protocol](https://modelcontextprotocol.io) over stdio: newline-delimited
|
|
//! JSON-RPC 2.0, hand-written (no async runtime). The server exposes VectorCraft as a set of MCP
|
|
//! tools and resources and forwards everything to a [`Backend`]:
|
|
//!
|
|
//! - [`Remote`] talks to a running desktop app through its loopback JSON-lines control channel
|
|
//! (`vectorcraft --control 7979`): one `{"id","method","params"}` line in, one
|
|
//! `{"id","ok","result"|"error"}` line out.
|
|
//! - [`Headless`] hosts an in-process [`vectorcraft_engine::Session`] and implements the same
|
|
//! control-channel method names itself (rendering screenshots with `vectorcraft-render`), so agents
|
|
//! can draw and look at the result without a window.
|
|
//!
|
|
//! Entry points: [`Server::serve`] (stdio loop) and [`Server::handle_line`] (one message).
|
|
#![forbid(unsafe_code)]
|
|
|
|
mod backend;
|
|
mod headless;
|
|
pub mod logging;
|
|
mod prompts;
|
|
mod resources;
|
|
mod server;
|
|
mod tools;
|
|
|
|
pub use backend::{Backend, Remote};
|
|
pub use headless::Headless;
|
|
pub use prompts::{PROMPTS, PromptArg, PromptDef};
|
|
pub use resources::{DOC_JSON_URI, DOC_URI, TEMPLATES};
|
|
pub use server::{PROTOCOL_VERSION, Server};
|
|
pub use tools::{ToolResult, call_tool, tool_definitions};
|
|
|
|
/// Default control-channel address of the desktop app.
|
|
pub const DEFAULT_ADDR: &str = "127.0.0.1:7979";
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|
|
#[cfg(test)]
|
|
mod tests_distortkeys;
|
|
#[cfg(test)]
|
|
mod tests_exportas;
|
|
#[cfg(test)]
|
|
mod tests_fileio;
|
|
#[cfg(test)]
|
|
mod tests_freeform;
|
|
#[cfg(test)]
|
|
mod tests_gradient;
|
|
#[cfg(test)]
|
|
mod tests_links;
|
|
#[cfg(test)]
|
|
mod tests_liquify;
|
|
#[cfg(test)]
|
|
mod tests_pen;
|
|
#[cfg(test)]
|
|
mod tests_persp;
|
|
#[cfg(test)]
|
|
mod tests_place;
|
|
#[cfg(test)]
|
|
mod tests_protocol;
|
|
#[cfg(test)]
|
|
mod tests_svg;
|