GB/Z 185-2026 协议栈(自上而下调用)
──────────────────────────────────────────────────────
GB/Z 185.7 tooling/ ToolDescriptor 单源模型 · ToolRegistry
GB/Z 185.6 aip/ AIP 信封 · 会话 · 群组路由 · FakeTransport
GB/Z 185.5 discovery/ ADP 发现 · AgentNode · match_nodes
GB/Z 185.4 capability/ ACS 能力集 · covers 覆盖判断
GB/Z 185.3 registry/ ATR 注册表 · 鉴权 · 生命周期 · 审计
GB/Z 185.2 identity/ AIC 身份码逐字符校验
GB/Z 185.1 (根包) arch 双模式 · 全局模型 · 互联角色
──────────────────────────────────────────────────────
公共层 wire/ ProtocolError 特征 · JSON 编解码
transport_async/ TCP NDJSON · TLS 指纹钉扎
verify/ moon prove 形式化验证(Z3)| 部分 | 包 | 内容 | 状态 |
|---|---|---|---|
| GB/Z 185.1 | arch.mbt(根包) | 总体架构:双模式(本地/互联)、全局模型(agents/agent_skills/agent_messages/agent_tasks/sessions)、互联角色定义 | ✅ |
| GB/Z 185.2 | identity/ | 身份码 AIC(Agent Identity Code)点分编码结构与校验、唯一标识、CAI 凭证引用、identity_status(none/active/locked/revoked) | ✅ |
| GB/Z 185.3 | registry/ | 身份管理 ATR(Agent Token Registry):注册(AIC 分配)、凭证、鉴权(CAIVerifier 注入)、生命周期(lock/revoke)、注销 | ✅ |
| GB/Z 185.4 | capability/ | 智能体描述 ACS(Agent Capability Statement):能力元数据、输入输出类型、约束(constraints)、匹配原语 | ✅ |
| GB/Z 185.5 | discovery/ | 智能体发现 ADP(Agent Discovery Protocol):检索、能力匹配、discoverable 可见性过滤 | ✅ |
| GB/Z 185.6 | aip/ | 智能体交互 AIP(Agent Interconnection Protocol):报文信封、单调序号防重放、群组 URN 路由、FakeTransport(sans-I/O) | ✅(MQ 分发与国密于 0.2.0) |
| GB/Z 185.7 | tooling/ | 智能体工具调用:ToolDescriptor 单源模型、调用流程、绑定契约(ToolCallable) | ✅ |
moon add walkzzz/gbz185.mbt
moon update// GB/Z 185.5:构造智能体节点(AGENTS.md frontmatter 字段映射)
let node = @discovery.AgentNode::from_frontmatter(
"urn:agent:walkzzz:node-1", "演示智能体", @identity.NoIdentity, true,
["skill:demo"], ["text"], ["text"],
)
let proto = @aip.AipProtocol::new(node)
// GB/Z 185.3:注册 → 身份激活(AIC 由注册表分配并校验)
// GB/Z 185.6:交互 —— 群组 URN 直通分发,单调序号防重放
let env = @aip.AipProtocol::dispatch(
proto, @aip.Event, "urn:agent:group:ops", ("hello" : Json),
)| 任务 | 入口 |
|---|---|
| 身份码校验(185.2) | @identity.aic_validate · AgentIdentity::from_json |
| 注册 / 鉴权 / 生命周期(185.3) | @registry.TokenRegistry::register → authenticate → lock / revoke / renew |
| 能力描述与覆盖判断(185.4) | @capability.AgentCapabilitySet::covers |
| 智能体发现与匹配(185.5) | @discovery.AgentNode::from_frontmatter · match_nodes |
| 交互收发(185.6) | @aip.AipProtocol::dispatch / receive · AipSession::send / recv |
| 群组路由与扇出 | @aip.RouteTable::add_group · fanout |
| 信封 JSON 编解码 | @aip.AipEnvelope::to_json / from_json |
| 工具单源模型(185.7) | @tooling.ToolDescriptor::validate · ToolRegistry::invoke_tool · to_mcp_entry |
| 统一错误契约 | @wire.ProtocolError 特征(全栈 suberror 分型) |
| 传输扩展 | @transport_async.TcpChannel · TlsTcpChannel · ndjson_encode / ndjson_decode |
| 形式化验证 | @verify.clamp_i64 / next_seq / inbox_advance |
| 门禁 | 结果 |
|---|---|
| moon check --deny-warn --target all | 四目标零警告 |
| moon test --target native | 77/77 全绿(黑盒/白盒/Fake Transport/quickcheck 属性/小模型 mock 消费,seed 固定可复现) |
| 形式化验证 | verify/ 包 proof_enabled——moon prove 3 goals proved(Z3 4.8.12/WSL) |
| 覆盖率 | 94.8%;CRAP 全函数 < 10 |
| 变异测试 | 12/12 KILLED(击杀率 100%) |
| 基准实测 | dispatch 90.51ns / registry_lookup 96.29ns / envelope_roundtrip 1.69µs |
| 统一错误契约 | ProtocolError 特征(part/code/message),全栈 suberror 分型 |
GB/Z 185-2026 protocol stack (top-down calls)
──────────────────────────────────────────────────────
GB/Z 185.7 tooling/ ToolDescriptor single source · ToolRegistry
GB/Z 185.6 aip/ AIP envelope · session · group routing · FakeTransport
GB/Z 185.5 discovery/ ADP discovery · AgentNode · match_nodes
GB/Z 185.4 capability/ ACS capability set · covers
GB/Z 185.3 registry/ ATR registry · auth · lifecycle · audit
GB/Z 185.2 identity/ AIC per-character validation
GB/Z 185.1 (root) arch dual-mode · global model · interconnect roles
──────────────────────────────────────────────────────
Common wire/ ProtocolError trait · JSON codecs
transport_async/ TCP NDJSON · TLS fingerprint pinning
verify/ moon prove formal verification (Z3)| Part | Package | Content | Status |
|---|---|---|---|
| GB/Z 185.1 | arch.mbt (root) | Overall architecture: dual mode (local/interconnect), global model, interconnect roles | ✅ |
| GB/Z 185.2 | identity/ | AIC identity code structure/validation, CAI credential reference, identity_status | ✅ |
| GB/Z 185.3 | registry/ | ATR: register (AIC assignment), credentials, authentication (CAIVerifier injection), lifecycle, unregister | ✅ |
| GB/Z 185.4 | capability/ | ACS: capability metadata, input/output types, constraints, match primitive | ✅ |
| GB/Z 185.5 | discovery/ | ADP: search, capability matching, discoverable visibility filtering | ✅ |
| GB/Z 185.6 | aip/ | AIP: envelope, monotonic-sequence anti-replay, group URN routing, FakeTransport (sans-I/O) | ✅ (MQ & SM-suite at 0.2.0) |
| GB/Z 185.7 | tooling/ | Tool invocation: ToolDescriptor single-source model, invocation flow, binding contract | ✅ |
moon add walkzzz/gbz185.mbt
moon update// GB/Z 185.5: build an agent node (AGENTS.md frontmatter mapping)
let node = @discovery.AgentNode::from_frontmatter(
"urn:agent:walkzzz:node-1", "demo-agent", @identity.NoIdentity, true,
["skill:demo"], ["text"], ["text"],
)
let proto = @aip.AipProtocol::new(node)
// GB/Z 185.3: register -> activate (AIC assigned & validated by the registry)
// GB/Z 185.6: interact — group URN routing, monotonic-sequence anti-replay
let env = @aip.AipProtocol::dispatch(
proto, @aip.Event, "urn:agent:group:ops", ("hello" : Json),
)| Task | Entry points |
|---|---|
| Identity code validation (185.2) | @identity.aic_validate · AgentIdentity::from_json |
| Register / auth / lifecycle (185.3) | @registry.TokenRegistry::register → authenticate → lock / revoke / renew |
| Capability & coverage (185.4) | @capability.AgentCapabilitySet::covers |
| Discovery & matching (185.5) | @discovery.AgentNode::from_frontmatter · match_nodes |
| Send / receive (185.6) | @aip.AipProtocol::dispatch / receive · AipSession::send / recv |
| Group routing & fanout | @aip.RouteTable::add_group · fanout |
| Envelope JSON codec | @aip.AipEnvelope::to_json / from_json |
| Tool single source (185.7) | @tooling.ToolDescriptor::validate · ToolRegistry::invoke_tool · to_mcp_entry |
| Unified error contract | @wire.ProtocolError trait (typed suberrors across the stack) |
| Transport extension | @transport_async.TcpChannel · TlsTcpChannel · ndjson_encode / ndjson_decode |
| Formal verification | @verify.clamp_i64 / next_seq / inbox_advance |
| Gate | Result |
|---|---|
| moon check --deny-warn --target all | zero warnings on 4 targets |
| moon test --target native | 77/77 green (blackbox/whitebox/Fake Transport/quickcheck properties/model-based mock consumption, fixed seeds) |
| Formal verification | verify/ with proof_enabled — moon prove 3 goals proved (Z3 4.8.12/WSL) |
| Coverage | 94.8%; CRAP < 10 on all functions |
| Mutation testing | 12/12 KILLED (100% kill rate) |
| Benchmarks | dispatch 90.51ns / registry_lookup 96.29ns / envelope_roundtrip 1.69µs |
| Unified error contract | ProtocolError trait (part/code/message), typed suberrors across the stack |