diff --git a/packages/cli-rs/crates/tui/src/dialogs/skill.rs b/packages/cli-rs/crates/tui/src/dialogs/skill.rs index 78b0da73e50..14bbcee9bb2 100644 --- a/packages/cli-rs/crates/tui/src/dialogs/skill.rs +++ b/packages/cli-rs/crates/tui/src/dialogs/skill.rs @@ -41,7 +41,7 @@ pub fn show(tui: &Tui, location: Option, on_select: OnSelect) { Ok(()) => Load::Loaded(tui.data.read(|state| { state.location(Some(&read)).and_then(|data| data.skill.clone()).unwrap_or_default() })), - Err(error) => Load::Failed(error.to_string()), + Err(error) => Load::Failed(error.tui_message()), }; open(&tui, load, on_select); }), diff --git a/packages/cli-rs/crates/tui/tests/all/mcp.rs b/packages/cli-rs/crates/tui/tests/all/mcp.rs index fee1a40f821..eaf65f03af3 100644 --- a/packages/cli-rs/crates/tui/tests/all/mcp.rs +++ b/packages/cli-rs/crates/tui/tests/all/mcp.rs @@ -50,7 +50,7 @@ fn skills() -> Value { ]) } -/// Serves the location, the MCP list and skills (`None` answers the skill list with a 500), the prompt catalog, +/// Serves the location, the MCP list and skills (`None` answers the skill list with a declared error), the prompt catalog, /// and the writes; logs every request. fn fake(servers: Arc>, skills: Option) -> Fake { Fake::new(move |seen| match (seen.method.as_str(), seen.path.as_str()) { @@ -61,7 +61,7 @@ fn fake(servers: Arc>, skills: Option) -> Fake { ("GET", "/api/mcp") => (200, list(DIRECTORY, servers.lock().unwrap().clone())), ("GET", "/api/skill") => match &skills { Some(skills) => (200, list(DIRECTORY, skills.clone())), - None => (500, json!({ "message": "skills exploded" })), + None => (400, json!({ "_tag": "InvalidRequestError", "message": "skills exploded" })), }, ("GET", "/api/session") => (200, json!({ "data": [], "cursor": {} })), // `docs` fails to connect, so the error toast and the cleared loading state show. @@ -341,6 +341,8 @@ fn skills_dialog_shows_a_failed_read() { kit.run("prompt.skills"); let screen = kit.wait_for("Could not load skills"); assert!(screen.contains("Close and reopen Skills to try again."), "{screen}"); + // The declared error's message, as `errorMessage` shows it, without its tag. + assert!(screen.contains("skills exploded") && !screen.contains("InvalidRequestError"), "{screen}"); // Locked while failed: typing does not filter. assert!(!screen.contains("Search"), "{screen}"); } diff --git a/packages/cli-rs/parity/deviations/DLG19-skill-mentions.md b/packages/cli-rs/parity/deviations/DLG19-skill-mentions.md deleted file mode 100644 index 44ad6949a0b..00000000000 --- a/packages/cli-rs/parity/deviations/DLG19-skill-mentions.md +++ /dev/null @@ -1,17 +0,0 @@ -# DLG19: skill read errors - -## TypeScript - -Picking a skill inserts `@ ` at the cursor, adds `{ id, mention }` to `prompt.skills`, and ties the part to -a virtual extmark with the skill style (`packages/tui/src/component/prompt/index.tsx:588-616`). A failed skill -read shows `errorMessage(error)`. - -## Rust - -The pick is the same since E.3: `prompt::autocomplete::parts::insert_skill` adds an atomic extmark in the -`extmark.skill` style and the part, and submit sends the parts whose marks remain. A failed read shows the Rust -client error's text. - -## Reason - -The Rust client's errors are not the TS `ClientError` objects that `errorMessage` formats.