chore(host-core): tighten feature boundaries

This commit is contained in:
Kayshen-X 2026-06-14 12:18:51 +08:00
parent 2a6d2191ef
commit 8f3d7588c0
6 changed files with 31 additions and 11 deletions

1
Cargo.lock generated
View file

@ -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",

View file

@ -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"]

View file

@ -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;

View file

@ -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

View file

@ -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<PathBuf> {
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 {

View file

@ -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",