@wjarka/cezarion 0.18.0-dev.7675 → 0.18.0-dev.7691

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 (49) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{activity-motion-D9kDOQdA.js → activity-motion-B2qhh6Zc.js} +1 -1
  3. package/web/dist/assets/{activity-route-CZsGE2kr.js → activity-route-DDfZ9AAr.js} +1 -1
  4. package/web/dist/assets/attention-CfWn6Sw7.js +1 -0
  5. package/web/dist/assets/{cez-idle-D1rXzVuh.js → cez-idle-BZ4uUtP5.js} +1 -1
  6. package/web/dist/assets/{commit-diff-panel-BuON_M0j.js → commit-diff-panel-D66nKUdV.js} +1 -1
  7. package/web/dist/assets/{diff-Db5bcfH_.js → diff-CrMuUg5k.js} +2 -2
  8. package/web/dist/assets/{diff-view-DqlLiU5V.js → diff-view-CeOhHrrL.js} +1 -1
  9. package/web/dist/assets/{file-preview-DSnLzP2A.js → file-preview-BHVkb2MF.js} +1 -1
  10. package/web/dist/assets/{git-toolbar-WHsIb3zj.js → git-toolbar-V1O_B5gA.js} +1 -1
  11. package/web/dist/assets/{github-BZSy7bl0.js → github-_Qa7kzYX.js} +1 -1
  12. package/web/dist/assets/{global-activity-route-BPvST6Do.js → global-activity-route-DRVaNSCs.js} +1 -1
  13. package/web/dist/assets/{index-DmUnZuj2.js → index-BdxettaC.js} +5 -5
  14. package/web/dist/assets/{live-protocol-DKHlCFyG.js → live-protocol-60uiPDg6.js} +1 -1
  15. package/web/dist/assets/{live-worker-BWdeGzQX.ts → live-worker-DBw-5jVE.ts} +3 -1
  16. package/web/dist/assets/{markdown-EqokmdNx.js → markdown-ByqtNDDA.js} +1 -1
  17. package/web/dist/assets/{picker-pill-DP8YY8yK.js → picker-pill-Bmxuo6r5.js} +1 -1
  18. package/web/dist/assets/{preview-pane-connected-DePVzNAm.js → preview-pane-connected-CcK1ccWT.js} +1 -1
  19. package/web/dist/assets/{project-router-LT30LjzY.js → project-router-BLLH9tz9.js} +1 -1
  20. package/web/dist/assets/project-scope-context-CR3cozni.js +4 -0
  21. package/web/dist/assets/{prompt-template-menu-DhXONhoB.js → prompt-template-menu-Fb8KyZ2w.js} +1 -1
  22. package/web/dist/assets/{queries-DHY6U3e_.js → queries-BCXjp1_j.js} +1 -1
  23. package/web/dist/assets/{reference-chip-BKeVxG_E.js → reference-chip-1O0efJ0d.js} +1 -1
  24. package/web/dist/assets/{repo-git-CWn2Z4Un.js → repo-git-Ud4-RTPu.js} +1 -1
  25. package/web/dist/assets/{report-reader-RkXaRhiv.js → report-reader-CsUbG9Oz.js} +1 -1
  26. package/web/dist/assets/{reports-CiU1cLpn.js → reports-eG4CMqaA.js} +1 -1
  27. package/web/dist/assets/{run-header-z48y-i75.js → run-header-KFbvUkXb.js} +1 -1
  28. package/web/dist/assets/runners-D8udSrRd.js +1 -0
  29. package/web/dist/assets/{skills-BeZ9naR_.js → skills-DbnKQ7tM.js} +1 -1
  30. package/web/dist/assets/{tab-link-C_0J92TF.js → tab-link-DkArCoa9.js} +1 -1
  31. package/web/dist/assets/{task-changes-R9UrXbyp.js → task-changes-DKblejY4.js} +1 -1
  32. package/web/dist/assets/{task-commits-BgwKBJPa.js → task-commits-B-jOhTAx.js} +1 -1
  33. package/web/dist/assets/{task-files-BuoYB5UQ.js → task-files-DsrdZMK6.js} +1 -1
  34. package/web/dist/assets/{task-github-item-DQ_suCNz.js → task-github-item-DjRISRRf.js} +1 -1
  35. package/web/dist/assets/{task-thread-B7GO7yjQ.js → task-thread-Bv6iFEin.js} +1 -1
  36. package/web/dist/assets/{thread-state-DSb5VKd8.js → thread-state-CZrV-vbA.js} +1 -1
  37. package/web/dist/assets/{use-desktop-EnHXg46f.js → use-desktop-CEB_iBfH.js} +1 -1
  38. package/web/dist/assets/{use-hand-to-agent-state-C6FNQ2e0.js → use-hand-to-agent-state-8hVHQyC4.js} +1 -1
  39. package/web/dist/assets/{useInfiniteQuery-CvdGA_PU.js → useInfiniteQuery-Bh_R8jAH.js} +1 -1
  40. package/web/dist/assets/useQuery-Ct6O0RmO.js +1 -0
  41. package/web/dist/assets/{workflows-b6WsU1qg.js → workflows-BHUh4gkD.js} +1 -1
  42. package/web/dist/assets/ws-DCvFYEh3.js +1 -0
  43. package/web/dist/index.html +15 -15
  44. package/web/dist/live-worker.js +2 -2
  45. package/web/dist/assets/attention-zJ-ho5os.js +0 -1
  46. package/web/dist/assets/project-scope-context-DMCS5p-N.js +0 -4
  47. package/web/dist/assets/runners-C-sPUQye.js +0 -1
  48. package/web/dist/assets/useQuery-BJFZunTR.js +0 -1
  49. package/web/dist/assets/ws-BxsIvFCG.js +0 -1
