@elizaos/plugin-bootstrap 1.0.0-beta.32 → 1.0.0-beta.34
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 +275 -64
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -72,11 +72,11 @@ var require_dedent = __commonJS({
|
|
|
72
72
|
// src/index.ts
|
|
73
73
|
import {
|
|
74
74
|
asUUID,
|
|
75
|
-
ChannelType as
|
|
75
|
+
ChannelType as ChannelType10,
|
|
76
76
|
composePromptFromState as composePromptFromState9,
|
|
77
77
|
createUniqueUuid as createUniqueUuid4,
|
|
78
78
|
EventType as EventType2,
|
|
79
|
-
logger as
|
|
79
|
+
logger as logger17,
|
|
80
80
|
messageHandlerTemplate,
|
|
81
81
|
ModelType as ModelType13,
|
|
82
82
|
parseJSONObjectFromText as parseJSONObjectFromText4,
|
|
@@ -1602,7 +1602,6 @@ var updateRoleAction = {
|
|
|
1602
1602
|
]
|
|
1603
1603
|
]
|
|
1604
1604
|
};
|
|
1605
|
-
var roles_default = updateRoleAction;
|
|
1606
1605
|
|
|
1607
1606
|
// src/actions/sendMessage.ts
|
|
1608
1607
|
import {
|
|
@@ -2486,7 +2485,6 @@ var updateSettingsAction = {
|
|
|
2486
2485
|
]
|
|
2487
2486
|
]
|
|
2488
2487
|
};
|
|
2489
|
-
var settings_default = updateSettingsAction;
|
|
2490
2488
|
|
|
2491
2489
|
// src/actions/unfollowRoom.ts
|
|
2492
2490
|
import {
|
|
@@ -4867,13 +4865,157 @@ var timeProvider = {
|
|
|
4867
4865
|
}
|
|
4868
4866
|
};
|
|
4869
4867
|
|
|
4868
|
+
// src/providers/world.ts
|
|
4869
|
+
import {
|
|
4870
|
+
logger as logger14,
|
|
4871
|
+
addHeader as addHeader10,
|
|
4872
|
+
ChannelType as ChannelType8
|
|
4873
|
+
} from "@elizaos/core";
|
|
4874
|
+
var worldProvider = {
|
|
4875
|
+
name: "WORLD",
|
|
4876
|
+
description: "World and environment information",
|
|
4877
|
+
dynamic: true,
|
|
4878
|
+
get: async (runtime, message) => {
|
|
4879
|
+
try {
|
|
4880
|
+
logger14.debug("\u{1F310} World provider activated for roomId:", message.roomId);
|
|
4881
|
+
const currentRoom = await runtime.getRoom(message.roomId);
|
|
4882
|
+
if (!currentRoom) {
|
|
4883
|
+
logger14.warn(`World provider: Room not found for roomId ${message.roomId}`);
|
|
4884
|
+
return {
|
|
4885
|
+
data: {
|
|
4886
|
+
world: {
|
|
4887
|
+
info: "Unable to retrieve world information - room not found"
|
|
4888
|
+
}
|
|
4889
|
+
},
|
|
4890
|
+
text: "Unable to retrieve world information - room not found"
|
|
4891
|
+
};
|
|
4892
|
+
}
|
|
4893
|
+
logger14.debug(`\u{1F310} World provider: Found room "${currentRoom.name}" (${currentRoom.type})`);
|
|
4894
|
+
const worldId = currentRoom.worldId;
|
|
4895
|
+
const world = await runtime.getWorld(worldId);
|
|
4896
|
+
if (!world) {
|
|
4897
|
+
logger14.warn(`World provider: World not found for worldId ${worldId}`);
|
|
4898
|
+
return {
|
|
4899
|
+
data: {
|
|
4900
|
+
world: {
|
|
4901
|
+
info: "Unable to retrieve world information - world not found"
|
|
4902
|
+
}
|
|
4903
|
+
},
|
|
4904
|
+
text: "Unable to retrieve world information - world not found"
|
|
4905
|
+
};
|
|
4906
|
+
}
|
|
4907
|
+
logger14.debug(`\u{1F310} World provider: Found world "${world.name}" (ID: ${world.id})`);
|
|
4908
|
+
const worldRooms = await runtime.getRooms(worldId);
|
|
4909
|
+
logger14.debug(`\u{1F310} World provider: Found ${worldRooms.length} rooms in world "${world.name}"`);
|
|
4910
|
+
const participants = await runtime.getParticipantsForRoom(message.roomId);
|
|
4911
|
+
logger14.debug(
|
|
4912
|
+
`\u{1F310} World provider: Found ${participants.length} participants in room "${currentRoom.name}"`
|
|
4913
|
+
);
|
|
4914
|
+
const channelsByType = {
|
|
4915
|
+
text: [],
|
|
4916
|
+
voice: [],
|
|
4917
|
+
dm: [],
|
|
4918
|
+
feed: [],
|
|
4919
|
+
thread: [],
|
|
4920
|
+
other: []
|
|
4921
|
+
};
|
|
4922
|
+
for (const room of worldRooms) {
|
|
4923
|
+
const roomInfo = {
|
|
4924
|
+
id: room.id,
|
|
4925
|
+
name: room.name,
|
|
4926
|
+
isCurrentChannel: room.id === message.roomId
|
|
4927
|
+
};
|
|
4928
|
+
if (room.type === ChannelType8.GROUP || room.type === ChannelType8.WORLD || room.type === ChannelType8.FORUM) {
|
|
4929
|
+
channelsByType.text.push(roomInfo);
|
|
4930
|
+
} else if (room.type === ChannelType8.VOICE_GROUP || room.type === ChannelType8.VOICE_DM) {
|
|
4931
|
+
channelsByType.voice.push(roomInfo);
|
|
4932
|
+
} else if (room.type === ChannelType8.DM || room.type === ChannelType8.SELF) {
|
|
4933
|
+
channelsByType.dm.push(roomInfo);
|
|
4934
|
+
} else if (room.type === ChannelType8.FEED) {
|
|
4935
|
+
channelsByType.feed.push(roomInfo);
|
|
4936
|
+
} else if (room.type === ChannelType8.THREAD) {
|
|
4937
|
+
channelsByType.thread.push(roomInfo);
|
|
4938
|
+
} else {
|
|
4939
|
+
channelsByType.other.push({
|
|
4940
|
+
...roomInfo,
|
|
4941
|
+
type: room.type
|
|
4942
|
+
});
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
const worldInfoText = [
|
|
4946
|
+
`# World: ${world.name}`,
|
|
4947
|
+
`Current Channel: ${currentRoom.name} (${currentRoom.type})`,
|
|
4948
|
+
`Total Channels: ${worldRooms.length}`,
|
|
4949
|
+
`Participants in current channel: ${participants.length}`,
|
|
4950
|
+
"",
|
|
4951
|
+
`Text channels: ${channelsByType.text.length}`,
|
|
4952
|
+
`Voice channels: ${channelsByType.voice.length}`,
|
|
4953
|
+
`DM channels: ${channelsByType.dm.length}`,
|
|
4954
|
+
`Feed channels: ${channelsByType.feed.length}`,
|
|
4955
|
+
`Thread channels: ${channelsByType.thread.length}`,
|
|
4956
|
+
`Other channels: ${channelsByType.other.length}`
|
|
4957
|
+
].join("\n");
|
|
4958
|
+
const data = {
|
|
4959
|
+
world: {
|
|
4960
|
+
id: world.id,
|
|
4961
|
+
name: world.name,
|
|
4962
|
+
serverId: world.serverId,
|
|
4963
|
+
metadata: world.metadata || {},
|
|
4964
|
+
currentRoom: {
|
|
4965
|
+
id: currentRoom.id,
|
|
4966
|
+
name: currentRoom.name,
|
|
4967
|
+
type: currentRoom.type,
|
|
4968
|
+
channelId: currentRoom.channelId,
|
|
4969
|
+
participantCount: participants.length
|
|
4970
|
+
},
|
|
4971
|
+
channels: channelsByType,
|
|
4972
|
+
channelStats: {
|
|
4973
|
+
total: worldRooms.length,
|
|
4974
|
+
text: channelsByType.text.length,
|
|
4975
|
+
voice: channelsByType.voice.length,
|
|
4976
|
+
dm: channelsByType.dm.length,
|
|
4977
|
+
feed: channelsByType.feed.length,
|
|
4978
|
+
thread: channelsByType.thread.length,
|
|
4979
|
+
other: channelsByType.other.length
|
|
4980
|
+
}
|
|
4981
|
+
}
|
|
4982
|
+
};
|
|
4983
|
+
const values = {
|
|
4984
|
+
worldName: world.name,
|
|
4985
|
+
currentChannelName: currentRoom.name,
|
|
4986
|
+
worldInfo: worldInfoText
|
|
4987
|
+
};
|
|
4988
|
+
const formattedText = addHeader10("# World Information", worldInfoText);
|
|
4989
|
+
logger14.debug("\u{1F310} World provider completed successfully");
|
|
4990
|
+
return {
|
|
4991
|
+
data,
|
|
4992
|
+
values,
|
|
4993
|
+
text: formattedText
|
|
4994
|
+
};
|
|
4995
|
+
} catch (error) {
|
|
4996
|
+
logger14.error(
|
|
4997
|
+
`Error in world provider: ${error instanceof Error ? error.message : String(error)}`
|
|
4998
|
+
);
|
|
4999
|
+
return {
|
|
5000
|
+
data: {
|
|
5001
|
+
world: {
|
|
5002
|
+
info: "Error retrieving world information",
|
|
5003
|
+
error: error instanceof Error ? error.message : "Unknown error"
|
|
5004
|
+
}
|
|
5005
|
+
},
|
|
5006
|
+
text: "Error retrieving world information"
|
|
5007
|
+
};
|
|
5008
|
+
}
|
|
5009
|
+
}
|
|
5010
|
+
};
|
|
5011
|
+
|
|
4870
5012
|
// src/services/scenario.ts
|
|
4871
5013
|
import {
|
|
4872
|
-
ChannelType as
|
|
5014
|
+
ChannelType as ChannelType9,
|
|
4873
5015
|
EventType,
|
|
4874
5016
|
Service,
|
|
4875
5017
|
createUniqueUuid as createUniqueUuid3,
|
|
4876
|
-
logger as
|
|
5018
|
+
logger as logger15
|
|
4877
5019
|
} from "@elizaos/core";
|
|
4878
5020
|
var ScenarioService = class _ScenarioService extends Service {
|
|
4879
5021
|
/**
|
|
@@ -4917,7 +5059,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
4917
5059
|
startTime: Date.now(),
|
|
4918
5060
|
completed: false
|
|
4919
5061
|
});
|
|
4920
|
-
|
|
5062
|
+
logger15.debug("Evaluator started", data);
|
|
4921
5063
|
return Promise.resolve();
|
|
4922
5064
|
});
|
|
4923
5065
|
this.runtime.registerEvent(
|
|
@@ -4928,7 +5070,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
4928
5070
|
evaluator.completed = true;
|
|
4929
5071
|
evaluator.error = data.error;
|
|
4930
5072
|
}
|
|
4931
|
-
|
|
5073
|
+
logger15.debug("Evaluator completed", data);
|
|
4932
5074
|
return Promise.resolve();
|
|
4933
5075
|
}
|
|
4934
5076
|
);
|
|
@@ -5007,7 +5149,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
5007
5149
|
id: roomId,
|
|
5008
5150
|
name,
|
|
5009
5151
|
source: "scenario",
|
|
5010
|
-
type:
|
|
5152
|
+
type: ChannelType9.GROUP,
|
|
5011
5153
|
channelId: roomId,
|
|
5012
5154
|
serverId: worldId
|
|
5013
5155
|
});
|
|
@@ -5051,7 +5193,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
5051
5193
|
source: "scenario",
|
|
5052
5194
|
name: sender.character.name,
|
|
5053
5195
|
userName: sender.character.name,
|
|
5054
|
-
channelType:
|
|
5196
|
+
channelType: ChannelType9.GROUP
|
|
5055
5197
|
}
|
|
5056
5198
|
};
|
|
5057
5199
|
const participants = await this.runtime.getParticipantsForRoom(roomId);
|
|
@@ -5062,7 +5204,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
5062
5204
|
roomId,
|
|
5063
5205
|
entityId: participantId,
|
|
5064
5206
|
source: "scenario",
|
|
5065
|
-
type:
|
|
5207
|
+
type: ChannelType9.GROUP
|
|
5066
5208
|
});
|
|
5067
5209
|
}
|
|
5068
5210
|
}
|
|
@@ -5109,7 +5251,7 @@ var ScenarioService = class _ScenarioService extends Service {
|
|
|
5109
5251
|
|
|
5110
5252
|
// src/services/task.ts
|
|
5111
5253
|
import {
|
|
5112
|
-
logger as
|
|
5254
|
+
logger as logger16,
|
|
5113
5255
|
Service as Service2,
|
|
5114
5256
|
ServiceType
|
|
5115
5257
|
} from "@elizaos/core";
|
|
@@ -5137,21 +5279,21 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5137
5279
|
this.runtime.registerTaskWorker({
|
|
5138
5280
|
name: "REPEATING_TEST_TASK",
|
|
5139
5281
|
validate: async (_runtime, _message, _state) => {
|
|
5140
|
-
|
|
5282
|
+
logger16.debug("Validating repeating test task");
|
|
5141
5283
|
return true;
|
|
5142
5284
|
},
|
|
5143
5285
|
execute: async (_runtime, _options) => {
|
|
5144
|
-
|
|
5286
|
+
logger16.debug("Executing repeating test task");
|
|
5145
5287
|
}
|
|
5146
5288
|
});
|
|
5147
5289
|
this.runtime.registerTaskWorker({
|
|
5148
5290
|
name: "ONETIME_TEST_TASK",
|
|
5149
5291
|
validate: async (_runtime, _message, _state) => {
|
|
5150
|
-
|
|
5292
|
+
logger16.debug("Validating one-time test task");
|
|
5151
5293
|
return true;
|
|
5152
5294
|
},
|
|
5153
5295
|
execute: async (_runtime, _options) => {
|
|
5154
|
-
|
|
5296
|
+
logger16.debug("Executing one-time test task");
|
|
5155
5297
|
}
|
|
5156
5298
|
});
|
|
5157
5299
|
const tasks = await this.runtime.getTasksByName("REPEATING_TEST_TASK");
|
|
@@ -5188,7 +5330,7 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5188
5330
|
try {
|
|
5189
5331
|
await this.checkTasks();
|
|
5190
5332
|
} catch (error) {
|
|
5191
|
-
|
|
5333
|
+
logger16.error("Error checking tasks:", error);
|
|
5192
5334
|
}
|
|
5193
5335
|
}, this.TICK_INTERVAL);
|
|
5194
5336
|
}
|
|
@@ -5217,7 +5359,7 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5217
5359
|
continue;
|
|
5218
5360
|
}
|
|
5219
5361
|
} catch (error) {
|
|
5220
|
-
|
|
5362
|
+
logger16.error(`Error validating task ${task.name}:`, error);
|
|
5221
5363
|
continue;
|
|
5222
5364
|
}
|
|
5223
5365
|
}
|
|
@@ -5254,14 +5396,14 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5254
5396
|
continue;
|
|
5255
5397
|
}
|
|
5256
5398
|
if (now - taskStartTime >= updateIntervalMs) {
|
|
5257
|
-
|
|
5399
|
+
logger16.debug(
|
|
5258
5400
|
`Executing task ${task.name} - interval of ${updateIntervalMs}ms has elapsed`
|
|
5259
5401
|
);
|
|
5260
5402
|
await this.executeTask(task);
|
|
5261
5403
|
}
|
|
5262
5404
|
}
|
|
5263
5405
|
} catch (error) {
|
|
5264
|
-
|
|
5406
|
+
logger16.error("Error checking tasks:", error);
|
|
5265
5407
|
}
|
|
5266
5408
|
}
|
|
5267
5409
|
/**
|
|
@@ -5272,17 +5414,17 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5272
5414
|
async executeTask(task) {
|
|
5273
5415
|
try {
|
|
5274
5416
|
if (!task) {
|
|
5275
|
-
|
|
5417
|
+
logger16.debug(`Task ${task.id} not found`);
|
|
5276
5418
|
return;
|
|
5277
5419
|
}
|
|
5278
5420
|
const worker = this.runtime.getTaskWorker(task.name);
|
|
5279
5421
|
if (!worker) {
|
|
5280
|
-
|
|
5422
|
+
logger16.debug(`No worker found for task type: ${task.name}`);
|
|
5281
5423
|
return;
|
|
5282
5424
|
}
|
|
5283
|
-
|
|
5425
|
+
logger16.debug(`Executing task ${task.name} (${task.id})`);
|
|
5284
5426
|
await worker.execute(this.runtime, task.metadata || {}, task);
|
|
5285
|
-
|
|
5427
|
+
logger16.debug("task.tags are", task.tags);
|
|
5286
5428
|
if (task.tags?.includes("repeat")) {
|
|
5287
5429
|
await this.runtime.updateTask(task.id, {
|
|
5288
5430
|
metadata: {
|
|
@@ -5290,13 +5432,13 @@ var TaskService = class _TaskService extends Service2 {
|
|
|
5290
5432
|
updatedAt: Date.now()
|
|
5291
5433
|
}
|
|
5292
5434
|
});
|
|
5293
|
-
|
|
5435
|
+
logger16.debug(`Updated repeating task ${task.name} (${task.id}) with new timestamp`);
|
|
5294
5436
|
} else {
|
|
5295
5437
|
await this.runtime.deleteTask(task.id);
|
|
5296
|
-
|
|
5438
|
+
logger16.debug(`Deleted non-repeating task ${task.name} (${task.id}) after execution`);
|
|
5297
5439
|
}
|
|
5298
5440
|
} catch (error) {
|
|
5299
|
-
|
|
5441
|
+
logger16.error(`Error executing task ${task.id}:`, error);
|
|
5300
5442
|
}
|
|
5301
5443
|
}
|
|
5302
5444
|
/**
|
|
@@ -5398,7 +5540,7 @@ var messageReceivedHandler = async ({
|
|
|
5398
5540
|
]);
|
|
5399
5541
|
const agentUserState = await runtime.getParticipantUserState(message.roomId, runtime.agentId);
|
|
5400
5542
|
if (agentUserState === "MUTED" && !message.content.text?.toLowerCase().includes(runtime.character.name.toLowerCase())) {
|
|
5401
|
-
|
|
5543
|
+
logger17.debug("Ignoring muted room");
|
|
5402
5544
|
return;
|
|
5403
5545
|
}
|
|
5404
5546
|
let state = await runtime.composeState(message, [
|
|
@@ -5409,7 +5551,7 @@ var messageReceivedHandler = async ({
|
|
|
5409
5551
|
"ENTITIES"
|
|
5410
5552
|
]);
|
|
5411
5553
|
const room = await runtime.getRoom(message.roomId);
|
|
5412
|
-
const shouldSkipShouldRespond = room?.type ===
|
|
5554
|
+
const shouldSkipShouldRespond = room?.type === ChannelType10.DM || room?.type === ChannelType10.VOICE_DM || room?.type === ChannelType10.SELF;
|
|
5413
5555
|
let shouldRespond = true;
|
|
5414
5556
|
let providers = [];
|
|
5415
5557
|
if (!shouldSkipShouldRespond) {
|
|
@@ -5417,7 +5559,7 @@ var messageReceivedHandler = async ({
|
|
|
5417
5559
|
state,
|
|
5418
5560
|
template: runtime.character.templates?.shouldRespondTemplate || shouldRespondTemplate
|
|
5419
5561
|
});
|
|
5420
|
-
|
|
5562
|
+
logger17.debug(
|
|
5421
5563
|
`*** Should Respond Prompt for ${runtime.character.name} ***
|
|
5422
5564
|
`,
|
|
5423
5565
|
shouldRespondPrompt
|
|
@@ -5425,17 +5567,17 @@ var messageReceivedHandler = async ({
|
|
|
5425
5567
|
const response = await runtime.useModel(ModelType13.TEXT_SMALL, {
|
|
5426
5568
|
prompt: shouldRespondPrompt
|
|
5427
5569
|
});
|
|
5428
|
-
|
|
5570
|
+
logger17.debug(`*** Should Respond Response for ${runtime.character.name} ***
|
|
5429
5571
|
`, response);
|
|
5430
|
-
|
|
5572
|
+
logger17.debug(`*** Raw Response Type: ${typeof response} ***`);
|
|
5431
5573
|
let processedResponse = response;
|
|
5432
5574
|
if (typeof response === "string" && response.includes("```")) {
|
|
5433
|
-
|
|
5575
|
+
logger17.debug("*** Response contains code block markers, attempting to clean up ***");
|
|
5434
5576
|
processedResponse = response.replace(/```json\n|\n```|```/g, "");
|
|
5435
|
-
|
|
5577
|
+
logger17.debug("*** Processed Response ***\n", processedResponse);
|
|
5436
5578
|
}
|
|
5437
5579
|
const responseObject = parseJSONObjectFromText4(processedResponse);
|
|
5438
|
-
|
|
5580
|
+
logger17.debug("*** Parsed Response Object ***", responseObject);
|
|
5439
5581
|
shouldRespond = responseObject?.action && responseObject.action === "RESPOND";
|
|
5440
5582
|
providers = responseObject?.providers || [];
|
|
5441
5583
|
} else {
|
|
@@ -5449,8 +5591,8 @@ var messageReceivedHandler = async ({
|
|
|
5449
5591
|
const responseObject = parseJSONObjectFromText4(response);
|
|
5450
5592
|
providers = responseObject?.providers || [];
|
|
5451
5593
|
}
|
|
5452
|
-
|
|
5453
|
-
|
|
5594
|
+
logger17.debug("*** Should Respond ***", shouldRespond);
|
|
5595
|
+
logger17.debug("*** Providers Value ***", providers);
|
|
5454
5596
|
state = await runtime.composeState(message, null, providers);
|
|
5455
5597
|
let responseMessages = [];
|
|
5456
5598
|
if (shouldRespond) {
|
|
@@ -5468,12 +5610,12 @@ var messageReceivedHandler = async ({
|
|
|
5468
5610
|
responseContent = parseJSONObjectFromText4(response);
|
|
5469
5611
|
retries++;
|
|
5470
5612
|
if (!responseContent?.thought && !responseContent?.actions) {
|
|
5471
|
-
|
|
5613
|
+
logger17.warn("*** Missing required fields, retrying... ***");
|
|
5472
5614
|
}
|
|
5473
5615
|
}
|
|
5474
5616
|
const currentResponseId = agentResponses.get(message.roomId);
|
|
5475
5617
|
if (currentResponseId !== responseId) {
|
|
5476
|
-
|
|
5618
|
+
logger17.info(
|
|
5477
5619
|
`Response discarded - newer message being processed for agent: ${runtime.agentId}, room: ${message.roomId}`
|
|
5478
5620
|
);
|
|
5479
5621
|
return;
|
|
@@ -5544,10 +5686,10 @@ var reactionReceivedHandler = async ({
|
|
|
5544
5686
|
await runtime.createMemory(message, "messages");
|
|
5545
5687
|
} catch (error) {
|
|
5546
5688
|
if (error.code === "23505") {
|
|
5547
|
-
|
|
5689
|
+
logger17.warn("Duplicate reaction memory, skipping");
|
|
5548
5690
|
return;
|
|
5549
5691
|
}
|
|
5550
|
-
|
|
5692
|
+
logger17.error("Error in reaction handler:", error);
|
|
5551
5693
|
}
|
|
5552
5694
|
};
|
|
5553
5695
|
var postGeneratedHandler = async ({
|
|
@@ -5558,7 +5700,7 @@ var postGeneratedHandler = async ({
|
|
|
5558
5700
|
roomId,
|
|
5559
5701
|
source
|
|
5560
5702
|
}) => {
|
|
5561
|
-
|
|
5703
|
+
logger17.info("Generating new post...");
|
|
5562
5704
|
await runtime.ensureWorldExists({
|
|
5563
5705
|
id: worldId,
|
|
5564
5706
|
name: `${runtime.character.name}'s Feed`,
|
|
@@ -5569,7 +5711,7 @@ var postGeneratedHandler = async ({
|
|
|
5569
5711
|
id: roomId,
|
|
5570
5712
|
name: `${runtime.character.name}'s Feed`,
|
|
5571
5713
|
source,
|
|
5572
|
-
type:
|
|
5714
|
+
type: ChannelType10.FEED,
|
|
5573
5715
|
channelId: `${userId}-home`,
|
|
5574
5716
|
serverId: userId,
|
|
5575
5717
|
worldId
|
|
@@ -5611,7 +5753,7 @@ var postGeneratedHandler = async ({
|
|
|
5611
5753
|
content: {
|
|
5612
5754
|
text: cleanedText,
|
|
5613
5755
|
source,
|
|
5614
|
-
channelType:
|
|
5756
|
+
channelType: ChannelType10.FEED,
|
|
5615
5757
|
thought: jsonResponse.thought || "",
|
|
5616
5758
|
type: "post"
|
|
5617
5759
|
},
|
|
@@ -5625,10 +5767,10 @@ var postGeneratedHandler = async ({
|
|
|
5625
5767
|
};
|
|
5626
5768
|
var syncSingleUser = async (entityId, runtime, serverId, channelId, type, source) => {
|
|
5627
5769
|
const entity = await runtime.getEntityById(entityId);
|
|
5628
|
-
|
|
5770
|
+
logger17.info(`Syncing user: ${entity.metadata[source].username || entity.id}`);
|
|
5629
5771
|
try {
|
|
5630
5772
|
if (!channelId) {
|
|
5631
|
-
|
|
5773
|
+
logger17.warn(`Cannot sync user ${entity.id} without a valid channelId`);
|
|
5632
5774
|
return;
|
|
5633
5775
|
}
|
|
5634
5776
|
const roomId = createUniqueUuid4(runtime, channelId);
|
|
@@ -5644,9 +5786,9 @@ var syncSingleUser = async (entityId, runtime, serverId, channelId, type, source
|
|
|
5644
5786
|
type,
|
|
5645
5787
|
worldId
|
|
5646
5788
|
});
|
|
5647
|
-
|
|
5789
|
+
logger17.success(`Successfully synced user: ${entity.id}`);
|
|
5648
5790
|
} catch (error) {
|
|
5649
|
-
|
|
5791
|
+
logger17.error(`Error syncing user: ${error instanceof Error ? error.message : String(error)}`);
|
|
5650
5792
|
}
|
|
5651
5793
|
};
|
|
5652
5794
|
var handleServerSync = async ({
|
|
@@ -5657,7 +5799,7 @@ var handleServerSync = async ({
|
|
|
5657
5799
|
source,
|
|
5658
5800
|
onComplete
|
|
5659
5801
|
}) => {
|
|
5660
|
-
|
|
5802
|
+
logger17.debug(`Handling server sync event for server: ${world.name}`);
|
|
5661
5803
|
try {
|
|
5662
5804
|
await runtime.ensureWorldExists({
|
|
5663
5805
|
id: world.id,
|
|
@@ -5701,7 +5843,7 @@ var handleServerSync = async ({
|
|
|
5701
5843
|
worldId: world.id
|
|
5702
5844
|
});
|
|
5703
5845
|
} catch (err) {
|
|
5704
|
-
|
|
5846
|
+
logger17.warn(`Failed to sync user ${entity.metadata.username}: ${err}`);
|
|
5705
5847
|
}
|
|
5706
5848
|
})
|
|
5707
5849
|
);
|
|
@@ -5710,14 +5852,51 @@ var handleServerSync = async ({
|
|
|
5710
5852
|
}
|
|
5711
5853
|
}
|
|
5712
5854
|
}
|
|
5713
|
-
|
|
5855
|
+
logger17.debug(`Successfully synced standardized world structure for ${world.name}`);
|
|
5714
5856
|
onComplete?.();
|
|
5715
5857
|
} catch (error) {
|
|
5716
|
-
|
|
5858
|
+
logger17.error(
|
|
5717
5859
|
`Error processing standardized server data: ${error instanceof Error ? error.message : String(error)}`
|
|
5718
5860
|
);
|
|
5719
5861
|
}
|
|
5720
5862
|
};
|
|
5863
|
+
var controlMessageHandler = async ({
|
|
5864
|
+
runtime,
|
|
5865
|
+
message,
|
|
5866
|
+
source
|
|
5867
|
+
}) => {
|
|
5868
|
+
try {
|
|
5869
|
+
logger17.debug(
|
|
5870
|
+
`[controlMessageHandler] Processing control message: ${message.payload.action} for room ${message.roomId}`
|
|
5871
|
+
);
|
|
5872
|
+
const serviceNames = Array.from(runtime.getAllServices().keys());
|
|
5873
|
+
const websocketServiceName = serviceNames.find(
|
|
5874
|
+
(name) => name.toLowerCase().includes("websocket") || name.toLowerCase().includes("socket")
|
|
5875
|
+
);
|
|
5876
|
+
if (websocketServiceName) {
|
|
5877
|
+
const websocketService = runtime.getService(websocketServiceName);
|
|
5878
|
+
if (websocketService && "sendMessage" in websocketService) {
|
|
5879
|
+
await websocketService.sendMessage({
|
|
5880
|
+
type: "controlMessage",
|
|
5881
|
+
payload: {
|
|
5882
|
+
action: message.payload.action,
|
|
5883
|
+
target: message.payload.target,
|
|
5884
|
+
roomId: message.roomId
|
|
5885
|
+
}
|
|
5886
|
+
});
|
|
5887
|
+
logger17.debug(
|
|
5888
|
+
`[controlMessageHandler] Control message ${message.payload.action} sent successfully`
|
|
5889
|
+
);
|
|
5890
|
+
} else {
|
|
5891
|
+
logger17.error("[controlMessageHandler] WebSocket service does not have sendMessage method");
|
|
5892
|
+
}
|
|
5893
|
+
} else {
|
|
5894
|
+
logger17.error("[controlMessageHandler] No WebSocket service found to send control message");
|
|
5895
|
+
}
|
|
5896
|
+
} catch (error) {
|
|
5897
|
+
logger17.error(`[controlMessageHandler] Error processing control message: ${error}`);
|
|
5898
|
+
}
|
|
5899
|
+
};
|
|
5721
5900
|
var events = {
|
|
5722
5901
|
[EventType2.MESSAGE_RECEIVED]: [
|
|
5723
5902
|
async (payload) => {
|
|
@@ -5753,7 +5932,7 @@ var events = {
|
|
|
5753
5932
|
],
|
|
5754
5933
|
[EventType2.MESSAGE_SENT]: [
|
|
5755
5934
|
async (payload) => {
|
|
5756
|
-
|
|
5935
|
+
logger17.debug(`Message sent: ${payload.message.content.text}`);
|
|
5757
5936
|
}
|
|
5758
5937
|
],
|
|
5759
5938
|
[EventType2.WORLD_JOINED]: [
|
|
@@ -5790,34 +5969,35 @@ var events = {
|
|
|
5790
5969
|
};
|
|
5791
5970
|
await payload.runtime.updateEntity(entity);
|
|
5792
5971
|
}
|
|
5793
|
-
|
|
5972
|
+
logger17.info(`User ${payload.entityId} left world ${payload.worldId}`);
|
|
5794
5973
|
} catch (error) {
|
|
5795
|
-
|
|
5974
|
+
logger17.error(`Error handling user left: ${error.message}`);
|
|
5796
5975
|
}
|
|
5797
5976
|
}
|
|
5798
5977
|
],
|
|
5799
5978
|
[EventType2.ACTION_STARTED]: [
|
|
5800
5979
|
async (payload) => {
|
|
5801
|
-
|
|
5980
|
+
logger17.debug(`Action started: ${payload.actionName} (${payload.actionId})`);
|
|
5802
5981
|
}
|
|
5803
5982
|
],
|
|
5804
5983
|
[EventType2.ACTION_COMPLETED]: [
|
|
5805
5984
|
async (payload) => {
|
|
5806
5985
|
const status = payload.error ? `failed: ${payload.error.message}` : "completed";
|
|
5807
|
-
|
|
5986
|
+
logger17.debug(`Action ${status}: ${payload.actionName} (${payload.actionId})`);
|
|
5808
5987
|
}
|
|
5809
5988
|
],
|
|
5810
5989
|
[EventType2.EVALUATOR_STARTED]: [
|
|
5811
5990
|
async (payload) => {
|
|
5812
|
-
|
|
5991
|
+
logger17.debug(`Evaluator started: ${payload.evaluatorName} (${payload.evaluatorId})`);
|
|
5813
5992
|
}
|
|
5814
5993
|
],
|
|
5815
5994
|
[EventType2.EVALUATOR_COMPLETED]: [
|
|
5816
5995
|
async (payload) => {
|
|
5817
5996
|
const status = payload.error ? `failed: ${payload.error.message}` : "completed";
|
|
5818
|
-
|
|
5997
|
+
logger17.debug(`Evaluator ${status}: ${payload.evaluatorName} (${payload.evaluatorId})`);
|
|
5819
5998
|
}
|
|
5820
|
-
]
|
|
5999
|
+
],
|
|
6000
|
+
CONTROL_MESSAGE: [controlMessageHandler]
|
|
5821
6001
|
};
|
|
5822
6002
|
var bootstrapPlugin = {
|
|
5823
6003
|
name: "bootstrap",
|
|
@@ -5833,8 +6013,8 @@ var bootstrapPlugin = {
|
|
|
5833
6013
|
sendMessageAction,
|
|
5834
6014
|
updateEntityAction,
|
|
5835
6015
|
choiceAction,
|
|
5836
|
-
|
|
5837
|
-
|
|
6016
|
+
updateRoleAction,
|
|
6017
|
+
updateSettingsAction
|
|
5838
6018
|
],
|
|
5839
6019
|
events,
|
|
5840
6020
|
evaluators: [reflectionEvaluator],
|
|
@@ -5854,14 +6034,45 @@ var bootstrapPlugin = {
|
|
|
5854
6034
|
providersProvider,
|
|
5855
6035
|
actionsProvider,
|
|
5856
6036
|
characterProvider,
|
|
5857
|
-
recentMessagesProvider
|
|
6037
|
+
recentMessagesProvider,
|
|
6038
|
+
worldProvider
|
|
5858
6039
|
],
|
|
5859
6040
|
services: [TaskService, ScenarioService]
|
|
5860
6041
|
};
|
|
5861
6042
|
var index_default = bootstrapPlugin;
|
|
5862
6043
|
export {
|
|
6044
|
+
actionsProvider,
|
|
6045
|
+
anxietyProvider,
|
|
6046
|
+
attachmentsProvider,
|
|
5863
6047
|
bootstrapPlugin,
|
|
6048
|
+
capabilitiesProvider,
|
|
6049
|
+
characterProvider,
|
|
6050
|
+
choiceAction,
|
|
6051
|
+
choiceProvider,
|
|
5864
6052
|
index_default as default,
|
|
5865
|
-
|
|
6053
|
+
entitiesProvider,
|
|
6054
|
+
evaluatorsProvider,
|
|
6055
|
+
factsProvider,
|
|
6056
|
+
fetchMediaData,
|
|
6057
|
+
followRoomAction,
|
|
6058
|
+
ignoreAction,
|
|
6059
|
+
knowledgeProvider,
|
|
6060
|
+
muteRoomAction,
|
|
6061
|
+
noneAction,
|
|
6062
|
+
providersProvider,
|
|
6063
|
+
recentMessagesProvider,
|
|
6064
|
+
reflectionEvaluator,
|
|
6065
|
+
relationshipsProvider,
|
|
6066
|
+
replyAction,
|
|
6067
|
+
roleProvider,
|
|
6068
|
+
sendMessageAction,
|
|
6069
|
+
settingsProvider,
|
|
6070
|
+
timeProvider,
|
|
6071
|
+
unfollowRoomAction,
|
|
6072
|
+
unmuteRoomAction,
|
|
6073
|
+
updateEntityAction,
|
|
6074
|
+
updateRoleAction,
|
|
6075
|
+
updateSettingsAction,
|
|
6076
|
+
worldProvider
|
|
5866
6077
|
};
|
|
5867
6078
|
//# sourceMappingURL=index.js.map
|