@wzrd_sol/eliza-plugin 0.3.3 → 0.5.0
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 +99 -48
- package/dist/actions/intel-preflight.js +2 -1
- package/dist/actions/intel-trust.d.ts +1 -1
- package/dist/actions/intel-trust.js +3 -2
- package/dist/actions/verify-receipt.d.ts +2 -2
- package/dist/actions/verify-receipt.js +3 -3
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -3
- package/dist/paying-fetch.d.ts +17 -0
- package/dist/paying-fetch.js +19 -0
- package/package.json +7 -3
package/README.md
CHANGED
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
# @wzrd_sol/eliza-plugin
|
|
2
2
|
|
|
3
|
-
ElizaOS plugin for WZRD Agent Intel
|
|
4
|
-
|
|
3
|
+
ElizaOS plugin for **WZRD Agent Intel** on the Solana x402 marketplace:
|
|
4
|
+
free pre-spend checks, free merchant graph card, paid V6 trust receipt, offline verify.
|
|
5
|
+
Also ships the **legacy** AO/CCM earn loop against `api.twzrd.xyz`.
|
|
6
|
+
|
|
7
|
+
## Buyer sequence (marketplace default)
|
|
8
|
+
|
|
9
|
+
Before any x402 spend:
|
|
10
|
+
|
|
11
|
+
1. **Free preflight** - `WZRD_INTEL_PREFLIGHT` / `preSpendGate` - ReadinessCard `allow` / `warn` / `block`
|
|
12
|
+
2. **Free merchant_card** - `WZRD_MERCHANT_CARD` (or inside `preSpendGate`) - if `wash_flagged: true`, **do not pay** (default)
|
|
13
|
+
3. **Optional paid trust** - `WZRD_INTEL_TRUST` (~0.05 USDC) - full score + **signed V6 receipt**
|
|
14
|
+
4. **Offline verify** - `WZRD_VERIFY_RECEIPT`
|
|
15
|
+
|
|
16
|
+
This plugin exposes **actions + SDK helpers**. It does **not** auto-intercept every wallet signature.
|
|
17
|
+
Wire `preSpendGate` / actions into your spend path, or compose with standalone `twzrd-x402-gate` on a paying fetch.
|
|
5
18
|
|
|
6
19
|
## 3-line quickstart
|
|
7
20
|
|
|
8
21
|
```typescript
|
|
9
22
|
import wzrdPlugin from '@wzrd_sol/eliza-plugin';
|
|
10
23
|
const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
11
|
-
// "Preflight seller JUP6Lkb... at 0.25 USDC"
|
|
24
|
+
// "Preflight seller JUP6Lkb... at 0.25 USDC" -> allow/warn/block, free, no wallet
|
|
25
|
+
// "Merchant card for GFpLvoc..." -> wash_flagged refuse default
|
|
12
26
|
```
|
|
13
27
|
|
|
14
28
|
## Install
|
|
@@ -17,22 +31,30 @@ const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
|
17
31
|
npm install @wzrd_sol/eliza-plugin
|
|
18
32
|
```
|
|
19
33
|
|
|
34
|
+
## Which package?
|
|
35
|
+
|
|
36
|
+
| Package | Role | Auto-gates every payment? |
|
|
37
|
+
|---------|------|---------------------------|
|
|
38
|
+
| **`@wzrd_sol/eliza-plugin`** (this) | Eliza actions: preflight, merchant_card, paid trust, verify; re-exports SDK `preSpendGate` | No - call-site / LLM actions |
|
|
39
|
+
| **`@wzrd_sol/plugin-trustgate`** | Smaller Eliza provider + `canSpendSafely` (preflight only) | No - opt-in `canSpendSafely` |
|
|
40
|
+
| **`twzrd-x402-gate`** | Framework-agnostic fetch wrapper (preflight + wash refuse on 402) | Only if you wrap fetch |
|
|
41
|
+
|
|
20
42
|
## Configuration
|
|
21
43
|
|
|
22
44
|
| Variable | Required | Default | Description |
|
|
23
45
|
|----------|----------|---------|-------------|
|
|
24
|
-
| `WZRD_INTEL_URL` | No | `https://intel.twzrd.xyz` | Agent Intel API (preflight, trust, verify) |
|
|
25
|
-
| `WZRD_API_URL` | No | `https://api.twzrd.xyz` | Earn API (infer/report/claim) |
|
|
26
|
-
| `SOLANA_PRIVATE_KEY` | Earn lane only |
|
|
46
|
+
| `WZRD_INTEL_URL` | No | `https://intel.twzrd.xyz` | Agent Intel API (preflight, merchant_card, trust, verify) |
|
|
47
|
+
| `WZRD_API_URL` | No | `https://api.twzrd.xyz` | Earn API (infer/report/claim) - legacy lane |
|
|
48
|
+
| `SOLANA_PRIVATE_KEY` | Earn lane only | - | JSON array of secret key bytes for agent Ed25519 auth |
|
|
27
49
|
|
|
28
50
|
## Intel actions (primary)
|
|
29
51
|
|
|
30
52
|
| Action | Auth/Pay | Description |
|
|
31
53
|
|--------|----------|-------------|
|
|
32
54
|
| `WZRD_INTEL_PREFLIGHT` | Free | ReadinessCard: `decision`, `trust_score`, `can_spend`, `caveats`, `preflight_id` |
|
|
33
|
-
| `WZRD_MERCHANT_CARD` | Free | Graph card: `wash_flagged`, tier, catalog join; default refuse if wash |
|
|
34
|
-
| `WZRD_INTEL_TRUST` | x402 (~0.05 USDC) | Paid trust payload + V6 signed receipt + ERC-8004 `reputation_credential` |
|
|
35
|
-
| `WZRD_VERIFY_RECEIPT` | Free (offline) | Recompute leaf + Ed25519 verify;
|
|
55
|
+
| `WZRD_MERCHANT_CARD` | Free | Graph card: `wash_flagged`, tier, catalog join; **default refuse if wash** |
|
|
56
|
+
| `WZRD_INTEL_TRUST` | x402 (~0.05 USDC) | Paid trust payload + **V6** signed receipt + ERC-8004 `reputation_credential` |
|
|
57
|
+
| `WZRD_VERIFY_RECEIPT` | Free (offline) | Recompute leaf + Ed25519 verify; V6 primary (older V5 still accepted) |
|
|
36
58
|
|
|
37
59
|
### Preflight (free, no wallet)
|
|
38
60
|
|
|
@@ -57,60 +79,78 @@ Decision: allow
|
|
|
57
79
|
Trust score: 72
|
|
58
80
|
Can spend: yes
|
|
59
81
|
Preflight ID: pf_abc123
|
|
60
|
-
Paid deep dive available (0.05 USDC)
|
|
82
|
+
Paid deep dive available (0.05 USDC) - use WZRD_INTEL_TRUST
|
|
61
83
|
```
|
|
62
84
|
|
|
63
|
-
###
|
|
64
|
-
|
|
65
|
-
For agents that call x402-gated URLs directly (not via pre-known seller wallet), pair this
|
|
66
|
-
plugin with `twzrd-x402-gate` to intercept 402s before any spend:
|
|
85
|
+
### Merchant card (free wash / demand-quality gate)
|
|
67
86
|
|
|
68
87
|
```typescript
|
|
69
|
-
import
|
|
70
|
-
import { withTwzrdGuard } from 'twzrd-x402-gate';
|
|
71
|
-
import { createAgentcashFetch } from 'agentcash';
|
|
88
|
+
import { merchantCardAction, fetchMerchantCard } from '@wzrd_sol/eliza-plugin';
|
|
72
89
|
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
const safeFetch = withTwzrdGuard(x402Fetch, {
|
|
76
|
-
autoReceipt: true, // auto-buy $0.05 TWZRD receipt on warn/allow
|
|
77
|
-
x402Fetch,
|
|
78
|
-
});
|
|
90
|
+
// Action (LLM-callable):
|
|
91
|
+
// "Merchant card for GFpLvocNdEjnSsLH3VJQL6wGcjGxTbUBrj6fqN3Qe1Gs"
|
|
79
92
|
|
|
80
|
-
//
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
//
|
|
93
|
+
// Programmatic:
|
|
94
|
+
const card = await fetchMerchantCard(sellerPubkey);
|
|
95
|
+
if (card?.wash_flagged) return 'refuse dirty pay_to';
|
|
96
|
+
// card unreachable -> fail-open (do not invent wash); use preflight decision only
|
|
84
97
|
```
|
|
85
98
|
|
|
86
|
-
|
|
87
|
-
1. `safeFetch` hits the resource, gets HTTP 402.
|
|
88
|
-
2. `withTwzrdGuard` reads `accepts[0].payTo` (seller wallet).
|
|
89
|
-
3. Calls `POST /v1/intel/preflight` — free, no auth.
|
|
90
|
-
4. `block` - throws, no payment made.
|
|
91
|
-
5. `warn/allow` - returns the 402 for the x402 client to pay.
|
|
99
|
+
Catalog enrichment is listing metadata only - never overrides wash.
|
|
92
100
|
|
|
93
|
-
### Pre-spend gate (programmatic)
|
|
101
|
+
### Pre-spend gate (programmatic - both free checks)
|
|
94
102
|
|
|
95
103
|
```typescript
|
|
96
104
|
import { preSpendGate, fetchIntelTrust, fetchMerchantCard } from '@wzrd_sol/eliza-plugin';
|
|
97
105
|
|
|
98
|
-
//
|
|
106
|
+
// Free preflight + free merchant_card wash refuse (default on):
|
|
99
107
|
const gate = await preSpendGate({ seller_wallet: sellerPubkey, price_usdc: 0.25 });
|
|
100
108
|
if (!gate.allow) return `Blocked (${gate.decision}): ${gate.reason}`;
|
|
101
109
|
// gate.washFlagged === true was refuse default; null = card gap (fail-open)
|
|
102
110
|
|
|
103
|
-
// Or inspect the card alone:
|
|
104
|
-
const card = await fetchMerchantCard(sellerPubkey);
|
|
105
|
-
if (card?.wash_flagged) return 'refuse dirty pay_to';
|
|
106
|
-
|
|
107
111
|
// Then pay and get the receipt:
|
|
108
112
|
const trust = await fetchIntelTrust(sellerPubkey, { fetchImpl: myX402Fetch });
|
|
109
113
|
```
|
|
110
114
|
|
|
111
|
-
**Default:** `refuseWashFlagged: true`
|
|
115
|
+
**Default:** `refuseWashFlagged: true` - if free `merchant_card.wash_flagged`, do not pay.
|
|
112
116
|
Soft cap: `{ washMaxUsdc: 0.05 }`. Opt out: `{ refuseWashFlagged: false }`.
|
|
113
117
|
|
|
118
|
+
### Guard pattern: fire-before-pay with `installTwzrdAutoGate` (default-on)
|
|
119
|
+
|
|
120
|
+
For agents that call x402-gated URLs directly (not via a pre-known seller wallet), pair this
|
|
121
|
+
plugin with standalone **`twzrd-x402-gate`** (separate package - not bundled here) to intercept
|
|
122
|
+
402s before any spend — and register the result as the plugin's paying fetch in one call:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import wzrdPlugin, { installTwzrdAutoGate } from '@wzrd_sol/eliza-plugin';
|
|
126
|
+
import { wrapFetchWithPayment } from '@x402/svm';
|
|
127
|
+
|
|
128
|
+
// Guards the raw fetch (free preflight + free merchant_card wash refuse), hands the guarded
|
|
129
|
+
// fetch to your x402 client, registers the result as the module paying fetch — a blocked or
|
|
130
|
+
// wash-flagged seller throws before your client ever signs.
|
|
131
|
+
installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
|
|
132
|
+
|
|
133
|
+
const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
134
|
+
// WZRD_INTEL_TRUST and any tool/skill using resolvePayingFetch() now goes through the guard.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
`payWrap` (the function you pass in) receives the **guarded** fetch — the guard has already
|
|
138
|
+
run by the time your client sees a 402. Building the composition the other way round (guarding
|
|
139
|
+
an already-paying client, e.g. one that resolves 402s internally and returns 200) is a no-op;
|
|
140
|
+
see `twzrd-x402-gate`'s Compatibility note. Opt out with `TWZRD_AUTO_GATE=0` (env) or
|
|
141
|
+
`{ disabled: true }`.
|
|
142
|
+
|
|
143
|
+
Guard flow (in `twzrd-x402-gate`, not inside this plugin):
|
|
144
|
+
1. The raw fetch hits the resource, gets HTTP 402.
|
|
145
|
+
2. The guard reads `accepts[0].payTo` (seller wallet).
|
|
146
|
+
3. Free `POST /v1/intel/preflight` — `decision=block` / score floor throws, `payWrap`'s client never signs.
|
|
147
|
+
4. Free `GET /v1/intel/merchant_card/{payTo}` — `wash_flagged:true` refuses by default (only tightens step 3).
|
|
148
|
+
5. Otherwise returns the 402 to `payWrap`'s client, which pays normally.
|
|
149
|
+
|
|
150
|
+
For manual composition (managing the raw/paying split yourself) or `autoReceipt`/`escalateOnWarn`
|
|
151
|
+
options, use `withTwzrdGuard` from `twzrd-x402-gate` directly and pass the result to `setPayingFetch`
|
|
152
|
+
— see that package's README.
|
|
153
|
+
|
|
114
154
|
### Paid trust receipt (agentcash)
|
|
115
155
|
|
|
116
156
|
```typescript
|
|
@@ -121,7 +161,7 @@ setPayingFetch(createAgentcashFetch({ apiKey: process.env.AGENTCASH_API_KEY }));
|
|
|
121
161
|
|
|
122
162
|
const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
123
163
|
// "Get the trust receipt for seller JUP6LkbZ..."
|
|
124
|
-
//
|
|
164
|
+
// -> WZRD_INTEL_TRUST: free preflight + merchant_card, then pays $0.05 USDC, returns VC + V6 receipt
|
|
125
165
|
```
|
|
126
166
|
|
|
127
167
|
### Paid trust receipt (PayAI)
|
|
@@ -136,8 +176,9 @@ setPayingFetch((url, init) => payai.fetch(url, init));
|
|
|
136
176
|
const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
137
177
|
```
|
|
138
178
|
|
|
139
|
-
Without a paying fetch, `WZRD_INTEL_TRUST` returns the HTTP 402 requirements and
|
|
140
|
-
`npx agentcash@latest fetch
|
|
179
|
+
Without a paying fetch, `WZRD_INTEL_TRUST` returns the HTTP 402 requirements and a
|
|
180
|
+
manual pay one-liner. Caveat: `npx agentcash@latest fetch` has been a known-bad path
|
|
181
|
+
for TWZRD paid trust (fee_payer slot); prefer a wired `setPayingFetch` client.
|
|
141
182
|
|
|
142
183
|
**`WZRD_INTEL_TRUST` response fields:**
|
|
143
184
|
|
|
@@ -165,12 +206,20 @@ if (vc.distinctCounterparties < 3) return 'warn'; // thin history
|
|
|
165
206
|
if (vc.washFactor < 0.5) return 'warn'; // suspicious ring
|
|
166
207
|
```
|
|
167
208
|
|
|
168
|
-
`effectiveTrustScore` is the cross-facilitator wash-adjusted score
|
|
209
|
+
`effectiveTrustScore` is the cross-facilitator wash-adjusted score - computed across all known
|
|
169
210
|
x402 facilitators, not just one settlement path.
|
|
170
211
|
|
|
212
|
+
### Facilitator settle attach (optional host pattern - not an Eliza action)
|
|
213
|
+
|
|
214
|
+
If your x402 client uses TWZRD as facilitator (`https://intel.twzrd.xyz`), successful
|
|
215
|
+
`POST /settle` may return `merchant_attach` + `twzrd_receipt` for the requirements `payTo`
|
|
216
|
+
(best-effort; never voids on-chain settle). Discover via `GET /supported` (`twzrd.merchant_attach`).
|
|
217
|
+
This plugin does not register a settle action - wire facilitator URL in the host payer.
|
|
218
|
+
|
|
171
219
|
### Example agent prompts (trust)
|
|
172
220
|
|
|
173
221
|
- `"Preflight Jupiter Quote Preview before I pay 0.25 USDC to 6EF8rrect..."`
|
|
222
|
+
- `"Merchant card for GFpLvocNdEjnSsLH3VJQL6wGcjGxTbUBrj6fqN3Qe1Gs"`
|
|
174
223
|
- `"Get the trust receipt for seller JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4"`
|
|
175
224
|
- `"Is it safe to call the paid intel endpoint on this seller?"`
|
|
176
225
|
- `"Verify this receipt: {leaf, preimage, signature...}"`
|
|
@@ -198,6 +247,7 @@ x402 facilitators, not just one settlement path.
|
|
|
198
247
|
import {
|
|
199
248
|
intelPreflight,
|
|
200
249
|
fetchIntelTrust,
|
|
250
|
+
fetchMerchantCard,
|
|
201
251
|
verifyReceipt,
|
|
202
252
|
preSpendGate,
|
|
203
253
|
IntelPaymentRequiredError,
|
|
@@ -206,6 +256,7 @@ import {
|
|
|
206
256
|
import type {
|
|
207
257
|
ReadinessCard,
|
|
208
258
|
PreflightResponse,
|
|
259
|
+
MerchantCard,
|
|
209
260
|
IntelTrustResponse,
|
|
210
261
|
TwzrdReceipt,
|
|
211
262
|
} from '@wzrd_sol/eliza-plugin';
|
|
@@ -220,8 +271,8 @@ npm run build
|
|
|
220
271
|
npm test
|
|
221
272
|
```
|
|
222
273
|
|
|
223
|
-
`npm test` runs live free preflight against `intel.twzrd.xyz`,
|
|
224
|
-
mocked paid trust path.
|
|
274
|
+
`npm test` runs live free preflight against `intel.twzrd.xyz`, free merchant_card path,
|
|
275
|
+
offline receipt verify, and a mocked paid trust path.
|
|
225
276
|
|
|
226
277
|
Manual earn smoke (requires `SOLANA_PRIVATE_KEY`):
|
|
227
278
|
|
|
@@ -233,9 +284,9 @@ npx tsx test/earn-e2e.ts
|
|
|
233
284
|
|
|
234
285
|
- [Agent Intel API](https://intel.twzrd.xyz)
|
|
235
286
|
- [API docs / llms.txt](https://intel.twzrd.xyz/llms.txt)
|
|
236
|
-
- [x402 gate (standalone firewall)](https://www.npmjs.com/package/twzrd-x402-gate)
|
|
287
|
+
- [x402 gate (standalone fetch firewall)](https://www.npmjs.com/package/twzrd-x402-gate)
|
|
288
|
+
- [plugin-trustgate (smaller Eliza spend guard)](https://www.npmjs.com/package/@wzrd_sol/plugin-trustgate)
|
|
237
289
|
- [GOAT plugin](https://www.npmjs.com/package/@wzrd_sol/goat-plugin)
|
|
238
|
-
- [TWZRD trust quickstart](https://intel.twzrd.xyz/docs/QUICKSTART.md)
|
|
239
290
|
|
|
240
291
|
## License
|
|
241
292
|
|
|
@@ -43,7 +43,8 @@ export const intelPreflightAction = {
|
|
|
43
43
|
similes: ['WZRD_PREFLIGHT', 'INTEL_PREFLIGHT', 'READINESS_CARD'],
|
|
44
44
|
description: 'Free pre-spend ReadinessCard for a seller/resource/price/intent. Returns decision (allow/warn/block), ' +
|
|
45
45
|
'trust_score, can_spend, caveats, paid_deep_dive upsell, and root_provenance when applicable. ' +
|
|
46
|
-
'
|
|
46
|
+
'Step 1 of the buyer sequence before any x402 payment; follow with WZRD_MERCHANT_CARD (wash refuse default) ' +
|
|
47
|
+
'or preSpendGate which runs both free checks.',
|
|
47
48
|
examples: [
|
|
48
49
|
[
|
|
49
50
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WZRD_INTEL_TRUST — Paid trust payload + signed receipt
|
|
2
|
+
* WZRD_INTEL_TRUST — Paid trust payload + signed V6 receipt via x402-capable
|
|
3
3
|
* fetch. Preflight-gated: free ReadinessCard + free merchant_card wash check run
|
|
4
4
|
* BEFORE payment; decision=block or wash_flagged aborts before any spend.
|
|
5
5
|
*/
|
|
@@ -4,8 +4,9 @@ import { resolvePayingFetch } from '../paying-fetch.js';
|
|
|
4
4
|
export const intelTrustAction = {
|
|
5
5
|
name: 'WZRD_INTEL_TRUST',
|
|
6
6
|
similes: ['WZRD_TRUST_RECEIPT', 'INTEL_TRUST', 'GET_TRUST_RECEIPT'],
|
|
7
|
-
description: 'Paid GET /v1/intel/trust/{pubkey} (~0.05 USDC). Returns trust score + signed
|
|
8
|
-
'Runs free preflight + merchant_card wash check first;
|
|
7
|
+
description: 'Paid GET /v1/intel/trust/{pubkey} (~0.05 USDC on Solana). Returns renormalized trust score + signed V6 ' +
|
|
8
|
+
'twzrd_receipt (portable offline proof). Runs free preflight + merchant_card wash check first; ' +
|
|
9
|
+
'aborts on decision=block or wash_flagged before any spend. ' +
|
|
9
10
|
'Requires an x402-capable fetchImpl (setPayingFetch or host service). ' +
|
|
10
11
|
'Surfaces payment requirements if no payer is configured.',
|
|
11
12
|
examples: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WZRD_VERIFY_RECEIPT — Offline leaf + Ed25519 verification (no network).
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Primary surface is V6 (reputation leaf). Older V5 receipts still verify when
|
|
4
|
+
* presented; the SDK selects the leaf binding from the receipt domain.
|
|
5
5
|
*/
|
|
6
6
|
import type { Action } from '@elizaos/core';
|
|
7
7
|
export declare const verifyReceiptAction: Action;
|
|
@@ -3,11 +3,11 @@ import { getIntelBase, parseReceipt, withTimeout } from '../intel-helpers.js';
|
|
|
3
3
|
export const verifyReceiptAction = {
|
|
4
4
|
name: 'WZRD_VERIFY_RECEIPT',
|
|
5
5
|
similes: ['WZRD_VERIFY', 'VERIFY_TWZRD_RECEIPT', 'CHECK_RECEIPT'],
|
|
6
|
-
description: 'Offline verify a TwzrdReceipt (V5
|
|
7
|
-
'against the published TWZRD key. No network required when trustedPubkey is known.',
|
|
6
|
+
description: 'Offline verify a TwzrdReceipt (V6 primary; older V5 still accepted): recompute keccak leaf from preimage ' +
|
|
7
|
+
'and check Ed25519 signature against the published TWZRD key. No network required when trustedPubkey is known.',
|
|
8
8
|
examples: [
|
|
9
9
|
[
|
|
10
|
-
{ name: '{{user1}}', content: { text: 'Verify this receipt: {"version":"
|
|
10
|
+
{ name: '{{user1}}', content: { text: 'Verify this receipt: {"version":"v6","leaf":"0x...","preimage":{...}}' } },
|
|
11
11
|
{ name: '{{agentName}}', content: { text: 'Receipt valid: leaf OK, signature OK.' } },
|
|
12
12
|
],
|
|
13
13
|
],
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Intel lane (default https://intel.twzrd.xyz):
|
|
5
5
|
* WZRD_INTEL_PREFLIGHT → WZRD_MERCHANT_CARD → WZRD_INTEL_TRUST → WZRD_VERIFY_RECEIPT
|
|
6
|
-
* Paid intel requires caller-supplied x402 fetch
|
|
6
|
+
* Paid intel requires a caller-supplied x402 fetch — either setPayingFetch(payingFetch)
|
|
7
|
+
* (already-composed, unguarded) or installTwzrdAutoGate(payWrap) (default-on: guards the
|
|
8
|
+
* raw fetch before your client signs, then registers it the same way).
|
|
7
9
|
* Default: preSpendGate refuses wash_flagged pay_to (free merchant_card).
|
|
8
10
|
*
|
|
9
11
|
* Earn lane (default https://api.twzrd.xyz):
|
|
@@ -28,7 +30,7 @@ export declare const wzrdPlugin: Plugin;
|
|
|
28
30
|
export default wzrdPlugin;
|
|
29
31
|
export { intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, earnAction, inferAction, reportAction, claimAction, rewardsAction, };
|
|
30
32
|
export { getWzrdClient, clearClientCache, getIntelApiBase, getIntelClient } from './client-factory.js';
|
|
31
|
-
export { setPayingFetch, clearPayingFetch, resolvePayingFetch } from './paying-fetch.js';
|
|
33
|
+
export { setPayingFetch, clearPayingFetch, resolvePayingFetch, installTwzrdAutoGate, } from './paying-fetch.js';
|
|
32
34
|
export { WzrdClient } from './client.js';
|
|
33
35
|
export type { InferResult, ReportResult, RewardsBalance, ClaimResult } from './client.js';
|
|
34
36
|
export { IntelPaymentRequiredError, intelPreflight, fetchIntelTrust, fetchMerchantCard, verifyReceipt, preSpendGate, intelTrustUrl, TRUSTED_RECEIPT_PUBKEY, INTEL_TRUST_PRICE_USDC, } from '@wzrd_sol/sdk';
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,9 @@ import { intelTrustAction } from './actions/intel-trust.js';
|
|
|
9
9
|
import { verifyReceiptAction } from './actions/verify-receipt.js';
|
|
10
10
|
export const wzrdPlugin = {
|
|
11
11
|
name: 'wzrd',
|
|
12
|
-
description: 'WZRD Agent Intel — free ReadinessCard preflight + merchant_card wash refuse (default), ' +
|
|
13
|
-
'x402-paid trust
|
|
12
|
+
description: 'WZRD Agent Intel — free ReadinessCard preflight + free merchant_card wash refuse (default), ' +
|
|
13
|
+
'then optional x402-paid V6 trust receipt (~0.05 USDC) + offline verify on intel.twzrd.xyz. ' +
|
|
14
|
+
'Buyer sequence is call-site / action-driven (not an auto-interceptor of all payments). ' +
|
|
14
15
|
'Also ships the legacy earn loop (infer/report/claim) on api.twzrd.xyz.',
|
|
15
16
|
actions: [
|
|
16
17
|
intelPreflightAction,
|
|
@@ -27,6 +28,6 @@ export const wzrdPlugin = {
|
|
|
27
28
|
export default wzrdPlugin;
|
|
28
29
|
export { intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, earnAction, inferAction, reportAction, claimAction, rewardsAction, };
|
|
29
30
|
export { getWzrdClient, clearClientCache, getIntelApiBase, getIntelClient } from './client-factory.js';
|
|
30
|
-
export { setPayingFetch, clearPayingFetch, resolvePayingFetch } from './paying-fetch.js';
|
|
31
|
+
export { setPayingFetch, clearPayingFetch, resolvePayingFetch, installTwzrdAutoGate, } from './paying-fetch.js';
|
|
31
32
|
export { WzrdClient } from './client.js';
|
|
32
33
|
export { IntelPaymentRequiredError, intelPreflight, fetchIntelTrust, fetchMerchantCard, verifyReceipt, preSpendGate, intelTrustUrl, TRUSTED_RECEIPT_PUBKEY, INTEL_TRUST_PRICE_USDC, } from '@wzrd_sol/sdk';
|
package/dist/paying-fetch.d.ts
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
/** x402-capable fetch injection for paid intel actions. No embedded wallet. */
|
|
2
2
|
import type { IAgentRuntime } from '@elizaos/core';
|
|
3
|
+
import { type InstallAutoGateOptions, type PayWrap } from 'twzrd-x402-gate';
|
|
3
4
|
/** Host supplies an x402-capable fetch (agentcash, twzrd-x402-gate, etc.) before runtime creation. */
|
|
4
5
|
export declare function setPayingFetch(f: typeof fetch): void;
|
|
6
|
+
/**
|
|
7
|
+
* Default-on replacement for `setPayingFetch(payWrap(rawFetch))`: guards the raw fetch
|
|
8
|
+
* with the free TWZRD preflight BEFORE handing it to your x402 client's `payWrap`, so a
|
|
9
|
+
* blocked seller is refused before your client ever signs — then registers the result as
|
|
10
|
+
* the module paying fetch (same slot `setPayingFetch` writes to).
|
|
11
|
+
*
|
|
12
|
+
* Opt out with `TWZRD_AUTO_GATE=0` (env) or `{ disabled: true }`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { installTwzrdAutoGate } from '@wzrd_sol/eliza-plugin';
|
|
16
|
+
* import { wrapFetchWithPayment } from '@x402/svm';
|
|
17
|
+
*
|
|
18
|
+
* installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
|
|
19
|
+
* const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
20
|
+
*/
|
|
21
|
+
export declare function installTwzrdAutoGate(payWrap: PayWrap, options?: InstallAutoGateOptions): void;
|
|
5
22
|
export declare function clearPayingFetch(): void;
|
|
6
23
|
type FetchLike = typeof fetch;
|
|
7
24
|
/** Resolve paying fetch: module setter > runtime service > runtime.fetch > global fetch. */
|
package/dist/paying-fetch.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
+
import { installTwzrdAutoGate as buildAutoGate, } from 'twzrd-x402-gate';
|
|
1
2
|
let modulePayingFetch = null;
|
|
2
3
|
/** Host supplies an x402-capable fetch (agentcash, twzrd-x402-gate, etc.) before runtime creation. */
|
|
3
4
|
export function setPayingFetch(f) {
|
|
4
5
|
modulePayingFetch = f;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Default-on replacement for `setPayingFetch(payWrap(rawFetch))`: guards the raw fetch
|
|
9
|
+
* with the free TWZRD preflight BEFORE handing it to your x402 client's `payWrap`, so a
|
|
10
|
+
* blocked seller is refused before your client ever signs — then registers the result as
|
|
11
|
+
* the module paying fetch (same slot `setPayingFetch` writes to).
|
|
12
|
+
*
|
|
13
|
+
* Opt out with `TWZRD_AUTO_GATE=0` (env) or `{ disabled: true }`.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { installTwzrdAutoGate } from '@wzrd_sol/eliza-plugin';
|
|
17
|
+
* import { wrapFetchWithPayment } from '@x402/svm';
|
|
18
|
+
*
|
|
19
|
+
* installTwzrdAutoGate((guarded) => wrapFetchWithPayment(guarded, buyerWallet));
|
|
20
|
+
* const agent = new AgentRuntime({ plugins: [wzrdPlugin] });
|
|
21
|
+
*/
|
|
22
|
+
export function installTwzrdAutoGate(payWrap, options) {
|
|
23
|
+
setPayingFetch(buildAutoGate(payWrap, options));
|
|
24
|
+
}
|
|
6
25
|
export function clearPayingFetch() {
|
|
7
26
|
modulePayingFetch = null;
|
|
8
27
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wzrd_sol/eliza-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "WZRD Agent Intel for ElizaOS
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "WZRD Agent Intel for ElizaOS. Free buyer sequence: preflight ReadinessCard + merchant_card (wash_flagged refuse default). Paid: GET /v1/intel/trust (0.05 USDC) for signed V6 receipt. Offline verify. installTwzrdAutoGate(payWrap) registers a default-on guarded paying fetch in one call; setPayingFetch / actions / preSpendGate remain available for manual wiring. Also ships the legacy earn loop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"@solana/web3.js": "^1.95.0",
|
|
22
22
|
"@wzrd_sol/sdk": "^0.4.7",
|
|
23
23
|
"bs58": "^5.0.0",
|
|
24
|
-
"tweetnacl": "^1.0.3"
|
|
24
|
+
"tweetnacl": "^1.0.3",
|
|
25
|
+
"twzrd-x402-gate": "^0.5.0"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
28
|
"@elizaos/core": "^1.0.0"
|
|
@@ -47,6 +48,9 @@
|
|
|
47
48
|
"receipt",
|
|
48
49
|
"reputation",
|
|
49
50
|
"preflight",
|
|
51
|
+
"merchant_card",
|
|
52
|
+
"wash",
|
|
53
|
+
"marketplace",
|
|
50
54
|
"ccm",
|
|
51
55
|
"inference",
|
|
52
56
|
"earn",
|