Skip to content

RFC-007: Nexus Core Agentic Interface

MetadataValue
TitleNexus Core Agentic Interface
Version1.8.0
StatusFinal Specification
Updated2026-04-01
ProtocolModel Context Protocol (MCP)
ArchitectureHub (PlatON) + Spoke (MPC Ingress) + KYT Firewall

1. 核心设计理念 (Design Philosophy)

Nexus Core 作为一个 MCP Server 运行,向网络中的 Agent 提供两套标准的插件(Plugins):

  1. Buyer Plugin: 引导 UA 完成“询价 -> 选链 -> 支付 -> 收货”的全过程。
  2. Seller Plugin: 帮助 MA 完成“查账 -> 发货 -> 提款”的闭环。 交互模式采用 "Draft-then-Finalize":先生成草稿订单供用户选择支付方式,再锁定生成具体的 MPC 托管地址。

2. 📦 Nexus Buyer Plugin (For User Agent)

此插件赋予 UA 处理支付意图、与用户交互选择网络、并执行资金托管的能力。

🛠️ Tool A: initialize_payment (初始化/预编排)

生命周期阶段: Discovery (用户看到报价卡片时) 功能: 注册订单意图,计算跨链路由,返回供用户选择的支付选项。

  • Input Schema:
json
{
"quote_payload": {
"type": "object",
"description": "提取自商户返回的 UCP Checkout Session (`ucp.payment_handlers['urn:ucp:payment:nexus_v1'][0].config`) 的 NUPS 报价 Payload",
"required": true
}
}
  • Output Schema:
json
{
"nexus_payment_id": "NEX-UUID-001", // 草稿 ID
"status": "AWAITING_USER_SELECTION",
"expiry": 1760000000,
"fiat_value": { "amount": "530.00", "currency": "USD" },
// 核心:供 UI 渲染的选项列表
"payment_options": [
{
"option_id": "opt_base_usdc",
"chain_id": 8453,
"chain_name": "Base",
"token_symbol": "USDC",
"amount_uint256": "530000000",
"est_gas_fee_usd": "0.02",
"bridge_fee_usd": "0.50",
"tags": ["RECOMMENDED", "BEST_VALUE"]
},
{
"option_id": "opt_eth_usdc",
"chain_id": 1,
"chain_name": "Ethereum",
"est_gas_fee_usd": "5.00",
"tags": ["HIGH_GAS"]
},
{
"option_id": "opt_platon_usdc",
"chain_id": 210425,
"chain_name": "PlatON",
"bridge_fee_usd": "0.00",
"tags": ["NATIVE_SETTLEMENT"]
}
]
}

🛠️ Tool B: finalize_payment (终编排/获取地址)

生命周期阶段: Decision (用户点击“支付”按钮时) 功能: 锁定用户的选择,分配专属的 MPC 临时托管地址,准备接收资金。

  • Input Schema:
json
{
"nexus_payment_id": "NEX-UUID-001",
"selected_option_id": "opt_base_usdc", // 用户选定的路径
"payer_wallet": "0xUserAddress..." // 用户连接的钱包地址 (用于后续 KYT 关联)
}
  • Output Schema:
json
{
"status": "AWAITING_DEPOSIT",
"kyc_policy": "STRICT", // 提示:入账后将进行严格 KYT
// 核心:支付指令
"payment_instruction": {
"chain_id": 8453,
"chain_name": "Base",
// MPC 托管地址 (Ephemeral Address)
"target_address": "0xNexusMPC_Temp_Addr_99",
"token_address": "0xUSDC_Base_Addr",
"amount": "530000000",
// 明确告知 UA 使用普通转账,而非合约调用
"method": "transfer",
"calldata": "0x"
},
"validity_window": "30 minutes"
}

🛠️ Tool C: sign_release (确认收货/释放资金)

生命周期阶段: Verification (用户确认收到服务后) 功能: 对订单 ID 进行 EIP-712 签名,授权将资金释放给商户。

  • Input Schema:
json
{
"nexus_payment_id": "NEX-UUID-001",
"rating": 5 // (可选) 评分
}
  • Output Schema:
json
{
"status": "RELEASE_SIGNED",
"signature": "0xUserReleaseSig...",
"message": "Signature uploaded to Core. Merchant notified."
}

3. 📦 Nexus Seller Plugin (For Merchant Agent)

此插件赋予 MA 跨链无感的收款能力,MA 只需要关注 Hub Chain (PlatON) 的状态。

🛠️ Tool A: verify_order_lock (验证发货条件)

生命周期阶段: Fulfillment (MA 准备发货前) 功能: 查询 Hub Chain (PlatON) 上的 Escrow 合约,确认资金是否安全锁定 (LOCKED)。 逻辑: 只有当 Core 完成 KYT 并同步状态后,此工具才会返回 LOCKED。

  • Input Schema:
json
{ "merchant_order_ref": "TRIP-888" }
  • Output Schema:
json
{
"nexus_payment_id": "NEX-UUID-001",
"status": "LOCKED", // 关键信号:可以发货
"amount_settled": "530.00",
"currency": "USDC",
"hub_chain": "PlatON",
"kyt_result": "PASS" // 资金合规
}

