twzrd-x402-gate 0.8.2 → 0.8.3

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/README.md CHANGED
@@ -358,6 +358,18 @@ Library: `import { safeFetch } from "twzrd-x402-gate/safe-fetch"`.
358
358
 
359
359
  ## Quickstart: `installTwzrdAutoGate` (default-on)
360
360
 
361
+ Canonical entry point (design: `docs/strategy/install-autogate-design.md`). One name, three adapters:
362
+
363
+ | Call | Adapter |
364
+ |------|---------|
365
+ | `installTwzrdAutoGate(payWrap, opts?)` | Fetch: guard raw fetch → pay client |
366
+ | `installTwzrdAutoGate(x402Client, opts?)` | Official x402 `onBeforePaymentCreation` |
367
+ | `installTwzrdAutoGate("mpp", opts)` | MPP `onChallenge` (returns handler) |
368
+
369
+ Aliases: `installTwzrdX402ClientHook`, `createTwzrdMppOnChallenge` remain; docs prefer AutoGate.
370
+ Kill switch: `TWZRD_GATE_ENABLED=false` or `TWZRD_AUTO_GATE=0`. Uninstall x402 installs with `uninstallTwzrdAutoGate(client)`.
371
+
372
+
361
373
  `installTwzrdAutoGate` is the one-liner form of "guard the raw fetch, then hand it to your
362
374
  x402 client." It takes a `payWrap` function — whatever composes your paying client on top of
363
375
  a fetch — and returns a fetch that's already gated: a blocked seller throws before your client
@@ -701,8 +713,10 @@ If you're composing `withTwzrdGuard` manually instead, pass the raw (non-paying)
701
713
 
702
714
  `GET /v1/intel/trust/{wallet}` is the **paid** ($0.05 USDC) deep-intel surface — not a gate.
703
715
  `POST /v1/intel/preflight` is the **free** `ReadinessCard` for the pre-spend decision.
704
- This package only ever calls the free preflight; you decide whether to proceed before any
705
- USDC leaves your wallet.
716
+ The gate path only ever calls free endpoints the preflight plus, by default
717
+ (`refuseWashFlagged: true`), the free merchant_card wash check. Paid intel
718
+ (`quickCheck`, `autoReceipt`) is opt-in and never runs implicitly; you decide
719
+ whether to proceed before any USDC leaves your wallet.
706
720
 
707
721
  ## License
708
722
 
@@ -1,48 +1,73 @@
1
+ /**
2
+ * installTwzrdAutoGate — canonical default trust checkpoint entry point.
3
+ *
4
+ * Design: docs/strategy/install-autogate-design.md (#1586).
5
+ *
6
+ * One name across three adapters:
7
+ * 1. Fetch / payWrap — guard raw fetch, then hand to x402 payer
8
+ * 2. x402 client — onBeforePaymentCreation (official Path E)
9
+ * 3. MPP — onChallenge via createTwzrdMppOnChallenge
10
+ *
11
+ * Default ON. Kill switch (any):
12
+ * TWZRD_AUTO_GATE=0|false
13
+ * TWZRD_GATE_ENABLED=0|false
14
+ * options.disabled: true
15
+ */
1
16
  import { type TwzrdGuardOptions } from "./with-guard.js";
17
+ import { type InstallX402ClientHookOptions, type X402ClientLike } from "./x402-client-hook.js";
18
+ import { type MppOnChallengeHelpers, type MppOnChallengeOptions, type MppChallenge } from "./mpp-hook.js";
2
19
  /**
3
20
  * Takes a guarded (pre-pay-checked) fetch and returns the fetch your agent actually
4
- * calls — i.e. your x402 client composed on top of the guard (agentcash, ClawRouter,
5
- * @x402/svm, PayAI, etc.).
21
+ * calls — i.e. your x402 client composed on top of the guard.
6
22
  */
7
23
  export type PayWrap = (guardedFetch: typeof fetch) => typeof fetch;
