@wjarka/cezarion 0.18.0-dev.8150 → 0.18.0-dev.8161
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-CZzEOP8R.js → accounts-section-xFYT_zfY.js} +1 -1
- package/web/dist/assets/{activity-motion-Jmq2_2yL.js → activity-motion-OAYNqxZ2.js} +1 -1
- package/web/dist/assets/{activity-route-SFwjSBCp.js → activity-route-cdDIR26F.js} +1 -1
- package/web/dist/assets/{agent-config-section-BumcXk5K.js → agent-config-section-B8yx4Ftt.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-VUhgYmuN.js → agent-defaults-section-BUJi0JBr.js} +1 -1
- package/web/dist/assets/{appearance-CpDAS_Ul.js → appearance-L-Mcz7xt.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-DlkEGuaI.js → archive-on-merge-field-BJoirmK5.js} +1 -1
- package/web/dist/assets/attention-D8ku2yDQ.js +1 -0
- package/web/dist/assets/{automation-format-BsnXeUET.js → automation-format-CUP262Tk.js} +1 -1
- package/web/dist/assets/{automations-route-BwDLBy9v.js → automations-route-DndFRPQ2.js} +1 -1
- package/web/dist/assets/{cez-idle-Crszm9Ts.js → cez-idle-CQtDz5jk.js} +1 -1
- package/web/dist/assets/{commit-diff-panel-DE6af9SI.js → commit-diff-panel-uXKNbpAQ.js} +1 -1
- package/web/dist/assets/{diff-DKigJrIK.js → diff-DcmpXzlx.js} +2 -2
- package/web/dist/assets/{diff-view-BV41OEIW.js → diff-view-Bu3mxoNK.js} +1 -1
- package/web/dist/assets/{file-preview-CXXKcpBz.js → file-preview-DmLdg1Ak.js} +1 -1
- package/web/dist/assets/{folder-browser-zsT1W215.js → folder-browser-DwKXxvit.js} +1 -1
- package/web/dist/assets/{git-toolbar-DM1Z5LRO.js → git-toolbar-CBMk5v-t.js} +1 -1
- package/web/dist/assets/{github-Z2_nA6EI.js → github-ktVA2Gmk.js} +1 -1
- package/web/dist/assets/{global-activity-route-DcQEMY2A.js → global-activity-route-Rx7cgzpu.js} +1 -1
- package/web/dist/assets/{index-jtycbyRq.js → index-CilVqe_c.js} +5 -5
- package/web/dist/assets/{label-9ElpAxAO.js → label-DozlouK_.js} +1 -1
- package/web/dist/assets/{live-protocol-BXzu6cSE.js → live-protocol-DteqtbyN.js} +1 -1
- package/web/dist/assets/{markdown-BDx7WnW8.js → markdown-CoC8_Mxa.js} +1 -1
- package/web/dist/assets/{notifications-section-CjgS2_uZ.js → notifications-section-CRVfC723.js} +1 -1
- package/web/dist/assets/{open-in-menu-jthe8d7_.js → open-in-menu-9Hic-2Jh.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-BdpApHW4.js → preview-pane-connected-BcePJL41.js} +1 -1
- package/web/dist/assets/{project-location-Do0zCjuE.js → project-location-YHLlezCN.js} +1 -1
- package/web/dist/assets/{project-router-DtTvMbeA.js → project-router-CYJwJlJL.js} +1 -1
- package/web/dist/assets/{project-scope-context-Dgq8_2JZ.js → project-scope-context-DqBHMdSb.js} +1 -1
- package/web/dist/assets/{projects-section-B94Rc_Ig.js → projects-section-BzJOvGbU.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-Bm4SvXEV.js → prompt-templates-section-DCXEFZeZ.js} +1 -1
- package/web/dist/assets/{queries-DfxoqDBz.js → queries-DeeY9cGJ.js} +1 -1
- package/web/dist/assets/{reference-chip-B9Cnr6jR.js → reference-chip-BSXiknFh.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-DXgS_yXZ.js → remote-settings-notice-B6gmSQmK.js} +1 -1
- package/web/dist/assets/{repo-git-C99FduHG.js → repo-git-f5cKDC-i.js} +1 -1
- package/web/dist/assets/{report-reader-BjVZrGCz.js → report-reader-D_SwO-8H.js} +1 -1
- package/web/dist/assets/{reports-DnQPedky.js → reports-CyP79G2S.js} +1 -1
- package/web/dist/assets/{resources-section-DVi14Dy4.js → resources-section-21R3ObSS.js} +1 -1
- package/web/dist/assets/{run-header-CCO4OIcD.js → run-header-CmEgf2OE.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-DjvmMcxd.js → settings-agent-picker-CIUuXcrv.js} +1 -1
- package/web/dist/assets/{settings-shell-BGvilCiB.js → settings-shell-DuQAKYA0.js} +1 -1
- package/web/dist/assets/{sidebar-section-BR6GFKTd.js → sidebar-section-D7e8bdCc.js} +1 -1
- package/web/dist/assets/{skills-BjtkIMxL.js → skills-CBHa5_n1.js} +1 -1
- package/web/dist/assets/{tab-link-Dl5Mmavw.js → tab-link-Bc33InzJ.js} +1 -1
- package/web/dist/assets/{task-changes-B8siIdj_.js → task-changes-B-daTy0n.js} +1 -1
- package/web/dist/assets/{task-commits-CGYaXoYl.js → task-commits-B8JcUxwa.js} +1 -1
- package/web/dist/assets/{task-files-HaulqF8i.js → task-files-QGAAGN7K.js} +1 -1
- package/web/dist/assets/{task-github-item-DumSw4lZ.js → task-github-item-BUQ-EaXP.js} +1 -1
- package/web/dist/assets/{task-groups-BWeTwWTP.js → task-groups-CC8zwSMv.js} +1 -1
- package/web/dist/assets/{task-thread-CeJ8GbmR.js → task-thread-BDXHF8cV.js} +1 -1
- package/web/dist/assets/{tasks-table-DS9DShj0.js → tasks-table-_5cXATkO.js} +1 -1
- package/web/dist/assets/{thread-state-BeRGkUTA.js → thread-state-CiVcAJSc.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-DAmqctoU.js → use-hand-to-agent-state-qYz6wj5e.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BnyaEFle.js → useInfiniteQuery-BswGDVd8.js} +1 -1
- package/web/dist/assets/useQuery-IS5tPlew.js +1 -0
- package/web/dist/assets/{workflows-bPgltsoh.js → workflows-CmaJn4ba.js} +1 -1
- package/web/dist/assets/{workspace-tools-Clb89tgJ.js → workspace-tools-CJ8gOVwz.js} +1 -1
- package/web/dist/assets/{worktrees-section-DdChlr21.js → worktrees-section-DmsaW6FZ.js} +1 -1
- package/web/dist/assets/{ws-Bal5BUy2.js → ws-CKLbENkm.js} +1 -1
- package/web/dist/index.html +16 -16
- package/web/dist/live-worker.js +1 -1
- package/web/dist/assets/attention-otQlgfRj.js +0 -1
- package/web/dist/assets/useQuery-BUslvRIM.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{i}from"./project-scope-context-
|
|
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{i}from"./project-scope-context-DqBHMdSb.js";import{dt as a,ft as o,pt as s,ut as c}from"./queries-DeeY9cGJ.js";import{h as l}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as u,S as d,X as f,j as p}from"./design-icons-CzEoMH9c.js";import{t as m}from"./run-header-CmEgf2OE.js";import{t as h}from"./project-router-CYJwJlJL.js";import{b as g}from"./task-groups-CC8zwSMv.js";import{t as _}from"./centered-state-V15AR_qo.js";import{C as v,Hn as y,s as b,w as x}from"./index-CilVqe_c.js";import{t as S}from"./commit-diff-panel-uXKNbpAQ.js";var C=e(t(),1),w=n(),T=77;function E({slot:e,commits:t,className:n,heading:i}){let[a,o]=(0,C.useState)(``),s=a.trim().toLowerCase(),c=s?t.filter(e=>e.subject.toLowerCase().includes(s)):t,l=c.length>150,u=(0,C.useRef)(null),d=(0,C.useRef)(null),[p,m]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=u.current,t=d.current;!e||!t||m(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l]);let h=c.map(n=>(0,w.jsx)(D,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,w.jsx)(f,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,w.jsx)(y,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>o(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,w.jsxs)(`div`,{ref:e=>{u.current=e,e&&(d.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":l,className:r(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,w.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,c.length===0?(0,w.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,l?(0,w.jsx)(b,{scrollRef:d,startMargin:p,itemSize:T,children:h}):h]})]})}function D({commit:e,detailed:t}){return(0,w.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,w.jsxs)(h,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:r(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,w.jsx)(p,{size:16,"aria-hidden":`true`,className:r(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,w.jsxs)(`span`,{className:r(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,w.jsx)(`span`,{className:r(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,w.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,w.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,w.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,w.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}function O(){let{id:e}=l(),t=c(e);return t.isPending?(0,w.jsx)(x,{tab:`changes`}):t.isError?(0,w.jsx)(v,{tab:`changes`,error:t.error}):(0,w.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=l(),n=s(e.id,g(e));return(0,w.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,w.jsx)(m,{run:e,tab:`commits`}),t?(0,w.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,w.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:n.error instanceof i&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof i&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,w.jsx)(_,{icon:(0,w.jsx)(p,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,w.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,w.jsx)(E,{slot:`task-commits`,heading:(0,w.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,w.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){return(0,w.jsx)(S,{commit:o(e,t),sha:t,backTo:`/tasks/${e}/commits`,backLabel:`All commits`,slot:`task-commit`,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`})}function j({run:e}){let t=a(e.id,g(e));return t.isPending?(0,w.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,w.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,w.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,w.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,w.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,w.jsx)(`li`,{children:(0,w.jsxs)(h,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,w.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,w.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-DSMR_WLb.js";import{M as i,i as a,s as o}from"./project-scope-context-Dgq8_2JZ.js";import{c as s,ht as c,u as l,ut as u,x as d}from"./queries-DfxoqDBz.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-CCO4OIcD.js";import{a as w,i as T,n as E,r as D}from"./file-preview-CXXKcpBz.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-jtycbyRq.js";import{r as N}from"./markdown-BDx7WnW8.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-DqBHMdSb.js";import{c as s,ht as c,u as l,ut as u,x as d}from"./queries-DeeY9cGJ.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-CmEgf2OE.js";import{a as w,i as T,n as E,r as D}from"./file-preview-DmLdg1Ak.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-CilVqe_c.js";import{r as N}from"./markdown-CoC8_Mxa.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-DqBHMdSb.js";import{D as i,M as a,U as o,in as s,q as c,t as l,ut as u,w as d}from"./queries-DeeY9cGJ.js";import{h as f}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{g as p,p as m}from"./tasks-table-_5cXATkO.js";import{F as h,ot as g,p as _}from"./design-icons-CzEoMH9c.js";import{t as v}from"./run-header-CmEgf2OE.js";import{t as y}from"./external-link-BE6y205O.js";import{u as b}from"./reference-chip-BSXiknFh.js";import{t as x}from"./button-BQ2y4XRB.js";import{t as S}from"./project-router-CYJwJlJL.js";import{t as C}from"./centered-state-V15AR_qo.js";import{C as w,S as T,qn as E}from"./index-CilVqe_c.js";import{n as D,o as O,t as k}from"./use-hand-to-agent-state-qYz6wj5e.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-DqBHMdSb.js";import"./queries-DeeY9cGJ.js";import"./attention-D8ku2yDQ.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}}function u(e){return e.command===void 0&&e.kind!==`plugin`}function d(e){let t=e.workflowCursor?.mode===`resume`?e.workflowCursor.stepId:void 0;if(t&&e.steps.find(e=>e.id===t)?.status===`failed`)return t;let n=o(e.steps);if(n)return n.synthetic===`continuation`&&n.continuesStepId!==void 0?n.continuesStepId:e.steps.find(e=>e.sessionId===n.sessionId)?.id??n.id}function f(e,t=!1){if(e.delegation?.role!==`worker`)return;let n=e.workflowDef?.steps;if(!n?.length)return;if(t)return n.find(u);let r=d(e);return(r?n.find(e=>e.id===r&&u(e)):void 0)??[...n].reverse().find(u)}var p=new Set([`queued`,`running`,`waiting`]);function m(e){return p.has(e)}function h(e){return i(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function g(e){return h(e)&&e.status!==`queued`}function _(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 v=[`done`,`failed`];function y(e){return e.archived||i(e)||!v.includes(e.status)?!1:e.finishedAt!==void 0}function b(e){let t=e.finishedAt;return t===void 0||!y(e)?!1:e.seenAt===void 0||e.seenAt<t}var x=[`Needs you`,`Finished`,`Working`,`Archived`],S={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},C=3,w=e=>i(e)?C:S[e.status]??9;function T(t){let n=t=>e[a(t).bucket];return[...t].sort((e,t)=>n(e)-n(t)||w(e)-w(t))[0]}function E(e,t){return t===`archived`?`Archived`:n(e)?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function D(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function O(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 k(e,t){return t!==void 0&&O(e).ref===t}function A(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 j(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=w(e)-w(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 M(e){return e.delegation?.role===`worker`}function N(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!M(n)?e:n.delegation?.parentRunId??e}function P(e,t,n=A(e)){let r=j(e,t).filter(e=>!M(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(E(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return x.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function F(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 I(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 L(e){let t=0,r=0,i=0;for(let a of e)if(!M(a)){if(a.archived){r+=1;continue}t+=1,n(a)&&(i+=1)}return{active:t,archived:r,waiting:i}}function R(e,n,r){return e.filter(e=>!e.archived&&(!r||t(e)===(n===`automations`)))}var z={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},B=Object.keys(z),V=`section`;function H(e,t,n){let r=`${V}=${z[e]}`;return n?`/?origin=${t===`automations`?`automations`:`direct`}&${r}`:`/?${r}`}function U(e){return B.find(t=>z[t]===e)??null}function W(e,r){let i={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let a of e){if(M(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{_ as C,s as D,o as E,f as O,g as S,l as T,O as _,P as a,h as b,T as c,k as d,D as f,R as g,W as h,F as i,U as l,N as m,V as n,M as o,H as p,B as r,L as s,x as t,A as u,I as v,b as w,m as x,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-Dgq8_2JZ.js";import{Ft as w,It as T,J as E,M as D,P as O,R as ee,St as k,U as te,Ut as A,Zt as ne,_t as re,b as ie,en as j,in as M,it as N,l as P,mt as ae,nn as F,o as I,p as L,rn as R,t as z,ut as oe,vt as B,zt as V}from"./queries-DfxoqDBz.js";import{t as se}from"./useQuery-BUslvRIM.js";import{f as ce,h as le,n as ue,p as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as fe,m as pe,r as me,s as he,v as ge}from"./tasks-table-DS9DShj0.js";import{n as H}from"./toaster-Bo5vCbz-.js";import{A as _e,B as U,F as ve,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 W,ut as Ne,v as Pe,y as Fe,z as Ie}from"./design-icons-CzEoMH9c.js";import{t as G}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-CCO4OIcD.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-BeRGkUTA.js";import{i as _t,o as vt,t as yt,u as bt}from"./reference-chip-B9Cnr6jR.js";import{t as xt}from"./square-terminal-B6RYYieR.js";import{t as K}from"./button-BQ2y4XRB.js";import{n as q,r as J,t as Y}from"./collapsible-BEV4FO-1.js";import{a as St}from"./popover-BPgUYFyu.js";import{s as Ct,t as X}from"./project-router-DtTvMbeA.js";import"./attention-otQlgfRj.js";import{D as wt,E as Tt,O as Et,S as Dt,b as Ot,f as Z,u as kt,w as At}from"./task-groups-BWeTwWTP.js";import{t as jt}from"./status-dot-DtAOFiIi.js";import{n as Mt,t as Nt}from"./centered-state-V15AR_qo.js";import{$t as Pt,F as Ft,Fn as It,G as Lt,Gn as Rt,I as zt,In as Bt,K as Vt,M as Ht,Mn as Ut,N as Wt,Nn as Gt,P as Kt,Pn as qt,W as Jt,X as Yt,Xn as Xt,Y as Zt,_n as Qt,an as $t,dn as en,fn as tn,gn as nn,i as rn,in as an,j as on,l as sn,ln as cn,m as ln,mn as un,n as dn,nn as fn,on as pn,pn as mn,s as hn,tn as gn,un as _n,vn,x as yn,xn as bn,y as xn,yn as Sn}from"./index-jtycbyRq.js";import{i as Cn,r as wn}from"./highlighter-DvLzHjjY.js";import{t as Tn}from"./zoomable-image-CIQl1Wpe.js";import{i as En,r as Dn,s as On,t as kn}from"./markdown-BDx7WnW8.js";import{t as An}from"./textarea-vJt9undk.js";import{t as jn}from"./report-title-D4Mbu2Er.js";var Mn=G(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Nn=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Pn=G(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Fn=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),In=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ln=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Rn=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=e(t(),1),$=r(),zn=12;function Bn({run:e}){let t=g(),n=M({mutationFn:()=>b(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),H(`This task will not resume itself`)},onError:e=>H(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,$.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,$.jsx)(jt,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,$.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,zn,`)`]}):(0,$.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,$.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,$.jsx)(ue,{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 Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Hn=/^[A-Za-z0-9_./:=+,@%-]+$/;function Un(e){return e.replaceAll(`'`,`'\\''`)}function Wn(e){return e===``?`''`:Hn.test(e)?e:`\u0027${Un(e)}\u0027`}function Gn(e){if(!Vn(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(Wn).join(` `)}}function Kn(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 qn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Jn(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Yn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Xn(e){let t=Kn(qn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Yn(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]){Yn(e[2])&&i.push({label:Jn(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:Jn(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Yn(t)&&i.push({label:t,href:t})}return i}var Zn=(0,Q.createContext)(void 0),Qn=(0,Q.createContext)(void 0);function $n(e,t){let n=new Map;for(let r of Xn(e)){let e=En(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 er(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function tr({text:e,messageKey:t}){let n=(0,Q.useContext)(Dn),r=(0,Q.useContext)(Qn),i=t??r;if(!n||i===void 0)return null;let a=$n(e,n);return a.length===0?null:(0,$.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,$.jsx)(nr,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function nr({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,Q.useContext)(Zn),s=(0,Q.useContext)(xn);(0,Q.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=P(r,n),l=ce(),u=de();if(c.isError)return(0,$.jsx)(ue,{id:er(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:l.pathname+l.search},children:i});let d=c.data?.artifact;if(d&&!On(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,$.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,$.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:d?jn(d):i}),(0,$.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,$.jsx)(ue,{id:er(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 rr={message:!0,reasoning:!0,tool:!0,hook:!0};function ir(e){return Object.hasOwn(rr,e)&&rr[e]}var ar=e=>e.kind===`tool`,or=e=>e.kind===`conversation`,sr=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,cr=(e,t,n)=>`${e} ${e===1?t:n}`;function lr(e,t){let n=[];return e>0&&n.push(cr(e,`file`,`files`)),t>0&&n.push(cr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ur(e){return`${e} earlier tool call${e===1?``:`s`}`}var dr=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function fr(e){for(let t of dr)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 pr=new WeakMap;function mr(e){let t=pr.get(e);if(t)return t;let n=hr(e);return pr.set(e,n),n}function hr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(ar).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=ir(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:lr(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 gr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(or(e)){s(),c.push(e);continue}l(),ar(e)&&sr(e)&&!r.has(e.id)?o.push(e):(s(),ar(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 gr(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 _r=new Map,vr=(0,Q.createContext)(null);function yr(){return(0,Q.useContext)(vr)}function br({runId:e,children:t}){let n=(0,Q.useMemo)(()=>({get:t=>_r.get(e)?.get(t),set:(t,n)=>{let r=_r.get(e)??new Map;r.set(t,n),_r.set(e,r)}}),[e]);return(0,$.jsx)(vr.Provider,{value:n,children:t})}function xr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Sr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Cr(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 wr(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Tr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Er=new Map;function Dr(e,t){Er.set(e,t)}function Or(e){return Er.get(e)}var kr=new Map;function Ar(e,t){kr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function jr(e){return kr.get(e)}function Mr(e,t,n){let r=kr.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 Nr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Pr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Fr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Ir=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Lr=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Rr(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function zr(e){let t=Rr(e);return t===void 0?void 0:Nr.format(t)}function Br(e){let t=Rr(e);return t===void 0?void 0:Pr.format(t)}var Vr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Hr(e){let t=Rr(e);return t===void 0?void 0:Vr(t)}function Ur(e,t=new Date){let n=Rr(e);if(n===void 0)return;let r=Vr(n);return r===Vr(t)?`Today`:r===Vr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Fr:Ir).format(n)}function Wr(e,t){let n=Rr(e),r=Rr(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 Gr({ts:e}){let t=zr(e);return t===void 0?null:(0,$.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Br(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Kr({startedAt:e,completedAt:t}){let n=zr(t);if(n===void 0)return null;let r=Wr(e,t);return(0,$.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,$.jsx)(`time`,{dateTime:t,title:Br(t),children:n}),r===void 0?null:(0,$.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function qr({ts:e}){let t=Ur(e),n=Rr(e);if(t===void 0||n===void 0)return null;let r=Lr.format(n);return(0,$.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,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,$.jsx)(`time`,{dateTime:Hr(e),title:r,children:t}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Jr={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 Yr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let s=Jr[e],c=r===void 0?void 0:zr(r);return(0,$.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,$.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,$.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,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,$.jsx)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,$.jsx)(Gr,{ts:r})})]}),(0,$.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 Xr({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,Q.useState)(!1),[p,m]=(0,Q.useState)(e),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.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,$.jsxs)(Yr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,$.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,$.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,$.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,$.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,$.jsx)(ot,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,$.jsxs)(Yr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,$.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,$.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,$.jsx)(Rn,{className:`size-3.5`})}):null,o?(0,$.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,$.jsx)(xe,{className:`size-3.5`})}):null]}):null,_?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,$.jsx)(kn,{breaks:!0,children:e}),n.length>0?(0,$.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,$.jsx)(Tn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,$.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,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,$.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Zr=`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`,Qr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function $r(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Qr).forEach(e=>e.remove());let r=Xn(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||!Yn(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 ei(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=$r(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 ti({text:e,ts:t,messageKey:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await ei(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,$.jsxs)(Yr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,$.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Zr,children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Zr,children:[(0,$.jsx)(Xt,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,$.jsx)(`div`,{ref:r,children:(0,$.jsx)(kn,{breaks:!0,children:e})}),(0,$.jsx)(tr,{text:e,messageKey:n})]})}function ni({note:e}){return e.icon===`handoff`?(0,$.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,$.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,$.jsx)(Rt,{className:`size-3`})}),(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,$.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 ri({incident:e}){let t=A().data;if(!t)return null;let n=T(t,e.provider);return(0,$.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,$.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,$.jsx)(X,{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 ii({text:e}){let t=(0,Q.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-DqBHMdSb.js";import{Ft as w,It as T,J as E,M as D,P as O,R as ee,St as k,U as te,Ut as A,Zt as ne,_t as re,b as ie,en as j,in as M,it as N,l as P,mt as ae,nn as F,o as I,p as L,rn as R,t as z,ut as oe,vt as B,zt as V}from"./queries-DeeY9cGJ.js";import{t as se}from"./useQuery-IS5tPlew.js";import{f as ce,h as le,n as ue,p as de}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{d as fe,m as pe,r as me,s as he,v as ge}from"./tasks-table-_5cXATkO.js";import{n as H}from"./toaster-Bo5vCbz-.js";import{A as _e,B as U,F as ve,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 W,ut as Ne,v as Pe,y as Fe,z as Ie}from"./design-icons-CzEoMH9c.js";import{t as G}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-CmEgf2OE.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-CiVcAJSc.js";import{i as _t,o as vt,t as yt,u as bt}from"./reference-chip-BSXiknFh.js";import{t as xt}from"./square-terminal-B6RYYieR.js";import{t as K}from"./button-BQ2y4XRB.js";import{n as q,r as J,t as Y}from"./collapsible-BEV4FO-1.js";import{a as St}from"./popover-BPgUYFyu.js";import{s as Ct,t as X}from"./project-router-CYJwJlJL.js";import"./attention-D8ku2yDQ.js";import{D as wt,E as Tt,O as Et,S as Dt,b as Ot,f as Z,u as kt,w as At}from"./task-groups-CC8zwSMv.js";import{t as jt}from"./status-dot-DtAOFiIi.js";import{n as Mt,t as Nt}from"./centered-state-V15AR_qo.js";import{$t as Pt,F as Ft,Fn as It,G as Lt,Gn as Rt,I as zt,In as Bt,K as Vt,M as Ht,Mn as Ut,N as Wt,Nn as Gt,P as Kt,Pn as qt,W as Jt,X as Yt,Xn as Xt,Y as Zt,_n as Qt,an as $t,dn as en,fn as tn,gn as nn,i as rn,in as an,j as on,l as sn,ln as cn,m as ln,mn as un,n as dn,nn as fn,on as pn,pn as mn,s as hn,tn as gn,un as _n,vn,x as yn,xn as bn,y as xn,yn as Sn}from"./index-CilVqe_c.js";import{i as Cn,r as wn}from"./highlighter-DvLzHjjY.js";import{t as Tn}from"./zoomable-image-CIQl1Wpe.js";import{i as En,r as Dn,s as On,t as kn}from"./markdown-CoC8_Mxa.js";import{t as An}from"./textarea-vJt9undk.js";import{t as jn}from"./report-title-D4Mbu2Er.js";var Mn=G(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Nn=G(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),Pn=G(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Fn=G(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),In=G(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),Ln=G(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Rn=G(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Q=e(t(),1),$=r(),zn=12;function Bn({run:e}){let t=g(),n=M({mutationFn:()=>b(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),H(`This task will not resume itself`)},onError:e=>H(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,$.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,$.jsx)(jt,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,$.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,zn,`)`]}):(0,$.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,$.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,$.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,$.jsx)(ue,{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 Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Hn=/^[A-Za-z0-9_./:=+,@%-]+$/;function Un(e){return e.replaceAll(`'`,`'\\''`)}function Wn(e){return e===``?`''`:Hn.test(e)?e:`\u0027${Un(e)}\u0027`}function Gn(e){if(!Vn(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(Wn).join(` `)}}function Kn(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 qn(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function Jn(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function Yn(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Xn(e){let t=Kn(qn(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))Yn(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]){Yn(e[2])&&i.push({label:Jn(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:Jn(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&Yn(t)&&i.push({label:t,href:t})}return i}var Zn=(0,Q.createContext)(void 0),Qn=(0,Q.createContext)(void 0);function $n(e,t){let n=new Map;for(let r of Xn(e)){let e=En(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 er(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function tr({text:e,messageKey:t}){let n=(0,Q.useContext)(Dn),r=(0,Q.useContext)(Qn),i=t??r;if(!n||i===void 0)return null;let a=$n(e,n);return a.length===0?null:(0,$.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,$.jsx)(nr,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function nr({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,Q.useContext)(Zn),s=(0,Q.useContext)(xn);(0,Q.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=P(r,n),l=ce(),u=de();if(c.isError)return(0,$.jsx)(ue,{id:er(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:l.pathname+l.search},children:i});let d=c.data?.artifact;if(d&&!On(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,$.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,$.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:d?jn(d):i}),(0,$.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,$.jsx)(ue,{id:er(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 rr={message:!0,reasoning:!0,tool:!0,hook:!0};function ir(e){return Object.hasOwn(rr,e)&&rr[e]}var ar=e=>e.kind===`tool`,or=e=>e.kind===`conversation`,sr=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,cr=(e,t,n)=>`${e} ${e===1?t:n}`;function lr(e,t){let n=[];return e>0&&n.push(cr(e,`file`,`files`)),t>0&&n.push(cr(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ur(e){return`${e} earlier tool call${e===1?``:`s`}`}var dr=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function fr(e){for(let t of dr)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 pr=new WeakMap;function mr(e){let t=pr.get(e);if(t)return t;let n=hr(e);return pr.set(e,n),n}function hr(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(ar).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=ir(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:lr(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 gr(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(or(e)){s(),c.push(e);continue}l(),ar(e)&&sr(e)&&!r.has(e.id)?o.push(e):(s(),ar(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 gr(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 _r=new Map,vr=(0,Q.createContext)(null);function yr(){return(0,Q.useContext)(vr)}function br({runId:e,children:t}){let n=(0,Q.useMemo)(()=>({get:t=>_r.get(e)?.get(t),set:(t,n)=>{let r=_r.get(e)??new Map;r.set(t,n),_r.set(e,r)}}),[e]);return(0,$.jsx)(vr.Provider,{value:n,children:t})}function xr(e){return e.scrollTop<Math.max(600,e.clientHeight)}function Sr(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function Cr(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 wr(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Tr(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Er=new Map;function Dr(e,t){Er.set(e,t)}function Or(e){return Er.get(e)}var kr=new Map;function Ar(e,t){kr.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function jr(e){return kr.get(e)}function Mr(e,t,n){let r=kr.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 Nr=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),Pr=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Fr=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Ir=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Lr=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Rr(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function zr(e){let t=Rr(e);return t===void 0?void 0:Nr.format(t)}function Br(e){let t=Rr(e);return t===void 0?void 0:Pr.format(t)}var Vr=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Hr(e){let t=Rr(e);return t===void 0?void 0:Vr(t)}function Ur(e,t=new Date){let n=Rr(e);if(n===void 0)return;let r=Vr(n);return r===Vr(t)?`Today`:r===Vr(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Fr:Ir).format(n)}function Wr(e,t){let n=Rr(e),r=Rr(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 Gr({ts:e}){let t=zr(e);return t===void 0?null:(0,$.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:Br(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Kr({startedAt:e,completedAt:t}){let n=zr(t);if(n===void 0)return null;let r=Wr(e,t);return(0,$.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,$.jsx)(`time`,{dateTime:t,title:Br(t),children:n}),r===void 0?null:(0,$.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function qr({ts:e}){let t=Ur(e),n=Rr(e);if(t===void 0||n===void 0)return null;let r=Lr.format(n);return(0,$.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,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,$.jsx)(`time`,{dateTime:Hr(e),title:r,children:t}),(0,$.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var Jr={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 Yr({role:e,children:t,className:n,ts:r,headerActions:i,...a}){let s=Jr[e],c=r===void 0?void 0:zr(r);return(0,$.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,$.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,$.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,$.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,$.jsx)(st,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),i]}),c===void 0?null:(0,$.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,$.jsx)(Gr,{ts:r})})]}),(0,$.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 Xr({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,Q.useState)(!1),[p,m]=(0,Q.useState)(e),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.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,$.jsxs)(Yr,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,$.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,$.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,$.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,$.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,$.jsx)(ot,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,$.jsxs)(Yr,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,$.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,$.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,$.jsx)(Rn,{className:`size-3.5`})}):null,o?(0,$.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,$.jsx)(xe,{className:`size-3.5`})}):null]}):null,_?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,$.jsx)(kn,{breaks:!0,children:e}),n.length>0?(0,$.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,$.jsx)(Tn,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,$.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,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,$.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}var Zr=`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`,Qr=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function $r(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Qr).forEach(e=>e.remove());let r=Xn(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||!Yn(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 ei(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=$r(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 ti({text:e,ts:t,messageKey:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),c=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await ei(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,$.jsxs)(Yr,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,$.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Zr,children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Zr,children:[(0,$.jsx)(Xt,{className:`size-3.5`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,$.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,$.jsx)(`div`,{ref:r,children:(0,$.jsx)(kn,{breaks:!0,children:e})}),(0,$.jsx)(tr,{text:e,messageKey:n})]})}function ni({note:e}){return e.icon===`handoff`?(0,$.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,$.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,$.jsx)(Rt,{className:`size-3`})}),(0,$.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,$.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 ri({incident:e}){let t=A().data;if(!t)return null;let n=T(t,e.provider);return(0,$.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,$.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,$.jsx)(X,{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 ii({text:e}){let t=(0,Q.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
2
|
`,1)[0]??``,r=n.length<e.length;return(0,$.jsxs)(Y,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,$.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,$.jsx)(W,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,$.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,$.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,$.jsx)(kn,{inline:!0,children:n})}),r?(0,$.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,$.jsx)(J,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,$.jsx)(q,{children:(0,$.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,$.jsx)(kn,{children:e})})})]})}function ai(){return(0,$.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,$.jsx)(ot,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,$.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var oi={read:Xt,edit:Rn,delete:xe,move:In,search:be,execute:xt,think:Nn,fetch:at,task:Me,plan:U,other:Ce},si=e=>e.split(`
|
|
3
3
|
`).length;function ci({text:e,streaming:t}){let[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=si(e),c=!t&&!n&&s>12;return(0,$.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=wr(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,$.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,$.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,$.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 li({diffs:e}){return(0,$.jsx)($.Fragment,{children:e.map((e,t)=>(0,$.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,$.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,$.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...ui(e.oldText).map((e,t)=>(0,$.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...ui(e.newText).map((e,t)=>(0,$.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
4
|
`).map((e,t)=>(0,$.jsx)(di,{text:e},t))})]},`${e.path}:${t}`))})}function ui(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-DqBHMdSb.js";import{C as t,f as n,o as r}from"./task-groups-CC8zwSMv.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-Dgq8_2JZ.js";import{_ as a,g as o,h as s,k as c,p as l,v as ee}from"./live-protocol-BXzu6cSE.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-jtycbyRq.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`&&c.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`?a:o).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=s.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:c}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:c})}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-DqBHMdSb.js";import{_ as a,g as o,h as s,k as c,p as l,v as ee}from"./live-protocol-DteqtbyN.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-CilVqe_c.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`&&c.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`?a:o).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=s.safeParse(t);if(!n.success)return;let{message:r,delivery:i,deliveredAt:a,consumedAt:o,ts:c}=n.data;G(e,r,i,{deliveredAt:a,consumedAt:o,recordedAt:c})}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};
|