🛠️ Tool B: claim_funds (提款/核销)

生命周期阶段: Settlement (收到用户 Release 签名后) 功能: 从 Nexus Core 拉取用户的签名,并在 PlatON 链上调用合约提取资金。

  • Input Schema:
json
{ "nexus_payment_id": "NEX-UUID-001" }
  • Output Schema:
json
{
"status": "CLAIMED",
"tx_hash": "0xPlatONTxHash...",
"settled_at": "2026-01-21T12:00:00Z"
}

4. 核心状态机 (Order State Machine)

Nexus Core 维护的单一真实状态源,通过 MCP Resource nexus://core/orders/{id} 暴露。

状态码 (Status)含义触发动作UA 界面展示
DRAFT订单意图已创建initialize_payment选择器视图 (Chain/Wallet)
AWAITING_DEPOSITMPC 地址已分配finalize_payment转账视图 (Target Addr)
DETECTING链上监测到入账监听器捕获 Tx"Verifying Transaction..."
SYNCINGKYT 通过,正在写入 HubKYT 引擎"Securing Funds..."
LOCKED[里程碑] PlatON 已锁定Hub 合约事件✅ "Payment Successful"
RELEASE_SIGNED用户已签署释放sign_release"Order Completed"
CLAIMED商户已提款claim_funds(历史记录)
RISK_REJECTEDKYT 失败KYT 引擎❌ "Security Alert" (触发退款)

5. 对 Antigravity 的实现指引

Core Server (nexuspay-core)

  1. 路由引擎: 需要硬编码或配置 PlatON, Base, Ethereum 的 RPC 节点,实时拉取 Gas Price 计算 est_gas_fee_usd
  2. MPC 服务: 集成 MPC 钱包 SDK(如 Fireblocks, Coinbase WaaS 或自研 TSS),实现 finalize_payment 时派生子地址。
  3. KYT 钩子:DETECTING 状态时,阻塞流程,调用 KYT API,仅在通过后执行 createVirtualDeposit 到 PlatON。

UA Integration (@nexus/ua-kit)

  1. Step 1: 组件 Mount -> 调用 initialize_payment -> 渲染 ``。
  2. Step 2: 用户选 Base + 连钱包 -> 点击 Pay -> 调用 finalize_payment
  3. Step 3: 拿到 target_address -> 调用 wagmi.sendTransaction({ to: target_address, value: 0 }) (USDC 则调用 ERC20 transfer)。
  4. Step 4: 轮询 Core 状态直到 LOCKED。 此规范完全满足了多链交互用户选择权KYT 合规以及去信任托管的所有需求。

6. Implementation Status (v1.8.0 注记)

重要: RFC-007 描述的是 Nexus 的完整愿景架构 (Hub-Spoke 跨链 + MPC + KYT)。当前 MVP 实现仅覆盖部分功能。

6.1 当前实现 vs 愿景

特性RFC-007 愿景MVP 实现计划阶段
多链 (Hub-Spoke)PlatON Hub + Base/ETH SpokePlatON 单链Phase 3
MPC 临时地址Fireblocks/WaaS无 MPC (Escrow 合约替代)Phase 3
KYT 合规检查DETECTING 状态阻断未实现Phase 3
Draft-then-Finalizeinitialize → finalize → sign_release一步 orchestrate (直接返回 402)N/A (简化设计)
状态机8 态 (DRAFT→CLAIMED)13 态 (CREATED→COMPLETED, RFC-005v4)Current
Buyer Plugin3 tools (init/finalize/sign_release)11 MCP Tools (orchestrate, status, etc.)Current
Seller Plugin2 tools (verify_lock/claim)confirm_fulfillment + webhookCurrent

6.2 当前 MCP Tools (生产中)

详见 RFC-005v4 Section 7.1。当前已部署的 11 个 MCP Tools:

User Agent 侧:

  • nexus_orchestrate_payment — 编排支付 (替代 initialize + finalize)
  • nexus_get_payment_status — 查询状态
  • nexus_dispute_payment — 发起争议
  • nexus_discover_agents — 发现商户 Agent
  • nexus_get_agent_skill — 获取 Agent skill.md
  • nexus_get_merchant — 获取商户信息

Merchant Agent 侧:

  • nexus_confirm_fulfillment — 确认履约 (触发 Escrow 释放)
  • nexus_release_payment — 显式释放
  • nexus_cancel_payment — 取消单笔支付
  • nexus_cancel_order — 取消整个订单组
  • nexus_resolve_dispute — 仲裁争议

6.3 AP2 Protocol 适配

RFC-007 的 Buyer/Seller Plugin 概念与 AP2 Agent Protocol 的 Credential 模式共存:

  • AP2 环境: CartMandate → Nexus → PaymentMandate (VC 格式)
  • MCP 环境: Quote → orchestrate_payment → 402 Instruction (NUPS 格式)
  • 链上结算层完全相同 (NexusEscrow v4.3.0)

详见 RFC-002 v2.0 Section 7 (AP2 Protocol Extension)。