var s;(function(t){t.TODO="TODO",t.IN_PROGRESS="IN_PROGRESS",t.IN_REVIEW="IN_REVIEW",t.DONE="DONE",t.CANCELLED="CANCELLED"})(s||(s={}));var c;(function(t){t.ACTIVE="ACTIVE",t.MERGED="MERGED",t.ABANDONED="ABANDONED",t.HIBERNATED="HIBERNATED"})(c||(c={}));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 E;(function(t){t.PENDING="PENDING",t.RUNNING="RUNNING",t.COMPLETED="COMPLETED",t.FAILED="FAILED",t.CANCELLED="CANCELLED"})(E||(E={}));var d;(function(t){t.CHAT="CHAT",t.COMMIT_MSG="COMMIT_MSG"})(d||(d={}));var l;(function(t){t.REBASE="REBASE",t.MERGE="MERGE"})(l||(l={}));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 u(t){const e=t.metadata?.toolName||"Tool",o=t.metadata?.action,i=t.metadata?.status,a=o?{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"}[o]:e;return i==="success"?`${a} ✓`:i==="failed"?`${a} ✗`:i==="pending_approval"?`${a} (待审批)`:a}function C(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:u(t),content:t.content,isCollapsed:t.metadata?.status==="success"};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:o}=t.metadata.tokenUsage;return{id:t.id,type:n.Info,content:t.content,tokenUsage:{totalTokens:e,modelContextWindow:o}}}return null;default:return null}}function D(t){return t.map(C).filter(e=>e!==null)}function I(){return{id:`cursor-${Date.now()}`,type:n.Cursor,content:""}}export{r as A,l as C,n as L,E as S,s as T,I as c,D as n};
