@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.
Files changed (175) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +323 -0
  3. package/dist/actions/delegateToSwarm.d.ts +8 -0
  4. package/dist/actions/delegateToSwarm.d.ts.map +1 -0
  5. package/dist/actions/delegateToSwarm.js +296 -0
  6. package/dist/actions/delegateToSwarm.js.map +1 -0
  7. package/dist/actions/delegateToSwarmWithPayment.d.ts +8 -0
  8. package/dist/actions/delegateToSwarmWithPayment.d.ts.map +1 -0
  9. package/dist/actions/delegateToSwarmWithPayment.js +323 -0
  10. package/dist/actions/delegateToSwarmWithPayment.js.map +1 -0
  11. package/dist/actions/discoverServices.d.ts +3 -0
  12. package/dist/actions/discoverServices.d.ts.map +1 -0
  13. package/dist/actions/discoverServices.js +63 -0
  14. package/dist/actions/discoverServices.js.map +1 -0
  15. package/dist/actions/index.d.ts +6 -0
  16. package/dist/actions/index.d.ts.map +1 -0
  17. package/dist/actions/index.js +6 -0
  18. package/dist/actions/index.js.map +1 -0
  19. package/dist/actions/payForService.d.ts +3 -0
  20. package/dist/actions/payForService.d.ts.map +1 -0
  21. package/dist/actions/payForService.js +115 -0
  22. package/dist/actions/payForService.js.map +1 -0
  23. package/dist/actions/runSwarmAgent.d.ts +7 -0
  24. package/dist/actions/runSwarmAgent.d.ts.map +1 -0
  25. package/dist/actions/runSwarmAgent.js +131 -0
  26. package/dist/actions/runSwarmAgent.js.map +1 -0
  27. package/dist/client/index.d.ts +512 -0
  28. package/dist/client/index.d.ts.map +1 -0
  29. package/dist/client/index.js +469 -0
  30. package/dist/client/index.js.map +1 -0
  31. package/dist/evaluators/paymentEvaluator.d.ts +7 -0
  32. package/dist/evaluators/paymentEvaluator.d.ts.map +1 -0
  33. package/dist/evaluators/paymentEvaluator.js +104 -0
  34. package/dist/evaluators/paymentEvaluator.js.map +1 -0
  35. package/dist/index.d.ts +29 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +60 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/marketing/index.d.ts +7 -0
  40. package/dist/marketing/index.d.ts.map +1 -0
  41. package/dist/marketing/index.js +7 -0
  42. package/dist/marketing/index.js.map +1 -0
  43. package/dist/marketing/milestoneAgent.d.ts +54 -0
  44. package/dist/marketing/milestoneAgent.d.ts.map +1 -0
  45. package/dist/marketing/milestoneAgent.js +121 -0
  46. package/dist/marketing/milestoneAgent.js.map +1 -0
  47. package/dist/marketing/tweetTemplates.d.ts +32 -0
  48. package/dist/marketing/tweetTemplates.d.ts.map +1 -0
  49. package/dist/marketing/tweetTemplates.js +60 -0
  50. package/dist/marketing/tweetTemplates.js.map +1 -0
  51. package/dist/marketing/xMonitor.d.ts +51 -0
  52. package/dist/marketing/xMonitor.d.ts.map +1 -0
  53. package/dist/marketing/xMonitor.js +141 -0
  54. package/dist/marketing/xMonitor.js.map +1 -0
  55. package/dist/providers/x402Provider.d.ts +7 -0
  56. package/dist/providers/x402Provider.d.ts.map +1 -0
  57. package/dist/providers/x402Provider.js +72 -0
  58. package/dist/providers/x402Provider.js.map +1 -0
  59. package/dist/providers/x402ServerProvider.d.ts +7 -0
  60. package/dist/providers/x402ServerProvider.d.ts.map +1 -0
  61. package/dist/providers/x402ServerProvider.js +48 -0
  62. package/dist/providers/x402ServerProvider.js.map +1 -0
  63. package/dist/routes/advancedRoutes.d.ts +5 -0
  64. package/dist/routes/advancedRoutes.d.ts.map +1 -0
  65. package/dist/routes/advancedRoutes.js +869 -0
  66. package/dist/routes/advancedRoutes.js.map +1 -0
  67. package/dist/routes/batchRoutes.d.ts +13 -0
  68. package/dist/routes/batchRoutes.d.ts.map +1 -0
  69. package/dist/routes/batchRoutes.js +496 -0
  70. package/dist/routes/batchRoutes.js.map +1 -0
  71. package/dist/routes/codeAuditRoutes.d.ts +6 -0
  72. package/dist/routes/codeAuditRoutes.d.ts.map +1 -0
  73. package/dist/routes/codeAuditRoutes.js +415 -0
  74. package/dist/routes/codeAuditRoutes.js.map +1 -0
  75. package/dist/routes/contentRoutes.d.ts +5 -0
  76. package/dist/routes/contentRoutes.d.ts.map +1 -0
  77. package/dist/routes/contentRoutes.js +370 -0
  78. package/dist/routes/contentRoutes.js.map +1 -0
  79. package/dist/routes/cryptoAnalysisRoutes.d.ts +5 -0
  80. package/dist/routes/cryptoAnalysisRoutes.d.ts.map +1 -0
  81. package/dist/routes/cryptoAnalysisRoutes.js +641 -0
  82. package/dist/routes/cryptoAnalysisRoutes.js.map +1 -0
  83. package/dist/routes/cryptoRoutes.d.ts +5 -0
  84. package/dist/routes/cryptoRoutes.d.ts.map +1 -0
  85. package/dist/routes/cryptoRoutes.js +1225 -0
  86. package/dist/routes/cryptoRoutes.js.map +1 -0
  87. package/dist/routes/heliusDataRoutes.d.ts +14 -0
  88. package/dist/routes/heliusDataRoutes.d.ts.map +1 -0
  89. package/dist/routes/heliusDataRoutes.js +388 -0
  90. package/dist/routes/heliusDataRoutes.js.map +1 -0
  91. package/dist/routes/taskRoutes.d.ts +5 -0
  92. package/dist/routes/taskRoutes.d.ts.map +1 -0
  93. package/dist/routes/taskRoutes.js +574 -0
  94. package/dist/routes/taskRoutes.js.map +1 -0
  95. package/dist/routes/tradingRoutes.d.ts +5 -0
  96. package/dist/routes/tradingRoutes.d.ts.map +1 -0
  97. package/dist/routes/tradingRoutes.js +500 -0
  98. package/dist/routes/tradingRoutes.js.map +1 -0
  99. package/dist/routes/walletAnalyzerRoutes.d.ts +12 -0
  100. package/dist/routes/walletAnalyzerRoutes.d.ts.map +1 -0
  101. package/dist/routes/walletAnalyzerRoutes.js +316 -0
  102. package/dist/routes/walletAnalyzerRoutes.js.map +1 -0
  103. package/dist/routes/x402Routes.d.ts +9 -0
  104. package/dist/routes/x402Routes.d.ts.map +1 -0
  105. package/dist/routes/x402Routes.js +474 -0
  106. package/dist/routes/x402Routes.js.map +1 -0
  107. package/dist/schemas/budgetState.d.ts +250 -0
  108. package/dist/schemas/budgetState.d.ts.map +1 -0
  109. package/dist/schemas/budgetState.js +20 -0
  110. package/dist/schemas/budgetState.js.map +1 -0
  111. package/dist/schemas/endpointScores.d.ts +182 -0
  112. package/dist/schemas/endpointScores.d.ts.map +1 -0
  113. package/dist/schemas/endpointScores.js +17 -0
  114. package/dist/schemas/endpointScores.js.map +1 -0
  115. package/dist/schemas/index.d.ts +4 -0
  116. package/dist/schemas/index.d.ts.map +1 -0
  117. package/dist/schemas/index.js +4 -0
  118. package/dist/schemas/index.js.map +1 -0
  119. package/dist/schemas/paymentHistory.d.ts +284 -0
  120. package/dist/schemas/paymentHistory.d.ts.map +1 -0
  121. package/dist/schemas/paymentHistory.js +24 -0
  122. package/dist/schemas/paymentHistory.js.map +1 -0
  123. package/dist/server/index.d.ts +3 -0
  124. package/dist/server/index.d.ts.map +1 -0
  125. package/dist/server/index.js +3 -0
  126. package/dist/server/index.js.map +1 -0
  127. package/dist/server/x402Gate.d.ts +56 -0
  128. package/dist/server/x402Gate.d.ts.map +1 -0
  129. package/dist/server/x402Gate.js +240 -0
  130. package/dist/server/x402Gate.js.map +1 -0
  131. package/dist/server/x402ServerService.d.ts +30 -0
  132. package/dist/server/x402ServerService.d.ts.map +1 -0
  133. package/dist/server/x402ServerService.js +79 -0
  134. package/dist/server/x402ServerService.js.map +1 -0
  135. package/dist/services/paymentMemoryService.d.ts +73 -0
  136. package/dist/services/paymentMemoryService.d.ts.map +1 -0
  137. package/dist/services/paymentMemoryService.js +247 -0
  138. package/dist/services/paymentMemoryService.js.map +1 -0
  139. package/dist/services/swarmsService.d.ts +66 -0
  140. package/dist/services/swarmsService.d.ts.map +1 -0
  141. package/dist/services/swarmsService.js +102 -0
  142. package/dist/services/swarmsService.js.map +1 -0
  143. package/dist/services/x402WalletService.d.ts +57 -0
  144. package/dist/services/x402WalletService.d.ts.map +1 -0
  145. package/dist/services/x402WalletService.js +258 -0
  146. package/dist/services/x402WalletService.js.map +1 -0
  147. package/dist/templates/index.d.ts +24 -0
  148. package/dist/templates/index.d.ts.map +1 -0
  149. package/dist/templates/index.js +51 -0
  150. package/dist/templates/index.js.map +1 -0
  151. package/dist/templates/swarmTemplates.d.ts +22 -0
  152. package/dist/templates/swarmTemplates.d.ts.map +1 -0
  153. package/dist/templates/swarmTemplates.js +225 -0
  154. package/dist/templates/swarmTemplates.js.map +1 -0
  155. package/dist/types.d.ts +197 -0
  156. package/dist/types.d.ts.map +1 -0
  157. package/dist/types.js +2 -0
  158. package/dist/types.js.map +1 -0
  159. package/dist/utils/cache.d.ts +17 -0
  160. package/dist/utils/cache.d.ts.map +1 -0
  161. package/dist/utils/cache.js +32 -0
  162. package/dist/utils/cache.js.map +1 -0
  163. package/dist/utils/llm.d.ts +16 -0
  164. package/dist/utils/llm.d.ts.map +1 -0
  165. package/dist/utils/llm.js +32 -0
  166. package/dist/utils/llm.js.map +1 -0
  167. package/dist/utils/reportStore.d.ts +45 -0
  168. package/dist/utils/reportStore.d.ts.map +1 -0
  169. package/dist/utils/reportStore.js +164 -0
  170. package/dist/utils/reportStore.js.map +1 -0
  171. package/dist/utils/taskQueue.d.ts +54 -0
  172. package/dist/utils/taskQueue.d.ts.map +1 -0
  173. package/dist/utils/taskQueue.js +124 -0
  174. package/dist/utils/taskQueue.js.map +1 -0
  175. package/package.json +69 -0
