@elizaos/plugin-bootstrap 1.6.0-alpha.0 → 1.6.0-alpha.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imageGeneration.d.ts","sourceRoot":"","sources":["../../src/actions/imageGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAYZ,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"imageGeneration.d.ts","sourceRoot":"","sources":["../../src/actions/imageGeneration.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EAYZ,MAAM,eAAe,CAAC;AAuBvB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EA6M3B,MAAM,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,KAAK,aAAa,EAIlB,KAAK,KAAK,EAMV,KAAK,MAAM,EAKX,KAAK,IAAI,EAUV,MAAM,eAAe,CAAC;AAUvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AAErC;;;;;GAKG;AACH,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAyBF;;GAEG;AA0CH;;;;;GAKG;AACH;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,WAAW,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAsB/E;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,KAAK,EAAE,EACpB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,KAAK,EAAE,CAAC,CAyHlB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,aAAa,EACtB,IAAI,CAAC,EAAE,IAAI,EACX,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAyCT;AAimDD,eAAO,MAAM,eAAe,EAAE,MAyC7B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,51 +16,6 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
18
18
|
|
|
19
|
-
// ../../node_modules/dedent/dist/dedent.js
|
|
20
|
-
var require_dedent = __commonJS((exports, module) => {
|
|
21
|
-
function dedent(strings) {
|
|
22
|
-
var raw = undefined;
|
|
23
|
-
if (typeof strings === "string") {
|
|
24
|
-
raw = [strings];
|
|
25
|
-
} else {
|
|
26
|
-
raw = strings.raw;
|
|
27
|
-
}
|
|
28
|
-
var result = "";
|
|
29
|
-
for (var i = 0;i < raw.length; i++) {
|
|
30
|
-
result += raw[i].replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`");
|
|
31
|
-
if (i < (arguments.length <= 1 ? 0 : arguments.length - 1)) {
|
|
32
|
-
result += arguments.length <= i + 1 ? undefined : arguments[i + 1];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
var lines = result.split(`
|
|
36
|
-
`);
|
|
37
|
-
var mindent = null;
|
|
38
|
-
lines.forEach(function(l) {
|
|
39
|
-
var m = l.match(/^(\s+)\S+/);
|
|
40
|
-
if (m) {
|
|
41
|
-
var indent = m[1].length;
|
|
42
|
-
if (!mindent) {
|
|
43
|
-
mindent = indent;
|
|
44
|
-
} else {
|
|
45
|
-
mindent = Math.min(mindent, indent);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
if (mindent !== null) {
|
|
50
|
-
result = lines.map(function(l) {
|
|
51
|
-
return l[0] === " " ? l.slice(mindent) : l;
|
|
52
|
-
}).join(`
|
|
53
|
-
`);
|
|
54
|
-
}
|
|
55
|
-
result = result.trim();
|
|
56
|
-
return result.replace(/\\n/g, `
|
|
57
|
-
`);
|
|
58
|
-
}
|
|
59
|
-
if (typeof module !== "undefined") {
|
|
60
|
-
module.exports = dedent;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
19
|
// ../../node_modules/unique-names-generator/dist/index.js
|
|
65
20
|
var require_dist = __commonJS((exports) => {
|
|
66
21
|
var a = (a2) => {
|
|
@@ -204,10 +159,13 @@ import {
|
|
|
204
159
|
parseKeyValueXml,
|
|
205
160
|
logger
|
|
206
161
|
} from "@elizaos/core";
|
|
207
|
-
var imageGenerationTemplate = `# Task: Generate an image prompt
|
|
162
|
+
var imageGenerationTemplate = `# Task: Generate an image prompt based on the user's request.
|
|
208
163
|
{{providers}}
|
|
209
164
|
# Instructions:
|
|
210
|
-
|
|
165
|
+
Based on the user's message in the conversation, write a clear, concise, and visually descriptive prompt for image generation. Focus only on what the user wants to see, extract the key visual elements from the request, and formulate a detailed prompt suitable for image generation.
|
|
166
|
+
|
|
167
|
+
# Recent conversation:
|
|
168
|
+
{{recentMessages}}
|
|
211
169
|
|
|
212
170
|
Your response should be formatted in XML like this:
|
|
213
171
|
<response>
|
|
@@ -259,6 +217,7 @@ var generateImageAction = {
|
|
|
259
217
|
};
|
|
260
218
|
}
|
|
261
219
|
const imageUrl = imageResponse[0].url;
|
|
220
|
+
logger.info(`[GENERATE_IMAGE] Received image URL: ${imageUrl}`);
|
|
262
221
|
const getFileExtension = (url) => {
|
|
263
222
|
try {
|
|
264
223
|
const urlPath = new URL(url).pathname;
|
|
@@ -278,7 +237,7 @@ var generateImageAction = {
|
|
|
278
237
|
{
|
|
279
238
|
id: attachmentId,
|
|
280
239
|
url: imageUrl,
|
|
281
|
-
title:
|
|
240
|
+
title: fileName,
|
|
282
241
|
contentType: ContentType.IMAGE
|
|
283
242
|
}
|
|
284
243
|
],
|
|
@@ -286,13 +245,7 @@ var generateImageAction = {
|
|
|
286
245
|
actions: ["GENERATE_IMAGE"],
|
|
287
246
|
text: imagePrompt
|
|
288
247
|
};
|
|
289
|
-
|
|
290
|
-
id: attachmentId,
|
|
291
|
-
attachment: imageUrl,
|
|
292
|
-
name: fileName,
|
|
293
|
-
contentType: ContentType.IMAGE
|
|
294
|
-
};
|
|
295
|
-
await callback(responseContent, [imageFile]);
|
|
248
|
+
await callback(responseContent);
|
|
296
249
|
return {
|
|
297
250
|
text: "Generated image",
|
|
298
251
|
values: {
|
|
@@ -1841,8 +1794,8 @@ var replyAction = {
|
|
|
1841
1794
|
return true;
|
|
1842
1795
|
},
|
|
1843
1796
|
handler: async (runtime, message, state, _options, callback, responses) => {
|
|
1844
|
-
const
|
|
1845
|
-
const previousResults =
|
|
1797
|
+
const actionContext = _options?.actionContext;
|
|
1798
|
+
const previousResults = actionContext?.previousResults || [];
|
|
1846
1799
|
if (previousResults.length > 0) {
|
|
1847
1800
|
logger5.debug(`[REPLY] Found ${previousResults.length} previous action results`);
|
|
1848
1801
|
}
|
|
@@ -2708,7 +2661,6 @@ var sendMessageAction = {
|
|
|
2708
2661
|
]
|
|
2709
2662
|
};
|
|
2710
2663
|
// src/actions/settings.ts
|
|
2711
|
-
var import_dedent = __toESM(require_dedent(), 1);
|
|
2712
2664
|
import {
|
|
2713
2665
|
ChannelType as ChannelType2,
|
|
2714
2666
|
composePrompt as composePrompt3,
|
|
@@ -2719,6 +2671,104 @@ import {
|
|
|
2719
2671
|
ModelType as ModelType8,
|
|
2720
2672
|
parseKeyValueXml as parseKeyValueXml6
|
|
2721
2673
|
} from "@elizaos/core";
|
|
2674
|
+
|
|
2675
|
+
// ../../node_modules/dedent/dist/dedent.mjs
|
|
2676
|
+
function ownKeys(object, enumerableOnly) {
|
|
2677
|
+
var keys = Object.keys(object);
|
|
2678
|
+
if (Object.getOwnPropertySymbols) {
|
|
2679
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
2680
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
2681
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2682
|
+
})), keys.push.apply(keys, symbols);
|
|
2683
|
+
}
|
|
2684
|
+
return keys;
|
|
2685
|
+
}
|
|
2686
|
+
function _objectSpread(target) {
|
|
2687
|
+
for (var i = 1;i < arguments.length; i++) {
|
|
2688
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
2689
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
2690
|
+
_defineProperty(target, key, source[key]);
|
|
2691
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
2692
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
return target;
|
|
2696
|
+
}
|
|
2697
|
+
function _defineProperty(obj, key, value) {
|
|
2698
|
+
key = _toPropertyKey(key);
|
|
2699
|
+
if (key in obj) {
|
|
2700
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2701
|
+
} else {
|
|
2702
|
+
obj[key] = value;
|
|
2703
|
+
}
|
|
2704
|
+
return obj;
|
|
2705
|
+
}
|
|
2706
|
+
function _toPropertyKey(arg) {
|
|
2707
|
+
var key = _toPrimitive(arg, "string");
|
|
2708
|
+
return typeof key === "symbol" ? key : String(key);
|
|
2709
|
+
}
|
|
2710
|
+
function _toPrimitive(input, hint) {
|
|
2711
|
+
if (typeof input !== "object" || input === null)
|
|
2712
|
+
return input;
|
|
2713
|
+
var prim = input[Symbol.toPrimitive];
|
|
2714
|
+
if (prim !== undefined) {
|
|
2715
|
+
var res = prim.call(input, hint || "default");
|
|
2716
|
+
if (typeof res !== "object")
|
|
2717
|
+
return res;
|
|
2718
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2719
|
+
}
|
|
2720
|
+
return (hint === "string" ? String : Number)(input);
|
|
2721
|
+
}
|
|
2722
|
+
var dedent = createDedent({});
|
|
2723
|
+
var dedent_default = dedent;
|
|
2724
|
+
function createDedent(options) {
|
|
2725
|
+
dedent2.withOptions = (newOptions) => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
|
|
2726
|
+
return dedent2;
|
|
2727
|
+
function dedent2(strings, ...values) {
|
|
2728
|
+
const raw = typeof strings === "string" ? [strings] : strings.raw;
|
|
2729
|
+
const {
|
|
2730
|
+
escapeSpecialCharacters = Array.isArray(strings)
|
|
2731
|
+
} = options;
|
|
2732
|
+
let result = "";
|
|
2733
|
+
for (let i = 0;i < raw.length; i++) {
|
|
2734
|
+
let next = raw[i];
|
|
2735
|
+
if (escapeSpecialCharacters) {
|
|
2736
|
+
next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
|
|
2737
|
+
}
|
|
2738
|
+
result += next;
|
|
2739
|
+
if (i < values.length) {
|
|
2740
|
+
result += values[i];
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
const lines = result.split(`
|
|
2744
|
+
`);
|
|
2745
|
+
let mindent = null;
|
|
2746
|
+
for (const l of lines) {
|
|
2747
|
+
const m = l.match(/^(\s+)\S+/);
|
|
2748
|
+
if (m) {
|
|
2749
|
+
const indent = m[1].length;
|
|
2750
|
+
if (!mindent) {
|
|
2751
|
+
mindent = indent;
|
|
2752
|
+
} else {
|
|
2753
|
+
mindent = Math.min(mindent, indent);
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
if (mindent !== null) {
|
|
2758
|
+
const m = mindent;
|
|
2759
|
+
result = lines.map((l) => l[0] === " " || l[0] === "\t" ? l.slice(m) : l).join(`
|
|
2760
|
+
`);
|
|
2761
|
+
}
|
|
2762
|
+
result = result.trim();
|
|
2763
|
+
if (escapeSpecialCharacters) {
|
|
2764
|
+
result = result.replace(/\\n/g, `
|
|
2765
|
+
`);
|
|
2766
|
+
}
|
|
2767
|
+
return result;
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
|
|
2771
|
+
// src/actions/settings.ts
|
|
2722
2772
|
var messageCompletionFooter = `
|
|
2723
2773
|
# Instructions: Write the next message for {{agentName}}. Include the appropriate action from the list: {{actionNames}}
|
|
2724
2774
|
|
|
@@ -2887,7 +2937,7 @@ async function extractSettingValues(runtime, _message, state, worldSettings) {
|
|
|
2887
2937
|
return `${key}: ${setting.description} ${requiredStr}`;
|
|
2888
2938
|
}).join(`
|
|
2889
2939
|
`);
|
|
2890
|
-
const basePrompt =
|
|
2940
|
+
const basePrompt = dedent_default`
|
|
2891
2941
|
I need to extract settings values from the user's message.
|
|
2892
2942
|
|
|
2893
2943
|
Available settings:
|
|
@@ -6775,6 +6825,9 @@ class TaskService extends Service {
|
|
|
6775
6825
|
const allTasks = await this.runtime.getTasks({
|
|
6776
6826
|
tags: ["queue"]
|
|
6777
6827
|
});
|
|
6828
|
+
if (!allTasks) {
|
|
6829
|
+
return;
|
|
6830
|
+
}
|
|
6778
6831
|
const tasks = await this.validateTasks(allTasks);
|
|
6779
6832
|
const now = Date.now();
|
|
6780
6833
|
for (const task of tasks) {
|
|
@@ -6886,7 +6939,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6886
6939
|
this.startProcessing();
|
|
6887
6940
|
}
|
|
6888
6941
|
async handleEmbeddingRequest(payload) {
|
|
6889
|
-
const { memory, priority = "normal", retryCount = 0, maxRetries = 3 } = payload;
|
|
6942
|
+
const { memory, priority = "normal", retryCount = 0, maxRetries = 3, runId } = payload;
|
|
6890
6943
|
if (memory.embedding) {
|
|
6891
6944
|
logger21.debug("[EmbeddingService] Memory already has embeddings, skipping");
|
|
6892
6945
|
return;
|
|
@@ -6900,7 +6953,8 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6900
6953
|
priority,
|
|
6901
6954
|
retryCount,
|
|
6902
6955
|
maxRetries,
|
|
6903
|
-
addedAt: Date.now()
|
|
6956
|
+
addedAt: Date.now(),
|
|
6957
|
+
runId
|
|
6904
6958
|
};
|
|
6905
6959
|
this.insertItemByPriority(queueItem);
|
|
6906
6960
|
logger21.debug(`[EmbeddingService] Added memory to queue. Queue size: ${this.queue.length}`);
|
|
@@ -6981,6 +7035,18 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6981
7035
|
this.insertItemByPriority(item);
|
|
6982
7036
|
logger21.debug(`[EmbeddingService] Re-queued item for retry (${item.retryCount}/${item.maxRetries})`);
|
|
6983
7037
|
} else {
|
|
7038
|
+
await this.runtime.log({
|
|
7039
|
+
entityId: this.runtime.agentId,
|
|
7040
|
+
roomId: item.memory.roomId || this.runtime.agentId,
|
|
7041
|
+
type: "embedding_event",
|
|
7042
|
+
body: {
|
|
7043
|
+
runId: item.runId,
|
|
7044
|
+
memoryId: item.memory.id,
|
|
7045
|
+
status: "failed",
|
|
7046
|
+
error: error instanceof Error ? error.message : String(error),
|
|
7047
|
+
source: "embeddingService"
|
|
7048
|
+
}
|
|
7049
|
+
});
|
|
6984
7050
|
await this.runtime.emitEvent(EventType.EMBEDDING_GENERATION_FAILED, {
|
|
6985
7051
|
runtime: this.runtime,
|
|
6986
7052
|
memory: item.memory,
|
|
@@ -7013,6 +7079,18 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7013
7079
|
id: memory.id,
|
|
7014
7080
|
embedding
|
|
7015
7081
|
});
|
|
7082
|
+
await this.runtime.log({
|
|
7083
|
+
entityId: this.runtime.agentId,
|
|
7084
|
+
roomId: memory.roomId || this.runtime.agentId,
|
|
7085
|
+
type: "embedding_event",
|
|
7086
|
+
body: {
|
|
7087
|
+
runId: item.runId,
|
|
7088
|
+
memoryId: memory.id,
|
|
7089
|
+
status: "completed",
|
|
7090
|
+
duration,
|
|
7091
|
+
source: "embeddingService"
|
|
7092
|
+
}
|
|
7093
|
+
});
|
|
7016
7094
|
await this.runtime.emitEvent(EventType.EMBEDDING_GENERATION_COMPLETED, {
|
|
7017
7095
|
runtime: this.runtime,
|
|
7018
7096
|
memory: { ...memory, embedding },
|
|
@@ -7357,12 +7435,17 @@ ${response}`);
|
|
|
7357
7435
|
if (responseContent.providers && responseContent.providers.length > 0) {
|
|
7358
7436
|
runtime.logger.debug({ providers: responseContent.providers }, "[Bootstrap] Simple response used providers");
|
|
7359
7437
|
}
|
|
7360
|
-
|
|
7438
|
+
if (callback) {
|
|
7439
|
+
await callback(responseContent);
|
|
7440
|
+
}
|
|
7361
7441
|
} else if (mode === "actions") {
|
|
7362
|
-
await runtime.processActions(message, responseMessages, state, async (content
|
|
7363
|
-
runtime.logger.debug({ content
|
|
7442
|
+
await runtime.processActions(message, responseMessages, state, async (content) => {
|
|
7443
|
+
runtime.logger.debug({ content }, "action callback");
|
|
7364
7444
|
responseContent.actionCallbacks = content;
|
|
7365
|
-
|
|
7445
|
+
if (callback) {
|
|
7446
|
+
return callback(content);
|
|
7447
|
+
}
|
|
7448
|
+
return [];
|
|
7366
7449
|
});
|
|
7367
7450
|
}
|
|
7368
7451
|
}
|
|
@@ -7408,7 +7491,9 @@ ${response}`);
|
|
|
7408
7491
|
simple: true,
|
|
7409
7492
|
inReplyTo: createUniqueUuid3(runtime, message.id)
|
|
7410
7493
|
};
|
|
7411
|
-
|
|
7494
|
+
if (callback) {
|
|
7495
|
+
await callback(ignoreContent);
|
|
7496
|
+
}
|
|
7412
7497
|
const ignoreMemory = {
|
|
7413
7498
|
id: asUUID2(v4_default()),
|
|
7414
7499
|
entityId: runtime.agentId,
|
|
@@ -7418,9 +7503,7 @@ ${response}`);
|
|
|
7418
7503
|
createdAt: Date.now()
|
|
7419
7504
|
};
|
|
7420
7505
|
await runtime.createMemory(ignoreMemory, "messages");
|
|
7421
|
-
runtime.logger.debug("[Bootstrap] Saved ignore response to memory", {
|
|
7422
|
-
memoryId: ignoreMemory.id
|
|
7423
|
-
});
|
|
7506
|
+
runtime.logger.debug("[Bootstrap] Saved ignore response to memory", `memoryId: ${ignoreMemory.id}`);
|
|
7424
7507
|
}
|
|
7425
7508
|
agentResponses.delete(message.roomId);
|
|
7426
7509
|
if (agentResponses.size === 0) {
|
|
@@ -7431,13 +7514,16 @@ ${response}`);
|
|
|
7431
7514
|
if (responseContent) {
|
|
7432
7515
|
responseContent.evalCallbacks = content;
|
|
7433
7516
|
}
|
|
7434
|
-
|
|
7517
|
+
if (callback) {
|
|
7518
|
+
return callback(content);
|
|
7519
|
+
}
|
|
7520
|
+
return [];
|
|
7435
7521
|
}, responseMessages);
|
|
7436
7522
|
let entityName = "noname";
|
|
7437
7523
|
if (message.metadata && "entityName" in message.metadata) {
|
|
7438
7524
|
entityName = message.metadata.entityName;
|
|
7439
7525
|
}
|
|
7440
|
-
const isDM = message.content?.channelType
|
|
7526
|
+
const isDM = message.content?.channelType === ChannelType9.DM;
|
|
7441
7527
|
let roomName = entityName;
|
|
7442
7528
|
if (!isDM) {
|
|
7443
7529
|
const roomDatas = await runtime.getRoomsByIds([message.roomId]);
|
|
@@ -7608,10 +7694,12 @@ async function runMultiStepCore({ runtime, message, state, callback }) {
|
|
|
7608
7694
|
const { thought, providers: providers2 = [], action, isFinish } = parsedStep;
|
|
7609
7695
|
if (isFinish === "true" || isFinish === true) {
|
|
7610
7696
|
runtime.logger.info(`[MultiStep] Task marked as complete at iteration ${iterationCount}`);
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7697
|
+
if (callback) {
|
|
7698
|
+
await callback({
|
|
7699
|
+
text: "",
|
|
7700
|
+
thought: thought ?? ""
|
|
7701
|
+
});
|
|
7702
|
+
}
|
|
7615
7703
|
break;
|
|
7616
7704
|
}
|
|
7617
7705
|
if ((!providers2 || providers2.length === 0) && !action) {
|
|
@@ -7647,11 +7735,13 @@ async function runMultiStepCore({ runtime, message, state, callback }) {
|
|
|
7647
7735
|
text: success ? providerResult.text : undefined,
|
|
7648
7736
|
error: success ? undefined : providerResult?.error
|
|
7649
7737
|
});
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7738
|
+
if (callback) {
|
|
7739
|
+
await callback({
|
|
7740
|
+
text: `\uD83D\uDD0E Provider executed: ${providerName}`,
|
|
7741
|
+
actions: [providerName],
|
|
7742
|
+
thought: thought ?? ""
|
|
7743
|
+
});
|
|
7744
|
+
}
|
|
7655
7745
|
}
|
|
7656
7746
|
if (action) {
|
|
7657
7747
|
const actionContent = {
|
|
@@ -7704,7 +7794,7 @@ async function runMultiStepCore({ runtime, message, state, callback }) {
|
|
|
7704
7794
|
let responseContent = null;
|
|
7705
7795
|
if (summary?.text) {
|
|
7706
7796
|
responseContent = {
|
|
7707
|
-
actions: ["
|
|
7797
|
+
actions: ["MULTI_STEP_SUMMARY"],
|
|
7708
7798
|
text: summary.text,
|
|
7709
7799
|
thought: summary.thought || "Final user-facing message after task completion.",
|
|
7710
7800
|
simple: true
|
|
@@ -8032,12 +8122,7 @@ var events = {
|
|
|
8032
8122
|
payload.runtime.logger.error("No callback provided for message");
|
|
8033
8123
|
return;
|
|
8034
8124
|
}
|
|
8035
|
-
await messageReceivedHandler(
|
|
8036
|
-
runtime: payload.runtime,
|
|
8037
|
-
message: payload.message,
|
|
8038
|
-
callback: payload.callback,
|
|
8039
|
-
onComplete: payload.onComplete
|
|
8040
|
-
});
|
|
8125
|
+
await messageReceivedHandler(payload);
|
|
8041
8126
|
}
|
|
8042
8127
|
],
|
|
8043
8128
|
[EventType2.VOICE_MESSAGE_RECEIVED]: [
|
|
@@ -8046,20 +8131,12 @@ var events = {
|
|
|
8046
8131
|
payload.runtime.logger.error("No callback provided for voice message");
|
|
8047
8132
|
return;
|
|
8048
8133
|
}
|
|
8049
|
-
await messageReceivedHandler(
|
|
8050
|
-
runtime: payload.runtime,
|
|
8051
|
-
message: payload.message,
|
|
8052
|
-
callback: payload.callback,
|
|
8053
|
-
onComplete: payload.onComplete
|
|
8054
|
-
});
|
|
8134
|
+
await messageReceivedHandler(payload);
|
|
8055
8135
|
}
|
|
8056
8136
|
],
|
|
8057
8137
|
[EventType2.REACTION_RECEIVED]: [
|
|
8058
8138
|
async (payload) => {
|
|
8059
|
-
await reactionReceivedHandler(
|
|
8060
|
-
runtime: payload.runtime,
|
|
8061
|
-
message: payload.message
|
|
8062
|
-
});
|
|
8139
|
+
await reactionReceivedHandler(payload);
|
|
8063
8140
|
}
|
|
8064
8141
|
],
|
|
8065
8142
|
[EventType2.POST_GENERATED]: [
|
|
@@ -8074,10 +8151,7 @@ var events = {
|
|
|
8074
8151
|
],
|
|
8075
8152
|
[EventType2.MESSAGE_DELETED]: [
|
|
8076
8153
|
async (payload) => {
|
|
8077
|
-
await messageDeletedHandler(
|
|
8078
|
-
runtime: payload.runtime,
|
|
8079
|
-
message: payload.message
|
|
8080
|
-
});
|
|
8154
|
+
await messageDeletedHandler(payload);
|
|
8081
8155
|
}
|
|
8082
8156
|
],
|
|
8083
8157
|
[EventType2.CHANNEL_CLEARED]: [
|
|
@@ -8139,21 +8213,47 @@ var events = {
|
|
|
8139
8213
|
[EventType2.ACTION_STARTED]: [
|
|
8140
8214
|
async (payload) => {
|
|
8141
8215
|
try {
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
|
|
8216
|
+
if (payload.content?.source === "client_chat") {
|
|
8217
|
+
const messageBusService = payload.runtime.getService("message-bus-service");
|
|
8218
|
+
if (messageBusService) {
|
|
8219
|
+
await messageBusService.notifyActionStart(payload.roomId, payload.world, payload.content, payload.messageId);
|
|
8220
|
+
}
|
|
8145
8221
|
}
|
|
8146
8222
|
} catch (error) {
|
|
8147
8223
|
logger22.error(`[Bootstrap] Error sending refetch request: ${error}`);
|
|
8148
8224
|
}
|
|
8225
|
+
},
|
|
8226
|
+
async (payload) => {
|
|
8227
|
+
try {
|
|
8228
|
+
await payload.runtime.log({
|
|
8229
|
+
entityId: payload.runtime.agentId,
|
|
8230
|
+
roomId: payload.roomId,
|
|
8231
|
+
type: "action_event",
|
|
8232
|
+
body: {
|
|
8233
|
+
runId: payload.content?.runId,
|
|
8234
|
+
actionId: payload.content?.actionId,
|
|
8235
|
+
actionName: payload.content?.actions?.[0],
|
|
8236
|
+
roomId: payload.roomId,
|
|
8237
|
+
messageId: payload.messageId,
|
|
8238
|
+
timestamp: Date.now(),
|
|
8239
|
+
planStep: payload.content?.planStep,
|
|
8240
|
+
source: "actionHandler"
|
|
8241
|
+
}
|
|
8242
|
+
});
|
|
8243
|
+
logger22.debug(`[Bootstrap] Logged ACTION_STARTED event for action ${payload.content?.actions?.[0]}`);
|
|
8244
|
+
} catch (error) {
|
|
8245
|
+
logger22.error(`[Bootstrap] Failed to log ACTION_STARTED event: ${error}`);
|
|
8246
|
+
}
|
|
8149
8247
|
}
|
|
8150
8248
|
],
|
|
8151
8249
|
[EventType2.ACTION_COMPLETED]: [
|
|
8152
8250
|
async (payload) => {
|
|
8153
8251
|
try {
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8252
|
+
if (payload.content?.source === "client_chat") {
|
|
8253
|
+
const messageBusService = payload.runtime.getService("message-bus-service");
|
|
8254
|
+
if (messageBusService) {
|
|
8255
|
+
await messageBusService.notifyActionUpdate(payload.roomId, payload.world, payload.content, payload.messageId);
|
|
8256
|
+
}
|
|
8157
8257
|
}
|
|
8158
8258
|
} catch (error) {
|
|
8159
8259
|
logger22.error(`[Bootstrap] Error sending refetch request: ${error}`);
|
|
@@ -8171,6 +8271,81 @@ var events = {
|
|
|
8171
8271
|
logger22.debug(`[Bootstrap] Evaluator ${status}: ${payload.evaluatorName} (${payload.evaluatorId})`);
|
|
8172
8272
|
}
|
|
8173
8273
|
],
|
|
8274
|
+
[EventType2.RUN_STARTED]: [
|
|
8275
|
+
async (payload) => {
|
|
8276
|
+
try {
|
|
8277
|
+
await payload.runtime.log({
|
|
8278
|
+
entityId: payload.entityId,
|
|
8279
|
+
roomId: payload.roomId,
|
|
8280
|
+
type: "run_event",
|
|
8281
|
+
body: {
|
|
8282
|
+
runId: payload.runId,
|
|
8283
|
+
status: payload.status,
|
|
8284
|
+
messageId: payload.messageId,
|
|
8285
|
+
roomId: payload.roomId,
|
|
8286
|
+
entityId: payload.entityId,
|
|
8287
|
+
startTime: payload.startTime,
|
|
8288
|
+
source: payload.source || "unknown"
|
|
8289
|
+
}
|
|
8290
|
+
});
|
|
8291
|
+
logger22.debug(`[Bootstrap] Logged RUN_STARTED event for run ${payload.runId}`);
|
|
8292
|
+
} catch (error) {
|
|
8293
|
+
logger22.error(`[Bootstrap] Failed to log RUN_STARTED event: ${error}`);
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
],
|
|
8297
|
+
[EventType2.RUN_ENDED]: [
|
|
8298
|
+
async (payload) => {
|
|
8299
|
+
try {
|
|
8300
|
+
await payload.runtime.log({
|
|
8301
|
+
entityId: payload.entityId,
|
|
8302
|
+
roomId: payload.roomId,
|
|
8303
|
+
type: "run_event",
|
|
8304
|
+
body: {
|
|
8305
|
+
runId: payload.runId,
|
|
8306
|
+
status: payload.status,
|
|
8307
|
+
messageId: payload.messageId,
|
|
8308
|
+
roomId: payload.roomId,
|
|
8309
|
+
entityId: payload.entityId,
|
|
8310
|
+
startTime: payload.startTime,
|
|
8311
|
+
endTime: payload.endTime,
|
|
8312
|
+
duration: payload.duration,
|
|
8313
|
+
error: payload.error,
|
|
8314
|
+
source: payload.source || "unknown"
|
|
8315
|
+
}
|
|
8316
|
+
});
|
|
8317
|
+
logger22.debug(`[Bootstrap] Logged RUN_ENDED event for run ${payload.runId} with status ${payload.status}`);
|
|
8318
|
+
} catch (error) {
|
|
8319
|
+
logger22.error(`[Bootstrap] Failed to log RUN_ENDED event: ${error}`);
|
|
8320
|
+
}
|
|
8321
|
+
}
|
|
8322
|
+
],
|
|
8323
|
+
[EventType2.RUN_TIMEOUT]: [
|
|
8324
|
+
async (payload) => {
|
|
8325
|
+
try {
|
|
8326
|
+
await payload.runtime.log({
|
|
8327
|
+
entityId: payload.entityId,
|
|
8328
|
+
roomId: payload.roomId,
|
|
8329
|
+
type: "run_event",
|
|
8330
|
+
body: {
|
|
8331
|
+
runId: payload.runId,
|
|
8332
|
+
status: payload.status,
|
|
8333
|
+
messageId: payload.messageId,
|
|
8334
|
+
roomId: payload.roomId,
|
|
8335
|
+
entityId: payload.entityId,
|
|
8336
|
+
startTime: payload.startTime,
|
|
8337
|
+
endTime: payload.endTime,
|
|
8338
|
+
duration: payload.duration,
|
|
8339
|
+
error: payload.error,
|
|
8340
|
+
source: payload.source || "unknown"
|
|
8341
|
+
}
|
|
8342
|
+
});
|
|
8343
|
+
logger22.debug(`[Bootstrap] Logged RUN_TIMEOUT event for run ${payload.runId}`);
|
|
8344
|
+
} catch (error) {
|
|
8345
|
+
logger22.error(`[Bootstrap] Failed to log RUN_TIMEOUT event: ${error}`);
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
],
|
|
8174
8349
|
CONTROL_MESSAGE: [controlMessageHandler]
|
|
8175
8350
|
};
|
|
8176
8351
|
var bootstrapPlugin = {
|
|
@@ -8253,5 +8428,5 @@ export {
|
|
|
8253
8428
|
actionStateProvider
|
|
8254
8429
|
};
|
|
8255
8430
|
|
|
8256
|
-
//# debugId=
|
|
8431
|
+
//# debugId=0B130525A243124D64756E2164756E21
|
|
8257
8432
|
//# sourceMappingURL=index.js.map
|