Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/apps/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down
4 changes: 3 additions & 1 deletion src/crates/execution/tool-execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ 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 }
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
12 changes: 8 additions & 4 deletions src/crates/execution/tool-execution/src/web_readable.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -145,6 +148,7 @@ fn attempt_legible(html: &str, base_url: &str) -> Result<ExtractedCandidate, Str
})
}

#[cfg(not(target_env = "ohos"))]
fn attempt_readability_js(html: &str, base_url: &str) -> Result<ExtractedCandidate, String> {
let reader = Readability::new()
.map_err(|err| format!("Failed to initialize readability-js: {}", err))?;
Expand Down
11 changes: 8 additions & 3 deletions src/crates/services/terminal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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"

Comment thread
limityan marked this conversation as resolved.
[lints]
workspace = true

Loading