8
- export type InstallAutoGateOptions = TwzrdGuardOptions & {
24
+ export type TwzrdAutoGateCommonOptions = {
9
25
  /**
10
- * The RAW (non-paying) fetch to guard. This MUST be a fetch that still surfaces
11
- * HTTP 402 do not pass an already-paying client here (see compatibility note
12
- * in README: proxied clients like AgentCash/.fetch resolve 402 internally and
13
- * return 200, so the guard would never see the block condition).
14
- * Default: globalThis.fetch.
26
+ * Force-disable the gate. Mirrors TWZRD_AUTO_GATE=0|false and
27
+ * TWZRD_GATE_ENABLED=0|false. Prefer env for deploy kill switch; use this for tests.
15
28
  */
16
- rawFetch?: typeof fetch;
29
+ disabled?: boolean;
30
+ };
31
+ export type InstallAutoGateFetchOptions = TwzrdGuardOptions & TwzrdAutoGateCommonOptions & {
17
32
  /**
18
- * Force-disable the gate (payWrap gets the raw fetch, unguarded). Mirrors
19
- * TWZRD_AUTO_GATE=0 / "false". Prefer the env var for a deploy-time kill switch;
20
- * use this for tests.
33
+ * RAW (non-paying) fetch that still surfaces HTTP 402.
34
+ * Default: globalThis.fetch.
21
35
  */
22
- disabled?: boolean;
36
+ rawFetch?: typeof fetch;
23
37
  };
38
+ /** @deprecated Prefer InstallAutoGateFetchOptions — same type (fetch adapter). */
39
+ export type InstallAutoGateOptions = InstallAutoGateFetchOptions;
40
+ export type InstallAutoGateX402Options = InstallX402ClientHookOptions & TwzrdAutoGateCommonOptions;
41
+ export type InstallAutoGateMppOptions = MppOnChallengeOptions & TwzrdAutoGateCommonOptions;
42
+ /** True when env or options ask to skip the gate entirely. */
43
+ export declare function isTwzrdAutoGateDisabled(options?: {
44
+ disabled?: boolean;
45
+ }): boolean;
24
46
  /**
25
- * Default-on composition helper: guards the RAW fetch with the free TWZRD preflight,
26
- * THEN hands the guarded fetch to your payment wrapper. This is the one-liner form of
27
- * the two-step pattern documented in the README:
28
- *
29
- * const raw = globalThis.fetch;
30
- * const gated = withTwzrdGuard(raw);
31
- * const paying = payWrap(gated);
32
- *
33
- * Composing it this way by construction rules out the common mis-wiring of guarding
34
- * an already-paying fetch (which returns 200 and never gives the guard a 402 to act on).
47
+ * Fetch adapter guard RAW fetch, then hand to payWrap.
35
48
  *
36
- * Default ON — a blocked seller throws before payWrap's client ever signs. Opt out with
37
- * TWZRD_AUTO_GATE=0 (env) or { disabled: true } (per-call), e.g. for a local dev harness
38
- * that intentionally wants the unguarded fetch.
49
+ * @example
50
+ * const payingFetch = installTwzrdAutoGate((g) => wrapFetchWithPayment(g, wallet));
51
+ */
52
+ export declare function installTwzrdAutoGate(payWrap: PayWrap, options?: InstallAutoGateFetchOptions): typeof fetch;
53
+ /**
54
+ * x402 client adapter — install at onBeforePaymentCreation (before sign).
39
55
  *
40
56
  * @example
41
- * import { installTwzrdAutoGate } from "twzrd-x402-gate";
42
- * import { wrapFetchWithPayment } from "@x402/svm";
57
+ * installTwzrdAutoGate(client, { refuseWashFlagged: true });
58
+ */
59
+ export declare function installTwzrdAutoGate(client: X402ClientLike, options?: InstallAutoGateX402Options): X402ClientLike;
60
+ /**
61
+ * MPP adapter — returns onChallenge for Mppx.create({ onChallenge }).
43
62
  *
44
- * const payingFetch = installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
45
- * await payingFetch("https://api.exa.ai/search"); // blocked sellers throw before signing
63
+ * @example
64
+ * onChallenge: installTwzrdAutoGate("mpp", { signer, policy: { maxAmountUsd: "1.00" } })
65
+ */
66
+ export declare function installTwzrdAutoGate(adapter: "mpp", options: InstallAutoGateMppOptions): (challenge: MppChallenge, helpers: MppOnChallengeHelpers) => Promise<string | undefined>;
67
+ /**
68
+ * Disable a prior installTwzrdAutoGate on an x402 client (soft uninstall).
69
+ * Fetch compositions cannot be uninstalled — rebuild with disabled:true instead.
70
+ * Process-wide kill: TWZRD_GATE_ENABLED=false or TWZRD_AUTO_GATE=0.
46
71
  */
47
- export declare function installTwzrdAutoGate(payWrap: PayWrap, options?: InstallAutoGateOptions): typeof fetch;
72
+ export declare function uninstallTwzrdAutoGate(client: X402ClientLike): void;
48
73
  //# sourceMappingURL=auto-gate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-gate.d.ts","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,KAAK,OAAO,KAAK,CAAC;AAEnE,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG;IACvD;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,KAAK,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBA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oB,CAClC,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,0BAA0B,GACnC,cAAc,CAAC;AAElB;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,KAAK,EACd,OAAO,EAAE,yBAAyB,GACjC,CAAC,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AAiE5F;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CASnE"}
package/dist/auto-gate.js CHANGED
@@ -1,34 +1,95 @@
1
- import { withTwzrdGuard } from "./with-guard.js";
2
1
  /**
3
- * Default-on composition helper: guards the RAW fetch with the free TWZRD preflight,
4
- * THEN hands the guarded fetch to your payment wrapper. This is the one-liner form of
5
- * the two-step pattern documented in the README:
6
- *
7
- * const raw = globalThis.fetch;
8
- * const gated = withTwzrdGuard(raw);
9
- * const paying = payWrap(gated);
10
- *
11
- * Composing it this way by construction rules out the common mis-wiring of guarding
12
- * an already-paying fetch (which returns 200 and never gives the guard a 402 to act on).
2
+ * installTwzrdAutoGate canonical default trust checkpoint entry point.
13
3
  *
14
- * Default ON — a blocked seller throws before payWrap's client ever signs. Opt out with
15
- * TWZRD_AUTO_GATE=0 (env) or { disabled: true } (per-call), e.g. for a local dev harness
16
- * that intentionally wants the unguarded fetch.
4
+ * Design: docs/strategy/install-autogate-design.md (#1586).
17
5
  *
18
- * @example
19
- * import { installTwzrdAutoGate } from "twzrd-x402-gate";
20
- * import { wrapFetchWithPayment } from "@x402/svm";
6
+ * One name across three adapters:
7
+ * 1. Fetch / payWrap — guard raw fetch, then hand to x402 payer
8
+ * 2. x402 client — onBeforePaymentCreation (official Path E)
9
+ * 3. MPP — onChallenge via createTwzrdMppOnChallenge
21
10
  *
22
- * const payingFetch = installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
23
- * await payingFetch("https://api.exa.ai/search"); // blocked sellers throw before signing
11
+ * Default ON. Kill switch (any):
12
+ * TWZRD_AUTO_GATE=0|false
13
+ * TWZRD_GATE_ENABLED=0|false
14
+ * options.disabled: true
15
+ */
16
+ import { withTwzrdGuard } from "./with-guard.js";
17
+ import { installTwzrdX402ClientHook, } from "./x402-client-hook.js";
18
+ import { createTwzrdMppOnChallenge, } from "./mpp-hook.js";
19
+ const clientInstalls = new WeakMap();
20
+ /** True when env or options ask to skip the gate entirely. */
21
+ export function isTwzrdAutoGateDisabled(options) {
22
+ if (options?.disabled === true)
23
+ return true;
24
+ const auto = process.env.TWZRD_AUTO_GATE;
25
+ if (auto === "0" || auto === "false")
26
+ return true;
27
+ const gate = process.env.TWZRD_GATE_ENABLED;
28
+ if (gate === "0" || gate === "false")
29
+ return true;
30
+ return false;
31
+ }
32
+ function isPayWrap(x) {
33
+ return typeof x === "function";
34
+ }
35
+ function isX402ClientLike(x) {
36
+ return (!!x &&
37
+ typeof x === "object" &&
38
+ typeof x.onBeforePaymentCreation === "function");
39
+ }
40
+ export function installTwzrdAutoGate(target, options) {
41
+ // ── MPP ──────────────────────────────────────────────────────────────
42
+ if (target === "mpp") {
43
+ const mppOpts = options;
44
+ if (isTwzrdAutoGateDisabled(mppOpts)) {
45
+ return async (_challenge, helpers) => helpers.createCredential();
46
+ }
47
+ return createTwzrdMppOnChallenge(mppOpts);
48
+ }
49
+ // ── x402 client ──────────────────────────────────────────────────────
50
+ if (isX402ClientLike(target)) {
51
+ const x402Opts = options;
52
+ if (isTwzrdAutoGateDisabled(x402Opts)) {
53
+ return target;
54
+ }
55
+ if (clientInstalls.has(target)) {
56
+ console.warn("[twzrd-x402-gate] installTwzrdAutoGate: client already gated; dual install may double-evaluate. Call uninstallTwzrdAutoGate first.");
57
+ }
58
+ const state = { disabled: false };
59
+ clientInstalls.set(target, state);
60
+ // Wrap the registrar so every installed before-payment hook honors uninstall + env kill.
61
+ const originalRegister = target.onBeforePaymentCreation.bind(target);
62
+ target.onBeforePaymentCreation = ((hook) => originalRegister(async (context) => {
63
+ if (state.disabled || isTwzrdAutoGateDisabled()) {
64
+ return undefined; // proceed unguarded
65
+ }
66
+ return hook(context);
67
+ }));
68
+ installTwzrdX402ClientHook(target, x402Opts);
69
+ return target;
70
+ }
71
+ // ── Fetch / payWrap ──────────────────────────────────────────────────
72
+ if (isPayWrap(target)) {
73
+ const fetchOpts = options;
74
+ const raw = fetchOpts?.rawFetch ?? globalThis.fetch;
75
+ if (isTwzrdAutoGateDisabled(fetchOpts)) {
76
+ return target(raw);
77
+ }
78
+ return target(withTwzrdGuard(raw, fetchOpts));
79
+ }
80
+ throw new TypeError('[twzrd-x402-gate] installTwzrdAutoGate: expected a PayWrap function, an x402 client with onBeforePaymentCreation, or the string "mpp"');
81
+ }
82
+ /**
83
+ * Disable a prior installTwzrdAutoGate on an x402 client (soft uninstall).
84
+ * Fetch compositions cannot be uninstalled — rebuild with disabled:true instead.
85
+ * Process-wide kill: TWZRD_GATE_ENABLED=false or TWZRD_AUTO_GATE=0.
24
86
  */
25
- export function installTwzrdAutoGate(payWrap, options) {
26
- const raw = options?.rawFetch ?? globalThis.fetch;
27
- const envDisabled = process.env.TWZRD_AUTO_GATE === "0" || process.env.TWZRD_AUTO_GATE === "false";
28
- const disabled = options?.disabled ?? envDisabled;
29
- if (disabled)
30
- return payWrap(raw);
31
- const guarded = withTwzrdGuard(raw, options);
32
- return payWrap(guarded);
87
+ export function uninstallTwzrdAutoGate(client) {
88
+ const state = clientInstalls.get(client);
89
+ if (state) {
90
+ state.disabled = true;
91
+ return;
92
+ }
93
+ console.warn("[twzrd-x402-gate] uninstallTwzrdAutoGate: no install state for this client (noop).");
33
94
  }
34
95
  //# sourceMappingURL=auto-gate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-gate.js","sourceRoot":"","sources":["../src/auto-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AA0BzE;;;;;;;;;;;;;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EAAE,CACzC,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;YACjC,IAAI,KAAK,CAAC,QAAQ,IAAI,uBAAuB,EAAE,EAAE,CAAC;gBAChD,OAAO,SAAS,CAAC,CAAC,oBAAoB;YACxC,CAAC;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC,CAAC,CAA8C,CAAC;QAEnD,0BAA0B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,wEAAwE;IACxE,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,OAAkD,CAAC;QACrE,MAAM,GAAG,GAAG,SAAS,EAAE,QAAQ,IAAI,UAAU,CAAC,KAAK,CAAC;QACpD,IAAI,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;YACvC,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,IAAI,SAAS,CACjB,uIAAuI,CACxI,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAC,MAAgB,CAAC,CAAC;IACnD,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;QACtB,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CACV,oFAAoF,CACrF,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,7 +10,7 @@ export { twzrdOnPaymentRequested } from "./mcp-hook.js";
10
10
  export { wrapFetchWithTwzrdGate } from "./wrap-fetch.js";
11
11
  export { evaluate_x402_resource, type EvaluateX402Options, type EvaluateX402Result, } from "./evaluate.js";
12
12
  export { withTwzrdGuard, type TwzrdGuardOptions } from "./with-guard.js";
13
- export { installTwzrdAutoGate, type PayWrap, type InstallAutoGateOptions, } from "./auto-gate.js";
13
+ export { installTwzrdAutoGate, uninstallTwzrdAutoGate, isTwzrdAutoGateDisabled, type PayWrap, type InstallAutoGateOptions, type InstallAutoGateFetchOptions, type InstallAutoGateX402Options, type InstallAutoGateMppOptions, type TwzrdAutoGateCommonOptions, } from "./auto-gate.js";
14
14
  export { safeFetch, runAgentcashFetch, main as safeFetchMain, type SafeFetchOptions, type SafeFetchResult, } from "./safe-fetch.js";
15
15
  export { installTwzrdX402ClientHook, twzrdBeforePaymentCreation, type X402ClientLike, type X402SelectedRequirements, type BeforePaymentCreationContext, type BeforePaymentCreationResult, type InstallX402ClientHookOptions, type X402PaymentControlOptions, } from "./x402-client-hook.js";
16
16
  export { runGateAdoptionProof, main as adoptionProofMain, ADOPTION_TRANSCRIPT_SCHEMA, ADOPTION_PROOF_SELLER, ADOPTION_PROOF_NETWORK, ADOPTION_PROOF_RESOURCE, type GateAdoptionTranscript, type GateAdoptionStep, type GateAdoptionAssertions, type GateAdoptionLineage, type RunGateAdoptionProofOptions, } from "./adoption-proof.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,KAAK,mBAAmB,GACzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/F,OAAO,EACL,eAAe,EACf,wBAAwB,EAC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BAAwB,GAC9B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,8BAA8B,EAC9B,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,kBAAkB,GACxB,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ export { twzrdOnPaymentRequested } from "./mcp-hook.js";
13
13
  export { wrapFetchWithTwzrdGate } from "./wrap-fetch.js";
14
14
  export { evaluate_x402_resource, } from "./evaluate.js";
15
15
  export { withTwzrdGuard } from "./with-guard.js";
16
- export { installTwzrdAutoGate, } from "./auto-gate.js";
16
+ export { installTwzrdAutoGate, uninstallTwzrdAutoGate, isTwzrdAutoGateDisabled, } from "./auto-gate.js";
17
17
  export { safeFetch, runAgentcashFetch, main as safeFetchMain, } from "./safe-fetch.js";
18
18
  export { installTwzrdX402ClientHook, twzrdBeforePaymentCreation, } from "./x402-client-hook.js";
19
19
  export { runGateAdoptionProof, main as adoptionProofMain, ADOPTION_TRANSCRIPT_SCHEMA, ADOPTION_PROOF_SELLER, ADOPTION_PROOF_NETWORK, ADOPTION_PROOF_RESOURCE, } from "./adoption-proof.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,qFAAqF;AACrF,uFAAuF;AACvF,qFAAqF;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAkB,MAAM,WAAW,CAAC;AACzE,OAAO,EAAE,aAAa,EAAgC,MAAM,aAAa,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GAEpB,MAA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M,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "twzrd-x402-gate",
3
- "version": "0.8.2",
4
- "description": "Core: buyer-side x402 trust gate. Free TWZRD preflight (ReadinessCard) before signing USDC to any merchant, with optional $0.001 paid trust escalate on warn — blocking spend on bad intel, no human in the loop. Optional: createTwzrdSettleGuard for resource servers to apply merchant policy on the payer before settle+serve (abuse/sanctions/bots; not equal to the buyer product wash resistance is mainly TWZRD scoring). Default refuse when free merchant_card.wash_flagged (opt out TWZRD_REFUSE_WASH_FLAGGED=0). A 402 with no extractable payTo fails closed (twzrd_unidentifiable_payment_recipient). Wraps fetch (HTTP 402) and the @x402/mcp onPaymentRequested hook — fixed in 0.5.2 for real @x402/mcp v2 nested paymentRequired.accepts. installTwzrdAutoGate(payWrap) is the default-on one-liner. BREAKING(0.2.0): fail-closed by default — set TWZRD_FAIL_OPEN=true to restore legacy allow-on-outage behavior.",
3
+ "version": "0.8.3",
4
+ "description": "Core: buyer-side x402 trust gate. Free TWZRD preflight (ReadinessCard) before signing USDC to any merchant, with optional $0.001 paid trust escalate on warn — blocking spend on bad intel, no human in the loop. Optional: createTwzrdSettleGuard for resource servers to apply merchant policy on the payer before settle+serve. installTwzrdAutoGate is the canonical default-on entry across fetch payWrap, x402 client (onBeforePaymentCreation), and MPP onChallenge. Fail-closed by default — set TWZRD_FAIL_OPEN=true for outage allow; kill switch TWZRD_GATE_ENABLED=false or TWZRD_AUTO_GATE=0.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",