mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
Require Trace v3 version const 3, reject mixed pages/states payloads, and align TypeScript selection optionality with the generated schema. Trace v2 on main already records hover steps, so the frozen v2 schema must accept them instead of dropping them during reduction. Co-authored-by: Cursor <cursoragent@cursor.com>
507 lines
12 KiB
JSON
507 lines
12 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"title": "Trace",
|
|
"description": "Persisted user-action trace exported by `tool.record_stop` / `await`.",
|
|
"type": "object",
|
|
"required": [
|
|
"entry",
|
|
"recorded_at",
|
|
"recorder",
|
|
"states",
|
|
"steps",
|
|
"stopped_by",
|
|
"version"
|
|
],
|
|
"properties": {
|
|
"entry": {
|
|
"$ref": "#/definitions/TraceEntry"
|
|
},
|
|
"purpose": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"recorded_at": {
|
|
"type": "string"
|
|
},
|
|
"recorder": {
|
|
"$ref": "#/definitions/RecorderInfo"
|
|
},
|
|
"started_at": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"states": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/TraceState"
|
|
}
|
|
},
|
|
"steps": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/Step"
|
|
}
|
|
},
|
|
"stopped_by": {
|
|
"$ref": "#/definitions/StopReason"
|
|
},
|
|
"version": {
|
|
"type": "integer",
|
|
"const": 3
|
|
}
|
|
},
|
|
"additionalProperties": false,
|
|
"definitions": {
|
|
"FillCommit": {
|
|
"type": "string",
|
|
"enum": [
|
|
"enter",
|
|
"suggestion",
|
|
"blur"
|
|
]
|
|
},
|
|
"KeyModifier": {
|
|
"description": "Keyboard modifier flags. Multiple flags may be combined; the extension folds them into CDP's bitfield (`alt=1, ctrl=2, meta=4, shift=8`).",
|
|
"type": "string",
|
|
"enum": [
|
|
"alt",
|
|
"ctrl",
|
|
"meta",
|
|
"shift"
|
|
]
|
|
},
|
|
"NavigationCause": {
|
|
"type": "string",
|
|
"enum": [
|
|
"user_typed",
|
|
"link",
|
|
"form_submit",
|
|
"reload",
|
|
"history",
|
|
"script",
|
|
"browser"
|
|
]
|
|
},
|
|
"RecorderInfo": {
|
|
"type": "object",
|
|
"required": [
|
|
"bsk",
|
|
"vom"
|
|
],
|
|
"properties": {
|
|
"bsk": {
|
|
"type": "string"
|
|
},
|
|
"vom": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
}
|
|
}
|
|
},
|
|
"SelectedOption": {
|
|
"description": "One selected option (`select` op).",
|
|
"type": "object",
|
|
"required": [
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"label": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"Step": {
|
|
"description": "One recorded user action — discriminated union by `op`.",
|
|
"oneOf": [
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"cause",
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state",
|
|
"to"
|
|
],
|
|
"properties": {
|
|
"cause": {
|
|
"$ref": "#/definitions/NavigationCause"
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"navigate"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"to": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state",
|
|
"target"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"click"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"target": {
|
|
"$ref": "#/definitions/TargetDescriptor"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state",
|
|
"target"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"hover"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"target": {
|
|
"$ref": "#/definitions/TargetDescriptor"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"commit",
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state",
|
|
"target",
|
|
"value"
|
|
],
|
|
"properties": {
|
|
"commit": {
|
|
"$ref": "#/definitions/FillCommit"
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"fill"
|
|
]
|
|
},
|
|
"redacted": {
|
|
"type": "boolean"
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"target": {
|
|
"$ref": "#/definitions/TargetDescriptor"
|
|
},
|
|
"value": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state",
|
|
"target"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"select"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"selection": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/SelectedOption"
|
|
}
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"target": {
|
|
"$ref": "#/definitions/TargetDescriptor"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"key",
|
|
"op",
|
|
"result",
|
|
"state"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"key": {
|
|
"type": "string"
|
|
},
|
|
"modifiers": {
|
|
"type": [
|
|
"array",
|
|
"null"
|
|
],
|
|
"items": {
|
|
"$ref": "#/definitions/KeyModifier"
|
|
}
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"press"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
},
|
|
"target": {
|
|
"anyOf": [
|
|
{
|
|
"$ref": "#/definitions/TargetDescriptor"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"description": "Fields shared by every step variant (flattened in JSON).",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"op",
|
|
"result",
|
|
"state"
|
|
],
|
|
"properties": {
|
|
"id": {
|
|
"type": "integer",
|
|
"format": "uint32",
|
|
"minimum": 0.0
|
|
},
|
|
"op": {
|
|
"type": "string",
|
|
"enum": [
|
|
"scroll"
|
|
]
|
|
},
|
|
"result": {
|
|
"$ref": "#/definitions/StepResult"
|
|
},
|
|
"state": {
|
|
"description": "Observation id immediately before this action.",
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"StepResult": {
|
|
"type": "object",
|
|
"required": [
|
|
"state"
|
|
],
|
|
"properties": {
|
|
"state": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"StopReason": {
|
|
"type": "string",
|
|
"enum": [
|
|
"user_finish",
|
|
"cli_stop"
|
|
]
|
|
},
|
|
"TargetDescriptor": {
|
|
"description": "Stable semantic handle for an interacted element within a page observation.",
|
|
"type": "object",
|
|
"properties": {
|
|
"ctx": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"name": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"ref": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"role": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"unmatched": {
|
|
"type": "boolean"
|
|
}
|
|
}
|
|
},
|
|
"TraceEntry": {
|
|
"description": "Recording entry point — first URL the flow starts from.",
|
|
"type": "object",
|
|
"required": [
|
|
"start_url"
|
|
],
|
|
"properties": {
|
|
"start_url": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"TraceState": {
|
|
"description": "Page observation dictionary entry — referenced by steps via `state` / `result.state`.",
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"url"
|
|
],
|
|
"properties": {
|
|
"body": {
|
|
"description": "Wire-only: full page observation (front matter + VOM body + annotations).",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"page": {
|
|
"description": "Disk-only: filename under the bundle `pages/` directory.",
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"title": {
|
|
"type": [
|
|
"string",
|
|
"null"
|
|
]
|
|
},
|
|
"truncated": {
|
|
"type": "boolean"
|
|
},
|
|
"url": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|