Skip to content

Commit e9217ca

Browse files
committed
update message format
1 parent c7c5671 commit e9217ca

File tree

2 files changed

+27
-44
lines changed

2 files changed

+27
-44
lines changed

packages/plugin-bootstrap/src/providers/roles.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
ChannelType,
3-
createUniqueUuid,
43
logger,
54
type IAgentRuntime,
65
type Memory,
@@ -47,25 +46,24 @@ export const roleProvider: Provider = {
4746
};
4847
}
4948

50-
const serverId = room.messageServerId;
49+
const worldId = room.worldId;
5150

52-
if (!serverId) {
53-
throw new Error('No server ID found');
51+
if (!worldId) {
52+
throw new Error('No world ID found for room');
5453
}
5554

5655
logger.info(
57-
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, serverId },
58-
'Using server ID'
56+
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, worldId },
57+
'Using world ID'
5958
);
6059

61-
// Get world data instead of using cache
62-
const worldId = createUniqueUuid(runtime, serverId);
60+
// Get world data
6361
const world = await runtime.getWorld(worldId);
6462

6563
if (!world || !world.metadata?.ownership?.ownerId) {
6664
logger.info(
67-
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, serverId },
68-
'No ownership data found for server, initializing empty role hierarchy'
65+
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, worldId },
66+
'No ownership data found for world, initializing empty role hierarchy'
6967
);
7068
return {
7169
data: {
@@ -82,8 +80,8 @@ export const roleProvider: Provider = {
8280

8381
if (Object.keys(roles).length === 0) {
8482
logger.info(
85-
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, serverId },
86-
'No roles found for server'
83+
{ src: 'plugin:bootstrap:provider:roles', agentId: runtime.agentId, worldId },
84+
'No roles found for world'
8785
);
8886
return {
8987
data: {

packages/plugin-bootstrap/src/providers/settings.ts

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import {
55
ChannelType,
66
findWorldsForOwner,
7-
getWorldSettings,
87
logger,
98
World,
109
type IAgentRuntime,
@@ -113,13 +112,12 @@ function generateStatusMessage(
113112
}
114113

115114
// Non-onboarding context - list all public settings with values and descriptions
116-
return `## Current Configuration\n\n${
117-
requiredUnconfigured > 0
118-
? `IMPORTANT!: ${requiredUnconfigured} required settings still need configuration. ${runtime.character.name} should get onboarded with the OWNER as soon as possible.\n\n`
119-
: 'All required settings are configured.\n\n'
120-
}${formattedSettings
121-
.map((s) => `### ${s?.name}\n**Value:** ${s?.value}\n**Description:** ${s?.description}`)
122-
.join('\n\n')}`;
115+
return `## Current Configuration\n\n${requiredUnconfigured > 0
116+
? `IMPORTANT!: ${requiredUnconfigured} required settings still need configuration. ${runtime.character.name} should get onboarded with the OWNER as soon as possible.\n\n`
117+
: 'All required settings are configured.\n\n'
118+
}${formattedSettings
119+
.map((s) => `### ${s?.name}\n**Value:** ${s?.value}\n**Description:** ${s?.description}`)
120+
.join('\n\n')}`;
123121
} catch (error) {
124122
logger.error(
125123
{
@@ -231,22 +229,9 @@ export const settingsProvider: Provider = {
231229

232230
serverId = world.messageServerId;
233231

234-
// Fetch world settings based on the server ID
235-
if (serverId) {
236-
try {
237-
worldSettings = await getWorldSettings(runtime, serverId);
238-
} catch (error) {
239-
logger.error(
240-
{
241-
src: 'plugin:bootstrap:provider:settings',
242-
agentId: runtime.agentId,
243-
serverId,
244-
error: error instanceof Error ? error.message : String(error),
245-
},
246-
'Error fetching world settings'
247-
);
248-
throw new Error(`Failed to retrieve settings for server ${serverId}`);
249-
}
232+
// Get world settings directly from the world object we already have
233+
if (world.metadata?.settings) {
234+
worldSettings = world.metadata.settings as WorldSettings;
250235
}
251236
} else {
252237
// For non-onboarding, we need to get the world associated with the room
@@ -267,17 +252,17 @@ export const settingsProvider: Provider = {
267252

268253
serverId = world.messageServerId;
269254

270-
// Once we have the serverId, get the settings
271-
if (serverId) {
272-
worldSettings = await getWorldSettings(runtime, serverId);
273-
} else {
274-
logger.error(
255+
// Get world settings directly from the world object we already have
256+
if (world.metadata?.settings) {
257+
worldSettings = world.metadata.settings as WorldSettings;
258+
} else if (!serverId) {
259+
logger.debug(
275260
{
276261
src: 'plugin:bootstrap:provider:settings',
277262
agentId: runtime.agentId,
278263
worldId: room.worldId,
279264
},
280-
'No server ID found for world'
265+
'No server ID or settings found for world'
281266
);
282267
}
283268
} catch (error) {
@@ -310,7 +295,7 @@ export const settingsProvider: Provider = {
310295
},
311296
values: {
312297
settings:
313-
"The user doesn't appear to have ownership of any servers. They should make sure they're using the correct account.",
298+
"The user doesn't appear to have ownership of any servers. They should make sure they're using the correct account.",
314299
},
315300
text: "The user doesn't appear to have ownership of any servers. They should make sure they're using the correct account.",
316301
}
@@ -337,7 +322,7 @@ export const settingsProvider: Provider = {
337322
},
338323
values: {
339324
settings:
340-
"The user doesn't appear to have any settings configured for this server. They should configure some settings for this server.",
325+
"The user doesn't appear to have any settings configured for this server. They should configure some settings for this server.",
341326
},
342327
text: "The user doesn't appear to have any settings configured for this server. They should configure some settings for this server.",
343328
}

0 commit comments

Comments
 (0)