@hearsay-tools/squawk 0.19.0-dev.8893 → 0.19.0-dev.8902
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/activity/requests.js +1 -1
- package/dist/activity/requests.js.map +1 -1
- package/dist/activity/text.d.ts +0 -2
- package/dist/activity/text.js +1 -7
- package/dist/activity/text.js.map +1 -1
- package/dist/activity/tool-activity.js +1 -1
- package/dist/activity/tool-activity.js.map +1 -1
- package/dist/activity/wait.js +1 -1
- package/dist/activity/wait.js.map +1 -1
- package/dist/ci-wait/errors.js +2 -2
- package/dist/ci-wait/errors.js.map +1 -1
- package/dist/ci-wait/github.d.ts +22 -30
- package/dist/ci-wait/github.js +27 -9
- package/dist/ci-wait/github.js.map +1 -1
- package/dist/ci-wait/pr-wait-kind.d.ts +2 -2
- package/dist/ci-wait/pr-wait-kind.js +3 -3
- package/dist/ci-wait/pr-wait-kind.js.map +1 -1
- package/dist/ci-wait/pr-wait-port.d.ts +44 -0
- package/dist/ci-wait/pr-wait-port.js +125 -0
- package/dist/ci-wait/pr-wait-port.js.map +1 -0
- package/dist/ci-wait/progress.d.ts +4 -5
- package/dist/ci-wait/progress.js +1 -1
- package/dist/ci-wait/progress.js.map +1 -1
- package/dist/ci-wait/supervisor.d.ts +13 -8
- package/dist/ci-wait/supervisor.js +59 -26
- package/dist/ci-wait/supervisor.js.map +1 -1
- package/dist/ci-wait/tool-catalog.js +1 -1
- package/dist/ci-wait/tool-catalog.js.map +1 -1
- package/dist/core/clamp-text.d.ts +2 -0
- package/dist/core/clamp-text.js +8 -0
- package/dist/core/clamp-text.js.map +1 -0
- package/dist/core/forge-pr-wait.d.ts +99 -0
- package/dist/core/forge-pr-wait.js +20 -0
- package/dist/core/forge-pr-wait.js.map +1 -0
- package/dist/core/forge-registry.d.ts +6 -2
- package/dist/core/forge-registry.js +5 -0
- package/dist/core/forge-registry.js.map +1 -1
- package/dist/features/automations/tools.d.ts +8 -8
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.js +2 -0
- package/dist/plugin/index.js.map +1 -1
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/server/forge/github-forge.js +3 -0
- package/dist/server/forge/github-forge.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/runs-routes.d.ts +17 -17
- package/dist/server/server.d.ts +1396 -1396
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/dist/workflows/input-acknowledgement.d.ts +24 -24
- package/dist/workflows/run/wait-input-descriptors.js +1 -1
- package/dist/workflows/run/wait-input-descriptors.js.map +1 -1
- package/dist/workflows/run/wait-kind-registry.d.ts +3 -2
- package/dist/workflows/run/wait-kind-registry.js.map +1 -1
- package/dist/workflows/run/wait-registration-tool.js +3 -1
- package/dist/workflows/run/wait-registration-tool.js.map +1 -1
- package/package.json +4 -4
- package/web/dist/assets/{accounts-section-DV18K14j.js → accounts-section-CL4_y1Ap.js} +1 -1
- package/web/dist/assets/{activity-motion-U0gkYTm-.js → activity-motion-1nxINCqs.js} +1 -1
- package/web/dist/assets/{activity-route-CKFb-IYI.js → activity-route-yCPzQHRl.js} +1 -1
- package/web/dist/assets/{agent-config-section-X66FRjsE.js → agent-config-section-CO-Bl7d7.js} +1 -1
- package/web/dist/assets/{agent-defaults-section-EEYiGk_Q.js → agent-defaults-section-C90pO0nt.js} +1 -1
- package/web/dist/assets/{appearance-D4I-ANZ_.js → appearance-dgwYTY63.js} +1 -1
- package/web/dist/assets/{archive-on-merge-field-D6y7pCov.js → archive-on-merge-field-DJZVhb_I.js} +1 -1
- package/web/dist/assets/{automations-route-4ahsnx6z.js → automations-route-BhSkU9kZ.js} +2 -2
- package/web/dist/assets/{command-ppU3xBNs.js → command-BMMjB5k9.js} +1 -1
- package/web/dist/assets/{commit-list-Dp0c_x8b.js → commit-list-mYh1t3BD.js} +1 -1
- package/web/dist/assets/{design-icons-CzEoMH9c.js → design-icons-BZt8Kqs9.js} +1 -1
- package/web/dist/assets/{dialog-DXCws12U.js → dialog-CB9ZhEk2.js} +1 -1
- package/web/dist/assets/{diff-n7BcLjSi.js → diff-B4l1BaZJ.js} +2 -2
- package/web/dist/assets/{diff-controls-7hWjGeWp.js → diff-controls-Bs58JOMz.js} +1 -1
- package/web/dist/assets/{diff-view-CJNrRCRI.js → diff-view-BGwOGavy.js} +1 -1
- package/web/dist/assets/{discard-changes-dialog-Bd3w4xOW.js → discard-changes-dialog-Cr1vlcjZ.js} +1 -1
- package/web/dist/assets/dropdown-menu-VFda6KAg.js +1 -0
- package/web/dist/assets/{file-preview-DS5j5uFi.js → file-preview-DqopZwES.js} +1 -1
- package/web/dist/assets/{git-toolbar-D5N_Ucqr.js → git-toolbar-pr68yTY4.js} +1 -1
- package/web/dist/assets/github-BY-X8L5Q.js +1 -0
- package/web/dist/assets/{global-activity-route-DqyHJiZz.js → global-activity-route-XkwjlnaD.js} +1 -1
- package/web/dist/assets/index-BOWGArJd.css +1 -0
- package/web/dist/assets/index-I4_drgNu.js +21 -0
- package/web/dist/assets/{markdown-9FIYg1nH.js → markdown-fuaT5ciN.js} +1 -1
- package/web/dist/assets/{open-in-menu-L5v_AQZt.js → open-in-menu-Uw-sJhbG.js} +1 -1
- package/web/dist/assets/{option-select-CYbw9rk4.js → option-select-_tHcMUWt.js} +1 -1
- package/web/dist/assets/{preferences-section-Do1nZwKg.js → preferences-section-Crh_5QfK.js} +1 -1
- package/web/dist/assets/{preview-pane-connected-o7nx7h4-.js → preview-pane-connected-CLWRxEhI.js} +1 -1
- package/web/dist/assets/{project-location-BFN7mvbZ.js → project-location-DmGO5Dqx.js} +1 -1
- package/web/dist/assets/{projects-section-Bq9DzRDF.js → projects-section-CLPN14JX.js} +1 -1
- package/web/dist/assets/{prompt-templates-section-CNa_K7AU.js → prompt-templates-section-CQHpVrcB.js} +2 -2
- package/web/dist/assets/{reference-chip-O8Bfl1Oi.js → reference-chip-Dk69XD7Q.js} +1 -1
- package/web/dist/assets/{remote-settings-notice-CbCCb3QA.js → remote-settings-notice-C8naX_yp.js} +1 -1
- package/web/dist/assets/{repo-git-Dz3fhj6j.js → repo-git-CTSdvalV.js} +1 -1
- package/web/dist/assets/{report-reader-BfsdCLq-.js → report-reader-DJJixZxy.js} +1 -1
- package/web/dist/assets/{report-selection-cuFCCxDW.js → report-selection-BH0M_8bk.js} +1 -1
- package/web/dist/assets/{reports-Df83TkE3.js → reports-DXfywo34.js} +1 -1
- package/web/dist/assets/{resources-section-CKJGgLWa.js → resources-section-CA-D1Vj2.js} +1 -1
- package/web/dist/assets/review-panel-UI6FQQmp.js +11 -0
- package/web/dist/assets/{run-header-BWNapiIC.js → run-header-DDQU9tCB.js} +2 -2
- package/web/dist/assets/select-QO8XlmjU.js +1 -0
- package/web/dist/assets/{session-context-section-CSDtUgJI.js → session-context-section-CTDQl-i5.js} +1 -1
- package/web/dist/assets/{settings-agent-picker-pMZcMiW4.js → settings-agent-picker-DE5zKJtS.js} +1 -1
- package/web/dist/assets/{settings-list-detail-Ch1KMPjr.js → settings-list-detail-DcRsGkGy.js} +1 -1
- package/web/dist/assets/{settings-save-bar-CFkofH5G.js → settings-save-bar-DM7T22Nr.js} +1 -1
- package/web/dist/assets/{settings-shell-B6-ofejE.js → settings-shell-EOUcgx1J.js} +1 -1
- package/web/dist/assets/{sidebar-section-DwcXrxn2.js → sidebar-section-C69ES3GL.js} +1 -1
- package/web/dist/assets/{skills-DD5hhynR.js → skills-DuaNQ6XW.js} +1 -1
- package/web/dist/assets/task-changes-midIkW0D.js +1 -0
- package/web/dist/assets/{task-commits-D8Pzk4b3.js → task-commits-DAT7-sIh.js} +1 -1
- package/web/dist/assets/{task-file-scope-DPJOeknI.js → task-file-scope-BYAH1Mj8.js} +1 -1
- package/web/dist/assets/{task-files-DJnNyynG.js → task-files-CJaZfp0y.js} +1 -1
- package/web/dist/assets/{task-github-item-Di9HWGn6.js → task-github-item-BnoxG2el.js} +1 -1
- package/web/dist/assets/task-thread-fsRo8vgf.js +2 -0
- package/web/dist/assets/{thread-state-B2dX4psn.js → thread-state-T5A2uz_q.js} +1 -1
- package/web/dist/assets/use-hand-to-agent-state-CqiCI37V.css +1 -0
- package/web/dist/assets/use-hand-to-agent-state-Cy6oaj7k.js +1 -0
- package/web/dist/assets/use-path-bases-x6weDx5i.js +1 -0
- package/web/dist/assets/workflows-CwZ1aiR4.js +7 -0
- package/web/dist/assets/{workspace-tools-6fvZHbrZ.js → workspace-tools-0-Yx7SCS.js} +1 -1
- package/web/dist/assets/{worktrees-section-C1fpzChO.js → worktrees-section-Cn8sFOCC.js} +1 -1
- package/web/dist/index.html +9 -9
- package/web/dist/assets/dropdown-menu-B60L-d_4.js +0 -1
- package/web/dist/assets/github-Bhj0PA8h.js +0 -1
- package/web/dist/assets/index-UMSYsh9P.css +0 -1
- package/web/dist/assets/index-i4Bu7SvU.js +0 -21
- package/web/dist/assets/review-panel-BaUd88ko.js +0 -11
- package/web/dist/assets/select-Cy2NunWj.js +0 -1
- package/web/dist/assets/task-changes-CbWxyOEd.js +0 -1
- package/web/dist/assets/task-thread-gXImKbGN.js +0 -2
- package/web/dist/assets/use-hand-to-agent-state-BHaqyTxa.css +0 -1
- package/web/dist/assets/use-hand-to-agent-state-DhUiLIQg.js +0 -1
- package/web/dist/assets/use-path-bases-BzlzA9bw.js +0 -1
- package/web/dist/assets/workflows-slzqyi2_.js +0 -7
|
@@ -1,11 +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{m as r,o as i,s as a}from"./dist-C_rn70hE.js";import{$ as o,$t as s,Ct as c,P as l,Wt as u,Xt as d,Yt as f,_ as p,dn as m,lt as h,rn as g,un as _}from"./queries-CIeJg62Y.js";import{Fn as v,ct as y,dr as b,hi as x,n as S,ot as C,pt as w,rr as T}from"./toaster-D0HMoto5.js";import{f as E,n as D,p as ee}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{B as O,F as te,K as k,X as A,at as j,c as ne,dt as M,ft as re,s as ie,u as N,v as ae}from"./design-icons-CzEoMH9c.js";import{t as P}from"./createLucideIcon-BHp8sXmF.js";import{t as oe}from"./check-OP-CVgZG.js";import{t as se}from"./chevron-right-BENZ-1ZN.js";import{t as ce}from"./external-link-BE6y205O.js";import{t as le}from"./eye-B8okNWXU.js";import{n as ue}from"./smartphone-Lr8Ug2z_.js";import{t as de}from"./loader-circle-CPBhhDbB.js";import{t as fe}from"./message-square-B-MD-8rD.js";import{n as pe,t as me}from"./tool-display-B9NN44oU.js";import{t as he}from"./square-terminal-B6RYYieR.js";import{t as F}from"./button-C8jUIs8Q.js";import{n as I,r as L,t as R}from"./collapsible-Bx2vViFx.js";import{t as z}from"./project-router-BHFXTx5l.js";import{O as ge}from"./task-groups-C9pTQm-2.js";import{a as _e,c as ve,i as ye,l as be,o as xe,s as Se,t as Ce}from"./report-selection-cuFCCxDW.js";import{n as we}from"./centered-state-BgSV4e79.js";import{L as Te,Q as Ee,bn as De,dn as Oe,en as ke,hn as Ae,hr as je,in as Me,ir as Ne,lr as Pe,mn as Fe,nn as Ie}from"./index-i4Bu7SvU.js";import{i as Le,r as Re}from"./highlighter-Cfo7mLVB.js";import{t as ze}from"./zoomable-image-BUTgYpld.js";import{i as Be,r as Ve,t as B}from"./markdown-9FIYg1nH.js";import{r as He}from"./html-report-BX3msvci.js";import{t as V}from"./textarea-vEsJAUAV.js";import{t as Ue}from"./task-file-scope-DPJOeknI.js";import{t as We}from"./report-title-D4Mbu2Er.js";var Ge=P(`anchor`,[[`path`,{d:`M12 6v16`,key:`nqf5sj`}],[`path`,{d:`m19 13 2-1a9 9 0 0 1-18 0l2 1`,key:`y7qv08`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}],[`circle`,{cx:`12`,cy:`4`,r:`2`,key:`muu5ef`}]]),Ke=P(`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`}]]),qe=P(`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`}]]),Je=P(`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`}]]),Ye=P(`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`}]]),Xe=P(`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`}]]),H=e(t(),1),U=n();function Ze(e,t){if(e.length===1)return[t.replace(RegExp(`^${Qe(e[0].header)}: ?`),``)];let n=t,r=[];for(let[t,i]of e.entries()){let a=`${i.header}: `;if(!n.startsWith(a))return;n=n.slice(a.length);let o=e[t+1],s=o?n.indexOf(`\n${o.header}: `):n.length;if(s<0)return;r.push(n.slice(0,s)),n=n.slice(s+1)}return r}function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function $e(e,t){if(t===void 0)return[];let n=e.options??[];if(!e.multiSelect)return n.filter(e=>e.label===t).map(e=>e.label);let r=[];function i(e,t){for(let{label:a}of n)t.includes(a)||(e===a?r.push([...t,a]):e.startsWith(`${a}, `)&&i(e.slice(a.length+2),[...t,a]))}return i(t,[]),r.length===1?r[0]:[]}var et=`
|
|
2
|
-
|
|
3
|
-
Additional comments:
|
|
4
|
-
`;function tt(e){let t=e.indexOf(et);if(t<0)return{body:e,comment:void 0};let n=e.slice(t+23).trim();return{body:e.slice(0,t),comment:n||void 0}}function nt({ask:e}){let t=e.answer===void 0?void 0:tt(e.answer),n=t===void 0?void 0:Ze(e.questions,t.body);return(0,U.jsxs)(`div`,{"data-slot":`ask-answers`,className:`flex flex-col gap-4 text-sm`,children:[e.questions.map((t,r)=>{let i=n?.[r],a=$e(t,i),o=i!==void 0&&a.length===0;return(0,U.jsxs)(`section`,{className:`flex flex-col gap-2`,"aria-label":t.question,children:[(0,U.jsxs)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:[t.header,` · Question `,r+1,` of `,e.questions.length]}),(0,U.jsx)(`p`,{className:`break-words font-semibold`,children:t.question}),t.options?(0,U.jsxs)(`ul`,{className:`flex list-none flex-col gap-1.5`,children:[t.options.map(e=>(0,U.jsxs)(`li`,{"data-selected":a.includes(e.label),className:`flex items-start gap-2 rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border data-[selected=true]:bg-message-user-accent/5`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0 text-message-user-accent`,children:a.includes(e.label)?`✓`:`○`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 break-words`,children:[(0,U.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description?(0,U.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description}):null]}),a.includes(e.label)?(0,U.jsx)(`span`,{className:`shrink-0 text-xs text-message-user-accent`,children:`Selected`}):null]},e.label)),(0,U.jsxs)(`li`,{"data-selected":o,className:`rounded-md border border-border px-3 py-2 data-[selected=true]:border-message-user-border`,children:[(0,U.jsxs)(`p`,{className:`flex items-start gap-2 font-medium`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`text-message-user-accent`,children:o?`✓`:`○`}),(0,U.jsx)(`span`,{className:`flex-1`,children:`Other`}),o?(0,U.jsx)(`span`,{className:`text-xs text-message-user-accent`,children:`Selected`}):null]}),o?(0,U.jsx)(W,{text:i}):null]})]}):i===void 0?null:(0,U.jsx)(W,{text:i})]},t.id??r)}),n&&t?.comment?(0,U.jsxs)(`section`,{className:`flex flex-col gap-1`,"aria-label":`Additional comments`,children:[(0,U.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`Additional comments`}),(0,U.jsx)(W,{text:t.comment})]}):null,!n&&e.answer!==void 0?(0,U.jsx)(W,{text:e.answer}):null]})}function W({text:e}){return(0,U.jsx)(`blockquote`,{className:`[margin-block-start:0.5rem] border-s-2 border-message-user-accent ps-3 break-words whitespace-pre-wrap`,children:e})}function G(e,t,n){let r=n[e];return r===void 0?(t[e]?.length??0)>0:r.trim().length>0}function rt(e,t,n){let r=n[e]?.trim();if(r)return r;let i=t[e]??[];return i.length>0?i.join(`, `):`Not answered yet`}function it({stepped:e,mode:t,onModeChange:n,showModeSwitch:r,stepLabel:a,hasSheetContext:o,showContextButtonRef:s,onOpenContext:c,onShowOrigin:l}){return(0,U.jsxs)(`div`,{"data-slot":`ask-header`,className:`flex shrink-0 flex-wrap items-center gap-x-2 gap-y-1 border-b border-border/70 px-2.5 py-1.5 md:px-3 md:py-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold text-link-foreground`,children:`Needs your answer`}),e&&t===`options`?(0,U.jsx)(`span`,{"data-slot":`ask-step-indicator`,className:`rounded-full bg-accent-strong/15 px-2 py-0.5 text-xs font-semibold text-foreground tabular-nums`,children:a}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-1.5`,children:[o?(0,U.jsxs)(F,{ref:s,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(Pe,{"aria-hidden":`true`,className:`size-3.5`}),`Show context`]}):l?(0,U.jsx)(dt,{onShowOrigin:l}):null,r?(0,U.jsxs)(`div`,{"data-slot":`ask-mode-switch`,role:`group`,"aria-label":`Reply mode`,className:`inline-flex items-center rounded-lg border border-border bg-card p-0.5`,children:[(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-options`,"aria-pressed":t===`options`,onClick:()=>n(`options`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`options`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Options`}),(0,U.jsx)(`button`,{type:`button`,"data-slot":`ask-mode-reply`,"aria-pressed":t===`reply`,onClick:()=>n(`reply`),className:i(`min-h-11 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring md:min-h-7`,t===`reply`?`bg-accent-strong text-accent-strong-foreground`:`text-foreground hover:bg-muted/60`),children:`Write a reply`})]}):null]})]})}function at({questions:e,stepIndex:t,selections:n,otherAnswers:r,hasComment:a,onSelectStep:o}){let s=e.length;return(0,U.jsxs)(`div`,{"data-slot":`ask-step-pills`,role:`group`,"aria-label":`Question steps`,className:`hidden shrink-0 flex-wrap items-center gap-1.5 border-b border-border/60 px-3 py-1.5 md:flex`,children:[e.map((e,a)=>{let s=t===a,c=G(a,n,r);return(0,U.jsxs)(`button`,{type:`button`,"aria-current":s?`step`:void 0,onClick:()=>o(a),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,s?`border-accent-strong bg-accent-strong/15 text-foreground`:c?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(`span`,{className:`tabular-nums text-xs font-semibold`,children:c?(0,U.jsx)(oe,{"aria-hidden":`true`,className:`size-3 text-semantic-green`}):`${a+1}.`}),(0,U.jsx)(`span`,{className:`max-w-[140px] truncate`,children:e.header})]},e.id??a)}),(0,U.jsxs)(`button`,{type:`button`,"aria-current":t===s?`step`:void 0,onClick:()=>o(s),className:i(`inline-flex min-h-8 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-2 focus-visible:outline-ring`,t===s?`border-accent-strong bg-accent-strong/15 text-foreground`:a?`border-border bg-card text-foreground hover:border-accent-strong/50`:`border-dashed border-border bg-transparent text-muted-foreground hover:text-foreground`),children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3`}),(0,U.jsx)(`span`,{children:`Comment`})]})]})}function ot({questions:e,selections:t,otherAnswers:n,comment:r,disabled:a,onCommentChange:o,onJumpToQuestion:s}){let c=(0,H.useId)();return(0,U.jsxs)(`div`,{"data-slot":`ask-comment-step`,className:`flex flex-col gap-2.5`,children:[(0,U.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-2.5`,children:[(0,U.jsx)(`p`,{className:`mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:`Selected answers`}),(0,U.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.map((e,r)=>{let a=G(r,t,n);return(0,U.jsxs)(`li`,{className:`flex items-baseline justify-between gap-2 text-xs`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>s(r),className:`min-h-11 text-start font-medium text-link-foreground underline-offset-4 hover:underline md:min-h-6`,children:e.header}),(0,U.jsx)(`span`,{className:i(`min-w-0 truncate text-end`,a?`text-foreground`:`text-semantic-red`),children:rt(r,t,n)})]},e.id??r)})})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:c,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:c,"data-slot":`ask-additional-comment`,rows:2,value:r,disabled:a,placeholder:`Optional extra notes to send with your selections…`,onChange:e=>o(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}function st({value:e,onValueChange:t,disabled:n,renderFreeTextReply:r}){let i=(0,H.useId)();return r?(0,U.jsx)(`div`,{"data-slot":`ask-free-text`,children:r({value:e,onValueChange:t,disabled:n})}):(0,U.jsxs)(`div`,{"data-slot":`ask-free-text`,className:`flex flex-col gap-2`,children:[(0,U.jsx)(`label`,{htmlFor:i,className:`text-xs font-medium text-foreground`,children:`Reply to the agent`}),(0,U.jsx)(V,{id:i,rows:2,value:e,disabled:n,placeholder:`Write a free-text reply…`,onChange:e=>t(e.target.value),className:`bg-card text-base md:text-[13px]`})]})}function ct({stepIndex:e,questionCount:t,answeredCount:n,allAnswered:r,hasComment:a,resuming:o,disabled:s,onBack:c,onNext:l,onOpenComment:u,onSend:d,questions:f,selections:p,otherAnswers:m,stopControl:h}){let g=e===t-1,_=e===t,v=o?`Send answer & reopen`:`Send answer`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e>0?(0,U.jsxs)(F,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:c,children:[(0,U.jsx)(je,{"aria-hidden":`true`,className:`size-4`}),`Back`]}):null,(0,U.jsxs)(`span`,{"data-slot":`ask-progress-dots`,"aria-hidden":`true`,className:`flex items-center gap-1.5 px-1 md:hidden`,children:[f.map((t,n)=>{let r=n===e,a=G(n,p,m);return(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,r?`bg-accent-strong`:a?`bg-success`:`bg-border`)},t.id??n)}),(0,U.jsx)(`span`,{className:i(`size-2 rounded-full motion-safe:transition-colors`,_?`bg-accent-strong`:a?`bg-success`:`bg-border/60`)})]}),(0,U.jsxs)(`span`,{"data-slot":`ask-progress-summary`,className:`hidden text-xs text-soft-foreground tabular-nums sm:inline`,children:[n,` of `,t,` answered`]}),o?(0,U.jsx)(`span`,{"data-slot":`ask-resume-hint`,className:`text-xs text-soft-foreground`,children:`Reopens the closed session.`}):null,(0,U.jsxs)(`div`,{className:`ms-auto flex flex-wrap items-center gap-2`,children:[h,!g&&!_?(0,U.jsxs)(F,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:l,children:[`Next`,(0,U.jsx)(se,{"aria-hidden":`true`,className:`size-4`})]}):null,g?(0,U.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:u,children:a?`Edit comment`:`+ Comment`}):null,g||_||r?(0,U.jsx)(F,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:s||!r,onClick:d,children:v}):null]})]})}function lt({oneTap:e,hasOtherAnswer:t,allowComment:n,commentOpen:r,hasComment:i,resuming:a,disabled:o,onToggleComment:s,onSend:c,stopControl:l}){return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[n?(0,U.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,className:`min-h-11 min-w-11 px-2 text-xs text-muted-foreground hover:text-foreground md:min-h-8 md:min-w-0`,onClick:s,children:[(0,U.jsx)(Ye,{"aria-hidden":`true`,className:`size-3.5`}),r?`Hide comment`:i?`Edit comment`:`+ Add comment`]}):null,(0,U.jsx)(`span`,{"data-slot":a?`ask-resume-hint`:`ask-hint`,className:`text-xs text-soft-foreground`,children:a?`Reopens the closed session.`:e?`Tap an option to send.`:`Choose an answer, then send.`}),(0,U.jsxs)(`div`,{className:`ms-auto flex items-center gap-2`,children:[l,!e||t||r||i?(0,U.jsx)(F,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:o,onClick:c,children:a?`Send answer & reopen`:`Send answer`}):null]})]})}function ut({blockedBy:e,reason:t,error:n}){return(0,U.jsxs)(U.Fragment,{children:[t?(0,U.jsxs)(`p`,{"data-slot":`ask-blocked-reason`,className:`text-xs text-muted-foreground`,children:[t,` `,e===`provider`?(0,U.jsx)(z,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):null]}):null,n?(0,U.jsx)(`p`,{role:`alert`,className:`text-xs text-semantic-red`,children:n}):null]})}function dt({onShowOrigin:e,className:t}){return(0,U.jsx)(F,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-origin`,onClick:e,className:i(`min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,t),children:`Show where it was asked`})}function ft({open:e,onOpenChange:t,runId:n,context:r,onShowOrigin:i,returnFocusRef:a}){let o=(0,H.useRef)(!1);return(0,U.jsx)(ye,{open:e,onOpenChange:t,children:(0,U.jsxs)(xe,{side:`right`,showCloseButton:!1,"data-slot":`ask-context-sheet`,className:`flex w-full max-w-[540px] flex-col gap-0 p-0 sm:max-w-[540px]`,onCloseAutoFocus:e=>{if(e.preventDefault(),o.current){o.current=!1,i?.();return}a?.current?.focus()},children:[(0,U.jsxs)(ve,{className:`relative shrink-0 border-b border-border px-5 py-4 pr-14`,children:[(0,U.jsx)(be,{children:`Question context`}),(0,U.jsx)(Se,{children:`Your selections and drafts stay intact while you read.`}),(0,U.jsx)(_e,{asChild:!0,children:(0,U.jsx)(F,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Close`,className:`absolute inset-bs-2 end-2 size-11 md:size-9`,children:(0,U.jsx)(re,{"aria-hidden":`true`,className:`size-4`})})})]}),(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain break-words px-5 py-4 text-sm text-foreground`,children:(0,U.jsx)(Ue,{runId:n,children:(0,U.jsx)(B,{breaks:!0,children:r})})}),i?(0,U.jsx)(`div`,{className:`flex shrink-0 items-center justify-end border-t border-border px-5 py-3`,children:(0,U.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-show-origin`,className:`min-h-11 md:min-h-8`,onClick:()=>{o.current=!0,t(!1),i()},children:`Show where it was asked`})}):null]})})}function pt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var mt=/^[A-Za-z0-9_./:=+,@%-]+$/;function ht(e){return e.replaceAll(`'`,`'\\''`)}function gt(e){return e===``?`''`:mt.test(e)?e:`\u0027${ht(e)}\u0027`}function _t(e){if(!pt(e))return;let t=e.command;if(typeof t==`string`&&t!==``)return t;if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return e.map(gt).join(` `)}}function vt(e){let t="`".repeat(3),n=`~`.repeat(3);return e.split(t).filter((e,t)=>t%2==0).join(` `).split(n).filter((e,t)=>t%2==0).join(` `).split("`").filter((e,t)=>t%2==0).join(` `)}function yt(e){return e.replace(/!\[(?:\\.|[^\]\\])*\]\([^)\s]*(?:\s+"[^"]*")?\)/g,` `)}function bt(e){return e.replace(/(?<!\\)(?:\*\*|\*|__|~~|`)/g,``).replace(/\\([!"#$%&'()*+,\-./:;<=>?@[\]\\^_`{|}~])/g,`$1`)}function K(e){let t=e.trim();return t===``||t.startsWith(`#`)||/^(https?:|mailto:)/i.test(t)?!0:!/^[a-z][a-z0-9+.-]*:/i.test(t)}function xt(e){let t=vt(yt(e)),n=new Map;for(let e of t.matchAll(/^\s*\[([^\]]+)\]:\s*(\S+)/gm))K(e[2])&&n.set(e[1].toLowerCase(),e[2]);let r=t.replace(/^\s*\[[^\]]+\]:\s*\S+.*$/gm,` `),i=[];for(let e of r.matchAll(/(?<!!)\[((?:\\.|[^\]\\])+)\](?:\(((?:[^()\s]|\([^)]*\))+)(?:\s+"[^"]*")?\)|\[([^\]]*)\])|<(https?:\/\/[^>\s]+)>|(https?:\/\/[^\s<]+)/g)){if(e[2]){K(e[2])&&i.push({label:bt(e[1]),href:e[2]});continue}if(e[1]!==void 0&&e[3]!==void 0){let t=(e[3].length>0?e[3]:e[1]).toLowerCase(),r=n.get(t);r&&i.push({label:bt(e[1]),href:r});continue}let t=(e[4]??e[5])?.replace(/[.,;:!?]+$/,``);t&&K(t)&&i.push({label:t,href:t})}return i}var St=(0,H.createContext)(void 0),Ct=(0,H.createContext)(void 0);function wt(e,t){let n=new Map;for(let r of xt(e)){let e=Be(r.href,t);if(!e)continue;let i=new URL(e,`https://cockpit.invalid`),a=/^\/p\/([^/]+)\/tasks\/([^/]+)\/report$/.exec(i.pathname),o=/^\/tasks\/([^/]+)\/report$/.exec(i.pathname),s=i.searchParams.get(`artifact`);if(!s||(a?decodeURIComponent(a[1])!==t.projectId:!o))continue;let c=decodeURIComponent(a?a[2]:o[1]),l=`${c}:${s}`;n.has(l)||n.set(l,{runId:c,artifactId:s,label:r.label,href:e})}return[...n.values()]}function Tt(e,t){return`report-card-${encodeURIComponent(e)}-${t}`}function Et({text:e,messageKey:t}){let n=(0,H.useContext)(Ve),r=(0,H.useContext)(Ct),i=t??r;if(!n||i===void 0)return null;let a=wt(e,n);return a.length===0?null:(0,U.jsx)(`div`,{"data-slot":`report-cards`,className:`flex flex-col gap-3 [margin-block-start:1rem]`,children:a.map(e=>(0,U.jsx)(Dt,{reference:e,messageKey:i},`${e.runId}:${e.artifactId}`))})}function Dt({reference:e,messageKey:t}){let{artifactId:n,runId:r,label:i,href:a}=e,o=(0,H.useContext)(St),s=(0,H.useContext)(Ce);(0,H.useLayoutEffect)(()=>s?.register(n,r),[s,n,r]);let c=l(r,n),u=E(),d=ee();if(c.isError)return(0,U.jsx)(D,{id:Tt(t,n),"data-slot":`report-card-fallback`,to:a,state:{readerFrom:u.pathname+u.search},children:i});let f=c.data?.artifact;if(f&&!He(f.name))return null;let p=new URLSearchParams(u.search);p.set(`report`,n),p.set(`card`,t);let m=new URLSearchParams(u.search).has(`report`)?u.state:null,h=new URLSearchParams(u.search);h.delete(`report`),h.delete(`card`);let g=`${u.pathname}${h.size?`?${h}`:``}`,_=window.navigation,v={reportCardEntry:!0,reportReturnTo:m?.reportReturnTo??g,reportReturnKey:m?.reportReturnKey??_?.currentEntry?.key,reportScrollTop:m?.reportScrollTop},y={pathname:u.pathname,search:`?${p}`,hash:new URL(a,`https://cockpit.invalid`).hash};return(0,U.jsxs)(`section`,{"data-slot":`report-card`,"data-artifact-id":n,"data-report-run-id":r,"aria-busy":c.isPending,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-card p-3 text-foreground`,children:[(0,U.jsx)(`h3`,{className:`break-words text-sm font-medium`,children:f?We(f):i}),(0,U.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`HTML report`}),(0,U.jsx)(D,{id:Tt(t,n),to:y,state:v,onClick:e=>{if(e.button!==0||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault(),o?.(t);let n=v.reportScrollTop??(document.querySelector(`[data-slot="thread-transcript"]`)??document.querySelector(`[data-slot="main"]`))?.scrollTop;d(y,{state:{...v,reportScrollTop:n}})},className:`inline-flex min-h-11 min-w-11 items-center self-start rounded-md border border-border px-3 text-sm active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring ${c.isPending?`text-soft-foreground`:`text-accent-text`}`,children:`Read report`})]})}var Ot={message:!0,reasoning:!0,tool:!0,hook:!0};function kt(e){return Object.hasOwn(Ot,e)&&Ot[e]}var At=e=>e.kind===`tool`,jt=e=>e.kind===`conversation`,Mt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,Nt=(e,t,n)=>`${e} ${e===1?t:n}`;function Pt(e,t){let n=[];return e>0&&n.push(Nt(e,`file`,`files`)),t>0&&n.push(Nt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function Ft(e){return`${e} earlier tool call${e===1?``:`s`}`}var It=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function Lt(e){for(let t of It)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}var Rt=new WeakMap;function zt(e){let t=Rt.get(e);if(t)return t;let n=Bt(e);return Rt.set(e,n),n}function Bt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!((e.kind===`reasoning`||e.kind===`message`)&&e.text.trim()===``)),n=new Set(t.filter(At).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=kt(e.kind)&&`parentItemId`in e&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:Pt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]},c=[],l=()=>{if(c.length!==0){for(let e of Vt(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(jt(e)){s(),c.push(e);continue}l(),At(e)&&Mt(e)&&!r.has(e.id)?o.push(e):(s(),At(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}))}s(),l();let u=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,d=e=>e.kind===`context-group`?e.tools.length:1,f=[],p=[],m=()=>{if(p.length>3){let e=p.slice(0,p.length-3);f.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+d(t),0),blocks:e}),f.push(...p.slice(p.length-3))}else f.push(...p);p=[]};for(let e of a)u(e)?p.push(e):(m(),f.push(e));return m(),f}function Vt(e){let t=[];for(let n of e){let e=t.at(-1);n.messageKind===`request`&&e?.kind===`request`&&e.senderRunId===n.senderRunId&&e.text===n.text&&e.messages[0].relationship===`peer`==(n.relationship===`peer`)&&!e.messages.some(e=>e.recipientRunId===n.recipientRunId)?e.messages.push(n):t.push({id:`worker-batch:${n.messageId}`,kind:n.messageKind,text:n.text,senderRunId:n.senderRunId,messages:[n]})}return{kind:`worker-conversation`,id:`worker:${e[0].id}`,batches:t}}var Ht=new Map,Ut=(0,H.createContext)(null);function Wt(){return(0,H.useContext)(Ut)}function Gt({runId:e,children:t}){let n=(0,H.useMemo)(()=>({get:t=>Ht.get(e)?.get(t),set:(t,n)=>{let r=Ht.get(e)??new Map;r.set(t,n),Ht.set(e,r)}}),[e]);return(0,U.jsx)(Ut.Provider,{value:n,children:t})}function Kt(e){return e.scrollTop<Math.max(600,e.clientHeight)}function qt(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 Yt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Xt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Zt=new Map;function Qt(e,t){Zt.set(e,t)}function $t(e){return Zt.get(e)}var en=new Map;function tn(e,t){en.set(e,{...t,...t.rowKeys?{rowKeys:[...t.rowKeys]}:{}})}function nn(e){return en.get(e)}function rn(e,t,n){let r=en.get(e);if(!r||r.rows!==t)return;let i=r.rowKeys;if(!(n&&i&&(n.length!==t||i.length!==t||!n.every((e,t)=>e===i[t]))))return r.cache}var an=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}),on=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),sn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),cn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),ln=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function q(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function J(e){let t=q(e);return t===void 0?void 0:an.format(t)}function un(e){let t=q(e);return t===void 0?void 0:on.format(t)}var Y=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function dn(e){let t=q(e);return t===void 0?void 0:Y(t)}function fn(e,t=new Date){let n=q(e);if(n===void 0)return;let r=Y(n);return r===Y(t)?`Today`:r===Y(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?sn:cn).format(n)}function pn(e,t){let n=q(e),r=q(t);if(n===void 0||r===void 0)return;let i=Math.round((r.getTime()-n.getTime())/1e3);if(i<0)return;if(i<60)return`${i}s`;let a=Math.floor(i/60);return a<60?`${a}m ${String(i%60).padStart(2,`0`)}s`:`${Math.floor(a/60)}h ${String(a%60).padStart(2,`0`)}m`}function mn({ts:e}){let t=J(e);return t===void 0?null:(0,U.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:un(e),className:`text-xs leading-none text-soft-foreground`,children:t})}function hn({startedAt:e,completedAt:t}){let n=J(t);if(n===void 0)return null;let r=pn(e,t);return(0,U.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-xs leading-none text-soft-foreground`,children:[(0,U.jsx)(`time`,{dateTime:t,title:un(t),children:n}),r===void 0?null:(0,U.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function gn({ts:e}){let t=fn(e),n=q(e);if(t===void 0||n===void 0)return null;let r=ln.format(n);return(0,U.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-xs font-medium text-soft-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,U.jsx)(`time`,{dateTime:dn(e),title:r,children:t}),(0,U.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}var _n={assistant:`Agent message`,error:`Runner error`,"session.error":`Session error`,"step-end":`Step status`,lifecycle:`Run status`};function vn({note:e}){return e.icon===`handoff`?(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,"data-icon":`handoff`,className:`flex items-start gap-2 px-0.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`mt-[-1px] flex size-5 shrink-0 items-center justify-center rounded-full border border-border text-success`,children:(0,U.jsx)(Ne,{className:`size-3`})}),(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):e.details&&e.details.length>0?(0,U.jsxs)(R,{"data-slot":`note-line`,"data-tone":e.tone,className:`group/failure min-w-0 px-0.5 text-xs`,children:[(0,U.jsxs)(`div`,{className:i(`flex items-start gap-2`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[(0,U.jsxs)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap wrap-anywhere`,children:[e.tone===`danger`?`✗ `:null,e.text]}),(0,U.jsxs)(L,{"data-slot":`note-details-toggle`,className:`inline-flex shrink-0 items-center gap-1 rounded-sm px-1.5 py-0.5 text-xs font-medium text-muted-foreground hover:bg-muted/50 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11 max-md:min-w-11 max-md:justify-center pointer-coarse:min-h-11 pointer-coarse:min-w-11 pointer-coarse:justify-center`,children:[(0,U.jsx)(N,{"aria-hidden":`true`,className:`size-3 shrink-0 motion-safe:transition-transform group-data-[state=open]/failure:rotate-90`}),`Details`]})]}),(0,U.jsx)(I,{children:(0,U.jsx)(`ul`,{"data-slot":`note-details`,className:`mbs-1.5 flex flex-col gap-1 border-s border-border ps-3 font-mono text-xs text-muted-foreground`,children:e.details.map((e,t)=>(0,U.jsxs)(`li`,{className:`min-w-0 whitespace-pre-wrap wrap-anywhere`,children:[(0,U.jsxs)(`span`,{className:`font-sans font-medium text-foreground`,children:[_n[e.source],`:`,` `]}),e.text]},`${e.source}:${t}`))})})]}):(0,U.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:i(`px-0.5 text-xs`,e.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:null,e.text]})}var yn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-user-accent`,accent:`text-message-user-accent`,body:`max-md:text-[12px]`},agent:{label:`AGENT RESPONSE`,speaker:`Agent response`,classes:`border-message-agent-border bg-message-agent-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-agent-accent`,accent:`text-message-agent-accent`,body:`text-[15px] md:text-[14px]`}};function X({role:e,children:t,className:n,ts:r,headerActions:a,...o}){let s=yn[e],c=r===void 0?void 0:J(r);return(0,U.jsxs)(`article`,{...o,"data-role":e,"aria-label":s.speaker,className:i(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes,n),children:[(0,U.jsxs)(`p`,{className:i(`m-0 flex w-full min-w-0 items-start gap-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 normal-case tracking-normal`,children:[(0,U.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2 uppercase tracking-[0.6px]`,children:[(0,U.jsx)(fe,{"aria-hidden":`true`,className:`size-4 shrink-0`}),s.label]}),a]}),c===void 0?null:(0,U.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,U.jsx)(mn,{ts:r})})]}),(0,U.jsx)(`div`,{className:i(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,s.body,`leading-[1.6]`),children:t})]})}var bn=[],xn=(0,H.memo)(function({text:e,imageCount:t=0,images:n=bn,ts:i,onEdit:a,onRemove:o,editLabel:s=`Edit message`,removeLabel:c=`Remove message`,children:l}){let u=t-n.length,[d,f]=(0,H.useState)(!1),[p,m]=(0,H.useState)(e),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(),y=()=>{m(e),v(void 0),f(!0)},x=async()=>{let t=p.trim();if(!t||t===e){f(!1);return}g(!0),v(void 0);try{await a?.(t),f(!1)}catch(e){v(e instanceof Error?e.message:`Could not save the message`)}finally{g(!1)}},S=async()=>{g(!0),v(void 0);try{await o?.()}catch(e){v(e instanceof Error?e.message:`Could not remove the message`)}finally{g(!1)}};return d?(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,U.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:p,onChange:e=>m(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),f(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),x())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[14px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,U.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>f(!1),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm px-2 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void x(),disabled:h,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded-sm bg-action px-2 text-xs font-semibold text-action-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:h?(0,U.jsx)(de,{className:`size-3.5 animate-spin`}):`Save`})]}),_?(0,U.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:_}):null]}):(0,U.jsxs)(X,{role:`user`,ts:i,"data-slot":`user-bubble`,className:`group`,children:[a||o?(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[a?(0,U.jsx)(`button`,{type:`button`,"aria-label":s,onClick:y,disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(Xe,{className:`size-3.5`})}):null,o?(0,U.jsx)(`button`,{type:`button`,"aria-label":c,onClick:()=>void S(),disabled:h,className:`inline-flex size-11 items-center justify-center rounded-sm text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(j,{className:`size-3.5`})}):null]}):null,_?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:_}):null,l??(0,U.jsx)(B,{breaks:!0,children:e}),n.length>0?(0,U.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>b(e.split(`/`).pop()??``)?(0,U.jsx)(ze,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,U.jsxs)(`a`,{href:r(e),download:!0,"data-slot":`user-file`,className:`inline-flex min-h-11 min-w-11 max-w-[220px] items-center gap-1.5 rounded-md border border-border bg-background/60 px-2 py-1 text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(k,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,u>0?(0,U.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[u,` image`,u>1?`s`:``,` attached`]}):null]})}),Sn=`inline-flex h-11 min-w-11 items-center justify-center gap-1 rounded-sm px-2 text-xs font-medium text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,Cn=[`[data-streamdown="code-block-actions"]`,`[data-streamdown="code-copy-button"]`,`[data-streamdown="code-block-copy-button"]`,`[data-streamdown="code-block-header"]`].join(`,`);function wn(e,t){let n=e.cloneNode(!0);n.querySelectorAll(Cn).forEach(e=>e.remove());let r=xt(t);return[...n.querySelectorAll(`button[data-streamdown="link"]`)].forEach(e=>{let t=e.textContent??``,i=r.findIndex(e=>e.label===t);if(i<0)return;let a=r.splice(i,1)[0];if(!a||!K(a.href))return;let o=n.ownerDocument.createElement(`a`);o.setAttribute(`href`,a.href),o.setAttribute(`data-streamdown`,`link`),o.textContent=e.textContent,e.replaceWith(o)}),n.innerHTML}async function Tn(e,t,n){if(e===`markdown`){if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(t);return}if(!navigator.clipboard?.write||typeof ClipboardItem>`u`||!n)throw Error(`Clipboard unavailable`);let r=wn(n,t);await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:`text/html`}),"text/plain":new Blob([t],{type:`text/plain`})})])}var En=(0,H.memo)(function({text:e,ts:t,messageKey:n}){let r=(0,H.useRef)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),c=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>{c.current!==null&&clearTimeout(c.current)},[]);let l=async t=>{c.current!==null&&clearTimeout(c.current),a(null),s(null);try{await Tn(t,e,r.current),a(t),c.current=setTimeout(()=>a(null),2e3)}catch{s(`Couldn't copy to the clipboard`)}};return(0,U.jsxs)(X,{role:`agent`,ts:t,"data-slot":`assistant-message`,headerActions:(0,U.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`flex items-center gap-0.5`,children:[(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply`,onClick:()=>void l(`html`),className:Sn,children:[(0,U.jsx)(ae,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`html`?`Copied`:`Copy`})]}),(0,U.jsxs)(`button`,{type:`button`,"aria-label":`Copy reply as markdown`,onClick:()=>void l(`markdown`),className:Sn,children:[(0,U.jsx)(Pe,{className:`size-3.5`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{"aria-live":`polite`,children:i===`markdown`?`Copied`:`Copy markdown`})]})]}),children:[o?(0,U.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:o}):null,(0,U.jsx)(`div`,{ref:r,children:(0,U.jsx)(B,{breaks:!0,children:e})}),(0,U.jsx)(Et,{text:e,messageKey:n})]})});function Dn({incident:e}){let t=g().data;if(!t)return null;let n=d(t,e.provider);return(0,U.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,U.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,n,` authorization`]}),(0,U.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,n,` settings before retrying.`]}),(0,U.jsx)(z,{to:`/settings/agent-defaults#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}var On=(0,H.memo)(function({text:e}){let t=(0,H.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
5
|
-
`,1)[0]??``,r=n.length<e.length;return(0,U.jsxs)(R,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,U.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,U.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,U.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,U.jsx)(B,{inline:!0,children:n})}),r?(0,U.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,U.jsx)(L,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,U.jsx)(I,{children:(0,U.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,U.jsx)(B,{children:e})})})]})});function kn(){return(0,U.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,U.jsx)(de,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,U.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var An={read:Pe,edit:Xe,delete:j,move:Je,search:A,execute:he,think:Ke,fetch:ue,task:ie,plan:O,other:M},jn=e=>e.split(`
|
|
6
|
-
`).length;function Mn({text:e,streaming:t}){let[n,r]=(0,H.useState)(!1),a=(0,H.useRef)(null),o=(0,H.useRef)(!0);(0,H.useEffect)(()=>{let e=a.current;t&&e&&o.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let s=jn(e),c=!t&&!n&&s>12;return(0,U.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":c?`true`:void 0,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`div`,{ref:a,onScroll:t?e=>{o.current=Yt(e.currentTarget)}:void 0,className:i(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,c&&`max-h-[216px] overflow-y-hidden`),children:(0,U.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),c?(0,U.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&s>12?(0,U.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-xs font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${s} lines`}):null]})}function Nn({diffs:e}){return(0,U.jsx)(U.Fragment,{children:e.map((e,t)=>(0,U.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,U.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-xs wrap-anywhere text-muted-foreground`,children:e.path}),(0,U.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Pn(e.oldText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Pn(e.newText).map((e,t)=>(0,U.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
7
|
-
`).map((e,t)=>(0,U.jsx)(Fn,{text:e},t))})]},`${e.path}:${t}`))})}function Pn(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
8
|
-
`)}function Fn({text:e}){return(0,U.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 In(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function Ln(e){let t=e.status===`running`||e.status===`pending`,n=Lt(e.title),{verb:r,detail:i}=e.toolKind===`execute`&&n.detail===void 0?{verb:`Ran`,detail:e.title}:n;return{busy:t,verb:r,detail:i,expandedCommand:(e.toolKind===`execute`?_t(e.input):pe(e.name).toolKind===e.toolKind?me(e.name,e.input):void 0)??i,Icon:An[e.toolKind]??M}}function Rn(e,t){return e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t>0}function zn({item:e,busy:t}){return(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[t?(0,U.jsx)(de,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,U.jsx)(`span`,{"data-slot":`tool-exit`,className:i(`rounded-full px-2 py-px font-mono text-xs font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})}function Bn({item:e,command:t,busy:n,nested:r,cacheKey:i,renderNested:a}){return(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[t===void 0?null:(0,U.jsx)(`pre`,{"data-slot":`tool-command`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:t}),e.error!==void 0&&e.error!==``?(0,U.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap wrap-anywhere text-signal-word-red`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,U.jsx)(Nn,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,U.jsx)(Mn,{text:e.output,streaming:n}):null,r.length>0?(0,U.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:a?.(r,i??e.id)}):null]})}function Vn({item:e,nested:t=[],cacheKey:n,renderNested:r}){let a=Wt(),[o,s]=(0,H.useState)(()=>n===void 0?null:a?.get(n)??null),c=e=>{n!==void 0&&a?.set(n,e),s(e)},{busy:l,verb:u,detail:d,expandedCommand:f,Icon:p}=Ln(e),m=Rn(e,t.length),h=f!==void 0||m,g=h&&(o??(m&&In(e)));return(0,U.jsxs)(R,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:g,onOpenChange:c,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(L,{disabled:!h,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,U.jsx)(N,{"aria-hidden":!0,className:i(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!h&&`invisible`)}),(0,U.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:i(`shrink-0 font-semibold`,l&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:u}),d===void 0?null:(0,U.jsx)(`code`,{title:d,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:d}),(0,U.jsx)(zn,{item:e,busy:l})]}),(0,U.jsx)(I,{children:(0,U.jsx)(Bn,{item:e,command:f,busy:l,nested:t,cacheKey:n,renderNested:r})})]})}function Hn(e){let t=e.name??e.event,n=t.indexOf(`:`);return n>0?`${t.slice(0,n)} · ${t.slice(n+1)}`:t}function Un({item:e,cacheKey:t}){let n=Wt(),[r,a]=(0,H.useState)(()=>t===void 0?!1:n?.get(t)??!1),o=e=>{t!==void 0&&n?.set(t,e),a(e)},s=e.status!==`completed`,c=e.entries.some(e=>e.kind===`context`),l=(e.stdout??``)!==``||(e.stderr??``)!==``,u=Hn(e);return(0,U.jsxs)(R,{"data-slot":`hook-card`,"data-status":e.status,open:r,onOpenChange:o,className:i(`min-w-0 overflow-hidden rounded-md border bg-card`,s?`border-danger/25`:`border-border`),children:[(0,U.jsxs)(L,{className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] hover:bg-muted`,children:[(0,U.jsx)(N,{"aria-hidden":!0,className:`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),(0,U.jsx)(Ge,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Hook`}),(0,U.jsx)(`code`,{title:u,className:`block min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:u}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[s?(0,U.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.status}):c?(0,U.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`context`}):null,s&&typeof e.exitCode==`number`&&e.exitCode!==0?(0,U.jsx)(`span`,{"data-slot":`hook-exit`,className:`rounded-full bg-danger/10 px-2 py-px font-mono text-xs font-semibold text-danger`,children:e.exitCode}):null]})]}),(0,U.jsx)(I,{children:(0,U.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.entries.map((e,t)=>(0,U.jsx)(`pre`,{"data-slot":`hook-entry`,"data-kind":e.kind,className:i(`px-3 py-2 font-mono text-xs leading-[1.7] whitespace-pre-wrap [overflow-wrap:anywhere]`,(e.kind===`error`||e.kind===`stop`)&&`text-signal-word-red`),children:e.text},t)),e.source===void 0?null:(0,U.jsx)(`p`,{"data-slot":`hook-source`,className:`px-3 pb-2 font-mono text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:e.source}),l?(0,U.jsxs)(R,{className:`border-t border-border`,children:[(0,U.jsxs)(L,{"data-slot":`hook-raw-toggle`,className:`group flex w-full items-center gap-1 px-3 py-1 text-left text-xs text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(N,{"aria-hidden":!0,className:`size-3 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),`Raw output${typeof e.exitCode==`number`?` · exit ${e.exitCode}`:``}`]}),(0,U.jsxs)(I,{children:[e.stdout?(0,U.jsx)(`pre`,{"data-slot":`hook-stdout`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.stdout}):null,e.stderr?(0,U.jsx)(`pre`,{"data-slot":`hook-stderr`,className:`px-3 py-2 font-mono text-xs whitespace-pre-wrap text-signal-word-red [overflow-wrap:anywhere]`,children:e.stderr}):null]})]}):null]})})]})}function Wn({group:e,scope:t}){return(0,U.jsxs)(R,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,U.jsxs)(L,{className:`group flex h-[34px] tabular-nums 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,U.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,U.jsx)(I,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,U.jsx)(Vn,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function Gn({count:e,children:t}){return(0,U.jsxs)(R,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,U.jsxs)(L,{className:`group flex items-center gap-1.5 rounded-md p-0.5 tabular-nums text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,U.jsx)(N,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),Ft(e)]}),(0,U.jsx)(I,{children:(0,U.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function Kn({image:e}){return(0,U.jsx)(ze,{"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`})}var qn={finish:`Closed when the task finished`,superseded:`Closed when the worker went on`,"parent-stopped":`Closed when the parent stopped`,"worker-stopped":`Closed when the worker stopped`,undeliverable:`Closed: not delivered`};function Jn(e,t,n){return`${e.header}: ${n?.trim()||t.join(`, `)}`}function Yn(e,t,n,r=``){let i=e.map((e,r)=>Jn(e,t[r]??[],n[r])).join(`
|
|
9
|
-
`),a=r.trim();return a?`${i}\n\nAdditional comments:\n${a}`:i}function Xn({ask:e,run:t,projectId:n,onShowOrigin:r,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s=!1,onFinish:c,finishing:l=!1,mode:u,onModeChange:d,hideReplyBody:f=!1,delivery:p,surface:m=`transcript`}){let h=m===`transcript`&&e.context?(0,U.jsx)(Zn,{text:e.context}):null;if(e.resolved)return(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[e.context?(0,U.jsx)(Zn,{text:e.context}):null,(0,U.jsxs)(X,{role:`user`,"data-slot":`ask-card`,"data-resolved":`true`,children:[(0,U.jsx)(`span`,{className:`text-soft-foreground`,children:e.closed?qn[e.closed]:e.answeredBy===`parent`?`Answered by parent`:`Answered`}),(0,U.jsx)(nt,{ask:e})]})]});let g=e.placement===`pinned`&&r?r:void 0;return e.routedToParent?(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(Qn,{ask:e,runId:t.id,surface:m,onShowOrigin:g})]}):(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[h,(0,U.jsx)(nr,{ask:e,run:t,projectId:n,surface:m,onShowOrigin:g,onAnswered:i,renderFreeTextReply:a,onStop:o,stopping:s,onFinish:c,finishing:l,controlledMode:u,onModeChange:d,hideReplyBody:f,delivery:p})]})}function Zn({text:e}){return(0,U.jsx)(X,{role:`agent`,children:(0,U.jsx)(`div`,{"data-slot":`ask-context`,role:`region`,"aria-label":`Context`,className:`break-words text-sm text-foreground`,children:(0,U.jsx)(B,{breaks:!0,children:e})})})}function Qn({ask:e,runId:t,surface:n,onShowOrigin:r}){let[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null),s=n===`decision-zone`&&!!e.context;return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-routed":`parent`,className:`rounded-xl border border-card-edge bg-card shadow-card px-3 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-xs font-medium text-link-foreground`,children:`The agent is asking its parent`}),s?(0,U.jsx)(F,{ref:o,type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-show-context`,className:`ms-auto min-h-11 min-w-11 px-2 text-xs font-medium text-link-foreground underline underline-offset-4 md:min-h-8 md:min-w-0`,onClick:()=>a(!0),children:`Show context`}):null]}),(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-3`,children:e.questions.map((e,t)=>(0,U.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,U.jsx)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:(0,U.jsx)(`span`,{className:`rounded-md bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground`,children:e.header})}),(0,U.jsx)(`p`,{className:`mb-1.5 break-words text-sm font-semibold text-foreground`,children:e.question}),e.options?(0,U.jsx)(`ul`,{className:`flex list-disc flex-col gap-0.5 pl-5 text-[13px] text-muted-foreground`,children:e.options.map(e=>(0,U.jsxs)(`li`,{className:`break-words`,children:[(0,U.jsx)(`span`,{className:`text-foreground`,children:e.label}),e.description?(0,U.jsxs)(`span`,{children:[`: `,e.description]}):null]},e.label))}):(0,U.jsx)(`p`,{"data-slot":`ask-open-routed`,className:`text-[13px] text-muted-foreground`,children:`Open question: answered in words, with no options.`})]},e.id??t))}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`mt-2.5 flex flex-wrap items-center gap-2`,children:[(0,U.jsxs)(`p`,{"data-slot":`ask-routed-hint`,className:`text-xs text-muted-foreground`,children:[`Routed to parent: answer it in the`,` `,e.parentRunId?(0,U.jsx)(z,{to:`/tasks/${e.parentRunId}`,className:`font-medium text-foreground underline underline-offset-4`,children:`parent task`}):`parent task`,`.`]}),!s&&r?(0,U.jsx)(dt,{onShowOrigin:r,className:`ms-auto`}):null]}),s&&e.context?(0,U.jsx)(ft,{open:i,onOpenChange:a,runId:t,context:e.context,onShowOrigin:r,returnFocusRef:o}):null]})}function $n(e,t,n,r,i){let a=t.blockedBy!==void 0,o=e.questions,s=o.length>1,c=o.length,[l,u]=(0,H.useState)(`options`),d=n??l,f=e=>{u(e),r?.(e)},[p,m]=(0,H.useState)(0),[h,g]=(0,H.useState)({}),[_,v]=(0,H.useState)({}),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[C,w]=(0,H.useState)(``),[T,E]=(0,H.useState)(!1),D=s&&p===c,ee=o.length===1&&o[0]?.options!==void 0&&o[0]?.multiSelect!==!0&&!x&&y.trim()===``;Ae(Object.values(h).some(e=>e.length>0)||Object.values(_).some(e=>e.trim()!==``)||y.trim()!==``||C.trim()!==``);let O=(e,t)=>g(n=>({...n,[e]:t})),te=e=>v(t=>{if(t[e]===void 0)return t;let n={...t};return delete n[e],n}),k=e=>{O(e,[]),v(t=>({...t,[e]:t[e]??``}))},A=o.some((e,t)=>!e.options||_[t]!==void 0),j=o.filter((e,t)=>G(t,h,_)).length,ne=j===o.length,M=async e=>{let n=await t.send(e);return n===void 0&&i?.(),n};return{delivery:t,blocked:a,questions:o,stepped:s,commentStepIndex:c,mode:d,setMode:f,stepIndex:p,setStepIndex:m,selections:h,otherAnswers:_,setOtherAnswers:v,additionalComment:y,setAdditionalComment:b,singleCommentOpen:x,setSingleCommentOpen:S,freeTextDraft:C,setFreeTextDraft:w,contextOpen:T,setContextOpen:E,onCommentStep:D,oneTap:ee,setQuestion:O,clearOtherAnswer:te,selectOther:k,hasOtherAnswer:A,answeredCount:j,allAnswered:ne,deliver:M,sendAll:()=>void M(Yn(o,h,_,y)),sendFreeText:()=>{let e=C.trim();e&&M(e).then(e=>{e===void 0&&w(``)})}}}function er({state:e,renderFreeTextReply:t}){let n=(0,H.useId)(),r=e.delivery.isPending||e.blocked;if(e.mode===`reply`)return(0,U.jsx)(st,{value:e.freeTextDraft,onValueChange:e.setFreeTextDraft,disabled:r,renderFreeTextReply:t});if(e.onCommentStep)return(0,U.jsx)(ot,{questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,comment:e.additionalComment,disabled:r,onCommentChange:e.setAdditionalComment,onJumpToQuestion:e.setStepIndex});let i=e.stepped?Math.min(e.stepIndex,e.questions.length-1):0,a=e.questions[i];return a?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(or,{question:a,disabled:r,selected:e.selections[i]??[],isOther:e.otherAnswers[i]!==void 0,otherAnswer:e.otherAnswers[i]??``,onSelect:t=>{e.blocked||(e.clearOtherAnswer(i),e.oneTap?e.deliver(Jn(a,t)):e.setQuestion(i,t))},onOtherToggle:()=>{e.blocked||(e.otherAnswers[i]===void 0?e.selectOther(i):e.clearOtherAnswer(i))},onOtherChange:t=>e.setOtherAnswers(e=>({...e,[i]:t}))},a.id??i),!e.stepped&&e.singleCommentOpen?(0,U.jsxs)(`div`,{className:`pt-1`,children:[(0,U.jsx)(`label`,{htmlFor:n,className:`mb-1 block text-xs font-medium text-foreground`,children:`Additional comments (optional)`}),(0,U.jsx)(V,{id:n,"data-slot":`ask-additional-comment`,rows:2,value:e.additionalComment,disabled:r,placeholder:`Optional extra notes for the agent…`,onChange:t=>e.setAdditionalComment(t.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):null}function tr({onFinish:e,finishing:t,onStop:n,stopping:r,onActionError:i}){if(!e&&!n)return null;let a=e=>{i(void 0),Promise.resolve(e()).catch(e=>{i(e instanceof Error?e.message:String(e))})};return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,"data-slot":`ask-finish`,disabled:t||r,title:`Close the session and mark this task done`,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(e),children:t?`Finishing…`:`Finish`}):null,n?(0,U.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,disabled:r||t,className:`min-h-11 min-w-11 px-3 md:min-h-8 md:min-w-0`,onClick:()=>a(n),children:r?`Stopping…`:`Stop`}):null]})}function nr(e){return e.delivery===void 0?(0,U.jsx)(rr,{...e}):(0,U.jsx)(ir,{...e,delivery:e.delivery})}function rr(e){let t=ke(e.run,e.projectId);return(0,U.jsx)(ir,{...e,delivery:t})}function ir({ask:e,run:t,surface:n,onShowOrigin:r,onAnswered:a,renderFreeTextReply:o,onStop:s,stopping:c,onFinish:l,finishing:u,controlledMode:d,onModeChange:f,hideReplyBody:p,delivery:m}){let h=$n(e,m,d,f,a),[g,_]=(0,H.useState)(void 0),v=(0,H.useRef)(null),y=h.delivery.mode===`resume`,b=n===`decision-zone`||o!==void 0,x=n===`decision-zone`&&!!e.context,S=h.additionalComment.trim()!==``,C=h.mode===`reply`&&p,w=(0,U.jsx)(tr,{onFinish:l,finishing:u,onStop:s,stopping:c,onActionError:_});return(0,U.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-ask-id":e.id,"data-ask-mode":h.mode,"data-pinned":e.placement===`pinned`?`true`:void 0,"data-delivery":h.delivery.mode,className:i(`rounded-xl border border-accent-strong/30 bg-accent-strong/[0.04] [html:not(.light)_&]:bg-card`,C&&`rounded-b-none border-b-0`),children:[(0,U.jsx)(it,{stepped:h.stepped,mode:h.mode,onModeChange:h.setMode,showModeSwitch:b,stepLabel:h.onCommentStep?`Comment (optional)`:`${h.stepIndex+1} of ${h.questions.length}`,hasSheetContext:x,showContextButtonRef:v,onOpenContext:()=>h.setContextOpen(!0),onShowOrigin:x?void 0:r}),h.stepped&&h.mode===`options`?(0,U.jsx)(at,{questions:h.questions,stepIndex:h.stepIndex,selections:h.selections,otherAnswers:h.otherAnswers,hasComment:S,onSelectStep:h.setStepIndex}):null,C?null:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{"data-slot":`ask-body`,className:`flex flex-col gap-2.5 px-3 py-2.5`,children:(0,U.jsx)(er,{state:h,renderFreeTextReply:o})}),(0,U.jsxs)(`div`,{"data-slot":`ask-footer`,className:`flex shrink-0 flex-col gap-2 border-t border-border/70 px-3 py-2`,children:[(0,U.jsx)(ar,{state:h,hasComment:S,resuming:y,hasCustomReply:o!==void 0,stopControl:w}),(0,U.jsx)(ut,{blockedBy:h.delivery.blockedBy,reason:h.delivery.reason,error:h.delivery.error??g})]})]}),x&&e.context?(0,U.jsx)(ft,{open:h.contextOpen,onOpenChange:h.setContextOpen,runId:t.id,context:e.context,onShowOrigin:r,returnFocusRef:v}):null]})}function ar({state:e,hasComment:t,resuming:n,hasCustomReply:r,stopControl:i}){return e.mode===`reply`?r?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[i,(0,U.jsx)(F,{type:`button`,size:`sm`,className:`min-h-11 min-w-11 px-3.5 md:min-h-8 md:min-w-0`,disabled:e.delivery.isPending||e.blocked||e.freeTextDraft.trim()===``,onClick:e.sendFreeText,children:`Send reply`})]}):e.stepped?(0,U.jsx)(ct,{stepIndex:e.stepIndex,questionCount:e.questions.length,answeredCount:e.answeredCount,allAnswered:e.allAnswered,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked,onBack:()=>e.setStepIndex(e=>Math.max(0,e-1)),onNext:()=>e.setStepIndex(t=>Math.min(e.commentStepIndex,t+1)),onOpenComment:()=>e.setStepIndex(e.commentStepIndex),onSend:e.sendAll,questions:e.questions,selections:e.selections,otherAnswers:e.otherAnswers,stopControl:i}):(0,U.jsx)(lt,{oneTap:e.oneTap,hasOtherAnswer:e.hasOtherAnswer,allowComment:e.questions[0]?.allowFreeText!==!1,commentOpen:e.singleCommentOpen,hasComment:t,resuming:n,disabled:e.delivery.isPending||e.blocked||!e.allAnswered,onToggleComment:()=>e.setSingleCommentOpen(e=>!e),onSend:e.sendAll,stopControl:i})}function or({question:e,disabled:t,selected:n,isOther:r,otherAnswer:a,onSelect:o,onOtherToggle:s,onOtherChange:c}){let l=(0,H.useId)(),u=(0,H.useRef)(null),d=(0,H.useRef)(r),f=e.options,p=f!==void 0,m=p&&e.multiSelect===!0;(0,H.useEffect)(()=>{let e=r&&!d.current;d.current=r,e&&p&&u.current?.focus()},[r,p]);let h=e=>{if(!m){o([e]);return}o(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,U.jsxs)(`div`,{"data-slot":`ask-question`,role:`group`,"aria-label":e.question,children:[(0,U.jsxs)(`div`,{className:`mb-1.5 flex flex-wrap items-baseline gap-x-2 gap-y-0.5`,children:[(0,U.jsx)(`span`,{className:`shrink-0 rounded-md bg-accent-strong px-1.5 py-0.5 text-xs font-semibold uppercase tracking-wide text-accent-strong-foreground`,children:e.header}),(0,U.jsx)(`p`,{className:`min-w-0 flex-1 break-words text-sm font-semibold text-foreground`,children:e.question}),m?(0,U.jsx)(`span`,{className:`ms-auto text-xs text-soft-foreground`,children:`select all that apply`}):null]}),f?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{"data-slot":`ask-options`,className:`grid grid-cols-1 gap-1.5 sm:grid-cols-2 sm:gap-2`,children:[f.map(e=>{let r=n.includes(e.label);return(0,U.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>h(e.label),className:i(`flex min-h-11 w-full flex-col items-start justify-start content-start gap-0.5 rounded-md border px-2.5 py-1.5 text-left transition-colors focus-visible:outline-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50`,r?`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`:`border-border bg-card pointer-hover:border-accent-strong/50 pointer-hover:bg-accent-strong/[0.08]`),children:[(0,U.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13px] font-semibold text-foreground`,children:[m?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:i(`flex size-4 shrink-0 items-center justify-center rounded border text-[12px]`,r?`border-accent-strong bg-accent-strong text-accent-strong-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,U.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,U.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)}),e.allowFreeText===!1?null:(0,U.jsx)(F,{type:`button`,variant:`outline`,"aria-pressed":r,"aria-expanded":r,"aria-controls":r?l:void 0,disabled:t,onClick:s,className:i(`h-auto min-h-11 w-full justify-start px-2.5 py-1.5 text-left`,f.length%2==0&&`sm:col-span-2`,r&&`border-accent-strong bg-accent-strong/15 ring-1 ring-accent-strong/30 pointer-hover:border-accent-strong pointer-hover:bg-accent-strong/15`),children:`Other`})]}),e.allowFreeText!==!1&&r?(0,U.jsxs)(`div`,{className:`mt-2`,children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{ref:u,id:l,rows:2,value:a,disabled:t,placeholder:`Type your custom answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]}):null]}):(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:l,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Your answer`}),(0,U.jsx)(V,{id:l,rows:2,value:a,disabled:t,placeholder:`Type your answer…`,onChange:e=>c(e.target.value),className:`bg-card text-base md:text-[13px]`})]})]})}var sr=/^diff --git /;function cr(e){let t=e.replace(sr,``),n=t.lastIndexOf(` b/`);return Z(n>=0?t.slice(n+3):t)}function Z(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)&&t.length>=2?t.slice(1,-1).replace(/\\(.)/g,`$1`):t}function lr(e){let t=Z(e.slice(4));if(t!==`/dev/null`)return t.replace(/^[ab]\//,``)}function ur(e){return{path:cr(e),status:`modified`,binary:!1,additions:0,deletions:0,lines:[]}}function dr(e,t){if(t.startsWith(`rename from `))e.status=`renamed`,e.oldPath=Z(t.slice(12));else if(t.startsWith(`rename to `))e.status=`renamed`,e.path=Z(t.slice(10));else if(t.startsWith(`new file mode`))e.status=`added`;else if(t.startsWith(`deleted file mode`))e.status=`deleted`;else if(t.startsWith(`Binary files `)||t===`GIT binary patch`)e.binary=!0;else if(t.startsWith(`+++ `)){let n=lr(t);n!==void 0&&(e.path=n)}else if(t.startsWith(`--- `)){let n=lr(t);n!==void 0&&e.status===`deleted`&&(e.path=n)}}function fr(e,t){e.lines.push(t),t.startsWith(`+`)?e.additions+=1:t.startsWith(`-`)&&(e.deletions+=1)}function pr(e){let t=[],n=null,r=!1;for(let i of e.split(`
|
|
10
|
-
`)){if(sr.test(i)){n=ur(i),t.push(n),r=!1;continue}if(n){if(!r){i.startsWith(`@@`)?(r=!0,n.lines.push(i)):dr(n,i);continue}fr(n,i)}}let i=t.at(-1);return i&&i.lines.at(-1)===``&&i.lines.pop(),t}function mr(e){return{files:e.length,additions:e.reduce((e,t)=>e+t.additions,0),deletions:e.reduce((e,t)=>e+t.deletions,0)}}var hr=20,gr=300;function _r({runId:e,projectId:t}){let n=x(),r=o(e,t);(0,H.useEffect)(()=>{let r=t?[t,`runs`,`diff`,e]:u.runs.diff(e);n.invalidateQueries({queryKey:r})},[t,n,e]);let i=(0,H.useMemo)(()=>pr(r.data??``),[r.data]),[a,s]=(0,H.useState)(!1);if(r.isPending)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-soft-foreground`,children:`Loading diff…`});if(r.isError)return(0,U.jsx)(`p`,{className:`px-1 text-xs text-danger`,children:r.error.message});if(i.length===0)return(0,U.jsx)(`p`,{"data-slot":`run-diff-empty`,className:`px-1 font-mono text-xs text-soft-foreground`,children:r.data.trim()||`(no changes)`});let c=mr(i),l=a?i:i.slice(0,hr);return(0,U.jsxs)(`div`,{"data-slot":`run-diff`,className:`flex min-w-0 flex-col gap-2`,children:[(0,U.jsxs)(`p`,{className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`span`,{children:[c.files,` `,c.files===1?`file`:`files`,` changed`]}),(0,U.jsxs)(`span`,{className:`font-mono font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,c.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,c.deletions]})]})]}),l.map(e=>(0,U.jsx)(yr,{file:e},`${e.oldPath??``}→${e.path}`)),i.length>l.length?(0,U.jsxs)(F,{variant:`ghost`,size:`sm`,className:`self-start`,onClick:()=>s(!0),children:[`Show `,i.length-l.length,` more files`]}):null]})}var vr={added:`added`,deleted:`deleted`,renamed:`renamed`};function yr({file:e}){let[t,n]=(0,H.useState)(!0),r=vr[e.status],a=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,U.jsxs)(R,{open:t,onOpenChange:n,"data-slot":`diff-file`,className:`min-w-0 overflow-hidden rounded-md border border-card-edge bg-card shadow-card`,children:[(0,U.jsxs)(L,{className:`flex w-full items-start gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,U.jsx)(se,{className:i(`mbs-[1px] size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,U.jsx)(`span`,{"data-slot":`diff-file-path`,title:a,className:`min-w-0 wrap-anywhere font-mono text-xs font-medium`,children:e.oldPath?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),r?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:r}):null,e.binary?(0,U.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,U.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-xs font-semibold tabular-nums`,children:[(0,U.jsxs)(`span`,{className:`text-semantic-green`,children:[`+`,e.additions]}),` `,(0,U.jsxs)(`span`,{className:`text-semantic-red`,children:[`−`,e.deletions]})]})]}),(0,U.jsx)(I,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50`,children:e.binary?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.lines.length===0?(0,U.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,U.jsx)(br,{lines:e.lines})})})]})}function br({lines:e}){let[t,n]=(0,H.useState)(!1),r=t?e:e.slice(0,gr),a=r.join(`
|
|
11
|
-
`),[o,s]=(0,H.useState)(null);(0,H.useEffect)(()=>{let e=!1;return Re(a,`diff`).then(t=>{e||s({text:a,tokens:t.tokens})}),()=>{e=!0}},[a]);let c=o?.text===a?o.tokens:Le(a,`diff`)?.tokens??null;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`pre`,{"data-slot":`diff-file-body`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:r.map((e,t)=>(0,U.jsxs)(`span`,{"data-line":e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:void 0,className:i(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[c?.[t]===void 0?e:c[t].map((e,t)=>(0,U.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t)),e===``?` `:``]},t))}),e.length>gr?(0,U.jsx)(`button`,{type:`button`,"data-slot":`diff-file-toggle`,onClick:()=>n(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-xs font-medium text-soft-foreground hover:text-foreground`,children:t?`Show less`:`Show all ${e.length} lines`}):null]})}function xr(e,t,n,r){return ge(e,t)?.runner??e.runner??(t||n?r:void 0)??`claude`}function Sr(e,t,n){let r=new Set;for(let i of e.workflowDef?.steps??[]){if(i.command!==void 0||i.kind===`plugin`)continue;let a=i.runner??t,o=i.agentProfile??(a===(e.runner??t)?e.agentProfile:void 0)??n.repoAccount?.[a];n.readyOn(a,o)||r.add(a)}return[...r]}function Cr(e,t,n,r,i){if(!e)return t!==null||!n||r?i:void 0}function wr(e){return e.needsConfig&&e.configPending?`Checking task settings…`:e.needsConfig&&e.configError?`Task settings could not be loaded.`:e.providersPending?`Checking agent providers…`:e.providersError?`Provider authentication could not be verified.`:e.canContinue?void 0:e.untouched?`Connect the required workflow providers (${e.missing.join(`, `)}) to continue.`:`Connect an agent provider to continue.`}function Tr(){let e=c(),t=g();return{providers:e,registered:t,providersPending:e.isPending||t.isPending,providersError:e.isError||t.isError,providersReady:e.isSuccess&&t.isSuccess}}function Er(e,t=null,n){let{registered:r,providersPending:i,providersError:a,providersReady:o}=Tr(),c=p(n),l=Me(e),u=e.removedRunner!==void 0,d=l&&!e.runner||u,m=De(n),h=e.delegation?.role===`worker`,g=c.data?.defaultRunner,_=xr(e,l,u,f(g,s(r.data))??g),v=(t,n)=>Oe(e,t,m.repoAccount,{original:_,target:n},l),{runners:y,signedOut:b}=m.runnersOn(e=>v(e,e)),x=h?_:Te(t,y,_),S=y.includes(_),C=l?T(e.workflowDef,x,s(r.data)):[x],w=l&&h&&e.workflowDef?Sr(e,x,m):C.filter(e=>!m.readyOn(e,v(e,x))),E=o&&(!d||c.isSuccess)&&w.length===0,D=wr({needsConfig:d,configPending:c.isPending,configError:c.isError,providersPending:i,providersError:a,canContinue:E,untouched:l,missing:w});return{runners:y,signedOut:b,currentRunner:_,runner:x,currentRunnerConnected:S,canContinue:E,providerPending:i||d&&c.isPending,providerError:a,reason:D,runnerOverride:Cr(h,t,S,u,x)}}var Dr={open:!1,notes:``},Q=new Map,Or=new Set,$=null;function kr(){let e=[...Q.values()].some(e=>e.notes.trim()!==``);e&&$===null&&($=Fe()),!e&&$!==null&&($(),$=null);for(let e of Or)e()}function Ar(e){return Or.add(e),()=>{Or.delete(e)}}function jr(e){return Q.get(e)??Dr}function Mr(e,t){let n={...jr(e),...t};!n.open&&n.notes===``?Q.delete(e):Q.set(e,n),kr()}function Nr(e){Q.delete(e)&&kr()}function Pr(e){let t=(0,H.useSyncExternalStore)(Ar,()=>jr(e)),n=(0,H.useCallback)(t=>Mr(e,t),[e]),r=(0,H.useCallback)(()=>Nr(e),[e]);return{...t,update:n,clear:r}}function Fr(e,t){let n=x();return m({mutationFn:()=>w(e,t?.projectId),onSuccess:()=>{n.invalidateQueries({queryKey:u.runs.all}),t?.onSuccess?.()},onError:e=>S(e.message,{tone:`danger`})})}function Ir({run:e,projectId:t,onResolved:n}){return(0,U.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex flex-col gap-2 rounded-xl border border-info/35 bg-info/10 px-3.5 py-2.5`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2.5`,children:[(0,U.jsx)(le,{className:`size-4 shrink-0 text-semantic-info`,"aria-hidden":`true`}),(0,U.jsxs)(`p`,{className:`min-w-0 break-words text-[13px] leading-relaxed`,children:[(0,U.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,U.jsx)(`span`,{className:`block text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,U.jsx)(Rr,{run:e,projectId:t,onResolved:n})]})}function Lr({run:e,projectId:t,onResolved:n,showDiff:r=!0}){return(0,U.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-2.5`,children:[(0,U.jsx)(Ir,{run:e,projectId:t,onResolved:n}),r?(0,U.jsx)(_r,{runId:e.id,projectId:t}):null]})}function Rr({run:e,projectId:t,onResolved:n}){let r=h(),i=x(),o=(0,H.useRef)(null),s=Pr(e.id),{notes:c,open:l,clear:d}=s,f=e=>s.update({notes:e}),[p,g]=(0,H.useState)(null),[b,w]=(0,H.useState)(null),T=Fr(e.id,{projectId:t,onSuccess:()=>{d(),n?.()}}),E=Er(e,null,t),ee=()=>i.invalidateQueries({queryKey:u.runs.all}),O=m({mutationFn:async n=>E.canContinue?C(_(e.id,{projectId:t}),{text:`Review feedback:\n${n}`,runner:E.runnerOverride}):null,onMutate:()=>_(e.id,{projectId:t}),onSuccess:(t,i,a)=>{t!==null&&(jr(e.id).notes.trim()===i&&d(),r.invalidateAfter(`continue`,a),n?.())},onError:e=>S(e.message,{tone:`danger`})}),k=m({mutationFn:()=>y(e.id,t),onSuccess:e=>{S(`Draft PR created — ${e.url}`),d(),ee(),n?.()},onError:e=>{e instanceof v&&e.manual!==void 0&&w(e.manual),S(e.message,{tone:`danger`})}}),A=()=>{if(!l){s.update({open:!0}),requestAnimationFrame(()=>o.current?.focus());return}let e=c.trim();if(e.length===0){g(`Write what to change first.`),o.current?.focus();return}g(null),O.mutate(e)};return(0,U.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[E.canContinue?null:(0,U.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{children:E.reason}),E.providerPending?null:(0,U.jsx)(z,{to:`/settings/agent-defaults#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 [&_button]:min-h-11 [&_a]:min-h-11`,children:[(0,U.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,children:t?(0,U.jsxs)(D,{to:`/p/${encodeURIComponent(t)}/tasks/${encodeURIComponent(e.id)}/changes`,children:[(0,U.jsx)(le,{"aria-hidden":`true`}),`Review changes`]}):(0,U.jsxs)(z,{to:`/tasks/${e.id}/changes`,children:[(0,U.jsx)(le,{"aria-hidden":`true`}),`Review changes`]})}),(0,U.jsxs)(F,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:E.reason??(l?`Send the notes back into the agent's session`:`Write notes for the agent`),"aria-describedby":E.canContinue?void 0:`review-provider-guidance`,"aria-expanded":l,"aria-controls":l?`review-notes`:void 0,disabled:O.isPending||!E.canContinue,onClick:A,children:[(0,U.jsx)(qe,{"aria-hidden":`true`}),l?`Send back with notes`:`Send back`]}),a(e.pullRequestUrl)?(0,U.jsx)(F,{asChild:!0,variant:`outline`,size:`sm`,children:(0,U.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,U.jsx)(ce,{"aria-hidden":`true`}),`PR ↗`]})}):(0,U.jsxs)(F,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,U.jsx)(te,{"aria-hidden":`true`}),`Draft PR`]}),e.finishBlocked===null?(0,U.jsxs)(F,{"data-slot":`review-accept`,variant:`primary`,size:`sm`,className:`[margin-inline-start:auto]`,title:Ie(`review`),disabled:T.isPending,onClick:()=>T.mutate(),children:[(0,U.jsx)(ne,{"aria-hidden":`true`}),`Accept`]}):null]}),l?(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(V,{ref:o,id:`review-notes`,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,"aria-invalid":p!==null||void 0,"aria-describedby":p===null?void 0:`review-notes-error`,placeholder:`Notes for the agent — what should change?`,rows:1,value:c,onChange:e=>{let t=e.target.value;f(t),p!==null&&t.trim().length>0&&g(null)},onKeyDown:e=>{Ee({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(),A())},className:`min-h-11 text-base md:text-[13px]`}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[p===null?(0,U.jsx)(`span`,{}):(0,U.jsx)(`p`,{id:`review-notes-error`,"data-slot":`review-notes-error`,role:`alert`,className:`text-xs font-medium text-semantic-red`,children:p}),(0,U.jsx)(F,{"data-slot":`review-notes-cancel`,variant:`ghost`,size:`sm`,className:`min-h-11`,title:`Fold the notes box and drop the notes`,onClick:()=>{g(null),d()},children:`Cancel`})]})]}):null,b===null?null:(0,U.jsx)(zr,{command:b})]})}function zr({command:e}){return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>S(`Command copied to clipboard.`)).catch(()=>S(`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-xs text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(ae,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function Br(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var Vr=1500;function Hr({status:e}){let t=(0,H.useRef)(e),[n,r]=(0,H.useState)(!1);return(0,H.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||Br())return;r(!0);let i=setTimeout(()=>r(!1),Vr);return()=>clearTimeout(i)},[e]),n?(0,U.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,U.jsx)(we,{}),(0,U.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,U.jsx)(`span`,{className:`rounded-full border border-accent-strong/30 bg-accent-strong/15 px-4 py-1.5 text-[13px] font-medium text-accent-text shadow-modal`,children:`✓ Changes accepted`})})]}):null}export{tn as A,St as B,dn as C,nn as D,Kt as E,Wt as F,wt as H,zt as I,Lt as L,Jt as M,Xt as N,rn as O,Gt as P,kt as R,J as S,Yt as T,nt as U,Tt as V,Ye as W,kn as _,_r as a,mn as b,En as c,Kn as d,Dn as f,xn as g,Gn as h,Er as i,Qt as j,$t as k,Wn as l,Vn as m,Lr as n,Xn as o,On as p,Fr as r,Zn as s,Hr as t,Un as u,vn as v,qt as w,hn as x,gn as y,Ct as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{a as i,n as a,o}from"./dist-C_rn70hE.js";import{c as s,d as c,l}from"./design-icons-CzEoMH9c.js";import{a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,t as S,u as C}from"./es2015-CUEfzDjB.js";import{n as w,t as T}from"./dist-BSUJIXeE.js";import{t as E}from"./dist-Czz3Y5qH.js";import{a as D,i as O,n as k,r as A,t as j}from"./dist-DudPJH39.js";import{nr as ee}from"./index-i4Bu7SvU.js";var M=e(t(),1),N=e(n(),1);function P(e,[t,n]){return Math.min(n,Math.max(t,e))}var F=r(),I=[` `,`Enter`,`ArrowUp`,`ArrowDown`],L=[` `,`Enter`],R=`Select`,[z,B,V]=w(R),[H,U]=_(R,[V,D]),W=D(),[te,G]=H(R),[ne,re]=H(R),ie=`SelectProvider`;function K(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:p,required:m,form:h,internal_do_not_use_render:_}=e,v=W(t),[y,b]=M.useState(null),[x,S]=M.useState(null),[C,w]=M.useState(!1),E=T(l),[D,k]=f({prop:r,defaultProp:i??!1,onChange:a,caller:R}),[A,j]=f({prop:o,defaultProp:s,onChange:c,caller:R}),ee=M.useRef(null),N=M.useRef(A);M.useEffect(()=>{let e=h?y?.ownerDocument.getElementById(h):y?.form;if(e instanceof HTMLFormElement){let t=()=>j(N.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[h,y,j]);let P=!y||!!h||!!y.closest(`form`),[I,L]=M.useState(new Set),B=g(),V=Array.from(I).map(e=>e.props.value).join(`;`),H=M.useCallback(e=>{L(t=>new Set(t).add(e))},[]),U=M.useCallback(e=>{L(t=>{let n=new Set(t);return n.delete(e),n})},[]),G={required:m,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:B,value:A,onValueChange:j,open:D,onOpenChange:k,dir:E,triggerPointerDownPosRef:ee,disabled:p,name:u,autoComplete:d,form:h,nativeOptions:I,nativeSelectKey:V,isFormControl:P};return(0,F.jsx)(O,{...v,children:(0,F.jsx)(te,{scope:t,...G,children:(0,F.jsx)(z.Provider,{scope:t,children:(0,F.jsx)(ne,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:U,children:Qe(_)?_(G):n})})})})}K.displayName=ie;var q=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,F.jsx)(K,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,F.jsxs)(F.Fragment,{children:[n,e?(0,F.jsx)(Ze,{__scopeSelect:t}):null]})})};q.displayName=R;var ae=`SelectTrigger`,oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...a}=e,o=W(n),s=G(ae,n),c=s.disabled||r,l=i(t,s.onTriggerChange),u=B(n),d=M.useRef(`touch`),[f,p,h]=$e(e=>{let t=u().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,F.jsx)(j,{asChild:!0,...o,children:(0,F.jsx)(m.button,{type:`button`,role:`combobox`,"aria-controls":s.open?s.contentId:void 0,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":$(s.value)?``:void 0,...a,ref:l,onClick:b(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:b(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:b(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&p(e.key),!(t&&e.key===` `)&&I.includes(e.key)&&(g(),e.preventDefault())})})})});oe.displayName=ae;var se=`SelectValue`,ce=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,children:o,placeholder:s=``,...c}=e,l=G(se,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=i(t,l.onValueNodeChange);p(()=>{u(d)},[u,d]);let h=$(l.value);return(0,F.jsx)(m.span,{...c,asChild:!h&&c.asChild,ref:f,style:{pointerEvents:`none`},children:(0,F.jsx)(M.Fragment,{children:h?s:o},h?`placeholder`:`value`)})});ce.displayName=se;var le=`SelectIcon`,ue=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,F.jsx)(m.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ue.displayName=le;var de=`SelectPortal`,[fe,pe]=H(de,{forceMount:void 0}),me=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,F.jsx)(fe,{scope:e.__scopeSelect,forceMount:n,children:(0,F.jsx)(h,{asChild:!0,...r})})};me.displayName=de;var J=`SelectContent`,he=M.forwardRef((e,t)=>{let n=pe(J,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=G(J,e.__scopeSelect),[o,s]=M.useState();return p(()=>{s(new DocumentFragment)},[]),(0,F.jsx)(C,{present:r||a.open,children:({present:e})=>e?(0,F.jsx)(be,{...i,ref:t}):(0,F.jsx)(ge,{...i,fragment:o})})});he.displayName=J;var ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?N.createPortal((0,F.jsx)(_e,{scope:n,children:(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(`div`,{ref:t,children:r})})}),i):null});ge.displayName=`SelectContentFragment`;var Y=10,[_e,X]=H(J),ve=`SelectContentImpl`,ye=a(`SelectContent.RemoveScroll`),be=M.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C,...w}=e,T=G(J,n),[E,D]=M.useState(null),[O,k]=M.useState(null),A=i(t,D),[j,ee]=M.useState(null),[N,P]=M.useState(null),I=B(n),[L,R]=M.useState(!1),z=M.useRef(!1);M.useEffect(()=>{if(E)return S(E)},[E]),x();let V=M.useCallback(e=>{let[t,...n]=I().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&O&&(O.scrollTop=0),n===r&&O&&(O.scrollTop=O.scrollHeight),n?.focus(),document.activeElement!==i))return},[I,O]),H=M.useCallback(()=>V([j,E]),[V,j,E]);M.useEffect(()=>{L&&H()},[L,H]);let{onOpenChange:U,triggerPointerDownPosRef:W}=T;M.useEffect(()=>{if(E){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(W.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(W.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(E)||U(!1),document.removeEventListener(`pointermove`,t),W.current=null};return W.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[E,U,W]),M.useEffect(()=>{let e=()=>U(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[U]);let[te,ne]=$e(e=>{let t=I().filter(e=>!e.disabled),n=et(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),re=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&(ee(e),r&&(z.current=!0))},[T.value]),ie=M.useCallback(()=>E?.focus(),[E]),K=M.useCallback((e,t,n)=>{let r=!z.current&&!n;(T.value!==void 0&&T.value===t||r)&&P(e)},[T.value]),q=r===`popper`?we:Se,ae=q===we?{side:c,sideOffset:l,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:_,avoidCollisions:C}:{};return(0,F.jsx)(_e,{scope:n,content:E,viewport:O,onViewportChange:k,itemRefCallback:re,selectedItem:j,onItemLeave:ie,itemTextRefCallback:K,focusSelectedItem:H,selectedItemText:N,position:r,isPositioned:L,searchRef:te,children:(0,F.jsx)(v,{as:ye,allowPinchZoom:!0,children:(0,F.jsx)(u,{asChild:!0,trapped:T.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:b(a,e=>{T.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,F.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:(0,F.jsx)(q,{role:`listbox`,id:T.contentId,"data-state":T.open?`open`:`closed`,dir:T.dir,onContextMenu:e=>e.preventDefault(),...w,...ae,onPlaced:()=>R(!0),ref:A,style:{display:`flex`,flexDirection:`column`,outline:`none`,...w.style},onKeyDown:b(w.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ne(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=I().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>V(t)),e.preventDefault()}})})})})})})});be.displayName=ve;var xe=`SelectItemAlignedPosition`,Se=M.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...a}=e,o=G(J,n),s=X(J,n),[c,l]=M.useState(null),[u,d]=M.useState(null),f=i(t,d),h=B(n),g=M.useRef(!1),_=M.useRef(!0),{viewport:v,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,S=M.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&v&&y&&b){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-Y,d=P(a,[Y,Math.max(Y,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=h(),s=window.innerHeight-Y*2,l=v.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),m=parseInt(d.borderBottomWidth,10),_=parseInt(d.paddingBottom,10),x=f+p+l+_+m,S=Math.min(y.offsetHeight*5,x),C=window.getComputedStyle(v),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Y,D=s-E,O=y.offsetHeight/2,k=y.offsetTop+O,A=f+p+k,j=x-A;if(A<=E){let e=a.length>0&&y===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-v.offsetTop-v.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+m);c.style.height=n+`px`}else{let e=a.length>0&&y===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+v.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,v.scrollTop=A-E+v.offsetTop}c.style.margin=`${Y}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>g.current=!0)}},[h,o.trigger,o.valueNode,c,u,v,y,b,o.dir,r]);p(()=>S(),[S]);let[C,w]=M.useState();return p(()=>{u&&w(window.getComputedStyle(u).zIndex)},[u]),(0,F.jsx)(Te,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M.useCallback(e=>{e&&_.current===!0&&(S(),x?.(),_.current=!1)},[S,x]),children:(0,F.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,F.jsx)(m.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});Se.displayName=xe;var Ce=`SelectPopperPosition`,we=M.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Y,...a}=e,o=W(n);return(0,F.jsx)(A,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});we.displayName=Ce;var[Te,Ee]=H(J,{}),De=`SelectViewport`,Oe=M.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...a}=e,o=X(De,n),s=Ee(De,n),c=i(t,o.onViewportChange),l=M.useRef(0);return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,F.jsx)(z.Slot,{scope:n,children:(0,F.jsx)(m.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:b(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.current-t.scrollTop);if(e>0){let r=window.innerHeight-Y*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}l.current=t.scrollTop})})})]})});Oe.displayName=De;var ke=`SelectGroup`,[Ae,je]=H(ke),Me=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,F.jsx)(Ae,{scope:n,id:i,children:(0,F.jsx)(m.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Me.displayName=ke;var Ne=`SelectLabel`,Pe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=je(Ne,n);return(0,F.jsx)(m.div,{id:i.id,...r,ref:t})});Pe.displayName=Ne;var Z=`SelectItem`,[Fe,Ie]=H(Z),Le=M.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...s}=e,c=G(Z,n),l=X(Z,n),u=c.value===r,[f,p]=M.useState(o??``),[h,_]=M.useState(!1),v=i(t,d(e=>l.itemRefCallback?.(e,r,a))),y=g(),x=M.useRef(`touch`),S=()=>{a||(c.onValueChange(r),c.onOpenChange(!1))};return(0,F.jsx)(Fe,{scope:n,value:r,disabled:a,textId:y,isSelected:u,onItemTextChange:M.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,F.jsx)(z.ItemSlot,{scope:n,value:r,disabled:a,textValue:f,children:(0,F.jsx)(m.div,{role:`option`,"aria-labelledby":y,"data-highlighted":h?``:void 0,"aria-selected":u&&h,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:v,onFocus:b(s.onFocus,()=>_(!0)),onBlur:b(s.onBlur,()=>_(!1)),onClick:b(s.onClick,()=>{x.current!==`mouse`&&S()}),onPointerUp:b(s.onPointerUp,()=>{x.current===`mouse`&&S()}),onPointerDown:b(s.onPointerDown,e=>{x.current=e.pointerType}),onPointerMove:b(s.onPointerMove,e=>{x.current=e.pointerType,a?l.onItemLeave?.():x.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:b(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:b(s.onKeyDown,e=>{a||e.target!==e.currentTarget||l.searchRef?.current!==``&&e.key===` `||(L.includes(e.key)&&S(),e.key===` `&&e.preventDefault())})})})})});Le.displayName=Z;var Q=`SelectItemText`,Re=M.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:a,...o}=e,s=G(Q,n),c=X(Q,n),l=Ie(Q,n),u=re(Q,n),[f,h]=M.useState(null),g=d(e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),_=i(t,h,l.onItemTextChange,g),v=f?.textContent,y=M.useMemo(()=>(0,F.jsx)(`option`,{value:l.value,disabled:l.disabled,children:v},l.value),[l.disabled,l.value,v]),{onNativeOptionAdd:b,onNativeOptionRemove:x}=u;return p(()=>(b(y),()=>x(y)),[b,x,y]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(m.span,{id:l.textId,...o,ref:_}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren&&!$(s.value)?N.createPortal(o.children,s.valueNode):null]})});Re.displayName=Q;var ze=`SelectItemIndicator`,Be=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Ie(ze,n).isSelected?(0,F.jsx)(m.span,{"aria-hidden":!0,...r,ref:t}):null});Be.displayName=ze;var Ve=`SelectScrollUpButton`,He=M.forwardRef((e,t)=>{let n=X(Ve,e.__scopeSelect),r=Ee(Ve,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;o(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});He.displayName=Ve;var Ue=`SelectScrollDownButton`,We=M.forwardRef((e,t)=>{let n=X(Ue,e.__scopeSelect),r=Ee(Ue,e.__scopeSelect),[a,o]=M.useState(!1),s=i(t,r.onScrollButtonChange);return p(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;o(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,F.jsx)(Ge,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});We.displayName=Ue;var Ge=M.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=X(`SelectScrollButton`,n),o=M.useRef(null),s=B(n),c=M.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return M.useEffect(()=>()=>c(),[c]),p(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,F.jsx)(m.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:b(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:b(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:b(i.onPointerLeave,()=>{c()})})}),Ke=`SelectSeparator`,qe=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,F.jsx)(m.div,{"aria-hidden":!0,...r,ref:t})});qe.displayName=Ke;var Je=`SelectArrow`,Ye=M.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=W(n);return X(Je,n).position===`popper`?(0,F.jsx)(k,{...i,...r,ref:t}):null});Ye.displayName=Je;var Xe=`SelectBubbleInput`,Ze=M.forwardRef(({__scopeSelect:e,...t},n)=>{let r=G(Xe,e),{value:a,onValueChange:o,required:s,disabled:c,name:l,autoComplete:u,form:d}=r,{nativeOptions:f,nativeSelectKey:p}=r,h=M.useRef(null),g=i(n,h),_=a??``,v=E(_),y=Array.from(f).some(e=>(e.props.value??``)===``);return M.useEffect(()=>{let e=h.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(v!==_&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,_),e.dispatchEvent(t)}},[v,_]),(0,F.jsxs)(m.select,{"aria-hidden":!0,required:s,tabIndex:-1,name:l,autoComplete:u,disabled:c,form:d,onChange:e=>o(e.target.value),...t,style:{...ee,...t.style},ref:g,defaultValue:_,children:[$(a)&&!y?(0,F.jsx)(`option`,{value:``}):null,Array.from(f)]},p)});Ze.displayName=Xe;function Qe(e){return typeof e==`function`}function $(e){return e===``||e===void 0}function $e(e){let t=d(e),n=M.useRef(``),r=M.useRef(0),i=M.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=M.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return M.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function et(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=tt(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function tt(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function nt({...e}){return(0,F.jsx)(q,{"data-slot":`select`,...e})}function rt({...e}){return(0,F.jsx)(ce,{"data-slot":`select-value`,...e})}function it({className:e,size:t=`default`,children:n,...r}){return(0,F.jsxs)(oe,{"data-slot":`select-trigger`,"data-size":t,className:o(`flex w-fit items-center justify-between gap-2 rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-sm whitespace-nowrap shadow-none transition-[color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-11 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 pointer-hover:bg-muted [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,F.jsx)(ue,{asChild:!0,children:(0,F.jsx)(l,{className:`size-4 opacity-50`})})]})}function at({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,F.jsx)(me,{children:(0,F.jsxs)(he,{"data-slot":`select-content`,className:o(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,F.jsx)(st,{}),(0,F.jsx)(Oe,{className:o(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,F.jsx)(ct,{})]})})}function ot({className:e,children:t,...n}){return(0,F.jsxs)(Le,{"data-slot":`select-item`,className:o(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pe-8 ps-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,F.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute end-2 flex size-3.5 items-center justify-center`,children:(0,F.jsx)(Be,{children:(0,F.jsx)(s,{className:`size-4`})})}),(0,F.jsx)(Re,{children:t})]})}function st({className:e,...t}){return(0,F.jsx)(He,{"data-slot":`select-scroll-up-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(c,{className:`size-4`})})}function ct({className:e,...t}){return(0,F.jsx)(We,{"data-slot":`select-scroll-down-button`,className:o(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,F.jsx)(l,{className:`size-4`})})}export{rt as a,it as i,at as n,ot as r,nt 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{o as r}from"./dist-C_rn70hE.js";import{C as i,Wt as a,X as o,Y as s,dn as c,yt as l}from"./queries-CIeJg62Y.js";import{Bt as u,Fn as d,Ft as f,Ht as p,Lt as m,Tt as h,at as g,ct as _,hi as v,n as y,tr as b}from"./toaster-D0HMoto5.js";import{h as x}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{C as S,j as C,l as w}from"./design-icons-CzEoMH9c.js";import{t as T}from"./run-header-BWNapiIC.js";import{i as E,n as D,r as ee}from"./git-toolbar-D5N_Ucqr.js";import{t as O}from"./button-C8jUIs8Q.js";import{a as k,i as A,o as j,r as M,s as N,t as P}from"./dialog-DXCws12U.js";import{b as F,f as I}from"./task-groups-C9pTQm-2.js";import{f as L,l as R,m as z}from"./page-shell-Dky5crRl.js";import{t as B}from"./centered-state-BgSV4e79.js";import{C as V,In as H,Q as U,S as W,on as G}from"./index-i4Bu7SvU.js";import{t as K}from"./markdown-BBDDg-4t.js";import{t as q}from"./textarea-vEsJAUAV.js";import{t as J}from"./diff-n7BcLjSi.js";var Y=e(t(),1),X=`no worktree — this task ran directly in the repo working tree`;function Z(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.run.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.changedFiles===void 0?t(`Commit unavailable — changes are still loading`):e.changedFiles===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${X}`)}function Q(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):e.run.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${X}`)}function te(e){let t=e=>({id:`create-pr`,label:`Draft PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Draft PR unavailable — ${X}`):e.forge===null?t(`Draft PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?b(e.run)?t(`Draft PR unavailable — the run is waiting on a usage-limit hold; choose Don’t resume first`):F(e.run)?t(`Draft PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Draft PR`,enabled:!0}:t(`Draft PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function ne(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:Z(e),n=e.prUrl?[Z(e),Q(e)]:[Q(e),te(e)],r=[];if(e.localHandoff&&e.cliHandoff!==!1){let t=e.hasSession?F(e.run)?{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — the session is still active in the engine`}:{id:`open-terminal`,label:`Open in terminal`,enabled:!0}:{id:`open-terminal`,label:`Open in terminal`,enabled:!1,reason:`Terminal unavailable — no agent session to resume`};r.push(t)}return{primary:t,secondary:n,menu:r}}var $=n();function re({run:e,open:t,onOpenChange:n}){let r=v(),[i,o]=(0,Y.useState)(``),s=I(e),l=(0,Y.useRef)(s);l.current=s,(0,Y.useEffect)(()=>{t&&o(l.current)},[t]);let u=c({mutationFn:t=>g(e.id,t),onSuccess:t=>{y(`Committed ${H(t.sha)}`),n(!1),r.invalidateQueries({queryKey:a.runs.changes(e.id)}),r.invalidateQueries({queryKey:a.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),d=()=>{let e=i.trim();e.length===0||u.isPending||u.mutate(e)};return(0,$.jsx)(P,{open:t,onOpenChange:n,children:(0,$.jsxs)(M,{"data-slot":`commit-dialog`,children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(N,{children:`Commit changes`}),(0,$.jsxs)(A,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,$.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,$.jsx)(q,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:i,onChange:e=>o(e.target.value),onKeyDown:e=>{U({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(),d())}}),(0,$.jsxs)(k,{children:[(0,$.jsx)(O,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,$.jsx)(O,{"data-slot":`commit-confirm`,disabled:i.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:`Commit`})]})]})})}function ie(){let{id:e}=x(),t=s(e);return t.isPending?(0,$.jsx)(V,{tab:`changes`}):t.isError?(0,$.jsx)(W,{tab:`changes`,error:t.error}):(0,$.jsx)(ae,{run:t.data})}function ae({run:e}){let t=l(),n=i(),r=o(e.id,F(e)),s=z(),[p,h]=(0,Y.useState)(`unified`),[g,b]=(0,Y.useState)(!0),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(!1),k=(0,Y.useRef)(null),A=v(),j=()=>A.invalidateQueries({queryKey:a.runs.all}),M=e=>y(e.message,{tone:`danger`}),N=c({mutationFn:()=>u(e.id),onSuccess:e=>y(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:M}),P=c({mutationFn:()=>_(e.id),onSuccess:e=>{y(`Draft PR created — ${e.url}`),j()},onError:M}),I=c({mutationFn:()=>m(e.id),onError:e=>{if(e instanceof d&&e.command){navigator.clipboard.writeText(e.command).then(()=>y(`No terminal found — command copied to clipboard.`)).catch(()=>y(`Run manually: ${e.command}`));return}M(e)}}),B=c({mutationFn:t=>f(e.id,t),onError:M}),V=r.isError&&r.error instanceof d&&r.error.status===409,H=ne({run:e,cliHandoff:e.cliHandoff,hasWorktree:!!e.worktreePath&&!V,branch:e.branch,changedFiles:r.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:G(e)!==void 0,prUrl:e.pullRequestUrl}),U=e=>{switch(e){case`commit`:O(!0);break;case`push`:N.mutate();break;case`create-pr`:P.mutate();break;case`open-terminal`:I.mutate();break;case`view-pr`:break}},W=r.data?.files??[],q=(0,Y.useMemo)(()=>ee(W),[W]),J=(0,Y.useMemo)(()=>W.some(K),[W]),X=s?p:`unified`;return(0,$.jsxs)(R,{route:`task-changes`,density:L(W.length),flushPadding:!0,children:[(0,$.jsx)(T,{run:e,tab:`changes`}),(0,$.jsx)(D,{bar:H,healthReady:t.data!==void 0,branch:e.branch,stat:r.data?.stat,mode:X,wrap:g,preview:x,onModeChange:h,onWrapChange:b,onPreviewChange:J?S:void 0,onAction:U}),r.data?.repointedHead?(0,$.jsxs)(`p`,{"data-slot":`repointed-head-note`,className:`border-b px-4 py-2 text-xs text-soft-foreground md:px-9`,children:[`HEAD is on `,(0,$.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,$.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,(0,$.jsx)(oe,{changes:r,changesRefused:V,fileCount:W.length,children:(0,$.jsx)(se,{runId:e.id,files:W,tree:q,selected:C,selectFile:e=>{w(e),k.current?.scrollToPath(e)},diffRef:k,effectiveMode:X,effectiveWrap:g,preview:x,localHandoff:t.data?.capabilities.localHandoff,onOpenInApp:B.mutate})}),(0,$.jsx)(re,{run:e,open:E,onOpenChange:O})]})}function oe({changes:e,changesRefused:t,fileCount:n,children:r}){return e.isPending?(0,$.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,$.jsx)(B,{icon:t?(0,$.jsx)(S,{size:16}):(0,$.jsx)(C,{size:16}),tone:t?`neutral`:`danger`,heading:`h2`,title:t?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):n===0?(0,$.jsx)(B,{icon:(0,$.jsx)(S,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):r}function se({runId:e,files:t,tree:n,selected:i,selectFile:a,diffRef:o,effectiveMode:s,effectiveWrap:c,preview:l,localHandoff:u,onOpenInApp:d}){let[f,m]=(0,Y.useState)(!1);return(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-4 px-4 pb-9 pt-0 [--diff-sticky-top:0px] md:flex-row md:items-start md:gap-5 md:px-9`,children:[(0,$.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_2rem)] md:w-60 md:overflow-y-auto md:overscroll-contain md:p-3.5 lg:w-[288px]`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-slot":`changes-tree-toggle`,"aria-expanded":f,onClick:()=>m(e=>!e),className:`flex min-h-11 w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-xs font-semibold text-foreground md:hidden`,children:[(0,$.jsxs)(`span`,{children:[`Changed files`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[`(`,t.length,`)`]})]}),(0,$.jsx)(w,{size:16,"aria-hidden":`true`,className:r(`size-4 shrink-0 text-muted-foreground motion-safe:transition-transform`,f&&`rotate-180`)})]}),(0,$.jsx)(`h2`,{className:`mb-3 hidden border-b border-border pb-3 text-xs font-semibold md:block`,children:`Changed files`}),(0,$.jsx)(`div`,{className:r(f?`border-t border-border px-3.5 py-3 md:border-t-0 md:p-0`:`hidden md:block`),children:(0,$.jsx)(E,{root:n,selected:i,onSelect:e=>{a(e),m(!1)}})})]}),(0,$.jsx)(J,{files:t,viewRef:o,mode:s,wrap:c,preview:l,loadFileText:t=>ce(e,t),imageSrc:t=>p(e,t),onOpenInApp:u?e=>d(e):void 0,totals:!1,className:`min-w-0 flex-1`})]})}async function ce(e,t){try{let n=await h(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{ie as TaskChangesRoute};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{o as i,s as a}from"./dist-C_rn70hE.js";import{G as o,J as s,R as c,Ut as l,V as u,Wt as d,Xt as f,Y as p,_ as m,dn as h,dt as g,ln as _,lt as v,nt as y,ot as b,rn as x,rt as S,sn as C,un as w,xt as T,yt as E,z as D}from"./queries-CIeJg62Y.js";import{$r as O,An as k,At as ee,Fn as A,Nn as j,Pn as M,Qn as N,Xn as P,Yn as F,Zn as te,ei as I,hi as L,ii as R,it as z,lt as B,n as V,ot as ne,rt as H,tr as re,vr as U,yr as ie}from"./toaster-D0HMoto5.js";import{f as ae,h as oe,n as se}from"./chunk-KS7C4IRE-Cg8l-LDN.js";import{c as ce,f as le,h as ue,r as de,y as fe}from"./tasks-table-CvZ2ZyCa.js";import{A as pe,B as me,a as he,f as ge,g as W,h as _e,it as ve,k as ye,l as G,m as be,n as xe,ot as Se,p as Ce,s as we,u as Te,ut as Ee,y as De,z as Oe}from"./design-icons-CzEoMH9c.js";import{t as ke}from"./createLucideIcon-BHp8sXmF.js";import{A as Ae,B as je,C as Me,D as Ne,E as Pe,F as Fe,H as Ie,I as Le,L as Re,M as ze,N as Be,O as Ve,P as He,R as Ue,S as We,T as Ge,U as Ke,V as qe,W as Je,_ as Ye,a as Xe,b as Ze,c as Qe,d as $e,f as et,g as tt,h as nt,i as rt,j as it,k as at,l as ot,m as st,n as ct,o as lt,p as ut,r as dt,s as ft,t as pt,u as mt,v as ht,w as gt,x as _t,y as vt,z as yt}from"./review-panel-BaUd88ko.js";import{a as bt,i as xt,n as St,o as Ct,r as wt,s as Tt,t as Et}from"./run-header-BWNapiIC.js";import{t as Dt}from"./eye-B8okNWXU.js";import{t as Ot}from"./loader-circle-CPBhhDbB.js";import{a as kt}from"./tool-display-B9NN44oU.js";import{i as At,l as jt,o as Mt,t as Nt}from"./reference-chip-O8Bfl1Oi.js";import{a as Pt,i as Ft,n as It,o as Lt,r as Rt,t as zt}from"./thread-state-B2dX4psn.js";import{t as K}from"./button-C8jUIs8Q.js";import{n as Bt,r as Vt,t as Ht}from"./collapsible-Bx2vViFx.js";import{a as Ut,i as Wt,o as Gt,r as Kt,t as qt}from"./popover-CvL6hQ5c.js";import{s as Jt,t as Yt}from"./project-router-BHFXTx5l.js";import"./attention-V1gJ7gKo.js";import{D as Xt,E as Zt,O as Qt,S as $t,b as en,f as q,u as tn,w as nn,x as rn}from"./task-groups-C9pTQm-2.js";import{t as J}from"./status-dot-BXf-Ubd0.js";import{c as an,i as on,l as sn,o as cn,r as ln,s as un,t as dn}from"./report-selection-cuFCCxDW.js";import{l as fn,m as pn}from"./page-shell-Dky5crRl.js";import{t as mn}from"./centered-state-BgSV4e79.js";import{An as hn,F as gn,I as _n,In as vn,J as yn,K as bn,M as xn,N as Sn,On as Cn,P as wn,Rn as Tn,Tn as En,Z as Dn,_n as On,b as kn,cn as An,en as jn,fn as Mn,gn as Nn,h as Pn,i as Fn,in as In,l as Ln,ln as Rn,m as zn,n as Bn,q as Vn,rn as Hn,s as Un,sn as Wn,un as Gn,v as Kn,yn as qn}from"./index-i4Bu7SvU.js";import{t as Jn}from"./markdown-9FIYg1nH.js";import{t as Yn}from"./task-file-scope-DPJOeknI.js";import{i as Xn}from"./automation-format-DB34jUyF.js";var Zn=ke(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),Y=e(t(),1),X=r();function Qn(e,t,n,r,i,a,o,s,c){let l=Qt(e,In(e)),u=l?l.model:e.model,d=l?l.effort:e.effort,f=!r&&!n&&u?{...i?.defaultModels,[t]:u}:i?.defaultModels,p=r?null:s,m=wn(t,o,a,[p,f?.[t]]),h=_n(p,t,o,f,a),g=Sn(h,a),_=r?``:c??d??``,v=gn(_,g);return{models:m,model:h,effortOptions:g,effort:v,mustClearStoredEffort:!r&&c===null&&_!==``&&v===``}}function $n(e,t,n,r){let i=Zt(e.steps),a=Qt(e,In(e)),o=a?.agentProfile??e.agentProfile??i?.profileId??`default`;return{sessionStep:i,workerStep:a,account:n?r?.[t]??`default`:o}}function er(e,t,n,r,i,a,o,{model:s,effort:c,mustClearStoredEffort:l}){return{text:e.trim()?e:void 0,images:t.length?t:void 0,runner:n,model:!r&&(a!==null||i)?s:void 0,effort:!r&&(o!==null||i)?c:l?``:void 0}}function tr(e,t,n,r){return!!t&&(r!==Xt(t,e)||(n?.agentProfile??e.agentProfile??t.profileId??`default`)!==(t.profileId??`default`))}function nr({models:e,model:t,effortOptions:n,effort:r}){return{modelLabel:e.find(e=>e.id===t)?.label??`Runner default`,effortLabel:n.find(e=>e.value===r)?.label??`Runner default`}}function rr(e){let t=v(),n=Gn(e).continueRun,r=m(),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),u=`${e.id}:${Qt(e,In(e))?.id??``}`,[d,p]=(0,Y.useState)(u);d!==u&&(p(u),a(null),s(null),l(null));let g=rt(e,i),{runners:_,canContinue:y,currentRunner:b,runner:S}=g,{sessionStep:T,workerStep:D,account:O}=$n(e,S,S!==b,qn().repoAccount),k=E(),ee=k.data?.capabilities?.localHandoff!==!1,j=x(),M=C(S,n&&!k.isPending&&!j.isPending,ee?O:null),N=r.data?.modelsLocked===!0,P=S!==b,F=Qn(e,S,P,N,r.data,M.data,j.data,o,c),{models:te,model:I,effortOptions:L,effort:R}=F,{modelLabel:z,effortLabel:B}=nr(F),V=h({mutationFn:({text:t,images:n})=>y?ne(w(e.id),er(t,n,g.runnerOverride,N,P,o,c,F)):Promise.reject(Error(g.reason??`Connect an agent provider to continue.`)),onMutate:()=>w(e.id),onSuccess:(e,n,r)=>t.invalidateAfter(`continue`,r),onError:(e,n,r)=>{e instanceof A&&e.status===409&&r&&t.invalidateAfter(`continue`,r)}}),H=e.delegation?.role===`worker`;return{skillRunner:S,skillAccount:O,available:n,canContinue:y,startsNewConversation:tr(e,T,D,S),reason:g.reason,providerPending:g.providerPending,pills:(0,X.jsx)(ir,{compact:e.status===`review`,summary:`${f(j.data,S)} · ${z} · ${B}`,children:(0,X.jsxs)(Vn,{children:[!H&&(_.length>1||g.signedOut.length>0)?(0,X.jsx)(yn,{icon:(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,runners:_,signedOut:g.signedOut,value:S,onPick:e=>{e!==S&&(a(e),s(null))}}):(0,X.jsx)(bn,{icon:(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,readOnly:!0,disabledHint:H?`Owned workers keep their runner; change model or effort instead.`:void 0,slot:`session-runner-value`,ariaLabel:`Runner`,label:S,value:S,onPick:()=>{},options:[{value:S,label:S}]}),(0,X.jsx)(bn,{icon:(0,X.jsx)(De,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-model-pill`,ariaLabel:`Model`,label:z,value:I,readOnly:N,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>{s(e);let t=Sn(e,M.data);R!==``&&gn(R,t)===``&&l(``)},options:te.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:xn(S,j.data,M)}),(0,X.jsx)(bn,{icon:(0,X.jsx)(ye,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),fieldLabel:!0,slot:`follow-up-effort-pill`,ariaLabel:`Effort`,label:B,value:R,readOnly:N,disabledHint:`Effort selection is locked to native coding-agent settings.`,onPick:e=>l(e),options:L.map(e=>({value:e.value,label:e.label,desc:e.desc}))})]})},u),continueWith:(e,t)=>V.mutateAsync({text:e,images:t})}}function ir({compact:e,summary:t,children:n}){let[r,i]=(0,Y.useState)(!1),a=(0,Y.useRef)(null),o=e&&!r;return(0,Y.useEffect)(()=>{r&&a.current?.querySelector(`button:not([disabled])`)?.focus()},[r]),(0,X.jsx)(`div`,{ref:a,"data-slot":`follow-up-engine`,"data-folded":o||void 0,className:o?`min-w-0`:`session-engine-controls`,children:o?(0,X.jsxs)(`button`,{type:`button`,"data-slot":`follow-up-engine-summary`,"aria-expanded":!1,"aria-label":`Agent settings: ${t}`,title:`Change the runner, model or effort`,onClick:()=>i(!0),className:`inline-flex min-h-11 max-w-full min-w-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground transition-colors outline-hidden hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:[(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-4 shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:t}),(0,X.jsx)(G,{"aria-hidden":`true`,className:`size-3.5 shrink-0`})]}):n})}var ar=120,or=e=>e!==`pending`&&e!==`running`,sr=e=>e.kind===`tool`&&e.toolKind===`task`,cr=e=>sr(e)&&e.parentItemId===void 0,lr=e=>Ue(e.kind)&&!(e.kind===`tool`&&e.toolKind===`plan`);function ur(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 dr(e){if(e.kind===`tool`)return fr(e.title);if(e.kind===`hook`)return fr(`${e.event} hook${e.status===`completed`?``:` ${e.status}`}`);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
2
|
-
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return fr(n)}}}function fr(e){return e.length>ar?`${e.slice(0,ar-1).trimEnd()}…`:e}function pr(e,t=!1,n=e){let r=_r(e,e=>e.items.some(cr));if(r===-1)return[];let i=e=>!t&&!or(e.status),a=e=>i(e)&&e.background===!0,o=[],s=!1;for(let t=r-1;t>=0;--t){let n=e[t].items.filter(cr);n.length!==0&&(!s&&!n.some(i)&&(s=!0),(!s||n.some(a))&&o.unshift(...n))}let c=[...o,...e[r].items.filter(cr)];return r!==e.length-1&&!c.some(i)?[]:c.map(r=>mr(r,xr(n,e,r.id),t))}function mr(e,t,n){let r={id:e.id,title:Re(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=ur(e);i!==void 0&&(r.agentType=i),n&&!or(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=dr(t[e]);if(n!==void 0){r.activity=n;break}}return r}function hr(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function gr(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function _r(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function vr(e,t,n=!1,r=e){for(let i=e.length-1;i>=0;--i){let a=e[i].items.find(e=>e.id===t&&cr(e));if(a!==void 0)return mr(a,xr(r,e,t),n)}}function yr(e,t){return _r(e,e=>e.items.some(e=>e.id===t&&cr(e)))}function br(e,t,n){let r=[];for(let i=n;i<e.length;i+=1){let n=e[i];for(let e of n.items)lr(e)&&e.parentItemId===t&&e.id!==t&&r.push({entry:e,seqs:n.itemSeqs?.get(e.id)})}return r}function xr(e,t,n){let r=yr(t,n);if(r===-1)return[];let i=br(t,n,r);if(e===t)return i.map(({entry:e})=>e);let a=t[r].itemSeqs?.get(n)?.first,o=e=>a===void 0||e.seqs===void 0||e.seqs.first>a,s=new Map;for(let t of br(e,n,Math.max(yr(e,n),0)))o(t)&&!s.has(t.entry.id)&&s.set(t.entry.id,t);for(let e of i){let t=s.get(e.entry.id);s.set(e.entry.id,t===void 0?e:Sr(t,e))}return[...s.values()].sort(Cr).map(({entry:e})=>e)}function Sr(e,t){return e.seqs===void 0||t.seqs===void 0?e:{entry:(t.seqs.last>e.seqs.last?t:e).entry,seqs:{first:Math.min(e.seqs.first,t.seqs.first),last:Math.max(e.seqs.last,t.seqs.last)}}}function Cr(e,t){return e.seqs===void 0||t.seqs===void 0?0:e.seqs.first-t.seqs.first}function wr(e,t){if(e.kind===`entry`){let n=e.entry;return n.kind===`message`&&n.role===`assistant`?[{messageKey:`${t}:${n.id}`,text:n.text}]:[]}return e.kind===`tool-card`?Le(e.children).flatMap(n=>wr(n,`${t}:${e.id}`)):e.kind===`streak`?e.blocks.flatMap(e=>wr(e,t)):[]}function Tr(e){return e.flatMap((e,t)=>e.content.kind===`block`?wr(e.content.block,e.scope).map(n=>({...n,rowKey:e.key,rowIndex:t})):[])}function Er(e,t,n,r){let i=(0,Y.useContext)(dn),{projectId:a}=oe(),o=(0,Y.useMemo)(()=>Tr(t),[t]);(0,Y.useLayoutEffect)(()=>{if(!i)return;let t=[],s={runId:e,...a?{projectId:a}:{}};for(let e of o){let a=Ie(e.text,s);for(let e of a)t.push(i.register(e.artifactId,e.runId));r===`document`&&a.length>0&&t.push(i.registerOpener(e.messageKey,(t,r)=>{let i=qe(e.messageKey,t);n.jumpToRow(e.rowKey,e.rowIndex,e=>[...e.querySelectorAll(`[id]`)].find(e=>e.id===i)??null,r)}))}return()=>{for(let e of t)e()}},[i,o,e,a,r,n.jumpToRow])}function Dr(e){let t=L();return h({mutationFn:t=>B(e,t),retry:!1,networkMode:`always`,onSettled:()=>{t.invalidateQueries({queryKey:d.runs.all})}})}var Or=e=>(window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}),kr=()=>navigator.onLine;function Ar({permission:e,runId:t,sessionOpen:n=!1}){return e.status!==`pending`||!n?(0,X.jsx)(Mr,{permission:e,state:e.status===`resolved`?`resolved`:`expired`}):(0,X.jsx)(jr,{permission:e,runId:t},e.requestId)}function jr({permission:e,runId:t}){let n=Dr(t),r=(0,Y.useSyncExternalStore)(Or,kr,()=>!1),i=(0,Y.useRef)(!1),[a,o]=(0,Y.useState)(`pending`),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(),d=async t=>{if(!(i.current||!r||a!==`pending`)){i.current=!0,o(`sending`),u(void 0);try{await n.mutateAsync({requestId:e.requestId,optionId:t}),c(t),o(`resolved`)}catch(e){e instanceof A&&e.status===409?o(`expired`):(u(e instanceof Error?e.message:String(e)),o(`pending`))}finally{i.current=!1}}};return(0,X.jsx)(Mr,{permission:{...e,...s===void 0?{}:{optionId:s}},state:a,offline:!r,error:l,onSelect:e=>{d(e)}})}function Mr({permission:e,state:t,offline:n=!1,error:r,onSelect:i}){let a=(0,Y.useId)(),o=e.options.find(t=>t.id===e.optionId),s=t!==`pending`||n||!i,c=t===`expired`?`Approval expired. This session can no longer accept a decision.`:t===`resolved`?`Decision sent: ${o?.label??`Recorded`}.`:t===`sending`?`Sending decision…`:n?`Offline. Reconnect to send a decision.`:`Choose an option to respond to this permission request.`;return(0,X.jsxs)(`section`,{"data-slot":`permission-card`,"data-request-id":e.requestId,"data-state":n&&t===`pending`?`offline`:t,"aria-labelledby":a,"aria-busy":t===`sending`,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-card-edge bg-card shadow-card p-3.5 text-sm [overflow-wrap:anywhere]`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Permission request`}),(0,X.jsx)(`h3`,{id:a,className:`font-semibold whitespace-pre-wrap`,children:e.title})]}),e.details?(0,X.jsx)(`pre`,{className:`min-w-0 font-mono text-xs leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.details}):null,(0,X.jsx)(`div`,{role:`group`,"aria-labelledby":a,className:`flex min-w-0 flex-col gap-2`,children:e.options.map(t=>(0,X.jsx)(K,{type:`button`,variant:`outline`,disabled:s,"aria-pressed":e.optionId===t.id,className:`h-auto min-h-11 min-w-0 max-w-full justify-start py-2 text-start whitespace-normal [overflow-wrap:anywhere] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,onClick:()=>i?.(t.id),children:t.label},t.id))}),(0,X.jsxs)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:[c,e.reason?` ${e.reason}`:``]}),r&&t===`pending`?(0,X.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r}):null]})}var Nr=(0,Y.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function Pr(e,t){let n={};for(let e of t??[])n[e.id]=e.currentStepBackend??e.runner;return n[e.id]=e.steps.find(t=>t.id===e.currentStepId)?.backend??e.runner,n}function Fr(e,t,n=[]){let r={};for(let e of n)r[e.id]=q(e);for(let e of t??[])r[e.id]=q(e);return r[e.id]=q(e),r}function Ir(e,t){return t?.[e]??`Task`}function Lr(e,t,n){return t?n?.[e]??`peer task`:Ir(e,n)}function Rr(e,t){return e.senderRunId===t?`outbound`:`inbound`}function zr(e){return e?.relationship===`peer`}function Br(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`}}function Vr(e){switch(e){case`pending`:return`Pending`;case`replied`:return`Replied`;case`replied-late`:return`Replied late`;case`timed-out`:return`Timed out`;case`cancelled`:return`Cancelled`;case`completed-without-reply`:return`Completed without reply`;case`failed`:return`Failed`;case`destroyed`:return`Destroyed`;case`sender-closed`:return`Sender closed`;case`human-fallback`:return`Sent to a human`;case`deleted`:return`Recipient deleted`}}function Hr(e){if(e.outcome)return Vr(e.outcome.status);if(e.delivery===`not-delivered`)return Z(`not-delivered`)}function Z(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`}}function Ur(e,t){return e.instruction===void 0?e.delivery===`queued`?`${t?`Queued for delivery. This agent can receive messages during its current turn.`:`Queued for delivery. Timing depends on the recipient agent.`} Pending messages are batched within the size limit; human questions and scheduler capacity can delay delivery.`:e.state===`continuation-required`?zr(e)?`Not delivered. The recipient is not running. Only its human can continue it.`:`Not delivered. The recipient needs a new instruction to resume. A parent can resume its owned worker with ${Nn()} worker resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0:e.instruction}function Wr({id:e,peer:t,taskTitles:n,children:r}){return!t||n?.[e]!==void 0?r({title:Ir(e,n),linkable:!0}):(0,X.jsx)(Gr,{id:e,children:r})}function Gr({id:e,children:t}){let n=p(e);return n.data?t({title:q(n.data),linkable:!0}):n.isPending?t({title:`Peer task`,linkable:!1}):t({title:n.error instanceof A&&n.error.status===404?`Deleted task`:`Task unavailable`,linkable:!1})}var Kr={outbound:{classes:`border-message-outbound-border bg-message-outbound-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-outbound-accent`,accent:`text-message-outbound-accent`},inbound:{classes:`border-message-inbound-border bg-message-inbound-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-inbound-accent`,accent:`text-message-inbound-accent`},peer:{classes:`border-message-peer-border bg-message-peer-bg [html:not(.light)_&]:border-s-[3px] [html:not(.light)_&]:border-s-message-peer-accent`,accent:`text-message-peer-accent`}},qr=`inline-flex min-h-11 max-w-full items-center break-words underline underline-offset-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`;function Jr({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,X.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,X.jsx)(Yr,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function Yr({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let a=Rr(e.messages[0]??{senderRunId:e.senderRunId},t),o=zr(e.messages[0]),s=Kr[o?`peer`:a],c=ii(e.messages.map(e=>a===`outbound`?e.recipientRunId:e.senderRunId)),l=a===`outbound`?`SENT to`:`RECEIVED from`,u=`${l} ${c.map(e=>Lr(e,o,n)).join(`, `)}`,d=e.messages[0],f=d?.createdAt??d?.recordedAt;return(0,X.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":a,"data-relationship":o?`peer`:`family`,"data-kind":e.kind,className:i(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,s.classes),children:[(0,X.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`p`,{className:i(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-xs leading-[1.2] font-semibold tracking-[0.6px] uppercase`,s.accent),children:[(0,X.jsx)(`span`,{children:l}),c.map((e,t)=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,X.jsx)(Wr,{id:e,peer:o,taskTitles:n,children:t=>(0,X.jsx)(ei,{view:t,to:`/tasks/${e}`,label:`${l} ${t.title}`})})]},e))]}),o?(0,X.jsx)(`span`,{"data-slot":`conversation-relationship`,className:`rounded-full border border-message-peer-border px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:`Peer`}):null,(0,X.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-xs font-semibold tracking-[0.05em] text-foreground uppercase`,children:Br(e.kind)}),e.messages.length===1&&d?(0,X.jsx)(Zr,{message:d}):null]}),(0,X.jsx)(Xr,{at:f,className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-xs text-soft-foreground`,children:e.messages.length>1?`First sent`:null})]}),(0,X.jsx)($r,{batch:e},`${t}:${d?.messageId??e.id}`),[...new Set(e.messages.map(e=>Ur(e,r?.[e.recipientRunId])))].map(e=>e?(0,X.jsx)(`p`,{"data-slot":`conversation-delivery-explanation`,className:`min-w-0 text-xs leading-relaxed text-muted-foreground [overflow-wrap:anywhere]`,children:e},e):null),e.kind===`request`&&e.messages.length>1?(0,X.jsx)(Qr,{messages:e.messages,peer:o,runId:t,taskTitles:n}):null,e.messages.length===1&&d?(0,X.jsx)(ti,{message:d,runId:t,taskTitles:n}):null,(0,X.jsx)(ni,{batch:e,heading:u})]})}function Xr({at:e,className:t,children:n}){return e===void 0||We(e)===void 0?null:(0,X.jsxs)(`span`,{className:t,children:[n,(0,X.jsx)(Ze,{ts:e})]})}function Zr({message:e}){let t=Hr(e),n=Z(e.delivery),r=(e.messageKind===`request`||e.messageKind===`reply`)&&n!==t;return(0,X.jsxs)(X.Fragment,{children:[t?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:t}):null,r?(0,X.jsx)(`span`,{"data-slot":`conversation-delivery`,className:`text-xs text-muted-foreground`,children:n}):null]})}function Qr({messages:e,peer:t,runId:n,taskTitles:r}){return(0,X.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.map(e=>{let i=Hr(e),a=e.createdAt??e.recordedAt;return(0,X.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(Wr,{id:e.recipientRunId,peer:t,taskTitles:r,children:t=>(0,X.jsx)(ei,{view:t,to:`/tasks/${e.recipientRunId}`,label:`${t.title}${i?` — ${i}`:``}`})}),i?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,children:i}):null,Z(e.delivery)===i?null:(0,X.jsx)(`span`,{"data-slot":`conversation-delivery`,children:Z(e.delivery)}),(0,X.jsx)(ti,{message:e,runId:n,taskTitles:r}),(0,X.jsx)(Xr,{at:a,className:`ml-auto whitespace-nowrap`})]},e.id)})})}function $r({batch:e}){let t=Fe(),n=`conversation-body:${e.messages[0]?.messageId??e.id}`,[r,i]=(0,Y.useState)(()=>t?.get(n)??!1),a=(0,X.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,X.jsx)(Jn,{breaks:!0,children:e.text})});return e.kind!==`request`&&e.kind!==`reply`?a:(0,X.jsxs)(Ht,{"data-slot":`conversation-body`,open:r,onOpenChange:e=>{t?.set(n,e),i(e)},className:`min-w-0`,children:[(0,X.jsxs)(Vt,{type:`button`,"data-slot":`conversation-body-toggle`,className:`group/body inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-start text-xs font-medium text-muted-foreground [@media(hover:hover)_and_(pointer:fine)]:hover:bg-background/40 [@media(hover:hover)_and_(pointer:fine)]:hover:text-foreground active:bg-background/60 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(Te,{"aria-hidden":!0,className:`size-3.5 shrink-0 group-data-[state=open]/body:rotate-90`}),r?`Hide message`:`Show message`]}),(0,X.jsx)(Bt,{children:a})]})}function ei({view:e,to:t,label:n}){return e.linkable?(0,X.jsx)(Yt,{className:qr,to:t,"aria-label":n,children:e.title}):(0,X.jsx)(`span`,{"data-slot":`conversation-counterpart`,children:e.title})}function ti({message:e,runId:t,taskTitles:n}){let{targets:r,replies:a,navigate:o}=(0,Y.useContext)(Nr),s=e.requestId?r.get(e.requestId):void 0,c=e.requestId?s?[s]:[]:a.get(e.messageId)??[],l=e.requestId?`request`:`reply`;return c.length===0?e.requestId||e.outcome?.replyId?(0,X.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,l,` is outside loaded history.`]}):null:c.map(e=>{let r=Rr(e.message,t)===`outbound`,a=r?e.message.recipientRunId:e.message.senderRunId;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:i(qr,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>o(e),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),(0,X.jsx)(Wr,{id:a,peer:zr(e.message),taskTitles:n,children:e=>(0,X.jsxs)(X.Fragment,{children:[`View `,l,` `,r?`to`:`from`,` `,e.title]})})]},e.message.messageId)})}function ni({batch:e,heading:t}){return(0,X.jsxs)(Ht,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,X.jsxs)(Vt,{type:`button`,className:`inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-left text-xs font-medium text-muted-foreground hover:bg-background/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,X.jsx)(Te,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,X.jsx)(Bt,{children:(0,X.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-xs text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>ri(e)).map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,X.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function ri(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},...zr(e)?[{label:`Relationship`,value:`peer`}]:[],{label:`Delivery`,value:Z(e.delivery)}];return e.requestId&&t.push({label:`Request`,value:e.requestId}),e.outcome?.replyId&&t.push({label:`Reply`,value:e.outcome.replyId}),e.state&&t.push({label:`State`,value:e.state}),e.createdAt&&t.push({label:`Created`,value:e.createdAt}),e.deliveredAt&&t.push({label:e.resumed?`Opening turn completed`:`Delivery acknowledged`,value:e.deliveredAt}),e.recordedAt&&t.push({label:`Event recorded`,value:e.recordedAt}),e.resumed&&t.push({label:`Continuation`,value:`Requested by parent with this instruction`}),e.deadline&&t.push({label:`Deadline`,value:e.deadline}),e.requestHash&&t.push({label:`Hash`,value:e.requestHash}),t}function ii(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var ai=e(n(),1),oi=`pending-ask`;function si(e){return e.querySelector(`[data-slot="ask-question"] :is(button, textarea):not(:disabled)`)||(e.tabIndex=-1,e)}function ci(e,t){if(e.dataset.askMode===`reply`){let n=(t??e.closest(`[data-slot="thread-dock"]`)??document).querySelector(`[data-slot="thread-composer-slot"]:not([hidden]) textarea:not(:disabled)`);if(n)return n}return si(e)}function li(e){let t=e.querySelector(`[data-slot="ask-card"][data-pinned="true"]`);return t?ci(t,e):null}function ui(e,t){let n=`${oi}:${e}`;return r=>{if(!t())return!1;let i=[...r.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===n);if(i)return li(i);let a=[...r.querySelectorAll(`[data-slot="ask-card"][data-pinned="true"]`)].find(t=>t.dataset.askId===e);return a?ci(a,r):null}}function di(e){return e<=0?`Jump to latest`:`Jump to latest (${e} ${e===1?`question`:`questions`} pending)`}function fi({onGoToQuestion:e}){return(0,X.jsxs)(`div`,{"data-slot":`ask-origin`,className:`flex flex-wrap items-center gap-x-2 rounded-lg border border-dashed border-accent-strong/40 px-3.5 py-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium text-link-foreground`,children:`Question asked here`}),(0,X.jsx)(K,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`ask-go-to-question`,className:`min-h-11 min-w-11 px-2 text-foreground underline underline-offset-4`,onClick:e,children:`Go to the question`})]})}function pi(){let e=(0,Y.useRef)(null);return(0,Y.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=t.closest(`[data-slot="main"]`),r=t.querySelector(`[data-slot="run-header"]`),i=t.querySelector(`[data-slot="thread-dock"]`);if(!n||!r||!i)return;let a=()=>{let e=r.querySelector(`[data-slot="run-tabs"]`),a=r.getBoundingClientRect(),o=getComputedStyle(document.documentElement),s=document.documentElement.style.getPropertyValue(`--kb`)||(typeof o.getPropertyValue==`function`?o.getPropertyValue(`--kb`):``),c=Number.parseFloat(s)||0;n.clientHeight>0&&n.clientHeight<420?t.dataset.compactViewport=`true`:delete t.dataset.compactViewport,c>0||Ut(window)?t.dataset.keyboardOpen=`true`:delete t.dataset.keyboardOpen,r.style.setProperty(`--run-header-lead`,`${e?Math.max(0,e.getBoundingClientRect().top-a.top):0}px`),n.style.setProperty(`--thread-viewport-height`,`${n.clientHeight}px`),n.style.setProperty(`--thread-header-height`,`${mi(r)}px`),n.style.setProperty(`--thread-footer-height`,`${i.getBoundingClientRect().height}px`)};a();let o=new ResizeObserver(a);return o.observe(r),o.observe(i),o.observe(n),()=>{o.disconnect(),delete t.dataset.compactViewport,delete t.dataset.keyboardOpen,r.style.removeProperty(`--run-header-lead`),n.style.removeProperty(`--thread-header-height`),n.style.removeProperty(`--thread-footer-height`),n.style.removeProperty(`--thread-viewport-height`)}},[]),e}function mi(e){let t=Number.parseFloat(getComputedStyle(e).insetBlockStart)||0;return Math.max(0,e.getBoundingClientRect().height+Math.min(0,t))}var hi={viewKey:void 0,generation:0},gi=600,_i=24;function vi(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,Y.useRef)(a);o.current=a;let s=(0,Y.useRef)(e);s.current=e;let c=(0,Y.useRef)(null),[u,d]=(0,Y.useState)(null),[f,p]=(0,Y.useState)(!1),m=(0,Y.useRef)(!0),h=(0,Y.useRef)(!0),g=(0,Y.useRef)(0),_=(0,Y.useRef)(0),v=(0,Y.useRef)(new Set),y=(0,Y.useCallback)(e=>{for(let t of[...v.current])t(e)},[]),b=(0,Y.useCallback)(e=>(v.current.add(e),()=>{v.current.delete(e)}),[]),x=(0,Y.useRef)(null),S=(0,Y.useRef)(null),C=(0,Y.useRef)(null),w=(0,Y.useRef)(null),T=(0,Y.useCallback)(e=>{let t=c.current;if(!t)return;let n=w.current;n?n.scrollTo(e):t.scrollTop=e},[]),E=(0,Y.useCallback)(()=>{let e=c.current;if(!e)return;let t=h.current?o.current.findIndex(e=>e.startsWith(`pending-ask:`)):-1,n=h.current?e.querySelector(`[data-slot="ask-card"][data-pinned="true"][data-resolved="false"]`):null,r=e.querySelector(`[data-slot="run-header"]`),i=r&&getComputedStyle(r).position===`sticky`?mi(r):0;n?T(e.scrollTop+n.getBoundingClientRect().top-e.getBoundingClientRect().top-i-12):t>=0&&w.current?w.current.scrollToIndex(t,{align:`start`,offset:-i-12}):T(e.scrollHeight-e.clientHeight)},[T]),D=(0,Y.useCallback)(()=>{if(c.current){if(C.current!==e){C.current=e,h.current=!0;let t=at(e);t&&!t.atBottom?(m.current=!1,x.current=t.top,S.current=Ne(e)?.rowKeys?{viewKey:e,top:t.top}:null):(m.current=!0,x.current=null,S.current=null)}x.current===null?m.current&&E():T(x.current)}},[e,T,E]),O=(0,Y.useCallback)(e=>S.current?.viewKey===e,[]),k=(0,Y.useCallback)(e=>{let t=S.current;return!t||!O(e)||e!==s.current?!1:(x.current=t.top,m.current=!1,S.current=null,!0)},[O]),ee=(0,Y.useCallback)(e=>{d(e),e&&(c.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="thread-transcript"], [data-slot="main"]`),D())},[n,D]),A=(0,Y.useCallback)(()=>{m.current&&E()},[E]),j=(0,Y.useRef)(!1),M=(0,Y.useRef)(0),N=(0,Y.useRef)(!1),P=(0,Y.useRef)(void 0),F=(0,Y.useRef)(!1),te=(0,Y.useRef)(!1),I=(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}}),[]),L=(0,Y.useRef)(null),R=(0,Y.useRef)(0);(0,Y.useEffect)(()=>{if(!l())return;let e=e=>{x.current=null,S.current=null,R.current+=1,L.current=null,m.current=!1,h.current=!1,T(e)};return window.__cezThreadScrollTo=e,()=>{window.__cezThreadScrollTo===e&&delete window.__cezThreadScrollTo}},[T]);let z=(0,Y.useCallback)(()=>{let e=L.current,t=c.current;if(!e||!t)return;L.current=null;let n=e.beforeTop+Math.max(0,t.scrollHeight-e.beforeHeight),r=t.getBoundingClientRect().top,i=e.anchor===void 0?-1:o.current.indexOf(e.anchor.key),a=w.current;a&&i>=0?a.scrollToIndex(i,{align:`start`,offset:-e.anchor.offset}):T(ze(t.scrollTop,r,e.anchor,I(t),n))},[I,T]),B=(0,Y.useCallback)(()=>{let e=c.current;if(!e||!r||j.current)return;x.current=null,S.current=null,m.current=!1,j.current=!0;let t=M.current+1;M.current=t;let n=e.scrollHeight,i=e.scrollTop,a=e.getBoundingClientRect().top,l=gt(a,I(e)),u=l===void 0?-1:o.current.indexOf(l.key),d=s.current,f=R.current;r().then(()=>{s.current===d&&R.current===f&&(L.current={beforeHeight:n,beforeTop:i,anchor:l,anchorIndex:u})},()=>{}).finally(()=>{M.current===t&&(j.current=!1)})},[I,r]);(0,Y.useEffect)(()=>()=>clearTimeout(P.current),[]);let V=(0,Y.useRef)(null),ne=(0,Y.useRef)(0),H=(0,Y.useCallback)(()=>n===`document`?++hi.generation:++ne.current,[n]),re=(0,Y.useCallback)((e,t)=>n===`document`?hi.viewKey===e&&hi.generation===t:s.current===e&&ne.current===t,[n]);(0,Y.useEffect)(()=>()=>V.current?.disconnect(),[e,u]);let U=(0,Y.useCallback)((t,n,r,i)=>{let a=c.current;if(!a||!u)return;x.current=null,S.current=null,R.current+=1,L.current=null,m.current=!1,g.current=0,p(!0),H(),V.current?.disconnect();let o=()=>[...u.querySelectorAll(`[data-row-key]`)].find(e=>e.dataset.rowKey===t),s=a.querySelector(`[data-slot="run-header"]`),l=s&&getComputedStyle(s).position===`sticky`?mi(s):0,d=(e,t)=>{let r=a.getBoundingClientRect(),o=t.getBoundingClientRect(),s=w.current;if(s&&i===void 0){let t=o.top-e.getBoundingClientRect().top;l+t+o.height>r.height&&s.scrollToIndex(n,{align:`start`,offset:t-l-12})}else(o.top<r.top+l||o.bottom>r.bottom)&&T(a.scrollTop+o.top-r.top-l-12)},f=()=>{let e=o();if(!e||getComputedStyle(e).visibility===`hidden`)return!1;let t=r?.(e)??e;return t===e?e.tabIndex=-1:d(e,t),t.focus({preventScroll:!0}),document.activeElement===t?(V.current?.disconnect(),!0):!1},h=w.current;if(i!==void 0)T(i);else if(h)h.scrollToIndex(n,{align:`start`,...l>0?{offset:-l}:{}});else{let e=o();e&&T(a.scrollTop+e.getBoundingClientRect().top-a.getBoundingClientRect().top-l)}f()||(V.current=new MutationObserver(()=>{f()}),V.current.observe(u,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`]})),it(e,{top:i??a.scrollTop,atBottom:!1})},[u,T,e,H]),ie=(0,Y.useCallback)(t=>{let n=H(),r=s.current;V.current?.disconnect();let a=c.current;if(!a)return;x.current=null,S.current=null,R.current+=1,L.current=null,m.current=!0,h.current=!0,_.current=0,y({direction:`tail`}),it(e,{top:a.scrollHeight-a.clientHeight,atBottom:!0});let o=()=>{m.current&&E()},l=a.closest(`[data-slot="main"]`)??a.closest(`[data-route="task-thread"]`)??a,u=()=>re(r,n),d=()=>{let e=t?.(l);return e===!1?!0:e?(e.focus({preventScroll:!0}),document.activeElement===e):!1};(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{o(),requestAnimationFrame(()=>{if(o(),!t||!u()||d())return;V.current?.disconnect();let e=new MutationObserver(()=>{u()?d()&&e.disconnect():e.disconnect()});V.current=e,e.observe(l,{childList:!0,subtree:!0})})})})},[i,e,E,H,re,y]),ae=a.at(-1),oe=a.length;return(0,Y.useLayoutEffect)(()=>{R.current+=1,L.current=null,j.current=!1,n===`document`?hi.viewKey!==e&&(hi.viewKey=e,hi.generation+=1):ne.current+=1},[e,n]),(0,Y.useLayoutEffect)(()=>{let e=L.current;e?(e.anchor===void 0?-1:o.current.indexOf(e.anchor.key))>e.anchorIndex?z():L.current=null:m.current&&E()},[ae,oe,z,E]),(0,Y.useLayoutEffect)(()=>{!c.current||!u||D()},[u,D]),(0,Y.useEffect)(()=>{let t=c.current,n=u;if(!t||!n)return;g.current=0;let r=null,i=!1,a=t.scrollTop,o,s=0,l,d=()=>{h.current&&!Ge(t,80)&&(m.current=!1),h.current=!1},f=e=>{_.current=Date.now(),d(),l=e},v=()=>{H(),V.current?.disconnect(),x.current=null,S.current=null,R.current+=1,L.current=null,m.current=!1,g.current=0},b=()=>{x.current=null,S.current=null,R.current+=1,L.current=null,g.current=Date.now()},C=e=>{if(e.deltaY!==0)if(f(e.deltaY<0?`up`:`down`),e.deltaY<0){v();let e=!N.current;N.current=!0,clearTimeout(P.current),P.current=setTimeout(()=>{N.current=!1},180),e&&Pe(t)&&B()}else b()},w=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(f(`up`),v(),!e.repeat&&Pe(t)&&B()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&(f(`down`),b())},D=e=>{if(e.target!==t||e.button!==0||e.pointerType===`touch`||e.pointerType===`pen`||t.scrollHeight<=t.clientHeight)return;i=!0,te.current=!1,a=t.scrollTop;let n=t.getBoundingClientRect(),r=getComputedStyle(t),o=parseFloat(r.borderLeftWidth)||0,s=parseFloat(r.borderRightWidth)||0,c=n.left+t.clientLeft,l=c+t.clientWidth;!(e.clientX>=n.left+o&&e.clientX<c||e.clientX>=l&&e.clientX<n.right-s)||e.clientY<n.top+t.clientTop||e.clientY>=n.top+t.clientTop+t.clientHeight||(h.current=!1,x.current=null,S.current=null,Ge(t,80)||(v(),b()))},k=()=>{i=!1},ee=e=>{F.current=!1,r=e.touches[0]?.clientY??null},A=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(r!==null&&n>r+1?(f(`up`),v(),!F.current&&Pe(t)&&(F.current=!0,B())):r!==null&&n<r-1&&(f(`down`),b()),r=n)},j=e=>{if(e===0||!i&&Date.now()-_.current>=gi)return;let n=e<0?`up`:`down`;!i&&n!==l||(n!==o&&(o=n,s=0),s+=Math.abs(e),s>=_i&&(0,ai.flushSync)(()=>y({direction:n,distanceFromBottom:t.scrollHeight-t.clientHeight-t.scrollTop})))},M=()=>{let n=m.current;j(t.scrollTop-a),i&&t.scrollTop!==a&&(d(),t.scrollTop<a?v():b()),i&&!te.current&&t.scrollTop<a&&Pe(t)&&(te.current=!0,B()),a=t.scrollTop;let r=Ge(t,80);r&&x.current===null&&(m.current||Date.now()-g.current<2e3)&&(m.current=!0),!n&&m.current&&y({direction:`tail`}),p(!r),x.current===null&&!O(e)&&it(e,{top:t.scrollTop,atBottom:r})};t.addEventListener(`scroll`,M,{passive:!0}),t.addEventListener(`wheel`,C,{passive:!0}),t.addEventListener(`touchstart`,ee,{passive:!0}),t.addEventListener(`touchmove`,A,{passive:!0}),t.addEventListener(`pointerdown`,D,{passive:!0}),window.addEventListener(`pointerup`,k,{passive:!0}),window.addEventListener(`pointercancel`,k,{passive:!0}),t.addEventListener(`keydown`,w);let I;if(typeof ResizeObserver<`u`){I=new ResizeObserver(()=>{let e=x.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;T(Math.min(e,n)),n>=e&&(x.current=null)}else m.current&&E()}),I.observe(n);let e=n.closest(`[data-route="task-thread"]`),r=e?.querySelector(`[data-slot="run-header"]`),i=e?.querySelector(`[data-slot="thread-dock"]`);r&&I.observe(r),i&&I.observe(i)}return()=>{t.removeEventListener(`scroll`,M),t.removeEventListener(`wheel`,C),t.removeEventListener(`touchstart`,ee),t.removeEventListener(`touchmove`,A),t.removeEventListener(`pointerdown`,D),window.removeEventListener(`pointerup`,k),window.removeEventListener(`pointercancel`,k),t.removeEventListener(`keydown`,w),I?.disconnect()}},[e,u,B,T,E,O,H,y]),{attachContent:ee,scrollElRef:c,virtualizerRef:w,restoreMeasurements:k,ownsMeasurementRestore:O,pillVisible:f,jumpToLatest:ie,jumpToRow:U,loadOlder:B,restickIfStuck:A,subscribeReaderScroll:b}}function yi({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,X.jsx)(bi,{runId:e,rows:t,controls:r}):(0,X.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,className:`[overflow-anchor:none]`,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 bi({runId:e,rows:t,controls:n}){return(0,X.jsx)(xi,{runId:e,rows:t,controls:n},e)}function xi({runId:e,rows:t,controls:n}){let r=(0,Y.useRef)(null),i=(0,Y.useRef)(t),a=t[0]?.key,o=i.current[0]?.key,s=a!==o&&(t.some(e=>e.key===o)||i.current.some(e=>e.key===a));(0,Y.useLayoutEffect)(()=>{i.current=t},[t]);let[c]=(0,Y.useState)(()=>Ne(e)),[l,u]=(0,Y.useState)(()=>({cache:Ve(e,t.length,t.map(e=>e.key)),generation:0})),d=(0,Y.useRef)(l.cache===void 0&&c?.rowKeys?.length===c?.rows&&c!==void 0);(0,Y.useLayoutEffect)(()=>{let r=c?.rowKeys;if(!d.current){n.restoreMeasurements(e);return}if(!(!c||!r)){if(t.length>c.rows||t.some((e,t)=>e.key!==r[t])){d.current=!1,n.restoreMeasurements(e);return}t.length===c.rows&&(d.current=!1,n.restoreMeasurements(e)&&u({cache:c.cache,generation:1}))}},[c,t,n.restoreMeasurements,e]);let f=(0,Y.useRef)(t.length);f.current=t.length;let p=(0,Y.useRef)(t.map(e=>e.key));p.current=t.map(e=>e.key);let m=(0,Y.useRef)(null),h=(0,Y.useCallback)(t=>{n.virtualizerRef.current=t,t?m.current=t:m.current&&=(d.current&&c?.rowKeys&&f.current<c.rows&&n.ownsMeasurementRestore(e)||Ae(e,{rows:f.current,cache:m.current.cache,rowKeys:p.current}),null)},[e,n.virtualizerRef,n.ownsMeasurementRestore,c]),[g,_]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||_(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`,className:`[overflow-anchor:none]`,children:(0,X.jsx)(Un,{ref:h,scrollRef:n.scrollElRef,startMargin:g,shift:s,...l.cache===void 0?{}:{cache:l.cache},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))},l.generation)})}function Si({onJump:e,pendingQuestions:t=0}){return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,"data-pending-questions":t>0?t:void 0,onClick:()=>e(),className:`pointer-events-auto inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-sm hover:text-foreground`,children:[(0,X.jsx)(xe,{"aria-hidden":!0,className:`size-3.5`}),di(t)]})}function Ci(e){return e.consumedAt?`consumed`:e.deliveredAt?`delivered`:`queued`}function wi(e,t){let n=new Map((e.agentInputs??[]).map(e=>[e.id,Ci(e)]));if(n.size===0)return t;let r=!1,i=t.map(e=>{if(e.kind!==`note`||!e.id.startsWith(`agent-input:`))return e;let t=n.get(e.id.slice(12));return!t||e.delivery===t?e:(r=!0,{...e,delivery:t})});return r?i:t}function Ti(e,t,n){return e.kind===`ask`?e.id===t?n===void 0?e:{...e,placement:`origin`}:e.resolved?e:{...e,resolved:!0}:e}var Ei=new WeakMap;function Di(e,t){let n=Ei.get(e);return n?.length===t.length&&t.every((e,t)=>{let r=n[t];return e===r||Object.keys(e).length===Object.keys(r).length&&Object.entries(e).every(([e,t])=>t===r[e])})?n:(Ei.set(e,t),t)}function Oi(e,t){if(t!=null)return e.turns.flatMap(e=>e.items).find(e=>e.kind===`ask`&&e.id===t&&!e.resolved)}function ki(e,t,n=t,r,i){let a=Oi(n,r),o=i?.pinPendingAskInTranscript!==!1,s=new Map(n.turns.flatMap(e=>e.items).filter(e=>e.kind===`permission`).map(e=>[e.requestId,e])),c=new Set,l=new Set(t.turns.map(e=>e.userMessage?.ask?.id)),u=[];e.task&&u.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[],ts:e.createdAt},entries:[]});for(let t of e.queuedMessages??[])u.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[],ts:t.createdAt},inDaySequence:!1,entries:[]});let d=t.turns.at(-1);for(let n of t.turns){let t=e.status===`review`&&n===d?ji(n.items):n.items;u.push({id:n.id,userMessageKey:`${n.id}:user`,...n.userMessage===void 0?{}:{userMessage:{text:n.userMessage.text,ask:n.userMessage.ask,imageCount:n.userMessage.imageCount,images:n.userMessage.images,...n.userMessage.ts===void 0?{}:{ts:n.userMessage.ts}}},...n.startedAt===void 0?{}:{startedAt:n.startedAt},...n.completed?.ts===void 0?{}:{completedAt:n.completed.ts},entries:Di(n.items,wi(e,t.filter(t=>!e.task||!Pt(t,`opening`)).map(e=>e.kind===`ask`&&l.has(e.id)?{...e,placement:`origin`}:r!==void 0&&e.kind===`ask`?Ti(e,r,a):e.kind===`permission`?(c.add(e.requestId),s.get(e.requestId)??(e.status===`pending`?{...e,status:`expired`}:e)):e)))})}let f=[...s.values()].filter(e=>e.status===`pending`&&!c.has(e.requestId));return f.length>0&&u.push({id:`pending-permissions`,entries:f,inDaySequence:!1}),a!==void 0&&o&&u.push({id:oi,entries:[{...a,placement:`pinned`}],inDaySequence:!1}),u}var Ai=`changes ready for review`;function ji(e){return e.filter(e=>!(e.kind===`note`&&e.tone===`dim`&&e.text.startsWith(Ai)))}function Mi(e,t,n){let r=e.findIndex(({content:e})=>e.kind===`block`&&e.block.kind===`entry`&&e.block.entry.kind===`ask`&&e.block.entry.id===t&&e.block.entry.placement===n);return r<0?void 0:{key:e[r].key,index:r}}function Ni(e,t){return[{id:`agent:${e}`,entries:t}]}function Pi(e){if(e.inDaySequence!==!1)return e.userMessage?.ts??e.startedAt??e.completedAt}function Fi(e,t){let n=[],r;for(let t of e){let e=Pi(t),i=Me(e);i!==void 0&&e!==void 0&&(r===void 0||i>r)&&(r!==void 0&&n.push({key:`${t.id}:day-separator`,scope:t.id,content:{kind:`day-separator`,ts:e}}),r=i),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 Le(t.entries))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}});t.completedAt!==void 0&&n.push({key:`${t.id}:turn-time`,scope:t.id,content:{kind:`turn-time`,completedAt:t.completedAt,...t.startedAt===void 0?{}:{startedAt:t.startedAt}}})}return n}function Ii({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,renderPermission:o,messageActions:s,scrollControls:c,renderMode:l,taskTitles:u,recipientBackends:d}){let f=(0,Y.useMemo)(()=>Fi(n,e),[n,e]),p=vi(`${e}:${t}`,{surface:r}),m=c??p;Er(e,f,m,r);let h=(0,Y.useMemo)(()=>{let e=new Map;f.forEach((t,n)=>{if(!(t.content.kind!==`block`||t.content.block.kind!==`worker-conversation`))for(let r of t.content.block.batches)for(let i of r.messages)e.set(i.messageId,{message:i,rowKey:t.key,rowIndex:n})});let t=new Map;for(let n of e.values()){let{message:e}=n;if(e.messageKind!==`reply`||!e.requestId)continue;let r=t.get(e.requestId)??[];r.push(n),t.set(e.requestId,r)}return{targets:e,replies:t,navigate:e=>m.jumpToRow(e.rowKey,e.rowIndex)}},[f,m.jumpToRow]),g=(0,Y.useMemo)(()=>f.map(t=>({key:t.key,node:Li(t,s?.[t.key],a,o,e,u,d)})),[s,a,o,f,e,u,d]),_=l??Be(``,g.length),v=g.length===0?i??null:(0,X.jsx)(yi,{runId:`${e}:${t}`,rows:g,mode:_,controls:m});return(0,X.jsx)(Yn,{runId:e,children:(0,X.jsx)(He,{runId:e,children:(0,X.jsx)(Nr.Provider,{value:h,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:v}),m.pillVisible?(0,X.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,X.jsx)(Si,{onJump:m.jumpToLatest})}):null]}):v})})})}function Li(e,t,n,r,i,a,o){switch(e.content.kind){case`user-message`:return(0,X.jsx)(Ri,{message:e.content.message,actions:t});case`day-separator`:return(0,X.jsx)(vt,{ts:e.content.ts});case`turn-time`:return(0,X.jsx)(_t,{completedAt:e.content.completedAt,...e.content.startedAt===void 0?{}:{startedAt:e.content.startedAt}});case`block`:return(0,X.jsx)(zi,{block:e.content.block,scope:e.scope,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o});default:return Ui(e.content)}}function Ri({message:e,actions:t}){return(0,X.jsx)(tt,{text:e.text,imageCount:e.imageCount,images:e.images,...e.ts===void 0?{}:{ts:e.ts},onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel,children:e.ask?(0,X.jsx)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,children:(0,X.jsx)(Ke,{ask:e.ask})}):void 0})}function zi({block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`entry`:return(0,X.jsx)(yt.Provider,{value:`${t}:${e.entry.id}`,children:(0,X.jsx)(Vi,{entry:e.entry,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`tool-card`:return(0,X.jsx)(st,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,X.jsx)(Bi,{entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o})});case`context-group`:return(0,X.jsx)(ot,{group:e,scope:t});case`streak`:return(0,X.jsx)(nt,{count:e.count,children:e.blocks.map(e=>(0,X.jsx)(zi,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))});case`worker-conversation`:return(0,X.jsx)(Jr,{block:e,runId:i,taskTitles:a,recipientBackends:o});default:return Ui(e)}}function Bi({entries:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){return Le(e).map(e=>(0,X.jsx)(zi,{block:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o},e.id))}function Vi({entry:e,scope:t,renderAsk:n,renderPermission:r,runId:i,taskTitles:a,recipientBackends:o}){switch(e.kind){case`message`:return e.role===`assistant`?(0,X.jsx)(Qe,{text:e.text,ts:e.ts}):(0,X.jsx)(tt,{text:e.text,ts:e.ts});case`reasoning`:return(0,X.jsx)(ut,{text:e.text});case`tool`:return(0,X.jsx)(st,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return e.attribution?(0,X.jsxs)(`div`,{className:`min-w-0 rounded-md border border-border px-4 py-3 text-sm`,children:[(0,X.jsxs)(`p`,{className:`mb-2 break-all text-xs text-muted-foreground`,children:[e.attribution.source===`agent`?`Agent input from parent ${e.attribution.parentRunId}`:`Worker lifecycle context for parent ${e.attribution.parentRunId}`,e.delivery?` · ${Z(e.delivery)}`:``]}),(0,X.jsx)(ht,{note:e})]}):(0,X.jsx)(ht,{note:e});case`conversation`:return(0,X.jsx)(Jr,{runId:i,taskTitles:a,recipientBackends:o,block:{kind:`worker-conversation`,id:e.id,batches:[{id:e.id,kind:e.messageKind,text:e.text,senderRunId:e.senderRunId,messages:[e]}]}});case`image`:return(0,X.jsx)($e,{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`permission`:return r?r(e):(0,X.jsx)(Ar,{permission:e,runId:i});case`provider-auth-required`:return(0,X.jsx)(et,{incident:e});case`preview-server`:return(0,X.jsx)(Hi,{entry:e});case`hook`:return(0,X.jsx)(mt,{item:e,cacheKey:`${t}:${e.id}`});default:return Ui(e)}}function Hi({entry:e}){let t=zn(),n=E().data?.capabilities?.preview===!0;return(0,X.jsx)(Lt,{entry:t?.worktreeRemoved?{kind:`preview-server`,id:e.id,server:e.server,state:`unavailable`}:e,inPreview:t!==null&&t.open&&t.port===e.server.port,onOpen:t!==null&&n?t.openPane:void 0})}function Ui(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function Wi({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,onClose:a,onBeforeOpenReport:o,onRestoreAgentFocus:s,taskTitles:c,recipientBackends:l}){let u=(0,Y.useContext)(dn),d=(0,Y.useRef)(void 0),f=(0,Y.useRef)(!1);return(0,Y.useEffect)(()=>()=>{d.current?.()},[u,e]),(0,X.jsx)(on,{open:r!==void 0,onOpenChange:e=>{e||a()},children:(0,X.jsx)(cn,{"data-slot":`subagent-sheet`,side:`right`,onCloseAutoFocus:e=>{f.current&&=(e.preventDefault(),!1)},className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:r===void 0?null:(0,X.jsx)(je.Provider,{value:e=>{let t=r?.id,n=[...document.querySelectorAll(`[data-agent-id]`)].find(e=>e.dataset.agentId===t);d.current?.(),d.current=u?.registerOpener(e,()=>{if(t&&s){s(t);return}n?.focus({preventScroll:!0})}),f.current=!0,o?.(),a()},children:(0,X.jsx)(Gi,{runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:c,recipientBackends:l})})})})}function Gi({runId:e,renderAsk:t,renderPermission:n,agent:r,entries:i,taskTitles:a,recipientBackends:o}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(an,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,X.jsxs)(sn,{className:`flex min-w-0 items-center gap-2 pr-8 text-[16px]`,children:[(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:r.title}),r.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-xs font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:r.agentType})]}),(0,X.jsxs)(un,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,X.jsx)(Ki,{status:r.status}),(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[r.toolCalls,` `,r.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,X.jsx)(Ii,{runId:e,viewId:`agent:${r.id}`,sections:Ni(r.id,i),mode:`panel`,renderAsk:t,renderPermission:n,taskTitles:a,recipientBackends:o,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 Ki({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-xs 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 qi(e){let t=L(),[n,r]=(0,Y.useState)(),i=en(e);(0,Y.useEffect)(()=>{(!i||n&&n!==e.id)&&r(void 0)},[i,e.id,n]);let a=h({mutationFn:async()=>{r(e.id);try{if(!(await z(e.id)).cancelled)throw Error(`The task changed before Stop was accepted. Check its status and retry.`)}catch(e){throw r(void 0),e}},onSettled:()=>t.invalidateQueries({queryKey:d.runs.all})});return{stopping:!!e.stopping||a.isPending||i&&n===e.id,stop:()=>a.mutateAsync()}}function Ji({agents:e,onSelect:t}){return e.length===0?null:(0,X.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map(e=>(0,X.jsx)(Yi,{agent:e,onSelect:t},e.id))})}function Yi({agent:e,onSelect:t}){let n=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Xi,{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-xs 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:gr(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`,"data-agent-id":e.id,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 Xi({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`})]})}function Zi(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function Qi({entries:e}){return e.length===0?null:(0,X.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex min-w-0 flex-col gap-[7px]`,children:e.map((e,t)=>(0,X.jsx)($i,{entry:e},`${t}:${e.content}`))})}function $i({entry:e}){return(0,X.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:i(`flex min-h-5 min-w-0 flex-wrap items-start gap-x-2.5 gap-y-1 text-[13px] [&>svg]:mt-[3px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-disabled-foreground line-through`),children:[(0,X.jsx)(ea,{status:e.status}),(0,X.jsx)(`span`,{"data-slot":`plan-text`,className:`min-w-0 flex-1 basis-40 break-words`,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-xs font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function ea({status:e}){return e===`cancelled`?(0,X.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-disabled-foreground`,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 ta(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 na(e,t){let n=ta(e);return n===`active`&&t===`waiting`?`paused`:n}function ra(e){return e===`active`?`running`:e}function ia(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 aa({steps:e,runStatus:t=`running`}){if(e.length===0)return null;let n=ia(e)*100;return(0,X.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((n,r)=>(0,X.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":na(n.status,t),className:`flex min-h-[22px] min-w-0 flex-wrap items-start gap-x-2 gap-y-0.5 text-[13px] text-muted-foreground [&>svg]:mt-[3px]`,children:[(0,X.jsx)(oa,{visual:na(n.status,t)}),(0,X.jsx)(`span`,{"data-slot":`step-name`,className:`min-w-0 flex-1 basis-32 break-words font-medium text-foreground`,children:n.name}),n.iterations>1?(0,X.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,n.iterations]}):null,(0,X.jsxs)(`span`,{"data-slot":`step-meta`,className:`ml-auto max-w-full min-w-0 pl-2 text-right text-xs leading-5 break-words text-soft-foreground tabular-nums`,children:[n.pluginKind??n.kind,` · step `,r+1,` of `,e.length]})]},n.id)),(0,X.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,X.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${n}%`}})})]})}function oa({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,X.jsx)(ge,{"aria-hidden":!0,className:i(t,`text-success`)});case`active`:return(0,X.jsx)(Ot,{role:`status`,"aria-label":`Step running`,className:i(t,`animate-spin stroke-pending motion-reduce:animate-none [html.light_&]:stroke-pending-strong`)});case`paused`:return(0,X.jsx)(Ce,{role:`img`,"aria-label":`Step paused`,className:i(t,sa)});case`failed`:return(0,X.jsx)(W,{"aria-hidden":!0,className:i(t,`text-danger`)});case`pending`:return(0,X.jsx)(be,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)})}}var sa=`stroke-pending [html.light_&]:stroke-pending-strong`,ca={done:`done`,failed:`failed`,cancelled:`cancelled`};function la(e){let t=ca[e.status];return t?e.steps.map(e=>ta(e.status)===`active`?{...e,status:t}:e.status===`pending`?{...e,status:`skipped`}:e):ua(e)}function ua(e){let t=da(e.currentStepId,e.steps);return e.steps.some((e,n)=>n!==t&&e.status===`waiting`)?e.steps.map((e,n)=>n!==t&&e.status===`waiting`?{...e,status:`done`}:e):e.steps}function da(e,t){let n=t.findIndex(t=>t.id===e);if(n>=0)return n;let r=t.reduce((e,t,n)=>ta(t.status)===`active`?n:e,-1);if(r>=0)return r;let i=t.findIndex(e=>e.status===`pending`);return i>=0?i:t.reduce((e,t,n)=>t.status===`skipped`?e:n,0)}function fa(e,t,n,r){return n?r===`step`?`Step ${e} of ${t}`:`${e} of ${t} complete`:`${e} / ${t}`}function pa(e){return typeof e==`object`&&!!e&&!(0,Y.isValidElement)(e)&&`keep`in e}function Q({slot:e,icon:t,title:n,meta:r,summary:a,aside:o,open:s,onToggle:c,className:l,children:u}){let d=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex size-4 shrink-0 items-center justify-center text-accent-text`,children:t}),(0,X.jsx)(`span`,{className:i(`truncate text-[14px] font-semibold text-foreground`,typeof n==`string`?`shrink-0`:`min-w-0 shrink`),children:n}),a??(pa(r)?(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta`,className:`contents text-[13px] text-muted-foreground tabular-nums`,children:[r.drop===void 0?null:(0,X.jsxs)(`span`,{className:`flex h-[1lh] min-w-0 shrink-[2] flex-wrap overflow-hidden`,children:[(0,X.jsx)(`span`,{"aria-hidden":!0,className:`h-[1lh] w-0`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-meta-drop`,className:`whitespace-nowrap`,children:[r.drop,(0,X.jsx)(`span`,{className:`text-soft-foreground`,children:` ·`})]})]}),` `,(0,X.jsx)(`span`,{"data-slot":`run-activity-meta-keep`,className:`shrink-0 whitespace-nowrap`,children:r.keep})]}):r===void 0?null:(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`min-w-0 shrink-[2] truncate text-[13px] text-muted-foreground tabular-nums`,children:r}))]}),f=c!==void 0;return(0,X.jsxs)(`div`,{"data-slot":`run-activity-${e}`,"data-state":f&&s?`open`:`collapsed`,className:i(`min-w-0 border-t border-border first:border-t-0`,l),children:[f?(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:c,className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2 text-start hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,children:[d,o,(0,X.jsx)(G,{"aria-hidden":!0,className:i(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!o&&`ms-auto`,s&&`rotate-180`)})]}):(0,X.jsxs)(`div`,{className:`flex min-h-11 w-full min-w-0 items-center gap-2.5 px-3.5 py-2`,children:[d,o]}),f&&s?(0,X.jsx)(`div`,{"data-slot":`run-activity-body`,className:`min-w-0 border-t border-border/60 bg-muted/30 px-3.5 py-2.5`,children:u}):null]})}function ma(e){return U(e.delegation)}function ha(e,t){let n=e?.role===`root`?e.receipts.map(e=>e.workerId).reverse():[];return[...new Set([...n,...(t?.workers??[]).map(e=>e.workerId)])]}function ga(e){let t=e.delegation,n=ma(e),r=y(e.id,{enabled:n});if(!n||!t)return`complete`;if(!r.isSuccess)return r.isError||r.fetchStatus===`paused`?`unknown`:`pending`;let i=new Map(r.data.workers.map(e=>[e.workerId,e])),a=ha(t,r.data).map(e=>{let t=i.get(e)?.status;return t===`done`||t===`cancelled`?`complete`:t===void 0||t===`failed`?`issue`:`pending`});return a.includes(`pending`)?`pending`:a.includes(`issue`)?`issue`:`complete`}function _a(e){let t=y(e.id,{enabled:e.delegation?.role===`root`});return t.isSuccess&&t.data.workers.some(e=>rn(e.status))}function va({run:e,open:t,onToggle:n}){let r=y(e.id),a=S(),o=pn(),s=e.delegation,c=new Map(r.data?.workers.map(e=>[e.workerId,e])),l=ha(s,r.data),u=F(e)??P(e),d=u?ya(e,u):void 0,f=e=>a.data?.find(t=>t.id===e)??r.data?.titles?.find(t=>t.id===e),p=e=>{let t=f(e);return t?q(t):`worker ${e.slice(0,8)}`};return(0,X.jsx)(Q,{slot:`workers`,icon:(0,X.jsx)(pe,{className:`size-4`}),title:`Workers`,meta:ba({ids:l,workers:c,desktop:o,query:r}),aside:r.data?.capacity?(0,X.jsx)(Da,{capacity:r.data.capacity}):void 0,open:t,onToggle:n,children:(0,X.jsxs)(`div`,{"aria-label":`Task relationships`,className:`min-w-0 text-[13px] text-muted-foreground`,role:`group`,children:[r.data?.capacity&&r.data.capacity.outstanding>=r.data.capacity.limit?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`All worker slots are in use. Clean up finished workers to free a slot.`}):null,u?(0,X.jsx)(wa,{wait:u,dependencyLabel:d}):null,l.length>0?(0,X.jsx)(`ul`,{className:`grid max-h-64 min-w-0 gap-0.5 overflow-y-auto`,children:l.map(t=>{let n=c.get(t),a=f(t),o=n?Sa(n.status):r.isSuccess?`Record unavailable or deleted`:`Status unavailable`;return(0,X.jsxs)(`li`,{"data-slot":`worker-item`,"data-status":n?.status,className:`min-w-0`,children:[(0,X.jsxs)(Yt,{to:`/tasks/${t}`,"aria-label":`Worker task ${t}`,className:`group flex min-h-11 min-w-0 items-center gap-2.5 rounded-md px-1 text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[(0,X.jsx)(xa,{status:n?.status}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`span`,{className:`block truncate`,children:a?q(a):`Worker ${t.slice(0,8)}`}),n?.supervisorRunId&&n.supervisorRunId!==e.id?(0,X.jsxs)(`span`,{"data-slot":`worker-supervisor`,className:`block truncate text-xs text-muted-foreground`,children:[`Started by `,p(n.supervisorRunId)]}):null]}),(0,X.jsx)(`span`,{className:i(`max-w-[45%] shrink-0 truncate text-xs`,Ca(n?.status)),children:o}),(0,X.jsx)(he,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`})]}),n?(0,X.jsx)(ka,{parentRunId:e.id,worker:n}):null,n?.destroy?(0,X.jsx)(Na,{state:n.destroy}):null]},t)})}):ma(e)&&r.isSuccess?(0,X.jsx)(`p`,{className:`px-1 py-1`,children:`No workers`}):null,r.fetchStatus===`paused`?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Offline — relationship details will refresh when connected.`}):r.isPending?(0,X.jsx)(`p`,{role:`status`,className:`px-1 py-1`,children:`Loading relationships…`}):null,r.isError?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-1 py-1`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Could not load relationships. Known task links are retained.`}),(0,X.jsx)(K,{variant:`outline`,className:`min-h-11`,onClick:()=>void r.refetch(),children:`Retry relationships`})]}):null]})})}function ya(e,t){let n=e.delegation;if(!(!n||n.role===`invalid`))return M(e)??j(n.role,t,`requestIds`in t&&N(n,t.requestIds))}function ba({ids:e,workers:t,desktop:n,query:r}){if(e.length===0)return r.isError?`Unavailable`:r.isPending?`Linking…`:`No workers`;let i=`${e.length} linked`;if(!n)return i;let a=new Map;for(let n of e){let e=t.get(n)?.status;e!==void 0&&a.set(e,(a.get(e)??0)+1)}return[i,...[...a.entries()].map(([e,t])=>`${t} ${e}`)].join(` · `)}function xa({status:e}){let t=`size-[15px] shrink-0`;return e===`done`?(0,X.jsx)(ge,{"aria-hidden":!0,className:i(t,`text-semantic-green`)}):e===`failed`?(0,X.jsx)(W,{"aria-hidden":!0,className:i(t,`text-semantic-red`)}):e===`cancelled`?(0,X.jsx)(_e,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)}):e===`review`?(0,X.jsx)(Dt,{"aria-hidden":!0,className:i(t,`text-semantic-info`)}):e===`waiting`?(0,X.jsx)(Ce,{"aria-hidden":!0,className:i(t,`text-semantic-amber`)}):e===`running`?(0,X.jsx)(Ot,{role:`status`,"aria-label":`Worker running`,className:i(t,`animate-spin stroke-status-running motion-reduce:animate-none`)}):(0,X.jsx)(be,{"aria-hidden":!0,className:i(t,`text-soft-foreground`)})}function Sa(e){return Cn(e)}function Ca(e){return e===`done`?`text-semantic-green`:e===`failed`?`text-semantic-red`:e===`review`?`text-semantic-info`:e===`waiting`?`text-semantic-amber`:`text-muted-foreground`}function wa({wait:e,dependencyLabel:t}){return(0,X.jsxs)(`p`,{className:`px-2 break-words`,children:[e.phase===`parked`&&t?En(`waiting-on-workers`,t):`requestIds`in e&&e.requestIds?e.phase===`parked`?`Waiting for request replies`:e.phase===`wake-pending`?`Conversation update queued for this task`:`Request wait registered — the agent is finishing its turn`:e.phase===`parked`?`Waiting for workers`:e.phase===`wake-pending`?`Worker update queued for the parent`:`Worker wait registered — the agent is finishing its turn`,`.`,`deadline`in e?(0,X.jsxs)(X.Fragment,{children:[` `,`Deadline: `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:e.deadline})]}):` No deadline: Squawk wakes this task when they have all settled.`]})}function Ta(e){return e.delegation?.role===`worker`&&P(e)?.phase===`wake-pending`}function Ea({run:e}){let t=P(e);return e.delegation?.role===`worker`&&t?.phase===`wake-pending`?(0,X.jsx)(wa,{wait:t,dependencyLabel:j(`worker`,t)}):null}function Da({capacity:e}){return(0,X.jsxs)(`span`,{"data-slot":`worker-capacity`,role:`status`,"aria-label":`Worker capacity: ${e.outstanding} of ${e.limit} in use`,className:`ms-auto shrink-0 whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:[e.outstanding,` of `,e.limit,` in use`]})}var Oa=new Set([`review`,`done`,`failed`,`cancelled`]);function ka({parentRunId:e,worker:t}){let n=c(e),[r,i]=(0,Y.useState)(!1);if(!Oa.has(t.status)||t.destroy?.phase===`complete`&&t.destroy.remaining.length===0)return null;let a=t.workerId.slice(0,8),o=!!t.destroy&&t.destroy.phase!==`complete`,s=n.error instanceof A?n.error.work:void 0;return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2 px-1`,children:[r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`break-words text-xs`,children:ie(t.workspace)?`Removes this worker's worktree and branch. Its result is saved first.`:`Stops this worker and frees its slot. It runs in this task's worktree, so no worktree or branch is removed. Its result is saved first.`}),(0,X.jsx)(K,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Confirm clean up of worker ${a}`,onClick:()=>{i(!1),n.mutate({workerId:t.workerId})},children:`Clean up`}),(0,X.jsx)(K,{variant:`outline`,size:`sm`,className:`min-h-11`,onClick:()=>i(!1),children:`Cancel`})]}):(0,X.jsx)(K,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":o?`Retry clean up of worker ${a}`:`Clean up worker ${a}`,disabled:n.isPending,onClick:()=>i(!0),children:n.isPending?`Cleaning up…`:o?`Retry clean up`:`Clean up`}),n.isError&&!r?(0,X.jsx)(`span`,{role:`status`,className:`break-words text-xs`,children:s?`Cleanup stopped: this worker holds ${ja(s)}. Land or commit what you need first, or discard it.`:`Cleanup did not finish: ${n.error.message}`}):null,s&&!r&&!n.isPending?(0,X.jsx)(K,{variant:`danger-ghost`,size:`sm`,className:`min-h-11`,"aria-label":`Discard work and clean up worker ${a}`,onClick:()=>n.mutate({workerId:t.workerId,discardWork:!0}),children:`Discard work and clean up`}):null]})}var Aa=(e,t,n)=>`${e} ${e===1?t:n}`;function ja(e){return[...e.uncommittedFiles?[Aa(e.uncommittedFiles,`uncommitted file`,`uncommitted files`)]:[],...e.commits?[`${Aa(e.commits,`commit`,`commits`)} no other branch reaches`]:[]].join(` and `)}function Ma(e){return e!==void 0&&(e.phase!==`complete`||e.remaining.length>0||e.error!==void 0)}function Na({state:e}){if(!Ma(e))return null;let t=e.phase===`complete`?void 0:e.retry,n=t&&(0,X.jsx)(Pa,{at:t.nextAt});return(0,X.jsxs)(`p`,{className:`px-2 pb-2 break-words`,children:[t?.needsAttention?`Cleanup needs attention`:e.phase===`incomplete`?`Cleanup incomplete`:e.phase===`complete`?`Cleanup complete`:`Cleanup ${e.phase}`,e.remaining.length?` — remaining: ${e.remaining.join(`, `)}`:``,e.error?` — ${t?e.error.replace(/\.$/,``):e.error}`:``,t?.needsAttention?(0,X.jsxs)(X.Fragment,{children:[`. Nothing changed after `,t.attempts,` automatic attempts; checking hourly, next check `,n,`. Retry clean up to try now.`]}):t?(0,X.jsxs)(X.Fragment,{children:[`. Retrying automatically, next attempt `,n,`.`]}):null]})}function Pa({at:e}){let t=ln(3e4);return(0,X.jsx)(`time`,{dateTime:e,title:new Date(e).toLocaleString(),children:Xn(t,Date.parse(e))})}function Fa({items:e,lead:t=0}){let n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(-1/0);return(0,Y.useLayoutEffect)(()=>{let r=n.current;if(!r)return;let a=()=>{let n=r.getBoundingClientRect().width;if(!n&&r.getClientRects().length===0)return;let a=getComputedStyle(r),o=Number.parseFloat(a.width),s=o>0?n/o:1,c=(Number.parseFloat(a.columnGap)||0)*s,l=Array.from(r.children,e=>e.getBoundingClientRect().width),u=e.map((e,t)=>({...e,width:l[t]??0})),d=-1/0,f=()=>u.reduce((e,t)=>e+t.width,0)+Math.max(0,u.length-1)*c+(u.length>0?t*s:0);for(let t of[...new Set(e.map(e=>e.priority))].sort((e,t)=>e-t)){if(f()<=n)break;d=t,u=u.filter(e=>e.priority>t)}i(e=>e===d?e:d)};if(a(),typeof ResizeObserver>`u`)return;let o=new ResizeObserver(a);o.observe(r);for(let e of r.children)o.observe(e);return()=>o.disconnect()},[e,t]),(0,X.jsx)(`span`,{ref:n,"data-slot":`activity-summary`,className:`relative flex h-[max(1.5em,22px)] min-w-0 flex-1 items-center gap-2.5 overflow-clip whitespace-nowrap text-[13px] font-normal text-muted-foreground tabular-nums`,children:e.map(n=>{let i=n.priority<=r,a=n===e.find(e=>e.priority>r);return(0,X.jsxs)(`span`,{"data-summary-item":n.id,"data-hidden":i,"aria-hidden":i||void 0,inert:i||void 0,style:a&&t?{marginInlineStart:t}:void 0,className:`inline-flex w-max shrink-0 items-center gap-1.5 data-[hidden=true]:invisible data-[hidden=true]:absolute`,children:[!a||t>0?(0,X.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`activity-separator`,className:`before:content-['·']`}):null,n.content]},n.id)})})}function Ia({run:e,references:t}){return(0,X.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:t.map(t=>(0,X.jsx)(Nt,{reference:t,taskTitle:q(e),inert:!0},ce(t)))})}function La(e){return e.accountId===void 0||e.profilesPending?void 0:e.profilesError?e.accountId:e.accountId==="default"?On(e.accounts,e.accountBackend)?`default`:void 0:e.known?On(e.accounts,e.accountBackend)?e.known.label:void 0:`${e.accountId} (removed)`}function Ra(e){let t=x(),n=m(),r=g(),{accounts:i}=qn(),a=e.runner??n.data?.defaultRunner??`claude`,o=e.model??`auto`,s=e.effort||`auto`,c=[...e.steps].reverse().find(e=>e.profileId),l=c?.profileId,u=c?.backend??a,d=r.data?.profiles.find(e=>e.id===l&&e.provider===u),p=La({accountId:l,profilesPending:r.isPending,profilesError:r.isError,known:d,accounts:i,accountBackend:u}),h=e.modelIdentity&&e.modelIdentity!==o?e.modelIdentity:void 0;return{runner:e.removedRunner===void 0?f(t.data,a):O(e.removedRunner),...p?{account:p}:{},model:o,effort:s,...h?{identity:h}:{}}}var za=[`running`,`queued`,`waiting`];function Ba(e){return Array.isArray(e)?e.filter(e=>e?.kind===`pr`||e?.kind===`timer`||e?.kind===`worker`||e?.kind===`process`||e?.kind===`peer`||e?.kind===`subagent`||e?.kind===`plugin`):[]}function $(e){let t=e?new Date(e):void 0;return t&&Number.isFinite(t.getTime())?new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(t):void 0}function Va(e,t){return`${e} — ${t.status===`failed`?`not delivered; Continue delivers it, Stop discards it`:t.status===`running`?`current turn still working`:`waiting for capacity`}`}function Ha(e){return e.kind!==`worker`&&e.kind!==`peer`&&e.kind!==`subagent`}function Ua(e){let t=Ba(e.waits),n=za.includes(e.status),r=t.filter(t=>t.phase===`open`?n:t.phase===`resolved`&&Ha(t)&&(n||e.status===`failed`)),i=r.some(e=>e.kind===`pr`),a=[...Ba(e.lastWaits),...t.filter(e=>!r.includes(e)&&e.phase!==`open`)],o=i?void 0:a.filter(e=>e.kind===`pr`).at(-1),s=i?void 0:e.lastWaitsError,c=r.some(e=>e.kind===`process`)?void 0:a.filter(e=>e.kind===`process`).at(-1);return r.length||o||s||c?{open:r,lastCi:o,error:s,lastProcess:c}:void 0}function Wa(e){return Ua(e)!==void 0}function Ga(e){return(Ua(e)?.open??[]).filter(e=>e.kind===`pr`).map(e=>({kind:`PR`,number:e.prNumber,url:e.prUrl}))}function Ka({run:e}){let t=Ua(e);if(!t)return null;let{open:n,lastCi:r,error:i,lastProcess:a}=t;return(0,X.jsxs)(`div`,{"data-slot":`open-waits`,className:`flex min-w-0 flex-col gap-1`,children:[n.map(t=>t.kind===`pr`?(0,X.jsx)(Ja,{run:e,wait:t},t.id):t.kind===`worker`?(0,X.jsx)(Ya,{wait:t},t.id):t.kind===`process`?(0,X.jsx)(to,{run:e,wait:t},t.id):t.kind===`peer`?(0,X.jsx)(Xa,{wait:t},t.id):t.kind===`subagent`?(0,X.jsx)(Za,{wait:t},t.id):t.kind===`plugin`?(0,X.jsx)(Qa,{run:e,wait:t},t.id):(0,X.jsx)($a,{run:e,wait:t},t.id)),i?(0,X.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:i}):r?(0,X.jsx)(Ja,{run:e,wait:r,settled:!0}):null,a?(0,X.jsx)(to,{run:e,wait:a,settled:!0}):null]})}function qa(e,t,n){let r=t.result,i=t.until!==`checks`,a={passed:`CI checks passed — observed checks only; not merge approval`,stuck:`CI checks stuck in queue — inspect the PR checks`,failed:`CI checks failed — inspect the PR checks`,conflicting:i?`PR has merge conflicts — inspect the PR; not merged`:`PR has merge conflicts — inspect the PR; not merge approval`,cancelled:i?`Merge wait cancelled`:`CI wait cancelled`,skipped:`CI checks skipped — inspect the PR checks`,no_checks:`No CI checks found — inspect the PR workflows`,startup_failure:`CI workflow never started — inspect the PR workflows`,deadline:i?`Merge wait timed out — merge not confirmed`:`CI wait timed out — inspect the PR checks`,error:i?`Merge wait unavailable — inspect access and the PR`:`CI wait unavailable — inspect access and the PR checks`,head_changed:`CI head changed — ${r?.headSha?vn(r.headSha):`unknown`} → ${r?.observedHeadSha?vn(r.observedHeadSha):`unknown`}`,merged:`PR merged`,closed:`PR closed without merge — inspect the PR`,blocked:`Initiated merge blocked — inspect the PR; not merged`},o=i?`Merge`:`CI`,s=n&&t.phase===`cancelled`;return n?s?`${o} wait cancelled`:r?a[r.outcome]:`${o} wait unavailable`:t.phase===`resolved`?Va(`${o} result ready`,e):t.until===`merge_or_blocked`?`Waiting for merge or blockage`:i?`Waiting for merge`:`Waiting for CI`}function Ja({run:e,wait:t,settled:n=!1}){let r=t.result,i=t.until===`checks`?`CI`:`Merge`,o=n&&t.phase===`cancelled`,s=qa(e,t,n),c=n?o?t.cancelledAt:r?.observedAt:t.deadline,l=$(c),u=`${t.repository}#${t.prNumber}`;return(0,X.jsx)(`div`,{"data-slot":`ci-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-[13px] text-muted-foreground [overflow-wrap:anywhere]`,children:(0,X.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] items-baseline gap-x-3 gap-y-1`,children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Status`}),(0,X.jsx)(`dd`,{children:s}),(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Pull request`}),(0,X.jsx)(`dd`,{className:`min-w-0`,children:a(t.prUrl)?(0,X.jsx)(`a`,{href:t.prUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-11 min-w-11 max-w-full items-center rounded-sm px-1 font-medium text-foreground underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted`,children:u}):(0,X.jsx)(`span`,{children:u})}),l?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:n?o?`Cancelled`:`Observed`:`Deadline`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(`time`,{dateTime:c,children:l})})]}):n?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Deadline`}),(0,X.jsxs)(`dd`,{children:[i,` deadline unavailable`]})]})]})})}function Ya({wait:e}){let t=e.workerIds!==void 0,n=new Set((t?e.outcomes:e.requestOutcomes)?.map(e=>`workerId`in e?e.workerId:e.requestId)),r=(e.workerIds??e.requestIds??[]).filter(e=>!n.has(e)).length,i=t?r===1?`worker`:`workers`:r===1?`request reply`:`request replies`,a=$(e.deadline);return(0,X.jsxs)(`div`,{"data-slot":`worker-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,X.jsxs)(`p`,{children:[`Waiting for `,r,` `,i]}),a?(0,X.jsxs)(`p`,{children:[`Deadline`,` `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:a})]}):(0,X.jsx)(`p`,{children:`Worker wait deadline unavailable`})]})}function Xa({wait:e}){let t=e.peerIds.length,n=$(e.deadline);return(0,X.jsxs)(`div`,{"data-slot":`peer-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,X.jsxs)(`p`,{children:[`Waiting for `,t,` `,t===1?`task`:`tasks`]}),n?(0,X.jsxs)(`p`,{children:[`Deadline`,` `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,X.jsx)(`p`,{children:`Peer wait deadline unavailable`})]})}function Za({wait:e}){let t=(Array.isArray(e.children)?e.children:[]).filter(e=>e?.status===`running`).length,n=$(e.deadline);return(0,X.jsxs)(`div`,{"data-slot":`subagent-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,X.jsxs)(`p`,{children:[`Waiting for `,t,` `,t===1?`subagent`:`subagents`]}),n?(0,X.jsxs)(`p`,{children:[`Check by`,` `,(0,X.jsx)(`time`,{dateTime:e.deadline,children:n})]}):(0,X.jsx)(`p`,{children:`Subagent wait deadline unavailable`})]})}function Qa({run:e,wait:t}){let n=t.phase===`open`?$(t.deadline):void 0;return(0,X.jsxs)(`div`,{"data-slot":`plugin-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`p`,{children:t.phase===`resolved`?Va(t.summary,e):t.summary}),n?(0,X.jsxs)(`p`,{children:[`Deadline`,` `,(0,X.jsx)(`time`,{dateTime:t.deadline,children:n})]}):null]})}function $a({run:e,wait:t}){let n=$(t.deadline);return(0,X.jsxs)(`div`,{"data-slot":`monitoring-schedule`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[t.phase===`resolved`?(0,X.jsx)(`p`,{children:Va(`Automatic check due`,e)}):n?(0,X.jsxs)(`p`,{children:[`Next automatic check`,` `,(0,X.jsx)(`time`,{dateTime:t.deadline,className:`font-medium text-foreground`,children:n})]}):(0,X.jsx)(`p`,{children:`Automatic check time unavailable`}),t.note?(0,X.jsx)(`p`,{children:t.note}):null]})}function eo(e){let t=e.result;return t?t.outcome===`exit_file`?t.exitCode===void 0?`PID ${e.pid} wrote an exit file that is not an exit code`:`PID ${e.pid} exited with code ${t.exitCode}`:t.outcome===`exited`?e.startToken===void 0&&t.observedAt===e.registeredAt?`PID ${e.pid} was not running when the wait was registered`:`PID ${e.pid} exited, code unknown`:t.outcome===`deadline`?`PID ${e.pid} still running at the deadline`:`PID ${e.pid} could not be checked`:`PID ${e.pid} still running at the deadline`}function to({run:e,wait:t,settled:n=!1}){let r=n&&t.phase===`cancelled`?`Process wait on PID ${t.pid} cancelled`:n?eo(t):t.phase===`resolved`?Va(eo(t),e):`Waiting for PID ${t.pid}${t.note?` — ${t.note}`:``}`,i=!n&&t.phase===`open`?$(t.deadline):void 0;return(0,X.jsxs)(`div`,{"data-slot":`process-wait-status`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`min-w-0 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`p`,{children:r}),i?(0,X.jsxs)(`p`,{children:[`Until`,` `,(0,X.jsx)(`time`,{dateTime:t.deadline,children:i})]}):null]})}var no=new Map,ro=new Map;function io(e){let{referenceProjectId:t,repoBase:n,references:r,requests:i}=Ct(e.run);return(0,X.jsx)(At,{projectId:t,repoBase:n,requests:i,children:(0,X.jsx)(ao,{...e,references:r,prNumbers:i.filter(e=>e.kind===`PR`).map(e=>e.number),hasReferences:r.length>0||!!ue(e.run)||!!le(e.run,n)})})}function ao({run:e,thread:t,currentThread:n,currentComplete:r=!0,pendingAsk:i=!1,onOpenWorker:a,readerScroll:o,presentation:s=`card`,prNumbers:c,hasReferences:l,references:u}){let d=pn(),f=Ra(e),[p,m]=(0,Y.useState)(()=>i?!1:no.get(e.id)??!1),h=Co(o,p),g=s===`panel`||h.open,[_,v]=(0,Y.useState)({}),y=so(e,t??n,n,r,c),b=bt(e),x=t=>_[t]??ro.get(`${e.id}:${t}`)??t===`workers`,S=t=>{let n=!x(t);ro.set(`${e.id}:${t}`,n),v(e=>({...e,[t]:n}))},C=e=>({open:x(e),onToggle:()=>S(e)}),w=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-border`,children:[(0,X.jsx)(go,{run:e,activity:y,...C(`status`)}),(0,X.jsx)(_o,{run:e,desktop:d,automations:y.automations,...C(`workflow`)}),(0,X.jsx)(vo,{activity:y,desktop:d,onOpenWorker:a,...C(`subagents`)}),(0,X.jsx)(yo,{run:e,...C(`workers`)}),(0,X.jsx)(bo,{activity:y,desktop:d,...C(`plan`)}),(0,X.jsx)(xo,{run:e,identity:f,activity:y,...C(`usage`)}),(0,X.jsx)(So,{run:e,references:u,conflicts:y.conflicts,hasReferences:l,onResume:()=>b.mutate(),...C(`workspace`)})]});return s===`panel`?(0,X.jsxs)(`section`,{"data-slot":`run-activity-dock`,"data-presentation":`panel`,"data-state":`open`,"aria-label":`Session activity`,className:`flex min-w-0 flex-col bg-card`,children:[(0,X.jsxs)(`div`,{className:`sticky inset-bs-0 z-10 flex items-center gap-2 bg-card px-3.5 py-2.5 text-[13px]`,children:[(0,X.jsx)(Oe,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`font-semibold text-foreground`,children:`Session activity`}),y.cost?(0,X.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`ms-auto shrink-0 font-mono text-[12px] text-muted-foreground tabular-nums`,children:y.cost}):null]}),w]}):(0,X.jsxs)(`section`,{"data-slot":`run-activity-dock`,ref:h.ref,"data-state":g?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-xl border border-border bg-card shadow-xs`,children:[(0,X.jsx)(po,{run:e,identity:f,activity:y,references:u,open:g,onToggle:()=>{no.set(e.id,!g),m(!g),h.chose(!g)}}),g?w:null]})}function oo(e,t,n,r){let i=E(),a=Bn(i.data),o=S(),s=Tt(e,{queuePosition:e.status===`queued`?tn(o.data??[]).get(e.id):void 0}),c=!$t(e)&&e.status!==`queued`,l=(0,Y.useMemo)(()=>r?pr(n.turns,c,t.turns):[],[r,n.turns,c,t.turns]),u=zt(n)??[],d=ga(e),f=hr(l),p=Zi(u);return{health:i,line:s,...co(e,s,d,r?f:void 0,p),...lo(e,a),agents:l,agentCounts:f,planEntries:u,planCounts:p}}function so(e,t,n,r,i){let a=oo(e,t,n,r),o=Mt(i);return{...a,conflicts:o,waitReferences:Ga(e),automations:Tn(a.health.data)}}function co(e,t,n,r,i){let a=e.steps.every(e=>e.status===`done`||e.status===`skipped`),o=e.status===`done`&&a&&n===`complete`&&r!==void 0&&r.done===r.total&&i.done===i.total;return{allComplete:o,statusText:o?`All complete`:e.status!==`done`||r===void 0?t.label:n===`unknown`?`Workers unavailable`:n===`pending`?`In progress`:`Incomplete`,failed:t.attention.tone===`danger`,glyph:o?(0,X.jsx)(ge,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-success`}):(0,X.jsx)(J,{tone:t.attention.tone,shape:t.attention.shape,pulse:t.attention.pulse})}}function lo(e,t){return{cost:t.cost&&e.costUsd!==void 0?de(e.costUsd):void 0,tokens:t.tokens&&(e.inputTokens!==void 0||e.outputTokens!==void 0)?(0,X.jsx)(Fn,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):void 0}}function uo(e){return e.allComplete?`text-semantic-green`:e.failed&&`text-semantic-red`}function fo(e){let t=la(e),n=da(e.currentStepId,t);return t.length>0?{steps:t,index:n,step:t[n]}:void 0}function po({run:e,identity:t,activity:n,references:r,open:a,onToggle:o}){let{cost:s}=n,c=[...new Map([...r,...n.waitReferences].map(e=>[ce(e),e])).values()];return(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-label":mo(e,t,n,c,a),onClick:o,className:i(`flex min-h-11 w-full min-w-0 items-center px-3.5 py-2 text-start text-[14px] hover:bg-muted/40 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,a?`gap-2.5`:`gap-2`),children:[(0,X.jsx)(Oe,{"aria-hidden":!0,className:`size-4 shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Activity`}),a?null:(0,X.jsx)(ho,{run:e,identity:t,activity:n,summaryReferences:c}),a&&s?(0,X.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`ms-auto shrink-0 text-[13px] text-muted-foreground tabular-nums`,children:s}):null,(0,X.jsx)(G,{"aria-hidden":!0,className:i(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,a&&!s&&`ms-auto`,a&&`rotate-180`)})]})}function mo(e,t,n,r,i){let{statusText:a,conflicts:o,cost:s}=n,c=`Session activity: ${a}${o.length?`; pull request conflicts`:``}${s?`; cost ${s}`:``}`;if(i)return c;let l=fo(e)?.step,u=l?`; step ${l.name}, ${ra(na(l.status,e.status))}`:``,d=r.length?`; ${r.map(e=>`${e.kind} #${e.number}`).join(`; `)}`:``;return`${c}${u}; runner ${t.runner}; model ${t.model}; effort ${t.effort}${d}`}function ho({run:e,identity:t,activity:n,summaryReferences:r}){let{statusText:a,cost:o,conflicts:s}=n,c=fo(e)?.step,l=[{id:`runner`,priority:2,content:t.runner},{id:`model`,priority:4,content:t.model},{id:`effort`,priority:3,content:t.effort},...o?[{id:`cost`,priority:1,content:(0,X.jsx)(`span`,{"data-slot":`run-activity-cost`,children:o})}]:[],...r.length||s.length?[{id:`chips`,priority:0,content:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ia,{run:e,references:r}),s.length>0?(0,X.jsxs)(`span`,{"data-slot":`run-activity-conflict`,className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,X.jsx)(Se,{"aria-hidden":!0,className:`size-3.5`}),`Conflicts`]}):null]})}]:[]];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`run-activity-status`,title:a,className:i(`inline-flex min-w-[calc(0.875rem+3ch)] flex-[0_1_auto] items-center gap-1.5 text-[13px] whitespace-nowrap text-muted-foreground`,uo(n)),children:[n.glyph,(0,X.jsx)(`span`,{"data-slot":`run-activity-status-label`,className:`min-w-0 truncate`,children:a})]}),c?(0,X.jsxs)(`span`,{"data-slot":`run-activity-step`,className:i(`flex max-w-max min-w-[calc(1.375rem+2ch)] flex-[1000_1_0] items-center gap-1.5 text-[13px] text-muted-foreground`,e.status===`waiting`&&`max-md:hidden`),children:[(0,X.jsx)(Do,{step:c,runStatus:e.status,decorative:!0}),(0,X.jsx)(`span`,{"data-slot":`run-activity-step-name`,title:c.name,className:`min-w-0 truncate`,children:c.name})]}):null,(0,X.jsx)(`span`,{className:`-ms-2 flex min-w-0 flex-[1_1_0]`,children:(0,X.jsx)(Fa,{items:l,lead:8})})]})}function go({run:e,activity:t,open:n,onToggle:r}){let{line:a,waitReferences:o}=t,s=Ta(e);return(0,X.jsxs)(Q,{slot:`status-row`,icon:t.glyph,title:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{"data-slot":`run-activity-status`,className:i(`truncate`,uo(t)),children:t.statusText}),a.nextCheck?(0,X.jsxs)(`span`,{"data-slot":`run-activity-next-check`,className:`whitespace-normal text-[13px] font-normal text-muted-foreground`,children:[`Next check `,(0,X.jsx)(`time`,{dateTime:a.nextCheck.at,children:a.nextCheck.text})]}):null]}),summary:!n&&o.length>0?(0,X.jsx)(Fa,{items:[{id:`chips`,priority:0,content:(0,X.jsx)(Ia,{run:e,references:o})}]}):void 0,open:n,onToggle:Wa(e)||s?r:void 0,children:[(0,X.jsx)(Ka,{run:e}),s?(0,X.jsx)(Ea,{run:e}):null]})}function _o({run:e,desktop:t,automations:n,open:r,onToggle:i}){let a=fe(e),o=fo(e);return!a&&!o?null:(0,X.jsxs)(Q,{slot:`workflow`,icon:o?(0,X.jsx)(Do,{step:o.step,runStatus:e.status}):(0,X.jsx)(Ee,{className:`size-4`}),title:(0,X.jsxs)(X.Fragment,{children:[`Workflow`,a?(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` · `,a]}):null]}),meta:o?{drop:o.step.name,keep:fa(o.index+1,o.steps.length,t,`step`)}:void 0,open:r,onToggle:i,children:[o?(0,X.jsx)(aa,{steps:o.steps,runStatus:e.status}):null,(0,X.jsx)(Eo,{run:e,available:n})]})}function vo({activity:e,desktop:t,onOpenWorker:n,open:r,onToggle:i}){let{agents:a,agentCounts:o}=e;return a.length===0?null:(0,X.jsx)(Q,{slot:`subagents`,icon:(0,X.jsx)(we,{className:`size-4`}),title:`Subagents`,meta:fa(o.done,o.total,t),open:r,onToggle:i,children:(0,X.jsx)(Ji,{agents:a,onSelect:n})})}function yo({run:e,open:t,onToggle:n}){return ma(e)?(0,X.jsx)(va,{run:e,open:t,onToggle:n}):null}function bo({activity:e,desktop:t,open:n,onToggle:r}){let{planEntries:i,planCounts:a}=e;return i.length===0?null:(0,X.jsx)(Q,{slot:`plan`,icon:(0,X.jsx)(me,{className:`size-4`}),title:`Plan`,meta:fa(a.done,a.total,t),open:n,onToggle:r,children:(0,X.jsx)(Qi,{entries:i})})}function xo({run:e,identity:t,activity:n,open:r,onToggle:i}){let{cost:a,tokens:o}=n,s=e.modelIdentity?.includes(`/`)?e.modelIdentity.split(`/`)[0]:void 0,c=[...s?[{id:`provider`,priority:2,content:s}]:[],{id:`model`,priority:4,content:t.model},{id:`effort`,priority:3,content:t.effort},...a?[{id:`cost`,priority:1,content:a}]:[],...o?[{id:`tokens`,priority:0,content:o}]:[]];return(0,X.jsx)(Q,{slot:`usage`,icon:(0,X.jsx)(Zn,{className:`size-4`}),title:`Usage & agent`,summary:(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,X.jsx)(Fa,{items:c})}),open:r,onToggle:i,children:(0,X.jsx)(To,{run:e,tokens:o,cost:a})})}function So({run:e,references:t,conflicts:n,hasReferences:r,onResume:i,open:a,onToggle:o}){let s=e.delegation?.role===`worker`?e.delegation.destroy:void 0;if(!(e.branch||e.worktreePath||r||Rn(e)||Ma(s)))return null;let c=n.length===1?`PR #${n[0]} conflicts`:`${n.length} PRs conflict`;return(0,X.jsx)(Q,{slot:`workspace`,icon:(0,X.jsx)(pe,{className:`size-4`}),title:`Workspace`,summary:!a&&t.length>0?(0,X.jsx)(`span`,{"data-slot":`run-activity-meta`,className:`contents`,children:(0,X.jsx)(Fa,{items:[...e.branch?[{id:`branch`,priority:0,content:(0,X.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch})}]:[],{id:`chips`,priority:1,content:(0,X.jsx)(Ia,{run:e,references:t})},...n.length>0?[{id:`conflicts`,priority:2,content:(0,X.jsx)(`span`,{className:`font-medium text-conflict`,children:c})}]:[]]})}):void 0,meta:n.length>0?(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-conflict`,children:[(0,X.jsx)(Se,{"aria-hidden":!0,className:`size-3.5`}),c]}):e.branch?(0,X.jsx)(`span`,{className:`font-mono text-[12px]`,children:e.branch}):void 0,open:a,onToggle:o,children:(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3 text-[13px] text-muted-foreground`,children:[s?(0,X.jsx)(Na,{state:s}):null,(0,X.jsx)(wt,{run:e}),e.branch?(0,X.jsx)(wo,{label:`Branch`,children:(0,X.jsx)(St,{branch:e.branch})}):null,e.worktreePath?(0,X.jsx)(wo,{label:`Worktree`,children:(0,X.jsx)(`span`,{className:`min-w-0 break-all font-mono text-[12px] text-foreground`,children:e.worktreePath})}):null,(0,X.jsx)(xt,{run:e,canResume:Gn(e).terminal,onResume:i})]})})}function Co(e,t){let n=(0,Y.useRef)(null),[r,i]=(0,Y.useState)(!1),a=(0,Y.useRef)(t);a.current=t;let o=(0,Y.useRef)({active:!1,override:!1});return(0,Y.useEffect)(()=>e?.(e=>{if(e.direction===`tail`){o.current={active:!1,override:!1},i(!1);return}if(e.direction===`down`){i(!1);return}if(o.current.active=!0,o.current.override||!a.current)return;let t=n.current?.closest(`[data-slot="thread-dock"]`);!t||getComputedStyle(t).position!==`sticky`||e.distanceFromBottom<=t.getBoundingClientRect().height||i(!0)}),[e]),{ref:n,open:t&&!r,chose:e=>{i(!1),e&&o.current.active&&(o.current.override=!0)}}}function wo({label:e,children:t}){return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,X.jsx)(`span`,{className:`w-20 shrink-0 font-medium text-foreground`,children:e}),t]})}function To({run:e,tokens:t,cost:n}){let{runner:r,account:i,model:a,effort:o,identity:s}=Ra(e);return(0,X.jsxs)(`dl`,{"data-slot":`agent-details`,className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-[13px]`,children:[t?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Tokens`}),(0,X.jsx)(`dd`,{className:`min-w-0 text-[12px]`,children:t})]}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Cost`}),(0,X.jsx)(`dd`,{className:`min-w-0 font-mono text-[12px] tabular-nums`,children:n})]}):null,(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Runner`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:r}),i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Account`}),(0,X.jsx)(`dd`,{"data-slot":`agent-badge-account`,className:`min-w-0 break-all font-mono text-[12px]`,children:i})]}):null,(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Model`}),(0,X.jsx)(`dd`,{className:`min-w-0 break-all font-mono text-[12px]`,children:a}),(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Effort`}),(0,X.jsx)(`dd`,{"data-slot":`agent-badge-effort`,className:`min-w-0 break-all font-mono text-[12px]`,children:o}),s?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`dt`,{className:`font-medium text-foreground`,children:`Identity`}),(0,X.jsx)(`dd`,{"data-slot":`agent-badge-identity`,className:`min-w-0 break-all font-mono text-[12px]`,children:s})]}):null]})}function Eo({run:e,available:t}){if(!e.automation)return null;let n=`inline-flex min-h-11 items-center rounded-sm text-[13px] font-medium md:min-h-8`;return(0,X.jsxs)(`p`,{className:`mt-2 text-[13px] text-muted-foreground`,children:[`Launched by`,` `,t?(0,X.jsx)(Yt,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:i(n,`text-foreground underline underline-offset-2`),children:`Automation`}):(0,X.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:n,children:`Automation`})]})}function Do({step:e,runStatus:t,decorative:n=!1}){let r=na(e.status,t),a=`size-4 shrink-0`;switch(r){case`active`:return(0,X.jsx)(Ot,{...n?{"aria-hidden":!0}:{role:`status`,"aria-label":`Step running`},"data-slot":`workflow-glyph`,"data-visual":r,className:i(a,`animate-spin stroke-pending motion-reduce:animate-none [html.light_&]:stroke-pending-strong`)});case`paused`:return(0,X.jsx)(Ce,{...n?{"aria-hidden":!0}:{role:`img`,"aria-label":`Step paused`},"data-slot":`workflow-glyph`,"data-visual":r,className:i(a,sa)});case`failed`:return(0,X.jsx)(W,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:i(a,`text-danger`)});case`pending`:return(0,X.jsx)(be,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:i(a,`text-soft-foreground`)});case`done`:return(0,X.jsx)(ge,{"aria-hidden":!0,"data-slot":`workflow-glyph`,"data-visual":r,className:i(a,`text-success`)})}}function Oo(e,t,n,r){let i=oo(e,t,n,r),a=ma(e),o=y(e.id,{enabled:a}),s=(0,Y.useMemo)(()=>{let t=e.delegation?.role===`root`?e.delegation.receipts.map(e=>e.workerId):[],n=o.data?.workers.map(e=>e.workerId)??[];return new Set([...t,...n]).size},[e.delegation,o.data?.workers]),c=la(e),l=c.length>0?c[da(e.currentStepId,c)]:void 0;return{statusText:i.statusText,glyph:i.glyph,allComplete:i.allComplete,failed:i.failed,activeStepName:l?.name,workerCount:s,agentCounts:i.agentCounts,cost:i.cost,nextCheckText:i.line.nextCheck?.text}}function ko(e,t){let n=[`Session activity: ${e.statusText}`];return e.nextCheckText&&n.push(`Next check ${e.nextCheckText}`),e.activeStepName&&n.push(`step ${e.activeStepName}`),e.workerCount>0&&n.push(`${e.workerCount} ${e.workerCount===1?`worker`:`workers`}`),e.agentCounts.total>0&&n.push(`${e.agentCounts.done}/${e.agentCounts.total} subagents`),e.cost&&n.push(`cost ${e.cost}`),t===`sidebar`&&n.push(`toggle activity sidebar`),n.join(`; `)}function Ao({props:e,align:t,sideOffset:n,contentClassName:r,children:i}){let{run:a,thread:o,currentThread:s,currentComplete:c,onOpenWorker:l,open:u,onOpenChange:d,keepOpen:f=!1,onOpenAutoFocus:p}=e,m=e=>{f&&e.preventDefault()};return(0,X.jsxs)(qt,{open:u,onOpenChange:e=>{!e&&f||d(e)},children:[(0,X.jsx)(Wt,{asChild:!0,children:i}),(0,X.jsx)(Kt,{align:t,sideOffset:n,"data-slot":`run-activity-popover`,className:r,onOpenAutoFocus:p,onInteractOutside:m,onPointerDownOutside:m,onFocusOutside:m,onEscapeKeyDown:m,children:(0,X.jsx)(io,{presentation:`panel`,run:a,thread:o,currentThread:s,currentComplete:c,onOpenWorker:l})})]})}function jo(e){let{run:t,thread:n,currentThread:r,currentComplete:a,mode:o,open:s,onOpenChange:c}=e,l=Oo(t,n,r,a),u=ko(l,o),d=l.allComplete?`text-semantic-green`:l.failed?`text-semantic-red`:`text-foreground`,f=(0,X.jsxs)(`button`,{type:`button`,"data-slot":`run-activity-trigger`,"data-activity-mode":o,"aria-expanded":s,"aria-label":u,onClick:o===`sidebar`?()=>c(!s):void 0,className:i(`hidden min-h-9 min-w-0 max-w-full shrink items-center gap-2 rounded-full border border-border bg-card px-3 py-1 text-[12px] font-medium text-foreground shadow-xs transition-colors md:inline-flex`,`pointer-hover:bg-muted/60 active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,s&&`border-accent-strong/60`),children:[(0,X.jsxs)(`span`,{"data-slot":`pill`,className:`inline-flex min-w-0 items-center gap-1.5`,children:[l.glyph,(0,X.jsx)(`span`,{"data-slot":`run-activity-status`,className:i(`truncate`,d),children:(0,X.jsx)(`span`,{"data-slot":`run-activity-status-label`,children:l.statusText})})]}),l.activeStepName?(0,X.jsxs)(`span`,{className:`hidden max-w-[140px] truncate text-muted-foreground @min-[1120px]:inline`,children:[`· `,l.activeStepName]}):null,l.workerCount>0?(0,X.jsxs)(`span`,{"data-slot":`activity-workers-badge`,className:`rounded-full bg-muted px-2 py-0.5 text-xs text-foreground tabular-nums`,children:[l.workerCount,` `,l.workerCount===1?`worker`:`workers`]}):null,l.agentCounts.total>0?(0,X.jsxs)(`span`,{"data-slot":`activity-subagents-badge`,className:`rounded-full bg-muted px-2 py-0.5 text-xs text-foreground tabular-nums`,children:[l.agentCounts.done,`/`,l.agentCounts.total,` agents`]}):null,l.cost?(0,X.jsx)(`span`,{"data-slot":`run-activity-cost`,className:`font-mono text-xs text-muted-foreground tabular-nums`,children:l.cost}):null,(0,X.jsx)(G,{"aria-hidden":`true`,className:i(`size-3.5 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,s&&`rotate-180`)})]});return o===`sidebar`?f:(0,X.jsx)(Ao,{props:e,align:`end`,sideOffset:6,contentClassName:`w-[380px] max-w-[calc(100vw-2rem)] max-h-[min(70dvh,540px)] overflow-y-auto overscroll-contain p-0`,children:f})}function Mo(e){let{run:t,thread:n,currentThread:r,currentComplete:a,open:o}=e,s=Oo(t,n,r,a),c=ko(s,`popover`),l=s.allComplete?`text-semantic-green`:s.failed?`text-semantic-red`:`text-muted-foreground`;return(0,X.jsx)(Ao,{props:e,align:`center`,sideOffset:4,contentClassName:`w-[calc(100vw-1.5rem)] max-w-[420px] max-h-[min(65dvh,460px)] overflow-y-auto overscroll-contain p-0`,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`run-activity-trigger-mobile`,"aria-expanded":o,"aria-label":c,className:i(`flex min-h-11 min-w-0 flex-1 items-center gap-2 border-t border-border bg-background px-1 text-start text-[13px] text-foreground md:hidden`,`active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`),children:[(0,X.jsx)(Oe,{"aria-hidden":`true`,className:`size-4 shrink-0 text-accent-text`}),(0,X.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Activity`}),(0,X.jsxs)(`span`,{"data-slot":`run-activity-status`,className:i(`inline-flex min-w-0 items-center gap-1.5 truncate`,l),children:[s.glyph,(0,X.jsx)(`span`,{"data-slot":`run-activity-status-label`,className:`truncate`,children:s.statusText})]}),s.workerCount>0?(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-foreground tabular-nums`,children:[s.workerCount,`w`]}):null,s.agentCounts.total>0?(0,X.jsxs)(`span`,{className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium text-foreground tabular-nums`,children:[s.agentCounts.done,`/`,s.agentCounts.total]}):null,s.cost?(0,X.jsx)(`span`,{className:`ms-auto shrink-0 font-mono text-xs text-muted-foreground tabular-nums`,children:s.cost}):null,(0,X.jsx)(G,{"aria-hidden":`true`,className:i(`size-4 shrink-0 text-soft-foreground motion-safe:transition-transform motion-reduce:transition-none`,!s.cost&&`ms-auto`,o&&`rotate-180`)})]})})}var No=2e3;function Po(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 Fo(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`turn-end`&&r.seq>t&&(t=r.seq),(r.type===`turn.started`||r.type===`session.started`||r.type===`user-message`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Io(e,t){let n=L(),r=(0,Y.useMemo)(()=>Po(t),[t]),i=(0,Y.useMemo)(()=>Fo(t),[t]),a=e?.id,o=e?.status;(0,Y.useEffect)(()=>{if(!(r!==0&&(o===`running`||o===`waiting`))&&!(i!==0&&o===`running`)||a===void 0)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:d.runs.detail(a)}),n.invalidateQueries({queryKey:d.runs.list()})},No);return()=>clearTimeout(e)},[r,i,a,o,n])}function Lo(e){let t=e.querySelector(`[data-slot="ask-origin"]`);return t&&(t.tabIndex=-1),t}function Ro({pendingAskId:e,askSeq:t,rows:n,history:r,jumpToRow:i}){let[a,o]=(0,Y.useState)(void 0),s=(0,Y.useCallback)(()=>o(e),[e]),c=r?.visibleEvents,l=t!==void 0&&(c?.some(({seq:e})=>e===t)??!1),u=r?.hasOlder??!1,d=r?.isFetchingOlder??!1,f=r?.olderError,p=r?.loadOlder;return(0,Y.useEffect)(()=>{if(a===void 0)return;if(a!==e){o(void 0);return}let r=Mi(n,a,`origin`);if(r){o(void 0),i(r.key,r.index,Lo);return}if(!(p!==void 0&&u&&f===void 0&&t!==void 0&&!l)){o(void 0);return}d||p().catch(()=>{})},[a,e,n,c,l,u,d,f,p,t,i]),{reveal:s,seeking:a!==void 0&&a===e}}var zo=12;function Bo({run:e}){let t=L(),n=h({mutationFn:()=>H(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:d.runs.detail(e.id)}),t.invalidateQueries({queryKey:d.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(!re(e))return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,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)(J,{tone:`neutral`,shape:`ring`}),e.autoResumeReason===`provider-error`?(0,X.jsxs)(`span`,{title:e.error,children:[`Provider error — this task retries automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i}),` `,`(attempt `,(e.autoResumeAttempts??0)+1,` of `,zo,`)`]}):(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)(se,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}function Vo({pinnedAskId:e,runStatus:t,askModeState:n,replyPending:r,composerPending:i}){let a=e!==void 0,o=!a&&t===`review`,s=n.askId===e?n.mode:`options`;return{hasPendingAsk:a,isReviewGate:o,askMode:s,decisionMode:a?`ask`:o?`review`:`composer`,unifiedReplyActive:a&&s===`reply`,composerHidden:o||a&&s===`options`,optionDeliveryPending:a&&r&&!i}}function Ho(e){let{run:t,thread:n,pinnedAsk:r,pendingQuestions:a,scroll:o,onJump:s,onShowOrigin:c,sessionOpen:l,attention:u,queued:d,continuable:f,continueAction:p,stopAction:m,finishAction:h,needsAnswer:g,sendMessage:_,reply:v,providerBlocked:y,providerReason:b,removedRunnerNotice:x}=e,S=Gn(t,_a(t)).cancel,[C,w]=(0,Y.useState)({askId:r?.id,mode:`options`}),[T,E]=(0,Y.useState)(!1),D=e=>w({askId:r?.id,mode:e}),{hasPendingAsk:O,isReviewGate:k,askMode:ee,decisionMode:A,unifiedReplyActive:j,composerHidden:M,optionDeliveryPending:N}=Vo({pinnedAskId:r?.id,runStatus:t.status,askModeState:C,replyPending:v.isPending,composerPending:T});return(0,X.jsxs)(`div`,{"data-slot":`thread-dock`,"data-pending-ask":g||void 0,"data-decision-mode":A,className:`relative z-10 shrink-0 bg-background py-1.5 md:pt-2.5 md:pb-4`,children:[o.pillVisible?(0,X.jsx)(`div`,{"data-slot":`thread-jump`,className:`pointer-events-none z-30 flex justify-center`,children:(0,X.jsx)(Si,{pendingQuestions:a,onJump:s})}):null,(0,X.jsxs)(`div`,{"data-slot":`thread-footer-content`,className:i(`mx-auto flex w-full min-w-0 max-w-[var(--measure)] flex-col px-[14px] md:px-16`,j?`gap-0`:`gap-1.5 md:gap-2`),children:[k?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Bo,{run:t}),(0,X.jsx)(Uo,{run:t,sessionOpen:l,attention:u,queued:d,continuable:f,startsNewConversation:p.startsNewConversation,removedRunnerNotice:x})]}),r===void 0?k?(0,X.jsx)(ct,{run:t,showDiff:!1}):null:(0,X.jsx)(lt,{ask:{...r,placement:`pinned`},run:t,surface:`decision-zone`,mode:ee,onModeChange:D,hideReplyBody:!0,delivery:v,onShowOrigin:c,onStop:S?m.stop:void 0,stopping:m.stopping,onFinish:Wn(t)?()=>h.mutateAsync():void 0,finishing:h.isPending},r.id),(0,X.jsx)(`div`,{"data-slot":`thread-composer-slot`,hidden:M,className:i(`min-w-0 w-full`,M&&`hidden`,j&&`rounded-b-xl border border-t-0 border-accent-strong/30 bg-accent-strong/[0.04] p-2.5 [html:not(.light)_&]:bg-card`),children:(0,X.jsx)(Ko,{run:t,thread:n,canStop:S,hasPendingAsk:O,composerHidden:M,optionDeliveryPending:N,onComposerPendingChange:E,stopAction:m,finishAction:h,attention:u,needsAnswer:g,continuable:f,continueAction:p,queued:d,sendMessage:_,reply:v,providerBlocked:y,providerReason:b,sessionOpen:l})})]})]})}function Uo({run:e,sessionOpen:t,attention:n,queued:r,continuable:i,startsNewConversation:a,removedRunnerNotice:o}){if(e.status===`waiting`&&t)return(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)(J,{tone:n.tone,shape:n.shape,pulse:n.pulse}),n.bucket===`permission`?`Choose an approval option above to continue`:n.bucket===`waiting`?`The agent is paused, waiting for your reply`:`${hn(e,n).label} — you can send a message to resume`]});if(e.status===`running`){let t=Tt(e,{}),n=la(e),r=n.length>0?n[da(e.currentStepId,n)]:void 0;return(0,X.jsxs)(`div`,{"data-slot":`running-hint`,className:`flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(J,{tone:t.attention.tone,shape:t.attention.shape,pulse:t.attention.pulse}),(0,X.jsxs)(`span`,{className:`truncate`,children:[t.label,r?` · ${r.name}`:``]})]})}return r?(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)(J,{tone:`neutral`,shape:`ring`}),`Messages you add now are folded into the prompt before the run starts.`]}):o===void 0?i&&a?(0,X.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:`Starts a new agent conversation.`}):null:(0,X.jsx)(`p`,{className:`px-1 text-xs text-muted-foreground`,role:`status`,children:o})}function Wo(e,t,n){if(t)return{skillRunner:n.skillRunner,skillAccount:n.skillAccount};let r=e.steps.find(t=>t.id===e.currentStepId),i=e.workflowDef?.steps.find(t=>t.id===e.currentStepId);return{skillRunner:r?.backend??i?.runner??e.runner,skillAccount:r?.profileId??i?.agentProfile??e.agentProfile}}function Go(e){let{run:t,hasPendingAsk:n,optionDeliveryPending:r,continuable:i,continueAction:a,queued:o,sendMessage:s,reply:c,providerBlocked:l,providerReason:u,sessionOpen:d}=e,f=async(e,t)=>{let n=await c.send(e,t);if(n!==void 0)throw Error(n)};return n?{onSubmit:f,pendingLabel:c.mode===`resume`?`Continuing…`:`Sending…`,disabled:l||c.blockedBy!==void 0||r,disabledReason:l?u:r?`Sending your answer…`:c.reason,placeholder:`Reply — / for skills, @ for files…`}:{onSubmit:i?(e,t)=>a.continueWith(e,t??[]):o?(e,t)=>s.mutateAsync({text:e,images:t}):f,pendingLabel:i?`Continuing…`:`Sending…`,disabled:l||!d&&!o&&!i,disabledReason:l?u:`Session closed — no session to resume.`,placeholder:Jo(t,o,i)}}function Ko(e){let{run:t,thread:n,canStop:r,hasPendingAsk:i,composerHidden:a,onComposerPendingChange:o,stopAction:s,finishAction:c,attention:l,needsAnswer:u,continuable:d,continueAction:f,providerBlocked:p}=e,m=Go(e),h=!i&&d&&!u;return(0,X.jsx)(Dn,{...Wo(t,d,f),onPendingChange:o,onStop:r?s.stop:void 0,onFinish:Wn(t)?()=>c.mutateAsync().catch(()=>void 0):void 0,finishing:c.isPending,stopOnEmpty:!i&&qo(t,l,u),stopping:s.stopping,retainDraftUntilSuccess:!0,compactFeedback:!0,pendingLabel:m.pendingLabel,failureHint:`Your draft is kept. Check the task status and connection, then retry.`,sessionControls:!i&&d?f.pills:void 0,onSubmit:m.onSubmit,disabled:m.disabled,disabledReason:m.disabledReason,footerEnd:p&&!f.providerPending?(0,X.jsx)(Yt,{to:`/settings/agent-defaults#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):void 0,allowEmptySubmit:h,emptySubmitVariant:t.status===`review`?`outline`:`primary`,emptySubmitLabel:h?`Continue`:void 0,placeholder:m.placeholder,autocompleteSkills:!0,quickReplies:!a,getMentionCandidates:()=>Rt(n)})}function qo(e,t,n){return e.status===`queued`||e.status===`running`||e.status===`waiting`&&t.bucket===`none`&&!n}function Jo(e,t,n){return t?`Add to the prompt — sent when the run starts…`:n?`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…`}function Yo(){let{id:e}=oe(),t=p(e),n=Ln(e),r=t.data?.status,i=(0,Y.useMemo)(()=>It(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,Y.useMemo)(()=>It(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,Y.useRef)(void 0),s=(0,Y.useCallback)(e=>{o.current=e},[]),{mutate:c}=u();if((0,Y.useEffect)(()=>{t.data&&o.current!==t.data.id&&nn(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Io(t.data,n.visibleEvents),t.isPending)return(0,X.jsx)(kn,{});if(t.isError){let e=t.error instanceof A&&t.error.status===404;return(0,X.jsx)(fn,{route:`task-thread`,density:`empty`,flushPadding:!0,children:(0,X.jsx)(mn,{icon:e?(0,X.jsx)(jt,{}):(0,X.jsx)(Je,{}),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)(K,{asChild:!0,variant:`outline`,children:(0,X.jsx)(Yt,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,X.jsx)(kn,{}):(0,X.jsx)(Zo,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}var Xo=e=>({titles:Object.fromEntries(e.map(e=>[e.id,q(e)])),backends:Object.fromEntries(e.map(e=>[e.id,e.currentStepBackend??e.runner]))});function Zo({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){Jt();let a=R({queryKey:d.runs.list(),queryFn:({signal:e})=>ee(_(),{signal:e}),select:Xo}),{pendingAsk:o,transcriptAsk:s,pendingAskId:c,historyLoading:l}=ns(r,n),u=k(e),f=Ft(e.status,e.error,t),p=Hn(e),m=!p&&e.status!==`queued`,h=e.status===`queued`,g=rr(e),v=qi(e),y=dt(e.id),x=s||te(e),{hasContinuation:S,continuable:C}=rs(p,h,g),{openAgentId:w,setOpenAgentId:E,activityMode:D,activityOpen:O,setActivityOpen:A,showActivitySidebar:j,closeActivityPopover:M}=es(e.id),N=(0,Y.useRef)(void 0),P=(0,Y.useCallback)(e=>{let t=[...document.querySelectorAll(`[data-agent-id]`)].find(t=>t.dataset.agentId===e);if(t){t.focus({preventScroll:!0});return}N.current=e,A(!0)},[A]),F=(0,Y.useCallback)(e=>{let t=N.current;if(!t)return;N.current=void 0;let n=[...document.querySelectorAll(`[data-agent-id]`)].find(e=>e.dataset.agentId===t);n&&(e.preventDefault(),n.focus({preventScroll:!0}))},[]),{openAgent:L,openAgentChildren:z}=Qo(w,n,t,m),B=b(e.id),V=jn(e),{providerBlocked:ne,providerReason:H}=is(p,Mn(e),S,g),re=ts(e,h),U=l?void 0:c??null,ie=(0,Y.useMemo)(()=>Oi(n,U),[n,U]),oe=ie?.questions.length??0,se=(0,Y.useMemo)(()=>ki(e,t,n,U,{pinPendingAskInTranscript:!1}),[e,t,n,U]),ce=(0,Y.useMemo)(()=>Fi(se,e.id),[se,e.id]),{taskTitles:ue,recipientBackends:de}=$o(e,a.data),fe=(0,Y.useCallback)(t=>(0,X.jsx)(Ar,{permission:t,runId:e.id,sessionOpen:p}),[e.id,p]),pe=C&&e.removedRunner!==void 0?I(e.removedRunner):void 0,me=le(e,T()),{search:he}=ae(),ge=Be(he,ce.length),W=vi(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:ce.map(({key:e})=>e)}),_e=Ro({pendingAskId:c,askSeq:r?o?.seq:void 0,rows:ce,history:r,jumpToRow:W.jumpToRow}),ve=(0,Y.useRef)(c);l||(ve.current=c);let ye=pi(),G=(0,Y.useRef)({reveal:_e.reveal});G.current={reveal:_e.reveal};let be=(0,Y.useCallback)(()=>{li(ye.current??document.body)?.focus({preventScroll:!0})},[ye]),xe=(0,Y.useCallback)(t=>t.placement===`origin`?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[t.context?(0,X.jsx)(ft,{text:t.context}):null,t.resolved?null:(0,X.jsx)(fi,{onGoToQuestion:be})]}):(0,X.jsx)(lt,{ask:t,run:e,onShowOrigin:()=>G.current.reveal()}),[e,be]);Gt(W.restickIfStuck);let Se=r?.currentComplete??!0,Ce={run:e,thread:t,currentThread:n,currentComplete:Se,onOpenWorker:E,mode:D,open:O,onOpenChange:A,keepOpen:w!==void 0,onOpenAutoFocus:F};return(0,X.jsxs)(fn,{route:`task-thread`,density:t.turns.length===0?`empty`:`full`,fillHeight:!0,flushPadding:!0,rootRef:ye,rootProps:{"data-run-id":e.id},className:`overflow-clip`,children:[(0,X.jsx)(Et,{run:e,onMarkedUnread:()=>i?.(e.id),desktopActivitySlot:(0,X.jsx)(jo,{...Ce}),mobileActivitySlot:(0,X.jsx)(Mo,{...Ce})}),(0,X.jsxs)(`div`,{"data-slot":`thread-workspace`,children:[(0,X.jsxs)(`div`,{"data-slot":`thread-main`,children:[(0,X.jsx)(`div`,{"data-slot":`thread-transcript`,role:`region`,"aria-label":`Session transcript`,tabIndex:0,children:(0,X.jsx)(as,{run:e,thread:t,history:r,footer:f,issueUrl:me,sections:se,renderAsk:xe,renderPermission:fe,messageActions:re,scroll:W,mode:ge,taskTitles:ue,recipientBackends:de})}),(0,X.jsx)(Ho,{run:e,thread:t,pinnedAsk:ie,pendingQuestions:oe,scroll:W,onJump:()=>{let e=oe>0?ie?.id:void 0;W.jumpToLatest(e===void 0?void 0:ui(e,()=>ve.current===e))},onShowOrigin:()=>G.current.reveal(),sessionOpen:p,attention:u,queued:h,continuable:C,continueAction:g,stopAction:v,finishAction:y,needsAnswer:x,sendMessage:B,reply:V,providerBlocked:ne,providerReason:H,removedRunnerNotice:pe})]}),j?(0,X.jsx)(`aside`,{"data-slot":`thread-activity-sidebar`,"aria-label":`Session activity`,children:(0,X.jsx)(io,{presentation:`panel`,run:e,thread:t,currentThread:n,currentComplete:Se,onOpenWorker:E})}):null]}),(0,X.jsx)(pt,{status:e.status}),(0,X.jsx)(Wi,{runId:e.id,renderAsk:xe,renderPermission:fe,agent:L,entries:z,taskTitles:ue,recipientBackends:de,onBeforeOpenReport:M,onRestoreAgentFocus:P,onClose:()=>E(void 0)})]})}function Qo(e,t,n,r){return{openAgent:(0,Y.useMemo)(()=>e===void 0?void 0:vr(t.turns,e,r,n.turns),[t.turns,e,r,n.turns]),openAgentChildren:(0,Y.useMemo)(()=>e===void 0?[]:xr(n.turns,t.turns,e),[n.turns,t.turns,e])}}function $o(e,t){let n=e.delegation?.role===`root`||e.delegation?.role===`worker`,r=y(e.id,{enabled:n});return{taskTitles:(0,Y.useMemo)(()=>({...Fr(e,void 0,r.data?.titles),...t?.titles,[e.id]:q(e)}),[e,t,r.data]),recipientBackends:(0,Y.useMemo)(()=>({...t?.backends,...Pr(e,void 0)}),[e,t])}}function es(e){let[t,n]=(0,Y.useState)(void 0),[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(!0),[s,c]=(0,Y.useState)(e);s!==e&&(c(e),n(void 0),i(!1));let l=zn(),u=Pn()||l?.open===!0,d=Kn(`(min-width: 1600px)`,!1)&&!u?`sidebar`:`popover`;return{openAgentId:t,setOpenAgentId:n,activityMode:d,activityOpen:d===`sidebar`?a:r,setActivityOpen:d===`sidebar`?o:i,showActivitySidebar:d===`sidebar`&&a,closeActivityPopover:(0,Y.useCallback)(()=>i(!1),[])}}function ts(e,t){let{mutateAsync:n}=o(e.id),{mutateAsync:r}=D(e.id),{mutateAsync:i}=s(e.id);return(0,Y.useMemo)(()=>{if(!t)return;let a={task:{onEdit:async e=>{await n({task:e})},editLabel:`Edit the prompt`}};for(let t of e.queuedMessages??[])a[`queued:${t.id}`]={onEdit:e=>r({msgId:t.id,message:{text:e}}).then(()=>void 0),onRemove:()=>i(t.id).then(()=>void 0)};return a},[t,e.queuedMessages,n,r,i])}function ns(e,t){let n=e?kt(e.currentEvents):void 0;return{pendingAsk:n,transcriptAsk:e?n!==void 0:t.turns.some(e=>e.items.some(e=>e.kind===`ask`&&!e.resolved)),pendingAskId:e?n?.requestId:t.turns.flatMap(e=>e.items).reverse().find(e=>e.kind===`ask`&&!e.resolved)?.id,historyLoading:e!==void 0&&(e.isPending||e.contextPending)}}function rs(e,t,n){let r=!e&&!t&&n.available;return{hasContinuation:r,continuable:r&&n.canContinue}}function is(e,t,n,r){let i=e&&!t.usable,a=n&&!r.canContinue;return{providerBlocked:i||a,providerReason:i?t.reason:r.reason}}function as({run:e,thread:t,history:n,footer:r,issueUrl:o,sections:s,renderAsk:c,renderPermission:l,messageActions:u,scroll:d,mode:f,taskTitles:p,recipientBackends:m}){return(0,X.jsxs)(`div`,{"data-slot":`session-conversation`,className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-2.5 px-[18px] py-3 [padding-block-end:12px] md:gap-3.5 md:px-16 md:py-5 md:[padding-block-end:24px]`,children:[n?(0,X.jsx)(os,{hasOlder:n.hasOlder,loading:n.isFetchingOlder,error:n.olderError,fallback:n.fallback,retainedPages:n.retainedPages,onLoad:d.loadOlder}):null,(0,X.jsx)(Ii,{runId:e.id,viewId:`main`,sections:s,mode:`document`,renderAsk:c,renderPermission:l,messageActions:u,scrollControls:d,renderMode:f,taskTitles:p,recipientBackends:m}),t.turns.length===0?e.status===`queued`?(0,X.jsx)(ss,{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)(Ye,{}):null,r&&r.state===`closed`?(0,X.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":r.state,className:i(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,r.tone===`danger`?`text-semantic-red`:`text-soft-foreground`),children:[r.label,a(ue(e))?(0,X.jsx)(`a`,{"data-slot":`pr-link`,href:ue(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,a(o)?(0,X.jsx)(`a`,{"data-slot":`issue-link`,href:o,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)(Xe,{runId:e.id}):null]})}function os({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-xs 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 ss({run:e}){let t=An(S().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)(J,{tone:`neutral`,shape:`ring`}),(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{Yo as TaskThreadRoute};
|