twzrd-x402-gate 0.9.3 → 0.9.5
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/QUICKSTART.md +35 -3
- package/README.md +150 -15
- package/bin/twzrd-evidence-bundle.js +33 -0
- package/bin/twzrd-payment-decision.js +25 -0
- package/dist/adoption-proof.d.ts +9 -0
- package/dist/adoption-proof.d.ts.map +1 -1
- package/dist/adoption-proof.js +15 -3
- package/dist/adoption-proof.js.map +1 -1
- package/dist/auto-gate.d.ts +35 -2
- package/dist/auto-gate.d.ts.map +1 -1
- package/dist/auto-gate.js +94 -16
- package/dist/auto-gate.js.map +1 -1
- package/dist/cloudflare-base.d.ts +49 -0
- package/dist/cloudflare-base.d.ts.map +1 -0
- package/dist/cloudflare-base.js +113 -0
- package/dist/cloudflare-base.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -2
- package/dist/config.js.map +1 -1
- package/dist/decision-token.d.ts +23 -1
- package/dist/decision-token.d.ts.map +1 -1
- package/dist/decision-token.js +44 -14
- package/dist/decision-token.js.map +1 -1
- package/dist/directory.d.ts +35 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +95 -0
- package/dist/directory.js.map +1 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +24 -2
- package/dist/doctor.js.map +1 -1
- package/dist/evaluate.d.ts +20 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +71 -0
- package/dist/evaluate.js.map +1 -1
- package/dist/evidence-bundle.d.ts +139 -0
- package/dist/evidence-bundle.d.ts.map +1 -0
- package/dist/evidence-bundle.js +213 -0
- package/dist/evidence-bundle.js.map +1 -0
- package/dist/evidence-verify.d.ts +145 -0
- package/dist/evidence-verify.d.ts.map +1 -0
- package/dist/evidence-verify.js +784 -0
- package/dist/evidence-verify.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/log-inclusion.d.ts +135 -0
- package/dist/log-inclusion.d.ts.map +1 -0
- package/dist/log-inclusion.js +127 -0
- package/dist/log-inclusion.js.map +1 -0
- package/dist/network.d.ts +3 -1
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js.map +1 -1
- package/dist/payment-decision.d.ts +263 -0
- package/dist/payment-decision.d.ts.map +1 -0
- package/dist/payment-decision.js +666 -0
- package/dist/payment-decision.js.map +1 -0
- package/dist/payto.d.ts +12 -1
- package/dist/payto.d.ts.map +1 -1
- package/dist/payto.js +32 -0
- package/dist/payto.js.map +1 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +90 -44
- package/dist/policy.js.map +1 -1
- package/dist/seller-hook.d.ts.map +1 -1
- package/dist/seller-hook.js +32 -4
- package/dist/seller-hook.js.map +1 -1
- package/dist/spend-control.d.ts +26 -15
- package/dist/spend-control.d.ts.map +1 -1
- package/dist/spend-control.js +189 -64
- package/dist/spend-control.js.map +1 -1
- package/dist/spend-ledger-file.d.ts +3 -0
- package/dist/spend-ledger-file.d.ts.map +1 -1
- package/dist/spend-ledger-file.js +33 -1
- package/dist/spend-ledger-file.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/unsafe.d.ts +11 -0
- package/dist/unsafe.d.ts.map +1 -0
- package/dist/unsafe.js +11 -0
- package/dist/unsafe.js.map +1 -0
- package/dist/with-guard.d.ts.map +1 -1
- package/dist/with-guard.js +5 -7
- package/dist/with-guard.js.map +1 -1
- package/dist/wrap-fetch.d.ts.map +1 -1
- package/dist/wrap-fetch.js +5 -7
- package/dist/wrap-fetch.js.map +1 -1
- package/dist/x402-client-hook.d.ts +38 -0
- package/dist/x402-client-hook.d.ts.map +1 -1
- package/dist/x402-client-hook.js +82 -4
- package/dist/x402-client-hook.js.map +1 -1
- package/package.json +27 -6
package/QUICKSTART.md
CHANGED
|
@@ -49,6 +49,33 @@ installTwzrdAutoGate(client, { refuseWashFlagged: true });
|
|
|
49
49
|
// then register schemes + wrapFetchWithPayment as usual
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## 1c. PayKit (`createPayKitClient`) — Foundation #303
|
|
53
|
+
|
|
54
|
+
PayKit callers pass TWZRD as `onBeforeX402PaymentCreation`. No TWZRD branding
|
|
55
|
+
inside pay-kit itself. The option is on `solana-foundation/pay-kit#303` (and the
|
|
56
|
+
`twzrd-sol` fork); until Foundation merges, use the fork or wait.
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { createPayKitClient } from "@solana/pay-kit";
|
|
60
|
+
import { createTwzrdPayKitBeforePaymentHook } from "twzrd-x402-gate";
|
|
61
|
+
|
|
62
|
+
const client = await createPayKitClient({
|
|
63
|
+
accept: ["x402"],
|
|
64
|
+
onBeforeX402PaymentCreation: createTwzrdPayKitBeforePaymentHook({
|
|
65
|
+
refuseWashFlagged: true,
|
|
66
|
+
}),
|
|
67
|
+
rpcUrl,
|
|
68
|
+
signer,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Equivalent: `onBeforeX402PaymentCreation: installTwzrdAutoGate("pay-kit", { refuseWashFlagged: true })`.
|
|
73
|
+
The hook is the official `@x402/core` context shape (same evaluator as Path E).
|
|
74
|
+
`@solana/pay-kit` is optional — this package does not hard-depend on it.
|
|
75
|
+
The factory itself does not read `TWZRD_AUTO_GATE`; use the AutoGate seat if you
|
|
76
|
+
want the env kill switch re-read per call. You cannot `installTwzrdAutoGate(client)`
|
|
77
|
+
after `createPayKitClient` — PayKit only accepts the hook at construction.
|
|
78
|
+
|
|
52
79
|
## 2. Prove it blocked something (spends nothing)
|
|
53
80
|
|
|
54
81
|
```bash
|
|
@@ -60,6 +87,9 @@ npm run x402-solana-before-payment-proof
|
|
|
60
87
|
|
|
61
88
|
# @x402/core Path E proof (onBeforePaymentCreation)
|
|
62
89
|
npm run autogate-block-proof
|
|
90
|
+
|
|
91
|
+
# PayKit seat (fake createPayKitClient — no unpublished @solana/pay-kit)
|
|
92
|
+
npm run pay-kit-before-payment
|
|
63
93
|
```
|
|
64
94
|
|
|
65
95
|
That JSON is your receipt: a bad merchant intercepted with 0 USDC at risk.
|
|
@@ -112,7 +142,7 @@ payWrap as `x402Fetch`.
|
|
|
112
142
|
|
|
113
143
|
| Knob | Effect |
|
|
114
144
|
|------|--------|
|
|
115
|
-
| `TWZRD_AUTO_GATE=0` | Kill switch — gate fully off, payments proceed unguarded |
|
|
145
|
+
| `TWZRD_AUTO_GATE=0` | Kill switch — gate fully off, payments proceed unguarded. Read per call on the x402-client / x402-solana / pay-kit / MPP seats; the fetch (payWrap) seat resolves it once when the fetch is composed, in both directions — rebuild the fetch to change it. |
|
|
116
146
|
| `refuseWashFlagged: false` | Stop refusing wash-flagged merchants (default `true`) |
|
|
117
147
|
| `gateOnCanSpend: true` | Opt-in hard cap: also block when `can_spend=false` (default `false`) |
|
|
118
148
|
|
|
@@ -120,7 +150,9 @@ Everything else (thresholds, wash caps, fail posture, settle guard): [README](./
|
|
|
120
150
|
|
|
121
151
|
## What this will NOT do
|
|
122
152
|
|
|
123
|
-
- **No Base/EVM reputation.** Non-Solana networks get an explicit `unknown`
|
|
124
|
-
|
|
153
|
+
- **No Base/EVM reputation.** Non-Solana networks get an explicit `unknown`
|
|
154
|
+
(observed; no Solana preflight) unless you set
|
|
155
|
+
`TWZRD_UNSUPPORTED_NETWORK_MODE=strict`. Observe is not a wash bypass —
|
|
156
|
+
`wash_flagged` still refuses before sign.
|
|
125
157
|
- **No delivery guarantee.** It screens the merchant before you pay, nothing after.
|
|
126
158
|
- **Not a wallet.** It never holds keys or signs — it only decides if your signer runs.
|
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# twzrd-x402-gate
|
|
2
2
|
|
|
3
|
-
**TWZRD is the spend-control SDK for agents paying over x402
|
|
3
|
+
**Don't let your agent sign blind.** TWZRD is the spend-control SDK for agents paying over x402 — and the default
|
|
4
4
|
`onBeforePaymentCreation` policy engine for official x402 clients.
|
|
5
5
|
|
|
6
|
+
Commerce loop (directory → preflight → AutoGate → verify → evidence bundle):
|
|
7
|
+
repo [docs/COMMERCE-KIT.md](../docs/COMMERCE-KIT.md). `exportEvidenceBundle` /
|
|
8
|
+
`npx twzrd-evidence-bundle` writes `twzrd.evidence_bundle.v1`. This package is
|
|
9
|
+
not Catena's Agent Commerce Kit.
|
|
10
|
+
|
|
6
11
|
### One call (named export `twzrd`)
|
|
7
12
|
|
|
8
13
|
```js
|
|
@@ -11,17 +16,19 @@ import { twzrd } from "twzrd-x402-gate";
|
|
|
11
16
|
const result = await twzrd.safeFetch(url, {
|
|
12
17
|
maxSpend: "0.10", // per-call cap AND cumulative budget
|
|
13
18
|
allowNetworks: ["solana", "base"],
|
|
14
|
-
requireOfferBinding: true, //
|
|
19
|
+
requireOfferBinding: true, // compose → verify hard bind → only then pay()
|
|
20
|
+
composeBoundTransaction, // build unsigned bound bytes (no keys)
|
|
21
|
+
pay, // sign/submit only after bind-v1 hard verify
|
|
15
22
|
});
|
|
16
23
|
// result.verdict: "allow" | "warn" | "block" — blocks have signerInvocations === 0
|
|
17
24
|
// result.receipt: { strength: "hard"|"soft"|"refuse", leaf_hash, fact_type: "resource_bound" }
|
|
18
25
|
```
|
|
19
26
|
|
|
20
|
-
`requireOfferBinding` is
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
`requireOfferBinding` is fail-closed: missing `composeBoundTransaction` returns
|
|
28
|
+
`bind_required_no_compose` with `signerInvocations === 0` (pay is never called).
|
|
29
|
+
The gate verifies the composed bytes, then calls `pay()` with that
|
|
30
|
+
`transactionBase64`. The old post-pay check remains as
|
|
31
|
+
`verifyOfferBindingAfterPay` only. This SDK never holds keys.
|
|
25
32
|
|
|
26
33
|
Full walkthrough: [QUICKSTART.md](https://github.com/twzrd-sol/twzrd-trust/blob/main/QUICKSTART.md) ·
|
|
27
34
|
verify receipts yourself: [REVIEW.md](https://github.com/twzrd-sol/twzrd-trust/blob/main/REVIEW.md)
|
|
@@ -50,7 +57,7 @@ installTwzrdAutoGate(client, { refuseWashFlagged: true });
|
|
|
50
57
|
**Intercept proof (0 USDC, wash seller never reaches signer):**
|
|
51
58
|
|
|
52
59
|
```bash
|
|
53
|
-
cd
|
|
60
|
+
cd twzrd-x402-gate && npm run autogate-block-proof # needs network: live intel preflight
|
|
54
61
|
# writes block-proof-<run_id>.json (schema twzrd.autogate_block_proof.v1)
|
|
55
62
|
# public reason: TWZRD_TRUST_GATE_BLOCK: wash_flagged
|
|
56
63
|
```
|
|
@@ -95,6 +102,7 @@ server.onBeforeSettle(
|
|
|
95
102
|
| Default screen | free `GET /v1/intel/merchant_card/{payer}` via `twzrdPayerScreen()` |
|
|
96
103
|
| Screen/extract timeout | `timeoutMs: 3000` — on timeout, **continue** (fail-open) |
|
|
97
104
|
| Unresolved payer / null screen / screen error | **continue** unless `failOpen: false` |
|
|
105
|
+
| exact-SVM payload, no `@x402/svm` peer installed | reports `twzrd_svm_peer_missing` (warns once) and **continues** — without the peer, SVM payers are never screened; install it or set `failOpen: false` |
|
|
98
106
|
| Paid `/v1/intel/trust` | **not** default — inject a custom `screen` if you want it |
|
|
99
107
|
|
|
100
108
|
Payer identity prefers signed/encoded scheme fields (EIP-3009 `authorization.from`, Permit2
|
|
@@ -210,6 +218,31 @@ official x402 client receives 402
|
|
|
210
218
|
|
|
211
219
|
No AgentCash. No marketplace. No second probe. No TWZRD custody.
|
|
212
220
|
|
|
221
|
+
### PayKit (`@solana/pay-kit`)
|
|
222
|
+
|
|
223
|
+
Foundation [pay-kit#303](https://github.com/solana-foundation/pay-kit/pull/303)
|
|
224
|
+
exposes `onBeforeX402PaymentCreation` on `createPayKitClient` and registers it
|
|
225
|
+
on the internal x402Client. Pass TWZRD as that option — no TWZRD branding inside
|
|
226
|
+
pay-kit itself. This package does not hard-depend on unpublished `@solana/pay-kit`.
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
import { createPayKitClient } from "@solana/pay-kit";
|
|
230
|
+
import { createTwzrdPayKitBeforePaymentHook } from "twzrd-x402-gate";
|
|
231
|
+
|
|
232
|
+
const client = await createPayKitClient({
|
|
233
|
+
accept: ["x402"],
|
|
234
|
+
onBeforeX402PaymentCreation: createTwzrdPayKitBeforePaymentHook({
|
|
235
|
+
refuseWashFlagged: true,
|
|
236
|
+
}),
|
|
237
|
+
rpcUrl,
|
|
238
|
+
signer,
|
|
239
|
+
});
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Equivalent: `onBeforeX402PaymentCreation: installTwzrdAutoGate("pay-kit", { refuseWashFlagged: true })`.
|
|
243
|
+
Same official `@x402/core` context hook as Path E. Abort returns
|
|
244
|
+
`{ abort: true, reason }`; PayKit throws before `signTransactions`.
|
|
245
|
+
|
|
213
246
|
### MCP (`@x402/mcp`)
|
|
214
247
|
|
|
215
248
|
Wire `twzrdOnPaymentRequested` / prefer `onPaymentRequired` + `onBeforePayment` per
|
|
@@ -308,8 +341,12 @@ assertIntentApproved(intentBeingSigned, token, {
|
|
|
308
341
|
registry, // replay / consume-once
|
|
309
342
|
publicKeyPem: signer.publicKeyPem, // signature verification
|
|
310
343
|
});
|
|
311
|
-
// throws
|
|
312
|
-
//
|
|
344
|
+
// throws MISSING_VERIFIER_KEY | BAD_SIGNATURE | INTENT_HASH_MISMATCH |
|
|
345
|
+
// DECISION_EXPIRED | DECISION_NOT_ALLOW | DECISION_REPLAYED
|
|
346
|
+
// -> the signer is never invoked
|
|
347
|
+
// In-process matching without a key is unsafeAssertIntentApprovedWithoutSignature,
|
|
348
|
+
// exported only from the "twzrd-x402-gate/unsafe" subpath — never the root:
|
|
349
|
+
// import { unsafeAssertIntentApprovedWithoutSignature } from "twzrd-x402-gate/unsafe";
|
|
313
350
|
```
|
|
314
351
|
|
|
315
352
|
- `PaymentIntent` v1 (frozen): protocol `x402 | ap2 | ucp | mpp | direct` +
|
|
@@ -446,16 +483,22 @@ Library: `import { safeFetch } from "twzrd-x402-gate/safe-fetch"`.
|
|
|
446
483
|
|
|
447
484
|
## Quickstart: `installTwzrdAutoGate` (default-on)
|
|
448
485
|
|
|
449
|
-
Canonical entry point (design: `docs/strategy/install-autogate-design.md`). One name,
|
|
486
|
+
Canonical entry point (design: `docs/strategy/install-autogate-design.md`). One name, five adapters:
|
|
450
487
|
|
|
451
488
|
| Call | Adapter |
|
|
452
489
|
|------|---------|
|
|
453
490
|
| `installTwzrdAutoGate(payWrap, opts?)` | Fetch: guard raw fetch → pay client |
|
|
454
491
|
| `installTwzrdAutoGate(x402Client, opts?)` | Official x402 `onBeforePaymentCreation` |
|
|
492
|
+
| `installTwzrdAutoGate("x402-solana", opts)` | PayAI `beforePayment` on `createX402Client` |
|
|
493
|
+
| `installTwzrdAutoGate("pay-kit", opts)` | PayKit `onBeforeX402PaymentCreation` (Foundation #303) |
|
|
455
494
|
| `installTwzrdAutoGate("mpp", opts)` | MPP `onChallenge` (returns handler) |
|
|
456
495
|
|
|
457
496
|
Aliases: `installTwzrdX402ClientHook`, `createTwzrdMppOnChallenge` remain; docs prefer AutoGate.
|
|
458
497
|
Kill switch: `TWZRD_GATE_ENABLED=false` or `TWZRD_AUTO_GATE=0`. Uninstall x402 installs with `uninstallTwzrdAutoGate(client)`.
|
|
498
|
+
The env switch is read **per call** on the x402-client, x402-solana, pay-kit and MPP seats, so flipping it moves an already-installed
|
|
499
|
+
gate in both directions. The **fetch / payWrap** seat is the exception: it resolves the switch once, when the fetch is composed,
|
|
500
|
+
so a fetch built while the switch was off stays ungated after you clear it — rebuild the fetch. `options.disabled: true` is a
|
|
501
|
+
permanent install-time opt-out everywhere and no env change revives it.
|
|
459
502
|
|
|
460
503
|
|
|
461
504
|
`installTwzrdAutoGate` is the one-liner form of "guard the raw fetch, then hand it to your
|
|
@@ -499,13 +542,66 @@ The gate **recognizes** multi-chain 402s but only **reputation-scores Solana mai
|
|
|
499
542
|
| Network | Reputation scored? | Default policy (`unsupportedNetworkMode`) |
|
|
500
543
|
|---------|-------------------|-------------------------------------------|
|
|
501
544
|
| Solana mainnet | Yes — free preflight + merchant_card | allow/block from intel |
|
|
502
|
-
| Base / other EVM (`eip155:*`) | **No** | `observe` (default): `decision=unknown`, `policyAction=allow`, telemetry `unsupported_network_seen` |
|
|
545
|
+
| Base / other EVM (`eip155:*`) | **No** Solana preflight | `observe` (default): `decision=unknown`, `policyAction=allow`, telemetry `unsupported_network_seen`. **Wash still runs** — `wash_flagged` refuses before sign. |
|
|
503
546
|
| Base / EVM in `strict` mode | No | `policyAction=block` before sign |
|
|
504
547
|
|
|
505
548
|
This is intentional: Base listing abundance ≠ Solana behavioral history. Unsupported is never
|
|
506
549
|
represented as a TWZRD trust `allow`. Set `TWZRD_UNSUPPORTED_NETWORK_MODE=strict` (or
|
|
507
550
|
`{ unsupportedNetworkMode: "strict" }`) to hard-block unscored networks.
|
|
508
551
|
|
|
552
|
+
`requireReceipt` (Path A) follows the same line: `hard` receipts apply to **scored networks
|
|
553
|
+
only** — on an unscored network there is no receipt to buy, so the decision carries
|
|
554
|
+
`receiptSkipped: "unscored_network"` and continues. Use `strict` mode to fail closed there.
|
|
555
|
+
|
|
556
|
+
`requireLogInclusion` sits one step further: a captured Path A receipt does not **count** as
|
|
557
|
+
trust until its leaf is proven included in the Receipt Transparency log under a key you
|
|
558
|
+
pinned ([spec](../docs/transparency-log.md)). A valid signature proves authorship and
|
|
559
|
+
integrity; only the log proves the issuer showed everyone the same answer. The log is **live**
|
|
560
|
+
(v0.1 domain, genesis 2026-09-03), and a paid response carries its proof **inline** as
|
|
561
|
+
`log_inclusion` — the audit path plus the signed head it targets — once the leaf is merged, so
|
|
562
|
+
the usual case verifies **offline** with nothing but your pinned key. The gate takes no
|
|
563
|
+
dependency on the log verifier — you wire it; it receives the receipt *and* the whole paid
|
|
564
|
+
response, and `twzrd-log-verifier`'s results fit the verdict shape with no adapter:
|
|
565
|
+
|
|
566
|
+
```typescript
|
|
567
|
+
import { verifyLogInclusion, verifyReceiptInLog } from "twzrd-log-verifier"; // not yet on npm — see its README
|
|
568
|
+
|
|
569
|
+
// Today the log serves a single signing key (the receipt issuer key); pin it out of band.
|
|
570
|
+
// When v0.2 ships a key directory, pass that here instead — same call.
|
|
571
|
+
const PIN = "Ak5SQwHpuQAqU7ty7ZWX7qgF39A9yi72c22KNn8sHzvS";
|
|
572
|
+
|
|
573
|
+
await evaluate_x402_resource(url, requirements, {
|
|
574
|
+
requireReceipt: true,
|
|
575
|
+
x402Fetch,
|
|
576
|
+
requireLogInclusion: {
|
|
577
|
+
verifier: async (_receipt, ctx) =>
|
|
578
|
+
ctx.logInclusion
|
|
579
|
+
? verifyLogInclusion(ctx.response, PIN) // offline: no round-trip
|
|
580
|
+
: verifyReceiptInLog({ baseUrl: "https://intel.twzrd.xyz", receipt: ctx.response, trusted: PIN }), // fetch; 404 ⇒ pending
|
|
581
|
+
// hard: true — an unproven receipt denies spend (default)
|
|
582
|
+
// onPending: "deny" — a leaf not merged yet is unprovable at pay time; "allow"
|
|
583
|
+
// tolerates the one-anchor-period merge window (default "deny")
|
|
584
|
+
// refuseTofu: true — never accept keys the log advertised about itself (default)
|
|
585
|
+
},
|
|
586
|
+
});
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
The receipt is returned either way (`result.receipt`) — you paid for it. What changes is
|
|
590
|
+
`approved`: a denial sets `logInclusionDenied: true`, `policyAction: "block"`, and a reason of
|
|
591
|
+
`twzrd_log_inclusion_failed | _pending | _tofu_refused | _error`; `result.logInclusion` carries
|
|
592
|
+
the verdict (`key_id`, `leaf_index`, `tree_size`, `pending`, `tofu`). A verifier that throws
|
|
593
|
+
denies under `hard` — a broken or unreachable verifier must not wave receipts through. So does a
|
|
594
|
+
Path A attempt that yields no receipt at all (non-OK response, thrown fetch, `x402Fetch` not
|
|
595
|
+
wired): an outage on the receipt endpoint must never produce a *better* outcome than an empty
|
|
596
|
+
receipt body. Path A that your `requireReceipt` threshold never attempted is out of scope — this
|
|
597
|
+
knob gates receipts, it does not override your threshold.
|
|
598
|
+
|
|
599
|
+
Two things to know today: a leaf is merged within one anchor period, so a receipt paid for
|
|
600
|
+
*just now* may not yet carry `log_inclusion` — the fetch fallback above then reports `pending`,
|
|
601
|
+
and `onPending` decides. And nothing is **anchored** on Solana yet (`anchor_authority` is null),
|
|
602
|
+
so inclusion currently proves *what the log committed to*, not yet *when* — the anchor is what
|
|
603
|
+
makes backdating detectable.
|
|
604
|
+
|
|
509
605
|
Dual-chain accepts still prefer the Solana entry for scoring (same as payment clients that
|
|
510
606
|
prefer Solana when available).
|
|
511
607
|
|
|
@@ -786,7 +882,41 @@ Deterministic install→transcript path for operators (no wallet, no USDC):
|
|
|
786
882
|
npm run adoption-proof -- --integration demo-autogate-proof --run-id 00000000-0000-4000-8000-000000000001
|
|
787
883
|
```
|
|
788
884
|
|
|
789
|
-
Emits `twzrd.gate_adoption_transcript.v1` JSON: block path aborts with `signerInvocations: 0`, allow path emits decision, attribution headers stamped on mocked preflight. Full acceptance criteria (what counts as `EXTERNAL_RUN` vs dogfood)
|
|
885
|
+
Emits `twzrd.gate_adoption_transcript.v1` JSON: block path aborts with `signerInvocations: 0`, allow path emits decision, attribution headers stamped on mocked preflight. Full acceptance criteria (what counts as `EXTERNAL_RUN` vs dogfood), and the
|
|
886
|
+
harness's own limits: [`docs/strategy/gate-adoption-operator-proof.md`](../docs/strategy/gate-adoption-operator-proof.md)
|
|
887
|
+
in this repo — the same path the transcript's `acceptanceDoc` field cites.
|
|
888
|
+
|
|
889
|
+
## Portable decision receipt: `twzrd.payment_decision.v1`
|
|
890
|
+
|
|
891
|
+
A frozen, closed public record of one decision — what the agent saw
|
|
892
|
+
(`challenge_hash`), what it decided (`allow | block | warn | unavailable`), why
|
|
893
|
+
(one code from a closed enum) and an `evidence_id` — signed with your existing
|
|
894
|
+
decision signer and verifiable **offline** by anyone holding your public key.
|
|
895
|
+
No TWZRD call in the verification path. `unavailable` is a first-class decision
|
|
896
|
+
and is never written as `block`. The record carries **no** score, secret, raw
|
|
897
|
+
authorization/payload, amount or resource URL; the verifier rejects any of them.
|
|
898
|
+
|
|
899
|
+
```ts
|
|
900
|
+
import { createLocalDecisionSigner, evaluateIntent } from "twzrd-x402-gate";
|
|
901
|
+
import { paymentDecisionRecordFromToken, verifyPaymentDecisionRecord } from "twzrd-x402-gate/payment-decision";
|
|
902
|
+
|
|
903
|
+
const signer = createLocalDecisionSigner({ keyId: "ops-2026-09" });
|
|
904
|
+
const token = await evaluateIntent(intent, { signer, policy });
|
|
905
|
+
const record = await paymentDecisionRecordFromToken(token, selectedAccepts, signer);
|
|
906
|
+
|
|
907
|
+
// relying party, anywhere, later:
|
|
908
|
+
const r = verifyPaymentDecisionRecord(record, { publicKeyPem, challenge: selectedAccepts });
|
|
909
|
+
r.ok && r.decision; // "block" — or null when rejected
|
|
910
|
+
```
|
|
911
|
+
|
|
912
|
+
```bash
|
|
913
|
+
npx twzrd-payment-decision --verify record.json --pubkey issuer.spki.pem [--challenge accepts-entry.json] [--json]
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
Spec (schema, challenge normalization, what is signed, what is forbidden):
|
|
917
|
+
[`docs/payment-decision-v1-spec.md`](../docs/payment-decision-v1-spec.md) ·
|
|
918
|
+
JSON Schema: [`docs/schemas/twzrd.payment_decision.v1.schema.json`](../docs/schemas/twzrd.payment_decision.v1.schema.json) ·
|
|
919
|
+
test vectors: `test/fixtures/payment-decision-v1-vectors.json`.
|
|
790
920
|
|
|
791
921
|
## Run attribution (optional, for integration correlation)
|
|
792
922
|
|
|
@@ -830,8 +960,13 @@ If you're composing `withTwzrdGuard` manually instead, pass the raw (non-paying)
|
|
|
830
960
|
`POST /v1/intel/preflight` is the **free** `ReadinessCard` for the pre-spend decision.
|
|
831
961
|
The gate path only ever calls free endpoints — the preflight plus, by default
|
|
832
962
|
(`refuseWashFlagged: true`), the free merchant_card wash check. Paid intel
|
|
833
|
-
(`quickCheck`, `autoReceipt`) is opt-in
|
|
834
|
-
|
|
963
|
+
(`quickCheck`, `autoReceipt`) is otherwise opt-in, with one documented
|
|
964
|
+
exception (QUICKSTART 3b): on the fetch / payWrap seat, wiring a paying fetch
|
|
965
|
+
auto-enables buyer Path A, so a proceeding `warn` settles the $0.001 quick
|
|
966
|
+
tier ($0.05 at material size) through your wallet with no further flag —
|
|
967
|
+
opt out with `escalateOnWarn: false`, `requireReceipt: false`, or by leaving
|
|
968
|
+
`x402Fetch` unwired. The merchant-facing payment still waits on the free
|
|
969
|
+
preflight's verdict.
|
|
835
970
|
|
|
836
971
|
## License
|
|
837
972
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Export a twzrd.evidence_bundle.v1 from the no-spend adoption harness.
|
|
4
|
+
*
|
|
5
|
+
* npx twzrd-evidence-bundle --integration acme-ops-agent-v1 --run-id "$(uuidgen)"
|
|
6
|
+
* npx twzrd-evidence-bundle --integration acme-ops-agent-v1 --run-id <uuid> --out bundle.json
|
|
7
|
+
*
|
|
8
|
+
* Correlation evidence only — not EXTERNAL_RUN by itself.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
13
|
+
|
|
14
|
+
const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
+
// --verify re-checks an ALREADY PUBLISHED bundle. Offline and deterministic,
|
|
16
|
+
// so a foreign operator reaches the same verdict TWZRD would.
|
|
17
|
+
const verify = process.argv.includes("--verify");
|
|
18
|
+
const dist = join(pkgRoot, "dist", verify ? "evidence-verify.js" : "evidence-bundle.js");
|
|
19
|
+
|
|
20
|
+
if (!existsSync(dist)) {
|
|
21
|
+
console.error("twzrd-evidence-bundle: run `npm run build` in twzrd-x402-gate or install the published package");
|
|
22
|
+
process.exit(2);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const mod = await import(pathToFileURL(dist).href);
|
|
26
|
+
if (verify) {
|
|
27
|
+
const code = await mod.mainVerify(process.argv.slice(2).filter((a) => a !== "--verify"));
|
|
28
|
+
process.exit(code);
|
|
29
|
+
}
|
|
30
|
+
await mod.main(process.argv.slice(2)).catch((err) => {
|
|
31
|
+
console.error(err instanceof Error ? err.message : err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Verify a twzrd.payment_decision.v1 record offline.
|
|
4
|
+
*
|
|
5
|
+
* npx twzrd-payment-decision --verify record.json --pubkey issuer.spki.pem
|
|
6
|
+
* npx twzrd-payment-decision --verify record.json --pubkey issuer.spki.pem --challenge accepts-entry.json --json
|
|
7
|
+
*
|
|
8
|
+
* Exit 0 = accept, 1 = reject, 2 = usage / unreadable input. No network.
|
|
9
|
+
* Spec: docs/payment-decision-v1-spec.md.
|
|
10
|
+
*/
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { dirname, join } from "node:path";
|
|
13
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
|
+
|
|
15
|
+
const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
16
|
+
const dist = join(pkgRoot, "dist", "payment-decision.js");
|
|
17
|
+
|
|
18
|
+
if (!existsSync(dist)) {
|
|
19
|
+
console.error("twzrd-payment-decision: run `npm run build` in twzrd-x402-gate or install the published package");
|
|
20
|
+
process.exit(2);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const mod = await import(pathToFileURL(dist).href);
|
|
24
|
+
const code = await mod.mainVerify(process.argv.slice(2).filter((a) => a !== "--verify"));
|
|
25
|
+
process.exit(code);
|
package/dist/adoption-proof.d.ts
CHANGED
|
@@ -91,6 +91,15 @@ export type RunGateAdoptionProofOptions = {
|
|
|
91
91
|
*/
|
|
92
92
|
lineage?: GateAdoptionLineage;
|
|
93
93
|
};
|
|
94
|
+
export declare function isInternalIntegration(integration: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* AUDIT FIX (finding B): lineage may only TIGHTEN. isInternalIntegration()
|
|
97
|
+
* was a default that any explicit `lineage` overrode, so a twzrd-/ci- id could
|
|
98
|
+
* emit external_candidate with ok:true. An internal id is dogfood regardless
|
|
99
|
+
* of what the caller (or a hand-edited transcript) says; only a non-internal
|
|
100
|
+
* id may carry external_candidate, and it may still self-declare dogfood.
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolveLineage(integration: string, requested?: GateAdoptionLineage): GateAdoptionLineage;
|
|
94
103
|
/**
|
|
95
104
|
* Run the deterministic no-spend adoption proof.
|
|
96
105
|
* Never contacts a wallet; never spends USDC. Preflight is mocked.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adoption-proof.d.ts","sourceRoot":"","sources":["../src/adoption-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAKL,KAAK,wBAAwB,EAC9B,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,0BAA0B,EAAG,mCAA4C,CAAC;AAEvF,wEAAwE;AACxE,eAAO,MAAM,qBAAqB,gDAAgD,CAAC;AACnF,eAAO,MAAM,sBAAsB,4CAA4C,CAAC;AAChF,eAAO,MAAM,uBAAuB,kDAAkD,CAAC;AAEvF,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,YAAY,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,oBAAoB,EAAE,wBAAwB,CAAC;IAC/C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,E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AAI,GAAE,MAAM,EAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlF"}
|
package/dist/adoption-proof.js
CHANGED
|
@@ -83,18 +83,31 @@ function baseRequirements(amount) {
|
|
|
83
83
|
scheme: "exact",
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
|
-
function isInternalIntegration(integration) {
|
|
86
|
+
export function isInternalIntegration(integration) {
|
|
87
87
|
const i = integration.toLowerCase();
|
|
88
88
|
return (i.startsWith("twzrd-") ||
|
|
89
89
|
i.startsWith("twzrd/") ||
|
|
90
90
|
i.startsWith("ops-") ||
|
|
91
91
|
i.startsWith("test-") ||
|
|
92
|
+
i.startsWith("demo-") ||
|
|
92
93
|
i === "dogfood" ||
|
|
93
94
|
i.includes("dogfood") ||
|
|
94
95
|
i.includes("internal") ||
|
|
95
96
|
i.includes("ci-") ||
|
|
96
97
|
i === "gate-adoption-proof");
|
|
97
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* AUDIT FIX (finding B): lineage may only TIGHTEN. isInternalIntegration()
|
|
101
|
+
* was a default that any explicit `lineage` overrode, so a twzrd-/ci- id could
|
|
102
|
+
* emit external_candidate with ok:true. An internal id is dogfood regardless
|
|
103
|
+
* of what the caller (or a hand-edited transcript) says; only a non-internal
|
|
104
|
+
* id may carry external_candidate, and it may still self-declare dogfood.
|
|
105
|
+
*/
|
|
106
|
+
export function resolveLineage(integration, requested) {
|
|
107
|
+
if (isInternalIntegration(integration))
|
|
108
|
+
return "dogfood";
|
|
109
|
+
return requested === "dogfood" ? "dogfood" : "external_candidate";
|
|
110
|
+
}
|
|
98
111
|
/**
|
|
99
112
|
* Run the deterministic no-spend adoption proof.
|
|
100
113
|
* Never contacts a wallet; never spends USDC. Preflight is mocked.
|
|
@@ -105,8 +118,7 @@ export async function runGateAdoptionProof(opts = {}) {
|
|
|
105
118
|
(typeof crypto !== "undefined" && "randomUUID" in crypto
|
|
106
119
|
? crypto.randomUUID()
|
|
107
120
|
: `run-${Date.now()}`);
|
|
108
|
-
const lineage = opts.lineage
|
|
109
|
-
(isInternalIntegration(integration) ? "dogfood" : "external_candidate");
|
|
121
|
+
const lineage = resolveLineage(integration, opts.lineage);
|
|
110
122
|
const clientHeader = `twzrd-x402-gate/${CLIENT_VERSION}`;
|
|
111
123
|
const steps = [];
|
|
112
124
|
// ── block path: can_spend false → abort, signer must stay 0 ─────────────
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adoption-proof.js","sourceRoot":"","sources":["../src/adoption-proof.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,0BAA0B,GAK3B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,0BAA0B,GAAG,mCAA4C,CAAC;AAEvF,wEAAwE;AACxE,MAAM,CAAC,MAAM,qBAAqB,GAAG,6CAA6C,CAAC;AACnF,MAAM,CAAC,MAAM,sBAAsB,GAAG,yCAAyC,CAAC;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,+CAA+C,CAAC;AAkFvF,SAAS,UAAU;IAIjB,IAAI,IAIS,CAAC;IACd,MAAM,MAAM,GAAmB;QAC7B,uBAAuB,CAAC,CAAC;YACvB,IAAI,GAAG,CAAC,CAAC;YACT,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;IACF,OAAO;QACL,MAAM;QACN,KAAK,CAAC,IAAI,CAAC,GAAG;YACZ,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;YACjE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,QAAoC,EAAE,QAAiB;IAC5E,OAAO;QACL,cAAc,EAAE;YACd,QAAQ;YACR,SAAS,EAAE,QAAQ;YACnB,WAAW,EAAE,QAAQ,KAAK,OAAO,IAAI,CA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 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Design: docs/strategy/install-autogate-design.md (#1586).
|
|
5
5
|
*
|
|
6
|
-
* One name across
|
|
6
|
+
* One name across five adapters:
|
|
7
7
|
* 1. Fetch / payWrap — guard raw fetch, then hand to x402 payer
|
|
8
8
|
* 2. x402 client — onBeforePaymentCreation (@x402/core Path E)
|
|
9
9
|
* 3. x402-solana seat — beforePayment on createX402Client (PayAI 2.1.0+)
|
|
10
10
|
* 4. MPP — onChallenge via createTwzrdMppOnChallenge
|
|
11
|
+
* 5. PayKit seat — onBeforeX402PaymentCreation on createPayKitClient
|
|
12
|
+
* (Foundation pay-kit #303; optional / duck-typed)
|
|
11
13
|
*
|
|
12
14
|
* Default ON. Kill switch (any):
|
|
13
15
|
* TWZRD_AUTO_GATE=0|false
|
|
14
16
|
* TWZRD_GATE_ENABLED=0|false
|
|
15
17
|
* options.disabled: true
|
|
18
|
+
*
|
|
19
|
+
* Kill-switch timing, which differs by kind and is deliberate:
|
|
20
|
+
* - The ENV switches are re-read PER CALL on the MPP, x402-solana,
|
|
21
|
+
* pay-kit and x402-client adapters, so flipping one takes effect on
|
|
22
|
+
* already-installed hooks. It is a running switch, not only a deploy-time one.
|
|
23
|
+
* - `options.disabled: true` is an install-time opt-out and is permanent for
|
|
24
|
+
* that install: nothing is constructed and no later env change revives it.
|
|
25
|
+
* - EXCEPTION, adapter 1: the fetch / payWrap adapter still resolves the
|
|
26
|
+
* switch once, at install, because it composes fetch wrappers rather than
|
|
27
|
+
* dispatching per call. This is permanent in BOTH directions: setting
|
|
28
|
+
* TWZRD_AUTO_GATE=0 afterwards does not un-gate an already-composed fetch,
|
|
29
|
+
* and — the direction that matters — a fetch composed WHILE the switch was
|
|
30
|
+
* off stays ungated after it is cleared. Rebuild it either way.
|
|
16
31
|
*/
|
|
17
32
|
import { type TwzrdGuardOptions } from "./with-guard.js";
|
|
18
|
-
import { type BeforePaymentCreationResult, type InstallX402ClientHookOptions, type X402ClientLike, type X402SelectedRequirements, type X402SolanaBeforePaymentContext } from "./x402-client-hook.js";
|
|
33
|
+
import { type BeforePaymentCreationContext, type BeforePaymentCreationResult, type InstallX402ClientHookOptions, type X402ClientLike, type X402SelectedRequirements, type X402SolanaBeforePaymentContext } from "./x402-client-hook.js";
|
|
19
34
|
import { type MppOnChallengeHelpers, type MppOnChallengeOptions, type MppChallenge } from "./mpp-hook.js";
|
|
20
35
|
/**
|
|
21
36
|
* Takes a guarded (pre-pay-checked) fetch and returns the fetch your agent actually
|
|
@@ -78,6 +93,24 @@ export declare function installTwzrdAutoGate(adapter: "mpp", options: InstallAut
|
|
|
78
93
|
* });
|
|
79
94
|
*/
|
|
80
95
|
export declare function installTwzrdAutoGate(adapter: "x402-solana", options?: InstallAutoGateX402Options): (requirements: X402SelectedRequirements & Record<string, unknown>, context?: X402SolanaBeforePaymentContext) => Promise<BeforePaymentCreationResult>;
|
|
96
|
+
/**
|
|
97
|
+
* PayKit seat (Foundation pay-kit #303): returns the official `@x402/core`
|
|
98
|
+
* `BeforePaymentCreationHook` for `createPayKitClient({
|
|
99
|
+
* onBeforeX402PaymentCreation,
|
|
100
|
+
* })`. Same evaluator as `createTwzrdPayKitBeforePaymentHook`. No hard
|
|
101
|
+
* dependency on `@solana/pay-kit`.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const client = await createPayKitClient({
|
|
105
|
+
* accept: ["x402"],
|
|
106
|
+
* onBeforeX402PaymentCreation: installTwzrdAutoGate("pay-kit", {
|
|
107
|
+
* refuseWashFlagged: true,
|
|
108
|
+
* }),
|
|
109
|
+
* rpcUrl,
|
|
110
|
+
* signer,
|
|
111
|
+
* });
|
|
112
|
+
*/
|
|
113
|
+
export declare function installTwzrdAutoGate(adapter: "pay-kit", options?: InstallAutoGateX402Options): (context: BeforePaymentCreationContext) => Promise<BeforePaymentCreationResult>;
|
|
81
114
|
/**
|
|
82
115
|
* Disable a prior installTwzrdAutoGate on an x402 client (soft uninstall).
|
|
83
116
|
* Fetch compositions cannot be uninstalled — rebuild with disabled:true instead.
|
package/dist/auto-gate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-gate.d.ts","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auto-gate.d.ts","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,wBAAwB,EAC7B,KAAK,8BAA8B,EACpC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,KAAK,OAAO,KAAK,CAAC;AAEnE,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,GACzD,0BAA0B,GAAG;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,KAAK,CAAC;CACzB,CAAC;AAEJ,kFAAkF;AAClF,MAAM,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAEjE,MAAM,MAAM,0BAA0B,GAAG,4BAA4B,GACnE,0BAA0B,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,GAC3D,0BAA0B,CAAC;AAS7B,8DAA8D;AAC9D,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EA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