// @bun
var x=Object.defineProperty;var y=(j)=>j;function B(j,q){this[j]=y.bind(null,q)}var H=(j,q)=>{for(var v in q)x(j,v,{get:q[v],enumerable:!0,configurable:!0,set:B.bind(q,v)})};var J=(j,q)=>()=>(j&&(q=j(j=0)),q);var K=import.meta.require;function N(j){let q=[];for(let v of j.messages)if(v.role==="user"||v.role==="assistant"){let w=typeof v.content==="string"?v.content:JSON.stringify(v.content);q.push({role:v.role,content:w})}return{sessionId:j.sessionId,messages:q,metadata:{agentId:j.agentId,tenantId:j.tenantId,actorId:j.actorId}}}function F(j){return{sessionId:j?.sessionId,messages:[],metadata:{tenantId:j?.tenantId,actorId:j?.actorId,...j?.metadata}}}function O(){return F()}function P(j){return{tenantId:j?.tenantId,actorId:j?.actorId,sessionId:j?.sessionId,...j?.metadata}}function Q(j,q){return{...j,messages:[...j.messages,{role:"user",content:q}]}}function R(j,q){return{...j,messages:[...j.messages,{role:"assistant",content:q}]}}function V(j){return{...j,messages:[]}}function W(j,q){return j.messages.slice(-q)}function X(j){if(typeof j==="string")return[];return j.filter((q)=>q.type==="tool_use")}function Y(j,q,v=!1){return{type:"tool_result",tool_use_id:j,content:typeof q==="string"?q:JSON.stringify(q),is_error:v}}function Z(j,q){return{...j,metadata:{...j.metadata,...q}}}function _(j){return j.messages.length}function G(j){let q=0;for(let v of j.messages)if(typeof v.content==="string")q+=v.content.length;else q+=JSON.stringify(v.content).length;return Math.ceil(q/4)}function $(j){let q=0,v=0;for(let w of j.messages)if(w.role==="user")q++;else v++;return{messageCount:j.messages.length,userMessages:q,assistantMessages:v,estimatedTokens:G(j)}}export{Z as updateSessionMetadata,N as toClaudeAgentSession,$ as summarizeSession,W as getRecentMessages,_ as getMessageCount,X as extractToolUseBlocks,G as estimateTokens,Y as createToolResultBlock,O as createEmptyClaudeSession,F as createClaudeAgentSession,V as clearSession,P as buildClaudeAgentContext,Q as appendUserMessage,R as appendAssistantMessage};
