var i;(function(t){t.TODO="TODO",t.IN_PROGRESS="IN_PROGRESS",t.IN_REVIEW="IN_REVIEW",t.DONE="DONE",t.CANCELLED="CANCELLED"})(i||(i={}));var c;(function(t){t.ACTIVE="ACTIVE",t.MERGED="MERGED",t.ABANDONED="ABANDONED",t.HIBERNATED="HIBERNATED"})(c||(c={}));var E;(function(t){t.WORKTREE="WORKTREE",t.MAIN_DIRECTORY="MAIN_DIRECTORY"})(E||(E={}));var r;(function(t){t.CLAUDE_CODE="CLAUDE_CODE",t.GEMINI_CLI="GEMINI_CLI",t.CURSOR_AGENT="CURSOR_AGENT",t.CODEX="CODEX"})(r||(r={}));var d;(function(t){t.PENDING="PENDING",t.RUNNING="RUNNING",t.COMPLETED="COMPLETED",t.FAILED="FAILED",t.CANCELLED="CANCELLED"})(d||(d={}));var l;(function(t){t.CHAT="CHAT",t.COMMIT_MSG="COMMIT_MSG"})(l||(l={}));var u;(function(t){t.REBASE="REBASE",t.MERGE="MERGE"})(u||(u={}));var n;(function(t){t.Action="Action",t.Assistant="Assistant",t.Info="Info",t.Tool="Tool",t.User="User",t.Cursor="Cursor",t.Error="Error"})(n||(n={}));function C(t){const e=t.metadata?.toolName||"Tool",a=t.metadata?.action,s=t.metadata?.status,o=a?{file_read:"Read File",file_edit:"Edit File",command_run:"Run Command",search:"Search",web_fetch:"Fetch URL",tool:"Tool",task_create:"Create Task",plan_presentation:"Present Plan",todo_management:"Manage Todo",other:"Action"}[a]:e;return s==="success"?`${o} ✓`:s==="failed"?`${o} ✗`:s==="pending_approval"?`${o} (待审批)`:o}function N(t){switch(t.entryType){case"user_message":case"user_feedback":return{id:t.id,type:n.User,content:t.content};case"assistant_message":return{id:t.id,type:n.Assistant,content:t.content};case"next_action":return{id:t.id,type:n.Action,content:t.content};case"thinking":return{id:t.id,type:n.Info,title:"Thinking",content:t.content};case"tool_use":return{id:t.id,type:n.Tool,title:C(t),content:t.content,isCollapsed:t.metadata?.status==="success",tool:{action:t.metadata?.action,name:t.metadata?.toolName,id:t.metadata?.toolId,status:t.metadata?.status}};case"error_message":return{id:t.id,type:n.Error,content:t.content};case"system_message":return{id:t.id,type:n.Info,content:t.content};case"loading":return{id:t.id,type:n.Cursor,content:""};case"token_usage_info":if(t.metadata?.tokenUsage){const{totalTokens:e=0,modelContextWindow:a}=t.metadata.tokenUsage;return{id:t.id,type:n.Info,content:t.content,tokenUsage:{totalTokens:e,modelContextWindow:a}}}return null;default:return null}}function D(t){return t.map(N).filter(e=>e!==null)}function R(){return{id:`cursor-${Date.now()}`,type:n.Cursor,content:""}}export{r as A,u as C,n as L,d as S,i as T,E as W,c as a,R as c,D as n};
