vibeteam 0.5.3 → 0.5.4

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.
@@ -561,6 +561,11 @@ function matchWorktreesWithAgents(worktrees, projectId) {
561
561
  const projectAgents = Array.from(managedSessions.values())
562
562
  .filter(s => s.projectId === projectId);
563
563
 
564
+ // Get all pipelines for this project that have active worktrees AND whose task still exists
565
+ const activePipelineWorktrees = pipelineManager.getPipelines(projectId)
566
+ .filter(p => p.worktreePath && p.worktreeStatus === 'active' && kanbanManager.getTask(p.taskId))
567
+ .map(p => ({ path: p.worktreePath, taskId: p.taskId, pipelineId: p.id }));
568
+
564
569
  return worktrees.map(wt => {
565
570
  // Find agent using this worktree
566
571
  const agent = projectAgents.find(a =>
@@ -568,12 +573,16 @@ function matchWorktreesWithAgents(worktrees, projectId) {
568
573
  a.cwd === wt.path
569
574
  );
570
575
 
576
+ // Find pipeline task using this worktree
577
+ const pipeline = activePipelineWorktrees.find(p => p.path === wt.path);
578
+
571
579
  return {
572
580
  ...wt,
573
581
  agentId: agent?.id,
574
582
  agentName: agent?.name,
575
- // Orphaned = not main worktree AND no agent using it
576
- isOrphaned: !wt.isMain && !agent,
583
+ pipelineTaskId: pipeline?.taskId,
584
+ // Orphaned = not main worktree AND no agent using it AND no active pipeline task using it
585
+ isOrphaned: !wt.isMain && !agent && !pipeline,
577
586
  };
578
587
  });
579
588
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeteam",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "AI agent orchestration platform for Claude Code",
5
5
  "author": "asara",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- import{u as b,a as s,j as t,e as U}from"./index-B6Eylck2.js";const P="vibeteam-activity-filters",Y=[{value:"tool_use",label:"Tool Use"},{value:"prompt",label:"Prompts"},{value:"permission",label:"Permissions"},{value:"session_end",label:"Session End"},{value:"error",label:"Errors"}],B=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"1h",label:"1h"},{value:"all",label:"All"}],J=["tool_use","prompt","status_change","permission","error","session_end"],K=["5m","15m","1h","all"];function W(){try{const n=localStorage.getItem(P);if(!n)return{selectedTypes:[],timeRange:"all"};const a=JSON.parse(n),v=Array.isArray(a.selectedTypes)?a.selectedTypes.filter(y=>J.includes(y)):[],g=K.includes(a.timeRange)?a.timeRange:"all";return{selectedTypes:v,timeRange:g}}catch{return{selectedTypes:[],timeRange:"all"}}}function q(n,a){try{localStorage.setItem(P,JSON.stringify({selectedTypes:n,timeRange:a}))}catch{}}function z(n){switch(n){case"5m":return 300*1e3;case"15m":return 900*1e3;case"1h":return 3600*1e3;case"all":return 1/0}}function Q(n){const a=Date.now()-n;return a<5e3?"just now":a<6e4?`${Math.floor(a/1e3)}s ago`:a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:`${Math.floor(a/864e5)}d ago`}function X(n){switch(n.type){case"tool_use":return n.tool?U(n.tool):"🔧";case"prompt":return"💬";case"permission":return"⚠️";case"session_end":return"✅";case"error":return"❌";case"status_change":return"🔄";default:return"📌"}}function Z(n,a){return n.length<=a?n:n.slice(0,a)+"..."}function te(){const n=b(e=>e.activityEvents),a=b(e=>e.resetActivityUnread),v=b(e=>e.agents),g=b(e=>e.selectAgent),y=s.useMemo(()=>W(),[]),[u,k]=s.useState([]),[r,C]=s.useState(y.selectedTypes),[f,$]=s.useState(y.timeRange),[p,T]=s.useState(!1),[N,E]=s.useState(!1),[c,x]=s.useState(!1),[,O]=s.useState(0),o=s.useRef(null),m=s.useRef(!0),h=s.useRef(0),[w,j]=s.useState(0),A=s.useRef(null),I=s.useRef(null),R=s.useRef(0);s.useEffect(()=>{q(r,f)},[r,f]),s.useEffect(()=>{if(!p&&!N)return;const e=l=>{const i=l.target;A.current?.contains(i)||I.current?.contains(i)||(T(!1),E(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p,N]),s.useEffect(()=>{const e=setInterval(()=>O(l=>l+1),6e4);return()=>clearInterval(e)},[]),s.useEffect(()=>{m.current&&!c&&(a(),h.current=0,j(0))},[n.length,a,c]),s.useEffect(()=>{!c&&m.current&&o.current?o.current.scrollTop=o.current.scrollHeight:c||(h.current++,j(h.current))},[n.length,c]);const L=s.useCallback(()=>{if(!o.current)return;const{scrollTop:e,scrollHeight:l,clientHeight:i}=o.current,d=l-e-i<40;m.current=d,d&&(h.current=0,j(0),a(),c&&x(!1))},[a,c]),_=s.useCallback(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight,m.current=!0,h.current=0,j(0),a(),x(!1))},[a]),D=s.useCallback(e=>{e.agentId&&e.agentId!=="unknown"&&g(e.agentId)},[g]),H=s.useCallback(e=>{k(l=>l.includes(e)?l.filter(i=>i!==e):[...l,e])},[]),V=s.useCallback(e=>{C(l=>l.includes(e)?l.filter(i=>i!==e):[...l,e])},[]),G=s.useCallback(()=>{x(e=>e?!1:(R.current=n.length,!0))},[n.length]),S=c?n.length-R.current:0,F=s.useMemo(()=>{const e=Date.now(),l=z(f);return(c?n.slice(0,R.current):n).filter(d=>!(u.length>0&&!u.includes(d.agentId)||r.length>0&&!r.includes(d.type)||l!==1/0&&e-d.timestamp>l))},[n,u,r,f,c]),M=s.useMemo(()=>{const e=new Map;for(const[l,i]of v)e.set(l,{id:l,name:i.name,color:i.color});return Array.from(e.values())},[v]);return t.jsxs("div",{className:"activity-feed-panel",children:[t.jsxs("div",{className:"activity-filter-bar",children:[t.jsxs("div",{className:"activity-filter-group",children:[t.jsxs("div",{className:"activity-filter-dropdown-wrapper",ref:A,children:[t.jsxs("button",{className:`activity-filter-btn ${u.length>0?"active":""}`,onClick:()=>{T(!p),E(!1)},children:["Agent",u.length>0?` (${u.length})`:""]}),p&&t.jsxs("div",{className:"activity-filter-dropdown",children:[M.length===0?t.jsx("div",{className:"activity-filter-empty",children:"No agents"}):M.map(e=>t.jsxs("label",{className:"activity-filter-option",children:[t.jsx("input",{type:"checkbox",checked:u.includes(e.id),onChange:()=>H(e.id)}),t.jsx("span",{className:"activity-agent-dot",style:{background:e.color}}),t.jsx("span",{children:e.name})]},e.id)),u.length>0&&t.jsx("button",{className:"activity-filter-clear",onClick:()=>k([]),children:"Clear"})]})]}),t.jsxs("div",{className:"activity-filter-dropdown-wrapper",ref:I,children:[t.jsxs("button",{className:`activity-filter-btn ${r.length>0?"active":""}`,onClick:()=>{E(!N),T(!1)},children:["Type",r.length>0?` (${r.length})`:""]}),N&&t.jsxs("div",{className:"activity-filter-dropdown",children:[Y.map(e=>t.jsxs("label",{className:"activity-filter-option",children:[t.jsx("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>V(e.value)}),t.jsx("span",{children:e.label})]},e.value)),r.length>0&&t.jsx("button",{className:"activity-filter-clear",onClick:()=>C([]),children:"Clear"})]})]}),t.jsx("button",{className:`activity-pause-btn ${c?"paused":""}`,onClick:G,title:c?"Resume feed":"Pause feed",children:c?"▶":"⏸"})]}),t.jsx("div",{className:"activity-time-range",children:B.map(e=>t.jsx("button",{className:`activity-time-btn ${f===e.value?"active":""}`,onClick:()=>$(e.value),children:e.label},e.value))})]}),c&&t.jsxs("div",{className:"activity-paused-banner",children:["Paused ",S>0?`- ${S} new event${S!==1?"s":""}`:"",t.jsx("button",{className:"activity-paused-resume",onClick:()=>{x(!1),_()},children:"Resume"})]}),t.jsx("div",{className:"activity-event-list",ref:o,onScroll:L,children:F.length===0?t.jsxs("div",{className:"activity-empty-state",children:[t.jsx("div",{className:"activity-empty-icon",children:"📋"}),t.jsx("div",{className:"activity-empty-text",children:"No activity yet"}),t.jsx("div",{className:"activity-empty-hint",children:"Spawn an agent to get started"})]}):F.map(e=>t.jsxs("div",{className:"activity-event-card",onClick:()=>D(e),title:e.description,children:[t.jsx("span",{className:"activity-event-time",children:Q(e.timestamp)}),t.jsx("span",{className:"activity-agent-dot",style:{background:e.agentColor}}),t.jsx("span",{className:"activity-event-agent",children:e.agentName}),t.jsx("span",{className:"activity-event-icon",children:X(e)}),t.jsx("span",{className:"activity-event-desc",children:Z(e.description,80)})]},e.id))}),!c&&w>0&&!m.current&&t.jsxs("button",{className:"activity-new-events",onClick:_,children:[w," new event",w!==1?"s":""]})]})}export{te as ActivityFeedPanel};
1
+ import{u as b,a as s,j as t,e as U}from"./index-DQO9MIWG.js";const P="vibeteam-activity-filters",Y=[{value:"tool_use",label:"Tool Use"},{value:"prompt",label:"Prompts"},{value:"permission",label:"Permissions"},{value:"session_end",label:"Session End"},{value:"error",label:"Errors"}],B=[{value:"5m",label:"5m"},{value:"15m",label:"15m"},{value:"1h",label:"1h"},{value:"all",label:"All"}],J=["tool_use","prompt","status_change","permission","error","session_end"],K=["5m","15m","1h","all"];function W(){try{const n=localStorage.getItem(P);if(!n)return{selectedTypes:[],timeRange:"all"};const a=JSON.parse(n),v=Array.isArray(a.selectedTypes)?a.selectedTypes.filter(y=>J.includes(y)):[],g=K.includes(a.timeRange)?a.timeRange:"all";return{selectedTypes:v,timeRange:g}}catch{return{selectedTypes:[],timeRange:"all"}}}function q(n,a){try{localStorage.setItem(P,JSON.stringify({selectedTypes:n,timeRange:a}))}catch{}}function z(n){switch(n){case"5m":return 300*1e3;case"15m":return 900*1e3;case"1h":return 3600*1e3;case"all":return 1/0}}function Q(n){const a=Date.now()-n;return a<5e3?"just now":a<6e4?`${Math.floor(a/1e3)}s ago`:a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:`${Math.floor(a/864e5)}d ago`}function X(n){switch(n.type){case"tool_use":return n.tool?U(n.tool):"🔧";case"prompt":return"💬";case"permission":return"⚠️";case"session_end":return"✅";case"error":return"❌";case"status_change":return"🔄";default:return"📌"}}function Z(n,a){return n.length<=a?n:n.slice(0,a)+"..."}function te(){const n=b(e=>e.activityEvents),a=b(e=>e.resetActivityUnread),v=b(e=>e.agents),g=b(e=>e.selectAgent),y=s.useMemo(()=>W(),[]),[u,k]=s.useState([]),[r,C]=s.useState(y.selectedTypes),[f,$]=s.useState(y.timeRange),[p,T]=s.useState(!1),[N,E]=s.useState(!1),[c,x]=s.useState(!1),[,O]=s.useState(0),o=s.useRef(null),m=s.useRef(!0),h=s.useRef(0),[w,j]=s.useState(0),A=s.useRef(null),I=s.useRef(null),R=s.useRef(0);s.useEffect(()=>{q(r,f)},[r,f]),s.useEffect(()=>{if(!p&&!N)return;const e=l=>{const i=l.target;A.current?.contains(i)||I.current?.contains(i)||(T(!1),E(!1))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[p,N]),s.useEffect(()=>{const e=setInterval(()=>O(l=>l+1),6e4);return()=>clearInterval(e)},[]),s.useEffect(()=>{m.current&&!c&&(a(),h.current=0,j(0))},[n.length,a,c]),s.useEffect(()=>{!c&&m.current&&o.current?o.current.scrollTop=o.current.scrollHeight:c||(h.current++,j(h.current))},[n.length,c]);const L=s.useCallback(()=>{if(!o.current)return;const{scrollTop:e,scrollHeight:l,clientHeight:i}=o.current,d=l-e-i<40;m.current=d,d&&(h.current=0,j(0),a(),c&&x(!1))},[a,c]),_=s.useCallback(()=>{o.current&&(o.current.scrollTop=o.current.scrollHeight,m.current=!0,h.current=0,j(0),a(),x(!1))},[a]),D=s.useCallback(e=>{e.agentId&&e.agentId!=="unknown"&&g(e.agentId)},[g]),H=s.useCallback(e=>{k(l=>l.includes(e)?l.filter(i=>i!==e):[...l,e])},[]),V=s.useCallback(e=>{C(l=>l.includes(e)?l.filter(i=>i!==e):[...l,e])},[]),G=s.useCallback(()=>{x(e=>e?!1:(R.current=n.length,!0))},[n.length]),S=c?n.length-R.current:0,F=s.useMemo(()=>{const e=Date.now(),l=z(f);return(c?n.slice(0,R.current):n).filter(d=>!(u.length>0&&!u.includes(d.agentId)||r.length>0&&!r.includes(d.type)||l!==1/0&&e-d.timestamp>l))},[n,u,r,f,c]),M=s.useMemo(()=>{const e=new Map;for(const[l,i]of v)e.set(l,{id:l,name:i.name,color:i.color});return Array.from(e.values())},[v]);return t.jsxs("div",{className:"activity-feed-panel",children:[t.jsxs("div",{className:"activity-filter-bar",children:[t.jsxs("div",{className:"activity-filter-group",children:[t.jsxs("div",{className:"activity-filter-dropdown-wrapper",ref:A,children:[t.jsxs("button",{className:`activity-filter-btn ${u.length>0?"active":""}`,onClick:()=>{T(!p),E(!1)},children:["Agent",u.length>0?` (${u.length})`:""]}),p&&t.jsxs("div",{className:"activity-filter-dropdown",children:[M.length===0?t.jsx("div",{className:"activity-filter-empty",children:"No agents"}):M.map(e=>t.jsxs("label",{className:"activity-filter-option",children:[t.jsx("input",{type:"checkbox",checked:u.includes(e.id),onChange:()=>H(e.id)}),t.jsx("span",{className:"activity-agent-dot",style:{background:e.color}}),t.jsx("span",{children:e.name})]},e.id)),u.length>0&&t.jsx("button",{className:"activity-filter-clear",onClick:()=>k([]),children:"Clear"})]})]}),t.jsxs("div",{className:"activity-filter-dropdown-wrapper",ref:I,children:[t.jsxs("button",{className:`activity-filter-btn ${r.length>0?"active":""}`,onClick:()=>{E(!N),T(!1)},children:["Type",r.length>0?` (${r.length})`:""]}),N&&t.jsxs("div",{className:"activity-filter-dropdown",children:[Y.map(e=>t.jsxs("label",{className:"activity-filter-option",children:[t.jsx("input",{type:"checkbox",checked:r.includes(e.value),onChange:()=>V(e.value)}),t.jsx("span",{children:e.label})]},e.value)),r.length>0&&t.jsx("button",{className:"activity-filter-clear",onClick:()=>C([]),children:"Clear"})]})]}),t.jsx("button",{className:`activity-pause-btn ${c?"paused":""}`,onClick:G,title:c?"Resume feed":"Pause feed",children:c?"▶":"⏸"})]}),t.jsx("div",{className:"activity-time-range",children:B.map(e=>t.jsx("button",{className:`activity-time-btn ${f===e.value?"active":""}`,onClick:()=>$(e.value),children:e.label},e.value))})]}),c&&t.jsxs("div",{className:"activity-paused-banner",children:["Paused ",S>0?`- ${S} new event${S!==1?"s":""}`:"",t.jsx("button",{className:"activity-paused-resume",onClick:()=>{x(!1),_()},children:"Resume"})]}),t.jsx("div",{className:"activity-event-list",ref:o,onScroll:L,children:F.length===0?t.jsxs("div",{className:"activity-empty-state",children:[t.jsx("div",{className:"activity-empty-icon",children:"📋"}),t.jsx("div",{className:"activity-empty-text",children:"No activity yet"}),t.jsx("div",{className:"activity-empty-hint",children:"Spawn an agent to get started"})]}):F.map(e=>t.jsxs("div",{className:"activity-event-card",onClick:()=>D(e),title:e.description,children:[t.jsx("span",{className:"activity-event-time",children:Q(e.timestamp)}),t.jsx("span",{className:"activity-agent-dot",style:{background:e.agentColor}}),t.jsx("span",{className:"activity-event-agent",children:e.agentName}),t.jsx("span",{className:"activity-event-icon",children:X(e)}),t.jsx("span",{className:"activity-event-desc",children:Z(e.description,80)})]},e.id))}),!c&&w>0&&!m.current&&t.jsxs("button",{className:"activity-new-events",onClick:_,children:[w," new event",w!==1?"s":""]})]})}export{te as ActivityFeedPanel};
@@ -1 +1 @@
1
- import{a as i,j as e,c as J,l as Q,f as O}from"./index-B6Eylck2.js";const $=[{id:"code_improvements",label:"Code Improvements",color:"#4ade80",icon:"🔧"},{id:"ui_ux",label:"UI/UX",color:"#60a5fa",icon:"🎨"},{id:"security",label:"Security",color:"#f87171",icon:"🔒"},{id:"performance",label:"Performance",color:"#fbbf24",icon:"⚡"},{id:"documentation",label:"Documentation",color:"#a78bfa",icon:"📝"},{id:"code_quality",label:"Code Quality",color:"#22d3d8",icon:"✨"},{id:"new_features",label:"New Features",color:"#a855f7",icon:"🚀"}];function re({onGenerate:s,onCancel:n,initialCategories:h}){const[g,m]=i.useState(()=>new Set(h||$.map(l=>l.id))),c=l=>{m(u=>{const x=new Set(u);return x.has(l)?x.delete(l):x.add(l),x})},v=()=>m(new Set($.map(l=>l.id))),j=()=>m(new Set);return e.jsx("div",{className:"ideation-config-overlay",onClick:n,children:e.jsxs("div",{className:"ideation-config-dialog",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"ideation-config-header",children:[e.jsx("h3",{children:"Configure Ideation"}),e.jsx("p",{children:"Select the categories to analyze"})]}),e.jsxs("div",{className:"ideation-config-toggles",children:[e.jsx("button",{className:"ideation-config-toggle-btn",onClick:v,children:"Select All"}),e.jsx("button",{className:"ideation-config-toggle-btn",onClick:j,children:"Deselect All"})]}),e.jsx("div",{className:"ideation-config-categories",children:$.map(l=>e.jsxs("label",{className:"ideation-config-category",children:[e.jsx("input",{type:"checkbox",checked:g.has(l.id),onChange:()=>c(l.id)}),e.jsx("span",{className:"ideation-config-category-icon",children:l.icon}),e.jsx("span",{className:"ideation-config-category-label",children:l.label}),e.jsx("span",{className:"ideation-config-category-color",style:{backgroundColor:l.color}})]},l.id))}),e.jsxs("div",{className:"ideation-config-actions",children:[e.jsx("button",{className:"ideation-config-cancel",onClick:n,children:"Cancel"}),e.jsxs("button",{className:"ideation-config-generate",onClick:()=>s(Array.from(g)),disabled:g.size===0,children:["Generate Ideas (",g.size," categories)"]})]})]})})}const V=6,oe=10*1024*1024;function ce({projectId:s,editingIdea:n,onSave:h,onCancel:g}){const[m,c]=i.useState(n?.title||""),[v,j]=i.useState(n?.description||""),[l,u]=i.useState(n?.category||"new_features"),[x,N]=i.useState(n?.effort||"medium"),[M,r]=i.useState(n?.impact||"medium"),[f,k]=i.useState(n?.images||[]),[b,L]=i.useState(n?.links||[]),[o,_]=i.useState(""),[w,C]=i.useState(""),[R,T]=i.useState(!1),[B,S]=i.useState(null),[X,U]=i.useState(!1),A=i.useRef(0),G=i.useRef(null),z=!!n,P=i.useCallback(async a=>{if(!a.type.startsWith("image/")){S("Only image files are supported");return}if(a.size>oe){S("Image must be under 10MB");return}if(f.length>=V){S(`Maximum ${V} images`);return}S(null),T(!0);try{const d=await new Promise((K,le)=>{const H=new FileReader;H.onload=()=>K(H.result),H.onerror=()=>le(new Error("Failed to read image file")),H.readAsDataURL(a)}),p=J(Q()),E=await(await fetch(`${p}/kanban/images`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:d,projectId:s})})).json();if(!E.ok)throw new Error(E.error||"Failed to upload image");const I=E.attachment,ne={id:`img-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,filename:I.filename||a.name,path:I.path||I.url||"",size:a.size,mimeType:a.type,createdAt:Date.now()};k(K=>[...K,ne])}catch(d){S(d instanceof Error?d.message:"Failed to upload image")}finally{T(!1)}},[f.length,s]),D=i.useCallback(a=>{Array.from(a).forEach(d=>P(d))},[P]),t=i.useCallback(a=>{a.preventDefault(),a.stopPropagation(),U(!1),A.current=0,a.dataTransfer.files.length>0&&D(a.dataTransfer.files)},[D]),y=i.useCallback(a=>{const d=a.clipboardData?.items;if(!d)return;const p=[];for(let F=0;F<d.length;F++)if(d[F].type.startsWith("image/")){const E=d[F].getAsFile();E&&p.push(E)}p.length>0&&(a.preventDefault(),D(p))},[D]),W=i.useCallback(a=>{k(d=>d.filter(p=>p.id!==a))},[]),q=i.useCallback(()=>{const a=o.trim();if(!a)return;const d={id:`ref-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,url:a,title:w.trim()||a};L(p=>[...p,d]),_(""),C("")},[o,w]),se=i.useCallback(a=>{L(d=>d.filter(p=>p.id!==a))},[]),te=()=>{m.trim()&&h({title:m.trim(),description:v.trim(),category:l,effort:x,impact:M,images:f,links:b})},ie=a=>{try{return new URL(a).hostname}catch{return a}};return e.jsx("div",{className:"idea-creator-overlay",onClick:g,children:e.jsxs("div",{className:"idea-creator-dialog",onClick:a=>a.stopPropagation(),onPaste:y,children:[e.jsxs("div",{className:"idea-creator-header",children:[e.jsx("h3",{children:z?"Edit Idea":"New Idea"}),e.jsx("p",{children:z?"Update your idea details":"Add your own improvement idea with references"})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Title *"}),e.jsx("input",{type:"text",value:m,onChange:a=>c(a.target.value),placeholder:"What's the idea?",autoFocus:!0,className:"idea-creator-input"})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Description"}),e.jsx("textarea",{value:v,onChange:a=>j(a.target.value),placeholder:"Describe the improvement...",rows:4,className:"idea-creator-textarea"})]}),e.jsxs("div",{className:"idea-creator-selects-row",children:[e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Category"}),e.jsx("select",{value:l,onChange:a=>u(a.target.value),className:"idea-creator-select",children:$.map(a=>e.jsxs("option",{value:a.id,children:[a.icon," ",a.label]},a.id))})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Effort"}),e.jsxs("select",{value:x,onChange:a=>N(a.target.value),className:"idea-creator-select",children:[e.jsx("option",{value:"trivial",children:"Trivial"}),e.jsx("option",{value:"small",children:"Small"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"large",children:"Large"}),e.jsx("option",{value:"complex",children:"Complex"})]})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Impact"}),e.jsxs("select",{value:M,onChange:a=>r(a.target.value),className:"idea-creator-select",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Images"}),e.jsxs("div",{className:`idea-creator-dropzone ${X?"drag-over":""}`,onDragEnter:a=>{a.preventDefault(),a.stopPropagation(),A.current++,a.dataTransfer.types.includes("Files")&&U(!0)},onDragLeave:a=>{a.preventDefault(),a.stopPropagation(),A.current--,A.current===0&&U(!1)},onDragOver:a=>{a.preventDefault(),a.stopPropagation()},onDrop:t,onClick:()=>G.current?.click(),children:[e.jsx("input",{ref:G,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:a=>{a.target.files&&D(a.target.files),a.target.value=""}}),R?e.jsx("span",{className:"idea-creator-dropzone-text",children:"Uploading..."}):e.jsx("span",{className:"idea-creator-dropzone-text",children:"Drop images here, paste, or click to browse"})]}),B&&e.jsx("div",{className:"idea-creator-upload-error",children:B}),f.length>0&&e.jsx("div",{className:"idea-creator-image-grid",children:f.map(a=>e.jsxs("div",{className:"idea-creator-image-thumb",children:[e.jsx("img",{src:`${J(Q())}/kanban/images/${a.filename||a.path.split("/").pop()}`,alt:a.filename}),e.jsx("button",{className:"idea-creator-image-remove",onClick:()=>W(a.id),title:"Remove image",children:"×"})]},a.id))})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Reference Links"}),e.jsxs("div",{className:"idea-creator-link-input-row",children:[e.jsx("input",{type:"text",value:o,onChange:a=>_(a.target.value),placeholder:"https://...",className:"idea-creator-input",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),q())}}),e.jsx("input",{type:"text",value:w,onChange:a=>C(a.target.value),placeholder:"Title (optional)",className:"idea-creator-input",style:{flex:"0 0 140px"},onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),q())}}),e.jsx("button",{className:"ideation-btn secondary",onClick:q,disabled:!o.trim(),children:"Add"})]}),b.length>0&&e.jsx("div",{className:"idea-creator-link-list",children:b.map(a=>e.jsxs("div",{className:"idea-creator-link-item",children:[e.jsx("span",{className:"idea-creator-link-icon",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M6.5 9.5l3-3M9 7l1.5-1.5a2.12 2.12 0 0 0-3-3L6 4M7 9l-1.5 1.5a2.12 2.12 0 0 1-3-3L4 6"})})}),e.jsx("span",{className:"idea-creator-link-title",children:a.title||ie(a.url)}),e.jsx("button",{className:"idea-creator-link-remove",onClick:()=>se(a.id),title:"Remove link",children:"×"})]},a.id))})]}),e.jsxs("div",{className:"idea-creator-actions",children:[e.jsx("button",{className:"ideation-config-cancel",onClick:g,children:"Cancel"}),e.jsx("button",{className:"ideation-config-generate",onClick:te,disabled:!m.trim()||R,children:z?"Save Changes":"Create Idea"})]})]})})}function de(s){switch(s){case"critical":return"urgent";case"high":return"high";case"medium":return"medium";case"low":return"low";default:return"medium"}}function me(s){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);return n?`${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)}`:"255, 255, 255"}const Z={trivial:"#4ade80",small:"#60a5fa",medium:"#fbbf24",large:"#f97316",complex:"#f87171"},Y={low:"#888",medium:"#fbbf24",high:"#f97316",critical:"#f87171"};function ee(s){const n=J(Q()),h=s.filename||s.path.split("/").pop()||"";return`${n}/kanban/images/${h}`}function ae(s){try{return new URL(s).hostname}catch{return s}}function he({idea:s,onDismiss:n,onDelete:h,onConvertToTask:g,onEdit:m}){const[c,v]=i.useState(!1),[j,l]=i.useState(null),u=$.find(r=>r.id===s.category),x=s.images&&s.images.length>0,N=s.links&&s.links.length>0,M=c?s.images:s.images?.slice(0,3)||[];return e.jsxs("div",{className:`idea-card ${s.convertedToTaskId?"converted":""} ${c?"expanded":""}`,children:[e.jsxs("div",{className:"idea-card-header",children:[e.jsx("span",{className:"idea-card-category-icon",title:u?.label,children:u?.icon||"?"}),e.jsxs("h4",{className:"idea-card-title",onClick:()=>v(!c),children:[s.title,s.isManual&&e.jsx("span",{className:"idea-card-manual-badge",title:"Manual idea",children:"M"}),e.jsx("span",{className:"idea-card-expand-hint",children:c?"▾":"▸"})]}),e.jsx("div",{className:"idea-card-actions",children:s.convertedToTaskId?e.jsxs("span",{className:"idea-card-converted-badge",title:"Converted to task",children:[e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"currentColor",children:e.jsx("path",{d:"M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L6.75 9.19 5.28 7.72a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l4.5-4.5z"})}),e.jsx("span",{style:{fontSize:11,marginLeft:4},children:"Task created"})]}):e.jsxs(e.Fragment,{children:[s.isManual&&m&&e.jsx("button",{className:"idea-card-action-btn edit",onClick:m,title:"Edit idea",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M11.5 1.5l3 3-9 9H2.5v-3l9-9z"})})}),h&&e.jsx("button",{className:"idea-card-action-btn delete",onClick:h,title:"Delete idea permanently",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M3 4h10M5.5 4V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1M6.5 7v5M9.5 7v5M4.5 4l.5 9a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1l.5-9"})})}),e.jsx("button",{className:"idea-card-action-btn dismiss",onClick:n,title:"Dismiss idea (hide)",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})})]}),e.jsx("p",{className:`idea-card-description ${c?"expanded":""}`,children:s.description}),x&&e.jsxs("div",{className:`idea-card-images ${c?"expanded":""}`,children:[M.map(r=>e.jsx("div",{className:`idea-card-thumbnail ${c?"large":""}`,onClick:()=>l(ee(r)),title:r.filename,children:e.jsx("img",{src:ee(r),alt:r.filename})},r.id)),!c&&s.images.length>3&&e.jsxs("span",{className:"idea-card-images-overflow",onClick:()=>v(!0),children:["+",s.images.length-3]})]}),N&&e.jsx("div",{className:"idea-card-links",children:s.links.map(r=>e.jsxs("a",{className:`idea-card-link-pill ${c?"expanded":""}`,href:r.url,target:"_blank",rel:"noopener noreferrer",title:r.url,children:[e.jsx("svg",{viewBox:"0 0 16 16",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M6.5 9.5l3-3M9 7l1.5-1.5a2.12 2.12 0 0 0-3-3L6 4M7 9l-1.5 1.5a2.12 2.12 0 0 1-3-3L4 6"})}),c?r.title?`${r.title} — ${ae(r.url)}`:r.url:r.title||ae(r.url)]},r.id))}),c&&e.jsxs("div",{className:"idea-card-meta",children:[e.jsx("span",{className:"idea-card-meta-category",style:{color:u?.color},children:u?.label}),e.jsx("span",{className:"idea-card-meta-date",children:new Date(s.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"idea-card-footer",children:[e.jsxs("div",{className:"idea-card-badges",children:[e.jsx("span",{className:"idea-badge effort",style:{borderColor:Z[s.effort]||"#888",color:Z[s.effort]||"#888"},children:s.effort}),e.jsxs("span",{className:"idea-badge impact",style:{borderColor:Y[s.impact]||"#888",color:Y[s.impact]||"#888"},children:[s.impact," impact"]})]}),!s.convertedToTaskId&&e.jsx("button",{className:"idea-card-create-task-btn",onClick:g,title:"Create Kanban task from this idea",children:"+ Create Task"})]}),j&&e.jsx("div",{className:"idea-card-image-preview",onClick:()=>l(null),children:e.jsx("img",{src:j,alt:"Preview"})})]})}function ge({projectId:s,projectPath:n,generateIdeas:h,dismissIdea:g,deleteIdea:m,deleteIdeationSession:c,createKanbanTask:v,convertIdeaToTask:j,createManualIdea:l,updateManualIdea:u}){const[x,N]=i.useState(!1),[M,r]=i.useState(!1),[f,k]=i.useState(),b=O(t=>t.selectedCategory),L=O(t=>t.setSelectedCategory),o=O(t=>s?t.sessions.get(s):void 0),_=O(t=>t.getIdeasByCategory),w=s?_(s,b):[],C=o?.status==="generating"||o?.status==="streaming",R=o?.status==="error",T=o?.ideas.filter(t=>!t.dismissed).length||0,B=i.useCallback(async t=>{!s||!n||(N(!1),await h(s,n,t))},[s,n,h]),S=i.useCallback(async()=>{if(!s||!n)return;const t=o?.enabledCategories;await h(s,n,t,!0)},[s,n,o,h]),X=i.useCallback(async t=>{s&&await g(t,s)},[s,g]),U=i.useCallback(async t=>{!s||!m||await m(t,s)},[s,m]),A=i.useCallback(async t=>{if(!s)return;const y=await v(s,{title:t.title,description:t.description,priority:de(t.impact),columnId:"ideas",tags:[t.category]});y&&(O.getState().updateIdea(s,t.id,{convertedToTaskId:y.id}),j(t.id,s,y.id))},[s,v,j]),G=i.useCallback(async()=>{s&&await c(s)},[s,c]),z=i.useCallback(async t=>{!s||!l||(await l(s,t),r(!1),k(void 0))},[s,l]),P=i.useCallback(async t=>{!s||!f||!u||(await u(f.id,s,t),r(!1),k(void 0))},[s,f,u]),D=i.useCallback(t=>{k(t),r(!0)},[]);return s?e.jsxs("div",{className:"ideation-panel",children:[e.jsxs("div",{className:"ideation-header",children:[e.jsx("div",{className:"ideation-header-left",children:C&&e.jsxs("div",{className:"ideation-generating",children:[e.jsxs("span",{className:"ideation-generating-dots",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsx("span",{className:"ideation-generating-text",children:T>0?`${T} ideas found...`:"Analyzing codebase..."})]})}),e.jsxs("div",{className:"ideation-header-actions",children:[l&&e.jsx("button",{className:"ideation-btn secondary",onClick:()=>{k(void 0),r(!0)},title:"Add your own idea",children:"+ New Idea"}),o&&!C&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"ideation-btn secondary",onClick:S,title:"Add more ideas to current session",children:"+ Add More"}),e.jsx("button",{className:"ideation-btn secondary",onClick:G,title:"Clear all ideas",children:"Clear"})]}),e.jsx("button",{className:"ideation-btn secondary",onClick:()=>N(!0),title:"Configure categories",disabled:C,children:e.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"8",cy:"8",r:"3"}),e.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41"})]})}),!C&&e.jsx("button",{className:"ideation-btn primary",onClick:()=>N(!0),disabled:!n,title:n?"Generate improvement ideas":"Project path required",children:R?"Retry":o?"Regenerate":"Generate Ideas"})]})]}),R&&o?.error&&e.jsx("div",{className:"ideation-error",children:e.jsxs("span",{children:["Error: ",o.error]})}),o&&o.ideas.length>0&&e.jsxs("div",{className:"ideation-category-tabs",children:[e.jsxs("button",{className:`ideation-category-tab ${b===null?"active":""}`,onClick:()=>L(null),children:["All (",T,")"]}),$.map(t=>{const y=o.ideas.filter(W=>!W.dismissed&&W.category===t.id).length;return y===0?null:e.jsxs("button",{className:`ideation-category-tab ${b===t.id?"active":""}`,onClick:()=>L(t.id),style:{"--tab-color":t.color,"--tab-color-rgb":me(t.color)},children:[t.icon," ",t.label," (",y,")"]},t.id)})]}),e.jsx("div",{className:"ideation-ideas-list",children:w.length>0?w.map(t=>e.jsx(he,{idea:t,onDismiss:()=>X(t.id),onDelete:m?()=>U(t.id):void 0,onConvertToTask:()=>A(t),onEdit:t.isManual&&u?()=>D(t):void 0},t.id)):!C&&!o?e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:"💡"}),e.jsx("h3",{children:"Discover Improvements"}),e.jsx("p",{children:'Click "Generate Ideas" to AI-analyze your codebase, or "+ New Idea" to add your own inspiration with images and reference links.'})]}):!C&&o&&w.length===0?e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:b?"🔍":"✅"}),e.jsx("p",{children:b?"No ideas in this category":"No ideas found. Try generating with different categories or add your own."})]}):null}),x&&e.jsx(re,{onGenerate:B,onCancel:()=>N(!1),initialCategories:o?.enabledCategories}),M&&s&&e.jsx(ce,{projectId:s,editingIdea:f,onSave:f?P:z,onCancel:()=>{r(!1),k(void 0)}})]}):e.jsx("div",{className:"ideation-panel",children:e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:"💡"}),e.jsx("p",{children:"Select a project to generate improvement ideas"})]})})}export{ge as IdeationPanel};
1
+ import{a as i,j as e,c as J,l as Q,f as O}from"./index-DQO9MIWG.js";const $=[{id:"code_improvements",label:"Code Improvements",color:"#4ade80",icon:"🔧"},{id:"ui_ux",label:"UI/UX",color:"#60a5fa",icon:"🎨"},{id:"security",label:"Security",color:"#f87171",icon:"🔒"},{id:"performance",label:"Performance",color:"#fbbf24",icon:"⚡"},{id:"documentation",label:"Documentation",color:"#a78bfa",icon:"📝"},{id:"code_quality",label:"Code Quality",color:"#22d3d8",icon:"✨"},{id:"new_features",label:"New Features",color:"#a855f7",icon:"🚀"}];function re({onGenerate:s,onCancel:n,initialCategories:h}){const[g,m]=i.useState(()=>new Set(h||$.map(l=>l.id))),c=l=>{m(u=>{const x=new Set(u);return x.has(l)?x.delete(l):x.add(l),x})},v=()=>m(new Set($.map(l=>l.id))),j=()=>m(new Set);return e.jsx("div",{className:"ideation-config-overlay",onClick:n,children:e.jsxs("div",{className:"ideation-config-dialog",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"ideation-config-header",children:[e.jsx("h3",{children:"Configure Ideation"}),e.jsx("p",{children:"Select the categories to analyze"})]}),e.jsxs("div",{className:"ideation-config-toggles",children:[e.jsx("button",{className:"ideation-config-toggle-btn",onClick:v,children:"Select All"}),e.jsx("button",{className:"ideation-config-toggle-btn",onClick:j,children:"Deselect All"})]}),e.jsx("div",{className:"ideation-config-categories",children:$.map(l=>e.jsxs("label",{className:"ideation-config-category",children:[e.jsx("input",{type:"checkbox",checked:g.has(l.id),onChange:()=>c(l.id)}),e.jsx("span",{className:"ideation-config-category-icon",children:l.icon}),e.jsx("span",{className:"ideation-config-category-label",children:l.label}),e.jsx("span",{className:"ideation-config-category-color",style:{backgroundColor:l.color}})]},l.id))}),e.jsxs("div",{className:"ideation-config-actions",children:[e.jsx("button",{className:"ideation-config-cancel",onClick:n,children:"Cancel"}),e.jsxs("button",{className:"ideation-config-generate",onClick:()=>s(Array.from(g)),disabled:g.size===0,children:["Generate Ideas (",g.size," categories)"]})]})]})})}const V=6,oe=10*1024*1024;function ce({projectId:s,editingIdea:n,onSave:h,onCancel:g}){const[m,c]=i.useState(n?.title||""),[v,j]=i.useState(n?.description||""),[l,u]=i.useState(n?.category||"new_features"),[x,N]=i.useState(n?.effort||"medium"),[M,r]=i.useState(n?.impact||"medium"),[f,k]=i.useState(n?.images||[]),[b,L]=i.useState(n?.links||[]),[o,_]=i.useState(""),[w,C]=i.useState(""),[R,T]=i.useState(!1),[B,S]=i.useState(null),[X,U]=i.useState(!1),A=i.useRef(0),G=i.useRef(null),z=!!n,P=i.useCallback(async a=>{if(!a.type.startsWith("image/")){S("Only image files are supported");return}if(a.size>oe){S("Image must be under 10MB");return}if(f.length>=V){S(`Maximum ${V} images`);return}S(null),T(!0);try{const d=await new Promise((K,le)=>{const H=new FileReader;H.onload=()=>K(H.result),H.onerror=()=>le(new Error("Failed to read image file")),H.readAsDataURL(a)}),p=J(Q()),E=await(await fetch(`${p}/kanban/images`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:d,projectId:s})})).json();if(!E.ok)throw new Error(E.error||"Failed to upload image");const I=E.attachment,ne={id:`img-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,filename:I.filename||a.name,path:I.path||I.url||"",size:a.size,mimeType:a.type,createdAt:Date.now()};k(K=>[...K,ne])}catch(d){S(d instanceof Error?d.message:"Failed to upload image")}finally{T(!1)}},[f.length,s]),D=i.useCallback(a=>{Array.from(a).forEach(d=>P(d))},[P]),t=i.useCallback(a=>{a.preventDefault(),a.stopPropagation(),U(!1),A.current=0,a.dataTransfer.files.length>0&&D(a.dataTransfer.files)},[D]),y=i.useCallback(a=>{const d=a.clipboardData?.items;if(!d)return;const p=[];for(let F=0;F<d.length;F++)if(d[F].type.startsWith("image/")){const E=d[F].getAsFile();E&&p.push(E)}p.length>0&&(a.preventDefault(),D(p))},[D]),W=i.useCallback(a=>{k(d=>d.filter(p=>p.id!==a))},[]),q=i.useCallback(()=>{const a=o.trim();if(!a)return;const d={id:`ref-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,url:a,title:w.trim()||a};L(p=>[...p,d]),_(""),C("")},[o,w]),se=i.useCallback(a=>{L(d=>d.filter(p=>p.id!==a))},[]),te=()=>{m.trim()&&h({title:m.trim(),description:v.trim(),category:l,effort:x,impact:M,images:f,links:b})},ie=a=>{try{return new URL(a).hostname}catch{return a}};return e.jsx("div",{className:"idea-creator-overlay",onClick:g,children:e.jsxs("div",{className:"idea-creator-dialog",onClick:a=>a.stopPropagation(),onPaste:y,children:[e.jsxs("div",{className:"idea-creator-header",children:[e.jsx("h3",{children:z?"Edit Idea":"New Idea"}),e.jsx("p",{children:z?"Update your idea details":"Add your own improvement idea with references"})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Title *"}),e.jsx("input",{type:"text",value:m,onChange:a=>c(a.target.value),placeholder:"What's the idea?",autoFocus:!0,className:"idea-creator-input"})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Description"}),e.jsx("textarea",{value:v,onChange:a=>j(a.target.value),placeholder:"Describe the improvement...",rows:4,className:"idea-creator-textarea"})]}),e.jsxs("div",{className:"idea-creator-selects-row",children:[e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Category"}),e.jsx("select",{value:l,onChange:a=>u(a.target.value),className:"idea-creator-select",children:$.map(a=>e.jsxs("option",{value:a.id,children:[a.icon," ",a.label]},a.id))})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Effort"}),e.jsxs("select",{value:x,onChange:a=>N(a.target.value),className:"idea-creator-select",children:[e.jsx("option",{value:"trivial",children:"Trivial"}),e.jsx("option",{value:"small",children:"Small"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"large",children:"Large"}),e.jsx("option",{value:"complex",children:"Complex"})]})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Impact"}),e.jsxs("select",{value:M,onChange:a=>r(a.target.value),className:"idea-creator-select",children:[e.jsx("option",{value:"low",children:"Low"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Images"}),e.jsxs("div",{className:`idea-creator-dropzone ${X?"drag-over":""}`,onDragEnter:a=>{a.preventDefault(),a.stopPropagation(),A.current++,a.dataTransfer.types.includes("Files")&&U(!0)},onDragLeave:a=>{a.preventDefault(),a.stopPropagation(),A.current--,A.current===0&&U(!1)},onDragOver:a=>{a.preventDefault(),a.stopPropagation()},onDrop:t,onClick:()=>G.current?.click(),children:[e.jsx("input",{ref:G,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:a=>{a.target.files&&D(a.target.files),a.target.value=""}}),R?e.jsx("span",{className:"idea-creator-dropzone-text",children:"Uploading..."}):e.jsx("span",{className:"idea-creator-dropzone-text",children:"Drop images here, paste, or click to browse"})]}),B&&e.jsx("div",{className:"idea-creator-upload-error",children:B}),f.length>0&&e.jsx("div",{className:"idea-creator-image-grid",children:f.map(a=>e.jsxs("div",{className:"idea-creator-image-thumb",children:[e.jsx("img",{src:`${J(Q())}/kanban/images/${a.filename||a.path.split("/").pop()}`,alt:a.filename}),e.jsx("button",{className:"idea-creator-image-remove",onClick:()=>W(a.id),title:"Remove image",children:"×"})]},a.id))})]}),e.jsxs("div",{className:"idea-creator-field",children:[e.jsx("label",{children:"Reference Links"}),e.jsxs("div",{className:"idea-creator-link-input-row",children:[e.jsx("input",{type:"text",value:o,onChange:a=>_(a.target.value),placeholder:"https://...",className:"idea-creator-input",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),q())}}),e.jsx("input",{type:"text",value:w,onChange:a=>C(a.target.value),placeholder:"Title (optional)",className:"idea-creator-input",style:{flex:"0 0 140px"},onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),q())}}),e.jsx("button",{className:"ideation-btn secondary",onClick:q,disabled:!o.trim(),children:"Add"})]}),b.length>0&&e.jsx("div",{className:"idea-creator-link-list",children:b.map(a=>e.jsxs("div",{className:"idea-creator-link-item",children:[e.jsx("span",{className:"idea-creator-link-icon",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"12",height:"12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M6.5 9.5l3-3M9 7l1.5-1.5a2.12 2.12 0 0 0-3-3L6 4M7 9l-1.5 1.5a2.12 2.12 0 0 1-3-3L4 6"})})}),e.jsx("span",{className:"idea-creator-link-title",children:a.title||ie(a.url)}),e.jsx("button",{className:"idea-creator-link-remove",onClick:()=>se(a.id),title:"Remove link",children:"×"})]},a.id))})]}),e.jsxs("div",{className:"idea-creator-actions",children:[e.jsx("button",{className:"ideation-config-cancel",onClick:g,children:"Cancel"}),e.jsx("button",{className:"ideation-config-generate",onClick:te,disabled:!m.trim()||R,children:z?"Save Changes":"Create Idea"})]})]})})}function de(s){switch(s){case"critical":return"urgent";case"high":return"high";case"medium":return"medium";case"low":return"low";default:return"medium"}}function me(s){const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);return n?`${parseInt(n[1],16)}, ${parseInt(n[2],16)}, ${parseInt(n[3],16)}`:"255, 255, 255"}const Z={trivial:"#4ade80",small:"#60a5fa",medium:"#fbbf24",large:"#f97316",complex:"#f87171"},Y={low:"#888",medium:"#fbbf24",high:"#f97316",critical:"#f87171"};function ee(s){const n=J(Q()),h=s.filename||s.path.split("/").pop()||"";return`${n}/kanban/images/${h}`}function ae(s){try{return new URL(s).hostname}catch{return s}}function he({idea:s,onDismiss:n,onDelete:h,onConvertToTask:g,onEdit:m}){const[c,v]=i.useState(!1),[j,l]=i.useState(null),u=$.find(r=>r.id===s.category),x=s.images&&s.images.length>0,N=s.links&&s.links.length>0,M=c?s.images:s.images?.slice(0,3)||[];return e.jsxs("div",{className:`idea-card ${s.convertedToTaskId?"converted":""} ${c?"expanded":""}`,children:[e.jsxs("div",{className:"idea-card-header",children:[e.jsx("span",{className:"idea-card-category-icon",title:u?.label,children:u?.icon||"?"}),e.jsxs("h4",{className:"idea-card-title",onClick:()=>v(!c),children:[s.title,s.isManual&&e.jsx("span",{className:"idea-card-manual-badge",title:"Manual idea",children:"M"}),e.jsx("span",{className:"idea-card-expand-hint",children:c?"▾":"▸"})]}),e.jsx("div",{className:"idea-card-actions",children:s.convertedToTaskId?e.jsxs("span",{className:"idea-card-converted-badge",title:"Converted to task",children:[e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"currentColor",children:e.jsx("path",{d:"M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zm3.78-9.72a.75.75 0 0 0-1.06-1.06L6.75 9.19 5.28 7.72a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l4.5-4.5z"})}),e.jsx("span",{style:{fontSize:11,marginLeft:4},children:"Task created"})]}):e.jsxs(e.Fragment,{children:[s.isManual&&m&&e.jsx("button",{className:"idea-card-action-btn edit",onClick:m,title:"Edit idea",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M11.5 1.5l3 3-9 9H2.5v-3l9-9z"})})}),h&&e.jsx("button",{className:"idea-card-action-btn delete",onClick:h,title:"Delete idea permanently",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M3 4h10M5.5 4V3a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1M6.5 7v5M9.5 7v5M4.5 4l.5 9a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1l.5-9"})})}),e.jsx("button",{className:"idea-card-action-btn dismiss",onClick:n,title:"Dismiss idea (hide)",children:e.jsx("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})})]}),e.jsx("p",{className:`idea-card-description ${c?"expanded":""}`,children:s.description}),x&&e.jsxs("div",{className:`idea-card-images ${c?"expanded":""}`,children:[M.map(r=>e.jsx("div",{className:`idea-card-thumbnail ${c?"large":""}`,onClick:()=>l(ee(r)),title:r.filename,children:e.jsx("img",{src:ee(r),alt:r.filename})},r.id)),!c&&s.images.length>3&&e.jsxs("span",{className:"idea-card-images-overflow",onClick:()=>v(!0),children:["+",s.images.length-3]})]}),N&&e.jsx("div",{className:"idea-card-links",children:s.links.map(r=>e.jsxs("a",{className:`idea-card-link-pill ${c?"expanded":""}`,href:r.url,target:"_blank",rel:"noopener noreferrer",title:r.url,children:[e.jsx("svg",{viewBox:"0 0 16 16",width:"10",height:"10",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:e.jsx("path",{d:"M6.5 9.5l3-3M9 7l1.5-1.5a2.12 2.12 0 0 0-3-3L6 4M7 9l-1.5 1.5a2.12 2.12 0 0 1-3-3L4 6"})}),c?r.title?`${r.title} — ${ae(r.url)}`:r.url:r.title||ae(r.url)]},r.id))}),c&&e.jsxs("div",{className:"idea-card-meta",children:[e.jsx("span",{className:"idea-card-meta-category",style:{color:u?.color},children:u?.label}),e.jsx("span",{className:"idea-card-meta-date",children:new Date(s.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"idea-card-footer",children:[e.jsxs("div",{className:"idea-card-badges",children:[e.jsx("span",{className:"idea-badge effort",style:{borderColor:Z[s.effort]||"#888",color:Z[s.effort]||"#888"},children:s.effort}),e.jsxs("span",{className:"idea-badge impact",style:{borderColor:Y[s.impact]||"#888",color:Y[s.impact]||"#888"},children:[s.impact," impact"]})]}),!s.convertedToTaskId&&e.jsx("button",{className:"idea-card-create-task-btn",onClick:g,title:"Create Kanban task from this idea",children:"+ Create Task"})]}),j&&e.jsx("div",{className:"idea-card-image-preview",onClick:()=>l(null),children:e.jsx("img",{src:j,alt:"Preview"})})]})}function ge({projectId:s,projectPath:n,generateIdeas:h,dismissIdea:g,deleteIdea:m,deleteIdeationSession:c,createKanbanTask:v,convertIdeaToTask:j,createManualIdea:l,updateManualIdea:u}){const[x,N]=i.useState(!1),[M,r]=i.useState(!1),[f,k]=i.useState(),b=O(t=>t.selectedCategory),L=O(t=>t.setSelectedCategory),o=O(t=>s?t.sessions.get(s):void 0),_=O(t=>t.getIdeasByCategory),w=s?_(s,b):[],C=o?.status==="generating"||o?.status==="streaming",R=o?.status==="error",T=o?.ideas.filter(t=>!t.dismissed).length||0,B=i.useCallback(async t=>{!s||!n||(N(!1),await h(s,n,t))},[s,n,h]),S=i.useCallback(async()=>{if(!s||!n)return;const t=o?.enabledCategories;await h(s,n,t,!0)},[s,n,o,h]),X=i.useCallback(async t=>{s&&await g(t,s)},[s,g]),U=i.useCallback(async t=>{!s||!m||await m(t,s)},[s,m]),A=i.useCallback(async t=>{if(!s)return;const y=await v(s,{title:t.title,description:t.description,priority:de(t.impact),columnId:"ideas",tags:[t.category]});y&&(O.getState().updateIdea(s,t.id,{convertedToTaskId:y.id}),j(t.id,s,y.id))},[s,v,j]),G=i.useCallback(async()=>{s&&await c(s)},[s,c]),z=i.useCallback(async t=>{!s||!l||(await l(s,t),r(!1),k(void 0))},[s,l]),P=i.useCallback(async t=>{!s||!f||!u||(await u(f.id,s,t),r(!1),k(void 0))},[s,f,u]),D=i.useCallback(t=>{k(t),r(!0)},[]);return s?e.jsxs("div",{className:"ideation-panel",children:[e.jsxs("div",{className:"ideation-header",children:[e.jsx("div",{className:"ideation-header-left",children:C&&e.jsxs("div",{className:"ideation-generating",children:[e.jsxs("span",{className:"ideation-generating-dots",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]}),e.jsx("span",{className:"ideation-generating-text",children:T>0?`${T} ideas found...`:"Analyzing codebase..."})]})}),e.jsxs("div",{className:"ideation-header-actions",children:[l&&e.jsx("button",{className:"ideation-btn secondary",onClick:()=>{k(void 0),r(!0)},title:"Add your own idea",children:"+ New Idea"}),o&&!C&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"ideation-btn secondary",onClick:S,title:"Add more ideas to current session",children:"+ Add More"}),e.jsx("button",{className:"ideation-btn secondary",onClick:G,title:"Clear all ideas",children:"Clear"})]}),e.jsx("button",{className:"ideation-btn secondary",onClick:()=>N(!0),title:"Configure categories",disabled:C,children:e.jsxs("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("circle",{cx:"8",cy:"8",r:"3"}),e.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.41 1.41M11.54 11.54l1.41 1.41M3.05 12.95l1.41-1.41M11.54 4.46l1.41-1.41"})]})}),!C&&e.jsx("button",{className:"ideation-btn primary",onClick:()=>N(!0),disabled:!n,title:n?"Generate improvement ideas":"Project path required",children:R?"Retry":o?"Regenerate":"Generate Ideas"})]})]}),R&&o?.error&&e.jsx("div",{className:"ideation-error",children:e.jsxs("span",{children:["Error: ",o.error]})}),o&&o.ideas.length>0&&e.jsxs("div",{className:"ideation-category-tabs",children:[e.jsxs("button",{className:`ideation-category-tab ${b===null?"active":""}`,onClick:()=>L(null),children:["All (",T,")"]}),$.map(t=>{const y=o.ideas.filter(W=>!W.dismissed&&W.category===t.id).length;return y===0?null:e.jsxs("button",{className:`ideation-category-tab ${b===t.id?"active":""}`,onClick:()=>L(t.id),style:{"--tab-color":t.color,"--tab-color-rgb":me(t.color)},children:[t.icon," ",t.label," (",y,")"]},t.id)})]}),e.jsx("div",{className:"ideation-ideas-list",children:w.length>0?w.map(t=>e.jsx(he,{idea:t,onDismiss:()=>X(t.id),onDelete:m?()=>U(t.id):void 0,onConvertToTask:()=>A(t),onEdit:t.isManual&&u?()=>D(t):void 0},t.id)):!C&&!o?e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:"💡"}),e.jsx("h3",{children:"Discover Improvements"}),e.jsx("p",{children:'Click "Generate Ideas" to AI-analyze your codebase, or "+ New Idea" to add your own inspiration with images and reference links.'})]}):!C&&o&&w.length===0?e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:b?"🔍":"✅"}),e.jsx("p",{children:b?"No ideas in this category":"No ideas found. Try generating with different categories or add your own."})]}):null}),x&&e.jsx(re,{onGenerate:B,onCancel:()=>N(!1),initialCategories:o?.enabledCategories}),M&&s&&e.jsx(ce,{projectId:s,editingIdea:f,onSave:f?P:z,onCancel:()=>{r(!1),k(void 0)}})]}):e.jsx("div",{className:"ideation-panel",children:e.jsxs("div",{className:"ideation-empty-state",children:[e.jsx("span",{className:"ideation-empty-icon",children:"💡"}),e.jsx("p",{children:"Select a project to generate improvement ideas"})]})})}export{ge as IdeationPanel};
@@ -1,4 +1,4 @@
1
- import{r as Ao,a as k,R as de,j as b,u as fn,b as Ki,g as Gi,c as Hr,l as qr,K as tr,d as Ot}from"./index-B6Eylck2.js";var ft=Ao();function To(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Et(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function gr(e){return"nodeType"in e}function Ne(e){var t,n;return e?Et(e)?e:gr(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function br(e){const{Document:t}=Ne(e);return e instanceof t}function Kt(e){return Et(e)?!1:e instanceof Ne(e).HTMLElement}function Ji(e){return e instanceof Ne(e).SVGElement}function It(e){return e?Et(e)?e.document:gr(e)?br(e)?e:Kt(e)||Ji(e)?e.ownerDocument:document:document:document}const Ve=vn?k.useLayoutEffect:k.useEffect;function Cn(e){const t=k.useRef(e);return Ve(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function No(){const e=k.useRef(null),t=k.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vt(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Ve(()=>{n.current!==e&&(n.current=e)},t),n}function Gt(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function dn(e){const t=Cn(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,r]}function hn(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let On={};function Jt(e,t){return k.useMemo(()=>{if(t)return t;const n=On[e]==null?0:On[e]+1;return On[e]=n,e+"-"+n},[e,t])}function Qi(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((l,o)=>{const a=Object.entries(o);for(const[s,u]of a){const f=l[s];f!=null&&(l[s]=f+e*u)}return l},{...t})}}const vt=Qi(1),pn=Qi(-1);function Ro(e){return"clientX"in e&&"clientY"in e}function Sn(e){if(!e)return!1;const{KeyboardEvent:t}=Ne(e.target);return t&&e instanceof t}function Po(e){if(!e)return!1;const{TouchEvent:t}=Ne(e.target);return t&&e instanceof t}function mn(e){if(Po(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ro(e)?{x:e.clientX,y:e.clientY}:null}const st=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[st.Translate.toString(e),st.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Vr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Lo(e){return e.matches(Vr)?e:e.querySelector(Vr)}const Oo={display:"none"};function jo(e){let{id:t,value:n}=e;return de.createElement("div",{id:t,style:Oo},n)}function zo(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return de.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Mo(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Zi=k.createContext(null);function Fo(e){const t=k.useContext(Zi);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function _o(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:l}=r;e.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,l)})},[e]),t]}const Bo={draggable:`
1
+ import{r as Ao,a as k,R as de,j as b,u as fn,b as Ki,g as Gi,c as Hr,l as qr,K as tr,d as Ot}from"./index-DQO9MIWG.js";var ft=Ao();function To(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return k.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const vn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Et(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function gr(e){return"nodeType"in e}function Ne(e){var t,n;return e?Et(e)?e:gr(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function br(e){const{Document:t}=Ne(e);return e instanceof t}function Kt(e){return Et(e)?!1:e instanceof Ne(e).HTMLElement}function Ji(e){return e instanceof Ne(e).SVGElement}function It(e){return e?Et(e)?e.document:gr(e)?br(e)?e:Kt(e)||Ji(e)?e.ownerDocument:document:document:document}const Ve=vn?k.useLayoutEffect:k.useEffect;function Cn(e){const t=k.useRef(e);return Ve(()=>{t.current=e}),k.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function No(){const e=k.useRef(null),t=k.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=k.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vt(e,t){t===void 0&&(t=[e]);const n=k.useRef(e);return Ve(()=>{n.current!==e&&(n.current=e)},t),n}function Gt(e,t){const n=k.useRef();return k.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function dn(e){const t=Cn(e),n=k.useRef(null),r=k.useCallback(i=>{i!==n.current&&t?.(i,n.current),n.current=i},[]);return[n,r]}function hn(e){const t=k.useRef();return k.useEffect(()=>{t.current=e},[e]),t.current}let On={};function Jt(e,t){return k.useMemo(()=>{if(t)return t;const n=On[e]==null?0:On[e]+1;return On[e]=n,e+"-"+n},[e,t])}function Qi(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((l,o)=>{const a=Object.entries(o);for(const[s,u]of a){const f=l[s];f!=null&&(l[s]=f+e*u)}return l},{...t})}}const vt=Qi(1),pn=Qi(-1);function Ro(e){return"clientX"in e&&"clientY"in e}function Sn(e){if(!e)return!1;const{KeyboardEvent:t}=Ne(e.target);return t&&e instanceof t}function Po(e){if(!e)return!1;const{TouchEvent:t}=Ne(e.target);return t&&e instanceof t}function mn(e){if(Po(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Ro(e)?{x:e.clientX,y:e.clientY}:null}const st=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[st.Translate.toString(e),st.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Vr="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Lo(e){return e.matches(Vr)?e:e.querySelector(Vr)}const Oo={display:"none"};function jo(e){let{id:t,value:n}=e;return de.createElement("div",{id:t,style:Oo},n)}function zo(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return de.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Mo(){const[e,t]=k.useState("");return{announce:k.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Zi=k.createContext(null);function Fo(e){const t=k.useContext(Zi);k.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function _o(){const[e]=k.useState(()=>new Set),t=k.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[k.useCallback(r=>{let{type:i,event:l}=r;e.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,l)})},[e]),t]}const Bo={draggable:`
2
2
  To pick up a draggable item, press the space bar.
3
3
  While dragging, use the arrow keys to move the item.
4
4
  Press space again to drop the item in its new position, or press escape to cancel.
@@ -1 +1 @@
1
- import{a as d,j as e}from"./index-B6Eylck2.js";function w({projectId:s,getProjectState:c,cleanupOrphanedWorktrees:a,onSelectAgent:i}){const[n,t]=d.useState("overview"),[r,x]=d.useState(null),[m,j]=d.useState(!1),[u,o]=d.useState(null),[N,p]=d.useState(!1),h=d.useCallback(async()=>{if(!s){console.log("[ProjectStatePanel] No projectId, clearing state"),x(null);return}console.log("[ProjectStatePanel] Fetching state for project:",s),j(!0),o(null);try{const l=await c(s);console.log("[ProjectStatePanel] Received state:",l),x(l)}catch(l){console.error("[ProjectStatePanel] Error fetching state:",l),o(l instanceof Error?l.message:"Failed to fetch project state")}finally{j(!1)}},[s,c]);d.useEffect(()=>{h()},[h]);const v=async()=>{if(!(!s||N)){p(!0);try{const l=await a(s);l.ok?await h():o(l.error||"Failed to cleanup worktrees")}catch(l){o(l instanceof Error?l.message:"Failed to cleanup worktrees")}finally{p(!1)}}};return s?m&&!r?e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:"Loading project state..."})]})}):u&&!r?e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-error",children:[e.jsx("span",{className:"error-icon",children:"⚠️"}),e.jsx("p",{children:u}),e.jsx("button",{onClick:h,className:"retry-btn",children:"Retry"})]})}):e.jsxs("div",{className:"project-state-panel",children:[e.jsxs("div",{className:"state-tabs",children:[e.jsx("button",{className:`state-tab ${n==="overview"?"active":""}`,onClick:()=>t("overview"),children:"Overview"}),e.jsxs("button",{className:`state-tab ${n==="worktrees"?"active":""}`,onClick:()=>t("worktrees"),children:["Worktrees",r?.healthSummary.orphanedWorktrees?e.jsx("span",{className:"tab-badge warning",children:r.healthSummary.orphanedWorktrees}):null]}),e.jsx("button",{className:`state-tab ${n==="tmux"?"active":""}`,onClick:()=>t("tmux"),children:"Tmux"}),e.jsx("button",{className:"refresh-btn",onClick:h,disabled:m,title:"Refresh",children:m?"...":"↻"})]}),e.jsxs("div",{className:"state-content",children:[n==="overview"&&r&&e.jsx(g,{mainBranch:r.mainBranch,healthSummary:r.healthSummary}),n==="worktrees"&&r&&e.jsx(b,{worktrees:r.worktrees,onSelectAgent:i,onCleanup:v,cleaning:N}),n==="tmux"&&r&&e.jsx(f,{sessions:r.tmuxSessions,onSelectAgent:i})]})]}):e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-empty",children:[e.jsx("span",{className:"empty-icon",children:"📂"}),e.jsx("p",{children:"No project selected"}),e.jsx("p",{className:"empty-hint",children:"Select a project to view its state"})]})})}function g({mainBranch:s,healthSummary:c}){const a=n=>{switch(n){case"synced":return"success";case"ahead":return"info";case"behind":return"warning";case"diverged":return"error";default:return"neutral"}},i=n=>{switch(n){case"synced":return"✓";case"ahead":return"↑";case"behind":return"↓";case"diverged":return"⇅";default:return"?"}};return e.jsxs("div",{className:"overview-tab",children:[e.jsxs("div",{className:"state-card",children:[e.jsxs("div",{className:"card-header",children:[e.jsx("span",{className:"card-icon",children:"🌿"}),e.jsx("span",{className:"card-title",children:"Main Branch"})]}),e.jsxs("div",{className:"card-content",children:[e.jsxs("div",{className:"branch-info",children:[e.jsx("span",{className:"branch-name",children:s.branch}),e.jsxs("span",{className:`sync-badge ${a(s.syncStatus)}`,children:[i(s.syncStatus)," ",s.syncStatus]})]}),(s.ahead>0||s.behind>0)&&e.jsxs("div",{className:"sync-details",children:[s.ahead>0&&e.jsxs("span",{className:"ahead",children:["↑ ",s.ahead," ahead"]}),s.behind>0&&e.jsxs("span",{className:"behind",children:["↓ ",s.behind," behind"]})]}),s.uncommittedChanges>0&&e.jsx("div",{className:"uncommitted-changes",children:e.jsxs("span",{className:"warning-text",children:["⚠ ",s.uncommittedChanges," uncommitted changes"]})}),s.lastCommit&&e.jsxs("div",{className:"last-commit",children:[e.jsx("span",{className:"commit-sha",children:s.lastCommit.sha}),e.jsx("span",{className:"commit-message",children:s.lastCommit.message})]})]})]}),e.jsxs("div",{className:"state-card",children:[e.jsxs("div",{className:"card-header",children:[e.jsx("span",{className:"card-icon",children:"📊"}),e.jsx("span",{className:"card-title",children:"Health Summary"})]}),e.jsx("div",{className:"card-content",children:e.jsxs("div",{className:"health-grid",children:[e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:c.activeAgents}),e.jsx("span",{className:"health-label",children:"Active Agents"})]}),e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:c.offlineAgents}),e.jsx("span",{className:"health-label",children:"Offline Agents"})]}),e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:c.totalWorktrees}),e.jsx("span",{className:"health-label",children:"Worktrees"})]}),e.jsxs("div",{className:`health-item ${c.orphanedWorktrees>0?"warning":""}`,children:[e.jsx("span",{className:"health-value",children:c.orphanedWorktrees}),e.jsx("span",{className:"health-label",children:"Orphaned"})]})]})})]})]})}function b({worktrees:s,onSelectAgent:c,onCleanup:a,cleaning:i}){const n=s.filter(t=>t.isOrphaned).length;return e.jsxs("div",{className:"worktrees-tab",children:[n>0&&e.jsxs("div",{className:"cleanup-banner",children:[e.jsxs("span",{className:"warning-text",children:["⚠ ",n," orphaned worktree",n>1?"s":""," detected"]}),e.jsx("button",{className:"cleanup-btn",onClick:a,disabled:i,children:i?"Cleaning...":"Clean Up"})]}),e.jsx("div",{className:"worktrees-list",children:s.length===0?e.jsx("div",{className:"empty-list",children:"No worktrees found"}):s.map(t=>e.jsxs("div",{className:`worktree-item ${t.isOrphaned?"orphaned":""} ${t.isMain?"main":""}`,onClick:()=>t.agentId&&c?.(t.agentId),style:{cursor:t.agentId?"pointer":"default"},children:[e.jsxs("div",{className:"worktree-header",children:[e.jsxs("span",{className:"worktree-branch",children:[t.isMain?"🌿 ":"🔀 ",t.branch||"detached"]}),t.isMain&&e.jsx("span",{className:"main-badge",children:"main"}),t.isOrphaned&&e.jsx("span",{className:"orphaned-badge",children:"orphaned"})]}),e.jsxs("div",{className:"worktree-details",children:[e.jsx("span",{className:"worktree-path",title:t.path,children:t.path.split("/").slice(-2).join("/")}),e.jsx("span",{className:"worktree-commit",children:t.commit})]}),t.agentName&&e.jsxs("div",{className:"worktree-agent",children:[e.jsx("span",{className:"agent-indicator",children:"●"}),e.jsx("span",{className:"agent-name",children:t.agentName})]})]},t.path))})]})}function f({sessions:s,onSelectAgent:c}){return e.jsx("div",{className:"tmux-tab",children:e.jsx("div",{className:"tmux-list",children:s.length===0?e.jsx("div",{className:"empty-list",children:"No tmux sessions found"}):s.map(a=>e.jsxs("div",{className:`tmux-item ${a.status==="offline"?"offline":"active"}`,onClick:()=>a.agentId&&c?.(a.agentId),style:{cursor:a.agentId?"pointer":"default"},children:[e.jsxs("div",{className:"tmux-header",children:[e.jsx("span",{className:"tmux-name",children:a.sessionName}),e.jsxs("span",{className:`tmux-status ${a.status}`,children:[a.status==="active"?"●":"○"," ",a.status]})]}),a.agentName&&e.jsxs("div",{className:"tmux-agent",children:[e.jsx("span",{className:"agent-indicator",children:"👤"}),e.jsx("span",{className:"agent-name",children:a.agentName})]}),a.cwd&&e.jsx("div",{className:"tmux-cwd",children:e.jsx("span",{className:"cwd-path",title:a.cwd,children:a.cwd.split("/").slice(-2).join("/")})}),e.jsx("div",{className:"tmux-meta",children:a.attached&&e.jsx("span",{className:"attached-badge",children:"attached"})})]},a.sessionName))})})}export{w as ProjectStatePanel};
1
+ import{a as d,j as e}from"./index-DQO9MIWG.js";function y({projectId:s,getProjectState:l,cleanupOrphanedWorktrees:t,onSelectAgent:i}){const[n,a]=d.useState("overview"),[r,x]=d.useState(null),[m,j]=d.useState(!1),[p,o]=d.useState(null),[N,u]=d.useState(!1),h=d.useCallback(async()=>{if(!s){console.log("[ProjectStatePanel] No projectId, clearing state"),x(null);return}console.log("[ProjectStatePanel] Fetching state for project:",s),j(!0),o(null);try{const c=await l(s);console.log("[ProjectStatePanel] Received state:",c),x(c)}catch(c){console.error("[ProjectStatePanel] Error fetching state:",c),o(c instanceof Error?c.message:"Failed to fetch project state")}finally{j(!1)}},[s,l]);d.useEffect(()=>{h()},[h]);const v=async()=>{if(!(!s||N)){u(!0);try{const c=await t(s);c.ok?await h():o(c.error||"Failed to cleanup worktrees")}catch(c){o(c instanceof Error?c.message:"Failed to cleanup worktrees")}finally{u(!1)}}};return s?m&&!r?e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-loading",children:[e.jsx("div",{className:"loading-spinner"}),e.jsx("p",{children:"Loading project state..."})]})}):p&&!r?e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-error",children:[e.jsx("span",{className:"error-icon",children:"⚠️"}),e.jsx("p",{children:p}),e.jsx("button",{onClick:h,className:"retry-btn",children:"Retry"})]})}):e.jsxs("div",{className:"project-state-panel",children:[e.jsxs("div",{className:"state-tabs",children:[e.jsx("button",{className:`state-tab ${n==="overview"?"active":""}`,onClick:()=>a("overview"),children:"Overview"}),e.jsxs("button",{className:`state-tab ${n==="worktrees"?"active":""}`,onClick:()=>a("worktrees"),children:["Worktrees",r?.healthSummary.orphanedWorktrees?e.jsx("span",{className:"tab-badge warning",children:r.healthSummary.orphanedWorktrees}):null]}),e.jsx("button",{className:`state-tab ${n==="tmux"?"active":""}`,onClick:()=>a("tmux"),children:"Tmux"}),e.jsx("button",{className:"refresh-btn",onClick:h,disabled:m,title:"Refresh",children:m?"...":"↻"})]}),e.jsxs("div",{className:"state-content",children:[n==="overview"&&r&&e.jsx(g,{mainBranch:r.mainBranch,healthSummary:r.healthSummary}),n==="worktrees"&&r&&e.jsx(b,{worktrees:r.worktrees,onSelectAgent:i,onCleanup:v,cleaning:N}),n==="tmux"&&r&&e.jsx(f,{sessions:r.tmuxSessions,onSelectAgent:i})]})]}):e.jsx("div",{className:"project-state-panel",children:e.jsxs("div",{className:"project-state-empty",children:[e.jsx("span",{className:"empty-icon",children:"📂"}),e.jsx("p",{children:"No project selected"}),e.jsx("p",{className:"empty-hint",children:"Select a project to view its state"})]})})}function g({mainBranch:s,healthSummary:l}){const t=n=>{switch(n){case"synced":return"success";case"ahead":return"info";case"behind":return"warning";case"diverged":return"error";default:return"neutral"}},i=n=>{switch(n){case"synced":return"✓";case"ahead":return"↑";case"behind":return"↓";case"diverged":return"⇅";default:return"?"}};return e.jsxs("div",{className:"overview-tab",children:[e.jsxs("div",{className:"state-card",children:[e.jsxs("div",{className:"card-header",children:[e.jsx("span",{className:"card-icon",children:"🌿"}),e.jsx("span",{className:"card-title",children:"Main Branch"})]}),e.jsxs("div",{className:"card-content",children:[e.jsxs("div",{className:"branch-info",children:[e.jsx("span",{className:"branch-name",children:s.branch}),e.jsxs("span",{className:`sync-badge ${t(s.syncStatus)}`,children:[i(s.syncStatus)," ",s.syncStatus]})]}),(s.ahead>0||s.behind>0)&&e.jsxs("div",{className:"sync-details",children:[s.ahead>0&&e.jsxs("span",{className:"ahead",children:["↑ ",s.ahead," ahead"]}),s.behind>0&&e.jsxs("span",{className:"behind",children:["↓ ",s.behind," behind"]})]}),s.uncommittedChanges>0&&e.jsx("div",{className:"uncommitted-changes",children:e.jsxs("span",{className:"warning-text",children:["⚠ ",s.uncommittedChanges," uncommitted changes"]})}),s.lastCommit&&e.jsxs("div",{className:"last-commit",children:[e.jsx("span",{className:"commit-sha",children:s.lastCommit.sha}),e.jsx("span",{className:"commit-message",children:s.lastCommit.message})]})]})]}),e.jsxs("div",{className:"state-card",children:[e.jsxs("div",{className:"card-header",children:[e.jsx("span",{className:"card-icon",children:"📊"}),e.jsx("span",{className:"card-title",children:"Health Summary"})]}),e.jsx("div",{className:"card-content",children:e.jsxs("div",{className:"health-grid",children:[e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:l.activeAgents}),e.jsx("span",{className:"health-label",children:"Active Agents"})]}),e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:l.offlineAgents}),e.jsx("span",{className:"health-label",children:"Offline Agents"})]}),e.jsxs("div",{className:"health-item",children:[e.jsx("span",{className:"health-value",children:l.totalWorktrees}),e.jsx("span",{className:"health-label",children:"Worktrees"})]}),e.jsxs("div",{className:`health-item ${l.orphanedWorktrees>0?"warning":""}`,children:[e.jsx("span",{className:"health-value",children:l.orphanedWorktrees}),e.jsx("span",{className:"health-label",children:"Orphaned"})]})]})})]})]})}function b({worktrees:s,onSelectAgent:l,onCleanup:t,cleaning:i}){const n=s.filter(a=>a.isOrphaned).length;return e.jsxs("div",{className:"worktrees-tab",children:[n>0&&e.jsxs("div",{className:"cleanup-banner",children:[e.jsxs("span",{className:"warning-text",children:["⚠ ",n," orphaned worktree",n>1?"s":""," detected"]}),e.jsx("button",{className:"cleanup-btn",onClick:t,disabled:i,children:i?"Cleaning...":"Clean Up"})]}),e.jsx("div",{className:"worktrees-list",children:s.length===0?e.jsx("div",{className:"empty-list",children:"No worktrees found"}):s.map(a=>e.jsxs("div",{className:`worktree-item ${a.isOrphaned?"orphaned":""} ${a.isMain?"main":""}`,onClick:()=>a.agentId&&l?.(a.agentId),style:{cursor:a.agentId?"pointer":"default"},children:[e.jsxs("div",{className:"worktree-header",children:[e.jsxs("span",{className:"worktree-branch",children:[a.isMain?"🌿 ":"🔀 ",a.branch||"detached"]}),a.isMain&&e.jsx("span",{className:"main-badge",children:"main"}),a.pipelineTaskId&&e.jsx("span",{className:"pipeline-badge",children:"pipeline"}),a.isOrphaned&&e.jsx("span",{className:"orphaned-badge",children:"orphaned"})]}),e.jsxs("div",{className:"worktree-details",children:[e.jsx("span",{className:"worktree-path",title:a.path,children:a.path.split("/").slice(-2).join("/")}),e.jsx("span",{className:"worktree-commit",children:a.commit})]}),a.agentName&&e.jsxs("div",{className:"worktree-agent",children:[e.jsx("span",{className:"agent-indicator",children:"●"}),e.jsx("span",{className:"agent-name",children:a.agentName})]}),a.pipelineTaskId&&!a.agentName&&e.jsxs("div",{className:"worktree-agent",children:[e.jsx("span",{className:"agent-indicator",style:{color:"#a78bfa"},children:"⑂"}),e.jsx("span",{className:"agent-name",style:{color:"#a78bfa"},children:"Pipeline task"})]})]},a.path))})]})}function f({sessions:s,onSelectAgent:l}){return e.jsx("div",{className:"tmux-tab",children:e.jsx("div",{className:"tmux-list",children:s.length===0?e.jsx("div",{className:"empty-list",children:"No tmux sessions found"}):s.map(t=>e.jsxs("div",{className:`tmux-item ${t.status==="offline"?"offline":"active"}`,onClick:()=>t.agentId&&l?.(t.agentId),style:{cursor:t.agentId?"pointer":"default"},children:[e.jsxs("div",{className:"tmux-header",children:[e.jsx("span",{className:"tmux-name",children:t.sessionName}),e.jsxs("span",{className:`tmux-status ${t.status}`,children:[t.status==="active"?"●":"○"," ",t.status]})]}),t.agentName&&e.jsxs("div",{className:"tmux-agent",children:[e.jsx("span",{className:"agent-indicator",children:"👤"}),e.jsx("span",{className:"agent-name",children:t.agentName})]}),t.cwd&&e.jsx("div",{className:"tmux-cwd",children:e.jsx("span",{className:"cwd-path",title:t.cwd,children:t.cwd.split("/").slice(-2).join("/")})}),e.jsx("div",{className:"tmux-meta",children:t.attached&&e.jsx("span",{className:"attached-badge",children:"attached"})})]},t.sessionName))})})}export{y as ProjectStatePanel};
@@ -1 +1 @@
1
- .project-state-panel{display:flex;flex-direction:column;height:100%;color:#e0e0e0;font-size:.85rem}.project-state-empty,.project-state-loading,.project-state-error{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:20px;text-align:center;color:#888}.empty-icon,.error-icon{font-size:2rem;margin-bottom:12px}.empty-hint{font-size:.75rem;color:#666;margin-top:4px}.loading-spinner{width:24px;height:24px;border:2px solid #333;border-top-color:#0ff;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:12px}@keyframes spin{to{transform:rotate(360deg)}}.retry-btn{margin-top:12px;padding:6px 16px;background:#0ff2;border:1px solid #00ffff44;border-radius:6px;color:#0ff;cursor:pointer;font-size:.8rem;transition:all .15s ease}.retry-btn:hover{background:#0ff3;border-color:#0ff6}.state-tabs{display:flex;gap:4px;padding:8px;border-bottom:1px solid #2a2a3a;background:#0003}.state-tab{padding:6px 12px;background:transparent;border:none;border-radius:6px;color:#888;font-size:.8rem;cursor:pointer;transition:all .15s ease;display:flex;align-items:center;gap:6px}.state-tab:hover{background:#ffffff0d;color:#aaa}.state-tab.active{background:#00ffff1a;color:#0ff}.tab-badge{padding:2px 6px;border-radius:10px;font-size:.7rem;font-weight:600}.tab-badge.warning{background:#fa03;color:#fa0}.refresh-btn{margin-left:auto;padding:6px 10px;background:transparent;border:1px solid #333;border-radius:6px;color:#888;cursor:pointer;font-size:.85rem;transition:all .15s ease}.refresh-btn:hover:not(:disabled){background:#ffffff0d;color:#aaa;border-color:#444}.refresh-btn:disabled{opacity:.5;cursor:not-allowed}.state-content{flex:1;overflow-y:auto;padding:12px}.overview-tab{display:flex;flex-direction:column;gap:12px}.state-card{background:#0000004d;border:1px solid #2a2a3a;border-radius:8px;overflow:hidden}.card-header{display:flex;align-items:center;gap:8px;padding:10px 12px;background:#0003;border-bottom:1px solid #2a2a3a}.card-icon{font-size:1rem}.card-title{font-weight:600;color:#fff;font-size:.85rem}.card-content{padding:12px}.branch-info{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.branch-name{font-family:SF Mono,Consolas,monospace;font-size:.85rem;color:#fff}.sync-badge{padding:3px 8px;border-radius:12px;font-size:.7rem;font-weight:600;text-transform:uppercase}.sync-badge.success{background:#00c86433;color:#00c864}.sync-badge.info{background:#00c8ff33;color:#00c8ff}.sync-badge.warning{background:#fa03;color:#fa0}.sync-badge.error{background:#ff505033;color:#ff5050}.sync-badge.neutral{background:#80808033;color:#888}.sync-details{display:flex;gap:12px;font-size:.75rem;color:#888;margin-bottom:8px}.sync-details .ahead{color:#00c8ff}.sync-details .behind{color:#fa0}.uncommitted-changes{margin-bottom:8px}.warning-text{color:#fa0;font-size:.8rem}.last-commit{display:flex;flex-direction:column;gap:4px;padding-top:8px;border-top:1px solid #2a2a3a}.commit-sha{font-family:SF Mono,Consolas,monospace;font-size:.75rem;color:#888}.commit-message{font-size:.8rem;color:#aaa;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.health-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.health-item{display:flex;flex-direction:column;align-items:center;padding:12px;background:#0003;border-radius:8px;border:1px solid #2a2a3a}.health-item.warning{border-color:#fa04;background:#ffaa000d}.health-value{font-size:1.5rem;font-weight:700;color:#fff}.health-item.warning .health-value{color:#fa0}.health-label{font-size:.7rem;color:#888;text-transform:uppercase;margin-top:4px}.worktrees-tab{display:flex;flex-direction:column;gap:12px}.cleanup-banner{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:#ffaa001a;border:1px solid #ffaa0044;border-radius:8px}.cleanup-btn{padding:6px 12px;background:#fa02;border:1px solid #ffaa0044;border-radius:6px;color:#fa0;font-size:.75rem;font-weight:600;cursor:pointer;transition:all .15s ease}.cleanup-btn:hover:not(:disabled){background:#fa03;border-color:#fa06}.cleanup-btn:disabled{opacity:.6;cursor:not-allowed}.worktrees-list,.tmux-list{display:flex;flex-direction:column;gap:8px}.empty-list{text-align:center;padding:20px;color:#666;font-size:.8rem}.worktree-item,.tmux-item{padding:10px 12px;background:#0000004d;border:1px solid #2a2a3a;border-radius:8px;transition:all .15s ease}.worktree-item:hover,.tmux-item:hover{background:#0006;border-color:#3a3a4a}.worktree-item.main{border-color:#0ff3;background:#00ffff0d}.worktree-item.orphaned{border-color:#fa04;background:#ffaa000d}.tmux-item.offline{opacity:.6}.worktree-header,.tmux-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.worktree-branch,.tmux-name{font-weight:600;font-size:.85rem;color:#fff}.main-badge,.orphaned-badge,.attached-badge{padding:2px 6px;border-radius:10px;font-size:.65rem;font-weight:600;text-transform:uppercase}.main-badge{background:#0ff3;color:#0ff}.orphaned-badge{background:#fa03;color:#fa0}.attached-badge{background:#64c86433;color:#64c864}.worktree-details{display:flex;align-items:center;justify-content:space-between;font-size:.75rem;color:#888;margin-bottom:4px}.worktree-path,.cwd-path{font-family:SF Mono,Consolas,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.worktree-commit{font-family:SF Mono,Consolas,monospace;color:#666}.worktree-agent,.tmux-agent{display:flex;align-items:center;gap:6px;font-size:.8rem;color:#0ff}.agent-indicator{font-size:.7rem}.tmux-tab{display:flex;flex-direction:column;gap:8px}.tmux-status{font-size:.75rem}.tmux-status.active{color:#64c864}.tmux-status.offline{color:#888}.tmux-cwd{font-size:.75rem;color:#888;margin-top:4px}.tmux-meta{display:flex;gap:6px;margin-top:6px}
1
+ .project-state-panel{display:flex;flex-direction:column;height:100%;color:#e0e0e0;font-size:.85rem}.project-state-empty,.project-state-loading,.project-state-error{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;padding:20px;text-align:center;color:#888}.empty-icon,.error-icon{font-size:2rem;margin-bottom:12px}.empty-hint{font-size:.75rem;color:#666;margin-top:4px}.loading-spinner{width:24px;height:24px;border:2px solid #333;border-top-color:#0ff;border-radius:50%;animation:spin 1s linear infinite;margin-bottom:12px}@keyframes spin{to{transform:rotate(360deg)}}.retry-btn{margin-top:12px;padding:6px 16px;background:#0ff2;border:1px solid #00ffff44;border-radius:6px;color:#0ff;cursor:pointer;font-size:.8rem;transition:all .15s ease}.retry-btn:hover{background:#0ff3;border-color:#0ff6}.state-tabs{display:flex;gap:4px;padding:8px;border-bottom:1px solid #2a2a3a;background:#0003}.state-tab{padding:6px 12px;background:transparent;border:none;border-radius:6px;color:#888;font-size:.8rem;cursor:pointer;transition:all .15s ease;display:flex;align-items:center;gap:6px}.state-tab:hover{background:#ffffff0d;color:#aaa}.state-tab.active{background:#00ffff1a;color:#0ff}.tab-badge{padding:2px 6px;border-radius:10px;font-size:.7rem;font-weight:600}.tab-badge.warning{background:#fa03;color:#fa0}.refresh-btn{margin-left:auto;padding:6px 10px;background:transparent;border:1px solid #333;border-radius:6px;color:#888;cursor:pointer;font-size:.85rem;transition:all .15s ease}.refresh-btn:hover:not(:disabled){background:#ffffff0d;color:#aaa;border-color:#444}.refresh-btn:disabled{opacity:.5;cursor:not-allowed}.state-content{flex:1;overflow-y:auto;padding:12px}.overview-tab{display:flex;flex-direction:column;gap:12px}.state-card{background:#0000004d;border:1px solid #2a2a3a;border-radius:8px;overflow:hidden}.card-header{display:flex;align-items:center;gap:8px;padding:10px 12px;background:#0003;border-bottom:1px solid #2a2a3a}.card-icon{font-size:1rem}.card-title{font-weight:600;color:#fff;font-size:.85rem}.card-content{padding:12px}.branch-info{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:8px}.branch-name{font-family:SF Mono,Consolas,monospace;font-size:.85rem;color:#fff}.sync-badge{padding:3px 8px;border-radius:12px;font-size:.7rem;font-weight:600;text-transform:uppercase}.sync-badge.success{background:#00c86433;color:#00c864}.sync-badge.info{background:#00c8ff33;color:#00c8ff}.sync-badge.warning{background:#fa03;color:#fa0}.sync-badge.error{background:#ff505033;color:#ff5050}.sync-badge.neutral{background:#80808033;color:#888}.sync-details{display:flex;gap:12px;font-size:.75rem;color:#888;margin-bottom:8px}.sync-details .ahead{color:#00c8ff}.sync-details .behind{color:#fa0}.uncommitted-changes{margin-bottom:8px}.warning-text{color:#fa0;font-size:.8rem}.last-commit{display:flex;flex-direction:column;gap:4px;padding-top:8px;border-top:1px solid #2a2a3a}.commit-sha{font-family:SF Mono,Consolas,monospace;font-size:.75rem;color:#888}.commit-message{font-size:.8rem;color:#aaa;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.health-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.health-item{display:flex;flex-direction:column;align-items:center;padding:12px;background:#0003;border-radius:8px;border:1px solid #2a2a3a}.health-item.warning{border-color:#fa04;background:#ffaa000d}.health-value{font-size:1.5rem;font-weight:700;color:#fff}.health-item.warning .health-value{color:#fa0}.health-label{font-size:.7rem;color:#888;text-transform:uppercase;margin-top:4px}.worktrees-tab{display:flex;flex-direction:column;gap:12px}.cleanup-banner{display:flex;align-items:center;justify-content:space-between;padding:10px 12px;background:#ffaa001a;border:1px solid #ffaa0044;border-radius:8px}.cleanup-btn{padding:6px 12px;background:#fa02;border:1px solid #ffaa0044;border-radius:6px;color:#fa0;font-size:.75rem;font-weight:600;cursor:pointer;transition:all .15s ease}.cleanup-btn:hover:not(:disabled){background:#fa03;border-color:#fa06}.cleanup-btn:disabled{opacity:.6;cursor:not-allowed}.worktrees-list,.tmux-list{display:flex;flex-direction:column;gap:8px}.empty-list{text-align:center;padding:20px;color:#666;font-size:.8rem}.worktree-item,.tmux-item{padding:10px 12px;background:#0000004d;border:1px solid #2a2a3a;border-radius:8px;transition:all .15s ease}.worktree-item:hover,.tmux-item:hover{background:#0006;border-color:#3a3a4a}.worktree-item.main{border-color:#0ff3;background:#00ffff0d}.worktree-item.orphaned{border-color:#fa04;background:#ffaa000d}.tmux-item.offline{opacity:.6}.worktree-header,.tmux-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.worktree-branch,.tmux-name{font-weight:600;font-size:.85rem;color:#fff}.main-badge,.orphaned-badge,.pipeline-badge,.attached-badge{padding:2px 6px;border-radius:10px;font-size:.65rem;font-weight:600;text-transform:uppercase}.main-badge{background:#0ff3;color:#0ff}.orphaned-badge{background:#fa03;color:#fa0}.pipeline-badge{background:#a78bfa33;color:#a78bfa}.attached-badge{background:#64c86433;color:#64c864}.worktree-details{display:flex;align-items:center;justify-content:space-between;font-size:.75rem;color:#888;margin-bottom:4px}.worktree-path,.cwd-path{font-family:SF Mono,Consolas,monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.worktree-commit{font-family:SF Mono,Consolas,monospace;color:#666}.worktree-agent,.tmux-agent{display:flex;align-items:center;gap:6px;font-size:.8rem;color:#0ff}.agent-indicator{font-size:.7rem}.tmux-tab{display:flex;flex-direction:column;gap:8px}.tmux-status{font-size:.75rem}.tmux-status.active{color:#64c864}.tmux-status.offline{color:#888}.tmux-cwd{font-size:.75rem;color:#888;margin-top:4px}.tmux-meta{display:flex;gap:6px;margin-top:6px}