twzrd-x402-gate 0.9.12 → 0.9.13
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 +13 -11
- package/README.md +34 -27
- package/dist/auto-gate.d.ts +11 -5
- package/dist/auto-gate.d.ts.map +1 -1
- package/dist/auto-gate.js +17 -9
- package/dist/auto-gate.js.map +1 -1
- package/dist/cloudflare-x402.d.ts +3 -3
- package/dist/cloudflare-x402.js +3 -3
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -9
- package/dist/config.js.map +1 -1
- package/dist/consumer-adjacency.d.ts +1 -1
- package/dist/consumer-adjacency.js +1 -1
- package/dist/doctor.js +6 -6
- package/dist/evaluate.d.ts +3 -3
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +4 -5
- package/dist/evaluate.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/intelligence.js +2 -2
- package/dist/intelligence.js.map +1 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +20 -10
- package/dist/policy.js.map +1 -1
- package/dist/quick.d.ts +4 -3
- package/dist/quick.d.ts.map +1 -1
- package/dist/quick.js.map +1 -1
- package/dist/seller-hook.d.ts +6 -2
- package/dist/seller-hook.d.ts.map +1 -1
- package/dist/seller-hook.js +6 -1
- package/dist/seller-hook.js.map +1 -1
- package/dist/spend-control.d.ts.map +1 -1
- package/dist/spend-control.js +16 -0
- package/dist/spend-control.js.map +1 -1
- package/dist/types.d.ts +8 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/x402-client-hook.d.ts +6 -0
- package/dist/x402-client-hook.d.ts.map +1 -1
- package/dist/x402-client-hook.js +6 -0
- package/dist/x402-client-hook.js.map +1 -1
- package/package.json +2 -2
package/QUICKSTART.md
CHANGED
|
@@ -6,13 +6,13 @@ is unreachable the gate never *invents* a wash flag. A failed preflight, or a me
|
|
|
6
6
|
outage on a scored path, blocks by default (`TWZRD_FAIL_OPEN=true` to allow). A reachable
|
|
7
7
|
card with no wash signal still proceeds.
|
|
8
8
|
|
|
9
|
-
**Pin:** `twzrd-x402-gate@0.9.
|
|
9
|
+
**Pin:** `twzrd-x402-gate@0.9.13` + stock PayAI client `x402-solana@3.0.0` (official
|
|
10
10
|
`beforePayment` seat). `@x402/core` Path E remains supported; refuse script is fallback.
|
|
11
11
|
|
|
12
12
|
## 1. Stock PayAI client (default seat — copy-paste)
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm install twzrd-x402-gate@0.9.
|
|
15
|
+
npm install twzrd-x402-gate@0.9.13 x402-solana@3.0.0
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
> **ESM-only.** The package ships `import` conditions only — a CommonJS
|
|
@@ -37,7 +37,7 @@ Then: `await client.fetch("https://merchant.example/paid");`
|
|
|
37
37
|
## 1b. Official `@x402/core` client (Path E)
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install twzrd-x402-gate@0.9.
|
|
40
|
+
npm install twzrd-x402-gate@0.9.13 @x402/core @x402/fetch @x402/svm
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
@@ -73,9 +73,11 @@ const client = await createPayKitClient({
|
|
|
73
73
|
Equivalent: `onBeforeX402PaymentCreation: installTwzrdAutoGate("pay-kit", { refuseWashFlagged: true })`.
|
|
74
74
|
The hook is the official `@x402/core` context shape (same evaluator as Path E).
|
|
75
75
|
`@solana/pay-kit` is optional — this package does not hard-depend on it.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
`createTwzrdPayKitBeforePaymentHook` does not read `TWZRD_AUTO_GATE` or
|
|
77
|
+
`TWZRD_GATE_ENABLED`. `installTwzrdAutoGate("pay-kit", opts)` is the seat that
|
|
78
|
+
reads that kill switch per call and then calls the factory. You cannot
|
|
79
|
+
`installTwzrdAutoGate(client)` after `createPayKitClient` — PayKit only accepts
|
|
80
|
+
the hook at construction.
|
|
79
81
|
|
|
80
82
|
## 1d. Cold-start a foreign diet (0 USDC)
|
|
81
83
|
|
|
@@ -170,7 +172,7 @@ payWrap as `x402Fetch`.
|
|
|
170
172
|
|
|
171
173
|
| Knob | Effect |
|
|
172
174
|
|------|--------|
|
|
173
|
-
| `TWZRD_AUTO_GATE=0` | Kill switch
|
|
175
|
+
| `TWZRD_AUTO_GATE=0` | Kill switch for `installTwzrdAutoGate` only — that seat proceeds unguarded. `createTwzrdBeforePaymentHook` does not read `TWZRD_AUTO_GATE` or `TWZRD_GATE_ENABLED`, so a direct call still aborts a bad payment. `installTwzrdAutoGate` reads the switch per call on the x402-client / x402-solana / pay-kit / MPP seats before it calls the factory. The fetch (payWrap) seat resolves it once when the fetch is composed — rebuild the fetch to change it. |
|
|
174
176
|
| `refuseWashFlagged: false` | Stop refusing wash-flagged merchants (default `true`) |
|
|
175
177
|
| `gateOnCanSpend: true` | Opt-in hard cap: also block when `can_spend=false` (default `false`) |
|
|
176
178
|
|
|
@@ -178,9 +180,9 @@ Everything else (thresholds, wash caps, fail posture, settle guard): [README](./
|
|
|
178
180
|
|
|
179
181
|
## What this will NOT do
|
|
180
182
|
|
|
181
|
-
- **Base mainnet is scored.** Solana mainnet and Base mainnet (`eip155:8453`)
|
|
182
|
-
|
|
183
|
-
`TWZRD_UNSUPPORTED_NETWORK_MODE=strict`. Observe is
|
|
184
|
-
`wash_flagged` still refuses before sign.
|
|
183
|
+
- **Base mainnet is scored.** Solana mainnet and Base mainnet (`eip155:8453`)
|
|
184
|
+
run the scored preflight. Other EVM networks do not: they get an explicit
|
|
185
|
+
`unknown` unless you set `TWZRD_UNSUPPORTED_NETWORK_MODE=strict`. Observe is
|
|
186
|
+
not a wash bypass — `wash_flagged` still refuses before sign.
|
|
185
187
|
- **No delivery guarantee.** It screens the merchant before you pay, nothing after.
|
|
186
188
|
- **Not a wallet.** It never holds keys or signs — it only decides if your signer runs.
|
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ refuse. Protects the **payer** from a risky **merchant** (`payTo`). Chain-neutra
|
|
|
41
41
|
### Default-on AutoGate (5 lines)
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
npm install twzrd-x402-gate@0.9.
|
|
44
|
+
npm install twzrd-x402-gate@0.9.13 @x402/core @x402/fetch @x402/svm
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
```typescript
|
|
@@ -80,7 +80,7 @@ transfer on-chain. Wash/sybil edges are primarily discounted in TWZRD scoring, n
|
|
|
80
80
|
revenue refusal.
|
|
81
81
|
|
|
82
82
|
```bash
|
|
83
|
-
npm install twzrd-x402-gate@0.9.
|
|
83
|
+
npm install twzrd-x402-gate@0.9.13
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
```typescript
|
|
@@ -125,7 +125,7 @@ Fixture-backed SVM extract tests live in `test/seller-hook.test.ts` +
|
|
|
125
125
|
Install the published gate and run against wash fixtures:
|
|
126
126
|
|
|
127
127
|
```bash
|
|
128
|
-
npm install twzrd-x402-gate@0.9.
|
|
128
|
+
npm install twzrd-x402-gate@0.9.13
|
|
129
129
|
# from package root after install, or from a checkout:
|
|
130
130
|
npm run wash-dogfood
|
|
131
131
|
```
|
|
@@ -261,7 +261,7 @@ const payingFetch = installTwzrdAutoGate((guarded) =>
|
|
|
261
261
|
);
|
|
262
262
|
```
|
|
263
263
|
|
|
264
|
-
## Buyer flow
|
|
264
|
+
## Buyer flow — locked sequence
|
|
265
265
|
|
|
266
266
|
Canonical path for every agent that spends USDC on Solana x402:
|
|
267
267
|
|
|
@@ -269,7 +269,7 @@ Canonical path for every agent that spends USDC on Solana x402:
|
|
|
269
269
|
|------|------|------|----------------|
|
|
270
270
|
| 1 | `POST /v1/intel/preflight` | free | `decision=block` → refuse (`twzrd_decision_block`). Score floor / optional `can_spend` also deny. |
|
|
271
271
|
| 2 | `GET /v1/intel/merchant_card/{payTo}` | free | `wash_flagged: true` → refuse by default (`twzrd_wash_flagged`). **Only tightens** step 1. |
|
|
272
|
-
| 3 | First paid hop `quickCheck` | $0.001 | On `warn
|
|
272
|
+
| 3 | First paid hop `quickCheck` | $0.001 | On an approved `warn` with `x402Fetch` wired: `GET /v1/intel/quick/{payTo}` only. That hop does not request `GET /v1/intel/trust/{payTo}`. `/trust` at $0.05 is a separate allow-path receipt, not the warn hop. |
|
|
273
273
|
| 4 | Pay (or refuse) | resource price | Only if steps 1–2 approved (and any opt-in paid escalate did not block). |
|
|
274
274
|
|
|
275
275
|
**Fail-open (no invent):**
|
|
@@ -297,7 +297,7 @@ Dogfood (one public live proof path):
|
|
|
297
297
|
## Install
|
|
298
298
|
|
|
299
299
|
```bash
|
|
300
|
-
npm install twzrd-x402-gate@0.9.
|
|
300
|
+
npm install twzrd-x402-gate@0.9.13
|
|
301
301
|
```
|
|
302
302
|
|
|
303
303
|
Do not hardcode a version in this doc — every past pin here (**0.5.4**, **0.7.1**, **0.8.5**,
|
|
@@ -502,9 +502,10 @@ npx twzrd-bounty-preflight --board https://clawtasks.com/api/bounties?status=ope
|
|
|
502
502
|
```
|
|
503
503
|
|
|
504
504
|
Refuse reasons, in order: `gate_block` / `gate_wash_flagged` (TWZRD refused the
|
|
505
|
-
payee), `gate_unscored` (the payee's rail is outside the
|
|
506
|
-
|
|
507
|
-
trust allow; opt in with
|
|
505
|
+
payee), `gate_unscored` (the payee's rail is outside the scored corpus — Solana
|
|
506
|
+
mainnet and Base mainnet (`eip155:8453`) are scored; other rails are not; the
|
|
507
|
+
gate's "allow" there is a policy pass-through, never a trust allow; opt in with
|
|
508
|
+
`--allow-unscored-payee`, wash still refuses),
|
|
508
509
|
`payout_network_unsupported` / `payout_network_unknown`, `attempt_cost_over_max`
|
|
509
510
|
(attempt fee + board entry fee + stake vs the ceiling), `below_break_even` /
|
|
510
511
|
`assumed_win_prob_missing` (your declared win probability vs
|
|
@@ -527,9 +528,9 @@ Canonical entry point (design: `docs/strategy/install-autogate-design.md`). One
|
|
|
527
528
|
| `installTwzrdAutoGate("mpp", opts)` | MPP `onChallenge` (returns handler) |
|
|
528
529
|
|
|
529
530
|
Aliases: `installTwzrdX402ClientHook`, `createTwzrdMppOnChallenge` remain; docs prefer AutoGate.
|
|
530
|
-
Kill switch: `TWZRD_GATE_ENABLED=false` or `TWZRD_AUTO_GATE=0
|
|
531
|
-
|
|
532
|
-
|
|
531
|
+
Kill switch: `TWZRD_GATE_ENABLED=false` or `TWZRD_AUTO_GATE=0` applies to `installTwzrdAutoGate` only. `createTwzrdBeforePaymentHook` does not read those variables. Uninstall x402 installs with `uninstallTwzrdAutoGate(client)`.
|
|
532
|
+
`installTwzrdAutoGate` reads that switch **per call** on the x402-client, x402-solana, pay-kit and MPP seats before it calls the factory, so flipping it moves an already-installed
|
|
533
|
+
AutoGate seat in both directions. The **fetch / payWrap** seat is the exception: it resolves the switch once, when the fetch is composed,
|
|
533
534
|
so a fetch built while the switch was off stays ungated after you clear it — rebuild the fetch. `options.disabled: true` is a
|
|
534
535
|
permanent install-time opt-out everywhere and no env change revives it.
|
|
535
536
|
|
|
@@ -556,9 +557,11 @@ Any x402 client that composes over an underlying `fetch` works the same way —
|
|
|
556
557
|
whatever `payWrap` your client's API expects (agentcash, ClawRouter, PayAI, a custom
|
|
557
558
|
`@x402/svm` scheme, etc.).
|
|
558
559
|
|
|
559
|
-
|
|
560
|
-
`{ disabled: true }`
|
|
561
|
-
|
|
560
|
+
This `installTwzrdAutoGate(payWrap)` seat is default **ON**. Disable that seat with
|
|
561
|
+
`TWZRD_AUTO_GATE=0` or `TWZRD_GATE_ENABLED=false`, or with `{ disabled: true }`
|
|
562
|
+
(install option, for example in tests) — the raw fetch is handed straight to
|
|
563
|
+
`payWrap`, unguarded. `createTwzrdBeforePaymentHook` does not read those
|
|
564
|
+
variables. Setting them does not stop that factory from aborting a bad payment.
|
|
562
565
|
|
|
563
566
|
What happens on every HTTP 402 the raw fetch returns:
|
|
564
567
|
1. Reads the Solana-network entry from `accepts[]` (falls back to first entry) to get the seller wallet.
|
|
@@ -708,7 +711,7 @@ is the next step.
|
|
|
708
711
|
|
|
709
712
|
The reputation ladder has three rungs: **free** preflight (`allow/warn/block`), **$0.001**
|
|
710
713
|
`quickCheck` (tier + score, no receipt), **$0.05** `autoReceipt` (full intel + signed V7
|
|
711
|
-
receipt). When
|
|
714
|
+
receipt). When an evaluated `warn` is inconclusive and you want a
|
|
712
715
|
cheap *paid* confirmation before committing — without paying 50× for the portable receipt —
|
|
713
716
|
use `quickCheck`:
|
|
714
717
|
|
|
@@ -727,10 +730,12 @@ allow/warn/block decision stays the free preflight's job.
|
|
|
727
730
|
|
|
728
731
|
### Autonomous risk-escalation — `escalateOnWarn` (pay-to-confirm on warn)
|
|
729
732
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
An evaluated `warn` (no `null_reason`, score present) **proceeds** by default. A card
|
|
734
|
+
with `null_reason: unknown_subject` does not sign on Solana mainnet or Base mainnet, so
|
|
735
|
+
this hop does not run for it. `escalateOnWarn` closes the loop on a proceeding `warn`:
|
|
736
|
+
the guard settles the cheap **$0.001** `GET /v1/intel/quick/{payTo}` and **re-decides on
|
|
737
|
+
the paid score** — below the floor the payment is **blocked**, at/above it proceeds. That
|
|
738
|
+
hop does not request `GET /v1/intel/trust/`. The paid call fires from your
|
|
734
739
|
agent's own risk policy (no human), and the paid signal actually gates the spend (unlike
|
|
735
740
|
`autoReceipt`, which is upsell-only and never changes the decision).
|
|
736
741
|
|
|
@@ -887,17 +892,19 @@ const gatedFetch = wrapFetchWithTwzrdGate(fetch, resolveConfig());
|
|
|
887
892
|
|
|
888
893
|
A payment is **blocked** when:
|
|
889
894
|
1. `decision ∈ blockDecisions` (default: `["block"]`)
|
|
890
|
-
2. `trust_score < preflightMinScore` (default: `40`)
|
|
895
|
+
2. `trust_score < preflightMinScore` (default: `40`), after an evaluated card. `null_reason: unknown_subject` (or `score: null`) is not a low score: on Solana mainnet and Base mainnet it does not sign, even when `trust_score` is the floor 45.
|
|
891
896
|
3. `can_spend === false` — **only** when `gateOnCanSpend: true` (default `false`, opt-in)
|
|
897
|
+
4. the price is above `recommended_cap_usdc` when the card was otherwise approved
|
|
892
898
|
|
|
893
|
-
`
|
|
899
|
+
`null_reason: unknown_subject` returns reason `twzrd_unevaluated_subject_unknown_subject`. A price above `recommended_cap_usdc` returns a reason that starts with `twzrd_over_recommended_cap_`. A direct `createTwzrdBeforePaymentHook` abort of a block card returns reason `twzrd_decision_block`. That reason string is not `block` and is not `twzrd_fail_closed`. A missing `payTo` returns reason `twzrd_unidentifiable_payment_recipient` from `twzrdApprovePayment`. That reason is not `twzrd_missing_payTo`. When the buyer preflight fetch throws and `TWZRD_FAIL_OPEN` is unset, `twzrdApprovePayment` returns reason `twzrd_fail_closed`. That reason is not `twzrd_preflight_fetch_error`.
|
|
894
900
|
|
|
895
|
-
|
|
901
|
+
An evaluated `warn` (no `null_reason`, score present) is allowed unless overridden. When the buyer preflight fetch throws and `TWZRD_FAIL_OPEN` is unset, `twzrdApprovePayment` returns `approved: false` with reason `twzrd_fail_closed` and the wallet does not sign. An omitted `failOpen` on `createTwzrdSettleGuard` is a different default: a thrown screen returns without abort. 0.9.13 is not uniformly fail-closed.
|
|
902
|
+
|
|
903
|
+
A 402 whose payment requirements yield **no identifiable seller wallet** (missing/empty `payTo`, or an unparseable `accepts[]`) is a different case from "unknown seller" — it always **blocks** with `reason: twzrd_unidentifiable_payment_recipient`, without ever calling the preflight network. The wallet does not sign. This is unconditional (not affected by buyer `failOpen`): that switch governs a buyer preflight outage, not a missing payTo. An omitted `failOpen` on `createTwzrdSettleGuard` is a different default: a thrown screen returns without abort.
|
|
896
904
|
|
|
897
905
|
> **`can_spend` note:** the free preflight returns `can_spend=false` for most sellers
|
|
898
|
-
> not yet in the TWZRD corpus, including legitimate ones.
|
|
899
|
-
>
|
|
900
|
-
> Set `gateOnCanSpend: true` for strict mode.
|
|
906
|
+
> not yet in the TWZRD corpus, including legitimate ones. `can_spend: false` alone does not block (`gateOnCanSpend` defaults false). That is separate from `null_reason: unknown_subject`, which does not sign on a scored network.
|
|
907
|
+
> Set `gateOnCanSpend: true` to also block on `can_spend: false`.
|
|
901
908
|
|
|
902
909
|
## Config
|
|
903
910
|
|
|
@@ -906,7 +913,7 @@ A 402 whose payment requirements yield **no identifiable seller wallet** (missin
|
|
|
906
913
|
| `intelBase` | `TWZRD_INTEL_BASE` | `https://intel.twzrd.xyz` | Preflight API base |
|
|
907
914
|
| `preflightMinScore` | `TWZRD_PREFLIGHT_MIN_SCORE` | `40` | Block below this score |
|
|
908
915
|
| `blockDecisions` | `TWZRD_BLOCK_DECISIONS` | `block` | Decisions that throw |
|
|
909
|
-
| `failOpen` | `TWZRD_FAIL_OPEN` | `false` | `
|
|
916
|
+
| `failOpen` (buyer preflight only) | `TWZRD_FAIL_OPEN` | `false` | Buyer outage only: default does not sign. `createTwzrdSettleGuard` omitted `failOpen` is the other default — a thrown screen returns without abort |
|
|
910
917
|
| `gateOnCanSpend` | `TWZRD_GATE_ON_CAN_SPEND` | `false` | Also block when `can_spend=false` |
|
|
911
918
|
| `autoReceipt` | — | `false` | Optional V7: auto-buy $0.05 `/trust` when `/quick` did not already settle |
|
|
912
919
|
| `x402Fetch` | — | — | x402-capable fetch for `autoReceipt` |
|
package/dist/auto-gate.d.ts
CHANGED
|
@@ -11,15 +11,20 @@
|
|
|
11
11
|
* 5. PayKit seat — onBeforeX402PaymentCreation on createPayKitClient
|
|
12
12
|
* (Foundation pay-kit #303; optional / duck-typed)
|
|
13
13
|
*
|
|
14
|
-
* Default ON.
|
|
14
|
+
* Default ON for this installer. The kill switch is read only by
|
|
15
|
+
* installTwzrdAutoGate, not by createTwzrdBeforePaymentHook:
|
|
15
16
|
* TWZRD_AUTO_GATE=0|false
|
|
16
17
|
* TWZRD_GATE_ENABLED=0|false
|
|
17
18
|
* options.disabled: true
|
|
18
19
|
*
|
|
19
20
|
* Kill-switch timing, which differs by kind and is deliberate:
|
|
20
|
-
* -
|
|
21
|
-
* pay-kit and x402-client
|
|
22
|
-
*
|
|
21
|
+
* - installTwzrdAutoGate re-reads the ENV switches PER CALL on the MPP,
|
|
22
|
+
* x402-solana, pay-kit and x402-client seats, then either skips or calls
|
|
23
|
+
* the underlying factory. createTwzrdBeforePaymentHook itself does not
|
|
24
|
+
* read TWZRD_AUTO_GATE or TWZRD_GATE_ENABLED. Setting those variables
|
|
25
|
+
* does not stop a direct call to that factory from aborting a bad payment.
|
|
26
|
+
* Flipping the switch takes effect on an already-installed AutoGate seat.
|
|
27
|
+
* It is a running switch for that installer, not only a deploy-time one.
|
|
23
28
|
* - `options.disabled: true` is an install-time opt-out and is permanent for
|
|
24
29
|
* that install: nothing is constructed and no later env change revives it.
|
|
25
30
|
* - EXCEPTION, adapter 1: the fetch / payWrap adapter still resolves the
|
|
@@ -114,7 +119,8 @@ export declare function installTwzrdAutoGate(adapter: "pay-kit", options?: Insta
|
|
|
114
119
|
/**
|
|
115
120
|
* Disable a prior installTwzrdAutoGate on an x402 client (soft uninstall).
|
|
116
121
|
* Fetch compositions cannot be uninstalled — rebuild with disabled:true instead.
|
|
117
|
-
*
|
|
122
|
+
* AutoGate kill switch (this installer only): TWZRD_GATE_ENABLED=false or
|
|
123
|
+
* TWZRD_AUTO_GATE=0. createTwzrdBeforePaymentHook does not read those variables.
|
|
118
124
|
*/
|
|
119
125
|
export declare function uninstallTwzrdAutoGate(client: X402ClientLike): void;
|
|
120
126
|
//# sourceMappingURL=auto-gate.d.ts.map
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAG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C,OAAO,EAAE,KAAK,EACd,OAAO,EAAE,yBAAyB,GACjC,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAE5F;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,0BAA0B,GACnC,CACD,YAAY,EAAE,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChE,OAAO,CAAC,EAAE,8BAA8B,KACrC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAE1C;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,SAAS,EAClB,OAAO,CAAC,EAAE,0BAA0B,GACnC,CAAC,OAAO,EAAE,4BAA4B,KAAK,OAAO,CAAC,2BAA2B,CAAC,CAAC;AAwJnF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAWnE"}
|
package/dist/auto-gate.js
CHANGED
|
@@ -11,15 +11,20 @@
|
|
|
11
11
|
* 5. PayKit seat — onBeforeX402PaymentCreation on createPayKitClient
|
|
12
12
|
* (Foundation pay-kit #303; optional / duck-typed)
|
|
13
13
|
*
|
|
14
|
-
* Default ON.
|
|
14
|
+
* Default ON for this installer. The kill switch is read only by
|
|
15
|
+
* installTwzrdAutoGate, not by createTwzrdBeforePaymentHook:
|
|
15
16
|
* TWZRD_AUTO_GATE=0|false
|
|
16
17
|
* TWZRD_GATE_ENABLED=0|false
|
|
17
18
|
* options.disabled: true
|
|
18
19
|
*
|
|
19
20
|
* Kill-switch timing, which differs by kind and is deliberate:
|
|
20
|
-
* -
|
|
21
|
-
* pay-kit and x402-client
|
|
22
|
-
*
|
|
21
|
+
* - installTwzrdAutoGate re-reads the ENV switches PER CALL on the MPP,
|
|
22
|
+
* x402-solana, pay-kit and x402-client seats, then either skips or calls
|
|
23
|
+
* the underlying factory. createTwzrdBeforePaymentHook itself does not
|
|
24
|
+
* read TWZRD_AUTO_GATE or TWZRD_GATE_ENABLED. Setting those variables
|
|
25
|
+
* does not stop a direct call to that factory from aborting a bad payment.
|
|
26
|
+
* Flipping the switch takes effect on an already-installed AutoGate seat.
|
|
27
|
+
* It is a running switch for that installer, not only a deploy-time one.
|
|
23
28
|
* - `options.disabled: true` is an install-time opt-out and is permanent for
|
|
24
29
|
* that install: nothing is constructed and no later env change revives it.
|
|
25
30
|
* - EXCEPTION, adapter 1: the fetch / payWrap adapter still resolves the
|
|
@@ -66,9 +71,9 @@ export function installTwzrdAutoGate(target, options) {
|
|
|
66
71
|
return async (_challenge, helpers) => helpers.createCredential();
|
|
67
72
|
}
|
|
68
73
|
// AUDIT FIX: the env kill switch used to be read ONCE here, so a hook built
|
|
69
|
-
// before TWZRD_AUTO_GATE=0 kept gating forever while the x402-client
|
|
70
|
-
// honoured the same variable per call.
|
|
71
|
-
//
|
|
74
|
+
// before TWZRD_AUTO_GATE=0 kept gating forever while the x402-client seat
|
|
75
|
+
// honoured the same variable per call. This installer re-reads it per call.
|
|
76
|
+
// The inner factory does not read TWZRD_AUTO_GATE or TWZRD_GATE_ENABLED.
|
|
72
77
|
const gated = createTwzrdMppOnChallenge(mppOpts);
|
|
73
78
|
return async (challenge, helpers) => isTwzrdAutoGateDisabled(mppOpts) ? helpers.createCredential() : gated(challenge, helpers);
|
|
74
79
|
}
|
|
@@ -78,7 +83,9 @@ export function installTwzrdAutoGate(target, options) {
|
|
|
78
83
|
if (solOpts?.disabled === true) {
|
|
79
84
|
return async () => undefined;
|
|
80
85
|
}
|
|
81
|
-
// AUDIT FIX: same as the MPP seat —
|
|
86
|
+
// AUDIT FIX: same as the MPP seat — installTwzrdAutoGate re-reads the env
|
|
87
|
+
// per call, then calls createTwzrdBeforePaymentHook. That factory does not
|
|
88
|
+
// read TWZRD_AUTO_GATE or TWZRD_GATE_ENABLED.
|
|
82
89
|
const gated = createTwzrdBeforePaymentHook(solOpts);
|
|
83
90
|
return async (requirements, context) => isTwzrdAutoGateDisabled(solOpts) ? undefined : gated(requirements, context);
|
|
84
91
|
}
|
|
@@ -174,7 +181,8 @@ export function installTwzrdAutoGate(target, options) {
|
|
|
174
181
|
/**
|
|
175
182
|
* Disable a prior installTwzrdAutoGate on an x402 client (soft uninstall).
|
|
176
183
|
* Fetch compositions cannot be uninstalled — rebuild with disabled:true instead.
|
|
177
|
-
*
|
|
184
|
+
* AutoGate kill switch (this installer only): TWZRD_GATE_ENABLED=false or
|
|
185
|
+
* TWZRD_AUTO_GATE=0. createTwzrdBeforePaymentHook does not read those variables.
|
|
178
186
|
*/
|
|
179
187
|
export function uninstallTwzrdAutoGate(client) {
|
|
180
188
|
const states = clientInstalls.get(client);
|
package/dist/auto-gate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-gate.js","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auto-gate.js","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,0BAA0B,GAO3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,GAI1B,MAAM,eAAe,CAAC;AAoCvB;;6CAE6C;AAC7C,MAAM,cAAc,GAAG,IAAI,OAAO,EAAgC,CAAC;AAEnE,8DAA8D;AAC9D,MAAM,UAAU,uBAAuB,CAAC,OAAgC;IACtE,IAAI,OAAO,EAAE,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,IAAI,GA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,CAAC;QAClD,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACV,oFAAoF,CACrF,CAAC;AACJ,CAAC"}
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* payload. This adapter turns that callback into the same TWZRD decision used
|
|
7
7
|
* by the generic MCP hook.
|
|
8
8
|
*
|
|
9
|
-
* This is an approval boundary
|
|
10
|
-
*
|
|
11
|
-
* refuses
|
|
9
|
+
* This is an approval boundary. Solana mainnet and Base mainnet (`eip155:8453`)
|
|
10
|
+
* run the scored preflight. Other EVM networks stay `decision=unknown`: observe
|
|
11
|
+
* permits them and strict refuses them before the Cloudflare client pays.
|
|
12
12
|
*/
|
|
13
13
|
import type { TwzrdGateConfig, X402PaymentRequiredBody } from "./types.js";
|
|
14
14
|
/** Dependency-free structural shape passed to Cloudflare's callback. */
|
package/dist/cloudflare-x402.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* payload. This adapter turns that callback into the same TWZRD decision used
|
|
7
7
|
* by the generic MCP hook.
|
|
8
8
|
*
|
|
9
|
-
* This is an approval boundary
|
|
10
|
-
*
|
|
11
|
-
* refuses
|
|
9
|
+
* This is an approval boundary. Solana mainnet and Base mainnet (`eip155:8453`)
|
|
10
|
+
* run the scored preflight. Other EVM networks stay `decision=unknown`: observe
|
|
11
|
+
* permits them and strict refuses them before the Cloudflare client pays.
|
|
12
12
|
*/
|
|
13
13
|
import { resolveConfig } from "./config.js";
|
|
14
14
|
import { twzrdOnPaymentRequested } from "./mcp-hook.js";
|
package/dist/config.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export type ResolvedTwzrdGateConfig = {
|
|
|
10
10
|
/** Soft cap USDC when wash_flagged; null = hard refuse */
|
|
11
11
|
washMaxUsdc: number | null;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Policy for networks that are not scored. Solana mainnet and Base mainnet
|
|
14
|
+
* (`eip155:8453`) are scored. Other EVM networks are not. Default observe.
|
|
14
15
|
* @see UnsupportedNetworkMode in network.ts
|
|
15
16
|
*/
|
|
16
17
|
unsupportedNetworkMode: "observe" | "strict";
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0DAA0D;IAC1D,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,iBAAiB,EAAE,OAAO,CAAC;IAC3B,0DAA0D;IAC1D,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;;;OAIG;IACH,sBAAsB,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7C,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,0EAA0E;IAC1E,WAAW,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CACtD,CAAC;AAYF,wBAAgB,aAAa,CAAC,SAAS,CAAC,EAAE,eAAe,GAAG,uBAAuB,CAyFlF"}
|
package/dist/config.js
CHANGED
|
@@ -21,12 +21,9 @@ export function resolveConfig(overrides) {
|
|
|
21
21
|
const failOpen = overrides?.failOpen ??
|
|
22
22
|
(process.env.TWZRD_FAIL_OPEN === "true" ||
|
|
23
23
|
process.env.TWZRD_FAIL_OPEN === "1");
|
|
24
|
-
// Default false
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// the sister package @wzrd_sol/plugin-trustgate and the preflight's own
|
|
28
|
-
// warn-not-block intent, and keeps the gate usable for discovery. Opt in to
|
|
29
|
-
// strict can_spend gating with TWZRD_GATE_ON_CAN_SPEND=true or =1.
|
|
24
|
+
// Default false: can_spend false alone does not block. null_reason
|
|
25
|
+
// unknown_subject is refused earlier by isUnevaluatedCard and is not this
|
|
26
|
+
// knob. Opt in to strict can_spend gating with TWZRD_GATE_ON_CAN_SPEND=true or =1.
|
|
30
27
|
const gateOnCanSpend = overrides?.gateOnCanSpend ??
|
|
31
28
|
(process.env.TWZRD_GATE_ON_CAN_SPEND === "true" ||
|
|
32
29
|
process.env.TWZRD_GATE_ON_CAN_SPEND === "1");
|
|
@@ -44,9 +41,11 @@ export function resolveConfig(overrides) {
|
|
|
44
41
|
if (Number.isFinite(n) && n >= 0)
|
|
45
42
|
washMaxUsdc = n;
|
|
46
43
|
}
|
|
47
|
-
// Default observe
|
|
48
|
-
//
|
|
49
|
-
//
|
|
44
|
+
// Default observe for unscored networks. Solana mainnet and Base mainnet
|
|
45
|
+
// are scored, so they run the preflight. Other EVM networks skip that
|
|
46
|
+
// preflight and are marked decision=unknown (policy allow ≠ reputation
|
|
47
|
+
// allow). Wash still runs — wash_flagged refuses before sign. Strict blocks
|
|
48
|
+
// unscored networks outright.
|
|
50
49
|
const envMode = (process.env.TWZRD_UNSUPPORTED_NETWORK_MODE ?? "").trim().toLowerCase();
|
|
51
50
|
const unsupportedNetworkMode = overrides?.unsupportedNetworkMode ??
|
|
52
51
|
(envMode === "strict" ? "strict" : "observe");
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAwBA,SAAS,mBAAmB,CAAC,GAAuB;IAClD,MAAM,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC;IACtC,OAAO,IAAI,GAAG,CACZ,MAAM;SACH,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,SAA2B;IACvD,MAAM,SAAS,GAAG,CAChB,SAAS,EAAE,SAAS;QACpB,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC5B,yBAAyB,CAC1B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAEtB,MAAM,MAAM,GACV,SAAS,EAAE,iBAAiB;QAC5B,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,yBAAyB,IAAI,IAAI,CAAC,CAAC;IACxD,MAAM,iBAAiB,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjF,MAAM,cAAc,GAClB,SAAS,EAAE,cAAc,IAAI,IAAI;QAC/B,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,G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AAY;QACrC,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Consumer-agent adjacency router for Muse / Instinct / OpenClaw-class agents.
|
|
3
3
|
*
|
|
4
|
-
* Solana x402 accepts → TWZRD preflight path (
|
|
4
|
+
* Solana x402 accepts → TWZRD preflight path (skill check) before sign.
|
|
5
5
|
* Stripe / Link / Tempo / MPP-only → hand off; do NOT run Solana wash on those rails.
|
|
6
6
|
* Empty or template payTo → refuse.
|
|
7
7
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Consumer-agent adjacency router for Muse / Instinct / OpenClaw-class agents.
|
|
3
3
|
*
|
|
4
|
-
* Solana x402 accepts → TWZRD preflight path (
|
|
4
|
+
* Solana x402 accepts → TWZRD preflight path (skill check) before sign.
|
|
5
5
|
* Stripe / Link / Tempo / MPP-only → hand off; do NOT run Solana wash on those rails.
|
|
6
6
|
* Empty or template payTo → refuse.
|
|
7
7
|
*
|
package/dist/doctor.js
CHANGED
|
@@ -33,7 +33,7 @@ const HOSTS = [
|
|
|
33
33
|
id: "solana-agent-kit",
|
|
34
34
|
label: "Solana Agent Kit (SolanaAgentKit)",
|
|
35
35
|
deps: ["solana-agent-kit"],
|
|
36
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
36
|
+
install: "npm install twzrd-x402-gate@0.9.13",
|
|
37
37
|
snippet: `import { SolanaAgentKit } from "solana-agent-kit";
|
|
38
38
|
import { twzrdBeforeSign } from "twzrd-x402-gate";
|
|
39
39
|
|
|
@@ -49,7 +49,7 @@ const agent = new SolanaAgentKit(wallet, rpcUrl, {
|
|
|
49
49
|
id: "pay-kit",
|
|
50
50
|
label: "Solana PayKit (createPayKitClient)",
|
|
51
51
|
deps: ["@solana/pay-kit"],
|
|
52
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
52
|
+
install: "npm install twzrd-x402-gate@0.9.13 @solana/pay-kit",
|
|
53
53
|
snippet: `import { createPayKitClient } from "@solana/pay-kit";
|
|
54
54
|
import { createTwzrdPayKitBeforePaymentHook } from "twzrd-x402-gate";
|
|
55
55
|
|
|
@@ -71,7 +71,7 @@ const client = await createPayKitClient({
|
|
|
71
71
|
id: "x402-client",
|
|
72
72
|
label: "official x402 client (@x402/core)",
|
|
73
73
|
deps: ["@x402/core", "@x402/fetch", "@x402/svm"],
|
|
74
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
74
|
+
install: "npm install twzrd-x402-gate@0.9.13 @x402/core @x402/fetch @x402/svm",
|
|
75
75
|
snippet: `import { x402Client } from "@x402/core/client";
|
|
76
76
|
import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
77
77
|
|
|
@@ -83,7 +83,7 @@ installTwzrdAutoGate(client, { refuseWashFlagged: true });`,
|
|
|
83
83
|
id: "elizaos",
|
|
84
84
|
label: "elizaOS agent runtime",
|
|
85
85
|
deps: ["@elizaos/core", "elizaos"],
|
|
86
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
86
|
+
install: "npm install twzrd-x402-gate@0.9.13",
|
|
87
87
|
snippet: `import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
88
88
|
|
|
89
89
|
// Gate the payment client your plugin hands to the runtime, not the runtime
|
|
@@ -94,7 +94,7 @@ installTwzrdAutoGate(paymentClient, { refuseWashFlagged: true });`,
|
|
|
94
94
|
id: "goat",
|
|
95
95
|
label: "GOAT SDK",
|
|
96
96
|
deps: ["@goat-sdk/core"],
|
|
97
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
97
|
+
install: "npm install twzrd-x402-gate@0.9.13",
|
|
98
98
|
snippet: `import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
99
99
|
|
|
100
100
|
installTwzrdAutoGate(walletClient, { refuseWashFlagged: true });`,
|
|
@@ -103,7 +103,7 @@ installTwzrdAutoGate(walletClient, { refuseWashFlagged: true });`,
|
|
|
103
103
|
id: "raw-fetch",
|
|
104
104
|
label: "raw fetch + x402 payer",
|
|
105
105
|
deps: ["x402-fetch", "x402"],
|
|
106
|
-
install: "npm install twzrd-x402-gate@0.9.
|
|
106
|
+
install: "npm install twzrd-x402-gate@0.9.13",
|
|
107
107
|
snippet: `import { installTwzrdAutoGate } from "twzrd-x402-gate";
|
|
108
108
|
|
|
109
109
|
// Wraps fetch: a refused payment never reaches the payer.
|
package/dist/evaluate.d.ts
CHANGED
|
@@ -116,9 +116,9 @@ export type EvaluateX402Result = {
|
|
|
116
116
|
* auto-fetch optional V7 GET /trust via x402Fetch ($0.05).
|
|
117
117
|
* With requireReceipt.hard (default), deny spend if /trust fails.
|
|
118
118
|
*
|
|
119
|
-
* Defaults to gateOnCanSpend=false
|
|
120
|
-
*
|
|
121
|
-
*
|
|
119
|
+
* Defaults to gateOnCanSpend=false — `can_spend: false` alone does not block.
|
|
120
|
+
* A `null_reason: unknown_subject` card is refused before that knob and does
|
|
121
|
+
* not sign on Solana mainnet or Base mainnet.
|
|
122
122
|
*/
|
|
123
123
|
export declare function evaluate_x402_resource(resourceUrl: string, paymentRequirements: X402PaymentRequirements, opts?: EvaluateX402Options): Promise<EvaluateX402Result>;
|
|
124
124
|
//# sourceMappingURL=evaluate.d.ts.map
|
package/dist/evaluate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../src/evaluate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC/B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,M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,EAAE,SAAS,GAAG,IAAI,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAClC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAC1C,WAAW,EAAE,MAAM,EACnB,mBAAmB,EAAE,uBAAuB,EAC5C,IAAI,GAAE,mBAAwB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CAkS7B"}
|
package/dist/evaluate.js
CHANGED
|
@@ -15,9 +15,9 @@ import { evaluateLogInclusion, resolveRequireLogInclusionPolicy, } from "./log-i
|
|
|
15
15
|
* auto-fetch optional V7 GET /trust via x402Fetch ($0.05).
|
|
16
16
|
* With requireReceipt.hard (default), deny spend if /trust fails.
|
|
17
17
|
*
|
|
18
|
-
* Defaults to gateOnCanSpend=false
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Defaults to gateOnCanSpend=false — `can_spend: false` alone does not block.
|
|
19
|
+
* A `null_reason: unknown_subject` card is refused before that knob and does
|
|
20
|
+
* not sign on Solana mainnet or Base mainnet.
|
|
21
21
|
*/
|
|
22
22
|
export async function evaluate_x402_resource(resourceUrl, paymentRequirements, opts = {}) {
|
|
23
23
|
const config = resolveConfig({
|
|
@@ -25,8 +25,7 @@ export async function evaluate_x402_resource(resourceUrl, paymentRequirements, o
|
|
|
25
25
|
preflightMinScore: opts.preflightMinScore,
|
|
26
26
|
blockDecisions: opts.blockDecisions,
|
|
27
27
|
failOpen: opts.failOpen,
|
|
28
|
-
//
|
|
29
|
-
// Gating on can_spend would block every Agentic.Market seller not in corpus.
|
|
28
|
+
// can_spend false alone does not block. unknown_subject is refused earlier.
|
|
30
29
|
gateOnCanSpend: opts.gateOnCanSpend,
|
|
31
30
|
refuseWashFlagged: opts.refuseWashFlagged,
|
|
32
31
|
washMaxUsdc: opts.washMaxUsdc,
|