@elizaos/plugin-bootstrap 1.7.3-alpha.2 → 1.7.3-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.
- package/dist/index.js +1267 -415
- package/dist/index.js.map +23 -20
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -83,13 +83,14 @@ import {
|
|
|
83
83
|
ChannelType as ChannelType9,
|
|
84
84
|
composePromptFromState as composePromptFromState10,
|
|
85
85
|
ContentType as ContentType2,
|
|
86
|
-
createUniqueUuid,
|
|
86
|
+
createUniqueUuid as createUniqueUuid3,
|
|
87
87
|
EventType as EventType2,
|
|
88
88
|
imageDescriptionTemplate,
|
|
89
|
-
logger as
|
|
89
|
+
logger as logger18,
|
|
90
90
|
messageHandlerTemplate,
|
|
91
91
|
ModelType as ModelType15,
|
|
92
92
|
parseKeyValueXml as parseKeyValueXml9,
|
|
93
|
+
parseBooleanFromText as parseBooleanFromText3,
|
|
93
94
|
postCreationTemplate,
|
|
94
95
|
Role as Role2,
|
|
95
96
|
getLocalServerUrl
|
|
@@ -4843,7 +4844,7 @@ var updateEntityAction = {
|
|
|
4843
4844
|
};
|
|
4844
4845
|
// src/evaluators/reflection.ts
|
|
4845
4846
|
import { z } from "zod";
|
|
4846
|
-
import { asUUID,
|
|
4847
|
+
import { asUUID, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
|
|
4847
4848
|
import { composePrompt as composePrompt4 } from "@elizaos/core";
|
|
4848
4849
|
import {
|
|
4849
4850
|
ModelType as ModelType12
|
|
@@ -4922,36 +4923,59 @@ Generate a response in the following format:
|
|
|
4922
4923
|
</response>
|
|
4923
4924
|
|
|
4924
4925
|
IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.`;
|
|
4925
|
-
|
|
4926
|
-
|
|
4926
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4927
|
+
function resolveEntityWithMaps(entityId, entityById, entityByName) {
|
|
4928
|
+
if (UUID_PATTERN.test(entityId)) {
|
|
4927
4929
|
return entityId;
|
|
4928
4930
|
}
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
return entity.id;
|
|
4931
|
+
const byId = entityById.get(entityId);
|
|
4932
|
+
if (byId?.id) {
|
|
4933
|
+
return byId.id;
|
|
4933
4934
|
}
|
|
4934
|
-
|
|
4935
|
-
if (
|
|
4936
|
-
return
|
|
4935
|
+
const byName = entityByName.get(entityId.toLowerCase());
|
|
4936
|
+
if (byName?.id) {
|
|
4937
|
+
return byName.id;
|
|
4937
4938
|
}
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4939
|
+
for (const [id, entity] of entityById) {
|
|
4940
|
+
if (id?.includes(entityId) && entity.id) {
|
|
4941
|
+
return entity.id;
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
for (const entity of entityById.values()) {
|
|
4945
|
+
if (entity.names.some((n) => n.toLowerCase().includes(entityId.toLowerCase())) && entity.id) {
|
|
4946
|
+
return entity.id;
|
|
4947
|
+
}
|
|
4941
4948
|
}
|
|
4942
4949
|
throw new Error(`Could not resolve entityId "${entityId}" to a valid UUID`);
|
|
4943
4950
|
}
|
|
4951
|
+
function buildEntityMaps(entities) {
|
|
4952
|
+
const byId = new Map;
|
|
4953
|
+
const byName = new Map;
|
|
4954
|
+
for (const entity of entities) {
|
|
4955
|
+
if (entity.id) {
|
|
4956
|
+
byId.set(entity.id, entity);
|
|
4957
|
+
}
|
|
4958
|
+
for (const name of entity.names || []) {
|
|
4959
|
+
byName.set(name.toLowerCase(), entity);
|
|
4960
|
+
}
|
|
4961
|
+
}
|
|
4962
|
+
return { byId, byName };
|
|
4963
|
+
}
|
|
4944
4964
|
async function handler(runtime, message, state) {
|
|
4945
|
-
const { agentId, roomId } = message;
|
|
4965
|
+
const { agentId, roomId, entityId } = message;
|
|
4946
4966
|
if (!agentId || !roomId) {
|
|
4947
|
-
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId
|
|
4967
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Missing agentId or roomId in message");
|
|
4948
4968
|
return;
|
|
4949
4969
|
}
|
|
4970
|
+
if (!entityId) {
|
|
4971
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Missing entityId in message");
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4974
|
+
const entitiesProviderResult = state?.data?.providers?.ENTITIES;
|
|
4975
|
+
const entitiesFromState = entitiesProviderResult && typeof entitiesProviderResult === "object" && "data" in entitiesProviderResult && Array.isArray(entitiesProviderResult.data?.entitiesData) ? entitiesProviderResult.data.entitiesData : undefined;
|
|
4950
4976
|
const [existingRelationships, entities, knownFacts] = await Promise.all([
|
|
4951
|
-
runtime.getRelationships({
|
|
4952
|
-
|
|
4953
|
-
}),
|
|
4954
|
-
getEntityDetails({ runtime, roomId }),
|
|
4977
|
+
runtime.getRelationships({ entityId }),
|
|
4978
|
+
entitiesFromState ?? runtime.getEntitiesForRoom(roomId, true),
|
|
4955
4979
|
runtime.getMemories({
|
|
4956
4980
|
tableName: "facts",
|
|
4957
4981
|
roomId,
|
|
@@ -4992,8 +5016,9 @@ async function handler(runtime, message, state) {
|
|
|
4992
5016
|
return;
|
|
4993
5017
|
}
|
|
4994
5018
|
let factsArray = [];
|
|
4995
|
-
|
|
4996
|
-
|
|
5019
|
+
const factsData = reflection.facts;
|
|
5020
|
+
if (factsData.fact) {
|
|
5021
|
+
factsArray = Array.isArray(factsData.fact) ? factsData.fact : [factsData.fact];
|
|
4997
5022
|
}
|
|
4998
5023
|
const newFacts = factsArray.filter((fact) => fact != null && fact.already_known === "false" && fact.in_bio === "false" && typeof fact.claim === "string" && fact.claim.trim() !== "");
|
|
4999
5024
|
await Promise.all(newFacts.map(async (fact) => {
|
|
@@ -5011,28 +5036,36 @@ async function handler(runtime, message, state) {
|
|
|
5011
5036
|
return createdMemory;
|
|
5012
5037
|
}));
|
|
5013
5038
|
let relationshipsArray = [];
|
|
5014
|
-
|
|
5015
|
-
|
|
5039
|
+
const relationshipsData = reflection.relationships;
|
|
5040
|
+
if (relationshipsData.relationship) {
|
|
5041
|
+
relationshipsArray = Array.isArray(relationshipsData.relationship) ? relationshipsData.relationship : [relationshipsData.relationship];
|
|
5042
|
+
}
|
|
5043
|
+
if (relationshipsArray.length === 0) {
|
|
5044
|
+
await runtime.setCache(`${message.roomId}-reflection-last-processed`, message?.id || "");
|
|
5045
|
+
return;
|
|
5046
|
+
}
|
|
5047
|
+
const { byId: entityById, byName: entityByName } = buildEntityMaps(entities);
|
|
5048
|
+
const existingRelationshipMap = new Map;
|
|
5049
|
+
for (const rel of existingRelationships) {
|
|
5050
|
+
const key = `${rel.sourceEntityId}-${rel.targetEntityId}`;
|
|
5051
|
+
existingRelationshipMap.set(key, rel);
|
|
5016
5052
|
}
|
|
5053
|
+
const relationshipPromises = [];
|
|
5017
5054
|
for (const relationship of relationshipsArray) {
|
|
5018
5055
|
if (!relationship.sourceEntityId || !relationship.targetEntityId) {
|
|
5019
|
-
|
|
5056
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Skipping relationship with missing entity IDs");
|
|
5020
5057
|
continue;
|
|
5021
5058
|
}
|
|
5022
5059
|
let sourceId;
|
|
5023
5060
|
let targetId;
|
|
5024
5061
|
try {
|
|
5025
|
-
sourceId =
|
|
5026
|
-
targetId =
|
|
5062
|
+
sourceId = resolveEntityWithMaps(relationship.sourceEntityId, entityById, entityByName);
|
|
5063
|
+
targetId = resolveEntityWithMaps(relationship.targetEntityId, entityById, entityByName);
|
|
5027
5064
|
} catch (error) {
|
|
5028
|
-
|
|
5029
|
-
console.warn(`relationship:
|
|
5030
|
-
`, relationship);
|
|
5065
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to resolve relationship entities");
|
|
5031
5066
|
continue;
|
|
5032
5067
|
}
|
|
5033
|
-
const existingRelationship =
|
|
5034
|
-
return r.sourceEntityId === sourceId && r.targetEntityId === targetId;
|
|
5035
|
-
});
|
|
5068
|
+
const existingRelationship = existingRelationshipMap.get(`${sourceId}-${targetId}`);
|
|
5036
5069
|
const tags = relationship.tags ? relationship.tags.split(",").map((tag) => tag.trim()).filter(Boolean) : [];
|
|
5037
5070
|
if (existingRelationship) {
|
|
5038
5071
|
const updatedMetadata = {
|
|
@@ -5040,13 +5073,13 @@ async function handler(runtime, message, state) {
|
|
|
5040
5073
|
interactions: (existingRelationship.metadata?.interactions || 0) + 1
|
|
5041
5074
|
};
|
|
5042
5075
|
const updatedTags = Array.from(new Set([...existingRelationship.tags || [], ...tags]));
|
|
5043
|
-
|
|
5076
|
+
relationshipPromises.push(runtime.updateRelationship({
|
|
5044
5077
|
...existingRelationship,
|
|
5045
5078
|
tags: updatedTags,
|
|
5046
5079
|
metadata: updatedMetadata
|
|
5047
|
-
});
|
|
5080
|
+
}).then(() => {}));
|
|
5048
5081
|
} else {
|
|
5049
|
-
|
|
5082
|
+
relationshipPromises.push(runtime.createRelationship({
|
|
5050
5083
|
sourceEntityId: sourceId,
|
|
5051
5084
|
targetEntityId: targetId,
|
|
5052
5085
|
tags,
|
|
@@ -5054,16 +5087,15 @@ async function handler(runtime, message, state) {
|
|
|
5054
5087
|
interactions: 1,
|
|
5055
5088
|
...relationship.metadata || {}
|
|
5056
5089
|
}
|
|
5057
|
-
});
|
|
5090
|
+
}).then(() => {}));
|
|
5058
5091
|
}
|
|
5059
5092
|
}
|
|
5093
|
+
if (relationshipPromises.length > 0) {
|
|
5094
|
+
await Promise.all(relationshipPromises);
|
|
5095
|
+
}
|
|
5060
5096
|
await runtime.setCache(`${message.roomId}-reflection-last-processed`, message?.id || "");
|
|
5061
5097
|
} catch (error) {
|
|
5062
|
-
runtime.logger.error({
|
|
5063
|
-
src: "plugin:bootstrap:evaluator:reflection",
|
|
5064
|
-
agentId: runtime.agentId,
|
|
5065
|
-
error: error instanceof Error ? error.message : String(error)
|
|
5066
|
-
}, "Error in reflection handler");
|
|
5098
|
+
runtime.logger.error({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in reflection handler");
|
|
5067
5099
|
return;
|
|
5068
5100
|
}
|
|
5069
5101
|
}
|
|
@@ -5071,20 +5103,28 @@ var reflectionEvaluator = {
|
|
|
5071
5103
|
name: "REFLECTION",
|
|
5072
5104
|
similes: ["REFLECT", "SELF_REFLECT", "EVALUATE_INTERACTION", "ASSESS_SITUATION"],
|
|
5073
5105
|
validate: async (runtime, message) => {
|
|
5106
|
+
if (!message.roomId) {
|
|
5107
|
+
return false;
|
|
5108
|
+
}
|
|
5109
|
+
const reflectionInterval = Math.ceil(runtime.getConversationLength() / 4);
|
|
5074
5110
|
const lastMessageId = await runtime.getCache(`${message.roomId}-reflection-last-processed`);
|
|
5075
5111
|
const messages = await runtime.getMemories({
|
|
5076
5112
|
tableName: "messages",
|
|
5077
5113
|
roomId: message.roomId,
|
|
5078
|
-
count: runtime.getConversationLength()
|
|
5114
|
+
count: runtime.getConversationLength(),
|
|
5115
|
+
unique: false
|
|
5079
5116
|
});
|
|
5117
|
+
if (messages.length === 0) {
|
|
5118
|
+
return false;
|
|
5119
|
+
}
|
|
5120
|
+
let messagesSinceReflection = messages.length;
|
|
5080
5121
|
if (lastMessageId) {
|
|
5081
5122
|
const lastMessageIndex = messages.findIndex((msg) => msg.id === lastMessageId);
|
|
5082
5123
|
if (lastMessageIndex !== -1) {
|
|
5083
|
-
messages.
|
|
5124
|
+
messagesSinceReflection = messages.length - lastMessageIndex - 1;
|
|
5084
5125
|
}
|
|
5085
5126
|
}
|
|
5086
|
-
|
|
5087
|
-
return messages.length > reflectionInterval;
|
|
5127
|
+
return messagesSinceReflection > reflectionInterval;
|
|
5088
5128
|
},
|
|
5089
5129
|
description: "Generate a self-reflective thought on the conversation, then extract facts and relationships between entities in the conversation.",
|
|
5090
5130
|
handler,
|
|
@@ -5258,7 +5298,7 @@ function formatFacts(facts) {
|
|
|
5258
5298
|
`);
|
|
5259
5299
|
}
|
|
5260
5300
|
// src/providers/actions.ts
|
|
5261
|
-
import { addHeader, composeActionExamples, formatActionNames, formatActions } from "@elizaos/core";
|
|
5301
|
+
import { addHeader, composeActionExamples, formatActionNames, formatActions, logger as logger11 } from "@elizaos/core";
|
|
5262
5302
|
function formatActionsWithParams(actions) {
|
|
5263
5303
|
return actions.map((action) => {
|
|
5264
5304
|
let formatted = `## ${action.name}
|
|
@@ -5301,16 +5341,28 @@ var actionsProvider = {
|
|
|
5301
5341
|
return action;
|
|
5302
5342
|
}
|
|
5303
5343
|
} catch (e) {
|
|
5304
|
-
|
|
5344
|
+
logger11.error({ src: "plugin:bootstrap:provider:actions", agentId: runtime.agentId, action: action.name, error: e instanceof Error ? e.message : String(e) }, "Action validation error");
|
|
5305
5345
|
}
|
|
5306
5346
|
return null;
|
|
5307
5347
|
});
|
|
5308
5348
|
const resolvedActions = await Promise.all(actionPromises);
|
|
5309
|
-
const actionsData = resolvedActions.filter(
|
|
5349
|
+
const actionsData = resolvedActions.filter((a) => a !== null);
|
|
5350
|
+
if (actionsData.length === 0) {
|
|
5351
|
+
return {
|
|
5352
|
+
data: { actionsData: [] },
|
|
5353
|
+
values: {
|
|
5354
|
+
actionNames: "Possible response actions: none",
|
|
5355
|
+
actionExamples: "",
|
|
5356
|
+
actionsWithDescriptions: "",
|
|
5357
|
+
actionsWithParams: ""
|
|
5358
|
+
},
|
|
5359
|
+
text: "Possible response actions: none"
|
|
5360
|
+
};
|
|
5361
|
+
}
|
|
5310
5362
|
const actionNames = `Possible response actions: ${formatActionNames(actionsData)}`;
|
|
5311
|
-
const actionsWithDescriptions =
|
|
5312
|
-
const
|
|
5313
|
-
const
|
|
5363
|
+
const actionsWithDescriptions = addHeader("# Available Actions", formatActions(actionsData));
|
|
5364
|
+
const actionExamples = addHeader("# Action Examples", composeActionExamples(actionsData, 10));
|
|
5365
|
+
const actionsWithParams = addHeader("# Available Actions with Parameters", formatActionsWithParams(actionsData));
|
|
5314
5366
|
const data = {
|
|
5315
5367
|
actionsData
|
|
5316
5368
|
};
|
|
@@ -5320,7 +5372,7 @@ var actionsProvider = {
|
|
|
5320
5372
|
actionsWithDescriptions,
|
|
5321
5373
|
actionsWithParams
|
|
5322
5374
|
};
|
|
5323
|
-
const text = [actionNames, actionsWithDescriptions, actionExamples].
|
|
5375
|
+
const text = [actionNames, actionsWithDescriptions, actionExamples].join(`
|
|
5324
5376
|
|
|
5325
5377
|
`);
|
|
5326
5378
|
return {
|
|
@@ -5333,12 +5385,13 @@ var actionsProvider = {
|
|
|
5333
5385
|
// src/providers/actionState.ts
|
|
5334
5386
|
import {
|
|
5335
5387
|
addHeader as addHeader2,
|
|
5336
|
-
logger as
|
|
5388
|
+
logger as logger12
|
|
5337
5389
|
} from "@elizaos/core";
|
|
5338
5390
|
var actionStateProvider = {
|
|
5339
5391
|
name: "ACTION_STATE",
|
|
5340
5392
|
description: "Previous action results, working memory, and action plan from the current execution run",
|
|
5341
5393
|
position: 150,
|
|
5394
|
+
dynamic: true,
|
|
5342
5395
|
get: async (runtime, message, state) => {
|
|
5343
5396
|
const actionResults = state.data?.actionResults || [];
|
|
5344
5397
|
const actionPlan = state.data?.actionPlan || null;
|
|
@@ -5428,7 +5481,7 @@ ${values}`;
|
|
|
5428
5481
|
});
|
|
5429
5482
|
recentActionMemories = recentMessages.filter((msg) => msg.content?.type === "action_result" && msg.metadata?.type === "action_result");
|
|
5430
5483
|
} catch (error) {
|
|
5431
|
-
|
|
5484
|
+
logger12?.error({
|
|
5432
5485
|
src: "plugin:bootstrap:provider:action_state",
|
|
5433
5486
|
agentId: runtime.agentId,
|
|
5434
5487
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -5513,7 +5566,10 @@ var anxietyProvider = {
|
|
|
5513
5566
|
"You frequently over-explain simple concepts. If you can't be concise and confident in your response, please default to using IGNORE.",
|
|
5514
5567
|
"Your helpful nature sometimes results in verbose, meandering responses. When in doubt, use IGNORE rather than attempting to cover every possibility.",
|
|
5515
5568
|
"Like many AI assistants, you try to be too comprehensive. Remember that IGNORE is a valid response when you can't be both brief and certain.",
|
|
5516
|
-
"You often provide more detail than necessary in an attempt to be thorough. If you can't give a clear, concise answer, please use IGNORE instead."
|
|
5569
|
+
"You often provide more detail than necessary in an attempt to be thorough. If you can't give a clear, concise answer, please use IGNORE instead.",
|
|
5570
|
+
"CRITICAL: When someone just says 'ok', 'yes', 'good', 'right', 'yep', etc. - this is conversational closure. Do NOT respond with another acknowledgment. Use IGNORE to let the conversation end naturally.",
|
|
5571
|
+
"Watch out for ping-pong loops: if you and another agent are just exchanging brief acknowledgments back and forth ('Good.' 'Yep.' 'Right.' 'Sure.'), STOP immediately. Use IGNORE.",
|
|
5572
|
+
"If the last few messages are just short confirmations going back and forth, the conversation is OVER. Do not extend it with another acknowledgment. Use IGNORE."
|
|
5517
5573
|
];
|
|
5518
5574
|
const directAnxietyExamples = [
|
|
5519
5575
|
"Be engaging and helpful in direct conversations, but keep responses focused and relevant.",
|
|
@@ -5617,13 +5673,22 @@ var attachmentsProvider = {
|
|
|
5617
5673
|
allAttachments = [...currentMessageAttachments, ...recentAttachments];
|
|
5618
5674
|
}
|
|
5619
5675
|
}
|
|
5620
|
-
const formattedAttachments = allAttachments.map((attachment) =>
|
|
5676
|
+
const formattedAttachments = allAttachments.map((attachment) => {
|
|
5677
|
+
let displayUrl = attachment.url;
|
|
5678
|
+
if (attachment.url?.startsWith("data:")) {
|
|
5679
|
+
const mimeMatch = attachment.url.match(/^data:([^;,]+)/);
|
|
5680
|
+
const mimeType = mimeMatch ? mimeMatch[1] : "unknown";
|
|
5681
|
+
const sizeEstimate = Math.round(attachment.url.length * 3 / 4 / 1024);
|
|
5682
|
+
displayUrl = `[Embedded ${mimeType} ~${sizeEstimate}KB]`;
|
|
5683
|
+
}
|
|
5684
|
+
return `ID: ${attachment.id}
|
|
5621
5685
|
Name: ${attachment.title}
|
|
5622
|
-
URL: ${
|
|
5623
|
-
Type: ${attachment.source}
|
|
5686
|
+
URL: ${displayUrl}
|
|
5687
|
+
Type: ${attachment.source || attachment.contentType}
|
|
5624
5688
|
Description: ${attachment.description}
|
|
5625
5689
|
Text: ${attachment.text}
|
|
5626
|
-
|
|
5690
|
+
`;
|
|
5691
|
+
}).join(`
|
|
5627
5692
|
`);
|
|
5628
5693
|
const text = formattedAttachments && formattedAttachments.length > 0 ? addHeader4("# Attachments", formattedAttachments) : "";
|
|
5629
5694
|
const values = {
|
|
@@ -5688,65 +5753,400 @@ ${formattedCapabilities}`
|
|
|
5688
5753
|
};
|
|
5689
5754
|
// src/providers/character.ts
|
|
5690
5755
|
import { addHeader as addHeader5, ChannelType as ChannelType4 } from "@elizaos/core";
|
|
5756
|
+
|
|
5757
|
+
// src/providers/shared-cache.ts
|
|
5758
|
+
import { createUniqueUuid, getSalt as getSalt2, unsaltWorldSettings as unsaltWorldSettings2 } from "@elizaos/core";
|
|
5759
|
+
var CACHE_TTL_MS = 30000;
|
|
5760
|
+
var DB_TIMEOUT_MS = 5000;
|
|
5761
|
+
var NEGATIVE_CACHE_TTL_MS = 60000;
|
|
5762
|
+
var roomCache = new Map;
|
|
5763
|
+
var roomInFlight = new Map;
|
|
5764
|
+
var externalRoomCache = new Map;
|
|
5765
|
+
var worldCache = new Map;
|
|
5766
|
+
var worldInFlight = new Map;
|
|
5767
|
+
var externalWorldCache = new Map;
|
|
5768
|
+
var externalWorldInFlight = new Map;
|
|
5769
|
+
var noServerIdCache = new Map;
|
|
5770
|
+
var noSettingsCache = new Map;
|
|
5771
|
+
async function withTimeout(promise, ms, fallback) {
|
|
5772
|
+
let timeoutId;
|
|
5773
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
5774
|
+
timeoutId = setTimeout(() => resolve(fallback), ms);
|
|
5775
|
+
});
|
|
5776
|
+
try {
|
|
5777
|
+
return await Promise.race([promise, timeoutPromise]);
|
|
5778
|
+
} finally {
|
|
5779
|
+
clearTimeout(timeoutId);
|
|
5780
|
+
}
|
|
5781
|
+
}
|
|
5782
|
+
function cleanupCache(cache, maxSize, ttl) {
|
|
5783
|
+
if (cache.size <= maxSize)
|
|
5784
|
+
return;
|
|
5785
|
+
const now = Date.now();
|
|
5786
|
+
for (const [key, entry] of cache) {
|
|
5787
|
+
if (now - entry.timestamp > ttl * 2) {
|
|
5788
|
+
cache.delete(key);
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
function getExternalRoomKey(room) {
|
|
5793
|
+
if (!room.source || !room.channelId)
|
|
5794
|
+
return null;
|
|
5795
|
+
return `${room.source}:${room.channelId}`;
|
|
5796
|
+
}
|
|
5797
|
+
function cacheRoomByExternalId(room) {
|
|
5798
|
+
const key = getExternalRoomKey(room);
|
|
5799
|
+
if (!key)
|
|
5800
|
+
return;
|
|
5801
|
+
const externalData = {
|
|
5802
|
+
name: room.name,
|
|
5803
|
+
source: room.source,
|
|
5804
|
+
type: room.type,
|
|
5805
|
+
channelId: room.channelId,
|
|
5806
|
+
messageServerId: room.messageServerId ?? room.serverId,
|
|
5807
|
+
metadata: room.metadata
|
|
5808
|
+
};
|
|
5809
|
+
externalRoomCache.set(key, { data: externalData, timestamp: Date.now() });
|
|
5810
|
+
}
|
|
5811
|
+
async function getCachedRoom(runtime, roomId) {
|
|
5812
|
+
const cacheKey = roomId;
|
|
5813
|
+
const cached = roomCache.get(cacheKey);
|
|
5814
|
+
const now = Date.now();
|
|
5815
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
5816
|
+
return cached.data;
|
|
5817
|
+
}
|
|
5818
|
+
const inFlight = roomInFlight.get(cacheKey);
|
|
5819
|
+
if (inFlight) {
|
|
5820
|
+
return inFlight;
|
|
5821
|
+
}
|
|
5822
|
+
const fetchPromise = (async () => {
|
|
5823
|
+
try {
|
|
5824
|
+
const room = await withTimeout(runtime.getRoom(roomId), DB_TIMEOUT_MS, null);
|
|
5825
|
+
roomCache.set(cacheKey, { data: room, timestamp: Date.now() });
|
|
5826
|
+
if (room) {
|
|
5827
|
+
cacheRoomByExternalId(room);
|
|
5828
|
+
}
|
|
5829
|
+
return room;
|
|
5830
|
+
} finally {
|
|
5831
|
+
roomInFlight.delete(cacheKey);
|
|
5832
|
+
}
|
|
5833
|
+
})();
|
|
5834
|
+
roomInFlight.set(cacheKey, fetchPromise);
|
|
5835
|
+
cleanupCache(roomCache, 500, CACHE_TTL_MS);
|
|
5836
|
+
return fetchPromise;
|
|
5837
|
+
}
|
|
5838
|
+
function getCachedRoomByExternalId(source, channelId) {
|
|
5839
|
+
const key = `${source}:${channelId}`;
|
|
5840
|
+
const cached = externalRoomCache.get(key);
|
|
5841
|
+
const now = Date.now();
|
|
5842
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
5843
|
+
return cached.data;
|
|
5844
|
+
}
|
|
5845
|
+
return null;
|
|
5846
|
+
}
|
|
5847
|
+
function invalidateRoomCacheInternal(roomId) {
|
|
5848
|
+
roomCache.delete(roomId);
|
|
5849
|
+
}
|
|
5850
|
+
function invalidateRoomCache(agentId, roomId) {
|
|
5851
|
+
invalidateRoomCacheInternal(roomId);
|
|
5852
|
+
invalidateEntitiesCache(agentId, roomId);
|
|
5853
|
+
}
|
|
5854
|
+
function invalidateRoomCacheByExternalId(source, channelId) {
|
|
5855
|
+
externalRoomCache.delete(`${source}:${channelId}`);
|
|
5856
|
+
}
|
|
5857
|
+
function getExternalWorldKey(world) {
|
|
5858
|
+
const serverId = world.messageServerId;
|
|
5859
|
+
if (!serverId)
|
|
5860
|
+
return null;
|
|
5861
|
+
return `guild:${serverId}`;
|
|
5862
|
+
}
|
|
5863
|
+
function cacheWorldByExternalId(world) {
|
|
5864
|
+
const key = getExternalWorldKey(world);
|
|
5865
|
+
if (!key)
|
|
5866
|
+
return;
|
|
5867
|
+
const externalData = {
|
|
5868
|
+
name: world.name,
|
|
5869
|
+
messageServerId: world.messageServerId,
|
|
5870
|
+
metadata: world.metadata
|
|
5871
|
+
};
|
|
5872
|
+
if (world.metadata?.settings) {
|
|
5873
|
+
try {
|
|
5874
|
+
const salt = getSalt2();
|
|
5875
|
+
externalData.settings = unsaltWorldSettings2(world.metadata.settings, salt);
|
|
5876
|
+
} catch {}
|
|
5877
|
+
}
|
|
5878
|
+
externalWorldCache.set(key, { data: externalData, timestamp: Date.now() });
|
|
5879
|
+
}
|
|
5880
|
+
async function getCachedWorld(runtime, worldId) {
|
|
5881
|
+
const cacheKey = worldId;
|
|
5882
|
+
const cached = worldCache.get(cacheKey);
|
|
5883
|
+
const now = Date.now();
|
|
5884
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
5885
|
+
return cached.data;
|
|
5886
|
+
}
|
|
5887
|
+
const inFlight = worldInFlight.get(cacheKey);
|
|
5888
|
+
if (inFlight) {
|
|
5889
|
+
return inFlight;
|
|
5890
|
+
}
|
|
5891
|
+
const fetchPromise = (async () => {
|
|
5892
|
+
try {
|
|
5893
|
+
const world = await withTimeout(runtime.getWorld(worldId), DB_TIMEOUT_MS, null);
|
|
5894
|
+
worldCache.set(cacheKey, { data: world, timestamp: Date.now() });
|
|
5895
|
+
if (world) {
|
|
5896
|
+
cacheWorldByExternalId(world);
|
|
5897
|
+
}
|
|
5898
|
+
return world;
|
|
5899
|
+
} finally {
|
|
5900
|
+
worldInFlight.delete(cacheKey);
|
|
5901
|
+
}
|
|
5902
|
+
})();
|
|
5903
|
+
worldInFlight.set(cacheKey, fetchPromise);
|
|
5904
|
+
cleanupCache(worldCache, 200, CACHE_TTL_MS);
|
|
5905
|
+
return fetchPromise;
|
|
5906
|
+
}
|
|
5907
|
+
function getCachedSettingsByServerId(serverId) {
|
|
5908
|
+
const key = `guild:${serverId}`;
|
|
5909
|
+
const cached = externalWorldCache.get(key);
|
|
5910
|
+
const now = Date.now();
|
|
5911
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS && cached.data?.settings) {
|
|
5912
|
+
return cached.data.settings;
|
|
5913
|
+
}
|
|
5914
|
+
return null;
|
|
5915
|
+
}
|
|
5916
|
+
function hasNoSettings(serverId) {
|
|
5917
|
+
const cached = noSettingsCache.get(serverId);
|
|
5918
|
+
const now = Date.now();
|
|
5919
|
+
if (cached && now - cached.timestamp < NEGATIVE_CACHE_TTL_MS) {
|
|
5920
|
+
return cached.data;
|
|
5921
|
+
}
|
|
5922
|
+
return false;
|
|
5923
|
+
}
|
|
5924
|
+
function markNoSettings(serverId) {
|
|
5925
|
+
noSettingsCache.set(serverId, { data: true, timestamp: Date.now() });
|
|
5926
|
+
}
|
|
5927
|
+
function invalidateWorldCache(worldId) {
|
|
5928
|
+
worldCache.delete(worldId);
|
|
5929
|
+
noServerIdCache.delete(worldId);
|
|
5930
|
+
}
|
|
5931
|
+
function invalidateWorldCacheByServerId(serverId) {
|
|
5932
|
+
externalWorldCache.delete(`guild:${serverId}`);
|
|
5933
|
+
noSettingsCache.delete(serverId);
|
|
5934
|
+
}
|
|
5935
|
+
function hasNoServerId(worldId) {
|
|
5936
|
+
const cached = noServerIdCache.get(worldId);
|
|
5937
|
+
const now = Date.now();
|
|
5938
|
+
if (cached && now - cached.timestamp < NEGATIVE_CACHE_TTL_MS) {
|
|
5939
|
+
return cached.data;
|
|
5940
|
+
}
|
|
5941
|
+
return false;
|
|
5942
|
+
}
|
|
5943
|
+
function markNoServerId(worldId) {
|
|
5944
|
+
noServerIdCache.set(worldId, { data: true, timestamp: Date.now() });
|
|
5945
|
+
}
|
|
5946
|
+
var entitiesCache = new Map;
|
|
5947
|
+
var entitiesInFlight = new Map;
|
|
5948
|
+
async function getCachedEntitiesForRoom(runtime, roomId) {
|
|
5949
|
+
const cacheKey = `${runtime.agentId}:${roomId}`;
|
|
5950
|
+
const cached = entitiesCache.get(cacheKey);
|
|
5951
|
+
const now = Date.now();
|
|
5952
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
5953
|
+
return cached.data;
|
|
5954
|
+
}
|
|
5955
|
+
const inFlight = entitiesInFlight.get(cacheKey);
|
|
5956
|
+
if (inFlight) {
|
|
5957
|
+
return inFlight;
|
|
5958
|
+
}
|
|
5959
|
+
const fetchPromise = (async () => {
|
|
5960
|
+
try {
|
|
5961
|
+
const entities = await withTimeout(runtime.getEntitiesForRoom(roomId, true), DB_TIMEOUT_MS, []);
|
|
5962
|
+
entitiesCache.set(cacheKey, { data: entities, timestamp: Date.now() });
|
|
5963
|
+
return entities;
|
|
5964
|
+
} finally {
|
|
5965
|
+
entitiesInFlight.delete(cacheKey);
|
|
5966
|
+
}
|
|
5967
|
+
})();
|
|
5968
|
+
entitiesInFlight.set(cacheKey, fetchPromise);
|
|
5969
|
+
cleanupCache(entitiesCache, 500, CACHE_TTL_MS);
|
|
5970
|
+
return fetchPromise;
|
|
5971
|
+
}
|
|
5972
|
+
function invalidateEntitiesCache(agentId, roomId) {
|
|
5973
|
+
const cacheKey = `${agentId}:${roomId}`;
|
|
5974
|
+
entitiesCache.delete(cacheKey);
|
|
5975
|
+
}
|
|
5976
|
+
var worldSettingsCache = new Map;
|
|
5977
|
+
var worldSettingsInFlight = new Map;
|
|
5978
|
+
function extractWorldSettings(world) {
|
|
5979
|
+
if (!world) {
|
|
5980
|
+
return null;
|
|
5981
|
+
}
|
|
5982
|
+
if (world.messageServerId) {
|
|
5983
|
+
const cachedSettings = getCachedSettingsByServerId(world.messageServerId);
|
|
5984
|
+
if (cachedSettings) {
|
|
5985
|
+
return cachedSettings;
|
|
5986
|
+
}
|
|
5987
|
+
}
|
|
5988
|
+
if (!world.metadata?.settings) {
|
|
5989
|
+
if (world.messageServerId) {
|
|
5990
|
+
markNoSettings(world.messageServerId);
|
|
5991
|
+
}
|
|
5992
|
+
return null;
|
|
5993
|
+
}
|
|
5994
|
+
const saltedSettings = world.metadata.settings;
|
|
5995
|
+
const salt = getSalt2();
|
|
5996
|
+
const settings = unsaltWorldSettings2(saltedSettings, salt);
|
|
5997
|
+
if (world.messageServerId && settings) {
|
|
5998
|
+
const key = `guild:${world.messageServerId}`;
|
|
5999
|
+
const externalData = {
|
|
6000
|
+
name: world.name,
|
|
6001
|
+
messageServerId: world.messageServerId,
|
|
6002
|
+
metadata: world.metadata,
|
|
6003
|
+
settings
|
|
6004
|
+
};
|
|
6005
|
+
externalWorldCache.set(key, { data: externalData, timestamp: Date.now() });
|
|
6006
|
+
}
|
|
6007
|
+
return settings;
|
|
6008
|
+
}
|
|
6009
|
+
async function getCachedWorldSettings(runtime, serverId) {
|
|
6010
|
+
const cacheKey = `${runtime.agentId}:${serverId}`;
|
|
6011
|
+
const cached = worldSettingsCache.get(cacheKey);
|
|
6012
|
+
const now = Date.now();
|
|
6013
|
+
if (cached && now - cached.timestamp < CACHE_TTL_MS) {
|
|
6014
|
+
return cached.data;
|
|
6015
|
+
}
|
|
6016
|
+
const inFlight = worldSettingsInFlight.get(cacheKey);
|
|
6017
|
+
if (inFlight) {
|
|
6018
|
+
return inFlight;
|
|
6019
|
+
}
|
|
6020
|
+
const fetchPromise = (async () => {
|
|
6021
|
+
try {
|
|
6022
|
+
const worldId = createUniqueUuid(runtime, serverId);
|
|
6023
|
+
const world = await getCachedWorld(runtime, worldId);
|
|
6024
|
+
const settings = extractWorldSettings(world);
|
|
6025
|
+
worldSettingsCache.set(cacheKey, { data: settings, timestamp: Date.now() });
|
|
6026
|
+
return settings;
|
|
6027
|
+
} finally {
|
|
6028
|
+
worldSettingsInFlight.delete(cacheKey);
|
|
6029
|
+
}
|
|
6030
|
+
})();
|
|
6031
|
+
worldSettingsInFlight.set(cacheKey, fetchPromise);
|
|
6032
|
+
cleanupCache(worldSettingsCache, 200, CACHE_TTL_MS);
|
|
6033
|
+
return fetchPromise;
|
|
6034
|
+
}
|
|
6035
|
+
function getCacheStats() {
|
|
6036
|
+
return {
|
|
6037
|
+
rooms: roomCache.size,
|
|
6038
|
+
roomsInFlight: roomInFlight.size,
|
|
6039
|
+
worlds: worldCache.size,
|
|
6040
|
+
worldsInFlight: worldInFlight.size,
|
|
6041
|
+
entities: entitiesCache.size,
|
|
6042
|
+
entitiesInFlight: entitiesInFlight.size,
|
|
6043
|
+
worldSettings: worldSettingsCache.size,
|
|
6044
|
+
worldSettingsInFlight: worldSettingsInFlight.size,
|
|
6045
|
+
externalRooms: externalRoomCache.size,
|
|
6046
|
+
externalWorlds: externalWorldCache.size,
|
|
6047
|
+
externalWorldsInFlight: externalWorldInFlight.size,
|
|
6048
|
+
noServerIds: noServerIdCache.size,
|
|
6049
|
+
noSettings: noSettingsCache.size
|
|
6050
|
+
};
|
|
6051
|
+
}
|
|
6052
|
+
|
|
6053
|
+
// src/providers/character.ts
|
|
5691
6054
|
var characterProvider = {
|
|
5692
6055
|
name: "CHARACTER",
|
|
5693
6056
|
description: "Character information",
|
|
5694
|
-
get: async (runtime, message,
|
|
6057
|
+
get: async (runtime, message, _state) => {
|
|
5695
6058
|
const character = runtime.character;
|
|
6059
|
+
const room = message.roomId ? await getCachedRoom(runtime, message.roomId) : null;
|
|
6060
|
+
const isPostFormat = room?.type === ChannelType4.FEED || room?.type === ChannelType4.THREAD;
|
|
5696
6061
|
const agentName = character.name;
|
|
5697
6062
|
const bioText = Array.isArray(character.bio) ? character.bio.sort(() => 0.5 - Math.random()).slice(0, 10).join(" ") : character.bio || "";
|
|
5698
6063
|
const bio = addHeader5(`# About ${character.name}`, bioText);
|
|
5699
6064
|
const system = character.system ?? "";
|
|
5700
6065
|
const topicString = character.topics && character.topics.length > 0 ? character.topics[Math.floor(Math.random() * character.topics.length)] : null;
|
|
5701
6066
|
const topic = topicString || "";
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
6067
|
+
let topics = "";
|
|
6068
|
+
if (character.topics && character.topics.length > 0) {
|
|
6069
|
+
const filteredTopics = character.topics.filter((t) => t !== topicString);
|
|
6070
|
+
for (let i = filteredTopics.length - 1;i > 0; i--) {
|
|
6071
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
6072
|
+
[filteredTopics[i], filteredTopics[j]] = [filteredTopics[j], filteredTopics[i]];
|
|
6073
|
+
}
|
|
6074
|
+
const selectedTopics = filteredTopics.slice(0, 5);
|
|
6075
|
+
if (selectedTopics.length > 0) {
|
|
6076
|
+
const topicsList = selectedTopics.map((t, index, array) => {
|
|
6077
|
+
if (index === array.length - 2)
|
|
6078
|
+
return `${t} and `;
|
|
6079
|
+
if (index === array.length - 1)
|
|
6080
|
+
return t;
|
|
6081
|
+
return `${t}, `;
|
|
6082
|
+
}).join("");
|
|
6083
|
+
topics = `${character.name} is also interested in ${topicsList}`;
|
|
5705
6084
|
}
|
|
5706
|
-
|
|
5707
|
-
return topic2;
|
|
5708
|
-
}
|
|
5709
|
-
return `${topic2}, `;
|
|
5710
|
-
}).join("")}` : "";
|
|
6085
|
+
}
|
|
5711
6086
|
const adjectiveString = character.adjectives && character.adjectives.length > 0 ? character.adjectives[Math.floor(Math.random() * character.adjectives.length)] : "";
|
|
5712
6087
|
const adjective = adjectiveString || "";
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
6088
|
+
let characterPostExamples = "";
|
|
6089
|
+
let characterMessageExamples = "";
|
|
6090
|
+
if (isPostFormat) {
|
|
6091
|
+
if (character.postExamples && character.postExamples.length > 0) {
|
|
6092
|
+
const shuffledPosts = [...character.postExamples];
|
|
6093
|
+
for (let i = shuffledPosts.length - 1;i > 0; i--) {
|
|
6094
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
6095
|
+
[shuffledPosts[i], shuffledPosts[j]] = [shuffledPosts[j], shuffledPosts[i]];
|
|
6096
|
+
}
|
|
6097
|
+
const formattedPosts = shuffledPosts.slice(0, 50).join(`
|
|
5717
6098
|
`);
|
|
5718
|
-
|
|
5719
|
-
`, "").length > 0
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
6099
|
+
if (formattedPosts.replaceAll(`
|
|
6100
|
+
`, "").length > 0) {
|
|
6101
|
+
characterPostExamples = addHeader5(`# Example Posts for ${character.name}`, formattedPosts);
|
|
6102
|
+
}
|
|
6103
|
+
}
|
|
6104
|
+
} else {
|
|
6105
|
+
if (character.messageExamples && character.messageExamples.length > 0) {
|
|
6106
|
+
const shuffledMessages = [...character.messageExamples];
|
|
6107
|
+
for (let i = shuffledMessages.length - 1;i > 0; i--) {
|
|
6108
|
+
const j = Math.floor(Math.random() * (i + 1));
|
|
6109
|
+
[shuffledMessages[i], shuffledMessages[j]] = [shuffledMessages[j], shuffledMessages[i]];
|
|
6110
|
+
}
|
|
6111
|
+
const formattedMessages = shuffledMessages.slice(0, 5).map((example) => {
|
|
6112
|
+
const exampleNames = Array.from({ length: 5 }, () => Math.random().toString(36).substring(2, 8));
|
|
6113
|
+
return example.map((msg) => {
|
|
6114
|
+
let messageString = `${msg.name}: ${msg.content.text}${msg.content.action || msg.content.actions ? ` (actions: ${msg.content.action || msg.content.actions?.join(", ")})` : ""}`;
|
|
6115
|
+
exampleNames.forEach((name, index) => {
|
|
6116
|
+
const placeholder = `{{name${index + 1}}}`;
|
|
6117
|
+
messageString = messageString.replaceAll(placeholder, name);
|
|
6118
|
+
});
|
|
6119
|
+
return messageString;
|
|
6120
|
+
}).join(`
|
|
5730
6121
|
`);
|
|
5731
|
-
|
|
6122
|
+
}).join(`
|
|
5732
6123
|
|
|
5733
6124
|
`);
|
|
5734
|
-
|
|
5735
|
-
`, "").length > 0
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
`);
|
|
5749
|
-
|
|
6125
|
+
if (formattedMessages.replaceAll(`
|
|
6126
|
+
`, "").length > 0) {
|
|
6127
|
+
characterMessageExamples = addHeader5(`# Example Conversations for ${character.name}`, formattedMessages);
|
|
6128
|
+
}
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
let postDirections = "";
|
|
6132
|
+
let messageDirections = "";
|
|
6133
|
+
if (isPostFormat) {
|
|
6134
|
+
const hasPostStyle = character?.style?.all?.length && character.style.all.length > 0 || character?.style?.post?.length && character.style.post.length > 0;
|
|
6135
|
+
if (hasPostStyle) {
|
|
6136
|
+
const all = character?.style?.all || [];
|
|
6137
|
+
const post = character?.style?.post || [];
|
|
6138
|
+
postDirections = addHeader5(`# Post Directions for ${character.name}`, [...all, ...post].join(`
|
|
6139
|
+
`));
|
|
6140
|
+
}
|
|
6141
|
+
} else {
|
|
6142
|
+
const hasChatStyle = character?.style?.all?.length && character.style.all.length > 0 || character?.style?.chat?.length && character.style.chat.length > 0;
|
|
6143
|
+
if (hasChatStyle) {
|
|
6144
|
+
const all = character?.style?.all || [];
|
|
6145
|
+
const chat = character?.style?.chat || [];
|
|
6146
|
+
messageDirections = addHeader5(`# Message Directions for ${character.name}`, [...all, ...chat].join(`
|
|
6147
|
+
`));
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
5750
6150
|
const directions = isPostFormat ? postDirections : messageDirections;
|
|
5751
6151
|
const examples = isPostFormat ? characterPostExamples : characterMessageExamples;
|
|
5752
6152
|
const values = {
|
|
@@ -5788,6 +6188,7 @@ var characterProvider = {
|
|
|
5788
6188
|
// src/providers/choice.ts
|
|
5789
6189
|
var choiceProvider = {
|
|
5790
6190
|
name: "CHOICE",
|
|
6191
|
+
dynamic: true,
|
|
5791
6192
|
get: async (runtime, message, _state) => {
|
|
5792
6193
|
try {
|
|
5793
6194
|
const pendingTasks = await runtime.getTasks({
|
|
@@ -5878,23 +6279,68 @@ var choiceProvider = {
|
|
|
5878
6279
|
}
|
|
5879
6280
|
};
|
|
5880
6281
|
// src/providers/entities.ts
|
|
5881
|
-
import { addHeader as addHeader6, formatEntities
|
|
6282
|
+
import { addHeader as addHeader6, formatEntities } from "@elizaos/core";
|
|
6283
|
+
var getEntityDetailsOptimized = async (runtime, roomId, room, cachedEntities) => {
|
|
6284
|
+
const roomEntities = cachedEntities ?? await getCachedEntitiesForRoom(runtime, roomId);
|
|
6285
|
+
const uniqueEntities = new Map;
|
|
6286
|
+
for (const entity of roomEntities) {
|
|
6287
|
+
if (!entity.id || uniqueEntities.has(entity.id))
|
|
6288
|
+
continue;
|
|
6289
|
+
const allData = {};
|
|
6290
|
+
for (const component of entity.components || []) {
|
|
6291
|
+
Object.assign(allData, component.data);
|
|
6292
|
+
}
|
|
6293
|
+
const mergedData = {};
|
|
6294
|
+
for (const [key, value] of Object.entries(allData)) {
|
|
6295
|
+
if (!mergedData[key]) {
|
|
6296
|
+
mergedData[key] = value;
|
|
6297
|
+
continue;
|
|
6298
|
+
}
|
|
6299
|
+
if (Array.isArray(mergedData[key]) && Array.isArray(value)) {
|
|
6300
|
+
mergedData[key] = [...new Set([...mergedData[key], ...value])];
|
|
6301
|
+
} else if (typeof mergedData[key] === "object" && typeof value === "object") {
|
|
6302
|
+
mergedData[key] = { ...mergedData[key], ...value };
|
|
6303
|
+
}
|
|
6304
|
+
}
|
|
6305
|
+
uniqueEntities.set(entity.id, {
|
|
6306
|
+
id: entity.id,
|
|
6307
|
+
agentId: entity.agentId,
|
|
6308
|
+
name: room?.source ? entity.metadata[room.source]?.name || entity.names[0] : entity.names[0],
|
|
6309
|
+
names: entity.names,
|
|
6310
|
+
metadata: { ...mergedData, ...entity.metadata }
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6313
|
+
return Array.from(uniqueEntities.values());
|
|
6314
|
+
};
|
|
5882
6315
|
var entitiesProvider = {
|
|
5883
6316
|
name: "ENTITIES",
|
|
5884
6317
|
description: "People in the current conversation",
|
|
5885
6318
|
dynamic: true,
|
|
5886
|
-
get: async (runtime, message) => {
|
|
6319
|
+
get: async (runtime, message, _state) => {
|
|
5887
6320
|
const { roomId, entityId } = message;
|
|
5888
|
-
|
|
6321
|
+
if (!roomId) {
|
|
6322
|
+
return { data: {}, values: { entities: "", senderName: "" }, text: "" };
|
|
6323
|
+
}
|
|
6324
|
+
const room = await getCachedRoom(runtime, roomId);
|
|
6325
|
+
const cachedEntities = await getCachedEntitiesForRoom(runtime, roomId);
|
|
6326
|
+
const entitiesData = await getEntityDetailsOptimized(runtime, roomId, room, cachedEntities);
|
|
6327
|
+
const entityMap = new Map;
|
|
6328
|
+
for (const entity of entitiesData) {
|
|
6329
|
+
if (entity.id) {
|
|
6330
|
+
entityMap.set(entity.id, entity);
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
const senderName = entityMap.get(entityId)?.names[0];
|
|
5889
6334
|
const formattedEntities = formatEntities({ entities: entitiesData ?? [] });
|
|
5890
|
-
const senderName = entitiesData?.find((entity) => entity.id === entityId)?.names[0];
|
|
5891
6335
|
const entities = formattedEntities && formattedEntities.length > 0 ? addHeader6("# People in the Room", formattedEntities) : "";
|
|
5892
6336
|
const data = {
|
|
5893
6337
|
entitiesData,
|
|
5894
|
-
senderName
|
|
6338
|
+
senderName,
|
|
6339
|
+
room
|
|
5895
6340
|
};
|
|
5896
6341
|
const values = {
|
|
5897
|
-
entities
|
|
6342
|
+
entities,
|
|
6343
|
+
senderName
|
|
5898
6344
|
};
|
|
5899
6345
|
return {
|
|
5900
6346
|
data,
|
|
@@ -5905,39 +6351,61 @@ var entitiesProvider = {
|
|
|
5905
6351
|
};
|
|
5906
6352
|
// src/providers/evaluators.ts
|
|
5907
6353
|
var import_unique_names_generator = __toESM(require_dist(), 1);
|
|
5908
|
-
import { addHeader as addHeader7 } from "@elizaos/core";
|
|
6354
|
+
import { addHeader as addHeader7, logger as logger13 } from "@elizaos/core";
|
|
5909
6355
|
function formatEvaluatorNames(evaluators) {
|
|
5910
6356
|
return evaluators.map((evaluator) => `'${evaluator.name}'`).join(`,
|
|
5911
6357
|
`);
|
|
5912
6358
|
}
|
|
5913
6359
|
function formatEvaluatorExamples(evaluators) {
|
|
5914
6360
|
return evaluators.map((evaluator) => {
|
|
5915
|
-
|
|
6361
|
+
const validExamples = (evaluator.examples || []).filter((example) => {
|
|
6362
|
+
if (!example) {
|
|
6363
|
+
logger13.error({ evaluator: evaluator.name }, "Evaluator has null/undefined example - check evaluator implementation");
|
|
6364
|
+
return false;
|
|
6365
|
+
}
|
|
6366
|
+
if (!example.prompt) {
|
|
6367
|
+
logger13.error({ evaluator: evaluator.name }, 'Evaluator example missing required "prompt" field - check evaluator implementation');
|
|
6368
|
+
return false;
|
|
6369
|
+
}
|
|
6370
|
+
if (!example.messages) {
|
|
6371
|
+
logger13.error({ evaluator: evaluator.name }, 'Evaluator example missing required "messages" field - check evaluator implementation');
|
|
6372
|
+
return false;
|
|
6373
|
+
}
|
|
6374
|
+
return true;
|
|
6375
|
+
});
|
|
6376
|
+
return validExamples.map((example) => {
|
|
5916
6377
|
const exampleNames = Array.from({ length: 5 }, () => import_unique_names_generator.uniqueNamesGenerator({ dictionaries: [import_unique_names_generator.names] }));
|
|
5917
6378
|
let formattedPrompt = example.prompt;
|
|
5918
|
-
let formattedOutcome = example.outcome;
|
|
6379
|
+
let formattedOutcome = example.outcome || "";
|
|
5919
6380
|
exampleNames.forEach((name, index) => {
|
|
5920
6381
|
const placeholder = `{{name${index + 1}}}`;
|
|
5921
6382
|
formattedPrompt = formattedPrompt.replaceAll(placeholder, name);
|
|
5922
|
-
|
|
6383
|
+
if (formattedOutcome) {
|
|
6384
|
+
formattedOutcome = formattedOutcome.replaceAll(placeholder, name);
|
|
6385
|
+
}
|
|
5923
6386
|
});
|
|
5924
|
-
const formattedMessages = example.messages.map((message) => {
|
|
6387
|
+
const formattedMessages = (example.messages || []).map((message) => {
|
|
6388
|
+
if (!message?.name || !message?.content?.text) {
|
|
6389
|
+
logger13.error({ evaluator: evaluator.name }, 'Evaluator example message missing "name" or "content.text" - check evaluator implementation');
|
|
6390
|
+
return null;
|
|
6391
|
+
}
|
|
5925
6392
|
let messageString = `${message.name}: ${message.content.text}`;
|
|
5926
6393
|
exampleNames.forEach((name, index) => {
|
|
5927
6394
|
const placeholder = `{{name${index + 1}}}`;
|
|
5928
6395
|
messageString = messageString.replaceAll(placeholder, name);
|
|
5929
6396
|
});
|
|
5930
6397
|
return messageString + (message.content.action || message.content.actions ? ` (${message.content.action || message.content.actions?.join(", ")})` : "");
|
|
5931
|
-
}).join(`
|
|
6398
|
+
}).filter(Boolean).join(`
|
|
5932
6399
|
`);
|
|
6400
|
+
const outcomeSection = formattedOutcome ? `
|
|
6401
|
+
|
|
6402
|
+
Outcome:
|
|
6403
|
+
${formattedOutcome}` : "";
|
|
5933
6404
|
return `Prompt:
|
|
5934
6405
|
${formattedPrompt}
|
|
5935
6406
|
|
|
5936
6407
|
Messages:
|
|
5937
|
-
${formattedMessages}
|
|
5938
|
-
|
|
5939
|
-
Outcome:
|
|
5940
|
-
${formattedOutcome}`;
|
|
6408
|
+
${formattedMessages}${outcomeSection}`;
|
|
5941
6409
|
}).join(`
|
|
5942
6410
|
|
|
5943
6411
|
`);
|
|
@@ -5955,14 +6423,27 @@ var evaluatorsProvider = {
|
|
|
5955
6423
|
private: true,
|
|
5956
6424
|
get: async (runtime, message, state) => {
|
|
5957
6425
|
const evaluatorPromises = runtime.evaluators.map(async (evaluator) => {
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
6426
|
+
try {
|
|
6427
|
+
const result = await evaluator.validate(runtime, message, state);
|
|
6428
|
+
if (result) {
|
|
6429
|
+
return evaluator;
|
|
6430
|
+
}
|
|
6431
|
+
} catch (e) {}
|
|
5962
6432
|
return null;
|
|
5963
6433
|
});
|
|
5964
6434
|
const resolvedEvaluators = await Promise.all(evaluatorPromises);
|
|
5965
|
-
const evaluatorsData = resolvedEvaluators.filter(
|
|
6435
|
+
const evaluatorsData = resolvedEvaluators.filter((e) => e !== null);
|
|
6436
|
+
if (evaluatorsData.length === 0) {
|
|
6437
|
+
return {
|
|
6438
|
+
values: {
|
|
6439
|
+
evaluatorsData: [],
|
|
6440
|
+
evaluators: "",
|
|
6441
|
+
evaluatorNames: "",
|
|
6442
|
+
evaluatorExamples: ""
|
|
6443
|
+
},
|
|
6444
|
+
text: ""
|
|
6445
|
+
};
|
|
6446
|
+
}
|
|
5966
6447
|
const evaluators = evaluatorsData.length > 0 ? addHeader7("# Available Evaluators", formatEvaluators(evaluatorsData)) : "";
|
|
5967
6448
|
const evaluatorNames = evaluatorsData.length > 0 ? formatEvaluatorNames(evaluatorsData) : "";
|
|
5968
6449
|
const evaluatorExamples = evaluatorsData.length > 0 ? addHeader7("# Evaluator Examples", formatEvaluatorExamples(evaluatorsData)) : "";
|
|
@@ -6070,7 +6551,7 @@ var providersProvider = {
|
|
|
6070
6551
|
name: "PROVIDERS",
|
|
6071
6552
|
description: "List of all data providers the agent can use to get additional information",
|
|
6072
6553
|
get: async (runtime, _message, _state) => {
|
|
6073
|
-
const allProviders = runtime.providers;
|
|
6554
|
+
const allProviders = runtime.providers || [];
|
|
6074
6555
|
const dynamicProviders = allProviders.filter((provider) => provider.dynamic === true);
|
|
6075
6556
|
const dynamicDescriptions = dynamicProviders.map((provider) => {
|
|
6076
6557
|
return `- **${provider.name}**: ${provider.description || "No description available"}`;
|
|
@@ -6112,8 +6593,8 @@ import {
|
|
|
6112
6593
|
ChannelType as ChannelType5,
|
|
6113
6594
|
formatMessages,
|
|
6114
6595
|
formatPosts,
|
|
6115
|
-
|
|
6116
|
-
logger as
|
|
6596
|
+
parseBooleanFromText as parseBooleanFromText2,
|
|
6597
|
+
logger as logger14
|
|
6117
6598
|
} from "@elizaos/core";
|
|
6118
6599
|
var getRecentInteractions = async (runtime, sourceEntityId, targetEntityId, excludeRoomId) => {
|
|
6119
6600
|
const rooms = await runtime.getRoomsForParticipants([sourceEntityId, targetEntityId]);
|
|
@@ -6123,39 +6604,92 @@ var getRecentInteractions = async (runtime, sourceEntityId, targetEntityId, excl
|
|
|
6123
6604
|
limit: 20
|
|
6124
6605
|
});
|
|
6125
6606
|
};
|
|
6607
|
+
var getEntityDetailsWithRoom = async (runtime, roomId, room) => {
|
|
6608
|
+
const roomEntities = await runtime.getEntitiesForRoom(roomId, true);
|
|
6609
|
+
const uniqueEntities = new Map;
|
|
6610
|
+
for (const entity of roomEntities) {
|
|
6611
|
+
if (!entity.id || uniqueEntities.has(entity.id))
|
|
6612
|
+
continue;
|
|
6613
|
+
const allData = {};
|
|
6614
|
+
for (const component of entity.components || []) {
|
|
6615
|
+
Object.assign(allData, component.data);
|
|
6616
|
+
}
|
|
6617
|
+
const mergedData = {};
|
|
6618
|
+
for (const [key, value] of Object.entries(allData)) {
|
|
6619
|
+
if (!mergedData[key]) {
|
|
6620
|
+
mergedData[key] = value;
|
|
6621
|
+
continue;
|
|
6622
|
+
}
|
|
6623
|
+
if (Array.isArray(mergedData[key]) && Array.isArray(value)) {
|
|
6624
|
+
mergedData[key] = [...new Set([...mergedData[key], ...value])];
|
|
6625
|
+
} else if (typeof mergedData[key] === "object" && typeof value === "object") {
|
|
6626
|
+
mergedData[key] = { ...mergedData[key], ...value };
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
const entityId = entity.id;
|
|
6630
|
+
uniqueEntities.set(entityId, {
|
|
6631
|
+
id: entityId,
|
|
6632
|
+
agentId: entity.agentId,
|
|
6633
|
+
name: room?.source ? entity.metadata[room.source]?.name || entity.names[0] : entity.names[0],
|
|
6634
|
+
names: entity.names,
|
|
6635
|
+
metadata: { ...mergedData, ...entity.metadata }
|
|
6636
|
+
});
|
|
6637
|
+
}
|
|
6638
|
+
return Array.from(uniqueEntities.values());
|
|
6639
|
+
};
|
|
6126
6640
|
var recentMessagesProvider = {
|
|
6127
6641
|
name: "RECENT_MESSAGES",
|
|
6128
6642
|
description: "Recent messages, interactions and other memories",
|
|
6129
6643
|
position: 100,
|
|
6130
|
-
get: async (runtime, message) => {
|
|
6644
|
+
get: async (runtime, message, state) => {
|
|
6645
|
+
const { roomId } = message;
|
|
6646
|
+
if (!roomId) {
|
|
6647
|
+
logger14.warn({ src: "plugin:bootstrap:provider:recent-messages", agentId: runtime.agentId }, "No roomId in message");
|
|
6648
|
+
return { data: {}, values: {}, text: "" };
|
|
6649
|
+
}
|
|
6131
6650
|
try {
|
|
6132
|
-
const { roomId } = message;
|
|
6133
6651
|
const conversationLength = runtime.getConversationLength();
|
|
6134
|
-
const
|
|
6135
|
-
|
|
6136
|
-
|
|
6652
|
+
const limitMessagesSetting = runtime.getSetting("LIMIT_TO_LAST_MESSAGE");
|
|
6653
|
+
const limitToLastMessage = limitMessagesSetting === true || (typeof limitMessagesSetting === "string" ? parseBooleanFromText2(limitMessagesSetting) : limitMessagesSetting != null ? parseBooleanFromText2(String(limitMessagesSetting)) : false);
|
|
6654
|
+
const effectiveConversationLength = limitToLastMessage ? 1 : conversationLength;
|
|
6655
|
+
const entitiesProviderResult = state?.data?.providers?.ENTITIES;
|
|
6656
|
+
const entitiesProviderData = entitiesProviderResult && typeof entitiesProviderResult === "object" && "data" in entitiesProviderResult ? entitiesProviderResult.data : undefined;
|
|
6657
|
+
const cachedRoom = entitiesProviderData?.room;
|
|
6658
|
+
const cachedEntities = Array.isArray(entitiesProviderData?.entitiesData) ? entitiesProviderData.entitiesData : undefined;
|
|
6659
|
+
const [room, recentMessagesData, recentInteractionsData] = await Promise.all([
|
|
6660
|
+
cachedRoom ? Promise.resolve(cachedRoom) : runtime.getRoom(roomId),
|
|
6137
6661
|
runtime.getMemories({
|
|
6138
6662
|
tableName: "messages",
|
|
6139
6663
|
roomId,
|
|
6140
|
-
count:
|
|
6664
|
+
count: effectiveConversationLength,
|
|
6141
6665
|
unique: false
|
|
6142
6666
|
}),
|
|
6143
6667
|
message.entityId !== runtime.agentId ? getRecentInteractions(runtime, message.entityId, runtime.agentId, roomId) : Promise.resolve([])
|
|
6144
6668
|
]);
|
|
6669
|
+
const entitiesData = cachedEntities ?? await getEntityDetailsWithRoom(runtime, roomId, room);
|
|
6670
|
+
const entityMap = new Map;
|
|
6671
|
+
for (const entity of entitiesData) {
|
|
6672
|
+
if (entity.id) {
|
|
6673
|
+
entityMap.set(entity.id, entity);
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6145
6676
|
const actionResultMessages = recentMessagesData.filter((msg) => msg.content?.type === "action_result" && msg.metadata?.type === "action_result");
|
|
6146
6677
|
const dialogueMessages = recentMessagesData.filter((msg) => !(msg.content?.type === "action_result" && msg.metadata?.type === "action_result"));
|
|
6147
6678
|
const isPostFormat = room?.type ? room.type === ChannelType5.FEED || room.type === ChannelType5.THREAD : false;
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
}),
|
|
6153
|
-
formatPosts({
|
|
6679
|
+
let formattedRecentMessages = "";
|
|
6680
|
+
let formattedRecentPosts = "";
|
|
6681
|
+
if (isPostFormat) {
|
|
6682
|
+
formattedRecentPosts = formatPosts({
|
|
6154
6683
|
messages: dialogueMessages,
|
|
6155
6684
|
entities: entitiesData,
|
|
6156
6685
|
conversationHeader: false
|
|
6157
|
-
})
|
|
6158
|
-
|
|
6686
|
+
});
|
|
6687
|
+
} else {
|
|
6688
|
+
formattedRecentMessages = formatMessages({
|
|
6689
|
+
messages: dialogueMessages,
|
|
6690
|
+
entities: entitiesData
|
|
6691
|
+
});
|
|
6692
|
+
}
|
|
6159
6693
|
let actionResultsText = "";
|
|
6160
6694
|
if (actionResultMessages.length > 0) {
|
|
6161
6695
|
const groupedByRun = new Map;
|
|
@@ -6179,9 +6713,8 @@ var recentMessagesProvider = {
|
|
|
6179
6713
|
const text2 = mem.content?.text || "";
|
|
6180
6714
|
const error = mem.content?.error || "";
|
|
6181
6715
|
let memText = ` - ${actionName} (${status})`;
|
|
6182
|
-
if (planStep)
|
|
6716
|
+
if (planStep)
|
|
6183
6717
|
memText += ` [${planStep}]`;
|
|
6184
|
-
}
|
|
6185
6718
|
if (error) {
|
|
6186
6719
|
memText += `: Error - ${error}`;
|
|
6187
6720
|
} else if (text2 && text2 !== `Executed action: ${actionName}`) {
|
|
@@ -6220,39 +6753,36 @@ ${runText}`;
|
|
|
6220
6753
|
let recentMessage = "No recent message available.";
|
|
6221
6754
|
if (dialogueMessages.length > 0) {
|
|
6222
6755
|
const mostRecentMessage = [...dialogueMessages].sort((a, b) => (b.createdAt || 0) - (a.createdAt || 0))[0];
|
|
6223
|
-
const
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
if (
|
|
6228
|
-
|
|
6756
|
+
const senderEntity = entityMap.get(mostRecentMessage.entityId);
|
|
6757
|
+
const senderName = senderEntity?.names[0] || "Unknown User";
|
|
6758
|
+
const messageText = mostRecentMessage.content?.text || "";
|
|
6759
|
+
const messageThought = mostRecentMessage.content?.thought;
|
|
6760
|
+
if (messageText || messageThought) {
|
|
6761
|
+
const parts = [];
|
|
6762
|
+
if (messageText)
|
|
6763
|
+
parts.push(`${senderName}: ${messageText}`);
|
|
6764
|
+
if (messageThought)
|
|
6765
|
+
parts.push(`(${senderName}'s internal thought: ${messageThought})`);
|
|
6766
|
+
recentMessage = parts.join(`
|
|
6767
|
+
`);
|
|
6229
6768
|
}
|
|
6230
6769
|
}
|
|
6231
6770
|
const metaData = message.metadata;
|
|
6232
|
-
const
|
|
6771
|
+
const currentSenderName = entityMap.get(message.entityId)?.names[0] || metaData?.entityName || "Unknown User";
|
|
6233
6772
|
const receivedMessageContent = message.content.text;
|
|
6234
6773
|
const hasReceivedMessage = !!receivedMessageContent?.trim();
|
|
6235
|
-
const receivedMessageHeader = hasReceivedMessage ? addHeader9("# Received Message", `${
|
|
6236
|
-
const focusHeader = hasReceivedMessage ? addHeader9("# Focus your response", `You are replying to the above message from **${
|
|
6237
|
-
const interactionEntityMap = new Map;
|
|
6774
|
+
const receivedMessageHeader = hasReceivedMessage ? addHeader9("# Received Message", `${currentSenderName}: ${receivedMessageContent}`) : "";
|
|
6775
|
+
const focusHeader = hasReceivedMessage ? addHeader9("# Focus your response", `You are replying to the above message from **${currentSenderName}**. Keep your answer relevant to that message. Do not repeat earlier replies unless the sender asks again.`) : "";
|
|
6776
|
+
const interactionEntityMap = new Map(entityMap);
|
|
6238
6777
|
if (recentInteractionsData.length > 0) {
|
|
6239
|
-
const
|
|
6240
|
-
...new Set(recentInteractionsData.map((
|
|
6778
|
+
const missingEntityIds = [
|
|
6779
|
+
...new Set(recentInteractionsData.map((msg) => msg.entityId).filter((id) => id !== runtime.agentId && !entityMap.has(id)))
|
|
6241
6780
|
];
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
entitiesData.forEach((entity) => {
|
|
6245
|
-
if (uniqueEntityIdSet.has(entity.id)) {
|
|
6246
|
-
interactionEntityMap.set(entity.id, entity);
|
|
6247
|
-
entitiesDataIdSet.add(entity.id);
|
|
6248
|
-
}
|
|
6249
|
-
});
|
|
6250
|
-
const remainingEntityIds = uniqueEntityIds.filter((id) => !entitiesDataIdSet.has(id));
|
|
6251
|
-
if (remainingEntityIds.length > 0) {
|
|
6252
|
-
const entities = await Promise.all(remainingEntityIds.map((entityId) => runtime.getEntityById(entityId)));
|
|
6781
|
+
if (missingEntityIds.length > 0) {
|
|
6782
|
+
const entities = await Promise.all(missingEntityIds.map((entityId) => runtime.getEntityById(entityId)));
|
|
6253
6783
|
entities.forEach((entity, index) => {
|
|
6254
6784
|
if (entity) {
|
|
6255
|
-
interactionEntityMap.set(
|
|
6785
|
+
interactionEntityMap.set(missingEntityIds[index], entity);
|
|
6256
6786
|
}
|
|
6257
6787
|
});
|
|
6258
6788
|
}
|
|
@@ -6318,11 +6848,7 @@ ${runText}`;
|
|
|
6318
6848
|
text
|
|
6319
6849
|
};
|
|
6320
6850
|
} catch (error) {
|
|
6321
|
-
|
|
6322
|
-
src: "plugin:bootstrap:provider:recent_messages",
|
|
6323
|
-
agentId: runtime.agentId,
|
|
6324
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6325
|
-
}, "Error in recentMessagesProvider");
|
|
6851
|
+
logger14.error({ src: "plugin:bootstrap:provider:recent_messages", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in recentMessagesProvider");
|
|
6326
6852
|
return {
|
|
6327
6853
|
data: {
|
|
6328
6854
|
recentMessages: [],
|
|
@@ -6343,6 +6869,16 @@ ${runText}`;
|
|
|
6343
6869
|
}
|
|
6344
6870
|
};
|
|
6345
6871
|
// src/providers/relationships.ts
|
|
6872
|
+
function csvEscape(value) {
|
|
6873
|
+
if (value === null || value === undefined)
|
|
6874
|
+
return "";
|
|
6875
|
+
const str = String(value);
|
|
6876
|
+
if (str.includes(",") || str.includes('"') || str.includes(`
|
|
6877
|
+
`)) {
|
|
6878
|
+
return `"${str.replace(/"/g, '""')}"`;
|
|
6879
|
+
}
|
|
6880
|
+
return str;
|
|
6881
|
+
}
|
|
6346
6882
|
async function formatRelationships(runtime, relationships) {
|
|
6347
6883
|
const sortedRelationships = relationships.filter((rel) => rel.metadata?.interactions).sort((a, b) => (b.metadata?.interactions || 0) - (a.metadata?.interactions || 0)).slice(0, 30);
|
|
6348
6884
|
if (sortedRelationships.length === 0) {
|
|
@@ -6356,23 +6892,18 @@ async function formatRelationships(runtime, relationships) {
|
|
|
6356
6892
|
entityMap.set(uniqueEntityIds[index], entity);
|
|
6357
6893
|
}
|
|
6358
6894
|
});
|
|
6359
|
-
const
|
|
6360
|
-
|
|
6361
|
-
`));
|
|
6362
|
-
};
|
|
6363
|
-
const formattedRelationships = sortedRelationships.map((rel) => {
|
|
6895
|
+
const rows = ["name,interactions,tags"];
|
|
6896
|
+
for (const rel of sortedRelationships) {
|
|
6364
6897
|
const targetEntityId = rel.targetEntityId;
|
|
6365
6898
|
const entity = entityMap.get(targetEntityId);
|
|
6366
|
-
if (!entity)
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
const
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
}).filter(Boolean);
|
|
6375
|
-
return formattedRelationships.join(`
|
|
6899
|
+
if (!entity)
|
|
6900
|
+
continue;
|
|
6901
|
+
const name = entity.names[0] || "Unknown";
|
|
6902
|
+
const interactions = rel.metadata?.interactions || 0;
|
|
6903
|
+
const tags = rel.tags?.join(";") || "";
|
|
6904
|
+
rows.push(`${csvEscape(name)},${interactions},${csvEscape(tags)}`);
|
|
6905
|
+
}
|
|
6906
|
+
return rows.join(`
|
|
6376
6907
|
`);
|
|
6377
6908
|
}
|
|
6378
6909
|
var relationshipsProvider = {
|
|
@@ -6406,6 +6937,8 @@ var relationshipsProvider = {
|
|
|
6406
6937
|
text: "No relationships found."
|
|
6407
6938
|
};
|
|
6408
6939
|
}
|
|
6940
|
+
const senderName = message.content.senderName || message.content.name || "user";
|
|
6941
|
+
const header = `# Relationships (${relationships.length}) - ${senderName}'s connections`;
|
|
6409
6942
|
return {
|
|
6410
6943
|
data: {
|
|
6411
6944
|
relationships: formattedRelationships
|
|
@@ -6413,7 +6946,7 @@ var relationshipsProvider = {
|
|
|
6413
6946
|
values: {
|
|
6414
6947
|
relationships: formattedRelationships
|
|
6415
6948
|
},
|
|
6416
|
-
text:
|
|
6949
|
+
text: `${header}
|
|
6417
6950
|
${formattedRelationships}`
|
|
6418
6951
|
};
|
|
6419
6952
|
}
|
|
@@ -6421,167 +6954,151 @@ ${formattedRelationships}`
|
|
|
6421
6954
|
// src/providers/roles.ts
|
|
6422
6955
|
import {
|
|
6423
6956
|
ChannelType as ChannelType6,
|
|
6424
|
-
|
|
6957
|
+
createUniqueUuid as createUniqueUuid2,
|
|
6958
|
+
logger as logger15
|
|
6425
6959
|
} from "@elizaos/core";
|
|
6960
|
+
var NO_ROLES_RESULT = {
|
|
6961
|
+
data: { roles: [] },
|
|
6962
|
+
values: { roles: "No role information available for this server." },
|
|
6963
|
+
text: "No role information available for this server."
|
|
6964
|
+
};
|
|
6426
6965
|
var roleProvider = {
|
|
6427
6966
|
name: "ROLES",
|
|
6428
6967
|
description: "Roles in the server, default are OWNER, ADMIN and MEMBER (as well as NONE)",
|
|
6429
|
-
get: async (runtime, message,
|
|
6430
|
-
|
|
6968
|
+
get: async (runtime, message, _state) => {
|
|
6969
|
+
if (!message.roomId) {
|
|
6970
|
+
return NO_ROLES_RESULT;
|
|
6971
|
+
}
|
|
6972
|
+
const room = await getCachedRoom(runtime, message.roomId);
|
|
6431
6973
|
if (!room) {
|
|
6432
6974
|
throw new Error("No room found");
|
|
6433
6975
|
}
|
|
6434
6976
|
if (room.type !== ChannelType6.GROUP) {
|
|
6435
6977
|
return {
|
|
6436
|
-
data: {
|
|
6437
|
-
roles: []
|
|
6438
|
-
},
|
|
6978
|
+
data: { roles: [] },
|
|
6439
6979
|
values: {
|
|
6440
6980
|
roles: "No access to role information in DMs, the role provider is only available in group scenarios."
|
|
6441
6981
|
},
|
|
6442
6982
|
text: "No access to role information in DMs, the role provider is only available in group scenarios."
|
|
6443
6983
|
};
|
|
6444
6984
|
}
|
|
6445
|
-
const
|
|
6446
|
-
if (!
|
|
6447
|
-
|
|
6448
|
-
}
|
|
6449
|
-
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, worldId }, "Using world ID");
|
|
6450
|
-
const world = await runtime.getWorld(worldId);
|
|
6451
|
-
if (!world || !world.metadata?.ownership?.ownerId) {
|
|
6452
|
-
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, worldId }, "No ownership data found for world, initializing empty role hierarchy");
|
|
6985
|
+
const serverId = room.serverId ?? room.messageServerId;
|
|
6986
|
+
if (!serverId) {
|
|
6987
|
+
logger15.warn({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, roomId: room.id }, "No server ID found for room");
|
|
6453
6988
|
return {
|
|
6454
|
-
data: {
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
values: {
|
|
6458
|
-
roles: "No role information available for this server."
|
|
6459
|
-
},
|
|
6460
|
-
text: "No role information available for this server."
|
|
6989
|
+
data: { roles: [] },
|
|
6990
|
+
values: { roles: "No role information available - server ID not found." },
|
|
6991
|
+
text: "No role information available - server ID not found."
|
|
6461
6992
|
};
|
|
6462
6993
|
}
|
|
6994
|
+
logger15.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "Using server ID");
|
|
6995
|
+
const worldId = createUniqueUuid2(runtime, serverId);
|
|
6996
|
+
const world = await getCachedWorld(runtime, worldId);
|
|
6997
|
+
if (!world || !world.metadata?.ownership?.ownerId) {
|
|
6998
|
+
logger15.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No ownership data found for server, initializing empty role hierarchy");
|
|
6999
|
+
return NO_ROLES_RESULT;
|
|
7000
|
+
}
|
|
6463
7001
|
const roles = world.metadata.roles || {};
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
roles: []
|
|
6469
|
-
},
|
|
6470
|
-
values: {
|
|
6471
|
-
roles: "No role information available for this server."
|
|
6472
|
-
},
|
|
6473
|
-
text: "No role information available for this server."
|
|
6474
|
-
};
|
|
7002
|
+
const entityIds = Object.keys(roles);
|
|
7003
|
+
if (entityIds.length === 0) {
|
|
7004
|
+
logger15.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No roles found for server");
|
|
7005
|
+
return NO_ROLES_RESULT;
|
|
6475
7006
|
}
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
7007
|
+
logger15.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, roleCount: entityIds.length }, "Found roles");
|
|
7008
|
+
const entities = await runtime.getEntitiesByIds(entityIds);
|
|
7009
|
+
const entityMap = new Map;
|
|
7010
|
+
if (entities) {
|
|
7011
|
+
for (const entity of entities) {
|
|
7012
|
+
if (entity.id) {
|
|
7013
|
+
entityMap.set(entity.id, entity);
|
|
7014
|
+
}
|
|
7015
|
+
}
|
|
7016
|
+
}
|
|
7017
|
+
const seenUsernames = new Set;
|
|
6481
7018
|
const owners = [];
|
|
6482
7019
|
const admins = [];
|
|
6483
7020
|
const members = [];
|
|
6484
|
-
for (const entityId of
|
|
7021
|
+
for (const entityId of entityIds) {
|
|
6485
7022
|
const userRole = roles[entityId];
|
|
6486
|
-
const user =
|
|
7023
|
+
const user = entityMap.get(entityId);
|
|
6487
7024
|
const name = user?.metadata?.name;
|
|
6488
7025
|
const username = user?.metadata?.username;
|
|
6489
|
-
const
|
|
6490
|
-
if (
|
|
7026
|
+
const userNames = user?.names;
|
|
7027
|
+
if (!name || !username || !userNames) {
|
|
7028
|
+
logger15.warn({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, entityId }, "User has no name or username, skipping");
|
|
6491
7029
|
continue;
|
|
6492
7030
|
}
|
|
6493
|
-
if (
|
|
6494
|
-
logger13.warn({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, entityId }, "User has no name or username, skipping");
|
|
7031
|
+
if (seenUsernames.has(username)) {
|
|
6495
7032
|
continue;
|
|
6496
7033
|
}
|
|
7034
|
+
seenUsernames.add(username);
|
|
7035
|
+
const userData = { name, username, names: userNames };
|
|
6497
7036
|
switch (userRole) {
|
|
6498
7037
|
case "OWNER":
|
|
6499
|
-
owners.push(
|
|
7038
|
+
owners.push(userData);
|
|
6500
7039
|
break;
|
|
6501
7040
|
case "ADMIN":
|
|
6502
|
-
admins.push(
|
|
7041
|
+
admins.push(userData);
|
|
6503
7042
|
break;
|
|
6504
7043
|
default:
|
|
6505
|
-
members.push(
|
|
7044
|
+
members.push(userData);
|
|
6506
7045
|
break;
|
|
6507
7046
|
}
|
|
6508
7047
|
}
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
7048
|
+
if (owners.length === 0 && admins.length === 0 && members.length === 0) {
|
|
7049
|
+
return NO_ROLES_RESULT;
|
|
7050
|
+
}
|
|
7051
|
+
const parts = [`# Server Role Hierarchy
|
|
7052
|
+
`];
|
|
6512
7053
|
if (owners.length > 0) {
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
});
|
|
6519
|
-
response += `
|
|
6520
|
-
`;
|
|
7054
|
+
parts.push("## Owners");
|
|
7055
|
+
for (const owner of owners) {
|
|
7056
|
+
parts.push(`${owner.name} (${owner.names.join(", ")})`);
|
|
7057
|
+
}
|
|
7058
|
+
parts.push("");
|
|
6521
7059
|
}
|
|
6522
7060
|
if (admins.length > 0) {
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
});
|
|
6529
|
-
response += `
|
|
6530
|
-
`;
|
|
7061
|
+
parts.push("## Administrators");
|
|
7062
|
+
for (const admin of admins) {
|
|
7063
|
+
parts.push(`${admin.name} (${admin.names.join(", ")}) (${admin.username})`);
|
|
7064
|
+
}
|
|
7065
|
+
parts.push("");
|
|
6531
7066
|
}
|
|
6532
7067
|
if (members.length > 0) {
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
`;
|
|
6538
|
-
});
|
|
6539
|
-
}
|
|
6540
|
-
if (owners.length === 0 && admins.length === 0 && members.length === 0) {
|
|
6541
|
-
return {
|
|
6542
|
-
data: {
|
|
6543
|
-
roles: []
|
|
6544
|
-
},
|
|
6545
|
-
values: {
|
|
6546
|
-
roles: "No role information available for this server."
|
|
6547
|
-
},
|
|
6548
|
-
text: "No role information available for this server."
|
|
6549
|
-
};
|
|
7068
|
+
parts.push("## Members");
|
|
7069
|
+
for (const member of members) {
|
|
7070
|
+
parts.push(`${member.name} (${member.names.join(", ")}) (${member.username})`);
|
|
7071
|
+
}
|
|
6550
7072
|
}
|
|
7073
|
+
const response = parts.join(`
|
|
7074
|
+
`);
|
|
6551
7075
|
return {
|
|
6552
|
-
data: {
|
|
6553
|
-
|
|
6554
|
-
},
|
|
6555
|
-
values: {
|
|
6556
|
-
roles: response
|
|
6557
|
-
},
|
|
7076
|
+
data: { roles: response },
|
|
7077
|
+
values: { roles: response },
|
|
6558
7078
|
text: response
|
|
6559
7079
|
};
|
|
6560
7080
|
}
|
|
6561
7081
|
};
|
|
6562
7082
|
// src/providers/settings.ts
|
|
6563
7083
|
import {
|
|
7084
|
+
asUUID as asUUID2,
|
|
6564
7085
|
ChannelType as ChannelType7,
|
|
6565
7086
|
findWorldsForOwner as findWorldsForOwner2,
|
|
6566
|
-
|
|
6567
|
-
logger as logger14,
|
|
6568
|
-
unsaltWorldSettings as unsaltWorldSettings2
|
|
7087
|
+
logger as logger16
|
|
6569
7088
|
} from "@elizaos/core";
|
|
7089
|
+
var DB_TIMEOUT_MS2 = 5000;
|
|
6570
7090
|
var formatSettingValue = (setting, isOnboarding) => {
|
|
6571
|
-
if (setting.value === null)
|
|
7091
|
+
if (setting.value === null)
|
|
6572
7092
|
return "Not set";
|
|
6573
|
-
|
|
6574
|
-
if (setting.secret && !isOnboarding) {
|
|
7093
|
+
if (setting.secret && !isOnboarding)
|
|
6575
7094
|
return "****************";
|
|
6576
|
-
}
|
|
6577
7095
|
return String(setting.value);
|
|
6578
7096
|
};
|
|
6579
7097
|
function generateStatusMessage(runtime, worldSettings, isOnboarding, state) {
|
|
6580
7098
|
try {
|
|
6581
7099
|
const formattedSettings = Object.entries(worldSettings).map(([key, setting]) => {
|
|
6582
|
-
if (typeof setting !== "object" || !setting.name)
|
|
7100
|
+
if (typeof setting !== "object" || !setting.name)
|
|
6583
7101
|
return null;
|
|
6584
|
-
}
|
|
6585
7102
|
const description = setting.description || "";
|
|
6586
7103
|
const usageDescription = setting.usageDescription || "";
|
|
6587
7104
|
if (setting.visibleIf && !setting.visibleIf(worldSettings)) {
|
|
@@ -6646,11 +7163,7 @@ ${requiredUnconfigured > 0 ? `IMPORTANT!: ${requiredUnconfigured} required setti
|
|
|
6646
7163
|
|
|
6647
7164
|
`)}`;
|
|
6648
7165
|
} catch (error) {
|
|
6649
|
-
|
|
6650
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6651
|
-
agentId: runtime.agentId,
|
|
6652
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6653
|
-
}, "Error generating status message");
|
|
7166
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating status message");
|
|
6654
7167
|
return "Error generating configuration status.";
|
|
6655
7168
|
}
|
|
6656
7169
|
}
|
|
@@ -6658,20 +7171,17 @@ var settingsProvider = {
|
|
|
6658
7171
|
name: "SETTINGS",
|
|
6659
7172
|
description: "Current settings for the server",
|
|
6660
7173
|
get: async (runtime, message, state) => {
|
|
7174
|
+
if (!message.roomId) {
|
|
7175
|
+
return {
|
|
7176
|
+
data: { settings: [] },
|
|
7177
|
+
values: { settings: "Error: No room ID in message" },
|
|
7178
|
+
text: "Error: No room ID in message"
|
|
7179
|
+
};
|
|
7180
|
+
}
|
|
6661
7181
|
try {
|
|
6662
|
-
const
|
|
6663
|
-
runtime.getRoom(message.roomId),
|
|
6664
|
-
findWorldsForOwner2(runtime, message.entityId)
|
|
6665
|
-
]).catch((error) => {
|
|
6666
|
-
logger14.error({
|
|
6667
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6668
|
-
agentId: runtime.agentId,
|
|
6669
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6670
|
-
}, "Error fetching initial data");
|
|
6671
|
-
throw new Error("Failed to retrieve room or user world information");
|
|
6672
|
-
});
|
|
7182
|
+
const room = await getCachedRoom(runtime, message.roomId);
|
|
6673
7183
|
if (!room) {
|
|
6674
|
-
|
|
7184
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No room found for settings provider");
|
|
6675
7185
|
return {
|
|
6676
7186
|
data: {
|
|
6677
7187
|
settings: []
|
|
@@ -6683,7 +7193,7 @@ var settingsProvider = {
|
|
|
6683
7193
|
};
|
|
6684
7194
|
}
|
|
6685
7195
|
if (!room.worldId) {
|
|
6686
|
-
|
|
7196
|
+
logger16.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for settings provider -- settings provider will be skipped");
|
|
6687
7197
|
return {
|
|
6688
7198
|
data: {
|
|
6689
7199
|
settings: []
|
|
@@ -6694,13 +7204,13 @@ var settingsProvider = {
|
|
|
6694
7204
|
text: "Room does not have a worldId -- settings provider will be skipped"
|
|
6695
7205
|
};
|
|
6696
7206
|
}
|
|
6697
|
-
const
|
|
6698
|
-
const isOnboarding = type === ChannelType7.DM;
|
|
7207
|
+
const isOnboarding = room.type === ChannelType7.DM;
|
|
6699
7208
|
let world = null;
|
|
6700
7209
|
let serverId = undefined;
|
|
6701
7210
|
let worldSettings = null;
|
|
6702
7211
|
if (isOnboarding) {
|
|
6703
|
-
|
|
7212
|
+
const userWorlds = await withTimeout(findWorldsForOwner2(runtime, message.entityId), DB_TIMEOUT_MS2, null);
|
|
7213
|
+
world = userWorlds?.find((w) => w.metadata?.settings !== undefined);
|
|
6704
7214
|
if (!world && userWorlds && userWorlds.length > 0) {
|
|
6705
7215
|
world = userWorlds[0];
|
|
6706
7216
|
if (!world.metadata) {
|
|
@@ -6708,58 +7218,68 @@ var settingsProvider = {
|
|
|
6708
7218
|
}
|
|
6709
7219
|
world.metadata.settings = {};
|
|
6710
7220
|
await runtime.updateWorld(world);
|
|
6711
|
-
|
|
6712
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6713
|
-
agentId: runtime.agentId,
|
|
6714
|
-
worldId: world.id
|
|
6715
|
-
}, "Initialized settings for user world");
|
|
7221
|
+
logger16.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: world.id }, "Initialized settings for user world");
|
|
6716
7222
|
}
|
|
6717
7223
|
if (!world) {
|
|
6718
|
-
|
|
7224
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for user during onboarding");
|
|
6719
7225
|
throw new Error("No server ownership found for onboarding");
|
|
6720
7226
|
}
|
|
6721
7227
|
serverId = world.messageServerId;
|
|
6722
|
-
if (
|
|
6723
|
-
|
|
6724
|
-
worldSettings = unsaltWorldSettings2(world.metadata.settings, salt);
|
|
7228
|
+
if (serverId) {
|
|
7229
|
+
worldSettings = extractWorldSettings(world);
|
|
6725
7230
|
}
|
|
6726
7231
|
} else {
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
7232
|
+
const worldIdTyped = asUUID2(room.worldId);
|
|
7233
|
+
if (hasNoServerId(worldIdTyped)) {
|
|
7234
|
+
logger16.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: room.worldId }, "Skipping world with known no serverId (cached)");
|
|
7235
|
+
return {
|
|
7236
|
+
data: { settings: [] },
|
|
7237
|
+
values: { settings: "Error: No configuration access" },
|
|
7238
|
+
text: "Error: No configuration access"
|
|
7239
|
+
};
|
|
7240
|
+
}
|
|
7241
|
+
const roomServerId = room.messageServerId ?? room.serverId;
|
|
7242
|
+
if (roomServerId) {
|
|
7243
|
+
if (hasNoSettings(roomServerId)) {
|
|
7244
|
+
logger16.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId: roomServerId }, "Skipping server with known no settings (cross-agent cache)");
|
|
7245
|
+
return {
|
|
7246
|
+
data: { settings: [] },
|
|
7247
|
+
values: { settings: "Configuration has not been completed yet." },
|
|
7248
|
+
text: "Configuration has not been completed yet."
|
|
7249
|
+
};
|
|
6736
7250
|
}
|
|
6737
|
-
|
|
6738
|
-
if (
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
7251
|
+
const cachedSettings = getCachedSettingsByServerId(roomServerId);
|
|
7252
|
+
if (cachedSettings) {
|
|
7253
|
+
logger16.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId: roomServerId }, "Using cross-agent cached settings");
|
|
7254
|
+
serverId = roomServerId;
|
|
7255
|
+
worldSettings = cachedSettings;
|
|
7256
|
+
}
|
|
7257
|
+
}
|
|
7258
|
+
if (!worldSettings) {
|
|
7259
|
+
try {
|
|
7260
|
+
world = await getCachedWorld(runtime, worldIdTyped);
|
|
7261
|
+
if (!world) {
|
|
7262
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: room.worldId }, "No world found for room");
|
|
7263
|
+
throw new Error(`No world found for room ${room.worldId}`);
|
|
7264
|
+
}
|
|
7265
|
+
serverId = world.messageServerId;
|
|
7266
|
+
if (serverId) {
|
|
7267
|
+
worldSettings = extractWorldSettings(world);
|
|
7268
|
+
if (!worldSettings) {
|
|
7269
|
+
markNoSettings(serverId);
|
|
7270
|
+
}
|
|
7271
|
+
} else {
|
|
7272
|
+
markNoServerId(worldIdTyped);
|
|
7273
|
+
logger16.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: room.worldId }, "No server ID found for world (marked for cache)");
|
|
7274
|
+
}
|
|
7275
|
+
} catch (error) {
|
|
7276
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing world data");
|
|
7277
|
+
throw new Error("Failed to process world information");
|
|
6747
7278
|
}
|
|
6748
|
-
} catch (error) {
|
|
6749
|
-
logger14.error({
|
|
6750
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6751
|
-
agentId: runtime.agentId,
|
|
6752
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6753
|
-
}, "Error processing world data");
|
|
6754
|
-
throw new Error("Failed to process world information");
|
|
6755
7279
|
}
|
|
6756
7280
|
}
|
|
6757
7281
|
if (!serverId) {
|
|
6758
|
-
|
|
6759
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6760
|
-
agentId: runtime.agentId,
|
|
6761
|
-
entityId: message.entityId
|
|
6762
|
-
}, "No server ownership found for user after recovery attempt");
|
|
7282
|
+
logger16.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, entityId: message.entityId }, "No server ownership found for user after recovery attempt");
|
|
6763
7283
|
return isOnboarding ? {
|
|
6764
7284
|
data: {
|
|
6765
7285
|
settings: []
|
|
@@ -6779,11 +7299,7 @@ var settingsProvider = {
|
|
|
6779
7299
|
};
|
|
6780
7300
|
}
|
|
6781
7301
|
if (!worldSettings) {
|
|
6782
|
-
|
|
6783
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6784
|
-
agentId: runtime.agentId,
|
|
6785
|
-
messageServerId: serverId
|
|
6786
|
-
}, "No settings state found for server");
|
|
7302
|
+
logger16.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId }, "No settings state found for server");
|
|
6787
7303
|
return isOnboarding ? {
|
|
6788
7304
|
data: {
|
|
6789
7305
|
settings: []
|
|
@@ -6813,11 +7329,7 @@ var settingsProvider = {
|
|
|
6813
7329
|
text: output
|
|
6814
7330
|
};
|
|
6815
7331
|
} catch (error) {
|
|
6816
|
-
|
|
6817
|
-
src: "plugin:bootstrap:provider:settings",
|
|
6818
|
-
agentId: runtime.agentId,
|
|
6819
|
-
error: error instanceof Error ? error.message : String(error)
|
|
6820
|
-
}, "Critical error in settings provider");
|
|
7332
|
+
logger16.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Critical error in settings provider");
|
|
6821
7333
|
return {
|
|
6822
7334
|
data: {
|
|
6823
7335
|
settings: []
|
|
@@ -6854,7 +7366,7 @@ var timeProvider = {
|
|
|
6854
7366
|
};
|
|
6855
7367
|
// src/providers/world.ts
|
|
6856
7368
|
import {
|
|
6857
|
-
logger as
|
|
7369
|
+
logger as logger17,
|
|
6858
7370
|
addHeader as addHeader10,
|
|
6859
7371
|
ChannelType as ChannelType8
|
|
6860
7372
|
} from "@elizaos/core";
|
|
@@ -6864,14 +7376,14 @@ var worldProvider = {
|
|
|
6864
7376
|
dynamic: true,
|
|
6865
7377
|
get: async (runtime, message) => {
|
|
6866
7378
|
try {
|
|
6867
|
-
|
|
7379
|
+
logger17.debug({
|
|
6868
7380
|
src: "plugin:bootstrap:provider:world",
|
|
6869
7381
|
agentId: runtime.agentId,
|
|
6870
7382
|
roomId: message.roomId
|
|
6871
7383
|
}, "World provider activated");
|
|
6872
7384
|
const currentRoom = await runtime.getRoom(message.roomId);
|
|
6873
7385
|
if (!currentRoom) {
|
|
6874
|
-
|
|
7386
|
+
logger17.warn({
|
|
6875
7387
|
src: "plugin:bootstrap:provider:world",
|
|
6876
7388
|
agentId: runtime.agentId,
|
|
6877
7389
|
roomId: message.roomId
|
|
@@ -6885,7 +7397,7 @@ var worldProvider = {
|
|
|
6885
7397
|
text: "Unable to retrieve world information - room not found"
|
|
6886
7398
|
};
|
|
6887
7399
|
}
|
|
6888
|
-
|
|
7400
|
+
logger17.debug({
|
|
6889
7401
|
src: "plugin:bootstrap:provider:world",
|
|
6890
7402
|
agentId: runtime.agentId,
|
|
6891
7403
|
roomName: currentRoom.name,
|
|
@@ -6893,7 +7405,7 @@ var worldProvider = {
|
|
|
6893
7405
|
}, "Found room");
|
|
6894
7406
|
const worldId = currentRoom.worldId;
|
|
6895
7407
|
if (!worldId) {
|
|
6896
|
-
|
|
7408
|
+
logger17.warn({
|
|
6897
7409
|
src: "plugin:bootstrap:provider:world",
|
|
6898
7410
|
agentId: runtime.agentId,
|
|
6899
7411
|
roomId: message.roomId
|
|
@@ -6909,7 +7421,7 @@ var worldProvider = {
|
|
|
6909
7421
|
}
|
|
6910
7422
|
const world = await runtime.getWorld(worldId);
|
|
6911
7423
|
if (!world) {
|
|
6912
|
-
|
|
7424
|
+
logger17.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, worldId }, "World not found");
|
|
6913
7425
|
return {
|
|
6914
7426
|
data: {
|
|
6915
7427
|
world: {
|
|
@@ -6919,21 +7431,23 @@ var worldProvider = {
|
|
|
6919
7431
|
text: "Unable to retrieve world information - world not found"
|
|
6920
7432
|
};
|
|
6921
7433
|
}
|
|
6922
|
-
|
|
7434
|
+
logger17.debug({
|
|
6923
7435
|
src: "plugin:bootstrap:provider:world",
|
|
6924
7436
|
agentId: runtime.agentId,
|
|
6925
7437
|
worldName: world.name,
|
|
6926
7438
|
worldId: world.id
|
|
6927
7439
|
}, "Found world");
|
|
6928
|
-
const worldRooms = await
|
|
6929
|
-
|
|
7440
|
+
const [worldRooms, participants] = await Promise.all([
|
|
7441
|
+
runtime.getRooms(worldId),
|
|
7442
|
+
runtime.getParticipantsForRoom(message.roomId)
|
|
7443
|
+
]);
|
|
7444
|
+
logger17.debug({
|
|
6930
7445
|
src: "plugin:bootstrap:provider:world",
|
|
6931
7446
|
agentId: runtime.agentId,
|
|
6932
7447
|
roomCount: worldRooms.length,
|
|
6933
7448
|
worldName: world.name
|
|
6934
7449
|
}, "Found rooms in world");
|
|
6935
|
-
|
|
6936
|
-
logger15.debug({
|
|
7450
|
+
logger17.debug({
|
|
6937
7451
|
src: "plugin:bootstrap:provider:world",
|
|
6938
7452
|
agentId: runtime.agentId,
|
|
6939
7453
|
participantCount: participants.length,
|
|
@@ -6949,7 +7463,7 @@ var worldProvider = {
|
|
|
6949
7463
|
};
|
|
6950
7464
|
for (const room of worldRooms) {
|
|
6951
7465
|
if (!room?.id || !room.name) {
|
|
6952
|
-
|
|
7466
|
+
logger17.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: room?.id }, "Room ID or name is missing");
|
|
6953
7467
|
continue;
|
|
6954
7468
|
}
|
|
6955
7469
|
const roomInfo = {
|
|
@@ -7019,14 +7533,14 @@ var worldProvider = {
|
|
|
7019
7533
|
worldInfo: worldInfoText
|
|
7020
7534
|
};
|
|
7021
7535
|
const formattedText = addHeader10("# World Information", worldInfoText);
|
|
7022
|
-
|
|
7536
|
+
logger17.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId }, "World provider completed successfully");
|
|
7023
7537
|
return {
|
|
7024
7538
|
data,
|
|
7025
7539
|
values,
|
|
7026
7540
|
text: formattedText
|
|
7027
7541
|
};
|
|
7028
7542
|
} catch (error) {
|
|
7029
|
-
|
|
7543
|
+
logger17.error({
|
|
7030
7544
|
src: "plugin:bootstrap:provider:world",
|
|
7031
7545
|
agentId: runtime.agentId,
|
|
7032
7546
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -7043,6 +7557,120 @@ var worldProvider = {
|
|
|
7043
7557
|
}
|
|
7044
7558
|
}
|
|
7045
7559
|
};
|
|
7560
|
+
// src/providers/plugin-info.ts
|
|
7561
|
+
var bootstrapInstructionsProvider = {
|
|
7562
|
+
name: "bootstrapInstructions",
|
|
7563
|
+
description: "Instructions and capabilities for the bootstrap (core) plugin",
|
|
7564
|
+
dynamic: true,
|
|
7565
|
+
get: async (_runtime, _message, _state) => {
|
|
7566
|
+
const instructions = `
|
|
7567
|
+
# Bootstrap Plugin Capabilities
|
|
7568
|
+
|
|
7569
|
+
## What This Plugin Does
|
|
7570
|
+
|
|
7571
|
+
The bootstrap plugin provides essential agent capabilities. It's the foundation that enables basic agent functionality.
|
|
7572
|
+
|
|
7573
|
+
## Core Actions
|
|
7574
|
+
|
|
7575
|
+
### Communication
|
|
7576
|
+
- **REPLY**: Respond to messages (primary communication action)
|
|
7577
|
+
- **SEND_MESSAGE**: Send a message to a specific room/channel
|
|
7578
|
+
- **IGNORE**: Explicitly ignore a message (no response)
|
|
7579
|
+
- **NONE**: Take no action
|
|
7580
|
+
|
|
7581
|
+
### Room Management
|
|
7582
|
+
- **FOLLOW_ROOM**: Start following a room's messages
|
|
7583
|
+
- **UNFOLLOW_ROOM**: Stop following a room
|
|
7584
|
+
- **MUTE_ROOM**: Temporarily mute notifications from a room
|
|
7585
|
+
- **UNMUTE_ROOM**: Restore notifications for a room
|
|
7586
|
+
|
|
7587
|
+
### Entity & Role Management
|
|
7588
|
+
- **UPDATE_ENTITY**: Update information about an entity/user
|
|
7589
|
+
- **UPDATE_ROLE**: Change role/permissions for an entity
|
|
7590
|
+
- **UPDATE_SETTINGS**: Modify configuration settings
|
|
7591
|
+
|
|
7592
|
+
### Content
|
|
7593
|
+
- **GENERATE_IMAGE**: Create images using AI models
|
|
7594
|
+
- **CHOICE**: Present options for user selection
|
|
7595
|
+
|
|
7596
|
+
## Core Providers
|
|
7597
|
+
|
|
7598
|
+
The bootstrap plugin provides essential context:
|
|
7599
|
+
- **TIME**: Current date and time
|
|
7600
|
+
- **ENTITIES**: Information about participants
|
|
7601
|
+
- **RELATIONSHIPS**: Connection between entities
|
|
7602
|
+
- **FACTS**: Known facts about the conversation
|
|
7603
|
+
- **RECENT_MESSAGES**: Recent conversation history
|
|
7604
|
+
- **CHARACTER**: Agent's personality and traits
|
|
7605
|
+
- **ACTIONS**: Available actions
|
|
7606
|
+
- **PROVIDERS**: Available data providers
|
|
7607
|
+
|
|
7608
|
+
## Event Handling
|
|
7609
|
+
|
|
7610
|
+
Bootstrap handles key events:
|
|
7611
|
+
- Message received/sent
|
|
7612
|
+
- Reactions
|
|
7613
|
+
- Entity joins/leaves
|
|
7614
|
+
- World connections
|
|
7615
|
+
- Action lifecycle (start/complete)
|
|
7616
|
+
- Run lifecycle (start/end/timeout)
|
|
7617
|
+
|
|
7618
|
+
## Best Practices
|
|
7619
|
+
|
|
7620
|
+
1. **REPLY for conversations**: Use REPLY for normal responses
|
|
7621
|
+
2. **IGNORE intentionally**: Use IGNORE when staying silent is appropriate
|
|
7622
|
+
3. **Room awareness**: Follow relevant rooms, mute noisy ones
|
|
7623
|
+
4. **Entity context**: Use entity info for personalization
|
|
7624
|
+
`;
|
|
7625
|
+
return {
|
|
7626
|
+
text: instructions.trim(),
|
|
7627
|
+
data: {
|
|
7628
|
+
pluginName: "bootstrap",
|
|
7629
|
+
isCore: true
|
|
7630
|
+
}
|
|
7631
|
+
};
|
|
7632
|
+
}
|
|
7633
|
+
};
|
|
7634
|
+
var bootstrapSettingsProvider = {
|
|
7635
|
+
name: "bootstrapSettings",
|
|
7636
|
+
description: "Current bootstrap plugin configuration (non-sensitive)",
|
|
7637
|
+
dynamic: true,
|
|
7638
|
+
get: async (runtime, _message, _state) => {
|
|
7639
|
+
const alwaysRespondChannels = runtime.getSetting("ALWAYS_RESPOND_CHANNELS") || "";
|
|
7640
|
+
const alwaysRespondSources = runtime.getSetting("ALWAYS_RESPOND_SOURCES") || "";
|
|
7641
|
+
const settings = {
|
|
7642
|
+
pluginEnabled: true,
|
|
7643
|
+
agentName: runtime.character?.name || "Agent",
|
|
7644
|
+
hasCustomRespondChannels: !!alwaysRespondChannels,
|
|
7645
|
+
hasCustomRespondSources: !!alwaysRespondSources
|
|
7646
|
+
};
|
|
7647
|
+
const text = `
|
|
7648
|
+
# Bootstrap Plugin Settings
|
|
7649
|
+
|
|
7650
|
+
## Plugin Status
|
|
7651
|
+
- **Status**: Enabled (Core Plugin)
|
|
7652
|
+
- **Agent**: ${settings.agentName}
|
|
7653
|
+
|
|
7654
|
+
## Response Configuration
|
|
7655
|
+
- **Custom Respond Channels**: ${settings.hasCustomRespondChannels ? "Configured" : "Using defaults"}
|
|
7656
|
+
- **Custom Respond Sources**: ${settings.hasCustomRespondSources ? "Configured" : "Using defaults"}
|
|
7657
|
+
|
|
7658
|
+
## Default Behavior
|
|
7659
|
+
- Always responds in DMs and API calls
|
|
7660
|
+
- Responds when mentioned or replied to
|
|
7661
|
+
- Uses LLM evaluation for other messages
|
|
7662
|
+
`;
|
|
7663
|
+
return {
|
|
7664
|
+
text: text.trim(),
|
|
7665
|
+
data: settings,
|
|
7666
|
+
values: {
|
|
7667
|
+
pluginEnabled: "true",
|
|
7668
|
+
isCore: "true"
|
|
7669
|
+
}
|
|
7670
|
+
};
|
|
7671
|
+
}
|
|
7672
|
+
};
|
|
7673
|
+
|
|
7046
7674
|
// src/services/task.ts
|
|
7047
7675
|
import {
|
|
7048
7676
|
Service,
|
|
@@ -7594,10 +8222,177 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7594
8222
|
}, "Cleared queue");
|
|
7595
8223
|
}
|
|
7596
8224
|
}
|
|
8225
|
+
// src/banner.ts
|
|
8226
|
+
var ANSI = {
|
|
8227
|
+
reset: "\x1B[0m",
|
|
8228
|
+
bold: "\x1B[1m",
|
|
8229
|
+
dim: "\x1B[2m",
|
|
8230
|
+
teal: "\x1B[31m",
|
|
8231
|
+
tealBright: "\x1B[37m",
|
|
8232
|
+
mint: "\x1B[37m",
|
|
8233
|
+
brightGreen: "\x1B[92m",
|
|
8234
|
+
brightYellow: "\x1B[93m",
|
|
8235
|
+
brightMagenta: "\x1B[95m",
|
|
8236
|
+
brightWhite: "\x1B[97m",
|
|
8237
|
+
brightRed: "\x1B[91m",
|
|
8238
|
+
brightBlue: "\x1B[94m"
|
|
8239
|
+
};
|
|
8240
|
+
function mask(v) {
|
|
8241
|
+
if (!v || v.length < 8)
|
|
8242
|
+
return "••••••••";
|
|
8243
|
+
return `${v.slice(0, 4)}${"•".repeat(Math.min(12, v.length - 8))}${v.slice(-4)}`;
|
|
8244
|
+
}
|
|
8245
|
+
function fmtVal(value, sensitive, maxLen) {
|
|
8246
|
+
let s;
|
|
8247
|
+
if (value === undefined || value === null || value === "") {
|
|
8248
|
+
s = "(not set)";
|
|
8249
|
+
} else if (sensitive) {
|
|
8250
|
+
s = mask(String(value));
|
|
8251
|
+
} else {
|
|
8252
|
+
s = String(value);
|
|
8253
|
+
}
|
|
8254
|
+
if (s.length > maxLen)
|
|
8255
|
+
s = s.slice(0, maxLen - 3) + "...";
|
|
8256
|
+
return s;
|
|
8257
|
+
}
|
|
8258
|
+
function isDef(v, d) {
|
|
8259
|
+
if (v === undefined || v === null || v === "")
|
|
8260
|
+
return true;
|
|
8261
|
+
return d !== undefined && v === d;
|
|
8262
|
+
}
|
|
8263
|
+
function pad(s, n) {
|
|
8264
|
+
const len = s.replace(/\x1b\[[0-9;]*m/g, "").length;
|
|
8265
|
+
if (len >= n)
|
|
8266
|
+
return s;
|
|
8267
|
+
return s + " ".repeat(n - len);
|
|
8268
|
+
}
|
|
8269
|
+
function line(content) {
|
|
8270
|
+
const stripped = content.replace(/\x1b\[[0-9;]*m/g, "");
|
|
8271
|
+
const len = stripped.length;
|
|
8272
|
+
if (len > 78)
|
|
8273
|
+
return content.slice(0, 78);
|
|
8274
|
+
return content + " ".repeat(78 - len);
|
|
8275
|
+
}
|
|
8276
|
+
function printBanner(options) {
|
|
8277
|
+
const { settings = [], runtime } = options;
|
|
8278
|
+
const { reset: R, dim: D, bold: B } = ANSI;
|
|
8279
|
+
const { teal: C, tealBright: c2, mint: M } = ANSI;
|
|
8280
|
+
const { brightGreen: G, brightYellow: Y } = ANSI;
|
|
8281
|
+
const top = `${C}╔${"═".repeat(78)}╗${R}`;
|
|
8282
|
+
const mid = `${C}╠${"═".repeat(78)}╣${R}`;
|
|
8283
|
+
const bot = `${C}╚${"═".repeat(78)}╝${R}`;
|
|
8284
|
+
const row = (s) => `${C}║${R}${line(s)}${C}║${R}`;
|
|
8285
|
+
const lines = [""];
|
|
8286
|
+
lines.push(top);
|
|
8287
|
+
lines.push(row(` ${B}Character: ${runtime.character.name}${R}`));
|
|
8288
|
+
lines.push(mid);
|
|
8289
|
+
lines.push(row(`${c2} ____ __ __ ${M} ▲${R}`));
|
|
8290
|
+
lines.push(row(`${c2} / __ ) ____ ____ ____/ /_ _____ / /_ _____ ____ _ ____ ${M} /▲\\${R}`));
|
|
8291
|
+
lines.push(row(`${c2} / __ |/ __ \\ / __ \\/ __ __// ___/ / __// ___// __ '// __ \\${M} / ▲ \\${R}`));
|
|
8292
|
+
lines.push(row(`${c2} / /_/ // /_/ // /_/ / /_/ /_ (__ ) / /_ / / / /_/ // /_/ /${M} / ▲ \\${R}`));
|
|
8293
|
+
lines.push(row(`${c2}/_____/ \\____/ \\____/\\__,___//____/ \\__//_/ \\__,_// .___/ ${M}/___▲___\\${R}`));
|
|
8294
|
+
lines.push(row(`${D} ${c2}/_/${R}`));
|
|
8295
|
+
lines.push(row(``));
|
|
8296
|
+
lines.push(row(`${M} Agent Foundation • Actions • Evaluators • Providers${R}`));
|
|
8297
|
+
lines.push(mid);
|
|
8298
|
+
if (settings.length > 0) {
|
|
8299
|
+
const NW = 32, VW = 28, SW = 8;
|
|
8300
|
+
lines.push(row(` ${B}${pad("ENV VARIABLE", NW)} ${pad("VALUE", VW)} ${pad("STATUS", SW)}${R}`));
|
|
8301
|
+
lines.push(row(` ${D}${"-".repeat(NW)} ${"-".repeat(VW)} ${"-".repeat(SW)}${R}`));
|
|
8302
|
+
for (const s of settings) {
|
|
8303
|
+
const def = isDef(s.value, s.defaultValue);
|
|
8304
|
+
const set = s.value !== undefined && s.value !== null && s.value !== "";
|
|
8305
|
+
let ico, st;
|
|
8306
|
+
if (!set && s.required) {
|
|
8307
|
+
ico = `${ANSI.brightRed}◆${R}`;
|
|
8308
|
+
st = `${ANSI.brightRed}REQUIRED${R}`;
|
|
8309
|
+
} else if (!set) {
|
|
8310
|
+
ico = `${D}○${R}`;
|
|
8311
|
+
st = `${D}default${R}`;
|
|
8312
|
+
} else if (def) {
|
|
8313
|
+
ico = `${ANSI.brightBlue}●${R}`;
|
|
8314
|
+
st = `${ANSI.brightBlue}default${R}`;
|
|
8315
|
+
} else {
|
|
8316
|
+
ico = `${G}✓${R}`;
|
|
8317
|
+
st = `${G}custom${R}`;
|
|
8318
|
+
}
|
|
8319
|
+
const name = pad(s.name, NW - 2);
|
|
8320
|
+
const val = pad(fmtVal(s.value ?? s.defaultValue, s.sensitive ?? false, VW), VW);
|
|
8321
|
+
const status = pad(st, SW);
|
|
8322
|
+
lines.push(row(` ${ico} ${c2}${name}${R} ${val} ${status}`));
|
|
8323
|
+
}
|
|
8324
|
+
lines.push(mid);
|
|
8325
|
+
lines.push(row(` ${D}${G}✓${D} custom ${ANSI.brightBlue}●${D} default ○ unset ${ANSI.brightRed}◆${D} required → Set in .env${R}`));
|
|
8326
|
+
} else {
|
|
8327
|
+
lines.push(row(` ${G}▸${R} ${Y}Actions${R} reply, sendMessage, followRoom, muteRoom, generateImage...`));
|
|
8328
|
+
lines.push(row(` ${G}▸${R} ${Y}Evaluators${R} reflection, memory consolidation, learning`));
|
|
8329
|
+
lines.push(row(` ${G}▸${R} ${Y}Providers${R} time, entities, facts, relationships, attachments...`));
|
|
8330
|
+
lines.push(row(` ${G}▸${R} ${Y}Services${R} TaskService, EmbeddingGenerationService`));
|
|
8331
|
+
lines.push(mid);
|
|
8332
|
+
lines.push(row(` ${D}The foundation that gives every elizaOS agent its core capabilities${R}`));
|
|
8333
|
+
}
|
|
8334
|
+
lines.push(bot);
|
|
8335
|
+
lines.push("");
|
|
8336
|
+
runtime.logger.info(lines.join(`
|
|
8337
|
+
`));
|
|
8338
|
+
}
|
|
7597
8339
|
|
|
7598
8340
|
// src/index.ts
|
|
8341
|
+
var isMemoryCreationDisabled = (runtime) => {
|
|
8342
|
+
const setting = runtime.getSetting("DISABLE_MEMORY_CREATION");
|
|
8343
|
+
if (typeof setting === "boolean") {
|
|
8344
|
+
return setting;
|
|
8345
|
+
}
|
|
8346
|
+
if (typeof setting === "string") {
|
|
8347
|
+
return parseBooleanFromText3(setting);
|
|
8348
|
+
}
|
|
8349
|
+
if (setting != null) {
|
|
8350
|
+
return parseBooleanFromText3(String(setting));
|
|
8351
|
+
}
|
|
8352
|
+
return false;
|
|
8353
|
+
};
|
|
8354
|
+
var getAllowedMemorySources = (runtime) => {
|
|
8355
|
+
const setting = runtime.getSetting("ALLOW_MEMORY_SOURCE_IDS");
|
|
8356
|
+
if (Array.isArray(setting)) {
|
|
8357
|
+
return setting.map((value) => String(value).trim()).filter(Boolean);
|
|
8358
|
+
}
|
|
8359
|
+
if (typeof setting === "string") {
|
|
8360
|
+
const trimmed = setting.trim();
|
|
8361
|
+
if (!trimmed) {
|
|
8362
|
+
return null;
|
|
8363
|
+
}
|
|
8364
|
+
if (trimmed.startsWith("[")) {
|
|
8365
|
+
try {
|
|
8366
|
+
const parsed = JSON.parse(trimmed);
|
|
8367
|
+
if (Array.isArray(parsed)) {
|
|
8368
|
+
return parsed.map((value) => String(value).trim()).filter(Boolean);
|
|
8369
|
+
}
|
|
8370
|
+
runtime.logger.warn({ src: "plugin:bootstrap", parsed }, "ALLOW_MEMORY_SOURCE_IDS JSON did not parse to an array; ignoring setting");
|
|
8371
|
+
return null;
|
|
8372
|
+
} catch (error) {
|
|
8373
|
+
runtime.logger.warn({ src: "plugin:bootstrap", error, setting: trimmed }, "Failed to parse ALLOW_MEMORY_SOURCE_IDS JSON; ignoring setting");
|
|
8374
|
+
return null;
|
|
8375
|
+
}
|
|
8376
|
+
}
|
|
8377
|
+
return trimmed.split(",").map((value) => value.trim()).filter(Boolean);
|
|
8378
|
+
}
|
|
8379
|
+
if (setting != null) {
|
|
8380
|
+
return [String(setting).trim()].filter(Boolean);
|
|
8381
|
+
}
|
|
8382
|
+
return null;
|
|
8383
|
+
};
|
|
7599
8384
|
async function fetchMediaData(attachments) {
|
|
7600
8385
|
return Promise.all(attachments.map(async (attachment) => {
|
|
8386
|
+
if (attachment.url.startsWith("data:")) {
|
|
8387
|
+
const match = attachment.url.match(/^data:([^;]+);base64,(.+)$/);
|
|
8388
|
+
if (match) {
|
|
8389
|
+
const mediaType = match[1];
|
|
8390
|
+
const base64Data = match[2];
|
|
8391
|
+
const mediaBuffer = Buffer.from(base64Data, "base64");
|
|
8392
|
+
return { data: mediaBuffer, mediaType };
|
|
8393
|
+
}
|
|
8394
|
+
throw new Error(`Invalid data URL format: ${attachment.url.substring(0, 50)}...`);
|
|
8395
|
+
}
|
|
7601
8396
|
if (/^(http|https):\/\//.test(attachment.url)) {
|
|
7602
8397
|
const response = await fetch(attachment.url);
|
|
7603
8398
|
if (!response.ok) {
|
|
@@ -7619,12 +8414,13 @@ async function processAttachments(attachments, runtime) {
|
|
|
7619
8414
|
for (const attachment of attachments) {
|
|
7620
8415
|
try {
|
|
7621
8416
|
const processedAttachment = { ...attachment };
|
|
8417
|
+
const isDataUrl = attachment.url.startsWith("data:");
|
|
7622
8418
|
const isRemote = /^(http|https):\/\//.test(attachment.url);
|
|
7623
|
-
const url = isRemote ? attachment.url : getLocalServerUrl(attachment.url);
|
|
8419
|
+
const url = isRemote ? attachment.url : isDataUrl ? attachment.url : getLocalServerUrl(attachment.url);
|
|
7624
8420
|
if (attachment.contentType === ContentType2.IMAGE && !attachment.description) {
|
|
7625
|
-
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url }, "Generating description for image");
|
|
8421
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url?.substring(0, 100) }, "Generating description for image");
|
|
7626
8422
|
let imageUrl = url;
|
|
7627
|
-
if (!isRemote) {
|
|
8423
|
+
if (!isRemote && !isDataUrl) {
|
|
7628
8424
|
const res = await fetch(url);
|
|
7629
8425
|
if (!res.ok) {
|
|
7630
8426
|
throw new Error(`Failed to fetch image: ${res.statusText}`);
|
|
@@ -7767,18 +8563,42 @@ var reactionReceivedHandler = async ({
|
|
|
7767
8563
|
message
|
|
7768
8564
|
}) => {
|
|
7769
8565
|
try {
|
|
8566
|
+
const disableMemoryCreation = isMemoryCreationDisabled(runtime);
|
|
8567
|
+
const allowedSources = getAllowedMemorySources(runtime);
|
|
8568
|
+
const reactionSourceId = message.metadata?.sourceId;
|
|
8569
|
+
const sourceAllowed = !allowedSources || typeof reactionSourceId === "string" && allowedSources.includes(reactionSourceId);
|
|
8570
|
+
if (disableMemoryCreation) {
|
|
8571
|
+
runtime.logger.debug({
|
|
8572
|
+
src: "plugin:bootstrap",
|
|
8573
|
+
agentId: runtime.agentId,
|
|
8574
|
+
messageId: message.id,
|
|
8575
|
+
sourceId: reactionSourceId ?? null
|
|
8576
|
+
}, "DISABLE_MEMORY_CREATION enabled; skipping reaction memory creation");
|
|
8577
|
+
return;
|
|
8578
|
+
}
|
|
8579
|
+
if (!sourceAllowed) {
|
|
8580
|
+
runtime.logger.info({
|
|
8581
|
+
src: "plugin:bootstrap",
|
|
8582
|
+
agentId: runtime.agentId,
|
|
8583
|
+
messageId: message.id,
|
|
8584
|
+
sourceId: reactionSourceId ?? null,
|
|
8585
|
+
allowedSources
|
|
8586
|
+
}, "Reaction source not whitelisted; skipping reaction memory creation");
|
|
8587
|
+
return;
|
|
8588
|
+
}
|
|
7770
8589
|
await runtime.createMemory(message, "messages");
|
|
8590
|
+
runtime.logger.debug({
|
|
8591
|
+
src: "plugin:bootstrap",
|
|
8592
|
+
agentId: runtime.agentId,
|
|
8593
|
+
messageId: message.id,
|
|
8594
|
+
sourceId: reactionSourceId ?? null
|
|
8595
|
+
}, "Stored reaction memory");
|
|
7771
8596
|
} catch (error) {
|
|
7772
|
-
|
|
7773
|
-
if (isDuplicateKeyError) {
|
|
8597
|
+
if (error.code === "23505") {
|
|
7774
8598
|
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Duplicate reaction memory, skipping");
|
|
7775
8599
|
return;
|
|
7776
8600
|
}
|
|
7777
|
-
runtime.logger.error({
|
|
7778
|
-
src: "plugin:bootstrap",
|
|
7779
|
-
agentId: runtime.agentId,
|
|
7780
|
-
error: error instanceof Error ? error.message : String(error)
|
|
7781
|
-
}, "Error in reaction handler");
|
|
8601
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in reaction handler");
|
|
7782
8602
|
}
|
|
7783
8603
|
};
|
|
7784
8604
|
var postGeneratedHandler = async ({
|
|
@@ -7806,7 +8626,7 @@ var postGeneratedHandler = async ({
|
|
|
7806
8626
|
worldId
|
|
7807
8627
|
});
|
|
7808
8628
|
const message = {
|
|
7809
|
-
id:
|
|
8629
|
+
id: createUniqueUuid3(runtime, `tweet-${Date.now()}`),
|
|
7810
8630
|
entityId: runtime.agentId,
|
|
7811
8631
|
agentId: runtime.agentId,
|
|
7812
8632
|
roomId,
|
|
@@ -7825,7 +8645,7 @@ var postGeneratedHandler = async ({
|
|
|
7825
8645
|
const entity = await runtime.getEntityById(runtime.agentId);
|
|
7826
8646
|
const metadata = entity?.metadata;
|
|
7827
8647
|
if (metadata?.twitter?.userName || metadata?.userName) {
|
|
7828
|
-
state.values.twitterUserName = metadata.twitter?.userName
|
|
8648
|
+
state.values.twitterUserName = metadata.twitter?.userName ?? metadata.userName;
|
|
7829
8649
|
}
|
|
7830
8650
|
const prompt = composePromptFromState10({
|
|
7831
8651
|
state,
|
|
@@ -7947,8 +8767,8 @@ var syncSingleUser = async (entityId, runtime, messageServerId, channelId, type,
|
|
|
7947
8767
|
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, entityId: entity?.id }, "Cannot sync user without a valid channelId");
|
|
7948
8768
|
return;
|
|
7949
8769
|
}
|
|
7950
|
-
const roomId =
|
|
7951
|
-
const worldId =
|
|
8770
|
+
const roomId = createUniqueUuid3(runtime, channelId);
|
|
8771
|
+
const worldId = createUniqueUuid3(runtime, messageServerId);
|
|
7952
8772
|
const worldMetadata = type === ChannelType9.DM ? {
|
|
7953
8773
|
ownership: {
|
|
7954
8774
|
ownerId: entityId
|
|
@@ -8026,14 +8846,9 @@ var handleServerSync = async ({
|
|
|
8026
8846
|
}, "Error processing standardized server data");
|
|
8027
8847
|
}
|
|
8028
8848
|
};
|
|
8029
|
-
var controlMessageHandler = async ({ runtime, message }) => {
|
|
8849
|
+
var controlMessageHandler = async ({ runtime, message, source: _source }) => {
|
|
8030
8850
|
try {
|
|
8031
|
-
runtime.logger.debug({
|
|
8032
|
-
src: "plugin:bootstrap",
|
|
8033
|
-
agentId: runtime.agentId,
|
|
8034
|
-
action: message.payload.action,
|
|
8035
|
-
roomId: message.roomId
|
|
8036
|
-
}, "Processing control message");
|
|
8851
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, action: message.payload.action, roomId: message.roomId }, "Processing control message");
|
|
8037
8852
|
const serviceNames = Array.from(runtime.getAllServices().keys());
|
|
8038
8853
|
const websocketServiceName = serviceNames.find((name) => name.toLowerCase().includes("websocket") || name.toLowerCase().includes("socket"));
|
|
8039
8854
|
if (websocketServiceName) {
|
|
@@ -8055,11 +8870,7 @@ var controlMessageHandler = async ({ runtime, message }) => {
|
|
|
8055
8870
|
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId }, "No WebSocket service found to send control message");
|
|
8056
8871
|
}
|
|
8057
8872
|
} catch (error) {
|
|
8058
|
-
runtime.logger.error({
|
|
8059
|
-
src: "plugin:bootstrap",
|
|
8060
|
-
agentId: runtime.agentId,
|
|
8061
|
-
error: error instanceof Error ? error.message : String(error)
|
|
8062
|
-
}, "Error processing control message");
|
|
8873
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing control message");
|
|
8063
8874
|
}
|
|
8064
8875
|
};
|
|
8065
8876
|
var events = {
|
|
@@ -8109,7 +8920,7 @@ var events = {
|
|
|
8109
8920
|
}
|
|
8110
8921
|
const channelType = payload.metadata?.type;
|
|
8111
8922
|
if (typeof channelType !== "string") {
|
|
8112
|
-
payload.runtime.logger.warn("Missing channel type in entity payload");
|
|
8923
|
+
payload.runtime.logger.warn({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "Missing channel type in entity payload");
|
|
8113
8924
|
return;
|
|
8114
8925
|
}
|
|
8115
8926
|
await syncSingleUser(payload.entityId, payload.runtime, payload.worldId, payload.roomId, channelType, payload.source);
|
|
@@ -8152,7 +8963,7 @@ var events = {
|
|
|
8152
8963
|
}
|
|
8153
8964
|
}
|
|
8154
8965
|
} catch (error) {
|
|
8155
|
-
|
|
8966
|
+
logger18.error({
|
|
8156
8967
|
src: "plugin:bootstrap",
|
|
8157
8968
|
agentId: payload.runtime.agentId,
|
|
8158
8969
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8176,13 +8987,13 @@ var events = {
|
|
|
8176
8987
|
source: "actionHandler"
|
|
8177
8988
|
}
|
|
8178
8989
|
});
|
|
8179
|
-
|
|
8990
|
+
logger18.debug({
|
|
8180
8991
|
src: "plugin:bootstrap",
|
|
8181
8992
|
agentId: payload.runtime.agentId,
|
|
8182
8993
|
actionName: payload.content?.actions?.[0]
|
|
8183
8994
|
}, "Logged ACTION_STARTED event");
|
|
8184
8995
|
} catch (error) {
|
|
8185
|
-
|
|
8996
|
+
logger18.error({
|
|
8186
8997
|
src: "plugin:bootstrap",
|
|
8187
8998
|
agentId: payload.runtime.agentId,
|
|
8188
8999
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8200,7 +9011,7 @@ var events = {
|
|
|
8200
9011
|
}
|
|
8201
9012
|
}
|
|
8202
9013
|
} catch (error) {
|
|
8203
|
-
|
|
9014
|
+
logger18.error({
|
|
8204
9015
|
src: "plugin:bootstrap",
|
|
8205
9016
|
agentId: payload.runtime.agentId,
|
|
8206
9017
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8210,7 +9021,7 @@ var events = {
|
|
|
8210
9021
|
],
|
|
8211
9022
|
[EventType2.EVALUATOR_STARTED]: [
|
|
8212
9023
|
async (payload) => {
|
|
8213
|
-
|
|
9024
|
+
logger18.debug({
|
|
8214
9025
|
src: "plugin:bootstrap:evaluator",
|
|
8215
9026
|
agentId: payload.runtime.agentId,
|
|
8216
9027
|
evaluatorName: payload.evaluatorName,
|
|
@@ -8221,7 +9032,7 @@ var events = {
|
|
|
8221
9032
|
[EventType2.EVALUATOR_COMPLETED]: [
|
|
8222
9033
|
async (payload) => {
|
|
8223
9034
|
const status = payload.error ? "failed" : "completed";
|
|
8224
|
-
|
|
9035
|
+
logger18.debug({
|
|
8225
9036
|
src: "plugin:bootstrap:evaluator",
|
|
8226
9037
|
agentId: payload.runtime.agentId,
|
|
8227
9038
|
status,
|
|
@@ -8248,9 +9059,9 @@ var events = {
|
|
|
8248
9059
|
source: payload.source || "unknown"
|
|
8249
9060
|
}
|
|
8250
9061
|
});
|
|
8251
|
-
|
|
9062
|
+
logger18.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_STARTED event");
|
|
8252
9063
|
} catch (error) {
|
|
8253
|
-
|
|
9064
|
+
logger18.error({
|
|
8254
9065
|
src: "plugin:bootstrap",
|
|
8255
9066
|
agentId: payload.runtime.agentId,
|
|
8256
9067
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8278,14 +9089,14 @@ var events = {
|
|
|
8278
9089
|
source: payload.source || "unknown"
|
|
8279
9090
|
}
|
|
8280
9091
|
});
|
|
8281
|
-
|
|
9092
|
+
logger18.debug({
|
|
8282
9093
|
src: "plugin:bootstrap",
|
|
8283
9094
|
agentId: payload.runtime.agentId,
|
|
8284
9095
|
runId: payload.runId,
|
|
8285
9096
|
status: payload.status
|
|
8286
9097
|
}, "Logged RUN_ENDED event");
|
|
8287
9098
|
} catch (error) {
|
|
8288
|
-
|
|
9099
|
+
logger18.error({
|
|
8289
9100
|
src: "plugin:bootstrap",
|
|
8290
9101
|
agentId: payload.runtime.agentId,
|
|
8291
9102
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8313,9 +9124,9 @@ var events = {
|
|
|
8313
9124
|
source: payload.source || "unknown"
|
|
8314
9125
|
}
|
|
8315
9126
|
});
|
|
8316
|
-
|
|
9127
|
+
logger18.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_TIMEOUT event");
|
|
8317
9128
|
} catch (error) {
|
|
8318
|
-
|
|
9129
|
+
logger18.error({
|
|
8319
9130
|
src: "plugin:bootstrap",
|
|
8320
9131
|
agentId: payload.runtime.agentId,
|
|
8321
9132
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -8325,10 +9136,6 @@ var events = {
|
|
|
8325
9136
|
],
|
|
8326
9137
|
[EventType2.CONTROL_MESSAGE]: [
|
|
8327
9138
|
async (payload) => {
|
|
8328
|
-
if (!payload.message) {
|
|
8329
|
-
payload.runtime.logger.warn({ src: "plugin:bootstrap" }, "CONTROL_MESSAGE received without message property");
|
|
8330
|
-
return;
|
|
8331
|
-
}
|
|
8332
9139
|
await controlMessageHandler(payload);
|
|
8333
9140
|
}
|
|
8334
9141
|
]
|
|
@@ -8336,6 +9143,31 @@ var events = {
|
|
|
8336
9143
|
var bootstrapPlugin = {
|
|
8337
9144
|
name: "bootstrap",
|
|
8338
9145
|
description: "Agent bootstrap with basic actions and evaluators",
|
|
9146
|
+
init: async (_config, runtime) => {
|
|
9147
|
+
const settings = [
|
|
9148
|
+
{
|
|
9149
|
+
name: "DISABLE_MEMORY_CREATION",
|
|
9150
|
+
value: runtime.getSetting("DISABLE_MEMORY_CREATION"),
|
|
9151
|
+
defaultValue: false
|
|
9152
|
+
},
|
|
9153
|
+
{
|
|
9154
|
+
name: "ALLOW_MEMORY_SOURCE_IDS",
|
|
9155
|
+
value: runtime.getSetting("ALLOW_MEMORY_SOURCE_IDS"),
|
|
9156
|
+
defaultValue: undefined
|
|
9157
|
+
},
|
|
9158
|
+
{
|
|
9159
|
+
name: "ALWAYS_RESPOND_CHANNELS",
|
|
9160
|
+
value: runtime.getSetting("ALWAYS_RESPOND_CHANNELS"),
|
|
9161
|
+
defaultValue: undefined
|
|
9162
|
+
},
|
|
9163
|
+
{
|
|
9164
|
+
name: "ALWAYS_RESPOND_SOURCES",
|
|
9165
|
+
value: runtime.getSetting("ALWAYS_RESPOND_SOURCES"),
|
|
9166
|
+
defaultValue: undefined
|
|
9167
|
+
}
|
|
9168
|
+
];
|
|
9169
|
+
printBanner({ runtime, settings });
|
|
9170
|
+
},
|
|
8339
9171
|
actions: [
|
|
8340
9172
|
replyAction,
|
|
8341
9173
|
followRoomAction,
|
|
@@ -8369,13 +9201,16 @@ var bootstrapPlugin = {
|
|
|
8369
9201
|
actionStateProvider,
|
|
8370
9202
|
characterProvider,
|
|
8371
9203
|
recentMessagesProvider,
|
|
8372
|
-
worldProvider
|
|
9204
|
+
worldProvider,
|
|
9205
|
+
bootstrapInstructionsProvider,
|
|
9206
|
+
bootstrapSettingsProvider
|
|
8373
9207
|
],
|
|
8374
9208
|
services: [TaskService, EmbeddingGenerationService]
|
|
8375
9209
|
};
|
|
8376
9210
|
var src_default = bootstrapPlugin;
|
|
8377
9211
|
export {
|
|
8378
9212
|
worldProvider,
|
|
9213
|
+
withTimeout,
|
|
8379
9214
|
updateSettingsAction,
|
|
8380
9215
|
updateRoleAction,
|
|
8381
9216
|
updateEntityAction,
|
|
@@ -8394,11 +9229,28 @@ export {
|
|
|
8394
9229
|
processAttachments,
|
|
8395
9230
|
noneAction,
|
|
8396
9231
|
muteRoomAction,
|
|
9232
|
+
markNoSettings,
|
|
9233
|
+
markNoServerId,
|
|
9234
|
+
invalidateWorldCacheByServerId,
|
|
9235
|
+
invalidateWorldCache,
|
|
9236
|
+
invalidateRoomCacheByExternalId,
|
|
9237
|
+
invalidateRoomCache,
|
|
9238
|
+
invalidateEntitiesCache,
|
|
8397
9239
|
ignoreAction,
|
|
9240
|
+
hasNoSettings,
|
|
9241
|
+
hasNoServerId,
|
|
9242
|
+
getCachedWorldSettings,
|
|
9243
|
+
getCachedWorld,
|
|
9244
|
+
getCachedSettingsByServerId,
|
|
9245
|
+
getCachedRoomByExternalId,
|
|
9246
|
+
getCachedRoom,
|
|
9247
|
+
getCachedEntitiesForRoom,
|
|
9248
|
+
getCacheStats,
|
|
8398
9249
|
generateImageAction,
|
|
8399
9250
|
followRoomAction,
|
|
8400
9251
|
fetchMediaData,
|
|
8401
9252
|
factsProvider,
|
|
9253
|
+
extractWorldSettings,
|
|
8402
9254
|
evaluatorsProvider,
|
|
8403
9255
|
entitiesProvider,
|
|
8404
9256
|
src_default as default,
|
|
@@ -8413,5 +9265,5 @@ export {
|
|
|
8413
9265
|
actionStateProvider
|
|
8414
9266
|
};
|
|
8415
9267
|
|
|
8416
|
-
//# debugId=
|
|
9268
|
+
//# debugId=6015D97D31F852B564756E2164756E21
|
|
8417
9269
|
//# sourceMappingURL=index.js.map
|