specrails-desktop 2.14.0 → 2.16.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-BBGvhMX5.js → ActivityFeedPage-C_clKk8d.js} +1 -1
- package/client/dist/assets/AgentsPage-jcPUtPhP.js +86 -0
- package/client/dist/assets/AnalyticsPage-DZkVU3yd.js +1 -0
- package/client/dist/assets/{BarChart-zCFHhnbZ.js → BarChart-Dq1h8eYR.js} +2 -2
- package/client/dist/assets/CodePage-BcbZT88K.js +2 -0
- package/client/dist/assets/{DesktopAnalyticsPage-DlrcBWPo.js → DesktopAnalyticsPage-CYhXhJoQ.js} +1 -1
- package/client/dist/assets/{DocsDialog-B8mSbQhA.js → DocsDialog-CS3Syf61.js} +2 -2
- package/client/dist/assets/{DocsPage-D7t2Bc-K.js → DocsPage-l3ZcTO2E.js} +2 -2
- package/client/dist/assets/{ExportDropdown-ClTut9WA.js → ExportDropdown-DdB2ncYh.js} +1 -1
- package/client/dist/assets/IntegrationsPage-CJ_Om1zu.js +3 -0
- package/client/dist/assets/JobDetailPage-D5Cxw0md.js +16 -0
- package/client/dist/assets/JobsPage-3v_iX83r.js +1 -0
- package/client/dist/assets/{LoopBuilderPage-CScd8wyY.js → LoopBuilderPage-4s_adZy5.js} +2 -2
- package/client/dist/assets/LoopsPage-DA94-o0j.js +1 -0
- package/client/dist/assets/analytics-BDlELxc7.js +1 -0
- package/client/dist/assets/analytics-BE49LbUk.js +1 -0
- package/client/dist/assets/analytics-CQqu1yE5.js +1 -0
- package/client/dist/assets/analytics-CgEkAUiP.js +1 -0
- package/client/dist/assets/analytics-D1ElChhs.js +1 -0
- package/client/dist/assets/analytics-DBGO8B6-.js +1 -0
- package/client/dist/assets/analytics-DDqve9Ma.js +1 -0
- package/client/dist/assets/analytics-DEsEAJZL.js +1 -0
- package/client/dist/assets/{common-DI4jE5y-.js → common-C9VyfY7g.js} +1 -1
- package/client/dist/assets/{common-DTHzyfYC.js → common-CNoRVpnA.js} +1 -1
- package/client/dist/assets/{common-CnrZ9gCZ.js → common-CcHFVATT.js} +1 -1
- package/client/dist/assets/{common-BhFasU8N.js → common-CzCQ0rpW.js} +1 -1
- package/client/dist/assets/{common-DY4nzbWC.js → common-Dmpyh323.js} +1 -1
- package/client/dist/assets/{common-CwhHWbTD.js → common-LDwESeCX.js} +1 -1
- package/client/dist/assets/{common-DS8zKLQT.js → common-ULlk84G4.js} +1 -1
- package/client/dist/assets/common-kftoE0Q-.js +1 -0
- package/client/dist/assets/dashboard-03EpOoMM.js +1 -0
- package/client/dist/assets/dashboard-BQ3Oa8CE.js +1 -0
- package/client/dist/assets/dashboard-C-dXxut-.js +1 -0
- package/client/dist/assets/dashboard-C2owt3eN.js +1 -0
- package/client/dist/assets/dashboard-C52PElPV.js +1 -0
- package/client/dist/assets/dashboard-CUjyhohl.js +1 -0
- package/client/dist/assets/dashboard-Ch6H-457.js +1 -0
- package/client/dist/assets/dashboard-zH9quXks.js +1 -0
- package/client/dist/assets/{dist-js-Ca7dsMhN.js → dist-js-D27I-bfi.js} +1 -1
- package/client/dist/assets/{dist-js-BHJ5LpTw.js → dist-js-Ele_sHO7.js} +1 -1
- package/client/dist/assets/index-BRMyOS1B.css +2 -0
- package/client/dist/assets/index-meTWPBzY.js +144 -0
- package/client/dist/assets/{lib-3_pPhUqA.js → lib-qdRfWwE1.js} +1 -1
- package/client/dist/assets/{tickets-IbYhlr-6.js → tickets-68LH1xp6.js} +1 -1
- package/client/dist/assets/{tickets-EnP6m_Ao.js → tickets-D6f3GSYn.js} +1 -1
- package/client/dist/assets/{tickets-BFrVcXAI.js → tickets-DBQXMYYA.js} +1 -1
- package/client/dist/assets/{tickets-C3gG--yT.js → tickets-OrJwUxJR.js} +1 -1
- package/client/dist/assets/{tickets-Cfhwbdxj.js → tickets-PtHNxQo5.js} +1 -1
- package/client/dist/assets/{tickets-ZS5EsDxn.js → tickets-REr-EQx9.js} +1 -1
- package/client/dist/assets/{tickets-DcggvP3k.js → tickets-blQnNA4N.js} +1 -1
- package/client/dist/assets/{tickets-lJR7pWNI.js → tickets-jxsTrApR.js} +1 -1
- package/client/dist/assets/{upload-DsygVwLQ.js → upload-DPG87J4t.js} +1 -1
- package/client/dist/assets/{value-B5mYukkD.js → value-BRVOAvhY.js} +1 -1
- package/client/dist/index.html +6 -6
- package/package.json +1 -1
- package/server/dist/ai-invocations.js +5 -2
- package/server/dist/db.js +35 -2
- package/server/dist/desktop-analytics.js +39 -6
- package/server/dist/loop-command-catalog.js +40 -1
- package/server/dist/loop-constants.js +37 -1
- package/server/dist/loop-decider.js +13 -10
- package/server/dist/loop-executors.js +58 -6
- package/server/dist/loop-factory.js +10 -3
- package/server/dist/loop-run-manager.js +199 -16
- package/server/dist/loop-runs-store.js +51 -0
- package/server/dist/loop-templates-ported.js +25 -21
- package/server/dist/loop-templates.js +87 -7
- package/server/dist/merge-manager.js +81 -0
- package/server/dist/pricing.js +20 -1
- package/server/dist/project-registry.js +7 -0
- package/server/dist/project-router-spending.js +56 -8
- package/server/dist/queue-manager.js +70 -10
- package/server/dist/rail-isolated-launch.js +189 -0
- package/server/dist/rail-isolation.js +55 -0
- package/server/dist/rail-merge-orchestrator.js +45 -0
- package/server/dist/rail-worktrees-store.js +52 -0
- package/server/dist/rails-router.js +47 -4
- package/server/dist/repo-lock.js +25 -0
- package/server/dist/result-event.js +15 -1
- package/server/dist/spending.js +161 -21
- package/server/dist/workspace-manager.js +134 -14
- package/server/dist/worktree-manager.js +159 -0
- package/client/dist/assets/AgentsPage-CSrs9kuV.js +0 -86
- package/client/dist/assets/AnalyticsPage-B011XilA.js +0 -1
- package/client/dist/assets/CodePage-MB0JiLis.js +0 -2
- package/client/dist/assets/IntegrationsPage-CgJf4uLW.js +0 -3
- package/client/dist/assets/JobDetailPage-DlyLLI4l.js +0 -16
- package/client/dist/assets/JobsPage-mbez97dP.js +0 -1
- package/client/dist/assets/LoopsPage-mBDRcEzq.js +0 -1
- package/client/dist/assets/analytics-BHApBnUn.js +0 -1
- package/client/dist/assets/analytics-BUxrug9J.js +0 -1
- package/client/dist/assets/analytics-Cy6DTfO-.js +0 -1
- package/client/dist/assets/analytics-DMJxD9FD.js +0 -1
- package/client/dist/assets/analytics-DgrBuxla.js +0 -1
- package/client/dist/assets/analytics-DwxT1CS8.js +0 -1
- package/client/dist/assets/analytics-GrLc-SMr.js +0 -1
- package/client/dist/assets/analytics-qvPq4T4h.js +0 -1
- package/client/dist/assets/common-D9GAPxeN.js +0 -1
- package/client/dist/assets/dashboard-8FSyxKGV.js +0 -1
- package/client/dist/assets/dashboard-A9XQUfdS.js +0 -1
- package/client/dist/assets/dashboard-BFktSDsV.js +0 -1
- package/client/dist/assets/dashboard-C1PKCXLs.js +0 -1
- package/client/dist/assets/dashboard-DNf0czU-.js +0 -1
- package/client/dist/assets/dashboard-DQQCOVfu.js +0 -1
- package/client/dist/assets/dashboard-DxFqeHZk.js +0 -1
- package/client/dist/assets/dashboard-WvPGhbbi.js +0 -1
- package/client/dist/assets/index-ByhYcYLV.css +0 -2
- package/client/dist/assets/index-CEunZ8kJ.js +0 -144
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{At as t,Bt as n,Ct as r,Dt as i,E as a,Et as o,Gt as s,H as c,Ht as l,Mt as u,O as d,Ot as f,T as p,U as m,V as h,Wt as g,bn as ee,en as _,et as v,f as y,ft as b,gn as x,hn as S,it as te,jt as C,l as w,nn as T,o as E,p as D,tn as O,tt as k,u as ne,v as A,wn as j,wt as M,xn as re,y as N,yn as P}from"./index-meTWPBzY.js";import{t as F}from"./lib-qdRfWwE1.js";import{t as ie}from"./format-command-CMsBTOPN.js";var I=n(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),L=n(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),R=e(j(),1),z=O();function ae({phases:e,phaseDefinitions:t}){return t.length===0?null:(0,z.jsx)(`div`,{className:`flex items-center`,children:t.map((n,r)=>{let i=e[n.key]??`idle`,o=r<t.length-1?e[t[r+1].key]??`idle`:null;return(0,z.jsxs)(`div`,{className:`flex items-center`,children:[(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5 cursor-default px-4`,children:[(0,z.jsx)(oe,{state:i}),(0,z.jsx)(`span`,{className:m(`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,z.jsxs)(a,{side:`bottom`,className:`max-w-[200px]`,children:[(0,z.jsx)(`p`,{className:`font-medium`,children:n.label}),(0,z.jsx)(`p`,{className:`text-muted-foreground mt-0.5`,children:n.description})]})]}),o!==null&&(0,z.jsx)(`div`,{className:m(`h-px w-12 -mt-5 shrink-0 transition-all duration-300`,o===`done`||i===`done`?`bg-emerald-500/30 aurora-light:bg-accent-success/40`:o===`running`?`bg-blue-400/40 aurora-light:bg-accent-info/40`:`bg-border/30`)})]},n.key)})})}function oe({state:e}){return(0,z.jsxs)(`div`,{className:m(`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,z.jsx)(b,{className:`w-6 h-6 text-blue-400 aurora-light:text-accent-info animate-spin`}),e===`done`&&(0,z.jsx)(f,{className:`w-6 h-6 text-emerald-400 aurora-light:text-accent-success`}),e===`error`&&(0,z.jsx)(i,{className:`w-6 h-6 text-red-400 aurora-light:text-destructive`}),e===`idle`&&(0,z.jsx)(o,{className:`w-6 h-6 text-muted-foreground/20`})]})}function B(e,t){let n=(typeof t==`number`?t:new Date(t).getTime())-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function V(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 H={steps:0,actionKey:``,actionArg:``,lastSeenIdx:0};function se(e,t){if(t.type===`reset`)return H;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=D(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 ce({job:e,events:t,defaultOpen:n=!0,pipelineTotals:r,phases:a,phaseDefinitions:o}){let{t:s}=x(`jobs`),[c,l]=(0,R.useState)(n),d=(0,R.useMemo)(()=>V(t),[t]),p=e.status===`running`,h=e.status===`completed`,[g,ee]=(0,R.useState)(()=>Date.now());(0,R.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>ee(Date.now()),1e3);return()=>window.clearInterval(e)},[p]);let[_,v]=(0,R.useReducer)(se,H),S=(0,R.useRef)(e.id);(0,R.useEffect)(()=>{S.current!==e.id&&(S.current=e.id,v({type:`reset`})),v({type:`consume`,events:t})},[e.id,t]);let[te,C]=(0,R.useState)(!0);(0,R.useEffect)(()=>{if(!p)return;C(!0);let e=window.setTimeout(()=>C(!1),8e3);return()=>window.clearTimeout(e)},[p,e.id]);let w=e.finished_at?B(e.started_at,e.finished_at):p?B(e.started_at,g):`—`,T=!!e.total_cost_usd_estimated,E=e.total_cost_usd==null?null:`${T?`~`:``}$${e.total_cost_usd.toFixed(4)}`,D=e.num_turns==null?null:String(e.num_turns),O=e.tokens_in==null?null:(e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0),k=O==null?null:`${(O/1e3).toFixed(1)}k`,ne=(0,R.useMemo)(()=>!a||!o?null:o.find(e=>a[e.key]===`running`)?.label??null,[a,o]),A=p&&_.steps===0?`connecting`:_.actionKey||`thinking`,j=y.has(A)&&_.actionArg!==``,M=y.has(A)&&!j?`working`:A,re=j?s(`statusPanel.activity.${M}`,{arg:_.actionArg}):s(`statusPanel.activity.${M}`),N=ne??(p&&_.steps===0?s(`statusPanel.activity.starting`):null),P=_.steps>0?s(`statusPanel.steps`,{count:_.steps}):null,F=s(p?`statusPanel.inProgress`:h?`statusPanel.completed`:`statusPanel.failed`),ie=p?`border-accent-info/20 bg-accent-info/5`:h?`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`,I=p?b:h?f:i,L=p?`w-4 h-4 text-accent-info shrink-0 animate-spin`:h?`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,z.jsxs)(`div`,{className:m(`mx-4 my-2 rounded-xl border transition-colors duration-500`,ie),children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>l(!c),className:`w-full flex items-center gap-3 px-4 py-3`,children:[(0,z.jsx)(I,{className:L,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`text-sm font-semibold flex-1 text-left`,children:F}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-[11px] text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`tabular-nums`,children:w}),p?P&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:P}):(0,z.jsxs)(z.Fragment,{children:[E&&(0,z.jsx)(`span`,{className:`tabular-nums text-yellow-400 aurora-light:text-accent-warning`,children:E}),d.length>0&&(0,z.jsx)(`span`,{children:s(`statusPanel.filesCount`,{count:d.length})})]})]}),(0,z.jsx)(u,{className:m(`w-4 h-4 text-muted-foreground/40 transition-transform duration-150 shrink-0`,c&&`rotate-180`)})]}),c&&(0,z.jsx)(`div`,{className:`px-4 pb-4 space-y-3 border-t border-border/20`,children:p?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneInProgress`)}),(0,z.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-3 sm:items-stretch`,children:[(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 sm:w-44 shrink-0`,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1.5 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[s(`statusPanel.duration`),(0,z.jsx)(`span`,{className:`inline-block w-1.5 h-1.5 rounded-full bg-accent-info animate-pulse`,title:s(`statusPanel.liveTooltip`),"aria-label":s(`statusPanel.liveTooltip`)})]}),(0,z.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-accent-info`,children:w})]}),(0,z.jsxs)(`div`,{className:`flex-1 flex items-center gap-2 bg-muted/10 rounded-lg px-3 py-2 min-w-0`,children:[(0,z.jsx)(b,{className:`w-3.5 h-3.5 text-accent-info shrink-0 animate-spin`,"aria-hidden":`true`}),N&&(0,z.jsx)(`span`,{className:`text-[11px] font-medium px-1.5 py-0.5 rounded bg-accent-info/15 text-accent-info shrink-0`,children:N}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground truncate flex-1 min-w-0`,children:re}),P&&(0,z.jsxs)(`span`,{className:`text-[11px] text-muted-foreground/60 tabular-nums shrink-0`,children:[`· `,P]})]})]}),te&&(0,z.jsx)(`p`,{className:`text-[11px] text-muted-foreground/40 leading-snug`,children:s(`statusPanel.explainer`)}),(0,z.jsx)(`p`,{className:`pt-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider border-t border-accent-info/10 mt-1`,children:s(`statusPanel.zoneFinalPending`)}),(0,z.jsxs)(`div`,{className:`grid grid-cols-3 gap-2`,children:[(0,z.jsx)(G,{label:s(`statusPanel.cost`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.costTooltip`)}),(0,z.jsx)(G,{label:s(`statusPanel.turns`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)}),(0,z.jsx)(G,{label:s(`statusPanel.tokens`),caption:s(`statusPanel.pendingCaption`),tooltip:s(`statusPanel.pendingTooltip`)})]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`p`,{className:`pt-3 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:s(`statusPanel.zoneFinal`)}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-2`,children:[(0,z.jsx)(U,{label:s(`statusPanel.duration`),value:w}),(0,z.jsx)(W,{label:s(`statusPanel.cost`),value:E,valueClass:`text-yellow-400 aurora-light:text-accent-warning`,naCaption:s(`statusPanel.notAvailable`)}),(0,z.jsx)(W,{label:s(`statusPanel.turns`),value:D,naCaption:s(`statusPanel.notAvailable`)}),(0,z.jsx)(W,{label:s(`statusPanel.tokens`),value:k,naCaption:s(`statusPanel.notAvailable`)})]}),r&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.pipelineTotal`,{count:r.jobCount})}),(0,z.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,z.jsx)(U,{label:s(`statusPanel.totalCost`),value:`$${r.totalCostUsd.toFixed(4)}`,valueClass:`text-yellow-400 aurora-light:text-accent-warning`}),(0,z.jsx)(U,{label:s(`statusPanel.totalTokens`),value:`${((r.totalTokensIn+r.totalTokensOut+r.totalTokensCacheRead+r.totalTokensCacheCreate)/1e3).toFixed(1)}k`})]})]}),d.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider mb-1.5`,children:s(`statusPanel.filesModified`)}),(0,z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:d.map(e=>(0,z.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 U({label:e,value:t,valueClass:n}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,z.jsx)(`p`,{className:m(`text-sm font-semibold tabular-nums mt-0.5`,n),children:t})]})}function W({label:e,value:t,valueClass:n,naCaption:r}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2`,children:[(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:e}),(0,z.jsx)(`p`,{className:m(`text-sm font-semibold tabular-nums mt-0.5`,t==null?`text-muted-foreground`:n),children:t??`—`}),t==null&&(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:r})]})}function G({label:e,caption:t,tooltip:n}){return(0,z.jsxs)(`div`,{className:`bg-muted/20 rounded-lg px-3 py-2 ring-1 ring-accent-info/10`,title:n,children:[(0,z.jsxs)(`p`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground/50 uppercase tracking-wider`,children:[e,(0,z.jsx)(I,{className:`w-2.5 h-2.5 text-muted-foreground/30`,"aria-hidden":`true`})]}),(0,z.jsx)(`p`,{className:`text-sm font-semibold tabular-nums mt-0.5 text-muted-foreground/40`,children:`—`}),(0,z.jsx)(`p`,{className:`text-[10px] text-muted-foreground/30 mt-0.5`,children:t})]})}var K=4;function le({tickets:e,onTicketClick:n}){let{t:r}=x(`jobs`),[i,a]=(0,R.useState)(!1);if(e.length===0)return null;let o=e.length>=K&&!i?e.slice(0,1):e,s=e.length-o.length;return(0,z.jsxs)(`div`,{className:`rounded-xl border border-border/40 bg-card/40 px-4 py-3 space-y-1.5`,children:[o.map(e=>(0,z.jsx)(q,{ticket:e,onClick:()=>n(e.id)},e.id)),s>0&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>a(!0),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showMore`,{count:s}),(0,z.jsx)(u,{className:`w-3 h-3`})]}),i&&e.length>=K&&(0,z.jsxs)(`button`,{type:`button`,onClick:()=>a(!1),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[r(`ticketHeader.showLess`),(0,z.jsx)(t,{className:`w-3 h-3`})]})]})}function q({ticket:e,onClick:t}){let{t:n}=x(`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,z.jsx)(`div`,{className:`flex items-center gap-2 min-w-0`,children:(0,z.jsx)(`span`,{className:m(i,`text-muted-foreground bg-muted/20 select-none`),title:n(`ticketHeader.deletedTooltip`),children:n(`ticketHeader.deletedTicket`,{id:e.id})})}):(0,z.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,z.jsxs)(`span`,{className:m(i,`text-accent-primary bg-accent-primary/10 group-hover:bg-accent-primary/20 transition-colors`),children:[`#`,e.id]}),(0,z.jsx)(`span`,{className:`text-lg font-semibold text-foreground truncate group-hover:text-accent-primary transition-colors`,children:e.title})]})}function J(e){let t=e.trimStart();return!!(/^#{1,6}\s/.test(t)||/^[-*+]\s/.test(t)||/^\d+\.\s/.test(t)||/^\|.+\|/.test(t)||t.startsWith("```")||t.startsWith(`> `)||/\*\*[^*]+\*\*/.test(e)||/`[^`]+`/.test(e)||/\[.+\]\(.+\)/.test(e)||/^(-{3,}|_{3,}|\*{3,})$/.test(t)||/^- \[[ x]\]\s/.test(t))}function ue(e,t){let n=`${e.id??t}`,r=e.timestamp;if(e.event_type===`log`)try{let t=JSON.parse(e.payload).line??``;return t.trim()?t.startsWith(`▸`)||t.match(/^(architect|developer|reviewer|ship|analyst)\s*:/i)?{id:n,content:t,type:`phase`,timestamp:r}:e.source===`stderr`?{id:n,content:t,type:`stderr`,timestamp:r}:J(t)?{id:n,content:t,type:`assistant`,timestamp:r}:{id:n,content:t,type:`plain`,timestamp:r}:null}catch{return null}if(e.event_type!==`log`&&e.event_type!==`result`)return null;if(e.event_type===`result`)try{let t=JSON.parse(e.payload),i=[];return t.duration_ms&&i.push(`${(t.duration_ms/1e3).toFixed(1)}s`),t.total_cost_usd&&i.push(`$${t.total_cost_usd.toFixed(4)}`),t.num_turns&&i.push(s.t(`jobs:logViewer.turns`,{count:t.num_turns})),{id:n,content:`▸ ${s.t(`jobs:logViewer.completed`)}${i.length?` — ${i.join(` · `)}`:``}`,type:`result`,timestamp:r}}catch{return null}return null}function de(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 Y(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 fe({events:e,isLoading:t}){let{t:n,i18n:r}=x(`jobs`),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!0),[l,d]=(0,R.useState)(new Set),f=(0,R.useRef)(null),p=(0,R.useRef)(null),{processedLines:m,groups:h,totalLines:g}=(0,R.useMemo)(()=>{let t=e.map((e,t)=>ue(e,t)).filter(e=>e!==null),n=[];for(let e of t){let t=n.length>0?n[n.length-1]:null;e.type===`assistant`&&t?.type===`assistant`?t.content+=`
|
|
2
|
+
`+e.content:n.push({...e})}let r=de(n);return{processedLines:r,groups:Y(r),totalLines:r.length}},[e,r.language]),ee=(0,R.useMemo)(()=>{if(!i)return g;let e=i.toLowerCase();return m.filter(t=>t.content.toLowerCase().includes(e)).length},[i,m,g]),_=(0,R.useCallback)(()=>{let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[]);(0,R.useEffect)(()=>{o&&_()},[e.length,o,_]);function v(){let e=p.current;e&&s(e.scrollHeight-e.scrollTop-e.clientHeight<50)}function y(e){d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return t?(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.loading`)})}):g===0?(0,z.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n(`logViewer.empty`)})}):(0,z.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,z.jsxs)(`div`,{className:`px-4 py-2 border-b border-border flex items-center gap-2`,children:[(0,z.jsxs)(`div`,{className:`relative flex-1 max-w-xs`,children:[(0,z.jsx)(k,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3 h-3 text-muted-foreground`}),(0,z.jsx)(E,{placeholder:n(`logViewer.filterPlaceholder`),value:i,onChange:e=>a(e.target.value),className:`pl-7 h-7`})]}),(0,z.jsx)(c,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground/50 hover:text-foreground`,onClick:()=>{let e=m.map(e=>e.content).join(`
|
|
3
|
+
`);navigator.clipboard.writeText(e).then(()=>{S.success(n(`logViewer.copySuccess`))}).catch(()=>{S.error(n(`logViewer.copyFailed`))})},children:(0,z.jsx)(M,{className:`w-3.5 h-3.5`})}),(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:n(`logViewer.lineCount`,{filtered:ee,total:g})})]}),(0,z.jsxs)(`div`,{ref:p,className:`flex-1 overflow-y-auto p-2 text-xs relative`,onScroll:v,children:[h.map(e=>(0,z.jsx)(X,{group:e,filter:i,collapsed:l.has(e.key),onToggle:()=>y(e.key)},e.key)),(0,z.jsx)(`div`,{ref:f})]}),!o&&(0,z.jsxs)(c,{size:`sm`,variant:`secondary`,onClick:()=>{s(!0),_()},className:`absolute bottom-16 right-6 h-7 gap-1 shadow-lg`,children:[(0,z.jsx)(u,{className:`w-3 h-3`}),n(`logViewer.jumpToBottom`)]})]})}var X=(0,R.memo)(function({group:e,filter:t,collapsed:n,onToggle:r}){let{t:i}=x(`jobs`),a=t?e.lines.filter(e=>e.content.toLowerCase().includes(t.toLowerCase())):e.lines;if(e.header===null)return a.length===0?null:(0,z.jsx)(`div`,{children:a.map((e,t)=>(0,z.jsx)(Q,{line:e,even:t%2==0},e.id))});let o=e.header.content;return(0,z.jsxs)(`div`,{className:`mt-3 rounded-md overflow-hidden border border-border/20`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:m(`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,z.jsx)(C,{className:m(`w-3 h-3 text-primary/60 shrink-0 transition-transform duration-150`,!n&&`rotate-90`)}),(0,z.jsx)(`span`,{className:`flex-1 text-[12px] font-semibold text-foreground leading-none`,children:o}),e.header.timestamp&&(0,z.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,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0`,children:i(`logViewer.phaseLines`,{count:e.lines.length})})]}),!n&&(0,z.jsx)(`div`,{className:`bg-muted/5`,children:a.length===0?(0,z.jsx)(`p`,{className:`px-4 py-2 text-[10px] text-muted-foreground/40 italic`,children:i(t?`logViewer.noMatchingLines`:`logViewer.noOutput`)}):a.map((e,t)=>(0,z.jsx)(Q,{line:e,even:t%2==0},e.id))})]})}),Z=[F],Q=(0,R.memo)(function({line:e,even:t}){let n=e.type===`assistant`,r=e.type===`diff-add`,i=e.type===`diff-remove`,a=e.type===`diff-meta`,o=e.type===`diff-hunk`;return(0,z.jsxs)(`div`,{className:m(`flex items-start gap-2 group px-2 py-0.5 rounded-sm`,!(r||i||a||o)&&(t?`bg-muted/20`:`bg-transparent`),e.type===`result`&&`bg-emerald-500/5 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/40 aurora-light:border-accent-success/40 mt-2 py-2`,r&&`bg-emerald-500/8 aurora-light:bg-accent-success/10 border-l-2 border-emerald-500/50 aurora-light:border-accent-success/50`,i&&`bg-red-500/8 aurora-light:bg-destructive/10 border-l-2 border-red-500/50 aurora-light:border-destructive/50`,a&&`bg-accent-primary/5 border-l-2 border-accent-primary/30`,o&&`bg-accent-info/5 border-l-2 border-accent-info/30`),children:[e.timestamp&&(0,z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/40 shrink-0 mt-0.5 w-[52px] font-mono tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString(`en`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}),n?(0,z.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,z.jsx)(N,{remarkPlugins:[A],rehypePlugins:Z,children:e.content})}):(0,z.jsx)(`span`,{className:m(`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`,r&&`text-emerald-400 aurora-light:text-accent-success`,i&&`text-red-400 aurora-light:text-destructive`,a&&`text-accent-primary/80`,o&&`text-accent-info/80`),children:e.content})]})}),pe={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 $(){let{t:e}=x(`jobs`),{id:t}=re(),{activeProjectId:n,projects:i}=l(),o=i.find(e=>e.id===n)?.provider,s=ee(),{openTicketDetail:u}=w(),[y,E]=(0,R.useState)(null),[D,O]=(0,R.useState)([]),[k,A]=(0,R.useState)([]),[j,M]=(0,R.useState)({}),[N,F]=(0,R.useState)([]),[I,oe]=(0,R.useState)(!0),[B,V]=(0,R.useState)(!1),[H,se]=(0,R.useState)(null),[U,W]=(0,R.useState)(!1),[G,K]=(0,R.useState)(``),[q,J]=(0,R.useState)(!1),[ue,de]=(0,R.useState)(!1);(0,R.useEffect)(()=>{if(!t)return;let e=new AbortController;E(null),O([]),A([]),M({}),oe(!0),V(!1);async function n(){try{let n=await fetch(`${T()}/jobs/${t}`,{signal:e.signal});if(n.status===404){V(!0);return}if(!n.ok)throw Error(`Failed to fetch job`);let r=await n.json();E(r.job),O(r.events)}catch(e){if(e.name===`AbortError`)return;V(!0)}finally{e.signal.aborted||oe(!1)}}return n(),()=>e.abort()},[t,n]),(0,R.useEffect)(()=>{if(!y?.pipeline_id){F([]);return}let e=y.pipeline_id;fetch(`${T()}/pipelines/${e}`).then(e=>e.ok?e.json():null).then(e=>{e?.jobs&&F(e.jobs)}).catch(()=>{})},[y?.pipeline_id,y?.status]);let Y=(0,R.useRef)(n);Y.current=n;let X=(0,R.useRef)([]),Z=(0,R.useRef)(null),Q=(0,R.useCallback)(()=>{Z.current=null;let e=X.current;e.length!==0&&(X.current=[],O(t=>{let n=[...t,...e];return n.length>1e4?n.slice(n.length-8e3):n}))},[]),$=(0,R.useCallback)(e=>{let t=X.current;t.push(e),t.length>1e4&&(X.current=t.slice(-8e3)),Z.current||=requestAnimationFrame(Q)},[Q]);(0,R.useEffect)(()=>()=>{Z.current&&cancelAnimationFrame(Z.current)},[]);let me=(0,R.useCallback)(e=>{let n=e;if(!(Y.current&&n.projectId&&n.projectId!==Y.current)){if(n.type===`init`){let e=n.phaseDefinitions??[];A(e);let t={};for(let r of e)t[r.key]=n.phases?.[r.key]??`idle`;M(t)}else if(n.type===`event`&&n.jobId===t)$({id:Date.now(),job_id:t??``,seq:n.seq??0,event_type:n.event_type,source:n.source,payload:n.payload,timestamp:n.timestamp});else if(n.type===`log`&&n.processId===t)$({id:Date.now(),job_id:t??``,seq:0,event_type:`log`,source:n.source,payload:JSON.stringify({line:n.line}),timestamp:n.timestamp});else if(n.type===`job.turn_user`&&n.jobId===t)W(!0);else if(n.type===`job.turn_done`&&n.jobId===t)se(n.totals),W(!1);else if(n.type===`job.finalized`&&n.jobId===t){W(!1),J(!1);let e=n.totals;e&&se(e),fetch(`${T()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{})}else if(n.type===`phase`){let e=n.phase,t=n.state;M(n=>({...n,[e]:t}))}else if(n.type===`queue`){let e=n.jobs?.find(e=>e.id===t);if(e){let n=e.status;E(e=>e&&{...e,status:n}),(n===`completed`||n===`failed`||n===`canceled`)&&fetch(`${T()}/jobs/${t}`).then(e=>e.json()).then(e=>E(e.job)).catch(()=>{})}}}},[t,$]),{registerHandler:he,unregisterHandler:ge}=_();(0,R.useEffect)(()=>(he(`job-detail-${t}`,me),()=>ge(`job-detail-${t}`)),[t,me,he,ge]),(0,R.useEffect)(()=>{if(!t||!y||y.status!==`running`||y.hasTelemetry)return;let e=setInterval(()=>{fetch(`${T()}/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,y?.status,y?.hasTelemetry]);async function _e(){if(t)try{let n=await fetch(`${T()}/jobs/${t}`,{method:`DELETE`});if(n.ok)(await n.json()).status===`deleted`?(S.success(e(`detail.toast.jobDeleted`)),s(`/jobs`)):S.success(e(`detail.toast.cancelSignalSent`),{description:e(`detail.toast.cancelSignalSentDescription`)});else{let t=await n.json();S.error(e(`detail.toast.failed`),{description:t.error})}}catch{S.error(e(`detail.toast.networkError`))}}async function ve(){if(!(!t||q)){J(!0);try{let n=await fetch(`${T()}/jobs/${t}/finalize`,{method:`POST`});if(n.ok)S.success(e(`detail.toast.finalizeScheduled`));else{let t=await n.json().catch(()=>({}));S.error(e(`detail.toast.finalizeFailed`),{description:t.error}),J(!1)}}catch{S.error(e(`detail.toast.networkError`)),J(!1)}}}async function ye(){let n=G.trim();if(!(!t||!n||ue)){de(!0);try{let r=await fetch(`${T()}/jobs/${t}/messages`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:n})});if(r.ok)K(``);else{let t=await r.json().catch(()=>({}));S.error(e(`detail.toast.sendFailed`),{description:t.error})}}catch{S.error(e(`detail.toast.networkError`))}finally{de(!1)}}}async function be(){if(y)try{let t=await fetch(`${T()}/jobs/${y.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-${y.id}-${i}.zip`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(r)}catch(t){S.error(e(`detail.toast.exportFailed`),{description:t.message})}}async function xe(){if(y)try{let t=await fetch(`${T()}/spawn`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({command:y.command})}),n=await t.json();if(!t.ok)throw Error(n.error??e(`detail.toast.spawnFailed`));S.success(e(`detail.toast.jobRequeued`)),s(`/jobs/${n.jobId}`)}catch(e){S.error(e.message)}}if(I)return(0,z.jsx)(`div`,{className:`max-w-5xl mx-auto px-4 py-6`,children:(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(`div`,{className:`h-4 w-48 bg-muted/30 rounded animate-pulse`}),(0,z.jsx)(`div`,{className:`h-20 bg-muted/30 rounded-lg animate-pulse`}),(0,z.jsx)(`div`,{className:`h-64 bg-muted/30 rounded-lg animate-pulse`})]})});if(B||!y)return(0,z.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-6 flex flex-col items-center gap-3 mt-12`,children:[(0,z.jsx)(`p`,{className:`text-lg font-semibold`,children:e(`detail.notFound`)}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e(`detail.notFoundDescription`,{id:t})}),(0,z.jsx)(c,{asChild:!0,variant:`outline`,size:`sm`,children:(0,z.jsxs)(P,{to:`/`,children:[(0,z.jsx)(L,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.backToDashboard`)]})})]});let Se=pe[y.status]??pe.queued,Ce=y.status===`running`,we=y.status===`completed`||y.status===`failed`,Te=!!y.interactive,Ee=Te&&Ce,De=(y.tickets?.length??0)>0,Oe=N.length>1?{totalCostUsd:N.reduce((e,t)=>e+(t.total_cost_usd??0),0),totalTokensIn:N.reduce((e,t)=>e+(t.tokens_in??0),0),totalTokensOut:N.reduce((e,t)=>e+(t.tokens_out??0),0),totalTokensCacheRead:N.reduce((e,t)=>e+(t.tokens_cache_read??0),0),totalTokensCacheCreate:N.reduce((e,t)=>e+(t.tokens_cache_create??0),0),jobCount:N.length}:null;return(0,z.jsxs)(`div`,{"data-job-detail-surface":!0,className:`flex flex-col h-full max-w-5xl mx-auto w-full`,children:[(0,z.jsxs)(`div`,{className:`px-4 py-4 border-b border-border space-y-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,z.jsxs)(P,{to:`/`,className:`hover:text-foreground transition-colors flex items-center gap-1`,children:[(0,z.jsx)(L,{className:`w-3 h-3`}),e(`detail.breadcrumbDashboard`)]}),(0,z.jsx)(C,{className:`w-3 h-3`}),(0,z.jsx)(`span`,{className:`text-foreground font-mono`,children:e(`detail.breadcrumbJob`,{id:t?.slice(0,8)})})]}),De&&(0,z.jsx)(le,{tickets:y.tickets??[],onTicketClick:u}),(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`space-y-1 min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsx)(`div`,{children:(0,z.jsx)(h,{variant:Se.variant,children:e(Se.labelKey)})})}),(0,z.jsx)(a,{children:e(Se.tooltipKey)})]}),(0,z.jsx)(`code`,{className:m(`font-mono text-foreground/90 truncate`,De?`text-xs text-muted-foreground`:`text-sm`),children:ie(y.command,o)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground flex-wrap`,children:[(0,z.jsx)(`span`,{children:y.started_at?e(`detail.startedAgo`,{timeAgo:ne(new Date(y.started_at),{addSuffix:!0,locale:g()})}):e(`detail.queuedWaiting`)}),y.model&&(0,z.jsx)(`span`,{className:`text-muted-foreground/40`,children:y.model})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[y.hasTelemetry&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,className:`h-7`,onClick:be,"aria-label":e(`detail.exportDiagnosticAria`),children:[(0,z.jsx)(r,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.exportDiagnostic`)]})}),(0,z.jsx)(a,{children:e(`detail.exportDiagnosticTooltip`)})]}),we&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,onClick:xe,className:`h-7`,children:[(0,z.jsx)(te,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.reExecute`)]})}),(0,z.jsx)(a,{children:e(`detail.reExecuteTooltip`)})]}),Ee&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(c,{variant:`outline`,size:`sm`,onClick:ve,disabled:q,className:`h-7 border-accent-success/40 text-accent-success hover:bg-accent-success/10`,children:[(0,z.jsx)(f,{className:`w-3.5 h-3.5 mr-1.5`}),e(q?`detail.finalizing`:`detail.finalizeJob`)]})}),(0,z.jsx)(a,{children:e(`detail.finalizeJobTooltip`)})]}),Ce&&(0,z.jsxs)(p,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsx)(c,{variant:`outline`,size:`sm`,onClick:_e,className:`h-7 border-destructive/30 text-destructive hover:bg-destructive/10`,children:e(Te?`detail.cancelInteractive`:`detail.cancelJob`)})}),(0,z.jsx)(a,{children:e(`detail.cancelJobTooltip`)})]})]})]}),(0,z.jsx)(ae,{phases:j,phaseDefinitions:k})]}),(y.status===`running`||y.status===`completed`||y.status===`failed`)&&(0,z.jsx)(ce,{job:y,events:D,defaultOpen:y.status===`completed`||y.status===`running`,pipelineTotals:Oe??void 0,phases:j,phaseDefinitions:k}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden relative`,children:(0,z.jsx)(fe,{events:D})}),Ee&&(0,z.jsxs)(`div`,{className:`shrink-0 border-t border-border/40 bg-surface/40 px-3 py-2 space-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between text-[11px] text-muted-foreground`,children:[(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[U&&(0,z.jsx)(b,{className:`w-3 h-3 animate-spin`}),e(U?`detail.interactive.working`:`detail.interactive.ready`)]}),H&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:e(`detail.interactive.liveTotals`,{turns:H.num_turns,cost:H.total_cost_usd.toFixed(4)})})]}),(0,z.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,z.jsx)(`textarea`,{value:G,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),ye())},rows:2,placeholder:e(`detail.interactive.placeholder`),"aria-label":e(`detail.interactive.placeholder`),className:`flex-1 resize-none rounded-md border border-border/50 bg-background px-2.5 py-1.5 text-sm focus:outline-none focus:ring-2 focus:ring-ring`}),(0,z.jsxs)(c,{size:`sm`,onClick:()=>void ye(),disabled:ue||!G.trim(),className:`h-9 shrink-0`,children:[(0,z.jsx)(v,{className:`w-3.5 h-3.5 mr-1.5`}),e(`detail.interactive.send`)]})]})]})]})}export{$ as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-CilyBKbf.js";import{Bt as t,Dt as n,E as r,F as i,G as a,H as o,Ht as s,I as c,J as l,L as u,M as d,N as f,O as p,Ot as m,P as h,R as g,T as _,Tt as v,Ut as y,V as b,Wt as x,bn as ee,gn as S,hn as C,j as w,n as te,nn as T,pt as ne,tn as E,u as D,v as O,wn as k,y as A}from"./index-meTWPBzY.js";import{t as j}from"./ExportDropdown-DdB2ncYh.js";import{t as re}from"./format-command-CMsBTOPN.js";var ie=t(`git-compare-arrows`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M12 6h5a2 2 0 0 1 2 2v7`,key:`1yj91y`}],[`path`,{d:`m15 9-3-3 3-3`,key:`1lwv8l`}],[`circle`,{cx:`19`,cy:`18`,r:`3`,key:`1qljk2`}],[`path`,{d:`M12 18H7a2 2 0 0 1-2-2V9`,key:`16sdep`}],[`path`,{d:`m9 15 3 3-3 3`,key:`1m3kbl`}]]),M=e(k(),1),N=E();function P(e){if(e==null)return`—`;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function F(e){return e==null?`—`:e===0?`$0`:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function I(e){return e==null?`—`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function L({label:e,a:t,b:n,highlight:r}){return(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 py-2 border-b border-border/20 last:border-0 text-xs`,children:[(0,N.jsx)(`span`,{className:`text-muted-foreground`,children:e}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`a`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:t}),(0,N.jsx)(`span`,{className:`font-mono text-right ${r===`b`?`text-emerald-400 aurora-light:text-accent-success font-semibold`:``}`,children:n})]})}function R(e,t,n=!0){return e==null||t==null||e===t?null:n?e<t?`a`:`b`:e>t?`a`:`b`}function ae({jobIds:e,onClose:t}){let{t:r}=S(`jobs`),[i,o]=(0,M.useState)(null),[s,c]=(0,M.useState)(!0),[l,d]=(0,M.useState)(null),{panelRef:f,panelStyle:p,headerHandleProps:h,resizeHandles:_,isFloating:v,guardBackdrop:y}=g();(0,M.useEffect)(()=>{let t=new AbortController;return fetch(`${T()}/jobs/compare?jobIds=${e.join(`,`)}`,{signal:t.signal}).then(e=>{if(!e.ok)throw Error(`HTTP ${e.status}`);return e.json()}).then(e=>{o(e),c(!1)}).catch(e=>{e.name!==`AbortError`&&(d(e.message),c(!1))}),()=>t.abort()},[e]);function b(e,t){return(0,N.jsxs)(`div`,{className:`text-center space-y-1`,children:[(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-medium uppercase tracking-wider`,children:r(`comparison.jobN`,{n:t+1})}),(0,N.jsx)(`code`,{className:`text-[10px] text-foreground/70 block truncate max-w-[160px] mx-auto`,children:e.command}),(0,N.jsxs)(`div`,{className:`flex items-center justify-center gap-1 text-[10px]`,children:[e.status===`completed`?(0,N.jsx)(m,{className:`w-3 h-3 text-emerald-400 aurora-light:text-accent-success`}):(0,N.jsx)(n,{className:`w-3 h-3 text-rose-400 aurora-light:text-destructive`}),(0,N.jsx)(`span`,{className:`capitalize text-muted-foreground`,children:r(`statusLabel.${e.status}`,{defaultValue:e.status})})]}),(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground font-mono`,children:e.id.slice(0,8)})]})}return(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:y(t),children:[(0,N.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:p,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between ${v?`cursor-grab active:cursor-grabbing`:``}`,...h,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold`,children:r(`comparison.title`)}),(0,N.jsx)(`button`,{type:`button`,onClick:t,className:`text-muted-foreground hover:text-foreground transition-colors`,children:(0,N.jsx)(a,{className:`w-4 h-4`})})]}),s&&(0,N.jsx)(`div`,{className:`space-y-2`,children:[0,1,2,3].map(e=>(0,N.jsx)(`div`,{className:`h-8 bg-muted/20 rounded animate-pulse`},e))}),l&&(0,N.jsx)(`p`,{className:`text-xs text-red-400 aurora-light:text-destructive`,children:r(`comparison.loadFailed`,{error:l})}),i&&(()=>{let[e,t]=i.jobs,n=R(e.durationMs,t.durationMs,!0),a=R(e.totalCostUsd,t.totalCostUsd,!0),o=R(e.tokensOut==null?null:e.tokensOut,t.tokensOut==null?null:t.tokensOut,!0);return(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 pb-3 border-b border-border/30 mb-1`,children:[(0,N.jsx)(`div`,{}),b(e,0),b(t,1)]}),(0,N.jsx)(L,{label:r(`comparison.duration`),a:P(e.durationMs),b:P(t.durationMs),highlight:n}),(0,N.jsx)(L,{label:r(`comparison.cost`),a:F(e.totalCostUsd),b:F(t.totalCostUsd),highlight:a}),(0,N.jsx)(L,{label:r(`comparison.tokensOut`),a:I(e.tokensOut),b:I(t.tokensOut),highlight:o}),(0,N.jsx)(L,{label:r(`comparison.tokensIn`),a:I(e.tokensIn),b:I(t.tokensIn),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.cacheRead`),a:I(e.tokensCacheRead),b:I(t.tokensCacheRead),highlight:null}),(0,N.jsx)(L,{label:r(`comparison.model`),a:e.model??`—`,b:t.model??`—`,highlight:null}),(0,N.jsx)(L,{label:r(`comparison.phasesDone`),a:e.phasesCompleted.length>0?e.phasesCompleted.join(`, `):`—`,b:t.phasesCompleted.length>0?t.phasesCompleted.join(`, `):`—`,highlight:null})]})})(),i&&(0,N.jsx)(`p`,{className:`text-[10px] text-muted-foreground/60 text-center`,children:r(`comparison.betterValueHint`)})]}),(0,N.jsx)(u,{handles:_})]})}var z={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`}},oe=[`running`,`completed`,`failed`,`canceled`,`zombie_terminated`,`queued`,`skipped`],B={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 se(e){return e==null||e===0?null:e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(3)}`}function ce(e,t){if(!t)return null;let n=new Date(t).getTime()-new Date(e).getTime();if(n<0)return null;let r=Math.round(n/1e3);if(r<60)return`${r}s`;let i=Math.floor(r/60),a=r%60;return i<60?`${i}m ${a}s`:`${Math.floor(i/60)}h ${i%60}m`}function le(e){return e==null||e===0?null:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ue(e){try{return D(new Date(e),{addSuffix:!0,locale:x()})}catch{return e}}var V=10;function H({jobs:e,isLoading:t,onJobsCleared:n,onProposalClick:a,onProposalDelete:m}){let{t:y}=S(`jobs`),x=ee(),{activeProjectId:te,projects:E}=s(),D=E.find(e=>e.id===te)?.provider,[O,k]=(0,M.useState)(null),[A,j]=(0,M.useState)(``),[P,F]=(0,M.useState)(``),[I,L]=(0,M.useState)(!1),[R,H]=(0,M.useState)(``),[U,W]=(0,M.useState)(``),[G,de]=(0,M.useState)(!1),[K,q]=(0,M.useState)(null),[J,fe]=(0,M.useState)(V),[Y,pe]=(0,M.useState)(!1),[X,Z]=(0,M.useState)([]),[me,Q]=(0,M.useState)(null),{panelRef:he,panelStyle:ge,headerHandleProps:_e,resizeHandles:ve,isFloating:ye,guardBackdrop:be}=g();(0,M.useEffect)(()=>{fe(V)},[e.length]);function xe(){pe(e=>!e),Z([])}function Se(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=>!(O&&e.status!==O||A&&e.started_at<A||P&&e.started_at>`${P}T23:59:59`)),Ce=e.filter(e=>!(R&&e.started_at<R||U&&e.started_at>`${U}T23:59:59`)).length;async function we(e){de(!0);try{let t={};e===`range`&&(R&&(t.from=R),U&&(t.to=U));let r=await fetch(`${T()}/jobs`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)});if(r.ok){let e=await r.json();C.success(y(`recent.toast.cleared`,{count:e.deleted})),L(!1),H(``),W(``),n?.()}else C.error(y(`recent.toast.clearFailed`))}catch{C.error(y(`recent.toast.networkError`))}finally{de(!1)}}return t?(0,N.jsx)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-1`,children:[0,1,2].map(e=>(0,N.jsx)(`div`,{className:`h-9 bg-muted/30 rounded-md animate-pulse`},e))}):e.length===0?(0,N.jsxs)(`div`,{className:`rounded-lg border border-dashed border-border/40 bg-card/50 p-8 text-center space-y-2`,children:[(0,N.jsx)(v,{className:`w-8 h-8 text-muted-foreground/30 mx-auto`}),(0,N.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:y(`recent.emptyTitle`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:y(`recent.emptyDescription`)})]}):(0,N.jsxs)(`div`,{className:`rounded-lg border border-border/40 bg-card/50 p-4 space-y-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>k(null),className:`px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${O===null?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:y(`recent.filterAll`,{count:e.length})}),oe.map(t=>{let n=e.filter(e=>e.status===t).length;return n===0?null:(0,N.jsx)(`button`,{type:`button`,onClick:()=>k(O===t?null:t),className:`px-2 py-0.5 rounded text-[10px] font-medium capitalize transition-colors ${O===t?`bg-accent text-foreground`:`text-muted-foreground hover:text-foreground hover:bg-accent/50`}`,children:y(`recent.filterStatus`,{status:y(`statusName.${t}`),count:n})},t)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:A,onChange:e=>j(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:y(`recent.fromDate`)}),(0,N.jsx)(`input`,{type:`date`,value:P,onChange:e=>F(e.target.value),className:`h-6 rounded border border-border bg-input px-1.5 text-[10px] text-foreground`,title:y(`recent.toDate`)}),(A||P)&&(0,N.jsx)(`button`,{type:`button`,onClick:()=>{j(``),F(``)},className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors`,children:y(`recent.clear`)}),(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(o,{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:xe,children:(0,N.jsx)(ie,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(r,{children:y(Y?`recent.exitCompareMode`:`recent.compareTwoJobs`)})]}),(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(o,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0 text-muted-foreground hover:text-destructive`,onClick:()=>L(!0),children:(0,N.jsx)(l,{className:`w-3.5 h-3.5`})})}),(0,N.jsx)(r,{children:y(`recent.clearJobs`)})]})]})]}),Y&&(0,N.jsxs)(`div`,{className:`flex items-center justify-between rounded-md bg-accent/40 px-3 py-1.5 text-[10px] text-muted-foreground`,children:[(0,N.jsxs)(`span`,{children:[X.length===0&&y(`recent.selectTwoToCompare`),X.length===1&&y(`recent.selectOneMore`),X.length===2&&y(`recent.readyToCompare`)]}),X.length===2&&(0,N.jsx)(`button`,{type:`button`,className:`text-[10px] font-medium text-foreground hover:underline`,onClick:()=>Q(X),children:y(`recent.compareAction`)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-1 text-[10px] font-medium text-muted-foreground uppercase tracking-wider`,children:[(0,N.jsx)(`span`,{className:`w-14`,children:y(`recent.colStatus`)}),(0,N.jsx)(`span`,{className:`flex-1 min-w-0`,children:y(`recent.colCommand`)}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:y(`recent.colDuration`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:y(`recent.colTokens`)}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:y(`recent.colCost`)}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:y(`recent.colStarted`)})]})]}),(0,N.jsx)(`div`,{className:`space-y-0.5`,children:$.slice(0,J).map(e=>{let t=z[e.status]??z.queued,n=se(e.total_cost_usd),i=ce(e.started_at,e.finished_at),o=le((e.tokens_in??0)+(e.tokens_out??0)+(e.tokens_cache_read??0)+(e.tokens_cache_create??0)||null),s=e.id.startsWith(`proposal:`),c=s?e.id.replace(`proposal:`,``):null,u=X.includes(e.id),d=Y&&!s&&X.length===2&&!u;return(0,N.jsxs)(`div`,{role:`button`,tabIndex:0,className:`flex items-center gap-3 px-3 py-2 rounded-md transition-colors cursor-pointer group ${u?`bg-accent/70 ring-1 ring-border`:d?`opacity-40 cursor-not-allowed`:`hover:bg-accent/50`}`,onClick:()=>{if(Y&&!s){Se(e.id);return}s&&c?a?.(c):x(`/jobs/${e.id}`)},children:[(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(`div`,{children:(0,N.jsx)(b,{variant:t.variant,children:y(t.labelKey)})})}),(0,N.jsx)(r,{children:y(t.tooltipKey)})]}),e.priority&&e.priority!==`normal`&&(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border ${B[e.priority].className}`,children:y(B[e.priority].labelKey)}),e.profile_name&&(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(`span`,{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[9px] font-medium border border-accent-primary/40 bg-accent-primary/10 text-accent-primary/90`,children:e.profile_name})}),(0,N.jsx)(r,{children:y(`recent.profileTooltip`,{name:e.profile_name})})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-1 flex-1 min-w-0`,children:[e.pipeline_id&&(0,N.jsxs)(_,{children:[(0,N.jsx)(p,{asChild:!0,children:(0,N.jsx)(ne,{className:`w-3 h-3 text-accent-primary/60 shrink-0`})}),(0,N.jsxs)(r,{children:[y(`recent.pipelinePart`),e.depends_on_job_id&&` ${y(`recent.pipelineDependsOn`)}`,e.skip_reason&&` — ${e.skip_reason}`]})]}),(0,N.jsx)(`code`,{className:`text-xs text-foreground/80 truncate`,children:re(e.command,D)})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 text-[10px] text-muted-foreground shrink-0`,children:[(0,N.jsx)(`span`,{className:`w-14 text-right`,children:i??`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:o?`${o}`:`—`}),(0,N.jsx)(`span`,{className:`w-12 text-right`,children:n??`—`}),(0,N.jsx)(`span`,{className:`w-20 text-right`,children:ue(e.started_at)}),s&&c&&(0,N.jsx)(`button`,{type:`button`,className:`w-4 h-4 md:opacity-0 md:group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all`,onClick:e=>{e.stopPropagation(),q(c)},title:y(`recent.deleteProposal`),children:(0,N.jsx)(l,{className:`w-3 h-3`})})]})]},e.id)})}),$.length>J&&(0,N.jsx)(`div`,{className:`pt-1 text-center`,children:(0,N.jsx)(`button`,{type:`button`,onClick:()=>fe(e=>e+V),className:`text-[10px] text-muted-foreground hover:text-foreground transition-colors px-3 py-1 rounded hover:bg-accent/50`,children:y(`recent.loadMore`,{count:$.length-J})})}),I&&(0,N.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm`,onClick:be(()=>L(!1)),children:[(0,N.jsxs)(`div`,{ref:he,className:`w-80 rounded-xl border border-border/30 bg-popover p-4 shadow-lg space-y-4`,onClick:e=>e.stopPropagation(),style:ge,children:[(0,N.jsxs)(`div`,{..._e,className:ye?`cursor-grab active:cursor-grabbing`:void 0,children:[(0,N.jsx)(`h3`,{className:`text-sm font-semibold`,children:y(`recent.clearModal.title`)}),(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:y(`recent.clearModal.jobsInHistory`,{count:e.length})})]}),(0,N.jsx)(o,{variant:`destructive`,size:`sm`,className:`w-full`,disabled:G,onClick:()=>we(`all`),children:y(`recent.clearModal.clearAll`,{count:e.length})}),(0,N.jsxs)(`div`,{className:`space-y-2`,children:[(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:y(`recent.clearModal.orByRange`)}),(0,N.jsxs)(`div`,{className:`flex gap-2`,children:[(0,N.jsx)(`input`,{type:`date`,value:R,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:y(`recent.clearModal.fromPlaceholder`)}),(0,N.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:y(`recent.clearModal.toPlaceholder`)})]}),(0,N.jsx)(o,{variant:`outline`,size:`sm`,className:`w-full`,disabled:G||!R&&!U,onClick:()=>we(`range`),children:R||U?y(`recent.clearModal.clearInRange`,{count:Ce}):y(`recent.clearModal.clearRange`)})]}),(0,N.jsx)(o,{variant:`ghost`,size:`sm`,className:`w-full`,onClick:()=>L(!1),children:y(`common:actions.cancel`)})]}),(0,N.jsx)(u,{handles:ve})]}),(0,N.jsx)(w,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,N.jsxs)(d,{className:`max-w-sm`,children:[(0,N.jsxs)(i,{children:[(0,N.jsx)(c,{children:y(`recent.deleteProposalConfirm.title`)}),(0,N.jsx)(f,{children:y(`recent.deleteProposalConfirm.description`)})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>q(null),children:y(`common:actions.cancel`)}),(0,N.jsx)(o,{variant:`destructive`,size:`sm`,onClick:()=>{K&&m?.(K),q(null)},children:y(`common:actions.delete`)})]})]})}),me&&(0,N.jsx)(ae,{jobIds:me,onClose:()=>{Q(null),Z([]),pe(!1)}})]})}function U(){let{t:e}=S(`jobs`),{activeProjectId:t}=s(),{recentJobs:n}=te(t),{data:r,isFirstLoad:a,refresh:l}=y({namespace:`jobs`,projectId:t,initialValue:n,fetcher:async()=>{let e=await fetch(`${T()}/jobs?limit=10`);return e.ok?(await e.json()).jobs:[]},pollInterval:1e4}),{data:u}=y({namespace:`proposals`,projectId:t,initialValue:[],fetcher:async()=>{let e=await fetch(`${T()}/propose?limit=10`);return e.ok?(await e.json()).proposals:[]},pollInterval:1e4}),f={input:`queued`,exploring:`running`,review:`running`,refining:`running`,creating_issue:`running`,created:`completed`,cancelled:`canceled`},p=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,status:f[e.status]??`queued`})),m=[...r,...p].sort((e,t)=>new Date(t.started_at).getTime()-new Date(e.started_at).getTime()),[g,_]=(0,M.useState)(null),v=(0,M.useCallback)(async e=>{try{let t=await fetch(`${T()}/propose/${e}`);if(!t.ok)return;_((await t.json()).proposal)}catch{}},[]),x=(0,M.useCallback)(async t=>{try{(await fetch(`${T()}/propose/${t}`,{method:`DELETE`})).ok&&(C.success(e(`page.proposalDeleted`)),l())}catch{}},[l,e]);return(0,N.jsxs)(`div`,{className:`max-w-4xl mx-auto px-4 py-6`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,N.jsx)(`h1`,{className:`text-sm font-semibold`,children:e(`page.title`)}),(0,N.jsx)(j,{baseUrl:`${T()}/jobs/export`,label:e(`page.exportJobs`)})]}),(0,N.jsx)(H,{jobs:m,isLoading:a,onJobsCleared:l,onProposalClick:v,onProposalDelete:x}),(0,N.jsx)(w,{open:g!==null,onOpenChange:e=>!e&&_(null),children:(0,N.jsx)(d,{className:`max-w-3xl glass-card`,children:g&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(i,{children:(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(c,{className:`flex-1 min-w-0`,children:e(`page.proposal.title`)}),(0,N.jsx)(b,{variant:g.status===`created`?`success`:g.status===`cancelled`?`destructive`:`secondary`,children:g.status})]})}),(0,N.jsx)(`div`,{className:`text-xs text-muted-foreground bg-muted/20 rounded px-2 py-1 italic`,children:g.idea}),g.result_markdown?(0,N.jsx)(`div`,{className:`max-h-[400px] overflow-y-auto rounded-lg px-3 py-2 text-xs bg-muted/40`,children:(0,N.jsx)(`div`,{className:`prose prose-invert prose-xs max-w-none prose-p:my-1 prose-headings:mt-2 prose-headings:mb-1 prose-headings:text-sm prose-headings:font-semibold prose-ul:my-1 prose-ol:my-1 prose-li:my-0 prose-code:text-cyan-300 prose-code:text-[10px] prose-code:bg-muted/40 prose-code:px-1 prose-code:py-0.5 prose-code:rounded text-foreground/80`,children:(0,N.jsx)(A,{remarkPlugins:[O],children:g.result_markdown})})}):(0,N.jsx)(`p`,{className:`text-xs text-muted-foreground py-4 text-center`,children:e(`page.proposal.noContent`)}),g.issue_url&&(0,N.jsxs)(`div`,{className:`text-xs`,children:[e(`page.proposal.githubIssue`),` `,(0,N.jsx)(`a`,{href:g.issue_url,target:`_blank`,rel:`noopener noreferrer`,className:`text-accent-primary hover:underline`,children:g.issue_url})]}),(0,N.jsxs)(h,{children:[(0,N.jsx)(o,{variant:`destructive`,size:`sm`,onClick:()=>{x(g.id),_(null)},children:e(`common:actions.delete`)}),(0,N.jsx)(o,{variant:`ghost`,size:`sm`,onClick:()=>_(null),children:e(`common:actions.close`)})]})]})})})]})}export{U as default};
|