@elizaos/plugin-bootstrap 1.6.5-alpha.2 → 1.6.5-alpha.21
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 +226 -228
- package/dist/index.js.map +24 -24
- package/package.json +7 -5
package/dist/index.js
CHANGED
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
createUniqueUuid as createUniqueUuid3,
|
|
87
87
|
EventType as EventType2,
|
|
88
88
|
imageDescriptionTemplate,
|
|
89
|
-
logger as
|
|
89
|
+
logger as logger16,
|
|
90
90
|
messageHandlerTemplate,
|
|
91
91
|
ModelType as ModelType15,
|
|
92
92
|
parseKeyValueXml as parseKeyValueXml9,
|
|
@@ -195,9 +195,10 @@ var generateImageAction = {
|
|
|
195
195
|
});
|
|
196
196
|
if (!imageResponse || imageResponse.length === 0 || !imageResponse[0]?.url) {
|
|
197
197
|
logger.error({
|
|
198
|
-
|
|
198
|
+
src: "plugin:bootstrap:action:image_generation",
|
|
199
|
+
agentId: runtime.agentId,
|
|
199
200
|
imagePrompt
|
|
200
|
-
}, "
|
|
201
|
+
}, "Image generation failed - no valid response received");
|
|
201
202
|
return {
|
|
202
203
|
text: "Image generation failed",
|
|
203
204
|
values: {
|
|
@@ -214,7 +215,7 @@ var generateImageAction = {
|
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
217
|
const imageUrl = imageResponse[0].url;
|
|
217
|
-
logger.info(
|
|
218
|
+
logger.info({ src: "plugin:bootstrap:action:image_generation", agentId: runtime.agentId, imageUrl }, "Received image URL");
|
|
218
219
|
const getFileExtension = (url) => {
|
|
219
220
|
try {
|
|
220
221
|
const urlPath = new URL(url).pathname;
|
|
@@ -261,9 +262,10 @@ var generateImageAction = {
|
|
|
261
262
|
} catch (error) {
|
|
262
263
|
const err = error;
|
|
263
264
|
logger.error({
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
src: "plugin:bootstrap:action:image_generation",
|
|
266
|
+
agentId: runtime.agentId,
|
|
267
|
+
error: err.message
|
|
268
|
+
}, "Exception during image generation");
|
|
267
269
|
return {
|
|
268
270
|
text: "Image generation failed",
|
|
269
271
|
values: {
|
|
@@ -387,14 +389,14 @@ var choiceAction = {
|
|
|
387
389
|
description: "Selects an option for a pending task that has multiple options",
|
|
388
390
|
validate: async (runtime, message, state) => {
|
|
389
391
|
if (!state) {
|
|
390
|
-
logger2.error("State is required for validating the action");
|
|
392
|
+
logger2.error({ src: "plugin:bootstrap:action:choice", agentId: runtime.agentId }, "State is required for validating the action");
|
|
391
393
|
throw new Error("State is required for validating the action");
|
|
392
394
|
}
|
|
393
395
|
const room = state.data.room ?? await runtime.getRoom(message.roomId);
|
|
394
|
-
if (!room || !room.
|
|
396
|
+
if (!room || !room.messageServerId) {
|
|
395
397
|
return false;
|
|
396
398
|
}
|
|
397
|
-
const userRole = await getUserServerRole(runtime, message.entityId, room.
|
|
399
|
+
const userRole = await getUserServerRole(runtime, message.entityId, room.messageServerId);
|
|
398
400
|
if (userRole !== "OWNER" && userRole !== "ADMIN") {
|
|
399
401
|
return false;
|
|
400
402
|
}
|
|
@@ -404,13 +406,13 @@ var choiceAction = {
|
|
|
404
406
|
tags: ["AWAITING_CHOICE"]
|
|
405
407
|
});
|
|
406
408
|
const room2 = state.data.room ?? await runtime.getRoom(message.roomId);
|
|
407
|
-
const userRole2 = await getUserServerRole(runtime, message.entityId, room2.
|
|
409
|
+
const userRole2 = await getUserServerRole(runtime, message.entityId, room2.messageServerId);
|
|
408
410
|
if (userRole2 !== "OWNER" && userRole2 !== "ADMIN") {
|
|
409
411
|
return false;
|
|
410
412
|
}
|
|
411
413
|
return pendingTasks && pendingTasks.length > 0 && pendingTasks.some((task) => task.metadata?.options);
|
|
412
414
|
} catch (error) {
|
|
413
|
-
logger2.error({ error }, "Error validating choice action");
|
|
415
|
+
logger2.error({ src: "plugin:bootstrap:action:choice", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error validating choice action");
|
|
414
416
|
return false;
|
|
415
417
|
}
|
|
416
418
|
},
|
|
@@ -593,7 +595,7 @@ ${task.options?.map((opt) => `- ${opt.name}: ${opt.description}`).join(`
|
|
|
593
595
|
success: true
|
|
594
596
|
};
|
|
595
597
|
} catch (error) {
|
|
596
|
-
logger2.error({ error }, "Error executing task with option");
|
|
598
|
+
logger2.error({ src: "plugin:bootstrap:action:choice", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error executing task with option");
|
|
597
599
|
await callback?.({
|
|
598
600
|
text: "There was an error processing your selection.",
|
|
599
601
|
actions: ["SELECT_OPTION_ERROR"],
|
|
@@ -718,7 +720,7 @@ var followRoomAction = {
|
|
|
718
720
|
},
|
|
719
721
|
handler: async (runtime, message, state, _options, _callback, _responses) => {
|
|
720
722
|
if (!state) {
|
|
721
|
-
logger3.error("State is required for followRoomAction");
|
|
723
|
+
logger3.error({ src: "plugin:bootstrap:action:follow_room", agentId: runtime.agentId }, "State is required for followRoomAction");
|
|
722
724
|
return {
|
|
723
725
|
text: "State is required for follow room action",
|
|
724
726
|
values: {
|
|
@@ -776,7 +778,7 @@ var followRoomAction = {
|
|
|
776
778
|
}, "messages");
|
|
777
779
|
return false;
|
|
778
780
|
}
|
|
779
|
-
logger3.warn(
|
|
781
|
+
logger3.warn({ src: "plugin:bootstrap:action:follow_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
|
|
780
782
|
return false;
|
|
781
783
|
}
|
|
782
784
|
const shouldFollow = await _shouldFollow(state);
|
|
@@ -811,7 +813,7 @@ var followRoomAction = {
|
|
|
811
813
|
success: true
|
|
812
814
|
};
|
|
813
815
|
} catch (error) {
|
|
814
|
-
logger3.error({ error }, "Error following room");
|
|
816
|
+
logger3.error({ src: "plugin:bootstrap:action:follow_room", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error following room");
|
|
815
817
|
return {
|
|
816
818
|
text: "Failed to follow room",
|
|
817
819
|
values: {
|
|
@@ -1372,7 +1374,7 @@ var muteRoomAction = {
|
|
|
1372
1374
|
},
|
|
1373
1375
|
handler: async (runtime, message, state, _options, _callback, _responses) => {
|
|
1374
1376
|
if (!state) {
|
|
1375
|
-
logger4.error("State is required for muting a room");
|
|
1377
|
+
logger4.error({ src: "plugin:bootstrap:action:mute_room", agentId: runtime.agentId }, "State is required for muting a room");
|
|
1376
1378
|
return {
|
|
1377
1379
|
text: "State is required for mute room action",
|
|
1378
1380
|
values: {
|
|
@@ -1429,7 +1431,7 @@ var muteRoomAction = {
|
|
|
1429
1431
|
}
|
|
1430
1432
|
}, "messages");
|
|
1431
1433
|
}
|
|
1432
|
-
logger4.warn(
|
|
1434
|
+
logger4.warn({ src: "plugin:bootstrap:action:mute_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
|
|
1433
1435
|
return false;
|
|
1434
1436
|
}
|
|
1435
1437
|
const shouldMute = await _shouldMute(state);
|
|
@@ -1464,7 +1466,7 @@ var muteRoomAction = {
|
|
|
1464
1466
|
success: true
|
|
1465
1467
|
};
|
|
1466
1468
|
} catch (error) {
|
|
1467
|
-
logger4.error({ error }, "Error muting room");
|
|
1469
|
+
logger4.error({ src: "plugin:bootstrap:action:mute_room", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error muting room");
|
|
1468
1470
|
return {
|
|
1469
1471
|
text: "Failed to mute room",
|
|
1470
1472
|
values: {
|
|
@@ -1794,7 +1796,7 @@ var replyAction = {
|
|
|
1794
1796
|
const actionContext = _options?.actionContext;
|
|
1795
1797
|
const previousResults = actionContext?.previousResults || [];
|
|
1796
1798
|
if (previousResults.length > 0) {
|
|
1797
|
-
logger5.debug(
|
|
1799
|
+
logger5.debug({ src: "plugin:bootstrap:action:reply", agentId: runtime.agentId, count: previousResults.length }, "Found previous action results");
|
|
1798
1800
|
}
|
|
1799
1801
|
const allProviders = responses?.flatMap((res) => res.content?.providers ?? []) ?? [];
|
|
1800
1802
|
state = await runtime.composeState(message, [
|
|
@@ -1835,7 +1837,7 @@ var replyAction = {
|
|
|
1835
1837
|
success: true
|
|
1836
1838
|
};
|
|
1837
1839
|
} catch (error) {
|
|
1838
|
-
logger5.error(
|
|
1840
|
+
logger5.error({ src: "plugin:bootstrap:action:reply", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating response");
|
|
1839
1841
|
return {
|
|
1840
1842
|
text: "Error generating reply",
|
|
1841
1843
|
values: {
|
|
@@ -1948,7 +1950,7 @@ var updateRoleAction = {
|
|
|
1948
1950
|
},
|
|
1949
1951
|
handler: async (runtime, message, state, _options, callback) => {
|
|
1950
1952
|
if (!state) {
|
|
1951
|
-
logger6.error("State is required for role assignment");
|
|
1953
|
+
logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId }, "State is required for role assignment");
|
|
1952
1954
|
return {
|
|
1953
1955
|
text: "State is required for role assignment",
|
|
1954
1956
|
values: {
|
|
@@ -1971,7 +1973,7 @@ var updateRoleAction = {
|
|
|
1971
1973
|
world = await runtime.getWorld(worldId);
|
|
1972
1974
|
}
|
|
1973
1975
|
if (!world) {
|
|
1974
|
-
logger6.error("World not found");
|
|
1976
|
+
logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId }, "World not found");
|
|
1975
1977
|
await callback?.({
|
|
1976
1978
|
text: "I couldn't find the world. This action only works in a world."
|
|
1977
1979
|
});
|
|
@@ -2067,7 +2069,7 @@ IMPORTANT: Your response must ONLY contain the <response></response> XML block a
|
|
|
2067
2069
|
for (const assignment of assignments) {
|
|
2068
2070
|
let targetEntity = entities.find((e) => e.id === assignment.entityId);
|
|
2069
2071
|
if (!targetEntity) {
|
|
2070
|
-
logger6.error("Could not find an ID to assign to");
|
|
2072
|
+
logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId, entityId: assignment.entityId }, "Could not find an ID to assign to");
|
|
2071
2073
|
failedUpdates.push({
|
|
2072
2074
|
entityId: assignment.entityId,
|
|
2073
2075
|
reason: "Entity not found"
|
|
@@ -2103,9 +2105,9 @@ IMPORTANT: Your response must ONLY contain the <response></response> XML block a
|
|
|
2103
2105
|
if (worldUpdated) {
|
|
2104
2106
|
try {
|
|
2105
2107
|
await runtime.updateWorld(world);
|
|
2106
|
-
logger6.info(
|
|
2108
|
+
logger6.info({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId, serverId }, "Updated roles in world metadata");
|
|
2107
2109
|
} catch (error) {
|
|
2108
|
-
logger6.error({ error }, "Failed to save world updates");
|
|
2110
|
+
logger6.error({ src: "plugin:bootstrap:action:update_role", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to save world updates");
|
|
2109
2111
|
return {
|
|
2110
2112
|
text: "Failed to save role updates",
|
|
2111
2113
|
values: {
|
|
@@ -2259,7 +2261,7 @@ var sendMessageAction = {
|
|
|
2259
2261
|
handler: async (runtime, message, state, _options, callback, responses) => {
|
|
2260
2262
|
try {
|
|
2261
2263
|
if (!state) {
|
|
2262
|
-
logger7.error("State is required for sendMessage action");
|
|
2264
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "State is required for sendMessage action");
|
|
2263
2265
|
return {
|
|
2264
2266
|
text: "State is required for sendMessage action",
|
|
2265
2267
|
values: {
|
|
@@ -2275,7 +2277,7 @@ var sendMessageAction = {
|
|
|
2275
2277
|
};
|
|
2276
2278
|
}
|
|
2277
2279
|
if (!callback) {
|
|
2278
|
-
logger7.error("Callback is required for sendMessage action");
|
|
2280
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "Callback is required for sendMessage action");
|
|
2279
2281
|
return {
|
|
2280
2282
|
text: "Callback is required for sendMessage action",
|
|
2281
2283
|
values: {
|
|
@@ -2291,7 +2293,7 @@ var sendMessageAction = {
|
|
|
2291
2293
|
};
|
|
2292
2294
|
}
|
|
2293
2295
|
if (!responses) {
|
|
2294
|
-
logger7.error("Responses are required for sendMessage action");
|
|
2296
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId }, "Responses are required for sendMessage action");
|
|
2295
2297
|
return {
|
|
2296
2298
|
text: "Responses are required for sendMessage action",
|
|
2297
2299
|
values: {
|
|
@@ -2442,7 +2444,7 @@ var sendMessageAction = {
|
|
|
2442
2444
|
success: true
|
|
2443
2445
|
};
|
|
2444
2446
|
} catch (error) {
|
|
2445
|
-
logger7.error(
|
|
2447
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to send direct message");
|
|
2446
2448
|
await callback({
|
|
2447
2449
|
text: "I encountered an error trying to send the message. Please try again.",
|
|
2448
2450
|
actions: ["SEND_MESSAGE_ERROR"],
|
|
@@ -2548,7 +2550,7 @@ var sendMessageAction = {
|
|
|
2548
2550
|
success: true
|
|
2549
2551
|
};
|
|
2550
2552
|
} catch (error) {
|
|
2551
|
-
logger7.error(
|
|
2553
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to send room message");
|
|
2552
2554
|
await callback({
|
|
2553
2555
|
text: "I encountered an error trying to send the message to the room. Please try again.",
|
|
2554
2556
|
actions: ["SEND_MESSAGE_ERROR"],
|
|
@@ -2588,7 +2590,7 @@ var sendMessageAction = {
|
|
|
2588
2590
|
success: false
|
|
2589
2591
|
};
|
|
2590
2592
|
} catch (error) {
|
|
2591
|
-
logger7.error(
|
|
2593
|
+
logger7.error({ src: "plugin:bootstrap:action:send_message", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in sendMessage handler");
|
|
2592
2594
|
await callback?.({
|
|
2593
2595
|
text: "There was an error processing your message request.",
|
|
2594
2596
|
actions: ["SEND_MESSAGE_ERROR"],
|
|
@@ -2877,7 +2879,7 @@ async function getWorldSettings(runtime, serverId) {
|
|
|
2877
2879
|
}
|
|
2878
2880
|
return world.metadata.settings;
|
|
2879
2881
|
} catch (error) {
|
|
2880
|
-
logger8.error(
|
|
2882
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error getting settings state");
|
|
2881
2883
|
return null;
|
|
2882
2884
|
}
|
|
2883
2885
|
}
|
|
@@ -2886,7 +2888,7 @@ async function updateWorldSettings(runtime, serverId, worldSettings) {
|
|
|
2886
2888
|
const worldId = createUniqueUuid(runtime, serverId);
|
|
2887
2889
|
const world = await runtime.getWorld(worldId);
|
|
2888
2890
|
if (!world) {
|
|
2889
|
-
logger8.error(
|
|
2891
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "No world found for server");
|
|
2890
2892
|
return false;
|
|
2891
2893
|
}
|
|
2892
2894
|
if (!world.metadata) {
|
|
@@ -2896,7 +2898,7 @@ async function updateWorldSettings(runtime, serverId, worldSettings) {
|
|
|
2896
2898
|
await runtime.updateWorld(world);
|
|
2897
2899
|
return true;
|
|
2898
2900
|
} catch (error) {
|
|
2899
|
-
logger8.error(
|
|
2901
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error updating settings state");
|
|
2900
2902
|
return false;
|
|
2901
2903
|
}
|
|
2902
2904
|
}
|
|
@@ -3037,7 +3039,7 @@ async function processSettingUpdates(runtime, serverId, worldSettings, updates)
|
|
|
3037
3039
|
}
|
|
3038
3040
|
return { updatedAny, messages };
|
|
3039
3041
|
} catch (error) {
|
|
3040
|
-
logger8.error({ error }, "Error processing setting updates
|
|
3042
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing setting updates");
|
|
3041
3043
|
return {
|
|
3042
3044
|
updatedAny: false,
|
|
3043
3045
|
messages: ["Error occurred while updating settings"]
|
|
@@ -3076,7 +3078,7 @@ async function handleOnboardingComplete(runtime, worldSettings, _state, callback
|
|
|
3076
3078
|
success: true
|
|
3077
3079
|
};
|
|
3078
3080
|
} catch (error) {
|
|
3079
|
-
logger8.error(
|
|
3081
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error handling settings completion");
|
|
3080
3082
|
await callback({
|
|
3081
3083
|
text: "Great! All required settings have been configured. Your server is now fully set up and ready to use.",
|
|
3082
3084
|
actions: ["ONBOARDING_COMPLETE"],
|
|
@@ -3140,7 +3142,7 @@ async function generateSuccessResponse(runtime, worldSettings, state, messages,
|
|
|
3140
3142
|
success: true
|
|
3141
3143
|
};
|
|
3142
3144
|
} catch (error) {
|
|
3143
|
-
logger8.error(
|
|
3145
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating success response");
|
|
3144
3146
|
await callback({
|
|
3145
3147
|
text: "Settings updated successfully. Please continue with the remaining configuration.",
|
|
3146
3148
|
actions: ["SETTING_UPDATED"],
|
|
@@ -3201,7 +3203,7 @@ async function generateFailureResponse(runtime, worldSettings, state, callback)
|
|
|
3201
3203
|
success: false
|
|
3202
3204
|
};
|
|
3203
3205
|
} catch (error) {
|
|
3204
|
-
logger8.error(
|
|
3206
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating failure response");
|
|
3205
3207
|
await callback({
|
|
3206
3208
|
text: "I couldn't understand your settings update. Please try again with a clearer format.",
|
|
3207
3209
|
actions: ["SETTING_UPDATE_FAILED"],
|
|
@@ -3251,7 +3253,7 @@ async function generateErrorResponse(runtime, state, callback) {
|
|
|
3251
3253
|
success: false
|
|
3252
3254
|
};
|
|
3253
3255
|
} catch (error) {
|
|
3254
|
-
logger8.error(
|
|
3256
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating error response");
|
|
3255
3257
|
await callback({
|
|
3256
3258
|
text: "I'm sorry, but I encountered an error while processing your request. Please try again or contact support if the issue persists.",
|
|
3257
3259
|
actions: ["SETTING_UPDATE_ERROR"],
|
|
@@ -3281,10 +3283,10 @@ var updateSettingsAction = {
|
|
|
3281
3283
|
validate: async (runtime, message, _state) => {
|
|
3282
3284
|
try {
|
|
3283
3285
|
if (message.content.channelType !== ChannelType2.DM) {
|
|
3284
|
-
logger8.debug(
|
|
3286
|
+
logger8.debug({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, channelType: message.content.channelType }, "Skipping settings in non-DM channel");
|
|
3285
3287
|
return false;
|
|
3286
3288
|
}
|
|
3287
|
-
logger8.debug(
|
|
3289
|
+
logger8.debug({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, entityId: message.entityId }, "Looking for server where user is owner");
|
|
3288
3290
|
const worlds = await findWorldsForOwner(runtime, message.entityId);
|
|
3289
3291
|
if (!worlds) {
|
|
3290
3292
|
return false;
|
|
@@ -3292,20 +3294,20 @@ var updateSettingsAction = {
|
|
|
3292
3294
|
const world = worlds.find((world2) => world2.metadata?.settings);
|
|
3293
3295
|
const worldSettings = world?.metadata?.settings;
|
|
3294
3296
|
if (!worldSettings) {
|
|
3295
|
-
logger8.error(
|
|
3297
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId: world?.messageServerId }, "No settings state found for server");
|
|
3296
3298
|
return false;
|
|
3297
3299
|
}
|
|
3298
|
-
logger8.debug(
|
|
3300
|
+
logger8.debug({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId: world.messageServerId }, "Found valid settings state for server");
|
|
3299
3301
|
return true;
|
|
3300
3302
|
} catch (error) {
|
|
3301
|
-
logger8.error(
|
|
3303
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error validating settings action");
|
|
3302
3304
|
return false;
|
|
3303
3305
|
}
|
|
3304
3306
|
},
|
|
3305
3307
|
handler: async (runtime, message, state, _options, callback) => {
|
|
3306
3308
|
try {
|
|
3307
3309
|
if (!state) {
|
|
3308
|
-
logger8.error("State is required for settings handler");
|
|
3310
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "State is required for settings handler");
|
|
3309
3311
|
if (callback) {
|
|
3310
3312
|
await generateErrorResponse(runtime, state, callback);
|
|
3311
3313
|
}
|
|
@@ -3324,7 +3326,7 @@ var updateSettingsAction = {
|
|
|
3324
3326
|
};
|
|
3325
3327
|
}
|
|
3326
3328
|
if (!message) {
|
|
3327
|
-
logger8.error("Message is required for settings handler");
|
|
3329
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Message is required for settings handler");
|
|
3328
3330
|
await generateErrorResponse(runtime, state, callback);
|
|
3329
3331
|
return {
|
|
3330
3332
|
text: "Message is required for settings handler",
|
|
@@ -3341,7 +3343,7 @@ var updateSettingsAction = {
|
|
|
3341
3343
|
};
|
|
3342
3344
|
}
|
|
3343
3345
|
if (!callback) {
|
|
3344
|
-
logger8.error("Callback is required for settings handler");
|
|
3346
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Callback is required for settings handler");
|
|
3345
3347
|
return {
|
|
3346
3348
|
text: "Callback is required for settings handler",
|
|
3347
3349
|
values: {
|
|
@@ -3356,11 +3358,11 @@ var updateSettingsAction = {
|
|
|
3356
3358
|
error: new Error("Callback is required for settings handler")
|
|
3357
3359
|
};
|
|
3358
3360
|
}
|
|
3359
|
-
logger8.info(
|
|
3361
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, entityId: message.entityId }, "Handler looking for server for user");
|
|
3360
3362
|
const worlds = await findWorldsForOwner(runtime, message.entityId);
|
|
3361
3363
|
const serverOwnership = worlds?.find((world) => world.metadata?.settings);
|
|
3362
3364
|
if (!serverOwnership) {
|
|
3363
|
-
logger8.error(
|
|
3365
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, entityId: message.entityId }, "No server found for user in handler");
|
|
3364
3366
|
await generateErrorResponse(runtime, state, callback);
|
|
3365
3367
|
return {
|
|
3366
3368
|
text: "No server found for user",
|
|
@@ -3376,10 +3378,10 @@ var updateSettingsAction = {
|
|
|
3376
3378
|
success: false
|
|
3377
3379
|
};
|
|
3378
3380
|
}
|
|
3379
|
-
const serverId = serverOwnership?.
|
|
3380
|
-
logger8.info(
|
|
3381
|
+
const serverId = serverOwnership?.messageServerId;
|
|
3382
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "Using server ID");
|
|
3381
3383
|
if (!serverId) {
|
|
3382
|
-
logger8.error(
|
|
3384
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, entityId: message.entityId }, "No server ID found for user in handler");
|
|
3383
3385
|
await generateErrorResponse(runtime, state, callback);
|
|
3384
3386
|
return {
|
|
3385
3387
|
text: "No server ID found",
|
|
@@ -3397,7 +3399,7 @@ var updateSettingsAction = {
|
|
|
3397
3399
|
}
|
|
3398
3400
|
const worldSettings = await getWorldSettings(runtime, serverId);
|
|
3399
3401
|
if (!worldSettings) {
|
|
3400
|
-
logger8.error(
|
|
3402
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, serverId }, "No settings state found for server in handler");
|
|
3401
3403
|
await generateErrorResponse(runtime, state, callback);
|
|
3402
3404
|
return {
|
|
3403
3405
|
text: "No settings state found",
|
|
@@ -3413,15 +3415,15 @@ var updateSettingsAction = {
|
|
|
3413
3415
|
success: false
|
|
3414
3416
|
};
|
|
3415
3417
|
}
|
|
3416
|
-
logger8.info(
|
|
3418
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, text: message.content.text }, "Extracting settings from message");
|
|
3417
3419
|
const extractedSettings = await extractSettingValues(runtime, message, state, worldSettings);
|
|
3418
|
-
logger8.info(
|
|
3420
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, count: extractedSettings.length }, "Extracted settings");
|
|
3419
3421
|
const updateResults = await processSettingUpdates(runtime, serverId, worldSettings, extractedSettings);
|
|
3420
3422
|
if (updateResults.updatedAny) {
|
|
3421
|
-
logger8.info(
|
|
3423
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, messages: updateResults.messages }, "Successfully updated settings");
|
|
3422
3424
|
const updatedWorldSettings = await getWorldSettings(runtime, serverId);
|
|
3423
3425
|
if (!updatedWorldSettings) {
|
|
3424
|
-
logger8.error("Failed to retrieve updated settings state");
|
|
3426
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "Failed to retrieve updated settings state");
|
|
3425
3427
|
await generateErrorResponse(runtime, state, callback);
|
|
3426
3428
|
return {
|
|
3427
3429
|
text: "Failed to retrieve updated settings state",
|
|
@@ -3461,7 +3463,7 @@ var updateSettingsAction = {
|
|
|
3461
3463
|
success: true
|
|
3462
3464
|
};
|
|
3463
3465
|
} else {
|
|
3464
|
-
logger8.info("No settings were updated");
|
|
3466
|
+
logger8.info({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId }, "No settings were updated");
|
|
3465
3467
|
await generateFailureResponse(runtime, worldSettings, state, callback);
|
|
3466
3468
|
const { requiredUnconfigured } = categorizeSettings(worldSettings);
|
|
3467
3469
|
return {
|
|
@@ -3482,7 +3484,7 @@ var updateSettingsAction = {
|
|
|
3482
3484
|
};
|
|
3483
3485
|
}
|
|
3484
3486
|
} catch (error) {
|
|
3485
|
-
logger8.error(
|
|
3487
|
+
logger8.error({ src: "plugin:bootstrap:action:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in settings handler");
|
|
3486
3488
|
if (state && callback) {
|
|
3487
3489
|
await generateErrorResponse(runtime, state, callback);
|
|
3488
3490
|
}
|
|
@@ -4125,7 +4127,7 @@ var unmuteRoomAction = {
|
|
|
4125
4127
|
}, "messages");
|
|
4126
4128
|
return false;
|
|
4127
4129
|
}
|
|
4128
|
-
logger9.warn(
|
|
4130
|
+
logger9.warn({ src: "plugin:bootstrap:action:unmute_room", agentId: runtime.agentId, response }, "Unclear boolean response, defaulting to false");
|
|
4129
4131
|
return false;
|
|
4130
4132
|
}
|
|
4131
4133
|
if (!state) {
|
|
@@ -4149,7 +4151,7 @@ var unmuteRoomAction = {
|
|
|
4149
4151
|
await runtime.setParticipantUserState(message.roomId, runtime.agentId, null);
|
|
4150
4152
|
const room = await runtime.getRoom(message.roomId);
|
|
4151
4153
|
if (!room) {
|
|
4152
|
-
logger9.warn(
|
|
4154
|
+
logger9.warn({ src: "plugin:bootstrap:action:unmute_room", agentId: runtime.agentId, roomId: message.roomId }, "Room not found");
|
|
4153
4155
|
return {
|
|
4154
4156
|
text: `Room not found: ${message.roomId}`,
|
|
4155
4157
|
values: {
|
|
@@ -4192,7 +4194,7 @@ var unmuteRoomAction = {
|
|
|
4192
4194
|
success: true
|
|
4193
4195
|
};
|
|
4194
4196
|
} catch (error) {
|
|
4195
|
-
logger9.error({ error }, "Error unmuting room
|
|
4197
|
+
logger9.error({ src: "plugin:bootstrap:action:unmute_room", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error unmuting room");
|
|
4196
4198
|
return {
|
|
4197
4199
|
text: "Failed to unmute room",
|
|
4198
4200
|
values: {
|
|
@@ -4386,7 +4388,7 @@ var updateEntityAction = {
|
|
|
4386
4388
|
handler: async (runtime, message, state, _options, callback, responses) => {
|
|
4387
4389
|
try {
|
|
4388
4390
|
if (!state) {
|
|
4389
|
-
logger10.error("State is required for the updateEntity action");
|
|
4391
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "State is required for the updateEntity action");
|
|
4390
4392
|
return {
|
|
4391
4393
|
text: "State is required for updateEntity action",
|
|
4392
4394
|
values: {
|
|
@@ -4402,7 +4404,7 @@ var updateEntityAction = {
|
|
|
4402
4404
|
};
|
|
4403
4405
|
}
|
|
4404
4406
|
if (!callback) {
|
|
4405
|
-
logger10.error("Callback is required for the updateEntity action");
|
|
4407
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Callback is required for the updateEntity action");
|
|
4406
4408
|
return {
|
|
4407
4409
|
text: "Callback is required for updateEntity action",
|
|
4408
4410
|
values: {
|
|
@@ -4418,7 +4420,7 @@ var updateEntityAction = {
|
|
|
4418
4420
|
};
|
|
4419
4421
|
}
|
|
4420
4422
|
if (!responses) {
|
|
4421
|
-
logger10.error("Responses are required for the updateEntity action");
|
|
4423
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Responses are required for the updateEntity action");
|
|
4422
4424
|
return {
|
|
4423
4425
|
text: "Responses are required for updateEntity action",
|
|
4424
4426
|
values: {
|
|
@@ -4434,7 +4436,7 @@ var updateEntityAction = {
|
|
|
4434
4436
|
};
|
|
4435
4437
|
}
|
|
4436
4438
|
if (!message) {
|
|
4437
|
-
logger10.error("Message is required for the updateEntity action");
|
|
4439
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId }, "Message is required for the updateEntity action");
|
|
4438
4440
|
return {
|
|
4439
4441
|
text: "Message is required for updateEntity action",
|
|
4440
4442
|
values: {
|
|
@@ -4492,7 +4494,7 @@ var updateEntityAction = {
|
|
|
4492
4494
|
throw new Error("Invalid response format - missing source or data");
|
|
4493
4495
|
}
|
|
4494
4496
|
} catch (error) {
|
|
4495
|
-
logger10.error(
|
|
4497
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to parse component data");
|
|
4496
4498
|
await callback({
|
|
4497
4499
|
text: "I couldn't properly understand the component information. Please try again with more specific information.",
|
|
4498
4500
|
actions: ["UPDATE_ENTITY_ERROR"],
|
|
@@ -4592,7 +4594,7 @@ var updateEntityAction = {
|
|
|
4592
4594
|
};
|
|
4593
4595
|
}
|
|
4594
4596
|
} catch (error) {
|
|
4595
|
-
logger10.error(
|
|
4597
|
+
logger10.error({ src: "plugin:bootstrap:action:update_entity", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in updateEntity handler");
|
|
4596
4598
|
await callback?.({
|
|
4597
4599
|
text: "There was an error processing the entity information.",
|
|
4598
4600
|
actions: ["UPDATE_ENTITY_ERROR"],
|
|
@@ -4663,7 +4665,7 @@ var updateEntityAction = {
|
|
|
4663
4665
|
};
|
|
4664
4666
|
// src/evaluators/reflection.ts
|
|
4665
4667
|
import { z } from "zod";
|
|
4666
|
-
import { asUUID, getEntityDetails,
|
|
4668
|
+
import { asUUID, getEntityDetails, parseKeyValueXml as parseKeyValueXml8 } from "@elizaos/core";
|
|
4667
4669
|
import { composePrompt as composePrompt4 } from "@elizaos/core";
|
|
4668
4670
|
import {
|
|
4669
4671
|
ModelType as ModelType12
|
|
@@ -4764,7 +4766,7 @@ function resolveEntity(entityId, entities) {
|
|
|
4764
4766
|
async function handler(runtime, message, state) {
|
|
4765
4767
|
const { agentId, roomId } = message;
|
|
4766
4768
|
if (!agentId || !roomId) {
|
|
4767
|
-
|
|
4769
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId, message }, "Missing agentId or roomId in message");
|
|
4768
4770
|
return;
|
|
4769
4771
|
}
|
|
4770
4772
|
const [existingRelationships, entities, knownFacts] = await Promise.all([
|
|
@@ -4795,20 +4797,20 @@ async function handler(runtime, message, state) {
|
|
|
4795
4797
|
prompt
|
|
4796
4798
|
});
|
|
4797
4799
|
if (!response) {
|
|
4798
|
-
|
|
4800
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - empty response");
|
|
4799
4801
|
return;
|
|
4800
4802
|
}
|
|
4801
4803
|
const reflection = parseKeyValueXml8(response);
|
|
4802
4804
|
if (!reflection) {
|
|
4803
|
-
|
|
4805
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - failed to parse XML");
|
|
4804
4806
|
return;
|
|
4805
4807
|
}
|
|
4806
4808
|
if (!reflection.facts) {
|
|
4807
|
-
|
|
4809
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - invalid facts structure");
|
|
4808
4810
|
return;
|
|
4809
4811
|
}
|
|
4810
4812
|
if (!reflection.relationships) {
|
|
4811
|
-
|
|
4813
|
+
runtime.logger.warn({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId }, "Getting reflection failed - invalid relationships structure");
|
|
4812
4814
|
return;
|
|
4813
4815
|
}
|
|
4814
4816
|
let factsArray = [];
|
|
@@ -4875,7 +4877,7 @@ async function handler(runtime, message, state) {
|
|
|
4875
4877
|
}
|
|
4876
4878
|
await runtime.setCache(`${message.roomId}-reflection-last-processed`, message?.id || "");
|
|
4877
4879
|
} catch (error) {
|
|
4878
|
-
|
|
4880
|
+
runtime.logger.error({ src: "plugin:bootstrap:evaluator:reflection", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in reflection handler");
|
|
4879
4881
|
return;
|
|
4880
4882
|
}
|
|
4881
4883
|
}
|
|
@@ -5113,7 +5115,7 @@ var actionsProvider = {
|
|
|
5113
5115
|
// src/providers/actionState.ts
|
|
5114
5116
|
import {
|
|
5115
5117
|
addHeader as addHeader2,
|
|
5116
|
-
logger as
|
|
5118
|
+
logger as logger11
|
|
5117
5119
|
} from "@elizaos/core";
|
|
5118
5120
|
var actionStateProvider = {
|
|
5119
5121
|
name: "ACTION_STATE",
|
|
@@ -5202,7 +5204,7 @@ ${values}`;
|
|
|
5202
5204
|
});
|
|
5203
5205
|
recentActionMemories = recentMessages.filter((msg) => msg.content?.type === "action_result" && msg.metadata?.type === "action_result");
|
|
5204
5206
|
} catch (error) {
|
|
5205
|
-
|
|
5207
|
+
logger11?.error({ src: "plugin:bootstrap:provider:action_state", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to retrieve action memories");
|
|
5206
5208
|
}
|
|
5207
5209
|
let actionMemoriesText = "";
|
|
5208
5210
|
if (recentActionMemories.length > 0) {
|
|
@@ -5409,7 +5411,6 @@ var attachmentsProvider = {
|
|
|
5409
5411
|
}
|
|
5410
5412
|
};
|
|
5411
5413
|
// src/providers/capabilities.ts
|
|
5412
|
-
import { logger as logger13 } from "@elizaos/core";
|
|
5413
5414
|
var capabilitiesProvider = {
|
|
5414
5415
|
name: "CAPABILITIES",
|
|
5415
5416
|
get: async (runtime, _message) => {
|
|
@@ -5445,7 +5446,7 @@ var capabilitiesProvider = {
|
|
|
5445
5446
|
${formattedCapabilities}`
|
|
5446
5447
|
};
|
|
5447
5448
|
} catch (error) {
|
|
5448
|
-
|
|
5449
|
+
runtime.logger.error({ src: "plugin:bootstrap:provider:capabilities", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in capabilities provider");
|
|
5449
5450
|
return {
|
|
5450
5451
|
text: "Error retrieving capabilities from services."
|
|
5451
5452
|
};
|
|
@@ -5552,7 +5553,6 @@ var characterProvider = {
|
|
|
5552
5553
|
}
|
|
5553
5554
|
};
|
|
5554
5555
|
// src/providers/choice.ts
|
|
5555
|
-
import { logger as logger14 } from "@elizaos/core";
|
|
5556
5556
|
var choiceProvider = {
|
|
5557
5557
|
name: "CHOICE",
|
|
5558
5558
|
get: async (runtime, message, _state) => {
|
|
@@ -5627,7 +5627,7 @@ var choiceProvider = {
|
|
|
5627
5627
|
text: output
|
|
5628
5628
|
};
|
|
5629
5629
|
} catch (error) {
|
|
5630
|
-
|
|
5630
|
+
runtime.logger.error({ src: "plugin:bootstrap:provider:choice", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in options provider");
|
|
5631
5631
|
return {
|
|
5632
5632
|
data: {
|
|
5633
5633
|
tasks: []
|
|
@@ -5746,7 +5746,6 @@ var evaluatorsProvider = {
|
|
|
5746
5746
|
};
|
|
5747
5747
|
// src/providers/facts.ts
|
|
5748
5748
|
import { ModelType as ModelType13 } from "@elizaos/core";
|
|
5749
|
-
import { logger as logger15 } from "@elizaos/core";
|
|
5750
5749
|
function formatFacts2(facts) {
|
|
5751
5750
|
return facts.reverse().map((fact) => fact.content.text).join(`
|
|
5752
5751
|
`);
|
|
@@ -5811,7 +5810,7 @@ var factsProvider = {
|
|
|
5811
5810
|
text
|
|
5812
5811
|
};
|
|
5813
5812
|
} catch (error) {
|
|
5814
|
-
|
|
5813
|
+
runtime.logger.error({ src: "plugin:bootstrap:provider:facts", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in factsProvider");
|
|
5815
5814
|
return {
|
|
5816
5815
|
values: {
|
|
5817
5816
|
facts: ""
|
|
@@ -5873,7 +5872,7 @@ import {
|
|
|
5873
5872
|
formatMessages,
|
|
5874
5873
|
formatPosts,
|
|
5875
5874
|
getEntityDetails as getEntityDetails3,
|
|
5876
|
-
logger as
|
|
5875
|
+
logger as logger12
|
|
5877
5876
|
} from "@elizaos/core";
|
|
5878
5877
|
var getRecentInteractions = async (runtime, sourceEntityId, targetEntityId, excludeRoomId) => {
|
|
5879
5878
|
const rooms = await runtime.getRoomsForParticipants([sourceEntityId, targetEntityId]);
|
|
@@ -6077,7 +6076,7 @@ ${runText}`;
|
|
|
6077
6076
|
text
|
|
6078
6077
|
};
|
|
6079
6078
|
} catch (error) {
|
|
6080
|
-
|
|
6079
|
+
logger12.error({ src: "plugin:bootstrap:provider:recent_messages", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in recentMessagesProvider");
|
|
6081
6080
|
return {
|
|
6082
6081
|
data: {
|
|
6083
6082
|
recentMessages: [],
|
|
@@ -6177,7 +6176,7 @@ ${formattedRelationships}`
|
|
|
6177
6176
|
import {
|
|
6178
6177
|
ChannelType as ChannelType6,
|
|
6179
6178
|
createUniqueUuid as createUniqueUuid2,
|
|
6180
|
-
logger as
|
|
6179
|
+
logger as logger13
|
|
6181
6180
|
} from "@elizaos/core";
|
|
6182
6181
|
var roleProvider = {
|
|
6183
6182
|
name: "ROLES",
|
|
@@ -6198,15 +6197,15 @@ var roleProvider = {
|
|
|
6198
6197
|
text: "No access to role information in DMs, the role provider is only available in group scenarios."
|
|
6199
6198
|
};
|
|
6200
6199
|
}
|
|
6201
|
-
const serverId = room.
|
|
6200
|
+
const serverId = room.messageServerId;
|
|
6202
6201
|
if (!serverId) {
|
|
6203
6202
|
throw new Error("No server ID found");
|
|
6204
6203
|
}
|
|
6205
|
-
|
|
6204
|
+
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "Using server ID");
|
|
6206
6205
|
const worldId = createUniqueUuid2(runtime, serverId);
|
|
6207
6206
|
const world = await runtime.getWorld(worldId);
|
|
6208
6207
|
if (!world || !world.metadata?.ownership?.ownerId) {
|
|
6209
|
-
|
|
6208
|
+
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No ownership data found for server, initializing empty role hierarchy");
|
|
6210
6209
|
return {
|
|
6211
6210
|
data: {
|
|
6212
6211
|
roles: []
|
|
@@ -6219,7 +6218,7 @@ var roleProvider = {
|
|
|
6219
6218
|
}
|
|
6220
6219
|
const roles = world.metadata.roles || {};
|
|
6221
6220
|
if (Object.keys(roles).length === 0) {
|
|
6222
|
-
|
|
6221
|
+
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, serverId }, "No roles found for server");
|
|
6223
6222
|
return {
|
|
6224
6223
|
data: {
|
|
6225
6224
|
roles: []
|
|
@@ -6230,7 +6229,7 @@ var roleProvider = {
|
|
|
6230
6229
|
text: "No role information available for this server."
|
|
6231
6230
|
};
|
|
6232
6231
|
}
|
|
6233
|
-
|
|
6232
|
+
logger13.info({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, roleCount: Object.keys(roles).length }, "Found roles");
|
|
6234
6233
|
const owners = [];
|
|
6235
6234
|
const admins = [];
|
|
6236
6235
|
const members = [];
|
|
@@ -6244,7 +6243,7 @@ var roleProvider = {
|
|
|
6244
6243
|
continue;
|
|
6245
6244
|
}
|
|
6246
6245
|
if (!name || !username || !names2) {
|
|
6247
|
-
|
|
6246
|
+
logger13.warn({ src: "plugin:bootstrap:provider:roles", agentId: runtime.agentId, entityId }, "User has no name or username, skipping");
|
|
6248
6247
|
continue;
|
|
6249
6248
|
}
|
|
6250
6249
|
switch (userRole) {
|
|
@@ -6317,7 +6316,7 @@ import {
|
|
|
6317
6316
|
ChannelType as ChannelType7,
|
|
6318
6317
|
findWorldsForOwner as findWorldsForOwner2,
|
|
6319
6318
|
getWorldSettings as getWorldSettings2,
|
|
6320
|
-
logger as
|
|
6319
|
+
logger as logger14
|
|
6321
6320
|
} from "@elizaos/core";
|
|
6322
6321
|
var formatSettingValue = (setting, isOnboarding) => {
|
|
6323
6322
|
if (setting.value === null)
|
|
@@ -6395,7 +6394,7 @@ ${requiredUnconfigured > 0 ? `IMPORTANT!: ${requiredUnconfigured} required setti
|
|
|
6395
6394
|
|
|
6396
6395
|
`)}`;
|
|
6397
6396
|
} catch (error) {
|
|
6398
|
-
|
|
6397
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating status message");
|
|
6399
6398
|
return "Error generating configuration status.";
|
|
6400
6399
|
}
|
|
6401
6400
|
}
|
|
@@ -6408,11 +6407,11 @@ var settingsProvider = {
|
|
|
6408
6407
|
runtime.getRoom(message.roomId),
|
|
6409
6408
|
findWorldsForOwner2(runtime, message.entityId)
|
|
6410
6409
|
]).catch((error) => {
|
|
6411
|
-
|
|
6410
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error fetching initial data");
|
|
6412
6411
|
throw new Error("Failed to retrieve room or user world information");
|
|
6413
6412
|
});
|
|
6414
6413
|
if (!room) {
|
|
6415
|
-
|
|
6414
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No room found for settings provider");
|
|
6416
6415
|
return {
|
|
6417
6416
|
data: {
|
|
6418
6417
|
settings: []
|
|
@@ -6424,7 +6423,7 @@ var settingsProvider = {
|
|
|
6424
6423
|
};
|
|
6425
6424
|
}
|
|
6426
6425
|
if (!room.worldId) {
|
|
6427
|
-
|
|
6426
|
+
logger14.debug({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for settings provider -- settings provider will be skipped");
|
|
6428
6427
|
return {
|
|
6429
6428
|
data: {
|
|
6430
6429
|
settings: []
|
|
@@ -6449,39 +6448,41 @@ var settingsProvider = {
|
|
|
6449
6448
|
}
|
|
6450
6449
|
world.metadata.settings = {};
|
|
6451
6450
|
await runtime.updateWorld(world);
|
|
6452
|
-
|
|
6451
|
+
logger14.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: world.id }, "Initialized settings for user world");
|
|
6453
6452
|
}
|
|
6454
6453
|
if (!world) {
|
|
6455
|
-
|
|
6454
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId }, "No world found for user during onboarding");
|
|
6456
6455
|
throw new Error("No server ownership found for onboarding");
|
|
6457
6456
|
}
|
|
6458
|
-
serverId = world.
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6457
|
+
serverId = world.messageServerId;
|
|
6458
|
+
if (serverId) {
|
|
6459
|
+
try {
|
|
6460
|
+
worldSettings = await getWorldSettings2(runtime, serverId);
|
|
6461
|
+
} catch (error) {
|
|
6462
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId, error: error instanceof Error ? error.message : String(error) }, "Error fetching world settings");
|
|
6463
|
+
throw new Error(`Failed to retrieve settings for server ${serverId}`);
|
|
6464
|
+
}
|
|
6464
6465
|
}
|
|
6465
6466
|
} else {
|
|
6466
6467
|
try {
|
|
6467
6468
|
world = await runtime.getWorld(room.worldId);
|
|
6468
6469
|
if (!world) {
|
|
6469
|
-
|
|
6470
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: room.worldId }, "No world found for room");
|
|
6470
6471
|
throw new Error(`No world found for room ${room.worldId}`);
|
|
6471
6472
|
}
|
|
6472
|
-
serverId = world.
|
|
6473
|
+
serverId = world.messageServerId;
|
|
6473
6474
|
if (serverId) {
|
|
6474
6475
|
worldSettings = await getWorldSettings2(runtime, serverId);
|
|
6475
6476
|
} else {
|
|
6476
|
-
|
|
6477
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, worldId: room.worldId }, "No server ID found for world");
|
|
6477
6478
|
}
|
|
6478
6479
|
} catch (error) {
|
|
6479
|
-
|
|
6480
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing world data");
|
|
6480
6481
|
throw new Error("Failed to process world information");
|
|
6481
6482
|
}
|
|
6482
6483
|
}
|
|
6483
6484
|
if (!serverId) {
|
|
6484
|
-
|
|
6485
|
+
logger14.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, entityId: message.entityId }, "No server ownership found for user after recovery attempt");
|
|
6485
6486
|
return isOnboarding ? {
|
|
6486
6487
|
data: {
|
|
6487
6488
|
settings: []
|
|
@@ -6501,7 +6502,7 @@ var settingsProvider = {
|
|
|
6501
6502
|
};
|
|
6502
6503
|
}
|
|
6503
6504
|
if (!worldSettings) {
|
|
6504
|
-
|
|
6505
|
+
logger14.info({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, serverId }, "No settings state found for server");
|
|
6505
6506
|
return isOnboarding ? {
|
|
6506
6507
|
data: {
|
|
6507
6508
|
settings: []
|
|
@@ -6531,7 +6532,7 @@ var settingsProvider = {
|
|
|
6531
6532
|
text: output
|
|
6532
6533
|
};
|
|
6533
6534
|
} catch (error) {
|
|
6534
|
-
|
|
6535
|
+
logger14.error({ src: "plugin:bootstrap:provider:settings", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Critical error in settings provider");
|
|
6535
6536
|
return {
|
|
6536
6537
|
data: {
|
|
6537
6538
|
settings: []
|
|
@@ -6568,7 +6569,7 @@ var timeProvider = {
|
|
|
6568
6569
|
};
|
|
6569
6570
|
// src/providers/world.ts
|
|
6570
6571
|
import {
|
|
6571
|
-
logger as
|
|
6572
|
+
logger as logger15,
|
|
6572
6573
|
addHeader as addHeader10,
|
|
6573
6574
|
ChannelType as ChannelType8
|
|
6574
6575
|
} from "@elizaos/core";
|
|
@@ -6578,10 +6579,10 @@ var worldProvider = {
|
|
|
6578
6579
|
dynamic: true,
|
|
6579
6580
|
get: async (runtime, message) => {
|
|
6580
6581
|
try {
|
|
6581
|
-
|
|
6582
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: message.roomId }, "World provider activated");
|
|
6582
6583
|
const currentRoom = await runtime.getRoom(message.roomId);
|
|
6583
6584
|
if (!currentRoom) {
|
|
6584
|
-
|
|
6585
|
+
logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: message.roomId }, "Room not found");
|
|
6585
6586
|
return {
|
|
6586
6587
|
data: {
|
|
6587
6588
|
world: {
|
|
@@ -6591,10 +6592,10 @@ var worldProvider = {
|
|
|
6591
6592
|
text: "Unable to retrieve world information - room not found"
|
|
6592
6593
|
};
|
|
6593
6594
|
}
|
|
6594
|
-
|
|
6595
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomName: currentRoom.name, roomType: currentRoom.type }, "Found room");
|
|
6595
6596
|
const worldId = currentRoom.worldId;
|
|
6596
6597
|
if (!worldId) {
|
|
6597
|
-
|
|
6598
|
+
logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: message.roomId }, "World ID not found");
|
|
6598
6599
|
return {
|
|
6599
6600
|
data: {
|
|
6600
6601
|
world: {
|
|
@@ -6606,7 +6607,7 @@ var worldProvider = {
|
|
|
6606
6607
|
}
|
|
6607
6608
|
const world = await runtime.getWorld(worldId);
|
|
6608
6609
|
if (!world) {
|
|
6609
|
-
|
|
6610
|
+
logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, worldId }, "World not found");
|
|
6610
6611
|
return {
|
|
6611
6612
|
data: {
|
|
6612
6613
|
world: {
|
|
@@ -6616,11 +6617,11 @@ var worldProvider = {
|
|
|
6616
6617
|
text: "Unable to retrieve world information - world not found"
|
|
6617
6618
|
};
|
|
6618
6619
|
}
|
|
6619
|
-
|
|
6620
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, worldName: world.name, worldId: world.id }, "Found world");
|
|
6620
6621
|
const worldRooms = await runtime.getRooms(worldId);
|
|
6621
|
-
|
|
6622
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomCount: worldRooms.length, worldName: world.name }, "Found rooms in world");
|
|
6622
6623
|
const participants = await runtime.getParticipantsForRoom(message.roomId);
|
|
6623
|
-
|
|
6624
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, participantCount: participants.length, roomName: currentRoom.name }, "Found participants in room");
|
|
6624
6625
|
const channelsByType = {
|
|
6625
6626
|
text: [],
|
|
6626
6627
|
voice: [],
|
|
@@ -6631,7 +6632,7 @@ var worldProvider = {
|
|
|
6631
6632
|
};
|
|
6632
6633
|
for (const room of worldRooms) {
|
|
6633
6634
|
if (!room?.id || !room.name) {
|
|
6634
|
-
|
|
6635
|
+
logger15.warn({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, roomId: room?.id }, "Room ID or name is missing");
|
|
6635
6636
|
continue;
|
|
6636
6637
|
}
|
|
6637
6638
|
const roomInfo = {
|
|
@@ -6674,7 +6675,7 @@ var worldProvider = {
|
|
|
6674
6675
|
world: {
|
|
6675
6676
|
id: world.id,
|
|
6676
6677
|
name: world.name,
|
|
6677
|
-
serverId: world.
|
|
6678
|
+
serverId: world.messageServerId,
|
|
6678
6679
|
metadata: world.metadata || {},
|
|
6679
6680
|
currentRoom: {
|
|
6680
6681
|
id: currentRoom.id,
|
|
@@ -6701,14 +6702,14 @@ var worldProvider = {
|
|
|
6701
6702
|
worldInfo: worldInfoText
|
|
6702
6703
|
};
|
|
6703
6704
|
const formattedText = addHeader10("# World Information", worldInfoText);
|
|
6704
|
-
|
|
6705
|
+
logger15.debug({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId }, "World provider completed successfully");
|
|
6705
6706
|
return {
|
|
6706
6707
|
data,
|
|
6707
6708
|
values,
|
|
6708
6709
|
text: formattedText
|
|
6709
6710
|
};
|
|
6710
6711
|
} catch (error) {
|
|
6711
|
-
|
|
6712
|
+
logger15.error({ src: "plugin:bootstrap:provider:world", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in world provider");
|
|
6712
6713
|
return {
|
|
6713
6714
|
data: {
|
|
6714
6715
|
world: {
|
|
@@ -6723,7 +6724,6 @@ var worldProvider = {
|
|
|
6723
6724
|
};
|
|
6724
6725
|
// src/services/task.ts
|
|
6725
6726
|
import {
|
|
6726
|
-
logger as logger20,
|
|
6727
6727
|
Service,
|
|
6728
6728
|
ServiceType
|
|
6729
6729
|
} from "@elizaos/core";
|
|
@@ -6742,21 +6742,21 @@ class TaskService extends Service {
|
|
|
6742
6742
|
this.runtime.registerTaskWorker({
|
|
6743
6743
|
name: "REPEATING_TEST_TASK",
|
|
6744
6744
|
validate: async (_runtime, _message, _state) => {
|
|
6745
|
-
|
|
6745
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Validating repeating test task");
|
|
6746
6746
|
return true;
|
|
6747
6747
|
},
|
|
6748
6748
|
execute: async (_runtime, _options) => {
|
|
6749
|
-
|
|
6749
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Executing repeating test task");
|
|
6750
6750
|
}
|
|
6751
6751
|
});
|
|
6752
6752
|
this.runtime.registerTaskWorker({
|
|
6753
6753
|
name: "ONETIME_TEST_TASK",
|
|
6754
6754
|
validate: async (_runtime, _message, _state) => {
|
|
6755
|
-
|
|
6755
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Validating one-time test task");
|
|
6756
6756
|
return true;
|
|
6757
6757
|
},
|
|
6758
6758
|
execute: async (_runtime, _options) => {
|
|
6759
|
-
|
|
6759
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Executing one-time test task");
|
|
6760
6760
|
}
|
|
6761
6761
|
});
|
|
6762
6762
|
const tasks = await this.runtime.getTasksByName("REPEATING_TEST_TASK");
|
|
@@ -6788,7 +6788,7 @@ class TaskService extends Service {
|
|
|
6788
6788
|
try {
|
|
6789
6789
|
await this.checkTasks();
|
|
6790
6790
|
} catch (error) {
|
|
6791
|
-
|
|
6791
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in task timer");
|
|
6792
6792
|
}
|
|
6793
6793
|
}, this.TICK_INTERVAL);
|
|
6794
6794
|
}
|
|
@@ -6809,7 +6809,7 @@ class TaskService extends Service {
|
|
|
6809
6809
|
continue;
|
|
6810
6810
|
}
|
|
6811
6811
|
} catch (error) {
|
|
6812
|
-
|
|
6812
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name, error: error instanceof Error ? error.message : String(error) }, "Error validating task");
|
|
6813
6813
|
continue;
|
|
6814
6814
|
}
|
|
6815
6815
|
}
|
|
@@ -6849,29 +6849,29 @@ class TaskService extends Service {
|
|
|
6849
6849
|
}
|
|
6850
6850
|
if (task.metadata?.updatedAt === task.metadata?.createdAt) {
|
|
6851
6851
|
if (task.tags?.includes("immediate")) {
|
|
6852
|
-
|
|
6852
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name }, "Immediately running task");
|
|
6853
6853
|
await this.executeTask(task);
|
|
6854
6854
|
continue;
|
|
6855
6855
|
}
|
|
6856
6856
|
}
|
|
6857
6857
|
if (now - taskStartTime >= updateIntervalMs) {
|
|
6858
|
-
|
|
6858
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name, intervalMs: updateIntervalMs }, "Executing task - interval elapsed");
|
|
6859
6859
|
await this.executeTask(task);
|
|
6860
6860
|
}
|
|
6861
6861
|
}
|
|
6862
6862
|
} catch (error) {
|
|
6863
|
-
|
|
6863
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error checking tasks");
|
|
6864
6864
|
}
|
|
6865
6865
|
}
|
|
6866
6866
|
async executeTask(task) {
|
|
6867
6867
|
try {
|
|
6868
6868
|
if (!task || !task.id) {
|
|
6869
|
-
|
|
6869
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId }, "Task not found");
|
|
6870
6870
|
return;
|
|
6871
6871
|
}
|
|
6872
6872
|
const worker = this.runtime.getTaskWorker(task.name);
|
|
6873
6873
|
if (!worker) {
|
|
6874
|
-
|
|
6874
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name }, "No worker found for task type");
|
|
6875
6875
|
return;
|
|
6876
6876
|
}
|
|
6877
6877
|
if (task.tags?.includes("repeat")) {
|
|
@@ -6881,16 +6881,16 @@ class TaskService extends Service {
|
|
|
6881
6881
|
updatedAt: Date.now()
|
|
6882
6882
|
}
|
|
6883
6883
|
});
|
|
6884
|
-
|
|
6884
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name, taskId: task.id }, "Updated repeating task with new timestamp");
|
|
6885
6885
|
}
|
|
6886
|
-
|
|
6886
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name, taskId: task.id }, "Executing task");
|
|
6887
6887
|
await worker.execute(this.runtime, task.metadata || {}, task);
|
|
6888
6888
|
if (!task.tags?.includes("repeat")) {
|
|
6889
6889
|
await this.runtime.deleteTask(task.id);
|
|
6890
|
-
|
|
6890
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskName: task.name, taskId: task.id }, "Deleted non-repeating task after execution");
|
|
6891
6891
|
}
|
|
6892
6892
|
} catch (error) {
|
|
6893
|
-
|
|
6893
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:task", agentId: this.runtime.agentId, taskId: task.id, error: error instanceof Error ? error.message : String(error) }, "Error executing task");
|
|
6894
6894
|
}
|
|
6895
6895
|
}
|
|
6896
6896
|
static async stop(runtime) {
|
|
@@ -6911,8 +6911,7 @@ class TaskService extends Service {
|
|
|
6911
6911
|
import {
|
|
6912
6912
|
Service as Service2,
|
|
6913
6913
|
EventType,
|
|
6914
|
-
ModelType as ModelType14
|
|
6915
|
-
logger as logger21
|
|
6914
|
+
ModelType as ModelType14
|
|
6916
6915
|
} from "@elizaos/core";
|
|
6917
6916
|
|
|
6918
6917
|
class EmbeddingGenerationService extends Service2 {
|
|
@@ -6926,10 +6925,10 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6926
6925
|
processingIntervalMs = 100;
|
|
6927
6926
|
isDisabled = false;
|
|
6928
6927
|
static async start(runtime) {
|
|
6929
|
-
|
|
6928
|
+
runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: runtime.agentId }, "Starting embedding generation service");
|
|
6930
6929
|
const embeddingModel = runtime.getModel(ModelType14.TEXT_EMBEDDING);
|
|
6931
6930
|
if (!embeddingModel) {
|
|
6932
|
-
|
|
6931
|
+
runtime.logger.warn({ src: "plugin:bootstrap:service:embedding", agentId: runtime.agentId }, "No TEXT_EMBEDDING model registered - service will not be initialized");
|
|
6933
6932
|
const noOpService = new EmbeddingGenerationService(runtime);
|
|
6934
6933
|
noOpService.isDisabled = true;
|
|
6935
6934
|
return noOpService;
|
|
@@ -6940,25 +6939,25 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6940
6939
|
}
|
|
6941
6940
|
async initialize() {
|
|
6942
6941
|
if (this.isDisabled) {
|
|
6943
|
-
|
|
6942
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, skipping initialization");
|
|
6944
6943
|
return;
|
|
6945
6944
|
}
|
|
6946
|
-
|
|
6945
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Initializing embedding generation service");
|
|
6947
6946
|
this.runtime.registerEvent(EventType.EMBEDDING_GENERATION_REQUESTED, this.handleEmbeddingRequest.bind(this));
|
|
6948
6947
|
this.startProcessing();
|
|
6949
6948
|
}
|
|
6950
6949
|
async handleEmbeddingRequest(payload) {
|
|
6951
6950
|
if (this.isDisabled) {
|
|
6952
|
-
|
|
6951
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, skipping embedding request");
|
|
6953
6952
|
return;
|
|
6954
6953
|
}
|
|
6955
6954
|
const { memory, priority = "normal", retryCount = 0, maxRetries = 3, runId } = payload;
|
|
6956
6955
|
if (memory.embedding) {
|
|
6957
|
-
|
|
6956
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, memoryId: memory.id }, "Memory already has embeddings, skipping");
|
|
6958
6957
|
return;
|
|
6959
6958
|
}
|
|
6960
6959
|
if (this.queue.length >= this.maxQueueSize) {
|
|
6961
|
-
|
|
6960
|
+
this.runtime.logger.warn({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, queueSize: this.queue.length, maxSize: this.maxQueueSize }, "Queue is full, making room");
|
|
6962
6961
|
this.makeRoomInQueue();
|
|
6963
6962
|
}
|
|
6964
6963
|
const queueItem = {
|
|
@@ -6970,7 +6969,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6970
6969
|
runId
|
|
6971
6970
|
};
|
|
6972
6971
|
this.insertItemByPriority(queueItem);
|
|
6973
|
-
|
|
6972
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, queueSize: this.queue.length }, "Added memory to queue");
|
|
6974
6973
|
}
|
|
6975
6974
|
makeRoomInQueue() {
|
|
6976
6975
|
const tenPercent = Math.floor(this.maxQueueSize * 0.1);
|
|
@@ -6987,7 +6986,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
6987
6986
|
const newQueue = this.queue.filter((_, index) => !indicesToRemove.has(index));
|
|
6988
6987
|
const removedCount = this.queue.length - newQueue.length;
|
|
6989
6988
|
this.queue = newQueue;
|
|
6990
|
-
|
|
6989
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, removedCount, newSize: this.queue.length }, "Removed items from queue");
|
|
6991
6990
|
}
|
|
6992
6991
|
insertItemByPriority(queueItem) {
|
|
6993
6992
|
if (queueItem.priority === "high") {
|
|
@@ -7021,7 +7020,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7021
7020
|
}
|
|
7022
7021
|
startProcessing() {
|
|
7023
7022
|
if (this.isDisabled) {
|
|
7024
|
-
|
|
7023
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, not starting processing loop");
|
|
7025
7024
|
return;
|
|
7026
7025
|
}
|
|
7027
7026
|
if (this.processingInterval) {
|
|
@@ -7032,7 +7031,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7032
7031
|
await this.processQueue();
|
|
7033
7032
|
}
|
|
7034
7033
|
}, this.processingIntervalMs);
|
|
7035
|
-
|
|
7034
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Started processing loop");
|
|
7036
7035
|
}
|
|
7037
7036
|
async processQueue() {
|
|
7038
7037
|
if (this.isProcessing || this.queue.length === 0) {
|
|
@@ -7041,16 +7040,16 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7041
7040
|
this.isProcessing = true;
|
|
7042
7041
|
try {
|
|
7043
7042
|
const batch = this.queue.splice(0, Math.min(this.batchSize, this.queue.length));
|
|
7044
|
-
|
|
7043
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, batchSize: batch.length, remaining: this.queue.length }, "Processing batch");
|
|
7045
7044
|
const promises = batch.map(async (item) => {
|
|
7046
7045
|
try {
|
|
7047
7046
|
await this.generateEmbedding(item);
|
|
7048
7047
|
} catch (error) {
|
|
7049
|
-
|
|
7048
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, memoryId: item.memory.id, error: error instanceof Error ? error.message : String(error) }, "Error processing item");
|
|
7050
7049
|
if (item.retryCount < item.maxRetries) {
|
|
7051
7050
|
item.retryCount++;
|
|
7052
7051
|
this.insertItemByPriority(item);
|
|
7053
|
-
|
|
7052
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, retryCount: item.retryCount, maxRetries: item.maxRetries }, "Re-queued item for retry");
|
|
7054
7053
|
} else {
|
|
7055
7054
|
await this.runtime.log({
|
|
7056
7055
|
entityId: this.runtime.agentId,
|
|
@@ -7081,7 +7080,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7081
7080
|
async generateEmbedding(item) {
|
|
7082
7081
|
const { memory } = item;
|
|
7083
7082
|
if (!memory.content?.text) {
|
|
7084
|
-
|
|
7083
|
+
this.runtime.logger.warn({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, memoryId: memory.id }, "Memory has no text content");
|
|
7085
7084
|
return;
|
|
7086
7085
|
}
|
|
7087
7086
|
try {
|
|
@@ -7090,7 +7089,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7090
7089
|
text: memory.content.text
|
|
7091
7090
|
});
|
|
7092
7091
|
const duration = Date.now() - startTime;
|
|
7093
|
-
|
|
7092
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, memoryId: memory.id, durationMs: duration }, "Generated embedding");
|
|
7094
7093
|
if (memory.id) {
|
|
7095
7094
|
await this.runtime.updateMemory({
|
|
7096
7095
|
id: memory.id,
|
|
@@ -7115,14 +7114,14 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7115
7114
|
});
|
|
7116
7115
|
}
|
|
7117
7116
|
} catch (error) {
|
|
7118
|
-
|
|
7117
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, memoryId: memory.id, error: error instanceof Error ? error.message : String(error) }, "Failed to generate embedding");
|
|
7119
7118
|
throw error;
|
|
7120
7119
|
}
|
|
7121
7120
|
}
|
|
7122
7121
|
async stop() {
|
|
7123
|
-
|
|
7122
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Stopping embedding generation service");
|
|
7124
7123
|
if (this.isDisabled) {
|
|
7125
|
-
|
|
7124
|
+
this.runtime.logger.debug({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId }, "Service is disabled, nothing to stop");
|
|
7126
7125
|
return;
|
|
7127
7126
|
}
|
|
7128
7127
|
if (this.processingInterval) {
|
|
@@ -7131,16 +7130,16 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7131
7130
|
}
|
|
7132
7131
|
const highPriorityItems = this.queue.filter((item) => item.priority === "high");
|
|
7133
7132
|
if (highPriorityItems.length > 0) {
|
|
7134
|
-
|
|
7133
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, count: highPriorityItems.length }, "Processing high priority items before shutdown");
|
|
7135
7134
|
for (const item of highPriorityItems) {
|
|
7136
7135
|
try {
|
|
7137
7136
|
await this.generateEmbedding(item);
|
|
7138
7137
|
} catch (error) {
|
|
7139
|
-
|
|
7138
|
+
this.runtime.logger.error({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error during shutdown processing");
|
|
7140
7139
|
}
|
|
7141
7140
|
}
|
|
7142
7141
|
}
|
|
7143
|
-
|
|
7142
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, remainingItems: this.queue.length }, "Stopped");
|
|
7144
7143
|
}
|
|
7145
7144
|
getQueueSize() {
|
|
7146
7145
|
return this.queue.length;
|
|
@@ -7160,7 +7159,7 @@ class EmbeddingGenerationService extends Service2 {
|
|
|
7160
7159
|
clearQueue() {
|
|
7161
7160
|
const size = this.queue.length;
|
|
7162
7161
|
this.queue = [];
|
|
7163
|
-
|
|
7162
|
+
this.runtime.logger.info({ src: "plugin:bootstrap:service:embedding", agentId: this.runtime.agentId, clearedCount: size }, "Cleared queue");
|
|
7164
7163
|
}
|
|
7165
7164
|
}
|
|
7166
7165
|
|
|
@@ -7183,7 +7182,7 @@ async function processAttachments(attachments, runtime) {
|
|
|
7183
7182
|
if (!attachments || attachments.length === 0) {
|
|
7184
7183
|
return [];
|
|
7185
7184
|
}
|
|
7186
|
-
runtime.logger.debug(
|
|
7185
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, count: attachments.length }, "Processing attachments");
|
|
7187
7186
|
const processedAttachments = [];
|
|
7188
7187
|
for (const attachment of attachments) {
|
|
7189
7188
|
try {
|
|
@@ -7191,7 +7190,7 @@ async function processAttachments(attachments, runtime) {
|
|
|
7191
7190
|
const isRemote = /^(http|https):\/\//.test(attachment.url);
|
|
7192
7191
|
const url = isRemote ? attachment.url : getLocalServerUrl(attachment.url);
|
|
7193
7192
|
if (attachment.contentType === ContentType2.IMAGE && !attachment.description) {
|
|
7194
|
-
runtime.logger.debug(
|
|
7193
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url }, "Generating description for image");
|
|
7195
7194
|
let imageUrl = url;
|
|
7196
7195
|
if (!isRemote) {
|
|
7197
7196
|
const res = await fetch(url);
|
|
@@ -7213,7 +7212,7 @@ async function processAttachments(attachments, runtime) {
|
|
|
7213
7212
|
processedAttachment.description = parsedXml.description || "";
|
|
7214
7213
|
processedAttachment.title = parsedXml.title || "Image";
|
|
7215
7214
|
processedAttachment.text = parsedXml.text || parsedXml.description || "";
|
|
7216
|
-
runtime.logger.debug(
|
|
7215
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, descriptionPreview: processedAttachment.description?.substring(0, 100) }, "Generated description");
|
|
7217
7216
|
} else {
|
|
7218
7217
|
const responseStr = response;
|
|
7219
7218
|
const titleMatch = responseStr.match(/<title>([^<]+)<\/title>/);
|
|
@@ -7223,21 +7222,21 @@ async function processAttachments(attachments, runtime) {
|
|
|
7223
7222
|
processedAttachment.title = titleMatch?.[1] || "Image";
|
|
7224
7223
|
processedAttachment.description = descMatch?.[1] || "";
|
|
7225
7224
|
processedAttachment.text = textMatch?.[1] || descMatch?.[1] || "";
|
|
7226
|
-
runtime.logger.debug(
|
|
7225
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, descriptionPreview: processedAttachment.description?.substring(0, 100) }, "Used fallback XML parsing");
|
|
7227
7226
|
} else {
|
|
7228
|
-
runtime.logger.warn(
|
|
7227
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Failed to parse XML response for image description");
|
|
7229
7228
|
}
|
|
7230
7229
|
}
|
|
7231
7230
|
} else if (response && typeof response === "object" && "description" in response) {
|
|
7232
7231
|
processedAttachment.description = response.description;
|
|
7233
7232
|
processedAttachment.title = response.title || "Image";
|
|
7234
7233
|
processedAttachment.text = response.description;
|
|
7235
|
-
runtime.logger.debug(
|
|
7234
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, descriptionPreview: processedAttachment.description?.substring(0, 100) }, "Generated description");
|
|
7236
7235
|
} else {
|
|
7237
|
-
runtime.logger.warn(
|
|
7236
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Unexpected response format for image description");
|
|
7238
7237
|
}
|
|
7239
7238
|
} catch (error) {
|
|
7240
|
-
runtime.logger.error({ error },
|
|
7239
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error generating image description");
|
|
7241
7240
|
}
|
|
7242
7241
|
} else if (attachment.contentType === ContentType2.DOCUMENT && !attachment.text) {
|
|
7243
7242
|
const res = await fetch(url);
|
|
@@ -7246,18 +7245,18 @@ async function processAttachments(attachments, runtime) {
|
|
|
7246
7245
|
const contentType = res.headers.get("content-type") || "";
|
|
7247
7246
|
const isPlainText = contentType.startsWith("text/plain");
|
|
7248
7247
|
if (isPlainText) {
|
|
7249
|
-
runtime.logger.debug(
|
|
7248
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, url: attachment.url }, "Processing plain text document");
|
|
7250
7249
|
const textContent = await res.text();
|
|
7251
7250
|
processedAttachment.text = textContent;
|
|
7252
7251
|
processedAttachment.title = processedAttachment.title || "Text File";
|
|
7253
|
-
runtime.logger.debug(
|
|
7252
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, textPreview: processedAttachment.text?.substring(0, 100) }, "Extracted text content");
|
|
7254
7253
|
} else {
|
|
7255
|
-
runtime.logger.warn(
|
|
7254
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, contentType }, "Skipping non-plain-text document");
|
|
7256
7255
|
}
|
|
7257
7256
|
}
|
|
7258
7257
|
processedAttachments.push(processedAttachment);
|
|
7259
7258
|
} catch (error) {
|
|
7260
|
-
runtime.logger.error({
|
|
7259
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, attachmentUrl: attachment.url, error: error instanceof Error ? error.message : String(error) }, "Failed to process attachment");
|
|
7261
7260
|
processedAttachments.push(attachment);
|
|
7262
7261
|
}
|
|
7263
7262
|
}
|
|
@@ -7311,10 +7310,10 @@ var reactionReceivedHandler = async ({
|
|
|
7311
7310
|
await runtime.createMemory(message, "messages");
|
|
7312
7311
|
} catch (error) {
|
|
7313
7312
|
if (error.code === "23505") {
|
|
7314
|
-
runtime.logger.warn("
|
|
7313
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Duplicate reaction memory, skipping");
|
|
7315
7314
|
return;
|
|
7316
7315
|
}
|
|
7317
|
-
runtime.logger.error({ error }, "
|
|
7316
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error in reaction handler");
|
|
7318
7317
|
}
|
|
7319
7318
|
};
|
|
7320
7319
|
var postGeneratedHandler = async ({
|
|
@@ -7325,12 +7324,12 @@ var postGeneratedHandler = async ({
|
|
|
7325
7324
|
roomId,
|
|
7326
7325
|
source
|
|
7327
7326
|
}) => {
|
|
7328
|
-
runtime.logger.info("
|
|
7327
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId }, "Generating new post");
|
|
7329
7328
|
await runtime.ensureWorldExists({
|
|
7330
7329
|
id: worldId,
|
|
7331
7330
|
name: `${runtime.character.name}'s Feed`,
|
|
7332
7331
|
agentId: runtime.agentId,
|
|
7333
|
-
|
|
7332
|
+
messageServerId: userId
|
|
7334
7333
|
});
|
|
7335
7334
|
await runtime.ensureRoomExists({
|
|
7336
7335
|
id: roomId,
|
|
@@ -7338,7 +7337,7 @@ var postGeneratedHandler = async ({
|
|
|
7338
7337
|
source,
|
|
7339
7338
|
type: ChannelType9.FEED,
|
|
7340
7339
|
channelId: `${userId}-home`,
|
|
7341
|
-
|
|
7340
|
+
messageServerId: userId,
|
|
7342
7341
|
worldId
|
|
7343
7342
|
});
|
|
7344
7343
|
const message = {
|
|
@@ -7387,8 +7386,7 @@ var postGeneratedHandler = async ({
|
|
|
7387
7386
|
}
|
|
7388
7387
|
retries++;
|
|
7389
7388
|
if (!responseContent?.thought || !responseContent?.actions) {
|
|
7390
|
-
runtime.logger.warn(
|
|
7391
|
-
`, response, parsedXml, responseContent);
|
|
7389
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, response, parsedXml, responseContent }, "Missing required fields, retrying");
|
|
7392
7390
|
}
|
|
7393
7391
|
}
|
|
7394
7392
|
state = await runtime.composeState(message, responseContent?.providers);
|
|
@@ -7401,7 +7399,7 @@ var postGeneratedHandler = async ({
|
|
|
7401
7399
|
});
|
|
7402
7400
|
const parsedXmlResponse = parseKeyValueXml9(xmlResponseText);
|
|
7403
7401
|
if (!parsedXmlResponse) {
|
|
7404
|
-
runtime.logger.error("
|
|
7402
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, xmlResponseText }, "Failed to parse XML response for post creation");
|
|
7405
7403
|
return;
|
|
7406
7404
|
}
|
|
7407
7405
|
function cleanupPostText(text) {
|
|
@@ -7419,7 +7417,7 @@ $2`);
|
|
|
7419
7417
|
if (RM) {
|
|
7420
7418
|
for (const m of RM.data.recentMessages) {
|
|
7421
7419
|
if (cleanedText === m.content.text) {
|
|
7422
|
-
runtime.logger.info({ cleanedText }, "
|
|
7420
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, cleanedText }, "Already recently posted that, retrying");
|
|
7423
7421
|
postGeneratedHandler({
|
|
7424
7422
|
runtime,
|
|
7425
7423
|
callback,
|
|
@@ -7437,7 +7435,7 @@ $2`);
|
|
|
7437
7435
|
const googleRefusalRegex = /(i\s+can'?t\s+help\s+with\s+that|that\s+goes\s+against\s+(our\s+)?(policy|policies)|i'?m\s+still\s+learning|response\s+must\s+follow\s+(usage|safety)\s+policies|i'?ve\s+been\s+designed\s+to\s+avoid\s+that)/i;
|
|
7438
7436
|
const generalRefusalRegex = /(response\s+was\s+withheld|content\s+was\s+filtered|this\s+request\s+cannot\s+be\s+completed|violates\s+our\s+safety\s+policy|content\s+is\s+not\s+available)/i;
|
|
7439
7437
|
if (oaiRefusalRegex.test(cleanedText) || anthropicRefusalRegex.test(cleanedText) || googleRefusalRegex.test(cleanedText) || generalRefusalRegex.test(cleanedText)) {
|
|
7440
|
-
runtime.logger.info({ cleanedText }, "
|
|
7438
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, cleanedText }, "Got prompt moderation refusal, retrying");
|
|
7441
7439
|
postGeneratedHandler({
|
|
7442
7440
|
runtime,
|
|
7443
7441
|
callback,
|
|
@@ -7468,16 +7466,16 @@ $2`);
|
|
|
7468
7466
|
await callback?.(message2.content);
|
|
7469
7467
|
}
|
|
7470
7468
|
};
|
|
7471
|
-
var syncSingleUser = async (entityId, runtime,
|
|
7469
|
+
var syncSingleUser = async (entityId, runtime, messageServerId, channelId, type, source) => {
|
|
7472
7470
|
try {
|
|
7473
7471
|
const entity = await runtime.getEntityById(entityId);
|
|
7474
|
-
runtime.logger.info(
|
|
7472
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, entityId, username: entity?.metadata?.username }, "Syncing user");
|
|
7475
7473
|
if (!channelId) {
|
|
7476
|
-
runtime.logger.warn(
|
|
7474
|
+
runtime.logger.warn({ src: "plugin:bootstrap", agentId: runtime.agentId, entityId: entity?.id }, "Cannot sync user without a valid channelId");
|
|
7477
7475
|
return;
|
|
7478
7476
|
}
|
|
7479
7477
|
const roomId = createUniqueUuid3(runtime, channelId);
|
|
7480
|
-
const worldId = createUniqueUuid3(runtime,
|
|
7478
|
+
const worldId = createUniqueUuid3(runtime, messageServerId);
|
|
7481
7479
|
const worldMetadata = type === ChannelType9.DM ? {
|
|
7482
7480
|
ownership: {
|
|
7483
7481
|
ownerId: entityId
|
|
@@ -7487,27 +7485,27 @@ var syncSingleUser = async (entityId, runtime, serverId, channelId, type, source
|
|
|
7487
7485
|
},
|
|
7488
7486
|
settings: {}
|
|
7489
7487
|
} : undefined;
|
|
7490
|
-
runtime.logger.info(
|
|
7488
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, type, isDM: type === ChannelType9.DM, worldMetadata }, "syncSingleUser");
|
|
7491
7489
|
await runtime.ensureConnection({
|
|
7492
7490
|
entityId,
|
|
7493
7491
|
roomId,
|
|
7494
7492
|
name: entity?.metadata?.name || entity?.metadata?.username || `User${entityId}`,
|
|
7495
7493
|
source,
|
|
7496
7494
|
channelId,
|
|
7497
|
-
|
|
7495
|
+
messageServerId,
|
|
7498
7496
|
type,
|
|
7499
7497
|
worldId,
|
|
7500
7498
|
metadata: worldMetadata
|
|
7501
7499
|
});
|
|
7502
7500
|
try {
|
|
7503
7501
|
const createdWorld = await runtime.getWorld(worldId);
|
|
7504
|
-
runtime.logger.info(
|
|
7502
|
+
runtime.logger.info({ src: "plugin:bootstrap", agentId: runtime.agentId, worldId, metadata: createdWorld?.metadata }, "Created world check");
|
|
7505
7503
|
} catch (error) {
|
|
7506
|
-
runtime.logger.error(
|
|
7504
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to verify created world");
|
|
7507
7505
|
}
|
|
7508
|
-
runtime.logger.success(
|
|
7506
|
+
runtime.logger.success({ src: "plugin:bootstrap", agentId: runtime.agentId, agentName: runtime.character.name, entityId: entity?.id }, "Successfully synced user");
|
|
7509
7507
|
} catch (error) {
|
|
7510
|
-
runtime.logger.error(
|
|
7508
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error syncing user");
|
|
7511
7509
|
}
|
|
7512
7510
|
};
|
|
7513
7511
|
var handleServerSync = async ({
|
|
@@ -7518,13 +7516,13 @@ var handleServerSync = async ({
|
|
|
7518
7516
|
source,
|
|
7519
7517
|
onComplete
|
|
7520
7518
|
}) => {
|
|
7521
|
-
runtime.logger.debug(
|
|
7519
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, serverName: world.name }, "Handling server sync event");
|
|
7522
7520
|
try {
|
|
7523
7521
|
await runtime.ensureConnections(entities, rooms, source, world);
|
|
7524
|
-
runtime.logger.debug(
|
|
7522
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, worldName: world.name }, "Successfully synced standardized world structure");
|
|
7525
7523
|
onComplete?.();
|
|
7526
7524
|
} catch (error) {
|
|
7527
|
-
runtime.logger.error(
|
|
7525
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing standardized server data");
|
|
7528
7526
|
}
|
|
7529
7527
|
};
|
|
7530
7528
|
var controlMessageHandler = async ({
|
|
@@ -7532,7 +7530,7 @@ var controlMessageHandler = async ({
|
|
|
7532
7530
|
message
|
|
7533
7531
|
}) => {
|
|
7534
7532
|
try {
|
|
7535
|
-
runtime.logger.debug(
|
|
7533
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, action: message.payload.action, roomId: message.roomId }, "Processing control message");
|
|
7536
7534
|
const serviceNames = Array.from(runtime.getAllServices().keys());
|
|
7537
7535
|
const websocketServiceName = serviceNames.find((name) => name.toLowerCase().includes("websocket") || name.toLowerCase().includes("socket"));
|
|
7538
7536
|
if (websocketServiceName) {
|
|
@@ -7546,15 +7544,15 @@ var controlMessageHandler = async ({
|
|
|
7546
7544
|
roomId: message.roomId
|
|
7547
7545
|
}
|
|
7548
7546
|
});
|
|
7549
|
-
runtime.logger.debug(
|
|
7547
|
+
runtime.logger.debug({ src: "plugin:bootstrap", agentId: runtime.agentId, action: message.payload.action }, "Control message sent successfully");
|
|
7550
7548
|
} else {
|
|
7551
|
-
runtime.logger.error("
|
|
7549
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId }, "WebSocket service does not have sendMessage method");
|
|
7552
7550
|
}
|
|
7553
7551
|
} else {
|
|
7554
|
-
runtime.logger.error("
|
|
7552
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId }, "No WebSocket service found to send control message");
|
|
7555
7553
|
}
|
|
7556
7554
|
} catch (error) {
|
|
7557
|
-
runtime.logger.error(
|
|
7555
|
+
runtime.logger.error({ src: "plugin:bootstrap", agentId: runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error processing control message");
|
|
7558
7556
|
}
|
|
7559
7557
|
};
|
|
7560
7558
|
var events = {
|
|
@@ -7570,7 +7568,7 @@ var events = {
|
|
|
7570
7568
|
],
|
|
7571
7569
|
[EventType2.MESSAGE_SENT]: [
|
|
7572
7570
|
async (payload) => {
|
|
7573
|
-
payload.runtime.logger.debug(
|
|
7571
|
+
payload.runtime.logger.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, text: payload.message.content.text }, "Message sent");
|
|
7574
7572
|
}
|
|
7575
7573
|
],
|
|
7576
7574
|
[EventType2.WORLD_JOINED]: [
|
|
@@ -7585,17 +7583,17 @@ var events = {
|
|
|
7585
7583
|
],
|
|
7586
7584
|
[EventType2.ENTITY_JOINED]: [
|
|
7587
7585
|
async (payload) => {
|
|
7588
|
-
payload.runtime.logger.debug(
|
|
7586
|
+
payload.runtime.logger.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, entityId: payload.entityId }, "ENTITY_JOINED event received");
|
|
7589
7587
|
if (!payload.worldId) {
|
|
7590
|
-
payload.runtime.logger.error("
|
|
7588
|
+
payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No worldId provided for entity joined");
|
|
7591
7589
|
return;
|
|
7592
7590
|
}
|
|
7593
7591
|
if (!payload.roomId) {
|
|
7594
|
-
payload.runtime.logger.error("
|
|
7592
|
+
payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No roomId provided for entity joined");
|
|
7595
7593
|
return;
|
|
7596
7594
|
}
|
|
7597
7595
|
if (!payload.metadata?.type) {
|
|
7598
|
-
payload.runtime.logger.error("
|
|
7596
|
+
payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId }, "No type provided for entity joined");
|
|
7599
7597
|
return;
|
|
7600
7598
|
}
|
|
7601
7599
|
await syncSingleUser(payload.entityId, payload.runtime, payload.worldId, payload.roomId, payload.metadata.type, payload.source);
|
|
@@ -7613,9 +7611,9 @@ var events = {
|
|
|
7613
7611
|
};
|
|
7614
7612
|
await payload.runtime.updateEntity(entity);
|
|
7615
7613
|
}
|
|
7616
|
-
payload.runtime.logger.info(
|
|
7614
|
+
payload.runtime.logger.info({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, entityId: payload.entityId, worldId: payload.worldId }, "User left world");
|
|
7617
7615
|
} catch (error) {
|
|
7618
|
-
payload.runtime.logger.error(
|
|
7616
|
+
payload.runtime.logger.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error handling user left");
|
|
7619
7617
|
}
|
|
7620
7618
|
}
|
|
7621
7619
|
],
|
|
@@ -7629,7 +7627,7 @@ var events = {
|
|
|
7629
7627
|
}
|
|
7630
7628
|
}
|
|
7631
7629
|
} catch (error) {
|
|
7632
|
-
|
|
7630
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error sending refetch request");
|
|
7633
7631
|
}
|
|
7634
7632
|
},
|
|
7635
7633
|
async (payload) => {
|
|
@@ -7649,9 +7647,9 @@ var events = {
|
|
|
7649
7647
|
source: "actionHandler"
|
|
7650
7648
|
}
|
|
7651
7649
|
});
|
|
7652
|
-
|
|
7650
|
+
logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, actionName: payload.content?.actions?.[0] }, "Logged ACTION_STARTED event");
|
|
7653
7651
|
} catch (error) {
|
|
7654
|
-
|
|
7652
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to log ACTION_STARTED event");
|
|
7655
7653
|
}
|
|
7656
7654
|
}
|
|
7657
7655
|
],
|
|
@@ -7665,19 +7663,19 @@ var events = {
|
|
|
7665
7663
|
}
|
|
7666
7664
|
}
|
|
7667
7665
|
} catch (error) {
|
|
7668
|
-
|
|
7666
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Error sending refetch request");
|
|
7669
7667
|
}
|
|
7670
7668
|
}
|
|
7671
7669
|
],
|
|
7672
7670
|
[EventType2.EVALUATOR_STARTED]: [
|
|
7673
7671
|
async (payload) => {
|
|
7674
|
-
|
|
7672
|
+
logger16.debug({ src: "plugin:bootstrap:evaluator", agentId: payload.runtime.agentId, evaluatorName: payload.evaluatorName, evaluatorId: payload.evaluatorId }, "Evaluator started");
|
|
7675
7673
|
}
|
|
7676
7674
|
],
|
|
7677
7675
|
[EventType2.EVALUATOR_COMPLETED]: [
|
|
7678
7676
|
async (payload) => {
|
|
7679
|
-
const status = payload.error ?
|
|
7680
|
-
|
|
7677
|
+
const status = payload.error ? "failed" : "completed";
|
|
7678
|
+
logger16.debug({ src: "plugin:bootstrap:evaluator", agentId: payload.runtime.agentId, status, evaluatorName: payload.evaluatorName, evaluatorId: payload.evaluatorId, error: payload.error?.message }, "Evaluator completed");
|
|
7681
7679
|
}
|
|
7682
7680
|
],
|
|
7683
7681
|
[EventType2.RUN_STARTED]: [
|
|
@@ -7697,9 +7695,9 @@ var events = {
|
|
|
7697
7695
|
source: payload.source || "unknown"
|
|
7698
7696
|
}
|
|
7699
7697
|
});
|
|
7700
|
-
|
|
7698
|
+
logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_STARTED event");
|
|
7701
7699
|
} catch (error) {
|
|
7702
|
-
|
|
7700
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to log RUN_STARTED event");
|
|
7703
7701
|
}
|
|
7704
7702
|
}
|
|
7705
7703
|
],
|
|
@@ -7723,9 +7721,9 @@ var events = {
|
|
|
7723
7721
|
source: payload.source || "unknown"
|
|
7724
7722
|
}
|
|
7725
7723
|
});
|
|
7726
|
-
|
|
7724
|
+
logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId, status: payload.status }, "Logged RUN_ENDED event");
|
|
7727
7725
|
} catch (error) {
|
|
7728
|
-
|
|
7726
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to log RUN_ENDED event");
|
|
7729
7727
|
}
|
|
7730
7728
|
}
|
|
7731
7729
|
],
|
|
@@ -7749,9 +7747,9 @@ var events = {
|
|
|
7749
7747
|
source: payload.source || "unknown"
|
|
7750
7748
|
}
|
|
7751
7749
|
});
|
|
7752
|
-
|
|
7750
|
+
logger16.debug({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, runId: payload.runId }, "Logged RUN_TIMEOUT event");
|
|
7753
7751
|
} catch (error) {
|
|
7754
|
-
|
|
7752
|
+
logger16.error({ src: "plugin:bootstrap", agentId: payload.runtime.agentId, error: error instanceof Error ? error.message : String(error) }, "Failed to log RUN_TIMEOUT event");
|
|
7755
7753
|
}
|
|
7756
7754
|
}
|
|
7757
7755
|
],
|
|
@@ -7837,5 +7835,5 @@ export {
|
|
|
7837
7835
|
actionStateProvider
|
|
7838
7836
|
};
|
|
7839
7837
|
|
|
7840
|
-
//# debugId=
|
|
7838
|
+
//# debugId=B5755FAB85A9201A64756E2164756E21
|
|
7841
7839
|
//# sourceMappingURL=index.js.map
|