@straiffi/archon 1.8.14 → 1.8.15
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/dist/client/assets/{ActivityView-DYDYyqIN.js → ActivityView-DpY9GZez.js} +1 -1
- package/dist/client/assets/{GitHubActionsDialog-jhi4GOyV.js → GitHubActionsDialog-BCr-hjvp.js} +1 -1
- package/dist/client/assets/{RepositoryGraphDialog-BZV0vHu6.js → RepositoryGraphDialog-_hm-x1Dx.js} +1 -1
- package/dist/client/assets/{VerificationDialog-Sc6e8AKH.js → VerificationDialog-CsjDzpE1.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-DFbki8mi.js → architectureDiagram-3BPJPVTR-Dx7MJofM.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-BZFehG8P.js → blockDiagram-GPEHLZMM-CSSJR8F_.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-FVDXRu1t.js → c4Diagram-AAUBKEIU-C4F9969r.js} +1 -1
- package/dist/client/assets/channel-DVkhJzgx.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-4tuVZaT0.js → chunk-2J33WTMH-23HW6i-y.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-DSn14S35.js → chunk-3OPIFGDE-C3ZmRDMb.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-Cwx1KNjg.js → chunk-5ZQYHXKU-B_-UQvCg.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-Odza4hes.js → chunk-727SXJPM-5Dua6u1B.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-BmVoQT7M.js → chunk-AQP2D5EJ-DcpcaFRO.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-Bg7Ktx0B.js → chunk-CSCIHK7Q-CLCpOw52.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-2tnhar2x.js → chunk-KSCS5N6A-uOZFe2JI.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-dAyg8qMJ.js → chunk-L5ZTLDWV-DNnzSNoX.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-0gElxrlR.js → chunk-LZXEDZCA-CSA3Xnoh.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-Bu-8Lz91.js → chunk-ND2GUHAM-BQR5rD7w.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-CInZFdzd.js → chunk-NZK2D7GU-DyIwcQYQ.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-rAzpvdNR.js → chunk-O5CBEL6O-DfW60w5V.js} +1 -1
- package/dist/client/assets/{chunk-WU5MYG2G-DOOw2vq7.js → chunk-WU5MYG2G-CzMMPYdi.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-6oZ93s5p.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DYO_YnkU.js +1 -0
- package/dist/client/assets/{dagre-BM42HDAG-Dgua1iuh.js → dagre-BM42HDAG-Ba7Pz-ZI.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-odacwlwu.js → diagram-2AECGRRQ-BxYfgpZ6.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-BiKjFmJ1.js → diagram-5GNKFQAL-Bc4-O-UJ.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-CmYcvFri.js → diagram-KO2AKTUF-Ds1Lmrzm.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-ncx0RBuX.js → diagram-LMA3HP47-VFQabxKS.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-DbchKIzw.js → diagram-OG6HWLK6-Baff59Zc.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-CMnpvRyQ.js → erDiagram-TEJ5UH35-Da5zHjOK.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-Bi02_PK5.js → flowDiagram-I6XJVG4X-pdGMAuog.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-BiS992US.js → ganttDiagram-6RSMTGT7-DjJGX0nm.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-Cc1hrTsT.js → gitGraphDiagram-PVQCEYII-kErlwtcT.js} +1 -1
- package/dist/client/assets/index-CS4TzG41.css +2 -0
- package/dist/client/assets/{index-B1gdJKwK.js → index-D5TEfELZ.js} +107 -107
- package/dist/client/assets/{infoDiagram-5YYISTIA-BKVfqJCe.js → infoDiagram-5YYISTIA-Bx78HhDi.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-B-IbFOty.js → ishikawaDiagram-YF4QCWOH-BP0YQCMl.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DAZBgAQW.js → journeyDiagram-JHISSGLW-DUgrCOuD.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-Bkr_fXev.js → kanban-definition-UN3LZRKU-K0Zc5_M8.js} +1 -1
- package/dist/client/assets/{line-CROuuXDO.js → line-Dtg-krjk.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-DrBw_Rsc.js → mermaid-parser.core-Dw5BI77W.js} +1 -1
- package/dist/client/assets/{mermaid.core-pPd6OYYj.js → mermaid.core-BE-qlWNj.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-BXSd3TZU.js → mindmap-definition-RKZ34NQL-1Piz4H9I.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-DoT7PIZC.js → pieDiagram-4H26LBE5-zlWdJ7lL.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-ycZkLowm.js → quadrantDiagram-W4KKPZXB-DRQY8Adp.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-BPkO1yLu.js → requirementDiagram-4Y6WPE33-B8_GJFxl.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-D7AvhhCw.js → sankeyDiagram-5OEKKPKP-BaI0Njo8.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-C982swnH.js → sequenceDiagram-3UESZ5HK-DjqAXbRF.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-xvJ3u8lc.js → stateDiagram-AJRCARHV-Ovr_3LeO.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-9pmeAorV.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-D89qjzb5.js → timeline-definition-PNZ67QCA-DkczYKeZ.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-CoKeC__u.js → vennDiagram-CIIHVFJN-BZyo4ESi.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-DKhjzvSE.js → wardleyDiagram-YWT4CUSO-BEISrECX.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-DFn9ass1.js → xychartDiagram-2RQKCTM6-CyNzGK7f.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/db.js +2 -0
- package/dist/server/db.js.map +1 -1
- package/dist/server/index.js +11 -42
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/agent.js +61 -12
- package/dist/server/lib/agent.js.map +1 -1
- package/dist/server/lib/agentProvider.js +13 -3
- package/dist/server/lib/agentProvider.js.map +1 -1
- package/dist/server/lib/agentRuns.js +20 -9
- package/dist/server/lib/agentRuns.js.map +1 -1
- package/dist/server/lib/chatOperations.js +30 -1
- package/dist/server/lib/chatOperations.js.map +1 -1
- package/dist/server/lib/git.js +32 -1
- package/dist/server/lib/git.js.map +1 -1
- package/dist/server/lib/lightweightPrompt.js +1 -0
- package/dist/server/lib/lightweightPrompt.js.map +1 -1
- package/dist/server/lib/opencodeExecutionReliability.js +52 -0
- package/dist/server/lib/opencodeExecutionReliability.js.map +1 -0
- package/dist/server/lib/opencodeSessionOperations.js +21 -11
- package/dist/server/lib/opencodeSessionOperations.js.map +1 -1
- package/dist/server/lib/projectAutoConfig.js +1 -0
- package/dist/server/lib/projectAutoConfig.js.map +1 -1
- package/dist/server/lib/specArtifact.js +19 -0
- package/dist/server/lib/specArtifact.js.map +1 -1
- package/dist/server/lib/specBundleGroups.js +151 -0
- package/dist/server/lib/specBundleGroups.js.map +1 -0
- package/dist/server/lib/specExport.js +1 -0
- package/dist/server/lib/specExport.js.map +1 -1
- package/dist/server/lib/specFormatting.js +13 -0
- package/dist/server/lib/specFormatting.js.map +1 -1
- package/dist/server/lib/specReviewValidation.js +22 -1
- package/dist/server/lib/specReviewValidation.js.map +1 -1
- package/dist/server/lib/specReviews.js +1 -1
- package/dist/server/lib/specSections.js +8 -1
- package/dist/server/lib/specSections.js.map +1 -1
- package/dist/server/lib/specTicketMaterialization.js +119 -0
- package/dist/server/lib/specTicketMaterialization.js.map +1 -0
- package/dist/server/lib/specs.js +27 -5
- package/dist/server/lib/specs.js.map +1 -1
- package/dist/server/lib/types.js.map +1 -1
- package/dist/server/workers/followUp.js +25 -4
- package/dist/server/workers/followUp.js.map +1 -1
- package/dist/server/workers/plan.js +23 -2
- package/dist/server/workers/plan.js.map +1 -1
- package/dist/server/workers/review.js +29 -10
- package/dist/server/workers/review.js.map +1 -1
- package/dist/server/workers/specReview.js +7 -1
- package/dist/server/workers/specReview.js.map +1 -1
- package/dist/server/workers/specSession.js +68 -36
- package/dist/server/workers/specSession.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-D1kOpezG.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-C253nwny.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DFgDA23g.js +0 -1
- package/dist/client/assets/index-CCQwWUKF.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BKQG8NCn.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,pt as t}from"./index-
|
|
1
|
+
import{i as e,pt as t}from"./index-D5TEfELZ.js";var n=t(),r=({projectId:t,onClose:r,onNavigateToLifecycleSource:i,initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c})=>t?(0,n.jsx)(e,{projectId:t,scope:{type:`project`},initialRunId:a,initialEventId:o,onRunSelectionChange:s,onUnavailable:c,onClose:r,onNavigateToLifecycleSource:i}):null;export{r as ActivityView};
|
package/dist/client/assets/{GitHubActionsDialog-jhi4GOyV.js → GitHubActionsDialog-BCr-hjvp.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{C as t,D as n,E as r,F as i,G as a,H as o,I as s,K as c,N as l,S as u,T as d,U as f,V as p,W as m,X as h,Y as g,Z as _,bt as v,d as y,dt as ee,ft as te,gt as b,lt as ne,mt as x,pt as S,ut as re,w as C,x as w}from"./index-B1gdJKwK.js";var T=e(v(),1),E=S(),D=`https://docs.github.com/en/actions`,ie=5e3,O=(e,t)=>u.t(`common:githubActions.${e}`,t),k=e=>O(`status.${e}`),A=e=>e?O(`conclusion.${e}`):null,j=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`||e.conclusion===`timed_out`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e.conclusion===`cancelled`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e.status===`queued`?`border-violet-400/40 bg-violet-500/10 text-violet-200`:`border-border/70 bg-background/60 text-muted-foreground`,M=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`?`border-rose-400/30 bg-rose-500/10 text-rose-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border/70 bg-background/60 text-muted-foreground`,N=e=>{let t=e.run_started_at??e.created_at,n=e.updated_at;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=i-r;if(a<1e3)return`${a} ms`;let o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return s>0?`${s}h ${c}m ${l}s`:c>0?`${c}m ${l}s`:`${(a/1e3).toFixed(a>=1e4?0:1)} s`},P=e=>e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status),F=e=>{let t={};for(let n of e){if(n.type===`boolean`){t[n.name]=n.default===!0;continue}typeof n.default==`string`&&n.default!==``&&(t[n.name]=n.default)}return t},ae=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let a=e.state===`active`,o=t?.dispatchable??!0,c=a&&o&&!t?.isLoading,l=e.path.split(`/`).pop();return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-3 rounded-2xl border px-4 py-3 transition-colors`,n?`border-sky-400/45 bg-sky-500/10`:`border-border/60 bg-background/20 hover:bg-accent/20`),children:[(0,E.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,E.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:l}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,a?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:O(a?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,E.jsxs)(h,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!c,"aria-label":O(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?O(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:O(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:n,refValue:r,onRefChange:a,values:c,onValueChange:l,isDispatching:u,onDispatch:d,onCancel:f})=>{let m=n.inputs.filter(e=>e.required&&!L(c[e.name],e)),g=n.dispatchable&&!n.isLoading&&!n.error&&r.trim()!==``&&m.length===0&&!u;return(0,E.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`inputs.title`)}),(0,E.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":O(`actions.cancel`),onClick:f,children:(0,E.jsx)(t,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(p,{htmlFor:`github-actions-ref`,children:O(`inputs.refLabel`)}),(0,E.jsx)(o,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{a(e.target.value)},placeholder:O(`inputs.refPlaceholder`),"aria-label":O(`inputs.refAriaLabel`)})]}),n.isLoading&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`inputs.loading`)})]}),n.error&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:n.error}),!n.dispatchable&&!n.isLoading&&!n.error&&(0,E.jsx)(`p`,{className:`text-xs text-amber-200`,children:O(`inputs.notDispatchable`)}),n.inputs.map(e=>(0,E.jsx)(R,{input:e,value:c[e.name],onChange:t=>{l(e.name,t)}},e.name)),m.length>0&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:O(`inputs.requiredValidationError`)}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(h,{type:`button`,variant:`ghost`,onClick:f,disabled:u,children:O(`actions.cancel`)}),(0,E.jsxs)(h,{type:`button`,variant:`success`,onClick:d,disabled:!g,children:[u?(0,E.jsx)(s,{className:`h-4 w-4 animate-spin`}):(0,E.jsx)(i,{className:`h-4 w-4`}),(0,E.jsx)(`span`,{children:O(`actions.dispatch`)})]})]})]})},L=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,R=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(p,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{children:e.name}),e.required&&(0,E.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:O(`inputs.requiredLabel`)})]}),e.description&&(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),z(e,r,t,n)]})},z=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(y,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(i?`inputs.booleanYes`:`inputs.booleanNo`)})]})}if(e.type===`choice`){let i=e.options??[],a=typeof n==`string`?n:typeof e.default==`string`?e.default:``;return(0,E.jsxs)(`select`,{id:t,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 px-3 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,value:a,onChange:e=>{r(e.target.value)},children:[a===``&&(0,E.jsx)(`option`,{value:``,children:O(`inputs.selectPlaceholder`)}),i.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]})}return(0,E.jsx)(o,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},B=({job:e})=>e.steps.length===0?null:(0,E.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(t)),children:t.status===`completed`?A(t.conclusion)??O(`status.completed`):k(t.status)}),(0,E.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=N(e),n=P(e);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,j(e)),children:n})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,E.jsxs)(`a`,{href:e.html_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-sky-200 hover:text-sky-100`,children:[O(`actions.openOnGithub`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,E.jsxs)(`div`,{className:`mt-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(e)),children:e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status)}),(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,E.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??O(`runs.trackingState.${e.state}`);return(0,E.jsxs)(`div`,{className:_(`flex items-start gap-2 rounded-2xl border px-4 py-3`,t?`border-border/60 bg-background/20`:`border-red-400/25 bg-red-500/8`),children:[t&&(0,E.jsx)(s,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:_(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,E.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??O(`runs.unknownRef`)})]})]})},U=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||(e.updated_at??``)>=(t.updated_at??``))&&n.set(e.id,e)}return[...n.values()]},W=(e,t)=>{let n=new Map(e.map(e=>[e.execution_run_id,e]));for(let e of t){let t=n.get(e.execution_run_id),r=t&&![`queued`,`waiting`,`running`].includes(t.execution_status),i=[`queued`,`waiting`,`running`].includes(e.execution_status);(!r||!i)&&n.set(e.execution_run_id,e)}return[...n.values()]},oe=(e,t,n)=>{let r=t.filter(e=>e.run===null),i=new Set(r.map(e=>e.tracking_key));return W(e.filter(e=>i.has(e.tracking_key)||n.get(e.tracking_key)?.run===null),r.filter(e=>!n.has(e.tracking_key)))},se=e=>({ref:e??`main`}),G=({projectId:e,defaultBranch:i,onClose:o})=>{let[u,p]=(0,T.useState)([]),[_,v]=(0,T.useState)(!0),[y,S]=(0,T.useState)(null),[w,k]=(0,T.useState)([]),[A,j]=(0,T.useState)([]),[M,N]=(0,T.useState)({}),[P,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B]=(0,T.useState)(()=>se(i)),W=(0,T.useRef)({}),G=(0,T.useRef)({}),K=(0,T.useRef)(null),q=(0,T.useRef)(!1),J=(0,T.useRef)(0),Y=(0,T.useRef)(new Map),X=(0,T.useCallback)(async t=>{N(e=>{let n=e[t.id];return n?.isLoading?e:{...e,[t.id]:{inputs:n?.inputs??[],dispatchable:n?.dispatchable??!0,isLoading:!0,error:null}}});try{let n=await re(e,t.id,t.path);return N(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return N(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof x?e.message:O(`workflows.loadError`)}})),null}},[e]),Z=(0,T.useCallback)(async()=>{v(!0),S(null);try{let t=await te(e);p(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){S(e instanceof x?e.message:O(`workflows.loadError`))}finally{v(!1)}},[X,e]),Q=(0,T.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await ee(e,t);k(e=>U(e,r.runs)),j(e=>{let t=new Map([...Y.current.entries()].filter(([,e])=>e.revision>n).map(([e,t])=>[e,t.event]));return oe(e,r.tracked_runs??[],t)})}catch(e){b(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,T.useEffect)(()=>{Z()},[Z]),(0,T.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,ie),i=r(t);return()=>{e.abort(),window.clearInterval(n),i()}},[Q]);let ce=(0,T.useCallback)(async e=>{if(P?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=M[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:F(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:F(n.inputs)})},[B.ref,M,X,P]),le=(0,T.useCallback)(async()=>{if(!P)return;let t=M[P.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=P.values[e.name];e.type===`boolean`?n[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?n[e.name]=t:typeof e.default==`string`&&e.default!==``&&(n[e.name]=e.default)}try{await ne(e,P.workflow.id,{ref:P.ref,workflowName:P.workflow.name,workflowUrl:P.workflow.url,inputs:n}),l.success(O(`messages.dispatched`)),L(null),Q()}catch(e){l.error(e instanceof x?e.message:O(`messages.dispatchError`))}finally{z(!1)}},[M,Q,e,P]);(0,T.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),j(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&k(e=>U(e,[t.run])))};return d.on(`github-actions:updated`,t),()=>{d.off(`github-actions:updated`,t)}},[e]),(0,T.useEffect)(()=>{let e=P?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[P?.workflow.id]);let $=(0,T.useMemo)(()=>[...w].sort((e,t)=>{let n=e.updated_at?Date.parse(e.updated_at):0;return(t.updated_at?Date.parse(t.updated_at):0)-n}),[w]);return(0,E.jsx)(f,{open:!0,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(a,{showCloseButton:!1,overlayClassName:`bg-black/70`,className:`flex h-[calc(100vh-2rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl border border-[#2a2a38] bg-[#16161f] p-0 shadow-2xl sm:max-w-5xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,E.jsx)(g,{className:`sr-only`,children:O(`dialog.srTitle`)}),(0,E.jsx)(c,{className:`sr-only`,children:O(`dialog.srDescription`)}),(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-violet-200`,children:(0,E.jsx)(n,{className:`h-5 w-5`})}),(0,E.jsx)(`div`,{children:(0,E.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:O(`dialog.title`)})})]}),(0,E.jsx)(m,{asChild:!0,children:(0,E.jsx)(h,{type:`button`,"aria-label":O(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(t,{className:`h-4 w-4`})})})]}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,E.jsxs)(`aside`,{"aria-label":O(`workflows.ariaLabel`),className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`workflows.title`)}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:O(`actions.refresh`)})]}),_&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`workflows.loading`)})]}),y&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:y}),!_&&u.length===0&&!y&&(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:[(0,E.jsx)(`p`,{children:O(`workflows.empty`)}),(0,E.jsx)(`p`,{className:`mt-1`,children:O(`workflows.emptyHint`)}),(0,E.jsxs)(`a`,{href:D,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[O(`workflows.docsLink`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]}),(0,E.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=P?.workflow.id===e.id;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,E.jsx)(ae,{workflow:e,inputsState:M[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&P&&(0,E.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,E.jsx)(I,{workflow:e,inputsState:M[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:P.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:P.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`runs.title`)}),A.map(e=>(0,E.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,E.jsx)(V,{run:e},e.id)),$.length===0&&A.length===0&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:O(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{C as t,D as n,E as r,F as i,G as a,H as o,I as s,K as c,N as l,S as u,T as d,U as f,V as p,W as m,X as h,Y as g,Z as _,bt as v,d as y,dt as ee,ft as te,gt as b,lt as ne,mt as x,pt as S,ut as re,w as C,x as w}from"./index-D5TEfELZ.js";var T=e(v(),1),E=S(),D=`https://docs.github.com/en/actions`,ie=5e3,O=(e,t)=>u.t(`common:githubActions.${e}`,t),k=e=>O(`status.${e}`),A=e=>e?O(`conclusion.${e}`):null,j=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`||e.conclusion===`timed_out`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e.conclusion===`cancelled`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e.status===`queued`?`border-violet-400/40 bg-violet-500/10 text-violet-200`:`border-border/70 bg-background/60 text-muted-foreground`,M=e=>e.status===`completed`?e.conclusion===`success`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.conclusion===`failure`?`border-rose-400/30 bg-rose-500/10 text-rose-200`:`border-border/70 bg-background/60 text-muted-foreground`:e.status===`in_progress`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border/70 bg-background/60 text-muted-foreground`,N=e=>{let t=e.run_started_at??e.created_at,n=e.updated_at;if(!t||!n)return null;let r=Date.parse(t),i=Date.parse(n);if(!Number.isFinite(r)||!Number.isFinite(i)||i<r)return null;let a=i-r;if(a<1e3)return`${a} ms`;let o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60;return s>0?`${s}h ${c}m ${l}s`:c>0?`${c}m ${l}s`:`${(a/1e3).toFixed(a>=1e4?0:1)} s`},P=e=>e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status),F=e=>{let t={};for(let n of e){if(n.type===`boolean`){t[n.name]=n.default===!0;continue}typeof n.default==`string`&&n.default!==``&&(t[n.name]=n.default)}return t},ae=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let a=e.state===`active`,o=t?.dispatchable??!0,c=a&&o&&!t?.isLoading,l=e.path.split(`/`).pop();return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-3 rounded-2xl border px-4 py-3 transition-colors`,n?`border-sky-400/45 bg-sky-500/10`:`border-border/60 bg-background/20 hover:bg-accent/20`),children:[(0,E.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,E.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:l}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,a?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:O(a?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,E.jsxs)(h,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!c,"aria-label":O(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?O(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}):(0,E.jsx)(i,{className:`h-3.5 w-3.5`}),(0,E.jsx)(`span`,{children:O(`actions.run`)})]})]})]})},I=({workflow:e,inputsState:n,refValue:r,onRefChange:a,values:c,onValueChange:l,isDispatching:u,onDispatch:d,onCancel:f})=>{let m=n.inputs.filter(e=>e.required&&!L(c[e.name],e)),g=n.dispatchable&&!n.isLoading&&!n.error&&r.trim()!==``&&m.length===0&&!u;return(0,E.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`inputs.title`)}),(0,E.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":O(`actions.cancel`),onClick:f,children:(0,E.jsx)(t,{className:`h-4 w-4`})})]}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(p,{htmlFor:`github-actions-ref`,children:O(`inputs.refLabel`)}),(0,E.jsx)(o,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{a(e.target.value)},placeholder:O(`inputs.refPlaceholder`),"aria-label":O(`inputs.refAriaLabel`)})]}),n.isLoading&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`inputs.loading`)})]}),n.error&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:n.error}),!n.dispatchable&&!n.isLoading&&!n.error&&(0,E.jsx)(`p`,{className:`text-xs text-amber-200`,children:O(`inputs.notDispatchable`)}),n.inputs.map(e=>(0,E.jsx)(R,{input:e,value:c[e.name],onChange:t=>{l(e.name,t)}},e.name)),m.length>0&&(0,E.jsx)(`p`,{className:`text-xs text-rose-200`,children:O(`inputs.requiredValidationError`)}),(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,E.jsx)(h,{type:`button`,variant:`ghost`,onClick:f,disabled:u,children:O(`actions.cancel`)}),(0,E.jsxs)(h,{type:`button`,variant:`success`,onClick:d,disabled:!g,children:[u?(0,E.jsx)(s,{className:`h-4 w-4 animate-spin`}):(0,E.jsx)(i,{className:`h-4 w-4`}),(0,E.jsx)(`span`,{children:O(`actions.dispatch`)})]})]})]})},L=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,R=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(p,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{children:e.name}),e.required&&(0,E.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:O(`inputs.requiredLabel`)})]}),e.description&&(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),z(e,r,t,n)]})},z=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(y,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,E.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:O(i?`inputs.booleanYes`:`inputs.booleanNo`)})]})}if(e.type===`choice`){let i=e.options??[],a=typeof n==`string`?n:typeof e.default==`string`?e.default:``;return(0,E.jsxs)(`select`,{id:t,className:`h-9 w-full rounded-lg border border-border/70 bg-background/60 px-3 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,value:a,onChange:e=>{r(e.target.value)},children:[a===``&&(0,E.jsx)(`option`,{value:``,children:O(`inputs.selectPlaceholder`)}),i.map(e=>(0,E.jsx)(`option`,{value:e,children:e},e))]})}return(0,E.jsx)(o,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},B=({job:e})=>e.steps.length===0?null:(0,E.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(t)),children:t.status===`completed`?A(t.conclusion)??O(`status.completed`):k(t.status)}),(0,E.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),V=({run:e})=>{let t=N(e),n=P(e);return(0,E.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,j(e)),children:n})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,E.jsxs)(`a`,{href:e.html_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-[11px] text-sky-200 hover:text-sky-100`,children:[O(`actions.openOnGithub`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,E.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,E.jsxs)(`div`,{className:`mt-2`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(w,{variant:`outline`,className:_(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,j(e)),children:e.status===`completed`?A(e.conclusion)??O(`status.completed`):k(e.status)}),(0,E.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,E.jsx)(B,{job:e})]},e.id))]})},H=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??O(`runs.trackingState.${e.state}`);return(0,E.jsxs)(`div`,{className:_(`flex items-start gap-2 rounded-2xl border px-4 py-3`,t?`border-border/60 bg-background/20`:`border-red-400/25 bg-red-500/8`),children:[t&&(0,E.jsx)(s,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsx)(`span`,{className:_(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,E.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??O(`runs.unknownRef`)})]})]})},U=(e,t)=>{let n=new Map(e.map(e=>[e.id,e]));for(let e of t){let t=n.get(e.id);(!t||(e.updated_at??``)>=(t.updated_at??``))&&n.set(e.id,e)}return[...n.values()]},W=(e,t)=>{let n=new Map(e.map(e=>[e.execution_run_id,e]));for(let e of t){let t=n.get(e.execution_run_id),r=t&&![`queued`,`waiting`,`running`].includes(t.execution_status),i=[`queued`,`waiting`,`running`].includes(e.execution_status);(!r||!i)&&n.set(e.execution_run_id,e)}return[...n.values()]},oe=(e,t,n)=>{let r=t.filter(e=>e.run===null),i=new Set(r.map(e=>e.tracking_key));return W(e.filter(e=>i.has(e.tracking_key)||n.get(e.tracking_key)?.run===null),r.filter(e=>!n.has(e.tracking_key)))},se=e=>({ref:e??`main`}),G=({projectId:e,defaultBranch:i,onClose:o})=>{let[u,p]=(0,T.useState)([]),[_,v]=(0,T.useState)(!0),[y,S]=(0,T.useState)(null),[w,k]=(0,T.useState)([]),[A,j]=(0,T.useState)([]),[M,N]=(0,T.useState)({}),[P,L]=(0,T.useState)(null),[R,z]=(0,T.useState)(!1),[B]=(0,T.useState)(()=>se(i)),W=(0,T.useRef)({}),G=(0,T.useRef)({}),K=(0,T.useRef)(null),q=(0,T.useRef)(!1),J=(0,T.useRef)(0),Y=(0,T.useRef)(new Map),X=(0,T.useCallback)(async t=>{N(e=>{let n=e[t.id];return n?.isLoading?e:{...e,[t.id]:{inputs:n?.inputs??[],dispatchable:n?.dispatchable??!0,isLoading:!0,error:null}}});try{let n=await re(e,t.id,t.path);return N(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return N(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof x?e.message:O(`workflows.loadError`)}})),null}},[e]),Z=(0,T.useCallback)(async()=>{v(!0),S(null);try{let t=await te(e);p(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){S(e instanceof x?e.message:O(`workflows.loadError`))}finally{v(!1)}},[X,e]),Q=(0,T.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await ee(e,t);k(e=>U(e,r.runs)),j(e=>{let t=new Map([...Y.current.entries()].filter(([,e])=>e.revision>n).map(([e,t])=>[e,t.event]));return oe(e,r.tracked_runs??[],t)})}catch(e){b(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,T.useEffect)(()=>{Z()},[Z]),(0,T.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,ie),i=r(t);return()=>{e.abort(),window.clearInterval(n),i()}},[Q]);let ce=(0,T.useCallback)(async e=>{if(P?.workflow.id===e.id)return;K.current=e.id,L({workflow:e,ref:B.ref,values:{}});let t=M[e.id];if(t&&!t.isLoading&&!t.error){L(n=>!n||n.workflow.id!==e.id?n:{...n,values:F(t.inputs)});return}let n=await X(e);n&&L(t=>!t||t.workflow.id!==e.id?t:{...t,values:F(n.inputs)})},[B.ref,M,X,P]),le=(0,T.useCallback)(async()=>{if(!P)return;let t=M[P.workflow.id];if(!t||!t.dispatchable)return;z(!0);let n={};for(let e of t.inputs){let t=P.values[e.name];e.type===`boolean`?n[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?n[e.name]=t:typeof e.default==`string`&&e.default!==``&&(n[e.name]=e.default)}try{await ne(e,P.workflow.id,{ref:P.ref,workflowName:P.workflow.name,workflowUrl:P.workflow.url,inputs:n}),l.success(O(`messages.dispatched`)),L(null),Q()}catch(e){l.error(e instanceof x?e.message:O(`messages.dispatchError`))}finally{z(!1)}},[M,Q,e,P]);(0,T.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),j(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&k(e=>U(e,[t.run])))};return d.on(`github-actions:updated`,t),()=>{d.off(`github-actions:updated`,t)}},[e]),(0,T.useEffect)(()=>{let e=P?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[P?.workflow.id]);let $=(0,T.useMemo)(()=>[...w].sort((e,t)=>{let n=e.updated_at?Date.parse(e.updated_at):0;return(t.updated_at?Date.parse(t.updated_at):0)-n}),[w]);return(0,E.jsx)(f,{open:!0,onOpenChange:e=>{e||o()},children:(0,E.jsxs)(a,{showCloseButton:!1,overlayClassName:`bg-black/70`,className:`flex h-[calc(100vh-2rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl border border-[#2a2a38] bg-[#16161f] p-0 shadow-2xl sm:max-w-5xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,E.jsx)(g,{className:`sr-only`,children:O(`dialog.srTitle`)}),(0,E.jsx)(c,{className:`sr-only`,children:O(`dialog.srDescription`)}),(0,E.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,E.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-violet-200`,children:(0,E.jsx)(n,{className:`h-5 w-5`})}),(0,E.jsx)(`div`,{children:(0,E.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:O(`dialog.title`)})})]}),(0,E.jsx)(m,{asChild:!0,children:(0,E.jsx)(h,{type:`button`,"aria-label":O(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,E.jsx)(t,{className:`h-4 w-4`})})})]}),(0,E.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,E.jsxs)(`aside`,{"aria-label":O(`workflows.ariaLabel`),className:`flex min-h-0 flex-col gap-3 overflow-y-auto border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`workflows.title`)}),(0,E.jsx)(h,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:O(`actions.refresh`)})]}),_&&(0,E.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,E.jsx)(s,{className:`h-3.5 w-3.5 animate-spin`}),(0,E.jsx)(`span`,{children:O(`workflows.loading`)})]}),y&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:y}),!_&&u.length===0&&!y&&(0,E.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:[(0,E.jsx)(`p`,{children:O(`workflows.empty`)}),(0,E.jsx)(`p`,{className:`mt-1`,children:O(`workflows.emptyHint`)}),(0,E.jsxs)(`a`,{href:D,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[O(`workflows.docsLink`),(0,E.jsx)(C,{className:`h-3 w-3`})]})]}),(0,E.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=P?.workflow.id===e.id;return(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,E.jsx)(ae,{workflow:e,inputsState:M[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&P&&(0,E.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,E.jsx)(I,{workflow:e,inputsState:M[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:P.ref,onRefChange:e=>{L(t=>t&&{...t,ref:e})},values:P.values,onValueChange:(e,t)=>{L(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:R,onDispatch:()=>{le()},onCancel:()=>{L(null)}})})]},e.id)})})]}),(0,E.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,E.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:O(`runs.title`)}),A.map(e=>(0,E.jsx)(H,{tracked:e},e.tracking_key)),$.map(e=>(0,E.jsx)(V,{run:e},e.id)),$.length===0&&A.length===0&&(0,E.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:O(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
|
package/dist/client/assets/{RepositoryGraphDialog-BZV0vHu6.js → RepositoryGraphDialog-_hm-x1Dx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,G as n,H as r,I as i,J as a,K as ee,U as te,V as ne,X as o,Y as re,bt as ie,gt as s,ht as c,l as ae,mt as l,pt as u,q as oe,r as se,vt as d,yt as ce}from"./index-B1gdJKwK.js";var f=e(ie(),1),p=e=>({target_kind:e.kind,...e.kind===`bundle`?{bundle_id:e.bundle_id}:{}}),m=(e,t)=>{let n=new URL(c(e));return n.searchParams.set(`target_kind`,t.kind),t.kind===`bundle`&&t.bundle_id&&n.searchParams.set(`bundle_id`,t.bundle_id),n},le=(e,t,n={})=>d(m(`/projects/${encodeURIComponent(e)}/repository-graph/status`,t).toString(),{signal:n.signal}),ue=(e,t,n={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans`),{method:`POST`,body:p(t),signal:n.signal}),de=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/cancel`),{method:`POST`,body:p(t),signal:r.signal}),fe=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/retry`),{method:`POST`,body:p(t),signal:r.signal}),pe=(e,t,n,r,i)=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/path-impact`,t);return a.searchParams.set(`scan_id`,n),a.searchParams.set(`path`,r),a.searchParams.set(`direction`,i.direction),a.searchParams.set(`depth`,`1`),a.searchParams.set(`limit`,String(i.limit??50)),d(a.toString(),{signal:i.signal})},me=(e,t,n,r,i={})=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/edges/${encodeURIComponent(r)}/explanation`,t);return a.searchParams.set(`scan_id`,n),d(a.toString(),{signal:i.signal})},h=u(),g=new Set([`pending`,`running`]),he=new Set([`failed`,`cancelled`,`interrupted`]),ge=e=>!(e instanceof l)||typeof e.data!=`object`||e.data===null||!(`reason`in e.data)?null:typeof e.data.reason==`string`?e.data.reason:null,_e=e=>e===`deterministic`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-500/30 bg-amber-500/10 text-amber-200`:`border-violet-500/30 bg-violet-500/10 text-violet-200`,ve=2e3,ye=600,_=12,be=e=>({kind:e.kind,bundle_id:e.kind===`bundle`?e.bundle_id:null,ticket_id:null}),xe=(e,n)=>{let r=n.trim();return!e||!r?[]:e.entries.filter(e=>e.status!==`deleted`).map(e=>({entry:e,score:t(r,[e.path])})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||e.entry.path.localeCompare(t.entry.path)).slice(0,_).map(e=>e.entry)},v=({projectId:e,target:t,targetLabel:ie,canRunOperations:c=!0,onClose:l})=>{let{t:u}=ce(`common`,{keyPrefix:`repositoryGraphDialog`}),d=ae(),[p,m]=(0,f.useState)(null),[_,v]=(0,f.useState)(!1),[Se,y]=(0,f.useState)(!0),[b,x]=(0,f.useState)(null),[S,Ce]=(0,f.useState)(!1),[C,we]=(0,f.useState)(``),[Te,w]=(0,f.useState)(null),[T,Ee]=(0,f.useState)(`combined`),[E,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[je,M]=(0,f.useState)(0),[N,P]=(0,f.useState)({}),F=(0,f.useRef)(null),I=(0,f.useRef)(0),L=(0,f.useRef)(null),R=(0,f.useRef)(null),z=(0,f.useRef)(0),B=(0,f.useRef)(null),V=(0,f.useRef)(0),H=(0,f.useRef)(new Map),U=(0,f.useCallback)(e=>{m(t=>t&&t.scan.scan_sequence>e.scan.scan_sequence?t:e),v(!1)},[]),W=(0,f.useCallback)(async()=>{let n=I.current+1;I.current=n,F.current?.abort();let r=new AbortController;F.current=r,y(!0),x(null);try{let i=await le(e,t,{signal:r.signal});I.current===n&&!r.signal.aborted&&U(i)}catch(e){if(s(e)||r.signal.aborted||I.current!==n)return;ge(e)===`scan_not_found`?(m(null),v(!0)):(v(!1),x(u(`errors.status`)))}finally{I.current===n&&!r.signal.aborted&&y(!1)}},[U,e,u,t]);(0,f.useEffect)(()=>{W()},[W]);let G=p?.scan??null;(0,f.useEffect)(()=>{if(!G||!g.has(G.status))return;let e=window.setInterval(()=>void W(),ve);return()=>window.clearInterval(e)},[W,G]),(0,f.useEffect)(()=>{let n=n=>n.project_id===e&&n.target_kind===t.kind&&(t.kind!==`bundle`||n.target_bundle_id===t.bundle_id),r=e=>{n(e)&&W()},i=()=>{W()};return d.on(`repository-graph-scan:updated`,r),d.on(`connect`,i),()=>{d.off(`repository-graph-scan:updated`,r),d.off(`connect`,i)}},[W,e,d,t.bundle_id,t.kind]),(0,f.useEffect)(()=>()=>{F.current?.abort(),L.current?.abort(),R.current?.abort(),B.current?.abort(),H.current.forEach(e=>e.abort()),H.current.clear()},[]);let K=async e=>{L.current?.abort(),F.current?.abort();let t=I.current+1;I.current=t;let n=new AbortController;L.current=n,Ce(!0),x(null);try{let r=await e(n.signal);!n.signal.aborted&&I.current===t&&(U(r),y(!1))}catch(e){!s(e)&&!n.signal.aborted&&x(u(`errors.operation`))}finally{n.signal.aborted||Ce(!1)}},q=G?.id??null,J=G?.status===`completed`,Y=C.trim(),X=(0,f.useDeferredValue)(C),Z=(0,f.useMemo)(()=>xe(O,X),[X,O]),Me=O?.entries.find(e=>e.status!==`deleted`&&e.path===Y)?.path??null,Ne=Y.includes(`/`)||/(^|\/)[^/]+\.[^/]+$/.test(Y),Q=Te??Me??(Ne?Y:``),$=Z.length===0?0:Math.min(je,Z.length-1);(0,f.useEffect)(()=>{B.current?.abort();let n=V.current+1;if(V.current=n,k(null),j(!1),!q||!J)return;let r=new AbortController;return B.current=r,j(!0),se(e,be(t),r.signal).then(e=>{!r.signal.aborted&&V.current===n&&k(e)}).catch(e=>{s(e)||r.signal.aborted||V.current!==n||k(null)}).finally(()=>{!r.signal.aborted&&V.current===n&&j(!1)}),()=>r.abort()},[J,e,q,t,t.bundle_id,t.kind]),(0,f.useEffect)(()=>{R.current?.abort();let n=z.current+1;if(z.current=n,H.current.forEach(e=>e.abort()),H.current.clear(),De(null),ke(null),P({}),!q||!J||!Q){D(!1);return}let r=new AbortController;R.current=r,D(!0);let i=window.setTimeout(()=>{pe(e,t,q,Q,{direction:T,limit:50,signal:r.signal}).then(e=>{!r.signal.aborted&&z.current===n&&De(e)}).catch(e=>{s(e)||r.signal.aborted||z.current!==n||ke(ge(e)===`path_not_found`?u(`errors.pathNotFound`):u(`errors.impact`))}).finally(()=>{!r.signal.aborted&&z.current===n&&D(!1)})},ye);return()=>{window.clearTimeout(i),r.abort()}},[J,T,Q,e,q,u,t]);let Pe=e=>{we(e),w(e),M(0)},Fe=e=>{if(e.key===`ArrowDown`&&Z.length>0){e.preventDefault(),M(e=>Math.min(e+1,Z.length-1));return}if(e.key===`ArrowUp`&&Z.length>0){e.preventDefault(),M(e=>Math.max(e-1,0));return}if(e.key===`Enter`){let t=Z[$];if(t){e.preventDefault(),Pe(t.path);return}Y&&(Ne||!O)&&(e.preventDefault(),w(Y))}},Ie=(n,r)=>{if(!r.currentTarget.open||N[n]?.state===`loading`||N[n]?.state===`loaded`||!q)return;let i=new AbortController,a=z.current;H.current.set(n,i),P(e=>({...e,[n]:{state:`loading`}})),me(e,t,q,n,{signal:i.signal}).then(e=>{!i.signal.aborted&&z.current===a&&P(t=>({...t,[n]:{state:`loaded`,response:e}}))}).catch(e=>{!s(e)&&!i.signal.aborted&&z.current===a&&P(e=>({...e,[n]:{state:`error`}}))}).finally(()=>{H.current.get(n)===i&&H.current.delete(n)})},Le=G?G.status===`pending`?`queued`:G.status===`completed`&&p?.freshness.state===`stale`?`stale`:G.status===`completed`&&p?.freshness.state===`unavailable`?`completeUnverified`:G.status===`completed`&&p?.freshness.is_current||G.status===`completed`?`complete`:G.status:_?`neverScanned`:`unknown`,Re=u(G?`refreshScan`:`startScan`),ze=!!G||_,Be=E?.paths.filter(e=>e.depth>0)??[];return(0,h.jsx)(te,{open:!0,onOpenChange:e=>{e||l()},children:(0,h.jsxs)(n,{showCloseButton:!1,overlayClassName:`z-[80]`,className:`z-[80] h-[calc(100vh-2rem)] max-h-[720px] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-4xl`,children:[(0,h.jsx)(a,{className:`border-b border-border/70 px-5 py-4 pr-6 sm:px-6`,children:(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(re,{children:u(`title`)}),(0,h.jsx)(ee,{className:`mt-1 break-words`,children:u(`target`,{target:ie})})]}),(0,h.jsxs)(o,{type:`button`,disabled:!c||!ze||Se||S||!!b||!!(G&&g.has(G.status)),onClick:()=>{K(n=>ue(e,t,{signal:n}))},children:[S&&(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),Re]})]})}),(0,h.jsxs)(`div`,{"data-testid":`repository-graph-scroll-region`,className:`min-h-0 space-y-6 overflow-y-auto px-5 py-5 sm:px-6`,children:[(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-status-title`,className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{id:`repository-graph-status-title`,className:`font-heading text-sm font-semibold`,children:u(`status.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,"aria-live":`polite`,children:u(Se?`status.loading`:`status.${Le}`)})]}),G&&g.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>de(e,t,G.id,{signal:n}))},children:u(`cancelScan`)}),G&&G.execution_run_id&&he.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>fe(e,t,G.id,{signal:n}))},children:u(`retryScan`)})]}),b&&(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-sm text-destructive`,role:`alert`,children:[(0,h.jsx)(`span`,{children:b}),(0,h.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void W(),children:u(`retryLoad`)})]}),G&&(0,h.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.files`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.admitted_file_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.relationships`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.edge_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.diagnostics`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.diagnostic_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.analyzer`)}),(0,h.jsxs)(`dd`,{className:`mt-1 font-mono text-sm`,children:[`v`,p?.analyzer_version]})]})]}),p?.truncation.scan&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`truncatedScan`)}),p?.freshness.state===`unavailable`&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`freshnessUnavailable`)}),p&&p.diagnostic_summary.total_count>0&&(0,h.jsxs)(`details`,{className:`mt-4 rounded-lg border border-border/60 p-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:u(`diagnostics.show`,{count:p.diagnostic_summary.total_count})}),(0,h.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.diagnostic_summary.diagnostics.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-xs leading-5 text-muted-foreground`,children:[(0,h.jsx)(`span`,{className:`font-medium text-foreground`,children:e.code}),e.path&&(0,h.jsxs)(`span`,{children:[` · `,e.path]}),(0,h.jsx)(`p`,{className:`break-words`,children:e.message})]},`${e.code}-${e.path??``}-${t}`))}),p.diagnostic_summary.truncated&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`diagnostics.truncated`)})]})]}),(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-relationship-title`,children:[(0,h.jsx)(`h3`,{id:`repository-graph-relationship-title`,className:`font-heading text-sm font-semibold`,children:u(`relationships.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u(`relationships.description`)}),(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(ne,{htmlFor:`repository-graph-path`,children:u(`relationships.pathLabel`)}),(0,h.jsxs)(`div`,{className:`relative mt-2`,children:[(0,h.jsx)(r,{id:`repository-graph-path`,type:`search`,value:C,disabled:!J,onChange:e=>{we(e.target.value),w(null),M(0)},onKeyDown:Fe,placeholder:u(`relationships.pathPlaceholder`),"aria-autocomplete":`list`,"aria-controls":`repository-graph-path-suggestions`,"aria-activedescendant":Z.length>0?`repository-graph-path-suggestion-${$}`:void 0}),J&&X.trim()&&Te!==Y&&(A||O)&&(0,h.jsxs)(`div`,{id:`repository-graph-path-suggestions`,role:`listbox`,className:`absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-lg`,children:[A&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.suggestionsLoading`)}),!A&&O&&Z.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.noSuggestions`)}),Z.map((e,t)=>(0,h.jsx)(`button`,{id:`repository-graph-path-suggestion-${t}`,type:`button`,role:`option`,"aria-selected":t===$,className:`block w-full rounded-md px-3 py-2 text-left font-mono text-xs ${t===$?`bg-accent text-accent-foreground`:`text-foreground hover:bg-muted`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>Pe(e.path),children:e.path},e.path))]})]})]}),(0,h.jsxs)(`fieldset`,{className:`mt-4`,disabled:!J,children:[(0,h.jsx)(`legend`,{className:`text-sm font-medium`,children:u(`relationships.direction`)}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-4`,children:[`combined`,`incoming`,`outgoing`].map(e=>(0,h.jsxs)(ne,{className:`flex items-center gap-2 text-sm`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`repository-graph-direction`,checked:T===e,onChange:()=>Ee(e)}),u(`relationships.directions.${e}`)]},e))})]}),!J&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.unavailable`)}),Ae&&(0,h.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),u(`relationships.loading`)]}),Oe&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-destructive`,role:`alert`,children:Oe}),E?.truncation.query&&(0,h.jsx)(`p`,{className:`mt-4 text-xs text-amber-200`,children:u(`relationships.truncated`)}),E&&Be.length===0&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.empty`)}),Be.length>0&&(0,h.jsx)(`ul`,{className:`mt-4 space-y-3`,children:Be.map(e=>{let t=e.edge_ids[e.edge_ids.length-1],n=t?N[t]:void 0,r=n?.state===`loaded`?n.response.edge:null,i=r?.evidence_class??e.evidence_classes[e.evidence_classes.length-1]??`deterministic`;return(0,h.jsxs)(`li`,{className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsx)(`p`,{className:`break-words text-sm font-medium`,children:r?u(`relationships.kinds.${r.kind}`,{path:e.path}):e.path}),(0,h.jsx)(`span`,{className:`mt-2 inline-flex rounded-full border px-2 py-1 text-xs font-medium ${_e(i)}`,children:u(`evidence.${i}.label`)}),t&&(0,h.jsxs)(`details`,{className:`mt-3`,onToggle:e=>Ie(t,e),children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground`,children:u(`relationships.showEvidence`)}),(0,h.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:[n?.state===`loading`&&(0,h.jsx)(`p`,{children:u(`relationships.loadingEvidence`)}),n?.state===`error`&&(0,h.jsx)(`p`,{className:`text-destructive`,children:u(`errors.explanation`)}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:u(`evidence.${r.evidence_class}.description`)}),(0,h.jsx)(`p`,{className:`mt-1`,children:u(`relationships.explanations.${r.kind}`)}),r.detail?.type===`relationship_value`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.value`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.value})]}),r.detail?.type===`co_changes`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2 gap-y-1`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.changeCount`)}),(0,h.jsx)(`dd`,{children:r.detail.change_count.toLocaleString()}),r.detail.sampled_commit_ids.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.sampledCommits`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.sampled_commit_ids.join(`, `)})]}),r.detail.samples_truncated&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`sr-only`,children:u(`relationships.evidenceDetail.coverage`)}),(0,h.jsx)(`dd`,{className:`col-span-2 text-amber-200`,children:u(`relationships.evidenceDetail.samplesTruncated`)})]})]})]})]})]})]},`${e.node.id}-${t??``}`)})})]})]}),(0,h.jsx)(oe,{className:`border-t border-border/70 px-5 py-4 sm:px-6`,children:(0,h.jsx)(o,{type:`button`,variant:`outline`,onClick:l,children:u(`close`)})})]})})};export{v as RepositoryGraphDialog};
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,G as n,H as r,I as i,J as a,K as ee,U as te,V as ne,X as o,Y as re,bt as ie,gt as s,ht as c,l as ae,mt as l,pt as u,q as oe,r as se,vt as d,yt as ce}from"./index-D5TEfELZ.js";var f=e(ie(),1),p=e=>({target_kind:e.kind,...e.kind===`bundle`?{bundle_id:e.bundle_id}:{}}),m=(e,t)=>{let n=new URL(c(e));return n.searchParams.set(`target_kind`,t.kind),t.kind===`bundle`&&t.bundle_id&&n.searchParams.set(`bundle_id`,t.bundle_id),n},le=(e,t,n={})=>d(m(`/projects/${encodeURIComponent(e)}/repository-graph/status`,t).toString(),{signal:n.signal}),ue=(e,t,n={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans`),{method:`POST`,body:p(t),signal:n.signal}),de=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/cancel`),{method:`POST`,body:p(t),signal:r.signal}),fe=(e,t,n,r={})=>d(c(`/projects/${encodeURIComponent(e)}/repository-graph/scans/${encodeURIComponent(n)}/retry`),{method:`POST`,body:p(t),signal:r.signal}),pe=(e,t,n,r,i)=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/path-impact`,t);return a.searchParams.set(`scan_id`,n),a.searchParams.set(`path`,r),a.searchParams.set(`direction`,i.direction),a.searchParams.set(`depth`,`1`),a.searchParams.set(`limit`,String(i.limit??50)),d(a.toString(),{signal:i.signal})},me=(e,t,n,r,i={})=>{let a=m(`/projects/${encodeURIComponent(e)}/repository-graph/edges/${encodeURIComponent(r)}/explanation`,t);return a.searchParams.set(`scan_id`,n),d(a.toString(),{signal:i.signal})},h=u(),g=new Set([`pending`,`running`]),he=new Set([`failed`,`cancelled`,`interrupted`]),ge=e=>!(e instanceof l)||typeof e.data!=`object`||e.data===null||!(`reason`in e.data)?null:typeof e.data.reason==`string`?e.data.reason:null,_e=e=>e===`deterministic`?`border-emerald-500/30 bg-emerald-500/10 text-emerald-200`:e===`structural_heuristic`?`border-amber-500/30 bg-amber-500/10 text-amber-200`:`border-violet-500/30 bg-violet-500/10 text-violet-200`,ve=2e3,ye=600,_=12,be=e=>({kind:e.kind,bundle_id:e.kind===`bundle`?e.bundle_id:null,ticket_id:null}),xe=(e,n)=>{let r=n.trim();return!e||!r?[]:e.entries.filter(e=>e.status!==`deleted`).map(e=>({entry:e,score:t(r,[e.path])})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score||e.entry.path.localeCompare(t.entry.path)).slice(0,_).map(e=>e.entry)},v=({projectId:e,target:t,targetLabel:ie,canRunOperations:c=!0,onClose:l})=>{let{t:u}=ce(`common`,{keyPrefix:`repositoryGraphDialog`}),d=ae(),[p,m]=(0,f.useState)(null),[_,v]=(0,f.useState)(!1),[Se,y]=(0,f.useState)(!0),[b,x]=(0,f.useState)(null),[S,Ce]=(0,f.useState)(!1),[C,we]=(0,f.useState)(``),[Te,w]=(0,f.useState)(null),[T,Ee]=(0,f.useState)(`combined`),[E,De]=(0,f.useState)(null),[Oe,ke]=(0,f.useState)(null),[Ae,D]=(0,f.useState)(!1),[O,k]=(0,f.useState)(null),[A,j]=(0,f.useState)(!1),[je,M]=(0,f.useState)(0),[N,P]=(0,f.useState)({}),F=(0,f.useRef)(null),I=(0,f.useRef)(0),L=(0,f.useRef)(null),R=(0,f.useRef)(null),z=(0,f.useRef)(0),B=(0,f.useRef)(null),V=(0,f.useRef)(0),H=(0,f.useRef)(new Map),U=(0,f.useCallback)(e=>{m(t=>t&&t.scan.scan_sequence>e.scan.scan_sequence?t:e),v(!1)},[]),W=(0,f.useCallback)(async()=>{let n=I.current+1;I.current=n,F.current?.abort();let r=new AbortController;F.current=r,y(!0),x(null);try{let i=await le(e,t,{signal:r.signal});I.current===n&&!r.signal.aborted&&U(i)}catch(e){if(s(e)||r.signal.aborted||I.current!==n)return;ge(e)===`scan_not_found`?(m(null),v(!0)):(v(!1),x(u(`errors.status`)))}finally{I.current===n&&!r.signal.aborted&&y(!1)}},[U,e,u,t]);(0,f.useEffect)(()=>{W()},[W]);let G=p?.scan??null;(0,f.useEffect)(()=>{if(!G||!g.has(G.status))return;let e=window.setInterval(()=>void W(),ve);return()=>window.clearInterval(e)},[W,G]),(0,f.useEffect)(()=>{let n=n=>n.project_id===e&&n.target_kind===t.kind&&(t.kind!==`bundle`||n.target_bundle_id===t.bundle_id),r=e=>{n(e)&&W()},i=()=>{W()};return d.on(`repository-graph-scan:updated`,r),d.on(`connect`,i),()=>{d.off(`repository-graph-scan:updated`,r),d.off(`connect`,i)}},[W,e,d,t.bundle_id,t.kind]),(0,f.useEffect)(()=>()=>{F.current?.abort(),L.current?.abort(),R.current?.abort(),B.current?.abort(),H.current.forEach(e=>e.abort()),H.current.clear()},[]);let K=async e=>{L.current?.abort(),F.current?.abort();let t=I.current+1;I.current=t;let n=new AbortController;L.current=n,Ce(!0),x(null);try{let r=await e(n.signal);!n.signal.aborted&&I.current===t&&(U(r),y(!1))}catch(e){!s(e)&&!n.signal.aborted&&x(u(`errors.operation`))}finally{n.signal.aborted||Ce(!1)}},q=G?.id??null,J=G?.status===`completed`,Y=C.trim(),X=(0,f.useDeferredValue)(C),Z=(0,f.useMemo)(()=>xe(O,X),[X,O]),Me=O?.entries.find(e=>e.status!==`deleted`&&e.path===Y)?.path??null,Ne=Y.includes(`/`)||/(^|\/)[^/]+\.[^/]+$/.test(Y),Q=Te??Me??(Ne?Y:``),$=Z.length===0?0:Math.min(je,Z.length-1);(0,f.useEffect)(()=>{B.current?.abort();let n=V.current+1;if(V.current=n,k(null),j(!1),!q||!J)return;let r=new AbortController;return B.current=r,j(!0),se(e,be(t),r.signal).then(e=>{!r.signal.aborted&&V.current===n&&k(e)}).catch(e=>{s(e)||r.signal.aborted||V.current!==n||k(null)}).finally(()=>{!r.signal.aborted&&V.current===n&&j(!1)}),()=>r.abort()},[J,e,q,t,t.bundle_id,t.kind]),(0,f.useEffect)(()=>{R.current?.abort();let n=z.current+1;if(z.current=n,H.current.forEach(e=>e.abort()),H.current.clear(),De(null),ke(null),P({}),!q||!J||!Q){D(!1);return}let r=new AbortController;R.current=r,D(!0);let i=window.setTimeout(()=>{pe(e,t,q,Q,{direction:T,limit:50,signal:r.signal}).then(e=>{!r.signal.aborted&&z.current===n&&De(e)}).catch(e=>{s(e)||r.signal.aborted||z.current!==n||ke(ge(e)===`path_not_found`?u(`errors.pathNotFound`):u(`errors.impact`))}).finally(()=>{!r.signal.aborted&&z.current===n&&D(!1)})},ye);return()=>{window.clearTimeout(i),r.abort()}},[J,T,Q,e,q,u,t]);let Pe=e=>{we(e),w(e),M(0)},Fe=e=>{if(e.key===`ArrowDown`&&Z.length>0){e.preventDefault(),M(e=>Math.min(e+1,Z.length-1));return}if(e.key===`ArrowUp`&&Z.length>0){e.preventDefault(),M(e=>Math.max(e-1,0));return}if(e.key===`Enter`){let t=Z[$];if(t){e.preventDefault(),Pe(t.path);return}Y&&(Ne||!O)&&(e.preventDefault(),w(Y))}},Ie=(n,r)=>{if(!r.currentTarget.open||N[n]?.state===`loading`||N[n]?.state===`loaded`||!q)return;let i=new AbortController,a=z.current;H.current.set(n,i),P(e=>({...e,[n]:{state:`loading`}})),me(e,t,q,n,{signal:i.signal}).then(e=>{!i.signal.aborted&&z.current===a&&P(t=>({...t,[n]:{state:`loaded`,response:e}}))}).catch(e=>{!s(e)&&!i.signal.aborted&&z.current===a&&P(e=>({...e,[n]:{state:`error`}}))}).finally(()=>{H.current.get(n)===i&&H.current.delete(n)})},Le=G?G.status===`pending`?`queued`:G.status===`completed`&&p?.freshness.state===`stale`?`stale`:G.status===`completed`&&p?.freshness.state===`unavailable`?`completeUnverified`:G.status===`completed`&&p?.freshness.is_current||G.status===`completed`?`complete`:G.status:_?`neverScanned`:`unknown`,Re=u(G?`refreshScan`:`startScan`),ze=!!G||_,Be=E?.paths.filter(e=>e.depth>0)??[];return(0,h.jsx)(te,{open:!0,onOpenChange:e=>{e||l()},children:(0,h.jsxs)(n,{showCloseButton:!1,overlayClassName:`z-[80]`,className:`z-[80] h-[calc(100vh-2rem)] max-h-[720px] grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0 sm:max-w-4xl`,children:[(0,h.jsx)(a,{className:`border-b border-border/70 px-5 py-4 pr-6 sm:px-6`,children:(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,h.jsxs)(`div`,{className:`min-w-0`,children:[(0,h.jsx)(re,{children:u(`title`)}),(0,h.jsx)(ee,{className:`mt-1 break-words`,children:u(`target`,{target:ie})})]}),(0,h.jsxs)(o,{type:`button`,disabled:!c||!ze||Se||S||!!b||!!(G&&g.has(G.status)),onClick:()=>{K(n=>ue(e,t,{signal:n}))},children:[S&&(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),Re]})]})}),(0,h.jsxs)(`div`,{"data-testid":`repository-graph-scroll-region`,className:`min-h-0 space-y-6 overflow-y-auto px-5 py-5 sm:px-6`,children:[(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-status-title`,className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`h3`,{id:`repository-graph-status-title`,className:`font-heading text-sm font-semibold`,children:u(`status.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,"aria-live":`polite`,children:u(Se?`status.loading`:`status.${Le}`)})]}),G&&g.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>de(e,t,G.id,{signal:n}))},children:u(`cancelScan`)}),G&&G.execution_run_id&&he.has(G.status)&&(0,h.jsx)(o,{type:`button`,variant:`outline`,disabled:!c||S||!!b,onClick:()=>{K(n=>fe(e,t,G.id,{signal:n}))},children:u(`retryScan`)})]}),b&&(0,h.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-sm text-destructive`,role:`alert`,children:[(0,h.jsx)(`span`,{children:b}),(0,h.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void W(),children:u(`retryLoad`)})]}),G&&(0,h.jsxs)(`dl`,{className:`mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.files`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.admitted_file_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.relationships`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.edge_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.diagnostics`)}),(0,h.jsx)(`dd`,{className:`mt-1 font-mono text-sm`,children:G.diagnostic_count.toLocaleString()})]}),(0,h.jsxs)(`div`,{children:[(0,h.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:u(`counts.analyzer`)}),(0,h.jsxs)(`dd`,{className:`mt-1 font-mono text-sm`,children:[`v`,p?.analyzer_version]})]})]}),p?.truncation.scan&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`truncatedScan`)}),p?.freshness.state===`unavailable`&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`freshnessUnavailable`)}),p&&p.diagnostic_summary.total_count>0&&(0,h.jsxs)(`details`,{className:`mt-4 rounded-lg border border-border/60 p-3`,children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium`,children:u(`diagnostics.show`,{count:p.diagnostic_summary.total_count})}),(0,h.jsx)(`ul`,{className:`mt-3 space-y-2`,children:p.diagnostic_summary.diagnostics.map((e,t)=>(0,h.jsxs)(`li`,{className:`text-xs leading-5 text-muted-foreground`,children:[(0,h.jsx)(`span`,{className:`font-medium text-foreground`,children:e.code}),e.path&&(0,h.jsxs)(`span`,{children:[` · `,e.path]}),(0,h.jsx)(`p`,{className:`break-words`,children:e.message})]},`${e.code}-${e.path??``}-${t}`))}),p.diagnostic_summary.truncated&&(0,h.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:u(`diagnostics.truncated`)})]})]}),(0,h.jsxs)(`section`,{"aria-labelledby":`repository-graph-relationship-title`,children:[(0,h.jsx)(`h3`,{id:`repository-graph-relationship-title`,className:`font-heading text-sm font-semibold`,children:u(`relationships.title`)}),(0,h.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u(`relationships.description`)}),(0,h.jsxs)(`div`,{className:`mt-4`,children:[(0,h.jsx)(ne,{htmlFor:`repository-graph-path`,children:u(`relationships.pathLabel`)}),(0,h.jsxs)(`div`,{className:`relative mt-2`,children:[(0,h.jsx)(r,{id:`repository-graph-path`,type:`search`,value:C,disabled:!J,onChange:e=>{we(e.target.value),w(null),M(0)},onKeyDown:Fe,placeholder:u(`relationships.pathPlaceholder`),"aria-autocomplete":`list`,"aria-controls":`repository-graph-path-suggestions`,"aria-activedescendant":Z.length>0?`repository-graph-path-suggestion-${$}`:void 0}),J&&X.trim()&&Te!==Y&&(A||O)&&(0,h.jsxs)(`div`,{id:`repository-graph-path-suggestions`,role:`listbox`,className:`absolute z-10 mt-1 max-h-60 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-lg`,children:[A&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.suggestionsLoading`)}),!A&&O&&Z.length===0&&(0,h.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground`,children:u(`relationships.noSuggestions`)}),Z.map((e,t)=>(0,h.jsx)(`button`,{id:`repository-graph-path-suggestion-${t}`,type:`button`,role:`option`,"aria-selected":t===$,className:`block w-full rounded-md px-3 py-2 text-left font-mono text-xs ${t===$?`bg-accent text-accent-foreground`:`text-foreground hover:bg-muted`}`,onMouseDown:e=>e.preventDefault(),onClick:()=>Pe(e.path),children:e.path},e.path))]})]})]}),(0,h.jsxs)(`fieldset`,{className:`mt-4`,disabled:!J,children:[(0,h.jsx)(`legend`,{className:`text-sm font-medium`,children:u(`relationships.direction`)}),(0,h.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-4`,children:[`combined`,`incoming`,`outgoing`].map(e=>(0,h.jsxs)(ne,{className:`flex items-center gap-2 text-sm`,children:[(0,h.jsx)(`input`,{type:`radio`,name:`repository-graph-direction`,checked:T===e,onChange:()=>Ee(e)}),u(`relationships.directions.${e}`)]},e))})]}),!J&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.unavailable`)}),Ae&&(0,h.jsxs)(`p`,{className:`mt-4 flex items-center gap-2 text-sm text-muted-foreground`,children:[(0,h.jsx)(i,{className:`h-4 w-4 animate-spin`}),u(`relationships.loading`)]}),Oe&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-destructive`,role:`alert`,children:Oe}),E?.truncation.query&&(0,h.jsx)(`p`,{className:`mt-4 text-xs text-amber-200`,children:u(`relationships.truncated`)}),E&&Be.length===0&&(0,h.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:u(`relationships.empty`)}),Be.length>0&&(0,h.jsx)(`ul`,{className:`mt-4 space-y-3`,children:Be.map(e=>{let t=e.edge_ids[e.edge_ids.length-1],n=t?N[t]:void 0,r=n?.state===`loaded`?n.response.edge:null,i=r?.evidence_class??e.evidence_classes[e.evidence_classes.length-1]??`deterministic`;return(0,h.jsxs)(`li`,{className:`rounded-xl border border-border/70 bg-background/30 p-4`,children:[(0,h.jsx)(`p`,{className:`break-words text-sm font-medium`,children:r?u(`relationships.kinds.${r.kind}`,{path:e.path}):e.path}),(0,h.jsx)(`span`,{className:`mt-2 inline-flex rounded-full border px-2 py-1 text-xs font-medium ${_e(i)}`,children:u(`evidence.${i}.label`)}),t&&(0,h.jsxs)(`details`,{className:`mt-3`,onToggle:e=>Ie(t,e),children:[(0,h.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-muted-foreground hover:text-foreground`,children:u(`relationships.showEvidence`)}),(0,h.jsxs)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground`,children:[n?.state===`loading`&&(0,h.jsx)(`p`,{children:u(`relationships.loadingEvidence`)}),n?.state===`error`&&(0,h.jsx)(`p`,{className:`text-destructive`,children:u(`errors.explanation`)}),r&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{children:u(`evidence.${r.evidence_class}.description`)}),(0,h.jsx)(`p`,{className:`mt-1`,children:u(`relationships.explanations.${r.kind}`)}),r.detail?.type===`relationship_value`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.value`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.value})]}),r.detail?.type===`co_changes`&&(0,h.jsxs)(`dl`,{className:`mt-2 grid grid-cols-[auto_1fr] gap-x-2 gap-y-1`,children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.changeCount`)}),(0,h.jsx)(`dd`,{children:r.detail.change_count.toLocaleString()}),r.detail.sampled_commit_ids.length>0&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`font-medium text-foreground`,children:u(`relationships.evidenceDetail.sampledCommits`)}),(0,h.jsx)(`dd`,{className:`break-all font-mono`,children:r.detail.sampled_commit_ids.join(`, `)})]}),r.detail.samples_truncated&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`dt`,{className:`sr-only`,children:u(`relationships.evidenceDetail.coverage`)}),(0,h.jsx)(`dd`,{className:`col-span-2 text-amber-200`,children:u(`relationships.evidenceDetail.samplesTruncated`)})]})]})]})]})]})]},`${e.node.id}-${t??``}`)})})]})]}),(0,h.jsx)(oe,{className:`border-t border-border/70 px-5 py-4 sm:px-6`,children:(0,h.jsx)(o,{type:`button`,variant:`outline`,onClick:l,children:u(`close`)})})]})})};export{v as RepositoryGraphDialog};
|
package/dist/client/assets/{VerificationDialog-Sc6e8AKH.js → VerificationDialog-CsjDzpE1.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,X as y,Y as ee,Z as b,_ as te,_t as x,a as S,at as C,b as w,bt as T,c as ne,ct as re,et as ie,f as ae,g as E,gt as oe,h as D,ht as O,it as k,j as A,k as j,l as se,m as ce,mt as le,n as ue,nt as de,o as fe,ot as pe,p as M,pt as me,q as he,rt as ge,s as _e,st as ve,t as N,tt as ye,v as P,vt as be,x as F,y as I,yt as L,z as xe}from"./index-B1gdJKwK.js";var R=e(T(),1),z=me(),Se=({title:e,children:t,defaultOpen:n=!1})=>(0,z.jsxs)(P,{defaultOpen:n,className:`mt-5 rounded-2xl border border-border/70 bg-background/25`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":e,className:`group flex w-full items-center gap-2 rounded-2xl px-4 py-3 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e}),(0,z.jsx)(xe,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsx)(I,{className:`border-t border-border/60 px-4 py-3`,children:t})]}),B=e=>{if(!e.file_path)return null;if(!e.start_line)return e.file_path;let t=`${e.start_line}${e.start_column?`:${e.start_column}`:``}`,n=e.end_line?`-${e.end_line}${e.end_column?`:${e.end_column}`:``}`:``;return`${e.file_path}:${t}${n}`},V=[`error`,`warning`,`info`,`unknown`],H=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},U=({counts:e,totalCount:t})=>{let{t:n}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=V.filter(t=>e[t]>0);return(0,z.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,z.jsx)(`span`,{className:`rounded-full border border-border/70 bg-background/45 px-2 py-1 text-[11px] text-muted-foreground`,children:n(`severityCount`,{count:e[t],severity:n(`severity.${t}`)})},t)),t>0&&t!==r.reduce((t,n)=>t+e[n],0)&&(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},Ce=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:i,onSelectedTicketChange:a})=>{let{t:o}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),s=e.currency??`unavailable`;return(0,z.jsxs)(P,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":o(`technicalDetails`),className:`group flex w-full items-center gap-2 rounded-xl px-3 py-2.5 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,z.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:o(`technicalDetails`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:o(`technicalDetailsHint`)}),(0,z.jsx)(xe,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsxs)(I,{className:`border-t border-border/60 px-3 py-3`,children:[(0,z.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`parser.${t.parser_kind}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserStateLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`state.${t.status}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${t.retention_state}`)})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`outputRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${e.output_retention_state}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`applicabilityLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`applicability`,{state:o(`applicabilityState.${s}`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`sourceLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`destinationTitle`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`destination.${n.destination}`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:o(`destinationHint`)})]})]}),r&&n&&(0,z.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[o(`ticketLabel`),(0,z.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:`mt-1 h-10 w-full rounded-xl border border-border bg-card px-3 text-sm text-foreground`,children:[(0,z.jsx)(`option`,{value:``,children:o(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},W=({attempt:e,diagnostics:t,repair:n,selectedDiagnosticIds:r,selectedRawOutputAttemptRunIds:i,selectedAttemptRunIds:a,selectedTicketId:o,pending:s,activeRepair:c,autoFix:l,onSelectedTicketChange:u,onToggleDiagnostic:d,onToggleRawOutput:f,onStartRepair:p,onStopRepair:m})=>{let{t:h}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),{t:g}=L(`common`,{keyPrefix:`checksDialog`});if(e.execution_status!==`failed`)return null;let _=t?.parser??null,v=t?.diagnostics??[],ee=H(v),b=!!(l&&!l.terminal_reason),te=l?.attempts[l.attempts.length-1]??null,x=c?.terminal_result===null||b,S=!!(n?.eligibility.eligible&&n.eligible_attempt_run_ids.includes(e.execution_run_id)&&_?.status===`complete`&&_.retention_state===`retained`),C=!!(n?.eligibility.eligible&&n.eligible_raw_output_attempt_run_ids.includes(e.execution_run_id)&&e.output_retention_state===`retained`&&e.retained_output),w=i.has(e.execution_run_id),T=r.size,ne=T>=32,re=a.size>=8&&!a.has(e.execution_run_id),ie=ne?h(`diagnosticLimit`,{count:32}):re?h(`attemptLimit`,{count:8}):null,ae=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),E=T+i.size,oe=E>0&&(!ae||o!==``),D=n&&!n.eligibility.eligible?h(`disabled.${n.eligibility.reason}`):null,O=_&&t&&(_.status===`interrupted`||v.length===0&&[`unsupported`,`malformed`].includes(_.status))?_.status:null,k=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count===0),A=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count>0),j=_?.diagnostic_count??v.length;return(0,z.jsxs)(`section`,{"aria-labelledby":`diagnostics-${e.execution_run_id}`,className:`mt-5 rounded-2xl border border-border/70 bg-background/25 p-4`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:h(`title`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:_&&_.status===`pending`?h(`loading`):_&&j>0?A||_.retention_state===`expired`?h(`totalAvailable`,{count:j}):h(`availableCount`,{count:j}):h(t?`noneAvailable`:`loading`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:h(`failureOutcome`,{outcome:e.outcome?g(`outcomeValue.${e.outcome}`):g(`status.${e.execution_status}`)})}),t&&v.length>0&&(0,z.jsx)(U,{counts:ee,totalCount:j})]})}),_?.retention_state===`expired`&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`expired`)}),_?.truncated&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`truncated`)}),O&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`fallback.${O}`)}),k&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`noStructuredDiagnostics`)}),A&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`structuredDetailsUnavailable`)}),C&&(0,z.jsxs)(`label`,{className:`mt-4 flex items-start gap-3 rounded-xl border border-amber-400/25 bg-amber-500/5 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":h(`rawOutputSelect`),checked:w,disabled:x||!w&&re,onChange:e=>f(e.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:h(`rawOutputSelect`)}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(`rawOutputHint`)}),e.retained_start_offset>0&&(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:h(`rawOutputTruncated`)})]})]}),t&&v.length>0&&(0,z.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,z.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:h(`selectLegend`)}),(0,z.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>{let t=B(e),n=r.has(e.id);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!S||x||!n&&ie!==null,onChange:t=>d(e.id,t.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:h(`severity.${e.severity}`)}),e.code&&(0,z.jsx)(`code`,{children:e.code})]}),(0,z.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,z.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),D&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),ie&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:ie}),c&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:h(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),l&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,role:`status`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:l.terminal_reason?h(`autoFix.terminal.${l.terminal_reason}`):te?.fallback_used?h(`autoFix.phase.fallback`):h(`autoFix.phase.${l.phase}`)}),!l.terminal_reason&&l.attempt_count>0&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:h(`autoFix.attempt`,{current:l.attempt_count,total:l.max_attempts})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h(`selectedEvidence`,{count:E})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(y,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!oe||s||x,title:D??void 0,onClick:p,children:s?h(`starting`):h(`repairSelectedEvidence`,{count:E})}),x&&(0,z.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:s||l?.phase===`stopping`,onClick:m,children:h(b?`autoFix.stop`:`stopRepair`)})]})]}),(0,z.jsx)(Ce,{attempt:e,parser:_,repair:n,ticketRequired:ae,selectedTicketId:o,onSelectedTicketChange:u})]})},G=({attempt:e})=>{let{t}=L(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?S(e.retained_output):``;return(0,z.jsxs)(Se,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,z.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputExpired`)}),e.output_retention_state===`retained`&&!n&&(0,z.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputEmpty`)}),e.output_retention_state===`retained`&&n&&(0,z.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-xl border border-border bg-[#090b12] p-4 font-mono text-xs text-slate-200`,children:n}),e.retained_start_offset>0&&(0,z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},K=({definition:e,policy:t})=>{let{t:n}=L(`common`,{keyPrefix:`checksDialog`});return(0,z.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,z.jsx)(`p`,{className:`mt-4 rounded-xl border border-dashed border-border px-3 py-2 text-sm text-muted-foreground`,children:n(`notRunDescription`)}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},we=({attempt:e,definition:t,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h,policy:g})=>{let{t:_}=L(`common`,{keyPrefix:`checksDialog`}),{t:v}=L(`common`,{keyPrefix:`activityView`});return e?(0,z.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`status.${e.execution_status}`)})]}),e.outcome&&(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:_(`outcomeValue.${e.outcome}`)})]}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??_(`targetRoot`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`outcome`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?_(`outcomeValue.${e.outcome}`):_(`status.${e.execution_status}`)})]}),e.currency&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`currencyLabel`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:v(`currency.${e.currency}`)})]}),g&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[_(g.required?`required`:`optional`),` · `,_(g.preReview?`preReview`:`finalOnly`)]})]})]}),e.execution_status===`failed`&&(0,z.jsx)(W,{attempt:e,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h}),(0,z.jsx)(G,{attempt:e},e.execution_run_id)]}):t?(0,z.jsx)(K,{definition:t,policy:g}):(0,z.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,z.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:_(`selectAttemptTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`selectAttemptDescription`)})]})},q={current:`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`,stale:`border-amber-400/30 bg-amber-500/10 text-amber-200`,failed:`border-red-400/30 bg-red-500/10 text-red-200`,missing:`border-border bg-muted/40 text-muted-foreground`,interrupted:`border-orange-400/30 bg-orange-500/10 text-orange-200`,blocked:`border-amber-400/30 bg-amber-500/10 text-amber-200`},Te=(e,t)=>e.presentApplicability.appliesToCurrentState===!1?`stale`:t?t.execution_status===`interrupted`||t.execution_status===`cancelled`?`interrupted`:t.execution_status===`failed`?`failed`:t.currency===`stale`?`stale`:t.outcome&&t.outcome!==`passed`?`failed`:t.outcome===`passed`&&t.currency===`current`?`current`:e.decision===`blocked`?`blocked`:`current`:`missing`,Ee=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,De=({evaluation:e})=>{let{t}=L(`common`,{keyPrefix:`checksDialog`}),n=e.presentApplicability.appliesToCurrentState===!1?`gateStale`:e.presentApplicability.appliesToCurrentState===null?`gateUnverifiable`:e.decision===`passed`?`gatePassed`:`gateBlocked`,r=e.reasonCodes[0],i=r?t(`gateReasonSummary`,{reason:t(`reason.${r}`)}):e.decision===`passed`?t(`gatePassedSummary`):t(`gateBlockedSummary`);return(0,z.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?q.current:q.blocked),children:t(n)})]}),(0,z.jsx)(Se,{title:t(`gateDetails`),children:(0,z.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:t(`gateScope`)}),(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,z.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,z.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,z.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(Ee(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,z.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Te(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,z.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-1 text-xs`,q[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,z.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},Oe=e=>e.execution_status===`completed`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.execution_status===`failed`||e.execution_status===`interrupted`?`border-red-400/30 bg-red-500/10 text-red-200`:e.execution_status===`running`||e.execution_status===`queued`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border bg-muted/40 text-muted-foreground`,ke=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,Ae=(e,t,n,r)=>((t?.attempts.find(t=>t.attempt_run_id===e.execution_run_id))?.diagnostics.filter(e=>n.has(e.id)).length??0)+ +!!r.has(e.execution_run_id),je=({definitions:e,attempts:t,requiredDefinitionIds:n,preReviewDefinitionIds:r,selectedDefinitionIds:i,selectedCheckId:a,diagnostics:o,selectedDiagnosticIds:s,selectedRawOutputAttemptRunIds:c,onToggleDefinition:l,onSelectCheck:u})=>{let{t:d}=L(`common`,{keyPrefix:`checksDialog`}),f=new Set(n),p=new Set(r),m=new Set(e.map(e=>e.id)),h=[...e.map(e=>({definition:e,attempt:t.find(t=>t.definition_id===e.id),historical:!1})),...t.filter(e=>!m.has(e.definition_id)).map(e=>({definition:e.command_snapshot,attempt:e,historical:!0}))];return(0,z.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,z.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,z.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5 md:max-h-none md:py-5 max-md:max-h-[min(35vh,18rem)]`,children:(0,z.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:h.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?Ae(t,o,s,c):0,h=f.has(e.id),g=p.has(e.id),_=`${d(`category.${e.category}`)} · ${d(h?`required`:`optional`)} · ${d(g?`preReview`:`finalOnly`)}`;return(0,z.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 shrink-0 accent-primary`,checked:i.has(e.id),"aria-label":d(`selectForRun`,{name:e.name}),onChange:t=>l(e.id,t.target.checked)}),t?(0,z.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(ke(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,Oe(t)),children:d(ke(t))})]}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_}),m>0&&(0,z.jsx)(`span`,{"data-evidence-selected":`true`,className:`mt-1.5 inline-flex rounded-full border border-amber-400/30 bg-amber-500/10 px-2 py-0.5 text-[11px] text-amber-200`,children:d(`evidenceSelected`,{count:m})})]}):(0,z.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(`status.notRun`)}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_})]})]})},t?.execution_run_id??e.id)})})})]})},Me=(e,t)=>{let n=new Set(t?.attempts.filter(e=>e.parser.status===`complete`&&e.parser.retention_state===`retained`&&e.diagnostics.length>0).map(e=>e.attempt_run_id)??[]);return e.find(e=>e.execution_status===`failed`&&n.has(e.execution_run_id))??e.find(e=>e.execution_status===`failed`)??e.find(e=>e.execution_status===`running`)??e[0]??null},Ne=new Set([`queued`,`running`,`waiting`]),Pe=75,Fe=32,Ie=64,Le=3,Re=32,ze=8,J=(e,t)=>e instanceof le?e.message:t,Be=e=>{let t=new Set(e.repair.eligibility.eligible?e.repair.eligible_attempt_run_ids:[]);return new Set(e.attempts.filter(e=>t.has(e.attempt_run_id)).flatMap(e=>e.diagnostics.map(e=>e.id)))},Ve=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),He=({projectId:e,targetKind:n,targetBundleId:r,definitions:i,requiredDefinitionIds:a=[],preReviewDefinitionIds:o=[],gateEvaluationId:s=null,directBatchRunId:c=null,directAttemptRunId:l=null,onSelectionChange:u,onUnavailable:d,onStatusChange:f})=>{let{t:p}=L(`common`,{keyPrefix:`checksDialog`}),m=se(),[h,g]=(0,R.useState)(()=>new Set(i.map(e=>e.id))),[_,v]=(0,R.useState)(null),[ee,b]=(0,R.useState)(null),[te,x]=(0,R.useState)(null),[S,w]=(0,R.useState)(null),[T,ae]=(0,R.useState)(!0),[E,D]=(0,R.useState)(null),[O,A]=(0,R.useState)(null),[j,ce]=(0,R.useState)(new Set),[ue,M]=(0,R.useState)(new Set),[me,he]=(0,R.useState)(``),[N,P]=(0,R.useState)(null),[be,F]=(0,R.useState)(!1),[I,xe]=(0,R.useState)(0),[Se,B]=(0,R.useState)(null),V=(0,R.useRef)(_),H=(0,R.useRef)(null),U=(0,R.useRef)(new Set),Ce=(0,R.useRef)(new Map),W=(0,R.useRef)(0),G=(0,R.useRef)(0),K=(0,R.useRef)(null),q=(0,R.useRef)(!1),Te=(0,R.useRef)(!0),Ee=(0,R.useRef)(null),Oe=(0,R.useRef)(`automatic`),ke=(0,R.useRef)(null),Ae=(0,R.useRef)(async()=>void 0),He=(0,R.useRef)(async()=>void 0),Ue=(0,R.useRef)(()=>void 0),We=(0,R.useRef)(0),Ge=(0,R.useRef)(O);V.current=_,Ge.current=O,Te.current=T||E!==null;let Y=(0,R.useCallback)((e,t)=>{Ee.current=e,Oe.current=t,x(e)},[]),Ke=(0,R.useCallback)(e=>{A(e),P(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),ce(t=>{let n=Be(e);return new Set([...t].filter(e=>n.has(e)))}),M(t=>{let n=Ve(e);return new Set([...t].filter(e=>n.has(e)))}),he(t=>e.repair.candidate_tickets.some(e=>e.id===t)?t:e.repair.candidate_tickets.length===1&&e.repair.accepts_ticket_id?e.repair.candidate_tickets[0].id:``);let t=V.current;Oe.current===`automatic`&&t?.batch.execution_run_id===e.batch_run_id&&Y(Me(t.attempts,e)?.execution_run_id??null,`automatic`)},[Y]),qe=(0,R.useCallback)(e=>{let t=Ce.current;if(!t.has(e.attempt_run_id)&&t.size>=Fe){let e=t.keys().next().value;e&&(t.delete(e),U.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(Ie-1)),e])},[]),Je=(0,R.useCallback)((e,t,n=`route`)=>{let r=V.current?.batch.execution_run_id===e.batch.execution_run_id?V.current:null,i=!1,a=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of Ce.current.keys())a.has(e)||(Ce.current.delete(e),U.current.delete(e));let o=e.attempts.map(e=>{let t=!1,n=r?.attempts.find(t=>t.execution_run_id===e.execution_run_id),a=n&&n.output_revision>e.output_revision?n:e,o=Ce.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=_e(fe(a),e);if(n.status===`refetch`){t=!0,i=!0;continue}n.status===`applied`&&(a={...a,output_revision:n.snapshot.revision,retained_start_offset:n.snapshot.retainedStartOffset,retained_end_offset:n.snapshot.totalByteCount,total_persisted_bytes:n.snapshot.totalByteCount,retained_output:n.snapshot.retainedText})}return t?U.current.add(e.execution_run_id):(U.current.delete(e.execution_run_id),Ce.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};K.current=e.batch.execution_run_id,V.current=s,v(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,l=Ee.current,f=Oe.current,m=!!(l&&s.attempts.some(e=>e.execution_run_id===l)),h=Me(s.attempts,Ge.current?.batch_run_id===s.batch.execution_run_id?Ge.current:null),g=ke.current,_=!!(g&&g.batchRunId===s.batch.execution_run_id&&g.attemptRunId===t),y=!!(g&&g.previousBatchRunId===s.batch.execution_run_id&&g.previousAttemptRunId===t);if(n===`reset`)Y(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(_)Y(c.execution_run_id,`manual`);else if(y&&f===`manual`)Y(m?l:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=f!==`external`||l!==c.execution_run_id;Y(c.execution_run_id,`external`),e&&u?.(s.batch.execution_run_id,c.execution_run_id)}else _||y?f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`):(Y(t,`external`),d?.());else n===`preserve`?f===`external`&&l?m?Y(l,`external`):(Y(l,`external`),d?.()):f===`manual`&&m?Y(l,`manual`):Y(f===`automatic`&&m?l:h?.execution_run_id??null,`automatic`):f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`);i?Ue.current(e.batch.execution_run_id):We.current=0,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))},[u,d,p,Y]),X=(0,R.useCallback)(async(n,r)=>{let i=++W.current,a=await t(e,n,r);if(i!==W.current||a.batch.execution_run_id!==n||K.current!==null&&K.current!==n){a.batch.execution_run_id!==n&&d?.();return}Je(a,n===c?l:null)},[l,c,Je,d,e]);Ae.current=X,Ue.current=(0,R.useCallback)(e=>{if(H.current)return;if(We.current>=Le){We.current=0,U.current.clear(),Ce.current.clear();return}let t=Pe*2**We.current;H.current=setTimeout(()=>{H.current=null,We.current+=1,Ae.current(e).catch(t=>{B(J(t,p(`errors.load`))),U.current.size>0&&Ue.current(e)})},t)},[p]);let Z=(0,R.useCallback)(async t=>{let i=++W.current,a=await ge(e,n,r,t);if(i===W.current){if(a.batch_run_id){K.current=a.batch_run_id,await X(a.batch_run_id,t);return}!t?.aborted&&i===W.current&&(K.current=null,V.current=null,v(null),Y(null,`automatic`))}},[X,e,r,n,Y]),Ye=(0,R.useCallback)(async()=>{if(s||c){let e=K.current;e&&await X(e);return}await Z()},[c,s,X,Z]);He.current=Ye;let Xe=(0,R.useCallback)(e=>{H.current||=setTimeout(()=>{H.current=null,X(e).catch(e=>B(J(e,p(`errors.load`))))},Pe)},[X,p]);(0,R.useEffect)(()=>{let t=new AbortController;return ae(!0),B(null),(async()=>{if(c){if(b(null),l){let n=await ne(e,l,t.signal);if(n.run.kind!==`check_attempt`||n.details.kind!==`check_attempt`||!n.details.available||!n.details.attempt||n.details.attempt.batch_run_id!==c){d?.();return}}K.current=c,await X(c,t.signal);return}if(!s){b(null),await Z(t.signal);return}let n=await ye(e,s,t.signal);if(b(n),n.sourceBatchRunId){K.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}K.current=null,V.current=null,v(null),Y(null,`automatic`)})().catch(e=>{oe(e)||(e instanceof le&&e.status===404&&d?.(),B(J(e,p(`errors.load`))))}).finally(()=>{t.signal.aborted||(ae(!1),Te.current=!1,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe)))}),()=>t.abort()},[l,c,s,X,Z,d,e,p,Y]),(0,R.useEffect)(()=>{let t=_?.batch.execution_run_id;if(!t){G.current+=1,A(null),ce(new Set),M(new Set),he(``),P(null);return}Ge.current?.batch_run_id!==t&&(A(null),ce(new Set),M(new Set),he(``),P(null));let n=++G.current,r=new AbortController;return ie(e,t,r.signal).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(e=>{oe(e)||B(J(e,p(`errors.diagnostics`)))}),()=>r.abort()},[_?.batch.execution_run_id,I,Ke,e,p]),(0,R.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=K.current;if(n!==null&&t.batch_run_id!==n)return;let r=V.current;if(!r||U.current.has(t.attempt_run_id)){qe(t),r&&U.current.has(t.attempt_run_id)&&Ue.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){qe(t),Xe(r.batch.execution_run_id);return}let a=r.attempts[i],o=_e(fe(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){U.current.add(t.attempt_run_id),qe(t),Ue.current(r.batch.execution_run_id);return}let s=[...r.attempts];s[i]={...a,output_revision:o.snapshot.revision,retained_start_offset:o.snapshot.retainedStartOffset,retained_end_offset:o.snapshot.totalByteCount,total_persisted_bytes:o.snapshot.totalByteCount,retained_output:o.snapshot.retainedText};let c={...r,attempts:s};V.current=c,v(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(Te.current){q.current=!0;return}let n=V.current,r=t.execution_run_id??t.id;if(xe(e=>e+1),N&&r===N.execution_run_id&&N.source_batch_run_id===K.current&&de(e,N.execution_run_id).then(P).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){W.current+=1,Xe(n.batch.execution_run_id);return}q.current=!0,!Te.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))},r=()=>{xe(e=>e+1),Ye().catch(e=>B(J(e,p(`errors.load`))))};return m.on(`check-attempt:output`,t),m.on(`execution-run:updated`,n),m.on(`lifecycle-event:created`,n),m.on(`connect`,r),()=>{m.off(`check-attempt:output`,t),m.off(`execution-run:updated`,n),m.off(`lifecycle-event:created`,n),m.off(`connect`,r)}},[N,qe,e,Ye,Xe,m,p]),(0,R.useEffect)(()=>()=>{H.current&&clearTimeout(H.current),U.current.clear(),Ce.current.clear()},[]);let Ze=(e,t)=>{W.current+=1,K.current=e.batch.execution_run_id,Je(e,null,t)},Qe=async(e,t)=>{W.current+=1,Te.current=!0,D(e),B(null);try{let n=await t();e!==`stop`&&(ke.current=null),Ze(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&u?.(n.batch.execution_run_id,void 0)}catch(t){B(J(t,p(`errors.${e}`))),t instanceof le&&t.status===409&&await Ye().catch(()=>void 0)}finally{D(null),Te.current=T,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))}},$e=_?Ne.has(_.batch.execution_status):!1,et=_?$e?`running`:_.batch.execution_status===`completed`?`finished`:_.batch.execution_status===`cancelled`||_.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,tt=_?.batch.execution_run_id??null,Q=O?.batch_run_id===tt?O:null,nt=N?.source_batch_run_id===tt?N:null,$=Q?.auto_fix??null,rt=!!($&&!$.terminal_reason),it=Q?Be(Q):new Set,at=Q?Ve(Q):new Set,ot=new Set([...j].filter(e=>it.has(e))),st=new Set([...ue].filter(e=>at.has(e))),ct=[...h],lt=_?.attempts.filter(e=>e.execution_status!==`completed`).length??0,ut=async()=>{let t=[...ot],n=[...st];if(!(!Q||!tt||K.current!==tt||Q.repair.eligibility.eligible!==!0||nt?.terminal_result===null||$&&!$.terminal_reason||t.length===0&&n.length===0)){F(!0),B(null);try{let r=await pe(e,t,n,Q.repair.accepts_ticket_id?Q.repair.candidate_tickets.some(e=>e.id===me)?me:Q.repair.candidate_tickets[0]?.id||null:null);P(r.source_batch_run_id===tt?r:null)}catch(t){if(B(J(t,p(`errors.repair`))),t instanceof le&&t.status===409&&_){let t=_.batch.execution_run_id,n=++G.current;ie(e,t).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(()=>void 0)}}finally{F(!1)}}},dt=async()=>{let t=$&&!$.terminal_reason?$.execution_run_id:nt?.execution_run_id;if(t){F(!0),B(null);try{let n=await re(e,t);`source_batch_run_id`in n&&P(n),xe(e=>e+1)}catch(e){B(J(e,p(`errors.repairStop`)))}finally{F(!1)}}},ft=new Set([...Q?.attempts.filter(e=>e.diagnostics.some(e=>ot.has(e.id))).map(e=>e.attempt_run_id)??[],...st]),pt=(e,t,n)=>{ce(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=Re||!Q||!it.has(t))return r;let a=new Set(Q.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=ze?r:(i.add(t),i)})},mt=(e,t)=>{M(n=>{let r=new Set(n);return t?!ft.has(e)&&ft.size>=ze||!at.has(e)?n:(r.add(e),r):(r.delete(e),r)})},ht=(e,t)=>{g(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},gt=e=>{_&&(w(null),ke.current={batchRunId:_.batch.execution_run_id,attemptRunId:e,previousBatchRunId:c===_.batch.execution_run_id?c:null,previousAttemptRunId:c===_.batch.execution_run_id?l:null},Y(e,`manual`),u?.(_.batch.execution_run_id,e))},_t=e=>{let t=_?.attempts.find(t=>t.definition_id===e);if(t){gt(t.execution_run_id);return}w(e)},vt=S?_?.attempts.find(e=>e.definition_id===S)??null:_?.attempts.find(e=>e.execution_run_id===te)??null,yt=vt?.command_snapshot??i.find(e=>e.id===S)??null,bt=S??vt?.definition_id??null,xt=yt?{required:a.includes(yt.id),preReview:o.includes(yt.id)}:null;return(0,R.useEffect)(()=>{f?.(et)},[et,f]),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Se&&(0,z.jsx)(`p`,{role:`alert`,className:`mx-4 mt-3 rounded-xl border border-red-400/25 bg-red-500/10 px-3 py-2 text-sm text-red-200 sm:mx-6`,children:Se}),(0,z.jsxs)(`div`,{role:`toolbar`,"aria-label":p(`runActions`),className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-y border-border/70 bg-background/30 px-4 py-3 sm:px-6`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:p(`runActions`)})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(y,{type:`button`,size:`sm`,disabled:ct.length===0||$e||rt||E!==null,onClick:()=>void Qe(`run`,()=>C(e,{targetKind:n,targetBundleId:r,definitionIds:ct})),children:p(E===`run`?`starting`:`runSelected`)}),_&&$e&&(0,z.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null||be,onClick:()=>void(rt?dt():Qe(`stop`,()=>ve(e,_.batch.execution_run_id))),children:p(E===`stop`||be?`stopping`:`stop`)}),_&&!$e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:rt||E!==null,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`all`})),children:p(`rerunAll`)}),(0,z.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:rt||E!==null||lt===0,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`failed_only`})),children:p(`rerunFailed`)})]})]})]}),(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,auto)_minmax(0,1fr)] overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)] md:grid-rows-1`,children:[(0,z.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,z.jsx)(je,{definitions:i,attempts:_?.attempts??[],requiredDefinitionIds:a,preReviewDefinitionIds:o,selectedDefinitionIds:h,selectedCheckId:bt,diagnostics:Q,selectedDiagnosticIds:ot,selectedRawOutputAttemptRunIds:st,onToggleDefinition:ht,onSelectCheck:_t})}),(0,z.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[s&&!ee&&T&&(0,z.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:p(`gateLoading`)}),ee&&(0,z.jsx)(De,{evaluation:ee}),T&&(0,z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:p(`loading`)}),!T&&!_&&!yt&&(0,z.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-foreground`,children:p(`emptyTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:p(`emptyDescription`)})]}),_&&(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:p(`status.${_.batch.execution_status}`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:p(`summary`,{passed:_.batch.passed_count,failed:_.batch.failed_count,running:_.batch.running_count,queued:_.batch.queued_count})}),_.batch.stop_requested&&(0,z.jsx)(`span`,{className:`text-xs text-amber-200`,children:p(`stopRequested`)})]})}),(_||yt)&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(we,{attempt:vt,definition:yt,diagnostics:Q?.attempts.find(e=>e.attempt_run_id===vt?.execution_run_id)??null,repair:Q?.repair??null,selectedDiagnosticIds:ot,selectedRawOutputAttemptRunIds:st,selectedAttemptRunIds:ft,selectedTicketId:me,pending:be,activeRepair:nt,autoFix:$,policy:xt,onSelectedTicketChange:he,onToggleDiagnostic:(e,t)=>vt&&pt(vt.execution_run_id,e,t),onToggleRawOutput:e=>vt&&mt(vt.execution_run_id,e),onStartRepair:()=>void ut(),onStopRepair:()=>void dt()})})]})]})]})},Ue=(e,t)=>be(O(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),We=(e,t)=>be(O(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Ge=(e,t={})=>be(O(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),Y=(e,t)=>be(O(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),Ke=e=>be(O(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),qe=e=>x(O(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),Je=256*1024,X=24,Z=(e,t)=>g.t(`common:testsDialog.${e}`,t),Ye=(e,t)=>{let n=`${e}${t}`;return n.length<=Je?n:n.slice(-Je)},Xe=(e,t)=>e?e.run_id&&t.run_id&&e.run_id!==t.run_id?e.status===`running`||t.status!==`running`?e:t:e.status!==`idle`&&e.status!==`running`&&t.status===`running`?e:e.run_id===t.run_id&&e.output.length>t.output.length?{...t,output:e.output,output_truncated:e.output_truncated||t.output_truncated}:t:t,Ze=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=X,Qe=e=>{e.scrollTop=e.scrollHeight},$e=(e,t=!1)=>{Qe(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{Qe(e),t&&(r=window.requestAnimationFrame(()=>{Qe(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},et=e=>e===`running`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e===`passed`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e===`failed`||e===`error`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e===`stopped`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`,tt=e=>{if(e==null)return null;if(e<1e3)return`${e} ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`},Q=e=>{let t=e.split(`/`);return t[t.length-1]||e},nt=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),$=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),rt=(e,t)=>{let n=nt(t);return n.length===0?e:e.flatMap(e=>{let t=Q(e.path);if($(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>$(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},it=e=>Z(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),at=e=>e?.selection?e.selection.kind===`all`?Z(`selection.allTests`):e.selection.kind===`case`?e.selection.name:Q(e.selection.path):Z(`selection.noRunYet`),ot=e=>/(^|\s)(?:FAIL|✗)(\s|$)|\b(?:failed|error|stderr|Expected:|Received:)\b/i.test(e)?`failure`:/(^|\s)(?:PASS|✓)(\s|$)|\bpassed\b/i.test(e)?`success`:/\b(?:WARN|warning|skipped|todo|pending)\b/i.test(e)?`warning`:`default`,st=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,ct=(e,t)=>e===t?!0:e.length===t.length?e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.name===r.name&&e.command===r.command&&e.cwd===r.cwd&&e.runner===r.runner}):!1,lt=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,ut=({line:e,tone:t})=>(0,z.jsx)(`div`,{"data-tone":t,className:b(`whitespace-pre-wrap break-words`,st(t)),children:e===``?` `:e}),dt=(0,R.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,z.jsxs)(`button`,{type:`button`,"aria-label":Z(`caseRow.runAriaLabel`,{name:r}),title:r,className:b(`flex w-full min-w-0 items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,e?`cursor-pointer hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,n&&`bg-sky-500/10`),disabled:!e,onClick:()=>{i(t,r)},children:[(0,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));dt.displayName=`TestCaseRow`;var ft=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let l=e===`file`&&n===i.path,d=e===`case`&&n===i.path;return(0,z.jsx)(P,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Z(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,z.jsx)(xe,{className:b(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Z(`fileRow.runAriaLabel`,{path:i.path}),className:b(`min-w-0 flex-1 rounded-xl border border-border/60 bg-background/20 px-2.5 py-2 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,r?`cursor-pointer hover:border-sky-400/35 hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,(l||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,z.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-sky-200`,children:(0,z.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:Q(i.path)}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Z(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,z.jsx)(I,{children:(0,z.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Z(`fileRow.noNamedTests`)}):(0,z.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,z.jsx)(dt,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});ft.displayName=`DiscoveryFileRow`;var pt=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,availableCommands:a,canRunGranular:c,discovery:l,expandedFiles:u,fullSuiteOnlyNotice:f,isLoading:p,selectedCommandId:m,selectedCommandName:h,sessionError:g,sessionStatus:_,shouldShowCommandSelector:v,onRunCase:ee,onRunFile:te,onSelectCommand:x,onToggleFile:S})=>{let[C,w]=(0,R.useState)(``),T=(0,R.useMemo)(()=>rt(l,C),[l,C]),ne=(0,R.useMemo)(()=>T.reduce((e,t)=>e+t.cases.length,0),[T]),re=nt(C).length>0;return(0,z.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[v&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Z(`scope.label`)}),(0,z.jsxs)(j,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(y,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Z(`scope.selectedCommandAriaLabel`),disabled:a.length===0||_===`running`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:h??Z(`scope.selectTestScope`)}),(0,z.jsx)(xe,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(n,{align:`start`,className:`w-72`,children:a.map(e=>(0,z.jsx)(A,{className:b(m===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{x(e.id)},children:(0,z.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),f&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:f}),(l.length>0||C.length>0)&&(0,z.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,z.jsx)(o,{type:`search`,value:C,onChange:e=>{w(e.target.value)},placeholder:Z(`filter.placeholder`),"aria-label":Z(`filter.ariaLabel`),className:`pr-10`}),C.length>0&&(0,z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Z(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{w(``)},children:(0,z.jsx)(r,{className:`size-4`})})]}),!a.length&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Z(`discovery.noCommands`)}),g&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:g}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Z(`discovery.fileCount`,{count:T.length}),`, `,Z(`discovery.caseCount`,{count:ne})]})}),p&&(0,z.jsx)(s,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:l.length===0&&!p?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilesDetected`)}):T.length===0?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilterMatches`)}):T.map(n=>(0,z.jsx)(ft,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,canRunGranular:c,file:n,isExpanded:re||(u[n.path]??!1),onRunCase:ee,onRunFile:te,onToggleFile:S},n.path))})]})]})})});pt.displayName=`DiscoveryPane`;var mt=(0,R.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,R.useMemo)(()=>t?S(t).replace(/\r\n/g,`
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,A as n,C as r,F as i,G as a,H as o,I as s,J as c,K as l,L as u,M as d,O as f,P as p,Q as m,R as h,S as g,T as _,U as v,X as y,Y as ee,Z as b,_ as te,_t as x,a as S,at as C,b as w,bt as T,c as ne,ct as re,et as ie,f as ae,g as E,gt as oe,h as D,ht as O,it as k,j as A,k as j,l as se,m as ce,mt as le,n as ue,nt as de,o as fe,ot as pe,p as M,pt as me,q as he,rt as ge,s as _e,st as ve,t as N,tt as ye,v as P,vt as be,x as F,y as I,yt as L,z as xe}from"./index-D5TEfELZ.js";var R=e(T(),1),z=me(),Se=({title:e,children:t,defaultOpen:n=!1})=>(0,z.jsxs)(P,{defaultOpen:n,className:`mt-5 rounded-2xl border border-border/70 bg-background/25`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":e,className:`group flex w-full items-center gap-2 rounded-2xl px-4 py-3 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 text-sm font-semibold text-foreground`,children:e}),(0,z.jsx)(xe,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsx)(I,{className:`border-t border-border/60 px-4 py-3`,children:t})]}),B=e=>{if(!e.file_path)return null;if(!e.start_line)return e.file_path;let t=`${e.start_line}${e.start_column?`:${e.start_column}`:``}`,n=e.end_line?`-${e.end_line}${e.end_column?`:${e.end_column}`:``}`:``;return`${e.file_path}:${t}${n}`},V=[`error`,`warning`,`info`,`unknown`],H=e=>{let t={error:0,warning:0,info:0,unknown:0};return e.forEach(e=>{t[e.severity]+=1}),t},U=({counts:e,totalCount:t})=>{let{t:n}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),r=V.filter(t=>e[t]>0);return(0,z.jsxs)(`div`,{"aria-label":n(`severitySummaryLabel`),className:`mt-3 flex flex-wrap items-center gap-2`,children:[r.map(t=>(0,z.jsx)(`span`,{className:`rounded-full border border-border/70 bg-background/45 px-2 py-1 text-[11px] text-muted-foreground`,children:n(`severityCount`,{count:e[t],severity:n(`severity.${t}`)})},t)),t>0&&t!==r.reduce((t,n)=>t+e[n],0)&&(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n(`totalAvailable`,{count:t})})]})},Ce=({attempt:e,parser:t,repair:n,ticketRequired:r,selectedTicketId:i,onSelectedTicketChange:a})=>{let{t:o}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),s=e.currency??`unavailable`;return(0,z.jsxs)(P,{className:`mt-4 rounded-xl border border-border/60 bg-background/25`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,"aria-label":o(`technicalDetails`),className:`group flex w-full items-center gap-2 rounded-xl px-3 py-2.5 text-left outline-none transition-colors hover:bg-accent/40 focus-visible:ring-2 focus-visible:ring-ring/60`,children:[(0,z.jsx)(`span`,{className:`text-xs font-semibold text-foreground`,children:o(`technicalDetails`)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:o(`technicalDetailsHint`)}),(0,z.jsx)(xe,{className:`size-4 shrink-0 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]})}),(0,z.jsxs)(I,{className:`border-t border-border/60 px-3 py-3`,children:[(0,z.jsxs)(`dl`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[t&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`parser.${t.parser_kind}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserStateLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`state.${t.status}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`parserRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${t.retention_state}`)})]})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`outputRetentionLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`retentionState.${e.output_retention_state}`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`applicabilityLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`applicability`,{state:o(`applicabilityState.${s}`)})})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`sourceLabel`)}),(0,z.jsx)(`dd`,{className:`mt-1 break-words text-foreground`,children:e.command_snapshot.name})]}),n&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-muted-foreground`,children:o(`destinationTitle`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-foreground`,children:o(`destination.${n.destination}`)}),(0,z.jsx)(`dd`,{className:`mt-1 text-muted-foreground`,children:o(`destinationHint`)})]})]}),r&&n&&(0,z.jsxs)(`label`,{className:`mt-3 block text-xs text-muted-foreground`,children:[o(`ticketLabel`),(0,z.jsxs)(`select`,{value:i,onChange:e=>a(e.target.value),className:`mt-1 h-10 w-full rounded-xl border border-border bg-card px-3 text-sm text-foreground`,children:[(0,z.jsx)(`option`,{value:``,children:o(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,z.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]})]})]})},W=({attempt:e,diagnostics:t,repair:n,selectedDiagnosticIds:r,selectedRawOutputAttemptRunIds:i,selectedAttemptRunIds:a,selectedTicketId:o,pending:s,activeRepair:c,autoFix:l,onSelectedTicketChange:u,onToggleDiagnostic:d,onToggleRawOutput:f,onStartRepair:p,onStopRepair:m})=>{let{t:h}=L(`common`,{keyPrefix:`checksDialog.diagnostics`}),{t:g}=L(`common`,{keyPrefix:`checksDialog`});if(e.execution_status!==`failed`)return null;let _=t?.parser??null,v=t?.diagnostics??[],ee=H(v),b=!!(l&&!l.terminal_reason),te=l?.attempts[l.attempts.length-1]??null,x=c?.terminal_result===null||b,S=!!(n?.eligibility.eligible&&n.eligible_attempt_run_ids.includes(e.execution_run_id)&&_?.status===`complete`&&_.retention_state===`retained`),C=!!(n?.eligibility.eligible&&n.eligible_raw_output_attempt_run_ids.includes(e.execution_run_id)&&e.output_retention_state===`retained`&&e.retained_output),w=i.has(e.execution_run_id),T=r.size,ne=T>=32,re=a.size>=8&&!a.has(e.execution_run_id),ie=ne?h(`diagnosticLimit`,{count:32}):re?h(`attemptLimit`,{count:8}):null,ae=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),E=T+i.size,oe=E>0&&(!ae||o!==``),D=n&&!n.eligibility.eligible?h(`disabled.${n.eligibility.reason}`):null,O=_&&t&&(_.status===`interrupted`||v.length===0&&[`unsupported`,`malformed`].includes(_.status))?_.status:null,k=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count===0),A=!!(_&&t&&v.length===0&&_.status===`complete`&&_.retention_state===`retained`&&_.diagnostic_count>0),j=_?.diagnostic_count??v.length;return(0,z.jsxs)(`section`,{"aria-labelledby":`diagnostics-${e.execution_run_id}`,className:`mt-5 rounded-2xl border border-border/70 bg-background/25 p-4`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:h(`title`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:_&&_.status===`pending`?h(`loading`):_&&j>0?A||_.retention_state===`expired`?h(`totalAvailable`,{count:j}):h(`availableCount`,{count:j}):h(t?`noneAvailable`:`loading`)}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:h(`failureOutcome`,{outcome:e.outcome?g(`outcomeValue.${e.outcome}`):g(`status.${e.execution_status}`)})}),t&&v.length>0&&(0,z.jsx)(U,{counts:ee,totalCount:j})]})}),_?.retention_state===`expired`&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`expired`)}),_?.truncated&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:h(`truncated`)}),O&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`fallback.${O}`)}),k&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`noStructuredDiagnostics`)}),A&&(0,z.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:h(`structuredDetailsUnavailable`)}),C&&(0,z.jsxs)(`label`,{className:`mt-4 flex items-start gap-3 rounded-xl border border-amber-400/25 bg-amber-500/5 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,"aria-label":h(`rawOutputSelect`),checked:w,disabled:x||!w&&re,onChange:e=>f(e.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:h(`rawOutputSelect`)}),(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(`rawOutputHint`)}),e.retained_start_offset>0&&(0,z.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:h(`rawOutputTruncated`)})]})]}),t&&v.length>0&&(0,z.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,z.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:h(`selectLegend`)}),(0,z.jsx)(`ul`,{className:`mt-2 space-y-2`,children:v.map(e=>{let t=B(e),n=r.has(e.id);return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:n,disabled:!S||x||!n&&ie!==null,onChange:t=>d(e.id,t.target.checked)}),(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,z.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:h(`severity.${e.severity}`)}),e.code&&(0,z.jsx)(`code`,{children:e.code})]}),(0,z.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:e.message}),t&&(0,z.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:t})]})]})},e.id)})})]}),D&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),ie&&(0,z.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:ie}),c&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:h(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),l&&(0,z.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,role:`status`,children:[(0,z.jsx)(`p`,{className:`font-medium text-sky-100`,children:l.terminal_reason?h(`autoFix.terminal.${l.terminal_reason}`):te?.fallback_used?h(`autoFix.phase.fallback`):h(`autoFix.phase.${l.phase}`)}),!l.terminal_reason&&l.attempt_count>0&&(0,z.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:h(`autoFix.attempt`,{current:l.attempt_count,total:l.max_attempts})})]}),(0,z.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:h(`selectedEvidence`,{count:E})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(y,{type:`button`,size:`sm`,disabled:n?.eligibility.eligible!==!0||!oe||s||x,title:D??void 0,onClick:p,children:s?h(`starting`):h(`repairSelectedEvidence`,{count:E})}),x&&(0,z.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:s||l?.phase===`stopping`,onClick:m,children:h(b?`autoFix.stop`:`stopRepair`)})]})]}),(0,z.jsx)(Ce,{attempt:e,parser:_,repair:n,ticketRequired:ae,selectedTicketId:o,onSelectedTicketChange:u})]})},G=({attempt:e})=>{let{t}=L(`common`,{keyPrefix:`checksDialog`}),n=e.retained_output?S(e.retained_output):``;return(0,z.jsxs)(Se,{title:t(`rawOutput`),defaultOpen:!0,children:[e.output_retention_state===`expired`&&(0,z.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputExpired`)}),e.output_retention_state===`retained`&&!n&&(0,z.jsx)(`p`,{className:`rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:t(`outputEmpty`)}),e.output_retention_state===`retained`&&n&&(0,z.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-xl border border-border bg-[#090b12] p-4 font-mono text-xs text-slate-200`,children:n}),e.retained_start_offset>0&&(0,z.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:t(`outputTruncated`)})]})},K=({definition:e,policy:t})=>{let{t:n}=L(`common`,{keyPrefix:`checksDialog`});return(0,z.jsxs)(`article`,{"aria-labelledby":`configured-check-${e.id}`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`configured-check-${e.id}`,className:`text-lg font-semibold text-foreground`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n(`status.notRun`)})]})}),(0,z.jsx)(`p`,{className:`mt-4 rounded-xl border border-dashed border-border px-3 py-2 text-sm text-muted-foreground`,children:n(`notRunDescription`)}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.cwd??n(`targetRoot`)})]}),t&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:n(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[n(t.required?`required`:`optional`),` · `,n(t.preReview?`preReview`:`finalOnly`)]})]})]})]})},we=({attempt:e,definition:t,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h,policy:g})=>{let{t:_}=L(`common`,{keyPrefix:`checksDialog`}),{t:v}=L(`common`,{keyPrefix:`activityView`});return e?(0,z.jsxs)(`article`,{"aria-labelledby":`selected-check-${e.execution_run_id}`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`selected-check-${e.execution_run_id}`,className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`status.${e.execution_status}`)})]}),e.outcome&&(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:_(`outcomeValue.${e.outcome}`)})]}),(0,z.jsxs)(`dl`,{className:`mt-4 grid gap-3 text-sm sm:grid-cols-2`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`command`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`directory`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??_(`targetRoot`)})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`outcome`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?_(`outcomeValue.${e.outcome}`):_(`status.${e.execution_status}`)})]}),e.currency&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`currencyLabel`)}),(0,z.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:v(`currency.${e.currency}`)})]}),g&&(0,z.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,z.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:_(`policyLabel`)}),(0,z.jsxs)(`dd`,{className:`mt-0.5 break-words text-foreground`,children:[_(g.required?`required`:`optional`),` · `,_(g.preReview?`preReview`:`finalOnly`)]})]})]}),e.execution_status===`failed`&&(0,z.jsx)(W,{attempt:e,diagnostics:n,repair:r,selectedDiagnosticIds:i,selectedRawOutputAttemptRunIds:a,selectedAttemptRunIds:o,selectedTicketId:s,pending:c,activeRepair:l,autoFix:u,onSelectedTicketChange:d,onToggleDiagnostic:f,onToggleRawOutput:p,onStartRepair:m,onStopRepair:h}),(0,z.jsx)(G,{attempt:e},e.execution_run_id)]}):t?(0,z.jsx)(K,{definition:t,policy:g}):(0,z.jsxs)(`section`,{"aria-labelledby":`selected-check-heading`,className:`rounded-2xl border border-dashed border-border p-6`,children:[(0,z.jsx)(`h2`,{id:`selected-check-heading`,className:`font-medium text-foreground`,children:_(`selectAttemptTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:_(`selectAttemptDescription`)})]})},q={current:`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`,stale:`border-amber-400/30 bg-amber-500/10 text-amber-200`,failed:`border-red-400/30 bg-red-500/10 text-red-200`,missing:`border-border bg-muted/40 text-muted-foreground`,interrupted:`border-orange-400/30 bg-orange-500/10 text-orange-200`,blocked:`border-amber-400/30 bg-amber-500/10 text-amber-200`},Te=(e,t)=>e.presentApplicability.appliesToCurrentState===!1?`stale`:t?t.execution_status===`interrupted`||t.execution_status===`cancelled`?`interrupted`:t.execution_status===`failed`?`failed`:t.currency===`stale`?`stale`:t.outcome&&t.outcome!==`passed`?`failed`:t.outcome===`passed`&&t.currency===`current`?`current`:e.decision===`blocked`?`blocked`:`current`:`missing`,Ee=e=>e===!0?`gateApplicability.overallCurrent`:e===!1?`gateApplicability.overallStale`:`gateApplicability.overallUnverifiable`,De=({evaluation:e})=>{let{t}=L(`common`,{keyPrefix:`checksDialog`}),n=e.presentApplicability.appliesToCurrentState===!1?`gateStale`:e.presentApplicability.appliesToCurrentState===null?`gateUnverifiable`:e.decision===`passed`?`gatePassed`:`gateBlocked`,r=e.reasonCodes[0],i=r?t(`gateReasonSummary`,{reason:t(`reason.${r}`)}):e.decision===`passed`?t(`gatePassedSummary`):t(`gateBlockedSummary`);return(0,z.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:t(`gateTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:i})]}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2.5 py-1 text-xs font-medium`,e.decision===`passed`&&e.presentApplicability.appliesToCurrentState===!0?q.current:q.blocked),children:t(n)})]}),(0,z.jsx)(Se,{title:t(`gateDetails`),children:(0,z.jsxs)(`div`,{className:`space-y-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{children:t(`gateScope`)}),(0,z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,z.jsx)(`p`,{children:t(`gateBoundary.label`,{boundary:t(`gateBoundary.${e.boundaryKind}`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:t(`gatePolicy`,{fingerprint:e.policy.fingerprint.slice(0,12)})}),(0,z.jsx)(`p`,{children:t(`gatePolicyStatus`,{status:t(e.policy.status===`valid`?`gatePolicyValid`:`gatePolicyInvalid`)})}),(0,z.jsx)(`p`,{className:`break-all`,children:e.sourceBatchRunId?t(`gateSourceBatch`,{batchId:e.sourceBatchRunId}):t(`gateNoBatch`)}),(0,z.jsx)(`p`,{className:`break-words`,children:t(`gateApplicability.label`,{workspace:t(`gateApplicability.${e.presentApplicability.workspace}`),policy:t(`gateApplicability.${e.presentApplicability.policy}`),overall:t(Ee(e.presentApplicability.appliesToCurrentState))})})]}),e.reasonCodes.length>0&&(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateReasonsTitle`)}),(0,z.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.reasonCodes.map(e=>(0,z.jsx)(`li`,{children:t(`reason.${e}`)},e))})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h3`,{className:`font-medium text-foreground`,children:t(`gateEvidenceTitle`)}),(0,z.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.policy.definitions.map(n=>{let r=Te(e,e.evaluatedAttempts.find(e=>e.definition_id===n.id));return(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:n.name}),(0,z.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:n.command})]}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-1 text-xs`,q[r]),children:t(`evidence.${r}`)})]},n.id)})})]}),e.policy.status===`invalid`&&(0,z.jsx)(`p`,{className:`break-words text-amber-200`,children:e.policy.error})]})})]})},Oe=e=>e.execution_status===`completed`?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:e.execution_status===`failed`||e.execution_status===`interrupted`?`border-red-400/30 bg-red-500/10 text-red-200`:e.execution_status===`running`||e.execution_status===`queued`?`border-sky-400/30 bg-sky-500/10 text-sky-200`:`border-border bg-muted/40 text-muted-foreground`,ke=e=>e.execution_status===`completed`&&e.outcome&&e.outcome!==`passed`?`outcomeValue.${e.outcome}`:`status.${e.execution_status}`,Ae=(e,t,n,r)=>((t?.attempts.find(t=>t.attempt_run_id===e.execution_run_id))?.diagnostics.filter(e=>n.has(e.id)).length??0)+ +!!r.has(e.execution_run_id),je=({definitions:e,attempts:t,requiredDefinitionIds:n,preReviewDefinitionIds:r,selectedDefinitionIds:i,selectedCheckId:a,diagnostics:o,selectedDiagnosticIds:s,selectedRawOutputAttemptRunIds:c,onToggleDefinition:l,onSelectCheck:u})=>{let{t:d}=L(`common`,{keyPrefix:`checksDialog`}),f=new Set(n),p=new Set(r),m=new Set(e.map(e=>e.id)),h=[...e.map(e=>({definition:e,attempt:t.find(t=>t.definition_id===e.id),historical:!1})),...t.filter(e=>!m.has(e.definition_id)).map(e=>({definition:e.command_snapshot,attempt:e,historical:!0}))];return(0,z.jsxs)(`section`,{"aria-labelledby":`configured-checks-heading`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`header`,{className:`shrink-0 border-b border-border/60 px-4 py-4 sm:px-5`,children:[(0,z.jsxs)(`div`,{className:`flex flex-col items-start gap-1`,children:[(0,z.jsx)(`h2`,{id:`configured-checks-heading`,className:`text-sm font-semibold text-foreground`,children:d(`configured`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:d(`selectionHint`)})]}),(0,z.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,z.jsx)(`p`,{className:`font-medium text-foreground`,children:d(`policySummary.title`)}),(0,z.jsx)(`p`,{className:`mt-1`,children:d(`policySummary.counts`,{requiredCount:n.length,preReviewCount:r.length})})]})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5 md:max-h-none md:py-5 max-md:max-h-[min(35vh,18rem)]`,children:(0,z.jsx)(`ul`,{"aria-label":d(`configured`),className:`space-y-2`,children:h.map(({definition:e,attempt:t,historical:n})=>{let r=a===e.id,m=t?Ae(t,o,s,c):0,h=f.has(e.id),g=p.has(e.id),_=`${d(`category.${e.category}`)} · ${d(h?`required`:`optional`)} · ${d(g?`preReview`:`finalOnly`)}`;return(0,z.jsx)(`li`,{className:`rounded-xl border border-border/60 bg-background/30 p-2.5`,children:(0,z.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[!n&&(0,z.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 shrink-0 accent-primary`,checked:i.has(e.id),"aria-label":d(`selectForRun`,{name:e.name}),onChange:t=>l(e.id,t.target.checked)}),t?(0,z.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(ke(t))}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name}),(0,z.jsx)(`span`,{className:b(`shrink-0 rounded-full border px-2 py-0.5 text-[11px] font-medium`,Oe(t)),children:d(ke(t))})]}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_}),m>0&&(0,z.jsx)(`span`,{"data-evidence-selected":`true`,className:`mt-1.5 inline-flex rounded-full border border-amber-400/30 bg-amber-500/10 px-2 py-0.5 text-[11px] text-amber-200`,children:d(`evidenceSelected`,{count:m})})]}):(0,z.jsxs)(`button`,{type:`button`,className:b(`min-w-0 flex-1 cursor-pointer rounded-lg px-1.5 py-1 text-left outline-none transition-colors hover:bg-accent/60 focus-visible:ring-2 focus-visible:ring-ring/60`,r&&`bg-accent/60`),"aria-label":d(`inspectAttempt`,{name:e.name,status:d(`status.notRun`)}),"aria-pressed":r,"aria-current":r?`true`:void 0,onClick:()=>u(e.id),children:[(0,z.jsx)(`span`,{className:`flex min-w-0 items-center justify-between gap-2`,children:(0,z.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,children:e.name})}),(0,z.jsx)(`span`,{className:`mt-1 block truncate text-[11px] text-muted-foreground`,children:_})]})]})},t?.execution_run_id??e.id)})})})]})},Me=(e,t)=>{let n=new Set(t?.attempts.filter(e=>e.parser.status===`complete`&&e.parser.retention_state===`retained`&&e.diagnostics.length>0).map(e=>e.attempt_run_id)??[]);return e.find(e=>e.execution_status===`failed`&&n.has(e.execution_run_id))??e.find(e=>e.execution_status===`failed`)??e.find(e=>e.execution_status===`running`)??e[0]??null},Ne=new Set([`queued`,`running`,`waiting`]),Pe=75,Fe=32,Ie=64,Le=3,Re=32,ze=8,J=(e,t)=>e instanceof le?e.message:t,Be=e=>{let t=new Set(e.repair.eligibility.eligible?e.repair.eligible_attempt_run_ids:[]);return new Set(e.attempts.filter(e=>t.has(e.attempt_run_id)).flatMap(e=>e.diagnostics.map(e=>e.id)))},Ve=e=>new Set(e.repair.eligibility.eligible?e.repair.eligible_raw_output_attempt_run_ids:[]),He=({projectId:e,targetKind:n,targetBundleId:r,definitions:i,requiredDefinitionIds:a=[],preReviewDefinitionIds:o=[],gateEvaluationId:s=null,directBatchRunId:c=null,directAttemptRunId:l=null,onSelectionChange:u,onUnavailable:d,onStatusChange:f})=>{let{t:p}=L(`common`,{keyPrefix:`checksDialog`}),m=se(),[h,g]=(0,R.useState)(()=>new Set(i.map(e=>e.id))),[_,v]=(0,R.useState)(null),[ee,b]=(0,R.useState)(null),[te,x]=(0,R.useState)(null),[S,w]=(0,R.useState)(null),[T,ae]=(0,R.useState)(!0),[E,D]=(0,R.useState)(null),[O,A]=(0,R.useState)(null),[j,ce]=(0,R.useState)(new Set),[ue,M]=(0,R.useState)(new Set),[me,he]=(0,R.useState)(``),[N,P]=(0,R.useState)(null),[be,F]=(0,R.useState)(!1),[I,xe]=(0,R.useState)(0),[Se,B]=(0,R.useState)(null),V=(0,R.useRef)(_),H=(0,R.useRef)(null),U=(0,R.useRef)(new Set),Ce=(0,R.useRef)(new Map),W=(0,R.useRef)(0),G=(0,R.useRef)(0),K=(0,R.useRef)(null),q=(0,R.useRef)(!1),Te=(0,R.useRef)(!0),Ee=(0,R.useRef)(null),Oe=(0,R.useRef)(`automatic`),ke=(0,R.useRef)(null),Ae=(0,R.useRef)(async()=>void 0),He=(0,R.useRef)(async()=>void 0),Ue=(0,R.useRef)(()=>void 0),We=(0,R.useRef)(0),Ge=(0,R.useRef)(O);V.current=_,Ge.current=O,Te.current=T||E!==null;let Y=(0,R.useCallback)((e,t)=>{Ee.current=e,Oe.current=t,x(e)},[]),Ke=(0,R.useCallback)(e=>{A(e),P(e.latest_repair?.source_batch_run_id===e.batch_run_id?e.latest_repair:null),ce(t=>{let n=Be(e);return new Set([...t].filter(e=>n.has(e)))}),M(t=>{let n=Ve(e);return new Set([...t].filter(e=>n.has(e)))}),he(t=>e.repair.candidate_tickets.some(e=>e.id===t)?t:e.repair.candidate_tickets.length===1&&e.repair.accepts_ticket_id?e.repair.candidate_tickets[0].id:``);let t=V.current;Oe.current===`automatic`&&t?.batch.execution_run_id===e.batch_run_id&&Y(Me(t.attempts,e)?.execution_run_id??null,`automatic`)},[Y]),qe=(0,R.useCallback)(e=>{let t=Ce.current;if(!t.has(e.attempt_run_id)&&t.size>=Fe){let e=t.keys().next().value;e&&(t.delete(e),U.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(Ie-1)),e])},[]),Je=(0,R.useCallback)((e,t,n=`route`)=>{let r=V.current?.batch.execution_run_id===e.batch.execution_run_id?V.current:null,i=!1,a=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of Ce.current.keys())a.has(e)||(Ce.current.delete(e),U.current.delete(e));let o=e.attempts.map(e=>{let t=!1,n=r?.attempts.find(t=>t.execution_run_id===e.execution_run_id),a=n&&n.output_revision>e.output_revision?n:e,o=Ce.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let n=_e(fe(a),e);if(n.status===`refetch`){t=!0,i=!0;continue}n.status===`applied`&&(a={...a,output_revision:n.snapshot.revision,retained_start_offset:n.snapshot.retainedStartOffset,retained_end_offset:n.snapshot.totalByteCount,total_persisted_bytes:n.snapshot.totalByteCount,retained_output:n.snapshot.retainedText})}return t?U.current.add(e.execution_run_id):(U.current.delete(e.execution_run_id),Ce.current.delete(e.execution_run_id)),a}),s={...e,attempts:o};K.current=e.batch.execution_run_id,V.current=s,v(s);let c=t?s.attempts.find(e=>e.execution_run_id===t):null,l=Ee.current,f=Oe.current,m=!!(l&&s.attempts.some(e=>e.execution_run_id===l)),h=Me(s.attempts,Ge.current?.batch_run_id===s.batch.execution_run_id?Ge.current:null),g=ke.current,_=!!(g&&g.batchRunId===s.batch.execution_run_id&&g.attemptRunId===t),y=!!(g&&g.previousBatchRunId===s.batch.execution_run_id&&g.previousAttemptRunId===t);if(n===`reset`)Y(h?.execution_run_id??null,`automatic`);else if(t)if(c)if(_)Y(c.execution_run_id,`manual`);else if(y&&f===`manual`)Y(m?l:h?.execution_run_id??null,m?`manual`:`automatic`);else{let e=f!==`external`||l!==c.execution_run_id;Y(c.execution_run_id,`external`),e&&u?.(s.batch.execution_run_id,c.execution_run_id)}else _||y?f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`):(Y(t,`external`),d?.());else n===`preserve`?f===`external`&&l?m?Y(l,`external`):(Y(l,`external`),d?.()):f===`manual`&&m?Y(l,`manual`):Y(f===`automatic`&&m?l:h?.execution_run_id??null,`automatic`):f===`manual`&&m?Y(l,`manual`):Y(h?.execution_run_id??null,`automatic`);i?Ue.current(e.batch.execution_run_id):We.current=0,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))},[u,d,p,Y]),X=(0,R.useCallback)(async(n,r)=>{let i=++W.current,a=await t(e,n,r);if(i!==W.current||a.batch.execution_run_id!==n||K.current!==null&&K.current!==n){a.batch.execution_run_id!==n&&d?.();return}Je(a,n===c?l:null)},[l,c,Je,d,e]);Ae.current=X,Ue.current=(0,R.useCallback)(e=>{if(H.current)return;if(We.current>=Le){We.current=0,U.current.clear(),Ce.current.clear();return}let t=Pe*2**We.current;H.current=setTimeout(()=>{H.current=null,We.current+=1,Ae.current(e).catch(t=>{B(J(t,p(`errors.load`))),U.current.size>0&&Ue.current(e)})},t)},[p]);let Z=(0,R.useCallback)(async t=>{let i=++W.current,a=await ge(e,n,r,t);if(i===W.current){if(a.batch_run_id){K.current=a.batch_run_id,await X(a.batch_run_id,t);return}!t?.aborted&&i===W.current&&(K.current=null,V.current=null,v(null),Y(null,`automatic`))}},[X,e,r,n,Y]),Ye=(0,R.useCallback)(async()=>{if(s||c){let e=K.current;e&&await X(e);return}await Z()},[c,s,X,Z]);He.current=Ye;let Xe=(0,R.useCallback)(e=>{H.current||=setTimeout(()=>{H.current=null,X(e).catch(e=>B(J(e,p(`errors.load`))))},Pe)},[X,p]);(0,R.useEffect)(()=>{let t=new AbortController;return ae(!0),B(null),(async()=>{if(c){if(b(null),l){let n=await ne(e,l,t.signal);if(n.run.kind!==`check_attempt`||n.details.kind!==`check_attempt`||!n.details.available||!n.details.attempt||n.details.attempt.batch_run_id!==c){d?.();return}}K.current=c,await X(c,t.signal);return}if(!s){b(null),await Z(t.signal);return}let n=await ye(e,s,t.signal);if(b(n),n.sourceBatchRunId){K.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}K.current=null,V.current=null,v(null),Y(null,`automatic`)})().catch(e=>{oe(e)||(e instanceof le&&e.status===404&&d?.(),B(J(e,p(`errors.load`))))}).finally(()=>{t.signal.aborted||(ae(!1),Te.current=!1,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe)))}),()=>t.abort()},[l,c,s,X,Z,d,e,p,Y]),(0,R.useEffect)(()=>{let t=_?.batch.execution_run_id;if(!t){G.current+=1,A(null),ce(new Set),M(new Set),he(``),P(null);return}Ge.current?.batch_run_id!==t&&(A(null),ce(new Set),M(new Set),he(``),P(null));let n=++G.current,r=new AbortController;return ie(e,t,r.signal).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(e=>{oe(e)||B(J(e,p(`errors.diagnostics`)))}),()=>r.abort()},[_?.batch.execution_run_id,I,Ke,e,p]),(0,R.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=K.current;if(n!==null&&t.batch_run_id!==n)return;let r=V.current;if(!r||U.current.has(t.attempt_run_id)){qe(t),r&&U.current.has(t.attempt_run_id)&&Ue.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){qe(t),Xe(r.batch.execution_run_id);return}let a=r.attempts[i],o=_e(fe(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){U.current.add(t.attempt_run_id),qe(t),Ue.current(r.batch.execution_run_id);return}let s=[...r.attempts];s[i]={...a,output_revision:o.snapshot.revision,retained_start_offset:o.snapshot.retainedStartOffset,retained_end_offset:o.snapshot.totalByteCount,total_persisted_bytes:o.snapshot.totalByteCount,retained_output:o.snapshot.retainedText};let c={...r,attempts:s};V.current=c,v(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(Te.current){q.current=!0;return}let n=V.current,r=t.execution_run_id??t.id;if(xe(e=>e+1),N&&r===N.execution_run_id&&N.source_batch_run_id===K.current&&de(e,N.execution_run_id).then(P).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){W.current+=1,Xe(n.batch.execution_run_id);return}q.current=!0,!Te.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))},r=()=>{xe(e=>e+1),Ye().catch(e=>B(J(e,p(`errors.load`))))};return m.on(`check-attempt:output`,t),m.on(`execution-run:updated`,n),m.on(`lifecycle-event:created`,n),m.on(`connect`,r),()=>{m.off(`check-attempt:output`,t),m.off(`execution-run:updated`,n),m.off(`lifecycle-event:created`,n),m.off(`connect`,r)}},[N,qe,e,Ye,Xe,m,p]),(0,R.useEffect)(()=>()=>{H.current&&clearTimeout(H.current),U.current.clear(),Ce.current.clear()},[]);let Ze=(e,t)=>{W.current+=1,K.current=e.batch.execution_run_id,Je(e,null,t)},Qe=async(e,t)=>{W.current+=1,Te.current=!0,D(e),B(null);try{let n=await t();e!==`stop`&&(ke.current=null),Ze(n,e===`stop`?`preserve`:`reset`),e!==`stop`&&u?.(n.batch.execution_run_id,void 0)}catch(t){B(J(t,p(`errors.${e}`))),t instanceof le&&t.status===409&&await Ye().catch(()=>void 0)}finally{D(null),Te.current=T,q.current&&!H.current&&(q.current=!1,H.current=setTimeout(()=>{H.current=null,He.current().catch(e=>B(J(e,p(`errors.load`))))},Pe))}},$e=_?Ne.has(_.batch.execution_status):!1,et=_?$e?`running`:_.batch.execution_status===`completed`?`finished`:_.batch.execution_status===`cancelled`||_.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,tt=_?.batch.execution_run_id??null,Q=O?.batch_run_id===tt?O:null,nt=N?.source_batch_run_id===tt?N:null,$=Q?.auto_fix??null,rt=!!($&&!$.terminal_reason),it=Q?Be(Q):new Set,at=Q?Ve(Q):new Set,ot=new Set([...j].filter(e=>it.has(e))),st=new Set([...ue].filter(e=>at.has(e))),ct=[...h],lt=_?.attempts.filter(e=>e.execution_status!==`completed`).length??0,ut=async()=>{let t=[...ot],n=[...st];if(!(!Q||!tt||K.current!==tt||Q.repair.eligibility.eligible!==!0||nt?.terminal_result===null||$&&!$.terminal_reason||t.length===0&&n.length===0)){F(!0),B(null);try{let r=await pe(e,t,n,Q.repair.accepts_ticket_id?Q.repair.candidate_tickets.some(e=>e.id===me)?me:Q.repair.candidate_tickets[0]?.id||null:null);P(r.source_batch_run_id===tt?r:null)}catch(t){if(B(J(t,p(`errors.repair`))),t instanceof le&&t.status===409&&_){let t=_.batch.execution_run_id,n=++G.current;ie(e,t).then(e=>{n===G.current&&e.batch_run_id===t&&K.current===t&&Ke(e)}).catch(()=>void 0)}}finally{F(!1)}}},dt=async()=>{let t=$&&!$.terminal_reason?$.execution_run_id:nt?.execution_run_id;if(t){F(!0),B(null);try{let n=await re(e,t);`source_batch_run_id`in n&&P(n),xe(e=>e+1)}catch(e){B(J(e,p(`errors.repairStop`)))}finally{F(!1)}}},ft=new Set([...Q?.attempts.filter(e=>e.diagnostics.some(e=>ot.has(e.id))).map(e=>e.attempt_run_id)??[],...st]),pt=(e,t,n)=>{ce(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=Re||!Q||!it.has(t))return r;let a=new Set(Q.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=ze?r:(i.add(t),i)})},mt=(e,t)=>{M(n=>{let r=new Set(n);return t?!ft.has(e)&&ft.size>=ze||!at.has(e)?n:(r.add(e),r):(r.delete(e),r)})},ht=(e,t)=>{g(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},gt=e=>{_&&(w(null),ke.current={batchRunId:_.batch.execution_run_id,attemptRunId:e,previousBatchRunId:c===_.batch.execution_run_id?c:null,previousAttemptRunId:c===_.batch.execution_run_id?l:null},Y(e,`manual`),u?.(_.batch.execution_run_id,e))},_t=e=>{let t=_?.attempts.find(t=>t.definition_id===e);if(t){gt(t.execution_run_id);return}w(e)},vt=S?_?.attempts.find(e=>e.definition_id===S)??null:_?.attempts.find(e=>e.execution_run_id===te)??null,yt=vt?.command_snapshot??i.find(e=>e.id===S)??null,bt=S??vt?.definition_id??null,xt=yt?{required:a.includes(yt.id),preReview:o.includes(yt.id)}:null;return(0,R.useEffect)(()=>{f?.(et)},[et,f]),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Se&&(0,z.jsx)(`p`,{role:`alert`,className:`mx-4 mt-3 rounded-xl border border-red-400/25 bg-red-500/10 px-3 py-2 text-sm text-red-200 sm:mx-6`,children:Se}),(0,z.jsxs)(`div`,{role:`toolbar`,"aria-label":p(`runActions`),className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-y border-border/70 bg-background/30 px-4 py-3 sm:px-6`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:p(`runActions`)})}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(y,{type:`button`,size:`sm`,disabled:ct.length===0||$e||rt||E!==null,onClick:()=>void Qe(`run`,()=>C(e,{targetKind:n,targetBundleId:r,definitionIds:ct})),children:p(E===`run`?`starting`:`runSelected`)}),_&&$e&&(0,z.jsx)(y,{type:`button`,variant:`destructive`,size:`sm`,disabled:E!==null||be,onClick:()=>void(rt?dt():Qe(`stop`,()=>ve(e,_.batch.execution_run_id))),children:p(E===`stop`||be?`stopping`:`stop`)}),_&&!$e&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:rt||E!==null,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`all`})),children:p(`rerunAll`)}),(0,z.jsx)(y,{type:`button`,variant:`outline`,size:`xs`,disabled:rt||E!==null||lt===0,onClick:()=>void Qe(`rerun`,()=>k(e,_.batch.execution_run_id,{mode:`failed_only`})),children:p(`rerunFailed`)})]})]})]}),(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,auto)_minmax(0,1fr)] overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)] md:grid-rows-1`,children:[(0,z.jsx)(`aside`,{className:`flex min-h-0 flex-col border-b border-border/70 md:border-r md:border-b-0`,children:(0,z.jsx)(je,{definitions:i,attempts:_?.attempts??[],requiredDefinitionIds:a,preReviewDefinitionIds:o,selectedDefinitionIds:h,selectedCheckId:bt,diagnostics:Q,selectedDiagnosticIds:ot,selectedRawOutputAttemptRunIds:st,onToggleDefinition:ht,onSelectCheck:_t})}),(0,z.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[s&&!ee&&T&&(0,z.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:p(`gateLoading`)}),ee&&(0,z.jsx)(De,{evaluation:ee}),T&&(0,z.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:p(`loading`)}),!T&&!_&&!yt&&(0,z.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,z.jsx)(`h2`,{className:`font-medium text-foreground`,children:p(`emptyTitle`)}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:p(`emptyDescription`)})]}),_&&(0,z.jsx)(z.Fragment,{children:(0,z.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:p(`status.${_.batch.execution_status}`)}),(0,z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:p(`summary`,{passed:_.batch.passed_count,failed:_.batch.failed_count,running:_.batch.running_count,queued:_.batch.queued_count})}),_.batch.stop_requested&&(0,z.jsx)(`span`,{className:`text-xs text-amber-200`,children:p(`stopRequested`)})]})}),(_||yt)&&(0,z.jsx)(z.Fragment,{children:(0,z.jsx)(we,{attempt:vt,definition:yt,diagnostics:Q?.attempts.find(e=>e.attempt_run_id===vt?.execution_run_id)??null,repair:Q?.repair??null,selectedDiagnosticIds:ot,selectedRawOutputAttemptRunIds:st,selectedAttemptRunIds:ft,selectedTicketId:me,pending:be,activeRepair:nt,autoFix:$,policy:xt,onSelectedTicketChange:he,onToggleDiagnostic:(e,t)=>vt&&pt(vt.execution_run_id,e,t),onToggleRawOutput:e=>vt&&mt(vt.execution_run_id,e),onStartRepair:()=>void ut(),onStopRepair:()=>void dt()})})]})]})]})},Ue=(e,t)=>be(O(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),We=(e,t)=>be(O(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),Ge=(e,t={})=>be(O(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),Y=(e,t)=>be(O(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),Ke=e=>be(O(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),qe=e=>x(O(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),Je=256*1024,X=24,Z=(e,t)=>g.t(`common:testsDialog.${e}`,t),Ye=(e,t)=>{let n=`${e}${t}`;return n.length<=Je?n:n.slice(-Je)},Xe=(e,t)=>e?e.run_id&&t.run_id&&e.run_id!==t.run_id?e.status===`running`||t.status!==`running`?e:t:e.status!==`idle`&&e.status!==`running`&&t.status===`running`?e:e.run_id===t.run_id&&e.output.length>t.output.length?{...t,output:e.output,output_truncated:e.output_truncated||t.output_truncated}:t:t,Ze=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=X,Qe=e=>{e.scrollTop=e.scrollHeight},$e=(e,t=!1)=>{Qe(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{Qe(e),t&&(r=window.requestAnimationFrame(()=>{Qe(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},et=e=>e===`running`?`border-sky-400/40 bg-sky-500/10 text-sky-200`:e===`passed`?`border-emerald-400/40 bg-emerald-500/10 text-emerald-200`:e===`failed`||e===`error`?`border-rose-400/40 bg-rose-500/10 text-rose-200`:e===`stopped`?`border-amber-400/40 bg-amber-500/10 text-amber-200`:`border-border/70 bg-background/60 text-muted-foreground`,tt=e=>{if(e==null)return null;if(e<1e3)return`${e} ms`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${(e/1e3).toFixed(e>=1e4?0:1)} s`},Q=e=>{let t=e.split(`/`);return t[t.length-1]||e},nt=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),$=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),rt=(e,t)=>{let n=nt(t);return n.length===0?e:e.flatMap(e=>{let t=Q(e.path);if($(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>$(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},it=e=>Z(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),at=e=>e?.selection?e.selection.kind===`all`?Z(`selection.allTests`):e.selection.kind===`case`?e.selection.name:Q(e.selection.path):Z(`selection.noRunYet`),ot=e=>/(^|\s)(?:FAIL|✗)(\s|$)|\b(?:failed|error|stderr|Expected:|Received:)\b/i.test(e)?`failure`:/(^|\s)(?:PASS|✓)(\s|$)|\bpassed\b/i.test(e)?`success`:/\b(?:WARN|warning|skipped|todo|pending)\b/i.test(e)?`warning`:`default`,st=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,ct=(e,t)=>e===t?!0:e.length===t.length?e.every((e,n)=>{let r=t[n];return r!=null&&e.id===r.id&&e.name===r.name&&e.command===r.command&&e.cwd===r.cwd&&e.runner===r.runner}):!1,lt=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,ut=({line:e,tone:t})=>(0,z.jsx)(`div`,{"data-tone":t,className:b(`whitespace-pre-wrap break-words`,st(t)),children:e===``?` `:e}),dt=(0,R.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,z.jsxs)(`button`,{type:`button`,"aria-label":Z(`caseRow.runAriaLabel`,{name:r}),title:r,className:b(`flex w-full min-w-0 items-center gap-2.5 rounded-xl px-2.5 py-1.5 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,e?`cursor-pointer hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,n&&`bg-sky-500/10`),disabled:!e,onClick:()=>{i(t,r)},children:[(0,z.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,z.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));dt.displayName=`TestCaseRow`;var ft=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:o,onRunFile:s,onToggleFile:c})=>{let l=e===`file`&&n===i.path,d=e===`case`&&n===i.path;return(0,z.jsx)(P,{open:a,onOpenChange:e=>{c(i.path,e)},children:(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(w,{asChild:!0,children:(0,z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Z(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,z.jsx)(xe,{className:b(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,z.jsx)(`button`,{type:`button`,"aria-label":Z(`fileRow.runAriaLabel`,{path:i.path}),className:b(`min-w-0 flex-1 rounded-xl border border-border/60 bg-background/20 px-2.5 py-2 text-left transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring/50`,r?`cursor-pointer hover:border-sky-400/35 hover:bg-sky-500/10`:`cursor-not-allowed opacity-60`,(l||d)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{s(i.path)},children:(0,z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,z.jsx)(`span`,{className:`flex size-6 shrink-0 items-center justify-center rounded-md border border-border/70 bg-background/60 text-sky-200`,children:(0,z.jsx)(u,{className:`h-3.5 w-3.5`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:Q(i.path)}),(0,z.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,z.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Z(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,z.jsx)(I,{children:(0,z.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,z.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Z(`fileRow.noNamedTests`)}):(0,z.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let s=e===`case`&&n===i.path&&t===a.name;return(0,z.jsx)(dt,{canRunGranular:r,filePath:i.path,isActive:s,name:a.name,onRunCase:o},a.id)})})})})]})})});ft.displayName=`DiscoveryFileRow`;var pt=(0,R.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,availableCommands:a,canRunGranular:c,discovery:l,expandedFiles:u,fullSuiteOnlyNotice:f,isLoading:p,selectedCommandId:m,selectedCommandName:h,sessionError:g,sessionStatus:_,shouldShowCommandSelector:v,onRunCase:ee,onRunFile:te,onSelectCommand:x,onToggleFile:S})=>{let[C,w]=(0,R.useState)(``),T=(0,R.useMemo)(()=>rt(l,C),[l,C]),ne=(0,R.useMemo)(()=>T.reduce((e,t)=>e+t.cases.length,0),[T]),re=nt(C).length>0;return(0,z.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[v&&(0,z.jsxs)(`div`,{className:`space-y-2`,children:[(0,z.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Z(`scope.label`)}),(0,z.jsxs)(j,{children:[(0,z.jsx)(d,{asChild:!0,children:(0,z.jsxs)(y,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Z(`scope.selectedCommandAriaLabel`),disabled:a.length===0||_===`running`,children:[(0,z.jsx)(`span`,{className:`truncate`,children:h??Z(`scope.selectTestScope`)}),(0,z.jsx)(xe,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,z.jsx)(n,{align:`start`,className:`w-72`,children:a.map(e=>(0,z.jsx)(A,{className:b(m===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{x(e.id)},children:(0,z.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),f&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:f}),(l.length>0||C.length>0)&&(0,z.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,z.jsx)(o,{type:`search`,value:C,onChange:e=>{w(e.target.value)},placeholder:Z(`filter.placeholder`),"aria-label":Z(`filter.ariaLabel`),className:`pr-10`}),C.length>0&&(0,z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Z(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{w(``)},children:(0,z.jsx)(r,{className:`size-4`})})]}),!a.length&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Z(`discovery.noCommands`)}),g&&(0,z.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:g}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,z.jsx)(`div`,{className:`min-w-0`,children:(0,z.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Z(`discovery.fileCount`,{count:T.length}),`, `,Z(`discovery.caseCount`,{count:ne})]})}),p&&(0,z.jsx)(s,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:l.length===0&&!p?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilesDetected`)}):T.length===0?(0,z.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Z(`discovery.noFilterMatches`)}):T.map(n=>(0,z.jsx)(ft,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:i,canRunGranular:c,file:n,isExpanded:re||(u[n.path]??!1),onRunCase:ee,onRunFile:te,onToggleFile:S},n.path))})]})]})})});pt.displayName=`DiscoveryPane`;var mt=(0,R.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,R.useMemo)(()=>t?S(t).replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`).map(e=>({line:e,tone:ot(e)})):[],[t]);return(0,z.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,z.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,z.jsx)(F,{variant:`outline`,className:b(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,et(i)),children:it(i)}),a&&(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,z.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,z.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:tt(e)}),n&&(0,z.jsx)(F,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:Z(`output.trimmed`)})]}),(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,z.jsx)(`div`,{ref:o,"aria-label":Z(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,z.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,z.jsx)(ut,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,z.jsx)(`div`,{className:`text-slate-200`,children:Z(`output.empty`)})})})})]})})});mt.displayName=`OutputPane`;var ht=(0,R.forwardRef)(({testCommands:e,onStatusChange:t,onTargetLabelChange:n,onClose:r,...o},s)=>{let u=o.scope,d=o.projectId,f=o.scope===`ticket`?o.ticketId:null,h=o.scope===`project`?o.targetKind:null,g=o.scope===`project`?o.targetBundleId:null,[b,te]=(0,R.useState)(e),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)([]),[T,ne]=(0,R.useState)(``),[re,ie]=(0,R.useState)({}),[E,oe]=(0,R.useState)(!0),[D,O]=(0,R.useState)(!1),[k,A]=(0,R.useState)(!1),[j,se]=(0,R.useState)(null),[ce,de]=(0,R.useState)(!1),[fe,pe]=(0,R.useState)(!1),M=(0,R.useRef)(null),me=(0,R.useRef)(!1),ge=(0,R.useRef)(null),_e=(0,R.useRef)(!0),ve=(0,R.useRef)(null),N=(0,R.useRef)(null),ye=x?.selection?.kind??null,P=x?.selection?.kind===`all`?null:x?.selection?.path??null,be=x?.selection?.kind===`case`?x.selection.name:null,F=x?.id??null,I=x?.status??null,L=(0,R.useMemo)(()=>b.find(e=>e.id===T)??null,[b,T]),xe=(0,R.useMemo)(()=>{if(x?.summary?.failed_count==null&&x?.summary?.passed_count==null&&x?.summary?.failed_file_count==null&&x?.summary?.passed_file_count==null)return null;let e=x?.summary?.failed_count==null&&x?.summary?.passed_count==null;return{failed:I===`failed`&&x?.summary?.failed_count==null&&x?.summary?.failed_file_count!=null||e?{count:x?.summary?.failed_file_count??0,label:Z(`summaryCounts.filesFailed`)}:{count:x?.summary?.failed_count??0,label:Z(`summaryCounts.failed`)},passed:e?{count:x?.summary?.passed_file_count??0,label:Z(`summaryCounts.filesPassed`)}:{count:x?.summary?.passed_count??x?.summary?.passed_file_count??0,label:Z(`summaryCounts.passed`)}}},[x?.summary?.failed_count,x?.summary?.passed_count,x?.summary?.failed_file_count,x?.summary?.passed_file_count,I]),Se=L?.runner===`unknown`?Z(`scope.fullSuiteOnlyNotice`):null,B=!!(L&&x?.status!==`running`&&!D&&!k),V=B,H=B&&fe,U=b.length>1,{runs:Ce}=ue(d),W=x?.run_id?Ce.find(e=>e.id===x.run_id)??null:null;(0,R.useEffect)(()=>{T||b.length===0||ne(b[0]?.id??``)},[b,T]),(0,R.useEffect)(()=>{e.length>0&&te(t=>ct(t,e)?t:e)},[e]),(0,R.useEffect)(()=>{if(b.length>0||!d)return;let e=new AbortController;return m(e.signal).then(e=>{let t=e.find(e=>e.id===d);t&&te(e=>{let n=ae(t);return ct(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[b.length,d]),(0,R.useEffect)(()=>{let e=e=>{!e||e.id!==M.current||S(t=>Xe(t,e))},t=e=>{!e||e.session_id!==M.current||S(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Ye(t.output,e.chunk),output_truncated:e.output_truncated})};return _.on(`test-session:updated`,e),_.on(`test-session:output`,t),()=>{_.off(`test-session:updated`,e),_.off(`test-session:output`,t)}},[]),(0,R.useEffect)(()=>{let e=ge.current;if(!e){ve.current=x?.output??null,N.current=x?.status??null;return}let t=ve.current!==(x?.output??null),n=N.current!==`running`&&x?.status===`running`,r=N.current===`running`&&x?.status!==`running`;if(n&&(_e.current=!0),n||t&&x?.status===`running`&&_e.current||r&&_e.current){let t=$e(e,r);return ve.current=x?.output??null,N.current=x?.status??null,t}ve.current=x?.output??null,N.current=x?.status??null},[x?.output,x?.status]),(0,R.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!d)return;t=await Ue(d,{target_kind:h??`repo_root`,target_bundle_id:g??null})}else t=await We(f??``,d);if(e){qe(t.id).catch(()=>{});return}M.current=t.id,S(t)}catch(t){e||se(t instanceof le?t.message:Z(`messages.loadRunnerError`))}finally{!e&&M.current==null&&oe(!1)}})(),()=>{e=!0}},[d,u,g,h,f]),(0,R.useEffect)(()=>{W&&S(e=>{if(!e||e.run_id!==W.id)return e;let t=W.status===`completed`?`passed`:W.status===`failed`?`failed`:W.status===`cancelled`||W.status===`interrupted`?`stopped`:`running`;return e.status===t&&e.error===(W.failure?.message??e.error)?e:{...e,status:t,error:W.failure?.message??e.error,started_at:W.started_at??e.started_at,completed_at:W.completed_at??e.completed_at}})},[W]),(0,R.useEffect)(()=>{if(!x?.id){pe(!1);return}if(b.length>0&&!T){pe(!1);return}let e=new AbortController,t=!1;return oe(!0),pe(!1),Ge(x.id,{commandId:T||null,signal:e.signal}).then(e=>{t||(w(e.files),pe(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||se(n instanceof le?n.message:Z(`messages.discoverError`))}).finally(()=>{t||oe(!1)}),()=>{t=!0,e.abort()}},[b.length,T,x?.id]),(0,R.useEffect)(()=>()=>{let e=M.current;!e||me.current||(me.current=!0,qe(e).catch(()=>{}))},[]);let G=(0,R.useCallback)(async e=>{if(!(!F||I===`running`||!L||D||k)){se(null),O(!0);try{let t=await Y(F,{command_id:L.id,selection:e});S(e=>Xe(e,t))}catch(e){se(e instanceof le?e.message:Z(`messages.startError`))}finally{O(!1)}}},[D,k,L,F,I]),K=(0,R.useCallback)(async()=>{if(!(!F||I!==`running`||k)){se(null),A(!0);try{let e=await Ke(F);S(t=>Xe(t,e))}catch(e){se(e instanceof le?e.message:Z(`messages.stopError`))}finally{A(!1)}}},[k,F,I]),we=(0,R.useCallback)(()=>{let e=M.current;if(!e||me.current){r();return}me.current=!0,r(),qe(e).catch(()=>{})},[r]),q=(0,R.useCallback)(()=>{if(I===`running`){de(!0);return}we()},[we,I]);(0,R.useImperativeHandle)(s,()=>({requestClose:q}),[q]),(0,R.useEffect)(()=>{t?.(I===`running`?`running`:I===`passed`?`finished`:I===`failed`||I===`error`?`error`:I===`stopped`?`interrupted`:`inactive`)},[t,I]),(0,R.useEffect)(()=>{x?.target_label&&n?.(x.target_label)},[n,x?.target_label]);let Te=(0,R.useCallback)(()=>{let e=ge.current;e&&(_e.current=Ze(e))},[]),Ee=(0,R.useCallback)(e=>{ne(e)},[]),De=(0,R.useCallback)((e,t)=>{ie(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Oe=(0,R.useCallback)(e=>{G({kind:`file`,path:e})},[G]),ke=(0,R.useCallback)((e,t)=>{G({kind:`case`,path:e,name:t})},[G]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-0 lg:grid-cols-[22rem_minmax(0,1fr)] lg:grid-rows-1`,children:[(0,z.jsx)(pt,{activeSelectionKind:ye,activeSelectionName:be,activeSelectionPath:P,availableCommands:b,canRunGranular:H,discovery:C,expandedFiles:re,fullSuiteOnlyNotice:Se,isLoading:E,selectedCommandId:T,selectedCommandName:L?.name??null,sessionError:j,sessionStatus:I,shouldShowCommandSelector:U,onRunCase:ke,onRunFile:Oe,onSelectCommand:Ee,onToggleFile:De}),(0,z.jsx)(mt,{durationMs:x?.duration_ms??null,output:x?.output??``,outputTruncated:x?.output_truncated??!1,selectionLabel:at(x),status:I,summaryCounts:xe,viewportRef:ge,onScroll:Te})]}),(0,z.jsx)(he,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,z.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:x?.status===`running`?(0,z.jsxs)(y,{type:`button`,variant:`destructive`,className:lt,onClick:()=>{K()},disabled:k,children:[(0,z.jsx)(p,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:Z(`actions.stop`)})]}):(0,z.jsxs)(y,{type:`button`,variant:`success`,className:lt,disabled:!V,onClick:()=>{G({kind:`all`})},children:[(0,z.jsx)(i,{className:`h-4 w-4`}),(0,z.jsx)(`span`,{children:Z(`actions.run`)})]})})})]}),(0,z.jsx)(v,{open:ce,onOpenChange:de,children:(0,z.jsxs)(a,{showCloseButton:!1,overlayClassName:`z-[60] bg-black/60`,className:`z-[60] max-w-md rounded-2xl border border-border bg-card p-6 shadow-2xl`,children:[(0,z.jsxs)(c,{children:[(0,z.jsx)(ee,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:Z(`closeConfirmation.title`)}),(0,z.jsx)(l,{className:`text-sm text-foreground whitespace-pre-line`,children:Z(`closeConfirmation.description`)})]}),(0,z.jsxs)(he,{className:`sm:flex-row sm:justify-end`,children:[(0,z.jsx)(y,{type:`button`,variant:`ghost`,onClick:()=>de(!1),children:Z(`closeConfirmation.keepRunning`)}),(0,z.jsx)(y,{type:`button`,variant:`destructive`,onClick:()=>{de(!1),we()},children:Z(`closeConfirmation.stopAndClose`)})]})]})})]})});ht.displayName=`TestsPanel`;var gt=`archon.verification-tab`,_t=()=>{try{let e=window.localStorage.getItem(gt);return e===`checks`||e===`tests`?e:null}catch{return null}},vt=e=>{try{window.localStorage.setItem(gt,e)}catch{}},yt=({targetLabel:e,definitions:t,requiredDefinitionIds:n=[],preReviewDefinitionIds:i=[],checksTarget:o,testsTarget:s,onClose:c,onOpenActivity:u,requestedInitialTab:d,directBatchRunId:p,directAttemptRunId:m,onCheckSelectionChange:g,onUnavailable:_})=>{let{t:b}=L(`common`,{keyPrefix:`verificationDialog`}),x=M(t),S=o!==null&&(t.length>0||!!o.gateEvaluationId||!!p),C=s!==null&&x.length>0,[w,T]=(0,R.useState)(()=>{if(d===`checks`&&S||d===`tests`&&C)return d;let e=_t();return e===`checks`&&S||e===`tests`&&C?e:S?`checks`:`tests`}),[ne,re]=(0,R.useState)(()=>new Set([w])),[ie,ae]=(0,R.useState)(`inactive`),[oe,O]=(0,R.useState)(`inactive`),k=(0,R.useRef)(null),A=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(w===`checks`&&!S||w===`tests`&&!C){let e=S?`checks`:`tests`;T(e),re(t=>new Set(t).add(e))}},[w,S,C]);let j=e=>{if(A.current=e??null,s){let e=k.current;if(e){e.requestClose();return}}(e??c)()},se=()=>{let e=A.current??c;A.current=null,e()};return(0,z.jsx)(v,{open:!0,onOpenChange:e=>{e||j()},children:(0,z.jsxs)(a,{showCloseButton:!1,className:`flex h-[calc(100vh-1rem)] max-h-[58rem] w-full max-w-[calc(100%-1rem)] flex-col gap-0 overflow-hidden rounded-3xl p-0 sm:h-[calc(100vh-2rem)] sm:max-w-7xl`,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.stopPropagation(),children:[(0,z.jsx)(ee,{className:`sr-only`,children:b(`title`)}),(0,z.jsx)(l,{className:`sr-only`,children:b(`description`)}),(0,z.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-border/70 px-4 py-4 sm:px-6`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,z.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border bg-background/60 text-sky-200`,children:(0,z.jsx)(h,{className:`size-5`})}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:b(`title`)}),(0,z.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u&&(0,z.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>j(u),children:b(`openActivity`)}),(0,z.jsx)(y,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":b(`close`),onClick:()=>j(),children:(0,z.jsx)(r,{className:`size-4`})})]})]}),(0,z.jsxs)(ce,{value:w,onValueChange:e=>{e!==`checks`&&e!==`tests`||(T(e),re(t=>new Set(t).add(e)),vt(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,z.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,z.jsxs)(E,{"aria-label":b(`tabsAriaLabel`),children:[S&&(0,z.jsxs)(te,{value:`checks`,className:`gap-2`,children:[(0,z.jsx)(h,{className:`size-4`}),(0,z.jsx)(`span`,{children:b(`tabs.checks.label`)}),(0,z.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.checks.${ie}`),children:(0,z.jsx)(f,{state:ie})})]}),C&&(0,z.jsxs)(te,{value:`tests`,className:`gap-2`,children:[(0,z.jsx)(N,{className:`size-4`}),(0,z.jsx)(`span`,{children:b(`tabs.tests.label`)}),(0,z.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":b(`status.tests.${oe}`),children:(0,z.jsx)(f,{state:oe})})]})]}),(0,z.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:b(`tabs.${w}.description`)})]}),S&&o&&ne.has(`checks`)&&(0,z.jsx)(D,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,z.jsx)(He,{...o,definitions:t,requiredDefinitionIds:n,preReviewDefinitionIds:i,directBatchRunId:p,directAttemptRunId:m,onSelectionChange:w===`checks`?g:void 0,onUnavailable:_,onStatusChange:ae})}),s&&x.length>0&&ne.has(`tests`)&&(0,z.jsx)(D,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,z.jsx)(ht,{ref:k,...s,testCommands:x,onStatusChange:O,onClose:se})})]})]})})};export{yt as VerificationDialog};
|