@@ -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{E as r,t as i}from"./button-C1fD-ZFr.js";import{Gt as a,Lt as o,T as s,a as c,ei as l,g as u,nr as d,sn as f,yt as p,zt as m}from"./project-scope-context-DMCS5p-N.js";import{M as h,Yt as g,dt as _,ft as v,ot as y,t as b}from"./queries-DHY6U3e_.js";import{n as x,q as S,z as C}from"./use-desktop-EnHXg46f.js";import{n as w}from"./toaster-Cxgzn9ip.js";import{C as T,j as E}from"./design-icons-B6-0w7Aw.js";import{t as D}from"./run-header-z48y-i75.js";import{i as O,n as k,r as A}from"./git-toolbar-WHsIb3zj.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-DSwzMeY3.js";import{t as L}from"./centered-state-CiiA8Vgw.js";import{D as R,E as z,Et as B,U as V,z as H}from"./index-DmUnZuj2.js";import{t as U}from"./markdown-BBDDg-4t.js";import{t as W}from"./diff-Db5bcfH_.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?d(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):S(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?S(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=l(),[a,o]=(0,G.useState)(``),s=C(e),c=(0,G.useRef)(s);c.current=s,(0,G.useEffect)(()=>{t&&o(c.current)},[t]);let d=g({mutationFn:t=>u(e.id,t),onSuccess:t=>{w(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:b.runs.changes(e.id)}),r.invalidateQueries({queryKey:b.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,Z.jsx)(I,{open:t,onOpenChange:n,children:(0,Z.jsxs)(P,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{children:`Commit changes`}),(0,Z.jsxs)(M,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(V,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{H({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(i,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(i,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=r(),t=_(e);return t.isPending?(0,Z.jsx)(R,{tab:`changes`}):t.isError?(0,Z.jsx)(z,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=h(),n=y(),r=v(e.id,S(e)),i=x(),[u,d]=(0,G.useState)(`unified`),[f,p]=(0,G.useState)(!1),[_,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[O,j]=(0,G.useState)(!1),M=(0,G.useRef)(null),N=l(),P=()=>N.invalidateQueries({queryKey:b.runs.all}),F=e=>w(e.message,{tone:`danger`}),I=g({mutationFn:()=>a(e.id),onSuccess:e=>w(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:F}),L=g({mutationFn:()=>s(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),P()},onError:F}),R=g({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof c&&e.command){navigator.clipboard.writeText(e.command).then(()=>w(`No terminal found — command copied to clipboard.`)).catch(()=>w(`Run manually: ${e.command}`));return}F(e)}}),z=g({mutationFn:t=>o(e.id,t),onError:F}),V=r.isError&&r.error instanceof c&&r.error.status===409,H=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:j(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,G.useMemo)(()=>A(K),[K]),J=(0,G.useMemo)(()=>K.some(U),[K]),Y=i?u:`unified`,$=!i||f;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(D,{run:e,tab:`changes`}),(0,Z.jsx)(k,{bar:H,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:_,onModeChange:d,onWrapChange:p,onPreviewChange:J?C:void 0,onAction:W}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:T,selectFile:e=>{E(e),M.current?.scrollToPath(e)},diffRef:M,effectiveMode:Y,effectiveWrap:$,preview:_,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:j})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(L,{icon:t?(0,Z.jsx)(T,{size:16}):(0,Z.jsx)(E,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(L,{icon:(0,Z.jsx)(T,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:u}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(O,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>f(e,t),onOpenInApp:l?e=>u(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await p(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,t as i}from"./button-C1fD-ZFr.js";import{Gt as a,Lt as o,T as s,a as c,ei as l,g as u,nr as d,sn as f,yt as p,zt as m}from"./project-scope-context-CR3cozni.js";import{M as h,Yt as g,dt as _,ft as v,ot as y,t as b}from"./queries-BCXjp1_j.js";import{n as x,q as S,z as C}from"./use-desktop-CEB_iBfH.js";import{n as w}from"./toaster-Cxgzn9ip.js";import{C as T,j as E}from"./design-icons-B6-0w7Aw.js";import{t as D}from"./run-header-KFbvUkXb.js";import{i as O,n as k,r as A}from"./git-toolbar-V1O_B5gA.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-DSwzMeY3.js";import{t as L}from"./centered-state-CiiA8Vgw.js";import{D as R,E as z,Et as B,U as V,z as H}from"./index-BdxettaC.js";import{t as U}from"./markdown-BBDDg-4t.js";import{t as W}from"./diff-CrMuUg5k.js";var G=e(t(),1),K=`no worktree — this task ran directly in the repo working tree`;function q(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${K}`)}function J(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${K}`)}function Y(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${K}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?d(e.run)?t(`Create PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):S(e.run)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function X(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:q(e),n=e.prUrl?[q(e),J(e)]:[J(e),Y(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?S(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var Z=n();function Q({run:e,open:t,onOpenChange:n}){let r=l(),[a,o]=(0,G.useState)(``),s=C(e),c=(0,G.useRef)(s);c.current=s,(0,G.useEffect)(()=>{t&&o(c.current)},[t]);let d=g({mutationFn:t=>u(e.id,t),onSuccess:t=>{w(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:b.runs.changes(e.id)}),r.invalidateQueries({queryKey:b.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||d.isPending||d.mutate(e)};return(0,Z.jsx)(I,{open:t,onOpenChange:n,children:(0,Z.jsxs)(P,{"data-slot":`commit-dialog`,children:[(0,Z.jsxs)(N,{children:[(0,Z.jsx)(F,{children:`Commit changes`}),(0,Z.jsxs)(M,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,Z.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,Z.jsx)(V,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{H({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}}),(0,Z.jsxs)(j,{children:[(0,Z.jsx)(i,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,Z.jsx)(i,{"data-slot":`commit-confirm`,disabled:a.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function $(){let{id:e}=r(),t=_(e);return t.isPending?(0,Z.jsx)(R,{tab:`changes`}):t.isError?(0,Z.jsx)(z,{tab:`changes`,error:t.error}):(0,Z.jsx)(ee,{run:t.data})}function ee({run:e}){let t=h(),n=y(),r=v(e.id,S(e)),i=x(),[u,d]=(0,G.useState)(`unified`),[f,p]=(0,G.useState)(!1),[_,C]=(0,G.useState)(!1),[T,E]=(0,G.useState)(null),[O,j]=(0,G.useState)(!1),M=(0,G.useRef)(null),N=l(),P=()=>N.invalidateQueries({queryKey:b.runs.all}),F=e=>w(e.message,{tone:`danger`}),I=g({mutationFn:()=>a(e.id),onSuccess:e=>w(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:F}),L=g({mutationFn:()=>s(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),P()},onError:F}),R=g({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof c&&e.command){navigator.clipboard.writeText(e.command).then(()=>w(`No terminal found — command copied to clipboard.`)).catch(()=>w(`Run manually: ${e.command}`));return}F(e)}}),z=g({mutationFn:t=>o(e.id,t),onError:F}),V=r.isError&&r.error instanceof c&&r.error.status===409,H=X({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:B(e)!==void 0,prUrl:e.pullRequestUrl}),W=e=>{switch(e){case`commit`:j(!0);break;case`push`:I.mutate();break;case`create-pr`:L.mutate();break;case`open-terminal`:R.mutate();break;case`view-pr`:break}},K=r.data?.files??[],q=(0,G.useMemo)(()=>A(K),[K]),J=(0,G.useMemo)(()=>K.some(U),[K]),Y=i?u:`unified`,$=!i||f;return(0,Z.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,Z.jsx)(D,{run:e,tab:`changes`}),(0,Z.jsx)(k,{bar:H,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:Y,wrap:$,preview:_,onModeChange:d,onWrapChange:p,onPreviewChange:J?C:void 0,onAction:W}),r.data?.repointedHead?(0,Z.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,Z.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,Z.jsx)(te,{changes:r,changesRefused:V,fileCount:K.length,children:(0,Z.jsx)(ne,{runId:e.id,files:K,tree:q,selected:T,selectFile:e=>{E(e),M.current?.scrollToPath(e)},diffRef:M,effectiveMode:Y,effectiveWrap:$,preview:_,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:z.mutate})}),(0,Z.jsx)(Q,{run:e,open:O,onOpenChange:j})]})}function te({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,Z.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,Z.jsx)(L,{icon:t?(0,Z.jsx)(T,{size:16}):(0,Z.jsx)(E,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,Z.jsx)(L,{icon:(0,Z.jsx)(T,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function ne({runId:e,files:t,tree:n,selected:r,selectFile:i,diffRef:a,effectiveMode:o,effectiveWrap:s,preview:c,localHandoff:l,onOpenInApp:u}){return(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,Z.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,Z.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,Z.jsx)(O,{root:n,selected:r,onSelect:i})]}),(0,Z.jsx)(W,{files:t,viewRef:a,mode:o,wrap:s,preview:c,loadFileText:t=>re(e,t),imageSrc:t=>f(e,t),onOpenInApp:l?e=>u(e):void 0,className:`min-w-0 flex-1`})]})}async function re(e,t){try{let n=await p(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{$ as TaskChangesRoute};
@@ -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{E as r,l as i}from"./button-C1fD-ZFr.js";import{a}from"./project-scope-context-DMCS5p-N.js";import{dt as o,ft as s,mt as c,pt as l}from"./queries-DHY6U3e_.js";import{q as u}from"./use-desktop-EnHXg46f.js";import{C as d,S as f,X as p,j as m}from"./design-icons-B6-0w7Aw.js";import{t as h}from"./run-header-z48y-i75.js";import{t as g}from"./project-router-LT30LjzY.js";import{t as _}from"./centered-state-CiiA8Vgw.js";import{D as v,E as y,s as b,tn as x}from"./index-DmUnZuj2.js";import{t as S}from"./commit-diff-panel-BuON_M0j.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:r}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(x,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[r?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:r}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:i(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:i(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:i(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:i(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=r(),t=o(e);return t.isPending?(0,w.jsx)(v,{tab:`changes`}):t.isError?(0,w.jsx)(y,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=r(),n=c(e.id,u(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:n.error instanceof a&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof a&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:l(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=s(e.id,u(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,l as i}from"./button-C1fD-ZFr.js";import{a}from"./project-scope-context-CR3cozni.js";import{dt as o,ft as s,mt as c,pt as l}from"./queries-BCXjp1_j.js";import{q as u}from"./use-desktop-CEB_iBfH.js";import{C as d,S as f,X as p,j as m}from"./design-icons-B6-0w7Aw.js";import{t as h}from"./run-header-KFbvUkXb.js";import{t as g}from"./project-router-BLLH9tz9.js";import{t as _}from"./centered-state-CiiA8Vgw.js";import{D as v,E as y,s as b,tn as x}from"./index-BdxettaC.js";import{t as S}from"./commit-diff-panel-D66nKUdV.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:r}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[f,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(x,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:i(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[r?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:r}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:f,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(g,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:i(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(m,{size:16,"aria-hidden":`true`,className:i(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:i(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:i(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=r(),t=o(e);return t.isPending?(0,w.jsx)(v,{tab:`changes`}):t.isError?(0,w.jsx)(y,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=r(),n=c(e.id,u(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(h,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:n.error instanceof a&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof a&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(m,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:l(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=s(e.id,u(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(g,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
@@ -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{C as r,D as i,E as a,T as o,l as s,t as c}from"./button-C1fD-ZFr.js";import{N as l,a as u,c as d}from"./project-scope-context-DMCS5p-N.js";import{c as f,dt as p,gt as m,u as h,x as g}from"./queries-DHY6U3e_.js";import{S as _,T as v,X as y,ot as b,u as x}from"./design-icons-B6-0w7Aw.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{f as C,t as w}from"./run-header-z48y-i75.js";import{a as T,i as E,n as D,r as O}from"./file-preview-DSnLzP2A.js";import{t as k}from"./centered-state-CiiA8Vgw.js";import{D as A,E as j,tn as M}from"./index-DmUnZuj2.js";import{r as N}from"./markdown-EqokmdNx.js";var P=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`}]]),F=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`}]]),I=e(t(),1),L=n();function R({runId:e,path:t,artifactId:n}){let i=g(e,n?null:t),a=f(e,n),o=n?a:i,s=(0,I.useContext)(N),u=r(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=o.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...s,basePath:m.path}:null,[m,s,e]);if(!t&&!n)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(o.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(o.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:o.error.message}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,t),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=r(),t=o()===`POP`,[n,i]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let a={key:e,generation:t?n.generation+1:n.generation};return i(a),a.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),i=r(),a=o()===`POP`?i.key:B(i.state),[s]=(0,I.useState)(()=>{let t=a?z.get(a):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(i.key,{runId:e,folders:new Set(c.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[i.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!t||l.current.size>0)return;n.current&&(n.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,t,u,p]),(0,I.useEffect)(()=>{p();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:n,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=m(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.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,L.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,L.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,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let o=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>o?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{o?.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+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:s(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:s(`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`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=a(),t=p(e),n=H();return t.isPending?(0,L.jsx)(A,{tab:`files`}):t.isError?(0,L.jsx)(j,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=g(e,r||n!==null?null:t),a=f(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=m(e.id,``),n=h(e.id),[r,a]=i(),o=r.get(`path`),s=r.get(`artifact`),l=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let p=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},g=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,o,s,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&p(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(M,{"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,L.jsx)(c,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.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,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:g?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>p(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===s?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>p(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(c,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),l?(0,L.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,L.jsx)(R,{runId:e.id,path:o,artifactId:s}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] 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.`})]})}export{Y 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{C as r,D as i,E as a,T as o,l as s,t as c}from"./button-C1fD-ZFr.js";import{N as l,a as u,c as d}from"./project-scope-context-CR3cozni.js";import{c as f,dt as p,gt as m,u as h,x as g}from"./queries-BCXjp1_j.js";import{S as _,T as v,X as y,ot as b,u as x}from"./design-icons-B6-0w7Aw.js";import{t as S}from"./createLucideIcon-BHp8sXmF.js";import{f as C,t as w}from"./run-header-KFbvUkXb.js";import{a as T,i as E,n as D,r as O}from"./file-preview-BHVkb2MF.js";import{t as k}from"./centered-state-CiiA8Vgw.js";import{D as A,E as j,tn as M}from"./index-BdxettaC.js";import{r as N}from"./markdown-ByqtNDDA.js";var P=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`}]]),F=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`}]]),I=e(t(),1),L=n();function R({runId:e,path:t,artifactId:n}){let i=g(e,n?null:t),a=f(e,n),o=n?a:i,s=(0,I.useContext)(N),u=r(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=o.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...s,basePath:m.path}:null,[m,s,e]);if(!t&&!n)return(0,L.jsx)(O,{runId:e,path:null,className:`min-w-0 flex-1`});if(o.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(o.isError)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:`Could not load this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:o.error.message}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});if(!m)return(0,L.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(m.type!==`file`)return(0,L.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,L.jsx)(`h2`,{children:m.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,L.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:m.path}),(0,L.jsx)(`p`,{className:`text-sm`,children:m.reason}),(0,L.jsx)(c,{variant:`outline`,onClick:()=>void o.refetch(),children:`Retry`})]});let _=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(D,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:_?d(e,_.id,`image`):l(e,t),..._?{downloadUrl:d(e,_.id,`download`),snapshot:new Date(_.createdAt).toLocaleString()}:{}},_?.id??m.path)})}var z=new Map;function B(e){let t=e?.filesRestoreKey;return typeof t==`string`&&t?t:null}var V=(0,I.createContext)(null);function H(){let{key:e}=r(),t=o()===`POP`,[n,i]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let a={key:e,generation:t?n.generation+1:n.generation};return i(a),a.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),i=r(),a=o()===`POP`?i.key:B(i.state),[s]=(0,I.useState)(()=>{let t=a?z.get(a):void 0;return t?.runId===e?t:null}),c=(0,I.useRef)(new Set(s?.folders??[])),l=(0,I.useRef)(new Set),[u,d]=(0,I.useState)(0),f=(0,I.useRef)(s===null),p=(0,I.useCallback)(()=>{f.current&&z.set(i.key,{runId:e,folders:new Set(c.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[i.key,e]),m=(0,I.useMemo)(()=>({isOpen:e=>c.current.has(e),setOpen:(e,t)=>{t?c.current.add(e):c.current.delete(e),p()},loading:(e,t)=>{s?.folders.has(e)&&(t?l.current.add(e):l.current.delete(e),d(l.current.size))}}),[s,p]);return(0,I.useEffect)(()=>{if(f.current||!s||!t||l.current.size>0)return;n.current&&(n.current.scrollTop=s.tree);let e=U();e&&(e.scrollTop=s.main),f.current=!0,p()},[s,t,u,p]),(0,I.useEffect)(()=>{p();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,p,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,p)}},[p]),{tree:n,folders:m}}function G({runId:e,selected:t,onSelect:n}){return(0,L.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function K({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=m(e,t),o=(0,I.useContext)(V);return(0,I.useEffect)(()=>{if(!(!t||!o))return o.loading(t,a.isPending),()=>o.loading(t,!1)},[o,t,a.isPending]),a.isPending?(0,L.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,L.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,L.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,L.jsx)(L.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,L.jsx)(q,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,L.jsx)(J,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function q({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let o=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>o?.isOpen(n)??!1);return(0,L.jsxs)(`li`,{children:[(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":c?`open`:`closed`,"aria-expanded":c,onClick:()=>{o?.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+r*14}px`},children:[(0,L.jsx)(x,{size:16,"aria-hidden":`true`,className:s(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),c?(0,L.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,L.jsx)(K,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function J({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,c=T(t)?F:_;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:s(`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`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,L.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,L.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:E(n)})]})})}function Y(){let{id:e}=a(),t=p(e),n=H();return t.isPending?(0,L.jsx)(A,{tab:`files`}):t.isError?(0,L.jsx)(j,{tab:`files`,error:t.error}):(0,L.jsx)(C,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=g(e,r||n!==null?null:t),a=f(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=m(e.id,``),n=h(e.id),[r,a]=i(),o=r.get(`path`),s=r.get(`artifact`),l=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let p=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),a(n)},g=t.isError&&t.error instanceof u&&t.error.status===409,_=X(e.id,o,s,l),v=W(e.id,!t.isPending&&_);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(w,{run:e,tab:`files`}),(0,L.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&p(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(y,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(M,{"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,L.jsx)(c,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,L.jsxs)(`aside`,{ref:v.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,L.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,L.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,L.jsx)(k,{icon:g?(0,L.jsx)(P,{}):(0,L.jsx)(b,{size:16}),tone:g?`neutral`:`danger`,heading:`h2`,title:g?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:v.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>p(`path`,e)})}),(0,L.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,L.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,L.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,L.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,L.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(`button`,{type:`button`,"aria-current":e.id===s?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>p(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(c,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),l?(0,L.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,L.jsx)(R,{runId:e.id,path:o,artifactId:s}):null]}),(0,L.jsx)(`p`,{className:`px-[18px] 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.`})]})}export{Y as TaskFilesRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{E as t,t as n,u as r}from"./button-C1fD-ZFr.js";import{$ as i,ei as a}from"./project-scope-context-DMCS5p-N.js";import{D as o,J as s,M as c,U as l,Yt as u,dt as d,t as f,w as p}from"./queries-DHY6U3e_.js";import{S as m,tt as h,y as g}from"./use-desktop-EnHXg46f.js";import{F as _,ot as v,p as y}from"./design-icons-B6-0w7Aw.js";import{t as b}from"./run-header-z48y-i75.js";import{u as x}from"./reference-chip-BKeVxG_E.js";import{t as S}from"./project-router-LT30LjzY.js";import{t as C}from"./centered-state-CiiA8Vgw.js";import{E as w,T,ln as E}from"./index-DmUnZuj2.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-C6FNQ2e0.js";var A=e(),j={issue:`Issue`,pr:`Pull request`};function M({kind:e}){let{id:n}=t(),r=d(n);return r.isPending?(0,A.jsx)(T,{kind:e}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:e})}function N({run:e,kind:r}){let{n:i}=t(),a=Number(i),u=l(),d=s(),f=c(),p=d.isPending||f.isPending,m=g(e,u).some(e=>e.kind===r&&e.number===a),h=o(r,a,m);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:e,tab:{kind:r,number:a}}),m?(0,A.jsx)(V,{run:e,kind:r,number:a,repoBase:u,item:h}):p?(0,A.jsx)(T,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(f.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:t,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=t===`pr`?_:y,u=m(e,a).find(e=>e.kind===`PR`==(t===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&r(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(h,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:o}){let s=a(),c=u({mutationFn:e=>i(t,n,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),l=P(t,o),d=p(l?[n]:[],l),f=d.data?.available?d.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:c,kind:t,number:n});if(o.isPending)return(0,A.jsx)(T,{kind:t,number:n,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:n,error:c.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,f,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function H(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 U({item:e}){let t=k();return(0,A.jsx)(D,{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{M as TaskGithubItemRoute};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{E as t,t as n,u as r}from"./button-C1fD-ZFr.js";import{$ as i,ei as a}from"./project-scope-context-CR3cozni.js";import{D as o,J as s,M as c,U as l,Yt as u,dt as d,t as f,w as p}from"./queries-BCXjp1_j.js";import{S as m,tt as h,y as g}from"./use-desktop-CEB_iBfH.js";import{F as _,ot as v,p as y}from"./design-icons-B6-0w7Aw.js";import{t as b}from"./run-header-KFbvUkXb.js";import{u as x}from"./reference-chip-1O0efJ0d.js";import{t as S}from"./project-router-BLLH9tz9.js";import{t as C}from"./centered-state-CiiA8Vgw.js";import{E as w,T,ln as E}from"./index-BdxettaC.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-8hVHQyC4.js";var A=e(),j={issue:`Issue`,pr:`Pull request`};function M({kind:e}){let{id:n}=t(),r=d(n);return r.isPending?(0,A.jsx)(T,{kind:e}):r.isError?(0,A.jsx)(w,{tab:`github-item`,error:r.error}):(0,A.jsx)(N,{run:r.data,kind:e})}function N({run:e,kind:r}){let{n:i}=t(),a=Number(i),u=l(),d=s(),f=c(),p=d.isPending||f.isPending,m=g(e,u).some(e=>e.kind===r&&e.number===a),h=o(r,a,m);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(b,{run:e,tab:{kind:r,number:a}}),m?(0,A.jsx)(V,{run:e,kind:r,number:a,repoBase:u,item:h}):p?(0,A.jsx)(T,{kind:r,number:a,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${i} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsx)(S,{to:`/tasks/${e.id}`,children:`Back to the session`})})})]})}function P(e,t){return e===`pr`&&t.data?.available===!0&&t.data.item!==null}function F(e,t,n,r){return e===`pr`?n?.[t]??r:r}function I({retry:e,kind:t,number:r}){return(0,A.jsx)(n,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(f.githubItem(t,r)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(v,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:t,number:i,repoBase:a,reason:o,retryError:s,retryButton:c}){let l=t===`pr`?_:y,u=m(e,a).find(e=>e.kind===`PR`==(t===`pr`)&&e.number===i)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:s?.message??o,actions:(0,A.jsxs)(A.Fragment,{children:[c,u&&r(u)?(0,A.jsx)(n,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(h,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(x,{}),tone:`neutral`,heading:`h2`,title:`${e} was not found in ${H(t)}`,subtitle:`It may have been deleted, or the number points at a different repository.`})}function B({kind:e,item:t,labelColors:n,checks:r}){return(0,A.jsx)(`div`,{className:`min-w-0 px-0.5 md:px-2`,children:(0,A.jsx)(O,{item:t,colors:n??{},checks:r,backLink:null,subNav:null,children:e===`issue`?(0,A.jsx)(U,{item:t},t.url):null})})}function V({run:e,kind:t,number:n,repoBase:r,item:o}){let s=a(),c=u({mutationFn:e=>i(t,n,{refresh:!0}),onSuccess:(e,t)=>s.setQueryData(t,e)}),l=P(t,o),d=p(l?[n]:[],l),f=d.data?.available?d.data.checks:void 0,m=`${j[t]} #${n}`,h=(0,A.jsx)(I,{retry:c,kind:t,number:n});if(o.isPending)return(0,A.jsx)(T,{kind:t,number:n,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:n,error:c.error??o.error,retryButton:h});let g=o.data;return g.available?g.item?(0,A.jsx)(B,{kind:t,item:g.item,labelColors:g.labelColors,checks:F(t,n,f,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:r}):(0,A.jsx)(R,{run:e,kind:t,number:n,repoBase:r,reason:g.reason,retryError:c.error,retryButton:h})}function H(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 U({item:e}){let t=k();return(0,A.jsx)(D,{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{M as TaskGithubItemRoute};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{C as i,E as a,N as o,l as s,p as c,t as l,u,w as d}from"./button-C1fD-ZFr.js";import{n as f}from"./live-refetch-CZb2VOyu.js";import{$n as p,Br as m,D as h,Er as g,Mn as _,P as v,T as y,Vr as b,a as x,cr as S,ei as C,f as w,ir as T,nr as E,u as D,v as ee}from"./project-scope-context-DMCS5p-N.js";import{Ct as te,Jt as O,Kt as k,M as A,P as ne,R as j,U as re,Ut as M,Y as N,Yt as P,at as F,b as ie,dt as I,ht as L,l as ae,o as R,p as z,t as B,vt as oe,yt as se}from"./queries-DHY6U3e_.js";import{$ as ce,E as le,L as ue,Y as de,Z as fe,_ as pe,b as me,et as he,l as ge,n as _e,p as V,q as ve,tt as ye,w as be,z as H}from"./use-desktop-EnHXg46f.js";import{n as U}from"./toaster-Cxgzn9ip.js";import{i as xe,s as Se,t as Ce}from"./runners-C-sPUQye.js";import{A as we,B as Te,F as Ee,K as De,X as Oe,at as ke,c as Ae,dt as je,f as Me,g as Ne,it as Pe,k as Fe,l as Ie,m as Le,n as Re,ot as ze,s as Be,u as W,ut as Ve,v as He,y as Ue,z as We}from"./design-icons-B6-0w7Aw.js";import{t as G}from"./createLucideIcon-BHp8sXmF.js";import{_ as Ge,a as Ke,c as qe,d as Je,f as Ye,g as Xe,h as Ze,i as Qe,l as $e,m as et,n as tt,o as nt,p as rt,r as it,s as at,t as ot,u as K,v as st,y as ct}from"./run-header-z48y-i75.js";import{t as lt}from"./eye-B8okNWXU.js";import{a as ut}from"./format-BNCkW110.js";import{t as dt}from"./message-square-B-MD-8rD.js";import{a as ft,c as pt,i as mt,l as ht,n as gt,o as _t,r as vt,s as yt,t as bt}from"./thread-state-DSb5VKd8.js";import{i as xt,o as St,t as Ct,u as wt}from"./reference-chip-BKeVxG_E.js";import{s as Tt,t as q}from"./project-router-LT30LjzY.js";import"./attention-zJ-ho5os.js";import{S as Et,_ as Dt,b as Ot,g as kt,n as At,r as jt,t as Mt,v as Nt,x as Pt}from"./picker-pill-DP8YY8yK.js";import{n as Ft,t as It}from"./centered-state-CiiA8Vgw.js";import{At as Lt,Ct as Rt,Dt as zt,F as Bt,G as Vt,It as Ht,Jt as Ut,K as Wt,Kt as Gt,Nt as Kt,Ot as qt,P as Jt,R as Yt,S as Xt,St as Zt,U as Qt,Xt as $t,Yt as en,Zt as tn,_ as nn,an as rn,bt as an,c as J,f as on,fn as sn,hn as cn,i as ln,jt as un,kt as dn,l as Y,n as fn,qt as pn,rn as mn,s as hn,u as X,un as gn,w as _n,wt as vn,yt as yn,z as bn}from"./index-DmUnZuj2.js";import{t as xn}from"./zoomable-image-DrDnCL4V.js";import{i as Sn,r as Cn,s as wn,t as Tn}from"./markdown-EqokmdNx.js";import{t as En}from"./report-title-D4Mbu2Er.js";var Dn=G(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),On=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),kn=G(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),An=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),jn=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Mn=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Nn=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Z=e(t(),1),Q=r(),Pn=12;function Fn({run:e}){let t=C(),n=P({mutationFn:()=>D(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:B.runs.detail(e.id)}),t.invalidateQueries({queryKey:B.runs.list()}),U(`This task will not resume itself`)},onError:e=>U(e.message,{tone:`danger`})});if(!E(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Q.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(tn,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,Q.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,Pn,`)`]}):(0,Q.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Q.jsx)(c,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function In(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ln=/^[A-Za-z0-9_./:=+,@%-]+$/;function Rn(e){return e.replaceAll(`'`,`'\\''`)}function zn(e){return e===``?`''`:Ln.test(e)?e:`\u0027${Rn(e)}\u0027`}function Bn(e){if(!In(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(zn).join(` `)}}function Vn(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Hn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Un(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Wn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Gn(e){let t=Vn(Hn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Wn(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){Wn(e[2])&&i.push({label:Un(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Un(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Wn(t)&&i.push({label:t,href:t})}return i}var Kn=(0,Z.createContext)(void 0),qn=(0,Z.createContext)(void 0);function Jn(e,t){let n=new Map;for(let r of Gn(e)){let e=Sn(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Yn(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xn({text:e,messageKey:t}){let n=(0,Z.useContext)(Cn),r=(0,Z.useContext)(qn),i=t??r;if(!n||i===void 0)return null;let a=Jn(e,n);return a.length===0?null:(0,Q.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,Q.jsx)(Zn,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Zn({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:a,href:o}=e,s=(0,Z.useContext)(Kn),l=(0,Z.useContext)(Xt);(0,Z.useLayoutEffect)(()=>l?.register(n,r),[l,n,r]);let u=ae(r,n),f=i(),p=d();if(u.isError)return(0,Q.jsx)(c,{id:Yn(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:f.pathname+f.search},children:a});let m=u.data?.artifact;if(m&&!wn(m.name))return null;let h=new URLSearchParams(f.search);h.set(`report`,n),h.set(`card`,t);let g=new URLSearchParams(f.search).has(`report`)?f.state:null,_=new URLSearchParams(f.search);_.delete(`report`),_.delete(`card`);let v=`${f.pathname}${_.size?`?${_}`:``}`,y=window.navigation,b={reportCardEntry:!0,reportReturnTo:g?.reportReturnTo??v,reportReturnKey:g?.reportReturnKey??y?.currentEntry?.key,reportScrollTop:g?.reportScrollTop},x={pathname:f.pathname,search:`?${h}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":u.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,Q.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:m?En(m):a}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(c,{id:Yn(t,n),to:x,state:b,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=b.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;p(x,{state:{...b,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${u.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qn={message:!0,reasoning:!0,tool:!0,hook:!0};function $n(e){return Object.hasOwn(Qn,e)&&Qn[e]}var er=e=>e.kind===`tool`,tr=e=>e.kind===`conversation`,nr=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,rr=(e,t,n)=>`${e} ${e===1?t:n}`;function ir(e,t){let n=[];return e>0&&n.push(rr(e,`file`,`files`)),t>0&&n.push(rr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ar(e){return`${e} earlier tool call${e===1?``:`s`}`}var or=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function sr(e){for(let t of or)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function cr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(er).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$n(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:ir(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of lr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(tr(e)){s(),c.push(e);continue}l(),er(e)&&nr(e)&&!r.has(e.id)?o.push(e):(s(),er(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function lr(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var ur=new Map,dr=(0,Z.createContext)(null);function fr(){return(0,Z.useContext)(dr)}function pr({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>ur.get(e)?.get(t),set:(t,n)=>{let r=ur.get(e)??new Map;r.set(t,n),ur.set(e,r)}}),[e]);return(0,Q.jsx)(dr.Provider,{value:n,children:t})}function mr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function hr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function gr(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function _r(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function vr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var yr=new Map;function br(e,t){yr.set(e,t)}function xr(e){return yr.get(e)}var Sr=new Map;function Cr(e,t){Sr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function wr(e){return Sr.get(e)}function Tr(e,t,n){let r=Sr.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var Er=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Dr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Or=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),kr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ar=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function $(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function jr(e){let t=$(e);return t===void 0?void 0:Er.format(t)}function Mr(e){let t=$(e);return t===void 0?void 0:Dr.format(t)}var Nr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Pr(e){let t=$(e);return t===void 0?void 0:Nr(t)}function Fr(e,t=new Date){let n=$(e);if(n===void 0)return;let r=Nr(n);return r===Nr(t)?`Today`:r===Nr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Or:kr).format(n)}function Ir(e,t){let n=$(e),r=$(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Lr({ts:e}){let t=jr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Mr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Rr({startedAt:e,completedAt:t}){let n=jr(t);if(n===void 0)return null;let r=Ir(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Q.jsx)(`time`,{dateTime:t,title:Mr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function zr({ts:e}){let t=Fr(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Ar.format(n);return(0,Q.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Q.jsx)(`time`,{dateTime:Pr(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Br={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Vr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Br[e],c=r===void 0?void 0:jr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:s(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,Q.jsxs)(`p`,{className:s(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,Q.jsx)(dt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),c===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Lr,{ts:r})})]}),(0,Q.jsx)(`div`,{className:s(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}function Hr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(e),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(),y=()=>{m(e),v(void 0),f(!0)},b=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await i?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},x=async()=>{g(!0),v(void 0);try{await a?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(Vr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,Q.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Q.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Q.jsx)(ut,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Q.jsxs)(Vr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,Q.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Nn,{className:`size-3.5`})}):null,a?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void x(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ke,{className:`size-3.5`})}):null]}):null,_?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,Q.jsx)(Tn,{breaks:!0,children:e}),n.length>0?(0,Q.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>S(e.split(`/`).pop()??``)?(0,Q.jsx)(xn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:o(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(De,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Q.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Ur=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Wr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Gr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Wr).forEach(e=>e.remove());let r=Gn(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!Wn(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Kr(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Gr(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}function qr({text:e,ts:t,messageKey:n}){let r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Kr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(Vr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Ur,children:[(0,Q.jsx)(He,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Ur,children:[(0,Q.jsx)(sn,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,Q.jsx)(`div`,{ref:r,children:(0,Q.jsx)(Tn,{breaks:!0,children:e})}),(0,Q.jsx)(Xn,{text:e,messageKey:n})]})}function Jr({note:e}){return e.icon===`handoff`?(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,Q.jsx)(rn,{className:`size-3`})}),(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:s(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function Yr({incident:e}){let t=Se().data;if(!t)return null;let n=Ce(t,e.provider);return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,Q.jsx)(q,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Xr({text:e}){let t=(0,Z.useId)();if(e.trim()===``)return null;let n=e.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{C as i,E as a,N as o,l as s,p as c,t as l,u,w as d}from"./button-C1fD-ZFr.js";import{n as f}from"./live-refetch-CZb2VOyu.js";import{$n as p,Br as m,D as h,Er as g,Mn as _,P as v,T as y,Vr as b,a as x,cr as S,ei as C,f as w,ir as T,nr as E,u as D,v as ee}from"./project-scope-context-CR3cozni.js";import{Ct as te,Jt as O,Kt as k,M as A,P as ne,R as j,U as re,Ut as M,Y as N,Yt as P,at as F,b as ie,dt as I,ht as L,l as ae,o as R,p as z,t as B,vt as oe,yt as se}from"./queries-BCXjp1_j.js";import{$ as ce,E as le,L as ue,Y as de,Z as fe,_ as pe,b as me,et as he,l as ge,n as _e,p as V,q as ve,tt as ye,w as be,z as H}from"./use-desktop-CEB_iBfH.js";import{n as U}from"./toaster-Cxgzn9ip.js";import{i as xe,s as Se,t as Ce}from"./runners-D8udSrRd.js";import{A as we,B as Te,F as Ee,K as De,X as Oe,at as ke,c as Ae,dt as je,f as Me,g as Ne,it as Pe,k as Fe,l as Ie,m as Le,n as Re,ot as ze,s as Be,u as W,ut as Ve,v as He,y as Ue,z as We}from"./design-icons-B6-0w7Aw.js";import{t as G}from"./createLucideIcon-BHp8sXmF.js";import{_ as Ge,a as Ke,c as qe,d as Je,f as Ye,g as Xe,h as Ze,i as Qe,l as $e,m as et,n as tt,o as nt,p as rt,r as it,s as at,t as ot,u as K,v as st,y as ct}from"./run-header-KFbvUkXb.js";import{t as lt}from"./eye-B8okNWXU.js";import{a as ut}from"./format-BNCkW110.js";import{t as dt}from"./message-square-B-MD-8rD.js";import{a as ft,c as pt,i as mt,l as ht,n as gt,o as _t,r as vt,s as yt,t as bt}from"./thread-state-CZrV-vbA.js";import{i as xt,o as St,t as Ct,u as wt}from"./reference-chip-1O0efJ0d.js";import{s as Tt,t as q}from"./project-router-BLLH9tz9.js";import"./attention-CfWn6Sw7.js";import{S as Et,_ as Dt,b as Ot,g as kt,n as At,r as jt,t as Mt,v as Nt,x as Pt}from"./picker-pill-Bmxuo6r5.js";import{n as Ft,t as It}from"./centered-state-CiiA8Vgw.js";import{At as Lt,Ct as Rt,Dt as zt,F as Bt,G as Vt,It as Ht,Jt as Ut,K as Wt,Kt as Gt,Nt as Kt,Ot as qt,P as Jt,R as Yt,S as Xt,St as Zt,U as Qt,Xt as $t,Yt as en,Zt as tn,_ as nn,an as rn,bt as an,c as J,f as on,fn as sn,hn as cn,i as ln,jt as un,kt as dn,l as Y,n as fn,qt as pn,rn as mn,s as hn,u as X,un as gn,w as _n,wt as vn,yt as yn,z as bn}from"./index-BdxettaC.js";import{t as xn}from"./zoomable-image-DrDnCL4V.js";import{i as Sn,r as Cn,s as wn,t as Tn}from"./markdown-ByqtNDDA.js";import{t as En}from"./report-title-D4Mbu2Er.js";var Dn=G(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),On=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),kn=G(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),An=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),jn=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Mn=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Nn=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Z=e(t(),1),Q=r(),Pn=12;function Fn({run:e}){let t=C(),n=P({mutationFn:()=>D(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:B.runs.detail(e.id)}),t.invalidateQueries({queryKey:B.runs.list()}),U(`This task will not resume itself`)},onError:e=>U(e.message,{tone:`danger`})});if(!E(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Q.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(tn,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,Q.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,Pn,`)`]}):(0,Q.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Q.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Q.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Q.jsx)(c,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function In(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Ln=/^[A-Za-z0-9_./:=+,@%-]+$/;function Rn(e){return e.replaceAll(`'`,`'\\''`)}function zn(e){return e===``?`''`:Ln.test(e)?e:`\u0027${Rn(e)}\u0027`}function Bn(e){if(!In(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(zn).join(` `)}}function Vn(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function Hn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Un(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Wn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Gn(e){let t=Vn(Hn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Wn(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){Wn(e[2])&&i.push({label:Un(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:Un(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Wn(t)&&i.push({label:t,href:t})}return i}var Kn=(0,Z.createContext)(void 0),qn=(0,Z.createContext)(void 0);function Jn(e,t){let n=new Map;for(let r of Gn(e)){let e=Sn(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Yn(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Xn({text:e,messageKey:t}){let n=(0,Z.useContext)(Cn),r=(0,Z.useContext)(qn),i=t??r;if(!n||i===void 0)return null;let a=Jn(e,n);return a.length===0?null:(0,Q.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,Q.jsx)(Zn,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Zn({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:a,href:o}=e,s=(0,Z.useContext)(Kn),l=(0,Z.useContext)(Xt);(0,Z.useLayoutEffect)(()=>l?.register(n,r),[l,n,r]);let u=ae(r,n),f=i(),p=d();if(u.isError)return(0,Q.jsx)(c,{id:Yn(t,n),"data-slot":`report-card-fallback`,to:o,state:{readerFrom:f.pathname+f.search},children:a});let m=u.data?.artifact;if(m&&!wn(m.name))return null;let h=new URLSearchParams(f.search);h.set(`report`,n),h.set(`card`,t);let g=new URLSearchParams(f.search).has(`report`)?f.state:null,_=new URLSearchParams(f.search);_.delete(`report`),_.delete(`card`);let v=`${f.pathname}${_.size?`?${_}`:``}`,y=window.navigation,b={reportCardEntry:!0,reportReturnTo:g?.reportReturnTo??v,reportReturnKey:g?.reportReturnKey??y?.currentEntry?.key,reportScrollTop:g?.reportScrollTop},x={pathname:f.pathname,search:`?${h}`,hash:new URL(o,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":u.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,Q.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:m?En(m):a}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(c,{id:Yn(t,n),to:x,state:b,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),s?.(t);let n=b.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;p(x,{state:{...b,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${u.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Qn={message:!0,reasoning:!0,tool:!0,hook:!0};function $n(e){return Object.hasOwn(Qn,e)&&Qn[e]}var er=e=>e.kind===`tool`,tr=e=>e.kind===`conversation`,nr=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,rr=(e,t,n)=>`${e} ${e===1?t:n}`;function ir(e,t){let n=[];return e>0&&n.push(rr(e,`file`,`files`)),t>0&&n.push(rr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ar(e){return`${e} earlier tool call${e===1?``:`s`}`}var or=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function sr(e){for(let t of or)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function cr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(er).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=$n(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:ir(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of lr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(tr(e)){s(),c.push(e);continue}l(),er(e)&&nr(e)&&!r.has(e.id)?o.push(e):(s(),er(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function lr(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var ur=new Map,dr=(0,Z.createContext)(null);function fr(){return(0,Z.useContext)(dr)}function pr({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>ur.get(e)?.get(t),set:(t,n)=>{let r=ur.get(e)??new Map;r.set(t,n),ur.set(e,r)}}),[e]);return(0,Q.jsx)(dr.Provider,{value:n,children:t})}function mr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function hr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function gr(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function _r(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function vr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var yr=new Map;function br(e,t){yr.set(e,t)}function xr(e){return yr.get(e)}var Sr=new Map;function Cr(e,t){Sr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function wr(e){return Sr.get(e)}function Tr(e,t,n){let r=Sr.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var Er=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Dr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Or=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),kr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ar=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function $(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function jr(e){let t=$(e);return t===void 0?void 0:Er.format(t)}function Mr(e){let t=$(e);return t===void 0?void 0:Dr.format(t)}var Nr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Pr(e){let t=$(e);return t===void 0?void 0:Nr(t)}function Fr(e,t=new Date){let n=$(e);if(n===void 0)return;let r=Nr(n);return r===Nr(t)?`Today`:r===Nr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Or:kr).format(n)}function Ir(e,t){let n=$(e),r=$(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function Lr({ts:e}){let t=jr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Mr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Rr({startedAt:e,completedAt:t}){let n=jr(t);if(n===void 0)return null;let r=Ir(e,t);return(0,Q.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,Q.jsx)(`time`,{dateTime:t,title:Mr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function zr({ts:e}){let t=Fr(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Ar.format(n);return(0,Q.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,Q.jsx)(`time`,{dateTime:Pr(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Br={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function Vr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let o=Br[e],c=r===void 0?void 0:jr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":o.speaker,className:s(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,o.classes,n),children:[(0,Q.jsxs)(`p`,{className:s(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,o.accent),children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,Q.jsx)(dt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),o.label]}),i]}),c===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Lr,{ts:r})})]}),(0,Q.jsx)(`div`,{className:s(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,o.body,`leading-[1.6]`),children:t})]})}function Hr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,Z.useState)(!1),[p,m]=(0,Z.useState)(e),[h,g]=(0,Z.useState)(!1),[_,v]=(0,Z.useState)(),y=()=>{m(e),v(void 0),f(!0)},b=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await i?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},x=async()=>{g(!0),v(void 0);try{await a?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(Vr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,Q.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),b())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Q.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Q.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void b(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,Q.jsx)(ut,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,Q.jsxs)(Vr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,Q.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(Nn,{className:`size-3.5`})}):null,a?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void x(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Q.jsx)(ke,{className:`size-3.5`})}):null]}):null,_?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,Q.jsx)(Tn,{breaks:!0,children:e}),n.length>0?(0,Q.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>S(e.split(`/`).pop()??``)?(0,Q.jsx)(xn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:o(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(De,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,Q.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Ur=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Wr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Gr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Wr).forEach(e=>e.remove());let r=Gn(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!Wn(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Kr(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=Gr(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}function qr({text:e,ts:t,messageKey:n}){let r=(0,Z.useRef)(null),[i,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(null),c=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Kr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(Vr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,Q.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Ur,children:[(0,Q.jsx)(He,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Ur,children:[(0,Q.jsx)(sn,{className:`size-3.5`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,Q.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,Q.jsx)(`div`,{ref:r,children:(0,Q.jsx)(Tn,{breaks:!0,children:e})}),(0,Q.jsx)(Xn,{text:e,messageKey:n})]})}function Jr({note:e}){return e.icon===`handoff`?(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,Q.jsx)(rn,{className:`size-3`})}),(0,Q.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,Q.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:s(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function Yr({incident:e}){let t=Se().data;if(!t)return null;let n=Ce(t,e.provider);return(0,Q.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,Q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,Q.jsx)(q,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Xr({text:e}){let t=(0,Z.useId)();if(e.trim()===``)return null;let n=e.split(`
2
2
  `,1)[0]??``,r=n.length<e.length;return(0,Q.jsxs)(J,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Q.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Q.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Q.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Q.jsx)(Tn,{inline:!0,children:n})}),r?(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Q.jsx)(X,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Q.jsx)(Y,{children:(0,Q.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Q.jsx)(Tn,{children:e})})})]})}function Zr(){return(0,Q.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,Q.jsx)(ut,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Q.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Qr={read:sn,edit:Nn,delete:ke,move:jn,search:Oe,execute:mn,think:On,fetch:gn,task:Be,plan:Te,other:je},$r=e=>e.split(`
3
3
  `).length;function ei({text:e,streaming:t}){let[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null),a=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=$r(e),c=!t&&!n&&o>12;return(0,Q.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=_r(e.currentTarget)}:void 0,className:s(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,Q.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,Q.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Q.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function ti({diffs:e}){return(0,Q.jsx)(Q.Fragment,{children:e.map((e,t)=>(0,Q.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] wrap-anywhere text-muted-foreground`,children:e.path}),(0,Q.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...ni(e.oldText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...ni(e.newText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
4
4
  `).map((e,t)=>(0,Q.jsx)(ri,{text:e},t))})]},`${e.path}:${t}`))})}function ni(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
@@ -1,4 +1,4 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{l as t,t as n}from"./button-C1fD-ZFr.js";import{Hr as r,fr as i,pr as a}from"./project-scope-context-DMCS5p-N.js";import{E as o,_ as s,f as c,g as l,h as ee,m as te}from"./live-protocol-DKHlCFyG.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{Zt as ie,fn as ae,g as oe,h as se,rn as ce}from"./index-DmUnZuj2.js";var f=u(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),p=u(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),m=e(),le={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function ue(e){let{text:t,...n}=oe(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:ae,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=ne(i.registeredAt);return(0,m.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ie,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ce,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:e,inPreview:t,action:r,onOpen:i}){let{server:a}=e,o=t&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(n,{variant:o||r.label===`View`||r.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}function g(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var _=120;function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){let t=e.replace(/\s+/g,` `).trim();return t.length>_?`${t.slice(0,_-1)}…`:t}var b=e=>e===void 0?void 0:y(e);function x(e,...t){if(v(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function S(e,...t){return b(x(e,...t))}function me(e){if(!v(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function he(e){if(!v(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)v(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function ge(e){return S(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return x(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=he(t);return e.length===1?e[0]:void 0}default:return x(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,b(T(e,t)))};let r=he(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?x(t,`path`):x(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,b(E(e,t)))}}function D(e){return x(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?x(t,`url`):x(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,b(O(e,t)))}}var k=e=>x(e,`skill`,`name`,`command`),A=e=>x(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):x(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=b(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:S(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=b(A(t)),i=S(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Se(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=S(n,`server`),t=S(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:ge(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?y(e):`Tool`,subtitle:ge(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,b(me(t))),subtitle:S(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,b(D(t))),subtitle:S(t,`path`)};case`fetch`:return ye(n,t);case`task`:return xe(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Se(e,n,t)}}function Ce(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return me(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return be(n,t);default:return}}function we(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&o.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?l:ee).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Te(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function M(e){let t=Te(e);return t&&{seq:e.seq,...t}}function Ee(e,t){let n=we(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function De(e){let t;for(let n of e)t=Ee(t,n);return t}function Oe(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function ke(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ae(e){return r.safeParse(e).data}function L(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Ve(e,t){let n=a.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:i,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:i,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=te.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=s.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Pe(e,r.requestId))}function We(e,t){let n=c.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=L(e,t.seq),a=I(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&Oe(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function kt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{l as t,t as n}from"./button-C1fD-ZFr.js";import{Hr as r,fr as i,pr as a}from"./project-scope-context-CR3cozni.js";import{D as o,_ as s,g as c,h as l,p as ee,v as te}from"./live-protocol-60uiPDg6.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as ne}from"./format-BNCkW110.js";import{t as re}from"./play-CmVAj_fu.js";import{Zt as ie,fn as ae,g as oe,h as se,rn as ce}from"./index-BdxettaC.js";var f=u(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),p=u(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),m=e(),le={registered:e=>e.server.answeredAtRegistration?{label:`Open`,run:!1}:{label:`Run and open`,run:!0},adopted:()=>({label:`Open`,run:!1}),starting:()=>({label:`Open`,run:!1}),up:()=>({label:`Open`,run:!1}),stalled:()=>({label:`View`,run:!1}),exited:()=>({label:`Start again`,run:!0}),stopped:()=>({label:`Start again`,run:!0}),unavailable:()=>void 0};function ue(e){let{text:t,...n}=oe(e),r={...n,status:t},i=le[e.state](e);return i?{...r,action:i}:r}var de={"Run and open":re,Open:d,View:ae,"Start again":f};function fe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=ue(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=ne(i.registeredAt);return(0,m.jsxs)(`div`,{"data-slot":`preview-server-card`,"data-state":e.state,className:t(`min-w-0 rounded-lg border border-border bg-card px-3.5 py-3 text-sm`,o&&`text-muted-foreground`),children:[(0,m.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,m.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,m.jsx)(p,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,m.jsx)(`span`,{children:`worktree removed`}):l?(0,m.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,m.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,m.jsx)(ie,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,m.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,m.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,m.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,m.jsx)(pe,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,m.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,m.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,m.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,m.jsx)(`span`,{children:`cwd`}),(0,m.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,m.jsx)(h,{icon:(0,m.jsx)(ce,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),children:`${s.label===`Start again`?`Starting again`:`Opening`} runs ${c} in this task's worktree, on the host.`}):null,o?(0,m.jsx)(h,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function pe({entry:e,inPreview:t,action:r,onOpen:i}){let{server:a}=e,o=t&&r!==void 0&&!r.run,s=o?`In preview`:r?.label,c=o?d:r?de[r.label]:null;return r&&s&&c?(0,m.jsxs)(n,{variant:o||r.label===`View`||r.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>i?.({port:a.port,run:r.run}),children:[(0,m.jsx)(c,{"aria-hidden":`true`}),s]}):null}function h({icon:e,children:t}){return(0,m.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,m.jsx)(`span`,{children:t})]})}function g(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var _=120;function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e){let t=e.replace(/\s+/g,` `).trim();return t.length>_?`${t.slice(0,_-1)}…`:t}var b=e=>e===void 0?void 0:y(e);function x(e,...t){if(v(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function S(e,...t){return b(x(e,...t))}function me(e){if(!v(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.join(` `)}}function he(e){if(!v(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)v(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function ge(e){return S(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function C(e,t){return t?`${e} ${t}`:e}var w=new Map([[`bash`,`execute`],[`commandexecution`,`execute`],[`edit`,`edit`],[`multiedit`,`edit`],[`write`,`edit`],[`notebookedit`,`edit`],[`filechange`,`edit`],[`read`,`read`],[`imageview`,`read`],[`glob`,`search`],[`grep`,`search`],[`webfetch`,`fetch`],[`websearch`,`fetch`],[`task`,`task`],[`agent`,`task`],[`skill`,`task`],[`spawnagent`,`task`],[`subtask`,`task`],[`todowrite`,`plan`],[`todolist`,`plan`],[`plan`,`plan`],[`taskcreate`,`plan`],[`taskupdate`,`plan`],[`tasklist`,`plan`],[`contextcompaction`,`other`],[`mcptoolcall`,`other`]]);function T(e,t){switch(e){case`notebookedit`:return x(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=he(t);return e.length===1?e[0]:void 0}default:return x(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,b(T(e,t)))};let r=he(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?x(t,`path`):x(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,b(E(e,t)))}}function D(e){return x(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?x(t,`url`):x(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,b(O(e,t)))}}var k=e=>x(e,`skill`,`name`,`command`),A=e=>x(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):x(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=b(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:S(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=b(A(t)),i=S(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${n}: ${i}`:n,subtitle:i===r?void 0:r}}function Se(e,t,n){if(t===`contextcompaction`)return{toolKind:`other`,title:`Compacted context`};if(t===`mcptoolcall`){let e=S(n,`server`),t=S(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:ge(n)}}if(t.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?y(e):`Tool`,subtitle:ge(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,b(me(t))),subtitle:S(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,b(D(t))),subtitle:S(t,`path`)};case`fetch`:return ye(n,t);case`task`:return xe(n,t);case`plan`:return{toolKind:`plan`,title:`Update plan`};default:return Se(e,n,t)}}function Ce(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return me(t);case`edit`:return T(n,t);case`read`:return E(n,t);case`search`:return D(t);case`fetch`:return O(n,t);case`task`:return be(n,t);default:return}}function we(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&o.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`||t.type===`human-ask-closed`){let n=(t.type===`human-input-delivered`?s:c).safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function Te(e){if(!(e.type!==`ask.requested`||typeof e.requestId!=`string`))return{requestId:e.requestId,questions:e.questions,...e.context===void 0?{}:{context:e.context}}}function M(e){let t=Te(e);return t&&{seq:e.seq,...t}}function Ee(e,t){let n=we(e&&{type:`ask.requested`,seq:e.seq,ts:``},t);return n===t?M(t):n===void 0?void 0:e}function De(e){let t;for(let n of e)t=Ee(t,n);return t}function Oe(e){let t=Array.isArray(e.questions)?e.questions.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&typeof e.header==`string`&&(e.options===void 0||Array.isArray(e.options))):[];if(t.length===0)return;let n=typeof e.context==`string`&&e.context!==``?e.context:void 0;return{id:e.requestId,questions:t,...n===void 0?{}:{context:n},askSeq:e.seq}}function ke(){return{turns:[],itemsById:new Map,turnSeq:0,eventSeq:0,permissions:new Map,conversationEntries:new Map,outcomesByRequest:new Map,seenInputs:new Set,previewByPort:new Map,handedOff:!1}}function N(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function P(e){return typeof e==`string`?e:void 0}function F(e){let t=typeof e==`string`?new Date(e):void 0;return!t||Number.isNaN(t.getTime())?``:` · ${t.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`})}`}function I(e){if(!(typeof e!=`string`||e===``))return Number.isFinite(new Date(e).getTime())?e:void 0}function Ae(e){return r.safeParse(e).data}function L(e,t){e.turnSeq+=1;let n={id:t===void 0?`turn-fallback-${e.turnSeq}`:`turn-seq-${t}`,entries:[],v2Items:!1};return e.turns.push(n),n}function R(e){return e.turns.at(-1)??L(e)}function z(e,t){R(e).entries.push({origin:`meta`,entry:t,firstSeq:e.eventSeq,lastSeq:e.eventSeq})}function B(e){for(let t of e.permissions.values())t.status===`pending`&&(t.status=`expired`)}function V(e,t){let n=P(e.stepId);return n===void 0?t:`${n}:${t}`}function je(e,t){t.v2Items=!0;for(let n of t.entries)n.origin===`v1`&&n.entry.kind===`tool`&&e.itemsById.delete(n.entry.id);t.entries=t.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}function Me(e,t,n,r,i){let a=n.kind===`message`&&i!==void 0?{...n,ts:i}:{...n};!t.v2Items&&a.kind!==`hook`&&je(e,t);let o=e.itemsById.get(r);if(o&&o.turn===t){o.entry.entry=a,o.entry.lastSeq=e.eventSeq;return}let s={origin:`v2`,entry:a,firstSeq:e.eventSeq,lastSeq:e.eventSeq};t.entries.push(s),e.itemsById.set(r,{turn:t,entry:s})}var H={"not-delivered":0,queued:1,delivered:2,consumed:3},Ne=[`instruction`,`resumed`,`requestId`,`relationship`,`state`,`createdAt`,`requestHash`,`deadline`];function U(e){let t={};for(let n of Ne)e[n]!==void 0&&Object.assign(t,{[n]:e[n]});return t}function W(e,t){if(t.messageKind!==`request`)return;let n=e.outcomesByRequest.get(t.messageId);n&&(t.outcome={status:n.status,...n.replyId===void 0?{}:{replyId:n.replyId},observedAt:n.observedAt})}function Pe(e,t){let n=e.conversationEntries.get(t);n&&W(e,n)}function Fe(e,t,n,r){(H[e.delivery]<H.delivered||H[n]>H[e.delivery])&&(e.delivery=n),t.text!==``&&(e.text=t.text),Object.assign(e,U(t)),r.deliveredAt!==void 0&&(e.deliveredAt=r.deliveredAt),r.consumedAt!==void 0&&(e.consumedAt=r.consumedAt),r.recordedAt!==void 0&&(n===`delivered`||e.delivery!==`delivered`)&&(e.recordedAt=r.recordedAt)}function G(e,t,n,r){let i=e.conversationEntries.get(t.id);if(i){Fe(i,t,n,r),W(e,i);return}let a={kind:`conversation`,id:`conversation-message:${t.id}`,messageId:t.id,text:t.text,senderRunId:t.senderRunId,recipientRunId:t.recipientRunId,messageKind:t.kind,delivery:n,...r,...U(t)};W(e,a),e.conversationEntries.set(t.id,a),z(e,a)}function Ie(e,t){let n=F(t.ts),r=P(t.message),i=t.notify===!1?`Stopped notifying the webhook${n}`:`${e.handedOff?`Note sent to webhook`:`Handed off to webhook`}${n}${r?` — ${r}`:``}`;e.handedOff=t.notify!==!1,z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`dim`,icon:`handoff`})}function Le(e,t){let n=typeof t.attempts==`number`?t.attempts:void 0,r=P(t.webhookName),i=`${r?`Delivery to ${r} failed`:`Webhook delivery failed`}${P(t.event)?` (${P(t.event)})`:``}${n?` after ${n} attempt${n===1?``:`s`}`:``}: ${P(t.error)??`unknown error`}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:i,tone:`danger`})}function Re(e,t){let n=P(t.webhookName)??`webhook`,r=P(t.title),i=`v1:${t.seq}`;if(t.ok===!1){z(e,{kind:`note`,id:i,text:`Report to ${n} failed: ${P(t.error)??`unknown error`}`,tone:`danger`});return}let a=`${t.dryRun===!0?`Report to ${n} (dry run, nothing sent)`:`Sent report to ${n}`}${F(t.ts)}${r?` — ${r}`:``}`;z(e,t.dryRun===!0?{kind:`note`,id:i,text:a,tone:`dim`}:{kind:`note`,id:i,text:a,tone:`dim`,icon:`handoff`})}function ze(e,t){let n=t.payload??{},r=`Webhook (dry run, nothing sent): ${P(t.event)??`delivery`}${P(n.status)?` · ${P(n.status)}`:``}`;z(e,{kind:`note`,id:`v1:${t.seq}`,text:r,tone:`dim`})}function Be(e,t){let n=i.safeParse(t.server);if(!n.success)return;let r=e.previewByPort.get(n.data.port);r&&(r.turn.entries=r.turn.entries.filter(e=>e!==r.draft));let a=R(e),o={origin:`meta`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`preview-server`,id:`preview-server:${n.data.port}`,server:n.data,state:`registered`,stateAt:t.ts}};a.entries.push(o),e.previewByPort.set(n.data.port,{turn:a,draft:o})}function Ve(e,t){let n=a.safeParse(t.state),r=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!r||r.draft.entry.kind!==`preview-server`)return;let{server:i,id:o}=r.draft.entry;r.draft.lastSeq=t.seq,r.draft.entry={kind:`preview-server`,id:o,server:i,state:n.data,stateAt:t.ts,...typeof t.exitCode==`number`?{exitCode:t.exitCode}:{},...t.reason===`user`||t.reason===`idle`?{reason:t.reason}:{}}}function He(e,t){let n=l.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:s}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:s})}function Ue(e,t){let n=te.safeParse(t);if(!n.success)return;let{outcome:r}=n.data,i=e.outcomesByRequest.get(r.requestId);i&&!(i.status===`timed-out`&&r.status===`replied-late`)||(e.outcomesByRequest.set(r.requestId,r),Pe(e,r.requestId))}function We(e,t){let n=ee.safeParse(t);if(!n.success)return;let{input:r}=n.data;if(!e.seenInputs.has(r.id)){if(e.seenInputs.add(r.id),r.conversation){G(e,{id:r.id,text:r.text,createdAt:r.createdAt,...r.conversation},`delivered`,{deliveredAt:r.deliveredAt,recordedAt:n.data.ts});return}z(e,{kind:`note`,id:`agent-input:${r.id}`,text:r.text,tone:`dim`,attribution:{source:r.source,parentRunId:r.parentRunId}})}}function Ge(e,t){let n=P(t.text)??``,r=e.pendingAsk;e.pendingAsk&&!e.pendingAsk.resolved&&(e.pendingAsk.resolved=!0,e.pendingAsk.answeredBy=`human`,n!==``&&(e.pendingAsk.answer=n),e.pendingAsk=void 0);let i=L(e,t.seq),a=I(t.ts);i.userMessage={text:n,ask:r,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[],...a===void 0?{}:{ts:a}},a!==void 0&&(i.startedAt=a)}function Ke(e,t){let n=e.turns.at(-1),r=n&&n.turnId===void 0&&!n.v2Items?n:L(e,t.seq);r.turnId=P(t.turnId),r.startedAt??=I(t.ts)}function qe(e,t){for(let n=e.turns.length-1;n>=0;--n)if(e.turns[n].turnId===t)return e.turns[n];return e.turns.at(-1)}function Je(e,t){B(e);let n=qe(e,P(t.turnId));if(!n)return;let r=I(t.ts);n.completed={stopReason:P(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{},...r===void 0?{}:{ts:r}}}var K=new Set([`message`,`reasoning`,`tool`,`hook`]),Ye=e=>K.has(e.kind);function Xe(e){if(!(!N(e)||!K.has(e.kind)))return typeof e.id==`string`&&e.id!==``?e:void 0}function q(e,t){let n=Xe(t.item);if(!n)return;let r=V(t,n.id);Me(e,e.itemsById.get(r)?.turn??R(e),n,r,t.type===`item.completed`?I(t.ts):void 0)}function Ze(e,t){let n=e.itemsById.get(V(t,P(t.itemId)??``)),r=P(t.delta)??``;if(!n||r===``||!Ye(n.entry.entry))return;let i=n.entry.entry;n.entry.lastSeq=t.seq,t.field===`output`&&i.kind===`tool`?i.output=(i.output??``)+r:t.field!==`output`&&(i.kind===`message`||i.kind===`reasoning`)&&(i.text+=r)}function Qe(e,t){let n=R(e),r=P(t.text)??``;if(r===``)return;let i=I(t.ts);n.entries.push({origin:`v1`,firstSeq:t.seq,lastSeq:t.seq,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:r,...i===void 0?{}:{ts:i}}})}var $e=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function et(e){if(!N(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!N(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:$e.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}var tt=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function nt(e,t){let n=R(e),r=P(t.tool)??`Tool`;if(n.v2Items||tt.has(r))return;let i=j(r,t.input),a=i.toolKind===`plan`?et(t.input):void 0;a!==void 0&&(n.planEntries=a);let o={kind:`tool`,id:P(t.id)??`v1:${t.seq}`,name:r,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},s={origin:`v1`,entry:o,firstSeq:t.seq,lastSeq:t.seq};n.entries.push(s),e.itemsById.set(o.id,{turn:n,entry:s})}function rt(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}function it(e,t){let n=e.itemsById.get(P(t.toolCallId)??``);if(!n||n.turn.v2Items||n.entry.origin!==`v1`)return;let r=n.entry.entry;r.kind===`tool`&&(n.entry.lastSeq=t.seq,r.status=`completed`,r.output=rt(t.result))}function J(e,t,n,r){let i=P(t.message)??``;i!==``&&z(e,{kind:`note`,id:n,text:i,tone:r})}function Y(e,t){J(e,t,`v1:${t.seq}`,t.tone===`danger`?`danger`:`dim`)}function at(e,t){J(e,t,`v1:${t.seq}`,`danger`)}function ot(e,t){J(e,t,`v2:${t.seq}`,`danger`)}function st(e,t){if(t.status!==`failed`)return;let n=P(t.error)?` — ${P(t.error)}`:``;z(e,{kind:`note`,id:`v1:${t.seq}`,text:`step ${P(t.stepId)??`?`} failed${n}`,tone:`danger`})}function ct(e,t){let n=P(t.command)??`check`,r=typeof t.exitCode==`number`?t.exitCode:-1;z(e,{kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${n}`,status:r===0?`completed`:`failed`,output:P(t.text)??``,exitCode:r})}function lt(e,t){let n=Ae(t.provider),r=P(t.authFailureId)??``;n===void 0||r.length<1||r.length>128||z(e,{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:n,authFailureId:r})}function ut(e,t){let n=P(t.url);if(n===void 0)return;let r={kind:`image`,id:`v1:${t.seq}`,url:n},i=P(t.name);i!==void 0&&(r.name=i),z(e,r)}function dt(e,t){Array.isArray(t.entries)&&(R(e).planEntries=t.entries)}function ft(e,t){B(e);let n=P(t.message);e.sessionEnded={reason:P(t.reason)??`end_turn`,...n===void 0?{}:{message:n}}}var pt=new Set([`allow_once`,`allow_always`,`reject_once`,`reject_always`]);function mt(e){return N(e)&&typeof e.id==`string`&&e.id!==``&&typeof e.label==`string`&&e.label!==``&&pt.has(e.kind)}function ht(e){if(!(!Array.isArray(e)||e.length===0||!e.every(mt)))return new Set(e.map(e=>e.id)).size===e.length?e:void 0}function gt(e,t){let n=P(t.requestId),r=P(t.title),i=ht(t.options);if(!n||!r||e.permissions.has(n)||!i)return;let a=P(t.itemId),o=P(t.details),s={kind:`permission`,id:`permission:${n}`,requestId:n,title:r,options:i.map(e=>({...e})),status:`pending`,...a===void 0?{}:{itemId:a},...o===void 0?{}:{details:o}};e.permissions.set(n,s),z(e,s)}function _t(e,t){let n=e.permissions.get(P(t.requestId)??``);if(!n||n.status!==`pending`)return;let r=P(t.optionId);r!==void 0&&n.options.some(e=>e.id===r)?(n.status=`resolved`,n.optionId=r):n.status=`expired`;let i=P(t.reason);i!==void 0&&(n.reason=i)}function vt(e,t){let n=M(t),r=n&&Oe(n);if(!r)return;let i={kind:`ask`,...r,questions:r.questions,resolved:!1};z(e,i),e.pendingAsk=i}function X(e,t){let n=e.pendingAsk;return n&&!n.resolved&&n.askSeq===t.askSeq?n:void 0}function yt(e,t){let n=X(e,t);if(!n)return;n.routedToParent=!0;let r=P(t.parentRunId);r!==void 0&&(n.parentRunId=r)}function bt(e,t){let n=X(e,t);n&&(n.routedToParent=!1)}function xt(e,t){let n=X(e,t);n&&Z(e,n,`undeliverable`)}var St=new Set([`finish`,`superseded`,`parent-stopped`,`worker-stopped`,`undeliverable`]);function Ct(e,t){let n=X(e,t);n&&St.has(t.reason)&&Z(e,n,t.reason)}function Z(e,t,n){t.resolved=!0,t.closed=n,e.pendingAsk=void 0}function wt(e,t){let n=X(e,t);if(n){if(t.source===`cezar`){Z(e,n,`undeliverable`);return}t.source===`parent`&&(n.resolved=!0,n.answeredBy=`parent`,e.pendingAsk=void 0)}}var Q=()=>{},Tt=new Map([[`handoff`,Ie],[`webhook.failed`,Le],[`webhook.dry-run`,ze],[`webhook.report`,Re],[`preview.server-registered`,Be],[`preview.server-state`,Ve],[`conversation-message`,He],[`request-outcome`,Ue],[`agent-input`,We],[`user-message`,Ge],[`turn.started`,Ke],[`turn.completed`,Je],[`item.started`,q],[`item.updated`,q],[`item.completed`,q],[`item.delta`,Ze],[`text`,Qe],[`tool-call`,nt],[`tool-result`,it],[`note`,Y],[`lifecycle`,Y],[`error`,at],[`session.error`,ot],[`step-end`,st],[`check-output`,ct],[`provider-auth-required`,lt],[`image`,ut],[`plan.updated`,dt],[`session.started`,e=>B(e)],[`session.ended`,ft],[`permission.requested`,gt],[`permission.resolved`,_t],[`ask.requested`,vt],[`worker-question-routed`,yt],[`worker-question-fallback`,bt],[`worker-question-undelivered`,xt],[`human-ask-closed`,Ct],[`human-input-delivered`,wt],[`step-start`,Q],[`token-usage`,Q],[`cost`,Q],[`turn-end`,Q],[`done`,Q],[`session`,Q]]);function Et(e,t){e.eventSeq=t.seq,Tt.get(t.type)?.(e,t)}function Dt(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function Ot(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function kt(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);if(t){let e=n.trimEnd(),t=e.lastIndexOf(`
2
2
  `)+1;/^CEZ:ASK[ \t]+.+$/.test(e.slice(t))&&(n=e.slice(0,t).trimEnd())}return n.includes(`CEZ:`)?n.split(`
3
3
  `).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
4
4
  `):n}function At(e){let t=e=>$(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function jt(e){let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add($(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has($(e.entry.text,!0).trim()))),At(e))}function Mt(e){e.userMessage&&(e.entries=e.entries.filter(({entry:e})=>!g(e,`human`)))}function Nt(e){for(let t of e.conversationEntries.values())t.messageKind!==`request`||t.outcome!==void 0||t.delivery!==`not-delivered`&&(t.state!==void 0&&t.state!==`accepted`||(t.outcome={status:`pending`}))}function Pt(e,t){let n=t||e.entries.some(({entry:e})=>e.kind===`ask`);return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.startedAt===void 0?{}:{startedAt:e.startedAt},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:$(e.text,n)}:e),itemSeqs:Ft(e.entries)}}function Ft(e){let t=new Map;for(let{entry:n,firstSeq:r,lastSeq:i}of e)t.has(n.id)||t.set(n.id,{first:r,last:i});return t}function It(e,t={}){let n=ke();for(let t of e)Et(n,t);for(let e of n.turns)e.v2Items&&jt(e),Mt(e);Nt(n);let r=n.turns.length-1;return{turns:n.turns.map((e,n)=>Pt(e,t.activeTurn===!0&&n===r)),...n.sessionEnded===void 0?{}:{sessionEnded:n.sessionEnded}}}export{De as a,g as c,f as d,kt as i,fe as l,It as n,Ce as o,Ot as r,j as s,Dt as t,p as u};
@@ -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{i as r,l as i,s as a}from"./button-C1fD-ZFr.js";import{Bn as o,Dn as s,Mn as c,Nn as l,nr as u,vr as d}from"./project-scope-context-DMCS5p-N.js";import"./queries-DHY6U3e_.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{a as ee,d as p,h as m,i as te,l as ne,m as re,n as ie,o as ae,p as h,r as oe,t as se,u as g}from"./es2015-Ch36azR0.js";import{_ as ce,b as le,v as ue,x as de,y as fe}from"./dropdown-menu-DRFDwG2X.js";import"./attention-zJ-ho5os.js";function pe(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var me=f(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_=e(t(),1),v=n(),y=`Popover`,[b,he]=re(y,[de]),x=de(),[ge,S]=b(y),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:y});return(0,v.jsx)(le,{...s,children:(0,v.jsx)(ge,{scope:t,contentId:ne(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=y;var w=`PopoverAnchor`,T=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,v.jsx)(ce,{...a,...r,ref:t})});T.displayName=w;var E=`PopoverTrigger`,D=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(E,n),o=x(n),s=a(t,i.triggerRef),c=(0,v.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":P(i.open),...r,ref:s,onClick:h(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,v.jsx)(ce,{asChild:!0,...o,children:c})});D.displayName=E;var O=`PopoverPortal`,[_e,ve]=b(O,{forceMount:void 0}),k=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(O,t);return(0,v.jsx)(_e,{scope:t,forceMount:n,children:(0,v.jsx)(g,{present:n||a.open,children:(0,v.jsx)(te,{asChild:!0,container:i,children:r})})})};k.displayName=O;var A=`PopoverContent`,j=_.forwardRef((e,t)=>{let n=ve(A,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(A,e.__scopePopover);return(0,v.jsx)(g,{present:r||a.open,children:a.modal?(0,v.jsx)(be,{...i,ref:t}):(0,v.jsx)(xe,{...i,ref:t})})});j.displayName=A;var ye=r(`PopoverContent.RemoveScroll`),be=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(null),i=a(t,r),o=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,v.jsx)(ie,{as:ye,allowPinchZoom:!0,children:(0,v.jsx)(M,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xe=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,v.jsx)(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),M=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=S(A,n),p=x(n);return oe(),(0,v.jsx)(ee,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,v.jsx)(fe,{"data-state":P(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),N=`PopoverClose`,Se=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(N,n);return(0,v.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Se.displayName=N;var Ce=`PopoverArrow`,we=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,v.jsx)(ue,{...i,...r,ref:t})});we.displayName=Ce;function P(e){return e?`open`:`closed`}var Te=C,Ee=T,De=D,Oe=k,ke=j;function F(e,t){let n;for(let r of e)!r.sessionId||r.id===t||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n}function I(e,t){return e?.backend??t?.runner??`claude`}function Ae(e,t){let n;for(let r of e)r.removedBackend===void 0&&(t===void 0||r.sessionId!==t)||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n?.removedBackend===void 0?void 0:n}function je(e){let t=F(e.steps),n=Ae(e.steps,t?.sessionId)?void 0:t;return{sessionId:n?.sessionId,backend:I(n,e),profileId:n?.profileId}}var Me=new Set([`queued`,`running`,`waiting`]);function Ne(e){return Me.has(e)}function L(e){return u(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Pe(e){return L(e)&&e.status!==`queued`}function Fe(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&o(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Ie=[`done`,`failed`];function R(e){return e.archived||u(e)||!Ie.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!R(e)?!1:e.seenAt===void 0||e.seenAt<t}var z=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,B=e=>u(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[c(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||B(e)-B(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:l(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function V(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function H(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&H(e).ref===t}function U(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=B(e)-B(n);if(r!==0)return r;if(u(e)&&u(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function W(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!W(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=U(e)){let r=Ue(e,t).filter(e=>!W(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return z.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:d(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!W(i)){if(i.archived){n+=1;continue}t+=1,l(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t,n){return e.filter(e=>!e.archived&&(!n||o(e)===(t===`automations`)))}var G={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},K=Object.keys(G),q=`section`;function Xe(e,t,n){let r=`${q}=${G[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function Ze(e){return K.find(t=>G[t]===e)??null}function Qe(e,t){let n={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let r of e){if(W(r)||r.archived)continue;let e=+!!l(r);t&&o(r)?(n.automations+=1,n.automationsWaiting+=e):(n.active+=1,n.activeWaiting+=e)}return n}function J(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=J(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(J(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:J(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,_.useState)({top:0,bottom:0});return(0,_.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,_.useRef)(e);t.current=e,(0,_.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var st=new WeakMap;function ct(e){let t=st.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return st.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function lt(e){let t=ct(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&J(e)>80||t>80&&ot(e.document?.activeElement)}function ut(){let[e,t]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=window,n=()=>t(lt(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function dt(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function ft(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?dt(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var pt=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:ft},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function mt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ht(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function gt(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ht(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of pt)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function _t(e,t,n={}){let r=mt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=gt(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var vt=new Set([`running`,`waiting`]);function Y(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function yt(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function bt(e,t=new Date){if(!u(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xt(e){return e.steps?pe({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function St(e,t,n=()=>``){let r=e.filter(e=>!W(e));return t.trim()?r.filter(e=>_t(e,t,{scope:`shown`,extras:{displayTitle:V(e),automation:n(e),references:()=>Ct(e)}})):[...r]}function Ct(e){return X(e).map(e=>e.number)}function wt(e,t){return e.filter(e=>Fe(e,t)).length}function Tt(e){return wt(e)}function Et(e){return Dt(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Dt(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Ot(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function kt(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function X(e,t,n=e.projectId){let r=Dt(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:Ot(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??At(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=kt(a);o.has(c)||(o.add(c),s.push(a))}return s}function At(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function jt(e){return X(e)[0]}function Z(e,t){if(!e.url)return!0;if(!t)return!1;let n=Mt(t);return n!==void 0&&Mt(e.url)===n}function Mt(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Nt(e,t){let n=[];for(let r of X(e,t)){if(!Z(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function Pt(e,t,n,r){if(Z(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Ft(e,t){let n=vt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Y(n.rssBytes),kind:`live`}};let r=Y(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var $=_.createContext(null);function It({...e}){let t=_.useRef(!1);return(0,v.jsx)($,{value:t,children:(0,v.jsx)(Te,{"data-slot":`popover`,...e})})}function Lt({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=_.useContext($);return(0,v.jsx)(De,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Rt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,onOpenAutoFocus:a,...o}){let s=rt(),c=_.useContext($);return(0,v.jsx)(Oe,{children:(0,v.jsx)(ke,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,r),className:i(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function zt({...e}){return(0,v.jsx)(Ee,{"data-slot":`popover-anchor`,...e})}var Bt=`(min-width: 48rem)`;function Vt(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Bt),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{F as $,K as A,Xe as B,Ft as C,ut as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Ne as J,R as K,U as L,Ge as M,W as N,z as O,Je as P,je as Q,He as R,X as S,_t as T,Ye as U,We as V,H as W,Fe as X,Pe as Y,Le as Z,Ot as _,Rt as a,Et as b,Tt as c,Z as d,I as et,Q as f,wt as g,Ct as h,zt as i,Ke as j,q as k,yt as l,bt as m,Vt as n,Lt as o,kt as p,L as q,It as r,St as s,Bt as t,me as tt,Y as u,Pt as v,xt as w,jt as x,Nt as y,V as z};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r,l as i,s as a}from"./button-C1fD-ZFr.js";import{Bn as o,Dn as s,Mn as c,Nn as l,nr as u,vr as d}from"./project-scope-context-CR3cozni.js";import"./queries-BCXjp1_j.js";import{t as f}from"./createLucideIcon-BHp8sXmF.js";import{a as ee,d as p,h as m,i as te,l as ne,m as re,n as ie,o as ae,p as h,r as oe,t as se,u as g}from"./es2015-Ch36azR0.js";import{_ as ce,b as le,v as ue,x as de,y as fe}from"./dropdown-menu-DRFDwG2X.js";import"./attention-CfWn6Sw7.js";function pe(e){if(e.workflow===`(planned)`||e.workflow===`(inbox)`){let t=(e.steps??[]).find(e=>e.kind===`agent`);if(t?.name)return t.name}return e.workflow}var me=f(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),_=e(t(),1),v=n(),y=`Popover`,[b,he]=re(y,[de]),x=de(),[ge,S]=b(y),C=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=x(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=p({prop:r,defaultProp:i??!1,onChange:a,caller:y});return(0,v.jsx)(le,{...s,children:(0,v.jsx)(ge,{scope:t,contentId:ne(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};C.displayName=y;var w=`PopoverAnchor`,T=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(w,n),a=x(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,v.jsx)(ce,{...a,...r,ref:t})});T.displayName=w;var E=`PopoverTrigger`,D=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(E,n),o=x(n),s=a(t,i.triggerRef),c=(0,v.jsx)(m.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":P(i.open),...r,ref:s,onClick:h(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?c:(0,v.jsx)(ce,{asChild:!0,...o,children:c})});D.displayName=E;var O=`PopoverPortal`,[_e,ve]=b(O,{forceMount:void 0}),k=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=S(O,t);return(0,v.jsx)(_e,{scope:t,forceMount:n,children:(0,v.jsx)(g,{present:n||a.open,children:(0,v.jsx)(te,{asChild:!0,container:i,children:r})})})};k.displayName=O;var A=`PopoverContent`,j=_.forwardRef((e,t)=>{let n=ve(A,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=S(A,e.__scopePopover);return(0,v.jsx)(g,{present:r||a.open,children:a.modal?(0,v.jsx)(be,{...i,ref:t}):(0,v.jsx)(xe,{...i,ref:t})})});j.displayName=A;var ye=r(`PopoverContent.RemoveScroll`),be=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(null),i=a(t,r),o=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return se(e)},[]),(0,v.jsx)(ie,{as:ye,allowPinchZoom:!0,children:(0,v.jsx)(M,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:h(e.onCloseAutoFocus,e=>{e.preventDefault(),o.current||n.triggerRef.current?.focus()}),onPointerDownOutside:h(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;o.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:h(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xe=_.forwardRef((e,t)=>{let n=S(A,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,v.jsx)(M,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),M=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=S(A,n),p=x(n);return oe(),(0,v.jsx)(ee,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,v.jsx)(ae,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,v.jsx)(fe,{"data-state":P(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),N=`PopoverClose`,Se=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=S(N,n);return(0,v.jsx)(m.button,{type:`button`,...r,ref:t,onClick:h(e.onClick,()=>i.onOpenChange(!1))})});Se.displayName=N;var Ce=`PopoverArrow`,we=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=x(n);return(0,v.jsx)(ue,{...i,...r,ref:t})});we.displayName=Ce;function P(e){return e?`open`:`closed`}var Te=C,Ee=T,De=D,Oe=k,ke=j;function F(e,t){let n;for(let r of e)!r.sessionId||r.id===t||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n}function I(e,t){return e?.backend??t?.runner??`claude`}function Ae(e,t){let n;for(let r of e)r.removedBackend===void 0&&(t===void 0||r.sessionId!==t)||(!n||!r.startedAt||!n.startedAt||r.startedAt>=n.startedAt)&&(n=r);return n?.removedBackend===void 0?void 0:n}function je(e){let t=F(e.steps),n=Ae(e.steps,t?.sessionId)?void 0:t;return{sessionId:n?.sessionId,backend:I(n,e),profileId:n?.profileId}}var Me=new Set([`queued`,`running`,`waiting`]);function Ne(e){return Me.has(e)}function L(e){return u(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function Pe(e){return L(e)&&e.status!==`queued`}function Fe(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&o(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var Ie=[`done`,`failed`];function R(e){return e.archived||u(e)||!Ie.includes(e.status)?!1:e.finishedAt!==void 0}function Le(e){let t=e.finishedAt;return t===void 0||!R(e)?!1:e.seenAt===void 0||e.seenAt<t}var z=[`Needs you`,`Finished`,`Working`,`Archived`],Re={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},ze=3,B=e=>u(e)?ze:Re[e.status]??9;function Be(e){let t=e=>s[c(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||B(e)-B(n))[0]}function Ve(e,t){return t===`archived`?`Archived`:l(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function V(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function H(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function He(e,t){return t!==void 0&&H(e).ref===t}function U(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function Ue(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=B(e)-B(n);if(r!==0)return r;if(u(e)&&u(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function W(e){return e.delegation?.role===`worker`}function We(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!W(n)?e:n.delegation?.parentRunId??e}function Ge(e,t,n=U(e)){let r=Ue(e,t).filter(e=>!W(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Ve(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return z.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Ke(e,t={}){let n=typeof t==`number`?{overall:t}:d(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function qe(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Je(e){let t=0,n=0,r=0;for(let i of e)if(!W(i)){if(i.archived){n+=1;continue}t+=1,l(i)&&(r+=1)}return{active:t,archived:n,waiting:r}}function Ye(e,t,n){return e.filter(e=>!e.archived&&(!n||o(e)===(t===`automations`)))}var G={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},K=Object.keys(G),q=`section`;function Xe(e,t,n){let r=`${q}=${G[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function Ze(e){return K.find(t=>G[t]===e)??null}function Qe(e,t){let n={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let r of e){if(W(r)||r.archived)continue;let e=+!!l(r);t&&o(r)?(n.automations+=1,n.automationsWaiting+=e):(n.active+=1,n.activeWaiting+=e)}return n}function J(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function $e(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=J(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(J(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function et(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:J(e)}:{top:0,bottom:0}}function tt(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function nt(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(et(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function rt(){let[e,t]=(0,_.useState)({top:0,bottom:0});return(0,_.useEffect)(()=>nt(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function it(e){let t=(0,_.useRef)(e);t.current=e,(0,_.useEffect)(()=>{let e=document.documentElement;return $e(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}var at=new Set([``,`text`,`search`,`email`,`url`,`tel`,`password`,`number`]);function ot(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.tagName?.toUpperCase();return n===`TEXTAREA`?!0:n===`INPUT`?at.has((t.type??``).toLowerCase()):t.isContentEditable===!0}var st=new WeakMap;function ct(e){let t=st.get(e),n=t&&t.width===e.innerWidth?Math.max(t.height,e.innerHeight):e.innerHeight;return st.set(e,{width:e.innerWidth,height:n}),n-e.innerHeight}function lt(e){let t=ct(e),n=e.visualViewport?.scale??1;return Math.abs(n-1)<.05&&J(e)>80||t>80&&ot(e.document?.activeElement)}function ut(){let[e,t]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{let e=window,n=()=>t(lt(e));n();let r=e.visualViewport;return r?.addEventListener(`resize`,n),r?.addEventListener(`scroll`,n),window.addEventListener(`resize`,n),document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,n),()=>{r?.removeEventListener(`resize`,n),r?.removeEventListener(`scroll`,n),window.removeEventListener(`resize`,n),document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,n)}},[]),e}function dt(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function ft(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?dt(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var pt=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:ft},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function mt(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function ht(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function gt(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:ht(e,t.automationNames)},i=[],a=[],o=[],s={text:i,identifier:a,link:o},c=[];for(let t of pt)if(t.scopes.includes(n)){if(t.kind===`reference`){c.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&s[t.kind].push(n.toLowerCase())}let l;return{prose:i,ids:a,links:o,references:()=>l??=new Set(c.flatMap(e=>e().map(String)))}}function _t(e,t,n={}){let r=mt(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=gt(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var vt=new Set([`running`,`waiting`]);function Y(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function yt(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function bt(e,t=new Date){if(!u(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function xt(e){return e.steps?pe({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function St(e,t,n=()=>``){let r=e.filter(e=>!W(e));return t.trim()?r.filter(e=>_t(e,t,{scope:`shown`,extras:{displayTitle:V(e),automation:n(e),references:()=>Ct(e)}})):[...r]}function Ct(e){return X(e).map(e=>e.number)}function wt(e,t){return e.filter(e=>Fe(e,t)).length}function Tt(e){return wt(e)}function Et(e){return Dt(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Dt(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function Ot(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function kt(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function X(e,t,n=e.projectId){let r=Dt(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>Q(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:Ot(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(Q(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??At(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=kt(a);o.has(c)||(o.add(c),s.push(a))}return s}function At(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function jt(e){return X(e)[0]}function Z(e,t){if(!e.url)return!0;if(!t)return!1;let n=Mt(t);return n!==void 0&&Mt(e.url)===n}function Mt(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function Nt(e,t){let n=[];for(let r of X(e,t)){if(!Z(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function Pt(e,t,n,r){if(Z(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function Q(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function Ft(e,t){let n=vt.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:Y(n.rssBytes),kind:`live`}};let r=Y(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}var $=_.createContext(null);function It({...e}){let t=_.useRef(!1);return(0,v.jsx)($,{value:t,children:(0,v.jsx)(Te,{"data-slot":`popover`,...e})})}function Lt({onPointerDownCapture:e,onKeyDownCapture:t,...n}){let r=_.useContext($);return(0,v.jsx)(De,{"data-slot":`popover-trigger`,...n,onPointerDownCapture:t=>{r&&(r.current=t.pointerType===`touch`),e?.(t)},onKeyDownCapture:e=>{r&&(r.current=!1),t?.(e)}})}function Rt({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,onOpenAutoFocus:a,...o}){let s=rt(),c=_.useContext($);return(0,v.jsx)(Oe,{children:(0,v.jsx)(ke,{"data-slot":`popover-content`,align:t,sideOffset:n,onOpenAutoFocus:e=>{let t=c?.current;if(c&&(c.current=!1),a?.(e),e.defaultPrevented||!t)return;let n=e.target;n instanceof HTMLElement&&n.querySelector(`[cmdk-input]`)&&(e.preventDefault(),n.focus({preventScroll:!0}))},collisionPadding:tt(s,r),className:i(`z-50 w-72 max-w-(--radix-popover-content-available-width) [overflow-wrap:anywhere] origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...o})})}function zt({...e}){return(0,v.jsx)(Ee,{"data-slot":`popover-anchor`,...e})}var Bt=`(min-width: 48rem)`;function Vt(){let[e,t]=(0,_.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 48rem)`).matches);return(0,_.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(Bt),n=()=>t(e.matches);return n(),e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{F as $,K as A,Xe as B,Ft as C,ut as D,it as E,Be as F,qe as G,Qe as H,Ze as I,Ne as J,R as K,U as L,Ge as M,W as N,z as O,Je as P,je as Q,He as R,X as S,_t as T,Ye as U,We as V,H as W,Fe as X,Pe as Y,Le as Z,Ot as _,Rt as a,Et as b,Tt as c,Z as d,I as et,Q as f,wt as g,Ct as h,zt as i,Ke as j,q as k,yt as l,bt as m,Vt as n,Lt as o,kt as p,L as q,It as r,St as s,Bt as t,me as tt,Y as u,Pt as v,xt as w,jt as x,Nt as y,V as z};