@straiffi/archon 1.7.10 → 1.8.1
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-IUWr92uj.js → ActivityView-CbdDNsdO.js} +1 -1
- package/dist/client/assets/{GitHubActionsDialog-0YtWvbFk.js → GitHubActionsDialog-Cmb9Yebr.js} +1 -1
- package/dist/client/assets/VerificationDialog-YUi8g2ou.js +4 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-LLMyOR-6.js → architectureDiagram-3BPJPVTR-BgoQ_BIc.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-aa1HitBJ.js → blockDiagram-GPEHLZMM-Xdp2x8BW.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BpSt5sdj.js → c4Diagram-AAUBKEIU-B220zS5a.js} +1 -1
- package/dist/client/assets/channel-CZ1HsfsD.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-D8pf3RNr.js → chunk-2J33WTMH-tYM2mjFx.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-_yx1N2iT.js → chunk-3OPIFGDE-CTITOUvV.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-CYURGSbL.js → chunk-5ZQYHXKU-D45jJDNN.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-Ci2Mu1zz.js → chunk-727SXJPM-X90EdJX4.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-CqVgrKze.js → chunk-AQP2D5EJ-PEoVUnQP.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-CT8aPk-o.js → chunk-CSCIHK7Q-CLWG2R5F.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-yM1i0J-p.js → chunk-KSCS5N6A-BamDWXh_.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-BKMGr31Z.js → chunk-L5ZTLDWV-05TaQDcG.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-A7oUDETP.js → chunk-LZXEDZCA-CjsbWN3c.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-Cagc-XAG.js → chunk-ND2GUHAM-BVmPBEeD.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-pe8tKLWI.js → chunk-NZK2D7GU-DNZ6WouC.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-BahwghWW.js → chunk-O5CBEL6O-Dfonikgz.js} +1 -1
- package/dist/client/assets/{chunk-WU5MYG2G-BfSAFufr.js → chunk-WU5MYG2G-CyiTxcGh.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-D4DcLL7k.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Benwuous.js +1 -0
- package/dist/client/assets/{dagre-BM42HDAG-DCma6-hS.js → dagre-BM42HDAG-9jv2zUKk.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-DUeggZrO.js → diagram-2AECGRRQ-DmF0Td45.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-CdjOKGtl.js → diagram-5GNKFQAL-DJNMQ7tI.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-CYjXhgh_.js → diagram-KO2AKTUF-EfcoL9E4.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-DYBCh4cm.js → diagram-LMA3HP47-C77Lzbhk.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-D3HPQt3z.js → diagram-OG6HWLK6-7GPyDhpX.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-mG8Yztg-.js → erDiagram-TEJ5UH35-B-mOpWb2.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-4FvjuoSZ.js → flowDiagram-I6XJVG4X-Bbte_qNo.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-ByCQI8ft.js → ganttDiagram-6RSMTGT7-DC4ltCss.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CzEUA7nB.js → gitGraphDiagram-PVQCEYII-4F87Sxzr.js} +1 -1
- package/dist/client/assets/index-D4qr0sQx.css +2 -0
- package/dist/client/assets/index-DCCSprul.js +274 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-Q9CqnXO1.js → infoDiagram-5YYISTIA-CHQaSUgi.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-CO8BToGf.js → ishikawaDiagram-YF4QCWOH-CuXLE_L1.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DtOyWvDJ.js → journeyDiagram-JHISSGLW-Dkj3B7DF.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-DIn9bYpk.js → kanban-definition-UN3LZRKU-DAH_WodG.js} +1 -1
- package/dist/client/assets/{line-H-k0M9_s.js → line-CxewTz3a.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-CZOUS5zK.js → mermaid-parser.core-W88fOlNl.js} +1 -1
- package/dist/client/assets/{mermaid.core-Ck71Qr7h.js → mermaid.core-CjJzzlTK.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-BRFEcJw_.js → mindmap-definition-RKZ34NQL-BdCMvjnB.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-CwihXXcJ.js → pieDiagram-4H26LBE5-HeTRmhyt.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-moiRw4Cm.js → quadrantDiagram-W4KKPZXB-CLXv5YTL.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-tshvM_vV.js → requirementDiagram-4Y6WPE33-DB4DS6CS.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-rtKIuBEp.js → sankeyDiagram-5OEKKPKP-BjUVvwEU.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-lkTCo4wE.js → sequenceDiagram-3UESZ5HK-FH39XKuz.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-CFQhVUSd.js → stateDiagram-AJRCARHV-U8DIBjJj.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Cw8SkdDx.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-BmlQ7Wiy.js → timeline-definition-PNZ67QCA-cuO_PRfp.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-CZyZepcT.js → vennDiagram-CIIHVFJN-BR7Vk6hi.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-C2b52gni.js → wardleyDiagram-YWT4CUSO-C443pGVk.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-FqnROUHq.js → xychartDiagram-2RQKCTM6-BtjwBwmu.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/db.js +503 -9
- package/dist/server/db.js.map +1 -1
- package/dist/server/index.js +374 -201
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/activeAutomationChild.js +6 -1
- package/dist/server/lib/activeAutomationChild.js.map +1 -1
- package/dist/server/lib/automationCheckGate.js +183 -50
- package/dist/server/lib/automationCheckGate.js.map +1 -1
- package/dist/server/lib/automationProgression.js +76 -9
- package/dist/server/lib/automationProgression.js.map +1 -1
- package/dist/server/lib/automationReconciliation.js +65 -0
- package/dist/server/lib/automationReconciliation.js.map +1 -1
- package/dist/server/lib/automationResumeDecision.js +69 -32
- package/dist/server/lib/automationResumeDecision.js.map +1 -1
- package/dist/server/lib/automationReviewGate.js +6 -1
- package/dist/server/lib/automationReviewGate.js.map +1 -1
- package/dist/server/lib/bundleActivity.js +20 -0
- package/dist/server/lib/bundleActivity.js.map +1 -1
- package/dist/server/lib/bundleReviewOperations.js +36 -5
- package/dist/server/lib/bundleReviewOperations.js.map +1 -1
- package/dist/server/lib/chatOperations.js +9 -0
- package/dist/server/lib/chatOperations.js.map +1 -1
- package/dist/server/lib/chatTicketProposals.js +2 -1
- package/dist/server/lib/chatTicketProposals.js.map +1 -1
- package/dist/server/lib/chats.js +2 -0
- package/dist/server/lib/chats.js.map +1 -1
- package/dist/server/lib/checkDiagnosticParsers.js +301 -0
- package/dist/server/lib/checkDiagnosticParsers.js.map +1 -0
- package/dist/server/lib/checkDiagnostics.js +142 -0
- package/dist/server/lib/checkDiagnostics.js.map +1 -0
- package/dist/server/lib/checkGateEvaluations.js +89 -1
- package/dist/server/lib/checkGateEvaluations.js.map +1 -1
- package/dist/server/lib/checkRepair.js +1031 -0
- package/dist/server/lib/checkRepair.js.map +1 -0
- package/dist/server/lib/checkRepairLifecycle.js +56 -0
- package/dist/server/lib/checkRepairLifecycle.js.map +1 -0
- package/dist/server/lib/checkRepairReconciliation.js +145 -0
- package/dist/server/lib/checkRepairReconciliation.js.map +1 -0
- package/dist/server/lib/checkRunner.js +122 -23
- package/dist/server/lib/checkRunner.js.map +1 -1
- package/dist/server/lib/checkRuns.js +60 -6
- package/dist/server/lib/checkRuns.js.map +1 -1
- package/dist/server/lib/executionReconciliation.js +21 -11
- package/dist/server/lib/executionReconciliation.js.map +1 -1
- package/dist/server/lib/executionRetryPredicates.js +3 -1
- package/dist/server/lib/executionRetryPredicates.js.map +1 -1
- package/dist/server/lib/executionRunRetention.js +24 -3
- package/dist/server/lib/executionRunRetention.js.map +1 -1
- package/dist/server/lib/executionRuns.js +15 -3
- package/dist/server/lib/executionRuns.js.map +1 -1
- package/dist/server/lib/git.js +57 -7
- package/dist/server/lib/git.js.map +1 -1
- package/dist/server/lib/planModeQuestions.js +2 -0
- package/dist/server/lib/planModeQuestions.js.map +1 -1
- package/dist/server/lib/planQuestions.js +39 -7
- package/dist/server/lib/planQuestions.js.map +1 -1
- package/dist/server/lib/postBuildCheckRuns.js +43 -0
- package/dist/server/lib/postBuildCheckRuns.js.map +1 -0
- package/dist/server/lib/postBuildChecks.js +122 -0
- package/dist/server/lib/postBuildChecks.js.map +1 -0
- package/dist/server/lib/projectMemorySuggestions.js +2 -1
- package/dist/server/lib/projectMemorySuggestions.js.map +1 -1
- package/dist/server/lib/projects.js +24 -25
- package/dist/server/lib/projects.js.map +1 -1
- package/dist/server/lib/pullRequestContent.js +14 -0
- package/dist/server/lib/pullRequestContent.js.map +1 -1
- package/dist/server/lib/requiredCheckPolicy.js +13 -49
- package/dist/server/lib/requiredCheckPolicy.js.map +1 -1
- package/dist/server/lib/requiredCheckPolicyPrompt.js +46 -0
- package/dist/server/lib/requiredCheckPolicyPrompt.js.map +1 -0
- package/dist/server/lib/specDraft.js +6 -0
- package/dist/server/lib/specDraft.js.map +1 -1
- package/dist/server/lib/specResources.js +42 -0
- package/dist/server/lib/specResources.js.map +1 -0
- package/dist/server/lib/specs.js +9 -5
- package/dist/server/lib/specs.js.map +1 -1
- package/dist/server/lib/ticketAutomation.js +10 -3
- package/dist/server/lib/ticketAutomation.js.map +1 -1
- package/dist/server/lib/ticketAutomationCommit.js +36 -11
- package/dist/server/lib/ticketAutomationCommit.js.map +1 -1
- package/dist/server/lib/ticketFollowUpOperations.js +33 -9
- package/dist/server/lib/ticketFollowUpOperations.js.map +1 -1
- package/dist/server/lib/tickets.js +11 -32
- package/dist/server/lib/tickets.js.map +1 -1
- package/dist/server/lib/types.js +1 -0
- package/dist/server/lib/types.js.map +1 -1
- package/dist/server/workers/build.js +42 -12
- package/dist/server/workers/build.js.map +1 -1
- package/dist/server/workers/chat.js +18 -3
- package/dist/server/workers/chat.js.map +1 -1
- package/dist/server/workers/followUp.js +70 -17
- package/dist/server/workers/followUp.js.map +1 -1
- package/dist/server/workers/plan.js +5 -3
- package/dist/server/workers/plan.js.map +1 -1
- package/dist/server/workers/planFollowUp.js +5 -6
- package/dist/server/workers/planFollowUp.js.map +1 -1
- package/dist/server/workers/review.js +38 -6
- package/dist/server/workers/review.js.map +1 -1
- package/dist/server/workers/specSession.js +10 -4
- package/dist/server/workers/specSession.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/VerificationDialog-B4Pyz1LV.js +0 -4
- package/dist/client/assets/channel-DWPRC-jg.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DBZaZLLc.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B7HsVFoJ.js +0 -1
- package/dist/client/assets/index-D-miHTTb.js +0 -273
- package/dist/client/assets/index-TAQIlNdJ.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-rrN4DgWp.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{et as e,r as t}from"./index-
|
|
1
|
+
import{et as e,r as t}from"./index-DCCSprul.js";var n=e(),r=({projectId:e,onClose:r,onNavigateToLifecycleSource:i})=>e?(0,n.jsx)(t,{projectId:e,scope:{type:`project`},onClose:r,onNavigateToLifecycleSource:i?e=>{r(),i(e)}:void 0}):null;export{r as ActivityView};
|
package/dist/client/assets/{GitHubActionsDialog-0YtWvbFk.js → GitHubActionsDialog-Cmb9Yebr.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,B as n,C as r,H as i,J as a,K as o,N as s,P as c,Q as l,R as u,S as d,T as f,U as p,V as m,X as h,Z as g,b as _,et as v,j as y,l as b,q as x,rt as ee,st as S,tt as C,w as te,x as w,y as T,z as E}from"./index-D-miHTTb.js";var D=e(S(),1),O=v(),ne=`https://docs.github.com/en/actions`,re=5e3,k=(e,t)=>_.t(`common:githubActions.${e}`,t),A=e=>k(`status.${e}`),j=e=>e?k(`conclusion.${e}`):null,M=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`,N=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`,P=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`},F=e=>e.status===`completed`?j(e.conclusion)??k(`status.completed`):A(e.status),I=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},ie=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,o=t?.dispatchable??!0,l=i&&o&&!t?.isLoading,u=e.path.split(`/`).pop();return(0,O.jsxs)(`div`,{className:a(`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,O.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,O.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:u}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,i?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:k(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,O.jsxs)(x,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!l,"aria-label":k(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?k(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(s,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:k(`actions.run`)})]})]})]})},L=({workflow:e,inputsState:t,refValue:n,onRefChange:r,values:i,onValueChange:a,isDispatching:o,onDispatch:l,onCancel:d})=>{let f=t.inputs.filter(e=>e.required&&!R(i[e.name],e)),p=t.dispatchable&&!t.isLoading&&!t.error&&n.trim()!==``&&f.length===0&&!o;return(0,O.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`inputs.title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,O.jsx)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":k(`actions.cancel`),onClick:d,children:(0,O.jsx)(w,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(u,{htmlFor:`github-actions-ref`,children:k(`inputs.refLabel`)}),(0,O.jsx)(E,{id:`github-actions-ref`,type:`text`,value:n,onChange:e=>{r(e.target.value)},placeholder:k(`inputs.refPlaceholder`),"aria-label":k(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:k(`inputs.loading`)})]}),t.error&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:t.error}),!t.dispatchable&&!t.isLoading&&!t.error&&(0,O.jsx)(`p`,{className:`text-xs text-amber-200`,children:k(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,O.jsx)(z,{input:e,value:i[e.name],onChange:t=>{a(e.name,t)}},e.name)),f.length>0&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:k(`inputs.requiredValidationError`)}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(x,{type:`button`,variant:`ghost`,onClick:d,disabled:o,children:k(`actions.cancel`)}),(0,O.jsxs)(x,{type:`button`,variant:`success`,onClick:l,disabled:!p,children:[o?(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}):(0,O.jsx)(s,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:k(`actions.dispatch`)})]})]})]})},R=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,z=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(u,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{children:e.name}),e.required&&(0,O.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:k(`inputs.requiredLabel`)})]}),e.description&&(0,O.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),B(e,r,t,n)]})},B=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(b,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k(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,O.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,O.jsx)(`option`,{value:``,children:k(`inputs.selectPlaceholder`)}),i.map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))]})}return(0,O.jsx)(E,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},V=({job:e})=>e.steps.length===0?null:(0,O.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,N(t)),children:t.status===`completed`?j(t.conclusion)??k(`status.completed`):A(t.status)}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),H=({run:e})=>{let t=P(e),n=F(e);return(0,O.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,M(e)),children:n})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,O.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:[k(`actions.openOnGithub`),(0,O.jsx)(d,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,O.jsxs)(`div`,{className:`mt-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(e)),children:e.status===`completed`?j(e.conclusion)??k(`status.completed`):A(e.status)}),(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,O.jsx)(V,{job:e})]},e.id))]})},ae=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??k(`runs.trackingState.${e.state}`);return(0,O.jsxs)(`div`,{className:a(`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,O.jsx)(c,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:a(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,O.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??k(`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:a,onClose:s})=>{let[u,_]=(0,D.useState)([]),[v,b]=(0,D.useState)(!0),[S,T]=(0,D.useState)(null),[E,A]=(0,D.useState)([]),[j,M]=(0,D.useState)([]),[N,P]=(0,D.useState)({}),[F,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V]=(0,D.useState)(()=>se(a)),W=(0,D.useRef)({}),G=(0,D.useRef)({}),K=(0,D.useRef)(null),q=(0,D.useRef)(!1),J=(0,D.useRef)(0),Y=(0,D.useRef)(new Map),X=(0,D.useCallback)(async t=>{P(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 g(e,t.id,t.path);return P(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return P(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof C?e.message:k(`workflows.loadError`)}})),null}},[e]),Z=(0,D.useCallback)(async()=>{b(!0),T(null);try{let n=await t(e);_(n.workflows),Promise.allSettled(n.workflows.map(e=>X(e)))}catch(e){T(e instanceof C?e.message:k(`workflows.loadError`))}finally{b(!1)}},[X,e]),Q=(0,D.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await l(e,t);A(e=>U(e,r.runs)),M(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){ee(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,D.useEffect)(()=>{Z()},[Z]),(0,D.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,re),r=te(t);return()=>{e.abort(),window.clearInterval(n),r()}},[Q]);let ce=(0,D.useCallback)(async e=>{if(F?.workflow.id===e.id)return;K.current=e.id,R({workflow:e,ref:V.ref,values:{}});let t=N[e.id];if(t&&!t.isLoading&&!t.error){R(n=>!n||n.workflow.id!==e.id?n:{...n,values:I(t.inputs)});return}let n=await X(e);n&&R(t=>!t||t.workflow.id!==e.id?t:{...t,values:I(n.inputs)})},[V.ref,N,X,F]),le=(0,D.useCallback)(async()=>{if(!F)return;let t=N[F.workflow.id];if(!t||!t.dispatchable)return;B(!0);let n={};for(let e of t.inputs){let t=F.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 h(e,F.workflow.id,{ref:F.ref,workflowName:F.workflow.name,workflowUrl:F.workflow.url,inputs:n}),y.success(k(`messages.dispatched`)),R(null),Q()}catch(e){y.error(e instanceof C?e.message:k(`messages.dispatchError`))}finally{B(!1)}},[N,Q,e,F]);(0,D.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),M(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&A(e=>U(e,[t.run])))};return r.on(`github-actions:updated`,t),()=>{r.off(`github-actions:updated`,t)}},[e]),(0,D.useEffect)(()=>{let e=F?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[F?.workflow.id]);let $=(0,D.useMemo)(()=>[...E].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}),[E]);return(0,O.jsx)(n,{open:!0,onOpenChange:e=>{e||s()},children:(0,O.jsxs)(i,{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,O.jsx)(o,{className:`sr-only`,children:k(`dialog.srTitle`)}),(0,O.jsx)(p,{className:`sr-only`,children:k(`dialog.srDescription`)}),(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.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,O.jsx)(f,{className:`h-5 w-5`})}),(0,O.jsx)(`div`,{children:(0,O.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:k(`dialog.title`)})})]}),(0,O.jsx)(m,{asChild:!0,children:(0,O.jsx)(x,{type:`button`,"aria-label":k(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,O.jsx)(w,{className:`h-4 w-4`})})})]}),(0,O.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,O.jsxs)(`aside`,{"aria-label":k(`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,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`workflows.title`)}),(0,O.jsx)(x,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:k(`actions.refresh`)})]}),v&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:k(`workflows.loading`)})]}),S&&(0,O.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:S}),!v&&u.length===0&&!S&&(0,O.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,O.jsx)(`p`,{children:k(`workflows.empty`)}),(0,O.jsx)(`p`,{className:`mt-1`,children:k(`workflows.emptyHint`)}),(0,O.jsxs)(`a`,{href:ne,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[k(`workflows.docsLink`),(0,O.jsx)(d,{className:`h-3 w-3`})]})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=F?.workflow.id===e.id;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,O.jsx)(ie,{workflow:e,inputsState:N[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&F&&(0,O.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,O.jsx)(L,{workflow:e,inputsState:N[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:F.ref,onRefChange:e=>{R(t=>t&&{...t,ref:e})},values:F.values,onValueChange:(e,t)=>{R(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:z,onDispatch:()=>{le()},onCancel:()=>{R(null)}})})]},e.id)})})]}),(0,O.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`runs.title`)}),j.map(e=>(0,O.jsx)(ae,{tracked:e},e.tracking_key)),$.map(e=>(0,O.jsx)(H,{run:e},e.id)),$.length===0&&j.length===0&&(0,O.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:k(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{$ as t,B as n,C as r,H as i,J as a,K as o,N as s,P as c,Q as l,R as u,S as d,T as f,U as p,V as m,X as h,Z as g,b as _,et as v,j as y,l as b,q as x,rt as ee,st as S,tt as C,w as te,x as w,y as T,z as E}from"./index-DCCSprul.js";var D=e(S(),1),O=v(),ne=`https://docs.github.com/en/actions`,re=5e3,k=(e,t)=>_.t(`common:githubActions.${e}`,t),A=e=>k(`status.${e}`),j=e=>e?k(`conclusion.${e}`):null,M=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`,N=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`,P=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`},F=e=>e.status===`completed`?j(e.conclusion)??k(`status.completed`):A(e.status),I=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},ie=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,o=t?.dispatchable??!0,l=i&&o&&!t?.isLoading,u=e.path.split(`/`).pop();return(0,O.jsxs)(`div`,{className:a(`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,O.jsx)(`p`,{className:`line-clamp-2 break-words text-sm font-medium text-foreground`,children:e.name}),(0,O.jsx)(`p`,{className:`min-w-0 break-words text-[11px] text-muted-foreground`,children:u}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,i?`border-emerald-400/30 bg-emerald-500/10 text-emerald-200`:`border-border/70 bg-background/60 text-muted-foreground`),children:k(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,O.jsxs)(x,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!l,"aria-label":k(`workflows.runAriaLabel`,{name:e.name}),title:!o&&t?k(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(s,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:k(`actions.run`)})]})]})]})},L=({workflow:e,inputsState:t,refValue:n,onRefChange:r,values:i,onValueChange:a,isDispatching:o,onDispatch:l,onCancel:d})=>{let f=t.inputs.filter(e=>e.required&&!R(i[e.name],e)),p=t.dispatchable&&!t.isLoading&&!t.error&&n.trim()!==``&&f.length===0&&!o;return(0,O.jsxs)(`div`,{className:`space-y-4 rounded-2xl border border-border/70 bg-background/20 p-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`inputs.title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,O.jsx)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":k(`actions.cancel`),onClick:d,children:(0,O.jsx)(w,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(u,{htmlFor:`github-actions-ref`,children:k(`inputs.refLabel`)}),(0,O.jsx)(E,{id:`github-actions-ref`,type:`text`,value:n,onChange:e=>{r(e.target.value)},placeholder:k(`inputs.refPlaceholder`),"aria-label":k(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:k(`inputs.loading`)})]}),t.error&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:t.error}),!t.dispatchable&&!t.isLoading&&!t.error&&(0,O.jsx)(`p`,{className:`text-xs text-amber-200`,children:k(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,O.jsx)(z,{input:e,value:i[e.name],onChange:t=>{a(e.name,t)}},e.name)),f.length>0&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:k(`inputs.requiredValidationError`)}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(x,{type:`button`,variant:`ghost`,onClick:d,disabled:o,children:k(`actions.cancel`)}),(0,O.jsxs)(x,{type:`button`,variant:`success`,onClick:l,disabled:!p,children:[o?(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}):(0,O.jsx)(s,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:k(`actions.dispatch`)})]})]})]})},R=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,z=({input:e,value:t,onChange:n})=>{let r=`github-actions-input-${e.name}`;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(u,{htmlFor:r,className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{children:e.name}),e.required&&(0,O.jsx)(`span`,{className:`text-[10px] uppercase tracking-[0.18em] text-rose-200/80`,children:k(`inputs.requiredLabel`)})]}),e.description&&(0,O.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),B(e,r,t,n)]})},B=(e,t,n,r)=>{if(e.type===`boolean`){let i=typeof n==`boolean`?n:e.default===!0;return(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.jsx)(b,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:k(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,O.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,O.jsx)(`option`,{value:``,children:k(`inputs.selectPlaceholder`)}),i.map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))]})}return(0,O.jsx)(E,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},V=({job:e})=>e.steps.length===0?null:(0,O.jsx)(`div`,{className:`mt-2 ml-4 space-y-1 border-l border-border/60 pl-4`,children:e.steps.map(t=>(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,N(t)),children:t.status===`completed`?j(t.conclusion)??k(`status.completed`):A(t.status)}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),H=({run:e})=>{let t=P(e),n=F(e);return(0,O.jsxs)(`div`,{className:`rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e.name??`#${e.id}`}),(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,M(e)),children:n})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t&&(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t}),e.html_url&&(0,O.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:[k(`actions.openOnGithub`),(0,O.jsx)(d,{className:`h-3 w-3`})]})]})]}),e.head_branch&&(0,O.jsx)(`p`,{className:`mt-1 text-[11px] text-muted-foreground`,children:e.head_branch}),e.jobs.map(e=>(0,O.jsxs)(`div`,{className:`mt-2`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(T,{variant:`outline`,className:a(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,M(e)),children:e.status===`completed`?j(e.conclusion)??k(`status.completed`):A(e.status)}),(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,O.jsx)(V,{job:e})]},e.id))]})},ae=({tracked:e})=>{let t=e.state===`resolving`,n=e.failure?.message??k(`runs.trackingState.${e.state}`);return(0,O.jsxs)(`div`,{className:a(`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,O.jsx)(c,{className:`mt-0.5 h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`span`,{className:a(`block break-words text-xs`,t?`text-muted-foreground`:`text-red-200`),children:n}),(0,O.jsx)(`span`,{className:`mt-1 block text-[11px] text-muted-foreground`,children:e.ref??k(`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:a,onClose:s})=>{let[u,_]=(0,D.useState)([]),[v,b]=(0,D.useState)(!0),[S,T]=(0,D.useState)(null),[E,A]=(0,D.useState)([]),[j,M]=(0,D.useState)([]),[N,P]=(0,D.useState)({}),[F,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V]=(0,D.useState)(()=>se(a)),W=(0,D.useRef)({}),G=(0,D.useRef)({}),K=(0,D.useRef)(null),q=(0,D.useRef)(!1),J=(0,D.useRef)(0),Y=(0,D.useRef)(new Map),X=(0,D.useCallback)(async t=>{P(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 g(e,t.id,t.path);return P(e=>({...e,[t.id]:{inputs:n.inputs,dispatchable:n.dispatchable,isLoading:!1,error:null}})),n}catch(e){return P(n=>({...n,[t.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof C?e.message:k(`workflows.loadError`)}})),null}},[e]),Z=(0,D.useCallback)(async()=>{b(!0),T(null);try{let n=await t(e);_(n.workflows),Promise.allSettled(n.workflows.map(e=>X(e)))}catch(e){T(e instanceof C?e.message:k(`workflows.loadError`))}finally{b(!1)}},[X,e]),Q=(0,D.useCallback)(async t=>{if(q.current)return;q.current=!0;let n=J.current;try{let r=await l(e,t);A(e=>U(e,r.runs)),M(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){ee(e)||console.warn(`[github-actions] unable to load runs`,e)}finally{q.current=!1}},[e]);(0,D.useEffect)(()=>{Z()},[Z]),(0,D.useEffect)(()=>{let e=new AbortController,t=()=>{document.visibilityState===`visible`&&Q(e.signal)};t();let n=window.setInterval(t,re),r=te(t);return()=>{e.abort(),window.clearInterval(n),r()}},[Q]);let ce=(0,D.useCallback)(async e=>{if(F?.workflow.id===e.id)return;K.current=e.id,R({workflow:e,ref:V.ref,values:{}});let t=N[e.id];if(t&&!t.isLoading&&!t.error){R(n=>!n||n.workflow.id!==e.id?n:{...n,values:I(t.inputs)});return}let n=await X(e);n&&R(t=>!t||t.workflow.id!==e.id?t:{...t,values:I(n.inputs)})},[V.ref,N,X,F]),le=(0,D.useCallback)(async()=>{if(!F)return;let t=N[F.workflow.id];if(!t||!t.dispatchable)return;B(!0);let n={};for(let e of t.inputs){let t=F.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 h(e,F.workflow.id,{ref:F.ref,workflowName:F.workflow.name,workflowUrl:F.workflow.url,inputs:n}),y.success(k(`messages.dispatched`)),R(null),Q()}catch(e){y.error(e instanceof C?e.message:k(`messages.dispatchError`))}finally{B(!1)}},[N,Q,e,F]);(0,D.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(J.current+=1,Y.current.set(t.tracking_key,{revision:J.current,event:t}),M(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&A(e=>U(e,[t.run])))};return r.on(`github-actions:updated`,t),()=>{r.off(`github-actions:updated`,t)}},[e]),(0,D.useEffect)(()=>{let e=F?.workflow.id;!e||K.current!==e||(W.current[e]?.scrollIntoView({block:`nearest`}),G.current[e]?.scrollIntoView({block:`nearest`}),K.current=null)},[F?.workflow.id]);let $=(0,D.useMemo)(()=>[...E].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}),[E]);return(0,O.jsx)(n,{open:!0,onOpenChange:e=>{e||s()},children:(0,O.jsxs)(i,{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,O.jsx)(o,{className:`sr-only`,children:k(`dialog.srTitle`)}),(0,O.jsx)(p,{className:`sr-only`,children:k(`dialog.srDescription`)}),(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,O.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,O.jsx)(f,{className:`h-5 w-5`})}),(0,O.jsx)(`div`,{children:(0,O.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:k(`dialog.title`)})})]}),(0,O.jsx)(m,{asChild:!0,children:(0,O.jsx)(x,{type:`button`,"aria-label":k(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,O.jsx)(w,{className:`h-4 w-4`})})})]}),(0,O.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 overflow-hidden lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,O.jsxs)(`aside`,{"aria-label":k(`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,O.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`workflows.title`)}),(0,O.jsx)(x,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:k(`actions.refresh`)})]}),v&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(c,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:k(`workflows.loading`)})]}),S&&(0,O.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:S}),!v&&u.length===0&&!S&&(0,O.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,O.jsx)(`p`,{children:k(`workflows.empty`)}),(0,O.jsx)(`p`,{className:`mt-1`,children:k(`workflows.emptyHint`)}),(0,O.jsxs)(`a`,{href:ne,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[k(`workflows.docsLink`),(0,O.jsx)(d,{className:`h-3 w-3`})]})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>{let t=F?.workflow.id===e.id;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{ref:t=>{W.current[e.id]=t},children:(0,O.jsx)(ie,{workflow:e,inputsState:N[e.id]??null,isSelected:t,onSelect:()=>{ce(e)}})}),t&&F&&(0,O.jsx)(`div`,{ref:t=>{G.current[e.id]=t},children:(0,O.jsx)(L,{workflow:e,inputsState:N[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:F.ref,onRefChange:e=>{R(t=>t&&{...t,ref:e})},values:F.values,onValueChange:(e,t)=>{R(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:z,onDispatch:()=>{le()},onCancel:()=>{R(null)}})})]},e.id)})})]}),(0,O.jsxs)(`section`,{className:`flex min-h-0 flex-col gap-3 overflow-y-auto px-4 py-4`,children:[(0,O.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:k(`runs.title`)}),j.map(e=>(0,O.jsx)(ae,{tracked:e},e.tracking_key)),$.map(e=>(0,O.jsx)(H,{run:e},e.id)),$.length===0&&j.length===0&&(0,O.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:k(`runs.empty`)})]})]})]})})};export{G as GitHubActionsDialog};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,I as l,J as u,K as d,L as f,M as p,N as m,O as h,P as g,U as _,W as v,Y as y,_ as b,a as x,at as S,b as C,d as w,et as T,f as E,g as D,h as ee,i as te,it as O,k as ne,m as re,n as ie,nt as k,o as ae,ot as A,p as oe,q as j,rt as se,s as ce,st as le,t as M,tt as ue,u as de,v as fe,x as N,y as P,z as pe}from"./index-DCCSprul.js";var F=e(le(),1),me=(e,t)=>S(k(`/projects/${e}/check-batches`),{method:`POST`,body:{target_kind:t.targetKind,target_bundle_id:t.targetKind===`bundle`?t.targetBundleId:null,definition_ids:t.definitionIds},fallbackErrorMessage:`Unable to start checks right now.`}),he=(e,t={})=>{let n=new URL(k(`/projects/${e}/check-batches`));return t.statuses?.length&&n.searchParams.set(`status`,t.statuses.join(`,`)),t.cursor&&n.searchParams.set(`cursor`,t.cursor),t.limit&&n.searchParams.set(`limit`,String(t.limit)),S(n.toString(),{signal:t.signal,fallbackErrorMessage:`Unable to load check batches right now.`})},ge=(e,t,n)=>S(k(`/projects/${e}/check-batches/${t}`),{signal:n,fallbackErrorMessage:`Unable to load check details right now.`}),_e=(e,t,n)=>S(k(`/projects/${e}/check-gate-evaluations/${t}`),{signal:n,fallbackErrorMessage:`Unable to load the automated delivery gate right now.`}),ve=(e,t,n)=>S(k(`/projects/${e}/check-batches/${t}/diagnostics`),{signal:n,fallbackErrorMessage:`Unable to load structured diagnostics right now.`}),ye=(e,t,n,r)=>S(k(`/projects/${e}/check-repairs`),{method:`POST`,body:{diagnostic_ids:t,raw_output_attempt_run_ids:n,...r?{ticket_id:r}:{}},fallbackErrorMessage:`Unable to start check repair right now.`}),be=(e,t,n)=>S(k(`/projects/${e}/check-repairs/${t}`),{signal:n,fallbackErrorMessage:`Unable to load check repair status right now.`}),xe=(e,t)=>S(k(`/projects/${e}/check-repairs/${t}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop check repair right now.`}),I=(e,t)=>S(k(`/projects/${e}/check-batches/${t}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop this check batch right now.`}),L=(e,t,n)=>S(k(`/projects/${e}/check-batches/${t}/rerun`),{method:`POST`,body:n.mode===`selected`?{mode:`selected`,definition_ids:n.definitionIds}:{mode:n.mode},fallbackErrorMessage:`Unable to rerun checks right now.`}),R=T(),Se=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}`},Ce=({attempt:e,diagnostics:t,repair:n,selectedDiagnosticIds:r,selectedRawOutputAttemptRunIds:i,selectedAttemptRunIds:a,selectedTicketId:o,pending:s,activeRepair:c,onSelectedTicketChange:l,onToggleDiagnostic:u,onToggleRawOutput:d,onStartRepair:f,onStopRepair:p})=>{let{t:m}=A(`common`,{keyPrefix:`checksDialog.diagnostics`}),h=t?.parser,g=c?.terminal_result===null,_=!!(n?.eligibility.eligible&&n.eligible_attempt_run_ids.includes(e.execution_run_id)&&h?.status===`complete`&&h.retention_state===`retained`),v=!!(n?.eligibility.eligible&&n.eligible_raw_output_attempt_run_ids.includes(e.execution_run_id)&&e.output_retention_state===`retained`&&e.retained_output),y=i.has(e.execution_run_id),b=r.size,x=b>=32,S=a.size>=8&&!a.has(e.execution_run_id),C=x?m(`diagnosticLimit`,{count:32}):S?m(`attemptLimit`,{count:8}):null,w=!!(n?.accepts_ticket_id&&n.candidate_tickets.length>1),T=b+i.size,E=T>0&&(!w||o!==``),D=n&&!n.eligibility.eligible?m(`disabled.${n.eligibility.reason}`):null;return(0,R.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,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{id:`diagnostics-${e.execution_run_id}`,className:`text-sm font-semibold text-foreground`,children:m(`title`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:h?m(`summary`,{count:h.diagnostic_count,parser:m(`parser.${h.parser_kind}`)}):m(`loading`)})]}),h&&(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:m(`state.${h.status}`)})]}),h?.retention_state===`expired`&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:m(`expired`)}),h?.truncated&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-amber-200`,children:m(`truncated`)}),h&&[`unsupported`,`malformed`,`interrupted`].includes(h.status)&&(0,R.jsx)(`p`,{className:`mt-3 text-sm text-muted-foreground`,children:m(`fallback.${h.status}`)}),v&&(0,R.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,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:y,disabled:g||!y&&S,onChange:e=>d(e.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:m(`rawOutputSelect`)}),(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:m(`rawOutputHint`)}),e.retained_start_offset>0&&(0,R.jsx)(`span`,{className:`mt-1 block text-xs text-amber-200`,children:m(`rawOutputTruncated`)})]})]}),h&&t&&t.diagnostics.length>0&&(0,R.jsxs)(`fieldset`,{className:`mt-4`,children:[(0,R.jsx)(`legend`,{className:`text-xs font-medium text-muted-foreground`,children:m(`selectLegend`)}),(0,R.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.diagnostics.map(t=>{let n=Se(t),i=r.has(t.id);return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`label`,{className:`flex items-start gap-3 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:i,disabled:!_||g||!i&&C!==null,onChange:e=>u(t.id,e.target.checked)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`span`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{className:`font-semibold uppercase text-foreground`,children:m(`severity.${t.severity}`)}),t.code&&(0,R.jsx)(`code`,{children:t.code}),(0,R.jsx)(`span`,{children:m(`source`,{source:e.command_snapshot.name})})]}),(0,R.jsx)(`span`,{className:`mt-1 block break-words text-sm text-foreground`,children:t.message}),(0,R.jsx)(`span`,{className:`mt-1 block break-all font-mono text-xs text-muted-foreground`,children:n??m(`repositoryLocation`)}),(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[m(`repairApplicability`),` · `,m(`retention`,{state:m(`retentionState.${h.retention_state}`)})]})]})]})},t.id)})})]}),n&&(0,R.jsxs)(`aside`,{className:`mt-4 rounded-xl border border-border/60 bg-background/35 p-3`,children:[(0,R.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:m(`destinationTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:m(`destination.${n.destination}`)}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:m(`destinationHint`)})]}),w&&n&&(0,R.jsxs)(`label`,{className:`mt-4 block text-xs text-muted-foreground`,children:[m(`ticketLabel`),(0,R.jsxs)(`select`,{value:o,onChange:e=>l(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,R.jsx)(`option`,{value:``,children:m(`ticketPlaceholder`)}),n.candidate_tickets.map(e=>(0,R.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),D&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:D}),C&&(0,R.jsx)(`p`,{className:`mt-3 text-xs text-amber-200`,children:C}),c&&(0,R.jsxs)(`div`,{className:`mt-4 rounded-xl border border-sky-400/25 bg-sky-500/10 p-3 text-sm`,children:[(0,R.jsx)(`p`,{className:`font-medium text-sky-100`,children:m(c.terminal_result?`repairResult.${c.terminal_result}`:`repairRunning`)}),c.terminal_message&&(0,R.jsx)(`p`,{className:`mt-1 text-xs text-sky-100/80`,children:c.terminal_message})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,R.jsx)(j,{type:`button`,size:`sm`,disabled:!_&&!v||!E||s||g,title:D??void 0,onClick:f,children:s?m(`starting`):m(`repairSelectedEvidence`,{count:T})}),g&&(0,R.jsx)(j,{type:`button`,variant:`destructive`,size:`sm`,disabled:s,onClick:p,children:m(`stopRepair`)})]})]})},we=new Set([`queued`,`running`,`waiting`]),Te=75,Ee=32,De=64,Oe=3,z=32,ke=8,B=(e,t)=>e instanceof ue?e.message:t,Ae=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`,je=(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`,Me={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`},V=({projectId:e,targetKind:t,targetBundleId:n,definitions:r,requiredDefinitionIds:i=[],preReviewDefinitionIds:a=[],gateEvaluationId:o=null,onStatusChange:s})=>{let{t:c}=A(`common`,{keyPrefix:`checksDialog`}),l=ce(),[d,f]=(0,F.useState)(()=>new Set(r.map(e=>e.id))),[p,m]=(0,F.useState)(null),[h,g]=(0,F.useState)(null),[_,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(!0),[S,C]=(0,F.useState)(null),[w,T]=(0,F.useState)(null),[D,O]=(0,F.useState)(new Set),[ne,ie]=(0,F.useState)(new Set),[k,le]=(0,F.useState)(``),[M,de]=(0,F.useState)(null),[fe,N]=(0,F.useState)(!1),[P,pe]=(0,F.useState)(0),[Se,V]=(0,F.useState)(null),H=(0,F.useRef)(p),U=(0,F.useRef)(null),W=(0,F.useRef)(new Set),G=(0,F.useRef)(new Map),K=(0,F.useRef)(0),q=(0,F.useRef)(0),J=(0,F.useRef)(null),Y=(0,F.useRef)(!1),X=(0,F.useRef)(!0),Ne=(0,F.useRef)(async()=>void 0),Z=(0,F.useRef)(async()=>void 0),Pe=(0,F.useRef)(()=>void 0),Q=(0,F.useRef)(0);H.current=p,X.current=y||S!==null;let Fe=(0,F.useCallback)(e=>{T(e),de(e.latest_repair),O(t=>{let n=new Set(e.attempts.flatMap(e=>e.diagnostics.map(e=>e.id)));return new Set([...t].filter(e=>n.has(e)))}),ie(t=>{let n=new Set(e.repair.eligible_raw_output_attempt_run_ids);return new Set([...t].filter(e=>n.has(e)))}),le(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:``)},[]),Ie=(0,F.useCallback)(e=>{let t=G.current;if(!t.has(e.attempt_run_id)&&t.size>=Ee){let e=t.keys().next().value;e&&(t.delete(e),W.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(De-1)),e])},[]),Le=(0,F.useCallback)(e=>{let t=H.current?.batch.execution_run_id===e.batch.execution_run_id?H.current:null,n=!1,r=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of G.current.keys())r.has(e)||(G.current.delete(e),W.current.delete(e));let i=e.attempts.map(e=>{let r=!1,i=t?.attempts.find(t=>t.execution_run_id===e.execution_run_id),a=i&&i.output_revision>e.output_revision?i:e,o=G.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let t=ae(x(a),e);if(t.status===`refetch`){r=!0,n=!0;continue}t.status===`applied`&&(a={...a,output_revision:t.snapshot.revision,retained_start_offset:t.snapshot.retainedStartOffset,retained_end_offset:t.snapshot.totalByteCount,total_persisted_bytes:t.snapshot.totalByteCount,retained_output:t.snapshot.retainedText})}return r?W.current.add(e.execution_run_id):(W.current.delete(e.execution_run_id),G.current.delete(e.execution_run_id)),a}),a={...e,attempts:i};J.current=e.batch.execution_run_id,H.current=a,m(a),v(e=>a.attempts.some(t=>t.execution_run_id===e)?e:a.attempts.find(e=>e.execution_status===`running`)?.execution_run_id??a.attempts[0]?.execution_run_id??null),n?Pe.current(e.batch.execution_run_id):Q.current=0,Y.current&&!U.current&&(Y.current=!1,U.current=setTimeout(()=>{U.current=null,Z.current().catch(e=>V(B(e,c(`errors.load`))))},Te))},[c]),$=(0,F.useCallback)(async(t,n)=>{let r=++K.current,i=await ge(e,t,n);r!==K.current||i.batch.execution_run_id!==t||J.current!==null&&J.current!==t||Le(i)},[Le,e]);Ne.current=$,Pe.current=(0,F.useCallback)(e=>{if(U.current)return;if(Q.current>=Oe){Q.current=0,W.current.clear(),G.current.clear();return}let t=Te*2**Q.current;U.current=setTimeout(()=>{U.current=null,Q.current+=1,Ne.current(e).catch(t=>{V(B(t,c(`errors.load`))),W.current.size>0&&Pe.current(e)})},t)},[c]);let Re=(0,F.useCallback)(async r=>{let i=++K.current,a=null;do{let o=await he(e,{limit:50,cursor:a,signal:r});if(i!==K.current)return;let s=o.items.find(e=>e.check_batch?.details?.target_kind===t&&e.check_batch.details.target_bundle_id===(t===`bundle`?n:null));if(s){J.current=s.run.id,await $(s.run.id,r);return}a=o.next_cursor}while(a);!r?.aborted&&i===K.current&&(J.current=null,H.current=null,m(null),v(null))},[$,e,n,t]),ze=(0,F.useCallback)(async()=>{if(o){let e=J.current;e&&await $(e);return}await Re()},[o,$,Re]);Z.current=ze;let Be=(0,F.useCallback)(e=>{U.current||=setTimeout(()=>{U.current=null,$(e).catch(e=>V(B(e,c(`errors.load`))))},Te)},[$,c]);(0,F.useEffect)(()=>{let t=new AbortController;return b(!0),V(null),(async()=>{if(!o){g(null),await Re(t.signal);return}let n=await _e(e,o,t.signal);if(g(n),n.sourceBatchRunId){J.current=n.sourceBatchRunId,await $(n.sourceBatchRunId,t.signal);return}J.current=null,H.current=null,m(null),v(null)})().catch(e=>{se(e)||V(B(e,c(`errors.load`)))}).finally(()=>{t.signal.aborted||(b(!1),X.current=!1,Y.current&&!U.current&&(Y.current=!1,U.current=setTimeout(()=>{U.current=null,Z.current().catch(e=>V(B(e,c(`errors.load`))))},Te)))}),()=>t.abort()},[o,$,Re,e,c]),(0,F.useEffect)(()=>{let t=p?.batch.execution_run_id;if(!t){q.current+=1,T(null),O(new Set),ie(new Set),le(``);return}let n=++q.current,r=new AbortController;return ve(e,t,r.signal).then(e=>{n===q.current&&e.batch_run_id===t&&J.current===t&&Fe(e)}).catch(e=>{se(e)||V(B(e,c(`errors.diagnostics`)))}),()=>r.abort()},[p?.batch.execution_run_id,P,Fe,e,c]),(0,F.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=J.current;if(n!==null&&t.batch_run_id!==n)return;let r=H.current;if(!r||W.current.has(t.attempt_run_id)){Ie(t),r&&W.current.has(t.attempt_run_id)&&Pe.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){Ie(t),Be(r.batch.execution_run_id);return}let a=r.attempts[i],o=ae(x(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){W.current.add(t.attempt_run_id),Ie(t),Pe.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};H.current=c,m(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(X.current){Y.current=!0;return}let n=H.current,r=t.execution_run_id??t.id;if(pe(e=>e+1),M&&r===M.execution_run_id&&be(e,M.execution_run_id).then(de).catch(()=>void 0),n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){K.current+=1,Be(n.batch.execution_run_id);return}Y.current=!0,!X.current&&!U.current&&(Y.current=!1,U.current=setTimeout(()=>{U.current=null,Z.current().catch(e=>V(B(e,c(`errors.load`))))},Te))},r=()=>{pe(e=>e+1),ze().catch(e=>V(B(e,c(`errors.load`))))};return l.on(`check-attempt:output`,t),l.on(`execution-run:updated`,n),l.on(`lifecycle-event:created`,n),l.on(`connect`,r),()=>{l.off(`check-attempt:output`,t),l.off(`execution-run:updated`,n),l.off(`lifecycle-event:created`,n),l.off(`connect`,r)}},[M,Ie,e,ze,Be,l,c]),(0,F.useEffect)(()=>()=>{U.current&&clearTimeout(U.current),W.current.clear(),G.current.clear()},[]);let Ve=e=>{K.current+=1,J.current=e.batch.execution_run_id,Le(e)},He=async(e,t)=>{K.current+=1,X.current=!0,C(e),V(null);try{Ve(await t())}catch(t){V(B(t,c(`errors.${e}`))),t instanceof ue&&t.status===409&&await ze().catch(()=>void 0)}finally{C(null),X.current=y,Y.current&&!U.current&&(Y.current=!1,U.current=setTimeout(()=>{U.current=null,Z.current().catch(e=>V(B(e,c(`errors.load`))))},Te))}},Ue=p?we.has(p.batch.execution_status):!1,We=p?Ue?`running`:p.batch.execution_status===`completed`?`finished`:p.batch.execution_status===`cancelled`||p.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,Ge=[...d],Ke=new Set(i),qe=new Set(a),Je=i.length,Ye=a.length,Xe=p?.attempts.filter(e=>e.execution_status!==`completed`).length??0,Ze=async()=>{if(!(!w||D.size===0&&ne.size===0)){N(!0),V(null);try{let t=w.repair.accepts_ticket_id&&(k||w.repair.candidate_tickets[0]?.id)||null;de(await ye(e,[...D],[...ne],t))}catch(t){if(V(B(t,c(`errors.repair`))),t instanceof ue&&t.status===409&&p){let t=p.batch.execution_run_id,n=++q.current;ve(e,t).then(e=>{n===q.current&&e.batch_run_id===t&&J.current===t&&Fe(e)}).catch(()=>void 0)}}finally{N(!1)}}},Qe=async()=>{if(M){N(!0),V(null);try{de(await xe(e,M.execution_run_id))}catch(e){V(B(e,c(`errors.repairStop`)))}finally{N(!1)}}},$e=new Set([...w?.attempts.filter(e=>e.diagnostics.some(e=>D.has(e.id))).map(e=>e.attempt_run_id)??[],...ne]),et=(e,t,n)=>{O(r=>{let i=new Set(r);if(!n)return i.delete(t),i;if(i.size>=z)return r;let a=new Set(w?.attempts.filter(e=>e.diagnostics.some(e=>i.has(e.id))).map(e=>e.attempt_run_id)??[]);return!a.has(e)&&a.size>=ke?r:(i.add(t),i)})},tt=(e,t)=>{ie(n=>{let r=new Set(n);return t?!$e.has(e)&&$e.size>=ke?n:(r.add(e),r):(r.delete(e),r)})};return(0,F.useEffect)(()=>{s?.(We)},[We,s]),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Se&&(0,R.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,R.jsxs)(`div`,{className:`grid min-h-0 flex-1 overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)]`,children:[(0,R.jsxs)(`aside`,{className:`min-h-0 overflow-y-auto border-b border-border/70 p-4 md:border-r md:border-b-0 sm:p-5`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:c(`configured`)}),(0,R.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,R.jsx)(`p`,{className:`font-medium text-foreground`,children:c(`policySummary.title`)}),(0,R.jsx)(`p`,{className:`mt-1`,children:c(`policySummary.counts`,{requiredCount:Je,preReviewCount:Ye})}),(0,R.jsx)(`p`,{className:`mt-1`,children:c(`policySummary.projectPolicy`)})]}),(0,R.jsx)(`div`,{className:`mt-3 space-y-2`,children:r.map(e=>{let t=p?.attempts.find(t=>t.definition_id===e.id),n=Ke.has(e.id),r=qe.has(e.id);return(0,R.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-xl border border-border/60 bg-background/30 p-3`,children:[(0,R.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:d.has(e.id),onChange:t=>f(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:e.name}),(0,R.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[c(`category.${e.category}`),` · `,c(n?`required`:`optional`),` · `,c(r?`preReview`:`finalOnly`),t?` · ${c(`status.${t.execution_status}`)}`:``]})]})]},e.id)})}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,R.jsx)(j,{type:`button`,size:`sm`,disabled:Ge.length===0||Ue||S!==null,onClick:()=>void He(`run`,()=>me(e,{targetKind:t,targetBundleId:n,definitionIds:Ge})),children:c(S===`run`?`starting`:`runSelected`)}),p&&Ue&&(0,R.jsx)(j,{type:`button`,variant:`destructive`,size:`sm`,disabled:S!==null,onClick:()=>void He(`stop`,()=>I(e,p.batch.execution_run_id)),children:c(S===`stop`?`stopping`:`stop`)})]}),p&&!Ue&&(0,R.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,R.jsx)(j,{type:`button`,variant:`outline`,size:`xs`,disabled:S!==null,onClick:()=>void He(`rerun`,()=>L(e,p.batch.execution_run_id,{mode:`all`})),children:c(`rerunAll`)}),(0,R.jsx)(j,{type:`button`,variant:`outline`,size:`xs`,disabled:S!==null||Xe===0,onClick:()=>void He(`rerun`,()=>L(e,p.batch.execution_run_id,{mode:`failed_only`})),children:c(`rerunFailed`)})]})]}),(0,R.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[o&&!h&&y&&(0,R.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:c(`gateLoading`)}),h&&(0,R.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:c(`gateTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-muted-foreground`,children:c(`gateScope`)})]}),(0,R.jsx)(`span`,{className:u(`rounded-full border px-2.5 py-1 text-xs font-medium`,h.decision===`passed`&&h.presentApplicability.appliesToCurrentState===!0?Me.current:Me.blocked),children:c(h.presentApplicability.appliesToCurrentState===!1?`gateStale`:h.presentApplicability.appliesToCurrentState===null?`gateUnverifiable`:h.decision===`passed`?`gatePassed`:`gateBlocked`)})]}),(0,R.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,R.jsx)(`span`,{children:c(`gateBoundary`,{boundary:h.boundaryKind})}),(0,R.jsx)(`span`,{className:`break-all`,children:c(`gatePolicy`,{fingerprint:h.policy.fingerprint.slice(0,12)})}),(0,R.jsx)(`span`,{className:`break-all`,children:h.sourceBatchRunId?c(`gateSourceBatch`,{batchId:h.sourceBatchRunId}):c(`gateNoBatch`)})]}),h.reasonCodes.length>0&&(0,R.jsx)(`ul`,{className:`mt-3 space-y-1 text-sm text-muted-foreground`,children:h.reasonCodes.map(e=>(0,R.jsx)(`li`,{children:c(`reason.${e}`)},e))}),(0,R.jsx)(`div`,{className:`mt-4 space-y-2`,children:h.policy.definitions.map(e=>{let t=je(h,h.evaluatedAttempts.find(t=>t.definition_id===e.id));return(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:e.name}),(0,R.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:e.command})]}),(0,R.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-2 py-1 text-xs`,Me[t]),children:c(`evidence.${t}`)})]},e.id)})})]}),y&&(0,R.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:c(`loading`)}),!y&&!p&&(0,R.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,R.jsx)(`h2`,{className:`font-medium text-foreground`,children:c(`emptyTitle`)}),(0,R.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:c(`emptyDescription`)})]}),p&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:c(`status.${p.batch.execution_status}`)}),(0,R.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c(`summary`,{passed:p.batch.passed_count,failed:p.batch.failed_count,running:p.batch.running_count,queued:p.batch.queued_count})}),p.batch.stop_requested&&(0,R.jsx)(`span`,{className:`text-xs text-amber-200`,children:c(`stopRequested`)})]}),(0,R.jsxs)(E,{value:_??void 0,onValueChange:v,children:[(0,R.jsx)(re,{className:`mt-4 flex flex-wrap gap-2 border-0 bg-transparent p-0`,"aria-label":c(`attempts`),children:p.attempts.map(e=>(0,R.jsx)(ee,{value:e.execution_run_id,tabIndex:_===e.execution_run_id?0:-1,className:u(`h-auto items-start border px-3 py-2 text-left text-xs data-[state=active]:ring-2 data-[state=active]:ring-ring/60`,Ae(e)),children:(0,R.jsxs)(`span`,{children:[(0,R.jsx)(`span`,{className:`block font-medium`,children:e.command_snapshot.name}),(0,R.jsx)(`span`,{className:`mt-0.5 block opacity-80`,children:c(`status.${e.execution_status}`)})]})},e.execution_run_id))}),p.attempts.map(e=>(0,R.jsx)(oe,{value:e.execution_run_id,className:`mt-5`,children:(0,R.jsxs)(`article`,{children:[(0,R.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,R.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:c(`command`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:c(`directory`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??c(`targetRoot`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:c(`outcome`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?c(`outcomeValue.${e.outcome}`):c(`status.${e.execution_status}`)})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:c(`currencyLabel`)}),(0,R.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.currency?c(`currency.${e.currency}`):c(`currency.pending`)})]})]}),(0,R.jsx)(Ce,{attempt:e,diagnostics:w?.attempts.find(t=>t.attempt_run_id===e.execution_run_id)??null,repair:w?.repair??null,selectedDiagnosticIds:D,selectedRawOutputAttemptRunIds:ne,selectedAttemptRunIds:$e,selectedTicketId:k,pending:fe,activeRepair:M,onSelectedTicketChange:le,onToggleDiagnostic:(t,n)=>et(e.execution_run_id,t,n),onToggleRawOutput:t=>tt(e.execution_run_id,t),onStartRepair:()=>void Ze(),onStopRepair:()=>void Qe()}),(0,R.jsx)(`h3`,{className:`mt-5 text-sm font-semibold text-foreground`,children:c(`output`)}),e.output_retention_state===`expired`?(0,R.jsx)(`p`,{className:`mt-2 rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:c(`outputExpired`)}):(0,R.jsx)(`pre`,{className:`mt-2 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:te(e.retained_output)||c(`outputEmpty`)}),e.retained_start_offset>0&&(0,R.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:c(`outputTruncated`)})]})},e.execution_run_id))]})]})]})]})]})},H=(e,t)=>S(k(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),U=(e,t)=>S(k(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),W=(e,t={})=>S(k(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),G=(e,t)=>S(k(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),K=e=>S(k(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),q=e=>O(k(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),J=256*1024,Y=24,X=(e,t)=>C.t(`common:testsDialog.${e}`,t),Ne=(e,t)=>{let n=`${e}${t}`;return n.length<=J?n:n.slice(-J)},Z=(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,Pe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=Y,Q=e=>{e.scrollTop=e.scrollHeight},Fe=(e,t=!1)=>{Q(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{Q(e),t&&(r=window.requestAnimationFrame(()=>{Q(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},Ie=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`,Le=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`},$=e=>{let t=e.split(`/`);return t[t.length-1]||e},Re=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),ze=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),Be=(e,t)=>{let n=Re(t);return n.length===0?e:e.flatMap(e=>{let t=$(e.path);if(ze(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>ze(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},Ve=e=>X(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),He=e=>e?.selection?e.selection.kind===`all`?X(`selection.allTests`):e.selection.kind===`case`?e.selection.name:$(e.selection.path):X(`selection.noRunYet`),Ue=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`,We=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,Ge=(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,Ke=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,qe=({line:e,tone:t})=>(0,R.jsx)(`div`,{"data-tone":t,className:u(`whitespace-pre-wrap break-words`,We(t)),children:e===``?` `:e}),Je=(0,F.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,R.jsxs)(`button`,{type:`button`,"aria-label":X(`caseRow.runAriaLabel`,{name:r}),title:r,className:u(`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,R.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,R.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));Je.displayName=`TestCaseRow`;var Ye=(0,F.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:s,onRunFile:c,onToggleFile:l})=>{let d=e===`file`&&n===i.path,p=e===`case`&&n===i.path;return(0,R.jsx)(D,{open:a,onOpenChange:e=>{l(i.path,e)},children:(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(fe,{asChild:!0,children:(0,R.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":X(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,R.jsx)(f,{className:u(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,R.jsx)(`button`,{type:`button`,"aria-label":X(`fileRow.runAriaLabel`,{path:i.path}),className:u(`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`,(d||p)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{c(i.path)},children:(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,R.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,R.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,R.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:$(i.path)}),(0,R.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:X(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,R.jsx)(b,{children:(0,R.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,R.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:X(`fileRow.noNamedTests`)}):(0,R.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let o=e===`case`&&n===i.path&&t===a.name;return(0,R.jsx)(Je,{canRunGranular:r,filePath:i.path,isActive:o,name:a.name,onRunCase:s},a.id)})})})})]})})});Ye.displayName=`DiscoveryFileRow`;var Xe=(0,F.memo)(({activeSelectionKind:e,activeSelectionName:n,activeSelectionPath:r,availableCommands:a,canRunGranular:o,discovery:s,expandedFiles:c,fullSuiteOnlyNotice:l,isLoading:d,selectedCommandId:p,selectedCommandName:m,sessionError:_,sessionStatus:v,shouldShowCommandSelector:y,onRunCase:b,onRunFile:x,onSelectCommand:S,onToggleFile:C})=>{let[w,T]=(0,F.useState)(``),E=(0,F.useMemo)(()=>Be(s,w),[s,w]),D=(0,F.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),ee=Re(w).length>0;return(0,R.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,R.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[y&&(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:X(`scope.label`)}),(0,R.jsxs)(i,{children:[(0,R.jsx)(t,{asChild:!0,children:(0,R.jsxs)(j,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":X(`scope.selectedCommandAriaLabel`),disabled:a.length===0||v===`running`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:m??X(`scope.selectTestScope`)}),(0,R.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,R.jsx)(h,{align:`start`,className:`w-72`,children:a.map(e=>(0,R.jsx)(ne,{className:u(p===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{S(e.id)},children:(0,R.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),l&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:l}),(s.length>0||w.length>0)&&(0,R.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,R.jsx)(pe,{type:`search`,value:w,onChange:e=>{T(e.target.value)},placeholder:X(`filter.placeholder`),"aria-label":X(`filter.ariaLabel`),className:`pr-10`}),w.length>0&&(0,R.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":X(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{T(``)},children:(0,R.jsx)(N,{className:`size-4`})})]}),!a.length&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:X(`discovery.noCommands`)}),_&&(0,R.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:_}),(0,R.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,R.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`min-w-0`,children:(0,R.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[X(`discovery.fileCount`,{count:E.length}),`, `,X(`discovery.caseCount`,{count:D})]})}),d&&(0,R.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:s.length===0&&!d?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:X(`discovery.noFilesDetected`)}):E.length===0?(0,R.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:X(`discovery.noFilterMatches`)}):E.map(t=>(0,R.jsx)(Ye,{activeSelectionKind:e,activeSelectionName:n,activeSelectionPath:r,canRunGranular:o,file:t,isExpanded:ee||(c[t.path]??!1),onRunCase:b,onRunFile:x,onToggleFile:C},t.path))})]})]})})});Xe.displayName=`DiscoveryPane`;var Ze=(0,F.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,F.useMemo)(()=>t?te(t).replace(/\r\n/g,`
|
|
2
|
+
`).replace(/\r/g,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`).map(e=>({line:e,tone:Ue(e)})):[],[t]);return(0,R.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,R.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,R.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,R.jsx)(P,{variant:`outline`,className:u(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,Ie(i)),children:Ve(i)}),a&&(0,R.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,R.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,R.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:Le(e)}),n&&(0,R.jsx)(P,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:X(`output.trimmed`)})]}),(0,R.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,R.jsx)(`div`,{ref:o,"aria-label":X(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,R.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,R.jsx)(qe,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,R.jsx)(`div`,{className:`text-slate-200`,children:X(`output.empty`)})})})})]})})});Ze.displayName=`OutputPane`;var Qe=(0,F.forwardRef)(({testCommands:e,onStatusChange:t,onTargetLabelChange:i,onClose:a,...o},l)=>{let u=o.scope,f=o.projectId,h=o.scope===`ticket`?o.ticketId:null,g=o.scope===`project`?o.targetKind:null,b=o.scope===`project`?o.targetBundleId:null,[x,S]=(0,F.useState)(e),[C,w]=(0,F.useState)(null),[T,E]=(0,F.useState)([]),[D,ee]=(0,F.useState)(``),[te,O]=(0,F.useState)({}),[ne,re]=(0,F.useState)(!0),[k,ae]=(0,F.useState)(!1),[A,oe]=(0,F.useState)(!1),[se,ce]=(0,F.useState)(null),[le,M]=(0,F.useState)(!1),[fe,N]=(0,F.useState)(!1),P=(0,F.useRef)(null),pe=(0,F.useRef)(!1),me=(0,F.useRef)(null),he=(0,F.useRef)(!0),ge=(0,F.useRef)(null),_e=(0,F.useRef)(null),ve=C?.selection?.kind??null,ye=C?.selection?.kind===`all`?null:C?.selection?.path??null,be=C?.selection?.kind===`case`?C.selection.name:null,xe=C?.id??null,I=C?.status??null,L=(0,F.useMemo)(()=>x.find(e=>e.id===D)??null,[x,D]),Se=(0,F.useMemo)(()=>{if(C?.summary?.failed_count==null&&C?.summary?.passed_count==null&&C?.summary?.failed_file_count==null&&C?.summary?.passed_file_count==null)return null;let e=C?.summary?.failed_count==null&&C?.summary?.passed_count==null;return{failed:I===`failed`&&C?.summary?.failed_count==null&&C?.summary?.failed_file_count!=null||e?{count:C?.summary?.failed_file_count??0,label:X(`summaryCounts.filesFailed`)}:{count:C?.summary?.failed_count??0,label:X(`summaryCounts.failed`)},passed:e?{count:C?.summary?.passed_file_count??0,label:X(`summaryCounts.filesPassed`)}:{count:C?.summary?.passed_count??C?.summary?.passed_file_count??0,label:X(`summaryCounts.passed`)}}},[C?.summary?.failed_count,C?.summary?.passed_count,C?.summary?.failed_file_count,C?.summary?.passed_file_count,I]),Ce=L?.runner===`unknown`?X(`scope.fullSuiteOnlyNotice`):null,we=!!(L&&C?.status!==`running`&&!k&&!A),Te=we,Ee=we&&fe,De=x.length>1,{runs:Oe}=ie(f),z=C?.run_id?Oe.find(e=>e.id===C.run_id)??null:null;(0,F.useEffect)(()=>{D||x.length===0||ee(x[0]?.id??``)},[x,D]),(0,F.useEffect)(()=>{e.length>0&&S(t=>Ge(t,e)?t:e)},[e]),(0,F.useEffect)(()=>{if(x.length>0||!f)return;let e=new AbortController;return y(e.signal).then(e=>{let t=e.find(e=>e.id===f);t&&S(e=>{let n=de(t);return Ge(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[x.length,f]),(0,F.useEffect)(()=>{let e=e=>{!e||e.id!==P.current||w(t=>Z(t,e))},t=e=>{!e||e.session_id!==P.current||w(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Ne(t.output,e.chunk),output_truncated:e.output_truncated})};return r.on(`test-session:updated`,e),r.on(`test-session:output`,t),()=>{r.off(`test-session:updated`,e),r.off(`test-session:output`,t)}},[]),(0,F.useEffect)(()=>{let e=me.current;if(!e){ge.current=C?.output??null,_e.current=C?.status??null;return}let t=ge.current!==(C?.output??null),n=_e.current!==`running`&&C?.status===`running`,r=_e.current===`running`&&C?.status!==`running`;if(n&&(he.current=!0),n||t&&C?.status===`running`&&he.current||r&&he.current){let t=Fe(e,r);return ge.current=C?.output??null,_e.current=C?.status??null,t}ge.current=C?.output??null,_e.current=C?.status??null},[C?.output,C?.status]),(0,F.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!f)return;t=await H(f,{target_kind:g??`repo_root`,target_bundle_id:b??null})}else t=await U(h??``,f);if(e){q(t.id).catch(()=>{});return}P.current=t.id,w(t)}catch(t){e||ce(t instanceof ue?t.message:X(`messages.loadRunnerError`))}finally{!e&&P.current==null&&re(!1)}})(),()=>{e=!0}},[f,u,b,g,h]),(0,F.useEffect)(()=>{z&&w(e=>{if(!e||e.run_id!==z.id)return e;let t=z.status===`completed`?`passed`:z.status===`failed`?`failed`:z.status===`cancelled`||z.status===`interrupted`?`stopped`:`running`;return e.status===t&&e.error===(z.failure?.message??e.error)?e:{...e,status:t,error:z.failure?.message??e.error,started_at:z.started_at??e.started_at,completed_at:z.completed_at??e.completed_at}})},[z]),(0,F.useEffect)(()=>{if(!C?.id){N(!1);return}if(x.length>0&&!D){N(!1);return}let e=new AbortController,t=!1;return re(!0),N(!1),W(C.id,{commandId:D||null,signal:e.signal}).then(e=>{t||(E(e.files),N(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||ce(n instanceof ue?n.message:X(`messages.discoverError`))}).finally(()=>{t||re(!1)}),()=>{t=!0,e.abort()}},[x.length,D,C?.id]),(0,F.useEffect)(()=>()=>{let e=P.current;!e||pe.current||(pe.current=!0,q(e).catch(()=>{}))},[]);let ke=(0,F.useCallback)(async e=>{if(!(!xe||I===`running`||!L||k||A)){ce(null),ae(!0);try{let t=await G(xe,{command_id:L.id,selection:e});w(e=>Z(e,t))}catch(e){ce(e instanceof ue?e.message:X(`messages.startError`))}finally{ae(!1)}}},[k,A,L,xe,I]),B=(0,F.useCallback)(async()=>{if(!(!xe||I!==`running`||A)){ce(null),oe(!0);try{let e=await K(xe);w(t=>Z(t,e))}catch(e){ce(e instanceof ue?e.message:X(`messages.stopError`))}finally{oe(!1)}}},[A,xe,I]),Ae=(0,F.useCallback)(()=>{let e=P.current;if(!e||pe.current){a();return}pe.current=!0,a(),q(e).catch(()=>{})},[a]),je=(0,F.useCallback)(()=>{if(I===`running`){M(!0);return}Ae()},[Ae,I]);(0,F.useImperativeHandle)(l,()=>({requestClose:je}),[je]),(0,F.useEffect)(()=>{t?.(I===`running`?`running`:I===`passed`?`finished`:I===`failed`||I===`error`?`error`:I===`stopped`?`interrupted`:`inactive`)},[t,I]),(0,F.useEffect)(()=>{C?.target_label&&i?.(C.target_label)},[i,C?.target_label]);let Me=(0,F.useCallback)(()=>{let e=me.current;e&&(he.current=Pe(e))},[]),V=(0,F.useCallback)(e=>{ee(e)},[]),J=(0,F.useCallback)((e,t)=>{O(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Y=(0,F.useCallback)(e=>{ke({kind:`file`,path:e})},[ke]),Q=(0,F.useCallback)((e,t)=>{ke({kind:`case`,path:e,name:t})},[ke]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,R.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,R.jsx)(Xe,{activeSelectionKind:ve,activeSelectionName:be,activeSelectionPath:ye,availableCommands:x,canRunGranular:Ee,discovery:T,expandedFiles:te,fullSuiteOnlyNotice:Ce,isLoading:ne,selectedCommandId:D,selectedCommandName:L?.name??null,sessionError:se,sessionStatus:I,shouldShowCommandSelector:De,onRunCase:Q,onRunFile:Y,onSelectCommand:V,onToggleFile:J}),(0,R.jsx)(Ze,{durationMs:C?.duration_ms??null,output:C?.output??``,outputTruncated:C?.output_truncated??!1,selectionLabel:He(C),status:I,summaryCounts:Se,viewportRef:me,onScroll:Me})]}),(0,R.jsx)(v,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,R.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:C?.status===`running`?(0,R.jsxs)(j,{type:`button`,variant:`destructive`,className:Ke,onClick:()=>{B()},disabled:A,children:[(0,R.jsx)(p,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:X(`actions.stop`)})]}):(0,R.jsxs)(j,{type:`button`,variant:`success`,className:Ke,disabled:!Te,onClick:()=>{ke({kind:`all`})},children:[(0,R.jsx)(m,{className:`h-4 w-4`}),(0,R.jsx)(`span`,{children:X(`actions.run`)})]})})})]}),(0,R.jsx)(n,{open:le,onOpenChange:M,children:(0,R.jsxs)(c,{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,R.jsxs)(s,{children:[(0,R.jsx)(d,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:X(`closeConfirmation.title`)}),(0,R.jsx)(_,{className:`text-sm text-foreground whitespace-pre-line`,children:X(`closeConfirmation.description`)})]}),(0,R.jsxs)(v,{className:`sm:flex-row sm:justify-end`,children:[(0,R.jsx)(j,{type:`button`,variant:`ghost`,onClick:()=>M(!1),children:X(`closeConfirmation.keepRunning`)}),(0,R.jsx)(j,{type:`button`,variant:`destructive`,onClick:()=>{M(!1),Ae()},children:X(`closeConfirmation.stopAndClose`)})]})]})})]})});Qe.displayName=`TestsPanel`;var $e=`archon.verification-tab`,et=()=>{try{let e=window.localStorage.getItem($e);return e===`checks`||e===`tests`?e:null}catch{return null}},tt=e=>{try{window.localStorage.setItem($e,e)}catch{}},nt=({targetLabel:e,definitions:t,requiredDefinitionIds:r=[],preReviewDefinitionIds:i=[],checksTarget:o,testsTarget:s,onClose:u,onOpenActivity:f,requestedInitialTab:p})=>{let{t:m}=A(`common`,{keyPrefix:`verificationDialog`}),h=w(t),g=o!==null&&(t.length>0||!!o.gateEvaluationId),v=s!==null&&h.length>0,[y,b]=(0,F.useState)(()=>{if(p===`checks`&&g||p===`tests`&&v)return p;let e=et();return e===`checks`&&g||e===`tests`&&v?e:g?`checks`:`tests`}),[x,S]=(0,F.useState)(`inactive`),[C,T]=(0,F.useState)(`inactive`),D=(0,F.useRef)(null),te=(0,F.useRef)(null);(0,F.useEffect)(()=>{(y===`checks`&&!g||y===`tests`&&!v)&&b(g?`checks`:`tests`)},[y,g,v]);let O=e=>{if(te.current=e??null,s){let e=D.current;if(e){e.requestClose();return}}(e??u)()},ne=()=>{let e=te.current??u;te.current=null,e()};return(0,R.jsx)(n,{open:!0,onOpenChange:e=>{e||O()},children:(0,R.jsxs)(c,{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,R.jsx)(d,{className:`sr-only`,children:m(`title`)}),(0,R.jsx)(_,{className:`sr-only`,children:m(`description`)}),(0,R.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,R.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,R.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,R.jsx)(l,{className:`size-5`})}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:m(`title`)}),(0,R.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f&&(0,R.jsx)(j,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>O(f),children:m(`openActivity`)}),(0,R.jsx)(j,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m(`close`),onClick:()=>O(),children:(0,R.jsx)(N,{className:`size-4`})})]})]}),(0,R.jsxs)(E,{value:y,onValueChange:e=>{e!==`checks`&&e!==`tests`||(b(e),tt(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,R.jsxs)(re,{"aria-label":m(`tabsAriaLabel`),children:[g&&(0,R.jsxs)(ee,{value:`checks`,className:`gap-2`,children:[(0,R.jsx)(l,{className:`size-4`}),(0,R.jsx)(`span`,{children:m(`tabs.checks.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":m(`status.checks.${x}`),children:(0,R.jsx)(a,{state:x})})]}),v&&(0,R.jsxs)(ee,{value:`tests`,className:`gap-2`,children:[(0,R.jsx)(M,{className:`size-4`}),(0,R.jsx)(`span`,{children:m(`tabs.tests.label`)}),(0,R.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":m(`status.tests.${C}`),children:(0,R.jsx)(a,{state:C})})]})]}),(0,R.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:m(`tabs.${y}.description`)})]}),g&&o&&(0,R.jsx)(oe,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(V,{...o,definitions:t,requiredDefinitionIds:r,preReviewDefinitionIds:i,onStatusChange:S})}),s&&h.length>0&&(0,R.jsx)(oe,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,R.jsx)(Qe,{ref:D,...s,testCommands:h,onStatusChange:T,onClose:ne})})]})]})})};export{nt as VerificationDialog};
|