specrails-desktop 2.32.0 → 2.34.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/client/dist/assets/{ActivityFeedPage-DvnFkjVG.js → ActivityFeedPage-DIDxNsDj.js} +1 -1
- package/client/dist/assets/{AgentBrowserCapture-CBjcliD7.js → AgentBrowserCapture-7pJ2G5VY.js} +1 -1
- package/client/dist/assets/AgentModeAnalyticsPane-BSSyTnTM.js +2 -0
- package/client/dist/assets/{AgentModeCodePane-CokuFVdV.js → AgentModeCodePane-DzW6gvDw.js} +2 -2
- package/client/dist/assets/{AgentModeJobsPane-rf_DlWNo.js → AgentModeJobsPane-9wJff15f.js} +1 -1
- package/client/dist/assets/AgentsPage-CIA67psb.js +87 -0
- package/client/dist/assets/AnalyticsPage-C0LwYELz.js +1 -0
- package/client/dist/assets/CodePage-RtKvHmAO.js +2 -0
- package/client/dist/assets/{DesktopAnalyticsPage-gBRVqiw6.js → DesktopAnalyticsPage-BU8Y_Ts1.js} +1 -1
- package/client/dist/assets/{DocsDialog-BzO5dg2B.js → DocsDialog-DIpoaGlQ.js} +1 -1
- package/client/dist/assets/{DocsPage-Db_uxr1j.js → DocsPage-ME47KZpK.js} +1 -1
- package/client/dist/assets/InteractiveJobComposer-BGjIe9R6.js +19 -0
- package/client/dist/assets/{JobDetailModal-DPHh2WOS.js → JobDetailModal-1UZkqH4I.js} +1 -1
- package/client/dist/assets/JobDetailPage-CN65sAf1.js +1 -0
- package/client/dist/assets/JobsPage-f-4dqys7.js +1 -0
- package/client/dist/assets/LoopBuilderPage-WeiofeL6.js +7 -0
- package/client/dist/assets/LoopPreviewModal-DDTnTyH0.js +1 -0
- package/client/dist/assets/LoopsPage-BVNchIex.js +1 -0
- package/client/dist/assets/MinimizedChatsContext-CHsu3NCX.js +1 -0
- package/client/dist/assets/PluginsPage-CdFzGEfQ.js +2 -0
- package/client/dist/assets/ProjectSettingsDialog-BkCXBQWk.js +1 -0
- package/client/dist/assets/TemplatePreviewModal-RDi0khFG.js +1 -0
- package/client/dist/assets/TicketDetailModal-MhJzrqbi.js +14 -0
- package/client/dist/assets/{Trans-B2i5HVcM.js → Trans-CTqw6rr9.js} +1 -1
- package/client/dist/assets/{addspec-DhmnXER8.js → addspec-A1lDQa4M.js} +1 -1
- package/client/dist/assets/{addspec-BRlk8jON.js → addspec-BHZd0N5F.js} +1 -1
- package/client/dist/assets/{addspec-CHW9xf_X.js → addspec-BPpZ_olp.js} +1 -1
- package/client/dist/assets/{addspec-Di41DpYV.js → addspec-B_TPJt-R.js} +1 -1
- package/client/dist/assets/{addspec-4WmLJmBG.js → addspec-CLYLvaVP.js} +1 -1
- package/client/dist/assets/{addspec-C7XRejU4.js → addspec-CQBjzt24.js} +1 -1
- package/client/dist/assets/{addspec-x3mizDxc.js → addspec-D2YIQ0GU.js} +1 -1
- package/client/dist/assets/{addspec-DTmRrWrF.js → addspec-iFdQ6D99.js} +1 -1
- package/client/dist/assets/agent-Bd-q3Wqp.js +1 -0
- package/client/dist/assets/agent-BlvdW4Hv.js +1 -0
- package/client/dist/assets/agent-C-KQhxeM.js +1 -0
- package/client/dist/assets/agent-Ca15w5eu.js +1 -0
- package/client/dist/assets/agent-D6fKaoMd.js +1 -0
- package/client/dist/assets/agent-HFMYMTbB.js +1 -0
- package/client/dist/assets/agent-QIEbkBjg.js +1 -0
- package/client/dist/assets/agent-mTCsAbCl.js +1 -0
- package/client/dist/assets/agentstudio-BNUth0uj.js +1 -0
- package/client/dist/assets/agentstudio-BNdB5hkr.js +1 -0
- package/client/dist/assets/agentstudio-C7-bt8FO.js +1 -0
- package/client/dist/assets/agentstudio-C8uNchpV.js +1 -0
- package/client/dist/assets/agentstudio-CKabyMlg.js +1 -0
- package/client/dist/assets/agentstudio-CN2pokQu.js +1 -0
- package/client/dist/assets/agentstudio-DR7doNBV.js +1 -0
- package/client/dist/assets/agentstudio-y2dVDXeM.js +1 -0
- package/client/dist/assets/{analytics-C9RaQcE3.js → analytics-47pYygtV.js} +1 -1
- package/client/dist/assets/{analytics-B8Qtptbl.js → analytics-B0vt1g5U.js} +1 -1
- package/client/dist/assets/analytics-BMzCvrCU.js +1 -0
- package/client/dist/assets/{analytics-BPptRY4f.js → analytics-BlFN3Zwx.js} +1 -1
- package/client/dist/assets/{analytics-BxDGOIwf.js → analytics-CZYzL-nR.js} +1 -1
- package/client/dist/assets/{analytics-D_OZdQ9O.js → analytics-DAsb9MJ8.js} +1 -1
- package/client/dist/assets/{analytics-CJIwqrEl.js → analytics-FXQlQ2Yt.js} +1 -1
- package/client/dist/assets/{analytics-We6lUMI8.js → analytics-RnFCNkah.js} +1 -1
- package/client/dist/assets/{builder-CWYPw7Cw.js → builder-0IWtosUm.js} +1 -1
- package/client/dist/assets/{builder-CX1437hF.js → builder-Bf2N6XWn.js} +1 -1
- package/client/dist/assets/{builder-BiUG9Z5K.js → builder-BnqaaBkT.js} +1 -1
- package/client/dist/assets/{builder-CGRz_-zP.js → builder-BxxfGgAO.js} +1 -1
- package/client/dist/assets/{builder-DwDexYRE.js → builder-C5IIgWsq.js} +1 -1
- package/client/dist/assets/builder-CHuahItu.js +1 -0
- package/client/dist/assets/{builder-Cowk9jtL.js → builder-CjWosXL_.js} +1 -1
- package/client/dist/assets/{builder-3bygQtZi.js → builder-CpCIOoKj.js} +1 -1
- package/client/dist/assets/dashboard-BHRqsGCV.js +1 -0
- package/client/dist/assets/dashboard-Bfr90vOl.js +1 -0
- package/client/dist/assets/dashboard-CTsM8x3m.js +1 -0
- package/client/dist/assets/dashboard-CqC6wX0h.js +1 -0
- package/client/dist/assets/dashboard-CuZtAszc.js +1 -0
- package/client/dist/assets/dashboard-DAcqIc-n.js +1 -0
- package/client/dist/assets/dashboard-DekiV-86.js +1 -0
- package/client/dist/assets/dashboard-DoDczc5S.js +1 -0
- package/client/dist/assets/{dist-js-CkTZKBF9.js → dist-js-BmsFWRly.js} +1 -1
- package/client/dist/assets/{dist-js-ClShHcGa.js → dist-js-J5W_N5ng.js} +1 -1
- package/client/dist/assets/{formatDistanceToNow-BjGwPf6I.js → formatDistanceToNow-BOuXgebD.js} +1 -1
- package/client/dist/assets/{getTimezoneOffsetInMilliseconds-CSCbUI4W.js → getTimezoneOffsetInMilliseconds-EjGOpn4b.js} +1 -1
- package/client/dist/assets/{i18n-Ch-Db_x2.js → i18n-nJQvD5zJ.js} +2 -2
- package/client/dist/assets/index-C_sdsSZt.js +63 -0
- package/client/dist/assets/index-DCN5QbDm.css +2 -0
- package/client/dist/assets/{jira-BySfUuQZ.js → jira-BNZu8f9O.js} +1 -1
- package/client/dist/assets/{jira-gAvOyije.js → jira-BOoaUXbb.js} +1 -1
- package/client/dist/assets/{jira-pRaL7JQo.js → jira-BYVN4L2u.js} +1 -1
- package/client/dist/assets/jira-CKJg3HZd.js +1 -0
- package/client/dist/assets/{jira-Byw2C0F8.js → jira-DDDsZ4ub.js} +1 -1
- package/client/dist/assets/{jira-D38Gj7AT.js → jira-DXwYjVE4.js} +1 -1
- package/client/dist/assets/{jira-D11gPhxz.js → jira-Dn6U2nRW.js} +1 -1
- package/client/dist/assets/{jira-api-BgFIr8eD.js → jira-api-Bhixwn-d.js} +1 -1
- package/client/dist/assets/{jira-CNeYi06w.js → jira-j7hVolR5.js} +1 -1
- package/client/dist/assets/nav-ApJVg3xu.js +1 -0
- package/client/dist/assets/nav-BKNky1Bg.js +1 -0
- package/client/dist/assets/nav-C6vWWKYx.js +1 -0
- package/client/dist/assets/nav-CXJ6Aw89.js +1 -0
- package/client/dist/assets/nav-CsmFBIDf.js +1 -0
- package/client/dist/assets/nav-DjkmQJjd.js +1 -0
- package/client/dist/assets/nav-iwjCg5FR.js +1 -0
- package/client/dist/assets/nav-pYuXq7sf.js +1 -0
- package/client/dist/assets/{provider-capabilities-BvoExILy.js → provider-capabilities-Doej9lfa.js} +1 -1
- package/client/dist/assets/setup-3jWaoVUO.js +1 -0
- package/client/dist/assets/setup-BjgRneb2.js +1 -0
- package/client/dist/assets/setup-BzFIjv-f.js +1 -0
- package/client/dist/assets/setup-C4VfQsxE.js +1 -0
- package/client/dist/assets/setup-DfUkpDbN.js +1 -0
- package/client/dist/assets/setup-ECe90Pmu.js +1 -0
- package/client/dist/assets/setup-dlqC4Jmm.js +1 -0
- package/client/dist/assets/setup-jwfLMiM2.js +1 -0
- package/client/dist/assets/{spending-Dq43JYmD.js → spending-BpYPsevQ.js} +1 -1
- package/client/dist/assets/tickets-B4rjuSYi.js +1 -0
- package/client/dist/assets/tickets-Bc71ce1C.js +1 -0
- package/client/dist/assets/tickets-CLg7VTJ8.js +1 -0
- package/client/dist/assets/tickets-CP9U1GJt.js +1 -0
- package/client/dist/assets/tickets-CZNBiHbq.js +1 -0
- package/client/dist/assets/tickets-DlX2mEkD.js +1 -0
- package/client/dist/assets/tickets-W6pBmbrX.js +1 -0
- package/client/dist/assets/tickets-_yKvCt4Y.js +1 -0
- package/client/dist/assets/{useBrowserCaptureSession-TTO8vHtd.js → useBrowserCaptureSession-BBXBN0Na.js} +1 -1
- package/client/dist/assets/useDesktop-B6Du2N83.js +1 -0
- package/client/dist/assets/{useSharedWebSocket-DaPh7QBL.js → useSharedWebSocket-DK96ctb7.js} +1 -1
- package/client/dist/index.html +24 -24
- package/docs/guide/de/getting-started/3-adding-your-first-project.md +13 -32
- package/docs/guide/de/integrations/1-ai-providers.md +27 -16
- package/docs/guide/en/getting-started/3-adding-your-first-project.md +8 -27
- package/docs/guide/en/integrations/1-ai-providers.md +21 -18
- package/docs/guide/es/getting-started/3-adding-your-first-project.md +12 -31
- package/docs/guide/es/integrations/1-ai-providers.md +24 -16
- package/docs/guide/fr/getting-started/3-adding-your-first-project.md +15 -34
- package/docs/guide/fr/integrations/1-ai-providers.md +25 -16
- package/docs/guide/it/getting-started/3-adding-your-first-project.md +16 -35
- package/docs/guide/it/integrations/1-ai-providers.md +25 -16
- package/docs/guide/ja/getting-started/3-adding-your-first-project.md +16 -35
- package/docs/guide/ja/integrations/1-ai-providers.md +7 -12
- package/docs/guide/pt/getting-started/3-adding-your-first-project.md +15 -34
- package/docs/guide/pt/integrations/1-ai-providers.md +24 -16
- package/docs/guide/zh/getting-started/3-adding-your-first-project.md +18 -37
- package/docs/guide/zh/integrations/1-ai-providers.md +7 -12
- package/docs/internals/project-builder.md +11 -6
- package/package.json +1 -1
- package/server/dist/ai-invocations.js +35 -0
- package/server/dist/blueprint-commit.js +1 -1
- package/server/dist/desktop-db.js +22 -1
- package/server/dist/desktop-router.js +132 -43
- package/server/dist/framework-reseed.js +144 -0
- package/server/dist/index.js +41 -2
- package/server/dist/jira/jira-sync-manager.js +49 -2
- package/server/dist/jira-router.js +21 -0
- package/server/dist/job-phase-breakdown.js +132 -0
- package/server/dist/legacy-migration.js +395 -0
- package/server/dist/loop-executors.js +5 -1
- package/server/dist/offline-assemble.js +32 -4
- package/server/dist/pr-body.js +13 -0
- package/server/dist/project-router-jobs.js +16 -0
- package/server/dist/project-router-spending.js +11 -1
- package/server/dist/provider-detection.js +222 -0
- package/server/dist/provider-selection.js +71 -19
- package/server/dist/queue-manager.js +4 -0
- package/server/dist/rail-pr-decision.js +10 -0
- package/server/dist/rails-router.js +11 -0
- package/server/dist/rails-store.js +5 -1
- package/server/dist/repo-map.js +293 -0
- package/server/dist/setup-manager.js +57 -0
- package/server/dist/spending.js +45 -0
- package/client/dist/assets/AgentsPage-B648IzGI.js +0 -87
- package/client/dist/assets/AnalyticsPage-0rBoULPX.js +0 -1
- package/client/dist/assets/CodePage-ju302Vl7.js +0 -2
- package/client/dist/assets/InteractiveJobComposer-_jmsE_Az.js +0 -19
- package/client/dist/assets/JobDetailPage-7nwHyHGV.js +0 -1
- package/client/dist/assets/JobsPage-C_6YrcmE.js +0 -1
- package/client/dist/assets/LoopBuilderPage-DJ1UPDwL.js +0 -7
- package/client/dist/assets/LoopPreviewModal-12cUnljK.js +0 -1
- package/client/dist/assets/LoopsPage-CHYK0Xjr.js +0 -1
- package/client/dist/assets/MinimizedChatsContext-Gt6KQySM.js +0 -1
- package/client/dist/assets/PluginsPage-E59oQmwc.js +0 -2
- package/client/dist/assets/ProjectSettingsDialog-DQTLQ7ie.js +0 -1
- package/client/dist/assets/TemplatePreviewModal-nXUcDgfk.js +0 -1
- package/client/dist/assets/TicketDetailModal-C-tHW-2s.js +0 -14
- package/client/dist/assets/agent-BKsuIgIT.js +0 -1
- package/client/dist/assets/agent-Bs9NilfI.js +0 -1
- package/client/dist/assets/agent-C23h684q.js +0 -1
- package/client/dist/assets/agent-CqEjy3Z2.js +0 -1
- package/client/dist/assets/agent-D5DZTks1.js +0 -1
- package/client/dist/assets/agent-DE8hUYPl.js +0 -1
- package/client/dist/assets/agent-DsTuJGSc.js +0 -1
- package/client/dist/assets/agent-DwZM05-x.js +0 -1
- package/client/dist/assets/agentstudio-8TQqBenW.js +0 -1
- package/client/dist/assets/agentstudio-B8Z_mmEX.js +0 -1
- package/client/dist/assets/agentstudio-BZR9YmLs.js +0 -1
- package/client/dist/assets/agentstudio-Bge9pAWb.js +0 -1
- package/client/dist/assets/agentstudio-Bz169Vzt.js +0 -1
- package/client/dist/assets/agentstudio-D6L2jpNi.js +0 -1
- package/client/dist/assets/agentstudio-K2-Z7CL0.js +0 -1
- package/client/dist/assets/agentstudio-Zmgzthv8.js +0 -1
- package/client/dist/assets/analytics-BHqUazhP.js +0 -1
- package/client/dist/assets/builder-skfnZ1uC.js +0 -1
- package/client/dist/assets/dashboard-BVq6kRJe.js +0 -1
- package/client/dist/assets/dashboard-BaKPPmLH.js +0 -1
- package/client/dist/assets/dashboard-Bm8e4zYG.js +0 -1
- package/client/dist/assets/dashboard-Bt6IesnM.js +0 -1
- package/client/dist/assets/dashboard-C_NQZle_.js +0 -1
- package/client/dist/assets/dashboard-CyZKoGoI.js +0 -1
- package/client/dist/assets/dashboard-HIUdUBQ0.js +0 -1
- package/client/dist/assets/dashboard-pm4Mr229.js +0 -1
- package/client/dist/assets/index-Bz0TeGRs.css +0 -2
- package/client/dist/assets/index-kCUcnT8G.js +0 -77
- package/client/dist/assets/jira-CmKWERE0.js +0 -1
- package/client/dist/assets/nav-BHDiSIVu.js +0 -1
- package/client/dist/assets/nav-CMiYAq4i.js +0 -1
- package/client/dist/assets/nav-CqS7NrDW.js +0 -1
- package/client/dist/assets/nav-D-0M7xfv.js +0 -1
- package/client/dist/assets/nav-D65O6u9I.js +0 -1
- package/client/dist/assets/nav-D_LKYvBr.js +0 -1
- package/client/dist/assets/nav-FDTJmU79.js +0 -1
- package/client/dist/assets/nav-VaB-C4k5.js +0 -1
- package/client/dist/assets/setup-BBiHEO7h.js +0 -1
- package/client/dist/assets/setup-BlTWhNIQ.js +0 -1
- package/client/dist/assets/setup-Bp2L_oiP.js +0 -1
- package/client/dist/assets/setup-CInYXp1-.js +0 -1
- package/client/dist/assets/setup-CYH3bP6K.js +0 -1
- package/client/dist/assets/setup-DwcQ921P.js +0 -1
- package/client/dist/assets/setup-PBLjuDSs.js +0 -1
- package/client/dist/assets/setup-bx6FtoBp.js +0 -1
- package/client/dist/assets/tickets-BL9r1G0e.js +0 -1
- package/client/dist/assets/tickets-B_NyHJ8f.js +0 -1
- package/client/dist/assets/tickets-BarF1wuG.js +0 -1
- package/client/dist/assets/tickets-CclVhpQA.js +0 -1
- package/client/dist/assets/tickets-CqqOHbli.js +0 -1
- package/client/dist/assets/tickets-DCkFSiqt.js +0 -1
- package/client/dist/assets/tickets-Djn3ccfT.js +0 -1
- package/client/dist/assets/tickets-MiHBPsy_.js +0 -1
- package/client/dist/assets/useDesktop-DUvS4fuP.js +0 -1
|
@@ -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{o as r}from"./i18n-nJQvD5zJ.js";import{n as i,t as a}from"./createLucideIcon-Bjbbp_KS.js";import{n as o}from"./dist-bVqfYmby.js";import{g as s,m as c}from"./useBrowserCaptureSession-BBXBN0Na.js";import{l}from"./MinimizedChatsContext-CHsu3NCX.js";import{t as u}from"./brain-DI9lHkKY.js";import{n as d}from"./external-link-BcU5EWZp.js";import{t as f}from"./chevron-right-CViMxucY.js";import{V as p}from"./TicketDetailModal-MhJzrqbi.js";import{t as m}from"./circle-x-CMYsN4ZH.js";import{t as h}from"./git-branch-BRM0F5GN.js";import{t as g}from"./loader-circle-DcygOQpC.js";import{t as _}from"./play-DNlrawbS.js";import{t as v}from"./search-Cq_gE3Ik.js";import{t as y}from"./x-CBMI9ejn.js";import{a as b}from"./auth-D_5bQv5W.js";import{r as x}from"./useSharedWebSocket-DK96ctb7.js";import{t as S}from"./api-B2M7CtDw.js";import{r as C}from"./useDesktop-B6Du2N83.js";import{t as w}from"./button-BUIIBQPT.js";import{t as T}from"./utils-BC4DHlz2.js";import{n as E,t as D}from"./lib-CGdyxIWg.js";import{$ as O,Dt as k,F as A,M as j,N as M,S as N,Z as P,a as F,c as ee,ht as te,it as I,o as ne,ot as L,s as R,v as re,wt as z,xt as ie}from"./index-C_sdsSZt.js";import{t as ae}from"./lib-C7Mhm-gT.js";var oe=a(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),se=a(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ce=a(`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`}]]),B=n();function le({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,B.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,B.jsxs)(`div`,{className:`flex items-center`,children:[(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,B.jsx)(ue,{state:i}),(0,B.jsx)(`span`,{className:T(`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,B.jsxs)(M,{side:`bottom`,className:`max-w-[200px]`,children:[(0,B.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,B.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),a!==null&&(0,B.jsx)(`div`,{className:T(`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 ue({state:e}){return(0,B.jsxs)(`div`,{className:T(`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,B.jsx)(g,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,B.jsx)(k,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,B.jsx)(m,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,B.jsx)(p,{className:`w-6 h-6 text-muted-foreground/20`})]})}var V=e(t(),1);function de(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 H=new Set;function U({ticketId:e,onOpen:t,children:n}){let{t:r}=i(`agent`),a=r(`refs.openTicket`,{id:e});return(0,B.jsx)(`button`,{type:`button`,"data-testid":`log-ticket-ref`,onClick:n=>{n.stopPropagation(),t(e)},title:a,"aria-label":a,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 fe(e){if(!e.includes(`#`))return null;let t=R(e,H);return t.some(e=>e.kind===`ticket`)?t:null}function pe(e,t){let n=fe(e);return n?n.map((e,n)=>e.kind===`ticket`?(0,B.jsx)(U,{ticketId:e.ticketId,onOpen:t,children:e.label},n):(0,B.jsx)(V.Fragment,{children:e.kind===`text`?e.text:e.label},n)):e}var me=new Set([`code`,`inlineCode`,`link`,`linkReference`,`image`,`imageReference`,`definition`,`html`]);function he(e){return e.kind===`ticket`?{type:`link`,url:F({kind:`ticket`,ticketId:e.ticketId}),children:[{type:`text`,value:e.label}]}:{type:`text`,value:e.kind===`text`?e.text:e.label}}function W(e){let t=e.children;if(t)for(let e=t.length-1;e>=0;e--){let n=t[e];if(!me.has(n.type))if(n.type===`text`&&typeof n.value==`string`){let r=R(n.value,H);r.some(e=>e.kind===`ticket`)&&t.splice(e,1,...r.map(he))}else W(n)}}function ge(){return e=>W(e)}function G(e){let{activeProjectId:t}=C(),{openRef:n}=ee(),r=e??t??void 0;return(0,V.useMemo)(()=>r?e=>{n(r,{kind:`ticket`,ticketId:e})}:void 0,[r,n])}function _e(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}:de(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 ve(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 ye(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 be(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 xe({events:e,isLoading:t,projectId:n}){let{t:r,i18n:a}=i(`jobs`),[s,c]=(0,V.useState)(``),[u,d]=(0,V.useState)(!0),[f,p]=(0,V.useState)(new Set),m=(0,V.useRef)(null),h=(0,V.useRef)(null),g=G(n),{processedLines:_,groups:y,totalLines:b}=(0,V.useMemo)(()=>{let t=ve(ye(e.map((e,t)=>_e(e,t)).filter(e=>e!==null)));return{processedLines:t,groups:be(t),totalLines:t.length}},[e,a.language]),x=(0,V.useMemo)(()=>{if(!s)return b;let e=s.toLowerCase();return _.filter(t=>t.content.toLowerCase().includes(e)).length},[s,_,b]),S=(0,V.useCallback)(()=>{let e=h.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,V.useEffect)(()=>{u&&S()},[e.length,u,S]);function C(){let e=h.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight<50;d(t)}function T(e){p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.loading`)})}):b===0?(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r(`logViewer.empty`)})}):(0,B.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,B.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,B.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,B.jsx)(v,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,B.jsx)(re,{placeholder:r(`logViewer.filterPlaceholder`),value:s,onChange:e=>c(e.target.value),className:`pl-7 h-7`})]}),(0,B.jsx)(w,{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(()=>{o.success(r(`logViewer.copySuccess`))}).catch(()=>{o.error(r(`logViewer.copyFailed`))})},children:(0,B.jsx)(z,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:r(`logViewer.lineCount`,{filtered:x,total:b})})]}),(0,B.jsxs)(`div`,{ref:h,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:C,children:[y.map(e=>(0,B.jsx)(Se,{group:e,filter:s,collapsed:f.has(e.key),onToggle:()=>T(e.key),onOpenTicket:g},e.key)),(0,B.jsx)(`div`,{ref:m})]}),!u&&(0,B.jsxs)(w,{size:`sm`,variant:`secondary`,onClick:()=>{d(!0),S()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,B.jsx)(l,{className:`w-3 h-3`}),r(`logViewer.jumpToBottom`)]})]})}var Se=(0,V.memo)(function({group:e,filter:t,collapsed:n,onToggle:r,onOpenTicket:a}){let{t:o}=i(`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,B.jsx)(`div`,{children:s.map((e,t)=>(0,B.jsx)(K,{line:e,even:t%2==0,onOpenTicket:a},e.id))});let c=e.header.content;return(0,B.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:r,className:T(`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,B.jsx)(f,{className:T(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,B.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:c}),e.header.timestamp&&(0,B.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,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:o(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,B.jsx)(`div`,{className:`bg-muted/5`,children:s.length===0?(0,B.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:o(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):s.map((e,t)=>(0,B.jsx)(K,{line:e,even:t%2==0,onOpenTicket:a},e.id))})]})}),Ce=[ae],we=[D],Te=[D,ge],K=(0,V.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,V.useMemo)(()=>l&&n?pe(e.content,n):e.content,[l,n,e.content]),d=r&&n?Te:we,f=(0,V.useMemo)(()=>n?{a:({href:e,children:t})=>{let r=ne(e);return r?.kind===`ticket`?(0,B.jsx)(U,{ticketId:r.ticketId,onOpen:n,children:t}):(0,B.jsx)(`a`,{href:e,children:t})}}:void 0,[n]);return(0,B.jsxs)(`div`,{className:T(`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,B.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,B.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,B.jsx)(E,{remarkPlugins:d,rehypePlugins:Ce,components:f,children:e.content})}):(0,B.jsx)(`span`,{className:T(`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})]})});function q(e){try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}var Ee=/^\s*━+\s*Step\s+\d+\s*·/,De=/\s*\(iteration\s+\d+\)\s*$/i;function J(e){return e.replace(/^[\s\uFE0F\p{Extended_Pictographic}]+/u,``).trim()||e.trim()}function Y(e){let t=J(e.title);return e.iteration==null?t:t.replace(De,``)}function Oe(e){return e.meta.nodeId??`${e.meta.kind}::${J(e.meta.title).replace(De,``)}`}function ke(e){let t=null,n=0,r=[[]],i=[];for(let a=0;a<e.length;a++){let o=e[a];if(o.event_type===`loop_graph`){let e=q(o.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(o.event_type===`loop_step`){let e=q(o.payload);if(!e||typeof e.index!=`number`)continue;let t=typeof e.iteration==`number`?e.iteration:null;t!=null&&t>n&&(n=t),i.push({meta:{index:e.index,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}),r.push([]);continue}if(o.event_type===`loop_step_end`){let e=q(o.payload);if(!e||typeof e.index!=`number`)continue;for(let t=i.length-1;t>=0;t--)if(i[t].meta.index===e.index){i[t].end={index:e.index,nodeId:typeof e.nodeId==`string`?e.nodeId:null,status: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};break}continue}let s=i.length>0,c=_e(o,a);if(c&&!(s&&Ee.test(c.content))&&r[r.length-1].push(c),s){let e=N(o);e.step&&e.actionKey&&(i[i.length-1].lastActivity={actionKey:e.actionKey,actionArg:e.actionArg})}}let a=e=>ve(ye(e)),o=a(r[0]),s=i.map((e,t)=>({key:`step-${t}-${e.meta.index}`,meta:e.meta,lines:a(r[t+1]),end:e.end,lastActivity:e.lastActivity})),c=o.length+s.reduce((e,t)=>e+t.lines.length,0);return{graphMeta:t,setup:o,segments:s,maxIteration:n,totalLines:c}}function Ae(e,t){return e.end?e.end.status:t.isLast?t.jobSettled?`interrupted`:`running`:`unknown`}function je(e){return e===`continue`?0:e===`stop`?2:1}function Me(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)=>je(e.branch)-je(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 X(e){let t=e.data?.label;return typeof t==`string`&&t.trim()?t.trim():null}function Ne(e,t){let n=e.segments.length-1,r=new Map,i=new Map;e.segments.forEach((e,t)=>{let n=Oe(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=Ae(e.seg,{isLast:e.idx===n,jobSettled:t.jobSettled});return r===`unknown`?`ok`:r};if(e.graphMeta)return Me(e.graphMeta.graph).map(e=>{if(e.type===`start`)return{key:e.id,kind:`start`,label:X(e),state:`ok`,latestSegmentKey:null};if(e.type===`end`)return{key:e.id,kind:`end`,label:X(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:X(e)??Y(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:X(e),state:`pending`,latestSegmentKey:null}});let o=[],s=new Map;return e.segments.forEach((e,t)=>{let n=Oe(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:Y(e.meta)||null,state:a(r),decision:l,latestSegmentKey:e.key})}),o}function Pe(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`}var Fe={start:_,"ai-step":u,shell:P,decider:h,condition:h,end:ie},Ie=O,Le={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`},Re={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 Z(e){return Fe[e]??Ie}function ze({chips:e,iteration:t,onChipClick:n,variant:r}){let{t:a}=i(`jobs`);return e.length===0&&!t?null:(0,B.jsxs)(`div`,{"data-testid":`loop-overview-strip`,role:`list`,"aria-label":a(`loopExplorer.stepMapAria`),className:T(`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=Z(e.kind),i=Le[e.kind]??`text-foreground`,o=Re[e.kind]??`border-border/40`,l=e.label??a(`loops:builder.nodes.${e.kind}`,{defaultValue:e.kind}),u=e.latestSegmentKey!=null;return(0,B.jsxs)(V.Fragment,{children:[t>0&&(0,B.jsx)(f,{className:`w-3 h-3 text-muted-foreground/30 shrink-0`}),(0,B.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":`${l} — ${e.state}`,disabled:!u,onClick:()=>e.latestSegmentKey&&n(e.latestSegmentKey),className:T(`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`&&`border-dashed border-accent-warning/50`,u?`cursor-pointer hover:bg-surface/70`:`cursor-default`),children:[e.state===`running`&&(0,B.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,B.jsx)(r,{className:T(`w-3 h-3 shrink-0`,i)}),(0,B.jsx)(`span`,{className:T(`max-w-[120px] truncate font-medium text-foreground/90`,e.state===`running`&&`title-shimmer`),children:l}),e.state===`ok`&&(0,B.jsx)(d,{className:`w-3 h-3 text-accent-success shrink-0`}),e.state===`failed`&&(0,B.jsx)(y,{className:`w-3 h-3 text-destructive shrink-0`}),e.decision===`continue`&&(0,B.jsx)(c,{className:`w-3 h-3 text-accent-highlight shrink-0`}),e.decision===`stop`&&(0,B.jsx)(s,{className:`w-3 h-3 text-accent-success shrink-0`})]})]},e.key)}),t&&(0,B.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,B.jsx)(L,{className:`w-3 h-3`}),t.limit==null?a(`loopExplorer.iterationBadge`,{count:t.current}):a(`loopExplorer.iteration`,{current:t.current,limit:t.limit})]})]})}var Be=(0,V.memo)(ze);function Ve({className:e}){return(0,B.jsxs)(`span`,{className:T(`relative flex h-2 w-2 shrink-0`,e),children:[(0,B.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,B.jsx)(`span`,{className:`relative inline-flex rounded-full h-2 w-2 bg-accent-primary`})]})}function He(e,t){if(!t)return e;let n=t.toLowerCase();return e.filter(e=>e.content.toLowerCase().includes(n))}function Ue(e,t,n,r){return e.length===0?(0,B.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,B.jsx)(K,{line:e,even:t%2==0,onOpenTicket:r},e.id))}function We({label:e,value:t,copyLabel:n}){let[r,i]=(0,V.useState)(!1),a=async()=>{try{await navigator.clipboard.writeText(t),i(!0),window.setTimeout(()=>i(!1),1500)}catch{}};return(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/50`,children:e}),(0,B.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,B.jsx)(d,{className:`w-2.5 h-2.5 text-accent-success`}):(0,B.jsx)(z,{className:`w-2.5 h-2.5`})})]}),(0,B.jsx)(`pre`,{className:`mt-0.5 text-[10px] font-mono leading-relaxed text-foreground/75 whitespace-pre-wrap break-words`,children:t})]})}function Ge({segment:e,status:t,collapsed:n,filter:r,onToggle:a,onCopy:o,setRef:s,onOpenTicket:c}){let{t:l}=i(`jobs`),{meta:u,lines:p,end:m,lastActivity:h}=e,g=Z(u.kind),_=Le[u.kind]??`text-foreground`,v=He(p,r),b=t===`running`,x=!!(u.template||u.command),[S,C]=(0,V.useState)(!1);return(0,B.jsxs)(`div`,{ref:t=>s(e.key,t),"data-testid":`loop-step-section`,"data-status":t,"data-step-index":u.index,className:T(`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===`interrupted`&&`border-dashed border-accent-warning/40`,(t===`ok`||t===`unknown`)&&`border-border/20`),children:[(0,B.jsxs)(`div`,{className:T(`flex items-stretch bg-primary/5 border-b`,t===`failed`?`border-destructive/20`:`border-primary/20`),children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>a(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,B.jsx)(f,{className:T(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,B.jsx)(`span`,{className:`text-[10px] font-mono tabular-nums text-muted-foreground/60 shrink-0 w-5 text-right`,children:u.index}),(0,B.jsx)(g,{className:T(`w-3.5 h-3.5 shrink-0`,_)}),(0,B.jsx)(`span`,{className:`text-[12px] font-semibold text-foreground leading-none truncate`,children:Y(u)}),u.iteration!=null&&u.iteration>=1&&(0,B.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})}),b&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 min-w-0 shrink-0 max-w-[40%]`,children:[(0,B.jsx)(Ve,{}),h&&(0,B.jsx)(`span`,{className:`title-shimmer text-[10px] truncate`,children:l(`statusPanel.activity.${h.actionKey}`,{arg:h.actionArg??``})})]}),t===`ok`&&(0,B.jsx)(d,{className:`w-3.5 h-3.5 text-accent-success shrink-0`}),t===`failed`&&(0,B.jsx)(y,{className:`w-3.5 h-3.5 text-destructive shrink-0`}),t===`interrupted`&&(0,B.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,B.jsx)(`span`,{className:`flex-1`}),m?.durationMs!=null&&(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/50 font-mono tabular-nums shrink-0`,children:Pe(m.durationMs)}),t===`failed`&&m?.exitCode!=null&&m.exitCode!==0&&(0,B.jsx)(`span`,{className:`text-[10px] text-destructive/70 font-mono shrink-0`,children:l(`activeJob.exitCode`,{code:m.exitCode})}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:l(`logViewer.phaseLines`,{count:p.length})})]}),x&&(0,B.jsx)(`button`,{type:`button`,onClick:()=>C(e=>!e),"aria-label":l(`loopExplorer.stepDetail`),"aria-expanded":S,title:l(`loopExplorer.stepDetail`),className:T(`px-2 flex items-center transition-colors cursor-pointer`,S?`text-foreground bg-primary/10`:`text-muted-foreground/40 hover:text-foreground hover:bg-primary/10`),children:(0,B.jsx)(te,{className:`w-3 h-3`})}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>o(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,B.jsx)(z,{className:`w-3 h-3`})})]}),S&&x&&(0,B.jsxs)(`div`,{"data-testid":`loop-step-detail`,className:T(`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,B.jsx)(We,{label:l(`loopExplorer.stepDetailTemplate`),value:u.template,copyLabel:l(`loopExplorer.copyCommand`)}),u.command&&(0,B.jsx)(We,{label:l(`loopExplorer.stepDetailCommand`),value:u.command,copyLabel:l(`loopExplorer.copyCommand`)})]}),!n&&(0,B.jsx)(`div`,{className:`bg-muted/5`,children:Ue(v,r,l,c)})]})}var Ke=(0,V.memo)(Ge,(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),Q=`__setup__`;function qe({lines:e,collapsed:t,filter:n,onToggle:r,setRef:a,onOpenTicket:o}){let{t:s}=i(`jobs`),c=He(e,n);return(0,B.jsxs)(`div`,{ref:e=>a(Q,e),"data-testid":`loop-setup-section`,className:`rounded-md overflow-hidden border border-border/20`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(Q),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,B.jsx)(f,{className:T(`w-3 h-3 text-muted-foreground/60 shrink-0 transition-transform duration-150`,!t&&`rotate-90`)}),(0,B.jsx)(_,{className:`w-3.5 h-3.5 text-accent-success/70 shrink-0`}),(0,B.jsx)(`span`,{className:`text-[11px] font-semibold text-muted-foreground leading-none uppercase tracking-wide`,children:s(`loopExplorer.setup`)}),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:s(`logViewer.phaseLines`,{count:e.length})})]}),!t&&(0,B.jsx)(`div`,{className:`bg-muted/5`,children:Ue(c,n,s,o)})]})}var Je=(0,V.memo)(qe,(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 $(){return(0,B.jsxs)(`span`,{className:`relative flex h-1.5 w-1.5 shrink-0`,children:[(0,B.jsx)(`span`,{className:`motion-safe:animate-ping absolute inline-flex h-full w-full rounded-full bg-accent-primary opacity-60`}),(0,B.jsx)(`span`,{className:`relative inline-flex rounded-full h-1.5 w-1.5 bg-accent-primary`})]})}function Ye({events:e,jobStatus:t,isLoading:n,variant:r=`page`,projectId:a}){let{t:s,i18n:c}=i(`jobs`),[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(`follow`),[p,m]=(0,V.useState)(new Set),h=(0,V.useRef)(null),g=(0,V.useRef)(new Map),_=G(a),y=(0,V.useMemo)(()=>ke(e),[e,c.language]),b=t!=null&&t!==`running`&&t!==`queued`,x=t===`running`,S=(0,V.useMemo)(()=>y.segments.map((e,t)=>Ae(e,{isLast:t===y.segments.length-1,jobSettled:b})),[y,b]),C=(0,V.useMemo)(()=>{let e=y.segments.map(e=>e.key);return y.setup.length>0&&e.push(Q),e},[y]),E=y.segments.length>0?y.segments[y.segments.length-1].key:Q,D=(0,V.useMemo)(()=>l?new Set(C):d===`follow`?new Set([E]):p,[l,d,E,p,C]),O=(0,V.useRef)(D);O.current=D;let k=(0,V.useRef)(y);k.current=y;let A=(0,V.useCallback)(e=>{let t=new Set(O.current);e?.(t),m(t),f(`manual`)},[]),j=(0,V.useCallback)(e=>{A(t=>{t.has(e)?t.delete(e):t.add(e)})},[A]),M=(0,V.useCallback)(e=>{A(t=>t.add(e)),requestAnimationFrame(()=>{g.current.get(e)?.scrollIntoView?.({behavior:`smooth`,block:`start`})})},[A]),N=(0,V.useCallback)(()=>{let e=h.current;e&&(e.scrollTop=e.scrollHeight)},[]),P=(0,V.useCallback)(()=>{f(`follow`),requestAnimationFrame(N)},[N]),F=(0,V.useCallback)(()=>{m(new Set(C)),f(`manual`)},[C]),ee=(0,V.useCallback)(()=>{m(new Set),f(`manual`)},[]);(0,V.useEffect)(()=>{d===`follow`&&!l&&N()},[y.totalLines,y.segments.length,d,l,N]);let te=(0,V.useCallback)(()=>{let e=h.current;!e||d!==`follow`||e.scrollHeight-e.scrollTop-e.clientHeight>80&&A()},[d,A]),I=(0,V.useCallback)((e,t)=>{t?g.current.set(e,t):g.current.delete(e)},[]),ne=(0,V.useCallback)(e=>{let t=k.current.segments.find(t=>t.key===e),n=e===`__setup__`?k.current.setup.map(e=>e.content).join(`
|
|
17
|
+
`):(t?.lines??[]).map(e=>e.content).join(`
|
|
18
|
+
`);navigator.clipboard.writeText(n).then(()=>o.success(s(`loopExplorer.copied`))).catch(()=>o.error(s(`logViewer.copyFailed`)))},[s]),L=(0,V.useCallback)(()=>{let e=k.current,t=e.setup.map(e=>e.content);for(let n of e.segments){t.push(`── Step ${n.meta.index} · ${J(n.meta.title)} ──`);for(let e of n.lines)t.push(e.content)}navigator.clipboard.writeText(t.join(`
|
|
19
|
+
`)).then(()=>o.success(s(`logViewer.copySuccess`))).catch(()=>o.error(s(`logViewer.copyFailed`)))},[s]),R=(0,V.useMemo)(()=>Ne(y,{jobSettled:b,jobFailed:t===`failed`}),[y,b,t]),ie=y.graphMeta?.iterationLimit??y.graphMeta?.graph.config.maxIterations??null,ae=y.maxIteration>0?{current:y.maxIteration,limit:ie}:null,ce=(0,V.useMemo)(()=>{if(!l)return y.totalLines;let e=l.toLowerCase(),t=y.setup.filter(t=>t.content.toLowerCase().includes(e)).length;for(let n of y.segments)t+=n.lines.filter(t=>t.content.toLowerCase().includes(e)).length;return t},[l,y]),le=y.segments[y.segments.length-1],ue=x&&(y.segments.length===0||le?.end!=null);return n?(0,B.jsx)(`div`,{className:`flex-1 flex items-center justify-center h-full`,children:(0,B.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:s(`logViewer.loading`)})}):y.totalLines===0&&y.segments.length===0?(0,B.jsx)(`div`,{"data-testid":`loop-step-explorer`,className:`flex-1 flex items-center justify-center h-full`,children:(0,B.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-2`,children:[x&&(0,B.jsx)($,{}),s(x?`loopExplorer.waiting`:`logViewer.empty`)]})}):(0,B.jsxs)(`div`,{"data-testid":`loop-step-explorer`,className:`relative flex flex-col h-full`,children:[(0,B.jsxs)(`div`,{className:T(`border-b border-border flex items-center gap-2`,r===`glass`?`px-3 py-1.5`:`px-4 py-2`),children:[(0,B.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,B.jsx)(v,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,B.jsx)(re,{placeholder:s(`logViewer.filterPlaceholder`),value:l,onChange:e=>u(e.target.value),className:`pl-7 h-7`})]}),(0,B.jsx)(w,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:F,"aria-label":s(`loopExplorer.expandAll`),title:s(`loopExplorer.expandAll`),children:(0,B.jsx)(se,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(w,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:ee,"aria-label":s(`loopExplorer.collapseAll`),title:s(`loopExplorer.collapseAll`),children:(0,B.jsx)(oe,{className:`w-3.5 h-3.5`})}),d===`follow`&&x&&(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[10px] text-accent-primary shrink-0`,children:[(0,B.jsx)($,{}),s(`loopExplorer.follow`)]}),(0,B.jsx)(`span`,{className:`flex-1`}),(0,B.jsx)(w,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:L,"aria-label":s(`logViewer.copySuccess`),children:(0,B.jsx)(z,{className:`w-3.5 h-3.5`})}),(0,B.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:s(`logViewer.lineCount`,{filtered:ce,total:y.totalLines})})]}),(0,B.jsx)(Be,{chips:R,iteration:ae,onChipClick:M,variant:r}),(0,B.jsxs)(`div`,{ref:h,onScroll:te,className:`flex-1 overflow-y-auto p-2 text-xs`,children:[y.setup.length>0&&(0,B.jsx)(Je,{lines:y.setup,collapsed:!D.has(`__setup__`),filter:l,onToggle:j,setRef:I,onOpenTicket:_}),y.segments.map((e,t)=>(0,B.jsx)(Ke,{segment:e,status:S[t],collapsed:!D.has(e.key),filter:l,onToggle:j,onCopy:ne,setRef:I,onOpenTicket:_},e.key)),ue&&(0,B.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,B.jsx)($,{}),s(`loopExplorer.waiting`)]})]}),d===`manual`&&x&&!l&&(0,B.jsxs)(`button`,{type:`button`,"data-testid":`resume-follow-pill`,onClick:P,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,B.jsx)($,{}),s(`loopExplorer.resumeFollow`)]})]})}function Xe(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 Ze(){try{return x()}catch{return null}}function Qe({jobId:e,projectId:t,settleMode:n,initialAcceptingTurns:r,kind:a=`job`,variant:s=`page`,onFinalized:c}){let{t:l}=i(`jobs`),u=n??`finalize`,d=()=>t?`${b}/api/projects/${t}`:S(),[f,p]=(0,V.useReducer)(Xe,{streaming:!1,queued:0,totals:null,accepting:r??!0,finalizing:!1}),[m,h]=(0,V.useState)(``),[_,v]=(0,V.useState)(!1),y=(0,V.useRef)(null);(0,V.useEffect)(()=>{r!==void 0&&p({type:`accepting`,accepting:r})},[r]);let x=(0,V.useRef)(c);x.current=c;let C=Ze(),E=(0,V.useId)();(0,V.useEffect)(()=>{if(!C)return;let t=`interactive-composer-${e}-${E}`;return C.registerHandler(t,t=>{let n=t;n.jobId===e&&(n.type===`job.turn_user`?p({type:`turn-user`,queued:!!n.queued}):n.type===`job.turn_done`?p({type:`turn-done`,totals:n.totals}):n.type===`job.finalized`?(p({type:`finalized`,totals:n.totals??null}),x.current?.()):n.type===`job.interactive`&&p({type:`accepting`,accepting:!!n.acceptingTurns}))}),()=>C.unregisterHandler(t)},[C,e,E]);let D=a===`loop-step`&&!f.accepting;async function O(){let t=m.trim();if(!(!t||_||D)){v(!0);try{let n=await fetch(`${d()}/jobs/${e}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:t})});if(n.ok)h(``),requestAnimationFrame(()=>y.current?.focus());else if(n.status===409&&a===`loop-step`)p({type:`blocked`});else{let e=await n.json().catch(()=>({}));o.error(l(`detail.toast.sendFailed`),{description:e.error})}}catch{o.error(l(`detail.toast.networkError`))}finally{v(!1)}}}async function N(){if(!f.finalizing){p({type:`finalize-request`});try{let t=await fetch(`${d()}/jobs/${e}/finalize`,{method:`POST`});if(t.ok)o.success(l(u===`finalize`?`detail.toast.finalizeScheduled`:a===`loop-step`?`detail.toast.wrapUpStepScheduled`:`detail.toast.wrapUpScheduled`));else if(t.status===409&&a===`loop-step`)p({type:`blocked`}),p({type:`finalize-reject`});else{let e=await t.json().catch(()=>({}));o.error(l(`detail.toast.finalizeFailed`),{description:e.error}),p({type:`finalize-reject`})}}catch{o.error(l(`detail.toast.networkError`)),p({type:`finalize-reject`})}}}let P=_||D||!m.trim(),F=l(`detail.interactive.working`);return(0,B.jsxs)(`div`,{"data-testid":`interactive-job-composer`,className:T(`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`,s===`glass`?`border-border/30 bg-surface/30`:`border-border/40 bg-surface/40`),children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[11px] text-muted-foreground`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[D?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(ce,{className:`h-3 w-3 motion-safe:animate-pulse`}),l(`detail.interactive.waitingForStepShort`)]}):f.streaming?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(g,{className:`h-3 w-3 animate-spin text-accent-primary`}),(0,B.jsxs)(`span`,{className:`relative`,children:[F,(0,B.jsx)(`span`,{"aria-hidden":!0,className:`title-shimmer pointer-events-none absolute inset-0`,children:F})]})]}):(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bg-accent-success motion-safe:animate-pulse`}),l(`detail.interactive.ready`)]}),f.queued>0&&(0,B.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:l(`detail.interactive.queued`,{count:f.queued})})]}),(0,B.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[f.totals&&(0,B.jsx)(`span`,{className:`tabular-nums`,children:l(`detail.interactive.liveTotals`,{turns:f.totals.num_turns,cost:f.totals.total_cost_usd.toFixed(4)})}),u===`finalize`?(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{asChild:!0,children:(0,B.jsxs)(w,{variant:`outline`,size:`sm`,onClick:()=>void N(),disabled:f.finalizing,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,B.jsx)(k,{className:`mr-1.5 h-3.5 w-3.5`}),f.finalizing?l(`detail.finalizing`):l(`detail.finalizeJob`)]})}),(0,B.jsx)(M,{children:l(`detail.finalizeJobTooltip`)})]}):(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,onClick:()=>void N(),disabled:f.finalizing||D,className:T(`text-[11px] underline-offset-2 transition-colors`,D?`cursor-not-allowed text-muted-foreground/40`:`text-muted-foreground hover:text-accent-success hover:underline`),children:f.finalizing?l(`detail.interactive.wrappingUp`):l(a===`loop-step`?`detail.interactive.wrapUpStep`:`detail.interactive.wrapUp`)})}),(0,B.jsx)(M,{children:l(a===`loop-step`?`detail.interactive.wrapUpStepTooltip`:`detail.interactive.wrapUpTooltip`)})]})]})]}),u===`auto`&&(0,B.jsx)(`p`,{className:`text-[11px] leading-snug text-muted-foreground/60`,children:l(D?`detail.interactive.waitingForStep`:`detail.interactive.autoHint`)}),(0,B.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,B.jsx)(`textarea`,{ref:y,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())},rows:2,placeholder:l(D?`detail.interactive.waitingForStepShort`:`detail.interactive.placeholder`),"aria-label":l(`detail.interactive.placeholder`),disabled:D,className:T(`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`,D&&`opacity-60`)}),(0,B.jsxs)(j,{children:[(0,B.jsx)(A,{asChild:!0,children:(0,B.jsx)(`span`,{className:`shrink-0`,children:(0,B.jsxs)(w,{size:`sm`,onClick:()=>void O(),disabled:P,className:`h-9`,children:[(0,B.jsx)(I,{className:`mr-1.5 h-3.5 w-3.5`}),l(`detail.interactive.send`)]})})}),P&&!_&&(0,B.jsx)(M,{children:l(D?`detail.interactive.sendDisabledWaiting`:`detail.interactive.sendDisabledEmpty`)})]})]})]})}export{le as i,Ye as n,xe as r,Qe as t};
|
|
@@ -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{t as r}from"./react-dom-DiWzBDP9.js";import{a as i}from"./i18n-
|
|
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}from"./i18n-nJQvD5zJ.js";import{n as a}from"./createLucideIcon-Bjbbp_KS.js";import{n as o}from"./dist-bVqfYmby.js";import{p as s}from"./useBrowserCaptureSession-BBXBN0Na.js";import{i as c,n as l,r as u,t as d}from"./InteractiveJobComposer-BGjIe9R6.js";import{t as ee}from"./loader-circle-DcygOQpC.js";import{t as te}from"./x-CBMI9ejn.js";import{a as f,n as p}from"./auth-D_5bQv5W.js";import{t as m}from"./api-B2M7CtDw.js";import{t as h}from"./button-BUIIBQPT.js";import{c as ne,s as re}from"./dialog-CzIekCw0.js";import{t as ie}from"./formatDistanceToNow-BOuXgebD.js";import{F as g,I as _,M as v,N as y,P as b,n as x,r as S}from"./index-C_sdsSZt.js";import{n as C,t as w}from"./job-time-BCL7wee9.js";var T=e(r(),1),E=e(t(),1),D=[1e3,2e3,4e3,8e3,16e3];function O(e,t){let[n,r]=(0,E.useState)(`connecting`),i=(0,E.useRef)(null),a=(0,E.useRef)(0),o=(0,E.useRef)(null),s=(0,E.useRef)(t);s.current=t;let c=(0,E.useCallback)(()=>{let t=p(),n=t?new WebSocket(e,[`specrails-desktop`,t]):new WebSocket(e);i.current=n,r(`connecting`),n.onopen=()=>{a.current=0,r(`connected`)},n.onmessage=e=>{try{let t=JSON.parse(e.data);s.current(t)}catch{}},n.onclose=()=>{i.current=null;let e=a.current;if(e>=D.length){r(`disconnected`);return}let t=D[e];a.current+=1,o.current=setTimeout(c,t)}},[e]);return(0,E.useEffect)(()=>(c(),()=>{o.current&&clearTimeout(o.current);let e=i.current;e&&(e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null,e.close()),i.current=null}),[c]),{connectionStatus:n}}var k=n();function ae(e,t){let n=C(e),r=C(t);if(!n||!r)return`—`;let i=r.getTime()-n.getTime();if(i<0)return`—`;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`}var A={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`}};function j({jobId:e,onClose:t,projectId:n}){let{t:r}=a(`jobs`),p=(0,E.useCallback)(()=>n?`${f}/api/projects/${n}`:m(),[n]),[D,j]=(0,E.useState)(null),[M,N]=(0,E.useState)([]),[P,F]=(0,E.useState)([]),[I,L]=(0,E.useState)({}),[R,z]=(0,E.useState)(!0),[B,V]=(0,E.useState)(!1),[H,U]=(0,E.useState)(!1),[W,G]=(0,E.useState)(!1);(0,E.useEffect)(()=>{async function t(){try{let t=await fetch(`${p()}/jobs/${e}`);if(t.status===404){V(!0);return}if(!t.ok)throw Error(`Failed to fetch job`);let n=await t.json();if(j(n.job),N(n.events),n.phaseDefinitions){F(n.phaseDefinitions);let e={};for(let t of n.phaseDefinitions)e[t.key]=`idle`;L(e)}}catch{V(!0)}finally{z(!1)}}t()},[e,p]);let K=(0,E.useCallback)(()=>{fetch(`${p()}/jobs/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.job&&j(e.job)}).catch(()=>{})},[e,p]),q=(0,E.useRef)([]),J=(0,E.useRef)(null),Y=(0,E.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,E.useEffect)(()=>()=>{J.current&&cancelAnimationFrame(J.current)},[]),O(s,(0,E.useCallback)(t=>{let n=t;if(n.type===`event`&&n.jobId===e){let t={id:Date.now(),job_id:e,seq:0,event_type:n.event_type,source:n.source,payload:n.payload,timestamp:n.timestamp};q.current.push(t),J.current||=requestAnimationFrame(Y)}else if(n.type===`log`&&n.processId===e){let t={id:Date.now(),job_id:e,seq:0,event_type:`log`,source:n.source,payload:JSON.stringify({line:n.line}),timestamp:n.timestamp};q.current.push(t),J.current||=requestAnimationFrame(Y)}else if(n.type===`job.finalized`&&n.jobId===e||n.type===`job.interactive`&&n.jobId===e||(n.type===`loop.run_paused`||n.type===`loop.run_resumed`)&&n.loopRunId===e)K();else if(n.type===`phase`){let e=n.phase,t=n.state;L(n=>({...n,[e]:t}))}else if(n.type===`queue`){let t=n.jobs?.find(t=>t.id===e);t&&D&&j(e=>e&&{...e,status:t.status})}},[e,D,Y,K])),(0,E.useEffect)(()=>{function e(e){if(e.key===`Escape`){if(H){U(!1);return}t()}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t,H]);let X=D?S(D):`job`,Z=X===`loop-run`;async function oe(){G(!0);try{let t=await x({projectId:n??null,jobId:e,kind:X});t.ok?(o.success(r(Z?`modal.toast.stopSignalSent`:`modal.toast.cancelSignalSent`),{description:r(Z?`modal.toast.stopSignalSentDescription`:`modal.toast.cancelSignalSentDescription`)}),K()):o.error(r(`modal.toast.cancelFailed`),{description:t.error})}finally{G(!1)}}let Q=D?A[D.status]??A.queued:A.queued,se=D?.status===`running`,$=D?C(w(D)):null,{panelRef:ce,panelStyle:le,headerHandleProps:ue,resizeHandles:de,isFloating:fe,guardBackdrop:pe}=ne();return(0,T.createPortal)((0,k.jsx)(b,{delayDuration:400,children:(0,k.jsxs)(`div`,{className:`fixed inset-0 z-[65] flex items-stretch justify-center`,children:[(0,k.jsx)(`div`,{className:`absolute inset-0 bg-black/50 backdrop-blur-sm`,onClick:pe(t)}),(0,k.jsxs)(`div`,{ref:ce,className:`relative w-full m-3 rounded-xl glass-card border border-border/30 flex flex-col animate-in fade-in zoom-in-95 duration-200 overflow-hidden`,style:le,children:[(0,k.jsxs)(`div`,{...ue,className:`flex items-center justify-between px-4 py-3 border-b border-border/30${fe?` cursor-grab active:cursor-grabbing`:``}`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[D&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(v,{children:[(0,k.jsx)(g,{asChild:!0,children:(0,k.jsx)(`div`,{children:(0,k.jsx)(_,{variant:Q.variant,children:r(Q.labelKey)})})}),(0,k.jsx)(y,{children:r(Q.tooltipKey)})]}),(0,k.jsx)(`code`,{className:`text-xs font-mono text-foreground/80 truncate`,children:D.command}),(0,k.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:$?ie($,{addSuffix:!0,locale:i()}):`—`}),D.total_cost_usd!=null&&D.total_cost_usd>0&&(0,k.jsxs)(`span`,{className:`text-[10px] text-muted-foreground`,children:[`$`,D.total_cost_usd.toFixed(4)]}),D.started_at&&D.finished_at&&(0,k.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:ae(D.started_at,D.finished_at)})]}),R&&(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r(`common:states.loading`)})]}),(0,k.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[P.length>0&&(0,k.jsx)(`div`,{className:`mr-3`,children:(0,k.jsx)(c,{phases:I,phaseDefinitions:P})}),se&&(0,k.jsxs)(h,{variant:`ghost`,size:`sm`,onClick:()=>U(!0),disabled:W,className:`h-7 text-destructive hover:text-destructive hover:bg-destructive/10`,children:[W&&(0,k.jsx)(ee,{className:`w-3.5 h-3.5 mr-1.5 animate-spin`,"aria-hidden":!0}),r(Z?`dashboard:railControls.stop`:X===`interactive`?`common:actions.discard`:`common:actions.cancel`)]}),(0,k.jsx)(`button`,{onClick:t,className:`h-7 w-7 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-surface/50 transition-colors cursor-pointer`,children:(0,k.jsx)(te,{className:`w-4 h-4`})})]})]}),(0,k.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:B?(0,k.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r(`modal.notFound`)})}):D?.command.startsWith(`loop:`)?(0,k.jsx)(l,{events:M,jobStatus:D.status,isLoading:R,variant:`glass`,projectId:n}):(0,k.jsx)(u,{events:M,isLoading:R,projectId:n})}),!!D?.interactive&&D.status===`running`&&(0,k.jsx)(d,{jobId:e,projectId:n,settleMode:D.interactiveSettleMode,initialAcceptingTurns:D.interactiveAcceptingTurns,kind:D.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`glass`,onFinalized:K})]}),(0,k.jsx)(re,{handles:de}),H&&(0,k.jsxs)(`div`,{"data-testid":`job-cancel-confirm`,className:`absolute inset-0 z-10 flex items-center justify-center p-4`,children:[(0,k.jsx)(`div`,{className:`absolute inset-0 bg-black/60 backdrop-blur-sm`,onClick:()=>U(!1)}),(0,k.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,k.jsx)(`h3`,{className:`text-base font-semibold text-foreground`,children:r(Z?`modal.stopRunConfirmTitle`:`modal.cancelConfirmTitle`)}),(0,k.jsx)(`p`,{className:`mt-1.5 text-sm text-muted-foreground`,children:r(Z?`modal.stopRunConfirmDescription`:`modal.cancelConfirmDescription`)}),(0,k.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,k.jsx)(h,{variant:`ghost`,size:`sm`,onClick:()=>U(!1),children:r(`modal.keepRunning`)}),(0,k.jsx)(h,{variant:`destructive`,size:`sm`,onClick:()=>{U(!1),oe()},children:r(Z?`modal.stopRun`:X===`interactive`?`common:actions.discard`:`modal.cancelJob`)})]})]})]})]})}),document.body)}export{j 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{l as r,n as i,u as a}from"./chunk-KS7C4IRE-Cx5sqopX.js";import{a as o}from"./i18n-nJQvD5zJ.js";import{n as s}from"./createLucideIcon-Bjbbp_KS.js";import{n as c}from"./dist-bVqfYmby.js";import{c as l,l as u}from"./MinimizedChatsContext-CHsu3NCX.js";import{t as d}from"./chevron-right-CViMxucY.js";import{i as f,n as p,r as ee,t as te}from"./InteractiveJobComposer-BGjIe9R6.js";import{o as m}from"./TicketDetailModal-MhJzrqbi.js";import{t as ne}from"./circle-x-CMYsN4ZH.js";import{t as h}from"./download-CFHyyHcw.js";import{t as g}from"./loader-circle-DcygOQpC.js";import{r as _}from"./useSharedWebSocket-DK96ctb7.js";import{t as v}from"./api-B2M7CtDw.js";import{r as y}from"./useDesktop-B6Du2N83.js";import{t as b}from"./button-BUIIBQPT.js";import{t as x}from"./utils-BC4DHlz2.js";import{t as re}from"./formatDistanceToNow-BOuXgebD.js";import{Dt as S,F as C,I as ie,M as w,N as T,S as E,Tt as D,at as O,gt as k,n as ae,x as A}from"./index-C_sdsSZt.js";import{n as j}from"./job-time-BCL7wee9.js";import{t as M}from"./format-command-C0D9IPmV.js";var N=e(t(),1),P=n();function F(e,t){let n=j(e),r=(typeof t==`number`?t:j(t)?.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 I(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 L={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function R(e,t){if(t.type===`reset`)return L;if(t.type===`consume`){let{events:n}=t,r=e.lastSeenIdx>n.length?n.length:e.lastSeenIdx;if(n.length<=r)return r===e.lastSeenIdx?e:{...e,lastSeenIdx:r};let{steps:i,actionKey:a,actionArg:o}=e;for(let e=r;e<n.length;e++){let t=E(n[e]);t.step&&(i+=t.stepCount??1),t.actionKey&&(a=t.actionKey,o=t.actionArg??``)}return{steps:i,actionKey:a,actionArg:o,lastSeenIdx:n.length}}return e}function oe({job:e,events:t,defaultOpen:n=!0,pipelineTotals:r,phases:i,phaseDefinitions:a}){let{t:o}=s(`jobs`),[c,l]=(0,N.useState)(n),d=(0,N.useMemo)(()=>I(t),[t]),f=e.status===`running`,p=e.status===`completed`,[ee,te]=(0,N.useState)(()=>Date.now());(0,N.useEffect)(()=>{if(!f)return;let e=window.setInterval(()=>te(Date.now()),1e3);return()=>window.clearInterval(e)},[f]);let[m,h]=(0,N.useReducer)(R,L),_=(0,N.useRef)(e.id);(0,N.useEffect)(()=>{_.current!==e.id&&(_.current=e.id,h({type:`reset`})),h({type:`consume`,events:t})},[e.id,t]);let[v,y]=(0,N.useState)(!0);(0,N.useEffect)(()=>{if(!f)return;y(!0);let e=window.setTimeout(()=>y(!1),8e3);return()=>window.clearTimeout(e)},[f,e.id]);let b=e.finished_at?F(e.started_at,e.finished_at):f?F(e.started_at,ee):`—`,re=!!e.total_cost_usd_estimated,C=e.total_cost_usd==null?null:`${re?`~`:``}$${e.total_cost_usd.toFixed(4)}`,ie=e.num_turns==null?null:String(e.num_turns),w=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),T=w==null?null:`${(w/1e3).toFixed(1)}k`,E=(0,N.useMemo)(()=>!i||!a?null:a.find(e=>i[e.key]===`running`)?.label??null,[i,a]),D=f&&m.steps===0?`connecting`:m.actionKey||`thinking`,O=A.has(D)&&m.actionArg!==``,k=A.has(D)&&!O?`working`:D,ae=O?o(`statusPanel.activity.${k}`,{arg:m.actionArg}):o(`statusPanel.activity.${k}`),j=E??(f&&m.steps===0?o(`statusPanel.activity.starting`):null),M=m.steps>0?o(`statusPanel.steps`,{count:m.steps}):null,oe=o(f?`statusPanel.inProgress`:p?`statusPanel.completed`:`statusPanel.failed`),H=f?`border-accent-info/20 bg-accent-info/5`:p?`border-emerald-500/20 aurora-light:border-accent-success/30 bg-emerald-500/5 aurora-light:bg-accent-success/5`:`border-red-500/20 aurora-light:border-destructive/30 bg-red-500/5 aurora-light:bg-destructive/5`,se=f?g:p?S:ne,U=f?`w-4 h-4 text-accent-info shrink-0 animate-spin`:p?`w-4 h-4 text-emerald-400 aurora-light:text-accent-success shrink-0`:`w-4 h-4 text-red-400 aurora-light:text-destructive shrink-0`;return(0,P.jsxs)(`div`,{className:x(`mx-4 my-2 rounded-xl border transition-colors duration-500`,H),children:[(0,P.jsxs)(`button`,{type:`button`,onClick:()=>l(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,P.jsx)(se,{className:U,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:oe}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:`tabular-nums`,children:b}),f?M&&(0,P.jsx)(`span`,{className:`tabular-nums`,children:M}):(0,P.jsxs)(P.Fragment,{children:[C&&(0,P.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:C}),d.length>0&&(0,P.jsx)(`span`,{children:o(`statusPanel.filesCount`,{count:d.length})})]})]}),(0,P.jsx)(u,{className:x(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,P.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:f?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:o(`statusPanel.zoneInProgress`)}),(0,P.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,P.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,P.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[o(`statusPanel.duration`),(0,P.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:o(`statusPanel.liveTooltip`),"aria-label":o(`statusPanel.liveTooltip`)})]}),(0,P.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:b})]}),(0,P.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,P.jsx)(g,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),j&&(0,P.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:j}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:ae}),M&&(0,P.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,M]})]})]}),v&&(0,P.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:o(`statusPanel.explainer`)}),(0,P.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:o(`statusPanel.zoneFinalPending`)}),(0,P.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,P.jsx)(V,{label:o(`statusPanel.cost`),caption:o(`statusPanel.pendingCaption`),tooltip:o(`statusPanel.costTooltip`)}),(0,P.jsx)(V,{label:o(`statusPanel.turns`),caption:o(`statusPanel.pendingCaption`),tooltip:o(`statusPanel.pendingTooltip`)}),(0,P.jsx)(V,{label:o(`statusPanel.tokens`),caption:o(`statusPanel.pendingCaption`),tooltip:o(`statusPanel.pendingTooltip`)})]})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:o(`statusPanel.zoneFinal`)}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,P.jsx)(z,{label:o(`statusPanel.duration`),value:b}),(0,P.jsx)(B,{label:o(`statusPanel.cost`),value:C,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:o(`statusPanel.notAvailable`)}),(0,P.jsx)(B,{label:o(`statusPanel.turns`),value:ie,naCaption:o(`statusPanel.notAvailable`)}),(0,P.jsx)(B,{label:o(`statusPanel.tokens`),value:T,naCaption:o(`statusPanel.notAvailable`)})]}),r&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:o(`statusPanel.pipelineTotal`,{count:r.jobCount})}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,P.jsx)(z,{label:o(`statusPanel.totalCost`),value:r.costUnavailable?`—`:`${r.costEstimated?`~`:``}${r.hasNullCost?`≥`:``}$${r.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,P.jsx)(z,{label:o(`statusPanel.totalTokens`),value:r.tokensUnavailable?`—`:`${(r.nullTokenCount??0)>0?`≥`:``}${((r.totalTokensIn+r.totalTokensOut+r.totalTokensCacheRead+r.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]}),r.hasNullCost&&!r.costUnavailable&&(0,P.jsx)(`p`,{"data-testid":`pipeline-partial-hint`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,title:o(`statusPanel.pipelinePartialTooltip`),children:o(`statusPanel.pipelinePartial`,{count:r.nullCostCount??0})}),r.costUnavailable&&(0,P.jsx)(`p`,{"data-testid":`pipeline-cost-unavailable`,className:`text-[10px] text-muted-foreground/70 mt-1.5`,children:o(`statusPanel.pipelineCostUnavailable`)}),(r.nullTokenCount??0)>0&&(0,P.jsx)(`p`,{"data-testid":`pipeline-usage-coverage-hint`,className:`text-[10px] text-muted-foreground/70 mt-1`,title:o(`statusPanel.pipelineUsageTooltip`),children:r.tokensUnavailable?o(`statusPanel.pipelineUsageUnavailable`):o(`statusPanel.pipelineUsagePartial`,{count:r.nullTokenCount??0})})]}),d.length>0&&(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:o(`statusPanel.filesModified`)}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,P.jsx)(`code`,{className:`text-[10px] font-mono bg-muted/30 px-2 py-0.5 rounded text-cyan-400/80 aurora-light:text-accent-info`,children:e},e))})]})]})})]})}function z({label:e,value:t,valueClass:n}){return(0,P.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,P.jsx)(`p`,{className:x(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function B({label:e,value:t,valueClass:n,naCaption:r}){return(0,P.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,P.jsx)(`p`,{className:x(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function V({label:e,caption:t,tooltip:n}){return(0,P.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,P.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,P.jsx)(D,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,P.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var H=4;function se({tickets:e,onTicketClick:t}){let{t:n}=s(`jobs`),[r,i]=(0,N.useState)(!1);if(e.length===0)return null;let a=e.length>=H&&!r?e.slice(0,1):e,o=e.length-a.length;return(0,P.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,P.jsx)(U,{ticket:e,onClick:()=>t(e.id)},e.id)),o>0&&(0,P.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,P.jsx)(u,{className:`w-3 h-3`})]}),r&&e.length>=H&&(0,P.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,P.jsx)(l,{className:`w-3 h-3`})]})]})}function U({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,P.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,P.jsx)(`span`,{className:x(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,P.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,P.jsxs)(`span`,{className:x(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,P.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}var W={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`}};function G(){let{t:e}=s(`jobs`),{id:t}=a(),{activeProjectId:n,projects:l}=y(),u=l.find(e=>e.id===n)?.provider,ne=r(),{openTicketDetail:g}=m(),[S,E]=(0,N.useState)(null),[D,A]=(0,N.useState)([]),[j,F]=(0,N.useState)([]),[I,L]=(0,N.useState)({}),[R,z]=(0,N.useState)([]),[B,V]=(0,N.useState)(!0),[H,U]=(0,N.useState)(!1),[G,K]=(0,N.useState)(!1),q=(0,N.useRef)(!1),J=(0,N.useRef)(null);(0,N.useEffect)(()=>{q.current=!1,J.current=null,K(!1)},[t]),(0,N.useEffect)(()=>{if(!t)return;let e=new AbortController;E(null),A([]),F([]),L({}),V(!0),U(!1);async function n(){try{let n=await fetch(`${v()}/jobs/${t}`,{signal:e.signal});if(n.status===404){U(!0);return}if(!n.ok)throw Error(`Failed to fetch job`);let r=await n.json();E(r.job),A(r.events)}catch(e){if(e.name===`AbortError`)return;U(!0)}finally{e.signal.aborted||V(!1)}}return n(),()=>e.abort()},[t,n]),(0,N.useEffect)(()=>{if(!S?.pipeline_id){z([]);return}let e=S.pipeline_id;fetch(`${v()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&z(e.jobs)}).catch(()=>{})},[S?.pipeline_id,S?.status]);let Y=(0,N.useRef)(n);Y.current=n;let ce=(0,N.useRef)(null);ce.current=S?.status??null;let X=(0,N.useRef)([]),Z=(0,N.useRef)(null),le=(0,N.useCallback)(()=>{Z.current=null;let e=X.current;e.length!==0&&(X.current=[],A(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),Q=(0,N.useCallback)(e=>{let t=X.current;t.push(e),t.length>1e4&&(X.current=t.slice(-8e3)),Z.current||=requestAnimationFrame(le)},[le]);(0,N.useEffect)(()=>()=>{Z.current&&cancelAnimationFrame(Z.current)},[]);let ue=(0,N.useCallback)(e=>{let n=e;if(!(Y.current&&n.projectId&&n.projectId!==Y.current)){if(n.type===`init`){let e=n.phaseDefinitions??[];F(e);let t={};for(let r of e)t[r.key]=n.phases?.[r.key]??`idle`;L(t)}else if(n.type===`event`&&n.jobId===t){let e={id:Date.now(),job_id:t??``,seq:n.seq??0,event_type:n.event_type,source:n.source,payload:n.payload,timestamp:n.timestamp};Q(e)}else if(n.type===`log`&&n.processId===t){let e={id:Date.now(),job_id:t??``,seq:0,event_type:`log`,source:n.source,payload:JSON.stringify({line:n.line}),timestamp:n.timestamp};Q(e)}else if(n.type===`job.finalized`&&n.jobId===t||n.type===`job.interactive`&&n.jobId===t||(n.type===`loop.run_paused`||n.type===`loop.run_resumed`)&&n.loopRunId===t)fetch(`${v()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{});else if(n.type===`phase`){let e=n.phase,t=n.state;L(n=>({...n,[e]:t}))}else if(n.type===`queue`){let e=n.jobs?.find(e=>e.id===t);if(e){let n=e.status,r=ce.current;E(e=>e&&{...e,status:n}),(n===`completed`||n===`failed`||n===`canceled`||n===`running`&&r!==`running`)&&fetch(`${v()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{})}}}},[t,Q]),{registerHandler:de,unregisterHandler:fe}=_();(0,N.useEffect)(()=>(de(`job-detail-${t}`,ue),()=>fe(`job-detail-${t}`)),[t,ue,de,fe]),(0,N.useEffect)(()=>{if(!t||!S||S.status!==`running`||S.hasTelemetry)return;let e=setInterval(()=>{fetch(`${v()}/jobs/${t}`).then(e=>e.ok?e.json():null).then(e=>{e?.job?.hasTelemetry&&E(e=>e&&{...e,hasTelemetry:!0})}).catch(()=>{})},8e3);return()=>clearInterval(e)},[t,S?.status,S?.hasTelemetry]);async function pe(){if(!t)return;let n=await ae({projectId:null,jobId:t});n.ok?c.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)}):n.httpStatus===null?c.error(e(`detail.toast.networkError`)):c.error(e(`detail.toast.failed`),{description:n.error})}async function me(){if(S)try{let t=await fetch(`${v()}/jobs/${S.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-${S.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){c.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function he(){if(!(!S||q.current)){q.current=!0,K(!0),J.current||=typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`rerun-${S.id}-${Date.now()}-${Math.random().toString(36).slice(2)}`;try{let t=await fetch(`${v()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`,"Idempotency-Key":J.current},body:JSON.stringify({rerunOfJobId:S.id})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));J.current=null,c.success(e(`detail.toast.jobRequeued`)),ne(`/jobs/${n.jobId}`)}catch(e){c.error(e.message)}finally{q.current=!1,K(!1)}}}if(B)return(0,P.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,P.jsxs)(`div`,{className:`space-y-3`,children:[(0,P.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,P.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,P.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(H||!S)return(0,P.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,P.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,P.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:t})}),(0,P.jsx)(b,{asChild:!0,variant:`outline`,size:`sm`,children:(0,P.jsxs)(i,{to:`/`,children:[(0,P.jsx)(k,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let $=W[S.status]??W.queued,ge=S.status===`running`,_e=S.status===`completed`||S.status===`failed`,ve=!!S.interactive,ye=ve&&ge,be=(S.tickets?.length??0)>0,xe=S.command.startsWith(`loop:`),Se=R.length>1?{totalCostUsd:R.reduce((e,t)=>e+(t.total_cost_usd??0),0),hasNullCost:R.some(e=>e.total_cost_usd==null),costEstimated:R.some(e=>!!e.total_cost_usd_estimated),nullCostCount:R.filter(e=>e.total_cost_usd==null).length,costUnavailable:R.every(e=>e.total_cost_usd==null),totalTokensIn:R.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:R.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:R.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:R.reduce((e,t)=>e+(t.tokens_cache_create??0),0),nullTokenCount:R.filter(e=>e.tokens_in==null&&e.tokens_out==null&&e.tokens_cache_read==null&&e.tokens_cache_create==null).length,tokensUnavailable:R.every(e=>e.tokens_in==null&&e.tokens_out==null&&e.tokens_cache_read==null&&e.tokens_cache_create==null),jobCount:R.length}:null;return(0,P.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,P.jsxs)(`div`,{className:`px-4 py-4 border-b border-border space-y-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,P.jsxs)(i,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,P.jsx)(k,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,P.jsx)(d,{className:`w-3 h-3`}),(0,P.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:t?.slice(0,8)})})]}),be&&(0,P.jsx)(se,{tickets:S.tickets??[],onTicketClick:g}),(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,P.jsxs)(w,{children:[(0,P.jsx)(C,{asChild:!0,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(ie,{variant:$.variant,children:e($.labelKey)})})}),(0,P.jsx)(T,{children:e($.tooltipKey)})]}),(0,P.jsx)(`code`,{className:x(`font-mono text-foreground/90 truncate`,be?`text-xs text-muted-foreground`:`text-sm`),children:M(S.command,u)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,P.jsx)(`span`,{children:S.started_at?e(`detail.startedAgo`,{timeAgo:re(new Date(S.started_at),{addSuffix:!0,locale:o()})}):e(`detail.queuedWaiting`)}),S.model&&(0,P.jsx)(`span`,{className:`text-muted-foreground/40`,children:S.model})]})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[S.hasTelemetry&&(0,P.jsxs)(w,{children:[(0,P.jsx)(C,{asChild:!0,children:(0,P.jsxs)(b,{variant:`outline`,size:`sm`,className:`h-7`,onClick:me,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,P.jsx)(h,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,P.jsx)(T,{children:e(`detail.exportDiagnosticTooltip`)})]}),_e&&(0,P.jsxs)(w,{children:[(0,P.jsx)(C,{asChild:!0,children:(0,P.jsxs)(b,{variant:`outline`,size:`sm`,onClick:he,disabled:G,"aria-busy":G,className:`h-7`,children:[(0,P.jsx)(O,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,P.jsx)(T,{children:e(`detail.reExecuteTooltip`)})]}),ge&&(0,P.jsxs)(w,{children:[(0,P.jsx)(C,{asChild:!0,children:(0,P.jsx)(b,{variant:`outline`,size:`sm`,onClick:pe,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(ve?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,P.jsx)(T,{children:e(`detail.cancelJobTooltip`)})]})]})]}),(0,P.jsx)(f,{phases:I,phaseDefinitions:j})]}),(S.status===`running`||S.status===`completed`||S.status===`failed`)&&(0,P.jsx)(oe,{job:S,events:D,defaultOpen:S.status===`completed`||S.status===`running`,pipelineTotals:Se??void 0,phases:I,phaseDefinitions:j}),(0,P.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:xe?(0,P.jsx)(p,{events:D,jobStatus:S.status,variant:`page`}):(0,P.jsx)(ee,{events:D})}),ye&&(0,P.jsx)(te,{jobId:S.id,settleMode:S.interactiveSettleMode,initialAcceptingTurns:S.interactiveAcceptingTurns,kind:S.command.startsWith(`loop:`)?`loop-step`:`job`,variant:`page`})]})}export{G 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{l as r}from"./chunk-KS7C4IRE-Cx5sqopX.js";import{a as i}from"./i18n-nJQvD5zJ.js";import{n as a,t as o}from"./createLucideIcon-Bjbbp_KS.js";import{n as s}from"./dist-bVqfYmby.js";import{t as c}from"./circle-x-CMYsN4ZH.js";import{t as l}from"./trash-2-BOU3WdZZ.js";import{t as u}from"./triangle-alert-H9T4jAmh.js";import{t as d}from"./x-CBMI9ejn.js";import{a as f}from"./auth-D_5bQv5W.js";import{t as p}from"./api-B2M7CtDw.js";import{i as m,r as h}from"./useDesktop-B6Du2N83.js";import{t as g}from"./button-BUIIBQPT.js";import{a as _,c as v,i as y,n as b,o as ee,r as x,s as S,t as te}from"./dialog-CzIekCw0.js";import{n as ne,t as re}from"./lib-CGdyxIWg.js";import{t as C}from"./formatDistanceToNow-BOuXgebD.js";import{Dt as w,Et as T,F as E,I as ie,M as D,N as O,mt as ae,t as k}from"./index-C_sdsSZt.js";import{n as A,t as j}from"./job-time-BCL7wee9.js";import{t as oe}from"./format-command-C0D9IPmV.js";import{t as M}from"./ExportDropdown-BrtfWzEG.js";var se=o(`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`}]]),N=e(t(),1),P=n();function F(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 I(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function L(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R({label:e,a:t,b:n,highlight:r}){return(0,P.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,P.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,P.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,P.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function z(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function ce({jobIds:e,onClose:t}){let{t:n}=a(`jobs`),[r,i]=(0,N.useState)(null),[o,s]=(0,N.useState)(!0),[l,u]=(0,N.useState)(null),{panelRef:f,panelStyle:m,headerHandleProps:h,resizeHandles:g,isFloating:_,guardBackdrop:y}=v();(0,N.useEffect)(()=>{let t=new AbortController;return fetch(`${p()}/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),s(!1)}).catch(e=>{e.name!==`AbortError`&&(u(e.message),s(!1))}),()=>t.abort()},[e]);function b(e,t){return(0,P.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:n(`comparison.jobN`,{n:t+1})}),(0,P.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,P.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,P.jsx)(w,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,P.jsx)(c,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,P.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:n(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:y(t),children:[(0,P.jsxs)(`div`,{ref:f,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:m,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between ${_?`cursor-grab active:cursor-grabbing`:``}`,...h,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold`,children:n(`comparison.title`)}),(0,P.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,P.jsx)(d,{className:`w-4 h-4`})})]}),o&&(0,P.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,P.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,P.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:n(`comparison.loadFailed`,{error:l})}),r&&(()=>{let[e,t]=r.jobs,i=z(e.durationMs,t.durationMs,!0),a=z(e.totalCostUsd,t.totalCostUsd,!0),o=z(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,P.jsx)(`div`,{}),b(e,0),b(t,1)]}),(0,P.jsx)(R,{label:n(`comparison.duration`),a:F(e.durationMs),b:F(t.durationMs),highlight:i}),(0,P.jsx)(R,{label:n(`comparison.cost`),a:I(e.totalCostUsd),b:I(t.totalCostUsd),highlight:a}),(0,P.jsx)(R,{label:n(`comparison.tokensOut`),a:L(e.tokensOut),b:L(t.tokensOut),highlight:o}),(0,P.jsx)(R,{label:n(`comparison.tokensIn`),a:L(e.tokensIn),b:L(t.tokensIn),highlight:null}),(0,P.jsx)(R,{label:n(`comparison.cacheRead`),a:L(e.tokensCacheRead),b:L(t.tokensCacheRead),highlight:null}),(0,P.jsx)(R,{label:n(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,P.jsx)(R,{label:n(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),r&&(0,P.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:n(`comparison.betterValueHint`)})]}),(0,P.jsx)(S,{handles:g})]})}var le={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=A(e),r=A(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=A(e);return t?C(t,{addSuffix:!0,locale:i()}):`—`}function ge(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r).getTime()}function B(e){let[t,n,r]=e.split(`-`).map(Number);return new Date(t,n-1,r+1).getTime()-1}function _e(e,t,n){if(!t&&!n)return!0;let r=A(e);if(!r)return!0;let i=r.getTime();return!(t&&i<ge(t)||n&&i>B(n))}var V=10;function H({jobs:e,isLoading:t,error:n,onRetry:i,onJobsCleared:o,onProposalClick:c,onProposalDelete:d}){let{t:f}=a(`jobs`),m=r(),{activeProjectId:ne,projects:re}=h(),C=re.find(e=>e.id===ne)?.provider,[w,k]=(0,N.useState)(null),[A,M]=(0,N.useState)(``),[F,I]=(0,N.useState)(``),[L,R]=(0,N.useState)(!1),[z,H]=(0,N.useState)(``),[U,W]=(0,N.useState)(``),[G,ve]=(0,N.useState)(!1),[K,q]=(0,N.useState)(null),[J,ye]=(0,N.useState)(V),[Y,be]=(0,N.useState)(!1),[X,Z]=(0,N.useState)([]),[xe,Q]=(0,N.useState)(null),{panelRef:Se,panelStyle:Ce,headerHandleProps:we,resizeHandles:Te,isFloating:Ee,guardBackdrop:De}=v();(0,N.useEffect)(()=>{ye(V)},[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=>w&&e.status!==w?!1:_e(j(e),A,F)),Ae=e.filter(e=>_e(j(e),z,U)).length;async function je(e){ve(!0);try{let t={};e===`range`&&(z&&(t.from=new Date(ge(z)).toISOString()),U&&(t.to=new Date(B(U)).toISOString()));let n=await fetch(`${p()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(n.ok){let e=await n.json();s.success(f(`recent.toast.cleared`,{count:e.deleted})),R(!1),H(``),W(``),o?.()}else s.error(f(`recent.toast.clearFailed`))}catch{s.error(f(`recent.toast.networkError`))}finally{ve(!1)}}let Me=n?(0,P.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,P.jsx)(u,{className:`h-4 w-4 shrink-0`}),(0,P.jsx)(`span`,{className:`flex-1`,children:f(`recent.loadFailed`)}),i&&(0,P.jsx)(g,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,onClick:i,disabled:t,children:f(`common:actions.retry`)})]}):null;return n&&e.length===0?(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4`,children:Me}):t&&e.length===0?(0,P.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,P.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,P.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,P.jsx)(T,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,P.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:f(`recent.emptyTitle`)}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:f(`recent.emptyDescription`)})]}):(0,P.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[Me,(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,P.jsx)(`button`,{type:`button`,onClick:()=>k(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${w===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:f(`recent.filterAll`,{count:e.length})}),ue.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,P.jsx)(`button`,{type:`button`,onClick:()=>k(w===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${w===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:f(`recent.filterStatus`,{status:f(`statusName.${t}`),count:n})},t)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`input`,{type:`date`,value:A,onChange:e=>M(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:f(`recent.fromDate`)}),(0,P.jsx)(`input`,{type:`date`,value:F,onChange:e=>I(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:f(`recent.toDate`)}),(A||F)&&(0,P.jsx)(`button`,{type:`button`,onClick:()=>{M(``),I(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:f(`recent.clear`)}),(0,P.jsxs)(D,{children:[(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(g,{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,P.jsx)(se,{className:`w-3.5 h-3.5`})})}),(0,P.jsx)(O,{children:f(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,P.jsxs)(D,{children:[(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(g,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>R(!0),children:(0,P.jsx)(l,{className:`w-3.5 h-3.5`})})}),(0,P.jsx)(O,{children:f(`recent.clearJobs`)})]})]})]}),Y&&(0,P.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,P.jsxs)(`span`,{children:[X.length===0&&f(`recent.selectTwoToCompare`),X.length===1&&f(`recent.selectOneMore`),X.length===2&&f(`recent.readyToCompare`)]}),X.length===2&&(0,P.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:f(`recent.compareAction`)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,P.jsx)(`span`,{className:`w-14`,children:f(`recent.colStatus`)}),(0,P.jsx)(`span`,{className:`flex-1 min-w-0`,children:f(`recent.colCommand`)}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,P.jsx)(`span`,{className:`w-14 text-right`,children:f(`recent.colDuration`)}),(0,P.jsx)(`span`,{className:`w-12 text-right`,children:f(`recent.colTokens`)}),(0,P.jsx)(`span`,{className:`w-12 text-right`,children:f(`recent.colCost`)}),(0,P.jsx)(`span`,{className:`w-20 text-right`,children:f(`recent.colStarted`)})]})]}),(0,P.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let t=le[e.status]??le.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:`),o=a?e.id.replace(`proposal:`,``):null,s=X.includes(e.id),u=Y&&!a&&X.length===2&&!s,d=()=>{if(Y&&!a){ke(e.id);return}a&&o?c?.(o):m(`/jobs/${e.id}`)};return(0,P.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${s?`bg-accent/70 ring-1 ring-border`:u?`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,P.jsxs)(D,{children:[(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(`div`,{children:(0,P.jsx)(ie,{variant:t.variant,children:f(t.labelKey)})})}),(0,P.jsx)(O,{children:f(t.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,P.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${de[e.priority].className}`,children:f(de[e.priority].labelKey)}),e.profile_name&&(0,P.jsxs)(D,{children:[(0,P.jsx)(E,{asChild:!0,children:(0,P.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,P.jsx)(O,{children:f(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,P.jsxs)(D,{children:[(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(ae,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,P.jsxs)(O,{children:[f(`recent.pipelinePart`),e.depends_on_job_id&&` ${f(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,P.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:oe(e.command,C)})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,P.jsx)(`span`,{className:`w-14 text-right`,children:r??`—`}),(0,P.jsx)(`span`,{className:`w-12 text-right`,children:i?`${i}`:`—`}),(0,P.jsx)(`span`,{className:`w-12 text-right`,children:n??`—`}),(0,P.jsx)(`span`,{className:`w-20 text-right`,children:e.status===`queued`?`—`:he(e.started_at)}),a&&o&&(0,P.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(o)},title:f(`recent.deleteProposal`),children:(0,P.jsx)(l,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,P.jsx)(`div`,{className:`pt-1 text-center`,children:(0,P.jsx)(`button`,{type:`button`,onClick:()=>ye(e=>e+V),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:f(`recent.loadMore`,{count:$.length-J})})}),L&&(0,P.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:De(()=>R(!1)),children:[(0,P.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,P.jsxs)(`div`,{...we,className:Ee?`cursor-grab active:cursor-grabbing`:void 0,children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold`,children:f(`recent.clearModal.title`)}),(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:f(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,P.jsx)(g,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:G,onClick:()=>je(`all`),children:f(`recent.clearModal.clearAll`,{count:e.length})}),(0,P.jsxs)(`div`,{className:`space-y-2`,children:[(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f(`recent.clearModal.orByRange`)}),(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsx)(`input`,{type:`date`,value:z,onChange:e=>H(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:f(`recent.clearModal.fromPlaceholder`)}),(0,P.jsx)(`input`,{type:`date`,value:U,onChange:e=>W(e.target.value),className:`flex-1 h-7 rounded-md border border-border bg-input px-2 text-xs text-foreground`,placeholder:f(`recent.clearModal.toPlaceholder`)})]}),(0,P.jsx)(g,{variant:`outline`,size:`sm`,className:`w-full`,disabled:G||!z&&!U,onClick:()=>je(`range`),children:z||U?f(`recent.clearModal.clearInRange`,{count:Ae}):f(`recent.clearModal.clearRange`)})]}),(0,P.jsx)(g,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>R(!1),children:f(`common:actions.cancel`)})]}),(0,P.jsx)(S,{handles:Te})]}),(0,P.jsx)(te,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,P.jsxs)(b,{className:`max-w-sm`,children:[(0,P.jsxs)(_,{children:[(0,P.jsx)(ee,{children:f(`recent.deleteProposalConfirm.title`)}),(0,P.jsx)(x,{children:f(`recent.deleteProposalConfirm.description`)})]}),(0,P.jsxs)(y,{children:[(0,P.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:f(`common:actions.cancel`)}),(0,P.jsx)(g,{variant:`destructive`,size:`sm`,onClick:()=>{K&&d?.(K),q(null)},children:f(`common:actions.delete`)})]})]})}),xe&&(0,P.jsx)(ce,{jobIds:xe,onClose:()=>{Q(null),Z([]),be(!1)}})]})}var U={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 W(e){return`${f}/api/projects/${encodeURIComponent(e)}`}function G(){let{t:e}=a(`jobs`),{activeProjectId:t}=h(),{recentJobs:n}=k(t),{data:r,isFirstLoad:i,isLoading:o,error:c,refresh:l}=m({namespace:`jobs`,projectId:t,initialValue:n,fetcher:async({projectId:e,signal:t})=>{let n=await fetch(`${W(e)}/jobs?limit=10`,{signal:t});if(!n.ok)throw Error(`Failed to fetch jobs: ${n.status}`);return(await n.json()).jobs},pollInterval:1e4}),{data:u,isFirstLoad:d,isLoading:f,error:v,refresh:x}=m({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async({projectId:e,signal:t})=>{let n=await fetch(`${W(e)}/propose?limit=10`,{signal:t});if(!n.ok)throw Error(`Failed to fetch proposals: ${n.status}`);return(await n.json()).proposals},pollInterval:1e4}),S={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},C=u.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:S[e.status]??`queued`})),w=[...r,...C].sort((e,t)=>(A(j(t))?.getTime()??0)-(A(j(e))?.getTime()??0)),[T,E]=(0,N.useState)(null),D=(0,N.useCallback)(async e=>{try{let t=await fetch(`${p()}/propose/${e}`);if(!t.ok)return;let n=await t.json();E(n.proposal)}catch{}},[]),O=(0,N.useCallback)(async t=>{try{(await fetch(`${p()}/propose/${t}`,{method:`DELETE`})).ok&&(s.success(e(`page.proposalDeleted`)),await x())}catch{}},[x,e]);return(0,P.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,P.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,P.jsx)(M,{baseUrl:`${p()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,P.jsx)(H,{jobs:w,isLoading:i||d||o||f,error:c??v,onRetry:()=>{Promise.all([l(),x()])},onJobsCleared:l,onProposalClick:D,onProposalDelete:O}),(0,P.jsx)(te,{open:T!==null,onOpenChange:e=>!e&&E(null),children:(0,P.jsx)(b,{className:`max-w-3xl glass-card`,children:T&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(_,{children:(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(ee,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,P.jsx)(ie,{variant:T.status===`created`?`success`:T.status===`cancelled`?`destructive`:`secondary`,children:e(U[T.status]??`page.proposal.status.unknown`,{status:T.status})})]})}),(0,P.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:T.idea}),T.result_markdown?(0,P.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,P.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,P.jsx)(ne,{remarkPlugins:[re],children:T.result_markdown})})}):(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),T.issue_url&&(0,P.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,P.jsx)(`a`,{href:T.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:T.issue_url})]}),(0,P.jsxs)(y,{children:[(0,P.jsx)(g,{variant:`destructive`,size:`sm`,onClick:()=>{O(T.id),E(null)},children:e(`common:actions.delete`)}),(0,P.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>E(null),children:e(`common:actions.close`)})]})]})})})]})}export{G as default};
|