@overlordai/server 1.0.174 → 1.0.176
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/database/migrations/020-connectors.sql +48 -0
- package/database/migrations/021-task-design-context.sql +17 -0
- package/dist/adapters/command-parser.utils.d.ts +1 -0
- package/dist/adapters/command-parser.utils.d.ts.map +1 -1
- package/dist/adapters/command-parser.utils.js +9 -0
- package/dist/adapters/command-parser.utils.js.map +1 -1
- package/dist/adapters/nlu.service.d.ts.map +1 -1
- package/dist/adapters/nlu.service.js +4 -1
- package/dist/adapters/nlu.service.js.map +1 -1
- package/dist/app.module.d.ts.map +1 -1
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/connectors/connector-closure.service.d.ts +16 -0
- package/dist/connectors/connector-closure.service.d.ts.map +1 -0
- package/dist/connectors/connector-closure.service.js +97 -0
- package/dist/connectors/connector-closure.service.js.map +1 -0
- package/dist/connectors/connector-dispatch.service.d.ts +30 -0
- package/dist/connectors/connector-dispatch.service.d.ts.map +1 -0
- package/dist/connectors/connector-dispatch.service.js +226 -0
- package/dist/connectors/connector-dispatch.service.js.map +1 -0
- package/dist/connectors/connector.constants.d.ts +4 -0
- package/dist/connectors/connector.constants.d.ts.map +1 -0
- package/dist/connectors/connector.constants.js +12 -0
- package/dist/connectors/connector.constants.js.map +1 -0
- package/dist/connectors/connector.controller.d.ts +20 -0
- package/dist/connectors/connector.controller.d.ts.map +1 -0
- package/dist/connectors/connector.controller.js +166 -0
- package/dist/connectors/connector.controller.js.map +1 -0
- package/dist/connectors/connector.interface.d.ts +61 -0
- package/dist/connectors/connector.interface.d.ts.map +1 -0
- package/dist/connectors/connector.interface.js +3 -0
- package/dist/connectors/connector.interface.js.map +1 -0
- package/dist/connectors/connector.module.d.ts +3 -0
- package/dist/connectors/connector.module.d.ts.map +1 -0
- package/dist/connectors/connector.module.js +50 -0
- package/dist/connectors/connector.module.js.map +1 -0
- package/dist/connectors/connector.registry.d.ts +15 -0
- package/dist/connectors/connector.registry.d.ts.map +1 -0
- package/dist/connectors/connector.registry.js +48 -0
- package/dist/connectors/connector.registry.js.map +1 -0
- package/dist/connectors/design-context.service.d.ts +21 -0
- package/dist/connectors/design-context.service.d.ts.map +1 -0
- package/dist/connectors/design-context.service.js +77 -0
- package/dist/connectors/design-context.service.js.map +1 -0
- package/dist/connectors/design-review-trigger.service.d.ts +15 -0
- package/dist/connectors/design-review-trigger.service.d.ts.map +1 -0
- package/dist/connectors/design-review-trigger.service.js +98 -0
- package/dist/connectors/design-review-trigger.service.js.map +1 -0
- package/dist/connectors/figma/figma-url-parser.d.ts +12 -0
- package/dist/connectors/figma/figma-url-parser.d.ts.map +1 -0
- package/dist/connectors/figma/figma-url-parser.js +28 -0
- package/dist/connectors/figma/figma-url-parser.js.map +1 -0
- package/dist/connectors/figma/figma.client.d.ts +67 -0
- package/dist/connectors/figma/figma.client.d.ts.map +1 -0
- package/dist/connectors/figma/figma.client.js +67 -0
- package/dist/connectors/figma/figma.client.js.map +1 -0
- package/dist/connectors/figma/figma.connector.d.ts +29 -0
- package/dist/connectors/figma/figma.connector.d.ts.map +1 -0
- package/dist/connectors/figma/figma.connector.js +223 -0
- package/dist/connectors/figma/figma.connector.js.map +1 -0
- package/dist/connectors/figma/index.d.ts +4 -0
- package/dist/connectors/figma/index.d.ts.map +1 -0
- package/dist/connectors/figma/index.js +10 -0
- package/dist/connectors/figma/index.js.map +1 -0
- package/dist/connectors/issue-ref-helpers.d.ts +10 -0
- package/dist/connectors/issue-ref-helpers.d.ts.map +1 -0
- package/dist/connectors/issue-ref-helpers.js +24 -0
- package/dist/connectors/issue-ref-helpers.js.map +1 -0
- package/dist/connectors/issue-ref-parser.d.ts +22 -0
- package/dist/connectors/issue-ref-parser.d.ts.map +1 -0
- package/dist/connectors/issue-ref-parser.js +35 -0
- package/dist/connectors/issue-ref-parser.js.map +1 -0
- package/dist/connectors/issue-ref-resolver.service.d.ts +44 -0
- package/dist/connectors/issue-ref-resolver.service.d.ts.map +1 -0
- package/dist/connectors/issue-ref-resolver.service.js +226 -0
- package/dist/connectors/issue-ref-resolver.service.js.map +1 -0
- package/dist/connectors/jira/jira.client.d.ts +58 -0
- package/dist/connectors/jira/jira.client.d.ts.map +1 -0
- package/dist/connectors/jira/jira.client.js +70 -0
- package/dist/connectors/jira/jira.client.js.map +1 -0
- package/dist/connectors/jira/jira.connector.d.ts +17 -0
- package/dist/connectors/jira/jira.connector.d.ts.map +1 -0
- package/dist/connectors/jira/jira.connector.js +141 -0
- package/dist/connectors/jira/jira.connector.js.map +1 -0
- package/dist/connectors/sentry/sentry.client.d.ts +54 -0
- package/dist/connectors/sentry/sentry.client.d.ts.map +1 -0
- package/dist/connectors/sentry/sentry.client.js +69 -0
- package/dist/connectors/sentry/sentry.client.js.map +1 -0
- package/dist/connectors/sentry/sentry.connector.d.ts +17 -0
- package/dist/connectors/sentry/sentry.connector.d.ts.map +1 -0
- package/dist/connectors/sentry/sentry.connector.js +173 -0
- package/dist/connectors/sentry/sentry.connector.js.map +1 -0
- package/dist/connectors/webhook-comment-parser.d.ts +18 -0
- package/dist/connectors/webhook-comment-parser.d.ts.map +1 -0
- package/dist/connectors/webhook-comment-parser.js +28 -0
- package/dist/connectors/webhook-comment-parser.js.map +1 -0
- package/dist/database/repositories/connector.repository.d.ts +84 -0
- package/dist/database/repositories/connector.repository.d.ts.map +1 -0
- package/dist/database/repositories/connector.repository.js +222 -0
- package/dist/database/repositories/connector.repository.js.map +1 -0
- package/dist/database/repositories/developer.repository.d.ts +6 -1
- package/dist/database/repositories/developer.repository.d.ts.map +1 -1
- package/dist/database/repositories/developer.repository.js +19 -1
- package/dist/database/repositories/developer.repository.js.map +1 -1
- package/dist/database/repositories/external-issue-link.repository.d.ts +27 -0
- package/dist/database/repositories/external-issue-link.repository.d.ts.map +1 -0
- package/dist/database/repositories/external-issue-link.repository.js +85 -0
- package/dist/database/repositories/external-issue-link.repository.js.map +1 -0
- package/dist/database/repositories/task-design-context.repository.d.ts +33 -0
- package/dist/database/repositories/task-design-context.repository.d.ts.map +1 -0
- package/dist/database/repositories/task-design-context.repository.js +76 -0
- package/dist/database/repositories/task-design-context.repository.js.map +1 -0
- package/dist/database/repository.module.d.ts.map +1 -1
- package/dist/database/repository.module.js +6 -0
- package/dist/database/repository.module.js.map +1 -1
- package/dist/dispatcher/dedup.service.d.ts +1 -1
- package/dist/dispatcher/dedup.service.d.ts.map +1 -1
- package/dist/dispatcher/dedup.service.js +2 -2
- package/dist/dispatcher/dedup.service.js.map +1 -1
- package/dist/dispatcher/dispatcher.module.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.module.js +2 -1
- package/dist/dispatcher/dispatcher.module.js.map +1 -1
- package/dist/dispatcher/dispatcher.service.d.ts +7 -1
- package/dist/dispatcher/dispatcher.service.d.ts.map +1 -1
- package/dist/dispatcher/dispatcher.service.js +79 -8
- package/dist/dispatcher/dispatcher.service.js.map +1 -1
- package/dist/dispatcher/dispatcher.types.d.ts +26 -0
- package/dist/dispatcher/dispatcher.types.d.ts.map +1 -1
- package/dist/dispatcher/scheduler.service.d.ts +3 -1
- package/dist/dispatcher/scheduler.service.d.ts.map +1 -1
- package/dist/dispatcher/scheduler.service.js +16 -2
- package/dist/dispatcher/scheduler.service.js.map +1 -1
- package/dist/dispatcher/task-creation.service.d.ts +47 -3
- package/dist/dispatcher/task-creation.service.d.ts.map +1 -1
- package/dist/dispatcher/task-creation.service.js +26 -9
- package/dist/dispatcher/task-creation.service.js.map +1 -1
- package/dist/dispatcher/task-lifecycle.service.d.ts +5 -1
- package/dist/dispatcher/task-lifecycle.service.d.ts.map +1 -1
- package/dist/dispatcher/task-lifecycle.service.js +32 -3
- package/dist/dispatcher/task-lifecycle.service.js.map +1 -1
- package/dist/notifier/notification-consumer.d.ts +3 -1
- package/dist/notifier/notification-consumer.d.ts.map +1 -1
- package/dist/notifier/notification-consumer.js +31 -8
- package/dist/notifier/notification-consumer.js.map +1 -1
- package/dist/notifier/template.service.d.ts +6 -0
- package/dist/notifier/template.service.d.ts.map +1 -1
- package/dist/notifier/template.service.js +12 -0
- package/dist/notifier/template.service.js.map +1 -1
- package/dist/web/admin/admin-connector.controller.d.ts +58 -0
- package/dist/web/admin/admin-connector.controller.d.ts.map +1 -0
- package/dist/web/admin/admin-connector.controller.js +327 -0
- package/dist/web/admin/admin-connector.controller.js.map +1 -0
- package/dist/web/admin/admin-developer.controller.d.ts +1 -1
- package/dist/web/admin/admin-developer.controller.d.ts.map +1 -1
- package/dist/web/admin/admin-developer.controller.js +16 -5
- package/dist/web/admin/admin-developer.controller.js.map +1 -1
- package/dist/web/dashboard.controller.d.ts +1 -1
- package/dist/web/dashboard.service.d.ts +2 -7
- package/dist/web/dashboard.service.d.ts.map +1 -1
- package/dist/web/dashboard.service.js +16 -21
- package/dist/web/dashboard.service.js.map +1 -1
- package/dist/web/frame-handlers/review-report.handler.d.ts +3 -1
- package/dist/web/frame-handlers/review-report.handler.d.ts.map +1 -1
- package/dist/web/frame-handlers/review-report.handler.js +8 -3
- package/dist/web/frame-handlers/review-report.handler.js.map +1 -1
- package/dist/web/task.controller.d.ts +11 -1
- package/dist/web/task.controller.d.ts.map +1 -1
- package/dist/web/task.controller.js +118 -4
- package/dist/web/task.controller.js.map +1 -1
- package/dist/web/web.module.d.ts.map +1 -1
- package/dist/web/web.module.js +4 -1
- package/dist/web/web.module.js.map +1 -1
- package/dist/web/worker-channel.gateway.d.ts +3 -1
- package/dist/web/worker-channel.gateway.d.ts.map +1 -1
- package/dist/web/worker-channel.gateway.js +6 -3
- package/dist/web/worker-channel.gateway.js.map +1 -1
- package/package.json +4 -4
- package/public/assets/{AccessTokensPage-CBlLkkX6.js → AccessTokensPage-CoUlSpBu.js} +1 -1
- package/public/assets/{AdminPage-mynf8ODr.js → AdminPage-BonHpbC8.js} +1 -1
- package/public/assets/{AgentCliPage-DrnciW6T.js → AgentCliPage-2zflW4gy.js} +1 -1
- package/public/assets/{ApiReferencePage-DRe_cm_m.js → ApiReferencePage-BC8HEfcM.js} +1 -1
- package/public/assets/{ArchitecturePage-DNoVjW-a.js → ArchitecturePage-Da9rv0hg.js} +1 -1
- package/public/assets/{AuditLogPage-B1eTcJBR.js → AuditLogPage-BrF0T3MT.js} +1 -1
- package/public/assets/AutomationCreatePage-DI-Z1v9e.js +1 -0
- package/public/assets/{AutomationDetailPage-DWshoZlm.js → AutomationDetailPage-7TLMwELt.js} +1 -1
- package/public/assets/AutomationEditPage-BuOKTyTf.js +1 -0
- package/public/assets/AutomationListPage-D4XF43yR.js +26 -0
- package/public/assets/{AutomationRunDetailPage-D0oJoBJW.js → AutomationRunDetailPage-BDhPEndz.js} +1 -1
- package/public/assets/{BindPlatformPage-BTgH5eI0.js → BindPlatformPage-DNamr2h_.js} +1 -1
- package/public/assets/{BotIntegrationPage-D6GXacbO.js → BotIntegrationPage-DN665fG6.js} +1 -1
- package/public/assets/{BotManage-Cn_zH3U4.js → BotManage-DvfKuBFx.js} +1 -1
- package/public/assets/{BotSetupPage-DTb0r78_.js → BotSetupPage-DPsT5Ln6.js} +1 -1
- package/public/assets/{ChangelogPage-CNfqrRty.js → ChangelogPage-D1_YfUwN.js} +1 -1
- package/public/assets/{Checkbox-D1hAKR9E.js → Checkbox-D8xEau6n.js} +1 -1
- package/public/assets/{CliReferencePage-DK4sv8D8.js → CliReferencePage-DVtpCVyB.js} +1 -1
- package/public/assets/{ConfirmStageDialog-Bi3nbWlh.js → ConfirmStageDialog-Cu49oAnM.js} +1 -1
- package/public/assets/ConnectorsPage-DmC6MARl.js +48 -0
- package/public/assets/{DeploymentPage-xKePKzHX.js → DeploymentPage-P3jrGKlU.js} +1 -1
- package/public/assets/{DevWorkflowPage-DHNtwyat.js → DevWorkflowPage-DDE9wLKC.js} +1 -1
- package/public/assets/DeveloperManage-Bpo7QRy5.js +16 -0
- package/public/assets/{DeveloperSetupPage-C7_LFKDA.js → DeveloperSetupPage-CHz_5bNW.js} +1 -1
- package/public/assets/{DocsIndexPage-DDcOuwlz.js → DocsIndexPage-C8kNCHNc.js} +11 -6
- package/public/assets/{DocsLayout-B477jsxk.js → DocsLayout-CF22uAIS.js} +1 -1
- package/public/assets/{DocsPrimitives-CgyoKAir.js → DocsPrimitives-BhxcRaTm.js} +1 -1
- package/public/assets/{EditProjectPage-Dfm319Z2.js → EditProjectPage-D_3HRO1s.js} +1 -1
- package/public/assets/{EmptyState-P0FzomcO.js → EmptyState-IvQHEoph.js} +1 -1
- package/public/assets/{EnvVariablesPage-CnQo2yCF.js → EnvVariablesPage-DNuaFEmN.js} +1 -1
- package/public/assets/HomePage-B7S2lrwi.js +1 -0
- package/public/assets/{InfoRow-DbxM6iML.js → InfoRow-C_tQVkuP.js} +1 -1
- package/public/assets/{InstallationPage-CuOWbc1H.js → InstallationPage-CK1BUOe2.js} +1 -1
- package/public/assets/{LandingPage-Cbvdm3eI.js → LandingPage-DvR0mLWM.js} +1 -1
- package/public/assets/{LocalDevelopmentPage-0icX-WcV.js → LocalDevelopmentPage-C-5yQqhM.js} +1 -1
- package/public/assets/{LoginPage-6JnXQfU3.js → LoginPage-BdTmOyQm.js} +1 -1
- package/public/assets/{MetricBar-Dc-VQSMu.js → MetricBar-CKXN_2Ue.js} +1 -1
- package/public/assets/{MultiSelect-DCWH4BA8.js → MultiSelect-DegVW8UL.js} +1 -1
- package/public/assets/{NotFoundPage-DDuYP8W4.js → NotFoundPage-V93x8tfy.js} +1 -1
- package/public/assets/{OnboardingGuide-B0V0r8s3.js → OnboardingGuide-Crybb-Zh.js} +1 -1
- package/public/assets/{PermissionsPage-B0ggYIb5.js → PermissionsPage-BmehbFsh.js} +1 -1
- package/public/assets/{PipelineConfigPage-DtZQzMEH.js → PipelineConfigPage-DZVU3Vkj.js} +1 -1
- package/public/assets/{PipelineEditorPage-BJvEIr25.js → PipelineEditorPage-BH67Oewc.js} +1 -1
- package/public/assets/{PlanPage-C86YOhVS.js → PlanPage-B4OhS9_O.js} +1 -1
- package/public/assets/{ProfilePage-BnWgT5TC.js → ProfilePage-DpMfRGms.js} +1 -1
- package/public/assets/{ProjectDetailPage-DGQH-J_A.js → ProjectDetailPage-BOvwgwui.js} +1 -1
- package/public/assets/{ProjectListPage-CNCAX69Y.js → ProjectListPage-C2ZPh8P9.js} +1 -1
- package/public/assets/{PtyTerminal-kO8wCuuU.js → PtyTerminal-DKh7d_-3.js} +1 -1
- package/public/assets/{QuickAuth-DARffZGR.js → QuickAuth-D2EErll5.js} +1 -1
- package/public/assets/{RemoveMemberConfirmDialog-D9rPijXx.js → RemoveMemberConfirmDialog-Bnq4vIGU.js} +1 -1
- package/public/assets/ReviewAggregatePage-CTSuOo4O.js +6 -0
- package/public/assets/ReviewPage-Dx31QqyM.js +1 -0
- package/public/assets/{Select-CgGQnjuL.js → Select-BXx8KPbW.js} +1 -1
- package/public/assets/{SettingsPage-Dqser9QV.js → SettingsPage-D3tDh7gu.js} +1 -1
- package/public/assets/{Skeleton-KIdOfHCh.js → Skeleton-Crpru9Ol.js} +1 -1
- package/public/assets/{SkillPage-kituG7_x.js → SkillPage-BiwP6aqc.js} +1 -1
- package/public/assets/TaskDetailPage-DHW9thUL.js +21 -0
- package/public/assets/{TaskGuidePage-D3sA_3Vy.js → TaskGuidePage-DD_jyUVW.js} +1 -1
- package/public/assets/TaskListPage-CBIv7NTp.js +1 -0
- package/public/assets/{TaskStatusBadge-D9epJQNe.js → TaskStatusBadge-Cfz28K6K.js} +1 -1
- package/public/assets/{TerminalHomePage-Cl2Uh4Hp.js → TerminalHomePage-BmhBvY10.js} +1 -1
- package/public/assets/{TokenManage-DOg2xTt8.js → TokenManage-CYSBKzT7.js} +1 -1
- package/public/assets/{Tooltip-D1qzP0lG.js → Tooltip-DZdu3ZKx.js} +1 -1
- package/public/assets/{TotpSetupPage-CCbH89j8.js → TotpSetupPage-DP5q6oE-.js} +1 -1
- package/public/assets/{WorkerDetailPage-PtA39Lz5.js → WorkerDetailPage-LMirCNtN.js} +1 -1
- package/public/assets/{WorkerListPage-Rq7zwaP2.js → WorkerListPage-q6siISS8.js} +1 -1
- package/public/assets/{WorkerOperationsPage-CapQErvu.js → WorkerOperationsPage-CGzqG_QM.js} +1 -1
- package/public/assets/{WorkerSetupGuidePage-BVgaWQP0.js → WorkerSetupGuidePage-aVkDqrMr.js} +1 -1
- package/public/assets/{WorkerSetupPage-D-T4O7PE.js → WorkerSetupPage-C_zONAIf.js} +1 -1
- package/public/assets/agent-type-options-BiSKx1a4.js +1 -0
- package/public/assets/{arrow-left-CsRQX7H5.js → arrow-left-sGTyHBvX.js} +1 -1
- package/public/assets/{arrow-right-lhj-X9Ah.js → arrow-right-_NIT1UtR.js} +1 -1
- package/public/assets/{bot-BI0aOjZg.js → bot-CDSBtXc_.js} +1 -1
- package/public/assets/{chevron-down-BMMNE8tj.js → chevron-down-CE0uuyBZ.js} +1 -1
- package/public/assets/{chevron-left-C5QPcYfE.js → chevron-left-C0Zw71uv.js} +1 -1
- package/public/assets/{chevron-right-DUJ8mQK2.js → chevron-right-BCit7CZP.js} +1 -1
- package/public/assets/{chevron-up-tdj0sbLv.js → chevron-up-Bl0OZM4v.js} +1 -1
- package/public/assets/{circle-alert-CMpAAr9i.js → circle-alert-rHCTliEW.js} +1 -1
- package/public/assets/{clock-CM8cLcAb.js → clock-BwsbKSS6.js} +1 -1
- package/public/assets/{copy-DEFukTLk.js → copy-h1a805Rd.js} +1 -1
- package/public/assets/{download-enKZtRO3.js → download-URcu3Jx3.js} +1 -1
- package/public/assets/{external-link-DLg1H4XY.js → external-link-FhyMbjzB.js} +1 -1
- package/public/assets/{git-fork-BLuZ7mG_.js → git-fork-Dc1BvdTN.js} +1 -1
- package/public/assets/{index-6n4YMG-q.js → index-J1zWTACN.js} +13 -13
- package/public/assets/{key-DdT50FZZ.js → key-COdogDFT.js} +1 -1
- package/public/assets/{loader-circle-BsR1MJQw.js → loader-circle-Bq_BpbZ2.js} +1 -1
- package/public/assets/{pencil-wJOYzbVI.js → pencil-0fxibflK.js} +1 -1
- package/public/assets/{play-sxSJsoXu.js → play-Dbk8Wgkn.js} +1 -1
- package/public/assets/{plus-B3b8vXw9.js → plus-V36Q_nxP.js} +1 -1
- package/public/assets/{rotate-ccw-Wq-FsTE-.js → rotate-ccw-ByVQRmQu.js} +1 -1
- package/public/assets/{scroll-text-DrPNg6ww.js → scroll-text-C2iOLXnA.js} +1 -1
- package/public/assets/{settings-CG53o23z.js → settings-DrgaMc9j.js} +1 -1
- package/public/assets/{skip-forward-gDc2Yb8q.js → skip-forward-SfkU0vVB.js} +1 -1
- package/public/assets/{status-colors-D1PZs9TB.js → status-colors-IR97PkWv.js} +1 -1
- package/public/assets/{task-agent-DZDHjrS-.js → task-agent-BIYkVnlP.js} +1 -1
- package/public/assets/{task-constants-CCKesKBc.js → task-constants-07c7xWcv.js} +1 -1
- package/public/assets/{task.store-yMf_13Ff.js → task.store-DWG-SG1e.js} +1 -1
- package/public/assets/{timer-tBxBLW3s.js → timer-IeRNhyK4.js} +1 -1
- package/public/assets/{trash-2--fHS3BRC.js → trash-2-DuFeqRaH.js} +1 -1
- package/public/assets/{useFetch-CBIWj1ZT.js → useFetch-CZCaxaCi.js} +1 -1
- package/public/assets/{users-BWDidnLE.js → users-CG1y1K_u.js} +1 -1
- package/public/assets/{wifi-BTg-eNKI.js → wifi-Dvp0MK85.js} +1 -1
- package/public/assets/{workflow-CBP21ght.js → workflow-qWh96h21.js} +1 -1
- package/public/assets/{zap-Dhvfo8tD.js → zap-Cwv7x_Mg.js} +1 -1
- package/public/index.html +1 -1
- package/public/sw.js +1 -1
- package/public/assets/AutomationCreatePage-CukXfCtB.js +0 -1
- package/public/assets/AutomationEditPage-DL3-RPcj.js +0 -1
- package/public/assets/AutomationListPage-DGH6MsJc.js +0 -26
- package/public/assets/DeveloperManage-Di8MWrTf.js +0 -16
- package/public/assets/HomePage-Da2G6_QB.js +0 -1
- package/public/assets/ReviewAggregatePage-Bc1K6gXO.js +0 -6
- package/public/assets/ReviewPage-BPDRxqrG.js +0 -1
- package/public/assets/TaskDetailPage-DQVE-zp-.js +0 -21
- package/public/assets/TaskListPage-arWi98DB.js +0 -1
- package/public/assets/agent-type-options-CvfN3Xkt.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{W as r,o as e,ab as s,ac as u,a8 as a}from"./index-
|
|
1
|
+
import{W as r,o as e,ab as s,ac as u,a8 as a}from"./index-J1zWTACN.js";const n={[e.QUEUED]:"var(--text-muted)",[e.ASSIGNED]:"#60a5fa",[e.RUNNING]:"var(--accent)",[e.SUSPENDED]:"var(--warning)",[e.COMPLETED]:"var(--info)",[e.FAILED]:"var(--destructive)",[e.CANCELLED]:"var(--text-muted)"};function v(t){return n[t]??"var(--text-muted)"}const o={[r.ONLINE]:"var(--accent)",[r.OFFLINE]:"var(--destructive)",[r.DRAINING]:"var(--warning)",[r.DECOMMISSIONED]:"var(--text-muted)"};function E(t){return o[t]??"var(--text-muted)"}function x(t){switch(t){case s.ACTIVE:return"text-green-400";case s.DISABLED:return"text-red-400";default:return"text-[var(--text-muted)]"}}function S(t){switch(t){case a.ACTIVE:return"text-green-400";case a.USED:return"text-blue-400";case a.REVOKED:return"text-red-400";case a.EXPIRED:return"text-[var(--text-muted)]";default:return"text-[var(--text-muted)]"}}function d(t){switch(t){case u.ACTIVE:return"text-green-400";case"error":return"text-red-400";default:return"text-[var(--text-muted)]"}}function i(t){return t>.8?"var(--destructive)":t>.6?"var(--warning)":"var(--accent)"}export{v as a,i as b,x as c,d,S as e,E as g,n as t,o as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as a,Q as t}from"./index-
|
|
1
|
+
import{o as a,Q as t}from"./index-J1zWTACN.js";import{a as l}from"./agent-type-options-BiSKx1a4.js";const r=[a.COMPLETED,a.FAILED,a.CANCELLED],E=[{value:"feat",label:"feat"},{value:"fix",label:"fix"},{value:"refactor",label:"refactor"},{value:"docs",label:"docs"},{value:"chore",label:"chore"}],o=l(e=>e);[...o];function c(e){return(e??t.CLAUDE).toLowerCase()}export{r as T,E as a,c as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as i,h as c}from"./index-
|
|
1
|
+
import{n as i,h as c}from"./index-J1zWTACN.js";const k=i((a,o)=>({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null,_fetchTasksAbort:null,_fetchTasksRequestId:0,fetchTasks:async s=>{const t=o()._fetchTasksAbort;t&&t.abort();const e=new AbortController,n=o()._fetchTasksRequestId+1;a({loading:!0,error:null,_fetchTasksAbort:e,_fetchTasksRequestId:n});try{const r={};s!=null&&s.status&&(r.status=s.status),s!=null&&s.projectKey&&(r.projectKey=s.projectKey),s!=null&&s.developerId&&(r.developerId=s.developerId),s!=null&&s.taskMode&&(r.taskMode=s.taskMode),s!=null&&s.cursor&&(r.cursor=s.cursor),s!=null&&s.limit&&(r.limit=String(s.limit));const l=await c.get("web/tasks",{searchParams:r,signal:e.signal}).json();if(o()._fetchTasksRequestId!==n)return;a({tasks:l.data,nextCursor:l.nextCursor??null,_fetchTasksAbort:null})}catch(r){if(r instanceof DOMException&&r.name==="AbortError")return;o()._fetchTasksRequestId===n&&a({error:r instanceof Error?r.message:"Failed to fetch tasks"})}finally{o()._fetchTasksRequestId===n&&a({loading:!1,_fetchTasksAbort:null})}},fetchTask:async s=>{a({loading:!0,error:null});try{const t=await c.get(`web/tasks/${s}`).json();a({currentTask:t})}catch(t){a({error:t instanceof Error?t.message:"Failed to fetch task"})}finally{a({loading:!1})}},createTask:async s=>{a({error:null});try{const t=await c.post("web/tasks",{json:s}).json();return a(e=>({tasks:[t,...e.tasks]})),t}catch(t){throw a({error:t instanceof Error?t.message:"Failed to create task"}),t}},cancelTask:async s=>{a({error:null});try{await c.post(`web/tasks/${s}/cancel`);const{currentTask:t}=o();(t==null?void 0:t.id)===s&&await o().fetchTask(s)}catch(t){throw a({error:t instanceof Error?t.message:"Failed to cancel task"}),t}},reset:()=>{a({tasks:[],currentTask:null,loading:!1,error:null,nextCursor:null,_fetchTasksAbort:null,_fetchTasksRequestId:0})}}));export{k as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./index-
|
|
1
|
+
import{r as e}from"./index-J1zWTACN.js";function p(s,l){const[i,d]=e.useState(null),[R,a]=e.useState(!0),[m,o]=e.useState(null),f=e.useRef(s);f.current=s;const r=e.useRef(0),t=e.useRef(!0),u=e.useCallback(async()=>{const c=++r.current;a(!0),o(null);try{const n=await f.current();t.current&&c===r.current&&d(n)}catch(n){if(t.current&&c===r.current){const E=n instanceof Error?n.message:"An unexpected error occurred";o(E)}}finally{t.current&&c===r.current&&a(!1)}},l);return e.useEffect(()=>{u()},[u]),e.useEffect(()=>()=>{t.current=!1,r.current+=1},[]),{data:i,loading:R,error:m,refetch:u}}export{p as u};
|
package/public/index.html
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap"
|
|
29
29
|
rel="stylesheet"
|
|
30
30
|
/>
|
|
31
|
-
<script type="module" crossorigin src="/assets/index-
|
|
31
|
+
<script type="module" crossorigin src="/assets/index-J1zWTACN.js"></script>
|
|
32
32
|
<link rel="stylesheet" crossorigin href="/assets/index-B40ZH6vh.css">
|
|
33
33
|
<link rel="manifest" href="/manifest.webmanifest"><script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script></head>
|
|
34
34
|
<body>
|
package/public/sw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const a=s=>l(s,r),o={module:{uri:r},exports:u,require:a};e[r]=Promise.all(i.map(s=>o[s]||a(s))).then(s=>(n(...s),u))}}define(["./workbox-6e9b121d"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"og-image.png",revision:"f1563b4bdc7d1a4ab0aef864b0c2294e"},{url:"index.html",revision:"
|
|
1
|
+
if(!self.define){let s,e={};const l=(l,i)=>(l=new URL(l+".js",i).href,e[l]||new Promise(e=>{if("document"in self){const s=document.createElement("script");s.src=l,s.onload=e,document.head.appendChild(s)}else s=l,importScripts(l),e()}).then(()=>{let s=e[l];if(!s)throw new Error(`Module ${l} didn’t register its module`);return s}));self.define=(i,n)=>{const r=s||("document"in self?document.currentScript.src:"")||location.href;if(e[r])return;let u={};const a=s=>l(s,r),o={module:{uri:r},exports:u,require:a};e[r]=Promise.all(i.map(s=>o[s]||a(s))).then(s=>(n(...s),u))}}define(["./workbox-6e9b121d"],function(s){"use strict";self.skipWaiting(),s.clientsClaim(),s.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"og-image.png",revision:"f1563b4bdc7d1a4ab0aef864b0c2294e"},{url:"index.html",revision:"1955c77bf3dd8805e4c2f2feb58313e1"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"apple-touch-icon-152x152.png",revision:"8cc7ef3bc3aa19c3d8a29a58646d0636"},{url:"apple-touch-icon-120x120.png",revision:"7057fb6fb60df3fcf3cd49883db13be9"},{url:"assets/zap-Cwv7x_Mg.js",revision:null},{url:"assets/workflow-qWh96h21.js",revision:null},{url:"assets/wifi-Dvp0MK85.js",revision:null},{url:"assets/users-CG1y1K_u.js",revision:null},{url:"assets/useFetch-CZCaxaCi.js",revision:null},{url:"assets/trash-2-DuFeqRaH.js",revision:null},{url:"assets/timer-IeRNhyK4.js",revision:null},{url:"assets/task.store-DWG-SG1e.js",revision:null},{url:"assets/task-constants-07c7xWcv.js",revision:null},{url:"assets/task-agent-BIYkVnlP.js",revision:null},{url:"assets/status-colors-IR97PkWv.js",revision:null},{url:"assets/skip-forward-SfkU0vVB.js",revision:null},{url:"assets/settings-DrgaMc9j.js",revision:null},{url:"assets/scroll-text-C2iOLXnA.js",revision:null},{url:"assets/rotate-ccw-ByVQRmQu.js",revision:null},{url:"assets/plus-V36Q_nxP.js",revision:null},{url:"assets/play-Dbk8Wgkn.js",revision:null},{url:"assets/pencil-0fxibflK.js",revision:null},{url:"assets/password-CHk45-jw.js",revision:null},{url:"assets/loader-circle-Bq_BpbZ2.js",revision:null},{url:"assets/key-COdogDFT.js",revision:null},{url:"assets/index-J1zWTACN.js",revision:null},{url:"assets/index-B40ZH6vh.css",revision:null},{url:"assets/git-fork-Dc1BvdTN.js",revision:null},{url:"assets/external-link-FhyMbjzB.js",revision:null},{url:"assets/download-URcu3Jx3.js",revision:null},{url:"assets/date-CmcdoD87.js",revision:null},{url:"assets/copy-h1a805Rd.js",revision:null},{url:"assets/clock-BwsbKSS6.js",revision:null},{url:"assets/circle-alert-rHCTliEW.js",revision:null},{url:"assets/chevron-up-Bl0OZM4v.js",revision:null},{url:"assets/chevron-right-BCit7CZP.js",revision:null},{url:"assets/chevron-left-C0Zw71uv.js",revision:null},{url:"assets/chevron-down-CE0uuyBZ.js",revision:null},{url:"assets/bot-CDSBtXc_.js",revision:null},{url:"assets/automationFindings-DfyQvLZV.js",revision:null},{url:"assets/arrow-right-_NIT1UtR.js",revision:null},{url:"assets/arrow-left-sGTyHBvX.js",revision:null},{url:"assets/agent-type-options-BiSKx1a4.js",revision:null},{url:"assets/WorkerSetupPage-C_zONAIf.js",revision:null},{url:"assets/WorkerSetupGuidePage-aVkDqrMr.js",revision:null},{url:"assets/WorkerOperationsPage-CGzqG_QM.js",revision:null},{url:"assets/WorkerListPage-q6siISS8.js",revision:null},{url:"assets/WorkerDetailPage-LMirCNtN.js",revision:null},{url:"assets/TotpSetupPage-DP5q6oE-.js",revision:null},{url:"assets/Tooltip-DZdu3ZKx.js",revision:null},{url:"assets/TokenManage-CYSBKzT7.js",revision:null},{url:"assets/TerminalHomePage-BmhBvY10.js",revision:null},{url:"assets/TaskStatusBadge-Cfz28K6K.js",revision:null},{url:"assets/TaskListPage-CBIv7NTp.js",revision:null},{url:"assets/TaskGuidePage-DD_jyUVW.js",revision:null},{url:"assets/TaskDetailPage-DHW9thUL.js",revision:null},{url:"assets/SkillPage-BiwP6aqc.js",revision:null},{url:"assets/Skeleton-Crpru9Ol.js",revision:null},{url:"assets/SettingsPage-D3tDh7gu.js",revision:null},{url:"assets/Select-BXx8KPbW.js",revision:null},{url:"assets/ReviewPage-Dx31QqyM.js",revision:null},{url:"assets/ReviewAggregatePage-CTSuOo4O.js",revision:null},{url:"assets/RemoveMemberConfirmDialog-Bnq4vIGU.js",revision:null},{url:"assets/QuickAuth-D2EErll5.js",revision:null},{url:"assets/PtyTerminal-DKh7d_-3.js",revision:null},{url:"assets/PtyTerminal-6GBZ9nXN.css",revision:null},{url:"assets/ProjectListPage-C2ZPh8P9.js",revision:null},{url:"assets/ProjectDetailPage-BOvwgwui.js",revision:null},{url:"assets/ProfilePage-DpMfRGms.js",revision:null},{url:"assets/PlanPage-B4OhS9_O.js",revision:null},{url:"assets/PipelineEditorPage-BH67Oewc.js",revision:null},{url:"assets/PipelineConfigPage-DZVU3Vkj.js",revision:null},{url:"assets/PermissionsPage-BmehbFsh.js",revision:null},{url:"assets/OnboardingGuide-Crybb-Zh.js",revision:null},{url:"assets/NotFoundPage-V93x8tfy.js",revision:null},{url:"assets/MultiSelect-DegVW8UL.js",revision:null},{url:"assets/MetricBar-CKXN_2Ue.js",revision:null},{url:"assets/LoginPage-BdTmOyQm.js",revision:null},{url:"assets/LocalDevelopmentPage-C-5yQqhM.js",revision:null},{url:"assets/LandingPage-DvR0mLWM.js",revision:null},{url:"assets/InstallationPage-CK1BUOe2.js",revision:null},{url:"assets/InfoRow-C_tQVkuP.js",revision:null},{url:"assets/HomePage-B7S2lrwi.js",revision:null},{url:"assets/EnvVariablesPage-DNuaFEmN.js",revision:null},{url:"assets/EmptyState-IvQHEoph.js",revision:null},{url:"assets/EditProjectPage-D_3HRO1s.js",revision:null},{url:"assets/DocsPrimitives-BhxcRaTm.js",revision:null},{url:"assets/DocsLayout-CF22uAIS.js",revision:null},{url:"assets/DocsIndexPage-C8kNCHNc.js",revision:null},{url:"assets/DeveloperSetupPage-CHz_5bNW.js",revision:null},{url:"assets/DeveloperManage-Bpo7QRy5.js",revision:null},{url:"assets/DevWorkflowPage-DDE9wLKC.js",revision:null},{url:"assets/DeploymentPage-P3jrGKlU.js",revision:null},{url:"assets/ConnectorsPage-DmC6MARl.js",revision:null},{url:"assets/ConfirmStageDialog-Cu49oAnM.js",revision:null},{url:"assets/CliReferencePage-DVtpCVyB.js",revision:null},{url:"assets/Checkbox-D8xEau6n.js",revision:null},{url:"assets/ChangelogPage-D1_YfUwN.js",revision:null},{url:"assets/BotSetupPage-DPsT5Ln6.js",revision:null},{url:"assets/BotManage-DvfKuBFx.js",revision:null},{url:"assets/BotIntegrationPage-DN665fG6.js",revision:null},{url:"assets/BindPlatformPage-DNamr2h_.js",revision:null},{url:"assets/AutomationRunDetailPage-BDhPEndz.js",revision:null},{url:"assets/AutomationListPage-D4XF43yR.js",revision:null},{url:"assets/AutomationEditPage-BuOKTyTf.js",revision:null},{url:"assets/AutomationDetailPage-7TLMwELt.js",revision:null},{url:"assets/AutomationCreatePage-DI-Z1v9e.js",revision:null},{url:"assets/AuditLogPage-BrF0T3MT.js",revision:null},{url:"assets/ArchitecturePage-Da9rv0hg.js",revision:null},{url:"assets/ApiReferencePage-BC8HEfcM.js",revision:null},{url:"assets/AgentCliPage-2zflW4gy.js",revision:null},{url:"assets/AdminPage-BonHpbC8.js",revision:null},{url:"assets/AccessTokensPage-CoUlSpBu.js",revision:null},{url:"apple-touch-icon-180x180.png",revision:"34c1b155ebc55bee221777f86f4612d8"},{url:"favicon.svg",revision:"e91ea32c7308cc2267ae15a5974a27f8"},{url:"icon-192x192.png",revision:"0bc2b74efb274c01d9eb50f717f4b7cf"},{url:"icon-512x512.png",revision:"74e561c3eb152bbb9cdcb333b5f1f3be"},{url:"icon-maskable-192x192.png",revision:"bf88226fe789dcb35bf89a307d3ba1af"},{url:"icon-maskable-512x512.png",revision:"69ada030d99c4a087bc309c00d716654"},{url:"manifest.webmanifest",revision:"e3100788a89f54481dbd663d57df57a6"}],{}),s.cleanupOutdatedCaches(),s.registerRoute(new s.NavigationRoute(s.createHandlerBoundToURL("/index.html"))),s.registerRoute(/^https:\/\/fonts\.googleapis\.com/,new s.CacheFirst({cacheName:"google-fonts-stylesheets",plugins:[]}),"GET"),s.registerRoute(/^https:\/\/fonts\.gstatic\.com/,new s.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new s.ExpirationPlugin({maxEntries:10,maxAgeSeconds:31536e3})]}),"GET")});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as J,a as Q,F as W,a1 as A,r,h as X,t as x,j as e}from"./index-6n4YMG-q.js";import{S as b}from"./Select-CgGQnjuL.js";import{M as ee}from"./MultiSelect-DCWH4BA8.js";import{C as te}from"./Checkbox-D1hAKR9E.js";import{A as ae}from"./arrow-left-CsRQX7H5.js";import"./chevron-down-BMMNE8tj.js";const re=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],oe=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],se=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],ne=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function le(m){const a=m.trim().split(/\s+/);return a.length===5||a.length===6}function pe(){const m=J(),{t:a}=Q(),[Y]=W(),u=Y.get("templateId"),{createAutomation:w}=A(),[h,P]=r.useState(""),[y,F]=r.useState(""),[s,M]=r.useState([]),[c,$]=r.useState("cron"),[B,j]=r.useState("0 0 * * *"),[v,_]=r.useState("0 0 * * *"),[k,K]=r.useState("UTC"),[N,L]=r.useState("COMPLETED"),[d,C]=r.useState(""),[f,D]=r.useState(""),[g,z]=r.useState("readonly"),[S,T]=r.useState("claude"),[E,I]=r.useState(!0),[U,V]=r.useState({}),[O,G]=r.useState([]),[q,R]=r.useState(!1);r.useEffect(()=>{d&&(s.length===0||!s.includes(d))&&C("")},[d,s]),r.useEffect(()=>{let t=!1;return X.get("web/projects").json().then(n=>{t||G(n),!t&&n.length===1&&(M([n[0].key]),T(n[0].agentType))}).catch(()=>{t||x.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{if(!u)return;let t=!1;return A.getState().fetchTemplates().then(()=>{if(t)return;const o=A.getState().templates.find(l=>l.id===Number(u));if(o){P(o.name),F(o.taskDescription),$(o.triggerType),z(o.executionMode);const l=o.triggerConfig;if(o.triggerType==="cron"&&l.cron&&(_(l.cron),j(""),l.timezone&&K(l.timezone)),o.triggerType==="task_event"&&l.event){L(l.event);const i=l.filter;i!=null&&i.projectKey&&C(i.projectKey),i!=null&&i.taskMode&&D(i.taskMode)}const p=o.taskConfig;p&&V(p),p!=null&&p.agentType&&T(p.agentType),I(!0)}}),()=>{t=!0}},[u]);const Z=t=>{j(t),t&&_(t)},H=r.useCallback(async()=>{if(!h.trim()){x.error(a("automation.name_required"));return}if(s.length===0){x.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!v.trim()){x.error(a("automation.cron_expression_required"));return}if(!le(v)){x.error(a("automation.cron_expression_invalid"));return}t={cron:v,timezone:k}}else c==="task_event"&&(t={event:N,filter:{...d&&{projectKey:d},...f&&{taskMode:f}}});R(!0);try{const n=await w({projectKey:s[0],projectKeys:s,name:h.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:g,taskConfig:{...U,agentType:S},notifyProjectChats:E,...u?{templateId:Number(u)}:{}});x.success(a("automation.automation_created")),m(`/automations/${n.id}`)}catch(n){const o=n instanceof Error?n.message:a("automation.failed_create");x.error(o)}finally{R(!1)}},[h,y,s,c,v,k,N,d,f,g,S,E,u,w,m,a]);return e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ae,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.create_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-project",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(ee,{values:s,onChange:M,options:O.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"create-name",type:"text",value:h,onChange:t=>P(t.target.value),placeholder:a("automation.name_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"create-description",value:y,onChange:t=>F(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>$(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(b,{value:B,onChange:Z,options:re.map(t=>({value:t.value,label:t.value?`${t.label} (${t.value})`:t.label}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"create-cron-expression",type:"text",value:v,onChange:t=>{_(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(b,{value:k,onChange:K,options:ne.map(t=>({value:t,label:t}))})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(b,{value:N,onChange:L,options:oe})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(b,{value:d,onChange:C,options:[{value:"",label:a("automation.all_projects")},...O.filter(t=>s.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:s.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"create-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(b,{value:f,onChange:D,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>z(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${g===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(g==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:se.map(t=>e.jsx("button",{onClick:()=>T(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${S===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsx(te,{checked:E,onCheckedChange:I,label:a("automation.notify_project_chats")}),e.jsx("p",{className:"mt-1 pl-6 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:H,disabled:q,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(q?"automation.creating":"automation.create_automation")}),e.jsx("button",{onClick:()=>m("/automations"),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{pe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as X,a as ee,B as te,a1 as ae,r,h as re,t as m,j as e}from"./index-6n4YMG-q.js";import{S as v}from"./Select-CgGQnjuL.js";import{M as oe}from"./MultiSelect-DCWH4BA8.js";import{C as se}from"./Checkbox-D1hAKR9E.js";import{T as ne}from"./Skeleton-KIdOfHCh.js";import{E as le}from"./EmptyState-P0FzomcO.js";import{C as ie}from"./clock-CM8cLcAb.js";import{A as ce}from"./arrow-left-CsRQX7H5.js";import"./chevron-down-BMMNE8tj.js";const R=[{label:"every_hour",value:"0 * * * *"},{label:"every_6_hours",value:"0 */6 * * *"},{label:"daily_midnight",value:"0 0 * * *"},{label:"daily_9am",value:"0 9 * * *"},{label:"weekly_monday",value:"0 9 * * 1"},{label:"custom",value:""}],de=[{label:"completed",value:"COMPLETED"},{label:"failed",value:"FAILED"},{label:"cancelled",value:"CANCELLED"}],xe=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}],U=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Europe/London","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Asia/Kolkata","Australia/Sydney"];function me(u){const a=u.trim().split(/\s+/);return a.length===5||a.length===6}function _e(){const u=X(),{t:a}=ee(),{id:Y}=te(),n=Number(Y),{currentAutomation:o,loading:B,fetchAutomation:E,updateAutomation:S}=ae(),[b,T]=r.useState(""),[y,w]=r.useState(""),[l,A]=r.useState([]),[c,P]=r.useState("cron"),[V,j]=r.useState(""),[p,g]=r.useState(""),[d,M]=r.useState("UTC"),[_,$]=r.useState("COMPLETED"),[x,k]=r.useState(""),[h,F]=r.useState(""),[f,K]=r.useState("readonly"),[N,L]=r.useState("claude"),[C,z]=r.useState(!1),[D,G]=r.useState([]),[O,I]=r.useState(!1),[q,Z]=r.useState(!1);r.useEffect(()=>{E(n)},[n,E]),r.useEffect(()=>{let t=!1;return re.get("web/projects").json().then(i=>{t||G(i)}).catch(()=>{t||m.error(a("automation.failed_load_projects"))}),()=>{t=!0}},[a]),r.useEffect(()=>{x&&(l.length===0||!l.includes(x))&&k("")},[x,l]),r.useEffect(()=>{if(!o||o.id!==n||q)return;T(o.name),w(o.description),A(o.projectKeys??[o.projectKey]),P(o.triggerType),K(o.executionMode);const t=o.triggerConfig;if(o.triggerType==="cron"){const s=t.cron??"";g(s);const Q=R.find(W=>W.value===s);j(Q?s:""),M(t.timezone??"UTC")}if(o.triggerType==="task_event"){$(t.event??"COMPLETED");const s=t.filter;k((s==null?void 0:s.projectKey)??""),F((s==null?void 0:s.taskMode)??"")}const i=o.taskConfig;L((i==null?void 0:i.agentType)??"claude"),z(o.notifyProjectChats),Z(!0)},[o,n,q]);const H=t=>{j(t),t&&g(t)},J=r.useCallback(async()=>{if(!b.trim()){m.error(a("automation.name_required"));return}if(l.length===0){m.error(a("automation.project_required"));return}let t={};if(c==="cron"){if(!p.trim()){m.error(a("automation.cron_expression_required"));return}if(!me(p)){m.error(a("automation.cron_expression_invalid"));return}t={cron:p,timezone:d}}else c==="task_event"&&(t={event:_,filter:{...x&&{projectKey:x},...h&&{taskMode:h}}});I(!0);try{await S(n,{projectKey:l[0],projectKeys:l,name:b.trim(),description:y.trim(),triggerType:c,triggerConfig:t,executionMode:f,taskConfig:{...(o==null?void 0:o.taskConfig)??{},agentType:N},notifyProjectChats:C}),m.success(a("automation.automation_updated")),u(`/automations/${n}`)}catch(i){const s=i instanceof Error?i.message:a("automation.failed_update");m.error(s)}finally{I(!1)}},[b,y,l,c,p,d,_,x,h,f,N,C,n,S,u,a]);return B&&!o?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(ne,{rows:6})}):!o||o.id!==n?e.jsx("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(le,{icon:ie,title:a("automation.automation_not_found")})}):e.jsxs("div",{className:"mx-auto max-w-2xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center gap-3",children:[e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(ce,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-sm font-bold text-[var(--text-primary)]",children:a("automation.edit_title")})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-projects",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.project")}),e.jsx(oe,{values:l,onChange:A,options:D.map(t=>({value:t.key,label:`${t.name} (${t.key})`})),placeholder:a("automation.select_project")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-name",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.name")}),e.jsx("input",{id:"edit-name",type:"text",value:b,onChange:t=>T(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-description",className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.description")}),e.jsx("textarea",{id:"edit-description",value:y,onChange:t=>w(t.target.value),rows:4,placeholder:a("automation.description_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a("automation.template_vars")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.trigger_type")}),e.jsx("div",{className:"flex gap-2",children:["cron","task_event","manual"].map(t=>e.jsx("button",{onClick:()=>P(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${c===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))})]}),c==="cron"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.cron_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-preset",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.preset")}),e.jsx(v,{value:V,onChange:H,options:R.map(t=>({value:t.value,label:`${t.label}${t.value?` (${t.value})`:""}`}))})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-cron-expression",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.cron_expression")}),e.jsx("input",{id:"edit-cron-expression",type:"text",value:p,onChange:t=>{g(t.target.value),j("")},placeholder:"* * * * *",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs font-mono text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-timezone",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.timezone")}),e.jsx(v,{value:d,onChange:M,options:[...d&&!U.includes(d)?[{value:d,label:d}]:[],...U.map(t=>({value:t,label:t}))]})]})]}),c==="task_event"&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-3",children:[e.jsx("label",{className:"block text-[11px] font-bold text-[var(--text-primary)]",children:a("automation.task_event_config")}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-event-type",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.event_type")}),e.jsx(v,{value:_,onChange:$,options:de})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-project",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_project_key")}),e.jsx(v,{value:x,onChange:k,options:[{value:"",label:a("automation.all_projects")},...D.filter(t=>l.includes(t.key)).map(t=>({value:t.key,label:`${t.name} (${t.key})`}))],disabled:l.length===0})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"edit-filter-mode",className:"mb-1 block text-[10px] text-[var(--text-muted)]",children:a("automation.filter_task_mode")}),e.jsx(v,{value:h,onChange:F,options:[{value:"",label:a("automation.all_modes")},{value:"develop",label:"develop"},{value:"review",label:"review"}]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.execution_mode")}),e.jsx("div",{className:"flex gap-2",children:["readonly","writable"].map(t=>e.jsx("button",{onClick:()=>K(t),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${f===t?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t},t))}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:a(f==="writable"?"automation.writable_hint":"automation.readonly_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-[11px] text-[var(--text-muted)]",children:a("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:xe.map(t=>e.jsx("button",{onClick:()=>L(t.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${N===t.value?"border-[var(--accent)] text-[var(--accent)] bg-[var(--accent)]/5":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:t.label},t.value))})]}),e.jsxs("div",{children:[e.jsx(se,{checked:C,onCheckedChange:z,label:a("automation.notify_project_chats")}),e.jsx("p",{className:"mt-1 pl-6 text-[10px] text-[var(--text-muted)]",children:a("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{onClick:J,disabled:O,className:"flex-1 rounded-[4px] bg-[var(--accent)] px-4 py-2.5 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed transition-opacity hover:opacity-90",children:a(O?"automation.saving":"automation.save_changes")}),e.jsx("button",{onClick:()=>u(`/automations/${n}`),className:"rounded-[4px] border border-[var(--border)] px-4 py-2.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:a("automation.cancel")})]})]})]})}export{_e as default};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{c as E,f as $,a as K,r as l,a1 as M,x as Z,j as e,a2 as Q,a3 as R,a4 as X,a5 as F,t as p,V as J,G as ee,v as te,h as ae,X as re}from"./index-6n4YMG-q.js";import{E as P}from"./EmptyState-P0FzomcO.js";import{T as I}from"./Skeleton-KIdOfHCh.js";import{T as se}from"./TaskStatusBadge-D9epJQNe.js";import{f as H,d as oe}from"./date-CmcdoD87.js";import{S as ne}from"./Select-CgGQnjuL.js";import{M as ie}from"./MultiSelect-DCWH4BA8.js";import{C as O}from"./Checkbox-D1hAKR9E.js";import{e as ce}from"./automationFindings-DfyQvLZV.js";import{P as le}from"./plus-B3b8vXw9.js";import{P as de}from"./play-sxSJsoXu.js";import{Z as xe}from"./zap-Dhvfo8tD.js";import{T as me}from"./timer-tBxBLW3s.js";import{C as ue}from"./clock-CM8cLcAb.js";import{C as pe}from"./chevron-right-DUJ8mQK2.js";import"./status-colors-D1PZs9TB.js";import"./chevron-down-BMMNE8tj.js";/**
|
|
2
|
-
* @license lucide-react v0.469.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const he=E("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
7
|
-
* @license lucide-react v0.469.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const V=E("BookDashed",[["path",{d:"M12 17h1.5",key:"1gkc67"}],["path",{d:"M12 22h1.5",key:"1my7sn"}],["path",{d:"M12 2h1.5",key:"19tvb7"}],["path",{d:"M17.5 22H19a1 1 0 0 0 1-1",key:"10akbh"}],["path",{d:"M17.5 2H19a1 1 0 0 1 1 1v1.5",key:"1vrfjs"}],["path",{d:"M20 14v3h-2.5",key:"1naeju"}],["path",{d:"M20 8.5V10",key:"1ctpfu"}],["path",{d:"M4 10V8.5",key:"1o3zg5"}],["path",{d:"M4 19.5V14",key:"ob81pf"}],["path",{d:"M4 4.5A2.5 2.5 0 0 1 6.5 2H8",key:"s8vcyb"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/**
|
|
12
|
-
* @license lucide-react v0.469.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const ge=E("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
|
|
17
|
-
* @license lucide-react v0.469.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const be=E("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["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"}]]);/**
|
|
22
|
-
* @license lucide-react v0.469.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const ve=E("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function fe({severity:a}){const t={critical:"border-[var(--destructive)] text-[var(--destructive)]",warning:"border-[var(--warning)] text-[var(--warning)]",info:"border-[var(--info)] text-[var(--info)]"};return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t[a]??"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function z({type:a}){const o={cron:me,task_event:xe,manual:de}[a]??ue;return e.jsxs("span",{className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:[e.jsx(o,{className:"h-2.5 w-2.5"}),a]})}function q({mode:a}){const t=a==="writable";return e.jsx("span",{className:`rounded-[4px] border px-1.5 py-0.5 text-[10px] ${t?"border-[var(--warning)] text-[var(--warning)]":"border-[var(--border)] text-[var(--text-muted)]"}`,children:a})}function ye(a,t){const o=a&&a.length>0?a:[t];return o.length<=2?o.join(", "):`${o.slice(0,2).join(", ")} +${o.length-2}`}function je(){const a=$(),{t}=K(),{runs:o,loading:n,fetchRuns:d,updateRunStatus:b,batchUpdateRuns:x,clearRunQuery:v}=M(),[s,f]=l.useState(new Set),N=l.useRef(!1);l.useEffect(()=>(d({inboxStatus:"unread",limit:50}),()=>{v()}),[d,v]),l.useEffect(()=>{N.current=!0;const r=Q.onStatus(w=>{N.current&&w==="connected"&&d({inboxStatus:"unread",limit:50})});return()=>{N.current=!1,r()}},[d]);const c=r=>{f(w=>{const h=new Set(w);return h.has(r)?h.delete(r):h.add(r),h})},u=()=>{s.size===o.length?f(new Set):f(new Set(o.map(r=>r.id)))},m=async r=>{try{await b(r,"read"),p.success(t("automation.marked_as_read"))}catch{p.error(t("automation.failed_mark_read"))}},_=async r=>{try{await b(r,"archived"),p.success(t("automation.archived"))}catch{p.error(t("automation.failed_archive"))}},k=async()=>{if(s.size!==0)try{await x(Array.from(s),"read"),f(new Set),p.success(t("automation.marked_n_read",{n:s.size}))}catch{p.error(t("automation.failed_batch_update"))}},y=r=>!r.findings||!Array.isArray(r.findings)?[]:ce(r.findings),C=r=>y(r).length;if(n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});const T=o.filter(r=>r.inboxStatus==="unread");return T.length===0?e.jsx(P,{icon:be,title:t("automation.no_unread_findings"),description:t("automation.inbox_description")}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("button",{onClick:u,className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:s.size===T.length?t("automation.deselect_all"):t("automation.select_all")}),s.size>0&&e.jsxs("button",{onClick:k,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-[11px] text-[var(--text-secondary)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(R,{className:"h-3 w-3"}),t("automation.mark_all_read")," (",s.size,")"]})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:T.map(r=>e.jsxs("div",{className:`flex items-center gap-3 border-b border-[var(--border)] px-4 py-3 transition-colors last:border-b-0 ${s.has(r.id)?"bg-[var(--accent)]/5":"hover:bg-[var(--bg-input)]/60"}`,children:[e.jsx(O,{checked:s.has(r.id),onCheckedChange:()=>c(r.id),"aria-label":r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId}),containerClassName:"shrink-0"}),e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsxs("div",{className:"flex min-w-0 flex-1 cursor-pointer flex-col gap-0.5",onClick:()=>a(`/automations/runs/${r.id}`),children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors",children:r.automationName?`${r.automationName} #${r.id}`:t("automation.run_label",{id:r.id,automationId:r.automationId})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[r.projectKey&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:r.projectKey}),e.jsx(z,{type:r.triggerType}),r.taskStatus&&e.jsx(se,{status:r.taskStatus}),r.workerName&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:r.workerName}),C(r)>0&&e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:C(r)!==1?t("automation.findings_count",{count:C(r)}):t("automation.finding_count",{count:C(r)})}),C(r)>0&&(()=>{const w=new Set(y(r).map(h=>h.severity));return Array.from(w).map(h=>e.jsx(fe,{severity:h},h))})()]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:H(r.createdAt)}),e.jsx("button",{onClick:()=>m(r.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",title:t("automation.mark_read"),children:e.jsx(R,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>_(r.id),className:"shrink-0 rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",title:t("automation.archive"),children:e.jsx(he,{className:"h-3.5 w-3.5"})})]},r.id))})]})}function _e(){const a=$(),{t}=K(),{automations:o,loading:n,fetchAutomations:d,enableAutomation:b,disableAutomation:x}=M();l.useEffect(()=>{d()},[d]);const v=async s=>{try{s.enabled?(await x(s.id),p.success(t("automation.automation_disabled"))):(await b(s.id),p.success(t("automation.automation_enabled")))}catch{p.error(t("automation.failed_toggle"))}};return n&&o.length===0?e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})}):o.length===0?e.jsx(P,{icon:X,title:t("automation.no_automations"),description:t("automation.create_first_description"),actionLabel:t("automation.new_automation"),onAction:()=>a("/automations/new")}):e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(s=>e.jsxs("div",{className:"cursor-pointer rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30",onClick:()=>a(`/automations/${s.id}`),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-xs font-bold text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${s.enabled?"bg-[var(--accent)]":"bg-[var(--text-muted)]"}`})]}),s.description&&e.jsx("p",{className:"mt-1 truncate text-[11px] text-[var(--text-muted)]",children:s.description}),e.jsxs("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:[t("automation.project"),": ",ye(s.projectKeys,s.projectKey)]})]}),e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),v(s)},"aria-pressed":s.enabled,className:`relative h-5 w-9 shrink-0 cursor-pointer rounded-full transition-colors focus:outline-none ${s.enabled?"bg-[var(--accent)]":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform ${s.enabled?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsx(z,{type:s.triggerType}),e.jsx(q,{mode:s.executionMode})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3 text-[10px] text-[var(--text-muted)]",children:[s.lastRunAt&&e.jsx("span",{children:t("automation.last_run",{time:H(s.lastRunAt)})}),s.nextRunAt&&e.jsx("span",{children:t("automation.next_run",{time:oe(s.nextRunAt)})}),!s.lastRunAt&&!s.nextRunAt&&e.jsx("span",{children:t("automation.no_runs_yet")})]})]},s.id))})}const B={status_reports:{titleKey:"automation.template_category_status_reports",descriptionKey:"automation.template_category_status_reports_description",icon:ee,order:0,iconClass:"border-sky-500/30 bg-sky-500/10 text-sky-300"},release_prep:{titleKey:"automation.template_category_release_prep",descriptionKey:"automation.template_category_release_prep_description",icon:R,order:1,iconClass:"border-emerald-500/30 bg-emerald-500/10 text-emerald-300"},incidents_triage:{titleKey:"automation.template_category_incidents_triage",descriptionKey:"automation.template_category_incidents_triage_description",icon:J,order:2,iconClass:"border-rose-500/30 bg-rose-500/10 text-rose-300"},code_quality:{titleKey:"automation.template_category_code_quality",descriptionKey:"automation.template_category_code_quality_description",icon:ge,order:3,iconClass:"border-amber-500/30 bg-amber-500/10 text-amber-300"},repo_maintenance:{titleKey:"automation.template_category_repo_maintenance",descriptionKey:"automation.template_category_repo_maintenance_description",icon:ve,order:4,iconClass:"border-fuchsia-500/30 bg-fuchsia-500/10 text-fuchsia-300"},growth_exploration:{titleKey:"automation.template_category_growth_exploration",descriptionKey:"automation.template_category_growth_exploration_description",icon:F,order:5,iconClass:"border-violet-500/30 bg-violet-500/10 text-violet-300"},other:{titleKey:"automation.template_category_other",descriptionKey:"automation.template_category_other_description",icon:V,order:99,iconClass:"border-[var(--border)] bg-[var(--bg-input)] text-[var(--text-muted)]"}},Ne={standup_summary:0,weekly_engineering_summary:1,weekly_release_notes:2,daily_bug_scan:3},ke=[{label:"claude",value:"claude"},{label:"cursor",value:"cursor"},{label:"codex",value:"codex"}];function S(a){return B[a??""]??B.other}function we(a){const t=S(a.category);return{Icon:t.icon,iconClass:t.iconClass}}function U(a){const t=a.builtinKey!=null?Ne[a.builtinKey]??50:50,o=S(a.category).order,n=a.isBuiltin?0:20,d=a.executionMode==="readonly"?0:2;return t+o*5+n+d}function D({template:a,onUse:t,emphasized:o=!1,sourceLabel:n,actionLabel:d}){const{Icon:b,iconClass:x}=we(a);return e.jsxs("article",{className:`group rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 transition-colors hover:border-[var(--accent)]/30 ${o?"min-h-[220px]":""}`,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-[4px] border ${x}`,children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[10px] text-[var(--text-muted)]",children:n})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-sm font-bold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:`mt-2 text-xs leading-5 text-[var(--text-secondary)] ${o?"line-clamp-4":"line-clamp-3"}`,children:a.description})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[e.jsx(z,{type:a.triggerType}),e.jsx(q,{mode:a.executionMode})]}),e.jsxs("button",{onClick:()=>t(a.id),className:"mt-5 inline-flex items-center gap-1 text-xs font-bold text-[var(--accent)] transition-colors hover:text-[var(--text-primary)]",children:[d,e.jsx(pe,{className:"h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5"})]})]})}function Ce(a){const t=a.trim().split(/\s+/);return t.length===5||t.length===6}function Te({template:a,onClose:t,onCreated:o}){const{t:n}=K(),{createAutomation:d}=M(),[b,x]=l.useState([]),[v,s]=l.useState([]),[f,N]=l.useState(""),[c,u]=l.useState("UTC"),[m,_]=l.useState("claude"),[k,y]=l.useState(!0),[C,T]=l.useState(!1),[r,w]=l.useState(!1),[h,L]=l.useState(!1);if(te(!!a),l.useEffect(()=>{if(!a)return;const i=a.triggerConfig??{},g=a.taskConfig??{};s([]),N(typeof i.cron=="string"?i.cron:""),u(typeof i.timezone=="string"?i.timezone:"UTC"),_(typeof g.agentType=="string"?g.agentType:"claude"),y(!0),T(!1),w(!0);let j=!1;return ae.get("web/projects").json().then(A=>{j||(x(A),A.length===1&&(s([A[0].key]),_(A[0].agentType)))}).catch(()=>{j||p.error(n("automation.failed_load_projects"))}).finally(()=>{j||w(!1)}),()=>{j=!0}},[a,n]),l.useEffect(()=>{if(!a)return;const i=g=>{g.key==="Escape"&&!h&&t()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[a,t,h]),!a)return null;const G=i=>{if(s(i),C)return;const g=b.find(j=>j.key===i[0]);g&&_(g.agentType)},Y=i=>{_(i),T(!0)},W=async()=>{if(v.length===0){p.error(n("automation.project_required"));return}let i=a.triggerConfig??{};if(a.triggerType==="cron"){if(!f.trim()){p.error(n("automation.cron_expression_required"));return}if(!Ce(f)){p.error(n("automation.cron_expression_invalid"));return}i={...i,cron:f.trim(),timezone:c}}else if(a.triggerType==="task_event"){const g=typeof i.filter=="object"&&i.filter!==null&&!Array.isArray(i.filter)?i.filter:{},{projectKey:j,...A}=g;i={...i,filter:{...A,...v.length===1?{projectKey:v[0]}:{}}}}L(!0);try{const g=a.taskConfig??{},j=await d({projectKey:v[0],projectKeys:v,name:a.name,description:a.taskDescription,triggerType:a.triggerType,triggerConfig:i,executionMode:a.executionMode,notifyProjectChats:k,taskConfig:{...g,agentType:m},templateId:a.id});p.success(n("automation.automation_created")),t(),o(j.id)}catch(g){const j=g instanceof Error?g.message:n("automation.failed_create");p.error(j)}finally{L(!1)}};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-y-auto bg-black/70 p-4",onClick:t,children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":a.name,onClick:i=>i.stopPropagation(),className:"mx-auto my-4 max-h-[calc(100vh-2rem)] w-full max-w-5xl overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono shadow-2xl",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-[0.16em] text-[var(--accent)]",children:n("automation.template_preview")}),e.jsx("h2",{className:"mt-2 text-2xl font-semibold text-[var(--text-primary)]",children:a.name}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-[var(--text-secondary)]",children:a.description})]}),e.jsx("button",{type:"button","aria-label":n("common.close"),onClick:t,className:"rounded-[4px] border border-[var(--border)] p-2 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:e.jsx(re,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"px-6 py-6",children:e.jsxs("div",{className:"max-h-[40vh] overflow-y-auto rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] p-5",children:[e.jsx("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:n("automation.template_prompt")}),e.jsx("p",{className:"whitespace-pre-wrap text-lg leading-9 text-[var(--text-primary)]",children:a.taskDescription})]})}),e.jsxs("div",{className:"flex flex-col gap-4 border-t border-[var(--border)] px-6 py-5",children:[e.jsxs("div",{className:"grid gap-3 lg:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_200px]",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:n("automation.project")}),e.jsx(ie,{values:v,onChange:G,options:b.map(i=>({value:i.key,label:`${i.name} (${i.key})`})),placeholder:n(r?"common.loading":"automation.select_project"),className:"w-full"})]}),a.triggerType==="cron"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:n("automation.schedule")}),e.jsx("input",{type:"text",value:f,onChange:i=>N(i.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:n("automation.timezone")}),e.jsx(ne,{value:c,onChange:u,options:[{value:"UTC",label:"UTC"},{value:"Asia/Shanghai",label:"Asia/Shanghai"},{value:"Asia/Singapore",label:"Asia/Singapore"},{value:"America/Los_Angeles",label:"America/Los_Angeles"},{value:"America/New_York",label:"America/New_York"}],placeholder:n("automation.timezone"),className:"w-full"})]})]}):e.jsxs("div",{className:"lg:col-span-2 flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:n("automation.trigger_type")}),e.jsx("div",{className:"flex h-9 items-center rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 text-xs text-[var(--text-primary)]",children:a.triggerType})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:n("automation.agent_type")}),e.jsx("div",{className:"flex gap-2",children:ke.map(i=>e.jsx("button",{type:"button",onClick:()=>Y(i.value),className:`flex-1 rounded-[4px] border px-3 py-2 text-xs transition-colors ${m===i.value?"border-[var(--accent)] bg-[var(--accent)]/5 text-[var(--accent)]":"border-[var(--border)] text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:i.label},i.value))})]}),e.jsxs("div",{children:[e.jsx(O,{checked:k,onCheckedChange:y,label:n("automation.notify_project_chats")}),e.jsx("p",{className:"mt-1 pl-6 text-[10px] text-[var(--text-muted)]",children:n("automation.notify_project_chats_hint")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{type:"button",onClick:t,className:"text-sm text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:n("automation.cancel")}),e.jsx("button",{type:"button",onClick:W,disabled:h,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-sm font-bold text-black transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",children:n(h?"automation.creating":"automation.create_from_template")})]})]})]})})}function Ae(){const a=$(),{t}=K(),{templates:o,loading:n,fetchTemplates:d}=M(),[b,x]=l.useState(null);if(l.useEffect(()=>{d()},[d]),n&&o.length===0)return e.jsx("div",{className:"p-4",children:e.jsx(I,{rows:4})});if(o.length===0)return e.jsx(P,{icon:V,title:t("automation.no_templates"),description:t("automation.templates_description")});const v=o.reduce((c,u)=>{const m=u.category||"other";return c[m]||(c[m]=[]),c[m].push(u),c},{}),s=Object.entries(v).sort(([c],[u])=>S(c).order-S(u).order),f=[...o].sort((c,u)=>U(c)-U(u)).slice(0,Math.min(4,o.length)),N=c=>{const u=o.find(m=>m.id===c)??null;x(u)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 md:p-5",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--accent)]",children:[e.jsx(F,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t("automation.templates_suggested")})]}),e.jsx("h2",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t("automation.templates_suggested_title")}),e.jsx("p",{className:"mt-1 max-w-2xl text-xs leading-5 text-[var(--text-muted)]",children:t("automation.templates_suggested_description")})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:t("automation.templates_ready_count",{count:o.length})})]}),e.jsx("div",{className:"mt-4 grid gap-3 xl:grid-cols-2",children:f.map(c=>e.jsx(D,{template:c,emphasized:!0,onUse:N,sourceLabel:c.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},`suggested-${c.id}`))})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[220px_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"h-fit rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 lg:sticky lg:top-4",children:[e.jsx("p",{className:"text-[11px] font-bold text-[var(--text-primary)]",children:t("automation.templates_browse")}),e.jsx("p",{className:"mt-1 text-[11px] leading-5 text-[var(--text-muted)]",children:t("automation.templates_browse_description")}),e.jsx("div",{className:"mt-3 space-y-1.5",children:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("button",{type:"button","aria-label":t(m.titleKey),onClick:()=>{var y;(y=document.getElementById(k))==null||y.scrollIntoView({behavior:"smooth",block:"start"})},className:"flex w-full items-center justify-between rounded-[4px] border border-transparent bg-[var(--bg-input)] px-3 py-2 text-left transition-colors hover:border-[var(--border)] hover:text-[var(--text-primary)]",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-xs text-[var(--text-secondary)]",children:[e.jsx(_,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:t(m.titleKey)})]}),e.jsx("span",{className:"text-[10px] text-[var(--text-muted)]",children:u.length})]},`nav-${c}`)})})]}),e.jsx("div",{className:"space-y-6",children:s.map(([c,u])=>{const m=S(c),_=m.icon,k=`automation-template-category-${c}`;return e.jsxs("section",{id:k,className:"scroll-mt-4",children:[e.jsxs("div",{className:"mb-3 border-b border-[var(--border)] pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-[var(--text-muted)]",children:[e.jsx(_,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:t(m.titleKey)})]}),e.jsx("h3",{className:"mt-2 text-sm font-bold text-[var(--text-primary)]",children:t(m.titleKey)}),e.jsx("p",{className:"mt-1 text-xs leading-5 text-[var(--text-muted)]",children:t(m.descriptionKey)})]}),e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:u.map(y=>e.jsx(D,{template:y,onUse:N,sourceLabel:y.isBuiltin?t("automation.template_source_builtin"):t("automation.template_source_custom"),actionLabel:t("automation.use_template")},y.id))})]},c)})})]}),e.jsx(Te,{template:b,onClose:()=>x(null),onCreated:c=>a(`/automations/${c}`)})]})}function Ge(){const a=$(),{t}=K(),[o,n]=l.useState("inbox"),d=M(x=>x.inboxUnreadCount);l.useEffect(()=>{M.getState().fetchInboxCount()},[]),Z(l.useMemo(()=>e.jsxs("button",{onClick:()=>a("/automations/new"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),t("automation.new_automation")]}),[a,t]));const b=[{key:"inbox",label:t("automation.tab_inbox"),count:d>0?d:void 0},{key:"automations",label:t("automation.tab_automations")},{key:"templates",label:t("automation.tab_templates")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:t("automation.title")}),e.jsx("div",{className:"mb-4 flex items-center gap-1 overflow-x-auto pb-1 no-scrollbar",children:b.map(x=>e.jsxs("button",{onClick:()=>n(x.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors flex items-center gap-1.5 ${o===x.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:[x.label,x.count!==void 0&&e.jsx("span",{className:"flex h-4 min-w-[16px] items-center justify-center rounded-full bg-[var(--accent)] px-1 text-[10px] font-bold text-black",children:x.count})]},x.key))}),o==="inbox"&&e.jsx(je,{}),o==="automations"&&e.jsx(_e,{}),o==="templates"&&e.jsx(Ae,{})]})}export{Ge as default};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import{c as X,D as S,a as E,v as L,r as n,j as e,X as M,h as C,u as q,y as K,ab as w}from"./index-6n4YMG-q.js";import{S as G}from"./Select-CgGQnjuL.js";import{v as B}from"./password-CHk45-jw.js";import{E as J}from"./EmptyState-P0FzomcO.js";import{T as Q}from"./Skeleton-KIdOfHCh.js";import{u as W}from"./useFetch-CBIWj1ZT.js";import{c as F}from"./status-colors-D1PZs9TB.js";import{P as Y}from"./plus-B3b8vXw9.js";import{U as Z}from"./users-BWDidnLE.js";import{P as ee}from"./pencil-wJOYzbVI.js";import{R as te}from"./rotate-ccw-Wq-FsTE-.js";import"./chevron-down-BMMNE8tj.js";/**
|
|
2
|
-
* @license lucide-react v0.469.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const ae=X("ShieldAlert",[["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"}]]);/**
|
|
7
|
-
* @license lucide-react v0.469.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const re=X("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
|
|
12
|
-
* @license lucide-react v0.469.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const se=X("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]),$=Object.values(S).map(t=>({value:t,label:t}));function ne({isOpen:t,onClose:r,onCreated:o}){const{t:l}=E();L(t);const[s,i]=n.useState(""),[p,b]=n.useState(""),[u,h]=n.useState(""),[m,f]=n.useState(""),[d,v]=n.useState("developer"),[y,a]=n.useState(!1),[j,g]=n.useState("");function D(){i(""),b(""),h(""),f(""),v("developer"),g("")}function N(){D(),r()}async function U(){if(g(""),!s.trim()||!p.trim()||!u.trim()||!m.trim()){g(l("admin.all_fields_required"));return}const x=B(m);if(x){g(l(x));return}try{a(!0),await C.post("admin/developers",{json:{name:s.trim(),gitName:p.trim(),gitEmail:u.trim(),password:m,role:d}}).json(),N(),o()}catch(R){const A=R instanceof Error?R.message:l("admin.failed_to_create_developer");g(A)}finally{a(!1)}}return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",l("admin.create_developer_title")]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:N,children:e.jsx(M,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[j&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:j}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:l("admin.username")}),e.jsx("input",{type:"text",placeholder:"e.g. jdoe",value:s,onChange:x=>i(x.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:l("profile.git_name")}),e.jsx("input",{type:"text",placeholder:"e.g. John Doe",value:p,onChange:x=>b(x.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:l("profile.git_email")}),e.jsx("input",{type:"email",placeholder:"e.g. john@example.com",value:u,onChange:x=>h(x.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:l("auth.password")}),e.jsx("input",{type:"password",placeholder:"10-20 chars, letters + digits + special",value:m,onChange:x=>f(x.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-[11px] text-[var(--text-muted)]",children:l("admin.password_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:l("common.role")}),e.jsx(G,{value:d,onChange:v,options:$})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:N,children:l("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:y,onClick:U,children:l(y?"common.creating":"common.create")})]})]})]}):null}function oe({isOpen:t,developer:r,onClose:o,onUpdated:l}){var z,P;const{t:s}=E();L(t);const i=q(c=>c.user),[p,b]=n.useState(r.name),[u,h]=n.useState(r.gitName),[m,f]=n.useState(r.gitEmail),[d,v]=n.useState(r.role),[y,a]=n.useState(((z=r.platformUids)==null?void 0:z.lark)??""),[j,g]=n.useState(((P=r.platformUids)==null?void 0:P.slack)??""),[D,N]=n.useState(!1),[U,x]=n.useState(""),A=r.id===(i==null?void 0:i.id)&&r.role===S.ADMIN&&d!==S.ADMIN;n.useEffect(()=>{var c,k;b(r.name),h(r.gitName),f(r.gitEmail),v(r.role),a(((c=r.platformUids)==null?void 0:c.lark)??""),g(((k=r.platformUids)==null?void 0:k.slack)??""),x("")},[r]);async function O(){var c,k;if(x(""),!p.trim()||!u.trim()||!m.trim()){x(s("admin.all_fields_required"));return}A&&x(s("admin.demote_self_warning"));try{N(!0);const _={name:p.trim(),gitName:u.trim(),gitEmail:m.trim(),role:d},T=((c=r.platformUids)==null?void 0:c.lark)??"",H=((k=r.platformUids)==null?void 0:k.slack)??"";if(y.trim()!==T||j.trim()!==H){const I={};I.lark=y.trim(),I.slack=j.trim(),_.platformUids=I}await C.put(`admin/developers/${r.id}`,{json:_}).json(),o(),l()}catch(_){const T=_ instanceof Error?_.message:s("admin.failed_to_update_developer");x(T)}finally{N(!1)}}return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{className:"relative z-10 mx-2 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",s("admin.edit_developer_title")]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:o,children:e.jsx(M,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[U&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:U}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.username")}),e.jsx("input",{type:"text",value:p,onChange:c=>b(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("profile.git_name")}),e.jsx("input",{type:"text",value:u,onChange:c=>h(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("profile.git_email")}),e.jsx("input",{type:"email",value:m,onChange:c=>f(c.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("common.role")}),e.jsx(G,{value:d,onChange:v,options:$}),A&&e.jsx("div",{className:"mt-2 rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2 text-xs text-[var(--warning)]",children:s("admin.demote_self_inline_warning")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("admin.platform_accounts")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-muted)]",children:s("admin.lark_uid")}),e.jsx("input",{type:"text",value:y,onChange:c=>a(c.target.value),placeholder:"ou_xxxxxxxxxx",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-xs text-[var(--text-muted)]",children:s("admin.slack_uid")}),e.jsx("input",{type:"text",value:j,onChange:c=>g(c.target.value),placeholder:"U0XXXXXXXXX",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:o,children:s("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:D,onClick:O,children:s(D?"common.saving":"common.save_changes")})]})]})]}):null}function le({isOpen:t,developer:r,onClose:o,onConfirmed:l}){const{t:s}=E();L(t);const[i,p]=n.useState(!1),[b,u]=n.useState(""),h=n.useRef(null);n.useEffect(()=>{var d;t&&((d=h.current)==null||d.focus())},[t]);const m=n.useCallback(d=>{d.key==="Escape"&&!i&&o()},[o,i]);async function f(){u("");try{p(!0),await C.put(`admin/developers/${r.id}/reset-totp`),o(),l()}catch(d){const v=d instanceof Error?d.message:s("admin.failed_to_reset_2fa");u(v)}finally{p(!1)}}return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]"}),e.jsxs("div",{ref:h,className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",onKeyDown:m,tabIndex:-1,children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ae,{className:"h-4 w-4 text-yellow-400"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",s("admin.reset_2fa")]})]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:o,children:e.jsx(M,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-3 px-5 py-5",children:[b&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:b}),e.jsxs("p",{className:"text-xs text-[var(--text-primary)]",children:[s("admin.reset_2fa_confirm_message")," ",e.jsx("span",{className:"text-[var(--accent)]",children:r.name}),"?"]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("admin.reset_2fa_audit_note")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:o,children:s("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-yellow-600 px-3 py-1.5 text-xs text-white hover:opacity-90 transition-opacity disabled:opacity-50",disabled:i,onClick:f,children:s(i?"admin.resetting":"admin.reset_2fa")})]})]})]}):null}function V({dev:t,currentUserId:r,onEdit:o,onReset2fa:l,onToggleStatus:s}){const{t:i}=E();return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:i("common.edit"),onClick:()=>o(t),children:e.jsx(ee,{className:"h-3.5 w-3.5"})}),t.id!==r&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-2.5 md:p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:i("admin.reset_2fa"),onClick:()=>l(t),children:e.jsx(te,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:`rounded-[4px] p-2.5 md:p-1.5 transition-colors hover:bg-white/[0.05] ${t.status===w.ACTIVE?"text-red-400 hover:text-red-300":"text-green-400 hover:text-green-300"}`,title:t.status===w.ACTIVE?i("admin.deactivate"):i("admin.activate"),onClick:()=>s(t),children:t.status===w.ACTIVE?e.jsx(se,{className:"h-3.5 w-3.5"}):e.jsx(re,{className:"h-3.5 w-3.5"})})]})]})}function je(){const{t}=E(),r=q(a=>a.user),[o,l]=n.useState(""),[s,i]=n.useState(!1),[p,b]=n.useState(null),[u,h]=n.useState(null),{data:m,loading:f,refetch:d}=W(()=>{const a={};return o&&(a.q=o),C.get("admin/developers",{searchParams:a}).json()},[o]);async function v(a){const j=a.status===w.ACTIVE?w.DISABLED:w.ACTIVE;try{await C.put(`admin/developers/${a.id}`,{json:{status:j}}),d()}catch{}}function y(a){switch(a){case S.ADMIN:return"text-yellow-400";case S.DEVELOPER:return"text-blue-400";default:return"text-[var(--text-secondary)]"}}return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("admin.developers_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t("admin.developers_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>i(!0),children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),t("admin.create_developer")]})]}),e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"relative w-full max-w-xs",children:[e.jsx(K,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:t("admin.search_developers"),value:o,onChange:a=>l(a.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})}),f?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(Q,{rows:4})}):!m||m.length===0?e.jsx(J,{icon:Z,title:t(o?"admin.no_matching_developers":"admin.no_developers_found"),description:t(o?"admin.try_adjusting_search":"admin.create_first_developer"),actionLabel:o?void 0:t("admin.create_developer"),onAction:o?void 0:()=>i(!0)}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.username")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("profile.git_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.role")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.totp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("common.created_at")}),e.jsx("th",{className:"pb-2 font-normal",children:t("common.actions")})]})}),e.jsx("tbody",{children:m.map(a=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:a.name}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:a.gitName}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:y(a.role),children:a.role})}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:F(a.status),children:a.status})}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:a.totpEnabled?"text-green-400":"text-[var(--text-muted)]",children:a.totpEnabled?t("common.enabled"):t("common.disabled")})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(a.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5",children:e.jsx(V,{dev:a,currentUserId:r==null?void 0:r.id,onEdit:b,onReset2fa:h,onToggleStatus:v})})]},a.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3",children:m.map(a=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)] font-medium",children:a.name}),e.jsx(V,{dev:a,currentUserId:r==null?void 0:r.id,onEdit:b,onReset2fa:h,onToggleStatus:v})]}),e.jsx("div",{className:"text-[11px] text-[var(--text-secondary)] mb-1",children:a.gitName}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px]",children:[e.jsx("span",{className:y(a.role),children:a.role}),e.jsx("span",{className:F(a.status),children:a.status}),e.jsx("span",{className:a.totpEnabled?"text-green-400":"text-[var(--text-muted)]",children:a.totpEnabled?t("common.enabled"):t("common.disabled")})]})]},a.id))})]}),e.jsx(ne,{isOpen:s,onClose:()=>i(!1),onCreated:d}),p&&e.jsx(oe,{isOpen:!!p,developer:p,onClose:()=>b(null),onUpdated:d}),u&&e.jsx(le,{isOpen:!!u,developer:u,onClose:()=>h(null),onConfirmed:d})]})}export{je as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as z,a as K,i as H,k as D,r as $,j as e,L as p,l as I,m as B,W as w,h}from"./index-6n4YMG-q.js";import{T as R}from"./TaskStatusBadge-D9epJQNe.js";import{T as g}from"./Skeleton-KIdOfHCh.js";import{O as G}from"./OnboardingGuide-B0V0r8s3.js";import{f as _}from"./date-CmcdoD87.js";import{g as V}from"./status-colors-D1PZs9TB.js";import{u as b}from"./useFetch-CBIWj1ZT.js";import{T as q}from"./Tooltip-D1qzP0lG.js";import{A as v}from"./arrow-right-lhj-X9Ah.js";import"./chevron-right-DUJ8mQK2.js";const Y=3e5,J=[{type:"fraction",numerator:"active_tasks",denominator:"queued_tasks",labelKey:"dashboard.tasks_active_queued"},{type:"simple",key:"online_workers",labelKey:"dashboard.online_workers"},{type:"simple",key:"completed_today",labelKey:"dashboard.completed_all_today"},{type:"simple",key:"completed_by_user_today",labelKey:"dashboard.completed_by_you_today"}],Q=["sun","mon","tue","wed","thu","fri","sat"];function U(){const n=new Date;return Array.from({length:7},(a,i)=>{const r=new Date(n);r.setDate(r.getDate()-(6-i));const c=String(r.getMonth()+1).padStart(2,"0"),l=String(r.getDate()).padStart(2,"0");return{label:Q[r.getDay()],date:`${c}/${l}`}})}function X({dailyRates:n,dailyCounts:a,overallRate:i}){const{t:r}=K(),c=U(),l=a.reduce((t,o)=>t+o,0),u=Math.max(...a,1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsx("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:l}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("dashboard.last_7_days")}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"·"}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:[r("dashboard.success_rate"),": ",i,"%"]})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:c.map(({label:t,date:o},j)=>{const x=a[j]??0,m=n[j]??0,f=r(x===1?"dashboard.task_total":"dashboard.tasks_total"),N=u>0?Math.max(x/u*100,4):4;return e.jsxs(q,{content:`${t} ${o} — ${x} ${f} (${m}%)`,className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px] cursor-default",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${N}%`,backgroundColor:m>=80?"var(--accent)":m>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:t})]},t)})})]})}function oe(){const n=z(),{t:a}=K(),i=H(),r=D(s=>s.taskSeq),c=D(s=>s.workerSeq),[l,u]=$.useState(0),{data:t,loading:o}=b(()=>h.get("web/dashboard/stats",{searchParams:{tz:String(new Date().getTimezoneOffset())}}).json(),[l,r,c]),{data:j,loading:x}=b(()=>h.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json(),[l,r]),{data:m,loading:f}=b(()=>h.get("web/workers").json(),[l,c]),{data:N,loading:E}=b(()=>h.get("web/projects").json(),[l]),{data:O,loading:M}=b(()=>h.get("web/dashboard/recent-activity").json(),[]);$.useEffect(()=>{const s=setInterval(()=>{u(d=>d+1)},Y);return()=>clearInterval(s)},[]);const S=(t==null?void 0:t.success_rate_daily)??null,T=(t==null?void 0:t.task_count_daily)??[],W=(t==null?void 0:t.task_success_rate_7d)??0,L=j??[],y=m??[],C=N??[],A=O??[];function F(s){switch(s){case w.ONLINE:return a("dashboard.online");case w.DRAINING:return a("dashboard.idle");case w.OFFLINE:default:return a("dashboard.offline")}}function P(s){return a(s===1?"dashboard.task_total":"dashboard.tasks_total")}return e.jsxs("div",{className:"mx-auto max-w-6xl overflow-hidden px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:J.map(s=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[11px] md:text-xs text-[var(--text-muted)]",children:[a(s.labelKey),":"]}),o?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded-[4px] bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:s.type==="fraction"?e.jsxs("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:[(t==null?void 0:t[s.numerator])??0,e.jsx("span",{className:"text-base md:text-lg font-normal text-[var(--text-muted)]",children:"/"}),(t==null?void 0:t[s.denominator])??0]}):e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(t==null?void 0:t[s.key])??0})})]},s.labelKey))}),e.jsx(G,{data:{activeTasks:((t==null?void 0:t.active_tasks)??0)+((t==null?void 0:t.queued_tasks)??0),totalWorkers:y.length,totalProjects:(t==null?void 0:t.project_count)??0,totalDevelopers:(t==null?void 0:t.developer_count)??0}}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.task_count")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:o?e.jsx("div",{className:"h-24 animate-pulse rounded-[4px] bg-[var(--bg-input)]"}):S?e.jsx(X,{dailyRates:S,dailyCounts:T,overallRate:W}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsx("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:T.reduce((s,d)=>s+d,0)}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_tasks")}),e.jsxs(p,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(v,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:a("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:px-5 md:pb-4 md:pt-0",children:x?e.jsx(g,{rows:4}):L.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:L.map(s=>e.jsxs("div",{onClick:()=>n(`/tasks/${s.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[11px] text-[var(--text-primary)] leading-tight line-clamp-2 preserve-case",title:B(s),children:["#",s.id," ",I(s)]}),e.jsx("span",{className:"shrink-0",children:e.jsx(R,{status:s.status})})]}),e.jsx("span",{className:"text-[11px] text-[var(--text-muted)] mt-1 block",children:_(s.createdAt)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",s.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate preserve-case",children:e.jsx(q,{content:s.description,children:I(s,40)})}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(R,{status:s.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:_(s.createdAt)})]},s.id))})})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.workers")}),e.jsxs(p,{to:"/workers",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(v,{className:"h-3 w-3"})]})]}),e.jsxs("div",{className:"flex md:hidden items-center justify-between border-b border-[var(--border)] px-3 py-3",children:[e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:a("dashboard.workers")}),e.jsxs(p,{to:"/workers",className:"flex items-center gap-1 text-[11px] text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(v,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:f?e.jsx(g,{rows:3}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:y.map(s=>e.jsxs("div",{onClick:()=>n(`/workers/${s.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"min-w-0 flex-1 flex flex-col gap-0.5",children:[e.jsx("span",{className:"truncate text-xs text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"truncate text-xs text-[var(--text-muted)]",children:s.host??"--"})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[s.activeSlots,"/",s.maxSlots," ",a("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:V(s.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),F(s.status)]})]})]},s.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-3 py-3",children:[e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:a("dashboard.projects")}),e.jsxs(p,{to:"/projects",className:"flex items-center gap-1 text-[11px] text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(v,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-3",children:E?e.jsx(g,{rows:3}):C.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("projects.no_projects_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2",children:C.map(s=>{const d=s.taskCount??0;return e.jsxs("div",{onClick:()=>n(`/projects/${s.key}`),className:"cursor-pointer rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-[var(--accent)]",children:s.key}),e.jsxs("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:[d," ",P(d)]})]}),e.jsx("span",{className:"mt-1 block text-[11px] text-[var(--text-primary)]",children:s.name}),e.jsx("span",{className:"mt-0.5 block text-[11px] text-[var(--text-muted)]",children:s.agentType})]},s.key)})})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("dashboard.recent_activity")}),i&&e.jsxs(p,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(v,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-3 md:p-4",children:M?e.jsx(g,{rows:4}):A.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:A.map(s=>{const d=s.message.match(/task\s*#?(\d+)/i),k=d?d[1]:null;return e.jsxs("div",{className:`flex min-w-0 flex-col gap-1 rounded-[4px] border-b border-[var(--border-row)] px-2 py-2 transition-colors last:border-b-0 md:flex-row md:items-start md:gap-3 md:rounded-none md:px-0 ${k?"cursor-pointer hover:bg-[var(--bg-input)]":""}`,onClick:()=>k&&n(`/tasks/${k}`),children:[e.jsx("span",{className:"shrink-0 whitespace-nowrap text-[11px] text-[var(--text-muted)] md:text-xs",children:_(s.timestamp)}),e.jsx("span",{className:"min-w-0 break-words text-[11px] leading-relaxed text-[var(--text-secondary)] md:truncate md:text-xs md:leading-normal",children:s.message})]},s.id)})})})]})]})]})}export{oe as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as xe,B as me,f as ue,a as H,k as pe,r as n,h as L,j as e,L as ve,V as W,Y as be,t as f,o as v,b as ge,Q as he,X as fe}from"./index-6n4YMG-q.js";import{P as je}from"./PtyTerminal-kO8wCuuU.js";import{T as Ne}from"./Skeleton-KIdOfHCh.js";import{C as K}from"./Checkbox-D1hAKR9E.js";import{f as we,b as ye}from"./date-CmcdoD87.js";import{a as ke}from"./agent-type-options-CvfN3Xkt.js";import{T as G,g as Q}from"./task-constants-CCKesKBc.js";import{A as Se}from"./arrow-left-CsRQX7H5.js";import{L as Ce}from"./loader-circle-BsR1MJQw.js";import{P as z}from"./play-sxSJsoXu.js";import{S as Te}from"./skip-forward-gDc2Yb8q.js";import{R as Ae}from"./rotate-ccw-Wq-FsTE-.js";import{C as Ee}from"./chevron-up-tdj0sbLv.js";import{C as Re}from"./chevron-down-BMMNE8tj.js";import{C as De}from"./circle-alert-CMpAAr9i.js";/**
|
|
2
|
-
* @license lucide-react v0.469.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ie=xe("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]),X={critical:0,warning:1,suggestion:2};function Le(s){switch(s){case"critical":return{text:"text-[var(--destructive)]",bg:"rgba(239,68,68,0.12)",border:"rgba(239,68,68,0.27)"};case"warning":return{text:"text-[var(--warning)]",bg:"rgba(245,158,11,0.12)",border:"rgba(245,158,11,0.27)"};default:return{text:"text-[var(--info)]",bg:"rgba(59,130,246,0.10)",border:"rgba(59,130,246,0.27)"}}}function _e({severity:s}){return s==="critical"?e.jsx(De,{className:"h-3.5 w-3.5 text-[var(--destructive)]"}):s==="warning"?e.jsx(W,{className:"h-3.5 w-3.5 text-[var(--warning)]"}):e.jsx(Ie,{className:"h-3.5 w-3.5 text-[var(--info)]"})}function $e(s){switch(s){case v.RUNNING:return"bg-[var(--accent)]";case v.QUEUED:case v.ASSIGNED:case v.SUSPENDED:return"bg-[var(--warning)]";case v.COMPLETED:return"bg-[var(--accent)]";case v.FAILED:return"bg-[var(--destructive)]";default:return"bg-[#525252]"}}function Z(s){return s===v.RUNNING||s===v.QUEUED||s===v.ASSIGNED}function O(s){return s===v.SUSPENDED}const Pe=ke(Q);function Fe({task:s,expanded:l,onToggleExpand:r}){const b=Q(s.agentType),d=$e(s.status),o=ye(s.startedAt,s.completedAt??void 0),j=Z(s.status),g=G.includes(s.status),w=n.useRef(null);return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex cursor-pointer items-center gap-3 px-4 py-3 hover:bg-[var(--bg-input)] transition-colors",onClick:r,children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${d} ${j?"animate-pulse":""}`}),e.jsx("span",{className:"flex-1 text-xs font-medium text-[var(--text-primary)]",children:b}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[j?`${s.status.toLowerCase()}...`:s.status.toLowerCase(),o&&` · ${o}`]}),e.jsxs("a",{href:`/tasks/${s.id}`,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"rounded-[4px] border border-[var(--border)] px-2 py-1 text-[11px] text-[var(--text-muted)] hover:text-[var(--accent)] hover:border-[var(--accent)] transition-colors flex items-center gap-1",children:[e.jsx(ge,{className:"h-3 w-3"}),"↗"]}),l?e.jsx(Ee,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"}):e.jsx(Re,{className:"h-3.5 w-3.5 text-[var(--text-muted)]"})]}),l&&e.jsx("div",{className:"border-t border-[var(--border)]",style:{height:"300px"},children:e.jsx(je,{ref:w,taskId:s.id,sessionId:s.currentSessionId??void 0,taskFinished:g})})]})}function Ue({issue:s}){const l=Le(s.severity);return e.jsxs("div",{className:`rounded-[4px] p-3 text-xs ${s.isDuplicate?"opacity-60":""}`,style:{backgroundColor:l.bg,border:`1px solid ${l.border}`},children:[e.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[e.jsx(_e,{severity:s.severity}),e.jsx("span",{className:`font-bold ${l.text}`,children:s.severity}),s.agentType&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:s.agentType}),e.jsxs("span",{className:"text-[var(--text-muted)]",children:[s.file,s.line!=null?`:${s.line}`:""]}),s.isDuplicate&&e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-1.5 py-0.5 text-[10px] text-[var(--text-muted)]",children:"duplicate"})]}),e.jsx("p",{className:"mb-1 text-[var(--text-secondary)]",children:s.description}),s.suggestion&&e.jsxs("p",{className:"text-[var(--text-muted)]",children:[e.jsx("span",{className:"font-medium",children:"suggestion:"})," ",s.suggestion]})]})}function Me({sourceTaskId:s,defaultReviewers:l,onClose:r,onLaunched:b}){const{t:d}=H(),o=l.length>0?l:[he.CLAUDE],j=l.length>0,[g,w]=n.useState(o),[y,_]=n.useState(""),[N,$]=n.useState(!1),[C,T]=n.useState(!1);function R(i){w(p=>p.includes(i)?p.filter(P=>P!==i):[...p,i])}async function D(){if(g.length===0){f.error("select at least one review agent.");return}T(!0);try{await L.post(`web/tasks/${s}/review`,{json:{agentTypes:g,description:y.trim()||void 0,skipFix:N||void 0}}),f.success("review launched"),b(),r()}catch(i){const p=i instanceof Error?i.message:String(i);f.error(p)}finally{T(!1)}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:d("review.review_again")}),e.jsx("button",{onClick:r,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(fe,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("p",{className:"text-[11px] text-[var(--text-muted)]",children:d("review.select_agents")}),j&&e.jsx("span",{className:"rounded-[4px] border border-amber-500/40 bg-amber-500/10 px-1.5 py-0.5 text-[10px] text-amber-500",children:"using project defaults"})]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:Pe.map(i=>e.jsx(K,{checked:g.includes(i.value),onCheckedChange:()=>R(i.value),label:i.label,containerClassName:"w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors"},i.value))}),e.jsx("textarea",{value:y,onChange:i=>_(i.target.value),placeholder:d("review.description_placeholder"),rows:3,className:"mb-3 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsx(K,{checked:N,onCheckedChange:$,label:d("review.skip_fix_label"),containerClassName:"mb-4 w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors",labelClassName:"text-[var(--text-muted)]"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:D,disabled:C||g.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(z,{className:"h-3 w-3"}),d(C?"common.processing":"review.launch")]}),e.jsx("button",{onClick:r,className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:d("common.cancel")})]})]})})}function tt(){var B;const{sourceTaskId:s}=me(),l=ue(),{t:r}=H(),b=Number(s),d=pe(t=>t.eventSeq),[o,j]=n.useState(null),[g,w]=n.useState(!0),[y,_]=n.useState(new Set),[N,$]=n.useState(""),[C,T]=n.useState(!1),[R,D]=n.useState(!1),[i,p]=n.useState(!1),[P,V]=n.useState(null),k=n.useCallback(async()=>{try{const t=await L.get(`web/tasks/${b}/reviews`).json();j(t),t.rounds&&t.rounds.length>0&&V(a=>a??t.rounds[t.rounds.length-1].round)}catch{j(null)}finally{w(!1)}},[b]);n.useEffect(()=>{w(!0),k()},[k]),n.useEffect(()=>{d>0&&k()},[d,k]);const ee=n.useCallback(t=>{_(a=>{const x=new Set(a);return x.has(t)?x.delete(t):x.add(t),x})},[]),S=(o==null?void 0:o.rounds)??[],F=S.length>0?S[S.length-1].round:null,h=P??F,U=S.find(t=>t.round===h),c=(U==null?void 0:U.reviewTasks)??(o==null?void 0:o.reviewTasks)??[];c.some(t=>Z(t.status));const I=c.some(t=>O(t.status)),M=c.length>0&&c.every(t=>G.includes(t.status)),te=c.some(t=>t.report!=null),se=c.length>0&&c.every(t=>t.report!=null),q=h===F,re=I||M,A=n.useMemo(()=>{var x;const t=[];for(const u of c)if((x=u.report)!=null&&x.issues)for(const E of u.report.issues)t.push({...E,agentType:u.agentType??"claude"});t.sort((u,E)=>(X[u.severity]??9)-(X[E.severity]??9));const a=new Set;return t.map(u=>{const E=u.description.slice(0,20),J=`${u.file}:${u.line??""}:${E}`;return a.has(J)?{...u,isDuplicate:!0}:(a.add(J),u)})},[c]),ae=A.filter(t=>t.severity==="critical").length,ne=A.filter(t=>t.severity==="warning").length,oe=A.filter(t=>t.severity==="suggestion").length,Y=c.filter(t=>O(t.status)),ie=n.useMemo(()=>[{value:"",label:"select agent..."},...Y.map(t=>({value:String(t.id),label:Q(t.agentType)}))],[Y]);async function ce(){if(!N){f.error("select a review agent to perform the fix.");return}T(!0);try{await L.post(`web/tasks/${b}/approve-fix`,{json:{reviewTaskId:Number(N)}}),f.success("fix started"),k()}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{T(!1)}}async function le(){D(!0);try{await L.post(`web/tasks/${b}/skip-fix`,{json:h!=null?{round:h}:{}}),f.success("review completed — no fix needed"),l("/review")}catch(t){const a=t instanceof Error?t.message:String(t);f.error(a)}finally{D(!1)}}const de=n.useMemo(()=>{var a;const t=(a=o==null?void 0:o.sourceTask)==null?void 0:a.configSnapshot;if(!t)return[];try{const x=JSON.parse(t);return Array.isArray(x.defaultReviewers)?x.defaultReviewers:[]}catch{return[]}},[(B=o==null?void 0:o.sourceTask)==null?void 0:B.configSnapshot]);if(g)return e.jsx("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:e.jsx(Ne,{rows:5})});if(!o)return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:"// reviews not found"}),e.jsx("button",{onClick:()=>l("/review"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:"< back to review"})]});const{sourceTask:m}=o;return e.jsxs("div",{className:"mx-auto max-w-4xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("div",{className:"mb-4 flex items-center gap-2",children:e.jsxs("button",{onClick:()=>l("/review"),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(Se,{className:"h-3.5 w-3.5"}),r("common.back")]})}),e.jsx("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex flex-1 flex-col gap-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:"source task"}),e.jsxs(ve,{to:`/tasks/${m.id}`,className:"text-xs text-[var(--info)] hover:underline",children:["#",m.id]}),e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:m.projectKey})]}),e.jsx("span",{className:"truncate text-sm text-[var(--text-primary)]",children:m.description}),(m.branch||m.sourceCommitSha)&&e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:["reviewing branch"," ",m.branch&&e.jsx("span",{className:"text-[var(--text-secondary)]",children:m.branch}),m.sourceCommitSha&&e.jsxs(e.Fragment,{children:[" ","at commit"," ",e.jsx("span",{className:"font-mono text-[var(--accent)]",children:m.sourceCommitSha.slice(0,7)})]})]})]}),e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:we(m.createdAt)})]})}),S.length>1&&e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:"round:"}),e.jsx("div",{className:"flex gap-1",children:S.map(t=>e.jsxs("button",{onClick:()=>V(t.round),className:`rounded-[4px] border px-3 py-1 text-xs transition-colors ${h===t.round?"border-[var(--accent)] bg-[var(--accent)] text-black font-bold":"border-[var(--border)] text-[var(--text-muted)] hover:text-[var(--text-primary)]"}`,children:["#",t.round]},t.round))}),h!==F&&e.jsx("span",{className:"text-[11px] text-[var(--text-muted)]",children:"// historical"})]}),c.length>0&&e.jsxs("div",{className:"mb-5",children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-bold text-[var(--text-muted)]",children:[r("review.round"),h?` #${h}`:""]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[c.filter(t=>G.includes(t.status)||O(t.status)).length," / ",c.length," done"]})]}),e.jsx("div",{className:"flex flex-col gap-2",children:c.map(t=>e.jsx(Fe,{task:t,expanded:y.has(t.id),onToggleExpand:()=>ee(t.id)},t.id))})]}),re&&te&&(c.filter(a=>a.report!=null).every(a=>!a.report.summary&&a.report.issues.length===0)?e.jsx("div",{className:"mb-5 rounded-[4px] border border-amber-500/40 bg-amber-500/10 p-4",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(W,{className:"h-4 w-4 shrink-0 text-amber-500 mt-0.5"}),e.jsx("p",{className:"text-xs text-amber-500",children:r("review.empty_report_warning")})]})}):e.jsxs("div",{className:"mb-5 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("div",{className:"mb-3 flex items-center gap-3",children:e.jsxs("span",{className:"text-xs font-bold text-[var(--accent)]",children:[r("review.round")," — ",r("review.issues_summary",{critical:String(ae),warning:String(ne),suggestion:String(oe)})]})}),A.length>0?e.jsx("div",{className:"flex flex-col gap-2",children:A.map((a,x)=>e.jsx(Ue,{issue:a},x))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:"// no issues reported"})]})),q&&se&&!I&&!M&&e.jsxs("div",{className:"mb-4 flex items-center gap-2 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx(Ce,{className:"h-3.5 w-3.5 animate-spin text-[var(--text-muted)]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("review.waiting_agents")})]}),q&&(I||M)&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("span",{className:"mb-3 block text-xs font-bold text-[var(--text-muted)]",children:"actions"}),e.jsxs("div",{className:"flex flex-col gap-3",children:[I&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center",children:[e.jsx("select",{value:N,onChange:t=>$(t.target.value),className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)] md:w-48",children:ie.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsxs("button",{onClick:ce,disabled:C||!N,className:"flex items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(z,{className:"h-3 w-3"}),r(C?"common.processing":"review.approve_fix")]}),e.jsxs("button",{onClick:le,disabled:R,className:"flex items-center justify-center gap-1.5 rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-input)] transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(Te,{className:"h-3 w-3"}),r(R?"common.processing":"review.skip_fix")]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-[var(--text-muted)]",children:[e.jsx(be,{className:"h-3 w-3 shrink-0"}),r("review.fix_push_info")]})]}),e.jsxs("button",{onClick:()=>p(!0),className:"flex items-center gap-1.5 text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),r("review.review_again")]})]})]}),c.length===0&&e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("review.no_reviews")}),e.jsxs("button",{onClick:()=>p(!0),className:"mt-3 flex items-center gap-1.5 mx-auto rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black",children:[e.jsx(z,{className:"h-3 w-3"}),r("review.launch")]})]}),i&&e.jsx(Me,{sourceTaskId:b,defaultReviewers:de,onClose:()=>p(!1),onLaunched:()=>{p(!1),k()}})]})}export{tt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as w,f as k,k as K,r,x as F,j as e,h as N,o as m,E,l as B,X as T,H,t as y,Q}from"./index-6n4YMG-q.js";import{E as D}from"./EmptyState-P0FzomcO.js";import{T as L}from"./Skeleton-KIdOfHCh.js";import{C as q}from"./Checkbox-D1hAKR9E.js";import{S as C}from"./Select-CgGQnjuL.js";import{f as P}from"./date-CmcdoD87.js";import{T as A}from"./Tooltip-D1qzP0lG.js";import{a as z}from"./agent-type-options-CvfN3Xkt.js";import{g as X}from"./task-constants-CCKesKBc.js";import{P as Z}from"./plus-B3b8vXw9.js";import{P as R}from"./play-sxSJsoXu.js";import{C as J}from"./chevron-left-C5QPcYfE.js";import{C as V}from"./chevron-right-DUJ8mQK2.js";import"./chevron-down-BMMNE8tj.js";function $(){const[s,i]=r.useState(void 0),[t,o]=r.useState(void 0),[p,c]=r.useState([]),h=r.useRef(void 0),u=r.useRef(void 0);h.current=s,u.current=t;const g=r.useCallback(x=>{i(x)},[]),l=r.useCallback(()=>{const x=h.current;x&&(c(j=>[...j,u.current??""]),o(x))},[]),b=r.useRef([]);b.current=p;const d=r.useCallback(()=>{const x=b.current;x.length!==0&&(o(x.at(-1)||void 0),c(x.slice(0,-1)))},[]),a=p.length+1,n=p.length>0;return{cursor:t,setNextCursor:g,goNext:l,goPrev:d,pageNumber:a,hasPrev:n,hasNext:!!s}}const I=20;function W(s){switch(s){case m.RUNNING:return"bg-[var(--accent)]";case m.QUEUED:return"bg-[var(--warning)]";case m.ASSIGNED:return"bg-[var(--info)]";case m.SUSPENDED:return"bg-[var(--warning)]";case m.COMPLETED:return"bg-[var(--accent)]";case m.FAILED:return"bg-[var(--destructive)]";case m.CANCELLED:return"bg-[#525252]";default:return"bg-[#525252]"}}const Y=z(X);function ee({taskId:s,onClose:i,onLaunched:t}){const{t:o}=w(),[p,c]=r.useState([Q.CLAUDE]),[h,u]=r.useState(""),[g,l]=r.useState(!1);function b(a){c(n=>n.includes(a)?n.filter(f=>f!==a):[...n,a])}async function d(){if(p.length===0){y.error("select at least one review agent.");return}l(!0);try{await N.post(`web/tasks/${s}/review`,{json:{agentTypes:p,description:h.trim()||void 0}}),y.success("review launched"),t(),i()}catch(a){const n=a instanceof Error?a.message:String(a);y.error(n)}finally{l(!1)}}return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",children:e.jsxs("div",{className:"w-full max-w-sm rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 font-mono",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-bold text-[var(--text-primary)]",children:o("review.launch")}),e.jsx("button",{onClick:i,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:e.jsx(T,{className:"h-4 w-4"})})]}),e.jsxs("p",{className:"mb-3 text-[11px] text-[var(--text-muted)]",children:["task #",s," — ",o("review.select_agents")]}),e.jsx("div",{className:"mb-4 flex flex-col gap-2",children:Y.map(a=>e.jsx(q,{checked:p.includes(a.value),onCheckedChange:()=>b(a.value),label:a.label,containerClassName:"w-full gap-2.5 rounded-[4px] border border-[var(--border)] px-3 py-2 hover:bg-[var(--bg-input)] transition-colors"},a.value))}),e.jsx("textarea",{value:h,onChange:a=>u(a.target.value),placeholder:o("review.description_placeholder"),rows:3,className:"mb-4 w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] outline-none focus:border-[var(--accent)] resize-none"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:d,disabled:g||p.length===0,className:"flex flex-1 items-center justify-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-bold text-black disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(R,{className:"h-3 w-3"}),o(g?"common.processing":"review.launch")]}),e.jsx("button",{onClick:i,className:"rounded-[4px] border border-[var(--border)] px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:o("common.cancel")})]})]})})}function _({pag:s}){const{t:i}=w();return!s.hasPrev&&!s.hasNext?null:e.jsxs("div",{className:"mt-6 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// page ",s.pageNumber]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{onClick:s.goPrev,disabled:!s.hasPrev,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[e.jsx(J,{className:"h-3.5 w-3.5"}),i("tasks.prev")]}),e.jsxs("button",{onClick:s.goNext,disabled:!s.hasNext,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:[i("common.next"),e.jsx(V,{className:"h-3.5 w-3.5"})]})]})]})}function se({onRefresh:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),[l,b]=r.useState(null),d=$(),a=r.useCallback(async n=>{g(!0);try{const f=new Date(Date.now()-6048e5).toISOString(),x=new URLSearchParams({status:m.COMPLETED,taskMode:"develop",reviewStatus:"null",completedAfter:f,limit:String(I)});i&&x.set("projectKey",i),t&&x.set("developerId",t),n&&x.set("cursor",n);const j=await N.get(`web/tasks?${x}`).json();h(j.data??[]),d.setNextCursor(j.nextCursor)}catch{h([]),d.setNextCursor(void 0)}finally{g(!1)}},[i,t]);return r.useEffect(()=>{a(d.cursor)},[a,d.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!d.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews"),description:o("review.pending")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(n=>e.jsxs("div",{className:"flex flex-col gap-1 border-b border-[var(--border)] px-4 py-3 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent)]"}),e.jsx(A,{content:n.description,className:"flex-1 min-w-0",children:e.jsxs("span",{className:"cursor-pointer truncate text-xs text-[var(--text-primary)] hover:text-[var(--accent)] transition-colors block preserve-case",onClick:()=>p(`/tasks/${n.id}`),children:["#",n.id," ",B(n)]})}),e.jsx("button",{onClick:async()=>{try{await N.post(`web/tasks/${n.id}/review-status`,{json:{reviewStatus:"dismissed"}}),a(d.cursor)}catch(f){let x="Failed to dismiss";try{if(f instanceof H){const j=await f.response.json();x=(j==null?void 0:j.message)??x}else f instanceof Error&&(x=f.message)}catch{}y.error(x)}},className:"shrink-0 flex items-center rounded-[4px] p-1.5 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors","aria-label":"dismiss",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsxs("button",{onClick:()=>b(n.id),className:"shrink-0 flex items-center gap-1.5 rounded-[4px] px-3 py-1.5 text-[11px] font-medium text-[var(--accent)]",style:{backgroundColor:"rgba(34,197,94,0.12)"},children:[e.jsx(R,{className:"h-3 w-3"}),e.jsx("span",{className:"hidden md:inline",children:o("review.launch_short")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-5 text-[11px] text-[var(--text-muted)] min-w-0",children:[e.jsx("span",{className:"shrink-0",children:P(n.completedAt??n.createdAt)}),e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"shrink-0",children:n.projectKey}),n.workerName&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"shrink-0",children:"·"}),e.jsx("span",{className:"truncate",children:n.workerName})]})]})]},n.id))}),e.jsx(_,{pag:d}),l!==null&&e.jsx(ee,{taskId:l,onClose:()=>b(null),onLaunched:()=>{s(),a(d.cursor)}})]})}function te(s){const i=new Map;for(const t of s){const o=t.sourceTaskId??t.id;i.has(o)||i.set(o,[]),i.get(o).push(t)}return Array.from(i.entries()).map(([t,o])=>({sourceTaskId:t,tasks:o}))}function re({group:s,onClick:i}){const t=s.tasks[0],o=s.tasks.every(c=>c.status===m.COMPLETED||c.status===m.FAILED||c.status===m.CANCELLED),p=t==null?void 0:t.sourceCommitSha;return e.jsxs("div",{onClick:i,className:"flex cursor-pointer items-center gap-3 border-b border-[var(--border)] px-4 py-3 last:border-b-0 hover:bg-[var(--bg-input)] transition-colors",children:[e.jsx("span",{className:`h-2 w-2 shrink-0 rounded-full ${o?"bg-[var(--accent)]":"bg-[var(--warning)]"}`}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(A,{content:(t==null?void 0:t.sourceTaskDescription)??(t==null?void 0:t.description),className:"truncate",children:e.jsxs("span",{className:"truncate text-xs text-[var(--text-primary)]",children:["source #",s.sourceTaskId]})}),p&&e.jsxs("span",{className:"shrink-0 font-mono text-[11px] text-[var(--accent)]",children:["@",p.slice(0,7)]})]}),e.jsxs("span",{className:"text-[11px] text-[var(--text-muted)]",children:[s.tasks.length," ",s.tasks.length===1?"agent":"agents"," · ",s.tasks.map(c=>(c.agentType??"claude").toLowerCase()).join(", ")]})]}),t&&e.jsx("span",{className:"shrink-0 rounded-[4px] border border-[var(--border)] px-2 py-0.5 text-[11px] text-[var(--text-muted)]",children:t.projectKey}),t&&e.jsx("span",{className:"shrink-0 text-[11px] text-[var(--text-muted)]",children:P(t.createdAt)}),e.jsx("div",{className:"flex shrink-0 items-center gap-1",children:s.tasks.map(c=>e.jsx("span",{className:`h-2 w-2 rounded-full ${W(c.status)}`,title:c.status.toLowerCase()},c.id))})]})}function S({mode:s,projectFilter:i,developerFilter:t}){const{t:o}=w(),p=k(),[c,h]=r.useState([]),[u,g]=r.useState(!0),l=$(),b=r.useCallback(async d=>{g(!0);try{const a=new URLSearchParams({taskMode:"review",limit:String(I),groupBySource:"true"});s==="in_progress"?a.set("status",[m.QUEUED,m.ASSIGNED,m.RUNNING,m.SUSPENDED].join(",")):a.set("status",[m.COMPLETED,m.FAILED,m.CANCELLED].join(",")),i&&a.set("projectKey",i),t&&a.set("sourceDeveloperId",t),d&&a.set("cursor",d);const n=await N.get(`web/tasks?${a}`).json();h(te(n.data??[])),l.setNextCursor(n.nextCursor??void 0)}catch{h([]),l.setNextCursor(void 0)}finally{g(!1)}},[s,i,t]);return r.useEffect(()=>{b(l.cursor)},[b,l.cursor]),u&&c.length===0?e.jsx("div",{className:"p-4",children:e.jsx(L,{rows:4})}):!u&&c.length===0&&!l.hasPrev?e.jsx(D,{icon:E,title:o("review.no_reviews")}):e.jsxs(e.Fragment,{children:[c.length>0&&e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:c.map(d=>e.jsx(re,{group:d,onClick:()=>p(`/review/${d.sourceTaskId}`)},d.sourceTaskId))}),e.jsx(_,{pag:l})]})}function fe(){const{t:s}=w(),i=k(),t=K(v=>v.taskSeq),[o,p]=r.useState("pending"),[c,h]=r.useState(0),[u,g]=r.useState(""),[l,b]=r.useState(""),[d,a]=r.useState([]),[n,f]=r.useState([]);F(null);const x=r.useCallback(()=>h(v=>v+1),[]);r.useEffect(()=>{let v=!1;return(async()=>{try{const[M,G]=await Promise.all([N.get("web/projects").json(),N.get("web/projects/-/developers").json()]);if(v)return;a(M),f(G)}catch{}})(),()=>{v=!0}},[]);const j=r.useMemo(()=>[{value:"",label:s("tasks.filter_project")},...d.map(v=>({value:v.key,label:v.name}))],[d,s]),O=r.useMemo(()=>[{value:"",label:s("tasks.filter_developer")},...n.map(v=>({value:String(v.id),label:v.name}))],[n,s]),U=[{key:"pending",label:s("review.pending")},{key:"in_progress",label:s("review.in_progress")},{key:"history",label:s("review.history")}];return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-4 md:py-6 font-mono",children:[e.jsx("h1",{className:"sr-only",children:s("review.title")}),e.jsxs("div",{className:"mb-4 flex flex-col gap-3 md:gap-4 md:flex-row md:items-center",children:[e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto pb-1 md:pb-0 no-scrollbar",children:[U.map(v=>e.jsx("button",{onClick:()=>p(v.key),className:`shrink-0 rounded-[4px] px-3 py-2 h-8 text-xs transition-colors ${o===v.key?"text-[var(--accent)] bg-[var(--bg-input)]":"text-[var(--text-muted)] bg-[var(--bg-card)] hover:text-[var(--text-secondary)]"}`,children:v.label},v.key)),e.jsxs("button",{onClick:()=>i("/plan"),className:"shrink-0 flex items-center gap-1 rounded-[4px] px-3 py-2 h-8 text-xs text-[var(--text-muted)] hover:text-[var(--accent)] transition-colors",children:[e.jsx(Z,{className:"h-3 w-3"}),s("plan.title")]})]}),e.jsxs("div",{className:"flex flex-col gap-2 md:ml-auto md:flex-row md:items-center",children:[e.jsx(C,{value:u,onChange:g,options:j,className:"md:w-40"}),e.jsx(C,{value:l,onChange:b,options:O,className:"md:w-40"})]})]}),o==="pending"&&e.jsx(se,{onRefresh:x,projectFilter:u,developerFilter:l},`pending-${c}-${t}-${u}-${l}`),o==="in_progress"&&e.jsx(S,{mode:"in_progress",projectFilter:u,developerFilter:l},`inprogress-${c}-${t}-${u}-${l}`),o==="history"&&e.jsx(S,{mode:"history",projectFilter:u,developerFilter:l},`history-${c}-${t}-${u}-${l}`)]})}export{fe as default};
|