Documentation
¶
Overview ¶
Package protocol 解析从 sctl 权威 schema 生成并嵌入的协议元数据。
Index ¶
Constants ¶
const BlockingNone = "none"
BlockingNone 是 blocking 的取值之一:方法收到即执行,不等待人工决定。
const ConfirmParam = "confirm"
ConfirmParam 是 L1 方法参数里承载显式确认的字段名,值必须恰好是 true。
Variables ¶
var DefinitionJSON []byte
DefinitionJSON is the sole maintained protocol definition embedded directly from protocol.json.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct {
Scope string `json:"scope"`
Write bool `json:"-"`
Effect string `json:"effect"`
Blocking string `json:"blocking,omitempty"`
Level Level `json:"level"`
Params string `json:"params"`
Result string `json:"result"`
Peer Peer `json:"peer"`
// MergeField 是结果中的数组字段名:多个浏览器同时在线时 daemon 按它合并各实例的列表;非列表方法为空。
MergeField string `json:"mergeField,omitempty"`
// Internal 标记只供 daemon 内部组件调用的方法(如原始 CDP 中转):它们能以用户登录态驱动任意页面,
// 所以既不经 /control/call 对外开放,也不注册为 MCP 工具。
Internal bool `json:"internal,omitempty"`
}
type CryptoContext ¶ added in v0.2.0
CryptoContext 把 context 键映射到握手字符串;protocol.json 中每项另带归属标注,只在生成各对端代码时使用。
func (*CryptoContext) UnmarshalJSON ¶ added in v0.2.0
func (c *CryptoContext) UnmarshalJSON(data []byte) error
type Level ¶ added in v0.2.0
type Level string
Level 是方法的破坏级别。daemon 只执行 L1 的确认检查;L2 的人工审批由扩展侧完成, daemon 只是等待它的结果(与 blocking 为 approval/disclosure 的方法同一套阻塞语义)。
type PairingCode ¶
type Protocol ¶
type Protocol struct {
JSONRPCVersion string `json:"jsonrpc"`
SchemaVersion string `json:"schemaVersion"`
Transport Transport `json:"transport"`
SessionMethods []SessionMethod `json:"sessionMethods"`
Scopes []string `json:"scopes"`
Actions map[string]Action `json:"methods"`
// Types 是 protocol.json 的类型定义(JSON Schema 原文),供需要按方法参数派生 schema 的一方使用。
Types map[string]json.RawMessage `json:"types"`
ErrorCodes []ErrorCode `json:"errorCodes"`
Crypto Crypto `json:"crypto"`
Limits Limits `json:"limits"`
PairingCode PairingCode `json:"pairingCode"`
}
type SessionMethod ¶ added in v0.2.0
SessionMethod 是会话层方法或通知(不经 /control/call 转发);Peers 标明哪些对端的会话里会出现它。