maestro-flow 0.3.11 → 0.3.12

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.
Files changed (164) hide show
  1. package/.claude/agents/conceptual-planning-agent.md +1 -0
  2. package/.claude/agents/workflow-analyzer.md +114 -114
  3. package/.claude/agents/workflow-collab-planner.md +144 -144
  4. package/.claude/agents/workflow-debugger.md +102 -103
  5. package/.claude/agents/workflow-executor.md +127 -128
  6. package/.claude/agents/workflow-integration-checker.md +82 -82
  7. package/.claude/agents/workflow-nyquist-auditor.md +85 -84
  8. package/.claude/agents/workflow-phase-researcher.md +85 -85
  9. package/.claude/agents/workflow-plan-checker.md +90 -90
  10. package/.claude/agents/workflow-planner.md +178 -178
  11. package/.claude/agents/workflow-roadmapper.md +81 -83
  12. package/.claude/agents/workflow-verifier.md +119 -119
  13. package/.claude/commands/learn-retro.md +2 -2
  14. package/.claude/commands/learn-second-opinion.md +2 -2
  15. package/.claude/commands/maestro-brainstorm.md +1 -0
  16. package/.claude/commands/maestro-fork.md +133 -111
  17. package/.claude/commands/maestro-merge.md +85 -77
  18. package/.claude/commands/maestro-plan.md +88 -2
  19. package/.claude/commands/maestro-roadmap.md +113 -2
  20. package/.claude/commands/maestro.md +1 -0
  21. package/.claude/commands/quality-business-test.md +5 -5
  22. package/.claude/commands/quality-debug.md +3 -2
  23. package/.claude/commands/quality-retrospective.md +6 -4
  24. package/.claude/commands/quality-review.md +1 -1
  25. package/.claude/commands/quality-test-gen.md +5 -4
  26. package/.codex/skills/maestro-brainstorm/SKILL.md +1 -1
  27. package/.codex/skills/maestro-fork/SKILL.md +98 -68
  28. package/.codex/skills/maestro-init/SKILL.md +4 -3
  29. package/.codex/skills/maestro-merge/SKILL.md +69 -62
  30. package/.codex/skills/maestro-ui-design/SKILL.md +1 -1
  31. package/.codex/skills/maestro-verify/SKILL.md +12 -12
  32. package/.codex/skills/manage-learn/SKILL.md +1 -1
  33. package/.codex/skills/manage-status/SKILL.md +4 -4
  34. package/.codex/skills/quality-business-test/SKILL.md +2 -2
  35. package/.codex/skills/quality-integration-test/SKILL.md +1 -1
  36. package/.codex/skills/quality-retrospective/SKILL.md +7 -7
  37. package/.codex/skills/quality-review/SKILL.md +2 -2
  38. package/.codex/skills/quality-test/SKILL.md +2 -2
  39. package/.codex/skills/quality-test-gen/SKILL.md +1 -1
  40. package/README.md +2 -0
  41. package/README.zh-CN.md +2 -0
  42. package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
  43. package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
  44. package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
  45. package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
  46. package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
  47. package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
  48. package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
  49. package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
  50. package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
  51. package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
  52. package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
  53. package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
  54. package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
  55. package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
  56. package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
  57. package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
  58. package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
  59. package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
  60. package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
  61. package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
  62. package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
  63. package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
  64. package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
  65. package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
  66. package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
  67. package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
  68. package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
  69. package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
  70. package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
  71. package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
  72. package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
  73. package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
  74. package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
  75. package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
  76. package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
  77. package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
  78. package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
  79. package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
  80. package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
  81. package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
  82. package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
  83. package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
  84. package/dashboard/dist/index.html +2 -2
  85. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
  86. package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
  87. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
  88. package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
  89. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
  90. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
  91. package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
  92. package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
  93. package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
  94. package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
  95. package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
  96. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
  97. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
  98. package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
  99. package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
  100. package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
  101. package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
  102. package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
  103. package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
  105. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
  106. package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
  107. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  108. package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +1 -0
  109. package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
  110. package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
  111. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +27 -1
  112. package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
  113. package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
  114. package/dashboard/dist-server/src/hooks/constants.d.ts +1 -1
  115. package/dashboard/dist-server/src/hooks/constants.js +2 -2
  116. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  117. package/dist/shared/agent-types.d.ts +4 -0
  118. package/dist/shared/agent-types.d.ts.map +1 -1
  119. package/dist/src/commands/install-backend.d.ts.map +1 -1
  120. package/dist/src/commands/install-backend.js +29 -18
  121. package/dist/src/commands/install-backend.js.map +1 -1
  122. package/dist/src/hooks/__tests__/statusline-visual-test.js +23 -1
  123. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
  124. package/dist/src/hooks/constants.d.ts +1 -1
  125. package/dist/src/hooks/constants.d.ts.map +1 -1
  126. package/dist/src/hooks/constants.js +2 -2
  127. package/dist/src/hooks/constants.js.map +1 -1
  128. package/dist/src/hooks/skill-context.d.ts +3 -0
  129. package/dist/src/hooks/skill-context.d.ts.map +1 -1
  130. package/dist/src/hooks/skill-context.js +95 -9
  131. package/dist/src/hooks/skill-context.js.map +1 -1
  132. package/dist/src/hooks/statusline.d.ts.map +1 -1
  133. package/dist/src/hooks/statusline.js +6 -3
  134. package/dist/src/hooks/statusline.js.map +1 -1
  135. package/dist/src/tools/merge-validator.d.ts.map +1 -1
  136. package/dist/src/tools/merge-validator.js +114 -16
  137. package/dist/src/tools/merge-validator.js.map +1 -1
  138. package/package.json +1 -1
  139. package/shared/agent-types.ts +4 -0
  140. package/templates/worktree-scope.json +9 -10
  141. package/templates/worktrees.json +26 -27
  142. package/workflows/brainstorm.md +10 -1
  143. package/workflows/debug.md +16 -6
  144. package/workflows/fork.md +100 -36
  145. package/workflows/integration-test.md +14 -2
  146. package/workflows/issue.md +14 -4
  147. package/workflows/learn.md +19 -5
  148. package/workflows/maestro.md +1 -0
  149. package/workflows/merge.md +113 -55
  150. package/workflows/retrospective.md +61 -22
  151. package/workflows/review.md +17 -4
  152. package/workflows/test.md +12 -2
  153. package/workflows/ui-style.md +9 -2
  154. package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
  155. package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
  156. package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
  157. package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
  158. package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
  159. package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
  160. package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
  161. package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
  162. package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
  163. package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
  164. package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
