// @bun
var w=Object.defineProperty;var z=(h)=>h;function B(h,j){this[h]=z.bind(null,j)}var K=(h,j)=>{for(var k in j)w(h,k,{get:j[k],enumerable:!0,configurable:!0,set:B.bind(j,k)})};var L=(h,j)=>()=>(h&&(j=h(h=0)),j);var N=import.meta.require;import{randomUUID as q}from"crypto";function F(h){let j=h.content;if(typeof j==="string")return j;if(Array.isArray(j))return j.map((k)=>{if(typeof k==="string")return k;if("text"in k&&typeof k.text==="string")return k.text;return""}).filter(Boolean).join("");return""}function G(h){let j=h.content;if(typeof j==="string")return j;if(Array.isArray(j))return j.map((k)=>{if(typeof k==="string")return k;if("text"in k&&typeof k.text==="string")return k.text;return""}).filter(Boolean).join("");return""}function H(h){switch(h){case"assistant":return"assistant";case"system":return"system";case"tool":return"tool";case"user":default:return"user"}}class J{async append(h,j){let k=await this.load(h.sessionId)??this.bootstrapMemory(h),v={id:q(),createdAt:j.createdAt??new Date,...j};return k.memory.entries.push(v),await this.save(k),k}async summarize(h){return}async prune(h){}bootstrapMemory(h){return{session:h,memory:{entries:h.messages.map((j)=>({id:q(),createdAt:new Date,type:H(j.role),content:F(j)}))}}}}function Q(h,j,k){if(!h)return;h.append(j,{type:k.role,content:G(k),metadata:k.metadata})}export{Q as trackMessageInMemory,J as BaseAgentMemoryManager};
