diff --git a/src/apps/cli/Cargo.toml b/src/apps/cli/Cargo.toml index f8d33a49f8..6e24dc7e37 100644 --- a/src/apps/cli/Cargo.toml +++ b/src/apps/cli/Cargo.toml @@ -81,11 +81,18 @@ tracing-subscriber = { workspace = true } tempfile = "3" sha2 = { workspace = true } hex = { workspace = true } -portable-pty = { workspace = true } [target.'cfg(windows)'.dependencies] windows = { workspace = true, features = ["Win32_Foundation", "Win32_System_Console"] } +# portable-pty: ohos requires 0.9 (nix 0.25 is incompatible); all other +# platforms use 0.8 to avoid the PSEUDOCONSOLE_INHERIT_CURSOR ConPTY bug. +[target.'cfg(not(target_env = "ohos"))'.dev-dependencies] +portable-pty = { workspace = true } + +[target.'cfg(target_env = "ohos")'.dev-dependencies] +portable-pty = "0.9" + [features] default = [] diff --git a/src/crates/execution/tool-execution/Cargo.toml b/src/crates/execution/tool-execution/Cargo.toml index 5b1413ccfb..0cfde9bf5c 100644 --- a/src/crates/execution/tool-execution/Cargo.toml +++ b/src/crates/execution/tool-execution/Cargo.toml @@ -20,7 +20,6 @@ htmd = { version = "0.5.4", optional = true } ignore = { workspace = true } legible = { version = "0.4.2", optional = true } log = { workspace = true } -readability-js = { version = "0.1.5", optional = true } regex = { workspace = true, optional = true } serde = { workspace = true } serde_json = { workspace = true } @@ -28,5 +27,8 @@ tokio = { workspace = true } tokio-util = { workspace = true } vte = { workspace = true, features = ["ansi"] } +[target.'cfg(not(target_env = "ohos"))'.dependencies] +readability-js = { version = "0.1.5", optional = true } + [lints] workspace = true diff --git a/src/crates/execution/tool-execution/src/web_readable.rs b/src/crates/execution/tool-execution/src/web_readable.rs index 75c3e142c9..4e8c4ff370 100644 --- a/src/crates/execution/tool-execution/src/web_readable.rs +++ b/src/crates/execution/tool-execution/src/web_readable.rs @@ -1,5 +1,6 @@ use htmd::HtmlToMarkdown; use legible::{parse as parse_legible, Error as LegibleError, Options as LegibleOptions}; +#[cfg(not(target_env = "ohos"))] use readability_js::{Readability, ReadabilityOptions}; use regex::{Captures, Regex}; @@ -73,10 +74,12 @@ pub fn extract_markdown_with_text_fallback( // Keep the existing extractor order. Local extraction experiments across // article, documentation, wiki, and forum pages showed `legible` gives the // best current quality/latency balance, with readability-js as fallback. - for extractor in [ - attempt_legible as ExtractorFn, - attempt_readability_js as ExtractorFn, - ] { + #[cfg(not(target_env = "ohos"))] + let extractors: &[ExtractorFn] = &[attempt_legible as ExtractorFn, attempt_readability_js as ExtractorFn]; + #[cfg(target_env = "ohos")] + let extractors: &[ExtractorFn] = &[attempt_legible as ExtractorFn]; + + for extractor in extractors { let Ok(candidate) = extractor(html, base_url) else { continue; }; @@ -145,6 +148,7 @@ fn attempt_legible(html: &str, base_url: &str) -> Result Result { let reader = Readability::new() .map_err(|err| format!("Failed to initialize readability-js: {}", err))?; diff --git a/src/crates/services/terminal/Cargo.toml b/src/crates/services/terminal/Cargo.toml index 86e3f6d04d..c0f1c39340 100644 --- a/src/crates/services/terminal/Cargo.toml +++ b/src/crates/services/terminal/Cargo.toml @@ -12,9 +12,6 @@ path = "src/lib.rs" [dependencies] bitfun-runtime-ports = { path = "../../contracts/runtime-ports" } -# PTY support -portable-pty = { workspace = true } - # Async runtime tokio = { workspace = true } tokio-stream = { workspace = true } @@ -55,6 +52,14 @@ tempfile = { workspace = true } # Windows process-tree ownership win32job = { workspace = true } +# portable-pty: ohos requires 0.9 (nix 0.25 is incompatible); all other +# platforms use 0.8 to avoid the PSEUDOCONSOLE_INHERIT_CURSOR ConPTY bug. +[target.'cfg(not(target_env = "ohos"))'.dependencies] +portable-pty = { workspace = true } + +[target.'cfg(target_env = "ohos")'.dependencies] +portable-pty = "0.9" + [lints] workspace = true