profclaw 2.0.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +14 -2
- package/CHANGELOG.md +37 -0
- package/CONTRIBUTING.md +20 -0
- package/Dockerfile +39 -23
- package/README.md +174 -40
- package/dist/agents/agent-summary.d.ts +44 -0
- package/dist/agents/agent-summary.js +176 -0
- package/dist/agents/auto-memory.d.ts +59 -0
- package/dist/agents/auto-memory.js +310 -0
- package/dist/agents/checkpoint-manager.d.ts +76 -0
- package/dist/agents/checkpoint-manager.js +156 -0
- package/dist/agents/circuit-breaker.d.ts +54 -0
- package/dist/agents/circuit-breaker.js +153 -0
- package/dist/agents/context-compactor.d.ts +70 -0
- package/dist/agents/context-compactor.js +361 -0
- package/dist/agents/conversation-branch.d.ts +55 -0
- package/dist/agents/conversation-branch.js +115 -0
- package/dist/agents/error-recovery.d.ts +44 -0
- package/dist/agents/error-recovery.js +197 -0
- package/dist/agents/events.d.ts +76 -0
- package/dist/agents/events.js +8 -0
- package/dist/agents/executor.d.ts +35 -1
- package/dist/agents/executor.js +573 -124
- package/dist/agents/file-snapshots.d.ts +72 -0
- package/dist/agents/file-snapshots.js +182 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/orchestrator.d.ts +183 -0
- package/dist/agents/orchestrator.js +495 -0
- package/dist/agents/permissions.d.ts +63 -0
- package/dist/agents/permissions.js +138 -0
- package/dist/agents/plan-mode.d.ts +71 -0
- package/dist/agents/plan-mode.js +186 -0
- package/dist/agents/prompt-suggestions.d.ts +33 -0
- package/dist/agents/prompt-suggestions.js +208 -0
- package/dist/agents/rate-limit-monitor.d.ts +56 -0
- package/dist/agents/rate-limit-monitor.js +224 -0
- package/dist/agents/result-store.d.ts +37 -0
- package/dist/agents/result-store.js +104 -0
- package/dist/agents/session-diff.d.ts +43 -0
- package/dist/agents/session-diff.js +258 -0
- package/dist/agents/tool-loader.d.ts +65 -0
- package/dist/agents/tool-loader.js +273 -0
- package/dist/agents/transcript.d.ts +96 -0
- package/dist/agents/transcript.js +267 -0
- package/dist/agents/worktree-manager.d.ts +80 -0
- package/dist/agents/worktree-manager.js +203 -0
- package/dist/auth/middleware.js +14 -0
- package/dist/chat/agentic-executor.d.ts +7 -0
- package/dist/chat/agentic-executor.js +253 -30
- package/dist/chat/conversations.d.ts +2 -0
- package/dist/chat/conversations.js +8 -0
- package/dist/chat/execution/executor.d.ts +8 -0
- package/dist/chat/execution/executor.js +157 -103
- package/dist/chat/execution/index.js +5 -1
- package/dist/chat/execution/tool-router.js +40 -14
- package/dist/chat/execution/tools/canvas.d.ts +2 -2
- package/dist/chat/execution/tools/code-tools.d.ts +66 -0
- package/dist/chat/execution/tools/code-tools.js +353 -0
- package/dist/chat/execution/tools/complete-task.d.ts +2 -2
- package/dist/chat/execution/tools/cron-tool.d.ts +26 -10
- package/dist/chat/execution/tools/cron-tool.js +48 -3
- package/dist/chat/execution/tools/decompose-task.d.ts +58 -0
- package/dist/chat/execution/tools/decompose-task.js +166 -0
- package/dist/chat/execution/tools/exec.d.ts +5 -2
- package/dist/chat/execution/tools/exec.js +294 -155
- package/dist/chat/execution/tools/feed-tools.d.ts +77 -0
- package/dist/chat/execution/tools/feed-tools.js +142 -0
- package/dist/chat/execution/tools/file-ops.d.ts +1 -1
- package/dist/chat/execution/tools/github.d.ts +2 -2
- package/dist/chat/execution/tools/index.d.ts +14 -2
- package/dist/chat/execution/tools/index.js +86 -12
- package/dist/chat/execution/tools/integrations.d.ts +8 -8
- package/dist/chat/execution/tools/multi-patch.d.ts +53 -0
- package/dist/chat/execution/tools/multi-patch.js +373 -0
- package/dist/chat/execution/tools/openai-image-gen.d.ts +2 -2
- package/dist/chat/execution/tools/plan-tools.d.ts +80 -0
- package/dist/chat/execution/tools/plan-tools.js +134 -0
- package/dist/chat/execution/tools/profclaw-ops.d.ts +6 -6
- package/dist/chat/execution/tools/repl-tool.d.ts +46 -0
- package/dist/chat/execution/tools/repl-tool.js +207 -0
- package/dist/chat/execution/tools/sessions-send.d.ts +2 -2
- package/dist/chat/execution/tools/slack-actions.d.ts +2 -2
- package/dist/chat/execution/tools/system.d.ts +4 -4
- package/dist/chat/execution/tools/todo-tool.d.ts +72 -0
- package/dist/chat/execution/tools/todo-tool.js +152 -0
- package/dist/chat/execution/tools/tool-search.d.ts +50 -0
- package/dist/chat/execution/tools/tool-search.js +155 -0
- package/dist/chat/execution/types.d.ts +21 -14
- package/dist/chat/execution/workflows/executor.d.ts +11 -0
- package/dist/chat/execution/workflows/executor.js +99 -1
- package/dist/chat/execution/workflows/types.d.ts +35 -2
- package/dist/chat/format/index.d.ts +1 -0
- package/dist/chat/format/index.js +1 -0
- package/dist/chat/format/markdown-convert.d.ts +23 -0
- package/dist/chat/format/markdown-convert.js +149 -0
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +1 -1
- package/dist/chat/message-handler.js +58 -6
- package/dist/chat/proactive/index.d.ts +62 -0
- package/dist/chat/proactive/index.js +147 -0
- package/dist/chat/prompt-adapter.js +2 -0
- package/dist/chat/providers/irc/index.d.ts +2 -2
- package/dist/chat/providers/telegram/index.d.ts +2 -0
- package/dist/chat/providers/telegram/index.js +21 -2
- package/dist/chat/system-prompts.d.ts +3 -3
- package/dist/chat/system-prompts.js +116 -61
- package/dist/chat/tools.d.ts +6 -6
- package/dist/cli/commands/auth.js +64 -1
- package/dist/cli/commands/chat.js +1327 -138
- package/dist/cli/commands/doctor.js +222 -16
- package/dist/cli/commands/history.d.ts +3 -0
- package/dist/cli/commands/history.js +138 -0
- package/dist/cli/commands/import.d.ts +44 -0
- package/dist/cli/commands/import.js +526 -0
- package/dist/cli/commands/init.d.ts +13 -0
- package/dist/cli/commands/init.js +381 -0
- package/dist/cli/commands/onboard.js +210 -30
- package/dist/cli/commands/plan.d.ts +13 -0
- package/dist/cli/commands/plan.js +184 -0
- package/dist/cli/commands/serve.d.ts +7 -0
- package/dist/cli/commands/serve.js +77 -18
- package/dist/cli/commands/setup.js +84 -3
- package/dist/cli/commands/status.js +54 -0
- package/dist/cli/commands/tools.js +13 -13
- package/dist/cli/commands/tui.js +26 -1
- package/dist/cli/index.js +19 -0
- package/dist/cli/ink/App.d.ts +13 -0
- package/dist/cli/ink/App.js +6 -0
- package/dist/cli/ink/ChatApp.d.ts +60 -0
- package/dist/cli/ink/ChatApp.js +325 -0
- package/dist/cli/ink/DashboardApp.d.ts +3 -0
- package/dist/cli/ink/DashboardApp.js +143 -0
- package/dist/cli/ink/components/AgentStatus.d.ts +17 -0
- package/dist/cli/ink/components/AgentStatus.js +33 -0
- package/dist/cli/ink/components/ChannelList.d.ts +17 -0
- package/dist/cli/ink/components/ChannelList.js +33 -0
- package/dist/cli/ink/components/ConnectionStatus.d.ts +19 -0
- package/dist/cli/ink/components/ConnectionStatus.js +50 -0
- package/dist/cli/ink/components/CostBar.d.ts +19 -0
- package/dist/cli/ink/components/CostBar.js +35 -0
- package/dist/cli/ink/components/HookStatus.d.ts +15 -0
- package/dist/cli/ink/components/HookStatus.js +7 -0
- package/dist/cli/ink/components/PermissionPrompt.d.ts +21 -0
- package/dist/cli/ink/components/PermissionPrompt.js +51 -0
- package/dist/cli/ink/components/PlanView.d.ts +23 -0
- package/dist/cli/ink/components/PlanView.js +26 -0
- package/dist/cli/ink/components/ProviderList.d.ts +16 -0
- package/dist/cli/ink/components/ProviderList.js +16 -0
- package/dist/cli/ink/components/SessionHeader.d.ts +15 -0
- package/dist/cli/ink/components/SessionHeader.js +15 -0
- package/dist/cli/ink/components/StreamingMessage.d.ts +20 -0
- package/dist/cli/ink/components/StreamingMessage.js +27 -0
- package/dist/cli/ink/components/SuggestionBar.d.ts +15 -0
- package/dist/cli/ink/components/SuggestionBar.js +28 -0
- package/dist/cli/ink/components/SystemHealth.d.ts +20 -0
- package/dist/cli/ink/components/SystemHealth.js +39 -0
- package/dist/cli/ink/components/TaskList.d.ts +17 -0
- package/dist/cli/ink/components/TaskList.js +59 -0
- package/dist/cli/ink/components/ToolCall.d.ts +17 -0
- package/dist/cli/ink/components/ToolCall.js +43 -0
- package/dist/cli/ink/index.d.ts +23 -0
- package/dist/cli/ink/index.js +15 -0
- package/dist/cli/ink/keybindings.d.ts +35 -0
- package/dist/cli/ink/keybindings.js +105 -0
- package/dist/cli/ink/markdown-renderer.d.ts +47 -0
- package/dist/cli/ink/markdown-renderer.js +380 -0
- package/dist/cli/ink/output-styles.d.ts +39 -0
- package/dist/cli/ink/output-styles.js +119 -0
- package/dist/cli/interactive/auto-serve.d.ts +38 -0
- package/dist/cli/interactive/auto-serve.js +209 -0
- package/dist/cli/interactive/index.d.ts +25 -0
- package/dist/cli/interactive/index.js +23 -0
- package/dist/cli/interactive/picker.d.ts +28 -0
- package/dist/cli/interactive/picker.js +153 -0
- package/dist/cli/interactive/renderer.d.ts +26 -0
- package/dist/cli/interactive/renderer.js +555 -0
- package/dist/cli/interactive/repl.d.ts +14 -0
- package/dist/cli/interactive/repl.js +1516 -0
- package/dist/cli/interactive/stream-client.d.ts +59 -0
- package/dist/cli/interactive/stream-client.js +506 -0
- package/dist/cli/interactive/types.d.ts +121 -0
- package/dist/cli/interactive/types.js +10 -0
- package/dist/cli/utils/api.d.ts +9 -0
- package/dist/cli/utils/api.js +58 -2
- package/dist/cron/natural-language.d.ts +54 -0
- package/dist/cron/natural-language.js +569 -0
- package/dist/cron/scheduler.d.ts +34 -4
- package/dist/cron/scheduler.js +141 -9
- package/dist/cron/templates.d.ts +1 -1
- package/dist/cron/templates.js +219 -0
- package/dist/feeds/feed-engine.d.ts +149 -0
- package/dist/feeds/feed-engine.js +600 -0
- package/dist/feeds/index.d.ts +9 -0
- package/dist/feeds/index.js +8 -0
- package/dist/gateway/router.js +6 -1
- package/dist/hooks/built-in/audit-log.d.ts +11 -0
- package/dist/hooks/built-in/audit-log.js +84 -0
- package/dist/hooks/built-in/cost-warning.d.ts +10 -0
- package/dist/hooks/built-in/cost-warning.js +59 -0
- package/dist/hooks/built-in/dangerous-tool.d.ts +32 -0
- package/dist/hooks/built-in/dangerous-tool.js +80 -0
- package/dist/hooks/built-in/index.d.ts +14 -0
- package/dist/hooks/built-in/index.js +20 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/loader.d.ts +17 -0
- package/dist/hooks/loader.js +142 -0
- package/dist/hooks/registry.d.ts +62 -0
- package/dist/hooks/registry.js +127 -0
- package/dist/integrations/web-search.js +6 -3
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/memory-service.js +14 -13
- package/dist/memory/observational.d.ts +62 -0
- package/dist/memory/observational.js +396 -0
- package/dist/middleware/content-filter.d.ts +22 -0
- package/dist/middleware/content-filter.js +69 -0
- package/dist/middleware/request-validator.d.ts +159 -0
- package/dist/middleware/request-validator.js +93 -0
- package/dist/plugins/sdk.d.ts +22 -0
- package/dist/plugins/sdk.js +17 -1
- package/dist/projects/types.d.ts +10 -10
- package/dist/providers/ai-sdk.d.ts +11 -0
- package/dist/providers/ai-sdk.js +78 -19
- package/dist/providers/core/models.js +67 -1
- package/dist/providers/core/types.d.ts +3 -0
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.js +1 -0
- package/dist/providers/smart-router.d.ts +118 -0
- package/dist/providers/smart-router.js +685 -0
- package/dist/providers/types.d.ts +16 -16
- package/dist/routes/agents.js +50 -0
- package/dist/routes/auth.js +8 -1
- package/dist/routes/chat.js +259 -14
- package/dist/routes/costs.js +32 -0
- package/dist/routes/cron.js +80 -5
- package/dist/routes/feeds.d.ts +10 -0
- package/dist/routes/feeds.js +168 -0
- package/dist/routes/mcp.js +21 -0
- package/dist/routes/memory.js +130 -0
- package/dist/routes/skills.js +129 -0
- package/dist/routes/teams.d.ts +9 -0
- package/dist/routes/teams.js +210 -0
- package/dist/routes/tools.js +14 -0
- package/dist/routes/users.js +2 -0
- package/dist/server/route-loader.js +3 -1
- package/dist/server/stream-bridge.d.ts +19 -0
- package/dist/server/stream-bridge.js +38 -0
- package/dist/server.js +310 -36
- package/dist/skills/marketplace.d.ts +87 -0
- package/dist/skills/marketplace.js +268 -0
- package/dist/storage/index.d.ts +14 -0
- package/dist/storage/index.js +64 -3
- package/dist/storage/schema.d.ts +4 -4
- package/dist/storage/schema.js +1 -1
- package/dist/teams/index.d.ts +110 -0
- package/dist/teams/index.js +365 -0
- package/dist/tickets/types.d.ts +39 -39
- package/dist/types/summary.d.ts +5 -5
- package/dist/utils/auto-update.d.ts +23 -0
- package/dist/utils/auto-update.js +157 -0
- package/dist/utils/offline-detect.d.ts +55 -0
- package/dist/utils/offline-detect.js +121 -0
- package/dist/utils/pid-file.d.ts +36 -0
- package/dist/utils/pid-file.js +125 -0
- package/dist/utils/prevent-sleep.d.ts +27 -0
- package/dist/utils/prevent-sleep.js +95 -0
- package/dist/utils/sanitizer.d.ts +57 -0
- package/dist/utils/sanitizer.js +174 -0
- package/docker-compose.yml +13 -137
- package/package.json +31 -6
- package/skills/deploy-cloudflare/SKILL.md +62 -0
- package/skills/deploy-vercel/SKILL.md +67 -0
- package/skills/docker-deploy/SKILL.md +158 -0
- package/skills/full-stack-builder/SKILL.md +92 -0
- package/skills/humanizer/SKILL.md +488 -0
- package/skills/profclaw-assistant/SKILL.md +85 -56
- package/ui/dist/assets/ActivityView-Da6HQ8ws.js +1 -0
- package/ui/dist/assets/AgentList-H58R0kX3.js +1 -0
- package/ui/dist/assets/AnalyticsDashboard-B28AeRsc.js +1 -0
- package/ui/dist/assets/AreaChart-DwLzeAQ8.js +1 -0
- package/ui/dist/assets/CartesianChart-piKQsTAR.js +36 -0
- package/ui/dist/assets/ChatView-Dbj8rxU5.js +10 -0
- package/ui/dist/assets/CostsDashboard-C6F5df0F.js +1 -0
- package/ui/dist/assets/EstimateSelect-wga0rUKX.js +1 -0
- package/ui/dist/assets/FeedDashboard-Ef6FEzEf.js +1 -0
- package/ui/dist/assets/FloatingChatbot-0yhkUeCq.js +2 -0
- package/ui/dist/assets/InviteCodeManagement-tUXfx4Bc.js +2 -0
- package/ui/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/ui/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/ui/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/ui/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/ui/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/ui/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/ui/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/ui/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/ui/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/ui/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/ui/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/ui/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/ui/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/ui/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/ui/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/ui/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/ui/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/ui/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/ui/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/ui/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/ui/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/ui/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/ui/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/ui/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/ui/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/ui/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/ui/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/ui/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/ui/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/ui/dist/assets/MarketplacePage-DGrLtolR.js +1 -0
- package/ui/dist/assets/{ProjectDetail--gPfvATB.js → ProjectDetail-BgWvA6UP.js} +2 -2
- package/ui/dist/assets/ProjectIcon-TDuliqwg.js +1 -0
- package/ui/dist/assets/ProjectList-DXgM4187.js +1 -0
- package/ui/dist/assets/{Settings-1kaf7VHE.js → Settings-xA8Zhi3p.js} +3 -3
- package/ui/dist/assets/StatusIndicator-B8vfFAxg.js +1 -0
- package/ui/dist/assets/{SummaryDetail-DV3AmONk.js → SummaryDetail-eedRfTtF.js} +2 -2
- package/ui/dist/assets/SummaryList-CLNX2P84.js +1 -0
- package/ui/dist/assets/TaskDetail-BtWclNiR.js +1 -0
- package/ui/dist/assets/TaskList-JjODAgSc.js +1 -0
- package/ui/dist/assets/TeamsPage-CBK5iAyx.js +1 -0
- package/ui/dist/assets/TicketBoard-C9aJNNYp.js +1 -0
- package/ui/dist/assets/TicketDetail-CV5JmL31.js +1 -0
- package/ui/dist/assets/TicketList-68V4lzUz.js +1 -0
- package/ui/dist/assets/UserManagement-DKTb6UpE.js +2 -0
- package/ui/dist/assets/ViewSwitcher-BvdQht2Y.js +1 -0
- package/ui/dist/assets/alert-dialog-O6qBOv_f.js +1 -0
- package/ui/dist/assets/{archive-BsLa7brF.js → archive-CX7UvZpf.js} +1 -1
- package/ui/dist/assets/badge-BbfnwDJP.js +1 -0
- package/ui/dist/assets/{bug-CmZI7jqM.js → bug-3WX0394-.js} +1 -1
- package/ui/dist/assets/{calendar-Bf0t2B82.js → calendar-buq77TaS.js} +1 -1
- package/ui/dist/assets/{chevron-up-CoUsOvZj.js → chevron-up-4ymsBJRo.js} +1 -1
- package/ui/dist/assets/{circle-x-Dgw11LgT.js → circle-x-ByXtwR6Y.js} +1 -1
- package/ui/dist/assets/constants-CVdDh7p0.js +1 -0
- package/ui/dist/assets/{cpu-DiPMQICV.js → cpu-CiuoCeDY.js} +1 -1
- package/ui/dist/assets/{database-BwTfupDi.js → database-BWXSBg5a.js} +1 -1
- package/ui/dist/assets/dialog-lDg4NvMV.js +1 -0
- package/ui/dist/assets/dollar-sign-Dmijd6DP.js +1 -0
- package/ui/dist/assets/{ellipsis-UJx4Xnf6.js → ellipsis-vT-5SVIp.js} +1 -1
- package/ui/dist/assets/{ellipsis-vertical-DoULYEKn.js → ellipsis-vertical-B4tAX_bL.js} +1 -1
- package/ui/dist/assets/feature-markdown-DBo5Q7uq.js +289 -0
- package/ui/dist/assets/{file-code-B2UrJLwi.js → file-code-ChOWdKXf.js} +1 -1
- package/ui/dist/assets/{folder-open-BJi577JH.js → folder-open-CkOUbIiP.js} +1 -1
- package/ui/dist/assets/{funnel-PkaD_HSR.js → funnel-uZkoSPP-.js} +1 -1
- package/ui/dist/assets/{git-branch-C_K30am0.js → git-branch-CwvUxj7C.js} +1 -1
- package/ui/dist/assets/{git-commit-horizontal-IT6ecxWQ.js → git-commit-horizontal-lxPzCvhD.js} +1 -1
- package/ui/dist/assets/{globe-f-jjCa_g.js → globe-D_WpJdsj.js} +1 -1
- package/ui/dist/assets/{hash-DNEv8Elo.js → hash-CA0hJ7vh.js} +1 -1
- package/ui/dist/assets/{history-BQSBo_1Q.js → history-CEWMLELs.js} +1 -1
- package/ui/dist/assets/inbox-ehtOptTV.js +1 -0
- package/ui/dist/assets/{index-nS3EErDg.js → index-C1rhbml4.js} +3 -3
- package/ui/dist/assets/index-CR8gfCHv.js +1 -0
- package/ui/dist/assets/index-DVXMpWai.js +1 -0
- package/ui/dist/assets/index-DaDJMM2v.js +1 -0
- package/ui/dist/assets/index-Djdq_0xu.js +1 -0
- package/ui/dist/assets/index-M46Gcb8K.css +1 -0
- package/ui/dist/assets/index-sEBN7w8J.js +109 -0
- package/ui/dist/assets/layers-C6Mhf8Nk.js +1 -0
- package/ui/dist/assets/{layout-dashboard-CcKt1hXw.js → layout-dashboard-BRUM0kpT.js} +1 -1
- package/ui/dist/assets/{lightbulb-Jhp7FvbU.js → lightbulb-CN2q1O5l.js} +1 -1
- package/ui/dist/assets/{link-2-DdO7ostF.js → link-2-CC4E28yJ.js} +1 -1
- package/ui/dist/assets/markdown-renderer-C6ENbB0u.js +10 -0
- package/ui/dist/assets/markdown-renderer-CfVKi3_s.css +1 -0
- package/ui/dist/assets/{message-square-CBgH65X7.js → message-square-Bbb241am.js} +1 -1
- package/ui/dist/assets/package-CwT3IzFx.js +1 -0
- package/ui/dist/assets/{pencil-CYXCEPQh.js → pencil-CDmiHzoj.js} +1 -1
- package/ui/dist/assets/{play-d1ONaH0-.js → play-tjy5jMQX.js} +1 -1
- package/ui/dist/assets/popover-CFHZf3pE.js +1 -0
- package/ui/dist/assets/progress-BboUHuLf.js +1 -0
- package/ui/dist/assets/{rocket-DhvUetsk.js → rocket--8ZHgdXJ.js} +1 -1
- package/ui/dist/assets/select-n108rXny.js +1 -0
- package/ui/dist/assets/{send-P0r5D7td.js → send-Cu7MR2Qh.js} +1 -1
- package/ui/dist/assets/server-DmodxZp-.js +1 -0
- package/ui/dist/assets/{settings-2-ocj5uHGx.js → settings-2-CkRNqkxj.js} +1 -1
- package/ui/dist/assets/sheet-7aUJkyzU.js +1 -0
- package/ui/dist/assets/{shield-check-DfVdE34l.js → shield-check-ViI3nMKE.js} +1 -1
- package/ui/dist/assets/{shield-off-8l0J6R-8.js → shield-off-DN3tagkn.js} +1 -1
- package/ui/dist/assets/skeleton-C0E1Nfro.js +1 -0
- package/ui/dist/assets/{smartphone-77_g3SQn.js → smartphone-5FghiXpA.js} +1 -1
- package/ui/dist/assets/{square-Ckzsr3Rn.js → square-DiNSx8K7.js} +1 -1
- package/ui/dist/assets/star-DhdFVidS.js +1 -0
- package/ui/dist/assets/switch-CIgVbZqQ.js +1 -0
- package/ui/dist/assets/table-BC56FVMV.js +1 -0
- package/ui/dist/assets/{tag-C35mgoEv.js → tag-CH_vQliw.js} +1 -1
- package/ui/dist/assets/textarea-CxDiKFXZ.js +1 -0
- package/ui/dist/assets/{timer-DHJBS2w1.js → timer-CdGVTb60.js} +1 -1
- package/ui/dist/assets/tooltip-BuW9A5UO.js +1 -0
- package/ui/dist/assets/{trash-2-keO5tKPE.js → trash-2-CucZJL0N.js} +1 -1
- package/ui/dist/assets/trending-down-BCezC1z2.js +1 -0
- package/ui/dist/assets/{trending-up-BBv8KbrY.js → trending-up-C5OYX2k2.js} +1 -1
- package/ui/dist/assets/vendor-query-C0p7b53x.js +4 -0
- package/ui/dist/assets/vendor-react-Mc5_kfYG.js +12 -0
- package/ui/dist/assets/vendor-ui-CXPAUBFv.js +51 -0
- package/ui/dist/assets/{wand-sparkles-BusQ52ZK.js → wand-sparkles-BaH6pJnc.js} +1 -1
- package/ui/dist/assets/{wrench-02YaOSiK.js → wrench-CjxjP6ok.js} +1 -1
- package/ui/dist/index.html +5 -2
- package/ui/dist/assets/ActivityView-BeshZXmE.js +0 -1
- package/ui/dist/assets/AgentList-QVHeldPi.js +0 -1
- package/ui/dist/assets/AnalyticsDashboard-C9R97dXE.js +0 -1
- package/ui/dist/assets/AreaChart-B73gaiVQ.js +0 -1
- package/ui/dist/assets/CartesianChart-CXYL2R-A.js +0 -36
- package/ui/dist/assets/ChatView-qjZErlrp.js +0 -10
- package/ui/dist/assets/CostsDashboard-O4DCLy1i.js +0 -1
- package/ui/dist/assets/EstimateSelect-1hQf4Osk.js +0 -1
- package/ui/dist/assets/FloatingChatbot-BZBzrJxd.js +0 -2
- package/ui/dist/assets/InviteCodeManagement-LEoGqYeA.js +0 -2
- package/ui/dist/assets/ProjectIcon-Chd_ofsw.js +0 -1
- package/ui/dist/assets/ProjectList-BvUfVB6c.js +0 -4
- package/ui/dist/assets/StatusIndicator-pRfkNcdV.js +0 -1
- package/ui/dist/assets/SummaryList-B6kXiTxL.js +0 -1
- package/ui/dist/assets/TaskDetail-CV6CzbOS.js +0 -1
- package/ui/dist/assets/TaskList-DL7brQKd.js +0 -1
- package/ui/dist/assets/TicketBoard-CrkkFj7C.js +0 -1
- package/ui/dist/assets/TicketDetail-hnnYclpD.js +0 -1
- package/ui/dist/assets/TicketList-CsDAyQCL.js +0 -1
- package/ui/dist/assets/UserManagement-BGFQyTSr.js +0 -2
- package/ui/dist/assets/ViewSwitcher-CnL0OqA8.js +0 -1
- package/ui/dist/assets/alert-dialog-SKM6Gjz4.js +0 -7
- package/ui/dist/assets/badge-CVHH1a-v.js +0 -1
- package/ui/dist/assets/brain-6o_RHVpe.js +0 -1
- package/ui/dist/assets/constants-Q5Zivl-a.js +0 -1
- package/ui/dist/assets/dialog-BUqN9Psj.js +0 -1
- package/ui/dist/assets/index-BUmnwPQr.js +0 -1
- package/ui/dist/assets/index-BfF5G4Cw.js +0 -1
- package/ui/dist/assets/index-C8N375c2.js +0 -1
- package/ui/dist/assets/index-CuxnqVVz.css +0 -1
- package/ui/dist/assets/index-CzMM3QOk.js +0 -1
- package/ui/dist/assets/index-lJlNPFVJ.js +0 -67
- package/ui/dist/assets/layers-jFqVrWMD.js +0 -1
- package/ui/dist/assets/markdown-renderer-n1ToC4XQ.js +0 -36
- package/ui/dist/assets/popover-CrmZgoWu.js +0 -1
- package/ui/dist/assets/progress-uv4SPkL5.js +0 -1
- package/ui/dist/assets/select-CeQ8AHGy.js +0 -1
- package/ui/dist/assets/server-CVHTZB72.js +0 -1
- package/ui/dist/assets/sheet-DuQExSho.js +0 -1
- package/ui/dist/assets/skeleton-TFiFJ3nB.js +0 -1
- package/ui/dist/assets/switch-CAePkd6k.js +0 -1
- package/ui/dist/assets/table-ZjAZ7hkt.js +0 -1
- package/ui/dist/assets/textarea-DsVPnSgR.js +0 -1
- package/ui/dist/assets/tooltip-BYmQ331W.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as oe,q as ie,r as L,u as O,j as e,v as ce,w as de,I as U,T as k,a1 as Y,C as N,X as P,S as E,F as xe,an as M,B as H,k as S,L as me,h as ue,g as pe,m as q}from"./index-lJlNPFVJ.js";import{B as Q}from"./badge-CVHH1a-v.js";import{S as j,a as b,b as v,c as f,d as h}from"./select-CeQ8AHGy.js";import{P as he,a as ge,b as je}from"./popover-CrmZgoWu.js";import{V as be,C as ve}from"./ViewSwitcher-CnL0OqA8.js";import{E as fe}from"./EstimateSelect-1hQf4Osk.js";import{I as G,C as T,L as W}from"./layers-jFqVrWMD.js";import{P as X}from"./play-d1ONaH0-.js";import{B as J,a as _}from"./bug-CmZI7jqM.js";import{T as Ne}from"./tag-C35mgoEv.js";import{F as ye}from"./funnel-PkaD_HSR.js";import"./chevron-up-CoUsOvZj.js";import"./textarea-DsVPnSgR.js";import"./dialog-BUqN9Psj.js";import"./brain-6o_RHVpe.js";import"./wand-sparkles-BusQ52ZK.js";import"./folder-open-BJi577JH.js";import"./link-2-DdO7ostF.js";import"./hash-DNEv8Elo.js";import"./lightbulb-Jhp7FvbU.js";const we=[{value:"all",label:"All Status",icon:k},{value:"backlog",label:"Backlog",icon:G},{value:"todo",label:"Todo",icon:T},{value:"in_progress",label:"In Progress",icon:X},{value:"in_review",label:"In Review",icon:Y},{value:"done",label:"Done",icon:N},{value:"cancelled",label:"Cancelled",icon:P}],Ce=[{value:"all",label:"All Types",icon:k},{value:"task",label:"Task",icon:N},{value:"bug",label:"Bug",icon:J},{value:"feature",label:"Feature",icon:E},{value:"epic",label:"Epic",icon:W},{value:"story",label:"Story",icon:_},{value:"subtask",label:"Subtask",icon:T}],Se=[{value:"all",label:"All Priorities",color:"text-muted-foreground"},{value:"urgent",label:"Urgent",color:"text-red-500"},{value:"high",label:"High",color:"text-orange-500"},{value:"medium",label:"Medium",color:"text-yellow-500"},{value:"low",label:"Low",color:"text-blue-500"},{value:"none",label:"None",color:"text-gray-500"}],Pe=[{value:"all",label:"All Authors",icon:M},{value:"human",label:"Human",icon:M},{value:"ai",label:"AI",icon:H}];function Ye(){const Z=oe(),[r,V]=ie(),n=r.get("status")||"all",o=r.get("type")||"all",i=r.get("priority")||"all",l=r.get("project")||"all",c=r.get("createdBy")||"all",t=r.get("label")||"",[u,z]=L.useState(r.get("q")||""),[R,y]=L.useState(""),[x,w]=L.useState(0),p=20,{data:ee}=O({queryKey:["projects-list"],queryFn:()=>q.projects.list({limit:100})}),C=ee?.projects??[],{data:ae}=O({queryKey:["labels-global"],queryFn:async()=>{const a=C[0];return a?q.labels.list(a.id,{includeGlobal:!0}):{labels:[],total:0}},enabled:C.length>0}),D=ae?.labels??[],d=(a,s)=>{const m=new URLSearchParams(r);s==="all"||s===""?m.delete(a):m.set(a,s),V(m),w(0)},se=()=>{V({}),z(""),y(""),w(0)},I=n!=="all"||o!=="all"||i!=="all"||l!=="all"||c!=="all"||t||u,{data:$,isLoading:le,error:K}=O({queryKey:["tickets",{status:n==="all"?void 0:n,type:o==="all"?void 0:o,priority:i==="all"?void 0:i,projectId:l==="all"?void 0:l,createdBy:c==="all"?void 0:c,label:t||void 0,search:u||void 0,limit:p,offset:x*p}],queryFn:()=>q.tickets.list({status:n==="all"?void 0:n,type:o==="all"?void 0:o,priority:i==="all"?void 0:i,projectId:l==="all"?void 0:l,createdBy:c==="all"?void 0:c,label:t||void 0,search:u||void 0,limit:p,offset:x*p})}),g=$?.tickets??[],B=$?.total??0,te=a=>{const m={done:{variant:"success",icon:N},cancelled:{variant:"destructive",icon:P},in_progress:{variant:"info",icon:X},in_review:{variant:"warning",icon:Y},todo:{variant:"secondary",icon:T},backlog:{variant:"secondary",icon:G}}[a]||{variant:"secondary",icon:pe},{variant:A,icon:F}=m;return e.jsxs(Q,{variant:A,className:"gap-1",children:[e.jsx(F,{className:"h-3 w-3"}),a.replace("_"," ")]})},re=a=>{const m={task:{icon:N,color:"text-blue-500"},bug:{icon:J,color:"text-red-500"},feature:{icon:E,color:"text-cyan-500"},enhancement:{icon:E,color:"text-indigo-500"},documentation:{icon:_,color:"text-cyan-500"},epic:{icon:W,color:"text-orange-500"},story:{icon:_,color:"text-green-500"},subtask:{icon:T,color:"text-gray-500"}}[a]||{icon:k,color:"text-gray-500"},{icon:A,color:F}=m;return e.jsxs("span",{className:`flex items-center gap-1 text-xs ${F}`,children:[e.jsx(A,{className:"h-3 w-3"}),a]})},ne=a=>{const s={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-yellow-500",low:"bg-blue-500",none:"bg-gray-400"};return e.jsx("div",{className:`h-2 w-2 rounded-full ${s[a]}`,title:a})};return K?e.jsxs("div",{className:"premium-card rounded-[24px] p-12 text-center",children:[e.jsx(ce,{className:"h-12 w-12 mx-auto text-red-400 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-red-400",children:"Error loading tickets"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:K.message})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Tickets"}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:[B," total tickets • ",g.length," showing"]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(be,{view:"list",onChange:a=>{a==="board"&&Z("/tickets/board")}}),e.jsx(ve,{})]})]}),e.jsxs("div",{className:"premium-card rounded-[20px] p-4 bg-muted/20",children:[e.jsxs("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-center",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(de,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(U,{placeholder:"Search tickets by title or description...",value:u,onChange:a=>{z(a.target.value),d("q",a.target.value)},className:"pl-10 h-10"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(j,{value:n,onValueChange:a=>d("status",a),children:[e.jsx(b,{className:"w-[140px]",children:e.jsx(v,{placeholder:"Status"})}),e.jsx(f,{className:"glass-heavy rounded-xl border-white/10",children:we.map(a=>e.jsx(h,{value:a.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(a.icon,{className:"h-3.5 w-3.5"}),a.label]})},a.value))})]}),e.jsxs(j,{value:o,onValueChange:a=>d("type",a),children:[e.jsx(b,{className:"w-[130px]",children:e.jsx(v,{placeholder:"Type"})}),e.jsx(f,{className:"glass-heavy rounded-xl border-white/10",children:Ce.map(a=>e.jsx(h,{value:a.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(a.icon,{className:"h-3.5 w-3.5"}),a.label]})},a.value))})]}),e.jsxs(j,{value:i,onValueChange:a=>d("priority",a),children:[e.jsx(b,{className:"w-[140px]",children:e.jsx(v,{placeholder:"Priority"})}),e.jsx(f,{className:"glass-heavy rounded-xl border-white/10",children:Se.map(a=>e.jsx(h,{value:a.value,children:e.jsx("span",{className:`flex items-center gap-2 ${a.color}`,children:a.label})},a.value))})]}),e.jsxs(j,{value:l,onValueChange:a=>d("project",a),children:[e.jsx(b,{className:"w-[150px]",children:e.jsx(v,{placeholder:"Project"})}),e.jsxs(f,{className:"glass-heavy rounded-xl border-white/10",children:[e.jsx(h,{value:"all",children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(xe,{className:"h-3.5 w-3.5"}),"All Projects"]})}),C.map(a=>e.jsx(h,{value:a.id,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{children:a.icon}),a.name]})},a.id))]})]}),e.jsxs(j,{value:c,onValueChange:a=>d("createdBy",a),children:[e.jsx(b,{className:"w-[130px]",children:e.jsx(v,{placeholder:"Author"})}),e.jsx(f,{className:"glass-heavy rounded-xl border-white/10",children:Pe.map(a=>e.jsx(h,{value:a.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(a.icon,{className:"h-3.5 w-3.5"}),a.label]})},a.value))})]}),e.jsxs(he,{children:[e.jsx(ge,{asChild:!0,children:e.jsxs(S,{variant:"outline",size:"sm",className:`w-[130px] justify-start ${t?"text-primary":""}`,children:[e.jsx(Ne,{className:"h-3.5 w-3.5 mr-2"}),t||"Label"]})}),e.jsxs(je,{className:"w-64 p-0 glass-heavy rounded-xl border-white/10",align:"start",children:[e.jsx("div",{className:"p-2 border-b border-white/5",children:e.jsx(U,{placeholder:"Search labels...",value:R,onChange:a=>y(a.target.value),className:"h-8 bg-transparent border-white/10"})}),e.jsxs("div",{className:"max-h-64 overflow-y-auto p-1",children:[e.jsxs("button",{type:"button",onClick:()=>{d("label",""),y("")},className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-sm hover:bg-white/5",children:[e.jsx(P,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{children:"Clear label filter"})]}),D.filter(a=>a.name.toLowerCase().includes(R.toLowerCase())).map(a=>e.jsxs("button",{type:"button",onClick:()=>{d("label",a.name),y("")},className:`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-sm hover:bg-white/5 ${t===a.name?"bg-primary/10":""}`,children:[e.jsx("span",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:a.color}}),e.jsx("span",{className:"truncate",children:a.name}),t===a.name&&e.jsx(N,{className:"h-3.5 w-3.5 ml-auto text-primary"})]},a.id)),D.length===0&&e.jsx("p",{className:"p-2 text-sm text-muted-foreground text-center",children:"No labels available"})]})]})]}),I&&e.jsxs(S,{variant:"ghost",size:"sm",onClick:se,className:"rounded-xl text-muted-foreground hover:text-foreground",children:[e.jsx(P,{className:"h-4 w-4 mr-1"}),"Clear"]})]})]}),I&&e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3 pt-3 border-t border-white/5",children:[e.jsx(ye,{className:"h-4 w-4 text-muted-foreground"}),n!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-blue-500/10 text-blue-400 text-xs font-medium",children:["Status: ",n]}),o!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-indigo-500/10 text-indigo-400 text-xs font-medium capitalize",children:["Type: ",o]}),i!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-orange-500/10 text-orange-400 text-xs font-medium capitalize",children:["Priority: ",i]}),l!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-indigo-500/10 text-indigo-400 text-xs font-medium",children:["Project: ",C.find(a=>a.id===l)?.name||l]}),c!=="all"&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-cyan-500/10 text-cyan-400 text-xs font-medium capitalize",children:["Author: ",c]}),t&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-pink-500/10 text-pink-400 text-xs font-medium",children:["Label: ",t]}),u&&e.jsxs("span",{className:"px-2 py-0.5 rounded-lg bg-green-500/10 text-green-400 text-xs font-medium",children:['Search: "',u,'"']})]})]}),le?e.jsx("div",{className:"premium-card rounded-[28px] p-12 flex items-center justify-center",children:e.jsx(me,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):g.length===0?e.jsxs("div",{className:"premium-card rounded-[24px] p-12 text-center",children:[e.jsx(k,{className:"h-12 w-12 mx-auto text-muted-foreground/40 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-muted-foreground",children:"No tickets found"}),e.jsx("p",{className:"text-sm text-muted-foreground/60 mt-1",children:I?"Try adjusting your filters":"Create a ticket to get started"})]}):e.jsx("div",{className:"space-y-2",children:g.map(a=>e.jsx(ue,{to:`/tickets/${a.id}`,className:"block premium-card border-none hover:bg-muted/30 transition-all group",children:e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:"pt-1",children:ne(a.priority)}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:[a.projectKey||"PROFCLAW","-",a.sequence]}),!a.projectId&&e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider text-amber-400 px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20",children:"No Project"}),e.jsx("h3",{className:"font-semibold truncate group-hover:text-primary transition-colors",children:a.title})]}),a.description&&e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1 mb-2",children:a.description}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[re(a.type),te(a.status),a.assigneeAgent&&e.jsxs("span",{className:"flex items-center gap-1 text-[10px] font-bold uppercase tracking-wider text-primary/80 px-2 py-0.5 rounded-md bg-primary/10",children:[e.jsx(H,{className:"h-3 w-3"}),a.assigneeAgent]}),a.createdBy==="ai"&&e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-blue-400 px-2 py-0.5 rounded-md bg-blue-500/10",children:"AI Created"}),a.labels.slice(0,3).map(s=>e.jsx(Q,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:s},s)),a.estimate!=null&&e.jsx(fe,{value:a.estimate}),e.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-auto",children:new Date(a.createdAt).toLocaleDateString()})]})]})]})})},a.id))}),g.length>0&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Page ",x+1," • Showing ",Math.min(g.length,p)," of ",B]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{variant:"outline",size:"sm",onClick:()=>w(x-1),disabled:x===0,className:"rounded-xl border-white/10",children:"Previous"}),e.jsx(S,{variant:"outline",size:"sm",onClick:()=>w(x+1),disabled:(x+1)*p>=B,className:"rounded-xl border-white/10",children:"Next"})]})]})]})}export{Ye as TicketList};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as _,r as l,u as X,o as w,t as a,j as e,U,ad as G,k as r,R as V,i as N,w as W,L as T,bJ as Y,C as R,D as Z,x as ee,y as se,bo as te,aw as v,z as m,_ as ae,ai as E,O as F,Q as P}from"./index-lJlNPFVJ.js";import{A as re,a as le,b as ne,c as de,d as ie,e as oe,f as ce,g as me}from"./alert-dialog-SKM6Gjz4.js";import{C as M}from"./circle-x-Dgw11LgT.js";import{E as xe}from"./ellipsis-UJx4Xnf6.js";import{S as ue}from"./shield-off-8l0J6R-8.js";import{T as he}from"./trash-2-keO5tKPE.js";const x="http://localhost:3000";function ve(){const u=_(),[h,L]=l.useState(""),[n,Q]=l.useState(null),[$,p]=l.useState(!1),[d,b]=l.useState(null),[y,C]=l.useState(null),[i,j]=l.useState(null),{data:o,isLoading:g,error:k,refetch:q}=X({queryKey:["admin","users"],queryFn:async()=>{const s=await fetch(`${x}/api/users/admin/list`,{credentials:"include"});if(!s.ok)throw s.status===403?new Error("Admin access required"):new Error("Failed to fetch users");return s.json()}}),S=w({mutationFn:async({userId:s,updates:t})=>{const c=await fetch(`${x}/api/users/admin/${s}`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)});if(!c.ok)throw new Error("Failed to update user");return c.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["admin","users"]}),a.success("User updated")},onError:()=>a.error("Failed to update user")}),f=w({mutationFn:async s=>{const t=await fetch(`${x}/api/users/admin/${s}/reset-password`,{method:"POST",credentials:"include"});if(!t.ok)throw new Error("Failed to reset password");return t.json()},onSuccess:s=>{b({password:s.temporaryPassword,codes:s.recoveryCodes}),u.invalidateQueries({queryKey:["admin","users"]}),a.success("Password reset successfully")},onError:()=>a.error("Failed to reset password")}),I=w({mutationFn:async s=>{const t=await fetch(`${x}/api/users/admin/${s}`,{method:"DELETE",credentials:"include"});if(!t.ok){const c=await t.json().catch(()=>({error:"Failed to delete user"}));throw new Error(c.error||"Failed to delete user")}return t.json()},onSuccess:()=>{u.invalidateQueries({queryKey:["admin","users"]}),a.success("User deleted")},onError:s=>a.error(s.message)}),A=(s,t)=>{navigator.clipboard.writeText(s),C(t),setTimeout(()=>C(null),2e3),a.success(`${t} copied`)},D=o?.users?.filter(s=>s.name.toLowerCase().includes(h.toLowerCase())||s.email.toLowerCase().includes(h.toLowerCase()))||[],z=s=>{const t=s.role==="admin"?"user":"admin";S.mutate({userId:s.id,updates:{role:t}})},K=s=>{const t=s.status==="active"?"suspended":"active";S.mutate({userId:s.id,updates:{status:t}})},O=s=>{Q(s),p(!0),b(null)},B=()=>{n&&f.mutate(n.id)},H=s=>{j(s)},J=()=>{i&&(I.mutate(i.id),j(null))};return k?e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx(U,{className:"h-12 w-12 text-destructive mb-4"}),e.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-muted-foreground",children:k.message})]})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-3",children:[e.jsx(G,{className:"h-6 w-6"}),"User Management"]}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage user accounts, roles, and permissions"})]}),e.jsxs(r,{variant:"outline",onClick:()=>q(),disabled:g,className:"rounded-xl",children:[e.jsx(V,{className:N("h-4 w-4 mr-2",g&&"animate-spin")}),"Refresh"]})]}),e.jsxs("div",{className:"relative max-w-md",children:[e.jsx(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search users...",value:h,onChange:s=>L(s.target.value),className:"w-full pl-10 pr-4 py-2 field-lg"})]}),e.jsx("div",{className:"rounded-2xl glass shadow-lg overflow-hidden",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 bg-muted/30",children:[e.jsx("th",{className:"text-left p-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"User"}),e.jsx("th",{className:"text-left p-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Role"}),e.jsx("th",{className:"text-left p-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Status"}),e.jsx("th",{className:"text-left p-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Created"}),e.jsx("th",{className:"text-right p-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:g?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"p-8 text-center",children:e.jsx(T,{className:"h-6 w-6 animate-spin mx-auto text-muted-foreground"})})}):D.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"p-8 text-center text-muted-foreground",children:"No users found"})}):D.map(s=>e.jsxs("tr",{className:"border-b border-white/5 last:border-0 hover:bg-muted/20 transition-colors",children:[e.jsx("td",{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[s.avatarUrl?e.jsx("img",{src:s.avatarUrl,alt:s.name,className:"h-10 w-10 rounded-full ring-1 ring-white/10"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-gradient-to-br from-primary to-primary/60 ring-1 ring-white/10 flex items-center justify-center text-sm font-medium text-white",children:s.name.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.email})]})]})}),e.jsx("td",{className:"p-4",children:e.jsxs("span",{className:N("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold",s.role==="admin"?"bg-red-500/10 text-red-500":"bg-blue-500/10 text-blue-500"),children:[s.role==="admin"&&e.jsx(Y,{className:"h-3 w-3"}),s.role]})}),e.jsx("td",{className:"p-4",children:e.jsxs("span",{className:N("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-semibold",s.status==="active"?"bg-green-500/10 text-green-500":"bg-amber-500/10 text-amber-500"),children:[s.status==="active"?e.jsx(R,{className:"h-3 w-3"}):e.jsx(M,{className:"h-3 w-3"}),s.status]})}),e.jsx("td",{className:"p-4 text-sm text-muted-foreground",children:new Date(s.createdAt).toLocaleDateString()}),e.jsx("td",{className:"p-4",children:e.jsx("div",{className:"flex items-center justify-end gap-2",children:e.jsxs(Z,{children:[e.jsx(ee,{asChild:!0,children:e.jsx(r,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-lg",children:e.jsx(xe,{className:"h-4 w-4"})})}),e.jsxs(se,{align:"end",className:"w-48",children:[e.jsx(te,{children:"Actions"}),e.jsx(v,{}),e.jsx(m,{onClick:()=>z(s),children:s.role==="admin"?e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-4 w-4 mr-2"}),"Remove Admin"]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),"Make Admin"]})}),e.jsx(m,{onClick:()=>K(s),children:s.status==="active"?e.jsxs(e.Fragment,{children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"Suspend User"]}):e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"h-4 w-4 mr-2"}),"Activate User"]})}),e.jsx(v,{}),e.jsxs(m,{onClick:()=>O(s),children:[e.jsx(E,{className:"h-4 w-4 mr-2"}),"Reset Password"]}),e.jsx(v,{}),e.jsxs(m,{onClick:()=>H(s),className:"text-destructive focus:text-destructive",children:[e.jsx(he,{className:"h-4 w-4 mr-2"}),"Delete User"]})]})]})})})]},s.id))})]})})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"p-4 rounded-2xl glass shadow-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Users"}),e.jsx("p",{className:"text-2xl font-bold",children:o?.total||0})]}),e.jsxs("div",{className:"p-4 rounded-2xl glass shadow-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Admins"}),e.jsx("p",{className:"text-2xl font-bold text-red-500",children:o?.users?.filter(s=>s.role==="admin").length||0})]}),e.jsxs("div",{className:"p-4 rounded-2xl glass shadow-lg",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Active"}),e.jsx("p",{className:"text-2xl font-bold text-green-500",children:o?.users?.filter(s=>s.status==="active").length||0})]})]}),e.jsx(re,{open:!!i,onOpenChange:s=>!s&&j(null),children:e.jsxs(le,{children:[e.jsxs(ne,{children:[e.jsx(de,{children:"Delete User"}),e.jsxs(ie,{children:["Are you sure you want to delete ",e.jsx("strong",{children:i?.name}),"? This action cannot be undone and will remove all associated data."]})]}),e.jsxs(oe,{children:[e.jsx(ce,{className:"rounded-xl",children:"Cancel"}),e.jsx(me,{onClick:J,className:"rounded-xl bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete User"})]})]})}),$&&n&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:e.jsxs("div",{className:"glass-heavy rounded-2xl shadow-2xl w-full max-w-md mx-4 p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:e.jsx(E,{className:"h-6 w-6 text-amber-500"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:"Reset Password"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.name})]})]}),d?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Temporary Password"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 font-mono text-sm",children:d.password}),e.jsx(r,{size:"sm",variant:"ghost",className:"h-8 w-8 p-0",onClick:()=>A(d.password,"Password"),children:y==="Password"?e.jsx(F,{className:"h-4 w-4 text-green-500"}):e.jsx(P,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Recovery Codes"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:d.codes.map((s,t)=>e.jsx("code",{className:"text-xs font-mono bg-background px-2 py-1 rounded",children:s},t))}),e.jsxs(r,{size:"sm",variant:"outline",className:"w-full mt-3 rounded-xl",onClick:()=>A(d.codes.join(`
|
|
2
|
-
`),"Codes"),children:[y==="Codes"?e.jsx(F,{className:"h-4 w-4 mr-2 text-green-500"}):e.jsx(P,{className:"h-4 w-4 mr-2"}),"Copy All Codes"]})]}),e.jsxs("p",{className:"text-xs text-amber-500 flex items-start gap-2",children:[e.jsx(U,{className:"h-4 w-4 flex-shrink-0 mt-0.5"}),"Share these credentials securely. The user must change their password on next login."]}),e.jsx(r,{className:"w-full rounded-xl",onClick:()=>p(!1),children:"Done"})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This will generate a new temporary password and recovery codes for"," ",e.jsx("strong",{children:n.email}),". All existing sessions will be revoked."]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(r,{variant:"outline",className:"flex-1 rounded-xl",onClick:()=>p(!1),children:"Cancel"}),e.jsx(r,{className:"flex-1 rounded-xl",onClick:B,disabled:f.isPending,children:f.isPending?e.jsx(T,{className:"h-4 w-4 animate-spin"}):"Reset Password"})]})]})]})})]})}export{ve as UserManagement};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as se,r as a,n as xe,u as E,o as B,t as n,m,j as e,k as l,P as X,p as c,I as J,L as f,i as V,C as ue,S as he,X as ge,O}from"./index-lJlNPFVJ.js";import{T as pe}from"./textarea-DsVPnSgR.js";import{B as q}from"./badge-CVHH1a-v.js";import{D as je,a as Ne,b as fe,c as be,d as ve,e as ye,f as we}from"./dialog-BUqN9Psj.js";import{S as b,a as v,b as y,c as w,d as x}from"./select-CeQ8AHGy.js";import{a as ke}from"./EstimateSelect-1hQf4Osk.js";import{B as Ce}from"./brain-6o_RHVpe.js";import{W as Z}from"./wand-sparkles-BusQ52ZK.js";import{F as Se}from"./folder-open-BJi577JH.js";import{L as _e}from"./link-2-DdO7ostF.js";import{L as te,C as ze}from"./layers-jFqVrWMD.js";import{a as ae,B as Ie}from"./bug-CmZI7jqM.js";import{H as Ae}from"./hash-DNEv8Elo.js";import{L as ee}from"./lightbulb-Jhp7FvbU.js";const Te=[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]],Le=se("kanban",Te);const Pe=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Fe=se("list",Pe),Me=[{value:"task",label:"Task",icon:ue},{value:"bug",label:"Bug",icon:Ie},{value:"feature",label:"Feature",icon:he},{value:"epic",label:"Epic",icon:te},{value:"story",label:"Story",icon:ae},{value:"subtask",label:"Subtask",icon:ze}],De=[{value:"urgent",label:"Urgent",color:"text-red-500"},{value:"high",label:"High",color:"text-orange-500"},{value:"medium",label:"Medium",color:"text-yellow-500"},{value:"low",label:"Low",color:"text-blue-500"},{value:"none",label:"None",color:"text-gray-500"}];function Xe({defaultProjectId:u,defaultParentId:h}={}){const[K,R]=a.useState(!1),[i,k]=a.useState(""),[g,C]=a.useState(""),[S,_]=a.useState("task"),[$,z]=a.useState("medium"),[H,p]=a.useState(""),[I,W]=a.useState(null),[j,Q]=a.useState(u),[U,A]=a.useState(h),[T,L]=a.useState(null),[t,Y]=a.useState(null),[ie,P]=a.useState(!1),re=xe(),{data:ne}=E({queryKey:["ai-status"],queryFn:()=>m.tickets.ai.status(),staleTime:6e4}),{data:le}=E({queryKey:["projects"],queryFn:()=>m.projects.list({limit:50})}),{data:ce}=E({queryKey:["tickets","parents",j],queryFn:()=>m.tickets.list({projectId:j||void 0,type:["epic","story"],limit:50}),enabled:K}),oe=le?.projects||[],N=ce?.tickets||[],o=ne?.available??!1,d=B({mutationFn:()=>m.tickets.ai.categorize(i,g||void 0),onSuccess:s=>{s.categorization?(L(s.categorization),_(s.categorization.type),z(s.categorization.priority),s.categorization.labels.length>0&&p(s.categorization.labels.join(", ")),n.success(`AI categorized with ${Math.round(s.categorization.confidence*100)}% confidence`)):n.error("AI could not categorize this ticket")},onError:()=>{n.error("AI categorization failed")}}),F=B({mutationFn:()=>m.tickets.ai.suggest(i,g||void 0,S),onSuccess:s=>{s.suggestions?(Y(s.suggestions),P(!0)):n.error("AI could not generate suggestions")},onError:()=>{n.error("AI suggestion failed")}});a.useEffect(()=>{if(o&&i.length>=10&&!T&&!d.isPending){const s=setTimeout(()=>{d.mutate()},1e3);return()=>clearTimeout(s)}},[i,o]);const M=(s,r)=>{s==="title"&&typeof r=="string"?k(r):s==="description"&&typeof r=="string"?C(r):s==="suggestedLabels"&&Array.isArray(r)&&p(r.join(", ")),n.success(`Applied AI suggestion for ${s}`)},D=B({mutationFn:s=>m.tickets.create(s),onSuccess:s=>{re.invalidateQueries({queryKey:["tickets"]}),n.success(`Ticket PROFCLAW-${s.ticket.sequence} created`),G()},onError:s=>{n.error(`Failed to create ticket: ${s.message}`)}}),G=()=>{R(!1),k(""),C(""),_("task"),z("medium"),p(""),W(null),Q(u),A(h),L(null),Y(null),P(!1)},de=s=>{if(s.preventDefault(),!i.trim()){n.error("Title is required");return}const r=H.split(",").map(me=>me.trim()).filter(Boolean);D.mutate({title:i.trim(),description:g.trim()||void 0,type:S,priority:$,labels:r.length>0?r:void 0,estimate:I??void 0,estimateUnit:I!==null?"points":void 0,projectId:j||void 0,parentId:U||void 0,createdBy:"human"})};return e.jsxs(je,{open:K,onOpenChange:R,children:[e.jsx(Ne,{asChild:!0,children:e.jsxs(l,{className:"gap-2 rounded-xl",children:[e.jsx(X,{className:"h-4 w-4"}),"Create Ticket"]})}),e.jsx(fe,{className:"glass-heavy rounded-[20px] border-white/10 sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:de,children:[e.jsxs(be,{children:[e.jsxs(ve,{className:"flex items-center gap-2",children:["Create Ticket",o&&e.jsxs(q,{variant:"outline",className:"text-xs font-normal gap-1 border-primary/30 text-primary",children:[e.jsx(Ce,{className:"h-3 w-3"}),"AI Assist"]})]}),e.jsxs(ye,{children:["Create a new ticket for your project. ",o?"AI will help categorize and suggest improvements.":"AI agents can pick this up and work on it."]})]}),e.jsxs("div",{className:"grid gap-4 py-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(c,{htmlFor:"title",children:"Title *"}),e.jsx(J,{id:"title",placeholder:"Brief description of the ticket...",value:i,onChange:s=>{k(s.target.value),L(null)},className:"bg-white/5 border-white/10 rounded-xl",autoFocus:!0}),o&&i.length>=10&&e.jsx("div",{className:"flex items-center gap-2 text-xs",children:d.isPending?e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[e.jsx(f,{className:"h-3 w-3 animate-spin"}),"AI analyzing..."]}):T?e.jsxs("span",{className:"flex items-center gap-1 text-green-400",children:[e.jsx(Z,{className:"h-3 w-3"}),"AI categorized (",Math.round(T.confidence*100),"% confidence)"]}):null})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(c,{htmlFor:"description",children:"Description"}),e.jsx(pe,{id:"description",placeholder:"Detailed description, acceptance criteria, etc...",value:g,onChange:s=>C(s.target.value),className:"bg-white/5 border-white/10 rounded-xl min-h-[100px] resize-none"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(c,{className:"flex items-center gap-1.5",children:[e.jsx(Se,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Project"]}),e.jsxs(b,{value:j||"__none__",onValueChange:s=>{Q(s==="__none__"?void 0:s),A(void 0)},children:[e.jsx(v,{className:"bg-white/5 border-white/10 rounded-xl",children:e.jsx(y,{placeholder:"Select project..."})}),e.jsxs(w,{className:"glass-heavy rounded-xl border-white/10",children:[e.jsx(x,{value:"__none__",children:e.jsx("span",{className:"text-muted-foreground",children:"No project"})}),oe.map(s=>e.jsx(x,{value:s.id,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{children:s.icon}),e.jsx("span",{className:"truncate",children:s.name}),e.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:s.key})]})},s.id))]})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(c,{className:"flex items-center gap-1.5",children:[e.jsx(_e,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Parent (Epic/Story)"]}),e.jsxs(b,{value:U||"__none__",onValueChange:s=>A(s==="__none__"?void 0:s),disabled:N.length===0,children:[e.jsx(v,{className:V("bg-white/5 border-white/10 rounded-xl",N.length===0&&"opacity-50"),children:e.jsx(y,{placeholder:N.length===0?"No epics/stories":"Select parent..."})}),e.jsxs(w,{className:"glass-heavy rounded-xl border-white/10 max-h-[200px]",children:[e.jsx(x,{value:"__none__",children:e.jsx("span",{className:"text-muted-foreground",children:"No parent"})}),N.map(s=>e.jsx(x,{value:s.id,children:e.jsxs("span",{className:"flex items-center gap-2",children:[s.type==="epic"?e.jsx(te,{className:"h-3.5 w-3.5 text-amber-400"}):e.jsx(ae,{className:"h-3.5 w-3.5 text-cyan-400"}),e.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:[s.projectKey||"PROFCLAW","-",s.sequence]}),e.jsx("span",{className:"truncate max-w-[140px]",children:s.title})]})},s.id))]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(c,{children:"Type"}),e.jsxs(b,{value:S,onValueChange:s=>_(s),children:[e.jsx(v,{className:"bg-white/5 border-white/10 rounded-xl",children:e.jsx(y,{})}),e.jsx(w,{className:"glass-heavy rounded-xl border-white/10",children:Me.map(s=>e.jsx(x,{value:s.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(s.icon,{className:"h-4 w-4"}),s.label]})},s.value))})]})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(c,{children:"Priority"}),e.jsxs(b,{value:$,onValueChange:s=>z(s),children:[e.jsx(v,{className:"bg-white/5 border-white/10 rounded-xl",children:e.jsx(y,{})}),e.jsx(w,{className:"glass-heavy rounded-xl border-white/10",children:De.map(s=>e.jsx(x,{value:s.value,children:e.jsx("span",{className:`flex items-center gap-2 ${s.color}`,children:s.label})},s.value))})]})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"col-span-2 grid gap-2",children:[e.jsx(c,{htmlFor:"labels",children:"Labels"}),e.jsx(J,{id:"labels",placeholder:"Comma-separated labels (e.g., frontend, auth)",value:H,onChange:s=>p(s.target.value),className:"bg-white/5 border-white/10 rounded-xl"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(c,{className:"flex items-center gap-1.5",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Estimate"]}),e.jsx(ke,{value:I,onChange:W,placeholder:"Points"})]})]}),o&&i.length>=5&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(l,{type:"button",variant:"outline",size:"sm",onClick:()=>d.mutate(),disabled:d.isPending,className:"flex-1 gap-1 rounded-xl border-white/10 text-xs",children:[d.isPending?e.jsx(f,{className:"h-3 w-3 animate-spin"}):e.jsx(Z,{className:"h-3 w-3"}),"Re-categorize"]}),e.jsxs(l,{type:"button",variant:"outline",size:"sm",onClick:()=>F.mutate(),disabled:F.isPending,className:"flex-1 gap-1 rounded-xl border-white/10 text-xs",children:[F.isPending?e.jsx(f,{className:"h-3 w-3 animate-spin"}):e.jsx(ee,{className:"h-3 w-3"}),"Get AI Suggestions"]})]}),ie&&t&&e.jsxs("div",{className:"rounded-xl bg-primary/5 border border-primary/20 p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium text-primary",children:[e.jsx(ee,{className:"h-4 w-4"}),"AI Suggestions"]}),e.jsx(l,{type:"button",variant:"ghost",size:"sm",onClick:()=>P(!1),className:"h-6 w-6 p-0 rounded-lg",children:e.jsx(ge,{className:"h-3 w-3"})})]}),t.title&&t.title!==i&&e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Improved title:"}),e.jsx("p",{className:"text-sm truncate",children:t.title})]}),e.jsx(l,{type:"button",variant:"ghost",size:"sm",onClick:()=>M("title",t.title),className:"h-6 px-2 rounded-lg text-xs text-green-400 hover:text-green-300",children:e.jsx(O,{className:"h-3 w-3"})})]}),t.description&&e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Suggested description:"}),e.jsx("p",{className:"text-sm line-clamp-2",children:t.description})]}),e.jsx(l,{type:"button",variant:"ghost",size:"sm",onClick:()=>M("description",t.description),className:"h-6 px-2 rounded-lg text-xs text-green-400 hover:text-green-300",children:e.jsx(O,{className:"h-3 w-3"})})]}),t.acceptanceCriteria&&t.acceptanceCriteria.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Acceptance criteria:"}),e.jsx("ul",{className:"text-xs space-y-0.5 text-muted-foreground",children:t.acceptanceCriteria.slice(0,3).map((s,r)=>e.jsxs("li",{className:"flex items-start gap-1",children:[e.jsx("span",{className:"text-primary",children:"-"}),s]},r))})]}),t.suggestedLabels&&t.suggestedLabels.length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Suggested labels:"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:t.suggestedLabels.map(s=>e.jsx(q,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:s},s))})]}),e.jsx(l,{type:"button",variant:"ghost",size:"sm",onClick:()=>M("suggestedLabels",t.suggestedLabels),className:"h-6 px-2 rounded-lg text-xs text-green-400 hover:text-green-300",children:e.jsx(O,{className:"h-3 w-3"})})]}),t.estimatedEffort&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Estimated effort:"}),e.jsx(q,{variant:"outline",className:"text-[10px] capitalize",children:t.estimatedEffort})]})]})]}),e.jsxs(we,{children:[e.jsx(l,{type:"button",variant:"ghost",onClick:G,className:"rounded-xl",children:"Cancel"}),e.jsx(l,{type:"submit",disabled:!i.trim()||D.isPending,className:"gap-2 rounded-xl",children:D.isPending?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(X,{className:"h-4 w-4"}),"Create Ticket"]})})]})]})})]})}function Je({view:u,onChange:h}){return e.jsxs("div",{className:"flex items-center gap-1 p-1 rounded-xl bg-[var(--muted)]/30 border border-[var(--border)]",children:[e.jsxs("button",{onClick:()=>h("list"),className:V("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-all",u==="list"?"bg-[var(--background)] text-[var(--foreground)] shadow-sm":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:[e.jsx(Fe,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"List"})]}),e.jsxs("button",{onClick:()=>h("board"),className:V("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-all",u==="board"?"bg-[var(--background)] text-[var(--foreground)] shadow-sm":"text-[var(--muted-foreground)] hover:text-[var(--foreground)]"),children:[e.jsx(Le,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:"Board"})]})]})}export{Xe as C,Je as V};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{j as o,by as L,bK as m,bD as G,r as s,at as u,bL as H,bz as B,ar as V,bB as W,bC as Y,bA as A,bE as k,bl as q,bF as K,av as J,i as n,bM as D}from"./index-lJlNPFVJ.js";var v="AlertDialog",[Q]=J(v,[m]),i=m(),x=e=>{const{__scopeAlertDialog:a,...t}=e,r=i(a);return o.jsx(L,{...r,...t,modal:!0})};x.displayName=v;var U="AlertDialogTrigger",N=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,l=i(t);return o.jsx(K,{...l,...r,ref:a})});N.displayName=U;var X="AlertDialogPortal",y=e=>{const{__scopeAlertDialog:a,...t}=e,r=i(a);return o.jsx(G,{...r,...t})};y.displayName=X;var Z="AlertDialogOverlay",b=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,l=i(t);return o.jsx(k,{...l,...r,ref:a})});b.displayName=Z;var c="AlertDialogContent",[ee,ae]=Q(c),te=q("AlertDialogContent"),R=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,children:r,...l}=e,g=i(t),p=s.useRef(null),z=u(a,p),f=s.useRef(null);return o.jsx(H,{contentName:c,titleName:_,docsSlug:"alert-dialog",children:o.jsx(ee,{scope:t,cancelRef:f,children:o.jsxs(B,{role:"alertdialog",...g,...l,ref:z,onOpenAutoFocus:V(l.onOpenAutoFocus,d=>{d.preventDefault(),f.current?.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[o.jsx(te,{children:r}),o.jsx(re,{contentRef:p})]})})})});R.displayName=c;var _="AlertDialogTitle",j=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,l=i(t);return o.jsx(W,{...l,...r,ref:a})});j.displayName=_;var h="AlertDialogDescription",C=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,l=i(t);return o.jsx(Y,{...l,...r,ref:a})});C.displayName=h;var oe="AlertDialogAction",E=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,l=i(t);return o.jsx(A,{...l,...r,ref:a})});E.displayName=oe;var w="AlertDialogCancel",P=s.forwardRef((e,a)=>{const{__scopeAlertDialog:t,...r}=e,{cancelRef:l}=ae(w,t),g=i(t),p=u(a,l);return o.jsx(A,{...g,...r,ref:p})});P.displayName=w;var re=({contentRef:e})=>{const a=`\`${c}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
You can add a description to the \`${c}\` by passing a \`${h}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
-
|
|
5
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${c}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
6
|
-
|
|
7
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return s.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(a)},[a,e]),null},se=x,le=N,ie=y,S=b,T=R,O=E,$=P,M=j,I=C;const De=se,ve=le,ne=ie,F=s.forwardRef(({className:e,...a},t)=>o.jsx(S,{className:n("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...a,ref:t}));F.displayName=S.displayName;const ce=s.forwardRef(({className:e,...a},t)=>o.jsxs(ne,{children:[o.jsx(F,{}),o.jsx(T,{ref:t,className:n("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 p-6 shadow-2xl modal-glass duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl",e),...a})]}));ce.displayName=T.displayName;const de=({className:e,...a})=>o.jsx("div",{className:n("flex flex-col space-y-2 text-center sm:text-left",e),...a});de.displayName="AlertDialogHeader";const pe=({className:e,...a})=>o.jsx("div",{className:n("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...a});pe.displayName="AlertDialogFooter";const ge=s.forwardRef(({className:e,...a},t)=>o.jsx(M,{ref:t,className:n("text-lg font-semibold",e),...a}));ge.displayName=M.displayName;const fe=s.forwardRef(({className:e,...a},t)=>o.jsx(I,{ref:t,className:n("text-sm text-muted-foreground",e),...a}));fe.displayName=I.displayName;const me=s.forwardRef(({className:e,...a},t)=>o.jsx(O,{ref:t,className:n(D(),e),...a}));me.displayName=O.displayName;const ue=s.forwardRef(({className:e,...a},t)=>o.jsx($,{ref:t,className:n(D({variant:"outline"}),"mt-2 sm:mt-0",e),...a}));ue.displayName=$.displayName;export{De as A,ce as a,de as b,ge as c,fe as d,pe as e,ue as f,me as g,ve as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as n,i as o,bI as s}from"./index-lJlNPFVJ.js";const a=s("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-[var(--ring)] focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow-sm hover:brightness-110",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground shadow-sm",outline:"border-border text-foreground hover:bg-muted/50",success:"border-transparent bg-success/10 text-success border border-success/20",warning:"border-transparent bg-warning/10 text-warning border border-warning/20",info:"border-transparent bg-info/10 text-info border border-info/20"}},defaultVariants:{variant:"default"}});function i({className:r,variant:e,...t}){return n.jsx("div",{className:o(a({variant:e}),r),...t})}export{i as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a}from"./index-lJlNPFVJ.js";const e=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],t=a("brain",e);export{t as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,an as s,aK as i,S as l,ai as r,_ as c,aB as p,aC as n,aE as d,aF as u,aL as m,aM as g,aN as y,aH as h,aG as k,aO as b,aP as L,aQ as v,aR as M,aS as A,aT as f,aU as I,aV as x,aI as w,aD as U,aW as S,aJ as _,aX as C,aY as P,aZ as G,a_ as z,a$ as N,b0 as T,b1 as V,b2 as B,b3 as R,b4 as q,b5 as D,b6 as E,b7 as O,b8 as H}from"./index-lJlNPFVJ.js";import{S as F}from"./settings-2-ocj5uHGx.js";import{T as K}from"./tag-C35mgoEv.js";import{S as W}from"./smartphone-77_g3SQn.js";import{B as $}from"./brain-6o_RHVpe.js";import{W as Q}from"./wrench-02YaOSiK.js";import{D as j}from"./database-BwTfupDi.js";import{G as X}from"./globe-f-jjCa_g.js";import{C as Z}from"./cpu-DiPMQICV.js";const J=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ie=e("code-xml",J);const Y=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],ee=e("message-circle",Y);const oe=[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]],ae=e("mic",oe);const te=[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]],se=e("monitor-smartphone",te);const ie=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],le=e("plug",ie);const re=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],ce=e("puzzle",re);const pe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],xe=e("shield-alert",pe);const ne=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],de=e("store",ne);const ue=[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]],we=e("test-tube",ue);const me=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Ue=e("volume-2",me),Se=[{id:"general",label:"General",icon:F,description:"Appearance and preferences"},{id:"account",label:"Account",icon:s,description:"Profile and recovery codes"},{id:"notifications",label:"Notifications",icon:i,description:"Alert preferences"},{id:"ai-providers",label:"AI Providers",icon:l,description:"Configure AI models"},{id:"labels",label:"Labels",icon:K,description:"Manage project labels"},{id:"integrations",label:"Integrations",icon:r,description:"API keys and services"},{id:"messaging",label:"Messaging",icon:ee,description:"Telegram, Discord, WhatsApp"},{id:"devices",label:"Devices",icon:W,description:"Manage paired devices"},{id:"memory",label:"Memory",icon:$,description:"Semantic memory system"},{id:"skills",label:"Skills",icon:ce,description:"Modular AI capabilities"},{id:"tools",label:"Tools",icon:Q,description:"AI tool configuration"},{id:"security",label:"Security",icon:c,description:"Tool execution security"},{id:"plugins",label:"Plugins & MCP",icon:le,description:"Extensions and MCP"},{id:"marketplace",label:"Marketplace",icon:de,description:"Browse and install plugins & skills"},{id:"storage",label:"Storage",icon:j,description:"Data and backup"},{id:"voice",label:"Voice",icon:ae,description:"Speech recognition and synthesis"},{id:"pwa",label:"App & Notifications",icon:se,description:"Install app, push notifications"},{id:"tunnels",label:"Tunnels",icon:X,description:"Remote access via Tailscale or Cloudflare"},{id:"system",label:"System",icon:Z,description:"Advanced settings"}],_e=[{type:"anthropic",name:"Anthropic",description:"Claude Opus, Sonnet, Haiku",Logo:p,setupUrl:"https://console.anthropic.com/settings/keys",placeholder:"sk-ant-...",category:"cloud",models:[]},{type:"openai",name:"OpenAI",description:"GPT-4.5, o1, o3-mini",Logo:n,setupUrl:"https://platform.openai.com/api-keys",placeholder:"sk-...",category:"cloud",models:[]},{type:"google",name:"Google AI",description:"Gemini 2.5 Pro, Flash",Logo:d,setupUrl:"https://makersuite.google.com/app/apikey",placeholder:"AIza...",category:"cloud",models:[]},{type:"xai",name:"xAI (Grok)",description:"Grok 2, Grok 3 models",Logo:u,setupUrl:"https://console.x.ai/",placeholder:"xai-...",category:"cloud",models:[]},{type:"mistral",name:"Mistral AI",description:"Mistral Large, Medium, Codestral",Logo:m,setupUrl:"https://console.mistral.ai/api-keys/",placeholder:"your-key...",category:"cloud",models:[]},{type:"cohere",name:"Cohere",description:"Command R, R+",Logo:g,setupUrl:"https://dashboard.cohere.com/api-keys",placeholder:"your-key...",category:"cloud",models:[]},{type:"perplexity",name:"Perplexity",description:"Sonar models with search",Logo:y,setupUrl:"https://www.perplexity.ai/settings/api",placeholder:"pplx-...",category:"cloud",models:[]},{type:"deepseek",name:"DeepSeek",description:"DeepSeek Chat, Coder, R1",Logo:h,setupUrl:"https://platform.deepseek.com/api_keys",placeholder:"sk-...",category:"cloud",models:[]},{type:"groq",name:"Groq",description:"Ultra-fast Llama & Mixtral",Logo:k,setupUrl:"https://console.groq.com/keys",placeholder:"gsk_...",category:"cloud",models:[]},{type:"together",name:"Together AI",description:"Fast open-source models",Logo:b,setupUrl:"https://api.together.xyz/settings/api-keys",placeholder:"your-key...",category:"cloud",models:[]},{type:"cerebras",name:"Cerebras",description:"Fastest Llama inference",Logo:L,setupUrl:"https://cloud.cerebras.ai/",placeholder:"csk-...",category:"cloud",models:[]},{type:"fireworks",name:"Fireworks",description:"Fast serverless inference",Logo:v,setupUrl:"https://fireworks.ai/account/api-keys",placeholder:"fw-...",category:"cloud",models:[]},{type:"replicate",name:"Replicate",description:"Hosted open-source models (Llama, Mixtral)",Logo:M,setupUrl:"https://replicate.com/account/api-tokens",placeholder:"r8_...",category:"cloud",models:[],status:"beta"},{type:"github-models",name:"GitHub Models",description:"GPT-4o, Phi-4, Llama via GitHub",Logo:A,setupUrl:"https://github.com/marketplace/models",placeholder:"ghp_...",category:"cloud",models:[],status:"beta"},{type:"zhipu",name:"Zhipu AI",description:"GLM-5, GLM-4.7, GLM-4 series",Logo:f,setupUrl:"https://open.bigmodel.cn/usercenter/apikeys",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"moonshot",name:"Moonshot (Kimi)",description:"Long-context Kimi models (1M tokens)",Logo:I,setupUrl:"https://platform.moonshot.cn/console/api-keys",placeholder:"sk-...",category:"cloud",models:[],status:"beta"},{type:"qwen",name:"Qwen (Alibaba)",description:"Qwen-Max, Qwen-Plus, Qwen-Turbo",Logo:x,setupUrl:"https://dashscope.console.aliyun.com/apiKey",placeholder:"sk-...",category:"cloud",models:[],status:"beta"},{type:"openrouter",name:"OpenRouter",description:"300+ models via one API",Logo:w,setupUrl:"https://openrouter.ai/keys",placeholder:"sk-or-...",category:"cloud",models:[]},{type:"azure",name:"Azure OpenAI",description:"Enterprise GPT-4 via Azure / Foundry",Logo:U,setupUrl:"https://portal.azure.com/",placeholder:"your-key...",category:"enterprise",models:[],requiresBaseUrl:!0},{type:"bedrock",name:"AWS Bedrock",description:"Claude, Llama, Mistral via AWS",Logo:S,setupUrl:"https://console.aws.amazon.com/bedrock/",placeholder:"AKIA...",category:"enterprise",models:[],status:"stable"},{type:"ollama",name:"Ollama (Local)",description:"Run models locally - free",Logo:_,setupUrl:"https://ollama.ai/download",placeholder:"http://localhost:11434",category:"local",models:[],requiresBaseUrl:!0},{type:"copilot",name:"GitHub Copilot",description:"Use your Copilot subscription (experimental)",Logo:C,setupUrl:"https://github.com/ericc-ch/copilot-api",placeholder:"http://localhost:4141",category:"local",models:[],requiresBaseUrl:!0,status:"experimental"},{type:"volcengine",name:"Volcengine Doubao",description:"Bytedance Doubao Pro/Lite models",Logo:P,setupUrl:"https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"byteplus",name:"BytePlus",description:"International Bytedance AI models",Logo:G,setupUrl:"https://console.byteplus.com/",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"qianfan",name:"Baidu Qianfan",description:"ERNIE Bot 4.0, ERNIE Speed",Logo:z,setupUrl:"https://console.bce.baidu.com/qianfan/ais/console/applicationConsole/application",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"modelstudio",name:"ModelStudio",description:"Alibaba DashScope compatible mode",Logo:N,setupUrl:"https://dashscope.console.aliyun.com/apiKey",placeholder:"sk-...",category:"cloud",models:[],status:"experimental"},{type:"minimax",name:"Minimax",description:"abab6.5, abab5.5 models (245k context)",Logo:T,setupUrl:"https://www.minimaxi.com/user-center/basic-information/interface-key",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"xiaomi",name:"Xiaomi MiLM",description:"Xiaomi AI language models",Logo:V,setupUrl:"https://ai.xiaomi.com/",placeholder:"your-key...",category:"cloud",models:[],status:"experimental"},{type:"huggingface",name:"HuggingFace",description:"Llama, Mistral, and 1000s of open models",Logo:B,setupUrl:"https://huggingface.co/settings/tokens",placeholder:"hf_...",category:"cloud",models:[],status:"beta"},{type:"nvidia-nim",name:"NVIDIA NIM",description:"Llama 3.1 405B, Mixtral via NVIDIA",Logo:R,setupUrl:"https://build.nvidia.com/explore/discover",placeholder:"nvapi-...",category:"cloud",models:[],status:"beta"},{type:"venice",name:"Venice AI",description:"Privacy-preserving AI inference",Logo:q,setupUrl:"https://venice.ai/settings/api",placeholder:"your-key...",category:"cloud",models:[],status:"experimental"},{type:"kilocode",name:"Kilocode",description:"AI-powered code assistance",Logo:D,setupUrl:"https://kilocode.ai/",placeholder:"your-key...",category:"cloud",models:[],status:"experimental"},{type:"vercel-ai",name:"Vercel AI Gateway",description:"Unified gateway for multiple AI providers",Logo:E,setupUrl:"https://vercel.com/docs/ai/gateway",placeholder:"your-key...",category:"cloud",models:[],status:"beta"},{type:"cloudflare-ai",name:"Cloudflare AI Gateway",description:"Route AI calls via Cloudflare Workers AI",Logo:O,setupUrl:"https://dash.cloudflare.com/?to=/:account/ai/ai-gateway",placeholder:"your-token...",category:"cloud",models:[],requiresBaseUrl:!0,status:"beta"},{type:"watsonx",name:"IBM Watsonx",description:"Granite enterprise AI models",Logo:H,setupUrl:"https://dataplatform.cloud.ibm.com/wx/home",placeholder:"your-key...",category:"enterprise",models:[],status:"stable"}],Ce=[{value:"2024-10-21",label:"2024-10-21 (Recommended - Stable)"},{value:"2024-12-01-preview",label:"2024-12-01-preview (For o1/o1-mini)"},{value:"2025-01-01-preview",label:"2025-01-01-preview (Latest Preview)"},{value:"2024-08-01-preview",label:"2024-08-01-preview"},{value:"2024-02-15-preview",label:"2024-02-15-preview (Legacy)"}];function Pe(o){if(!o)return{valid:!0};try{if(!new URL(o).protocol.startsWith("https"))return{valid:!1,message:"Must use HTTPS"};const a=o.includes("openai.azure.com"),t=o.includes("cognitive.microsoft.com")||o.includes("cognitiveservices.azure.com");return a||t?{valid:!0}:{valid:!1,message:"Must be an Azure endpoint (e.g., https://your-resource.openai.azure.com or https://eastus.api.cognitive.microsoft.com)"}}catch{return{valid:!1,message:"Invalid URL format"}}}const Ge="http://localhost:3000";export{Ce as A,Ie as C,ae as M,ce as P,xe as S,we as T,Ue as V,_e as a,Ge as b,le as c,de as d,Se as e,ee as f,Pe as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{by as f,bF as p,r as l,j as t,bD as g,bz as i,bA as x,X as u,i as o,bB as d,bC as n,bE as r}from"./index-lJlNPFVJ.js";const w=f,R=p,y=g,c=l.forwardRef(({className:a,...e},s)=>t.jsx(r,{ref:s,className:o("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...e}));c.displayName=r.displayName;const N=l.forwardRef(({className:a,children:e,...s},m)=>t.jsxs(y,{children:[t.jsx(c,{}),t.jsxs(i,{ref:m,className:o("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 p-6 shadow-2xl modal-glass duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-2xl",a),...s,children:[e,t.jsxs(x,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-[var(--background)] transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-[var(--ring)] focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-[var(--accent)] data-[state=open]:text-[var(--muted-foreground)]",children:[t.jsx(u,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));N.displayName=i.displayName;const b=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col space-y-1.5 text-center sm:text-left",a),...e});b.displayName="DialogHeader";const D=({className:a,...e})=>t.jsx("div",{className:o("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...e});D.displayName="DialogFooter";const j=l.forwardRef(({className:a,...e},s)=>t.jsx(d,{ref:s,className:o("text-lg font-semibold leading-none tracking-tight",a),...e}));j.displayName=d.displayName;const v=l.forwardRef(({className:a,...e},s)=>t.jsx(n,{ref:s,className:o("text-sm text-[var(--muted-foreground)]",a),...e}));v.displayName=n.displayName;export{w as D,R as a,N as b,b as c,j as d,v as e,D as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Q,u as A,n as w,o as b,m as f,r as p,j as e,b as i,f as c,k as j,H as k,ak as y,i as C,U as L,g as D,a5 as I,R as v,t as h}from"./index-lJlNPFVJ.js";import{B as q}from"./badge-CVHH1a-v.js";import{S as z}from"./skeleton-TFiFJ3nB.js";import{C as B}from"./circle-x-Dgw11LgT.js";import{C as K}from"./chevron-up-CoUsOvZj.js";import{T as M}from"./trash-2-keO5tKPE.js";const E=[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]],U=Q("skull",E);function _(){return A({queryKey:["dlq"],queryFn:()=>f.dlq.list(),refetchInterval:1e4})}function H(){const t=w();return b({mutationFn:n=>f.dlq.retry(n),onSuccess:()=>{t.invalidateQueries({queryKey:["dlq"]}),t.invalidateQueries({queryKey:["tasks"]})}})}function X(){const t=w();return b({mutationFn:n=>f.dlq.remove(n),onSuccess:()=>{t.invalidateQueries({queryKey:["dlq"]})}})}function G({task:t,onRetry:n,onRemove:u,isRetrying:o,isRemoving:x}){const[l,m]=p.useState(!1);return e.jsx(i,{className:"glass rounded-[20px] overflow-hidden border-red-500/10 group hover-lift transition-liquid",children:e.jsx(c,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:"h-8 w-8 rounded-xl bg-red-500/10 flex items-center justify-center flex-shrink-0",children:e.jsx(B,{className:"h-4 w-4 text-red-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-bold truncate",children:t.title}),e.jsxs("div",{className:"flex items-center gap-3 text-[10px] text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(D,{className:"h-3 w-3"}),new Date(t.failedAt).toLocaleString()]}),e.jsxs(q,{variant:"secondary",className:"text-[9px] px-1.5 py-0",children:[t.attempts," ",t.attempts===1?"attempt":"attempts"]})]})]})]}),e.jsx("button",{onClick:()=>m(!l),className:"w-full text-left",children:e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[l?e.jsx(K,{className:"h-3 w-3"}):e.jsx(I,{className:"h-3 w-3"}),e.jsx("span",{className:C("transition-all",l?"":"truncate"),children:t.error})]})}),l&&e.jsx("div",{className:"mt-3 p-3 rounded-xl bg-red-500/5 border border-red-500/10",children:e.jsx("pre",{className:"text-[10px] text-red-300 whitespace-pre-wrap font-mono overflow-x-auto",children:t.error})})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs(j,{variant:"outline",size:"sm",className:"h-8 rounded-xl text-[11px] font-bold border-green-500/20 text-green-400 hover:bg-green-500/10",onClick:n,disabled:o,children:[o?e.jsx(v,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(k,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry"]}),e.jsxs(j,{variant:"outline",size:"sm",className:"h-8 rounded-xl text-[11px] font-bold border-red-500/20 text-red-400 hover:bg-red-500/10",onClick:u,disabled:x,children:[x?e.jsx(v,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):e.jsx(M,{className:"h-3.5 w-3.5 mr-1.5"}),"Remove"]})]})]})})})}function Z(){const{data:t,isLoading:n,error:u}=_(),o=H(),x=X(),[l,m]=p.useState(new Set),[R,g]=p.useState(new Set),N=async s=>{m(r=>new Set(r).add(s));try{await o.mutateAsync(s),h.success("Task queued for retry")}catch{h.error("Failed to retry task")}finally{m(r=>{const d=new Set(r);return d.delete(s),d})}},S=async s=>{g(r=>new Set(r).add(s));try{await x.mutateAsync(s),h.success("Task removed from DLQ")}catch{h.error("Failed to remove task")}finally{g(r=>{const d=new Set(r);return d.delete(s),d})}},T=async()=>{if(t?.tasks)for(const s of t.tasks)await N(s.id)};if(n)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Failed Tasks"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading dead letter queue..."})]}),e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsx(z,{className:"h-24 rounded-[20px] skeleton-glass"},s))})]});if(u)return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Failed Tasks"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Dead Letter Queue"})]}),e.jsx(i,{className:"glass rounded-[28px] border-red-500/10",children:e.jsx(c,{className:"p-8 text-center",children:e.jsx("p",{className:"text-red-400",children:"Failed to load dead letter queue"})})})]});const F=t?.tasks??[],a=t?.count??0;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Failed Tasks"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Tasks that failed processing and need attention."})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[a>0&&e.jsxs(j,{variant:"outline",size:"sm",className:"rounded-xl text-[11px] font-bold",onClick:T,children:[e.jsx(k,{className:"h-3.5 w-3.5 mr-1.5"}),"Retry All (",a,")"]}),e.jsx("div",{className:C("flex items-center gap-2 px-4 py-2 rounded-full glass border-white/10",a>0?"border-red-500/20":"border-green-500/20"),children:a>0?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-4 w-4 text-red-400"}),e.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-widest text-red-400",children:[a," Failed"]})]}):e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-4 w-4 text-green-400"}),e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-green-400",children:"All Clear"})]})})]})]}),a>0&&e.jsx(i,{className:"glass rounded-[24px] border-yellow-500/10 overflow-hidden",children:e.jsx(c,{className:"p-4",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"h-12 w-12 rounded-2xl bg-gradient-to-br from-yellow-500 to-orange-600 flex items-center justify-center shadow-lg shadow-yellow-500/20",children:e.jsx(L,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-bold",children:"Attention Required"}),e.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[a," ",a===1?"task has":"tasks have"," failed and been moved to the dead letter queue. Review the errors and retry or remove them."]})]})]})})}),a===0?e.jsx(i,{className:"glass rounded-[28px] border-white/5",children:e.jsx(c,{className:"p-12",children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx("div",{className:"h-20 w-20 rounded-full glass-heavy flex items-center justify-center mb-6 border border-green-500/20",children:e.jsx(y,{className:"h-10 w-10 text-green-400"})}),e.jsx("h3",{className:"text-xl font-bold mb-2",children:"No Failed Tasks"}),e.jsx("p",{className:"text-muted-foreground max-w-md",children:"All tasks are processing normally. Failed tasks will appear here if any agent encounters an error during execution."})]})})}):e.jsx("div",{className:"space-y-3",children:F.map(s=>e.jsx(G,{task:s,onRetry:()=>N(s.id),onRemove:()=>S(s.id),isRetrying:l.has(s.id),isRemoving:R.has(s.id)},s.id))}),e.jsx(i,{className:"glass rounded-[24px] border-white/5",children:e.jsx(c,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"h-10 w-10 rounded-xl glass-heavy flex items-center justify-center flex-shrink-0",children:e.jsx(q,{variant:"secondary",className:"text-[10px] px-2 py-0.5",children:"?"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-bold",children:"About the Dead Letter Queue"}),e.jsxs("ul",{className:"text-[12px] text-muted-foreground space-y-1.5 list-disc list-inside",children:[e.jsx("li",{children:"Tasks are moved here after failing multiple retry attempts"}),e.jsxs("li",{children:[e.jsx("strong",{children:"Retry"})," puts the task back in the main queue for another attempt"]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Remove"})," permanently deletes the task from the queue"]}),e.jsx("li",{children:"Check the error message to understand why the task failed"})]})]})]})})})]})}export{Z as DLQDashboard,_ as useDLQTasks,X as useRemoveDLQTask,H as useRetryDLQTask};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as O,r as m,u as v,o as Z,m as u,j as e,M as X,g as _,b as r,d as n,e as c,f as d,Z as J,ak as S,am as N,p as y,I as Y,k as ee}from"./index-lJlNPFVJ.js";import{B as l}from"./badge-CVHH1a-v.js";import{T as se}from"./textarea-DsVPnSgR.js";import{S as M,a as q,b as A,c as D,d as w}from"./select-CeQ8AHGy.js";import{P as te}from"./progress-uv4SPkL5.js";import{C as R}from"./circle-x-Dgw11LgT.js";import{S as ae}from"./server-CVHTZB72.js";import{T as le}from"./trending-up-BBv8KbrY.js";import"./chevron-up-CoUsOvZj.js";function he(){const k=O(),[o,L]=m.useState(""),[C,F]=m.useState(""),[h,E]=m.useState("__auto__"),[j,P]=m.useState("__auto__"),[a,$]=m.useState(null),{data:K,isLoading:B}=v({queryKey:["gateway","agents"],queryFn:()=>u.gateway.agents(),refetchInterval:3e4}),{data:I,isLoading:W}=v({queryKey:["gateway","workflows"],queryFn:()=>u.gateway.workflows()}),{data:Q}=v({queryKey:["gateway","config"],queryFn:()=>u.gateway.config()}),{data:U,isLoading:z}=v({queryKey:["gateway","status"],queryFn:()=>u.gateway.status(),refetchInterval:5e3}),b=Z({mutationFn:s=>u.gateway.execute(s),onSuccess:s=>{$(s),k.invalidateQueries({queryKey:["tasks"]}),k.invalidateQueries({queryKey:["stats"]})}}),G=()=>{if(!o.trim())return;const s={task:{title:o,prompt:C||o,source:"gateway-ui",priority:3},workflow:h&&h!=="__auto__"?h:void 0,preferredAgent:j&&j!=="__auto__"?j:void 0,autonomous:!0};b.mutate(s)},x=K?.agents||[],g=I?.workflows||[],V=Q?.config,t=U,H=s=>{const i=Math.floor(s/1e3),f=Math.floor(i/60),p=Math.floor(f/60),T=Math.floor(p/24);return T>0?`${T}d ${p%24}h`:p>0?`${p}h ${f%60}m`:f>0?`${f}m ${i%60}s`:`${i}s`};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:"Gateway"}),e.jsx("p",{className:"text-muted-foreground",children:"Execute tasks through the unified routing system"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[z?e.jsx(l,{variant:"secondary",children:"Checking..."}):t?.status.online?e.jsxs(l,{variant:"default",className:"gap-1",children:[e.jsx(X,{className:"h-3 w-3"}),"Online"]}):e.jsxs(l,{variant:"destructive",className:"gap-1",children:[e.jsx(R,{className:"h-3 w-3"}),"Offline"]}),t&&e.jsxs(l,{variant:"outline",className:"gap-1",children:[e.jsx(_,{className:"h-3 w-3"}),H(t.status.uptime)]})]})]}),t&&e.jsxs(r,{className:"shadow-elevated",children:[e.jsx(n,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(c,{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-5 w-5"}),"Gateway Status"]}),e.jsxs(l,{variant:t.status.activeRequests>0?"default":"secondary",children:[t.status.activeRequests," active request",t.status.activeRequests!==1?"s":""]})]})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Capacity Utilization"}),e.jsxs("span",{className:"font-medium",children:[t.status.utilizationPercent,"%"]})]}),e.jsx(te,{value:t.status.utilizationPercent,className:"h-2"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.status.activeRequests," / ",t.status.maxConcurrent," concurrent slots used"]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground text-xs mb-1",children:[e.jsx(J,{className:"h-3 w-3"}),"Total Tasks"]}),e.jsx("div",{className:"text-xl font-bold",children:t.metrics.totalTasks})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground text-xs mb-1",children:[e.jsx(S,{className:"h-3 w-3"}),"Success Rate"]}),e.jsxs("div",{className:"text-xl font-bold",children:[t.metrics.successRate,"%"]})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground text-xs mb-1",children:[e.jsx(_,{className:"h-3 w-3"}),"Avg Duration"]}),e.jsx("div",{className:"text-xl font-bold",children:t.metrics.averageDurationMs>6e4?`${Math.round(t.metrics.averageDurationMs/6e4)}m`:`${Math.round(t.metrics.averageDurationMs/1e3)}s`})]}),e.jsxs("div",{className:"rounded-lg bg-muted/50 p-3 text-center",children:[e.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground text-xs mb-1",children:[e.jsx(le,{className:"h-3 w-3"}),"Total Load"]}),e.jsx("div",{className:"text-xl font-bold",children:t.agents.totalLoad})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"font-medium",children:"Connected Agents"}),e.jsxs("span",{className:"text-muted-foreground",children:[t.agents.healthy,"/",t.agents.total," healthy"]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.agents.list.map(s=>e.jsxs(l,{variant:s.healthy?"outline":"destructive",className:"gap-1",children:[s.healthy?e.jsx(S,{className:"h-3 w-3 text-green-500"}):e.jsx(R,{className:"h-3 w-3"}),s.name,s.load>0&&e.jsxs("span",{className:"text-xs opacity-70",children:["(",s.load,")"]}),s.latencyMs!==void 0&&e.jsxs("span",{className:"text-xs opacity-70",children:[s.latencyMs,"ms"]})]},s.type)),t.agents.list.length===0&&e.jsx("span",{className:"text-sm text-muted-foreground",children:"No agents connected"})]})]})]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(r,{children:[e.jsx(n,{className:"pb-2",children:e.jsx(c,{className:"text-sm font-medium",children:"Available Agents"})}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:x.length}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[x.filter(s=>s.health.healthy).length," healthy"]})]})]}),e.jsxs(r,{children:[e.jsx(n,{className:"pb-2",children:e.jsx(c,{className:"text-sm font-medium",children:"Workflows"})}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:g.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Available templates"})]})]}),e.jsxs(r,{children:[e.jsx(n,{className:"pb-2",children:e.jsx(c,{className:"text-sm font-medium",children:"Config"})}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:V?.enableScoring?"Smart":"Basic"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Routing mode"})]})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs(r,{children:[e.jsxs(n,{children:[e.jsx(c,{children:"Execute Task"}),e.jsx(N,{children:"Route a task through the gateway for intelligent agent selection"})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"title",children:"Task Title"}),e.jsx(Y,{id:"title",placeholder:"Fix authentication bug",value:o,onChange:s=>L(s.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{htmlFor:"prompt",children:"Task Prompt (optional)"}),e.jsx(se,{id:"prompt",placeholder:"Detailed description of the task...",value:C,onChange:s=>F(s.target.value),rows:3})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{children:"Workflow"}),e.jsxs(M,{value:h,onValueChange:E,children:[e.jsx(q,{children:e.jsx(A,{placeholder:"Auto-detect"})}),e.jsxs(D,{children:[e.jsx(w,{value:"__auto__",children:"Auto-detect"}),g.map(s=>e.jsx(w,{value:s.type,children:s.name},s.type))]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(y,{children:"Preferred Agent"}),e.jsxs(M,{value:j,onValueChange:P,children:[e.jsx(q,{children:e.jsx(A,{placeholder:"Auto-select"})}),e.jsxs(D,{children:[e.jsx(w,{value:"__auto__",children:"Auto-select"}),x.map(s=>e.jsxs(w,{value:s.type,disabled:!s.health.healthy,children:[s.name," ",!s.health.healthy&&"(unhealthy)"]},s.type))]})]})]})]}),e.jsx(ee,{onClick:G,disabled:!o.trim()||b.isPending,className:"w-full",children:b.isPending?"Executing...":"Execute Task"})]})]}),e.jsxs(r,{children:[e.jsxs(n,{children:[e.jsx(c,{children:"Execution Result"}),e.jsx(N,{children:a?"Last execution result":"Execute a task to see results"})]}),e.jsx(d,{children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l,{variant:a.success?"default":"destructive",children:a.success?"Success":"Failed"}),a.agent&&e.jsx(l,{variant:"outline",children:a.agent}),a.workflow&&e.jsx(l,{variant:"secondary",children:a.workflow})]}),a.routing&&e.jsxs("div",{className:"rounded-lg bg-muted p-3 space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Routing Decision"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:a.routing.reason}),a.routing.scores.length>0&&e.jsxs("div",{className:"mt-2 space-y-1",children:[e.jsx("div",{className:"text-xs font-medium",children:"Scores:"}),a.routing.scores.map(s=>e.jsxs("div",{className:"flex justify-between text-xs",children:[e.jsx("span",{children:s.agent}),e.jsx("span",{className:"font-mono",children:s.score.toFixed(1)})]},s.agent))]})]}),a.metrics&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total"}),e.jsxs("div",{className:"font-mono text-sm",children:[(a.metrics.totalDuration/1e3).toFixed(2),"s"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Routing"}),e.jsxs("div",{className:"font-mono text-sm",children:[a.metrics.routingDuration,"ms"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Execution"}),e.jsxs("div",{className:"font-mono text-sm",children:[(a.metrics.executionDuration/1e3).toFixed(2),"s"]})]})]}),a.error&&e.jsx("div",{className:"rounded-lg bg-destructive/10 p-3 text-sm text-destructive",children:a.error})]}):e.jsx("div",{className:"flex h-32 items-center justify-center text-muted-foreground",children:"No execution yet"})})]})]}),e.jsxs(r,{children:[e.jsxs(n,{children:[e.jsx(c,{children:"Available Agents"}),e.jsx(N,{children:"Agents registered with the gateway for task execution"})]}),e.jsx(d,{children:B?e.jsx("div",{className:"text-muted-foreground",children:"Loading agents..."}):x.length===0?e.jsx("div",{className:"text-muted-foreground",children:"No agents available"}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:x.map(s=>e.jsxs("div",{className:"rounded-lg bg-card/50 shadow-sm p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx(l,{variant:s.health.healthy?"default":"destructive",children:s.health.healthy?"Healthy":"Unhealthy"})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s.description}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.capabilities.slice(0,4).map(i=>e.jsx(l,{variant:"outline",className:"text-xs",children:i},i)),s.capabilities.length>4&&e.jsxs(l,{variant:"outline",className:"text-xs",children:["+",s.capabilities.length-4]})]}),s.health.latencyMs!==void 0&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latency: ",s.health.latencyMs,"ms"]})]},s.type))})})]}),e.jsxs(r,{children:[e.jsxs(n,{children:[e.jsx(c,{children:"Workflow Templates"}),e.jsx(N,{children:"Pre-defined workflows for common task types"})]}),e.jsx(d,{children:W?e.jsx("div",{className:"text-muted-foreground",children:"Loading workflows..."}):g.length===0?e.jsx("div",{className:"text-muted-foreground",children:"No workflows available"}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:g.map(s=>e.jsxs("div",{className:"rounded-lg bg-card/50 shadow-sm p-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsxs(l,{variant:"secondary",children:[s.steps," steps"]})]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:s.description}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.requiredCapabilities.map(i=>e.jsx(l,{variant:"outline",className:"text-xs",children:i},i))}),s.defaultTimeoutMs&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Timeout: ",Math.round(s.defaultTimeoutMs/1e3/60),"min"]})]},s.type))})})]})]})}export{he as GatewayDashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as le,r,K as ue,C as G,g as J,j as e,i as l,D as Fe,x as Ie,k as D,y as Oe,z,Z as xe,aw as is,R as re,u as Ne,L as ne,U as he,m as O,n as ze,S as qe,a1 as hs,M as ps,ay as gs,o as K,P as fs,O as Ms,l as Rs,p as g,aK as Je,aj as Ds,I as C,v as we,_ as As,be as Ps,A as Fs,X as Is,w as Os}from"./index-lJlNPFVJ.js";import{A as Js,a as Ls,b as zs,c as qs,d as _s,e as $s,f as Hs,g as Us}from"./alert-dialog-SKM6Gjz4.js";import{M as Ce}from"./message-square-CBgH65X7.js";import{W as Y}from"./wrench-02YaOSiK.js";import{G as Se}from"./globe-f-jjCa_g.js";import{A as _e}from"./archive-BsLa7brF.js";import{C as ae}from"./circle-x-Dgw11LgT.js";import{E as Ks}from"./ellipsis-vertical-DoULYEKn.js";import{P as Gs}from"./pencil-CYXCEPQh.js";import{H as Qs}from"./history-BQSBo_1Q.js";import{P as ke}from"./play-d1ONaH0-.js";import{T as bs}from"./trash-2-keO5tKPE.js";import{T as vs}from"./tag-C35mgoEv.js";import{T as pe,C as De,I as Le,S as Ws}from"./timer-DHJBS2w1.js";import{D as $e,b as He,c as Ue,d as Ke,a as Bs}from"./dialog-BUqN9Psj.js";import{S as js}from"./settings-2-ocj5uHGx.js";import{L as Vs}from"./link-2-DdO7ostF.js";import{W as Ys}from"./wand-sparkles-BusQ52ZK.js";import{G as Xs}from"./git-branch-C_K30am0.js";import{D as Zs}from"./database-BwTfupDi.js";import{F as et}from"./file-code-B2UrJLwi.js";import{C as Te}from"./calendar-Bf0t2B82.js";import{L as st}from"./lightbulb-Jhp7FvbU.js";import{T as tt}from"./trending-up-BBv8KbrY.js";import{F as at}from"./funnel-PkaD_HSR.js";const rt=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],nt=le("archive-restore",rt);const lt=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],it=le("hard-drive",lt);const ot=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],ct=le("megaphone",ot);const dt=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],ge=le("pause",dt);const mt=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],os=le("refresh-ccw",mt);const xt=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ut=le("sliders-horizontal",xt),ht={http:Se,tool:Y,script:ue,message:Ce},pt={active:{color:"text-green-500",bg:"bg-green-500/10",icon:G,label:"Active"},paused:{color:"text-amber-500",bg:"bg-amber-500/10",icon:ge,label:"Paused"},completed:{color:"text-blue-500",bg:"bg-blue-500/10",icon:G,label:"Completed"},failed:{color:"text-red-500",bg:"bg-red-500/10",icon:ae,label:"Failed"},archived:{color:"text-muted-foreground",bg:"bg-muted/50",icon:_e,label:"Archived"}},gt={color:"text-muted-foreground",bg:"bg-muted/50",icon:J,label:"Unknown"};function ft(t){if(!t)return"Not scheduled";const o=new Date(t),f=new Date,i=o.getTime()-f.getTime();return i<0?"Overdue":i<6e4?"In less than a minute":i<36e5?`In ${Math.round(i/6e4)} min`:i<864e5?`In ${Math.round(i/36e5)} hours`:o.toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function bt(t){if(!t)return"Never";const o=new Date(t),i=new Date().getTime()-o.getTime();return i<6e4?"Just now":i<36e5?`${Math.round(i/6e4)} min ago`:i<864e5?`${Math.round(i/36e5)} hours ago`:o.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function vt({job:t,onTrigger:o,onPause:f,onResume:i,onDelete:j,onViewHistory:h,onEdit:N,onArchive:c,onRestore:b}){const[d,m]=r.useState(!1),x=ht[t.jobType]||Y,u=pt[t.status]||gt,P=u.icon,w=t.status==="archived",L=async()=>{m(!0);try{await o(t.id)}finally{m(!1)}},k=t.runCount>0?Math.round(t.successCount/t.runCount*100):0;return e.jsxs("div",{className:"group relative rounded-2xl border border-border/50 bg-card/50 backdrop-blur-sm p-4 hover:border-border hover:shadow-lg transition-all duration-200",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-3",children:[e.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.jsx("div",{className:l("h-10 w-10 rounded-xl flex items-center justify-center shrink-0",u.bg),children:e.jsx(x,{className:l("h-5 w-5",u.color)})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{className:"font-semibold text-sm truncate",children:t.name}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:t.description})]})]}),e.jsxs(Fe,{children:[e.jsx(Ie,{asChild:!0,children:e.jsx(D,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 opacity-0 group-hover:opacity-100",children:e.jsx(Ks,{className:"h-4 w-4"})})}),e.jsxs(Oe,{align:"end",className:"w-48",children:[!w&&e.jsxs(e.Fragment,{children:[e.jsxs(z,{onClick:L,disabled:d,children:[e.jsx(xe,{className:"h-4 w-4 mr-2"}),"Run Now"]}),N&&e.jsxs(z,{onClick:()=>N(t),children:[e.jsx(Gs,{className:"h-4 w-4 mr-2"}),"Edit Job"]})]}),e.jsxs(z,{onClick:()=>h(t.id),children:[e.jsx(Qs,{className:"h-4 w-4 mr-2"}),"View History"]}),e.jsx(is,{}),!w&&t.status==="active"&&e.jsxs(z,{onClick:()=>f(t.id),children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Pause Job"]}),!w&&t.status==="paused"&&e.jsxs(z,{onClick:()=>i(t.id),children:[e.jsx(ke,{className:"h-4 w-4 mr-2"}),"Resume Job"]}),w&&b&&e.jsxs(z,{onClick:()=>b(t.id),children:[e.jsx(nt,{className:"h-4 w-4 mr-2"}),"Restore Job"]}),e.jsx(is,{}),!w&&c&&e.jsxs(z,{onClick:()=>c(t.id),className:"text-amber-500 focus:text-amber-500",children:[e.jsx(_e,{className:"h-4 w-4 mr-2"}),"Archive Job"]}),e.jsxs(z,{onClick:()=>j(t.id),className:"text-red-500 focus:text-red-500",children:[e.jsx(bs,{className:"h-4 w-4 mr-2"}),"Delete Permanently"]})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold",u.bg,u.color),children:[e.jsx(P,{className:"h-3 w-3"}),u.label]}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:t.cronExpression||`Every ${Math.round((t.intervalMs||0)/1e3)}s`})]}),t.labels&&t.labels.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[t.labels.slice(0,3).map(F=>e.jsxs("span",{className:"inline-flex items-center gap-0.5 px-1.5 py-0.5 rounded bg-primary/10 text-primary text-[9px]",children:[e.jsx(vs,{className:"h-2.5 w-2.5"}),F]},F)),t.labels.length>3&&e.jsxs("span",{className:"text-[9px] text-muted-foreground",children:["+",t.labels.length-3]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-3",children:[e.jsxs("div",{className:"text-center p-2 rounded-lg bg-muted/50",children:[e.jsx("div",{className:"text-lg font-bold",children:t.runCount}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Total Runs"})]}),e.jsxs("div",{className:"text-center p-2 rounded-lg bg-muted/50",children:[e.jsxs("div",{className:l("text-lg font-bold",k>=80?"text-green-500":k>=50?"text-amber-500":"text-red-500"),children:[k,"%"]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Success"})]}),e.jsxs("div",{className:"text-center p-2 rounded-lg bg-muted/50",children:[e.jsx("div",{className:"text-lg font-bold text-red-500",children:t.failureCount}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Failures"})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground border-t border-border/50 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:["Last: ",bt(t.lastRunAt)]}),t.lastRunStatus&&e.jsx("span",{className:l("h-1.5 w-1.5 rounded-full",t.lastRunStatus==="success"?"bg-green-500":"bg-red-500")})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:ft(t.nextRunAt)})]})]}),e.jsx(D,{variant:"outline",size:"sm",className:"w-full mt-3 h-8 text-xs",onClick:L,disabled:d||t.status==="completed",children:d?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Running..."]}):e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"h-3.5 w-3.5 mr-1.5"}),"Run Now"]})})]})}const jt={pending:{color:"text-amber-500",bg:"bg-amber-500/10",icon:J,label:"Pending"},running:{color:"text-blue-500",bg:"bg-blue-500/10",icon:ne,label:"Running"},success:{color:"text-green-500",bg:"bg-green-500/10",icon:G,label:"Success"},failure:{color:"text-red-500",bg:"bg-red-500/10",icon:ae,label:"Failed"},error:{color:"text-red-500",bg:"bg-red-500/10",icon:ae,label:"Error"},timeout:{color:"text-orange-500",bg:"bg-orange-500/10",icon:he,label:"Timeout"},cancelled:{color:"text-muted-foreground",bg:"bg-muted/50",icon:ae,label:"Cancelled"}},yt={color:"text-muted-foreground",bg:"bg-muted/50",icon:he,label:"Unknown"};function Nt(t){return t?t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:`${Math.round(t/6e4)}m ${Math.round(t%6e4/1e3)}s`:"-"}function wt(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function kt({jobId:t,jobName:o,open:f,onOpenChange:i}){const{data:j,isLoading:h,error:N,refetch:c}=Ne({queryKey:["cron-history",t],queryFn:()=>O.cron.history(t,50),enabled:!!t&&f,refetchInterval:5e3}),b=j?.history||[],d=j?.job;return e.jsx($e,{open:f,onOpenChange:i,children:e.jsxs(He,{className:"max-w-2xl max-h-[80vh] flex flex-col",children:[e.jsx(Ue,{className:"flex-shrink-0",children:e.jsxs(Ke,{className:"flex items-center gap-2",children:[e.jsx(ue,{className:"h-5 w-5 text-primary"}),"Job History: ",o||t?.slice(0,8)]})}),d&&e.jsxs("div",{className:"flex items-center gap-4 p-3 rounded-xl bg-muted/50 border border-border/50 mb-4",children:[e.jsxs("div",{className:"flex-1 text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:d.runCount}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Total Runs"})]}),e.jsx("div",{className:"h-8 w-px bg-border"}),e.jsxs("div",{className:"flex-1 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-500",children:d.successCount}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Successes"})]}),e.jsx("div",{className:"h-8 w-px bg-border"}),e.jsxs("div",{className:"flex-1 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-red-500",children:d.failureCount}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Failures"})]}),e.jsx("div",{className:"h-8 w-px bg-border"}),e.jsxs("div",{className:"flex-1 text-center",children:[e.jsxs("div",{className:"text-2xl font-bold",children:[d.runCount>0?Math.round(d.successCount/d.runCount*100):0,"%"]}),e.jsx("div",{className:"text-[10px] text-muted-foreground",children:"Success Rate"})]})]}),e.jsx("div",{className:"flex-1 overflow-y-auto -mx-6 px-6",children:h?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(ne,{className:"h-8 w-8 animate-spin text-primary mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading history..."})]}):N?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(he,{className:"h-8 w-8 text-red-500 mb-3"}),e.jsx("p",{className:"text-sm text-red-500",children:"Failed to load history"}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>c(),className:"mt-3",children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"Retry"]})]}):b.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(J,{className:"h-8 w-8 text-muted-foreground mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No runs yet"}),e.jsx("p",{className:"text-xs text-muted-foreground/70 mt-1",children:"History will appear here after the first execution"})]}):e.jsx("div",{className:"space-y-2",children:b.map((m,x)=>{const u=jt[m.status]||yt,P=u.icon,w=m.status==="running";return e.jsxs("div",{className:l("rounded-xl border p-3 transition-colors",x===0?"border-primary/30 bg-primary/5":"border-border/50 bg-card/50"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:l("inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-semibold",u.bg,u.color),children:[e.jsx(P,{className:l("h-3 w-3",w&&"animate-spin")}),u.label]}),x===0&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[9px] font-medium bg-primary/10 text-primary",children:"Latest"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),Nt(m.durationMs)]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),wt(m.startedAt)]})]})]}),(m.output||m.error)&&e.jsx("div",{className:l("mt-2 p-2 rounded-lg text-xs font-mono overflow-x-auto",m.error?"bg-red-500/10 text-red-400":"bg-muted/50 text-muted-foreground"),children:e.jsx("pre",{className:"whitespace-pre-wrap break-words max-h-32 overflow-y-auto",children:m.error||m.output})})]},m.id)})})}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border/50 mt-4",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",b.length," runs"]}),e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>c(),children:[e.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),"Refresh"]})]})]})})}const V=[{id:"type",label:"Type",icon:qe,description:"What kind of job?"},{id:"schedule",label:"Schedule",icon:J,description:"When to run?"},{id:"config",label:"Configure",icon:js,description:"Job details"},{id:"review",label:"Review",icon:hs,description:"Confirm & create"}],cs=[{id:"health-check",name:"Health Check",category:"monitoring",icon:ps,description:"Monitor service health with HTTP pings",jobType:"http",suggestedCron:"*/5 * * * *",payload:{url:"https://your-api.com/health",method:"GET"},guide:"Regularly checks if your service is responding. Great for uptime monitoring."},{id:"db-backup",name:"Database Backup",category:"maintenance",icon:it,description:"Schedule automated database backups",jobType:"script",suggestedCron:"0 2 * * *",payload:{command:"pg_dump",args:["-h","localhost","mydb"]},guide:"Runs daily at 2 AM. Adjust the command for your database type.",warning:"Ensure backup storage has sufficient space."},{id:"git-sync",name:"Git Repository Sync",category:"development",icon:re,description:"Pull latest changes from remote",jobType:"tool",suggestedCron:"*/30 * * * *",payload:{tool:"git_pull",params:{branch:"main"}},guide:"Keeps local repositories in sync with remote."},{id:"slack-standup",name:"Daily Standup Reminder",category:"notifications",icon:ct,description:"Send daily standup reminders to Slack",jobType:"message",suggestedCron:"0 9 * * 1-5",payload:{channel:"#team",message:"Good morning! Time for standup!"},guide:"Sends at 9 AM on weekdays. Change channel and message as needed."},{id:"api-sync",name:"External API Sync",category:"integration",icon:Vs,description:"Sync data from external APIs",jobType:"http",suggestedCron:"0 */4 * * *",payload:{url:"https://api.example.com/sync",method:"POST",headers:{"Content-Type":"application/json"}},guide:"Runs every 4 hours. Add authentication headers if required."},{id:"cleanup",name:"Cleanup Old Files",category:"maintenance",icon:bs,description:"Remove temporary and old files",jobType:"script",suggestedCron:"0 3 * * 0",payload:{command:"find",args:["/tmp","-mtime","+7","-delete"]},guide:"Runs weekly on Sunday at 3 AM.",warning:"Double-check paths before enabling to avoid data loss."},{id:"report-gen",name:"Generate Reports",category:"analytics",icon:gs,description:"Generate and send automated reports",jobType:"tool",suggestedCron:"0 8 * * 1",payload:{tool:"generate_report",params:{type:"weekly",format:"pdf"}},guide:"Generates weekly reports every Monday at 8 AM."},{id:"webhook-trigger",name:"Webhook Trigger",category:"integration",icon:xe,description:"Trigger external webhooks on schedule",jobType:"http",suggestedCron:"0 */6 * * *",payload:{url:"https://hooks.example.com/trigger",method:"POST",body:{event:"scheduled"}},guide:"Triggers every 6 hours. Customize the webhook URL and payload."}],Ct=[{id:"all",label:"All",icon:qe},{id:"monitoring",label:"Monitoring",icon:hs},{id:"maintenance",label:"Maintenance",icon:Y},{id:"development",label:"Development",icon:Xs},{id:"notifications",label:"Notifications",icon:Je},{id:"integration",label:"Integration",icon:Ds},{id:"analytics",label:"Analytics",icon:Zs}],te=[{type:"http",label:"HTTP Request",icon:Se,description:"Call an API endpoint",color:"from-blue-500/20 to-cyan-500/20",examples:["Sync data from API","Health checks","Webhook triggers"],defaultPayload:{url:"https://api.example.com/endpoint",method:"POST",headers:{}},guide:"Make HTTP requests to external services. Supports GET, POST, PUT, DELETE methods."},{type:"tool",label:"Tool Execution",icon:Y,description:"Run a profClaw tool",color:"from-indigo-500/20 to-pink-500/20",examples:["Git operations","File sync","Database backups"],defaultPayload:{tool:"git_status",params:{}},guide:"Execute any registered profClaw tool with custom parameters."},{type:"script",label:"Shell Script",icon:ue,description:"Execute a command",color:"from-green-500/20 to-emerald-500/20",examples:["Build scripts","Cleanup tasks","System checks"],defaultPayload:{command:'echo "Hello World"',args:[]},guide:"Run shell commands on the server. Use with caution.",warning:"Scripts run with server permissions. Avoid sensitive operations."},{type:"message",label:"Notification",icon:Ce,description:"Send a message",color:"from-orange-500/20 to-amber-500/20",examples:["Daily standup reminder","Status reports","Alerts"],defaultPayload:{channel:"#general",message:"Scheduled notification"},guide:"Send messages to Slack channels, email, or webhooks."}],St=[{type:"cron",label:"Cron",icon:J,description:"Classic cron syntax"},{type:"interval",label:"Interval",icon:pe,description:"Every X seconds"},{type:"oneshot",label:"One-Time",icon:Te,description:"Run once"},{type:"event",label:"Event",icon:xe,description:"On trigger"}],ys=[{label:"Every minute",value:"* * * * *",humanize:"Runs every minute"},{label:"Every 5 min",value:"*/5 * * * *",humanize:"Runs every 5 minutes"},{label:"Every 15 min",value:"*/15 * * * *",humanize:"Runs every 15 minutes"},{label:"Hourly",value:"0 * * * *",humanize:"Runs at the start of every hour"},{label:"Daily midnight",value:"0 0 * * *",humanize:"Runs daily at midnight"},{label:"Weekdays 9am",value:"0 9 * * 1-5",humanize:"Runs at 9am on weekdays"}],Ae=[{label:"30 sec",value:30,humanize:"Every 30 seconds"},{label:"1 min",value:60,humanize:"Every minute"},{label:"5 min",value:300,humanize:"Every 5 minutes"},{label:"15 min",value:900,humanize:"Every 15 minutes"},{label:"30 min",value:1800,humanize:"Every 30 minutes"},{label:"1 hour",value:3600,humanize:"Every hour"}],Tt=[{type:"webhook",label:"Webhook",description:"HTTP webhook endpoint"},{type:"ticket",label:"Ticket",description:"Ticket changes"},{type:"github",label:"GitHub",description:"Push, PR, issues"},{type:"file",label:"File",description:"File changes"}];function _({children:t,type:o="info"}){const f={info:"bg-blue-500/10 border-blue-500/20 text-blue-700 dark:text-blue-300",warning:"bg-amber-500/10 border-amber-500/20 text-amber-700 dark:text-amber-300",tip:"bg-green-500/10 border-green-500/20 text-green-700 dark:text-green-300"},j={info:Le,warning:he,tip:st}[o];return e.jsxs("div",{className:l("flex items-start gap-2 p-3 rounded-lg border text-xs",f[o]),children:[e.jsx(j,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.jsx("div",{children:t})]})}function Pe({children:t,content:o}){return e.jsxs("span",{className:"relative group",children:[t,e.jsx("span",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 rounded bg-popover border text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-50",children:o})]})}function ds(t){const o=ys.find(b=>b.value===t);if(o)return o.humanize;const f=t.split(" ");if(f.length!==5)return`Cron: ${t}`;const[i,j,h,N,c]=f;return i.startsWith("*/")&&j==="*"&&h==="*"&&N==="*"&&c==="*"?`Every ${i.slice(2)} minutes`:i==="0"&&j.startsWith("*/")&&h==="*"&&N==="*"&&c==="*"?`Every ${j.slice(2)} hours`:i==="0"&&j==="0"&&h==="*"&&N==="*"&&c==="*"?"Daily at midnight":`Cron: ${t}`}function Et(t){try{return{valid:!0,parsed:JSON.parse(t)}}catch{return{valid:!1,error:"Invalid JSON syntax"}}}function ms({open:t,onOpenChange:o}){const f=ze(),[i,j]=r.useState(!1),h=t??i,N=o??j,[c,b]=r.useState("simple"),[d,m]=r.useState("type"),x=V.findIndex(s=>s.id===d),[u,P]=r.useState("all"),[w,L]=r.useState(""),[k,F]=r.useState(""),[p,$]=r.useState(null),[v,E]=r.useState(null),[M,q]=r.useState("*/5 * * * *"),[A,H]=r.useState(300),[T,n]=r.useState(""),[R,fe]=r.useState(""),[U,be]=r.useState("webhook"),[ve,je]=r.useState("{}"),[Q,X]=r.useState("{}"),[I,Z]=r.useState(null),[a,ee]=r.useState("UTC"),[ie,Ge]=r.useState(!0),[Ee,Qe]=r.useState(3),[Me,We]=r.useState("exponential"),[oe,Be]=r.useState(!1),[W,Ve]=r.useState(""),[Ye,Xe]=r.useState(!1),[Ze,es]=r.useState(!0),[ss,ts]=r.useState(!1),[ce,as]=r.useState(null),[Re,rs]=r.useState(null),de=r.useMemo(()=>Et(Q),[Q]),{data:Ns}=Ne({queryKey:["cron-templates"],queryFn:()=>O.cron.listTemplates?.()||Promise.resolve({templates:[]}),enabled:h}),ns=Ns?.templates||[],ws=r.useMemo(()=>u==="all"?cs:cs.filter(s=>s.category===u),[u]);r.useEffect(()=>{if(p&&!I){const s=te.find(y=>y.type===p);s&&X(JSON.stringify(s.defaultPayload,null,2))}},[p,I]);const ls=s=>{if(I?.id===s.id){Z(null);return}Z(s),L(s.name),F(s.description??""),$(s.jobType),X(JSON.stringify(s.payload,null,2)),s.suggestedCron&&(E("cron"),q(s.suggestedCron))},se=K({mutationFn:()=>{const s=JSON.parse(Q);let y;v==="oneshot"&&T&&R&&(y=new Date(`${T}T${R}`).toISOString());let S;if(v==="event")try{S={type:U,config:JSON.parse(ve)}}catch{S={type:U,config:{}}}let B;return c==="advanced"&&oe&&W&&(B={channels:[{type:W.includes("@")?"email":W.startsWith("http")?"webhook":"slack",target:W,onSuccess:Ye,onFailure:Ze}]}),O.cron.create({name:w,description:k||void 0,jobType:p,cronExpression:v==="cron"?M:void 0,intervalMs:v==="interval"?A*1e3:void 0,runAt:y,eventTrigger:S,payload:s,timezone:c==="advanced"?a:"UTC",deleteOnComplete:v==="oneshot"?ss:void 0,retryPolicy:c==="advanced"?{enabled:ie,maxRetries:Ee,backoff:Me}:void 0,delivery:B,maxRuns:c==="advanced"&&ce||void 0,maxFailures:c==="advanced"&&Re||void 0})},onSuccess:()=>{f.invalidateQueries({queryKey:["cron-jobs"]}),f.invalidateQueries({queryKey:["cron-stats"]}),N(!1),ks()}}),ks=()=>{m("type"),b("simple"),P("all"),L(""),F(""),$(null),E(null),q("*/5 * * * *"),H(300),n(""),fe(""),be("webhook"),je("{}"),X("{}"),Z(null),ee("UTC"),Ge(!0),Qe(3),We("exponential"),Be(!1),Ve(""),Xe(!1),es(!0),ts(!1),as(null),rs(null)},Cs=r.useMemo(()=>{switch(d){case"type":return p!==null;case"schedule":return v?v==="oneshot"?T&&R:!0:!1;case"config":return w.trim().length>0&&de.valid;case"review":return!0;default:return!1}},[d,p,v,T,R,w,de]),Ss=()=>{x<V.length-1&&m(V[x+1].id)},Ts=()=>{x>0&&m(V[x-1].id)},Es=r.useMemo(()=>{switch(v){case"cron":return ds(M);case"interval":return Ae.find(s=>s.value===A)?.humanize||`Every ${A} seconds`;case"oneshot":return T&&R?`Once at ${new Date(`${T}T${R}`).toLocaleString()}`:"One-time (not scheduled)";case"event":return`On ${U} event`;default:return"Not configured"}},[v,M,A,T,R,U]),ye=te.find(s=>s.type===p);return e.jsxs($e,{open:h,onOpenChange:N,children:[e.jsx(Bs,{asChild:!0,children:e.jsxs(D,{className:"gap-2 shadow-lg shadow-primary/20 hover:shadow-primary/30 transition-shadow",children:[e.jsx(fs,{className:"h-4 w-4"}),"Create Job"]})}),e.jsxs(He,{className:"max-w-4xl w-[90vw] max-h-[85vh] my-8 flex flex-col p-0 overflow-hidden [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[e.jsxs("div",{className:"border-b border-border/20 bg-linear-to-r from-primary/5 to-transparent",children:[e.jsx(Ue,{className:"px-6 pt-5 pb-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(Ke,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(J,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("span",{className:"block",children:"Create Scheduled Job"}),e.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:V[x].description})]})]}),e.jsxs("div",{className:"flex items-center gap-1 p-1 rounded-lg bg-muted",children:[e.jsxs("button",{onClick:()=>b("simple"),className:l("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all",c==="simple"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(Ys,{className:"h-3 w-3"}),"Simple"]}),e.jsxs("button",{onClick:()=>b("advanced"),className:l("flex items-center gap-1.5 px-3 py-1.5 rounded-md text-xs font-medium transition-all",c==="advanced"?"bg-background shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:[e.jsx(ut,{className:"h-3 w-3"}),"Advanced"]})]})]})}),e.jsx("div",{className:"px-6 pb-4",children:e.jsx("div",{className:"flex items-center gap-2",children:V.map((s,y)=>{const S=s.icon,B=s.id===d,me=y<x;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>y<=x&&m(s.id),disabled:y>x,className:l("flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-medium transition-all",B&&"bg-primary text-primary-foreground shadow-md shadow-primary/30",me&&"bg-primary/20 text-primary hover:bg-primary/30",!B&&!me&&"bg-muted text-muted-foreground",y>x&&"opacity-50 cursor-not-allowed"),children:[me?e.jsx(Ms,{className:"h-3 w-3"}):e.jsx(S,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden sm:inline",children:s.label})]}),y<V.length-1&&e.jsx(Rs,{className:l("h-4 w-4",y<x?"text-primary":"text-muted-foreground/50")})]},s.id)})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",children:[d==="type"&&e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-right-4 duration-300",children:[c==="simple"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Quick Start Templates"}),e.jsx(Pe,{content:"Pre-configured jobs for common tasks",children:e.jsx(De,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:Ct.map(s=>{const y=s.icon,S=u===s.id;return e.jsxs("button",{onClick:()=>P(s.id),className:l("flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-medium transition-all",S?"bg-foreground text-background shadow-sm":"bg-muted text-muted-foreground hover:bg-muted/80"),children:[e.jsx(y,{className:"h-3 w-3"}),s.label]},s.id)})}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:ws.map(s=>{const y=s.icon;return e.jsxs("button",{onClick:()=>ls(s),className:l("flex items-start gap-3 p-3 rounded-xl text-left transition-all hover:scale-[1.01]",I?.id===s.id?"bg-primary/5 ring-2 ring-primary/20":"bg-muted/30 hover:bg-muted/50"),children:[e.jsx("div",{className:l("p-1.5 rounded-lg shrink-0",I?.id===s.id?"bg-primary/20 text-primary":"bg-muted text-muted-foreground"),children:e.jsx(y,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium text-sm truncate",children:s.name}),e.jsx("div",{className:"text-[10px] text-muted-foreground line-clamp-2",children:s.description})]})]},s.id)})}),ns.length>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx(g,{className:"text-xs text-muted-foreground",children:"Your Templates"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:ns.slice(0,4).map(s=>e.jsxs("button",{onClick:()=>ls({id:s.id,name:s.name,category:s.category,description:s.description,jobType:s.jobType,payload:s.payloadTemplate,suggestedCron:s.suggestedCron}),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-muted/30 hover:bg-muted/50 text-xs",children:[e.jsx(et,{className:"h-3 w-3 text-primary"}),s.name]},s.id))})]}),e.jsx("div",{className:"mt-4",children:e.jsx(_,{type:"tip",children:"Select a template to get started quickly, or choose a job type below for custom configuration."})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-3",children:e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:c==="simple"?"Or Choose Job Type":"Job Type"})}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:te.map(s=>{const y=s.icon,S=p===s.type;return e.jsxs("button",{onClick:()=>{$(s.type),Z(null)},className:l("relative overflow-hidden group p-4 rounded-2xl text-left transition-all duration-200",S?"bg-primary/5 ring-2 ring-primary/20 scale-[1.02]":"bg-muted/30 hover:bg-muted/50 hover:scale-[1.01]"),children:[e.jsx("div",{className:l("absolute inset-0 bg-linear-to-br opacity-0 transition-opacity",s.color,S&&"opacity-100","group-hover:opacity-50")}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:l("p-2 rounded-lg transition-colors",S?"bg-primary text-primary-foreground":"bg-muted"),children:e.jsx(y,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:l("font-semibold",S&&"text-primary"),children:s.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.description})]}),S&&e.jsx(G,{className:"h-5 w-5 text-primary"})]}),c==="advanced"&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:s.examples.map((B,me)=>e.jsx("span",{className:"px-2 py-0.5 rounded-full bg-muted/80 text-[10px] text-muted-foreground",children:B},me))})]})]},s.type)})}),ye&&e.jsxs("div",{className:"mt-4 space-y-2",children:[e.jsx(_,{type:"info",children:ye.guide}),ye.warning&&e.jsx(_,{type:"warning",children:ye.warning})]})]})]}),d==="schedule"&&e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-right-4 duration-300",children:[e.jsxs("div",{children:[e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"When to Run?"}),e.jsx("div",{className:"grid grid-cols-4 gap-2 mt-3",children:St.map(s=>{const y=s.icon,S=v===s.type;return e.jsxs("button",{onClick:()=>E(s.type),className:l("flex flex-col items-center gap-2 p-4 rounded-xl transition-all",S?"bg-primary/5 ring-2 ring-primary/20":"bg-muted/30 hover:bg-muted/50"),children:[e.jsx(y,{className:l("h-6 w-6",S?"text-primary":"text-muted-foreground")}),e.jsx("span",{className:l("text-xs font-medium",S&&"text-primary"),children:s.label})]},s.type)})})]}),v==="cron"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in duration-200",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"cron",children:"Cron Expression"}),e.jsx(C,{id:"cron",placeholder:"*/5 * * * *",value:M,onChange:s=>q(s.target.value),className:"mt-2 font-mono text-sm"}),e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:ds(M)})]})})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs text-muted-foreground",children:"Presets"}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:ys.map(s=>e.jsx("button",{onClick:()=>q(s.value),className:l("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",M===s.value?"bg-primary text-primary-foreground shadow-md":"bg-muted hover:bg-muted/80"),children:s.label},s.value))})]}),e.jsxs(_,{type:"info",children:["Cron format: ",e.jsx("code",{className:"font-mono bg-muted px-1 rounded",children:"minute hour day month weekday"}),e.jsx("br",{}),"Use ",e.jsx("code",{className:"font-mono bg-muted px-1 rounded",children:"*"})," for any value, ",e.jsx("code",{className:"font-mono bg-muted px-1 rounded",children:"*/N"})," for every N units."]})]}),v==="interval"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in duration-200",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"interval",children:"Interval (seconds)"}),e.jsx(C,{id:"interval",type:"number",min:1,value:A,onChange:s=>H(parseInt(s.target.value)||60),className:"mt-2"}),e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(pe,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:Ae.find(s=>s.value===A)?.humanize||`Every ${A} seconds`})]})})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ae.map(s=>e.jsx("button",{onClick:()=>H(s.value),className:l("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",A===s.value?"bg-primary text-primary-foreground shadow-md":"bg-muted hover:bg-muted/80"),children:s.label},s.value))})]}),v==="oneshot"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in duration-200",children:[e.jsxs("div",{children:[e.jsx(g,{children:"Run At"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-2",children:[e.jsxs("div",{children:[e.jsx(C,{type:"date",value:T,onChange:s=>n(s.target.value),min:new Date().toISOString().split("T")[0]}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Date"})]}),e.jsxs("div",{children:[e.jsx(C,{type:"time",value:R,onChange:s=>fe(s.target.value)}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"Time"})]})]}),T&&R&&e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:new Date(`${T}T${R}`).toLocaleString()})]})})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:ss,onChange:s=>ts(s.target.checked),className:"rounded"}),e.jsx("span",{className:"text-muted-foreground",children:"Auto-delete after completion"})]}),e.jsx(_,{type:"info",children:"One-shot jobs run exactly once at the specified time and can optionally be deleted afterward."})]}),v==="event"&&e.jsxs("div",{className:"space-y-4 animate-in fade-in duration-200",children:[e.jsxs("div",{children:[e.jsx(g,{children:"Event Type"}),e.jsx("div",{className:"grid grid-cols-4 gap-2 mt-2",children:Tt.map(s=>e.jsxs("button",{onClick:()=>be(s.type),className:l("flex flex-col items-center p-3 rounded-xl text-center transition-all",U===s.type?"bg-primary/5 ring-2 ring-primary/20":"bg-muted/30 hover:bg-muted/50"),children:[e.jsx("span",{className:l("text-xs font-medium",U===s.type&&"text-primary"),children:s.label}),e.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:s.description})]},s.type))})]}),c==="advanced"&&e.jsxs("div",{children:[e.jsx(g,{htmlFor:"eventConfig",children:"Event Config (JSON)"}),e.jsx(C,{id:"eventConfig",placeholder:'{"source": "webhook"}',value:ve,onChange:s=>je(s.target.value),className:"mt-2 font-mono text-xs"})]}),e.jsx(_,{type:"info",children:"Event-triggered jobs run when specific events occur, like webhooks or file changes."})]}),c==="advanced"&&v==="cron"&&e.jsxs("div",{children:[e.jsx(g,{htmlFor:"timezone",children:"Timezone"}),e.jsx(C,{id:"timezone",placeholder:"UTC",value:a,onChange:s=>ee(s.target.value),className:"mt-2"}),e.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:"Default: UTC. Use IANA timezone names (e.g., America/New_York)."})]})]}),d==="config"&&e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-right-4 duration-300",children:[I?.guide&&e.jsxs(_,{type:"tip",children:[e.jsxs("strong",{children:[I.name,":"]})," ",I.guide]}),I?.warning&&e.jsx(_,{type:"warning",children:I.warning}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"name",className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Job Name *"}),e.jsx(C,{id:"name",placeholder:"e.g., Sync GitHub Issues",value:w,onChange:s=>L(s.target.value),className:"mt-2 text-lg font-medium"})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"description",className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Description"}),e.jsx(C,{id:"description",placeholder:"What this job does...",value:k,onChange:s=>F(s.target.value),className:"mt-2"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx(g,{htmlFor:"payload",className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Payload (JSON)"}),de.valid?e.jsxs("span",{className:"flex items-center gap-1 text-xs text-green-600",children:[e.jsx(G,{className:"h-3 w-3"})," Valid"]}):e.jsxs("span",{className:"flex items-center gap-1 text-xs text-red-500",children:[e.jsx(we,{className:"h-3 w-3"})," ",de.error]})]}),e.jsx("textarea",{id:"payload",value:Q,onChange:s=>X(s.target.value),className:l("w-full p-4 rounded-xl bg-muted/40 font-mono text-sm resize-none h-32 transition-colors focus:outline-none focus:ring-1 focus:ring-primary/30",!de.valid&&"ring-1 ring-red-500"),placeholder:'{"url": "https://..."}'})]}),c==="advanced"&&e.jsxs("div",{className:"p-4 rounded-xl bg-muted/30 space-y-4",children:[e.jsxs("div",{className:"text-xs uppercase tracking-wider text-muted-foreground font-medium flex items-center gap-2",children:[e.jsx(js,{className:"h-3.5 w-3.5"}),"Advanced Options"]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(os,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:"Retry on failure"})]}),e.jsx("input",{type:"checkbox",checked:ie,onChange:s=>Ge(s.target.checked),className:"rounded"})]}),ie&&e.jsxs("div",{className:"grid grid-cols-2 gap-3 pl-6",children:[e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:"Max Retries"}),e.jsx(C,{type:"number",min:1,max:10,value:Ee,onChange:s=>Qe(parseInt(s.target.value)||3),className:"mt-1 h-8 text-xs"})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs",children:"Backoff"}),e.jsxs("select",{value:Me,onChange:s=>We(s.target.value),className:"w-full mt-1 h-8 px-2 rounded-md border bg-background text-xs",children:[e.jsx("option",{value:"exponential",children:"Exponential"}),e.jsx("option",{value:"linear",children:"Linear"}),e.jsx("option",{value:"fixed",children:"Fixed"})]})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Je,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm",children:"Send notifications"})]}),e.jsx("input",{type:"checkbox",checked:oe,onChange:s=>Be(s.target.checked),className:"rounded"})]}),oe&&e.jsxs("div",{className:"pl-6 space-y-2",children:[e.jsx(C,{placeholder:"Slack channel, webhook URL, or email",value:W,onChange:s=>Ve(s.target.value),className:"text-xs"}),e.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"checkbox",checked:Ye,onChange:s=>Xe(s.target.checked),className:"rounded"}),"On success"]}),e.jsxs("label",{className:"flex items-center gap-1",children:[e.jsx("input",{type:"checkbox",checked:Ze,onChange:s=>es(s.target.checked),className:"rounded"}),"On failure"]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs(g,{className:"text-xs flex items-center gap-1",children:["Max Runs",e.jsx(Pe,{content:"Stop after N runs",children:e.jsx(De,{className:"h-3 w-3"})})]}),e.jsx(C,{type:"number",min:1,placeholder:"Unlimited",value:ce||"",onChange:s=>as(s.target.value?parseInt(s.target.value):null),className:"mt-1 h-8 text-xs"})]}),e.jsxs("div",{children:[e.jsxs(g,{className:"text-xs flex items-center gap-1",children:["Max Failures",e.jsx(Pe,{content:"Pause after N consecutive failures",children:e.jsx(De,{className:"h-3 w-3"})})]}),e.jsx(C,{type:"number",min:1,placeholder:"Unlimited",value:Re||"",onChange:s=>rs(s.target.value?parseInt(s.target.value):null),className:"mt-1 h-8 text-xs"})]})]})]})]}),d==="review"&&e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-right-4 duration-300",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-linear-to-br from-primary/20 to-primary/5 mb-3",children:e.jsx(G,{className:"h-8 w-8 text-primary"})}),e.jsx("h3",{className:"text-lg font-semibold",children:"Ready to Create"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Review your job configuration"})]}),e.jsxs("div",{className:"p-5 rounded-2xl bg-linear-to-br from-muted/50 to-transparent space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"Job Name"}),e.jsx("div",{className:"text-lg font-semibold mt-1",children:w||"Untitled Job"}),k&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:k})]}),p&&e.jsx("div",{className:l("p-2 rounded-lg",p==="http"&&"bg-blue-500/20",p==="tool"&&"bg-indigo-500/20",p==="script"&&"bg-green-500/20",p==="message"&&"bg-orange-500/20"),children:te.find(s=>s.type===p)?.icon&&(()=>{const s=te.find(y=>y.type===p).icon;return e.jsx(s,{className:"h-5 w-5"})})()})]}),e.jsx("hr",{className:"border-border/50"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"Type"}),e.jsx("div",{className:"text-sm font-medium mt-1",children:te.find(s=>s.type===p)?.label})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"Schedule"}),e.jsx("div",{className:"text-sm font-medium mt-1",children:Es})]})]}),e.jsx("hr",{className:"border-border/50"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground uppercase tracking-wider mb-2",children:"Payload"}),e.jsx("pre",{className:"p-3 rounded-lg bg-muted/50 text-xs font-mono overflow-x-auto max-h-24",children:Q})]}),c==="advanced"&&(ie||oe||ce||Re)&&e.jsxs(e.Fragment,{children:[e.jsx("hr",{className:"border-border/50"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[ie&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-muted text-xs",children:[e.jsx(os,{className:"h-3 w-3"}),Ee,"x ",Me," retries"]}),oe&&W&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-muted text-xs",children:[e.jsx(Je,{className:"h-3 w-3"}),"Notify: ",W.slice(0,15),"..."]}),ce&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full bg-muted text-xs",children:[e.jsx(As,{className:"h-3 w-3"}),"Max ",ce," runs"]})]})]})]}),p==="script"&&e.jsxs(_,{type:"warning",children:[e.jsx("strong",{children:"Security Notice:"})," Script jobs execute shell commands with server permissions. Ensure your command is safe before creating."]}),se.isError&&e.jsxs("div",{className:"flex items-center gap-2 p-4 rounded-xl bg-red-500/10 border border-red-500/20 text-red-500 text-sm",children:[e.jsx(we,{className:"h-5 w-5 shrink-0"}),e.jsx("span",{children:se.error instanceof Error?se.error.message:"Failed to create job"})]})]})]}),e.jsxs("div",{className:"border-t border-border/20 p-4 flex items-center justify-between bg-muted/30",children:[e.jsxs(D,{variant:"ghost",onClick:x===0?()=>N(!1):Ts,className:"gap-2",children:[e.jsx(Ps,{className:"h-4 w-4"}),x===0?"Cancel":"Back"]}),d==="review"?e.jsx(D,{onClick:()=>se.mutate(),disabled:se.isPending,className:"gap-2 min-w-35 shadow-lg shadow-primary/20",children:se.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-4 w-4 animate-spin"}),"Creating..."]}):e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"h-4 w-4"}),"Create Job"]})}):e.jsxs(D,{onClick:Ss,disabled:!Cs,className:"gap-2",children:["Continue",e.jsx(Fs,{className:"h-4 w-4"})]})]})]})]})}const Mt=[{value:"http",label:"HTTP Request",icon:Se},{value:"tool",label:"Tool Execution",icon:Y},{value:"script",label:"Shell Script",icon:ue},{value:"message",label:"Notification",icon:Ce}],Rt=[{label:"1 min",value:"* * * * *"},{label:"5 min",value:"*/5 * * * *"},{label:"15 min",value:"*/15 * * * *"},{label:"30 min",value:"*/30 * * * *"},{label:"Hourly",value:"0 * * * *"},{label:"Daily",value:"0 0 * * *"},{label:"Weekly",value:"0 0 * * 0"}];function Dt(t){return{"* * * * *":"Every minute","*/5 * * * *":"Every 5 minutes","*/15 * * * *":"Every 15 minutes","*/30 * * * *":"Every 30 minutes","0 * * * *":"Every hour","0 0 * * *":"Daily at midnight","0 0 * * 0":"Weekly on Sunday","0 9 * * 1-5":"Weekdays at 9 AM"}[t]||t}function At({type:t,children:o}){const f={info:{icon:Le,bg:"bg-blue-500/10",border:"border-blue-500/20",text:"text-blue-400"},warning:{icon:we,bg:"bg-amber-500/10",border:"border-amber-500/20",text:"text-amber-400"},tip:{icon:Le,bg:"bg-green-500/10",border:"border-green-500/20",text:"text-green-400"}},{icon:i,bg:j,border:h,text:N}=f[t];return e.jsxs("div",{className:l("flex items-start gap-2 p-3 rounded-lg border text-xs",j,h,N),children:[e.jsx(i,{className:"h-4 w-4 shrink-0 mt-0.5"}),e.jsx("div",{children:o})]})}function Pt({job:t,open:o,onOpenChange:f}){const i=ze(),[j,h]=r.useState(""),[N,c]=r.useState(""),[b,d]=r.useState("cron"),[m,x]=r.useState("*/5 * * * *"),[u,P]=r.useState(300),[w,L]=r.useState("{}"),[k,F]=r.useState([]),[p,$]=r.useState(""),[v,E]=r.useState("active");r.useEffect(()=>{t&&(h(t.name),c(t.description||""),d(t.cronExpression?"cron":"interval"),x(t.cronExpression||"*/5 * * * *"),P(t.intervalMs?Math.round(t.intervalMs/1e3):300),L(JSON.stringify(t.payload||{},null,2)),F(t.labels||[]),E(t.status==="paused"?"paused":"active"))},[t]);const M=K({mutationFn:()=>{if(!t)throw new Error("No job to update");const n=JSON.parse(w);return O.cron.update(t.id,{name:j,description:N||void 0,cronExpression:b==="cron"?m:void 0,intervalMs:b==="interval"?u*1e3:void 0,payload:n,labels:k,status:v})},onSuccess:()=>{i.invalidateQueries({queryKey:["cron-jobs"]}),i.invalidateQueries({queryKey:["cron-stats"]}),f(!1)}}),q=j.trim().length>0&&(b==="cron"&&m.trim().length>0||b==="interval"&&u>=1),A=()=>{const n=p.trim().toLowerCase();n&&!k.includes(n)&&(F([...k,n]),$(""))},H=n=>{F(k.filter(R=>R!==n))};if(!t)return null;const T=Mt.find(n=>n.value===t.jobType)?.icon||Y;return e.jsx($e,{open:o,onOpenChange:f,children:e.jsxs(He,{className:"max-w-2xl max-h-[85vh] flex flex-col overflow-hidden",children:[e.jsx(Ue,{children:e.jsxs(Ke,{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 rounded-xl bg-primary/10",children:e.jsx(T,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("span",{className:"block",children:"Edit Scheduled Job"}),e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:[t.jobType.toUpperCase()," • Created ",new Date(t.createdAt).toLocaleDateString()]})]})]})}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-6 py-4",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(g,{htmlFor:"name",children:"Job Name"}),e.jsx(C,{id:"name",value:j,onChange:n=>h(n.target.value),placeholder:"My Scheduled Job",className:"mt-1.5"})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"description",children:"Description (optional)"}),e.jsx(C,{id:"description",value:N,onChange:n=>c(n.target.value),placeholder:"What this job does...",className:"mt-1.5"})]})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 block",children:"Status"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:()=>E("active"),className:l("flex items-center gap-2 px-4 py-2 rounded-xl border transition-all",v==="active"?"border-green-500/50 bg-green-500/10 text-green-500":"border-border/50 hover:border-border"),children:[e.jsx(ke,{className:"h-4 w-4"}),"Active"]}),e.jsxs("button",{onClick:()=>E("paused"),className:l("flex items-center gap-2 px-4 py-2 rounded-xl border transition-all",v==="paused"?"border-amber-500/50 bg-amber-500/10 text-amber-500":"border-border/50 hover:border-border"),children:[e.jsx(ge,{className:"h-4 w-4"}),"Paused"]})]})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 block",children:"Schedule"}),e.jsxs("div",{className:"flex gap-2 mb-4",children:[e.jsxs("button",{onClick:()=>d("cron"),className:l("flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-all",b==="cron"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[e.jsx(J,{className:"h-4 w-4"}),"Cron"]}),e.jsxs("button",{onClick:()=>d("interval"),className:l("flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-all",b==="interval"?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[e.jsx(pe,{className:"h-4 w-4"}),"Interval"]})]}),b==="cron"?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx(C,{value:m,onChange:n=>x(n.target.value),placeholder:"*/5 * * * *",className:"font-mono"}),e.jsx("div",{className:"mt-2 px-3 py-2 rounded-lg bg-primary/5 border border-primary/20",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[e.jsx(ke,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium",children:Dt(m)})]})})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Rt.map(n=>e.jsx("button",{onClick:()=>x(n.value),className:l("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",m===n.value?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:n.label},n.value))})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Every"}),e.jsx(C,{type:"number",min:1,value:u,onChange:n=>P(parseInt(n.target.value)||60),className:"w-24"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"seconds"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[30,60,300,600,1800,3600].map(n=>e.jsx("button",{onClick:()=>P(n),className:l("px-3 py-1.5 rounded-lg text-xs font-medium transition-all",u===n?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:n<60?`${n}s`:n<3600?`${n/60}m`:`${n/3600}h`},n))})]})]}),e.jsxs("div",{children:[e.jsx(g,{className:"text-xs uppercase tracking-wider text-muted-foreground mb-2 block",children:"Labels"}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:k.map(n=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-lg bg-primary/10 text-primary text-xs",children:[e.jsx(vs,{className:"h-3 w-3"}),n,e.jsx("button",{onClick:()=>H(n),className:"ml-1 hover:text-red-500",children:e.jsx(Is,{className:"h-3 w-3"})})]},n))}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(C,{value:p,onChange:n=>$(n.target.value),placeholder:"Add label...",className:"flex-1",onKeyDown:n=>n.key==="Enter"&&(n.preventDefault(),A())}),e.jsx(D,{variant:"outline",size:"sm",onClick:A,disabled:!p.trim(),children:e.jsx(fs,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{children:[e.jsx(g,{htmlFor:"payload",children:"Payload (JSON)"}),e.jsx("textarea",{id:"payload",value:w,onChange:n=>L(n.target.value),rows:6,className:"w-full mt-1.5 px-3 py-2 rounded-lg border border-border bg-background font-mono text-sm resize-none focus:outline-none focus:ring-2 focus:ring-primary/50"}),e.jsx(At,{type:"info",children:"Payload is specific to job type. HTTP jobs need url/method, tool jobs need tool/params."})]})]}),e.jsxs("div",{className:"flex items-center justify-between pt-4 border-t",children:[e.jsx(D,{variant:"ghost",onClick:()=>f(!1),children:"Cancel"}),e.jsx(D,{onClick:()=>M.mutate(),disabled:!q||M.isPending,className:"gap-2",children:M.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(Ws,{className:"h-4 w-4"}),"Save Changes"]})})]}),M.isError&&e.jsxs("div",{className:"mt-2 p-3 rounded-lg bg-red-500/10 border border-red-500/20 text-red-400 text-sm",children:[e.jsx(we,{className:"h-4 w-4 inline mr-2"}),M.error.message]})]})})}const xs=[{value:"all",label:"All Status",icon:J},{value:"active",label:"Active",icon:G},{value:"paused",label:"Paused",icon:ge},{value:"completed",label:"Completed",icon:G},{value:"failed",label:"Failed",icon:ae},{value:"archived",label:"Archived",icon:_e}],us=[{value:"all",label:"All Types",icon:Te},{value:"http",label:"HTTP",icon:Se},{value:"tool",label:"Tool",icon:Y},{value:"script",label:"Script",icon:ue},{value:"message",label:"Message",icon:Ce}];function na(){const t=ze(),[o,f]=r.useState(""),[i,j]=r.useState("all"),[h,N]=r.useState("all"),[c,b]=r.useState(null),[d,m]=r.useState(""),[x,u]=r.useState(null),[P,w]=r.useState(null),{data:L,isLoading:k,error:F,refetch:p}=Ne({queryKey:["cron-jobs",i,h],queryFn:()=>O.cron.list({status:i!=="all"?i:void 0,jobType:h!=="all"?h:void 0,limit:100}),refetchInterval:1e4}),{data:$}=Ne({queryKey:["cron-stats"],queryFn:()=>O.cron.stats(),refetchInterval:3e4}),v=L?.jobs||[],E=$?.stats,M=v.filter(a=>o?a.name.toLowerCase().includes(o.toLowerCase())||a.description?.toLowerCase().includes(o.toLowerCase()):!0),q=K({mutationFn:a=>O.cron.trigger(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]})}}),A=K({mutationFn:a=>O.cron.pause(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]}),t.invalidateQueries({queryKey:["cron-stats"]})}}),H=K({mutationFn:a=>O.cron.resume(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]}),t.invalidateQueries({queryKey:["cron-stats"]})}}),T=K({mutationFn:a=>O.cron.delete(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]}),t.invalidateQueries({queryKey:["cron-stats"]}),u(null)}}),n=K({mutationFn:a=>O.cron.archive(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]}),t.invalidateQueries({queryKey:["cron-stats"]})}}),R=K({mutationFn:a=>O.cron.restore(a),onSuccess:()=>{t.invalidateQueries({queryKey:["cron-jobs"]}),t.invalidateQueries({queryKey:["cron-stats"]})}}),fe=r.useCallback(a=>{q.mutate(a)},[q]),U=r.useCallback(a=>{A.mutate(a)},[A]),be=r.useCallback(a=>{H.mutate(a)},[H]),ve=r.useCallback(a=>{b(a.id),m(a.name)},[]),je=r.useCallback(a=>{u(a)},[]),Q=r.useCallback(a=>{w(a)},[]),X=r.useCallback(a=>{n.mutate(a)},[n]),I=r.useCallback(a=>{R.mutate(a)},[R]),Z=()=>{x&&T.mutate(x)};return F?e.jsxs("div",{className:"glass rounded-[28px] p-12 text-center",children:[e.jsx(he,{className:"h-12 w-12 mx-auto text-red-400 mb-4"}),e.jsx("p",{className:"text-lg font-bold text-red-400",children:"Error loading scheduled jobs"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.message}),e.jsxs(D,{variant:"outline",onClick:()=>p(),className:"mt-4",children:[e.jsx(re,{className:"h-4 w-4 mr-2"}),"Retry"]})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(J,{className:"h-6 w-6 text-primary"}),"Scheduled Jobs"]}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Manage automated tasks with cron schedules or fixed intervals"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(D,{variant:"outline",size:"sm",onClick:()=>p(),disabled:k,children:[e.jsx(re,{className:l("h-4 w-4 mr-2",k&&"animate-spin")}),"Refresh"]}),e.jsx(ms,{})]})]}),E&&e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(Te,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Total Jobs"})]}),e.jsx("div",{className:"text-2xl font-bold",children:E.total})]}),e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-500 mb-1",children:[e.jsx(ps,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Active"})]}),e.jsx("div",{className:"text-2xl font-bold text-green-500",children:E.active})]}),e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-amber-500 mb-1",children:[e.jsx(ge,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Paused"})]}),e.jsx("div",{className:"text-2xl font-bold text-amber-500",children:E.paused})]}),e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[e.jsx(xe,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Total Runs"})]}),e.jsx("div",{className:"text-2xl font-bold",children:E.totalRuns})]}),e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-green-500 mb-1",children:[e.jsx(tt,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Successes"})]}),e.jsx("div",{className:"text-2xl font-bold text-green-500",children:E.totalSuccesses})]}),e.jsxs("div",{className:"glass rounded-2xl p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-red-500 mb-1",children:[e.jsx(ae,{className:"h-4 w-4"}),e.jsx("span",{className:"text-xs",children:"Failures"})]}),e.jsx("div",{className:"text-2xl font-bold text-red-500",children:E.totalFailures})]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-sm",children:[e.jsx(Os,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(C,{placeholder:"Search jobs...",value:o,onChange:a=>f(a.target.value),className:"pl-10 bg-white/5 border-white/10 rounded-xl"})]}),e.jsxs(Fe,{children:[e.jsx(Ie,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(at,{className:"h-4 w-4"}),xs.find(a=>a.value===i)?.label]})}),e.jsx(Oe,{align:"start",children:xs.map(a=>{const ee=a.icon;return e.jsxs(z,{onClick:()=>j(a.value),className:l(i===a.value&&"bg-primary/10"),children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),a.label]},a.value)})})]}),e.jsxs(Fe,{children:[e.jsx(Ie,{asChild:!0,children:e.jsxs(D,{variant:"outline",size:"sm",className:"gap-2",children:[e.jsx(gs,{className:"h-4 w-4"}),us.find(a=>a.value===h)?.label]})}),e.jsx(Oe,{align:"start",children:us.map(a=>{const ee=a.icon;return e.jsxs(z,{onClick:()=>N(a.value),className:l(h===a.value&&"bg-primary/10"),children:[e.jsx(ee,{className:"h-4 w-4 mr-2"}),a.label]},a.value)})})]})]}),k?e.jsxs("div",{className:"glass rounded-[28px] p-12 flex flex-col items-center justify-center",children:[e.jsx(ne,{className:"h-8 w-8 animate-spin text-primary mb-3"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading scheduled jobs..."})]}):M.length===0?e.jsxs("div",{className:"glass rounded-[28px] p-12 text-center",children:[e.jsx(J,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),e.jsx("h3",{className:"text-lg font-semibold mb-1",children:o||i!=="all"||h!=="all"?"No jobs match your filters":"No scheduled jobs yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:o||i!=="all"||h!=="all"?"Try adjusting your search or filters":"Create your first scheduled job to automate tasks"}),!(o||i!=="all"||h!=="all")&&e.jsx(ms,{})]}):e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:M.map(a=>e.jsx(vt,{job:a,onTrigger:fe,onPause:U,onResume:be,onDelete:je,onViewHistory:()=>ve(a),onEdit:Q,onArchive:X,onRestore:I},a.id))}),e.jsx(kt,{jobId:c,jobName:d,open:!!c,onOpenChange:a=>!a&&b(null)}),e.jsx(Pt,{job:P,open:!!P,onOpenChange:a=>!a&&w(null)}),e.jsx(Js,{open:!!x,onOpenChange:a=>!a&&u(null),children:e.jsxs(Ls,{children:[e.jsxs(zs,{children:[e.jsx(qs,{children:"Delete Scheduled Job?"}),e.jsx(_s,{children:"This will permanently delete this job and all its run history. This action cannot be undone."})]}),e.jsxs($s,{children:[e.jsx(Hs,{children:"Cancel"}),e.jsx(Us,{onClick:Z,className:"bg-red-500 hover:bg-red-600",disabled:T.isPending,children:T.isPending?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete Job"})]})]})})]})}export{ms as CreateJobModal,na as CronDashboard,Pt as EditJobModal,vt as JobCard,kt as JobHistoryModal};
|