@wjarka/cezarion 0.18.0-dev.8015 → 0.18.0-dev.8022
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/web/dist/assets/{accounts-section-CJ1xR0FN.js → accounts-section-Lxa13E8O.js} +1 -1
- package/web/dist/assets/{activity-motion-C01GEN0y.js → activity-motion-D-8GF_WP.js} +1 -1
- package/web/dist/assets/{activity-route-BZ1NIKSY.js → activity-route-Bo-Cyzsz.js} +1 -1
- package/web/dist/assets/{agent-config-section-DvFcRRLD.js → agent-config-section-BE239EYo.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-BE88c2RN.js → agent-defaults-section-Bj5dO6F3.js} +1 -1
- package/web/dist/assets/{appearance-B9Z6lNEm.js → appearance-C2v7z5MF.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DtR7twJI.js → archive-on-merge-field-Ta3WlY1p.js} +1 -1
- package/web/dist/assets/attention-B1Ei1IW6.js +1 -0
- package/web/dist/assets/{automations-route-Dpa01C3j.js → automations-route-DPpaFR0Q.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-CGjhxIPJ.js → commit-diff-panel-CzY8bO3p.js} +1 -1
- package/web/dist/assets/{diff-DQ18_bA-.js → diff-3jSM3IH7.js} +2 -2
- package/web/dist/assets/{diff-view-CMwe_Rx7.js → diff-view-C3cwyYRv.js} +1 -1
- package/web/dist/assets/{file-preview-_lAUlt5u.js → file-preview-B71T62DU.js} +1 -1
- package/web/dist/assets/{folder-browser-Cy26Y6YK.js → folder-browser-BTYMFLBY.js} +1 -1
- package/web/dist/assets/{git-toolbar-BJM3pWHY.js → git-toolbar-Dng31AhK.js} +1 -1
- package/web/dist/assets/{github-aO7y0526.js → github-Cft2RNHM.js} +1 -1
- package/web/dist/assets/{global-activity-route-BWOfw2C5.js → global-activity-route-CngRjBlD.js} +1 -1
- package/web/dist/assets/{index-D-Y1olb1.js → index-MG3T7zFQ.js} +5 -5
- package/web/dist/assets/{label-CbEJ99h4.js → label-C9IGG0mW.js} +1 -1
- package/web/dist/assets/{markdown-BDWII3gy.js → markdown-BDWm6oGX.js} +1 -1
- package/web/dist/assets/{notifications-section-Z_4IW83J.js → notifications-section-BxIKJ1NF.js} +1 -1
- package/web/dist/assets/{open-in-menu-21vcjK3t.js → open-in-menu-LbTu2sP4.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-CxwvH4pt.js → preview-pane-connected-CGQngtTw.js} +1 -1
- package/web/dist/assets/{project-location-CvJMe_Vp.js → project-location-B-18C392.js} +1 -1
- package/web/dist/assets/{project-router-hhGBPlav.js → project-router-DImKA81z.js} +1 -1
- package/web/dist/assets/project-scope-context-D3_4Nfjk.js +4 -0
- package/web/dist/assets/{projects-section-CQ34YFnT.js → projects-section-DQ1LxJ3A.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-UIxQCLJq.js → prompt-templates-section-C5AYB6Ig.js} +1 -1
- package/web/dist/assets/{queries-D6ioEk6c.js → queries-BaHOUYn4.js} +1 -1
- package/web/dist/assets/{reference-chip-B5br2cfV.js → reference-chip-CdOqXRll.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-BWDpTH5W.js → remote-settings-notice-BTdflMqO.js} +1 -1
- package/web/dist/assets/{repo-git-U12bPaG-.js → repo-git-DChiMWrS.js} +1 -1
- package/web/dist/assets/{report-reader-B5vipU-m.js → report-reader-nV2G6iRk.js} +1 -1
- package/web/dist/assets/{reports-Cdk8Dc-w.js → reports-CoQqVEy4.js} +1 -1
- package/web/dist/assets/{resources-section-BCLu3v1Z.js → resources-section-CVaIlicS.js} +1 -1
- package/web/dist/assets/{run-header-gOqc0BKa.js → run-header-xPtXOBkm.js} +1 -1
- package/web/dist/assets/{runners-5cgs0qUY.js → runners-DccsyraI.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-CB7l8AW-.js → settings-agent-picker-ixlEQ-MP.js} +1 -1
- package/web/dist/assets/{settings-shell-BUHHoCDs.js → settings-shell-BwknM_fs.js} +1 -1
- package/web/dist/assets/{sidebar-section-8dTKLdQw.js → sidebar-section-BNy-fRPU.js} +1 -1
- package/web/dist/assets/{skills-thuBrq2s.js → skills-CKceHo5J.js} +1 -1
- package/web/dist/assets/{tab-link-DaFUyEhe.js → tab-link-VCVNqxFc.js} +1 -1
- package/web/dist/assets/{task-changes-DSpeg6sX.js → task-changes-D4H5YbMo.js} +1 -1
- package/web/dist/assets/{task-commits-DRDRswBh.js → task-commits-BNu0VTTf.js} +1 -1
- package/web/dist/assets/{task-files-Cevz9Mex.js → task-files-C8q8GHYK.js} +1 -1
- package/web/dist/assets/{task-github-item-DpLkKSKy.js → task-github-item-D5kHfnwY.js} +1 -1
- package/web/dist/assets/{task-groups-CafTiSSz.js → task-groups-C7yO8nMy.js} +1 -1
- package/web/dist/assets/{task-thread-BvM4rEQe.js → task-thread-Dhts8Nbu.js} +1 -1
- package/web/dist/assets/{tasks-table-DYjfmofR.js → tasks-table-I_z4e7uI.js} +1 -1
- package/web/dist/assets/{thread-state-A3TSuI5v.js → thread-state-DV19z3BD.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-IepoiFbj.js → use-hand-to-agent-state-C6e6Mgi1.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-B20OnjTe.js → useInfiniteQuery-DR5UfhCS.js} +1 -1
- package/web/dist/assets/useQuery-BMyCehPp.js +1 -0
- package/web/dist/assets/{workflows-B0TaHAzz.js → workflows-BNHmFZRc.js} +1 -1
- package/web/dist/assets/{workspace-tools-B8sP_p5c.js → workspace-tools-UHJAnHEN.js} +1 -1
- package/web/dist/assets/{worktrees-section-BDfwadB6.js → worktrees-section-B4XPx6R5.js} +1 -1
- package/web/dist/assets/{ws-ExzR2_Yn.js → ws-CH3zNFKR.js} +1 -1
- package/web/dist/index.html +15 -15
- package/web/dist/assets/attention-B6NEiTGm.js +0 -1
- package/web/dist/assets/project-scope-context-BiijuuWU.js +0 -4
- package/web/dist/assets/useQuery-BTg3x78A.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{t as r}from"./utils-DSMR_WLb.js";import{M as i,i as a,s as o}from"./project-scope-context-BiijuuWU.js";import{c as s,ht as c,u as l,ut as u,x as d}from"./queries-D6ioEk6c.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,ot as y,u as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{f as S,t as C}from"./run-header-gOqc0BKa.js";import{a as w,i as T,n as E,r as D}from"./file-preview-_lAUlt5u.js";import{t as O}from"./button-BQ2y4XRB.js";import{t as k}from"./centered-state-V15AR_qo.js";import{C as A,Hn as j,w as M}from"./index-D-Y1olb1.js";import{r as N}from"./markdown-BDWII3gy.js";var P=x(`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=x(`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 r=d(e,n?null:t),a=s(e,n),c=n?a:r,l=(0,I.useContext)(N),u=f(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=c.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...l,basePath:m.path}:null,[m,l,e]);if(!t&&!n)return(0,L.jsx)(D,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.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:c.error.message}),(0,L.jsx)(O,{variant:`outline`,onClick:()=>void c.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)(O,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let g=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(E,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:g?o(e,g.id,`image`):i(e,t),...g?{downloadUrl:o(e,g.id,`download`),snapshot:new Date(g.createdAt).toLocaleString()}:{}},g?.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}=f(),t=h()===`POP`,[n,r]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),r=f(),i=h()===`POP`?r.key:B(r.state),[a]=(0,I.useState)(()=>{let t=i?z.get(i):void 0;return t?.runId===e?t:null}),o=(0,I.useRef)(new Set(a?.folders??[])),s=(0,I.useRef)(new Set),[c,l]=(0,I.useState)(0),u=(0,I.useRef)(a===null),d=(0,I.useCallback)(()=>{u.current&&z.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[r.key,e]),p=(0,I.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,I.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=U();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,I.useEffect)(()=>{d();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function 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=c(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:i,selected:a,onSelect:o}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.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:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,L.jsx)(b,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(_,{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:i+1,selected:a,onSelect:o})}):null]})}function J({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=w(t)?F:g;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,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:T(n)})]})})}function Y(){let{id:e}=m(),t=u(e),n=H();return t.isPending?(0,L.jsx)(M,{tab:`files`}):t.isError?(0,L.jsx)(A,{tab:`files`,error:t.error}):(0,L.jsx)(S,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=d(e,r||n!==null?null:t),a=s(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=c(e.id,``),n=l(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof a&&t.error.status===409,g=X(e.id,o,s,u),_=W(e.id,!t.isPending&&g);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(C,{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()&&m(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(j,{"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)(O,{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:_.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:h?(0,L.jsx)(P,{}):(0,L.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:_.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>m(`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:()=>m(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(O,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),u?(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{t as r}from"./utils-DSMR_WLb.js";import{M as i,i as a,s as o}from"./project-scope-context-D3_4Nfjk.js";import{c as s,ht as c,u as l,ut as u,x as d}from"./queries-BaHOUYn4.js";import{f,g as p,h as m,m as h}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{S as g,T as _,X as v,ot as y,u as b}from"./design-icons-CzEoMH9c.js";import{t as x}from"./createLucideIcon-BHp8sXmF.js";import{f as S,t as C}from"./run-header-xPtXOBkm.js";import{a as w,i as T,n as E,r as D}from"./file-preview-B71T62DU.js";import{t as O}from"./button-BQ2y4XRB.js";import{t as k}from"./centered-state-V15AR_qo.js";import{C as A,Hn as j,w as M}from"./index-MG3T7zFQ.js";import{r as N}from"./markdown-BDWm6oGX.js";var P=x(`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=x(`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 r=d(e,n?null:t),a=s(e,n),c=n?a:r,l=(0,I.useContext)(N),u=f(),p=u.pathname.replace(/\/files\/?$/,`/report`)+u.search,m=c.data,h=(0,I.useMemo)(()=>m?.type===`file`&&m.source!==`artifact`?{runId:e,...l,basePath:m.path}:null,[m,l,e]);if(!t&&!n)return(0,L.jsx)(D,{runId:e,path:null,className:`min-w-0 flex-1`});if(c.isPending)return(0,L.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(c.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:c.error.message}),(0,L.jsx)(O,{variant:`outline`,onClick:()=>void c.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)(O,{variant:`outline`,onClick:()=>void c.refetch(),children:`Retry`})]});let g=m.artifact;return(0,L.jsx)(N.Provider,{value:h,children:(0,L.jsx)(E,{runId:e,entry:m,documentPreview:!0,readerHref:p,className:`min-w-0 flex-1`,imageUrl:g?o(e,g.id,`image`):i(e,t),...g?{downloadUrl:o(e,g.id,`download`),snapshot:new Date(g.createdAt).toLocaleString()}:{}},g?.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}=f(),t=h()===`POP`,[n,r]=(0,I.useState)({key:e,generation:0});if(n.key===e)return n.generation;let i={key:e,generation:t?n.generation+1:n.generation};return r(i),i.generation}var U=()=>document.querySelector(`[data-slot="main"]`);function W(e,t){let n=(0,I.useRef)(null),r=f(),i=h()===`POP`?r.key:B(r.state),[a]=(0,I.useState)(()=>{let t=i?z.get(i):void 0;return t?.runId===e?t:null}),o=(0,I.useRef)(new Set(a?.folders??[])),s=(0,I.useRef)(new Set),[c,l]=(0,I.useState)(0),u=(0,I.useRef)(a===null),d=(0,I.useCallback)(()=>{u.current&&z.set(r.key,{runId:e,folders:new Set(o.current),tree:n.current?.scrollTop??0,main:U()?.scrollTop??0})},[r.key,e]),p=(0,I.useMemo)(()=>({isOpen:e=>o.current.has(e),setOpen:(e,t)=>{t?o.current.add(e):o.current.delete(e),d()},loading:(e,t)=>{a?.folders.has(e)&&(t?s.current.add(e):s.current.delete(e),l(s.current.size))}}),[a,d]);return(0,I.useEffect)(()=>{if(u.current||!a||!t||s.current.size>0)return;n.current&&(n.current.scrollTop=a.tree);let e=U();e&&(e.scrollTop=a.main),u.current=!0,d()},[a,t,c,d]),(0,I.useEffect)(()=>{d();let e=[n.current,U()].filter(e=>e!==null);for(let t of e)t.addEventListener(`scroll`,d,{passive:!0});return()=>{for(let t of e)t.removeEventListener(`scroll`,d)}},[d]),{tree:n,folders:p}}function 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=c(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:i,selected:a,onSelect:o}){let s=(0,I.useContext)(V),[c,l]=(0,I.useState)(()=>s?.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:()=>{s?.setOpen(n,!c),l(!c)},className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+i*14}px`},children:[(0,L.jsx)(b,{size:16,"aria-hidden":`true`,className:r(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,c&&`rotate-90`)}),(0,L.jsx)(_,{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:i+1,selected:a,onSelect:o})}):null]})}function J({name:e,path:t,size:n,depth:i,selected:a,onSelect:o}){let s=a===t,c=w(t)?F:g;return(0,L.jsx)(`li`,{children:(0,L.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":s?`true`:void 0,onClick:()=>o(t),className:r(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,s?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+i*14}px`},children:[(0,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:T(n)})]})})}function Y(){let{id:e}=m(),t=u(e),n=H();return t.isPending?(0,L.jsx)(M,{tab:`files`}):t.isError?(0,L.jsx)(A,{tab:`files`,error:t.error}):(0,L.jsx)(S,{runId:t.data.id,children:(0,L.jsx)(Z,{run:t.data},`${t.data.id}:${n}`)})}function X(e,t,n,r){let i=d(e,r||n!==null?null:t),a=s(e,r?null:n);return r||t===null&&n===null?!0:!(n===null?i:a).isPending}function Z({run:e}){let t=c(e.id,``),n=l(e.id),[r,i]=p(),o=r.get(`path`),s=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||o!==null&&s!==null,[d,f]=(0,I.useState)(o??``);(0,I.useEffect)(()=>f(o??``),[o]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),i(n)},h=t.isError&&t.error instanceof a&&t.error.status===409,g=X(e.id,o,s,u),_=W(e.id,!t.isPending&&g);return(0,L.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,L.jsx)(C,{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()&&m(`path`,d.trim())},children:[(0,L.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,L.jsx)(v,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,L.jsx)(j,{"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)(O,{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:_.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:h?(0,L.jsx)(P,{}):(0,L.jsx)(y,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,L.jsx)(V.Provider,{value:_.folders,children:(0,L.jsx)(G,{runId:e.id,selected:o,onSelect:e=>m(`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:()=>m(`artifact`,e.id),children:e.name})},e.id))}),(0,L.jsx)(O,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),u?(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{n as t}from"./utils-DSMR_WLb.js";import{Q as n,ci as r}from"./project-scope-context-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{n as t}from"./utils-DSMR_WLb.js";import{Q as n,ci as r}from"./project-scope-context-D3_4Nfjk.js";import{D as i,M as a,U as o,Yt as s,q as c,t as l,ut as u,w as d}from"./queries-BaHOUYn4.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-I_z4e7uI.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-xPtXOBkm.js";import{t as y}from"./external-link-BE6y205O.js";import{u as b}from"./reference-chip-CdOqXRll.js";import{t as x}from"./button-BQ2y4XRB.js";import{t as S}from"./project-router-DImKA81z.js";import{t as C}from"./centered-state-V15AR_qo.js";import{C as w,S as T,qn as E}from"./index-MG3T7zFQ.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-C6e6Mgi1.js";var A=e(),j={issue:`Issue`,pr:`Pull request`};function M({kind:e}){let{id:t}=f(),n=u(t);return n.isPending?(0,A.jsx)(T,{kind:e}):n.isError?(0,A.jsx)(w,{tab:`github-item`,error:n.error}):(0,A.jsx)(N,{run:n.data,kind:e})}function N({run:e,kind:t}){let{n}=f(),r=Number(n),s=o(),l=c(),u=a(),d=l.isPending||u.isPending,p=m(e,s).some(e=>e.kind===t&&e.number===r),h=i(t,r,p);return(0,A.jsxs)(`div`,{"data-route":`task-github-item`,className:`flex min-h-full flex-col`,children:[(0,A.jsx)(v,{run:e,tab:{kind:t,number:r}}),p?(0,A.jsx)(V,{run:e,kind:t,number:r,repoBase:s,item:h}):d?(0,A.jsx)(T,{kind:t,number:r,heading:`h2`}):(0,A.jsx)(C,{icon:(0,A.jsx)(E,{size:16}),tone:`neutral`,heading:`h2`,title:`#${n} is not linked to this task`,subtitle:`Only the issues and pull requests this task references open here.`,actions:(0,A.jsx)(x,{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:n}){return(0,A.jsx)(x,{variant:`outline`,disabled:e.isPending,onClick:()=>e.mutate(l.githubItem(t,n)),children:`Retry`})}function L({kind:e,number:t,error:n,retryButton:r}){return(0,A.jsx)(C,{icon:(0,A.jsx)(g,{size:16}),tone:`danger`,heading:`h2`,title:`Could not load ${j[e].toLowerCase()} #${t}`,subtitle:n.message,actions:r})}function R({run:e,kind:n,number:r,repoBase:i,reason:a,retryError:o,retryButton:s}){let c=n===`pr`?h:_,l=p(e,i).find(e=>e.kind===`PR`==(n===`pr`)&&e.number===r)?.url;return(0,A.jsx)(C,{icon:(0,A.jsx)(c,{size:16}),tone:`neutral`,heading:`h2`,title:`GitHub is unavailable`,subtitle:o?.message??a,actions:(0,A.jsxs)(A.Fragment,{children:[s,l&&t(l)?(0,A.jsx)(x,{asChild:!0,variant:`outline`,children:(0,A.jsxs)(`a`,{href:l,target:`_blank`,rel:`noopener noreferrer`,children:[`open on GitHub`,(0,A.jsx)(y,{"aria-hidden":`true`})]})}):null]})})}function z({label:e,repoBase:t}){return(0,A.jsx)(C,{icon:(0,A.jsx)(b,{}),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:i,repoBase:a,item:o}){let c=r(),l=s({mutationFn:e=>n(t,i,{refresh:!0}),onSuccess:(e,t)=>c.setQueryData(t,e)}),u=P(t,o),f=d(u?[i]:[],u),p=f.data?.available?f.data.checks:void 0,m=`${j[t]} #${i}`,h=(0,A.jsx)(I,{retry:l,kind:t,number:i});if(o.isPending)return(0,A.jsx)(T,{kind:t,number:i,heading:`h2`});if(o.isError)return(0,A.jsx)(L,{kind:t,number:i,error:l.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,i,p,g.item.checks)}):(0,A.jsx)(z,{label:m,repoBase:a}):(0,A.jsx)(R,{run:e,kind:t,number:i,repoBase:a,reason:g.reason,retryError:l.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 +1 @@
|
|
|
1
|
-
import{En as e,Ln as t,Mn as n,Nr as r,Yn as i,jn as a}from"./project-scope-context-
|
|
1
|
+
import{En as e,Ln as t,Mn as n,Nr as r,Yn as i,jn as a}from"./project-scope-context-D3_4Nfjk.js";import"./queries-BaHOUYn4.js";import"./attention-B1Ei1IW6.js";function o(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 s(e,t){return e?.backend??t?.runner??`claude`}function c(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 l(e){let t=o(e.steps),n=c(e.steps,t?.sessionId)?void 0:t;return{sessionId:n?.sessionId,backend:s(n,e),profileId:n?.profileId}}var u=new Set([`queued`,`running`,`waiting`]);function d(e){return u.has(e)}function f(e){return i(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function p(e){return f(e)&&e.status!==`queued`}function m(e,n,r){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||r!==void 0&&t(e)!==r?!1:n===`unpinned`?!e.pinned:n!==`pinned`||e.pinned===!0}var h=[`done`,`failed`];function g(e){return e.archived||i(e)||!h.includes(e.status)?!1:e.finishedAt!==void 0}function _(e){let t=e.finishedAt;return t===void 0||!g(e)?!1:e.seenAt===void 0||e.seenAt<t}var v=[`Needs you`,`Finished`,`Working`,`Archived`],y={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},b=3,x=e=>i(e)?b:y[e.status]??9;function S(t){let n=t=>e[a(t).bucket];return[...t].sort((e,t)=>n(e)-n(t)||x(e)-x(t))[0]}function C(e,t){return t===`archived`?`Archived`:n(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function w(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function T(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 E(e,t){return t!==void 0&&T(e).ref===t}function D(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 O(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=x(e)-x(n);if(r!==0)return r;if(i(e)&&i(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 k(e){return e.delegation?.role===`worker`}function A(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!k(n)?e:n.delegation?.parentRunId??e}function j(e,t,n=D(e)){let r=O(e,t).filter(e=>!k(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(C(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return v.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function M(e,t={}){let n=typeof t==`number`?{overall:t}:r(t),i={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},a=[],o=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[i[t.label]]??1/0,r=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:o<=0||e<=0?!1:(--o,--e,!0)});r.length&&a.push({label:t.label,rows:r})}return a}function N(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 P(e){let t=0,r=0,i=0;for(let a of e)if(!k(a)){if(a.archived){r+=1;continue}t+=1,n(a)&&(i+=1)}return{active:t,archived:r,waiting:i}}function F(e,n,r){return e.filter(e=>!e.archived&&(!r||t(e)===(n===`automations`)))}var I={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},L=Object.keys(I),R=`section`;function z(e,t,n){let r=`${R}=${I[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function B(e){return L.find(t=>I[t]===e)??null}function V(e,r){let i={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let a of e){if(k(a)||a.archived)continue;let e=+!!n(a);r&&t(a)?(i.automations+=1,i.automationsWaiting+=e):(i.active+=1,i.activeWaiting+=e)}return i}export{m as C,s as D,o as E,p as S,l as T,T as _,j as a,f as b,S as c,E as d,w as f,F as g,V as h,M as i,B as l,A as m,R as n,k as o,z as p,L as r,P as s,v as t,D as u,N as v,_ as w,d as x,g as y};
|
|
@@ -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{l as i,n as a,t as o}from"./utils-DSMR_WLb.js";import{n as s}from"./live-refetch-CZb2VOyu.js";import{E as c,Jr as l,Kn as u,N as d,Qn as f,Yn as p,Yr as m,_ as h,ci as g,d as _,i as v,jn as y,l as b,or as x,w as S,wt as C}from"./project-scope-context-BiijuuWU.js";import{Gt as w,Ht as T,J as E,Jt as D,M as ee,P as O,R as k,St as A,U as te,Yt as j,_t as ne,b as re,it as M,l as N,mt as P,o as F,p as I,qt as ie,t as L,ut as ae,vt as R}from"./queries-D6ioEk6c.js";import{t as oe}from"./useQuery-BTg3x78A.js";import{f as se,h as z,n as ce,p as le}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as ue,m as B,r as de,s as fe,v as pe}from"./tasks-table-DYjfmofR.js";import{n as V}from"./toaster-Bo5vCbz-.js";import{i as me,s as he,t as ge}from"./runners-5cgs0qUY.js";import{A as _e,B as ve,F as H,K as ye,X as be,at as xe,c as Se,dt as Ce,f as we,g as Te,it as Ee,k as De,l as Oe,m as ke,n as Ae,ot as je,s as Me,u as U,ut as Ne,v as Pe,y as Fe,z as Ie}from"./design-icons-CzEoMH9c.js";import{t as W}from"./createLucideIcon-BHp8sXmF.js";import{_ as Le,a as Re,c as ze,d as Be,f as Ve,g as He,h as Ue,i as We,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,t as Qe,u as $e,v as et,y as tt}from"./run-header-gOqc0BKa.js";import{t as nt}from"./chevron-right-BENZ-1ZN.js";import{t as rt}from"./external-link-BE6y205O.js";import{t as it}from"./eye-B8okNWXU.js";import{n as at}from"./smartphone-Lr8Ug2z_.js";import{a as ot}from"./format-BNCkW110.js";import{t as st}from"./message-square-B-MD-8rD.js";import{a as ct,c as lt,i as ut,l as dt,n as ft,o as pt,r as mt,s as ht,t as gt}from"./thread-state-A3TSuI5v.js";import{i as _t,o as vt,t as yt,u as bt}from"./reference-chip-B5br2cfV.js";import{t as xt}from"./square-terminal-B6RYYieR.js";import{t as G}from"./button-BQ2y4XRB.js";import{n as K,r as q,t as J}from"./collapsible-BEV4FO-1.js";import{a as St}from"./popover-BPgUYFyu.js";import{s as Ct,t as Y}from"./project-router-hhGBPlav.js";import"./attention-B6NEiTGm.js";import{D as wt,E as Tt,S as Et,b as Dt,f as X,u as Ot,w as kt}from"./task-groups-CafTiSSz.js";import{t as At}from"./status-dot-DtAOFiIi.js";import{n as jt,t as Mt}from"./centered-state-V15AR_qo.js";import{$t as Nt,F as Pt,Fn as Ft,G as It,Gn as Lt,I as Rt,In as zt,K as Bt,M as Vt,Mn as Ht,N as Ut,Nn as Wt,P as Gt,Pn as Kt,W as qt,X as Jt,Xn as Yt,Y as Xt,_n as Zt,an as Qt,dn as $t,fn as en,gn as tn,i as nn,in as rn,j as an,l as on,ln as sn,m as cn,mn as ln,n as un,nn as dn,on as fn,pn,s as mn,tn as hn,un as gn,vn as _n,x as vn,xn as yn,y as bn,yn as xn}from"./index-D-Y1olb1.js";import{i as Sn,r as Cn}from"./highlighter-DvLzHjjY.js";import{t as wn}from"./zoomable-image-CIQl1Wpe.js";import{i as Tn,r as En,s as Dn,t as On}from"./markdown-BDWII3gy.js";import{t as kn}from"./textarea-vJt9undk.js";import{t as An}from"./report-title-D4Mbu2Er.js";var jn=W(`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`}]]),Mn=W(`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`}]]),Nn=W(`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`}]]),Pn=W(`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`}]]),Fn=W(`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`}]]),In=W(`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`}]]),Ln=W(`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(),Rn=12;function zn({run:e}){let t=g(),n=j({mutationFn:()=>b(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:L.runs.detail(e.id)}),t.invalidateQueries({queryKey:L.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(!p(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)(At,{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 `,Rn,`)`]}):(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)(ce,{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 Bn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Vn=/^[A-Za-z0-9_./:=+,@%-]+$/;function Hn(e){return e.replaceAll(`'`,`'\\''`)}function Un(e){return e===``?`''`:Vn.test(e)?e:`\u0027${Hn(e)}\u0027`}function Wn(e){if(!Bn(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(Un).join(` `)}}function Gn(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 Kn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function qn(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Jn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Yn(e){let t=Gn(Kn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Jn(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]){Jn(e[2])&&i.push({label:qn(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:qn(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Jn(t)&&i.push({label:t,href:t})}return i}var Xn=(0,Z.createContext)(void 0),Zn=(0,Z.createContext)(void 0);function Qn(e,t){let n=new Map;for(let r of Yn(e)){let e=Tn(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 $n(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function er({text:e,messageKey:t}){let n=(0,Z.useContext)(En),r=(0,Z.useContext)(Zn),i=t??r;if(!n||i===void 0)return null;let a=Qn(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)(tr,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function tr({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,Z.useContext)(Xn),s=(0,Z.useContext)(bn);(0,Z.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=N(r,n),l=se(),u=le();if(c.isError)return(0,Q.jsx)(ce,{id:$n(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:l.pathname+l.search},children:i});let d=c.data?.artifact;if(d&&!Dn(d.name))return null;let f=new URLSearchParams(l.search);f.set(`report`,n),f.set(`card`,t);let p=new URLSearchParams(l.search).has(`report`)?l.state:null,m=new URLSearchParams(l.search);m.delete(`report`),m.delete(`card`);let h=`${l.pathname}${m.size?`?${m}`:``}`,g=window.navigation,_={reportCardEntry:!0,reportReturnTo:p?.reportReturnTo??h,reportReturnKey:p?.reportReturnKey??g?.currentEntry?.key,reportScrollTop:p?.reportScrollTop},v={pathname:l.pathname,search:`?${f}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.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:d?An(d):i}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(ce,{id:$n(t,n),to:v,state:_,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=_.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;u(v,{state:{..._,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 ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var nr={message:!0,reasoning:!0,tool:!0,hook:!0};function rr(e){return Object.hasOwn(nr,e)&&nr[e]}var ir=e=>e.kind===`tool`,ar=e=>e.kind===`conversation`,or=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,sr=(e,t,n)=>`${e} ${e===1?t:n}`;function cr(e,t){let n=[];return e>0&&n.push(sr(e,`file`,`files`)),t>0&&n.push(sr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function lr(e){return`${e} earlier tool call${e===1?``:`s`}`}var ur=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dr(e){for(let t of ur)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var fr=new WeakMap;function pr(e){let t=fr.get(e);if(t)return t;let n=mr(e);return fr.set(e,n),n}function mr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(ir).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=rr(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:cr(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 hr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(ar(e)){s(),c.push(e);continue}l(),ir(e)&&or(e)&&!r.has(e.id)?o.push(e):(s(),ir(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 hr(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 gr=new Map,_r=(0,Z.createContext)(null);function vr(){return(0,Z.useContext)(_r)}function yr({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>gr.get(e)?.get(t),set:(t,n)=>{let r=gr.get(e)??new Map;r.set(t,n),gr.set(e,r)}}),[e]);return(0,Q.jsx)(_r.Provider,{value:n,children:t})}function br(e){return e.scrollTop<Math.max(600,e.clientHeight)}function xr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Sr(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 Cr(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function wr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Tr=new Map;function Er(e,t){Tr.set(e,t)}function Dr(e){return Tr.get(e)}var Or=new Map;function kr(e,t){Or.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Ar(e){return Or.get(e)}function jr(e,t,n){let r=Or.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 Mr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Nr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Pr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Fr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ir=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 Lr(e){let t=$(e);return t===void 0?void 0:Mr.format(t)}function Rr(e){let t=$(e);return t===void 0?void 0:Nr.format(t)}var zr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Br(e){let t=$(e);return t===void 0?void 0:zr(t)}function Vr(e,t=new Date){let n=$(e);if(n===void 0)return;let r=zr(n);return r===zr(t)?`Today`:r===zr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Pr:Fr).format(n)}function Hr(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 Ur({ts:e}){let t=Lr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Rr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Wr({startedAt:e,completedAt:t}){let n=Lr(t);if(n===void 0)return null;let r=Hr(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:Rr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Gr({ts:e}){let t=Vr(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Ir.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:Br(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Kr={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 qr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let s=Kr[e],c=r===void 0?void 0:Lr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":s.speaker,className:o(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,Q.jsxs)(`p`,{className:o(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.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)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Ur,{ts:r})})]}),(0,Q.jsx)(`div`,{className:o(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}function Jr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:a,onRemove:o,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 a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(qr,{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)(ot,{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)(qr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(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:[a?(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)(Ln,{className:`size-3.5`})}):null,o?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),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)(xe,{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)(On,{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=>x(e.split(`/`).pop()??``)?(0,Q.jsx)(wn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:i(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)(ye,{"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 Yr=`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`,Xr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Zr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Xr).forEach(e=>e.remove());let r=Yn(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||!Jn(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 Qr(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=Zr(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 $r({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 Qr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(qr,{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:Yr,children:[(0,Q.jsx)(Pe,{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:Yr,children:[(0,Q.jsx)(Yt,{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)(On,{breaks:!0,children:e})}),(0,Q.jsx)(er,{text:e,messageKey:n})]})}function ei({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)(Lt,{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:o(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function ti({incident:e}){let t=he().data;if(!t)return null;let n=ge(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)(Y,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function ni({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{l as i,n as a,t as o}from"./utils-DSMR_WLb.js";import{n as s}from"./live-refetch-CZb2VOyu.js";import{E as c,Jr as l,Kn as u,N as d,Qn as f,Yn as p,Yr as m,_ as h,ci as g,d as _,i as v,jn as y,l as b,or as x,w as S,wt as C}from"./project-scope-context-D3_4Nfjk.js";import{Gt as w,Ht as T,J as E,Jt as D,M as ee,P as O,R as k,St as A,U as te,Yt as j,_t as ne,b as re,it as M,l as N,mt as P,o as F,p as I,qt as ie,t as L,ut as ae,vt as R}from"./queries-BaHOUYn4.js";import{t as oe}from"./useQuery-BMyCehPp.js";import{f as se,h as z,n as ce,p as le}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as ue,m as B,r as de,s as fe,v as pe}from"./tasks-table-I_z4e7uI.js";import{n as V}from"./toaster-Bo5vCbz-.js";import{i as me,s as he,t as ge}from"./runners-DccsyraI.js";import{A as _e,B as ve,F as H,K as ye,X as be,at as xe,c as Se,dt as Ce,f as we,g as Te,it as Ee,k as De,l as Oe,m as ke,n as Ae,ot as je,s as Me,u as U,ut as Ne,v as Pe,y as Fe,z as Ie}from"./design-icons-CzEoMH9c.js";import{t as W}from"./createLucideIcon-BHp8sXmF.js";import{_ as Le,a as Re,c as ze,d as Be,f as Ve,g as He,h as Ue,i as We,l as Ge,m as Ke,n as qe,o as Je,p as Ye,r as Xe,s as Ze,t as Qe,u as $e,v as et,y as tt}from"./run-header-xPtXOBkm.js";import{t as nt}from"./chevron-right-BENZ-1ZN.js";import{t as rt}from"./external-link-BE6y205O.js";import{t as it}from"./eye-B8okNWXU.js";import{n as at}from"./smartphone-Lr8Ug2z_.js";import{a as ot}from"./format-BNCkW110.js";import{t as st}from"./message-square-B-MD-8rD.js";import{a as ct,c as lt,i as ut,l as dt,n as ft,o as pt,r as mt,s as ht,t as gt}from"./thread-state-DV19z3BD.js";import{i as _t,o as vt,t as yt,u as bt}from"./reference-chip-CdOqXRll.js";import{t as xt}from"./square-terminal-B6RYYieR.js";import{t as G}from"./button-BQ2y4XRB.js";import{n as K,r as q,t as J}from"./collapsible-BEV4FO-1.js";import{a as St}from"./popover-BPgUYFyu.js";import{s as Ct,t as Y}from"./project-router-DImKA81z.js";import"./attention-B1Ei1IW6.js";import{D as wt,E as Tt,S as Et,b as Dt,f as X,u as Ot,w as kt}from"./task-groups-C7yO8nMy.js";import{t as At}from"./status-dot-DtAOFiIi.js";import{n as jt,t as Mt}from"./centered-state-V15AR_qo.js";import{$t as Nt,F as Pt,Fn as Ft,G as It,Gn as Lt,I as Rt,In as zt,K as Bt,M as Vt,Mn as Ht,N as Ut,Nn as Wt,P as Gt,Pn as Kt,W as qt,X as Jt,Xn as Yt,Y as Xt,_n as Zt,an as Qt,dn as $t,fn as en,gn as tn,i as nn,in as rn,j as an,l as on,ln as sn,m as cn,mn as ln,n as un,nn as dn,on as fn,pn,s as mn,tn as hn,un as gn,vn as _n,x as vn,xn as yn,y as bn,yn as xn}from"./index-MG3T7zFQ.js";import{i as Sn,r as Cn}from"./highlighter-DvLzHjjY.js";import{t as wn}from"./zoomable-image-CIQl1Wpe.js";import{i as Tn,r as En,s as Dn,t as On}from"./markdown-BDWm6oGX.js";import{t as kn}from"./textarea-vJt9undk.js";import{t as An}from"./report-title-D4Mbu2Er.js";var jn=W(`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`}]]),Mn=W(`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`}]]),Nn=W(`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`}]]),Pn=W(`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`}]]),Fn=W(`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`}]]),In=W(`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`}]]),Ln=W(`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(),Rn=12;function zn({run:e}){let t=g(),n=j({mutationFn:()=>b(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:L.runs.detail(e.id)}),t.invalidateQueries({queryKey:L.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(!p(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)(At,{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 `,Rn,`)`]}):(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)(ce,{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 Bn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Vn=/^[A-Za-z0-9_./:=+,@%-]+$/;function Hn(e){return e.replaceAll(`'`,`'\\''`)}function Un(e){return e===``?`''`:Vn.test(e)?e:`\u0027${Hn(e)}\u0027`}function Wn(e){if(!Bn(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(Un).join(` `)}}function Gn(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 Kn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function qn(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Jn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Yn(e){let t=Gn(Kn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Jn(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]){Jn(e[2])&&i.push({label:qn(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:qn(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Jn(t)&&i.push({label:t,href:t})}return i}var Xn=(0,Z.createContext)(void 0),Zn=(0,Z.createContext)(void 0);function Qn(e,t){let n=new Map;for(let r of Yn(e)){let e=Tn(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 $n(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function er({text:e,messageKey:t}){let n=(0,Z.useContext)(En),r=(0,Z.useContext)(Zn),i=t??r;if(!n||i===void 0)return null;let a=Qn(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)(tr,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function tr({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,Z.useContext)(Xn),s=(0,Z.useContext)(bn);(0,Z.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=N(r,n),l=se(),u=le();if(c.isError)return(0,Q.jsx)(ce,{id:$n(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:l.pathname+l.search},children:i});let d=c.data?.artifact;if(d&&!Dn(d.name))return null;let f=new URLSearchParams(l.search);f.set(`report`,n),f.set(`card`,t);let p=new URLSearchParams(l.search).has(`report`)?l.state:null,m=new URLSearchParams(l.search);m.delete(`report`),m.delete(`card`);let h=`${l.pathname}${m.size?`?${m}`:``}`,g=window.navigation,_={reportCardEntry:!0,reportReturnTo:p?.reportReturnTo??h,reportReturnKey:p?.reportReturnKey??g?.currentEntry?.key,reportScrollTop:p?.reportScrollTop},v={pathname:l.pathname,search:`?${f}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,Q.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.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:d?An(d):i}),(0,Q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,Q.jsx)(ce,{id:$n(t,n),to:v,state:_,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=_.reportScrollTop??document.querySelector(`[data-slot="main"]`)?.scrollTop;u(v,{state:{..._,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 ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var nr={message:!0,reasoning:!0,tool:!0,hook:!0};function rr(e){return Object.hasOwn(nr,e)&&nr[e]}var ir=e=>e.kind===`tool`,ar=e=>e.kind===`conversation`,or=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,sr=(e,t,n)=>`${e} ${e===1?t:n}`;function cr(e,t){let n=[];return e>0&&n.push(sr(e,`file`,`files`)),t>0&&n.push(sr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function lr(e){return`${e} earlier tool call${e===1?``:`s`}`}var ur=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dr(e){for(let t of ur)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var fr=new WeakMap;function pr(e){let t=fr.get(e);if(t)return t;let n=mr(e);return fr.set(e,n),n}function mr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(ir).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=rr(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:cr(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 hr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(ar(e)){s(),c.push(e);continue}l(),ir(e)&&or(e)&&!r.has(e.id)?o.push(e):(s(),ir(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 hr(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 gr=new Map,_r=(0,Z.createContext)(null);function vr(){return(0,Z.useContext)(_r)}function yr({runId:e,children:t}){let n=(0,Z.useMemo)(()=>({get:t=>gr.get(e)?.get(t),set:(t,n)=>{let r=gr.get(e)??new Map;r.set(t,n),gr.set(e,r)}}),[e]);return(0,Q.jsx)(_r.Provider,{value:n,children:t})}function br(e){return e.scrollTop<Math.max(600,e.clientHeight)}function xr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Sr(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 Cr(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function wr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Tr=new Map;function Er(e,t){Tr.set(e,t)}function Dr(e){return Tr.get(e)}var Or=new Map;function kr(e,t){Or.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function Ar(e){return Or.get(e)}function jr(e,t,n){let r=Or.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 Mr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Nr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Pr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Fr=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Ir=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 Lr(e){let t=$(e);return t===void 0?void 0:Mr.format(t)}function Rr(e){let t=$(e);return t===void 0?void 0:Nr.format(t)}var zr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Br(e){let t=$(e);return t===void 0?void 0:zr(t)}function Vr(e,t=new Date){let n=$(e);if(n===void 0)return;let r=zr(n);return r===zr(t)?`Today`:r===zr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Pr:Fr).format(n)}function Hr(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 Ur({ts:e}){let t=Lr(e);return t===void 0?null:(0,Q.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Rr(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Wr({startedAt:e,completedAt:t}){let n=Lr(t);if(n===void 0)return null;let r=Hr(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:Rr(t),children:n}),r===void 0?null:(0,Q.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Gr({ts:e}){let t=Vr(e),n=$(e);if(t===void 0||n===void 0)return null;let r=Ir.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:Br(e),title:r,children:t}),(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Kr={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 qr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let s=Kr[e],c=r===void 0?void 0:Lr(r);return(0,Q.jsxs)(`article`,{...a,"data-role":e,"aria-label":s.speaker,className:o(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,Q.jsxs)(`p`,{className:o(`m-0 flex w-full min-w-0 items-start gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.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)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,Q.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,Q.jsx)(Ur,{ts:r})})]}),(0,Q.jsx)(`div`,{className:o(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}function Jr({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:a,onRemove:o,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 a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,Q.jsxs)(qr,{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)(ot,{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)(qr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(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:[a?(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)(Ln,{className:`size-3.5`})}):null,o?(0,Q.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),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)(xe,{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)(On,{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=>x(e.split(`/`).pop()??``)?(0,Q.jsx)(wn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,Q.jsxs)(`a`,{href:i(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)(ye,{"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 Yr=`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`,Xr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function Zr(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Xr).forEach(e=>e.remove());let r=Yn(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||!Jn(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 Qr(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=Zr(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 $r({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 Qr(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,Q.jsxs)(qr,{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:Yr,children:[(0,Q.jsx)(Pe,{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:Yr,children:[(0,Q.jsx)(Yt,{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)(On,{breaks:!0,children:e})}),(0,Q.jsx)(er,{text:e,messageKey:n})]})}function ei({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)(Lt,{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:o(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}function ti({incident:e}){let t=he().data;if(!t)return null;let n=ge(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)(Y,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function ni({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)(U,{"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)(On,{inline:!0,children:n})}),r?(0,Q.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Q.jsx)(q,{"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)(K,{children:(0,Q.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Q.jsx)(On,{children:e})})})]})}function ri(){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)(ot,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Q.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var ii={read:Yt,edit:Ln,delete:xe,move:Fn,search:be,execute:xt,think:Mn,fetch:at,task:Me,plan:ve,other:Ce},ai=e=>e.split(`
|
|
3
3
|
`).length;function oi({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 s=ai(e),c=!t&&!n&&s>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=Cr(e.currentTarget)}:void 0,className:o(`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&&s>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 ${s} lines`}):null]})}function si({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?[...ci(e.oldText).map((e,t)=>(0,Q.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...ci(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)(li,{text:e},t))})]},`${e.path}:${t}`))})}function ci(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Yn as e}from"./project-scope-context-
|
|
1
|
+
import{Yn as e}from"./project-scope-context-D3_4Nfjk.js";import{C as t,f as n,o as r}from"./task-groups-C7yO8nMy.js";function i(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}function a(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function o(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?a(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 s=[{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:o},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function c(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function l(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function u(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.extras:{automation:l(e,t.automationNames)},i=[],a=[],o=[],c={text:i,identifier:a,link:o},u=[];for(let t of s)if(t.scopes.includes(n)){if(t.kind===`reference`){u.push(()=>t.numbers(e,r));continue}for(let n of t.texts(e,r))typeof n==`string`&&c[t.kind].push(n.toLowerCase())}let d;return{prose:i,ids:a,links:o,references:()=>d??=new Set(u.flatMap(e=>e().map(String)))}}function d(e,t,n={}){let r=c(t);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=u(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 f=new Set([`running`,`waiting`]);function p(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 m(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function h(t,n=new Date){if(!e(t))return;let r=new Date(t.autoResumeAt);if(!Number.isFinite(r.getTime()))return;let i=r.toDateString()===n.toDateString(),a=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(r);return{label:i?a:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(r)} ${a}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r)}`}}function g(e){return e.steps?i({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function _(e,t,i=()=>``){let a=e.filter(e=>!r(e));return t.trim()?a.filter(e=>d(e,t,{scope:`shown`,extras:{displayTitle:n(e),automation:i(e),references:()=>v(e)}})):[...a]}function v(e){return T(e).map(e=>e.number)}function y(e,n){return e.filter(e=>t(e,n)).length}function b(e){return y(e)}function x(e){return S(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function S(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 C(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function w(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 T(e,t,n=e.projectId){let r=S(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>M(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:C(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(M(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??E(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=w(a);o.has(c)||(o.add(c),s.push(a))}return s}function E(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function D(e){return T(e)[0]}function O(e,t){if(!e.url)return!0;if(!t)return!1;let n=k(t);return n!==void 0&&k(e.url)===n}function k(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 A(e,t){let n=[];for(let r of T(e,t)){if(!O(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 j(e,t,n,r){if(O(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function M(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function N(e,t){let n=f.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:p(n.rssBytes),kind:`live`}};let r=p(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`}}}export{N as _,O as a,h as c,C as d,j as f,T as g,D as h,p as i,v as l,x as m,b as n,M as o,A as p,m as r,w as s,_ as t,y as u,g as v,d as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-DSMR_WLb.js";import{Xr as n,dr as r,ur as i}from"./project-scope-context-BiijuuWU.js";import{D as a,_ as o,g as s,h as c,p as l,v as ee}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as te}from"./format-BNCkW110.js";import{t as ne}from"./play-CmVAj_fu.js";import{t as re}from"./square-terminal-B6RYYieR.js";import{t as ie}from"./button-BQ2y4XRB.js";import{t as ae}from"./status-dot-DtAOFiIi.js";import{Xn as oe,f as se,p as ce}from"./index-D-Y1olb1.js";var le=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`}]]),f=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`}]]),p=e(),ue={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 de(e){let{text:t,...n}=ce(e),r={...n,status:t},i=ue[e.state](e);return i?{...r,action:i}:r}var fe={"Run and open":ne,Open:d,View:oe,"Start again":le};function pe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=de(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=te(i.registeredAt);return(0,p.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,p.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,p.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,p.jsx)(f,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,p.jsx)(`span`,{children:`worktree removed`}):l?(0,p.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,p.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,p.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,p.jsx)(me,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,p.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,p.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,p.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,p.jsx)(`span`,{children:`cwd`}),(0,p.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,p.jsx)(m,{icon:(0,p.jsx)(re,{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,p.jsx)(m,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function me({entry:e,inPreview:t,action:n,onOpen:r}){let{server:i}=e,a=t&&n!==void 0&&!n.run,o=a?`In preview`:n?.label,s=a?d:n?fe[n.label]:null;return n&&o&&s?(0,p.jsxs)(ie,{variant:a||n.label===`View`||n.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>r?.({port:i.port,run:n.run}),children:[(0,p.jsx)(s,{"aria-hidden":`true`}),o]}):null}function m({icon:e,children:t}){return(0,p.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,p.jsx)(`span`,{children:t})]})}function h(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var g=120;function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){let t=e.replace(/\s+/g,` `).trim();return t.length>g?`${t.slice(0,g-1)}…`:t}var y=e=>e===void 0?void 0:v(e);function b(e,...t){if(_(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function x(e,...t){return y(b(e,...t))}function he(e){if(!_(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 ge(e){if(!_(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)_(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function S(e){return x(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 b(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=ge(t);return e.length===1?e[0]:void 0}default:return b(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,y(T(e,t)))};let r=ge(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?b(t,`path`):b(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,y(E(e,t)))}}function D(e){return b(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?b(t,`url`):b(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,y(O(e,t)))}}var k=e=>b(e,`skill`,`name`,`command`),A=e=>b(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):b(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=y(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:x(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=y(A(t)),i=x(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=x(n,`server`),t=x(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:S(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()!==``?v(e):`Tool`,subtitle:S(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,y(he(t))),subtitle:x(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,y(D(t))),subtitle:x(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 he(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`&&a.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`?o:s).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 n.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=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.lastSeq=t.seq,i.draft.entry={kind:`preview-server`,id:o,server:a,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=c.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=ee.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=l.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=new Set;for(let e=t.length-1;e>=0;--e)n.add(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{t}from"./utils-DSMR_WLb.js";import{Xr as n,dr as r,ur as i}from"./project-scope-context-D3_4Nfjk.js";import{D as a,_ as o,g as s,h as c,p as l,v as ee}from"./live-protocol-D9ji1YCl.js";import{t as u}from"./createLucideIcon-BHp8sXmF.js";import{t as d}from"./app-window-CSHwDX9N.js";import{i as te}from"./format-BNCkW110.js";import{t as ne}from"./play-CmVAj_fu.js";import{t as re}from"./square-terminal-B6RYYieR.js";import{t as ie}from"./button-BQ2y4XRB.js";import{t as ae}from"./status-dot-DtAOFiIi.js";import{Xn as oe,f as se,p as ce}from"./index-MG3T7zFQ.js";var le=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`}]]),f=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`}]]),p=e(),ue={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 de(e){let{text:t,...n}=ce(e),r={...n,status:t},i=ue[e.state](e);return i?{...r,action:i}:r}var fe={"Run and open":ne,Open:d,View:oe,"Start again":le};function pe({entry:e,inPreview:n,onOpen:r}){let{server:i}=e,a=de(e),o=e.state===`unavailable`,s=r?a.action:void 0,c=se(i.command),l=te(i.registeredAt);return(0,p.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,p.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2 text-xs text-soft-foreground`,children:[(0,p.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 font-mono`,children:[(0,p.jsx)(f,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`truncate`,children:`cezar_preview_serve`})]}),o?(0,p.jsx)(`span`,{children:`worktree removed`}):l?(0,p.jsxs)(`span`,{children:[l,` ago`]}):null]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-3 gap-y-2`,children:[(0,p.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,p.jsx)(ae,{tone:a.tone,shape:a.ring?`ring`:`filled`,pulse:a.pulse===!0,"aria-hidden":`true`}),(0,p.jsx)(`span`,{className:`font-semibold text-foreground`,children:i.label}),(0,p.jsxs)(`span`,{className:`font-mono text-muted-foreground`,children:[`:`,i.port]}),(0,p.jsx)(`span`,{className:`text-muted-foreground`,children:a.status})]}),(0,p.jsx)(me,{entry:e,inPreview:n,action:s,onOpen:r})]}),(0,p.jsxs)(`div`,{className:`mt-2.5 min-w-0 rounded-md bg-muted px-3 py-2 font-mono text-xs`,children:[(0,p.jsx)(`p`,{className:`break-words whitespace-pre-wrap text-foreground`,children:i.command}),i.cwd?(0,p.jsxs)(`p`,{className:`mt-1 flex gap-3 text-soft-foreground`,children:[(0,p.jsx)(`span`,{children:`cwd`}),(0,p.jsx)(`span`,{className:`break-all`,children:i.cwd})]}):null]}),s?.run?(0,p.jsx)(m,{icon:(0,p.jsx)(re,{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,p.jsx)(m,{children:`The worktree this server ran in is gone. Register it again from a new task.`}):null]})}function me({entry:e,inPreview:t,action:n,onOpen:r}){let{server:i}=e,a=t&&n!==void 0&&!n.run,o=a?`In preview`:n?.label,s=a?d:n?fe[n.label]:null;return n&&o&&s?(0,p.jsxs)(ie,{variant:a||n.label===`View`||n.label===`Open`&&e.state===`starting`?`outline`:`contrast`,size:`sm`,className:`max-md:h-11 max-md:px-3.5`,onClick:()=>r?.({port:i.port,run:n.run}),children:[(0,p.jsx)(s,{"aria-hidden":`true`}),o]}):null}function m({icon:e,children:t}){return(0,p.jsxs)(`p`,{className:`mt-2.5 flex items-start gap-2 text-xs text-muted-foreground`,children:[e,(0,p.jsx)(`span`,{children:t})]})}function h(e,t){return e.kind===`message`&&e.role===`user`&&e.skillInput?.source===t&&typeof e.skillInput.id==`string`&&e.skillInput.id!==``}var g=120;function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function v(e){let t=e.replace(/\s+/g,` `).trim();return t.length>g?`${t.slice(0,g-1)}…`:t}var y=e=>e===void 0?void 0:v(e);function b(e,...t){if(_(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return t}}function x(e,...t){return y(b(e,...t))}function he(e){if(!_(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 ge(e){if(!_(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)_(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function S(e){return x(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 b(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`);case`filechange`:{let e=ge(t);return e.length===1?e[0]:void 0}default:return b(t,`file_path`,`filePath`,`path`)}}function _e(e,t){let n=e===`write`?`Write`:`Edit`;if(e!==`filechange`)return{toolKind:`edit`,title:C(n,y(T(e,t)))};let r=ge(t);return{toolKind:`edit`,title:C(n,r.length>1?`${r.length} files`:r[0])}}function E(e,t){return e===`imageview`?b(t,`path`):b(t,`file_path`,`filePath`,`path`)}function ve(e,t){return{toolKind:`read`,title:C(e===`imageview`?`View image`:`Read`,y(E(e,t)))}}function D(e){return b(e,`pattern`,`query`)}function O(e,t){return e===`webfetch`?b(t,`url`):b(t,`query`)}function ye(e,t){return{toolKind:`fetch`,title:C(e===`webfetch`?`Fetch`:`Web search`,y(O(e,t)))}}var k=e=>b(e,`skill`,`name`,`command`),A=e=>b(e,`subagent_type`,`subagentType`);function be(e,t){return e===`skill`?k(t):b(t,`prompt`,`task`,`description`)??A(t)}function xe(e,t){if(e===`skill`){let e=y(k(t));return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:x(t,`args`,`description`)}}let n=e===`agent`?`Agent`:`Task`,r=y(A(t)),i=x(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=x(n,`server`),t=x(n,`tool`);return e&&t?{toolKind:`other`,title:`${e}.${t}`}:{toolKind:`other`,title:`MCP tool`,subtitle:S(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()!==``?v(e):`Tool`,subtitle:S(n)}}function j(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(w.get(n)){case`execute`:return{toolKind:`execute`,title:C(`Ran`,y(he(t))),subtitle:x(t,`description`)};case`edit`:return _e(n,t);case`read`:return ve(n,t);case`search`:return{toolKind:`search`,title:C(`Search`,y(D(t))),subtitle:x(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 he(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`&&a.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`?o:s).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 n.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=r.safeParse(t.state),i=typeof t.port==`number`?e.previewByPort.get(t.port):void 0;if(!n.success||!i||i.draft.entry.kind!==`preview-server`)return;let{server:a,id:o}=i.draft.entry;i.draft.lastSeq=t.seq,i.draft.entry={kind:`preview-server`,id:o,server:a,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=c.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=ee.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=l.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=new Set;for(let e=t.length-1;e>=0;--e)n.add(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})=>!h(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,h as c,le as d,kt as i,pe as l,It as n,Ce as o,Ot as r,j as s,Dt as t,f as u};
|