@seasonkoh/webaz 0.1.18 → 0.1.20

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 (30) hide show
  1. package/dist/layer0-foundation/L0-2-state-machine/engine.js +171 -56
  2. package/dist/layer0-foundation/L0-2-state-machine/order-chain.js +23 -0
  3. package/dist/layer0-foundation/L0-2-state-machine/transitions.js +65 -2
  4. package/dist/layer1-agent/L1-1-mcp-server/server.js +46 -22
  5. package/dist/layer2-business/L2-8-feedback/build-feedback-engine.js +64 -5
  6. package/dist/layer2-business/L2-9-contribution/build-reputation-engine.js +4 -0
  7. package/dist/pwa/contract-fingerprint.js +46 -0
  8. package/dist/pwa/economic-participation.js +122 -0
  9. package/dist/pwa/endpoint-actions.js +112 -0
  10. package/dist/pwa/entity-dictionary.js +125 -0
  11. package/dist/pwa/goal-index.js +60 -0
  12. package/dist/pwa/integration-contract.js +64 -0
  13. package/dist/pwa/limits.js +30 -0
  14. package/dist/pwa/negative-space.js +64 -0
  15. package/dist/pwa/public/app.js +5 -0
  16. package/dist/pwa/public/docs/ECONOMIC-MODEL.md +287 -0
  17. package/dist/pwa/public/docs/INTEGRATOR.md +67 -0
  18. package/dist/pwa/public/docs/META-RULES-FULL.md +543 -0
  19. package/dist/pwa/public/i18n.js +4 -0
  20. package/dist/pwa/routes/build-feedback.js +3 -2
  21. package/dist/pwa/routes/disputes-write.js +68 -0
  22. package/dist/pwa/routes/orders-action.js +93 -1
  23. package/dist/pwa/routes/orders-create.js +7 -2
  24. package/dist/pwa/routes/orders-read.js +18 -0
  25. package/dist/pwa/routes/public-utils.js +131 -1
  26. package/dist/pwa/routes/webauthn.js +9 -1
  27. package/dist/pwa/server.js +69 -123
  28. package/dist/pwa/verifiability-index.js +63 -0
  29. package/dist/version.js +32 -0
  30. package/package.json +2 -1
