@wzrd_sol/eliza-plugin 0.5.0 → 0.6.1
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 +29 -6
- package/dist/index.d.ts +16 -6
- package/dist/index.js +33 -18
- package/dist/test/plugin-registration.intel.js +21 -1
- package/package.json +4 -6
package/README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
# @wzrd_sol/eliza-plugin
|
|
2
2
|
|
|
3
|
-
ElizaOS plugin for **
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
ElizaOS plugin for **TWZRD Agent Intel** — free preflight before x402 spends, optional paid
|
|
4
|
+
trust receipts, and offline verification. Default path (0.6+):
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
seller → preflight → merchant_card → policy → optional trust receipt → sign or refuse
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
The default export registers **intel actions only**. Legacy AO/CCM earn actions are opt-in.
|
|
6
11
|
|
|
7
12
|
## Buyer sequence (marketplace default)
|
|
8
13
|
|
|
@@ -44,8 +49,8 @@ npm install @wzrd_sol/eliza-plugin
|
|
|
44
49
|
| Variable | Required | Default | Description |
|
|
45
50
|
|----------|----------|---------|-------------|
|
|
46
51
|
| `WZRD_INTEL_URL` | No | `https://intel.twzrd.xyz` | Agent Intel API (preflight, merchant_card, trust, verify) |
|
|
47
|
-
| `WZRD_API_URL` |
|
|
48
|
-
| `SOLANA_PRIVATE_KEY` |
|
|
52
|
+
| `WZRD_API_URL` | Legacy earn only | `https://api.twzrd.xyz` | Earn API when `legacyEarnActions: true` |
|
|
53
|
+
| `SOLANA_PRIVATE_KEY` | Legacy earn only | - | JSON array of secret key bytes for agent Ed25519 auth |
|
|
49
54
|
|
|
50
55
|
## Intel actions (primary)
|
|
51
56
|
|
|
@@ -224,7 +229,25 @@ This plugin does not register a settle action - wire facilitator URL in the host
|
|
|
224
229
|
- `"Is it safe to call the paid intel endpoint on this seller?"`
|
|
225
230
|
- `"Verify this receipt: {leaf, preimage, signature...}"`
|
|
226
231
|
|
|
227
|
-
## Legacy earn actions
|
|
232
|
+
## Legacy earn actions (opt-in)
|
|
233
|
+
|
|
234
|
+
**0.6 breaking change:** `import wzrdPlugin from '@wzrd_sol/eliza-plugin'` registers intel
|
|
235
|
+
actions only. To restore the pre-0.6 earn surface:
|
|
236
|
+
|
|
237
|
+
```typescript
|
|
238
|
+
import { createWzrdPlugin, wzrdPluginWithLegacyEarn } from '@wzrd_sol/eliza-plugin';
|
|
239
|
+
|
|
240
|
+
// Either factory:
|
|
241
|
+
const agent = new AgentRuntime({
|
|
242
|
+
plugins: [createWzrdPlugin({ legacyEarnActions: true })],
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Or compatibility export:
|
|
246
|
+
const agent = new AgentRuntime({ plugins: [wzrdPluginWithLegacyEarn] });
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Legacy earn is **not** part of the supported Agent Intel conversion path. New agents should
|
|
250
|
+
use intel actions + `twzrd-x402-gate` for pre-sign policy.
|
|
228
251
|
|
|
229
252
|
| Action | Auth | Description |
|
|
230
253
|
|--------|------|-------------|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @wzrd_sol/eliza-plugin — WZRD Agent Intel
|
|
2
|
+
* @wzrd_sol/eliza-plugin — WZRD Agent Intel for ElizaOS
|
|
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
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
* raw fetch before your client signs, then registers it the same way).
|
|
9
9
|
* Default: preSpendGate refuses wash_flagged pay_to (free merchant_card).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* WZRD_INFER → WZRD_REPORT → WZRD_EARN → WZRD_CLAIM / WZRD_REWARDS
|
|
11
|
+
* Legacy earn lane (opt-in via createWzrdPlugin({ legacyEarnActions: true })):
|
|
12
|
+
* WZRD_INFER → WZRD_REPORT → WZRD_EARN → WZRD_CLAIM / WZRD_REWARDS on api.twzrd.xyz
|
|
13
13
|
*
|
|
14
14
|
* Config (runtime.getSetting):
|
|
15
|
-
* SOLANA_PRIVATE_KEY — required for earn tx/auth
|
|
16
|
-
* WZRD_API_URL — optional, defaults to https://api.twzrd.xyz
|
|
17
15
|
* WZRD_INTEL_URL — optional, defaults to https://intel.twzrd.xyz
|
|
16
|
+
* WZRD_API_URL — earn lane only, defaults to https://api.twzrd.xyz
|
|
17
|
+
* SOLANA_PRIVATE_KEY — earn lane only (agent Ed25519 auth)
|
|
18
18
|
*/
|
|
19
|
-
import type { Plugin } from '@elizaos/core';
|
|
19
|
+
import type { Action, Plugin } from '@elizaos/core';
|
|
20
20
|
import { inferAction } from './actions/infer.js';
|
|
21
21
|
import { reportAction } from './actions/report.js';
|
|
22
22
|
import { earnAction } from './actions/earn.js';
|
|
@@ -26,7 +26,17 @@ import { intelPreflightAction } from './actions/intel-preflight.js';
|
|
|
26
26
|
import { merchantCardAction } from './actions/merchant-card.js';
|
|
27
27
|
import { intelTrustAction } from './actions/intel-trust.js';
|
|
28
28
|
import { verifyReceiptAction } from './actions/verify-receipt.js';
|
|
29
|
+
export declare const intelActions: Action[];
|
|
30
|
+
export declare const legacyEarnActions: Action[];
|
|
31
|
+
export interface WzrdPluginOptions {
|
|
32
|
+
/** Register WZRD_INFER / REPORT / EARN / CLAIM / REWARDS (0.5.x default; off in 0.6+). */
|
|
33
|
+
legacyEarnActions?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function createWzrdPlugin(options?: WzrdPluginOptions): Plugin;
|
|
36
|
+
/** Default plugin: intel actions only (0.6+). */
|
|
29
37
|
export declare const wzrdPlugin: Plugin;
|
|
38
|
+
/** Pre-0.6 compatibility: intel + legacy earn actions. */
|
|
39
|
+
export declare const wzrdPluginWithLegacyEarn: Plugin;
|
|
30
40
|
export default wzrdPlugin;
|
|
31
41
|
export { intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, earnAction, inferAction, reportAction, claimAction, rewardsAction, };
|
|
32
42
|
export { getWzrdClient, clearClientCache, getIntelApiBase, getIntelClient } from './client-factory.js';
|
package/dist/index.js
CHANGED
|
@@ -7,24 +7,39 @@ import { intelPreflightAction } from './actions/intel-preflight.js';
|
|
|
7
7
|
import { merchantCardAction } from './actions/merchant-card.js';
|
|
8
8
|
import { intelTrustAction } from './actions/intel-trust.js';
|
|
9
9
|
import { verifyReceiptAction } from './actions/verify-receipt.js';
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
10
|
+
export const intelActions = [
|
|
11
|
+
intelPreflightAction,
|
|
12
|
+
merchantCardAction,
|
|
13
|
+
intelTrustAction,
|
|
14
|
+
verifyReceiptAction,
|
|
15
|
+
];
|
|
16
|
+
export const legacyEarnActions = [
|
|
17
|
+
earnAction,
|
|
18
|
+
inferAction,
|
|
19
|
+
reportAction,
|
|
20
|
+
claimAction,
|
|
21
|
+
rewardsAction,
|
|
22
|
+
];
|
|
23
|
+
const INTEL_DESCRIPTION = 'WZRD Agent Intel — free ReadinessCard preflight + free merchant_card wash refuse (default), ' +
|
|
24
|
+
'then optional x402-paid V6 trust receipt (~0.05 USDC) + offline verify on intel.twzrd.xyz. ' +
|
|
25
|
+
'Buyer sequence is call-site / action-driven (not an auto-interceptor of all payments).';
|
|
26
|
+
const LEGACY_EARN_SUFFIX = ' Legacy earn actions (infer/report/claim/rewards) on api.twzrd.xyz are enabled.';
|
|
27
|
+
export function createWzrdPlugin(options = {}) {
|
|
28
|
+
const actions = options.legacyEarnActions
|
|
29
|
+
? [...intelActions, ...legacyEarnActions]
|
|
30
|
+
: [...intelActions];
|
|
31
|
+
return {
|
|
32
|
+
name: 'wzrd',
|
|
33
|
+
description: options.legacyEarnActions
|
|
34
|
+
? INTEL_DESCRIPTION + LEGACY_EARN_SUFFIX
|
|
35
|
+
: INTEL_DESCRIPTION,
|
|
36
|
+
actions,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** Default plugin: intel actions only (0.6+). */
|
|
40
|
+
export const wzrdPlugin = createWzrdPlugin();
|
|
41
|
+
/** Pre-0.6 compatibility: intel + legacy earn actions. */
|
|
42
|
+
export const wzrdPluginWithLegacyEarn = createWzrdPlugin({ legacyEarnActions: true });
|
|
28
43
|
export default wzrdPlugin;
|
|
29
44
|
export { intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, earnAction, inferAction, reportAction, claimAction, rewardsAction, };
|
|
30
45
|
export { getWzrdClient, clearClientCache, getIntelApiBase, getIntelClient } from './client-factory.js';
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import assert from 'node:assert/strict';
|
|
11
11
|
import { describe, it, before, after } from 'node:test';
|
|
12
12
|
import { AgentRuntime } from '@elizaos/core';
|
|
13
|
-
import wzrdPlugin, { intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, setPayingFetch, clearPayingFetch, getIntelClient, resolvePayingFetch, } from '@wzrd_sol/eliza-plugin';
|
|
13
|
+
import wzrdPlugin, { createWzrdPlugin, wzrdPluginWithLegacyEarn, intelPreflightAction, merchantCardAction, intelTrustAction, verifyReceiptAction, setPayingFetch, clearPayingFetch, getIntelClient, resolvePayingFetch, } from '@wzrd_sol/eliza-plugin';
|
|
14
14
|
function mockMemory(content) {
|
|
15
15
|
return {
|
|
16
16
|
id: '00000000-0000-0000-0000-000000000001',
|
|
@@ -47,6 +47,26 @@ describe('wzrdPlugin intel registration + E2E (real runtime load)', () => {
|
|
|
47
47
|
assert.ok(names.includes('WZRD_INTEL_TRUST'), 'trust must be registered');
|
|
48
48
|
assert.ok(names.includes('WZRD_VERIFY_RECEIPT'), 'verify must be registered');
|
|
49
49
|
});
|
|
50
|
+
it('default plugin (0.6+) does not register legacy earn actions', () => {
|
|
51
|
+
const names = runtime.actions.map((a) => a.name);
|
|
52
|
+
for (const legacy of ['WZRD_INFER', 'WZRD_REPORT', 'WZRD_EARN', 'WZRD_CLAIM', 'WZRD_REWARDS']) {
|
|
53
|
+
assert.equal(names.includes(legacy), false, `${legacy} must be opt-in in 0.6+`);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
it('createWzrdPlugin({ legacyEarnActions: true }) registers earn actions', async () => {
|
|
57
|
+
const rt = new AgentRuntime({
|
|
58
|
+
character: { name: 'wzrd-legacy-earn-test', bio: 'test', plugins: [] },
|
|
59
|
+
settings: {},
|
|
60
|
+
});
|
|
61
|
+
await rt.registerPlugin(createWzrdPlugin({ legacyEarnActions: true }));
|
|
62
|
+
const names = rt.actions.map((a) => a.name);
|
|
63
|
+
for (const legacy of ['WZRD_INFER', 'WZRD_REPORT', 'WZRD_EARN', 'WZRD_CLAIM', 'WZRD_REWARDS']) {
|
|
64
|
+
assert.ok(names.includes(legacy), `${legacy} must register when legacyEarnActions is true`);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
it('wzrdPluginWithLegacyEarn matches createWzrdPlugin legacy opt-in', () => {
|
|
68
|
+
assert.deepEqual(wzrdPluginWithLegacyEarn.actions?.map((a) => a.name), createWzrdPlugin({ legacyEarnActions: true }).actions?.map((a) => a.name));
|
|
69
|
+
});
|
|
50
70
|
it('preflight handler accepts seller_wallet + price + resource_name, returns success + decision/score text (live)', { timeout: 10000 }, async () => {
|
|
51
71
|
const rt = mockRuntime({ WZRD_INTEL_URL: 'https://intel.twzrd.xyz' });
|
|
52
72
|
const callbacks = [];
|
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.6.1",
|
|
4
|
+
"description": "WZRD Agent Intel for ElizaOS. Default plugin registers intel actions only: free preflight ReadinessCard + merchant_card (wash_flagged refuse default), paid GET /v1/intel/trust (0.05 USDC) V6 receipt, offline verify. Legacy earn loop (infer/report/claim) is opt-in via createWzrdPlugin({ legacyEarnActions: true }).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@wzrd_sol/sdk": "^0.4.7",
|
|
23
23
|
"bs58": "^5.0.0",
|
|
24
24
|
"tweetnacl": "^1.0.3",
|
|
25
|
-
"twzrd-x402-gate": "^0.
|
|
25
|
+
"twzrd-x402-gate": "^0.8.3"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@elizaos/core": "^1.0.0"
|
|
@@ -51,9 +51,7 @@
|
|
|
51
51
|
"merchant_card",
|
|
52
52
|
"wash",
|
|
53
53
|
"marketplace",
|
|
54
|
-
"
|
|
55
|
-
"inference",
|
|
56
|
-
"earn",
|
|
54
|
+
"legacy-earn",
|
|
57
55
|
"ai-agent",
|
|
58
56
|
"mcp"
|
|
59
57
|
],
|