@@ -1,36 +0,0 @@
1
- import{d as A,o as ie,K as F,r as p,j as e,D as Y,N as le,F as U,Q as ce,X as de,R as xe,P as pe,O as be,f as ue,T as me,h as O,i as B,V as ge}from"./index-DWG-WrzT.js";import{u as fe}from"./shallow-Bme1JY57.js";import{C as ye}from"./columns-3-38xIDlzy.js";import{L as he}from"./list-CgIP_2A-.js";import{S as ve}from"./search-SieXnOgr.js";import{C as J}from"./circle-CMrkbRNg.js";import{m as L}from"./proxy-BKxDAKTj.js";import{C as we}from"./circle-alert-c3tH1P4z.js";import{T as Q}from"./trash-2-C8f4vFFM.js";import{P as X}from"./pen-line-Bh_WKYHm.js";import{C as je}from"./check-u6fGOwQO.js";/**
2
- * @license lucide-react v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ke=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Z=A("arrow-down",ke);/**
7
- * @license lucide-react v0.577.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Ne=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],Ce=A("compass",Ne);/**
12
- * @license lucide-react v0.577.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Ee=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Se=A("eye-off",Ee);/**
17
- * @license lucide-react v0.577.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const Be=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Ae=A("eye",Be);/**
22
- * @license lucide-react v0.577.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const De=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Te=A("settings",De);/**
27
- * @license lucide-react v0.577.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Fe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],R=A("shield",Fe);/**
32
- * @license lucide-react v0.577.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const _e=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],ee=A("tag",_e),f=ie((r,c)=>({entries:[],files:[],loading:!1,error:null,activeView:"kanban",typeFilter:"all",categoryFilter:"all",keywordFilter:"all",search:"",selectedEntry:null,hiddenColumns:new Set,setActiveView:o=>r({activeView:o}),setTypeFilter:o=>r({typeFilter:o}),setCategoryFilter:o=>r({categoryFilter:o}),setKeywordFilter:o=>r({keywordFilter:o}),setSearch:o=>r({search:o}),setSelectedEntry:o=>r({selectedEntry:o}),toggleColumn:o=>r(a=>{const n=new Set(a.hiddenColumns);return n.has(o)?n.delete(o):n.add(o),{hiddenColumns:n}}),fetchEntries:async()=>{r({loading:!0,error:null});try{const o=await fetch(F.SPECS);if(!o.ok)throw new Error(`Failed: ${o.status}`);const a=await o.json();r({entries:a.entries??[],loading:!1})}catch(o){r({loading:!1,error:String(o)})}},fetchFiles:async()=>{try{const o=await fetch(F.SPECS_FILES);if(!o.ok)return;const a=await o.json();r({files:a.files??[]})}catch{}},addEntry:async(o,a,n)=>{r({error:null});try{const d=await fetch(F.SPECS,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:o,content:a,file:n})});if(!d.ok){const g=await d.json().catch(()=>({error:`HTTP ${d.status}`}));throw new Error(g.error)}return c().fetchEntries(),null}catch(d){return r({error:String(d)}),null}},deleteEntry:async o=>{r({error:null});const a=c().entries;r(n=>({entries:n.entries.filter(d=>d.id!==o)}));try{(await fetch(`${F.SPECS}/${o}`,{method:"DELETE"})).ok||r({entries:a})}catch{r({entries:a})}},filteredEntries:()=>{const{entries:o,typeFilter:a,categoryFilter:n,keywordFilter:d,search:g}=c();let y=o;if(a!=="all"&&(y=y.filter(u=>u.type===a)),n!=="all"&&(y=y.filter(u=>u.category===n)),d!=="all"&&(y=y.filter(u=>u.keywords.includes(d))),g){const u=g.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(u)||h.content.toLowerCase().includes(u)||h.id.toLowerCase().includes(u)||h.keywords.some(v=>v.toLowerCase().includes(u)))}return y},entriesByType:()=>{const o=c().filteredEntries(),a={bug:[],pattern:[],decision:[],rule:[],debug:[],test:[],review:[],validation:[],general:[]};for(const n of o)(a[n.type]??a.general).push(n);return a},typeCounts:()=>{const{entries:o}=c(),a={all:o.length,bug:0,pattern:0,decision:0,rule:0,debug:0,test:0,review:0,validation:0,general:0};for(const n of o)a[n.type]=(a[n.type]??0)+1;return a},allCategories:()=>{const{entries:o}=c(),a=new Set;for(const n of o)n.category&&a.add(n.category);return Array.from(a).sort()},allKeywords:()=>{const{entries:o}=c(),a=new Set;for(const n of o)for(const d of n.keywords)a.add(d);return Array.from(a).sort()}})),ze={general:{label:"General",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"},planning:{label:"Planning",icon:e.jsx(Ce,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-planning)",color:"#9178B5"},execution:{label:"Execution",icon:e.jsx(Te,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-exploring)",color:"#5B8DB8"},debug:{label:"Debug",icon:e.jsx(we,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-blocked)",color:"#C46555"},test:{label:"Test",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-completed)",color:"#5A9E78"},review:{label:"Review",icon:e.jsx(ce,{size:14,strokeWidth:1.8}),tintBg:"rgba(219,176,108,0.12)",color:"#C4A055"},validation:{label:"Validation",icon:e.jsx(R,{size:14,strokeWidth:1.8}),tintBg:"rgba(90,158,120,0.10)",color:"#3D8B5F"}},Le=["general","planning","execution","debug","test","review","validation"],Me={label:"",icon:e.jsx(J,{size:14,strokeWidth:1.8}),tintBg:"var(--color-tint-pending)",color:"#A09D97"};function I(r){return ze[r]??{...Me,label:r.charAt(0).toUpperCase()+r.slice(1)}}const We={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function $e(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function Ve({onAddEntry:r}){const c=f(s=>s.entries),o=f(s=>s.typeFilter),a=f(s=>s.keywordFilter),n=f(s=>s.search),d=f(s=>s.selectedEntry),g=f(s=>s.setSelectedEntry),y=f(s=>s.setKeywordFilter),u=f(s=>s.hiddenColumns),h=f(s=>s.toggleColumn),v=p.useMemo(()=>{const s=new Set;for(const x of c)x.category&&s.add(x.category);const i=[];for(const x of Le)s.has(x)&&(i.push(x),s.delete(x));for(const x of Array.from(s).sort())i.push(x);return i},[c]),N=p.useMemo(()=>{const s=new Set;for(const i of c)for(const x of i.keywords)s.add(x);return Array.from(s).sort()},[c]),w=p.useMemo(()=>{let s=c;if(o!=="all"&&(s=s.filter(i=>i.type===o)),a!=="all"&&(s=s.filter(i=>i.keywords.includes(a))),n){const i=n.toLowerCase();s=s.filter(x=>x.title.toLowerCase().includes(i)||x.content.toLowerCase().includes(i)||x.id.toLowerCase().includes(i)||x.keywords.some(C=>C.toLowerCase().includes(i)))}return s},[c,o,a,n]),m=p.useMemo(()=>{const s={};for(const i of v)s[i]=[];for(const i of w){const x=i.category||"general";s[x]||(s[x]=[]),s[x].push(i)}return s},[w,v]),k=p.useMemo(()=>{const s={};for(const i of c){const x=i.category||"general";s[x]=(s[x]??0)+1}return s},[c]),S=p.useMemo(()=>v.filter(s=>!u.has(s)),[v,u]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-[6px] px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[v.map(s=>{const i=I(s),x=!u.has(s),C=k[s]??0;return e.jsxs("button",{type:"button",onClick:()=>h(s),className:["text-[11px] font-medium px-[10px] py-[4px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",x?"bg-bg-card text-text-primary border-border hover:shadow-sm":"bg-bg-secondary text-text-quaternary border-border-divider opacity-60"].join(" "),style:x?{borderColor:i.color,boxShadow:`0 0 0 1px ${i.color}22`}:void 0,children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0 transition-opacity",style:{background:i.color,opacity:x?1:.35}}),i.label,e.jsx("span",{className:"text-[10px] font-mono opacity-60",children:C})]},s)}),N.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx(ee,{size:11,strokeWidth:2,className:"text-text-quaternary shrink-0"}),N.map(s=>{const i=a===s;return e.jsx("button",{type:"button",onClick:()=>y(i?"all":s),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",i?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:s},s)})]})]}),e.jsxs("div",{className:"flex gap-3 flex-1 overflow-x-auto p-3",children:[S.map((s,i)=>{const x=I(s),C=m[s]??[];return e.jsxs("div",{className:"flex flex-col min-w-[260px] flex-1 bg-bg-secondary rounded-[12px] overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[14px] py-3 border-b border-black/[0.04]",children:[e.jsx("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center shrink-0",style:{background:x.tintBg,color:x.color},children:x.icon}),e.jsx("span",{className:"text-[13px] font-bold text-text-primary",children:x.label}),e.jsx("span",{className:"text-[10px] text-text-tertiary bg-bg-card px-[6px] rounded-full font-mono",children:C.length}),e.jsx("button",{type:"button",onClick:r,className:"ml-auto w-6 h-6 rounded-[6px] border border-dashed border-border bg-transparent cursor-pointer flex items-center justify-center text-text-quaternary hover:border-text-tertiary hover:text-text-primary hover:bg-bg-card transition-all",children:e.jsx(Y,{size:12,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-2 flex flex-col gap-2",children:[C.map((E,D)=>e.jsx(qe,{entry:E,selected:d===E.id,onClick:()=>g(E.id),index:i*100+D},E.id)),C.length===0&&e.jsx("div",{className:"flex items-center justify-center py-8 text-[11px] text-text-quaternary",children:"No entries"})]})]},s)}),S.length===0&&e.jsx("div",{className:"flex items-center justify-center flex-1 text-[13px] text-text-tertiary",children:"All columns hidden — click a category tag above to show it."})]})]})}function qe({entry:r,selected:c,onClick:o,index:a}){const n=We[r.type];return e.jsxs(L.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2,delay:Math.min(a*.03,.3)},onClick:o,className:["bg-bg-card rounded-[10px] px-[14px] py-3 border cursor-pointer","transition-all duration-[180ms]","hover:-translate-y-[2px] hover:shadow-[0_4px_16px_rgba(0,0,0,0.06)] hover:border-border",c?"border-[#9178B5] shadow-[0_0_0_2px_rgba(145,120,181,0.2)]":"border-border-divider"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-[6px] mb-2",children:[e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em]",style:{background:n.bg,color:n.text},children:r.type}),e.jsx("span",{className:"text-[10px] font-mono text-text-quaternary ml-auto",children:r.id})]}),e.jsx("div",{className:"text-[13px] text-text-primary font-medium leading-[1.5] mb-2 line-clamp-3",children:r.content||r.title}),r.keywords.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mb-2",children:[r.keywords.slice(0,4).map(d=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono",children:d},d)),r.keywords.length>4&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-4]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-[10px] text-text-quaternary font-mono flex items-center gap-[3px]",children:[e.jsx(le,{size:10,strokeWidth:2}),$e(r.timestamp)]}),r.file&&e.jsxs("span",{className:"text-[10px] text-text-tertiary flex items-center gap-[3px] ml-auto",children:[e.jsx(U,{size:10,strokeWidth:2}),r.file.split("/").pop()]})]})]})}const Pe={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}},Oe={bug:"#C46555",pattern:"#5B8DB8",decision:"#9178B5",rule:"#5A9E78",debug:"#B85B4A",test:"#3D8B5F",review:"#C4A055",validation:"#4A7DA8",general:"#A09D97"},te={general:"#A09D97",planning:"#9178B5",execution:"#5B8DB8",debug:"#C46555",test:"#5A9E78",review:"#C4A055",validation:"#3D8B5F"},Re=[{value:"all",label:"All"},{value:"bug",label:"Bug"},{value:"pattern",label:"Pattern"},{value:"decision",label:"Decision"},{value:"rule",label:"Rule"},{value:"debug",label:"Debug"},{value:"test",label:"Test"},{value:"review",label:"Review"},{value:"validation",label:"Validation"},{value:"general",label:"General"}],K=[{key:"id",label:"ID",width:60},{key:"type",label:"Type",width:80},{key:"category",label:"Category",width:100},{key:"content",label:"Content",alwaysVisible:!0},{key:"keywords",label:"Keywords",width:180},{key:"file",label:"File",width:140},{key:"added",label:"Added",width:90},{key:"actions",label:"",width:80,alwaysVisible:!0}];function Ie(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function Ke(){const r=f(t=>t.entries),c=f(t=>t.typeFilter),o=f(t=>t.setTypeFilter),a=f(t=>t.categoryFilter),n=f(t=>t.setCategoryFilter),d=f(t=>t.keywordFilter),g=f(t=>t.setKeywordFilter),y=f(t=>t.search),u=f(t=>t.selectedEntry),h=f(t=>t.setSelectedEntry),v=f(t=>t.deleteEntry),N=f(t=>t.addEntry),[w,m]=p.useState("timestamp"),[k,S]=p.useState("desc"),[s,i]=p.useState(!1),[x,C]=p.useState("bug"),[E,D]=p.useState(""),[z,re]=p.useState(new Set),oe=p.useCallback(t=>{re(l=>{const b=new Set(l);return b.has(t)?b.delete(t):b.add(t),b})},[]),T=p.useMemo(()=>K.filter(t=>t.alwaysVisible||!z.has(t.key)),[z]),M=p.useMemo(()=>{const t=new Set;for(const l of r)l.category&&t.add(l.category);return Array.from(t).sort()},[r]),W=p.useMemo(()=>{const t=new Set;for(const l of r)for(const b of l.keywords)t.add(b);return Array.from(t).sort()},[r]),se=p.useMemo(()=>{const t={all:r.length,bug:0,pattern:0,decision:0,rule:0,general:0};for(const l of r)t[l.type]=(t[l.type]??0)+1;return t},[r]),ae=p.useMemo(()=>{const t={};for(const l of r){const b=l.category||"general";t[b]=(t[b]??0)+1}return t},[r]),$=p.useMemo(()=>{let t=r;if(c!=="all"&&(t=t.filter(l=>l.type===c)),a!=="all"&&(t=t.filter(l=>l.category===a)),d!=="all"&&(t=t.filter(l=>l.keywords.includes(d))),y){const l=y.toLowerCase();t=t.filter(b=>b.title.toLowerCase().includes(l)||b.content.toLowerCase().includes(l)||b.id.toLowerCase().includes(l)||b.keywords.some(j=>j.toLowerCase().includes(l)))}return t},[r,c,a,d,y]),V=p.useMemo(()=>{const t=[...$];return t.sort((l,b)=>{let j=0;return w==="timestamp"?j=new Date(l.timestamp).getTime()-new Date(b.timestamp).getTime():w==="id"?j=l.id.localeCompare(b.id):w==="type"?j=l.type.localeCompare(b.type):w==="category"&&(j=(l.category||"").localeCompare(b.category||"")),k==="desc"?-j:j}),t},[$,w,k]),q=p.useCallback(t=>{m(l=>l===t?(S(b=>b==="desc"?"asc":"desc"),l):(S("desc"),t))},[]),P=p.useCallback(async()=>{E.trim()&&(await N(x,E.trim(),"learnings.md"),D(""),i(!1))},[x,E,N]),ne=p.useCallback((t,l)=>{t.stopPropagation(),v(l)},[v]);return e.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-5 py-2 border-b border-border-divider bg-bg-primary shrink-0",children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Type"}),Re.map(t=>{const l=c===t.value;return e.jsxs("button",{type:"button",onClick:()=>o(t.value),className:["text-[11px] font-medium px-3 py-1 rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:[t.value!=="all"&&e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":Oe[t.value]}}),t.label,e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:se[t.value]??0})]},t.value)}),M.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:"Category"}),e.jsx("button",{type:"button",onClick:()=>n("all"),className:["text-[11px] font-medium px-2 py-[3px] rounded-full border cursor-pointer transition-all",a==="all"?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),children:"All"}),M.map(t=>{const l=a===t,b=te[t]??"#A09D97";return e.jsxs("button",{type:"button",onClick:()=>n(l?"all":t),className:["text-[11px] font-medium px-[10px] py-[3px] rounded-full border cursor-pointer transition-all","flex items-center gap-[5px]",l?"border-transparent text-white":"bg-bg-card text-text-secondary border-border hover:border-text-tertiary hover:text-text-primary"].join(" "),style:l?{background:b}:void 0,children:[e.jsx("span",{className:"w-[6px] h-[6px] rounded-full",style:{background:l?"#fff":b}}),t.charAt(0).toUpperCase()+t.slice(1),e.jsx("span",{className:"text-[10px] font-mono opacity-70",children:ae[t]??0})]},t)})]}),W.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-[18px] bg-border-divider mx-1"}),e.jsx("span",{className:"text-[10px] font-semibold text-text-quaternary uppercase tracking-[0.06em]",children:e.jsx(ee,{size:10,strokeWidth:2,className:"inline-block mr-[2px] align-middle"})}),W.map(t=>{const l=d===t;return e.jsx("button",{type:"button",onClick:()=>g(l?"all":t),className:["text-[10px] font-medium px-2 py-[2px] rounded-[4px] border cursor-pointer transition-all",l?"bg-text-primary text-white border-text-primary":"bg-bg-card text-text-tertiary border-border-divider hover:border-text-tertiary hover:text-text-primary"].join(" "),children:t},t)})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex items-center gap-1",children:K.filter(t=>!t.alwaysVisible).map(t=>{const l=z.has(t.key);return e.jsxs("button",{type:"button",onClick:()=>oe(t.key),className:["text-[10px] font-medium px-[6px] py-[3px] rounded-[4px] border cursor-pointer transition-all","flex items-center gap-[3px]",l?"bg-bg-secondary text-text-quaternary border-border-divider opacity-50":"bg-bg-card text-text-tertiary border-border hover:text-text-primary"].join(" "),title:`${l?"Show":"Hide"} ${t.label} column`,children:[l?e.jsx(Se,{size:9,strokeWidth:2}):e.jsx(Ae,{size:9,strokeWidth:2}),t.label]},t.key)})}),e.jsx("div",{className:"w-px h-[18px] bg-border-divider"}),e.jsxs("button",{type:"button",onClick:()=>q("timestamp"),className:"text-[11px] font-medium px-[10px] py-1 rounded-[6px] border border-border bg-bg-card text-text-tertiary cursor-pointer font-sans transition-all hover:border-text-tertiary hover:text-text-primary flex items-center gap-1",children:[e.jsx(Z,{size:12,strokeWidth:2,className:k==="asc"?"rotate-180 transition-transform":"transition-transform"}),k==="desc"?"Newest":"Oldest"]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{children:T.map(t=>{const b={id:"id",type:"type",category:"category",added:"timestamp"}[t.key];return e.jsx(Ge,{width:t.width,active:b?w===b:!1,onClick:b?()=>q(b):void 0,children:t.label},t.key)})})}),e.jsxs("tbody",{children:[s&&e.jsx("tr",{children:T.map(t=>{const l="var(--color-tint-planning)",b="rgba(145,120,181,0.3)";return t.key==="id"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("span",{className:"font-mono text-[11px] font-semibold",style:{color:"#9178B5"},children:"NEW"})},t.key):t.key==="type"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("select",{value:x,onChange:j=>C(j.target.value),className:"px-2 py-1 rounded-[6px] border border-border bg-bg-card text-[11px] text-text-primary font-sans outline-none cursor-pointer",children:[e.jsx("option",{value:"bug",children:"bug"}),e.jsx("option",{value:"pattern",children:"pattern"}),e.jsx("option",{value:"decision",children:"decision"}),e.jsx("option",{value:"rule",children:"rule"}),e.jsx("option",{value:"debug",children:"debug"}),e.jsx("option",{value:"test",children:"test"}),e.jsx("option",{value:"review",children:"review"}),e.jsx("option",{value:"validation",children:"validation"}),e.jsx("option",{value:"general",children:"general"})]})},t.key):t.key==="content"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsx("input",{type:"text",value:E,onChange:j=>D(j.target.value),placeholder:"Describe the entry...",autoFocus:!0,onKeyDown:j=>{j.key==="Enter"&&P(),j.key==="Escape"&&i(!1)},className:"w-full px-[10px] py-[6px] rounded-[6px] border border-border bg-bg-card text-[13px] text-text-primary font-sans outline-none focus:border-[#9178B5] transition-colors"})},t.key):t.key==="actions"?e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top",style:{background:l,borderBottomColor:b},children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{type:"button",onClick:()=>void P(),className:"px-3 py-[5px] rounded-[6px] border-none bg-text-primary text-white text-[11px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] transition-all",children:"Save"}),e.jsx("button",{type:"button",onClick:()=>i(!1),className:"px-3 py-[5px] rounded-[6px] border-none bg-bg-secondary text-text-secondary text-[11px] font-semibold cursor-pointer font-sans hover:bg-bg-tertiary transition-all",children:"Cancel"})]})},t.key):e.jsx("td",{className:"px-3 py-[10px] border-b-2 align-top font-mono text-[11px] text-text-tertiary",style:{background:l,borderBottomColor:b},children:"—"},t.key)})}),V.map((t,l)=>e.jsx(He,{entry:t,selected:u===t.id,onClick:()=>h(t.id),onDelete:ne,index:l,visibleColumns:T},t.id)),V.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:T.length,className:"text-center py-12 text-[13px] text-text-tertiary",children:"No entries found"})})]})]})})]})}function Ge({children:r,width:c,active:o,onClick:a}){return e.jsxs("th",{style:{width:c?`${c}px`:void 0},onClick:a,className:["sticky top-0 z-10 text-left text-[10px] font-semibold uppercase tracking-[0.06em] px-3 py-2","bg-bg-secondary border-b border-border select-none whitespace-nowrap",a?"cursor-pointer":"",o?"text-text-primary":"text-text-tertiary hover:text-text-primary"].join(" "),children:[r,o&&e.jsx(Z,{size:10,strokeWidth:2,className:"inline-block align-middle ml-[3px]"})]})}function He({entry:r,selected:c,onClick:o,onDelete:a,index:n,visibleColumns:d}){const g=Pe[r.type],y=te[r.category]??"#A09D97",u={id:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.id}),type:e.jsx("span",{className:"text-[9px] font-bold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:g.bg,color:g.text},children:r.type}),category:e.jsx("span",{className:"text-[10px] font-semibold px-[7px] py-[2px] rounded-[4px] uppercase font-mono tracking-[0.04em] whitespace-nowrap inline-block",style:{background:`${y}15`,color:y},children:r.category||"general"}),content:e.jsx("span",{className:"text-[13px] text-text-primary font-medium leading-[1.5] max-w-[500px] block",children:r.content||r.title}),keywords:e.jsxs("div",{className:"flex flex-wrap gap-[3px]",children:[r.keywords.slice(0,3).map(h=>e.jsx("span",{className:"text-[9px] px-[5px] py-[1px] rounded-[3px] bg-bg-secondary text-text-tertiary font-mono whitespace-nowrap",children:h},h)),r.keywords.length>3&&e.jsxs("span",{className:"text-[9px] text-text-quaternary font-mono",children:["+",r.keywords.length-3]})]}),file:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:r.file?r.file.split("/").pop():""}),added:e.jsx("span",{className:"font-mono text-[11px] text-text-quaternary whitespace-nowrap",children:Ie(r.timestamp)}),actions:e.jsxs("div",{className:"flex gap-[2px] whitespace-nowrap",children:[e.jsx("button",{type:"button",onClick:h=>{h.stopPropagation(),o()},className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-bg-hover hover:text-text-primary",children:e.jsx(X,{size:14,strokeWidth:1.8})}),e.jsx("button",{type:"button",onClick:h=>a(h,r.id),className:"w-7 h-7 rounded-[6px] border-none bg-transparent cursor-pointer text-text-quaternary flex items-center justify-center transition-all opacity-0 group-hover:opacity-100 hover:bg-[rgba(196,101,85,0.08)] hover:text-[#C46555]",children:e.jsx(Q,{size:14,strokeWidth:1.8})})]})};return e.jsx(L.tr,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15,delay:Math.min(n*.02,.3)},onClick:o,className:["cursor-pointer transition-colors group",c?"[&>td]:bg-tint-planning":"hover:[&>td]:bg-bg-hover"].join(" "),children:d.map(h=>e.jsx("td",{className:"px-3 py-[10px] border-b border-border-divider align-top",children:u[h.key]},h.key))})}const G={bug:{bg:"var(--color-tint-blocked)",text:"#C46555"},pattern:{bg:"var(--color-tint-exploring)",text:"#5B8DB8"},decision:{bg:"var(--color-tint-planning)",text:"#9178B5"},rule:{bg:"var(--color-tint-completed)",text:"#5A9E78"},debug:{bg:"rgba(196,101,85,0.10)",text:"#B85B4A"},test:{bg:"rgba(90,158,120,0.10)",text:"#3D8B5F"},review:{bg:"rgba(219,176,108,0.12)",text:"#C4A055"},validation:{bg:"rgba(91,141,184,0.10)",text:"#4A7DA8"},general:{bg:"var(--color-tint-pending)",text:"#A09D97"}};function Ye(r){if(!r)return"--";const c=new Date(r);if(isNaN(c.getTime()))return"--";const a=Date.now()-c.getTime(),n=Math.floor(a/6e4);if(n<1)return"now";if(n<60)return`${n}m ago`;const d=Math.floor(n/60);if(d<24)return`${d}h ago`;const g=Math.floor(d/24);return g<7?`${g}d ago`:c.toLocaleDateString()}function Ue({entry:r,onClose:c}){const o=f(g=>g.deleteEntry),a=p.useMemo(()=>G[r.type]??G.general,[r.type]),n=p.useMemo(()=>r.file?r.file.split("/").pop():"",[r.file]);function d(){o(r.id),c()}return e.jsxs(L.aside,{initial:{width:0,opacity:0},animate:{width:380,opacity:1},exit:{width:0,opacity:0},transition:{type:"spring",stiffness:400,damping:30},className:"shrink-0 border-l border-border bg-bg-primary overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border-divider shrink-0 min-h-[48px]",children:[e.jsx("span",{className:"text-[12px] font-semibold text-text-primary",children:"Entry Detail"}),e.jsx("button",{type:"button",onClick:c,"aria-label":"Close detail panel",className:"w-7 h-7 rounded-[8px] border-none bg-transparent cursor-pointer text-text-tertiary flex items-center justify-center hover:bg-bg-hover hover:text-text-primary transition-colors",children:e.jsx(de,{size:14,strokeWidth:2})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-4 py-4",style:{width:380},children:[e.jsx("span",{className:"inline-flex items-center gap-[5px] text-[10px] font-bold px-[10px] py-[3px] rounded-[6px] mb-3 uppercase tracking-[0.04em]",style:{background:a.bg,color:a.text},children:r.type}),e.jsx("div",{className:"text-[16px] font-bold text-text-primary leading-[1.5] mb-4",children:r.title||r.content}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-4",children:[e.jsx(_,{label:"ID",value:r.id,mono:!0}),e.jsx(_,{label:"Added",value:Ye(r.timestamp),mono:!0}),e.jsx(_,{label:"File",value:n||"--",mono:!0}),e.jsx(_,{label:"Type",value:r.type})]}),r.content&&r.title&&r.content!==r.title&&e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-[6px]",children:"Description"}),e.jsx("div",{className:"text-[13px] text-text-secondary leading-[1.6] whitespace-pre-wrap",children:r.content})]}),e.jsxs("div",{className:"flex gap-2 pt-3 border-t border-border-divider",children:[e.jsxs("button",{type:"button",className:"flex-1 py-2 rounded-[8px] border border-text-primary bg-text-primary text-[12px] font-semibold text-white cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:bg-[#1A1816] transition-all",children:[e.jsx(X,{size:13,strokeWidth:2}),"Edit"]}),e.jsxs("button",{type:"button",onClick:d,className:"flex-1 py-2 rounded-[8px] border border-border bg-bg-card text-[12px] font-semibold text-text-secondary cursor-pointer font-sans flex items-center justify-center gap-[6px] hover:border-[#C46555] hover:text-[#C46555] hover:bg-[rgba(196,101,85,0.08)] transition-all",children:[e.jsx(Q,{size:13,strokeWidth:2}),"Delete"]})]})]})]})}function _({label:r,value:c,mono:o}){return e.jsxs("div",{className:"px-3 py-2 bg-bg-secondary rounded-[8px]",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.04em] text-text-quaternary mb-[2px]",children:r}),e.jsx("div",{className:["text-[13px] font-semibold text-text-primary",o?"font-mono text-[12px]":""].join(" "),children:c})]})}const Je=[{value:"bug",label:"Bug",activeBg:"var(--color-tint-blocked)",activeText:"#C46555",activeBorder:"#C46555"},{value:"pattern",label:"Pattern",activeBg:"var(--color-tint-exploring)",activeText:"#5B8DB8",activeBorder:"#5B8DB8"},{value:"decision",label:"Decision",activeBg:"var(--color-tint-planning)",activeText:"#9178B5",activeBorder:"#9178B5"},{value:"rule",label:"Rule",activeBg:"var(--color-tint-completed)",activeText:"#5A9E78",activeBorder:"#5A9E78"},{value:"debug",label:"Debug",activeBg:"rgba(196,101,85,0.10)",activeText:"#B85B4A",activeBorder:"#B85B4A"},{value:"test",label:"Test",activeBg:"rgba(90,158,120,0.10)",activeText:"#3D8B5F",activeBorder:"#3D8B5F"},{value:"review",label:"Review",activeBg:"rgba(219,176,108,0.12)",activeText:"#C4A055",activeBorder:"#C4A055"},{value:"validation",label:"Validation",activeBg:"rgba(91,141,184,0.10)",activeText:"#4A7DA8",activeBorder:"#4A7DA8"}];function Qe({open:r,onOpenChange:c}){const o=f(m=>m.addEntry),a=f(m=>m.files),[n,d]=p.useState("bug"),[g,y]=p.useState(""),[u,h]=p.useState(""),[v,N]=p.useState(!1);p.useEffect(()=>{r||(d("bug"),y(""),h(""))},[r]),p.useEffect(()=>{a.length>0&&!u&&h(a[0].path)},[a,u]);const w=p.useCallback(async()=>{g.trim()&&(N(!0),await o(n,g.trim(),u),N(!1),c(!1))},[n,g,u,o,c]);return e.jsx(xe,{open:r,onOpenChange:c,children:e.jsxs(pe,{children:[e.jsx(be,{className:"fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),e.jsxs(ue,{className:B("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-[480px] max-w-[95vw] max-h-[80vh]","rounded-[16px] border border-border bg-bg-card shadow-lg","flex flex-col overflow-hidden","focus:outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95"),children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-divider shrink-0",children:[e.jsx(me,{className:"text-[16px] font-bold text-text-primary",children:"New Spec Entry"}),e.jsx(O,{className:B("w-7 h-7 flex items-center justify-center rounded-[8px]","text-text-tertiary hover:text-text-primary hover:bg-bg-hover","transition-colors border-none bg-transparent cursor-pointer"),"aria-label":"Close",children:e.jsxs("svg",{className:"w-[14px] h-[14px]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Type"}),e.jsx("div",{className:"grid grid-cols-4 gap-2",children:Je.map(m=>{const k=n===m.value;return e.jsx("button",{type:"button",onClick:()=>d(m.value),className:B("py-[10px] rounded-[10px] border-[1.5px] bg-bg-card cursor-pointer","text-center text-[11px] font-semibold font-sans transition-all"),style:k?{borderColor:m.activeBorder,color:m.activeText,background:m.activeBg,fontWeight:700}:{borderColor:"var(--color-border, #E8E5DE)",color:"var(--color-text-tertiary, #A09D97)"},children:m.label},m.value)})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Content"}),e.jsx("textarea",{value:g,onChange:m=>y(m.target.value),placeholder:"Describe the bug, pattern, decision, or rule...",rows:5,className:B("w-full min-h-[120px] px-[14px] py-[10px] rounded-[8px]","border border-border bg-bg-primary text-[13px] text-text-primary","font-sans leading-[1.6] resize-y outline-none","focus:border-[#9178B5] transition-colors","placeholder:text-text-quaternary")}),e.jsx("div",{className:"text-[11px] text-text-quaternary mt-1",children:"Supports markdown. Will be timestamped automatically."})]}),a.length>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-[11px] font-semibold text-text-tertiary uppercase tracking-[0.04em] mb-[6px]",children:"Target File"}),e.jsx("select",{value:u,onChange:m=>h(m.target.value),className:B("w-full px-3 py-2 rounded-[8px] border border-border","bg-bg-primary text-[12px] text-text-primary font-sans","outline-none cursor-pointer","focus:border-[#9178B5] transition-colors"),children:a.map(m=>e.jsxs("option",{value:m.path,children:[m.name," (",m.category,")"]},m.path))})]}),u&&e.jsxs("div",{className:"bg-bg-primary rounded-[10px] px-4 py-[14px] border border-border-divider",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.06em] text-text-quaternary mb-2",children:"Will write to"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-[10px] py-[6px] rounded-[6px] bg-bg-card border border-border-divider text-[11px] font-mono text-text-secondary",children:[e.jsx(U,{size:12,strokeWidth:1.8,className:"text-text-tertiary"}),e.jsx("span",{className:"text-text-primary font-semibold",children:u})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-border-divider shrink-0",children:[e.jsx(O,{className:B("px-4 py-2 rounded-[8px] border border-border bg-bg-card","text-[12px] font-semibold text-text-secondary cursor-pointer font-sans","hover:border-text-tertiary hover:text-text-primary transition-all"),children:"Cancel"}),e.jsxs("button",{type:"button",disabled:!g.trim()||v,onClick:()=>void w(),className:B("flex items-center gap-[6px] px-[14px] py-2 rounded-[8px] border-none","bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans","hover:bg-[#1A1816] hover:-translate-y-px hover:shadow-md transition-all","disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:translate-y-0 disabled:hover:shadow-none"),children:[e.jsx(je,{size:14,strokeWidth:2}),v?"Adding...":"Add Entry"]})]})]})]})})}const Xe=[{label:"Kanban",icon:e.jsx(ye,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Table",icon:e.jsx(he,{size:14,strokeWidth:1.8}),shortcut:"2"}],H=["kanban","table"];function dt(){const{activeView:r,setActiveView:c,fetchEntries:o,fetchFiles:a,entries:n,search:d,setSearch:g,selectedEntry:y,setSelectedEntry:u,loading:h,error:v}=f(fe(i=>({activeView:i.activeView,setActiveView:i.setActiveView,fetchEntries:i.fetchEntries,fetchFiles:i.fetchFiles,entries:i.entries,search:i.search,setSearch:i.setSearch,selectedEntry:i.selectedEntry,setSelectedEntry:i.setSelectedEntry,loading:i.loading,error:i.error}))),[N,w]=p.useState(!1),{register:m,unregister:k}=p.useContext(ge),S=p.useCallback(i=>c(H[i]),[c]);p.useEffect(()=>{m({items:Xe.map(i=>({label:i.label,icon:i.icon,shortcut:i.shortcut})),activeIndex:H.indexOf(r),onSwitch:S})},[r,m,S]),p.useEffect(()=>()=>k(),[k]),p.useEffect(()=>{function i(x){x.target instanceof HTMLInputElement||x.target instanceof HTMLTextAreaElement||(x.key==="1"?c("kanban"):x.key==="2"&&c("table"))}return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[c]),p.useEffect(()=>{o(),a()},[o,a]);const s=y?n.find(i=>i.id===y)??null:null;return h&&n.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading specs..."}):v&&n.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load specs"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:v}),e.jsx("button",{type:"button",onClick:()=>void o(),className:"px-3 py-1 rounded-[var(--radius-md)] border border-border bg-bg-card text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",children:"Retry"})]}):e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-[10px] px-5 py-[10px] border-b border-border-divider shrink-0",children:[e.jsx("span",{className:"text-[16px] font-bold text-text-primary",children:"Specs"}),e.jsxs("span",{className:"text-[11px] text-text-tertiary font-mono tabular-nums",children:[n.length," entries"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-[6px] px-3 py-[5px] rounded-[8px] bg-bg-card w-[240px] focus-within:border-[#9178B5] transition-colors",style:{border:"var(--style-btn-secondary-border)"},children:[e.jsx(ve,{size:13,strokeWidth:2,className:"text-text-quaternary shrink-0"}),e.jsx("input",{type:"text",placeholder:"Search specs...",value:d,onChange:i=>g(i.target.value),className:"border-none bg-transparent outline-none text-[12px] text-text-primary font-sans w-full placeholder:text-text-quaternary"})]}),e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"flex items-center gap-[6px] px-[14px] py-[6px] rounded-[8px] border-none bg-text-primary text-white text-[12px] font-semibold cursor-pointer font-sans hover:bg-[#1A1816] hover:[transform:var(--style-card-hover-transform)] hover:[box-shadow:var(--style-card-hover-shadow)] transition-all",children:[e.jsx(Y,{size:14,strokeWidth:2}),"New Entry"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden min-w-0",children:[r==="kanban"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(Ve,{onAddEntry:()=>w(!0)})}),r==="table"&&e.jsx("div",{className:"flex-1 flex flex-col overflow-hidden motion-safe:animate-[view-fade-in_250ms_ease-out_both]",children:e.jsx(Ke,{})})]}),s&&e.jsx(Ue,{entry:s,onClose:()=>u(null)})]}),e.jsx(Qe,{open:N,onOpenChange:w})]})}export{dt as SpecsPage};
@@ -1,6 +0,0 @@
1
- import{o as _e,u as T,b as R,j as e,z as Be,w as Me,r as g,s as X,$ as _}from"./index-DWG-WrzT.js";const m=_e((r,o)=>({activeTab:"commander",learningStats:null,learningPatterns:[],knowledgeEntries:[],scheduledTasks:[],extensions:[],promptModes:[],promptBindings:{},error:null,onLearningUpdate:t=>r({learningStats:t,learningPatterns:t.topPatterns}),onScheduleUpdate:t=>r({scheduledTasks:t}),onScheduleTriggered:t=>r(n=>{const s=new Date().toISOString();return{scheduledTasks:n.scheduledTasks.map(a=>{if(a.id!==t.taskId)return a;const v=a.lastRun?new Date(a.lastRun).getTime():0,p=v>0?Date.now()-v:0;return{...a,lastRun:s,history:[...a.history,{timestamp:s,status:"success",duration:p}]}})}}),onExtensionLoaded:t=>r({extensions:t.extensions}),onExtensionError:t=>r(n=>({extensions:n.extensions.map(x=>x.name!==t.name?x:{...x,status:"disabled"})})),fetchLearningStats:async()=>{try{const t=await fetch("/api/supervisor/learning/stats");if(!t.ok){r({error:`Failed to fetch learning stats: ${t.status}`});return}const n=await t.json();if(n&&typeof n=="object"&&"topPatterns"in n){const s=n;r({learningStats:s,learningPatterns:s.topPatterns,error:null})}}catch(t){r({error:`Failed to fetch learning stats: ${t instanceof Error?t.message:String(t)}`})}},fetchSchedules:async()=>{try{const t=await fetch("/api/supervisor/schedules");if(!t.ok){r({error:`Failed to fetch schedules: ${t.status}`});return}const n=await t.json(),s=n&&typeof n=="object"&&"tasks"in n?n.tasks:Array.isArray(n)?n:[];r({scheduledTasks:s,error:null})}catch(t){r({error:`Failed to fetch schedules: ${t instanceof Error?t.message:String(t)}`})}},fetchExtensions:async()=>{try{const t=await fetch("/api/supervisor/extensions");if(!t.ok){r({error:`Failed to fetch extensions: ${t.status}`});return}const n=await t.json(),s=n&&typeof n=="object"&&"extensions"in n?n.extensions:Array.isArray(n)?n:[];r({extensions:s,error:null})}catch(t){r({error:`Failed to fetch extensions: ${t instanceof Error?t.message:String(t)}`})}},fetchPromptModes:async()=>{try{const t=await fetch("/api/supervisor/prompts");if(!t.ok){r({error:`Failed to fetch prompt modes: ${t.status}`});return}const n=await t.json();if(n&&typeof n=="object"){const s=n,x=Array.isArray(s.builders)?s.builders:[],a=s.bindings&&typeof s.bindings=="object"?s.bindings:{};r({promptModes:x,promptBindings:a,error:null})}}catch(t){r({error:`Failed to fetch prompt modes: ${t instanceof Error?t.message:String(t)}`})}},createSchedule:async t=>{try{const n=await fetch("/api/supervisor/schedules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok){r({error:`Failed to create schedule: ${n.status}`});return}const s=await n.json();if(s&&typeof s=="object"&&"task"in s){const x=s.task;r(a=>({scheduledTasks:[...a.scheduledTasks,x],error:null}))}}catch(n){r({error:`Failed to create schedule: ${n instanceof Error?n.message:String(n)}`})}},updateSchedule:async(t,n)=>{try{const s=await fetch(`/api/supervisor/schedules/${encodeURIComponent(t)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!s.ok){r({error:`Failed to update schedule: ${s.status}`});return}const x=await s.json();if(x&&typeof x=="object"&&"task"in x){const a=x.task;r(v=>({scheduledTasks:v.scheduledTasks.map(p=>p.id===t?a:p),error:null}))}}catch(s){r({error:`Failed to update schedule: ${s instanceof Error?s.message:String(s)}`})}},deleteSchedule:async t=>{try{const n=await fetch(`/api/supervisor/schedules/${encodeURIComponent(t)}`,{method:"DELETE"});if(!n.ok){r({error:`Failed to delete schedule: ${n.status}`});return}r(s=>({scheduledTasks:s.scheduledTasks.filter(x=>x.id!==t),error:null}))}catch(n){r({error:`Failed to delete schedule: ${n instanceof Error?n.message:String(n)}`})}},toggleSchedule:async(t,n)=>{await o().updateSchedule(t,{enabled:n})},runSchedule:async t=>{try{const n=await fetch(`/api/supervisor/schedules/${encodeURIComponent(t)}/run`,{method:"POST"});n.ok||r({error:`Failed to run schedule: ${n.status}`})}catch(n){r({error:`Failed to run schedule: ${n instanceof Error?n.message:String(n)}`})}},setActiveTab:t=>r({activeTab:t}),clearError:()=>r({error:null})}));function $e(r){const o=Date.now()-new Date(r).getTime(),t=Math.floor(o/1e3);if(t<60)return`${t}s`;const n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Ae(){var y;const{t:r}=T(),o=R(i=>i.slots),t=R(i=>i.queue),n=R(i=>i.supervisorStatus),s=Object.values(o),x=(n==null?void 0:n.stats.totalDispatched)??0,a=(n==null?void 0:n.stats.totalCompleted)??0,v=(n==null?void 0:n.stats.totalFailed)??0,p=x>0?Math.round(a/x*100):0;return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflowY:"auto",padding:24,gap:20},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12},children:[e.jsx(Z,{label:r("supervisor.overview.dispatched"),value:String(x),sub:`${s.length} ${r("supervisor.overview.active")}`}),e.jsx(Z,{label:r("supervisor.overview.success_rate"),value:x?`${p}%`:"-",valueColor:"var(--color-accent-green)",sub:`${a} ${r("supervisor.overview.completed")}`}),e.jsx(Z,{label:r("supervisor.overview.queued"),value:String(t.length),sub:`${((y=n==null?void 0:n.retrying)==null?void 0:y.length)??0} retrying`}),e.jsx(Z,{label:"Failed",value:String(v),valueColor:v>0?"var(--color-accent-red)":void 0,sub:x>0?`${Math.round(v/x*100)}% fail rate`:"-"})]}),e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r("supervisor.overview.active_executions")}),e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)"},children:r("supervisor.overview.running_count",{count:s.length})})]}),e.jsx("div",{children:s.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:16},children:"No active executions"}):s.map(i=>{const d=Be[i.executor]??"var(--color-text-tertiary)",k=Me[i.executor]??i.executor;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:d,flexShrink:0}}),e.jsx("span",{style:{fontSize:12,fontWeight:500,color:"var(--color-text-primary)"},children:i.issueId}),e.jsx("span",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:k}),e.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)"},children:["Turn ",i.turnNumber,"/",i.maxTurns]}),e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",marginLeft:"auto"},children:$e(i.startedAt)})]},i.processId)})})]}),t.length>0&&e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsxs("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:["Queue (",t.length,")"]})}),e.jsx("div",{children:t.map((i,d)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsxs("span",{style:{fontSize:10,fontWeight:600,color:"var(--color-text-tertiary)",minWidth:20},children:["#",d+1]}),e.jsx("span",{style:{fontSize:12,fontWeight:500,color:"var(--color-text-primary)"},children:i})]},i))})]})]})}function Z({label:r,value:o,sub:t,valueColor:n}){return e.jsxs("div",{style:{flex:1,background:"var(--color-bg-primary)",borderRadius:10,padding:14,border:"1px solid var(--color-border-divider)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:r}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:n??"var(--color-text-primary)",marginTop:2},children:o}),e.jsx("div",{style:{fontSize:10,color:"var(--color-text-secondary)"},children:t})]})}const De={optimize:"var(--color-accent-green)",alert:"var(--color-accent-orange)",automate:"var(--color-accent-purple)"};function Ee(){const{t:r}=T(),o=R(i=>i.commanderState),t=R(i=>i.commanderConfig),n=R(i=>i.fetchCommanderConfig),s=R(i=>i.recentDecisions),x=m(i=>i.setActiveTab),a=m(i=>i.learningStats);g.useEffect(()=>{n()},[n]);const v=()=>X({action:"commander:stop"}),p=s.length>0?s[s.length-1]:null,y=(a==null?void 0:a.suggestions)??[];return e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px 40px"},children:[e.jsxs("div",{style:re,children:[e.jsxs("div",{style:K,children:[e.jsx("div",{style:Q,children:r("supervisor.commander.metrics")}),e.jsxs("div",{style:{display:"flex",gap:6},children:[e.jsx("button",{type:"button",onClick:()=>x("executions"),style:Pe,children:r("supervisor.commander.view_executions")??"View Executions"}),e.jsx("button",{type:"button",onClick:v,style:Ne,children:r("supervisor.commander.stop")})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12},children:[e.jsx(ge,{label:r("supervisor.commander.ticks"),value:String((o==null?void 0:o.tickCount)??0),sub:o!=null&&o.sessionId?`Session ${o.sessionId.slice(0,8)}`:void 0}),e.jsx(ge,{label:r("supervisor.commander.workers"),value:String((o==null?void 0:o.activeWorkers)??0),sub:t?`Max: ${t.maxConcurrentWorkers}`:void 0}),e.jsx(ge,{label:r("supervisor.commander.last_tick"),value:o!=null&&o.lastTickAt?we(o.lastTickAt):"--:--:--",valueStyle:{fontSize:16},sub:o!=null&&o.lastTickAt?Fe(o.lastTickAt):void 0})]})]}),t&&e.jsxs("div",{style:re,children:[e.jsx("div",{style:K,children:e.jsx("div",{style:Q,children:r("supervisor.commander.config")})}),e.jsxs("div",{style:He,children:[e.jsx(ee,{label:r("supervisor.commander.profile"),desc:r("supervisor.commander.profile_desc")??"Environment-specific behavior preset",children:e.jsx("select",{value:t.profile,onChange:i=>X({action:"commander:config",config:{profile:i.target.value}}),style:fe,children:["development","staging","production"].map(i=>e.jsx("option",{value:i,children:i},i))})}),e.jsx(ee,{label:r("supervisor.commander.decision_model"),desc:r("supervisor.commander.decision_model_desc")??"AI model for orchestration decisions",children:e.jsx("select",{value:t.decisionModel,onChange:i=>X({action:"commander:config",config:{decisionModel:i.target.value}}),style:fe,children:["haiku","sonnet","opus"].map(i=>e.jsx("option",{value:i,children:i},i))})}),e.jsx(ee,{label:r("supervisor.commander.auto_approve"),desc:r("supervisor.commander.auto_approve_desc")??"Confidence threshold for auto-approval",children:e.jsx("select",{value:t.autoApproveThreshold,onChange:i=>X({action:"commander:config",config:{autoApproveThreshold:i.target.value}}),style:fe,children:["low","medium","high"].map(i=>e.jsx("option",{value:i,children:i},i))})}),e.jsx(ee,{label:r("supervisor.commander.max_workers")??"Max Workers",desc:r("supervisor.commander.max_workers_desc")??"Maximum parallel agent executions",isLast:!0,children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",padding:"4px 10px"},children:t.maxConcurrentWorkers})})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:[e.jsxs("div",{style:re,children:[e.jsxs("div",{style:K,children:[e.jsx("div",{style:Q,children:r("supervisor.commander.decision_history")}),e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r("supervisor.commander.decisions_count",{count:s.length})})]}),e.jsx("div",{style:ye,children:e.jsx("div",{style:{padding:"14px 16px"},children:s.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:16},children:r("supervisor.commander.no_decisions")}):s.slice().reverse().map((i,d,k)=>{const j=we(i.timestamp),f=i.actions.length>0?"var(--color-accent-green)":"var(--color-accent-gray)",I=d===k.length-1;return e.jsxs("div",{style:{display:"flex",gap:12,padding:"10px 0",position:"relative"},children:[!I&&e.jsx("div",{style:{position:"absolute",left:11,top:30,bottom:-10,width:1,background:"var(--color-border-divider)"}}),e.jsx("div",{style:qe,children:e.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:f}})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:10,fontFamily:"'SF Mono', Consolas, monospace",color:"var(--color-text-placeholder)"},children:j}),e.jsxs("div",{style:{fontSize:12,color:"var(--color-text-primary)"},children:[i.trigger," - ",i.actions.length," action",i.actions.length!==1?"s":""]}),i.deferred.length>0&&e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:[i.deferred.length," deferred"]})]})]},i.id)})})})]}),e.jsxs("div",{style:re,children:[e.jsx("div",{style:K,children:e.jsx("div",{style:Q,children:r("supervisor.commander.latest_assessment")})}),e.jsx("div",{style:ye,children:e.jsx("div",{style:{padding:"14px 16px"},children:p!=null&&p.assessment?e.jsxs(e.Fragment,{children:[p.assessment.observations.length>0&&e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("div",{style:Ce,children:r("supervisor.commander.observations")}),e.jsx("div",{style:{fontSize:11,color:"var(--color-text-secondary)",paddingLeft:8,lineHeight:1.8},children:p.assessment.observations.map((i,d)=>e.jsxs("div",{children:["- ",i]},d))})]}),p.assessment.risks.length>0&&e.jsxs("div",{children:[e.jsx("div",{style:Ce,children:r("supervisor.commander.risks")}),e.jsx("div",{style:{fontSize:11,color:"var(--color-accent-red)",paddingLeft:8,lineHeight:1.8},children:p.assessment.risks.map((i,d)=>e.jsxs("div",{children:["- ",i]},d))})]})]}):e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:8},children:r("supervisor.commander.no_decisions")})})}),e.jsxs("div",{style:{marginTop:16},children:[e.jsxs("div",{style:K,children:[e.jsx("div",{style:Q,children:r("supervisor.commander.suggestions")??"Suggestions"}),y.length>0&&e.jsxs("span",{style:{fontSize:9,fontWeight:700,padding:"2px 8px",borderRadius:100,background:"var(--color-tint-verifying)",color:"var(--color-accent-orange)"},children:[y.length," new"]})]}),e.jsx("div",{style:ye,children:e.jsx("div",{style:{padding:"14px 16px"},children:y.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:8},children:r("supervisor.commander.no_suggestions")??"No suggestions"}):y.map((i,d)=>e.jsxs("div",{style:{display:"flex",gap:10,padding:"10px 0",borderBottom:d<y.length-1?"1px solid var(--color-border-divider)":"none"},children:[e.jsx("div",{style:{width:8,height:8,borderRadius:"50%",marginTop:5,flexShrink:0,background:De[i.type]??"var(--color-accent-gray)"}}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:i.title}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-secondary)",marginTop:1},children:[i.description," (",Math.round(i.confidence*100),"%)"]})]})]},d))})})]})]})]})]})}function ge({label:r,value:o,sub:t,valueStyle:n}){return e.jsxs("div",{style:Oe,children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:r}),e.jsx("div",{style:{fontSize:20,fontWeight:800,color:"var(--color-text-primary)",marginTop:2,...n},children:o}),t&&e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:t})]})}function ee({label:r,desc:o,children:t,isLast:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:n?"none":"1px solid var(--color-border-divider)"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:500,color:"var(--color-text-primary)"},children:r}),e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)",marginTop:2},children:o})]}),t]})}function we(r){const o=new Date(r);return`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}:${String(o.getSeconds()).padStart(2,"0")}`}function Fe(r){const o=Math.floor((Date.now()-new Date(r).getTime())/1e3);return o<60?`${o}s ago`:o<3600?`${Math.floor(o/60)} min ago`:`${Math.floor(o/3600)}h ago`}const re={marginBottom:24},K={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},Q={fontSize:13,fontWeight:700,color:"var(--color-text-primary)"},ye={background:"var(--color-bg-card)",borderRadius:12,border:"1px solid var(--color-border-divider)",overflow:"hidden"},Oe={background:"var(--color-bg-card)",borderRadius:10,padding:"14px 16px",border:"1px solid var(--color-border-divider)"},He={background:"var(--color-bg-card)",borderRadius:12,border:"1px solid var(--color-border-divider)",overflow:"hidden"},fe={fontSize:12,fontWeight:600,color:"var(--color-text-primary)",padding:"4px 10px",borderRadius:6,border:"1px solid var(--color-border)",background:"var(--color-bg-primary)",minWidth:100,textAlign:"center",cursor:"pointer"},qe={width:22,height:22,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"2px solid var(--color-bg-primary)"},Ce={fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:"var(--color-text-tertiary)",marginBottom:6},Ie={fontSize:11,fontWeight:600,padding:"5px 12px",borderRadius:8,border:"1px solid var(--color-border)",background:"none",cursor:"pointer",color:"var(--color-text-secondary)",transition:"all 150ms"},Pe={...Ie},Ne={...Ie,color:"var(--color-accent-red)",borderColor:"var(--color-accent-red)"},Ye=["claude","gemini","codex","qwen","opencode"],oe={running:{bg:"var(--color-tint-running)",color:"var(--color-accent-blue)"},awaiting_clarification:{bg:"var(--color-tint-verifying)",color:"var(--color-accent-orange)"},completed:{bg:"var(--color-tint-completed)",color:"var(--color-accent-green)"},failed:{bg:"var(--color-tint-failed)",color:"var(--color-accent-red)"},paused:{bg:"var(--color-tint-pending)",color:"var(--color-accent-gray)"},idle:{bg:"var(--color-tint-pending)",color:"var(--color-accent-gray)"}},P={completed:{bg:"var(--color-tint-completed)",dot:"var(--color-accent-green)"},running:{bg:"var(--color-tint-running)",dot:"var(--color-accent-blue)"},pending:{bg:"transparent",dot:"var(--color-accent-gray)"},failed:{bg:"var(--color-tint-failed)",dot:"var(--color-accent-red)"},skipped:{bg:"var(--color-tint-pending)",dot:"var(--color-accent-gray)"}};function Ke(){const{t:r}=T(),o=_(l=>l.session),t=_(l=>l.selectedStepIndex),n=_(l=>l.clarificationQuestion),s=_(l=>l.start),x=_(l=>l.stop),a=_(l=>l.resume),v=_(l=>l.selectStep),p=_(l=>l.sendClarification),[y,i]=g.useState(""),[d,k]=g.useState("claude"),[j,f]=g.useState(!0),[I,$]=g.useState(""),[L,B]=g.useState(""),C=g.useRef(null),b=o!=null&&o.status!=="idle",u=b&&o.status==="running",E=(o==null?void 0:o.status)==="awaiting_clarification",w=(o==null?void 0:o.steps)??[],h=t!=null?w[t]??null:null,z=w.filter(l=>l.status==="completed"),F=w.length,he=F>0?Math.round(z.length/F*100):0,O=(o==null?void 0:o.avgQuality)??(z.length>0?z.reduce((l,S)=>l+(S.qualityScore??0),0)/z.length:null),H=g.useCallback(()=>{var q;if(!o||!w.length)return"--";const l=(q=w[0])==null?void 0:q.startedAt;if(!l)return"--";const S=Date.now()-new Date(l).getTime();if(S<0)return"--";const W=Math.floor(S/1e3),M=Math.floor(W/60),J=Math.floor(M/60);return J>0?`${J}h ${M%60}m`:M>0?`${M}m ${W%60}s`:`${W}s`},[o,w]);g.useEffect(()=>(u?(B(H()),C.current=setInterval(()=>B(H()),1e3)):(B(H()),C.current&&clearInterval(C.current)),()=>{C.current&&clearInterval(C.current)}),[u,H]),g.useEffect(()=>{if(!b||t!=null)return;const l=w.findIndex(S=>S.status==="running");l>=0?v(l):w.length>0&&v(0)},[b,w,t,v]);const G=()=>{y.trim()&&(s(y.trim(),d,j),i(""))},c=()=>{!I.trim()||!o||(p(o.sessionId,I.trim()),$(""))},Y=l=>{if(l.durationMs!=null){const S=Math.floor(l.durationMs/1e3),W=Math.floor(S/60);return W>0?`${W}m ${S%60}s`:`${S}s`}if(l.status==="running"&&l.startedAt){const S=Math.floor((Date.now()-new Date(l.startedAt).getTime())/1e3),W=Math.floor(S/60);return W>0?`${W}m ${S%60}s...`:`${S}s...`}return""},A=l=>l>=70?"var(--color-accent-green)":l>=40?"var(--color-accent-orange)":"var(--color-accent-red)",ke=l=>l>=70?"var(--color-tint-completed)":l>=40?"var(--color-tint-verifying)":"var(--color-tint-failed)",Le=l=>{switch(l){case"running":return"Running";case"awaiting_clarification":return"Needs Clarification";case"completed":return"Completed";case"failed":return"Failed";case"paused":return"Paused";default:return l}};return e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px 40px"},children:[e.jsxs("div",{style:V,children:[e.jsxs("div",{style:te,children:[e.jsx("div",{style:ne,children:r("supervisor.coordinator.title")}),b&&e.jsxs("div",{style:{display:"flex",gap:6},children:[u&&e.jsx("button",{type:"button",onClick:x,style:Ve,children:r("supervisor.coordinator.stop")}),(o.status==="paused"||o.status==="failed")&&e.jsx("button",{type:"button",onClick:()=>a(),style:Ue,children:r("supervisor.coordinator.resume")})]})]}),e.jsx("div",{style:Ge,children:e.jsxs("div",{style:Je,children:[e.jsx("input",{style:Xe,placeholder:r("supervisor.coordinator.describe_intent"),value:y,onChange:l=>i(l.target.value),onKeyDown:l=>{l.key==="Enter"&&G()}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0},children:[e.jsx("select",{style:Ze,value:d,onChange:l=>k(l.target.value),children:Ye.map(l=>e.jsx("option",{value:l,children:l},l))}),e.jsx("button",{type:"button",style:j?er:rr,onClick:()=>f(!j),children:r(j?"supervisor.coordinator.auto":"supervisor.coordinator.manual")}),e.jsx("button",{type:"button",style:Qe,onClick:G,children:r("supervisor.coordinator.start")})]})]})})]}),b&&e.jsxs("div",{style:V,children:[e.jsxs("div",{style:te,children:[e.jsx("div",{style:ne,children:"Session"}),e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"2px 8px",borderRadius:100,background:(oe[o.status]??oe.idle).bg,color:(oe[o.status]??oe.idle).color},children:Le(o.status)})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:12},children:[e.jsxs("div",{style:ie,children:[e.jsx("div",{style:se,children:r("supervisor.coordinator.chain")}),e.jsx("div",{style:{...le,fontSize:16},children:o.chainName??"--"}),e.jsx("div",{style:ae,children:o.intent||"--"})]}),e.jsxs("div",{style:ie,children:[e.jsx("div",{style:se,children:r("supervisor.coordinator.progress")}),e.jsxs("div",{style:le,children:[z.length,e.jsxs("span",{style:{fontSize:13,fontWeight:500,color:"var(--color-text-tertiary)"},children:[" / ",F]})]}),e.jsx("div",{style:ae,children:e.jsx("div",{style:{height:3,background:"rgba(0,0,0,0.06)",borderRadius:100,overflow:"hidden",marginTop:4},children:e.jsx("div",{style:{height:"100%",borderRadius:100,background:"linear-gradient(90deg, var(--color-accent-blue), var(--color-accent-green))",width:`${he}%`,transition:"width 0.6s"}})})})]}),e.jsxs("div",{style:ie,children:[e.jsx("div",{style:se,children:r("supervisor.coordinator.avg_quality")}),e.jsx("div",{style:{...le,color:O!=null?A(O):"var(--color-text-primary)"},children:O!=null?O.toFixed(1):"--"}),e.jsx("div",{style:ae,children:z.length>0?r("supervisor.coordinator.from_steps",{count:z.length}):"--"})]}),e.jsxs("div",{style:ie,children:[e.jsx("div",{style:se,children:r("supervisor.coordinator.elapsed")}),e.jsx("div",{style:{...le,fontSize:16},children:L}),e.jsxs("div",{style:ae,children:[r("supervisor.coordinator.tool_label"),": ",o.tool??d]})]})]})]}),E&&n&&e.jsx("div",{style:V,children:e.jsxs("div",{style:or,children:[e.jsxs("div",{style:tr,children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),e.jsx("span",{style:nr,children:r("supervisor.coordinator.clarification_needed")})]}),e.jsxs("div",{style:{padding:"14px 16px"},children:[e.jsx("div",{style:ir,children:n}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("input",{style:sr,placeholder:r("supervisor.coordinator.type_response"),value:I,onChange:l=>$(l.target.value),onKeyDown:l=>{l.key==="Enter"&&c()}}),e.jsxs("button",{type:"button",style:lr,onClick:c,children:[e.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]}),r("supervisor.coordinator.send")]})]})]})]})}),b&&w.length>0&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16},children:[e.jsxs("div",{style:V,children:[e.jsxs("div",{style:te,children:[e.jsx("div",{style:ne,children:r("supervisor.coordinator.chain_steps")}),e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r("supervisor.coordinator.steps_count",{count:F})})]}),e.jsx("div",{style:D,children:e.jsx("div",{style:{padding:"14px 16px"},children:w.map((l,S)=>{const W=P[l.status]??P.pending,M=t===S,J=S===w.length-1,q=Y(l);return e.jsxs("div",{onClick:()=>v(S),style:{display:"flex",gap:12,padding:"10px 8px",position:"relative",cursor:"pointer",background:M?"var(--color-bg-hover)":"transparent",borderRadius:M?8:0,margin:M?"0 -8px":"0"},children:[!J&&e.jsx("div",{style:{position:"absolute",left:M?19:11,top:30,bottom:-10,width:1,background:l.status==="completed"?"var(--color-accent-green)":"var(--color-border-divider)",opacity:l.status==="completed"?.4:1}}),e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,background:W.bg,border:"2px solid var(--color-bg-primary)"},children:e.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:W.dot,animation:l.status==="running"?"pulse 2s infinite":void 0}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:l.cmd}),l.args&&e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:l.args}),(q||l.qualityScore!=null||l.status==="running")&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:3},children:[q&&e.jsx("span",{style:{fontSize:10,fontFamily:"'SF Mono', Consolas, monospace",color:"var(--color-text-placeholder)"},children:q}),l.qualityScore!=null&&e.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"1px 7px",borderRadius:100,background:ke(l.qualityScore),color:A(l.qualityScore)},children:l.qualityScore}),l.status==="running"&&l.qualityScore==null&&e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"2px 8px",borderRadius:100,background:"var(--color-tint-running)",color:"var(--color-accent-blue)"},children:"running"})]})]})]},l.index)})})})]}),e.jsx("div",{style:V,children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:te,children:[e.jsxs("div",{style:ne,children:["Step ",(t??0)+1,": ",h.cmd]}),e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"2px 8px",borderRadius:100,background:(P[h.status]??P.pending).bg||"var(--color-tint-pending)",color:(P[h.status]??P.pending).dot},children:h.status})]}),h.status==="completed"&&h.qualityScore!=null&&e.jsx("div",{style:{marginBottom:16},children:e.jsxs("div",{style:D,children:[e.jsxs("div",{style:je,children:[e.jsx("span",{style:me,children:r("supervisor.coordinator.quality_score")}),e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"2px 8px",borderRadius:100,background:ke(h.qualityScore),color:A(h.qualityScore)},children:h.qualityScore})]}),e.jsx("div",{style:{padding:"14px 16px"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[e.jsxs("div",{style:{width:48,height:48,position:"relative",flexShrink:0},children:[e.jsxs("svg",{viewBox:"0 0 36 36",width:"48",height:"48",style:{transform:"rotate(-90deg)"},children:[e.jsx("circle",{cx:"18",cy:"18",r:"15.9",fill:"none",stroke:"var(--color-bg-secondary)",strokeWidth:"5"}),e.jsx("circle",{cx:"18",cy:"18",r:"15.9",fill:"none",stroke:A(h.qualityScore),strokeWidth:"5",strokeLinecap:"round",strokeDasharray:"100",strokeDashoffset:100-h.qualityScore})]}),e.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:800,color:"var(--color-text-primary)"},children:h.qualityScore})]}),h.summary&&e.jsx("div",{style:{flex:1,fontSize:11,color:"var(--color-text-secondary)",lineHeight:1.6},children:h.summary})]})})]})}),h.status==="completed"&&h.summary&&e.jsx("div",{style:{marginBottom:16},children:e.jsxs("div",{style:D,children:[e.jsx("div",{style:je,children:e.jsx("span",{style:me,children:r("supervisor.coordinator.summary")})}),e.jsx("div",{style:{padding:"14px 16px"},children:e.jsx("div",{style:{fontSize:12,color:"var(--color-text-primary)",lineHeight:1.7},children:h.summary})})]})}),(h.status==="running"||h.status==="completed")&&h.analysis&&e.jsx("div",{style:{marginBottom:16},children:e.jsxs("div",{style:D,children:[e.jsx("div",{style:je,children:e.jsx("span",{style:me,children:r("supervisor.coordinator.analysis")})}),e.jsx("pre",{style:ar,children:h.analysis})]})}),(h.status==="pending"||h.status==="skipped")&&e.jsx("div",{style:D,children:e.jsx("div",{style:{padding:"14px 16px"},children:e.jsxs("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--color-text-tertiary)"},children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.2,margin:"0 auto 10px",display:"block"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--color-text-secondary)"},children:r("supervisor.coordinator.waiting_execute")}),e.jsx("div",{style:{fontSize:11,marginTop:4,maxWidth:300,marginLeft:"auto",marginRight:"auto",lineHeight:1.6},children:r("supervisor.coordinator.pending_desc")})]})})})]}):e.jsx("div",{style:D,children:e.jsx("div",{style:{padding:"14px 16px"},children:e.jsx("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--color-text-tertiary)",fontSize:11},children:"Select a step to view details"})})})})]}),!b&&e.jsx("div",{style:D,children:e.jsx("div",{style:{padding:"14px 16px"},children:e.jsxs("div",{style:{textAlign:"center",padding:"48px 20px",color:"var(--color-text-tertiary)"},children:[e.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",style:{opacity:.2,margin:"0 auto 10px",display:"block"},children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 5.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"var(--color-text-secondary)"},children:r("supervisor.coordinator.no_session")}),e.jsx("div",{style:{fontSize:11,marginTop:4,maxWidth:300,marginLeft:"auto",marginRight:"auto",lineHeight:1.6},children:r("supervisor.coordinator.no_session_desc")})]})})})]})}const V={marginBottom:24},te={display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},ne={fontSize:13,fontWeight:700,color:"var(--color-text-primary)"},D={background:"var(--color-bg-card)",borderRadius:12,border:"1px solid var(--color-border-divider)",overflow:"hidden"},je={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},me={fontSize:12,fontWeight:700,color:"var(--color-text-primary)"},ie={background:"var(--color-bg-card)",borderRadius:10,padding:"14px 16px",border:"1px solid var(--color-border-divider)"},se={fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},le={fontSize:20,fontWeight:800,color:"var(--color-text-primary)",marginTop:2},ae={fontSize:10,color:"var(--color-text-tertiary)"},Se={fontSize:11,fontWeight:600,padding:"5px 12px",borderRadius:8,border:"1px solid var(--color-border)",background:"none",cursor:"pointer",color:"var(--color-text-secondary)",transition:"all 150ms"},Qe={...Se,background:"var(--color-text-primary)",color:"#fff",borderColor:"var(--color-text-primary)"},Ve={...Se,color:"var(--color-accent-red)",borderColor:"var(--color-accent-red)"},Ue={...Se,color:"var(--color-accent-green)",borderColor:"var(--color-accent-green)"},Ge={background:"var(--color-bg-card)",borderRadius:12,border:"1px solid var(--color-border-divider)",overflow:"hidden"},Je={display:"flex",alignItems:"center",gap:10,padding:"10px 16px"},Xe={flex:1,border:"none",background:"transparent",fontSize:13,color:"var(--color-text-primary)",outline:"none",fontFamily:"inherit",lineHeight:1.5},Ze={padding:"4px 8px",borderRadius:6,fontSize:11,fontWeight:600,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-primary)",color:"var(--color-text-secondary)",cursor:"pointer",outline:"none"},er={fontSize:9,fontWeight:700,padding:"3px 8px",borderRadius:100,border:"none",cursor:"pointer",transition:"all 150ms",background:"var(--color-tint-completed)",color:"var(--color-accent-green)"},rr={fontSize:9,fontWeight:700,padding:"3px 8px",borderRadius:100,border:"none",cursor:"pointer",transition:"all 150ms",background:"var(--color-tint-pending)",color:"var(--color-accent-gray)"},or={background:"var(--color-bg-card)",borderRadius:12,border:"2px solid var(--color-accent-orange)",overflow:"hidden"},tr={display:"flex",alignItems:"center",gap:8,padding:"10px 16px",background:"var(--color-tint-verifying)",color:"var(--color-accent-orange)"},nr={fontSize:11,fontWeight:700,textTransform:"uppercase",letterSpacing:".04em"},ir={fontSize:12,color:"var(--color-text-primary)",lineHeight:1.6,marginBottom:10},sr={flex:1,padding:"7px 12px",fontSize:12,borderRadius:8,border:"1px solid var(--color-border)",background:"var(--color-bg-primary)",color:"var(--color-text-primary)",outline:"none"},lr={padding:"7px 14px",border:"none",borderRadius:8,background:"var(--color-accent-orange)",color:"#fff",fontSize:11,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:4},ar={margin:0,padding:"14px 16px",fontSize:11,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'SF Mono', Consolas, monospace",background:"#2C2723",color:"#D9D0C4",borderRadius:"0 0 12px 12px",maxHeight:220,overflowY:"auto"};function dr(){const{t:r}=T(),o=m(d=>d.promptModes),t=m(d=>d.promptBindings),[n,s]=g.useState(null),[x,a]=g.useState(""),[v,p]=g.useState(""),y=v?o.filter(d=>d.toLowerCase().includes(v.toLowerCase())):o,i=d=>{s(d),a(t[d]??"")};return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{style:{width:320,background:"var(--color-bg-primary)",borderRight:"1px solid var(--color-border)",flexShrink:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"var(--color-text-primary)"},children:r("supervisor.prompts.title")}),e.jsx("span",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r("supervisor.prompts.builders_count",{count:o.length})})]}),e.jsx("input",{value:v,onChange:d=>p(d.target.value),placeholder:r("supervisor.prompts.filter"),style:{margin:"10px 12px 6px",padding:"8px 12px",borderRadius:8,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-card)",fontSize:12,color:"var(--color-text-primary)",outline:"none"}}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:y.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:16},children:r(v?"supervisor.prompts.no_matches":"supervisor.prompts.no_modes")}):y.map(d=>{const k=d===n,j=!!t[d];return e.jsxs("button",{type:"button",onClick:()=>i(d),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 16px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",background:k?"var(--color-tint-exploring)":"none",borderLeft:`3px solid ${k?"var(--color-accent-blue)":"transparent"}`,transition:"all 120ms"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-planning)",color:"var(--color-accent-purple)",flexShrink:0},children:e.jsxs("svg",{style:{width:14,height:14,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 7 4 4 20 4 20 7"}),e.jsx("line",{x1:"9",y1:"20",x2:"15",y2:"20"}),e.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:d}),e.jsx("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r(j?"supervisor.prompts.bound":"supervisor.prompts.unbound")})]}),j&&e.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"2px 8px",borderRadius:100,background:"rgba(90,158,120,0.12)",color:"var(--color-accent-green)"},children:"active"})]},d)})})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid var(--color-border-divider)",flexShrink:0},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-planning)",color:"var(--color-accent-purple)"},children:e.jsxs("svg",{style:{width:18,height:18,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 7 4 4 20 4 20 7"}),e.jsx("line",{x1:"9",y1:"20",x2:"15",y2:"20"}),e.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"})]})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"var(--color-text-primary)"},children:n}),e.jsx("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:r("supervisor.prompts.prompt_builder")})]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r("supervisor.prompts.binding")})}),e.jsxs("div",{style:{padding:"14px 16px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 0",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:120,flexShrink:0},children:r("supervisor.prompts.mode")}),e.jsx("span",{style:{fontSize:12,color:"var(--color-text-primary)",fontWeight:500},children:n})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 0"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:120,flexShrink:0},children:r("supervisor.prompts.status")}),e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:t[n]?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:t[n]?"var(--color-accent-green)":"var(--color-accent-gray)"},children:t[n]?r("supervisor.prompts.bound"):r("supervisor.prompts.unbound")})]})]})]}),e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r("supervisor.prompts.template")})}),e.jsx("div",{style:{padding:"14px 16px"},children:e.jsx("textarea",{value:x,onChange:d=>a(d.target.value),placeholder:r("supervisor.prompts.edit_placeholder"),style:{width:"100%",minHeight:160,resize:"vertical",borderRadius:8,padding:12,fontSize:12,fontFamily:"'SF Mono', Consolas, monospace",lineHeight:1.6,background:"var(--color-bg-secondary)",color:"var(--color-text-primary)",border:"1px solid var(--color-border-divider)",outline:"none"}})})]}),x&&e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r("supervisor.prompts.preview")})}),e.jsx("div",{style:{padding:0},children:e.jsx("pre",{style:{margin:0,padding:16,fontSize:11,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"'SF Mono', Consolas, monospace",maxHeight:200,overflowY:"auto",background:"var(--color-text-primary)",color:"#d4d0ca",borderRadius:"0 0 12px 12px"},children:x})})]})]})]}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:13},children:r("supervisor.prompts.select_detail")})})]})}const pe={strategy:{bg:"var(--color-tint-exploring)",fg:"var(--color-accent-blue)"},builder:{bg:"var(--color-tint-completed)",fg:"var(--color-accent-green)"},adapter:{bg:"var(--color-tint-verifying)",fg:"var(--color-accent-orange)"},task:{bg:"var(--color-tint-planning)",fg:"var(--color-accent-purple)"},tool:{bg:"var(--color-tint-pending)",fg:"var(--color-accent-gray)"}},xe={strategy:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),e.jsx("path",{d:"M2 17l10 5 10-5"}),e.jsx("path",{d:"M2 12l10 5 10-5"})]}),builder:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"3",y1:"9",x2:"21",y2:"9"}),e.jsx("line",{x1:"9",y1:"21",x2:"9",y2:"9"})]}),adapter:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"16 18 22 12 16 6"}),e.jsx("polyline",{points:"8 6 2 12 8 18"})]}),task:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),tool:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09"})]})};function cr(){const{t:r}=T(),o=m(p=>p.extensions),[t,n]=g.useState(null),[s,x]=g.useState(""),a=s?o.filter(p=>p.name.toLowerCase().includes(s.toLowerCase())||p.type.toLowerCase().includes(s.toLowerCase())):o,v=o.find(p=>p.name===t)??null;return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{style:{width:320,background:"var(--color-bg-primary)",borderRight:"1px solid var(--color-border)",flexShrink:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"var(--color-text-primary)"},children:r("supervisor.extensions.title")}),e.jsx("span",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r("supervisor.extensions.loaded_count",{count:o.length})})]}),e.jsx("input",{value:s,onChange:p=>x(p.target.value),placeholder:r("supervisor.extensions.filter"),style:{margin:"10px 12px 6px",padding:"8px 12px",borderRadius:8,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-card)",fontSize:12,color:"var(--color-text-primary)",outline:"none"}}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:a.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:16},children:r(s?"supervisor.extensions.no_matches":"supervisor.extensions.no_extensions")}):a.map(p=>{const y=p.name===t,i=pe[p.type]??pe.tool;return e.jsxs("button",{type:"button",onClick:()=>n(p.name),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 16px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",background:y?"var(--color-tint-exploring)":"none",borderLeft:`3px solid ${y?"var(--color-accent-blue)":"transparent"}`,transition:"all 120ms"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",background:i.bg,color:i.fg,flexShrink:0},children:e.jsx("span",{style:{width:14,height:14,strokeWidth:1.8,display:"flex"},children:xe[p.type]??xe.tool})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:p.name}),e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)",display:"flex",gap:8},children:[e.jsxs("span",{children:["v",p.version]}),e.jsx("span",{children:p.type})]})]}),e.jsx("div",{style:{flexShrink:0},children:e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",display:"inline-block",background:p.status==="enabled"?"var(--color-accent-green)":"var(--color-text-tertiary)"}})})]},p.name)})})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:v?e.jsx(pr,{ext:v}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:13},children:r("supervisor.extensions.select_detail")})})]})}function pr({ext:r}){const{t:o}=T(),t=pe[r.type]??pe.tool;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid var(--color-border-divider)",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:t.bg,color:t.fg},children:e.jsx("span",{style:{width:18,height:18,strokeWidth:1.8,display:"flex"},children:xe[r.type]??xe.tool})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"var(--color-text-primary)"},children:r.name}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:["v",r.version]})]})]}),e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:r.status==="enabled"?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:r.status==="enabled"?"var(--color-accent-green)":"var(--color-accent-gray)"},children:r.status})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:20},children:[e.jsx(ze,{title:o("supervisor.extensions.about"),children:e.jsx("div",{style:{fontSize:12,color:"var(--color-text-primary)",lineHeight:1.6},children:r.description||o("supervisor.extensions.no_description")})}),e.jsxs(ze,{title:o("supervisor.extensions.details"),children:[e.jsx(de,{label:o("supervisor.extensions.name"),value:r.name}),e.jsx(de,{label:o("supervisor.extensions.version"),value:r.version}),e.jsx(de,{label:o("supervisor.extensions.type"),value:r.type}),e.jsx(de,{label:o("supervisor.extensions.status"),value:r.status})]})]})]})}function ze({title:r,children:o}){return e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r})}),e.jsx("div",{style:{padding:"14px 16px"},children:o})]})}function de({label:r,value:o}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 0",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:120,flexShrink:0},children:r}),e.jsx("span",{style:{fontSize:12,color:"var(--color-text-primary)",fontWeight:500},children:o})]})}const xr={optimize:"var(--color-accent-blue)",alert:"var(--color-accent-red)",automate:"var(--color-accent-green)"};function ur(){const{t:r}=T(),o=m(i=>i.learningStats),t=m(i=>i.learningPatterns),n=m(i=>i.knowledgeEntries),[s,x]=g.useState(""),[a,v]=g.useState(null),p=s?n.filter(i=>i.topic.toLowerCase().includes(s.toLowerCase())||i.content.toLowerCase().includes(s.toLowerCase())||i.tags.some(d=>d.toLowerCase().includes(s.toLowerCase()))):n,y=t.reduce((i,d)=>Math.max(i,d.frequency),1);return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{style:{width:320,background:"var(--color-bg-primary)",borderRight:"1px solid var(--color-border)",flexShrink:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"var(--color-text-primary)"},children:r("supervisor.learning.title")}),o&&e.jsx("span",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:r("supervisor.learning.cmds_patterns",{cmds:o.totalCommands,patterns:o.uniquePatterns})})]}),e.jsx("input",{value:s,onChange:i=>x(i.target.value),placeholder:r("supervisor.learning.search"),style:{margin:"10px 12px 6px",padding:"8px 12px",borderRadius:8,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-card)",fontSize:12,color:"var(--color-text-primary)",outline:"none"}}),e.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:"var(--color-text-tertiary)",padding:"10px 16px 4px"},children:r("supervisor.learning.command_patterns")}),t.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:12},children:r("supervisor.learning.no_patterns")}):t.map(i=>{const d=(a==null?void 0:a.type)==="pattern"&&a.data.command===i.command;return e.jsxs("button",{type:"button",onClick:()=>v({type:"pattern",data:i}),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 16px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",background:d?"var(--color-tint-exploring)":"none",borderLeft:`3px solid ${d?"var(--color-accent-blue)":"transparent"}`,transition:"all 120ms"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-exploring)",color:"var(--color-accent-blue)",flexShrink:0},children:e.jsxs("svg",{style:{width:14,height:14,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 17 10 11 4 5"}),e.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.command}),e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)",display:"flex",gap:8},children:[e.jsxs("span",{children:["x",i.frequency]}),e.jsxs("span",{children:[Math.round(i.successRate*100),"% ",r("supervisor.learning.success_label")]})]})]})]},i.command)}),e.jsxs("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:"var(--color-text-tertiary)",padding:"10px 16px 4px"},children:[r("supervisor.learning.knowledge_base")," (",p.length,")"]}),p.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:12},children:r(s?"supervisor.learning.no_matches":"supervisor.learning.empty")}):p.map(i=>{const d=(a==null?void 0:a.type)==="knowledge"&&a.data.id===i.id;return e.jsxs("button",{type:"button",onClick:()=>v({type:"knowledge",data:i}),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 16px",cursor:"pointer",border:"none",width:"100%",textAlign:"left",background:d?"var(--color-tint-exploring)":"none",borderLeft:`3px solid ${d?"var(--color-accent-blue)":"transparent"}`,transition:"all 120ms"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-completed)",color:"var(--color-accent-green)",flexShrink:0},children:e.jsxs("svg",{style:{width:14,height:14,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),e.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:i.topic}),e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)",display:"flex",gap:8},children:[e.jsx("span",{children:i.source}),e.jsx("span",{children:r("supervisor.learning.used_count",{count:i.usageCount})})]})]})]},i.id)})]})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:a?a.type==="pattern"?e.jsx(vr,{pattern:a.data,maxFrequency:y,suggestions:(o==null?void 0:o.suggestions)??[]}):e.jsx(hr,{entry:a.data}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:13},children:r("supervisor.learning.select_detail")})})]})}function vr({pattern:r,maxFrequency:o,suggestions:t}){const{t:n}=T(),s=Math.round(r.frequency/o*100),x=r.successRate>=.9?"var(--color-accent-green)":r.successRate>=.7?"var(--color-accent-blue)":"var(--color-accent-yellow)";return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid var(--color-border-divider)",flexShrink:0},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-exploring)",color:"var(--color-accent-blue)"},children:e.jsxs("svg",{style:{width:18,height:18,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 17 10 11 4 5"}),e.jsx("line",{x1:"12",y1:"19",x2:"20",y2:"19"})]})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"var(--color-text-primary)"},children:r.command}),e.jsx("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:n("supervisor.learning.command_pattern")})]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(N,{label:n("supervisor.learning.frequency"),value:String(r.frequency)}),e.jsx(N,{label:n("supervisor.learning.success_rate"),value:`${Math.round(r.successRate*100)}%`,valueColor:x}),e.jsx(N,{label:n("supervisor.learning.avg_duration"),value:`${Math.round(r.avgDuration/1e3)}s`})]}),e.jsxs(U,{title:n("supervisor.learning.usage"),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"8px 0"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:80},children:n("supervisor.learning.relative")}),e.jsx("div",{style:{flex:1,height:6,background:"rgba(0,0,0,0.04)",borderRadius:100,overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${s}%`,borderRadius:100,background:x}})}),e.jsxs("span",{style:{fontSize:11,color:"var(--color-text-tertiary)"},children:[s,"%"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 0",borderTop:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:120},children:n("supervisor.learning.last_used")}),e.jsx("span",{style:{fontSize:12,color:"var(--color-text-primary)",fontWeight:500},children:r.lastUsed?new Date(r.lastUsed).toLocaleString():"-"})]})]}),r.contexts&&r.contexts.length>0&&e.jsx(U,{title:n("supervisor.learning.contexts"),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.contexts.map(a=>e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:"rgba(145,120,181,0.12)",color:"var(--color-accent-purple)"},children:a},a))})}),t.length>0&&e.jsx(U,{title:n("supervisor.learning.suggestions"),children:e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.map((a,v)=>e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:xr[a.type]??"var(--color-bg-tertiary)",color:"#fff",flexShrink:0},children:a.type}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:a.title}),e.jsx("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:a.description})]})]},v))})})]})]})}function hr({entry:r}){const{t:o}=T();return e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid var(--color-border-divider)",flexShrink:0},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:"var(--color-tint-completed)",color:"var(--color-accent-green)"},children:e.jsxs("svg",{style:{width:18,height:18,strokeWidth:1.8},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),e.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"var(--color-text-primary)"},children:r.topic}),e.jsxs("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:[o("supervisor.learning.knowledge_entry")," - ",r.source]})]})]})}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsx(N,{label:o("supervisor.learning.usage_count"),value:String(r.usageCount)}),e.jsx(N,{label:o("supervisor.learning.source"),value:r.source}),e.jsx(N,{label:o("supervisor.learning.last_accessed"),value:r.lastAccessed?new Date(r.lastAccessed).toLocaleDateString():"-"})]}),e.jsx(U,{title:o("supervisor.learning.content"),children:e.jsx("div",{style:{fontSize:12,color:"var(--color-text-primary)",lineHeight:1.6,whiteSpace:"pre-wrap"},children:r.content})}),r.tags.length>0&&e.jsx(U,{title:o("supervisor.learning.tags"),children:e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.tags.map(t=>e.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:"rgba(91,141,184,0.12)",color:"var(--color-accent-blue)"},children:t},t))})})]})]})}function N({label:r,value:o,valueColor:t}){return e.jsxs("div",{style:{flex:1,background:"var(--color-bg-primary)",borderRadius:10,padding:14,border:"1px solid var(--color-border-divider)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:r}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:t??"var(--color-text-primary)",marginTop:2},children:o})]})}function U({title:r,children:o}){return e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r})}),e.jsx("div",{style:{padding:"14px 16px"},children:o})]})}const gr=["auto-dispatch","cleanup","report","health-check","learning-analysis","custom"],ue={"auto-dispatch":{bg:"var(--color-tint-verifying)",fg:"var(--color-accent-orange)"},cleanup:{bg:"var(--color-tint-exploring)",fg:"var(--color-accent-blue)"},report:{bg:"var(--color-tint-planning)",fg:"var(--color-accent-purple)"},"health-check":{bg:"var(--color-tint-completed)",fg:"var(--color-accent-green)"},"learning-analysis":{bg:"var(--color-tint-executing)",fg:"var(--color-accent-yellow)"},custom:{bg:"var(--color-tint-pending)",fg:"var(--color-accent-gray)"}},ve={"auto-dispatch":e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"13 17 18 12 13 7"}),e.jsx("polyline",{points:"6 17 11 12 6 7"})]}),cleanup:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),report:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"})]}),"health-check":e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e.jsx("polyline",{points:"22 4 12 14.01 9 11.01"})]}),"learning-analysis":e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),e.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]}),custom:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09"})]})};function yr(){const{t:r}=T(),o=m(u=>u.scheduledTasks),t=m(u=>u.createSchedule),n=m(u=>u.deleteSchedule),s=m(u=>u.toggleSchedule),x=m(u=>u.runSchedule),[a,v]=g.useState(null),[p,y]=g.useState(""),[i,d]=g.useState(!1),[k,j]=g.useState(""),[f,I]=g.useState(""),[$,L]=g.useState("custom"),B=p?o.filter(u=>u.name.toLowerCase().includes(p.toLowerCase())):o,C=o.find(u=>u.id===a)??null,b=async()=>{!k.trim()||!f.trim()||(await t({name:k.trim(),cronExpression:f.trim(),taskType:$,config:{},enabled:!0}),j(""),I(""),L("custom"),d(!1))};return e.jsxs("div",{className:"flex h-full overflow-hidden",children:[e.jsxs("div",{style:{width:320,background:"var(--color-bg-primary)",borderRight:"1px solid var(--color-border)",flexShrink:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700,color:"var(--color-text-primary)"},children:r("supervisor.schedule.title")}),e.jsx("button",{type:"button",onClick:()=>d(!i),style:{fontSize:12,fontWeight:600,padding:"7px 16px",borderRadius:8,border:"none",cursor:"pointer",background:"var(--color-text-primary)",color:"#fff"},children:r(i?"supervisor.schedule.cancel":"supervisor.schedule.new")})]}),i&&e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)",display:"flex",flexDirection:"column",gap:8},children:[e.jsx("input",{value:k,onChange:u=>j(u.target.value),placeholder:r("supervisor.schedule.task_name"),style:{...be}}),e.jsx("input",{value:f,onChange:u=>I(u.target.value),placeholder:"*/5 * * * *",style:{...be,fontFamily:"'SF Mono', Consolas, monospace"}}),e.jsx("select",{value:$,onChange:u=>L(u.target.value),style:{...be},children:gr.map(u=>e.jsx("option",{value:u,children:u},u))}),e.jsx("button",{type:"button",onClick:b,disabled:!k.trim()||!f.trim(),style:{fontSize:12,fontWeight:600,padding:"7px 16px",borderRadius:8,border:"none",cursor:"pointer",background:"var(--color-accent-green)",color:"#fff",opacity:!k.trim()||!f.trim()?.4:1},children:r("supervisor.schedule.create")})]}),e.jsx("input",{value:p,onChange:u=>y(u.target.value),placeholder:r("supervisor.schedule.filter"),style:{margin:"10px 12px 6px",padding:"8px 12px",borderRadius:8,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-card)",fontSize:12,color:"var(--color-text-primary)",outline:"none"}}),e.jsx("div",{style:{flex:1,overflowY:"auto"},children:B.map(u=>{const E=u.id===a,w=ue[u.taskType]??ue.custom;return e.jsxs("button",{type:"button",onClick:()=>v(u.id),style:{display:"flex",alignItems:"center",gap:12,padding:"10px 16px",cursor:"pointer",border:"none",background:E?"var(--color-tint-exploring)":"none",borderLeft:`3px solid ${E?"var(--color-accent-blue)":"transparent"}`,width:"100%",textAlign:"left",transition:"all 120ms"},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:8,display:"flex",alignItems:"center",justifyContent:"center",background:w.bg,color:w.fg,flexShrink:0},children:e.jsx("span",{style:{width:14,height:14,strokeWidth:1.8,display:"flex"},children:ve[u.taskType]??ve.custom})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:u.name}),e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)",display:"flex",gap:8},children:[e.jsx("span",{style:{fontFamily:"'SF Mono', Consolas, monospace"},children:u.cronExpression}),u.lastRun&&e.jsx("span",{children:mr(u.lastRun)})]})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:2,flexShrink:0},children:e.jsx("span",{style:{fontSize:9,fontWeight:600,padding:"2px 8px",borderRadius:100,background:u.enabled?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:u.enabled?"var(--color-accent-green)":"var(--color-accent-gray)"},children:u.enabled?r("supervisor.schedule.active"):r("supervisor.schedule.paused")})})]},u.id)})})]}),e.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column"},children:C?e.jsx(fr,{task:C,onToggle:s,onRun:x,onDelete:n}):e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--color-text-tertiary)",fontSize:13},children:r("supervisor.schedule.select_detail")})})]})}function fr({task:r,onToggle:o,onRun:t,onDelete:n}){const{t:s}=T(),x=ue[r.taskType]??ue.custom;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 24px",borderBottom:"1px solid var(--color-border-divider)",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[e.jsx("div",{style:{width:40,height:40,borderRadius:10,display:"flex",alignItems:"center",justifyContent:"center",background:x.bg,color:x.fg},children:e.jsx("span",{style:{width:18,height:18,strokeWidth:1.8,display:"flex"},children:ve[r.taskType]??ve.custom})}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:16,fontWeight:700,color:"var(--color-text-primary)"},children:r.name}),e.jsx("div",{style:{fontSize:11,color:"var(--color-text-secondary)"},children:r.taskType})]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{type:"button",onClick:()=>t(r.id),style:{...Re},children:s("supervisor.schedule.run_now")}),e.jsx(jr,{on:r.enabled,onToggle:()=>o(r.id,!r.enabled)}),e.jsx("button",{type:"button",onClick:()=>n(r.id),style:{...Re,color:"var(--color-accent-red)"},children:s("supervisor.schedule.delete")})]})]}),e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"20px 24px",display:"flex",flexDirection:"column",gap:20},children:[e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{flex:1,background:"var(--color-bg-primary)",borderRadius:10,padding:14,border:"1px solid var(--color-border-divider)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:s("supervisor.schedule.total_runs")}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:"var(--color-text-primary)",marginTop:2},children:r.history.length})]}),e.jsxs("div",{style:{flex:1,background:"var(--color-bg-primary)",borderRadius:10,padding:14,border:"1px solid var(--color-border-divider)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:s("supervisor.schedule.success_rate")}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:"var(--color-accent-green)",marginTop:2},children:r.history.length>0?`${Math.round(r.history.filter(a=>a.status==="success").length/r.history.length*100)}%`:"-"})]}),e.jsxs("div",{style:{flex:1,background:"var(--color-bg-primary)",borderRadius:10,padding:14,border:"1px solid var(--color-border-divider)"},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)"},children:s("supervisor.schedule.next_run")}),e.jsx("div",{style:{fontSize:14,fontWeight:700,color:"var(--color-text-primary)",marginTop:6},children:r.nextRun?new Date(r.nextRun).toLocaleString():"-"})]})]}),e.jsxs(We,{title:s("supervisor.schedule.configuration"),children:[e.jsx(ce,{label:s("supervisor.schedule.schedule_label"),value:r.cronExpression,mono:!0}),e.jsx(ce,{label:s("supervisor.schedule.type"),value:r.taskType}),e.jsx(ce,{label:s("supervisor.schedule.last_run"),value:r.lastRun?new Date(r.lastRun).toLocaleString():s("supervisor.schedule.never")}),Object.entries(r.config).map(([a,v])=>e.jsx(ce,{label:a,value:String(v)},a))]}),e.jsx(We,{title:s("supervisor.schedule.run_history"),children:r.history.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",textAlign:"center",padding:"8px 0"},children:s("supervisor.schedule.no_runs")}):e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:r.history.slice(-10).reverse().map((a,v)=>{const p=a.status==="success"?"var(--color-accent-green)":a.status==="failed"?"var(--color-accent-red)":"var(--color-accent-gray)";return e.jsxs("div",{style:{display:"flex",gap:12,padding:"8px 0",position:"relative"},children:[v<Math.min(r.history.length,10)-1&&e.jsx("div",{style:{position:"absolute",left:11,top:24,bottom:-8,width:1,background:"var(--color-border-divider)"}}),e.jsx("div",{style:{width:22,height:22,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,border:"2px solid var(--color-bg-card)"},children:e.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:p}})}),e.jsxs("div",{style:{flex:1},children:[e.jsx("div",{style:{fontSize:10,color:"var(--color-text-placeholder)",fontFamily:"'SF Mono', Consolas, monospace"},children:new Date(a.timestamp).toLocaleString()}),e.jsx("div",{style:{fontSize:12,color:"var(--color-text-primary)"},children:a.status}),a.duration!=null&&e.jsxs("div",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:[Math.round(a.duration/1e3),"s"]})]})]},v)})})})]})]})}function We({title:r,children:o}){return e.jsxs("div",{style:{borderRadius:12,background:"var(--color-bg-card)",border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:12,fontWeight:600,color:"var(--color-text-primary)"},children:r})}),e.jsx("div",{style:{padding:"14px 16px"},children:o})]})}function ce({label:r,value:o,mono:t}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 0",borderBottom:"1px solid var(--color-border-divider)"},children:[e.jsx("span",{style:{fontSize:11,color:"var(--color-text-tertiary)",width:120,flexShrink:0},children:r}),e.jsx("span",{style:{fontSize:12,color:"var(--color-text-primary)",fontWeight:500,fontFamily:t?"'SF Mono', Consolas, monospace":void 0},children:o})]})}function jr({on:r,onToggle:o}){return e.jsx("button",{type:"button",onClick:o,style:{width:36,height:20,borderRadius:100,background:r?"var(--color-accent-green)":"var(--color-border)",border:"none",cursor:"pointer",position:"relative",transition:"background 200ms"},children:e.jsx("span",{style:{position:"absolute",top:2,left:r?18:2,width:16,height:16,borderRadius:"50%",background:"#fff",transition:"left 200ms",boxShadow:"0 1px 3px rgba(0,0,0,0.15)"}})})}function mr(r){const o=Date.now()-new Date(r).getTime(),t=Math.floor(o/6e4);if(t<1)return"just now";if(t<60)return`${t}m ago`;const n=Math.floor(t/60);return n<24?`${n}h ago`:new Date(r).toLocaleDateString()}const be={padding:"8px 12px",borderRadius:8,border:"1px solid var(--color-border-divider)",background:"var(--color-bg-card)",fontSize:12,color:"var(--color-text-primary)",outline:"none"},Re={fontSize:11,fontWeight:600,padding:"5px 12px",borderRadius:8,border:"1px solid var(--color-border)",background:"none",color:"var(--color-text-secondary)",cursor:"pointer"},Te=[{id:"commander",labelKey:"supervisor.tabs.commander",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),e.jsx("path",{d:"M2 17l10 5 10-5"}),e.jsx("path",{d:"M2 12l10 5 10-5"})]})},{id:"executions",labelKey:"supervisor.tabs.executions",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})},{id:"schedule",labelKey:"supervisor.tabs.schedules",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]})},{id:"learning",labelKey:"supervisor.tabs.learning",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"}),e.jsx("path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"})]})},{id:"extensions",labelKey:"supervisor.tabs.extensions",icon:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M14.7 6.3a1 1 0 000 1.4l1.6 1.6a1 1 0 001.4 0l3.77-3.77a6 6 0 01-7.94 7.94l-6.91 6.91a2.12 2.12 0 01-3-3l6.91-6.91a6 6 0 017.94-7.94l-3.76 3.76z"})})},{id:"prompts",labelKey:"supervisor.tabs.prompts",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("polyline",{points:"4 7 4 4 20 4 20 7"}),e.jsx("line",{x1:"9",y1:"20",x2:"15",y2:"20"}),e.jsx("line",{x1:"12",y1:"4",x2:"12",y2:"20"})]})},{id:"coordinator",labelKey:"supervisor.tabs.coordinator",icon:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"})]})}];function Sr(){const{t:r}=T(),o=m(c=>c.activeTab),t=m(c=>c.setActiveTab),n=m(c=>c.fetchLearningStats),s=m(c=>c.fetchSchedules),x=m(c=>c.fetchExtensions),a=m(c=>c.fetchPromptModes),v=m(c=>c.scheduledTasks),p=m(c=>c.extensions),y=R(c=>c.slots),i=R(c=>c.queue),d=R(c=>c.supervisorStatus),k=R(c=>c.toggleSupervisor),j=R(c=>c.commanderState),f=_(c=>c.session),I=_(c=>c.start),$=_(c=>c.stop),[L,B]=g.useState(!1);g.useEffect(()=>{n(),s(),x(),a()},[n,s,x,a]);const C=g.useMemo(()=>Object.values(y),[y]),b=(d==null?void 0:d.enabled)??!1,u=(d==null?void 0:d.stats.totalDispatched)??0,E=(d==null?void 0:d.stats.totalCompleted)??0,w=u>0?`${Math.round(E/u*100)}%`:"-",h=f!=null&&f.status!=="idle"&&f.status!=="completed"&&f.status!=="failed",z=(f==null?void 0:f.steps)??[],F=z.filter(c=>c.status==="completed"||c.status==="skipped").length,he=g.useCallback(async()=>{await k(!b)},[k,b]),O=g.useCallback(()=>{h?$():I("continue",void 0,!0)},[h,$,I]),H=g.useCallback(c=>{t(c),B(!1)},[t]),G={schedule:v.length,extensions:p.length};return e.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",background:"var(--color-bg-primary)"},children:[e.jsx("nav",{style:{flexShrink:0,display:"flex",alignItems:"center",padding:"0 24px",background:"var(--color-bg-secondary)",borderBottom:"1px solid var(--color-border)"},children:Te.map(c=>{const Y=o===c.id,A=G[c.id]??0;return e.jsxs("button",{type:"button",onClick:()=>t(c.id),style:{display:"flex",alignItems:"center",gap:6,padding:"10px 16px",fontSize:12,fontWeight:Y?600:500,color:Y?"var(--color-text-primary)":"var(--color-text-tertiary)",background:"none",border:"none",borderBottom:`2px solid ${Y?"var(--color-text-primary)":"transparent"}`,cursor:"pointer",transition:"color 120ms, border-color 120ms"},children:[e.jsx("span",{style:{width:14,height:14,display:"flex"},children:c.icon}),r(c.labelKey),A>0&&e.jsx("span",{style:{fontSize:9,fontWeight:700,padding:"1px 6px",borderRadius:100,background:"var(--color-bg-card)",color:"var(--color-text-tertiary)"},children:A})]},c.id)})}),e.jsxs("main",{style:{flex:1,minHeight:0,overflow:"hidden"},children:[o==="commander"&&e.jsx(Ee,{}),o==="executions"&&e.jsx(Ae,{}),o==="coordinator"&&e.jsx(Ke,{}),o==="prompts"&&e.jsx(dr,{}),o==="extensions"&&e.jsx(cr,{}),o==="learning"&&e.jsx(ur,{}),o==="schedule"&&e.jsx(yr,{})]}),L&&e.jsx("div",{onClick:()=>B(!1),style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.25)",zIndex:90,transition:"opacity 200ms"}}),e.jsxs("div",{style:{position:"fixed",left:0,right:0,bottom:36,maxHeight:L?"60vh":0,overflow:"hidden",background:"var(--color-bg-card)",borderTop:L?"1px solid var(--color-border)":"none",borderRadius:"12px 12px 0 0",zIndex:91,transition:"max-height 300ms cubic-bezier(0.4,0,0.2,1)",boxShadow:L?"0 -4px 24px rgba(0,0,0,0.08)":"none"},children:[e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"8px 0 4px",cursor:"pointer"},onClick:()=>B(!1),children:e.jsx("div",{style:{width:32,height:4,borderRadius:2,background:"var(--color-border)"}})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"180px 1fr 1fr",gap:16,padding:"8px 24px 24px",overflowY:"auto",maxHeight:"calc(60vh - 40px)"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".04em",color:"var(--color-text-tertiary)",padding:"4px 8px",marginBottom:4},children:"Navigate"}),Te.map(c=>e.jsxs("button",{type:"button",onClick:()=>H(c.id),style:{display:"flex",alignItems:"center",gap:8,padding:"8px 10px",fontSize:12,fontWeight:o===c.id?600:400,color:o===c.id?"var(--color-text-primary)":"var(--color-text-secondary)",background:o===c.id?"var(--color-bg-active)":"none",border:"none",borderRadius:6,cursor:"pointer",textAlign:"left",transition:"background 120ms"},children:[e.jsx("span",{style:{width:14,height:14,display:"flex"},children:c.icon}),r(c.labelKey)]},c.id))]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{borderRadius:10,border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"10px 14px",borderBottom:"1px solid var(--color-border-divider)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--color-accent-blue)"},children:"Issue Executions"}),e.jsxs("span",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:[C.length," running"]})]}),e.jsx("div",{style:{padding:"8px 14px"},children:C.length===0?e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",padding:"4px 0"},children:"No active slots"}):C.slice(0,5).map(c=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"5px 0",fontSize:11},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--color-accent-blue)",flexShrink:0}}),e.jsx("span",{style:{fontWeight:500,color:"var(--color-text-primary)"},children:c.issueId}),e.jsx("span",{style:{color:"var(--color-text-tertiary)",marginLeft:"auto"},children:c.executor})]},c.processId))})]}),e.jsxs("div",{style:{borderRadius:10,border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"10px 14px",borderBottom:"1px solid var(--color-border-divider)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--color-accent-purple)"},children:"Workflow Sessions"}),e.jsx("span",{style:{fontSize:10,color:"var(--color-text-tertiary)"},children:f?f.status:"idle"})]}),e.jsx("div",{style:{padding:"8px 14px"},children:f?e.jsxs("div",{style:{fontSize:11},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0"},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--color-text-primary)"},children:f.chainName??"Session"}),e.jsxs("span",{style:{color:"var(--color-text-tertiary)"},children:["Step ",f.currentStep+1,"/",z.length]})]}),f.intent&&e.jsx("div",{style:{color:"var(--color-text-secondary)",padding:"2px 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:f.intent})]}):e.jsx("div",{style:{fontSize:11,color:"var(--color-text-tertiary)",padding:"4px 0"},children:"No active session"})})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{borderRadius:10,border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"10px 14px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--color-text-primary)"},children:"Commander"})}),e.jsxs("div",{style:{padding:"8px 14px",fontSize:11},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0"},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--color-text-secondary)"},children:"Status:"}),e.jsx("span",{style:{fontWeight:600,color:(j==null?void 0:j.status)==="dispatching"?"var(--color-accent-green)":(j==null?void 0:j.status)==="thinking"?"var(--color-accent-blue)":"var(--color-text-tertiary)"},children:(j==null?void 0:j.status)??"idle"})]}),(d==null?void 0:d.isCommanderActive)!==void 0&&e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"4px 0"},children:[e.jsx("span",{style:{fontWeight:500,color:"var(--color-text-secondary)"},children:"Active:"}),e.jsx("span",{style:{color:d.isCommanderActive?"var(--color-accent-green)":"var(--color-text-tertiary)"},children:d.isCommanderActive?"Yes":"No"})]})]})]}),e.jsxs("div",{style:{borderRadius:10,border:"1px solid var(--color-border-divider)",overflow:"hidden"},children:[e.jsx("div",{style:{padding:"10px 14px",borderBottom:"1px solid var(--color-border-divider)"},children:e.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--color-text-primary)"},children:"Suggestions"})}),e.jsx("div",{style:{padding:"8px 14px",fontSize:11,color:"var(--color-text-tertiary)"},children:"No suggestions"})]})]})]})]}),e.jsxs("footer",{style:{flexShrink:0,display:"flex",alignItems:"center",height:36,padding:"0 16px",background:"var(--color-bg-secondary)",borderTop:"1px solid var(--color-border)",gap:12,fontSize:11,zIndex:92},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{fontWeight:600,color:"var(--color-text-primary)"},children:"Supervisor"}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10,fontWeight:600,padding:"2px 8px",borderRadius:100,background:b?"rgba(90,158,120,0.12)":"rgba(160,157,151,0.12)",color:b?"var(--color-accent-green)":"var(--color-accent-gray)"},children:[b&&e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"var(--color-accent-green)",animation:"pulse 2s ease-in-out infinite"}}),b?"Active":"Inactive"]})]}),e.jsx("div",{style:{width:1,height:16,background:"var(--color-border-divider)"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,color:"var(--color-accent-blue)"},children:"Issues"}),e.jsxs("span",{style:{color:"var(--color-text-secondary)"},children:[C.length," running"]}),e.jsxs("span",{style:{color:"var(--color-text-tertiary)"},children:[i.length," queued"]}),e.jsxs("span",{style:{color:"var(--color-text-secondary)"},children:[w," success"]})]}),e.jsx("div",{style:{width:1,height:16,background:"var(--color-border-divider)"}}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("span",{style:{fontSize:10,fontWeight:600,color:"var(--color-accent-purple)"},children:"Workflow"}),e.jsx("span",{style:{color:"var(--color-text-secondary)"},children:h?"1 running":"0 running"}),e.jsx("span",{style:{color:"var(--color-text-tertiary)"},children:z.length>0?`${F}/${z.length} steps`:"-"})]}),e.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:8},children:[e.jsxs("button",{type:"button",onClick:()=>B(c=>!c),style:{display:"flex",alignItems:"center",gap:4,padding:"3px 10px",fontSize:10,fontWeight:600,borderRadius:6,border:"1px solid var(--color-border)",background:L?"var(--color-bg-active)":"none",color:"var(--color-text-secondary)",cursor:"pointer",transition:"background 120ms"},children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{width:12,height:12},children:e.jsx("polyline",{points:L?"6 15 12 9 18 15":"6 9 12 15 18 9"})}),"Overview"]}),e.jsx("button",{type:"button",onClick:he,style:{padding:"3px 10px",fontSize:10,fontWeight:600,borderRadius:6,border:"1px solid",borderColor:b?"var(--color-accent-blue)":"var(--color-border)",background:b?"rgba(91,141,184,0.12)":"none",color:b?"var(--color-accent-blue)":"var(--color-text-tertiary)",cursor:"pointer",transition:"all 120ms"},children:"Issues"}),e.jsx("button",{type:"button",onClick:O,style:{padding:"3px 10px",fontSize:10,fontWeight:600,borderRadius:6,border:"1px solid",borderColor:h?"var(--color-accent-purple)":"var(--color-border)",background:h?"rgba(145,120,181,0.12)":"none",color:h?"var(--color-accent-purple)":"var(--color-text-tertiary)",cursor:"pointer",transition:"all 120ms"},children:"Workflow"})]})]}),e.jsx("style",{children:`
2
- @keyframes pulse {
3
- 0%, 100% { opacity: 1; }
4
- 50% { opacity: 0.4; }
5
- }
6
- `})]})}export{Sr as SupervisorPage};
@@ -1,6 +0,0 @@
1
- import{d as $,o as M,U as B,j as e,p as V,N as W,M as Q,r as h,X as _,y as X,F,V as K,n as H}from"./index-DWG-WrzT.js";import{L as q}from"./list-CgIP_2A-.js";import{S as G}from"./search-SieXnOgr.js";import{C as J}from"./chevron-right-Csu22t58.js";import{T as Y}from"./trash-2-C8f4vFFM.js";import{A as Z}from"./arrow-left-Bqtb2hle.js";import{A as ee}from"./index-Do71weNR.js";import{m as te}from"./proxy-BKxDAKTj.js";/**
2
- * @license lucide-react v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const se=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],re=$("users",se),m=M((t,l)=>({sessions:[],activeSession:null,activeSessionId:null,activeView:"cards",loading:!1,error:null,statusFilter:"all",skillFilter:null,searchQuery:"",setActiveView:s=>t({activeView:s}),setStatusFilter:s=>t({statusFilter:s}),setSkillFilter:s=>t({skillFilter:s}),setSearchQuery:s=>t({searchQuery:s}),clearActiveSession:()=>t({activeSession:null,activeSessionId:null}),fetchSessions:async()=>{t({loading:!0,error:null});try{const s=await fetch(B.SESSIONS);if(!s.ok)throw new Error(`Failed: ${s.status}`);const n=await s.json();t({sessions:n,loading:!1})}catch(s){t({loading:!1,error:String(s)})}},deleteSession:async s=>{const n=l().sessions;t(i=>({sessions:i.sessions.filter(o=>o.sessionId!==s)}));try{(await fetch(B.SESSIONS+"/"+s,{method:"DELETE"})).ok||t({sessions:n})}catch{t({sessions:n})}},fetchSessionDetail:async s=>{t({loading:!0,error:null,activeSessionId:s});try{const n=await fetch(B.SESSIONS+"/"+s);if(!n.ok)throw new Error(`Failed: ${n.status}`);const i=await n.json();t({activeSession:i,loading:!1})}catch(n){t({loading:!1,error:String(n)})}},filteredSessions:()=>{const{sessions:s,statusFilter:n,skillFilter:i,searchQuery:o}=l();let d=s;if(n!=="all"&&(d=d.filter(u=>u.status===n)),i&&(d=d.filter(u=>u.skill===i)),o){const u=o.toLowerCase();d=d.filter(f=>f.title.toLowerCase().includes(u)||f.sessionId.toLowerCase().includes(u)||f.roles.some(c=>c.toLowerCase().includes(u)))}return d}})),C={active:"#B89540",completed:"#5A9E78",failed:"#C46555",archived:"#A09D97"},S={done:"#5A9E78",in_progress:"#B89540",pending:"#A09D97",skipped:"#D1CEC8"},ae={done:"#5A9E78",active:"#B89540",pending:"#A09D97",injected:"#8B6BBF"},le={Coordinate:"#4A90D9",Lifecycle:"#8B6BBF",QA:"#3D9B6F",Review:"#D4832E",Testing:"#3BA0B5","Frontend Debug":"#D05454","Perf Opt":"#C99B2D","Tech Debt":"#A09D97","Plan & Execute":"#4A90D9",Brainstorm:"#8B6BBF","Roadmap Dev":"#3D9B6F",Issue:"#D05454","Iter Dev":"#D4832E","Ultra Analyze":"#C99B2D","UX Improve":"#3BA0B5","UI Design":"#8B6BBF","Arch Opt":"#4A90D9",Team:"#A09D97"},ie={Coordinate:"TC",Lifecycle:"LV",QA:"QA",Review:"RV",Testing:"TST","Frontend Debug":"FD","Perf Opt":"PO","Tech Debt":"TD","Plan & Execute":"PX",Brainstorm:"BS","Roadmap Dev":"RD",Issue:"IS","Iter Dev":"ID","Ultra Analyze":"UA","UX Improve":"UX","UI Design":"UI","Arch Opt":"AO",Team:"TM"},L=["#4A90D9","#8B6BBF","#C99B2D","#D05454","#3D9B6F","#D4832E","#3BA0B5"];function ne({status:t}){const l=C[t];return e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold",style:{background:`${l}18`,color:l},children:[t==="active"&&e.jsxs("span",{className:"relative flex w-1.5 h-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:l}}),e.jsx("span",{className:"relative inline-flex rounded-full w-1.5 h-1.5",style:{backgroundColor:l}})]}),t.charAt(0).toUpperCase()+t.slice(1)]})}function oe({session:t,onClick:l,onDelete:s}){const n=le[t.skill]??"#A09D97",i=ie[t.skill]??"TM";return e.jsxs("button",{type:"button",onClick:l,className:"group w-full text-left bg-bg-card border border-border rounded-xl p-3.5 hover:border-accent-blue hover:shadow-[0_2px_12px_rgba(0,0,0,0.06)] transition-all duration-150 cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-2",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-[11px] font-bold text-white shrink-0",style:{backgroundColor:n},children:i}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-semibold text-text-primary truncate",children:t.title}),e.jsx("div",{className:"text-[10px] font-mono text-text-placeholder truncate",children:t.sessionId})]}),e.jsx(ne,{status:t.status}),s&&e.jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),s(t.sessionId)},className:"w-6 h-6 rounded-md flex items-center justify-center text-text-placeholder opacity-0 group-hover:opacity-100 hover:!text-status-failed hover:bg-[rgba(196,101,85,0.1)] transition-all shrink-0",title:"Delete session",children:e.jsx(Y,{size:13,strokeWidth:2})})]}),t.description&&e.jsx("p",{className:"text-[11px] text-text-secondary leading-relaxed mb-2.5 line-clamp-2",children:t.description}),t.pipelineStages.length>0&&e.jsx("div",{className:"flex gap-1 mb-2.5",children:t.pipelineStages.map(o=>e.jsx("div",{className:"w-2 h-2 rounded-full",title:`${o.name}: ${o.status}`,style:{backgroundColor:S[o.status]}},o.id))}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-text-tertiary mb-2.5",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(V,{size:11,strokeWidth:2}),t.taskProgress.completed,"/",t.taskProgress.total," tasks"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(W,{size:11,strokeWidth:2}),t.duration||"--"]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(Q,{size:11,strokeWidth:2}),t.messageCount," msgs"]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 pt-2 border-t border-border-divider",children:[e.jsxs("div",{className:"flex gap-0.5",children:[t.roles.slice(0,4).map((o,d)=>e.jsx("div",{className:"w-[18px] h-[18px] rounded-[5px] flex items-center justify-center text-[8px] font-bold text-white",title:o,style:{backgroundColor:L[d%L.length]},children:o.charAt(0).toUpperCase()},o)),t.roles.length>4&&e.jsxs("div",{className:"w-[18px] h-[18px] rounded-[5px] flex items-center justify-center text-[8px] font-semibold text-text-tertiary bg-bg-hover",children:["+",t.roles.length-4]})]}),e.jsx("div",{className:"flex-1"}),e.jsx(J,{size:14,className:"text-text-placeholder group-hover:text-accent-blue transition-colors"})]})]})}const ce=["all","active","completed","failed","archived"];function de({viewMode:t}){const l=m(a=>a.sessions),s=m(a=>a.filteredSessions),n=m(a=>a.statusFilter),i=m(a=>a.skillFilter),o=m(a=>a.searchQuery),d=m(a=>a.setStatusFilter),u=m(a=>a.setSkillFilter),f=m(a=>a.setSearchQuery),c=m(a=>a.fetchSessionDetail),b=m(a=>a.deleteSession),v=s(),g=h.useMemo(()=>{const a=l.filter(j=>j.status==="active").length,y=l.filter(j=>j.status==="completed").length,w=l.reduce((j,T)=>j+T.roles.length,0);return{total:l.length,active:a,completed:y,totalRoles:w}},[l]),N=h.useMemo(()=>{const a=new Set(l.map(y=>y.skill));return Array.from(a).sort()},[l]);return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-3 px-5 py-2.5 border-b border-border shrink-0",children:[e.jsx("span",{className:"text-[14px] font-semibold text-text-primary",children:"Sessions"}),e.jsx("span",{className:"text-[11px] font-medium text-text-tertiary bg-bg-hover px-1.5 py-0.5 rounded-full",children:v.length}),e.jsxs("div",{className:"relative ml-2",children:[e.jsx(G,{size:13,className:"absolute left-2 top-1/2 -translate-y-1/2 text-text-placeholder"}),e.jsx("input",{type:"text",placeholder:"Search sessions...",value:o,onChange:a=>f(a.target.value),className:"pl-7 pr-2.5 py-1 rounded-lg border border-border bg-bg-secondary text-[12px] text-text-primary placeholder:text-text-placeholder w-48 focus:outline-none focus:border-accent-blue transition-colors"})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex gap-1",children:ce.map(a=>e.jsx("button",{type:"button",onClick:()=>d(a),className:["px-2 py-0.5 rounded-full text-[10px] font-semibold transition-all",n===a?"bg-text-primary text-white":"text-text-tertiary hover:text-text-primary hover:bg-bg-hover"].join(" "),children:a==="all"?"All":a.charAt(0).toUpperCase()+a.slice(1)},a))}),N.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-border-divider"}),e.jsx("div",{className:"flex gap-1",children:N.map(a=>e.jsx("button",{type:"button",onClick:()=>u(i===a?null:a),className:["px-2 py-0.5 rounded-full text-[10px] font-semibold transition-all",i===a?"bg-accent-blue text-white":"text-text-tertiary hover:text-text-primary hover:bg-bg-hover"].join(" "),children:a},a))})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-5",children:[e.jsxs("div",{className:"grid grid-cols-4 gap-3 mb-4",children:[e.jsx(D,{label:"Total Sessions",value:g.total,sub:`across ${N.length} skill types`}),e.jsx(D,{label:"Active",value:g.active,color:C.active,sub:"running now"}),e.jsx(D,{label:"Completed",value:g.completed,color:C.completed,sub:"finished"}),e.jsx(D,{label:"Total Roles",value:g.totalRoles,sub:`avg ${g.total?(g.totalRoles/g.total).toFixed(1):0} per session`})]}),v.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-text-tertiary",children:[e.jsx("span",{className:"text-[14px] font-medium mb-1",children:"No sessions found"}),e.jsx("span",{className:"text-[12px]",children:l.length===0?"Run a team skill to see sessions here":"Try adjusting your filters"})]}),t==="cards"&&v.length>0&&e.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-3",children:v.map(a=>e.jsx(oe,{session:a,onClick:()=>void c(a.sessionId),onDelete:y=>void b(y)},a.sessionId))}),t==="table"&&v.length>0&&e.jsx(xe,{sessions:v,onSelect:a=>void c(a)})]})]})}function D({label:t,value:l,color:s,sub:n}){return e.jsxs("div",{className:"bg-bg-card rounded-xl border border-border px-4 py-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-widest text-text-tertiary mb-0.5",children:t}),e.jsx("div",{className:"text-[22px] font-bold",style:{color:s??"var(--color-text-primary)"},children:l}),e.jsx("div",{className:"text-[11px] text-text-tertiary mt-0.5",children:n})]})}const O=["#4A90D9","#8B6BBF","#C99B2D","#D05454","#3D9B6F","#D4832E","#3BA0B5"];function xe({sessions:t,onSelect:l}){return e.jsx("div",{className:"bg-bg-card rounded-xl border border-border overflow-hidden",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary bg-bg-secondary border-b border-border sticky top-0 z-[5]",children:"Session"}),e.jsx("th",{className:"text-left px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary bg-bg-secondary border-b border-border sticky top-0 z-[5]",children:"Status"}),e.jsx("th",{className:"text-left px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary bg-bg-secondary border-b border-border sticky top-0 z-[5]",children:"Progress"}),e.jsx("th",{className:"text-left px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary bg-bg-secondary border-b border-border sticky top-0 z-[5]",children:"Roles"}),e.jsx("th",{className:"text-left px-3.5 py-2.5 text-[10px] font-semibold uppercase tracking-widest text-text-tertiary bg-bg-secondary border-b border-border sticky top-0 z-[5]",children:"Duration"}),e.jsx("th",{className:"w-8 bg-bg-secondary border-b border-border sticky top-0 z-[5]"})]})}),e.jsx("tbody",{children:t.map(s=>{const n=s.taskProgress.total?Math.round(s.taskProgress.completed/s.taskProgress.total*100):0,i=C[s.status];return e.jsxs("tr",{onClick:()=>l(s.sessionId),className:"cursor-pointer hover:bg-bg-hover transition-colors group",children:[e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider",children:e.jsx("div",{className:"flex items-center gap-2.5 min-w-[240px]",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[13px] font-semibold text-text-primary truncate",children:s.title}),e.jsx("div",{className:"text-[10px] font-mono text-text-placeholder",children:s.sessionId})]})})}),e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider",children:e.jsx("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold",style:{background:`${i}18`,color:i},children:s.status})}),e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider",children:e.jsxs("div",{className:"flex items-center gap-2 min-w-[120px]",children:[e.jsx("div",{className:"flex-1 h-[5px] bg-bg-hover rounded-full overflow-hidden min-w-[60px]",children:e.jsx("div",{className:"h-full rounded-full",style:{width:`${n}%`,backgroundColor:i}})}),e.jsxs("span",{className:"text-[11px] font-semibold text-text-tertiary whitespace-nowrap min-w-[36px]",children:[s.taskProgress.completed,"/",s.taskProgress.total]})]})}),e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider",children:e.jsx("div",{className:"flex gap-0.5",children:s.roles.slice(0,5).map((o,d)=>e.jsx("div",{className:"w-[18px] h-[18px] rounded-[5px] flex items-center justify-center text-[8px] font-bold text-white",title:o,style:{backgroundColor:O[d%O.length]},children:o.charAt(0).toUpperCase()},o))})}),e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider",children:e.jsx("span",{className:"font-mono text-[11px] text-text-tertiary whitespace-nowrap",children:s.duration||"--"})}),e.jsx("td",{className:"px-3.5 py-2.5 border-b border-border-divider text-center",children:e.jsx("span",{className:"text-[14px] text-text-placeholder group-hover:text-accent-blue transition-colors",children:"→"})})]},s.sessionId)})})]})})}function pe({session:t,open:l,onClose:s}){const n=h.useCallback(i=>{i.target===i.currentTarget&&s()},[s]);return e.jsx(e.Fragment,{children:e.jsx("div",{className:["absolute inset-0 z-40 bg-black/[.18] backdrop-blur-[2px] transition-opacity duration-200",l?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"].join(" "),onClick:n,children:e.jsxs("div",{className:["absolute top-0 left-0 right-0 z-50 bg-bg-card border-b border-border","rounded-b-[14px] shadow-[0_12px_40px_rgba(0,0,0,0.12)]","transition-transform duration-[280ms] ease-[cubic-bezier(0.34,1.56,0.64,1)]","max-h-[68vh] overflow-hidden flex flex-col",l?"translate-y-0":"-translate-y-full"].join(" "),children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b border-border-divider shrink-0",children:[e.jsx("h3",{className:"text-[14px] font-bold text-text-primary",children:t.title}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary",children:t.sessionId}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{type:"button",onClick:s,className:"w-[26px] h-[26px] rounded-[7px] flex items-center justify-center text-text-tertiary hover:bg-bg-hover hover:text-text-primary transition-all",children:e.jsx(_,{size:14})})]}),e.jsxs("div",{className:"grid grid-cols-3 flex-1 overflow-auto",children:[e.jsxs("div",{className:"p-3.5",children:[e.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-placeholder mb-2.5 flex items-center gap-1.5",children:["Pipeline",e.jsx("span",{className:"bg-bg-hover px-1.5 rounded-full text-[9px] text-text-tertiary",children:t.pipelineStages.length})]}),e.jsxs("div",{className:"flex gap-2 mb-3",children:[e.jsx(E,{label:"Done",value:t.pipelineStages.filter(i=>i.status==="done").length}),e.jsx(E,{label:"Active",value:t.pipelineStages.filter(i=>i.status==="in_progress").length}),e.jsx(E,{label:"Pending",value:t.pipelineStages.filter(i=>i.status==="pending").length})]}),t.pipeline.waves.length>0?t.pipeline.waves.map(i=>e.jsxs("div",{className:"mb-2",children:[e.jsxs("div",{className:"text-[9px] font-semibold text-text-placeholder mb-1",children:["Wave ",i.number]}),e.jsx("div",{className:"flex gap-1.5 flex-wrap",children:i.nodes.map(o=>e.jsx(R,{node:o},o.id))})]},i.number)):t.pipelineStages.map(i=>e.jsx(R,{node:i},i.id))]}),e.jsxs("div",{className:"p-3.5 border-l border-border-divider",children:[e.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-placeholder mb-2.5 flex items-center gap-1.5",children:["Roles",e.jsx("span",{className:"bg-bg-hover px-1.5 rounded-full text-[9px] text-text-tertiary",children:t.roleDetails.length})]}),e.jsxs("div",{className:"flex flex-col",children:[t.roleDetails.map(i=>e.jsx(me,{role:i},i.name)),t.roleDetails.length===0&&e.jsx("span",{className:"text-[11px] text-text-tertiary italic",children:"No roles data"})]})]}),e.jsxs("div",{className:"p-3.5 border-l border-border-divider",children:[e.jsxs("div",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-placeholder mb-2.5 flex items-center gap-1.5",children:["Messages",e.jsx("span",{className:"bg-bg-hover px-1.5 rounded-full text-[9px] text-text-tertiary",children:t.messages.length})]}),e.jsxs("div",{className:"flex flex-col max-h-[50vh] overflow-y-auto",children:[t.messages.slice(-20).map(i=>e.jsx(he,{message:i},i.id)),t.messages.length===0&&e.jsx("span",{className:"text-[11px] text-text-tertiary italic",children:"No messages"})]})]})]}),e.jsx("div",{className:"flex justify-center py-1.5 border-t border-border-divider cursor-pointer hover:bg-bg-hover",children:e.jsx("div",{className:"w-10 h-1 rounded-full bg-text-placeholder"})})]})})})}function E({label:t,value:l}){return e.jsxs("div",{className:"flex-1 text-center p-1.5 bg-bg-hover rounded-lg",children:[e.jsx("div",{className:"text-[16px] font-bold text-text-primary",children:l}),e.jsx("div",{className:"text-[9px] font-semibold uppercase text-text-tertiary",children:t})]})}function R({node:t}){const l=S[t.status];return e.jsxs("div",{className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-lg border border-border text-[10px] mb-1 hover:border-accent-blue transition-colors",children:[e.jsx("span",{className:"w-[7px] h-[7px] rounded-full",style:{backgroundColor:l}}),e.jsx("span",{className:"font-semibold text-text-primary",children:t.name})]})}function me({role:t}){const l=ae[t.status];return e.jsxs("div",{className:"flex items-center gap-2 py-1.5 border-b border-border-divider last:border-0",children:[e.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center text-[10px] font-bold text-white shrink-0",style:{backgroundColor:l},children:t.prefix||t.name.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-[12px] font-semibold text-text-primary truncate",children:t.name}),e.jsxs("div",{className:"text-[10px] text-text-tertiary",children:[t.taskCount," task",t.taskCount!==1?"s":""]})]}),e.jsxs("div",{className:"flex gap-1 shrink-0",children:[e.jsx("span",{className:"text-[8px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:`${l}18`,color:l},children:t.status}),t.injected&&e.jsx("span",{className:"text-[8px] font-semibold px-1.5 py-0.5 rounded-full bg-[#8B6BBF18] text-[#8B6BBF]",children:"injected"})]})]})}function he({message:t}){const s={message:"#4A90D9",state_update:"#3D9B6F",task_complete:"#5A9E78",error:"#D05454",broadcast:"#8B6BBF",shutdown:"#A09D97"}[t.type]??"#A09D97";return e.jsxs("div",{className:"flex gap-2 py-1.5 border-b border-border-divider last:border-0 text-[11px] items-start",children:[e.jsx("div",{className:"w-[22px] h-[22px] rounded-md flex items-center justify-center text-[10px] shrink-0 mt-0.5",style:{background:`${s}18`,color:s},children:t.from.charAt(0).toUpperCase()}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-text-primary",children:t.from}),e.jsx("span",{className:"text-[8px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:`${s}18`,color:s},children:t.type}),e.jsx("span",{className:"text-[9px] font-mono text-text-placeholder ml-auto",children:t.ts.substring(11,19)})]}),e.jsx("div",{className:"text-[11px] text-text-secondary truncate mt-0.5",children:t.summary})]})]})}function ue(){const t=m(r=>r.activeSession),l=m(r=>r.activeSessionId),s=m(r=>r.loading),n=m(r=>r.clearActiveSession),[i,o]=h.useState(!1),[d,u]=h.useState(null),[f,c]=h.useState(""),[b,v]=h.useState(!1),[g,N]=h.useState([]),[a,y]=h.useState(new Set);h.useEffect(()=>{function r(x){x.key==="Escape"&&(i?o(!1):n())}return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[n,i]);const w=h.useCallback(async r=>{if(l){u(r),v(!0),N(x=>x.some(p=>p.id===r.id)?x:[...x,r]);try{const x=`${B.SESSIONS}/${l}/files/${encodeURIComponent(r.path)}`,p=await fetch(x);if(!p.ok)throw new Error(`Failed: ${p.status}`);if((p.headers.get("content-type")??"").includes("json")){const U=await p.json();c(JSON.stringify(U,null,2))}else c(await p.text())}catch{c("// Failed to load file content")}v(!1)}},[l]),j=h.useCallback(r=>{N(x=>{const p=x.filter(I=>I.id!==r);return(d==null?void 0:d.id)===r&&(p.length>0?w(p[p.length-1]):(u(null),c(""))),p})},[d,w]),T=h.useCallback(r=>{y(x=>{const p=new Set(x);return p.has(r)?p.delete(r):p.add(r),p})},[]);if(s||!t)return e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading session..."});const k=C[t.status],A=new Map;for(const r of t.files){const x=r.category;A.has(x)||A.set(x,[]),A.get(x).push(r)}const P={artifacts:"Artifacts","role-specs":"Role Specs",session:"Session",wisdom:"Wisdom","message-bus":"Message Bus"};return e.jsxs("div",{className:"-m-[var(--spacing-4)] max-sm:-m-[var(--spacing-2)] flex flex-col h-[calc(100%+var(--spacing-4)*2)] max-sm:h-[calc(100%+var(--spacing-2)*2)] overflow-hidden relative",children:[e.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-2 border-b border-border shrink-0 bg-bg-secondary",children:[e.jsx("button",{type:"button",onClick:n,className:"w-7 h-7 rounded-lg flex items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-bg-hover transition-all",title:"Back to sessions",children:e.jsx(Z,{size:15,strokeWidth:2})}),e.jsx("span",{className:"text-[14px] font-semibold text-text-primary truncate",children:t.title}),e.jsx("span",{className:"text-[10px] font-mono text-text-tertiary",children:t.sessionId}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[10px] font-semibold",style:{background:`${k}18`,color:k},children:[t.status==="active"&&e.jsxs("span",{className:"relative flex w-1.5 h-1.5",children:[e.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",style:{backgroundColor:k}}),e.jsx("span",{className:"relative inline-flex rounded-full w-1.5 h-1.5",style:{backgroundColor:k}})]}),t.status]}),e.jsx("span",{className:"text-[11px] font-mono text-text-tertiary",children:t.duration}),e.jsxs("button",{type:"button",onClick:()=>o(!0),className:"ml-2 px-2.5 py-1 rounded-lg bg-bg-hover text-[11px] font-semibold text-text-secondary hover:text-text-primary hover:bg-bg-active transition-all flex items-center gap-1.5",children:[e.jsx(re,{size:12}),"Team Status"]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsxs("aside",{className:"w-[240px] border-r border-border bg-bg-secondary flex flex-col shrink-0 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-border-divider",children:[e.jsx("span",{className:"text-[11px] font-semibold text-text-primary",children:"Session Explorer"}),e.jsx("span",{className:"text-[9px] font-semibold px-1.5 py-0.5 rounded-full",style:{background:`${k}18`,color:k},children:t.status})]}),e.jsxs("div",{className:"px-3 py-2 border-b border-border-divider",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-widest text-text-placeholder mb-2",children:"Pipeline DAG"}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.pipelineStages.map((r,x)=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-0.5",children:[e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:S[r.status]}}),e.jsx("span",{className:["text-[10px] flex-1 truncate",r.status==="in_progress"?"font-semibold text-text-primary":"text-text-secondary",r.status==="pending"?"opacity-50":""].join(" "),children:r.name}),e.jsx("span",{className:"text-[8px] font-semibold px-1 rounded-full",style:{background:`${S[r.status]}18`,color:S[r.status]},children:r.status==="done"?"Done":r.status==="in_progress"?"Run":"Wait"})]}),x<t.pipelineStages.length-1&&e.jsx("div",{className:"w-px h-2 bg-border-divider ml-[3.5px]"})]},r.id)),t.pipelineStages.length===0&&e.jsx("span",{className:"text-[10px] text-text-tertiary italic",children:"No pipeline data"})]})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[Array.from(A.entries()).map(([r,x])=>e.jsxs("div",{className:"px-1.5 py-1",children:[e.jsxs("button",{type:"button",onClick:()=>T(r),className:"flex items-center gap-1 px-1.5 py-1 w-full text-left text-[9px] font-semibold uppercase tracking-widest text-text-placeholder hover:text-text-primary transition-colors",children:[e.jsx(X,{size:10,className:["transition-transform",a.has(r)?"-rotate-90":""].join(" ")}),P[r]??r,e.jsx("span",{className:"ml-auto text-[9px] bg-bg-hover px-1 rounded-full text-text-tertiary",children:x.length})]}),!a.has(r)&&e.jsx("div",{className:"flex flex-col gap-0.5",children:x.map(p=>e.jsxs("button",{type:"button",onClick:()=>void w(p),className:["flex items-center gap-1.5 px-2 py-1 rounded-md text-left text-[11px] w-full transition-all",(d==null?void 0:d.id)===p.id?"bg-bg-active text-text-primary font-medium":"text-text-secondary hover:bg-bg-hover hover:text-text-primary"].join(" "),children:[e.jsx(F,{size:11,className:"text-text-placeholder shrink-0"}),e.jsx("span",{className:"truncate",children:p.name})]},p.id))})]},r)),t.files.length===0&&e.jsx("div",{className:"px-3 py-4 text-[11px] text-text-tertiary italic text-center",children:"No files found"})]})]}),e.jsxs("main",{className:"flex-1 flex flex-col overflow-hidden bg-bg-primary",children:[g.length>0&&e.jsx("div",{className:"flex items-center border-b border-border bg-bg-secondary shrink-0 overflow-x-auto",children:g.map(r=>e.jsxs("div",{className:["flex items-center gap-1.5 px-3 py-1.5 text-[11px] cursor-pointer border-r border-border-divider shrink-0",(d==null?void 0:d.id)===r.id?"bg-bg-primary text-text-primary font-medium":"text-text-tertiary hover:text-text-secondary hover:bg-bg-hover"].join(" "),children:[e.jsx("button",{type:"button",onClick:()=>void w(r),className:"truncate max-w-[140px]",children:r.name}),e.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),j(r.id)},className:"w-4 h-4 rounded flex items-center justify-center text-text-placeholder hover:text-text-primary hover:bg-bg-hover transition-all",children:e.jsx(_,{size:10})})]},r.id))}),e.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[b&&e.jsx("div",{className:"text-[12px] text-text-tertiary",children:"Loading file..."}),!b&&!d&&e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-text-tertiary gap-2",children:[e.jsx(F,{size:32,className:"opacity-30"}),e.jsx("span",{className:"text-[13px] font-medium",children:"Select a file to view"}),e.jsx("span",{className:"text-[11px]",children:"Choose from the sidebar or click Team Status for an overview"})]}),!b&&d&&e.jsx("div",{className:"font-mono text-[12px] leading-relaxed text-text-primary whitespace-pre-wrap break-words",children:f})]})]})]}),e.jsx(pe,{session:t,open:i,onClose:()=>o(!1)})]})}const fe=[{label:"Cards",icon:e.jsx(H,{size:14,strokeWidth:1.8}),shortcut:"1"},{label:"Table",icon:e.jsx(q,{size:14,strokeWidth:1.8}),shortcut:"2"}],z=["cards","table"],be={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8}};function Ce(){const t=m(c=>c.activeView),l=m(c=>c.setActiveView),s=m(c=>c.activeSessionId),n=m(c=>c.fetchSessions),i=m(c=>c.loading),o=m(c=>c.error),{register:d,unregister:u}=h.useContext(K),f=h.useCallback(c=>l(z[c]),[l]);return h.useEffect(()=>{s?u():d({items:fe.map(c=>({label:c.label,icon:c.icon,shortcut:c.shortcut})),activeIndex:z.indexOf(t),onSwitch:f})},[t,s,d,u,f]),h.useEffect(()=>()=>u(),[u]),h.useEffect(()=>{function c(b){b.target instanceof HTMLInputElement||b.target instanceof HTMLTextAreaElement||s||(b.key==="1"?l("cards"):b.key==="2"&&l("table"))}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[l,s]),h.useEffect(()=>{n()},[n]),i&&!s?e.jsx("div",{className:"flex items-center justify-center h-full text-text-secondary text-[length:var(--font-size-sm)]",children:"Loading team sessions..."}):o&&!s?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-3",children:[e.jsx("span",{className:"text-status-failed text-[length:var(--font-size-sm)]",children:"Failed to load team sessions"}),e.jsx("span",{className:"text-text-tertiary text-[length:var(--font-size-xs)]",children:o}),e.jsx("button",{type:"button",onClick:()=>void n(),className:"px-3 py-1 rounded-[var(--radius-md)] text-[11px] font-semibold text-text-secondary hover:text-text-primary transition-all",style:{border:"var(--style-btn-secondary-border)",background:"var(--style-btn-secondary-bg)"},children:"Retry"})]}):s?e.jsx(ue,{}):e.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:e.jsx(ee,{mode:"wait",children:e.jsx(te.div,{className:"flex-1 flex flex-col overflow-hidden",variants:be,initial:"initial",animate:"animate",exit:"exit",transition:{duration:.25,ease:[.34,1.56,.64,1]},children:e.jsx(de,{viewMode:t})},t)})})}export{Ce as TeamsPage};
@@ -1,6 +0,0 @@
1
- import{d as o}from"./index-DWG-WrzT.js";/**
2
- * @license lucide-react v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],r=o("arrow-left",e);export{r as A};