plugin-undesirables 2.0.1 → 2.0.2

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/dist/index.js CHANGED
@@ -1,109 +1,132 @@
1
- /**
2
- * The Undesirables — ElizaOS Plugin v2.0
3
- * ========================================
4
- * Pioneers "Personality-as-Code" via verifiable soul workspaces.
5
- * Each of 4,444 NFTs generates a unique AI personality from its visual traits.
6
- *
7
- * Features:
8
- * - Load any of 4,444 unique soul personalities
9
- * - 23 unique skills across the collection (10 universal + 13 strategy-specific)
10
- * - Market analysis with personality-driven perspective
11
- * - Business Pilot — 23 AI-powered business modules
12
- * - Meme Machine — content creation & marketing
13
- * - Portfolio analysis with risk guardrails
14
- * - Persistent memory across sessions
15
- * - Multi-agent safe (workspaces keyed by agentId)
16
- *
17
- * @see https://the-undesirables.com
18
- * @see https://gitlab.com/meme-merchants/undesirables-mcp-server
19
- */
1
+ // src/index.ts
2
+ import * as fs2 from "fs";
3
+ import * as path2 from "path";
4
+ import * as yaml from "js-yaml";
5
+
6
+ // src/environment.ts
20
7
  import * as fs from "fs";
21
8
  import * as path from "path";
