@wjarka/cezarion 0.11.2 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/index.js +2 -1
- package/dist/contract/workspace.d.ts +14 -0
- package/dist/core/opencode-model-catalog.d.ts +5 -5
- package/dist/core/opencode-model-catalog.js +96 -34
- package/dist/core/opencode-model-catalog.js.map +1 -1
- package/dist/core/opencode-server-runner.js +37 -2
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-model-catalog.d.ts +7 -0
- package/dist/core/pi-model-catalog.js +123 -26
- package/dist/core/pi-model-catalog.js.map +1 -1
- package/dist/core/pi-runner.js +12 -10
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/core/pi-ui-mapper.d.ts +1 -0
- package/dist/core/pi-ui-mapper.js +68 -11
- package/dist/core/pi-ui-mapper.js.map +1 -1
- package/dist/core/runner-model-catalog.d.ts +2 -0
- package/dist/core/runner-model-catalog.js.map +1 -1
- package/dist/server/server.d.ts +1 -0
- package/dist/workflows/run.d.ts +3 -0
- package/dist/workflows/run.js +48 -21
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-pi-rpc.mjs +49 -2
- package/web/dist/assets/{alert-dialog-g-GVThSw.js → alert-dialog-Bib2-aHJ.js} +1 -1
- package/web/dist/assets/arrow-down-DF9UfPoy.js +1 -0
- package/web/dist/assets/arrow-left-BVgebuvi.js +1 -0
- package/web/dist/assets/{centered-state-DdbE_pNl.js → centered-state-TyZe3tga.js} +1 -1
- package/web/dist/assets/chevron-right-W2B4c3Bn.js +1 -0
- package/web/dist/assets/{collapsible-R1r7zUOB.js → collapsible-DTRw1YnV.js} +1 -1
- package/web/dist/assets/{commit-list-Bgb1DHBX.js → commit-list-BKtzO28W.js} +1 -1
- package/web/dist/assets/{compare-variants-UA_0n_5a.js → compare-variants--E1SPJzi.js} +1 -1
- package/web/dist/assets/{diff-Cv3z9esx.js → diff-DtXK3tZy.js} +2 -2
- package/web/dist/assets/{diff-stat-ydfu0_5T.js → diff-stat-CJSJmLcb.js} +1 -1
- package/web/dist/assets/{diff-view-DnPdkmk2.js → diff-view-wZScCPoa.js} +1 -1
- package/web/dist/assets/{dropdown-menu-CPP9gEmn.js → dropdown-menu-CQp168wo.js} +1 -1
- package/web/dist/assets/editable-title-BWosq6YG.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-WNkaehnw.js → ellipsis-vertical-BXllsyll.js} +1 -1
- package/web/dist/assets/{file-RvhJlchx.js → file-BgcgwEU-.js} +1 -1
- package/web/dist/assets/{folder-Dz-weqBo.js → folder-DGrkgLg9.js} +1 -1
- package/web/dist/assets/{git-toolbar-BEKuAjHk.js → git-toolbar-D9Wu2J60.js} +1 -1
- package/web/dist/assets/{github-CmFHDNje.js → github-xAF2VFFK.js} +1 -1
- package/web/dist/assets/{image-preview-DYiOSYoY.js → image-preview-Cd7b7Evu.js} +1 -1
- package/web/dist/assets/index-CKWqcYjr.js +7 -0
- package/web/dist/assets/{markdown-DQHRRO9e.js → markdown-Cvzv-jvo.js} +1 -1
- package/web/dist/assets/new-task-form-CZAdHx_5.js +1 -0
- package/web/dist/assets/{pill-FAFXjmY6.js → pill-B9vrSbT6.js} +1 -1
- package/web/dist/assets/{project-router-Dzc0JK2j.js → project-router-CF-1GU39.js} +1 -1
- package/web/dist/assets/{prompt-templates-DmqtzSPL.js → prompt-templates-CSmaXZ5G.js} +1 -1
- package/web/dist/assets/{refresh-cw-BP4TkA4M.js → refresh-cw-D5a-hkgq.js} +1 -1
- package/web/dist/assets/{repo-git-C20pc5tT.js → repo-git-BicCjDSy.js} +1 -1
- package/web/dist/assets/{run-diff-CvcsWwew.js → run-diff-DWzdGMTg.js} +1 -1
- package/web/dist/assets/run-header-Cc7KFOMX.js +1 -0
- package/web/dist/assets/{search-x-Drnmsmd0.js → search-x-DJIOs-nB.js} +1 -1
- package/web/dist/assets/{skill-empty-hint-D2l_OqZ5.js → skill-empty-hint-BcecPZ6K.js} +1 -1
- package/web/dist/assets/skills-BKYATWFF.js +1 -0
- package/web/dist/assets/{sparkles-B9ja4FHw.js → sparkles-C-1JzGqe.js} +1 -1
- package/web/dist/assets/{square-terminal-CB2du-YG.js → square-terminal-CnrkOecA.js} +1 -1
- package/web/dist/assets/{tab-link-C5FWJ66Y.js → tab-link-CQgzNUwP.js} +1 -1
- package/web/dist/assets/{task-changes-CuUmQArS.js → task-changes--AyxNXvn.js} +1 -1
- package/web/dist/assets/{task-commits-DgIWIhW9.js → task-commits-DlBBODPF.js} +1 -1
- package/web/dist/assets/{task-files-BeDXPyz5.js → task-files-DZ49FGVz.js} +1 -1
- package/web/dist/assets/task-thread-D10akRi2.js +9 -0
- package/web/dist/assets/{textarea-Sm6doUPO.js → textarea-BPMIukW0.js} +1 -1
- package/web/dist/assets/{thread-loading-DojNeADh.js → thread-loading-C9cWYGbd.js} +1 -1
- package/web/dist/assets/{trash-2-C_lGBXG2.js → trash-2-CwmIdbv2.js} +1 -1
- package/web/dist/assets/{triangle-alert-Brk_ldFl.js → triangle-alert-BU7Fnc0D.js} +1 -1
- package/web/dist/assets/{upload-Cxs1UROt.js → upload-B54t9i6X.js} +1 -1
- package/web/dist/assets/{use-desktop-Cmrz3npD.js → use-desktop-Co7z3Xov.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-DzeqN3GK.js → use-submit-shortcut-DfJM2Y1U.js} +1 -1
- package/web/dist/assets/{utils-Unt0mZvU.js → utils-BLZyueuK.js} +1 -1
- package/web/dist/assets/{workflows-D_GyBbup.js → workflows-CfC6b8y4.js} +1 -1
- package/web/dist/assets/{zoomable-image-ByySCppM.js → zoomable-image-BQMum6hd.js} +1 -1
- package/web/dist/index.html +22 -22
- package/web/dist/assets/arrow-down-BzmL0uj0.js +0 -1
- package/web/dist/assets/arrow-left-DtUM7GFU.js +0 -1
- package/web/dist/assets/chevron-right-DnLh0uM2.js +0 -1
- package/web/dist/assets/editable-title-D_bWdmY0.js +0 -1
- package/web/dist/assets/index-BQTfjxFm.js +0 -7
- package/web/dist/assets/new-task-form-D2KlpqYC.js +0 -1
- package/web/dist/assets/run-header-xFlbebSJ.js +0 -1
- package/web/dist/assets/skills-Cn2ppPow.js +0 -1
- package/web/dist/assets/task-thread-2nmi0vcz.js +0 -9
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,s as f,u as p,w as m,x as h,y as g}from"./centered-state-DdbE_pNl.js";import{m as _,r as v,t as y}from"./utils-Unt0mZvU.js";import{f as b,g as x,h as S,m as ee,p as C}from"./dropdown-menu-CPP9gEmn.js";var te=v(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),ne=v(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),re=v(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),ie=v(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),w=v(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),ae=v(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),T=e(t(),1),E=n(),D=`Popover`,[O,oe]=a(D,[x]),k=x(),[A,j]=O(D),M=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!1}=e,c=k(t),l=T.useRef(null),[d,f]=T.useState(!1),[p,m]=i({prop:r,defaultProp:a??!1,onChange:o,caller:D});return(0,E.jsx)(S,{...c,children:(0,E.jsx)(A,{scope:t,contentId:u(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:T.useCallback(()=>m(e=>!e),[m]),hasCustomAnchor:d,onCustomAnchorAdd:T.useCallback(()=>f(!0),[]),onCustomAnchorRemove:T.useCallback(()=>f(!1),[]),modal:s,children:n})})};M.displayName=D;var N=`PopoverAnchor`,P=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(N,n),a=k(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return T.useEffect(()=>(o(),()=>s()),[o,s]),(0,E.jsx)(b,{...a,...r,ref:t})});P.displayName=N;var F=`PopoverTrigger`,I=T.forwardRef((e,t)=>{let{__scopePopover:n,...i}=e,a=j(F,n),o=k(n),s=r(t,a.triggerRef),c=(0,E.jsx)(h.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...i,ref:s,onClick:g(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?c:(0,E.jsx)(b,{asChild:!0,...o,children:c})});I.displayName=F;var L=`PopoverPortal`,[se,R]=O(L,{forceMount:void 0}),z=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=j(L,t);return(0,E.jsx)(se,{scope:t,forceMount:n,children:(0,E.jsx)(l,{present:n||a.open,children:(0,E.jsx)(p,{asChild:!0,container:i,children:r})})})};z.displayName=L;var B=`PopoverContent`,V=T.forwardRef((e,t)=>{let n=R(B,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=j(B,e.__scopePopover);return(0,E.jsx)(l,{present:r||a.open,children:a.modal?(0,E.jsx)(U,{...i,ref:t}):(0,E.jsx)(W,{...i,ref:t})})});V.displayName=B;var H=m(`PopoverContent.RemoveScroll`),U=T.forwardRef((e,t)=>{let n=j(B,e.__scopePopover),i=T.useRef(null),a=r(t,i),s=T.useRef(!1);return T.useEffect(()=>{let e=i.current;if(e)return f(e)},[]),(0,E.jsx)(o,{as:H,allowPinchZoom:!0,children:(0,E.jsx)(G,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{e.preventDefault(),s.current||n.triggerRef.current?.focus()}),onPointerDownOutside:g(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;s.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),W=T.forwardRef((e,t)=>{let n=j(B,e.__scopePopover),r=T.useRef(!1),i=T.useRef(!1);return(0,E.jsx)(G,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),G=T.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onInteractOutside:p,...m}=e,h=j(B,n),g=k(n);return d(),(0,E.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,E.jsx)(c,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:p,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:f,onDismiss:()=>h.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,E.jsx)(ee,{"data-state":q(h.open),role:`dialog`,id:h.contentId,...g,...m,ref:t,style:{...m.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),K=`PopoverClose`,ce=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=j(K,n);return(0,E.jsx)(h.button,{type:`button`,...r,ref:t,onClick:g(e.onClick,()=>i.onOpenChange(!1))})});ce.displayName=K;var le=`PopoverArrow`,ue=T.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=k(n);return(0,E.jsx)(C,{...i,...r,ref:t})});ue.displayName=le;function q(e){return e?`open`:`closed`}var de=M,fe=P,pe=I,me=z,he=V;function J(e){let t=e.visualViewport;return t?Math.max(0,Math.round(e.innerHeight-t.height-t.offsetTop)):0}function Y(e,t,n,r=250){let i=e.visualViewport;if(!i)return t(0),()=>{};let a,o=()=>{let i=J(e);t(i),n&&(clearTimeout(a),a=setTimeout(()=>n(i),r))};return t(J(e)),i.addEventListener(`resize`,o),i.addEventListener(`scroll`,o),()=>{clearTimeout(a),i.removeEventListener(`resize`,o),i.removeEventListener(`scroll`,o),t(0)}}function ge(e){let t=e.visualViewport;return t?{top:Math.max(0,Math.round(t.offsetTop)),bottom:J(e)}:{top:0,bottom:0}}function _e(e,t=0){let n=typeof t==`number`?{top:t,right:t,bottom:t,left:t}:t;return{top:(n.top??0)+e.top,right:n.right??0,bottom:(n.bottom??0)+e.bottom,left:n.left??0}}function ve(e,t){let n=e.visualViewport;if(!n)return t({top:0,bottom:0}),()=>{};let r=()=>t(ge(e));return r(),n.addEventListener(`resize`,r),n.addEventListener(`scroll`,r),()=>{n.removeEventListener(`resize`,r),n.removeEventListener(`scroll`,r)}}function ye(){let[e,t]=(0,T.useState)({top:0,bottom:0});return(0,T.useEffect)(()=>ve(window,e=>t(t=>t.top===e.top&&t.bottom===e.bottom?t:e)),[]),e}function be(e){let t=(0,T.useRef)(e);t.current=e,(0,T.useEffect)(()=>{let e=document.documentElement;return Y(window,t=>e.style.setProperty(`--kb`,`${t}px`),e=>t.current?.(e))},[])}function xe({...e}){return(0,E.jsx)(de,{"data-slot":`popover`,...e})}function Se({...e}){return(0,E.jsx)(pe,{"data-slot":`popover-trigger`,...e})}function Ce({className:e,align:t=`center`,sideOffset:n=4,collisionPadding:r,...i}){let a=ye();return(0,E.jsx)(me,{children:(0,E.jsx)(he,{"data-slot":`popover-content`,align:t,sideOffset:n,collisionPadding:_e(a,r),className:y(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...i})})}function we({...e}){return(0,E.jsx)(fe,{"data-slot":`popover-anchor`,...e})}var Te=`quick-task`;function Ee(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var X=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`}],Z={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`},{id:`claude-fable-5`,label:`Fable 5`,desc:`Most capable — the Claude 5 family`},{id:`claude-opus-4-8`,label:`Opus 4.8`,desc:`Pinned version`},{id:`claude-sonnet-5`,label:`Sonnet 5`,desc:`Pinned version`},{id:`claude-haiku-4-5`,label:`Haiku 4.5`,desc:`Pinned version`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`}]},De=[{value:``,label:`auto`,desc:`Harness default`},{value:`low`,label:`low`,desc:`Less reasoning, faster replies`},{value:`medium`,label:`medium`,desc:`Balanced reasoning`},{value:`high`,label:`high`,desc:`More reasoning for hard tasks`},{value:`xhigh`,label:`xhigh`,desc:`Extra-high reasoning`},{value:`max`,label:`max`,desc:`Maximum reasoning`}],Oe=[`opencode`,`pi`];function ke(e,t){return!e||Z[t].some(t=>t.id===e)?!1:Object.entries(Z).some(([n,r])=>n!==t&&!Oe.includes(n)&&r.some(t=>t.id!==``&&t.id===e))}function Q(e,t,n=[]){let r=[...Z[e]??Z.claude],i=new Set(r.map(e=>e.id));if(_(e))for(let e of t?.models??[])!e.id||i.has(e.id)||(i.add(e.id),r.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||i.has(t)||ke(t,e)||(i.add(t),r.push({id:t,label:t,desc:`Custom or legacy model`}));return r}var Ae={codex:`Codex`,opencode:`OpenCode`,pi:`Pi`};function je(e,t,n=!1){if(!_(e))return;let r=Ae[e];if(t?.stale)return`Using cached ${r} model list`;if(n||t?.source===`unavailable`)return`Latest ${r} models unavailable`}function Me(e){let t=X.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function Ne(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function $(e,t,n=!1){return!n&&e===t?void 0:e}function Pe(e,t,n,r){let i=Q(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function Fe(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function Ie(e,t,n){return e&&Fe(e,t,n)?e:null}function Le(e){let{task:t,source:n,model:r,modelsLocked:i,effort:a,runner:o,runnerExplicit:s,defaultRunner:c,agentProfile:l,variants:u,images:d,worktree:f,autonomous:p,generateFollowups:m,todoId:h}=e;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,effort:i?void 0:a||void 0,runner:$(o,c,s),agentProfile:l||void 0,variants:u>1?u:void 0,images:d.length>0?[...d]:void 0,worktree:f===!1&&u<=1?!1:void 0,autonomous:p===!0||void 0,generateFollowups:m!==!1&&void 0,todoId:h||void 0}}function Re(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}export{ne as C,re as S,Se as _,Le as a,w as b,Ee as c,Ie as d,$ as f,Ce as g,we as h,Me as i,Pe as l,xe as m,Te as n,je as o,Re as p,X as r,Q as s,De as t,Ne as u,be as v,te as w,ie as x,ae as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,At as i,B as a,Bn as o,Cn as s,Dn as c,Hn as l,Hr as u,Kr as d,M as f,Nt as p,Pn as m,R as h,Z as g,a as _,an as v,ar as ee,at as y,en as te,gn as b,i as x,in as ne,ir as re,it as ie,k as ae,kn as oe,kr as S,ln as se,mn as ce,nn as le,nt as ue,ot as de,pt as fe,sn as pe,ut as C}from"./centered-state-DdbE_pNl.js";import{n as w,r as T,t as E}from"./utils-Unt0mZvU.js";import{A as D,O as me,_ as O,c as he,f as ge,h as _e,k,m as ve,n as ye,p as A,r as be,s as xe,t as Se,v as Ce,w as we}from"./editable-title-D_bWdmY0.js";import{C as Te,b as j,u as Ee,w as De,x as Oe}from"./new-task-form-D2KlpqYC.js";import{c as M,i as N,n as P,r as F,s as I,t as L,x as ke}from"./dropdown-menu-CPP9gEmn.js";import{n as R,t as z}from"./trash-2-C_lGBXG2.js";import{t as Ae}from"./ellipsis-vertical-WNkaehnw.js";import{t as B}from"./square-terminal-CB2du-YG.js";import{n as je,r as Me,t as Ne}from"./collapsible-R1r7zUOB.js";import{a as Pe,c as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./alert-dialog-g-GVThSw.js";import{c as He,t as Ue}from"./project-router-Dzc0JK2j.js";import{a as We,n as Ge,r as Ke,t as qe}from"./pill-FAFXjmY6.js";import{t as Je}from"./markdown-DQHRRO9e.js";import{t as Ye}from"./diff-stat-ydfu0_5T.js";import{t as V}from"./tab-link-C5FWJ66Y.js";var H=T(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),U=T(`file-text`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),W=T(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),G=e(t(),1);function K(e,t=null){let n=C(),r=S(n.data),i=e.runner??`claude`,a=Ee(t,r,i),o=r.includes(i),s=n.isSuccess&&r.length>0,c=n.isPending?`Checking agent providers…`:n.isError?`Provider authentication could not be verified.`:s?void 0:`Connect an agent provider to continue.`;return{runners:r,currentRunner:i,runner:a,currentRunnerConnected:o,canContinue:s,providerPending:n.isPending,providerError:n.isError,reason:c,runnerOverride:t!==null||!o?a:void 0}}var q=n();function J(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function Y(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function Xe({steps:e}){if(e.length===0)return null;let t=Y(e)*100;return(0,q.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,q.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":J(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-[13px] text-muted-foreground`,children:[(0,q.jsx)(Ze,{visual:J(t.status)}),(0,q.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,q.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,q.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-[11.5px] text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,q.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,q.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function Ze({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,q.jsx)(Te,{"aria-hidden":!0,className:E(t,`text-success`)});case`active`:return(0,q.jsx)(ae,{role:`status`,"aria-label":`Step running`,className:E(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,q.jsx)(Oe,{"aria-hidden":!0,className:E(t,`text-danger`)});case`pending`:return(0,q.jsx)(ke,{"aria-hidden":!0,className:E(t,`text-soft-foreground`)})}}function Qe(e){let t=e.findIndex(e=>J(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>J(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function $e({visual:e}){return(0,q.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:E(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var X=new Map;function Z({runId:e,steps:t}){let[n,r]=(0,G.useState)(()=>X.get(e)??!1);if(t.length===0)return null;let i=t=>{X.set(e,t),r(t)},a=Qe(t),o=t[a],s=Y(t)*100;return(0,q.jsxs)(Ne,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,q.jsxs)(Me,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group flex min-h-[30px] w-full items-center gap-2.5 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,q.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,q.jsx)($e,{visual:J(e.status)},e.id))}),(0,q.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,q.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,q.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,q.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,q.jsx)(De,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,q.jsx)(je,{children:(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(Xe,{steps:t})})})]})}function Q(e){let t=d();return u({mutationFn:()=>l(e),onSuccess:()=>t.invalidateQueries({queryKey:f.runs.all}),onError:e=>x(e.message,{tone:`danger`})})}function et({run:e,planTally:t,tab:n=`session`,onMarkedUnread:i}){let a=We(e),o=A(e),s=ge(e),[c,l]=(0,G.useState)(!1),u=nt(e,i),d=p(),f=g(),m=Ge(f.data),h=e.status===`queued`?ce(d.data??[]).get(e.id):void 0;return(0,q.jsxs)(`header`,{"data-slot":`run-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,q.jsxs)(`div`,{className:`mx-auto w-full max-w-[var(--measure)]`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(rt,{run:e}),(0,q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[t?(0,q.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`text-[11px] text-soft-foreground tabular-nums`,children:[`Plan `,t.done,`/`,t.total]}):null,(0,q.jsxs)(qe,{dot:a.tone,pulse:a.pulse,children:[a.label,h===void 0?``:` #${h}`]}),(0,q.jsx)(st,{run:e,actions:u,onToggleNotes:()=>l(e=>!e)})]})]}),(0,q.jsx)(it,{run:e,showTokens:m.tokens,showCost:m.cost,automationsAvailable:f.data?.capabilities?.automations===!0}),(0,q.jsx)(at,{run:e}),(0,q.jsxs)(`div`,{"data-slot":`run-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,q.jsx)(V,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,q.jsx)(V,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,q.jsx)(V,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,q.jsx)(V,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),(0,q.jsxs)(`div`,{"data-slot":`run-actions`,className:`ml-auto hidden items-center gap-1 pb-1 md:flex`,children:[o.finish?(0,q.jsxs)(_,{variant:`outline`,size:`sm`,title:he(e.status),onClick:()=>u.finish.mutate(),children:[(0,q.jsx)(r,{"aria-hidden":`true`}),`Finish`]}):null,o.continueRun?(0,q.jsxs)(_,{variant:`outline`,size:`sm`,title:u.continuation.reason??`Reopen the session`,disabled:u.continueRun.isPending||!u.continuation.canContinue,onClick:()=>u.continueRun.mutate(),children:[(0,q.jsx)(j,{"aria-hidden":`true`}),`Continue`]}):null,(0,q.jsx)(tt,{run:e,canResume:o.terminal,onResume:()=>u.terminal.mutate()}),(0,q.jsxs)(_,{variant:`ghost`,size:`sm`,title:`Handoff notes — what the agent did and what's left`,"aria-expanded":c,onClick:()=>l(e=>!e),children:[(0,q.jsx)(U,{"aria-hidden":`true`}),`Notes`]}),o.markUnread?(0,q.jsxs)(_,{variant:`ghost`,size:`sm`,title:`Put this task back in the unread list`,disabled:u.markUnread.isPending,onClick:()=>u.markUnread.mutate(),children:[(0,q.jsx)(W,{"aria-hidden":`true`}),`Mark unread`]}):null,o.archive?(0,q.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:()=>u.archive.mutate(),children:[e.archived?(0,q.jsx)(D,{"aria-hidden":`true`}):(0,q.jsx)(k,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,o.cancel?(0,q.jsxs)(_,{variant:`danger-ghost`,size:`sm`,onClick:()=>u.setConfirming(`cancel`),children:[(0,q.jsx)(H,{"aria-hidden":`true`}),`Cancel`]}):null,o.deleteRun?(0,q.jsxs)(_,{variant:`danger-ghost`,size:`sm`,onClick:()=>u.setConfirming(`delete`),children:[(0,q.jsx)(z,{"aria-hidden":`true`}),`Delete`]}):null]})]}),e.steps.length>0?(0,q.jsx)(`div`,{className:`border-t border-border pt-2 pb-1`,children:(0,q.jsx)(Z,{runId:e.id,steps:e.steps})}):null,s?(0,q.jsx)(lt,{hint:s}):null,c?(0,q.jsx)(ut,{runId:e.id}):null]}),(0,q.jsx)(ct,{run:e,actions:u})]})}function tt({run:e,canResume:t,onResume:n}){let r=ie(),i=C(),a=u({mutationFn:t=>re(e.id,t),onError:e=>x(e.message,{tone:`danger`})}),o=S(i.data),s=e=>!i.isSuccess||o.includes(e??`claude`),c=t&&s(e.runner),l=e.worktreePath?(r.data?.targets??[]).filter(e=>{let t=_e(e.id);return t===void 0||s(t)}).map(t=>({target:t,...xe(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[];return!c&&l.length===0?null:(0,q.jsx)(ve,{choices:l,onPick:e=>a.mutate(e),title:`Resume in a terminal, or open the worktree locally`,leading:c?(0,q.jsxs)(F,{"data-target":`terminal-resume`,onSelect:n,children:[(0,q.jsx)(B,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,trailing:e.worktreePath?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(I,{}),(0,q.jsxs)(F,{onSelect:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>x(`Worktree path copied`)).catch(()=>x(`Path: ${t}`))},children:[(0,q.jsx)(R,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null})}function nt(e,t){let n=d(),r=He(),[i,a]=(0,G.useState)(null),l=()=>n.invalidateQueries({queryKey:f.runs.all}),p=e=>x(e.message,{tone:`danger`}),h=Q(e.id),g=K(e),_=u({mutationFn:async()=>g.canContinue?m(e.id,{runner:g.runnerOverride}):null,onSuccess:e=>{e!==null&&l()},onError:p}),v=u({mutationFn:()=>c(e.id,!e.archived),onSuccess:l,onError:p}),y=ue();return{finish:h,continuation:g,continueRun:_,archive:v,markUnread:{isPending:y.isPending,mutate:()=>{t?.(),y.mutate(e.id,{onError:p})}},cancel:u({mutationFn:()=>oe(e.id),onSuccess:l,onError:p}),delete:u({mutationFn:()=>o(e.id),onSuccess:()=>{l(),r(`/`)},onError:p}),terminal:u({mutationFn:()=>ee(e.id),onError:e=>{if(e instanceof s&&e.command){$(e.command,`No terminal found — command copied to clipboard.`);return}p(e)}}),confirming:i,setConfirming:a}}async function $(e,t){try{await navigator.clipboard.writeText(e),x(t)}catch{x(`Run manually: ${e}`)}}function rt({run:e}){let t=y(e.id),n=b(e),r=ye(n,e=>t.mutate({title:e},{onError:e=>x(e.message,{tone:`danger`})}));return r.editing?(0,q.jsx)(Se,{editor:r,className:`flex-1 text-[15px] font-semibold`}):(0,q.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,q.jsx)(`h1`,{className:`min-w-0 truncate text-[15px] font-semibold`,title:e.task,children:n}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:r.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,q.jsx)(we,{className:`size-3.5`,"aria-hidden":`true`})})]})}function it({run:e,showTokens:t,showCost:n,automationsAvailable:r}){let i=de(),a=fe(),o=(0,G.useMemo)(()=>pe(e,i),[e,i]),s=(0,G.useMemo)(()=>a===void 0?[]:o.map(e=>({projectId:a,kind:e.kind,number:e.number})),[o,a]),c=[(0,q.jsx)(`span`,{children:se(e)},`workflow`)];e.branch&&c.push((0,q.jsx)(`span`,{"data-slot":`branch-chip`,className:`rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:e.branch},`branch`));let l=o.filter(e=>e.kind===`PR`);for(let t of l)c.push((0,q.jsx)(O,{reference:t,taskTitle:b(e),className:`h-5`,conflictAction:(0,q.jsx)(be,{run:e,prNumber:t.number})},`pr-${t.number}`));let u=v(e);u&&w(u)&&!l.some(e=>e.url===u)&&c.push((0,q.jsx)(O,{reference:{kind:`PR`,url:u},taskTitle:b(e),className:`h-5`},`pr`));let d=ne(e,i);if(d&&w(d)){let t=le(d);c.push((0,q.jsx)(O,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},taskTitle:b(e),className:`h-5`},`issue`))}e.diffStat&&c.push((0,q.jsx)(Ye,{stat:e.diffStat},`diff`)),e.automation&&c.push(r?(0,q.jsx)(Ue,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,q.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-[11px] font-medium`,children:`Automation`},`automation`));let f=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&f.push((0,q.jsx)(Ke,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&f.push((0,q.jsx)(`span`,{className:`tabular-nums`,children:te(e.costUsd)},`cost`)),(0,q.jsx)(Ce,{projectId:a,requests:s,children:(0,q.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[c.map((e,t)=>(0,q.jsxs)(G.Fragment,{children:[t>0?(0,q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,q.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[f.map((e,t)=>(0,q.jsxs)(G.Fragment,{children:[t>0?(0,q.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,q.jsx)(ot,{run:e})]})]})})}function at({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,q.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,q.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,q.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function ot({run:e}){let t=a(),n=h(),r=e.runner??t.data?.defaultRunner??`claude`,i=e.model??`auto`,o=[...e.steps].reverse().find(e=>e.profileId)?.profileId,s=o===void 0?void 0:o==="default"?`default`:n.data?.profiles.find(e=>e.id===o)?.label??`${o} (removed)`,c=e.modelIdentity&&e.modelIdentity!==i?e.modelIdentity:void 0,l=[r,s,i].filter(Boolean).join(` · `);return(0,q.jsxs)(L,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsxs)(`button`,{type:`button`,"data-slot":`agent-badge`,title:l,"aria-label":`Agent: ${r}, ${s?`account ${s}, `:``}model ${i}`,className:`flex min-w-0 shrink items-center gap-1.5 rounded-sm px-1 py-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,q.jsx)(me,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{"data-slot":`agent-badge-summary`,className:`truncate font-mono text-[11px]`,children:l})]})}),(0,q.jsxs)(P,{align:`end`,className:`min-w-[9rem]`,children:[(0,q.jsxs)(N,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`runner: `,r]}),s?(0,q.jsxs)(N,{"data-slot":`agent-badge-account`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`account: `,s]}):null,(0,q.jsxs)(N,{className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`model: `,i]}),c?(0,q.jsxs)(N,{"data-slot":`agent-badge-identity`,className:`font-mono text-[11px] font-normal text-muted-foreground`,children:[`identity: `,c]}):null]})]})}function st({run:e,actions:t,onToggleNotes:n}){let i=A(e);return(0,q.jsxs)(L,{children:[(0,q.jsx)(M,{asChild:!0,children:(0,q.jsx)(_,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,q.jsx)(Ae,{"aria-hidden":`true`})})}),(0,q.jsxs)(P,{align:`end`,"data-slot":`run-actions-menu`,children:[i.finish?(0,q.jsxs)(F,{onSelect:()=>t.finish.mutate(),children:[(0,q.jsx)(r,{"aria-hidden":`true`}),` Finish`]}):null,i.continueRun?(0,q.jsxs)(F,{disabled:!t.continuation.canContinue||t.continueRun.isPending,title:t.continuation.reason,onSelect:()=>t.continueRun.mutate(),children:[(0,q.jsx)(j,{"aria-hidden":`true`}),` Continue`]}):null,i.terminal?(0,q.jsxs)(F,{onSelect:()=>t.terminal.mutate(),children:[(0,q.jsx)(B,{"aria-hidden":`true`}),` Terminal`]}):null,(0,q.jsxs)(F,{onSelect:n,children:[(0,q.jsx)(U,{"aria-hidden":`true`}),` Notes`]}),i.markUnread?(0,q.jsxs)(F,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,q.jsx)(W,{"aria-hidden":`true`}),` Mark unread`]}):null,i.archive?(0,q.jsxs)(F,{onSelect:()=>t.archive.mutate(),children:[e.archived?(0,q.jsx)(D,{"aria-hidden":`true`}):(0,q.jsx)(k,{"aria-hidden":`true`}),e.archived?`Unarchive`:`Archive`]}):null,i.cancel||i.deleteRun?(0,q.jsx)(I,{}):null,i.cancel?(0,q.jsxs)(F,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,q.jsx)(H,{"aria-hidden":`true`}),` Cancel`]}):null,i.deleteRun?(0,q.jsxs)(F,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,q.jsx)(z,{"aria-hidden":`true`}),` Delete`]}):null]})]})}function ct({run:e,actions:t}){let n=t.confirming;return(0,q.jsx)(Ve,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,q.jsxs)(Ie,{children:[(0,q.jsxs)(Be,{children:[(0,q.jsx)(Fe,{children:n===`delete`?`Delete this task?`:`Cancel this task?`}),(0,q.jsx)(Pe,{children:n===`delete`?(0,q.jsxs)(q.Fragment,{children:[`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,q.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:b(e),children:b(e)})]}):`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,q.jsxs)(Re,{children:[(0,q.jsx)(ze,{children:`Keep it`}),(0,q.jsx)(Le,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{n===`delete`?t.delete.mutate():t.cancel.mutate(),t.setConfirming(null)},children:n===`delete`?`Delete`:`Cancel the run`})]})]})})}function lt({hint:e}){return(0,q.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void $(e,`Command copied to clipboard.`),className:`mb-2 flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,q.jsx)(R,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}function ut({runId:e}){let t=i(e);return(0,q.jsx)(`div`,{"data-slot":`notes-panel`,className:`mb-3 max-h-72 overflow-y-auto rounded-md border border-border bg-card px-4 py-3`,children:t.isPending?(0,q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):t.isError?(0,q.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}):t.data.trim().length>0?(0,q.jsx)(Je,{children:t.data}):(0,q.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`})})}export{U as i,Q as n,K as r,et as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Gt as i,Hr as a,Kr as o,Ln as s,Lt as c,M as l,Rt as u,Sn as d,Ut as f,Vr as p,a as m,gr as h,i as g,jn as _,lt as v,mr as y,qt as b,t as x,wn as S}from"./centered-state-DdbE_pNl.js";import{t as C}from"./utils-Unt0mZvU.js";import{t as w}from"./arrow-left-DtUM7GFU.js";import{C as T,p as E,y as D}from"./new-task-form-D2KlpqYC.js";import{r as O,t as k}from"./skill-empty-hint-D2l_OqZ5.js";import{t as A}from"./refresh-cw-BP4TkA4M.js";import{t as j}from"./sparkles-B9ja4FHw.js";import{t as M}from"./triangle-alert-Brk_ldFl.js";import{a as N,c as P,l as F,o as I,r as L,s as R}from"./use-submit-shortcut-DzeqN3GK.js";import{c as z,t as B}from"./project-router-Dzc0JK2j.js";import{i as ee,n as te,o as ne,p as re}from"./skills-9oR_oHse.js";import{c as V,g as H,o as U,t as W}from"./index-BQTfjxFm.js";var G=e(t(),1),K=n(),q=`https://github.com/open-mercato/skills`;function J(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function Y(e,t){return J(e)??[...t]}function X({projectId:e}){let t=o(),n=i(),a=r(),[s,c]=(0,G.useState)(``),d=u(e,!!e),f=a.data??[],p=(0,G.useMemo)(()=>f.map(e=>e.name),[f]),m=(0,G.useRef)([]);m.current=p;let h=(0,G.useMemo)(()=>new Set(Y(n.data,p)),[n.data,p]),_=(0,G.useRef)(Promise.resolve()),v=(0,G.useRef)(0),S=(0,G.useCallback)(e=>{let n=b.uiState,r=t.getQueryData(n),i=e(Y(r,m.current));t.setQueryData(n,{...r,importedSkills:i});let a=++v.current;_.current=_.current.then(async()=>{try{let e=await y({importedSkills:i});a===v.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:l.skills}))}catch(e){g(e instanceof Error?e.message:String(e),{tone:`danger`}),a===v.current&&t.invalidateQueries({queryKey:n})}})},[t]),w=(0,G.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),T=p.length>0&&p.every(e=>h.has(e)),E=(0,G.useCallback)(()=>{if(T){let e=new Set(m.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...m.current])])},[T,S]);if(a.isError)return(0,K.jsx)(x,{icon:(0,K.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:a.error.message});let D=s.trim().toLowerCase(),O=D?f.filter(e=>e.name.toLowerCase().includes(D)||(e.description??``).toLowerCase().includes(D)):f;return(0,K.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`mx-auto w-full max-w-2xl`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold`,children:`Manage skills`}),(0,K.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Reusable, technology-agnostic agent skills from`,` `,(0,K.jsx)(`a`,{href:q,target:`_blank`,rel:`noreferrer`,className:`underline underline-offset-2 hover:text-foreground`,children:`open-mercato/skills`}),` `,`— PR creation, code review, CI stabilisation, spec writing and more. They're all in your catalog and the composer picker by default; uncheck any you don't want.`]}),(0,K.jsx)(ie,{projectId:e,state:d.data,loadError:d.error}),(0,K.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`These checkboxes choose what cezar shows; updates refresh installed skill files.`}),(0,K.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,K.jsx)(H,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:s,onChange:e=>c(e.target.value),className:`h-8 text-[13px]`}),(0,K.jsx)(`button`,{type:`button`,"data-slot":`import-all`,disabled:p.length===0||n.isPending,onClick:E,className:`h-8 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:T?`Remove all`:`Enable all`})]}),(0,K.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:a.isPending?(0,K.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):O.length>0?O.map(e=>{let t=h.has(e.name);return(0,K.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:C(`flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,K.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>w(e.name),className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[13px] font-medium text-foreground`,children:e.name})]}),e.description?(0,K.jsx)(`span`,{className:`mt-0.5 block pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,K.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:f.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ie({projectId:e,state:t,loadError:n}){let r=o(),i=z(),c=(0,G.useRef)(0),[u,d]=(0,G.useState)(!1),f=a({mutationFn:()=>s({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{d(!1),i(E(e))},onError:e=>g(e.message,{tone:`danger`})}),p=(t,n)=>{n.seq===c.current&&(r.setQueryData(b.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:l.skills}),g(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),d(!0)))},h=(e,t)=>{t.seq===c.current&&g(e.message,{tone:`danger`})},v=a({mutationFn:t=>_(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>h(e,t)}),y=a({mutationFn:t=>S(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>p(e,t),onError:(e,t)=>h(e,t)}),x=e=>{let n=++c.current;e===`apply`?y.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):v.mutate({action:e,seq:n})},w=t?.scopes.some(e=>e.skills.length>0)??!1,D=t?.status===`error`,O=w&&(t?.available||D),k=y.isPending||t?.status===`updating`,j=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],M=t?.scopes.filter(e=>e.updatedAt&&!j.includes(e))??[],B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-muted/30 p-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,K.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,K.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,j.length>0?(0,K.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,j.map(e=>Z(e.scope)).join(`, `),M.length?`; updated: ${M.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),O?(0,K.jsxs)(m,{"data-action":`skills-update-apply`,size:`sm`,disabled:k,onClick:()=>x(`apply`),children:[(0,K.jsx)(A,{"aria-hidden":`true`,className:C(`size-3.5`,k&&`motion-safe:animate-spin`)}),k?`Updating…`:D?`Retry`:`Update now`]}):t?.status===`current`?(0,K.jsx)(m,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:v.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,K.jsx)(m,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:v.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,K.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,K.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,K.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,K.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,K.jsx)(T,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,K.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,K.jsx)(L,{open:u,onOpenChange:e=>f.isPending?void 0:d(e),children:(0,K.jsxs)(N,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,K.jsxs)(P,{children:[(0,K.jsx)(F,{children:`Apply the upgrade notes now?`}),(0,K.jsxs)(I,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,K.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,K.jsxs)(R,{children:[(0,K.jsx)(m,{type:`button`,variant:`outline`,disabled:f.isPending,onClick:()=>d(!1),children:`No`}),(0,K.jsx)(m,{type:`button`,disabled:f.isPending,onClick:()=>f.mutate(),children:f.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function ae(){return(0,K.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,K.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,K.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,K.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,K.jsx)(oe,{})]})}function oe(){let e=c(),t=f(),n=r(),[i]=p(),[s,u]=(0,G.useState)(``),m=o(),_=v(),y=d().projectId??_.data?.bootProject??``,b=a({mutationFn:()=>h(),onSuccess:e=>{m.setQueryData(l.skills,e),g(`Team skills refreshed.`)},onError:e=>g(e.message,{tone:`danger`})});if(e.isError)return(0,K.jsx)(x,{icon:(0,K.jsx)(M,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let S=ne(e.data??[]),T=(n.data?.length??0)>0,E=i.get(`skill`),N=E===Q||E===$||E!==null&&S.some(e=>e.name===E)?E:S[0]?.name??(T?$:Q),P=S.find(e=>e.name===N)??null,F=te(S,s);return(0,K.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,K.jsxs)(`section`,{"data-slot":`skills-list`,className:C(`w-full flex-col border-border md:flex md:w-[320px] md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,E===null?`flex`:`hidden md:flex`),children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,K.jsx)(H,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:s,onChange:e=>u(e.target.value),className:`h-8 text-[13px]`}),(0,K.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:b.isPending,onClick:()=>b.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,K.jsx)(A,{"aria-hidden":`true`,className:C(`size-3`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,K.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 overflow-y-auto px-2 pb-2`,children:e.isPending?(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):F.length>0?F.map(e=>(0,K.jsx)(se,{skill:e,active:N===e.name},e.path)):(0,K.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:S.length>0?`(no skills match)`:(0,K.jsx)(k,{})})}),(0,K.jsxs)(`div`,{className:`shrink-0 border-t border-border p-2`,children:[T?(0,K.jsxs)(B,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":N===$?`page`:void 0,className:C(`mb-1 flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===$&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(O,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Manage skills`}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`open-mercato`})]}),(0,K.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`Choose which open-mercato skills appear in your catalog.`})]}):null,(0,K.jsxs)(B,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":N===Q?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,N===Q&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(D,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,K.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,children:`Run from GitHub`}),(0,K.jsx)(`span`,{className:`ml-auto shrink-0 rounded-full border border-border px-2 py-px font-mono text-[10.5px] text-soft-foreground`,children:`bookmarklets`})]}),(0,K.jsx)(`span`,{className:`pl-[22px] text-xs text-soft-foreground`,children:`One-click skill launch from any GitHub PR or issue.`})]})]})]}),(0,K.jsx)(`section`,{"data-slot":`skills-detail`,className:C(`min-w-0 flex-1 flex-col`,E===null?`hidden md:flex`:`flex`),children:(0,K.jsxs)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:[(0,K.jsxs)(B,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,K.jsx)(w,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),N===$?(0,K.jsx)(X,{projectId:y}):N===Q?(0,K.jsx)(W,{skills:S}):P?(0,K.jsx)(U,{skill:P,usedBy:re(t.data?.workflows??[],P.name)}):e.isPending?null:(0,K.jsx)(x,{icon:(0,K.jsx)(j,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})}function se({skill:e,active:t}){let n=ee(e);return(0,K.jsx)(`li`,{children:(0,K.jsxs)(B,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":n?`true`:void 0,"aria-current":t?`page`:void 0,className:C(`flex flex-col gap-0.5 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,t&&`bg-muted`),children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(j,{"aria-hidden":`true`,className:C(`size-3.5 shrink-0`,n?`text-violet`:`text-soft-foreground`)}),(0,K.jsx)(`span`,{className:C(`min-w-0 truncate font-mono text-[13px]`,n?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,K.jsx)(V,{source:e.source,className:`ml-auto`})]}),e.description?(0,K.jsx)(`span`,{className:`line-clamp-2 pl-[22px] text-xs text-soft-foreground`,children:e.description}):null]})})}export{ae as SkillsRoute};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,A as i,B as a,Br as o,Cn as s,Hr as c,It as l,Jr as u,Kr as d,M as f,Mt as p,Nt as m,On as h,Pn as g,Qn as _,Rn as v,Rr as y,Ur as b,W as x,Wr as S,Xr as C,Zr as w,a as T,an as E,at as D,i as O,in as ee,jr as te,k,n as A,ot as ne,t as j,tt as M,wt as N,yt as re}from"./centered-state-DdbE_pNl.js";import{a as P,c as ie,n as ae,r as F,t as I}from"./utils-Unt0mZvU.js";import{O as oe,S as se,T as ce,c as le,d as ue,g as de,o as L,p as fe}from"./editable-title-D_bWdmY0.js";import{t as pe}from"./arrow-down-BzmL0uj0.js";import{c as me,i as he,l as ge,n as _e,o as ve,s as ye,t as be}from"./thread-loading-DojNeADh.js";import{l as xe,o as Se,s as Ce,t as we,v as Te,w as Ee}from"./new-task-form-D2KlpqYC.js";import{t as R}from"./chevron-right-DnLh0uM2.js";import{i as De,n as Oe,r as ke,t as Ae}from"./run-header-xFlbebSJ.js";import{b as je,y as Me}from"./dropdown-menu-CPP9gEmn.js";import{n as Ne,t as Pe}from"./trash-2-C_lGBXG2.js";import{C as Fe,S as Ie,c as Le,d as Re,f as ze,s as Be}from"./prompt-templates-DmqtzSPL.js";import{t as Ve}from"./search-x-Drnmsmd0.js";import{t as He}from"./square-terminal-CB2du-YG.js";import{t as Ue}from"./textarea-Sm6doUPO.js";import{n as z,r as B,t as V}from"./collapsible-R1r7zUOB.js";import{t as We}from"./use-submit-shortcut-DzeqN3GK.js";import{t as H}from"./project-router-Dzc0JK2j.js";import{s as U}from"./pill-FAFXjmY6.js";import{t as W}from"./markdown-DQHRRO9e.js";import{t as Ge}from"./lib-BQXq3kEf.js";import{t as Ke}from"./zoomable-image-ByySCppM.js";import{t as qe}from"./run-diff-CvcsWwew.js";var Je=120;function G(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Je?`${t.slice(0,Je-1)}…`:t}function q(e,...t){if(G(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return K(t)}}function Ye(e){if(!G(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return K(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return K(e.join(` `))}}function Xe(e){if(!G(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)G(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function Ze(e){return q(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function J(e,t){return t?`${e} ${t}`:e}function Qe(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:J(`Ran`,Ye(t)),subtitle:q(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:J(`Write`,q(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Xe(t);return{toolKind:`edit`,title:J(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:J(`Read`,q(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:J(`View image`,q(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:J(`Search`,q(t,`pattern`,`query`)),subtitle:q(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:J(`Fetch`,q(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:J(`Web search`,q(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=q(t,`subagent_type`,`subagentType`),i=q(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=q(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:q(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=q(t,`server`),n=q(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:Ze(t)}}}if(n.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()!==``?K(e):`Tool`,subtitle:Ze(t)}}var $e=class extends u{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:C(t,n.data),hasPreviousPage:w(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function et(e,t){return S(e,$e,t)}var tt=F(`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`}]]),nt=F(`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`}]]),rt=F(`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`}]]),it=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),at=F(`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`}]]),ot=F(`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`}]]),st=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),Y=e(t(),1),ct=[`run-event`,`ui-event`];function lt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function ut(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=lt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(P(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of ct)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var dt=5,ft=200,pt=5e3;function mt(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function ht(e){let t=ie(),n=d(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=et({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>_(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:dt,retry:1}),s=b({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>r(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=ut(c?e:void 0),u=o.data?.pages??[],f=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),p=(0,Y.useRef)(!1),m=(0,Y.useCallback)(()=>{e===void 0||p.current||(p.current=!0,_(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>dt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{p.current=!1}))},[n,e,t]),h=ut(!c&&f?e:void 0,{cursor:f?.liveCursor,afterSeq:f?.asOfSeq,maxEvents:pt,compactAt:ft,onCompact:m}),g=(0,Y.useMemo)(()=>mt(...u.map(e=>e.events)),[u]),v=(0,Y.useMemo)(()=>c?l:mt(g,h),[c,l,g,h]),y=(0,Y.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return mt(e,v.filter(({seq:e})=>e>t))},[s.data,c,l,v]),x=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),S=(0,Y.useCallback)(async()=>{await n.resetQueries({queryKey:i,exact:!0})},[i,n]);return{visibleEvents:v,currentEvents:y,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:x,jumpToLatest:S,retainedPages:u.length}}var X=n();function gt({run:e}){let t=d(),n=c({mutationFn:()=>h(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:f.runs.detail(e.id)}),t.invalidateQueries({queryKey:f.runs.list()}),O(`This task will not resume itself`)},onError:e=>O(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)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,X.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,X.jsx)(U,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,X.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,X.jsx)(te,{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`})]})}var _t=e=>e.kind===`tool`,vt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,yt=(e,t,n)=>`${e} ${e===1?t:n}`;function bt(e,t){let n=[];return e>0&&n.push(yt(e,`file`,`files`)),t>0&&n.push(yt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function xt(e){return`${e} earlier tool call${e===1?``:`s`}`}var St=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Ct(e){for(let t of St)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function wt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(_t).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&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:bt(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=[]};for(let e of i)_t(e)&&vt(e)&&!r.has(e.id)?o.push(e):(s(),_t(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();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Tt=new Map,Et=(0,Y.createContext)(null);function Dt(){return(0,Y.useContext)(Et)}function Ot({runId:e,children:t}){let n=(0,Y.useMemo)(()=>({get:t=>Tt.get(e)?.get(t),set:(t,n)=>{let r=Tt.get(e)??new Map;r.set(t,n),Tt.set(e,r)}}),[e]);return(0,X.jsx)(Et.Provider,{value:n,children:t})}function kt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function At(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function jt(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 Mt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Nt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Pt=new Map;function Ft(e,t){Pt.set(e,t)}function It(e){return Pt.get(e)}var Lt=new Map;function Rt(e,t){Lt.set(e,t)}function zt(e,t){let n=Lt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Bt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(e),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,X.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,X.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,X.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 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,X.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,X.jsx)(k,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,X.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,X.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,X.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:[r?(0,X.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 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,X.jsx)(ot,{className:`size-3.5`})}):null,i?(0,X.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 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,X.jsx)(Pe,{className:`size-3.5`})}):null]}):null,m?(0,X.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,X.jsx)(W,{breaks:!0,children:e}),n.length>0?(0,X.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:n.map(e=>(0,X.jsx)(Ke,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e))}):null,s>0?(0,X.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Vt({text:e}){return(0,X.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,X.jsx)(W,{children:e})})}function Ht({note:e}){return(0,X.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:I(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Ut={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function Wt({incident:e}){let t=Ut[e.provider];return(0,X.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,X.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Gt({text:e}){let t=(0,Y.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
-
`,1)[0]??``,r=n.length<e.length;return(0,X.jsxs)(V,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,X.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,X.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,X.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,X.jsx)(W,{inline:!0,children:n})}),r?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,X.jsx)(B,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,X.jsx)(z,{children:(0,X.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,X.jsx)(W,{children:e})})})]})}function Kt(){return(0,X.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,X.jsx)(k,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var qt={read:De,edit:ot,delete:Pe,move:rt,search:Ie,execute:He,think:tt,fetch:ce,task:oe,plan:it,other:st},Jt=e=>e.split(`
|
|
3
|
-
`).length;function Yt({text:e,streaming:t}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(null),a=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Jt(e),s=!t&&!n&&o>12;return(0,X.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Mt(e.currentTarget)}:void 0,className:I(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,X.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,X.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,X.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Xt({diffs:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,X.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Zt(e.oldText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Zt(e.newText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
-
`).map((e,t)=>(0,X.jsx)(Qt,{text:e},t))})]},`${e.path}:${t}`))})}function Zt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
-
`)}function Qt({text:e}){return(0,X.jsx)(`span`,{className:I(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function $t(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function en({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=Dt(),[a,o]=(0,Y.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??$t(e)),{verb:d,detail:f}=Ct(e.title),p=qt[e.toolKind]??st;return(0,X.jsxs)(V,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:I(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,X.jsxs)(B,{disabled:!l,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,X.jsx)(R,{"aria-hidden":!0,className:I(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,X.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`span`,{className:I(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,X.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,X.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,X.jsx)(k,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,X.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,X.jsx)(`span`,{"data-slot":`tool-exit`,className:I(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,X.jsx)(z,{children:(0,X.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,X.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,X.jsx)(Xt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,X.jsx)(Yt,{text:e.output,streaming:c}):null,t.length>0?(0,X.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function tn({group:e,scope:t}){return(0,X.jsxs)(V,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,X.jsxs)(B,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,X.jsx)(z,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,X.jsx)(en,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function nn({count:e,children:t}){return(0,X.jsxs)(V,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,X.jsxs)(B,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,X.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),xt(e)]}),(0,X.jsx)(z,{children:(0,X.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function rn({image:e}){return(0,X.jsx)(Ke,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function an(e){let t=d(),n=fe(e).continueRun,r=a(),[i,o]=(0,Y.useState)(null),[s,l]=(0,Y.useState)(null),[u,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(e.id);v!==e.id&&(y(e.id),o(null),l(null),m(null),_(null));let b=ke(e,i),{runners:x,canContinue:S,currentRunner:C,runner:w}=b,T=p(w,n),E=r.data?.modelsLocked===!0,D=w!==C,O=!E&&!D&&e.model?{...r.data?.defaultModels,[w]:e.model}:r.data?.defaultModels,ee=E?null:s,te=Ce(w,T.data,[ee,O?.[w]]),k=xe(ee,w,O,T.data),A=E?``:u===null?e.effort??``:u,{accounts:ne,repoAccount:j}=ze(),M=[...e.steps].reverse().find(e=>e.profileId)?.profileId??e.agentProfile??`default`,N=D?j:{...j,[C]:M},re=ne.some(e=>e.provider===w&&e.id===h)?h:null,P=c({mutationFn:({text:t,images:n})=>S?g(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:b.runnerOverride,model:!E&&s!==null?k:void 0,effort:!E&&u!==null?A:void 0,agentProfile:re??void 0}):Promise.reject(Error(b.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:f.runs.all})});return{available:n,canContinue:S,reason:b.reason,providerPending:b.providerPending,pills:(0,X.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[x.length>1||x.some(e=>Re(ne,e))?(0,X.jsx)(Le,{runners:x,value:w,accounts:ne,account:re,repoAccount:N,onPick:(e,t)=>{_(t),e!==w&&(o(e),l(null))}}):null,(0,X.jsx)(Be,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:te.find(e=>e.id===k)?.label??`auto`,value:k,readOnly:E,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>l(e),options:te.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:Se(w,T.data,T.isError)}),(0,X.jsx)(Be,{slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:we.find(e=>e.value===A)?.label??`auto`,value:A,readOnly:E,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>m(e),options:we.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]}),continueWith:(e,t)=>P.mutateAsync({text:e,images:t})}}var on=120,sn=e=>e!==`pending`&&e!==`running`,cn=e=>e.kind===`tool`&&e.toolKind===`task`,Z=e=>cn(e)&&e.parentItemId===void 0,ln=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function un(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Z(e)&&t.has(e.id)))return n;return 0}function dn(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function fn(e){if(e.kind===`tool`)return pn(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
6
|
-
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return pn(n)}}}function pn(e){return e.length>on?`${e.slice(0,on-1).trimEnd()}…`:e}function mn(e,t=!1){let n=yn(e,e=>e.items.some(Z));if(n===-1)return[];let r=e=>!t&&!sn(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Z);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Z)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?un(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!ln(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>hn(e,c.get(e.id)??[],t))}function hn(e,t,n){let r={id:e.id,title:Ct(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=dn(e);i!==void 0&&(r.agentType=i),n&&!sn(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=fn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function gn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function _n(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function vn(e){return e.find(e=>!sn(e.status))??e[0]}function yn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function bn(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Z(e));if(i!==void 0)return hn(i,xn(e,t),n)}}function xn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Z(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)ln(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Sn=new Map,Cn=!1;function wn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,Y.useState)(()=>Sn.get(e)??Cn);if(t.length===0)return null;let{done:a,total:o}=gn(t),s=vn(t);return(0,X.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,X.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Sn.set(e,!t),!t)),"aria-expanded":r,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,X.jsx)(oe,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,X.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,X.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,_n(s)]}):null,(0,X.jsx)(Ee,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,X.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,X.jsx)(Tn,{agent:e,onSelect:n},e.id))}):null]})}function Tn({agent:e,onSelect:t}){let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(En,{status:e.status,stalled:e.stalled===!0}),(0,X.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,X.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:_n(e)}),(0,X.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,X.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,X.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,X.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function En({status:e,stalled:t=!1}){return t?(0,X.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,X.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var Dn=new Map;function On(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function kn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function An(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function jn({runId:e,entries:t}){let[n,r]=(0,Y.useState)(()=>Dn.get(e)??On());if(t.length===0)return null;let{done:i,total:a}=kn(t),o=An(t);return(0,X.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,X.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(Dn.set(e,!t),!t)),"aria-expanded":n,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,X.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,X.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,X.jsx)(Ee,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,X.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,X.jsx)(Mn,{entry:e},`${t}:${e.content}`))}):null]})}function Mn({entry:e}){return(0,X.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:I(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,X.jsx)(Nn,{status:e.status}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,X.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function Nn({status:e}){return e===`cancelled`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,X.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,X.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,X.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,X.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,X.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,X.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function Pn(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(0,Y.useRef)(!0),f=(0,Y.useRef)(null),p=(0,Y.useRef)(null),m=(0,Y.useRef)(null),h=(0,Y.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,Y.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,Y.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=It(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,Y.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,Y.useCallback)(()=>{d.current&&g()},[g]),b=(0,Y.useRef)(!1),x=(0,Y.useRef)(!1),S=(0,Y.useRef)(void 0),C=(0,Y.useRef)(!1),w=(0,Y.useRef)(!1),T=(0,Y.useRef)(a);T.current=a;let E=(0,Y.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),D=(0,Y.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=At(i,E(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:T.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(jt(e.scrollTop,i,a,E(e),r))}b.current=!1})})},[E,r,h]);(0,Y.useEffect)(()=>()=>clearTimeout(S.current),[]);let O=(0,Y.useCallback)(()=>{o.current&&(f.current=null,d.current=!0,(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{let e=o.current;e?.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`})})}))},[i]);return(0,Y.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,Y.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=0,i=null,a=!1,c=t.scrollTop,l=()=>{f.current=null,d.current=!1,r=0},p=()=>{r=Date.now()},m=e=>{if(e.deltaY<0){l();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&kt(t)&&D()}else p()},_=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(l(),!e.repeat&&kt(t)&&D()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&p()},v=()=>{a=!0,w.current=!1,c=t.scrollTop,Mt(t,80)||(l(),p())},y=()=>{a=!1},b=e=>{C.current=!1,i=e.touches[0]?.clientY??null},T=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(i!==null&&n>i+1?(l(),!C.current&&kt(t)&&(C.current=!0,D())):i!==null&&n<i-1&&p(),i=n)},E=()=>{a&&!w.current&&t.scrollTop<c&&kt(t)&&(w.current=!0,D()),c=t.scrollTop;let n=Mt(t,80);n&&f.current===null&&(d.current||Date.now()-r<2e3)&&(d.current=!0),u(!n),f.current===null&&Ft(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,E,{passive:!0}),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,b,{passive:!0}),t.addEventListener(`touchmove`,T,{passive:!0}),t.addEventListener(`pointerdown`,v,{passive:!0}),window.addEventListener(`pointerup`,y,{passive:!0}),t.addEventListener(`keydown`,_);let O;return typeof ResizeObserver<`u`&&(O=new ResizeObserver(()=>{let e=f.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;h(Math.min(e,n)),n>=e&&(f.current=null)}else d.current&&g()}),O.observe(n)),()=>{t.removeEventListener(`scroll`,E),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,b),t.removeEventListener(`touchmove`,T),t.removeEventListener(`pointerdown`,v),window.removeEventListener(`pointerup`,y),t.removeEventListener(`keydown`,_),O?.disconnect()}},[e,s,D,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:O,loadOlder:D,restickIfStuck:y}}function Fn({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,X.jsx)(In,{runId:e,rows:t,controls:r}):(0,X.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,X.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function In({runId:e,rows:t,controls:n}){let r=(0,Y.useRef)(null),[i]=(0,Y.useState)(()=>zt(e,t.length)),a=(0,Y.useRef)(t.length);a.current=t.length;let o=(0,Y.useRef)(null),s=(0,Y.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(Rt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,X.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,X.jsx)(Ge,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,X.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function Ln({onJump:e}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,X.jsx)(pe,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function Rn(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function zn(e,t){return[{id:`agent:${e}`,entries:t}]}function Bn(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of wt([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function Vn({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,Y.useMemo)(()=>Bn(n,e),[n,e]),u=Pn(`${e}:${t}`,{surface:r}),d=s??u,f=(0,Y.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,X.jsx)(Hn,{message:e.content.message,actions:o?.[e.key]}):(0,X.jsx)(Un,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??Nt(``,f.length),m=f.length===0?i??null:(0,X.jsx)(Fn,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,X.jsx)(Ot,{runId:e,children:r===`panel`?(0,X.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,X.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,X.jsx)(Ln,{onJump:d.jumpToLatest})}):null]}):m})}function Hn({message:e,actions:t}){return(0,X.jsx)(Bt,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function Un({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,X.jsx)(Gn,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,X.jsx)(en,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,X.jsx)(Wn,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,X.jsx)(tn,{group:e,scope:t});case`streak`:return(0,X.jsx)(nn,{count:e.count,children:e.blocks.map(e=>(0,X.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))});default:return Kn(e)}}function Wn({entries:e,scope:t,renderAsk:n}){return wt([...e]).map(e=>(0,X.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))}function Gn({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,X.jsx)(Vt,{text:e.text}):(0,X.jsx)(Bt,{text:e.text});case`reasoning`:return(0,X.jsx)(Gt,{text:e.text});case`tool`:return(0,X.jsx)(en,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,X.jsx)(Ht,{note:e});case`image`:return(0,X.jsx)(rn,{image:e});case`ask`:return n===void 0?(0,X.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,X.jsx)(Wt,{incident:e});default:return Kn(e)}}function Kn(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function qn({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,X.jsx)(he,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,X.jsx)(ve,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,X.jsx)(Jn,{runId:e,renderAsk:t,agent:n,entries:r})})})}function Jn({runId:e,renderAsk:t,agent:n,entries:r}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(me,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,X.jsxs)(ge,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,X.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,X.jsxs)(ye,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(Yn,{status:n.status}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,X.jsx)(Vn,{runId:e,viewId:`agent:${n.id}`,sections:zn(n.id,r),mode:`panel`,renderAsk:t,empty:(0,X.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function Yn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,X.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:I(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function Xn({run:e}){return(0,X.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,X.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,X.jsx)(Fe,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,X.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,X.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,X.jsx)(qe,{runId:e.id}),(0,X.jsx)(Zn,{run:e})]})}function Zn({run:e}){let t=d(),n=(0,Y.useRef)(null),[r,a]=(0,Y.useState)(``),[o,l]=(0,Y.useState)(null),u=Oe(e.id),p=ke(e),m=()=>t.invalidateQueries({queryKey:f.runs.all}),h=c({mutationFn:async t=>p.canContinue?g(e.id,{text:`Review feedback:\n${t}`,runner:p.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),m())},onError:e=>O(e.message,{tone:`danger`})}),_=c({mutationFn:()=>v(e.id),onSuccess:e=>{O(`Draft PR created — ${e.url}`),m()},onError:e=>{e instanceof s&&e.manual!==void 0&&l(e.manual),O(e.message,{tone:`danger`})}}),y=()=>{let e=r.trim();if(e.length===0){O(`Write what to change first.`),n.current?.focus();return}h.mutate(e)};return(0,X.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,X.jsx)(Ue,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:r,onChange:e=>a(e.target.value),onKeyDown:e=>{We({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`min-h-[52px] text-[13px]`}),p.canContinue?null:(0,X.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:p.reason}),p.providerPending?null:(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(T,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:p.reason??`Send the notes back into the agent's session`,"aria-describedby":p.canContinue?void 0:`review-provider-guidance`,disabled:h.isPending||!p.canContinue,onClick:y,children:[(0,X.jsx)(nt,{"aria-hidden":`true`}),`Send back`]}),ae(e.pullRequestUrl)?(0,X.jsx)(T,{asChild:!0,variant:`outline`,size:`sm`,children:(0,X.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,X.jsx)(je,{"aria-hidden":`true`}),`PR ↗`]})}):(0,X.jsxs)(T,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,X.jsx)(Me,{"aria-hidden":`true`}),`Draft PR`]}),(0,X.jsxs)(T,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:le(`review`),disabled:u.isPending,onClick:()=>u.mutate(),children:[(0,X.jsx)(i,{"aria-hidden":`true`}),`Accept`]})]}),o===null?null:(0,X.jsx)(Qn,{command:o})]})}function Qn({command:e}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>O(`Command copied to clipboard.`)).catch(()=>O(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,X.jsx)(Ne,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function $n(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var er=1500;function tr({status:e}){let t=(0,Y.useRef)(e),[n,r]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||$n())return;r(!0);let i=setTimeout(()=>r(!1),er);return()=>clearTimeout(i)},[e]),n?(0,X.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,X.jsx)(A,{}),(0,X.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,X.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}function nr(e,t){return`${e.header}: ${t.join(`, `)}`}function rr({ask:e,run:t}){return e.resolved?(0,X.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,X.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,X.jsx)(ir,{ask:e,run:t})}function ir({ask:e,run:t}){let n=L(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,Y.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>nr(e,o[t]??[])).join(`
|
|
7
|
-
`)),d=n.mode===`resume`;return(0,X.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,X.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,X.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,X.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,X.jsx)(ar,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(nr(e,i)):c(t,i))}},e.id??t))}),a?d?(0,X.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,X.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,X.jsx)(T,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,X.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,X.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:n.reason}),(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,X.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,X.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function ar({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,X.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,X.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,X.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,X.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,X.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,X.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:I(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,X.jsx)(`span`,{"aria-hidden":!0,className:I(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,X.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var or=2e3;function sr(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function cr(e,t){let n=d(),r=(0,Y.useMemo)(()=>sr(t),[t]),i=e?.id,a=e?.status;(0,Y.useEffect)(()=>{if(r===0||i===void 0||a!==`running`&&a!==`waiting`)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:f.runs.detail(i)}),n.invalidateQueries({queryKey:f.runs.list()})},or);return()=>clearTimeout(e)},[r,i,a,n])}function lr(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function ur(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function dr(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 fr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`?e:void 0}function pr(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`?e:void 0}function $(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
|
|
8
|
-
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
9
|
-
`):n}function mr(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 hr(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var gr=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,_r=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function vr(e){if(!fr(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!fr(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:_r.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function yr(e,t={}){let n=[],r=new Map,i,a=0,o,s=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=Q(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(t.type){case`user-message`:{let e=Q(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=Q(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s(t.seq).turnId=e;break}case`turn.completed`:{let e=Q(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:Q(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!fr(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=Q(t.itemId)??``,n=r.get(l(t,e)),i=Q(t.delta)??``;if(!n||i===``||!gr(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=Q(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=Q(t.tool)??`Tool`;if(br.has(n))break;let i=Qe(n,t.input);if(i.toolKind===`plan`){let n=vr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:Q(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get(Q(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=hr(t.result);break}case`note`:case`lifecycle`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`dim`}});break}case`error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=Q(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=Q(t.error)?` — ${Q(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${Q(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=Q(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:Q(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=pr(t.provider),n=Q(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=Q(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=Q(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:Q(t.reason)??`end_turn`,...Q(t.message)===void 0?{}:{message:Q(t.message)}};break;case`ask.requested`:{let e=Q(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>fr(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;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()))),mr(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...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,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var br=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function xr(){let{id:e}=o(),t=N(e),n=ht(e),r=t.data?.status,i=(0,Y.useMemo)(()=>yr(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,Y.useMemo)(()=>yr(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),c=(0,Y.useRef)(void 0),l=(0,Y.useCallback)(e=>{c.current=e},[]),{mutate:u}=M();if((0,Y.useEffect)(()=>{t.data&&c.current!==t.data.id&&se(t.data)&&u(t.data.id)},[u,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),cr(t.data,n.visibleEvents),t.isPending)return(0,X.jsx)(be,{});if(t.isError){let e=t.error instanceof s&&t.error.status===404;return(0,X.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(j,{icon:e?(0,X.jsx)(Ve,{}):(0,X.jsx)(at,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,X.jsx)(T,{asChild:!0,variant:`outline`,children:(0,X.jsx)(H,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,X.jsx)(be,{}):(0,X.jsx)(Sr,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:l})}function Sr({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){let a=dr(e.status,e.error),o=lr(n),s=o!==void 0&&o.length>0?kn(o):void 0,c=e.status===`running`||e.status===`waiting`,u=e.status===`queued`,d=an(e),f=!c&&!u&&d.available,p=f&&d.canContinue,m=!c&&e.status!==`queued`,h=(0,Y.useMemo)(()=>mn(n.turns,m),[n.turns,m]),[g,_]=(0,Y.useState)(void 0),[v,b]=(0,Y.useState)(e.id);v!==e.id&&(b(e.id),_(void 0));let S=(0,Y.useMemo)(()=>g===void 0?void 0:bn(n.turns,g,m),[n.turns,g,m]),C=(0,Y.useMemo)(()=>g===void 0?[]:xn(n.turns,g),[n.turns,g]),w=l(e.id),T=de(e),O=c&&!T.usable,te=f&&!d.canContinue,k=O||te,A=O?T.reason:d.reason,{mutateAsync:j}=D(e.id),{mutateAsync:M}=x(e.id),{mutateAsync:N}=re(e.id),P=(0,Y.useMemo)(()=>u?{onEditTask:async e=>{await j({task:e})},onEditMessage:(e,t)=>M({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>N(e).then(()=>void 0)}:void 0,[u,j,M,N]),ie=(0,Y.useMemo)(()=>Rn(e,t),[e,t]),F=(0,Y.useMemo)(()=>Bn(ie,e.id),[ie,e.id]),oe=(0,Y.useCallback)(t=>(0,X.jsx)(rr,{ask:t,run:e}),[e]),se=(0,Y.useMemo)(()=>{if(P===void 0)return;let t={task:{onEdit:P.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>P.onEditMessage(n.id,e),onRemove:()=>P.onRemoveMessage(n.id)};return t},[P,e.queuedMessages]),ce=ee(e,ne()),{search:le}=y(),ue=Nt(le,F.length),L=Pn(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:F.map(({key:e})=>e)});return Te(L.restickIfStuck),(0,X.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(Ae,{run:e,planTally:s,onMarkedUnread:()=>i?.(e.id)}),(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-3.5 px-4 py-5 md:px-6`,children:[r?(0,X.jsx)(Cr,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:L.loadOlder}):null,(0,X.jsx)(Vn,{runId:e.id,viewId:`main`,sections:ie,mode:`document`,renderAsk:oe,messageActions:se,scrollControls:L,renderMode:ue}),t.turns.length===0?e.status===`queued`?(0,X.jsx)(wr,{run:e}):(0,X.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,X.jsx)(Kt,{}):null,a&&a.state===`closed`?(0,X.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":a.state,className:I(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,a.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[a.label,ae(E(e))?(0,X.jsx)(`a`,{"data-slot":`pr-link`,href:E(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,ae(ce)?(0,X.jsx)(`a`,{"data-slot":`issue-link`,href:ce,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,X.jsx)(Xn,{run:e}):null]}),(0,X.jsx)(tr,{status:e.status}),(0,X.jsx)(qn,{runId:e.id,renderAsk:oe,agent:S,entries:C,onClose:()=>_(void 0)}),(0,X.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-4 pt-1.5 pb-3 max-md:border-t max-md:border-border md:px-6 md:pb-4`,children:[L.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,X.jsx)(Ln,{onJump:L.jumpToLatest})}):null,(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-2.5`,children:[(0,X.jsx)(wn,{runId:e.id,agents:h,onSelect:_},`agents:${e.id}`),o!==void 0&&o.length>0?(0,X.jsx)(jn,{runId:e.id,entries:o},e.id):null,(0,X.jsx)(gt,{run:e}),e.status===`waiting`?(0,X.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(U,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,u?(0,X.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(U,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,X.jsx)(_e,{onSubmit:p?(e,t)=>d.continueWith(e,t):(e,t)=>w.mutateAsync({text:e,images:t}),disabled:k||!c&&!u&&!p,disabledReason:k?A:`Session closed — no session to resume.`,footerEnd:k&&!d.providerPending?(0,X.jsx)(H,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):p?d.pills:void 0,allowEmptySubmit:p,sendAriaLabel:p?`Continue`:`Send`,placeholder:u?`Add to the prompt — sent when the run starts…`:p?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>ur(t)})]})]})]})}function Cr({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,X.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,X.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,X.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,X.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function wr({run:e}){let t=ue(m().data??[],e.id);return(0,X.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,X.jsx)(U,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,X.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{xr as TaskThreadRoute};
|