@agent-shield/plugin-elizaos 0.1.2 → 0.3.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 +215 -29
- package/dist/actions/index.d.ts +4 -3
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +9 -7
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/pauseResume.d.ts +14 -0
- package/dist/actions/pauseResume.d.ts.map +1 -0
- package/dist/actions/pauseResume.js +89 -0
- package/dist/actions/pauseResume.js.map +1 -0
- package/dist/actions/status.d.ts +14 -0
- package/dist/actions/status.d.ts.map +1 -0
- package/dist/actions/status.js +74 -0
- package/dist/actions/status.js.map +1 -0
- package/dist/actions/transactionHistory.d.ts +14 -0
- package/dist/actions/transactionHistory.d.ts.map +1 -0
- package/dist/actions/transactionHistory.js +89 -0
- package/dist/actions/transactionHistory.js.map +1 -0
- package/dist/actions/{swap.d.ts → updatePolicy.d.ts} +4 -8
- package/dist/actions/updatePolicy.d.ts.map +1 -0
- package/dist/actions/updatePolicy.js +83 -0
- package/dist/actions/updatePolicy.js.map +1 -0
- package/dist/client-factory.d.ts +5 -8
- package/dist/client-factory.d.ts.map +1 -1
- package/dist/client-factory.js +53 -33
- package/dist/client-factory.js.map +1 -1
- package/dist/evaluators/policyCheck.d.ts +2 -2
- package/dist/evaluators/policyCheck.d.ts.map +1 -1
- package/dist/evaluators/policyCheck.js +25 -29
- package/dist/evaluators/policyCheck.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +24 -68
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +14 -20
- package/dist/plugin.js.map +1 -1
- package/dist/providers/index.d.ts +1 -1
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +2 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/spendTracking.d.ts +7 -9
- package/dist/providers/spendTracking.d.ts.map +1 -1
- package/dist/providers/spendTracking.js +25 -32
- package/dist/providers/spendTracking.js.map +1 -1
- package/dist/providers/vaultStatus.d.ts +11 -15
- package/dist/providers/vaultStatus.d.ts.map +1 -1
- package/dist/providers/vaultStatus.js +22 -30
- package/dist/providers/vaultStatus.js.map +1 -1
- package/dist/types.d.ts +6 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -6
- package/dist/types.js.map +1 -1
- package/package.json +12 -8
- package/dist/actions/closePosition.d.ts +0 -27
- package/dist/actions/closePosition.d.ts.map +0 -1
- package/dist/actions/closePosition.js +0 -86
- package/dist/actions/closePosition.js.map +0 -1
- package/dist/actions/openPosition.d.ts +0 -31
- package/dist/actions/openPosition.d.ts.map +0 -1
- package/dist/actions/openPosition.js +0 -91
- package/dist/actions/openPosition.js.map +0 -1
- package/dist/actions/swap.d.ts.map +0 -1
- package/dist/actions/swap.js +0 -82
- package/dist/actions/swap.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const updatePolicyAction: {
|
|
2
2
|
name: string;
|
|
3
3
|
description: string;
|
|
4
4
|
similes: string[];
|
|
@@ -8,18 +8,14 @@ export declare const swapAction: {
|
|
|
8
8
|
user: string;
|
|
9
9
|
content: {
|
|
10
10
|
text: string;
|
|
11
|
-
|
|
12
|
-
outputMint: string;
|
|
13
|
-
amount: string;
|
|
11
|
+
maxSpend: string;
|
|
14
12
|
};
|
|
15
13
|
} | {
|
|
16
14
|
user: string;
|
|
17
15
|
content: {
|
|
18
16
|
text: string;
|
|
19
|
-
|
|
20
|
-
outputMint?: undefined;
|
|
21
|
-
amount?: undefined;
|
|
17
|
+
maxSpend?: undefined;
|
|
22
18
|
};
|
|
23
19
|
})[][];
|
|
24
20
|
};
|
|
25
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=updatePolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePolicy.d.ts","sourceRoot":"","sources":["../../src/actions/updatePolicy.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB;;;;wBAYH,GAAG,WAAW,GAAG,KAAG,OAAO,CAAC,OAAO,CAAC;uBAmBnD,GAAG,WACH,GAAG,UACJ,GAAG,YACD,GAAG,YACH,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI;;;;;;;;;;;;;;CAyDpC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updatePolicyAction = void 0;
|
|
4
|
+
const client_factory_1 = require("../client-factory");
|
|
5
|
+
exports.updatePolicyAction = {
|
|
6
|
+
name: "SHIELD_UPDATE_POLICY",
|
|
7
|
+
description: "Update AgentShield spending limits or program blocking at runtime.",
|
|
8
|
+
similes: [
|
|
9
|
+
"update policy",
|
|
10
|
+
"change limit",
|
|
11
|
+
"change spending cap",
|
|
12
|
+
"set budget",
|
|
13
|
+
"update shield",
|
|
14
|
+
],
|
|
15
|
+
validate: async (runtime, message) => {
|
|
16
|
+
try {
|
|
17
|
+
(0, client_factory_1.getOrCreateShieldedWallet)(runtime);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const text = (message.content?.text || "").toLowerCase();
|
|
23
|
+
const keywords = [
|
|
24
|
+
"update policy",
|
|
25
|
+
"change limit",
|
|
26
|
+
"change cap",
|
|
27
|
+
"set budget",
|
|
28
|
+
"update shield",
|
|
29
|
+
];
|
|
30
|
+
return keywords.some((kw) => text.includes(kw));
|
|
31
|
+
},
|
|
32
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
33
|
+
try {
|
|
34
|
+
const { wallet } = (0, client_factory_1.getOrCreateShieldedWallet)(runtime);
|
|
35
|
+
const params = message.content;
|
|
36
|
+
const newPolicies = {};
|
|
37
|
+
const changes = [];
|
|
38
|
+
if (params.maxSpend) {
|
|
39
|
+
newPolicies.maxSpend = params.maxSpend;
|
|
40
|
+
changes.push(`maxSpend: ${params.maxSpend}`);
|
|
41
|
+
}
|
|
42
|
+
if (params.blockUnknownPrograms !== undefined) {
|
|
43
|
+
newPolicies.blockUnknownPrograms = params.blockUnknownPrograms;
|
|
44
|
+
changes.push(`blockUnknownPrograms: ${params.blockUnknownPrograms}`);
|
|
45
|
+
}
|
|
46
|
+
if (changes.length === 0) {
|
|
47
|
+
callback({
|
|
48
|
+
text: "No policy changes specified. Provide maxSpend or blockUnknownPrograms.",
|
|
49
|
+
error: true,
|
|
50
|
+
});
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
wallet.updatePolicies(newPolicies);
|
|
54
|
+
callback({
|
|
55
|
+
text: `Shield policies updated: ${changes.join(", ")}`,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
callback({
|
|
60
|
+
text: `Failed to update policies: ${error.message}`,
|
|
61
|
+
error: true,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
examples: [
|
|
66
|
+
[
|
|
67
|
+
{
|
|
68
|
+
user: "{{user1}}",
|
|
69
|
+
content: {
|
|
70
|
+
text: "Update my shield limit to 1000 USDC per day",
|
|
71
|
+
maxSpend: "1000 USDC/day",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
user: "{{agent}}",
|
|
76
|
+
content: {
|
|
77
|
+
text: "Shield policies updated: maxSpend: 1000 USDC/day",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=updatePolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePolicy.js","sourceRoot":"","sources":["../../src/actions/updatePolicy.ts"],"names":[],"mappings":";;;AACA,sDAA8D;AAEjD,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,CAAC,oBAAoB,GAAG,MAAM,CAAC,oBAAoB,CAAC;gBAC/D,OAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,CAAC,oBAAoB,EAAE,CAAC,CAAC;YACvE,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACzB,QAAQ,CAAC;oBACP,IAAI,EAAE,wEAAwE;oBAC9E,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YAED,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YAEnC,QAAQ,CAAC;gBACP,IAAI,EAAE,4BAA4B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;aACvD,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,QAAQ,CAAC;gBACP,IAAI,EAAE,8BAA8B,KAAK,CAAC,OAAO,EAAE;gBACnD,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,QAAQ,EAAE;QACR;YACE;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,6CAA6C;oBACnD,QAAQ,EAAE,eAAe;iBAC1B;aACF;YACD;gBACE,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE;oBACP,IAAI,EAAE,kDAAkD;iBACzD;aACF;SACF;KACF;CACF,CAAC"}
|
package/dist/client-factory.d.ts
CHANGED
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { PublicKey } from "@solana/web3.js";
|
|
2
|
-
import {
|
|
3
|
-
import { AgentShieldClient } from "@agent-shield/sdk";
|
|
2
|
+
import type { ShieldedWallet } from "@agent-shield/solana";
|
|
4
3
|
import { AgentShieldElizaConfig } from "./types";
|
|
5
4
|
/**
|
|
6
5
|
* Reads AgentShield config from ElizaOS runtime settings.
|
|
7
6
|
*/
|
|
8
7
|
export declare function getConfig(runtime: any): AgentShieldElizaConfig;
|
|
9
8
|
/**
|
|
10
|
-
* Gets or creates
|
|
9
|
+
* Gets or creates a ShieldedWallet for the given ElizaOS runtime.
|
|
11
10
|
* Cached per runtime instance via WeakMap.
|
|
12
11
|
*/
|
|
13
|
-
export declare function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
vaultId: BN;
|
|
17
|
-
agentKey: PublicKey;
|
|
12
|
+
export declare function getOrCreateShieldedWallet(runtime: any): {
|
|
13
|
+
wallet: ShieldedWallet;
|
|
14
|
+
publicKey: PublicKey;
|
|
18
15
|
};
|
|
19
16
|
//# sourceMappingURL=client-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-factory.d.ts","sourceRoot":"","sources":["../src/client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client-factory.d.ts","sourceRoot":"","sources":["../src/client-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAY,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAyB3D;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,GAAG,GAAG,sBAAsB,CAgB9D;AAkBD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,GAAG,GAAG;IACvD,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,SAAS,CAAC;CACtB,CA4CA"}
|
package/dist/client-factory.js
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getConfig = getConfig;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getOrCreateShieldedWallet = getOrCreateShieldedWallet;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
|
-
const
|
|
7
|
-
const sdk_1 = require("@agent-shield/sdk");
|
|
6
|
+
const solana_1 = require("@agent-shield/solana");
|
|
8
7
|
const types_1 = require("./types");
|
|
9
|
-
|
|
8
|
+
/** Minimal wallet wrapper around a Keypair (no Anchor dependency). */
|
|
9
|
+
class KeypairWallet {
|
|
10
|
+
constructor(keypair) {
|
|
11
|
+
this.keypair = keypair;
|
|
12
|
+
this.publicKey = keypair.publicKey;
|
|
13
|
+
}
|
|
14
|
+
async signTransaction(tx) {
|
|
15
|
+
if (tx instanceof web3_js_1.Transaction) {
|
|
16
|
+
tx.partialSign(this.keypair);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
tx.sign([this.keypair]);
|
|
20
|
+
}
|
|
21
|
+
return tx;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const walletCache = new WeakMap();
|
|
10
25
|
/**
|
|
11
26
|
* Reads AgentShield config from ElizaOS runtime settings.
|
|
12
27
|
*/
|
|
@@ -17,11 +32,11 @@ function getConfig(runtime) {
|
|
|
17
32
|
throw new Error(`AgentShield: missing required setting '${key}'`);
|
|
18
33
|
return val;
|
|
19
34
|
};
|
|
35
|
+
const blockRaw = runtime.getSetting(types_1.ENV_KEYS.BLOCK_UNKNOWN);
|
|
36
|
+
const blockUnknown = blockRaw !== "false";
|
|
20
37
|
return {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
programId: runtime.getSetting(types_1.ENV_KEYS.PROGRAM_ID) || undefined,
|
|
24
|
-
rpcUrl: get(types_1.ENV_KEYS.RPC_URL),
|
|
38
|
+
maxSpend: runtime.getSetting(types_1.ENV_KEYS.MAX_SPEND) || undefined,
|
|
39
|
+
blockUnknown,
|
|
25
40
|
walletPrivateKey: get(types_1.ENV_KEYS.WALLET_PRIVATE_KEY),
|
|
26
41
|
};
|
|
27
42
|
}
|
|
@@ -38,38 +53,43 @@ function parseKeypair(raw) {
|
|
|
38
53
|
catch {
|
|
39
54
|
// Not JSON — try base58
|
|
40
55
|
}
|
|
41
|
-
// base58 secret key (64 bytes)
|
|
42
56
|
const bs58 = require("bs58");
|
|
43
57
|
return web3_js_1.Keypair.fromSecretKey(bs58.decode(raw));
|
|
44
58
|
}
|
|
45
59
|
/**
|
|
46
|
-
* Gets or creates
|
|
60
|
+
* Gets or creates a ShieldedWallet for the given ElizaOS runtime.
|
|
47
61
|
* Cached per runtime instance via WeakMap.
|
|
48
62
|
*/
|
|
49
|
-
function
|
|
50
|
-
const cached =
|
|
63
|
+
function getOrCreateShieldedWallet(runtime) {
|
|
64
|
+
const cached = walletCache.get(runtime);
|
|
65
|
+
if (cached)
|
|
66
|
+
return cached;
|
|
51
67
|
const config = getConfig(runtime);
|
|
52
|
-
if (cached) {
|
|
53
|
-
return {
|
|
54
|
-
client: cached,
|
|
55
|
-
vaultOwner: new web3_js_1.PublicKey(config.vaultOwner),
|
|
56
|
-
vaultId: new anchor_1.BN(config.vaultId),
|
|
57
|
-
agentKey: parseKeypair(config.walletPrivateKey).publicKey,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
const connection = new web3_js_1.Connection(config.rpcUrl, "confirmed");
|
|
61
68
|
const keypair = parseKeypair(config.walletPrivateKey);
|
|
62
|
-
const
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
const innerWallet = new KeypairWallet(keypair);
|
|
70
|
+
const logger = runtime.logger ?? console;
|
|
71
|
+
const shielded = (0, solana_1.shield)(innerWallet, {
|
|
72
|
+
maxSpend: config.maxSpend,
|
|
73
|
+
blockUnknownPrograms: config.blockUnknown,
|
|
74
|
+
}, {
|
|
75
|
+
onDenied: (error) => {
|
|
76
|
+
(logger.warn ?? console.warn)("[AgentShield] Transaction denied:", error.message);
|
|
77
|
+
},
|
|
78
|
+
onApproved: (txHash) => {
|
|
79
|
+
(logger.info ?? console.info)("[AgentShield] Transaction approved", txHash ?? "");
|
|
80
|
+
},
|
|
81
|
+
onPause: () => {
|
|
82
|
+
(logger.info ?? console.info)("[AgentShield] Enforcement paused");
|
|
83
|
+
},
|
|
84
|
+
onResume: () => {
|
|
85
|
+
(logger.info ?? console.info)("[AgentShield] Enforcement resumed");
|
|
86
|
+
},
|
|
87
|
+
onPolicyUpdate: () => {
|
|
88
|
+
(logger.info ?? console.info)("[AgentShield] Policies updated");
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
const result = { wallet: shielded, publicKey: keypair.publicKey };
|
|
92
|
+
walletCache.set(runtime, result);
|
|
93
|
+
return result;
|
|
74
94
|
}
|
|
75
95
|
//# sourceMappingURL=client-factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-factory.js","sourceRoot":"","sources":["../src/client-factory.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"client-factory.js","sourceRoot":"","sources":["../src/client-factory.ts"],"names":[],"mappings":";;AAoCA,8BAgBC;AAsBD,8DA+CC;AAzHD,6CAKyB;AACzB,iDAA8C;AAE9C,mCAA2D;AAE3D,sEAAsE;AACtE,MAAM,aAAa;IAEjB,YAAoB,OAAgB;QAAhB,YAAO,GAAP,OAAO,CAAS;QAClC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACrC,CAAC;IACD,KAAK,CAAC,eAAe,CACnB,EAAK;QAEL,IAAI,EAAE,YAAY,qBAAW,EAAE,CAAC;YAC9B,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACL,EAA2B,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,MAAM,WAAW,GAAG,IAAI,OAAO,EAG5B,CAAC;AAEJ;;GAEG;AACH,SAAgB,SAAS,CAAC,OAAY;IACpC,MAA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CAAC,CAAC;IACjC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Policy Check Evaluator — runs after
|
|
3
|
-
* if
|
|
2
|
+
* Policy Check Evaluator — runs after agent actions and warns
|
|
3
|
+
* if spending is approaching any token's cap (>=80%).
|
|
4
4
|
*/
|
|
5
5
|
export declare const policyCheckEvaluator: {
|
|
6
6
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policyCheck.d.ts","sourceRoot":"","sources":["../../src/evaluators/policyCheck.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;yBAOJ,GAAG,WAAW,GAAG,KAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"policyCheck.d.ts","sourceRoot":"","sources":["../../src/evaluators/policyCheck.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;yBAOJ,GAAG,WAAW,GAAG,KAAG,OAAO,CAAC,OAAO,CAAC;uBAStC,GAAG,YAAY,GAAG;;;;;;;;;;;;;;CAsD5C,CAAC"}
|
|
@@ -3,45 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.policyCheckEvaluator = void 0;
|
|
4
4
|
const client_factory_1 = require("../client-factory");
|
|
5
5
|
/**
|
|
6
|
-
* Policy Check Evaluator — runs after
|
|
7
|
-
* if
|
|
6
|
+
* Policy Check Evaluator — runs after agent actions and warns
|
|
7
|
+
* if spending is approaching any token's cap (>=80%).
|
|
8
8
|
*/
|
|
9
9
|
exports.policyCheckEvaluator = {
|
|
10
10
|
name: "AGENT_SHIELD_POLICY_CHECK",
|
|
11
|
-
description: "Post-action evaluator that checks spending against
|
|
12
|
-
"and warns if usage exceeds 80%.",
|
|
11
|
+
description: "Post-action evaluator that checks spending against caps " +
|
|
12
|
+
"and warns if any token usage exceeds 80%.",
|
|
13
13
|
similes: ["check spending limits", "policy warning"],
|
|
14
14
|
validate: async (_runtime, message) => {
|
|
15
|
-
// Only evaluate after shield actions
|
|
16
15
|
const text = (message.content?.text || "").toLowerCase();
|
|
17
16
|
return (text.includes("agentshield") ||
|
|
18
|
-
text.includes("shield
|
|
17
|
+
text.includes("shield") ||
|
|
19
18
|
text.includes("transaction:"));
|
|
20
19
|
},
|
|
21
20
|
handler: async (runtime, _message) => {
|
|
22
21
|
try {
|
|
23
|
-
const {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
22
|
+
const { wallet } = (0, client_factory_1.getOrCreateShieldedWallet)(runtime);
|
|
23
|
+
const summary = wallet.getSpendingSummary();
|
|
24
|
+
if (summary.isPaused)
|
|
25
|
+
return null;
|
|
26
|
+
const warnings = [];
|
|
27
|
+
for (const t of summary.tokens) {
|
|
28
|
+
if (t.limit === BigInt(0))
|
|
29
|
+
continue;
|
|
30
|
+
const pct = Number((t.spent * BigInt(100)) / t.limit);
|
|
31
|
+
if (pct >= 80) {
|
|
32
|
+
const label = t.symbol ?? t.mint.slice(0, 8) + "...";
|
|
33
|
+
warnings.push(`${label}: ${pct}% used (${t.remaining.toString()} remaining)`);
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
if (cap === BigInt(0))
|
|
37
|
-
return null;
|
|
38
|
-
const usagePct = Number((totalSpent * BigInt(100)) / cap);
|
|
39
|
-
if (usagePct >= 80) {
|
|
40
|
-
const remaining = cap > totalSpent ? cap - totalSpent : BigInt(0);
|
|
36
|
+
if (warnings.length > 0) {
|
|
41
37
|
return {
|
|
42
|
-
text: `WARNING: AgentShield
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
text: `WARNING: AgentShield spending approaching limits:\n` +
|
|
39
|
+
warnings.map((w) => ` ${w}`).join("\n") +
|
|
40
|
+
`\nConsider reducing trade sizes or waiting for the rolling window to reset.`,
|
|
45
41
|
action: "POLICY_WARNING",
|
|
46
42
|
};
|
|
47
43
|
}
|
|
@@ -54,17 +50,17 @@ exports.policyCheckEvaluator = {
|
|
|
54
50
|
},
|
|
55
51
|
examples: [
|
|
56
52
|
{
|
|
57
|
-
context: "Agent just executed a swap that pushed spending to 85% of
|
|
53
|
+
context: "Agent just executed a swap that pushed USDC spending to 85% of cap",
|
|
58
54
|
messages: [
|
|
59
55
|
{
|
|
60
56
|
user: "{{agent}}",
|
|
61
57
|
content: {
|
|
62
|
-
text: "Swap executed successfully
|
|
58
|
+
text: "Swap executed successfully.\nTransaction: 5xYz...",
|
|
63
59
|
},
|
|
64
60
|
},
|
|
65
61
|
],
|
|
66
|
-
outcome: "WARNING: AgentShield
|
|
67
|
-
"
|
|
62
|
+
outcome: "WARNING: AgentShield spending approaching limits:\n" +
|
|
63
|
+
" USDC: 85% used (75000000 remaining)",
|
|
68
64
|
},
|
|
69
65
|
],
|
|
70
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policyCheck.js","sourceRoot":"","sources":["../../src/evaluators/policyCheck.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"policyCheck.js","sourceRoot":"","sources":["../../src/evaluators/policyCheck.ts"],"names":[],"mappings":";;;AAAA,sDAA8D;AAE9D;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,0DAA0D;QAC1D,2CAA2C;IAC7C,OAAO,EAAE,CAAC,uBAAuB,EAAE,gBAAgB,CAAC;IAEpD,QAAQ,EAAE,KAAK,EAAE,QAAa,EAAE,OAAY,EAAoB,EAAE;QAChE,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QACzD,OAAO,CACL,IAAI,CAAC,QAAQ,CAAC,aAAa,CAA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/E,MAAM,EAAE,gBAAgB;iBACzB,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,wDAAwD;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,QAAQ,EAAE;QACR;YACE,OAAO,EACL,oEAAoE;YACtE,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,WAAW;oBACjB,OAAO,EAAE;wBACP,IAAI,EAAE,mDAAmD;qBAC1D;iBACF;aACF;YACD,OAAO,EACL,qDAAqD;gBACrD,uCAAuC;SAC1C;KACF;CACF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { agentShieldPlugin } from "./plugin";
|
|
2
2
|
export { ENV_KEYS, type AgentShieldElizaConfig } from "./types";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
3
|
+
export { getOrCreateShieldedWallet, getConfig } from "./client-factory";
|
|
4
|
+
export { statusAction, updatePolicyAction, pauseResumeAction, transactionHistoryAction, } from "./actions";
|
|
5
|
+
export { shieldStatusProvider, spendTrackingProvider } from "./providers";
|
|
6
6
|
export { policyCheckEvaluator } from "./evaluators";
|
|
7
7
|
import { agentShieldPlugin } from "./plugin";
|
|
8
8
|
export default agentShieldPlugin;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,eAAe,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.policyCheckEvaluator = exports.spendTrackingProvider = exports.
|
|
3
|
+
exports.policyCheckEvaluator = exports.spendTrackingProvider = exports.shieldStatusProvider = exports.transactionHistoryAction = exports.pauseResumeAction = exports.updatePolicyAction = exports.statusAction = exports.getConfig = exports.getOrCreateShieldedWallet = exports.ENV_KEYS = exports.agentShieldPlugin = void 0;
|
|
4
4
|
var plugin_1 = require("./plugin");
|
|
5
5
|
Object.defineProperty(exports, "agentShieldPlugin", { enumerable: true, get: function () { return plugin_1.agentShieldPlugin; } });
|
|
6
6
|
var types_1 = require("./types");
|
|
7
7
|
Object.defineProperty(exports, "ENV_KEYS", { enumerable: true, get: function () { return types_1.ENV_KEYS; } });
|
|
8
8
|
var client_factory_1 = require("./client-factory");
|
|
9
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "getOrCreateShieldedWallet", { enumerable: true, get: function () { return client_factory_1.getOrCreateShieldedWallet; } });
|
|
10
10
|
Object.defineProperty(exports, "getConfig", { enumerable: true, get: function () { return client_factory_1.getConfig; } });
|
|
11
11
|
var actions_1 = require("./actions");
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "statusAction", { enumerable: true, get: function () { return actions_1.statusAction; } });
|
|
13
|
+
Object.defineProperty(exports, "updatePolicyAction", { enumerable: true, get: function () { return actions_1.updatePolicyAction; } });
|
|
14
|
+
Object.defineProperty(exports, "pauseResumeAction", { enumerable: true, get: function () { return actions_1.pauseResumeAction; } });
|
|
15
|
+
Object.defineProperty(exports, "transactionHistoryAction", { enumerable: true, get: function () { return actions_1.transactionHistoryAction; } });
|
|
15
16
|
var providers_1 = require("./providers");
|
|
16
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "shieldStatusProvider", { enumerable: true, get: function () { return providers_1.shieldStatusProvider; } });
|
|
17
18
|
Object.defineProperty(exports, "spendTrackingProvider", { enumerable: true, get: function () { return providers_1.spendTrackingProvider; } });
|
|
18
19
|
var evaluators_1 = require("./evaluators");
|
|
19
20
|
Object.defineProperty(exports, "policyCheckEvaluator", { enumerable: true, get: function () { return evaluators_1.policyCheckEvaluator; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAC1B,iCAAgE;AAAvD,iGAAA,QAAQ,OAAA;AACjB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA;AAC1B,iCAAgE;AAAvD,iGAAA,QAAQ,OAAA;AACjB,mDAAwE;AAA/D,2HAAA,yBAAyB,OAAA;AAAE,2GAAA,SAAS,OAAA;AAC7C,qCAKmB;AAJjB,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,4GAAA,iBAAiB,OAAA;AACjB,mHAAA,wBAAwB,OAAA;AAE1B,yCAA0E;AAAjE,iHAAA,oBAAoB,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AACpD,2CAAoD;AAA3C,kHAAA,oBAAoB,OAAA;AAE7B,2CAA2C;AAC3C,qCAA6C;AAC7C,kBAAe,0BAAiB,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -2,93 +2,51 @@
|
|
|
2
2
|
* AgentShield Plugin for ElizaOS.
|
|
3
3
|
*
|
|
4
4
|
* Provides:
|
|
5
|
-
* - Actions:
|
|
6
|
-
* - Providers:
|
|
7
|
-
* - Evaluators: policy cap warning (runs after
|
|
5
|
+
* - Actions: SHIELD_STATUS, SHIELD_UPDATE_POLICY, SHIELD_PAUSE_RESUME, SHIELD_TRANSACTION_HISTORY
|
|
6
|
+
* - Providers: shield status, spend tracking (injected into agent context)
|
|
7
|
+
* - Evaluators: policy cap warning (runs after actions)
|
|
8
8
|
*
|
|
9
9
|
* Required environment variables:
|
|
10
|
-
* - AGENT_SHIELD_VAULT_OWNER — vault owner public key
|
|
11
|
-
* - AGENT_SHIELD_VAULT_ID — vault identifier
|
|
12
|
-
* - SOLANA_RPC_URL — Solana RPC endpoint
|
|
13
10
|
* - SOLANA_WALLET_PRIVATE_KEY — agent wallet key
|
|
14
11
|
*
|
|
15
12
|
* Optional:
|
|
16
|
-
* -
|
|
13
|
+
* - AGENT_SHIELD_MAX_SPEND — e.g. "500 USDC/day"
|
|
14
|
+
* - AGENT_SHIELD_BLOCK_UNKNOWN — "true" or "false" (default: true)
|
|
17
15
|
*/
|
|
18
16
|
export declare const agentShieldPlugin: {
|
|
19
17
|
name: string;
|
|
20
18
|
description: string;
|
|
21
|
-
actions:
|
|
19
|
+
actions: {
|
|
22
20
|
name: string;
|
|
23
21
|
description: string;
|
|
24
22
|
similes: string[];
|
|
25
23
|
validate: (runtime: any, message: any) => Promise<boolean>;
|
|
26
|
-
handler: (runtime: any,
|
|
27
|
-
examples:
|
|
28
|
-
user: string;
|
|
29
|
-
content: {
|
|
30
|
-
text: string;
|
|
31
|
-
inputMint: string;
|
|
32
|
-
outputMint: string;
|
|
33
|
-
amount: string;
|
|
34
|
-
};
|
|
35
|
-
} | {
|
|
36
|
-
user: string;
|
|
37
|
-
content: {
|
|
38
|
-
text: string;
|
|
39
|
-
inputMint?: undefined;
|
|
40
|
-
outputMint?: undefined;
|
|
41
|
-
amount?: undefined;
|
|
42
|
-
};
|
|
43
|
-
})[][];
|
|
44
|
-
} | {
|
|
45
|
-
name: string;
|
|
46
|
-
description: string;
|
|
47
|
-
similes: string[];
|
|
48
|
-
validate: (runtime: any, message: any) => Promise<boolean>;
|
|
49
|
-
handler: (runtime: any, message: any, _state: any, _options: any, callback: (response: any) => void) => Promise<void>;
|
|
50
|
-
examples: ({
|
|
51
|
-
user: string;
|
|
52
|
-
content: {
|
|
53
|
-
text: string;
|
|
54
|
-
targetSymbol: string;
|
|
55
|
-
collateralSymbol: string;
|
|
56
|
-
collateralAmount: string;
|
|
57
|
-
side: string;
|
|
58
|
-
};
|
|
59
|
-
} | {
|
|
24
|
+
handler: (runtime: any, _message: any, _state: any, _options: any, callback: (response: any) => void) => Promise<void>;
|
|
25
|
+
examples: {
|
|
60
26
|
user: string;
|
|
61
27
|
content: {
|
|
62
28
|
text: string;
|
|
63
|
-
targetSymbol?: undefined;
|
|
64
|
-
collateralSymbol?: undefined;
|
|
65
|
-
collateralAmount?: undefined;
|
|
66
|
-
side?: undefined;
|
|
67
29
|
};
|
|
68
|
-
}
|
|
69
|
-
}
|
|
30
|
+
}[][];
|
|
31
|
+
}[];
|
|
70
32
|
providers: ({
|
|
71
33
|
name: string;
|
|
72
34
|
description: string;
|
|
73
35
|
get: (runtime: any, _message: any, _state: any) => Promise<{
|
|
74
36
|
text: string;
|
|
75
37
|
values: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
openPositions: string;
|
|
81
|
-
maxPositions: string;
|
|
38
|
+
walletAddress: string;
|
|
39
|
+
isPaused: string;
|
|
40
|
+
tokenCount: string;
|
|
41
|
+
rateLimitUsage: string;
|
|
82
42
|
};
|
|
83
43
|
} | {
|
|
84
44
|
text: string;
|
|
85
45
|
values: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
openPositions?: undefined;
|
|
91
|
-
maxPositions?: undefined;
|
|
46
|
+
walletAddress?: undefined;
|
|
47
|
+
isPaused?: undefined;
|
|
48
|
+
tokenCount?: undefined;
|
|
49
|
+
rateLimitUsage?: undefined;
|
|
92
50
|
};
|
|
93
51
|
}>;
|
|
94
52
|
} | {
|
|
@@ -97,18 +55,16 @@ export declare const agentShieldPlugin: {
|
|
|
97
55
|
get: (runtime: any, _message: any, _state: any) => Promise<{
|
|
98
56
|
text: string;
|
|
99
57
|
values: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
usagePercent: string;
|
|
58
|
+
tokenCount: string;
|
|
59
|
+
maxUsagePercent: string;
|
|
60
|
+
isPaused: string;
|
|
104
61
|
};
|
|
105
62
|
} | {
|
|
106
63
|
text: string;
|
|
107
64
|
values: {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
usagePercent?: undefined;
|
|
65
|
+
tokenCount?: undefined;
|
|
66
|
+
maxUsagePercent?: undefined;
|
|
67
|
+
isPaused?: undefined;
|
|
112
68
|
};
|
|
113
69
|
}>;
|
|
114
70
|
})[];
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB7B,CAAC"}
|