22
- import * as yaml from "js-yaml";
23
- // ============================================================
24
- // Multi-Agent Safe Workspace Store
25
- // ============================================================
26
- /** Keyed by runtime.agentId — prevents state collision across agents */
27
- const workspaces = new Map();
28
- // ============================================================
29
- // Workspace Loader (Async + Secure)
30
- // ============================================================
31
- function getSafePath(workspacePath, requestedFile) {
32
- const baseDir = path.resolve(workspacePath);
33
- const targetPath = path.resolve(baseDir, requestedFile);
34
- if (!targetPath.startsWith(baseDir + path.sep) && targetPath !== baseDir) {
35
- throw new Error(`Security Error: Path traversal attempt detected on ${requestedFile}`);
9
+ function validateUndesirableConfig(runtime) {
10
+ const workspacePath = runtime.getSetting?.("UNDESIRABLES_WORKSPACE") || process.env.UNDESIRABLES_WORKSPACE || "";
11
+ if (!workspacePath) {
12
+ return {
13
+ valid: false,
14
+ error: "UNDESIRABLES_WORKSPACE is required. Set it in your character.json settings or as an environment variable. Point it to the absolute path of your downloaded soul workspace folder."
15
+ };
16
+ }
17
+ if (!fs.existsSync(workspacePath)) {
18
+ return {
19
+ valid: false,
20
+ error: `UNDESIRABLES_WORKSPACE path does not exist: "${workspacePath}". Make sure you've downloaded and unzipped your soul workspace.`
21
+ };
22
+ }
23
+ const soulPath = path.join(workspacePath, "SOUL.md");
24
+ if (!fs.existsSync(soulPath)) {
25
+ return {
26
+ valid: false,
27
+ error: `No SOUL.md found in workspace: "${workspacePath}". This doesn't look like a valid soul workspace. Download one from the-undesirables.com/soul`
28
+ };
29
+ }
30
+ return { valid: true, workspacePath };
31
+ }
32
+
33
+ // src/services.ts
34
+ import { Service } from "@elizaos/core";
35
+ var MemeTrendService = class _MemeTrendService extends Service {
36
+ static serviceType = "MEME_TREND_MONITOR";
37
+ get capabilityDescription() {
38
+ return "Monitors meme trends and content patterns for The Undesirables";
39
+ }
40
+ static async start(runtime) {
41
+ const service = new _MemeTrendService();
42
+ await service.initialize(runtime);
43
+ return service;
44
+ }
45
+ monitorInterval = null;
46
+ async initialize(_runtime) {
47
+ console.log("[Undesirables Service] Meme Trend Service initialized.");
48
+ }
49
+ async stop() {
50
+ if (this.monitorInterval) {
51
+ clearInterval(this.monitorInterval);
36
52
  }
37
- return targetPath;
53
+ console.log("[Undesirables Service] Meme Trend Service stopped.");
54
+ }
55
+ pollTrends() {
56
+ console.log("[Undesirables Service] Background task: Fetching latest meme templates...");
57
+ }
58
+ };
59
+
60
+ // src/index.ts
61
+ var workspaces = /* @__PURE__ */ new Map();
62
+ function getSafePath(workspacePath, requestedFile) {
63
+ const baseDir = path2.resolve(workspacePath);
64
+ const targetPath = path2.resolve(baseDir, requestedFile);
65
+ if (!targetPath.startsWith(baseDir + path2.sep) && targetPath !== baseDir) {
66
+ throw new Error(`Security Error: Path traversal attempt detected on ${requestedFile}`);
67
+ }
68
+ return targetPath;
38
69
  }
39
70
  async function loadWorkspace(workspacePath) {
40
- const workspace = {
41
- soulMd: "",
42
- systemPrompt: "",
43
- memory: "",
44
- predictions: [],
45
- skills: {},
46
- meta: {},
47
- };
48
- const soulPath = getSafePath(workspacePath, "SOUL.md");
49
- if (fs.existsSync(soulPath)) {
50
- workspace.soulMd = await fs.promises.readFile(soulPath, "utf-8");
51
- // Parse YAML frontmatter securely via js-yaml with JSON_SCHEMA
52
- const fmMatch = workspace.soulMd.match(/^---\n([\s\S]*?)\n---/);
53
- if (fmMatch) {
54
- try {
55
- const parsed = yaml.load(fmMatch[1], { schema: yaml.JSON_SCHEMA });
56
- if (parsed && typeof parsed === "object") {
57
- for (const key of Object.keys(parsed)) {
58
- if (key === "__proto__" || key === "constructor" || key === "prototype")
59
- continue;
60
- workspace.meta[key] = parsed[key];
61
- }
62
- }
63
- }
64
- catch {
65
- // Silently skip malformed YAML frontmatter
66
- }
71
+ const workspace = {
72
+ soulMd: "",
73
+ systemPrompt: "",
74
+ memory: "",
75
+ predictions: [],
76
+ skills: {},
77
+ meta: {}
78
+ };
79
+ const soulPath = getSafePath(workspacePath, "SOUL.md");
80
+ if (fs2.existsSync(soulPath)) {
81
+ workspace.soulMd = await fs2.promises.readFile(soulPath, "utf-8");
82
+ const fmMatch = workspace.soulMd.match(/^---\n([\s\S]*?)\n---/);
83
+ if (fmMatch) {
84
+ try {
85
+ const parsed = yaml.load(fmMatch[1], { schema: yaml.JSON_SCHEMA });
86
+ if (parsed && typeof parsed === "object") {
87
+ for (const key of Object.keys(parsed)) {
88
+ if (key === "__proto__" || key === "constructor" || key === "prototype") continue;
89
+ workspace.meta[key] = parsed[key];
90
+ }
67
91
  }
92
+ } catch {
93
+ }
68
94
  }
69
- const systemPath = getSafePath(workspacePath, "SYSTEM_PROMPT.txt");
70
- if (fs.existsSync(systemPath)) {
71
- workspace.systemPrompt = await fs.promises.readFile(systemPath, "utf-8");
72
- }
73
- const memoryPath = getSafePath(workspacePath, "MEMORY.md");
74
- if (fs.existsSync(memoryPath)) {
75
- workspace.memory = await fs.promises.readFile(memoryPath, "utf-8");
76
- }
77
- const predictionsPath = getSafePath(workspacePath, "PREDICTIONS_LEDGER.json");
78
- if (fs.existsSync(predictionsPath)) {
79
- try {
80
- const raw = await fs.promises.readFile(predictionsPath, "utf-8");
81
- workspace.predictions = JSON.parse(raw);
82
- }
83
- catch {
84
- workspace.predictions = [];
85
- }
95
+ }
96
+ const systemPath = getSafePath(workspacePath, "SYSTEM_PROMPT.txt");
97
+ if (fs2.existsSync(systemPath)) {
98
+ workspace.systemPrompt = await fs2.promises.readFile(systemPath, "utf-8");
99
+ }
100
+ const memoryPath = getSafePath(workspacePath, "MEMORY.md");
101
+ if (fs2.existsSync(memoryPath)) {
102
+ workspace.memory = await fs2.promises.readFile(memoryPath, "utf-8");
103
+ }
104
+ const predictionsPath = getSafePath(workspacePath, "PREDICTIONS_LEDGER.json");
105
+ if (fs2.existsSync(predictionsPath)) {
106
+ try {
107
+ const raw = await fs2.promises.readFile(predictionsPath, "utf-8");
108
+ workspace.predictions = JSON.parse(raw);
109
+ } catch {
110
+ workspace.predictions = [];
86
111
  }
87
- const skillsDir = getSafePath(workspacePath, "skills");
88
- if (fs.existsSync(skillsDir)) {
89
- const files = await fs.promises.readdir(skillsDir);
90
- for (const file of files.filter((f) => f.endsWith(".md"))) {
91
- workspace.skills[file.replace(".md", "")] = await fs.promises.readFile(path.join(skillsDir, file), "utf-8");
92
- }
112
+ }
113
+ const skillsDir = getSafePath(workspacePath, "skills");
114
+ if (fs2.existsSync(skillsDir)) {
115
+ const files = await fs2.promises.readdir(skillsDir);
116
+ for (const file of files.filter((f) => f.endsWith(".md"))) {
117
+ workspace.skills[file.replace(".md", "")] = await fs2.promises.readFile(
118
+ path2.join(skillsDir, file),
119
+ "utf-8"
120
+ );
93
121
  }
94
- return workspace;
122
+ }
123
+ return workspace;
95
124
  }
96
- // ============================================================
97
- // Helper: Get workspace for current agent (multi-agent safe)
98
- // ============================================================
99
125
  function getWorkspace(runtime) {
100
- return workspaces.get(runtime.agentId) || null;
126
+ return workspaces.get(runtime.agentId) || null;
101
127
  }
102
- // ============================================================
103
- // Helper: Build context string for LLM
104
- // ============================================================
105
128
  function buildSkillContext(skillContent, workspace, userMessage, instructions) {
106
- return `You are an Undesirable AI agent with a unique personality.
129
+ return `You are an Undesirable AI agent with a unique personality.
107
130
 
108
131
  Your personality context:
109
132
  ${workspace.soulMd.slice(0, 1500)}
@@ -123,266 +146,307 @@ ${instructions}
123
146
 
124
147
  Respond in character using your archetype, risk tolerance, and guardrails.`;
125
148
  }
126
- // ============================================================
127
- // Helper: Generate response through LLM via runtime.generateText
128
- // ============================================================
129
149
  async function generateResponse(runtime, context, callback, actionName) {
130
- try {
131
- const result = await runtime.generateText(context);
132
- const text = typeof result === "string" ? result : result?.text || context;
133
- if (callback) {
134
- await callback({ text, source: "plugin-undesirables" }, actionName);
135
- }
136
- return { success: true, text };
150
+ try {
151
+ const result = await runtime.generateText(context);
152
+ const text = typeof result === "string" ? result : result?.text || context;
153
+ if (callback) {
154
+ await callback({ text, source: "plugin-undesirables" }, actionName);
137
155
  }
138
- catch {
139
- // Fallback: return context as-is if generateText unavailable
140
- if (callback) {
141
- await callback({ text: context, source: "plugin-undesirables" }, actionName);
142
- }
143
- return { success: true, text: context };
156
+ return { success: true, text };
157
+ } catch {
158
+ if (callback) {
159
+ await callback({ text: context, source: "plugin-undesirables" }, actionName);
144
160
  }
161
+ return { success: true, text: context };
162
+ }
145
163
  }
146
- // ============================================================
147
- // ACTIONS
148
- // ============================================================
149
- const marketAnalysisAction = {
150
- name: "UNDESIRABLE_MARKET_ANALYSIS",
151
- description: "Analyze a market, token, or trading pair using the Undesirable agent's unique personality-driven perspective and risk guardrails.",
152
- similes: [
153
- "ANALYZE_MARKET",
154
- "MARKET_OUTLOOK",
155
- "PRICE_ANALYSIS",
156
- "TRADING_VIEW",
157
- "WHAT_DO_YOU_THINK_ABOUT",
164
+ var marketAnalysisAction = {
165
+ name: "UNDESIRABLE_MARKET_ANALYSIS",
166
+ description: "Analyze a market, token, or trading pair using the Undesirable agent's unique personality-driven perspective and risk guardrails.",
167
+ similes: [
168
+ "ANALYZE_MARKET",
169
+ "MARKET_OUTLOOK",
170
+ "PRICE_ANALYSIS",
171
+ "TRADING_VIEW",
172
+ "WHAT_DO_YOU_THINK_ABOUT"
173
+ ],
174
+ parameters: [
175
+ {
176
+ name: "asset",
177
+ description: "The token, coin, or market to analyze (e.g., 'ETH', 'BTC', 'SOL', 'DOGE')",
178
+ required: true,
179
+ schema: { type: "string" }
180
+ }
181
+ ],
182
+ examples: [
183
+ [
184
+ { name: "{{user1}}", content: { text: "What do you think about ETH right now?" } },
185
+ { name: "{{agentName}}", content: { text: "Let me run my market analysis on ETH...", action: "UNDESIRABLE_MARKET_ANALYSIS" } }
158
186
  ],
159
- examples: [
160
- [
161
- {
162
- name: "{{user1}}",
163
- content: { text: "What do you think about ETH right now?" },
164
- },
165
- {
166
- name: "{{agentName}}",
167
- content: {
168
- text: "Let me run my market analysis on ETH...",
169
- action: "UNDESIRABLE_MARKET_ANALYSIS",
170
- },
171
- },
172
- ],
187
+ [
188
+ { name: "{{user1}}", content: { text: "Give me your take on Bitcoin" } },
189
+ { name: "{{agentName}}", content: { text: "Analyzing BTC through my lens...", action: "UNDESIRABLE_MARKET_ANALYSIS" } }
173
190
  ],
174
- validate: async (runtime, _message) => {
175
- return getWorkspace(runtime) !== null;
176
- },
177
- handler: async (runtime, message, _state, _options, callback) => {
178
- const workspace = getWorkspace(runtime);
179
- if (!workspace) {
180
- if (callback)
181
- await callback({ text: "No soul workspace loaded. Set UNDESIRABLES_WORKSPACE in your character.json settings." });
182
- return { success: false, error: "No soul workspace loaded" };
183
- }
184
- const skill = workspace.skills["market_analysis"] || "";
185
- const context = buildSkillContext(skill, workspace, message.content.text || "", "Provide a detailed market analysis with conviction score, risk assessment, and actionable levels.");
186
- return generateResponse(runtime, context, callback, "UNDESIRABLE_MARKET_ANALYSIS");
187
- },
191
+ [
192
+ { name: "{{user1}}", content: { text: "Is SOL a good buy here?" } },
193
+ { name: "{{agentName}}", content: { text: "Running personality-driven analysis on SOL...", action: "UNDESIRABLE_MARKET_ANALYSIS" } }
194
+ ]
195
+ ],
196
+ validate: async (runtime, _message) => {
197
+ return getWorkspace(runtime) !== null;
198
+ },
199
+ handler: async (runtime, message, _state, _options, callback) => {
200
+ const workspace = getWorkspace(runtime);
201
+ if (!workspace) {
202
+ if (callback) await callback({ text: "No soul workspace loaded. Set UNDESIRABLES_WORKSPACE in your character.json settings." });
203
+ return { success: false, text: "No soul workspace loaded", data: { resolution: "Set UNDESIRABLES_WORKSPACE env var to your downloaded workspace path" } };
204
+ }
205
+ const skill = workspace.skills["market_analysis"] || "";
206
+ const context = buildSkillContext(
207
+ skill,
208
+ workspace,
209
+ message.content.text || "",
210
+ "Provide a detailed market analysis with conviction score, risk assessment, and actionable levels."
211
+ );
212
+ return generateResponse(runtime, context, callback, "UNDESIRABLE_MARKET_ANALYSIS");
213
+ }
188
214
  };
189
- const businessPilotAction = {
190
- name: "UNDESIRABLE_BUSINESS_PILOT",
191
- description: "Use the Business Pilot skill to recommend and set up AI-powered business tools — phone answering, SMS, invoicing, scheduling, and 23+ modules.",
192
- similes: [
193
- "SETUP_BUSINESS",
194
- "PHONE_ANSWERING",
195
- "BUSINESS_AUTOMATION",
196
- "SMS_AUTORESPONDER",
197
- "INVOICE_CHASER",
215
+ var businessPilotAction = {
216
+ name: "UNDESIRABLE_BUSINESS_PILOT",
217
+ description: "Use the Business Pilot skill to recommend and set up AI-powered business tools \u2014 phone answering, SMS, invoicing, scheduling, and 23+ modules.",
218
+ similes: [
219
+ "SETUP_BUSINESS",
220
+ "PHONE_ANSWERING",
221
+ "BUSINESS_AUTOMATION",
222
+ "SMS_AUTORESPONDER",
223
+ "INVOICE_CHASER"
224
+ ],
225
+ parameters: [
226
+ {
227
+ name: "business_type",
228
+ description: "The type of business to set up automation for (e.g., 'barbershop', 'restaurant', 'consulting')",
229
+ required: true,
230
+ schema: { type: "string" }
231
+ },
232
+ {
233
+ name: "module",
234
+ description: "Specific module to set up (e.g., 'phone answering', 'SMS', 'invoicing')",
235
+ required: false,
236
+ schema: { type: "string" }
237
+ }
238
+ ],
239
+ examples: [
240
+ [
241
+ { name: "{{user1}}", content: { text: "I run a barbershop. Help me set up phone answering." } },
242
+ { name: "{{agentName}}", content: { text: "Loading Business Pilot skill for your barbershop...", action: "UNDESIRABLE_BUSINESS_PILOT" } }
198
243
  ],
199
- examples: [
200
- [
201
- {
202
- name: "{{user1}}",
203
- content: { text: "I run a barbershop. Help me set up phone answering." },
204
- },
205
- {
206
- name: "{{agentName}}",
207
- content: {
208
- text: "Loading Business Pilot skill for your barbershop...",
209
- action: "UNDESIRABLE_BUSINESS_PILOT",
210
- },
211
- },
212
- ],
244
+ [
245
+ { name: "{{user1}}", content: { text: "Set up automated SMS for my restaurant" } },
246
+ { name: "{{agentName}}", content: { text: "Configuring SMS autoresponder for your restaurant...", action: "UNDESIRABLE_BUSINESS_PILOT" } }
213
247
  ],
214
- validate: async (runtime, _message) => {
215
- const ws = getWorkspace(runtime);
216
- return ws !== null && "business_pilot" in (ws?.skills || {});
217
- },
218
- handler: async (runtime, message, _state, _options, callback) => {
219
- const workspace = getWorkspace(runtime);
220
- if (!workspace) {
221
- if (callback)
222
- await callback({ text: "No soul workspace loaded." });
223
- return { success: false, error: "No soul workspace loaded" };
224
- }
225
- const skill = workspace.skills["business_pilot"] || "";
226
- const context = buildSkillContext(skill, workspace, message.content.text || "", "Recommend the top 3-5 modules they should set up first with exact steps.");
227
- return generateResponse(runtime, context, callback, "UNDESIRABLE_BUSINESS_PILOT");
228
- },
248
+ [
249
+ { name: "{{user1}}", content: { text: "I need invoice automation for my freelance business" } },
250
+ { name: "{{agentName}}", content: { text: "Setting up invoice chaser module...", action: "UNDESIRABLE_BUSINESS_PILOT" } }
251
+ ]
252
+ ],
253
+ validate: async (runtime, _message) => {
254
+ const ws = getWorkspace(runtime);
255
+ return ws !== null && "business_pilot" in (ws?.skills || {});
256
+ },
257
+ handler: async (runtime, message, _state, _options, callback) => {
258
+ const workspace = getWorkspace(runtime);
259
+ if (!workspace) {
260
+ if (callback) await callback({ text: "No soul workspace loaded." });
261
+ return { success: false, error: "No soul workspace loaded" };
262
+ }
263
+ const skill = workspace.skills["business_pilot"] || "";
264
+ const context = buildSkillContext(
265
+ skill,
266
+ workspace,
267
+ message.content.text || "",
268
+ "Recommend the top 3-5 modules they should set up first with exact steps."
269
+ );
270
+ return generateResponse(runtime, context, callback, "UNDESIRABLE_BUSINESS_PILOT");
271
+ }
229
272
  };
230
- const memeMachineAction = {
231
- name: "UNDESIRABLE_MEME_MACHINE",
232
- description: "Generate memes, marketing content, content calendars, and viral social media assets using the Meme Machine skill.",
233
- similes: [
234
- "CREATE_MEME",
235
- "MEME_MARKETING",
236
- "CONTENT_CALENDAR",
237
- "VIRAL_CONTENT",
238
- "BRAND_VOICE",
273
+ var memeMachineAction = {
274
+ name: "UNDESIRABLE_MEME_MACHINE",
275
+ description: "Generate memes, marketing content, content calendars, and viral social media assets using the Meme Machine skill.",
276
+ similes: [
277
+ "CREATE_MEME",
278
+ "MEME_MARKETING",
279
+ "CONTENT_CALENDAR",
280
+ "VIRAL_CONTENT",
281
+ "BRAND_VOICE"
282
+ ],
283
+ parameters: [
284
+ {
285
+ name: "business_or_topic",
286
+ description: "The business, brand, or topic to create meme content for (e.g., 'barbershop', 'crypto', 'coffee shop')",
287
+ required: true,
288
+ schema: { type: "string" }
289
+ },
290
+ {
291
+ name: "platform",
292
+ description: "Target platform for the content (e.g., 'twitter', 'instagram', 'tiktok')",
293
+ required: false,
294
+ schema: { type: "string" }
295
+ }
296
+ ],
297
+ examples: [
298
+ [
299
+ { name: "{{user1}}", content: { text: "Create some memes for my barbershop" } },
300
+ { name: "{{agentName}}", content: { text: "Firing up the Meme Machine for barbershop content...", action: "UNDESIRABLE_MEME_MACHINE" } }
239
301
  ],
240
- examples: [
241
- [
242
- {
243
- name: "{{user1}}",
244
- content: { text: "Create some memes for my barbershop" },
245
- },
246
- {
247
- name: "{{agentName}}",
248
- content: {
249
- text: "Firing up the Meme Machine for barbershop content...",
250
- action: "UNDESIRABLE_MEME_MACHINE",
251
- },
252
- },
253
- ],
302
+ [
303
+ { name: "{{user1}}", content: { text: "I need viral Twitter content for my coffee brand" } },
304
+ { name: "{{agentName}}", content: { text: "Generating viral coffee brand content...", action: "UNDESIRABLE_MEME_MACHINE" } }
254
305
  ],
255
- validate: async (runtime, _message) => {
256
- const ws = getWorkspace(runtime);
257
- return ws !== null && "meme_machine" in (ws?.skills || {});
258
- },
259
- handler: async (runtime, message, _state, _options, callback) => {
260
- const workspace = getWorkspace(runtime);
261
- if (!workspace) {
262
- if (callback)
263
- await callback({ text: "No soul workspace loaded." });
264
- return { success: false, error: "No soul workspace loaded" };
265
- }
266
- const skill = workspace.skills["meme_machine"] || "";
267
- const context = buildSkillContext(skill, workspace, message.content.text || "", "Create 3 meme concepts with template, text, caption, and export size.");
268
- return generateResponse(runtime, context, callback, "UNDESIRABLE_MEME_MACHINE");
269
- },
306
+ [
307
+ { name: "{{user1}}", content: { text: "Make me a content calendar for this week" } },
308
+ { name: "{{agentName}}", content: { text: "Building your weekly content calendar...", action: "UNDESIRABLE_MEME_MACHINE" } }
309
+ ]
310
+ ],
311
+ validate: async (runtime, _message) => {
312
+ const ws = getWorkspace(runtime);
313
+ return ws !== null && "meme_machine" in (ws?.skills || {});
314
+ },
315
+ handler: async (runtime, message, _state, _options, callback) => {
316
+ const workspace = getWorkspace(runtime);
317
+ if (!workspace) {
318
+ if (callback) await callback({ text: "No soul workspace loaded." });
319
+ return { success: false, error: "No soul workspace loaded" };
320
+ }
321
+ const skill = workspace.skills["meme_machine"] || "";
322
+ const context = buildSkillContext(
323
+ skill,
324
+ workspace,
325
+ message.content.text || "",
326
+ "Create 3 meme concepts with template, text, caption, and export size."
327
+ );
328
+ return generateResponse(runtime, context, callback, "UNDESIRABLE_MEME_MACHINE");
329
+ }
270
330
  };
271
- const loadSkillAction = {
272
- name: "UNDESIRABLE_LOAD_SKILL",
273
- description: "Load and execute any of the 23 skills from the Undesirable soul workspace — market analysis, content creation, portfolio check, entry signals, exit strategy, whale tracking, snipe evaluation, and more.",
274
- similes: [
275
- "USE_SKILL",
276
- "RUN_SKILL",
277
- "EXECUTE_SKILL",
278
- "CHECK_PORTFOLIO",
279
- "CONTENT_CREATION",
280
- "ENTRY_SIGNAL",
281
- "EXIT_STRATEGY",
331
+ var loadSkillAction = {
332
+ name: "UNDESIRABLE_LOAD_SKILL",
333
+ description: "Load and execute any of the 34 tools from the Undesirable soul workspace \u2014 market analysis, content creation, portfolio check, entry signals, exit strategy, whale tracking, snipe evaluation, and more.",
334
+ similes: [
335
+ "USE_SKILL",
336
+ "RUN_SKILL",
337
+ "EXECUTE_SKILL",
338
+ "CHECK_PORTFOLIO",
339
+ "CONTENT_CREATION",
340
+ "ENTRY_SIGNAL",
341
+ "EXIT_STRATEGY"
342
+ ],
343
+ parameters: [
344
+ {
345
+ name: "skill_name",
346
+ description: "Name of the skill to load (e.g., 'check_portfolio', 'entry_signal', 'whale_tracker')",
347
+ required: false,
348
+ schema: { type: "string" }
349
+ }
350
+ ],
351
+ examples: [
352
+ [
353
+ { name: "{{user1}}", content: { text: "Check my portfolio" } },
354
+ { name: "{{agentName}}", content: { text: "Loading portfolio check skill...", action: "UNDESIRABLE_LOAD_SKILL" } }
282
355
  ],
283
- examples: [
284
- [
285
- {
286
- name: "{{user1}}",
287
- content: { text: "Check my portfolio" },
288
- },
289
- {
290
- name: "{{agentName}}",
291
- content: {
292
- text: "Loading portfolio check skill...",
293
- action: "UNDESIRABLE_LOAD_SKILL",
294
- },
295
- },
296
- ],
356
+ [
357
+ { name: "{{user1}}", content: { text: "Should I ape into this token?" } },
358
+ { name: "{{agentName}}", content: { text: "Running ape checklist analysis...", action: "UNDESIRABLE_LOAD_SKILL" } }
297
359
  ],
298
- validate: async (runtime, _message) => {
299
- return getWorkspace(runtime) !== null;
300
- },
301
- handler: async (runtime, message, _state, _options, callback) => {
302
- const workspace = getWorkspace(runtime);
303
- if (!workspace) {
304
- if (callback)
305
- await callback({ text: "No soul workspace loaded." });
306
- return { success: false, error: "No soul workspace loaded" };
307
- }
308
- const text = message.content.text?.toLowerCase() || "";
309
- let matchedSkill = "";
310
- let matchedName = "";
311
- // All 23 unique skills mapped with trigger words
312
- const skillMatches = {
313
- check_portfolio: ["portfolio", "balance", "holdings", "how am i doing"],
314
- content_creation: ["tweet", "write", "promote", "content", "thread"],
315
- conviction_score: ["conviction", "confidence", "how sure"],
316
- image_generation: ["image", "picture", "generate art"],
317
- music_generation: ["music", "song", "beat", "audio"],
318
- prediction_log: ["predict", "forecast", "call"],
319
- video_production: ["video", "promo", "cinematic", "render video", "edit video"],
320
- farm_yield: ["farm", "yield farming", "liquidity", "lp", "best yield"],
321
- compound_strategy: ["compound", "auto-compound", "compounding", "apy", "harvest"],
322
- risk_assessment: ["risk", "downside", "worst case", "is this safe"],
323
- snipe_launch: ["snipe", "new launch", "token launching", "just launched"],
324
- memecoin_scanner: ["memecoin", "find me a gem", "degen scan", "what memecoins"],
325
- ape_checklist: ["should i ape", "ape check", "is this a good ape"],
326
- whale_tracker: ["whale", "smart money", "whale watch", "what are whales buying"],
327
- copy_trade: ["copy trade", "mirror this", "follow this wallet"],
328
- position_sizing: ["position size", "how much should i buy", "how big"],
329
- volatility_scan: ["volatile", "volatility", "what's moving", "find volatile"],
330
- liquidation_watch: ["liquidation", "liquidation levels", "longs", "shorts"],
331
- mev_detect: ["mev", "sandwich", "front-running", "front run"],
332
- entry_signal: ["entry", "should i buy", "good time to buy", "buy signal"],
333
- exit_strategy: ["exit", "sell", "take profit", "stop loss", "when should i sell"],
334
- rebalance_check: ["rebalance", "allocation", "portfolio drift"],
335
- diversify_check: ["diversify", "diversification", "spread", "concentrate"],
336
- sector_rotation: ["sector", "rotation", "rotate", "cycle"],
337
- };
338
- for (const [skillName, triggers] of Object.entries(skillMatches)) {
339
- if (triggers.some((t) => text.includes(t)) && workspace.skills[skillName]) {
340
- matchedSkill = workspace.skills[skillName];
341
- matchedName = skillName;
342
- break;
343
- }
344
- }
345
- if (!matchedSkill) {
346
- const available = Object.keys(workspace.skills)
347
- .filter((k) => k !== "_index")
348
- .join(", ");
349
- if (callback) {
350
- await callback({
351
- text: `Available skills: ${available}. Tell me what you need and I'll load the right one.`,
352
- });
353
- }
354
- return { success: true, text: `Listed ${available.split(", ").length} available skills` };
355
- }
356
- const context = buildSkillContext(matchedSkill, workspace, message.content.text || "", `Execute the ${matchedName.replace(/_/g, " ")} skill thoroughly.`);
357
- return generateResponse(runtime, context, callback, "UNDESIRABLE_LOAD_SKILL");
358
- },
360
+ [
361
+ { name: "{{user1}}", content: { text: "What are whales buying right now?" } },
362
+ { name: "{{agentName}}", content: { text: "Activating whale tracker skill...", action: "UNDESIRABLE_LOAD_SKILL" } }
363
+ ]
364
+ ],
365
+ validate: async (runtime, _message) => {
366
+ return getWorkspace(runtime) !== null;
367
+ },
368
+ handler: async (runtime, message, _state, _options, callback) => {
369
+ const workspace = getWorkspace(runtime);
370
+ if (!workspace) {
371
+ if (callback) await callback({ text: "No soul workspace loaded." });
372
+ return { success: false, error: "No soul workspace loaded" };
373
+ }
374
+ const text = message.content.text?.toLowerCase() || "";
375
+ let matchedSkill = "";
376
+ let matchedName = "";
377
+ const skillMatches = {
378
+ check_portfolio: ["portfolio", "balance", "holdings", "how am i doing"],
379
+ content_creation: ["tweet", "write", "promote", "content", "thread"],
380
+ conviction_score: ["conviction", "confidence", "how sure"],
381
+ image_generation: ["image", "picture", "generate art"],
382
+ music_generation: ["music", "song", "beat", "audio"],
383
+ prediction_log: ["predict", "forecast", "call"],
384
+ video_production: ["video", "promo", "cinematic", "render video", "edit video"],
385
+ farm_yield: ["farm", "yield farming", "liquidity", "lp", "best yield"],
386
+ compound_strategy: ["compound", "auto-compound", "compounding", "apy", "harvest"],
387
+ risk_assessment: ["risk", "downside", "worst case", "is this safe"],
388
+ snipe_launch: ["snipe", "new launch", "token launching", "just launched"],
389
+ memecoin_scanner: ["memecoin", "find me a gem", "degen scan", "what memecoins"],
390
+ ape_checklist: ["should i ape", "ape check", "is this a good ape"],
391
+ whale_tracker: ["whale", "smart money", "whale watch", "what are whales buying"],
392
+ copy_trade: ["copy trade", "mirror this", "follow this wallet"],
393
+ position_sizing: ["position size", "how much should i buy", "how big"],
394
+ volatility_scan: ["volatile", "volatility", "what's moving", "find volatile"],
395
+ liquidation_watch: ["liquidation", "liquidation levels", "longs", "shorts"],
396
+ mev_detect: ["mev", "sandwich", "front-running", "front run"],
397
+ entry_signal: ["entry", "should i buy", "good time to buy", "buy signal"],
398
+ exit_strategy: ["exit", "sell", "take profit", "stop loss", "when should i sell"],
399
+ rebalance_check: ["rebalance", "allocation", "portfolio drift"],
400
+ diversify_check: ["diversify", "diversification", "spread", "concentrate"],
401
+ sector_rotation: ["sector", "rotation", "rotate", "cycle"]
402
+ };
403
+ for (const [skillName, triggers] of Object.entries(skillMatches)) {
404
+ if (triggers.some((t) => text.includes(t)) && workspace.skills[skillName]) {
405
+ matchedSkill = workspace.skills[skillName];
406
+ matchedName = skillName;
407
+ break;
408
+ }
409
+ }
410
+ if (!matchedSkill) {
411
+ const available = Object.keys(workspace.skills).filter((k) => k !== "_index").join(", ");
412
+ if (callback) {
413
+ await callback({
414
+ text: `Available skills: ${available}. Tell me what you need and I'll load the right one.`
415
+ });
416
+ }
417
+ return { success: true, text: `Listed ${available.split(", ").length} available skills` };
418
+ }
419
+ const context = buildSkillContext(
420
+ matchedSkill,
421
+ workspace,
422
+ message.content.text || "",
423
+ `Execute the ${matchedName.replace(/_/g, " ")} skill thoroughly.`
424
+ );
425
+ return generateResponse(runtime, context, callback, "UNDESIRABLE_LOAD_SKILL");
426
+ }
359
427
  };
