Skip to content

Commit 81def05

Browse files
live_vendor_turn: --web and --image checks for native-loop rows
Used to verify OpenRouter end to end: a command through an approval, a web search with sources, and an attached image read by a vision model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 69cd093 commit 81def05

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

‎native/core/examples/live_vendor_turn.rs‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,28 @@ async fn main() -> anyhow::Result<()> {
6060
// --command: one harmless shell command, so the runtime must ask for
6161
// permission; the approval is granted through the same API the window uses.
6262
let command = std::env::args().any(|a| a == "--command");
63-
let prompts: &[&str] = if command {
63+
// --web: the task gets web tools (native loop only). --image: a small red
64+
// PNG is attached, with consent to upload it.
65+
let web = std::env::args().any(|a| a == "--web");
66+
let image = std::env::args().any(|a| a == "--image");
67+
if image {
68+
std::fs::write(
69+
project.join("red.png"),
70+
[
71+
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48,
72+
0x44, 0x52, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x02, 0x00, 0x00,
73+
0x00, 0x90, 0x91, 0x68, 0x36, 0x00, 0x00, 0x00, 0x17, 0x49, 0x44, 0x41, 0x54, 0x78,
74+
0x9c, 0x63, 0xf8, 0xcf, 0xc0, 0x40, 0x12, 0x22, 0x4d, 0xf5, 0xa8, 0x86, 0x51, 0x0d,
75+
0x43, 0x4a, 0x03, 0x00, 0x90, 0xf9, 0xff, 0x01, 0xf9, 0xe1, 0xfa, 0x78, 0x00, 0x00,
76+
0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82,
77+
],
78+
)?;
79+
}
80+
let prompts: &[&str] = if web {
81+
&["Use web_search to find the official website of the Tokio asynchronous Rust runtime, then reply with only its URL."]
82+
} else if image {
83+
&["What colour is the attached image? Reply with one word."]
84+
} else if command {
6485
&["Run the shell command `date +%Y` in the project folder and reply with only its output."]
6586
} else if second {
6687
&[
@@ -72,7 +93,11 @@ async fn main() -> anyhow::Result<()> {
7293
};
7394
let mut session: Option<String> = None;
7495
for prompt in prompts {
75-
let mut body = json!({"task": prompt, "model": target, "workspace": project});
96+
let mut body = json!({"task": prompt, "model": target, "workspace": project, "web": web});
97+
if image {
98+
body["images"] = json!(["red.png"]);
99+
body["handoff_consent"] = json!(true);
100+
}
76101
if let Some(sid) = &session {
77102
body["session_id"] = json!(sid);
78103
}

0 commit comments

Comments
 (0)