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

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: "",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:`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+=`
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+=`