@seasonkoh/webaz 0.1.16 → 0.1.18

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 (39) hide show
  1. package/README.md +60 -5
  2. package/dist/layer0-foundation/L0-2-state-machine/engine.js +3 -0
  3. package/dist/layer1-agent/L1-1-mcp-server/server.js +899 -720
  4. package/dist/layer2-business/L2-8-feedback/build-feedback-engine.js +287 -0
  5. package/dist/layer2-business/L2-9-contribution/build-reputation-engine.js +102 -0
  6. package/dist/layer2-business/L2-9-contribution/build-tasks-engine.js +180 -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 +1459 -96
  13. package/dist/pwa/public/i18n.js +303 -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 +82 -0
  23. package/dist/pwa/routes/build-reputation.js +10 -0
  24. package/dist/pwa/routes/build-tasks.js +73 -0
  25. package/dist/pwa/routes/disputes-write.js +149 -1
  26. package/dist/pwa/routes/governance-auto-deactivate.js +108 -0
  27. package/dist/pwa/routes/governance-onboarding.js +785 -0
  28. package/dist/pwa/routes/leaderboard.js +10 -2
  29. package/dist/pwa/routes/orders-action.js +5 -1
  30. package/dist/pwa/routes/products-meta.js +30 -0
  31. package/dist/pwa/routes/profile-identity.js +1 -1
  32. package/dist/pwa/routes/public-utils.js +44 -0
  33. package/dist/pwa/routes/rewards-apply.js +210 -0
  34. package/dist/pwa/routes/rewards-auto-downgrade.js +65 -0
  35. package/dist/pwa/routes/rewards-escrow-expire.js +48 -0
  36. package/dist/pwa/routes/wallet-write.js +17 -31
  37. package/dist/pwa/routes/webauthn.js +1 -1
  38. package/dist/pwa/server.js +641 -64
  39. package/package.json +6 -3
