specrails-desktop 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -19
- package/client/dist/assets/{ActivityFeedPage-LKqd18-G.js → ActivityFeedPage-DNqnf1fZ.js} +1 -1
- package/client/dist/assets/{AgentsPage-Cb-b-6Ot.js → AgentsPage-vmNIEbGM.js} +1 -1
- package/client/dist/assets/{AnalyticsPage-HVxQQ1wy.js → AnalyticsPage-CdfN0ofZ.js} +1 -1
- package/client/dist/assets/{BarChart-BOyHB0dw.js → BarChart-CIkopHjl.js} +1 -1
- package/client/dist/assets/{CodePage-DnOnwKGB.js → CodePage-DDRNU5FN.js} +1 -1
- package/client/dist/assets/{DesktopAnalyticsPage-D2auU39x.js → DesktopAnalyticsPage-Cl3sKKSG.js} +1 -1
- package/client/dist/assets/{DocsDialog-CTuDX3GK.js → DocsDialog-BGrBOfUr.js} +2 -2
- package/client/dist/assets/{DocsPage-DRyMmu0Z.js → DocsPage-CY-2SSzw.js} +2 -2
- package/client/dist/assets/{ExportDropdown-DO-GGiMh.js → ExportDropdown-BRHcvP0r.js} +1 -1
- package/client/dist/assets/{IntegrationsPage-BhbO4jFT.js → IntegrationsPage-nKdLB4Ub.js} +1 -1
- package/client/dist/assets/{JobDetailPage-DJooEg1s.js → JobDetailPage-Bf0A6WWQ.js} +1 -1
- package/client/dist/assets/{JobsPage-BbaC-YOg.js → JobsPage-Vg4nXPdL.js} +1 -1
- package/client/dist/assets/{dist-js-CiIVMsx3.js → dist-js-0i_klubI.js} +1 -1
- package/client/dist/assets/{dist-js-Xc2lRKp2.js → dist-js-CUs5GjwA.js} +1 -1
- package/client/dist/assets/{index-DK214dak.js → index-BXoHFtfG.js} +8 -8
- package/client/dist/assets/index-D6BaYRRU.css +2 -0
- package/client/dist/assets/{integrations-2C7MkGT0.js → integrations-7YyTBuU9.js} +1 -1
- package/client/dist/assets/{integrations-CX4p_bij.js → integrations-B9CEpNF0.js} +1 -1
- package/client/dist/assets/{integrations-C2jQtv-s.js → integrations-BlvAdewo.js} +1 -1
- package/client/dist/assets/{integrations-eQPHAYsE.js → integrations-Bw8UM9Xd.js} +1 -1
- package/client/dist/assets/{integrations-BDC670cg.js → integrations-C5SxNKnG.js} +1 -1
- package/client/dist/assets/{integrations-BqUmRUef.js → integrations-CJQKMmdW.js} +1 -1
- package/client/dist/assets/{integrations-CB98NeH5.js → integrations-DWz1eU_K.js} +1 -1
- package/client/dist/assets/{integrations-_SuVeQIG.js → integrations-DiPR8Fzp.js} +1 -1
- package/client/dist/assets/{lib-Bo5s6xpe.js → lib-D6M_MvoC.js} +1 -1
- package/client/dist/assets/setup-B6egeeTM.js +1 -0
- package/client/dist/assets/setup-BHroXlke.js +1 -0
- package/client/dist/assets/setup-BIXsWUp1.js +1 -0
- package/client/dist/assets/setup-BJRdg1iE.js +1 -0
- package/client/dist/assets/setup-C0rVGnCy.js +1 -0
- package/client/dist/assets/setup-Cpu17hJv.js +1 -0
- package/client/dist/assets/setup-D-1r0uSx.js +1 -0
- package/client/dist/assets/setup-Dn2-veYO.js +1 -0
- package/client/dist/assets/{useProjectCache-DVNypkmR.js → useProjectCache-BeyBSNpD.js} +1 -1
- package/client/dist/index.html +4 -4
- package/docs/README.md +5 -2
- package/docs/agy-cli-provider-study.md +78 -0
- package/docs/cli.md +23 -4
- package/docs/codex.md +116 -58
- package/docs/creating-specs.md +19 -5
- package/docs/customizing.md +27 -6
- package/docs/gemini.md +225 -73
- package/docs/getting-started.md +18 -9
- package/docs/guide/de/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/de/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/de/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/de/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/de/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/de/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/de/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/de/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/de/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/de/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/de/insights/3-code-explorer.md +50 -0
- package/docs/guide/de/integrations/1-ai-providers.md +64 -0
- package/docs/guide/de/integrations/2-plugins.md +44 -0
- package/docs/guide/de/integrations/3-jira-integration.md +71 -0
- package/docs/guide/de/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/de/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/de/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/de/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/de/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/de/settings/1-themes.md +37 -0
- package/docs/guide/de/settings/2-language.md +39 -0
- package/docs/guide/de/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/de/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/de/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/de/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/de/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/de/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/en/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/en/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/en/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/en/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/en/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/en/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/en/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/en/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/en/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/en/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/en/insights/3-code-explorer.md +50 -0
- package/docs/guide/en/integrations/1-ai-providers.md +64 -0
- package/docs/guide/en/integrations/2-plugins.md +44 -0
- package/docs/guide/en/integrations/3-jira-integration.md +71 -0
- package/docs/guide/en/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/en/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/en/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/en/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/en/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/en/settings/1-themes.md +37 -0
- package/docs/guide/en/settings/2-language.md +39 -0
- package/docs/guide/en/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/en/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/en/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/en/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/en/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/en/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/es/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/es/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/es/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/es/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/es/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/es/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/es/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/es/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/es/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/es/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/es/insights/3-code-explorer.md +50 -0
- package/docs/guide/es/integrations/1-ai-providers.md +64 -0
- package/docs/guide/es/integrations/2-plugins.md +44 -0
- package/docs/guide/es/integrations/3-jira-integration.md +71 -0
- package/docs/guide/es/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/es/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/es/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/es/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/es/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/es/settings/1-themes.md +37 -0
- package/docs/guide/es/settings/2-language.md +39 -0
- package/docs/guide/es/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/es/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/es/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/es/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/es/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/es/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/fr/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/fr/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/fr/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/fr/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/fr/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/fr/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/fr/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/fr/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/fr/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/fr/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/fr/insights/3-code-explorer.md +50 -0
- package/docs/guide/fr/integrations/1-ai-providers.md +64 -0
- package/docs/guide/fr/integrations/2-plugins.md +44 -0
- package/docs/guide/fr/integrations/3-jira-integration.md +71 -0
- package/docs/guide/fr/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/fr/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/fr/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/fr/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/fr/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/fr/settings/1-themes.md +37 -0
- package/docs/guide/fr/settings/2-language.md +39 -0
- package/docs/guide/fr/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/fr/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/fr/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/fr/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/fr/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/fr/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/it/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/it/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/it/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/it/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/it/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/it/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/it/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/it/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/it/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/it/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/it/insights/3-code-explorer.md +50 -0
- package/docs/guide/it/integrations/1-ai-providers.md +64 -0
- package/docs/guide/it/integrations/2-plugins.md +44 -0
- package/docs/guide/it/integrations/3-jira-integration.md +71 -0
- package/docs/guide/it/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/it/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/it/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/it/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/it/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/it/settings/1-themes.md +37 -0
- package/docs/guide/it/settings/2-language.md +39 -0
- package/docs/guide/it/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/it/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/it/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/it/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/it/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/it/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/ja/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/ja/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/ja/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/ja/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/ja/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/ja/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/ja/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/ja/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/ja/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/ja/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/ja/insights/3-code-explorer.md +50 -0
- package/docs/guide/ja/integrations/1-ai-providers.md +64 -0
- package/docs/guide/ja/integrations/2-plugins.md +44 -0
- package/docs/guide/ja/integrations/3-jira-integration.md +71 -0
- package/docs/guide/ja/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/ja/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/ja/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/ja/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/ja/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/ja/settings/1-themes.md +37 -0
- package/docs/guide/ja/settings/2-language.md +39 -0
- package/docs/guide/ja/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/ja/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/ja/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/ja/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/ja/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/ja/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/pt/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/pt/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/pt/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/pt/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/pt/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/pt/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/pt/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/pt/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/pt/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/pt/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/pt/insights/3-code-explorer.md +50 -0
- package/docs/guide/pt/integrations/1-ai-providers.md +64 -0
- package/docs/guide/pt/integrations/2-plugins.md +44 -0
- package/docs/guide/pt/integrations/3-jira-integration.md +71 -0
- package/docs/guide/pt/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/pt/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/pt/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/pt/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/pt/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/pt/settings/1-themes.md +37 -0
- package/docs/guide/pt/settings/2-language.md +39 -0
- package/docs/guide/pt/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/pt/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/pt/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/pt/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/pt/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/pt/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/guide/zh/agents/1-meet-the-agents.md +38 -0
- package/docs/guide/zh/agents/2-profiles-and-the-balanced-default.md +45 -0
- package/docs/guide/zh/agents/3-customizing-models-per-agent.md +60 -0
- package/docs/guide/zh/agents/4-custom-agents-catalog.md +43 -0
- package/docs/guide/zh/getting-started/1-what-is-specrails.md +49 -0
- package/docs/guide/zh/getting-started/2-installing-and-first-run.md +42 -0
- package/docs/guide/zh/getting-started/3-adding-your-first-project.md +58 -0
- package/docs/guide/zh/getting-started/4-the-dashboard-tour.md +53 -0
- package/docs/guide/zh/insights/1-analytics-and-cost-tracking.md +78 -0
- package/docs/guide/zh/insights/2-the-integrated-terminal.md +46 -0
- package/docs/guide/zh/insights/3-code-explorer.md +50 -0
- package/docs/guide/zh/integrations/1-ai-providers.md +64 -0
- package/docs/guide/zh/integrations/2-plugins.md +44 -0
- package/docs/guide/zh/integrations/3-jira-integration.md +71 -0
- package/docs/guide/zh/integrations/4-mobile-companion.md +38 -0
- package/docs/guide/zh/pipeline/1-rails-and-jobs.md +94 -0
- package/docs/guide/zh/pipeline/2-the-job-detail-view.md +90 -0
- package/docs/guide/zh/pipeline/3-batch-implement-and-multi-feature.md +78 -0
- package/docs/guide/zh/pipeline/4-picking-an-engine-per-rail.md +60 -0
- package/docs/guide/zh/settings/1-themes.md +37 -0
- package/docs/guide/zh/settings/2-language.md +39 -0
- package/docs/guide/zh/settings/3-pipeline-telemetry-and-diagnostics.md +46 -0
- package/docs/guide/zh/settings/4-where-your-data-lives.md +48 -0
- package/docs/guide/zh/specs/1-specs-and-the-backlog.md +52 -0
- package/docs/guide/zh/specs/2-add-spec-quick-mode.md +45 -0
- package/docs/guide/zh/specs/3-add-spec-explore-mode.md +68 -0
- package/docs/guide/zh/specs/4-drafts-and-contract-layer.md +81 -0
- package/docs/internals/README.md +1 -1
- package/docs/internals/adding-a-provider.md +192 -59
- package/docs/internals/api-reference.md +130 -21
- package/docs/internals/architecture.md +22 -9
- package/docs/internals/bundled-framework-build-plan.md +264 -0
- package/docs/internals/configuration.md +33 -8
- package/docs/internals/global-artifacts-alignment-contract.md +486 -0
- package/docs/internals/global-artifacts-relocation-evaluation.md +294 -0
- package/docs/internals/operations-runbook.md +16 -5
- package/docs/internals/profiles.md +42 -14
- package/docs/platforms/macos.md +27 -8
- package/docs/platforms/windows.md +20 -6
- package/docs/running-pipelines.md +17 -9
- package/docs/terminal.md +9 -3
- package/docs/tracking-cost.md +17 -11
- package/package.json +1 -1
- package/server/dist/agent-refine-manager.js +20 -5
- package/server/dist/artifact-registry.js +468 -0
- package/server/dist/attachment-manager.js +5 -8
- package/server/dist/browser-capture-manager.js +4 -4
- package/server/dist/bundled-core.js +72 -0
- package/server/dist/bundled-openspec.js +58 -0
- package/server/dist/chat-manager.js +42 -5
- package/server/dist/code-explorer-router.js +10 -7
- package/server/dist/config.js +7 -2
- package/server/dist/context-budget.js +17 -6
- package/server/dist/context-scope.js +6 -2
- package/server/dist/contract-refine-runner.js +31 -9
- package/server/dist/desktop-router.js +39 -14
- package/server/dist/docs-router.js +210 -132
- package/server/dist/file-summary-manager.js +41 -16
- package/server/dist/framework-manager.js +248 -0
- package/server/dist/framework-migration.js +308 -0
- package/server/dist/index.js +30 -0
- package/server/dist/install-config-path.js +73 -0
- package/server/dist/jira/jira-sync-manager.js +23 -11
- package/server/dist/openspec-shim.js +153 -0
- package/server/dist/plugins-router.js +19 -8
- package/server/dist/profiles-router.js +38 -16
- package/server/dist/project-registry.js +101 -3
- package/server/dist/project-router-chat.js +1 -1
- package/server/dist/project-router-helpers.js +25 -12
- package/server/dist/project-router-jobs.js +3 -3
- package/server/dist/project-router-settings.js +8 -6
- package/server/dist/project-router-setup.js +27 -10
- package/server/dist/project-router-spending.js +6 -1
- package/server/dist/project-router-tickets.js +30 -10
- package/server/dist/project-router.js +16 -1
- package/server/dist/providers/gemini-adapter.js +4 -0
- package/server/dist/providers/gemini-agent-ack.js +65 -0
- package/server/dist/queue-manager.js +156 -12
- package/server/dist/setup-manager.js +131 -29
- package/server/dist/smash-runner.js +21 -6
- package/server/dist/ticket-store.js +6 -2
- package/server/dist/ticket-watcher.js +5 -1
- package/server/dist/util/stream-display.js +18 -3
- package/server/dist/vitest-setup.js +25 -0
- package/server/dist/workspace-manager.js +199 -0
- package/server/dist/workspace-resolution.js +147 -0
- package/client/dist/assets/index-DgKfQFcf.css +0 -2
- package/client/dist/assets/setup-BIIkb-_K.js +0 -1
- package/client/dist/assets/setup-BeQxu9kD.js +0 -1
- package/client/dist/assets/setup-CPa6GnlI.js +0 -1
- package/client/dist/assets/setup-CZl4OEJx.js +0 -1
- package/client/dist/assets/setup-ChpodNfn.js +0 -1
- package/client/dist/assets/setup-D_fjJH6u.js +0 -1
- package/client/dist/assets/setup-YzD8DX4O.js +0 -1
- package/client/dist/assets/setup-fRpDozmq.js +0 -1
- package/docs/adding-a-provider.md +0 -107
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,C as n,Et as r,L as i,Lt as a,N as o,O as s,Q as c,Qt as l,R as u,Rt as d,S as f,T as p,Tt as m,Y as h,dt as g,ft as _,k as v,q as y,sn as b,st as x,t as S,tn as C,w,zt as T}from"./index-DK214dak.js";import{t as E}from"./useProjectCache-DVNypkmR.js";var D=e(b(),1),O=d(),k=[`todo`,`in_progress`,`done`,`cancelled`],A={todo:`todo`,in_progress:`inProgress`,done:`done`,cancelled:`cancelled`};function j({state:e,onChanged:n}){let{t:r}=t(`jira`),i=e.connection,[a,s]=(0,D.useState)(i.enabled),[c,u]=(0,D.useState)(!1),[d,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)([]),[v,y]=(0,D.useState)(i.discardStatus??``),[b,x]=(0,D.useState)(i.statusMap??{}),S=e.outbox??{pending:0,inflight:0,done:0,dead:0},C=(0,D.useCallback)(async()=>{try{let{ops:e}=await f.listOutbox(`dead`);h(e)}catch{h([])}},[]);(0,D.useEffect)(()=>{C()},[C]),(0,D.useEffect)(()=>{let e=!1;return f.listStatuses().then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[]);async function w(e){let t=v;y(e);try{await f.patchConnection({discardStatus:e||null}),n()}catch(e){y(t),l.error(N(e,r))}}async function T(e,t){let i=b,a={...b,[e]:t||void 0};x(a);let o=Object.fromEntries(Object.entries(a).filter(([,e])=>e));try{await f.patchConnection({statusMap:Object.keys(o).length?o:null}),n()}catch(e){x(i),l.error(N(e,r))}}async function E(){let e=!a;s(e),p(!0);try{await f.setEnabled(e)}catch(t){s(!e),l.error(N(t,r))}finally{p(!1)}}async function j(){u(!0);try{let e=await f.syncNow();l.success(r(`status.syncedToast`,{count:e.upserted}))}catch(e){l.error(N(e,r))}finally{u(!1)}}async function P(){if(window.confirm(r(`status.disconnectConfirm`))){p(!0);try{await f.disconnect(),l.success(r(`status.disconnectedToast`)),n()}catch(e){l.error(N(e,r))}finally{p(!1)}}}async function F(e){try{await f.retryOutbox(e),await C()}catch(e){l.error(N(e,r))}}let I=S.pending+S.inflight;return(0,O.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:r(`status.connected`,{key:i.jiraProjectKey})}),(0,O.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i.baseUrl,` · `,i.deployment===`cloud`?r(`review.cloud`):r(`review.dc`)]})]}),(0,O.jsx)(`a`,{href:`${i.baseUrl}/browse/${i.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:r(`badge.openInJira`)})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`status.enabledLabel`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(a?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":a,"aria-label":r(`status.enabledLabel`),disabled:d,onClick:E,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${a?`bg-accent-success`:`bg-input`}`,children:(0,O.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${a?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`wizard.step3Title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`mapping.intro`)}),(0,O.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>(0,O.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`mapping.${A[e]}`)}),(0,O.jsxs)(`select`,{value:b[e]??``,onChange:t=>void T(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,O.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),g.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,O.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`discard.configLabel`)}),(0,O.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`discard.configHelp`)}),(0,O.jsxs)(`select`,{value:v,onChange:e=>void w(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,O.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),g.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,O.jsx)(`option`,{value:v,children:v})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(o,{variant:`outline`,size:`sm`,onClick:j,disabled:c,children:r(c?`status.syncing`:`status.syncNow`)}),(0,O.jsx)(o,{variant:`ghost`,size:`sm`,onClick:P,disabled:d,className:`text-destructive`,children:r(`status.disconnect`)})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`outbox.title`)}),S.dead>0?(0,O.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:r(`outbox.dead`,{count:S.dead})}):I>0?(0,O.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.pending`,{count:I})}):(0,O.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.allSynced`)}),m.length>0&&(0,O.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`outbox.deadHelp`)}),m.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,O.jsxs)(`span`,{className:`truncate text-xs`,children:[M(e,r),` · `,e.deadReason??e.lastError??``]}),(0,O.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>F(e.id),children:r(`outbox.retry`)})]},e.id))]})]})]})}function M(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function N(e,t){return e instanceof Error?e.message:t(`errors.generic`)}function P({activeProjectId:e}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(null),[o,c]=(0,D.useState)(!0),[l,u]=(0,D.useState)(!1),[d,m]=(0,D.useState)(!1),g=(0,D.useCallback)(async()=>{try{a(await f.getConnection())}catch{a({connected:!1})}finally{c(!1)}},[]);if((0,D.useEffect)(()=>{!n||!e||(c(!0),g())},[e,g]),!n)return null;let y=!!(i?.connected&&i.connection);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,"data-testid":`jira-integration-card`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`div`,{className:`grid place-items-center w-9 h-9 rounded-md bg-accent-info/15 text-accent-info shrink-0`,children:(0,O.jsx)(h,{className:`w-4 h-4`})}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`jiraCard.title`)}),y&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,"data-testid":`jira-connected-badge`,children:[(0,O.jsx)(_,{className:`w-3 h-3`}),` `,r(`jiraCard.connected`)]})]}),(0,O.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:r(`jiraCard.category`)})]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:y&&i?.connection?r(`jiraCard.connectedDescription`,{key:i.connection.jiraProjectKey}):r(`jiraCard.description`)}),(0,O.jsxs)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:[(0,O.jsx)(`li`,{children:r(`jiraCard.bullet1`)}),(0,O.jsx)(`li`,{children:r(`jiraCard.bullet2`)}),(0,O.jsx)(`li`,{children:r(`jiraCard.bullet3`)})]}),(0,O.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:r(`jiraCard.requires`)}),(0,O.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:o?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):y?(0,O.jsx)(`button`,{type:`button`,onClick:()=>m(!0),"data-testid":`jira-manage-btn`,className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-muted/30 inline-flex items-center gap-1.5`,children:r(`jiraCard.manage`)}):(0,O.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),"data-testid":`jira-connect-btn`,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90 inline-flex items-center gap-1.5`,children:[(0,O.jsx)(h,{className:`w-3.5 h-3.5`}),r(`jiraCard.connect`)]})}),(0,O.jsx)(w,{open:l,onOpenChange:u,children:(0,O.jsxs)(p,{className:`max-w-lg`,children:[(0,O.jsx)(s,{children:(0,O.jsx)(v,{children:r(`jiraCard.modalTitle`)})}),(0,O.jsx)(S,{onConnected:()=>{u(!1),g()},onSkip:()=>u(!1)})]})}),(0,O.jsx)(w,{open:d,onOpenChange:m,children:(0,O.jsxs)(p,{className:`max-w-lg`,children:[(0,O.jsx)(s,{children:(0,O.jsx)(v,{children:r(`jiraCard.manageTitle`)})}),i?.connected&&i.connection&&(0,O.jsx)(j,{state:i,onChanged:()=>{g().then(()=>m(!1))}})]})})]})}function F(){let{t:e}=t(`integrations`),{activeProjectId:o,projects:s}=r(),c=s.find(e=>e.id===o),l=c?m(c).includes(`claude`):!0,{registerHandler:u,unregisterHandler:d}=a(),f=(0,D.useRef)(o);(0,D.useEffect)(()=>{f.current=o},[o]);let[p,h]=(0,D.useState)(null),[g,_]=(0,D.useState)(null),{data:v,isLoading:b,isFirstLoad:x,refresh:S}=E({namespace:`plugins`,projectId:o,initialValue:[],fetcher:(0,D.useCallback)(async()=>{let e=await fetch(`${T()}/plugins`);if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).plugins??[]},[])});(0,D.useEffect)(()=>(u(`integrations-page`,e=>{let t=e;t.type&&(t.projectId&&t.projectId!==f.current||t.type.startsWith(`plugin.`)&&S())}),()=>d(`integrations-page`)),[u,d,S]),(0,D.useEffect)(()=>{h(!b&&!v?`Failed to load plugins`:null)},[b,v]);let C=(0,D.useMemo)(()=>(v??[]).filter(e=>e.status!==`orphan`),[v]),w=(0,D.useMemo)(()=>(v??[]).filter(e=>e.status===`orphan`),[v]);return o?(0,O.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,O.jsxs)(`div`,{className:`flex-shrink-0 border-b border-border px-6 pt-4 pb-3 flex items-center gap-2`,children:[(0,O.jsx)(y,{className:`w-4 h-4 text-accent-primary`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold`,children:e(`page.title`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`page.subtitle`)})]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-auto p-6`,children:x&&b?(0,O.jsx)(G,{}):p&&l?(0,O.jsx)(K,{onRetry:S}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,O.jsx)(P,{activeProjectId:o}),l&&C.map(e=>(0,O.jsx)(I,{plugin:e,isInstalling:g===e.name,onInstall:()=>_(e.name),onCloseInstall:()=>{_(null),S()}},e.name))]}),l&&w.length>0&&(0,O.jsxs)(`div`,{className:`mt-10`,children:[(0,O.jsxs)(`h2`,{className:`text-sm font-semibold text-muted-foreground mb-3 flex items-center gap-2`,children:[(0,O.jsx)(i,{className:`w-3.5 h-3.5`}),` `,e(`page.deprecated`)]}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:w.map(e=>(0,O.jsx)(V,{plugin:e,onRemoved:S},e.name))})]}),!n&&(!l||C.length===0)&&(0,O.jsx)(q,{})]})})]}):(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:e(`page.selectProject`)})}function I({plugin:e,isInstalling:n,onInstall:r,onCloseInstall:a}){let{t:o}=t(`integrations`),[s,c]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,children:[(0,O.jsx)(`div`,{className:`flex items-start gap-2`,children:(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:[`v`,e.version]}),e.status===`installed`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,children:[(0,O.jsx)(_,{className:`w-3 h-3`}),` `,o(`card.statusActive`)]}),e.status===`deactivated`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1`,children:[(0,O.jsx)(g,{className:`w-3 h-3`}),` `,o(`card.statusDeactivated`)]}),e.status===`degraded`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-warning/20 text-accent-warning flex items-center gap-1`,children:[(0,O.jsx)(i,{className:`w-3 h-3`}),` `,o(`card.statusDegraded`)]}),e.updateAvailable&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/20 text-accent-info flex items-center gap-1`,children:[(0,O.jsx)(x,{className:`w-3 h-3`}),` `,o(`card.updateAvailable`)]})]}),e.category&&(0,O.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:e.category})]})}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.description}),e.whatItDoes.length>0&&(0,O.jsx)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:e.whatItDoes.map((e,t)=>(0,O.jsx)(`li`,{children:e},t))}),e.requirements.length>0&&(0,O.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:o(`card.requires`,{list:e.requirements.map(e=>`${e.name}${e.minVersion?` ≥ ${e.minVersion}`:``}`).join(`, `)})}),e.healthReason&&e.status===`degraded`&&(0,O.jsx)(`div`,{className:`text-[11px] text-accent-warning`,children:e.healthReason}),e.status===`deactivated`&&(0,O.jsx)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:(0,O.jsx)(C,{t:o,i18nKey:`card.deactivatedHint`,components:{strong:(0,O.jsx)(`strong`,{})}})}),e.marketplaceConflicts&&e.marketplaceConflicts.length>0&&(0,O.jsx)(B,{pluginName:e.name,conflicts:e.marketplaceConflicts}),e.marketplaceCachedButDisabled&&e.marketplaceCachedButDisabled.length>0&&(0,O.jsx)(R,{keys:e.marketplaceCachedButDisabled}),e.updateAvailable&&(0,O.jsx)(z,{pluginName:e.name}),(0,O.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:e.status===`not-installed`?(0,O.jsx)(`button`,{type:`button`,onClick:r,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90`,children:o(`card.install`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(L,{pluginName:e.name,active:e.status===`installed`}),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,O.jsx)(u,{className:`w-3 h-3`}),` `,o(`card.uninstall`)]})]})}),n&&(0,O.jsx)(H,{pluginName:e.name,onClose:a}),s&&(0,O.jsx)(U,{pluginName:e.name,onClose:()=>c(!1),onUninstalled:()=>{c(!1)}})]})}function L({pluginName:e,active:n}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(null);return(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),s(null);try{let t=`${T()}/plugins/${e}/${n?`deactivate`:`activate`}`,r=await fetch(t,{method:`POST`});if(!r.ok)throw Error((await r.json()).error??`HTTP ${r.status}`)}catch(e){s(e.message)}finally{a(!1)}},role:`switch`,"aria-checked":n,className:`relative inline-flex items-center h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${n?`bg-accent-success`:`bg-muted`}`,title:r(n?`toggle.titleActive`:`toggle.titleDeactivated`),children:(0,O.jsx)(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform ${n?`translate-x-4`:`translate-x-0.5`}`})}),(0,O.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(n?`card.statusActive`:`common:states.off`)}),o&&(0,O.jsx)(`span`,{className:`text-[10px] text-destructive`,children:o})]})}function R({keys:e}){let{t:n}=t(`integrations`);return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(i,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:n,i18nKey:`cachedNotice.body`,components:{strong:(0,O.jsx)(`strong`,{}),code:(0,O.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,O.jsx)(`div`,{className:`pl-5 space-y-0.5`,children:e.map(e=>(0,O.jsxs)(`pre`,{className:`text-[10px] bg-muted/40 rounded px-1.5 py-0.5 inline-block font-mono`,children:[`/plugin uninstall `,e]},e))}),(0,O.jsx)(`div`,{className:`pl-5 text-[10px] text-muted-foreground`,children:n(`cachedNotice.runInstruction`)})]})}function z({pluginName:e}){let{t:n}=t(`integrations`),[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(null);return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-accent-info/30 bg-accent-info/5 p-2 leading-relaxed space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(x,{className:`w-3 h-3 text-accent-info mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:n,i18nKey:`update.body`,components:{code:(0,O.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:r,onClick:async()=>{i(!0),o(null);try{let t=await fetch(`${T()}/plugins/${e}/update`,{method:`POST`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){o(e.message)}finally{i(!1)}},className:`text-[10px] px-2 py-0.5 rounded border border-accent-info/40 hover:bg-accent-info/10 disabled:opacity-50 flex items-center gap-1`,children:[r&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),(0,O.jsx)(C,{t:n,i18nKey:`update.button`,components:{code:(0,O.jsx)(`code`,{})}})]}),a&&(0,O.jsx)(`div`,{className:`text-destructive text-[10px]`,children:a})]})}function B({pluginName:e,conflicts:n}){let{t:r}=t(`integrations`),[a,o]=(0,D.useState)(null),[s,l]=(0,D.useState)(null),u=async e=>{o(e),l(null);try{let t=await fetch(`${T()}/plugins/_marketplace/disable`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){l(e.message)}finally{o(null)}};return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(i,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:r,i18nKey:`conflict.body`,values:{name:e},components:{strong:(0,O.jsx)(`strong`,{})}})})]}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,children:n.map(e=>(0,O.jsxs)(`button`,{type:`button`,disabled:a===e,onClick:()=>u(e),className:`text-[10px] px-2 py-0.5 rounded border border-yellow-500/40 aurora-light:border-accent-warning/40 hover:bg-yellow-500/10 aurora-light:hover:bg-accent-warning/10 disabled:opacity-50 flex items-center gap-1`,children:[a===e&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),(0,O.jsx)(C,{t:r,i18nKey:`conflict.disableButton`,values:{key:e},components:{code:(0,O.jsx)(`code`,{})}})]},e))}),s&&(0,O.jsx)(`div`,{className:`text-destructive`,children:s})]})}function V({plugin:e,onRemoved:n}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-4 flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,O.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 aurora-light:bg-accent-warning/15 text-yellow-500 aurora-light:text-accent-warning`,children:r(`orphan.badge`)})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),(0,O.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,O.jsxs)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0);try{await fetch(`${T()}/plugins/${e.name}`,{method:`DELETE`}),n()}finally{a(!1)}},className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,O.jsx)(u,{className:`w-3 h-3`}),` `,r(`orphan.removeButton`)]})})]})}function H({pluginName:e,onClose:n}){let{t:r}=t(`integrations`),[o,s]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(null),[h,v]=(0,D.useState)([]),[y,b]=(0,D.useState)(null),[S,C]=(0,D.useState)([]),{registerHandler:w,unregisterHandler:E}=a(),k=(0,D.useCallback)(()=>{s(null),u(null),fetch(`${T()}/plugins/${e}/preview-install`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>s(e)).catch(e=>u(e.message))},[e]);(0,D.useEffect)(()=>{k()},[k]),(0,D.useEffect)(()=>(w(`install-${e}`,t=>{let n=t;if(n.type===`plugin.install_progress`&&n.name===e&&n.line&&v(e=>[...e,n.line]),n.type===`plugin.prereq_install_progress`&&n.line&&C(e=>[...e,n.line]),n.type===`plugin.prereq_installed`){b(null);let e=n.reason;e&&C(t=>[...t,`► ${e}`]),n.ok&&k()}}),()=>E(`install-${e}`)),[e,w,E,k]);let A=async e=>{b(e),C([r(`installDialog.installingPrereq`,{name:e})]);try{await fetch(`${T()}/plugins/_prerequisites/${e}/install`,{method:`POST`})}catch(e){C(t=>[...t,r(`installDialog.prereqStartFailed`,{message:e.message})]),b(null)}},j=(o?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum);return(0,O.jsxs)(W,{onClose:n,title:r(`installDialog.title`,{name:e}),children:[l&&(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:l}),!o&&!l&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`w-3 h-3 animate-spin`}),` `,r(`installDialog.computingChanges`)]}),o&&(0,O.jsxs)(O.Fragment,{children:[o.platformNote&&(0,O.jsxs)(`div`,{className:`flex items-start gap-2 p-2.5 rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 text-[11px] leading-relaxed`,children:[(0,O.jsx)(i,{className:`w-3.5 h-3.5 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:o.platformNote})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:r(`installDialog.filesHeading`)}),(0,O.jsx)(`ul`,{className:`text-xs space-y-0.5 font-mono`,children:o.files.map((e,t)=>(0,O.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path,e.summary&&(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.summary]})]},t))})]}),o.requirements.length>0&&(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:r(`installDialog.prerequisites`)}),(0,O.jsx)(`ul`,{className:`text-xs space-y-1`,children:o.requirements.map(e=>{let t=e.installed&&e.executable&&e.meetsMinimum,n=e.name===`uv`;return(0,O.jsxs)(`li`,{className:`flex items-center gap-2`,children:[t?(0,O.jsx)(_,{className:`w-3 h-3 text-accent-success`}):(0,O.jsx)(g,{className:`w-3 h-3 text-accent-warning`}),(0,O.jsxs)(`span`,{children:[e.name,e.minVersion?` ≥ ${e.minVersion}`:``]}),e.version&&(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]}),!t&&n&&(0,O.jsxs)(`button`,{type:`button`,disabled:y===e.name,onClick:()=>A(e.name),className:`ml-auto text-[10px] px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 flex items-center gap-1`,children:[y===e.name&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),r(`installDialog.autoInstall`)]})]},e.name)})}),S.length>0&&(0,O.jsx)(`pre`,{className:`mt-2 text-[11px] bg-muted/40 rounded p-2 max-h-24 overflow-auto font-mono`,children:S.join(`
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,C as n,Et as r,L as i,Lt as a,N as o,O as s,Q as c,Qt as l,R as u,Rt as d,S as f,T as p,Tt as m,Y as h,dt as g,ft as _,k as v,q as y,sn as b,st as x,t as S,tn as C,w,zt as T}from"./index-BXoHFtfG.js";import{t as E}from"./useProjectCache-BeyBSNpD.js";var D=e(b(),1),O=d(),k=[`todo`,`in_progress`,`done`,`cancelled`],A={todo:`todo`,in_progress:`inProgress`,done:`done`,cancelled:`cancelled`};function j({state:e,onChanged:n}){let{t:r}=t(`jira`),i=e.connection,[a,s]=(0,D.useState)(i.enabled),[c,u]=(0,D.useState)(!1),[d,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)([]),[g,_]=(0,D.useState)([]),[v,y]=(0,D.useState)(i.discardStatus??``),[b,x]=(0,D.useState)(i.statusMap??{}),S=e.outbox??{pending:0,inflight:0,done:0,dead:0},C=(0,D.useCallback)(async()=>{try{let{ops:e}=await f.listOutbox(`dead`);h(e)}catch{h([])}},[]);(0,D.useEffect)(()=>{C()},[C]),(0,D.useEffect)(()=>{let e=!1;return f.listStatuses().then(({statuses:t})=>{e||_(t)}).catch(()=>{e||_([])}),()=>{e=!0}},[]);async function w(e){let t=v;y(e);try{await f.patchConnection({discardStatus:e||null}),n()}catch(e){y(t),l.error(N(e,r))}}async function T(e,t){let i=b,a={...b,[e]:t||void 0};x(a);let o=Object.fromEntries(Object.entries(a).filter(([,e])=>e));try{await f.patchConnection({statusMap:Object.keys(o).length?o:null}),n()}catch(e){x(i),l.error(N(e,r))}}async function E(){let e=!a;s(e),p(!0);try{await f.setEnabled(e)}catch(t){s(!e),l.error(N(t,r))}finally{p(!1)}}async function j(){u(!0);try{let e=await f.syncNow();l.success(r(`status.syncedToast`,{count:e.upserted}))}catch(e){l.error(N(e,r))}finally{u(!1)}}async function P(){if(window.confirm(r(`status.disconnectConfirm`))){p(!0);try{await f.disconnect(),l.success(r(`status.disconnectedToast`)),n()}catch(e){l.error(N(e,r))}finally{p(!1)}}}async function F(e){try{await f.retryOutbox(e),await C()}catch(e){l.error(N(e,r))}}let I=S.pending+S.inflight;return(0,O.jsxs)(`div`,{className:`space-y-4`,"data-testid":`jira-connected`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-sm font-medium text-foreground`,children:r(`status.connected`,{key:i.jiraProjectKey})}),(0,O.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[i.baseUrl,` · `,i.deployment===`cloud`?r(`review.cloud`):r(`review.dc`)]})]}),(0,O.jsx)(`a`,{href:`${i.baseUrl}/browse/${i.jiraProjectKey}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-accent-primary hover:underline`,children:r(`badge.openInJira`)})]}),(0,O.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-border p-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`status.enabledLabel`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(a?`status.enabledHelp`:`status.pausedHelp`)})]}),(0,O.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":a,"aria-label":r(`status.enabledLabel`),disabled:d,onClick:E,className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ${a?`bg-accent-success`:`bg-input`}`,children:(0,O.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-background shadow-sm transition-transform ${a?`translate-x-4`:`translate-x-0.5`}`})})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-status-map`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`wizard.step3Title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`mapping.intro`)}),(0,O.jsx)(`div`,{className:`space-y-2`,children:k.map(e=>(0,O.jsxs)(`label`,{className:`flex items-center justify-between gap-3`,children:[(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`mapping.${A[e]}`)}),(0,O.jsxs)(`select`,{value:b[e]??``,onChange:t=>void T(e,t.target.value),className:`w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-statusmap-${e}`,children:[(0,O.jsx)(`option`,{value:``,children:r(`mapping.auto`)}),g.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.id)),b[e]&&!g.some(t=>t.name===b[e])&&(0,O.jsx)(`option`,{value:b[e],children:b[e]})]})]},e))})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`discard.configLabel`)}),(0,O.jsx)(`p`,{className:`mt-0.5 mb-2 text-xs text-muted-foreground`,children:r(`discard.configHelp`)}),(0,O.jsxs)(`select`,{value:v,onChange:e=>void w(e.target.value),className:`w-full rounded-md border border-border bg-background px-2 py-1.5 text-sm`,"data-testid":`jira-discard-status-select`,children:[(0,O.jsx)(`option`,{value:``,children:r(`discard.configNone`)}),g.map(e=>(0,O.jsx)(`option`,{value:e.name,children:e.name},e.id)),v&&!g.some(e=>e.name===v)&&(0,O.jsx)(`option`,{value:v,children:v})]})]}),(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(o,{variant:`outline`,size:`sm`,onClick:j,disabled:c,children:r(c?`status.syncing`:`status.syncNow`)}),(0,O.jsx)(o,{variant:`ghost`,size:`sm`,onClick:P,disabled:d,className:`text-destructive`,children:r(`status.disconnect`)})]}),(0,O.jsxs)(`div`,{className:`rounded-md border border-border p-3`,"data-testid":`jira-outbox`,children:[(0,O.jsx)(`p`,{className:`text-sm font-medium`,children:r(`outbox.title`)}),S.dead>0?(0,O.jsx)(`p`,{className:`mt-1 text-xs text-accent-warning`,children:r(`outbox.dead`,{count:S.dead})}):I>0?(0,O.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.pending`,{count:I})}):(0,O.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:r(`outbox.allSynced`)}),m.length>0&&(0,O.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`outbox.deadHelp`)}),m.map(e=>(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded border border-border/60 px-2 py-1`,children:[(0,O.jsxs)(`span`,{className:`truncate text-xs`,children:[M(e,r),` · `,e.deadReason??e.lastError??``]}),(0,O.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>F(e.id),children:r(`outbox.retry`)})]},e.id))]})]})]})}function M(e,t){return e.opType===`transition`?t(`outbox.opTransition`):e.opType===`comment`?t(`outbox.opComment`):t(`outbox.opCreate`)}function N(e,t){return e instanceof Error?e.message:t(`errors.generic`)}function P({activeProjectId:e}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(null),[o,c]=(0,D.useState)(!0),[l,u]=(0,D.useState)(!1),[d,m]=(0,D.useState)(!1),g=(0,D.useCallback)(async()=>{try{a(await f.getConnection())}catch{a({connected:!1})}finally{c(!1)}},[]);if((0,D.useEffect)(()=>{!n||!e||(c(!0),g())},[e,g]),!n)return null;let y=!!(i?.connected&&i.connection);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,"data-testid":`jira-integration-card`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(`div`,{className:`grid place-items-center w-9 h-9 rounded-md bg-accent-info/15 text-accent-info shrink-0`,children:(0,O.jsx)(h,{className:`w-4 h-4`})}),(0,O.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:r(`jiraCard.title`)}),y&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,"data-testid":`jira-connected-badge`,children:[(0,O.jsx)(_,{className:`w-3 h-3`}),` `,r(`jiraCard.connected`)]})]}),(0,O.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:r(`jiraCard.category`)})]})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:y&&i?.connection?r(`jiraCard.connectedDescription`,{key:i.connection.jiraProjectKey}):r(`jiraCard.description`)}),(0,O.jsxs)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:[(0,O.jsx)(`li`,{children:r(`jiraCard.bullet1`)}),(0,O.jsx)(`li`,{children:r(`jiraCard.bullet2`)}),(0,O.jsx)(`li`,{children:r(`jiraCard.bullet3`)})]}),(0,O.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:r(`jiraCard.requires`)}),(0,O.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:o?(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`…`}):y?(0,O.jsx)(`button`,{type:`button`,onClick:()=>m(!0),"data-testid":`jira-manage-btn`,className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-muted/30 inline-flex items-center gap-1.5`,children:r(`jiraCard.manage`)}):(0,O.jsxs)(`button`,{type:`button`,onClick:()=>u(!0),"data-testid":`jira-connect-btn`,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90 inline-flex items-center gap-1.5`,children:[(0,O.jsx)(h,{className:`w-3.5 h-3.5`}),r(`jiraCard.connect`)]})}),(0,O.jsx)(w,{open:l,onOpenChange:u,children:(0,O.jsxs)(p,{className:`max-w-lg`,children:[(0,O.jsx)(s,{children:(0,O.jsx)(v,{children:r(`jiraCard.modalTitle`)})}),(0,O.jsx)(S,{onConnected:()=>{u(!1),g()},onSkip:()=>u(!1)})]})}),(0,O.jsx)(w,{open:d,onOpenChange:m,children:(0,O.jsxs)(p,{className:`max-w-lg`,children:[(0,O.jsx)(s,{children:(0,O.jsx)(v,{children:r(`jiraCard.manageTitle`)})}),i?.connected&&i.connection&&(0,O.jsx)(j,{state:i,onChanged:()=>{g().then(()=>m(!1))}})]})})]})}function F(){let{t:e}=t(`integrations`),{activeProjectId:o,projects:s}=r(),c=s.find(e=>e.id===o),l=c?m(c).includes(`claude`):!0,{registerHandler:u,unregisterHandler:d}=a(),f=(0,D.useRef)(o);(0,D.useEffect)(()=>{f.current=o},[o]);let[p,h]=(0,D.useState)(null),[g,_]=(0,D.useState)(null),{data:v,isLoading:b,isFirstLoad:x,refresh:S}=E({namespace:`plugins`,projectId:o,initialValue:[],fetcher:(0,D.useCallback)(async()=>{let e=await fetch(`${T()}/plugins`);if(!e.ok)throw Error(`HTTP ${e.status}`);return(await e.json()).plugins??[]},[])});(0,D.useEffect)(()=>(u(`integrations-page`,e=>{let t=e;t.type&&(t.projectId&&t.projectId!==f.current||t.type.startsWith(`plugin.`)&&S())}),()=>d(`integrations-page`)),[u,d,S]),(0,D.useEffect)(()=>{h(!b&&!v?`Failed to load plugins`:null)},[b,v]);let C=(0,D.useMemo)(()=>(v??[]).filter(e=>e.status!==`orphan`),[v]),w=(0,D.useMemo)(()=>(v??[]).filter(e=>e.status===`orphan`),[v]);return o?(0,O.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,O.jsxs)(`div`,{className:`flex-shrink-0 border-b border-border px-6 pt-4 pb-3 flex items-center gap-2`,children:[(0,O.jsx)(y,{className:`w-4 h-4 text-accent-primary`}),(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold`,children:e(`page.title`)}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e(`page.subtitle`)})]})]}),(0,O.jsx)(`div`,{className:`flex-1 overflow-auto p-6`,children:x&&b?(0,O.jsx)(G,{}):p&&l?(0,O.jsx)(K,{onRetry:S}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,O.jsx)(P,{activeProjectId:o}),l&&C.map(e=>(0,O.jsx)(I,{plugin:e,isInstalling:g===e.name,onInstall:()=>_(e.name),onCloseInstall:()=>{_(null),S()}},e.name))]}),l&&w.length>0&&(0,O.jsxs)(`div`,{className:`mt-10`,children:[(0,O.jsxs)(`h2`,{className:`text-sm font-semibold text-muted-foreground mb-3 flex items-center gap-2`,children:[(0,O.jsx)(i,{className:`w-3.5 h-3.5`}),` `,e(`page.deprecated`)]}),(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:w.map(e=>(0,O.jsx)(V,{plugin:e,onRemoved:S},e.name))})]}),!n&&(!l||C.length===0)&&(0,O.jsx)(q,{})]})})]}):(0,O.jsx)(`div`,{className:`flex flex-col items-center justify-center h-full text-muted-foreground text-sm`,children:e(`page.selectProject`)})}function I({plugin:e,isInstalling:n,onInstall:r,onCloseInstall:a}){let{t:o}=t(`integrations`),[s,c]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-4 flex flex-col gap-3 h-full`,children:[(0,O.jsx)(`div`,{className:`flex items-start gap-2`,children:(0,O.jsxs)(`div`,{className:`flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground`,children:[`v`,e.version]}),e.status===`installed`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-success/20 text-accent-success flex items-center gap-1`,children:[(0,O.jsx)(_,{className:`w-3 h-3`}),` `,o(`card.statusActive`)]}),e.status===`deactivated`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-muted text-muted-foreground flex items-center gap-1`,children:[(0,O.jsx)(g,{className:`w-3 h-3`}),` `,o(`card.statusDeactivated`)]}),e.status===`degraded`&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-warning/20 text-accent-warning flex items-center gap-1`,children:[(0,O.jsx)(i,{className:`w-3 h-3`}),` `,o(`card.statusDegraded`)]}),e.updateAvailable&&(0,O.jsxs)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-accent-info/20 text-accent-info flex items-center gap-1`,children:[(0,O.jsx)(x,{className:`w-3 h-3`}),` `,o(`card.updateAvailable`)]})]}),e.category&&(0,O.jsx)(`p`,{className:`text-[10px] text-muted-foreground mt-0.5`,children:e.category})]})}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground leading-relaxed`,children:e.description}),e.whatItDoes.length>0&&(0,O.jsx)(`ul`,{className:`text-xs space-y-1 list-disc pl-4 text-foreground/80`,children:e.whatItDoes.map((e,t)=>(0,O.jsx)(`li`,{children:e},t))}),e.requirements.length>0&&(0,O.jsx)(`div`,{className:`text-[10px] text-muted-foreground`,children:o(`card.requires`,{list:e.requirements.map(e=>`${e.name}${e.minVersion?` ≥ ${e.minVersion}`:``}`).join(`, `)})}),e.healthReason&&e.status===`degraded`&&(0,O.jsx)(`div`,{className:`text-[11px] text-accent-warning`,children:e.healthReason}),e.status===`deactivated`&&(0,O.jsx)(`div`,{className:`text-[11px] text-muted-foreground leading-relaxed`,children:(0,O.jsx)(C,{t:o,i18nKey:`card.deactivatedHint`,components:{strong:(0,O.jsx)(`strong`,{})}})}),e.marketplaceConflicts&&e.marketplaceConflicts.length>0&&(0,O.jsx)(B,{pluginName:e.name,conflicts:e.marketplaceConflicts}),e.marketplaceCachedButDisabled&&e.marketplaceCachedButDisabled.length>0&&(0,O.jsx)(R,{keys:e.marketplaceCachedButDisabled}),e.updateAvailable&&(0,O.jsx)(z,{pluginName:e.name}),(0,O.jsx)(`div`,{className:`mt-auto pt-2 flex items-center justify-end gap-2`,children:e.status===`not-installed`?(0,O.jsx)(`button`,{type:`button`,onClick:r,className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white hover:opacity-90`,children:o(`card.install`)}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(L,{pluginName:e.name,active:e.status===`installed`}),(0,O.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,O.jsx)(u,{className:`w-3 h-3`}),` `,o(`card.uninstall`)]})]})}),n&&(0,O.jsx)(H,{pluginName:e.name,onClose:a}),s&&(0,O.jsx)(U,{pluginName:e.name,onClose:()=>c(!1),onUninstalled:()=>{c(!1)}})]})}function L({pluginName:e,active:n}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(!1),[o,s]=(0,D.useState)(null);return(0,O.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,O.jsx)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0),s(null);try{let t=`${T()}/plugins/${e}/${n?`deactivate`:`activate`}`,r=await fetch(t,{method:`POST`});if(!r.ok)throw Error((await r.json()).error??`HTTP ${r.status}`)}catch(e){s(e.message)}finally{a(!1)}},role:`switch`,"aria-checked":n,className:`relative inline-flex items-center h-5 w-9 rounded-full transition-colors disabled:opacity-50 ${n?`bg-accent-success`:`bg-muted`}`,title:r(n?`toggle.titleActive`:`toggle.titleDeactivated`),children:(0,O.jsx)(`span`,{className:`inline-block h-4 w-4 rounded-full bg-white shadow transition-transform ${n?`translate-x-4`:`translate-x-0.5`}`})}),(0,O.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(n?`card.statusActive`:`common:states.off`)}),o&&(0,O.jsx)(`span`,{className:`text-[10px] text-destructive`,children:o})]})}function R({keys:e}){let{t:n}=t(`integrations`);return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(i,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:n,i18nKey:`cachedNotice.body`,components:{strong:(0,O.jsx)(`strong`,{}),code:(0,O.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,O.jsx)(`div`,{className:`pl-5 space-y-0.5`,children:e.map(e=>(0,O.jsxs)(`pre`,{className:`text-[10px] bg-muted/40 rounded px-1.5 py-0.5 inline-block font-mono`,children:[`/plugin uninstall `,e]},e))}),(0,O.jsx)(`div`,{className:`pl-5 text-[10px] text-muted-foreground`,children:n(`cachedNotice.runInstruction`)})]})}function z({pluginName:e}){let{t:n}=t(`integrations`),[r,i]=(0,D.useState)(!1),[a,o]=(0,D.useState)(null);return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-accent-info/30 bg-accent-info/5 p-2 leading-relaxed space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(x,{className:`w-3 h-3 text-accent-info mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:n,i18nKey:`update.body`,components:{code:(0,O.jsx)(`code`,{className:`bg-muted px-1 rounded`})}})})]}),(0,O.jsxs)(`button`,{type:`button`,disabled:r,onClick:async()=>{i(!0),o(null);try{let t=await fetch(`${T()}/plugins/${e}/update`,{method:`POST`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){o(e.message)}finally{i(!1)}},className:`text-[10px] px-2 py-0.5 rounded border border-accent-info/40 hover:bg-accent-info/10 disabled:opacity-50 flex items-center gap-1`,children:[r&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),(0,O.jsx)(C,{t:n,i18nKey:`update.button`,components:{code:(0,O.jsx)(`code`,{})}})]}),a&&(0,O.jsx)(`div`,{className:`text-destructive text-[10px]`,children:a})]})}function B({pluginName:e,conflicts:n}){let{t:r}=t(`integrations`),[a,o]=(0,D.useState)(null),[s,l]=(0,D.useState)(null),u=async e=>{o(e),l(null);try{let t=await fetch(`${T()}/plugins/_marketplace/disable`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({key:e})});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`)}catch(e){l(e.message)}finally{o(null)}};return(0,O.jsxs)(`div`,{className:`text-[11px] rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-2 leading-relaxed space-y-1.5`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-1.5`,children:[(0,O.jsx)(i,{className:`w-3 h-3 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:(0,O.jsx)(C,{t:r,i18nKey:`conflict.body`,values:{name:e},components:{strong:(0,O.jsx)(`strong`,{})}})})]}),(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-1`,children:n.map(e=>(0,O.jsxs)(`button`,{type:`button`,disabled:a===e,onClick:()=>u(e),className:`text-[10px] px-2 py-0.5 rounded border border-yellow-500/40 aurora-light:border-accent-warning/40 hover:bg-yellow-500/10 aurora-light:hover:bg-accent-warning/10 disabled:opacity-50 flex items-center gap-1`,children:[a===e&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),(0,O.jsx)(C,{t:r,i18nKey:`conflict.disableButton`,values:{key:e},components:{code:(0,O.jsx)(`code`,{})}})]},e))}),s&&(0,O.jsx)(`div`,{className:`text-destructive`,children:s})]})}function V({plugin:e,onRemoved:n}){let{t:r}=t(`integrations`),[i,a]=(0,D.useState)(!1);return(0,O.jsxs)(`div`,{className:`rounded-lg border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 p-4 flex flex-col gap-3`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.name}),(0,O.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded bg-yellow-500/20 aurora-light:bg-accent-warning/15 text-yellow-500 aurora-light:text-accent-warning`,children:r(`orphan.badge`)})]}),(0,O.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.description}),(0,O.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,O.jsxs)(`button`,{type:`button`,disabled:i,onClick:async()=>{a(!0);try{await fetch(`${T()}/plugins/${e.name}`,{method:`DELETE`}),n()}finally{a(!1)}},className:`text-xs px-3 py-1.5 rounded-md border border-border hover:bg-destructive/10 hover:text-destructive flex items-center gap-1.5`,children:[(0,O.jsx)(u,{className:`w-3 h-3`}),` `,r(`orphan.removeButton`)]})})]})}function H({pluginName:e,onClose:n}){let{t:r}=t(`integrations`),[o,s]=(0,D.useState)(null),[l,u]=(0,D.useState)(null),[d,f]=(0,D.useState)(!1),[p,m]=(0,D.useState)(null),[h,v]=(0,D.useState)([]),[y,b]=(0,D.useState)(null),[S,C]=(0,D.useState)([]),{registerHandler:w,unregisterHandler:E}=a(),k=(0,D.useCallback)(()=>{s(null),u(null),fetch(`${T()}/plugins/${e}/preview-install`).then(e=>e.ok?e.json():Promise.reject(Error(`HTTP ${e.status}`))).then(e=>s(e)).catch(e=>u(e.message))},[e]);(0,D.useEffect)(()=>{k()},[k]),(0,D.useEffect)(()=>(w(`install-${e}`,t=>{let n=t;if(n.type===`plugin.install_progress`&&n.name===e&&n.line&&v(e=>[...e,n.line]),n.type===`plugin.prereq_install_progress`&&n.line&&C(e=>[...e,n.line]),n.type===`plugin.prereq_installed`){b(null);let e=n.reason;e&&C(t=>[...t,`► ${e}`]),n.ok&&k()}}),()=>E(`install-${e}`)),[e,w,E,k]);let A=async e=>{b(e),C([r(`installDialog.installingPrereq`,{name:e})]);try{await fetch(`${T()}/plugins/_prerequisites/${e}/install`,{method:`POST`})}catch(e){C(t=>[...t,r(`installDialog.prereqStartFailed`,{message:e.message})]),b(null)}},j=(o?.requirements??[]).every(e=>e.installed&&e.executable&&e.meetsMinimum);return(0,O.jsxs)(W,{onClose:n,title:r(`installDialog.title`,{name:e}),children:[l&&(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:l}),!o&&!l&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`w-3 h-3 animate-spin`}),` `,r(`installDialog.computingChanges`)]}),o&&(0,O.jsxs)(O.Fragment,{children:[o.platformNote&&(0,O.jsxs)(`div`,{className:`flex items-start gap-2 p-2.5 rounded-md border border-yellow-500/30 aurora-light:border-accent-warning/30 bg-yellow-500/5 aurora-light:bg-accent-warning/10 text-[11px] leading-relaxed`,children:[(0,O.jsx)(i,{className:`w-3.5 h-3.5 text-yellow-500 aurora-light:text-accent-warning mt-0.5 flex-shrink-0`}),(0,O.jsx)(`span`,{children:o.platformNote})]}),(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:r(`installDialog.filesHeading`)}),(0,O.jsx)(`ul`,{className:`text-xs space-y-0.5 font-mono`,children:o.files.map((e,t)=>(0,O.jsxs)(`li`,{className:e.op===`create`?`text-accent-success`:`text-accent-info`,children:[e.op===`create`?`+ `:`~ `,e.path,e.summary&&(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,e.summary]})]},t))})]}),o.requirements.length>0&&(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:r(`installDialog.prerequisites`)}),(0,O.jsx)(`ul`,{className:`text-xs space-y-1`,children:o.requirements.map(e=>{let t=e.installed&&e.executable&&e.meetsMinimum,n=e.name===`uv`;return(0,O.jsxs)(`li`,{className:`flex items-center gap-2`,children:[t?(0,O.jsx)(_,{className:`w-3 h-3 text-accent-success`}):(0,O.jsx)(g,{className:`w-3 h-3 text-accent-warning`}),(0,O.jsxs)(`span`,{children:[e.name,e.minVersion?` ≥ ${e.minVersion}`:``]}),e.version&&(0,O.jsxs)(`span`,{className:`text-muted-foreground`,children:[`(`,e.version,`)`]}),!t&&n&&(0,O.jsxs)(`button`,{type:`button`,disabled:y===e.name,onClick:()=>A(e.name),className:`ml-auto text-[10px] px-2 py-0.5 rounded border border-border hover:bg-muted disabled:opacity-50 flex items-center gap-1`,children:[y===e.name&&(0,O.jsx)(c,{className:`w-2.5 h-2.5 animate-spin`}),r(`installDialog.autoInstall`)]})]},e.name)})}),S.length>0&&(0,O.jsx)(`pre`,{className:`mt-2 text-[11px] bg-muted/40 rounded p-2 max-h-24 overflow-auto font-mono`,children:S.join(`
|
|
2
2
|
`)})]}),h.length>0&&(0,O.jsxs)(`section`,{children:[(0,O.jsx)(`h4`,{className:`text-xs font-semibold mb-1.5`,children:r(`installDialog.progress`)}),(0,O.jsx)(`pre`,{className:`text-[11px] bg-muted/40 rounded p-2 max-h-32 overflow-auto font-mono`,children:h.join(`
|
|
3
3
|
`)})]}),p&&(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:p})]}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:r(`common:actions.cancel`)}),(0,O.jsxs)(`button`,{type:`button`,disabled:!o||!j||d,onClick:async()=>{f(!0),m(null);try{let t=await fetch(`${T()}/plugins/${e}/install`,{method:`POST`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`);setTimeout(n,1500)}catch(e){m(e.message)}finally{f(!1)}},className:`text-xs px-3 py-1.5 rounded-md bg-accent-primary text-white disabled:opacity-50 flex items-center gap-1.5`,children:[d?(0,O.jsx)(c,{className:`w-3 h-3 animate-spin`}):(0,O.jsx)(x,{className:`w-3 h-3`}),r(`card.install`)]})]})]})}function U({pluginName:e,onClose:n,onUninstalled:r}){let{t:i}=t(`integrations`),[a,o]=(0,D.useState)(!1),[s,l]=(0,D.useState)(null);return(0,O.jsxs)(W,{onClose:n,title:i(`uninstallDialog.title`,{name:e}),children:[(0,O.jsx)(`p`,{className:`text-xs`,children:(0,O.jsx)(C,{t:i,i18nKey:`uninstallDialog.body`,components:{code:(0,O.jsx)(`code`,{})}})}),s&&(0,O.jsx)(`div`,{className:`text-xs text-destructive`,children:s}),(0,O.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,O.jsx)(`button`,{type:`button`,onClick:n,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:i(`common:actions.cancel`)}),(0,O.jsxs)(`button`,{type:`button`,disabled:a,onClick:async()=>{o(!0);try{let t=await fetch(`${T()}/plugins/${e}`,{method:`DELETE`});if(!t.ok)throw Error((await t.json()).error??`HTTP ${t.status}`);r()}catch(e){l(e.message)}finally{o(!1)}},className:`text-xs px-3 py-1.5 rounded-md bg-destructive text-white disabled:opacity-50 flex items-center gap-1.5`,children:[a&&(0,O.jsx)(c,{className:`w-3 h-3 animate-spin`}),i(`card.uninstall`)]})]})]})}function W({title:e,onClose:t,children:n}){return(0,O.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/40`,role:`dialog`,tabIndex:-1,onClick:t,children:(0,O.jsxs)(`div`,{className:`bg-card border border-border rounded-lg shadow-xl w-full max-w-md p-5 flex flex-col gap-3`,onClick:e=>e.stopPropagation(),children:[(0,O.jsx)(`h3`,{className:`text-sm font-semibold`,children:e}),n]})})}function G(){return(0,O.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:Array.from({length:3},(e,t)=>(0,O.jsx)(`div`,{className:`rounded-lg border border-border bg-card p-4 h-40 animate-pulse`},t))})}function K({onRetry:e}){let{t:n}=t(`integrations`);return(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-3 text-sm text-muted-foreground`,children:[(0,O.jsx)(i,{className:`w-5 h-5 text-destructive`}),(0,O.jsx)(`p`,{children:n(`page.loadError`)}),(0,O.jsx)(`button`,{type:`button`,onClick:e,className:`text-xs px-3 py-1.5 rounded-md border border-border`,children:n(`common:actions.retry`)})]})}function q(){let{t:e}=t(`integrations`);return(0,O.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 text-sm text-muted-foreground`,children:[(0,O.jsx)(y,{className:`w-6 h-6`}),(0,O.jsx)(`p`,{children:e(`page.empty`)})]})}export{F as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,Dt as n,Et as r,G as i,H as a,Lt as o,M as s,N as c,Ot as l,P as u,Q as d,Qt as f,Rt as p,V as m,b as h,ct as g,dt as _,ft as v,gt as y,ht as b,in as x,l as S,m as C,mt as w,nn as T,o as E,p as D,rn as ee,sn as O,st as te,u as ne,ut as k,wt as A,x as j,y as M,zt as N}from"./index-DK214dak.js";import{t as P}from"./lib-Bo5s6xpe.js";import{t as re}from"./format-command-2VNoNnMv.js";var F=A(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ie=A(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),I=e(O(),1),L=p();function ae({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,L.jsx)(`div`,{className:`flex items-center`,children:t.map((n,r)=>{let i=e[n.key]??`idle`,a=r<t.length-1?e[t[r+1].key]??`idle`:null;return(0,L.jsxs)(`div`,{className:`flex items-center`,children:[(0,L.jsxs)(M,{children:[(0,L.jsx)(j,{asChild:!0,children:(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,L.jsx)(R,{state:i}),(0,L.jsx)(`span`,{className:u(`text-xs font-medium transition-colors`,i===`running`?`text-blue-400 aurora-light:text-accent-info`:i===`done`?`text-emerald-400 aurora-light:text-accent-success`:i===`error`?`text-red-400 aurora-light:text-destructive`:`text-muted-foreground/40`),children:n.label})]})}),(0,L.jsxs)(h,{side:`bottom`,className:`max-w-[200px]`,children:[(0,L.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,L.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),a!==null&&(0,L.jsx)(`div`,{className:u(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,a===`done`||i===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:a===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},n.key)})})}function R({state:e}){return(0,L.jsxs)(`div`,{className:u(`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300`,e===`running`?`bg-blue-500/10 aurora-light:bg-accent-info/10 ring-1 ring-blue-400/30 aurora-light:ring-accent-info/30 animate-pulse`:e===`done`?`bg-emerald-500/10 aurora-light:bg-accent-success/10`:e===`error`?`bg-red-500/10 aurora-light:bg-destructive/10`:`bg-muted/20`),children:[e===`running`&&(0,L.jsx)(d,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,L.jsx)(v,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,L.jsx)(_,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,L.jsx)(k,{className:`w-6 h-6 text-muted-foreground/20`})]})}function z(e,t){let n=(typeof t==`number`?t:new Date(t).getTime())-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function oe(e){let t=new Set;for(let n of e)if(n.event_type===`log`)try{let e=(JSON.parse(n.payload).line??``).match(/(?:Writing|Editing|Created?|Updated?)\s+(?:file:\s*)?([\w./\-]+\.\w+)/i);e&&t.add(e[1])}catch{}return Array.from(t).slice(0,20)}var se=new Set([`editing`,`writing`,`reading`,`searching`,`running`]);function B(e){return e.length>40?`${e.slice(0,39)}…`:e}function V(e){return typeof e!=`string`||e.length===0?``:B(e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??``)}function H(e){return typeof e!=`string`||e.length===0?``:B(e.trim().split(/\s+/)[0]??``)}function ce(e){if(typeof e!=`string`)return``;try{let t=JSON.parse(e)?.command;if(Array.isArray(t))return H(t.filter(e=>typeof e==`string`).join(` `));if(typeof t==`string`)return H(t)}catch{}return``}function U(e,t){let n=t??{},r=V(n.file_path??n.path);switch(e){case`Edit`:case`MultiEdit`:case`NotebookEdit`:case`Update`:return{step:!0,actionKey:`editing`,actionArg:r};case`Write`:case`create`:return{step:!0,actionKey:`writing`,actionArg:r};case`Read`:return{step:!0,actionKey:`reading`,actionArg:r};case`Grep`:case`Glob`:case`search`:return{step:!0,actionKey:`searching`,actionArg:B(String(n.pattern??n.query??``))};case`Bash`:case`shell`:return{step:!0,actionKey:`running`,actionArg:H(n.command)};default:return{step:!0,actionKey:`working`}}}function W(e){let t=e.event_type,n={};try{let t=JSON.parse(e.payload);t&&typeof t==`object`&&!Array.isArray(t)&&(n=t)}catch{}if(t===`assistant`){let e=n.message?.content;if(Array.isArray(e)){let t=e.filter(e=>e?.type===`tool_use`);if(t.length>0){let e=t[t.length-1];return{...U(e.name,e.input),stepCount:t.length}}if(e.some(e=>e?.type===`text`))return{step:!0,actionKey:`thinking`}}return{step:!0}}if(t===`tool_use`)return U(n.name,n.input);if(t===`item.completed`){let e=n.item,t=e?.type;return t===`agent_message`?{step:!0,actionKey:`thinking`}:t===`agent_reasoning`?{step:!0,actionKey:`reasoning`}:t===`function_call`||t===`local_shell_call`||t===`command_execution`?{step:!0,actionKey:`running`,actionArg:H(e?.command)||ce(e?.arguments)||(typeof e?.name==`string`?B(e.name):``)||(t===`local_shell_call`?`shell`:``)}:{step:!0}}return{step:!1}}var G={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function K(e,t){if(t.type===`reset`)return G;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o}=e;for(let e=r;e<n.length;e++){let t=W(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``)}return{steps:i,actionKey:a,actionArg:o,lastSeenIdx:n.length}}return e}function le({job:e,events:n,defaultOpen:r=!0,pipelineTotals:i,phases:a,phaseDefinitions:o}){let{t:s}=t(`jobs`),[c,l]=(0,I.useState)(r),f=(0,I.useMemo)(()=>oe(n),[n]),p=e.status===`running`,m=e.status===`completed`,[h,g]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(e)},[p]);let[b,x]=(0,I.useReducer)(K,G),S=(0,I.useRef)(e.id);(0,I.useEffect)(()=>{S.current!==e.id&&(S.current=e.id,x({type:`reset`})),x({type:`consume`,events:n})},[e.id,n]);let[C,w]=(0,I.useState)(!0);(0,I.useEffect)(()=>{if(!p)return;w(!0);let e=window.setTimeout(()=>w(!1),8e3);return()=>window.clearTimeout(e)},[p,e.id]);let T=e.finished_at?z(e.started_at,e.finished_at):p?z(e.started_at,h):`—`,E=!!e.total_cost_usd_estimated,D=e.total_cost_usd==null?null:`${E?`~`:``}$${e.total_cost_usd.toFixed(4)}`,ee=e.num_turns==null?null:String(e.num_turns),O=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),te=O==null?null:`${(O/1e3).toFixed(1)}k`,ne=(0,I.useMemo)(()=>!a||!o?null:o.find(e=>a[e.key]===`running`)?.label??null,[a,o]),k=p&&b.steps===0?`connecting`:b.actionKey||`thinking`,A=se.has(k)&&b.actionArg!==``,j=se.has(k)&&!A?`working`:k,M=A?s(`statusPanel.activity.${j}`,{arg:b.actionArg}):s(`statusPanel.activity.${j}`),N=ne??(p&&b.steps===0?s(`statusPanel.activity.starting`):null),P=b.steps>0?s(`statusPanel.steps`,{count:b.steps}):null,re=s(p?`statusPanel.inProgress`:m?`statusPanel.completed`:`statusPanel.failed`),F=p?`border-accent-info/20 bg-accent-info/5`:m?`border-emerald-500/20 aurora-light:border-accent-success/30 bg-emerald-500/5 aurora-light:bg-accent-success/5`:`border-red-500/20 aurora-light:border-destructive/30 bg-red-500/5 aurora-light:bg-destructive/5`,ie=p?d:m?v:_,ae=p?`w-4 h-4 text-accent-info shrink-0 animate-spin`:m?`w-4 h-4 text-emerald-400 aurora-light:text-accent-success shrink-0`:`w-4 h-4 text-red-400 aurora-light:text-destructive shrink-0`;return(0,L.jsxs)(`div`,{className:u(`mx-4 my-2 rounded-xl border transition-colors duration-500`,F),children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>l(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,L.jsx)(ie,{className:ae,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:re}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`tabular-nums`,children:T}),p?P&&(0,L.jsx)(`span`,{className:`tabular-nums`,children:P}):(0,L.jsxs)(L.Fragment,{children:[D&&(0,L.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:D}),f.length>0&&(0,L.jsx)(`span`,{children:s(`statusPanel.filesCount`,{count:f.length})})]})]}),(0,L.jsx)(y,{className:u(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,L.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:p?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneInProgress`)}),(0,L.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[s(`statusPanel.duration`),(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:s(`statusPanel.liveTooltip`),"aria-label":s(`statusPanel.liveTooltip`)})]}),(0,L.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:T})]}),(0,L.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,L.jsx)(d,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),N&&(0,L.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:N}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:M}),P&&(0,L.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,P]})]})]}),C&&(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:s(`statusPanel.explainer`)}),(0,L.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:s(`statusPanel.zoneFinalPending`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,L.jsx)(Y,{label:s(`statusPanel.cost`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.costTooltip`)}),(0,L.jsx)(Y,{label:s(`statusPanel.turns`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)}),(0,L.jsx)(Y,{label:s(`statusPanel.tokens`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)})]})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneFinal`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,L.jsx)(q,{label:s(`statusPanel.duration`),value:T}),(0,L.jsx)(J,{label:s(`statusPanel.cost`),value:D,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:s(`statusPanel.notAvailable`)}),(0,L.jsx)(J,{label:s(`statusPanel.turns`),value:ee,naCaption:s(`statusPanel.notAvailable`)}),(0,L.jsx)(J,{label:s(`statusPanel.tokens`),value:te,naCaption:s(`statusPanel.notAvailable`)})]}),i&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.pipelineTotal`,{count:i.jobCount})}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsx)(q,{label:s(`statusPanel.totalCost`),value:`$${i.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,L.jsx)(q,{label:s(`statusPanel.totalTokens`),value:`${((i.totalTokensIn+i.totalTokensOut+i.totalTokensCacheRead+i.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]})]}),f.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.filesModified`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,L.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]})]})})]})}function q({label:e,value:t,valueClass:n}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,L.jsx)(`p`,{className:u(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function J({label:e,value:t,valueClass:n,naCaption:r}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,L.jsx)(`p`,{className:u(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function Y({label:e,caption:t,tooltip:n}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,L.jsx)(F,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,L.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var X=4;function ue({tickets:e,onTicketClick:n}){let{t:r}=t(`jobs`),[i,a]=(0,I.useState)(!1);if(e.length===0)return null;let o=e.length>=X&&!i?e.slice(0,1):e,s=e.length-o.length;return(0,L.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[o.map(e=>(0,L.jsx)(Z,{ticket:e,onClick:()=>n(e.id)},e.id)),s>0&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showMore`,{count:s}),(0,L.jsx)(y,{className:`w-3 h-3`})]}),i&&e.length>=X&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>a(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showLess`),(0,L.jsx)(w,{className:`w-3 h-3`})]})]})}function Z({ticket:e,onClick:n}){let{t:r}=t(`jobs`),i=e.title==null,a=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return i?(0,L.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,L.jsx)(`span`,{className:u(a,`text-muted-foreground bg-muted/20 select-none`),title:r(`ticketHeader.deletedTooltip`),children:r(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,L.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,L.jsxs)(`span`,{className:u(a,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,L.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function Q(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}function de(e,t){let n=`${e.id??t}`,r=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:r}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:r}:Q(t)?{id:n,content:t,type:`assistant`,timestamp:r}:{id:n,content:t,type:`plain`,timestamp:r}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),i=[];return t.duration_ms&&i.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&i.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&i.push(l.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${l.t(`jobs:logViewer.completed`)}${i.length?` — ${i.join(` · `)}`:``}`,type:`result`,timestamp:r}}catch{return null}return null}function $(e){let t=`none`,n=[];for(let r of e){let e=r.type;if(e!==`plain`&&e!==`log`){t=`none`,n.push(r);continue}let i=r.content;i.startsWith(`--- `)?(t=`saw_minus`,n.push({...r,type:`diff-meta`})):t===`saw_minus`&&i.startsWith(`+++ `)?(t=`active`,n.push({...r,type:`diff-meta`})):t===`active`&&i.startsWith(`@@ `)?n.push({...r,type:`diff-hunk`}):t===`active`&&i.startsWith(`+`)&&!i.startsWith(`+++`)?n.push({...r,type:`diff-add`}):t===`active`&&i.startsWith(`-`)&&!i.startsWith(`---`)?n.push({...r,type:`diff-remove`}):(t===`active`&&(i.startsWith(` `)||i===``)||(t=`none`),n.push(r))}return n}function fe(e){let t=[{key:`__preamble__`,header:null,lines:[]}];for(let n of e)n.type===`phase`?t.push({key:n.id,header:n,lines:[]}):t[t.length-1].lines.push(n);return t.filter(e=>e.header!==null||e.lines.length>0)}function pe({events:e,isLoading:n}){let{t:r,i18n:i}=t(`jobs`),[o,s]=(0,I.useState)(``),[l,u]=(0,I.useState)(!0),[d,p]=(0,I.useState)(new Set),m=(0,I.useRef)(null),h=(0,I.useRef)(null),{processedLines:_,groups:v,totalLines:b}=(0,I.useMemo)(()=>{let t=e.map((e,t)=>de(e,t)).filter(e=>e!==null),n=[];for(let e of t){let t=n.length>0?n[n.length-1]:null;e.type===`assistant`&&t?.type===`assistant`?t.content+=`
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{$t as t,Dt as n,Et as r,G as i,H as a,Lt as o,M as s,N as c,Ot as l,P as u,Q as d,Qt as f,Rt as p,V as m,b as h,ct as g,dt as _,ft as v,gt as y,ht as b,in as x,l as S,m as C,mt as w,nn as T,o as E,p as D,rn as ee,sn as O,st as te,u as ne,ut as k,wt as A,x as j,y as M,zt as N}from"./index-BXoHFtfG.js";import{t as P}from"./lib-D6M_MvoC.js";import{t as re}from"./format-command-2VNoNnMv.js";var F=A(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),ie=A(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),I=e(O(),1),L=p();function ae({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,L.jsx)(`div`,{className:`flex items-center`,children:t.map((n,r)=>{let i=e[n.key]??`idle`,a=r<t.length-1?e[t[r+1].key]??`idle`:null;return(0,L.jsxs)(`div`,{className:`flex items-center`,children:[(0,L.jsxs)(M,{children:[(0,L.jsx)(j,{asChild:!0,children:(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,L.jsx)(R,{state:i}),(0,L.jsx)(`span`,{className:u(`text-xs font-medium transition-colors`,i===`running`?`text-blue-400 aurora-light:text-accent-info`:i===`done`?`text-emerald-400 aurora-light:text-accent-success`:i===`error`?`text-red-400 aurora-light:text-destructive`:`text-muted-foreground/40`),children:n.label})]})}),(0,L.jsxs)(h,{side:`bottom`,className:`max-w-[200px]`,children:[(0,L.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,L.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),a!==null&&(0,L.jsx)(`div`,{className:u(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,a===`done`||i===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:a===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},n.key)})})}function R({state:e}){return(0,L.jsxs)(`div`,{className:u(`flex items-center justify-center w-10 h-10 rounded-full transition-all duration-300`,e===`running`?`bg-blue-500/10 aurora-light:bg-accent-info/10 ring-1 ring-blue-400/30 aurora-light:ring-accent-info/30 animate-pulse`:e===`done`?`bg-emerald-500/10 aurora-light:bg-accent-success/10`:e===`error`?`bg-red-500/10 aurora-light:bg-destructive/10`:`bg-muted/20`),children:[e===`running`&&(0,L.jsx)(d,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,L.jsx)(v,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,L.jsx)(_,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,L.jsx)(k,{className:`w-6 h-6 text-muted-foreground/20`})]})}function z(e,t){let n=(typeof t==`number`?t:new Date(t).getTime())-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function oe(e){let t=new Set;for(let n of e)if(n.event_type===`log`)try{let e=(JSON.parse(n.payload).line??``).match(/(?:Writing|Editing|Created?|Updated?)\s+(?:file:\s*)?([\w./\-]+\.\w+)/i);e&&t.add(e[1])}catch{}return Array.from(t).slice(0,20)}var se=new Set([`editing`,`writing`,`reading`,`searching`,`running`]);function B(e){return e.length>40?`${e.slice(0,39)}…`:e}function V(e){return typeof e!=`string`||e.length===0?``:B(e.replace(/\\/g,`/`).split(`/`).filter(Boolean).pop()??``)}function H(e){return typeof e!=`string`||e.length===0?``:B(e.trim().split(/\s+/)[0]??``)}function ce(e){if(typeof e!=`string`)return``;try{let t=JSON.parse(e)?.command;if(Array.isArray(t))return H(t.filter(e=>typeof e==`string`).join(` `));if(typeof t==`string`)return H(t)}catch{}return``}function U(e,t){let n=t??{},r=V(n.file_path??n.path);switch(e){case`Edit`:case`MultiEdit`:case`NotebookEdit`:case`Update`:return{step:!0,actionKey:`editing`,actionArg:r};case`Write`:case`create`:return{step:!0,actionKey:`writing`,actionArg:r};case`Read`:return{step:!0,actionKey:`reading`,actionArg:r};case`Grep`:case`Glob`:case`search`:return{step:!0,actionKey:`searching`,actionArg:B(String(n.pattern??n.query??``))};case`Bash`:case`shell`:return{step:!0,actionKey:`running`,actionArg:H(n.command)};default:return{step:!0,actionKey:`working`}}}function W(e){let t=e.event_type,n={};try{let t=JSON.parse(e.payload);t&&typeof t==`object`&&!Array.isArray(t)&&(n=t)}catch{}if(t===`assistant`){let e=n.message?.content;if(Array.isArray(e)){let t=e.filter(e=>e?.type===`tool_use`);if(t.length>0){let e=t[t.length-1];return{...U(e.name,e.input),stepCount:t.length}}if(e.some(e=>e?.type===`text`))return{step:!0,actionKey:`thinking`}}return{step:!0}}if(t===`tool_use`)return U(n.name,n.input);if(t===`item.completed`){let e=n.item,t=e?.type;return t===`agent_message`?{step:!0,actionKey:`thinking`}:t===`agent_reasoning`?{step:!0,actionKey:`reasoning`}:t===`function_call`||t===`local_shell_call`||t===`command_execution`?{step:!0,actionKey:`running`,actionArg:H(e?.command)||ce(e?.arguments)||(typeof e?.name==`string`?B(e.name):``)||(t===`local_shell_call`?`shell`:``)}:{step:!0}}return{step:!1}}var G={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function K(e,t){if(t.type===`reset`)return G;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o}=e;for(let e=r;e<n.length;e++){let t=W(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``)}return{steps:i,actionKey:a,actionArg:o,lastSeenIdx:n.length}}return e}function le({job:e,events:n,defaultOpen:r=!0,pipelineTotals:i,phases:a,phaseDefinitions:o}){let{t:s}=t(`jobs`),[c,l]=(0,I.useState)(r),f=(0,I.useMemo)(()=>oe(n),[n]),p=e.status===`running`,m=e.status===`completed`,[h,g]=(0,I.useState)(()=>Date.now());(0,I.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>g(Date.now()),1e3);return()=>window.clearInterval(e)},[p]);let[b,x]=(0,I.useReducer)(K,G),S=(0,I.useRef)(e.id);(0,I.useEffect)(()=>{S.current!==e.id&&(S.current=e.id,x({type:`reset`})),x({type:`consume`,events:n})},[e.id,n]);let[C,w]=(0,I.useState)(!0);(0,I.useEffect)(()=>{if(!p)return;w(!0);let e=window.setTimeout(()=>w(!1),8e3);return()=>window.clearTimeout(e)},[p,e.id]);let T=e.finished_at?z(e.started_at,e.finished_at):p?z(e.started_at,h):`—`,E=!!e.total_cost_usd_estimated,D=e.total_cost_usd==null?null:`${E?`~`:``}$${e.total_cost_usd.toFixed(4)}`,ee=e.num_turns==null?null:String(e.num_turns),O=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),te=O==null?null:`${(O/1e3).toFixed(1)}k`,ne=(0,I.useMemo)(()=>!a||!o?null:o.find(e=>a[e.key]===`running`)?.label??null,[a,o]),k=p&&b.steps===0?`connecting`:b.actionKey||`thinking`,A=se.has(k)&&b.actionArg!==``,j=se.has(k)&&!A?`working`:k,M=A?s(`statusPanel.activity.${j}`,{arg:b.actionArg}):s(`statusPanel.activity.${j}`),N=ne??(p&&b.steps===0?s(`statusPanel.activity.starting`):null),P=b.steps>0?s(`statusPanel.steps`,{count:b.steps}):null,re=s(p?`statusPanel.inProgress`:m?`statusPanel.completed`:`statusPanel.failed`),F=p?`border-accent-info/20 bg-accent-info/5`:m?`border-emerald-500/20 aurora-light:border-accent-success/30 bg-emerald-500/5 aurora-light:bg-accent-success/5`:`border-red-500/20 aurora-light:border-destructive/30 bg-red-500/5 aurora-light:bg-destructive/5`,ie=p?d:m?v:_,ae=p?`w-4 h-4 text-accent-info shrink-0 animate-spin`:m?`w-4 h-4 text-emerald-400 aurora-light:text-accent-success shrink-0`:`w-4 h-4 text-red-400 aurora-light:text-destructive shrink-0`;return(0,L.jsxs)(`div`,{className:u(`mx-4 my-2 rounded-xl border transition-colors duration-500`,F),children:[(0,L.jsxs)(`button`,{type:`button`,onClick:()=>l(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,L.jsx)(ie,{className:ae,"aria-hidden":`true`}),(0,L.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:re}),(0,L.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,L.jsx)(`span`,{className:`tabular-nums`,children:T}),p?P&&(0,L.jsx)(`span`,{className:`tabular-nums`,children:P}):(0,L.jsxs)(L.Fragment,{children:[D&&(0,L.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:D}),f.length>0&&(0,L.jsx)(`span`,{children:s(`statusPanel.filesCount`,{count:f.length})})]})]}),(0,L.jsx)(y,{className:u(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,L.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:p?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneInProgress`)}),(0,L.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[s(`statusPanel.duration`),(0,L.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:s(`statusPanel.liveTooltip`),"aria-label":s(`statusPanel.liveTooltip`)})]}),(0,L.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:T})]}),(0,L.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,L.jsx)(d,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),N&&(0,L.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:N}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:M}),P&&(0,L.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,P]})]})]}),C&&(0,L.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:s(`statusPanel.explainer`)}),(0,L.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:s(`statusPanel.zoneFinalPending`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,L.jsx)(Y,{label:s(`statusPanel.cost`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.costTooltip`)}),(0,L.jsx)(Y,{label:s(`statusPanel.turns`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)}),(0,L.jsx)(Y,{label:s(`statusPanel.tokens`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)})]})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneFinal`)}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,L.jsx)(q,{label:s(`statusPanel.duration`),value:T}),(0,L.jsx)(J,{label:s(`statusPanel.cost`),value:D,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:s(`statusPanel.notAvailable`)}),(0,L.jsx)(J,{label:s(`statusPanel.turns`),value:ee,naCaption:s(`statusPanel.notAvailable`)}),(0,L.jsx)(J,{label:s(`statusPanel.tokens`),value:te,naCaption:s(`statusPanel.notAvailable`)})]}),i&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.pipelineTotal`,{count:i.jobCount})}),(0,L.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,L.jsx)(q,{label:s(`statusPanel.totalCost`),value:`$${i.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,L.jsx)(q,{label:s(`statusPanel.totalTokens`),value:`${((i.totalTokensIn+i.totalTokensOut+i.totalTokensCacheRead+i.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]})]}),f.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.filesModified`)}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:f.map(e=>(0,L.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]})]})})]})}function q({label:e,value:t,valueClass:n}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,L.jsx)(`p`,{className:u(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function J({label:e,value:t,valueClass:n,naCaption:r}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,L.jsx)(`p`,{className:u(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function Y({label:e,caption:t,tooltip:n}){return(0,L.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,L.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,L.jsx)(F,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,L.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,L.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var X=4;function ue({tickets:e,onTicketClick:n}){let{t:r}=t(`jobs`),[i,a]=(0,I.useState)(!1);if(e.length===0)return null;let o=e.length>=X&&!i?e.slice(0,1):e,s=e.length-o.length;return(0,L.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[o.map(e=>(0,L.jsx)(Z,{ticket:e,onClick:()=>n(e.id)},e.id)),s>0&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showMore`,{count:s}),(0,L.jsx)(y,{className:`w-3 h-3`})]}),i&&e.length>=X&&(0,L.jsxs)(`button`,{type:`button`,onClick:()=>a(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showLess`),(0,L.jsx)(w,{className:`w-3 h-3`})]})]})}function Z({ticket:e,onClick:n}){let{t:r}=t(`jobs`),i=e.title==null,a=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return i?(0,L.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,L.jsx)(`span`,{className:u(a,`text-muted-foreground bg-muted/20 select-none`),title:r(`ticketHeader.deletedTooltip`),children:r(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,L.jsxs)(`button`,{type:`button`,onClick:n,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,L.jsxs)(`span`,{className:u(a,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,L.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function Q(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}function de(e,t){let n=`${e.id??t}`,r=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:r}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:r}:Q(t)?{id:n,content:t,type:`assistant`,timestamp:r}:{id:n,content:t,type:`plain`,timestamp:r}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),i=[];return t.duration_ms&&i.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&i.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&i.push(l.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${l.t(`jobs:logViewer.completed`)}${i.length?` — ${i.join(` · `)}`:``}`,type:`result`,timestamp:r}}catch{return null}return null}function $(e){let t=`none`,n=[];for(let r of e){let e=r.type;if(e!==`plain`&&e!==`log`){t=`none`,n.push(r);continue}let i=r.content;i.startsWith(`--- `)?(t=`saw_minus`,n.push({...r,type:`diff-meta`})):t===`saw_minus`&&i.startsWith(`+++ `)?(t=`active`,n.push({...r,type:`diff-meta`})):t===`active`&&i.startsWith(`@@ `)?n.push({...r,type:`diff-hunk`}):t===`active`&&i.startsWith(`+`)&&!i.startsWith(`+++`)?n.push({...r,type:`diff-add`}):t===`active`&&i.startsWith(`-`)&&!i.startsWith(`---`)?n.push({...r,type:`diff-remove`}):(t===`active`&&(i.startsWith(` `)||i===``)||(t=`none`),n.push(r))}return n}function fe(e){let t=[{key:`__preamble__`,header:null,lines:[]}];for(let n of e)n.type===`phase`?t.push({key:n.id,header:n,lines:[]}):t[t.length-1].lines.push(n);return t.filter(e=>e.header!==null||e.lines.length>0)}function pe({events:e,isLoading:n}){let{t:r,i18n:i}=t(`jobs`),[o,s]=(0,I.useState)(``),[l,u]=(0,I.useState)(!0),[d,p]=(0,I.useState)(new Set),m=(0,I.useRef)(null),h=(0,I.useRef)(null),{processedLines:_,groups:v,totalLines:b}=(0,I.useMemo)(()=>{let t=e.map((e,t)=>de(e,t)).filter(e=>e!==null),n=[];for(let e of t){let t=n.length>0?n[n.length-1]:null;e.type===`assistant`&&t?.type===`assistant`?t.content+=`
|
|
2
2
|
`+e.content:n.push({...e})}let r=$(n);return{processedLines:r,groups:fe(r),totalLines:r.length}},[e,i.language]),x=(0,I.useMemo)(()=>{if(!o)return b;let e=o.toLowerCase();return _.filter(t=>t.content.toLowerCase().includes(e)).length},[o,_,b]),S=(0,I.useCallback)(()=>{let e=h.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,I.useEffect)(()=>{l&&S()},[e.length,l,S]);function C(){let e=h.current;e&&u(e.scrollHeight-e.scrollTop-e.clientHeight<50)}function w(e){p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return n?(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.loading`)})}):b===0?(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.empty`)})}):(0,L.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,L.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,L.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,L.jsx)(a,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,L.jsx)(E,{placeholder:r(`logViewer.filterPlaceholder`),value:o,onChange:e=>s(e.target.value),className:`pl-7 h-7`})]}),(0,L.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:()=>{let e=_.map(e=>e.content).join(`
|
|
3
3
|
`);navigator.clipboard.writeText(e).then(()=>{f.success(r(`logViewer.copySuccess`))}).catch(()=>{f.error(r(`logViewer.copyFailed`))})},children:(0,L.jsx)(g,{className:`w-3.5 h-3.5`})}),(0,L.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`logViewer.lineCount`,{filtered:x,total:b})})]}),(0,L.jsxs)(`div`,{ref:h,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:C,children:[v.map(e=>(0,L.jsx)(me,{group:e,filter:o,collapsed:d.has(e.key),onToggle:()=>w(e.key)},e.key)),(0,L.jsx)(`div`,{ref:m})]}),!l&&(0,L.jsxs)(c,{size:`sm`,variant:`secondary`,onClick:()=>{u(!0),S()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,L.jsx)(y,{className:`w-3 h-3`}),r(`logViewer.jumpToBottom`)]})]})}var me=(0,I.memo)(function({group:e,filter:n,collapsed:r,onToggle:i}){let{t:a}=t(`jobs`),o=n?e.lines.filter(e=>e.content.toLowerCase().includes(n.toLowerCase())):e.lines;if(e.header===null)return o.length===0?null:(0,L.jsx)(`div`,{children:o.map((e,t)=>(0,L.jsx)(ge,{line:e,even:t%2==0},e.id))});let s=e.header.content;return(0,L.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,L.jsxs)(`button`,{type:`button`,onClick:i,className:u(`flex items-center gap-2 w-full text-left px-3 py-2`,`bg-primary/5 border-b border-primary/20`,`hover:bg-primary/10 transition-colors duration-150 cursor-pointer`),children:[(0,L.jsx)(b,{className:u(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!r&&`rotate-90`)}),(0,L.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:s}),e.header.timestamp&&(0,L.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 font-mono tabular-nums shrink-0`,children:new Date(e.header.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),(0,L.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:a(`logViewer.phaseLines`,{count:e.lines.length})})]}),!r&&(0,L.jsx)(`div`,{className:`bg-muted/5`,children:o.length===0?(0,L.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:a(n?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):o.map((e,t)=>(0,L.jsx)(ge,{line:e,even:t%2==0},e.id))})]})}),he=[P],ge=(0,I.memo)(function({line:e,even:t}){let n=e.type===`assistant`,r=e.type===`diff-add`,i=e.type===`diff-remove`,a=e.type===`diff-meta`,o=e.type===`diff-hunk`;return(0,L.jsxs)(`div`,{className:u(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!(r||i||a||o)&&(t?`bg-muted/20`:`bg-transparent`),e.type===`result`&&`bg-emerald-500/5 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/40 aurora-light:border-accent-success/40 mt-2 py-2`,r&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,i&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,a&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,o&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,L.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0 mt-0.5 w-[52px] font-mono tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),n?(0,L.jsx)(`div`,{className:`flex-1 min-w-0 prose prose-invert prose-xs max-w-none
|
|
4
4
|
prose-p:my-1 prose-p:leading-relaxed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-CilyBKbf.js";import{$ as t,$t as n,D as r,Dt as i,E as a,Et as o,I as s,M as c,N as l,O as u,Qt as d,R as f,Rt as p,T as ee,b as m,dt as h,ft as g,k as _,lt as v,m as y,n as b,p as x,rn as S,sn as C,u as w,w as T,wt as E,x as D,y as O,zt as k}from"./index-DK214dak.js";import{t as A}from"./ExportDropdown-DO-GGiMh.js";import{t as j}from"./useProjectCache-DVNypkmR.js";import{t as te}from"./format-command-2VNoNnMv.js";var ne=E(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),M=e(C(),1),N=p();function P(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function F(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function I(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function L({label:e,a:t,b:n,highlight:r}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function R(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function re({jobIds:e,onClose:t}){let{t:r}=n(`jobs`),[i,a]=(0,M.useState)(null),[o,c]=(0,M.useState)(!0),[l,u]=(0,M.useState)(null);(0,M.useEffect)(()=>{let t=new AbortController;return fetch(`${k()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a(e),c(!1)}).catch(e=>{e.name!==`AbortError`&&(u(e.message),c(!1))}),()=>t.abort()},[e]);function d(e,t){return(0,N.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:r(`comparison.jobN`,{n:t+1})}),(0,N.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,N.jsx)(g,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,N.jsx)(h,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,N.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:r(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:t,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl border border-border/30 bg-popover p-5 shadow-xl space-y-4 mx-4`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`comparison.title`)}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,N.jsx)(s,{className:`w-4 h-4`})})]}),o&&(0,N.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,N.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:r(`comparison.loadFailed`,{error:l})}),i&&(()=>{let[e,t]=i.jobs,n=R(e.durationMs,t.durationMs,!0),a=R(e.totalCostUsd,t.totalCostUsd,!0),o=R(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,N.jsx)(`div`,{}),d(e,0),d(t,1)]}),(0,N.jsx)(L,{label:r(`comparison.duration`),a:P(e.durationMs),b:P(t.durationMs),highlight:n}),(0,N.jsx)(L,{label:r(`comparison.cost`),a:F(e.totalCostUsd),b:F(t.totalCostUsd),highlight:a}),(0,N.jsx)(L,{label:r(`comparison.tokensOut`),a:I(e.tokensOut),b:I(t.tokensOut),highlight:o}),(0,N.jsx)(L,{label:r(`comparison.tokensIn`),a:I(e.tokensIn),b:I(t.tokensIn),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.cacheRead`),a:I(e.tokensCacheRead),b:I(t.tokensCacheRead),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,N.jsx)(L,{label:r(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),i&&(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:r(`comparison.betterValueHint`)})]})})}var ie={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.done`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queuedToRun`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`warning`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}},ae=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],z={critical:{className:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,labelKey:`recent.priority.critical`},high:{className:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,labelKey:`recent.priority.high`},normal:{className:``,labelKey:`recent.priority.normal`},low:{className:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`,labelKey:`recent.priority.low`}};function oe(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function se(e,t){if(!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();if(n<0)return null;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function ce(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function le(e){try{return w(new Date(e),{addSuffix:!0,locale:i()})}catch{return e}}var B=10;function V({jobs:e,isLoading:i,onJobsCleared:s,onProposalClick:p,onProposalDelete:h}){let{t:g}=n(`jobs`),y=S(),{activeProjectId:b,projects:x}=o(),C=x.find(e=>e.id===b)?.provider,[w,E]=(0,M.useState)(null),[A,j]=(0,M.useState)(``),[P,F]=(0,M.useState)(``),[I,L]=(0,M.useState)(!1),[R,V]=(0,M.useState)(``),[H,U]=(0,M.useState)(``),[W,G]=(0,M.useState)(!1),[K,q]=(0,M.useState)(null),[J,ue]=(0,M.useState)(B),[Y,de]=(0,M.useState)(!1),[X,Z]=(0,M.useState)([]),[fe,Q]=(0,M.useState)(null);(0,M.useEffect)(()=>{ue(B)},[e.length]);function pe(){de(e=>!e),Z([])}function me(e){Z(t=>{if(t.includes(e))return t.filter(t=>t!==e);if(t.length>=2)return t;let n=[...t,e];return n.length===2&&Q(n),n})}let $=e.filter(e=>!(w&&e.status!==w||A&&e.started_at<A||P&&e.started_at>`${P}T23:59:59`)),he=e.filter(e=>!(R&&e.started_at<R||H&&e.started_at>`${H}T23:59:59`)).length;async function ge(e){G(!0);try{let t={};e===`range`&&(R&&(t.from=R),H&&(t.to=H));let n=await fetch(`${k()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.ok){let e=await n.json();d.success(g(`recent.toast.cleared`,{count:e.deleted})),L(!1),V(``),U(``),s?.()}else d.error(g(`recent.toast.clearFailed`))}catch{d.error(g(`recent.toast.networkError`))}finally{G(!1)}}return i?(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,N.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,N.jsx)(v,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:g(`recent.emptyTitle`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:g(`recent.emptyDescription`)})]}):(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${w===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:g(`recent.filterAll`,{count:e.length})}),ae.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,N.jsx)(`button`,{type:`button`,onClick:()=>E(w===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${w===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:g(`recent.filterStatus`,{status:g(`statusName.${t}`),count:n})},t)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:A,onChange:e=>j(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:g(`recent.fromDate`)}),(0,N.jsx)(`input`,{type:`date`,value:P,onChange:e=>F(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:g(`recent.toDate`)}),(A||P)&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>{j(``),F(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:g(`recent.clear`)}),(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 transition-colors ${Y?`text-foreground bg-accent`:`text-muted-foreground hover:text-foreground`}`,onClick:pe,children:(0,N.jsx)(ne,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(m,{children:g(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>L(!0),children:(0,N.jsx)(f,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(m,{children:g(`recent.clearJobs`)})]})]})]}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-accent/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[X.length===0&&g(`recent.selectTwoToCompare`),X.length===1&&g(`recent.selectOneMore`),X.length===2&&g(`recent.readyToCompare`)]}),X.length===2&&(0,N.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:g(`recent.compareAction`)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,N.jsx)(`span`,{className:`w-14`,children:g(`recent.colStatus`)}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0`,children:g(`recent.colCommand`)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:g(`recent.colDuration`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:g(`recent.colTokens`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:g(`recent.colCost`)}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:g(`recent.colStarted`)})]})]}),(0,N.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let n=ie[e.status]??ie.queued,r=oe(e.total_cost_usd),i=se(e.started_at,e.finished_at),a=ce((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),o=e.id.startsWith(`proposal:`),s=o?e.id.replace(`proposal:`,``):null,l=X.includes(e.id),u=Y&&!o&&X.length===2&&!l;return(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${l?`bg-accent/70 ring-1 ring-border`:u?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:()=>{if(Y&&!o){me(e.id);return}o&&s?p?.(s):y(`/jobs/${e.id}`)},children:[(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(`div`,{children:(0,N.jsx)(c,{variant:n.variant,children:g(n.labelKey)})})}),(0,N.jsx)(m,{children:g(n.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${z[e.priority].className}`,children:g(z[e.priority].labelKey)}),e.profile_name&&(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border border-accent-primary/40 bg-accent-primary/10 text-accent-primary/90`,children:e.profile_name})}),(0,N.jsx)(m,{children:g(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(t,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,N.jsxs)(m,{children:[g(`recent.pipelinePart`),e.depends_on_job_id&&` ${g(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,N.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:te(e.command,C)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:i??`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:a?`${a}`:`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:r??`—`}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:le(e.started_at)}),o&&s&&(0,N.jsx)(`button`,{type:`button`,className:`w-4 h-4 md:opacity-0 md:group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all`,onClick:e=>{e.stopPropagation(),q(s)},title:g(`recent.deleteProposal`),children:(0,N.jsx)(f,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,N.jsx)(`div`,{className:`pt-1 text-center`,children:(0,N.jsx)(`button`,{type:`button`,onClick:()=>ue(e=>e+B),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:g(`recent.loadMore`,{count:$.length-J})})}),I&&(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:()=>L(!1),children:(0,N.jsxs)(`div`,{className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold`,children:g(`recent.clearModal.title`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:g(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,N.jsx)(l,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:W,onClick:()=>ge(`all`),children:g(`recent.clearModal.clearAll`,{count:e.length})}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g(`recent.clearModal.orByRange`)}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:R,onChange:e=>V(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:g(`recent.clearModal.fromPlaceholder`)}),(0,N.jsx)(`input`,{type:`date`,value:H,onChange:e=>U(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:g(`recent.clearModal.toPlaceholder`)})]}),(0,N.jsx)(l,{variant:`outline`,size:`sm`,className:`w-full`,disabled:W||!R&&!H,onClick:()=>ge(`range`),children:R||H?g(`recent.clearModal.clearInRange`,{count:he}):g(`recent.clearModal.clearRange`)})]}),(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>L(!1),children:g(`common:actions.cancel`)})]})}),(0,N.jsx)(T,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,N.jsxs)(ee,{className:`max-w-sm`,children:[(0,N.jsxs)(u,{children:[(0,N.jsx)(_,{children:g(`recent.deleteProposalConfirm.title`)}),(0,N.jsx)(a,{children:g(`recent.deleteProposalConfirm.description`)})]}),(0,N.jsxs)(r,{children:[(0,N.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:g(`common:actions.cancel`)}),(0,N.jsx)(l,{variant:`destructive`,size:`sm`,onClick:()=>{K&&h?.(K),q(null)},children:g(`common:actions.delete`)})]})]})}),fe&&(0,N.jsx)(re,{jobIds:fe,onClose:()=>{Q(null),Z([]),de(!1)}})]})}function H(){let{t:e}=n(`jobs`),{activeProjectId:t}=o(),{recentJobs:i}=b(t),{data:a,isFirstLoad:s,refresh:f}=j({namespace:`jobs`,projectId:t,initialValue:i,fetcher:async()=>{let e=await fetch(`${k()}/jobs?limit=10`);return e.ok?(await e.json()).jobs:[]},pollInterval:1e4}),{data:p}=j({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async()=>{let e=await fetch(`${k()}/propose?limit=10`);return e.ok?(await e.json()).proposals:[]},pollInterval:1e4}),m={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},h=p.map(e=>({id:`proposal:${e.id}`,command:`/specrails:propose-feature ${e.idea.length>60?e.idea.slice(0,57)+`...`:e.idea}`,started_at:e.created_at,status:m[e.status]??`queued`})),g=[...a,...h].sort((e,t)=>new Date(t.started_at).getTime()-new Date(e.started_at).getTime()),[v,S]=(0,M.useState)(null),C=(0,M.useCallback)(async e=>{try{let t=await fetch(`${k()}/propose/${e}`);if(!t.ok)return;S((await t.json()).proposal)}catch{}},[]),w=(0,M.useCallback)(async t=>{try{(await fetch(`${k()}/propose/${t}`,{method:`DELETE`})).ok&&(d.success(e(`page.proposalDeleted`)),f())}catch{}},[f,e]);return(0,N.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,N.jsx)(A,{baseUrl:`${k()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,N.jsx)(V,{jobs:g,isLoading:s,onJobsCleared:f,onProposalClick:C,onProposalDelete:w}),(0,N.jsx)(T,{open:v!==null,onOpenChange:e=>!e&&S(null),children:(0,N.jsx)(ee,{className:`max-w-3xl glass-card`,children:v&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(_,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,N.jsx)(c,{variant:v.status===`created`?`success`:v.status===`cancelled`?`destructive`:`secondary`,children:v.status})]})}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:v.idea}),v.result_markdown?(0,N.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,N.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80`,children:(0,N.jsx)(y,{remarkPlugins:[x],children:v.result_markdown})})}):(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),v.issue_url&&(0,N.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,N.jsx)(`a`,{href:v.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:v.issue_url})]}),(0,N.jsxs)(r,{children:[(0,N.jsx)(l,{variant:`destructive`,size:`sm`,onClick:()=>{w(v.id),S(null)},children:e(`common:actions.delete`)}),(0,N.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>S(null),children:e(`common:actions.close`)})]})]})})})]})}export{H as default};
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{$ as t,$t as n,D as r,Dt as i,E as a,Et as o,I as s,M as c,N as l,O as u,Qt as d,R as f,Rt as p,T as ee,b as m,dt as h,ft as g,k as _,lt as v,m as y,n as b,p as x,rn as S,sn as C,u as w,w as T,wt as E,x as D,y as O,zt as k}from"./index-BXoHFtfG.js";import{t as A}from"./ExportDropdown-BRHcvP0r.js";import{t as j}from"./useProjectCache-BeyBSNpD.js";import{t as te}from"./format-command-2VNoNnMv.js";var ne=E(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),M=e(C(),1),N=p();function P(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function F(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function I(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function L({label:e,a:t,b:n,highlight:r}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function R(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function re({jobIds:e,onClose:t}){let{t:r}=n(`jobs`),[i,a]=(0,M.useState)(null),[o,c]=(0,M.useState)(!0),[l,u]=(0,M.useState)(null);(0,M.useEffect)(()=>{let t=new AbortController;return fetch(`${k()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a(e),c(!1)}).catch(e=>{e.name!==`AbortError`&&(u(e.message),c(!1))}),()=>t.abort()},[e]);function d(e,t){return(0,N.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:r(`comparison.jobN`,{n:t+1})}),(0,N.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,N.jsx)(g,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,N.jsx)(h,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,N.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:r(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:t,children:(0,N.jsxs)(`div`,{className:`w-full max-w-lg rounded-xl border border-border/30 bg-popover p-5 shadow-xl space-y-4 mx-4`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`comparison.title`)}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,N.jsx)(s,{className:`w-4 h-4`})})]}),o&&(0,N.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,N.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:r(`comparison.loadFailed`,{error:l})}),i&&(()=>{let[e,t]=i.jobs,n=R(e.durationMs,t.durationMs,!0),a=R(e.totalCostUsd,t.totalCostUsd,!0),o=R(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,N.jsx)(`div`,{}),d(e,0),d(t,1)]}),(0,N.jsx)(L,{label:r(`comparison.duration`),a:P(e.durationMs),b:P(t.durationMs),highlight:n}),(0,N.jsx)(L,{label:r(`comparison.cost`),a:F(e.totalCostUsd),b:F(t.totalCostUsd),highlight:a}),(0,N.jsx)(L,{label:r(`comparison.tokensOut`),a:I(e.tokensOut),b:I(t.tokensOut),highlight:o}),(0,N.jsx)(L,{label:r(`comparison.tokensIn`),a:I(e.tokensIn),b:I(t.tokensIn),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.cacheRead`),a:I(e.tokensCacheRead),b:I(t.tokensCacheRead),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,N.jsx)(L,{label:r(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),i&&(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:r(`comparison.betterValueHint`)})]})})}var ie={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.done`,tooltipKey:`statusTooltip.completed`},failed:{variant:`failed`,labelKey:`statusLabel.failed`,tooltipKey:`statusTooltip.failed`},canceled:{variant:`canceled`,labelKey:`statusLabel.canceled`,tooltipKey:`statusTooltip.canceled`},queued:{variant:`queued`,labelKey:`statusLabel.queued`,tooltipKey:`statusTooltip.queuedToRun`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`warning`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}},ae=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],z={critical:{className:`bg-red-500/15 aurora-light:bg-destructive/10 text-red-400 aurora-light:text-destructive border-red-500/30 aurora-light:border-destructive/30`,labelKey:`recent.priority.critical`},high:{className:`bg-orange-500/15 aurora-light:bg-accent-warning/10 text-orange-400 aurora-light:text-accent-warning border-orange-500/30 aurora-light:border-accent-warning/30`,labelKey:`recent.priority.high`},normal:{className:``,labelKey:`recent.priority.normal`},low:{className:`bg-gray-500/15 aurora-light:bg-muted text-gray-400 aurora-light:text-muted-foreground border-gray-500/30 aurora-light:border-border`,labelKey:`recent.priority.low`}};function oe(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function se(e,t){if(!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();if(n<0)return null;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function ce(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function le(e){try{return w(new Date(e),{addSuffix:!0,locale:i()})}catch{return e}}var B=10;function V({jobs:e,isLoading:i,onJobsCleared:s,onProposalClick:p,onProposalDelete:h}){let{t:g}=n(`jobs`),y=S(),{activeProjectId:b,projects:x}=o(),C=x.find(e=>e.id===b)?.provider,[w,E]=(0,M.useState)(null),[A,j]=(0,M.useState)(``),[P,F]=(0,M.useState)(``),[I,L]=(0,M.useState)(!1),[R,V]=(0,M.useState)(``),[H,U]=(0,M.useState)(``),[W,G]=(0,M.useState)(!1),[K,q]=(0,M.useState)(null),[J,ue]=(0,M.useState)(B),[Y,de]=(0,M.useState)(!1),[X,Z]=(0,M.useState)([]),[fe,Q]=(0,M.useState)(null);(0,M.useEffect)(()=>{ue(B)},[e.length]);function pe(){de(e=>!e),Z([])}function me(e){Z(t=>{if(t.includes(e))return t.filter(t=>t!==e);if(t.length>=2)return t;let n=[...t,e];return n.length===2&&Q(n),n})}let $=e.filter(e=>!(w&&e.status!==w||A&&e.started_at<A||P&&e.started_at>`${P}T23:59:59`)),he=e.filter(e=>!(R&&e.started_at<R||H&&e.started_at>`${H}T23:59:59`)).length;async function ge(e){G(!0);try{let t={};e===`range`&&(R&&(t.from=R),H&&(t.to=H));let n=await fetch(`${k()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.ok){let e=await n.json();d.success(g(`recent.toast.cleared`,{count:e.deleted})),L(!1),V(``),U(``),s?.()}else d.error(g(`recent.toast.clearFailed`))}catch{d.error(g(`recent.toast.networkError`))}finally{G(!1)}}return i?(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,N.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,N.jsx)(v,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:g(`recent.emptyTitle`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:g(`recent.emptyDescription`)})]}):(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>E(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${w===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:g(`recent.filterAll`,{count:e.length})}),ae.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,N.jsx)(`button`,{type:`button`,onClick:()=>E(w===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${w===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:g(`recent.filterStatus`,{status:g(`statusName.${t}`),count:n})},t)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:A,onChange:e=>j(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:g(`recent.fromDate`)}),(0,N.jsx)(`input`,{type:`date`,value:P,onChange:e=>F(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:g(`recent.toDate`)}),(A||P)&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>{j(``),F(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:g(`recent.clear`)}),(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 transition-colors ${Y?`text-foreground bg-accent`:`text-muted-foreground hover:text-foreground`}`,onClick:pe,children:(0,N.jsx)(ne,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(m,{children:g(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>L(!0),children:(0,N.jsx)(f,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(m,{children:g(`recent.clearJobs`)})]})]})]}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-accent/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[X.length===0&&g(`recent.selectTwoToCompare`),X.length===1&&g(`recent.selectOneMore`),X.length===2&&g(`recent.readyToCompare`)]}),X.length===2&&(0,N.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:g(`recent.compareAction`)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,N.jsx)(`span`,{className:`w-14`,children:g(`recent.colStatus`)}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0`,children:g(`recent.colCommand`)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:g(`recent.colDuration`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:g(`recent.colTokens`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:g(`recent.colCost`)}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:g(`recent.colStarted`)})]})]}),(0,N.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let n=ie[e.status]??ie.queued,r=oe(e.total_cost_usd),i=se(e.started_at,e.finished_at),a=ce((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),o=e.id.startsWith(`proposal:`),s=o?e.id.replace(`proposal:`,``):null,l=X.includes(e.id),u=Y&&!o&&X.length===2&&!l;return(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${l?`bg-accent/70 ring-1 ring-border`:u?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:()=>{if(Y&&!o){me(e.id);return}o&&s?p?.(s):y(`/jobs/${e.id}`)},children:[(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(`div`,{children:(0,N.jsx)(c,{variant:n.variant,children:g(n.labelKey)})})}),(0,N.jsx)(m,{children:g(n.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${z[e.priority].className}`,children:g(z[e.priority].labelKey)}),e.profile_name&&(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border border-accent-primary/40 bg-accent-primary/10 text-accent-primary/90`,children:e.profile_name})}),(0,N.jsx)(m,{children:g(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,N.jsxs)(O,{children:[(0,N.jsx)(D,{asChild:!0,children:(0,N.jsx)(t,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,N.jsxs)(m,{children:[g(`recent.pipelinePart`),e.depends_on_job_id&&` ${g(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,N.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:te(e.command,C)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:i??`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:a?`${a}`:`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:r??`—`}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:le(e.started_at)}),o&&s&&(0,N.jsx)(`button`,{type:`button`,className:`w-4 h-4 md:opacity-0 md:group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all`,onClick:e=>{e.stopPropagation(),q(s)},title:g(`recent.deleteProposal`),children:(0,N.jsx)(f,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,N.jsx)(`div`,{className:`pt-1 text-center`,children:(0,N.jsx)(`button`,{type:`button`,onClick:()=>ue(e=>e+B),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:g(`recent.loadMore`,{count:$.length-J})})}),I&&(0,N.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:()=>L(!1),children:(0,N.jsxs)(`div`,{className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold`,children:g(`recent.clearModal.title`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:g(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,N.jsx)(l,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:W,onClick:()=>ge(`all`),children:g(`recent.clearModal.clearAll`,{count:e.length})}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:g(`recent.clearModal.orByRange`)}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:R,onChange:e=>V(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:g(`recent.clearModal.fromPlaceholder`)}),(0,N.jsx)(`input`,{type:`date`,value:H,onChange:e=>U(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:g(`recent.clearModal.toPlaceholder`)})]}),(0,N.jsx)(l,{variant:`outline`,size:`sm`,className:`w-full`,disabled:W||!R&&!H,onClick:()=>ge(`range`),children:R||H?g(`recent.clearModal.clearInRange`,{count:he}):g(`recent.clearModal.clearRange`)})]}),(0,N.jsx)(l,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>L(!1),children:g(`common:actions.cancel`)})]})}),(0,N.jsx)(T,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,N.jsxs)(ee,{className:`max-w-sm`,children:[(0,N.jsxs)(u,{children:[(0,N.jsx)(_,{children:g(`recent.deleteProposalConfirm.title`)}),(0,N.jsx)(a,{children:g(`recent.deleteProposalConfirm.description`)})]}),(0,N.jsxs)(r,{children:[(0,N.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:g(`common:actions.cancel`)}),(0,N.jsx)(l,{variant:`destructive`,size:`sm`,onClick:()=>{K&&h?.(K),q(null)},children:g(`common:actions.delete`)})]})]})}),fe&&(0,N.jsx)(re,{jobIds:fe,onClose:()=>{Q(null),Z([]),de(!1)}})]})}function H(){let{t:e}=n(`jobs`),{activeProjectId:t}=o(),{recentJobs:i}=b(t),{data:a,isFirstLoad:s,refresh:f}=j({namespace:`jobs`,projectId:t,initialValue:i,fetcher:async()=>{let e=await fetch(`${k()}/jobs?limit=10`);return e.ok?(await e.json()).jobs:[]},pollInterval:1e4}),{data:p}=j({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async()=>{let e=await fetch(`${k()}/propose?limit=10`);return e.ok?(await e.json()).proposals:[]},pollInterval:1e4}),m={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},h=p.map(e=>({id:`proposal:${e.id}`,command:`/specrails:propose-feature ${e.idea.length>60?e.idea.slice(0,57)+`...`:e.idea}`,started_at:e.created_at,status:m[e.status]??`queued`})),g=[...a,...h].sort((e,t)=>new Date(t.started_at).getTime()-new Date(e.started_at).getTime()),[v,S]=(0,M.useState)(null),C=(0,M.useCallback)(async e=>{try{let t=await fetch(`${k()}/propose/${e}`);if(!t.ok)return;S((await t.json()).proposal)}catch{}},[]),w=(0,M.useCallback)(async t=>{try{(await fetch(`${k()}/propose/${t}`,{method:`DELETE`})).ok&&(d.success(e(`page.proposalDeleted`)),f())}catch{}},[f,e]);return(0,N.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,N.jsx)(A,{baseUrl:`${k()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,N.jsx)(V,{jobs:g,isLoading:s,onJobsCleared:f,onProposalClick:C,onProposalDelete:w}),(0,N.jsx)(T,{open:v!==null,onOpenChange:e=>!e&&S(null),children:(0,N.jsx)(ee,{className:`max-w-3xl glass-card`,children:v&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(u,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(_,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,N.jsx)(c,{variant:v.status===`created`?`success`:v.status===`cancelled`?`destructive`:`secondary`,children:v.status})]})}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:v.idea}),v.result_markdown?(0,N.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,N.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80`,children:(0,N.jsx)(y,{remarkPlugins:[x],children:v.result_markdown})})}):(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),v.issue_url&&(0,N.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,N.jsx)(`a`,{href:v.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:v.issue_url})]}),(0,N.jsxs)(r,{children:[(0,N.jsx)(l,{variant:`destructive`,size:`sm`,onClick:()=>{w(v.id),S(null)},children:e(`common:actions.delete`)}),(0,N.jsx)(l,{variant:`ghost`,size:`sm`,onClick:()=>S(null),children:e(`common:actions.close`)})]})]})})})]})}export{H as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,r as t}from"./index-
|
|
1
|
+
import{i as e,r as t}from"./index-BXoHFtfG.js";var n=class{constructor(){this.eventListeners=Object.create(null)}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}on(e,t){return e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t],this}once(e,t){let n=r=>{this.removeListener(e,n),t(r)};return this.addListener(e,n)}off(e,t){return e in this.eventListeners&&(this.eventListeners[e]=this.eventListeners[e].filter(e=>e!==t)),this}removeAllListeners(e){return e?delete this.eventListeners[e]:this.eventListeners=Object.create(null),this}emit(e,t){if(e in this.eventListeners){let n=this.eventListeners[e];for(let e of n)e(t);return!0}return!1}listenerCount(e){return e in this.eventListeners?this.eventListeners[e].length:0}prependListener(e,t){return e in this.eventListeners?this.eventListeners[e].unshift(t):this.eventListeners[e]=[t],this}prependOnceListener(e,t){let n=r=>{this.removeListener(e,n),t(r)};return this.prependListener(e,n)}},r=class{constructor(e){this.pid=e}async write(t){await e(`plugin:shell|stdin_write`,{pid:this.pid,buffer:t})}async kill(){await e(`plugin:shell|kill`,{cmd:`killChild`,pid:this.pid})}},i=class i extends n{constructor(e,t=[],r){super(),this.stdout=new n,this.stderr=new n,this.program=e,this.args=typeof t==`string`?[t]:t,this.options=r??{}}static create(e,t=[],n){return new i(e,t,n)}static sidecar(e,t=[],n){let r=new i(e,t,n);return r.options.sidecar=!0,r}async spawn(){let n=this.program,i=this.args,a=this.options;typeof i==`object`&&Object.freeze(i);let o=new t;return o.onmessage=e=>{switch(e.event){case`Error`:this.emit(`error`,e.payload);break;case`Terminated`:this.emit(`close`,e.payload);break;case`Stdout`:this.stdout.emit(`data`,e.payload);break;case`Stderr`:this.stderr.emit(`data`,e.payload);break}},await e(`plugin:shell|spawn`,{program:n,args:i,options:a,onEvent:o}).then(e=>new r(e))}async execute(){let t=this.program,n=this.args,r=this.options;return typeof n==`object`&&Object.freeze(n),await e(`plugin:shell|execute`,{program:t,args:n,options:r})}};async function a(t,n){await e(`plugin:shell|open`,{path:t,with:n})}export{r as Child,i as Command,n as EventEmitter,a as open};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./index-
|
|
1
|
+
import{i as e}from"./index-BXoHFtfG.js";function t(e){if(e!==void 0){if(typeof e==`string`)return e;if(`ok`in e&&`cancel`in e)return{OkCancelCustom:[e.ok,e.cancel]};if(`yes`in e&&`no`in e&&`cancel`in e)return{YesNoCancelCustom:[e.yes,e.no,e.cancel]};if(`ok`in e)return{OkCustom:e.ok}}}async function n(t={}){return typeof t==`object`&&Object.freeze(t),await e(`plugin:dialog|open`,{options:t})}async function r(t={}){return typeof t==`object`&&Object.freeze(t),await e(`plugin:dialog|save`,{options:t})}async function i(n,r){return await e(`plugin:dialog|message`,{message:n,title:r?.title,kind:r?.kind,buttons:t(r?.buttons)})}async function a(e,t){let n=typeof t==`string`?{title:t}:t;return n&&!n.buttons&&n.okLabel&&(n.buttons={ok:n.okLabel}),i(e,n)}async function o(e,t){let n=typeof t==`string`?{title:t}:t,r=n?.okLabel||n?.cancelLabel,a=n?.okLabel??`Yes`;return await i(e,{title:n?.title,kind:n?.kind,buttons:r?{ok:a,cancel:n.cancelLabel??`No`}:`YesNo`})===a}async function s(e,t){let n=typeof t==`string`?{title:t}:t,r=n?.okLabel||n?.cancelLabel,a=n?.okLabel??`Ok`;return await i(e,{title:n?.title,kind:n?.kind,buttons:r?{ok:a,cancel:n.cancelLabel??`Cancel`}:`OkCancel`})===a}export{o as ask,s as confirm,a as message,n as open,r as save};
|