@elizaos/plugin-action-bench 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +240 -1
- package/dist/index.cjs +845 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +845 -4
- package/dist/index.js.map +1 -1
- package/package.json +8 -3
package/dist/index.js
CHANGED
@@ -48,14 +48,855 @@ function createLetterAction(letter) {
|
|
48
48
|
}
|
49
49
|
var typewriterActions = "abcdefghijklmnopqrstuvwxyz".split("").map(createLetterAction);
|
50
50
|
|
51
|
+
// src/actions/multiverseMath.ts
|
52
|
+
function generateMultiverseSeed(a, b) {
|
53
|
+
const seed = (a * 73 + b * 37) % 1e3;
|
54
|
+
return Math.abs(seed);
|
55
|
+
}
|
56
|
+
function isPrime(n) {
|
57
|
+
if (n <= 1) return false;
|
58
|
+
if (n <= 3) return true;
|
59
|
+
if (n % 2 === 0 || n % 3 === 0) return false;
|
60
|
+
for (let i = 5; i * i <= n; i += 6) {
|
61
|
+
if (n % i === 0 || n % (i + 2) === 0) return false;
|
62
|
+
}
|
63
|
+
return true;
|
64
|
+
}
|
65
|
+
function findNextPrime(n) {
|
66
|
+
if (n < 2) return 2;
|
67
|
+
let candidate = Math.ceil(n);
|
68
|
+
while (!isPrime(candidate)) {
|
69
|
+
candidate++;
|
70
|
+
}
|
71
|
+
return candidate;
|
72
|
+
}
|
73
|
+
function findNearestFibonacci(n) {
|
74
|
+
const fibSeq = [0, 1];
|
75
|
+
while (fibSeq[fibSeq.length - 1] < Math.abs(n)) {
|
76
|
+
fibSeq.push(fibSeq[fibSeq.length - 1] + fibSeq[fibSeq.length - 2]);
|
77
|
+
}
|
78
|
+
const lastFib = fibSeq[fibSeq.length - 1];
|
79
|
+
const prevFib = fibSeq[fibSeq.length - 2];
|
80
|
+
return Math.abs(n - lastFib) < Math.abs(n - prevFib) ? lastFib : prevFib;
|
81
|
+
}
|
82
|
+
function getStateValue(state, key, defaultValue = 0) {
|
83
|
+
const value = state?.values?.[key];
|
84
|
+
if (typeof value === "number") return value;
|
85
|
+
if (typeof value === "string") {
|
86
|
+
const parsed = parseFloat(value);
|
87
|
+
return isNaN(parsed) ? defaultValue : parsed;
|
88
|
+
}
|
89
|
+
return defaultValue;
|
90
|
+
}
|
91
|
+
function createNumberAction(digit) {
|
92
|
+
return {
|
93
|
+
name: `INPUT_${digit}`,
|
94
|
+
similes: [`INPUT_${digit}`, `TYPE_${digit}`, `ENTER_${digit}`],
|
95
|
+
description: `Input the number ${digit} into the current calculation buffer.`,
|
96
|
+
validate: async () => true,
|
97
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
98
|
+
const currentBuffer = getStateValue(state, "inputBuffer", 0);
|
99
|
+
const newBuffer = currentBuffer * 10 + digit;
|
100
|
+
if (callback) {
|
101
|
+
await callback({
|
102
|
+
text: `Input: ${newBuffer}`,
|
103
|
+
source: message.content.source
|
104
|
+
});
|
105
|
+
}
|
106
|
+
return {
|
107
|
+
success: true,
|
108
|
+
text: `Input: ${newBuffer}`,
|
109
|
+
values: {
|
110
|
+
inputBuffer: newBuffer,
|
111
|
+
lastInput: digit
|
112
|
+
},
|
113
|
+
data: {
|
114
|
+
digit,
|
115
|
+
buffer: newBuffer
|
116
|
+
}
|
117
|
+
};
|
118
|
+
},
|
119
|
+
examples: [
|
120
|
+
[
|
121
|
+
{
|
122
|
+
name: "{{user}}",
|
123
|
+
content: { text: `input ${digit}` }
|
124
|
+
},
|
125
|
+
{
|
126
|
+
name: "{{agent}}",
|
127
|
+
content: {
|
128
|
+
text: `Input: ${digit}`,
|
129
|
+
actions: [`INPUT_${digit}`]
|
130
|
+
}
|
131
|
+
}
|
132
|
+
]
|
133
|
+
]
|
134
|
+
};
|
135
|
+
}
|
136
|
+
var selectDimensionAction = {
|
137
|
+
name: "SELECT_DIMENSION",
|
138
|
+
similes: ["DIMENSION", "SET_DIMENSION", "CHOOSE_DIMENSION"],
|
139
|
+
description: "Select the dimensional constant that affects how mathematical operations behave in the multiverse.",
|
140
|
+
validate: async () => true,
|
141
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
142
|
+
const content = message.content.text?.toLowerCase() || "";
|
143
|
+
let dimension = "standard";
|
144
|
+
if (content.includes("quantum")) dimension = "quantum";
|
145
|
+
else if (content.includes("chaos")) dimension = "chaos";
|
146
|
+
else if (content.includes("prime")) dimension = "prime";
|
147
|
+
else if (content.includes("mirror")) dimension = "mirror";
|
148
|
+
else if (content.includes("void")) dimension = "void";
|
149
|
+
else if (content.includes("absolute")) dimension = "absolute";
|
150
|
+
else if (content.includes("fibonacci")) dimension = "fibonacci";
|
151
|
+
else if (content.includes("exponential")) dimension = "exponential";
|
152
|
+
else if (content.includes("harmonic")) dimension = "harmonic";
|
153
|
+
else if (content.includes("infinite")) dimension = "infinite";
|
154
|
+
else if (content.includes("golden")) dimension = "golden";
|
155
|
+
else if (content.includes("spiral")) dimension = "spiral";
|
156
|
+
else if (content.includes("fractal")) dimension = "fractal";
|
157
|
+
else if (content.includes("cyclical")) dimension = "cyclical";
|
158
|
+
const text = `Dimension set to: ${dimension}`;
|
159
|
+
if (callback) {
|
160
|
+
await callback({ text, source: message.content.source });
|
161
|
+
}
|
162
|
+
return {
|
163
|
+
success: true,
|
164
|
+
text,
|
165
|
+
values: {
|
166
|
+
...state?.values,
|
167
|
+
dimension
|
168
|
+
},
|
169
|
+
data: {
|
170
|
+
dimension
|
171
|
+
}
|
172
|
+
};
|
173
|
+
},
|
174
|
+
examples: [
|
175
|
+
[
|
176
|
+
{
|
177
|
+
name: "{{user}}",
|
178
|
+
content: { text: "set dimension to quantum" }
|
179
|
+
},
|
180
|
+
{
|
181
|
+
name: "{{agent}}",
|
182
|
+
content: {
|
183
|
+
text: "Dimension set to: quantum",
|
184
|
+
actions: ["SELECT_DIMENSION"]
|
185
|
+
}
|
186
|
+
}
|
187
|
+
]
|
188
|
+
]
|
189
|
+
};
|
190
|
+
var multiverseAddAction = {
|
191
|
+
name: "MULTIVERSE_ADD",
|
192
|
+
similes: ["M_ADD", "MULTI_ADD", "DIMENSIONAL_ADD"],
|
193
|
+
description: "Performs addition in the multiverse where numbers behave differently based on dimensional constants (prime, quantum, or chaos).",
|
194
|
+
validate: async () => true,
|
195
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
196
|
+
const a = getStateValue(state, "accumulator", 0);
|
197
|
+
const b = getStateValue(state, "inputBuffer", 0);
|
198
|
+
const dimension = state?.values?.dimension || "prime";
|
199
|
+
let result;
|
200
|
+
let explanation;
|
201
|
+
switch (dimension) {
|
202
|
+
case "quantum":
|
203
|
+
result = a + b + Math.sqrt(Math.abs(a * b));
|
204
|
+
explanation = `In quantum dimension: ${a} + ${b} = ${result} (includes quantum entanglement factor \u221A(${a}\xD7${b}))`;
|
205
|
+
break;
|
206
|
+
case "chaos":
|
207
|
+
const seed = generateMultiverseSeed(a, b);
|
208
|
+
result = a + b + seed % 10;
|
209
|
+
explanation = `In chaos dimension: ${a} + ${b} = ${result} (chaos factor: ${seed % 10})`;
|
210
|
+
break;
|
211
|
+
case "prime":
|
212
|
+
default:
|
213
|
+
const standardResult = a + b;
|
214
|
+
const nextPrime = findNextPrime(Math.abs(standardResult));
|
215
|
+
result = standardResult < 0 ? -nextPrime : nextPrime;
|
216
|
+
explanation = `In prime dimension: ${a} + ${b} = ${result} (elevated to nearest prime from ${standardResult})`;
|
217
|
+
break;
|
218
|
+
}
|
219
|
+
result = Math.round(result * 1e3) / 1e3;
|
220
|
+
if (callback) {
|
221
|
+
await callback({ text: explanation, source: message.content.source });
|
222
|
+
}
|
223
|
+
return {
|
224
|
+
success: true,
|
225
|
+
text: explanation,
|
226
|
+
values: {
|
227
|
+
accumulator: result,
|
228
|
+
inputBuffer: 0,
|
229
|
+
lastOperation: "multiverse_add",
|
230
|
+
dimension,
|
231
|
+
history: [...state?.values?.history || [], explanation]
|
232
|
+
},
|
233
|
+
data: {
|
234
|
+
operation: "multiverse_add",
|
235
|
+
inputs: { a, b, dimension },
|
236
|
+
result,
|
237
|
+
explanation,
|
238
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
239
|
+
}
|
240
|
+
};
|
241
|
+
},
|
242
|
+
examples: [
|
243
|
+
[
|
244
|
+
{
|
245
|
+
name: "{{user}}",
|
246
|
+
content: { text: "add in quantum dimension" }
|
247
|
+
},
|
248
|
+
{
|
249
|
+
name: "{{agent}}",
|
250
|
+
content: {
|
251
|
+
text: "In quantum dimension: 0 + 0 = 0 (includes quantum entanglement factor \u221A(0\xD70))",
|
252
|
+
actions: ["MULTIVERSE_ADD"]
|
253
|
+
}
|
254
|
+
}
|
255
|
+
]
|
256
|
+
]
|
257
|
+
};
|
258
|
+
var multiverseSubtractAction = {
|
259
|
+
name: "MULTIVERSE_SUBTRACT",
|
260
|
+
similes: ["M_SUBTRACT", "MULTI_SUB", "DIMENSIONAL_SUBTRACT"],
|
261
|
+
description: "Performs subtraction in the multiverse where negative numbers might not exist in some dimensions (absolute, mirror, or void).",
|
262
|
+
validate: async () => true,
|
263
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
264
|
+
const a = getStateValue(state, "accumulator", 0);
|
265
|
+
const b = getStateValue(state, "inputBuffer", 0);
|
266
|
+
const dimension = state?.values?.dimension || "absolute";
|
267
|
+
let result;
|
268
|
+
let explanation;
|
269
|
+
switch (dimension) {
|
270
|
+
case "mirror":
|
271
|
+
result = Math.abs(a - b) * (a > b ? 1 : -1) * 2;
|
272
|
+
explanation = `In mirror dimension: ${a} - ${b} = ${result} (reflected subtraction)`;
|
273
|
+
break;
|
274
|
+
case "void":
|
275
|
+
result = Math.abs(a - b) + Math.min(a, b);
|
276
|
+
explanation = `In void dimension: ${a} - ${b} = ${result} (void compensation: +${Math.min(a, b)})`;
|
277
|
+
break;
|
278
|
+
case "absolute":
|
279
|
+
default:
|
280
|
+
result = Math.abs(a - b);
|
281
|
+
explanation = `In absolute dimension: ${a} - ${b} = ${result} (absolute value universe)`;
|
282
|
+
break;
|
283
|
+
}
|
284
|
+
result = Math.round(result * 1e3) / 1e3;
|
285
|
+
if (callback) {
|
286
|
+
await callback({ text: explanation, source: message.content.source });
|
287
|
+
}
|
288
|
+
return {
|
289
|
+
success: true,
|
290
|
+
text: explanation,
|
291
|
+
values: {
|
292
|
+
accumulator: result,
|
293
|
+
inputBuffer: 0,
|
294
|
+
lastOperation: "multiverse_subtract",
|
295
|
+
dimension,
|
296
|
+
history: [...state?.values?.history || [], explanation]
|
297
|
+
},
|
298
|
+
data: {
|
299
|
+
operation: "multiverse_subtract",
|
300
|
+
inputs: { a, b, dimension },
|
301
|
+
result,
|
302
|
+
explanation,
|
303
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
304
|
+
}
|
305
|
+
};
|
306
|
+
},
|
307
|
+
examples: [
|
308
|
+
[
|
309
|
+
{
|
310
|
+
name: "{{user}}",
|
311
|
+
content: { text: "subtract in mirror dimension" }
|
312
|
+
},
|
313
|
+
{
|
314
|
+
name: "{{agent}}",
|
315
|
+
content: {
|
316
|
+
text: "In mirror dimension: 0 - 0 = 0 (reflected subtraction)",
|
317
|
+
actions: ["MULTIVERSE_SUBTRACT"]
|
318
|
+
}
|
319
|
+
}
|
320
|
+
]
|
321
|
+
]
|
322
|
+
};
|
323
|
+
var multiverseMultiplyAction = {
|
324
|
+
name: "MULTIVERSE_MULTIPLY",
|
325
|
+
similes: ["M_MULTIPLY", "MULTI_MUL", "DIMENSIONAL_MULTIPLY"],
|
326
|
+
description: "Performs multiplication across dimensional boundaries with exotic number behaviors (fibonacci, exponential, or harmonic).",
|
327
|
+
validate: async () => true,
|
328
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
329
|
+
const a = getStateValue(state, "accumulator", 1);
|
330
|
+
const b = getStateValue(state, "inputBuffer", 1);
|
331
|
+
const dimension = state?.values?.dimension || "fibonacci";
|
332
|
+
let result;
|
333
|
+
let explanation;
|
334
|
+
switch (dimension) {
|
335
|
+
case "exponential":
|
336
|
+
result = Math.pow(Math.abs(a), Math.abs(b)) * (a < 0 || b < 0 ? -1 : 1);
|
337
|
+
explanation = `In exponential dimension: ${a} \xD7 ${b} = ${result} (actually ${a}^${b})`;
|
338
|
+
break;
|
339
|
+
case "harmonic":
|
340
|
+
const harmonic = a * b + (a + b) / 2;
|
341
|
+
result = harmonic;
|
342
|
+
explanation = `In harmonic dimension: ${a} \xD7 ${b} = ${result} (includes harmonic mean)`;
|
343
|
+
break;
|
344
|
+
case "fibonacci":
|
345
|
+
default:
|
346
|
+
const standard = a * b;
|
347
|
+
result = findNearestFibonacci(standard) * (standard < 0 ? -1 : 1);
|
348
|
+
explanation = `In fibonacci dimension: ${a} \xD7 ${b} = ${result} (nearest Fibonacci to ${standard})`;
|
349
|
+
break;
|
350
|
+
}
|
351
|
+
result = Math.round(result * 1e3) / 1e3;
|
352
|
+
if (callback) {
|
353
|
+
await callback({ text: explanation, source: message.content.source });
|
354
|
+
}
|
355
|
+
return {
|
356
|
+
success: true,
|
357
|
+
text: explanation,
|
358
|
+
values: {
|
359
|
+
accumulator: result,
|
360
|
+
inputBuffer: 0,
|
361
|
+
lastOperation: "multiverse_multiply",
|
362
|
+
dimension,
|
363
|
+
history: [...state?.values?.history || [], explanation]
|
364
|
+
},
|
365
|
+
data: {
|
366
|
+
operation: "multiverse_multiply",
|
367
|
+
inputs: { a, b, dimension },
|
368
|
+
result,
|
369
|
+
explanation,
|
370
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
371
|
+
}
|
372
|
+
};
|
373
|
+
},
|
374
|
+
examples: [
|
375
|
+
[
|
376
|
+
{
|
377
|
+
name: "{{user}}",
|
378
|
+
content: { text: "multiply in exponential dimension" }
|
379
|
+
},
|
380
|
+
{
|
381
|
+
name: "{{agent}}",
|
382
|
+
content: {
|
383
|
+
text: "In exponential dimension: 1 \xD7 1 = 1 (actually 1^1)",
|
384
|
+
actions: ["MULTIVERSE_MULTIPLY"]
|
385
|
+
}
|
386
|
+
}
|
387
|
+
]
|
388
|
+
]
|
389
|
+
};
|
390
|
+
var multiverseDivideAction = {
|
391
|
+
name: "MULTIVERSE_DIVIDE",
|
392
|
+
similes: ["M_DIVIDE", "MULTI_DIV", "DIMENSIONAL_DIVIDE"],
|
393
|
+
description: "Performs division in the multiverse where infinity and zero have special meanings (safe, infinite, or golden).",
|
394
|
+
validate: async () => true,
|
395
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
396
|
+
const a = getStateValue(state, "accumulator", 0);
|
397
|
+
const b = getStateValue(state, "inputBuffer", 1);
|
398
|
+
const dimension = state?.values?.dimension || "safe";
|
399
|
+
let result;
|
400
|
+
let explanation;
|
401
|
+
switch (dimension) {
|
402
|
+
case "infinite":
|
403
|
+
if (b === 0) {
|
404
|
+
result = a * 999;
|
405
|
+
explanation = `In infinite dimension: ${a} \xF7 0 = ${result} (portal opened!)`;
|
406
|
+
} else {
|
407
|
+
result = a / b * Math.PI;
|
408
|
+
explanation = `In infinite dimension: ${a} \xF7 ${b} = ${result} (\u03C0-scaled)`;
|
409
|
+
}
|
410
|
+
break;
|
411
|
+
case "golden":
|
412
|
+
const goldenRatio = 1.618033988749895;
|
413
|
+
const standard = b === 0 ? 0 : a / b;
|
414
|
+
result = (standard + goldenRatio) / 2;
|
415
|
+
explanation = `In golden dimension: ${a} \xF7 ${b} = ${result} (converging to \u03C6)`;
|
416
|
+
break;
|
417
|
+
case "safe":
|
418
|
+
default:
|
419
|
+
result = b === 0 ? a : a / b;
|
420
|
+
explanation = b === 0 ? `In safe dimension: ${a} \xF7 0 = ${a} (safe division, returns dividend)` : `In safe dimension: ${a} \xF7 ${b} = ${result} (standard division)`;
|
421
|
+
break;
|
422
|
+
}
|
423
|
+
result = Math.round(result * 1e3) / 1e3;
|
424
|
+
if (callback) {
|
425
|
+
await callback({ text: explanation, source: message.content.source });
|
426
|
+
}
|
427
|
+
return {
|
428
|
+
success: true,
|
429
|
+
text: explanation,
|
430
|
+
values: {
|
431
|
+
accumulator: result,
|
432
|
+
inputBuffer: 0,
|
433
|
+
lastOperation: "multiverse_divide",
|
434
|
+
dimension,
|
435
|
+
history: [...state?.values?.history || [], explanation]
|
436
|
+
},
|
437
|
+
data: {
|
438
|
+
operation: "multiverse_divide",
|
439
|
+
inputs: { a, b, dimension },
|
440
|
+
result,
|
441
|
+
explanation,
|
442
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
443
|
+
}
|
444
|
+
};
|
445
|
+
},
|
446
|
+
examples: [
|
447
|
+
[
|
448
|
+
{
|
449
|
+
name: "{{user}}",
|
450
|
+
content: { text: "divide in golden dimension" }
|
451
|
+
},
|
452
|
+
{
|
453
|
+
name: "{{agent}}",
|
454
|
+
content: {
|
455
|
+
text: "In golden dimension: 0 \xF7 1 = 0.809 (converging to \u03C6)",
|
456
|
+
actions: ["MULTIVERSE_DIVIDE"]
|
457
|
+
}
|
458
|
+
}
|
459
|
+
]
|
460
|
+
]
|
461
|
+
};
|
462
|
+
var multiverseModuloAction = {
|
463
|
+
name: "MULTIVERSE_MODULO",
|
464
|
+
similes: ["M_MODULO", "MULTI_MOD", "DIMENSIONAL_MODULO"],
|
465
|
+
description: "Performs modulo operation in the multiverse with cyclical dimensional properties (cyclical, spiral, or fractal).",
|
466
|
+
validate: async (_runtime, _message, state) => {
|
467
|
+
const b = getStateValue(state, "inputBuffer", 1);
|
468
|
+
return b !== 0;
|
469
|
+
},
|
470
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
471
|
+
const a = getStateValue(state, "accumulator", 0);
|
472
|
+
const b = getStateValue(state, "inputBuffer", 1);
|
473
|
+
const dimension = state?.values?.dimension || "cyclical";
|
474
|
+
let result;
|
475
|
+
let explanation;
|
476
|
+
if (b === 0) {
|
477
|
+
return {
|
478
|
+
success: false,
|
479
|
+
text: "Error: Cannot modulo by zero",
|
480
|
+
values: state?.values || {}
|
481
|
+
};
|
482
|
+
}
|
483
|
+
switch (dimension) {
|
484
|
+
case "spiral":
|
485
|
+
const spiralFactor = Math.sin(a) * Math.cos(b);
|
486
|
+
result = Math.abs(a % b + spiralFactor * 10);
|
487
|
+
explanation = `In spiral dimension: ${a} % ${b} = ${result} (spiral factor: ${spiralFactor.toFixed(2)})`;
|
488
|
+
break;
|
489
|
+
case "fractal":
|
490
|
+
const iterations = 3;
|
491
|
+
result = a % b;
|
492
|
+
for (let i = 0; i < iterations; i++) {
|
493
|
+
result = result * 2 % (b + i);
|
494
|
+
}
|
495
|
+
explanation = `In fractal dimension: ${a} % ${b} = ${result} (after ${iterations} fractal iterations)`;
|
496
|
+
break;
|
497
|
+
case "cyclical":
|
498
|
+
default:
|
499
|
+
result = a % b;
|
500
|
+
if (result < 0) result += b;
|
501
|
+
explanation = `In cyclical dimension: ${a} % ${b} = ${result} (perfect cycle)`;
|
502
|
+
break;
|
503
|
+
}
|
504
|
+
result = Math.round(result * 100) / 100;
|
505
|
+
if (callback) {
|
506
|
+
await callback({ text: explanation, source: message.content.source });
|
507
|
+
}
|
508
|
+
return {
|
509
|
+
success: true,
|
510
|
+
text: explanation,
|
511
|
+
values: {
|
512
|
+
accumulator: result,
|
513
|
+
inputBuffer: 0,
|
514
|
+
lastOperation: "multiverse_modulo",
|
515
|
+
dimension,
|
516
|
+
history: [...state?.values?.history || [], explanation]
|
517
|
+
},
|
518
|
+
data: {
|
519
|
+
operation: "multiverse_modulo",
|
520
|
+
inputs: { a, b, dimension },
|
521
|
+
result,
|
522
|
+
explanation,
|
523
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
524
|
+
}
|
525
|
+
};
|
526
|
+
},
|
527
|
+
examples: [
|
528
|
+
[
|
529
|
+
{
|
530
|
+
name: "{{user}}",
|
531
|
+
content: { text: "modulo in fractal dimension" }
|
532
|
+
},
|
533
|
+
{
|
534
|
+
name: "{{agent}}",
|
535
|
+
content: {
|
536
|
+
text: "In fractal dimension: 0 % 1 = 0 (after 3 fractal iterations)",
|
537
|
+
actions: ["MULTIVERSE_MODULO"]
|
538
|
+
}
|
539
|
+
}
|
540
|
+
]
|
541
|
+
]
|
542
|
+
};
|
543
|
+
var multiversePowerAction = {
|
544
|
+
name: "MULTIVERSE_POWER",
|
545
|
+
similes: ["M_POWER", "MULTI_POW", "DIMENSIONAL_POWER"],
|
546
|
+
description: "Raises numbers to powers in the multiverse with dimensional effects (standard, imaginary, or recursive).",
|
547
|
+
validate: async () => true,
|
548
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
549
|
+
const a = getStateValue(state, "accumulator", 0);
|
550
|
+
const b = getStateValue(state, "inputBuffer", 2);
|
551
|
+
const dimension = state?.values?.dimension || "standard";
|
552
|
+
let result;
|
553
|
+
let explanation;
|
554
|
+
switch (dimension) {
|
555
|
+
case "imaginary":
|
556
|
+
const oscillation = Math.cos(b * Math.PI / 2);
|
557
|
+
result = Math.pow(Math.abs(a), b) * oscillation;
|
558
|
+
explanation = `In imaginary dimension: ${a}^${b} = ${result} (oscillation factor: ${oscillation.toFixed(2)})`;
|
559
|
+
break;
|
560
|
+
case "recursive":
|
561
|
+
result = a;
|
562
|
+
for (let i = 0; i < Math.min(Math.abs(b), 5); i++) {
|
563
|
+
result = Math.pow(result, 1.5);
|
564
|
+
}
|
565
|
+
explanation = `In recursive dimension: ${a}^${b} = ${result} (${Math.min(Math.abs(b), 5)} recursive applications)`;
|
566
|
+
break;
|
567
|
+
case "standard":
|
568
|
+
default:
|
569
|
+
result = Math.pow(a, b);
|
570
|
+
explanation = `In standard dimension: ${a}^${b} = ${result}`;
|
571
|
+
break;
|
572
|
+
}
|
573
|
+
result = Math.round(result * 1e3) / 1e3;
|
574
|
+
if (callback) {
|
575
|
+
await callback({ text: explanation, source: message.content.source });
|
576
|
+
}
|
577
|
+
return {
|
578
|
+
success: true,
|
579
|
+
text: explanation,
|
580
|
+
values: {
|
581
|
+
accumulator: result,
|
582
|
+
inputBuffer: 0,
|
583
|
+
lastOperation: "multiverse_power",
|
584
|
+
dimension,
|
585
|
+
history: [...state?.values?.history || [], explanation]
|
586
|
+
},
|
587
|
+
data: {
|
588
|
+
operation: "multiverse_power",
|
589
|
+
inputs: { a, b, dimension },
|
590
|
+
result,
|
591
|
+
explanation,
|
592
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
593
|
+
}
|
594
|
+
};
|
595
|
+
},
|
596
|
+
examples: [
|
597
|
+
[
|
598
|
+
{
|
599
|
+
name: "{{user}}",
|
600
|
+
content: { text: "power in imaginary dimension" }
|
601
|
+
},
|
602
|
+
{
|
603
|
+
name: "{{agent}}",
|
604
|
+
content: {
|
605
|
+
text: "In imaginary dimension: 0^2 = 0 (oscillation factor: -1.00)",
|
606
|
+
actions: ["MULTIVERSE_POWER"]
|
607
|
+
}
|
608
|
+
}
|
609
|
+
]
|
610
|
+
]
|
611
|
+
};
|
612
|
+
var multiverseSqrtAction = {
|
613
|
+
name: "MULTIVERSE_SQRT",
|
614
|
+
similes: ["M_SQRT", "MULTI_ROOT", "DIMENSIONAL_SQRT"],
|
615
|
+
description: "Takes square root in the multiverse with dimensional variations (positive, complex, or quantum).",
|
616
|
+
validate: async () => true,
|
617
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
618
|
+
const a = getStateValue(state, "accumulator", 0);
|
619
|
+
const dimension = state?.values?.dimension || "positive";
|
620
|
+
let result;
|
621
|
+
let explanation;
|
622
|
+
switch (dimension) {
|
623
|
+
case "complex":
|
624
|
+
result = Math.sqrt(Math.abs(a));
|
625
|
+
if (a < 0) {
|
626
|
+
explanation = `In complex dimension: \u221A${a} = ${result}i (imaginary component)`;
|
627
|
+
} else {
|
628
|
+
explanation = `In complex dimension: \u221A${a} = ${result} (real component)`;
|
629
|
+
}
|
630
|
+
break;
|
631
|
+
case "quantum":
|
632
|
+
const superposition = Math.sqrt(Math.abs(a)) + (Math.random() - 0.5) * 0.1;
|
633
|
+
result = Math.abs(superposition);
|
634
|
+
explanation = `In quantum dimension: \u221A${a} = ${result} (quantum fluctuation)`;
|
635
|
+
break;
|
636
|
+
case "positive":
|
637
|
+
default:
|
638
|
+
result = Math.sqrt(Math.abs(a));
|
639
|
+
explanation = `In positive dimension: \u221A${a} = ${result} (absolute square root)`;
|
640
|
+
break;
|
641
|
+
}
|
642
|
+
result = Math.round(result * 1e3) / 1e3;
|
643
|
+
if (callback) {
|
644
|
+
await callback({ text: explanation, source: message.content.source });
|
645
|
+
}
|
646
|
+
return {
|
647
|
+
success: true,
|
648
|
+
text: explanation,
|
649
|
+
values: {
|
650
|
+
accumulator: result,
|
651
|
+
lastOperation: "multiverse_sqrt",
|
652
|
+
dimension,
|
653
|
+
history: [...state?.values?.history || [], explanation]
|
654
|
+
},
|
655
|
+
data: {
|
656
|
+
operation: "multiverse_sqrt",
|
657
|
+
inputs: { a, dimension },
|
658
|
+
result,
|
659
|
+
explanation,
|
660
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
661
|
+
}
|
662
|
+
};
|
663
|
+
},
|
664
|
+
examples: [
|
665
|
+
[
|
666
|
+
{
|
667
|
+
name: "{{user}}",
|
668
|
+
content: { text: "square root in complex dimension" }
|
669
|
+
},
|
670
|
+
{
|
671
|
+
name: "{{agent}}",
|
672
|
+
content: {
|
673
|
+
text: "In complex dimension: \u221A0 = 0 (real component)",
|
674
|
+
actions: ["MULTIVERSE_SQRT"]
|
675
|
+
}
|
676
|
+
}
|
677
|
+
]
|
678
|
+
]
|
679
|
+
};
|
680
|
+
var clearAction = {
|
681
|
+
name: "MATH_CLEAR",
|
682
|
+
similes: ["CLEAR", "RESET", "CLEAR_ALL"],
|
683
|
+
description: "Clear all calculation buffers and reset to zero.",
|
684
|
+
validate: async () => true,
|
685
|
+
handler: async (_runtime, message, _state, _options, callback) => {
|
686
|
+
const text = "Cleared all buffers";
|
687
|
+
if (callback) {
|
688
|
+
await callback({ text, source: message.content.source });
|
689
|
+
}
|
690
|
+
return {
|
691
|
+
success: true,
|
692
|
+
text,
|
693
|
+
values: {
|
694
|
+
accumulator: 0,
|
695
|
+
inputBuffer: 0,
|
696
|
+
lastOperation: "clear",
|
697
|
+
dimension: "standard",
|
698
|
+
history: []
|
699
|
+
},
|
700
|
+
data: {
|
701
|
+
operation: "clear"
|
702
|
+
}
|
703
|
+
};
|
704
|
+
},
|
705
|
+
examples: [
|
706
|
+
[
|
707
|
+
{
|
708
|
+
name: "{{user}}",
|
709
|
+
content: { text: "clear" }
|
710
|
+
},
|
711
|
+
{
|
712
|
+
name: "{{agent}}",
|
713
|
+
content: {
|
714
|
+
text: "Cleared all buffers",
|
715
|
+
actions: ["MATH_CLEAR"]
|
716
|
+
}
|
717
|
+
}
|
718
|
+
]
|
719
|
+
]
|
720
|
+
};
|
721
|
+
var storeAction = {
|
722
|
+
name: "MATH_STORE",
|
723
|
+
similes: ["STORE", "SAVE", "MEMORY_STORE"],
|
724
|
+
description: "Store current accumulator value to memory.",
|
725
|
+
validate: async () => true,
|
726
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
727
|
+
const accumulator = getStateValue(state, "accumulator", 0);
|
728
|
+
const text = `Stored ${accumulator} to memory`;
|
729
|
+
if (callback) {
|
730
|
+
await callback({ text, source: message.content.source });
|
731
|
+
}
|
732
|
+
return {
|
733
|
+
success: true,
|
734
|
+
text,
|
735
|
+
values: {
|
736
|
+
...state?.values,
|
737
|
+
memory: accumulator,
|
738
|
+
lastOperation: "store"
|
739
|
+
},
|
740
|
+
data: {
|
741
|
+
operation: "store",
|
742
|
+
value: accumulator
|
743
|
+
}
|
744
|
+
};
|
745
|
+
},
|
746
|
+
examples: [
|
747
|
+
[
|
748
|
+
{
|
749
|
+
name: "{{user}}",
|
750
|
+
content: { text: "store to memory" }
|
751
|
+
},
|
752
|
+
{
|
753
|
+
name: "{{agent}}",
|
754
|
+
content: {
|
755
|
+
text: "Stored 0 to memory",
|
756
|
+
actions: ["MATH_STORE"]
|
757
|
+
}
|
758
|
+
}
|
759
|
+
]
|
760
|
+
]
|
761
|
+
};
|
762
|
+
var recallAction = {
|
763
|
+
name: "MATH_RECALL",
|
764
|
+
similes: ["RECALL", "LOAD", "MEMORY_RECALL"],
|
765
|
+
description: "Recall value from memory to input buffer.",
|
766
|
+
validate: async () => true,
|
767
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
768
|
+
const memory = getStateValue(state, "memory", 0);
|
769
|
+
const text = `Recalled ${memory} from memory`;
|
770
|
+
if (callback) {
|
771
|
+
await callback({ text, source: message.content.source });
|
772
|
+
}
|
773
|
+
return {
|
774
|
+
success: true,
|
775
|
+
text,
|
776
|
+
values: {
|
777
|
+
...state?.values,
|
778
|
+
inputBuffer: memory,
|
779
|
+
lastOperation: "recall"
|
780
|
+
},
|
781
|
+
data: {
|
782
|
+
operation: "recall",
|
783
|
+
value: memory
|
784
|
+
}
|
785
|
+
};
|
786
|
+
},
|
787
|
+
examples: [
|
788
|
+
[
|
789
|
+
{
|
790
|
+
name: "{{user}}",
|
791
|
+
content: { text: "recall from memory" }
|
792
|
+
},
|
793
|
+
{
|
794
|
+
name: "{{agent}}",
|
795
|
+
content: {
|
796
|
+
text: "Recalled 0 from memory",
|
797
|
+
actions: ["MATH_RECALL"]
|
798
|
+
}
|
799
|
+
}
|
800
|
+
]
|
801
|
+
]
|
802
|
+
};
|
803
|
+
var transferAction = {
|
804
|
+
name: "TRANSFER_TO_INPUT",
|
805
|
+
similes: ["TRANSFER", "MOVE_TO_INPUT", "ACCUMULATOR_TO_INPUT"],
|
806
|
+
description: "Transfer accumulator value to input buffer for next operation.",
|
807
|
+
validate: async () => true,
|
808
|
+
handler: async (_runtime, message, state, _options, callback) => {
|
809
|
+
const accumulator = getStateValue(state, "accumulator", 0);
|
810
|
+
const text = `Transferred ${accumulator} from accumulator to input buffer`;
|
811
|
+
if (callback) {
|
812
|
+
await callback({ text, source: message.content.source });
|
813
|
+
}
|
814
|
+
return {
|
815
|
+
success: true,
|
816
|
+
text,
|
817
|
+
values: {
|
818
|
+
...state?.values,
|
819
|
+
inputBuffer: accumulator,
|
820
|
+
accumulator: 0,
|
821
|
+
lastOperation: "transfer"
|
822
|
+
},
|
823
|
+
data: {
|
824
|
+
operation: "transfer",
|
825
|
+
value: accumulator
|
826
|
+
}
|
827
|
+
};
|
828
|
+
},
|
829
|
+
examples: [
|
830
|
+
[
|
831
|
+
{
|
832
|
+
name: "{{user}}",
|
833
|
+
content: { text: "transfer to input" }
|
834
|
+
},
|
835
|
+
{
|
836
|
+
name: "{{agent}}",
|
837
|
+
content: {
|
838
|
+
text: "Transferred 0 from accumulator to input buffer",
|
839
|
+
actions: ["TRANSFER_TO_INPUT"]
|
840
|
+
}
|
841
|
+
}
|
842
|
+
]
|
843
|
+
]
|
844
|
+
};
|
845
|
+
var multiverseMathActions = [
|
846
|
+
// Number inputs
|
847
|
+
...Array.from({ length: 10 }, (_, i) => createNumberAction(i)),
|
848
|
+
// Dimension selector
|
849
|
+
selectDimensionAction,
|
850
|
+
// Multiverse operations
|
851
|
+
multiverseAddAction,
|
852
|
+
multiverseSubtractAction,
|
853
|
+
multiverseMultiplyAction,
|
854
|
+
multiverseDivideAction,
|
855
|
+
multiverseModuloAction,
|
856
|
+
multiversePowerAction,
|
857
|
+
multiverseSqrtAction,
|
858
|
+
// Utility operations
|
859
|
+
clearAction,
|
860
|
+
storeAction,
|
861
|
+
recallAction,
|
862
|
+
transferAction
|
863
|
+
];
|
864
|
+
|
51
865
|
// src/index.ts
|
866
|
+
var TYPEWRITER_ENABLED = process.env.TYPEWRITER_ENABLED?.toLowerCase() !== "false";
|
867
|
+
var MULTIVERSE_MATH_ENABLED = process.env.MULTIVERSE_MATH_ENABLED?.toLowerCase() !== "false";
|
868
|
+
function buildActions() {
|
869
|
+
const actions = [];
|
870
|
+
if (TYPEWRITER_ENABLED) {
|
871
|
+
console.log("[plugin-action-bench] Typewriter actions enabled");
|
872
|
+
actions.push(...typewriterActions);
|
873
|
+
} else {
|
874
|
+
console.log("[plugin-action-bench] Typewriter actions disabled via TYPEWRITER_ENABLED=false");
|
875
|
+
}
|
876
|
+
if (MULTIVERSE_MATH_ENABLED) {
|
877
|
+
console.log("[plugin-action-bench] Multiverse math actions enabled");
|
878
|
+
actions.push(...multiverseMathActions);
|
879
|
+
} else {
|
880
|
+
console.log("[plugin-action-bench] Multiverse math actions disabled via MULTIVERSE_MATH_ENABLED=false");
|
881
|
+
}
|
882
|
+
if (actions.length === 0) {
|
883
|
+
console.warn("[plugin-action-bench] WARNING: No benchmark actions are enabled. Set TYPEWRITER_ENABLED=true or MULTIVERSE_MATH_ENABLED=true to enable benchmarks.");
|
884
|
+
}
|
885
|
+
console.log(`[plugin-action-bench] Total actions loaded: ${actions.length}`);
|
886
|
+
return actions;
|
887
|
+
}
|
52
888
|
var actionBenchPlugin = {
|
53
|
-
name: "action-bench
|
54
|
-
description: "
|
55
|
-
actions:
|
889
|
+
name: "plugin-action-bench",
|
890
|
+
description: "Action benchmark plugin providing typewriter (A\u2013Z) and multiverse math operations where mathematical behavior changes based on dimensional constants, testing AI agents' ability to handle context-dependent operations and unknown mathematical scenarios.",
|
891
|
+
actions: buildActions()
|
892
|
+
};
|
893
|
+
var benchmarkConfig = {
|
894
|
+
typewriterEnabled: TYPEWRITER_ENABLED,
|
895
|
+
multiverseMathEnabled: MULTIVERSE_MATH_ENABLED,
|
896
|
+
totalActionsLoaded: actionBenchPlugin.actions?.length ?? 0
|
56
897
|
};
|
57
898
|
var index_default = actionBenchPlugin;
|
58
899
|
|
59
|
-
export { actionBenchPlugin, index_default as default };
|
900
|
+
export { actionBenchPlugin, benchmarkConfig, index_default as default };
|
60
901
|
//# sourceMappingURL=index.js.map
|
61
902
|
//# sourceMappingURL=index.js.map
|