claude-code-workflow 7.2.28 → 7.2.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (348) hide show
  1. package/.ccw/workflows/cli-templates/schemas/plan-overview-base-schema.json +2 -2
  2. package/.ccw/workflows/cli-templates/schemas/task-schema.json +14 -7
  3. package/.claude/agents/action-planning-agent.md +7 -4
  4. package/.claude/agents/cli-explore-agent.md +77 -63
  5. package/.claude/agents/cli-lite-planning-agent.md +11 -10
  6. package/.claude/agents/issue-plan-agent.md +421 -426
  7. package/.claude/commands/workflow/spec/setup.md +1 -1
  8. package/.claude/skills/ccw-chain/SKILL.md +119 -0
  9. package/.claude/skills/ccw-chain/chains/ccw-cycle.json +21 -0
  10. package/.claude/skills/ccw-chain/chains/ccw-exploration.json +47 -0
  11. package/.claude/skills/ccw-chain/chains/ccw-issue.json +33 -0
  12. package/.claude/skills/ccw-chain/chains/ccw-lightweight.json +57 -0
  13. package/.claude/skills/ccw-chain/chains/ccw-main.json +52 -0
  14. package/.claude/skills/ccw-chain/chains/ccw-standard.json +39 -0
  15. package/.claude/skills/ccw-chain/chains/ccw-team.json +10 -0
  16. package/.claude/skills/ccw-chain/chains/ccw-with-file.json +31 -0
  17. package/.claude/skills/ccw-chain/phases/analyze-with-file.md +788 -0
  18. package/.claude/skills/ccw-chain/phases/brainstorm/SKILL.md +408 -0
  19. package/.claude/skills/ccw-chain/phases/brainstorm/phases/01-mode-routing.md +207 -0
  20. package/.claude/skills/ccw-chain/phases/brainstorm/phases/02-artifacts.md +567 -0
  21. package/.claude/skills/ccw-chain/phases/brainstorm/phases/03-role-analysis.md +748 -0
  22. package/.claude/skills/ccw-chain/phases/brainstorm/phases/04-synthesis.md +827 -0
  23. package/.claude/skills/ccw-chain/phases/brainstorm-with-file.md +482 -0
  24. package/.claude/skills/ccw-chain/phases/collaborative-plan-with-file.md +639 -0
  25. package/.claude/skills/ccw-chain/phases/debug-with-file.md +656 -0
  26. package/.claude/skills/ccw-chain/phases/integration-test-cycle.md +936 -0
  27. package/.claude/skills/ccw-chain/phases/issue-convert-to-plan.md +720 -0
  28. package/.claude/skills/ccw-chain/phases/issue-discover.md +483 -0
  29. package/.claude/skills/ccw-chain/phases/issue-execute.md +629 -0
  30. package/.claude/skills/ccw-chain/phases/issue-from-brainstorm.md +382 -0
  31. package/.claude/skills/ccw-chain/phases/issue-plan.md +343 -0
  32. package/.claude/skills/ccw-chain/phases/issue-queue.md +464 -0
  33. package/.claude/skills/ccw-chain/phases/refactor-cycle.md +852 -0
  34. package/.claude/skills/ccw-chain/phases/review-cycle/SKILL.md +132 -0
  35. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-fix.md +760 -0
  36. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-module.md +764 -0
  37. package/.claude/skills/ccw-chain/phases/review-cycle/phases/review-session.md +775 -0
  38. package/.claude/skills/ccw-chain/phases/roadmap-with-file.md +544 -0
  39. package/.claude/skills/ccw-chain/phases/spec-generator/SKILL.md +338 -0
  40. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-5-requirement-clarification.md +404 -0
  41. package/.claude/skills/ccw-chain/phases/spec-generator/phases/01-discovery.md +257 -0
  42. package/.claude/skills/ccw-chain/phases/spec-generator/phases/02-product-brief.md +274 -0
  43. package/.claude/skills/ccw-chain/phases/spec-generator/phases/03-requirements.md +184 -0
  44. package/.claude/skills/ccw-chain/phases/spec-generator/phases/04-architecture.md +248 -0
  45. package/.claude/skills/ccw-chain/phases/spec-generator/phases/05-epics-stories.md +178 -0
  46. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-5-auto-fix.md +144 -0
  47. package/.claude/skills/ccw-chain/phases/spec-generator/phases/06-readiness-check.md +480 -0
  48. package/.claude/skills/ccw-chain/phases/team-planex.md +123 -0
  49. package/.claude/skills/ccw-chain/phases/ui-design-explore-auto.md +678 -0
  50. package/.claude/skills/ccw-chain/phases/unified-execute-with-file.md +870 -0
  51. package/.claude/skills/ccw-chain/phases/workflow-execute/SKILL.md +625 -0
  52. package/.claude/skills/ccw-chain/phases/workflow-execute/phases/06-review.md +215 -0
  53. package/.claude/skills/ccw-chain/phases/workflow-lite-plan.md +616 -0
  54. package/.claude/skills/ccw-chain/phases/workflow-multi-cli-plan.md +424 -0
  55. package/.claude/skills/ccw-chain/phases/workflow-plan/SKILL.md +466 -0
  56. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/01-session-discovery.md +99 -0
  57. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/02-context-gathering.md +338 -0
  58. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/03-conflict-resolution.md +422 -0
  59. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/04-task-generation.md +440 -0
  60. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/05-plan-verify.md +395 -0
  61. package/.claude/skills/ccw-chain/phases/workflow-plan/phases/06-replan.md +594 -0
  62. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/SKILL.md +527 -0
  63. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/01-session-discovery.md +57 -0
  64. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/02-context-gathering.md +407 -0
  65. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/03-test-coverage-analysis.md +172 -0
  66. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -0
  67. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/05-tdd-task-generation.md +473 -0
  68. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/06-tdd-structure-validation.md +189 -0
  69. package/.claude/skills/ccw-chain/phases/workflow-tdd-plan/phases/07-tdd-verify.md +635 -0
  70. package/.claude/skills/ccw-chain/phases/workflow-test-fix/SKILL.md +482 -0
  71. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/01-session-start.md +60 -0
  72. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/02-test-context-gather.md +493 -0
  73. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/03-test-concept-enhanced.md +150 -0
  74. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/04-test-task-generate.md +346 -0
  75. package/.claude/skills/ccw-chain/phases/workflow-test-fix/phases/05-test-cycle-execute.md +538 -0
  76. package/.claude/skills/ccw-chain/specs/auto-mode.md +47 -0
  77. package/.claude/skills/ccw-chain/specs/intent-patterns.md +60 -0
  78. package/.claude/skills/chain-loader/SKILL.md +78 -0
  79. package/.claude/skills/chain-loader/phases/01-analyze-skill.md +53 -0
  80. package/.claude/skills/chain-loader/phases/02-design-graph.md +73 -0
  81. package/.claude/skills/chain-loader/phases/03-generate-validate.md +75 -0
  82. package/.claude/skills/chain-loader/specs/chain-schema.md +99 -0
  83. package/.claude/skills/chain-loader/specs/design-patterns.md +99 -0
  84. package/.claude/skills/chain-loader/templates/chain-json.md +63 -0
  85. package/.claude/skills/review-cycle/phases/review-module.md +764 -764
  86. package/.claude/skills/review-cycle/phases/review-session.md +775 -775
  87. package/.claude/skills/workflow-multi-cli-plan/SKILL.md +2 -2
  88. package/.claude/skills/workflow-plan/phases/03-conflict-resolution.md +422 -422
  89. package/.claude/skills/workflow-plan/phases/05-plan-verify.md +395 -395
  90. package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +407 -407
  91. package/.claude/skills/workflow-tdd-plan/phases/04-conflict-resolution.md +426 -426
  92. package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +493 -493
  93. package/.codex/skills/brainstorm/SKILL.md +3 -3
  94. package/.codex/skills/clean/SKILL.md +3 -3
  95. package/.codex/skills/issue-discover/SKILL.md +13 -13
  96. package/.codex/skills/issue-discover/phases/02-discover.md +4 -4
  97. package/.codex/skills/issue-discover/phases/03-discover-by-prompt.md +3 -3
  98. package/.codex/skills/parallel-dev-cycle/SKILL.md +4 -4
  99. package/.codex/skills/parallel-dev-cycle/phases/02-agent-execution.md +6 -6
  100. package/.codex/skills/parallel-dev-cycle/phases/03-result-aggregation.md +10 -10
  101. package/.codex/skills/review-cycle/SKILL.md +10 -10
  102. package/.codex/skills/review-cycle/phases/02-parallel-review.md +6 -6
  103. package/.codex/skills/review-cycle/phases/04-iterative-deep-dive.md +4 -4
  104. package/.codex/skills/review-cycle/phases/07-fix-parallel-planning.md +4 -4
  105. package/.codex/skills/review-cycle/phases/08-fix-execution.md +2 -2
  106. package/.codex/skills/roadmap-with-file/SKILL.md +14 -14
  107. package/.codex/skills/spec-generator/README.md +1 -1
  108. package/.codex/skills/spec-generator/SKILL.md +184 -88
  109. package/.codex/skills/spec-generator/phases/01-5-requirement-clarification.md +4 -7
  110. package/.codex/skills/spec-generator/phases/01-discovery.md +30 -11
  111. package/.codex/skills/spec-generator/phases/02-product-brief.md +2 -5
  112. package/.codex/skills/spec-generator/phases/03-requirements.md +4 -6
  113. package/.codex/skills/spec-generator/phases/04-architecture.md +4 -6
  114. package/.codex/skills/spec-generator/phases/05-epics-stories.md +4 -6
  115. package/.codex/skills/spec-generator/phases/06-5-auto-fix.md +4 -5
  116. package/.codex/skills/spec-generator/phases/06-readiness-check.md +8 -8
  117. package/.codex/skills/spec-generator/phases/07-issue-export.md +2 -2
  118. package/.codex/skills/spec-setup/SKILL.md +4 -4
  119. package/.codex/skills/workflow-plan/SKILL.md +6 -6
  120. package/.codex/skills/workflow-tdd-plan/SKILL.md +5 -5
  121. package/.codex/skills/workflow-test-fix-cycle/SKILL.md +19 -19
  122. package/.codex/skills/workflow-test-fix-cycle/phases/01-test-fix-gen.md +5 -5
  123. package/.codex/skills/workflow-test-fix-cycle/phases/02-test-cycle-execute.md +5 -5
  124. package/README.md +14 -0
  125. package/ccw/dist/core/routes/litellm-api-routes.d.ts.map +1 -1
  126. package/ccw/dist/core/routes/litellm-api-routes.js +0 -23
  127. package/ccw/dist/core/routes/litellm-api-routes.js.map +1 -1
  128. package/ccw/dist/tools/chain-loader.d.ts +10 -0
  129. package/ccw/dist/tools/chain-loader.d.ts.map +1 -0
  130. package/ccw/dist/tools/chain-loader.js +642 -0
  131. package/ccw/dist/tools/chain-loader.js.map +1 -0
  132. package/ccw/dist/tools/index.d.ts.map +1 -1
  133. package/ccw/dist/tools/index.js +2 -0
  134. package/ccw/dist/tools/index.js.map +1 -1
  135. package/ccw/dist/tools/json-builder.js +20 -0
  136. package/ccw/dist/tools/json-builder.js.map +1 -1
  137. package/ccw/dist/types/chain-types.d.ts +72 -0
  138. package/ccw/dist/types/chain-types.d.ts.map +1 -0
  139. package/ccw/dist/types/chain-types.js +5 -0
  140. package/ccw/dist/types/chain-types.js.map +1 -0
  141. package/ccw/frontend/dist/assets/{AlertDialog-BjP1ydDR.js → AlertDialog-exlTDW81.js} +3 -3
  142. package/ccw/frontend/dist/assets/{AlertDialog-BjP1ydDR.js.map → AlertDialog-exlTDW81.js.map} +1 -1
  143. package/ccw/frontend/dist/assets/{AnalysisPage-CAX3xqMf.js → AnalysisPage-cgV9LfAI.js} +2 -2
  144. package/ccw/frontend/dist/assets/{AnalysisPage-CAX3xqMf.js.map → AnalysisPage-cgV9LfAI.js.map} +1 -1
  145. package/ccw/frontend/dist/assets/{ApiSettingsPage-CtWlmztq.js → ApiSettingsPage-Dk5jJdWt.js} +2 -2
  146. package/ccw/frontend/dist/assets/{ApiSettingsPage-CtWlmztq.js.map → ApiSettingsPage-Dk5jJdWt.js.map} +1 -1
  147. package/ccw/frontend/dist/assets/{CliModeToggle-hR4a-eLX.js → CliModeToggle-Be9xsPiv.js} +2 -2
  148. package/ccw/frontend/dist/assets/{CliModeToggle-hR4a-eLX.js.map → CliModeToggle-Be9xsPiv.js.map} +1 -1
  149. package/ccw/frontend/dist/assets/{CliSessionSharePage-DzNPkFN9.js → CliSessionSharePage-Bh9jBtPI.js} +2 -2
  150. package/ccw/frontend/dist/assets/{CliSessionSharePage-DzNPkFN9.js.map → CliSessionSharePage-Bh9jBtPI.js.map} +1 -1
  151. package/ccw/frontend/dist/assets/{CliViewerPage-BPEGN4TT.js → CliViewerPage-BrE-oyEq.js} +2 -2
  152. package/ccw/frontend/dist/assets/{CliViewerPage-BPEGN4TT.js.map → CliViewerPage-BrE-oyEq.js.map} +1 -1
  153. package/ccw/frontend/dist/assets/{CodexLensPage-Cf0r2RHY.js → CodexLensPage-Cd3nrC93.js} +2 -2
  154. package/ccw/frontend/dist/assets/{CodexLensPage-Cf0r2RHY.js.map → CodexLensPage-Cd3nrC93.js.map} +1 -1
  155. package/ccw/frontend/dist/assets/{Collapsible-DEm1rJ4h.js → Collapsible-DXFl3VKF.js} +2 -2
  156. package/ccw/frontend/dist/assets/{Collapsible-DEm1rJ4h.js.map → Collapsible-DXFl3VKF.js.map} +1 -1
  157. package/ccw/frontend/dist/assets/{CommandsManagerPage-BpeWw8HO.js → CommandsManagerPage-IV8zpjgX.js} +2 -2
  158. package/ccw/frontend/dist/assets/{CommandsManagerPage-BpeWw8HO.js.map → CommandsManagerPage-IV8zpjgX.js.map} +1 -1
  159. package/ccw/frontend/dist/assets/{DeepWikiPage-BEsmh2vF.js → DeepWikiPage-CpDxtmRX.js} +2 -2
  160. package/ccw/frontend/dist/assets/{DeepWikiPage-BEsmh2vF.js.map → DeepWikiPage-CpDxtmRX.js.map} +1 -1
  161. package/ccw/frontend/dist/assets/{EndpointsPage-B30SFdtU.js → EndpointsPage-BchjWe7s.js} +2 -2
  162. package/ccw/frontend/dist/assets/{EndpointsPage-B30SFdtU.js.map → EndpointsPage-BchjWe7s.js.map} +1 -1
  163. package/ccw/frontend/dist/assets/{ExplorerPage-BVvMpg1O.js → ExplorerPage-CbWvaJ0y.js} +2 -2
  164. package/ccw/frontend/dist/assets/{ExplorerPage-BVvMpg1O.js.map → ExplorerPage-CbWvaJ0y.js.map} +1 -1
  165. package/ccw/frontend/dist/assets/{FixSessionPage-CL73dHbh.js → FixSessionPage-YMjVRiCk.js} +2 -2
  166. package/ccw/frontend/dist/assets/{FixSessionPage-CL73dHbh.js.map → FixSessionPage-YMjVRiCk.js.map} +1 -1
  167. package/ccw/frontend/dist/assets/{FloatingFileBrowser-BL-28lMZ.js → FloatingFileBrowser-JW2ehYY_.js} +2 -2
  168. package/ccw/frontend/dist/assets/{FloatingFileBrowser-BL-28lMZ.js.map → FloatingFileBrowser-JW2ehYY_.js.map} +1 -1
  169. package/ccw/frontend/dist/assets/{FloatingPanel-BzZDciHZ.js → FloatingPanel-BtqzqDVq.js} +2 -2
  170. package/ccw/frontend/dist/assets/{FloatingPanel-BzZDciHZ.js.map → FloatingPanel-BtqzqDVq.js.map} +1 -1
  171. package/ccw/frontend/dist/assets/{GraphExplorerPage-CDp6-d8P.js → GraphExplorerPage-BsJL_W4d.js} +3 -3
  172. package/ccw/frontend/dist/assets/{GraphExplorerPage-CDp6-d8P.js.map → GraphExplorerPage-BsJL_W4d.js.map} +1 -1
  173. package/ccw/frontend/dist/assets/{HistoryPage-fZY_7O9n.js → HistoryPage-BuWpQ7k5.js} +2 -2
  174. package/ccw/frontend/dist/assets/{HistoryPage-fZY_7O9n.js.map → HistoryPage-BuWpQ7k5.js.map} +1 -1
  175. package/ccw/frontend/dist/assets/{HookManagerPage-4LJeC9bq.js → HookManagerPage-D0BtMIWy.js} +2 -2
  176. package/ccw/frontend/dist/assets/{HookManagerPage-4LJeC9bq.js.map → HookManagerPage-D0BtMIWy.js.map} +1 -1
  177. package/ccw/frontend/dist/assets/{InstallationsPage-Bpigrbhw.js → InstallationsPage-C7dwsAKG.js} +2 -2
  178. package/ccw/frontend/dist/assets/{InstallationsPage-Bpigrbhw.js.map → InstallationsPage-C7dwsAKG.js.map} +1 -1
  179. package/ccw/frontend/dist/assets/{IssueHubPage-BP0zJc1R.js → IssueHubPage-D0nCNaeB.js} +2 -2
  180. package/ccw/frontend/dist/assets/{IssueHubPage-BP0zJc1R.js.map → IssueHubPage-D0nCNaeB.js.map} +1 -1
  181. package/ccw/frontend/dist/assets/{LiteTasksPage-CSt2oVKQ.js → LiteTasksPage-B5c2Kb9r.js} +3 -3
  182. package/ccw/frontend/dist/assets/{LiteTasksPage-CSt2oVKQ.js.map → LiteTasksPage-B5c2Kb9r.js.map} +1 -1
  183. package/ccw/frontend/dist/assets/{McpManagerPage-B-xaMA0w.js → McpManagerPage-C-S5CehM.js} +2 -2
  184. package/ccw/frontend/dist/assets/{McpManagerPage-B-xaMA0w.js.map → McpManagerPage-C-S5CehM.js.map} +1 -1
  185. package/ccw/frontend/dist/assets/{MemoryPage-CJqo_7DY.js → MemoryPage-P_B0JVUQ.js} +2 -2
  186. package/ccw/frontend/dist/assets/{MemoryPage-CJqo_7DY.js.map → MemoryPage-P_B0JVUQ.js.map} +1 -1
  187. package/ccw/frontend/dist/assets/{NotFoundPage-ibZeQA-Y.js → NotFoundPage-S4Jn9LUE.js} +2 -2
  188. package/ccw/frontend/dist/assets/{NotFoundPage-ibZeQA-Y.js.map → NotFoundPage-S4Jn9LUE.js.map} +1 -1
  189. package/ccw/frontend/dist/assets/{OrchestratorPage-DgJ4ctPQ.js → OrchestratorPage-C2Zlr7AC.js} +2 -2
  190. package/ccw/frontend/dist/assets/{OrchestratorPage-DgJ4ctPQ.js.map → OrchestratorPage-C2Zlr7AC.js.map} +1 -1
  191. package/ccw/frontend/dist/assets/{ProjectOverviewPage-Cit0Yq0D.js → ProjectOverviewPage-CMVfz8s5.js} +2 -2
  192. package/ccw/frontend/dist/assets/{ProjectOverviewPage-Cit0Yq0D.js.map → ProjectOverviewPage-CMVfz8s5.js.map} +1 -1
  193. package/ccw/frontend/dist/assets/{PromptHistoryPage-Ce1HDIK0.js → PromptHistoryPage-YEMjFARX.js} +3 -3
  194. package/ccw/frontend/dist/assets/{PromptHistoryPage-Ce1HDIK0.js.map → PromptHistoryPage-YEMjFARX.js.map} +1 -1
  195. package/ccw/frontend/dist/assets/{ReviewSessionPage-J1KikNrk.js → ReviewSessionPage-DnTm55nG.js} +2 -2
  196. package/ccw/frontend/dist/assets/{ReviewSessionPage-J1KikNrk.js.map → ReviewSessionPage-DnTm55nG.js.map} +1 -1
  197. package/ccw/frontend/dist/assets/{RulesManagerPage-CdBjTmth.js → RulesManagerPage-CUwebtO2.js} +2 -2
  198. package/ccw/frontend/dist/assets/{RulesManagerPage-CdBjTmth.js.map → RulesManagerPage-CUwebtO2.js.map} +1 -1
  199. package/ccw/frontend/dist/assets/{SessionDetailPage-B9ZK7LvX.js → SessionDetailPage-0qyH1Z5P.js} +2 -2
  200. package/ccw/frontend/dist/assets/{SessionDetailPage-B9ZK7LvX.js.map → SessionDetailPage-0qyH1Z5P.js.map} +1 -1
  201. package/ccw/frontend/dist/assets/{SessionsPage-CW_nS5UR.js → SessionsPage-BpgP4087.js} +2 -2
  202. package/ccw/frontend/dist/assets/{SessionsPage-CW_nS5UR.js.map → SessionsPage-BpgP4087.js.map} +1 -1
  203. package/ccw/frontend/dist/assets/SettingsPage-C3SJajeT.js +150 -0
  204. package/ccw/frontend/dist/assets/SettingsPage-C3SJajeT.js.map +1 -0
  205. package/ccw/frontend/dist/assets/SkillsManagerPage-vD9PTsmy.js +7 -0
  206. package/ccw/frontend/dist/assets/SkillsManagerPage-vD9PTsmy.js.map +1 -0
  207. package/ccw/frontend/dist/assets/{SpecsSettingsPage-DJpi9XQL.js → SpecsSettingsPage-DT-yTVkD.js} +4 -4
  208. package/ccw/frontend/dist/assets/{SpecsSettingsPage-DJpi9XQL.js.map → SpecsSettingsPage-DT-yTVkD.js.map} +1 -1
  209. package/ccw/frontend/dist/assets/{Switch-Ac6Ov7uy.js → Switch-CYSPdqWk.js} +2 -2
  210. package/ccw/frontend/dist/assets/{Switch-Ac6Ov7uy.js.map → Switch-CYSPdqWk.js.map} +1 -1
  211. package/ccw/frontend/dist/assets/{TabsNavigation-DZAAspqR.js → TabsNavigation-CPh6Zor1.js} +2 -2
  212. package/ccw/frontend/dist/assets/{TabsNavigation-DZAAspqR.js.map → TabsNavigation-CPh6Zor1.js.map} +1 -1
  213. package/ccw/frontend/dist/assets/{TaskDrawer-BJkwfhIZ.js → TaskDrawer-Ds-8830B.js} +2 -2
  214. package/ccw/frontend/dist/assets/{TaskDrawer-BJkwfhIZ.js.map → TaskDrawer-Ds-8830B.js.map} +1 -1
  215. package/ccw/frontend/dist/assets/{TeamPage-BJgjxBgb.js → TeamPage-CJODUxBk.js} +2 -2
  216. package/ccw/frontend/dist/assets/{TeamPage-BJgjxBgb.js.map → TeamPage-CJODUxBk.js.map} +1 -1
  217. package/ccw/frontend/dist/assets/{TerminalDashboardPage-D1WekoOy.js → TerminalDashboardPage-Cn3fGUuO.js} +3 -3
  218. package/ccw/frontend/dist/assets/{TerminalDashboardPage-D1WekoOy.js.map → TerminalDashboardPage-Cn3fGUuO.js.map} +1 -1
  219. package/ccw/frontend/dist/assets/{archive-DxemgIhF.js → archive-CjwVpw6k.js} +2 -2
  220. package/ccw/frontend/dist/assets/{archive-DxemgIhF.js.map → archive-CjwVpw6k.js.map} +1 -1
  221. package/ccw/frontend/dist/assets/{archive-restore-CjS83f1V.js → archive-restore-2vZa9Ic3.js} +2 -2
  222. package/ccw/frontend/dist/assets/{archive-restore-CjS83f1V.js.map → archive-restore-2vZa9Ic3.js.map} +1 -1
  223. package/ccw/frontend/dist/assets/{arrow-right-B5PUcn8I.js → arrow-right-CUU5XDgT.js} +2 -2
  224. package/ccw/frontend/dist/assets/{arrow-right-B5PUcn8I.js.map → arrow-right-CUU5XDgT.js.map} +1 -1
  225. package/ccw/frontend/dist/assets/{bookmark-plus-DCc9aPbb.js → bookmark-plus-Cc3nKRZ5.js} +2 -2
  226. package/ccw/frontend/dist/assets/{bookmark-plus-DCc9aPbb.js.map → bookmark-plus-Cc3nKRZ5.js.map} +1 -1
  227. package/ccw/frontend/dist/assets/{bot-DOwFtzak.js → bot-BwpSRDUa.js} +2 -2
  228. package/ccw/frontend/dist/assets/{bot-DOwFtzak.js.map → bot-BwpSRDUa.js.map} +1 -1
  229. package/ccw/frontend/dist/assets/{braces-96qH3aFh.js → braces-DBzUW1XC.js} +2 -2
  230. package/ccw/frontend/dist/assets/{braces-96qH3aFh.js.map → braces-DBzUW1XC.js.map} +1 -1
  231. package/ccw/frontend/dist/assets/{circle-stop-CCxSuil1.js → circle-stop-CGNNsjvE.js} +2 -2
  232. package/ccw/frontend/dist/assets/{circle-stop-CCxSuil1.js.map → circle-stop-CGNNsjvE.js.map} +1 -1
  233. package/ccw/frontend/dist/assets/{cpu-CZNSJFdq.js → cpu-D27G86Ul.js} +2 -2
  234. package/ccw/frontend/dist/assets/{cpu-CZNSJFdq.js.map → cpu-D27G86Ul.js.map} +1 -1
  235. package/ccw/frontend/dist/assets/{ellipsis-vertical-h8xtvw2_.js → ellipsis-vertical-C1Ij47Yz.js} +2 -2
  236. package/ccw/frontend/dist/assets/{ellipsis-vertical-h8xtvw2_.js.map → ellipsis-vertical-C1Ij47Yz.js.map} +1 -1
  237. package/ccw/frontend/dist/assets/{eye-D3NY0bm6.js → eye-C6MOB7Au.js} +2 -2
  238. package/ccw/frontend/dist/assets/{eye-D3NY0bm6.js.map → eye-C6MOB7Au.js.map} +1 -1
  239. package/ccw/frontend/dist/assets/{eye-off-Cy2vkc8p.js → eye-off-BxfBlZ26.js} +2 -2
  240. package/ccw/frontend/dist/assets/{eye-off-Cy2vkc8p.js.map → eye-off-BxfBlZ26.js.map} +1 -1
  241. package/ccw/frontend/dist/assets/{file-json-Bzq3U1Mx.js → file-json-NI237wA-.js} +2 -2
  242. package/ccw/frontend/dist/assets/{file-json-Bzq3U1Mx.js.map → file-json-NI237wA-.js.map} +1 -1
  243. package/ccw/frontend/dist/assets/{file-text-DwuwPDPi.js → file-text-Byn2_2v6.js} +2 -2
  244. package/ccw/frontend/dist/assets/{file-text-DwuwPDPi.js.map → file-text-Byn2_2v6.js.map} +1 -1
  245. package/ccw/frontend/dist/assets/{filter-q9g-bknU.js → filter-D-7PhZjx.js} +2 -2
  246. package/ccw/frontend/dist/assets/{filter-q9g-bknU.js.map → filter-D-7PhZjx.js.map} +1 -1
  247. package/ccw/frontend/dist/assets/{folder-CL6vb42J.js → folder-BoAsK_FL.js} +2 -2
  248. package/ccw/frontend/dist/assets/{folder-CL6vb42J.js.map → folder-BoAsK_FL.js.map} +1 -1
  249. package/ccw/frontend/dist/assets/{gauge-BkrcQBly.js → gauge-DCSxJIS4.js} +2 -2
  250. package/ccw/frontend/dist/assets/{gauge-BkrcQBly.js.map → gauge-DCSxJIS4.js.map} +1 -1
  251. package/ccw/frontend/dist/assets/{globe-BQbwyNeV.js → globe-CHS3prza.js} +2 -2
  252. package/ccw/frontend/dist/assets/{globe-BQbwyNeV.js.map → globe-CHS3prza.js.map} +1 -1
  253. package/ccw/frontend/dist/assets/{grid-3x3-x5_7DrN7.js → grid-3x3-D7K35U7S.js} +2 -2
  254. package/ccw/frontend/dist/assets/{grid-3x3-x5_7DrN7.js.map → grid-3x3-D7K35U7S.js.map} +1 -1
  255. package/ccw/frontend/dist/assets/{hard-drive-DTyWXwzf.js → hard-drive-eq9xE07G.js} +2 -2
  256. package/ccw/frontend/dist/assets/{hard-drive-DTyWXwzf.js.map → hard-drive-eq9xE07G.js.map} +1 -1
  257. package/ccw/frontend/dist/assets/{hash-80O0kJO7.js → hash-C1DMpBua.js} +2 -2
  258. package/ccw/frontend/dist/assets/{hash-80O0kJO7.js.map → hash-C1DMpBua.js.map} +1 -1
  259. package/ccw/frontend/dist/assets/{history-DDlN2Bwa.js → history-Di5SBCY-.js} +2 -2
  260. package/ccw/frontend/dist/assets/{history-DDlN2Bwa.js.map → history-Di5SBCY-.js.map} +1 -1
  261. package/ccw/frontend/dist/assets/{index-mbeo62f8.js → index--_R7COnA.js} +2 -2
  262. package/ccw/frontend/dist/assets/{index-mbeo62f8.js.map → index--_R7COnA.js.map} +1 -1
  263. package/ccw/frontend/dist/assets/{index-rLgoBCfV.js → index-BUol9HDD.js} +3 -3
  264. package/ccw/frontend/dist/assets/{index-rLgoBCfV.js.map → index-BUol9HDD.js.map} +1 -1
  265. package/ccw/frontend/dist/assets/{index-Bs80iCX0.js → index-CT9oykfw.js} +2 -2
  266. package/ccw/frontend/dist/assets/{index-Bs80iCX0.js.map → index-CT9oykfw.js.map} +1 -1
  267. package/ccw/frontend/dist/assets/{index-B9A3Hnrk.js → index-Ddwvf87H.js} +2 -2
  268. package/ccw/frontend/dist/assets/{index-B9A3Hnrk.js.map → index-Ddwvf87H.js.map} +1 -1
  269. package/ccw/frontend/dist/assets/{layout-grid-C1niOWJx.js → layout-grid-LiX0qZbN.js} +2 -2
  270. package/ccw/frontend/dist/assets/{layout-grid-C1niOWJx.js.map → layout-grid-LiX0qZbN.js.map} +1 -1
  271. package/ccw/frontend/dist/assets/{lightbulb-BTmI7SUg.js → lightbulb-CL3DVEwb.js} +2 -2
  272. package/ccw/frontend/dist/assets/{lightbulb-BTmI7SUg.js.map → lightbulb-CL3DVEwb.js.map} +1 -1
  273. package/ccw/frontend/dist/assets/{link-2-CB9HKeuZ.js → link-2-CC5cFeq6.js} +2 -2
  274. package/ccw/frontend/dist/assets/{link-2-CB9HKeuZ.js.map → link-2-CC5cFeq6.js.map} +1 -1
  275. package/ccw/frontend/dist/assets/{link-koEYiemK.js → link-ngFQ9bs0.js} +2 -2
  276. package/ccw/frontend/dist/assets/{link-koEYiemK.js.map → link-ngFQ9bs0.js.map} +1 -1
  277. package/ccw/frontend/dist/assets/{list-v2_GaLdC.js → list-BEU6I0KK.js} +2 -2
  278. package/ccw/frontend/dist/assets/{list-v2_GaLdC.js.map → list-BEU6I0KK.js.map} +1 -1
  279. package/ccw/frontend/dist/assets/{map-pin-BQNfAqG_.js → map-pin-BWZdLA6y.js} +2 -2
  280. package/ccw/frontend/dist/assets/{map-pin-BQNfAqG_.js.map → map-pin-BWZdLA6y.js.map} +1 -1
  281. package/ccw/frontend/dist/assets/{messages-square-Dzq5LGg9.js → messages-square-K6_Chm7n.js} +2 -2
  282. package/ccw/frontend/dist/assets/{messages-square-Dzq5LGg9.js.map → messages-square-K6_Chm7n.js.map} +1 -1
  283. package/ccw/frontend/dist/assets/{minimize-2-CtkoJXcz.js → minimize-2-CWkphauf.js} +2 -2
  284. package/ccw/frontend/dist/assets/{minimize-2-CtkoJXcz.js.map → minimize-2-CWkphauf.js.map} +1 -1
  285. package/ccw/frontend/dist/assets/{package-CH3smL37.js → package-DrNgkamn.js} +2 -2
  286. package/ccw/frontend/dist/assets/{package-CH3smL37.js.map → package-DrNgkamn.js.map} +1 -1
  287. package/ccw/frontend/dist/assets/{plug-CZ0aL_yF.js → plug-CMo3sw5_.js} +2 -2
  288. package/ccw/frontend/dist/assets/{plug-CZ0aL_yF.js.map → plug-CMo3sw5_.js.map} +1 -1
  289. package/ccw/frontend/dist/assets/{power-F2A_J4l6.js → power-DppNTW5e.js} +2 -2
  290. package/ccw/frontend/dist/assets/{power-F2A_J4l6.js.map → power-DppNTW5e.js.map} +1 -1
  291. package/ccw/frontend/dist/assets/{save-Byxot0YU.js → save-CD8aPMbZ.js} +2 -2
  292. package/ccw/frontend/dist/assets/{save-Byxot0YU.js.map → save-CD8aPMbZ.js.map} +1 -1
  293. package/ccw/frontend/dist/assets/{send-JjqhUkpw.js → send-B4z90fQD.js} +2 -2
  294. package/ccw/frontend/dist/assets/{send-JjqhUkpw.js.map → send-B4z90fQD.js.map} +1 -1
  295. package/ccw/frontend/dist/assets/{settings-2--SuN9rAt.js → settings-2-CAKRU_QC.js} +2 -2
  296. package/ccw/frontend/dist/assets/{settings-2--SuN9rAt.js.map → settings-2-CAKRU_QC.js.map} +1 -1
  297. package/ccw/frontend/dist/assets/{square-check-big-BbngGB2h.js → square-check-big-KhI3HrzX.js} +2 -2
  298. package/ccw/frontend/dist/assets/{square-check-big-BbngGB2h.js.map → square-check-big-KhI3HrzX.js.map} +1 -1
  299. package/ccw/frontend/dist/assets/{square-pen-CgrHgZSl.js → square-pen-BtdGIpuq.js} +2 -2
  300. package/ccw/frontend/dist/assets/{square-pen-CgrHgZSl.js.map → square-pen-BtdGIpuq.js.map} +1 -1
  301. package/ccw/frontend/dist/assets/{star-BU3TQr7Z.js → star-ZoBUkXoD.js} +2 -2
  302. package/ccw/frontend/dist/assets/{star-BU3TQr7Z.js.map → star-ZoBUkXoD.js.map} +1 -1
  303. package/ccw/frontend/dist/assets/{style-CKs7nnn3.js → style-CltxQP-P.js} +2 -2
  304. package/ccw/frontend/dist/assets/{style-CKs7nnn3.js.map → style-CltxQP-P.js.map} +1 -1
  305. package/ccw/frontend/dist/assets/{target-DW5tsDW6.js → target-C32OUSGf.js} +2 -2
  306. package/ccw/frontend/dist/assets/{target-DW5tsDW6.js.map → target-C32OUSGf.js.map} +1 -1
  307. package/ccw/frontend/dist/assets/{test-tube-BHm7w3ON.js → test-tube-0IxoyAVZ.js} +2 -2
  308. package/ccw/frontend/dist/assets/{test-tube-BHm7w3ON.js.map → test-tube-0IxoyAVZ.js.map} +1 -1
  309. package/ccw/frontend/dist/assets/{upload-DYR7PWwt.js → upload-4eKCkyBn.js} +2 -2
  310. package/ccw/frontend/dist/assets/{upload-DYR7PWwt.js.map → upload-4eKCkyBn.js.map} +1 -1
  311. package/ccw/frontend/dist/assets/{useApiSettings-D0TVgQD_.js → useApiSettings-zLTUWqhi.js} +2 -2
  312. package/ccw/frontend/dist/assets/{useApiSettings-D0TVgQD_.js.map → useApiSettings-zLTUWqhi.js.map} +1 -1
  313. package/ccw/frontend/dist/assets/{useCli-DfY8mAP8.js → useCli-BtN2vpOX.js} +2 -2
  314. package/ccw/frontend/dist/assets/{useCli-DfY8mAP8.js.map → useCli-BtN2vpOX.js.map} +1 -1
  315. package/ccw/frontend/dist/assets/{useCommands-CGusDp0F.js → useCommands-_spj49qL.js} +2 -2
  316. package/ccw/frontend/dist/assets/{useCommands-CGusDp0F.js.map → useCommands-_spj49qL.js.map} +1 -1
  317. package/ccw/frontend/dist/assets/{useDebounce-CIwh0fF1.js → useDebounce-Bm9KFZvd.js} +2 -2
  318. package/ccw/frontend/dist/assets/{useDebounce-CIwh0fF1.js.map → useDebounce-Bm9KFZvd.js.map} +1 -1
  319. package/ccw/frontend/dist/assets/{useFileExplorer-FMyFv39K.js → useFileExplorer-DOmpm6v9.js} +2 -2
  320. package/ccw/frontend/dist/assets/{useFileExplorer-FMyFv39K.js.map → useFileExplorer-DOmpm6v9.js.map} +1 -1
  321. package/ccw/frontend/dist/assets/{useLocale-B2qhsoTb.js → useLocale-D2rj4rea.js} +2 -2
  322. package/ccw/frontend/dist/assets/{useLocale-B2qhsoTb.js.map → useLocale-D2rj4rea.js.map} +1 -1
  323. package/ccw/frontend/dist/assets/{useSkills-cxKXMBm3.js → useSkills-OskEpomF.js} +3 -3
  324. package/ccw/frontend/dist/assets/{useSkills-cxKXMBm3.js.map → useSkills-OskEpomF.js.map} +1 -1
  325. package/ccw/frontend/dist/assets/{useSystemSettings-B-xUT_z-.js → useSystemSettings-BjMgsNSF.js} +2 -2
  326. package/ccw/frontend/dist/assets/{useSystemSettings-B-xUT_z-.js.map → useSystemSettings-BjMgsNSF.js.map} +1 -1
  327. package/ccw/frontend/dist/assets/{wand-sparkles-DZV_3lPr.js → wand-sparkles-CLhyYWa7.js} +2 -2
  328. package/ccw/frontend/dist/assets/{wand-sparkles-DZV_3lPr.js.map → wand-sparkles-CLhyYWa7.js.map} +1 -1
  329. package/ccw/frontend/dist/index.html +1 -1
  330. package/ccw/scripts/prepublish-clean.mjs +0 -1
  331. package/package.json +1 -3
  332. package/ccw/frontend/dist/assets/SettingsPage-B2PYzSoO.js +0 -150
  333. package/ccw/frontend/dist/assets/SettingsPage-B2PYzSoO.js.map +0 -1
  334. package/ccw/frontend/dist/assets/SkillsManagerPage-CTnWrrwp.js +0 -7
  335. package/ccw/frontend/dist/assets/SkillsManagerPage-CTnWrrwp.js.map +0 -1
  336. package/ccw-litellm/README.md +0 -180
  337. package/ccw-litellm/pyproject.toml +0 -35
  338. package/ccw-litellm/src/ccw_litellm/__init__.py +0 -47
  339. package/ccw-litellm/src/ccw_litellm/cli.py +0 -108
  340. package/ccw-litellm/src/ccw_litellm/clients/__init__.py +0 -12
  341. package/ccw-litellm/src/ccw_litellm/clients/litellm_embedder.py +0 -270
  342. package/ccw-litellm/src/ccw_litellm/clients/litellm_llm.py +0 -198
  343. package/ccw-litellm/src/ccw_litellm/config/__init__.py +0 -22
  344. package/ccw-litellm/src/ccw_litellm/config/loader.py +0 -343
  345. package/ccw-litellm/src/ccw_litellm/config/models.py +0 -162
  346. package/ccw-litellm/src/ccw_litellm/interfaces/__init__.py +0 -14
  347. package/ccw-litellm/src/ccw_litellm/interfaces/embedder.py +0 -52
  348. package/ccw-litellm/src/ccw_litellm/interfaces/llm.py +0 -45
