Le righe che differivano dalla rinomina di aKode solo per codex/akode (header e user agent codex_cli_rs -> akode_cli_rs, nomi di file, testi di test) sono riportate come in aKode 0.9.2; dove la mappa automatica aveva rinominato troppo (stringhe di protocollo, residenza) e' ripristinato il testo originale. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
50 lines
1.7 KiB
Rust
50 lines
1.7 KiB
Rust
//! Verify delegated preview decoding and tool identity filtering.
|
|
|
|
use super::delegated_output_preview;
|
|
use akode_protocol::items::FunctionCallOutputItem;
|
|
use akode_protocol::models::FunctionCallOutputBody;
|
|
use pretty_assertions::assert_eq;
|
|
|
|
#[test]
|
|
fn delegated_previews_unwrap_only_recognized_inputs() {
|
|
let wrapped = "<codex_delegation>\n <source_thread_id>source</source_thread_id>\n <input>Check <main> & &lt;literal&gt;</input>\n</codex_delegation>";
|
|
for (namespace, name, text, expected) in [
|
|
(
|
|
Some("codex_app"),
|
|
"create_thread",
|
|
wrapped,
|
|
Some("Check <main> & <literal>"),
|
|
),
|
|
(
|
|
Some("codex_tui"),
|
|
"send_message_to_thread",
|
|
wrapped,
|
|
Some("Check <main> & <literal>"),
|
|
),
|
|
(
|
|
Some("codex_app"),
|
|
"create_thread",
|
|
"plain <text>",
|
|
Some("plain <text>"),
|
|
),
|
|
(Some("codex_tui"), "create_thread", " ", None),
|
|
(Some("other"), "create_thread", wrapped, None),
|
|
(None, "create_thread", wrapped, None),
|
|
(Some("codex_app"), "shell", wrapped, None),
|
|
(
|
|
Some("codex_app"),
|
|
"create_thread",
|
|
"<codex_delegation>incomplete",
|
|
Some("<codex_delegation>incomplete"),
|
|
),
|
|
] {
|
|
let output = FunctionCallOutputItem {
|
|
id: "output".to_string(),
|
|
name: name.to_string(),
|
|
namespace: namespace.map(str::to_string),
|
|
output: FunctionCallOutputBody::Text(text.to_string()),
|
|
};
|
|
assert_eq!(delegated_output_preview(&output).as_deref(), expected);
|
|
}
|
|
}
|