From 1bfddeefd6952f2fb20d17be85876811d79b39b9 Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Tue, 13 Oct 2026 21:14:47 -0700 Subject: [PATCH] Move the editor control protocol crate into the libraries folder (#4694) --- Cargo.lock | 20 +++++++++---------- Cargo.toml | 4 ++-- .../control-protocol/Cargo.toml | 2 +- .../control-protocol/src/lib.rs | 0 tools/web-editor-driver/Cargo.toml | 2 +- tools/web-editor-driver/README.md | 4 ++-- tools/web-editor-driver/src/browser.rs | 2 +- tools/web-editor-driver/src/client.rs | 2 +- tools/web-editor-driver/src/host.rs | 2 +- tools/web-editor-driver/src/main.rs | 2 +- tools/web-editor-driver/src/session.rs | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) rename {editor => libraries}/control-protocol/Cargo.toml (92%) rename {editor => libraries}/control-protocol/src/lib.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 1e46b83818..7db16309ba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -830,6 +830,15 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d52eff69cd5e647efe296129160853a42795992097e8af39800e1060caeea9b" +[[package]] +name = "control-protocol" +version = "0.0.0" +dependencies = [ + "glam 0.33.10", + "serde", + "serde_json", +] + [[package]] name = "convert_case" version = "0.12.0" @@ -2427,15 +2436,6 @@ dependencies = [ "zip", ] -[[package]] -name = "graphite-editor-control-protocol" -version = "0.0.0" -dependencies = [ - "glam 0.33.10", - "serde", - "serde_json", -] - [[package]] name = "graphite-proc-macros" version = "0.0.0" @@ -6926,9 +6926,9 @@ version = "0.0.0" dependencies = [ "base64", "clap", + "control-protocol", "getrandom 0.3.3", "glam 0.33.10", - "graphite-editor-control-protocol", "image", "interprocess", "serde", diff --git a/Cargo.toml b/Cargo.toml index d52bfb285d..df9e1eb186 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,13 +12,13 @@ members = [ "document/graph-storage", "document/container", "editor", - "editor/control-protocol", "frontend/wrapper", "libraries/dyn-any", "libraries/math-parser", "libraries/ipsum", "libraries/snapping", "libraries/wgpu-sync", + "libraries/control-protocol", "node-graph/libraries/graphene-hash", "node-graph/libraries/*", "node-graph/nodes/*", @@ -111,7 +111,7 @@ wgpu-executor = { path = "node-graph/libraries/wgpu-executor" } wgpu-sync = { path = "libraries/wgpu-sync" } graphite-proc-macros = { path = "proc-macros" } graphite-editor = { path = "editor" } -graphite-editor-control-protocol = { path = "editor/control-protocol" } +control-protocol = { path = "libraries/control-protocol" } graphene-canvas-utils = { path = "node-graph/libraries/canvas-utils" } ipsum = { path = "libraries/ipsum" } diff --git a/editor/control-protocol/Cargo.toml b/libraries/control-protocol/Cargo.toml similarity index 92% rename from editor/control-protocol/Cargo.toml rename to libraries/control-protocol/Cargo.toml index 1db69fda9b..97b3fd3665 100644 --- a/editor/control-protocol/Cargo.toml +++ b/libraries/control-protocol/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "graphite-editor-control-protocol" +name = "control-protocol" description = "The commands, results, and scenarios that scripts, QA, and agents use to operate the Graphite editor" version.workspace = true license.workspace = true diff --git a/editor/control-protocol/src/lib.rs b/libraries/control-protocol/src/lib.rs similarity index 100% rename from editor/control-protocol/src/lib.rs rename to libraries/control-protocol/src/lib.rs diff --git a/tools/web-editor-driver/Cargo.toml b/tools/web-editor-driver/Cargo.toml index f4f54dfbf9..16093419b4 100644 --- a/tools/web-editor-driver/Cargo.toml +++ b/tools/web-editor-driver/Cargo.toml @@ -16,7 +16,7 @@ workspace = true [dependencies] # Local dependencies -graphite-editor-control-protocol = { workspace = true } +control-protocol = { workspace = true } # Workspace dependencies serde = { workspace = true } diff --git a/tools/web-editor-driver/README.md b/tools/web-editor-driver/README.md index 164fee1ca7..0a882b8fe0 100644 --- a/tools/web-editor-driver/README.md +++ b/tools/web-editor-driver/README.md @@ -8,7 +8,7 @@ Drives the Graphite web editor the way a person does. Every action is real mouse The driver runs its own copy of Chromium, downloaded into this directory, with a fresh profile every session. It never touches a browser, profile, or history already on the machine. -It is written in Rust, apart from the small Node.js process in `playwright/` that delivers input and takes screenshots through Playwright. The commands, their results, and scenario files are defined by the editor control protocol in `editor/control-protocol`. +It is written in Rust, apart from the small Node.js process in `playwright/` that delivers input and takes screenshots through Playwright. The commands, their results, and scenario files are defined by the editor control protocol in `libraries/control-protocol`. The TypeScript in `playwright/` follows the frontend's lint rules, using the tools the frontend installs. Check it with `npm run check` in that folder, and fix what can be fixed automatically with `npm run fix`. @@ -68,7 +68,7 @@ A scenario file holds the same commands the command line performs, one per line Scenario files are named for what they do, ending in `.jsonl`, such as `draw-rectangle.jsonl`. -The commands and their fields are defined by `Command` in `editor/control-protocol/src/lib.rs`. +The commands and their fields are defined by `Command` in `libraries/control-protocol/src/lib.rs`. ## QA diff --git a/tools/web-editor-driver/src/browser.rs b/tools/web-editor-driver/src/browser.rs index b94c50c9c5..5201fd2ef1 100644 --- a/tools/web-editor-driver/src/browser.rs +++ b/tools/web-editor-driver/src/browser.rs @@ -1,6 +1,6 @@ use base64::Engine; +use control_protocol::{MouseButton, Rectangle}; use glam::{DVec2, UVec2}; -use graphite_editor_control_protocol::{MouseButton, Rectangle}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::collections::HashMap; diff --git a/tools/web-editor-driver/src/client.rs b/tools/web-editor-driver/src/client.rs index a9663cef90..8a80c666aa 100644 --- a/tools/web-editor-driver/src/client.rs +++ b/tools/web-editor-driver/src/client.rs @@ -1,6 +1,6 @@ //! Starting, reaching, and stopping the session host, which owns the browser so separate invocations can act on the same editor one after another. -use graphite_editor_control_protocol::{ClientMessage, Command, CommandResult, HostMessage, PROTOCOL_VERSION}; +use control_protocol::{ClientMessage, Command, CommandResult, HostMessage, PROTOCOL_VERSION}; use interprocess::local_socket::{RecvHalf, SendHalf, Stream, prelude::*}; use serde::{Deserialize, Serialize}; use std::io::BufReader; diff --git a/tools/web-editor-driver/src/host.rs b/tools/web-editor-driver/src/host.rs index b40923e7aa..58b498ac95 100644 --- a/tools/web-editor-driver/src/host.rs +++ b/tools/web-editor-driver/src/host.rs @@ -1,6 +1,6 @@ //! The long-lived process that owns the browser, which `start` runs in the background and every later invocation connects to. -use graphite_editor_control_protocol::{ClientMessage, Command, CommandResult, HostMessage, PROTOCOL_VERSION}; +use control_protocol::{ClientMessage, Command, CommandResult, HostMessage, PROTOCOL_VERSION}; use interprocess::local_socket::{ListenerOptions, Stream, prelude::*}; use std::io::BufReader; use std::sync::{Arc, Mutex, PoisonError}; diff --git a/tools/web-editor-driver/src/main.rs b/tools/web-editor-driver/src/main.rs index 64b3bfe648..3f939b0efc 100644 --- a/tools/web-editor-driver/src/main.rs +++ b/tools/web-editor-driver/src/main.rs @@ -11,8 +11,8 @@ mod session; mod socket; use clap::{Args, Parser, Subcommand, ValueEnum}; +use control_protocol::{Command, Filmstrip, MouseButton, Rectangle, Space, parse_scenario}; use glam::{DVec2, UVec2}; -use graphite_editor_control_protocol::{Command, Filmstrip, MouseButton, Rectangle, Space, parse_scenario}; use serde::Serialize; use std::num::NonZeroU32; use std::path::{Path, PathBuf}; diff --git a/tools/web-editor-driver/src/session.rs b/tools/web-editor-driver/src/session.rs index 7ca221ba67..04833fd2d1 100644 --- a/tools/web-editor-driver/src/session.rs +++ b/tools/web-editor-driver/src/session.rs @@ -1,5 +1,5 @@ +use control_protocol::{Command, CommandResult, Filmstrip, Located, MouseButton, Rectangle, SessionStatus, Space}; use glam::{DVec2, UVec2}; -use graphite_editor_control_protocol::{Command, CommandResult, Filmstrip, Located, MouseButton, Rectangle, SessionStatus, Space}; use std::num::NonZeroU32; use std::path::Path; use std::sync::Arc;