specrails-desktop 2.58.0 → 2.59.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 +2 -5
- package/client/dist/assets/{ActivityFeedPage-BQGppIR0.js → ActivityFeedPage-DBFt8ZHP.js} +1 -1
- package/client/dist/assets/AgentBrowserCapture-DiQx0W67.js +1 -0
- package/client/dist/assets/AgentModeAnalyticsPane-BmDSXp_J.js +2 -0
- package/client/dist/assets/AgentModeCodePane-BLQLPSwr.js +2 -0
- package/client/dist/assets/{AgentModeJobsPane-DR_06oqH.js → AgentModeJobsPane-BbTXdKUa.js} +1 -1
- package/client/dist/assets/{AgentsPage-BKIKjm_1.js → AgentsPage-Dei1jGR8.js} +3 -3
- package/client/dist/assets/{AnalyticsPage-069npRVo.js → AnalyticsPage-BhkeGIGn.js} +1 -1
- package/client/dist/assets/CodePage-B_9yYWUx.js +3 -0
- package/client/dist/assets/{DesktopAnalyticsPage-qtWAPM47.js → DesktopAnalyticsPage-DAcfEJac.js} +1 -1
- package/client/dist/assets/DocsDialog-WCuiYgsc.js +11 -0
- package/client/dist/assets/DocsPage-bGVYTMTU.js +11 -0
- package/client/dist/assets/{ExportDropdown-BcMpvV89.js → ExportDropdown-CsodZ-yb.js} +1 -1
- package/client/dist/assets/InteractiveJobComposer-D5fh_eVL.js +19 -0
- package/client/dist/assets/JobDetailModal-DlpXF61O.js +1 -0
- package/client/dist/assets/JobDetailPage-2yR19_Lb.js +1 -0
- package/client/dist/assets/JobsPage-CS9IR6Dq.js +1 -0
- package/client/dist/assets/LoopBuilderPage-BwiAtmOr.js +1 -0
- package/client/dist/assets/{LoopPreviewModal-je5pSCf-.js → LoopPreviewModal--upwvgTv.js} +1 -1
- package/client/dist/assets/LoopWindowSurface-DRnUixtl.js +1 -0
- package/client/dist/assets/LoopsPage-Xm3nRToQ.js +2 -0
- package/client/dist/assets/MinimizedChatsContext-D_8L4EWZ.js +1 -0
- package/client/dist/assets/PluginsPage-CAFQ1B4Q.js +2 -0
- package/client/dist/assets/ProjectSettingsDialog-DYSO4v90.js +1 -0
- package/client/dist/assets/{RepositoryDeliveries-BiwJuS8r.js → RepositoryDeliveries-CbQmW7Qx.js} +1 -1
- package/client/dist/assets/RepositoryScopeSelector-DKzvIGSZ.js +2 -0
- package/client/dist/assets/ReviewPacketPage-SDBhYdQB.js +4 -0
- package/client/dist/assets/TemplatePreviewModal-DHBUds51.js +1 -0
- package/client/dist/assets/TicketDetailModalContext-UAeNm7BB.js +16 -0
- package/client/dist/assets/{Trans-D3AfDylf.js → Trans-DExd3Z00.js} +1 -1
- package/client/dist/assets/agent-BElLtdKP.js +1 -0
- package/client/dist/assets/agent-C-m9VugX.js +1 -0
- package/client/dist/assets/agent-CGSKxfZk.js +1 -0
- package/client/dist/assets/agent-CW74ODDP.js +1 -0
- package/client/dist/assets/agent-DeCAZDhL.js +1 -0
- package/client/dist/assets/agent-DrM4qned.js +1 -0
- package/client/dist/assets/agent-KdIXq3w5.js +1 -0
- package/client/dist/assets/agent-jK8mCisM.js +1 -0
- package/client/dist/assets/{agentRuntime-DGz_IqKW.js → agentRuntime-15Pkk6we.js} +1 -1
- package/client/dist/assets/agentRuntime-Bpx3yWHK.js +1 -0
- package/client/dist/assets/{agentRuntime-Bg9tbmqm.js → agentRuntime-C78n13To.js} +1 -1
- package/client/dist/assets/{agentRuntime-D-GJVGkj.js → agentRuntime-CCI7XF4c.js} +1 -1
- package/client/dist/assets/{agentRuntime-D2__CVI_.js → agentRuntime-CKDHe2-a.js} +1 -1
- package/client/dist/assets/{agentRuntime-D35dGVOP.js → agentRuntime-Ddqvp2bP.js} +1 -1
- package/client/dist/assets/{agentRuntime-hInH9Fzj.js → agentRuntime-TXPQowKJ.js} +1 -1
- package/client/dist/assets/{agentRuntime-O1liDt6G.js → agentRuntime-hqZRy08E.js} +1 -1
- package/client/dist/assets/{builder-DGETbtZj.js → builder-B9gorTnT.js} +1 -1
- package/client/dist/assets/{builder-DyQperXU.js → builder-Bvw5s3Mi.js} +1 -1
- package/client/dist/assets/{builder-C1neIYGR.js → builder-CL5l4dU3.js} +1 -1
- package/client/dist/assets/{builder-DXEJUlC0.js → builder-CVDTVrQX.js} +1 -1
- package/client/dist/assets/{builder-CzW5ovyI.js → builder-CpS9liE9.js} +1 -1
- package/client/dist/assets/{builder-CvnFm0im.js → builder-DNctIL9Q.js} +1 -1
- package/client/dist/assets/{builder-D06L7iPy.js → builder-De2NxX6o.js} +1 -1
- package/client/dist/assets/{builder-C0FyvM83.js → builder-DeYT7Y-m.js} +1 -1
- package/client/dist/assets/{button-Ccc9Dc-D.js → button-D1xExSTF.js} +1 -1
- package/client/dist/assets/{common-DmsclwjP.js → common-Bdi0qN4S.js} +1 -1
- package/client/dist/assets/{common-C4Yvvhp6.js → common-Bhb9zN1P.js} +1 -1
- package/client/dist/assets/{common-od8WThlf.js → common-BykKlZg1.js} +1 -1
- package/client/dist/assets/{common-C0BOdeNi.js → common-CvnNNSJA.js} +1 -1
- package/client/dist/assets/{common-BCK7c9Pv.js → common-D5zk_mqq.js} +1 -1
- package/client/dist/assets/{common-DpLWwgI1.js → common-DQNO_al5.js} +1 -1
- package/client/dist/assets/{common-OCvl3c8t.js → common-Dax30Vmp.js} +1 -1
- package/client/dist/assets/{common-c0aujEZC.js → common-DkllpVSb.js} +1 -1
- package/client/dist/assets/{dialog-xXB2q5HJ.js → dialog-CMgps2MY.js} +1 -1
- package/client/dist/assets/external-link-D6XxC_Cu.js +1 -0
- package/client/dist/assets/file-text-BcLCfcWZ.js +1 -0
- package/client/dist/assets/{formatDistanceToNow-aBss1Nai.js → formatDistanceToNow-aw7H5ORC.js} +1 -1
- package/client/dist/assets/{getTimezoneOffsetInMilliseconds-DOGj1Mfz.js → getTimezoneOffsetInMilliseconds-NyC7gZJX.js} +1 -1
- package/client/dist/assets/index-CahchzS5.css +2 -0
- package/client/dist/assets/index-JSTZVJfe.js +83 -0
- package/client/dist/assets/integrations-BkpRUbvp.js +1 -0
- package/client/dist/assets/integrations-Bo8qbJf4.js +1 -0
- package/client/dist/assets/integrations-CmSrKzZb.js +1 -0
- package/client/dist/assets/integrations-DGtq26Rr.js +1 -0
- package/client/dist/assets/integrations-De38GFnQ.js +1 -0
- package/client/dist/assets/integrations-Dw6zdtb-.js +1 -0
- package/client/dist/assets/integrations-Dwl9KQp0.js +1 -0
- package/client/dist/assets/integrations-Refg_d2I.js +1 -0
- package/client/dist/assets/jira-api-DlXaRwA3.js +1 -0
- package/client/dist/assets/{jobs-KG4Sn12X.js → jobs-1G3wodhl.js} +1 -1
- package/client/dist/assets/{jobs-6_-r75yC.js → jobs-B4pu8TdF.js} +1 -1
- package/client/dist/assets/{jobs-pPv4KWjb.js → jobs-BD47Ov11.js} +1 -1
- package/client/dist/assets/{jobs-B1yqyId5.js → jobs-BLOoVRRl.js} +1 -1
- package/client/dist/assets/{jobs-BKiK-ZWh.js → jobs-CSrRx5lD.js} +1 -1
- package/client/dist/assets/{jobs-BFuV7ttH.js → jobs-DZAbh1m2.js} +1 -1
- package/client/dist/assets/{jobs-DmKV7b7d.js → jobs-epP7gt8W.js} +1 -1
- package/client/dist/assets/{jobs-BKa8LuwA.js → jobs-tWjcDF_6.js} +1 -1
- package/client/dist/assets/loops--KWr0X-w.js +1 -0
- package/client/dist/assets/{loops-BO3V8244.js → loops-3IutojWt.js} +1 -1
- package/client/dist/assets/{loops-C-hZK8pf.js → loops-BAosWtXE.js} +1 -1
- package/client/dist/assets/{loops-eUnCfLjC.js → loops-BISDssL5.js} +1 -1
- package/client/dist/assets/{loops-Dv849ckF.js → loops-Cm55CXJ4.js} +1 -1
- package/client/dist/assets/{loops-CDOWZ0ci.js → loops-D7tL_Saw.js} +1 -1
- package/client/dist/assets/{loops-BJDY9FTh.js → loops-DHQtnfze.js} +1 -1
- package/client/dist/assets/{loops-Q9LIgGkq.js → loops-kIJJkaxf.js} +1 -1
- package/client/dist/assets/nav--u7iPYlS.js +1 -0
- package/client/dist/assets/nav-C5Jgfaby.js +1 -0
- package/client/dist/assets/nav-CAna_Wpt.js +1 -0
- package/client/dist/assets/nav-CCLqeyHo.js +1 -0
- package/client/dist/assets/nav-Cf3c90Jk.js +1 -0
- package/client/dist/assets/nav-DMYQaQjR.js +1 -0
- package/client/dist/assets/nav-Df_PkZ9F.js +1 -0
- package/client/dist/assets/nav-VyNGBJwj.js +1 -0
- package/client/dist/assets/{project-repositories-CSnfzUpg.js → project-repositories-DXhb9FP4.js} +1 -1
- package/client/dist/assets/provider-capabilities-lePfeT_Y.js +1 -0
- package/client/dist/assets/save-OsUqVn99.js +1 -0
- package/client/dist/assets/settings-B5Hy_Kol.js +1 -0
- package/client/dist/assets/settings-BBj_kZaD.js +1 -0
- package/client/dist/assets/settings-ByVE7jdZ.js +1 -0
- package/client/dist/assets/settings-COlH_P33.js +1 -0
- package/client/dist/assets/settings-D77mC_Lb.js +1 -0
- package/client/dist/assets/settings-DZKy7MqN.js +1 -0
- package/client/dist/assets/settings-Dbyd6gmj.js +1 -0
- package/client/dist/assets/settings-Dn-pXukr.js +1 -0
- package/client/dist/assets/setup-Be485n2u.js +1 -0
- package/client/dist/assets/setup-CKGUxKr-.js +1 -0
- package/client/dist/assets/setup-Ck1Uwd7_.js +1 -0
- package/client/dist/assets/setup-Cm774a6v.js +1 -0
- package/client/dist/assets/setup-DIqMQpxt.js +1 -0
- package/client/dist/assets/setup-DfCsoNFL.js +1 -0
- package/client/dist/assets/setup-DkeE8mP0.js +1 -0
- package/client/dist/assets/setup-xVntVaz1.js +1 -0
- package/client/dist/assets/{spending-HBSk-6jv.js → spending-BdcyVkcd.js} +1 -1
- package/client/dist/assets/subscriptionUsage-Cf87DeS_.js +1 -0
- package/client/dist/assets/subscriptionUsage-D6u7VBdz.js +1 -0
- package/client/dist/assets/subscriptionUsage-DQ02J25O.js +1 -0
- package/client/dist/assets/subscriptionUsage-DWF3zKp4.js +1 -0
- package/client/dist/assets/subscriptionUsage-DkIf6Zuh.js +1 -0
- package/client/dist/assets/subscriptionUsage-DoWQv7l1.js +1 -0
- package/client/dist/assets/subscriptionUsage-N9hB-ARf.js +1 -0
- package/client/dist/assets/subscriptionUsage-zRcRPHkP.js +1 -0
- package/client/dist/assets/tauri-shell-DE6LfGPw.js +2 -0
- package/client/dist/assets/{useDesktop-0unHDBJJ.js → useDesktop-D07TvesS.js} +1 -1
- package/client/dist/assets/{useRuntimeRuns-BN1rhyEm.js → useRuntimeRuns-pGLmtAC6.js} +1 -1
- package/client/dist/assets/useSharedWebSocket-TzKtPRp9.js +2 -0
- package/client/dist/index.html +33 -32
- package/docs/README.md +1 -9
- package/docs/agent-live-steering.md +0 -6
- package/docs/agents/README.md +0 -2
- package/docs/agents/mcp.md +1 -14
- package/docs/cli.md +0 -13
- package/docs/codex.md +2 -75
- package/docs/creating-specs.md +0 -39
- package/docs/customizing.md +1 -15
- package/docs/getting-started.md +0 -23
- package/docs/guide/de/agents/2-profiles-and-the-balanced-default.md +0 -8
- package/docs/guide/de/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/de/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/de/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/de/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/de/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/de/integrations/1-ai-providers.md +2 -50
- package/docs/guide/de/integrations/2-plugins.md +0 -8
- package/docs/guide/de/integrations/5-mcp-server.md +1 -14
- package/docs/guide/de/integrations/6-agent-chat.md +0 -11
- package/docs/guide/de/integrations/7-local-engines.md +0 -4
- package/docs/guide/de/pipeline/1-rails-and-jobs.md +0 -13
- package/docs/guide/de/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/de/pipeline/4-picking-an-engine-per-rail.md +0 -20
- package/docs/guide/de/pipeline/5-the-loop-builder.md +0 -6
- package/docs/guide/de/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/en/agents/2-profiles-and-the-balanced-default.md +0 -10
- package/docs/guide/en/agents/4-custom-agents-catalog.md +0 -25
- package/docs/guide/en/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/en/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/en/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/en/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/en/insights/3-code-explorer.md +0 -5
- package/docs/guide/en/integrations/1-ai-providers.md +10 -99
- package/docs/guide/en/integrations/2-plugins.md +0 -8
- package/docs/guide/en/integrations/5-mcp-server.md +1 -1
- package/docs/guide/en/integrations/6-agent-chat.md +0 -17
- package/docs/guide/en/integrations/7-local-engines.md +0 -4
- package/docs/guide/en/pipeline/1-rails-and-jobs.md +2 -24
- package/docs/guide/en/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/en/pipeline/4-picking-an-engine-per-rail.md +10 -65
- package/docs/guide/en/pipeline/5-the-loop-builder.md +0 -7
- package/docs/guide/en/specs/2-add-spec-quick-mode.md +0 -11
- package/docs/guide/es/agents/2-profiles-and-the-balanced-default.md +0 -8
- package/docs/guide/es/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/es/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/es/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/es/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/es/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/es/integrations/1-ai-providers.md +10 -75
- package/docs/guide/es/integrations/2-plugins.md +0 -8
- package/docs/guide/es/integrations/5-mcp-server.md +1 -1
- package/docs/guide/es/integrations/6-agent-chat.md +0 -11
- package/docs/guide/es/integrations/7-local-engines.md +0 -4
- package/docs/guide/es/pipeline/1-rails-and-jobs.md +3 -13
- package/docs/guide/es/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/es/pipeline/4-picking-an-engine-per-rail.md +10 -53
- package/docs/guide/es/pipeline/5-the-loop-builder.md +1 -6
- package/docs/guide/es/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/fr/agents/2-profiles-and-the-balanced-default.md +0 -8
- package/docs/guide/fr/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/fr/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/fr/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/fr/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/fr/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/fr/integrations/1-ai-providers.md +2 -50
- package/docs/guide/fr/integrations/2-plugins.md +0 -8
- package/docs/guide/fr/integrations/5-mcp-server.md +1 -14
- package/docs/guide/fr/integrations/6-agent-chat.md +0 -11
- package/docs/guide/fr/integrations/7-local-engines.md +0 -4
- package/docs/guide/fr/pipeline/1-rails-and-jobs.md +0 -13
- package/docs/guide/fr/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/fr/pipeline/4-picking-an-engine-per-rail.md +0 -22
- package/docs/guide/fr/pipeline/5-the-loop-builder.md +0 -6
- package/docs/guide/fr/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/it/agents/2-profiles-and-the-balanced-default.md +0 -8
- package/docs/guide/it/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/it/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/it/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/it/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/it/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/it/integrations/1-ai-providers.md +2 -48
- package/docs/guide/it/integrations/2-plugins.md +0 -8
- package/docs/guide/it/integrations/5-mcp-server.md +1 -14
- package/docs/guide/it/integrations/6-agent-chat.md +0 -11
- package/docs/guide/it/integrations/7-local-engines.md +0 -4
- package/docs/guide/it/pipeline/1-rails-and-jobs.md +2 -13
- package/docs/guide/it/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/it/pipeline/4-picking-an-engine-per-rail.md +0 -20
- package/docs/guide/it/pipeline/5-the-loop-builder.md +1 -6
- package/docs/guide/it/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/ja/agents/2-profiles-and-the-balanced-default.md +0 -9
- package/docs/guide/ja/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/ja/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/ja/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/ja/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/ja/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/ja/integrations/1-ai-providers.md +1 -69
- package/docs/guide/ja/integrations/2-plugins.md +0 -8
- package/docs/guide/ja/integrations/5-mcp-server.md +1 -14
- package/docs/guide/ja/integrations/6-agent-chat.md +0 -10
- package/docs/guide/ja/integrations/7-local-engines.md +0 -4
- package/docs/guide/ja/pipeline/1-rails-and-jobs.md +0 -13
- package/docs/guide/ja/pipeline/2-the-job-detail-view.md +0 -3
- package/docs/guide/ja/pipeline/4-picking-an-engine-per-rail.md +0 -21
- package/docs/guide/ja/pipeline/5-the-loop-builder.md +0 -6
- package/docs/guide/ja/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/pt/agents/2-profiles-and-the-balanced-default.md +0 -8
- package/docs/guide/pt/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/pt/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/pt/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/pt/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/pt/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/pt/integrations/1-ai-providers.md +2 -48
- package/docs/guide/pt/integrations/2-plugins.md +0 -8
- package/docs/guide/pt/integrations/5-mcp-server.md +1 -14
- package/docs/guide/pt/integrations/6-agent-chat.md +0 -10
- package/docs/guide/pt/integrations/7-local-engines.md +0 -4
- package/docs/guide/pt/pipeline/1-rails-and-jobs.md +0 -13
- package/docs/guide/pt/pipeline/2-the-job-detail-view.md +0 -2
- package/docs/guide/pt/pipeline/4-picking-an-engine-per-rail.md +0 -21
- package/docs/guide/pt/pipeline/5-the-loop-builder.md +0 -6
- package/docs/guide/pt/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/guide/zh/agents/2-profiles-and-the-balanced-default.md +0 -7
- package/docs/guide/zh/agents/4-custom-agents-catalog.md +0 -15
- package/docs/guide/zh/getting-started/1-what-is-specrails.md +0 -2
- package/docs/guide/zh/getting-started/2-installing-and-first-run.md +0 -2
- package/docs/guide/zh/getting-started/3-adding-your-first-project.md +0 -4
- package/docs/guide/zh/getting-started/4-the-dashboard-tour.md +0 -5
- package/docs/guide/zh/integrations/1-ai-providers.md +1 -67
- package/docs/guide/zh/integrations/2-plugins.md +0 -8
- package/docs/guide/zh/integrations/5-mcp-server.md +1 -14
- package/docs/guide/zh/integrations/6-agent-chat.md +0 -9
- package/docs/guide/zh/integrations/7-local-engines.md +0 -4
- package/docs/guide/zh/pipeline/1-rails-and-jobs.md +0 -13
- package/docs/guide/zh/pipeline/2-the-job-detail-view.md +0 -2
- package/docs/guide/zh/pipeline/4-picking-an-engine-per-rail.md +0 -20
- package/docs/guide/zh/pipeline/5-the-loop-builder.md +0 -6
- package/docs/guide/zh/specs/2-add-spec-quick-mode.md +0 -7
- package/docs/internals/adding-a-provider.md +7 -0
- package/docs/internals/desktop-owned-workflows.md +121 -0
- package/docs/internals/operations-runbook.md +20 -0
- package/docs/internals/programmatic-agent-runtime.md +34 -28
- package/docs/internals/project-builder.md +34 -11
- package/docs/internals/source-map.md +51 -3
- package/docs/internals/spec-addenda.md +11 -5
- package/docs/local-providers.md +8 -13
- package/docs/mcp.md +1 -17
- package/docs/platforms/macos.md +0 -40
- package/docs/platforms/windows-parity.md +1 -1
- package/docs/platforms/windows.md +0 -8
- package/docs/running-pipelines.md +1 -46
- package/docs/subscription-usage.md +19 -0
- package/docs/terminal.md +0 -2
- package/docs/tracking-cost.md +2 -33
- package/package.json +1 -1
- package/server/dist/core-execution.js +24 -15
- package/server/dist/desktop-db.js +23 -10
- package/server/dist/desktop-router.js +8 -4
- package/server/dist/index.js +10 -5
- package/server/dist/mcp/guide.js +1 -0
- package/server/dist/mcp/tools/jobs.js +1 -1
- package/server/dist/mcp/tools/loops.js +2 -0
- package/server/dist/mcp/tools/meta.js +6 -7
- package/server/dist/mcp/tools/projects.js +31 -6
- package/server/dist/mcp/tools/rails.js +6 -3
- package/server/dist/mcp/tools/setup.js +10 -0
- package/server/dist/mcp/tools/specs.js +1 -1
- package/server/dist/modules/accounting/runtime/pricing.js +6 -1
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-bridge.js +55 -12
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-metrics.js +1 -1
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings-router.js +1 -1
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-settings.js +42 -0
- package/server/dist/modules/agent-runtime/runtime/agent-runtime-verification-suggestions.js +10 -4
- package/server/dist/modules/builder/runtime/milestone-chain.js +76 -10
- package/server/dist/modules/delivery/runtime/delivery-evidence.js +3 -2
- package/server/dist/modules/delivery/runtime/multi-repo-execution.js +3 -0
- package/server/dist/modules/delivery/runtime/rail-isolated-launch.js +1 -0
- package/server/dist/modules/delivery/runtime/rail-launch-parser.js +8 -0
- package/server/dist/modules/delivery/runtime/rails-router.js +48 -26
- package/server/dist/modules/delivery/runtime/review-packet.js +1 -1
- package/server/dist/modules/loops/runtime/loop-agent-defaults.json +6 -0
- package/server/dist/modules/loops/runtime/loop-agents.js +21 -0
- package/server/dist/modules/loops/runtime/loop-command-catalog.js +1 -1
- package/server/dist/modules/loops/runtime/loop-core-factory.js +19 -3
- package/server/dist/modules/loops/runtime/loop-definition.js +79 -12
- package/server/dist/modules/loops/runtime/loop-effect.js +1 -1
- package/server/dist/modules/loops/runtime/loop-executors.js +24 -9
- package/server/dist/modules/loops/runtime/loop-factory.js +1 -1
- package/server/dist/modules/loops/runtime/loop-graph.js +5 -14
- package/server/dist/modules/loops/runtime/loop-implement-recipe.js +49 -0
- package/server/dist/modules/loops/runtime/loop-run-manager.js +3 -3
- package/server/dist/modules/loops/runtime/loop-templates.js +29 -5
- package/server/dist/modules/loops/runtime/loops-router.js +17 -0
- package/server/dist/modules/missions/runtime/agent-context-resolver.js +1 -1
- package/server/dist/modules/missions/runtime/agent-operator-prompt.js +17 -8
- package/server/dist/modules/specs/runtime/spec-models.js +4 -7
- package/server/dist/modules/subscription-usage/adapters/claude.js +113 -0
- package/server/dist/modules/subscription-usage/adapters/codex.js +164 -0
- package/server/dist/modules/subscription-usage/adapters/errors.js +15 -0
- package/server/dist/modules/subscription-usage/adapters/http.js +20 -0
- package/server/dist/modules/subscription-usage/adapters/local-auth.js +61 -0
- package/server/dist/modules/subscription-usage/application.js +11 -0
- package/server/dist/modules/subscription-usage/domain.js +70 -0
- package/server/dist/modules/subscription-usage/index.js +2 -0
- package/server/dist/modules/subscription-usage/ports.js +2 -0
- package/server/dist/modules/subscription-usage/runtime/composition.js +20 -0
- package/server/dist/modules/subscription-usage/runtime/usage-service.js +111 -0
- package/server/dist/project-registry.js +16 -1
- package/server/dist/project-repositories.js +51 -2
- package/server/dist/project-router-helpers.js +1 -1
- package/server/dist/project-router-loop-runs.js +4 -1
- package/server/dist/providers/claude-adapter.js +6 -4
- package/server/dist/providers/codex-adapter.js +4 -5
- package/server/dist/schemas/workflow-definition.schema.json +2 -0
- package/client/dist/assets/AgentBrowserCapture-PI-cxyxi.js +0 -1
- package/client/dist/assets/AgentModeAnalyticsPane-mQsOqdXx.js +0 -2
- package/client/dist/assets/AgentModeCodePane-BL-vpmlY.js +0 -2
- package/client/dist/assets/CodePage-Alitorrv.js +0 -3
- package/client/dist/assets/DocsDialog-DwL6rgcT.js +0 -11
- package/client/dist/assets/DocsPage-BA1hiJZ-.js +0 -11
- package/client/dist/assets/InteractiveJobComposer-B3H1YHr6.js +0 -19
- package/client/dist/assets/JobDetailModal-XZQ9eAAy.js +0 -1
- package/client/dist/assets/JobDetailPage-B-SIaq_q.js +0 -1
- package/client/dist/assets/JobsPage-iQXAv2mx.js +0 -1
- package/client/dist/assets/LoopBuilderPage-B_gbFAHn.js +0 -1
- package/client/dist/assets/LoopsPage-BZwcY5cu.js +0 -2
- package/client/dist/assets/MinimizedChatsContext-CNx_0bZu.js +0 -1
- package/client/dist/assets/PluginsPage-DFocnoHX.js +0 -2
- package/client/dist/assets/ProjectSettingsDialog-Bh3S6EBB.js +0 -1
- package/client/dist/assets/RepositoryScopeSelector-C2mvWBQ6.js +0 -1
- package/client/dist/assets/ReviewPacketPage-CrAf-WDy.js +0 -4
- package/client/dist/assets/TemplatePreviewModal-C7DordpN.js +0 -1
- package/client/dist/assets/TicketDetailModalContext-B-DySpKL.js +0 -16
- package/client/dist/assets/agent-BaG10AN6.js +0 -1
- package/client/dist/assets/agent-CH4aJ884.js +0 -1
- package/client/dist/assets/agent-CLc9fA7v.js +0 -1
- package/client/dist/assets/agent-DHh9-AdL.js +0 -1
- package/client/dist/assets/agent-DkKnd6Wv.js +0 -1
- package/client/dist/assets/agent-aiVhqFW1.js +0 -1
- package/client/dist/assets/agent-dbznD3eO.js +0 -1
- package/client/dist/assets/agent-sMVFcPwL.js +0 -1
- package/client/dist/assets/agentRuntime-BeUb3g9g.js +0 -1
- package/client/dist/assets/file-text-CFT-xXKN.js +0 -1
- package/client/dist/assets/index-BS7KCWkV.css +0 -2
- package/client/dist/assets/index-C4Mv6tV6.js +0 -80
- package/client/dist/assets/integrations-CH0zy1Mw.js +0 -1
- package/client/dist/assets/integrations-CIAjhd7L.js +0 -1
- package/client/dist/assets/integrations-CZdwOe8A.js +0 -1
- package/client/dist/assets/integrations-Ct7omMld.js +0 -1
- package/client/dist/assets/integrations-D6MSxy3-.js +0 -1
- package/client/dist/assets/integrations-DbZa-Zyc.js +0 -1
- package/client/dist/assets/integrations-b8pH-vfl.js +0 -1
- package/client/dist/assets/integrations-mB-7zoyT.js +0 -1
- package/client/dist/assets/jira-api-BYbEPlkr.js +0 -1
- package/client/dist/assets/layers-eDMjG41I.js +0 -1
- package/client/dist/assets/loops-B4_D-nbg.js +0 -1
- package/client/dist/assets/nav-B-tpjyc2.js +0 -1
- package/client/dist/assets/nav-BJNXGg29.js +0 -1
- package/client/dist/assets/nav-BdhtRLP7.js +0 -1
- package/client/dist/assets/nav-ByYgyN5T.js +0 -1
- package/client/dist/assets/nav-DA0Mva2c.js +0 -1
- package/client/dist/assets/nav-DcJm_Jg_.js +0 -1
- package/client/dist/assets/nav-DhMPtAXc.js +0 -1
- package/client/dist/assets/nav-DhPb-Isc.js +0 -1
- package/client/dist/assets/provider-capabilities-Vi1ZGvAK.js +0 -1
- package/client/dist/assets/save-B6wGWwBR.js +0 -1
- package/client/dist/assets/settings-3o4Ntzi5.js +0 -1
- package/client/dist/assets/settings-B97jlkwD.js +0 -1
- package/client/dist/assets/settings-BTaT_bsS.js +0 -1
- package/client/dist/assets/settings-CT8w7WiC.js +0 -1
- package/client/dist/assets/settings-Cvr8_tvh.js +0 -1
- package/client/dist/assets/settings-Dn1qgAC8.js +0 -1
- package/client/dist/assets/settings-EShDdg4J.js +0 -1
- package/client/dist/assets/settings-tfLhQZRN.js +0 -1
- package/client/dist/assets/setup-CBMu3tqH.js +0 -1
- package/client/dist/assets/setup-CPh-e6J2.js +0 -1
- package/client/dist/assets/setup-CRKLp_ke.js +0 -1
- package/client/dist/assets/setup-Cy302v4J.js +0 -1
- package/client/dist/assets/setup-D681vTPf.js +0 -1
- package/client/dist/assets/setup-DYK0VBkE.js +0 -1
- package/client/dist/assets/setup-KAuiIiVs.js +0 -1
- package/client/dist/assets/setup-OGX-oCfI.js +0 -1
- package/client/dist/assets/useSharedWebSocket-BZMrX4jr.js +0 -2
- package/client/dist/assets/wrench-BfmNO9Vw.js +0 -1
- package/docs/agy-cli-provider-study.md +0 -257
- package/docs/gemini-cli-provider-study.md +0 -301
- package/docs/gemini-core-support-evaluation.md +0 -160
- package/docs/gemini.md +0 -257
- package/docs/kimi.md +0 -291
package/client/dist/assets/{DesktopAnalyticsPage-qtWAPM47.js → DesktopAnalyticsPage-DAcfEJac.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{m as r,r as i}from"./useSharedWebSocket-BZMrX4jr.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{t as s}from"./clsx-CjueKrWZ.js";import{t as c}from"./utils-BC4DHlz2.js";import{Jt as l,_t as u,tt as d}from"./index-C4Mv6tV6.js";import{$ as f,A as p,B as m,E as h,F as g,H as _,K as v,L as y,N as b,O as x,P as S,Q as C,R as w,S as T,T as ee,U as E,W as D,X as O,Y as te,Z as k,_ as ne,_t as A,a as re,c as ie,d as ae,dt as j,et as M,ft as oe,g as se,gt as ce,h as le,ht as ue,i as de,it as N,j as fe,k as pe,l as P,lt as F,mt as me,n as he,nt as I,o as ge,pt as L,q as R,r as z,rt as B,s as _e,t as ve,u as ye,ut as V,v as be,w as H,z as xe}from"./BarChart-nBOMNfiy.js";var Se=o(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),U=e(t());function W(){return W=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(null,arguments)}var G=e=>{var{cx:t,cy:n,r,className:i}=e,a=s(`recharts-dot`,i);return j(t)&&j(n)&&j(r)?U.createElement(`circle`,W({},ce(e),N(e),{className:a,cx:t,cy:n,r})):null},Ce=[`points`];function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?K(Object(n),!0).forEach(function(t){we(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function we(e,t,n){return(t=Te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Te(e){var t=Ee(e,`string`);return typeof t==`symbol`?t:t+``}function Ee(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}function De(e,t){if(e==null)return{};var n,r,i=Oe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Oe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ke(e){var{option:t,dotProps:n,className:r}=e;if((0,U.isValidElement)(t))return(0,U.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=s(r,typeof t==`boolean`?``:t.className),a=n??{},{points:o}=a,c=De(a,Ce);return U.createElement(G,J({},c,{className:i}))}function Ae(e,t){return e==null?!1:t?!0:e.length===1}function je(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:c,zIndex:l=y.scatter}=e;if(!Ae(t,n))return null;var u=H(n),d=ue(n),f=t.map((e,r)=>{var s=q(q(q({r:3},o),d),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return U.createElement(ke,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&c!=null&&(m.clipPath=`url(#clipPath-${u?``:`dots-`}${c})`),U.createElement(p,{zIndex:l},U.createElement(L,J({className:r},m),f))}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Me(Object(n),!0).forEach(function(t){Ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ne(e,t,n){return(t=Pe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e){var t=Fe(e,`string`);return typeof t==`symbol`?t:t+``}function Fe(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ie=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var s=Y(Y(Y({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),A(i)),N(i)),c=(0,U.isValidElement)(i)?(0,U.cloneElement)(i,s):typeof i==`function`?i(s):U.createElement(G,s);return U.createElement(L,{className:`recharts-active-dot`,clipPath:o},c)};function Le(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=y.activeDot}=e,s=I(fe),c=ye();if(t==null||c==null)return null;var l=t.find(e=>c.includes(e.payload));return V(l)?null:U.createElement(p,{zIndex:o},U.createElement(Ie,{point:l,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var Re=(e,t,n,r)=>b(e,`xAxis`,t,r),ze=(e,t,n,r)=>S(e,`xAxis`,t,r),Be=(e,t,n,r)=>b(e,`yAxis`,n,r),Ve=(e,t,n,r)=>S(e,`yAxis`,n,r),He=M([E,Re,Be,ze,Ve],(e,t,n,r,i)=>f(e,`xAxis`)?te(t,r,!1):te(n,i,!1)),Ue=(e,t,n,r,i)=>i;function We(e){return e.type===`line`}var Ge=M([E,Re,Be,ze,Ve,M([g,Ue],(e,t)=>e.filter(We).find(e=>e.id===t)),He,w],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return gt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function Ke(e){var t=A(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var qe=[`id`],Je=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],Ye=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Xe(Object(n),!0).forEach(function(t){Ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e,t,n){return(t=Qe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qe(e){var t=$e(e,`string`);return typeof t==`symbol`?t:t+``}function $e(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Q(e,t){if(e==null)return{};var n,r,i=et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function et(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var tt=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k(n,t),payload:e}]},nt=U.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:oe,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return U.createElement(be,{tooltipEntrySettings:d})}),rt=(e,t)=>`${t}px ${e}px`;function it(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i<t;++i)r.push(...n);return r}var at=(e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return rt(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],s=0,c=0;s<n.length;c+=(l=n[s])??0,++s){var l,u=n[s];if(u!=null&&c+u>a){o=[...n.slice(0,s),a-c];break}}var d=o.length%2==0?[0,t]:[t];return[...it(n,i),...o,...d].map(e=>`${e}px`).join(`, `)};function ot(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=ce(Q(r,qe));return U.createElement(je,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function st(e){var{showLabels:t,children:n,points:r}=e,i=(0,U.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return U.createElement(ee,{value:t?i:void 0},n)}function ct(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=Z(Z({},me(Q(a,Je))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return U.createElement(U.Fragment,null,r?.length>1&&U.createElement(T,X({shapeType:`curve`,option:u},d,{pathRef:n})),U.createElement(ot,{points:r,clipPathId:t,props:a}))}function lt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function ut(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,animateNewValues:f,width:p,height:g,onAnimationEnd:_,onAnimationStart:v}=n,y=i.current,b=xe(o,`recharts-line-`),x=(0,U.useRef)(b),[S,C]=(0,U.useState)(!1),w=!S,T=(0,U.useCallback)(()=>{typeof _==`function`&&_(),C(!1)},[_]),ee=(0,U.useCallback)(()=>{typeof v==`function`&&v(),C(!0)},[v]),E=lt(r.current),D=(0,U.useRef)(0);x.current!==b&&(D.current=a.current,x.current=b);var O=D.current;return U.createElement(st,{points:o,showLabels:w},n.children,U.createElement(m,{animationId:b,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:T,onAnimationStart:ee,key:b},e=>{var l=F(O,E+O,e),u=Math.min(l,E),d=c?s?at(u,E,`${s}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):rt(E,u):s==null?void 0:String(s);if(e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),y){var m=y.length/o.length,h=e===1?o:o.map((t,n)=>{var r=Math.floor(n*m);if(y[r]){var i=y[r];return Z(Z({},t),{},{x:F(i.x,t.x,e),y:F(i.y,t.y,e)})}return f?Z(Z({},t),{},{x:F(p*2,t.x,e),y:F(g/2,t.y,e)}):Z(Z({},t),{},{x:t.x,y:t.y})});return i.current=h,U.createElement(ct,{props:n,points:h,clipPathId:t,pathRef:r,strokeDasharray:d})}return U.createElement(ct,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:d})}),U.createElement(h,{label:n.label}))}function dt(e){var{clipPathId:t,props:n}=e,r=(0,U.useRef)(null),i=(0,U.useRef)(0),a=(0,U.useRef)(null);return U.createElement(ut,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var ft=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:C(e.payload,t)}),pt=class extends U.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:c,width:l,height:u,id:d,needClip:f,zIndex:m}=this.props;if(e)return null;var h=s(`recharts-line`,r),g=d,{r:_,strokeWidth:v}=Ke(t),y=H(t),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return U.createElement(p,{zIndex:m},U.createElement(L,{className:h},f&&U.createElement(`defs`,null,U.createElement(ge,{clipPathId:g,xAxisId:i,yAxisId:a}),!y&&U.createElement(`clipPath`,{id:`clipPath-dots-${g}`},U.createElement(`rect`,{x:c-b/2,y:o-b/2,width:l+b,height:u+b}))),U.createElement(ie,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:ft,errorBarOffset:0},U.createElement(dt,{props:this.props,clipPathId:g}))),U.createElement(Le,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}},mt={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:y.line,type:`linear`};function ht(e){var t=B(e,mt),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,hide:l,isAnimationActive:u,label:d,legendType:f,xAxisId:p,yAxisId:m,id:h}=t,g=Q(t,Ye),{needClip:_}=_e(p,m),v=ae(),y=D(),b=R(),x=I(e=>Ge(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var{height:S,width:C,x:w,y:T}=v;return U.createElement(pt,X({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:w,top:T,needClip:_}))}function gt(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=C(e,o);if(t===`horizontal`)return{x:O({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(V(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=V(l)?null:n.scale.map(l),d=O({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function _t(e){var t=B(e,mt),n=R();return U.createElement(se,{id:t.id,type:`line`},e=>U.createElement(U.Fragment,null,U.createElement(ne,{legendPayload:tt(t)}),U.createElement(nt,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),U.createElement(le,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),U.createElement(ht,X({},t,{id:e}))))}var vt=U.memo(_t,_);vt.displayName=`Line`;var yt=[`axis`],bt=(0,U.forwardRef)((e,t)=>U.createElement(he,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:yt,tooltipPayloadSearcher:pe,categoricalChartProps:e,ref:t})),$=n(),xt=[{value:`7d`,labelKey:`periods.d7`},{value:`30d`,labelKey:`periods.d30`},{value:`90d`,labelKey:`periods.d90`},{value:`all`,labelKey:`periods.all`},{value:`custom`,labelKey:`periods.custom`}];function St({period:e,from:t,to:n,onChange:r}){let{t:i}=a(`analytics`);function o(e){e===`custom`?r(`custom`,t,n):r(e)}function s(e){r(`custom`,e,n)}function l(e){r(`custom`,t,e)}return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-1`,children:xt.map(t=>(0,$.jsx)(`button`,{onClick:()=>o(t.value),className:c(`h-7 px-3 rounded-md text-xs font-medium transition-colors`,e===t.value?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:i(t.labelKey)},t.value))}),e===`custom`&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`date`,value:t,onChange:e=>s(e.target.value),"aria-label":i(`periods.startDate`),className:`h-7 px-2 rounded-md text-xs bg-card border border-border text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`periods.to`)}),(0,$.jsx)(`input`,{type:`date`,value:n,onChange:e=>l(e.target.value),"aria-label":i(`periods.endDate`),className:`h-7 px-2 rounded-md text-xs bg-card border border-border text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]})]})}function Ct({kpi:e,windowLabel:t}){let{t:n}=a(`analytics`),r=e.estimatedCostUsd??0,i=e.estimatedCostToday??0,o=e.includesEstimated??r>0,s=r>0,c=i>0,l=typeof e.pricedRuns==`number`||typeof e.unpricedRuns==`number`,u=e.unpricedRuns??0,d=e.pricedRuns??(l?Math.max(0,e.totalJobs-u):e.totalJobs),f=l&&e.totalCostUsd===0&&u>0&&d===0,p=u>0&&(d>0||e.totalCostUsd>0),m=e.unpricedTodayRuns??0,h=e.pricedTodayRuns??(l?Math.max(0,e.jobsToday-m):e.jobsToday),g=l&&e.costToday===0&&m>0&&h===0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[{key:`totalCost`,label:n(`desktop.totalCost`),value:f?`—`:`${s?`~`:``}$${e.totalCostUsd.toFixed(4)}`,sub:g?n(`desktop.costTodayUnavailable`):n(`desktop.costToday`,{value:`${c?`~`:``}$${e.costToday.toFixed(4)}`}),estimated:s,window:t},{key:`totalJobs`,label:n(`desktop.totalJobs`),value:e.totalJobs.toLocaleString(),sub:n(`desktop.jobsToday`,{n:e.jobsToday}),estimated:!1},{key:`successRate`,label:n(`desktop.successRate`),value:`${(e.successRate*100).toFixed(1)}%`,sub:n(`desktop.acrossAllProjects`),estimated:!1},{key:`avgCostPerJob`,label:n(`desktop.avgCostPerJob`),value:e.totalJobs>0&&u===0?`${s?`~`:``}$${(e.totalCostUsd/e.totalJobs).toFixed(5)}`:`—`,sub:n(u>0?`desktop.averageUnavailable`:`desktop.periodAverage`),estimated:s&&e.totalJobs>0}].map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,"data-estimated":e.estimated?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 mb-1`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.label}),`window`in e&&e.window&&(0,$.jsx)(`span`,{"data-testid":`kpi-window-label`,className:`text-[10px] text-muted-foreground/70 whitespace-nowrap`,children:e.window})]}),(0,$.jsx)(`p`,{className:`text-xl font-semibold font-mono`,children:e.value}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.sub})]},e.key))}),o&&(0,$.jsx)(`p`,{"data-testid":`kpi-estimated-footnote`,className:`text-[10px] text-muted-foreground/70 italic`,title:n(`desktop.includesEstimatedTooltip`,{amount:`$${r.toFixed(4)}`}),children:n(`desktop.includesEstimated`,{amount:`$${r.toFixed(4)}`})}),(f||p)&&(0,$.jsx)(`p`,{"data-testid":`kpi-cost-coverage-note`,className:`text-[10px] text-muted-foreground/70 italic`,children:f?n(`desktop.costUnavailable`):n(`desktop.costPartiallyUnavailable`,{count:u})})]})}function wt({data:e}){let{t}=a(`analytics`),n=l(),i=e.length>0&&e.some(e=>e.costUsd>0),o=e.reduce((e,t)=>e+(t.unpricedCount??0),0),s=!i&&o>0,c=i&&o>0,u=Math.max(1,Math.floor(e.length/7)),f=e.filter((e,t)=>t%u===0).map(e=>e.date),p=new Map(e.map(e=>[e.date,e.estimatedCostUsd??0])),m=e.some(e=>(e.estimatedCostUsd??0)>0);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`desktop.costOverTime`)}),m&&(0,$.jsx)(`span`,{"data-testid":`timeline-estimated-note`,className:`text-[10px] text-muted-foreground/70 italic`,title:t(`desktop.timelineEstimatedTooltip`),children:t(`desktop.includesEstimatedShort`)}),c&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 italic`,children:t(`desktop.costPartiallyUnavailable`,{count:o})})]}),s?(0,$.jsx)(`div`,{"data-testid":`desktop-timeline-cost-unavailable`,className:`h-[200px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.costUnavailable`)}):i?(0,$.jsx)(v,{width:`100%`,height:200,children:(0,$.jsxs)(bt,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,$.jsx)(P,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,$.jsx)(de,{dataKey:`date`,ticks:f,tickFormatter:e=>{try{return d(new Date(e),`MMM d`,{locale:r()})}catch{return e}},tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,$.jsx)(z,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,$.jsx)(x,{content:({active:e,payload:t,label:n})=>{if(!e||!t?.length)return null;let r=(p.get(n)??0)>0;return(0,$.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,$.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,$.jsxs)(`p`,{className:`font-medium`,children:[r?`~`:``,`$`,t[0].value.toFixed(4)]})]})}}),(0,$.jsx)(vt,{type:`monotone`,dataKey:`costUsd`,stroke:n.chart[0],strokeWidth:2,dot:!1,activeDot:{r:3,fill:n.chart[0]}})]})}):(0,$.jsx)(`div`,{className:`h-[200px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.noCostData`)})]})}function Tt({projects:e}){let{t}=a(`analytics`),n=l();if(e.length===0)return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:t(`desktop.projectComparison`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`desktop.noProjects`)})]});let r=Math.max(...e.map(e=>e.totalCostUsd),1e-4);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-4`,children:t(`desktop.projectComparison`)}),(0,$.jsx)(`div`,{className:`space-y-3`,children:e.map((e,i)=>{let a=e.estimatedCostUsd??0,o=a>0,s=e.unpricedRuns??0,c=e.pricedRuns??Math.max(0,e.totalJobs-s),l=s>0&&c===0,u=s>0&&c>0;return(0,$.jsxs)(`div`,{className:`space-y-1`,"data-estimated":o?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsxs)(`span`,{className:`font-medium truncate max-w-[160px] flex items-center gap-1`,title:e.projectName,children:[e.projectName,o&&(0,$.jsx)(`span`,{"data-testid":`project-estimated-badge`,className:`text-[9px] uppercase tracking-wide text-muted-foreground/70 not-italic border border-border/40 rounded px-1`,title:t(`desktop.projectEstimatedTooltip`,{amount:`$${a.toFixed(4)}`}),children:t(`desktop.estimatedBadge`)})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:t(`desktop.jobsCount`,{count:e.totalJobs})}),(0,$.jsx)(`span`,{children:t(`desktop.successPct`,{pct:(e.successRate*100).toFixed(0)})}),(0,$.jsx)(`span`,{className:`font-mono text-foreground`,title:u?t(`desktop.costPartiallyUnavailable`,{count:s}):void 0,children:l?t(`desktop.costUnavailableShort`):`${o?`~`:``}$${e.totalCostUsd.toFixed(4)}`})]})]}),(0,$.jsx)(`div`,{className:`h-1.5 rounded-full bg-border/30 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${e.totalCostUsd/r*100}%`,backgroundColor:n.chart[i%n.chart.length]}})})]},e.projectId)})})]})}function Et({projects:e}){let{t}=a(`analytics`),n=l();if(e.length===0)return null;let r=e.map(e=>({name:e.projectName.slice(0,12),costUsd:e.totalCostUsd})),i=e.some(e=>e.totalCostUsd>0),o=e.some(e=>(e.unpricedRuns??0)>0);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:t(`desktop.costByProject`)}),!i&&o?(0,$.jsx)(`div`,{"data-testid":`desktop-project-cost-unavailable`,className:`h-[180px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.costUnavailable`)}):(0,$.jsx)(v,{width:`100%`,height:180,children:(0,$.jsxs)(ve,{data:r,margin:{top:4,right:8,left:0,bottom:0},children:[(0,$.jsx)(P,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,$.jsx)(de,{dataKey:`name`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,$.jsx)(z,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,$.jsx)(x,{content:({active:e,payload:t,label:n})=>e&&t?.length?(0,$.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,$.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,$.jsxs)(`p`,{className:`font-medium`,children:[`$`,t[0].value.toFixed(4)]})]}):null}),(0,$.jsx)(re,{dataKey:`costUsd`,fill:n.chart[1],radius:[3,3,0,0]})]})})]})}function Dt(){let{t:e}=a(`analytics`),[t,n]=(0,U.useState)(`7d`),[r,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,d]=(0,U.useState)(null),[f,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(null),{registerHandler:g,unregisterHandler:_}=i(),v=(0,U.useCallback)(e=>{let n=e;(n.type===`spending.invalidated`||n.type===`rail.job_completed`)&&y(t,r,s)},[t,r,s]);(0,U.useEffect)(()=>(g(`desktop-analytics`,v),()=>_(`desktop-analytics`)),[v,g,_]);async function y(e,t,n){p(!0),h(null);try{let r=new URLSearchParams({period:e});e===`custom`&&t&&n&&(r.set(`from`,t),r.set(`to`,n));let i=await fetch(`/api/analytics?${r}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json();d(a)}catch(e){h(e.message)}finally{p(!1)}}(0,U.useEffect)(()=>{y(t,r,s)},[t,r,s]);function b(e,t,r){n(e),t!==void 0&&o(t),r!==void 0&&c(r)}return(0,$.jsx)(`div`,{className:`flex flex-col h-full overflow-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Se,{className:`w-4 h-4 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`desktop.title`)}),l&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.period.label})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 mr-8`,children:[(0,$.jsx)(St,{period:t,from:r,to:s,onChange:b}),(0,$.jsx)(`button`,{onClick:()=>y(t,r,s),disabled:f,className:`flex items-center gap-1.5 h-7 px-2 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50`,"aria-label":e(`desktop.refreshAria`),children:(0,$.jsx)(u,{className:`w-3 h-3 ${f?`animate-spin`:``}`})})]})]}),m&&(0,$.jsx)(`div`,{className:`rounded-lg border border-red-400/30 aurora-light:border-destructive/30 bg-red-400/10 aurora-light:bg-destructive/10 p-3 text-xs text-red-400 aurora-light:text-destructive`,children:e(`desktop.failedToLoad`,{error:m})}),f&&!l&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,$.jsx)(`div`,{className:`h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Array.from({length:2}).map((e,t)=>(0,$.jsx)(`div`,{className:`h-[220px] rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))})]}),l&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(Ct,{kpi:l.kpi,windowLabel:t===`custom`?l.period.label:e(`windowLabels.${t}`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,$.jsx)(wt,{data:l.costTimeline}),(0,$.jsx)(Et,{projects:l.projectBreakdown})]}),(0,$.jsx)(Tt,{projects:l.projectBreakdown})]})]})})}export{Dt as default};
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{m as r,r as i}from"./useSharedWebSocket-TzKtPRp9.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{t as s}from"./clsx-CjueKrWZ.js";import{t as c}from"./utils-BC4DHlz2.js";import{ct as l,tn as u,wt as d}from"./index-JSTZVJfe.js";import{$ as f,A as p,B as m,E as h,F as g,H as _,K as v,L as y,N as b,O as x,P as S,Q as C,R as w,S as T,T as ee,U as E,W as D,X as O,Y as te,Z as k,_ as ne,_t as A,a as re,c as ie,d as ae,dt as j,et as M,ft as oe,g as se,gt as ce,h as le,ht as ue,i as de,it as N,j as fe,k as pe,l as P,lt as F,mt as me,n as he,nt as I,o as ge,pt as L,q as R,r as z,rt as B,s as _e,t as ve,u as ye,ut as V,v as be,w as H,z as xe}from"./BarChart-nBOMNfiy.js";var Se=o(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),U=e(t());function W(){return W=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},W.apply(null,arguments)}var G=e=>{var{cx:t,cy:n,r,className:i}=e,a=s(`recharts-dot`,i);return j(t)&&j(n)&&j(r)?U.createElement(`circle`,W({},ce(e),N(e),{className:a,cx:t,cy:n,r})):null},Ce=[`points`];function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?K(Object(n),!0).forEach(function(t){we(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function we(e,t,n){return(t=Te(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Te(e){var t=Ee(e,`string`);return typeof t==`symbol`?t:t+``}function Ee(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},J.apply(null,arguments)}function De(e,t){if(e==null)return{};var n,r,i=Oe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Oe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function ke(e){var{option:t,dotProps:n,className:r}=e;if((0,U.isValidElement)(t))return(0,U.cloneElement)(t,n);if(typeof t==`function`)return t(n);var i=s(r,typeof t==`boolean`?``:t.className),a=n??{},{points:o}=a,c=De(a,Ce);return U.createElement(G,J({},c,{className:i}))}function Ae(e,t){return e==null?!1:t?!0:e.length===1}function je(e){var{points:t,dot:n,className:r,dotClassName:i,dataKey:a,baseProps:o,needClip:s,clipPathId:c,zIndex:l=y.scatter}=e;if(!Ae(t,n))return null;var u=H(n),d=ue(n),f=t.map((e,r)=>{var s=q(q(q({r:3},o),d),{},{index:r,cx:e.x??void 0,cy:e.y??void 0,dataKey:a,value:e.value,payload:e.payload,points:t});return U.createElement(ke,{key:`dot-${r}`,option:n,dotProps:s,className:i})}),m={};return s&&c!=null&&(m.clipPath=`url(#clipPath-${u?``:`dots-`}${c})`),U.createElement(p,{zIndex:l},U.createElement(L,J({className:r},m),f))}function Me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Me(Object(n),!0).forEach(function(t){Ne(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Me(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ne(e,t,n){return(t=Pe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pe(e){var t=Fe(e,`string`);return typeof t==`symbol`?t:t+``}function Fe(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Ie=e=>{var{point:t,childIndex:n,mainColor:r,activeDot:i,dataKey:a,clipPath:o}=e;if(i===!1||t.x==null||t.y==null)return null;var s=Y(Y(Y({},{index:n,dataKey:a,cx:t.x,cy:t.y,r:4,fill:r??`none`,strokeWidth:2,stroke:`#fff`,payload:t.payload,value:t.value}),A(i)),N(i)),c=(0,U.isValidElement)(i)?(0,U.cloneElement)(i,s):typeof i==`function`?i(s):U.createElement(G,s);return U.createElement(L,{className:`recharts-active-dot`,clipPath:o},c)};function Le(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:i,clipPath:a,zIndex:o=y.activeDot}=e,s=I(fe),c=ye();if(t==null||c==null)return null;var l=t.find(e=>c.includes(e.payload));return V(l)?null:U.createElement(p,{zIndex:o},U.createElement(Ie,{point:l,childIndex:Number(s),mainColor:n,dataKey:i,activeDot:r,clipPath:a}))}var Re=(e,t,n,r)=>b(e,`xAxis`,t,r),ze=(e,t,n,r)=>S(e,`xAxis`,t,r),Be=(e,t,n,r)=>b(e,`yAxis`,n,r),Ve=(e,t,n,r)=>S(e,`yAxis`,n,r),He=M([E,Re,Be,ze,Ve],(e,t,n,r,i)=>f(e,`xAxis`)?te(t,r,!1):te(n,i,!1)),Ue=(e,t,n,r,i)=>i;function We(e){return e.type===`line`}var Ge=M([E,Re,Be,ze,Ve,M([g,Ue],(e,t)=>e.filter(We).find(e=>e.id===t)),He,w],(e,t,n,r,i,a,o,s)=>{var{chartData:c,dataStartIndex:l,dataEndIndex:u}=s;if(!(a==null||t==null||n==null||r==null||i==null||r.length===0||i.length===0||o==null||e!==`horizontal`&&e!==`vertical`)){var{dataKey:d,data:f}=a,p=f!=null&&f.length>0?f:c?.slice(l,u+1);if(p!=null)return gt({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataKey:d,bandSize:o,displayedData:p})}});function Ke(e){var t=A(e),n=3,r=2;if(t!=null){var{r:i,strokeWidth:a}=t,o=Number(i),s=Number(a);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(s)||s<0)&&(s=r),{r:o,strokeWidth:s}}return{r:n,strokeWidth:r}}var qe=[`id`],Je=[`type`,`layout`,`connectNulls`,`needClip`,`shape`],Ye=[`activeDot`,`animateNewValues`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`hide`,`isAnimationActive`,`label`,`legendType`,`xAxisId`,`yAxisId`,`id`];function X(){return X=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},X.apply(null,arguments)}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Xe(Object(n),!0).forEach(function(t){Ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ze(e,t,n){return(t=Qe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qe(e){var t=$e(e,`string`);return typeof t==`symbol`?t:t+``}function $e(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Q(e,t){if(e==null)return{};var n,r,i=et(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function et(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var tt=e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k(n,t),payload:e}]},nt=U.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:s,unit:c,tooltipType:l,id:u}=e,d={dataDefinedOnItem:n,getPosition:oe,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k(o,t),hide:s,type:l,color:r,unit:c,graphicalItemId:u}};return U.createElement(be,{tooltipEntrySettings:d})}),rt=(e,t)=>`${t}px ${e}px`;function it(e,t){for(var n=e.length%2==0?e:[...e,0],r=[],i=0;i<t;++i)r.push(...n);return r}var at=(e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return rt(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],s=0,c=0;s<n.length;c+=(l=n[s])??0,++s){var l,u=n[s];if(u!=null&&c+u>a){o=[...n.slice(0,s),a-c];break}}var d=o.length%2==0?[0,t]:[t];return[...it(n,i),...o,...d].map(e=>`${e}px`).join(`, `)};function ot(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:s}=r,c=ce(Q(r,qe));return U.createElement(je,{points:n,dot:i,className:`recharts-line-dots`,dotClassName:`recharts-line-dot`,dataKey:a,baseProps:c,needClip:o,clipPathId:t})}function st(e){var{showLabels:t,children:n,points:r}=e,i=(0,U.useMemo)(()=>r?.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return Z(Z({},t),{},{value:e.value,payload:e.payload,viewBox:t,parentViewBox:void 0,fill:void 0})}),[r]);return U.createElement(ee,{value:t?i:void 0},n)}function ct(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:s,connectNulls:c,needClip:l,shape:u}=a,d=Z(Z({},me(Q(a,Je))),{},{fill:`none`,className:`recharts-line-curve`,clipPath:l?`url(#clipPath-${t})`:void 0,points:r,type:o,layout:s,connectNulls:c,strokeDasharray:i??a.strokeDasharray});return U.createElement(U.Fragment,null,r?.length>1&&U.createElement(T,X({shapeType:`curve`,option:u},d,{pathRef:n})),U.createElement(ot,{points:r,clipPathId:t,props:a}))}function lt(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function ut(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:s,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,animateNewValues:f,width:p,height:g,onAnimationEnd:_,onAnimationStart:v}=n,y=i.current,b=xe(o,`recharts-line-`),x=(0,U.useRef)(b),[S,C]=(0,U.useState)(!1),w=!S,T=(0,U.useCallback)(()=>{typeof _==`function`&&_(),C(!1)},[_]),ee=(0,U.useCallback)(()=>{typeof v==`function`&&v(),C(!0)},[v]),E=lt(r.current),D=(0,U.useRef)(0);x.current!==b&&(D.current=a.current,x.current=b);var O=D.current;return U.createElement(st,{points:o,showLabels:w},n.children,U.createElement(m,{animationId:b,begin:l,duration:u,isActive:c,easing:d,onAnimationEnd:T,onAnimationStart:ee,key:b},e=>{var l=F(O,E+O,e),u=Math.min(l,E),d=c?s?at(u,E,`${s}`.split(/[,\s]+/gim).map(e=>parseFloat(e))):rt(E,u):s==null?void 0:String(s);if(e>0&&E>0&&(i.current=o,a.current=Math.max(a.current,u)),y){var m=y.length/o.length,h=e===1?o:o.map((t,n)=>{var r=Math.floor(n*m);if(y[r]){var i=y[r];return Z(Z({},t),{},{x:F(i.x,t.x,e),y:F(i.y,t.y,e)})}return f?Z(Z({},t),{},{x:F(p*2,t.x,e),y:F(g/2,t.y,e)}):Z(Z({},t),{},{x:t.x,y:t.y})});return i.current=h,U.createElement(ct,{props:n,points:h,clipPathId:t,pathRef:r,strokeDasharray:d})}return U.createElement(ct,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:d})}),U.createElement(h,{label:n.label}))}function dt(e){var{clipPathId:t,props:n}=e,r=(0,U.useRef)(null),i=(0,U.useRef)(0),a=(0,U.useRef)(null);return U.createElement(ut,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var ft=(e,t)=>({x:e.x??void 0,y:e.y??void 0,value:e.value,errorVal:C(e.payload,t)}),pt=class extends U.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:c,width:l,height:u,id:d,needClip:f,zIndex:m}=this.props;if(e)return null;var h=s(`recharts-line`,r),g=d,{r:_,strokeWidth:v}=Ke(t),y=H(t),b=_*2+v,x=f?`url(#clipPath-${y?``:`dots-`}${g})`:void 0;return U.createElement(p,{zIndex:m},U.createElement(L,{className:h},f&&U.createElement(`defs`,null,U.createElement(ge,{clipPathId:g,xAxisId:i,yAxisId:a}),!y&&U.createElement(`clipPath`,{id:`clipPath-dots-${g}`},U.createElement(`rect`,{x:c-b/2,y:o-b/2,width:l+b,height:u+b}))),U.createElement(ie,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:ft,errorBarOffset:0},U.createElement(dt,{props:this.props,clipPathId:g}))),U.createElement(Le,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}},mt={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,connectNulls:!1,dot:!0,fill:`#fff`,hide:!1,isAnimationActive:`auto`,label:!1,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:y.line,type:`linear`};function ht(e){var t=B(e,mt),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:s,dot:c,hide:l,isAnimationActive:u,label:d,legendType:f,xAxisId:p,yAxisId:m,id:h}=t,g=Q(t,Ye),{needClip:_}=_e(p,m),v=ae(),y=D(),b=R(),x=I(e=>Ge(e,p,m,b,h));if(y!==`horizontal`&&y!==`vertical`||x==null||v==null)return null;var{height:S,width:C,x:w,y:T}=v;return U.createElement(pt,X({},g,{id:h,connectNulls:s,dot:c,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:u,hide:l,label:d,legendType:f,xAxisId:p,yAxisId:m,points:x,layout:y,height:S,width:C,left:w,top:T,needClip:_}))}function gt(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:s,displayedData:c}=e;return c.map((e,c)=>{var l=C(e,o);if(t===`horizontal`)return{x:O({axis:n,ticks:i,bandSize:s,entry:e,index:c}),y:(V(l)?null:r.scale.map(l))??null,value:l,payload:e};var u=V(l)?null:n.scale.map(l),d=O({axis:r,ticks:a,bandSize:s,entry:e,index:c});return u==null||d==null?null:{x:u,y:d,value:l,payload:e}}).filter(Boolean)}function _t(e){var t=B(e,mt),n=R();return U.createElement(se,{id:t.id,type:`line`},e=>U.createElement(U.Fragment,null,U.createElement(ne,{legendPayload:tt(t)}),U.createElement(nt,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),U.createElement(le,{type:`line`,id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),U.createElement(ht,X({},t,{id:e}))))}var vt=U.memo(_t,_);vt.displayName=`Line`;var yt=[`axis`],bt=(0,U.forwardRef)((e,t)=>U.createElement(he,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:yt,tooltipPayloadSearcher:pe,categoricalChartProps:e,ref:t})),$=n(),xt=[{value:`7d`,labelKey:`periods.d7`},{value:`30d`,labelKey:`periods.d30`},{value:`90d`,labelKey:`periods.d90`},{value:`all`,labelKey:`periods.all`},{value:`custom`,labelKey:`periods.custom`}];function St({period:e,from:t,to:n,onChange:r}){let{t:i}=a(`analytics`);function o(e){e===`custom`?r(`custom`,t,n):r(e)}function s(e){r(`custom`,e,n)}function l(e){r(`custom`,t,e)}return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-1`,children:xt.map(t=>(0,$.jsx)(`button`,{onClick:()=>o(t.value),className:c(`h-7 px-3 rounded-md text-xs font-medium transition-colors`,e===t.value?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent`),children:i(t.labelKey)},t.value))}),e===`custom`&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{type:`date`,value:t,onChange:e=>s(e.target.value),"aria-label":i(`periods.startDate`),className:`h-7 px-2 rounded-md text-xs bg-card border border-border text-foreground focus:outline-none focus:ring-1 focus:ring-primary`}),(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i(`periods.to`)}),(0,$.jsx)(`input`,{type:`date`,value:n,onChange:e=>l(e.target.value),"aria-label":i(`periods.endDate`),className:`h-7 px-2 rounded-md text-xs bg-card border border-border text-foreground focus:outline-none focus:ring-1 focus:ring-primary`})]})]})}function Ct({kpi:e,windowLabel:t}){let{t:n}=a(`analytics`),r=e.estimatedCostUsd??0,i=e.estimatedCostToday??0,o=e.includesEstimated??r>0,s=r>0,c=i>0,l=typeof e.pricedRuns==`number`||typeof e.unpricedRuns==`number`,u=e.unpricedRuns??0,d=e.pricedRuns??(l?Math.max(0,e.totalJobs-u):e.totalJobs),f=l&&e.totalCostUsd===0&&u>0&&d===0,p=u>0&&(d>0||e.totalCostUsd>0),m=e.unpricedTodayRuns??0,h=e.pricedTodayRuns??(l?Math.max(0,e.jobsToday-m):e.jobsToday),g=l&&e.costToday===0&&m>0&&h===0;return(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:[{key:`totalCost`,label:n(`desktop.totalCost`),value:f?`—`:`${s?`~`:``}$${e.totalCostUsd.toFixed(4)}`,sub:g?n(`desktop.costTodayUnavailable`):n(`desktop.costToday`,{value:`${c?`~`:``}$${e.costToday.toFixed(4)}`}),estimated:s,window:t},{key:`totalJobs`,label:n(`desktop.totalJobs`),value:e.totalJobs.toLocaleString(),sub:n(`desktop.jobsToday`,{n:e.jobsToday}),estimated:!1},{key:`successRate`,label:n(`desktop.successRate`),value:`${(e.successRate*100).toFixed(1)}%`,sub:n(`desktop.acrossAllProjects`),estimated:!1},{key:`avgCostPerJob`,label:n(`desktop.avgCostPerJob`),value:e.totalJobs>0&&u===0?`${s?`~`:``}$${(e.totalCostUsd/e.totalJobs).toFixed(5)}`:`—`,sub:n(u>0?`desktop.averageUnavailable`:`desktop.periodAverage`),estimated:s&&e.totalJobs>0}].map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,"data-estimated":e.estimated?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-1 mb-1`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.label}),`window`in e&&e.window&&(0,$.jsx)(`span`,{"data-testid":`kpi-window-label`,className:`text-[10px] text-muted-foreground/70 whitespace-nowrap`,children:e.window})]}),(0,$.jsx)(`p`,{className:`text-xl font-semibold font-mono`,children:e.value}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:e.sub})]},e.key))}),o&&(0,$.jsx)(`p`,{"data-testid":`kpi-estimated-footnote`,className:`text-[10px] text-muted-foreground/70 italic`,title:n(`desktop.includesEstimatedTooltip`,{amount:`$${r.toFixed(4)}`}),children:n(`desktop.includesEstimated`,{amount:`$${r.toFixed(4)}`})}),(f||p)&&(0,$.jsx)(`p`,{"data-testid":`kpi-cost-coverage-note`,className:`text-[10px] text-muted-foreground/70 italic`,children:f?n(`desktop.costUnavailable`):n(`desktop.costPartiallyUnavailable`,{count:u})})]})}function wt({data:e}){let{t}=a(`analytics`),n=u(),i=e.length>0&&e.some(e=>e.costUsd>0),o=e.reduce((e,t)=>e+(t.unpricedCount??0),0),s=!i&&o>0,c=i&&o>0,d=Math.max(1,Math.floor(e.length/7)),f=e.filter((e,t)=>t%d===0).map(e=>e.date),p=new Map(e.map(e=>[e.date,e.estimatedCostUsd??0])),m=e.some(e=>(e.estimatedCostUsd??0)>0);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium`,children:t(`desktop.costOverTime`)}),m&&(0,$.jsx)(`span`,{"data-testid":`timeline-estimated-note`,className:`text-[10px] text-muted-foreground/70 italic`,title:t(`desktop.timelineEstimatedTooltip`),children:t(`desktop.includesEstimatedShort`)}),c&&(0,$.jsx)(`span`,{className:`text-[10px] text-muted-foreground/70 italic`,children:t(`desktop.costPartiallyUnavailable`,{count:o})})]}),s?(0,$.jsx)(`div`,{"data-testid":`desktop-timeline-cost-unavailable`,className:`h-[200px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.costUnavailable`)}):i?(0,$.jsx)(v,{width:`100%`,height:200,children:(0,$.jsxs)(bt,{data:e,margin:{top:4,right:8,left:0,bottom:0},children:[(0,$.jsx)(P,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,$.jsx)(de,{dataKey:`date`,ticks:f,tickFormatter:e=>{try{return l(new Date(e),`MMM d`,{locale:r()})}catch{return e}},tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,$.jsx)(z,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,$.jsx)(x,{content:({active:e,payload:t,label:n})=>{if(!e||!t?.length)return null;let r=(p.get(n)??0)>0;return(0,$.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,$.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,$.jsxs)(`p`,{className:`font-medium`,children:[r?`~`:``,`$`,t[0].value.toFixed(4)]})]})}}),(0,$.jsx)(vt,{type:`monotone`,dataKey:`costUsd`,stroke:n.chart[0],strokeWidth:2,dot:!1,activeDot:{r:3,fill:n.chart[0]}})]})}):(0,$.jsx)(`div`,{className:`h-[200px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.noCostData`)})]})}function Tt({projects:e}){let{t}=a(`analytics`),n=u();if(e.length===0)return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:t(`desktop.projectComparison`)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t(`desktop.noProjects`)})]});let r=Math.max(...e.map(e=>e.totalCostUsd),1e-4);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-4`,children:t(`desktop.projectComparison`)}),(0,$.jsx)(`div`,{className:`space-y-3`,children:e.map((e,i)=>{let a=e.estimatedCostUsd??0,o=a>0,s=e.unpricedRuns??0,c=e.pricedRuns??Math.max(0,e.totalJobs-s),l=s>0&&c===0,u=s>0&&c>0;return(0,$.jsxs)(`div`,{className:`space-y-1`,"data-estimated":o?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs`,children:[(0,$.jsxs)(`span`,{className:`font-medium truncate max-w-[160px] flex items-center gap-1`,title:e.projectName,children:[e.projectName,o&&(0,$.jsx)(`span`,{"data-testid":`project-estimated-badge`,className:`text-[9px] uppercase tracking-wide text-muted-foreground/70 not-italic border border-border/40 rounded px-1`,title:t(`desktop.projectEstimatedTooltip`,{amount:`$${a.toFixed(4)}`}),children:t(`desktop.estimatedBadge`)})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-4 text-muted-foreground`,children:[(0,$.jsx)(`span`,{children:t(`desktop.jobsCount`,{count:e.totalJobs})}),(0,$.jsx)(`span`,{children:t(`desktop.successPct`,{pct:(e.successRate*100).toFixed(0)})}),(0,$.jsx)(`span`,{className:`font-mono text-foreground`,title:u?t(`desktop.costPartiallyUnavailable`,{count:s}):void 0,children:l?t(`desktop.costUnavailableShort`):`${o?`~`:``}$${e.totalCostUsd.toFixed(4)}`})]})]}),(0,$.jsx)(`div`,{className:`h-1.5 rounded-full bg-border/30 overflow-hidden`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full transition-all duration-500`,style:{width:`${e.totalCostUsd/r*100}%`,backgroundColor:n.chart[i%n.chart.length]}})})]},e.projectId)})})]})}function Et({projects:e}){let{t}=a(`analytics`),n=u();if(e.length===0)return null;let r=e.map(e=>({name:e.projectName.slice(0,12),costUsd:e.totalCostUsd})),i=e.some(e=>e.totalCostUsd>0),o=e.some(e=>(e.unpricedRuns??0)>0);return(0,$.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-medium mb-3`,children:t(`desktop.costByProject`)}),!i&&o?(0,$.jsx)(`div`,{"data-testid":`desktop-project-cost-unavailable`,className:`h-[180px] flex items-center justify-center text-xs text-muted-foreground`,children:t(`desktop.costUnavailable`)}):(0,$.jsx)(v,{width:`100%`,height:180,children:(0,$.jsxs)(ve,{data:r,margin:{top:4,right:8,left:0,bottom:0},children:[(0,$.jsx)(P,{strokeDasharray:`3 3`,stroke:`var(--color-border)`}),(0,$.jsx)(de,{dataKey:`name`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1}),(0,$.jsx)(z,{tickFormatter:e=>`$${e.toFixed(2)}`,tick:{fontSize:10,fill:`var(--color-muted-foreground)`},axisLine:!1,tickLine:!1,width:55}),(0,$.jsx)(x,{content:({active:e,payload:t,label:n})=>e&&t?.length?(0,$.jsxs)(`div`,{className:`bg-popover border border-border/30 rounded-lg p-2 text-xs shadow-lg`,children:[(0,$.jsx)(`p`,{className:`text-muted-foreground mb-1`,children:n}),(0,$.jsxs)(`p`,{className:`font-medium`,children:[`$`,t[0].value.toFixed(4)]})]}):null}),(0,$.jsx)(re,{dataKey:`costUsd`,fill:n.chart[1],radius:[3,3,0,0]})]})})]})}function Dt(){let{t:e}=a(`analytics`),[t,n]=(0,U.useState)(`7d`),[r,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(null),[f,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(null),{registerHandler:g,unregisterHandler:_}=i(),v=(0,U.useCallback)(e=>{let n=e;(n.type===`spending.invalidated`||n.type===`rail.job_completed`)&&y(t,r,s)},[t,r,s]);(0,U.useEffect)(()=>(g(`desktop-analytics`,v),()=>_(`desktop-analytics`)),[v,g,_]);async function y(e,t,n){p(!0),h(null);try{let r=new URLSearchParams({period:e});e===`custom`&&t&&n&&(r.set(`from`,t),r.set(`to`,n));let i=await fetch(`/api/analytics?${r}`);if(!i.ok)throw Error(`HTTP ${i.status}`);let a=await i.json();u(a)}catch(e){h(e.message)}finally{p(!1)}}(0,U.useEffect)(()=>{y(t,r,s)},[t,r,s]);function b(e,t,r){n(e),t!==void 0&&o(t),r!==void 0&&c(r)}return(0,$.jsx)(`div`,{className:`flex flex-col h-full overflow-auto bg-background`,children:(0,$.jsxs)(`div`,{className:`p-4 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Se,{className:`w-4 h-4 text-muted-foreground`}),(0,$.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`desktop.title`)}),l&&(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l.period.label})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 mr-8`,children:[(0,$.jsx)(St,{period:t,from:r,to:s,onChange:b}),(0,$.jsx)(`button`,{onClick:()=>y(t,r,s),disabled:f,className:`flex items-center gap-1.5 h-7 px-2 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent transition-colors disabled:opacity-50`,"aria-label":e(`desktop.refreshAria`),children:(0,$.jsx)(d,{className:`w-3 h-3 ${f?`animate-spin`:``}`})})]})]}),m&&(0,$.jsx)(`div`,{className:`rounded-lg border border-red-400/30 aurora-light:border-destructive/30 bg-red-400/10 aurora-light:bg-destructive/10 p-3 text-xs text-red-400 aurora-light:text-destructive`,children:e(`desktop.failedToLoad`,{error:m})}),f&&!l&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`div`,{className:`grid grid-cols-2 lg:grid-cols-4 gap-3`,children:Array.from({length:4}).map((e,t)=>(0,$.jsx)(`div`,{className:`h-20 rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))}),(0,$.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:Array.from({length:2}).map((e,t)=>(0,$.jsx)(`div`,{className:`h-[220px] rounded-lg border border-border/40 bg-card/50 animate-pulse`},t))})]}),l&&(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(Ct,{kpi:l.kpi,windowLabel:t===`custom`?l.period.label:e(`windowLabels.${t}`)}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,$.jsx)(wt,{data:l.costTimeline}),(0,$.jsx)(Et,{projects:l.projectBreakdown})]}),(0,$.jsx)(Tt,{projects:l.projectBreakdown})]})]})})}export{Dt as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r}from"./createLucideIcon-Bjbbp_KS.js";import{n as i,t as a}from"./file-text-BcLCfcWZ.js";import{t as o}from"./loader-circle-DcygOQpC.js";import{i as s,l as c,o as l,r as u,t as d}from"./dialog-CMgps2MY.js";import{t as f}from"./utils-BC4DHlz2.js";import{n as p,t as m}from"./lib-CGdyxIWg.js";import{Zt as h}from"./index-JSTZVJfe.js";import{t as g}from"./lib-C7Mhm-gT.js";import{t as _}from"./atom-one-dark-qiGhVQxg.js";var v=e(t(),1),y=n();function b({categories:e,activeCategory:t,activeSlug:n,onSelect:i,onHome:o}){let{t:s}=r(`integrations`);return(0,y.jsxs)(`nav`,{className:`w-48 shrink-0 space-y-4 overflow-y-auto border-r border-border pr-2`,children:[(0,y.jsxs)(`button`,{onClick:o,className:f(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,!t&&!n?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,y.jsx)(h,{className:`w-3.5 h-3.5 shrink-0`}),(0,y.jsx)(`span`,{className:`truncate`,children:s(`docs.title`)})]}),e.map(e=>(0,y.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,y.jsxs)(`div`,{className:`px-2.5 mb-1 flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length>0&&(0,y.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground/60 bg-muted/40 rounded px-1 py-0.5 leading-none`,children:e.docs.length})]}),e.docs.length===0?(0,y.jsx)(`p`,{className:`px-2.5 text-xs text-muted-foreground italic`,children:s(`docs.sidebarEmpty`)}):(0,y.jsx)(`ul`,{className:`space-y-0.5`,children:e.docs.map(r=>{let o=t===e.slug&&n===r.slug;return(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{onClick:()=>i(e.slug,r.slug),title:r.title,className:f(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,o?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,y.jsx)(a,{className:`w-3.5 h-3.5 shrink-0`}),(0,y.jsx)(`span`,{className:`truncate`,children:r.title})]})},r.slug)})})]},e.slug))]})}function x({categories:e,onSelect:t}){let{t:n}=r(`integrations`),o=e.reduce((e,t)=>e+t.docs.length,0),s=e.filter(e=>e.docs.length>0).length;return(0,y.jsxs)(`div`,{className:`max-w-2xl mx-auto py-2 px-1 space-y-5`,children:[(0,y.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:o===0?n(`docs.indexEmpty`):n(`docs.summary`,{documents:n(`docs.documentCount`,{count:o}),categories:n(`docs.categoryCount`,{count:s})})}),e.map(e=>(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length===0?(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground italic pl-2`,children:n(`docs.categoryEmpty`)}):(0,y.jsx)(`ul`,{className:`space-y-2`,children:e.docs.map(n=>(0,y.jsx)(`li`,{children:(0,y.jsxs)(`button`,{onClick:()=>t(e.slug,n.slug),className:`w-full flex items-center gap-3 p-2.5 rounded-md border border-border text-left transition-colors hover:bg-muted/40 group`,children:[(0,y.jsx)(a,{className:`w-3.5 h-3.5 text-muted-foreground flex-shrink-0`}),(0,y.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate`,children:n.title}),(0,y.jsx)(i,{className:`w-3 h-3 text-muted-foreground ml-auto md:opacity-0 md:group-hover:opacity-100 transition-opacity`})]})},n.slug))})]},e.slug))]})}var S=(0,v.memo)(function({content:e,currentCategory:t,onNavigateDoc:n}){return(0,y.jsx)(p,{remarkPlugins:[m],rehypePlugins:[g],components:{a({href:e,children:r,...i}){return(0,y.jsx)(`a`,{href:e,onClick:r=>{if(!e)return;if(/^[a-z][a-z0-9+.-]*:/i.test(e)){r.preventDefault(),window.open(e,`_blank`,`noopener,noreferrer`);return}if(e.startsWith(`#`))return;r.preventDefault();let i=_(e,t);i&&n(i.category,i.slug)},...i,children:r})}},children:e})});function C({category:e,slug:t,lang:n,onNotFound:i,onNavigate:a,scrollContainerRef:s}){let{t:c}=r(`integrations`),[l,u]=(0,v.useState)(null),[d,f]=(0,v.useState)(null),p=(0,v.useRef)(0);return(0,v.useEffect)(()=>{let r=++p.current;f(null),fetch(`/api/docs/${e}/${t}?lang=${encodeURIComponent(n)}`).then(async e=>{if(e.status===404){i();return}if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{r===p.current&&e&&(u(e),s.current&&(s.current.scrollTop=0))}).catch(e=>{r===p.current&&f(e instanceof Error?e.message:c(`docs.loadError`))})},[e,t,n,i,s]),!l&&!d?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(o,{className:`w-4 h-4 animate-spin text-muted-foreground`})}):d&&!l?(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsx)(`p`,{className:`text-sm text-destructive`,children:d})}):l?(0,y.jsx)(`article`,{className:`max-w-2xl mx-auto py-2 px-1`,children:(0,y.jsx)(`div`,{className:`prose prose-sm max-w-none
|
|
2
|
+
prose-headings:text-foreground prose-headings:font-bold
|
|
3
|
+
prose-p:text-foreground/90
|
|
4
|
+
prose-a:text-accent-primary prose-a:no-underline hover:prose-a:underline
|
|
5
|
+
prose-strong:text-foreground
|
|
6
|
+
prose-code:text-accent-info prose-code:bg-card prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-xs
|
|
7
|
+
prose-pre:bg-card prose-pre:border prose-pre:border-border prose-pre:rounded-md prose-pre:p-0 prose-pre:overflow-x-auto
|
|
8
|
+
prose-blockquote:border-l-accent-primary prose-blockquote:text-muted-foreground
|
|
9
|
+
prose-hr:border-border
|
|
10
|
+
prose-th:text-foreground prose-td:text-foreground/90
|
|
11
|
+
prose-li:text-foreground/90`,children:(0,y.jsx)(S,{content:l.content,currentCategory:l.category,onNavigateDoc:a})})}):null}function w({open:e,onClose:t}){let{t:n,i18n:i}=r(`integrations`),a=i.language||`en`,[f,p]=(0,v.useState)(null),[m,g]=(0,v.useState)(!0),[_,S]=(0,v.useState)(),[w,T]=(0,v.useState)(),E=(0,v.useRef)(null);(0,v.useEffect)(()=>{e&&(g(!0),fetch(`/api/docs?lang=${encodeURIComponent(a)}`).then(e=>e.json()).then(e=>p(e)).catch(()=>p({categories:[]})).finally(()=>g(!1)))},[e,a]);let D=(0,v.useCallback)((e,t)=>{S(e),T(t)},[]),O=(0,v.useCallback)(()=>{S(void 0),T(void 0)},[]),k=!!(_&&w);return(0,y.jsx)(d,{open:e,onOpenChange:e=>{e||t()},children:(0,y.jsxs)(u,{movableResizable:!0,className:`flex max-w-5xl w-[92vw] h-[82vh] flex-col overflow-hidden`,children:[(0,y.jsxs)(l,{children:[(0,y.jsxs)(c,{className:`flex items-center gap-2`,children:[(0,y.jsx)(h,{className:`w-4 h-4`}),n(`docs.title`)]}),(0,y.jsx)(s,{children:n(`docs.dialogDescription`)})]}),(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 py-2`,children:[m?(0,y.jsx)(`div`,{className:`w-48 shrink-0 border-r border-border flex items-center justify-center`,children:(0,y.jsx)(o,{className:`w-3.5 h-3.5 animate-spin text-muted-foreground`})}):(0,y.jsx)(b,{categories:f?.categories??[],activeCategory:_,activeSlug:w,onSelect:D,onHome:O}),(0,y.jsx)(`main`,{ref:E,className:`min-w-0 flex-1 overflow-y-auto pr-1`,children:k&&_&&w?(0,y.jsx)(C,{category:_,slug:w,lang:a,onNotFound:O,onNavigate:D,scrollContainerRef:E}):f&&(0,y.jsx)(x,{categories:f.categories,onSelect:D})})]})]})})}var T=(0,v.memo)(w);export{T as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{d as r,n as i,u as a}from"./chunk-KS7C4IRE-DEKu087k.js";import{n as o}from"./createLucideIcon-Bjbbp_KS.js";import{n as s,t as c}from"./file-text-BcLCfcWZ.js";import{t as l}from"./loader-circle-DcygOQpC.js";import{t as u}from"./utils-BC4DHlz2.js";import{n as d,t as f}from"./lib-CGdyxIWg.js";import{Zt as p}from"./index-JSTZVJfe.js";import{t as m}from"./lib-C7Mhm-gT.js";import{t as h}from"./atom-one-dark-qiGhVQxg.js";var g=e(t(),1),_=n();function v({categories:e,activeCategory:t,activeSlug:n}){let{t:r}=o(`integrations`);return(0,_.jsxs)(`nav`,{className:`w-56 flex-shrink-0 border-r border-border overflow-y-auto py-4 px-3 space-y-4`,children:[(0,_.jsxs)(i,{to:`/docs`,className:u(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,!t&&!n?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,_.jsx)(p,{className:`w-3.5 h-3.5 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate`,children:r(`docs.title`)})]}),e.map(e=>(0,_.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,_.jsxs)(`div`,{className:`px-2.5 mb-1 flex items-center justify-between`,children:[(0,_.jsx)(`span`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length>0&&(0,_.jsx)(`span`,{className:`text-[9px] font-medium text-muted-foreground/60 bg-muted/40 rounded px-1 py-0.5 leading-none`,children:e.docs.length})]}),e.docs.length===0?(0,_.jsx)(`p`,{className:`px-2.5 text-xs text-muted-foreground italic`,children:r(`docs.sidebarEmpty`)}):(0,_.jsx)(`ul`,{className:`space-y-0.5`,children:e.docs.map(r=>{let a=t===e.slug&&n===r.slug;return(0,_.jsx)(`li`,{children:(0,_.jsxs)(i,{to:`/docs/${e.slug}/${r.slug}`,title:r.title,className:u(`flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-xs transition-colors`,a?`bg-accent-primary/15 font-medium text-foreground`:`text-muted-foreground hover:bg-muted/40 hover:text-foreground`),children:[(0,_.jsx)(c,{className:`w-3.5 h-3.5 shrink-0`}),(0,_.jsx)(`span`,{className:`truncate`,children:r.title})]})},r.slug)})})]},e.slug))]})}function y({categories:e}){let{t}=o(`integrations`),n=e.reduce((e,t)=>e+t.docs.length,0),r=e.filter(e=>e.docs.length>0).length;return(0,_.jsxs)(`div`,{className:`max-w-2xl mx-auto py-8 px-6 space-y-5`,children:[(0,_.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,_.jsxs)(`h1`,{className:`flex items-center gap-2 text-lg font-semibold`,children:[(0,_.jsx)(p,{className:`w-4 h-4`}),t(`docs.title`)]}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n===0?t(`docs.indexEmpty`):t(`docs.summary`,{documents:t(`docs.documentCount`,{count:n}),categories:t(`docs.categoryCount`,{count:r})})})]}),e.map(e=>(0,_.jsxs)(`div`,{className:`space-y-2`,children:[(0,_.jsx)(`h2`,{className:`text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e.name}),e.docs.length===0?(0,_.jsx)(`p`,{className:`text-xs text-muted-foreground italic pl-2`,children:t(`docs.categoryEmpty`)}):(0,_.jsx)(`ul`,{className:`space-y-2`,children:e.docs.map(t=>(0,_.jsx)(`li`,{children:(0,_.jsxs)(i,{to:`/docs/${e.slug}/${t.slug}`,className:`flex items-center gap-3 p-2.5 rounded-md border border-border transition-colors hover:bg-muted/40 group`,children:[(0,_.jsx)(c,{className:`w-3.5 h-3.5 text-muted-foreground flex-shrink-0`}),(0,_.jsx)(`span`,{className:`text-xs font-medium text-foreground truncate`,children:t.title}),(0,_.jsx)(s,{className:`w-3 h-3 text-muted-foreground ml-auto md:opacity-0 md:group-hover:opacity-100 transition-opacity`})]})},t.slug))})]},e.slug))]})}var b=(0,g.memo)(function({content:e,currentCategory:t,onNavigateDoc:n}){return(0,_.jsx)(d,{remarkPlugins:[f],rehypePlugins:[m],components:{a({href:e,children:r,...i}){return(0,_.jsx)(`a`,{href:e,onClick:r=>{if(!e)return;if(/^[a-z][a-z0-9+.-]*:/i.test(e)){r.preventDefault(),window.open(e,`_blank`,`noopener,noreferrer`);return}if(e.startsWith(`#`))return;r.preventDefault();let i=h(e,t);i&&n(i.category,i.slug)},...i,children:r})}},children:e})});function x({category:e,slug:t,lang:n,scrollContainerRef:r}){let{t:i}=o(`integrations`),[s,c]=(0,g.useState)(null),[u,d]=(0,g.useState)(null),f=(0,g.useRef)(0),p=a();return(0,g.useEffect)(()=>{let a=++f.current;d(null),fetch(`/api/docs/${e}/${t}?lang=${encodeURIComponent(n)}`).then(async e=>{if(e.status===404){p(`/docs`,{replace:!0});return}if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{a===f.current&&e&&(c(e),r.current&&(r.current.scrollTop=0))}).catch(e=>{a===f.current&&d(e instanceof Error?e.message:i(`docs.loadError`))})},[e,t,n,p,r]),!s&&!u?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(l,{className:`w-4 h-4 animate-spin text-muted-foreground`})}):u&&!s?(0,_.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,_.jsx)(`p`,{className:`text-sm text-destructive`,children:u})}):s?(0,_.jsx)(`article`,{className:`max-w-2xl mx-auto py-8 px-6`,children:(0,_.jsx)(`div`,{className:`prose prose-sm max-w-none
|
|
2
|
+
prose-headings:text-foreground prose-headings:font-bold
|
|
3
|
+
prose-p:text-foreground/90
|
|
4
|
+
prose-a:text-accent-primary prose-a:no-underline hover:prose-a:underline
|
|
5
|
+
prose-strong:text-foreground
|
|
6
|
+
prose-code:text-accent-info prose-code:bg-card prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-xs
|
|
7
|
+
prose-pre:bg-card prose-pre:border prose-pre:border-border prose-pre:rounded-md prose-pre:p-0 prose-pre:overflow-x-auto
|
|
8
|
+
prose-blockquote:border-l-accent-primary prose-blockquote:text-muted-foreground
|
|
9
|
+
prose-hr:border-border
|
|
10
|
+
prose-th:text-foreground prose-td:text-foreground/90
|
|
11
|
+
prose-li:text-foreground/90`,children:(0,_.jsx)(b,{content:s.content,currentCategory:s.category,onNavigateDoc:(e,t)=>p(`/docs/${e}/${t}`)})})}):null}function S(){let{category:e,slug:t}=r(),{i18n:n}=o(`integrations`),i=n.language||`en`,[a,s]=(0,g.useState)(null),[c,u]=(0,g.useState)(!0),d=(0,g.useRef)(null);(0,g.useEffect)(()=>{fetch(`/api/docs?lang=${encodeURIComponent(i)}`).then(e=>e.json()).then(e=>s(e)).catch(()=>s({categories:[]})).finally(()=>u(!1))},[i]);let f=!!(e&&t);return(0,_.jsxs)(`div`,{className:`flex h-full overflow-hidden`,children:[c?(0,_.jsx)(`div`,{className:`w-56 flex-shrink-0 border-r border-border flex items-center justify-center`,children:(0,_.jsx)(l,{className:`w-3.5 h-3.5 animate-spin text-muted-foreground`})}):(0,_.jsx)(v,{categories:a?.categories??[],activeCategory:e,activeSlug:t}),(0,_.jsx)(`main`,{ref:d,className:`flex-1 overflow-y-auto`,children:f&&e&&t?(0,_.jsx)(x,{category:e,slug:t,lang:i,scrollContainerRef:d}):a&&(0,_.jsx)(y,{categories:a.categories})})]})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r}from"./createLucideIcon-Bjbbp_KS.js";import{s as i}from"./useDesktop-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{n as r}from"./createLucideIcon-Bjbbp_KS.js";import{s as i}from"./useDesktop-D07TvesS.js";import{t as a}from"./download-CFHyyHcw.js";var o=e(t(),1),s=n(),c=[{labelKey:`export.summaryCsv`,format:`csv`,mode:`summary`},{labelKey:`export.rawCsv`,format:`csv`,mode:`raw`},{labelKey:`export.summaryJson`,format:`json`,mode:`summary`},{labelKey:`export.rawJson`,format:`json`,mode:`raw`}];function l(e){if(!e)return null;let t=e.match(/filename="?([^"]+)"?/);return t?t[1]:null}function u({baseUrl:e,params:t,label:n,disabled:u}){let{t:d}=r(`analytics`),[f,p]=(0,o.useState)(!1),[m,h]=(0,o.useState)(!1),g=(0,o.useRef)(null);(0,o.useEffect)(()=>{if(!f)return;function e(e){g.current&&!g.current.contains(e.target)&&p(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[f]);let _=(0,o.useCallback)(n=>`${e}?${new URLSearchParams({format:n.format,mode:n.mode,...t}).toString()}`,[e,t]),v=(0,o.useCallback)(async e=>{p(!1),h(!0);try{let t=await fetch(_(e));if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r;let a=l(t.headers.get(`Content-Disposition`)),o=`analytics-${e.mode}.${e.format}`;i.download=a??o,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}catch(e){console.warn(`[ExportDropdown] download failed:`,e),i.error(d(`export.failed`))}finally{h(!1)}},[_,d]);return(0,s.jsxs)(`div`,{ref:g,className:`relative`,children:[(0,s.jsxs)(`button`,{type:`button`,"aria-haspopup":`true`,"aria-expanded":f,disabled:m||u,onClick:()=>p(e=>!e),title:u?d(`export.noData`):void 0,className:`flex items-center gap-1.5 h-7 px-2.5 rounded-md text-xs font-medium border border-border/60 bg-card/50 text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-colors disabled:opacity-50 disabled:pointer-events-none`,children:[(0,s.jsx)(a,{className:`w-3 h-3`}),m?d(`export.downloading`):n??d(`common:actions.export`)]}),f&&(0,s.jsx)(`div`,{role:`menu`,className:`absolute right-0 z-50 mt-1 min-w-[180px] rounded-md border border-border/60 bg-popover shadow-md text-xs overflow-hidden`,children:c.map(e=>(0,s.jsxs)(`button`,{role:`menuitem`,type:`button`,onClick:()=>v(e),className:`flex w-full items-center gap-2 px-3 py-2 text-left text-foreground hover:bg-accent/60 transition-colors`,children:[(0,s.jsx)(a,{className:`w-3 h-3 shrink-0`}),(0,s.jsx)(`span`,{className:`flex-1`,children:d(e.labelKey)}),e.mode===`raw`&&(0,s.jsx)(`span`,{className:`text-[9px] text-muted-foreground`,children:`≤10k`})]},`${e.format}-${e.mode}`))})]})}export{u as t};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{h as r,l as i,r as a}from"./useSharedWebSocket-TzKtPRp9.js";import{n as o,t as s}from"./createLucideIcon-Bjbbp_KS.js";import{a as c,r as l,s as u}from"./useDesktop-D07TvesS.js";import{$ as d,Q as f,V as p,tt as m}from"./TicketDetailModalContext-UAeNm7BB.js";import{n as h}from"./provider-capabilities-lePfeT_Y.js";import{n as g}from"./save-OsUqVn99.js";import{l as _}from"./MinimizedChatsContext-D_8L4EWZ.js";import{n as v}from"./file-text-BcLCfcWZ.js";import{t as y}from"./circle-x-CMYsN4ZH.js";import{t as b}from"./git-branch-BRM0F5GN.js";import{t as x}from"./loader-circle-DcygOQpC.js";import{n as S,t as C}from"./square-Ci-PFcFe.js";import{t as w}from"./rotate-ccw-Wh4id13q.js";import{t as T}from"./search-Cq_gE3Ik.js";import{t as E}from"./triangle-alert-H9T4jAmh.js";import{t as D}from"./x-CBMI9ejn.js";import{L as O,l as k,n as A,r as j,t as M,u as N}from"./dialog-CMgps2MY.js";import{t as P}from"./utils-BC4DHlz2.js";import{n as F,t as I}from"./lib-CGdyxIWg.js";import{t as L}from"./button-D1xExSTF.js";import{n as R}from"./project-repositories-DXhb9FP4.js";import{t as ee}from"./useRuntimeRuns-pGLmtAC6.js";import{$ as z,At as te,C as ne,Ct as re,E as ie,Gt as B,Ht as V,K as H,Mt as ae,St as U,T as oe,U as se,Y as W,Yt as ce,b as le,et as ue,gt as de,k as fe,kt as pe,q as me,st as he,tn as ge,tt as _e,w as ve,x as ye,y as be,zt as xe}from"./index-JSTZVJfe.js";import{l as Se,n as Ce,p as we,r as Te,t as Ee}from"./loop-layout-BF8xMiNv.js";import{t as De}from"./lib-C7Mhm-gT.js";import{n as Oe}from"./job-time-BCL7wee9.js";var ke=s(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),Ae=s(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),je=s(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Me=s(`circle-pause`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`10`,x2:`10`,y1:`15`,y2:`9`,key:`c1nkhi`}],[`line`,{x1:`14`,x2:`14`,y1:`15`,y2:`9`,key:`h65svq`}]]),Ne=s(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),Pe=s(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Fe=s(`message-circle-question-mark`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),G=e(t(),1),K=n();function Ie({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,K.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,K.jsxs)(`div`,{className:`flex items-center`,children:[(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,K.jsx)(Le,{state:i}),(0,K.jsx)(`span`,{className:P(`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,K.jsxs)(me,{side:`bottom`,className:`max-w-[200px]`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,K.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),a!==null&&(0,K.jsx)(`div`,{className:P(`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 Le({state:e}){return(0,K.jsxs)(`div`,{className:P(`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,K.jsx)(x,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,K.jsx)(B,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,K.jsx)(y,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,K.jsx)(f,{className:`w-6 h-6 text-muted-foreground/20`})]})}function Re(e,t){let n=Oe(e??null),r=(typeof t==`number`?t:Oe(t??null)?.getTime()??NaN)-(n?.getTime()??NaN);if(!Number.isFinite(r)||r<0)return`—`;let i=Math.round(r/1e3);if(i<60)return`${i}s`;let a=Math.floor(i/60),o=i%60;return a<60?`${a}m ${o}s`:`${Math.floor(a/60)}h ${a%60}m`}function ze(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 Be={steps:0,actionKey:``,actionArg:``,turns:0,tokens:0,lastSeenIdx:0};function Ve(e){if(e.event_type!==`assistant`)return null;try{let t=JSON.parse(e.payload);if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.message,r=(n&&typeof n==`object`&&!Array.isArray(n)?n:t).usage;if(!r||typeof r!=`object`||Array.isArray(r))return null;let i=r,a=e=>typeof e==`number`&&Number.isFinite(e)?e:0;return a(i.input_tokens)+a(i.output_tokens)+a(i.cache_read_input_tokens)+a(i.cache_creation_input_tokens)}catch{return null}}function He(e,t){if(t.type===`reset`)return Be;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,turns:s,tokens:c}=e;for(let e=r;e<n.length;e++){let t=ye(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``);let r=Ve(n[e]);r!=null&&(s+=1,c+=r)}return{steps:i,actionKey:a,actionArg:o,turns:s,tokens:c,lastSeenIdx:n.length}}return e}function Ue(e,t){let[n,r]=(0,G.useReducer)(He,Be),i=(0,G.useRef)(e);return(0,G.useEffect)(()=>{i.current!==e&&(i.current=e,r({type:`reset`})),r({type:`consume`,events:t})},[e,t]),n}function We(e,t){let n=t&&e.steps===0?`connecting`:e.actionKey||`thinking`,r=n===`delegating`||be.has(n),i=r&&e.actionArg!==``;return{key:r&&!i?`working`:n,arg:i?e.actionArg:null}}function Ge(e){return`${(e/1e3).toFixed(1)}k`}function Ke(e){let t=!!e.total_cost_usd_estimated,n=e.total_cost_usd==null?null:`${t?`~`:``}$${e.total_cost_usd.toFixed(4)}`,r=e.num_turns==null?null:String(e.num_turns),i=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0);return{cost:n,turns:r,tokens:i==null?null:Ge(i)}}function qe(e){if(e.length<=1)return null;let t=e=>e.tokens_in==null&&e.tokens_out==null&&e.tokens_cache_read==null&&e.tokens_cache_create==null;return{totalCostUsd:e.reduce((e,t)=>e+(t.total_cost_usd??0),0),hasNullCost:e.some(e=>e.total_cost_usd==null),costEstimated:e.some(e=>!!e.total_cost_usd_estimated),nullCostCount:e.filter(e=>e.total_cost_usd==null).length,costUnavailable:e.every(e=>e.total_cost_usd==null),totalTokensIn:e.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:e.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:e.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:e.reduce((e,t)=>e+(t.tokens_cache_create??0),0),nullTokenCount:e.filter(t).length,tokensUnavailable:e.every(t),jobCount:e.length}}function Je(e){return e.costUnavailable?`—`:`${e.costEstimated?`~`:``}${e.hasNullCost?`≥`:``}$${e.totalCostUsd.toFixed(4)}`}function Ye(e){if(e.tokensUnavailable)return`—`;let t=e.totalTokensIn+e.totalTokensOut+e.totalTokensCacheRead+e.totalTokensCacheCreate;return`${(e.nullTokenCount??0)>0?`≥`:``}${Ge(t)}`}var Xe=`specrails-desktop:job-run-details`;function Ze(e){try{let t=localStorage.getItem(Xe);return t?JSON.parse(t)?.[e]===!0:!1}catch{return!1}}function Qe(e,t){try{let n=localStorage.getItem(Xe),r={};if(n)try{let e=JSON.parse(n);e&&typeof e==`object`&&(r=e)}catch{}r[e]=t,localStorage.setItem(Xe,JSON.stringify(r))}catch{}}var $e={running:{variant:`running`,labelKey:`statusLabel.running`,tooltipKey:`statusTooltip.running`},completed:{variant:`success`,labelKey:`statusLabel.completed`,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.queued`},zombie_terminated:{variant:`failed`,labelKey:`statusLabel.zombie`,tooltipKey:`statusTooltip.zombie`},skipped:{variant:`queued`,labelKey:`statusLabel.skipped`,tooltipKey:`statusTooltip.skipped`}};function et({job:e,events:t,phases:n,phaseDefinitions:r,projectId:i,variant:a,pipelineTotals:s,actions:c,onOpenRun:l}){let{t:u}=o(`jobs`),{t:d}=o(`agentRuntime`),f=e.status===`running`,p=e.status===`queued`,m=e.command.startsWith(`loop:`),_=$e[e.status]??$e.queued,[v,y]=(0,G.useState)(()=>Date.now());(0,G.useEffect)(()=>{if(!f)return;y(Date.now());let e=window.setInterval(()=>y(Date.now()),1e3);return()=>window.clearInterval(e)},[f]);let b=e.finished_at?Re(e.started_at,e.finished_at):f?Re(e.started_at,v):`—`,S=Ue(e.id,t),C=ee(i,{jobId:e.id,enabled:!!i}),w=C.runs[0],[T,E]=(0,G.useState)(()=>Ze(a)),D=e=>{E(e),Qe(a,e)},O=(0,G.useMemo)(()=>r.find(e=>n[e.key]===`running`)?.label??null,[n,r]),k=w?.nextStep?d(`roles.${w.nextStep}`,{defaultValue:w.nextStep}):null,A=O??k,{key:j,arg:M}=We(S,f),N=M==null?u(`statusPanel.activity.${j}`):u(`statusPanel.activity.${j}`,{arg:M}),F=f?A?u(`runHeader.phaseActivity`,{phase:A,activity:N}):N:w&&!w.active&&w.nextStep&&(w.canResume||w.pendingQuestion||w.pendingApproval)?u(`runHeader.phaseActivity`,{phase:d(`runs.status.${w.status}`,{defaultValue:w.status}),activity:d(`runs.phase`,{phase:k})}):null,I=m&&f&&S.steps>0?u(`statusPanel.steps`,{count:S.steps}):null,R=Ke(e),z=!f&&!p,te=(0,G.useMemo)(()=>z?ze(t):[],[t,z]),re=f&&S.turns>0,B=C.runs.length>0?C.error:``,V=!!w?.pendingQuestion&&!!w.canResume&&!w.recoverableSteps.length,ae=z||re||!!w&&!!i||!!B,U=C.busy!==null,se=w?(0,K.jsxs)(K.Fragment,{children:[w.canResume&&!V&&(w.engineVersion===2&&w.recoverableSteps.length>0?(0,K.jsx)(ie,{run:w,busy:U,onRecover:e=>void C.act(w,`recover`,e)},`${i}:${w.runId}`):(0,K.jsx)(L,{size:`sm`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,w.recoverableSteps.length?`recover`:w.pendingApproval?`approve`:`resume`),children:w.recoverableSteps.length?d(`runs.recover`):w.pendingApproval?d(`runs.approve`):d(`runs.resume`)})),V&&(0,K.jsxs)(L,{size:`sm`,variant:`outline`,className:`h-7 border-accent-warning/40 text-accent-warning hover:bg-accent-warning/10`,onClick:()=>D(!0),children:[(0,K.jsx)(Fe,{className:`w-3.5 h-3.5 mr-1.5`,"aria-hidden":!0}),u(`runHeader.questionPending`)]}),w.canSettle&&(0,K.jsx)(L,{size:`sm`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,`settle`),children:d(`runs.prepareDelivery`)}),w.forkSuccessor&&l&&(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>l(w.forkSuccessor),children:u(`loopExplorer.openFork`)}),w.canCancel&&(0,K.jsx)(L,{size:`sm`,variant:`secondary`,className:`h-7`,disabled:U,onClick:()=>void C.act(w,`cancel`),children:d(`runs.cancel`)})]}):null;return(0,K.jsxs)(`div`,{"data-testid":`job-run-header`,className:P(`shrink-0`,a===`glass`?`border-b border-border/30 bg-surface/30`:`border-b border-border bg-background`),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap px-3 py-2 min-w-0`,children:[(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`div`,{children:(0,K.jsx)(fe,{variant:_.variant,children:u(_.labelKey)})})}),(0,K.jsx)(me,{children:u(_.tooltipKey)})]}),(0,K.jsxs)(`span`,{className:P(`inline-flex items-center gap-1.5 text-xs tabular-nums`,f?`text-accent-info font-medium`:`text-muted-foreground`),title:u(f?`statusPanel.liveTooltip`:`statusPanel.duration`),children:[f&&(0,K.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,"aria-hidden":!0}),b]}),F&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0 flex-1 basis-40 text-xs text-muted-foreground`,children:[f&&(0,K.jsx)(x,{className:`w-3 h-3 shrink-0 text-accent-info animate-spin`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`truncate`,"data-testid":`job-run-activity`,children:F})]}),!F&&(0,K.jsx)(`span`,{className:`flex-1`}),I&&(0,K.jsx)(`span`,{className:`text-[11px] text-muted-foreground/70 tabular-nums shrink-0`,children:I}),(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 ml-auto`,children:[se,c,ae&&(0,K.jsxs)(`button`,{type:`button`,onClick:()=>D(!T),"aria-expanded":T,className:`inline-flex items-center gap-1 h-7 px-2 rounded-md text-[11px] text-muted-foreground hover:text-foreground hover:bg-surface/60 transition-colors`,children:[u(`runHeader.details`),(0,K.jsx)(g,{className:P(`w-3.5 h-3.5 transition-transform duration-150`,T&&`rotate-180`),"aria-hidden":!0})]})]})]}),r.length>0&&(0,K.jsx)(`div`,{className:`px-3 pb-2 overflow-x-auto`,children:(0,K.jsx)(Ie,{phases:n,phaseDefinitions:r})}),ae&&T&&(0,K.jsxs)(`div`,{"data-testid":`job-run-details`,className:`px-3 pb-3 space-y-3 border-t border-border/20 pt-3 text-xs`,children:[re&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 max-w-sm`,children:[(0,K.jsx)(q,{label:u(`statusPanel.turns`),value:String(S.turns)}),(0,K.jsx)(q,{label:u(`statusPanel.tokens`),value:Ge(S.tokens)})]}),(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 mt-1`,children:u(`runHeader.liveReported`)})]}),z&&(0,K.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 max-w-lg`,children:[(0,K.jsx)(q,{label:u(`statusPanel.cost`),value:R.cost,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:h(e.provider)?u(`statusPanel.costUnknownLocal`):u(`statusPanel.notAvailable`),naTooltip:h(e.provider)?u(`statusPanel.costUnknownLocalTooltip`):void 0}),(0,K.jsx)(q,{label:u(`statusPanel.turns`),value:R.turns,naCaption:u(`statusPanel.notAvailable`)}),(0,K.jsx)(q,{label:u(`statusPanel.tokens`),value:R.tokens,naCaption:u(`statusPanel.notAvailable`)})]}),z&&s&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:u(`statusPanel.pipelineTotal`,{count:s.jobCount})}),(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-2 max-w-sm`,children:[(0,K.jsx)(q,{label:u(`statusPanel.totalCost`),value:Je(s),valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,K.jsx)(q,{label:u(`statusPanel.totalTokens`),value:Ye(s)})]}),s.hasNullCost&&!s.costUnavailable&&(0,K.jsx)(`p`,{"data-testid":`pipeline-partial-hint`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,title:u(`statusPanel.pipelinePartialTooltip`),children:u(`statusPanel.pipelinePartial`,{count:s.nullCostCount??0})}),s.costUnavailable&&(0,K.jsx)(`p`,{"data-testid":`pipeline-cost-unavailable`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,children:u(`statusPanel.pipelineCostUnavailable`)}),(s.nullTokenCount??0)>0&&(0,K.jsx)(`p`,{"data-testid":`pipeline-usage-coverage-hint`,className:`text-[10px] text-muted-foreground/70 mt-1`,title:u(`statusPanel.pipelineUsageTooltip`),children:s.tokensUnavailable?u(`statusPanel.pipelineUsageUnavailable`):u(`statusPanel.pipelineUsagePartial`,{count:s.nullTokenCount??0})})]}),te.length>0&&(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:u(`statusPanel.filesModified`)}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:te.map(e=>(0,K.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))})]}),(w||B)&&i&&(0,K.jsxs)(`section`,{"aria-label":d(`runs.implementation`),className:`space-y-2`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:[B&&(0,K.jsx)(`p`,{role:`alert`,className:`text-destructive`,children:B}),w?.historical&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`evidence.historical`)}),w?.status===`succeeded`&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`runs.reviewDelivery`)}),w?.canResume&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:d(`runs.preserveProgress`)}),w?.error&&(0,K.jsx)(`p`,{className:`text-destructive`,children:w.error}),w?.pendingApproval?.reason&&(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:w.pendingApproval.reason}),w?.pendingQuestion&&(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(`p`,{className:`font-medium`,children:d(`runs.question`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap`,children:w.pendingQuestion.question}),V&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`label`,{className:`block space-y-1`,children:[d(`runs.answerLabel`),(0,K.jsx)(`textarea`,{className:`min-h-20 w-full rounded-md border border-input bg-background px-2 py-1 text-sm`,maxLength:2e4,placeholder:d(`runs.answerPlaceholder`),value:C.answers[w.runId]??``,onChange:e=>C.setAnswer(w.runId,e.target.value)})]}),(0,K.jsx)(L,{size:`sm`,disabled:U||!C.answers[w.runId]?.trim(),onClick:()=>void C.act(w,`answer`),children:d(`runs.answer`)})]})]}),w?.metrics&&(0,K.jsx)(ne,{metrics:w.metrics}),w&&(0,K.jsx)(oe,{projectId:i,runId:w.runId,summary:w.efficiencySummary,historical:w.historical}),w&&(0,K.jsx)(ve,{projectId:i,run:w,onAccepted:C.refresh})]})]})]})}function q({label:e,value:t,valueClass:n,naCaption:r,naTooltip:i}){return(0,K.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-2.5 py-1.5`,title:t==null?i:void 0,children:[(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,K.jsx)(`p`,{className:P(`text-sm font-semibold tabular-nums`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&r&&(0,K.jsx)(`p`,{className:`text-[10px] text-muted-foreground/40`,children:r})]})}function tt(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))}var nt=new Set;function rt({ticketId:e,onOpen:t,children:n}){let{t:r}=o(`agent`),i=r(`refs.openTicket`,{id:e});return(0,K.jsx)(`button`,{type:`button`,"data-testid":`log-ticket-ref`,onClick:n=>{n.stopPropagation(),t(e)},title:i,"aria-label":i,className:`inline cursor-pointer p-0 align-baseline text-accent-primary/90 underline decoration-accent-primary/50 decoration-dotted underline-offset-2 transition-colors hover:text-accent-primary hover:decoration-solid`,children:n})}function it(e){if(!e.includes(`#`))return null;let t=_e(e,nt);return t.some(e=>e.kind===`ticket`)?t:null}function at(e,t){let n=it(e);return n?n.map((e,n)=>e.kind===`ticket`?(0,K.jsx)(rt,{ticketId:e.ticketId,onOpen:t,children:e.label},n):(0,K.jsx)(G.Fragment,{children:e.kind===`text`?e.text:e.label},n)):e}var ot=new Set([`code`,`inlineCode`,`link`,`linkReference`,`image`,`imageReference`,`definition`,`html`]);function st(e){return e.kind===`ticket`?{type:`link`,url:z({kind:`ticket`,ticketId:e.ticketId}),children:[{type:`text`,value:e.label}]}:{type:`text`,value:e.kind===`text`?e.text:e.label}}function ct(e){let t=e.children;if(t)for(let e=t.length-1;e>=0;e--){let n=t[e];if(!ot.has(n.type))if(n.type===`text`&&typeof n.value==`string`){let r=_e(n.value,nt);r.some(e=>e.kind===`ticket`)&&t.splice(e,1,...r.map(st))}else ct(n)}}function lt(){return e=>ct(e)}function ut(e){let{activeProjectId:t}=l(),{openRef:n}=he(),r=e??t??void 0;return(0,G.useMemo)(()=>r?e=>{n(r,{kind:`ticket`,ticketId:e})}:void 0,[r,n])}function dt(e,t){let n=`${e.id??t}`,i=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:i}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:i}:tt(t)?{id:n,content:t,type:`assistant`,timestamp:i}:{id:n,content:t,type:`plain`,timestamp:i}: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),a=[];return t.duration_ms&&a.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&a.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&a.push(r.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${r.t(`jobs:logViewer.completed`)}${a.length?` — ${a.join(` · `)}`:``}`,type:`result`,timestamp:i}}catch{return null}return null}function ft(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 pt(e){let t=[];for(let n of e){let e=t.length>0?t[t.length-1]:null;n.type===`assistant`&&e?.type===`assistant`?e.content+=`
|
|
2
|
+
`+n.content:t.push({...n})}return t}function mt(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 ht({events:e,isLoading:t,projectId:n}){let{t:r,i18n:i}=o(`jobs`),[a,s]=(0,G.useState)(``),[c,l]=(0,G.useState)(!0),[d,f]=(0,G.useState)(new Set),p=(0,G.useRef)(null),m=(0,G.useRef)(null),h=ut(n),{processedLines:_,groups:v,totalLines:y}=(0,G.useMemo)(()=>{let t=ft(pt(e.map((e,t)=>dt(e,t)).filter(e=>e!==null)));return{processedLines:t,groups:mt(t),totalLines:t.length}},[e,i.language]),b=(0,G.useMemo)(()=>{if(!a)return y;let e=a.toLowerCase();return _.filter(t=>t.content.toLowerCase().includes(e)).length},[a,_,y]),x=(0,G.useCallback)(()=>{let e=m.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,G.useEffect)(()=>{c&&x()},[e.length,c,x]);function S(){let e=m.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<50;l(t)}function C(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.loading`)})}):y===0?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.empty`)})}):(0,K.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,K.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,K.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,K.jsx)(T,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,K.jsx)(se,{placeholder:r(`logViewer.filterPlaceholder`),value:a,onChange:e=>s(e.target.value),className:`pl-7 h-7`})]}),(0,K.jsx)(L,{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
|
+
`);navigator.clipboard.writeText(e).then(()=>{u.success(r(`logViewer.copySuccess`))}).catch(()=>{u.error(r(`logViewer.copyFailed`))})},children:(0,K.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`logViewer.lineCount`,{filtered:b,total:y})})]}),(0,K.jsxs)(`div`,{ref:m,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:S,children:[v.map(e=>(0,K.jsx)(gt,{group:e,filter:a,collapsed:d.has(e.key),onToggle:()=>C(e.key),onOpenTicket:h},e.key)),(0,K.jsx)(`div`,{ref:p})]}),!c&&(0,K.jsxs)(L,{size:`sm`,variant:`secondary`,onClick:()=>{l(!0),x()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,K.jsx)(g,{className:`w-3 h-3`}),r(`logViewer.jumpToBottom`)]})]})}var gt=(0,G.memo)(function({group:e,filter:t,collapsed:n,onToggle:r,onOpenTicket:i}){let{t:a}=o(`jobs`),s=t?e.lines.filter(e=>e.content.toLowerCase().includes(t.toLowerCase())):e.lines;if(e.header===null)return s.length===0?null:(0,K.jsx)(`div`,{children:s.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:i},e.id))});let c=e.header.content;return(0,K.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:P(`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,K.jsx)(v,{className:P(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,K.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:c}),e.header.timestamp&&(0,K.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,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:a(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:s.length===0?(0,K.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:a(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):s.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:i},e.id))})]})}),_t=[De],vt=[I],yt=[I,lt],bt=(0,G.memo)(function({line:e,even:t,onOpenTicket:n}){let r=e.type===`assistant`,i=e.type===`diff-add`,a=e.type===`diff-remove`,o=e.type===`diff-meta`,s=e.type===`diff-hunk`,c=i||a||o||s,l=n!=null&&(e.type===`plain`||e.type===`log`),u=(0,G.useMemo)(()=>l&&n?at(e.content,n):e.content,[l,n,e.content]),d=r&&n?yt:vt,f=(0,G.useMemo)(()=>n?{a:({href:e,children:t})=>{let r=ue(e);return r?.kind===`ticket`?(0,K.jsx)(rt,{ticketId:r.ticketId,onOpen:n,children:t}):(0,K.jsx)(`a`,{href:e,children:t})}}:void 0,[n]);return(0,K.jsxs)(`div`,{className:P(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!c&&(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`,i&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,a&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,o&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,s&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,K.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})}),r?(0,K.jsx)(`div`,{className:`flex-1 min-w-0 prose prose-invert prose-xs max-w-none
|
|
4
|
+
prose-p:my-1 prose-p:leading-relaxed
|
|
5
|
+
prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold
|
|
6
|
+
prose-ul:my-1 prose-ol:my-1 prose-li:my-0
|
|
7
|
+
prose-code:text-cyan-300 prose-code:text-[11px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded
|
|
8
|
+
prose-pre:my-1 prose-pre:bg-muted/30 prose-pre:rounded-md prose-pre:p-2 prose-pre:text-[11px]
|
|
9
|
+
prose-strong:text-foreground prose-em:text-foreground/70
|
|
10
|
+
prose-a:text-blue-400 prose-a:no-underline hover:prose-a:underline
|
|
11
|
+
prose-table:my-2 prose-table:text-[11px]
|
|
12
|
+
prose-thead:border-border prose-thead:bg-muted/30
|
|
13
|
+
prose-th:px-3 prose-th:py-1.5 prose-th:text-left prose-th:font-semibold prose-th:text-foreground/90
|
|
14
|
+
prose-td:px-3 prose-td:py-1.5 prose-td:border-border
|
|
15
|
+
prose-tr:border-border
|
|
16
|
+
text-foreground/80`,children:(0,K.jsx)(F,{remarkPlugins:d,rehypePlugins:_t,components:f,children:e.content})}):(0,K.jsx)(`span`,{className:P(`flex-1 break-all leading-relaxed whitespace-pre-wrap font-mono`,e.type===`tool-use`&&`text-cyan-400/80 aurora-light:text-accent-info text-[11px]`,e.type===`stderr`&&`text-orange-400 aurora-light:text-accent-warning`,e.type===`result`&&`text-emerald-400 aurora-light:text-accent-success font-medium`,e.type===`log`&&`text-foreground/60`,e.type===`plain`&&`text-foreground/70`,e.type===`tool-result`&&`text-muted-foreground/50`,i&&`text-emerald-400 aurora-light:text-accent-success`,a&&`text-red-400 aurora-light:text-destructive`,o&&`text-accent-primary/80`,s&&`text-accent-info/80`),children:u})]})}),xt=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function St(e){if(!xt(e)||typeof e.entry!=`string`||!Array.isArray(e.nodes)||e.nodes.length>1e4)return null;let t=[];for(let n of e.nodes){if(!xt(n)||typeof n.id!=`string`||!n.id||typeof n.kind!=`string`||typeof n.label!=`string`||!xt(n.ends)||Object.values(n.ends).some(e=>e!==null&&typeof e!=`string`)||n.component!==void 0&&typeof n.component!=`string`)return null;t.push({id:n.id,kind:n.kind,label:n.label,ends:n.ends,...typeof n.component==`string`?{component:n.component}:{}})}let n=new Set(t.map(e=>e.id));return n.size!==t.length||!n.has(e.entry)||t.some(e=>Object.values(e.ends).some(e=>e!==null&&!n.has(e)))?null:{entry:e.entry,nodes:t}}function Ct(e){let t=St(e);if(!t||!xt(e)||e.components!==void 0&&!xt(e.components))return null;let n=Object.create(null);for(let[t,r]of Object.entries(e.components??{})){let e=St(r);if(!e)return null;n[t]=e}return{...t,components:n}}var J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0,wt=e=>Array.isArray(e)&&e.every(e=>typeof e==`string`);function Tt(e){if(!J(e)||e.version!==1||typeof e.execution!=`string`||!Y(e.steps)||!Y(e.deciderEvaluations)||!(e.turns===null||Y(e.turns))||!(e.costUsd===null||Y(e.costUsd))||typeof e.costUncertain!=`boolean`||e.engineVersion===2&&e.completion!==void 0&&(!J(e.completion)||typeof e.completion.ok!=`boolean`||typeof e.completion.verified!=`boolean`||!wt(e.completion.reasons)))return null;if(e.core!==null){let t=e.core;if(!J(t)||typeof t.change!=`string`||typeof t.recordedAt!=`string`||!J(t.completion)||![`implementation`,`validation`,`archive`,`delivery`].every(e=>typeof t.completion==`object`&&typeof t.completion[e]==`string`)||!wt(t.completion.reasons)||!wt(t.findings)||!Array.isArray(t.exceptions)||!Array.isArray(t.checks)||!Array.isArray(t.phases)||!t.exceptions.every(e=>J(e)&&[`requirement`,`reason`,`impact`,`acceptedBy`,`approvalEvidence`].every(t=>typeof e[t]==`string`))||!t.checks.every(e=>J(e)&&[`name`,`status`,`scope`,`limitations`].every(t=>typeof e[t]==`string`)&&typeof e.required==`boolean`&&wt(e.evidence))||!t.phases.every(e=>J(e)&&typeof e.name==`string`&&typeof e.status==`string`&&(e.durationMs===null||Y(e.durationMs))&&(e.attempts===null||Y(e.attempts))))return null}return e}function X(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}var Et=/^\s*━+\s*Step\s+\d+\s*·/,Dt=/\s*\(iteration\s+\d+\)\s*$/i;function Ot(e){return e.replace(/^[\s\uFE0F\p{Extended_Pictographic}]+/u,``).trim()||e.trim()}function kt(e){let t=Ot(e.title);return e.iteration==null?t:t.replace(Dt,``)}function At(e){return e.meta.nodeId??`${e.meta.kind}::${Ot(e.meta.title).replace(Dt,``)}`}function jt(e){let t=null,n=0,r=null,i=[[]],a=new Map,o=[];for(let s=0;s<e.length;s++){let c=e[s];if(c.event_type===`loop_completion`){r=Tt(X(c.payload));continue}if(c.event_type===`runtime-graph`){let e=X(c.payload);if(e&&Array.isArray(e.nodes)&&Array.isArray(e.edges)){let n=e.nodes.filter(e=>!!(e&&typeof e==`object`&&typeof e.path==`string`)),r=e.edges.filter(e=>!!(e&&typeof e==`object`&&typeof e.from==`string`&&typeof e.to==`string`)),i=t;t={...i??{},runtimeTopology:Ct(e.graph)??void 0,loopId:typeof e.workflowId==`string`?e.workflowId:i?.loopId,graph:{nodes:n.map((e,t)=>({id:String(e.path),type:`core`,position:{x:0,y:t*100},data:{label:String(e.label??e.path),kind:e.kind}})),edges:r.map((e,t)=>({id:`core-edge-${t}`,source:String(e.from),target:String(e.to),label:String(e.label)})),config:i?.graph.config??{maxIterations:1,timeoutMinutes:0}}}}continue}if(c.event_type===`loop_graph`){let e=X(c.payload);e&&e.graph&&typeof e.graph==`object`&&!Array.isArray(e.graph)&&(t={graph:e.graph,loopId:typeof e.loopId==`string`?e.loopId:void 0,loopName:typeof e.loopName==`string`?e.loopName:void 0,provider:typeof e.provider==`string`?e.provider:void 0,model:typeof e.model==`string`?e.model:void 0,iterationLimit:typeof e.iterationLimit==`number`?e.iterationLimit:void 0});continue}if(c.event_type===`loop_step`){let e=X(c.payload);if(!e||typeof e.index!=`number`)continue;let t=typeof e.iteration==`number`?e.iteration:null;t!=null&&t>n&&(n=t),o.push({meta:{index:e.index,traceId:typeof e.traceId==`string`?e.traceId:void 0,spanId:typeof e.spanId==`string`?e.spanId:void 0,nodePath:typeof e.nodePath==`string`?e.nodePath:void 0,scopeId:typeof e.scopeId==`string`?e.scopeId:void 0,branch:typeof e.branch==`string`?e.branch:void 0,attemptId:typeof e.attemptId==`string`?e.attemptId:void 0,attempt:typeof e.attempt==`number`?e.attempt:void 0,kind:typeof e.kind==`string`?e.kind:`ai-step`,title:typeof e.title==`string`?e.title:``,nodeId:typeof e.nodeId==`string`?e.nodeId:null,iteration:t,template:typeof e.template==`string`&&e.template?e.template:void 0,command:typeof e.command==`string`&&e.command?e.command:void 0},end:null,lastActivity:null}),typeof e.attemptId==`string`&&a.set(e.attemptId,o.length-1),i.push([]);continue}if(c.event_type===`loop_step_end`){let e=X(c.payload);if(!e||typeof e.index!=`number`)continue;for(let t=o.length-1;t>=0;t--)if(o[t].meta.index===e.index){o[t].end={index:e.index,nodeId:typeof e.nodeId==`string`?e.nodeId:null,status:e.status===`paused`?`paused`:e.status===`interrupted`?`interrupted`:e.status===`stalled`?`stalled`:e.status===`failed`?`failed`:`ok`,exitCode:typeof e.exitCode==`number`?e.exitCode:null,durationMs:typeof e.durationMs==`number`?e.durationMs:null,decision:e.decision===`continue`||e.decision===`stop`?e.decision:void 0,...e.reason===`idle_timeout`||e.reason===`provider_limit`?{reason:e.reason}:{},...typeof e.idleMs==`number`?{idleMs:e.idleMs}:{}};break}continue}let l=X(c.payload),u=l?.attemptId??(l?.event&&typeof l.event==`object`?l.event.attemptId:void 0),d=typeof u==`string`?a.get(u)??-1:-1,f=d>=0?d:u===void 0?o.length-1:-1,p=f>=0,m=dt(c,s);if(m&&!(p&&Et.test(m.content))&&i[f+1].push(m),p){let e=ye(c);e.step&&e.actionKey&&(o[f].lastActivity={actionKey:e.actionKey,actionArg:e.actionArg})}}let s=e=>ft(pt(e)),c=s(i[0]),l=o.map((e,t)=>({key:`step-${t}-${e.meta.index}`,meta:e.meta,lines:s(i[t+1]),end:e.end,lastActivity:e.lastActivity})),u=c.length+l.reduce((e,t)=>e+t.lines.length,0);return{graphMeta:t,setup:c,segments:l,maxIteration:n,totalLines:u,...r?{completion:r}:{}}}function Mt(e,t){return e.end?e.end.status:t.isLast||e.meta.attemptId?t.jobSettled?`interrupted`:`running`:`unknown`}function Nt(e){return e===`continue`?0:e===`stop`?2:1}function Pt(e){let t=new Map(e.nodes.map(e=>[e.id,e])),n=new Set,r=[],i=a=>{if(n.has(a))return;let o=t.get(a);if(!o)return;n.add(a),r.push(o);let s=e.edges.filter(e=>e.source===a).slice().sort((e,t)=>Nt(e.branch)-Nt(t.branch));for(let e of s)i(e.target)},a=e.nodes.find(e=>e.type===`start`);a&&i(a.id);for(let t of e.nodes)i(t.id);return r}function Ft(e){let t=e.data?.label;return typeof t==`string`&&t.trim()?t.trim():null}function It(e,t){let n=e.segments.length-1,r=new Map,i=new Map;e.segments.forEach((e,t)=>{let n=At(e);r.set(n,{seg:e,idx:t}),e.meta.kind===`decider`&&e.end?.decision&&i.set(n,e.end.decision)});let a=e=>{let r=Mt(e.seg,{isLast:e.idx===n,jobSettled:t.jobSettled});return r===`unknown`?`ok`:r===`stalled`?`failed`:r};if(e.graphMeta)return Pt(e.graphMeta.graph).map(e=>{if(e.type===`start`)return{key:e.id,kind:`start`,label:Ft(e),state:`ok`,latestSegmentKey:null};if(e.type===`end`)return{key:e.id,kind:`end`,label:Ft(e),state:t.jobSettled?t.jobFailed?`failed`:`ok`:`pending`,latestSegmentKey:null};let n=r.get(e.id);return n?{key:e.id,kind:e.type,label:Ft(e)??kt(n.seg.meta),state:a(n),decision:e.type===`decider`?i.get(e.id):void 0,latestSegmentKey:n.seg.key}:{key:e.id,kind:e.type,label:Ft(e),state:`pending`,latestSegmentKey:null}});let o=[],s=new Map;return e.segments.forEach((e,t)=>{let n=At(e),r={seg:e,idx:t},c=s.get(n),l=e.meta.kind===`decider`?i.get(n):void 0;if(c!=null){let t=o[c];t.state=a(r),t.decision=l,t.latestSegmentKey=e.key}else s.set(n,o.length),o.push({key:n,kind:e.meta.kind,label:kt(e.meta)||null,state:a(r),decision:l,latestSegmentKey:e.key})}),o}function Lt(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let n=Math.floor(t/60),r=Math.round(t%60);return n<60?`${n}m ${r}s`:`${Math.floor(n/60)}h ${n%60}m`}function Rt({topology:e,segments:t,settled:n,onFocus:r,onFork:i,forkBusy:a}){let{t:s}=o(`jobs`),c=ge(),[l,u]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)([]),[_,v]=(0,G.useState)(null),b=h[h.length-1]??{path:``,body:e},S=e=>b.path?`${b.path}/${e}`:e,C=t.filter(e=>(e.meta.nodePath??e.meta.nodeId)===_),w=(0,G.useMemo)(()=>{let e=b.body.nodes.flatMap(e=>Object.entries(e.ends).flatMap(([t,n])=>n===null?[]:[{id:`${e.id}:${t}`,source:e.id,target:n,label:t,markerEnd:{type:we.ArrowClosed}}])),r=new Map;for(let e of t){let t=e.meta.nodePath??e.meta.nodeId;if(!t)continue;let n=r.get(t)??new Map;n.set(e.meta.scopeId??`legacy`,e),r.set(t,n)}let i=b.body.nodes.map(e=>{let i=b.path?`${b.path}/${e.id}`:e.id,a=[...(r.get(i)??new Map).values()].map(e=>Mt(e,{isLast:e===t[t.length-1],jobSettled:n})),o=[`running`,`paused`,`failed`,`stalled`,`interrupted`].find(e=>a.includes(e))??(a.length?a.every(e=>e===`ok`)?`ok`:`unknown`:`pending`),c=o===`running`?`var(--color-accent-primary)`:o===`ok`?`var(--color-accent-success)`:o===`failed`?`var(--color-destructive)`:[`paused`,`stalled`,`interrupted`].includes(o)?`var(--color-accent-warning)`:`var(--color-border)`,l=o===`running`?x:o===`ok`?B:o===`failed`?y:[`paused`,`stalled`,`interrupted`].includes(o)?Me:o===`unknown`?d:f;return{id:e.id,type:`default`,position:{x:0,y:0},data:{kind:`core`,label:(0,K.jsxs)(`span`,{className:`block text-left`,"data-state":o,children:[(0,K.jsxs)(`strong`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(l,{"aria-hidden":!0,className:`h-4 w-4 shrink-0 ${o===`running`?`motion-safe:animate-spin`:``}`,style:{color:o===`pending`||o===`unknown`?`var(--color-muted-foreground)`:c}}),e.label]}),(0,K.jsxs)(`span`,{className:`mt-1 block text-[10px]`,children:[e.kind,` · `,s(`loopExplorer.graphState.${o}`)]})]})},style:{background:o===`pending`||o===`unknown`?`var(--color-background)`:`color-mix(in srgb, ${c} 12%, var(--color-background))`,color:`var(--color-foreground)`,borderColor:c,borderWidth:o===`pending`||o===`unknown`?1:2,boxShadow:o===`running`?`0 0 0 2px color-mix(in srgb, ${c} 30%, transparent), 0 0 22px color-mix(in srgb, ${c} 35%, transparent)`:void 0}}});return i.sort((e,t)=>e.id===b.body.entry?-1:+(t.id===b.body.entry)),{nodes:Ee(i,e,`vertical`),edges:e}},[b.body,b.path,t,n,s]),T=b.body.nodes.find(e=>S(e.id)===_),E=T?.component?e.components[T.component]:void 0,D=e=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 py-2 text-xs`,children:[h.length>0&&(0,K.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{g(e=>e.slice(0,-1)),v(null)},children:s(`loopExplorer.graphBack`)}),(0,K.jsx)(`code`,{children:b.path||`/`}),e?(0,K.jsx)(A,{asChild:!0,children:(0,K.jsx)(L,{className:`ml-auto`,size:`sm`,variant:`ghost`,"aria-label":s(`loopExplorer.graphExitFullscreen`),title:s(`loopExplorer.graphExitFullscreen`),children:(0,K.jsx)(pe,{className:`h-4 w-4`})})}):(0,K.jsx)(N,{asChild:!0,children:(0,K.jsx)(L,{className:`ml-auto`,size:`sm`,variant:`ghost`,"aria-label":s(`loopExplorer.graphFullscreen`),title:s(`loopExplorer.graphFullscreen`),children:(0,K.jsx)(te,{className:`h-4 w-4`})})})]}),(0,K.jsx)(`div`,{className:e?`min-h-0 flex-1 rounded border border-border`:`h-72 rounded border border-border`,"aria-label":s(`loopExplorer.runtimeGraph`),children:(0,K.jsxs)(Se,{colorMode:c.scheme===`dark`?`dark`:`light`,nodes:w.nodes,edges:w.edges,nodesDraggable:!1,nodesConnectable:!1,edgesReconnectable:!1,deleteKeyCode:null,fitView:!0,minZoom:.1,onNodeClick:(e,t)=>v(S(t.id)),children:[(0,K.jsx)(Ce,{}),(0,K.jsx)(Te,{showInteractive:!1})]},`${b.path}:${e}`)}),_&&(0,K.jsxs)(`div`,{className:`shrink-0 space-y-2 py-2 text-xs`,children:[(0,K.jsx)(`code`,{className:`break-all`,children:_}),E&&h.length<16&&(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>{g(e=>[...e,{path:_,body:E}]),v(null)},children:s(`loopExplorer.graphOpenComponent`)}),C.length===0?(0,K.jsx)(`p`,{children:s(`loopExplorer.graphNoAttempts`)}):(0,K.jsx)(`ul`,{className:`max-h-40 space-y-1 overflow-auto`,children:C.map(e=>(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(`button`,{className:`text-left underline underline-offset-2`,onClick:()=>r(e.key),children:[e.meta.scopeId??`/`,` · `,e.meta.attemptId??e.meta.index,` · `,s(`loopExplorer.graphState.${Mt(e,{isLast:!0,jobSettled:n})}`)]}),i&&e.end&&e.meta.nodePath&&e.meta.scopeId&&e.meta.iteration!=null&&(0,K.jsx)(L,{className:`ml-2`,size:`sm`,variant:`outline`,disabled:a,onClick:()=>i(e),children:s(`loopExplorer.repeatFromHere`)}),e.meta.traceId&&(0,K.jsxs)(`code`,{className:`block break-all text-[10px] text-muted-foreground`,children:[`traceId: `,e.meta.traceId,e.meta.spanId?` · spanId: ${e.meta.spanId}`:``]})]},e.key))})]})]});return(0,K.jsxs)(M,{open:p,onOpenChange:m,children:[(0,K.jsxs)(`details`,{className:`shrink-0 border-b border-border p-2`,onToggle:e=>u(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium`,children:s(`loopExplorer.runtimeGraph`)}),l&&D(!1)]}),(0,K.jsxs)(j,{overlayClassName:`z-[2147483646]`,className:`z-[2147483647] flex w-screen max-w-none !max-h-none flex-col gap-0 rounded-none p-3 sm:rounded-none`,style:{height:`calc(100dvh - ${O()}px)`},showCloseButton:!1,"aria-describedby":void 0,children:[(0,K.jsx)(k,{className:`shrink-0 text-sm`,children:s(`loopExplorer.runtimeGraph`)}),D(!0)]})]})}function zt({result:e}){let{t}=o(`jobs`),{t:n}=o(`loops`),r=e.core,i=e=>t(`completion.status.${e}`,{defaultValue:e});return(0,K.jsxs)(`section`,{"aria-label":t(`completion.title`),className:`border-b border-border/40 px-4 py-3 text-xs space-y-2`,"data-testid":`loop-completion`,children:[(0,K.jsxs)(`p`,{className:`font-medium`,children:[t(`completion.execution`),`: `,i(e.execution)]}),e.completion?(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`p`,{className:e.completion.ok?`text-accent-success`:`text-accent-warning`,children:[n(`core.acceptance`),`: `,i(e.completion.ok?`complete`:`blocked`)]}),(0,K.jsxs)(`p`,{children:[n(`core.verified`),`: `,i(e.completion.verified?`verified`:`unverified`)]}),e.completion.reasons.map((e,t)=>(0,K.jsx)(`p`,{className:`text-foreground/70`,children:e},t))]}):r?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`dl`,{className:`grid grid-cols-2 gap-2 md:grid-cols-4`,children:[`implementation`,`validation`,`archive`,`delivery`].map(e=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-foreground/70`,children:t(`completion.${e}`)}),(0,K.jsx)(`dd`,{className:r.completion[e]===`with-exceptions`||r.completion[e]===`blocked`?`text-accent-warning font-medium`:`font-medium`,children:i(r.completion[e])})]},e))}),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer`,children:t(`completion.evidence`)}),(0,K.jsxs)(`div`,{className:`space-y-2 pt-2 break-words`,children:[(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.snapshot`,{change:r.change,at:r.recordedAt})}),r.completion.reasons.map((e,t)=>(0,K.jsx)(`p`,{children:e},`reason-${t}`)),r.exceptions.map((e,n)=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`font-medium`,children:e.requirement}),(0,K.jsxs)(`p`,{children:[e.reason,` — `,e.impact]}),(0,K.jsxs)(`p`,{children:[t(`completion.acceptedBy`,{by:e.acceptedBy}),`: `,e.approvalEvidence]})]},`exception-${n}`)),r.checks.map((e,n)=>(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`p`,{className:`font-medium`,children:[e.name,`: `,i(e.status),` (`,t(e.required?`completion.required`:`completion.supplementary`),`)`]}),(0,K.jsxs)(`p`,{children:[e.scope,` — `,e.limitations]}),(0,K.jsx)(`p`,{className:`text-foreground/70`,children:e.evidence.join(`; `)})]},`check-${n}`)),r.findings.map((e,t)=>(0,K.jsx)(`p`,{children:e},`finding-${t}`)),r.phases.map(e=>(0,K.jsxs)(`p`,{children:[e.name,`: `,i(e.status),` · `,e.durationMs==null?t(`completion.unavailable`):`${(e.durationMs/1e3).toFixed(1)}s`,` · `,e.attempts==null?t(`completion.unavailable`):t(`completion.attempts`,{count:e.attempts})]},e.name)),(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.phaseCostUnavailable`)})]})]})]}):(0,K.jsx)(`p`,{className:`text-foreground/70`,children:t(`completion.noCoreEvidence`)})]})}var Bt={start:S,"ai-step":ce,shell:de,decider:b,condition:b,end:xe},Vt=C,Ht={start:`text-accent-success`,"ai-step":`text-accent-primary`,shell:`text-accent-warning`,decider:`text-accent-highlight`,condition:`text-accent-info`,end:`text-accent-secondary`},Ut={start:`border-accent-success/60`,"ai-step":`border-accent-primary/60`,shell:`border-accent-warning/60`,decider:`border-accent-highlight/60`,condition:`border-accent-info/60`,end:`border-accent-secondary/60`};function Wt(e){return Bt[e]??Vt}function Gt({chips:e,iteration:t,onChipClick:n,variant:r}){let{t:i}=o(`jobs`);return e.length===0&&!t?null:(0,K.jsxs)(`div`,{"data-testid":`loop-overview-strip`,role:`list`,"aria-label":i(`loopExplorer.stepMapAria`),className:P(`flex items-center gap-1 overflow-x-auto border-b border-border/30 bg-surface/20`,r===`glass`?`px-3 py-1.5`:`px-4 py-2`),children:[e.map((e,t)=>{let r=Wt(e.kind),a=Ht[e.kind]??`text-foreground`,o=Ut[e.kind]??`border-border/40`,s=e.label??i(`loops:builder.nodes.${e.kind}`,{defaultValue:e.kind}),c=e.latestSegmentKey!=null;return(0,K.jsxs)(G.Fragment,{children:[t>0&&(0,K.jsx)(v,{className:`w-3 h-3 text-muted-foreground/30 shrink-0`}),(0,K.jsxs)(`button`,{type:`button`,role:`listitem`,"data-testid":`loop-node-chip`,"data-state":e.state,"data-kind":e.kind,"data-decision":e.decision,"aria-label":`${s} — ${e.state}`,disabled:!c,onClick:()=>e.latestSegmentKey&&n(e.latestSegmentKey),className:P(`relative flex items-center gap-1.5 shrink-0 rounded-full border bg-surface/40 px-2.5 py-1 text-[11px] transition-colors`,o,e.state===`pending`&&`opacity-45 border-border/40`,(e.state===`interrupted`||e.state===`paused`)&&`border-dashed border-accent-warning/50`,c?`cursor-pointer hover:bg-surface/70`:`cursor-default`),children:[e.state===`running`&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute -inset-px rounded-full ring-2 ring-accent-primary/50 motion-safe:animate-pulse pointer-events-none`}),(0,K.jsx)(r,{className:P(`w-3 h-3 shrink-0`,a)}),(0,K.jsx)(`span`,{className:P(`max-w-[120px] truncate font-medium text-foreground/90`,e.state===`running`&&`title-shimmer`),children:s}),e.state===`paused`&&(0,K.jsx)(`span`,{className:`text-accent-warning`,children:i(`loopExplorer.paused`)}),e.state===`ok`&&(0,K.jsx)(_,{className:`w-3 h-3 text-accent-success shrink-0`}),e.state===`failed`&&(0,K.jsx)(D,{className:`w-3 h-3 text-destructive shrink-0`}),e.decision===`continue`&&(0,K.jsx)(p,{className:`w-3 h-3 text-accent-highlight shrink-0`}),e.decision===`stop`&&(0,K.jsx)(m,{className:`w-3 h-3 text-accent-success shrink-0`})]})]},e.key)}),t&&(0,K.jsxs)(`span`,{"data-testid":`loop-iteration-chip`,className:`ml-auto flex items-center gap-1.5 shrink-0 rounded-full border border-accent-highlight/40 bg-accent-highlight/10 px-2.5 py-1 text-[10px] font-medium text-accent-highlight tabular-nums`,children:[(0,K.jsx)(re,{className:`w-3 h-3`}),t.limit==null?i(`loopExplorer.iterationBadge`,{count:t.current}):i(`loopExplorer.iteration`,{current:t.current,limit:t.limit})]})]})}var Kt=(0,G.memo)(Gt);function qt({className:e}){return(0,K.jsxs)(`span`,{className:P(`relative flex h-2 w-2 shrink-0`,e),children:[(0,K.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,K.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-accent-primary`})]})}function Jt(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.content.toLowerCase().includes(n))}function Yt(e,t,n,r){return e.length===0?(0,K.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:n(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):e.map((e,t)=>(0,K.jsx)(bt,{line:e,even:t%2==0,onOpenTicket:r},e.id))}function Xt({label:e,value:t,copyLabel:n}){let[r,i]=(0,G.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(t),i(!0),window.setTimeout(()=>i(!1),1500)}catch{}};return(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/50`,children:e}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>void a(),"aria-label":`${n} — ${e}`,title:n,className:`p-0.5 text-muted-foreground/40 hover:text-foreground transition-colors cursor-pointer`,children:r?(0,K.jsx)(_,{className:`w-2.5 h-2.5 text-accent-success`}):(0,K.jsx)(V,{className:`w-2.5 h-2.5`})})]}),(0,K.jsx)(`pre`,{className:`mt-0.5 text-[10px] font-mono leading-relaxed text-foreground/75 whitespace-pre-wrap break-words`,children:t})]})}function Zt({segment:e,status:t,collapsed:n,filter:r,onToggle:i,onCopy:a,setRef:s,onOpenTicket:c}){let{t:l}=o(`jobs`),{meta:u,lines:d,end:f,lastActivity:p}=e,m=Wt(u.kind),h=Ht[u.kind]??`text-foreground`,g=Jt(d,r),y=t===`running`,b=!!(u.template||u.command),[x,S]=(0,G.useState)(!1);return(0,K.jsxs)(`div`,{ref:t=>s(e.key,t),"data-testid":`loop-step-section`,"data-status":t,"data-step-index":u.index,className:P(`mt-3 rounded-md overflow-hidden border animate-in fade-in duration-200`,t===`running`&&`border-accent-primary/40`,t===`failed`&&`border-destructive/30`,t===`stalled`&&`border-dashed border-destructive/40`,(t===`interrupted`||t===`paused`)&&`border-dashed border-accent-warning/40`,(t===`ok`||t===`unknown`)&&`border-border/20`),children:[(0,K.jsxs)(`div`,{className:P(`flex items-stretch bg-primary/5 border-b`,t===`failed`||t===`stalled`?`border-destructive/20`:`border-primary/20`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(e.key),className:`flex items-center gap-2 flex-1 min-w-0 text-left px-3 py-2 hover:bg-primary/10 transition-colors duration-150 cursor-pointer`,children:[(0,K.jsx)(v,{className:P(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,K.jsx)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground/60 shrink-0 w-5 text-right`,children:u.index}),(0,K.jsx)(m,{className:P(`w-3.5 h-3.5 shrink-0`,h)}),(0,K.jsx)(`span`,{className:`text-[12px] font-semibold text-foreground leading-none truncate`,children:kt(u)}),u.branch&&(0,K.jsx)(`span`,{className:`max-w-40 truncate font-mono text-[10px] text-muted-foreground`,title:u.scopeId,children:u.branch}),t===`paused`&&(0,K.jsx)(`span`,{className:`text-[10px] text-accent-warning`,children:l(`loopExplorer.paused`,{defaultValue:`Paused`})}),u.iteration!=null&&u.iteration>=1&&(0,K.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted/60 px-1.5 py-0.5 text-[9px] font-medium text-muted-foreground tabular-nums`,children:l(`loopExplorer.iterationBadge`,{count:u.iteration})}),y&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0 shrink-0 max-w-[40%]`,children:[(0,K.jsx)(qt,{}),p&&(0,K.jsx)(`span`,{className:`title-shimmer text-[10px] truncate`,children:l(`statusPanel.activity.${p.actionKey}`,{arg:p.actionArg??``})})]}),t===`ok`&&(0,K.jsx)(_,{className:`w-3.5 h-3.5 text-accent-success shrink-0`}),t===`failed`&&f?.reason===`provider_limit`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-destructive/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-destructive`,title:l(`loopExplorer.providerLimitHint`),"data-testid":`loop-step-provider-limit`,children:l(`loopExplorer.providerLimit`)}),t===`failed`&&(0,K.jsx)(D,{className:`w-3.5 h-3.5 text-destructive shrink-0`}),t===`stalled`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-destructive/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-destructive`,title:f?.idleMs==null?void 0:l(`loopExplorer.stalledIdle`,{count:Math.max(1,Math.round(f.idleMs/6e4))}),children:l(`loopExplorer.stalled`)}),t===`interrupted`&&(0,K.jsx)(`span`,{className:`shrink-0 rounded border border-dashed border-accent-warning/50 px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-wide text-accent-warning`,children:l(`loopExplorer.interrupted`)}),(0,K.jsx)(`span`,{className:`flex-1`}),f?.durationMs!=null&&(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/50 font-mono tabular-nums shrink-0`,children:Lt(f.durationMs)}),t===`failed`&&f?.exitCode!=null&&f.exitCode!==0&&(0,K.jsx)(`span`,{className:`text-[10px] text-destructive/70 font-mono shrink-0`,children:l(`activeJob.exitCode`,{code:f.exitCode})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:l(`logViewer.phaseLines`,{count:d.length})})]}),b&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(e=>!e),"aria-label":l(`loopExplorer.stepDetail`),"aria-expanded":x,title:l(`loopExplorer.stepDetail`),className:P(`px-2 flex items-center transition-colors cursor-pointer`,x?`text-foreground bg-primary/10`:`text-muted-foreground/40 hover:text-foreground hover:bg-primary/10`),children:(0,K.jsx)(ae,{className:`w-3 h-3`})}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(e.key),"aria-label":l(`loopExplorer.copyStep`),title:l(`loopExplorer.copyStep`),className:`px-2.5 flex items-center text-muted-foreground/40 hover:text-foreground hover:bg-primary/10 transition-colors cursor-pointer`,children:(0,K.jsx)(V,{className:`w-3 h-3`})})]}),x&&b&&(0,K.jsxs)(`div`,{"data-testid":`loop-step-detail`,className:P(`px-4 py-2.5 space-y-2.5 bg-muted/10 border-b animate-in fade-in duration-150`,t===`failed`?`border-destructive/20`:`border-primary/10`),children:[u.template&&(0,K.jsx)(Xt,{label:l(`loopExplorer.stepDetailTemplate`),value:u.template,copyLabel:l(`loopExplorer.copyCommand`)}),u.command&&(0,K.jsx)(Xt,{label:l(`loopExplorer.stepDetailCommand`),value:u.command,copyLabel:l(`loopExplorer.copyCommand`)})]}),!n&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:Yt(g,r,l,c)})]})}var Qt=(0,G.memo)(Zt,(e,t)=>e.segment.key===t.segment.key&&e.segment.lines.length===t.segment.lines.length&&e.segment.lines[e.segment.lines.length-1]?.content===t.segment.lines[t.segment.lines.length-1]?.content&&e.segment.meta.template===t.segment.meta.template&&e.segment.meta.command===t.segment.meta.command&&e.segment.end?.status===t.segment.end?.status&&e.segment.end?.durationMs===t.segment.end?.durationMs&&e.segment.end?.decision===t.segment.end?.decision&&e.segment.end?.exitCode===t.segment.end?.exitCode&&e.segment.lastActivity?.actionKey===t.segment.lastActivity?.actionKey&&e.segment.lastActivity?.actionArg===t.segment.lastActivity?.actionArg&&e.status===t.status&&e.collapsed===t.collapsed&&e.filter===t.filter&&e.onOpenTicket===t.onOpenTicket),$t=`__setup__`;function en({lines:e,collapsed:t,filter:n,onToggle:r,setRef:i,onOpenTicket:a}){let{t:s}=o(`jobs`),c=Jt(e,n);return(0,K.jsxs)(`div`,{ref:e=>i($t,e),"data-testid":`loop-setup-section`,className:`rounded-md overflow-hidden border border-border/20`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>r($t),className:`flex items-center gap-2 w-full text-left px-3 py-2 bg-muted/10 border-b border-border/20 hover:bg-muted/20 transition-colors duration-150 cursor-pointer`,children:[(0,K.jsx)(v,{className:P(`w-3 h-3 text-muted-foreground/60 shrink-0 transition-transform duration-150`,!t&&`rotate-90`)}),(0,K.jsx)(S,{className:`w-3.5 h-3.5 text-accent-success/70 shrink-0`}),(0,K.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground leading-none uppercase tracking-wide`,children:s(`loopExplorer.setup`)}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:s(`logViewer.phaseLines`,{count:e.length})})]}),!t&&(0,K.jsx)(`div`,{className:`bg-muted/5`,children:Yt(c,n,s,a)})]})}var tn=(0,G.memo)(en,(e,t)=>e.lines.length===t.lines.length&&e.lines[e.lines.length-1]?.content===t.lines[t.lines.length-1]?.content&&e.collapsed===t.collapsed&&e.filter===t.filter&&e.onOpenTicket===t.onOpenTicket);function nn(e,t){let{t:n}=o(`jobs`),[r,i]=(0,G.useState)(!1),[a,s]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),d=`${t??`active`}:${e??``}`,f=(0,G.useRef)(d),p=(0,G.useRef)(!1);f.current=d,(0,G.useEffect)(()=>(f.current=d,i(!1),s(``),u(null),p.current=!1,()=>{f.current=``}),[d]);async function m(r){if(!e||p.current||!r.meta.nodePath||!r.meta.scopeId||!r.meta.iteration)return;let a=d;p.current=!0,i(!0),s(``);try{let i=`${t?R(t):c()}/loop-runs/${encodeURIComponent(e)}`,o=await fetch(`${i}/recovery`,{cache:`no-store`});if(!o.ok)throw Error(n(`loopExplorer.forkFailed`));let s=await o.json();if(f.current!==a)return;if(s.forkAdopted&&s.forkRunId){u(s.forkRunId);return}let l={fromNodePath:r.meta.nodePath,scopeId:r.meta.scopeId,visit:r.meta.iteration};if(s.forkRequest&&(s.forkRequest.fromNodePath!==l.fromNodePath||s.forkRequest.scopeId!==l.scopeId||s.forkRequest.visit!==l.visit))throw Error(n(`loopExplorer.forkPending`));let d=s.forkRequest??{...l,requestId:crypto.randomUUID()},p=await fetch(`${i}/fork`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(d)}),m=await p.json();if(!p.ok||!m.loopRunId)throw Error(m.detail??n(`loopExplorer.forkFailed`));f.current===a&&u(m.loopRunId)}catch(e){f.current===a&&s(e instanceof Error?e.message:n(`loopExplorer.forkFailed`))}finally{f.current===a&&(p.current=!1,i(!1))}}return{busy:r,error:a,created:l,fork:m}}function rn(){return(0,K.jsxs)(`span`,{className:`relative flex h-1.5 w-1.5 shrink-0`,children:[(0,K.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,K.jsx)(`span`,{className:`relative inline-flex rounded-full h-1.5 w-1.5 bg-accent-primary`})]})}function an({events:e,jobStatus:t,isLoading:n,variant:r=`page`,projectId:i,onOpenRun:a}){let{t:s,i18n:c}=o(`jobs`),[d,f]=(0,G.useState)(``),[p,m]=(0,G.useState)(`follow`),[h,g]=(0,G.useState)(new Set),_=(0,G.useRef)(null),v=(0,G.useRef)(new Map),y=ut(i),{activeProjectId:b}=l(),x=nn(e[0]?.job_id,i??b??void 0),S=(0,G.useMemo)(()=>jt(e),[e,c.language]),C=t!=null&&t!==`running`&&t!==`queued`,w=t===`running`,E=(0,G.useMemo)(()=>S.segments.map((e,t)=>Mt(e,{isLast:t===S.segments.length-1,jobSettled:C})),[S,C]),D=(0,G.useMemo)(()=>{let e=S.segments.map(e=>e.key);return S.setup.length>0&&e.push($t),e},[S]),O=S.segments.length>0?S.segments[S.segments.length-1].key:$t,k=(0,G.useMemo)(()=>d?new Set(D):p===`follow`?new Set([O]):h,[d,p,O,h,D]),A=(0,G.useRef)(k);A.current=k;let j=(0,G.useRef)(S);j.current=S;let M=(0,G.useCallback)(e=>{let t=new Set(A.current);e?.(t),g(t),m(`manual`)},[]),N=(0,G.useCallback)(e=>{M(t=>{t.has(e)?t.delete(e):t.add(e)})},[M]),F=(0,G.useCallback)(e=>{M(t=>t.add(e)),requestAnimationFrame(()=>{v.current.get(e)?.scrollIntoView?.({behavior:`smooth`,block:`start`})})},[M]),I=(0,G.useCallback)(()=>{let e=_.current;e&&(e.scrollTop=e.scrollHeight)},[]),R=(0,G.useCallback)(()=>{m(`follow`),requestAnimationFrame(I)},[I]),ee=(0,G.useCallback)(()=>{g(new Set(D)),m(`manual`)},[D]),z=(0,G.useCallback)(()=>{g(new Set),m(`manual`)},[]);(0,G.useEffect)(()=>{p===`follow`&&!d&&I()},[S.totalLines,S.segments.length,p,d,I]);let te=(0,G.useCallback)(()=>{let e=_.current;!e||p!==`follow`||e.scrollHeight-e.scrollTop-e.clientHeight>80&&M()},[p,M]),ne=(0,G.useCallback)((e,t)=>{t?v.current.set(e,t):v.current.delete(e)},[]),re=(0,G.useCallback)(e=>{let t=j.current.segments.find(t=>t.key===e),n=e===`__setup__`?j.current.setup.map(e=>e.content).join(`
|
|
17
|
+
`):(t?.lines??[]).map(e=>e.content).join(`
|
|
18
|
+
`);navigator.clipboard.writeText(n).then(()=>u.success(s(`loopExplorer.copied`))).catch(()=>u.error(s(`logViewer.copyFailed`)))},[s]),ie=(0,G.useCallback)(()=>{let e=j.current,t=e.setup.map(e=>e.content);for(let n of e.segments){t.push(`── Step ${n.meta.index} · ${Ot(n.meta.title)} ──`);for(let e of n.lines)t.push(e.content)}navigator.clipboard.writeText(t.join(`
|
|
19
|
+
`)).then(()=>u.success(s(`logViewer.copySuccess`))).catch(()=>u.error(s(`logViewer.copyFailed`)))},[s]),B=(0,G.useMemo)(()=>It(S,{jobSettled:C,jobFailed:t===`failed`}),[S,C,t]),H=S.graphMeta?.iterationLimit??S.graphMeta?.graph.config.maxIterations??null,ae=S.maxIteration>0?{current:S.maxIteration,limit:H}:null,U=(0,G.useMemo)(()=>{if(!d)return S.totalLines;let e=d.toLowerCase(),t=S.setup.filter(t=>t.content.toLowerCase().includes(e)).length;for(let n of S.segments)t+=n.lines.filter(t=>t.content.toLowerCase().includes(e)).length;return t},[d,S]),oe=S.segments[S.segments.length-1],W=w&&(S.segments.length===0||oe?.end!=null);return n?(0,K.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`logViewer.loading`)})}):S.totalLines===0&&S.segments.length===0?(0,K.jsx)(`div`,{"data-testid":`loop-step-explorer`,className:`flex-1 flex items-center justify-center h-full`,children:(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[w&&(0,K.jsx)(rn,{}),s(w?`loopExplorer.waiting`:`logViewer.empty`)]})}):(0,K.jsxs)(`div`,{"data-testid":`loop-step-explorer`,className:`relative flex min-h-0 flex-col h-full`,children:[(0,K.jsxs)(`div`,{className:P(`border-b border-border flex items-center gap-2`,r===`glass`?`px-3 py-1.5`:`px-4 py-2`),children:[(0,K.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,K.jsx)(T,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,K.jsx)(se,{placeholder:s(`logViewer.filterPlaceholder`),value:d,onChange:e=>f(e.target.value),className:`pl-7 h-7`})]}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:ee,"aria-label":s(`loopExplorer.expandAll`),title:s(`loopExplorer.expandAll`),children:(0,K.jsx)(Ae,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:z,"aria-label":s(`loopExplorer.collapseAll`),title:s(`loopExplorer.collapseAll`),children:(0,K.jsx)(ke,{className:`w-3.5 h-3.5`})}),p===`follow`&&w&&(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] text-accent-primary shrink-0`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.follow`)]}),(0,K.jsx)(`span`,{className:`flex-1`}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:ie,"aria-label":s(`logViewer.copySuccess`),children:(0,K.jsx)(V,{className:`w-3.5 h-3.5`})}),(0,K.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:s(`logViewer.lineCount`,{filtered:U,total:S.totalLines})})]}),S.completion&&(0,K.jsx)(`div`,{"data-testid":`loop-completion-scroll`,className:r===`glass`?`max-h-[45%] min-h-0 shrink-0 overflow-y-auto overscroll-contain`:void 0,tabIndex:r===`glass`?0:void 0,children:(0,K.jsx)(zt,{result:S.completion})}),S.graphMeta?.runtimeTopology&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Rt,{topology:S.graphMeta.runtimeTopology,segments:S.segments,settled:C,onFocus:F,onFork:x.fork,forkBusy:x.busy}),x.error&&(0,K.jsx)(`p`,{role:`alert`,className:`px-2 text-xs text-destructive`,children:x.error}),x.created&&(0,K.jsxs)(`div`,{className:`p-2 text-xs`,children:[(0,K.jsx)(`p`,{children:s(`loopExplorer.forkCreated`)}),(0,K.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>a?.(x.created),disabled:!a,children:s(`loopExplorer.openFork`)}),(0,K.jsx)(`code`,{className:`ml-2`,children:x.created})]})]}),(0,K.jsx)(Kt,{chips:B,iteration:ae,onChipClick:F,variant:r}),(0,K.jsxs)(`div`,{ref:_,onScroll:te,className:`min-h-0 flex-1 overflow-y-auto p-2 text-xs`,children:[S.setup.length>0&&(0,K.jsx)(tn,{lines:S.setup,collapsed:!k.has(`__setup__`),filter:d,onToggle:N,setRef:ne,onOpenTicket:y}),S.segments.map((e,t)=>(0,K.jsx)(Qt,{segment:e,status:E[t],collapsed:!k.has(e.key),filter:d,onToggle:N,onCopy:re,setRef:ne,onOpenTicket:y},e.key)),W&&(0,K.jsxs)(`div`,{"data-testid":`loop-waiting-row`,className:`mt-3 flex items-center gap-2 px-3 py-2 text-[11px] text-muted-foreground/70 italic`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.waiting`)]})]}),p===`manual`&&w&&!d&&(0,K.jsxs)(`button`,{type:`button`,"data-testid":`resume-follow-pill`,onClick:R,className:`absolute bottom-4 left-1/2 -translate-x-1/2 z-10 flex items-center gap-1.5 rounded-full glass-card border border-accent-primary/30 px-3 py-1.5 text-[11px] font-medium text-foreground shadow-lg hover:border-accent-primary/60 transition-colors cursor-pointer animate-in fade-in slide-in-from-bottom-2 duration-200`,children:[(0,K.jsx)(rn,{}),s(`loopExplorer.resumeFollow`)]})]})}var on=new Set(`grep.rg.ag.ack.find.fd.ls.cat.head.tail.sed.awk.cut.sort.uniq.wc.jq.yq.tr.xargs.tee.column.less.more.cd.pwd.echo.printf.which.type.test.true.false.env.export.set.source.date.basename.dirname.realpath.readlink.stat.file.tree.diff.sleep.seq.hostname.whoami.uname.mkdir.rmdir.cp.mv.rm.touch.ln.chmod.chown.install.[[.[.]].].for.while.until.if.then.else.elif.fi.do.done.case.esac.exec.eval.trap.read.shift.wait`.split(`.`)),sn=new Set([`status`,`diff`,`log`,`show`,`branch`,`rev-parse`,`ls-files`,`blame`,`describe`]),cn=new Set([...sn,`commit`,`add`,`stage`,`push`,`pull`,`fetch`,`checkout`,`switch`,`merge`,`rebase`,`reset`,`stash`,`tag`,`clone`,`worktree`,`cherry-pick`,`restore`,`apply`,`init`,`remote`,`config`,`update-ref`,`for-each-ref`]),ln=new Set([`run`,`run-script`,`test`,`install`,`ci`,`i`,`add`,`exec`,`start`,`dlx`]),un=[[/^(test|tests|test:.*|vitest|jest|spec)$/,`activity.testing`],[/^(build|compile|bundle|dist)$/,`activity.building`],[/^(typecheck|tsc|types?)$/,`activity.typechecking`],[/^(lint|lint:.*|eslint|format|fmt|prettier)$/,`activity.linting`]],dn=new Set([`vitest`,`jest`,`pytest`,`mocha`,`ava`,`rspec`,`phpunit`]);function fn(e){for(let[t,n]of un)if(t.test(e))return n;return null}function pn(e){return e.split(/\s+/).map(e=>e.replace(/^['"`]+/,``).replace(/['"`]+$/,``)).filter(e=>e.length>0&&!e.startsWith(`-`))}function mn(e){let t=pn(e);if(t.length===0)return{kind:`plumbing`};let n=t[0].split(`/`).pop()??t[0],r=t.slice(1);if(on.has(n))return{kind:`plumbing`};if(dn.has(n))return{kind:`intent`,code:`activity.testing`};if((n===`npx`||n===`pnpm`||n===`yarn`||n===`bunx`)&&r.length>0){let e=r[0]===`dlx`||r[0]===`exec`?r[1]??``:r[0];if(dn.has(e))return{kind:`intent`,code:`activity.testing`};let t=fn(e===`run`?r[r.indexOf(`run`)+1]??``:e);if(t)return{kind:`intent`,code:t};if(e===`tsc`)return{kind:`intent`,code:`activity.typechecking`}}if(n===`npm`||n===`yarn`||n===`pnpm`||n===`bun`){let e=r.findIndex(e=>ln.has(e)),t=e===-1?``:r[e];if(t===`install`||t===`ci`||t===`i`||t===`add`)return{kind:`intent`,code:`activity.installing`};let i=fn(t===`run`||t===`run-script`?r[e+1]??``:t);return i?{kind:`intent`,code:i}:{kind:`named`,tool:n}}if(n===`git`){let e=r.find(e=>cn.has(e))??``;return sn.has(e)?{kind:`plumbing`}:e===`commit`||e===`add`||e===`stage`?{kind:`intent`,code:`activity.savingWork`}:{kind:`named`,tool:n}}if(n===`cargo`||n===`go`||n===`dotnet`||n===`mvn`||n===`mvnw`||n===`gradle`||n===`gradlew`){let e=r.find(e=>e===`test`||e===`build`||e===`compile`)??``;return e===`test`?{kind:`intent`,code:`activity.testing`}:e===`build`||e===`compile`?{kind:`intent`,code:`activity.building`}:{kind:`named`,tool:n}}return n===`tsc`?{kind:`intent`,code:`activity.typechecking`}:n===`openspec`?{kind:`intent`,code:`activity.checkingSpec`}:{kind:`named`,tool:n}}function hn(e){try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}function gn(e,t){return e&&/^main-\d+$/.test(e)?`step.role.work`:e===`verify`?`step.role.verify`:e===`decide`||t===`decider`?`step.role.decide`:e===`fix`?`step.role.fix`:null}function _n(e){return e.replace(/^[^\p{L}\p{N}(]+/u,``).trim()}var Z=e=>typeof e==`number`&&Number.isFinite(e)?e:null,Q=e=>typeof e==`string`&&e.length>0?e:null,vn=new Set([`thinking`,`reasoning`]),yn=/^(MEMORY\.md|confidence-score\.json|design-confidence\.json|\d{4}-\d{2}-\d{2}-.+|feedback_.+)$/,bn=/^(proposal|design|tasks|spec|context-bundle)\.md$/,xn=new Set([`reading`,`writing`,`editing`]);function $(e,t,n,r,i,a=``){for(let t=e.length-1;t>=0;t--){let o=e[t];if(o.values.phaseBoundary===1)break;if(o.kind!==`activity`){if(o.stepIndex!==n)break;continue}if(o.stepIndex!==n)break;if((o.values.repository??``)===a&&o.values.action===r&&o.values.target===i){o.values.repeats=Number(o.values.repeats??1)+1;return}}e.push({seq:t,kind:`activity`,code:r===`intent`?i:i?`activity.${r}`:`activity.${r}Bare`,values:{action:r,target:i,repeats:1,repository:a},stepIndex:n,tone:`neutral`})}var Sn=new Set([`architect`,`developer`,`fixer`,`verify`,`reviewer`,`archive`]),Cn=3;function wn(e,t,n,r,i,a=``){for(let t=e.length-1;t>=0;t--){let o=e[t];if(o.values.phaseBoundary===1||o.stepIndex!==n)break;if(o.kind!==`activity`||(o.values.repository??``)!==a||o.values.action!==r||o.values.fileGroup!==1)continue;let s=String(o.values.allNames??``).split(`\0`).filter(Boolean),c=!!i&&!s.includes(i);c&&s.push(i),o.values.allNames=s.join(`\0`),o.values.files=s.length;let l=String(o.values.names??``).split(`, `).filter(Boolean);c&&l.length<Cn&&(l.push(i),o.values.names=l.join(`, `)),o.code=s.length>1?`activity.${r}Files`:i?`activity.${r}`:`activity.${r}Bare`,o.values.repeats=s.length>1?1:Number(o.values.repeats??1)+1;return}e.push({seq:t,kind:`activity`,code:i?`activity.${r}`:`activity.${r}Bare`,values:{action:r,target:i,names:i,allNames:i,repository:a,files:+!!i,fileGroup:1,repeats:1},stepIndex:n,tone:`neutral`})}function Tn({events:e,settled:t}){let n=[],r=new Map,i=new Set,a=null,o=!1,s=!1,c=e.some(e=>e.event_type===`workflow-event`);for(let t of e){if(t.event_type===`loop_graph`){o=!0;continue}if(t.event_type===`loop_step`){let e=hn(t.payload),i=Z(e.index);if(i===null)continue;o=!0;let s=Q(e.kind)??`ai-step`,l={index:i,title:_n(Q(e.title)??``),roleCode:c?null:gn(Q(e.nodeId),s),kind:s,iteration:Z(e.iteration),ended:!1};r.set(i,l),a=i;let u=Z(e.attempt);n.push({seq:t.seq,kind:`step-start`,code:u!==null&&u>1?`step.startResume`:l.iteration&&l.iteration>1?`step.startRetry`:`step.start`,values:{step:i,title:l.title,iteration:l.iteration??1,...u!==null&&u>1?{attempt:u}:{},...l.roleCode?{roleCode:l.roleCode}:{}},stepIndex:i,tone:`neutral`});continue}if(t.event_type===`loop_step_end`){let e=hn(t.payload),i=Z(e.index);if(i===null)continue;let a=i===null?void 0:r.get(i);a&&(a.ended=!0);let o=Q(e.status),s=Z(e.durationMs),c=Z(e.exitCode),l=Z(e.idleMs),u=o===`stalled`,d=o===`failed`||u,f=o===`failed`&&Q(e.reason)===`provider_limit`;n.push({seq:t.seq,kind:`step-end`,code:e.recovered===!0&&o===`ok`?`step.recovered`:u?`step.stalled`:f?`step.providerLimit`:d?`step.failed`:s===null?`step.done`:s>=9e4?`step.doneTimedMin`:`step.doneTimed`,values:{step:i,title:a?.title??``,seconds:s===null?0:Math.max(1,Math.round(s/1e3)),minutes:s===null?0:Math.max(1,Math.round(s/6e4)),...u?{idleMinutes:l===null?0:Math.max(1,Math.round(l/6e4))}:{},...a?.roleCode?{roleCode:a.roleCode}:{},...c===null?{}:{exitCode:c}},stepIndex:i,tone:d?`bad`:`good`});let p=Q(e.decision);(p===`continue`||p===`stop`)&&n.push({seq:t.seq,kind:`decision`,code:p===`continue`?`decision.another`:`decision.satisfied`,values:{step:i},stepIndex:i,tone:p===`continue`?`neutral`:`good`});continue}if(t.event_type===`runtime-efficiency-event`){let e=hn(t.payload),r=e.payload&&typeof e.payload==`object`&&!Array.isArray(e.payload)?e.payload:{},o=Q(e.eventId),s=Q(e.kind);if(e.schemaVersion!==1||!o||i.has(o))continue;i.add(o);let c=Q(r.label),l=Q(r.repositoryId);if(!c||!l||c.length>256||l.length>256)continue;let u=s===`check-started`?`started`:s===`check-reused`?`reused`:s===`check-invalidated`?`invalidated`:s===`check-finished`&&typeof r.exitCode==`number`?r.exitCode===0?`passed`:`failed`:null;u&&n.push({seq:t.seq,kind:`activity`,code:`activity.check.${u}`,values:{target:c,repository:l},stepIndex:a,tone:u===`failed`?`bad`:`neutral`});continue}if(t.event_type===`workflow-event`){let e=hn(t.payload),r=e.event&&typeof e.event==`object`&&!Array.isArray(e.event)?e.event:{},i=Q(r.type),o=Q(r.stepId);if(i===`workflow_resumed`)s=!1,n.push({seq:t.seq,kind:`activity`,code:`activity.phase.resumed`,values:{phaseBoundary:1},stepIndex:a,tone:`neutral`});else if(i===`step_started`&&o&&Sn.has(o)){let e=o===`developer`&&s;o===`developer`&&(s=!0),n.push({seq:t.seq,kind:`activity`,code:e?`activity.phase.corrections`:`activity.phase.${o}`,values:{phaseBoundary:1},stepIndex:a,tone:`neutral`})}else i===`step_succeeded`&&o===`verify`&&typeof r.message!=`string`||i===`step_blocked`||(i===`workflow_failed`||i===`workflow_blocked`||i===`workflow_cancelled`)&&n.push({seq:t.seq,kind:`activity`,code:`activity.phase.stopped`,values:{action:`intent`,target:Q(r.message)??i,repeats:1},stepIndex:a,tone:`bad`});continue}let e=t.event_type===`agent-event`?hn(t.payload):{},l=Array.isArray(e.repositories)?e.repositories.map(e=>typeof e?.name==`string`?e.name:``).filter(Boolean).join(` + `):``,u=ye(t);if(!(!u.step||!u.actionKey)&&!vn.has(u.actionKey)&&!(c&&u.actionKey===`working`)){if(c&&u.actionKey===`searching`){$(n,t.seq,a,`searching`,``,l);continue}if(u.actionKey===`running`){let e=le(t),r=e?mn(e):{kind:`named`,tool:u.actionArg??``};if(r.kind===`plumbing`){$(n,t.seq,a,`exploring`,``,l);continue}if(r.kind===`intent`){$(n,t.seq,a,`intent`,r.code,l);continue}$(n,t.seq,a,`running`,c?``:r.tool,l);continue}if(xn.has(u.actionKey)){let e=u.actionArg??``;if(yn.test(e)){$(n,t.seq,a,`intent`,`activity.bookkeeping`,l);continue}if(bn.test(e)){$(n,t.seq,a,`intent`,`activity.writingSpec`,l);continue}wn(n,t.seq,a,u.actionKey,e,l);continue}$(n,t.seq,a,u.actionKey,u.actionArg??``,l)}}if(t)for(let e of r.values())e.ended||n.push({seq:2**53-1-(1e3-e.index),kind:`step-interrupted`,code:`step.interrupted`,values:{step:e.index,title:e.title},stepIndex:e.index,tone:`bad`});return{milestones:n,stepCount:r.size,plainJob:!o}}var En={"step-start":je,"step-end":_,"step-interrupted":E,decision:w,activity:je},Dn={neutral:`text-muted-foreground`,good:`text-accent-success`,bad:`text-accent-warning`};function On({events:e,settled:t,durationRange:n,elapsedMs:r,variant:i=`page`}){let{t:a}=o(`narration`),s=(0,G.useMemo)(()=>Tn({events:e,settled:t}),[e,t]),c=(0,G.useMemo)(()=>e.some(e=>e.event_type===`workflow-event`),[e]),l=(0,G.useMemo)(()=>[...s.milestones].sort((e,t)=>e.seq-t.seq),[s.milestones]);return(0,K.jsxs)(`div`,{className:i===`glass`?`flex h-full flex-col overflow-hidden`:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border/50 px-3 py-2 text-[11px] text-muted-foreground`,children:[typeof r==`number`&&r>0?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(Ne,{className:`size-3`,"aria-hidden":!0}),a(`waiting.elapsed`,{minutes:Math.max(1,Math.round(r/6e4))})]}):null,n?(0,K.jsx)(`span`,{"data-testid":`narration-range`,children:a(`waiting.range`,{low:Math.max(1,Math.round(n.p25Ms/6e4)),high:Math.max(1,Math.round(n.p75Ms/6e4)),count:n.sampleCount})}):null,(0,K.jsx)(`span`,{className:`ml-auto italic opacity-70`,children:a(`aiNote`)})]}),(0,K.jsx)(`ol`,{className:`flex-1 space-y-1 px-3 py-2 ${i===`glass`?`overflow-y-auto`:``}`,"data-testid":`narration-list`,children:l.length===0?(0,K.jsx)(`li`,{className:`py-6 text-center text-xs text-muted-foreground`,children:a(t?`emptySettled`:`emptyLive`)}):l.map((e,t)=>{let n=En[e.kind],r=e.kind===`step-start`||e.kind===`step-end`||e.kind===`step-interrupted`,i=Number(e.values.files??0)>1||c?1:Number(e.values.repeats??1);return(0,K.jsxs)(`li`,{className:`flex items-start gap-2 text-sm ${r||e.values.phaseBoundary===1?`font-medium text-foreground`:`text-muted-foreground`} ${e.kind===`step-start`&&t>0?`pt-2`:``}`,children:[(0,K.jsx)(n,{className:`mt-0.5 size-3.5 shrink-0 ${Dn[e.tone]}`,"aria-hidden":!0}),(0,K.jsxs)(`span`,{className:`min-w-0 break-words`,children:[typeof e.values.repository==`string`&&e.values.repository&&(0,K.jsx)(`span`,{className:`mr-2 inline-block rounded border border-border px-1.5 py-0.5 text-xs font-medium text-foreground`,children:e.values.repository}),e.kind===`step-start`&&typeof e.values.roleCode==`string`?a(e.code,{...e.values,title:a(e.values.roleCode),defaultValue:e.code}):a(e.code,{...e.values,defaultValue:e.code}),i>1?(0,K.jsx)(`span`,{className:`ml-1.5 text-[11px] opacity-70`,children:a(`repeats`,{count:i})}):null]})]},`${e.seq}-${e.code}-${t}`)})})]})}var kn=`specrails-desktop:job-log-mode`;function An(){try{let e=localStorage.getItem(kn);return e===`log`||e===`narrated`?e:`narrated`}catch{return`narrated`}}function jn(e){try{localStorage.setItem(kn,e)}catch{}}function Mn(e,t){switch(t.type){case`turn-user`:return{...e,streaming:!0,accepting:!0,queued:t.queued?e.queued+1:e.queued};case`turn-done`:{let n=Math.max(0,e.queued-1);return{...e,totals:t.totals,queued:n,streaming:e.queued>0}}case`finalized`:return{...e,streaming:!1,finalizing:!1,accepting:!1,queued:0,totals:t.totals??e.totals};case`accepting`:return t.accepting?{...e,accepting:!0}:{...e,accepting:!1,streaming:!1,queued:0};case`finalize-request`:return{...e,finalizing:!0};case`finalize-reject`:return{...e,finalizing:!1};case`blocked`:return{...e,accepting:!1,streaming:!1};default:return e}}function Nn(){try{return a()}catch{return null}}function Pn({jobId:e,projectId:t,settleMode:n,initialAcceptingTurns:r,pendingInterrupts:a,kind:s=`job`,variant:l=`page`,onFinalized:d}){let{t:f}=o(`jobs`),{t:p}=o(`loops`),[m,h]=(0,G.useState)(a??[]),[g,_]=(0,G.useState)(a?.length===1?a[0].id:``);(0,G.useEffect)(()=>{h(a??[]),_(a?.length===1?a[0].id:``)},[a]);let v=m.find(e=>e.id===g),y=v!==void 0&&v.kind!==`question`,b=n??`finalize`,S=()=>t?`${i}/api/projects/${t}`:c(),[C,w]=(0,G.useReducer)(Mn,{streaming:!1,queued:0,totals:null,accepting:r??!0,finalizing:!1}),[T,E]=(0,G.useState)(``),[D,O]=(0,G.useState)(!1),k=(0,G.useRef)(null);(0,G.useEffect)(()=>{r!==void 0&&w({type:`accepting`,accepting:r})},[r]);let A=(0,G.useRef)(d);A.current=d;let j=Nn(),M=(0,G.useId)();(0,G.useEffect)(()=>{if(!j)return;let t=`interactive-composer-${e}-${M}`;return j.registerHandler(t,t=>{let n=t;if(n.jobId===e){if(n.type===`job.turn_user`)w({type:`turn-user`,queued:!!n.queued});else if(n.type===`job.turn_done`)w({type:`turn-done`,totals:n.totals});else if(n.type===`job.finalized`)w({type:`finalized`,totals:n.totals??null}),A.current?.();else if(n.type===`job.interactive`&&(w({type:`accepting`,accepting:!!n.acceptingTurns}),Array.isArray(n.pendingInterrupts))){let e=n.pendingInterrupts;h(e),_(e.length===1?e[0].id:``)}}}),()=>j.unregisterHandler(t)},[j,e,M]);let N=s===`loop-step`&&!C.accepting;async function F(t=!1){let n=T.trim();if(!(!n&&!t||D||N||m.length>0&&!v||y&&!t)){O(!0);try{let r=await fetch(`${S()}/jobs/${e}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:n,...v?{interruptId:v.id}:{},...t?{approve:!0}:{}})});if(r.ok)E(``),v&&(h([]),_(``),w({type:`accepting`,accepting:!1})),requestAnimationFrame(()=>k.current?.focus());else if(r.status===409&&s===`loop-step`&&!m.length)w({type:`blocked`});else{let e=await r.json().catch(()=>({}));u.error(f(`detail.toast.sendFailed`),{description:e.error})}}catch{u.error(f(`detail.toast.networkError`))}finally{O(!1)}}}async function I(){if(!C.finalizing){w({type:`finalize-request`});try{let t=await fetch(`${S()}/jobs/${e}/finalize`,{method:`POST`});if(t.ok)u.success(f(b===`finalize`?`detail.toast.finalizeScheduled`:s===`loop-step`?`detail.toast.wrapUpStepScheduled`:`detail.toast.wrapUpScheduled`));else if(t.status===409&&s===`loop-step`)w({type:`blocked`}),w({type:`finalize-reject`});else{let e=await t.json().catch(()=>({}));u.error(f(`detail.toast.finalizeFailed`),{description:e.error}),w({type:`finalize-reject`})}}catch{u.error(f(`detail.toast.networkError`)),w({type:`finalize-reject`})}}}let R=D||N||!T.trim()||y||m.length>0&&!v,ee=f(`detail.interactive.working`);return(0,K.jsxs)(`div`,{"data-testid":`interactive-job-composer`,className:P(`shrink-0 border-t px-3 py-2 space-y-1.5`,`motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2 motion-safe:duration-300`,l===`glass`?`border-border/30 bg-surface/30`:`border-border/40 bg-surface/40`),children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[N?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(Pe,{className:`h-3 w-3 motion-safe:animate-pulse`}),f(`detail.interactive.waitingForStepShort`)]}):C.streaming?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(x,{className:`h-3 w-3 animate-spin text-accent-primary`}),(0,K.jsxs)(`span`,{className:`relative`,children:[ee,(0,K.jsx)(`span`,{"aria-hidden":!0,className:`title-shimmer pointer-events-none absolute inset-0`,children:ee})]})]}):(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent-success motion-safe:animate-pulse`}),f(`detail.interactive.ready`)]}),C.queued>0&&(0,K.jsx)(`span`,{className:`rounded-full border border-accent-info/30 bg-accent-info/10 px-1.5 py-px text-[10px] tabular-nums text-accent-info motion-safe:animate-in motion-safe:fade-in`,children:f(`detail.interactive.queued`,{count:C.queued})})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[C.totals&&(0,K.jsx)(`span`,{className:`tabular-nums`,children:f(`detail.interactive.liveTotals`,{turns:C.totals.num_turns??f(`completion.unavailable`),cost:C.totals.total_cost_usd?.toFixed(4)??f(`completion.unavailable`)})}),m.length?null:b===`finalize`?(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void I(),disabled:C.finalizing,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,K.jsx)(B,{className:`mr-1.5 h-3.5 w-3.5`}),C.finalizing?f(`detail.finalizing`):f(`detail.finalizeJob`)]})}),(0,K.jsx)(me,{children:f(`detail.finalizeJobTooltip`)})]}):(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>void I(),disabled:C.finalizing||N,className:P(`text-[11px] underline-offset-2 transition-colors`,N?`cursor-not-allowed text-muted-foreground/40`:`text-muted-foreground hover:text-accent-success hover:underline`),children:C.finalizing?f(`detail.interactive.wrappingUp`):f(s===`loop-step`?`detail.interactive.wrapUpStep`:`detail.interactive.wrapUp`)})}),(0,K.jsx)(me,{children:f(s===`loop-step`?`detail.interactive.wrapUpStepTooltip`:`detail.interactive.wrapUpTooltip`)})]})]})]}),m.length>0&&(0,K.jsxs)(`div`,{className:`space-y-2 rounded-md border border-accent-warning/30 bg-accent-warning/5 p-3`,children:[(0,K.jsxs)(`label`,{className:`block text-sm`,children:[p(`core.selectInterrupt`),(0,K.jsxs)(`select`,{"aria-label":p(`core.selectInterrupt`),className:`mt-1 w-full rounded border border-border bg-background p-2`,value:g,onChange:e=>_(e.target.value),children:[(0,K.jsx)(`option`,{value:``,children:p(`core.selectInterrupt`)}),m.map(e=>(0,K.jsxs)(`option`,{value:e.id,children:[e.nodePath,` · `,p(`core.${e.kind===`question`?`answerQuestion`:`approval`}`)]},e.id))]})]}),v&&typeof v.value==`object`&&v.value!==null&&typeof v.value.prompt==`string`&&(0,K.jsx)(`p`,{className:`whitespace-pre-wrap text-sm`,children:String(v.value.prompt)}),y&&(0,K.jsx)(L,{onClick:()=>void F(!0),disabled:D||N,children:p(`core.approveContinue`)})]}),b===`auto`&&!m.length&&(0,K.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground/60`,children:f(N?`detail.interactive.waitingForStep`:`detail.interactive.autoHint`)}),(0,K.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,K.jsx)(`textarea`,{ref:k,value:T,onChange:e=>E(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),F())},rows:2,placeholder:f(N?`detail.interactive.waitingForStepShort`:`detail.interactive.placeholder`),"aria-label":f(`detail.interactive.placeholder`),disabled:N,className:P(`flex-1 resize-none rounded-md border border-border/50 bg-background px-2.5 py-1.5 text-sm transition-opacity focus:outline-none focus:ring-2 focus:ring-ring`,N&&`opacity-60`)}),(0,K.jsxs)(H,{children:[(0,K.jsx)(W,{asChild:!0,children:(0,K.jsx)(`span`,{className:`shrink-0`,children:(0,K.jsxs)(L,{size:`sm`,onClick:()=>void F(),disabled:R,className:`h-9`,children:[(0,K.jsx)(U,{className:`mr-1.5 h-3.5 w-3.5`}),f(`detail.interactive.send`)]})})}),R&&!D&&(0,K.jsx)(me,{children:f(N?`detail.interactive.sendDisabledWaiting`:`detail.interactive.sendDisabledEmpty`)})]})]})]})}export{an as a,qe as c,On as i,An as n,ht as o,jn as r,et as s,Pn as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{t as r}from"./react-dom-DiWzBDP9.js";import{a as i,c as a,l as o,m as s}from"./useSharedWebSocket-TzKtPRp9.js";import{n as c}from"./createLucideIcon-Bjbbp_KS.js";import{a as l,s as u}from"./useDesktop-D07TvesS.js";import{dt as d,gt as f}from"./TicketDetailModalContext-UAeNm7BB.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as ee}from"./InteractiveJobComposer-D5fh_eVL.js";import{t as te}from"./loader-circle-DcygOQpC.js";import{t as ne}from"./x-CBMI9ejn.js";import{F as re,I as ie,P as ae}from"./dialog-CMgps2MY.js";import{t as oe}from"./formatDistanceToNow-aw7H5ORC.js";import{t as y}from"./button-D1xExSTF.js";import{G as se,J as b,W as x}from"./index-JSTZVJfe.js";import{n as S,t as C}from"./job-time-BCL7wee9.js";var ce=e(r(),1),w=e(t(),1),T=[1e3,2e3,4e3,8e3,16e3];function E(e,t){let[n,r]=(0,w.useState)(`connecting`),o=(0,w.useRef)(t);return o.current=t,(0,w.useEffect)(()=>{let t=!1,n=!1,s=null,c=0,l=null;async function u(){if(!(t||n||s)){n=!0;try{await a()}catch{}finally{n=!1}!t&&!s&&f()}}function d(){if(t)return;l!==null&&clearTimeout(l),r(`connecting`);let e=T[c++]??3e4;l=setTimeout(()=>{l=null,u()},e)}function f(){if(t||s)return;let n=i(),a;try{a=n?new WebSocket(e,[`specrails-desktop`,n]):new WebSocket(e)}catch{d();return}s=a,r(`connecting`),a.onopen=()=>{t||s!==a||(c=0,r(`connected`))},a.onmessage=e=>{if(!(t||s!==a))try{o.current(JSON.parse(e.data))}catch{}},a.onclose=()=>{t||s!==a||(s=null,d())}}let p=()=>{t||s||(l!==null&&clearTimeout(l),l=null,u())};return window.addEventListener(`online`,p),window.addEventListener(`focus`,p),f(),()=>{t=!0,window.removeEventListener(`online`,p),window.removeEventListener(`focus`,p),l!==null&&clearTimeout(l);let e=s;if(s=null,e){e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null;try{e.close()}catch{}}}},[e]),{connectionStatus:n}}var D=n();function O({jobId:e,onClose:t,projectId:n}){let[r,i]=(0,w.useState)(e);(0,w.useEffect)(()=>{i(e)},[e]);let{t:a}=c(`jobs`),{t:T}=c(`narration`),O=(0,w.useCallback)(()=>n?`${o}/api/projects/${n}`:l(),[n]),[k,le]=(0,w.useState)(h),ue=(0,w.useCallback)(e=>{le(e),_(e)},[]),[A,j]=(0,w.useState)(null),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)([]),[I,L]=(0,w.useState)({}),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(!1),[W,G]=(0,w.useState)(!1);(0,w.useEffect)(()=>{async function e(){try{let e=await fetch(`${O()}/jobs/${r}`);if(e.status===404){V(!0);return}if(!e.ok)throw Error(`Failed to fetch job`);let t=await e.json();if(j(t.job),N(t.events),t.phaseDefinitions){F(t.phaseDefinitions);let e={};for(let n of t.phaseDefinitions)e[n.key]=`idle`;L(e)}}catch{V(!0)}finally{z(!1)}}e()},[r,O]);let K=(0,w.useCallback)(()=>{fetch(`${O()}/jobs/${r}`).then(e=>e.ok?e.json():null).then(e=>{e?.job&&j(e.job)}).catch(()=>{})},[r,O]),q=(0,w.useRef)([]),J=(0,w.useRef)(null),Y=(0,w.useCallback)(()=>{J.current=null;let e=q.current;e.length!==0&&(q.current=[],N(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]);(0,w.useEffect)(()=>()=>{J.current&&cancelAnimationFrame(J.current)},[]),E(f,(0,w.useCallback)(e=>{let t=e;if(t.type===`event`&&t.jobId===r){let e={id:Date.now(),job_id:r,seq:0,event_type:t.event_type,source:t.source,payload:t.payload,timestamp:t.timestamp};q.current.push(e),J.current||=requestAnimationFrame(Y)}else if(t.type===`log`&&t.processId===r){let e={id:Date.now(),job_id:r,seq:0,event_type:`log`,source:t.source,payload:JSON.stringify({line:t.line}),timestamp:t.timestamp};q.current.push(e),J.current||=requestAnimationFrame(Y)}else if(t.type===`job.finalized`&&t.jobId===r||t.type===`runtime.continuation`&&t.jobId===r||t.type===`job.interactive`&&t.jobId===r||(t.type===`loop.run_paused`||t.type===`loop.run_resumed`)&&t.loopRunId===r)K();else if(t.type===`phase`){let e=t.phase,n=t.state;L(t=>({...t,[e]:n}))}else if(t.type===`queue`){let e=t.jobs?.find(e=>e.id===r);e&&A&&j(t=>t&&{...t,status:e.status})}},[r,A,Y,K])),(0,w.useEffect)(()=>{function e(e){if(!(e.key!==`Escape`||e.defaultPrevented)){if(H){U(!1);return}t()}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,H]);let X=A?se(A):`job`,Z=X===`loop-run`;async function de(){G(!0);try{let e=await x({projectId:n??null,jobId:r,kind:X});e.ok?(u.success(a(Z?`modal.toast.stopSignalSent`:`modal.toast.cancelSignalSent`),{description:a(Z?`modal.toast.stopSignalSentDescription`:`modal.toast.cancelSignalSentDescription`)}),K()):u.error(a(`modal.toast.cancelFailed`),{description:e.error})}finally{G(!1)}}let fe=A?.status===`running`,Q=A?S(C(A)):null,{panelRef:pe,panelStyle:$,headerHandleProps:me,resizeHandles:he,isFloating:ge,guardBackdrop:_e}=re();return(0,ce.createPortal)((0,D.jsx)(b,{delayDuration:400,children:(0,D.jsxs)(`div`,{style:ie(),className:`fixed inset-0 z-[65] flex items-stretch justify-center p-[clamp(12px,2vmin,24px)]`,children:[(0,D.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:_e(t)}),(0,D.jsxs)(`div`,{ref:pe,className:`relative w-full min-w-0 rounded-xl glass-card border border-border/30 flex flex-col animate-in fade-in zoom-in-95 duration-200 overflow-hidden`,style:$,children:[(0,D.jsxs)(`div`,{...me,className:`flex items-center justify-between px-4 py-3 border-b border-border/30${ge?` cursor-grab active:cursor-grabbing`:``}`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[A&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`text-xs font-mono text-foreground/80 truncate`,children:A.command}),(0,D.jsx)(`span`,{className:`text-[10px] text-muted-foreground shrink-0`,children:Q?oe(Q,{addSuffix:!0,locale:s()}):`—`})]}),R&&(0,D.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a(`common:states.loading`)})]}),(0,D.jsx)(`button`,{onClick:t,className:`h-7 w-7 shrink-0 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer`,children:(0,D.jsx)(ne,{className:`w-4 h-4`})})]}),A&&(0,D.jsx)(v,{onOpenRun:i,job:A,events:M,phases:I,phaseDefinitions:P,projectId:n,variant:`glass`,actions:fe?(0,D.jsxs)(y,{variant:`ghost`,size:`sm`,onClick:()=>U(!0),disabled:W,className:`h-7 text-destructive hover:text-destructive hover:bg-destructive/10`,children:[W&&(0,D.jsx)(te,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`,"aria-hidden":!0}),a(Z?`dashboard:railControls.stop`:X===`interactive`?`common:actions.discard`:`common:actions.cancel`)]}):null}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden relative`,children:B?(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,D.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:a(`modal.notFound`)})}):d&&A?(0,D.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,D.jsx)(`div`,{className:`flex items-center gap-1 border-b border-border/40 px-3 py-1.5`,children:[`narrated`,`log`].map(e=>(0,D.jsx)(`button`,{type:`button`,onClick:()=>ue(e),"aria-pressed":k===e,"data-testid":`modal-narration-mode-${e}`,className:`rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors ${k===e?`bg-accent-primary/15 text-accent-primary`:`text-muted-foreground hover:bg-surface/60`}`,children:T(e===`narrated`?`modeNarrated`:`modeLog`)},e))}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:k===`narrated`?(0,D.jsx)(m,{events:M,settled:A.status!==`running`&&A.status!==`queued`,elapsedMs:A.duration_ms??null,variant:`glass`}):A.command.startsWith(`loop:`)?(0,D.jsx)(p,{events:M,jobStatus:A.status,isLoading:R,variant:`glass`,projectId:n,onOpenRun:i}):(0,D.jsx)(g,{events:M,isLoading:R,projectId:n})})]}):A?.command.startsWith(`loop:`)?(0,D.jsx)(p,{events:M,jobStatus:A.status,isLoading:R,variant:`glass`,projectId:n,onOpenRun:i}):(0,D.jsx)(g,{events:M,isLoading:R,projectId:n})}),!!A?.interactive&&A.status===`running`&&(0,D.jsx)(ee,{jobId:r,projectId:n,settleMode:A.interactiveSettleMode,initialAcceptingTurns:A.interactiveAcceptingTurns,pendingInterrupts:A.pendingInterrupts,kind:A.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`glass`,onFinalized:K})]}),(0,D.jsx)(ae,{handles:he}),H&&(0,D.jsxs)(`div`,{"data-testid":`job-cancel-confirm`,className:`absolute inset-0 z-10 flex items-center justify-center p-4`,children:[(0,D.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:()=>U(!1)}),(0,D.jsxs)(`div`,{className:`relative w-full max-w-sm rounded-xl glass-card border border-border/30 p-5 shadow-xl animate-in fade-in zoom-in-95 duration-150`,children:[(0,D.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:a(Z?`modal.stopRunConfirmTitle`:`modal.cancelConfirmTitle`)}),(0,D.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:a(Z?`modal.stopRunConfirmDescription`:`modal.cancelConfirmDescription`)}),(0,D.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,D.jsx)(y,{variant:`ghost`,size:`sm`,onClick:()=>U(!1),children:a(`modal.keepRunning`)}),(0,D.jsx)(y,{variant:`destructive`,size:`sm`,onClick:()=>{U(!1),de()},children:a(Z?`modal.stopRun`:X===`interactive`?`common:actions.discard`:`modal.cancelJob`)})]})]})]})]})}),document.body)}export{O as JobDetailModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{d as r,n as i,u as a}from"./chunk-KS7C4IRE-DEKu087k.js";import{m as o,r as ee}from"./useSharedWebSocket-TzKtPRp9.js";import{n as s}from"./createLucideIcon-Bjbbp_KS.js";import{a as c,r as te,s as l}from"./useDesktop-D07TvesS.js";import{dt as u,n as ne}from"./TicketDetailModalContext-UAeNm7BB.js";import{n as d}from"./save-OsUqVn99.js";import{c as f}from"./MinimizedChatsContext-D_8L4EWZ.js";import{n as re}from"./file-text-BcLCfcWZ.js";import{a as p,c as ie,i as ae,n as oe,o as m,r as se,s as ce,t as le}from"./InteractiveJobComposer-D5fh_eVL.js";import{t as ue}from"./download-CFHyyHcw.js";import{t as de}from"./rotate-ccw-Wh4id13q.js";import{t as h}from"./utils-BC4DHlz2.js";import{t as fe}from"./formatDistanceToNow-aw7H5ORC.js";import{t as g}from"./button-D1xExSTF.js";import{K as _,Nt as v,W as pe,Y as y,q as b}from"./index-JSTZVJfe.js";import{t as me}from"./format-command-C0D9IPmV.js";var x=e(t(),1),S=n(),C=4;function he({tickets:e,onTicketClick:t}){let{t:n}=s(`jobs`),[r,i]=(0,x.useState)(!1);if(e.length===0)return null;let a=e.length>=C&&!r?e.slice(0,1):e,o=e.length-a.length;return(0,S.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[a.map(e=>(0,S.jsx)(w,{ticket:e,onClick:()=>t(e.id)},e.id)),o>0&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showMore`,{count:o}),(0,S.jsx)(d,{className:`w-3 h-3`})]}),r&&e.length>=C&&(0,S.jsxs)(`button`,{type:`button`,onClick:()=>i(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[n(`ticketHeader.showLess`),(0,S.jsx)(f,{className:`w-3 h-3`})]})]})}function w({ticket:e,onClick:t}){let{t:n}=s(`jobs`),r=e.title==null,i=`inline-flex items-center px-1.5 py-0.5 rounded-md text-[11px] font-mono tabular-nums shrink-0`;return r?(0,S.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,S.jsx)(`span`,{className:h(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,S.jsxs)(`button`,{type:`button`,onClick:t,className:`flex items-center gap-2 min-w-0 w-full text-left group`,title:e.title??void 0,children:[(0,S.jsxs)(`span`,{className:h(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,S.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function T(){let{t:e}=s(`jobs`),{t}=s(`narration`),{id:n}=r(),{activeProjectId:d,projects:f}=te(),C=f.find(e=>e.id===d)?.provider,w=a(),{openTicketDetail:T}=ne(),[E,D]=(0,x.useState)(null),[O,k]=(0,x.useState)([]),[ge,A]=(0,x.useState)([]),[_e,j]=(0,x.useState)({}),[ve,M]=(0,x.useState)([]),[ye,N]=(0,x.useState)(!0),[be,P]=(0,x.useState)(!1),[F,xe]=(0,x.useState)(oe),[Se,I]=(0,x.useState)(null),Ce=(0,x.useCallback)(e=>{xe(e),se(e)},[]),L=E?.command??null;(0,x.useEffect)(()=>{if(!u||F!==`narrated`||!d||!L)return;let e=!1,t=`command=${encodeURIComponent(L)}`;try{Promise.resolve(fetch(`${c()}/run-duration-range?${t}`)).then(e=>e&&e.ok?e.json():null).then(t=>{e||I(t?.range??null)}).catch(()=>{e||I(null)})}catch{I(null)}return()=>{e=!0}},[d,L,F]);let[R,z]=(0,x.useState)(!1),B=(0,x.useRef)(!1),V=(0,x.useRef)(null);(0,x.useEffect)(()=>{B.current=!1,V.current=null,z(!1)},[n]),(0,x.useEffect)(()=>{if(!n)return;let e=new AbortController;D(null),k([]),A([]),j({}),N(!0),P(!1);async function t(){try{let t=await fetch(`${c()}/jobs/${n}`,{signal:e.signal});if(t.status===404){P(!0);return}if(!t.ok)throw Error(`Failed to fetch job`);let r=await t.json();D(r.job),k(r.events)}catch(e){if(e.name===`AbortError`)return;P(!0)}finally{e.signal.aborted||N(!1)}}return t(),()=>e.abort()},[n,d]),(0,x.useEffect)(()=>{if(!E?.pipeline_id){M([]);return}let e=E.pipeline_id;fetch(`${c()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&M(e.jobs)}).catch(()=>{})},[E?.pipeline_id,E?.status]);let H=(0,x.useRef)(d);H.current=d;let U=(0,x.useRef)(null);U.current=E?.status??null;let W=(0,x.useRef)([]),G=(0,x.useRef)(null),K=(0,x.useCallback)(()=>{G.current=null;let e=W.current;e.length!==0&&(W.current=[],k(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),q=(0,x.useCallback)(e=>{let t=W.current;t.push(e),t.length>1e4&&(W.current=t.slice(-8e3)),G.current||=requestAnimationFrame(K)},[K]);(0,x.useEffect)(()=>()=>{G.current&&cancelAnimationFrame(G.current)},[]);let J=(0,x.useCallback)(e=>{let t=e;if(!(H.current&&t.projectId&&t.projectId!==H.current)){if(t.type===`init`){let e=t.phaseDefinitions??[];A(e);let n={};for(let r of e)n[r.key]=t.phases?.[r.key]??`idle`;j(n)}else if(t.type===`event`&&t.jobId===n){let e={id:Date.now(),job_id:n??``,seq:t.seq??0,event_type:t.event_type,source:t.source,payload:t.payload,timestamp:t.timestamp};q(e)}else if(t.type===`log`&&t.processId===n){let e={id:Date.now(),job_id:n??``,seq:0,event_type:`log`,source:t.source,payload:JSON.stringify({line:t.line}),timestamp:t.timestamp};q(e)}else if(t.type===`job.finalized`&&t.jobId===n||t.type===`runtime.continuation`&&t.jobId===n||t.type===`job.interactive`&&t.jobId===n||(t.type===`loop.run_paused`||t.type===`loop.run_resumed`)&&t.loopRunId===n)fetch(`${c()}/jobs/${n}`).then(e=>e.json()).then(e=>D(e.job)).catch(()=>{});else if(t.type===`phase`){let e=t.phase,n=t.state;j(t=>({...t,[e]:n}))}else if(t.type===`queue`){let e=t.jobs?.find(e=>e.id===n);if(e){let t=e.status,r=U.current;D(e=>e&&{...e,status:t}),(t===`completed`||t===`failed`||t===`canceled`||t===`running`&&r!==`running`)&&fetch(`${c()}/jobs/${n}`).then(e=>e.json()).then(e=>D(e.job)).catch(()=>{})}}}},[n,q]),{registerHandler:Y,unregisterHandler:X}=ee();(0,x.useEffect)(()=>(Y(`job-detail-${n}`,J),()=>X(`job-detail-${n}`)),[n,J,Y,X]),(0,x.useEffect)(()=>{if(!n||!E||E.status!==`running`||E.hasTelemetry)return;let e=setInterval(()=>{fetch(`${c()}/jobs/${n}`).then(e=>e.ok?e.json():null).then(e=>{e?.job?.hasTelemetry&&D(e=>e&&{...e,hasTelemetry:!0})}).catch(()=>{})},8e3);return()=>clearInterval(e)},[n,E?.status,E?.hasTelemetry]);async function we(){if(!n)return;let t=await pe({projectId:null,jobId:n});t.ok?l.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)}):t.httpStatus===null?l.error(e(`detail.toast.networkError`)):l.error(e(`detail.toast.failed`),{description:t.error})}async function Te(){if(E)try{let t=await fetch(`${c()}/jobs/${E.id}/diagnostic`);if(!t.ok){let n=await t.json().catch(()=>({}));throw Error(n.error??e(`detail.toast.exportFailedHttp`,{status:t.status}))}let n=await t.blob(),r=URL.createObjectURL(n),i=new Date().toISOString().slice(0,10),a=document.createElement(`a`);a.href=r,a.download=`specrails-diagnostic-${E.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){l.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function Ee(){if(!(!E||B.current)){B.current=!0,z(!0),V.current||=typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`rerun-${E.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{let t=await fetch(`${c()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`,"Idempotency-Key":V.current},body:JSON.stringify({rerunOfJobId:E.id})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));V.current=null,l.success(e(`detail.toast.jobRequeued`)),w(`/jobs/${n.jobId}`)}catch(e){l.error(e.message)}finally{B.current=!1,z(!1)}}}if(ye)return(0,S.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,S.jsxs)(`div`,{className:`space-y-3`,children:[(0,S.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,S.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,S.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(be||!E)return(0,S.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,S.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,S.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:n})}),(0,S.jsx)(g,{asChild:!0,variant:`outline`,size:`sm`,children:(0,S.jsxs)(i,{to:`/`,children:[(0,S.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let Z=E.status===`running`,De=E.status===`completed`||E.status===`failed`,Q=!!E.interactive,Oe=Q&&Z,ke=(E.tickets?.length??0)>0,$=E.command.startsWith(`loop:`),Ae=ie(ve);return(0,S.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,S.jsxs)(`div`,{className:`px-4 pt-3 pb-2 space-y-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,S.jsxs)(i,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,S.jsx)(v,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,S.jsx)(re,{className:`w-3 h-3`}),(0,S.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:n?.slice(0,8)})})]}),ke&&(0,S.jsx)(he,{tickets:E.tickets??[],onTicketClick:T}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap min-w-0`,children:[(0,S.jsx)(`code`,{className:h(`font-mono text-foreground/90 truncate`,ke?`text-xs text-muted-foreground`:`text-sm`),children:me(E.command,C)}),(0,S.jsx)(`span`,{children:E.started_at?e(`detail.startedAgo`,{timeAgo:fe(new Date(E.started_at),{addSuffix:!0,locale:o()})}):e(`detail.queuedWaiting`)}),E.model&&(0,S.jsx)(`span`,{className:`text-muted-foreground/40`,children:E.model})]})]}),(0,S.jsx)(ce,{onOpenRun:e=>w(`/jobs/${e}`),job:E,events:O,phases:_e,phaseDefinitions:ge,projectId:d,variant:`page`,pipelineTotals:Ae,actions:(0,S.jsxs)(S.Fragment,{children:[E.hasTelemetry&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsxs)(g,{variant:`outline`,size:`sm`,className:`h-7`,onClick:Te,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,S.jsx)(ue,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,S.jsx)(b,{children:e(`detail.exportDiagnosticTooltip`)})]}),De&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsxs)(g,{variant:`outline`,size:`sm`,onClick:Ee,disabled:R,"aria-busy":R,className:`h-7`,children:[(0,S.jsx)(de,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,S.jsx)(b,{children:e(`detail.reExecuteTooltip`)})]}),Z&&(0,S.jsxs)(_,{children:[(0,S.jsx)(y,{asChild:!0,children:(0,S.jsx)(g,{variant:`outline`,size:`sm`,onClick:we,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(Q?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,S.jsx)(b,{children:e(`detail.cancelJobTooltip`)})]})]})}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:u?(0,S.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-1 border-b border-border/50 px-3 py-1.5`,children:[`narrated`,`log`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>Ce(e),"aria-pressed":F===e,"data-testid":`job-narration-mode-${e}`,className:`rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors ${F===e?`bg-accent-primary/15 text-accent-primary`:`text-muted-foreground hover:bg-surface`}`,children:t(e===`narrated`?`modeNarrated`:`modeLog`)},e))}),(0,S.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:F===`narrated`?(0,S.jsx)(ae,{events:O,settled:E.status!==`running`&&E.status!==`queued`,durationRange:Se,elapsedMs:E.duration_ms??null,variant:`page`}):$?(0,S.jsx)(p,{events:O,jobStatus:E.status,variant:`page`,onOpenRun:e=>w(`/jobs/${e}`)}):(0,S.jsx)(m,{events:O})})]}):$?(0,S.jsx)(p,{events:O,jobStatus:E.status,variant:`page`,onOpenRun:e=>w(`/jobs/${e}`)}):(0,S.jsx)(m,{events:O})}),Oe&&(0,S.jsx)(le,{jobId:E.id,settleMode:E.interactiveSettleMode,initialAcceptingTurns:E.interactiveAcceptingTurns,pendingInterrupts:E.pendingInterrupts,kind:E.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`page`})]})}export{T as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./rolldown-runtime-CNC7AqOf.js";import{n as t,t as n}from"./jsx-runtime-zu2_FqZY.js";import{u as r}from"./chunk-KS7C4IRE-DEKu087k.js";import{l as i,m as a,r as o}from"./useSharedWebSocket-TzKtPRp9.js";import{n as s,t as c}from"./createLucideIcon-Bjbbp_KS.js";import{a as l,i as u,r as d,s as f}from"./useDesktop-D07TvesS.js";import{t as p}from"./circle-x-CMYsN4ZH.js";import{t as m}from"./trash-2-BOU3WdZZ.js";import{t as h}from"./triangle-alert-H9T4jAmh.js";import{t as g}from"./x-CBMI9ejn.js";import{F as _,P as v,a as y,i as b,l as x,o as ee,r as te,t as ne}from"./dialog-CMgps2MY.js";import{n as re,t as ie}from"./lib-CGdyxIWg.js";import{t as S}from"./formatDistanceToNow-aw7H5ORC.js";import{t as C}from"./button-D1xExSTF.js";import{Gt as w,K as T,S as E,Wt as ae,Y as D,jt as oe,k as se,q as O,t as k}from"./index-JSTZVJfe.js";import{t as A}from"./format-command-C0D9IPmV.js";import{t as j}from"./ExportDropdown-CsodZ-yb.js";import{n as M,t as N}from"./job-time-BCL7wee9.js";var ce=c(`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`}]]),P=e(t(),1),F=n();function I(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 L(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function R(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function z({label:e,a:t,b:n,highlight:r}){return(0,F.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,F.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,F.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,F.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function B(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function le({jobIds:e,onClose:t}){let{t:n}=s(`jobs`),[r,i]=(0,P.useState)(null),[a,o]=(0,P.useState)(!0),[c,u]=(0,P.useState)(null),{panelRef:d,panelStyle:f,headerHandleProps:m,resizeHandles:h,isFloating:y,guardBackdrop:b}=_();(0,P.useEffect)(()=>{let t=new AbortController;return fetch(`${l()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{i(e),o(!1)}).catch(e=>{e.name!==`AbortError`&&(u(e.message),o(!1))}),()=>t.abort()},[e]);function x(e,t){return(0,F.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,F.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:n(`comparison.jobN`,{n:t+1})}),(0,F.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,F.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,F.jsx)(w,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,F.jsx)(p,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,F.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:n(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,F.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,F.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:b(t),children:[(0,F.jsxs)(`div`,{ref:d,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(),style:f,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between ${y?`cursor-grab active:cursor-grabbing`:``}`,...m,children:[(0,F.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`comparison.title`)}),(0,F.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,F.jsx)(g,{className:`w-4 h-4`})})]}),a&&(0,F.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,F.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),c&&(0,F.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:n(`comparison.loadFailed`,{error:c})}),r&&(()=>{let[e,t]=r.jobs,i=B(e.durationMs,t.durationMs,!0),a=B(e.totalCostUsd,t.totalCostUsd,!0),o=B(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,F.jsx)(`div`,{}),x(e,0),x(t,1)]}),(0,F.jsx)(z,{label:n(`comparison.duration`),a:I(e.durationMs),b:I(t.durationMs),highlight:i}),(0,F.jsx)(z,{label:n(`comparison.cost`),a:L(e.totalCostUsd),b:L(t.totalCostUsd),highlight:a}),(0,F.jsx)(z,{label:n(`comparison.tokensOut`),a:R(e.tokensOut),b:R(t.tokensOut),highlight:o}),(0,F.jsx)(z,{label:n(`comparison.tokensIn`),a:R(e.tokensIn),b:R(t.tokensIn),highlight:null}),(0,F.jsx)(z,{label:n(`comparison.cacheRead`),a:R(e.tokensCacheRead),b:R(t.tokensCacheRead),highlight:null}),(0,F.jsx)(z,{label:n(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,F.jsx)(z,{label:n(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),r&&(0,F.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:n(`comparison.betterValueHint`)})]}),(0,F.jsx)(v,{handles:h})]})}var V={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`}},ue=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],de={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 fe(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function pe(e,t){let n=M(e),r=M(t);if(!n||!r)return null;let i=r.getTime()-n.getTime();if(i<0)return null;let a=Math.round(i/1e3);if(a<60)return`${a}s`;let o=Math.floor(a/60),s=a%60;return o<60?`${o}m ${s}s`:`${Math.floor(o/60)}h ${o%60}m`}function me(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function he(e){let t=M(e);return t?S(t,{addSuffix:!0,locale:a()}):`—`}function ge(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r).getTime()}function _e(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r+1).getTime()-1}function ve(e,t,n){if(!t&&!n)return!0;let r=M(e);if(!r)return!0;let i=r.getTime();return!(t&&i<ge(t)||n&&i>_e(n))}var H=10;function U({jobs:e,isLoading:t,error:n,onRetry:i,onJobsCleared:a,onProposalClick:o,onProposalDelete:c}){let{t:u}=s(`jobs`),p=r(),{activeProjectId:g,projects:re}=d(),ie=re.find(e=>e.id===g)?.provider,[S,w]=(0,P.useState)(null),[E,k]=(0,P.useState)(``),[j,M]=(0,P.useState)(``),[I,L]=(0,P.useState)(!1),[R,z]=(0,P.useState)(``),[B,U]=(0,P.useState)(``),[W,G]=(0,P.useState)(!1),[K,q]=(0,P.useState)(null),[J,ye]=(0,P.useState)(H),[Y,be]=(0,P.useState)(!1),[X,Z]=(0,P.useState)([]),[xe,Q]=(0,P.useState)(null),{panelRef:Se,panelStyle:Ce,headerHandleProps:we,resizeHandles:Te,isFloating:Ee,guardBackdrop:De}=_();(0,P.useEffect)(()=>{ye(H)},[e.length]);function Oe(){be(e=>!e),Z([])}function ke(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=>S&&e.status!==S?!1:ve(N(e),E,j)),Ae=e.filter(e=>ve(N(e),R,B)).length;async function je(e){G(!0);try{let t={};e===`range`&&(R&&(t.from=new Date(ge(R)).toISOString()),B&&(t.to=new Date(_e(B)).toISOString()));let n=await fetch(`${l()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.ok){let e=await n.json();f.success(u(`recent.toast.cleared`,{count:e.deleted})),L(!1),z(``),U(``),a?.()}else f.error(u(`recent.toast.clearFailed`))}catch{f.error(u(`recent.toast.networkError`))}finally{G(!1)}}let Me=n?(0,F.jsxs)(`div`,{role:`alert`,"data-testid":`jobs-load-error`,className:`flex items-center gap-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:[(0,F.jsx)(h,{className:`h-4 w-4 shrink-0`}),(0,F.jsx)(`span`,{className:`flex-1`,children:u(`recent.loadFailed`)}),i&&(0,F.jsx)(C,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,onClick:i,disabled:t,children:u(`common:actions.retry`)})]}):null;return n&&e.length===0?(0,F.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:Me}):t&&e.length===0?(0,F.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,F.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,F.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,F.jsx)(ae,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,F.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:u(`recent.emptyTitle`)}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:u(`recent.emptyDescription`)})]}):(0,F.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[Me,(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>w(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${S===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:u(`recent.filterAll`,{count:e.length})}),ue.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,F.jsx)(`button`,{type:`button`,onClick:()=>w(S===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${S===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:u(`recent.filterStatus`,{status:u(`statusName.${t}`),count:n})},t)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`input`,{type:`date`,value:E,onChange:e=>k(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:u(`recent.fromDate`)}),(0,F.jsx)(`input`,{type:`date`,value:j,onChange:e=>M(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:u(`recent.toDate`)}),(E||j)&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>{k(``),M(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:u(`recent.clear`)}),(0,F.jsxs)(T,{children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.jsx)(C,{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:Oe,children:(0,F.jsx)(ce,{className:`w-3.5 h-3.5`})})}),(0,F.jsx)(O,{children:u(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,F.jsxs)(T,{children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.jsx)(C,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>L(!0),children:(0,F.jsx)(m,{className:`w-3.5 h-3.5`})})}),(0,F.jsx)(O,{children:u(`recent.clearJobs`)})]})]})]}),Y&&(0,F.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,F.jsxs)(`span`,{children:[X.length===0&&u(`recent.selectTwoToCompare`),X.length===1&&u(`recent.selectOneMore`),X.length===2&&u(`recent.readyToCompare`)]}),X.length===2&&(0,F.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:u(`recent.compareAction`)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,F.jsx)(`span`,{className:`w-14`,children:u(`recent.colStatus`)}),(0,F.jsx)(`span`,{className:`flex-1 min-w-0`,children:u(`recent.colCommand`)}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,F.jsx)(`span`,{className:`w-14 text-right`,children:u(`recent.colDuration`)}),(0,F.jsx)(`span`,{className:`w-12 text-right`,children:u(`recent.colTokens`)}),(0,F.jsx)(`span`,{className:`w-12 text-right`,children:u(`recent.colCost`)}),(0,F.jsx)(`span`,{className:`w-20 text-right`,children:u(`recent.colStarted`)})]})]}),(0,F.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let t=V[e.status]??V.queued,n=fe(e.total_cost_usd),r=pe(e.started_at,e.finished_at),i=me((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),a=e.id.startsWith(`proposal:`),s=a?e.id.replace(`proposal:`,``):null,c=X.includes(e.id),l=Y&&!a&&X.length===2&&!c,d=()=>{if(Y&&!a){ke(e.id);return}a&&s?o?.(s):p(`/jobs/${e.id}`)};return(0,F.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${c?`bg-accent/70 ring-1 ring-border`:l?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:d,onKeyDown:e=>{e.target===e.currentTarget&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),d()))},children:[(0,F.jsxs)(T,{children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.jsx)(`div`,{children:(0,F.jsx)(se,{variant:t.variant,children:u(t.labelKey)})})}),(0,F.jsx)(O,{children:u(t.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,F.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${de[e.priority].className}`,children:u(de[e.priority].labelKey)}),e.profile_name&&(0,F.jsxs)(T,{children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.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,F.jsx)(O,{children:u(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,F.jsxs)(T,{children:[(0,F.jsx)(D,{asChild:!0,children:(0,F.jsx)(oe,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,F.jsxs)(O,{children:[u(`recent.pipelinePart`),e.depends_on_job_id&&` ${u(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,F.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:A(e.command,ie)})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,F.jsx)(`span`,{className:`w-14 text-right`,children:r??`—`}),(0,F.jsx)(`span`,{className:`w-12 text-right`,children:i?`${i}`:`—`}),(0,F.jsx)(`span`,{className:`w-12 text-right`,children:n??`—`}),(0,F.jsx)(`span`,{className:`w-20 text-right`,children:e.status===`queued`?`—`:he(e.started_at)}),a&&s&&(0,F.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:u(`recent.deleteProposal`),children:(0,F.jsx)(m,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,F.jsx)(`div`,{className:`pt-1 text-center`,children:(0,F.jsx)(`button`,{type:`button`,onClick:()=>ye(e=>e+H),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:u(`recent.loadMore`,{count:$.length-J})})}),I&&(0,F.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:De(()=>L(!1)),children:[(0,F.jsxs)(`div`,{ref:Se,className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),style:Ce,children:[(0,F.jsxs)(`div`,{...we,className:Ee?`cursor-grab active:cursor-grabbing`:void 0,children:[(0,F.jsx)(`h3`,{className:`text-sm font-semibold`,children:u(`recent.clearModal.title`)}),(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:u(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,F.jsx)(C,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:W,onClick:()=>je(`all`),children:u(`recent.clearModal.clearAll`,{count:e.length})}),(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u(`recent.clearModal.orByRange`)}),(0,F.jsxs)(`div`,{className:`flex gap-2`,children:[(0,F.jsx)(`input`,{type:`date`,value:R,onChange:e=>z(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:u(`recent.clearModal.fromPlaceholder`)}),(0,F.jsx)(`input`,{type:`date`,value:B,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:u(`recent.clearModal.toPlaceholder`)})]}),(0,F.jsx)(C,{variant:`outline`,size:`sm`,className:`w-full`,disabled:W||!R&&!B,onClick:()=>je(`range`),children:R||B?u(`recent.clearModal.clearInRange`,{count:Ae}):u(`recent.clearModal.clearRange`)})]}),(0,F.jsx)(C,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>L(!1),children:u(`common:actions.cancel`)})]}),(0,F.jsx)(v,{handles:Te})]}),(0,F.jsx)(ne,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,F.jsxs)(te,{className:`max-w-sm`,children:[(0,F.jsxs)(ee,{children:[(0,F.jsx)(x,{children:u(`recent.deleteProposalConfirm.title`)}),(0,F.jsx)(b,{children:u(`recent.deleteProposalConfirm.description`)})]}),(0,F.jsxs)(y,{children:[(0,F.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:u(`common:actions.cancel`)}),(0,F.jsx)(C,{variant:`destructive`,size:`sm`,onClick:()=>{K&&c?.(K),q(null)},children:u(`common:actions.delete`)})]})]})}),xe&&(0,F.jsx)(le,{jobIds:xe,onClose:()=>{Q(null),Z([]),be(!1)}})]})}var W={input:`page.proposal.status.input`,exploring:`page.proposal.status.exploring`,review:`page.proposal.status.review`,refining:`page.proposal.status.refining`,creating_issue:`page.proposal.status.creatingIssue`,created:`page.proposal.status.created`,cancelled:`page.proposal.status.cancelled`};function G(e){return`${i}/api/projects/${encodeURIComponent(e)}`}function K(){let[e,t]=(0,P.useState)(!1),{registerHandler:n,unregisterHandler:r}=o(),{t:i}=s(`jobs`),{activeProjectId:a}=d(),{recentJobs:c}=k(a),{data:p,isFirstLoad:m,isLoading:h,error:g,refresh:_}=u({namespace:`jobs`,projectId:a,initialValue:c,fetcher:async({projectId:e,signal:t})=>{let n=await fetch(`${G(e)}/jobs?limit=10`,{signal:t});if(!n.ok)throw Error(`Failed to fetch jobs: ${n.status}`);return(await n.json()).jobs},pollInterval:1e4});(0,P.useEffect)(()=>(n(`jobs-runtime-continuation`,e=>{let t=e;t.type===`runtime.continuation`&&t.projectId===a&&_()}),()=>r(`jobs-runtime-continuation`)),[a,_,n,r]);let{data:v,isFirstLoad:b,isLoading:S,error:w,refresh:T}=u({namespace:`proposals`,projectId:a,initialValue:[],fetcher:async({projectId:e,signal:t})=>{let n=await fetch(`${G(e)}/propose?limit=10`,{signal:t});if(!n.ok)throw Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals},pollInterval:1e4}),ae={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},D=v.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,enqueued_at:e.created_at,status:ae[e.status]??`queued`})),oe=[...p,...D].sort((e,t)=>(M(N(t))?.getTime()??0)-(M(N(e))?.getTime()??0)),[O,A]=(0,P.useState)(null),ce=(0,P.useCallback)(async e=>{try{let t=await fetch(`${l()}/propose/${e}`);if(!t.ok)return;let n=await t.json();A(n.proposal)}catch{}},[]),I=(0,P.useCallback)(async e=>{try{(await fetch(`${l()}/propose/${e}`,{method:`DELETE`})).ok&&(f.success(i(`page.proposalDeleted`)),await T())}catch{}},[T,i]);return(0,F.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,F.jsx)(`h1`,{className:`text-sm font-semibold`,children:i(`page.title`)}),(0,F.jsx)(j,{baseUrl:`${l()}/jobs/export`,label:i(`page.exportJobs`)})]}),a&&(0,F.jsxs)(`details`,{className:`mb-4 rounded-lg border border-border`,onToggle:e=>t(e.currentTarget.open),children:[(0,F.jsx)(`summary`,{className:`cursor-pointer p-3 text-sm`,children:i(`agentRuntime:runs.title`)}),e&&(0,F.jsx)(E,{projectId:a})]}),(0,F.jsx)(U,{jobs:oe,isLoading:m||b||h||S,error:g??w,onRetry:()=>{Promise.all([_(),T()])},onJobsCleared:_,onProposalClick:ce,onProposalDelete:I}),(0,F.jsx)(ne,{open:O!==null,onOpenChange:e=>!e&&A(null),children:(0,F.jsx)(te,{className:`max-w-3xl glass-card`,children:O&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(ee,{children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(x,{className:`flex-1 min-w-0`,children:i(`page.proposal.title`)}),(0,F.jsx)(se,{variant:O.status===`created`?`success`:O.status===`cancelled`?`destructive`:`secondary`,children:i(W[O.status]??`page.proposal.status.unknown`,{status:O.status})})]})}),(0,F.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:O.idea}),O.result_markdown?(0,F.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,F.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,F.jsx)(re,{remarkPlugins:[ie],children:O.result_markdown})})}):(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:i(`page.proposal.noContent`)}),O.issue_url&&(0,F.jsxs)(`div`,{className:`text-xs`,children:[i(`page.proposal.githubIssue`),` `,(0,F.jsx)(`a`,{href:O.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:O.issue_url})]}),(0,F.jsxs)(y,{children:[(0,F.jsx)(C,{variant:`destructive`,size:`sm`,onClick:()=>{I(O.id),A(null)},children:i(`common:actions.delete`)}),(0,F.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>A(null),children:i(`common:actions.close`)})]})]})})})]})}export{K as default};
|