@elizaos/core 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6DHKYLYG.js → chunk-WLUL3JMY.js} +305 -29
- package/dist/{index-Bu4JVNja.d.ts → index-DOpqCUJl.d.ts} +51 -15
- package/dist/index.d.ts +10 -7
- package/dist/index.js +3 -1
- package/dist/specs/v1/actionExample.d.ts +1 -1
- package/dist/specs/v1/index.d.ts +1 -1
- package/dist/specs/v1/index.js +1 -1
- package/dist/specs/v1/messages.js +1 -1
- package/dist/specs/v1/posts.js +1 -1
- package/dist/specs/v1/provider.d.ts +1 -1
- package/dist/specs/v1/runtime.js +1 -1
- package/dist/specs/v1/state.d.ts +1 -1
- package/dist/specs/v1/templates.d.ts +1 -1
- package/dist/specs/v1/uuid.js +1 -1
- package/dist/specs/v2/index.d.ts +2 -2
- package/dist/specs/v2/index.js +1 -1
- package/dist/{types-CpAVqV6l.d.ts → types-DIUaglro.d.ts} +1 -1
- package/package.json +2 -2
|
@@ -499,6 +499,15 @@ var AgentStatus2 = /* @__PURE__ */ ((AgentStatus3) => {
|
|
|
499
499
|
return AgentStatus3;
|
|
500
500
|
})(AgentStatus2 || {});
|
|
501
501
|
|
|
502
|
+
// src/types/components.ts
|
|
503
|
+
function createActionResult(partial = {}) {
|
|
504
|
+
return {
|
|
505
|
+
success: true,
|
|
506
|
+
// Default to success
|
|
507
|
+
...partial
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
502
511
|
// src/types/service.ts
|
|
503
512
|
var ServiceType3 = {
|
|
504
513
|
TRANSCRIPTION: "transcription",
|
|
@@ -513,10 +522,7 @@ var ServiceType3 = {
|
|
|
513
522
|
WALLET: "wallet",
|
|
514
523
|
LP_POOL: "lp_pool",
|
|
515
524
|
TOKEN_DATA: "token_data",
|
|
516
|
-
|
|
517
|
-
PLUGIN_MANAGER: "PLUGIN_MANAGER",
|
|
518
|
-
PLUGIN_CONFIGURATION: "PLUGIN_CONFIGURATION",
|
|
519
|
-
PLUGIN_USER_INTERACTION: "PLUGIN_USER_INTERACTION"
|
|
525
|
+
UNKNOWN: "unknown"
|
|
520
526
|
};
|
|
521
527
|
var Service3 = class {
|
|
522
528
|
constructor(runtime) {
|
|
@@ -1463,7 +1469,7 @@ function formatActionNames2(actions) {
|
|
|
1463
1469
|
}
|
|
1464
1470
|
function formatActions2(actions) {
|
|
1465
1471
|
if (!actions?.length) return "";
|
|
1466
|
-
return [...actions].sort(() => Math.random() - 0.5).map((action) =>
|
|
1472
|
+
return [...actions].sort(() => Math.random() - 0.5).map((action) => `- **${action.name}**: ${action.description || "No description available"}`).join("\n");
|
|
1467
1473
|
}
|
|
1468
1474
|
|
|
1469
1475
|
// src/database.ts
|
|
@@ -1519,14 +1525,22 @@ IMPORTANT ACTION ORDERING RULES:
|
|
|
1519
1525
|
- REPLY is used to acknowledge and inform the user about what you're going to do
|
|
1520
1526
|
- Follow-up actions execute the actual tasks after acknowledgment
|
|
1521
1527
|
- Use IGNORE only when you should not respond at all
|
|
1528
|
+
- If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.
|
|
1522
1529
|
|
|
1523
1530
|
IMPORTANT PROVIDER SELECTION RULES:
|
|
1531
|
+
- Only include providers if they are needed to respond accurately.
|
|
1524
1532
|
- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see "(Attachments:" in the conversation, you MUST include "ATTACHMENTS" in your providers list
|
|
1525
1533
|
- If the message asks about or references specific people, include "ENTITIES" in your providers list
|
|
1526
1534
|
- If the message asks about relationships or connections between people, include "RELATIONSHIPS" in your providers list
|
|
1527
1535
|
- If the message asks about facts or specific information, include "FACTS" in your providers list
|
|
1528
1536
|
- If the message asks about the environment or world context, include "WORLD" in your providers list
|
|
1529
|
-
- If
|
|
1537
|
+
- If no additional context is needed, you may leave the providers list empty.
|
|
1538
|
+
|
|
1539
|
+
IMPORTANT CODE BLOCK FORMATTING RULES:
|
|
1540
|
+
- If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with \`\`\` fenced code blocks (specify the language if known, e.g., \`\`\`python).
|
|
1541
|
+
- ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.
|
|
1542
|
+
- If including inline code (short single words or function names), use single backticks (\`) as appropriate.
|
|
1543
|
+
- This ensures the user sees clearly formatted and copyable code when relevant.
|
|
1530
1544
|
|
|
1531
1545
|
First, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.
|
|
1532
1546
|
</instructions>
|
|
@@ -1591,7 +1605,7 @@ Your output should be formatted in XML like this:
|
|
|
1591
1605
|
|
|
1592
1606
|
The "post" field should be the post you want to send. Do not including any thinking or internal reflection in the "post" field.
|
|
1593
1607
|
The "imagePrompt" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.
|
|
1594
|
-
The "thought" field should be a short description of what the agent is thinking about before responding,
|
|
1608
|
+
The "thought" field should be a short description of what the agent is thinking about before responding, including a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.
|
|
1595
1609
|
|
|
1596
1610
|
Do NOT include any thinking, reasoning, or <think> sections in your response.
|
|
1597
1611
|
Go directly to the XML response format without any preamble or explanation.
|
|
@@ -2689,6 +2703,7 @@ var Semaphore = class {
|
|
|
2689
2703
|
}
|
|
2690
2704
|
};
|
|
2691
2705
|
var AgentRuntime = class {
|
|
2706
|
+
// Default value, can be overridden
|
|
2692
2707
|
constructor(opts) {
|
|
2693
2708
|
this.#conversationLength = 32;
|
|
2694
2709
|
this.actions = [];
|
|
@@ -2711,6 +2726,7 @@ var AgentRuntime = class {
|
|
|
2711
2726
|
// The initial list of plugins specified by the character configuration.
|
|
2712
2727
|
this.characterPlugins = [];
|
|
2713
2728
|
this.servicesInitQueue = /* @__PURE__ */ new Set();
|
|
2729
|
+
this.maxWorkingMemoryEntries = 50;
|
|
2714
2730
|
this.agentId = opts.character?.id ?? opts?.agentId ?? stringToUuid(opts.character?.name ?? uuidv4() + opts.character?.username);
|
|
2715
2731
|
this.character = opts.character;
|
|
2716
2732
|
const logLevel = process.env.LOG_LEVEL || "info";
|
|
@@ -2735,6 +2751,11 @@ var AgentRuntime = class {
|
|
|
2735
2751
|
}
|
|
2736
2752
|
this.logger.debug(`Success: Agent ID: ${this.agentId}`);
|
|
2737
2753
|
this.currentRunId = void 0;
|
|
2754
|
+
if (opts.settings?.MAX_WORKING_MEMORY_ENTRIES) {
|
|
2755
|
+
this.maxWorkingMemoryEntries = parseInt(opts.settings.MAX_WORKING_MEMORY_ENTRIES, 10) || 50;
|
|
2756
|
+
} else if (process.env.MAX_WORKING_MEMORY_ENTRIES) {
|
|
2757
|
+
this.maxWorkingMemoryEntries = parseInt(process.env.MAX_WORKING_MEMORY_ENTRIES, 10) || 50;
|
|
2758
|
+
}
|
|
2738
2759
|
}
|
|
2739
2760
|
#conversationLength;
|
|
2740
2761
|
/**
|
|
@@ -3035,19 +3056,74 @@ var AgentRuntime = class {
|
|
|
3035
3056
|
registerEvaluator(evaluator) {
|
|
3036
3057
|
this.evaluators.push(evaluator);
|
|
3037
3058
|
}
|
|
3059
|
+
// Helper functions for immutable action plan updates
|
|
3060
|
+
updateActionPlan(plan, updates) {
|
|
3061
|
+
return { ...plan, ...updates };
|
|
3062
|
+
}
|
|
3063
|
+
updateActionStep(plan, index, stepUpdates) {
|
|
3064
|
+
if (!plan.steps || index < 0 || index >= plan.steps.length) {
|
|
3065
|
+
this.logger.warn(
|
|
3066
|
+
`Invalid step index: ${index} for plan with ${plan.steps?.length || 0} steps`
|
|
3067
|
+
);
|
|
3068
|
+
return plan;
|
|
3069
|
+
}
|
|
3070
|
+
return {
|
|
3071
|
+
...plan,
|
|
3072
|
+
steps: plan.steps.map(
|
|
3073
|
+
(step, i) => i === index ? { ...step, ...stepUpdates } : step
|
|
3074
|
+
)
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3038
3077
|
async processActions(message, responses, state, callback) {
|
|
3078
|
+
const allActions = [];
|
|
3079
|
+
for (const response of responses) {
|
|
3080
|
+
if (response.content?.actions && response.content.actions.length > 0) {
|
|
3081
|
+
allActions.push(...response.content.actions);
|
|
3082
|
+
}
|
|
3083
|
+
}
|
|
3084
|
+
const hasMultipleActions = allActions.length > 1;
|
|
3085
|
+
const runId = this.createRunId();
|
|
3086
|
+
let actionPlan = null;
|
|
3087
|
+
if (hasMultipleActions) {
|
|
3088
|
+
const thought = responses[0]?.content?.thought || `Executing ${allActions.length} actions: ${allActions.join(", ")}`;
|
|
3089
|
+
actionPlan = {
|
|
3090
|
+
runId,
|
|
3091
|
+
totalSteps: allActions.length,
|
|
3092
|
+
currentStep: 0,
|
|
3093
|
+
steps: allActions.map((action) => ({
|
|
3094
|
+
action,
|
|
3095
|
+
status: "pending"
|
|
3096
|
+
})),
|
|
3097
|
+
thought,
|
|
3098
|
+
startTime: Date.now()
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
3101
|
+
let actionIndex = 0;
|
|
3039
3102
|
for (const response of responses) {
|
|
3040
3103
|
let normalizeAction = function(actionString) {
|
|
3041
|
-
return actionString.toLowerCase().replace(
|
|
3104
|
+
return actionString.toLowerCase().replace(/_/g, "");
|
|
3042
3105
|
};
|
|
3043
3106
|
if (!response.content?.actions || response.content.actions.length === 0) {
|
|
3044
3107
|
this.logger.warn("No action found in the response content.");
|
|
3045
3108
|
continue;
|
|
3046
3109
|
}
|
|
3047
3110
|
const actions = response.content.actions;
|
|
3111
|
+
const actionResults = [];
|
|
3112
|
+
let accumulatedState = state;
|
|
3048
3113
|
this.logger.debug(`Found actions: ${this.actions.map((a) => normalizeAction(a.name))}`);
|
|
3049
3114
|
for (const responseAction of actions) {
|
|
3050
|
-
|
|
3115
|
+
if (actionPlan) {
|
|
3116
|
+
actionPlan = this.updateActionPlan(actionPlan, { currentStep: actionIndex + 1 });
|
|
3117
|
+
}
|
|
3118
|
+
accumulatedState = await this.composeState(message, [
|
|
3119
|
+
"RECENT_MESSAGES",
|
|
3120
|
+
"ACTION_STATE"
|
|
3121
|
+
// This will include the action plan
|
|
3122
|
+
]);
|
|
3123
|
+
if (actionPlan && accumulatedState.data) {
|
|
3124
|
+
accumulatedState.data.actionPlan = actionPlan;
|
|
3125
|
+
accumulatedState.data.actionResults = actionResults;
|
|
3126
|
+
}
|
|
3051
3127
|
this.logger.debug(`Success: Calling action: ${responseAction}`);
|
|
3052
3128
|
const normalizedResponseAction = normalizeAction(responseAction);
|
|
3053
3129
|
let action = this.actions.find(
|
|
@@ -3063,12 +3139,20 @@ var AgentRuntime = class {
|
|
|
3063
3139
|
} else {
|
|
3064
3140
|
this.logger.debug("Attempting to find action in similes.");
|
|
3065
3141
|
for (const _action of this.actions) {
|
|
3066
|
-
const
|
|
3067
|
-
(simile) => simile
|
|
3142
|
+
const exactSimileMatch = _action.similes?.find(
|
|
3143
|
+
(simile) => normalizeAction(simile) === normalizedResponseAction
|
|
3068
3144
|
);
|
|
3069
|
-
if (
|
|
3145
|
+
if (exactSimileMatch) {
|
|
3070
3146
|
action = _action;
|
|
3071
|
-
this.logger.debug(`Success: Action found in similes: ${action.name}`);
|
|
3147
|
+
this.logger.debug(`Success: Action found in similes (exact match): ${action.name}`);
|
|
3148
|
+
break;
|
|
3149
|
+
}
|
|
3150
|
+
const fuzzySimileMatch = _action.similes?.find(
|
|
3151
|
+
(simile) => normalizeAction(simile).includes(normalizedResponseAction) || normalizedResponseAction.includes(normalizeAction(simile))
|
|
3152
|
+
);
|
|
3153
|
+
if (fuzzySimileMatch) {
|
|
3154
|
+
action = _action;
|
|
3155
|
+
this.logger.debug(`Success: Action found in similes (fuzzy match): ${action.name}`);
|
|
3072
3156
|
break;
|
|
3073
3157
|
}
|
|
3074
3158
|
}
|
|
@@ -3076,6 +3160,12 @@ var AgentRuntime = class {
|
|
|
3076
3160
|
if (!action) {
|
|
3077
3161
|
const errorMsg = `No action found for: ${responseAction}`;
|
|
3078
3162
|
this.logger.error(errorMsg);
|
|
3163
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
3164
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
3165
|
+
status: "failed",
|
|
3166
|
+
error: errorMsg
|
|
3167
|
+
});
|
|
3168
|
+
}
|
|
3079
3169
|
const actionMemory = {
|
|
3080
3170
|
id: uuidv4(),
|
|
3081
3171
|
entityId: message.entityId,
|
|
@@ -3083,14 +3173,26 @@ var AgentRuntime = class {
|
|
|
3083
3173
|
worldId: message.worldId,
|
|
3084
3174
|
content: {
|
|
3085
3175
|
thought: errorMsg,
|
|
3086
|
-
source: "auto"
|
|
3176
|
+
source: "auto",
|
|
3177
|
+
type: "action_result",
|
|
3178
|
+
actionName: responseAction,
|
|
3179
|
+
actionStatus: "failed",
|
|
3180
|
+
runId
|
|
3087
3181
|
}
|
|
3088
3182
|
};
|
|
3089
3183
|
await this.createMemory(actionMemory, "messages");
|
|
3184
|
+
actionIndex++;
|
|
3090
3185
|
continue;
|
|
3091
3186
|
}
|
|
3092
3187
|
if (!action.handler) {
|
|
3093
3188
|
this.logger.error(`Action ${action.name} has no handler.`);
|
|
3189
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
3190
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
3191
|
+
status: "failed",
|
|
3192
|
+
error: "No handler"
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3195
|
+
actionIndex++;
|
|
3094
3196
|
continue;
|
|
3095
3197
|
}
|
|
3096
3198
|
try {
|
|
@@ -3101,9 +3203,130 @@ var AgentRuntime = class {
|
|
|
3101
3203
|
actionId,
|
|
3102
3204
|
prompts: []
|
|
3103
3205
|
};
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3206
|
+
const actionContext = {
|
|
3207
|
+
previousResults: actionResults,
|
|
3208
|
+
getPreviousResult: (actionName) => {
|
|
3209
|
+
return actionResults.find((r) => r.data?.actionName === actionName);
|
|
3210
|
+
}
|
|
3211
|
+
};
|
|
3212
|
+
const options2 = {
|
|
3213
|
+
context: actionContext
|
|
3214
|
+
};
|
|
3215
|
+
if (actionPlan) {
|
|
3216
|
+
options2.actionPlan = {
|
|
3217
|
+
totalSteps: actionPlan.totalSteps,
|
|
3218
|
+
currentStep: actionPlan.currentStep,
|
|
3219
|
+
steps: actionPlan.steps,
|
|
3220
|
+
thought: actionPlan.thought
|
|
3221
|
+
};
|
|
3222
|
+
}
|
|
3223
|
+
const result = await action.handler(
|
|
3224
|
+
this,
|
|
3225
|
+
message,
|
|
3226
|
+
accumulatedState,
|
|
3227
|
+
options2,
|
|
3228
|
+
callback,
|
|
3229
|
+
responses
|
|
3230
|
+
);
|
|
3231
|
+
const isLegacyReturn = result === void 0 || result === null || typeof result === "boolean";
|
|
3232
|
+
let actionResult = null;
|
|
3233
|
+
if (!isLegacyReturn) {
|
|
3234
|
+
if (typeof result === "object" && result !== null && ("values" in result || "data" in result || "text" in result)) {
|
|
3235
|
+
actionResult = {
|
|
3236
|
+
success: true,
|
|
3237
|
+
// Default to true if not specified
|
|
3238
|
+
...result
|
|
3239
|
+
};
|
|
3240
|
+
} else {
|
|
3241
|
+
actionResult = {
|
|
3242
|
+
success: true,
|
|
3243
|
+
// Default success for legacy results
|
|
3244
|
+
data: {
|
|
3245
|
+
actionName: action.name,
|
|
3246
|
+
legacyResult: result
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
}
|
|
3250
|
+
actionResults.push(actionResult);
|
|
3251
|
+
if (actionResult.values) {
|
|
3252
|
+
accumulatedState = {
|
|
3253
|
+
...accumulatedState,
|
|
3254
|
+
values: { ...accumulatedState.values, ...actionResult.values },
|
|
3255
|
+
data: {
|
|
3256
|
+
...accumulatedState.data || {},
|
|
3257
|
+
actionResults: [...accumulatedState.data?.actionResults || [], actionResult],
|
|
3258
|
+
actionPlan
|
|
3259
|
+
}
|
|
3260
|
+
};
|
|
3261
|
+
}
|
|
3262
|
+
if (actionResult && accumulatedState.data) {
|
|
3263
|
+
if (!accumulatedState.data.workingMemory) accumulatedState.data.workingMemory = {};
|
|
3264
|
+
const memoryKey = `action_${responseAction}_${uuidv4()}`;
|
|
3265
|
+
const memoryEntry = {
|
|
3266
|
+
actionName: action.name,
|
|
3267
|
+
result: actionResult,
|
|
3268
|
+
timestamp: Date.now()
|
|
3269
|
+
};
|
|
3270
|
+
accumulatedState.data.workingMemory[memoryKey] = memoryEntry;
|
|
3271
|
+
const entries = Object.entries(accumulatedState.data.workingMemory);
|
|
3272
|
+
if (entries.length > this.maxWorkingMemoryEntries) {
|
|
3273
|
+
const sorted = entries.sort((a, b) => {
|
|
3274
|
+
const entryA = a[1];
|
|
3275
|
+
const entryB = b[1];
|
|
3276
|
+
const timestampA = entryA?.timestamp ?? 0;
|
|
3277
|
+
const timestampB = entryB?.timestamp ?? 0;
|
|
3278
|
+
return timestampB - timestampA;
|
|
3279
|
+
});
|
|
3280
|
+
accumulatedState.data.workingMemory = Object.fromEntries(
|
|
3281
|
+
sorted.slice(0, this.maxWorkingMemoryEntries)
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3284
|
+
}
|
|
3285
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
3286
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
3287
|
+
status: "completed",
|
|
3288
|
+
result: actionResult
|
|
3289
|
+
});
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
const actionMemory = {
|
|
3293
|
+
id: actionId,
|
|
3294
|
+
entityId: this.agentId,
|
|
3295
|
+
roomId: message.roomId,
|
|
3296
|
+
worldId: message.worldId,
|
|
3297
|
+
content: {
|
|
3298
|
+
text: actionResult?.text || `Executed action: ${action.name}`,
|
|
3299
|
+
source: "action",
|
|
3300
|
+
type: "action_result",
|
|
3301
|
+
actionName: action.name,
|
|
3302
|
+
actionStatus: actionResult?.success ? "completed" : "failed",
|
|
3303
|
+
actionResult: isLegacyReturn ? { legacy: result } : actionResult,
|
|
3304
|
+
runId,
|
|
3305
|
+
...actionPlan && {
|
|
3306
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
3307
|
+
planThought: actionPlan.thought
|
|
3308
|
+
}
|
|
3309
|
+
},
|
|
3310
|
+
metadata: {
|
|
3311
|
+
type: "action_result",
|
|
3312
|
+
actionName: action.name,
|
|
3313
|
+
runId,
|
|
3314
|
+
actionId,
|
|
3315
|
+
...actionPlan && {
|
|
3316
|
+
totalSteps: actionPlan.totalSteps,
|
|
3317
|
+
currentStep: actionPlan.currentStep
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
};
|
|
3321
|
+
await this.createMemory(actionMemory, "messages");
|
|
3322
|
+
this.logger.debug(`Action ${action.name} completed`, {
|
|
3323
|
+
isLegacyReturn,
|
|
3324
|
+
result: isLegacyReturn ? result : void 0,
|
|
3325
|
+
hasValues: actionResult ? !!actionResult.values : false,
|
|
3326
|
+
hasData: actionResult ? !!actionResult.data : false,
|
|
3327
|
+
hasText: actionResult ? !!actionResult.text : false
|
|
3328
|
+
});
|
|
3329
|
+
await this.adapter.log({
|
|
3107
3330
|
entityId: message.entityId,
|
|
3108
3331
|
roomId: message.roomId,
|
|
3109
3332
|
type: "action",
|
|
@@ -3112,30 +3335,82 @@ var AgentRuntime = class {
|
|
|
3112
3335
|
actionId,
|
|
3113
3336
|
message: message.content.text,
|
|
3114
3337
|
messageId: message.id,
|
|
3115
|
-
state,
|
|
3338
|
+
state: accumulatedState,
|
|
3116
3339
|
responses,
|
|
3340
|
+
result: isLegacyReturn ? { legacy: result } : actionResult,
|
|
3341
|
+
isLegacyReturn,
|
|
3117
3342
|
prompts: this.currentActionContext?.prompts || [],
|
|
3118
|
-
promptCount: this.currentActionContext?.prompts.length || 0
|
|
3343
|
+
promptCount: this.currentActionContext?.prompts.length || 0,
|
|
3344
|
+
runId,
|
|
3345
|
+
...actionPlan && {
|
|
3346
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
3347
|
+
planThought: actionPlan.thought
|
|
3348
|
+
}
|
|
3119
3349
|
}
|
|
3120
3350
|
});
|
|
3121
3351
|
this.currentActionContext = void 0;
|
|
3122
3352
|
} catch (error) {
|
|
3123
3353
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
3124
3354
|
this.logger.error(error);
|
|
3355
|
+
if (actionPlan && actionPlan.steps[actionIndex]) {
|
|
3356
|
+
actionPlan = this.updateActionStep(actionPlan, actionIndex, {
|
|
3357
|
+
status: "failed",
|
|
3358
|
+
error: errorMessage
|
|
3359
|
+
});
|
|
3360
|
+
}
|
|
3125
3361
|
this.currentActionContext = void 0;
|
|
3362
|
+
const errorResult = {
|
|
3363
|
+
success: false,
|
|
3364
|
+
// Required field
|
|
3365
|
+
data: {
|
|
3366
|
+
actionName: action.name,
|
|
3367
|
+
error: errorMessage,
|
|
3368
|
+
errorObject: error
|
|
3369
|
+
}
|
|
3370
|
+
};
|
|
3371
|
+
actionResults.push(errorResult);
|
|
3126
3372
|
const actionMemory = {
|
|
3127
3373
|
id: uuidv4(),
|
|
3128
3374
|
content: {
|
|
3129
3375
|
thought: errorMessage,
|
|
3130
|
-
source: "auto"
|
|
3376
|
+
source: "auto",
|
|
3377
|
+
type: "action_result",
|
|
3378
|
+
actionName: action.name,
|
|
3379
|
+
actionStatus: "failed",
|
|
3380
|
+
error: errorMessage,
|
|
3381
|
+
runId,
|
|
3382
|
+
...actionPlan && {
|
|
3383
|
+
planStep: `${actionPlan.currentStep}/${actionPlan.totalSteps}`,
|
|
3384
|
+
planThought: actionPlan.thought
|
|
3385
|
+
}
|
|
3131
3386
|
},
|
|
3132
|
-
entityId:
|
|
3387
|
+
entityId: this.agentId,
|
|
3133
3388
|
roomId: message.roomId,
|
|
3134
|
-
worldId: message.worldId
|
|
3389
|
+
worldId: message.worldId,
|
|
3390
|
+
metadata: {
|
|
3391
|
+
type: "action_result",
|
|
3392
|
+
actionName: action.name,
|
|
3393
|
+
runId,
|
|
3394
|
+
error: true,
|
|
3395
|
+
...actionPlan && {
|
|
3396
|
+
totalSteps: actionPlan.totalSteps,
|
|
3397
|
+
currentStep: actionPlan.currentStep
|
|
3398
|
+
}
|
|
3399
|
+
}
|
|
3135
3400
|
};
|
|
3136
3401
|
await this.createMemory(actionMemory, "messages");
|
|
3137
|
-
|
|
3402
|
+
if (error?.critical || error?.code === "CRITICAL_ERROR") {
|
|
3403
|
+
throw error;
|
|
3404
|
+
}
|
|
3138
3405
|
}
|
|
3406
|
+
actionIndex++;
|
|
3407
|
+
}
|
|
3408
|
+
if (message.id) {
|
|
3409
|
+
this.stateCache.set(`${message.id}_action_results`, {
|
|
3410
|
+
values: { actionResults },
|
|
3411
|
+
data: { actionResults, actionPlan },
|
|
3412
|
+
text: JSON.stringify(actionResults)
|
|
3413
|
+
});
|
|
3139
3414
|
}
|
|
3140
3415
|
}
|
|
3141
3416
|
}
|
|
@@ -3217,7 +3492,7 @@ var AgentRuntime = class {
|
|
|
3217
3492
|
await this.createRooms(roomObjsToCreate);
|
|
3218
3493
|
}
|
|
3219
3494
|
const entityIds = entities.map((e) => e.id);
|
|
3220
|
-
const entityExistsCheck = await this.adapter.
|
|
3495
|
+
const entityExistsCheck = await this.adapter.getEntitiesByIds(entityIds);
|
|
3221
3496
|
const entitiesToUpdate = entityExistsCheck.map((e) => e.id);
|
|
3222
3497
|
const entitiesToCreate = entities.filter((e) => !entitiesToUpdate.includes(e.id));
|
|
3223
3498
|
const r = {
|
|
@@ -3824,12 +4099,12 @@ var AgentRuntime = class {
|
|
|
3824
4099
|
return newAgent;
|
|
3825
4100
|
}
|
|
3826
4101
|
async getEntityById(entityId) {
|
|
3827
|
-
const entities = await this.adapter.
|
|
4102
|
+
const entities = await this.adapter.getEntitiesByIds([entityId]);
|
|
3828
4103
|
if (!entities?.length) return null;
|
|
3829
4104
|
return entities[0];
|
|
3830
4105
|
}
|
|
3831
|
-
async
|
|
3832
|
-
return await this.adapter.
|
|
4106
|
+
async getEntitiesByIds(entityIds) {
|
|
4107
|
+
return await this.adapter.getEntitiesByIds(entityIds);
|
|
3833
4108
|
}
|
|
3834
4109
|
async getEntitiesForRoom(roomId, includeComponents) {
|
|
3835
4110
|
return await this.adapter.getEntitiesForRoom(roomId, includeComponents);
|
|
@@ -5420,8 +5695,8 @@ var AgentRuntime2 = class {
|
|
|
5420
5695
|
async getEntityById(entityId) {
|
|
5421
5696
|
return this._runtime.getEntityById(entityId);
|
|
5422
5697
|
}
|
|
5423
|
-
async
|
|
5424
|
-
return this._runtime.
|
|
5698
|
+
async getEntitiesByIds(entityIds) {
|
|
5699
|
+
return this._runtime.getEntitiesByIds(entityIds);
|
|
5425
5700
|
}
|
|
5426
5701
|
async getEntitiesForRoom(roomId, includeComponents) {
|
|
5427
5702
|
return this._runtime.getEntitiesForRoom(roomId, includeComponents);
|
|
@@ -5788,6 +6063,7 @@ export {
|
|
|
5788
6063
|
Role2 as Role,
|
|
5789
6064
|
ChannelType2 as ChannelType,
|
|
5790
6065
|
AgentStatus2 as AgentStatus,
|
|
6066
|
+
createActionResult,
|
|
5791
6067
|
ServiceType3 as ServiceType,
|
|
5792
6068
|
Service3 as Service,
|
|
5793
6069
|
getTypedService2 as getTypedService,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Action$1, I as IDatabaseAdapter$1, U as UUID$1, E as Entity$1, b as Component$1, M as Memory$1, L as Log$1, c as MemoryMetadata$1, W as World$1, R as Room$1, d as Participant$1, e as Relationship$1, f as Agent$1, T as Task$1, g as IAgentRuntime$1, h as Role$1, i as ServiceTypeName$1, j as Service$1, k as Route$1, l as Character$1, P as Provider$1, m as Evaluator$1, n as Plugin$1, o as RuntimeSettings$1, S as State$1, H as HandlerCallback$1, p as ModelTypeName$1, q as ModelResultMap$1, r as ModelParamsMap$1, s as TaskWorker$1, t as SendHandlerFunction$1, u as TargetInfo$1, C as Content$1, v as TemplateType$1, w as ActionEventPayload$1, A as ActionExample$1, x as AgentStatus$1, y as AudioProcessingParams$1, B as BaseMetadata$1, z as BaseModelParams$1, D as CacheKeyPrefix$1, F as ChannelClearedPayload$1, G as ChannelType$1, J as ChunkRow$1, K as ComponentData, N as ContentType$1, O as ControlMessage$1, Q as CustomMetadata$1, V as DbConnection$1, X as DeriveKeyAttestationData, Y as DescriptionMetadata$1, Z as DetokenizeTextParams$1, _ as DirectoryItem$1, $ as DocumentMetadata$1, a0 as EmbeddingSearchResult$1, a1 as EnhancedState$1, a2 as EntityPayload$1, a3 as EvaluationExample$1, a4 as EvaluatorEventPayload$1, a5 as EventDataObject, a6 as EventHandler$1, a7 as EventPayload$1, a8 as EventPayloadMap$1, a9 as EventType$1, aa as FragmentMetadata$1, ab as GenerateTextParams$1, ac as Handler$1, ad as ImageDescriptionParams$1, ae as ImageGenerationParams$1, af as InvokePayload$1, ag as IsValidServiceType$1, ah as JSONSchema$1, ai as KnowledgeItem$1, aj as KnowledgeScope$1, ak as Media$1, al as MemoryRetrievalOptions$1, am as MemoryScope$1, an as MemorySearchOptions$1, ao as MemoryType$1, ap as MemoryTypeAlias$1, aq as MessageExample$1, ar as MessageMemory$1, as as MessageMetadata$1, at as MessagePayload$1, au as MessageReceivedHandlerParams$1, av as MetadataObject, aw as ModelEventPayload$1, ax as ModelHandler$1, ay as ModelType$1, az as MultiRoomMemoryOptions$1, aA as ObjectGenerationParams$1, aB as OnboardingConfig$1, aC as PlatformPrefix$1, aD as PluginEvents$1, aE as Project$1, aF as ProjectAgent$1, aG as ProviderResult$1, aH as RemoteAttestationMessage, aI as RemoteAttestationQuote, aJ as RoomMetadata$1, aK as RunEventPayload$1, aL as SOCKET_MESSAGE_TYPE$1, aM as ServiceClassMap$1, aN as ServiceConfig, aO as ServiceError$1, aP as ServiceInstance$1, aQ as ServiceRegistry$1, aR as ServiceType$1, aS as ServiceTypeRegistry$1, aT as ServiceTypeValue$1, aU as Setting$1, aV as StateArray$1, aW as StateObject$1, aX as StateValue$1, aY as TEEMode, aZ as TaskMetadata$1, a_ as TeeAgent, a$ as TeePluginConfig, b0 as TeeType, b1 as TeeVendorConfig, b2 as TestCase$1, b3 as TestSuite$1, b4 as TextEmbeddingParams$1, b5 as TextGenerationParams$1, b6 as TextToSpeechParams$1, b7 as TokenizeTextParams$1, b8 as TranscriptionParams$1, b9 as TypedEventHandler$1, ba as TypedService$1, bb as TypedServiceClass$1, bc as UnifiedMemoryOptions$1, bd as UnifiedSearchOptions$1, be as VECTOR_DIMS$1, bf as Validator$1, bg as VideoProcessingParams$1, bh as WorldPayload$1, bi as WorldSettings$1, bj as asUUID$1, bk as createMessageMemory$1, bl as createServiceError$1, bm as getMemoryText$1, bn as getTypedService$1, bo as isCustomMetadata$1, bp as isDescriptionMetadata$1, bq as isDocumentMemory$1, br as isDocumentMetadata$1, bs as isFragmentMemory$1, bt as isFragmentMetadata$1, bu as isMessageMetadata$1 } from './types-
|
|
1
|
+
import { a as Action$1, I as IDatabaseAdapter$1, U as UUID$1, E as Entity$1, b as Component$1, M as Memory$1, L as Log$1, c as MemoryMetadata$1, W as World$1, R as Room$1, d as Participant$1, e as Relationship$1, f as Agent$1, T as Task$1, g as IAgentRuntime$1, h as Role$1, i as ServiceTypeName$1, j as Service$1, k as Route$1, l as Character$1, P as Provider$1, m as Evaluator$1, n as Plugin$1, o as RuntimeSettings$1, S as State$1, H as HandlerCallback$1, p as ModelTypeName$1, q as ModelResultMap$1, r as ModelParamsMap$1, s as TaskWorker$1, t as SendHandlerFunction$1, u as TargetInfo$1, C as Content$1, v as TemplateType$1, w as ActionEventPayload$1, A as ActionExample$1, x as AgentStatus$1, y as AudioProcessingParams$1, B as BaseMetadata$1, z as BaseModelParams$1, D as CacheKeyPrefix$1, F as ChannelClearedPayload$1, G as ChannelType$1, J as ChunkRow$1, K as ComponentData, N as ContentType$1, O as ControlMessage$1, Q as CustomMetadata$1, V as DbConnection$1, X as DeriveKeyAttestationData, Y as DescriptionMetadata$1, Z as DetokenizeTextParams$1, _ as DirectoryItem$1, $ as DocumentMetadata$1, a0 as EmbeddingSearchResult$1, a1 as EnhancedState$1, a2 as EntityPayload$1, a3 as EvaluationExample$1, a4 as EvaluatorEventPayload$1, a5 as EventDataObject, a6 as EventHandler$1, a7 as EventPayload$1, a8 as EventPayloadMap$1, a9 as EventType$1, aa as FragmentMetadata$1, ab as GenerateTextParams$1, ac as Handler$1, ad as ImageDescriptionParams$1, ae as ImageGenerationParams$1, af as InvokePayload$1, ag as IsValidServiceType$1, ah as JSONSchema$1, ai as KnowledgeItem$1, aj as KnowledgeScope$1, ak as Media$1, al as MemoryRetrievalOptions$1, am as MemoryScope$1, an as MemorySearchOptions$1, ao as MemoryType$1, ap as MemoryTypeAlias$1, aq as MessageExample$1, ar as MessageMemory$1, as as MessageMetadata$1, at as MessagePayload$1, au as MessageReceivedHandlerParams$1, av as MetadataObject, aw as ModelEventPayload$1, ax as ModelHandler$1, ay as ModelType$1, az as MultiRoomMemoryOptions$1, aA as ObjectGenerationParams$1, aB as OnboardingConfig$1, aC as PlatformPrefix$1, aD as PluginEvents$1, aE as Project$1, aF as ProjectAgent$1, aG as ProviderResult$1, aH as RemoteAttestationMessage, aI as RemoteAttestationQuote, aJ as RoomMetadata$1, aK as RunEventPayload$1, aL as SOCKET_MESSAGE_TYPE$1, aM as ServiceClassMap$1, aN as ServiceConfig, aO as ServiceError$1, aP as ServiceInstance$1, aQ as ServiceRegistry$1, aR as ServiceType$1, aS as ServiceTypeRegistry$1, aT as ServiceTypeValue$1, aU as Setting$1, aV as StateArray$1, aW as StateObject$1, aX as StateValue$1, aY as TEEMode, aZ as TaskMetadata$1, a_ as TeeAgent, a$ as TeePluginConfig, b0 as TeeType, b1 as TeeVendorConfig, b2 as TestCase$1, b3 as TestSuite$1, b4 as TextEmbeddingParams$1, b5 as TextGenerationParams$1, b6 as TextToSpeechParams$1, b7 as TokenizeTextParams$1, b8 as TranscriptionParams$1, b9 as TypedEventHandler$1, ba as TypedService$1, bb as TypedServiceClass$1, bc as UnifiedMemoryOptions$1, bd as UnifiedSearchOptions$1, be as VECTOR_DIMS$1, bf as Validator$1, bg as VideoProcessingParams$1, bh as WorldPayload$1, bi as WorldSettings$1, bj as asUUID$1, bk as createMessageMemory$1, bl as createServiceError$1, bm as getMemoryText$1, bn as getTypedService$1, bo as isCustomMetadata$1, bp as isDescriptionMetadata$1, bq as isDocumentMemory$1, br as isDocumentMetadata$1, bs as isFragmentMemory$1, bt as isFragmentMetadata$1, bu as isMessageMetadata$1 } from './types-DIUaglro.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Defines a custom type UUID representing a universally unique identifier
|
|
@@ -664,7 +664,7 @@ interface IDatabaseAdapter {
|
|
|
664
664
|
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
665
665
|
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
666
666
|
/** Get entity by IDs */
|
|
667
|
-
|
|
667
|
+
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
668
668
|
/** Get entities for room */
|
|
669
669
|
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
670
670
|
/** Create new entities */
|
|
@@ -1412,10 +1412,7 @@ interface ServiceTypeRegistry {
|
|
|
1412
1412
|
WALLET: 'wallet';
|
|
1413
1413
|
LP_POOL: 'lp_pool';
|
|
1414
1414
|
TOKEN_DATA: 'token_data';
|
|
1415
|
-
|
|
1416
|
-
PLUGIN_MANAGER: 'PLUGIN_MANAGER';
|
|
1417
|
-
PLUGIN_CONFIGURATION: 'PLUGIN_CONFIGURATION';
|
|
1418
|
-
PLUGIN_USER_INTERACTION: 'PLUGIN_USER_INTERACTION';
|
|
1415
|
+
UNKNOWN: 'unknown';
|
|
1419
1416
|
}
|
|
1420
1417
|
/**
|
|
1421
1418
|
* Type for service names that includes both core services and any plugin-registered services
|
|
@@ -1471,10 +1468,7 @@ declare const ServiceType: {
|
|
|
1471
1468
|
readonly WALLET: "wallet";
|
|
1472
1469
|
readonly LP_POOL: "lp_pool";
|
|
1473
1470
|
readonly TOKEN_DATA: "token_data";
|
|
1474
|
-
readonly
|
|
1475
|
-
readonly PLUGIN_MANAGER: "PLUGIN_MANAGER";
|
|
1476
|
-
readonly PLUGIN_CONFIGURATION: "PLUGIN_CONFIGURATION";
|
|
1477
|
-
readonly PLUGIN_USER_INTERACTION: "PLUGIN_USER_INTERACTION";
|
|
1471
|
+
readonly UNKNOWN: "unknown";
|
|
1478
1472
|
};
|
|
1479
1473
|
/**
|
|
1480
1474
|
* Client instance
|
|
@@ -1712,7 +1706,7 @@ type HandlerCallback = (response: Content, files?: any) => Promise<Memory[]>;
|
|
|
1712
1706
|
*/
|
|
1713
1707
|
type Handler = (runtime: IAgentRuntime, message: Memory, state?: State, options?: {
|
|
1714
1708
|
[key: string]: unknown;
|
|
1715
|
-
}, callback?: HandlerCallback, responses?: Memory[]) => Promise<
|
|
1709
|
+
}, callback?: HandlerCallback, responses?: Memory[]) => Promise<ActionResult | void | undefined>;
|
|
1716
1710
|
/**
|
|
1717
1711
|
* Validator function type for actions/evaluators
|
|
1718
1712
|
*/
|
|
@@ -1794,6 +1788,48 @@ interface Provider {
|
|
|
1794
1788
|
/** Data retrieval function */
|
|
1795
1789
|
get: (runtime: IAgentRuntime, message: Memory, state: State) => Promise<ProviderResult>;
|
|
1796
1790
|
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Result of executing an action
|
|
1793
|
+
*/
|
|
1794
|
+
interface ActionResult {
|
|
1795
|
+
values?: {
|
|
1796
|
+
[key: string]: any;
|
|
1797
|
+
};
|
|
1798
|
+
data?: {
|
|
1799
|
+
[key: string]: any;
|
|
1800
|
+
};
|
|
1801
|
+
text?: string;
|
|
1802
|
+
}
|
|
1803
|
+
/**
|
|
1804
|
+
* Result returned by an action after execution
|
|
1805
|
+
* Used for action chaining and state management
|
|
1806
|
+
*/
|
|
1807
|
+
interface ActionResult {
|
|
1808
|
+
/** Optional text description of the result */
|
|
1809
|
+
text?: string;
|
|
1810
|
+
/** Values to merge into the state */
|
|
1811
|
+
values?: Record<string, any>;
|
|
1812
|
+
/** Data payload containing action-specific results */
|
|
1813
|
+
data?: Record<string, any>;
|
|
1814
|
+
/** Whether the action succeeded - defaults to true */
|
|
1815
|
+
success: boolean;
|
|
1816
|
+
/** Error information if the action failed */
|
|
1817
|
+
error?: string | Error;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Context provided to actions during execution
|
|
1821
|
+
* Allows actions to access previous results and update state
|
|
1822
|
+
*/
|
|
1823
|
+
interface ActionContext {
|
|
1824
|
+
/** Results from previously executed actions in this run */
|
|
1825
|
+
previousResults: ActionResult[];
|
|
1826
|
+
/** Get a specific previous result by action name */
|
|
1827
|
+
getPreviousResult?: (actionName: string) => ActionResult | undefined;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Helper function to create ActionResult with proper defaults
|
|
1831
|
+
*/
|
|
1832
|
+
declare function createActionResult(partial?: Partial<ActionResult>): ActionResult;
|
|
1797
1833
|
|
|
1798
1834
|
/**
|
|
1799
1835
|
* Interface representing settings with string key-value pairs.
|
|
@@ -1930,7 +1966,7 @@ declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter
|
|
|
1930
1966
|
* @param entityIds The UUIDs of the user account to retrieve.
|
|
1931
1967
|
* @returns A Promise that resolves to the Entity object or null if not found.
|
|
1932
1968
|
*/
|
|
1933
|
-
abstract
|
|
1969
|
+
abstract getEntitiesByIds(entityIds: UUID$1[]): Promise<Entity$1[] | null>;
|
|
1934
1970
|
abstract getEntitiesForRoom(roomId: UUID$1, includeComponents?: boolean): Promise<Entity$1[]>;
|
|
1935
1971
|
/**
|
|
1936
1972
|
* Creates a new entities in the database.
|
|
@@ -2398,7 +2434,7 @@ declare function formatEntities({ entities }: {
|
|
|
2398
2434
|
*/
|
|
2399
2435
|
type LogMethod = (...args: any[]) => void;
|
|
2400
2436
|
declare const logger: Record<'trace' | 'debug' | 'success' | 'progress' | 'log' | 'info' | 'warn' | 'error' | 'fatal' | 'clear', LogMethod>;
|
|
2401
|
-
declare const elizaLogger: Record<"
|
|
2437
|
+
declare const elizaLogger: Record<"success" | "error" | "debug" | "fatal" | "warn" | "info" | "log" | "progress" | "trace" | "clear", LogMethod>;
|
|
2402
2438
|
|
|
2403
2439
|
declare const shouldRespondTemplate: string;
|
|
2404
2440
|
declare const messageHandlerTemplate: string;
|
|
@@ -2595,7 +2631,7 @@ declare class AgentRuntime implements IAgentRuntime$1 {
|
|
|
2595
2631
|
deleteAgent(agentId: UUID$1): Promise<boolean>;
|
|
2596
2632
|
ensureAgentExists(agent: Partial<Agent$1>): Promise<Agent$1>;
|
|
2597
2633
|
getEntityById(entityId: UUID$1): Promise<Entity$1 | null>;
|
|
2598
|
-
|
|
2634
|
+
getEntitiesByIds(entityIds: UUID$1[]): Promise<Entity$1[] | null>;
|
|
2599
2635
|
getEntitiesForRoom(roomId: UUID$1, includeComponents?: boolean): Promise<Entity$1[]>;
|
|
2600
2636
|
createEntity(entity: Entity$1): Promise<boolean>;
|
|
2601
2637
|
createEntities(entities: Entity$1[]): Promise<boolean>;
|
|
@@ -3031,4 +3067,4 @@ declare namespace v2 {
|
|
|
3031
3067
|
export { Action$1 as Action, ActionEventPayload$1 as ActionEventPayload, ActionExample$1 as ActionExample, Agent$1 as Agent, v2_AgentRuntime as AgentRuntime, AgentStatus$1 as AgentStatus, AudioProcessingParams$1 as AudioProcessingParams, BaseMetadata$1 as BaseMetadata, BaseModelParams$1 as BaseModelParams, CacheKeyPrefix$1 as CacheKeyPrefix, ChannelClearedPayload$1 as ChannelClearedPayload, ChannelType$1 as ChannelType, Character$1 as Character, ChunkRow$1 as ChunkRow, Component$1 as Component, v2_ComponentData as ComponentData, Content$1 as Content, ContentType$1 as ContentType, ControlMessage$1 as ControlMessage, CustomMetadata$1 as CustomMetadata, v2_DatabaseAdapter as DatabaseAdapter, DbConnection$1 as DbConnection, v2_DeriveKeyAttestationData as DeriveKeyAttestationData, DescriptionMetadata$1 as DescriptionMetadata, DetokenizeTextParams$1 as DetokenizeTextParams, DirectoryItem$1 as DirectoryItem, DocumentMetadata$1 as DocumentMetadata, EmbeddingSearchResult$1 as EmbeddingSearchResult, EnhancedState$1 as EnhancedState, Entity$1 as Entity, EntityPayload$1 as EntityPayload, EvaluationExample$1 as EvaluationExample, Evaluator$1 as Evaluator, EvaluatorEventPayload$1 as EvaluatorEventPayload, v2_EventDataObject as EventDataObject, EventHandler$1 as EventHandler, EventPayload$1 as EventPayload, EventPayloadMap$1 as EventPayloadMap, EventType$1 as EventType, FragmentMetadata$1 as FragmentMetadata, GenerateTextParams$1 as GenerateTextParams, Handler$1 as Handler, HandlerCallback$1 as HandlerCallback, IAgentRuntime$1 as IAgentRuntime, IDatabaseAdapter$1 as IDatabaseAdapter, ImageDescriptionParams$1 as ImageDescriptionParams, ImageGenerationParams$1 as ImageGenerationParams, InvokePayload$1 as InvokePayload, IsValidServiceType$1 as IsValidServiceType, JSONSchema$1 as JSONSchema, KnowledgeItem$1 as KnowledgeItem, KnowledgeScope$1 as KnowledgeScope, Log$1 as Log, Media$1 as Media, Memory$1 as Memory, MemoryMetadata$1 as MemoryMetadata, MemoryRetrievalOptions$1 as MemoryRetrievalOptions, MemoryScope$1 as MemoryScope, MemorySearchOptions$1 as MemorySearchOptions, MemoryType$1 as MemoryType, MemoryTypeAlias$1 as MemoryTypeAlias, MessageExample$1 as MessageExample, MessageMemory$1 as MessageMemory, MessageMetadata$1 as MessageMetadata, MessagePayload$1 as MessagePayload, MessageReceivedHandlerParams$1 as MessageReceivedHandlerParams, v2_MetadataObject as MetadataObject, ModelEventPayload$1 as ModelEventPayload, ModelHandler$1 as ModelHandler, ModelParamsMap$1 as ModelParamsMap, ModelResultMap$1 as ModelResultMap, ModelType$1 as ModelType, ModelTypeName$1 as ModelTypeName, MultiRoomMemoryOptions$1 as MultiRoomMemoryOptions, ObjectGenerationParams$1 as ObjectGenerationParams, OnboardingConfig$1 as OnboardingConfig, Participant$1 as Participant, PlatformPrefix$1 as PlatformPrefix, Plugin$1 as Plugin, PluginEvents$1 as PluginEvents, Project$1 as Project, ProjectAgent$1 as ProjectAgent, Provider$1 as Provider, ProviderResult$1 as ProviderResult, Relationship$1 as Relationship, v2_RemoteAttestationMessage as RemoteAttestationMessage, v2_RemoteAttestationQuote as RemoteAttestationQuote, Role$1 as Role, Room$1 as Room, RoomMetadata$1 as RoomMetadata, Route$1 as Route, RunEventPayload$1 as RunEventPayload, RuntimeSettings$1 as RuntimeSettings, SOCKET_MESSAGE_TYPE$1 as SOCKET_MESSAGE_TYPE, v2_Semaphore as Semaphore, SendHandlerFunction$1 as SendHandlerFunction, type v2_ServerOwnershipState as ServerOwnershipState, Service$1 as Service, v2_ServiceBuilder as ServiceBuilder, ServiceClassMap$1 as ServiceClassMap, v2_ServiceConfig as ServiceConfig, type v2_ServiceDefinition as ServiceDefinition, ServiceError$1 as ServiceError, ServiceInstance$1 as ServiceInstance, ServiceRegistry$1 as ServiceRegistry, ServiceType$1 as ServiceType, ServiceTypeName$1 as ServiceTypeName, ServiceTypeRegistry$1 as ServiceTypeRegistry, ServiceTypeValue$1 as ServiceTypeValue, Setting$1 as Setting, State$1 as State, StateArray$1 as StateArray, StateObject$1 as StateObject, StateValue$1 as StateValue, v2_TEEMode as TEEMode, TargetInfo$1 as TargetInfo, Task$1 as Task, TaskMetadata$1 as TaskMetadata, TaskWorker$1 as TaskWorker, v2_TeeAgent as TeeAgent, v2_TeePluginConfig as TeePluginConfig, v2_TeeType as TeeType, v2_TeeVendorConfig as TeeVendorConfig, TemplateType$1 as TemplateType, TestCase$1 as TestCase, TestSuite$1 as TestSuite, TextEmbeddingParams$1 as TextEmbeddingParams, TextGenerationParams$1 as TextGenerationParams, TextToSpeechParams$1 as TextToSpeechParams, TokenizeTextParams$1 as TokenizeTextParams, TranscriptionParams$1 as TranscriptionParams, TypedEventHandler$1 as TypedEventHandler, TypedService$1 as TypedService, TypedServiceClass$1 as TypedServiceClass, UUID$1 as UUID, UnifiedMemoryOptions$1 as UnifiedMemoryOptions, UnifiedSearchOptions$1 as UnifiedSearchOptions, VECTOR_DIMS$1 as VECTOR_DIMS, Validator$1 as Validator, VideoProcessingParams$1 as VideoProcessingParams, World$1 as World, WorldPayload$1 as WorldPayload, WorldSettings$1 as WorldSettings, v2_addHeader as addHeader, asUUID$1 as asUUID, v2_booleanFooter as booleanFooter, v2_composeActionExamples as composeActionExamples, v2_composePrompt as composePrompt, v2_composePromptFromState as composePromptFromState, createMessageMemory$1 as createMessageMemory, v2_createService as createService, createServiceError$1 as createServiceError, v2_createSettingFromConfig as createSettingFromConfig, v2_createUniqueUuid as createUniqueUuid, v2_decryptObjectValues as decryptObjectValues, decryptStringValue as decryptSecret, v2_decryptStringValue as decryptStringValue, v2_decryptedCharacter as decryptedCharacter, v2_defineService as defineService, v2_elizaLogger as elizaLogger, v2_encryptObjectValues as encryptObjectValues, v2_encryptStringValue as encryptStringValue, v2_encryptedCharacter as encryptedCharacter, v2_findEntityByName as findEntityByName, v2_findWorldsForOwner as findWorldsForOwner, v2_formatActionNames as formatActionNames, v2_formatActions as formatActions, v2_formatEntities as formatEntities, v2_formatMessages as formatMessages, v2_formatPosts as formatPosts, v2_formatTimestamp as formatTimestamp, v2_getEntityDetails as getEntityDetails, getMemoryText$1 as getMemoryText, v2_getSalt as getSalt, getTypedService$1 as getTypedService, v2_getUserServerRole as getUserServerRole, v2_getWorldSettings as getWorldSettings, v2_imageDescriptionTemplate as imageDescriptionTemplate, v2_initializeOnboarding as initializeOnboarding, isCustomMetadata$1 as isCustomMetadata, isDescriptionMetadata$1 as isDescriptionMetadata, isDocumentMemory$1 as isDocumentMemory, isDocumentMetadata$1 as isDocumentMetadata, isFragmentMemory$1 as isFragmentMemory, isFragmentMetadata$1 as isFragmentMetadata, isMessageMetadata$1 as isMessageMetadata, v2_logger as logger, v2_messageHandlerTemplate as messageHandlerTemplate, v2_parseBooleanFromText as parseBooleanFromText, v2_parseJSONObjectFromText as parseJSONObjectFromText, v2_parseKeyValueXml as parseKeyValueXml, v2_postCreationTemplate as postCreationTemplate, v2_safeReplacer as safeReplacer, v2_saltSettingValue as saltSettingValue, v2_saltWorldSettings as saltWorldSettings, v2_shouldRespondTemplate as shouldRespondTemplate, v2_stringToUuid as stringToUuid, v2_trimTokens as trimTokens, v2_truncateToCompleteSentence as truncateToCompleteSentence, v2_unsaltSettingValue as unsaltSettingValue, v2_unsaltWorldSettings as unsaltWorldSettings, v2_updateWorldSettings as updateWorldSettings, v2_validateUuid as validateUuid };
|
|
3032
3068
|
}
|
|
3033
3069
|
|
|
3034
|
-
export { type FragmentMetadata as $, type Action as A, type WorldSettings as B, ContentType as C, v2 as D, type Entity as E, asUUID as F, type Media as G, type HandlerCallback as H, type IAgentRuntime as I, type StateValue as J, type StateObject as K, type Log as L, type Metadata as M, type StateArray as N, type OnboardingConfig as O, type Participant as P, type EnhancedState as Q, type Room as R, Service as S, type TemplateType as T, type UUID as U, type MemoryTypeAlias as V, type World as W, MemoryType as X, type MemoryScope as Y, type BaseMetadata as Z, type DocumentMetadata as _, type State as a,
|
|
3070
|
+
export { type FragmentMetadata as $, type Action as A, type WorldSettings as B, ContentType as C, v2 as D, type Entity as E, asUUID as F, type Media as G, type HandlerCallback as H, type IAgentRuntime as I, type StateValue as J, type StateObject as K, type Log as L, type Metadata as M, type StateArray as N, type OnboardingConfig as O, type Participant as P, type EnhancedState as Q, type Room as R, Service as S, type TemplateType as T, type UUID as U, type MemoryTypeAlias as V, type World as W, MemoryType as X, type MemoryScope as Y, type BaseMetadata as Z, type DocumentMetadata as _, type State as a, type UnifiedMemoryOptions as a$, type MessageMetadata as a0, type DescriptionMetadata as a1, type CustomMetadata as a2, type MessageMemory as a3, createMessageMemory as a4, isDocumentMetadata as a5, isFragmentMetadata as a6, isMessageMetadata as a7, isDescriptionMetadata as a8, isCustomMetadata as a9, type ServiceClassMap as aA, type ServiceInstance as aB, type ServiceRegistry as aC, ServiceType as aD, type TypedService as aE, getTypedService as aF, type ServiceError as aG, createServiceError as aH, ModelType as aI, type GenerateTextParams as aJ, type DetokenizeTextParams as aK, type BaseModelParams as aL, type TextGenerationParams as aM, type TextEmbeddingParams as aN, type TokenizeTextParams as aO, type ImageGenerationParams as aP, type ImageDescriptionParams as aQ, type TranscriptionParams as aR, type TextToSpeechParams as aS, type AudioProcessingParams as aT, type VideoProcessingParams as aU, type JSONSchema as aV, type ObjectGenerationParams as aW, type EmbeddingSearchResult as aX, type MemoryRetrievalOptions as aY, type MemorySearchOptions as aZ, type MultiRoomMemoryOptions as a_, isDocumentMemory as aa, isFragmentMemory as ab, getMemoryText as ac, type KnowledgeItem as ad, KnowledgeScope as ae, CacheKeyPrefix as af, type DirectoryItem as ag, type ChunkRow as ah, type RoomMetadata as ai, type MessageExample as aj, AgentStatus as ak, type ActionExample as al, type Handler as am, type Validator as an, type ActionResult as ao, type EvaluationExample as ap, type ProviderResult as aq, type ActionContext as ar, createActionResult as as, type PluginEvents as at, type ProjectAgent as au, type Project as av, type ServiceTypeRegistry as aw, type ServiceTypeValue as ax, type IsValidServiceType as ay, type TypedServiceClass as az, type Memory as b, composePrompt as b$, type UnifiedSearchOptions as b0, type DbConnection as b1, VECTOR_DIMS as b2, EventType as b3, PlatformPrefix as b4, type EventPayload as b5, type WorldPayload as b6, type EntityPayload as b7, type MessagePayload as b8, type ChannelClearedPayload as b9, logger as bA, elizaLogger as bB, shouldRespondTemplate as bC, messageHandlerTemplate as bD, postCreationTemplate as bE, booleanFooter as bF, imageDescriptionTemplate as bG, type ServerOwnershipState as bH, getUserServerRole as bI, findWorldsForOwner as bJ, Semaphore as bK, AgentRuntime as bL, decryptStringValue as bM, createSettingFromConfig as bN, getSalt as bO, encryptStringValue as bP, saltSettingValue as bQ, unsaltSettingValue as bR, saltWorldSettings as bS, unsaltWorldSettings as bT, updateWorldSettings as bU, getWorldSettings as bV, initializeOnboarding as bW, encryptedCharacter as bX, decryptedCharacter as bY, encryptObjectValues as bZ, decryptObjectValues as b_, type InvokePayload as ba, type RunEventPayload as bb, type ActionEventPayload as bc, type EvaluatorEventPayload as bd, type ModelEventPayload as be, type MessageReceivedHandlerParams as bf, type EventPayloadMap as bg, type EventHandler as bh, type TypedEventHandler as bi, type TaskMetadata as bj, SOCKET_MESSAGE_TYPE as bk, type ControlMessage as bl, type TestCase as bm, type TestSuite as bn, ServiceBuilder$1 as bo, createService$1 as bp, type ServiceDefinition$1 as bq, defineService$1 as br, composeActionExamples as bs, formatActionNames as bt, formatActions as bu, DatabaseAdapter as bv, findEntityByName as bw, createUniqueUuid as bx, getEntityDetails as by, formatEntities as bz, type Character as c, composePromptFromState as c0, addHeader as c1, formatPosts as c2, formatMessages as c3, formatTimestamp as c4, validateUuid as c5, stringToUuid as c6, truncateToCompleteSentence as c7, parseKeyValueXml as c8, parseJSONObjectFromText as c9, parseBooleanFromText as ca, safeReplacer as cb, trimTokens as cc, ServiceBuilder as cd, createService as ce, type ServiceDefinition as cf, defineService as cg, type IDatabaseAdapter as d, type Component as e, type MemoryMetadata as f, type Relationship as g, type Agent as h, type Task as i, Role as j, type Evaluator as k, type Provider as l, type Plugin as m, type ServiceTypeName as n, type ModelHandler as o, type Route as p, type RuntimeSettings as q, ChannelType as r, type ModelTypeName as s, type ModelResultMap as t, type ModelParamsMap as u, type TaskWorker as v, type SendHandlerFunction as w, type TargetInfo as x, type Content as y, type Setting as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { M as Metadata, S as Service, T as TemplateType, a as State, b as Memory, E as Entity, I as IAgentRuntime, U as UUID, C as ContentType, c as Character, A as Action, d as IDatabaseAdapter, e as Component, L as Log, f as MemoryMetadata, W as World, R as Room, P as Participant, g as Relationship, h as Agent, i as Task, j as Role, k as Evaluator, l as Provider, m as Plugin, n as ServiceTypeName, o as ModelHandler, p as Route, q as RuntimeSettings, H as HandlerCallback, r as ChannelType, s as ModelTypeName, t as ModelResultMap, u as ModelParamsMap, v as TaskWorker, w as SendHandlerFunction, x as TargetInfo, y as Content, z as Setting, B as WorldSettings, O as OnboardingConfig, D as v2 } from './index-
|
|
2
|
-
export {
|
|
1
|
+
import { M as Metadata, S as Service, T as TemplateType, a as State, b as Memory, E as Entity, I as IAgentRuntime, U as UUID, C as ContentType, c as Character, A as Action, d as IDatabaseAdapter, e as Component, L as Log, f as MemoryMetadata, W as World, R as Room, P as Participant, g as Relationship, h as Agent, i as Task, j as Role, k as Evaluator, l as Provider, m as Plugin, n as ServiceTypeName, o as ModelHandler, p as Route, q as RuntimeSettings, H as HandlerCallback, r as ChannelType, s as ModelTypeName, t as ModelResultMap, u as ModelParamsMap, v as TaskWorker, w as SendHandlerFunction, x as TargetInfo, y as Content, z as Setting, B as WorldSettings, O as OnboardingConfig, D as v2 } from './index-DOpqCUJl.js';
|
|
2
|
+
export { ar as ActionContext, bc as ActionEventPayload, al as ActionExample, ao as ActionResult, ak as AgentStatus, aT as AudioProcessingParams, Z as BaseMetadata, aL as BaseModelParams, af as CacheKeyPrefix, b9 as ChannelClearedPayload, ah as ChunkRow, bl as ControlMessage, a2 as CustomMetadata, b1 as DbConnection, a1 as DescriptionMetadata, aK as DetokenizeTextParams, ag as DirectoryItem, _ as DocumentMetadata, aX as EmbeddingSearchResult, Q as EnhancedState, b7 as EntityPayload, ap as EvaluationExample, bd as EvaluatorEventPayload, bh as EventHandler, b5 as EventPayload, bg as EventPayloadMap, b3 as EventType, $ as FragmentMetadata, aJ as GenerateTextParams, am as Handler, aQ as ImageDescriptionParams, aP as ImageGenerationParams, ba as InvokePayload, ay as IsValidServiceType, aV as JSONSchema, ad as KnowledgeItem, ae as KnowledgeScope, G as Media, aY as MemoryRetrievalOptions, Y as MemoryScope, aZ as MemorySearchOptions, X as MemoryType, V as MemoryTypeAlias, aj as MessageExample, a3 as MessageMemory, a0 as MessageMetadata, b8 as MessagePayload, bf as MessageReceivedHandlerParams, be as ModelEventPayload, aI as ModelType, a_ as MultiRoomMemoryOptions, aW as ObjectGenerationParams, b4 as PlatformPrefix, at as PluginEvents, av as Project, au as ProjectAgent, aq as ProviderResult, ai as RoomMetadata, bb as RunEventPayload, bk as SOCKET_MESSAGE_TYPE, bo as ServiceBuilder, aA as ServiceClassMap, bq as ServiceDefinition, aG as ServiceError, aB as ServiceInstance, aC as ServiceRegistry, aD as ServiceType, aw as ServiceTypeRegistry, ax as ServiceTypeValue, N as StateArray, K as StateObject, J as StateValue, bj as TaskMetadata, bm as TestCase, bn as TestSuite, aN as TextEmbeddingParams, aM as TextGenerationParams, aS as TextToSpeechParams, aO as TokenizeTextParams, aR as TranscriptionParams, bi as TypedEventHandler, aE as TypedService, az as TypedServiceClass, a$ as UnifiedMemoryOptions, b0 as UnifiedSearchOptions, b2 as VECTOR_DIMS, an as Validator, aU as VideoProcessingParams, b6 as WorldPayload, F as asUUID, as as createActionResult, a4 as createMessageMemory, bp as createService, aH as createServiceError, br as defineService, ac as getMemoryText, aF as getTypedService, a9 as isCustomMetadata, a8 as isDescriptionMetadata, aa as isDocumentMemory, a5 as isDocumentMetadata, ab as isFragmentMemory, a6 as isFragmentMetadata, a7 as isMessageMetadata } from './index-DOpqCUJl.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as pino from 'pino';
|
|
5
5
|
import * as browser from '@sentry/browser';
|
|
6
6
|
export { browser as Sentry };
|
|
7
7
|
export { i as v1 } from './index-BHW44X0A.js';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-DIUaglro.js';
|
|
9
9
|
import './specs/v1/messages.js';
|
|
10
10
|
import './specs/v1/types.js';
|
|
11
11
|
import 'stream';
|
|
@@ -814,7 +814,7 @@ declare abstract class DatabaseAdapter<DB = unknown> implements IDatabaseAdapter
|
|
|
814
814
|
* @param entityIds The UUIDs of the user account to retrieve.
|
|
815
815
|
* @returns A Promise that resolves to the Entity object or null if not found.
|
|
816
816
|
*/
|
|
817
|
-
abstract
|
|
817
|
+
abstract getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
818
818
|
abstract getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
819
819
|
/**
|
|
820
820
|
* Creates a new entities in the database.
|
|
@@ -1296,8 +1296,8 @@ declare let logger: pino.Logger<string, boolean>;
|
|
|
1296
1296
|
declare const elizaLogger: pino.Logger<string, boolean>;
|
|
1297
1297
|
|
|
1298
1298
|
declare const shouldRespondTemplate = "<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>\n\n<providers>\n{{providers}}\n</providers>\n\n<instructions>Decide if {{agentName}} should respond to or interact with the conversation.\nIf the message is directed at or relevant to {{agentName}}, respond with RESPOND action.\nIf a user asks {{agentName}} to be quiet, respond with STOP action.\nIf {{agentName}} should ignore the message, respond with IGNORE action.</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <name>{{agentName}}</name>\n <reasoning>Your reasoning here</reasoning>\n <action>RESPOND | IGNORE | STOP</action>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
1299
|
-
declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\nThese are the available valid actions:\n<actionNames>\n{{actionNames}}\n</actionNames>\n\n<instructions>\nWrite a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\n\nIMPORTANT ACTION ORDERING RULES:\n- Actions are executed in the ORDER you list them - the order MATTERS!\n- REPLY should come FIRST to acknowledge the user's request before executing other actions\n- Common patterns:\n - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)\n - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)\n - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)\n- REPLY is used to acknowledge and inform the user about what you're going to do\n- Follow-up actions execute the actual tasks after acknowledgment\n- Use IGNORE only when you should not respond at all\n\nIMPORTANT PROVIDER SELECTION RULES:\n- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see \"(Attachments:\" in the conversation, you MUST include \"ATTACHMENTS\" in your providers list\n- If the message asks about or references specific people, include \"ENTITIES\" in your providers list \n- If the message asks about relationships or connections between people, include \"RELATIONSHIPS\" in your providers list\n- If the message asks about facts or specific information, include \"FACTS\" in your providers list\n- If the message asks about the environment or world context, include \"WORLD\" in your providers list\n- If you
|
|
1300
|
-
declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n<response>\n <thought>I am thinking about writing a post about the importance of AI in our lives</thought>\n <post>AI is changing the world and it is important to understand how it works</post>\n <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>\n</response>\n\n2. A post about dogs\n<response>\n <thought>I am thinking about writing a post about dogs</thought>\n <post>Dogs are man's best friend and they are loyal and loving</post>\n <imagePrompt>A dog playing with a ball in a park</imagePrompt>\n</response>\n\n3. A post about finding a new job\n<response>\n <thought>Getting a job is hard, I bet there's a good tweet in that</thought>\n <post>Just keep going!</post>\n <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>\n</response>\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in XML like this:\n<response>\n <thought>Your thought here</thought>\n <post>Your post text here</post>\n <imagePrompt>Optional image prompt here</imagePrompt>\n</response>\n\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding,
|
|
1299
|
+
declare const messageHandlerTemplate = "<task>Generate dialog and actions for the character {{agentName}}.</task>\n\n<providers>\n{{providers}}\n</providers>\n\nThese are the available valid actions:\n<actionNames>\n{{actionNames}}\n</actionNames>\n\n<instructions>\nWrite a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.\n\nIMPORTANT ACTION ORDERING RULES:\n- Actions are executed in the ORDER you list them - the order MATTERS!\n- REPLY should come FIRST to acknowledge the user's request before executing other actions\n- Common patterns:\n - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)\n - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)\n - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)\n- REPLY is used to acknowledge and inform the user about what you're going to do\n- Follow-up actions execute the actual tasks after acknowledgment\n- Use IGNORE only when you should not respond at all\n- If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.\n\nIMPORTANT PROVIDER SELECTION RULES:\n- Only include providers if they are needed to respond accurately.\n- If the message mentions images, photos, pictures, attachments, or visual content, OR if you see \"(Attachments:\" in the conversation, you MUST include \"ATTACHMENTS\" in your providers list\n- If the message asks about or references specific people, include \"ENTITIES\" in your providers list \n- If the message asks about relationships or connections between people, include \"RELATIONSHIPS\" in your providers list\n- If the message asks about facts or specific information, include \"FACTS\" in your providers list\n- If the message asks about the environment or world context, include \"WORLD\" in your providers list\n- If no additional context is needed, you may leave the providers list empty.\n\nIMPORTANT CODE BLOCK FORMATTING RULES:\n- If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with ``` fenced code blocks (specify the language if known, e.g., ```python).\n- ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.\n- If including inline code (short single words or function names), use single backticks (`) as appropriate.\n- This ensures the user sees clearly formatted and copyable code when relevant.\n\nFirst, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.\n</instructions>\n\n<keys>\n\"thought\" should be a short description of what the agent is thinking about and planning.\n\"actions\" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought, IN THE ORDER THEY SHOULD BE EXECUTED (if none, use IGNORE, if simply responding with text, use REPLY)\n\"providers\" should be a comma-separated list of the providers that {{agentName}} will use to have the right context for responding and acting (NEVER use \"IGNORE\" as a provider - use specific provider names like ATTACHMENTS, ENTITIES, FACTS, KNOWLEDGE, etc.)\n\"text\" should be the text of the next message for {{agentName}} which they will send to the conversation.\n</keys>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <thought>Your thought here</thought>\n <actions>ACTION1,ACTION2</actions>\n <providers>PROVIDER1,PROVIDER2</providers>\n <text>Your response text here</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
1300
|
+
declare const postCreationTemplate = "# Task: Create a post in the voice and style and perspective of {{agentName}} @{{twitterUserName}}.\n\nExample task outputs:\n1. A post about the importance of AI in our lives\n<response>\n <thought>I am thinking about writing a post about the importance of AI in our lives</thought>\n <post>AI is changing the world and it is important to understand how it works</post>\n <imagePrompt>A futuristic cityscape with flying cars and people using AI to do things</imagePrompt>\n</response>\n\n2. A post about dogs\n<response>\n <thought>I am thinking about writing a post about dogs</thought>\n <post>Dogs are man's best friend and they are loyal and loving</post>\n <imagePrompt>A dog playing with a ball in a park</imagePrompt>\n</response>\n\n3. A post about finding a new job\n<response>\n <thought>Getting a job is hard, I bet there's a good tweet in that</thought>\n <post>Just keep going!</post>\n <imagePrompt>A person looking at a computer screen with a job search website</imagePrompt>\n</response>\n\n{{providers}}\n\nWrite a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.\nYour response should be 1, 2, or 3 sentences (choose the length at random).\nYour response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.\n\nYour output should be formatted in XML like this:\n<response>\n <thought>Your thought here</thought>\n <post>Your post text here</post>\n <imagePrompt>Optional image prompt here</imagePrompt>\n</response>\n\nThe \"post\" field should be the post you want to send. Do not including any thinking or internal reflection in the \"post\" field.\nThe \"imagePrompt\" field is optional and should be a prompt for an image that is relevant to the post. It should be a single sentence that captures the essence of the post. ONLY USE THIS FIELD if it makes sense that the post would benefit from an image.\nThe \"thought\" field should be a short description of what the agent is thinking about before responding, including a brief justification for the response. Includate an explanation how the post is relevant to the topic but unique and different than other posts.\n\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.";
|
|
1301
1301
|
declare const booleanFooter = "Respond with only a YES or a NO.";
|
|
1302
1302
|
declare const imageDescriptionTemplate = "<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>\n\n<instructions>\nCarefully examine the image and provide:\n1. A concise, descriptive title that captures the main subject or scene\n2. A brief summary description (1-2 sentences) highlighting the key elements\n3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details\n\nBe objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.\n</instructions>\n\n<output>\nDo NOT include any thinking, reasoning, or <think> sections in your response. \nGo directly to the XML response format without any preamble or explanation.\n\nRespond using XML format like this:\n<response>\n <title>A concise, descriptive title for the image</title>\n <description>A brief 1-2 sentence summary of the key elements in the image</description>\n <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>\n</response>\n\nIMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.\n</output>";
|
|
1303
1303
|
|
|
@@ -1372,6 +1372,7 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
1372
1372
|
private servicesInitQueue;
|
|
1373
1373
|
private currentRunId?;
|
|
1374
1374
|
private currentActionContext?;
|
|
1375
|
+
private maxWorkingMemoryEntries;
|
|
1375
1376
|
constructor(opts: {
|
|
1376
1377
|
conversationLength?: number;
|
|
1377
1378
|
agentId?: UUID;
|
|
@@ -1414,6 +1415,8 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
1414
1415
|
registerProvider(provider: Provider): void;
|
|
1415
1416
|
registerAction(action: Action): void;
|
|
1416
1417
|
registerEvaluator(evaluator: Evaluator): void;
|
|
1418
|
+
private updateActionPlan;
|
|
1419
|
+
private updateActionStep;
|
|
1417
1420
|
processActions(message: Memory, responses: Memory[], state?: State, callback?: HandlerCallback): Promise<void>;
|
|
1418
1421
|
evaluate(message: Memory, state: State, didRespond?: boolean, callback?: HandlerCallback, responses?: Memory[]): Promise<Evaluator[]>;
|
|
1419
1422
|
ensureConnections(entities: any, rooms: any, source: any, world: any): Promise<void>;
|
|
@@ -1482,7 +1485,7 @@ declare class AgentRuntime implements IAgentRuntime {
|
|
|
1482
1485
|
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
1483
1486
|
ensureAgentExists(agent: Partial<Agent>): Promise<Agent>;
|
|
1484
1487
|
getEntityById(entityId: UUID): Promise<Entity | null>;
|
|
1485
|
-
|
|
1488
|
+
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
1486
1489
|
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
1487
1490
|
createEntity(entity: Entity): Promise<boolean>;
|
|
1488
1491
|
createEntities(entities: Entity[]): Promise<boolean>;
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
composeActionExamples,
|
|
31
31
|
composePrompt,
|
|
32
32
|
composePromptFromState,
|
|
33
|
+
createActionResult,
|
|
33
34
|
createLogger,
|
|
34
35
|
createMessageMemory,
|
|
35
36
|
createService,
|
|
@@ -94,7 +95,7 @@ import {
|
|
|
94
95
|
v2_exports,
|
|
95
96
|
validateCharacter,
|
|
96
97
|
validateUuid
|
|
97
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-WLUL3JMY.js";
|
|
98
99
|
import "./chunk-2HSL25IJ.js";
|
|
99
100
|
import "./chunk-WO7Z3GE6.js";
|
|
100
101
|
import "./chunk-U2ADTLZY.js";
|
|
@@ -133,6 +134,7 @@ export {
|
|
|
133
134
|
composeActionExamples,
|
|
134
135
|
composePrompt,
|
|
135
136
|
composePromptFromState,
|
|
137
|
+
createActionResult,
|
|
136
138
|
createLogger,
|
|
137
139
|
createMessageMemory,
|
|
138
140
|
createService,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ActionExample as ActionExample$2, Content as Content$1 } from './types.js';
|
|
2
|
-
import { A as ActionExample$1, C as Content } from '../../types-
|
|
2
|
+
import { A as ActionExample$1, C as Content } from '../../types-DIUaglro.js';
|
|
3
3
|
import 'stream';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/specs/v1/index.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ export { ActionExample, convertContentToV1, convertContentToV2, fromV2ActionExam
|
|
|
8
8
|
export { Provider, fromV2Provider, toV2Provider } from './provider.js';
|
|
9
9
|
export { TemplateType, createTemplateFunction, getTemplateValues, processTemplate } from './templates.js';
|
|
10
10
|
import 'stream';
|
|
11
|
-
import '../../types-
|
|
11
|
+
import '../../types-DIUaglro.js';
|
package/dist/specs/v1/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
formatMessages3 as formatMessages,
|
|
4
4
|
formatTimestamp3 as formatTimestamp,
|
|
5
5
|
getActorDetails
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-WLUL3JMY.js";
|
|
7
7
|
import "../../chunk-2HSL25IJ.js";
|
|
8
8
|
import "../../chunk-WO7Z3GE6.js";
|
|
9
9
|
import "../../chunk-U2ADTLZY.js";
|
package/dist/specs/v1/posts.js
CHANGED
package/dist/specs/v1/runtime.js
CHANGED
package/dist/specs/v1/state.d.ts
CHANGED
package/dist/specs/v1/uuid.js
CHANGED
package/dist/specs/v2/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { a as Action, w as ActionEventPayload, A as ActionExample, f as Agent, x as AgentStatus, y as AudioProcessingParams, B as BaseMetadata, z as BaseModelParams, D as CacheKeyPrefix, F as ChannelClearedPayload, G as ChannelType, l as Character, J as ChunkRow, b as Component, K as ComponentData, C as Content, N as ContentType, O as ControlMessage, Q as CustomMetadata, V as DbConnection, X as DeriveKeyAttestationData, Y as DescriptionMetadata, Z as DetokenizeTextParams, _ as DirectoryItem, $ as DocumentMetadata, a0 as EmbeddingSearchResult, a1 as EnhancedState, E as Entity, a2 as EntityPayload, a3 as EvaluationExample, m as Evaluator, a4 as EvaluatorEventPayload, a5 as EventDataObject, a6 as EventHandler, a7 as EventPayload, a8 as EventPayloadMap, a9 as EventType, aa as FragmentMetadata, ab as GenerateTextParams, ac as Handler, H as HandlerCallback, g as IAgentRuntime, I as IDatabaseAdapter, ad as ImageDescriptionParams, ae as ImageGenerationParams, af as InvokePayload, ag as IsValidServiceType, ah as JSONSchema, ai as KnowledgeItem, aj as KnowledgeScope, L as Log, ak as Media, M as Memory, c as MemoryMetadata, al as MemoryRetrievalOptions, am as MemoryScope, an as MemorySearchOptions, ao as MemoryType, ap as MemoryTypeAlias, aq as MessageExample, ar as MessageMemory, as as MessageMetadata, at as MessagePayload, au as MessageReceivedHandlerParams, av as MetadataObject, aw as ModelEventPayload, ax as ModelHandler, r as ModelParamsMap, q as ModelResultMap, ay as ModelType, p as ModelTypeName, az as MultiRoomMemoryOptions, aA as ObjectGenerationParams, aB as OnboardingConfig, d as Participant, aC as PlatformPrefix, n as Plugin, aD as PluginEvents, aE as Project, aF as ProjectAgent, P as Provider, aG as ProviderResult, e as Relationship, aH as RemoteAttestationMessage, aI as RemoteAttestationQuote, h as Role, R as Room, aJ as RoomMetadata, k as Route, aK as RunEventPayload, o as RuntimeSettings, aL as SOCKET_MESSAGE_TYPE, t as SendHandlerFunction, j as Service, aM as ServiceClassMap, aN as ServiceConfig, aO as ServiceError, aP as ServiceInstance, aQ as ServiceRegistry, aR as ServiceType, i as ServiceTypeName, aS as ServiceTypeRegistry, aT as ServiceTypeValue, aU as Setting, S as State, aV as StateArray, aW as StateObject, aX as StateValue, aY as TEEMode, u as TargetInfo, T as Task, aZ as TaskMetadata, s as TaskWorker, a_ as TeeAgent, a$ as TeePluginConfig, b0 as TeeType, b1 as TeeVendorConfig, v as TemplateType, b2 as TestCase, b3 as TestSuite, b4 as TextEmbeddingParams, b5 as TextGenerationParams, b6 as TextToSpeechParams, b7 as TokenizeTextParams, b8 as TranscriptionParams, b9 as TypedEventHandler, ba as TypedService, bb as TypedServiceClass, U as UUID, bc as UnifiedMemoryOptions, bd as UnifiedSearchOptions, be as VECTOR_DIMS, bf as Validator, bg as VideoProcessingParams, W as World, bh as WorldPayload, bi as WorldSettings, bj as asUUID, bk as createMessageMemory, bl as createServiceError, bm as getMemoryText, bn as getTypedService, bo as isCustomMetadata, bp as isDescriptionMetadata, bq as isDocumentMemory, br as isDocumentMetadata, bs as isFragmentMemory, bt as isFragmentMetadata, bu as isMessageMetadata } from '../../types-
|
|
2
|
-
export {
|
|
1
|
+
export { a as Action, w as ActionEventPayload, A as ActionExample, f as Agent, x as AgentStatus, y as AudioProcessingParams, B as BaseMetadata, z as BaseModelParams, D as CacheKeyPrefix, F as ChannelClearedPayload, G as ChannelType, l as Character, J as ChunkRow, b as Component, K as ComponentData, C as Content, N as ContentType, O as ControlMessage, Q as CustomMetadata, V as DbConnection, X as DeriveKeyAttestationData, Y as DescriptionMetadata, Z as DetokenizeTextParams, _ as DirectoryItem, $ as DocumentMetadata, a0 as EmbeddingSearchResult, a1 as EnhancedState, E as Entity, a2 as EntityPayload, a3 as EvaluationExample, m as Evaluator, a4 as EvaluatorEventPayload, a5 as EventDataObject, a6 as EventHandler, a7 as EventPayload, a8 as EventPayloadMap, a9 as EventType, aa as FragmentMetadata, ab as GenerateTextParams, ac as Handler, H as HandlerCallback, g as IAgentRuntime, I as IDatabaseAdapter, ad as ImageDescriptionParams, ae as ImageGenerationParams, af as InvokePayload, ag as IsValidServiceType, ah as JSONSchema, ai as KnowledgeItem, aj as KnowledgeScope, L as Log, ak as Media, M as Memory, c as MemoryMetadata, al as MemoryRetrievalOptions, am as MemoryScope, an as MemorySearchOptions, ao as MemoryType, ap as MemoryTypeAlias, aq as MessageExample, ar as MessageMemory, as as MessageMetadata, at as MessagePayload, au as MessageReceivedHandlerParams, av as MetadataObject, aw as ModelEventPayload, ax as ModelHandler, r as ModelParamsMap, q as ModelResultMap, ay as ModelType, p as ModelTypeName, az as MultiRoomMemoryOptions, aA as ObjectGenerationParams, aB as OnboardingConfig, d as Participant, aC as PlatformPrefix, n as Plugin, aD as PluginEvents, aE as Project, aF as ProjectAgent, P as Provider, aG as ProviderResult, e as Relationship, aH as RemoteAttestationMessage, aI as RemoteAttestationQuote, h as Role, R as Room, aJ as RoomMetadata, k as Route, aK as RunEventPayload, o as RuntimeSettings, aL as SOCKET_MESSAGE_TYPE, t as SendHandlerFunction, j as Service, aM as ServiceClassMap, aN as ServiceConfig, aO as ServiceError, aP as ServiceInstance, aQ as ServiceRegistry, aR as ServiceType, i as ServiceTypeName, aS as ServiceTypeRegistry, aT as ServiceTypeValue, aU as Setting, S as State, aV as StateArray, aW as StateObject, aX as StateValue, aY as TEEMode, u as TargetInfo, T as Task, aZ as TaskMetadata, s as TaskWorker, a_ as TeeAgent, a$ as TeePluginConfig, b0 as TeeType, b1 as TeeVendorConfig, v as TemplateType, b2 as TestCase, b3 as TestSuite, b4 as TextEmbeddingParams, b5 as TextGenerationParams, b6 as TextToSpeechParams, b7 as TokenizeTextParams, b8 as TranscriptionParams, b9 as TypedEventHandler, ba as TypedService, bb as TypedServiceClass, U as UUID, bc as UnifiedMemoryOptions, bd as UnifiedSearchOptions, be as VECTOR_DIMS, bf as Validator, bg as VideoProcessingParams, W as World, bh as WorldPayload, bi as WorldSettings, bj as asUUID, bk as createMessageMemory, bl as createServiceError, bm as getMemoryText, bn as getTypedService, bo as isCustomMetadata, bp as isDescriptionMetadata, bq as isDocumentMemory, br as isDocumentMetadata, bs as isFragmentMemory, bt as isFragmentMetadata, bu as isMessageMetadata } from '../../types-DIUaglro.js';
|
|
2
|
+
export { bL as AgentRuntime, bv as DatabaseAdapter, bK as Semaphore, bH as ServerOwnershipState, cd as ServiceBuilder, cf as ServiceDefinition, c1 as addHeader, bF as booleanFooter, bs as composeActionExamples, b$ as composePrompt, c0 as composePromptFromState, ce as createService, bN as createSettingFromConfig, bx as createUniqueUuid, b_ as decryptObjectValues, bM as decryptSecret, bM as decryptStringValue, bY as decryptedCharacter, cg as defineService, bB as elizaLogger, bZ as encryptObjectValues, bP as encryptStringValue, bX as encryptedCharacter, bw as findEntityByName, bJ as findWorldsForOwner, bt as formatActionNames, bu as formatActions, bz as formatEntities, c3 as formatMessages, c2 as formatPosts, c4 as formatTimestamp, by as getEntityDetails, bO as getSalt, bI as getUserServerRole, bV as getWorldSettings, bG as imageDescriptionTemplate, bW as initializeOnboarding, bA as logger, bD as messageHandlerTemplate, ca as parseBooleanFromText, c9 as parseJSONObjectFromText, c8 as parseKeyValueXml, bE as postCreationTemplate, cb as safeReplacer, bQ as saltSettingValue, bS as saltWorldSettings, bC as shouldRespondTemplate, c6 as stringToUuid, cc as trimTokens, c7 as truncateToCompleteSentence, bR as unsaltSettingValue, bT as unsaltWorldSettings, bU as updateWorldSettings, c5 as validateUuid } from '../../index-DOpqCUJl.js';
|
package/dist/specs/v2/index.js
CHANGED
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
unsaltWorldSettings2 as unsaltWorldSettings,
|
|
79
79
|
updateWorldSettings2 as updateWorldSettings,
|
|
80
80
|
validateUuid2 as validateUuid
|
|
81
|
-
} from "../../chunk-
|
|
81
|
+
} from "../../chunk-WLUL3JMY.js";
|
|
82
82
|
import "../../chunk-2HSL25IJ.js";
|
|
83
83
|
import "../../chunk-WO7Z3GE6.js";
|
|
84
84
|
import "../../chunk-U2ADTLZY.js";
|
|
@@ -671,7 +671,7 @@ interface IDatabaseAdapter {
|
|
|
671
671
|
deleteAgent(agentId: UUID): Promise<boolean>;
|
|
672
672
|
ensureEmbeddingDimension(dimension: number): Promise<void>;
|
|
673
673
|
/** Get entity by IDs */
|
|
674
|
-
|
|
674
|
+
getEntitiesByIds(entityIds: UUID[]): Promise<Entity[] | null>;
|
|
675
675
|
/** Get entities for room */
|
|
676
676
|
getEntitiesForRoom(roomId: UUID, includeComponents?: boolean): Promise<Entity[]>;
|
|
677
677
|
/** Create new entities */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "624b0bf9afbbdf0170d1abbdcba0ca5ed9032aeb"
|
|
79
79
|
}
|