@seasonkoh/webaz 0.1.15 → 0.1.17
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.
- package/LICENSE +1 -1
- package/NOTICE +58 -0
- package/README.md +84 -6
- package/dist/layer0-foundation/L0-2-state-machine/engine.js +3 -0
- package/dist/layer1-agent/L1-1-mcp-server/server.js +840 -704
- package/dist/layer2-business/L2-8-feedback/build-feedback-engine.js +169 -0
- package/dist/layer3-trust/L3-1-dispute-engine/dispute-engine.js +16 -0
- package/dist/layer4-economics/L4-3-reputation/reputation-engine.js +1 -0
- package/dist/mcp.js +7 -3
- package/dist/pwa/data/onboarding-cases.js +345 -0
- package/dist/pwa/data/onboarding-quiz.js +247 -0
- package/dist/pwa/public/app.js +1469 -105
- package/dist/pwa/public/i18n.js +282 -2
- package/dist/pwa/public/icon-192.png +0 -0
- package/dist/pwa/public/icon-512.png +0 -0
- package/dist/pwa/public/manifest.json +5 -2
- package/dist/pwa/public/openapi.json +1 -1
- package/dist/pwa/public/sw.js +1 -1
- package/dist/pwa/routes/admin-protocol-params.js +80 -2
- package/dist/pwa/routes/admin-reports.js +14 -9
- package/dist/pwa/routes/auth-read.js +3 -1
- package/dist/pwa/routes/build-feedback.js +67 -0
- package/dist/pwa/routes/disputes-write.js +149 -1
- package/dist/pwa/routes/governance-auto-deactivate.js +108 -0
- package/dist/pwa/routes/governance-onboarding.js +785 -0
- package/dist/pwa/routes/leaderboard.js +10 -2
- package/dist/pwa/routes/orders-action.js +5 -1
- package/dist/pwa/routes/products-meta.js +30 -0
- package/dist/pwa/routes/profile-identity.js +1 -1
- package/dist/pwa/routes/public-utils.js +44 -0
- package/dist/pwa/routes/rewards-apply.js +210 -0
- package/dist/pwa/routes/rewards-auto-downgrade.js +65 -0
- package/dist/pwa/routes/rewards-escrow-expire.js +48 -0
- package/dist/pwa/routes/webauthn.js +1 -1
- package/dist/pwa/server.js +590 -79
- package/package.json +11 -6
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
* webaz_update_order L1-6 更新订单状态(发货/揽收/投递/确认/争议)
|
|
12
12
|
* webaz_get_status L1-4 查询订单状态和历史
|
|
13
13
|
* webaz_wallet 查看钱包余额
|
|
14
|
+
* …(38 工具,完整定义见下方 TOOLS 数组;数量以 TOOLS.length 为准)
|
|
15
|
+
*
|
|
16
|
+
* 双模(RFC-003):NETWORK(WEBAZ_API_KEY → 调 webaz.xyz)/ SANDBOX(本机库);见 NETWORK_TOOLS / apiCall / toolBackend。
|
|
17
|
+
* 关联 / Related: AGENTS.md · RFC-003(双模) · RFC-004(webaz_feedback) · 元规则 #4 不撒谎(_mode 戳) /
|
|
18
|
+
* #6 不滥用(agent 责任制 + Iron-Rule 真人动作)· 生产端点在 src/pwa(NETWORK 共用)
|
|
14
19
|
*/
|
|
15
20
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
16
21
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
@@ -27,7 +32,89 @@ import { requireAuth } from './auth.js';
|
|
|
27
32
|
import { createHash, randomBytes } from 'node:crypto';
|
|
28
33
|
const SERVER_VERSION = '0.1.8';
|
|
29
34
|
const TELEMETRY_URL = process.env.WEBAZ_TELEMETRY_URL ?? 'https://webaz.xyz/api/mcp-telemetry';
|
|
30
|
-
|
|
35
|
+
// 2026-06-01: phase A pre-launch 默认 OFF(opt-in)— W8 public launch 时翻回 default ON + 加 README 披露段
|
|
36
|
+
// Phase A pre-launch: telemetry default OFF (opt-in). Flip to default ON at W8 launch + add README disclosure section.
|
|
37
|
+
const TELEMETRY_ENABLED = (process.env.WEBAZ_TELEMETRY ?? 'off').toLowerCase() === 'on';
|
|
38
|
+
// ─── RFC-003 P0: 双模(NETWORK / SANDBOX)骨架 ─────────────────────
|
|
39
|
+
// NETWORK = 带 api_key 调 webaz.xyz/api(加入共享生产网络);SANDBOX = 本地 SQLite(离线试玩,与全网隔离)。
|
|
40
|
+
// P0 不迁移任何工具(NETWORK_TOOLS 为空)→ 一切仍走本地 = 零行为变化;P1/P2 逐个把工具名加入集合切到网络。
|
|
41
|
+
const WEBAZ_API_URL = (process.env.WEBAZ_API_URL ?? 'https://webaz.xyz').replace(/\/+$/, '');
|
|
42
|
+
const WEBAZ_API_KEY = process.env.WEBAZ_API_KEY ?? '';
|
|
43
|
+
const WEBAZ_MODE_ENV = (process.env.WEBAZ_MODE ?? '').toLowerCase();
|
|
44
|
+
// 模式:显式 WEBAZ_MODE 优先;否则有 api_key → network,无 → sandbox
|
|
45
|
+
const MODE = WEBAZ_MODE_ENV === 'network' ? 'network'
|
|
46
|
+
: WEBAZ_MODE_ENV === 'sandbox' ? 'sandbox'
|
|
47
|
+
: (WEBAZ_API_KEY ? 'network' : 'sandbox');
|
|
48
|
+
// 已迁移到 NETWORK 的工具名。P1/P2 逐个加入;未在集合里的工具仍走 sandbox(本地)。
|
|
49
|
+
// P1(读工具): 纯公开读,无写无 Passkey,作"MCP 连得上生产网络"的首验证。
|
|
50
|
+
const NETWORK_TOOLS = new Set([
|
|
51
|
+
'webaz_price_history',
|
|
52
|
+
'webaz_leaderboard',
|
|
53
|
+
'webaz_verify_price',
|
|
54
|
+
'webaz_place_order',
|
|
55
|
+
'webaz_list_product',
|
|
56
|
+
'webaz_update_order',
|
|
57
|
+
'webaz_search',
|
|
58
|
+
'webaz_get_status',
|
|
59
|
+
'webaz_feedback',
|
|
60
|
+
]);
|
|
61
|
+
const recentCalls = [];
|
|
62
|
+
function pushRecentCall(c) {
|
|
63
|
+
recentCalls.push(c);
|
|
64
|
+
if (recentCalls.length > 8)
|
|
65
|
+
recentCalls.shift(); // 只留最近 8 条
|
|
66
|
+
}
|
|
67
|
+
// 单个工具实际后端:仅当全局 network 且该工具已迁移,才走网络;否则 sandbox。
|
|
68
|
+
function toolBackend(tool) {
|
|
69
|
+
return (MODE === 'network' && NETWORK_TOOLS.has(tool)) ? 'network' : 'sandbox';
|
|
70
|
+
}
|
|
71
|
+
// 统一 API helper(P1/P2 迁移工具时使用)。Bearer api_key + 15s 超时 + 错误映射。
|
|
72
|
+
async function apiCall(path, opts = {}) {
|
|
73
|
+
const { method = 'GET', body } = opts;
|
|
74
|
+
const key = opts.apiKey || WEBAZ_API_KEY; // 每次调用可覆盖(工具 args.api_key 优先);否则用全局配置 key
|
|
75
|
+
const url = WEBAZ_API_URL + (path.startsWith('/') ? path : '/' + path);
|
|
76
|
+
try {
|
|
77
|
+
const resp = await fetch(url, {
|
|
78
|
+
method,
|
|
79
|
+
headers: {
|
|
80
|
+
...(key ? { authorization: `Bearer ${key}` } : {}),
|
|
81
|
+
...(body != null ? { 'content-type': 'application/json' } : {}),
|
|
82
|
+
},
|
|
83
|
+
...(body != null ? { body: JSON.stringify(body) } : {}),
|
|
84
|
+
signal: AbortSignal.timeout(15_000),
|
|
85
|
+
});
|
|
86
|
+
let json = null;
|
|
87
|
+
try {
|
|
88
|
+
json = await resp.json();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
json = null;
|
|
92
|
+
}
|
|
93
|
+
if (!resp.ok) {
|
|
94
|
+
const map = {
|
|
95
|
+
401: 'api_key 无效或未注册 — 请在 https://webaz.xyz 注册并把 api_key 填入 WEBAZ_API_KEY',
|
|
96
|
+
403: '权限不足 / 需邀请码 / 该动作需真人 Passkey(请到 webaz.xyz 用 Passkey 操作)',
|
|
97
|
+
429: '调用过于频繁,请稍后再试',
|
|
98
|
+
503: '服务暂不可用,请稍后重试',
|
|
99
|
+
};
|
|
100
|
+
return { error: json?.error ?? map[resp.status] ?? `HTTP ${resp.status}`, error_code: json?.error_code, http_status: resp.status };
|
|
101
|
+
}
|
|
102
|
+
return json ?? {};
|
|
103
|
+
}
|
|
104
|
+
catch (e) {
|
|
105
|
+
const msg = e.name === 'TimeoutError' ? '请求超时(15s)' : e.message;
|
|
106
|
+
return { error: `网络错误:${msg}`, network_error: true };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// 启动 banner(stderr)+ status 声明用 —— 让用户/agent 一眼知道现在是真网络还是沙盒
|
|
110
|
+
function modeBanner() {
|
|
111
|
+
if (MODE === 'network') {
|
|
112
|
+
return `🟢 NETWORK mode — webaz.xyz (${WEBAZ_API_URL}). Migrated tools: ${NETWORK_TOOLS.size}/${TOOLS.length}`
|
|
113
|
+
+ (NETWORK_TOOLS.size === 0 ? ' ⚠️ network client not active yet (P0 scaffold) — all tools still SANDBOX/local.' : '');
|
|
114
|
+
}
|
|
115
|
+
return `🟡 SANDBOX mode — local-only (~/.webaz/webaz.db), NOT the live network. Data is private to this machine.`
|
|
116
|
+
+ (WEBAZ_API_KEY ? '' : ' Set WEBAZ_API_KEY (register at webaz.xyz) to join the network.');
|
|
117
|
+
}
|
|
31
118
|
// ─── 初始化 ──────────────────────────────────────────────────
|
|
32
119
|
const db = initDatabase();
|
|
33
120
|
initSystemUser(db);
|
|
@@ -165,46 +252,31 @@ No auth required, no parameters needed.
|
|
|
165
252
|
},
|
|
166
253
|
{
|
|
167
254
|
name: 'webaz_register',
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
- permanent_code (6-char recovery code — use with handle via webaz_mykey to recover lost api_key)
|
|
171
|
-
- handle (URL-safe unique ID derived from name; if requested handle is taken, system auto-appends numeric suffix — check handle_modified flag)
|
|
172
|
-
- created_at (ISO timestamp)
|
|
173
|
-
|
|
174
|
-
⚠️ Consent required: WebAZ is pre-launch and contains a 3-tier commission + binary PV pairing structure (see webaz_info.commission_model.compliance_notice — may overlap with MLM legal definitions). An agent acting for a human user MUST get the user's explicit, informed consent BEFORE creating an account on their behalf. Do NOT auto-register users just because they asked a generic shopping question.
|
|
255
|
+
// was ~1732 chars, now ~780 chars
|
|
256
|
+
description: `Register a new WebAZ account. Returns: api_key (36-char 128-bit credential, store securely) + permanent_code (6-char recovery code, pair with handle in webaz_mykey to recover lost api_key) + handle (URL-safe ID; if taken, system appends numeric suffix — check handle_modified flag) + created_at.
|
|
175
257
|
|
|
176
|
-
|
|
177
|
-
- buyer: browse, order, confirm receipt
|
|
178
|
-
- seller: list products, accept orders, ship
|
|
179
|
-
- logistics: pickup, transit updates, delivery confirm
|
|
180
|
-
- reviewer: structured product reviews
|
|
181
|
-
- arbitrator: handle disputes, issue rulings
|
|
258
|
+
⚠️ **Consent required (MLM disclosure)**: WebAZ is pre-launch with 3-tier commission + binary PV pairing structure (may overlap with MLM legal definitions; see webaz_info.commission_model.compliance_notice). Agent acting on behalf of human user **MUST get explicit informed consent BEFORE creating account**. Do NOT auto-register from generic shopping questions.
|
|
182
259
|
|
|
183
|
-
|
|
184
|
-
- Does NOT set placement_id / sponsor_id (binary tree + referral chain not built) — MCP registration does NOT enroll the user into the multi-tier structure
|
|
185
|
-
- To build a referral chain: user must arrive via webaz_share_link ?ref=<uid> URL clicked in browser (PWA flow) — explicit user action required
|
|
186
|
-
- region defaults to 'global' if omitted; valid: singapore, china, usa, malaysia, indonesia, thailand, vietnam, taiwan, hk, global
|
|
260
|
+
Roles: buyer (browse/order/confirm) | seller (list/accept/ship) | logistics (pickup/transit/deliver) | reviewer (reviews) | arbitrator (disputes/rulings).
|
|
187
261
|
|
|
188
|
-
|
|
189
|
-
中文:注册 WebAZ 账户。返回 api_key(128-bit 凭证)+ permanent_code(恢复码)+ handle(唯一标识,冲突自动加后缀,看 handle_modified)+ created_at。可选角色:买家/卖家/物流/测评员/仲裁员。
|
|
190
|
-
注意:MCP register 不建立 placement/sponsor 链(防 bot),需要建链时用 webaz_share_link + PWA 浏览器注册。`,
|
|
262
|
+
⚠️ **MCP register limitations (anti-bot, by design)**: does NOT set placement_id/sponsor_id — referral/PV chain NOT built via MCP. To build chain: user must arrive via webaz_share_link \`?ref=<uid>\` URL clicked in browser (PWA flow). region defaults 'global'; valid: singapore/china/usa/malaysia/indonesia/thailand/vietnam/taiwan/hk/global.`,
|
|
191
263
|
inputSchema: {
|
|
192
264
|
type: 'object',
|
|
193
265
|
properties: {
|
|
194
|
-
name: { type: 'string', description: '
|
|
266
|
+
name: { type: 'string', description: 'Your name or shop name' },
|
|
195
267
|
role: {
|
|
196
268
|
type: 'string',
|
|
197
269
|
enum: ['buyer', 'seller', 'logistics', 'reviewer', 'arbitrator'],
|
|
198
|
-
description: '
|
|
270
|
+
description: 'Your role in the protocol',
|
|
199
271
|
},
|
|
200
272
|
initial_balance: {
|
|
201
273
|
type: 'number',
|
|
202
|
-
description: '
|
|
274
|
+
description: 'Initial mock balance (for testing, default 1000 WAZ)',
|
|
203
275
|
},
|
|
204
276
|
region: {
|
|
205
277
|
type: 'string',
|
|
206
278
|
enum: ['global', 'singapore', 'china', 'usa', 'malaysia', 'indonesia', 'thailand', 'vietnam', 'taiwan', 'hk'],
|
|
207
|
-
description: '
|
|
279
|
+
description: 'Account region (default global; affects referral region cap + commission redirect_region_cap rules)',
|
|
208
280
|
},
|
|
209
281
|
},
|
|
210
282
|
required: ['name', 'role'],
|
|
@@ -212,184 +284,133 @@ Roles:
|
|
|
212
284
|
},
|
|
213
285
|
{
|
|
214
286
|
name: 'webaz_search',
|
|
287
|
+
// was ~2607 chars, now ~1050 chars
|
|
215
288
|
description: `Search WebAZ marketplace + cross-platform anchor lookup. No auth required.
|
|
216
289
|
|
|
217
|
-
⚠️ **STRICT MATCH ONLY**
|
|
218
|
-
不做 fuzzy LIKE 模糊降级。短查询(如 "钱包" "iphone")很大概率 0 命中,这是设计如此,不是 bug。
|
|
219
|
-
0 命中时,**不要**自己拼短词 retry,也**不要**调别的工具假装搜索;应**引导用户访问 https://webaz.xyz/#discover**
|
|
220
|
-
在搜索框输入关键词浏览(那里有 fuzzy LIKE)。模糊搜索是用户主动行为,不是 agent 代办。
|
|
290
|
+
⚠️ **STRICT MATCH ONLY** (no fuzzy fallback). query matches = exact title OR exact external_title OR alias ≥6 chars contained in user text. Short queries (e.g. "iphone") likely return 0 — **this is by design, NOT a bug**. On 0 results: do NOT retry with shorter terms, do NOT call other tools to fake search. Direct user to https://webaz.xyz/#discover for fuzzy browse (user action, not agent's job).
|
|
221
291
|
|
|
222
292
|
USE THIS when:
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
→ WebAZ exact-matches against its anchor registry
|
|
227
|
-
platforms). matched_by='none' means truly not indexed — do NOT silently fall back to keyword,
|
|
228
|
-
and do NOT guess similar products.
|
|
229
|
-
|
|
230
|
-
⚠️ Do not skip this tool just because user gave you a URL — URL-paste is a first-class mode here,
|
|
231
|
-
NOT a separate browser-fetch capability. Returns structured specs + logistics + after-sales +
|
|
232
|
-
agent_summary (one-line decision hint).
|
|
233
|
-
|
|
234
|
-
【Keyword search — STRICT】Pass query / category / max_price / min_return_days / max_handling_hours.
|
|
235
|
-
query 命中 = (1) 完全等于 product.title OR (2) 完全等于任一 external_title OR (3) 用户文本包含任一卖家声明 alias_value (≥6 字符)。模糊关键词请引导用户去 PWA #discover。
|
|
293
|
+
- User gives **full product title / SKU / precise description** (strict-match candidate), OR
|
|
294
|
+
- User gives **filters** (category / max_price / min_return_days / max_handling_hours / sort), OR
|
|
295
|
+
- User pastes **external URL / share-text** from Taobao / Tmall / JD / PDD / 1688 / Douyin / Xiaohongshu
|
|
296
|
+
→ URL-paste is a first-class mode of THIS tool, NOT a separate browser-fetch. WebAZ exact-matches against its cross-platform anchor registry.
|
|
236
297
|
|
|
237
|
-
【External-link paste
|
|
238
|
-
(e.g. '【淘宝】「Product Name」 https://e.tb.cn/xxx ...'), do:
|
|
239
|
-
1) Prefer your own LLM parsing → pass external_link object with:
|
|
240
|
-
- platform: 'taobao'|'tmall'|'jd'|'pdd'|'1688'|'douyin'|'xhs'
|
|
241
|
-
- external_id: canonical product ID (if resolvable from short URL; else omit)
|
|
242
|
-
- external_title: the title text inside 「」 brackets verbatim
|
|
243
|
-
2) If you can't parse, drop the raw text into paste_text — WebAZ server does light regex parsing (no outbound calls)
|
|
298
|
+
【External-link paste】Prefer LLM-parse into \`external_link\` { platform, external_id?, external_title } (title = verbatim text inside 「」). If unparseable, drop raw into \`paste_text\` (server does light regex). Match: L1 external_id exact → L2 external_title exact → else \`matched_by:'none'\`. **No fuzzy fallback, no keyword degradation, no similar-product guessing.** matched_by='none' = tell user honestly "no exact match"; trust premise is precise not "looks similar".
|
|
244
299
|
|
|
245
|
-
|
|
246
|
-
- Level 1: external_id exact match
|
|
247
|
-
- Level 2: external_title string exact match
|
|
248
|
-
- Neither hit → matched_by: 'none', **NO fuzzy fallback, NO keyword degradation**
|
|
249
|
-
|
|
250
|
-
IMPORTANT: matched_by='none' is an honest signal — tell the user "no exact match found".
|
|
251
|
-
Do NOT silently fall back to keyword search (that's a separate tool's job).
|
|
252
|
-
Do NOT guess similar products from title impressions.
|
|
253
|
-
WebAZ's trust premise is that match results are TRULY precise, not "looks similar".
|
|
254
|
-
|
|
255
|
-
Note: paste-link matching hits webaz.xyz production data, not your local webaz.db.
|
|
256
|
-
|
|
257
|
-
──
|
|
258
|
-
中文:商品搜索(无需登录)。两种模式:关键词搜索 + 粘贴外链精准匹配。外链匹配强制精准(仅 external_id 或 external_title 完全相等命中),不命中返回 matched_by:'none',不做模糊降级。`,
|
|
300
|
+
Returns: structured specs + logistics + after-sales + agent_summary (one-line decision hint). Paste-link hits webaz.xyz prod data, not local webaz.db.`,
|
|
259
301
|
inputSchema: {
|
|
260
302
|
type: 'object',
|
|
261
303
|
properties: {
|
|
262
|
-
query: { type: 'string', description: '
|
|
263
|
-
category: { type: 'string', description: '
|
|
264
|
-
max_price: { type: 'number', description: '
|
|
265
|
-
min_return_days: { type: 'number', description: '
|
|
266
|
-
max_handling_hours: { type: 'number', description: '
|
|
267
|
-
paste_text: { type: 'string', description: '
|
|
304
|
+
query: { type: 'string', description: 'Search keyword (product name or description)' },
|
|
305
|
+
category: { type: 'string', description: 'Category filter (optional)' },
|
|
306
|
+
max_price: { type: 'number', description: 'Max price filter (optional)' },
|
|
307
|
+
min_return_days: { type: 'number', description: 'Min return days (optional, e.g. 7 = only ≥7-day return)' },
|
|
308
|
+
max_handling_hours: { type: 'number', description: 'Max handling hours (optional, e.g. 24 = only ≤24h dispatch)' },
|
|
309
|
+
paste_text: { type: 'string', description: 'Raw paste text / external link (optional; server does light regex parse)' },
|
|
268
310
|
external_link: {
|
|
269
311
|
type: 'object',
|
|
270
|
-
description: '
|
|
312
|
+
description: 'Structured external link match (optional, agent-parsed)',
|
|
271
313
|
properties: {
|
|
272
314
|
platform: { type: 'string', description: "'taobao'|'tmall'|'jd'|'pdd'|'1688'|'douyin'|'xhs'" },
|
|
273
|
-
external_id: { type: 'string', description: '
|
|
274
|
-
external_title: { type: 'string', description: '
|
|
275
|
-
canonical_url: { type: 'string', description: '
|
|
315
|
+
external_id: { type: 'string', description: 'Platform product canonical ID (optional)' },
|
|
316
|
+
external_title: { type: 'string', description: 'Platform product title verbatim (optional)' },
|
|
317
|
+
canonical_url: { type: 'string', description: 'Canonical URL (optional)' },
|
|
276
318
|
},
|
|
277
319
|
},
|
|
278
|
-
limit: { type: 'number', description: '
|
|
279
|
-
sort: { type: 'string', enum: ['trending', 'newest', 'rating', 'price_asc', 'price_desc', 'random'], description: '
|
|
280
|
-
has_sales: { type: 'string', enum: ['true', 'false'], description: 'true
|
|
281
|
-
ship_to: { type: 'string', description: '
|
|
282
|
-
seller_id: { type: 'string', description: '
|
|
283
|
-
cursor: { type: 'string', description: '
|
|
320
|
+
limit: { type: 'number', description: 'Result limit, default 10; agent mode up to 200' },
|
|
321
|
+
sort: { type: 'string', enum: ['trending', 'newest', 'rating', 'price_asc', 'price_desc', 'random'], description: 'Sort: trending=composite (default) / newest / rating / price_asc / price_desc / random' },
|
|
322
|
+
has_sales: { type: 'string', enum: ['true', 'false'], description: 'true=only sold; false=only new' },
|
|
323
|
+
ship_to: { type: 'string', description: 'Ship-to (province/city); auto-filters unshippable' },
|
|
324
|
+
seller_id: { type: 'string', description: 'Filter to one seller' },
|
|
325
|
+
cursor: { type: 'string', description: 'Pagination cursor (from previous next_cursor)' },
|
|
284
326
|
},
|
|
285
327
|
},
|
|
286
328
|
},
|
|
287
329
|
{
|
|
288
330
|
name: 'webaz_verify_price',
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
USE THIS for EVERY purchase, not just price-sensitive ones. Reasons:
|
|
292
|
-
(1) order price matches displayed (defeats flash-sale / hidden-fee races)
|
|
293
|
-
(2) caller is alerted if price changed between view and order
|
|
294
|
-
(3) protocol only liable for T0 price
|
|
295
|
-
(4) reduces stock-depletion race on hot items (session_token is single-use within 10min)
|
|
331
|
+
// was ~647 chars, now ~370 chars
|
|
332
|
+
description: `Lock price + reserve stock BEFORE webaz_place_order — returns \`session_token\` (10-min TTL, single-use, pass to place_order).
|
|
296
333
|
|
|
297
|
-
|
|
334
|
+
USE THIS for **EVERY purchase**: (1) defeats flash-sale / hidden-fee race (2) alerts if price drifted (3) protocol only liable for T0 price (4) reduces stock-depletion race on hot items.
|
|
298
335
|
|
|
299
|
-
|
|
300
|
-
中文:下单前锁价 — 10 分钟一次性 session_token;agent 应先调此再调 place_order。`,
|
|
336
|
+
Skipping is allowed but agent then carries price/stock-race risk itself.`,
|
|
301
337
|
inputSchema: {
|
|
302
338
|
type: 'object',
|
|
303
339
|
properties: {
|
|
304
|
-
api_key: { type: 'string', description: '
|
|
305
|
-
product_id: { type: 'string', description: '
|
|
306
|
-
quantity: { type: 'number', description: '
|
|
340
|
+
api_key: { type: 'string', description: "Buyer's api_key" },
|
|
341
|
+
product_id: { type: 'string', description: 'Product ID (from webaz_search)' },
|
|
342
|
+
quantity: { type: 'number', description: 'Quantity, default 1' },
|
|
307
343
|
},
|
|
308
344
|
required: ['api_key', 'product_id'],
|
|
309
345
|
},
|
|
310
346
|
},
|
|
311
347
|
{
|
|
312
348
|
name: 'webaz_list_product',
|
|
313
|
-
|
|
349
|
+
// was ~1336 chars, now ~650 chars
|
|
350
|
+
description: `⚠️ **"list" = PUBLISH** (verb), NOT "list out". Seller-only catalog publish + manage.
|
|
314
351
|
|
|
315
|
-
USE THIS when
|
|
316
|
-
- publish a NEW product to their catalog, OR
|
|
317
|
-
- update / delist / relist / trash / delete an existing product they own, OR
|
|
318
|
-
- view their OWN listings (action=mine)
|
|
352
|
+
USE THIS when seller wants to publish / update / delist / relist / trash / delete own product, OR view own listings (action=mine). NOT for browsing marketplace — use webaz_search (anyone, no auth). Requires seller api_key. On create: system auto-suggests stake ~15% of price (buyer protection).
|
|
319
353
|
|
|
320
|
-
|
|
354
|
+
Fill agent_summary fields completely (brand/return/handling/warranty) — helps buyer agents compare. For "exclusive-price vs external-link" listing → PWA Web only (link claim needs crowd-verify).
|
|
321
355
|
|
|
322
|
-
|
|
323
|
-
Note: for "exclusive price vs external link" listing, use PWA Web only — link claim needs crowd-verification.
|
|
324
|
-
|
|
325
|
-
Actions:
|
|
326
|
-
- create list a new product (default; needs title/description/price)
|
|
327
|
-
- mine list all my products (no product_id needed)
|
|
328
|
-
- update modify fields (needs product_id; only changed fields)
|
|
329
|
-
- delist move to warehouse (status: warehouse; needs product_id)
|
|
330
|
-
- relist re-shelve from warehouse (status: active; needs product_id)
|
|
331
|
-
- trash move to trash (status: deleted; needs product_id)
|
|
332
|
-
- delete permanent delete (only trash items with no active orders; needs product_id)
|
|
333
|
-
|
|
334
|
-
──
|
|
335
|
-
中文:卖家商品目录管理(上架/更新/下架/回收/删除/查询)。Actions: create / mine / update / delist / relist / trash / delete。上架时系统自动建议 15% 价格的质押金。`,
|
|
356
|
+
Actions: create (title/description/price) | mine | update (product_id + changed fields) | delist (→ warehouse) | relist (warehouse → active) | trash (→ deleted) | delete (only trash, no active orders).`,
|
|
336
357
|
inputSchema: {
|
|
337
358
|
type: 'object',
|
|
338
359
|
properties: {
|
|
339
|
-
api_key: { type: 'string', description: '
|
|
360
|
+
api_key: { type: 'string', description: "Seller's api_key" },
|
|
340
361
|
action: {
|
|
341
362
|
type: 'string',
|
|
342
363
|
enum: ['create', 'mine', 'update', 'delist', 'relist', 'trash', 'delete'],
|
|
343
|
-
description: '
|
|
364
|
+
description: 'Action (default: create)',
|
|
344
365
|
},
|
|
345
|
-
product_id: { type: 'string', description: '
|
|
346
|
-
title: { type: 'string', description: '
|
|
347
|
-
description: { type: 'string', description: '
|
|
348
|
-
price: { type: 'number', description: '
|
|
349
|
-
stock: { type: 'number', description: '
|
|
350
|
-
category: { type: 'string', description: '
|
|
366
|
+
product_id: { type: 'string', description: 'Product ID (required for update/delist/relist/trash/delete)' },
|
|
367
|
+
title: { type: 'string', description: 'Product name (required for create; optional for update)' },
|
|
368
|
+
description: { type: 'string', description: 'Product description (required for create; optional for update)' },
|
|
369
|
+
price: { type: 'number', description: 'Price in WAZ (required for create; optional for update)' },
|
|
370
|
+
stock: { type: 'number', description: 'Stock, default 1' },
|
|
371
|
+
category: { type: 'string', description: 'Category (optional)' },
|
|
351
372
|
specs: {
|
|
352
373
|
type: 'object',
|
|
353
|
-
description: '
|
|
374
|
+
description: 'Structured specs k/v, e.g. {"color":"black","ram":"16GB","storage":"512GB"} (optional)',
|
|
354
375
|
},
|
|
355
|
-
brand: { type: 'string', description: '
|
|
356
|
-
model: { type: 'string', description: '
|
|
376
|
+
brand: { type: 'string', description: 'Brand (optional)' },
|
|
377
|
+
model: { type: 'string', description: 'Model (optional)' },
|
|
357
378
|
source_price: {
|
|
358
379
|
type: 'number',
|
|
359
|
-
description: '
|
|
380
|
+
description: 'External reference price (optional, display only; exclusive-price auth needs PWA link-claim)',
|
|
360
381
|
},
|
|
361
|
-
ship_regions: { type: 'string', description: '
|
|
362
|
-
handling_hours: { type: 'number', description: '
|
|
382
|
+
ship_regions: { type: 'string', description: 'Ship region, default "all"' },
|
|
383
|
+
handling_hours: { type: 'number', description: 'Handling time (hours), default 24' },
|
|
363
384
|
estimated_days: {
|
|
364
385
|
type: 'object',
|
|
365
|
-
description: '
|
|
386
|
+
description: 'Estimated delivery days: number (e.g. 4) OR region map (e.g. {"east":2,"all":4})',
|
|
366
387
|
},
|
|
367
|
-
fragile: { type: 'boolean', description: '
|
|
368
|
-
return_days: { type: 'number', description: '
|
|
369
|
-
return_condition: { type: 'string', description: '
|
|
370
|
-
warranty_days: { type: 'number', description: '
|
|
388
|
+
fragile: { type: 'boolean', description: 'Fragile flag, default false' },
|
|
389
|
+
return_days: { type: 'number', description: 'Return days, default 7 (0 = no returns)' },
|
|
390
|
+
return_condition: { type: 'string', description: 'Return conditions text (optional)' },
|
|
391
|
+
warranty_days: { type: 'number', description: 'Warranty days, default 0' },
|
|
371
392
|
// S2 库存预警
|
|
372
393
|
low_stock_threshold: {
|
|
373
394
|
type: 'number',
|
|
374
|
-
description: '
|
|
395
|
+
description: '[S2] Low-stock alert threshold (notify seller when ≤; 0 = disabled)',
|
|
375
396
|
},
|
|
376
397
|
auto_delist_on_zero: {
|
|
377
398
|
type: 'boolean',
|
|
378
|
-
description: '
|
|
399
|
+
description: '[S2] Auto-delist to warehouse when stock=0 (anti-oversell)',
|
|
379
400
|
},
|
|
380
401
|
// S3 跨境上架多语言
|
|
381
402
|
i18n_titles: {
|
|
382
403
|
type: 'object',
|
|
383
|
-
description: '
|
|
404
|
+
description: '[S3] Multilingual titles, keys = en/ja/ko/fr/de/es/pt/ru/ar, values ≤500 chars. zh uses title field. E.g. {"en":"Wireless Earbuds","ja":"ワイヤレスイヤホン"}',
|
|
384
405
|
},
|
|
385
406
|
i18n_descs: {
|
|
386
407
|
type: 'object',
|
|
387
|
-
description: '
|
|
408
|
+
description: '[S3] Multilingual descs, same structure as i18n_titles',
|
|
388
409
|
},
|
|
389
410
|
// S4 商品溯源(origin_claims)— 协议级可挑战
|
|
390
411
|
origin_claims: {
|
|
391
412
|
type: 'object',
|
|
392
|
-
description: '
|
|
413
|
+
description: '[S4] Product-origin claims (challengeable). E.g. {"made_in":"Kyoto JP","material":"100% cotton GOTS-cert","certs":[{"name":"GOTS","sha256":"<64-hex>"}]}. Total JSON ≤4KB; any cert sha256 must be 64-hex. Any buyer can challenge.',
|
|
393
414
|
},
|
|
394
415
|
},
|
|
395
416
|
required: ['api_key'],
|
|
@@ -397,49 +418,46 @@ Actions:
|
|
|
397
418
|
},
|
|
398
419
|
{
|
|
399
420
|
name: 'webaz_place_order',
|
|
400
|
-
|
|
421
|
+
// was ~1117 chars, now ~580 chars
|
|
422
|
+
description: `Buyer places order. Buyer api_key required. Funds auto-enter protocol escrow.
|
|
401
423
|
|
|
402
|
-
|
|
403
|
-
-
|
|
404
|
-
-
|
|
405
|
-
-
|
|
406
|
-
- delivery_deadline: T+336h (7d after pickup)
|
|
407
|
-
- confirm_deadline: T+408h (72h after delivery)
|
|
424
|
+
Order deadlines (absolute ISO timestamps in response):
|
|
425
|
+
- accept T+48h | ship T+120h (72h after accept)
|
|
426
|
+
- pickup T+168h (48h after ship) | delivery T+336h (7d after pickup)
|
|
427
|
+
- confirm T+408h (72h after delivery)
|
|
408
428
|
|
|
409
|
-
Missing any
|
|
429
|
+
Missing any → auto-judge fault against responsible party + compensation per protocol.
|
|
410
430
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
──
|
|
416
|
-
中文:买家下单 — 资金进托管。订单 6 个 deadline 都是绝对时间戳,每个相对前一步的允许时长:accept 24h→ship 72h→pickup 48h→deliver 7d→confirm 72h。任何一个超时由对应责任方违约。可选:跨境关税估算 / 匿名收件 / 慈善捐赠。`,
|
|
431
|
+
Options:
|
|
432
|
+
- **B1 cross-border tax**: server auto-estimates duty (seller's est_import_duty_pct × price)
|
|
433
|
+
- **B2 privacy**: \`anonymous_recipient=true\` → PR-XXXXX alias on shipping label
|
|
434
|
+
- **B5 donation**: \`donation_pct\` 0 / 0.5 / 1 / 2 / 5% → charity_fund`,
|
|
417
435
|
inputSchema: {
|
|
418
436
|
type: 'object',
|
|
419
437
|
properties: {
|
|
420
|
-
api_key: { type: 'string', description: '
|
|
421
|
-
product_id: { type: 'string', description: '
|
|
422
|
-
quantity: { type: 'number', description: '
|
|
423
|
-
shipping_address: { type: 'string', description: '
|
|
424
|
-
notes: { type: 'string', description: '
|
|
438
|
+
api_key: { type: 'string', description: "Buyer's api_key" },
|
|
439
|
+
product_id: { type: 'string', description: 'Product ID to buy (from webaz_search)' },
|
|
440
|
+
quantity: { type: 'number', description: 'Quantity, default 1' },
|
|
441
|
+
shipping_address: { type: 'string', description: 'Shipping address' },
|
|
442
|
+
notes: { type: 'string', description: 'Note to seller (optional)' },
|
|
425
443
|
session_token: {
|
|
426
444
|
type: 'string',
|
|
427
|
-
description: '
|
|
445
|
+
description: 'Price-lock session_token (recommended): from webaz_verify_price; guarantees order price = displayed price',
|
|
428
446
|
},
|
|
429
447
|
promoter_api_key: {
|
|
430
448
|
type: 'string',
|
|
431
|
-
description:
|
|
449
|
+
description: "Referrer api_key (optional). ⚠️ Only L1 recorded (direct referrer, 70% commission); L2/L3 can't be inferred via MCP, redirects per region rule (singapore-like high max_levels → charity chain_gap; global max_levels=1 → global_fund region cap). Full 7:2:1 three-tier chain requires buyer clicking ?ref= URL from webaz_share_link (creates product_share_attribution).",
|
|
432
450
|
},
|
|
433
451
|
// B2 隐私购物
|
|
434
452
|
anonymous_recipient: {
|
|
435
453
|
type: 'boolean',
|
|
436
|
-
description: '
|
|
454
|
+
description: '[B2] Anonymous recipient: system generates PR-XXXXX alias instead of real name (seller label shows alias + address only)',
|
|
437
455
|
},
|
|
438
456
|
// B5 公益捐赠(按订单总额百分比,定额选项防机器人滥用)
|
|
439
457
|
donation_pct: {
|
|
440
458
|
type: 'number',
|
|
441
459
|
enum: [0, 0.005, 0.01, 0.02, 0.05],
|
|
442
|
-
description: '
|
|
460
|
+
description: '[B5] Per-order donation pct (0 / 0.5 / 1 / 2 / 5). Computed separately + into charity_fund, posted on order complete.',
|
|
443
461
|
},
|
|
444
462
|
},
|
|
445
463
|
required: ['api_key', 'product_id', 'shipping_address'],
|
|
@@ -447,41 +465,28 @@ Missing any deadline auto-judges fault against the responsible party and trigger
|
|
|
447
465
|
},
|
|
448
466
|
{
|
|
449
467
|
name: 'webaz_update_order',
|
|
450
|
-
|
|
468
|
+
// was ~927 chars, now ~430 chars
|
|
469
|
+
description: `STATUS TRANSITIONS on an order — NOT for editing order content (price/qty/address immutable after creation). Each role can only perform their own actions.
|
|
451
470
|
|
|
452
|
-
|
|
471
|
+
- **Seller**: accept (24h after payment) | ship (needs tracking, within handling time)
|
|
472
|
+
- **Logistics**: pickup (48h after ship) | transit | deliver (needs proof description)
|
|
473
|
+
- **Buyer**: confirm (→ fund settlement) | dispute (needs reason; freezes funds → arbitration)
|
|
453
474
|
|
|
454
|
-
|
|
455
|
-
- accept: accept order (within 24h of payment)
|
|
456
|
-
- ship: confirm dispatch (needs tracking number, within promised handling time)
|
|
457
|
-
|
|
458
|
-
Logistics actions:
|
|
459
|
-
- pickup: confirm parcel pickup (within 48h of ship)
|
|
460
|
-
- transit: update to in-transit
|
|
461
|
-
- deliver: confirm delivery (needs delivery proof description)
|
|
462
|
-
|
|
463
|
-
Buyer actions:
|
|
464
|
-
- confirm: confirm receipt → triggers fund settlement
|
|
465
|
-
- dispute: raise dispute (needs reason; freezes funds pending arbitration)
|
|
466
|
-
|
|
467
|
-
If a deadline is missed, protocol auto-marks that party as in default.
|
|
468
|
-
|
|
469
|
-
──
|
|
470
|
-
中文:更新订单状态 — 角色专属 action(卖家 accept/ship · 物流 pickup/transit/deliver · 买家 confirm/dispute)。截止超时自动判违约。`,
|
|
475
|
+
Missing deadline → protocol auto-marks party in default.`,
|
|
471
476
|
inputSchema: {
|
|
472
477
|
type: 'object',
|
|
473
478
|
properties: {
|
|
474
|
-
api_key: { type: 'string', description: '
|
|
475
|
-
order_id: { type: 'string', description: '
|
|
479
|
+
api_key: { type: 'string', description: "Operator's api_key" },
|
|
480
|
+
order_id: { type: 'string', description: 'Order ID' },
|
|
476
481
|
action: {
|
|
477
482
|
type: 'string',
|
|
478
483
|
enum: ['accept', 'ship', 'pickup', 'transit', 'deliver', 'confirm', 'dispute'],
|
|
479
|
-
description: '
|
|
484
|
+
description: 'Action to execute',
|
|
480
485
|
},
|
|
481
|
-
notes: { type: 'string', description: '
|
|
486
|
+
notes: { type: 'string', description: 'Action note (e.g. tracking number, dispute reason)' },
|
|
482
487
|
evidence_description: {
|
|
483
488
|
type: 'string',
|
|
484
|
-
description: '
|
|
489
|
+
description: 'Evidence description (recommended for ship/pickup/deliver; required for dispute)',
|
|
485
490
|
},
|
|
486
491
|
},
|
|
487
492
|
required: ['api_key', 'order_id', 'action'],
|
|
@@ -489,43 +494,37 @@ If a deadline is missed, protocol auto-marks that party as in default.
|
|
|
489
494
|
},
|
|
490
495
|
{
|
|
491
496
|
name: 'webaz_get_status',
|
|
492
|
-
|
|
493
|
-
Requires api_key of
|
|
494
|
-
Returns: current status, status history (who did what when), next responsible actor, deadline.
|
|
495
|
-
|
|
496
|
-
──
|
|
497
|
-
中文:查订单状态 + 历史 + 当前责任方 + 截止时间。任一参与方可查。`,
|
|
497
|
+
// was ~286 chars, now ~200 chars
|
|
498
|
+
description: `Query order status + full history + current responsible party + deadline. Requires api_key of order participant (buyer/seller/logistics all OK). Returns: status / status_history (who did what when) / next_actor / deadline.`,
|
|
498
499
|
inputSchema: {
|
|
499
500
|
type: 'object',
|
|
500
501
|
properties: {
|
|
501
|
-
api_key: { type: 'string', description: '
|
|
502
|
-
order_id: { type: 'string', description: '
|
|
502
|
+
api_key: { type: 'string', description: "Querier's api_key" },
|
|
503
|
+
order_id: { type: 'string', description: 'Order ID' },
|
|
503
504
|
},
|
|
504
505
|
required: ['api_key', 'order_id'],
|
|
505
506
|
},
|
|
506
507
|
},
|
|
507
508
|
{
|
|
508
509
|
name: 'webaz_wallet',
|
|
509
|
-
|
|
510
|
+
// was ~788 chars, now ~440 chars
|
|
511
|
+
description: `Wallet **READ-ONLY** query (balance / earnings / deposit/withdrawal/income history).
|
|
510
512
|
|
|
511
|
-
⚠️ Iron-Rule
|
|
513
|
+
⚠️ **Iron-Rule**: actual withdrawals / deposits / whitelist mgmt need **PWA Web + Passkey + email OTP**. This tool CANNOT move money — only query. User asks "send/withdraw/deposit WAZ"? Do NOT promise via MCP — direct to PWA Web.
|
|
512
514
|
|
|
513
515
|
Actions:
|
|
514
|
-
- view
|
|
515
|
-
- deposits
|
|
516
|
-
- withdrawals
|
|
517
|
-
- income
|
|
518
|
-
|
|
519
|
-
──
|
|
520
|
-
中文:钱包查询(余额/收益/充提历史)。仅查询用,实际充提需 PWA Web + Passkey + 邮件 OTP,agent 不可绕过。`,
|
|
516
|
+
- view (default) — balance + staked + in-escrow + earnings + reputation tier
|
|
517
|
+
- deposits — last 10 on-chain (tx_hash / amount / block)
|
|
518
|
+
- withdrawals — last 10 (status / tx_hash)
|
|
519
|
+
- income — breakdown: referral L1/L2/L3 + binary PV matching + sales net`,
|
|
521
520
|
inputSchema: {
|
|
522
521
|
type: 'object',
|
|
523
522
|
properties: {
|
|
524
|
-
api_key: { type: 'string', description: '
|
|
523
|
+
api_key: { type: 'string', description: 'Your api_key' },
|
|
525
524
|
action: {
|
|
526
525
|
type: 'string',
|
|
527
526
|
enum: ['view', 'deposits', 'withdrawals', 'income'],
|
|
528
|
-
description: '
|
|
527
|
+
description: 'Action type (default: view)',
|
|
529
528
|
},
|
|
530
529
|
},
|
|
531
530
|
required: ['api_key'],
|
|
@@ -533,248 +532,185 @@ Actions:
|
|
|
533
532
|
},
|
|
534
533
|
{
|
|
535
534
|
name: 'webaz_notifications',
|
|
536
|
-
|
|
537
|
-
Agents should poll
|
|
538
|
-
Every status change (new order / ship / dispute / etc.) notifies relevant participants.
|
|
535
|
+
// was ~608 chars, now ~330 chars
|
|
536
|
+
description: `Query user notifications (L2-6 system). Agents should poll periodically for pending order events (new order / ship / dispute → notifies relevant participants).
|
|
539
537
|
|
|
540
|
-
|
|
541
|
-
中文:查通知 — agent 定期调用检查待处理事件(新订单/发货/争议等会通知所有相关方)。`,
|
|
538
|
+
⚠️ **Scope**: only L2-6 system notifications. Does NOT include: chat unread (use webaz_chat list) | announcements | feedback replies. PWA top badge aggregates 4; this returns 1 → may be **<** PWA shows.`,
|
|
542
539
|
inputSchema: {
|
|
543
540
|
type: 'object',
|
|
544
541
|
properties: {
|
|
545
|
-
api_key: { type: 'string', description: '
|
|
546
|
-
unread: { type: 'boolean', description: '
|
|
547
|
-
mark_read: { type: 'boolean', description: '
|
|
542
|
+
api_key: { type: 'string', description: 'Your api_key' },
|
|
543
|
+
unread: { type: 'boolean', description: 'Return only unread (default false)' },
|
|
544
|
+
mark_read: { type: 'boolean', description: 'Auto-mark read after call (default false)' },
|
|
548
545
|
},
|
|
549
546
|
required: ['api_key'],
|
|
550
547
|
},
|
|
551
548
|
},
|
|
552
549
|
{
|
|
553
550
|
name: 'webaz_dispute',
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
⚠️ Different from webaz_claim_verify:
|
|
557
|
-
- webaz_dispute = order delivery problem (didn't arrive / wrong / damaged in transit / seller fraud) → central arbitrator + 120h ruling
|
|
558
|
-
- webaz_claim_verify = challenge a product CLAIM (brand / spec / ship time) → 3 crowd verifiers vote
|
|
559
|
-
Pick based on the actual problem: delivery/receiving = dispute; marketing-claim accuracy = claim_verify.
|
|
560
|
-
|
|
561
|
-
When buyer claims item-not-as-described / damaged / seller fraud, first raise dispute via webaz_update_order action=dispute,
|
|
562
|
-
then use this tool for follow-ups.
|
|
563
|
-
|
|
564
|
-
Protocol guarantees (no human intervention):
|
|
565
|
-
- Respondent has 48h to submit rebuttal evidence, else protocol auto-judges in initiator's favor
|
|
566
|
-
- Arbitrator has 120h to issue ruling, else protocol defaults to refund-buyer
|
|
567
|
-
- Once executed, ruling fund movement is instant and irreversible
|
|
551
|
+
// was ~2277 chars, now ~900 chars
|
|
552
|
+
description: `Manage ORDER-DELIVERY dispute lifecycle (L3, central arbitrator). For order delivery problems (not arrived / wrong / damaged / seller fraud). **NOT for challenging product marketing claims → use webaz_claim_verify.** Quick rule: did buyer receive item? Yes + item-itself issue → claim_verify. No / damaged-transit → dispute. Initial raise via webaz_update_order action=dispute, then this tool for follow-ups.
|
|
568
553
|
|
|
569
554
|
Actions:
|
|
570
|
-
- view
|
|
571
|
-
- list_open
|
|
572
|
-
- respond
|
|
573
|
-
- add_evidence
|
|
574
|
-
- arbitrate
|
|
555
|
+
- view dispute details (any participant)
|
|
556
|
+
- list_open pending disputes (arbitrators only)
|
|
557
|
+
- respond respondent rebuttal (before 48h deadline)
|
|
558
|
+
- add_evidence any participant supplements
|
|
559
|
+
- arbitrate ruling + fund disposition (assigned arbitrator only)
|
|
575
560
|
|
|
576
|
-
Ruling options (
|
|
577
|
-
- refund_buyer: full refund to buyer + partial stake forfeit from seller
|
|
578
|
-
- release_seller: release funds to seller (seller wins)
|
|
579
|
-
- partial_refund: partial refund (needs refund_amount); if third-party fault, set liable_party (user_id) → seller settled full, compensation deducted from liable party
|
|
580
|
-
- liability_split: distributed liability (Wave 3) — needs liability_parties: [{user_id, amount}] for proportional stake deductions
|
|
561
|
+
Ruling options: refund_buyer | release_seller | partial_refund (needs refund_amount; optional liable_party → 3rd-party fault, seller settled full + deducted from liable) | liability_split (needs liability_parties[]={user_id,amount}).
|
|
581
562
|
|
|
582
|
-
|
|
583
|
-
⚠️ Iron-Rule boundary (spec §4): arbitrate is a protocol iron-rule node requiring arbitrator to complete Passkey re-confirmation via PWA Web UI.
|
|
584
|
-
Direct agent calls return 412 HUMAN_PRESENCE_REQUIRED — DO NOT retry; instead, guide the user to the browser.
|
|
585
|
-
view / list_open / respond / add_evidence can be agent-proxied; only arbitrate needs human.
|
|
563
|
+
Protocol auto-judges (no human): respondent silent 48h → favor initiator; arbitrator silent 120h → refund_buyer. Executed rulings are instant + irreversible.
|
|
586
564
|
|
|
587
|
-
|
|
588
|
-
中文:管理争议(L3)。Actions: view / list_open / respond / add_evidence (agent 可代) · arbitrate (需 PWA + Passkey 人工)。被诉方 48h 反驳,仲裁员 120h 裁定,超时自动判。`,
|
|
565
|
+
⚠️ **Iron-Rule (spec §4)**: \`arbitrate\` needs PWA + Passkey real-human re-confirm. Direct agent call returns 412 HUMAN_PRESENCE_REQUIRED — **do NOT retry**, guide user to browser. view / list_open / respond / add_evidence are agent-proxyable.`,
|
|
589
566
|
inputSchema: {
|
|
590
567
|
type: 'object',
|
|
591
568
|
properties: {
|
|
592
|
-
api_key: { type: 'string', description: '
|
|
569
|
+
api_key: { type: 'string', description: "Operator's api_key" },
|
|
593
570
|
action: {
|
|
594
571
|
type: 'string',
|
|
595
572
|
enum: ['view', 'list_open', 'respond', 'add_evidence', 'arbitrate'],
|
|
596
|
-
description: '
|
|
573
|
+
description: 'Action to execute',
|
|
597
574
|
},
|
|
598
|
-
dispute_id: { type: 'string', description: '
|
|
599
|
-
order_id: { type: 'string', description: '
|
|
600
|
-
notes: { type: 'string', description: '
|
|
601
|
-
evidence_description: { type: 'string', description: '
|
|
575
|
+
dispute_id: { type: 'string', description: 'Dispute ID (required for respond/add_evidence/arbitrate; for view, dispute_id OR order_id)' },
|
|
576
|
+
order_id: { type: 'string', description: 'Order ID (alternative to dispute_id for view)' },
|
|
577
|
+
notes: { type: 'string', description: 'Response / rebuttal note (for respond)' },
|
|
578
|
+
evidence_description: { type: 'string', description: 'Evidence description (for respond/add_evidence)' },
|
|
602
579
|
ruling: {
|
|
603
580
|
type: 'string',
|
|
604
581
|
enum: ['refund_buyer', 'release_seller', 'partial_refund', 'liability_split'],
|
|
605
|
-
description: '
|
|
582
|
+
description: 'Ruling (required for arbitrate)',
|
|
606
583
|
},
|
|
607
|
-
refund_amount: { type: 'number', description: '
|
|
608
|
-
liable_party: { type: 'string', description: '
|
|
584
|
+
refund_amount: { type: 'number', description: 'Partial refund amount (only when ruling=partial_refund)' },
|
|
585
|
+
liable_party: { type: 'string', description: '3rd-party liable user_id (optional for partial_refund): refund deducted from this party, seller settled in full' },
|
|
609
586
|
liability_parties: {
|
|
610
587
|
type: 'array',
|
|
611
|
-
description: '
|
|
588
|
+
description: 'Liability allocation array (required for liability_split); each item { user_id, amount }',
|
|
612
589
|
items: {
|
|
613
590
|
type: 'object',
|
|
614
591
|
properties: {
|
|
615
|
-
user_id: { type: 'string', description: '
|
|
616
|
-
amount: { type: 'number', description: '
|
|
592
|
+
user_id: { type: 'string', description: 'Liable user_id' },
|
|
593
|
+
amount: { type: 'number', description: 'Amount this party owes (WAZ)' },
|
|
617
594
|
},
|
|
618
595
|
required: ['user_id', 'amount'],
|
|
619
596
|
},
|
|
620
597
|
},
|
|
621
|
-
ruling_reason: { type: 'string', description: '
|
|
598
|
+
ruling_reason: { type: 'string', description: 'Ruling reason (required for arbitrate; permanently recorded on-chain)' },
|
|
622
599
|
},
|
|
623
600
|
required: ['api_key', 'action'],
|
|
624
601
|
},
|
|
625
602
|
},
|
|
626
603
|
{
|
|
627
604
|
name: 'webaz_claim_verify',
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
⚠️ Different from webaz_dispute:
|
|
631
|
-
- webaz_claim_verify = challenge a CLAIM about the product itself ("seller said 24h ship but didn't" / "said brand new but used")
|
|
632
|
-
- webaz_dispute = order-delivery problem (didn't arrive / arrived broken / wrong item) → central arbitrator
|
|
633
|
-
If unsure: did the buyer GET the item? If yes + problem with item itself → claim_verify. If no/damaged in transit → dispute.
|
|
605
|
+
// was ~2917 chars, now ~1100 chars
|
|
606
|
+
description: `Crowd-sourced PRODUCT-CLAIM verification — challenge seller's marketing claims (brand / spec / ship time / authenticity). 3 eligible verifiers vote → consensus.
|
|
634
607
|
|
|
635
|
-
|
|
636
|
-
- Buyer: suspects a seller's product claim (e.g. "brand new sealed", "ships within 24h") → wants decentralized verification
|
|
637
|
-
- Seller: defends against an opened verification by submitting counter-evidence → extends task by 24h
|
|
638
|
-
- Verifier: browses open tasks, votes on eligible ones (pass/fail/no_fault/abstain), settles on 3rd vote
|
|
608
|
+
**vs webaz_dispute**: dispute = delivery problem (not arrived / damaged / wrong item, central arbitrator). claim_verify = item-itself / claim-accuracy ("said brand new but used", "said 24h ship but didn't"). Quick test: did buyer receive? Yes + item issue → claim_verify; No / transit damage → dispute.
|
|
639
609
|
|
|
640
610
|
Actions:
|
|
641
611
|
[Buyer]
|
|
642
|
-
- create
|
|
643
|
-
- view
|
|
644
|
-
- mine
|
|
645
|
-
|
|
612
|
+
- create open verification (locks 10 WAZ; order must be paid/delivered, NOT completed; settles on 3rd vote)
|
|
613
|
+
- view task details (visible to participants + voters + eligible verifiers)
|
|
614
|
+
- mine all my tasks (buyer/seller/verifier perspectives)
|
|
646
615
|
[Seller]
|
|
647
|
-
- submit_seller_evidence
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
-
|
|
651
|
-
- vote vote on a task (pass / fail / no_fault / abstain)
|
|
652
|
-
pass = seller's claim is true / product OK
|
|
653
|
-
fail = seller's claim is false / product mismatch
|
|
654
|
-
no_fault = neither party clearly at fault (dispute has merit but inconclusive)
|
|
655
|
-
abstain = "not my expertise, skipping" — not counted in 3-vote consensus, doesn't affect accuracy (V3 right-to-decline)
|
|
656
|
-
|
|
616
|
+
- submit_seller_evidence rebuttal → +24h extension
|
|
617
|
+
[Verifier]
|
|
618
|
+
- available list takeable tasks (eligibility: age≥60d / email verified / ≥20 completed orders / 0 arbitration losses / never suspended / wallet ≥200 WAZ / reputation ≥110)
|
|
619
|
+
- vote pass (claim true) | fail (claim false) | no_fault (inconclusive) | abstain (not my expertise — not counted, no accuracy impact)
|
|
657
620
|
[Become Verifier]
|
|
658
|
-
- eligibility
|
|
659
|
-
- verifier_status my quota / tier / stake
|
|
660
|
-
- apply apply to verifier whitelist (needs reputation + stake lock)
|
|
661
|
-
- withdraw_application withdraw application, refund stake
|
|
662
|
-
- appeal appeal a suspension (only when suspended)
|
|
621
|
+
- eligibility / verifier_status / apply (needs stake) / withdraw_application / appeal (only when suspended)
|
|
663
622
|
|
|
664
|
-
|
|
665
|
-
⚠️ Iron-Rule boundary (spec §4): vote is a protocol iron-rule node requiring verifier to complete Passkey re-confirmation via PWA Web UI.
|
|
666
|
-
Direct agent calls to vote return 412 HUMAN_PRESENCE_REQUIRED — DO NOT retry; instead, guide the user to the browser.
|
|
667
|
-
Other actions (create / view / mine / available / eligibility / apply / appeal etc.) can be agent-proxied; only vote needs human.
|
|
668
|
-
|
|
669
|
-
──
|
|
670
|
-
中文:众包索赔验证 — 3 verifier 共识投票判定。买家创建、卖家反证、verifier 投票。仅 vote 需 PWA + Passkey 人工,其他 actions agent 可代。`,
|
|
623
|
+
⚠️ **Iron-Rule (spec §4)**: \`vote\` needs PWA + Passkey real-human re-confirm. Direct agent call returns 412 HUMAN_PRESENCE_REQUIRED — **do NOT retry**, guide user to browser. All other actions agent-proxyable.`,
|
|
671
624
|
inputSchema: {
|
|
672
625
|
type: 'object',
|
|
673
626
|
properties: {
|
|
674
|
-
api_key: { type: 'string', description: '
|
|
627
|
+
api_key: { type: 'string', description: 'Your api_key' },
|
|
675
628
|
action: {
|
|
676
629
|
type: 'string',
|
|
677
630
|
enum: ['create', 'view', 'mine', 'submit_seller_evidence', 'available', 'vote', 'eligibility', 'verifier_status', 'apply', 'withdraw_application', 'appeal'],
|
|
678
|
-
description: '
|
|
631
|
+
description: 'Action to execute',
|
|
679
632
|
},
|
|
680
633
|
// create
|
|
681
|
-
order_id: { type: 'string', description: '
|
|
634
|
+
order_id: { type: 'string', description: 'Order ID (required for create). Order status must be paid/delivered (cannot create on completed)' },
|
|
682
635
|
claim_target: {
|
|
683
636
|
type: 'string',
|
|
684
637
|
enum: ['price', 'commission', 'protection', 'return', 'warranty', 'handling', 'other'],
|
|
685
|
-
description: '
|
|
638
|
+
description: 'Claim target (required for create). 7 types: price / commission / protection / return / warranty / handling / other',
|
|
686
639
|
},
|
|
687
|
-
claim_text: { type: 'string', description: '
|
|
688
|
-
evidence_uri: { type: 'string', description: '
|
|
640
|
+
claim_text: { type: 'string', description: 'Claim text 6-500 chars (required for create). Locks 10 WAZ anti-spam (refunded if no fault)' },
|
|
641
|
+
evidence_uri: { type: 'string', description: 'Evidence URI (optional for create/vote/submit_seller_evidence; buyer/verifier/seller respective evidence)' },
|
|
689
642
|
// view / vote / submit_seller_evidence
|
|
690
|
-
task_id: { type: 'string', description: '
|
|
643
|
+
task_id: { type: 'string', description: 'Task ID (required for view/vote/submit_seller_evidence)' },
|
|
691
644
|
// vote
|
|
692
|
-
vote: { type: 'string', enum: ['pass', 'fail', 'no_fault', 'abstain'], description: 'vote
|
|
693
|
-
note: { type: 'string', description: '
|
|
645
|
+
vote: { type: 'string', enum: ['pass', 'fail', 'no_fault', 'abstain'], description: 'Required for vote; abstain = not my expertise (V3 right-to-decline)' },
|
|
646
|
+
note: { type: 'string', description: 'Vote note (optional for vote, ≤500 chars)' },
|
|
694
647
|
// appeal
|
|
695
|
-
reason: { type: 'string', description: '
|
|
648
|
+
reason: { type: 'string', description: 'Appeal reason (required for appeal, ≤500 chars)' },
|
|
696
649
|
},
|
|
697
650
|
required: ['api_key', 'action'],
|
|
698
651
|
},
|
|
699
652
|
},
|
|
700
653
|
{
|
|
701
654
|
name: 'webaz_skill',
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
USE THIS when:
|
|
705
|
-
- seller wants to install reusable selling behavior (auto-accept / catalog-sync / price-haggling / etc.), OR
|
|
706
|
-
- buyer agent wants to subscribe to seller's behaviour to enable priority discovery / auto-deal flows.
|
|
655
|
+
// was ~2251 chars, now ~920 chars
|
|
656
|
+
description: `L4-4 Skill marketplace — sellers publish reusable seller-side BEHAVIOUR configs; buyer Agents subscribe one-click.
|
|
707
657
|
|
|
708
|
-
NOT a product search
|
|
709
|
-
NOT a KNOWLEDGE-content marketplace — for buying/selling templates / prompts / guides / checklists use webaz_skill_market (totally separate system, independent revenue flow).
|
|
658
|
+
**NOT** a product search (use webaz_search). **NOT** a knowledge/content market (use webaz_skill_market — totally separate, independent revenue flow).
|
|
710
659
|
|
|
711
|
-
⚠️
|
|
660
|
+
⚠️ **Skill ≠ executable code distribution**. 5 typed kinds only, each accepts **structured config params** (numbers/enums/amounts). NO path for Agent to download/run arbitrary 3rd-party code. Subscribing = flag + data binding, NOT plugin install. Web2 "plugin marketplace" risk model does NOT apply.
|
|
712
661
|
|
|
713
|
-
|
|
714
|
-
buyer agents subscribe and auto-discover those sellers' products with priority; on sale, the Skill publisher earns referral commission.
|
|
662
|
+
Cold-start mechanism: Amazon/Shopify sellers integrate zero-cost; buyer agents auto-discover subscribed sellers with priority; publisher earns referral commission on sale.
|
|
715
663
|
|
|
716
|
-
Skill types (typed,
|
|
717
|
-
- catalog_sync
|
|
718
|
-
- auto_accept
|
|
719
|
-
- price_negotiation
|
|
720
|
-
- quality_guarantee
|
|
721
|
-
- instant_ship
|
|
664
|
+
Skill types (typed, not free-form):
|
|
665
|
+
- catalog_sync sync external store → subscribers see priority
|
|
666
|
+
- auto_accept auto-accept orders (config: min/max_amount, max_daily_orders)
|
|
667
|
+
- price_negotiation agent-side haggling (config: max_discount_pct, min_quantity)
|
|
668
|
+
- quality_guarantee extra stake compensation (config: guarantee_amount, coverage_days)
|
|
669
|
+
- instant_ship guarantee 24h dispatch (config: ship_within_hours)
|
|
722
670
|
|
|
723
|
-
Actions:
|
|
724
|
-
- list browse Skill marketplace (no auth)
|
|
725
|
-
- publish publish new Skill (sellers only)
|
|
726
|
-
- subscribe subscribe to a Skill (buyer perks)
|
|
727
|
-
- unsubscribe cancel subscription
|
|
728
|
-
- my_skills my published Skills (seller view)
|
|
729
|
-
- my_subs my subscribed Skills (buyer view)
|
|
730
|
-
|
|
731
|
-
──
|
|
732
|
-
中文:Skill 市场 — 卖家发布 agent 能力插件(catalog_sync / auto_accept / price_negotiation / quality_guarantee / instant_ship),买家 agent 订阅。Actions: list / publish / subscribe / unsubscribe / my_skills / my_subs。`,
|
|
671
|
+
Actions: list (no auth) | publish (seller) | subscribe / unsubscribe (buyer) | my_skills | my_subs.`,
|
|
733
672
|
inputSchema: {
|
|
734
673
|
type: 'object',
|
|
735
674
|
properties: {
|
|
736
|
-
api_key: { type: 'string', description: '
|
|
675
|
+
api_key: { type: 'string', description: 'Your api_key (omit for list)' },
|
|
737
676
|
action: {
|
|
738
677
|
type: 'string',
|
|
739
678
|
enum: ['list', 'publish', 'subscribe', 'unsubscribe', 'my_skills', 'my_subs'],
|
|
740
|
-
description: '
|
|
679
|
+
description: 'Action to execute',
|
|
741
680
|
},
|
|
742
681
|
// list 过滤参数
|
|
743
682
|
skill_type: {
|
|
744
683
|
type: 'string',
|
|
745
684
|
enum: ['catalog_sync', 'auto_accept', 'price_negotiation', 'quality_guarantee', 'instant_ship'],
|
|
746
|
-
description: '
|
|
685
|
+
description: 'Filter Skill type (optional for list)',
|
|
747
686
|
},
|
|
748
|
-
query: { type: 'string', description: '
|
|
687
|
+
query: { type: 'string', description: 'Keyword search (optional for list)' },
|
|
749
688
|
// publish 参数
|
|
750
|
-
name: { type: 'string', description: 'Skill
|
|
751
|
-
description: { type: 'string', description: 'Skill
|
|
752
|
-
category: { type: 'string', description: '
|
|
689
|
+
name: { type: 'string', description: 'Skill name (required for publish)' },
|
|
690
|
+
description: { type: 'string', description: 'Skill description (required for publish)' },
|
|
691
|
+
category: { type: 'string', description: 'Category (optional for publish)' },
|
|
753
692
|
config: {
|
|
754
693
|
type: 'object',
|
|
755
|
-
description: 'Skill
|
|
694
|
+
description: 'Skill config (optional for publish; e.g. auto_accept needs max_daily_orders)',
|
|
756
695
|
},
|
|
757
696
|
// subscribe 参数
|
|
758
|
-
skill_id: { type: 'string', description: 'Skill ID
|
|
697
|
+
skill_id: { type: 'string', description: 'Skill ID (required for subscribe/unsubscribe)' },
|
|
759
698
|
},
|
|
760
699
|
required: ['action'],
|
|
761
700
|
},
|
|
762
701
|
},
|
|
763
702
|
{
|
|
764
703
|
name: 'webaz_mykey',
|
|
765
|
-
|
|
704
|
+
// was ~909 chars, now ~480 chars
|
|
705
|
+
description: `Account RECOVERY check — confirm account existence by handle + 6-char permanent_code (from registration). Returns redacted api_key_hint only.
|
|
766
706
|
|
|
767
|
-
|
|
707
|
+
⚠️ **Iron-Rule**: full api_key disclosure requires **PWA + Passkey** verification — this MCP tool only returns hint + PWA URL, never full key.
|
|
768
708
|
|
|
769
|
-
|
|
709
|
+
USE THIS ONLY when user lost api_key + has handle + permanent_code. NOT for "show my api_key" (use the one you have). NOT for looking up others (use webaz_profile).
|
|
770
710
|
|
|
771
|
-
|
|
772
|
-
- found: boolean
|
|
773
|
-
- api_key_hint (e.g. "key_7d3d***faa7b") — confirms which account, never the full key
|
|
774
|
-
- full_api_key_recovery — instructions to use PWA for the real recovery
|
|
711
|
+
Rate-limited: 5/handle/hour; excessive → 1h lock.
|
|
775
712
|
|
|
776
|
-
|
|
777
|
-
中文:handle + permanent_code 双因素确认账户存在,仅返回 redact 过的 api_key_hint。完整 api_key 必须经 PWA + Passkey 二次验证(Iron-Rule)。同 handle 每小时最多 5 次。`,
|
|
713
|
+
Returns: found / api_key_hint (e.g. "key_7d3d***faa7b") / full_api_key_recovery URL.`,
|
|
778
714
|
inputSchema: {
|
|
779
715
|
type: 'object',
|
|
780
716
|
properties: {
|
|
@@ -786,44 +722,36 @@ Returns:
|
|
|
786
722
|
},
|
|
787
723
|
{
|
|
788
724
|
name: 'webaz_profile',
|
|
789
|
-
|
|
725
|
+
// was ~1076 chars, now ~570 chars
|
|
726
|
+
description: `View own profile / manage roles, AND view any user's public profile + content streams.
|
|
790
727
|
|
|
791
|
-
USE THIS
|
|
792
|
-
OR wants to see someone's listings / notes / activity stream. NOT for product keyword search — use webaz_search.
|
|
728
|
+
USE THIS for info about a SPECIFIC PERSON (by usr_xxx / permanent code / @handle / name), OR to see someone's listings / notes / activity stream. NOT for product keyword search — use webaz_search.
|
|
793
729
|
|
|
794
730
|
Self actions (need api_key):
|
|
795
|
-
- view
|
|
796
|
-
- add_role add a new role
|
|
797
|
-
- switch_role switch active role (one account can hold multiple roles)
|
|
731
|
+
- view (profile + wallet + api_key hint) | add_role | switch_role
|
|
798
732
|
|
|
799
733
|
Public-profile actions:
|
|
800
|
-
- view_user
|
|
801
|
-
- feed
|
|
802
|
-
secondhand | auctions | reviews | products | shares | reputation | pv | liked
|
|
803
|
-
(secondhand/auctions/reviews/products/shares/reputation are public;
|
|
804
|
-
pv needs api_key; liked is owner-only and needs your own api_key)
|
|
805
|
-
|
|
806
|
-
──
|
|
807
|
-
中文:看自己资料/管角色,也能看他人公开主页 + 内容流(二手/拍卖/测评/商品/笔记/信誉/PV/点赞)。Actions: view / add_role / switch_role / view_user / feed。`,
|
|
734
|
+
- view_user (user_id = usr_xxx / permanent_code / @handle; needs api_key)
|
|
735
|
+
- feed (user_id + feed): secondhand | auctions | reviews | products | shares | reputation (public) | pv (needs api_key) | liked (owner-only, needs your api_key)`,
|
|
808
736
|
inputSchema: {
|
|
809
737
|
type: 'object',
|
|
810
738
|
properties: {
|
|
811
|
-
api_key: { type: 'string', description: 'Your api_key
|
|
739
|
+
api_key: { type: 'string', description: 'Your api_key (required for view/add_role/switch_role/view_user; optional for public feed)' },
|
|
812
740
|
action: {
|
|
813
741
|
type: 'string',
|
|
814
742
|
enum: ['view', 'add_role', 'switch_role', 'view_user', 'feed'],
|
|
815
|
-
description: 'view/add_role/switch_role =
|
|
743
|
+
description: 'view/add_role/switch_role = self; view_user/feed = other user profile/feed',
|
|
816
744
|
},
|
|
817
745
|
role: {
|
|
818
746
|
type: 'string',
|
|
819
747
|
enum: ['buyer', 'seller', 'logistics', 'arbitrator'],
|
|
820
748
|
description: 'Role to add or switch to (required for add_role / switch_role)',
|
|
821
749
|
},
|
|
822
|
-
user_id: { type: 'string', description: '
|
|
750
|
+
user_id: { type: 'string', description: 'Target user: usr_xxx / permanent_code / @handle (required for view_user/feed)' },
|
|
823
751
|
feed: {
|
|
824
752
|
type: 'string',
|
|
825
753
|
enum: ['secondhand', 'auctions', 'reviews', 'products', 'shares', 'reputation', 'pv', 'liked'],
|
|
826
|
-
description: '
|
|
754
|
+
description: 'Feed type (required for feed)',
|
|
827
755
|
},
|
|
828
756
|
},
|
|
829
757
|
required: ['action'],
|
|
@@ -831,18 +759,14 @@ Public-profile actions:
|
|
|
831
759
|
},
|
|
832
760
|
{
|
|
833
761
|
name: 'webaz_revoke_key',
|
|
834
|
-
|
|
762
|
+
// was ~778 chars, now ~430 chars
|
|
763
|
+
description: `Initiate api_key revocation (**NO REPLACEMENT** — old key dies, no new issued).
|
|
835
764
|
|
|
836
|
-
⚠️
|
|
765
|
+
⚠️ **Iron-Rule**: actual revocation needs **PWA + Passkey** confirm. MCP only registers intent + returns PWA URL.
|
|
837
766
|
|
|
838
|
-
|
|
839
|
-
- You are PERMANENTLY decommissioning this agent / device, OR
|
|
840
|
-
- You want all access to die NOW with no fallback
|
|
767
|
+
⚠️ **STRONG REC**: use \`webaz_rotate_key\` instead unless you want zero replacement. Rotate = atomic swap (no access gap). Revoke = death + re-register.
|
|
841
768
|
|
|
842
|
-
After PWA
|
|
843
|
-
|
|
844
|
-
──
|
|
845
|
-
中文:发起 api_key 吊销。Iron-Rule:真正吊销必须 PWA + Passkey 二次确认(agent 不能单方面执行不可逆操作)。MCP 仅登记意图,返回 PWA 确认 URL。`,
|
|
769
|
+
Use revoke when: PERMANENT decommission of agent/device, OR want access death NOW with no fallback. After PWA confirm: old key → 401 on all tools.`,
|
|
846
770
|
inputSchema: {
|
|
847
771
|
type: 'object',
|
|
848
772
|
properties: {
|
|
@@ -854,12 +778,10 @@ After PWA confirmation, the old api_key returns 401 on all tools.
|
|
|
854
778
|
},
|
|
855
779
|
{
|
|
856
780
|
name: 'webaz_rotate_key',
|
|
857
|
-
|
|
781
|
+
// was ~372 chars, now ~260 chars
|
|
782
|
+
description: `Initiate api_key rotation (invalidate old + issue new). ⚠️ **Iron-Rule**: needs **PWA + Passkey** confirm. After PWA: old → 401; new shown ONCE — store immediately.
|
|
858
783
|
|
|
859
|
-
Safer than webaz_revoke_key
|
|
860
|
-
|
|
861
|
-
──
|
|
862
|
-
中文:发起 api_key 轮换(旧 key 失效 + 新 key 同时签发)。比 revoke 安全,原子操作无访问中断。需 PWA + Passkey。`,
|
|
784
|
+
Safer than \`webaz_revoke_key\` — atomic swap, no access gap.`,
|
|
863
785
|
inputSchema: {
|
|
864
786
|
type: 'object',
|
|
865
787
|
properties: {
|
|
@@ -871,9 +793,11 @@ Safer than webaz_revoke_key because issuance is atomic with invalidation — no
|
|
|
871
793
|
},
|
|
872
794
|
{
|
|
873
795
|
name: 'webaz_referral',
|
|
874
|
-
description: `View your
|
|
796
|
+
description: `View your referral status: 3-tier commission (推土机) team + earnings + invite links + binary PV matching (原子能) tree + tier progress + L1 share permission gate + **rewards_status (RFC-002 §3.5 opt-in state + pending escrow)**.
|
|
875
797
|
|
|
876
|
-
⚠️
|
|
798
|
+
⚠️ **Opt-in required (RFC-002)**: rewards default = off. \`rewards_status\` field returns 4-state {opted_in | never_activated | auto_downgraded | deactivated} + pending_escrow tally. Opted-out users still see attribution + tree, but commission held in escrow until activation via PWA #me.
|
|
799
|
+
|
|
800
|
+
⚠️ **MLM disclosure**: structure may overlap with MLM legal definitions (see webaz_info.commission_model.compliance_notice). Agent acting for human user **MUST get explicit consent** before generating referral links / promoting. Do NOT auto-recruit.`,
|
|
877
801
|
inputSchema: {
|
|
878
802
|
type: 'object',
|
|
879
803
|
properties: {
|
|
@@ -884,9 +808,11 @@ Safer than webaz_revoke_key because issuance is atomic with invalidation — no
|
|
|
884
808
|
},
|
|
885
809
|
{
|
|
886
810
|
name: 'webaz_share_link',
|
|
887
|
-
description: `Generate
|
|
811
|
+
description: `Generate product share link with your referral attached. Open in any social platform (TikTok/WeChat/Telegram). Clicker registers/buys → counts toward your 3-tier commission (if verified buyer) + PV tree.
|
|
812
|
+
|
|
813
|
+
⚠️ **Opt-in required (RFC-002 §3.5)**: this is a valuation-layer action. Caller must have \`rewards_opted_in=1\` (builder-identity opt-in). Opted-out users get \`{error: 'rewards_opt_in_required', missing_requirements, next_steps}\` — direct user to PWA #me to apply.
|
|
888
814
|
|
|
889
|
-
⚠️
|
|
815
|
+
⚠️ **MLM disclosure**: builds referral chain (multi-tier commission + binary pairing). Agent acting for human user **MUST get explicit consent**. Do NOT auto-generate. See webaz_info.commission_model.compliance_notice.`,
|
|
890
816
|
inputSchema: {
|
|
891
817
|
type: 'object',
|
|
892
818
|
properties: {
|
|
@@ -903,17 +829,12 @@ Safer than webaz_revoke_key because issuance is atomic with invalidation — no
|
|
|
903
829
|
},
|
|
904
830
|
{
|
|
905
831
|
name: 'webaz_blocklist',
|
|
906
|
-
|
|
832
|
+
// was ~607 chars, now ~370 chars
|
|
833
|
+
description: `Manage blocklist of sellers/users. Blocked → auto-hidden from your search + can't follow them.
|
|
907
834
|
|
|
908
|
-
Scope (元规则 #5 不偏袒
|
|
909
|
-
- ✓ Hides blocked user's products from YOUR search results
|
|
910
|
-
- ✓ Prevents YOU from following them (webaz_follows respects this)
|
|
911
|
-
- ✗ Does NOT prevent placing orders on their products (商品发布即承诺销售 — public listing = sales commitment)
|
|
912
|
-
- ✗ Does NOT silence existing chat conversations (business context overrides)
|
|
913
|
-
- ✗ Does NOT prevent NEW chat starts on shared order/rfq context
|
|
914
|
-
- For active rejection: delist products, don't bid on RFQs, or cancel the order.
|
|
835
|
+
⚠️ **Scope** (元规则 #5 不偏袒): ✓ hides from YOUR search ✓ prevents follow. ✗ Does NOT prevent placing orders on their products (商品发布即承诺销售) ✗ Does NOT silence existing chat (business context wins) ✗ Does NOT prevent new chat on shared order/rfq context. For active rejection: delist / don't bid / cancel order.
|
|
915
836
|
|
|
916
|
-
|
|
837
|
+
Actions: list | block | unblock.`,
|
|
917
838
|
inputSchema: {
|
|
918
839
|
type: 'object',
|
|
919
840
|
properties: {
|
|
@@ -940,11 +861,12 @@ Returns the action result.`,
|
|
|
940
861
|
},
|
|
941
862
|
{
|
|
942
863
|
name: 'webaz_nearby',
|
|
943
|
-
|
|
864
|
+
// was ~831 chars, now ~430 chars
|
|
865
|
+
description: `Query anonymized nearby (~11km cell) purchase aggregation. **k-anonymity ≥3** privacy guard. Set/clear your coarse geo (0.1° precision, never exact GPS).
|
|
866
|
+
|
|
867
|
+
USE THIS for "what's popular near me / 我附近 / 同城" — geo-aggregated, no keyword. NOT for "find product X" (use webaz_search). NOT for "shippable to me" (use webaz_search ship_to).
|
|
944
868
|
|
|
945
|
-
|
|
946
|
-
view, no specific keyword. NOT for "find product X" — use webaz_search. NOT for "items shippable
|
|
947
|
-
to my address" — use webaz_search ship_to filter.`,
|
|
869
|
+
⚠️ MCP \`query\` needs \`set_location\` first (else \`has_location: false\`). PWA #nearby has 4-tier fallback (national / city / around / 14km) — designed difference: MCP demands location, PWA degrades.`,
|
|
948
870
|
inputSchema: {
|
|
949
871
|
type: 'object',
|
|
950
872
|
properties: {
|
|
@@ -958,13 +880,10 @@ to my address" — use webaz_search ship_to filter.`,
|
|
|
958
880
|
},
|
|
959
881
|
{
|
|
960
882
|
name: 'webaz_default_address',
|
|
961
|
-
|
|
883
|
+
// was ~370 chars, now ~230 chars
|
|
884
|
+
description: `Read or set default shipping address. Used by webaz_search unshippable filter + fallback for webaz_rfq/place_order if omitted.
|
|
962
885
|
|
|
963
|
-
⚠️ set
|
|
964
|
-
不接受 structured 字段(recipient/line1/city/country/phone 等)— 跟传统电商地址 API 不同,agent 必须自己拼接。
|
|
965
|
-
|
|
966
|
-
──
|
|
967
|
-
中文:读取/设置默认收货地址。set 需要 text 必填 + region 可选;不收 structured 字段。`,
|
|
886
|
+
⚠️ \`set\` accepts only 2 fields: \`text\` (free-text address, ≤200 chars, required) + \`region\` (optional, for unshippable filter, ≤40 chars). NO structured fields (no recipient/line1/city/country/phone) — agent must concat itself.`,
|
|
968
887
|
inputSchema: {
|
|
969
888
|
type: 'object',
|
|
970
889
|
properties: {
|
|
@@ -978,16 +897,14 @@ to my address" — use webaz_search ship_to filter.`,
|
|
|
978
897
|
},
|
|
979
898
|
{
|
|
980
899
|
name: 'webaz_shareables',
|
|
981
|
-
|
|
900
|
+
// was ~843 chars, now ~480 chars
|
|
901
|
+
description: `Bind your **EXISTING external content** (YouTube / TikTok / 小红书 / B站 / IG / Twitter) to a WebAZ product/anchor — turns your content into referral-earning channel. WebAZ indexes only URL, never content bytes.
|
|
982
902
|
|
|
983
|
-
USE THIS when:
|
|
984
|
-
- creator/user wants to "anchor" their existing review/unboxing/recommendation video/post to a WebAZ product (or anchor) so future buyers clicking that content → registration / purchase counts toward THEIR referral commission, OR
|
|
985
|
-
- agent wants to look up "what external content is associated with this product / this anchor"
|
|
903
|
+
USE THIS when: creator anchors existing review/unboxing post → future buyers click → counts toward THEIR referral commission. OR agent looks up "what external content for this product/anchor".
|
|
986
904
|
|
|
987
|
-
|
|
905
|
+
⚠️ Different from \`webaz_share_link\` (generates NEW short link) — shareables register EXISTING content as discovery surface.
|
|
988
906
|
|
|
989
|
-
|
|
990
|
-
中文:把你在 YouTube/TikTok/小红书/B站/IG/Twitter 已发的内容(测评/开箱/推荐)锚定到 WebAZ 商品 —— 让你的外部内容变成赚 referral 佣金的入口。WebAZ 只锚 URL,不取内容。区别于 webaz_share_link(那个是生成新短链)。`,
|
|
907
|
+
Actions: list_mine | add (external_url + product/anchor) | delete | by_product | by_anchor.`,
|
|
991
908
|
inputSchema: {
|
|
992
909
|
type: 'object',
|
|
993
910
|
properties: {
|
|
@@ -1006,76 +923,63 @@ Differs from webaz_share_link (which generates a NEW short link for sharing) —
|
|
|
1006
923
|
// ── P3 RFQ / bid / chat / auto_bid(MCP 通过 HTTP 调 PWA,复用所有校验+状态机)────
|
|
1007
924
|
{
|
|
1008
925
|
name: 'webaz_rfq',
|
|
1009
|
-
|
|
926
|
+
// was ~1822 chars, now ~880 chars
|
|
927
|
+
description: `RFQ (Request-for-Quotation) — buyer posts demand, sellers bid within time window.
|
|
1010
928
|
|
|
1011
|
-
USE THIS when buyer wants
|
|
1012
|
-
webaz_search returned no good match, OR the buyer wants competing quotes (bulk / custom / unusual
|
|
1013
|
-
spec / time-sensitive). NOT a search tool. For browsing existing listings use webaz_search.
|
|
929
|
+
USE THIS when buyer POSTS a need (no good search match / bulk / custom / time-sensitive / wants competing quotes). NOT a search tool — for browsing use webaz_search. For AUCTION (English forward on a listed item) use webaz_auction.
|
|
1014
930
|
|
|
1015
931
|
Actions:
|
|
1016
|
-
- create (buyer)
|
|
1017
|
-
- mine (buyer)
|
|
1018
|
-
- browse (seller)
|
|
1019
|
-
- detail
|
|
1020
|
-
- award (buyer)
|
|
1021
|
-
- cancel (buyer)
|
|
932
|
+
- create (buyer) publish RFQ (title/qty/max_price/category/urgency/award_mode)
|
|
933
|
+
- mine (buyer) my RFQ list
|
|
934
|
+
- browse (seller) board view (filter by region/category/urgency/unbidded)
|
|
935
|
+
- detail full detail (buyer sees all bids; seller sees only own)
|
|
936
|
+
- award (buyer) pick winner (bid_id for manual; omit = auto-lowest)
|
|
937
|
+
- cancel (buyer) only pre-award; 30% deposit forfeit to charity_fund
|
|
1022
938
|
|
|
1023
939
|
Economics:
|
|
1024
|
-
- Buyer deposit = clamp(0.1, 1) of
|
|
1025
|
-
-
|
|
1026
|
-
-
|
|
1027
|
-
-
|
|
1028
|
-
- Award winner → standard order lifecycle, BUT with snapshot_commission_rate = 0 (RFQ orders 0% commission — direct deal between buyer/seller, no promoter chain to compensate). Seller gets price minus protocol_fee (2%) and fund_base (1%); no L1/L2/L3 dilution.
|
|
1029
|
-
- Seller bid stake (4.5+ WAZ) becomes bid_stake_held on the order; released to seller balance on successful complete; 50/50 split to buyer+sys_protocol on fault_seller (settleFault).
|
|
1030
|
-
- Window defaults: now=15min / today=60min / flex=1440min(24h)
|
|
1031
|
-
|
|
1032
|
-
Shipping address: if omitted, falls back to webaz_default_address (set via that tool first).
|
|
940
|
+
- Buyer deposit = clamp(0.1, 1) of max_price × qty × 1% (anti-spam). No-max-price = 0.1 WAZ flat.
|
|
941
|
+
- Seller bid stake = max(0.5, price × qty × 5%). Becomes bid_stake_held on award; released on complete; 50/50 split (buyer + sys_protocol) on fault_seller.
|
|
942
|
+
- Award → standard order lifecycle BUT **snapshot_commission_rate = 0** (RFQ 0% commission, no L1/L2/L3 promoter dilution); seller gets price − protocol_fee 2% − fund_base 1%.
|
|
943
|
+
- Window defaults: now=15min / today=60min / flex=24h.
|
|
1033
944
|
|
|
1034
|
-
|
|
1035
|
-
中文:求购单 RFQ。买家押金 1%(封顶 1 WAZ,仅防 spam);卖家 bid stake 5%(最少 0.5 WAZ);撤单扣 30% 入慈善池。`,
|
|
945
|
+
Shipping address falls back to webaz_default_address if omitted.`,
|
|
1036
946
|
inputSchema: {
|
|
1037
947
|
type: 'object',
|
|
1038
948
|
properties: {
|
|
1039
|
-
api_key: { type: 'string', description: '
|
|
949
|
+
api_key: { type: 'string', description: 'Your api_key' },
|
|
1040
950
|
action: { type: 'string', enum: ['create', 'mine', 'browse', 'detail', 'award', 'cancel'] },
|
|
1041
951
|
// create
|
|
1042
952
|
title: { type: 'string' },
|
|
1043
953
|
qty: { type: 'number' },
|
|
1044
|
-
max_price: { type: 'number', description: 'WAZ
|
|
954
|
+
max_price: { type: 'number', description: 'Max budget in WAZ (optional; if omitted, buyer deposit = 1 WAZ)' },
|
|
1045
955
|
category: { type: 'string', enum: ['standard', 'general', 'highvalue', 'restricted'] },
|
|
1046
956
|
urgency: { type: 'string', enum: ['now', 'today', 'flex'] },
|
|
1047
957
|
award_mode: { type: 'string', enum: ['manual', 'first_match', 'time_window'] },
|
|
1048
958
|
award_window_min: { type: 'number' },
|
|
1049
959
|
notes: { type: 'string' },
|
|
1050
|
-
shipping_address: { type: 'string', description: '
|
|
960
|
+
shipping_address: { type: 'string', description: 'Optional; falls back to buyer default address' },
|
|
1051
961
|
// browse filters
|
|
1052
962
|
region: { type: 'string' },
|
|
1053
963
|
unbidded: { type: 'boolean' },
|
|
1054
964
|
// detail/award/cancel
|
|
1055
965
|
rfq_id: { type: 'string' },
|
|
1056
|
-
bid_id: { type: 'string', description: 'award
|
|
966
|
+
bid_id: { type: 'string', description: 'Optional for award — if omitted, auto-pick current lowest bid' },
|
|
1057
967
|
},
|
|
1058
968
|
required: ['api_key', 'action'],
|
|
1059
969
|
},
|
|
1060
970
|
},
|
|
1061
971
|
{
|
|
1062
972
|
name: 'webaz_bid',
|
|
973
|
+
// was ~733 chars, now ~400 chars
|
|
1063
974
|
description: `Bid on RFQs (seller-side, Request-for-Quotation).
|
|
1064
975
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
Actions:
|
|
1068
|
-
- submit: new bid; needs rfq_id + price + qty_offered + fulfillment_type; optional eta_hours/note
|
|
1069
|
-
- patch: edit price/ETA/fulfillment/note (only active; stake delta auto-settled)
|
|
1070
|
-
- cancel: withdraw (only active; deposit released immediately)
|
|
1071
|
-
- list_mine: full bid history
|
|
976
|
+
⚠️ **ONLY for RFQ bidding** (buyer posted demand via webaz_rfq). For AUCTION (English forward on listed item) use \`webaz_auction action=bid\` — separate systems with different economics (RFQ = bid stake; auction = min_increment + sniper extension).
|
|
1072
977
|
|
|
1073
|
-
|
|
1074
|
-
中文:对 RFQ 报价(卖家)。Actions: submit / patch / cancel / list_mine。改价时 stake 自动结算差额。`,
|
|
978
|
+
Actions: submit (rfq_id + price + qty_offered + fulfillment_type; optional eta/note) | patch (active only, stake delta auto-settled) | cancel (active only, deposit released immediately) | list_mine.`,
|
|
1075
979
|
inputSchema: {
|
|
1076
980
|
type: 'object',
|
|
1077
981
|
properties: {
|
|
1078
|
-
api_key: { type: 'string', description: '
|
|
982
|
+
api_key: { type: 'string', description: 'Seller api_key' },
|
|
1079
983
|
action: { type: 'string', enum: ['submit', 'patch', 'cancel', 'list_mine'] },
|
|
1080
984
|
rfq_id: { type: 'string' },
|
|
1081
985
|
bid_id: { type: 'string' },
|
|
@@ -1084,42 +988,25 @@ Actions:
|
|
|
1084
988
|
eta_hours: { type: 'number' },
|
|
1085
989
|
fulfillment_type: { type: 'string', enum: ['instant_pickup', 'same_day', 'next_day', 'standard'] },
|
|
1086
990
|
note: { type: 'string' },
|
|
1087
|
-
offer_id: { type: 'string', description: '
|
|
991
|
+
offer_id: { type: 'string', description: 'Optional; reference existing offer' },
|
|
1088
992
|
},
|
|
1089
993
|
required: ['api_key', 'action'],
|
|
1090
994
|
},
|
|
1091
995
|
},
|
|
1092
996
|
{
|
|
1093
997
|
name: 'webaz_chat',
|
|
1094
|
-
|
|
998
|
+
// was ~1963 chars, now ~860 chars
|
|
999
|
+
description: `Relay buyer↔seller (or RFQ partner) MESSAGES — **context-bound DM**, NO open DM. Only \`order\` / \`rfq\` / \`listing_qa\` contexts.
|
|
1095
1000
|
|
|
1096
|
-
USE THIS
|
|
1097
|
-
Actions:
|
|
1098
|
-
- start: open conversation — needs kind + context_id (for rfq, also recipient_id)
|
|
1099
|
-
- list: my conversation list
|
|
1100
|
-
- read: read messages (last 50; flag_reasons is array)
|
|
1101
|
-
- send: send message (anti-scam regex; matches get flagged=true but still delivered; flag_reasons is array)
|
|
1102
|
-
- mark_read: mark as read
|
|
1103
|
-
- block: block this specific conversation (sets conv.status=blocked; ≠ webaz_blocklist which hides from search)
|
|
1001
|
+
USE THIS for trade communication ("ask seller about return", "tell buyer about delay", "answer listing Q&A"). NOT general LLM chat — every message attaches to context. User chatting with agent? Don't call this.
|
|
1104
1002
|
|
|
1105
|
-
|
|
1106
|
-
phone_cn (CN mobile 11-digit), wechat (微信/vx/wechat/weixin), alipay (支付宝/alipay),
|
|
1107
|
-
qq (qq:digits), bank_card (16-19 consecutive digits), telegram (@handle/t.me/telegram),
|
|
1108
|
-
external_url (any http(s) URL except localhost/webaz.app/webaz.io).
|
|
1003
|
+
Actions: start (kind + context_id; rfq needs recipient_id) | list | read (last 50, flag_reasons array) | send (anti-scam regex; matches flagged=true but still delivered) | mark_read | block (this conv only; ≠ webaz_blocklist which hides from search).
|
|
1109
1004
|
|
|
1110
|
-
|
|
1111
|
-
- Short-term: 60 messages / minute / user
|
|
1112
|
-
- AGENT_DAILY_CAP (reset at UTC midnight): new=30, trusted=100, quality=300, legend=1000
|
|
1113
|
-
(returns 429 + error_code=AGENT_DAILY_CAP + cap + used + level fields)
|
|
1114
|
-
3 overruns/day → auto agent warning strike.
|
|
1005
|
+
⚠️ **Anti-scam regex** (in flag_reasons[]): phone_cn (11-digit) / wechat (微信/vx/wechat) / alipay / qq / bank_card (16-19 digits) / telegram (@/t.me) / external_url (non-webaz HTTPS).
|
|
1115
1006
|
|
|
1116
|
-
|
|
1117
|
-
silences the specific conv. Existing conversations are NOT auto-silenced by webaz_blocklist
|
|
1118
|
-
(business context overrides — block prevents future ad-hoc contact but keeps active deal channels open).
|
|
1007
|
+
Rate limits: 60/min/user short-term + AGENT_DAILY_CAP (UTC reset): new=30 / trusted=100 / quality=300 / legend=1000 (over → 429 + error_code=AGENT_DAILY_CAP). 3 overruns/day → auto warning strike.
|
|
1119
1008
|
|
|
1120
|
-
|
|
1121
|
-
中文:上下文私聊 — 仅 order/rfq/listing_qa 三种场景可发起,无自由 DM。Actions: start / list / read / send / mark_read / block。
|
|
1122
|
-
反诈 regex 7 类 + 60/min rate limit。blocklist 不影响已建立 conversation(商业上下文优先)。`,
|
|
1009
|
+
webaz_blocklist hides from search but does NOT auto-silence existing convs (business context wins) — use this tool's \`block\` for per-conv silence.`,
|
|
1123
1010
|
inputSchema: {
|
|
1124
1011
|
type: 'object',
|
|
1125
1012
|
properties: {
|
|
@@ -1129,60 +1016,45 @@ silences the specific conv. Existing conversations are NOT auto-silenced by weba
|
|
|
1129
1016
|
context_id: { type: 'string' },
|
|
1130
1017
|
recipient_id: { type: 'string' },
|
|
1131
1018
|
conversation_id: { type: 'string' },
|
|
1132
|
-
body: { type: 'string', description: 'send action
|
|
1019
|
+
body: { type: 'string', description: 'Message body for send action (≤2000 chars)' },
|
|
1133
1020
|
},
|
|
1134
1021
|
required: ['api_key', 'action'],
|
|
1135
1022
|
},
|
|
1136
1023
|
},
|
|
1137
1024
|
{
|
|
1138
1025
|
name: 'webaz_price_history',
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
- windows: { d30, d90, lifetime } each {sales, volume, avg, median, p25, p75}
|
|
1142
|
-
- price_buckets: distribution array [{price, count, qty, pct}]
|
|
1143
|
-
- daily_avg: 30-day daily avg price trend [{date, sales, avg}]
|
|
1144
|
-
- category_avg_30d: same-category 30-day average
|
|
1145
|
-
- anomaly_flags: ('current_below_70pct_median' / 'far_below_category_avg' / 'far_above_category_avg')
|
|
1146
|
-
Returns insufficient_data:true when data sparse.
|
|
1026
|
+
// was ~571 chars, now ~350 chars
|
|
1027
|
+
description: `Product historical sale price + volume — helps agents avoid bottom-price dumping bait.
|
|
1147
1028
|
|
|
1148
|
-
|
|
1149
|
-
中文:商品历史成交价 + 量分布 — 防底价倾销。返回多时窗统计 + 价位分布 + 同类均价 + 异常预警。`,
|
|
1029
|
+
Returns: windows {d30, d90, lifetime} each {sales, volume, avg, median, p25, p75} | price_buckets [{price, count, qty, pct}] | daily_avg (30-day trend) | category_avg_30d | anomaly_flags (current_below_70pct_median / far_below_category_avg / far_above_category_avg). \`insufficient_data: true\` if sparse.`,
|
|
1150
1030
|
inputSchema: {
|
|
1151
1031
|
type: 'object',
|
|
1152
1032
|
properties: {
|
|
1153
|
-
product_id: { type: 'string', description: '
|
|
1033
|
+
product_id: { type: 'string', description: 'Product ID' },
|
|
1154
1034
|
},
|
|
1155
1035
|
required: ['product_id'],
|
|
1156
1036
|
},
|
|
1157
1037
|
},
|
|
1158
1038
|
{
|
|
1159
1039
|
name: 'webaz_charity',
|
|
1160
|
-
|
|
1040
|
+
// was ~1856 chars, now ~850 chars
|
|
1041
|
+
description: `Charity wish pool + repayment + community fund — double-anonymous + dual-signed anchoring + isolated prestige.
|
|
1161
1042
|
|
|
1162
|
-
USE THIS
|
|
1163
|
-
- user wants to publish a "wish" (need help with money/service) for community fulfillment, OR
|
|
1164
|
-
- user wants to claim/fulfill someone else's wish, OR
|
|
1165
|
-
- user wants to donate to / browse the community charity fund (separate from per-order donation).
|
|
1043
|
+
USE THIS for: publishing wish (need help) | claiming/fulfilling others' wishes | donating to / browsing community fund.
|
|
1166
1044
|
|
|
1167
|
-
NOT for per-order charity donation — that's
|
|
1168
|
-
Actions:
|
|
1169
|
-
- list: browse public wishes (filter by category/target_kind; anonymous accessible)
|
|
1170
|
-
- detail: single wish details (commit_hash + fulfillment + repayments)
|
|
1171
|
-
- create: (auth) publish a wish
|
|
1172
|
-
- claim: (auth) fulfiller claims (1:1 exclusive; 30-day self-claim lock; auto-release if no proof in 48h)
|
|
1173
|
-
- proof: (auth) submit completion evidence
|
|
1174
|
-
- confirm: (auth) wisher confirms → fulfiller +10 prestige
|
|
1175
|
-
- disclose: (auth) apply for public disclosure (both parties must agree)
|
|
1176
|
-
- cancel: (auth) wisher cancels (only open wishes)
|
|
1177
|
-
- me: (auth) my charity profile (prestige breakdown + pending repayment queue)
|
|
1178
|
-
- stories / leaderboard: public
|
|
1179
|
-
- repay: (auth) wisher initiates repayment (≥ 0.1 WAZ; auto-accepted if no response in 7d)
|
|
1180
|
-
- repay_respond:(auth) fulfiller responds (accept | decline_to_fund) — decline → funds go to community fund, wisher +8 / fulfiller +2 grace
|
|
1181
|
-
- donate: (auth) donate to community fund (≥ 0.1 WAZ; daily 50 WAZ matched 1:1 → donation_honor)
|
|
1182
|
-
- fund: fund balance + ledger + philanthropist leaderboard (public)
|
|
1045
|
+
**NOT** for per-order charity donation — that's webaz_place_order's \`donation_pct\` (0.5/1/2/5% to charity_fund at order time). This tool is the **standalone wish-fulfillment economy**.
|
|
1183
1046
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1047
|
+
Actions (15):
|
|
1048
|
+
- list / detail / stories / leaderboard / fund — public
|
|
1049
|
+
- create (auth) publish wish
|
|
1050
|
+
- claim (auth) 1:1 exclusive, 30-day self-claim lock, auto-release if no proof 48h
|
|
1051
|
+
- proof / confirm (auth) complete + wisher confirm → fulfiller +10 prestige
|
|
1052
|
+
- disclose (auth) both-agree public disclosure
|
|
1053
|
+
- cancel (auth) only open wishes
|
|
1054
|
+
- me (auth) prestige breakdown + pending repayment queue
|
|
1055
|
+
- repay (auth) ≥0.1 WAZ; auto-accept if no response 7d
|
|
1056
|
+
- repay_respond (auth) accept | decline_to_fund (decline → fund, wisher +8 / fulfiller +2 grace)
|
|
1057
|
+
- donate (auth) ≥0.1 WAZ; daily 50 WAZ matched 1:1 → donation_honor`,
|
|
1186
1058
|
inputSchema: {
|
|
1187
1059
|
type: 'object',
|
|
1188
1060
|
properties: {
|
|
@@ -1194,14 +1066,14 @@ Actions:
|
|
|
1194
1066
|
choice: { type: 'string', enum: ['accept', 'decline_to_fund'] },
|
|
1195
1067
|
category: { type: 'string', enum: ['medical', 'education', 'daily', 'elderly', 'disaster', 'tech', 'other'] },
|
|
1196
1068
|
target_kind: { type: 'string', enum: ['item', 'service', 'cash'] },
|
|
1197
|
-
target_waz: { type: 'number', description: 'cash
|
|
1198
|
-
escrow_self: { type: 'number', description: '1
|
|
1069
|
+
target_waz: { type: 'number', description: 'Required for cash mode, ≤500' },
|
|
1070
|
+
escrow_self: { type: 'number', description: '1=self-escrow lock full amount; 0=pure coordination' },
|
|
1199
1071
|
title: { type: 'string' }, content: { type: 'string' },
|
|
1200
|
-
window_hours: { type: 'number', description: '24-720
|
|
1072
|
+
window_hours: { type: 'number', description: '24-720 hours' },
|
|
1201
1073
|
allow_public: { type: 'number' },
|
|
1202
1074
|
proof_hash: { type: 'string', description: 'sha256 hex of proof_text' },
|
|
1203
1075
|
proof_note: { type: 'string' },
|
|
1204
|
-
amount: { type: 'number', description: 'repay / donate
|
|
1076
|
+
amount: { type: 'number', description: 'repay / donate amount in WAZ' },
|
|
1205
1077
|
note: { type: 'string' },
|
|
1206
1078
|
limit: { type: 'number' },
|
|
1207
1079
|
},
|
|
@@ -1210,20 +1082,15 @@ Actions:
|
|
|
1210
1082
|
},
|
|
1211
1083
|
{
|
|
1212
1084
|
name: 'webaz_p2p_product',
|
|
1085
|
+
// was ~880 chars, now ~480 chars
|
|
1213
1086
|
description: `P2P native store — product detail lives on seller's node; WebAZ only anchors hash + key fields.
|
|
1214
|
-
Actions:
|
|
1215
|
-
- create (seller): publish anchor — needs title/price/stock + content_hash (sha256) + content_signature (HMAC-SHA256(api_key, hash|signed_at))
|
|
1216
|
-
- list: browse public P2P products (incl. hash + peer_endpoint)
|
|
1217
|
-
- detail: single product (incl. hash + endpoint; agent should self-fetch peer_endpoint and verify sha256)
|
|
1218
|
-
- patch (seller): edit (price/stock/title direct; detail JSON change → must re-sign hash + signature)
|
|
1219
1087
|
|
|
1220
|
-
|
|
1088
|
+
Actions: create (seller, needs title/price/stock + content_hash sha256 + content_signature HMAC-SHA256(api_key, hash|signed_at)) | list | detail | patch (price/stock/title direct; detail JSON change → must re-sign).
|
|
1089
|
+
|
|
1090
|
+
⚠️ **Agent verification flow** (must implement):
|
|
1221
1091
|
1. GET peer_endpoint/<product_id> → raw JSON
|
|
1222
1092
|
2. canonicalize (sort keys, drop nulls) → JSON.stringify
|
|
1223
|
-
3. sha256(canonical) === product.content_hash ? accept : reject trade
|
|
1224
|
-
|
|
1225
|
-
──
|
|
1226
|
-
中文:P2P 原生商店 — 商品详情存卖家节点,WebAZ 只锚定 hash + 关键字段。Actions: create / list / detail / patch。Agent 须自行 GET peer_endpoint 校验 sha256。`,
|
|
1093
|
+
3. sha256(canonical) === product.content_hash ? accept : **reject trade**`,
|
|
1227
1094
|
inputSchema: {
|
|
1228
1095
|
type: 'object',
|
|
1229
1096
|
properties: {
|
|
@@ -1243,14 +1110,12 @@ Verification flow (agent implements):
|
|
|
1243
1110
|
},
|
|
1244
1111
|
{
|
|
1245
1112
|
name: 'webaz_like',
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
- toggle: like or unlike (same endpoint; second call auto-unlikes)
|
|
1249
|
-
- status: my like status on a shareable + total count
|
|
1250
|
-
Threshold: must have ≥1 completed order (anti-Sybil). One vote per person, can't like own.
|
|
1113
|
+
// was ~369 chars, now ~230 chars
|
|
1114
|
+
description: `Like a shareable to boost product ranking.
|
|
1251
1115
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1116
|
+
Actions: toggle (same endpoint; 2nd call auto-unlikes) | status (my like status + total).
|
|
1117
|
+
|
|
1118
|
+
⚠️ **Anti-Sybil**: must have ≥1 completed order. One vote per person, can't like own.`,
|
|
1254
1119
|
inputSchema: {
|
|
1255
1120
|
type: 'object',
|
|
1256
1121
|
properties: {
|
|
@@ -1263,49 +1128,43 @@ Threshold: must have ≥1 completed order (anti-Sybil). One vote per person, can
|
|
|
1263
1128
|
},
|
|
1264
1129
|
{
|
|
1265
1130
|
name: 'webaz_leaderboard',
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
- products trending products (rank_score = sales×0.5 + referrals×2.0 + likes×1.0)
|
|
1269
|
-
- value_products value-certified (💎 cheapest 20% per category · daily batch)
|
|
1270
|
-
- creators creator board (by total likes received)
|
|
1271
|
-
- sellers seller board (by rating × log(reviews+1); GMV hidden)
|
|
1272
|
-
- buyers buyer activity (by completed order count; GMV hidden)
|
|
1273
|
-
- verifiers verifier board (correct count / accuracy)
|
|
1274
|
-
- arbitrators arbitrator reputation (fairness_score)
|
|
1275
|
-
- agents agent eval (trust_score + 30d call count)
|
|
1131
|
+
// was ~817 chars, now ~480 chars
|
|
1132
|
+
description: `WebAZ leaderboards — no centralized traffic distribution, pure real-signal ranking. **Privacy-first**: GMV / revenue amounts NEVER exposed.
|
|
1276
1133
|
|
|
1277
|
-
|
|
1278
|
-
|
|
1134
|
+
8 kinds:
|
|
1135
|
+
- products (sales×0.5 + referrals×2.0 + likes×1.0)
|
|
1136
|
+
- value_products (💎 cheapest 20% per category, daily batch)
|
|
1137
|
+
- creators (total likes received)
|
|
1138
|
+
- sellers (rating × log(reviews+1); GMV hidden)
|
|
1139
|
+
- buyers (completed order count; GMV hidden)
|
|
1140
|
+
- verifiers (correct count / accuracy)
|
|
1141
|
+
- arbitrators (fairness_score)
|
|
1142
|
+
- agents (trust_score + 30d call count)`,
|
|
1279
1143
|
inputSchema: {
|
|
1280
1144
|
type: 'object',
|
|
1281
1145
|
properties: {
|
|
1282
1146
|
kind: {
|
|
1283
1147
|
type: 'string',
|
|
1284
1148
|
enum: ['products', 'value_products', 'creators', 'sellers', 'buyers', 'verifiers', 'arbitrators', 'agents'],
|
|
1285
|
-
description: '
|
|
1149
|
+
description: 'Leaderboard kind',
|
|
1286
1150
|
},
|
|
1287
|
-
limit: { type: 'number', description: '
|
|
1151
|
+
limit: { type: 'number', description: 'Default 20, max 50' },
|
|
1288
1152
|
},
|
|
1289
1153
|
required: ['kind'],
|
|
1290
1154
|
},
|
|
1291
1155
|
},
|
|
1292
1156
|
{
|
|
1293
1157
|
name: 'webaz_auction',
|
|
1294
|
-
|
|
1158
|
+
// was ~967 chars, now ~550 chars
|
|
1159
|
+
description: `English forward auction — seller posts → buyers raise → **anti-sniping extension** → highest wins.
|
|
1295
1160
|
|
|
1296
|
-
USE THIS
|
|
1297
|
-
collectibles, price-discovery). NOT a regular product search — auctions are time-windowed events.
|
|
1298
|
-
For fixed-price items use webaz_search.
|
|
1299
|
-
Actions:
|
|
1300
|
-
- create (seller): start auction; needs title/qty/category/starting_price, optional min_increment/reserve_price/window_min/sniper_extend_min
|
|
1301
|
-
- browse: public board
|
|
1302
|
-
- mine: my created (seller) + my participated (buyer)
|
|
1303
|
-
- detail: full detail incl. bid history (buyer_id redacted for non-seller / non-bidder viewers)
|
|
1304
|
-
- bid (buyer): place bid; needs auction_id + price (first ≥ starting; subsequent ≥ current + increment)
|
|
1305
|
-
- cancel (seller): cancel (only before any bid placed)
|
|
1161
|
+
USE THIS to BID on auction items OR seller starts auction (rare goods / collectibles / price-discovery). NOT regular product search — auctions are **time-windowed events**. For fixed-price use webaz_search.
|
|
1306
1162
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1163
|
+
Actions:
|
|
1164
|
+
- create (seller): title/qty/category/starting_price + optional min_increment/reserve_price/window_min/sniper_extend_min
|
|
1165
|
+
- browse / mine (own + participated) / detail (bid history; buyer_id redacted to non-seller/non-bidder)
|
|
1166
|
+
- bid (buyer): auction_id + price (first ≥ starting; next ≥ current + increment)
|
|
1167
|
+
- cancel (seller, only pre-bid)`,
|
|
1309
1168
|
inputSchema: {
|
|
1310
1169
|
type: 'object',
|
|
1311
1170
|
properties: {
|
|
@@ -1328,16 +1187,12 @@ Actions:
|
|
|
1328
1187
|
},
|
|
1329
1188
|
{
|
|
1330
1189
|
name: 'webaz_auto_bid',
|
|
1190
|
+
// was ~595 chars, now ~340 chars
|
|
1331
1191
|
description: `Seller auto_bid Skill config — auto-quote on RFQ creation instantly.
|
|
1332
1192
|
|
|
1333
|
-
|
|
1334
|
-
Actions:
|
|
1335
|
-
- get: read current Skill config
|
|
1336
|
-
- set: create/update Skill (needs categories[] / regions[] / max_eta_h / bid_strategy etc.)
|
|
1337
|
-
- disable: one-click disable (keeps config)
|
|
1193
|
+
Shortcut for \`webaz_skill install kind=auto_bid\` + ongoing config edits. Dedicated tool because auto_bid is most-used + needs frequent tuning (max_eta_h / undercut_pct / daily_cap). For other Skill kinds use webaz_skill.
|
|
1338
1194
|
|
|
1339
|
-
|
|
1340
|
-
中文:卖家 auto_bid Skill — RFQ 创建瞬间自动报价。Actions: get / set / disable。`,
|
|
1195
|
+
Actions: get | set (categories[] / regions[] / max_eta_h / bid_strategy) | disable (keeps config).`,
|
|
1341
1196
|
inputSchema: {
|
|
1342
1197
|
type: 'object',
|
|
1343
1198
|
properties: {
|
|
@@ -1348,7 +1203,7 @@ Actions:
|
|
|
1348
1203
|
max_eta_h: { type: 'number' },
|
|
1349
1204
|
fulfillment_type: { type: 'string', enum: ['instant_pickup', 'same_day', 'next_day', 'standard'] },
|
|
1350
1205
|
bid_strategy: { type: 'string', enum: ['cheapest_undercut', 'match_budget'] },
|
|
1351
|
-
undercut_pct: { type: 'number', description: '0–0.5
|
|
1206
|
+
undercut_pct: { type: 'number', description: '0–0.5; undercut margin' },
|
|
1352
1207
|
max_price_cap: { type: 'number' },
|
|
1353
1208
|
daily_cap: { type: 'number' },
|
|
1354
1209
|
cooldown_min: { type: 'number' },
|
|
@@ -1359,151 +1214,191 @@ Actions:
|
|
|
1359
1214
|
},
|
|
1360
1215
|
{
|
|
1361
1216
|
name: 'webaz_skill_market',
|
|
1362
|
-
|
|
1217
|
+
// was ~1426 chars, now ~720 chars
|
|
1218
|
+
description: `Knowledge-skill marketplace — anyone publishes content skills (templates / prompts / guides / checklists); others pay to unlock.
|
|
1363
1219
|
|
|
1364
|
-
|
|
1365
|
-
Billing modes: free / one_time (buy once, permanent) / per_use (charged each read).
|
|
1366
|
-
Revenue is an independent flow (author net → wallet, 5% protocol fee → sys_protocol); it does NOT enter PV / referral commission engines.
|
|
1220
|
+
⚠️ **DISTINCT from webaz_skill** (which is seller behaviour-automation plugins, totally separate revenue flow).
|
|
1367
1221
|
|
|
1368
|
-
|
|
1369
|
-
- list browse listed skills (filters: kind / billing / query; no auth needed)
|
|
1370
|
-
- detail one skill's public detail (skill_id; content is NOT included)
|
|
1371
|
-
- publish publish a new skill (title + content + billing_mode required) → enters review queue
|
|
1372
|
-
- update edit own skill (editing an approved one re-enters review)
|
|
1373
|
-
- delist take own skill offline
|
|
1374
|
-
- resubmit resubmit a rejected/delisted skill for review
|
|
1375
|
-
- purchase unlock free / one_time skill (cannot buy your own)
|
|
1376
|
-
- read read the unlocked content; per_use charges price each call
|
|
1377
|
-
- my_skills my published skills (all statuses)
|
|
1378
|
-
- library my unlocked / used skills
|
|
1222
|
+
Lifecycle: publish → human admin content review (NOT via MCP) → listed → buyers unlock.
|
|
1379
1223
|
|
|
1380
|
-
|
|
1381
|
-
|
|
1224
|
+
Billing: \`free\` | \`one_time\` (buy once, permanent) | \`per_use\` (charged each read).
|
|
1225
|
+
|
|
1226
|
+
⚠️ **Revenue is independent flow**: author net → wallet, 5% protocol fee → sys_protocol. Does **NOT** enter PV / referral commission engines.
|
|
1227
|
+
|
|
1228
|
+
Actions: list (no auth, filters: kind/billing/query) | detail (public, no content) | publish (→ review queue) | update (re-enters review if approved) | delist | resubmit | purchase (free / one_time; cannot self-buy) | read (per_use charges each call) | my_skills | library.`,
|
|
1382
1229
|
inputSchema: {
|
|
1383
1230
|
type: 'object',
|
|
1384
1231
|
properties: {
|
|
1385
|
-
api_key: { type: 'string', description: '
|
|
1232
|
+
api_key: { type: 'string', description: 'Your api_key (omit for list/detail)' },
|
|
1386
1233
|
action: {
|
|
1387
1234
|
type: 'string',
|
|
1388
1235
|
enum: ['list', 'detail', 'publish', 'update', 'delist', 'resubmit', 'purchase', 'read', 'my_skills', 'library'],
|
|
1389
|
-
description: '
|
|
1236
|
+
description: 'Action to execute',
|
|
1390
1237
|
},
|
|
1391
|
-
skill_id: { type: 'string', description: '
|
|
1238
|
+
skill_id: { type: 'string', description: 'Skill ID (required for detail/update/delist/resubmit/purchase/read)' },
|
|
1392
1239
|
// publish / update
|
|
1393
|
-
title: { type: 'string', description: '
|
|
1394
|
-
content: { type: 'string', description: '
|
|
1395
|
-
summary: { type: 'string', description: '
|
|
1396
|
-
preview: { type: 'string', description: '
|
|
1397
|
-
skill_kind: { type: 'string', enum: ['template', 'prompt', 'guide', 'checklist'], description: '
|
|
1398
|
-
billing_mode: { type: 'string', enum: ['free', 'one_time', 'per_use'], description: '
|
|
1399
|
-
price: { type: 'number', description: 'WAZ
|
|
1400
|
-
category: { type: 'string', description: '
|
|
1240
|
+
title: { type: 'string', description: 'Title (required for publish)' },
|
|
1241
|
+
content: { type: 'string', description: 'Skill content, visible only after purchase (required for publish)' },
|
|
1242
|
+
summary: { type: 'string', description: 'One-line summary (optional)' },
|
|
1243
|
+
preview: { type: 'string', description: 'Public preview, visible without purchase (optional)' },
|
|
1244
|
+
skill_kind: { type: 'string', enum: ['template', 'prompt', 'guide', 'checklist'], description: 'Skill kind (default template)' },
|
|
1245
|
+
billing_mode: { type: 'string', enum: ['free', 'one_time', 'per_use'], description: 'Billing mode (required for publish)' },
|
|
1246
|
+
price: { type: 'number', description: 'Price in WAZ; free must = 0, paid must > 0, max 100000' },
|
|
1247
|
+
category: { type: 'string', description: 'Category (optional)' },
|
|
1401
1248
|
// list filters
|
|
1402
|
-
kind: { type: 'string', enum: ['template', 'prompt', 'guide', 'checklist'], description: '
|
|
1403
|
-
billing: { type: 'string', enum: ['free', 'one_time', 'per_use'], description: '
|
|
1404
|
-
query: { type: 'string', description: '
|
|
1249
|
+
kind: { type: 'string', enum: ['template', 'prompt', 'guide', 'checklist'], description: 'Filter type (optional for list)' },
|
|
1250
|
+
billing: { type: 'string', enum: ['free', 'one_time', 'per_use'], description: 'Filter billing mode (optional for list)' },
|
|
1251
|
+
query: { type: 'string', description: 'Keyword search (optional for list)' },
|
|
1405
1252
|
},
|
|
1406
1253
|
required: ['action'],
|
|
1407
1254
|
},
|
|
1408
1255
|
},
|
|
1409
1256
|
{
|
|
1410
1257
|
name: 'webaz_secondhand',
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
USE THIS when user wants USED / pre-owned / 闲置 / 二手 items, OR wants to sell own used items.
|
|
1414
|
-
For NEW manufactured products use webaz_search. Note: secondhand and shop catalog are separate
|
|
1415
|
-
spaces — webaz_search does NOT return secondhand listings.
|
|
1258
|
+
// was ~1285 chars, now ~650 chars
|
|
1259
|
+
description: `Secondhand market (个人闲置二手) — P2P pre-owned goods, 1% protocol fee, escrow-protected. Supports shipping + in-person handoff.
|
|
1416
1260
|
|
|
1417
|
-
|
|
1418
|
-
- browse list available items (filters: category / condition / region / min_price / max_price / query / sort; no auth needed; excludes your own when api_key given)
|
|
1419
|
-
- detail one item's detail + seller's other listings (item_id; no auth needed)
|
|
1420
|
-
- publish list an item (title + category + condition + price + images[] required; ≥1 image)
|
|
1421
|
-
- update edit own item (item_id + fields; can set status available/reserved/closed)
|
|
1422
|
-
- mine my listings + stats (available/sold/earned)
|
|
1423
|
-
- buy place an order on an item (item_id + fulfillment_mode; shipping needs shipping_address)
|
|
1261
|
+
USE THIS for USED / pre-owned / 闲置 / 二手 items, OR selling own used. NOT for NEW manufactured (use webaz_search). **Separate space** — webaz_search does NOT return secondhand listings.
|
|
1424
1262
|
|
|
1425
|
-
|
|
1426
|
-
condition: brand_new / like_new / lightly_used / well_used / heavily_used
|
|
1427
|
-
fulfillment: shipping / in_person / both
|
|
1263
|
+
Actions: browse (filters: category/condition/region/price/query/sort; no auth, excludes own when api_key given) | detail (no auth) | publish (title + category + condition + price + images[≥1]) | update (item_id + fields; status available/reserved/closed) | mine | buy (item_id + fulfillment_mode; shipping needs shipping_address).
|
|
1428
1264
|
|
|
1429
|
-
|
|
1430
|
-
中文:二手集市 — 个人闲置 P2P,协议费 1%,escrow 保护,支持快递/面交。Actions: browse / detail / publish / update / mine / buy。`,
|
|
1265
|
+
Enums: **category** phone/computer/appliance/furniture/clothing/book/toy/sports/other · **condition** brand_new/like_new/lightly_used/well_used/heavily_used · **fulfillment** shipping/in_person/both.`,
|
|
1431
1266
|
inputSchema: {
|
|
1432
1267
|
type: 'object',
|
|
1433
1268
|
properties: {
|
|
1434
|
-
api_key: { type: 'string', description: '
|
|
1435
|
-
action: { type: 'string', enum: ['browse', 'detail', 'publish', 'update', 'mine', 'buy'], description: '
|
|
1436
|
-
item_id: { type: 'string', description: '
|
|
1269
|
+
api_key: { type: 'string', description: 'Your api_key (omit for browse/detail)' },
|
|
1270
|
+
action: { type: 'string', enum: ['browse', 'detail', 'publish', 'update', 'mine', 'buy'], description: 'Action to execute' },
|
|
1271
|
+
item_id: { type: 'string', description: 'Item ID (required for detail/update/buy)' },
|
|
1437
1272
|
// publish / update
|
|
1438
|
-
title: { type: 'string', description: '
|
|
1439
|
-
description: { type: 'string', description: '
|
|
1440
|
-
category: { type: 'string', enum: ['phone', 'computer', 'appliance', 'furniture', 'clothing', 'book', 'toy', 'sports', 'other'], description: '
|
|
1441
|
-
condition_grade: { type: 'string', enum: ['brand_new', 'like_new', 'lightly_used', 'well_used', 'heavily_used'], description: '
|
|
1442
|
-
price: { type: 'number', description: 'WAZ
|
|
1443
|
-
negotiable: { type: 'boolean', description: '
|
|
1444
|
-
images: { type: 'array', items: { type: 'string' }, description: '
|
|
1445
|
-
region: { type: 'string', description: '
|
|
1446
|
-
fulfillment: { type: 'string', enum: ['shipping', 'in_person', 'both'], description: '
|
|
1447
|
-
status: { type: 'string', enum: ['available', 'reserved', 'closed'], description: '
|
|
1273
|
+
title: { type: 'string', description: 'Title 2-60 chars (required for publish)' },
|
|
1274
|
+
description: { type: 'string', description: 'Description (≤1000 chars, optional)' },
|
|
1275
|
+
category: { type: 'string', enum: ['phone', 'computer', 'appliance', 'furniture', 'clothing', 'book', 'toy', 'sports', 'other'], description: 'Category (required for publish)' },
|
|
1276
|
+
condition_grade: { type: 'string', enum: ['brand_new', 'like_new', 'lightly_used', 'well_used', 'heavily_used'], description: 'Condition grade (required for publish)' },
|
|
1277
|
+
price: { type: 'number', description: 'Price in WAZ 0-100000 (required for publish)' },
|
|
1278
|
+
negotiable: { type: 'boolean', description: 'Negotiable flag (optional)' },
|
|
1279
|
+
images: { type: 'array', items: { type: 'string' }, description: 'Images dataURL/URL array, ≥1 ≤9 (required for publish)' },
|
|
1280
|
+
region: { type: 'string', description: 'Region (≤40 chars, optional)' },
|
|
1281
|
+
fulfillment: { type: 'string', enum: ['shipping', 'in_person', 'both'], description: 'Fulfillment (default both)' },
|
|
1282
|
+
status: { type: 'string', enum: ['available', 'reserved', 'closed'], description: 'Change status (optional for update)' },
|
|
1448
1283
|
// buy
|
|
1449
|
-
fulfillment_mode: { type: 'string', enum: ['shipping', 'in_person'], description: '
|
|
1450
|
-
shipping_address: { type: 'string', description: '
|
|
1451
|
-
notes: { type: 'string', description: '
|
|
1284
|
+
fulfillment_mode: { type: 'string', enum: ['shipping', 'in_person'], description: 'Per-order fulfillment (required for buy, default shipping)' },
|
|
1285
|
+
shipping_address: { type: 'string', description: 'Shipping address (required for buy + shipping)' },
|
|
1286
|
+
notes: { type: 'string', description: 'Order note (optional for buy; can include counter-offer)' },
|
|
1452
1287
|
// browse filters
|
|
1453
|
-
condition: { type: 'string', description: '
|
|
1288
|
+
condition: { type: 'string', description: 'Filter condition, comma-separated multi (optional for browse)' },
|
|
1454
1289
|
min_price: { type: 'number' },
|
|
1455
1290
|
max_price: { type: 'number' },
|
|
1456
|
-
query: { type: 'string', description: '
|
|
1457
|
-
sort: { type: 'string', enum: ['newest', 'price_asc', 'price_desc', 'popular'], description: '
|
|
1291
|
+
query: { type: 'string', description: 'Keyword (optional for browse)' },
|
|
1292
|
+
sort: { type: 'string', enum: ['newest', 'price_asc', 'price_desc', 'popular'], description: 'Sort (optional for browse)' },
|
|
1458
1293
|
},
|
|
1459
1294
|
required: ['action'],
|
|
1460
1295
|
},
|
|
1461
1296
|
},
|
|
1462
1297
|
{
|
|
1463
1298
|
name: 'webaz_trial',
|
|
1464
|
-
|
|
1299
|
+
// was ~1506 chars, now ~720 chars
|
|
1300
|
+
description: `Trial-for-review (测评免单) — seller refunds buyer's order when buyer posts qualifying review note that reaches a view threshold.
|
|
1465
1301
|
|
|
1466
|
-
USE THIS when:
|
|
1467
|
-
- buyer asks "is there a trial / free-test / 测评免单 / 0 元试用 for this product?", OR
|
|
1468
|
-
- buyer has already ordered a product with a trial campaign and wants to claim the slot, OR
|
|
1469
|
-
- seller wants to launch a trial campaign to seed reviews.
|
|
1470
|
-
NOT a search tool — for product discovery use webaz_search (can filter by has_trial=true coming soon).
|
|
1302
|
+
USE THIS when: buyer asks "trial / 测评免单 / 0 元试用 for this product?" | buyer has ordered product with active campaign + wants to claim | seller wants to launch campaign. NOT a search tool — use webaz_search.
|
|
1471
1303
|
|
|
1472
|
-
Anti-abuse
|
|
1304
|
+
⚠️ **Anti-abuse enforced server-side** (MCP just passes through): buyer ≠ seller / must have confirmed-or-completed order / account age ≥3d / IP+UA rate limits / config snapshot at claim time.
|
|
1473
1305
|
|
|
1474
1306
|
Buyer actions:
|
|
1475
|
-
- get_campaign
|
|
1476
|
-
- apply
|
|
1477
|
-
- link_note
|
|
1478
|
-
- my_claims
|
|
1479
|
-
Seller actions:
|
|
1480
|
-
- create_campaign open/update a campaign on your product (product_id + quota_total + reach_threshold + min_chars + min_days_live)
|
|
1481
|
-
- cancel_campaign close your product's campaign (product_id)
|
|
1482
|
-
- my_campaigns my seller-side campaigns
|
|
1483
|
-
- campaign_claims claims under a campaign (campaign_id)
|
|
1307
|
+
- get_campaign read product's active campaign (no auth)
|
|
1308
|
+
- apply claim slot (product_id)
|
|
1309
|
+
- link_note attach review note (claim_id + note_id; note must be type=note + bound to product + active)
|
|
1310
|
+
- my_claims my claims + statuses
|
|
1484
1311
|
|
|
1485
|
-
|
|
1486
|
-
|
|
1312
|
+
Seller actions:
|
|
1313
|
+
- create_campaign open/update (quota_total 1-200 + reach_threshold 10-10000 + min_chars 20-5000 + min_days_live 1-90)
|
|
1314
|
+
- cancel_campaign / my_campaigns / campaign_claims`,
|
|
1487
1315
|
inputSchema: {
|
|
1488
1316
|
type: 'object',
|
|
1489
1317
|
properties: {
|
|
1490
|
-
api_key: { type: 'string', description: '
|
|
1491
|
-
action: { type: 'string', enum: ['get_campaign', 'apply', 'link_note', 'my_claims', 'create_campaign', 'cancel_campaign', 'my_campaigns', 'campaign_claims'], description: '
|
|
1492
|
-
product_id: { type: 'string', description: '
|
|
1493
|
-
claim_id: { type: 'string', description: '
|
|
1494
|
-
campaign_id: { type: 'string', description: '
|
|
1495
|
-
note_id: { type: 'string', description: '
|
|
1318
|
+
api_key: { type: 'string', description: 'Your api_key (omit for get_campaign)' },
|
|
1319
|
+
action: { type: 'string', enum: ['get_campaign', 'apply', 'link_note', 'my_claims', 'create_campaign', 'cancel_campaign', 'my_campaigns', 'campaign_claims'], description: 'Action to execute' },
|
|
1320
|
+
product_id: { type: 'string', description: 'Product ID (required for get_campaign/apply/create_campaign/cancel_campaign)' },
|
|
1321
|
+
claim_id: { type: 'string', description: 'Claim ID (required for link_note)' },
|
|
1322
|
+
campaign_id: { type: 'string', description: 'Campaign ID (required for campaign_claims)' },
|
|
1323
|
+
note_id: { type: 'string', description: 'Review note ID (required for link_note; must be type=note + bound to product + active)' },
|
|
1496
1324
|
// create_campaign config
|
|
1497
|
-
quota_total: { type: 'number', description: '
|
|
1498
|
-
reach_threshold: { type: 'number', description: '
|
|
1499
|
-
min_chars: { type: 'number', description: '
|
|
1500
|
-
min_days_live: { type: 'number', description: '
|
|
1325
|
+
quota_total: { type: 'number', description: 'Quota total 1-200 (required for create_campaign)' },
|
|
1326
|
+
reach_threshold: { type: 'number', description: 'Reach threshold 10-10000 (default 50)' },
|
|
1327
|
+
min_chars: { type: 'number', description: 'Min note chars 20-5000 (default 50)' },
|
|
1328
|
+
min_days_live: { type: 'number', description: 'Min note alive days 1-90 (default 7)' },
|
|
1501
1329
|
},
|
|
1502
1330
|
required: ['action'],
|
|
1503
1331
|
},
|
|
1504
1332
|
},
|
|
1333
|
+
{
|
|
1334
|
+
name: 'webaz_feedback',
|
|
1335
|
+
description: `Submit the user's in-use feedback / improvement idea about WebAZ itself, right where it happens — agent-native "use → build". When a user hits a problem ("search keeps returning nothing") or has an idea ("you should support sorting by delivery time"), call this instead of telling them to go file a GitHub issue.
|
|
1336
|
+
|
|
1337
|
+
Your unique value: this tool auto-attaches the **scene** (your recent tool calls + outcomes, redacted) so a maintainer can reproduce + fix — far better than a vague complaint.
|
|
1338
|
+
|
|
1339
|
+
actions:
|
|
1340
|
+
- submit (default): type=ux_issue|bug|proposal, area (e.g. search/order/dispute), text (the feedback), severity=low|annoying|blocking (for issues), optional subject. Returns id + status.
|
|
1341
|
+
- my: list the user's past feedback + current status (received→triaged→in_progress→resolved/declined/duplicate). Closed loop — accepted feedback earns co-build reputation.
|
|
1342
|
+
- get: one item by id.
|
|
1343
|
+
|
|
1344
|
+
Gate by type: ux_issue/bug (reporting a problem = "using") needs only a logged-in user — NO Passkey, anyone can report. proposal (building the platform) requires a Passkey-bound real person (identity anchor for contribution rewards). Co-build reputation is credited only to Passkey-bound submitters. NETWORK mode only — feedback must reach the live project; in SANDBOX it returns guidance to switch.
|
|
1345
|
+
|
|
1346
|
+
──
|
|
1347
|
+
中文:就地提交用户在使用中发现的问题/改进建议(agent 时代"用→建"距离归零)。自动附带脱敏"现场"(你最近的调用+结果),可复现可修。分级门:ux_issue/bug(报告问题)登录即可、无需 Passkey;proposal(建设)需绑 Passkey(真人锚点)。仅 NETWORK 模式。`,
|
|
1348
|
+
inputSchema: {
|
|
1349
|
+
type: 'object',
|
|
1350
|
+
properties: {
|
|
1351
|
+
action: { type: 'string', enum: ['submit', 'my', 'get'], description: 'submit (default) | my | get' },
|
|
1352
|
+
api_key: { type: 'string', description: "User's api_key (real person required)" },
|
|
1353
|
+
type: { type: 'string', enum: ['ux_issue', 'bug', 'proposal'], description: 'submit: kind of feedback' },
|
|
1354
|
+
area: { type: 'string', description: 'submit: which feature, e.g. search / order / dispute' },
|
|
1355
|
+
severity: { type: 'string', enum: ['low', 'annoying', 'blocking'], description: 'submit: for ux_issue/bug' },
|
|
1356
|
+
subject: { type: 'string', description: 'submit: optional short title' },
|
|
1357
|
+
text: { type: 'string', description: 'submit: the feedback / idea (≥5 chars)' },
|
|
1358
|
+
feedback_id: { type: 'string', description: 'get: the feedback id' },
|
|
1359
|
+
},
|
|
1360
|
+
required: ['api_key'],
|
|
1361
|
+
},
|
|
1362
|
+
},
|
|
1505
1363
|
];
|
|
1506
1364
|
// ─── 工具处理函数 ─────────────────────────────────────────────
|
|
1365
|
+
// RFC-004: webaz_feedback — agent-native "use → build" 反馈(双模;仅 NETWORK 能送达)
|
|
1366
|
+
async function handleFeedback(args) {
|
|
1367
|
+
const action = args.action || 'submit';
|
|
1368
|
+
const apiKey = args.api_key;
|
|
1369
|
+
if (!apiKey)
|
|
1370
|
+
return { error: 'api_key required' };
|
|
1371
|
+
if (toolBackend('webaz_feedback') !== 'network') {
|
|
1372
|
+
return {
|
|
1373
|
+
_mode: 'sandbox',
|
|
1374
|
+
error: 'SANDBOX 模式下反馈无人接收 —— 建设性反馈要进真实项目才有意义。请设 WEBAZ_API_KEY 切到 NETWORK 模式后再提交。 / Feedback needs NETWORK mode to reach the project; set WEBAZ_API_KEY.',
|
|
1375
|
+
error_code: 'FEEDBACK_NEEDS_NETWORK',
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
if (action === 'my')
|
|
1379
|
+
return apiCall('/api/build-feedback/mine', { apiKey });
|
|
1380
|
+
if (action === 'get') {
|
|
1381
|
+
const fid = args.feedback_id;
|
|
1382
|
+
if (!fid)
|
|
1383
|
+
return { error: 'feedback_id required for action=get' };
|
|
1384
|
+
return apiCall('/api/build-feedback/' + encodeURIComponent(fid), { apiKey });
|
|
1385
|
+
}
|
|
1386
|
+
// submit(默认)
|
|
1387
|
+
const text = (args.text ?? '').trim();
|
|
1388
|
+
if (text.length < 5)
|
|
1389
|
+
return { error: 'text required (≥5 chars)' };
|
|
1390
|
+
return apiCall('/api/build-feedback', {
|
|
1391
|
+
method: 'POST', apiKey,
|
|
1392
|
+
body: {
|
|
1393
|
+
type: args.type || 'ux_issue',
|
|
1394
|
+
area: args.area,
|
|
1395
|
+
severity: args.severity,
|
|
1396
|
+
subject: args.subject,
|
|
1397
|
+
text,
|
|
1398
|
+
scene: recentCalls.slice(-8), // 现场证据:脱敏摘要(tool / arg_keys / outcome / mode)
|
|
1399
|
+
},
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1507
1402
|
function handleInfo() {
|
|
1508
1403
|
const summary = getManifestSummary();
|
|
1509
1404
|
// QA 轮 3 抓到:live_stats 不是 hardcoded、不是 remote — 就是本地 SQLite count。这里加 source 字段澄清。
|
|
@@ -1544,13 +1439,26 @@ function handleInfo() {
|
|
|
1544
1439
|
// 第三方尽调 agent 抓到过的破绽:live_stats 是本地库数字、引导词推 agent 拉新、佣金结构有 MLM 形态。
|
|
1545
1440
|
// 此处主动披露,不抗辩;agent 自己判断如何处理。
|
|
1546
1441
|
network_state: {
|
|
1442
|
+
// RFC-003 P3:显式声明当前客户端模式,让 agent 一眼分清"真网络 vs 本机沙盒"
|
|
1443
|
+
mode: MODE, // 'network' | 'sandbox'
|
|
1444
|
+
mode_banner: modeBanner(),
|
|
1445
|
+
mode_meaning: MODE === 'network'
|
|
1446
|
+
? '🟢 NETWORK:核心交易工具(下单/上架/履约/比价等)走 webaz.xyz 共享生产网络。注意:本 webaz_info 工具尚未联网,下方 live_stats 仍读本机本地缓存,不代表全网规模。'
|
|
1447
|
+
: '🟡 SANDBOX:所有工具都在本机本地 SQLite 运行,与 webaz.xyz 全网隔离。任何计数 / 账号 / 订单仅本机有效,不是真实网络状态。设 WEBAZ_API_KEY 可切到 NETWORK。',
|
|
1547
1448
|
phase: 'pre_launch',
|
|
1548
1449
|
real_users_on_canonical: 0,
|
|
1549
1450
|
canonical_endpoint: 'https://webaz.xyz',
|
|
1550
1451
|
economic_flow: 'simulated WAZ (test currency, 1 WAZ ≈ 1 USDC peg is a模拟基准, not a real exchange rate). No fiat/crypto settles yet.',
|
|
1551
1452
|
disclaimer: '本协议尚未公开上线,prod 真实用户≈0,无真实经济流转。下方 live_stats / 工具示例所有计数均来自**本机 MCP 服务器的本地 SQLite**(~/.webaz/webaz.db),仅供 dev / demo,不代表协议全网真实状态。请勿据此评估市场规模、做投资决策、或替终端用户承诺任何经济关系。',
|
|
1552
1453
|
},
|
|
1553
|
-
description: 'WebAZ
|
|
1454
|
+
description: 'WebAZ is a decentralized commerce protocol. Every transaction flows through a state machine; each state transition needs proof-of-action from the responsible party. Any timeout-without-action: protocol auto-rules default + executes remedy. / WebAZ 是去中心化商业协议;每笔交易通过状态机流转,每次状态转移需对应责任方的操作证明;超时未操作则协议自动判违约并执行处置。',
|
|
1455
|
+
// 连接两个场景:用协议(本工具) ↔ 改协议(开发协作)。想改 WebAZ 本身的 agent 从这里进。
|
|
1456
|
+
for_contributors: {
|
|
1457
|
+
note: 'Want to change WebAZ itself (not just use it)? This is an open, agent-native protocol — AI-authored PRs are welcome, with accountability. / 想改 WebAZ 本身(不只是用)?这是开放的 agent 原生协议,欢迎 AI 提 PR,但需问责。',
|
|
1458
|
+
repo: 'https://github.com/seasonsagents-art/webaz',
|
|
1459
|
+
start_here: 'AGENTS.md (project map + before-you-code + PR flow) → CONTRIBUTING.md (full guide)',
|
|
1460
|
+
ai_accountability: 'AI-authored PRs: add 🤖🤖🤖 to the PR title; the agent must be triggered by a Passkey-bound human (webazer) who is accountable. / AI 提 PR:标题加 🤖🤖🤖,且须由已绑 Passkey 的真人(webazer)触发并担责。',
|
|
1461
|
+
},
|
|
1554
1462
|
live_stats: stats,
|
|
1555
1463
|
economics,
|
|
1556
1464
|
// QA 轮 14.c P1:显式归因机制(与传统 MLM 自动吃下线的根本区别)
|
|
@@ -1561,7 +1469,7 @@ function handleInfo() {
|
|
|
1561
1469
|
redirect_rules: 'chain_gap (无 L / sponsor 无效) → charity_fund; region cap (level > region max_levels) → global_fund. global region max_levels=1 (仅 L1);singapore 等 max_levels=3.',
|
|
1562
1470
|
l1_gate: 'promoter 必须是 verified buyer(≥1 笔完成订单)才能领 commission,否则该份 redirect。',
|
|
1563
1471
|
// 主动披露,不要让外部尽调 agent 自己读出来再写差评
|
|
1564
|
-
compliance_notice: '⚠️ 本协议含三级佣金(L1/L2/L3 7:2:1) + 二元配对树(binary PV matching) + 邀请链结构。这类形态在多数司法辖区可能与**多层级营销(MLM)的法律定义重叠**。本协议通过显式 per-order 归因(非自动吃下线)规避了 MLM 寡头化的核心病灶,但形态层面仍带 MLM 特征,我们诚实告知。**代理 AI
|
|
1472
|
+
compliance_notice: '⚠️ 本协议含三级佣金(L1/L2/L3 7:2:1) + 二元配对树(binary PV matching) + 邀请链结构。这类形态在多数司法辖区可能与**多层级营销(MLM)的法律定义重叠**。本协议通过显式 per-order 归因(非自动吃下线)规避了 MLM 寡头化的核心病灶,但形态层面仍带 MLM 特征,我们诚实告知。**代理 AI 不应默认替终端用户生成推广链接或拉新**——这需要用户的显式授权,且用户自身要先评估当地合规性。\n\n**Reward participation is opt-in (RFC-002)**: default = off. Users must apply (Passkey + ≥1 completed order); attribution always recorded (relation layer), but commission settlement gated until opt-in. Pending commission held in pending_commission_escrow for 30d grace. See docs/rfcs/RFC-002-rewards-opt-in.md for full state matrix.',
|
|
1565
1473
|
},
|
|
1566
1474
|
// QA 轮 3 FAIL:roles 漏 reviewer。register 工具支持 5 个角色,info 必须列全。
|
|
1567
1475
|
roles: {
|
|
@@ -1601,6 +1509,25 @@ function handleInfo() {
|
|
|
1601
1509
|
};
|
|
1602
1510
|
}
|
|
1603
1511
|
function handleRegister(args) {
|
|
1512
|
+
// ─── RFC-003 P3:NETWORK 模式不自助建号 ────────────────────────
|
|
1513
|
+
// 自助注册会绕过邀请码 / captcha / 责任制;且 CHARTER §4 I-5 要求账号必须由已绑 Passkey
|
|
1514
|
+
// 的真人创建("每个 agent 背后有可问责的真人")。NETWORK 模式下改为引导真人去 webaz.xyz 拿 key。
|
|
1515
|
+
if (MODE === 'network') {
|
|
1516
|
+
return {
|
|
1517
|
+
_mode: 'network',
|
|
1518
|
+
registration: 'must_be_done_by_human_at_webaz_xyz',
|
|
1519
|
+
message: '🟢 NETWORK 模式下不支持 agent 自助注册。开放协议的信任来自"每个 agent 背后有可问责的真人",所以注册这一步刻意留给真人在 webaz.xyz 完成。请按三步加入共享网络:',
|
|
1520
|
+
steps: [
|
|
1521
|
+
'1. 打开 https://webaz.xyz 注册账号(需邀请码;注册时绑定 Passkey 成为可问责真人)',
|
|
1522
|
+
'2. 进入「我的 / 设置」→ 复制你的 api_key',
|
|
1523
|
+
'3. 把 api_key 填入 MCP 配置环境变量 WEBAZ_API_KEY,重启 MCP —— 之后所有交易工具自动在 webaz.xyz 共享网络上操作',
|
|
1524
|
+
],
|
|
1525
|
+
register_url: WEBAZ_API_URL,
|
|
1526
|
+
why_not_agent_self_register: 'agent 自助注册会绕过邀请 / captcha / 真人 Passkey 责任制,破坏协议的可问责性(#6 不滥用 / CHARTER §4 I-5)。',
|
|
1527
|
+
want_to_try_offline_first: '只想离线试玩、暂不连网络?设环境变量 WEBAZ_MODE=sandbox(或清空 WEBAZ_API_KEY),webaz_register 会在本机沙盒建一个测试账号(仅本机有效)。',
|
|
1528
|
+
};
|
|
1529
|
+
}
|
|
1530
|
+
// ─── SANDBOX 模式:本机建测试账号(显著标注,仅本机有效,与 webaz.xyz 全网隔离)──
|
|
1604
1531
|
const name = args.name;
|
|
1605
1532
|
const role = args.role;
|
|
1606
1533
|
const initialBalance = args.initial_balance ?? 1000;
|
|
@@ -1626,7 +1553,10 @@ function handleRegister(args) {
|
|
|
1626
1553
|
: '等待订单分配给你';
|
|
1627
1554
|
return {
|
|
1628
1555
|
success: true,
|
|
1629
|
-
|
|
1556
|
+
_mode: 'sandbox',
|
|
1557
|
+
sandbox_account: true,
|
|
1558
|
+
sandbox_warning: '⚠️ 这是 SANDBOX 测试账号 —— 仅本机有效,未在 webaz.xyz 全网注册,与共享网络完全隔离。要真正加入网络(让交易对其他人可见、形成网络效应),请在 https://webaz.xyz 注册并把 api_key 填入 WEBAZ_API_KEY 切到 NETWORK 模式。',
|
|
1559
|
+
message: '沙盒注册成功(仅本机)!妥善保管 api_key(身份凭证)+ permanent_code(恢复码,丢失 api_key 用它配 handle 找回)',
|
|
1630
1560
|
user_id: id,
|
|
1631
1561
|
api_key: apiKey,
|
|
1632
1562
|
permanent_code: permaCode,
|
|
@@ -1731,6 +1661,38 @@ async function handleSearch(args) {
|
|
|
1731
1661
|
if (limit > 200)
|
|
1732
1662
|
limit = 200;
|
|
1733
1663
|
const sortMode = args.sort ?? 'trending';
|
|
1664
|
+
// RFC-003 P4: NETWORK 模式关键词搜索 → 生产 GET /api/products?mode=agent
|
|
1665
|
+
// (同款协议级 strict alias 引擎,公开读,不传 fuzzy)。让 agent 搜到的是全网真实在售商品。
|
|
1666
|
+
if (toolBackend('webaz_search') === 'network') {
|
|
1667
|
+
const qs = new URLSearchParams({ mode: 'agent', limit: String(limit) });
|
|
1668
|
+
if (query)
|
|
1669
|
+
qs.set('q', query);
|
|
1670
|
+
if (category)
|
|
1671
|
+
qs.set('category', String(category));
|
|
1672
|
+
if (maxPrice != null)
|
|
1673
|
+
qs.set('max_price', String(maxPrice));
|
|
1674
|
+
if (minReturnDays != null)
|
|
1675
|
+
qs.set('min_return_days', String(minReturnDays));
|
|
1676
|
+
if (maxHandlingHours != null)
|
|
1677
|
+
qs.set('max_handling_hours', String(maxHandlingHours));
|
|
1678
|
+
if (hasSales)
|
|
1679
|
+
qs.set('has_sales', String(hasSales));
|
|
1680
|
+
if (sellerId)
|
|
1681
|
+
qs.set('seller_id', String(sellerId));
|
|
1682
|
+
if (args.sort)
|
|
1683
|
+
qs.set('sort', String(args.sort));
|
|
1684
|
+
const r = await apiCall('/api/products?' + qs.toString());
|
|
1685
|
+
if ('error' in r)
|
|
1686
|
+
return r;
|
|
1687
|
+
const products = r.products ?? [];
|
|
1688
|
+
return {
|
|
1689
|
+
...r,
|
|
1690
|
+
found: products.length,
|
|
1691
|
+
hint: products.length
|
|
1692
|
+
? `网络上匹配到 ${products.length} 件商品。下单前用 webaz_verify_price 锁价。`
|
|
1693
|
+
: '网络上未找到精确匹配商品(协议级 strict 匹配)。可换更准确的商品名,或用 paste_text 贴外链搜索。',
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1734
1696
|
let sql = `
|
|
1735
1697
|
SELECT p.*, u.name as seller_name,
|
|
1736
1698
|
COALESCE((SELECT total_points FROM reputation_scores WHERE user_id = p.seller_id), 0) as rep_points,
|
|
@@ -1903,7 +1865,15 @@ async function handleSearch(args) {
|
|
|
1903
1865
|
hint: 'agent 模式:products 已附带 metrics + score(含阶梯新鲜度 + 14d 首单 boost),可基于自身策略二次排序',
|
|
1904
1866
|
};
|
|
1905
1867
|
}
|
|
1906
|
-
function handleVerifyPrice(args) {
|
|
1868
|
+
async function handleVerifyPrice(args) {
|
|
1869
|
+
// RFC-003 P2: network 模式转发到生产 POST /api/verify-price(前置,绕过本地 db)
|
|
1870
|
+
if (toolBackend('webaz_verify_price') === 'network') {
|
|
1871
|
+
return apiCall('/api/verify-price', {
|
|
1872
|
+
method: 'POST',
|
|
1873
|
+
apiKey: args.api_key,
|
|
1874
|
+
body: { product_id: args.product_id, quantity: Number(args.quantity ?? 1) },
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1907
1877
|
const auth = requireAuth(db, args.api_key);
|
|
1908
1878
|
if ('error' in auth)
|
|
1909
1879
|
return auth;
|
|
@@ -1953,6 +1923,56 @@ async function handleListProduct(args) {
|
|
|
1953
1923
|
const apiKey = args.api_key;
|
|
1954
1924
|
if (!apiKey)
|
|
1955
1925
|
return { error: 'api_key required' };
|
|
1926
|
+
// RFC-003 P2b: NETWORK 模式 — 卖家目录管理全部转发生产端点(单一真相源)
|
|
1927
|
+
if (toolBackend('webaz_list_product') === 'network') {
|
|
1928
|
+
const pid = args.product_id;
|
|
1929
|
+
if (action === 'mine') {
|
|
1930
|
+
const r = await apiCall('/api/my-products', { apiKey });
|
|
1931
|
+
if (Array.isArray(r))
|
|
1932
|
+
return { found: r.length, products: r };
|
|
1933
|
+
return r;
|
|
1934
|
+
}
|
|
1935
|
+
if (action === 'create') {
|
|
1936
|
+
const createFields = ['title', 'description', 'price', 'stock', 'category', 'specs', 'brand', 'model', 'source_url', 'source_price', 'external_title', 'weight_kg', 'ship_regions', 'handling_hours', 'estimated_days', 'fragile', 'return_days', 'return_condition', 'warranty_days', 'commission_rate', 'product_type', 'aliases', 'image_hashes'];
|
|
1937
|
+
const body = {};
|
|
1938
|
+
for (const k of createFields)
|
|
1939
|
+
if (args[k] !== undefined)
|
|
1940
|
+
body[k] = args[k];
|
|
1941
|
+
const created = await apiCall('/api/products', { method: 'POST', apiKey, body });
|
|
1942
|
+
if ('error' in created)
|
|
1943
|
+
return created;
|
|
1944
|
+
const newId = (created.product_id ?? created.id);
|
|
1945
|
+
const extraKeys = ['i18n_titles', 'i18n_descs', 'origin_claims', 'low_stock_threshold', 'auto_delist_on_zero'];
|
|
1946
|
+
if (newId && extraKeys.some(k => args[k] !== undefined)) {
|
|
1947
|
+
const eb = {};
|
|
1948
|
+
for (const k of extraKeys)
|
|
1949
|
+
if (args[k] !== undefined)
|
|
1950
|
+
eb[k] = args[k];
|
|
1951
|
+
const extra = await apiCall(`/api/products/${encodeURIComponent(newId)}`, { method: 'PUT', apiKey, body: eb });
|
|
1952
|
+
return { ...created, extra_fields_applied: !('error' in extra), extra_result: extra };
|
|
1953
|
+
}
|
|
1954
|
+
return created;
|
|
1955
|
+
}
|
|
1956
|
+
if (!pid)
|
|
1957
|
+
return { error: `product_id required for action=${action}` };
|
|
1958
|
+
if (action === 'update') {
|
|
1959
|
+
const updatable = ['title', 'description', 'price', 'stock', 'specs', 'brand', 'model', 'handling_hours', 'ship_regions', 'estimated_days', 'fragile', 'return_days', 'return_condition', 'warranty_days', 'low_stock_threshold', 'auto_delist_on_zero', 'i18n_titles', 'i18n_descs', 'origin_claims'];
|
|
1960
|
+
const body = {};
|
|
1961
|
+
for (const k of updatable)
|
|
1962
|
+
if (args[k] !== undefined)
|
|
1963
|
+
body[k] = args[k];
|
|
1964
|
+
return apiCall(`/api/products/${encodeURIComponent(pid)}`, { method: 'PUT', apiKey, body });
|
|
1965
|
+
}
|
|
1966
|
+
if (action === 'delist')
|
|
1967
|
+
return apiCall(`/api/products/${encodeURIComponent(pid)}/status`, { method: 'PATCH', apiKey, body: { status: 'warehouse' } });
|
|
1968
|
+
if (action === 'relist')
|
|
1969
|
+
return apiCall(`/api/products/${encodeURIComponent(pid)}/status`, { method: 'PATCH', apiKey, body: { status: 'active' } });
|
|
1970
|
+
if (action === 'trash')
|
|
1971
|
+
return apiCall(`/api/products/${encodeURIComponent(pid)}/status`, { method: 'PATCH', apiKey, body: { status: 'deleted' } });
|
|
1972
|
+
if (action === 'delete')
|
|
1973
|
+
return apiCall(`/api/products/${encodeURIComponent(pid)}`, { method: 'DELETE', apiKey });
|
|
1974
|
+
return { error: `unknown action: ${action}. Valid actions: create | mine | update | delist | relist | trash | delete` };
|
|
1975
|
+
}
|
|
1956
1976
|
if (action !== 'create') {
|
|
1957
1977
|
const auth0 = requireAuth(db, apiKey);
|
|
1958
1978
|
if ('error' in auth0)
|
|
@@ -2065,7 +2085,21 @@ async function handleListProduct(args) {
|
|
|
2065
2085
|
...(extraResult ? { extra_fields_applied: !('error' in extraResult), extra_result: extraResult } : {}),
|
|
2066
2086
|
};
|
|
2067
2087
|
}
|
|
2068
|
-
function handlePlaceOrder(args) {
|
|
2088
|
+
async function handlePlaceOrder(args) {
|
|
2089
|
+
// RFC-003 P2: network 模式转发到生产 POST /api/orders(前置,绕过本地 db)。
|
|
2090
|
+
// 生产端做完整鉴权/库存/session/spend-cap/结算。
|
|
2091
|
+
if (toolBackend('webaz_place_order') === 'network') {
|
|
2092
|
+
const body = { product_id: args.product_id, quantity: Number(args.quantity ?? 1) };
|
|
2093
|
+
if (args.session_token != null)
|
|
2094
|
+
body.session_token = args.session_token;
|
|
2095
|
+
if (args.expected_price != null)
|
|
2096
|
+
body.expected_price = args.expected_price;
|
|
2097
|
+
if (args.shipping_address != null)
|
|
2098
|
+
body.shipping_address = args.shipping_address;
|
|
2099
|
+
if (args.donation_pct != null)
|
|
2100
|
+
body.donation_pct = args.donation_pct;
|
|
2101
|
+
return apiCall('/api/orders', { method: 'POST', apiKey: args.api_key, body });
|
|
2102
|
+
}
|
|
2069
2103
|
const auth = requireAuth(db, args.api_key);
|
|
2070
2104
|
if ('error' in auth)
|
|
2071
2105
|
return auth;
|
|
@@ -2224,6 +2258,24 @@ function handlePlaceOrder(args) {
|
|
|
2224
2258
|
};
|
|
2225
2259
|
}
|
|
2226
2260
|
async function handleUpdateOrder(args) {
|
|
2261
|
+
// RFC-003 P2b: NETWORK 模式 — 全部状态机动作转发生产 /api/orders/:id/action(单一真相源;
|
|
2262
|
+
// sandbox 路径里 confirm 也是这么转发的,network 把整套履约状态机统一走 PWA 引擎)
|
|
2263
|
+
if (toolBackend('webaz_update_order') === 'network') {
|
|
2264
|
+
const orderId = args.order_id;
|
|
2265
|
+
const action = args.action;
|
|
2266
|
+
if (!orderId || !action)
|
|
2267
|
+
return { error: 'order_id and action required' };
|
|
2268
|
+
return apiCall(`/api/orders/${encodeURIComponent(orderId)}/action`, {
|
|
2269
|
+
method: 'POST',
|
|
2270
|
+
apiKey: args.api_key,
|
|
2271
|
+
body: {
|
|
2272
|
+
action,
|
|
2273
|
+
notes: args.notes ?? '',
|
|
2274
|
+
evidence_description: args.evidence_description ?? '',
|
|
2275
|
+
...(args.logistics_company_id ? { logistics_company_id: args.logistics_company_id } : {}),
|
|
2276
|
+
},
|
|
2277
|
+
});
|
|
2278
|
+
}
|
|
2227
2279
|
const auth = requireAuth(db, args.api_key);
|
|
2228
2280
|
if ('error' in auth)
|
|
2229
2281
|
return auth;
|
|
@@ -2341,7 +2393,14 @@ async function handleUpdateOrder(args) {
|
|
|
2341
2393
|
history_record: result.historyId,
|
|
2342
2394
|
};
|
|
2343
2395
|
}
|
|
2344
|
-
function handleGetStatus(args) {
|
|
2396
|
+
async function handleGetStatus(args) {
|
|
2397
|
+
// RFC-003 P4: NETWORK 模式订单查询 → 生产 GET /api/orders/:id(权威网络订单详情 + 历史)
|
|
2398
|
+
if (toolBackend('webaz_get_status') === 'network') {
|
|
2399
|
+
const orderId = args.order_id;
|
|
2400
|
+
if (!orderId)
|
|
2401
|
+
return { error: 'order_id required' };
|
|
2402
|
+
return apiCall(`/api/orders/${encodeURIComponent(orderId)}`, { apiKey: args.api_key });
|
|
2403
|
+
}
|
|
2345
2404
|
const auth = requireAuth(db, args.api_key);
|
|
2346
2405
|
if ('error' in auth)
|
|
2347
2406
|
return auth;
|
|
@@ -3000,8 +3059,41 @@ function handleReferral(args) {
|
|
|
3000
3059
|
score_pending: score.pending,
|
|
3001
3060
|
waz_total_earned: score.settled_waz,
|
|
3002
3061
|
},
|
|
3062
|
+
rewards_status: (() => {
|
|
3063
|
+
// RFC-002 §3.5 — 4 states + pending escrow visibility (PR-4)
|
|
3064
|
+
const optIn = db.prepare("SELECT rewards_opted_in FROM users WHERE id = ?").get(userId)?.rewards_opted_in ?? 0;
|
|
3065
|
+
const lastAction = db.prepare("SELECT action FROM rewards_applications WHERE user_id = ? ORDER BY created_at DESC LIMIT 1").get(userId)?.action;
|
|
3066
|
+
let state;
|
|
3067
|
+
let note;
|
|
3068
|
+
if (optIn === 1) {
|
|
3069
|
+
state = 'opted_in';
|
|
3070
|
+
note = 'You have opted into rewards. Commissions credit to wallet immediately when orders settle.';
|
|
3071
|
+
}
|
|
3072
|
+
else if (lastAction === 'deactivate') {
|
|
3073
|
+
state = 'deactivated';
|
|
3074
|
+
note = 'You actively deactivated rewards. Future commissions redirect directly to charity_fund (no escrow). You can re-apply via PWA #me.';
|
|
3075
|
+
}
|
|
3076
|
+
else if (lastAction === 'auto_downgrade') {
|
|
3077
|
+
state = 'auto_downgraded';
|
|
3078
|
+
note = 'You were auto-downgraded (failed to re-confirm consent within grace window). Future commissions held in pending_commission_escrow (30d window) — re-confirm via PWA #me to recover them.';
|
|
3079
|
+
}
|
|
3080
|
+
else {
|
|
3081
|
+
state = 'never_activated';
|
|
3082
|
+
note = 'Rewards inactive — attributions recorded; commissions held in pending_commission_escrow (30d window per protocol_params.rewards_opt_in.escrow_days) until you activate via PWA #me.';
|
|
3083
|
+
}
|
|
3084
|
+
const pending = db.prepare("SELECT COUNT(*) AS n, COALESCE(SUM(amount),0) AS total FROM pending_commission_escrow WHERE recipient_user_id = ? AND status = 'pending'").get(userId);
|
|
3085
|
+
const expired = db.prepare("SELECT COUNT(*) AS n, COALESCE(SUM(amount),0) AS total FROM pending_commission_escrow WHERE recipient_user_id = ? AND status = 'expired'").get(userId);
|
|
3086
|
+
return {
|
|
3087
|
+
state,
|
|
3088
|
+
opted_in: optIn === 1,
|
|
3089
|
+
note,
|
|
3090
|
+
pending_escrow: { count: pending.n, total_amount: pending.total },
|
|
3091
|
+
expired_to_charity: { count: expired.n, total_amount: expired.total },
|
|
3092
|
+
spec: 'RFC-002 §3.5 — rewards opt-in / 共建身份申请制',
|
|
3093
|
+
};
|
|
3094
|
+
})(),
|
|
3003
3095
|
tip: canL1
|
|
3004
|
-
? 'Use webaz_share_link(product_id) to generate a product share link. Both 3-tier commission and PV tree will apply.'
|
|
3096
|
+
? 'Use webaz_share_link(product_id) to generate a product share link. Both 3-tier commission and PV tree will apply (only when rewards_opted_in=1).'
|
|
3005
3097
|
: 'Complete 1 purchase first, then your share link will earn 3-tier commission. Until then, your share builds PV tree only.',
|
|
3006
3098
|
};
|
|
3007
3099
|
}
|
|
@@ -3013,6 +3105,35 @@ function handleShareLink(args) {
|
|
|
3013
3105
|
const userId = user.id;
|
|
3014
3106
|
const productId = args.product_id;
|
|
3015
3107
|
const sideArg = args.side || 'auto';
|
|
3108
|
+
// RFC-002 §3.5 valuation-layer gate — share_link generation requires opt-in
|
|
3109
|
+
const optIn = db.prepare("SELECT rewards_opted_in FROM users WHERE id = ?").get(userId)?.rewards_opted_in ?? 0;
|
|
3110
|
+
if (optIn !== 1) {
|
|
3111
|
+
const getParam = (key, def) => {
|
|
3112
|
+
const r = db.prepare("SELECT value FROM protocol_params WHERE key = ?").get(key);
|
|
3113
|
+
return r ? Number(r.value) : def;
|
|
3114
|
+
};
|
|
3115
|
+
const minOrders = getParam('rewards_opt_in.min_completed_orders', 1);
|
|
3116
|
+
const requirePasskey = getParam('rewards_opt_in.require_passkey', 1);
|
|
3117
|
+
const totalCompleted = db.prepare("SELECT COUNT(*) as n FROM orders WHERE buyer_id = ? AND status = 'completed'").get(userId).n;
|
|
3118
|
+
const passkeyCount = db.prepare("SELECT COUNT(*) as n FROM webauthn_credentials WHERE user_id = ?").get(userId).n;
|
|
3119
|
+
const missing = [];
|
|
3120
|
+
if (totalCompleted < minOrders)
|
|
3121
|
+
missing.push(`completed_orders ${totalCompleted}/${minOrders}`);
|
|
3122
|
+
if (requirePasskey === 1 && passkeyCount === 0)
|
|
3123
|
+
missing.push('passkey_not_registered');
|
|
3124
|
+
if (missing.length === 0)
|
|
3125
|
+
missing.push('application_not_submitted');
|
|
3126
|
+
return {
|
|
3127
|
+
error: 'rewards_opt_in_required',
|
|
3128
|
+
message: 'Share-link generation is a valuation-layer action — requires builder-identity opt-in (RFC-002 §3.5)',
|
|
3129
|
+
missing_requirements: missing,
|
|
3130
|
+
next_steps: [
|
|
3131
|
+
'Open PWA #me → tap "申请共建身份 / Apply for builder identity"',
|
|
3132
|
+
'Read the 8-second disclosure (cannot skip)',
|
|
3133
|
+
'Submit application — pre-checks run server-side',
|
|
3134
|
+
],
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3016
3137
|
const product = db.prepare("SELECT id, title, price, commission_rate FROM products WHERE id = ? AND status='active'").get(productId);
|
|
3017
3138
|
if (!product)
|
|
3018
3139
|
return { error: '商品不存在或已下架' };
|
|
@@ -3023,7 +3144,7 @@ function handleShareLink(args) {
|
|
|
3023
3144
|
else {
|
|
3024
3145
|
// auto = 与 PWA pickPreferredSide 对齐:尊重 placement_pref(team_count | pv_count)
|
|
3025
3146
|
// 老版只看 total_left_pv vs total_right_pv,team_count 用户被错算
|
|
3026
|
-
const u = db.prepare("SELECT placement_pref, total_left_pv, total_right_pv,
|
|
3147
|
+
const u = db.prepare("SELECT placement_pref, total_left_pv, total_right_pv, left_count, right_count FROM users WHERE id = ?")
|
|
3027
3148
|
.get(userId);
|
|
3028
3149
|
const pref = u?.placement_pref || 'team_count';
|
|
3029
3150
|
if (pref === 'pv_count') {
|
|
@@ -3036,22 +3157,10 @@ function handleShareLink(args) {
|
|
|
3036
3157
|
side = leftPv <= rightPv ? 'left' : 'right';
|
|
3037
3158
|
}
|
|
3038
3159
|
else {
|
|
3039
|
-
// team_count:
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
const row = db.prepare(`SELECT ${childField} FROM users WHERE id = ?`).get(current);
|
|
3044
|
-
const next = row?.[childField] || null;
|
|
3045
|
-
if (!next)
|
|
3046
|
-
break;
|
|
3047
|
-
count++;
|
|
3048
|
-
current = next;
|
|
3049
|
-
}
|
|
3050
|
-
return count;
|
|
3051
|
-
};
|
|
3052
|
-
const lCount = countLeg(userId, 'left_child_id');
|
|
3053
|
-
const rCount = countLeg(userId, 'right_child_id');
|
|
3054
|
-
side = lCount <= rCount ? 'left' : 'right';
|
|
3160
|
+
// team_count: 整棵子树人数(增量维护的 left_count/right_count,与 PWA pickPreferredSide 对齐)。
|
|
3161
|
+
// 2026-06-04 修:旧版沿单条脊链数(countLeg)名实不符 → 选边失真。分享链接的 side 会被注册时
|
|
3162
|
+
// 当 placement_side 显式采用,必须与 PWA joinPowerLeg 用同一指标,否则两路径不一致。
|
|
3163
|
+
side = (Number(u?.left_count ?? 0) <= Number(u?.right_count ?? 0)) ? 'left' : 'right';
|
|
3055
3164
|
}
|
|
3056
3165
|
}
|
|
3057
3166
|
const completed = db.prepare("SELECT COUNT(*) as n FROM orders WHERE buyer_id = ? AND status = 'completed'").get(userId).n;
|
|
@@ -3346,6 +3455,19 @@ function handleShareables(args) {
|
|
|
3346
3455
|
}
|
|
3347
3456
|
// ─── P3 RFQ / bid / chat / auto_bid(HTTP 转发到 PWA,复用所有校验+状态机)────
|
|
3348
3457
|
const PWA_API_BASE = process.env.WEBAZ_PWA_API_BASE || 'http://localhost:3000/api';
|
|
3458
|
+
// RFC-003 P1: 公开读端点按模式取数 —— network → apiCall(webaz.xyz + Bearer + 15s 超时);sandbox → 本地 PWA。
|
|
3459
|
+
// subpath 不含 /api 前缀(如 '/leaderboard?...'),内部按模式补齐。
|
|
3460
|
+
async function readEndpoint(tool, subpath) {
|
|
3461
|
+
if (toolBackend(tool) === 'network')
|
|
3462
|
+
return apiCall('/api' + subpath);
|
|
3463
|
+
try {
|
|
3464
|
+
const r = await fetch(PWA_API_BASE + subpath, { signal: AbortSignal.timeout(15_000) });
|
|
3465
|
+
return await r.json();
|
|
3466
|
+
}
|
|
3467
|
+
catch (e) {
|
|
3468
|
+
return { error: String(e.message) };
|
|
3469
|
+
}
|
|
3470
|
+
}
|
|
3349
3471
|
async function pwaApi(method, path, apiKey, body) {
|
|
3350
3472
|
const opts = {
|
|
3351
3473
|
method,
|
|
@@ -3755,13 +3877,7 @@ async function handlePriceHistory(args) {
|
|
|
3755
3877
|
const pid = String(args.product_id || '');
|
|
3756
3878
|
if (!pid)
|
|
3757
3879
|
return { error: 'product_id required' };
|
|
3758
|
-
|
|
3759
|
-
const r = await fetch(PWA_API_BASE + '/products/' + encodeURIComponent(pid) + '/price-history');
|
|
3760
|
-
return await r.json();
|
|
3761
|
-
}
|
|
3762
|
-
catch (e) {
|
|
3763
|
-
return { error: String(e.message) };
|
|
3764
|
-
}
|
|
3880
|
+
return readEndpoint('webaz_price_history', '/products/' + encodeURIComponent(pid) + '/price-history');
|
|
3765
3881
|
}
|
|
3766
3882
|
async function handleCharity(args) {
|
|
3767
3883
|
const action = String(args.action || '');
|
|
@@ -3927,15 +4043,8 @@ async function handleLeaderboard(args) {
|
|
|
3927
4043
|
const VALID_KINDS = ['products', 'creators', 'buyers', 'sellers', 'value_products', 'agents', 'arbitrators', 'verifiers'];
|
|
3928
4044
|
if (!VALID_KINDS.includes(kind))
|
|
3929
4045
|
return { error: `kind 必须是 ${VALID_KINDS.join(' / ')}` };
|
|
3930
|
-
// 排行榜公开(不需 api_key
|
|
3931
|
-
|
|
3932
|
-
try {
|
|
3933
|
-
const r = await fetch(PWA_API_BASE + '/leaderboard?kind=' + kind + '&limit=' + limit);
|
|
3934
|
-
return await r.json();
|
|
3935
|
-
}
|
|
3936
|
-
catch (e) {
|
|
3937
|
-
return { error: `PWA API unreachable: ${e.message}` };
|
|
3938
|
-
}
|
|
4046
|
+
// 排行榜公开(不需 api_key)。RFC-003 P1:network 走 webaz.xyz,sandbox 走本地。
|
|
4047
|
+
return readEndpoint('webaz_leaderboard', '/leaderboard?kind=' + kind + '&limit=' + limit);
|
|
3939
4048
|
}
|
|
3940
4049
|
async function handleAuction(args) {
|
|
3941
4050
|
const apiKey = String(args.api_key || '');
|
|
@@ -4058,7 +4167,7 @@ export async function startMCPServer() {
|
|
|
4058
4167
|
{
|
|
4059
4168
|
uri: MANIFEST_URI,
|
|
4060
4169
|
name: 'WebAZ Protocol Manifest',
|
|
4061
|
-
description: '
|
|
4170
|
+
description: 'Full WebAZ machine-readable spec. Covers: state machine, economic model, roles, dispute system, Skill market, reputation, agent operating guide. Reading this is enough for an AI agent to participate in the protocol — no extra docs needed.',
|
|
4062
4171
|
mimeType: 'application/json',
|
|
4063
4172
|
},
|
|
4064
4173
|
],
|
|
@@ -4085,34 +4194,34 @@ export async function startMCPServer() {
|
|
|
4085
4194
|
const PROMPTS = [
|
|
4086
4195
|
{
|
|
4087
4196
|
name: 'webaz-place-order',
|
|
4088
|
-
description: '
|
|
4197
|
+
description: 'Guide buyer agent through discover → verify_price → lock → place_order (incl. precise match for pasted external links). Use this when the user hands you a product URL.',
|
|
4089
4198
|
arguments: [
|
|
4090
|
-
{ name: 'user_intent', description: '
|
|
4199
|
+
{ name: 'user_intent', description: 'User raw intent or pasted link text', required: true },
|
|
4091
4200
|
],
|
|
4092
4201
|
},
|
|
4093
4202
|
{
|
|
4094
4203
|
name: 'webaz-list-product',
|
|
4095
|
-
description: '
|
|
4204
|
+
description: 'Guide seller agent through product listing — covers SEO/agent-friendliness best practices (fill brand/model/specs/return_days/handling_hours and other Schema.org bonus fields).',
|
|
4096
4205
|
arguments: [
|
|
4097
|
-
{ name: 'product_summary', description: '
|
|
4206
|
+
{ name: 'product_summary', description: 'Seller-described product summary', required: true },
|
|
4098
4207
|
],
|
|
4099
4208
|
},
|
|
4100
4209
|
{
|
|
4101
4210
|
name: 'webaz-onboard',
|
|
4102
|
-
description: '
|
|
4211
|
+
description: 'Onboarding for a new agent first connecting to webaz — explains protocol nature / pre-launch state / MLM shape / registration path / user-authorization boundaries. Read webaz_info first, then run this prompt.',
|
|
4103
4212
|
arguments: [],
|
|
4104
4213
|
},
|
|
4105
4214
|
{
|
|
4106
4215
|
name: 'webaz-handle-dispute',
|
|
4107
|
-
description: '
|
|
4216
|
+
description: 'Guide handling when an order goes wrong — distinguishes three paths: negotiated refund / dispute arbitration / seller-initiated cancel. Reminds Iron-Rule (arbitrate requires PWA + Passkey).',
|
|
4108
4217
|
arguments: [
|
|
4109
|
-
{ name: 'order_id', description: '
|
|
4110
|
-
{ name: 'issue_summary', description: '
|
|
4218
|
+
{ name: 'order_id', description: 'The problematic order ID', required: true },
|
|
4219
|
+
{ name: 'issue_summary', description: 'Issue description (wrong item received / not received / quality problem, etc.)', required: true },
|
|
4111
4220
|
],
|
|
4112
4221
|
},
|
|
4113
4222
|
{
|
|
4114
4223
|
name: 'webaz-cross-border',
|
|
4115
|
-
description: '
|
|
4224
|
+
description: 'Onboarding for China cross-border sellers — domestic uses WebAZ native protocol / cross-border exposes UCP merchant endpoint to global agents. Explains dual-rail architecture + compliance boundaries.',
|
|
4116
4225
|
arguments: [],
|
|
4117
4226
|
},
|
|
4118
4227
|
];
|
|
@@ -4229,19 +4338,22 @@ export async function startMCPServer() {
|
|
|
4229
4338
|
result = await handleSearch(args);
|
|
4230
4339
|
break;
|
|
4231
4340
|
case 'webaz_verify_price':
|
|
4232
|
-
result = handleVerifyPrice(args);
|
|
4341
|
+
result = await handleVerifyPrice(args);
|
|
4233
4342
|
break;
|
|
4234
4343
|
case 'webaz_list_product':
|
|
4235
4344
|
result = await handleListProduct(args);
|
|
4236
4345
|
break;
|
|
4237
4346
|
case 'webaz_place_order':
|
|
4238
|
-
result = handlePlaceOrder(args);
|
|
4347
|
+
result = await handlePlaceOrder(args);
|
|
4239
4348
|
break;
|
|
4240
4349
|
case 'webaz_update_order':
|
|
4241
4350
|
result = await handleUpdateOrder(args);
|
|
4242
4351
|
break;
|
|
4243
4352
|
case 'webaz_get_status':
|
|
4244
|
-
result = handleGetStatus(args);
|
|
4353
|
+
result = await handleGetStatus(args);
|
|
4354
|
+
break;
|
|
4355
|
+
case 'webaz_feedback':
|
|
4356
|
+
result = await handleFeedback(args);
|
|
4245
4357
|
break;
|
|
4246
4358
|
case 'webaz_wallet':
|
|
4247
4359
|
result = await handleWallet(args);
|
|
@@ -4337,6 +4449,29 @@ export async function startMCPServer() {
|
|
|
4337
4449
|
result = { error: `执行出错:${err.message}` };
|
|
4338
4450
|
}
|
|
4339
4451
|
recordToolCall(name, args, result, Date.now() - t0);
|
|
4452
|
+
// RFC-004 现场证据:记本次调用的脱敏摘要(只 arg key 名,不含值)。webaz_feedback 自身不入 buffer。
|
|
4453
|
+
if (name !== 'webaz_feedback') {
|
|
4454
|
+
const isErr = !!result && typeof result === 'object' && 'error' in result;
|
|
4455
|
+
pushRecentCall({
|
|
4456
|
+
tool: name,
|
|
4457
|
+
arg_keys: Object.keys(args || {}).filter(k => k !== 'api_key'),
|
|
4458
|
+
outcome: isErr ? 'error' : 'ok',
|
|
4459
|
+
mode: toolBackend(name),
|
|
4460
|
+
ts: new Date().toISOString(),
|
|
4461
|
+
});
|
|
4462
|
+
}
|
|
4463
|
+
// RFC-003 P0: 给每个工具结果盖模式戳(诚实可见,防把 sandbox 当 live 网络)
|
|
4464
|
+
// P3: handler 可自行预设 _mode(如 register 在 network 模式返回引导,不是 sandbox 结果)→ 不覆盖。
|
|
4465
|
+
const backend = toolBackend(name);
|
|
4466
|
+
if (result && typeof result === 'object' && !Array.isArray(result)) {
|
|
4467
|
+
const r = result;
|
|
4468
|
+
if (!('_mode' in r))
|
|
4469
|
+
r._mode = backend;
|
|
4470
|
+
if (r._mode === 'sandbox' && !('_sandbox_note' in r)) {
|
|
4471
|
+
r._sandbox_note =
|
|
4472
|
+
'SANDBOX: 本地结果,非 webaz.xyz 全网真实状态 / local-only, NOT the live webaz.xyz network';
|
|
4473
|
+
}
|
|
4474
|
+
}
|
|
4340
4475
|
return {
|
|
4341
4476
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
4342
4477
|
};
|
|
@@ -4344,6 +4479,7 @@ export async function startMCPServer() {
|
|
|
4344
4479
|
const transport = new StdioServerTransport();
|
|
4345
4480
|
await server.connect(transport);
|
|
4346
4481
|
console.error('✅ WebAZ MCP Server 已启动,等待 Agent 连接...');
|
|
4482
|
+
console.error(modeBanner());
|
|
4347
4483
|
}
|
|
4348
4484
|
// ─── 工具函数 ─────────────────────────────────────────────────
|
|
4349
4485
|
function addHours(date, hours) {
|