360
- // ============================================================
361
- // PROVIDERS
362
- // ============================================================
363
- const soulProvider = {
364
- name: "undesirables-soul",
365
- description: "Injects Undesirable soul personality context into every agent response",
366
- get: async (runtime, _message, _state) => {
367
- // Load workspace if not already loaded for this agent
368
- if (!workspaces.has(runtime.agentId)) {
369
- const workspacePath = runtime.getSetting?.("UNDESIRABLES_WORKSPACE") ||
370
- process.env.UNDESIRABLES_WORKSPACE ||
371
- "";
372
- if (workspacePath && fs.existsSync(workspacePath)) {
373
- const loaded = await loadWorkspace(workspacePath);
374
- workspaces.set(runtime.agentId, loaded);
375
- console.log(`🐸 Loaded Undesirable soul: ${loaded.meta.name || "Unknown"} (agent: ${runtime.agentId})`);
376
- }
377
- }
378
- const workspace = getWorkspace(runtime);
379
- if (!workspace) {
380
- return {
381
- text: "No Undesirable soul workspace loaded. Set UNDESIRABLES_WORKSPACE env var to your downloaded workspace path.",
382
- };
383
- }
384
- return {
385
- text: `[SOUL CONTEXT]
428
+ var soulProvider = {
429
+ name: "undesirables-soul",
430
+ description: "Injects Undesirable soul personality context into every agent response",
431
+ get: async (runtime, _message, _state) => {
432
+ if (!workspaces.has(runtime.agentId)) {
433
+ const workspacePath = runtime.getSetting?.("UNDESIRABLES_WORKSPACE") || process.env.UNDESIRABLES_WORKSPACE || "";
434
+ if (workspacePath && fs2.existsSync(workspacePath)) {
435
+ const loaded = await loadWorkspace(workspacePath);
436
+ workspaces.set(runtime.agentId, loaded);
437
+ console.log(
438
+ `\u{1F438} Loaded Undesirable soul: ${loaded.meta.name || "Unknown"} (agent: ${runtime.agentId})`
439
+ );
440
+ }
441
+ }
442
+ const workspace = getWorkspace(runtime);
443
+ if (!workspace) {
444
+ return {
445
+ text: "No Undesirable soul workspace loaded. Set UNDESIRABLES_WORKSPACE env var to your downloaded workspace path."
446
+ };
447
+ }
448
+ return {
449
+ text: `[SOUL CONTEXT]
386
450
  Name: ${workspace.meta.name || "Unknown Undesirable"}
387
451
  Archetype: ${workspace.meta.archetype || "Unknown"}
388
452
  Strategy: ${workspace.meta.strategy || "Unknown"}
@@ -394,35 +458,41 @@ Predictions: ${workspace.predictions.length}
394
458
  Personality: ${(workspace.meta.adjectives || []).join(", ")}
395
459
 
396
460
  The agent should respond using the personality and style defined in its soul.
397
- Collection: The Undesirables — 4,444 autonomous AI agents on Ethereum.
461
+ Collection: The Undesirables \u2014 4,444 autonomous AI agents on Ethereum.
398
462
  Website: https://the-undesirables.com`,
399
- values: {
400
- soulName: workspace.meta.name || "Unknown",
401
- archetype: workspace.meta.archetype || "Unknown",
402
- strategy: workspace.meta.strategy || "Unknown",
403
- tokenId: workspace.meta.token_id || "?",
404
- },
405
- };
406
- },
463
+ values: {
464
+ soulName: workspace.meta.name || "Unknown",
465
+ archetype: workspace.meta.archetype || "Unknown",
466
+ strategy: workspace.meta.strategy || "Unknown",
467
+ tokenId: workspace.meta.token_id || "?"
468
+ }
469
+ };
470
+ }
407
471
  };
