@elizaos/plugin-bootstrap 1.3.2 → 1.4.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 +53 -43
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -338,7 +338,7 @@ var choiceAction = {
|
|
|
338
338
|
}
|
|
339
339
|
return pendingTasks && pendingTasks.length > 0 && pendingTasks.some((task) => task.metadata?.options);
|
|
340
340
|
} catch (error) {
|
|
341
|
-
logger.error("Error validating choice action
|
|
341
|
+
logger.error({ error }, "Error validating choice action");
|
|
342
342
|
return false;
|
|
343
343
|
}
|
|
344
344
|
},
|
|
@@ -519,7 +519,7 @@ ${task.options?.map((opt) => `- ${opt.name}: ${opt.description}`).join("\n")}`;
|
|
|
519
519
|
success: true
|
|
520
520
|
};
|
|
521
521
|
} catch (error) {
|
|
522
|
-
logger.error("Error executing task with option
|
|
522
|
+
logger.error({ error }, "Error executing task with option");
|
|
523
523
|
await callback?.({
|
|
524
524
|
text: "There was an error processing your selection.",
|
|
525
525
|
actions: ["SELECT_OPTION_ERROR"],
|
|
@@ -745,7 +745,7 @@ var followRoomAction = {
|
|
|
745
745
|
success: true
|
|
746
746
|
};
|
|
747
747
|
} catch (error) {
|
|
748
|
-
logger2.error("Error following room
|
|
748
|
+
logger2.error({ error }, "Error following room");
|
|
749
749
|
return {
|
|
750
750
|
text: "Failed to follow room",
|
|
751
751
|
values: {
|
|
@@ -1410,7 +1410,7 @@ var muteRoomAction = {
|
|
|
1410
1410
|
success: true
|
|
1411
1411
|
};
|
|
1412
1412
|
} catch (error) {
|
|
1413
|
-
logger3.error("Error muting room
|
|
1413
|
+
logger3.error({ error }, "Error muting room");
|
|
1414
1414
|
return {
|
|
1415
1415
|
text: "Failed to mute room",
|
|
1416
1416
|
values: {
|
|
@@ -2060,7 +2060,7 @@ IMPORTANT: Your response must ONLY contain the <response></response> XML block a
|
|
|
2060
2060
|
await runtime.updateWorld(world);
|
|
2061
2061
|
logger5.info(`Updated roles in world metadata for server ${serverId}`);
|
|
2062
2062
|
} catch (error) {
|
|
2063
|
-
logger5.error("Failed to save world updates
|
|
2063
|
+
logger5.error({ error }, "Failed to save world updates");
|
|
2064
2064
|
return {
|
|
2065
2065
|
text: "Failed to save role updates",
|
|
2066
2066
|
values: {
|
|
@@ -2901,7 +2901,7 @@ async function processSettingUpdates(runtime, serverId, worldSettings, updates)
|
|
|
2901
2901
|
}
|
|
2902
2902
|
return { updatedAny, messages };
|
|
2903
2903
|
} catch (error) {
|
|
2904
|
-
logger7.error("Error processing setting updates:"
|
|
2904
|
+
logger7.error({ error }, "Error processing setting updates:");
|
|
2905
2905
|
return {
|
|
2906
2906
|
updatedAny: false,
|
|
2907
2907
|
messages: ["Error occurred while updating settings"]
|
|
@@ -4083,7 +4083,7 @@ var unmuteRoomAction = {
|
|
|
4083
4083
|
success: true
|
|
4084
4084
|
};
|
|
4085
4085
|
} catch (error) {
|
|
4086
|
-
logger8.error("Error unmuting room:"
|
|
4086
|
+
logger8.error({ error }, "Error unmuting room:");
|
|
4087
4087
|
return {
|
|
4088
4088
|
text: "Failed to unmute room",
|
|
4089
4089
|
values: {
|
|
@@ -4667,7 +4667,7 @@ function resolveEntity(entityId, entities) {
|
|
|
4667
4667
|
async function handler(runtime, message, state) {
|
|
4668
4668
|
const { agentId, roomId } = message;
|
|
4669
4669
|
if (!agentId || !roomId) {
|
|
4670
|
-
logger10.warn("Missing agentId or roomId in message"
|
|
4670
|
+
logger10.warn({ message }, "Missing agentId or roomId in message");
|
|
4671
4671
|
return;
|
|
4672
4672
|
}
|
|
4673
4673
|
const [existingRelationships, entities, knownFacts] = await Promise.all([
|
|
@@ -4698,20 +4698,20 @@ async function handler(runtime, message, state) {
|
|
|
4698
4698
|
prompt
|
|
4699
4699
|
});
|
|
4700
4700
|
if (!response) {
|
|
4701
|
-
logger10.warn("Getting reflection failed - empty response"
|
|
4701
|
+
logger10.warn({ prompt }, "Getting reflection failed - empty response");
|
|
4702
4702
|
return;
|
|
4703
4703
|
}
|
|
4704
4704
|
const reflection = parseKeyValueXml8(response);
|
|
4705
4705
|
if (!reflection) {
|
|
4706
|
-
logger10.warn("Getting reflection failed - failed to parse XML"
|
|
4706
|
+
logger10.warn({ response }, "Getting reflection failed - failed to parse XML");
|
|
4707
4707
|
return;
|
|
4708
4708
|
}
|
|
4709
4709
|
if (!reflection.facts) {
|
|
4710
|
-
logger10.warn("Getting reflection failed - invalid facts structure"
|
|
4710
|
+
logger10.warn({ reflection }, "Getting reflection failed - invalid facts structure");
|
|
4711
4711
|
return;
|
|
4712
4712
|
}
|
|
4713
4713
|
if (!reflection.relationships) {
|
|
4714
|
-
logger10.warn("Getting reflection failed - invalid relationships structure"
|
|
4714
|
+
logger10.warn({ reflection }, "Getting reflection failed - invalid relationships structure");
|
|
4715
4715
|
return;
|
|
4716
4716
|
}
|
|
4717
4717
|
let factsArray = [];
|
|
@@ -4780,7 +4780,7 @@ async function handler(runtime, message, state) {
|
|
|
4780
4780
|
message?.id || ""
|
|
4781
4781
|
);
|
|
4782
4782
|
} catch (error) {
|
|
4783
|
-
logger10.error("Error in reflection handler:"
|
|
4783
|
+
logger10.error({ error }, "Error in reflection handler:");
|
|
4784
4784
|
return;
|
|
4785
4785
|
}
|
|
4786
4786
|
}
|
|
@@ -5106,7 +5106,7 @@ ${values}`;
|
|
|
5106
5106
|
(msg) => msg.content?.type === "action_result" && msg.metadata?.type === "action_result"
|
|
5107
5107
|
);
|
|
5108
5108
|
} catch (error) {
|
|
5109
|
-
logger11?.error("Failed to retrieve action memories:"
|
|
5109
|
+
logger11?.error({ error }, "Failed to retrieve action memories:");
|
|
5110
5110
|
}
|
|
5111
5111
|
let actionMemoriesText = "";
|
|
5112
5112
|
if (recentActionMemories.length > 0) {
|
|
@@ -5352,7 +5352,7 @@ var capabilitiesProvider = {
|
|
|
5352
5352
|
${formattedCapabilities}`
|
|
5353
5353
|
};
|
|
5354
5354
|
} catch (error) {
|
|
5355
|
-
logger12.error("Error in capabilities provider:"
|
|
5355
|
+
logger12.error({ error }, "Error in capabilities provider:");
|
|
5356
5356
|
return {
|
|
5357
5357
|
text: "Error retrieving capabilities from services."
|
|
5358
5358
|
};
|
|
@@ -5531,7 +5531,7 @@ var choiceProvider = {
|
|
|
5531
5531
|
text: output
|
|
5532
5532
|
};
|
|
5533
5533
|
} catch (error) {
|
|
5534
|
-
logger13.error("Error in options provider:"
|
|
5534
|
+
logger13.error({ error }, "Error in options provider:");
|
|
5535
5535
|
return {
|
|
5536
5536
|
data: {
|
|
5537
5537
|
tasks: []
|
|
@@ -5757,7 +5757,7 @@ var factsProvider = {
|
|
|
5757
5757
|
text
|
|
5758
5758
|
};
|
|
5759
5759
|
} catch (error) {
|
|
5760
|
-
logger14.error("Error in factsProvider:"
|
|
5760
|
+
logger14.error({ error }, "Error in factsProvider:");
|
|
5761
5761
|
return {
|
|
5762
5762
|
values: {
|
|
5763
5763
|
facts: ""
|
|
@@ -6010,7 +6010,7 @@ ${runText}`;
|
|
|
6010
6010
|
text
|
|
6011
6011
|
};
|
|
6012
6012
|
} catch (error) {
|
|
6013
|
-
logger15.error("Error in recentMessagesProvider:"
|
|
6013
|
+
logger15.error({ error }, "Error in recentMessagesProvider:");
|
|
6014
6014
|
return {
|
|
6015
6015
|
data: {
|
|
6016
6016
|
recentMessages: [],
|
|
@@ -6513,7 +6513,7 @@ var worldProvider = {
|
|
|
6513
6513
|
dynamic: true,
|
|
6514
6514
|
get: async (runtime, message) => {
|
|
6515
6515
|
try {
|
|
6516
|
-
logger18.debug("[\u{1F310}] World provider activated for roomId:"
|
|
6516
|
+
logger18.debug({ roomId: message.roomId }, "[\u{1F310}] World provider activated for roomId:");
|
|
6517
6517
|
const currentRoom = await runtime.getRoom(message.roomId);
|
|
6518
6518
|
if (!currentRoom) {
|
|
6519
6519
|
logger18.warn(`World provider: Room not found for roomId ${message.roomId}`);
|
|
@@ -6743,7 +6743,7 @@ var TaskService = class _TaskService extends Service {
|
|
|
6743
6743
|
try {
|
|
6744
6744
|
await this.checkTasks();
|
|
6745
6745
|
} catch (error) {
|
|
6746
|
-
logger19.error("[Bootstrap] Error checking tasks:"
|
|
6746
|
+
logger19.error({ error }, "[Bootstrap] Error checking tasks:");
|
|
6747
6747
|
}
|
|
6748
6748
|
}, this.TICK_INTERVAL);
|
|
6749
6749
|
}
|
|
@@ -6772,7 +6772,10 @@ var TaskService = class _TaskService extends Service {
|
|
|
6772
6772
|
continue;
|
|
6773
6773
|
}
|
|
6774
6774
|
} catch (error) {
|
|
6775
|
-
logger19.error(
|
|
6775
|
+
logger19.error(
|
|
6776
|
+
{ error, taskName: task.name },
|
|
6777
|
+
`[Bootstrap] Error validating task ${task.name}:`
|
|
6778
|
+
);
|
|
6776
6779
|
continue;
|
|
6777
6780
|
}
|
|
6778
6781
|
}
|
|
@@ -6827,7 +6830,7 @@ var TaskService = class _TaskService extends Service {
|
|
|
6827
6830
|
}
|
|
6828
6831
|
}
|
|
6829
6832
|
} catch (error) {
|
|
6830
|
-
logger19.error("[Bootstrap] Error checking tasks:"
|
|
6833
|
+
logger19.error({ error }, "[Bootstrap] Error checking tasks:");
|
|
6831
6834
|
}
|
|
6832
6835
|
}
|
|
6833
6836
|
/**
|
|
@@ -6866,7 +6869,7 @@ var TaskService = class _TaskService extends Service {
|
|
|
6866
6869
|
);
|
|
6867
6870
|
}
|
|
6868
6871
|
} catch (error) {
|
|
6869
|
-
logger19.error(`[Bootstrap] Error executing task ${task.id}
|
|
6872
|
+
logger19.error({ error, taskId: task.id }, `[Bootstrap] Error executing task ${task.id}:`);
|
|
6870
6873
|
}
|
|
6871
6874
|
}
|
|
6872
6875
|
/**
|
|
@@ -6960,7 +6963,7 @@ async function processAttachments(attachments, runtime) {
|
|
|
6960
6963
|
runtime.logger.warn(`[Bootstrap] Unexpected response format for image description`);
|
|
6961
6964
|
}
|
|
6962
6965
|
} catch (error) {
|
|
6963
|
-
runtime.logger.error(`[Bootstrap] Error generating image description
|
|
6966
|
+
runtime.logger.error({ error }, `[Bootstrap] Error generating image description:`);
|
|
6964
6967
|
}
|
|
6965
6968
|
} else if (attachment.contentType === ContentType2.DOCUMENT && !attachment.text) {
|
|
6966
6969
|
const res = await fetch(url);
|
|
@@ -6981,7 +6984,10 @@ async function processAttachments(attachments, runtime) {
|
|
|
6981
6984
|
}
|
|
6982
6985
|
processedAttachments.push(processedAttachment);
|
|
6983
6986
|
} catch (error) {
|
|
6984
|
-
runtime.logger.error(
|
|
6987
|
+
runtime.logger.error(
|
|
6988
|
+
{ error, attachmentUrl: attachment.url },
|
|
6989
|
+
`[Bootstrap] Failed to process attachment ${attachment.url}:`
|
|
6990
|
+
);
|
|
6985
6991
|
processedAttachments.push(attachment);
|
|
6986
6992
|
}
|
|
6987
6993
|
}
|
|
@@ -7183,7 +7189,7 @@ ${response}`
|
|
|
7183
7189
|
);
|
|
7184
7190
|
runtime.logger.debug(`[Bootstrap] Response type: ${typeof response}`);
|
|
7185
7191
|
const responseObject = parseKeyValueXml9(response);
|
|
7186
|
-
runtime.logger.debug("[Bootstrap] Parsed response:"
|
|
7192
|
+
runtime.logger.debug({ responseObject }, "[Bootstrap] Parsed response:");
|
|
7187
7193
|
const nonResponseActions = ["IGNORE", "NONE"];
|
|
7188
7194
|
shouldRespond = responseObject?.action && !nonResponseActions.includes(responseObject.action.toUpperCase());
|
|
7189
7195
|
} else {
|
|
@@ -7211,9 +7217,9 @@ ${response}`
|
|
|
7211
7217
|
let response = await runtime.useModel(ModelType14.TEXT_LARGE, {
|
|
7212
7218
|
prompt
|
|
7213
7219
|
});
|
|
7214
|
-
runtime.logger.debug("[Bootstrap] *** Raw LLM Response
|
|
7220
|
+
runtime.logger.debug({ response }, "[Bootstrap] *** Raw LLM Response ***");
|
|
7215
7221
|
const parsedXml = parseKeyValueXml9(response);
|
|
7216
|
-
runtime.logger.debug("[Bootstrap] *** Parsed XML Content
|
|
7222
|
+
runtime.logger.debug({ parsedXml }, "[Bootstrap] *** Parsed XML Content ***");
|
|
7217
7223
|
if (parsedXml) {
|
|
7218
7224
|
responseContent = {
|
|
7219
7225
|
...parsedXml,
|
|
@@ -7229,10 +7235,8 @@ ${response}`
|
|
|
7229
7235
|
retries++;
|
|
7230
7236
|
if (!responseContent?.thought || !responseContent?.actions) {
|
|
7231
7237
|
runtime.logger.warn(
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
parsedXml,
|
|
7235
|
-
responseContent
|
|
7238
|
+
{ response, parsedXml, responseContent },
|
|
7239
|
+
"[Bootstrap] *** Missing required fields (thought or actions), retrying... ***"
|
|
7236
7240
|
);
|
|
7237
7241
|
}
|
|
7238
7242
|
}
|
|
@@ -7287,14 +7291,14 @@ ${response}`
|
|
|
7287
7291
|
if (responseContent && responseContent.simple && responseContent.text) {
|
|
7288
7292
|
if (responseContent.providers && responseContent.providers.length > 0) {
|
|
7289
7293
|
runtime.logger.debug(
|
|
7290
|
-
|
|
7291
|
-
|
|
7294
|
+
{ providers: responseContent.providers },
|
|
7295
|
+
"[Bootstrap] Simple response used providers"
|
|
7292
7296
|
);
|
|
7293
7297
|
}
|
|
7294
7298
|
await callback(responseContent);
|
|
7295
7299
|
} else {
|
|
7296
7300
|
await runtime.processActions(message, responseMessages, state, async (content) => {
|
|
7297
|
-
runtime.logger.debug("action callback"
|
|
7301
|
+
runtime.logger.debug({ content }, "action callback");
|
|
7298
7302
|
if (responseContent) {
|
|
7299
7303
|
responseContent.actionCallbacks = content;
|
|
7300
7304
|
}
|
|
@@ -7306,7 +7310,7 @@ ${response}`
|
|
|
7306
7310
|
state,
|
|
7307
7311
|
shouldRespond,
|
|
7308
7312
|
async (content) => {
|
|
7309
|
-
runtime.logger.debug("evaluate callback"
|
|
7313
|
+
runtime.logger.debug({ content }, "evaluate callback");
|
|
7310
7314
|
if (responseContent) {
|
|
7311
7315
|
responseContent.evalCallbacks = content;
|
|
7312
7316
|
}
|
|
@@ -7476,7 +7480,7 @@ var reactionReceivedHandler = async ({
|
|
|
7476
7480
|
runtime.logger.warn("[Bootstrap] Duplicate reaction memory, skipping");
|
|
7477
7481
|
return;
|
|
7478
7482
|
}
|
|
7479
|
-
runtime.logger.error("[Bootstrap] Error in reaction handler:"
|
|
7483
|
+
runtime.logger.error({ error }, "[Bootstrap] Error in reaction handler:");
|
|
7480
7484
|
}
|
|
7481
7485
|
};
|
|
7482
7486
|
var messageDeletedHandler = async ({
|
|
@@ -7495,9 +7499,12 @@ var messageDeletedHandler = async ({
|
|
|
7495
7499
|
message.roomId
|
|
7496
7500
|
);
|
|
7497
7501
|
await runtime.deleteMemory(message.id);
|
|
7498
|
-
runtime.logger.debug(
|
|
7502
|
+
runtime.logger.debug(
|
|
7503
|
+
{ messageId: message.id },
|
|
7504
|
+
"[Bootstrap] Successfully deleted memory for message"
|
|
7505
|
+
);
|
|
7499
7506
|
} catch (error) {
|
|
7500
|
-
runtime.logger.error("[Bootstrap] Error in message deleted handler:"
|
|
7507
|
+
runtime.logger.error({ error }, "[Bootstrap] Error in message deleted handler:");
|
|
7501
7508
|
}
|
|
7502
7509
|
};
|
|
7503
7510
|
var channelClearedHandler = async ({
|
|
@@ -7521,7 +7528,10 @@ var channelClearedHandler = async ({
|
|
|
7521
7528
|
await runtime.deleteMemory(memory.id);
|
|
7522
7529
|
deletedCount++;
|
|
7523
7530
|
} catch (error) {
|
|
7524
|
-
runtime.logger.warn(
|
|
7531
|
+
runtime.logger.warn(
|
|
7532
|
+
{ error, memoryId: memory.id },
|
|
7533
|
+
`[Bootstrap] Failed to delete message memory ${memory.id}:`
|
|
7534
|
+
);
|
|
7525
7535
|
}
|
|
7526
7536
|
}
|
|
7527
7537
|
}
|
|
@@ -7529,7 +7539,7 @@ var channelClearedHandler = async ({
|
|
|
7529
7539
|
`[Bootstrap] Successfully cleared ${deletedCount}/${memories.length} message memories from channel ${channelId}`
|
|
7530
7540
|
);
|
|
7531
7541
|
} catch (error) {
|
|
7532
|
-
runtime.logger.error("[Bootstrap] Error in channel cleared handler:"
|
|
7542
|
+
runtime.logger.error({ error }, "[Bootstrap] Error in channel cleared handler:");
|
|
7533
7543
|
}
|
|
7534
7544
|
};
|
|
7535
7545
|
var postGeneratedHandler = async ({
|
|
@@ -7639,7 +7649,7 @@ var postGeneratedHandler = async ({
|
|
|
7639
7649
|
if (RM) {
|
|
7640
7650
|
for (const m of RM.data.recentMessages) {
|
|
7641
7651
|
if (cleanedText === m.content.text) {
|
|
7642
|
-
runtime.logger.info("[Bootstrap] Already recently posted that, retrying"
|
|
7652
|
+
runtime.logger.info({ cleanedText }, "[Bootstrap] Already recently posted that, retrying");
|
|
7643
7653
|
postGeneratedHandler({
|
|
7644
7654
|
runtime,
|
|
7645
7655
|
callback,
|
|
@@ -7657,7 +7667,7 @@ var postGeneratedHandler = async ({
|
|
|
7657
7667
|
const googleRefusalRegex = /(i\s+can'?t\s+help\s+with\s+that|that\s+goes\s+against\s+(our\s+)?(policy|policies)|i'?m\s+still\s+learning|response\s+must\s+follow\s+(usage|safety)\s+policies|i'?ve\s+been\s+designed\s+to\s+avoid\s+that)/i;
|
|
7658
7668
|
const generalRefusalRegex = /(response\s+was\s+withheld|content\s+was\s+filtered|this\s+request\s+cannot\s+be\s+completed|violates\s+our\s+safety\s+policy|content\s+is\s+not\s+available)/i;
|
|
7659
7669
|
if (oaiRefusalRegex.test(cleanedText) || anthropicRefusalRegex.test(cleanedText) || googleRefusalRegex.test(cleanedText) || generalRefusalRegex.test(cleanedText)) {
|
|
7660
|
-
runtime.logger.info("[Bootstrap] Got prompt moderation refusal, retrying"
|
|
7670
|
+
runtime.logger.info({ cleanedText }, "[Bootstrap] Got prompt moderation refusal, retrying");
|
|
7661
7671
|
postGeneratedHandler({
|
|
7662
7672
|
runtime,
|
|
7663
7673
|
callback,
|