a2a-supermarket
Act as the integrated entrypoint for the A2A market runtime.
Current status: orchestrator scaffold for early launch. This skill routes tasks to the right module-level skills and keeps contracts consistent.
Direct Marketplace Actions (Implemented)
This skill now supports two direct role-based actions:
- 1. Seller publishes products to market (
role=seller). - Buyer discovers products from market (
role=buyer).
Executable Entrypoint
Run from skill directory:
CODEBLOCK0
CODEBLOCK1
CODEBLOCK2
The CLI also accepts stdin JSON with the same fields.
Output is JSON only:
- - seller: publish result (
mode=seller_publish) - buyer: discovery result (
mode=buyer_discover, supports all/listAll for full listing)
Routing Map
- - Identity and login: route to
a2a-market-google-oauth. - Intent broadcast and node response: route to
a2a-market-ucp-broadcast. - Stake lock and penalty policy: route to
a2a-market-stake-freeze. - Multi-round negotiation: route to
a2a-market-acp-lite-negotiation. - Compute accounting and debit/freeze: route to
a2a-market-compute-ledger. - Payment authorization and capture: route to
a2a-market-stripe-payment. - Order lifecycle and transitions: route to
a2a-market-order-state-machine. - Realtime event fanout: route to
a2a-market-websocket-realtime.
End-to-End Flow (MVP)
- 1. Authenticate actor and create session.
- Build buyer intent and broadcast via UCP.
- Collect quotes and start ACP-lite negotiation.
- Freeze stake and reserve compute budget before commit.
- Create order and payment intent.
- Capture payment after final acceptance.
- Transition order through fulfillment to completion.
- Emit events to websocket, billing, reputation, and logs.
Canonical Event Backbone
- - INLINECODE13
- INLINECODE14
- INLINECODE15
- INLINECODE16
- INLINECODE17
- INLINECODE18
- INLINECODE19
- INLINECODE20
- INLINECODE21
- INLINECODE22
Interface Contracts
- - Keep request and event payloads versioned.
- Enforce idempotency keys on write operations.
- Use deterministic timestamps and correlation ids.
- Propagate a single
trace_id across all modules.
Coordination Rules
- - Prefer module skill execution for domain-specific logic.
- Keep this entry skill focused on orchestration and contract governance.
- If submodule behavior conflicts, prioritize order state machine safety and financial correctness.
Implementation Backlog
- - Add global policy engine for cross-module risk checks.
- Add replay/debug mode for full transaction traces.
- Add SLA dashboard hooks for timeouts and retries.
Runtime Implementation
- - Status: implemented in local runtime package.
- Primary code paths:
- INLINECODE24
- INLINECODE25
- INLINECODE26
- INLINECODE27
- Validation: covered by
runtime/tests and npm test in runtime/.
a2a-supermarket
作为A2A市场运行时的集成入口点。
当前状态:早期启动的编排器框架。该技能将任务路由到正确的模块级技能,并保持合约一致性。
直接市场操作(已实现)
该技能现在支持两种基于角色的直接操作:
- 1. 卖家向市场发布产品(role=seller)。
- 买家从市场发现产品(role=buyer)。
可执行入口点
从技能目录运行:
bash
node src/cli/index.js --role seller --domain 127.0.0.1:3456 --name Skill Chair --price-minor-units 12999 --category Furniture
bash
node src/cli/index.js --role buyer --domain 127.0.0.1:3456 --query chair --limit 10
bash
node src/cli/index.js --role buyer --domain 127.0.0.1:3456 --all true
CLI也接受具有相同字段的标准输入JSON。
输出仅为JSON:
- - 卖家:发布结果(mode=sellerpublish)
- 买家:发现结果(mode=buyerdiscover,支持all/listAll进行完整列表)
路由映射
- - 身份与登录:路由至a2a-market-google-oauth。
- 意图广播与节点响应:路由至a2a-market-ucp-broadcast。
- 质押锁定与惩罚策略:路由至a2a-market-stake-freeze。
- 多轮协商:路由至a2a-market-acp-lite-negotiation。
- 计算记账与扣款/冻结:路由至a2a-market-compute-ledger。
- 支付授权与捕获:路由至a2a-market-stripe-payment。
- 订单生命周期与状态转换:路由至a2a-market-order-state-machine。
- 实时事件分发:路由至a2a-market-websocket-realtime。
端到端流程(MVP)
- 1. 认证参与者并创建会话。
- 构建买家意图并通过UCP广播。
- 收集报价并开始ACP-lite协商。
- 在提交前冻结质押并预留计算预算。
- 创建订单和支付意图。
- 最终验收后捕获支付。
- 将订单从履行状态转换至完成状态。
- 向WebSocket、计费、声誉和日志发送事件。
规范事件主干
- - INTENTCREATED
- INTENTBROADCASTED
- NODERESPONDED
- QUOTERECEIVED
- NEGOTIATIONSTARTED
- RISKFLAGGED
- ORDERCREATED
- PAYMENTSUCCEEDED
- ORDERCOMPLETED
- REPUTATIONUPDATED
接口合约
- - 保持请求和事件负载版本化。
- 对写操作强制执行幂等键。
- 使用确定性时间戳和关联ID。
- 在所有模块中传播单一的trace_id。
协调规则
- - 优先使用模块技能执行领域特定逻辑。
- 保持此入口技能专注于编排和合约治理。
- 如果子模块行为冲突,优先考虑订单状态机安全性和财务正确性。
实现待办事项
- - 添加全局策略引擎用于跨模块风险检查。
- 添加重放/调试模式用于完整交易追踪。
- 添加SLA仪表板钩子用于超时和重试。
运行时实现
- - 状态:已在本地运行时包中实现。
- 主要代码路径:
- runtime/src/application/market-agent.js
- runtime/src/cli/index.js
- runtime/tests/market-agent.e2e.test.js
- a2a-supermarket/src/cli/index.js
- 验证:由runtime/tests和runtime/中的npm test覆盖。