maestro-flow 0.3.10 → 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.
- package/.claude/agents/conceptual-planning-agent.md +1 -0
- package/.claude/agents/workflow-analyzer.md +114 -114
- package/.claude/agents/workflow-collab-planner.md +144 -144
- package/.claude/agents/workflow-debugger.md +102 -103
- package/.claude/agents/workflow-executor.md +127 -128
- package/.claude/agents/workflow-integration-checker.md +82 -82
- package/.claude/agents/workflow-nyquist-auditor.md +85 -84
- package/.claude/agents/workflow-phase-researcher.md +85 -85
- package/.claude/agents/workflow-plan-checker.md +90 -90
- package/.claude/agents/workflow-planner.md +178 -178
- package/.claude/agents/workflow-roadmapper.md +81 -83
- package/.claude/agents/workflow-verifier.md +119 -119
- package/.claude/commands/learn-decompose.md +176 -176
- package/.claude/commands/learn-follow.md +167 -167
- package/.claude/commands/learn-retro.md +3 -3
- package/.claude/commands/learn-second-opinion.md +2 -2
- package/.claude/commands/maestro-brainstorm.md +1 -0
- package/.claude/commands/maestro-coordinate.md +1 -3
- package/.claude/commands/maestro-fork.md +133 -111
- package/.claude/commands/maestro-merge.md +85 -77
- package/.claude/commands/maestro-plan.md +88 -2
- package/.claude/commands/maestro-roadmap.md +113 -2
- package/.claude/commands/maestro.md +1 -0
- package/.claude/commands/manage-harvest.md +131 -131
- package/.claude/commands/manage-issue.md +2 -2
- package/.claude/commands/quality-business-test.md +5 -5
- package/.claude/commands/quality-debug.md +3 -2
- package/.claude/commands/quality-retrospective.md +6 -4
- package/.claude/commands/quality-review.md +1 -1
- package/.claude/commands/quality-test-gen.md +5 -4
- package/.claude/commands/spec-add.md +67 -56
- package/.claude/commands/spec-load.md +66 -64
- package/.claude/commands/spec-setup.md +5 -9
- package/.codex/skills/learn-decompose/SKILL.md +119 -0
- package/.codex/skills/learn-follow/SKILL.md +83 -0
- package/.codex/skills/learn-investigate/SKILL.md +83 -0
- package/.codex/skills/learn-retro/SKILL.md +83 -0
- package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
- package/.codex/skills/maestro/SKILL.md +151 -279
- package/.codex/skills/maestro-analyze/SKILL.md +59 -71
- package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
- package/.codex/skills/maestro-chain/SKILL.md +95 -110
- package/.codex/skills/maestro-coordinate/SKILL.md +68 -234
- package/.codex/skills/maestro-execute/SKILL.md +435 -446
- package/.codex/skills/maestro-fork/SKILL.md +98 -0
- package/.codex/skills/maestro-init/SKILL.md +172 -167
- package/.codex/skills/maestro-learn/SKILL.md +80 -0
- package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
- package/.codex/skills/maestro-merge/SKILL.md +69 -0
- package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
- package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
- package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
- package/.codex/skills/maestro-overlay/SKILL.md +188 -185
- package/.codex/skills/maestro-plan/SKILL.md +58 -69
- package/.codex/skills/maestro-quick/SKILL.md +26 -23
- package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
- package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
- package/.codex/skills/maestro-ui-design/SKILL.md +35 -32
- package/.codex/skills/maestro-verify/SKILL.md +556 -566
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
- package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
- package/.codex/skills/manage-harvest/SKILL.md +82 -0
- package/.codex/skills/manage-issue/SKILL.md +80 -65
- package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
- package/.codex/skills/manage-learn/SKILL.md +190 -186
- package/.codex/skills/manage-memory/SKILL.md +95 -72
- package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
- package/.codex/skills/manage-status/SKILL.md +102 -89
- package/.codex/skills/quality-business-test/SKILL.md +228 -223
- package/.codex/skills/quality-debug/SKILL.md +54 -66
- package/.codex/skills/quality-integration-test/SKILL.md +532 -544
- package/.codex/skills/quality-refactor/SKILL.md +197 -191
- package/.codex/skills/quality-retrospective/SKILL.md +512 -505
- package/.codex/skills/quality-review/SKILL.md +95 -107
- package/.codex/skills/quality-sync/SKILL.md +101 -89
- package/.codex/skills/quality-test/SKILL.md +202 -198
- package/.codex/skills/quality-test-gen/SKILL.md +94 -105
- package/.codex/skills/spec-add/SKILL.md +58 -39
- package/.codex/skills/spec-load/SKILL.md +45 -40
- package/.codex/skills/spec-map/SKILL.md +180 -182
- package/.codex/skills/spec-setup/SKILL.md +94 -76
- package/.codex/skills/team-coordinate/SKILL.md +346 -357
- package/.codex/skills/team-executor/SKILL.md +70 -112
- package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
- package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
- package/.codex/skills/team-review/SKILL.md +232 -225
- package/.codex/skills/team-tech-debt/SKILL.md +78 -100
- package/.codex/skills/team-testing/SKILL.md +242 -235
- package/.codex/skills/wiki-connect/SKILL.md +75 -0
- package/.codex/skills/wiki-digest/SKILL.md +87 -0
- package/README.md +9 -4
- package/README.zh-CN.md +9 -4
- package/dashboard/dist/assets/{ArtifactsPage-DZNCi6tn.js → ArtifactsPage-CUrrDGgN.js} +1 -1
- package/dashboard/dist/assets/ChatInput-pUOLJIKE.js +49 -0
- package/dashboard/dist/assets/ChatPage-B8Xqkt0v.js +27 -0
- package/dashboard/dist/assets/{CollabPage-B4NAHXS2.js → CollabPage-DIUXeazv.js} +1 -1
- package/dashboard/dist/assets/{ExecutionPanel-CFt4LJyq.js → ExecutionPanel-VmYeADFj.js} +1 -1
- package/dashboard/dist/assets/KanbanPage-DLq8v7hg.js +21 -0
- package/dashboard/dist/assets/{MarkdownRenderer-X4af_WNb.js → MarkdownRenderer-D7AehrnR.js} +1 -1
- package/dashboard/dist/assets/{McpPage-BKfCVIyU.js → McpPage-BY0SjTgw.js} +2 -2
- package/dashboard/dist/assets/{OutputPanel-BlBQFJSW.js → OutputPanel-B-Rjwgmv.js} +1 -1
- package/dashboard/dist/assets/{ProblemsPanel-De3DLvoI.js → ProblemsPanel-GEpF-oi4.js} +1 -1
- package/dashboard/dist/assets/RequirementBoardPage-xs8uDM7I.js +6 -0
- package/dashboard/dist/assets/{RequirementPage-Bllxe2XI.js → RequirementPage-BKDSFwjA.js} +5 -10
- package/dashboard/dist/assets/SpecsPage-DLFb9ZH0.js +36 -0
- package/dashboard/dist/assets/SupervisorPage-SOki_kgz.js +6 -0
- package/dashboard/dist/assets/TeamsPage-BO2kP70F.js +11 -0
- package/dashboard/dist/assets/{TreeBrowser-Q12qobZs.js → TreeBrowser-B9DHdULE.js} +1 -1
- package/dashboard/dist/assets/{WorkflowPage-D_Fzdy3_.js → WorkflowPage-C8hWbYim.js} +1 -1
- package/dashboard/dist/assets/{check-u6fGOwQO.js → check-DJDk3A2a.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-Csu22t58.js → chevron-right-C7bVDreZ.js} +1 -1
- package/dashboard/dist/assets/{circle-CMrkbRNg.js → circle-Qfgy4LB_.js} +1 -1
- package/dashboard/dist/assets/{circle-alert-c3tH1P4z.js → circle-alert-Na1vf6qQ.js} +1 -1
- package/dashboard/dist/assets/{circle-check-gYxxSYuH.js → circle-check-CEGgy3NV.js} +1 -1
- package/dashboard/dist/assets/{circle-check-big-TDSeWstm.js → circle-check-big-3JB8zRYj.js} +1 -1
- package/dashboard/dist/assets/{code-CFN2uX9V.js → code-Ble63Idz.js} +1 -1
- package/dashboard/dist/assets/{columns-3-38xIDlzy.js → columns-3-BUcKlxve.js} +1 -1
- package/dashboard/dist/assets/{download-DC7KkKyP.js → download-CMqkfn8x.js} +1 -1
- package/dashboard/dist/assets/{folder-CWq_lAnf.js → folder-B9ewx9LL.js} +1 -1
- package/dashboard/dist/assets/index-C2Mcb4TJ.js +231 -0
- package/dashboard/dist/assets/index-DyBbPc18.css +1 -0
- package/dashboard/dist/assets/{index-Do71weNR.js → index-JTmGteaT.js} +1 -1
- package/dashboard/dist/assets/{list-CgIP_2A-.js → list-DI8Wn2aT.js} +1 -1
- package/dashboard/dist/assets/loader-B5F6PzFT.js +11 -0
- package/dashboard/dist/assets/{minus-DYoN5UGk.js → minus-Lp_BfctG.js} +1 -1
- package/dashboard/dist/assets/{pen-line-Bh_WKYHm.js → pen-line-Ch7sphzZ.js} +1 -1
- package/dashboard/dist/assets/pencil-_yRMHmGT.js +6 -0
- package/dashboard/dist/assets/{proxy-BKxDAKTj.js → proxy-D72Y8a4Y.js} +1 -1
- package/dashboard/dist/assets/{search-SieXnOgr.js → search-BS6fI6Bg.js} +1 -1
- package/dashboard/dist/assets/{shallow-Bme1JY57.js → shallow-BXasQBvr.js} +1 -1
- package/dashboard/dist/assets/table-CeGlFjlP.js +6 -0
- package/dashboard/dist/assets/{terminal-BB3Xfuv5.js → terminal-BJic2yW-.js} +1 -1
- package/dashboard/dist/assets/{trash-2-C8f4vFFM.js → trash-2-Czz4X8Fb.js} +1 -1
- package/dashboard/dist/assets/{zap-4uwlzVm0.js → zap-C3H0jVFA.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js +16 -1
- package/dashboard/dist-server/dashboard/src/server/agents/agent-manager.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js +1 -2
- package/dashboard/dist-server/dashboard/src/server/agents/delegate-broker-monitor.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js +2 -1
- package/dashboard/dist-server/dashboard/src/server/commander/commander-prompts.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/index.js +3 -0
- package/dashboard/dist-server/dashboard/src/server/index.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js +124 -0
- package/dashboard/dist-server/dashboard/src/server/routes/collab.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.d.ts +10 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js +73 -0
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/team-handler.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.d.ts +31 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js +28 -0
- package/dashboard/dist-server/dashboard/src/shared/collab-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/constants.js +10 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/coordinate-types.d.ts +22 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js +12 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +22 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js +7 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +28 -2
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
- package/dashboard/dist-server/shared/agent-types.d.ts +4 -0
- package/dashboard/dist-server/src/hooks/constants.d.ts +3 -1
- package/dashboard/dist-server/src/hooks/constants.js +4 -2
- package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
- package/dist/shared/agent-types.d.ts +4 -0
- package/dist/shared/agent-types.d.ts.map +1 -1
- package/dist/src/commands/collab.js +4 -4
- package/dist/src/commands/collab.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +66 -1
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +29 -18
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +7 -2
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.js +23 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -1
- package/dist/src/hooks/constants.d.ts +3 -1
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +4 -2
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/guards/index.d.ts +1 -0
- package/dist/src/hooks/guards/index.d.ts.map +1 -1
- package/dist/src/hooks/guards/index.js +1 -0
- package/dist/src/hooks/guards/index.js.map +1 -1
- package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
- package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
- package/dist/src/hooks/guards/spec-validator.js +66 -0
- package/dist/src/hooks/guards/spec-validator.js.map +1 -0
- package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
- package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
- package/dist/src/hooks/keyword-spec-injector.js +96 -0
- package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
- package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
- package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
- package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
- package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
- package/dist/src/hooks/skill-context.d.ts +3 -0
- package/dist/src/hooks/skill-context.d.ts.map +1 -1
- package/dist/src/hooks/skill-context.js +95 -9
- package/dist/src/hooks/skill-context.js.map +1 -1
- package/dist/src/hooks/spec-bridge.d.ts +40 -0
- package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
- package/dist/src/hooks/spec-bridge.js +97 -0
- package/dist/src/hooks/spec-bridge.js.map +1 -0
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +18 -12
- package/dist/src/hooks/spec-injector.js.map +1 -1
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +6 -3
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/team/phase-orchestrator.d.ts +52 -0
- package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
- package/dist/src/team/phase-orchestrator.js +165 -0
- package/dist/src/team/phase-orchestrator.js.map +1 -0
- package/dist/src/team/phase-types.d.ts +51 -0
- package/dist/src/team/phase-types.d.ts.map +1 -0
- package/dist/src/team/phase-types.js +41 -0
- package/dist/src/team/phase-types.js.map +1 -0
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +6 -0
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/merge-validator.d.ts.map +1 -1
- package/dist/src/tools/merge-validator.js +114 -16
- package/dist/src/tools/merge-validator.js.map +1 -1
- package/dist/src/tools/spec-entry-parser.d.ts +56 -0
- package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
- package/dist/src/tools/spec-entry-parser.js +196 -0
- package/dist/src/tools/spec-entry-parser.js.map +1 -0
- package/dist/src/tools/spec-init.d.ts.map +1 -1
- package/dist/src/tools/spec-init.js +66 -92
- package/dist/src/tools/spec-init.js.map +1 -1
- package/dist/src/tools/spec-keyword-index.d.ts +30 -0
- package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
- package/dist/src/tools/spec-keyword-index.js +101 -0
- package/dist/src/tools/spec-keyword-index.js.map +1 -0
- package/dist/src/tools/spec-loader.d.ts +3 -3
- package/dist/src/tools/spec-loader.d.ts.map +1 -1
- package/dist/src/tools/spec-loader.js +49 -23
- package/dist/src/tools/spec-loader.js.map +1 -1
- package/dist/src/tools/team-agents.d.ts +27 -0
- package/dist/src/tools/team-agents.d.ts.map +1 -0
- package/dist/src/tools/team-agents.js +362 -0
- package/dist/src/tools/team-agents.js.map +1 -0
- package/dist/src/tools/team-mailbox.d.ts +40 -0
- package/dist/src/tools/team-mailbox.d.ts.map +1 -0
- package/dist/src/tools/team-mailbox.js +384 -0
- package/dist/src/tools/team-mailbox.js.map +1 -0
- package/dist/src/tools/team-msg.d.ts +17 -8
- package/dist/src/tools/team-msg.d.ts.map +1 -1
- package/dist/src/tools/team-msg.js +110 -13
- package/dist/src/tools/team-msg.js.map +1 -1
- package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
- package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
- package/dist/src/tools/team-tasks-mcp.js +408 -0
- package/dist/src/tools/team-tasks-mcp.js.map +1 -0
- package/package.json +2 -1
- package/shared/agent-types.ts +4 -0
- package/templates/worktree-scope.json +9 -10
- package/templates/worktrees.json +26 -27
- package/workflows/analyze.md +816 -816
- package/workflows/brainstorm.md +480 -471
- package/workflows/codebase-rebuild.md +332 -332
- package/workflows/codebase-refresh.md +240 -240
- package/workflows/debug.md +16 -6
- package/workflows/execute.md +1 -1
- package/workflows/fork.md +100 -36
- package/workflows/harvest.md +420 -420
- package/workflows/integration-test.md +355 -343
- package/workflows/issue-discover.md +414 -414
- package/workflows/issue.md +14 -4
- package/workflows/learn.md +19 -5
- package/workflows/maestro.md +1 -0
- package/workflows/map.md +111 -111
- package/workflows/merge.md +113 -55
- package/workflows/milestone-complete.md +176 -176
- package/workflows/plan.md +1 -1
- package/workflows/quick.md +497 -497
- package/workflows/refactor.md +300 -300
- package/workflows/retrospective.md +61 -22
- package/workflows/review.md +17 -4
- package/workflows/roadmap.md +335 -335
- package/workflows/spec-generate.md +640 -640
- package/workflows/specs-add.md +46 -81
- package/workflows/specs-load.md +15 -17
- package/workflows/specs-setup.md +40 -161
- package/workflows/test.md +12 -2
- package/workflows/ui-style.md +9 -2
- package/dashboard/dist/assets/ChatInput-Bvr-FeEq.js +0 -49
- package/dashboard/dist/assets/ChatPage-D9zTkJZo.js +0 -22
- package/dashboard/dist/assets/KanbanPage-C8USth6H.js +0 -21
- package/dashboard/dist/assets/RequirementBoardPage-Bf1trzqs.js +0 -11
- package/dashboard/dist/assets/SpecsPage-9lwxKT27.js +0 -36
- package/dashboard/dist/assets/SupervisorPage-SusdfHFq.js +0 -6
- package/dashboard/dist/assets/TeamsPage-DsuM6OwC.js +0 -6
- package/dashboard/dist/assets/arrow-left-Bqtb2hle.js +0 -6
- package/dashboard/dist/assets/index-DWG-WrzT.js +0 -231
- package/dashboard/dist/assets/index-GUNJodSR.css +0 -1
- package/dashboard/dist/assets/table-llyEtj-7.js +0 -6
|
@@ -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};
|