@seasonkoh/webaz 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -151,12 +151,29 @@ export function getOrderStatus(db, orderId) {
151
151
  const responsibleTable = isSelfFulfill ? CURRENT_RESPONSIBLE_SELF_FULFILL : CURRENT_RESPONSIBLE;
152
152
  const currentResponsible = responsibleTable[order.status] ?? null;
153
153
  const activeDeadline = getActiveDeadline(order, db);
154
+ // 2026-05-31 透传 Phase 1 兜底语义给 agent — 当 fulfillment_mode='shipping' 但 logistics_id NULL,
155
+ // 实际是"协议 Phase 1 没物流市场,seller 自履行兜底"。agent 看到 responsible=seller 容易误解为
156
+ // "卖家本来就要自履行",所以加显式 phase + context 让 agent 明白这是 Phase 1 临时兜底。
157
+ // 真正面交(fulfillment_mode='in_person')才是 self-fulfill 本意。
158
+ const mode = order.fulfillment_mode;
159
+ const isInPerson = mode === 'in_person';
160
+ const isPhase1Fallback = isSelfFulfill && !isInPerson && (mode === 'shipping' || !mode);
161
+ const fulfillmentPhase = isPhase1Fallback
162
+ ? 'phase_1_no_logistics_market'
163
+ : (isInPerson ? 'in_person' : (order.logistics_id ? 'phase_2_logistics_assigned' : 'unknown'));
164
+ const responsibleContext = isPhase1Fallback
165
+ ? `Phase 1 fallback: 协议物流市场未启用,logistics_id 未绑定。seller 自履行兜底(自己揽收/运输/送达),超时按 fault_seller 处置。Phase 2 logistics 市场上线后会自动派单给 logistics 角色,届时 shipped/picked_up/in_transit → logistics 负责。`
166
+ : (isInPerson
167
+ ? '面交模式(fulfillment_mode=in_person):seller 与 buyer 当面交接,无第三方物流'
168
+ : (order.logistics_id ? '已绑定物流方,按 logistics 责任流转(market-fulfill)' : null));
154
169
  return {
155
170
  order,
156
171
  history,
157
172
  currentResponsible,
158
173
  activeDeadline,
159
- isOverdue: activeDeadline ? new Date() > new Date(activeDeadline.deadline) : false
174
+ isOverdue: activeDeadline ? new Date() > new Date(activeDeadline.deadline) : false,
175
+ fulfillmentPhase,
176
+ responsibleContext,
160
177
  };
161
178
  }
162
179
  // ─── 超时判责资金处置 ────────────────────────────────────────
@@ -1579,6 +1579,23 @@ function handleInfo() {
1579
1579
  reviewer: '1. webaz_register(role=reviewer) → 2. webaz_claim_verify(action=apply) 申请测评免单 → 3. 收货后写真实评价',
1580
1580
  arbitrator: '1. webaz_register(role=arbitrator) → 2. webaz_dispute(action=list_open) 看待裁案件 → 3. webaz_dispute(action=arbitrate) — ⚠️ 需 PWA + Passkey(Iron-Rule)',
1581
1581
  },
