@elizaos/plugin-bootstrap 1.6.2-alpha.2 → 1.6.2-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 +25 -10
- package/dist/index.js.map +3 -3
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -7273,7 +7273,11 @@ function shouldRespond(runtime, message, room, mentionContext) {
|
|
|
7273
7273
|
return { shouldRespond: true, skipEvaluation: true, reason: `private channel: ${roomType}` };
|
|
7274
7274
|
}
|
|
7275
7275
|
if (respondSources.some((pattern) => sourceStr.includes(pattern))) {
|
|
7276
|
-
return {
|
|
7276
|
+
return {
|
|
7277
|
+
shouldRespond: true,
|
|
7278
|
+
skipEvaluation: true,
|
|
7279
|
+
reason: `whitelisted source: ${sourceStr}`
|
|
7280
|
+
};
|
|
7277
7281
|
}
|
|
7278
7282
|
const hasPlatformMention = !!(mentionContext?.isMention || mentionContext?.isReply);
|
|
7279
7283
|
if (hasPlatformMention) {
|
|
@@ -7428,13 +7432,14 @@ ${response}`);
|
|
|
7428
7432
|
}
|
|
7429
7433
|
let responseContent = null;
|
|
7430
7434
|
let responseMessages = [];
|
|
7435
|
+
const keepResp = parseBooleanFromText2(runtime.getSetting("BOOTSTRAP_KEEP_RESP"));
|
|
7431
7436
|
if (shouldRespondToMessage) {
|
|
7432
7437
|
const result = useMultiStep ? await runMultiStepCore({ runtime, message, state, callback }) : await runSingleShotCore({ runtime, message, state });
|
|
7433
7438
|
responseContent = result.responseContent;
|
|
7434
7439
|
responseMessages = result.responseMessages;
|
|
7435
7440
|
state = result.state;
|
|
7436
7441
|
const currentResponseId = agentResponses.get(message.roomId);
|
|
7437
|
-
if (currentResponseId !== responseId) {
|
|
7442
|
+
if (currentResponseId !== responseId && !keepResp) {
|
|
7438
7443
|
runtime.logger.info(`Response discarded - newer message being processed for agent: ${runtime.agentId}, room: ${message.roomId}`);
|
|
7439
7444
|
return;
|
|
7440
7445
|
}
|
|
@@ -7467,7 +7472,6 @@ ${response}`);
|
|
|
7467
7472
|
} else {
|
|
7468
7473
|
runtime.logger.debug("[Bootstrap] Agent decided not to respond (shouldRespond is false).");
|
|
7469
7474
|
const currentResponseId = agentResponses.get(message.roomId);
|
|
7470
|
-
const keepResp = parseBooleanFromText2(runtime.getSetting("BOOTSTRAP_KEEP_RESP"));
|
|
7471
7475
|
if (currentResponseId !== responseId && !keepResp) {
|
|
7472
7476
|
runtime.logger.info(`Ignore response discarded - newer message being processed for agent: ${runtime.agentId}, room: ${message.roomId}`);
|
|
7473
7477
|
await runtime.emitEvent(EventType2.RUN_ENDED, {
|
|
@@ -7524,7 +7528,7 @@ ${response}`);
|
|
|
7524
7528
|
if (agentResponses.size === 0) {
|
|
7525
7529
|
latestResponseIds.delete(runtime.agentId);
|
|
7526
7530
|
}
|
|
7527
|
-
|
|
7531
|
+
runtime.evaluate(message, state, shouldRespondToMessage, async (content) => {
|
|
7528
7532
|
runtime.logger.debug({ content }, "evaluate callback");
|
|
7529
7533
|
if (responseContent) {
|
|
7530
7534
|
responseContent.evalCallbacks = content;
|
|
@@ -7533,7 +7537,9 @@ ${response}`);
|
|
|
7533
7537
|
return callback(content);
|
|
7534
7538
|
}
|
|
7535
7539
|
return [];
|
|
7536
|
-
}, responseMessages)
|
|
7540
|
+
}, responseMessages).catch((error) => {
|
|
7541
|
+
runtime.logger.error({ error, messageId: message.id, roomId: message.roomId }, "[Bootstrap] Error in background evaluator execution");
|
|
7542
|
+
});
|
|
7537
7543
|
let entityName = "noname";
|
|
7538
7544
|
if (message.metadata && "entityName" in message.metadata) {
|
|
7539
7545
|
entityName = message.metadata.entityName;
|
|
@@ -7613,7 +7619,11 @@ ${response}`);
|
|
|
7613
7619
|
onComplete?.();
|
|
7614
7620
|
}
|
|
7615
7621
|
};
|
|
7616
|
-
async function runSingleShotCore({
|
|
7622
|
+
async function runSingleShotCore({
|
|
7623
|
+
runtime,
|
|
7624
|
+
message,
|
|
7625
|
+
state
|
|
7626
|
+
}) {
|
|
7617
7627
|
state = await runtime.composeState(message, ["ACTIONS"]);
|
|
7618
7628
|
if (!state.values?.actionNames) {
|
|
7619
7629
|
runtime.logger.warn("actionNames data missing from state, even though it was requested");
|
|
@@ -7681,7 +7691,12 @@ async function runSingleShotCore({ runtime, message, state }) {
|
|
|
7681
7691
|
mode: isSimple && responseContent.text ? "simple" : "actions"
|
|
7682
7692
|
};
|
|
7683
7693
|
}
|
|
7684
|
-
async function runMultiStepCore({
|
|
7694
|
+
async function runMultiStepCore({
|
|
7695
|
+
runtime,
|
|
7696
|
+
message,
|
|
7697
|
+
state,
|
|
7698
|
+
callback
|
|
7699
|
+
}) {
|
|
7685
7700
|
const traceActionResult = [];
|
|
7686
7701
|
let accumulatedState = state;
|
|
7687
7702
|
const maxIterations = parseInt(runtime.getSetting("MAX_MULTISTEP_ITERATIONS") || "6");
|
|
@@ -7748,7 +7763,7 @@ async function runMultiStepCore({ runtime, message, state, callback }) {
|
|
|
7748
7763
|
data: { actionName: providerName },
|
|
7749
7764
|
success,
|
|
7750
7765
|
text: success ? providerResult.text : undefined,
|
|
7751
|
-
error: success ? undefined : providerResult?.
|
|
7766
|
+
error: success ? undefined : providerResult?.text
|
|
7752
7767
|
});
|
|
7753
7768
|
if (callback) {
|
|
7754
7769
|
await callback({
|
|
@@ -7988,7 +8003,7 @@ $2`);
|
|
|
7988
8003
|
return cleanedText2;
|
|
7989
8004
|
}
|
|
7990
8005
|
const cleanedText = cleanupPostText(parsedXmlResponse.post || "");
|
|
7991
|
-
const RM = state.
|
|
8006
|
+
const RM = state.data?.providers?.RECENT_MESSAGES;
|
|
7992
8007
|
if (RM) {
|
|
7993
8008
|
for (const m of RM.data.recentMessages) {
|
|
7994
8009
|
if (cleanedText === m.content.text) {
|
|
@@ -8443,5 +8458,5 @@ export {
|
|
|
8443
8458
|
actionStateProvider
|
|
8444
8459
|
};
|
|
8445
8460
|
|
|
8446
|
-
//# debugId=
|
|
8461
|
+
//# debugId=0D5C974CD619FF2264756E2164756E21
|
|
8447
8462
|
//# sourceMappingURL=index.js.map
|