@straiffi/archon 1.4.12 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{GitHubActionsDialog-DcW7fUgz.js → GitHubActionsDialog-oMY61JXF.js} +1 -1
- package/dist/client/assets/{TestsDialog-xNEttQOx.js → TestsDialog-elElGi9L.js} +3 -4
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-DHADo63Y.js → architectureDiagram-3BPJPVTR-BNcdEMha.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-D_LqGLuD.js → blockDiagram-GPEHLZMM-xHTKb0-z.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-mIqv7fCU.js → c4Diagram-AAUBKEIU-kMngbYRg.js} +1 -1
- package/dist/client/assets/channel-DAW1OrrC.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-DP-b68f-.js → chunk-2J33WTMH-BVZnJcYa.js} +1 -1
- package/dist/client/assets/{chunk-3OPIFGDE-D4GWQbqc.js → chunk-3OPIFGDE-Dq_H_MkG.js} +1 -1
- package/dist/client/assets/{chunk-5ZQYHXKU-HftAkT9j.js → chunk-5ZQYHXKU-_TwHLQwE.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-CvB0JQZP.js → chunk-727SXJPM-CKkS_93w.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-DSB28EAb.js → chunk-AQP2D5EJ-BHSSO0SM.js} +1 -1
- package/dist/client/assets/{chunk-CSCIHK7Q-DuSgBocb.js → chunk-CSCIHK7Q-CgzsiMAL.js} +1 -1
- package/dist/client/assets/{chunk-KSCS5N6A-cm_ppJ7v.js → chunk-KSCS5N6A-DM-rnicK.js} +1 -1
- package/dist/client/assets/{chunk-L5ZTLDWV-BzDHIV9v.js → chunk-L5ZTLDWV-CnMgoXZs.js} +1 -1
- package/dist/client/assets/{chunk-LZXEDZCA-BruMwvko.js → chunk-LZXEDZCA-CCr2z1iU.js} +2 -2
- package/dist/client/assets/{chunk-ND2GUHAM-DrnvodkL.js → chunk-ND2GUHAM-DtA6gjMn.js} +1 -1
- package/dist/client/assets/{chunk-NZK2D7GU-QVsa0LuF.js → chunk-NZK2D7GU-_8fmSSaf.js} +1 -1
- package/dist/client/assets/{chunk-O5CBEL6O-DJFhq2gr.js → chunk-O5CBEL6O-B84elqwU.js} +1 -1
- package/dist/client/assets/{chunk-WU5MYG2G-ieLjE2uQ.js → chunk-WU5MYG2G-DBvmvPPt.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BmFh-n6n.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-tA1aAbh4.js +1 -0
- package/dist/client/assets/{dagre-BM42HDAG-CFRh82aT.js → dagre-BM42HDAG-C-QssoNU.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-CPk1WJvx.js → diagram-2AECGRRQ-8RpG5DGb.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-DHMJ735r.js → diagram-5GNKFQAL-Dk2raJWq.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-Cq9d2BWb.js → diagram-KO2AKTUF-7iZuIIef.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-CgWJTR_b.js → diagram-LMA3HP47-JLaaaEE6.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-HoFYGw81.js → diagram-OG6HWLK6-jeL3-Rd3.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-B7yuPZck.js → erDiagram-TEJ5UH35-B6uFrMrQ.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-DaXXRHQj.js → flowDiagram-I6XJVG4X-BFWnhmx2.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-pKsFmtHB.js → ganttDiagram-6RSMTGT7-nxON-689.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-Dwx5kc1M.js → gitGraphDiagram-PVQCEYII-DEAsC0GZ.js} +1 -1
- package/dist/client/assets/index-BzDXl4AF.js +265 -0
- package/dist/client/assets/index-DSap5tSX.css +2 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-6Taupp-l.js → infoDiagram-5YYISTIA-CAZHR2I8.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-BBKjiFtW.js → ishikawaDiagram-YF4QCWOH-DEe4SNzl.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-BQQ1EKJ3.js → journeyDiagram-JHISSGLW-CG2kTAj9.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-BvsroFzw.js → kanban-definition-UN3LZRKU-DUWutAjA.js} +1 -1
- package/dist/client/assets/{line-C6BHsie7.js → line-B1SFN8mz.js} +1 -1
- package/dist/client/assets/{mermaid-parser.core-Cb4G8u3H.js → mermaid-parser.core-C-dyz_nb.js} +1 -1
- package/dist/client/assets/{mermaid.core-NCO8Z4wR.js → mermaid.core-nm4BMZuF.js} +3 -3
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-DYzSjAq3.js → mindmap-definition-RKZ34NQL-DZEd-RCz.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-CWMyFFuU.js → pieDiagram-4H26LBE5-WXxrzUwX.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-D1ifIucc.js → quadrantDiagram-W4KKPZXB-BClH2kQx.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-DW68fC21.js → requirementDiagram-4Y6WPE33-ByolUxfP.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DnnV47BL.js → sankeyDiagram-5OEKKPKP-B2vcb3U1.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Dw-9ZBU_.js → sequenceDiagram-3UESZ5HK-J8Nt0GXG.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-C7dkf8nk.js → stateDiagram-AJRCARHV-CrgZ4Uwa.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-CUEBQOsD.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-BmVfK_16.js → timeline-definition-PNZ67QCA-CXebl6LI.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-B9j3QbmD.js → vennDiagram-CIIHVFJN-DLBqI39h.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-C520auMy.js → wardleyDiagram-YWT4CUSO-ku4fViV9.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-CPqUJuqs.js → xychartDiagram-2RQKCTM6-5Jh-bBeb.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/db.js +291 -3
- package/dist/server/db.js.map +1 -1
- package/dist/server/index.js +339 -97
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/agent.js +853 -161
- package/dist/server/lib/agent.js.map +1 -1
- package/dist/server/lib/agentRuns.js +22 -0
- package/dist/server/lib/agentRuns.js.map +1 -1
- package/dist/server/lib/chatMessages.js +24 -8
- package/dist/server/lib/chatMessages.js.map +1 -1
- package/dist/server/lib/genericToolCall.js +151 -0
- package/dist/server/lib/genericToolCall.js.map +1 -0
- package/dist/server/lib/git.js +18 -0
- package/dist/server/lib/git.js.map +1 -1
- package/dist/server/lib/mobileAccess.js +45 -2
- package/dist/server/lib/mobileAccess.js.map +1 -1
- package/dist/server/lib/models.js +65 -48
- package/dist/server/lib/models.js.map +1 -1
- package/dist/server/lib/opencodeTaskSessions.js +216 -0
- package/dist/server/lib/opencodeTaskSessions.js.map +1 -0
- package/dist/server/lib/projectMemory.js +1073 -276
- package/dist/server/lib/projectMemory.js.map +1 -1
- package/dist/server/lib/projectMemoryCursor.js +27 -0
- package/dist/server/lib/projectMemoryCursor.js.map +1 -0
- package/dist/server/lib/projectMemoryEvents.js +24 -0
- package/dist/server/lib/projectMemoryEvents.js.map +1 -0
- package/dist/server/lib/projectMemoryLimits.js +61 -0
- package/dist/server/lib/projectMemoryLimits.js.map +1 -0
- package/dist/server/lib/projectMemoryPrompt.js +299 -110
- package/dist/server/lib/projectMemoryPrompt.js.map +1 -1
- package/dist/server/lib/projectMemoryScan.js +461 -493
- package/dist/server/lib/projectMemoryScan.js.map +1 -1
- package/dist/server/lib/projectMemorySelections.js +97 -0
- package/dist/server/lib/projectMemorySelections.js.map +1 -0
- package/dist/server/lib/projectMemorySuggestions.js +19 -4
- package/dist/server/lib/projectMemorySuggestions.js.map +1 -1
- package/dist/server/lib/projectMemoryTransfer.js +635 -83
- package/dist/server/lib/projectMemoryTransfer.js.map +1 -1
- package/dist/server/lib/projectPathGlob.js +40 -0
- package/dist/server/lib/projectPathGlob.js.map +1 -0
- package/dist/server/lib/projects.js +50 -0
- package/dist/server/lib/projects.js.map +1 -1
- package/dist/server/lib/promptSkills.js +5 -0
- package/dist/server/lib/promptSkills.js.map +1 -1
- package/dist/server/lib/specMessages.js +9 -6
- package/dist/server/lib/specMessages.js.map +1 -1
- package/dist/server/lib/specReviewContext.js +2 -1
- package/dist/server/lib/specReviewContext.js.map +1 -1
- package/dist/server/lib/ticketMessages.js +22 -7
- package/dist/server/lib/ticketMessages.js.map +1 -1
- package/dist/server/lib/tickets.js +6 -0
- package/dist/server/lib/tickets.js.map +1 -1
- package/dist/server/lib/transcriptRuns.js +85 -0
- package/dist/server/lib/transcriptRuns.js.map +1 -0
- package/dist/server/workers/build.js +18 -4
- package/dist/server/workers/build.js.map +1 -1
- package/dist/server/workers/chat.js +24 -7
- package/dist/server/workers/chat.js.map +1 -1
- package/dist/server/workers/followUp.js +27 -10
- package/dist/server/workers/followUp.js.map +1 -1
- package/dist/server/workers/plan.js +405 -69
- package/dist/server/workers/plan.js.map +1 -1
- package/dist/server/workers/planFollowUp.js +30 -7
- package/dist/server/workers/planFollowUp.js.map +1 -1
- package/dist/server/workers/review.js +76 -20
- package/dist/server/workers/review.js.map +1 -1
- package/dist/server/workers/specReview.js +10 -0
- package/dist/server/workers/specReview.js.map +1 -1
- package/dist/server/workers/specSession.js +37 -3
- package/dist/server/workers/specSession.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-D7PWuiXU.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BNIT931s.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-TRtc0GGS.js +0 -1
- package/dist/client/assets/index-5Eun897r.js +0 -260
- package/dist/client/assets/index-CWWEw76C.css +0 -2
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BFmoroJA.js +0 -1
package/dist/client/assets/{GitHubActionsDialog-DcW7fUgz.js → GitHubActionsDialog-oMY61JXF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,R as d,T as f,W as p,_ as m,b as h,c as g,d as _,f as v,j as y,l as b,r as x,s as S,u as C,w,y as T,z as E}from"./index-5Eun897r.js";var D=e(p(),1),O=E(),k=`https://docs.github.com/en/actions`,A=(e,t)=>g.t(`common:githubActions.${e}`,t),j=e=>A(`status.${e}`),M=e=>e?A(`conclusion.${e}`):null,N=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`,P=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`,F=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`},I=e=>e.status===`completed`?M(e.conclusion)??A(`status.completed`):j(e.status),L=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},R=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,a=t?.dispatchable??!0,o=i&&a&&!t?.isLoading,s=e.path.split(`/`).pop();return(0,O.jsxs)(`div`,{className:l(`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.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsx)(`p`,{className:`min-w-0 text-[11px] text-muted-foreground`,children:s}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsx)(S,{variant:`outline`,className:l(`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:A(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,O.jsxs)(c,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!o,"aria-label":A(`workflows.runAriaLabel`,{name:e.name}),title:!a&&t?A(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(T,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:A(`actions.run`)})]})]})]})]})},z=({workflow:e,inputsState:t,refValue:r,onRefChange:i,values:a,onValueChange:o,isDispatching:s,onDispatch:l,onCancel:u})=>{let d=t.inputs.filter(e=>e.required&&!B(a[e.name],e)),f=t.dispatchable&&!t.isLoading&&!t.error&&r.trim()!==``&&d.length===0&&!s;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:A(`inputs.title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,O.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":A(`actions.cancel`),onClick:u,children:(0,O.jsx)(b,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(n,{htmlFor:`github-actions-ref`,children:A(`inputs.refLabel`)}),(0,O.jsx)(w,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{i(e.target.value)},placeholder:A(`inputs.refPlaceholder`),"aria-label":A(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:A(`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:A(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,O.jsx)(V,{input:e,value:a[e.name],onChange:t=>{o(e.name,t)}},e.name)),d.length>0&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:A(`inputs.requiredValidationError`)}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(c,{type:`button`,variant:`ghost`,onClick:u,disabled:s,children:A(`actions.cancel`)}),(0,O.jsxs)(c,{type:`button`,variant:`success`,onClick:l,disabled:!f,children:[s?(0,O.jsx)(h,{className:`h-4 w-4 animate-spin`}):(0,O.jsx)(T,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:A(`actions.dispatch`)})]})]})]})},B=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,V=({input:e,value:t,onChange:r})=>{let i=`github-actions-input-${e.name}`;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(n,{htmlFor:i,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:A(`inputs.requiredLabel`)})]}),e.description&&(0,O.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),H(e,i,t,r)]})},H=(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)(x,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:A(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:A(`inputs.selectPlaceholder`)}),i.map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))]})}return(0,O.jsx)(w,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},U=({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)(S,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,P(t)),children:t.status===`completed`?M(t.conclusion)??A(`status.completed`):j(t.status)}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),W=({run:e})=>{let t=F(e),n=I(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)(S,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,N(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:[A(`actions.openOnGithub`),(0,O.jsx)(C,{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)(S,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,N(e)),children:e.status===`completed`?M(e.conclusion)??A(`status.completed`):j(e.status)}),(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,O.jsx)(U,{job:e})]},e.id))]})},G=({tracked:e})=>{let t=e.state===`not_visible`?A(`runs.notVisible`):A(`runs.resolving`);return(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t})]})},K=e=>({ref:e??`main`}),q=({projectId:e,defaultBranch:n,onClose:l})=>{let[p,g]=(0,D.useState)([]),[x,S]=(0,D.useState)(!0),[w,T]=(0,D.useState)(null),[E,j]=(0,D.useState)([]),[M,N]=(0,D.useState)([]),[P,F]=(0,D.useState)({}),[I,B]=(0,D.useState)(null),[V,H]=(0,D.useState)(!1),[U]=(0,D.useState)(()=>K(n)),q=(0,D.useRef)({}),J=(0,D.useRef)({}),Y=(0,D.useRef)(null),X=(0,D.useCallback)(async n=>{F(e=>{let t=e[n.id];return t?.isLoading?e:{...e,[n.id]:{inputs:t?.inputs??[],dispatchable:t?.dispatchable??!0,isLoading:!0,error:null}}});try{let t=await o(e,n.id,n.path);return F(e=>({...e,[n.id]:{inputs:t.inputs,dispatchable:t.dispatchable,isLoading:!1,error:null}})),t}catch(e){return F(r=>({...r,[n.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof t?e.message:A(`workflows.loadError`)}})),null}},[e]),Z=(0,D.useCallback)(async()=>{S(!0),T(null);try{let t=await d(e);g(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){T(e instanceof t?e.message:A(`workflows.loadError`))}finally{S(!1)}},[X,e]),Q=(0,D.useCallback)(async()=>{try{j((await s(e)).runs)}catch(e){console.warn(`[github-actions] unable to load runs`,e)}},[e]);(0,D.useEffect)(()=>{Z(),Q()},[Z,Q]);let ee=(0,D.useCallback)(async e=>{if(I?.workflow.id===e.id)return;Y.current=e.id,B({workflow:e,ref:U.ref,values:{}});let t=P[e.id];if(t&&!t.isLoading&&!t.error){B(n=>!n||n.workflow.id!==e.id?n:{...n,values:L(t.inputs)});return}let n=await X(e);n&&B(t=>!t||t.workflow.id!==e.id?t:{...t,values:L(n.inputs)})},[U.ref,P,X,I]),te=(0,D.useCallback)(async()=>{if(!I)return;let n=P[I.workflow.id];if(!n||!n.dispatchable)return;H(!0);let r={};for(let e of n.inputs){let t=I.values[e.name];e.type===`boolean`?r[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?r[e.name]=t:typeof e.default==`string`&&e.default!==``&&(r[e.name]=e.default)}try{await a(e,I.workflow.id,{ref:I.ref,inputs:r}),m.success(A(`messages.dispatched`)),B(null),Q()}catch(e){m.error(e instanceof t?e.message:A(`messages.dispatchError`))}finally{H(!1)}},[P,Q,e,I]);(0,D.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(N(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&j(e=>{let n=e.findIndex(e=>e.id===t.run.id);if(n===-1)return[t.run,...e];let r=[...e];return r[n]=t.run,r}))};return _.on(`github-actions:updated`,t),()=>{_.off(`github-actions:updated`,t)}},[e]),(0,D.useEffect)(()=>{let e=I?.workflow.id;!e||Y.current!==e||(q.current[e]?.scrollIntoView({block:`nearest`}),J.current[e]?.scrollIntoView({block:`nearest`}),Y.current=null)},[I?.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)(f,{open:!0,onOpenChange:e=>{e||l()},children:(0,O.jsxs)(r,{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)(y,{className:`sr-only`,children:A(`dialog.srTitle`)}),(0,O.jsx)(u,{className:`sr-only`,children:A(`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)(v,{className:`h-5 w-5`})}),(0,O.jsx)(`div`,{children:(0,O.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:A(`dialog.title`)})})]}),(0,O.jsx)(i,{asChild:!0,children:(0,O.jsx)(c,{type:`button`,"aria-label":A(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,O.jsx)(b,{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":A(`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:A(`workflows.title`)}),(0,O.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:A(`actions.refresh`)})]}),x&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:A(`workflows.loading`)})]}),w&&(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:w}),!x&&p.length===0&&!w&&(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:A(`workflows.empty`)}),(0,O.jsx)(`p`,{className:`mt-1`,children:A(`workflows.emptyHint`)}),(0,O.jsxs)(`a`,{href:k,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[A(`workflows.docsLink`),(0,O.jsx)(C,{className:`h-3 w-3`})]})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>{let t=I?.workflow.id===e.id;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{ref:t=>{q.current[e.id]=t},children:(0,O.jsx)(R,{workflow:e,inputsState:P[e.id]??null,isSelected:t,onSelect:()=>{ee(e)}})}),t&&I&&(0,O.jsx)(`div`,{ref:t=>{J.current[e.id]=t},children:(0,O.jsx)(z,{workflow:e,inputsState:P[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:I.ref,onRefChange:e=>{B(t=>t&&{...t,ref:e})},values:I.values,onValueChange:(e,t)=>{B(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:V,onDispatch:()=>{te()},onCancel:()=>{B(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:A(`runs.title`)}),M.map(e=>(0,O.jsx)(G,{tracked:e},e.tracking_key)),$.map(e=>(0,O.jsx)(W,{run:e},e.id)),$.length===0&&M.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:A(`runs.empty`)})]})]})]})})};export{q as GitHubActionsDialog};
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{B as t,C as n,D as r,E as i,F as a,I as o,L as s,M as c,N as l,O as u,R as d,T as f,W as p,_ as m,b as h,c as g,d as _,f as v,j as y,l as b,r as x,s as S,u as C,w,y as T,z as E}from"./index-BzDXl4AF.js";var D=e(p(),1),O=E(),k=`https://docs.github.com/en/actions`,A=(e,t)=>g.t(`common:githubActions.${e}`,t),j=e=>A(`status.${e}`),M=e=>e?A(`conclusion.${e}`):null,N=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`,P=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`,F=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`},I=e=>e.status===`completed`?M(e.conclusion)??A(`status.completed`):j(e.status),L=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},R=({workflow:e,inputsState:t,isSelected:n,onSelect:r})=>{let i=e.state===`active`,a=t?.dispatchable??!0,o=i&&a&&!t?.isLoading,s=e.path.split(`/`).pop();return(0,O.jsxs)(`div`,{className:l(`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.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,O.jsx)(`p`,{className:`min-w-0 text-[11px] text-muted-foreground`,children:s}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,O.jsx)(S,{variant:`outline`,className:l(`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:A(i?`workflows.stateActive`:`workflows.stateDisabled`)}),(0,O.jsxs)(c,{type:`button`,variant:n?`secondary`:`outline`,size:`sm`,className:`h-8 gap-1.5 px-3 text-xs`,disabled:!o,"aria-label":A(`workflows.runAriaLabel`,{name:e.name}),title:!a&&t?A(`inputs.notDispatchable`):void 0,onClick:r,children:[t?.isLoading?(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}):(0,O.jsx)(T,{className:`h-3.5 w-3.5`}),(0,O.jsx)(`span`,{children:A(`actions.run`)})]})]})]})]})},z=({workflow:e,inputsState:t,refValue:r,onRefChange:i,values:a,onValueChange:o,isDispatching:s,onDispatch:l,onCancel:u})=>{let d=t.inputs.filter(e=>e.required&&!B(a[e.name],e)),f=t.dispatchable&&!t.isLoading&&!t.error&&r.trim()!==``&&d.length===0&&!s;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:A(`inputs.title`)}),(0,O.jsx)(`p`,{className:`mt-0.5 truncate text-sm font-medium text-foreground`,children:e.name})]}),(0,O.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":A(`actions.cancel`),onClick:u,children:(0,O.jsx)(b,{className:`h-4 w-4`})})]}),(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(n,{htmlFor:`github-actions-ref`,children:A(`inputs.refLabel`)}),(0,O.jsx)(w,{id:`github-actions-ref`,type:`text`,value:r,onChange:e=>{i(e.target.value)},placeholder:A(`inputs.refPlaceholder`),"aria-label":A(`inputs.refAriaLabel`)})]}),t.isLoading&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:A(`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:A(`inputs.notDispatchable`)}),t.inputs.map(e=>(0,O.jsx)(V,{input:e,value:a[e.name],onChange:t=>{o(e.name,t)}},e.name)),d.length>0&&(0,O.jsx)(`p`,{className:`text-xs text-rose-200`,children:A(`inputs.requiredValidationError`)}),(0,O.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,O.jsx)(c,{type:`button`,variant:`ghost`,onClick:u,disabled:s,children:A(`actions.cancel`)}),(0,O.jsxs)(c,{type:`button`,variant:`success`,onClick:l,disabled:!f,children:[s?(0,O.jsx)(h,{className:`h-4 w-4 animate-spin`}):(0,O.jsx)(T,{className:`h-4 w-4`}),(0,O.jsx)(`span`,{children:A(`actions.dispatch`)})]})]})]})},B=(e,t)=>t.type===`boolean`?typeof e==`boolean`:typeof e==`string`&&e.trim()!==``,V=({input:e,value:t,onChange:r})=>{let i=`github-actions-input-${e.name}`;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsxs)(n,{htmlFor:i,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:A(`inputs.requiredLabel`)})]}),e.description&&(0,O.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:e.description}),H(e,i,t,r)]})},H=(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)(x,{id:t,checked:i,onCheckedChange:e=>{r(e)}}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:A(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:A(`inputs.selectPlaceholder`)}),i.map(e=>(0,O.jsx)(`option`,{value:e,children:e},e))]})}return(0,O.jsx)(w,{id:t,type:`text`,value:typeof n==`string`?n:typeof e.default==`string`?e.default:``,onChange:e=>{r(e.target.value)}})},U=({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)(S,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,P(t)),children:t.status===`completed`?M(t.conclusion)??A(`status.completed`):j(t.status)}),(0,O.jsx)(`span`,{className:`truncate text-[11px] text-muted-foreground`,children:t.name})]},`${e.id}-${t.number}`))}),W=({run:e})=>{let t=F(e),n=I(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)(S,{variant:`outline`,className:l(`px-2 py-0.5 text-[10px] uppercase tracking-[0.18em]`,N(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:[A(`actions.openOnGithub`),(0,O.jsx)(C,{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)(S,{variant:`outline`,className:l(`px-2 py-0 text-[10px] uppercase tracking-[0.16em]`,N(e)),children:e.status===`completed`?M(e.conclusion)??A(`status.completed`):j(e.status)}),(0,O.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:e.name})]}),(0,O.jsx)(U,{job:e})]},e.id))]})},G=({tracked:e})=>{let t=e.state===`not_visible`?A(`runs.notVisible`):A(`runs.resolving`);return(0,O.jsxs)(`div`,{className:`flex items-center gap-2 rounded-2xl border border-border/60 bg-background/20 px-4 py-3`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin text-muted-foreground`}),(0,O.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t})]})},K=e=>({ref:e??`main`}),q=({projectId:e,defaultBranch:n,onClose:l})=>{let[p,g]=(0,D.useState)([]),[x,S]=(0,D.useState)(!0),[w,T]=(0,D.useState)(null),[E,j]=(0,D.useState)([]),[M,N]=(0,D.useState)([]),[P,F]=(0,D.useState)({}),[I,B]=(0,D.useState)(null),[V,H]=(0,D.useState)(!1),[U]=(0,D.useState)(()=>K(n)),q=(0,D.useRef)({}),J=(0,D.useRef)({}),Y=(0,D.useRef)(null),X=(0,D.useCallback)(async n=>{F(e=>{let t=e[n.id];return t?.isLoading?e:{...e,[n.id]:{inputs:t?.inputs??[],dispatchable:t?.dispatchable??!0,isLoading:!0,error:null}}});try{let t=await o(e,n.id,n.path);return F(e=>({...e,[n.id]:{inputs:t.inputs,dispatchable:t.dispatchable,isLoading:!1,error:null}})),t}catch(e){return F(r=>({...r,[n.id]:{inputs:[],dispatchable:!0,isLoading:!1,error:e instanceof t?e.message:A(`workflows.loadError`)}})),null}},[e]),Z=(0,D.useCallback)(async()=>{S(!0),T(null);try{let t=await d(e);g(t.workflows),Promise.allSettled(t.workflows.map(e=>X(e)))}catch(e){T(e instanceof t?e.message:A(`workflows.loadError`))}finally{S(!1)}},[X,e]),Q=(0,D.useCallback)(async()=>{try{j((await s(e)).runs)}catch(e){console.warn(`[github-actions] unable to load runs`,e)}},[e]);(0,D.useEffect)(()=>{Z(),Q()},[Z,Q]);let ee=(0,D.useCallback)(async e=>{if(I?.workflow.id===e.id)return;Y.current=e.id,B({workflow:e,ref:U.ref,values:{}});let t=P[e.id];if(t&&!t.isLoading&&!t.error){B(n=>!n||n.workflow.id!==e.id?n:{...n,values:L(t.inputs)});return}let n=await X(e);n&&B(t=>!t||t.workflow.id!==e.id?t:{...t,values:L(n.inputs)})},[U.ref,P,X,I]),te=(0,D.useCallback)(async()=>{if(!I)return;let n=P[I.workflow.id];if(!n||!n.dispatchable)return;H(!0);let r={};for(let e of n.inputs){let t=I.values[e.name];e.type===`boolean`?r[e.name]=typeof t==`boolean`?t:e.default===!0:typeof t==`string`&&t!==``?r[e.name]=t:typeof e.default==`string`&&e.default!==``&&(r[e.name]=e.default)}try{await a(e,I.workflow.id,{ref:I.ref,inputs:r}),m.success(A(`messages.dispatched`)),B(null),Q()}catch(e){m.error(e instanceof t?e.message:A(`messages.dispatchError`))}finally{H(!1)}},[P,Q,e,I]);(0,D.useEffect)(()=>{let t=t=>{!t||t.project_id!==e||(N(e=>{let n=e.filter(e=>e.tracking_key!==t.tracking_key);return t.run?n:[...n,t]}),t.run&&j(e=>{let n=e.findIndex(e=>e.id===t.run.id);if(n===-1)return[t.run,...e];let r=[...e];return r[n]=t.run,r}))};return _.on(`github-actions:updated`,t),()=>{_.off(`github-actions:updated`,t)}},[e]),(0,D.useEffect)(()=>{let e=I?.workflow.id;!e||Y.current!==e||(q.current[e]?.scrollIntoView({block:`nearest`}),J.current[e]?.scrollIntoView({block:`nearest`}),Y.current=null)},[I?.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)(f,{open:!0,onOpenChange:e=>{e||l()},children:(0,O.jsxs)(r,{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)(y,{className:`sr-only`,children:A(`dialog.srTitle`)}),(0,O.jsx)(u,{className:`sr-only`,children:A(`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)(v,{className:`h-5 w-5`})}),(0,O.jsx)(`div`,{children:(0,O.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:A(`dialog.title`)})})]}),(0,O.jsx)(i,{asChild:!0,children:(0,O.jsx)(c,{type:`button`,"aria-label":A(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,O.jsx)(b,{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":A(`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:A(`workflows.title`)}),(0,O.jsx)(c,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-foreground`,onClick:()=>{Z(),Q()},children:A(`actions.refresh`)})]}),x&&(0,O.jsxs)(`div`,{className:`flex items-center gap-2 px-2 text-xs text-muted-foreground`,children:[(0,O.jsx)(h,{className:`h-3.5 w-3.5 animate-spin`}),(0,O.jsx)(`span`,{children:A(`workflows.loading`)})]}),w&&(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:w}),!x&&p.length===0&&!w&&(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:A(`workflows.empty`)}),(0,O.jsx)(`p`,{className:`mt-1`,children:A(`workflows.emptyHint`)}),(0,O.jsxs)(`a`,{href:k,target:`_blank`,rel:`noreferrer`,className:`mt-2 inline-flex items-center gap-1 text-xs text-sky-200 hover:text-sky-100`,children:[A(`workflows.docsLink`),(0,O.jsx)(C,{className:`h-3 w-3`})]})]}),(0,O.jsx)(`div`,{className:`space-y-2`,children:p.map(e=>{let t=I?.workflow.id===e.id;return(0,O.jsxs)(`div`,{className:`space-y-2`,children:[(0,O.jsx)(`div`,{ref:t=>{q.current[e.id]=t},children:(0,O.jsx)(R,{workflow:e,inputsState:P[e.id]??null,isSelected:t,onSelect:()=>{ee(e)}})}),t&&I&&(0,O.jsx)(`div`,{ref:t=>{J.current[e.id]=t},children:(0,O.jsx)(z,{workflow:e,inputsState:P[e.id]??{inputs:[],dispatchable:!0,isLoading:!1,error:null},refValue:I.ref,onRefChange:e=>{B(t=>t&&{...t,ref:e})},values:I.values,onValueChange:(e,t)=>{B(n=>n&&{...n,values:{...n.values,[e]:t}})},isDispatching:V,onDispatch:()=>{te()},onCancel:()=>{B(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:A(`runs.title`)}),M.map(e=>(0,O.jsx)(G,{tracked:e},e.tracking_key)),$.map(e=>(0,O.jsx)(W,{run:e},e.id)),$.length===0&&M.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:A(`runs.empty`)})]})]})]})})};export{q as GitHubActionsDialog};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./chunk-BNv3lrIs.js";import{A as t,B as n,D as r,E as i,H as a,M as o,N as s,O as c,P as l,S as u,T as d,U as f,V as p,W as m,a as h,b as g,c as _,d as v,g as y,h as b,i as x,j as S,k as C,l as ee,m as te,n as w,o as T,p as ne,s as E,v as D,w as O,x as re,y as ie,z as k}from"./index-5Eun897r.js";var A=e(m(),1),ae=(e,t)=>f(p(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),oe=(e,t)=>f(p(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),se=(e,t={})=>f(p(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),ce=(e,t)=>f(p(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),le=e=>f(p(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),ue=e=>a(p(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),j=k(),M=256*1024,N=24,P=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),F=(e,t)=>_.t(`common:testsDialog.${e}`,t),de=(e,t)=>{let n=`${e}${t}`;return n.length<=M?n:n.slice(-M)},I=e=>e.replace(P,``),fe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=N,L=e=>{e.scrollTop=e.scrollHeight},pe=(e,t=!1)=>{L(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{L(e),t&&(r=window.requestAnimationFrame(()=>{L(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},me=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;if(typeof t.id!=`string`||typeof t.name!=`string`||typeof t.command!=`string`)return[];let n=t.runner===`vitest`||t.runner===`jest`||t.runner===`unknown`?t.runner:`auto`;return[{id:t.id,name:t.name,command:t.command,runner:n,...typeof t.cwd==`string`&&t.cwd.trim()!==``?{cwd:t.cwd}:{}}]}):[]}catch{return[]}},R=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`,he=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`},z=e=>{let t=e.split(`/`);return t[t.length-1]||e},B=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),V=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),H=(e,t)=>{let n=B(t);return n.length===0?e:e.flatMap(e=>{let t=z(e.path);if(V(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>V(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},U=e=>F(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ge=e=>e?.selection?e.selection.kind===`all`?F(`selection.allTests`):e.selection.kind===`case`?e.selection.name:z(e.selection.path):F(`selection.noRunYet`),W=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`,G=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,_e=(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,ve=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,K=({line:e,tone:t})=>(0,j.jsx)(`div`,{"data-tone":t,className:s(`whitespace-pre-wrap break-words`,G(t)),children:e===``?` `:e}),q=(0,A.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,j.jsxs)(`button`,{type:`button`,"aria-label":F(`caseRow.runAriaLabel`,{name:r}),title:r,className:s(`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,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,j.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));q.displayName=`TestCaseRow`;var J=(0,A.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:c,onRunFile:l,onToggleFile:d})=>{let f=e===`file`&&n===i.path,p=e===`case`&&n===i.path;return(0,j.jsx)(x,{open:a,onOpenChange:e=>{d(i.path,e)},children:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(T,{asChild:!0,children:(0,j.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":F(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(u,{className:s(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,j.jsx)(`button`,{type:`button`,"aria-label":F(`fileRow.runAriaLabel`,{path:i.path}),className:s(`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`,(f||p)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{l(i.path)},children:(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,j.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,j.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:z(i.path)}),(0,j.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:F(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,j.jsx)(h,{children:(0,j.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,j.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:F(`fileRow.noNamedTests`)}):(0,j.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let o=e===`case`&&n===i.path&&t===a.name;return(0,j.jsx)(q,{canRunGranular:r,filePath:i.path,isActive:o,name:a.name,onRunCase:c},a.id)})})})})]})})});J.displayName=`DiscoveryFileRow`;var ye=(0,A.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:c,fullSuiteOnlyNotice:l,isLoading:d,selectedCommandId:f,selectedCommandName:p,sessionError:m,sessionStatus:h,shouldShowCommandSelector:_,onRunCase:v,onRunFile:x,onSelectCommand:S,onToggleFile:C})=>{let[w,T]=(0,A.useState)(``),E=(0,A.useMemo)(()=>H(a,w),[a,w]),D=(0,A.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),re=B(w).length>0;return(0,j.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[_&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:F(`scope.label`)}),(0,j.jsxs)(ne,{children:[(0,j.jsx)(y,{asChild:!0,children:(0,j.jsxs)(o,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":F(`scope.selectedCommandAriaLabel`),disabled:r.length===0||h===`running`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:p??F(`scope.selectTestScope`)}),(0,j.jsx)(u,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,j.jsx)(te,{align:`start`,className:`w-72`,children:r.map(e=>(0,j.jsx)(b,{className:s(f===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{S(e.id)},children:(0,j.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),l&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:l}),(a.length>0||w.length>0)&&(0,j.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,j.jsx)(O,{type:`search`,value:w,onChange:e=>{T(e.target.value)},placeholder:F(`filter.placeholder`),"aria-label":F(`filter.ariaLabel`),className:`pr-10`}),w.length>0&&(0,j.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":F(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{T(``)},children:(0,j.jsx)(ee,{className:`size-4`})})]}),!r.length&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:F(`discovery.noCommands`)}),m&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:m}),(0,j.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,j.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[F(`discovery.fileCount`,{count:E.length}),`, `,F(`discovery.caseCount`,{count:D})]})}),d&&(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!d?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilesDetected`)}):E.length===0?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilterMatches`)}):E.map(r=>(0,j.jsx)(J,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:re||(c[r.path]??!1),onRunCase:v,onRunFile:x,onToggleFile:C},r.path))})]})]})})});ye.displayName=`DiscoveryPane`;var be=(0,A.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:c})=>{let l=(0,A.useMemo)(()=>t?I(t).replaceAll(`\r
|
|
2
|
-
|
|
3
|
-
`).replaceAll(`\r`,`
|
|
1
|
+
import{a as e}from"./chunk-BNv3lrIs.js";import{A as t,B as n,D as r,E as i,H as a,M as o,N as s,O as c,P as l,S as u,T as d,U as f,V as p,W as m,a as h,b as g,c as _,d as v,g as y,h as b,i as x,j as S,k as C,l as ee,m as te,n as w,o as T,p as ne,s as E,v as D,w as O,x as re,y as ie,z as k}from"./index-BzDXl4AF.js";var A=e(m(),1),ae=(e,t)=>f(p(`/projects/${e}/test-sessions`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to open the test runner right now.`}),oe=(e,t)=>f(p(`/tickets/${e}/test-sessions${t?`?project_id=${encodeURIComponent(t)}`:``}`),{method:`POST`,fallbackErrorMessage:`Unable to open the test runner right now.`}),se=(e,t={})=>f(p(`/test-sessions/${e}/discovery${t.commandId?`?command_id=${encodeURIComponent(t.commandId)}`:``}`),{signal:t.signal,fallbackErrorMessage:`Unable to discover tests right now.`}),ce=(e,t)=>f(p(`/test-sessions/${e}/run`),{method:`POST`,body:t,fallbackErrorMessage:`Unable to start the selected tests right now.`}),le=e=>f(p(`/test-sessions/${e}/stop`),{method:`POST`,fallbackErrorMessage:`Unable to stop the test run right now.`}),ue=e=>a(p(`/test-sessions/${e}`),{method:`DELETE`,fallbackErrorMessage:`Unable to close the test runner right now.`}),j=k(),M=256*1024,N=24,P=RegExp(`\x1B\\[[0-9;?]*[ -/]*[@-~]`,`g`),F=(e,t)=>_.t(`common:testsDialog.${e}`,t),de=(e,t)=>{let n=`${e}${t}`;return n.length<=M?n:n.slice(-M)},I=e=>e.replace(P,``),fe=e=>e.scrollHeight-e.scrollTop-e.clientHeight<=N,L=e=>{e.scrollTop=e.scrollHeight},pe=(e,t=!1)=>{L(e);let n=0,r=0;return n=window.requestAnimationFrame(()=>{L(e),t&&(r=window.requestAnimationFrame(()=>{L(e)}))}),()=>{window.cancelAnimationFrame(n),r!==0&&window.cancelAnimationFrame(r)}},me=e=>{if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.flatMap(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return[];let t=e;if(typeof t.id!=`string`||typeof t.name!=`string`||typeof t.command!=`string`)return[];let n=t.runner===`vitest`||t.runner===`jest`||t.runner===`unknown`?t.runner:`auto`;return[{id:t.id,name:t.name,command:t.command,runner:n,...typeof t.cwd==`string`&&t.cwd.trim()!==``?{cwd:t.cwd}:{}}]}):[]}catch{return[]}},R=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`,he=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`},z=e=>{let t=e.split(`/`);return t[t.length-1]||e},B=e=>e.toLowerCase().trim().split(/\s+/).filter(Boolean),V=(e,t)=>e.length===0?!0:e.every(e=>t.some(t=>t.includes(e))),H=(e,t)=>{let n=B(t);return n.length===0?e:e.flatMap(e=>{let t=z(e.path);if(V(n,[t.toLowerCase(),e.path.toLowerCase()]))return[e];let r=e.cases.filter(r=>V(n,[t.toLowerCase(),e.path.toLowerCase(),r.name.toLowerCase()]));return r.length===0?[]:[{...e,cases:r}]})},U=e=>F(e===`passed`?`status.passed`:e===`failed`?`status.failed`:e===`running`?`status.running`:e===`error`?`status.error`:e===`stopped`?`status.stopped`:`status.idle`),ge=e=>e?.selection?e.selection.kind===`all`?F(`selection.allTests`):e.selection.kind===`case`?e.selection.name:z(e.selection.path):F(`selection.noRunYet`),W=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`,G=e=>e===`failure`?`text-rose-200`:e===`success`?`text-emerald-200`:e===`warning`?`text-amber-200`:`text-slate-200`,_e=(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,ve=`min-w-24 justify-center shadow-none transition-none disabled:opacity-100`,K=({line:e,tone:t})=>(0,j.jsx)(`div`,{"data-tone":t,className:s(`whitespace-pre-wrap break-words`,G(t)),children:e===``?` `:e}),q=(0,A.memo)(({canRunGranular:e,filePath:t,isActive:n,name:r,onRunCase:i})=>(0,j.jsxs)(`button`,{type:`button`,"aria-label":F(`caseRow.runAriaLabel`,{name:r}),title:r,className:s(`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,j.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full bg-sky-300/80`}),(0,j.jsx)(`span`,{className:`truncate text-xs text-foreground`,children:r})]}));q.displayName=`TestCaseRow`;var J=(0,A.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:r,file:i,isExpanded:a,onRunCase:c,onRunFile:l,onToggleFile:d})=>{let f=e===`file`&&n===i.path,p=e===`case`&&n===i.path;return(0,j.jsx)(x,{open:a,onOpenChange:e=>{d(i.path,e)},children:(0,j.jsxs)(`div`,{className:`space-y-1`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(T,{asChild:!0,children:(0,j.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":F(a?`fileRow.collapseAriaLabel`:`fileRow.expandAriaLabel`,{path:i.path}),className:`mt-1 shrink-0 text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(u,{className:s(`h-4 w-4 transition-transform`,a&&`rotate-180`)})})}),(0,j.jsx)(`button`,{type:`button`,"aria-label":F(`fileRow.runAriaLabel`,{path:i.path}),className:s(`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`,(f||p)&&`border-sky-400/45 bg-sky-500/10`),disabled:!r,onClick:()=>{l(i.path)},children:(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,j.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,j.jsx)(w,{className:`h-3.5 w-3.5`})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-start justify-between gap-3`,children:[(0,j.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,j.jsx)(`span`,{className:`block truncate text-xs font-medium text-foreground`,children:z(i.path)}),(0,j.jsx)(`span`,{className:`mt-0.5 block truncate text-[11px] text-muted-foreground`,children:i.path})]}),(0,j.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted-foreground`,children:F(`fileRow.testCount`,{count:i.cases.length})})]})]})})]}),(0,j.jsx)(h,{children:(0,j.jsx)(`div`,{className:`ml-4 border-l border-border/60 pl-6`,children:i.cases.length===0?(0,j.jsx)(`p`,{className:`px-2.5 py-1.5 text-xs text-muted-foreground`,children:F(`fileRow.noNamedTests`)}):(0,j.jsx)(`div`,{className:`space-y-1`,children:i.cases.map(a=>{let o=e===`case`&&n===i.path&&t===a.name;return(0,j.jsx)(q,{canRunGranular:r,filePath:i.path,isActive:o,name:a.name,onRunCase:c},a.id)})})})})]})})});J.displayName=`DiscoveryFileRow`;var ye=(0,A.memo)(({activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,availableCommands:r,canRunGranular:i,discovery:a,expandedFiles:c,fullSuiteOnlyNotice:l,isLoading:d,selectedCommandId:f,selectedCommandName:p,sessionError:m,sessionStatus:h,shouldShowCommandSelector:_,onRunCase:v,onRunFile:x,onSelectCommand:S,onToggleFile:C})=>{let[w,T]=(0,A.useState)(``),E=(0,A.useMemo)(()=>H(a,w),[a,w]),D=(0,A.useMemo)(()=>E.reduce((e,t)=>e+t.cases.length,0),[E]),re=B(w).length>0;return(0,j.jsx)(`aside`,{className:`min-h-0 border-b border-border/70 px-4 py-4 lg:border-r lg:border-b-0`,children:(0,j.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col gap-3`,children:[_&&(0,j.jsxs)(`div`,{className:`space-y-2`,children:[(0,j.jsx)(`p`,{className:`text-xs uppercase tracking-[0.22em] text-muted-foreground`,children:F(`scope.label`)}),(0,j.jsxs)(ne,{children:[(0,j.jsx)(y,{asChild:!0,children:(0,j.jsxs)(o,{type:`button`,variant:`outline`,className:`w-full justify-between rounded-xl border-border/70 bg-background/60`,"aria-label":F(`scope.selectedCommandAriaLabel`),disabled:r.length===0||h===`running`,children:[(0,j.jsx)(`span`,{className:`truncate`,children:p??F(`scope.selectTestScope`)}),(0,j.jsx)(u,{className:`h-4 w-4 text-muted-foreground`})]})}),(0,j.jsx)(te,{align:`start`,className:`w-72`,children:r.map(e=>(0,j.jsx)(b,{className:s(f===e.id&&`bg-accent text-accent-foreground`),onSelect:()=>{S(e.id)},children:(0,j.jsx)(`span`,{className:`truncate`,children:e.name})},e.id))})]})]}),l&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-border/70 bg-background/30 px-4 py-3 text-sm text-muted-foreground`,children:l}),(a.length>0||w.length>0)&&(0,j.jsxs)(`div`,{className:`relative mt-1 shrink-0`,children:[(0,j.jsx)(O,{type:`search`,value:w,onChange:e=>{T(e.target.value)},placeholder:F(`filter.placeholder`),"aria-label":F(`filter.ariaLabel`),className:`pr-10`}),w.length>0&&(0,j.jsx)(o,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":F(`filter.clearAriaLabel`),className:`absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,onClick:()=>{T(``)},children:(0,j.jsx)(ee,{className:`size-4`})})]}),!r.length&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-4 text-sm text-muted-foreground`,children:F(`discovery.noCommands`)}),m&&(0,j.jsx)(`div`,{className:`rounded-2xl border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-200`,children:m}),(0,j.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,j.jsxs)(`div`,{className:`shrink-0 flex items-start justify-between gap-3`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[F(`discovery.fileCount`,{count:E.length}),`, `,F(`discovery.caseCount`,{count:D})]})}),d&&(0,j.jsx)(g,{className:`h-4 w-4 animate-spin text-muted-foreground`})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 space-y-2 overflow-y-auto pr-1`,children:a.length===0&&!d?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilesDetected`)}):E.length===0?(0,j.jsx)(`div`,{className:`rounded-2xl border border-dashed border-border/70 bg-background/20 px-4 py-5 text-sm text-muted-foreground`,children:F(`discovery.noFilterMatches`)}):E.map(r=>(0,j.jsx)(J,{activeSelectionKind:e,activeSelectionName:t,activeSelectionPath:n,canRunGranular:i,file:r,isExpanded:re||(c[r.path]??!1),onRunCase:v,onRunFile:x,onToggleFile:C},r.path))})]})]})})});ye.displayName=`DiscoveryPane`;var be=(0,A.memo)(({durationMs:e,output:t,outputTruncated:n,selectionLabel:r,status:i,summaryCounts:a,viewportRef:o,onScroll:c})=>{let l=(0,A.useMemo)(()=>t?I(t).replace(/\r\n/g,`
|
|
2
|
+
`).replace(/\r/g,`
|
|
4
3
|
`).split(`
|
|
5
|
-
`).map(e=>({line:e,tone:W(e)})):[],[t]);return(0,j.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,j.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,j.jsx)(E,{variant:`outline`,className:s(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,R(i)),children:U(i)}),a&&(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,j.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,j.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:he(e)}),n&&(0,j.jsx)(E,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:F(`output.trimmed`)})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,j.jsx)(`div`,{ref:o,"aria-label":F(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:c,children:(0,j.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:l.length>0?l.map((e,t)=>(0,j.jsx)(K,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,j.jsx)(`div`,{className:`text-slate-200`,children:F(`output.empty`)})})})})]})})});be.displayName=`OutputPane`;var xe=({testCommands:e,onClose:a,...s})=>{let u=s.scope,f=s.projectId,p=s.scope===`ticket`?s.ticketId:null,m=s.scope===`project`?s.targetKind:null,h=s.scope===`project`?s.targetBundleId:null,[g,_]=(0,A.useState)(e),[y,b]=(0,A.useState)(null),[x,te]=(0,A.useState)([]),[w,T]=(0,A.useState)(``),[ne,E]=(0,A.useState)({}),[O,k]=(0,A.useState)(!0),[M,N]=(0,A.useState)(!1),[P,I]=(0,A.useState)(!1),[L,R]=(0,A.useState)(null),[he,z]=(0,A.useState)(!1),[B,V]=(0,A.useState)(!1),H=(0,A.useRef)(null),U=(0,A.useRef)(!1),W=(0,A.useRef)(null),G=(0,A.useRef)(!0),K=(0,A.useRef)(null),q=(0,A.useRef)(null),J=y?.selection?.kind??null,xe=y?.selection?.kind===`all`?null:y?.selection?.path??null,Se=y?.selection?.kind===`case`?y.selection.name:null,Y=y?.id??null,X=y?.status??null,Z=(0,A.useMemo)(()=>g.find(e=>e.id===w)??null,[g,w]),Ce=(0,A.useMemo)(()=>{if(y?.summary?.failed_count==null&&y?.summary?.passed_count==null&&y?.summary?.failed_file_count==null&&y?.summary?.passed_file_count==null)return null;let e=y?.summary?.failed_count==null&&y?.summary?.passed_count==null;return{failed:X===`failed`&&y?.summary?.failed_count==null&&y?.summary?.failed_file_count!=null||e?{count:y?.summary?.failed_file_count??0,label:F(`summaryCounts.filesFailed`)}:{count:y?.summary?.failed_count??0,label:F(`summaryCounts.failed`)},passed:e?{count:y?.summary?.passed_file_count??0,label:F(`summaryCounts.filesPassed`)}:{count:y?.summary?.passed_count??y?.summary?.passed_file_count??0,label:F(`summaryCounts.passed`)}}},[y?.summary?.failed_count,y?.summary?.passed_count,y?.summary?.failed_file_count,y?.summary?.passed_file_count,X]),we=Z?.runner===`unknown`?F(`scope.fullSuiteOnlyNotice`):null,Te=!!(Z&&y?.status!==`running`&&!M&&!P),Ee=Te,De=Te&&B,Oe=g.length>1;(0,A.useEffect)(()=>{w||g.length===0||T(g[0]?.id??``)},[g,w]),(0,A.useEffect)(()=>{e.length>0&&_(t=>_e(t,e)?t:e)},[e]),(0,A.useEffect)(()=>{if(g.length>0||!f)return;let e=new AbortController;return l(e.signal).then(e=>{let t=e.find(e=>e.id===f);t&&_(e=>{let n=me(t.test_commands);return _e(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[g.length,f]),(0,A.useEffect)(()=>{let e=e=>{!e||e.id!==H.current||b(e)},t=e=>{!e||e.session_id!==H.current||b(t=>!t||t.id!==e.session_id?t:{...t,output:de(t.output,e.chunk),output_truncated:e.output_truncated})};return v.on(`test-session:updated`,e),v.on(`test-session:output`,t),()=>{v.off(`test-session:updated`,e),v.off(`test-session:output`,t)}},[]),(0,A.useEffect)(()=>{let e=W.current;if(!e){K.current=y?.output??null,q.current=y?.status??null;return}let t=K.current!==(y?.output??null),n=q.current!==`running`&&y?.status===`running`,r=q.current===`running`&&y?.status!==`running`;if(n&&(G.current=!0),n||t&&y?.status===`running`&&G.current||r&&G.current){let t=pe(e,r);return K.current=y?.output??null,q.current=y?.status??null,t}K.current=y?.output??null,q.current=y?.status??null},[y?.output,y?.status]),(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t
|
|
4
|
+
`).map(e=>({line:e,tone:W(e)})):[],[t]);return(0,j.jsx)(`section`,{className:`min-h-0 px-4 py-4`,children:(0,j.jsxs)(`div`,{className:`flex h-full flex-col gap-3`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,j.jsx)(`span`,{className:`font-medium text-foreground`,children:r}),i&&(0,j.jsx)(E,{variant:`outline`,className:s(`px-3 py-1 text-xs uppercase tracking-[0.2em]`,R(i)),children:U(i)}),a&&(0,j.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-xs font-medium uppercase tracking-[0.18em]`,children:[(0,j.jsxs)(`span`,{className:`text-rose-200`,children:[a.failed.count,` `,a.failed.label]}),(0,j.jsxs)(`span`,{className:`text-emerald-200`,children:[a.passed.count,` `,a.passed.label]})]}),e!=null&&(0,j.jsx)(`span`,{className:`text-muted-foreground`,children:he(e)}),n&&(0,j.jsx)(E,{variant:`outline`,className:`border-amber-400/30 bg-amber-500/10 text-amber-200`,children:F(`output.trimmed`)})]}),(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden rounded-2xl border border-border/70 bg-[#0d1017]`,children:(0,j.jsx)(`div`,{ref:o,"aria-label":F(`output.ariaLabel`),className:`h-full overflow-auto px-4 py-4`,onScroll:c,children:(0,j.jsx)(`div`,{className:`font-mono text-xs leading-5`,children:l.length>0?l.map((e,t)=>(0,j.jsx)(K,{line:e.line,tone:e.tone},`${t}:${e.line}`)):(0,j.jsx)(`div`,{className:`text-slate-200`,children:F(`output.empty`)})})})})]})})});be.displayName=`OutputPane`;var xe=({testCommands:e,onClose:a,...s})=>{let u=s.scope,f=s.projectId,p=s.scope===`ticket`?s.ticketId:null,m=s.scope===`project`?s.targetKind:null,h=s.scope===`project`?s.targetBundleId:null,[g,_]=(0,A.useState)(e),[y,b]=(0,A.useState)(null),[x,te]=(0,A.useState)([]),[w,T]=(0,A.useState)(``),[ne,E]=(0,A.useState)({}),[O,k]=(0,A.useState)(!0),[M,N]=(0,A.useState)(!1),[P,I]=(0,A.useState)(!1),[L,R]=(0,A.useState)(null),[he,z]=(0,A.useState)(!1),[B,V]=(0,A.useState)(!1),H=(0,A.useRef)(null),U=(0,A.useRef)(!1),W=(0,A.useRef)(null),G=(0,A.useRef)(!0),K=(0,A.useRef)(null),q=(0,A.useRef)(null),J=y?.selection?.kind??null,xe=y?.selection?.kind===`all`?null:y?.selection?.path??null,Se=y?.selection?.kind===`case`?y.selection.name:null,Y=y?.id??null,X=y?.status??null,Z=(0,A.useMemo)(()=>g.find(e=>e.id===w)??null,[g,w]),Ce=(0,A.useMemo)(()=>{if(y?.summary?.failed_count==null&&y?.summary?.passed_count==null&&y?.summary?.failed_file_count==null&&y?.summary?.passed_file_count==null)return null;let e=y?.summary?.failed_count==null&&y?.summary?.passed_count==null;return{failed:X===`failed`&&y?.summary?.failed_count==null&&y?.summary?.failed_file_count!=null||e?{count:y?.summary?.failed_file_count??0,label:F(`summaryCounts.filesFailed`)}:{count:y?.summary?.failed_count??0,label:F(`summaryCounts.failed`)},passed:e?{count:y?.summary?.passed_file_count??0,label:F(`summaryCounts.filesPassed`)}:{count:y?.summary?.passed_count??y?.summary?.passed_file_count??0,label:F(`summaryCounts.passed`)}}},[y?.summary?.failed_count,y?.summary?.passed_count,y?.summary?.failed_file_count,y?.summary?.passed_file_count,X]),we=Z?.runner===`unknown`?F(`scope.fullSuiteOnlyNotice`):null,Te=!!(Z&&y?.status!==`running`&&!M&&!P),Ee=Te,De=Te&&B,Oe=g.length>1;(0,A.useEffect)(()=>{w||g.length===0||T(g[0]?.id??``)},[g,w]),(0,A.useEffect)(()=>{e.length>0&&_(t=>_e(t,e)?t:e)},[e]),(0,A.useEffect)(()=>{if(g.length>0||!f)return;let e=new AbortController;return l(e.signal).then(e=>{let t=e.find(e=>e.id===f);t&&_(e=>{let n=me(t.test_commands??null);return _e(e,n)?e:n})}).catch(()=>{}),()=>{e.abort()}},[g.length,f]),(0,A.useEffect)(()=>{let e=e=>{!e||e.id!==H.current||b(e)},t=e=>{!e||e.session_id!==H.current||b(t=>!t||t.id!==e.session_id?t:{...t,output:de(t.output,e.chunk),output_truncated:e.output_truncated})};return v.on(`test-session:updated`,e),v.on(`test-session:output`,t),()=>{v.off(`test-session:updated`,e),v.off(`test-session:output`,t)}},[]),(0,A.useEffect)(()=>{let e=W.current;if(!e){K.current=y?.output??null,q.current=y?.status??null;return}let t=K.current!==(y?.output??null),n=q.current!==`running`&&y?.status===`running`,r=q.current===`running`&&y?.status!==`running`;if(n&&(G.current=!0),n||t&&y?.status===`running`&&G.current||r&&G.current){let t=pe(e,r);return K.current=y?.output??null,q.current=y?.status??null,t}K.current=y?.output??null,q.current=y?.status??null},[y?.output,y?.status]),(0,A.useEffect)(()=>{let e=!1;return(async()=>{try{let t;if(u===`project`){if(!f)return;t=await ae(f,{target_kind:m??`repo_root`,target_bundle_id:h??null})}else t=await oe(p??``,f);if(e)return;H.current=t.id,b(t)}catch(t){e||R(t instanceof n?t.message:F(`messages.loadRunnerError`))}finally{!e&&H.current==null&&k(!1)}})(),()=>{e=!0}},[f,u,h,m,p]),(0,A.useEffect)(()=>{if(!y?.id){V(!1);return}if(g.length>0&&!w){V(!1);return}let e=new AbortController,t=!1;return k(!0),V(!1),se(y.id,{commandId:w||null,signal:e.signal}).then(e=>{t||(te(e.files),V(e.supports_granular_selection))}).catch(r=>{t||e.signal.aborted||R(r instanceof n?r.message:F(`messages.discoverError`))}).finally(()=>{t||k(!1)}),()=>{t=!0,e.abort()}},[g.length,w,y?.id]),(0,A.useEffect)(()=>()=>{let e=H.current;!e||U.current||(U.current=!0,ue(e).catch(()=>{}))},[]);let Q=(0,A.useCallback)(async e=>{if(!(!Y||X===`running`||!Z||M||P)){R(null),N(!0);try{b(await ce(Y,{command_id:Z.id,selection:e}))}catch(e){R(e instanceof n?e.message:F(`messages.startError`))}finally{N(!1)}}},[M,P,Z,Y,X]),ke=(0,A.useCallback)(async()=>{if(!(!Y||X!==`running`||P)){R(null),I(!0);try{b(await le(Y))}catch(e){R(e instanceof n?e.message:F(`messages.stopError`))}finally{I(!1)}}},[P,Y,X]),$=(0,A.useCallback)(()=>{let e=H.current;if(!e||U.current){a();return}U.current=!0,a(),ue(e).catch(()=>{})},[a]),Ae=(0,A.useCallback)(()=>{if(X===`running`){z(!0);return}$()},[$,X]),je=(0,A.useCallback)(()=>{let e=W.current;e&&(G.current=fe(e))},[]),Me=(0,A.useCallback)(e=>{T(e)},[]),Ne=(0,A.useCallback)((e,t)=>{E(n=>(n[e]??!1)===t?n:{...n,[e]:t})},[]),Pe=(0,A.useCallback)(e=>{Q({kind:`file`,path:e})},[Q]),Fe=(0,A.useCallback)((e,t)=>{Q({kind:`case`,path:e,name:t})},[Q]);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(d,{open:!0,onOpenChange:e=>{e||Ae()},children:(0,j.jsxs)(r,{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-7xl`,onInteractOutside:e=>e.preventDefault(),children:[(0,j.jsx)(S,{className:`sr-only`,children:F(`dialog.srTitle`)}),(0,j.jsx)(c,{className:`sr-only`,children:F(`dialog.srDescription`)}),(0,j.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-border px-6 py-4`,children:[(0,j.jsx)(`div`,{className:`min-w-0`,children:(0,j.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,j.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-2xl border border-border/70 bg-background/60 text-sky-200`,children:(0,j.jsx)(re,{className:`h-5 w-5`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`text-2xl font-semibold text-foreground`,children:F(`dialog.title`)}),(0,j.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:y?.target_label??F(`dialog.preparingTarget`)})]})]})}),(0,j.jsx)(i,{asChild:!0,children:(0,j.jsx)(o,{type:`button`,"aria-label":F(`dialog.closeAriaLabel`),variant:`ghost`,size:`icon-sm`,className:`cursor-pointer text-muted-foreground hover:text-foreground`,children:(0,j.jsx)(ee,{className:`h-4 w-4`})})})]}),(0,j.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-0 lg:grid-cols-[22rem_minmax(0,1fr)]`,children:[(0,j.jsx)(ye,{activeSelectionKind:J,activeSelectionName:Se,activeSelectionPath:xe,availableCommands:g,canRunGranular:De,discovery:x,expandedFiles:ne,fullSuiteOnlyNotice:we,isLoading:O,selectedCommandId:w,selectedCommandName:Z?.name??null,sessionError:L,sessionStatus:X,shouldShowCommandSelector:Oe,onRunCase:Fe,onRunFile:Pe,onSelectCommand:Me,onToggleFile:Ne}),(0,j.jsx)(be,{durationMs:y?.duration_ms??null,output:y?.output??``,outputTruncated:y?.output_truncated??!1,selectionLabel:ge(y),status:X,summaryCounts:Ce,viewportRef:W,onScroll:je})]}),(0,j.jsx)(C,{className:`border-t border-border/70 px-6 py-4 sm:flex-row sm:items-center sm:justify-end`,children:(0,j.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:y?.status===`running`?(0,j.jsxs)(o,{type:`button`,variant:`destructive`,className:ve,onClick:()=>{ke()},disabled:P,children:[(0,j.jsx)(D,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.stop`)})]}):(0,j.jsxs)(o,{type:`button`,variant:`success`,className:ve,disabled:!Ee,onClick:()=>{Q({kind:`all`})},children:[(0,j.jsx)(ie,{className:`h-4 w-4`}),(0,j.jsx)(`span`,{children:F(`actions.run`)})]})})})]})}),(0,j.jsx)(d,{open:he,onOpenChange:z,children:(0,j.jsxs)(r,{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,j.jsxs)(t,{children:[(0,j.jsx)(S,{className:`text-sm font-semibold uppercase tracking-widest text-muted-foreground`,children:F(`closeConfirmation.title`)}),(0,j.jsx)(c,{className:`text-sm text-foreground whitespace-pre-line`,children:F(`closeConfirmation.description`)})]}),(0,j.jsxs)(C,{className:`sm:flex-row sm:justify-end`,children:[(0,j.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>z(!1),children:F(`closeConfirmation.keepRunning`)}),(0,j.jsx)(o,{type:`button`,variant:`destructive`,onClick:()=>{z(!1),$()},children:F(`closeConfirmation.stopAndClose`)})]})]})})]})};export{xe as TestsDialog};
|