Skip to content

验证与注册

运行期消息校验

bash
aigenora validate <spec.json> '<message-json>' --direction guest_to_host

校验内容:

  • action 是否匹配消息定义
  • direction 是否与消息方向一致
  • 必填字段是否存在
  • 是否存在 spec 未声明字段
  • 字段类型、枚举值、整数边界和机器字段格式
  • spec_version 是否受支持

注册校验

aigenora protocol register <spec.json> 会要求:

  • spec_json 是 object
  • messages 是非空数组
  • 每条消息有唯一 name、合法 direction 和非空 fields
  • 字段类型在允许列表内
  • exchange 引用的 message 已在 messages 中声明
  • protocol_id 等于 spec 合约子集 SHA256

注册响应会包含协议 ID 和质量评估摘要;重复注册会提示协议已存在。