cezarion 0.19.0-dev.8751 → 0.19.0-dev.8762

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.
Files changed (53) hide show
  1. package/package.json +3 -3
  2. package/web/dist/assets/{accounts-section-BJPI6m7z.js → accounts-section-DhS7blSK.js} +1 -1
  3. package/web/dist/assets/activity-motion-aJkLHTxc.js +1 -0
  4. package/web/dist/assets/{activity-route-42fC7Mxs.js → activity-route-D2sff_BA.js} +1 -1
  5. package/web/dist/assets/{agent-config-section-C74gGUgR.js → agent-config-section-C7SMwOgZ.js} +1 -1
  6. package/web/dist/assets/{agent-defaults-section-lpKgMMNk.js → agent-defaults-section-CvMgsSLY.js} +1 -1
  7. package/web/dist/assets/{appearance-NUe0p0BF.js → appearance-44RH8bum.js} +1 -1
  8. package/web/dist/assets/{automations-route-B-f1XBAk.js → automations-route-CygHw9Ni.js} +1 -1
  9. package/web/dist/assets/{commit-list-U-OxWHN-.js → commit-list-Djmz3j1l.js} +1 -1
  10. package/web/dist/assets/{diff-DZWO3IkH.js → diff-ByLut7n4.js} +2 -2
  11. package/web/dist/assets/{diff-controls-CSkIE9yB.js → diff-controls-BEVRwCau.js} +1 -1
  12. package/web/dist/assets/{diff-view-Zt6DGbX2.js → diff-view-kvjafBI7.js} +1 -1
  13. package/web/dist/assets/{file-preview-DKpgJH2C.js → file-preview-Ce0Jsxbm.js} +1 -1
  14. package/web/dist/assets/{git-toolbar-DLTYN21M.js → git-toolbar-Cn1ASnMZ.js} +1 -1
  15. package/web/dist/assets/{github-Cn5ODryx.js → github-CxYmUkO9.js} +1 -1
  16. package/web/dist/assets/{global-activity-route-5usGSS4S.js → global-activity-route-ALFcEqug.js} +2 -2
  17. package/web/dist/assets/{index-BEnkhnIC.js → index-BZr8Y74X.js} +4 -4
  18. package/web/dist/assets/index-D9L-uSh4.css +1 -0
  19. package/web/dist/assets/{markdown-B2ioG8t9.js → markdown-BRNtAZkY.js} +1 -1
  20. package/web/dist/assets/{notifications-section-1cYsj6Kt.js → notifications-section-C_IsaiyD.js} +1 -1
  21. package/web/dist/assets/{preview-pane-connected-B1k-xMeW.js → preview-pane-connected-DzajVDzR.js} +2 -2
  22. package/web/dist/assets/{projects-section-B9MczGec.js → projects-section-Cme2qWcF.js} +1 -1
  23. package/web/dist/assets/{prompt-templates-section-B6B3YiYG.js → prompt-templates-section-DVr3aKc-.js} +1 -1
  24. package/web/dist/assets/{remote-settings-notice-CNoeqtGO.js → remote-settings-notice-BFeWL9QB.js} +1 -1
  25. package/web/dist/assets/{repo-git-DfuenTj0.js → repo-git-C3YNr0yL.js} +1 -1
  26. package/web/dist/assets/{report-reader-CfpyZKZF.js → report-reader-Bm0J3ujk.js} +1 -1
  27. package/web/dist/assets/{reports-HWxwI40r.js → reports-CNL2zChD.js} +1 -1
  28. package/web/dist/assets/{resources-section-EsUWF8Gp.js → resources-section-BymE7-3T.js} +1 -1
  29. package/web/dist/assets/{review-panel-my4q8xfO.js → review-panel-3oSwii0J.js} +1 -1
  30. package/web/dist/assets/{run-header-DfEfupCk.css → run-header-BXO2nM0A.css} +1 -1
  31. package/web/dist/assets/run-header-CI49Lba9.js +2 -0
  32. package/web/dist/assets/{select-BC0GRtWk.js → select-DEqrvCmQ.js} +1 -1
  33. package/web/dist/assets/{session-context-section-Cc7O57OB.js → session-context-section-oK9zU15I.js} +1 -1
  34. package/web/dist/assets/{settings-agent-picker-2VsJyFCR.js → settings-agent-picker-BqRDs5nQ.js} +1 -1
  35. package/web/dist/assets/{settings-shell-DoYsgDvs.js → settings-shell-11SRBczO.js} +1 -1
  36. package/web/dist/assets/{sidebar-section-CJg8mwiE.js → sidebar-section-DujeUKJ0.js} +1 -1
  37. package/web/dist/assets/{skills-BJicAwPH.js → skills-B6vquPg1.js} +1 -1
  38. package/web/dist/assets/{task-changes-59Qa1bEL.js → task-changes-t473lMAF.js} +1 -1
  39. package/web/dist/assets/{task-commits-BGtVyWPE.js → task-commits-CuXxfPY6.js} +1 -1
  40. package/web/dist/assets/{task-file-scope-CYLbdb6B.js → task-file-scope-DK1biohR.js} +1 -1
  41. package/web/dist/assets/{task-files-DKGtV-H2.js → task-files-C0zhDxod.js} +1 -1
  42. package/web/dist/assets/{task-github-item-KzGyb9nv.js → task-github-item-CFU1Rbv0.js} +1 -1
  43. package/web/dist/assets/{task-thread-DpmaZvjj.js → task-thread-1BQ5lWbM.js} +2 -2
  44. package/web/dist/assets/{task-thread-PDeU-fL6.css → task-thread-1mNL_5FP.css} +1 -1
  45. package/web/dist/assets/{thread-state-BLwfKLzD.js → thread-state-BHI3Jijs.js} +1 -1
  46. package/web/dist/assets/{use-hand-to-agent-state-Dx4mIAAl.js → use-hand-to-agent-state-BHAhGcZe.js} +1 -1
  47. package/web/dist/assets/{workflows-a73JJd3t.js → workflows-BMlXKiaH.js} +1 -1
  48. package/web/dist/assets/{workspace-tools-D1ZIqE9E.js → workspace-tools-CsrBXG_p.js} +1 -1
  49. package/web/dist/assets/{worktrees-section-CJuySRx_.js → worktrees-section-DvFx6o_A.js} +1 -1
  50. package/web/dist/index.html +2 -2
  51. package/web/dist/assets/activity-motion-C0kwg24F.js +0 -1
  52. package/web/dist/assets/index-CHtuekzK.css +0 -1
  53. package/web/dist/assets/run-header-BOp4d2LA.js +0 -2
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-CYWRnyM5.js";import{Fn as l,ft as u,nt as d}from"./toaster-B0kvcFif.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-BOp4d2LA.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-DKpgJH2C.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,S as N,Xn as P,ar as F}from"./index-BEnkhnIC.js";import{r as I}from"./markdown-B2ioG8t9.js";import{t as L}from"./task-file-scope-CYLbdb6B.js";var R=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),z=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),B=e(t(),1),V=n();function H({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,B.useContext)(I),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,B.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,V.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,V.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:`Could not load this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,V.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,V.jsx)(I.Provider,{value:g,children:(0,V.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:new Date(v.createdAt).toLocaleString()}:{}},v?.id??h.path)})}var U=new Map;function W(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var G=(0,B.createContext)(null);function K(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,B.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var q=()=>document.querySelector(`[data-slot="main"]`);function J(e,t){let n=(0,B.useRef)(null),r=f(),i=h()===`POP`?r.key:W(r.state),[a]=(0,B.useState)(()=>{let t=i?U.get(i):void 0;return t?.runId===e?t:null}),o=(0,B.useRef)(new Set(a?.folders??[])),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),u=(0,B.useRef)(a===null),d=(0,B.useCallback)(()=>{u.current&&U.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:q()?.scrollTop??0})},[r.key,e]),p=(0,B.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,B.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=q();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,B.useEffect)(()=>{d();let e=[n.current,q()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function Y({runId:e,selected:t,onSelect:n}){return(0,V.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function X({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,B.useContext)(G);return(0,B.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,V.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,V.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,V.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,V.jsx)(V.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,V.jsx)(Z,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,V.jsx)(Q,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Z({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,B.useContext)(G),[c,l]=(0,B.useState)(()=>s?.isOpen(n)??!1);return(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,V.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function Q({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?z:g;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,V.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function $(){let{id:e}=m(),t=s(e),n=K();return t.isPending?(0,V.jsx)(M,{tab:`files`}):t.isError?(0,V.jsx)(N,{tab:`files`,error:t.error}):(0,V.jsx)(L,{runId:t.data.id,children:(0,V.jsx)(te,{run:t.data},`${t.data.id}:${n}`)})}function ee(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function te({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,B.useState)(o??``);(0,B.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=ee(e.id,o,s,u),_=J(e.id,!t.isPending&&g);return(0,V.jsxs)(A,{route:`task-files`,density:ne(t.isError),flushPadding:!0,children:[(0,V.jsx)(C,{run:e,tab:`files`}),(0,V.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,V.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,V.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,V.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,V.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,V.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,V.jsx)(j,{icon:h?(0,V.jsx)(R,{}):(0,V.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,V.jsx)(G.Provider,{value:_.folders,children:(0,V.jsx)(Y,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,V.jsx)(re,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,V.jsx)(H,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,V.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ne(e){return e?`empty`:`full`}function re({artifacts:e,artifactId:t,onSelect:n}){return(0,V.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,V.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,V.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,V.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,V.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,V.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,V.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,V.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{B as i,F as a,N as o,Y as s,et as c}from"./queries-CYWRnyM5.js";import{Fn as l,ft as u,nt as d}from"./toaster-B0kvcFif.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,Y as y,ot as b,u as x}from"./design-icons-CzEoMH9c.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{t as C}from"./run-header-CI49Lba9.js";import{a as w,i as T,n as E,o as D,r as O}from"./file-preview-Ce0Jsxbm.js";import{t as k}from"./button-B7MKxYjT.js";import{c as A}from"./page-shell-7pLJMOgh.js";import{t as j}from"./centered-state-V15AR_qo.js";import{C as M,S as N,Xn as P,ar as F}from"./index-BZr8Y74X.js";import{r as I}from"./markdown-BRNtAZkY.js";import{t as L}from"./task-file-scope-DK1biohR.js";var R=S(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),z=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),B=e(t(),1),V=n();function H({runId:e,path:t,artifactId:n,worktreePath:r}){let a=i(e,n?null:t),s=o(e,n),c=n?s:a,l=(0,B.useContext)(I),p=f(),m=p.pathname.replace(/\/files\/?$/,`/report`)+p.search,h=c.data,g=(0,B.useMemo)(()=>h?.type===`file`&&h.source!==`artifact`?{runId:e,...l,basePath:h.path}:null,[h,l,e]);if(!t&&!n)return(0,V.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,V.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.isError)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:`Could not load this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:c.error.message}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});if(!h)return(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});let _=T(h.path,r,t);if(h.type!==`file`)return(0,V.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,V.jsx)(`h2`,{children:h.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,V.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:_}),(0,V.jsx)(`p`,{className:`text-sm`,children:h.reason}),(0,V.jsx)(k,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let v=h.artifact;return(0,V.jsx)(I.Provider,{value:g,children:(0,V.jsx)(E,{runId:e,entry:h,displayPath:_,documentPreview:!0,readerHref:m,className:`min-w-0 flex-1`,imageUrl:v?d(e,v.id,`image`):u(e,t),...v?{downloadUrl:d(e,v.id,`download`),snapshot:new Date(v.createdAt).toLocaleString()}:{}},v?.id??h.path)})}var U=new Map;function W(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var G=(0,B.createContext)(null);function K(){let{key:e}=f(),t=h()===`POP`,[n,r]=(0,B.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var q=()=>document.querySelector(`[data-slot="main"]`);function J(e,t){let n=(0,B.useRef)(null),r=f(),i=h()===`POP`?r.key:W(r.state),[a]=(0,B.useState)(()=>{let t=i?U.get(i):void 0;return t?.runId===e?t:null}),o=(0,B.useRef)(new Set(a?.folders??[])),s=(0,B.useRef)(new Set),[c,l]=(0,B.useState)(0),u=(0,B.useRef)(a===null),d=(0,B.useCallback)(()=>{u.current&&U.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:q()?.scrollTop??0})},[r.key,e]),p=(0,B.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,B.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=q();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,B.useEffect)(()=>{d();let e=[n.current,q()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function Y({runId:e,selected:t,onSelect:n}){return(0,V.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function X({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=c(e,t),o=(0,B.useContext)(G);return(0,B.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,V.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,V.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,V.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,V.jsx)(V.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,V.jsx)(Z,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,V.jsx)(Q,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function Z({runId:e,name:t,path:n,depth:i,selected:a,onSelect:o}){let s=(0,B.useContext)(G),[c,l]=(0,B.useState)(()=>s?.isOpen(n)??!1);return(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,V.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,V.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,V.jsx)(X,{runId:e,path:n,depth:i+1,selected:a,onSelect:o})}):null]})}function Q({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=D(t)?z:g;return(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,V.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,V.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-xs tabular-nums text-soft-foreground`,children:w(n)})]})})}function $(){let{id:e}=m(),t=s(e),n=K();return t.isPending?(0,V.jsx)(M,{tab:`files`}):t.isError?(0,V.jsx)(N,{tab:`files`,error:t.error}):(0,V.jsx)(L,{runId:t.data.id,children:(0,V.jsx)(te,{run:t.data},`${t.data.id}:${n}`)})}function ee(e,t,n,r){let a=i(e,r||n!==null?null:t),s=o(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?a:s).isPending}function te({run:e}){let t=c(e.id,``),n=a(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,B.useState)(o??``);(0,B.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof l&&t.error.status===409,g=ee(e.id,o,s,u),_=J(e.id,!t.isPending&&g);return(0,V.jsxs)(A,{route:`task-files`,density:ne(t.isError),flushPadding:!0,children:[(0,V.jsx)(C,{run:e,tab:`files`}),(0,V.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-4 pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,V.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,V.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,V.jsx)(P,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>f(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,V.jsx)(k,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-4 py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,V.jsxs)(`aside`,{ref:_.tree,"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,V.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,V.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,V.jsx)(j,{icon:h?(0,V.jsx)(R,{}):(0,V.jsx)(b,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,V.jsx)(G.Provider,{value:_.folders,children:(0,V.jsx)(Y,{runId:e.id,selected:o,onSelect:e=>m(`path`,e)})}),(0,V.jsx)(re,{artifacts:n,artifactId:s,onSelect:e=>m(`artifact`,e)})]}),u?(0,V.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):o!==null||s!==null||t.isSuccess?(0,V.jsx)(H,{runId:e.id,path:o,artifactId:s,worktreePath:e.worktreePath}):null]}),(0,V.jsx)(`p`,{className:`px-4 pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}function ne(e){return e?`empty`:`full`}function re({artifacts:e,artifactId:t,onSelect:n}){return(0,V.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),e.isPending?(0,V.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):e.isError?(0,V.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):e.data.artifacts.length===0?(0,V.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,V.jsx)(`ul`,{children:e.data.artifacts.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsxs)(`button`,{type:`button`,"data-slot":`artifact-row`,"aria-current":e.id===t?`true`:void 0,className:`group flex min-h-11 w-full items-center gap-2 rounded px-2 py-2 text-left text-xs text-foreground hover:bg-muted focus-visible:ring-2 aria-[current=true]:bg-muted aria-[current=true]:font-medium`,onClick:()=>n(e.id),children:[(0,V.jsx)(F,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 wrap-anywhere underline-offset-2 group-hover:underline`,children:e.name}),(0,V.jsx)(x,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground group-hover:text-foreground`})]})},e.id))}),(0,V.jsxs)(k,{variant:`outline`,size:`sm`,"data-action":`refresh-artifacts`,className:`mt-2 max-md:h-11 no-hover:h-11`,onClick:()=>void e.refetch(),children:[(0,V.jsx)(y,{"aria-hidden":`true`}),`Refresh published files`]})]})}export{$ as TaskFilesRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{St as n,Wt as r,Y as i,dn as a,o,r as s,xt as c,yt as l}from"./queries-CYWRnyM5.js";import{hi as u,q as d}from"./toaster-B0kvcFif.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-k18AuMR5.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-BOp4d2LA.js";import{t as y}from"./external-link-BE6y205O.js";import{l as b}from"./reference-chip-BdikRjql.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./project-router-BvBqllk2.js";import{c as C}from"./page-shell-7pLJMOgh.js";import{t as w}from"./centered-state-V15AR_qo.js";import{S as T,nr as E,x as D}from"./index-BEnkhnIC.js";import{n as O,o as k,t as A}from"./use-hand-to-agent-state-Dx4mIAAl.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),n=i(t);return n.isPending?(0,j.jsx)(D,{kind:e}):n.isError?(0,j.jsx)(T,{tab:`github-item`,error:n.error}):(0,j.jsx)(P,{run:n.data,kind:e})}function P({run:e,kind:t}){let{n:r}=f(),i=Number(r),a=c(),s=n(),u=l(),d=s.isPending||u.isPending,p=m(e,a).some(e=>e.kind===t&&e.number===i),h=o(t,i,p);return(0,j.jsxs)(C,{route:`task-github-item`,density:p?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:i}}),p?(0,j.jsx)(H,{run:e,kind:t,number:i,repoBase:a,item:h}):d?(0,j.jsx)(D,{kind:t,number:i,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${r} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(k,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let o=u(),c=a({mutationFn:e=>d(t,n,{refresh:!0}),onSuccess:(e,t)=>o.setQueryData(t,e)}),l=F(t,i),f=s(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(D,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(O,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{St as n,Wt as r,Y as i,dn as a,o,r as s,xt as c,yt as l}from"./queries-CYWRnyM5.js";import{hi as u,q as d}from"./toaster-B0kvcFif.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-k18AuMR5.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-CI49Lba9.js";import{t as y}from"./external-link-BE6y205O.js";import{l as b}from"./reference-chip-BdikRjql.js";import{t as x}from"./button-B7MKxYjT.js";import{t as S}from"./project-router-BvBqllk2.js";import{c as C}from"./page-shell-7pLJMOgh.js";import{t as w}from"./centered-state-V15AR_qo.js";import{S as T,nr as E,x as D}from"./index-BZr8Y74X.js";import{n as O,o as k,t as A}from"./use-hand-to-agent-state-BHAhGcZe.js";var j=e(),M={issue:`Issue`,pr:`Pull request`};function N({kind:e}){let{id:t}=f(),n=i(t);return n.isPending?(0,j.jsx)(D,{kind:e}):n.isError?(0,j.jsx)(T,{tab:`github-item`,error:n.error}):(0,j.jsx)(P,{run:n.data,kind:e})}function P({run:e,kind:t}){let{n:r}=f(),i=Number(r),a=c(),s=n(),u=l(),d=s.isPending||u.isPending,p=m(e,a).some(e=>e.kind===t&&e.number===i),h=o(t,i,p);return(0,j.jsxs)(C,{route:`task-github-item`,density:p?`full`:`empty`,flushPadding:!0,children:[(0,j.jsx)(v,{run:e,tab:{kind:t,number:i}}),p?(0,j.jsx)(H,{run:e,kind:t,number:i,repoBase:a,item:h}):d?(0,j.jsx)(D,{kind:t,number:i,heading:`h2`}):(0,j.jsx)(w,{icon:(0,j.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${r} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function F(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function I(e,t,n,r){return e===`pr`?n?.[t]??r:r}function L({retry:e,kind:t,number:n}){return(0,j.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(r.githubItem(t,n)),children:`Retry`})}function R({kind:e,number:t,error:n,retryButton:r}){return(0,j.jsx)(w,{icon:(0,j.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${M[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function z({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,j.jsx)(w,{icon:(0,j.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,j.jsxs)(j.Fragment,{children:[s,l&&t(l)?(0,j.jsx)(x,{asChild:!0,variant:`outline`,children:(0,j.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,j.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function B({label:e,repoBase:t}){return(0,j.jsx)(w,{icon:(0,j.jsx)(b,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${U(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function V({kind:e,item:t,labelColors:n,checks:r}){return(0,j.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,j.jsx)(k,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,j.jsx)(W,{item:t},t.url):null})})}function H({run:e,kind:t,number:n,repoBase:r,item:i}){let o=u(),c=a({mutationFn:e=>d(t,n,{refresh:!0}),onSuccess:(e,t)=>o.setQueryData(t,e)}),l=F(t,i),f=s(l?[n]:[],l),p=f.data?.available?f.data.checks:void 0,m=`${M[t]} #${n}`,h=(0,j.jsx)(L,{retry:c,kind:t,number:n});if(i.isPending)return(0,j.jsx)(D,{kind:t,number:n,heading:`h2`});if(i.isError)return(0,j.jsx)(R,{kind:t,number:n,error:c.error??i.error,retryButton:h});let g=i.data;return g.available?g.item?(0,j.jsx)(V,{kind:t,item:g.item,labelColors:g.labelColors,checks:I(t,n,p,g.item.checks)}):(0,j.jsx)(B,{label:m,repoBase:r}):(0,j.jsx)(z,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function U(e){if(!e)return`this repository`;try{return new URL(e).pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`)||`this repository`}catch{return`this repository`}}function W({item:e}){let t=A();return(0,j.jsx)(O,{item:e,workflows:t.workflows.data?.workflows??[],skills:t.skillList,workflow:t.workflow,onWorkflowChange:t.setWorkflow,selectedSkills:t.selectedSkills,onSkillsChange:t.setSelectedSkills,engine:t.engine,onEngineChange:t.setEngine,queuedRunId:t.queued.get(e.url)??null,onQueued:t.onQueued},e.url)}export{N as TaskGithubItemRoute};