@itachisol/plugin-x402-swarms 0.1.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/LICENSE +21 -0
- package/README.md +323 -0
- package/dist/actions/delegateToSwarm.d.ts +8 -0
- package/dist/actions/delegateToSwarm.d.ts.map +1 -0
- package/dist/actions/delegateToSwarm.js +296 -0
- package/dist/actions/delegateToSwarm.js.map +1 -0
- package/dist/actions/delegateToSwarmWithPayment.d.ts +8 -0
- package/dist/actions/delegateToSwarmWithPayment.d.ts.map +1 -0
- package/dist/actions/delegateToSwarmWithPayment.js +323 -0
- package/dist/actions/delegateToSwarmWithPayment.js.map +1 -0
- package/dist/actions/discoverServices.d.ts +3 -0
- package/dist/actions/discoverServices.d.ts.map +1 -0
- package/dist/actions/discoverServices.js +63 -0
- package/dist/actions/discoverServices.js.map +1 -0
- package/dist/actions/index.d.ts +6 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +6 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/payForService.d.ts +3 -0
- package/dist/actions/payForService.d.ts.map +1 -0
- package/dist/actions/payForService.js +115 -0
- package/dist/actions/payForService.js.map +1 -0
- package/dist/actions/runSwarmAgent.d.ts +7 -0
- package/dist/actions/runSwarmAgent.d.ts.map +1 -0
- package/dist/actions/runSwarmAgent.js +131 -0
- package/dist/actions/runSwarmAgent.js.map +1 -0
- package/dist/client/index.d.ts +512 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +469 -0
- package/dist/client/index.js.map +1 -0
- package/dist/evaluators/paymentEvaluator.d.ts +7 -0
- package/dist/evaluators/paymentEvaluator.d.ts.map +1 -0
- package/dist/evaluators/paymentEvaluator.js +104 -0
- package/dist/evaluators/paymentEvaluator.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/marketing/index.d.ts +7 -0
- package/dist/marketing/index.d.ts.map +1 -0
- package/dist/marketing/index.js +7 -0
- package/dist/marketing/index.js.map +1 -0
- package/dist/marketing/milestoneAgent.d.ts +54 -0
- package/dist/marketing/milestoneAgent.d.ts.map +1 -0
- package/dist/marketing/milestoneAgent.js +121 -0
- package/dist/marketing/milestoneAgent.js.map +1 -0
- package/dist/marketing/tweetTemplates.d.ts +32 -0
- package/dist/marketing/tweetTemplates.d.ts.map +1 -0
- package/dist/marketing/tweetTemplates.js +60 -0
- package/dist/marketing/tweetTemplates.js.map +1 -0
- package/dist/marketing/xMonitor.d.ts +51 -0
- package/dist/marketing/xMonitor.d.ts.map +1 -0
- package/dist/marketing/xMonitor.js +141 -0
- package/dist/marketing/xMonitor.js.map +1 -0
- package/dist/providers/x402Provider.d.ts +7 -0
- package/dist/providers/x402Provider.d.ts.map +1 -0
- package/dist/providers/x402Provider.js +72 -0
- package/dist/providers/x402Provider.js.map +1 -0
- package/dist/providers/x402ServerProvider.d.ts +7 -0
- package/dist/providers/x402ServerProvider.d.ts.map +1 -0
- package/dist/providers/x402ServerProvider.js +48 -0
- package/dist/providers/x402ServerProvider.js.map +1 -0
- package/dist/routes/advancedRoutes.d.ts +5 -0
- package/dist/routes/advancedRoutes.d.ts.map +1 -0
- package/dist/routes/advancedRoutes.js +869 -0
- package/dist/routes/advancedRoutes.js.map +1 -0
- package/dist/routes/batchRoutes.d.ts +13 -0
- package/dist/routes/batchRoutes.d.ts.map +1 -0
- package/dist/routes/batchRoutes.js +496 -0
- package/dist/routes/batchRoutes.js.map +1 -0
- package/dist/routes/codeAuditRoutes.d.ts +6 -0
- package/dist/routes/codeAuditRoutes.d.ts.map +1 -0
- package/dist/routes/codeAuditRoutes.js +415 -0
- package/dist/routes/codeAuditRoutes.js.map +1 -0
- package/dist/routes/contentRoutes.d.ts +5 -0
- package/dist/routes/contentRoutes.d.ts.map +1 -0
- package/dist/routes/contentRoutes.js +370 -0
- package/dist/routes/contentRoutes.js.map +1 -0
- package/dist/routes/cryptoAnalysisRoutes.d.ts +5 -0
- package/dist/routes/cryptoAnalysisRoutes.d.ts.map +1 -0
- package/dist/routes/cryptoAnalysisRoutes.js +641 -0
- package/dist/routes/cryptoAnalysisRoutes.js.map +1 -0
- package/dist/routes/cryptoRoutes.d.ts +5 -0
- package/dist/routes/cryptoRoutes.d.ts.map +1 -0
- package/dist/routes/cryptoRoutes.js +1225 -0
- package/dist/routes/cryptoRoutes.js.map +1 -0
- package/dist/routes/heliusDataRoutes.d.ts +14 -0
- package/dist/routes/heliusDataRoutes.d.ts.map +1 -0
- package/dist/routes/heliusDataRoutes.js +388 -0
- package/dist/routes/heliusDataRoutes.js.map +1 -0
- package/dist/routes/taskRoutes.d.ts +5 -0
- package/dist/routes/taskRoutes.d.ts.map +1 -0
- package/dist/routes/taskRoutes.js +574 -0
- package/dist/routes/taskRoutes.js.map +1 -0
- package/dist/routes/tradingRoutes.d.ts +5 -0
- package/dist/routes/tradingRoutes.d.ts.map +1 -0
- package/dist/routes/tradingRoutes.js +500 -0
- package/dist/routes/tradingRoutes.js.map +1 -0
- package/dist/routes/walletAnalyzerRoutes.d.ts +12 -0
- package/dist/routes/walletAnalyzerRoutes.d.ts.map +1 -0
- package/dist/routes/walletAnalyzerRoutes.js +316 -0
- package/dist/routes/walletAnalyzerRoutes.js.map +1 -0
- package/dist/routes/x402Routes.d.ts +9 -0
- package/dist/routes/x402Routes.d.ts.map +1 -0
- package/dist/routes/x402Routes.js +474 -0
- package/dist/routes/x402Routes.js.map +1 -0
- package/dist/schemas/budgetState.d.ts +250 -0
- package/dist/schemas/budgetState.d.ts.map +1 -0
- package/dist/schemas/budgetState.js +20 -0
- package/dist/schemas/budgetState.js.map +1 -0
- package/dist/schemas/endpointScores.d.ts +182 -0
- package/dist/schemas/endpointScores.d.ts.map +1 -0
- package/dist/schemas/endpointScores.js +17 -0
- package/dist/schemas/endpointScores.js.map +1 -0
- package/dist/schemas/index.d.ts +4 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +4 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/paymentHistory.d.ts +284 -0
- package/dist/schemas/paymentHistory.d.ts.map +1 -0
- package/dist/schemas/paymentHistory.js +24 -0
- package/dist/schemas/paymentHistory.js.map +1 -0
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/x402Gate.d.ts +56 -0
- package/dist/server/x402Gate.d.ts.map +1 -0
- package/dist/server/x402Gate.js +240 -0
- package/dist/server/x402Gate.js.map +1 -0
- package/dist/server/x402ServerService.d.ts +30 -0
- package/dist/server/x402ServerService.d.ts.map +1 -0
- package/dist/server/x402ServerService.js +79 -0
- package/dist/server/x402ServerService.js.map +1 -0
- package/dist/services/paymentMemoryService.d.ts +73 -0
- package/dist/services/paymentMemoryService.d.ts.map +1 -0
- package/dist/services/paymentMemoryService.js +247 -0
- package/dist/services/paymentMemoryService.js.map +1 -0
- package/dist/services/swarmsService.d.ts +66 -0
- package/dist/services/swarmsService.d.ts.map +1 -0
- package/dist/services/swarmsService.js +102 -0
- package/dist/services/swarmsService.js.map +1 -0
- package/dist/services/x402WalletService.d.ts +57 -0
- package/dist/services/x402WalletService.d.ts.map +1 -0
- package/dist/services/x402WalletService.js +258 -0
- package/dist/services/x402WalletService.js.map +1 -0
- package/dist/templates/index.d.ts +24 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +51 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/swarmTemplates.d.ts +22 -0
- package/dist/templates/swarmTemplates.d.ts.map +1 -0
- package/dist/templates/swarmTemplates.js +225 -0
- package/dist/templates/swarmTemplates.js.map +1 -0
- package/dist/types.d.ts +197 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/cache.d.ts +17 -0
- package/dist/utils/cache.d.ts.map +1 -0
- package/dist/utils/cache.js +32 -0
- package/dist/utils/cache.js.map +1 -0
- package/dist/utils/llm.d.ts +16 -0
- package/dist/utils/llm.d.ts.map +1 -0
- package/dist/utils/llm.js +32 -0
- package/dist/utils/llm.js.map +1 -0
- package/dist/utils/reportStore.d.ts +45 -0
- package/dist/utils/reportStore.d.ts.map +1 -0
- package/dist/utils/reportStore.js +164 -0
- package/dist/utils/reportStore.js.map +1 -0
- package/dist/utils/taskQueue.d.ts +54 -0
- package/dist/utils/taskQueue.d.ts.map +1 -0
- package/dist/utils/taskQueue.js +124 -0
- package/dist/utils/taskQueue.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ModelType, } from "@elizaos/core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const AgentSchema = z.object({
|
|
4
|
+
task: z.string().min(1),
|
|
5
|
+
agentName: z.string().optional().default("GeneralAgent"),
|
|
6
|
+
systemPrompt: z.string().optional(),
|
|
7
|
+
modelName: z.string().optional().default("gpt-4o-mini"),
|
|
8
|
+
maxTokens: z.number().optional().default(4096),
|
|
9
|
+
temperature: z.number().optional().default(0.5),
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Run a single specialized agent via the Swarms API.
|
|
13
|
+
* For quick single-agent tasks that don't need multi-agent orchestration.
|
|
14
|
+
*/
|
|
15
|
+
export const runSwarmAgent = {
|
|
16
|
+
name: "RUN_SWARM_AGENT",
|
|
17
|
+
description: "Run a single specialized AI agent via the Swarms cloud API. Use for focused tasks that need a specific agent role or model. For multi-agent tasks, use DELEGATE_TO_SWARM instead.",
|
|
18
|
+
similes: [
|
|
19
|
+
"CALL_SWARM_AGENT",
|
|
20
|
+
"USE_SINGLE_AGENT",
|
|
21
|
+
"SWARM_AGENT_RUN",
|
|
22
|
+
"ASK_SWARM_AGENT",
|
|
23
|
+
],
|
|
24
|
+
validate: async (runtime, _message, _state) => {
|
|
25
|
+
return !!runtime.getSetting("SWARMS_API_KEY");
|
|
26
|
+
},
|
|
27
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
28
|
+
const swarmsService = runtime.getService("SWARMS");
|
|
29
|
+
if (!swarmsService || !swarmsService.isAvailable()) {
|
|
30
|
+
await callback?.({
|
|
31
|
+
text: "Swarms service not initialized. Set SWARMS_API_KEY in your environment.",
|
|
32
|
+
error: true,
|
|
33
|
+
});
|
|
34
|
+
return { success: false, error: "Swarms service not initialized" };
|
|
35
|
+
}
|
|
36
|
+
// Extract agent config from message
|
|
37
|
+
const extraction = await runtime.useModel(ModelType.TEXT_SMALL, {
|
|
38
|
+
prompt: `Extract agent task details from the user message. Return JSON with:
|
|
39
|
+
- task: string (what the agent should do)
|
|
40
|
+
- agentName: string (a descriptive name like "CodeReviewer", "DataAnalyst", "Writer")
|
|
41
|
+
- systemPrompt: optional string (specific instructions for the agent)
|
|
42
|
+
- modelName: optional string (e.g. "gpt-4o", "gpt-4o-mini", "claude-3-sonnet-20240229")
|
|
43
|
+
- maxTokens: optional number (default 4096)
|
|
44
|
+
- temperature: optional number (0.0-1.0, default 0.5)
|
|
45
|
+
|
|
46
|
+
User message: "${message.content.text ?? ""}"
|
|
47
|
+
|
|
48
|
+
Return only valid JSON, no markdown.`,
|
|
49
|
+
});
|
|
50
|
+
let params;
|
|
51
|
+
try {
|
|
52
|
+
params = AgentSchema.parse(JSON.parse(String(extraction)));
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
params = {
|
|
56
|
+
task: message.content.text ?? "unspecified task",
|
|
57
|
+
agentName: "GeneralAgent",
|
|
58
|
+
modelName: "gpt-4o-mini",
|
|
59
|
+
maxTokens: 4096,
|
|
60
|
+
temperature: 0.5,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
await callback?.({
|
|
64
|
+
text: `Running agent "${params.agentName}" (${params.modelName})...`,
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
const result = await swarmsService.runAgent({
|
|
68
|
+
agent_name: params.agentName,
|
|
69
|
+
system_prompt: params.systemPrompt ?? null,
|
|
70
|
+
model_name: params.modelName,
|
|
71
|
+
max_tokens: params.maxTokens,
|
|
72
|
+
temperature: params.temperature,
|
|
73
|
+
max_loops: 1,
|
|
74
|
+
}, params.task);
|
|
75
|
+
// Extract output
|
|
76
|
+
let output;
|
|
77
|
+
if (typeof result.outputs === "string") {
|
|
78
|
+
output = result.outputs;
|
|
79
|
+
}
|
|
80
|
+
else if (result.outputs != null &&
|
|
81
|
+
typeof result.outputs === "object" &&
|
|
82
|
+
"content" in result.outputs) {
|
|
83
|
+
output = result.outputs.content;
|
|
84
|
+
}
|
|
85
|
+
else if (result.outputs != null) {
|
|
86
|
+
output = JSON.stringify(result.outputs, null, 2);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
output = "(no output)";
|
|
90
|
+
}
|
|
91
|
+
const text = `Agent "${params.agentName}" completed.
|
|
92
|
+
|
|
93
|
+
${output.slice(0, 1500)}`;
|
|
94
|
+
await callback?.({
|
|
95
|
+
text,
|
|
96
|
+
content: {
|
|
97
|
+
agentId: String(result.job_id ?? ""),
|
|
98
|
+
agentName: params.agentName,
|
|
99
|
+
success: String(result.success ?? true),
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
return { success: true, text };
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
106
|
+
await callback?.({
|
|
107
|
+
text: `Agent run failed: ${msg}`,
|
|
108
|
+
error: true,
|
|
109
|
+
});
|
|
110
|
+
return { success: false, error: msg };
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
examples: [
|
|
114
|
+
[
|
|
115
|
+
{
|
|
116
|
+
name: "user",
|
|
117
|
+
content: {
|
|
118
|
+
text: "Use a code review agent to review this smart contract for vulnerabilities",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "agent",
|
|
123
|
+
content: {
|
|
124
|
+
text: 'Agent "CodeReviewer" completed.\n\n[detailed review]...',
|
|
125
|
+
actions: ["RUN_SWARM_AGENT"],
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
],
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=runSwarmAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runSwarmAgent.js","sourceRoot":"","sources":["../../src/actions/runSwarmAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,SAAS,GACV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC;IACxD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;IACvD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC;CAChD,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EACT,mLAAmL;IACrL,OAAO,EAAE;QACP,kBAAkB;QAClB,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;KAClB;IAED,QAAQ,EAAE,KAAK,EACb,OAAsB,EACtB,QAAgB,EAChB,MAAc,EACI,EAAE;QACpB,OAAO,CAAC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BACxC;aACF,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,MAAM,QAAQ,EAAE,CAAC;gBACf,IAAI,EAAE,qBAAqB,GAAG,EAAE;gBAChC,KAAK,EAAE,IAAI;aACZ,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;QACxC,CAAC;IACH,CAAC;IAED,QAAQ,EAAE;QACR;YACE;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,IAAI,EAAE,2EAA2E;iBAClF;aACF;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE;oBACP,IAAI,EAAE,yDAAyD;oBAC/D,OAAO,EAAE,CAAC,iBAAiB,CAAC;iBAC7B;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* x402-swarms Client SDK
|
|
3
|
+
*
|
|
4
|
+
* Dead-simple one-liner access to all x402-swarms platform endpoints.
|
|
5
|
+
* Handles x402 micropayments automatically — no protocol knowledge required.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createClient } from "@elizaos/plugin-x402-swarms/client";
|
|
10
|
+
*
|
|
11
|
+
* const client = createClient({
|
|
12
|
+
* walletPrivateKey: process.env.SOLANA_PRIVATE_KEY,
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* const report = await client.research("State of Solana DeFi in 2026");
|
|
16
|
+
* const analysis = await client.analyze("Bitcoin ETF impact on altcoins");
|
|
17
|
+
* const wallet = await client.analyzeWallet("So11...address");
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
/** Configuration for the x402-swarms client. */
|
|
23
|
+
export interface X402SwarmsClientConfig {
|
|
24
|
+
/** Solana private key (base58) for automatic USDC payments. */
|
|
25
|
+
walletPrivateKey?: string;
|
|
26
|
+
/** EVM private key (hex) for automatic USDC payments on Base/Polygon/Arbitrum. */
|
|
27
|
+
evmPrivateKey?: string;
|
|
28
|
+
/** Base URL of the x402-swarms platform. Defaults to production. */
|
|
29
|
+
baseUrl?: string;
|
|
30
|
+
/** Maximum payment per request in atomic units (USDC has 6 decimals). Defaults to "100000" ($0.10). */
|
|
31
|
+
maxAmountAtomic?: string;
|
|
32
|
+
/** Preferred network in CAIP-2 format (e.g. "eip155:8453" for Base mainnet). */
|
|
33
|
+
preferredNetwork?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Payment metadata included in every paid response. */
|
|
36
|
+
export interface PaymentInfo {
|
|
37
|
+
amount: string;
|
|
38
|
+
transaction: string;
|
|
39
|
+
network: string;
|
|
40
|
+
}
|
|
41
|
+
/** Response from POST /x402/research */
|
|
42
|
+
export interface ResearchResponse {
|
|
43
|
+
result: string;
|
|
44
|
+
template: string;
|
|
45
|
+
payment: PaymentInfo;
|
|
46
|
+
}
|
|
47
|
+
/** Response from POST /x402/analyze */
|
|
48
|
+
export interface AnalyzeResponse {
|
|
49
|
+
result: string;
|
|
50
|
+
template: string;
|
|
51
|
+
payment: PaymentInfo;
|
|
52
|
+
}
|
|
53
|
+
/** Response from POST /x402/agent */
|
|
54
|
+
export interface AgentResponse {
|
|
55
|
+
result: string;
|
|
56
|
+
payment: PaymentInfo;
|
|
57
|
+
}
|
|
58
|
+
/** A single token holding returned by the wallet analyzer. */
|
|
59
|
+
export interface TokenHolding {
|
|
60
|
+
mint: string;
|
|
61
|
+
amount: number;
|
|
62
|
+
decimals: number;
|
|
63
|
+
uiAmount: number;
|
|
64
|
+
symbol: string;
|
|
65
|
+
}
|
|
66
|
+
/** Response from POST /x402/wallet-analyzer */
|
|
67
|
+
export interface WalletAnalysisResponse {
|
|
68
|
+
address: string;
|
|
69
|
+
solBalance: number;
|
|
70
|
+
tokens: TokenHolding[];
|
|
71
|
+
tokenCount: number;
|
|
72
|
+
analyzedAt: string;
|
|
73
|
+
payment: PaymentInfo;
|
|
74
|
+
}
|
|
75
|
+
/** A single entry in the service catalog. */
|
|
76
|
+
export interface CatalogEntry {
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
path: string;
|
|
80
|
+
method: "GET" | "POST";
|
|
81
|
+
priceUsd: string;
|
|
82
|
+
free?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Response from GET /x402/health */
|
|
85
|
+
export interface HealthResponse {
|
|
86
|
+
status: string;
|
|
87
|
+
receiveAddress: string;
|
|
88
|
+
network: string;
|
|
89
|
+
totalRevenue: number;
|
|
90
|
+
settlements: number;
|
|
91
|
+
}
|
|
92
|
+
/** Response from GET /x402/wallet-analyzer/health */
|
|
93
|
+
export interface WalletAnalyzerHealthResponse {
|
|
94
|
+
status: string;
|
|
95
|
+
heliusConfigured: boolean;
|
|
96
|
+
receiveAddress: string;
|
|
97
|
+
network: string;
|
|
98
|
+
price: string;
|
|
99
|
+
}
|
|
100
|
+
/** Response from POST /x402/summarize */
|
|
101
|
+
export interface SummarizeResponse {
|
|
102
|
+
summary: string;
|
|
103
|
+
wordCount: number;
|
|
104
|
+
payment: PaymentInfo;
|
|
105
|
+
}
|
|
106
|
+
/** Response from POST /x402/translate */
|
|
107
|
+
export interface TranslateResponse {
|
|
108
|
+
translation: string;
|
|
109
|
+
sourceLanguage: string;
|
|
110
|
+
targetLanguage: string;
|
|
111
|
+
payment: PaymentInfo;
|
|
112
|
+
}
|
|
113
|
+
/** Response from POST /x402/code-review */
|
|
114
|
+
export interface CodeReviewResponse {
|
|
115
|
+
security: string;
|
|
116
|
+
performance: string;
|
|
117
|
+
style: string;
|
|
118
|
+
overallScore: string;
|
|
119
|
+
rawOutput: string;
|
|
120
|
+
template: string;
|
|
121
|
+
payment: PaymentInfo;
|
|
122
|
+
}
|
|
123
|
+
/** Response from POST /x402/write */
|
|
124
|
+
export interface WriteResponse {
|
|
125
|
+
content: string;
|
|
126
|
+
wordCount: number;
|
|
127
|
+
template: string;
|
|
128
|
+
payment: PaymentInfo;
|
|
129
|
+
}
|
|
130
|
+
/** Response from POST /x402/debate */
|
|
131
|
+
export interface DebateResponse {
|
|
132
|
+
proArgument: string;
|
|
133
|
+
conArgument: string;
|
|
134
|
+
verdict: string;
|
|
135
|
+
confidence: string;
|
|
136
|
+
rawOutput: string;
|
|
137
|
+
template: string;
|
|
138
|
+
payment: PaymentInfo;
|
|
139
|
+
}
|
|
140
|
+
/** Response from POST /x402/extract */
|
|
141
|
+
export interface ExtractResponse {
|
|
142
|
+
extracted: Record<string, string>;
|
|
143
|
+
payment: PaymentInfo;
|
|
144
|
+
}
|
|
145
|
+
/** Response from POST /x402/sentiment */
|
|
146
|
+
export interface SentimentResponse {
|
|
147
|
+
sentiment: "positive" | "negative" | "neutral";
|
|
148
|
+
confidence: number;
|
|
149
|
+
reasoning: string;
|
|
150
|
+
payment: PaymentInfo;
|
|
151
|
+
}
|
|
152
|
+
/** Response from POST /x402/contract-audit */
|
|
153
|
+
export interface ContractAuditResponse {
|
|
154
|
+
riskScore: number | null;
|
|
155
|
+
findings: {
|
|
156
|
+
security: string[];
|
|
157
|
+
economic: string[];
|
|
158
|
+
gas: string[];
|
|
159
|
+
};
|
|
160
|
+
summary: string;
|
|
161
|
+
payment?: PaymentInfo;
|
|
162
|
+
}
|
|
163
|
+
/** Response from POST /x402/token-risk */
|
|
164
|
+
export interface TokenRiskResponse {
|
|
165
|
+
riskScore: number | null;
|
|
166
|
+
verdict: string | null;
|
|
167
|
+
findings: {
|
|
168
|
+
contract: string[];
|
|
169
|
+
tokenomics: string[];
|
|
170
|
+
};
|
|
171
|
+
summary: string;
|
|
172
|
+
payment?: PaymentInfo;
|
|
173
|
+
}
|
|
174
|
+
/** Response from POST /x402/dao-analyze */
|
|
175
|
+
export interface DaoAnalyzeResponse {
|
|
176
|
+
recommendation: string | null;
|
|
177
|
+
confidence: number | null;
|
|
178
|
+
analysis: {
|
|
179
|
+
economic: string;
|
|
180
|
+
technical: string;
|
|
181
|
+
risk: string;
|
|
182
|
+
};
|
|
183
|
+
summary: string;
|
|
184
|
+
payment?: PaymentInfo;
|
|
185
|
+
}
|
|
186
|
+
/** Error thrown when an x402-swarms API call fails. */
|
|
187
|
+
export declare class X402SwarmsError extends Error {
|
|
188
|
+
/** HTTP status code from the server. */
|
|
189
|
+
readonly status: number;
|
|
190
|
+
/** Raw response body (may contain `error` field). */
|
|
191
|
+
readonly body: unknown;
|
|
192
|
+
constructor(message: string, status: number, body: unknown);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* x402-swarms client SDK.
|
|
196
|
+
*
|
|
197
|
+
* Wraps every HTTP call with Dexter's `wrapFetch` so x402 payments
|
|
198
|
+
* are handled automatically. Each method maps 1:1 to a platform endpoint.
|
|
199
|
+
*/
|
|
200
|
+
export declare class X402SwarmsClient {
|
|
201
|
+
private readonly x402Fetch;
|
|
202
|
+
private readonly baseUrl;
|
|
203
|
+
constructor(config: X402SwarmsClientConfig);
|
|
204
|
+
/** POST JSON and return parsed response. */
|
|
205
|
+
private post;
|
|
206
|
+
/** GET and return parsed response. */
|
|
207
|
+
private get;
|
|
208
|
+
/**
|
|
209
|
+
* Multi-agent research pipeline ($0.05).
|
|
210
|
+
*
|
|
211
|
+
* Spawns Researcher, FactChecker, and Writer agents to produce
|
|
212
|
+
* a verified report on any topic.
|
|
213
|
+
*
|
|
214
|
+
* @param query - The topic to research.
|
|
215
|
+
* @param depth - Research depth: "quick" | "standard" | "deep". Defaults to "standard".
|
|
216
|
+
* @returns Verified research report with payment receipt.
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* const report = await client.research("Solana validator economics in 2026");
|
|
221
|
+
* console.log(report.result);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
research(query: string, depth?: "quick" | "standard" | "deep"): Promise<ResearchResponse>;
|
|
225
|
+
/**
|
|
226
|
+
* Multi-perspective analysis panel ($0.03).
|
|
227
|
+
*
|
|
228
|
+
* Technical, Economic, and Risk experts synthesize an assessment
|
|
229
|
+
* of the provided text.
|
|
230
|
+
*
|
|
231
|
+
* @param text - The text or topic to analyze.
|
|
232
|
+
* @param type - Analysis type: "comprehensive" | "technical" | "economic" | "risk". Defaults to "comprehensive".
|
|
233
|
+
* @returns Multi-perspective analysis with payment receipt.
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts
|
|
237
|
+
* const analysis = await client.analyze("Impact of spot Bitcoin ETFs on altcoin markets");
|
|
238
|
+
* console.log(analysis.result);
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
analyze(text: string, type?: "comprehensive" | "technical" | "economic" | "risk"): Promise<AnalyzeResponse>;
|
|
242
|
+
/**
|
|
243
|
+
* Single AI agent execution ($0.02).
|
|
244
|
+
*
|
|
245
|
+
* Run a single agent with a custom task, model, and system prompt.
|
|
246
|
+
*
|
|
247
|
+
* @param task - The task for the agent to complete.
|
|
248
|
+
* @param options - Optional agent configuration.
|
|
249
|
+
* @param options.model - LLM model name (e.g. "gpt-4o-mini", "gpt-4o"). Defaults to "gpt-4o-mini".
|
|
250
|
+
* @param options.systemPrompt - Custom system prompt for the agent.
|
|
251
|
+
* @param options.agentName - Custom agent name. Defaults to "x402-agent".
|
|
252
|
+
* @returns Agent output with payment receipt.
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```ts
|
|
256
|
+
* const result = await client.runAgent("Summarize the top 5 DeFi protocols by TVL");
|
|
257
|
+
* console.log(result.result);
|
|
258
|
+
* ```
|
|
259
|
+
*/
|
|
260
|
+
runAgent(task: string, options?: {
|
|
261
|
+
model?: string;
|
|
262
|
+
systemPrompt?: string;
|
|
263
|
+
agentName?: string;
|
|
264
|
+
}): Promise<AgentResponse>;
|
|
265
|
+
/**
|
|
266
|
+
* Solana wallet analyzer ($0.01).
|
|
267
|
+
*
|
|
268
|
+
* Returns SOL balance, token holdings with USD values, and recent activity
|
|
269
|
+
* for any Solana wallet.
|
|
270
|
+
*
|
|
271
|
+
* @param address - Solana wallet address (base58, 32-44 chars).
|
|
272
|
+
* @returns Wallet analysis with payment receipt.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* const wallet = await client.analyzeWallet("So11111111111111111111111111111112");
|
|
277
|
+
* console.log(`SOL balance: ${wallet.solBalance}`);
|
|
278
|
+
* console.log(`Tokens held: ${wallet.tokenCount}`);
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
analyzeWallet(address: string): Promise<WalletAnalysisResponse>;
|
|
282
|
+
/**
|
|
283
|
+
* AI text summarization ($0.01).
|
|
284
|
+
*
|
|
285
|
+
* @param text - The text to summarize.
|
|
286
|
+
* @param maxLength - Maximum summary length in words. Defaults to 200.
|
|
287
|
+
* @returns Summary with word count and payment receipt.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* const result = await client.summarize("Long article text here...", 100);
|
|
292
|
+
* console.log(result.summary);
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
summarize(text: string, maxLength?: number): Promise<SummarizeResponse>;
|
|
296
|
+
/**
|
|
297
|
+
* AI text translation ($0.02).
|
|
298
|
+
*
|
|
299
|
+
* Auto-detects source language and translates to the target language.
|
|
300
|
+
*
|
|
301
|
+
* @param text - The text to translate.
|
|
302
|
+
* @param targetLanguage - Target language name (e.g. "Spanish", "Japanese", "French").
|
|
303
|
+
* @returns Translation with detected source language and payment receipt.
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```ts
|
|
307
|
+
* const result = await client.translate("Hello, world!", "Spanish");
|
|
308
|
+
* console.log(result.translation); // "Hola, mundo!"
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
translate(text: string, targetLanguage: string): Promise<TranslateResponse>;
|
|
312
|
+
/**
|
|
313
|
+
* Multi-agent code review ($0.03).
|
|
314
|
+
*
|
|
315
|
+
* Runs SecurityAuditor, PerformanceReviewer, and StyleChecker agents
|
|
316
|
+
* in parallel on the provided code.
|
|
317
|
+
*
|
|
318
|
+
* @param code - The code to review.
|
|
319
|
+
* @param language - Programming language hint (e.g. "TypeScript", "Solidity"). Auto-detected if omitted.
|
|
320
|
+
* @returns Security, performance, and style findings with payment receipt.
|
|
321
|
+
*
|
|
322
|
+
* @example
|
|
323
|
+
* ```ts
|
|
324
|
+
* const review = await client.codeReview("function add(a, b) { return a + b; }", "JavaScript");
|
|
325
|
+
* console.log(review.rawOutput);
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
codeReview(code: string, language?: string): Promise<CodeReviewResponse>;
|
|
329
|
+
/**
|
|
330
|
+
* Multi-agent content writing ($0.03).
|
|
331
|
+
*
|
|
332
|
+
* Runs a ResearchPipeline (Researcher + FactChecker + Writer) to produce
|
|
333
|
+
* well-researched content on any topic.
|
|
334
|
+
*
|
|
335
|
+
* @param topic - The topic to write about.
|
|
336
|
+
* @param options - Optional style and length settings.
|
|
337
|
+
* @param options.style - Writing style (e.g. "professional", "casual", "academic"). Defaults to "professional".
|
|
338
|
+
* @param options.length - Content length: "short" | "medium" | "long". Defaults to "medium".
|
|
339
|
+
* @returns Written content with word count and payment receipt.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* const article = await client.write("Zero-knowledge proofs explained", { style: "casual", length: "short" });
|
|
344
|
+
* console.log(article.content);
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
write(topic: string, options?: {
|
|
348
|
+
style?: string;
|
|
349
|
+
length?: string;
|
|
350
|
+
}): Promise<WriteResponse>;
|
|
351
|
+
/**
|
|
352
|
+
* Multi-agent debate ($0.03).
|
|
353
|
+
*
|
|
354
|
+
* Runs Proponent, Opponent, and Judge agents to debate a proposition
|
|
355
|
+
* and deliver a verdict with confidence.
|
|
356
|
+
*
|
|
357
|
+
* @param proposition - The statement or question to debate.
|
|
358
|
+
* @returns Pro/con arguments, verdict, and confidence with payment receipt.
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```ts
|
|
362
|
+
* const result = await client.debate("Should companies adopt a 4-day work week?");
|
|
363
|
+
* console.log(result.rawOutput);
|
|
364
|
+
* ```
|
|
365
|
+
*/
|
|
366
|
+
debate(proposition: string): Promise<DebateResponse>;
|
|
367
|
+
/**
|
|
368
|
+
* Structured data extraction ($0.01).
|
|
369
|
+
*
|
|
370
|
+
* Extracts specified fields from unstructured text using AI.
|
|
371
|
+
*
|
|
372
|
+
* @param text - The unstructured text to extract data from.
|
|
373
|
+
* @param fields - Array of field names to extract (e.g. ["name", "email", "company"]).
|
|
374
|
+
* @returns Extracted key-value pairs and payment receipt.
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```ts
|
|
378
|
+
* const result = await client.extract(
|
|
379
|
+
* "Contact John Smith at john@example.com, he works at Acme Corp.",
|
|
380
|
+
* ["name", "email", "company"]
|
|
381
|
+
* );
|
|
382
|
+
* console.log(result.extracted); // { name: "John Smith", email: "john@example.com", company: "Acme Corp." }
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
extract(text: string, fields: string[]): Promise<ExtractResponse>;
|
|
386
|
+
/**
|
|
387
|
+
* AI sentiment analysis ($0.01).
|
|
388
|
+
*
|
|
389
|
+
* Analyzes the sentiment of the given text and returns a classification
|
|
390
|
+
* with confidence score and reasoning.
|
|
391
|
+
*
|
|
392
|
+
* @param text - The text to analyze sentiment for.
|
|
393
|
+
* @returns Sentiment classification, confidence (0-1), reasoning, and payment receipt.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* const result = await client.sentiment("I absolutely love this product!");
|
|
398
|
+
* console.log(result.sentiment); // "positive"
|
|
399
|
+
* console.log(result.confidence); // 0.95
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
sentiment(text: string): Promise<SentimentResponse>;
|
|
403
|
+
/**
|
|
404
|
+
* Multi-agent smart contract pre-audit ($0.50).
|
|
405
|
+
*
|
|
406
|
+
* Runs SecurityAuditor, EconomicAttacker, GasOptimizer, and AuditReporter agents
|
|
407
|
+
* concurrently to produce a structured risk report.
|
|
408
|
+
*
|
|
409
|
+
* @param code - The smart contract source code to audit.
|
|
410
|
+
* @param language - Contract language: "solidity" | "rust" | "anchor". Defaults to "solidity".
|
|
411
|
+
* @returns Audit report with risk score, categorized findings, and payment receipt.
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```ts
|
|
415
|
+
* const audit = await client.contractAudit("pragma solidity ^0.8.0; ...", "solidity");
|
|
416
|
+
* console.log(`Risk score: ${audit.riskScore}/100`);
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
419
|
+
contractAudit(code: string, language?: string): Promise<ContractAuditResponse>;
|
|
420
|
+
/**
|
|
421
|
+
* Multi-agent token risk assessment ($0.05).
|
|
422
|
+
*
|
|
423
|
+
* Runs ContractScanner, TokenomicsAnalyzer, and RiskVerdict agents
|
|
424
|
+
* sequentially to score a token as SAFE/CAUTION/DANGER.
|
|
425
|
+
*
|
|
426
|
+
* @param mint - Token mint/contract address.
|
|
427
|
+
* @param chain - Blockchain: "solana" | "evm". Defaults to "solana".
|
|
428
|
+
* @returns Risk verdict with score, findings, and payment receipt.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```ts
|
|
432
|
+
* const risk = await client.tokenRisk("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
|
|
433
|
+
* console.log(`Verdict: ${risk.verdict}`);
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
tokenRisk(mint: string, chain?: string): Promise<TokenRiskResponse>;
|
|
437
|
+
/**
|
|
438
|
+
* Multi-agent DAO proposal analysis ($0.10).
|
|
439
|
+
*
|
|
440
|
+
* Runs EconomicAnalyst, TechnicalReviewer, RiskAssessor, and VoteSummarizer
|
|
441
|
+
* agents via MixtureOfAgents to produce a voting recommendation.
|
|
442
|
+
*
|
|
443
|
+
* @param proposal - The DAO proposal text to analyze.
|
|
444
|
+
* @param daoName - Optional DAO name for context.
|
|
445
|
+
* @returns Voting recommendation with confidence, analysis breakdown, and payment receipt.
|
|
446
|
+
*
|
|
447
|
+
* @example
|
|
448
|
+
* ```ts
|
|
449
|
+
* const dao = await client.daoAnalyze("Increase staking rewards by 5%", "Jito");
|
|
450
|
+
* console.log(`Recommendation: ${dao.recommendation} (${dao.confidence}% confidence)`);
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
daoAnalyze(proposal: string, daoName?: string): Promise<DaoAnalyzeResponse>;
|
|
454
|
+
/**
|
|
455
|
+
* List all available endpoints with pricing (free).
|
|
456
|
+
*
|
|
457
|
+
* @returns Array of service catalog entries.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```ts
|
|
461
|
+
* const services = await client.getCatalog();
|
|
462
|
+
* services.forEach(s => console.log(`${s.name}: $${s.priceUsd}`));
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
getCatalog(): Promise<CatalogEntry[]>;
|
|
466
|
+
/**
|
|
467
|
+
* Platform health check with revenue stats (free).
|
|
468
|
+
*
|
|
469
|
+
* @returns Health status, receive address, network, and revenue info.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```ts
|
|
473
|
+
* const health = await client.getHealth();
|
|
474
|
+
* console.log(`Status: ${health.status}, Revenue: $${health.totalRevenue}`);
|
|
475
|
+
* ```
|
|
476
|
+
*/
|
|
477
|
+
getHealth(): Promise<HealthResponse>;
|
|
478
|
+
/**
|
|
479
|
+
* Wallet analyzer health check (free).
|
|
480
|
+
*
|
|
481
|
+
* @returns Wallet analyzer status and configuration.
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* ```ts
|
|
485
|
+
* const health = await client.getWalletAnalyzerHealth();
|
|
486
|
+
* console.log(`Helius configured: ${health.heliusConfigured}`);
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
getWalletAnalyzerHealth(): Promise<WalletAnalyzerHealthResponse>;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Create an x402-swarms client.
|
|
493
|
+
*
|
|
494
|
+
* Convenience factory — identical to `new X402SwarmsClient(config)`.
|
|
495
|
+
*
|
|
496
|
+
* @param config - Client configuration (wallet key + optional base URL).
|
|
497
|
+
* @returns Configured client instance.
|
|
498
|
+
*
|
|
499
|
+
* @example
|
|
500
|
+
* ```ts
|
|
501
|
+
* import { createClient } from "@elizaos/plugin-x402-swarms/client";
|
|
502
|
+
*
|
|
503
|
+
* const client = createClient({
|
|
504
|
+
* walletPrivateKey: process.env.SOLANA_PRIVATE_KEY,
|
|
505
|
+
* });
|
|
506
|
+
*
|
|
507
|
+
* // One-liner research
|
|
508
|
+
* const report = await client.research("Zero-knowledge rollups comparison");
|
|
509
|
+
* ```
|
|
510
|
+
*/
|
|
511
|
+
export declare function createClient(config: X402SwarmsClientConfig): X402SwarmsClient;
|
|
512
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAMH,gDAAgD;AAChD,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,OAAO,CAA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