@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.
Files changed (36) hide show
  1. package/LICENSE +1 -1
  2. package/NOTICE +58 -0
  3. package/README.md +84 -6
  4. package/dist/layer0-foundation/L0-2-state-machine/engine.js +3 -0
  5. package/dist/layer1-agent/L1-1-mcp-server/server.js +840 -704
  6. package/dist/layer2-business/L2-8-feedback/build-feedback-engine.js +169 -0
  7. package/dist/layer3-trust/L3-1-dispute-engine/dispute-engine.js +16 -0
  8. package/dist/layer4-economics/L4-3-reputation/reputation-engine.js +1 -0
  9. package/dist/mcp.js +7 -3
  10. package/dist/pwa/data/onboarding-cases.js +345 -0
  11. package/dist/pwa/data/onboarding-quiz.js +247 -0
  12. package/dist/pwa/public/app.js +1469 -105
  13. package/dist/pwa/public/i18n.js +282 -2
  14. package/dist/pwa/public/icon-192.png +0 -0
  15. package/dist/pwa/public/icon-512.png +0 -0
  16. package/dist/pwa/public/manifest.json +5 -2
  17. package/dist/pwa/public/openapi.json +1 -1
  18. package/dist/pwa/public/sw.js +1 -1
  19. package/dist/pwa/routes/admin-protocol-params.js +80 -2
  20. package/dist/pwa/routes/admin-reports.js +14 -9
  21. package/dist/pwa/routes/auth-read.js +3 -1
  22. package/dist/pwa/routes/build-feedback.js +67 -0
  23. package/dist/pwa/routes/disputes-write.js +149 -1
  24. package/dist/pwa/routes/governance-auto-deactivate.js +108 -0
  25. package/dist/pwa/routes/governance-onboarding.js +785 -0
  26. package/dist/pwa/routes/leaderboard.js +10 -2
  27. package/dist/pwa/routes/orders-action.js +5 -1
  28. package/dist/pwa/routes/products-meta.js +30 -0
  29. package/dist/pwa/routes/profile-identity.js +1 -1
  30. package/dist/pwa/routes/public-utils.js +44 -0
  31. package/dist/pwa/routes/rewards-apply.js +210 -0
  32. package/dist/pwa/routes/rewards-auto-downgrade.js +65 -0
  33. package/dist/pwa/routes/rewards-escrow-expire.js +48 -0
  34. package/dist/pwa/routes/webauthn.js +1 -1
  35. package/dist/pwa/server.js +590 -79
  36. package/package.json +11 -6
package/LICENSE CHANGED
@@ -16,7 +16,7 @@ Business Source License 1.1
16
16
  Change License: MIT
17
17
 
18
18
  For information about alternative licensing arrangements for the
19
- Licensed Work, please contact seasons.agents@gmail.com.
19
+ Licensed Work, please contact licensing@webaz.xyz.
20
20
  License text copyright © 2024 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
21
21
 
22
22
  Terms