@@ -0,0 +1,63 @@
1
+ /**
2
+ * RFC-011 §⑤ 可验证索引 —— 一份"什么可验 + 怎么验"的总表(护照/锚/AP2/订单链散在四处,这里统一)。
3
+ * 诚实分级(不可过度声明):
4
+ * - 护照 / 外部锚:公开可验(任何第三方离线 ecrecover / 验签),强。
5
+ * - AP2 Mandate:签名输出,可验。
6
+ * - 订单事件链:HMAC 是 actor 私钥 → 第三方【无法】验签;可验的是【哈希链连续性】(防篡改),且 party-gated。
7
+ * 只【链接 + 说明】how-to,不嵌密钥(密钥 live 发布在 did.json / protocol-status issuers),doc=code 不漂移。
8
+ */
9
+ import { SOFTWARE_VERSION, CONTRACT_VERSION } from '../version.js';
10
+ const BASE = 'https://webaz.xyz';
11
+ export function buildVerifiabilityIndex() {
12
+ return {
13
+ contract_version: CONTRACT_VERSION,
14
+ software_version: SOFTWARE_VERSION,
15
+ note: 'RFC-011 §⑤. Each artifact lists what it proves, the scheme, how to verify, and its verifiability LEVEL — do not over-trust beyond the stated level. Issuer keys are published live (not embedded here): /.well-known/did.json + /.well-known/webaz-protocol.json#issuers.',
16
+ levels: {
17
+ public_signature: 'any third party verifies offline (ecrecover / sig-check) without calling WebAZ',
18
+ public_endpoint: 'verifiable via a public WebAZ endpoint (no auth)',
19
+ integrity_chain: 'tamper-evidence via a hash-chain (verify continuity); NOT a third-party-verifiable signature',
20
+ party_gated: 'full data only to order parties; others get integrity, not contents',
21
+ },
22
+ artifacts: [
23
+ {
24
+ artifact: 'agent_passport',
25
+ proves: 'an agent\'s custodian fingerprint + risk/engagement/behavior, signed by the WebAZ issuer key',
26
+ scheme: 'eip191 (EIP-191 personal_sign)',
27
+ level: 'public_signature',
28
+ offline: true,
29
+ how_to_verify: 'GET /api/me/agents/:apiKeyPrefix/passport → ecrecover(passport.canonical, passport.signature) == issuer address from /.well-known/did.json (CAIP-10) / /.well-known/webaz-protocol.json#issuers; check active_since/revoked_at window.',
30
+ endpoint: `${BASE}/api/me/agents/:apiKeyPrefix/passport`,
31
+ keys: `${BASE}/.well-known/did.json`,
32
+ },
33
+ {
34
+ artifact: 'external_anchor',
35
+ proves: 'a real-world item\'s ownership/authenticity anchor + independent verifier attestations',
36
+ scheme: 'signature (server-verifiable)',
37
+ level: 'public_endpoint',
38
+ offline: false,
39
+ how_to_verify: `GET ${BASE}/api/external-anchors/:id/verify-sig (public); cross-check verifier attestations via /api/external-anchors/:id.`,
40
+ endpoint: `${BASE}/api/external-anchors/:id/verify-sig`,
41
+ },
42
+ {
43
+ artifact: 'ap2_mandate',
44
+ proves: 'a buyer\'s signed Intent/Cart/Payment Mandate (AP2) emitted alongside the webaz price/order format',
45
+ scheme: 'AP2 signed mandate',
46
+ level: 'public_signature',
47
+ offline: true,
48
+ how_to_verify: 'verify the AP2 mandate signature per the AP2 spec; emitted by webaz_verify_price + webaz_place_order (dual-output).',
49
+ endpoint: 'returned inline by verify_price / place_order',
50
+ },
51
+ {
52
+ artifact: 'order_event_chain',
53
+ proves: 'the order/dispute transition history is append-only + tamper-evident (each event hash chains to the previous)',
54
+ scheme: 'sha256 hash-chain (event_hash / prev_event_hash). NOTE: the per-event `signature` is an HMAC with the actor\'s api_key — NOT third-party verifiable; the verifiable property is the HASH-CHAIN continuity.',
55
+ level: 'integrity_chain',
56
+ offline: true,
57
+ party_gated: true,
58
+ how_to_verify: `For an order you are party to: GET ${BASE}/api/orders/:id/chain (returns chain + verification). Or stream events via ${BASE}/api/agent/events (§⑥): check each event\'s prev_event_hash == the previous event\'s event_hash. Continuity proves no insert/delete/reorder.`,
59
+ endpoint: `${BASE}/api/orders/:id/chain`,
60
+ },
61
+ ],
62
+ };
63
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Single source of truth for WebAZ version axes — RFC-011 §④ (version hygiene).
3
+ *
4
+ * TWO DISTINCT AXES. Do not conflate them — conflating is exactly the dirt this file kills
5
+ * (the old hardcoded MCP `SERVER_VERSION='0.1.8'` + Server handshake `version:'0.1.0'` drifted
6
+ * away from the real package version 0.1.19; this makes that structurally impossible).
7
+ *
8
+ * 1. SOFTWARE_VERSION — npm / release semver of THIS codebase (MCP client+server + PWA).
9
+ * Read from package.json at runtime so it can NEVER drift. Bumps on every release.
10
+ * Resolves from both dev (tsx src/version.ts → ../package.json) and prod/published
11
+ * (node dist/version.js → ../package.json), since package.json sits at the package root
12
+ * and is always included in the npm tarball.
13
+ *
14
+ * 2. CONTRACT_VERSION — the agent-native INTEGRATION CONTRACT version (manifest `schema_version`).
15
+ * A deliberate integer that integrators' agents key off. Bump ONLY on a *breaking* change to
16
+ * the data contract they read (entity shape / boundary / verifiable-field semantics).
17
+ * INDEPENDENT of software releases — a patch/feature release does NOT bump it; a breaking
18
+ * contract change DOES, even within the same software version. Governs RFC-011's contract.
19
+ *
20
+ * Both are surfaced to integrators in /.well-known/webaz-protocol.json so an agent can read
21
+ * "contract vN running software x.y.z" and decide compatibility.
22
+ */
23
+ import { createRequire } from 'node:module';
24
+ const require = createRequire(import.meta.url);
25
+ const pkg = require('../package.json');
26
+ /** npm/release semver — single source = package.json. Never hardcode a copy of this. */
27
+ export const SOFTWARE_VERSION = pkg.version;
28
+ /** Integration-contract version. Bump on ANY integrator-observable contract-surface change
29
+ * (capability matrix §② / entity dictionary §①); the CONTRACT_CHANGES `kind` classifies whether
30
+ * it is breaking. Additive changes (kind:'added') are safe for agents to ignore. Guarded by
31
+ * tests/test-contract-fingerprint.ts + docs/CONTRACT-LOCK.json. */
32
+ export const CONTRACT_VERSION = 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seasonkoh/webaz",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "[PRE-LAUNCH] Agent-native decentralized commerce protocol. Humans and AI agents trade on the same protocol via MCP tools. ⚠️ Repository currently private until W8 public launch — GitHub links may return 404. See https://webaz.xyz for status.",
5
5
  "main": "dist/mcp.js",
6
6
  "bin": {
@@ -20,6 +20,7 @@
20
20
  "enforcement": "tsx src/cron-enforcement.ts",
21
21
  "pwa": "tsx src/pwa/server.ts",
22
22
  "schema:verify": "tsx scripts/schema-verify.ts",
23
+ "contract:verify": "tsx tests/test-contract-fingerprint.ts",
23
24
  "license:check": "tsx scripts/license-invariant-check.ts",
24
25
  "meta-rules:check": "tsx scripts/meta-rules-invariant-check.ts",
25
26
  "params:check": "tsx scripts/meta-rule-locked-params-check.ts"