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

39
src/browser/backend.rs Normal file
View File

@@ -0,0 +1,39 @@
use std::sync::Arc;
use serde_json::Value;
use crate::pipe::{Action, CommandOutput, ExecutionSurfaceMetadata, PipeError};
pub trait BrowserBackend: Send + Sync {
fn invoke(
&self,
action: Action,
params: Value,
expected_domain: &str,
) -> Result<CommandOutput, PipeError>;
fn surface_metadata(&self) -> ExecutionSurfaceMetadata;
fn supports_eval(&self) -> bool {
true
}
}
impl<T: BrowserBackend + ?Sized> BrowserBackend for Arc<T> {
fn invoke(
&self,
action: Action,
params: Value,
expected_domain: &str,
) -> Result<CommandOutput, PipeError> {
self.as_ref().invoke(action, params, expected_domain)
}
fn surface_metadata(&self) -> ExecutionSurfaceMetadata {
self.as_ref().surface_metadata()
}
fn supports_eval(&self) -> bool {
self.as_ref().supports_eval()
}
}