diff --git a/Cargo.lock b/Cargo.lock index 066d237e4..6546ef77c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3124,6 +3124,7 @@ dependencies = [ "op-ai", "op-ai-skills", "op-codegen", + "op-config-store", "op-design-lint", "op-editor-core", "op-editor-host-core", diff --git a/crates/op-editor-host-core/Cargo.toml b/crates/op-editor-host-core/Cargo.toml index 3646e8e63..20fe119a8 100644 --- a/crates/op-editor-host-core/Cargo.toml +++ b/crates/op-editor-host-core/Cargo.toml @@ -7,10 +7,22 @@ license.workspace = true description = "Transport-free editor host state machines shared by OpenPencil hosts" [dependencies] -jian-ops-schema = { path = "../../vendor/jian/crates/jian-ops-schema" } -op-ai = { path = "../op-ai" } -op-ai-skills = { path = "../op-ai-skills" } -op-codegen = { path = "../op-codegen", features = ["ai"] } +jian-ops-schema = { path = "../../vendor/jian/crates/jian-ops-schema", optional = true } +op-ai = { path = "../op-ai", optional = true } +op-ai-skills = { path = "../op-ai-skills", optional = true } +op-codegen = { path = "../op-codegen", features = ["ai"], optional = true } op-editor-core = { path = "../op-editor-core" } -op-orchestrator = { path = "../op-orchestrator" } -serde_json = { workspace = true } +op-orchestrator = { path = "../op-orchestrator", optional = true } +serde_json = { workspace = true, optional = true } + +[features] +default = ["chat", "codegen", "design"] +chat = ["dep:op-ai", "dep:serde_json"] +codegen = [ + "dep:jian-ops-schema", + "dep:op-ai", + "dep:op-ai-skills", + "dep:op-codegen", + "dep:serde_json", +] +design = ["dep:op-orchestrator"] diff --git a/crates/op-editor-host-core/src/lib.rs b/crates/op-editor-host-core/src/lib.rs index 79b4d2a45..ac1813042 100644 --- a/crates/op-editor-host-core/src/lib.rs +++ b/crates/op-editor-host-core/src/lib.rs @@ -1,6 +1,10 @@ //! Transport-free editor host state machines shared by native and web hosts. +#[cfg(feature = "chat")] pub mod chat; +#[cfg(feature = "codegen")] pub mod codegen; +#[cfg(feature = "codegen")] pub mod codegen_session; +#[cfg(feature = "design")] pub mod design; diff --git a/crates/op-host-desktop/Cargo.toml b/crates/op-host-desktop/Cargo.toml index db49cb7f7..3cecaa768 100644 --- a/crates/op-host-desktop/Cargo.toml +++ b/crates/op-host-desktop/Cargo.toml @@ -69,6 +69,8 @@ op-host-native = { path = "../op-host-native", version = "0.8.0" } op-editor-core = { path = "../op-editor-core" } # Transport-free host state machines shared with web/native hosts. op-editor-host-core = { path = "../op-editor-host-core" } +# Shared `~/.openpencil` well-known paths used by CLI and desktop discovery. +op-config-store = { path = "../op-config-store" } # D′ architecture: pre-validation adapter translates PlannedFix → EditorCommand. op-design-lint = { path = "../op-design-lint" } # AI code-generation pipeline. The `ai` feature compiles the pull-based diff --git a/crates/op-host-desktop/src/mcp_port_file.rs b/crates/op-host-desktop/src/mcp_port_file.rs index 0897a3bb8..3533d1245 100644 --- a/crates/op-host-desktop/src/mcp_port_file.rs +++ b/crates/op-host-desktop/src/mcp_port_file.rs @@ -18,11 +18,11 @@ use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; -const PORT_FILE_DIR: &str = ".openpencil"; -const PORT_FILE_NAME: &str = ".op-mcp-port"; - fn port_file_path() -> Option { - Some(dirs::home_dir()?.join(PORT_FILE_DIR).join(PORT_FILE_NAME)) + op_config_store::ConfigStore::user() + .ok()? + .path(op_config_store::well_known::LIVE_MCP_PORT) + .ok() } fn now_millis() -> u64 { diff --git a/crates/op-host-web/Cargo.toml b/crates/op-host-web/Cargo.toml index f4e8272d4..a93906651 100644 --- a/crates/op-host-web/Cargo.toml +++ b/crates/op-host-web/Cargo.toml @@ -28,7 +28,7 @@ op-editor-ui = { path = "../op-editor-ui" } # (`pen_document_to_document` runs `SkiaMeasure` for text layout); # keeping it optional preserves the wasm32-clean stub baseline. op-editor-core = { path = "../op-editor-core", optional = true } -op-editor-host-core = { path = "../op-editor-host-core", optional = true } +op-editor-host-core = { path = "../op-editor-host-core", optional = true, default-features = false } op-pen-loader = { path = "../op-pen-loader", optional = true } # P4b web AI-streaming foundation: the codegen/AI pipeline. Optional + behind # the `codegen` feature (which also pulls `skia`) so the wasm32-clean stub @@ -170,6 +170,7 @@ codegen = [ "dep:op-codegen", "dep:op-ai", "dep:op-editor-host-core", + "op-editor-host-core/codegen", "dep:jian-ops-schema", "dep:serde_json", "dep:op-figma",