mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
feat(extension): vom hover description bug fix
This commit is contained in:
@@ -29,6 +29,10 @@ pub struct ObserveArgs {
|
||||
/// Soft cap on rendered tokens (~4 chars/token).
|
||||
#[arg(long = "max-tokens")]
|
||||
pub max_tokens: Option<u32>,
|
||||
|
||||
/// Include conditional surface probe diagnostics in JSON output.
|
||||
#[arg(long = "debug-surfaces")]
|
||||
pub debug_surfaces: bool,
|
||||
}
|
||||
|
||||
pub fn dispatch(args: ObserveArgs, format: Format) -> Result<(), CliError> {
|
||||
@@ -42,6 +46,7 @@ fn run(sock: PathBuf, args: ObserveArgs, format: Format) -> Result<(), CliError>
|
||||
tab_id: args.tab_id,
|
||||
max_depth: args.max_depth,
|
||||
max_tokens: args.max_tokens,
|
||||
debug_surfaces: args.debug_surfaces,
|
||||
};
|
||||
let reply: ObserveResult = call(sock, params)?;
|
||||
match format {
|
||||
|
||||
@@ -478,6 +478,7 @@ async fn observe_returns_semantic_text_and_ref_count() {
|
||||
tab_id: 13,
|
||||
truncated: false,
|
||||
dialogs: vec![],
|
||||
debug: None,
|
||||
})
|
||||
.unwrap(),
|
||||
)
|
||||
@@ -492,6 +493,7 @@ async fn observe_returns_semantic_text_and_ref_count() {
|
||||
tab_id: None,
|
||||
max_depth: None,
|
||||
max_tokens: None,
|
||||
debug_surfaces: false,
|
||||
},
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
"session_id"
|
||||
],
|
||||
"properties": {
|
||||
"debug_surfaces": {
|
||||
"description": "Include implementation diagnostics for conditional surface probes.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"max_depth": {
|
||||
"description": "Cap the depth of the rendered VOM tree.",
|
||||
"type": [
|
||||
|
||||
@@ -8,6 +8,16 @@
|
||||
"text"
|
||||
],
|
||||
"properties": {
|
||||
"debug": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ObserveDebug"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dialogs": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
@@ -103,6 +113,73 @@
|
||||
"prompt",
|
||||
"beforeunload"
|
||||
]
|
||||
},
|
||||
"ObserveDebug": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"surface_probes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/SurfaceProbeDebug"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"SurfaceProbeDebug": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"sub_items",
|
||||
"trigger_action",
|
||||
"trigger_backend_node_id"
|
||||
],
|
||||
"properties": {
|
||||
"confidence": {
|
||||
"type": [
|
||||
"string",
|
||||
"null"
|
||||
]
|
||||
},
|
||||
"sub_items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"trigger_action": {
|
||||
"type": "string"
|
||||
},
|
||||
"trigger_backend_node_id": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"trigger_point": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/SurfaceProbePoint"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"SurfaceProbePoint": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"x",
|
||||
"y"
|
||||
],
|
||||
"properties": {
|
||||
"x": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"y": {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,32 @@ pub struct ObserveParams {
|
||||
/// best-effort heuristic based on character count).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub max_tokens: Option<u32>,
|
||||
/// Include implementation diagnostics for conditional surface probes.
|
||||
#[serde(default)]
|
||||
pub debug_surfaces: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct SurfaceProbePoint {
|
||||
pub x: f64,
|
||||
pub y: f64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct SurfaceProbeDebug {
|
||||
pub trigger_backend_node_id: i64,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub trigger_point: Option<SurfaceProbePoint>,
|
||||
pub trigger_action: String,
|
||||
pub sub_items: Vec<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub confidence: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct ObserveDebug {
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub surface_probes: Vec<SurfaceProbeDebug>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
|
||||
@@ -92,6 +118,8 @@ pub struct ObserveResult {
|
||||
pub truncated: bool,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub dialogs: Vec<JavaScriptDialogInfo>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub debug: Option<ObserveDebug>,
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -280,6 +308,7 @@ mod tests {
|
||||
tab_id: 42,
|
||||
truncated: false,
|
||||
dialogs: Vec::new(),
|
||||
debug: None,
|
||||
};
|
||||
let v = serde_json::to_value(&r).unwrap();
|
||||
assert_eq!(v.get("ref_count").and_then(|v| v.as_u64()), Some(1));
|
||||
|
||||
Reference in New Issue
Block a user