@elizaos/core 2.0.0-alpha.60 → 2.0.0-alpha.61

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.
@@ -3060,7 +3060,7 @@ Additional instructions: ${q}`;return K+=`
3060
3060
  Summary:`,K}async function Kz$($,q,K){let _=await $.getMemories({tableName:"messages",roomId:q,count:200});if(!_?.length)return"No conversation history to compact.";let P=_.sort((Y,O)=>(Y.createdAt??0)-(O.createdAt??0)).map((Y)=>{let O=Y.entityId===$.agentId?"Assistant":"User",j=Y.content?.text??"";return`${O}: ${j}`}).join(`
3061
3061
  `);return $.useModel(b$.TEXT_LARGE,{prompt:qz$(P,K)})}var vV={name:"COMPACT_SESSION",similes:["COMPACT","COMPRESS","SUMMARIZE_SESSION"],description:"Summarize conversation history and set a compaction point. Messages before the compaction point will not be included in future context. The summary is stored so key decisions and context are preserved.",validate:async($,q)=>{if(!q.roomId)return!1;if(!await $.getRoom(q.roomId))return!1;return((await $.getMemories({tableName:"messages",roomId:q.roomId,count:1}))?.length??0)>0},handler:async($,q,K,_,P,Y)=>{let{roomId:O}=q,W=(q.content?.text??"").replace(/^\/?compact\s*/i,"").trim()||void 0;try{let z=await Kz$($,O,W),T=Date.now();await $.createMemory({id:KY.randomUUID(),entityId:$.agentId,roomId:O,content:{text:`[Compaction Summary]
3062
3062
 