@@ -1625,7 +1625,7 @@ const _EN = {
1625
1625
  'UI 显示语言': 'UI language',
1626
1626
  '关于': 'About',
1627
1627
  '版本': 'Version',
1628
- '开源仓库': 'Source repo',
1628
+ '源码仓库': 'Source repo',
1629
1629
  '帮助': 'Help',
1630
1630
  '成长任务指引': 'Growth task guide',
1631
1631
 
@@ -4569,6 +4569,48 @@ const _EN = {
4569
4569
  '自动选边偏好': 'Auto side preference',
4570
4570
  '已自动加入「我的分享」': 'Auto added to "My Shares"',
4571
4571
  '完成该商品的购买后再分享': 'Share after completing the purchase of this item',
4572
+ '待补': 'Missing',
4573
+ '前往 #me 申请共建身份': 'Go to #me to apply for builder identity',
4574
+ '联系我们': 'Contact us',
4575
+ '合作 / 反馈 / 合规咨询': 'Partnerships / feedback / compliance',
4576
+ '申请共建身份': 'Apply for builder identity',
4577
+ '共建身份': 'Builder identity',
4578
+ '共建身份管理': 'Manage builder identity',
4579
+ '已是共建身份': 'Already opted in',
4580
+ '你已 opted-in。如需查看状态或退出,前往 ': 'You are opted in. To view status or opt out, go to ',
4581
+ '本流程与购物无关': 'This flow is not part of shopping',
4582
+ '你可以随时退出,不影响任何已下单或未来订单。本流程涉及经济关系登记(三级佣金 + 双轨配对),请仔细阅读全部条款。': 'You can leave anytime without affecting any past or future orders. This is an economic-relationship registration (3-tier commission + binary PV matching) — please read all terms carefully.',
4583
+ '门槛(全部通过才能申请)': 'Eligibility (all must pass to apply)',
4584
+ '已完成订单': 'Completed orders',
4585
+ 'Passkey 已注册': 'Passkey registered',
4586
+ '必需': 'required',
4587
+ '可选': 'optional',
4588
+ '同意文本': 'Consent text',
4589
+ '请先完成上述未达标指标,完成后再来申请': 'Please complete the missing items above first, then come back to apply',
4590
+ '我已阅读全部条款,理解 commission 与 PV 树结构的合规边界': 'I have read all terms and understand the compliance boundaries of commission + PV tree structure',
4591
+ '我自愿申请,无人收买 / 诱导': 'I apply voluntarily — no one is bribing or inducing me',
4592
+ '用 Passkey 签发提交申请': 'Submit application with Passkey signature',
4593
+ '请通过 Passkey / 生物识别确认...': 'Please confirm via Passkey / biometric...',
4594
+ 'Passkey 签发失败:': 'Passkey signature failed:',
4595
+ '提交中...': 'Submitting...',
4596
+ '✅ 共建身份激活成功': '✅ Builder identity activated',
4597
+ '已从 escrow 拨回:': 'Restored from escrow:',
4598
+ '笔': 'entries',
4599
+ '共建身份激活中': 'Active',
4600
+ '未激活': 'Never activated',
4601
+ '已自动降级(consent 未确认)': 'Auto-downgraded (consent not re-confirmed)',
4602
+ '已退出': 'Deactivated',
4603
+ 'Consent version': 'Consent version',
4604
+ '待领 escrow': 'Pending escrow',
4605
+ 'opt-in 后这笔钱会拨回钱包。30 天未领过期入公益。': 'These will be restored to your wallet on opt-in. Unclaimed escrow expires to charity after 30 days.',
4606
+ '历史过期入公益': 'Historical (expired to charity)',
4607
+ '退出共建身份后,未来 commission 直接入公益(无 escrow)。可随时再申请。': 'After deactivation, future commission goes directly to charity (no escrow). You can re-apply anytime.',
4608
+ '退出共建身份': 'Deactivate',
4609
+ '重新申请': 'Re-apply',
4610
+ '协议依据:': 'Protocol spec:',
4611
+ '确认退出共建身份?未来 commission 将直接入公益,可随时再申请。': 'Confirm opt-out? Future commission goes directly to charity. You can re-apply anytime.',
4612
+ '✅ 已退出共建身份': '✅ Deactivated',
4613
+ '申请制 · 含锁仓金': 'opt-in · with escrow',
4572
4614
  '点击复制 →': 'Click to copy →',
4573
4615
  '已申请公开': 'Public application submitted',
4574
4616
  '· 协议费仅 2%': '· Protocol fee only 2%',
@@ -5008,7 +5050,7 @@ const _EN = {
5008
5050
  '购买体验分享 · 公益贡献': 'Share purchase notes · contribute to charity',
5009
5051
  '你所在地区不分多级返佣 — 产生的佣金已自动捐入公益基金': 'Your region prohibits multi-level commission — commissions are auto-donated to the charity fund',
5010
5052
  '分享体验给其他买家(你所在地区返佣将捐入公益基金)': 'Share your experience (commissions from your region go to the charity fund)',
5011
- '区域禁 MLM 入池': 'MLM-prohibited region → charity',
5053
+ '区域佣金回流公益': 'Region commission cap → charity',
5012
5054
 
5013
5055
  // ── 笔记选订单 modal ─────────────────────────────────────────
5014
5056
  '选择要发笔记的订单': 'Pick an order to post a note for',
@@ -5769,6 +5811,265 @@ const _EN = {
5769
5811
  '已邀请': 'Invited',
5770
5812
  '处理状态': 'Status',
5771
5813
  '处理': 'Handle',
5814
+
5815
+ // ── #1093 阶段 1b 治理岗位申请页(governance onboarding apply UI) ──
5816
+ '本流程是治理岗位申请,不是赚钱机会':
5817
+ 'This is a governance application, not an income opportunity',
5818
+ 'phase A 不发放任何现金 / WAZ 报酬。治理是公共贡献。详 docs/GOVERNANCE-ONBOARDING.md。':
5819
+ 'Phase A pays NO cash / WAZ. Governance is a public contribution. See docs/GOVERNANCE-ONBOARDING.md.',
5820
+ '门槛(全部通过才能申请)': 'Requirements (all must pass to apply)',
5821
+ '请先完成上述未达标指标,完成后再来申请':
5822
+ 'Please meet the unmet requirements above first, then come back to apply',
5823
+ '知情同意(双勾选)': 'Informed consent (two checkboxes)',
5824
+ '我已阅读 GOVERNANCE-ONBOARDING / ARBITRATION-PLAYBOOK / META-RULES / CHARTER,理解角色责任':
5825
+ 'I have read GOVERNANCE-ONBOARDING / ARBITRATION-PLAYBOOK / META-RULES / CHARTER and understand the role responsibilities',
5826
+ '我自愿申请,无人收买 / 诱导':
5827
+ 'I voluntarily apply, no coercion or induction',
5828
+ '等': 'wait',
5829
+ '用 Passkey 签发提交申请': 'Sign with Passkey to submit application',
5830
+ '请通过 Passkey / 生物识别确认...': 'Please confirm via Passkey / biometric...',
5831
+ 'Passkey 签发失败:': 'Passkey signing failed:',
5832
+ '门槛未达标': 'Requirements not met',
5833
+ '申请已提交,等待 maintainer review': 'Application submitted, waiting for maintainer review',
5834
+
5835
+ // ── #1093 阶段 2a onboarding 学习包 + 题目 ────────────────────
5836
+ '仲裁员上岗 onboarding': 'Arbitrator onboarding',
5837
+ '审核员上岗 onboarding': 'Verifier onboarding',
5838
+ '§4.1 学习包': '§4.1 Study pack',
5839
+ '§4.3 题目': '§4.3 Quiz',
5840
+ '阅读以下文档,勾选已读。本步骤不写入 DB(仅本地标记),实际理解由题目和案例考察。':
5841
+ 'Read the documents below and check off as read. This step is local-only (not persisted to DB); actual understanding is assessed via quiz and case studies.',
5842
+ '10 多选 + 5 短答,合格线 12/15 (80%)':
5843
+ '10 multiple-choice + 5 short-answer, pass threshold 12/15 (80%)',
5844
+ '至少 50 字符': 'At least 50 chars',
5845
+ '至少 100 字符': 'At least 100 chars',
5846
+ '提交题目并评分': 'Submit answers for grading',
5847
+ '评分中...': 'Grading...',
5848
+ '合格': 'Passed',
5849
+ '未合格': 'Not passed',
5850
+ '得分': 'Score',
5851
+ '下一步:等待 maintainer 激活,本阶段未上线 admin UI':
5852
+ 'Next: wait for maintainer activation. Admin UI not yet available in this phase.',
5853
+ '可重试提交': 'You may retry submission',
5854
+ '上次得分': 'Last score',
5855
+ '已合格,等待 maintainer 激活': 'Passed, waiting for maintainer activation',
5856
+ '未合格,可重试': 'Not passed, you may retry',
5857
+ '必读': 'required',
5858
+ '权力边界:多签 + 修改流程': 'Power boundary: multisig + modification process',
5859
+ '真人 Passkey 7 条路径': 'Real-human Passkey 7 paths',
5860
+ '经济博弈原则 + 关系层估值层': 'Economic game theory + relationship/valuation layers',
5861
+ '案例决策树 + 4 种结算路径': 'Case decision tree + 4 verdict paths',
5862
+ '合规边界': 'Compliance boundary',
5863
+
5864
+ // ── #1093 阶段 2b 案例研读(i18n fix:静态 t() + placeholder pattern) ─
5865
+ '§4.2 案例研读': '§4.2 Case studies',
5866
+ '个案例,每个需选 verdict + 写理由 ≥ 200 字。本步骤':
5867
+ 'cases, each requires a verdict choice + reasoning ≥ 200 chars. This step',
5868
+ '不自动评分': 'is NOT auto-graded',
5869
+ ',maintainer 上岗签字前对比 expected verdict 评估你的 reasoning 方向。':
5870
+ '; maintainer will compare your reasoning with expected verdict before activation.',
5871
+ '已知事实': 'Known facts',
5872
+ '选择你的 verdict': 'Choose your verdict',
5873
+ 'reasoning(≥ N 字符)': 'Reasoning (≥ N chars)',
5874
+ '解释你为什么选这个 verdict,引用具体事实和 spec 原则...':
5875
+ 'Explain why you chose this verdict; cite specific facts and spec principles...',
5876
+ '提交案例 review': 'Submit case reviews',
5877
+ '案例 review 已提交': 'Case reviews submitted',
5878
+ '案例 review 不完整': 'Case reviews incomplete',
5879
+ '个案例': 'cases',
5880
+ 'maintainer 上岗签字前会对比 expected verdict 评估你的 reasoning 方向':
5881
+ 'Maintainer will compare with expected verdict and evaluate your reasoning before activation',
5882
+
5883
+ // ── #1093 阶段 2 i18n fix(动态 t() 拼接修复,补缺失翻译)─────
5884
+ '请先提交申请': 'Please submit application first',
5885
+ '完成申请': 'to complete application',
5886
+ '仲裁员': 'arbitrator',
5887
+ '审核员': 'verifier',
5888
+ '至少 N 字符': 'At least N chars',
5889
+ '题(多选 + 短答),合格线 80%': 'questions (multi-choice + short-answer), pass threshold 80%',
5890
+ '10 元规则,特别是 #5 不偏袒 / #6 不滥用':
5891
+ '10 meta-rules, especially #5 no-favoritism / #6 no-abuse',
5892
+
5893
+ // ── #1093 阶段 3 maintainer activation (/admin/governance) ─────
5894
+ '治理岗位激活': 'Governance role activation',
5895
+ '当前无待激活申请': 'No pending applications to activate',
5896
+ '所有 governance application 均已 active 或未达 onboarding 完成':
5897
+ 'All governance applications are either active or onboarding not complete',
5898
+ '返回 admin': 'Back to admin',
5899
+ '申请': 'Application',
5900
+ 'Region': 'Region',
5901
+ 'Email': 'Email',
5902
+ '题目': 'Quiz',
5903
+ '案例 review': 'Case review',
5904
+ '查看详情': 'View detail',
5905
+ '激活': 'Activate',
5906
+ 'onboarding 未完成': 'onboarding not complete',
5907
+ '待激活申请': 'Pending applications',
5908
+ '激活前:代码自动 re-gate(eligibility 二次校验)+ Iron-Rule Passkey ceremony,防 maintainer 漏检':
5909
+ 'Before activation: code auto re-gate (eligibility re-check) + Iron-Rule Passkey ceremony, prevents maintainer oversight',
5910
+ '加载中...': 'Loading...',
5911
+ '申请者选': 'Applicant chose',
5912
+ 'expected': 'Expected',
5913
+ 'reasoning': 'Reasoning',
5914
+ 'key principles': 'Key principles',
5915
+ '案例 review 对比': 'Case review comparison',
5916
+ '无 review 数据': 'No review data',
5917
+ '确认激活该申请?将自动 re-gate eligibility + Passkey 签发':
5918
+ 'Confirm activate this application? Will auto re-gate eligibility + Passkey sign',
5919
+ '代码自动 re-gate 失败': 'Code auto re-gate failed',
5920
+ '✅ 激活成功': '✅ Activation succeeded',
5921
+
5922
+ // ── #1093 阶段 4 resign + appeal (governance-me + admin appeals) ──
5923
+ '我的治理岗位': 'My governance roles',
5924
+ '在岗 / 申诉 / 卸任': 'Active / Appeal / Resign',
5925
+ 'spec docs/GOVERNANCE-ONBOARDING.md §6 §7':
5926
+ 'spec docs/GOVERNANCE-ONBOARDING.md §6 §7',
5927
+ 'phase A 治理 = 关系层数据采集 + 公共贡献意愿表达,不预设估值层':
5928
+ 'Phase A governance = relationship-layer data collection + public contribution intent. No valuation layer presumed.',
5929
+ '当前在岗': 'Currently active',
5930
+ '待申诉(14 天内)': 'Appeal window (within 14 days)',
5931
+ '申诉审核中': 'Appeal under review',
5932
+ '待审申请': 'Pending applications',
5933
+ '暂无治理岗位记录': 'No governance role records yet',
5934
+ '在岗': 'Active',
5935
+ '上岗时间': 'Activated at',
5936
+ '卸任': 'Resign',
5937
+ '被自动卸任': 'Auto-deactivated',
5938
+ '生效时间': 'Effective at',
5939
+ '申诉窗口剩余': 'Appeal window remaining',
5940
+ '天': 'days',
5941
+ '已提交申诉,等待 maintainer 裁决': 'Appeal submitted, awaiting maintainer ruling',
5942
+ '提交申诉': 'Submit appeal',
5943
+ '申请审核中': 'Application under review',
5944
+ '继续 onboarding': 'Continue onboarding',
5945
+ '提交时间': 'Submitted at',
5946
+ '返回 #me': 'Back to #me',
5947
+
5948
+ // ── resign modal ──
5949
+ '卸任治理岗位': 'Resign governance role',
5950
+ '卸任后历史履职记录保留(关系层,不可逆)':
5951
+ 'Resignation preserves historical performance records (relationship layer, irreversible)',
5952
+ '卸任不影响 reputation / dev_contribution':
5953
+ 'Resignation does not affect reputation / dev_contribution',
5954
+ '30 天内不能重新申请同一角色(冷却期)':
5955
+ 'Cannot re-apply for same role within 30 days (cooldown)',
5956
+ '已 assigned 但未完成的 case 必须先完成 / 转交,否则无法卸任':
5957
+ 'Assigned but unresolved cases must be completed / transferred before resigning',
5958
+ '输入': 'Type',
5959
+ '确认': 'to confirm',
5960
+ '取消': 'Cancel',
5961
+ 'Passkey 签发卸任': 'Sign resignation with Passkey',
5962
+ '请求 Passkey...': 'Requesting Passkey...',
5963
+ 'Passkey 签发失败:': 'Passkey signing failed:',
5964
+ '提交中...': 'Submitting...',
5965
+ '尚有 {n} 个未结案 dispute,请先完成裁决后再卸任':
5966
+ 'You still have {n} unresolved dispute(s). Complete pending verdicts before resigning.',
5967
+
5968
+ // ── #1080 audit: governance leaderboard observation-only banner + thresholds ──
5969
+ '本榜单仅展示履职数据,不构成 token / 经济利益分配':
5970
+ 'This leaderboard shows performance data only — NOT a token / economic distribution',
5971
+ 'Reward distribution 机制由 phase D first DAO 决定。详 docs/GOVERNANCE-LEADERBOARD-SPEC.md。':
5972
+ 'Reward distribution is decided by phase D first DAO. See docs/GOVERNANCE-LEADERBOARD-SPEC.md.',
5973
+ 'insufficient data': 'insufficient data',
5974
+ '仲裁员公平评价(< 10 案显 insufficient data,spec §4)':
5975
+ 'Arbitrator fairness rating (< 10 cases shows "insufficient data" per spec §4)',
5976
+ '正确数 / 总任务数 · 命中率(< 5 任务显 insufficient data,spec §4)':
5977
+ 'Correct / total · accuracy (< 5 tasks shows "insufficient data" per spec §4)',
5978
+ '卸任成功。冷却期至': 'Resignation succeeded. Cooldown until',
5979
+
5980
+ // ── appeal modal ──
5981
+ '对自动卸任提出申诉': 'Appeal auto-deactivation',
5982
+ '请详细说明:为何 outlier 计数 / COI 警告 / inactive 不应导致卸任。理由至少 100 字符,maintainer 群多签审议,通过后恢复 active 状态。':
5983
+ 'Explain in detail: why outlier count / COI warning / inactivity should not lead to deactivation. ≥100 chars. Maintainer group reviews, accepted appeals restore active status.',
5984
+ '详细说明你的申诉理由(≥100 字符)': 'Detailed appeal reason (≥100 chars)',
5985
+ '字符数': 'Characters',
5986
+ '申诉已提交,等待 maintainer 裁决': 'Appeal submitted, awaiting maintainer ruling',
5987
+
5988
+ // ── admin appeals resolve ──
5989
+ '待裁决申诉': 'Appeals awaiting ruling',
5990
+ 'spec §7.2:申诉通过 → 恢复 active + 抹除 outlier;驳回 → 公开理由(对应元规则 #1 当一切可见)':
5991
+ 'spec §7.2: accepted → restore active + clear outlier; rejected → public reason (meta-rule #1 transparency)',
5992
+ '驳回': 'Reject',
5993
+ '接受恢复': 'Accept (restore)',
5994
+ '提交于': 'Submitted',
5995
+ '自动卸任于': 'Auto-deactivated',
5996
+ '接受申诉(恢复 active)': 'Accept appeal (restore active)',
5997
+ '驳回申诉': 'Reject appeal',
5998
+ 'user.roles 将恢复角色,可立即继续履职(抹除 outlier 计数,审计留痕)':
5999
+ 'user.roles will be restored, can immediately resume duty (outlier counts cleared, audit logged)',
6000
+ 'user 维持 inactive 状态。处置理由会公开(元规则 #1 当一切可见)':
6001
+ 'user stays inactive. Resolution reason is public (meta-rule #1 transparency)',
6002
+ '处置理由(≥30 字符,公开)': 'Resolution reason (≥30 chars, public)',
6003
+ 'Passkey 签发裁决': 'Sign ruling with Passkey',
6004
+ '裁决已记录,user 已通知': 'Ruling recorded, user notified',
6005
+
6006
+ // ── #1093 stage 6 arbitrator pause/resume auto-judge ─────
6007
+ '自动判定时钟已冻结': 'Auto-judge clock frozen',
6008
+ '到期': 'Expires',
6009
+ '理由': 'Reason',
6010
+ '立即解冻(直接进入裁决/补证后)': 'Resume now (after evidence collected / before ruling)',
6011
+ '暂停自动判定时钟': 'Pause auto-judge clock',
6012
+ 'playbook §2.1:补证据期 > 48h 时显式调用,冻结协议自动判定时钟。最大窗口 7 天。':
6013
+ 'Playbook §2.1: when evidence collection > 48h, explicit call freezes the protocol auto-judge clock. Max 7-day window.',
6014
+ '暂停理由(≥10 字符,公开 audit_log)':
6015
+ 'Pause reason (≥10 chars, public audit_log)',
6016
+ '例:已通知 buyer 补开箱视频,等 72h':
6017
+ 'e.g., Asked buyer for unboxing video, waiting 72h',
6018
+ '冻结到期': 'Freeze expires',
6019
+ '(最大)': '(max)',
6020
+ '暂停时钟': 'Pause clock',
6021
+ '暂停理由至少 10 字符': 'Pause reason needs ≥10 characters',
6022
+ '确认立即解冻自动判定时钟? 协议层 48h 沉默判定将重新生效。':
6023
+ 'Resume auto-judge clock now? The 48h silence-default ruling will become active again.',
6024
+
6025
+ // ── RFC-004 build feedback(用→建反馈)──────────────────────────
6026
+ '反馈 / 建议': 'Feedback / Suggestion',
6027
+ '帮我们改进 WebAZ。会自动附上当前页面': 'Help us improve WebAZ. Auto-attaches your current page',
6028
+ '作为上下文(不含个人信息)': 'as context (no personal info)',
6029
+ '体验问题(用着别扭)': 'UX issue (awkward to use)',
6030
+ 'Bug(报错 / 坏了)': 'Bug (error / broken)',
6031
+ '改进提案(建设 · 需绑 Passkey,被采纳记共建信誉)': 'Proposal (building · needs Passkey; if accepted → co-build reputation)',
6032
+ '发生了什么 / 你的想法(≥5 字)': 'What happened / your idea (≥5 chars)',
6033
+ '请至少写 5 个字': 'Please write at least 5 characters',
6034
+ '已有类似建议,已合并 🙌': 'Similar suggestion exists — merged 🙌',
6035
+ '反馈已提交,谢谢! 🙏': 'Feedback submitted — thank you! 🙏',
6036
+ '查看我的反馈进度 →': 'View my feedback status →',
6037
+ '我的反馈': 'My feedback',
6038
+ '你提的问题 / 建议进展 — 被采纳的提案会记入共建信誉': 'Your reported issues / suggestions — accepted proposals earn co-build reputation',
6039
+ '新反馈 / 建议': 'New feedback / suggestion',
6040
+ '新反馈': 'New feedback',
6041
+ '还没有反馈 — 用着有问题随时点左下角 💬': 'No feedback yet — tap 💬 (bottom-left) anytime',
6042
+ '已收到': 'Received',
6043
+ '已分类': 'Triaged',
6044
+ '已采纳 ✅': 'Accepted ✅',
6045
+ '未采纳': 'Declined',
6046
+ '已合并': 'Merged',
6047
+ '体验问题': 'UX issue',
6048
+ '提案': 'Proposal',
6049
+ '共建信誉': 'Co-build reputation',
6050
+ // RFC-006 Gap 2:贡献者看板
6051
+ '我的共建': 'My contributions',
6052
+ '你的建设贡献(独立于交易信誉 — 不影响 verifier/仲裁准入)': 'Your building contributions (separate from trade reputation — does NOT gate verifier/arbitrator)',
6053
+ '建设等级': 'Build tier',
6054
+ '建设积分': 'Build points',
6055
+ '当前可参与': 'Can currently do',
6056
+ '下一级': 'Next tier',
6057
+ '认领中': 'Claimed',
6058
+ '审核中': 'In review',
6059
+ '已验收': 'Accepted (done)',
6060
+ '提反馈': 'Feedback sent',
6061
+ '被采纳': 'Accepted',
6062
+ '提任务': 'Tasks created',
6063
+ '署名构成(自报)': 'Authorship (self-declared)',
6064
+ '真人': 'Human',
6065
+ 'AI 辅助': 'AI-assisted',
6066
+ 'AI 主笔': 'AI-authored',
6067
+ '未声明': 'Unspecified',
6068
+ '未绑 Passkey:贡献可受理致谢,但需绑定真人锚点才记入建设信誉。': 'No Passkey: contributions are acknowledged, but earning build reputation requires a real-person Passkey anchor.',
6069
+ '限制与申诉': 'Restrictions & appeal',
6070
+ '无限制': 'No restrictions',
6071
+ '如有异议可申诉': 'Appeal if you disagree',
6072
+ '看板仅自己可见,不做公开排行。': 'This dashboard is private to you — no public leaderboard.',
5772
6073
  }
5773
6074
 
5774
6075
  window.t = (zh) => window._lang === 'en' ? (_EN[zh] || zh) : zh
Binary file
Binary file
@@ -1,4 +1,5 @@
1
1
  {
2
+ "id": "/",
2
3
  "name": "WebAZ — Agent-native 去中心化商业协议",
3
4
  "short_name": "WebAZ",
4
5
  "description": "买家 Agent 找货、卖家 Agent 上架,链上稳定币结算,2% 纯净协议。",
@@ -12,8 +13,10 @@
12
13
  "lang": "zh-CN",
13
14
  "categories": ["shopping", "business", "productivity"],
14
15
  "icons": [
15
- { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" },
16
- { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "maskable" }
16
+ { "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "any" },
17
+ { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any" },
18
+ { "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" },
19
+ { "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" }
17
20
  ],
18
21
  "shortcuts": [
19
22
  {
@@ -3,7 +3,7 @@
3
3
  "info": {
4
4
  "title": "WebAZ Protocol API",
5
5
  "version": "0.4.14",
6
- "description": "Auto-generated endpoint inventory (515 endpoints, 17 with full schema). See PROJECT_BRAIN.md for design context."
6
+ "description": "Auto-generated endpoint inventory (515 endpoints, 17 with full schema). See docs/ for design context."
7
7
  },
8
8
  "servers": [
9
9
  {
@@ -1,5 +1,5 @@
1
1
  // Service Worker — 网络优先,离线降级缓存;API 请求不缓存
2
- const CACHE = 'webaz-v481'
2
+ const CACHE = 'webaz-v482'
3
3
 
4
4
  self.addEventListener('install', e => {
5
5
  self.skipWaiting()
@@ -9,11 +9,12 @@ export function registerAdminProtocolParamsRoutes(app, deps) {
9
9
  res.json({ items: rows });
10
10
  });
11
11
  // H-2 P1-2: 协议参数是全局配置,需 protocol 权限(区域 admin 不能改)
12
+ // 2026-06-03 #1095: + constitutional only-increase 守护
12
13
  app.patch('/api/admin/protocol-params/:key', (req, res) => {
13
14
  const admin = requireProtocolAdmin(req, res);
14
15
  if (!admin)
15
16
  return;
16
- const param = db.prepare('SELECT type, min_value, max_value FROM protocol_params WHERE key = ?').get(req.params.key);
17
+ const param = db.prepare('SELECT type, min_value, max_value, category, value, requires_meta_rule_change FROM protocol_params WHERE key = ?').get(req.params.key);
17
18
  if (!param)
18
19
  return void res.status(404).json({ error: '参数不存在' });
19
20
  const { value } = req.body || {};
@@ -32,6 +33,45 @@ export function registerAdminProtocolParamsRoutes(app, deps) {
32
33
  if (param.max_value != null && n > param.max_value) {
33
34
  return void res.status(400).json({ error: `value 高于上限 ${param.max_value}` });
34
35
  }
36
+ // #1095 CHARTER §4 I-4: constitutional only-increase 锁
37
+ // 假设 increase = more protection;详头部注释块
38
+ if (param.category === 'constitutional') {
39
+ const oldNum = Number(param.value);
40
+ if (Number.isFinite(oldNum) && n < oldNum) {
41
+ // #1096 audit:拒绝时也写 protocol_params_log(meta-rule #1 "当一切可见")
42
+ // 谁尝试降低宪法保护要留痕,即便 attempt 失败
43
+ try {
44
+ db.prepare(`INSERT INTO protocol_params_log (id, key, old_value, new_value, changed_by, action) VALUES (?,?,?,?,?,'constitutional_reject_patch')`)
45
+ .run(generateId('ppl'), req.params.key, param.value, strVal, admin.id);
46
+ }
47
+ catch (_e) { /* log 失败不阻塞 reject 决定 */ }
48
+ return void res.status(403).json({
49
+ error: `宪法级 param 只能调高,不能调低(${param.value} → ${n})— CHARTER §4 I-4 防绕过`,
50
+ code: 'CONSTITUTIONAL_ONLY_INCREASE',
51
+ current: oldNum,
52
+ attempted: n,
53
+ });
54
+ }
55
+ }
56
+ // #1090 RFC-002 P1#6 runtime enforcement:meta-rule-locked params 走同款 only-increase
57
+ // (CI lint PR-3.1 守 source seed;此处守 runtime DB)
58
+ // PATCH-1c PR-3.1 描述行注明哪个方向是 more protection;协议侧约定 higher = stricter
59
+ if (param.requires_meta_rule_change === 1) {
60
+ const oldNum = Number(param.value);
61
+ if (Number.isFinite(oldNum) && n < oldNum) {
62
+ try {
63
+ db.prepare(`INSERT INTO protocol_params_log (id, key, old_value, new_value, changed_by, action) VALUES (?,?,?,?,?,'meta_rule_reject_patch')`)
64
+ .run(generateId('ppl'), req.params.key, param.value, strVal, admin.id);
65
+ }
66
+ catch (_e) { /* log 失败不阻塞 */ }
67
+ return void res.status(403).json({
68
+ error: `meta-rule-locked param 只能调高(${param.value} → ${n})— 降低需 60d amendment(CHARTER §4 I-1)`,
69
+ code: 'META_RULE_LOCKED_ONLY_INCREASE',
70
+ current: oldNum,
71
+ attempted: n,
72
+ });
73
+ }
74
+ }
35
75
  }
36
76
  if (param.type === 'boolean' && !['true', 'false', '1', '0'].includes(strVal)) {
37
77
  return void res.status(400).json({ error: '类型不匹配(需 boolean)' });
@@ -50,9 +90,47 @@ export function registerAdminProtocolParamsRoutes(app, deps) {
50
90
  const admin = requireProtocolAdmin(req, res);
51
91
  if (!admin)
52
92
  return;
53
- const param = db.prepare('SELECT default_value, value FROM protocol_params WHERE key = ?').get(req.params.key);
93
+ const param = db.prepare('SELECT default_value, value, category, type, requires_meta_rule_change FROM protocol_params WHERE key = ?').get(req.params.key);
54
94
  if (!param || param.default_value == null)
55
95
  return void res.status(404).json({ error: '参数不存在或无默认值' });
96
+ // #1095 CHARTER §4 I-4: constitutional reset 走 same only-increase
97
+ // 若 default 低于 current,reset 会构成降低保护 → 拒绝
98
+ if (param.category === 'constitutional' && param.type === 'number') {
99
+ const cur = Number(param.value);
100
+ const def = Number(param.default_value);
101
+ if (Number.isFinite(cur) && Number.isFinite(def) && def < cur) {
102
+ // #1096 audit:reset 拒绝同样留痕
103
+ try {
104
+ db.prepare(`INSERT INTO protocol_params_log (id, key, old_value, new_value, changed_by, action) VALUES (?,?,?,?,?,'constitutional_reject_reset')`)
105
+ .run(generateId('ppl'), req.params.key, param.value, param.default_value, admin.id);
106
+ }
107
+ catch (_e) { /* log 失败不阻塞 */ }
108
+ return void res.status(403).json({
109
+ error: `宪法级 param 不能 reset 至更低值(${param.value} → ${param.default_value})— CHARTER §4 I-4 防绕过`,
110
+ code: 'CONSTITUTIONAL_ONLY_INCREASE',
111
+ current: cur,
112
+ default: def,
113
+ });
114
+ }
115
+ }
116
+ // #1090 RFC-002 P1#6:meta-rule-locked param reset 也走 only-increase
117
+ if (param.requires_meta_rule_change === 1 && param.type === 'number') {
118
+ const cur = Number(param.value);
119
+ const def = Number(param.default_value);
120
+ if (Number.isFinite(cur) && Number.isFinite(def) && def < cur) {
121
+ try {
122
+ db.prepare(`INSERT INTO protocol_params_log (id, key, old_value, new_value, changed_by, action) VALUES (?,?,?,?,?,'meta_rule_reject_reset')`)
123
+ .run(generateId('ppl'), req.params.key, param.value, param.default_value, admin.id);
124
+ }
125
+ catch (_e) { /* log 失败不阻塞 */ }
126
+ return void res.status(403).json({
127
+ error: `meta-rule-locked param 不能 reset 至更低值(${param.value} → ${param.default_value})— 降低需 60d amendment(CHARTER §4 I-1)`,
128
+ code: 'META_RULE_LOCKED_ONLY_INCREASE',
129
+ current: cur,
130
+ default: def,
131
+ });
132
+ }
133
+ }
56
134
  db.transaction(() => {
57
135
  db.prepare(`UPDATE protocol_params SET value = ?, updated_at = datetime('now'), updated_by = ? WHERE key = ?`)
58
136
  .run(param.default_value, admin.id, req.params.key);
@@ -81,23 +81,27 @@ export function registerAdminReportsRoutes(app, deps) {
81
81
  }
82
82
  }
83
83
  engineA.distributed_total = r2(engineA.distributed_total);
84
- // 引擎 A redirect 去向(chain_gapcharity;region_cap → global_fund)
85
- const charity = db.prepare(`SELECT balance, total_chain_gap, total_orphan_sponsor, total_region_cap, total_donated, total_disbursed FROM charity_fund WHERE id='main'`).get();
84
+ // 2026-06-04 三科目解耦:引擎 A 所有 redirect 去向统一commission_pool(三级公池,只进不出)。
85
+ // charity_fund 自此纯净(仅捐款/还愿/拨款),不再承接佣金兜底。
86
+ const charity = db.prepare(`SELECT balance, total_donated, total_disbursed, total_redirected FROM charity_fund WHERE id='main'`).get();
87
+ const cpool = db.prepare(`SELECT balance, total_chain_gap, total_orphan_sponsor, total_region_cap FROM commission_reserve WHERE id='main'`).get();
86
88
  // 引擎 B:PV 对碰(binary_score_records 现金拨付 + 待拨 Score)
87
89
  const binarySettled = db.prepare(`SELECT COUNT(*) AS cnt, COALESCE(SUM(waz_amount),0) AS waz FROM binary_score_records WHERE settled_at IS NOT NULL`).get();
88
90
  const binaryPending = db.prepare(`SELECT COUNT(*) AS cnt, COALESCE(SUM(score),0) AS score FROM binary_score_records WHERE settled_at IS NULL`).get();
89
91
  const periods = db.prepare(`SELECT COUNT(*) AS cnt, COALESCE(SUM(cash_distributed),0) AS dist, COALESCE(SUM(cash_retained),0) AS retained FROM settlement_periods WHERE status='completed'`).get();
90
- const gfund = db.prepare(`SELECT pool_balance, total_scores_pending, current_n FROM global_fund WHERE id=1`).get();
92
+ const gfund = db.prepare(`SELECT pool_balance, total_scores_pending, current_n, pv_escrow_reserve FROM global_fund WHERE id=1`).get();
91
93
  // 资金管道:global_fund 蓄水来源(fund_base 1% + commission region_cap redirect)
92
94
  const pipe = db.prepare(`SELECT COALESCE(SUM(amount_base),0) AS base, COALESCE(SUM(amount_l3),0) AS redirect FROM fund_deposits`).get();
93
95
  res.json({
94
96
  engine_a_commission: {
95
97
  ...engineA,
96
- // redirect 三去向(互斥,全部源自 commission_pool 未发出的份额):
97
- redirected_to_charity_chain_gap: r2(Number(charity?.total_chain_gap || 0) + Number(charity?.total_orphan_sponsor || 0)), // 无 L / sponsor 无效
98
- redirected_to_charity_region_full_ban: r2(Number(charity?.total_region_cap || 0)), // max_levels=0 区域整池入公益
99
- redirected_to_global_fund_region_cap: r2(pipe.redirect), // level > max_levels(部分截断)→ global_fund (fund_deposits.amount_l3)
100
- note: '即时分账,bounded by commission_pool(订单内)。redirect 三去向见上字段。',
98
+ // 2026-06-04 起所有兜底 commission_reserve(三级公池,只进不出)。三个分项互斥:
99
+ commission_reserve_chain_gap: r2(Number(cpool?.total_chain_gap || 0)), // 无 L / 上家断链
100
+ commission_reserve_orphan_sponsor: r2(Number(cpool?.total_orphan_sponsor || 0)), // sponsor 无效 + opt-out 放弃 + escrow 到期
101
+ commission_reserve_region_cap: r2(Number(cpool?.total_region_cap || 0)), // level>maxLevels 截断 + max=0 整池
102
+ commission_reserve_balance: r2(Number(cpool?.balance || 0)),
103
+ legacy_global_fund_redirect: r2(pipe.redirect), // 历史:解耦前曾入 global_fund(fund_deposits.amount_l3),新订单恒 0
104
+ note: '即时分账;兜底全部入 commission_reserve(独立科目,只进不出,治理决定用途),不再污染 charity / global_fund。',
101
105
  },
102
106
  engine_b_pv_matching: {
103
107
  cash_distributed_total: r2(binarySettled.waz),
@@ -111,6 +115,7 @@ export function registerAdminReportsRoutes(app, deps) {
111
115
  },
112
116
  global_fund: {
113
117
  pool_balance: r2(Number(gfund?.pool_balance || 0)),
118
+ pv_escrow_reserve: r2(Number(gfund?.pv_escrow_reserve || 0)), // #1106 已承诺未兑付的 PV 负债(隔离于可分配池)
114
119
  total_scores_pending: r2(Number(gfund?.total_scores_pending || 0)),
115
120
  current_n: r2(Number(gfund?.current_n || 0)),
116
121
  },
@@ -124,7 +129,7 @@ export function registerAdminReportsRoutes(app, deps) {
124
129
  total_donated: r2(Number(charity?.total_donated || 0)),
125
130
  total_disbursed: r2(Number(charity?.total_disbursed || 0)),
126
131
  },
127
- governance_hint: '引擎A=消费即时奖励(commission_pool);引擎B=团队对碰(global_fund 安全阀)。两者解耦,调参互不影响。详见 docs/REWARD-ENGINES-DECOUPLING.md',
132
+ governance_hint: '引擎A=消费即时奖励(分账→钱包,兜底→commission_reserve);引擎B=团队对碰(global_fund 安全阀)。两者解耦,调参互不影响。详见 docs/REWARD-ENGINES-DECOUPLING.md',
128
133
  generated_at: new Date().toISOString(),
129
134
  });
130
135
  });
@@ -14,7 +14,8 @@ export function registerAuthReadRoutes(app, deps) {
14
14
  }
15
15
  const region = user.region || 'global';
16
16
  const maxLevels = getRegionMaxLevels(region);
17
- res.json({ ...user, api_key: undefined, roles, wallet: wallet || null, region_max_levels: maxLevels });
17
+ const pvEnabled = db.prepare("SELECT pv_enabled FROM region_config WHERE region = ?").get(region)?.pv_enabled ?? 0;
18
+ res.json({ ...user, api_key: undefined, roles, wallet: wallet || null, region_max_levels: maxLevels, region_pv_enabled: Number(pvEnabled) === 1 ? 1 : 0 });
18
19
  });
19
20
  app.get('/api/profile', (req, res) => {
20
21
  const user = auth(req, res);
@@ -42,6 +43,7 @@ export function registerAuthReadRoutes(app, deps) {
42
43
  has_password: !!user.password_hash,
43
44
  region: user.region ?? 'global',
44
45
  region_max_levels: getRegionMaxLevels(user.region || 'global'),
46
+ region_pv_enabled: (db.prepare("SELECT pv_enabled FROM region_config WHERE region = ?").get(user.region || 'global')?.pv_enabled ?? 0) === 1 ? 1 : 0,
45
47
  ...(() => { const g = userMlmGate(user.region || 'global'); return { mlm_ui_visible: g.mlmUiVisible, mlm_payout_levels: g.payoutLevels }; })(),
46
48
  bio: user.bio ?? null,
47
49
  search_anchor: user.search_anchor ?? null,