@@ -1,4 +1,4 @@
1
- import{O as Fe,r as a,j as e,u as G,cI as _e,cJ as Is,x as As,y as Es,z as Fs,A as Os,E as Rs,bu as de,I as We,e as B,R as us,aq as Pe,ar as Te,as as Ie,at as Ae,au as me,ap as ms,c as k,ew as Ls,ex as Ye,aU as Ee,G as _s,bc as xs,bm as qs,ey as ne,ez as ye,eA as ie,eB as zs,eC as z,eD as qe,eE as L,a9 as Ce,aa as Se,eF as Oe,eG as se,a_ as ve,N as W,a7 as Qs,m as fe,L as ze,av as $s,cn as Hs,ef as ge,B as re,eH as Bs,b2 as pe,eI as Gs,eh as Us,ei as Vs,eJ as Ks,eK as Ws,eL as ke,eM as Ys,eN as hs,J as Js,cN as Xs,b7 as we,be as Me,eO as Zs,aw as fs,X as ps,aP as le,eP as et,eQ as Ne,eR as st,ao as tt,ak as at,eS as nt,bi as rt,bq as Je,eT as gs,K as bs,M as it,et as lt,Z as ot,aN as ct,l as js,bh as vs,eU as dt,eV as Ns,eW as ws,eX as ys,eY as ut,eZ as mt,bp as Cs,e_ as xt,e$ as ht,f0 as ft,f1 as pt,ad as Xe,k as gt,dv as Ze,o as es,s as bt,f2 as jt}from"./index-rLgoBCfV.js";import{C as vt,R as Nt,S as wt,a as yt,V as he}from"./style-CKs7nnn3.js";import{s as Ct}from"./useApiSettings-D0TVgQD_.js";import{F as St}from"./folder-CL6vb42J.js";import{G as kt}from"./gauge-BkrcQBly.js";import{L as Mt}from"./layout-grid-C1niOWJx.js";import{M as Dt,a as Pt}from"./minimize-2-CtkoJXcz.js";import{a as Tt,F as It,u as At,T as Et}from"./useFileExplorer-FMyFv39K.js";import{A as Qe,a as $e,b as He,c as Be,d as Ge,e as Ue,f as Ve,g as Ke}from"./AlertDialog-BjP1ydDR.js";import{F as Ss}from"./file-text-DwuwPDPi.js";import{F as je}from"./FloatingPanel-BzZDciHZ.js";import{S as Ft}from"./send-JjqhUkpw.js";import{C as Ot}from"./circle-stop-CCxSuil1.js";import{A as ss}from"./arrow-right-B5PUcn8I.js";import{B as ks}from"./bot-DOwFtzak.js";import{E as Rt}from"./eye-off-Cy2vkc8p.js";import{E as Lt}from"./eye-D3NY0bm6.js";import"./useLocale-B2qhsoTb.js";import"./errorSanitizer-IY9pf5g4.js";/**
1
+ import{O as Fe,r as a,j as e,u as G,cJ as _e,cK as Is,x as As,y as Es,z as Fs,A as Os,E as Rs,bu as de,I as We,e as B,R as us,aq as Pe,ar as Te,as as Ie,at as Ae,au as me,ap as ms,c as k,ex as Ls,ey as Ye,aU as Ee,G as _s,bc as xs,bm as qs,ez as ne,eA as ye,eB as ie,eC as zs,eD as z,eE as qe,eF as L,a9 as Ce,aa as Se,eG as Oe,eH as se,a_ as ve,N as W,a7 as Qs,m as fe,L as ze,av as $s,co as Hs,eg as pe,B as re,eI as Bs,b2 as ge,eJ as Gs,ei as Us,ej as Vs,eK as Ks,eL as Ws,eM as ke,eN as Ys,eO as hs,J as Js,cO as Xs,b7 as we,be as Me,eP as Zs,aw as fs,X as gs,aP as le,eQ as et,eR as Ne,eS as st,ao as tt,ak as at,eT as nt,bi as rt,bq as Je,eU as ps,K as bs,M as it,eu as lt,Z as ot,aN as ct,l as js,bh as vs,eV as dt,eW as Ns,eX as ws,eY as ys,eZ as ut,e_ as mt,bp as Cs,e$ as xt,f0 as ht,f1 as ft,f2 as gt,ad as Xe,k as pt,dw as Ze,o as es,s as bt,f3 as jt}from"./index-BUol9HDD.js";import{C as vt,R as Nt,S as wt,a as yt,V as he}from"./style-CltxQP-P.js";import{s as Ct}from"./useApiSettings-zLTUWqhi.js";import{F as St}from"./folder-BoAsK_FL.js";import{G as kt}from"./gauge-DCSxJIS4.js";import{L as Mt}from"./layout-grid-LiX0qZbN.js";import{M as Dt,a as Pt}from"./minimize-2-CWkphauf.js";import{a as Tt,F as It,u as At,T as Et}from"./useFileExplorer-DOmpm6v9.js";import{A as Qe,a as $e,b as He,c as Be,d as Ge,e as Ue,f as Ve,g as Ke}from"./AlertDialog-exlTDW81.js";import{F as Ss}from"./file-text-Byn2_2v6.js";import{F as je}from"./FloatingPanel-BtqzqDVq.js";import{S as Ft}from"./send-B4z90fQD.js";import{C as Ot}from"./circle-stop-CGNNsjvE.js";import{A as ss}from"./arrow-right-CUU5XDgT.js";import{B as ks}from"./bot-BwpSRDUa.js";import{E as Rt}from"./eye-off-BxfBlZ26.js";import{E as Lt}from"./eye-C6MOB7Au.js";import"./useLocale-D2rj4rea.js";import"./errorSanitizer-IY9pf5g4.js";/**
2
2
  * @license lucide-react v0.460.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,5 +18,5 @@ import{O as Fe,r as a,j as e,u as G,cI as _e,cJ as Is,x as As,y as Es,z as Fs,A
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const ts=Fe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Ms=a.createContext(null);function Qt({children:s,scopeKey:t}){const[o,i]=a.useState(null),n=a.useRef(t);a.useEffect(()=>{n.current!==t&&(n.current=t,i(null))},[t]);const r=a.useCallback(c=>{i(c)},[]),l=a.useCallback((c,u)=>{if(!o)return!1;switch(u){case"issue":return o.issueId===c;case"queue":return o.queueItemId===c;case"session":return o.sessionId===c;default:return!1}},[o]),x=a.useMemo(()=>({chain:o,setChain:r,isHighlighted:l}),[o,r,l]);return e.jsx(Ms.Provider,{value:x,children:s})}function $t(){const s=a.useContext(Ms);if(!s)throw new Error("useAssociationHighlight must be used within an AssociationHighlightProvider");return s}function as(s){const o=new Date().toTimeString().slice(0,8).replace(/:/g,"");return`${s}-${o}`}function Ht({isOpen:s,onClose:t,defaultWorkingDir:o,onCreateSession:i}){const{formatMessage:n}=G(),r=_e(Is),l=a.useMemo(()=>Object.entries(r).filter(([,d])=>d.enabled).map(([d])=>d),[r]),[x,c]=a.useState("gemini"),[u,g]=a.useState(void 0),[m,f]=a.useState("yolo"),[v,T]=a.useState(typeof navigator<"u"&&navigator.platform.toLowerCase().includes("win")?"cmd":"bash"),[h,C]=a.useState(o??""),[N,M]=a.useState(""),[j,y]=a.useState(!1),[P,U]=a.useState(null),[_,b]=a.useState(""),[w,I]=a.useState(!1),q=a.useRef(null),O=a.useRef(null),{cliSettings:V}=Ct({enabled:!0}),te={claude:"claude",codex:"codex",gemini:"gemini"}[x]||x,J=a.useMemo(()=>(V||[]).filter(d=>d.enabled&&(d.provider||"claude")===te),[V,te]),[H,S]=a.useState(void 0);a.useEffect(()=>{S(void 0)},[x]);const Q=a.useMemo(()=>{var K,Y;if(H){const p=J.find(R=>R.id===H);if((K=p==null?void 0:p.settings.availableModels)!=null&&K.length)return p.settings.availableModels}const d=r[x];if(!d)return[];if((Y=d.availableModels)!=null&&Y.length)return d.availableModels;const A=[];return d.primaryModel&&A.push(d.primaryModel),d.secondaryModel&&d.secondaryModel!==d.primaryModel&&A.push(d.secondaryModel),A},[r,x,H,J]),E=a.useCallback(()=>{M(as(x))},[x]);a.useEffect(()=>{if(!s)return;C(o??""),U(null),S(void 0),E()},[s,o,E]),a.useEffect(()=>{if(N){const d=N.split("-").pop()||"";M(`${x}-${d}`)}},[x]),a.useEffect(()=>{b(u??"")},[u]);const F=a.useMemo(()=>{const d=_.toLowerCase();return d?Q.filter(A=>A.toLowerCase().includes(d)):Q},[Q,_]);a.useEffect(()=>{function d(A){q.current&&!q.current.contains(A.target)&&I(!1)}if(w)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[w]);const oe=d=>{var Y;c(d);const A=r[d],K=(Y=A==null?void 0:A.availableModels)!=null&&Y.length?A.availableModels:[A==null?void 0:A.primaryModel,A==null?void 0:A.secondaryModel].filter(Boolean);(!u||!K.includes(u))&&g(K[0])},ae=()=>{console.log("[CliConfigModal] browse working directory - not implemented")},be=async()=>{const d=h.trim();if(!d){U(n({id:"terminalDashboard.cliConfig.errors.workingDirRequired"}));return}const A=N.trim()||as(x);y(!0),U(null);try{await i({tool:x,model:u,launchMode:m,preferredShell:v,workingDir:d,tag:A,settingsEndpointId:H}),t()}catch(K){console.error("[CliConfigModal] create session failed:",K),U(n({id:"terminalDashboard.cliConfig.errors.createFailed"}))}finally{y(!1)}};return e.jsx(As,{open:s,onOpenChange:d=>!d&&t(),children:e.jsxs(Es,{className:"sm:max-w-[720px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(Fs,{children:[e.jsx(Os,{children:n({id:"terminalDashboard.cliConfig.title"})}),e.jsx(Rs,{children:n({id:"terminalDashboard.cliConfig.description"})})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-tag",children:n({id:"terminalDashboard.cliConfig.tag",defaultMessage:"Session Name"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(We,{id:"cli-config-tag",value:N,onChange:d=>M(d.target.value),placeholder:n({id:"terminalDashboard.cliConfig.tagPlaceholder",defaultMessage:"e.g., gemini-143052"}),disabled:j,className:"flex-1"}),e.jsx(B,{type:"button",variant:"outline",onClick:E,disabled:j,title:n({id:"terminalDashboard.cliConfig.regenerateTag",defaultMessage:"Regenerate name"}),children:e.jsx(us,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n({id:"terminalDashboard.cliConfig.tagHint",defaultMessage:"Auto-generated as {tool}-{time}. Used for grouping sessions."})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-tool",children:n({id:"terminalDashboard.cliConfig.tool"})}),e.jsxs(Pe,{value:x,onValueChange:oe,disabled:j,children:[e.jsx(Te,{id:"cli-config-tool",children:e.jsx(Ie,{})}),e.jsx(Ae,{children:l.map(d=>e.jsx(me,{value:d,children:d},d))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-model",children:n({id:"terminalDashboard.cliConfig.model"})}),e.jsxs("div",{ref:q,className:"relative",children:[e.jsxs("div",{className:"flex",children:[e.jsx("input",{ref:O,id:"cli-config-model",value:_,onChange:d=>{const A=d.target.value;b(A),g(A||void 0),w||I(!0)},onFocus:()=>I(!0),onKeyDown:d=>{d.key==="Escape"&&I(!1),d.key==="Enter"&&I(!1)},placeholder:n({id:"terminalDashboard.cliConfig.modelAuto",defaultMessage:"Auto"}),disabled:j,className:"flex h-10 w-full rounded-l-md border border-r-0 border-input bg-background px-3 py-2 text-sm font-mono ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>{var d;I(!w),w||(d=O.current)==null||d.focus()},disabled:j,className:"flex items-center justify-center h-10 w-9 shrink-0 rounded-r-md border border-input bg-background hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:e.jsx(ms,{className:"h-4 w-4 opacity-50"})})]}),w&&e.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-card shadow-md max-h-48 overflow-y-auto",children:[e.jsx("button",{type:"button",onClick:()=>{g(void 0),b(""),I(!1)},className:k("flex w-full items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground",!u&&"bg-accent/50"),children:n({id:"terminalDashboard.cliConfig.modelAuto",defaultMessage:"Auto"})}),F.map(d=>e.jsx("button",{type:"button",onClick:()=>{g(d),b(d),I(!1)},className:k("flex w-full items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground font-mono",u===d&&"bg-accent/50"),children:d},d))]})]})]})]}),J.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-profile",children:n({id:"terminalDashboard.cliConfig.configProfile",defaultMessage:"Config Profile"})}),e.jsxs(Pe,{value:H??"__default__",onValueChange:d=>{var K;const A=d==="__default__"?void 0:d;if(S(A),A){const Y=J.find(p=>p.id===A);(K=Y==null?void 0:Y.settings.availableModels)!=null&&K.length&&g(Y.settings.availableModels[0])}},disabled:j,children:[e.jsx(Te,{id:"cli-config-profile",children:e.jsx(Ie,{})}),e.jsxs(Ae,{children:[e.jsx(me,{value:"__default__",children:n({id:"terminalDashboard.cliConfig.defaultProfile",defaultMessage:"Default"})}),J.map(d=>e.jsx(me,{value:d.id,children:d.name},d.id))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n({id:"terminalDashboard.cliConfig.configProfileHint",defaultMessage:"Select a CLI Settings profile for custom API configuration."})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{children:n({id:"terminalDashboard.cliConfig.mode"})}),e.jsxs(Ls,{value:m,onValueChange:d=>f(d),className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Ye,{value:"default"}),n({id:"terminalDashboard.cliConfig.modeDefault"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Ye,{value:"yolo"}),n({id:"terminalDashboard.cliConfig.modeYolo"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-shell",children:n({id:"terminalDashboard.cliConfig.shell"})}),e.jsxs(Pe,{value:v,onValueChange:d=>T(d),disabled:j,children:[e.jsx(Te,{id:"cli-config-shell",children:e.jsx(Ie,{})}),e.jsxs(Ae,{children:[e.jsx(me,{value:"cmd",children:"cmd (推荐 Windows)"}),e.jsx(me,{value:"bash",children:"bash (Git Bash/WSL)"}),e.jsx(me,{value:"pwsh",children:"pwsh (PowerShell)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-workingDir",children:n({id:"terminalDashboard.cliConfig.workingDir"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(We,{id:"cli-config-workingDir",value:h,onChange:d=>{C(d.target.value),P&&U(null)},placeholder:n({id:"terminalDashboard.cliConfig.workingDirPlaceholder"}),disabled:j,className:k(P&&"border-destructive")}),e.jsx(B,{type:"button",variant:"outline",onClick:ae,disabled:j,title:n({id:"terminalDashboard.cliConfig.browse"}),children:e.jsx(Ee,{className:"w-4 h-4"})})]}),P&&e.jsx("p",{className:"text-xs text-destructive",children:P})]})]}),e.jsxs(_s,{children:[e.jsx(B,{variant:"outline",onClick:t,disabled:j,children:n({id:"common.actions.cancel"})}),e.jsx(B,{onClick:be,disabled:j,children:n({id:"common.actions.create"})})]})]})})}const Bt=[{id:"single",icon:ge,labelId:"terminalDashboard.toolbar.layoutSingle"},{id:"split-h",icon:vt,labelId:"terminalDashboard.toolbar.layoutSplitH"},{id:"split-v",icon:Nt,labelId:"terminalDashboard.toolbar.layoutSplitV"},{id:"grid-2x2",icon:Mt,labelId:"terminalDashboard.toolbar.layoutGrid"}];function Gt({activePanel:s,onTogglePanel:t,isFileSidebarOpen:o,onToggleFileSidebar:i,isSessionSidebarOpen:n,onToggleSessionSidebar:r,isFullscreen:l,onToggleFullscreen:x}){const{formatMessage:c}=G(),{openCount:u}=xs(),g=qs(),m=a.useMemo(()=>{if(!g.data)return 0;const S=g.data.grouped_items??{};let Q=0;for(const E of Object.values(S))Q+=E.length;return Q},[g.data]),v=ne(ye)!==null,T=ie(zs),C=z(qe)!=="idle",N=_e(S=>S.featureFlags),M=N.dashboardQueuePanelEnabled,j=N.dashboardInspectorEnabled,y=N.dashboardExecutionMonitorEnabled,P=L(S=>S.resetLayout),U=a.useCallback(S=>{P(S)},[P]),_=Ce(Se),b=L(Oe),w=L(S=>S.createSessionAndAssign),I=se(S=>S.updateTerminalMeta),[q,O]=a.useState(!1),[V,ee]=a.useState(!1);a.useEffect(()=>{O(!1),ee(!1)},[_]);const te=a.useCallback(()=>b||(P("single"),L.getState().focusedPaneId),[b]),J=a.useCallback(()=>{ee(!0)},[]),H=a.useCallback(async S=>{var Q;if(!_)throw new Error("No project path");O(!0);try{const E=te();if(!E)throw new Error("Failed to create pane");const F=await w(E,{workingDir:S.workingDir||_,preferredShell:S.preferredShell,tool:S.tool,model:S.model,launchMode:S.launchMode,settingsEndpointId:S.settingsEndpointId},_);(Q=F==null?void 0:F.session)!=null&&Q.sessionKey&&I(F.session.sessionKey,{tag:S.tag,title:S.tag})}catch(E){const F=E instanceof Error||E!=null&&E.message?E.message:String(E);throw ve.error(`CLI 会话创建失败 (${S.tool})`,F),E}finally{O(!1)}},[_,w,te,I]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 h-[40px] border-b border-border bg-muted/30 shrink-0",children:[e.jsxs("button",{onClick:J,className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors","text-muted-foreground hover:text-foreground hover:bg-muted",q&&"opacity-50 cursor-wait"),disabled:q||!_,title:c({id:"terminalDashboard.toolbar.launchCliHint",defaultMessage:"Click to configure and launch a CLI session"}),children:[q?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Qs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:c({id:"terminalDashboard.toolbar.launchCli"})})]}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx(ue,{icon:St,label:c({id:"terminalDashboard.toolbar.sessions",defaultMessage:"Sessions"}),isActive:n??!0,onClick:()=>r==null?void 0:r()}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx(ue,{icon:fe,label:c({id:"terminalDashboard.toolbar.issues"}),isActive:s==="issues",onClick:()=>t("issues"),badge:u>0?u:void 0}),M&&e.jsx(ue,{icon:ze,label:c({id:"terminalDashboard.toolbar.queue"}),isActive:s==="queue",onClick:()=>t("queue"),badge:m>0?m:void 0}),j&&e.jsx(ue,{icon:$s,label:c({id:"terminalDashboard.toolbar.inspector"}),isActive:s==="inspector",onClick:()=>t("inspector"),dot:v}),y&&e.jsx(ue,{icon:Hs,label:c({id:"terminalDashboard.toolbar.executionMonitor",defaultMessage:"Execution Monitor"}),isActive:s==="execution",onClick:()=>t("execution"),badge:T>0?T:void 0}),e.jsx(ue,{icon:kt,label:c({id:"terminalDashboard.toolbar.scheduler",defaultMessage:"Scheduler"}),isActive:s==="scheduler",onClick:()=>t("scheduler"),dot:C,loading:C}),e.jsx(ue,{icon:Ee,label:c({id:"terminalDashboard.toolbar.files",defaultMessage:"Files"}),isActive:o??!1,onClick:()=>i==null?void 0:i()}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),Bt.map(S=>e.jsx("button",{onClick:()=>U(S.id),className:k("p-1.5 rounded transition-colors","text-muted-foreground hover:text-foreground hover:bg-muted"),title:c({id:S.labelId}),children:e.jsx(S.icon,{className:"w-3.5 h-3.5"})},S.id)),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx("button",{onClick:x,className:k("p-1.5 rounded transition-colors",l?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:c(l?{id:"terminalDashboard.toolbar.exitFullscreen",defaultMessage:"Exit Fullscreen"}:{id:"terminalDashboard.toolbar.fullscreen",defaultMessage:"Fullscreen"}),children:l?e.jsx(Dt,{className:"w-3.5 h-3.5"}):e.jsx(Pt,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground font-medium",children:c({id:"terminalDashboard.page.title"})})]}),e.jsx(Ht,{isOpen:V,onClose:()=>ee(!1),defaultWorkingDir:_,onCreateSession:H})]})}function ue({icon:s,label:t,isActive:o,onClick:i,badge:n,dot:r,loading:l}){return e.jsxs("button",{onClick:i,className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors",o?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[l?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:t}),n!==void 0&&n>0&&e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5",children:n}),r&&e.jsx("span",{className:k("ml-0.5 w-2 h-2 rounded-full bg-primary shrink-0",l&&"animate-pulse")})]})}const Ut=/[)\]}>,.;:!?]+$/g,Vt=/^['"`]+|['"`]+$/g;function Kt(s){return s.trim().replace(Vt,"").replace(Ut,"")}const ns={"workflow-session":[/(?:^|[^\w.])(\.workflow[\\/](?:active|archives)[\\/][^\s"'`]+[\\/]workflow-session\.json)\b/g],"lite-session":[/(?:^|[^\w.])(\.workflow[\\/]\.lite-plan[\\/][^\s"'`]+)\b/g],"claude-md":[/([^\s"'`]*CLAUDE\.md)\b/gi],"ccw-config":[/(?:^|[^\w.])(\.ccw[\\/][^\s"'`]+)\b/g,/(?:^|[^\w.])(ccw\.config\.(?:json|ya?ml|toml))\b/gi],issue:[/(?:^|[^\w.])(\.workflow[\\/]issues[\\/][^\s"'`]+)\b/g]};function Wt(s){if(!s)return[];const t=[];for(const n of Object.keys(ns))for(const r of ns[n]){r.lastIndex=0;let l;for(;(l=r.exec(s))!==null;){const x=l[1]??l[0],c=Kt(x);if(!c)continue;const u=l[0]??"",g=l[1]??x,m=u.indexOf(g),f=(l.index??0)+(m>=0?m:0);t.push({type:n,path:c,index:f})}}t.sort((n,r)=>n.index-r.index);const o=[],i=new Set;for(const n of t){const r=`${n.type}:${n.path}`;i.has(r)||(i.add(r),o.push({type:n.type,path:n.path}))}return o}function Yt(s){switch(s){case"workflow-session":return"info";case"lite-session":return"success";case"claude-md":return"review";case"ccw-config":return"warning";case"issue":return"destructive";default:return"secondary"}}function Jt(s){switch(s){case"workflow-session":return"terminalDashboard.artifacts.types.workflowSession";case"lite-session":return"terminalDashboard.artifacts.types.liteSession";case"claude-md":return"terminalDashboard.artifacts.types.claudeMd";case"ccw-config":return"terminalDashboard.artifacts.types.ccwConfig";case"issue":return"terminalDashboard.artifacts.types.issue"}}function Xt(s){const t=s.split(/[\\/]/g);return t[t.length-1]||s}function Zt({type:s,path:t,onClick:o,className:i}){const{formatMessage:n}=G(),r=n({id:Jt(s)}),l=Xt(t);return e.jsxs("button",{type:"button",className:k(Bs({variant:Yt(s)}),"gap-1 cursor-pointer hover:opacity-90 active:opacity-100","px-2 py-0.5 text-[11px] font-semibold",i),onClick:()=>o==null?void 0:o(t),title:t,children:[e.jsx("span",{children:r}),e.jsx("span",{className:"opacity-80 font-mono",children:l})]})}const ea=250,rs=12;function sa(s){return s?!!(s.startsWith("/")||s.startsWith("\\")||/^[A-Za-z]:[\\/]/.test(s)||s.startsWith("~")):!1}function ta(s,t){const o=s.includes("\\")?"\\":"/",i=s.replace(/[\\/]+$/,""),n=t.replace(/^[\\/]+/,"");return`${i}${o}${n}`}function aa(s,t){return!s||sa(s)||!t?s:ta(t,s)}function na(s,t){if(t.length===0)return s;const o=new Map;for(const r of s)o.set(`${r.type}:${r.path}`,r);let i=!1;for(const r of t){const l=`${r.type}:${r.path}`;o.has(l)||(o.set(l,r),i=!0)}if(!i)return s;const n=Array.from(o.values());return n.length>rs?n.slice(n.length-rs):n}function ra({sessionId:s,className:t,onRevealPath:o}){const i=Ce(Se),n=pe(b=>b.outputChunks),r=pe(b=>b.setBuffer),l=pe(b=>b.clearOutput),[x,c]=a.useState([]),u=a.useRef(null),g=a.useRef(null),m=a.useRef(null),f=a.useRef(0),v=a.useRef(""),T=a.useRef(null),h=a.useRef(""),C=a.useRef(null),N=a.useRef(s);N.current=s;const M=a.useRef(i);M.current=i;const j=a.useCallback(()=>{var b;(b=g.current)==null||b.focus()},[]),y=a.useCallback(b=>{const w=aa(b,M.current);navigator.clipboard.writeText(w).catch(I=>{console.error("[TerminalInstance] copy artifact path failed:",I)}),o==null||o(w)},[o]),P=a.useCallback(b=>{b&&(v.current+=b,T.current===null&&(T.current=window.setTimeout(()=>{T.current=null;const w=v.current;v.current="";const I=Wt(w);I.length!==0&&c(q=>na(q,I))},ea)))},[]);a.useEffect(()=>()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null)},[]);const U=a.useCallback(async()=>{const b=N.current;if(!b)return;const w=h.current;if(h.current="",!!w)try{await Gs(b,{text:w,appendNewline:!1},M.current||void 0)}catch{}},[]),_=a.useCallback(()=>{C.current===null&&(C.current=window.setTimeout(async()=>{C.current=null,await U()},30))},[U]);return a.useEffect(()=>{if(!u.current||g.current)return;const b=new Us.Terminal({convertEol:!0,cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:12,scrollback:5e3}),w=new Vs.FitAddon;return b.loadAddon(w),b.open(u.current),w.fit(),b.onData(I=>{N.current&&(h.current+=I,_())}),g.current=b,m.current=w,()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null);try{b.dispose()}finally{g.current=null,m.current=null}}},[]),a.useEffect(()=>{const b=g.current,w=m.current;!b||!w||(f.current=0,b.reset(),b.clear(),c([]),v.current="",T.current!==null&&(window.clearTimeout(T.current),T.current=null),s&&(l(s),Ks(s,i||void 0).then(({buffer:I})=>{r(s,I||"")}).catch(()=>{}).finally(()=>{w.fit()})))},[s,i,r,l]),a.useEffect(()=>{const b=g.current;if(!b||!s)return;const w=n[s]??[],I=f.current;if(I>=w.length)return;const{feedMonitor:q}=se.getState(),O=[];for(let V=I;V<w.length;V++)b.write(w[V].data),q(s,w[V].data),O.push(w[V].data);f.current=w.length,O.length>0&&P(O.join(""))},[n,s,P]),a.useEffect(()=>{const b=u.current,w=g.current,I=m.current;if(!b||!w||!I)return;const q=()=>{I.fit(),N.current&&(async()=>{try{await Ws(N.current,{cols:w.cols,rows:w.rows},M.current||void 0)}catch{}})()},O=new ResizeObserver(q);return O.observe(b),()=>O.disconnect()},[s,i]),e.jsxs("div",{className:k("relative h-full w-full",t),children:[x.length>0&&e.jsx("div",{className:"absolute top-2 left-2 right-2 z-10 flex flex-wrap gap-1 pointer-events-none",children:x.map(b=>e.jsx(Zt,{type:b.type,path:b.path,onClick:y,className:"pointer-events-auto"},`${b.type}:${b.path}`))}),e.jsx("div",{ref:u,className:"h-full w-full bg-black/90",onClick:j})]})}const ia={active:"bg-green-500",idle:"bg-gray-400",error:"bg-red-500",paused:"bg-yellow-500",resuming:"bg-blue-400 animate-pulse",locked:"bg-amber-500 animate-pulse"};function Ds({paneId:s}){const{formatMessage:t}=G(),o=L(ke),i=L(Oe),n=L(D=>D.layout),r=L(D=>D.splitPane),l=L(D=>D.closePane),x=L(D=>D.assignSession),c=L(D=>D.setFocused),u=L(D=>D.setPaneDisplayMode),g=o[s],m=(g==null?void 0:g.sessionId)??null,f=(g==null?void 0:g.displayMode)??"terminal",v=(g==null?void 0:g.filePath)??null,T=i===s,h=Ys(n).length>1,C=f==="file"&&v,N=se(hs),M=pe(D=>D.sessions),j=se(D=>D.pauseSession),y=se(D=>D.resumeSession),P=se(D=>D.restartSession),U=se(D=>D.closeSession),[_,b]=a.useState(!1),[w,I]=a.useState(!1),[q,O]=a.useState(!1),[V,ee]=a.useState(!1),{content:te,isLoading:J,error:H}=Tt(v,{enabled:f==="file"&&!!v}),S=ne(ye),Q=a.useMemo(()=>!m||!S?null:S.sessionId===m?S.issueId:null,[m,S]),E=m?N[m]:null,F=(E==null?void 0:E.status)??"idle",oe=(E==null?void 0:E.alertCount)??0,ae=m&&!M[m];a.useEffect(()=>{if(ae){const D=setTimeout(()=>{x(s,null)},3e3);return()=>clearTimeout(D)}},[ae,s,x]);const be=a.useMemo(()=>Object.keys(M).map(ce=>{const Z=M[ce],Ts=Z?Z.tool?`${Z.tool} - ${Z.shellKind}`:Z.shellKind:ce;return{id:ce,name:Ts}}),[M]),d=a.useCallback(()=>{c(s)},[s,c]),A=a.useCallback(()=>{r(s,"horizontal")},[s,r]),K=a.useCallback(()=>{r(s,"vertical")},[s,r]),Y=a.useCallback(()=>{m?ee(!0):l(s)},[s,m,l]),p=a.useCallback(()=>{l(s),ee(!1)},[s,l]),R=a.useCallback(D=>{const ce=D.target.value,Z=ce?M[ce]:null;x(s,ce||null,(Z==null?void 0:Z.cliTool)??(Z==null?void 0:Z.tool)??null)},[s,x,M]),$=a.useCallback(()=>{m&&(x(s,null),queueMicrotask(()=>x(s,m)))},[s,m,x]),X=a.useCallback(async()=>{if(!(!m||_)){b(!0);try{await P(m)}catch(D){console.error("[TerminalPane] Restart failed:",D)}finally{b(!1)}}},[m,_,P]),xe=a.useCallback(async()=>{if(!(!m||w)){I(!0);try{F==="paused"?await y(m):(F==="active"||F==="idle")&&await j(m)}catch(D){console.error("[TerminalPane] Toggle pause failed:",D)}finally{I(!1)}}},[m,w,F,j,y]),De=a.useCallback(async()=>{if(!(!m||q)){O(!0);try{await U(m),x(s,null)}catch(D){console.error("[TerminalPane] Close session failed:",D)}finally{O(!1)}}},[m,q,U,s,x]),Re=a.useCallback(()=>{u(s,"terminal")},[s,u]);return e.jsxs("div",{className:k("flex flex-col h-full border border-border/50 rounded-sm overflow-hidden",T&&"ring-1 ring-primary/40"),onClick:d,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 px-2 py-1 border-b border-border bg-muted/30 shrink-0 overflow-hidden",children:[e.jsx("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:C?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:Re,className:"p-0.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground shrink-0",title:t({id:"terminalDashboard.pane.backToTerminal",defaultMessage:"Back to terminal"}),children:e.jsx(Js,{className:"w-3.5 h-3.5"})}),e.jsx(Ss,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs truncate",title:v??void 0,children:(v==null?void 0:v.split("/").pop())??"File"})]}):e.jsxs(e.Fragment,{children:[ae?e.jsx(ts,{className:"w-3.5 h-3.5 text-yellow-500 shrink-0"}):m&&e.jsx("span",{className:k("w-2 h-2 rounded-full shrink-0",ia[F])}),e.jsxs("div",{className:"relative min-w-0 overflow-hidden",children:[e.jsxs("select",{value:m??"",onChange:R,className:k("text-xs bg-transparent border-none outline-none cursor-pointer","appearance-none pr-4 max-w-[140px] truncate",!m&&"text-muted-foreground"),children:[e.jsx("option",{value:"",children:t({id:"terminalDashboard.pane.selectSession"})}),be.map(D=>e.jsx("option",{value:D.id,children:D.name},D.id))]}),e.jsx(ms,{className:"absolute right-0 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"})]})]})}),Q&&!C&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-primary/10 text-primary shrink-0 hidden sm:inline-flex",children:Q}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx("button",{onClick:A,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.splitHorizontal"}),children:e.jsx(wt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:K,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.splitVertical"}),children:e.jsx(yt,{className:"w-3.5 h-3.5"})}),!C&&m&&!ae&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:X,disabled:_,className:k("p-1 rounded hover:bg-muted transition-colors",_?"text-muted-foreground/50":"text-muted-foreground hover:text-foreground"),title:t({id:"terminalDashboard.pane.restart"}),children:_?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Xs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:xe,disabled:w||F==="resuming",className:k("p-1 rounded hover:bg-muted transition-colors",w||F==="resuming"?"text-muted-foreground/50":F==="paused"?"text-yellow-500 hover:text-yellow-600":"text-muted-foreground hover:text-foreground"),title:t({id:F==="paused"?"terminalDashboard.pane.resume":"terminalDashboard.pane.pause"}),children:w||F==="resuming"?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):F==="paused"?e.jsx(we,{className:"w-3.5 h-3.5"}):e.jsx(Me,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:$,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.clearTerminal"}),children:e.jsx(qt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:De,disabled:q,className:k("p-1 rounded hover:bg-muted transition-colors",q?"text-muted-foreground/50":"text-muted-foreground hover:text-destructive"),title:t({id:"terminalDashboard.pane.closeSession"}),children:q?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Zs,{className:"w-3.5 h-3.5"})})]}),oe>0&&!C&&e.jsxs("span",{className:"flex items-center gap-0.5 px-1 text-destructive",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsx("span",{className:"text-[10px] font-semibold tabular-nums",children:oe>99?"99+":oe})]}),h&&e.jsx("button",{onClick:Y,className:"p-1 rounded hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive",title:t({id:"terminalDashboard.pane.closePane"}),children:e.jsx(ps,{className:"w-3.5 h-3.5"})})]})]}),C?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(It,{fileContent:te,isLoading:J,error:(H==null?void 0:H.message)??null,className:"h-full"})}):ae?e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center px-4",children:[e.jsx(ts,{className:"h-6 w-6 mx-auto mb-1.5 text-yellow-500"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:t({id:"terminalDashboard.pane.sessionNotFound"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70 max-w-[200px]",children:t({id:"terminalDashboard.pane.sessionNotFoundHint"})})]})}):m?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(ra,{sessionId:m})}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(le,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:t({id:"terminalDashboard.pane.selectSession"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:t({id:"terminalDashboard.pane.selectSessionHint"})})]})}),e.jsx(Qe,{open:V,onOpenChange:ee,children:e.jsxs($e,{children:[e.jsxs(He,{children:[e.jsx(Be,{children:t({id:"terminalDashboard.pane.closeConfirmTitle"})}),e.jsx(Ge,{children:t({id:"terminalDashboard.pane.closeConfirmMessage"})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{children:t({id:"common.actions.cancel"})}),e.jsx(Ke,{onClick:p,children:t({id:"terminalDashboard.pane.closeConfirmAction"})})]})]})})]})}function Ps({group:s,minSize:t,depth:o=0}){const i=L(ke),n=L(c=>c.updateLayoutSizes),r=a.useCallback(c=>{n(c)},[n]),l=a.useMemo(()=>s.children.filter(c=>Ne(c)?i[c]!==void 0:!0),[s.children,i]);if(l.length===0)return null;const x=a.useMemo(()=>l.map(c=>Ne(c)?c:"group").join("-"),[l]);return e.jsx(he,{vertical:s.direction==="vertical",defaultSizes:s.sizes,onChange:r,children:l.map((c,u)=>e.jsx(he.Pane,{minSize:t,children:Ne(c)?e.jsx(Ds,{paneId:c}):e.jsx(Ps,{group:c,minSize:t,depth:o+1})},Ne(c)?c:`group-${o}-${u}`))},x)}function la({className:s}){const t=L(et),o=L(ke),i=a.useMemo(()=>{if(!t.children||t.children.length===0)return null;if(t.children.length===1&&Ne(t.children[0])){const n=t.children[0];return o[n]?e.jsx(Ds,{paneId:n}):null}return e.jsx(Ps,{group:t,minSize:150,depth:0})},[t,o]);return e.jsx("div",{className:k("h-full w-full overflow-hidden bg-background",s),children:i})}const oa={active:"bg-green-500",idle:"bg-gray-400",error:"bg-red-500",paused:"bg-yellow-500",resuming:"bg-blue-400 animate-pulse",locked:"bg-purple-500"};function ca(){const{formatMessage:s}=G(),t=se(st),o=se(hs),i=se(h=>h.setActiveTerminal),n=pe(h=>h.sessions),r=L(ke),l=L(h=>h.assignSession),x=L(h=>h.setFocused),[c,u]=a.useState(new Set),g=Ce(Se);a.useEffect(()=>{u(new Set)},[g]);const m=a.useCallback(h=>{u(C=>{const N=new Set(C);return N.has(h)?N.delete(h):N.add(h),N})},[]),f=a.useCallback(h=>{i(h);const C=Object.entries(r).find(([,N])=>N.sessionId===h);if(C)x(C[0]);else{const M=L.getState().focusedPaneId||Object.keys(r)[0];if(M){const j=n[h];l(M,h,(j==null?void 0:j.cliTool)??(j==null?void 0:j.tool)??null),x(M)}}},[i,r,x,l]),v=a.useMemo(()=>{const h={},C=[];for(const M of Object.keys(n)){const j=o[M],y=j==null?void 0:j.tag;y?(h[y]||(h[y]={tag:y,sessionIds:[]}),h[y].sessionIds.push(M)):C.push(M)}const N=Object.values(h).sort((M,j)=>j.tag.localeCompare(M.tag));return C.length>0&&N.push({tag:"__untagged__",sessionIds:C}),N},[n,o]),T=a.useMemo(()=>{const h={};for(const[C,N]of Object.entries(n))h[C]=N.tool??N.shellKind;return h},[n]);return Object.keys(n).length===0?e.jsx("div",{className:"flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1.5 text-muted-foreground p-4",children:[e.jsx(le,{className:"w-6 h-6 opacity-30"}),e.jsx("p",{className:"text-xs text-center",children:s({id:"terminalDashboard.sessionTree.noGroups"})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:'Click "New Session" to create one'})]})}):e.jsx("div",{className:"flex flex-col h-full",children:e.jsx("div",{className:"flex-1 overflow-y-auto",children:v.map(h=>{const C=c.has(h.tag),M=h.tag==="__untagged__"?"Other Sessions":h.tag;return e.jsxs("div",{className:"border-b border-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>m(h.tag),className:k("flex items-center gap-1.5 w-full px-3 py-2 text-left","hover:bg-muted/50 transition-colors text-sm"),children:[e.jsx(tt,{className:k("w-3.5 h-3.5 text-muted-foreground transition-transform shrink-0",C&&"rotate-90")}),e.jsx(at,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"flex-1 truncate font-medium text-xs",children:M}),e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:h.sessionIds.length})]}),C&&e.jsx("div",{className:"pb-1",children:h.sessionIds.map(j=>{const y=o[j],P=(y==null?void 0:y.status)??"idle";return e.jsxs("div",{className:k("flex items-center gap-1.5 mx-1 px-2 py-1.5 rounded-sm cursor-pointer","hover:bg-muted/50 transition-colors text-sm",t===j&&"bg-primary/10 text-primary"),onClick:()=>f(j),children:[e.jsx("span",{className:k("w-2 h-2 rounded-full shrink-0",oa[P]),title:P}),e.jsx(le,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-xs",children:T[j]??j})]},j)})})]},h.tag)})})})}const is={"skill-team-issue":s=>`完成 ${s} issue`,"ccw-cli":s=>`完成.issue.jsonl中 ${s} issue`,"direct-send":s=>`根据@.workflow/issues/issues.jsonl中的 ${s} 需求,进行开发`};function da(s){return`根据@.workflow/issues/issues.jsonl中的 ${s.map(o=>o.id).join(" ")} 需求,进行开发`}const ls={critical:{variant:"destructive",label:"Critical"},high:{variant:"warning",label:"High"},medium:{variant:"info",label:"Medium"},low:{variant:"secondary",label:"Low"}};function ua({priority:s}){const t=ls[s]??ls.medium;return e.jsx(re,{variant:t.variant,className:"text-[10px] px-1.5 py-0 shrink-0",children:t.label})}function ma({status:s}){const t={registered:"text-info",planning:"text-blue-500",planned:"text-blue-600",queued:"text-yellow-500",executing:"text-warning",completed:"text-success",failed:"text-destructive",paused:"text-muted-foreground"};return e.jsx(_t,{className:k("w-3 h-3 shrink-0",t[s]??"text-muted-foreground")})}function xa({issue:s,isSelected:t,isHighlighted:o,isChecked:i,onSelect:n,onToggleCheck:r}){return e.jsxs("div",{role:"button",tabIndex:0,className:k("w-full text-left px-2.5 py-1.5 rounded-md transition-colors","hover:bg-muted/60 focus:outline-none focus:ring-1 focus:ring-primary/30",t&&"bg-primary/10 ring-1 ring-primary/30",o&&!t&&"bg-accent/50"),onClick:n,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),n())},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:l=>{l.stopPropagation(),r()},onClick:l=>l.stopPropagation(),className:"w-3.5 h-3.5 rounded border-border accent-primary shrink-0"}),e.jsx(ma,{status:s.status}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.title})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsx(ua,{priority:s.priority})})]}),s.context&&e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground truncate pl-7",children:s.context}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground pl-7",children:[e.jsx("span",{className:"font-mono",children:s.id}),s.labels&&s.labels.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"|"}),e.jsx("span",{className:"truncate",children:s.labels.slice(0,2).join(", ")})]})]})]})}function ha(){const{formatMessage:s}=G();return e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(fe,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:s({id:"terminalDashboard.issuePanel.noIssues"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s({id:"terminalDashboard.issuePanel.noIssuesDesc"})})]})})}function fa({error:s}){const{formatMessage:t}=G();return e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(fs,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:t({id:"terminalDashboard.issuePanel.error"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s.message})]})})}function pa(){const{formatMessage:s}=G(),{issues:t,isLoading:o,error:i,openCount:n}=xs(),r=ne(nt),l=ne(ye),x=ne(p=>p.setSelectedIssue),c=ne(p=>p.buildAssociationChain),[u,g]=a.useState(new Set),[m,f]=a.useState(!1),[v,T]=a.useState(!1),[h,C]=a.useState("skill-team-issue"),[N,M]=a.useState(!1),[j,y]=a.useState(""),P=a.useRef(null),[U,_]=a.useState(!1),[b,w]=a.useState(!1),[I,q]=a.useState("write"),O=a.useRef(null),V=z(p=>p.submitItems),ee=L(Oe),te=L(ke),J=Ce(Se),H=ee?te[ee]:null,S=(H==null?void 0:H.sessionId)??null,Q=(H==null?void 0:H.cliTool)??null,E=a.useMemo(()=>Q==="claude"?[{value:"skill-team-issue",label:"team-issue"},{value:"ccw-cli",label:"ccw"},{value:"direct-send",label:"Direct send"}]:[{value:"direct-send",label:"Direct send"}],[Q]);a.useEffect(()=>{E.find(p=>p.value===h)||C(E[0].value)},[E,h]),a.useEffect(()=>()=>{P.current&&clearTimeout(P.current),O.current&&clearTimeout(O.current)},[]),a.useEffect(()=>{P.current&&clearTimeout(P.current),O.current&&clearTimeout(O.current),g(new Set),f(!1),T(!1),C("skill-team-issue"),M(!1),y(""),_(!1),w(!1),q("write")},[J]);const F=a.useMemo(()=>{const p={critical:0,high:1,medium:2,low:3},R={in_progress:0,open:1,resolved:2,completed:3,closed:4};return[...t].sort(($,X)=>{const xe=R[$.status]??5,De=R[X.status]??5;if(xe!==De)return xe-De;const Re=p[$.priority]??3,D=p[X.priority]??3;return Re-D})},[t]),oe=a.useCallback(p=>{r===p?x(null):c(p,"issue")},[r,x,c]),ae=a.useCallback(p=>{g(R=>{const $=new Set(R);return $.has(p)?$.delete(p):$.add(p),$})},[]),be=a.useCallback(()=>{g(new Set(F.map(p=>p.id)))},[F]),d=a.useCallback(()=>{g(new Set)},[]),A=a.useCallback(()=>{const p=Array.from(u).join(" ");y(is[h](p)),M(!0)},[u,h]),K=a.useCallback(async()=>{if(!S||u.size===0)return;const p=Q||"claude";f(!0);try{const R=j.trim();let $;switch(h){case"skill-team-issue":$={tool:p,prompt:R,instructionType:"skill",skillName:"team-issue"};break;case"ccw-cli":$={tool:p,prompt:R,instructionType:"skill",skillName:"ccw"};break;case"direct-send":$={tool:p,prompt:R,instructionType:"prompt"};break}await rt(S,$,J||void 0),ve.success("Sent to terminal",R.length>60?R.slice(0,60)+"...":R),T(!0),M(!1),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>T(!1),2e3)}catch(R){ve.error("Failed to send",R instanceof Error?R.message:String(R))}finally{f(!1)}},[S,u,J,h,Q,j]),Y=a.useCallback(async()=>{if(u.size!==0){_(!0);try{const p=F.filter(X=>u.has(X.id)),R=new Date().toISOString(),$=p.map((X,xe)=>({item_id:`Q-${X.id}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,issue_id:X.id,status:"pending",tool:Q||"gemini",prompt:da([X]),mode:I,depends_on:[],execution_order:xe+1,execution_group:"default",createdAt:R,metadata:{issueTitle:X.title,issuePriority:X.priority}}));await V($),ve.success(s({id:"terminalDashboard.issuePanel.addedToQueue",defaultMessage:"Added to queue"}),`${$.length} item(s)`),w(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>w(!1),2e3)}catch(p){ve.error(s({id:"terminalDashboard.issuePanel.addToQueueFailed",defaultMessage:"Failed to add to queue"}),p instanceof Error?p.message:String(p))}finally{_(!1)}}},[u,F,Q,V,s]);return o?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(W,{className:"w-5 h-5 animate-spin text-muted-foreground"})})]}):i?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]})}),e.jsx(fa,{error:i})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border shrink-0 flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[F.length>0&&e.jsx("button",{type:"button",className:"text-[10px] text-muted-foreground hover:text-foreground px-1",onClick:u.size===F.length?d:be,children:u.size===F.length?"Deselect all":"Select all"}),n>0&&e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:n})]})]}),F.length===0?e.jsx(ha,{}):e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1.5 space-y-0.5",children:F.map(p=>e.jsx(xa,{issue:p,isSelected:r===p.id,isHighlighted:(l==null?void 0:l.issueId)===p.id,isChecked:u.has(p.id),onSelect:()=>oe(p.id),onToggleCheck:()=>ae(p.id)},p.id))}),u.size>0&&e.jsxs("div",{className:"border-t border-border shrink-0",children:[N&&e.jsxs("div",{className:"px-3 py-2 space-y-2 border-b border-border bg-muted/20",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Send Configuration"}),e.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>M(!1),children:e.jsx(ps,{className:"w-3.5 h-3.5"})})]}),E.length>1&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:"Method"}),e.jsxs(Pe,{value:h,onValueChange:p=>{const R=p;C(R);const $=Array.from(u).join(" ");y(is[R]($))},children:[e.jsx(Te,{className:"h-6 w-full text-xs",children:e.jsx(Ie,{})}),e.jsx(Ae,{children:E.map(p=>e.jsx(me,{value:p.value,className:"text-xs",children:p.label},p.value))})]})]}),h!=="direct-send"&&e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Prefix: ",e.jsxs("span",{className:"font-mono text-foreground",children:["/",h==="skill-team-issue"?"team-issue":"ccw"]})]}),e.jsx("textarea",{className:"w-full text-xs bg-background border border-border rounded-md px-2 py-1.5 resize-none focus:outline-none focus:ring-1 focus:ring-primary/40 text-foreground",rows:3,value:j,onChange:p=>y(p.target.value),placeholder:"Enter prompt..."}),e.jsxs("button",{type:"button",className:k("w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors","bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:!S||m||!j.trim(),onClick:K,children:[m?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ft,{className:"w-3.5 h-3.5"}),"Confirm Send"]})]}),e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.size," selected"]}),e.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:d,children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("select",{className:"h-6 text-[10px] rounded border border-border bg-background px-1 text-muted-foreground",value:I,onChange:p=>q(p.target.value),title:s({id:"terminalDashboard.issuePanel.queueModeHint",defaultMessage:"Execution mode for queued items"}),children:[e.jsx("option",{value:"write",children:"write"}),e.jsx("option",{value:"analysis",children:"analysis"}),e.jsx("option",{value:"auto",children:"auto"})]}),e.jsxs("button",{type:"button",className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors",b?"bg-green-600 text-white":"bg-muted text-foreground hover:bg-muted/80","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:U,onClick:Y,title:s({id:"terminalDashboard.issuePanel.addToQueueHint",defaultMessage:"Add selected issues to the execution queue"}),children:[U?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):b?e.jsx(Je,{className:"w-3.5 h-3.5"}):e.jsx(zt,{className:"w-3.5 h-3.5"}),s(b?{id:"terminalDashboard.issuePanel.addedToQueue",defaultMessage:"Queued!"}:{id:"terminalDashboard.issuePanel.addToQueue",defaultMessage:"Queue"})]}),e.jsxs("button",{type:"button",className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors",v?"bg-green-600 text-white":"bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:!S||m,onClick:N?K:A,title:S?`Send via ${h}`:"No terminal session focused",children:[m?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):v?e.jsx(Je,{className:"w-3.5 h-3.5"}):e.jsx(le,{className:"w-3.5 h-3.5"}),v?"Sent!":`Send (${u.size})`]})]})]})]})]})}const os={pending:{variant:"secondary",icon:js,label:"Pending"},queued:{variant:"info",icon:ct,label:"Queued"},ready:{variant:"info",icon:ot,label:"Ready"},blocked:{variant:"outline",icon:lt,label:"Blocked"},executing:{variant:"warning",icon:W,label:"Executing"},completed:{variant:"success",icon:it,label:"Completed"},failed:{variant:"destructive",icon:bs,label:"Failed"},cancelled:{variant:"secondary",icon:ge,label:"Cancelled"}},ga={idle:"bg-muted text-muted-foreground",running:"bg-blue-500/15 text-blue-600",paused:"bg-yellow-500/15 text-yellow-600",stopping:"bg-orange-500/15 text-orange-600",completed:"bg-green-500/15 text-green-600",failed:"bg-red-500/15 text-red-600"};function ba({item:s,isHighlighted:t,onSelect:o}){const{formatMessage:i}=G(),n=os[s.status]??os.pending,r=n.icon,l=vs(dt(s.item_id)),x=l.find(f=>f.status==="running")??l[0],c=s.sessionKey??(x==null?void 0:x.sessionKey),u=s.status==="executing",g=s.status==="blocked",m=s.issue_id?`${s.issue_id}`:s.item_id;return e.jsxs("button",{type:"button",className:k("w-full text-left px-2.5 py-1.5 rounded-md transition-colors","hover:bg-muted/60 focus:outline-none focus:ring-1 focus:ring-primary/30",t&&"bg-accent/50 ring-1 ring-accent/30",u&&"border-l-2 border-l-blue-500"),onClick:o,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(r,{className:k("w-3 h-3 shrink-0",u&&"animate-spin")}),e.jsx("span",{className:"text-xs font-medium text-foreground truncate font-mono",children:m})]}),e.jsx(re,{variant:n.variant,className:"text-[10px] px-1 py-0 shrink-0",children:i({id:`terminalDashboard.queuePanel.status.${s.status}`,defaultMessage:n.label})})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-muted-foreground pl-4",children:[s.execution_group&&e.jsx("span",{children:s.execution_group}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"|"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(le,{className:"w-2.5 h-2.5"}),c]})]})]}),g&&s.depends_on.length>0&&e.jsx("div",{className:"mt-0.5 text-[10px] text-orange-500/80 pl-4 truncate",children:i({id:"terminalDashboard.queuePanel.blockedBy",defaultMessage:"Blocked by: {deps}"},{deps:s.depends_on.join(", ")})})]})}function ja(){const{formatMessage:s}=G(),t=z(qe),o=z(Ns),i=z(ws),n=z(ys),r=z(N=>N.startQueue),l=z(N=>N.pauseQueue),x=z(N=>N.stopQueue),c=z(gs),u=t==="idle"&&c.length>0,g=t==="running",m=t==="paused",f=t==="running"||t==="paused",v=t!=="idle",[T,h]=a.useState(!1),C=a.useCallback(()=>{m?r():u&&r(c)},[m,u,r,c]);return e.jsxs("div",{className:"border-t border-border px-2.5 py-1.5 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(re,{variant:"outline",className:k("text-[10px] px-1.5 py-0",ga[t]),children:s({id:`terminalDashboard.queuePanel.scheduler.status.${t}`,defaultMessage:t})}),v&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[o,"% | ",i,"/",(n==null?void 0:n.maxConcurrentSessions)??2]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[(u||m)&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:C,title:s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Start"}),children:e.jsx(we,{className:"w-3 h-3"})}),g&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:l,title:s({id:"terminalDashboard.queuePanel.scheduler.pause",defaultMessage:"Pause"}),children:e.jsx(Me,{className:"w-3 h-3"})}),f&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>h(!0),title:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"}),children:e.jsx(Ot,{className:"w-3 h-3"})})]})]}),v&&e.jsx("div",{className:"mt-1 h-1 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-300",style:{width:`${o}%`}})}),e.jsx(Qe,{open:T,onOpenChange:h,children:e.jsxs($e,{className:"max-w-sm",children:[e.jsxs(He,{children:[e.jsx(Be,{className:"text-base",children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmTitle",defaultMessage:"Stop Queue?"})}),e.jsx(Ge,{children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmMessage",defaultMessage:"Executing tasks will finish, but no new tasks will be started."})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{className:"h-8 text-xs",children:s({id:"common.cancel",defaultMessage:"Cancel"})}),e.jsx(Ke,{className:"h-8 text-xs bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{x(),h(!1)},children:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})})]})]})})]})}function va(){const{formatMessage:s}=G(),t=z(gs),o=ne(ye),i=ne(l=>l.buildAssociationChain),n=a.useMemo(()=>[...t].sort((l,x)=>l.execution_order-x.execution_order),[t]),r=a.useCallback(l=>{i(l,"queue")},[i]);return e.jsxs("div",{className:"flex flex-col h-full",children:[n.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground p-3",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ze,{className:"h-5 w-5 mx-auto mb-1 opacity-30"}),e.jsx("p",{className:"text-xs",children:s({id:"terminalDashboard.queuePanel.noItems"})}),e.jsx("p",{className:"text-[10px] mt-0.5 opacity-70",children:s({id:"terminalDashboard.queuePanel.noItemsDesc",defaultMessage:"Select issues and click Queue to add items"})})]})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1 space-y-0.5",children:n.map(l=>e.jsx(ba,{item:l,isHighlighted:(o==null?void 0:o.queueItemId)===l.item_id,onSelect:()=>r(l.item_id)},l.item_id))}),e.jsx(ja,{})]})}const Na={idle:"bg-muted text-muted-foreground border-border",running:"bg-primary/10 text-primary border-primary/50",paused:"bg-amber-500/10 text-amber-500 border-amber-500/50",stopping:"bg-orange-500/10 text-orange-500 border-orange-500/50",completed:"bg-green-500/10 text-green-500 border-green-500/50",failed:"bg-destructive/10 text-destructive border-destructive/50"};function wa(){const{formatMessage:s}=G(),t=z(qe),o=z(Ns),i=z(ys),n=z(ut),r=z(ws),l=z(mt),x=z(y=>y.startQueue),c=z(y=>y.pauseQueue),u=z(y=>y.stopQueue),g=z(y=>y.updateConfig),m=t==="idle",f=t==="running",v=t==="paused",T=t==="stopping",h=t==="completed"||t==="failed",[C,N]=a.useState(!1),M=a.useCallback(y=>{const P=parseInt(y.target.value,10);!isNaN(P)&&P>=1&&P<=10&&g({maxConcurrentSessions:P})},[g]),j=Object.entries(n??{});return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-3 py-3 border-b border-border space-y-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:k("px-2.5 py-1 rounded text-xs font-medium border",Na[t]),children:s({id:`terminalDashboard.queuePanel.scheduler.status.${t}`,defaultMessage:t})}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-auto tabular-nums",children:[r,"/",(i==null?void 0:i.maxConcurrentSessions)??2]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(m||h)&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:()=>x(),children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Start"})]}),v&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:()=>x(),children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Resume"})]}),f&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:c,children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.pause",defaultMessage:"Pause"})]}),(f||v)&&e.jsxs(B,{variant:"destructive",size:"sm",className:"h-7 text-xs gap-1.5",disabled:T,onClick:()=>N(!0),children:[T?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(ge,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})]})]}),!m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cs,{value:o,className:"h-1.5 flex-1",indicatorClassName:k(t==="failed"&&"bg-destructive",t==="completed"&&"bg-green-500",t==="paused"&&"bg-amber-500",(t==="running"||t==="stopping")&&"bg-primary")}),e.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:s({id:"terminalDashboard.queuePanel.scheduler.progress",defaultMessage:"{percent}%"},{percent:o})})]})]}),e.jsx("div",{className:"px-3 py-2.5 border-b border-border shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s({id:"terminalDashboard.queuePanel.scheduler.concurrency",defaultMessage:"Concurrency"})}),e.jsx("input",{type:"number",min:1,max:10,value:(i==null?void 0:i.maxConcurrentSessions)??2,onChange:M,className:"w-14 h-6 text-xs text-center rounded border border-border bg-background px-1"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsx("h4",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:s({id:"terminalDashboard.schedulerPanel.sessionPool",defaultMessage:"Session Pool"})}),j.length===0?e.jsx("p",{className:"text-xs text-muted-foreground/60 py-2",children:s({id:"terminalDashboard.schedulerPanel.noSessions",defaultMessage:"No active sessions"})}):e.jsx("div",{className:"space-y-1",children:j.map(([y,P])=>e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded bg-muted/30 text-xs",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-mono text-foreground truncate block",children:P.sessionKey}),e.jsx("span",{className:"text-[10px] text-muted-foreground truncate block",children:y})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 ml-2 tabular-nums",children:new Date(P.lastUsed).toLocaleTimeString()})]},y))})]})}),l&&e.jsx("div",{className:"px-3 py-2 border-t border-destructive/30 bg-destructive/5 shrink-0",children:e.jsx("p",{className:"text-xs text-destructive break-words",children:l})}),e.jsx(Qe,{open:C,onOpenChange:N,children:e.jsxs($e,{className:"max-w-sm",children:[e.jsxs(He,{children:[e.jsx(Be,{className:"text-base",children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmTitle",defaultMessage:"Stop Queue?"})}),e.jsx(Ge,{children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmMessage",defaultMessage:"Executing tasks will finish, but no new tasks will be started. Pending items will remain in the queue."})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{className:"h-8 text-xs",children:s({id:"common.cancel",defaultMessage:"Cancel"})}),e.jsx(Ke,{className:"h-8 text-xs bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{u(),N(!1)},children:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})})]})]})})]})}function Le({icon:s,label:t,entityId:o,status:i,timestamp:n,isLast:r=!1}){return o?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{className:"w-3.5 h-3.5 text-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs font-mono font-semibold text-foreground px-1.5 py-0.5 rounded bg-muted",children:o}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground px-1 py-0.5 rounded border border-border",children:i}),n&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:ya(n)}),!r&&e.jsx(ss,{className:"w-3 h-3 text-muted-foreground mx-1"})]}):e.jsxs("div",{className:"flex items-center gap-2 opacity-40",children:[e.jsx(s,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"--"}),!r&&e.jsx(ss,{className:"w-3 h-3 text-muted-foreground mx-1"})]})}function ya(s){try{return new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return s}}function Ca(){const{formatMessage:s}=G(),t=ne(ye),{chain:o}=$t(),i=o??t,n=a.useMemo(()=>{if(!i)return null;const l=Object.values(vs.getState().executions),x=pe.getState().sessions;let c,u;if(i.queueItemId){const f=l.find(v=>v.queueItemId===i.queueItemId);f&&(c=f.status,u=f.startedAt)}let g,m;if(i.sessionId){const f=x[i.sessionId];f&&(g="active",m=f.createdAt)}return{queueStatus:c,executionTimestamp:u,sessionStatus:g,sessionTimestamp:m}},[i]),r=i!==null;return e.jsx("div",{className:"h-full overflow-y-auto px-4 py-3",children:r?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s({id:"terminalDashboard.inspector.associationChain"})}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx(Le,{icon:fe,label:"Issue",entityId:i.issueId}),e.jsx(Le,{icon:ze,label:"Queue",entityId:i.queueItemId,status:n==null?void 0:n.queueStatus,timestamp:n==null?void 0:n.executionTimestamp}),e.jsx(Le,{icon:le,label:"Session",entityId:i.sessionId,status:n==null?void 0:n.sessionStatus,timestamp:n==null?void 0:n.sessionTimestamp,isLast:!0})]})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"terminalDashboard.inspector.noSelection"})})})}const cs={pending:{label:"Pending",color:"text-muted-foreground",bgColor:"bg-muted"},running:{label:"Running",color:"text-primary",bgColor:"bg-primary/10"},paused:{label:"Paused",color:"text-amber-500",bgColor:"bg-amber-500/10"},completed:{label:"Completed",color:"text-green-500",bgColor:"bg-green-500/10"},failed:{label:"Failed",color:"text-destructive",bgColor:"bg-destructive/10"},cancelled:{label:"Cancelled",color:"text-muted-foreground",bgColor:"bg-muted"}},ds={running:{variant:"info",messageId:"terminalDashboard.agentList.statusRunning"},completed:{variant:"success",messageId:"terminalDashboard.agentList.statusCompleted"},failed:{variant:"destructive",messageId:"terminalDashboard.agentList.statusFailed"},paused:{variant:"warning",messageId:"terminalDashboard.agentList.statusPaused"},pending:{variant:"secondary",messageId:"terminalDashboard.agentList.statusPending"},cancelled:{variant:"secondary",messageId:"terminalDashboard.agentList.statusPending"}};function Sa({status:s}){switch(s){case"pending":return e.jsx(Xe,{className:"w-4 h-4 text-muted-foreground"});case"running":return e.jsx(W,{className:"w-4 h-4 text-primary animate-spin"});case"completed":return e.jsx(gt,{className:"w-4 h-4 text-green-500"});case"failed":return e.jsx(bs,{className:"w-4 h-4 text-destructive"});case"paused":return e.jsx(Me,{className:"w-4 h-4 text-amber-500"});case"cancelled":return e.jsx(ge,{className:"w-4 h-4 text-muted-foreground"});default:return e.jsx(Xe,{className:"w-4 h-4 text-muted-foreground opacity-50"})}}function ka({step:s,isCurrent:t}){return e.jsxs("div",{className:k("flex items-start gap-3 px-3 py-2 rounded-md transition-colors",t&&s.status==="running"&&"bg-primary/5 border border-primary/20",s.status==="failed"&&"bg-destructive/5"),children:[e.jsx("div",{className:"pt-0.5 shrink-0",children:e.jsx(Sa,{status:s.status})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:k("text-sm font-medium truncate block",s.status==="completed"&&"text-muted-foreground",s.status==="running"&&"text-foreground",s.status==="failed"&&"text-destructive"),children:s.name}),s.error&&e.jsx("p",{className:"text-xs text-destructive mt-1 truncate",children:s.error})]})]})}function Ma({runState:s}){const{formatMessage:t}=G(),{plan:o,status:i,stepStatuses:n}=s,r=o.steps.length,l=a.useMemo(()=>Object.values(n).filter(u=>u.status==="completed"||u.status==="skipped").length,[n]),x=ds[i]??ds.pending,c=i==="running";return e.jsxs("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-md","hover:bg-muted/30 transition-colors"),children:[e.jsx("div",{className:"shrink-0",children:c?e.jsx(W,{className:"w-4 h-4 text-primary animate-spin"}):e.jsx(ks,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:o.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"terminalDashboard.agentList.stepLabel"},{current:l,total:r})})]}),e.jsx(re,{variant:x.variant,className:"text-xs px-2 py-0 shrink-0",children:t({id:x.messageId})})]})}function Da(){const{formatMessage:s}=G(),t=ie(xt),o=ie(ht),i=ie(f=>f.selectExecution),n=ie(f=>f.pauseExecution),r=ie(f=>f.resumeExecution),l=ie(f=>f.stopExecution),x=ie(f=>f.clearExecution),c=ft(pt),u=a.useMemo(()=>Object.entries(c),[c]),g=Object.values(o);return g.length>0||u.length>0?e.jsxs("div",{className:"flex flex-col h-full",children:[u.length>0&&e.jsxs("div",{className:"border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted/20",children:[e.jsx(ks,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:s({id:"terminalDashboard.agentList.title"})}),e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-auto",children:u.length})]}),e.jsx("div",{className:"divide-y divide-border/50",children:u.map(([f,v])=>e.jsx(Ma,{runState:v},f))})]}),g.length>0&&e.jsxs(e.Fragment,{children:[g.length>1&&e.jsx("div",{className:"border-b border-border p-2 shrink-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:g.map(f=>e.jsx("button",{onClick:()=>i(f.executionId),className:k("px-2 py-1 text-xs rounded-md transition-colors truncate max-w-[120px]",(t==null?void 0:t.executionId)===f.executionId?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80 text-muted-foreground"),children:f.flowName},f.executionId))})}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate flex-1",children:t.flowName}),e.jsx(re,{variant:"secondary",className:k("shrink-0",cs[t.status].bgColor),children:cs[t.status].label})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:s({id:"executionMonitor.progress",defaultMessage:"{completed}/{total} steps"},{completed:t.completedSteps,total:t.totalSteps||t.steps.length})}),e.jsxs("span",{children:[Math.round(t.completedSteps/(t.totalSteps||t.steps.length||1)*100),"%"]})]}),e.jsx(Cs,{value:t.completedSteps/(t.totalSteps||t.steps.length||1)*100,className:"h-2"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(js,{className:"w-3 h-3"}),new Date(t.startedAt).toLocaleTimeString()]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(le,{className:"w-3 h-3"}),e.jsxs("span",{className:"truncate max-w-[100px]",children:[t.sessionKey.slice(0,20),"..."]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:t.steps.map(f=>e.jsx(ka,{step:f,isCurrent:f.id===t.currentStepId},f.id))}),e.jsxs("div",{className:"p-3 border-t border-border flex items-center gap-2 shrink-0",children:[t.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsxs(B,{variant:"outline",size:"sm",onClick:()=>n(t.executionId),className:"gap-1.5",children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.pause",defaultMessage:"Pause"})]}),e.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>l(t.executionId),className:"gap-1.5",children:[e.jsx(ge,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.stop",defaultMessage:"Stop"})]})]}),t.status==="paused"&&e.jsxs(e.Fragment,{children:[e.jsxs(B,{variant:"default",size:"sm",onClick:()=>r(t.executionId),className:"gap-1.5",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.resume",defaultMessage:"Resume"})]}),e.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>l(t.executionId),className:"gap-1.5",children:[e.jsx(ge,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.stop",defaultMessage:"Stop"})]})]}),(t.status==="completed"||t.status==="failed"||t.status==="cancelled")&&e.jsx(B,{variant:"outline",size:"sm",onClick:()=>x(t.executionId),className:"gap-1.5 ml-auto",children:s({id:"executionMonitor.clear",defaultMessage:"Clear"})})]})]})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-8",children:[e.jsx(le,{className:"w-10 h-10 mb-3 opacity-30"}),e.jsx("p",{className:"text-sm font-medium",children:s({id:"executionMonitor.noExecutions",defaultMessage:"No active executions"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s({id:"executionMonitor.sendToTerminal",defaultMessage:"Send a workflow to terminal to start"})})]})}function Pa({rootPath:s,enabled:t=!0,className:o,onCollapse:i,width:n=280}){const{formatMessage:r}=G(),l=L(Oe),x=L(y=>y.showFileInPane),{rootNodes:c,state:u,isLoading:g,isFetching:m,error:f,refetch:v,setSelectedFile:T,toggleExpanded:h,toggleShowHidden:C}=At({rootPath:s,maxDepth:6,enabled:t}),N=a.useCallback(y=>{y.type==="file"&&(T(y.path),l&&x(l,y.path))},[l,T,x]),M=a.useCallback(()=>{v()},[v]),j=a.useCallback(()=>{i==null||i()},[i]);return t?e.jsxs("div",{className:k("flex flex-col h-full border-l border-border bg-background",o),style:{width:n},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Ee,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:r({id:"terminalDashboard.fileSidebar.title",defaultMessage:"Files"})}),m&&!g&&e.jsx(W,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:C,title:r({id:"terminalDashboard.fileBrowser.showHidden"}),children:u.showHiddenFiles?e.jsx(Rt,{className:"h-3.5 w-3.5"}):e.jsx(Lt,{className:"h-3.5 w-3.5"})}),e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:M,disabled:m,title:r({id:"terminalDashboard.fileSidebar.refresh",defaultMessage:"Refresh"}),children:e.jsx(us,{className:k("h-3.5 w-3.5",m&&"animate-spin")})}),i&&e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j,title:r({id:"terminalDashboard.fileSidebar.collapse",defaultMessage:"Collapse"}),children:e.jsx(Ze,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("div",{className:"px-3 py-1.5 border-b border-border/50 bg-muted/10 shrink-0",children:e.jsx("div",{className:"text-[10px] text-muted-foreground truncate font-mono",title:s,children:s})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:g?e.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[e.jsx(W,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{className:"ml-2 text-xs",children:r({id:"terminalDashboard.fileBrowser.loading",defaultMessage:"Loading..."})})]}):f?e.jsx("div",{className:"p-3 text-xs text-destructive",children:r({id:"terminalDashboard.fileBrowser.loadFailed",defaultMessage:"Failed to load files"})}):c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center text-muted-foreground",children:[e.jsx(Ss,{className:"h-10 w-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-xs",children:r({id:"terminalDashboard.fileSidebar.empty",defaultMessage:"No files found"})})]}):e.jsx(Et,{nodes:c,expandedPaths:u.expandedPaths,selectedPath:u.selectedFile,onNodeClick:N,onToggle:h,maxDepth:0,className:"py-1"})}),!l&&e.jsx("div",{className:"px-3 py-2 border-t border-border bg-muted/10 shrink-0",children:e.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:r({id:"terminalDashboard.fileSidebar.selectPaneHint",defaultMessage:"Click a pane to show file preview"})})})]}):e.jsxs("div",{className:k("flex flex-col h-full border-l border-border bg-background",o),style:{width:n},children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r({id:"terminalDashboard.fileSidebar.title",defaultMessage:"Files"})}),i&&e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j,children:e.jsx(Ze,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4 text-center text-muted-foreground",children:[e.jsx(Ee,{className:"h-10 w-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-xs",children:r({id:"terminalDashboard.fileSidebar.noProject",defaultMessage:"No project open"})}),e.jsx("p",{className:"text-[10px] mt-1 opacity-70",children:r({id:"terminalDashboard.fileSidebar.openProjectHint",defaultMessage:"Open a project to browse files"})})]})]})}function Wa(){const{formatMessage:s}=G(),[t,o]=a.useState(null),[i,n]=a.useState(!0),[r,l]=a.useState(!0),x=Ce(Se),c=_e(v=>v.featureFlags),u=es(bt),g=es(v=>v.toggleImmersiveMode),m=a.useCallback(v=>{o(T=>T===v?null:v)},[]),f=a.useCallback(()=>{o(null)},[]);return a.useEffect(()=>{o(null)},[x]),e.jsx("div",{className:`flex flex-col overflow-hidden ${u?"h-screen":"h-[calc(100vh-56px)]"}`,children:e.jsxs(Qt,{scopeKey:x??"default",children:[e.jsx(Gt,{activePanel:t,onTogglePanel:m,isFileSidebarOpen:i,onToggleFileSidebar:()=>n(v=>!v),isSessionSidebarOpen:r,onToggleSessionSidebar:()=>l(v=>!v),isFullscreen:u,onToggleFullscreen:g}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsxs(he,{className:"h-full",children:[r&&e.jsx(he.Pane,{preferredSize:240,minSize:180,maxSize:320,children:e.jsx("div",{className:"h-full flex flex-col border-r border-border",children:e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(ca,{})})})}),e.jsx(he.Pane,{preferredSize:-1,minSize:300,children:e.jsx(la,{})}),i&&e.jsx(he.Pane,{preferredSize:280,minSize:200,maxSize:400,children:e.jsx(Pa,{rootPath:x??"/",enabled:!!x,onCollapse:()=>n(!1)})})]})}),e.jsx(je,{isOpen:t==="issues",onClose:f,title:s({id:"terminalDashboard.toolbar.issues"}),side:"left",width:700,children:e.jsxs("div",{className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0 border-r border-border",children:e.jsx(pa,{})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsx("h3",{className:"text-sm font-semibold",children:s({id:"terminalDashboard.toolbar.queue"})})}),e.jsx(va,{})]})]})}),c.dashboardQueuePanelEnabled&&e.jsx(je,{isOpen:t==="queue",onClose:f,title:s({id:"terminalDashboard.toolbar.queue"}),side:"right",width:400,children:e.jsx(jt,{})}),c.dashboardInspectorEnabled&&e.jsx(je,{isOpen:t==="inspector",onClose:f,title:s({id:"terminalDashboard.toolbar.inspector"}),side:"right",width:360,children:e.jsx(Ca,{})}),c.dashboardExecutionMonitorEnabled&&e.jsx(je,{isOpen:t==="execution",onClose:f,title:s({id:"terminalDashboard.toolbar.executionMonitor",defaultMessage:"Execution Monitor"}),side:"right",width:380,children:e.jsx(Da,{})}),e.jsx(je,{isOpen:t==="scheduler",onClose:f,title:s({id:"terminalDashboard.toolbar.scheduler",defaultMessage:"Scheduler"}),side:"right",width:340,children:e.jsx(wa,{})})]})})}export{Wa as TerminalDashboardPage,Wa as default};
22
- //# sourceMappingURL=TerminalDashboardPage-D1WekoOy.js.map
21
+ */const ts=Fe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]),Ms=a.createContext(null);function Qt({children:s,scopeKey:t}){const[o,i]=a.useState(null),n=a.useRef(t);a.useEffect(()=>{n.current!==t&&(n.current=t,i(null))},[t]);const r=a.useCallback(c=>{i(c)},[]),l=a.useCallback((c,u)=>{if(!o)return!1;switch(u){case"issue":return o.issueId===c;case"queue":return o.queueItemId===c;case"session":return o.sessionId===c;default:return!1}},[o]),x=a.useMemo(()=>({chain:o,setChain:r,isHighlighted:l}),[o,r,l]);return e.jsx(Ms.Provider,{value:x,children:s})}function $t(){const s=a.useContext(Ms);if(!s)throw new Error("useAssociationHighlight must be used within an AssociationHighlightProvider");return s}function as(s){const o=new Date().toTimeString().slice(0,8).replace(/:/g,"");return`${s}-${o}`}function Ht({isOpen:s,onClose:t,defaultWorkingDir:o,onCreateSession:i}){const{formatMessage:n}=G(),r=_e(Is),l=a.useMemo(()=>Object.entries(r).filter(([,d])=>d.enabled).map(([d])=>d),[r]),[x,c]=a.useState("gemini"),[u,p]=a.useState(void 0),[m,f]=a.useState("yolo"),[v,T]=a.useState(typeof navigator<"u"&&navigator.platform.toLowerCase().includes("win")?"cmd":"bash"),[h,C]=a.useState(o??""),[N,M]=a.useState(""),[j,y]=a.useState(!1),[P,U]=a.useState(null),[_,b]=a.useState(""),[w,I]=a.useState(!1),q=a.useRef(null),O=a.useRef(null),{cliSettings:V}=Ct({enabled:!0}),te={claude:"claude",codex:"codex",gemini:"gemini"}[x]||x,J=a.useMemo(()=>(V||[]).filter(d=>d.enabled&&(d.provider||"claude")===te),[V,te]),[H,S]=a.useState(void 0);a.useEffect(()=>{S(void 0)},[x]);const Q=a.useMemo(()=>{var K,Y;if(H){const g=J.find(R=>R.id===H);if((K=g==null?void 0:g.settings.availableModels)!=null&&K.length)return g.settings.availableModels}const d=r[x];if(!d)return[];if((Y=d.availableModels)!=null&&Y.length)return d.availableModels;const A=[];return d.primaryModel&&A.push(d.primaryModel),d.secondaryModel&&d.secondaryModel!==d.primaryModel&&A.push(d.secondaryModel),A},[r,x,H,J]),E=a.useCallback(()=>{M(as(x))},[x]);a.useEffect(()=>{if(!s)return;C(o??""),U(null),S(void 0),E()},[s,o,E]),a.useEffect(()=>{if(N){const d=N.split("-").pop()||"";M(`${x}-${d}`)}},[x]),a.useEffect(()=>{b(u??"")},[u]);const F=a.useMemo(()=>{const d=_.toLowerCase();return d?Q.filter(A=>A.toLowerCase().includes(d)):Q},[Q,_]);a.useEffect(()=>{function d(A){q.current&&!q.current.contains(A.target)&&I(!1)}if(w)return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[w]);const oe=d=>{var Y;c(d);const A=r[d],K=(Y=A==null?void 0:A.availableModels)!=null&&Y.length?A.availableModels:[A==null?void 0:A.primaryModel,A==null?void 0:A.secondaryModel].filter(Boolean);(!u||!K.includes(u))&&p(K[0])},ae=()=>{console.log("[CliConfigModal] browse working directory - not implemented")},be=async()=>{const d=h.trim();if(!d){U(n({id:"terminalDashboard.cliConfig.errors.workingDirRequired"}));return}const A=N.trim()||as(x);y(!0),U(null);try{await i({tool:x,model:u,launchMode:m,preferredShell:v,workingDir:d,tag:A,settingsEndpointId:H}),t()}catch(K){console.error("[CliConfigModal] create session failed:",K),U(n({id:"terminalDashboard.cliConfig.errors.createFailed"}))}finally{y(!1)}};return e.jsx(As,{open:s,onOpenChange:d=>!d&&t(),children:e.jsxs(Es,{className:"sm:max-w-[720px] max-h-[90vh] overflow-y-auto",children:[e.jsxs(Fs,{children:[e.jsx(Os,{children:n({id:"terminalDashboard.cliConfig.title"})}),e.jsx(Rs,{children:n({id:"terminalDashboard.cliConfig.description"})})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-tag",children:n({id:"terminalDashboard.cliConfig.tag",defaultMessage:"Session Name"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(We,{id:"cli-config-tag",value:N,onChange:d=>M(d.target.value),placeholder:n({id:"terminalDashboard.cliConfig.tagPlaceholder",defaultMessage:"e.g., gemini-143052"}),disabled:j,className:"flex-1"}),e.jsx(B,{type:"button",variant:"outline",onClick:E,disabled:j,title:n({id:"terminalDashboard.cliConfig.regenerateTag",defaultMessage:"Regenerate name"}),children:e.jsx(us,{className:"w-4 h-4"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n({id:"terminalDashboard.cliConfig.tagHint",defaultMessage:"Auto-generated as {tool}-{time}. Used for grouping sessions."})})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-tool",children:n({id:"terminalDashboard.cliConfig.tool"})}),e.jsxs(Pe,{value:x,onValueChange:oe,disabled:j,children:[e.jsx(Te,{id:"cli-config-tool",children:e.jsx(Ie,{})}),e.jsx(Ae,{children:l.map(d=>e.jsx(me,{value:d,children:d},d))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-model",children:n({id:"terminalDashboard.cliConfig.model"})}),e.jsxs("div",{ref:q,className:"relative",children:[e.jsxs("div",{className:"flex",children:[e.jsx("input",{ref:O,id:"cli-config-model",value:_,onChange:d=>{const A=d.target.value;b(A),p(A||void 0),w||I(!0)},onFocus:()=>I(!0),onKeyDown:d=>{d.key==="Escape"&&I(!1),d.key==="Enter"&&I(!1)},placeholder:n({id:"terminalDashboard.cliConfig.modelAuto",defaultMessage:"Auto"}),disabled:j,className:"flex h-10 w-full rounded-l-md border border-r-0 border-input bg-background px-3 py-2 text-sm font-mono ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),e.jsx("button",{type:"button",onClick:()=>{var d;I(!w),w||(d=O.current)==null||d.focus()},disabled:j,className:"flex items-center justify-center h-10 w-9 shrink-0 rounded-r-md border border-input bg-background hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",children:e.jsx(ms,{className:"h-4 w-4 opacity-50"})})]}),w&&e.jsxs("div",{className:"absolute z-50 mt-1 w-full rounded-md border border-border bg-card shadow-md max-h-48 overflow-y-auto",children:[e.jsx("button",{type:"button",onClick:()=>{p(void 0),b(""),I(!1)},className:k("flex w-full items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground",!u&&"bg-accent/50"),children:n({id:"terminalDashboard.cliConfig.modelAuto",defaultMessage:"Auto"})}),F.map(d=>e.jsx("button",{type:"button",onClick:()=>{p(d),b(d),I(!1)},className:k("flex w-full items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-accent hover:text-accent-foreground font-mono",u===d&&"bg-accent/50"),children:d},d))]})]})]})]}),J.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-profile",children:n({id:"terminalDashboard.cliConfig.configProfile",defaultMessage:"Config Profile"})}),e.jsxs(Pe,{value:H??"__default__",onValueChange:d=>{var K;const A=d==="__default__"?void 0:d;if(S(A),A){const Y=J.find(g=>g.id===A);(K=Y==null?void 0:Y.settings.availableModels)!=null&&K.length&&p(Y.settings.availableModels[0])}},disabled:j,children:[e.jsx(Te,{id:"cli-config-profile",children:e.jsx(Ie,{})}),e.jsxs(Ae,{children:[e.jsx(me,{value:"__default__",children:n({id:"terminalDashboard.cliConfig.defaultProfile",defaultMessage:"Default"})}),J.map(d=>e.jsx(me,{value:d.id,children:d.name},d.id))]})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:n({id:"terminalDashboard.cliConfig.configProfileHint",defaultMessage:"Select a CLI Settings profile for custom API configuration."})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{children:n({id:"terminalDashboard.cliConfig.mode"})}),e.jsxs(Ls,{value:m,onValueChange:d=>f(d),className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Ye,{value:"default"}),n({id:"terminalDashboard.cliConfig.modeDefault"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx(Ye,{value:"yolo"}),n({id:"terminalDashboard.cliConfig.modeYolo"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-shell",children:n({id:"terminalDashboard.cliConfig.shell"})}),e.jsxs(Pe,{value:v,onValueChange:d=>T(d),disabled:j,children:[e.jsx(Te,{id:"cli-config-shell",children:e.jsx(Ie,{})}),e.jsxs(Ae,{children:[e.jsx(me,{value:"cmd",children:"cmd (推荐 Windows)"}),e.jsx(me,{value:"bash",children:"bash (Git Bash/WSL)"}),e.jsx(me,{value:"pwsh",children:"pwsh (PowerShell)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(de,{htmlFor:"cli-config-workingDir",children:n({id:"terminalDashboard.cliConfig.workingDir"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(We,{id:"cli-config-workingDir",value:h,onChange:d=>{C(d.target.value),P&&U(null)},placeholder:n({id:"terminalDashboard.cliConfig.workingDirPlaceholder"}),disabled:j,className:k(P&&"border-destructive")}),e.jsx(B,{type:"button",variant:"outline",onClick:ae,disabled:j,title:n({id:"terminalDashboard.cliConfig.browse"}),children:e.jsx(Ee,{className:"w-4 h-4"})})]}),P&&e.jsx("p",{className:"text-xs text-destructive",children:P})]})]}),e.jsxs(_s,{children:[e.jsx(B,{variant:"outline",onClick:t,disabled:j,children:n({id:"common.actions.cancel"})}),e.jsx(B,{onClick:be,disabled:j,children:n({id:"common.actions.create"})})]})]})})}const Bt=[{id:"single",icon:pe,labelId:"terminalDashboard.toolbar.layoutSingle"},{id:"split-h",icon:vt,labelId:"terminalDashboard.toolbar.layoutSplitH"},{id:"split-v",icon:Nt,labelId:"terminalDashboard.toolbar.layoutSplitV"},{id:"grid-2x2",icon:Mt,labelId:"terminalDashboard.toolbar.layoutGrid"}];function Gt({activePanel:s,onTogglePanel:t,isFileSidebarOpen:o,onToggleFileSidebar:i,isSessionSidebarOpen:n,onToggleSessionSidebar:r,isFullscreen:l,onToggleFullscreen:x}){const{formatMessage:c}=G(),{openCount:u}=xs(),p=qs(),m=a.useMemo(()=>{if(!p.data)return 0;const S=p.data.grouped_items??{};let Q=0;for(const E of Object.values(S))Q+=E.length;return Q},[p.data]),v=ne(ye)!==null,T=ie(zs),C=z(qe)!=="idle",N=_e(S=>S.featureFlags),M=N.dashboardQueuePanelEnabled,j=N.dashboardInspectorEnabled,y=N.dashboardExecutionMonitorEnabled,P=L(S=>S.resetLayout),U=a.useCallback(S=>{P(S)},[P]),_=Ce(Se),b=L(Oe),w=L(S=>S.createSessionAndAssign),I=se(S=>S.updateTerminalMeta),[q,O]=a.useState(!1),[V,ee]=a.useState(!1);a.useEffect(()=>{O(!1),ee(!1)},[_]);const te=a.useCallback(()=>b||(P("single"),L.getState().focusedPaneId),[b]),J=a.useCallback(()=>{ee(!0)},[]),H=a.useCallback(async S=>{var Q;if(!_)throw new Error("No project path");O(!0);try{const E=te();if(!E)throw new Error("Failed to create pane");const F=await w(E,{workingDir:S.workingDir||_,preferredShell:S.preferredShell,tool:S.tool,model:S.model,launchMode:S.launchMode,settingsEndpointId:S.settingsEndpointId},_);(Q=F==null?void 0:F.session)!=null&&Q.sessionKey&&I(F.session.sessionKey,{tag:S.tag,title:S.tag})}catch(E){const F=E instanceof Error||E!=null&&E.message?E.message:String(E);throw ve.error(`CLI 会话创建失败 (${S.tool})`,F),E}finally{O(!1)}},[_,w,te,I]);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 h-[40px] border-b border-border bg-muted/30 shrink-0",children:[e.jsxs("button",{onClick:J,className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors","text-muted-foreground hover:text-foreground hover:bg-muted",q&&"opacity-50 cursor-wait"),disabled:q||!_,title:c({id:"terminalDashboard.toolbar.launchCliHint",defaultMessage:"Click to configure and launch a CLI session"}),children:[q?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Qs,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:c({id:"terminalDashboard.toolbar.launchCli"})})]}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx(ue,{icon:St,label:c({id:"terminalDashboard.toolbar.sessions",defaultMessage:"Sessions"}),isActive:n??!0,onClick:()=>r==null?void 0:r()}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx(ue,{icon:fe,label:c({id:"terminalDashboard.toolbar.issues"}),isActive:s==="issues",onClick:()=>t("issues"),badge:u>0?u:void 0}),M&&e.jsx(ue,{icon:ze,label:c({id:"terminalDashboard.toolbar.queue"}),isActive:s==="queue",onClick:()=>t("queue"),badge:m>0?m:void 0}),j&&e.jsx(ue,{icon:$s,label:c({id:"terminalDashboard.toolbar.inspector"}),isActive:s==="inspector",onClick:()=>t("inspector"),dot:v}),y&&e.jsx(ue,{icon:Hs,label:c({id:"terminalDashboard.toolbar.executionMonitor",defaultMessage:"Execution Monitor"}),isActive:s==="execution",onClick:()=>t("execution"),badge:T>0?T:void 0}),e.jsx(ue,{icon:kt,label:c({id:"terminalDashboard.toolbar.scheduler",defaultMessage:"Scheduler"}),isActive:s==="scheduler",onClick:()=>t("scheduler"),dot:C,loading:C}),e.jsx(ue,{icon:Ee,label:c({id:"terminalDashboard.toolbar.files",defaultMessage:"Files"}),isActive:o??!1,onClick:()=>i==null?void 0:i()}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),Bt.map(S=>e.jsx("button",{onClick:()=>U(S.id),className:k("p-1.5 rounded transition-colors","text-muted-foreground hover:text-foreground hover:bg-muted"),title:c({id:S.labelId}),children:e.jsx(S.icon,{className:"w-3.5 h-3.5"})},S.id)),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx("button",{onClick:x,className:k("p-1.5 rounded transition-colors",l?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),title:c(l?{id:"terminalDashboard.toolbar.exitFullscreen",defaultMessage:"Exit Fullscreen"}:{id:"terminalDashboard.toolbar.fullscreen",defaultMessage:"Fullscreen"}),children:l?e.jsx(Dt,{className:"w-3.5 h-3.5"}):e.jsx(Pt,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground font-medium",children:c({id:"terminalDashboard.page.title"})})]}),e.jsx(Ht,{isOpen:V,onClose:()=>ee(!1),defaultWorkingDir:_,onCreateSession:H})]})}function ue({icon:s,label:t,isActive:o,onClick:i,badge:n,dot:r,loading:l}){return e.jsxs("button",{onClick:i,className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs transition-colors",o?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[l?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(s,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:t}),n!==void 0&&n>0&&e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-0.5",children:n}),r&&e.jsx("span",{className:k("ml-0.5 w-2 h-2 rounded-full bg-primary shrink-0",l&&"animate-pulse")})]})}const Ut=/[)\]}>,.;:!?]+$/g,Vt=/^['"`]+|['"`]+$/g;function Kt(s){return s.trim().replace(Vt,"").replace(Ut,"")}const ns={"workflow-session":[/(?:^|[^\w.])(\.workflow[\\/](?:active|archives)[\\/][^\s"'`]+[\\/]workflow-session\.json)\b/g],"lite-session":[/(?:^|[^\w.])(\.workflow[\\/]\.lite-plan[\\/][^\s"'`]+)\b/g],"claude-md":[/([^\s"'`]*CLAUDE\.md)\b/gi],"ccw-config":[/(?:^|[^\w.])(\.ccw[\\/][^\s"'`]+)\b/g,/(?:^|[^\w.])(ccw\.config\.(?:json|ya?ml|toml))\b/gi],issue:[/(?:^|[^\w.])(\.workflow[\\/]issues[\\/][^\s"'`]+)\b/g]};function Wt(s){if(!s)return[];const t=[];for(const n of Object.keys(ns))for(const r of ns[n]){r.lastIndex=0;let l;for(;(l=r.exec(s))!==null;){const x=l[1]??l[0],c=Kt(x);if(!c)continue;const u=l[0]??"",p=l[1]??x,m=u.indexOf(p),f=(l.index??0)+(m>=0?m:0);t.push({type:n,path:c,index:f})}}t.sort((n,r)=>n.index-r.index);const o=[],i=new Set;for(const n of t){const r=`${n.type}:${n.path}`;i.has(r)||(i.add(r),o.push({type:n.type,path:n.path}))}return o}function Yt(s){switch(s){case"workflow-session":return"info";case"lite-session":return"success";case"claude-md":return"review";case"ccw-config":return"warning";case"issue":return"destructive";default:return"secondary"}}function Jt(s){switch(s){case"workflow-session":return"terminalDashboard.artifacts.types.workflowSession";case"lite-session":return"terminalDashboard.artifacts.types.liteSession";case"claude-md":return"terminalDashboard.artifacts.types.claudeMd";case"ccw-config":return"terminalDashboard.artifacts.types.ccwConfig";case"issue":return"terminalDashboard.artifacts.types.issue"}}function Xt(s){const t=s.split(/[\\/]/g);return t[t.length-1]||s}function Zt({type:s,path:t,onClick:o,className:i}){const{formatMessage:n}=G(),r=n({id:Jt(s)}),l=Xt(t);return e.jsxs("button",{type:"button",className:k(Bs({variant:Yt(s)}),"gap-1 cursor-pointer hover:opacity-90 active:opacity-100","px-2 py-0.5 text-[11px] font-semibold",i),onClick:()=>o==null?void 0:o(t),title:t,children:[e.jsx("span",{children:r}),e.jsx("span",{className:"opacity-80 font-mono",children:l})]})}const ea=250,rs=12;function sa(s){return s?!!(s.startsWith("/")||s.startsWith("\\")||/^[A-Za-z]:[\\/]/.test(s)||s.startsWith("~")):!1}function ta(s,t){const o=s.includes("\\")?"\\":"/",i=s.replace(/[\\/]+$/,""),n=t.replace(/^[\\/]+/,"");return`${i}${o}${n}`}function aa(s,t){return!s||sa(s)||!t?s:ta(t,s)}function na(s,t){if(t.length===0)return s;const o=new Map;for(const r of s)o.set(`${r.type}:${r.path}`,r);let i=!1;for(const r of t){const l=`${r.type}:${r.path}`;o.has(l)||(o.set(l,r),i=!0)}if(!i)return s;const n=Array.from(o.values());return n.length>rs?n.slice(n.length-rs):n}function ra({sessionId:s,className:t,onRevealPath:o}){const i=Ce(Se),n=ge(b=>b.outputChunks),r=ge(b=>b.setBuffer),l=ge(b=>b.clearOutput),[x,c]=a.useState([]),u=a.useRef(null),p=a.useRef(null),m=a.useRef(null),f=a.useRef(0),v=a.useRef(""),T=a.useRef(null),h=a.useRef(""),C=a.useRef(null),N=a.useRef(s);N.current=s;const M=a.useRef(i);M.current=i;const j=a.useCallback(()=>{var b;(b=p.current)==null||b.focus()},[]),y=a.useCallback(b=>{const w=aa(b,M.current);navigator.clipboard.writeText(w).catch(I=>{console.error("[TerminalInstance] copy artifact path failed:",I)}),o==null||o(w)},[o]),P=a.useCallback(b=>{b&&(v.current+=b,T.current===null&&(T.current=window.setTimeout(()=>{T.current=null;const w=v.current;v.current="";const I=Wt(w);I.length!==0&&c(q=>na(q,I))},ea)))},[]);a.useEffect(()=>()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null)},[]);const U=a.useCallback(async()=>{const b=N.current;if(!b)return;const w=h.current;if(h.current="",!!w)try{await Gs(b,{text:w,appendNewline:!1},M.current||void 0)}catch{}},[]),_=a.useCallback(()=>{C.current===null&&(C.current=window.setTimeout(async()=>{C.current=null,await U()},30))},[U]);return a.useEffect(()=>{if(!u.current||p.current)return;const b=new Us.Terminal({convertEol:!0,cursorBlink:!0,fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:12,scrollback:5e3}),w=new Vs.FitAddon;return b.loadAddon(w),b.open(u.current),w.fit(),b.onData(I=>{N.current&&(h.current+=I,_())}),p.current=b,m.current=w,()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null);try{b.dispose()}finally{p.current=null,m.current=null}}},[]),a.useEffect(()=>{const b=p.current,w=m.current;!b||!w||(f.current=0,b.reset(),b.clear(),c([]),v.current="",T.current!==null&&(window.clearTimeout(T.current),T.current=null),s&&(l(s),Ks(s,i||void 0).then(({buffer:I})=>{r(s,I||"")}).catch(()=>{}).finally(()=>{w.fit()})))},[s,i,r,l]),a.useEffect(()=>{const b=p.current;if(!b||!s)return;const w=n[s]??[],I=f.current;if(I>=w.length)return;const{feedMonitor:q}=se.getState(),O=[];for(let V=I;V<w.length;V++)b.write(w[V].data),q(s,w[V].data),O.push(w[V].data);f.current=w.length,O.length>0&&P(O.join(""))},[n,s,P]),a.useEffect(()=>{const b=u.current,w=p.current,I=m.current;if(!b||!w||!I)return;const q=()=>{I.fit(),N.current&&(async()=>{try{await Ws(N.current,{cols:w.cols,rows:w.rows},M.current||void 0)}catch{}})()},O=new ResizeObserver(q);return O.observe(b),()=>O.disconnect()},[s,i]),e.jsxs("div",{className:k("relative h-full w-full",t),children:[x.length>0&&e.jsx("div",{className:"absolute top-2 left-2 right-2 z-10 flex flex-wrap gap-1 pointer-events-none",children:x.map(b=>e.jsx(Zt,{type:b.type,path:b.path,onClick:y,className:"pointer-events-auto"},`${b.type}:${b.path}`))}),e.jsx("div",{ref:u,className:"h-full w-full bg-black/90",onClick:j})]})}const ia={active:"bg-green-500",idle:"bg-gray-400",error:"bg-red-500",paused:"bg-yellow-500",resuming:"bg-blue-400 animate-pulse",locked:"bg-amber-500 animate-pulse"};function Ds({paneId:s}){const{formatMessage:t}=G(),o=L(ke),i=L(Oe),n=L(D=>D.layout),r=L(D=>D.splitPane),l=L(D=>D.closePane),x=L(D=>D.assignSession),c=L(D=>D.setFocused),u=L(D=>D.setPaneDisplayMode),p=o[s],m=(p==null?void 0:p.sessionId)??null,f=(p==null?void 0:p.displayMode)??"terminal",v=(p==null?void 0:p.filePath)??null,T=i===s,h=Ys(n).length>1,C=f==="file"&&v,N=se(hs),M=ge(D=>D.sessions),j=se(D=>D.pauseSession),y=se(D=>D.resumeSession),P=se(D=>D.restartSession),U=se(D=>D.closeSession),[_,b]=a.useState(!1),[w,I]=a.useState(!1),[q,O]=a.useState(!1),[V,ee]=a.useState(!1),{content:te,isLoading:J,error:H}=Tt(v,{enabled:f==="file"&&!!v}),S=ne(ye),Q=a.useMemo(()=>!m||!S?null:S.sessionId===m?S.issueId:null,[m,S]),E=m?N[m]:null,F=(E==null?void 0:E.status)??"idle",oe=(E==null?void 0:E.alertCount)??0,ae=m&&!M[m];a.useEffect(()=>{if(ae){const D=setTimeout(()=>{x(s,null)},3e3);return()=>clearTimeout(D)}},[ae,s,x]);const be=a.useMemo(()=>Object.keys(M).map(ce=>{const Z=M[ce],Ts=Z?Z.tool?`${Z.tool} - ${Z.shellKind}`:Z.shellKind:ce;return{id:ce,name:Ts}}),[M]),d=a.useCallback(()=>{c(s)},[s,c]),A=a.useCallback(()=>{r(s,"horizontal")},[s,r]),K=a.useCallback(()=>{r(s,"vertical")},[s,r]),Y=a.useCallback(()=>{m?ee(!0):l(s)},[s,m,l]),g=a.useCallback(()=>{l(s),ee(!1)},[s,l]),R=a.useCallback(D=>{const ce=D.target.value,Z=ce?M[ce]:null;x(s,ce||null,(Z==null?void 0:Z.cliTool)??(Z==null?void 0:Z.tool)??null)},[s,x,M]),$=a.useCallback(()=>{m&&(x(s,null),queueMicrotask(()=>x(s,m)))},[s,m,x]),X=a.useCallback(async()=>{if(!(!m||_)){b(!0);try{await P(m)}catch(D){console.error("[TerminalPane] Restart failed:",D)}finally{b(!1)}}},[m,_,P]),xe=a.useCallback(async()=>{if(!(!m||w)){I(!0);try{F==="paused"?await y(m):(F==="active"||F==="idle")&&await j(m)}catch(D){console.error("[TerminalPane] Toggle pause failed:",D)}finally{I(!1)}}},[m,w,F,j,y]),De=a.useCallback(async()=>{if(!(!m||q)){O(!0);try{await U(m),x(s,null)}catch(D){console.error("[TerminalPane] Close session failed:",D)}finally{O(!1)}}},[m,q,U,s,x]),Re=a.useCallback(()=>{u(s,"terminal")},[s,u]);return e.jsxs("div",{className:k("flex flex-col h-full border border-border/50 rounded-sm overflow-hidden",T&&"ring-1 ring-primary/40"),onClick:d,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1 px-2 py-1 border-b border-border bg-muted/30 shrink-0 overflow-hidden",children:[e.jsx("div",{className:"flex items-center gap-1.5 min-w-0 overflow-hidden",children:C?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:Re,className:"p-0.5 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground shrink-0",title:t({id:"terminalDashboard.pane.backToTerminal",defaultMessage:"Back to terminal"}),children:e.jsx(Js,{className:"w-3.5 h-3.5"})}),e.jsx(Ss,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs truncate",title:v??void 0,children:(v==null?void 0:v.split("/").pop())??"File"})]}):e.jsxs(e.Fragment,{children:[ae?e.jsx(ts,{className:"w-3.5 h-3.5 text-yellow-500 shrink-0"}):m&&e.jsx("span",{className:k("w-2 h-2 rounded-full shrink-0",ia[F])}),e.jsxs("div",{className:"relative min-w-0 overflow-hidden",children:[e.jsxs("select",{value:m??"",onChange:R,className:k("text-xs bg-transparent border-none outline-none cursor-pointer","appearance-none pr-4 max-w-[140px] truncate",!m&&"text-muted-foreground"),children:[e.jsx("option",{value:"",children:t({id:"terminalDashboard.pane.selectSession"})}),be.map(D=>e.jsx("option",{value:D.id,children:D.name},D.id))]}),e.jsx(ms,{className:"absolute right-0 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground pointer-events-none"})]})]})}),Q&&!C&&e.jsx("span",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-primary/10 text-primary shrink-0 hidden sm:inline-flex",children:Q}),e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx("button",{onClick:A,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.splitHorizontal"}),children:e.jsx(wt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:K,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.splitVertical"}),children:e.jsx(yt,{className:"w-3.5 h-3.5"})}),!C&&m&&!ae&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:X,disabled:_,className:k("p-1 rounded hover:bg-muted transition-colors",_?"text-muted-foreground/50":"text-muted-foreground hover:text-foreground"),title:t({id:"terminalDashboard.pane.restart"}),children:_?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Xs,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:xe,disabled:w||F==="resuming",className:k("p-1 rounded hover:bg-muted transition-colors",w||F==="resuming"?"text-muted-foreground/50":F==="paused"?"text-yellow-500 hover:text-yellow-600":"text-muted-foreground hover:text-foreground"),title:t({id:F==="paused"?"terminalDashboard.pane.resume":"terminalDashboard.pane.pause"}),children:w||F==="resuming"?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):F==="paused"?e.jsx(we,{className:"w-3.5 h-3.5"}):e.jsx(Me,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:$,className:"p-1 rounded hover:bg-muted transition-colors text-muted-foreground hover:text-foreground",title:t({id:"terminalDashboard.pane.clearTerminal"}),children:e.jsx(qt,{className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:De,disabled:q,className:k("p-1 rounded hover:bg-muted transition-colors",q?"text-muted-foreground/50":"text-muted-foreground hover:text-destructive"),title:t({id:"terminalDashboard.pane.closeSession"}),children:q?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Zs,{className:"w-3.5 h-3.5"})})]}),oe>0&&!C&&e.jsxs("span",{className:"flex items-center gap-0.5 px-1 text-destructive",children:[e.jsx(fs,{className:"w-3 h-3"}),e.jsx("span",{className:"text-[10px] font-semibold tabular-nums",children:oe>99?"99+":oe})]}),h&&e.jsx("button",{onClick:Y,className:"p-1 rounded hover:bg-destructive/10 transition-colors text-muted-foreground hover:text-destructive",title:t({id:"terminalDashboard.pane.closePane"}),children:e.jsx(gs,{className:"w-3.5 h-3.5"})})]})]}),C?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(It,{fileContent:te,isLoading:J,error:(H==null?void 0:H.message)??null,className:"h-full"})}):ae?e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center px-4",children:[e.jsx(ts,{className:"h-6 w-6 mx-auto mb-1.5 text-yellow-500"}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:t({id:"terminalDashboard.pane.sessionNotFound"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70 max-w-[200px]",children:t({id:"terminalDashboard.pane.sessionNotFoundHint"})})]})}):m?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(ra,{sessionId:m})}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(le,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:t({id:"terminalDashboard.pane.selectSession"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:t({id:"terminalDashboard.pane.selectSessionHint"})})]})}),e.jsx(Qe,{open:V,onOpenChange:ee,children:e.jsxs($e,{children:[e.jsxs(He,{children:[e.jsx(Be,{children:t({id:"terminalDashboard.pane.closeConfirmTitle"})}),e.jsx(Ge,{children:t({id:"terminalDashboard.pane.closeConfirmMessage"})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{children:t({id:"common.actions.cancel"})}),e.jsx(Ke,{onClick:g,children:t({id:"terminalDashboard.pane.closeConfirmAction"})})]})]})})]})}function Ps({group:s,minSize:t,depth:o=0}){const i=L(ke),n=L(c=>c.updateLayoutSizes),r=a.useCallback(c=>{n(c)},[n]),l=a.useMemo(()=>s.children.filter(c=>Ne(c)?i[c]!==void 0:!0),[s.children,i]);if(l.length===0)return null;const x=a.useMemo(()=>l.map(c=>Ne(c)?c:"group").join("-"),[l]);return e.jsx(he,{vertical:s.direction==="vertical",defaultSizes:s.sizes,onChange:r,children:l.map((c,u)=>e.jsx(he.Pane,{minSize:t,children:Ne(c)?e.jsx(Ds,{paneId:c}):e.jsx(Ps,{group:c,minSize:t,depth:o+1})},Ne(c)?c:`group-${o}-${u}`))},x)}function la({className:s}){const t=L(et),o=L(ke),i=a.useMemo(()=>{if(!t.children||t.children.length===0)return null;if(t.children.length===1&&Ne(t.children[0])){const n=t.children[0];return o[n]?e.jsx(Ds,{paneId:n}):null}return e.jsx(Ps,{group:t,minSize:150,depth:0})},[t,o]);return e.jsx("div",{className:k("h-full w-full overflow-hidden bg-background",s),children:i})}const oa={active:"bg-green-500",idle:"bg-gray-400",error:"bg-red-500",paused:"bg-yellow-500",resuming:"bg-blue-400 animate-pulse",locked:"bg-purple-500"};function ca(){const{formatMessage:s}=G(),t=se(st),o=se(hs),i=se(h=>h.setActiveTerminal),n=ge(h=>h.sessions),r=L(ke),l=L(h=>h.assignSession),x=L(h=>h.setFocused),[c,u]=a.useState(new Set),p=Ce(Se);a.useEffect(()=>{u(new Set)},[p]);const m=a.useCallback(h=>{u(C=>{const N=new Set(C);return N.has(h)?N.delete(h):N.add(h),N})},[]),f=a.useCallback(h=>{i(h);const C=Object.entries(r).find(([,N])=>N.sessionId===h);if(C)x(C[0]);else{const M=L.getState().focusedPaneId||Object.keys(r)[0];if(M){const j=n[h];l(M,h,(j==null?void 0:j.cliTool)??(j==null?void 0:j.tool)??null),x(M)}}},[i,r,x,l]),v=a.useMemo(()=>{const h={},C=[];for(const M of Object.keys(n)){const j=o[M],y=j==null?void 0:j.tag;y?(h[y]||(h[y]={tag:y,sessionIds:[]}),h[y].sessionIds.push(M)):C.push(M)}const N=Object.values(h).sort((M,j)=>j.tag.localeCompare(M.tag));return C.length>0&&N.push({tag:"__untagged__",sessionIds:C}),N},[n,o]),T=a.useMemo(()=>{const h={};for(const[C,N]of Object.entries(n))h[C]=N.tool??N.shellKind;return h},[n]);return Object.keys(n).length===0?e.jsx("div",{className:"flex flex-col h-full",children:e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-1.5 text-muted-foreground p-4",children:[e.jsx(le,{className:"w-6 h-6 opacity-30"}),e.jsx("p",{className:"text-xs text-center",children:s({id:"terminalDashboard.sessionTree.noGroups"})}),e.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:'Click "New Session" to create one'})]})}):e.jsx("div",{className:"flex flex-col h-full",children:e.jsx("div",{className:"flex-1 overflow-y-auto",children:v.map(h=>{const C=c.has(h.tag),M=h.tag==="__untagged__"?"Other Sessions":h.tag;return e.jsxs("div",{className:"border-b border-border/50 last:border-b-0",children:[e.jsxs("button",{onClick:()=>m(h.tag),className:k("flex items-center gap-1.5 w-full px-3 py-2 text-left","hover:bg-muted/50 transition-colors text-sm"),children:[e.jsx(tt,{className:k("w-3.5 h-3.5 text-muted-foreground transition-transform shrink-0",C&&"rotate-90")}),e.jsx(at,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"flex-1 truncate font-medium text-xs",children:M}),e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:h.sessionIds.length})]}),C&&e.jsx("div",{className:"pb-1",children:h.sessionIds.map(j=>{const y=o[j],P=(y==null?void 0:y.status)??"idle";return e.jsxs("div",{className:k("flex items-center gap-1.5 mx-1 px-2 py-1.5 rounded-sm cursor-pointer","hover:bg-muted/50 transition-colors text-sm",t===j&&"bg-primary/10 text-primary"),onClick:()=>f(j),children:[e.jsx("span",{className:k("w-2 h-2 rounded-full shrink-0",oa[P]),title:P}),e.jsx(le,{className:"w-3.5 h-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"flex-1 truncate text-xs",children:T[j]??j})]},j)})})]},h.tag)})})})}const is={"skill-team-issue":s=>`完成 ${s} issue`,"ccw-cli":s=>`完成.issue.jsonl中 ${s} issue`,"direct-send":s=>`根据@.workflow/issues/issues.jsonl中的 ${s} 需求,进行开发`};function da(s){return`根据@.workflow/issues/issues.jsonl中的 ${s.map(o=>o.id).join(" ")} 需求,进行开发`}const ls={critical:{variant:"destructive",label:"Critical"},high:{variant:"warning",label:"High"},medium:{variant:"info",label:"Medium"},low:{variant:"secondary",label:"Low"}};function ua({priority:s}){const t=ls[s]??ls.medium;return e.jsx(re,{variant:t.variant,className:"text-[10px] px-1.5 py-0 shrink-0",children:t.label})}function ma({status:s}){const t={registered:"text-info",planning:"text-blue-500",planned:"text-blue-600",queued:"text-yellow-500",executing:"text-warning",completed:"text-success",failed:"text-destructive",paused:"text-muted-foreground"};return e.jsx(_t,{className:k("w-3 h-3 shrink-0",t[s]??"text-muted-foreground")})}function xa({issue:s,isSelected:t,isHighlighted:o,isChecked:i,onSelect:n,onToggleCheck:r}){return e.jsxs("div",{role:"button",tabIndex:0,className:k("w-full text-left px-2.5 py-1.5 rounded-md transition-colors","hover:bg-muted/60 focus:outline-none focus:ring-1 focus:ring-primary/30",t&&"bg-primary/10 ring-1 ring-primary/30",o&&!t&&"bg-accent/50"),onClick:n,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),n())},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("input",{type:"checkbox",checked:i,onChange:l=>{l.stopPropagation(),r()},onClick:l=>l.stopPropagation(),className:"w-3.5 h-3.5 rounded border-border accent-primary shrink-0"}),e.jsx(ma,{status:s.status}),e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:s.title})]}),e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:e.jsx(ua,{priority:s.priority})})]}),s.context&&e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground truncate pl-7",children:s.context}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-2 text-[10px] text-muted-foreground pl-7",children:[e.jsx("span",{className:"font-mono",children:s.id}),s.labels&&s.labels.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"|"}),e.jsx("span",{className:"truncate",children:s.labels.slice(0,2).join(", ")})]})]})]})}function ha(){const{formatMessage:s}=G();return e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(fe,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:s({id:"terminalDashboard.issuePanel.noIssues"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s({id:"terminalDashboard.issuePanel.noIssuesDesc"})})]})})}function fa({error:s}){const{formatMessage:t}=G();return e.jsx("div",{className:"flex-1 flex items-center justify-center text-destructive p-4",children:e.jsxs("div",{className:"text-center",children:[e.jsx(fs,{className:"h-6 w-6 mx-auto mb-1.5 opacity-30"}),e.jsx("p",{className:"text-sm",children:t({id:"terminalDashboard.issuePanel.error"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s.message})]})})}function ga(){const{formatMessage:s}=G(),{issues:t,isLoading:o,error:i,openCount:n}=xs(),r=ne(nt),l=ne(ye),x=ne(g=>g.setSelectedIssue),c=ne(g=>g.buildAssociationChain),[u,p]=a.useState(new Set),[m,f]=a.useState(!1),[v,T]=a.useState(!1),[h,C]=a.useState("skill-team-issue"),[N,M]=a.useState(!1),[j,y]=a.useState(""),P=a.useRef(null),[U,_]=a.useState(!1),[b,w]=a.useState(!1),[I,q]=a.useState("write"),O=a.useRef(null),V=z(g=>g.submitItems),ee=L(Oe),te=L(ke),J=Ce(Se),H=ee?te[ee]:null,S=(H==null?void 0:H.sessionId)??null,Q=(H==null?void 0:H.cliTool)??null,E=a.useMemo(()=>Q==="claude"?[{value:"skill-team-issue",label:"team-issue"},{value:"ccw-cli",label:"ccw"},{value:"direct-send",label:"Direct send"}]:[{value:"direct-send",label:"Direct send"}],[Q]);a.useEffect(()=>{E.find(g=>g.value===h)||C(E[0].value)},[E,h]),a.useEffect(()=>()=>{P.current&&clearTimeout(P.current),O.current&&clearTimeout(O.current)},[]),a.useEffect(()=>{P.current&&clearTimeout(P.current),O.current&&clearTimeout(O.current),p(new Set),f(!1),T(!1),C("skill-team-issue"),M(!1),y(""),_(!1),w(!1),q("write")},[J]);const F=a.useMemo(()=>{const g={critical:0,high:1,medium:2,low:3},R={in_progress:0,open:1,resolved:2,completed:3,closed:4};return[...t].sort(($,X)=>{const xe=R[$.status]??5,De=R[X.status]??5;if(xe!==De)return xe-De;const Re=g[$.priority]??3,D=g[X.priority]??3;return Re-D})},[t]),oe=a.useCallback(g=>{r===g?x(null):c(g,"issue")},[r,x,c]),ae=a.useCallback(g=>{p(R=>{const $=new Set(R);return $.has(g)?$.delete(g):$.add(g),$})},[]),be=a.useCallback(()=>{p(new Set(F.map(g=>g.id)))},[F]),d=a.useCallback(()=>{p(new Set)},[]),A=a.useCallback(()=>{const g=Array.from(u).join(" ");y(is[h](g)),M(!0)},[u,h]),K=a.useCallback(async()=>{if(!S||u.size===0)return;const g=Q||"claude";f(!0);try{const R=j.trim();let $;switch(h){case"skill-team-issue":$={tool:g,prompt:R,instructionType:"skill",skillName:"team-issue"};break;case"ccw-cli":$={tool:g,prompt:R,instructionType:"skill",skillName:"ccw"};break;case"direct-send":$={tool:g,prompt:R,instructionType:"prompt"};break}await rt(S,$,J||void 0),ve.success("Sent to terminal",R.length>60?R.slice(0,60)+"...":R),T(!0),M(!1),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>T(!1),2e3)}catch(R){ve.error("Failed to send",R instanceof Error?R.message:String(R))}finally{f(!1)}},[S,u,J,h,Q,j]),Y=a.useCallback(async()=>{if(u.size!==0){_(!0);try{const g=F.filter(X=>u.has(X.id)),R=new Date().toISOString(),$=g.map((X,xe)=>({item_id:`Q-${X.id}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,issue_id:X.id,status:"pending",tool:Q||"gemini",prompt:da([X]),mode:I,depends_on:[],execution_order:xe+1,execution_group:"default",createdAt:R,metadata:{issueTitle:X.title,issuePriority:X.priority}}));await V($),ve.success(s({id:"terminalDashboard.issuePanel.addedToQueue",defaultMessage:"Added to queue"}),`${$.length} item(s)`),w(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>w(!1),2e3)}catch(g){ve.error(s({id:"terminalDashboard.issuePanel.addToQueueFailed",defaultMessage:"Failed to add to queue"}),g instanceof Error?g.message:String(g))}finally{_(!1)}}},[u,F,Q,V,s]);return o?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]})}),e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx(W,{className:"w-5 h-5 animate-spin text-muted-foreground"})})]}):i?e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]})}),e.jsx(fa,{error:i})]}):e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-3 py-2 border-b border-border shrink-0 flex items-center justify-between",children:[e.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[e.jsx(fe,{className:"w-4 h-4"}),s({id:"terminalDashboard.issuePanel.title"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[F.length>0&&e.jsx("button",{type:"button",className:"text-[10px] text-muted-foreground hover:text-foreground px-1",onClick:u.size===F.length?d:be,children:u.size===F.length?"Deselect all":"Select all"}),n>0&&e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:n})]})]}),F.length===0?e.jsx(ha,{}):e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1.5 space-y-0.5",children:F.map(g=>e.jsx(xa,{issue:g,isSelected:r===g.id,isHighlighted:(l==null?void 0:l.issueId)===g.id,isChecked:u.has(g.id),onSelect:()=>oe(g.id),onToggleCheck:()=>ae(g.id)},g.id))}),u.size>0&&e.jsxs("div",{className:"border-t border-border shrink-0",children:[N&&e.jsxs("div",{className:"px-3 py-2 space-y-2 border-b border-border bg-muted/20",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Send Configuration"}),e.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>M(!1),children:e.jsx(gs,{className:"w-3.5 h-3.5"})})]}),E.length>1&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:"Method"}),e.jsxs(Pe,{value:h,onValueChange:g=>{const R=g;C(R);const $=Array.from(u).join(" ");y(is[R]($))},children:[e.jsx(Te,{className:"h-6 w-full text-xs",children:e.jsx(Ie,{})}),e.jsx(Ae,{children:E.map(g=>e.jsx(me,{value:g.value,className:"text-xs",children:g.label},g.value))})]})]}),h!=="direct-send"&&e.jsxs("div",{className:"text-[10px] text-muted-foreground",children:["Prefix: ",e.jsxs("span",{className:"font-mono text-foreground",children:["/",h==="skill-team-issue"?"team-issue":"ccw"]})]}),e.jsx("textarea",{className:"w-full text-xs bg-background border border-border rounded-md px-2 py-1.5 resize-none focus:outline-none focus:ring-1 focus:ring-primary/40 text-foreground",rows:3,value:j,onChange:g=>y(g.target.value),placeholder:"Enter prompt..."}),e.jsxs("button",{type:"button",className:k("w-full flex items-center justify-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-colors","bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:!S||m||!j.trim(),onClick:K,children:[m?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(Ft,{className:"w-3.5 h-3.5"}),"Confirm Send"]})]}),e.jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:[u.size," selected"]}),e.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:d,children:"Clear"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("select",{className:"h-6 text-[10px] rounded border border-border bg-background px-1 text-muted-foreground",value:I,onChange:g=>q(g.target.value),title:s({id:"terminalDashboard.issuePanel.queueModeHint",defaultMessage:"Execution mode for queued items"}),children:[e.jsx("option",{value:"write",children:"write"}),e.jsx("option",{value:"analysis",children:"analysis"}),e.jsx("option",{value:"auto",children:"auto"})]}),e.jsxs("button",{type:"button",className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors",b?"bg-green-600 text-white":"bg-muted text-foreground hover:bg-muted/80","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:U,onClick:Y,title:s({id:"terminalDashboard.issuePanel.addToQueueHint",defaultMessage:"Add selected issues to the execution queue"}),children:[U?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):b?e.jsx(Je,{className:"w-3.5 h-3.5"}):e.jsx(zt,{className:"w-3.5 h-3.5"}),s(b?{id:"terminalDashboard.issuePanel.addedToQueue",defaultMessage:"Queued!"}:{id:"terminalDashboard.issuePanel.addToQueue",defaultMessage:"Queue"})]}),e.jsxs("button",{type:"button",className:k("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium transition-colors",v?"bg-green-600 text-white":"bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),disabled:!S||m,onClick:N?K:A,title:S?`Send via ${h}`:"No terminal session focused",children:[m?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):v?e.jsx(Je,{className:"w-3.5 h-3.5"}):e.jsx(le,{className:"w-3.5 h-3.5"}),v?"Sent!":`Send (${u.size})`]})]})]})]})]})}const os={pending:{variant:"secondary",icon:js,label:"Pending"},queued:{variant:"info",icon:ct,label:"Queued"},ready:{variant:"info",icon:ot,label:"Ready"},blocked:{variant:"outline",icon:lt,label:"Blocked"},executing:{variant:"warning",icon:W,label:"Executing"},completed:{variant:"success",icon:it,label:"Completed"},failed:{variant:"destructive",icon:bs,label:"Failed"},cancelled:{variant:"secondary",icon:pe,label:"Cancelled"}},pa={idle:"bg-muted text-muted-foreground",running:"bg-blue-500/15 text-blue-600",paused:"bg-yellow-500/15 text-yellow-600",stopping:"bg-orange-500/15 text-orange-600",completed:"bg-green-500/15 text-green-600",failed:"bg-red-500/15 text-red-600"};function ba({item:s,isHighlighted:t,onSelect:o}){const{formatMessage:i}=G(),n=os[s.status]??os.pending,r=n.icon,l=vs(dt(s.item_id)),x=l.find(f=>f.status==="running")??l[0],c=s.sessionKey??(x==null?void 0:x.sessionKey),u=s.status==="executing",p=s.status==="blocked",m=s.issue_id?`${s.issue_id}`:s.item_id;return e.jsxs("button",{type:"button",className:k("w-full text-left px-2.5 py-1.5 rounded-md transition-colors","hover:bg-muted/60 focus:outline-none focus:ring-1 focus:ring-primary/30",t&&"bg-accent/50 ring-1 ring-accent/30",u&&"border-l-2 border-l-blue-500"),onClick:o,children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(r,{className:k("w-3 h-3 shrink-0",u&&"animate-spin")}),e.jsx("span",{className:"text-xs font-medium text-foreground truncate font-mono",children:m})]}),e.jsx(re,{variant:n.variant,className:"text-[10px] px-1 py-0 shrink-0",children:i({id:`terminalDashboard.queuePanel.status.${s.status}`,defaultMessage:n.label})})]}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5 text-[10px] text-muted-foreground pl-4",children:[s.execution_group&&e.jsx("span",{children:s.execution_group}),c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-border",children:"|"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(le,{className:"w-2.5 h-2.5"}),c]})]})]}),p&&s.depends_on.length>0&&e.jsx("div",{className:"mt-0.5 text-[10px] text-orange-500/80 pl-4 truncate",children:i({id:"terminalDashboard.queuePanel.blockedBy",defaultMessage:"Blocked by: {deps}"},{deps:s.depends_on.join(", ")})})]})}function ja(){const{formatMessage:s}=G(),t=z(qe),o=z(Ns),i=z(ws),n=z(ys),r=z(N=>N.startQueue),l=z(N=>N.pauseQueue),x=z(N=>N.stopQueue),c=z(ps),u=t==="idle"&&c.length>0,p=t==="running",m=t==="paused",f=t==="running"||t==="paused",v=t!=="idle",[T,h]=a.useState(!1),C=a.useCallback(()=>{m?r():u&&r(c)},[m,u,r,c]);return e.jsxs("div",{className:"border-t border-border px-2.5 py-1.5 shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(re,{variant:"outline",className:k("text-[10px] px-1.5 py-0",pa[t]),children:s({id:`terminalDashboard.queuePanel.scheduler.status.${t}`,defaultMessage:t})}),v&&e.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[o,"% | ",i,"/",(n==null?void 0:n.maxConcurrentSessions)??2]}),e.jsxs("div",{className:"flex items-center gap-0.5",children:[(u||m)&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:C,title:s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Start"}),children:e.jsx(we,{className:"w-3 h-3"})}),p&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:l,title:s({id:"terminalDashboard.queuePanel.scheduler.pause",defaultMessage:"Pause"}),children:e.jsx(Me,{className:"w-3 h-3"})}),f&&e.jsx("button",{type:"button",className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground",onClick:()=>h(!0),title:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"}),children:e.jsx(Ot,{className:"w-3 h-3"})})]})]}),v&&e.jsx("div",{className:"mt-1 h-1 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-300",style:{width:`${o}%`}})}),e.jsx(Qe,{open:T,onOpenChange:h,children:e.jsxs($e,{className:"max-w-sm",children:[e.jsxs(He,{children:[e.jsx(Be,{className:"text-base",children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmTitle",defaultMessage:"Stop Queue?"})}),e.jsx(Ge,{children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmMessage",defaultMessage:"Executing tasks will finish, but no new tasks will be started."})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{className:"h-8 text-xs",children:s({id:"common.cancel",defaultMessage:"Cancel"})}),e.jsx(Ke,{className:"h-8 text-xs bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{x(),h(!1)},children:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})})]})]})})]})}function va(){const{formatMessage:s}=G(),t=z(ps),o=ne(ye),i=ne(l=>l.buildAssociationChain),n=a.useMemo(()=>[...t].sort((l,x)=>l.execution_order-x.execution_order),[t]),r=a.useCallback(l=>{i(l,"queue")},[i]);return e.jsxs("div",{className:"flex flex-col h-full",children:[n.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground p-3",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ze,{className:"h-5 w-5 mx-auto mb-1 opacity-30"}),e.jsx("p",{className:"text-xs",children:s({id:"terminalDashboard.queuePanel.noItems"})}),e.jsx("p",{className:"text-[10px] mt-0.5 opacity-70",children:s({id:"terminalDashboard.queuePanel.noItemsDesc",defaultMessage:"Select issues and click Queue to add items"})})]})}):e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-1 space-y-0.5",children:n.map(l=>e.jsx(ba,{item:l,isHighlighted:(o==null?void 0:o.queueItemId)===l.item_id,onSelect:()=>r(l.item_id)},l.item_id))}),e.jsx(ja,{})]})}const Na={idle:"bg-muted text-muted-foreground border-border",running:"bg-primary/10 text-primary border-primary/50",paused:"bg-amber-500/10 text-amber-500 border-amber-500/50",stopping:"bg-orange-500/10 text-orange-500 border-orange-500/50",completed:"bg-green-500/10 text-green-500 border-green-500/50",failed:"bg-destructive/10 text-destructive border-destructive/50"};function wa(){const{formatMessage:s}=G(),t=z(qe),o=z(Ns),i=z(ys),n=z(ut),r=z(ws),l=z(mt),x=z(y=>y.startQueue),c=z(y=>y.pauseQueue),u=z(y=>y.stopQueue),p=z(y=>y.updateConfig),m=t==="idle",f=t==="running",v=t==="paused",T=t==="stopping",h=t==="completed"||t==="failed",[C,N]=a.useState(!1),M=a.useCallback(y=>{const P=parseInt(y.target.value,10);!isNaN(P)&&P>=1&&P<=10&&p({maxConcurrentSessions:P})},[p]),j=Object.entries(n??{});return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-3 py-3 border-b border-border space-y-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:k("px-2.5 py-1 rounded text-xs font-medium border",Na[t]),children:s({id:`terminalDashboard.queuePanel.scheduler.status.${t}`,defaultMessage:t})}),e.jsxs("span",{className:"text-xs text-muted-foreground ml-auto tabular-nums",children:[r,"/",(i==null?void 0:i.maxConcurrentSessions)??2]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(m||h)&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:()=>x(),children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Start"})]}),v&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:()=>x(),children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.start",defaultMessage:"Resume"})]}),f&&e.jsxs(B,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5 flex-1",onClick:c,children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.pause",defaultMessage:"Pause"})]}),(f||v)&&e.jsxs(B,{variant:"destructive",size:"sm",className:"h-7 text-xs gap-1.5",disabled:T,onClick:()=>N(!0),children:[T?e.jsx(W,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(pe,{className:"w-3.5 h-3.5"}),s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})]})]}),!m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Cs,{value:o,className:"h-1.5 flex-1",indicatorClassName:k(t==="failed"&&"bg-destructive",t==="completed"&&"bg-green-500",t==="paused"&&"bg-amber-500",(t==="running"||t==="stopping")&&"bg-primary")}),e.jsx("span",{className:"text-[10px] text-muted-foreground tabular-nums shrink-0",children:s({id:"terminalDashboard.queuePanel.scheduler.progress",defaultMessage:"{percent}%"},{percent:o})})]})]}),e.jsx("div",{className:"px-3 py-2.5 border-b border-border shrink-0",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:s({id:"terminalDashboard.queuePanel.scheduler.concurrency",defaultMessage:"Concurrency"})}),e.jsx("input",{type:"number",min:1,max:10,value:(i==null?void 0:i.maxConcurrentSessions)??2,onChange:M,className:"w-14 h-6 text-xs text-center rounded border border-border bg-background px-1"})]})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsxs("div",{className:"px-3 py-2",children:[e.jsx("h4",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider mb-2",children:s({id:"terminalDashboard.schedulerPanel.sessionPool",defaultMessage:"Session Pool"})}),j.length===0?e.jsx("p",{className:"text-xs text-muted-foreground/60 py-2",children:s({id:"terminalDashboard.schedulerPanel.noSessions",defaultMessage:"No active sessions"})}):e.jsx("div",{className:"space-y-1",children:j.map(([y,P])=>e.jsxs("div",{className:"flex items-center justify-between px-2 py-1.5 rounded bg-muted/30 text-xs",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"font-mono text-foreground truncate block",children:P.sessionKey}),e.jsx("span",{className:"text-[10px] text-muted-foreground truncate block",children:y})]}),e.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0 ml-2 tabular-nums",children:new Date(P.lastUsed).toLocaleTimeString()})]},y))})]})}),l&&e.jsx("div",{className:"px-3 py-2 border-t border-destructive/30 bg-destructive/5 shrink-0",children:e.jsx("p",{className:"text-xs text-destructive break-words",children:l})}),e.jsx(Qe,{open:C,onOpenChange:N,children:e.jsxs($e,{className:"max-w-sm",children:[e.jsxs(He,{children:[e.jsx(Be,{className:"text-base",children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmTitle",defaultMessage:"Stop Queue?"})}),e.jsx(Ge,{children:s({id:"terminalDashboard.queuePanel.scheduler.stopConfirmMessage",defaultMessage:"Executing tasks will finish, but no new tasks will be started. Pending items will remain in the queue."})})]}),e.jsxs(Ue,{children:[e.jsx(Ve,{className:"h-8 text-xs",children:s({id:"common.cancel",defaultMessage:"Cancel"})}),e.jsx(Ke,{className:"h-8 text-xs bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{u(),N(!1)},children:s({id:"terminalDashboard.queuePanel.scheduler.stop",defaultMessage:"Stop"})})]})]})})]})}function Le({icon:s,label:t,entityId:o,status:i,timestamp:n,isLast:r=!1}){return o?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{className:"w-3.5 h-3.5 text-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs font-mono font-semibold text-foreground px-1.5 py-0.5 rounded bg-muted",children:o}),i&&e.jsx("span",{className:"text-[10px] text-muted-foreground px-1 py-0.5 rounded border border-border",children:i}),n&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:ya(n)}),!r&&e.jsx(ss,{className:"w-3 h-3 text-muted-foreground mx-1"})]}):e.jsxs("div",{className:"flex items-center gap-2 opacity-40",children:[e.jsx(s,{className:"w-3.5 h-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t}),e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"--"}),!r&&e.jsx(ss,{className:"w-3 h-3 text-muted-foreground mx-1"})]})}function ya(s){try{return new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return s}}function Ca(){const{formatMessage:s}=G(),t=ne(ye),{chain:o}=$t(),i=o??t,n=a.useMemo(()=>{if(!i)return null;const l=Object.values(vs.getState().executions),x=ge.getState().sessions;let c,u;if(i.queueItemId){const f=l.find(v=>v.queueItemId===i.queueItemId);f&&(c=f.status,u=f.startedAt)}let p,m;if(i.sessionId){const f=x[i.sessionId];f&&(p="active",m=f.createdAt)}return{queueStatus:c,executionTimestamp:u,sessionStatus:p,sessionTimestamp:m}},[i]),r=i!==null;return e.jsx("div",{className:"h-full overflow-y-auto px-4 py-3",children:r?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s({id:"terminalDashboard.inspector.associationChain"})}),e.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[e.jsx(Le,{icon:fe,label:"Issue",entityId:i.issueId}),e.jsx(Le,{icon:ze,label:"Queue",entityId:i.queueItemId,status:n==null?void 0:n.queueStatus,timestamp:n==null?void 0:n.executionTimestamp}),e.jsx(Le,{icon:le,label:"Session",entityId:i.sessionId,status:n==null?void 0:n.sessionStatus,timestamp:n==null?void 0:n.sessionTimestamp,isLast:!0})]})]}):e.jsx("p",{className:"text-xs text-muted-foreground",children:s({id:"terminalDashboard.inspector.noSelection"})})})}const cs={pending:{label:"Pending",color:"text-muted-foreground",bgColor:"bg-muted"},running:{label:"Running",color:"text-primary",bgColor:"bg-primary/10"},paused:{label:"Paused",color:"text-amber-500",bgColor:"bg-amber-500/10"},completed:{label:"Completed",color:"text-green-500",bgColor:"bg-green-500/10"},failed:{label:"Failed",color:"text-destructive",bgColor:"bg-destructive/10"},cancelled:{label:"Cancelled",color:"text-muted-foreground",bgColor:"bg-muted"}},ds={running:{variant:"info",messageId:"terminalDashboard.agentList.statusRunning"},completed:{variant:"success",messageId:"terminalDashboard.agentList.statusCompleted"},failed:{variant:"destructive",messageId:"terminalDashboard.agentList.statusFailed"},paused:{variant:"warning",messageId:"terminalDashboard.agentList.statusPaused"},pending:{variant:"secondary",messageId:"terminalDashboard.agentList.statusPending"},cancelled:{variant:"secondary",messageId:"terminalDashboard.agentList.statusPending"}};function Sa({status:s}){switch(s){case"pending":return e.jsx(Xe,{className:"w-4 h-4 text-muted-foreground"});case"running":return e.jsx(W,{className:"w-4 h-4 text-primary animate-spin"});case"completed":return e.jsx(pt,{className:"w-4 h-4 text-green-500"});case"failed":return e.jsx(bs,{className:"w-4 h-4 text-destructive"});case"paused":return e.jsx(Me,{className:"w-4 h-4 text-amber-500"});case"cancelled":return e.jsx(pe,{className:"w-4 h-4 text-muted-foreground"});default:return e.jsx(Xe,{className:"w-4 h-4 text-muted-foreground opacity-50"})}}function ka({step:s,isCurrent:t}){return e.jsxs("div",{className:k("flex items-start gap-3 px-3 py-2 rounded-md transition-colors",t&&s.status==="running"&&"bg-primary/5 border border-primary/20",s.status==="failed"&&"bg-destructive/5"),children:[e.jsx("div",{className:"pt-0.5 shrink-0",children:e.jsx(Sa,{status:s.status})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:k("text-sm font-medium truncate block",s.status==="completed"&&"text-muted-foreground",s.status==="running"&&"text-foreground",s.status==="failed"&&"text-destructive"),children:s.name}),s.error&&e.jsx("p",{className:"text-xs text-destructive mt-1 truncate",children:s.error})]})]})}function Ma({runState:s}){const{formatMessage:t}=G(),{plan:o,status:i,stepStatuses:n}=s,r=o.steps.length,l=a.useMemo(()=>Object.values(n).filter(u=>u.status==="completed"||u.status==="skipped").length,[n]),x=ds[i]??ds.pending,c=i==="running";return e.jsxs("div",{className:k("flex items-center gap-2 px-3 py-2 rounded-md","hover:bg-muted/30 transition-colors"),children:[e.jsx("div",{className:"shrink-0",children:c?e.jsx(W,{className:"w-4 h-4 text-primary animate-spin"}):e.jsx(ks,{className:"w-4 h-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:o.name}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t({id:"terminalDashboard.agentList.stepLabel"},{current:l,total:r})})]}),e.jsx(re,{variant:x.variant,className:"text-xs px-2 py-0 shrink-0",children:t({id:x.messageId})})]})}function Da(){const{formatMessage:s}=G(),t=ie(xt),o=ie(ht),i=ie(f=>f.selectExecution),n=ie(f=>f.pauseExecution),r=ie(f=>f.resumeExecution),l=ie(f=>f.stopExecution),x=ie(f=>f.clearExecution),c=ft(gt),u=a.useMemo(()=>Object.entries(c),[c]),p=Object.values(o);return p.length>0||u.length>0?e.jsxs("div",{className:"flex flex-col h-full",children:[u.length>0&&e.jsxs("div",{className:"border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted/20",children:[e.jsx(ks,{className:"w-4 h-4 text-muted-foreground"}),e.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:s({id:"terminalDashboard.agentList.title"})}),e.jsx(re,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-auto",children:u.length})]}),e.jsx("div",{className:"divide-y divide-border/50",children:u.map(([f,v])=>e.jsx(Ma,{runState:v},f))})]}),p.length>0&&e.jsxs(e.Fragment,{children:[p.length>1&&e.jsx("div",{className:"border-b border-border p-2 shrink-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:p.map(f=>e.jsx("button",{onClick:()=>i(f.executionId),className:k("px-2 py-1 text-xs rounded-md transition-colors truncate max-w-[120px]",(t==null?void 0:t.executionId)===f.executionId?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80 text-muted-foreground"),children:f.flowName},f.executionId))})}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-4 border-b border-border space-y-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground truncate flex-1",children:t.flowName}),e.jsx(re,{variant:"secondary",className:k("shrink-0",cs[t.status].bgColor),children:cs[t.status].label})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[e.jsx("span",{children:s({id:"executionMonitor.progress",defaultMessage:"{completed}/{total} steps"},{completed:t.completedSteps,total:t.totalSteps||t.steps.length})}),e.jsxs("span",{children:[Math.round(t.completedSteps/(t.totalSteps||t.steps.length||1)*100),"%"]})]}),e.jsx(Cs,{value:t.completedSteps/(t.totalSteps||t.steps.length||1)*100,className:"h-2"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(js,{className:"w-3 h-3"}),new Date(t.startedAt).toLocaleTimeString()]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(le,{className:"w-3 h-3"}),e.jsxs("span",{className:"truncate max-w-[100px]",children:[t.sessionKey.slice(0,20),"..."]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:t.steps.map(f=>e.jsx(ka,{step:f,isCurrent:f.id===t.currentStepId},f.id))}),e.jsxs("div",{className:"p-3 border-t border-border flex items-center gap-2 shrink-0",children:[t.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsxs(B,{variant:"outline",size:"sm",onClick:()=>n(t.executionId),className:"gap-1.5",children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.pause",defaultMessage:"Pause"})]}),e.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>l(t.executionId),className:"gap-1.5",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.stop",defaultMessage:"Stop"})]})]}),t.status==="paused"&&e.jsxs(e.Fragment,{children:[e.jsxs(B,{variant:"default",size:"sm",onClick:()=>r(t.executionId),className:"gap-1.5",children:[e.jsx(we,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.resume",defaultMessage:"Resume"})]}),e.jsxs(B,{variant:"destructive",size:"sm",onClick:()=>l(t.executionId),className:"gap-1.5",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),s({id:"executionMonitor.stop",defaultMessage:"Stop"})]})]}),(t.status==="completed"||t.status==="failed"||t.status==="cancelled")&&e.jsx(B,{variant:"outline",size:"sm",onClick:()=>x(t.executionId),className:"gap-1.5 ml-auto",children:s({id:"executionMonitor.clear",defaultMessage:"Clear"})})]})]})]})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground p-8",children:[e.jsx(le,{className:"w-10 h-10 mb-3 opacity-30"}),e.jsx("p",{className:"text-sm font-medium",children:s({id:"executionMonitor.noExecutions",defaultMessage:"No active executions"})}),e.jsx("p",{className:"text-xs mt-1 opacity-70",children:s({id:"executionMonitor.sendToTerminal",defaultMessage:"Send a workflow to terminal to start"})})]})}function Pa({rootPath:s,enabled:t=!0,className:o,onCollapse:i,width:n=280}){const{formatMessage:r}=G(),l=L(Oe),x=L(y=>y.showFileInPane),{rootNodes:c,state:u,isLoading:p,isFetching:m,error:f,refetch:v,setSelectedFile:T,toggleExpanded:h,toggleShowHidden:C}=At({rootPath:s,maxDepth:6,enabled:t}),N=a.useCallback(y=>{y.type==="file"&&(T(y.path),l&&x(l,y.path))},[l,T,x]),M=a.useCallback(()=>{v()},[v]),j=a.useCallback(()=>{i==null||i()},[i]);return t?e.jsxs("div",{className:k("flex flex-col h-full border-l border-border bg-background",o),style:{width:n},children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-2 border-b border-border bg-muted/30 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[e.jsx(Ee,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-xs font-medium truncate",children:r({id:"terminalDashboard.fileSidebar.title",defaultMessage:"Files"})}),m&&!p&&e.jsx(W,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:C,title:r({id:"terminalDashboard.fileBrowser.showHidden"}),children:u.showHiddenFiles?e.jsx(Rt,{className:"h-3.5 w-3.5"}):e.jsx(Lt,{className:"h-3.5 w-3.5"})}),e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:M,disabled:m,title:r({id:"terminalDashboard.fileSidebar.refresh",defaultMessage:"Refresh"}),children:e.jsx(us,{className:k("h-3.5 w-3.5",m&&"animate-spin")})}),i&&e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j,title:r({id:"terminalDashboard.fileSidebar.collapse",defaultMessage:"Collapse"}),children:e.jsx(Ze,{className:"h-3.5 w-3.5"})})]})]}),e.jsx("div",{className:"px-3 py-1.5 border-b border-border/50 bg-muted/10 shrink-0",children:e.jsx("div",{className:"text-[10px] text-muted-foreground truncate font-mono",title:s,children:s})}),e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:p?e.jsxs("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[e.jsx(W,{className:"w-5 h-5 animate-spin"}),e.jsx("span",{className:"ml-2 text-xs",children:r({id:"terminalDashboard.fileBrowser.loading",defaultMessage:"Loading..."})})]}):f?e.jsx("div",{className:"p-3 text-xs text-destructive",children:r({id:"terminalDashboard.fileBrowser.loadFailed",defaultMessage:"Failed to load files"})}):c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-8 px-4 text-center text-muted-foreground",children:[e.jsx(Ss,{className:"h-10 w-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-xs",children:r({id:"terminalDashboard.fileSidebar.empty",defaultMessage:"No files found"})})]}):e.jsx(Et,{nodes:c,expandedPaths:u.expandedPaths,selectedPath:u.selectedFile,onNodeClick:N,onToggle:h,maxDepth:0,className:"py-1"})}),!l&&e.jsx("div",{className:"px-3 py-2 border-t border-border bg-muted/10 shrink-0",children:e.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:r({id:"terminalDashboard.fileSidebar.selectPaneHint",defaultMessage:"Click a pane to show file preview"})})})]}):e.jsxs("div",{className:k("flex flex-col h-full border-l border-border bg-background",o),style:{width:n},children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border bg-muted/30",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:r({id:"terminalDashboard.fileSidebar.title",defaultMessage:"Files"})}),i&&e.jsx(B,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j,children:e.jsx(Ze,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-4 text-center text-muted-foreground",children:[e.jsx(Ee,{className:"h-10 w-10 mb-3 opacity-40"}),e.jsx("p",{className:"text-xs",children:r({id:"terminalDashboard.fileSidebar.noProject",defaultMessage:"No project open"})}),e.jsx("p",{className:"text-[10px] mt-1 opacity-70",children:r({id:"terminalDashboard.fileSidebar.openProjectHint",defaultMessage:"Open a project to browse files"})})]})]})}function Wa(){const{formatMessage:s}=G(),[t,o]=a.useState(null),[i,n]=a.useState(!0),[r,l]=a.useState(!0),x=Ce(Se),c=_e(v=>v.featureFlags),u=es(bt),p=es(v=>v.toggleImmersiveMode),m=a.useCallback(v=>{o(T=>T===v?null:v)},[]),f=a.useCallback(()=>{o(null)},[]);return a.useEffect(()=>{o(null)},[x]),e.jsx("div",{className:`flex flex-col overflow-hidden ${u?"h-screen":"h-[calc(100vh-56px)]"}`,children:e.jsxs(Qt,{scopeKey:x??"default",children:[e.jsx(Gt,{activePanel:t,onTogglePanel:m,isFileSidebarOpen:i,onToggleFileSidebar:()=>n(v=>!v),isSessionSidebarOpen:r,onToggleSessionSidebar:()=>l(v=>!v),isFullscreen:u,onToggleFullscreen:p}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsxs(he,{className:"h-full",children:[r&&e.jsx(he.Pane,{preferredSize:240,minSize:180,maxSize:320,children:e.jsx("div",{className:"h-full flex flex-col border-r border-border",children:e.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:e.jsx(ca,{})})})}),e.jsx(he.Pane,{preferredSize:-1,minSize:300,children:e.jsx(la,{})}),i&&e.jsx(he.Pane,{preferredSize:280,minSize:200,maxSize:400,children:e.jsx(Pa,{rootPath:x??"/",enabled:!!x,onCollapse:()=>n(!1)})})]})}),e.jsx(je,{isOpen:t==="issues",onClose:f,title:s({id:"terminalDashboard.toolbar.issues"}),side:"left",width:700,children:e.jsxs("div",{className:"flex h-full",children:[e.jsx("div",{className:"flex-1 min-w-0 border-r border-border",children:e.jsx(ga,{})}),e.jsxs("div",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsx("div",{className:"px-3 py-2 border-b border-border shrink-0",children:e.jsx("h3",{className:"text-sm font-semibold",children:s({id:"terminalDashboard.toolbar.queue"})})}),e.jsx(va,{})]})]})}),c.dashboardQueuePanelEnabled&&e.jsx(je,{isOpen:t==="queue",onClose:f,title:s({id:"terminalDashboard.toolbar.queue"}),side:"right",width:400,children:e.jsx(jt,{})}),c.dashboardInspectorEnabled&&e.jsx(je,{isOpen:t==="inspector",onClose:f,title:s({id:"terminalDashboard.toolbar.inspector"}),side:"right",width:360,children:e.jsx(Ca,{})}),c.dashboardExecutionMonitorEnabled&&e.jsx(je,{isOpen:t==="execution",onClose:f,title:s({id:"terminalDashboard.toolbar.executionMonitor",defaultMessage:"Execution Monitor"}),side:"right",width:380,children:e.jsx(Da,{})}),e.jsx(je,{isOpen:t==="scheduler",onClose:f,title:s({id:"terminalDashboard.toolbar.scheduler",defaultMessage:"Scheduler"}),side:"right",width:340,children:e.jsx(wa,{})})]})})}export{Wa as TerminalDashboardPage,Wa as default};
22
+ //# sourceMappingURL=TerminalDashboardPage-Cn3fGUuO.js.map