Fix browser wait during daemon startup

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
BB-fat
2026-06-23 15:04:20 +08:00
co-authored by Cursor
parent ab6aa16dfc
commit dc8a6d38b3
14 changed files with 578 additions and 104 deletions
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "BrowserListParams",
"description": "`browser.list` request payload.",
"type": "object",
"properties": {
"wait_for_browser_ms": {
"description": "When set, the daemon polls the browser registry for up to this many milliseconds before returning a list. Only applies while zero browsers are registered; an existing connection returns immediately.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
}
}
@@ -1,6 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "StatusParams",
"description": "`system.status` request payload. Empty.",
"type": "object"
"description": "`system.status` request payload.",
"type": "object",
"properties": {
"wait_for_browser_ms": {
"description": "When set, the daemon polls the browser registry for up to this many milliseconds before returning a snapshot. Only applies while zero browsers are registered; an existing connection returns immediately.",
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
}
}
+3 -1
View File
@@ -4,7 +4,8 @@ use std::fs;
use std::path::PathBuf;
use bsk_protocol::system::{
HandshakeParams, HandshakeResult, PingParams, PingResult, StatusParams, StatusResult,
BrowserListParams, HandshakeParams, HandshakeResult, PingParams, PingResult, StatusParams,
StatusResult,
};
use bsk_protocol::tools::*;
use bsk_protocol::{CancelParams, CancelResult};
@@ -34,6 +35,7 @@ fn main() {
dump!(PingResult, "system_ping_result");
dump!(StatusParams, "system_status_params");
dump!(StatusResult, "system_status_result");
dump!(BrowserListParams, "browser_list_params");
dump!(CancelParams, "cancel_params");
dump!(CancelResult, "cancel_result");
+3 -3
View File
@@ -12,8 +12,8 @@ pub use error::{DecodeError, ErrorCode, RpcError};
pub use frame::{EventFrame, EventKind, Frame, RequestFrame, ResponseBody, ResponseFrame, RpcId};
pub use method::Method;
pub use system::{
BrowserPeerInfo, BrowserStatusEntry, HandshakeCompat, HandshakeParams, HandshakeResult,
PingParams, PingResult, SessionStatusEntry, StatusParams, StatusResult, VersionSkewEntry,
compare_protocol, evaluate_handshake_compat,
BrowserListParams, BrowserPeerInfo, BrowserStatusEntry, HandshakeCompat, HandshakeParams,
HandshakeResult, PingParams, PingResult, SessionStatusEntry, StatusParams, StatusResult,
VersionSkewEntry, compare_protocol, evaluate_handshake_compat,
};
pub use tools::*;
+18 -2
View File
@@ -531,9 +531,25 @@ pub struct SessionStatusEntry {
pub created_at_ms: i64,
}
/// `system.status` request payload. Empty.
/// `system.status` request payload.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct StatusParams {}
pub struct StatusParams {
/// When set, the daemon polls the browser registry for up to this many
/// milliseconds before returning a snapshot. Only applies while zero
/// browsers are registered; an existing connection returns immediately.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub wait_for_browser_ms: Option<u64>,
}
/// `browser.list` request payload.
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct BrowserListParams {
/// When set, the daemon polls the browser registry for up to this many
/// milliseconds before returning a list. Only applies while zero browsers
/// are registered; an existing connection returns immediately.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub wait_for_browser_ms: Option<u64>,
}
/// One entry per connected browser whose protocol version drifts from
/// the daemon's (same major). Surfaced in `system.status` for