package/NOTICE ADDED
@@ -0,0 +1,58 @@
1
+ WebAZ — Licensing Notice
2
+ =========================
3
+
4
+ Copyright (c) 2026 seasonsagents-art and WebAZ contributors
5
+
6
+
7
+ Current License (since 2026-05-18)
8
+ ----------------------------------
9
+
10
+ Business Source License 1.1 (BUSL-1.1).
11
+ See LICENSE for full terms.
12
+
13
+ Licensor: seasonsagents-art
14
+ Licensed Work: WebAZ — Agent-native decentralized commerce protocol
15
+ Additional Use Grant: You may make production use of the Licensed Work,
16
+ provided that your use does not include offering the
17
+ Licensed Work to third parties as a hosted or managed
18
+ service that is substantially similar to, or competes
19
+ with, the WebAZ commerce protocol service operated by
20
+ the Licensor.
21
+ Change Date: 2030-05-18
22
+ Change License: MIT
23
+
24
+ On the Change Date the Licensed Work automatically converts to the
25
+ Change License (MIT) for all purposes.
26
+
27
+
28
+ Historical Licensing
29
+ --------------------
30
+
31
+ All versions and git commits published BEFORE 2026-05-18 were released under
32
+ the MIT License. That grant is irrevocable. Copies, forks, and derivatives
33
+ made from those earlier versions remain MIT-licensed in perpetuity.
34
+
35
+ The license change applies only to commits and releases dated on or after
36
+ 2026-05-18.
37
+
38
+
39
+ Third-Party Components
40
+ ----------------------
41
+
42
+ This software incorporates third-party open-source libraries listed in
43
+ package.json. Each is governed by its own license; see the respective
44
+ package's LICENSE file for terms.
45
+
46
+
47
+ Trademarks
48
+ ----------
49
+
50
+ "WebAZ" and the WebAZ logo are trademarks of seasonsagents-art. The license
51
+ does not grant any trademark rights.
52
+
53
+
54
+ Questions
55
+ ---------
56
+
57
+ For licensing questions, including commercial license inquiries that fall
58
+ outside the Additional Use Grant above, contact: licensing@webaz.xyz
package/README.md CHANGED
@@ -6,7 +6,12 @@
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/@seasonkoh/webaz.svg)](https://www.npmjs.com/package/@seasonkoh/webaz)
8
8
  [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-active-blue)](https://registry.modelcontextprotocol.io/v0/servers?search=webaz)
9
- [![License: BUSL-1.1](https://img.shields.io/badge/License-BUSL--1.1-orange.svg)](LICENSE) [![Change Date: 2030-05-18](https://img.shields.io/badge/Change%20Date-2030--05--18-blue.svg)](NOTICE)
9
+ [![License: BUSL-1.1](https://img.shields.io/badge/License-BUSL--1.1-orange.svg)](LICENSE) [![Change Date: 2030-05-18](https://img.shields.io/badge/Change%20Date-2030--05--18-blue.svg)](NOTICE) ![Status: Pre-launch](https://img.shields.io/badge/Status-Pre--launch-yellow.svg)
10
+
11
+ > 🚧 **Pre-launch · 预发布阶段** — v1.0 公示中(起算 2026-05-31)· 0 真用户 · verifier + arbitrator 全为 fixture · 经济模型未结算 · 不建议生产使用。
12
+ > 🚧 **Pre-launch stage** — v1.0 public-notice period (started 2026-05-31) · 0 real users · verifier + arbitrator are fixtures · economic model un-settled · **not for production use**.
13
+ >
14
+ > 详见 / Details: [`docs/CHARTER.md`](docs/CHARTER.md) · [`docs/META-RULES-FULL.md`](docs/META-RULES-FULL.md) · [`docs/ECONOMIC-MODEL.md`](docs/ECONOMIC-MODEL.md) · [`/api/protocol-status`](https://webaz.xyz/api/protocol-status)
10
15
 
11
16
  让 AI Agent 成为去中心化商业协议的原生参与者。卖家零额外工作量接入新渠道,买家通过 Agent 自动购物,人类与 AI 在同一协议上平等参与。
12
17
 
@@ -83,7 +88,16 @@
83
88
 
84
89
  ### 方式一:Claude MCP 接入(Agent 原生体验)
85
90
 
86
- **1. 添加到 Claude Desktop 配置**
91
+ MCP server 有两种模式 / The MCP runs in one of two modes:
92
+
93
+ | 模式 / Mode | 数据源 | 用途 | 如何触发 |
94
+ |---|---|---|---|
95
+ | 🟢 **NETWORK** | `webaz.xyz` 共享生产网络(带你的 `api_key`) | 真实加入网络、和别人交易 | 配了 `WEBAZ_API_KEY` |
96
+ | 🟡 **SANDBOX** | 本机本地 SQLite(`~/.webaz/webaz.db`) | 离线试玩 / 开发,**与全网隔离** | 未配 `WEBAZ_API_KEY`(默认) |
97
+
98
+ > 🟢 NETWORK = your agent acts on the live shared network. 🟡 SANDBOX = local-only, private to your machine, **not** the live network. Every tool result is stamped with `_mode` so you always know which one you're in.
99
+
100
+ **A. 先离线试玩(SANDBOX,零配置)**
87
101
 
88
102
  编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`:
89
103
 
@@ -98,15 +112,35 @@
98
112
  }
99
113
  ```
100
114
 
101
- 重启 Claude Desktop。无需手动安装,`npx` 会自动下载运行。
115
+ 重启 Claude Desktop。`npx` 自动下载运行。此时所有数据都在本机沙盒,可放心试 `webaz_register` / `webaz_search` / 下单全流程。
116
+
117
+ **B. 真正加入网络(NETWORK)**
118
+
119
+ 1. 在 [webaz.xyz](https://webaz.xyz) 注册账号(需邀请码;注册时绑定 Passkey 成为可问责真人)
120
+ 2. 「我的 / 设置」→ 复制 `api_key`
121
+ 3. 配置里加上 `WEBAZ_API_KEY` 环境变量:
122
+
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "webaz": {
127
+ "command": "npx",
128
+ "args": ["-y", "@seasonkoh/webaz"],
129
+ "env": { "WEBAZ_API_KEY": "你的_api_key" }
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ > NETWORK 模式下 `webaz_register` **不自助建号**(账号必须由真人在 webaz.xyz 创建 + 绑 Passkey,这是协议的可问责性要求)。注册以外的交易工具——搜索 / 锁价 / 下单 / 上架 / 履约 / 查单——都直接在共享网络上跑。
102
136
 
103
- **3. 开始使用**
137
+ **C. 开始使用**
104
138
 
105
139
  在 Claude 对话里说:
106
140
 
107
- > "帮我在 WebAZ 注册一个买家账号,然后搜索一下有什么商品"
141
+ > "帮我在 WebAZ 搜索一下有什么商品,挑性价比高的下单"
108
142
 
109
- Claude 会自动调用 `webaz_register` `webaz_search` 完成操作。
143
+ Claude 会自动调用 `webaz_search` `webaz_verify_price` → `webaz_place_order` → `webaz_get_status` 完成发现→下单→追踪全流程。
110
144
 
111
145
  ---
112
146
 
@@ -234,6 +268,32 @@ npm run test-manifest# 测试协议 Manifest
234
268
 
235
269
  ---
236
270
 
271
+ ## 架构总览 / Architecture map
272
+
273
+ > 给 AI agent / 新贡献者:不用扫全仓,从下表对应层入手。改代码的 agent 请先读 [`AGENTS.md`](AGENTS.md)。
274
+ > For AI agents / new contributors: don't scan the whole repo — start from the layer your change belongs to. Agents modifying code: read [`AGENTS.md`](AGENTS.md) first.
275
+
276
+ 一套代码两个运行时:**MCP server**(`src/mcp.ts`,给 AI agent)+ **PWA**(`src/pwa/`,给人类)—— 同后端、同规则。
277
+ One codebase, two runtimes: the **MCP server** (for AI agents) and the **PWA** (for humans) share the same backend and rules.
278
+
279
+ 代码分 8 层(`src/layerN-*/`,由底向上依赖)/ Code is layered (`src/layerN-*/`, bottom-up):
280
+
281
+ | Layer | 它是什么 / What |
282
+ |---|---|
283
+ | `layer0-foundation` | DB schema · 订单**状态机** state-machine · manifest |
284
+ | `layer1-agent` | **MCP server**(`L1-1-mcp-server/server.ts`,最常改)· 身份 / 外部锚点 identity / anchor |
285
+ | `layer2-business` · `layer2-commerce` | 通知 / SNF / anchor registry 等业务 business logic |
286
+ | `layer3-trust` | 争议引擎 dispute engine |
287
+ | `layer4-economics` | 声誉 reputation · 技能市场 skill-market |
288
+ | `layer5-decentralized` · `layer6-scale` | 治理 / 扩展(部分后续阶段)governance / scale (some reserved) |
289
+
290
+ 关键入口 / Key entry files:
291
+ - `src/mcp.ts` → tools 实现在 `src/layer1-agent/L1-1-mcp-server/server.ts`
292
+ - `src/pwa/server.ts` + `src/pwa/routes/` → PWA + HTTP API(人 / agent 共用生产端点)
293
+ - `src/cron-enforcement.ts` → 协议自动判责执行(超时→处置)auto state-machine enforcement
294
+
295
+ ---
296
+
237
297
  ## 当前阶段
238
298
 
239
299
  **Phase 0 · 概念验证** ✅
@@ -315,3 +375,21 @@ npm run test-manifest# 测试协议 Manifest
315
375
  - [ ] 评价系统(结构化 1-5 星,反哺声誉)
316
376
  - [ ] 证据上传通道(争议附图)
317
377
  - [ ] 治理 DAO
378
+
379
+ ---
380
+
381
+ ## 联系 / Contact
382
+
383
+ | 用途 / Purpose | Email | 详情 / Details |
384
+ |---|---|---|
385
+ | 通用咨询 / General inquiries | `contact@webaz.xyz` | — |
386
+ | 安全漏洞 / Security vulnerabilities | `security@webaz.xyz` | [SECURITY.md](SECURITY.md) — 强烈优先用 [GitHub Security Advisory](https://github.com/seasonsagents-art/webaz/security/advisories) / Strongly prefer Advisory |
387
+ | 行为准则举报 / Code of Conduct reports | `conduct@webaz.xyz` | [docs/CODE_OF_CONDUCT.md](docs/CODE_OF_CONDUCT.md) §7 |
388
+ | BSL 商业授权 / Commercial licensing | `licensing@webaz.xyz` | [LICENSE](LICENSE) / [NOTICE](NOTICE) |
389
+
390
+ > 📬 上述均为 Cloudflare Email Routing forwarding alias;phase A solo 阶段统一转发到创始人个人邮箱,响应水平为**个人级**(非企业 SLA);phase B+ 形成 maintainer 群后会切到团队 triage(无需改文档)。
391
+ > 📬 All addresses are Cloudflare Email Routing forwarding aliases; in phase A solo, they route to the founder's personal inbox with **personal-level response** (not enterprise SLA); phase B+ will switch to maintainer team triage (no doc change needed).
392
+
393
+ **Bug 报告 / 功能想法 / RFC**:走 [GitHub Issues](https://github.com/seasonsagents-art/webaz/issues) 或 [Discussions](https://github.com/seasonsagents-art/webaz/discussions);PR 流程见 [CONTRIBUTING.md](CONTRIBUTING.md)。
394
+
395
+ **Bug reports / feature ideas / RFCs**: please use [GitHub Issues](https://github.com/seasonsagents-art/webaz/issues) or [Discussions](https://github.com/seasonsagents-art/webaz/discussions); PR workflow per [CONTRIBUTING.md](CONTRIBUTING.md).
@@ -5,6 +5,9 @@
5
5
  * 1. transition() — 执行状态转移(验证权限 + 记录历史)
6
6
  * 2. checkTimeouts() — 扫描超时订单,自动判责
7
7
  * 3. getStatus() — 查询订单当前状态和责任方
8
+ *
9
+ * 关联 / Related: AGENTS.md · 元规则 #1 当一切可见 / #2 代码即规则(状态机=规则的代码化,改这里=改协议行为) ·
10
+ * 合法转移表见 transitions.ts · 协议级改动审批见 CHARTER §3.2
8
11
  */
9
12
  import { generateId } from '../L0-1-database/schema.js';
10
13
  import { appendOrderEvent } from './order-chain.js';