@straiffi/archon 1.7.8 → 1.7.10
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-DwfDSF4q.js → ActivityView-IUWr92uj.js} +1 -1
- package/dist/client/assets/{GitHubActionsDialog-3dMCYCSZ.js → GitHubActionsDialog-0YtWvbFk.js} +1 -1
- package/dist/client/assets/VerificationDialog-B4Pyz1LV.js +4 -0
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-Bdnc97XK.js → architectureDiagram-3BPJPVTR-LLMyOR-6.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-boxM3She.js → blockDiagram-GPEHLZMM-aa1HitBJ.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-CJDdF7xd.js → c4Diagram-AAUBKEIU-BpSt5sdj.js} +1 -1
- package/dist/client/assets/channel-DWPRC-jg.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-ClpcO-Om.js → chunk-2J33WTMH-D8pf3RNr.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-CcuL_65J.js → chunk-3OPIFGDE-_yx1N2iT.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-CUGYZXkH.js → chunk-5ZQYHXKU-CYURGSbL.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-CApeLDyK.js → chunk-727SXJPM-Ci2Mu1zz.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-8FdSvF2D.js → chunk-AQP2D5EJ-CqVgrKze.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-CZoIOF3a.js → chunk-CSCIHK7Q-CT8aPk-o.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-BigFQI5y.js → chunk-KSCS5N6A-yM1i0J-p.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-DIi3SHaT.js → chunk-L5ZTLDWV-BKMGr31Z.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-B-Z0BcQy.js → chunk-LZXEDZCA-A7oUDETP.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-EBeba0mg.js → chunk-ND2GUHAM-Cagc-XAG.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-DJBI2y53.js → chunk-NZK2D7GU-pe8tKLWI.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-BqxdXhMd.js → chunk-O5CBEL6O-BahwghWW.js} +1 -1
- package/dist/client/assets/{chunk-WU5MYG2G-Coe1_Cbb.js → chunk-WU5MYG2G-BfSAFufr.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DBZaZLLc.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B7HsVFoJ.js +1 -0
- package/dist/client/assets/{dagre-BM42HDAG-tuTmeA0Y.js → dagre-BM42HDAG-DCma6-hS.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-ILGCpG2F.js → diagram-2AECGRRQ-DUeggZrO.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-C8qBZsgK.js → diagram-5GNKFQAL-CdjOKGtl.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-BXlcm_Zo.js → diagram-KO2AKTUF-CYjXhgh_.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-B8V5EVbD.js → diagram-LMA3HP47-DYBCh4cm.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-CWsdOqcP.js → diagram-OG6HWLK6-D3HPQt3z.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-DW8pgly2.js → erDiagram-TEJ5UH35-mG8Yztg-.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-Djn7fOVR.js → flowDiagram-I6XJVG4X-4FvjuoSZ.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-DZ421MEy.js → ganttDiagram-6RSMTGT7-ByCQI8ft.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CCNzLPuP.js → gitGraphDiagram-PVQCEYII-CzEUA7nB.js} +1 -1
- package/dist/client/assets/index-D-miHTTb.js +273 -0
- package/dist/client/assets/index-TAQIlNdJ.css +2 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-Bd1gYgMp.js → infoDiagram-5YYISTIA-Q9CqnXO1.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-txyMoatJ.js → ishikawaDiagram-YF4QCWOH-CO8BToGf.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DhT3bmX6.js → journeyDiagram-JHISSGLW-DtOyWvDJ.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-BBHt2hfC.js → kanban-definition-UN3LZRKU-DIn9bYpk.js} +1 -1
- package/dist/client/assets/{line-KGRcT7Qz.js → line-H-k0M9_s.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-CDzt4_zR.js → mermaid-parser.core-CZOUS5zK.js} +1 -1
- package/dist/client/assets/{mermaid.core-DD_-k1aB.js → mermaid.core-Ck71Qr7h.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-DoctVTDl.js → mindmap-definition-RKZ34NQL-BRFEcJw_.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-DFlLEi70.js → pieDiagram-4H26LBE5-CwihXXcJ.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-3YHOQgl7.js → quadrantDiagram-W4KKPZXB-moiRw4Cm.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-X4fZVL9M.js → requirementDiagram-4Y6WPE33-tshvM_vV.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BUPnMXeG.js → sankeyDiagram-5OEKKPKP-rtKIuBEp.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-D6QU3M64.js → sequenceDiagram-3UESZ5HK-lkTCo4wE.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-c35bu4qZ.js → stateDiagram-AJRCARHV-CFQhVUSd.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-rrN4DgWp.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-CX2y6e_b.js → timeline-definition-PNZ67QCA-BmlQ7Wiy.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-BDaWltjF.js → vennDiagram-CIIHVFJN-CZyZepcT.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BpBRL2sb.js → wardleyDiagram-YWT4CUSO-C2b52gni.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-Bqw7X0UT.js → xychartDiagram-2RQKCTM6-FqnROUHq.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/db.js +23 -10
- package/dist/server/db.js.map +1 -1
- package/dist/server/index.js +330 -25
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/agent.js +5 -4
- package/dist/server/lib/agent.js.map +1 -1
- package/dist/server/lib/automationCheckGate.js +114 -20
- package/dist/server/lib/automationCheckGate.js.map +1 -1
- package/dist/server/lib/automationProgression.js +2 -1
- package/dist/server/lib/automationProgression.js.map +1 -1
- package/dist/server/lib/automationReconciliation.js +19 -0
- package/dist/server/lib/automationReconciliation.js.map +1 -1
- package/dist/server/lib/automationResumeDecision.js +82 -0
- package/dist/server/lib/automationResumeDecision.js.map +1 -1
- package/dist/server/lib/automationReviewGate.js +142 -0
- package/dist/server/lib/automationReviewGate.js.map +1 -0
- package/dist/server/lib/automationStageDetails.js +98 -5
- package/dist/server/lib/automationStageDetails.js.map +1 -1
- package/dist/server/lib/buildCompletionContinuation.js +109 -0
- package/dist/server/lib/buildCompletionContinuation.js.map +1 -0
- package/dist/server/lib/buildSequences.js +81 -0
- package/dist/server/lib/buildSequences.js.map +1 -1
- package/dist/server/lib/buildTicketCommit.js +219 -0
- package/dist/server/lib/buildTicketCommit.js.map +1 -0
- package/dist/server/lib/bundleAutomationReadiness.js +7 -0
- package/dist/server/lib/bundleAutomationReadiness.js.map +1 -0
- package/dist/server/lib/bundleReviewOperations.js +17 -5
- package/dist/server/lib/bundleReviewOperations.js.map +1 -1
- package/dist/server/lib/chatOperations.js +2 -2
- package/dist/server/lib/chatOperations.js.map +1 -1
- package/dist/server/lib/checkDefinitions.js +11 -0
- package/dist/server/lib/checkDefinitions.js.map +1 -1
- package/dist/server/lib/checkGateEvaluations.js +4 -3
- package/dist/server/lib/checkGateEvaluations.js.map +1 -1
- package/dist/server/lib/checkRunner.js +27 -4
- package/dist/server/lib/checkRunner.js.map +1 -1
- package/dist/server/lib/checkRuns.js +38 -6
- package/dist/server/lib/checkRuns.js.map +1 -1
- package/dist/server/lib/git.js +5 -1
- package/dist/server/lib/git.js.map +1 -1
- package/dist/server/lib/lightweightPrompt.js +2 -1
- package/dist/server/lib/lightweightPrompt.js.map +1 -1
- package/dist/server/lib/projectAutoConfig.js +2 -1
- package/dist/server/lib/projectAutoConfig.js.map +1 -1
- package/dist/server/lib/projects.js +95 -10
- package/dist/server/lib/projects.js.map +1 -1
- package/dist/server/lib/requiredCheckPolicy.js +150 -19
- package/dist/server/lib/requiredCheckPolicy.js.map +1 -1
- package/dist/server/lib/run.js +3 -2
- package/dist/server/lib/run.js.map +1 -1
- package/dist/server/lib/terminal.js +5 -7
- package/dist/server/lib/terminal.js.map +1 -1
- package/dist/server/lib/testSessions.js +2 -2
- package/dist/server/lib/testSessions.js.map +1 -1
- package/dist/server/lib/ticketAutomationCommit.js +251 -160
- package/dist/server/lib/ticketAutomationCommit.js.map +1 -1
- package/dist/server/lib/tickets.js +45 -4
- package/dist/server/lib/tickets.js.map +1 -1
- package/dist/server/lib/types.js.map +1 -1
- package/dist/server/lib/workspaceProcessEnvironment.js +21 -0
- package/dist/server/lib/workspaceProcessEnvironment.js.map +1 -0
- package/dist/server/workers/build.js +57 -97
- package/dist/server/workers/build.js.map +1 -1
- package/dist/server/workers/chat.js +13 -6
- package/dist/server/workers/chat.js.map +1 -1
- package/dist/server/workers/followUp.js +92 -116
- package/dist/server/workers/followUp.js.map +1 -1
- package/dist/server/workers/plan.js +4 -1
- package/dist/server/workers/plan.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/VerificationDialog-CoTfXMyb.js +0 -4
- package/dist/client/assets/channel-BGqdAcIT.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-D5VuKRcj.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-B9GNqpRr.js +0 -1
- package/dist/client/assets/index-BRc02lbW.js +0 -273
- package/dist/client/assets/index-CZO9HL1Z.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-Ymy1_EHr.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-D-miHTTb.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-3dMCYCSZ.js → GitHubActionsDialog-0YtWvbFk.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-BRc02lbW.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-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};
|
|
@@ -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 ee,N as p,O as m,P as h,U as g,W as _,Y as v,_ as y,a as b,at as x,b as S,d as C,et as w,f as T,g as E,h as D,i as te,it as O,k,m as ne,n as A,nt as j,o as M,ot as re,p as ie,q as N,rt as P,s as ae,st as F,t as I,tt as L,u as R,v as z,x as B,y as V,z as H}from"./index-D-miHTTb.js";var U=e(F(),1),oe=(e,t)=>x(j(`/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.`}),se=(e,t={})=>{let n=new URL(j(`/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)),x(n.toString(),{signal:t.signal,fallbackErrorMessage:`Unable to load check batches right now.`})},ce=(e,t,n)=>x(j(`/projects/${e}/check-batches/${t}`),{signal:n,fallbackErrorMessage:`Unable to load check details right now.`}),le=(e,t,n)=>x(j(`/projects/${e}/check-gate-evaluations/${t}`),{signal:n,fallbackErrorMessage:`Unable to load the automated delivery gate right now.`}),ue=(e,t)=>x(j(`/projects/${e}/check-batches/${t}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop this check batch right now.`}),de=(e,t,n)=>x(j(`/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.`}),W=w(),fe=new Set([`queued`,`running`,`waiting`]),G=75,K=32,q=64,pe=3,J=(e,t)=>e instanceof L?e.message:t,me=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`,he=(e,t)=>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`,ge={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`},Y=({projectId:e,targetKind:t,targetBundleId:n,definitions:r,requiredDefinitionIds:i=[],preReviewDefinitionIds:a=[],checkPolicySource:o=`project`,gateEvaluationId:s=null,onStatusChange:c})=>{let{t:l}=re(`common`,{keyPrefix:`checksDialog`}),d=ae(),[f,ee]=(0,U.useState)(()=>new Set(r.map(e=>e.id))),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,x]=(0,U.useState)(!0),[S,C]=(0,U.useState)(null),[w,E]=(0,U.useState)(null),O=(0,U.useRef)(p),k=(0,U.useRef)(null),A=(0,U.useRef)(new Set),j=(0,U.useRef)(new Map),F=(0,U.useRef)(0),I=(0,U.useRef)(null),R=(0,U.useRef)(!1),z=(0,U.useRef)(!0),B=(0,U.useRef)(async()=>void 0),V=(0,U.useRef)(async()=>void 0),H=(0,U.useRef)(()=>void 0),Y=(0,U.useRef)(0);O.current=p,z.current=y||S!==null;let _e=(0,U.useCallback)(e=>{let t=j.current;if(!t.has(e.attempt_run_id)&&t.size>=K){let e=t.keys().next().value;e&&(t.delete(e),A.current.delete(e))}let n=t.get(e.attempt_run_id)??[];t.set(e.attempt_run_id,[...n.slice(-(q-1)),e])},[]),ve=(0,U.useCallback)(e=>{let t=O.current?.batch.execution_run_id===e.batch.execution_run_id?O.current:null,n=!1,r=new Set(e.attempts.map(e=>e.execution_run_id));for(let e of j.current.keys())r.has(e)||(j.current.delete(e),A.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=j.current.get(e.execution_run_id)??[];for(let e of[...o].sort((e,t)=>e.revision-t.revision)){let t=M(b(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?A.current.add(e.execution_run_id):(A.current.delete(e.execution_run_id),j.current.delete(e.execution_run_id)),a}),a={...e,attempts:i};I.current=e.batch.execution_run_id,O.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?H.current(e.batch.execution_run_id):Y.current=0,R.current&&!k.current&&(R.current=!1,k.current=setTimeout(()=>{k.current=null,V.current().catch(e=>E(J(e,l(`errors.load`))))},G))},[l]),X=(0,U.useCallback)(async(t,n)=>{let r=++F.current,i=await ce(e,t,n);r!==F.current||i.batch.execution_run_id!==t||I.current!==null&&I.current!==t||ve(i)},[ve,e]);B.current=X,H.current=(0,U.useCallback)(e=>{if(k.current)return;if(Y.current>=pe){Y.current=0,A.current.clear(),j.current.clear();return}let t=G*2**Y.current;k.current=setTimeout(()=>{k.current=null,Y.current+=1,B.current(e).catch(t=>{E(J(t,l(`errors.load`))),A.current.size>0&&H.current(e)})},t)},[l]);let ye=(0,U.useCallback)(async r=>{let i=++F.current,a=null;do{let o=await se(e,{limit:50,cursor:a,signal:r});if(i!==F.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){I.current=s.run.id,await X(s.run.id,r);return}a=o.next_cursor}while(a);!r?.aborted&&i===F.current&&(I.current=null,O.current=null,m(null),v(null))},[X,e,n,t]),be=(0,U.useCallback)(async()=>{if(s){let e=I.current;e&&await X(e);return}await ye()},[s,X,ye]);V.current=be;let xe=(0,U.useCallback)(e=>{k.current||=setTimeout(()=>{k.current=null,X(e).catch(e=>E(J(e,l(`errors.load`))))},G)},[X,l]);(0,U.useEffect)(()=>{let t=new AbortController;return x(!0),E(null),(async()=>{if(!s){g(null),await ye(t.signal);return}let n=await le(e,s,t.signal);if(g(n),n.sourceBatchRunId){I.current=n.sourceBatchRunId,await X(n.sourceBatchRunId,t.signal);return}I.current=null,O.current=null,m(null),v(null)})().catch(e=>{P(e)||E(J(e,l(`errors.load`)))}).finally(()=>{t.signal.aborted||(x(!1),z.current=!1,R.current&&!k.current&&(R.current=!1,k.current=setTimeout(()=>{k.current=null,V.current().catch(e=>E(J(e,l(`errors.load`))))},G)))}),()=>t.abort()},[s,X,ye,e,l]),(0,U.useEffect)(()=>{let t=t=>{if(t.project_id!==e)return;let n=I.current;if(n!==null&&t.batch_run_id!==n)return;let r=O.current;if(!r||A.current.has(t.attempt_run_id)){_e(t),r&&A.current.has(t.attempt_run_id)&&H.current(r.batch.execution_run_id);return}let i=r.attempts.findIndex(e=>e.execution_run_id===t.attempt_run_id);if(i<0){_e(t),xe(r.batch.execution_run_id);return}let a=r.attempts[i],o=M(b(a),t);if(o.status===`ignored`)return;if(o.status===`refetch`){A.current.add(t.attempt_run_id),_e(t),H.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};O.current=c,m(c)},n=t=>{if(t.project_id&&t.project_id!==e)return;if(z.current){R.current=!0;return}let n=O.current,r=t.execution_run_id??t.id;if(n&&(r===n.batch.execution_run_id||n.attempts.some(e=>e.execution_run_id===r))){F.current+=1,xe(n.batch.execution_run_id);return}R.current=!0,!z.current&&!k.current&&(R.current=!1,k.current=setTimeout(()=>{k.current=null,V.current().catch(e=>E(J(e,l(`errors.load`))))},G))},r=()=>{be().catch(e=>E(J(e,l(`errors.load`))))};return d.on(`check-attempt:output`,t),d.on(`execution-run:updated`,n),d.on(`lifecycle-event:created`,n),d.on(`connect`,r),()=>{d.off(`check-attempt:output`,t),d.off(`execution-run:updated`,n),d.off(`lifecycle-event:created`,n),d.off(`connect`,r)}},[_e,e,be,xe,d,l]),(0,U.useEffect)(()=>()=>{k.current&&clearTimeout(k.current),A.current.clear(),j.current.clear()},[]);let Se=e=>{F.current+=1,I.current=e.batch.execution_run_id,ve(e)},Z=async(e,t)=>{F.current+=1,z.current=!0,C(e),E(null);try{Se(await t())}catch(t){E(J(t,l(`errors.${e}`))),t instanceof L&&t.status===409&&await be().catch(()=>void 0)}finally{C(null),z.current=y,R.current&&!k.current&&(R.current=!1,k.current=setTimeout(()=>{k.current=null,V.current().catch(e=>E(J(e,l(`errors.load`))))},G))}},Q=p?fe.has(p.batch.execution_status):!1,Ce=p?Q?`running`:p.batch.execution_status===`completed`?`finished`:p.batch.execution_status===`cancelled`||p.batch.execution_status===`interrupted`?`interrupted`:`error`:`inactive`,we=[...f],Te=new Set(i),$=new Set(a),Ee=i.length,De=a.length,Oe=p?.attempts.filter(e=>e.execution_status!==`completed`).length??0;return(0,U.useEffect)(()=>{c?.(Ce)},[Ce,c]),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[w&&(0,W.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:w}),(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 overflow-hidden md:grid-cols-[19rem_minmax(0,1fr)]`,children:[(0,W.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,W.jsx)(`h2`,{className:`text-sm font-semibold text-foreground`,children:l(`configured`)}),(0,W.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border/70 bg-background/35 p-3 text-xs text-muted-foreground`,children:[(0,W.jsx)(`p`,{className:`font-medium text-foreground`,children:l(`policySummary.title`)}),(0,W.jsx)(`p`,{className:`mt-1`,children:l(`policySummary.counts`,{requiredCount:Ee,preReviewCount:De})}),(0,W.jsx)(`p`,{className:`mt-1`,children:l(`policySummary.source`,{source:l(`policySource.${o}`)})})]}),(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:r.map(e=>{let t=p?.attempts.find(t=>t.definition_id===e.id),n=Te.has(e.id),r=$.has(e.id);return(0,W.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-xl border border-border/60 bg-background/30 p-3`,children:[(0,W.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-4 accent-primary`,checked:f.has(e.id),onChange:t=>ee(n=>{let r=new Set(n);return t.target.checked?r.add(e.id):r.delete(e.id),r})}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:e.name}),(0,W.jsxs)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:[l(`category.${e.category}`),` · `,l(n?`required`:`optional`),` · `,l(r?`preReview`:`finalOnly`),t?` · ${l(`status.${t.execution_status}`)}`:``]})]})]},e.id)})}),(0,W.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,W.jsx)(N,{type:`button`,size:`sm`,disabled:we.length===0||Q||S!==null,onClick:()=>void Z(`run`,()=>oe(e,{targetKind:t,targetBundleId:n,definitionIds:we})),children:l(S===`run`?`starting`:`runSelected`)}),p&&Q&&(0,W.jsx)(N,{type:`button`,variant:`destructive`,size:`sm`,disabled:S!==null,onClick:()=>void Z(`stop`,()=>ue(e,p.batch.execution_run_id)),children:l(S===`stop`?`stopping`:`stop`)})]}),p&&!Q&&(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,W.jsx)(N,{type:`button`,variant:`outline`,size:`xs`,disabled:S!==null,onClick:()=>void Z(`rerun`,()=>de(e,p.batch.execution_run_id,{mode:`all`})),children:l(`rerunAll`)}),(0,W.jsx)(N,{type:`button`,variant:`outline`,size:`xs`,disabled:S!==null||Oe===0,onClick:()=>void Z(`rerun`,()=>de(e,p.batch.execution_run_id,{mode:`failed_only`})),children:l(`rerunFailed`)})]})]}),(0,W.jsxs)(`main`,{className:`min-h-0 overflow-y-auto p-4 sm:p-6`,children:[s&&!h&&y&&(0,W.jsx)(`p`,{role:`status`,className:`mb-4 text-sm text-muted-foreground`,children:l(`gateLoading`)}),h&&(0,W.jsxs)(`section`,{"aria-labelledby":`automated-delivery-gate-heading`,className:`mb-5 rounded-2xl border border-border/70 bg-background/30 p-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{id:`automated-delivery-gate-heading`,className:`font-semibold text-foreground`,children:l(`gateTitle`)}),(0,W.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-muted-foreground`,children:l(`gateScope`)})]}),(0,W.jsx)(`span`,{className:u(`rounded-full border px-2.5 py-1 text-xs font-medium`,h.decision===`passed`?ge.current:ge.blocked),children:l(h.decision===`passed`?`gatePassed`:`gateBlocked`)})]}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,W.jsx)(`span`,{children:l(`gateBoundary`,{boundary:h.boundaryKind})}),(0,W.jsx)(`span`,{className:`break-all`,children:l(`gatePolicy`,{fingerprint:h.policy.fingerprint.slice(0,12)})}),(0,W.jsx)(`span`,{className:`break-all`,children:h.sourceBatchRunId?l(`gateSourceBatch`,{batchId:h.sourceBatchRunId}):l(`gateNoBatch`)})]}),h.reasonCodes.length>0&&(0,W.jsx)(`ul`,{className:`mt-3 space-y-1 text-sm text-muted-foreground`,children:h.reasonCodes.map(e=>(0,W.jsx)(`li`,{children:l(`reason.${e}`)},e))}),(0,W.jsx)(`div`,{className:`mt-4 space-y-2`,children:h.policy.definitions.map(e=>{let t=he(h,h.evaluatedAttempts.find(t=>t.definition_id===e.id));return(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-xl border border-border/60 p-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`p`,{className:`break-words text-sm font-medium text-foreground`,children:e.name}),(0,W.jsx)(`code`,{className:`mt-1 block break-all text-xs text-muted-foreground`,children:e.command})]}),(0,W.jsx)(`span`,{className:u(`shrink-0 rounded-full border px-2 py-1 text-xs`,ge[t]),children:l(`evidence.${t}`)})]},e.id)})})]}),y&&(0,W.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:l(`loading`)}),!y&&!p&&(0,W.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-border p-6 text-center`,children:[(0,W.jsx)(`h2`,{className:`font-medium text-foreground`,children:l(`emptyTitle`)}),(0,W.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:l(`emptyDescription`)})]}),p&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`rounded-full border border-border px-2 py-1 text-xs text-muted-foreground`,children:l(`status.${p.batch.execution_status}`)}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:l(`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,W.jsx)(`span`,{className:`text-xs text-amber-200`,children:l(`stopRequested`)})]}),(0,W.jsxs)(T,{value:_??void 0,onValueChange:v,children:[(0,W.jsx)(ne,{className:`mt-4 flex flex-wrap gap-2 border-0 bg-transparent p-0`,"aria-label":l(`attempts`),children:p.attempts.map(e=>(0,W.jsx)(D,{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`,me(e)),children:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`span`,{className:`block font-medium`,children:e.command_snapshot.name}),(0,W.jsx)(`span`,{className:`mt-0.5 block opacity-80`,children:l(`status.${e.execution_status}`)})]})},e.execution_run_id))}),p.attempts.map(e=>(0,W.jsx)(ie,{value:e.execution_run_id,className:`mt-5`,children:(0,W.jsxs)(`article`,{children:[(0,W.jsx)(`h2`,{className:`text-lg font-semibold text-foreground`,children:e.command_snapshot.name}),(0,W.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-sm sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:l(`command`)}),(0,W.jsx)(`dd`,{className:`mt-0.5 break-words font-mono text-xs text-foreground`,children:e.command_snapshot.command})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:l(`directory`)}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.command_snapshot.cwd??l(`targetRoot`)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:l(`outcome`)}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.outcome?l(`outcomeValue.${e.outcome}`):l(`status.${e.execution_status}`)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`dt`,{className:`text-xs text-muted-foreground`,children:l(`currencyLabel`)}),(0,W.jsx)(`dd`,{className:`mt-0.5 text-foreground`,children:e.currency?l(`currency.${e.currency}`):l(`currency.pending`)})]})]}),(0,W.jsx)(`h3`,{className:`mt-5 text-sm font-semibold text-foreground`,children:l(`output`)}),e.output_retention_state===`expired`?(0,W.jsx)(`p`,{className:`mt-2 rounded-xl border border-border bg-background/30 p-4 text-sm text-muted-foreground`,children:l(`outputExpired`)}):(0,W.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)||l(`outputEmpty`)}),e.retained_start_offset>0&&(0,W.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:l(`outputTruncated`)})]})},e.execution_run_id))]})]})]})]})]})},_e=(e,t)=>x(j(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),ve=(e,t)=>x(j(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),X=(e,t={})=>x(j(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),ye=(e,t)=>x(j(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),be=e=>x(j(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),xe=e=>O(j(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),Se=256*1024,Z=24,Q=(e,t)=>S.t(`common:testsDialog.${e}`,t),Ce=(e,t)=>{let n=`${e}${t}`;return n.length<=Se?n:n.slice(-Se)},we=(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,Te=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=Z,$=e=>{e.scrollTop=e.scrollHeight},Ee=(e,t=!1)=>{$(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{$(e),t&&(r=window.requestAnimationFrame(()=>{$(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},De=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`,Oe=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`},ke=e=>{let t=e.split(`/`);return t[t.length-1]||e},Ae=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),je=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),Me=(e,t)=>{let n=Ae(t);return n.length===0?e:e.flatMap(e=>{let t=ke(e.path);if(je(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>je(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},Ne=e=>Q(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),Pe=e=>e?.selection?e.selection.kind===`all`?Q(`selection.allTests`):e.selection.kind===`case`?e.selection.name:ke(e.selection.path):Q(`selection.noRunYet`),Fe=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`,Ie=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,Le=(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,Re=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,ze=({line:e,tone:t})=>(0,W.jsx)(`div`,{"data-tone":t,className:u(`whitespace-pre-wrap break-words`,Ie(t)),children:e===``?` `:e}),Be=(0,U.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,W.jsxs)(`button`,{type:`button`,"aria-label":Q(`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,W.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,W.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));Be.displayName=`TestCaseRow`;var Ve=(0,U.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,ee=e===`case`&&n===i.path;return(0,W.jsx)(E,{open:a,onOpenChange:e=>{l(i.path,e)},children:(0,W.jsxs)(`div`,{className:`space-y-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(z,{asChild:!0,children:(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":Q(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,W.jsx)(f,{className:u(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,W.jsx)(`button`,{type:`button`,"aria-label":Q(`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||ee)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{c(i.path)},children:(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,W.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,W.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,W.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:ke(i.path)}),(0,W.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,W.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:Q(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,W.jsx)(y,{children:(0,W.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,W.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:Q(`fileRow.noNamedTests`)}):(0,W.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let o=e===`case`&&n===i.path&&t===a.name;return(0,W.jsx)(Be,{canRunGranular:r,filePath:i.path,isActive:o,name:a.name,onRunCase:s},a.id)})})})})]})})});Ve.displayName=`DiscoveryFileRow`;var He=(0,U.memo)(({activeSelectionKind:e,activeSelectionName:n,activeSelectionPath:r,availableCommands:a,canRunGranular:o,discovery:s,expandedFiles:c,fullSuiteOnlyNotice:l,isLoading:d,selectedCommandId:ee,selectedCommandName:p,sessionError:g,sessionStatus:_,shouldShowCommandSelector:v,onRunCase:y,onRunFile:b,onSelectCommand:x,onToggleFile:S})=>{let[C,w]=(0,U.useState)(``),T=(0,U.useMemo)(()=>Me(s,C),[s,C]),E=(0,U.useMemo)(()=>T.reduce((e,t)=>e+t.cases.length,0),[T]),D=Ae(C).length>0;return(0,W.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[v&&(0,W.jsxs)(`div`,{className:`space-y-2`,children:[(0,W.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:Q(`scope.label`)}),(0,W.jsxs)(i,{children:[(0,W.jsx)(t,{asChild:!0,children:(0,W.jsxs)(N,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":Q(`scope.selectedCommandAriaLabel`),disabled:a.length===0||_===`running`,children:[(0,W.jsx)(`span`,{className:`truncate`,children:p??Q(`scope.selectTestScope`)}),(0,W.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,W.jsx)(m,{align:`start`,className:`w-72`,children:a.map(e=>(0,W.jsx)(k,{className:u(ee===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{x(e.id)},children:(0,W.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),l&&(0,W.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||C.length>0)&&(0,W.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,W.jsx)(H,{type:`search`,value:C,onChange:e=>{w(e.target.value)},placeholder:Q(`filter.placeholder`),"aria-label":Q(`filter.ariaLabel`),className:`pr-10`}),C.length>0&&(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":Q(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{w(``)},children:(0,W.jsx)(B,{className:`size-4`})})]}),!a.length&&(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:Q(`discovery.noCommands`)}),g&&(0,W.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:g}),(0,W.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,W.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,W.jsx)(`div`,{className:`min-w-0`,children:(0,W.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[Q(`discovery.fileCount`,{count:T.length}),`, `,Q(`discovery.caseCount`,{count:E})]})}),d&&(0,W.jsx)(h,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:s.length===0&&!d?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Q(`discovery.noFilesDetected`)}):T.length===0?(0,W.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:Q(`discovery.noFilterMatches`)}):T.map(t=>(0,W.jsx)(Ve,{activeSelectionKind:e,activeSelectionName:n,activeSelectionPath:r,canRunGranular:o,file:t,isExpanded:D||(c[t.path]??!1),onRunCase:y,onRunFile:b,onToggleFile:S},t.path))})]})]})})});He.displayName=`DiscoveryPane`;var Ue=(0,U.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:s})=>{let c=(0,U.useMemo)(()=>t?te(t).replace(/\r\n/g,`
|
|
2
|
+
`).replace(/\r/g,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`).map(e=>({line:e,tone:Fe(e)})):[],[t]);return(0,W.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,W.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,W.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,W.jsx)(V,{variant:`outline`,className:u(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,De(i)),children:Ne(i)}),a&&(0,W.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,W.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,W.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:Oe(e)}),n&&(0,W.jsx)(V,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:Q(`output.trimmed`)})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,W.jsx)(`div`,{ref:o,"aria-label":Q(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:s,children:(0,W.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:c.length>0?c.map((e,t)=>(0,W.jsx)(ze,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,W.jsx)(`div`,{className:`text-slate-200`,children:Q(`output.empty`)})})})})]})})});Ue.displayName=`OutputPane`;var We=(0,U.forwardRef)(({testCommands:e,onStatusChange:t,onTargetLabelChange:i,onClose:a,...o},l)=>{let u=o.scope,f=o.projectId,m=o.scope===`ticket`?o.ticketId:null,h=o.scope===`project`?o.targetKind:null,y=o.scope===`project`?o.targetBundleId:null,[b,x]=(0,U.useState)(e),[S,C]=(0,U.useState)(null),[w,T]=(0,U.useState)([]),[E,D]=(0,U.useState)(``),[te,O]=(0,U.useState)({}),[k,ne]=(0,U.useState)(!0),[A,j]=(0,U.useState)(!1),[M,re]=(0,U.useState)(!1),[ie,P]=(0,U.useState)(null),[ae,F]=(0,U.useState)(!1),[z,B]=(0,U.useState)(!1),V=(0,U.useRef)(null),H=(0,U.useRef)(!1),oe=(0,U.useRef)(null),se=(0,U.useRef)(!0),ce=(0,U.useRef)(null),le=(0,U.useRef)(null),ue=S?.selection?.kind??null,de=S?.selection?.kind===`all`?null:S?.selection?.path??null,fe=S?.selection?.kind===`case`?S.selection.name:null,G=S?.id??null,K=S?.status??null,q=(0,U.useMemo)(()=>b.find(e=>e.id===E)??null,[b,E]),pe=(0,U.useMemo)(()=>{if(S?.summary?.failed_count==null&&S?.summary?.passed_count==null&&S?.summary?.failed_file_count==null&&S?.summary?.passed_file_count==null)return null;let e=S?.summary?.failed_count==null&&S?.summary?.passed_count==null;return{failed:K===`failed`&&S?.summary?.failed_count==null&&S?.summary?.failed_file_count!=null||e?{count:S?.summary?.failed_file_count??0,label:Q(`summaryCounts.filesFailed`)}:{count:S?.summary?.failed_count??0,label:Q(`summaryCounts.failed`)},passed:e?{count:S?.summary?.passed_file_count??0,label:Q(`summaryCounts.filesPassed`)}:{count:S?.summary?.passed_count??S?.summary?.passed_file_count??0,label:Q(`summaryCounts.passed`)}}},[S?.summary?.failed_count,S?.summary?.passed_count,S?.summary?.failed_file_count,S?.summary?.passed_file_count,K]),J=q?.runner===`unknown`?Q(`scope.fullSuiteOnlyNotice`):null,me=!!(q&&S?.status!==`running`&&!A&&!M),he=me,ge=me&&z,Y=b.length>1,{runs:Se}=I(f),Z=S?.run_id?Se.find(e=>e.id===S.run_id)??null:null;(0,U.useEffect)(()=>{E||b.length===0||D(b[0]?.id??``)},[b,E]),(0,U.useEffect)(()=>{e.length>0&&x(t=>Le(t,e)?t:e)},[e]),(0,U.useEffect)(()=>{if(b.length>0||!f)return;let e=new AbortController;return v(e.signal).then(e=>{let t=e.find(e=>e.id===f);t&&x(e=>{let n=R(t);return Le(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[b.length,f]),(0,U.useEffect)(()=>{let e=e=>{!e||e.id!==V.current||C(t=>we(t,e))},t=e=>{!e||e.session_id!==V.current||C(t=>!t||t.id!==e.session_id||e.run_id&&t.run_id&&e.run_id!==t.run_id?t:{...t,output:Ce(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,U.useEffect)(()=>{let e=oe.current;if(!e){ce.current=S?.output??null,le.current=S?.status??null;return}let t=ce.current!==(S?.output??null),n=le.current!==`running`&&S?.status===`running`,r=le.current===`running`&&S?.status!==`running`;if(n&&(se.current=!0),n||t&&S?.status===`running`&&se.current||r&&se.current){let t=Ee(e,r);return ce.current=S?.output??null,le.current=S?.status??null,t}ce.current=S?.output??null,le.current=S?.status??null},[S?.output,S?.status]),(0,U.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!f)return;t=await _e(f,{target_kind:h??`repo_root`,target_bundle_id:y??null})}else t=await ve(m??``,f);if(e){xe(t.id).catch(()=>{});return}V.current=t.id,C(t)}catch(t){e||P(t instanceof L?t.message:Q(`messages.loadRunnerError`))}finally{!e&&V.current==null&&ne(!1)}})(),()=>{e=!0}},[f,u,y,h,m]),(0,U.useEffect)(()=>{Z&&C(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,U.useEffect)(()=>{if(!S?.id){B(!1);return}if(b.length>0&&!E){B(!1);return}let e=new AbortController,t=!1;return ne(!0),B(!1),X(S.id,{commandId:E||null,signal:e.signal}).then(e=>{t||(T(e.files),B(e.supports_granular_selection))}).catch(n=>{t||e.signal.aborted||P(n instanceof L?n.message:Q(`messages.discoverError`))}).finally(()=>{t||ne(!1)}),()=>{t=!0,e.abort()}},[b.length,E,S?.id]),(0,U.useEffect)(()=>()=>{let e=V.current;!e||H.current||(H.current=!0,xe(e).catch(()=>{}))},[]);let $=(0,U.useCallback)(async e=>{if(!(!G||K===`running`||!q||A||M)){P(null),j(!0);try{let t=await ye(G,{command_id:q.id,selection:e});C(e=>we(e,t))}catch(e){P(e instanceof L?e.message:Q(`messages.startError`))}finally{j(!1)}}},[A,M,q,G,K]),De=(0,U.useCallback)(async()=>{if(!(!G||K!==`running`||M)){P(null),re(!0);try{let e=await be(G);C(t=>we(t,e))}catch(e){P(e instanceof L?e.message:Q(`messages.stopError`))}finally{re(!1)}}},[M,G,K]),Oe=(0,U.useCallback)(()=>{let e=V.current;if(!e||H.current){a();return}H.current=!0,a(),xe(e).catch(()=>{})},[a]),ke=(0,U.useCallback)(()=>{if(K===`running`){F(!0);return}Oe()},[Oe,K]);(0,U.useImperativeHandle)(l,()=>({requestClose:ke}),[ke]),(0,U.useEffect)(()=>{t?.(K===`running`?`running`:K===`passed`?`finished`:K===`failed`||K===`error`?`error`:K===`stopped`?`interrupted`:`inactive`)},[t,K]),(0,U.useEffect)(()=>{S?.target_label&&i?.(S.target_label)},[i,S?.target_label]);let Ae=(0,U.useCallback)(()=>{let e=oe.current;e&&(se.current=Te(e))},[]),je=(0,U.useCallback)(e=>{D(e)},[]),Me=(0,U.useCallback)((e,t)=>{O(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Ne=(0,U.useCallback)(e=>{$({kind:`file`,path:e})},[$]),Fe=(0,U.useCallback)((e,t)=>{$({kind:`case`,path:e,name:t})},[$]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,"data-testid":`tests-panel-layout`,children:[(0,W.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,W.jsx)(He,{activeSelectionKind:ue,activeSelectionName:fe,activeSelectionPath:de,availableCommands:b,canRunGranular:ge,discovery:w,expandedFiles:te,fullSuiteOnlyNotice:J,isLoading:k,selectedCommandId:E,selectedCommandName:q?.name??null,sessionError:ie,sessionStatus:K,shouldShowCommandSelector:Y,onRunCase:Fe,onRunFile:Ne,onSelectCommand:je,onToggleFile:Me}),(0,W.jsx)(Ue,{durationMs:S?.duration_ms??null,output:S?.output??``,outputTruncated:S?.output_truncated??!1,selectionLabel:Pe(S),status:K,summaryCounts:pe,viewportRef:oe,onScroll:Ae})]}),(0,W.jsx)(_,{className:`shrink-0 border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,W.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:S?.status===`running`?(0,W.jsxs)(N,{type:`button`,variant:`destructive`,className:Re,onClick:()=>{De()},disabled:M,children:[(0,W.jsx)(ee,{className:`h-4 w-4`}),(0,W.jsx)(`span`,{children:Q(`actions.stop`)})]}):(0,W.jsxs)(N,{type:`button`,variant:`success`,className:Re,disabled:!he,onClick:()=>{$({kind:`all`})},children:[(0,W.jsx)(p,{className:`h-4 w-4`}),(0,W.jsx)(`span`,{children:Q(`actions.run`)})]})})})]}),(0,W.jsx)(n,{open:ae,onOpenChange:F,children:(0,W.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,W.jsxs)(s,{children:[(0,W.jsx)(d,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:Q(`closeConfirmation.title`)}),(0,W.jsx)(g,{className:`text-sm text-foreground whitespace-pre-line`,children:Q(`closeConfirmation.description`)})]}),(0,W.jsxs)(_,{className:`sm:flex-row sm:justify-end`,children:[(0,W.jsx)(N,{type:`button`,variant:`ghost`,onClick:()=>F(!1),children:Q(`closeConfirmation.keepRunning`)}),(0,W.jsx)(N,{type:`button`,variant:`destructive`,onClick:()=>{F(!1),Oe()},children:Q(`closeConfirmation.stopAndClose`)})]})]})})]})});We.displayName=`TestsPanel`;var Ge=`archon.verification-tab`,Ke=()=>{try{let e=window.localStorage.getItem(Ge);return e===`checks`||e===`tests`?e:null}catch{return null}},qe=e=>{try{window.localStorage.setItem(Ge,e)}catch{}},Je=({targetLabel:e,definitions:t,requiredDefinitionIds:r=[],preReviewDefinitionIds:i=[],checkPolicySource:o=`project`,checksTarget:s,testsTarget:u,onClose:f,onOpenActivity:ee,requestedInitialTab:p})=>{let{t:m}=re(`common`,{keyPrefix:`verificationDialog`}),h=C(t),_=s!==null&&(t.length>0||!!s.gateEvaluationId),v=u!==null&&h.length>0,[y,b]=(0,U.useState)(()=>{if(p===`checks`&&_||p===`tests`&&v)return p;let e=Ke();return e===`checks`&&_||e===`tests`&&v?e:_?`checks`:`tests`}),[x,S]=(0,U.useState)(`inactive`),[w,E]=(0,U.useState)(`inactive`),te=(0,U.useRef)(null),O=(0,U.useRef)(null);(0,U.useEffect)(()=>{(y===`checks`&&!_||y===`tests`&&!v)&&b(_?`checks`:`tests`)},[y,_,v]);let k=e=>{if(O.current=e??null,u){let e=te.current;if(e){e.requestClose();return}}(e??f)()},j=()=>{let e=O.current??f;O.current=null,e()};return(0,W.jsx)(n,{open:!0,onOpenChange:e=>{e||k()},children:(0,W.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(),children:[(0,W.jsx)(d,{className:`sr-only`,children:m(`title`)}),(0,W.jsx)(g,{className:`sr-only`,children:m(`description`)}),(0,W.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,W.jsxs)(`div`,{className:`flex min-w-0 gap-3`,children:[(0,W.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,W.jsx)(l,{className:`size-5`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`h1`,{className:`text-xl font-semibold text-foreground`,children:m(`title`)}),(0,W.jsx)(`p`,{className:`truncate text-sm text-muted-foreground`,children:e})]})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ee&&(0,W.jsx)(N,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>k(ee),children:m(`openActivity`)}),(0,W.jsx)(N,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":m(`close`),onClick:()=>k(),children:(0,W.jsx)(B,{className:`size-4`})})]})]}),(0,W.jsxs)(T,{value:y,onValueChange:e=>{e!==`checks`&&e!==`tests`||(b(e),qe(e))},className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`shrink-0 border-b border-border/70 px-4 py-3 sm:px-6`,children:[(0,W.jsxs)(ne,{"aria-label":m(`tabsAriaLabel`),children:[_&&(0,W.jsxs)(D,{value:`checks`,className:`gap-2`,children:[(0,W.jsx)(l,{className:`size-4`}),(0,W.jsx)(`span`,{children:m(`tabs.checks.label`)}),(0,W.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":m(`status.checks.${x}`),children:(0,W.jsx)(a,{state:x})})]}),v&&(0,W.jsxs)(D,{value:`tests`,className:`gap-2`,children:[(0,W.jsx)(A,{className:`size-4`}),(0,W.jsx)(`span`,{children:m(`tabs.tests.label`)}),(0,W.jsx)(`span`,{className:`inline-flex shrink-0`,role:`status`,"aria-label":m(`status.tests.${w}`),children:(0,W.jsx)(a,{state:w})})]})]}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:m(`tabs.${y}.description`)})]}),_&&s&&(0,W.jsx)(ie,{value:`checks`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,W.jsx)(Y,{...s,definitions:t,requiredDefinitionIds:r,preReviewDefinitionIds:i,checkPolicySource:o,onStatusChange:S})}),u&&h.length>0&&(0,W.jsx)(ie,{value:`tests`,forceMount:!0,className:`mt-0 flex min-h-0 flex-1 flex-col overflow-hidden data-[state=inactive]:hidden`,children:(0,W.jsx)(We,{ref:te,...u,testCommands:h,onStatusChange:E,onClose:j})})]})]})})};export{Je as VerificationDialog};
|