feat: add websocket browser service runtime

Wire the service/browser runtime onto the websocket-driven execution path and add the new browser/service modules needed for the submit flow and runtime integration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
木炎
2026-04-04 23:42:27 +08:00
parent 2ae71fb1c9
commit 3e18350320
33 changed files with 4993 additions and 327 deletions

View File

@@ -0,0 +1,70 @@
use std::env;
use std::process::ExitCode;
use std::time::Duration;
use sgclaw::{parse_probe_args, run_probe_script, ProbeOutcome};
fn main() -> ExitCode {
match run() {
Ok(()) => ExitCode::SUCCESS,
Err(err) => {
eprintln!("sgbrowser_ws_probe failed: {err}");
ExitCode::FAILURE
}
}
}
fn run() -> Result<(), String> {
let args: Vec<String> = env::args().skip(1).collect();
let config = match parse_probe_args(&args) {
Ok(config) => config,
Err(err) => return Err(err.to_string()),
};
let results = match run_probe_script(
&config.ws_url,
Duration::from_millis(config.timeout_ms),
config.steps,
) {
Ok(results) => results,
Err(err) => return Err(err.to_string()),
};
for (index, result) in results.iter().enumerate() {
println!("STEP {} {}", index + 1, result.label);
println!("SEND: {}", result.sent);
match &result.outcome {
ProbeOutcome::Received(frames) => {
if frames.is_empty() {
println!("RECV: <none>");
} else {
for frame in frames {
println!("RECV: {}", frame);
}
}
println!("OUTCOME: received");
}
ProbeOutcome::NoReplyExpected => {
println!("RECV: <none>");
println!("OUTCOME: no-reply-expected");
}
ProbeOutcome::TimedOut => {
println!("RECV: <none>");
println!("OUTCOME: timeout");
}
ProbeOutcome::Closed => {
println!("RECV: <none>");
println!("OUTCOME: closed");
}
ProbeOutcome::ConnectFailed(message) => {
println!("RECV: <none>");
println!("OUTCOME: connect-failed");
println!("DETAIL: {}", message);
}
}
if index + 1 < results.len() {
println!();
}
}
Ok(())
}