mirror of
https://github.com/storytold/figcraft.git
synced 2026-10-24 02:16:56 -06:00
* M9: real-time collaboration protocol (design) docs/collab-protocol.md: WebSocket sessions with a server-ordered, per-property last-writer-wins document sync, client-scoped ids, fractional positions for children, ephemeral presence (cursors, selections, follow), per-user undo, hosting from the app first and a self-hosted server next, and the implementation plan. ROADMAP gains M9. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M9: collaboration core: ids, change sets, server ordering, convergence Step 1 of docs/collab-protocol.md, no networking: - Client-scoped node ids: Document::set_client_id makes alloc_id hand out client << 32 | counter; single-user files allocate as before; the id counter is no longer part of document equality. - crates/collab (layer 2): the synced object/property model (every saved Node field, plus document-level styles, comments, variables, images, dev snapshots, library data), Change batches, an O(changed) diff, strict and lenient apply, fractional sibling positions, snapshots. - Server (ordering, validation, rejects with fixes) and Client (optimistic view, replay under remote batches, author-side repair of derived data) as pure state machines; binary (version byte + postcard, JSON values) and JSON message forms, fuzzed decoders. - Engine: normalize as the recompute hook, collab.diff. - Tests: round trips over random real commands, an N-client convergence fuzz test over delayed in-order links, junk batches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M9: fmt after merge * M9: live sessions: host from the app, invite links, live cursors and presence Step 2 of docs/collab-protocol.md, networking and presence half: - crates/collab-net (layer 6): WebSocket transport (sync tungstenite, a reader and a writer thread per connection, no async runtime), the session host the app embeds (runs figcraft_collab::Server as the authority, carries its messages), invite links, presence throttling (~30 Hz, latest wins), limits (sockets, hello/idle timeouts, message size, rate, slow clients), keep-alive, clean close, reconnect with backoff; a browser stand-in until the web-sys client (step 4). - engine: live session state (status, peers, presence, follow) and the collab.host/stop/join/leave/peers/follow/cursor commands; the network is reached only through the LiveLink the app installs. - ui-egui: remote cursors (pointer drawn in code, name tag, gliding), selection outlines (once documents sync), avatars in the right panel with follow, the Share popover (start, invite link + URL with Copy, stop), File > Join live session. - desktop app and MCP headless session install the link; xtask layers keeps networking crates out of L0-L5. - Documents don't sync between apps yet (follow-up). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M9: live sessions: document sync between apps - The host's session runs figcraft_collab::Server seeded with the shared document; every app (the host's too, through the hub without a socket) is a collab Client. Guests open the host's file from the welcome as a new tab; leaving keeps it as a local copy. - Engine: after each local action (a gesture once it ends; nothing during version or text previews) the session document is diffed into one Changes batch; server batches go through Client::receive with EngineRecompute and are installed with Session::apply_remote, which never touches the undo history. Batches arriving mid-gesture wait. - Transport: Changes/Reject/Welcome reach the engine as Event::Sync; LiveLink::send carries batches in order; hellos are limited to 64 KiB, joined clients to the core's message size. - Tests: engine sync against a real Server (ids in the client's space, one batch per gesture, remote edits skip undo, deferral, closing the file leaves), three apps over loopback converging (create, move, recolour, delete, rename) and a late joiner getting the server's state. - Docs: collab-protocol, mcp, README, roadmap docs; the UI's "cursors only" note is gone, replaced by the per-person undo caveat. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
99 lines
3.1 KiB
TOML
99 lines
3.1 KiB
TOML
[workspace]
|
||
resolver = "3"
|
||
members = ["crates/*", "apps/*", "xtask"]
|
||
# The plugin SDK and examples build for wasm32 in a workspace of their own (`cargo xtask plugins`).
|
||
exclude = ["plugins"]
|
||
# default-members = ["crates/*", "apps/figcraft", "apps/figcraft-cli", "xtask"]
|
||
|
||
[workspace.package]
|
||
version = "0.2.0"
|
||
edition = "2024"
|
||
license = "MIT OR Apache-2.0"
|
||
rust-version = "1.95"
|
||
repository = "https://github.com/storytold/figcraft"
|
||
|
||
[workspace.dependencies]
|
||
# internal
|
||
figcraft-geom = { path = "crates/geom" }
|
||
figcraft-color = { path = "crates/color" }
|
||
figcraft-doc = { path = "crates/doc" }
|
||
figcraft-layout = { path = "crates/layout" }
|
||
figcraft-text = { path = "crates/text" }
|
||
figcraft-pathops = { path = "crates/pathops" }
|
||
figcraft-render = { path = "crates/render" }
|
||
figcraft-svg = { path = "crates/svg" }
|
||
figcraft-pdf = { path = "crates/pdf" }
|
||
figcraft-format = { path = "crates/format" }
|
||
figcraft-tools = { path = "crates/tools" }
|
||
figcraft-collab = { path = "crates/collab" }
|
||
figcraft-engine = { path = "crates/engine" }
|
||
figcraft-ui-egui = { path = "crates/ui-egui" }
|
||
figcraft-mcp = { path = "crates/mcp" }
|
||
figcraft-collab-net = { path = "crates/collab-net" }
|
||
figcraft-plugin = { path = "crates/plugin" }
|
||
|
||
# foundation
|
||
kurbo = { version = "0.13", features = ["serde"] }
|
||
thiserror = "2"
|
||
serde = { version = "1", features = ["derive", "rc"] }
|
||
serde_json = { version = "1", features = ["float_roundtrip"] }
|
||
log = "0.4"
|
||
proptest = "1"
|
||
imbl = { version = "7", features = ["serde"] }
|
||
postcard = { version = "1", default-features = false, features = ["alloc"] }
|
||
|
||
# rendering / formats
|
||
tiny-skia = "0.12"
|
||
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "webp", "gif", "bmp"] }
|
||
usvg = "0.48"
|
||
krilla = "0.8"
|
||
skrifa = "0.47"
|
||
harfrust = "0.13"
|
||
unicode-bidi = "0.3"
|
||
linesweeper = "0.4"
|
||
zip = { version = "2", default-features = false, features = ["deflate"] }
|
||
sha2 = "0.10"
|
||
base64 = "0.22"
|
||
crc32fast = "1"
|
||
|
||
# plugins: a pure-Rust, metered WebAssembly interpreter (no JIT; also runs in the web build). The
|
||
# portable dispatch loop: tail-call dispatch relies on an LLVM optimisation that unoptimised and
|
||
# debug builds may not do, and then a long-running plugin overflows the native stack.
|
||
wasmi = { version = "2", default-features = false, features = ["std", "stable", "validate", "portable-dispatch"] }
|
||
wat = "1.261"
|
||
|
||
# ui
|
||
egui = "0.36"
|
||
egui_extras = { version = "0.36", default-features = false }
|
||
eframe = { version = "0.36", default-features = false }
|
||
rfd = "0.17"
|
||
arboard = { version = "3.6", default-features = false }
|
||
webbrowser = "1"
|
||
|
||
[workspace.lints.rust]
|
||
unsafe_code = "forbid"
|
||
|
||
[workspace.lints.clippy]
|
||
dbg_macro = "warn"
|
||
# Style lints from newer toolchains that fight index-heavy pixel code.
|
||
needless_range_loop = "allow"
|
||
chunks_exact_to_as_chunks = "allow"
|
||
# FigCraft never crashes: shipped code returns `Result`/`Option` instead of panicking (see
|
||
# AGENTS.md › Never crash). Tests may unwrap (clippy.toml).
|
||
unwrap_used = "deny"
|
||
expect_used = "deny"
|
||
panic = "deny"
|
||
todo = "deny"
|
||
unimplemented = "deny"
|
||
unreachable = "deny"
|
||
|
||
[profile.dev.package."*"]
|
||
opt-level = 2
|
||
|
||
[profile.dev]
|
||
opt-level = 1
|
||
|
||
[profile.release]
|
||
lto = "thin"
|
||
codegen-units = 4
|