coder-config 0.42.3 → 0.42.5
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.
package/README.md
CHANGED
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
# Coder Config
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A configuration manager for AI coding tools. Works with Claude Code, Gemini CLI, Codex CLI, and Antigravity.
|
|
4
4
|
|
|
5
5
|
> **Migration note:** This package was renamed from `@regression-io/claude-config` to `coder-config`. The `claude-config` command still works as an alias.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## The Problem
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
AI coding assistants are powerful, but managing their configuration across projects is tedious. Each tool has its own config format. MCP servers need to be set up per-project. Context gets lost between sessions. Working across multiple repos means re-explaining relationships every time.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
## What Coder Config Does
|
|
12
|
+
|
|
13
|
+
**Unified MCP Registry**
|
|
14
|
+
Define your MCP servers once in a global registry. Enable them per-project with a toggle. Configuration inherits from global → workspace → project, so common tools are always available while project-specific ones stay scoped.
|
|
15
|
+
|
|
16
|
+
**Multi-Tool Output**
|
|
17
|
+
Write one config, generate outputs for Claude Code (`.mcp.json`), Gemini CLI (`settings.json`), Codex CLI (`config.toml`), and Antigravity. Switch tools without reconfiguring.
|
|
18
|
+
|
|
19
|
+
**Workstreams**
|
|
20
|
+
Group related repos together. When a workstream is active, Claude automatically knows which directories it can access and receives your custom context. Useful for microservices, monorepos, or any multi-repo workflow where projects relate to each other.
|
|
21
|
+
|
|
22
|
+
**Persistent Memory**
|
|
23
|
+
Store preferences, corrections, and patterns that persist across sessions. When you tell Claude "always use our logger instead of console.log," it remembers — not just for this session, but permanently.
|
|
24
|
+
|
|
25
|
+
**Hierarchical Rules**
|
|
26
|
+
Rules cascade from `~/.claude/rules/` down to project-specific rules. Global conventions apply everywhere; project-specific instructions stay local.
|
|
27
|
+
|
|
28
|
+
**Plugin System**
|
|
29
|
+
Install LSP servers, MCP tools, and custom commands from plugin marketplaces. Plugins can be scoped globally or per-project.
|
|
30
|
+
|
|
31
|
+
**Web UI**
|
|
32
|
+
Visual interface for managing everything above. File explorer for `.claude` folders, MCP toggles, memory editor, workstream management. Runs locally on port 3333.
|
|
20
33
|
|
|
21
34
|
## Installation
|
|
22
35
|
|
package/lib/constants.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-config",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.5",
|
|
4
4
|
"description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
|
|
5
5
|
"author": "regression.io",
|
|
6
6
|
"main": "config-loader.js",
|
|
@@ -2867,7 +2867,7 @@ When reporting issues, include:
|
|
|
2867
2867
|
|
|
2868
2868
|
These projects are frequently worked on together.`),f(!0)},de=ne=>{A(Ae=>Ae.filter(Ie=>Ie!==ne))},je=ne=>{P.includes(ne)||A(Ae=>[...Ae,ne])},De=async ne=>{const Ae=B[ne];if(!Ae&&!Y[ne]){G(Ie=>({...Ie,[ne]:!0}));try{const Ie=await ve.getSubprojects(ne);z(ot=>({...ot,[ne]:Ie.subprojects||[]}))}catch(Ie){console.error("Failed to load subprojects:",Ie),z(ot=>({...ot,[ne]:[]}))}finally{G(Ie=>({...Ie,[ne]:!1}))}}$(Ie=>({...Ie,[ne]:!Ae}))},Je=ne=>{const Ae=ne.projects.sort().join("|"),Ie=[...W,Ae];le(Ie),localStorage.setItem("dismissedWorkstreamSuggestions",JSON.stringify(Ie)),fe(ot=>ot.filter(dt=>dt.projects.sort().join("|")!==Ae)),J.success("Suggestion dismissed")},_e=oe.filter(ne=>{const Ae=ne.projects.sort().join("|");return!W.includes(Ae)}),be=async()=>{if(confirm("Clear activity data older than 30 days?"))try{const ne=await ve.clearActivity(30);ne.success&&(J.success(`Cleared ${ne.cleared} old entries`),Ke())}catch(ne){J.error("Failed to clear activity: "+ne.message)}},Oe=async(ne,Ae)=>{if(!ne||ne.length===0){J.error("Add projects first to generate rules");return}Q(!0);try{const Ie=await ve.generateWorkstreamRules(ne,se);Ie.success&&Ie.rules?(Ae(Ie.rules),J.success(se?"Generated rules with Claude":"Generated rules from repos")):J.error(Ie.error||"Failed to generate rules")}catch(Ie){J.error("Failed to generate rules: "+Ie.message)}finally{Q(!1)}},vt=async()=>{F(!0);try{const ne=await ve.installWorkstreamHook();ne.success?(J.success(ne.message),L(Ae=>({...Ae,isInstalled:!0}))):J.error(ne.error||"Failed to install hook")}catch(ne){J.error("Failed to install hook: "+ne.message)}finally{F(!1)}},Tt=async()=>{try{u(!0);const ne=await ve.getWorkstreams();s(ne.workstreams||[])}catch{J.error("Failed to load workstreams")}finally{u(!1)}},ge=async()=>{if(!g.trim()){J.error("Name is required");return}R(!0);try{const ne=await ve.createWorkstream(g.trim(),P,j);ne.success?(s(Ae=>[...Ae,ne.workstream]),J.success(`Created workstream: ${g}`),f(!1),y(""),E(""),A([]),fe(Ae=>Ae.filter(Ie=>Ie.name!==g.trim()))):J.error(ne.error||"Failed to create workstream")}catch(ne){J.error("Failed to create workstream: "+ne.message)}finally{R(!1)}},Se=async ne=>{if(confirm(`Delete workstream "${ne.name}"?
|
|
2869
2869
|
|
|
2870
|
-
This cannot be undone.`))try{const Ae=await ve.deleteWorkstream(ne.id);Ae.success?(s(Ie=>Ie.filter(ot=>ot.id!==ne.id)),J.success(`Deleted workstream: ${ne.name}`)):J.error(Ae.error||"Failed to delete workstream")}catch(Ae){J.error("Failed to delete workstream: "+Ae.message)}},$e=async()=>{if(m){R(!0);try{const ne=await ve.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});ne.success?(s(Ae=>Ae.map(Ie=>Ie.id===m.id?ne.workstream:Ie)),J.success("Workstream updated"),h(null)):J.error(ne.error||"Failed to update workstream")}catch(ne){J.error("Failed to update workstream: "+ne.message)}finally{R(!1)}}},Ye=ne=>{b(Ae=>{const Ie=new Set(Ae);return Ie.has(ne)?Ie.delete(ne):Ie.add(ne),Ie})},Xe=async()=>{if(!k||v.size===0)return;R(!0);let ne=0,Ae=null;for(const Ie of v)try{const ot=await ve.addProjectToWorkstream(k.id,Ie);ot.success&&(Ae=ot.workstream,ne++)}catch(ot){console.error("Failed to add project:",Ie,ot)}Ae&&s(Ie=>Ie.map(ot=>ot.id===k.id?Ae:ot)),ne>0?J.success(`Added ${ne} project${ne>1?"s":""} to ${k.name}`):J.error("Failed to add projects"),R(!1),w(!1),_(null),b(new Set)},Pt=async(ne,Ae)=>{try{const Ie=await ve.removeProjectFromWorkstream(ne.id,Ae);Ie.success?(s(ot=>ot.map(dt=>dt.id===ne.id?Ie.workstream:dt)),J.success(`Removed project from ${ne.name}`)):J.error(Ie.error||"Failed to remove project")}catch(Ie){J.error("Failed to remove project: "+Ie.message)}},it=ne=>ne.split("/").pop()||ne,or=ne=>n.filter(Ae=>{var Ie;return(Ie=Ae.projects)==null?void 0:Ie.includes(ne)}).length,cr=(ne,Ae=null)=>{var dt,Zt;const Ie=or(ne),ot=Ae?(Zt=(dt=n.find(Ue=>Ue.id===Ae))==null?void 0:dt.projects)==null?void 0:Zt.includes(ne):!1;return Ie===0?null:Ie===1?ot?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(at,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(es,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ae,{variant:"outline",onClick:Tt,size:"sm",children:[r.jsx(_r,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(ae,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(_t,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsxs("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:[r.jsx("p",{className:"font-medium mb-1",children:"What are Workstreams?"}),r.jsx("p",{children:"Workstreams are virtual projects that group repos belonging to the same product. When active, workstream rules are automatically injected into every Claude session."})]}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(es,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(ae,{onClick:()=>f(!0),children:[r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(ne=>{var Ae,Ie,ot;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(d===ne.id?null:ne.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:d===ne.id?r.jsx(wr,{className:"w-4 h-4"}):r.jsx(Vr,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(es,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:ne.name}),((Ae=ne.projects)==null?void 0:Ae.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[ne.projects.length," project",ne.projects.length!==1?"s":""]}),ne.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(Ar,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Ie=ne.projects)==null?void 0:Ie.length)>0?ne.projects.map(dt=>it(dt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:dt=>dt.stopPropagation(),children:[r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>h({...ne}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(cb,{className:"w-4 h-4"})}),r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Se(ne),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(pn,{className:"w-4 h-4"})})]})]}),d===ne.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{size:"sm",variant:"outline",onClick:()=>{_(ne),w(!0)},children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((ot=ne.projects)==null?void 0:ot.length)>0?r.jsx("div",{className:"space-y-1",children:ne.projects.map(dt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:dt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Pt(ne,dt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(qM,{className:"w-4 h-4"})})]},dt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Rules"}),ne.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:ne.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No rules defined. Click Edit to add context rules for this workstream."})]})]})]},ne.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(ed,{className:"w-4 h-4"})})}),r.jsx(Vt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),U.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(al,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ns,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(ae,{onClick:vt,disabled:M||U.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[M?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kl,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),q&&q.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nM,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(ae,{variant:"ghost",size:"sm",onClick:be,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(pn,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(NC,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Ar,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(es,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.projectCount})]})]}),((Rr=q.topProjects)==null?void 0:Rr.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:q.topProjects.slice(0,5).map((ne,Ae)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:ne.path,children:ne.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[ne.fileCount," files"]})]},ne.path))})]})]}),_e.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ut,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:_e.map(ne=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(El,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),ne.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[ne.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Je(ne),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx(ri,{className:"w-4 h-4"})}),r.jsxs(ae,{size:"sm",onClick:()=>ee(ne),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(_t,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:ne.projects.map(Ae=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Ae.split("/").pop()},Ae))})]},ne.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(Et,{open:c,onOpenChange:ne=>{ne||(f(!1),y(""),E(""),A([]),O(!1),$({}))},children:r.jsxs(Ct,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(es,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:g,onChange:ne=>y(ne.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:P.map(ne=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ne.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>de(ne),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(ri,{className:"w-4 h-4"})})]},ne))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ne=>{const Ae=cr(ne.path),Ie=B[ne.path],ot=K[ne.path],dt=Y[ne.path]||[],Zt=P.includes(ne.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:ot?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):Ie?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>je(ne.path),disabled:Zt,className:`flex-1 text-left p-2 rounded transition-colors ${Zt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ae&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ae==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ae}),Zt&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Ie&&dt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:dt.map(Ue=>{const ce=P.includes(Ue.dir),Pe=cr(Ue.dir);return r.jsxs("button",{type:"button",onClick:()=>je(Ue.dir),disabled:ce,className:`w-full text-left p-2 rounded transition-colors ${ce?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Ue.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Pe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Pe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Pe}),ce&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:Ue.relativePath})]},Ue.dir)})}),Ie&&dt.length===0&&!ot&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(Hi,{checked:se,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>Oe(P,E),disabled:re||P.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:se?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[re?r.jsx(at,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(jn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(yt,{value:j,onChange:ne=>E(ne.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),A([]),O(!1),$({})},children:"Cancel"}),r.jsxs(ae,{onClick:ge,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(Et,{open:!!m,onOpenChange:ne=>!ne&&h(null),children:r.jsxs(Ct,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(cb,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:m.name,onChange:ne=>h(Ae=>({...Ae,name:ne.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{type:"button",size:"sm",variant:"outline",onClick:()=>h(ne=>({...ne,showPicker:!ne.showPicker})),children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((Mt=m.projects)==null?void 0:Mt.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(ne=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ne.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(Ae=>({...Ae,projects:Ae.projects.filter(Ie=>Ie!==ne)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(ri,{className:"w-4 h-4"})})]},ne))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ne=>{var Ue;const Ae=(Ue=m.projects)==null?void 0:Ue.includes(ne.path),Ie=cr(ne.path,m.id),ot=B[ne.path],dt=K[ne.path],Zt=Y[ne.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:dt?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):ot?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ae&&h(ce=>({...ce,projects:[...ce.projects||[],ne.path]})),disabled:Ae,className:`flex-1 text-left p-2 rounded transition-colors ${Ae?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),Ae&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),ot&&Zt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Zt.map(ce=>{var Gt;const Pe=(Gt=m.projects)==null?void 0:Gt.includes(ce.dir),pt=cr(ce.dir,m.id);return r.jsxs("button",{type:"button",onClick:()=>!Pe&&h(gt=>({...gt,projects:[...gt.projects||[],ce.dir]})),disabled:Pe,className:`w-full text-left p-2 rounded transition-colors ${Pe?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:ce.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pt}),Pe&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ce.relativePath})]},ce.dir)})}),ot&&Zt.length===0&&!dt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(Hi,{checked:se,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>Oe(m.projects,ne=>h(Ae=>({...Ae,rules:ne}))),disabled:re||!((ur=m.projects)!=null&&ur.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:se?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[re?r.jsx(at,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(jn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(yt,{value:m.rules||"",onChange:ne=>h(Ae=>({...Ae,rules:ne.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),r.jsxs(ae,{onClick:$e,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(Et,{open:x,onOpenChange:ne=>{w(ne),ne||($({}),b(new Set))},children:r.jsxs(Ct,{className:"max-w-lg",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(Li,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(ne=>{var ce;const Ae=(ce=k==null?void 0:k.projects)==null?void 0:ce.includes(ne.path),Ie=v.has(ne.path),ot=cr(ne.path,k==null?void 0:k.id),dt=B[ne.path],Zt=K[ne.path],Ue=Y[ne.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Zt?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):dt?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ae&&Ye(ne.path),disabled:Ae,className:`flex-1 text-left p-2 rounded transition-colors ${Ae?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Ie?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Ae?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Ie?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Ae||Ie)&&r.jsx(Jt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[ot&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${ot==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:ot}),Ae&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),dt&&Ue.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Ue.map(Pe=>{var xt;const pt=(xt=k==null?void 0:k.projects)==null?void 0:xt.includes(Pe.dir),Gt=v.has(Pe.dir),gt=cr(Pe.dir,k==null?void 0:k.id);return r.jsxs("button",{type:"button",onClick:()=>!pt&&Ye(Pe.dir),disabled:pt,className:`w-full text-left p-2 rounded transition-colors ${pt?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Gt?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${pt?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Gt?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(pt||Gt)&&r.jsx(Jt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Pe.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[gt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${gt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:gt}),pt&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Pe.relativePath})]},Pe.dir)})}),dt&&Ue.length===0&&!Zt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>{w(!1),b(new Set)},children:"Cancel"}),r.jsxs(ae,{onClick:Xe,disabled:v.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Add Selected (",v.size,")"]})]})]})})]})}const Hw={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},Ha={pending:r.jsx(gu,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(DC,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(RC,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(al,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(Au,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(Au,{className:"w-4 h-4 text-gray-500"})};function UH({activeProject:e=null}){var ne,Ae,Ie,ot,dt,Zt,Ue;const[t,n]=C.useState([]),[s,o]=C.useState(!0),[u,d]=C.useState(null),[l,c]=C.useState({}),[f,m]=C.useState([]),[h,x]=C.useState(null),[w,k]=C.useState(""),[_,v]=C.useState(!1),[b,g]=C.useState(!1),[y,j]=C.useState(!1),[E,P]=C.useState(!1),[A,N]=C.useState(null),[R,I]=C.useState(""),[O,B]=C.useState(""),[$,Y]=C.useState(50),[z,K]=C.useState("DONE"),[G,U]=C.useState(!1),[L,M]=C.useState(50),[F,q]=C.useState(!1),[H,oe]=C.useState("DONE"),[fe,me]=C.useState([]),[X,W]=C.useState({stopHook:{},prepromptHook:{}}),[le,re]=C.useState(!1),[Q,se]=C.useState(!1),[ye,Be]=C.useState(null);C.useEffect(()=>{ee(),de(),je(),Ke()},[]);const Ke=async()=>{try{const ce=await ve.getWorkstreams();m(ce.workstreams||[]),x(ce.activeId||null)}catch(ce){console.error("Failed to load workstreams:",ce)}};C.useEffect(()=>{_&&h&&B(h)},[_,h]);const ee=async()=>{try{o(!0);const ce=await ve.getLoops();n(ce.loops||[]),c(ce.config||{})}catch{J.error("Failed to load loops")}finally{o(!1)}},de=async()=>{try{const Pe=(await ve.getLoopConfig()).config||{};c(Pe),M(Pe.maxIterations||50),q(Pe.autoApprovePlan||!1),oe(Pe.completionPromise||"DONE"),Y(Pe.maxIterations||50),K(Pe.completionPromise||"DONE")}catch(ce){console.error("Failed to load config:",ce)}},je=async()=>{try{const ce=await ve.getLoopHookStatus();W(ce)}catch(ce){console.error("Failed to load hook status:",ce)}},De=async()=>{try{const ce=await ve.getLoopHistory();me(ce.completed||[])}catch{J.error("Failed to load history")}},Je=async()=>{if(!R.trim()){J.error("Task description is required");return}try{U(!0);const ce=await ve.createLoop(R,{workstreamId:O||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt($,10)||50,completionPromise:z||"DONE"});ce.success?(J.success("Loop created"),v(!1),I(""),B(""),Y(L),K(H),ee()):J.error(ce.error||"Failed to create loop")}catch(ce){J.error(ce.message)}finally{U(!1)}},_e=async ce=>{try{const Pe=await ve.startLoop(ce);Pe.success&&Pe.loop?(J.success("Loop started - launching Claude Code"),Be(Pe.loop),se(!0),ee()):J.error(Pe.error||"Failed to start loop")}catch(Pe){J.error(Pe.message)}},be=C.useCallback(async(ce,Pe)=>{var pt,Gt;if(ye)try{const xt=(await ve.getLoop(ye.id)).loop;xt.taskComplete||xt.status==="completed"?(J.success("Loop completed successfully!"),se(!1),Be(null)):xt.status==="paused"?J.info(`Loop paused: ${xt.pauseReason||"user requested"}`):((pt=xt.iterations)==null?void 0:pt.current)>=((Gt=xt.iterations)==null?void 0:Gt.max)?(J.warning("Loop reached max iterations"),await ve.pauseLoop(xt.id)):J.info("Claude exited. Click Start to continue the loop."),ee()}catch(gt){console.error("Failed to check loop status:",gt)}},[ye]),Oe=async ce=>{try{const Pe=await ve.pauseLoop(ce);Pe.success?(J.success("Loop paused"),ee()):J.error(Pe.error||"Failed to pause loop")}catch(Pe){J.error(Pe.message)}},vt=async ce=>{try{const Pe=await ve.resumeLoop(ce);Pe.success?(J.success("Loop resumed"),ee()):J.error(Pe.error||"Failed to resume loop")}catch(Pe){J.error(Pe.message)}},Tt=async ce=>{if(confirm("Cancel this loop?"))try{const Pe=await ve.cancelLoop(ce);Pe.success?(J.success("Loop cancelled"),ee()):J.error(Pe.error||"Failed to cancel loop")}catch(Pe){J.error(Pe.message)}},ge=async ce=>{if(confirm("Delete this loop and all its data?"))try{const Pe=await ve.deleteLoop(ce);Pe.success?(J.success("Loop deleted"),ee()):J.error(Pe.error||"Failed to delete loop")}catch(Pe){J.error(Pe.message)}},Se=async ce=>{try{const Pe=await ve.approveLoop(ce);Pe.success?(J.success("Plan approved"),ee()):J.error(Pe.error||"Failed to approve plan")}catch(Pe){J.error(Pe.message)}},$e=async()=>{try{U(!0);const ce=await ve.updateLoopConfig({maxIterations:parseInt(L,10),autoApprovePlan:F,completionPromise:H});ce.success?(J.success("Configuration saved"),g(!1),de()):J.error(ce.error||"Failed to save configuration")}catch(ce){J.error(ce.message)}finally{U(!1)}},Ye=async()=>{try{re(!0);const ce=await ve.installLoopHooks();ce.success?(J.success("Hooks installed successfully"),je()):J.error(ce.error||"Failed to install hooks")}catch(ce){J.error(ce.message)}finally{re(!1)}},Xe=async ce=>{try{const Pe=await ve.getLoop(ce.id);N({...Pe.loop,clarifications:Pe.clarifications,plan:Pe.plan}),P(!0)}catch{J.error("Failed to load loop details")}},Pt=ce=>{navigator.clipboard.writeText(ce),J.success("Copied to clipboard")},it=ce=>ce?new Date(ce).toLocaleString():"-",or=ce=>ce.iterations?Math.min(100,ce.iterations.current/ce.iterations.max*100):0,cr=((ne=X.stopHook)==null?void 0:ne.exists)&&((Ae=X.prepromptHook)==null?void 0:Ae.exists),Rr=ce=>{if(!ce)return null;const Pe=f.find(pt=>pt.id===ce);return(Pe==null?void 0:Pe.name)||ce},Mt=w?t.filter(ce=>ce.workstreamId===w):t,ur=ce=>{var gt,xt;const Pe=(((gt=ce.task)==null?void 0:gt.original)||"").replace(/"/g,'\\"'),pt=((xt=ce.iterations)==null?void 0:xt.max)||50,Gt=ce.completionPromise||"DONE";return`claude --dangerously-skip-permissions "/ralph-loop ${Pe} --max-iterations ${pt} --completion-promise '${Gt}'"`};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(cl,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops using the official ralph-loop plugin"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qp,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:w,onChange:ce=>k(ce.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(ce=>r.jsx("option",{value:ce.id,children:ce.name},ce.id))]})]}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>{De(),j(!0)},children:[r.jsx(Ru,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Vt,{children:"View completed loops"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>g(!0),children:[r.jsx(An,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Vt,{children:"Configure loop defaults"})]})}),r.jsxs(ae,{onClick:()=>v(!0),children:[r.jsx(_t,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!cr&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ns,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(ae,{variant:"outline",size:"sm",onClick:Ye,disabled:le,children:[le?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(at,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):Mt.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(cl,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:w?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:Mt.map(ce=>{var Pe,pt,Gt,gt,xt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(u===ce.id?null:ce.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[u===ce.id?r.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Vr,{className:"w-4 h-4 text-muted-foreground"}),Ha[ce.status]||Ha.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:ce.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((Pe=ce.task)==null?void 0:Pe.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[ce.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(es,{className:"w-3 h-3"}),Rr(ce.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${Hw[ce.phase]||"bg-gray-100"}`,children:ce.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((pt=ce.iterations)==null?void 0:pt.current)||0,"/",((Gt=ce.iterations)==null?void 0:Gt.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:Gn=>Gn.stopPropagation(),children:[ce.status==="pending"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>_e(ce.id),children:r.jsx(DC,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Start loop"})]})}),ce.status==="running"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Oe(ce.id),children:r.jsx(RC,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Pause loop"})]})}),ce.status==="paused"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>vt(ce.id),children:r.jsx(I5,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Resume loop"})]})}),ce.phase==="plan"&&ce.status==="running"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Se(ce.id),children:r.jsx(Jt,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Approve plan"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Xe(ce),children:r.jsx(Gp,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"View details"})]})}),(ce.status==="running"||ce.status==="paused")&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Tt(ce.id),children:r.jsx(Au,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Cancel loop"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>ge(ce.id),children:r.jsx(pn,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Vt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((gt=ce.iterations)==null?void 0:gt.current)||0," / ",((xt=ce.iterations)==null?void 0:xt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${or(ce)}%`}})})]})]}),u===ce.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:ce.id}),r.jsx(ae,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>Pt(ce.id),children:r.jsx(ll,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[ce.status,ce.pauseReason?` (${ce.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:it(ce.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:it(ce.updatedAt)})]}),ce.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(es,{className:"w-3 h-3 text-purple-500"}),Rr(ce.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ot,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:ur(ce)})]})]})]},ce.id)})}),r.jsx(Et,{open:_,onOpenChange:v,children:r.jsxs(Ct,{className:"sm:max-w-lg",children:[r.jsx(St,{children:r.jsx(kt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Task Description"}),r.jsx(yt,{placeholder:"Describe what you want Claude to accomplish...",value:R,onChange:ce=>I(ce.target.value),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Be specific about the goal. The loop will continue until this task is completed."})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:$,onChange:ce=>Y(ce.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:z,onChange:ce=>K(ce.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:O,onChange:ce=>B(ce.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(ce=>r.jsx("option",{value:ce.id,children:ce.name},ce.id))]})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),r.jsxs(ae,{onClick:Je,disabled:G||!R.trim(),children:[G?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(Et,{open:b,onOpenChange:g,children:r.jsxs(Ct,{className:"sm:max-w-md",children:[r.jsx(St,{children:r.jsx(kt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:L,onChange:ce=>M(ce.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(lt,{value:H,onChange:ce=>oe(ce.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:F,onChange:ce=>q(ce.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),r.jsxs(ae,{onClick:$e,disabled:G,children:[G?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(Et,{open:y,onOpenChange:j,children:r.jsxs(Ct,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsx(kt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:fe.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):fe.slice().reverse().map(ce=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[Ha[ce.status]||Ha.completed,r.jsx("span",{className:"font-medium",children:ce.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:it(ce.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:ce.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",ce.totalIterations]})})]},ce.id))})]})}),r.jsx(Et,{open:E,onOpenChange:P,children:r.jsxs(Ct,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsx(kt,{children:(A==null?void 0:A.name)||"Loop Details"})}),A&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${Hw[A.phase]||""}`,children:A.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ha[A.status],r.jsx("span",{children:A.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((Ie=A.iterations)==null?void 0:Ie.current)||0," / ",((ot=A.iterations)==null?void 0:ot.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(dt=A.task)==null?void 0:dt.original})]}),A.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:A.clarifications})]}),A.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:A.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((Zt=A.iterations)==null?void 0:Zt.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",A.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:ur(A)})]})]})]})}),r.jsx(cj,{open:Q,onOpenChange:ce=>{se(ce),ce||(Be(null),ee())},title:ye?`Loop: ${ye.name}`:"Running Loop",description:(Ue=ye==null?void 0:ye.task)==null?void 0:Ue.original,cwd:ye==null?void 0:ye.projectPath,initialCommand:ye?ur(ye):"",env:ye?{CODER_LOOP_ID:ye.id,...ye.workstreamId&&{CODER_WORKSTREAM:ye.workstreamId}}:{},onExit:be})]})}function GH(e,t=[]){let n=[];function s(u,d){const l=C.createContext(d);l.displayName=u+"Context";const c=n.length;n=[...n,d];const f=h=>{var b;const{scope:x,children:w,...k}=h,_=((b=x==null?void 0:x[e])==null?void 0:b[c])||l,v=C.useMemo(()=>k,Object.values(k));return r.jsx(_.Provider,{value:v,children:w})};f.displayName=u+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,k=C.useContext(w);if(k)return k;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${u}\``)}return[f,m]}const o=()=>{const u=n.map(d=>C.createContext(d));return function(l){const c=(l==null?void 0:l[e])||u;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,KH(o,...t)]}function KH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(u){const d=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(u)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return n.scopeName=t.scopeName,n}var qH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],VN=qH.reduce((e,t)=>{const n=sd(`Primitive.${t}`),s=C.forwardRef((o,u)=>{const{asChild:d,...l}=o,c=d?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:u})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),rx="Progress",nx=100,[YH]=GH(rx),[XH,JH]=YH(rx),UN=C.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:o,getValueLabel:u=QH,...d}=e;(o||o===0)&&!Ww(o)&&console.error(ZH(`${o}`,"Progress"));const l=Ww(o)?o:nx;s!==null&&!Vw(s,l)&&console.error(eW(`${s}`,"Progress"));const c=Vw(s,l)?s:null,f=Ku(c)?u(c,l):void 0;return r.jsx(XH,{scope:n,value:c,max:l,children:r.jsx(VN.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Ku(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":qN(c,l),"data-value":c??void 0,"data-max":l,...d,ref:t})})});UN.displayName=rx;var GN="ProgressIndicator",KN=C.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,o=JH(GN,n);return r.jsx(VN.div,{"data-state":qN(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});KN.displayName=GN;function QH(e,t){return`${Math.round(e/t*100)}%`}function qN(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Ku(e){return typeof e=="number"}function Ww(e){return Ku(e)&&!isNaN(e)&&e>0}function Vw(e,t){return Ku(e)&&!isNaN(e)&&e<=t&&e>=0}function ZH(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${nx}\`.`}function eW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2870
|
+
This cannot be undone.`))try{const Ae=await ve.deleteWorkstream(ne.id);Ae.success?(s(Ie=>Ie.filter(ot=>ot.id!==ne.id)),J.success(`Deleted workstream: ${ne.name}`)):J.error(Ae.error||"Failed to delete workstream")}catch(Ae){J.error("Failed to delete workstream: "+Ae.message)}},$e=async()=>{if(m){R(!0);try{const ne=await ve.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});ne.success?(s(Ae=>Ae.map(Ie=>Ie.id===m.id?ne.workstream:Ie)),J.success("Workstream updated"),h(null)):J.error(ne.error||"Failed to update workstream")}catch(ne){J.error("Failed to update workstream: "+ne.message)}finally{R(!1)}}},Ye=ne=>{b(Ae=>{const Ie=new Set(Ae);return Ie.has(ne)?Ie.delete(ne):Ie.add(ne),Ie})},Xe=async()=>{if(!k||v.size===0)return;R(!0);let ne=0,Ae=null;for(const Ie of v)try{const ot=await ve.addProjectToWorkstream(k.id,Ie);ot.success&&(Ae=ot.workstream,ne++)}catch(ot){console.error("Failed to add project:",Ie,ot)}Ae&&s(Ie=>Ie.map(ot=>ot.id===k.id?Ae:ot)),ne>0?J.success(`Added ${ne} project${ne>1?"s":""} to ${k.name}`):J.error("Failed to add projects"),R(!1),w(!1),_(null),b(new Set)},Pt=async(ne,Ae)=>{try{const Ie=await ve.removeProjectFromWorkstream(ne.id,Ae);Ie.success?(s(ot=>ot.map(dt=>dt.id===ne.id?Ie.workstream:dt)),J.success(`Removed project from ${ne.name}`)):J.error(Ie.error||"Failed to remove project")}catch(Ie){J.error("Failed to remove project: "+Ie.message)}},it=ne=>ne.split("/").pop()||ne,or=ne=>n.filter(Ae=>{var Ie;return(Ie=Ae.projects)==null?void 0:Ie.includes(ne)}).length,cr=(ne,Ae=null)=>{var dt,Zt;const Ie=or(ne),ot=Ae?(Zt=(dt=n.find(Ue=>Ue.id===Ae))==null?void 0:dt.projects)==null?void 0:Zt.includes(ne):!1;return Ie===0?null:Ie===1?ot?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(at,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(es,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ae,{variant:"outline",onClick:Tt,size:"sm",children:[r.jsx(_r,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(ae,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(_t,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsx("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:r.jsxs("p",{children:[r.jsx("strong",{children:"Workstreams"})," let you group related repos together so Claude sees them as one cohesive project. Perfect for microservices, monorepos, or any multi-repo setup where context matters. Your custom rules and context persist across sessions, and Claude stays scoped to only the directories you specify."]})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(es,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(ae,{onClick:()=>f(!0),children:[r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(ne=>{var Ae,Ie,ot;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(d===ne.id?null:ne.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:d===ne.id?r.jsx(wr,{className:"w-4 h-4"}):r.jsx(Vr,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(es,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:ne.name}),((Ae=ne.projects)==null?void 0:Ae.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[ne.projects.length," project",ne.projects.length!==1?"s":""]}),ne.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(Ar,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Ie=ne.projects)==null?void 0:Ie.length)>0?ne.projects.map(dt=>it(dt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:dt=>dt.stopPropagation(),children:[r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>h({...ne}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(cb,{className:"w-4 h-4"})}),r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Se(ne),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(pn,{className:"w-4 h-4"})})]})]}),d===ne.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{size:"sm",variant:"outline",onClick:()=>{_(ne),w(!0)},children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((ot=ne.projects)==null?void 0:ot.length)>0?r.jsx("div",{className:"space-y-1",children:ne.projects.map(dt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:dt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Pt(ne,dt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(qM,{className:"w-4 h-4"})})]},dt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Rules"}),ne.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:ne.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No rules defined. Click Edit to add context rules for this workstream."})]})]})]},ne.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(ed,{className:"w-4 h-4"})})}),r.jsx(Vt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),U.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(al,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ns,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(ae,{onClick:vt,disabled:M||U.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[M?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kl,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),q&&q.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(nM,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(ae,{variant:"ghost",size:"sm",onClick:be,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(pn,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(NC,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Ar,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(es,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:q.projectCount})]})]}),((Rr=q.topProjects)==null?void 0:Rr.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:q.topProjects.slice(0,5).map((ne,Ae)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:ne.path,children:ne.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[ne.fileCount," files"]})]},ne.path))})]})]}),_e.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Ut,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:_e.map(ne=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(El,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),ne.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[ne.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ae,{size:"sm",variant:"ghost",onClick:()=>Je(ne),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx(ri,{className:"w-4 h-4"})}),r.jsxs(ae,{size:"sm",onClick:()=>ee(ne),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(_t,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:ne.projects.map(Ae=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:Ae.split("/").pop()},Ae))})]},ne.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(Et,{open:c,onOpenChange:ne=>{ne||(f(!1),y(""),E(""),A([]),O(!1),$({}))},children:r.jsxs(Ct,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(es,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:g,onChange:ne=>y(ne.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:P.map(ne=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ne.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>de(ne),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(ri,{className:"w-4 h-4"})})]},ne))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ne=>{const Ae=cr(ne.path),Ie=B[ne.path],ot=K[ne.path],dt=Y[ne.path]||[],Zt=P.includes(ne.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:ot?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):Ie?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>je(ne.path),disabled:Zt,className:`flex-1 text-left p-2 rounded transition-colors ${Zt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ae&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ae==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ae}),Zt&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Ie&&dt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:dt.map(Ue=>{const ce=P.includes(Ue.dir),Pe=cr(Ue.dir);return r.jsxs("button",{type:"button",onClick:()=>je(Ue.dir),disabled:ce,className:`w-full text-left p-2 rounded transition-colors ${ce?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Ue.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Pe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Pe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Pe}),ce&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:Ue.relativePath})]},Ue.dir)})}),Ie&&dt.length===0&&!ot&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(Hi,{checked:se,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>Oe(P,E),disabled:re||P.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:se?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[re?r.jsx(at,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(jn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(yt,{value:j,onChange:ne=>E(ne.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),A([]),O(!1),$({})},children:"Cancel"}),r.jsxs(ae,{onClick:ge,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(Et,{open:!!m,onOpenChange:ne=>!ne&&h(null),children:r.jsxs(Ct,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(cb,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(lt,{value:m.name,onChange:ne=>h(Ae=>({...Ae,name:ne.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(ae,{type:"button",size:"sm",variant:"outline",onClick:()=>h(ne=>({...ne,showPicker:!ne.showPicker})),children:[r.jsx(Li,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((Mt=m.projects)==null?void 0:Mt.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(ne=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ne.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(Ae=>({...Ae,projects:Ae.projects.filter(Ie=>Ie!==ne)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(ri,{className:"w-4 h-4"})})]},ne))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ne=>{var Ue;const Ae=(Ue=m.projects)==null?void 0:Ue.includes(ne.path),Ie=cr(ne.path,m.id),ot=B[ne.path],dt=K[ne.path],Zt=Y[ne.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:dt?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):ot?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ae&&h(ce=>({...ce,projects:[...ce.projects||[],ne.path]})),disabled:Ae,className:`flex-1 text-left p-2 rounded transition-colors ${Ae?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),Ae&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),ot&&Zt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Zt.map(ce=>{var Gt;const Pe=(Gt=m.projects)==null?void 0:Gt.includes(ce.dir),pt=cr(ce.dir,m.id);return r.jsxs("button",{type:"button",onClick:()=>!Pe&&h(gt=>({...gt,projects:[...gt.projects||[],ce.dir]})),disabled:Pe,className:`w-full text-left p-2 rounded transition-colors ${Pe?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:ce.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pt}),Pe&&r.jsx(Jt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ce.relativePath})]},ce.dir)})}),ot&&Zt.length===0&&!dt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(Hi,{checked:se,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>Oe(m.projects,ne=>h(Ae=>({...Ae,rules:ne}))),disabled:re||!((ur=m.projects)!=null&&ur.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:se?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[re?r.jsx(at,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(jn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(yt,{value:m.rules||"",onChange:ne=>h(Ae=>({...Ae,rules:ne.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),r.jsxs(ae,{onClick:$e,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(hi,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(Et,{open:x,onOpenChange:ne=>{w(ne),ne||($({}),b(new Set))},children:r.jsxs(Ct,{className:"max-w-lg",children:[r.jsx(St,{children:r.jsxs(kt,{className:"flex items-center gap-2",children:[r.jsx(Li,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",k==null?void 0:k.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(ne=>{var ce;const Ae=(ce=k==null?void 0:k.projects)==null?void 0:ce.includes(ne.path),Ie=v.has(ne.path),ot=cr(ne.path,k==null?void 0:k.id),dt=B[ne.path],Zt=K[ne.path],Ue=Y[ne.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>De(ne.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Zt?r.jsx(at,{className:"w-4 h-4 animate-spin text-gray-400"}):dt?r.jsx(wr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Vr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!Ae&&Ye(ne.path),disabled:Ae,className:`flex-1 text-left p-2 rounded transition-colors ${Ae?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Ie?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${Ae?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Ie?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(Ae||Ie)&&r.jsx(Jt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ne.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[ot&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${ot==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:ot}),Ae&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:ne.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),dt&&Ue.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Ue.map(Pe=>{var xt;const pt=(xt=k==null?void 0:k.projects)==null?void 0:xt.includes(Pe.dir),Gt=v.has(Pe.dir),gt=cr(Pe.dir,k==null?void 0:k.id);return r.jsxs("button",{type:"button",onClick:()=>!pt&&Ye(Pe.dir),disabled:pt,className:`w-full text-left p-2 rounded transition-colors ${pt?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Gt?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${pt?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Gt?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(pt||Gt)&&r.jsx(Jt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:Pe.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[gt&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${gt==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:gt}),pt&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:Pe.relativePath})]},Pe.dir)})}),dt&&Ue.length===0&&!Zt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ne.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>{w(!1),b(new Set)},children:"Cancel"}),r.jsxs(ae,{onClick:Xe,disabled:v.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(at,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(_t,{className:"w-4 h-4 mr-2"}),"Add Selected (",v.size,")"]})]})]})})]})}const Hw={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},Ha={pending:r.jsx(gu,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(DC,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(RC,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(al,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(Au,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(Au,{className:"w-4 h-4 text-gray-500"})};function UH({activeProject:e=null}){var ne,Ae,Ie,ot,dt,Zt,Ue;const[t,n]=C.useState([]),[s,o]=C.useState(!0),[u,d]=C.useState(null),[l,c]=C.useState({}),[f,m]=C.useState([]),[h,x]=C.useState(null),[w,k]=C.useState(""),[_,v]=C.useState(!1),[b,g]=C.useState(!1),[y,j]=C.useState(!1),[E,P]=C.useState(!1),[A,N]=C.useState(null),[R,I]=C.useState(""),[O,B]=C.useState(""),[$,Y]=C.useState(50),[z,K]=C.useState("DONE"),[G,U]=C.useState(!1),[L,M]=C.useState(50),[F,q]=C.useState(!1),[H,oe]=C.useState("DONE"),[fe,me]=C.useState([]),[X,W]=C.useState({stopHook:{},prepromptHook:{}}),[le,re]=C.useState(!1),[Q,se]=C.useState(!1),[ye,Be]=C.useState(null);C.useEffect(()=>{ee(),de(),je(),Ke()},[]);const Ke=async()=>{try{const ce=await ve.getWorkstreams();m(ce.workstreams||[]),x(ce.activeId||null)}catch(ce){console.error("Failed to load workstreams:",ce)}};C.useEffect(()=>{_&&h&&B(h)},[_,h]);const ee=async()=>{try{o(!0);const ce=await ve.getLoops();n(ce.loops||[]),c(ce.config||{})}catch{J.error("Failed to load loops")}finally{o(!1)}},de=async()=>{try{const Pe=(await ve.getLoopConfig()).config||{};c(Pe),M(Pe.maxIterations||50),q(Pe.autoApprovePlan||!1),oe(Pe.completionPromise||"DONE"),Y(Pe.maxIterations||50),K(Pe.completionPromise||"DONE")}catch(ce){console.error("Failed to load config:",ce)}},je=async()=>{try{const ce=await ve.getLoopHookStatus();W(ce)}catch(ce){console.error("Failed to load hook status:",ce)}},De=async()=>{try{const ce=await ve.getLoopHistory();me(ce.completed||[])}catch{J.error("Failed to load history")}},Je=async()=>{if(!R.trim()){J.error("Task description is required");return}try{U(!0);const ce=await ve.createLoop(R,{workstreamId:O||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt($,10)||50,completionPromise:z||"DONE"});ce.success?(J.success("Loop created"),v(!1),I(""),B(""),Y(L),K(H),ee()):J.error(ce.error||"Failed to create loop")}catch(ce){J.error(ce.message)}finally{U(!1)}},_e=async ce=>{try{const Pe=await ve.startLoop(ce);Pe.success&&Pe.loop?(J.success("Loop started - launching Claude Code"),Be(Pe.loop),se(!0),ee()):J.error(Pe.error||"Failed to start loop")}catch(Pe){J.error(Pe.message)}},be=C.useCallback(async(ce,Pe)=>{var pt,Gt;if(ye)try{const xt=(await ve.getLoop(ye.id)).loop;xt.taskComplete||xt.status==="completed"?(J.success("Loop completed successfully!"),se(!1),Be(null)):xt.status==="paused"?J.info(`Loop paused: ${xt.pauseReason||"user requested"}`):((pt=xt.iterations)==null?void 0:pt.current)>=((Gt=xt.iterations)==null?void 0:Gt.max)?(J.warning("Loop reached max iterations"),await ve.pauseLoop(xt.id)):J.info("Claude exited. Click Start to continue the loop."),ee()}catch(gt){console.error("Failed to check loop status:",gt)}},[ye]),Oe=async ce=>{try{const Pe=await ve.pauseLoop(ce);Pe.success?(J.success("Loop paused"),ee()):J.error(Pe.error||"Failed to pause loop")}catch(Pe){J.error(Pe.message)}},vt=async ce=>{try{const Pe=await ve.resumeLoop(ce);Pe.success?(J.success("Loop resumed"),ee()):J.error(Pe.error||"Failed to resume loop")}catch(Pe){J.error(Pe.message)}},Tt=async ce=>{if(confirm("Cancel this loop?"))try{const Pe=await ve.cancelLoop(ce);Pe.success?(J.success("Loop cancelled"),ee()):J.error(Pe.error||"Failed to cancel loop")}catch(Pe){J.error(Pe.message)}},ge=async ce=>{if(confirm("Delete this loop and all its data?"))try{const Pe=await ve.deleteLoop(ce);Pe.success?(J.success("Loop deleted"),ee()):J.error(Pe.error||"Failed to delete loop")}catch(Pe){J.error(Pe.message)}},Se=async ce=>{try{const Pe=await ve.approveLoop(ce);Pe.success?(J.success("Plan approved"),ee()):J.error(Pe.error||"Failed to approve plan")}catch(Pe){J.error(Pe.message)}},$e=async()=>{try{U(!0);const ce=await ve.updateLoopConfig({maxIterations:parseInt(L,10),autoApprovePlan:F,completionPromise:H});ce.success?(J.success("Configuration saved"),g(!1),de()):J.error(ce.error||"Failed to save configuration")}catch(ce){J.error(ce.message)}finally{U(!1)}},Ye=async()=>{try{re(!0);const ce=await ve.installLoopHooks();ce.success?(J.success("Hooks installed successfully"),je()):J.error(ce.error||"Failed to install hooks")}catch(ce){J.error(ce.message)}finally{re(!1)}},Xe=async ce=>{try{const Pe=await ve.getLoop(ce.id);N({...Pe.loop,clarifications:Pe.clarifications,plan:Pe.plan}),P(!0)}catch{J.error("Failed to load loop details")}},Pt=ce=>{navigator.clipboard.writeText(ce),J.success("Copied to clipboard")},it=ce=>ce?new Date(ce).toLocaleString():"-",or=ce=>ce.iterations?Math.min(100,ce.iterations.current/ce.iterations.max*100):0,cr=((ne=X.stopHook)==null?void 0:ne.exists)&&((Ae=X.prepromptHook)==null?void 0:Ae.exists),Rr=ce=>{if(!ce)return null;const Pe=f.find(pt=>pt.id===ce);return(Pe==null?void 0:Pe.name)||ce},Mt=w?t.filter(ce=>ce.workstreamId===w):t,ur=ce=>{var gt,xt;const Pe=(((gt=ce.task)==null?void 0:gt.original)||"").replace(/"/g,'\\"'),pt=((xt=ce.iterations)==null?void 0:xt.max)||50,Gt=ce.completionPromise||"DONE";return`claude --dangerously-skip-permissions "/ralph-loop ${Pe} --max-iterations ${pt} --completion-promise '${Gt}'"`};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(cl,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops using the official ralph-loop plugin"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(qp,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:w,onChange:ce=>k(ce.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(ce=>r.jsx("option",{value:ce.id,children:ce.name},ce.id))]})]}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>{De(),j(!0)},children:[r.jsx(Ru,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Vt,{children:"View completed loops"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsxs(ae,{variant:"outline",size:"sm",onClick:()=>g(!0),children:[r.jsx(An,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Vt,{children:"Configure loop defaults"})]})}),r.jsxs(ae,{onClick:()=>v(!0),children:[r.jsx(_t,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!cr&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ns,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(ae,{variant:"outline",size:"sm",onClick:Ye,disabled:le,children:[le?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(at,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):Mt.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(cl,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:w?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:Mt.map(ce=>{var Pe,pt,Gt,gt,xt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>d(u===ce.id?null:ce.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[u===ce.id?r.jsx(wr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Vr,{className:"w-4 h-4 text-muted-foreground"}),Ha[ce.status]||Ha.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:ce.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((Pe=ce.task)==null?void 0:Pe.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[ce.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(es,{className:"w-3 h-3"}),Rr(ce.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${Hw[ce.phase]||"bg-gray-100"}`,children:ce.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((pt=ce.iterations)==null?void 0:pt.current)||0,"/",((Gt=ce.iterations)==null?void 0:Gt.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:Gn=>Gn.stopPropagation(),children:[ce.status==="pending"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>_e(ce.id),children:r.jsx(DC,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Start loop"})]})}),ce.status==="running"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Oe(ce.id),children:r.jsx(RC,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Pause loop"})]})}),ce.status==="paused"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>vt(ce.id),children:r.jsx(I5,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Resume loop"})]})}),ce.phase==="plan"&&ce.status==="running"&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Se(ce.id),children:r.jsx(Jt,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Approve plan"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Xe(ce),children:r.jsx(Gp,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"View details"})]})}),(ce.status==="running"||ce.status==="paused")&&r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>Tt(ce.id),children:r.jsx(Au,{className:"w-4 h-4"})})}),r.jsx(Vt,{children:"Cancel loop"})]})}),r.jsx(Br,{children:r.jsxs(Yt,{children:[r.jsx(Xt,{asChild:!0,children:r.jsx(ae,{variant:"ghost",size:"sm",onClick:()=>ge(ce.id),children:r.jsx(pn,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Vt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((gt=ce.iterations)==null?void 0:gt.current)||0," / ",((xt=ce.iterations)==null?void 0:xt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${or(ce)}%`}})})]})]}),u===ce.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:ce.id}),r.jsx(ae,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>Pt(ce.id),children:r.jsx(ll,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[ce.status,ce.pauseReason?` (${ce.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:it(ce.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:it(ce.updatedAt)})]}),ce.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(es,{className:"w-3 h-3 text-purple-500"}),Rr(ce.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ot,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:ur(ce)})]})]})]},ce.id)})}),r.jsx(Et,{open:_,onOpenChange:v,children:r.jsxs(Ct,{className:"sm:max-w-lg",children:[r.jsx(St,{children:r.jsx(kt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Task Description"}),r.jsx(yt,{placeholder:"Describe what you want Claude to accomplish...",value:R,onChange:ce=>I(ce.target.value),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Be specific about the goal. The loop will continue until this task is completed."})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:$,onChange:ce=>Y(ce.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(lt,{value:z,onChange:ce=>K(ce.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:O,onChange:ce=>B(ce.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(ce=>r.jsx("option",{value:ce.id,children:ce.name},ce.id))]})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>v(!1),children:"Cancel"}),r.jsxs(ae,{onClick:Je,disabled:G||!R.trim(),children:[G?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(Et,{open:b,onOpenChange:g,children:r.jsxs(Ct,{className:"sm:max-w-md",children:[r.jsx(St,{children:r.jsx(kt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(lt,{type:"number",value:L,onChange:ce=>M(ce.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(lt,{value:H,onChange:ce=>oe(ce.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:F,onChange:ce=>q(ce.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(Rt,{children:[r.jsx(ae,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),r.jsxs(ae,{onClick:$e,disabled:G,children:[G?r.jsx(at,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(Et,{open:y,onOpenChange:j,children:r.jsxs(Ct,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsx(kt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:fe.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):fe.slice().reverse().map(ce=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[Ha[ce.status]||Ha.completed,r.jsx("span",{className:"font-medium",children:ce.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:it(ce.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:ce.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",ce.totalIterations]})})]},ce.id))})]})}),r.jsx(Et,{open:E,onOpenChange:P,children:r.jsxs(Ct,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(St,{children:r.jsx(kt,{children:(A==null?void 0:A.name)||"Loop Details"})}),A&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${Hw[A.phase]||""}`,children:A.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ha[A.status],r.jsx("span",{children:A.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((Ie=A.iterations)==null?void 0:Ie.current)||0," / ",((ot=A.iterations)==null?void 0:ot.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(dt=A.task)==null?void 0:dt.original})]}),A.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:A.clarifications})]}),A.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:A.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((Zt=A.iterations)==null?void 0:Zt.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",A.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:ur(A)})]})]})]})}),r.jsx(cj,{open:Q,onOpenChange:ce=>{se(ce),ce||(Be(null),ee())},title:ye?`Loop: ${ye.name}`:"Running Loop",description:(Ue=ye==null?void 0:ye.task)==null?void 0:Ue.original,cwd:ye==null?void 0:ye.projectPath,initialCommand:ye?ur(ye):"",env:ye?{CODER_LOOP_ID:ye.id,...ye.workstreamId&&{CODER_WORKSTREAM:ye.workstreamId}}:{},onExit:be})]})}function GH(e,t=[]){let n=[];function s(u,d){const l=C.createContext(d);l.displayName=u+"Context";const c=n.length;n=[...n,d];const f=h=>{var b;const{scope:x,children:w,...k}=h,_=((b=x==null?void 0:x[e])==null?void 0:b[c])||l,v=C.useMemo(()=>k,Object.values(k));return r.jsx(_.Provider,{value:v,children:w})};f.displayName=u+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,k=C.useContext(w);if(k)return k;if(d!==void 0)return d;throw new Error(`\`${h}\` must be used within \`${u}\``)}return[f,m]}const o=()=>{const u=n.map(d=>C.createContext(d));return function(l){const c=(l==null?void 0:l[e])||u;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,KH(o,...t)]}function KH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(u){const d=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(u)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return n.scopeName=t.scopeName,n}var qH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],VN=qH.reduce((e,t)=>{const n=sd(`Primitive.${t}`),s=C.forwardRef((o,u)=>{const{asChild:d,...l}=o,c=d?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:u})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),rx="Progress",nx=100,[YH]=GH(rx),[XH,JH]=YH(rx),UN=C.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:o,getValueLabel:u=QH,...d}=e;(o||o===0)&&!Ww(o)&&console.error(ZH(`${o}`,"Progress"));const l=Ww(o)?o:nx;s!==null&&!Vw(s,l)&&console.error(eW(`${s}`,"Progress"));const c=Vw(s,l)?s:null,f=Ku(c)?u(c,l):void 0;return r.jsx(XH,{scope:n,value:c,max:l,children:r.jsx(VN.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Ku(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":qN(c,l),"data-value":c??void 0,"data-max":l,...d,ref:t})})});UN.displayName=rx;var GN="ProgressIndicator",KN=C.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,o=JH(GN,n);return r.jsx(VN.div,{"data-state":qN(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});KN.displayName=GN;function QH(e,t){return`${Math.round(e/t*100)}%`}function qN(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Ku(e){return typeof e=="number"}function Ww(e){return Ku(e)&&!isNaN(e)&&e>0}function Vw(e,t){return Ku(e)&&!isNaN(e)&&e<=t&&e>=0}function ZH(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${nx}\`.`}function eW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
2871
2871
|
- a positive number
|
|
2872
2872
|
- less than the value passed to \`max\` (or ${nx} if no \`max\` prop is set)
|
|
2873
2873
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
package/ui/dist/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<!-- PWA Manifest -->
|
|
21
21
|
<link rel="manifest" href="/manifest.json">
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-Bocb6Gsl.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-X0dVhMey.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|