3063
- ${z}`,source:"compaction"},createdAt:T,metadata:{type:W8.CUSTOM}},"messages");let Z=await $.getRoom(O);if(Z){let G=Array.isArray(Z.metadata?.compactionHistory)?Z.metadata.compactionHistory:[],k={timestamp:T,triggeredBy:q.entityId},N=[...G,k].slice(-10);await $.updateRoom({...Z,metadata:{...Z.metadata,lastCompactionAt:T,compactionHistory:N}})}if(J$.info({src:"action:compact-session",roomId:O,entityId:q.entityId,compactionAt:T},"Session compacted with summary"),P)await P({text:"Session compacted.",actions:["COMPACT_SESSION"],source:q.content.source});return{text:"Session compacted",success:!0,values:{compactedAt:T},data:{actionName:"COMPACT_SESSION",compactedAt:T}}}catch(z){let T=z instanceof Error?z.message:String(z);if(J$.error({src:"action:compact-session",roomId:O,error:T},"Compaction failed"),P)await P({text:`Compaction failed: ${T}`,actions:["COMPACT_SESSION_FAILED"],source:q.content.source});return{text:`Compaction failed: ${T}`,success:!1,values:{error:T},data:{actionName:"COMPACT_SESSION"}}}},examples:[[{name:"{{name1}}",content:{text:"/compact"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}],[{name:"{{name1}}",content:{text:"/compact Focus on decisions"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}],[{name:"{{name1}}",content:{text:"Compress the conversation history"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}]]};h6();var hO=e6("IGNORE"),GV={name:hO.name,similes:hO.similes?[...hO.similes]:[],validate:async($,q)=>{return!0},description:hO.description,handler:async($,q,K,_,P,Y)=>{if(P&&Y?.[0]?.content)await P(Y[0].content);return{text:"Ignoring message",values:{success:!0,ignored:!0},data:{actionName:"IGNORE"},success:!0}},examples:hO.examples??[]};h6();var LO=e6("NONE"),fV={name:LO.name,similes:LO.similes?[...LO.similes]:[],validate:async($,q)=>{return!0},description:LO.description,handler:async($,q)=>{return{text:"No additional action taken",values:{success:!0,actionType:"NONE"},data:{actionName:"NONE",description:"Response without additional action"},success:!0}},examples:LO.examples??[]};h6();d6();p6();S6();var bO=e6("REPLY"),kV={name:bO.name,similes:bO.similes?[...bO.similes]:[],description:bO.description,validate:async($)=>{return!0},handler:async($,q,K,_,P,Y)=>{let j=_?.actionContext?.previousResults||[];if(j.length>0)J$.debug({src:"plugin:bootstrap:action:reply",agentId:$.agentId,count:j.length},"Found previous action results");let W=[];if(Y)for(let I of Y){let b=I.content?.providers;if(b&&b.length>0)W.push(...b)}K=await $.composeState(q,[...W??[],"RECENT_MESSAGES","ACTION_STATE"]);let z=l6({state:K,template:$.character.templates?.replyTemplate||Ml}),T=await $.useModel(b$.TEXT_LARGE,{prompt:z}),Z=n6(T),G=Z?.thought,k=Z?.text,N=typeof G==="string"?G:"",E=typeof k==="string"?k:"",C={thought:N,text:E,actions:["REPLY"]};if(P)await P(C);let R=Date.now();return{text:`Generated reply: ${C.text}`,values:{success:!0,responded:!0,lastReply:C.text,lastReplyTime:R,thoughtProcess:N},data:{actionName:"REPLY",responseThought:N,responseText:E,thought:N,messageGenerated:!0},success:!0}},examples:bO.examples??[]};h6();function xO($,q,K,_){if($.length===0)return[];if(K<=0)return[];let P=_?.fromEnd??!1,Y=0,O=0,j=$.map(q);if(P){for(let z=$.length-1;z>=0;z--){if(Y+j[z]>K)break;Y+=j[z],O++}let W=O>0?O:0;return $.slice($.length-W)}for(;O<$.length;O++){if(Y+j[O]>K)break;Y+=j[O]}return $.slice(0,O)}S6();var VV=c6("ACTION_STATE"),_z$=2600,Yz$=2400,MV={name:VV.name,description:VV.description,position:VV.position??150,get:async($,q,K)=>{let _=K.data.actionResults??[],P=K.data.actionPlan,Y=K.data.workingMemory,O="";if(P&&P.totalSteps>1){let k=P.steps.filter((E)=>E.status==="completed").length,N=P.steps.filter((E)=>E.status==="failed").length;O=U6("# Action Execution Plan",[`**Plan:** ${P.thought}`,`**Progress:** Step ${P.currentStep} of ${P.totalSteps}`,`**Status:** ${k} completed, ${N} failed`,"","## Steps:",...P.steps.map((E,C)=>{let R=E.status==="completed"?"✓":E.status==="failed"?"✗":C<P.currentStep-1?"○":C===P.currentStep-1?"→":"○",I=E.status==="pending"&&C===P.currentStep-1?"in progress":E.status,b=`${R} **Step ${C+1}:** ${E.action} (${I})`;if(E.error)b+=`
3063
+ ${z}`,source:"compaction"},createdAt:T,metadata:{type:W8.CUSTOM}},"messages");let Z=await $.getRoom(O);if(Z){let G=Array.isArray(Z.metadata?.compactionHistory)?Z.metadata.compactionHistory:[],k={timestamp:T,triggeredBy:q.entityId},N=[...G,k].slice(-10);await $.updateRoom({...Z,metadata:{...Z.metadata,lastCompactionAt:T,compactionHistory:N}})}if(J$.info({src:"action:compact-session",roomId:O,entityId:q.entityId,compactionAt:T},"Session compacted with summary"),P)await P({text:"Session compacted.",actions:["COMPACT_SESSION"],source:q.content.source});return{text:"Session compacted",success:!0,values:{compactedAt:T},data:{actionName:"COMPACT_SESSION",compactedAt:T}}}catch(z){let T=z instanceof Error?z.message:String(z);if(J$.error({src:"action:compact-session",roomId:O,error:T},"Compaction failed"),P)await P({text:`Compaction failed: ${T}`,actions:["COMPACT_SESSION_FAILED"],source:q.content.source});return{text:`Compaction failed: ${T}`,success:!1,values:{error:T},data:{actionName:"COMPACT_SESSION"}}}},examples:[[{name:"{{name1}}",content:{text:"/compact"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}],[{name:"{{name1}}",content:{text:"/compact Focus on decisions"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}],[{name:"{{name1}}",content:{text:"Compress the conversation history"}},{name:"{{agentName}}",content:{text:"Session compacted.",actions:["COMPACT_SESSION"]}}]]};h6();var hO=e6("IGNORE"),GV={name:hO.name,similes:hO.similes?[...hO.similes]:[],validate:async($,q)=>{return!0},description:hO.description,handler:async($,q,K,_,P,Y)=>{if(P&&Y?.[0]?.content)await P(Y[0].content);return{text:"Ignoring message",values:{success:!0,ignored:!0},data:{actionName:"IGNORE"},success:!0}},examples:hO.examples??[]};h6();var LO=e6("NONE"),fV={name:LO.name,similes:LO.similes?[...LO.similes]:[],validate:async($,q)=>{return!0},description:LO.description,handler:async($,q)=>{return{text:"No additional action taken",values:{success:!0,actionType:"NONE"},data:{actionName:"NONE",description:"Response without additional action"},success:!0}},examples:LO.examples??[]};h6();d6();p6();S6();var bO=e6("REPLY"),kV={name:bO.name,similes:bO.similes?[...bO.similes]:[],description:bO.description,validate:async($)=>{return!0},handler:async($,q,K,_,P,Y)=>{let j=_?.actionContext?.previousResults||[];if(j.length>0)J$.debug({src:"plugin:bootstrap:action:reply",agentId:$.agentId,count:j.length},"Found previous action results");let W=[];if(Y)for(let I of Y){let b=I.content?.providers;if(b&&b.length>0)W.push(...b)}K=await $.composeState(q,[...W??[],"RECENT_MESSAGES","ACTION_STATE"]);let z=l6({state:K,template:$.character.templates?.replyTemplate||Ml}),T=await $.useModel(b$.TEXT_LARGE,{prompt:z}),Z=n6(T),G=Z?.thought,k=Z?.text,N=typeof G==="string"?G:"",E=typeof k==="string"?k:"",C={thought:N,text:E,actions:["REPLY"]};if(P)await P(C);let R=Date.now();return{text: "",values:{success:!0,responded:!0,lastReply:C.text,lastReplyTime:R,thoughtProcess:N},data:{actionName:"REPLY",responseThought:N,responseText:E,thought:N,messageGenerated:!0},success:!0}},examples:bO.examples??[]};h6();function xO($,q,K,_){if($.length===0)return[];if(K<=0)return[];let P=_?.fromEnd??!1,Y=0,O=0,j=$.map(q);if(P){for(let z=$.length-1;z>=0;z--){if(Y+j[z]>K)break;Y+=j[z],O++}let W=O>0?O:0;return $.slice($.length-W)}for(;O<$.length;O++){if(Y+j[O]>K)break;Y+=j[O]}return $.slice(0,O)}S6();var VV=c6("ACTION_STATE"),_z$=2600,Yz$=2400,MV={name:VV.name,description:VV.description,position:VV.position??150,get:async($,q,K)=>{let _=K.data.actionResults??[],P=K.data.actionPlan,Y=K.data.workingMemory,O="";if(P&&P.totalSteps>1){let k=P.steps.filter((E)=>E.status==="completed").length,N=P.steps.filter((E)=>E.status==="failed").length;O=U6("# Action Execution Plan",[`**Plan:** ${P.thought}`,`**Progress:** Step ${P.currentStep} of ${P.totalSteps}`,`**Status:** ${k} completed, ${N} failed`,"","## Steps:",...P.steps.map((E,C)=>{let R=E.status==="completed"?"✓":E.status==="failed"?"✗":C<P.currentStep-1?"○":C===P.currentStep-1?"→":"○",I=E.status==="pending"&&C===P.currentStep-1?"in progress":E.status,b=`${R} **Step ${C+1}:** ${E.action} (${I})`;if(E.error)b+=`
3064
3064
  Error: ${E.error}`;if(E.result?.text)b+=`