1582
+ // 搜索/发现场景决策地图 — agent 第一次 onboard 拿到 user-scenario → tool + PWA-page 总表,
1583
+ // 避免每次试错。每行:scenario(用户怎么说)→ tool(我用哪个 MCP 工具)+ pwa_page(没接口时让用户去哪)
1584
+ search_routing: [
1585
+ { scenario: '用户给出商品完整标题 / SKU / 精准描述', tool: 'webaz_search query=...', pwa_page: '#buy', note: 'STRICT 精准匹配,0 命中不降级 fuzzy' },
1586
+ { scenario: '用户粘贴外站链接(淘宝/抖音/小红书/JD/PDD/1688/Tmall)', tool: 'webaz_search external_link=... 或 paste_text=...', pwa_page: '#buy', note: '匹配 anchor registry 精准产品指纹' },
1587
+ { scenario: '用户要"模糊浏览"/ 关键词探索 / 不知精准 SKU', tool: '⚠️ 无 MCP 接口 — 引导用户去 PWA 自己输关键词', pwa_page: '#discover', note: 'fuzzy 是用户主动行为,不是 agent 代办,见 [protocol invariant]' },
1588
+ { scenario: '用户问"我附近 / 同城 / 11km 范围 有人买什么"', tool: 'webaz_nearby action=query', pwa_page: '#nearby', note: 'k-anonymity ≥3 隐私保护' },
1589
+ { scenario: '用户要二手 / 闲置 / 个人 pre-owned 商品', tool: 'webaz_secondhand action=browse', pwa_page: '#secondhand', note: '独立空间,不跟 catalog 商品混' },
1590
+ { scenario: '用户要竞拍 / 捡漏稀有品 / English forward auction', tool: 'webaz_auction action=browse', pwa_page: '#auctions', note: '时间窗口事件,有 anti-snipe 延时' },
1591
+ { scenario: '用户买不到,想发起求购让卖家来报价', tool: 'webaz_rfq action=create', pwa_page: '#rfqs', note: '反向匹配 — buyer 出需求 + 押金 1%' },
1592
+ { scenario: '用户想申请试用 / 0 元拿样 / 测评免单', tool: 'webaz_trial action=get_campaign / apply', pwa_page: '#trials', note: '需 ≥1 笔订单 + ≥3 天账号' },
1593
+ { scenario: '用户想发布或回应慈善许愿 / 捐赠社区基金', tool: 'webaz_charity action=list / create / donate', pwa_page: '#charity', note: '跟 place_order donation_pct 是不同动作' },
1594
+ { scenario: '用户买知识技能 / Prompt / 模板 / 清单', tool: 'webaz_skill_market action=list / purchase / read', pwa_page: '#skill-market', note: '内容型,与 webaz_skill 行为插件市场不同' },
1595
+ { scenario: '用户问某具体人 / @handle / usr_xxx 的主页或内容流', tool: 'webaz_profile action=view_user', pwa_page: '#u/:id', note: '不是关键词搜,只看指定人' },
1596
+ { scenario: '用户想看某商家全部商品(已知 seller_id)', tool: 'webaz_search seller_id=...', pwa_page: '#shop/:id', note: 'strict 精准过滤,sort 可选 trending/newest' },
1597
+ { scenario: '用户问什么"最热门 / 排行 / trending"', tool: 'webaz_leaderboard kind=...', pwa_page: '(无独立页,各域内置)', note: '8 类:products / value_products / creators / sellers / buyers / verifiers / arbitrators / agents' },
1598
+ ],
1582
1599
  available_tools: TOOLS.map((t) => ({ name: t.name, description: t.description.split('\n')[0] })),
1583
1600
  full_manifest: `读取 MCP Resource "${MANIFEST_URI}" 获取完整协议规范(状态机/经济模型/争议系统/Skill 市场/声誉系统)`,
1584
1601
  };
@@ -2331,13 +2348,17 @@ function handleGetStatus(args) {
2331
2348
  const statusInfo = getOrderStatus(db, args.order_id);
2332
2349
  if (!statusInfo)
2333
2350
  return { error: `订单不存在:${args.order_id}` };
2334
- const { order, history, currentResponsible, activeDeadline, isOverdue } = statusInfo;
2351
+ const { order, history, currentResponsible, activeDeadline, isOverdue, fulfillmentPhase, responsibleContext } = statusInfo;
2335
2352
  return {
2336
2353
  order_id: order.id,
2337
2354
  current_status: order.status,
2338
2355
  current_responsible: currentResponsible
2339
2356
  ? `${currentResponsible}(当前应由此角色操作)`
2340
2357
  : '无(等待系统处理)',
2358
+ // Phase 1 兜底语义透传 — agent 看到 responsible=seller 时若不理解为什么(如 shipped 后还要 seller 揽收),
2359
+ // 应读此字段。Phase 2 logistics 市场上线后,phase_1_no_logistics_market 会消失。
2360
+ fulfillment_phase: fulfillmentPhase,
2361
+ responsible_context: responsibleContext,
2341
2362
  deadline: activeDeadline
2342
2363
  ? {
2343
2364
  field: activeDeadline.field,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seasonkoh/webaz",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Agent-native decentralized commerce protocol. Humans and AI agents trade on the same protocol via MCP tools.",
5
5
  "main": "dist/mcp.js",
6
6
  "bin": {