A linked image (`ImageObject.link`, now a LinkInfo: absolute path, path relative to the document, size, modification time, hash, page; old path strings still load) keeps a low-resolution preview (`ImageBlob.proxy`, at most 256 px a side) that a native save writes in place of the pixels of images only linked images show. Opening a native document reads the linked files again, looking for each at its path, then relative to the document and by name in its folder: missing files show their preview, modified ones are read again only with Update Links: Automatically. `document.open` reports `missingLinks`, `modifiedLinks` and `updatedLinks`. links.check reports each link's status, links.update reads modified files again and links.relink points images at another file or at same-named files in a folder (each keeps its bounds; one undo step). In the app, a document opened without its linked files asks about each (Replace…, Ignore, Apply to All), then offers to update modified links when the preference asks. The renderer caches previews apart from the file's pixels; the Eyedropper samples previews in the object's pixel space. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.4 KiB
Rust
46 lines
1.4 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;
|
|
mod server;
|
|
mod tools;
|
|
|
|
pub use backend::{Backend, Remote};
|
|
pub use headless::Headless;
|
|
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_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_place;
|
|
#[cfg(test)]
|
|
mod tests_svg;
|