3065
3065
  Result: ${E.result.text}`;return b}),""].join(`
3066
3066
  `))}let j="";if(_.length>0){let N=xO(_,(E)=>String(E.text||"").length+String(E.error||"").length+(()=>{try{return JSON.stringify(E.values||{}).length}catch{return 0}})()+80,_z$).map((E,C)=>{let R=E.data?.actionName,I=typeof R==="string"?R:"Unknown Action",L=E.success?"Success":"Failed",y=`**${C+1}. ${I}** - ${L}`;if(E.text)y+=`
@@ -73447,7 +73447,7 @@ var replyAction = {
73447
73447
  }
73448
73448
  const now = Date.now();
73449
73449
  return {
73450
- text: `Generated reply: ${responseContent.text}`,
73450
+ text: "",
73451
73451
  values: {
73452
73452
  success: true,
73453
73453
  responded: true,
@@ -96313,17 +96313,20 @@ class AgentRuntime {
96313
96313
  await callback(content);
96314
96314
  }
96315
96315
  }
96316
- const actionMemory = {
96317
- id: actionId,
96318
- entityId: this.agentId,
96319
- roomId: message2.roomId,
96320
- worldId: message2.worldId,
96321
- content: {
96322
- text: actionResult?.text || `Executed action: ${action.name}`,
96323
- source: "action"
96324
- }
96325
- };
96326
- await this.createMemory(actionMemory, "messages");
96316
+ const actionText = typeof actionResult?.text === "string" ? actionResult.text.trim() : "";
96317
+ if (actionText) {
96318
+ const actionMemory = {
96319
+ id: actionId,
96320
+ entityId: this.agentId,
96321
+ roomId: message2.roomId,
96322
+ worldId: message2.worldId,
96323
+ content: {
96324
+ text: actionText,
96325
+ source: "action"
96326
+ }
96327
+ };
96328
+ await this.createMemory(actionMemory, "messages");
96329
+ }
96327
96330
  this.logger.debug({ src: "agent", agentId: this.agentId, action: action.name }, "Action completed");
96328
96331
  const logResult = actionResult ? {
96329
96332
  success: actionResult.success,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elizaos/core",
3
- "version": "2.0.0-alpha.60",
3
+ "version": "2.0.0-alpha.61",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -104,5 +104,5 @@
104
104
  "publishConfig": {
105
105
  "access": "public"
106
106
  },
107
- "gitHead": "454beccc910e11d05bcabf2d9ab5a5fc2fbce0a7"
107
+ "gitHead": "6a8cda9c74e9d56d340a652da9940e1b3c7bd472"
108
108
  }