@@ -0,0 +1,370 @@
1
+ import { x402Gate } from "../server/x402Gate.js";
2
+ import { callOpenAI } from "../utils/llm.js";
3
+ // ── Input validation helpers ───────────────────────────────────────────
4
+ function requireString(body, field, maxLen = 100_000) {
5
+ const val = body[field];
6
+ if (!val || typeof val !== "string" || val.trim().length === 0)
7
+ return null;
8
+ return val.slice(0, maxLen);
9
+ }
10
+ function optionalStringArray(body, field, maxItems) {
11
+ const val = body[field];
12
+ if (!Array.isArray(val))
13
+ return undefined;
14
+ const filtered = val
15
+ .filter((v) => typeof v === "string" && v.trim().length > 0)
16
+ .slice(0, maxItems);
17
+ return filtered.length > 0 ? filtered : undefined;
18
+ }
19
+ const VALID_TONES = ["professional", "casual", "academic", "conversational", "authoritative"];
20
+ const VALID_FORMATS = ["json", "table"];
21
+ // ── Catalog entries ───────────────────────────────────────────────────
22
+ export const CONTENT_CATALOG = [
23
+ {
24
+ name: "SEO Article",
25
+ description: "Multi-agent SEO article generation — research, write, and edit with keyword optimization",
26
+ path: "/x402/seo-article",
27
+ method: "POST",
28
+ priceUsd: "0.25",
29
+ },
30
+ {
31
+ name: "Document Extract",
32
+ description: "AI document data extraction — pull structured fields from unstructured text",
33
+ path: "/x402/document-extract",
34
+ method: "POST",
35
+ priceUsd: "0.05",
36
+ },
37
+ ];
38
+ // ── Helper: get SwarmsService or null ──────────────────────────────────
39
+ function getSwarmsService(runtime) {
40
+ const svc = runtime.getService("SWARMS");
41
+ return svc?.isAvailable() ? svc : null;
42
+ }
43
+ // ── JSON parse helper ──────────────────────────────────────────────────
44
+ function tryParseJson(raw) {
45
+ try {
46
+ const match = raw.match(/\{[\s\S]*\}/);
47
+ if (match) {
48
+ return JSON.parse(match[0]);
49
+ }
50
+ }
51
+ catch {
52
+ // not valid JSON
53
+ }
54
+ return null;
55
+ }
56
+ // ── Swarm output extraction ────────────────────────────────────────────
57
+ function extractSwarmOutput(result) {
58
+ const output = result.output;
59
+ if (typeof output === "string")
60
+ return output;
61
+ if (Array.isArray(output)) {
62
+ return output
63
+ .map((item) => {
64
+ if (typeof item === "string")
65
+ return item;
66
+ if (item && typeof item === "object") {
67
+ const obj = item;
68
+ const role = obj.role ?? obj.agent_name ?? "agent";
69
+ const content = obj.content ?? obj.text ?? obj.output ?? "";
70
+ return `[${role}]\n${content}`;
71
+ }
72
+ return String(item);
73
+ })
74
+ .join("\n\n");
75
+ }
76
+ if (output && typeof output === "object") {
77
+ const nested = output;
78
+ if (typeof nested.output === "string")
79
+ return nested.output;
80
+ if (typeof nested.content === "string")
81
+ return nested.content;
82
+ return JSON.stringify(output);
83
+ }
84
+ if (typeof result === "string")
85
+ return result;
86
+ return JSON.stringify(result);
87
+ }
88
+ // ── Free tier truncation helpers ───────────────────────────────────────
89
+ function truncateSeoArticleForFreeTier(result, gate) {
90
+ if (gate.amountUsd > 0)
91
+ return result; // paid — full output
92
+ return {
93
+ title: result.title,
94
+ metaDescription: result.metaDescription,
95
+ wordCount: result.wordCount,
96
+ articlePreview: result.article.slice(0, 200),
97
+ _preview: true,
98
+ _message: `Article "${result.title}" (${result.wordCount} words) generated. Pay $0.25 to see full article.`,
99
+ };
100
+ }
101
+ function truncateDocumentExtractForFreeTier(result, gate) {
102
+ if (gate.amountUsd > 0)
103
+ return result; // paid — full output
104
+ const fieldNames = Object.keys(result.extracted);
105
+ return {
106
+ fieldsFound: result.fieldsFound,
107
+ confidence: result.confidence,
108
+ fieldNames,
109
+ _preview: true,
110
+ _message: `Extracted ${result.fieldsFound} fields (confidence: ${result.confidence}). Pay $0.05 to see values.`,
111
+ };
112
+ }
113
+ // ── Routes ─────────────────────────────────────────────────────────────
114
+ export const contentRoutes = [
115
+ // ── POST /x402/seo-article — $0.25 ───────────────────────────────
116
+ {
117
+ type: "POST",
118
+ path: "/x402/seo-article",
119
+ handler: async (req, res, runtime) => {
120
+ const gate = await x402Gate(runtime, req, res, {
121
+ amountUsd: "0.25",
122
+ description: "Multi-agent SEO article generation",
123
+ });
124
+ if (!gate.paid)
125
+ return;
126
+ const body = req.body ?? {};
127
+ const topic = requireString(body, "topic", 500);
128
+ if (!topic) {
129
+ res.status(400).json({ error: "Missing required field: topic (non-empty string, max 500 chars)" });
130
+ return;
131
+ }
132
+ const keywords = optionalStringArray(body, "keywords", 10);
133
+ const wordCount = typeof body.wordCount === "number"
134
+ ? Math.max(500, Math.min(body.wordCount, 5000))
135
+ : 1500;
136
+ const tone = typeof body.tone === "string" && VALID_TONES.includes(body.tone)
137
+ ? body.tone
138
+ : "professional";
139
+ const swarmsService = getSwarmsService(runtime);
140
+ if (!swarmsService) {
141
+ res.status(503).json({ error: "Swarms service unavailable" });
142
+ return;
143
+ }
144
+ try {
145
+ const keywordInstruction = keywords
146
+ ? `\nPrimary keywords to target: ${keywords.join(", ")}`
147
+ : "";
148
+ const result = await swarmsService.runSwarm({
149
+ name: `seo-article-${Date.now()}`,
150
+ description: `SEO article about: ${topic.slice(0, 100)}`,
151
+ agents: [
152
+ {
153
+ agent_name: "SEOResearcher",
154
+ model_name: "gpt-4o",
155
+ system_prompt: "You are an SEO research specialist. Given a topic and optional keywords, create a detailed article outline. " +
156
+ "Output ONLY valid JSON with this structure: " +
157
+ '{ "title": "string", "metaDescription": "string (max 160 chars)", "primaryKeyword": "string", ' +
158
+ '"secondaryKeywords": ["string"], "outline": [{ "heading": "string", "subpoints": ["string"], "targetWordCount": number }] }. ' +
159
+ "No extra text outside the JSON.",
160
+ max_loops: 1,
161
+ max_tokens: 4096,
162
+ temperature: 0.4,
163
+ role: "worker",
164
+ },
165
+ {
166
+ agent_name: "ContentWriter",
167
+ model_name: "gpt-4o",
168
+ system_prompt: `You are an expert content writer. Given an SEO outline (from the previous agent), write a full article in markdown. ` +
169
+ `Target approximately ${wordCount} words. Use a ${tone} tone. ` +
170
+ "Do NOT include an H1 heading (the title will be added separately). " +
171
+ "Follow the outline sections exactly, using H2/H3 headings. " +
172
+ "Output raw markdown only — no JSON wrapping, no code fences.",
173
+ max_loops: 1,
174
+ max_tokens: 8192,
175
+ temperature: 0.6,
176
+ role: "worker",
177
+ },
178
+ {
179
+ agent_name: "Editor",
180
+ model_name: "gpt-4o",
181
+ system_prompt: "You are a professional editor. Polish the article from the previous agent. Fix grammar, improve flow, " +
182
+ "ensure keyword density is natural (1-3%). " +
183
+ "Output ONLY valid JSON: " +
184
+ '{ "article": "the polished markdown article", "title": "string", "metaDescription": "string", ' +
185
+ '"wordCount": number, "readabilityScore": number (1-100), ' +
186
+ '"keywordDensity": { "keyword": percentage }, "editsApplied": ["string"] }. ' +
187
+ "No extra text outside the JSON.",
188
+ max_loops: 1,
189
+ max_tokens: 8192,
190
+ temperature: 0.3,
191
+ role: "worker",
192
+ },
193
+ ],
194
+ swarm_type: "SequentialWorkflow",
195
+ task: `Write an SEO-optimized article about: ${topic}` +
196
+ keywordInstruction +
197
+ `\nTarget word count: ${wordCount}` +
198
+ `\nTone: ${tone}`,
199
+ max_loops: 1,
200
+ });
201
+ const rawOutput = extractSwarmOutput(result);
202
+ // Try to parse Editor's JSON output
203
+ let article = rawOutput;
204
+ let title = topic;
205
+ let metaDescription = "";
206
+ let finalWordCount = rawOutput.split(/\s+/).filter(Boolean).length;
207
+ let readabilityScore = null;
208
+ let keywordDensity = null;
209
+ let editsApplied = [];
210
+ const parsed = tryParseJson(rawOutput);
211
+ if (parsed) {
212
+ if (typeof parsed.article === "string")
213
+ article = parsed.article;
214
+ if (typeof parsed.title === "string")
215
+ title = parsed.title;
216
+ if (typeof parsed.metaDescription === "string")
217
+ metaDescription = parsed.metaDescription;
218
+ if (typeof parsed.wordCount === "number")
219
+ finalWordCount = parsed.wordCount;
220
+ if (typeof parsed.readabilityScore === "number")
221
+ readabilityScore = parsed.readabilityScore;
222
+ if (parsed.keywordDensity && typeof parsed.keywordDensity === "object") {
223
+ keywordDensity = parsed.keywordDensity;
224
+ }
225
+ if (Array.isArray(parsed.editsApplied)) {
226
+ editsApplied = parsed.editsApplied.filter((e) => typeof e === "string");
227
+ }
228
+ }
229
+ const seoResult = {
230
+ article,
231
+ title,
232
+ metaDescription,
233
+ wordCount: finalWordCount,
234
+ readabilityScore,
235
+ keywordDensity,
236
+ editsApplied,
237
+ };
238
+ const truncated = truncateSeoArticleForFreeTier(seoResult, gate);
239
+ res.json({
240
+ ...truncated,
241
+ topic,
242
+ tone,
243
+ freeRemaining: gate.freeRemaining,
244
+ payment: {
245
+ amount: "0.25",
246
+ transaction: gate.transaction,
247
+ network: gate.network,
248
+ },
249
+ });
250
+ }
251
+ catch (err) {
252
+ runtime.logger.error({ error: err instanceof Error ? err.message : String(err) }, "[x402/seo-article] Swarm execution failed");
253
+ res.status(500).json({ error: "Service temporarily unavailable" });
254
+ }
255
+ },
256
+ },
257
+ // ── POST /x402/document-extract — $0.05 ──────────────────────────
258
+ {
259
+ type: "POST",
260
+ path: "/x402/document-extract",
261
+ handler: async (req, res, runtime) => {
262
+ const gate = await x402Gate(runtime, req, res, {
263
+ amountUsd: "0.05",
264
+ description: "AI document data extraction",
265
+ });
266
+ if (!gate.paid)
267
+ return;
268
+ const body = req.body ?? {};
269
+ const text = requireString(body, "text", 100_000);
270
+ if (!text) {
271
+ res.status(400).json({ error: "Missing required field: text (non-empty string, max 100,000 chars)" });
272
+ return;
273
+ }
274
+ const fields = optionalStringArray(body, "fields", 50);
275
+ const format = typeof body.format === "string" && VALID_FORMATS.includes(body.format)
276
+ ? body.format
277
+ : "json";
278
+ const formatInstruction = format === "table"
279
+ ? 'If format=table, use { "extracted": { "headers": [...], "rows": [[...]] }, "confidence": 0.0-1.0, "fieldsFound": number, "fieldsRequested": number_or_"auto", "notes": ["strings"] }.'
280
+ : '{ "extracted": { "field": "value_or_null" }, "confidence": 0.0-1.0, "fieldsFound": number, "fieldsRequested": number_or_"auto", "notes": ["strings"] }.';
281
+ const systemPrompt = "You are a document data extraction specialist. Extract ONLY information explicitly present in the text. " +
282
+ `Output JSON: ${formatInstruction} ` +
283
+ "Do NOT hallucinate data. Output ONLY JSON.";
284
+ const fieldInstruction = fields
285
+ ? `Extract these specific fields: [${fields.join(", ")}]`
286
+ : "Auto-detect and extract all relevant fields from the text";
287
+ const userPrompt = `${fieldInstruction}\n\nFormat: ${format}\n\nText:\n${text}`;
288
+ try {
289
+ let raw;
290
+ const openaiKey = String(runtime.getSetting("OPENAI_API_KEY") ?? "");
291
+ if (openaiKey) {
292
+ raw = await callOpenAI({
293
+ apiKey: openaiKey,
294
+ model: "gpt-4o-mini",
295
+ systemPrompt,
296
+ userPrompt,
297
+ maxTokens: 4096,
298
+ temperature: 0.1,
299
+ });
300
+ }
301
+ else {
302
+ const swarmsService = getSwarmsService(runtime);
303
+ if (!swarmsService) {
304
+ res.status(503).json({ error: "Neither OPENAI_API_KEY nor Swarms service available" });
305
+ return;
306
+ }
307
+ const result = await swarmsService.runAgent({
308
+ agent_name: "document-extractor",
309
+ model_name: "gpt-4o-mini",
310
+ system_prompt: systemPrompt,
311
+ max_loops: 1,
312
+ max_tokens: 4096,
313
+ temperature: 0.1,
314
+ role: "worker",
315
+ }, userPrompt);
316
+ raw = String(result.outputs ?? result);
317
+ }
318
+ // Parse extraction result
319
+ let extracted = {};
320
+ let confidence = 0.5;
321
+ let fieldsFound = 0;
322
+ let fieldsRequested = fields ? fields.length : "auto";
323
+ let notes = [];
324
+ const parsed = tryParseJson(raw);
325
+ if (parsed) {
326
+ if (parsed.extracted && typeof parsed.extracted === "object") {
327
+ extracted = parsed.extracted;
328
+ }
329
+ if (typeof parsed.confidence === "number")
330
+ confidence = parsed.confidence;
331
+ if (typeof parsed.fieldsFound === "number")
332
+ fieldsFound = parsed.fieldsFound;
333
+ if (parsed.fieldsRequested !== undefined)
334
+ fieldsRequested = parsed.fieldsRequested;
335
+ if (Array.isArray(parsed.notes)) {
336
+ notes = parsed.notes.filter((n) => typeof n === "string");
337
+ }
338
+ }
339
+ else {
340
+ // Fallback: couldn't parse JSON
341
+ extracted = { raw };
342
+ fieldsFound = 1;
343
+ }
344
+ const extractResult = {
345
+ extracted,
346
+ confidence,
347
+ fieldsFound,
348
+ fieldsRequested,
349
+ notes,
350
+ };
351
+ const truncated = truncateDocumentExtractForFreeTier(extractResult, gate);
352
+ res.json({
353
+ ...truncated,
354
+ format,
355
+ freeRemaining: gate.freeRemaining,
356
+ payment: {
357
+ amount: "0.05",
358
+ transaction: gate.transaction,
359
+ network: gate.network,
360
+ },
361
+ });
362
+ }
363
+ catch (err) {
364
+ runtime.logger.error({ error: err instanceof Error ? err.message : String(err) }, "[x402/document-extract] Agent execution failed");
365
+ res.status(500).json({ error: "Service temporarily unavailable" });
366
+ }
367
+ },
368
+ },
369
+ ];
370
+ //# sourceMappingURL=contentRoutes.js.map
@@ -0,0 +1 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M,CAAC,KAAK,CAAC,EAAE,CAAC;wBAChC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;oBACzE,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,gCAAgC;oBAChC,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC;oBACpB,WAAW,GAAG,CAAC,CAAC;gBAClB,CAAC;gBAED,MAAM,aAAa,GAAG;oBACpB,SAAS;oBACT,UAAU;oBACV,WAAW;oBACX,eAAe;oBACf,KAAK;iBACN,CAAC;gBAEF,MAAM,SAAS,GAAG,kCAAkC,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAE1E,GAAG,CAAC,IAAI,CAAC;oBACP,GAAG,SAAS;oBACZ,MAAM;oBACN,aAAa,EAAE,IAAI,CAAC,aAAa;oBACjC,OAAO,EAAE;wBACP,MAAM,EAAE,MAAM;wBACd,WAAW,EAAE,IAAI,CAAC,WAAW;wBAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;qBACtB;iBACF,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,EAAE,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAC3D,gDAAgD,CACjD,CAAC;gBACF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;KACF;CACF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { Route } from "@elizaos/core";
2
+ import type { X402ServiceEndpoint } from "../types.js";
3
+ export declare const CRYPTO_ANALYSIS_CATALOG: X402ServiceEndpoint[];
4
+ export declare const cryptoAnalysisRoutes: Route[];
5
+ //# sourceMappingURL=cryptoAnalysisRoutes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoAnalysisRoutes.d.ts","sourceRoot":"","sources":["../../src/routes/cryptoAnalysisRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AA+EvD,eAAO,MAAM,uBAAuB,EAAE,mBAAmB,EAyBxD,CAAC;AAMF,eAAO,MAAM,oBAAoB,EAAE,KAAK,EAkmBvC,CAAC"}