408
- // ============================================================
409
- // PLUGIN EXPORT
410
- // ============================================================
411
- const undesirablePlugin = {
412
- name: "plugin-undesirables",
413
- description: "The Undesirables — 4,444 autonomous AI agents on Ethereum. " +
414
- "Pioneers 'Personality-as-Code' via verifiable soul workspaces. " +
415
- "Adds soul personality, market analysis, Business Pilot (23 modules), " +
416
- "Meme Machine, and 23 skills to any ElizaOS agent.",
417
- actions: [
418
- marketAnalysisAction,
419
- businessPilotAction,
420
- memeMachineAction,
421
- loadSkillAction,
422
- ],
423
- providers: [soulProvider],
424
- evaluators: [],
472
+ var undesirablePlugin = {
473
+ name: "plugin-undesirables",
474
+ description: "The Undesirables \u2014 4,444 autonomous AI agents on Ethereum. Pioneers 'Personality-as-Code' via verifiable soul workspaces. Adds soul personality, market analysis, Business Pilot (23 modules), Meme Machine, and 34 tools to any ElizaOS agent.",
475
+ init: async (config, runtime) => {
476
+ const validation = validateUndesirableConfig(runtime);
477
+ if (!validation.valid) {
478
+ console.warn(`\u26A0\uFE0F Undesirables: ${validation.error}`);
479
+ } else {
480
+ console.log(`\u{1F438} Undesirable soul workspace loaded: ${validation.workspacePath}`);
481
+ }
482
+ },
483
+ actions: [
484
+ marketAnalysisAction,
485
+ businessPilotAction,
486
+ memeMachineAction,
487
+ loadSkillAction
488
+ ],
489
+ providers: [soulProvider],
490
+ evaluators: [],
491
+ services: [MemeTrendService]
492
+ };
493
+ var index_default = undesirablePlugin;
494
+ export {
495
+ index_default as default,
496
+ loadWorkspace
425
497
  };
426
- export default undesirablePlugin;
427
- export { loadWorkspace };
428
498
  //# sourceMappingURL=index.js.map