@wjarka/cezarion 0.14.9-dev.991 → 0.14.9-dev.996
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/automations/scheduler.d.ts +6 -0
- package/dist/automations/scheduler.js +45 -17
- package/dist/automations/scheduler.js.map +1 -1
- package/dist/automations/store.d.ts +12 -4
- package/dist/automations/store.js +199 -22
- package/dist/automations/store.js.map +1 -1
- package/dist/automations/types.d.ts +2 -0
- package/dist/automations/types.js +1 -0
- package/dist/automations/types.js.map +1 -1
- package/dist/contract/automations.d.ts +6 -0
- package/dist/contract/index.js +2 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/server/server.d.ts +10 -10
- package/dist/server/server.js +2 -2
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/platforms/ubuntu-vps.d.ts +5 -1
- package/dist/server-install/platforms/ubuntu-vps.js +160 -18
- package/dist/server-install/platforms/ubuntu-vps.js.map +1 -1
- package/dist/server-install/steps.d.ts +4 -2
- package/dist/server-install/steps.js +5 -4
- package/dist/server-install/steps.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-accounts-Bh1l3ZSb.js → agent-accounts-xNBY6ogh.js} +1 -1
- package/web/dist/assets/{centered-state-kOb8j_BL.js → centered-state-B5dpq65a.js} +1 -1
- package/web/dist/assets/{collapsible-KSKVv9J9.js → collapsible-Be7f34CZ.js} +1 -1
- package/web/dist/assets/{commit-list-ihwhOiFP.js → commit-list-CrVF6aJO.js} +1 -1
- package/web/dist/assets/{compare-variants-CmAaF9cg.js → compare-variants-BhsIhofd.js} +1 -1
- package/web/dist/assets/{diff-Jd8igxRb2.js → diff-DkLLHPBL2.js} +2 -2
- package/web/dist/assets/{diff-controls-D_kgpdoa.js → diff-controls-BBH2il5I.js} +1 -1
- package/web/dist/assets/{diff-stat-C3Id3W_C.js → diff-stat-CRv7eHDb.js} +1 -1
- package/web/dist/assets/{diff-view-BK1wJX0D.js → diff-view-C_c7WhMC.js} +1 -1
- package/web/dist/assets/{dropdown-menu-78Ug-7x2.js → dropdown-menu-CHjcbAg2.js} +1 -1
- package/web/dist/assets/{git-toolbar-DFC6bS8a.js → git-toolbar-2NRZ0XRF.js} +1 -1
- package/web/dist/assets/{github-CY_FpDVo.js → github-MN8sYsUk.js} +1 -1
- package/web/dist/assets/{image-preview-BEOsw8qX.js → image-preview-CVNzfVE6.js} +1 -1
- package/web/dist/assets/{index-GcasY1jB.js → index-B3mt1xBA.js} +3 -3
- package/web/dist/assets/{markdown-DlvW2wEx.js → markdown-DMJKzyRf.js} +1 -1
- package/web/dist/assets/{pill-0JHCf1v8.js → pill-DzKHyuy3.js} +1 -1
- package/web/dist/assets/{project-router-CS_oeLqi.js → project-router-JF2eAjIT.js} +1 -1
- package/web/dist/assets/{prompt-templates-BgXzCOlY.js → prompt-templates-xPSqYS6C.js} +1 -1
- package/web/dist/assets/{repo-git-0_ca69eW.js → repo-git-Cmq5MEXj.js} +1 -1
- package/web/dist/assets/{run-diff-xym-7QHm.js → run-diff-CrcC1Yup.js} +1 -1
- package/web/dist/assets/{run-header-BBQOWhJ7.js → run-header-CJzRxOq_.js} +1 -1
- package/web/dist/assets/{skills-BqWbc75M.js → skills-Dhc5aF4q.js} +1 -1
- package/web/dist/assets/{tab-link-D6eAdJez.js → tab-link-h-NqfUyU.js} +1 -1
- package/web/dist/assets/{task-changes-qYtGOIA6.js → task-changes-BV15m5L7.js} +1 -1
- package/web/dist/assets/{task-commits-CW10ZH8j.js → task-commits-DFt3HGFV.js} +1 -1
- package/web/dist/assets/{task-files-C-IhNjVf.js → task-files-Bdx9Y_Ds.js} +1 -1
- package/web/dist/assets/{task-thread-DV71Q0au.js → task-thread-BU9PHrPG.js} +1 -1
- package/web/dist/assets/{textarea-D2Gx4GDI.js → textarea-bn5bn1st.js} +1 -1
- package/web/dist/assets/{thread-loading-hVlcCLdm.js → thread-loading-C06KXeIB.js} +1 -1
- package/web/dist/assets/{token-metrics-BQvw6Yoj.js → token-metrics-D6kVakap.js} +1 -1
- package/web/dist/assets/{utils-BW1-Ibnd.js → utils-Cv6VpwoW.js} +1 -1
- package/web/dist/assets/{workflows-DjoTJlOV.js → workflows-DIsCUQX9.js} +1 -1
- package/web/dist/assets/{zoomable-image-DVvXID3t.js → zoomable-image-DUpvct4v.js} +1 -1
- package/web/dist/index.html +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ba as r,Cr as i,Dr as a,Ei as o,Ga as s,Gt as c,It as l,Lt as u,Q as d,Rt as f,Tr as p,U as m,Ut as h,Vn as g,Wt as _,Yt as v,_r as y,bi as b,ca as x,d as S,fi as C,gr as w,in as T,jt as E,kn as D,li as O,nn as k,oa as A,ot as j,t as M,ya as N,za as P}from"./centered-state-kOb8j_BL.js";import{t as F}from"./utils-BW1-Ibnd.js";import{a as ee,i as te,n as ne,o as re,r as ie,s as ae}from"./textarea-D2Gx4GDI.js";import{T as oe}from"./prompt-templates-BgXzCOlY.js";import{c as I,t as L}from"./project-router-CS_oeLqi.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{c as U,h as W,o as G,t as K}from"./index-GcasY1jB.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),Y=`https://github.com/open-mercato/skills`;function ce(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return ce(e)??[...t]}function le({projectId:e}){let t=s(),n=p(),r=D(),[i,o]=(0,q.useState)(``),u=y(e,!!e),d=r.data??[],m=(0,q.useMemo)(()=>d.map(e=>e.name),[d]),h=(0,q.useRef)([]);h.current=m;let g=(0,q.useMemo)(()=>new Set(X(n.data,m)),[n.data,m]),b=(0,q.useRef)(Promise.resolve()),x=(0,q.useRef)(0),S=(0,q.useCallback)(e=>{let n=a.uiState,r=t.getQueryData(n),i=e(X(r,h.current));t.setQueryData(n,{...r,importedSkills:i});let o=++x.current;b.current=b.current.then(async()=>{try{let e=await A({importedSkills:i});o===x.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:T.skills}))}catch(e){N(e instanceof Error?e.message:String(e),{tone:`danger`}),o===x.current&&t.invalidateQueries({queryKey:n})}})},[t]),C=(0,q.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),w=m.length>0&&m.every(e=>g.has(e)),O=(0,q.useCallback)(()=>{if(w){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[w,S]);if(r.isError)return(0,J.jsx)(M,{icon:(0,J.jsx)(v,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:r.error.message});let k=z(d,i);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[12px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:Y,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:u.data,loadError:u.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:i,onChange:e=>o(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:m.length===0||n.isPending,onClick:O,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[w?(0,J.jsx)(E,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),w?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:r.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):k.length>0?k.map(e=>{let t=g.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:F(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>C(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(c,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:d.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let i=s(),c=I(),l=(0,q.useRef)(0),[f,p]=(0,q.useState)(!1),m=r({mutationFn:()=>o({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{p(!1),c(oe(e))},onError:e=>N(e.message,{tone:`danger`})}),h=(t,n)=>{n.seq===l.current&&(i.setQueryData(a.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:T.skills}),N(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),p(!0)))},g=(e,t)=>{t.seq===l.current&&N(e.message,{tone:`danger`})},_=r({mutationFn:t=>b(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>g(e,t)}),v=r({mutationFn:t=>C(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>g(e,t)}),y=e=>{let n=++l.current;e===`apply`?v.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):_.mutate({action:e,seq:n})},x=t?.scopes.some(e=>e.skills.length>0)??!1,w=t?.status===`error`,E=x&&(t?.available||w),D=v.isPending||t?.status===`updating`,O=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],k=t?.scopes.filter(e=>e.updatedAt&&!O.includes(e))??[],A=`Checking installed Open Mercato skills…`;return n?A=`Update status is unavailable right now.`:t?.status===`available`?A=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?A=`Updating installed Open Mercato skills…`:t?.status===`current`?A=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?A=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(A=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:A}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,O.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,O.map(e=>Z(e.scope)).join(`, `),k.length?`; updated: ${k.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),E?(0,J.jsxs)(S,{"data-action":`skills-update-apply`,size:`sm`,disabled:D,onClick:()=>y(`apply`),children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:F(`size-3.5`,D&&`motion-safe:animate-spin`)}),D?`Updating…`:w?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:_.isPending,onClick:()=>y(`check`),children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:_.isPending,onClick:()=>y(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(ne,{open:f,onOpenChange:e=>m.isPending?void 0:p(e),children:(0,J.jsxs)(ie,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(re,{children:[(0,J.jsx)(ae,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(te,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(ee,{children:[(0,J.jsx)(S,{type:`button`,variant:`outline`,disabled:m.isPending,onClick:()=>p(!1),children:`No`}),(0,J.jsx)(S,{type:`button`,disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=w(),t=i(),n=D(),[a]=P(),[o,c]=(0,q.useState)(``),l=s(),d=g(),p=O().projectId??d.data?.bootProject??``,_=r({mutationFn:()=>x(),onSuccess:e=>{l.setQueryData(T.skills,e),N(`Team skills refreshed.`)},onError:e=>N(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(M,{icon:(0,J.jsx)(v,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let y=V(e.data??[]),b=(n.data?.length??0)>0,S=a.get(`skill`),C=S===Q||S===$||S!==null&&y.some(e=>e.name===S)?S:y[0]?.name??(b?$:Q),E=y.find(e=>e.name===C)??null,A=B(y,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":C===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(j,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(L,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":C===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(k,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:F(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,S===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>c(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:_.isPending,onClick:()=>_.mutate(),className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:F(`size-3`,_.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,S===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):A.length>0?A.map(e=>(0,J.jsx)(pe,{skill:e,active:C===e.name,highlighted:C===$&&e===y[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:y.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,S===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(L,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),C===$?(0,J.jsx)(le,{projectId:p}):C===Q?(0,J.jsx)(K,{skills:y}):E?(0,J.jsx)(G,{skill:E,usedBy:H(t.data?.workflows??[],E.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(M,{icon:(0,J.jsx)(h,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(L,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:F(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:F(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ba as r,Cr as i,Dr as a,Ei as o,Ga as s,Gt as c,It as l,Lt as u,Q as d,Rt as f,Tr as p,U as m,Ut as h,Vn as g,Wt as _,Yt as v,_r as y,bi as b,ca as x,d as S,fi as C,gr as w,in as T,jt as E,kn as D,li as O,nn as k,oa as A,ot as j,t as M,ya as N,za as P}from"./centered-state-B5dpq65a.js";import{t as F}from"./utils-Cv6VpwoW.js";import{a as ee,i as te,n as ne,o as re,r as ie,s as ae}from"./textarea-bn5bn1st.js";import{T as oe}from"./prompt-templates-xPSqYS6C.js";import{c as I,t as L}from"./project-router-JF2eAjIT.js";import{i as R,l as z,n as B,o as V,p as H}from"./skills-DFBiAuJG.js";import{c as U,h as W,o as G,t as K}from"./index-B3mt1xBA.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),Y=`https://github.com/open-mercato/skills`;function ce(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function X(e,t){return ce(e)??[...t]}function le({projectId:e}){let t=s(),n=p(),r=D(),[i,o]=(0,q.useState)(``),u=y(e,!!e),d=r.data??[],m=(0,q.useMemo)(()=>d.map(e=>e.name),[d]),h=(0,q.useRef)([]);h.current=m;let g=(0,q.useMemo)(()=>new Set(X(n.data,m)),[n.data,m]),b=(0,q.useRef)(Promise.resolve()),x=(0,q.useRef)(0),S=(0,q.useCallback)(e=>{let n=a.uiState,r=t.getQueryData(n),i=e(X(r,h.current));t.setQueryData(n,{...r,importedSkills:i});let o=++x.current;b.current=b.current.then(async()=>{try{let e=await A({importedSkills:i});o===x.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:T.skills}))}catch(e){N(e instanceof Error?e.message:String(e),{tone:`danger`}),o===x.current&&t.invalidateQueries({queryKey:n})}})},[t]),C=(0,q.useCallback)(e=>{S(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S]),w=m.length>0&&m.every(e=>g.has(e)),O=(0,q.useCallback)(()=>{if(w){let e=new Set(h.current);S(t=>t.filter(t=>!e.has(t)))}else S(e=>[...new Set([...e,...h.current])])},[w,S]);if(r.isError)return(0,J.jsx)(M,{icon:(0,J.jsx)(v,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:r.error.message});let k=z(d,i);return(0,J.jsxs)(`div`,{"data-slot":`skills-import-panel`,className:`w-full min-w-0 [&_button]:min-h-11`,children:[(0,J.jsx)(`p`,{className:`mb-4 text-[12px] font-medium tracking-wide text-link-foreground`,children:`OPEN-MERCATO / SKILLS`}),(0,J.jsx)(`h2`,{className:`text-2xl font-medium`,children:`Manage skills`}),(0,J.jsxs)(`p`,{className:`mt-2 text-[13px] leading-relaxed text-muted-foreground`,children:[`Choose which `,(0,J.jsx)(`a`,{href:Y,target:`_blank`,rel:`noreferrer`,children:`open-mercato`}),` skills appear in your catalog and composer picker. All are enabled by default; uncheck any you don’t want.`]}),(0,J.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Applies across projects · saved automatically`}),(0,J.jsx)(ue,{projectId:e,state:u.data,loadError:u.error}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Checkboxes control visibility. Updating refreshes installed skill files; it does not change your selection.`}),(0,J.jsxs)(`div`,{className:`sw-import-controls mt-4 flex flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`div`,{className:`sw-search relative min-w-0 flex-1`,children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`import-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:i,onChange:e=>o(e.target.value),className:`h-11 min-w-0 pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`import-all`,disabled:m.length===0||n.isPending,onClick:O,className:`h-11 shrink-0 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[w?(0,J.jsx)(E,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),w?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:r.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):k.length>0?k.map(e=>{let t=g.has(e.name);return(0,J.jsxs)(`label`,{"data-slot":`import-row`,"data-skill":e.name,"data-imported":t?`true`:void 0,className:F(`flex min-h-16 cursor-pointer items-start gap-3 rounded-lg border border-border p-4 transition-colors hover:bg-muted`,t&&`bg-background`),children:[(0,J.jsxs)(`span`,{className:`relative size-5 shrink-0`,children:[(0,J.jsx)(`input`,{type:`checkbox`,"data-slot":`import-toggle`,checked:t,onChange:()=>C(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(_,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`}):(0,J.jsx)(c,{"aria-hidden":`true`,className:`pointer-events-none size-5 text-link-foreground peer-focus-visible:outline-2 peer-focus-visible:outline-ring`})]}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:`min-w-0 break-words text-[13px] font-medium text-foreground`,children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`mt-2 block text-xs leading-relaxed text-soft-foreground`,children:e.description}):null]})]},e.name)}):(0,J.jsx)(`p`,{className:`px-1 py-2 text-xs text-soft-foreground`,children:d.length>0?`(no skills match)`:`(no skills available — the repo may still be cloning)`})})]})}function Z(e){return e===`project`?`Project installation`:`Global installation`}function ue({projectId:e,state:t,loadError:n}){let i=s(),c=I(),l=(0,q.useRef)(0),[f,p]=(0,q.useState)(!1),m=r({mutationFn:()=>o({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{p(!1),c(oe(e))},onError:e=>N(e.message,{tone:`danger`})}),h=(t,n)=>{n.seq===l.current&&(i.setQueryData(a.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:T.skills}),N(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),p(!0)))},g=(e,t)=>{t.seq===l.current&&N(e.message,{tone:`danger`})},_=r({mutationFn:t=>b(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>g(e,t)}),v=r({mutationFn:t=>C(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>h(e,t),onError:(e,t)=>g(e,t)}),y=e=>{let n=++l.current;e===`apply`?v.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):_.mutate({action:e,seq:n})},x=t?.scopes.some(e=>e.skills.length>0)??!1,w=t?.status===`error`,E=x&&(t?.available||w),D=v.isPending||t?.status===`updating`,O=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],k=t?.scopes.filter(e=>e.updatedAt&&!O.includes(e))??[],A=`Checking installed Open Mercato skills…`;return n?A=`Update status is unavailable right now.`:t?.status===`available`?A=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?A=`Updating installed Open Mercato skills…`:t?.status===`current`?A=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?A=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(A=`The update did not finish for every installation.`),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`mt-4 rounded-lg border border-border bg-background p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:A}),(0,J.jsx)(`p`,{className:`mt-4 text-xs text-soft-foreground`,children:`Project and global installations are checked separately.`}),t?.checkedAt?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,t?.scopes.some(e=>e.skills.length>0)?(0,J.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:t.scopes.filter(e=>e.skills.length>0).map(e=>(0,J.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,O.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,O.map(e=>Z(e.scope)).join(`, `),k.length?`; updated: ${k.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),E?(0,J.jsxs)(S,{"data-action":`skills-update-apply`,size:`sm`,disabled:D,onClick:()=>y(`apply`),children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:F(`size-3.5`,D&&`motion-safe:animate-spin`)}),D?`Updating…`:w?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:_.isPending,onClick:()=>y(`check`),children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(S,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:_.isPending,onClick:()=>y(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,J.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,J.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,J.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,J.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-accent-strong/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,J.jsx)(d,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-link-foreground`}),(0,J.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,J.jsx)(ne,{open:f,onOpenChange:e=>m.isPending?void 0:p(e),children:(0,J.jsxs)(ie,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,J.jsxs)(re,{children:[(0,J.jsx)(ae,{children:`Apply the upgrade notes now?`}),(0,J.jsxs)(te,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,J.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,J.jsxs)(ee,{children:[(0,J.jsx)(S,{type:`button`,variant:`outline`,disabled:m.isPending,onClick:()=>p(!1),children:`No`}),(0,J.jsx)(S,{type:`button`,disabled:m.isPending,onClick:()=>m.mutate(),children:m.isPending?`Starting…`:`Yes, start session`})]})]})})]})}var Q=`__bm`,$=`__import`;function de(){return(0,J.jsx)(`div`,{"data-route":`skills`,className:`mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,J.jsx)(fe,{})})}function fe(){let e=w(),t=i(),n=D(),[a]=P(),[o,c]=(0,q.useState)(``),l=s(),d=g(),p=O().projectId??d.data?.bootProject??``,_=r({mutationFn:()=>x(),onSuccess:e=>{l.setQueryData(T.skills,e),N(`Team skills refreshed.`)},onError:e=>N(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(M,{icon:(0,J.jsx)(v,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let y=V(e.data??[]),b=(n.data?.length??0)>0,S=a.get(`skill`),C=S===Q||S===$||S!==null&&y.some(e=>e.name===S)?S:y[0]?.name??(b?$:Q),E=y.find(e=>e.name===C)??null,A=B(y,o);return(0,J.jsxs)(`div`,{"data-slot":`skills-section`,className:`@container flex min-w-0 flex-col gap-[22px]`,children:[(0,J.jsxs)(`header`,{className:`flex flex-col gap-4 @min-[700px]:flex-row @min-[700px]:items-center @min-[700px]:justify-between`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Skills`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Markdown playbooks your agents can follow.`})]}),(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":C===$?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(j,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Manage skills`]}):null,(0,J.jsxs)(L,{to:`/skills?skill=${Q}`,"data-slot":`bookmarklets-row`,"aria-current":C===Q?`page`:void 0,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium aria-[current=page]:bg-accent-strong/10 hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,J.jsx)(k,{"aria-hidden":`true`,className:`size-4 text-link-foreground`}),`Run from GitHub`]})]})]}),(0,J.jsxs)(`div`,{className:F(`flex-col items-start gap-2 sm:flex-row sm:items-center md:flex`,S===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(f,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,J.jsx)(W,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:o,onChange:e=>c(e.target.value),className:`h-11 min-w-0 bg-card pl-9 text-xs`})]}),(0,J.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:_.isPending,onClick:()=>_.mutate(),className:`flex h-11 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,J.jsx)(u,{"aria-hidden":`true`,className:F(`size-3`,_.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,J.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] md:grid-cols-[minmax(220px,310px)_minmax(0,1fr)]`,children:[(0,J.jsx)(`section`,{"data-slot":`skills-list`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card p-3 md:flex`,S===null?`flex`:`hidden`),children:(0,J.jsx)(`ul`,{"data-slot":`skill-rows`,className:`flex min-h-0 flex-col gap-1 overflow-y-auto md:max-h-[calc(100dvh-280px)]`,children:e.isPending?(0,J.jsx)(`li`,{role:`status`,"aria-busy":`true`,className:`min-h-72 p-3 text-[13px] text-soft-foreground`,children:`Loading skills…`}):A.length>0?A.map(e=>(0,J.jsx)(pe,{skill:e,active:C===e.name,highlighted:C===$&&e===y[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:y.length>0?`(no skills match)`:(0,J.jsx)(se,{})})})}),(0,J.jsx)(`section`,{"data-slot":`skills-detail`,className:F(`min-w-0 flex-col rounded-xl border border-border bg-card md:flex`,S===null?`hidden`:`flex`),children:(0,J.jsxs)(`div`,{className:`min-w-0 p-5`,children:[(0,J.jsxs)(L,{to:`/skills`,"data-slot":`skills-back`,className:`mb-4 inline-flex min-h-11 items-center gap-2 rounded-lg border border-border px-3 text-xs font-medium hover:bg-muted md:hidden`,children:[(0,J.jsx)(m,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),C===$?(0,J.jsx)(le,{projectId:p}):C===Q?(0,J.jsx)(K,{skills:y}):E?(0,J.jsx)(G,{skill:E,usedBy:H(t.data?.workflows??[],E.name)}):e.isPending?(0,J.jsx)(`div`,{role:`status`,"aria-busy":`true`,className:`min-h-72 text-xs text-muted-foreground`,children:`Loading skill…`}):(0,J.jsx)(M,{icon:(0,J.jsx)(h,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})]})})]})]})}function pe({skill:e,active:t,highlighted:n}){let r=R(e);return(0,J.jsx)(`li`,{children:(0,J.jsxs)(L,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-highlighted":n||void 0,"data-project":r?`true`:void 0,"aria-current":t?`page`:void 0,className:F(`selection-row flex min-h-24 flex-col gap-2 rounded-lg border-b border-border p-3 transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground`,(t||n)&&`border-transparent bg-accent-strong/10`),children:[(0,J.jsx)(`span`,{className:`flex min-w-0 items-center gap-2`,children:(0,J.jsx)(`span`,{className:F(`min-w-0 break-words text-[13px]`,r?`font-semibold text-foreground`:`font-normal text-muted-foreground`),children:e.name})}),e.description?(0,J.jsx)(`span`,{className:`line-clamp-2 text-xs leading-relaxed text-supporting-foreground`,children:e.description}):null,(0,J.jsx)(U,{source:e.source,className:`self-start border-0 bg-transparent p-0 text-link-foreground`})]})})}export{de as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-Cv6VpwoW.js";import{t as n}from"./project-router-JF2eAjIT.js";var r=e();function i({to:e,active:i=!1,onClick:a,children:o}){return(0,r.jsx)(n,{to:e,"aria-current":i?`page`:void 0,onClick:a,className:t(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-3 text-[13px] font-medium`,i?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:o})}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ba as i,Di as a,Dn as o,Ga as s,Hi as c,Ji as l,Qn as u,Ra as d,Xi as f,_t as p,d as m,fa as h,in as g,lt as _,na as v,nr as y,rr as b,t as x,ui as S,xi as C,ya as w}from"./centered-state-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ba as i,Di as a,Dn as o,Ga as s,Hi as c,Ji as l,Qn as u,Ra as d,Xi as f,_t as p,d as m,fa as h,in as g,lt as _,na as v,nr as y,rr as b,t as x,ui as S,xi as C,ya as w}from"./centered-state-B5dpq65a.js";import{a as T,i as E,n as D,o as O,r as k,s as A,t as j}from"./textarea-bn5bn1st.js";import{d as M,m as N}from"./pill-DzKHyuy3.js";import{t as P}from"./run-header-CJzRxOq_.js";import{i as F,n as I,r as L}from"./git-toolbar-2NRZ0XRF.js";import{t as R}from"./use-submit-shortcut-KWJsC906.js";import{n as z,r as B}from"./index-B3mt1xBA.js";import{t as ee}from"./diff-DkLLHPBL2.js";import{t as te}from"./use-desktop-BaYgO7YW.js";var V=e(t(),1),H=e=>e===`running`||e===`queued`||e===`waiting`,U=`no worktree — this task ran directly in the repo working tree`;function W(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?e.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 — ${U}`)}function G(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.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${U}`)}function K(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${U}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?H(e.status)?t(`Create PR unavailable — the run is still active; wait for the review gate`):{id:`create-pr`,label:`Create PR`,enabled:!0}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function q(e){let t=e.prUrl?{id:`view-pr`,label:`View PR`,enabled:!0,href:e.prUrl}:W(e),n=e.prUrl?[W(e),G(e)]:[G(e),K(e)],r=[];if(e.localHandoff){let t=e.hasSession?H(e.status)?{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 J=n();function Y({run:e,open:t,onOpenChange:n}){let a=s(),[o,c]=(0,V.useState)(``),l=r(e),u=(0,V.useRef)(l);u.current=l,(0,V.useEffect)(()=>{t&&c(u.current)},[t]);let d=i({mutationFn:t=>C(e.id,t),onSuccess:t=>{w(`Committed ${t.sha.slice(0,7)}`),n(!1),a.invalidateQueries({queryKey:g.runs.changes(e.id)}),a.invalidateQueries({queryKey:g.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),f=()=>{let e=o.trim();e.length===0||d.isPending||d.mutate(e)};return(0,J.jsx)(D,{open:t,onOpenChange:n,children:(0,J.jsxs)(k,{"data-slot":`commit-dialog`,children:[(0,J.jsxs)(O,{children:[(0,J.jsx)(A,{children:`Commit changes`}),(0,J.jsxs)(E,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,J.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,`.`]})]}),(0,J.jsx)(j,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:o,onChange:e=>c(e.target.value),onKeyDown:e=>{R({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),f())}}),(0,J.jsxs)(T,{children:[(0,J.jsx)(m,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,J.jsx)(m,{"data-slot":`commit-confirm`,disabled:o.trim().length===0||d.isPending,onClick:f,children:d.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=d(),t=y(e);return t.isPending?(0,J.jsx)(B,{tab:`changes`}):t.isError?(0,J.jsx)(z,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=o(),n=u(),r=b(e.id,M(e.status)),c=te(),[d,m]=(0,V.useState)(`unified`),[y,C]=(0,V.useState)(!1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(!1),k=(0,V.useRef)(null),A=s(),j=()=>A.invalidateQueries({queryKey:g.runs.all}),R=e=>w(e.message,{tone:`danger`}),z=i({mutationFn:()=>v(e.id),onSuccess:e=>w(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:R}),B=i({mutationFn:()=>a(e.id),onSuccess:e=>{w(`Draft PR created — ${e.url}`),j()},onError:R}),H=i({mutationFn:()=>f(e.id),onError:e=>{if(e instanceof S&&e.command){navigator.clipboard.writeText(e.command).then(()=>w(`No terminal found — command copied to clipboard.`)).catch(()=>w(`Run manually: ${e.command}`));return}R(e)}}),U=i({mutationFn:t=>l(e.id,t),onError:R}),W=r.isError&&r.error instanceof S&&r.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,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:N(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:O(!0);break;case`push`:z.mutate();break;case`create-pr`:B.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=r.data?.files??[],Z=(0,V.useMemo)(()=>L(X),[X]),Q=c?d:`unified`,$=!c||y;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(P,{run:e,tab:`changes`}),(0,J.jsx)(I,{bar:G,branch:e.branch,stat:r.data?.stat,mode:Q,wrap:$,onModeChange:m,onWrapChange:C,onAction:K}),r.data?.repointedHead?(0,J.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,J.jsx)(`code`,{children:r.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:r.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,r.isPending?(0,J.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):r.isError?(0,J.jsx)(x,{icon:W?(0,J.jsx)(_,{size:16}):(0,J.jsx)(p,{size:16}),tone:W?`neutral`:`danger`,heading:`h2`,title:W?`No changes to show`:`Could not load the changes`,subtitle:r.error.message}):X.length===0?(0,J.jsx)(x,{icon:(0,J.jsx)(_,{size:16}),tone:`neutral`,heading:`h2`,title:`No changes yet`,subtitle:`The worktree matches its base branch. Changes appear here as the agent works.`}):(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-9`,children:[(0,J.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 md:block lg:w-[250px]`,children:[(0,J.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,J.jsx)(F,{root:Z,selected:T,onSelect:e=>{E(e),k.current?.scrollToPath(e)}})]}),(0,J.jsx)(ee,{files:X,viewRef:k,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>h(e.id,t),onOpenInApp:t.data?.capabilities.localHandoff?e=>U.mutate(e):void 0,className:`min-w-0 flex-1`})]}),(0,J.jsx)(Y,{run:e,open:D,onOpenChange:O})]})}async function ne(e,t){try{let n=await c(e,t);return n.type!==`file`||n.binary||n.tooLarge?null:n.content??null}catch{return null}}export{X as TaskChangesRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ra as r,U as i,Yt as a,_t as o,ar as s,ct as c,d as l,ir as u,nr as d,rr as f,t as p,ui as m}from"./centered-state-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ra as r,U as i,Yt as a,_t as o,ar as s,ct as c,d as l,ir as u,nr as d,rr as f,t as p,ui as m}from"./centered-state-B5dpq65a.js";import{d as h}from"./pill-DzKHyuy3.js";import{t as g}from"./run-header-CJzRxOq_.js";import{n as _}from"./diff-controls-BBH2il5I.js";import{t as v}from"./project-router-JF2eAjIT.js";import{t as y}from"./search-x-I9Q8pgUa.js";import{t as b}from"./diff-stat-CRv7eHDb.js";import{n as x,r as S}from"./index-B3mt1xBA.js";import{t as C}from"./diff-DkLLHPBL2.js";import{t as w}from"./use-desktop-BaYgO7YW.js";import{t as T}from"./commit-list-CrVF6aJO.js";var E=e(t(),1),D=n();function O(){let{id:e}=r(),t=d(e);return t.isPending?(0,D.jsx)(S,{tab:`changes`}):t.isError?(0,D.jsx)(x,{tab:`changes`,error:t.error}):(0,D.jsx)(k,{run:t.data})}function k({run:e}){let{sha:t}=r(),n=s(e.id,h(e.status));return(0,D.jsxs)(`div`,{"data-route":`task-commits`,className:`flex min-h-full flex-col`,children:[(0,D.jsx)(g,{run:e,tab:`commits`}),t?(0,D.jsx)(A,{runId:e.id,sha:t}):n.isPending?(0,D.jsx)(`p`,{"data-slot":`commits-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commits…`}):n.isError?(0,D.jsx)(p,{icon:(0,D.jsx)(o,{size:16}),tone:n.error instanceof m&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof m&&n.error.status===409?`No commits to show`:`Could not load the commits`,subtitle:n.error.message}):n.data.commits.length===0?(0,D.jsx)(p,{icon:(0,D.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`This task hasn't committed anything on its branch. Autosave commits and any the agent makes appear here.`}):(0,D.jsxs)(`div`,{className:`px-[18px] py-[22px] md:px-9`,children:[(0,D.jsx)(T,{slot:`task-commits`,heading:(0,D.jsxs)(`h2`,{className:`text-base font-semibold`,children:[n.data.commits.length,` `,n.data.commits.length===1?`commit`:`commits`,` in this task`]}),className:`w-full`,commits:n.data.commits.map(t=>({...t,shaLabel:t.sha.slice(0,8),href:`/tasks/${e.id}/commits/${t.sha}`}))}),(0,D.jsx)(j,{run:e})]})]})}function A({runId:e,sha:t}){let n=u(e,t),r=w(),[s,c]=(0,E.useState)(`unified`),[d,f]=(0,E.useState)(!1),h=n.isError&&n.error instanceof m&&n.error.status===409,g=r?s:`unified`,x=!r||d;return(0,D.jsxs)(`section`,{"data-slot":`task-commit`,"data-sha":t,className:`mx-auto flex min-h-0 w-full max-w-[var(--measure)] flex-1 flex-col`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,D.jsx)(l,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,D.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,D.jsx)(i,{size:16,"aria-hidden":`true`}),`All commits`]})}),n.data?(0,D.jsx)(b,{stat:n.data.stat}):null,(0,D.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,D.jsx)(_,{mode:s,wrap:d,onModeChange:c,onWrapChange:f})})]}),n.isPending?(0,D.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):n.isError?(0,D.jsx)(p,{icon:h?(0,D.jsx)(y,{}):(0,D.jsx)(a,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`Commit not found`:`Could not load the commit`,subtitle:n.error.message}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,D.jsx)(`h2`,{className:`text-sm font-semibold`,children:n.data.subject}),(0,D.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[n.data.author,` · `,n.data.when,` ·`,` `,(0,D.jsx)(`span`,{className:`font-mono select-all`,children:n.data.sha})]})]}),n.data.files.length===0?(0,D.jsx)(p,{icon:(0,D.jsx)(o,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,D.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:0px] md:[--diff-sticky-top:1rem] md:px-6`,children:(0,D.jsx)(C,{files:n.data.files,mode:g,wrap:x,className:`min-w-0`})})]})]})}function j({run:e}){let t=f(e.id,h(e.status));return t.isPending?(0,D.jsx)(`p`,{className:`mt-[22px] text-xs text-muted-foreground`,children:`Loading changed files…`}):t.isError?(0,D.jsxs)(`p`,{role:`status`,className:`mt-[22px] text-xs text-danger`,children:[`Could not load changed files: `,t.error.message]}):t.data.files.length===0?null:(0,D.jsxs)(`section`,{"data-slot":`task-commit-files`,className:`mt-[22px] rounded-[10px] border border-border bg-card p-5`,children:[(0,D.jsxs)(`h2`,{className:`mb-4 text-[16px] font-semibold`,children:[t.data.files.length,` changed files`]}),(0,D.jsx)(`ul`,{className:`space-y-4`,children:t.data.files.map(t=>(0,D.jsx)(`li`,{children:(0,D.jsxs)(v,{to:`/tasks/${e.id}/changes`,className:`flex min-h-11 items-center gap-2 text-xs text-muted-foreground hover:text-foreground`,children:[(0,D.jsx)(c,{size:16,"aria-hidden":`true`,className:`size-[15px] shrink-0`}),(0,D.jsx)(`span`,{className:`break-all`,children:t.path})]})},t.path))})]})}export{O as TaskCommitsRoute};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ra as r,Rt as i,Yt as a,Z as o,ct as s,d as c,dn as l,dt as u,fa as d,fn as f,gi as p,ji as m,nr as h,sr as g,t as _,ui as v,ut as y,yn as b,za as x}from"./centered-state-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ra as r,Rt as i,Yt as a,Z as o,ct as s,d as c,dn as l,dt as u,fa as d,fn as f,gi as p,ji as m,nr as h,sr as g,t as _,ui as v,ut as y,yn as b,za as x}from"./centered-state-B5dpq65a.js";import{t as S}from"./utils-Cv6VpwoW.js";import{t as C}from"./createLucideIcon-BHp8sXmF.js";import{l as w,t as T}from"./run-header-CJzRxOq_.js";import{n as E,t as D}from"./markdown-DMJKzyRf.js";import{a as O,i as k,r as A}from"./highlighter-CdHqIwFr.js";import{h as j,n as M,r as N}from"./index-B3mt1xBA.js";var P=C(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),F=C(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),I=C(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),L=C(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),R=C(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),z=e(t(),1),B=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function V(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:B.has(t.slice(n+1).toLowerCase())}function H(e){return e.tooLarge?`too-large`:V(e.path)?`image`:e.binary?`binary`:`text`}function U(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var W=n();function G({runId:e,path:t,className:n}){let r=g(e,t??void 0);if(t===null)return(0,W.jsx)(q,{className:n,children:(0,W.jsx)(_,{icon:(0,W.jsx)(y,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,W.jsx)(q,{className:n,children:(0,W.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof v&&r.error.status===409;return(0,W.jsx)(q,{className:n,children:(0,W.jsx)(_,{icon:e?(0,W.jsx)(I,{}):(0,W.jsx)(a,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,W.jsx)(K,{runId:e,entry:r.data,className:n}):(0,W.jsx)(q,{className:n,children:(0,W.jsx)(_,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function K({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,documentPreview:o=!1}){let[s,c]=(0,z.useState)(!1),l=o&&/\.(?:md|markdown)$/i.test(t.path),u=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),f=o&&u&&t.size<=10*1024*1024?`image`:H(t);return(0,W.jsxs)(q,{className:n,children:[(0,W.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,W.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,W.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:U(t.size)})]}),a||i||l?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[a?(0,W.jsxs)(`span`,{children:[`Published snapshot · `,a]}):null,i?(0,W.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:i,children:`Download`}):null,l?(0,W.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:()=>c(e=>!e),children:s?`Preview`:`View source`}):null]}):null,f===`image`&&(!o||u)?(0,W.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,W.jsx)(`img`,{"data-slot":`file-preview-image`,src:r??d(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):f===`too-large`?(0,W.jsx)(_,{icon:(0,W.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${U(t.size)} — past the preview cap. Open it in your editor instead.`}):f===`binary`?(0,W.jsx)(_,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${U(t.size)} of binary data — no text preview.`}):l&&!s?(0,W.jsx)(`div`,{className:`p-4`,children:(0,W.jsx)(D,{document:!0,children:t.content??``})}):(0,W.jsx)(X,{path:t.path,text:t.content??``})]})}function q({className:e,children:t}){return(0,W.jsx)(`section`,{"data-slot":`file-preview`,className:S(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var J=1500;function Y(e,t){let n=(0,z.useMemo)(()=>t.split(`
|
|
2
2
|
`).map(e=>[{content:e}]),[t]),r=(0,z.useMemo)(()=>O(e),[e]),i=n.length>J,[a,o]=(0,z.useState)(null);return(0,z.useEffect)(()=>{if(r===null||i)return;let n=!1;return A(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:k(t,r)?.tokens??n}function X({path:e,text:t}){let n=Y(e,t);return(0,W.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":O(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,W.jsxs)(`div`,{className:`flex px-4`,children:[(0,W.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,W.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function Z({runId:e,path:t,artifactId:n}){let r=b(e,n?null:t),i=l(e,n),a=n?i:r,o=(0,z.useContext)(E),s=a.data,u=(0,z.useMemo)(()=>s?.type===`file`&&s.source!==`artifact`?{runId:e,...o,basePath:s.path}:null,[s,o,e]);if(!t&&!n)return(0,W.jsx)(G,{runId:e,path:null,className:`min-w-0 flex-1`});if(a.isPending)return(0,W.jsx)(`p`,{role:`status`,className:`p-4`,children:`Loading file…`});if(a.isError)return(0,W.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,W.jsx)(`h2`,{children:`Could not load this file`}),(0,W.jsx)(`p`,{className:`wrap-anywhere text-sm`,children:a.error.message}),(0,W.jsx)(c,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]});if(!s)return(0,W.jsx)(`p`,{role:`alert`,className:`p-4`,children:`No file data was returned.`});if(s.type!==`file`)return(0,W.jsxs)(`section`,{"data-slot":`file-preview`,className:`min-w-0 flex-1 rounded-lg border p-4`,children:[(0,W.jsx)(`h2`,{children:s.type===`unpublished`?`File not published`:`Cannot preview this file`}),(0,W.jsx)(`p`,{className:`wrap-anywhere py-2 font-mono text-xs`,children:s.path}),(0,W.jsx)(`p`,{className:`text-sm`,children:s.reason}),(0,W.jsx)(c,{variant:`outline`,onClick:()=>void a.refetch(),children:`Retry`})]});let d=s.artifact;return(0,W.jsx)(E.Provider,{value:u,children:(0,W.jsx)(K,{runId:e,entry:s,documentPreview:!0,className:`min-w-0 flex-1`,imageUrl:d?p(e,d.id,`image`):m(e,t),...d?{downloadUrl:p(e,d.id,`download`),snapshot:new Date(d.createdAt).toLocaleString()}:{}},d?.id??s.path)})}function Q({runId:e,selected:t,onSelect:n}){return(0,W.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,W.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,W.jsx)($,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function $({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=g(e,t);return a.isPending?(0,W.jsx)(`li`,{"data-slot":`files-tree-loading`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Loading…`}):a.isError?(0,W.jsx)(`li`,{"data-slot":`files-tree-error`,className:`px-1.5 py-1 text-xs text-danger`,style:{paddingLeft:`${6+n*14}px`},children:a.error.message}):a.data.type===`dir`?a.data.entries.length===0?(0,W.jsx)(`li`,{"data-slot":`files-tree-empty`,className:`px-1.5 py-1 text-xs text-soft-foreground`,style:{paddingLeft:`${6+n*14}px`},children:`Empty directory`}):(0,W.jsx)(W.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,W.jsx)(ee,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,W.jsx)(te,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function ee({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[s,c]=(0,z.useState)(!1);return(0,W.jsxs)(`li`,{children:[(0,W.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":s?`open`:`closed`,"aria-expanded":s,onClick:()=>c(e=>!e),className:`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+r*14}px`},children:[(0,W.jsx)(o,{size:16,"aria-hidden":`true`,className:S(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,s&&`rotate-90`)}),(0,W.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),s?(0,W.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,W.jsx)($,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function te({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,c=V(t)?R:s;return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:S(`flex min-h-11 md:min-h-8 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,o?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${6+r*14}px`},children:[(0,W.jsx)(c,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,W.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:U(n)})]})})}function ne(){let{id:e}=r(),t=h(e);return t.isPending?(0,W.jsx)(N,{tab:`files`}):t.isError?(0,W.jsx)(M,{tab:`files`,error:t.error}):(0,W.jsx)(w,{runId:t.data.id,children:(0,W.jsx)(re,{run:t.data},t.data.id)})}function re({run:e}){let t=g(e.id,``),n=f(e.id),[r,o]=x(),s=r.get(`path`),l=r.get(`artifact`),u=r.getAll(`path`).length>1||r.getAll(`artifact`).length>1||s!==null&&l!==null,[d,p]=(0,z.useState)(s??``);(0,z.useEffect)(()=>p(s??``),[s]);let m=(e,t)=>{let n=new URLSearchParams(r);n.delete(`path`),n.delete(`artifact`),n.set(e,t),o(n)},h=t.isError&&t.error instanceof v&&t.error.status===409;return(0,W.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,W.jsx)(T,{run:e,tab:`files`}),(0,W.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),d.trim()&&m(`path`,d.trim())},children:[(0,W.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,W.jsx)(i,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,W.jsx)(j,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:d,onChange:e=>p(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,W.jsx)(c,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!d.trim(),children:`Open file`})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-col items-stretch gap-5 px-[18px] py-[22px] [--diff-sticky-top:1rem] md:flex-row md:items-start md:px-9`,children:[(0,W.jsxs)(`aside`,{"data-slot":`files-tree-pane`,className:`w-full shrink-0 rounded-xl border border-border bg-card p-3.5 md:sticky md:top-[var(--diff-sticky-top)] md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,children:[(0,W.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),t.isPending?(0,W.jsx)(`p`,{"data-slot":`files-loading`,className:`py-4 text-xs`,children:`Loading files…`}):t.isError?(0,W.jsx)(_,{icon:h?(0,W.jsx)(L,{}):(0,W.jsx)(a,{size:16}),tone:h?`neutral`:`danger`,heading:`h2`,title:h?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,W.jsx)(Q,{runId:e.id,selected:s,onSelect:e=>m(`path`,e)}),(0,W.jsxs)(`section`,{className:`mt-4 border-t border-border pt-3`,"aria-label":`Published artifacts`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-medium`,children:`Published artifacts`}),n.isPending?(0,W.jsx)(`p`,{className:`py-2 text-xs`,children:`Loading published files…`}):n.isError?(0,W.jsx)(`p`,{role:`alert`,className:`py-2 text-xs`,children:`Could not load published files.`}):n.data.artifacts.length===0?(0,W.jsx)(`p`,{className:`py-2 text-xs text-muted-foreground`,children:`No published files yet.`}):(0,W.jsx)(`ul`,{children:n.data.artifacts.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsx)(`button`,{type:`button`,"aria-current":e.id===l?`true`:void 0,className:`min-h-11 w-full rounded px-2 py-2 text-left text-xs wrap-anywhere hover:bg-muted focus-visible:ring-2`,onClick:()=>m(`artifact`,e.id),children:e.name})},e.id))}),(0,W.jsx)(c,{variant:`ghost`,className:`min-h-11`,onClick:()=>void n.refetch(),children:`Refresh published files`})]})]}),u?(0,W.jsx)(`p`,{role:`alert`,className:`p-4`,children:`Invalid file link: choose either a path or a published artifact.`}):s!==null||l!==null||t.isSuccess?(0,W.jsx)(Z,{runId:e.id,path:s,artifactId:l}):null]}),(0,W.jsx)(`p`,{className:`px-[18px] pb-6 text-xs text-muted-foreground md:px-9`,children:`Browsing files is read-only. Worktree contents may differ from your main checkout. Published files are snapshots.`})]})}export{ne as TaskFilesRoute};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ba as i,Br as a,Ci as o,Di as s,Dt as c,Et as l,Ga as u,H as d,Ha as f,Hn as p,Ia as m,In as h,J as g,Jt as _,Mi as v,Oa as y,Or as b,Pt as x,Q as S,Ra as C,Rn as w,Rt as T,Ui as E,Va as D,Vr as O,Wi as k,X as A,Xa as j,Y as M,Ya as N,Z as P,Zn as F,_i as ee,at as te,d as I,dr as ne,en as L,et as R,fr as re,hr as ie,ht as ae,ii as oe,in as z,it as se,jn as ce,mn as le,n as ue,nr as de,nt as fe,qa as B,qt as pe,t as me,ui as he,vi as ge,vn as _e,wa as ve,xt as ye,ya as V}from"./centered-state-kOb8j_BL.js";import{C as be,S as xe,T as Se,c as Ce,i as we,n as Te,s as Ee,t as H,w as De,x as Oe,y as ke}from"./utils-BW1-Ibnd.js";import{n as U,r as Ae,t as je}from"./collapsible-KSKVv9J9.js";import{n as Me,s as Ne,t as Pe}from"./agent-accounts-Bh1l3ZSb.js";import{t as Fe}from"./textarea-D2Gx4GDI.js";import{t as Ie}from"./createLucideIcon-BHp8sXmF.js";import{A as Le,M as Re,O as ze,S as Be,c as Ve,d as He,f as Ue,g as We,h as Ge,u as Ke,v as qe}from"./pill-0JHCf1v8.js";import{a as Je,c as Ye,d as Xe,f as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as at}from"./run-header-BBQOWhJ7.js";import{t as ot}from"./external-link-BE6y205O.js";import{L as st,S as ct,_ as lt,b as ut,c as dt,g as ft,l as pt,v as mt,x as ht}from"./prompt-templates-BgXzCOlY.js";import{s as gt,t as W,u as _t}from"./project-router-CS_oeLqi.js";import{t as vt}from"./message-square-B-MD-8rD.js";import{t as yt}from"./search-x-I9Q8pgUa.js";import{t as bt}from"./square-terminal-B6RYYieR.js";import{t as xt}from"./markdown-DlvW2wEx.js";import{c as St,i as Ct,l as wt,n as Tt,o as Et,s as Dt,t as Ot}from"./thread-loading-hVlcCLdm.js";import{t as kt}from"./use-submit-shortcut-KWJsC906.js";import{t as At}from"./lib-BQXq3kEf.js";import{t as jt}from"./zoomable-image-DVvXID3t.js";import{t as Mt}from"./run-diff-xym-7QHm.js";import{t as Nt}from"./use-desktop-BaYgO7YW.js";var Pt=120;function Ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function It(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Pt?`${t.slice(0,Pt-1)}…`:t}function G(e,...t){if(Ft(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return It(t)}}function Lt(e){if(!Ft(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return It(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return It(e.join(` `))}}function Rt(e){if(!Ft(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Ft(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function zt(e){return G(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function K(e,t){return t?`${e} ${t}`:e}function Bt(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:K(`Ran`,Lt(t)),subtitle:G(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:K(`Write`,G(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Rt(t);return{toolKind:`edit`,title:K(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:K(`Read`,G(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:K(`View image`,G(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:K(`Search`,G(t,`pattern`,`query`)),subtitle:G(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:K(`Fetch`,G(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:K(`Web search`,G(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=G(t,`subagent_type`,`subagentType`),i=G(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=G(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:G(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=G(t,`server`),n=G(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:zt(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?It(e):`Tool`,subtitle:zt(t)}}var Vt=class extends B{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:N(t,n.data),hasPreviousPage:j(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Ht(e,t){return f(e,Vt,t)}var Ut=Ie(`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`}]]),Wt=Ie(`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`}]]),Gt=Ie(`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`}]]),Kt=Ie(`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`}]]),qt=Ie(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),q=e(t(),1),Jt=[`run-event`,`ui-event`];function Yt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function Xt(e,t={}){let[n,r]=(0,q.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,q.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=Yt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(we(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Jt)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var Zt=5,Qt=200,$t=5e3;function en(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function tn(e){let t=Ee(),n=u(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=Ht({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>E(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Zt,retry:1}),o=D({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>k(e,{signal:t}),retry:1}),s=a.isError||o.isError,c=Xt(s?e:void 0),l=a.data?.pages??[],d=l.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,q.useRef)(!1),p=(0,q.useCallback)(()=>{e===void 0||f.current||(f.current=!0,E(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>Zt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=Xt(!s&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:$t,compactAt:Qt,onCompact:p}),h=(0,q.useMemo)(()=>en(...l.map(e=>e.events)),[l]),g=(0,q.useMemo)(()=>s?c:en(h,m),[s,c,h,m]),_=(0,q.useMemo)(()=>{if(s)return c;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return en(e,g.filter(({seq:e})=>e>t))},[o.data,s,c,g]),v=(0,q.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),y=(0,q.useCallback)(async()=>{s||await n.resetQueries({queryKey:r,exact:!0})},[s,r,n]);return{visibleEvents:g,currentEvents:_,isPending:!s&&a.isPending,contextPending:!s&&o.isPending,fallback:s,hasOlder:!s&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:v,jumpToLatest:y,retainedPages:l.length}}var J=n();function nn({run:e}){let t=u(),n=i({mutationFn:()=>ee(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,J.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,J.jsx)(Le,{tone:`pending`,pulse:!0}),(0,J.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,J.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,J.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,J.jsx)(y,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var rn=e=>e.kind===`tool`,an=e=>e.kind===`conversation`,on=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,sn=(e,t,n)=>`${e} ${e===1?t:n}`;function cn(e,t){let n=[];return e>0&&n.push(sn(e,`file`,`files`)),t>0&&n.push(sn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ln(e){return`${e} earlier tool call${e===1?``:`s`}`}var un=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dn(e){for(let t of un)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function fn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(rn).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:cn(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 pn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(an(e)){s(),c.push(e);continue}l(),rn(e)&&on(e)&&!r.has(e.id)?o.push(e):(s(),rn(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 pn(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.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 mn=new Map,hn=(0,q.createContext)(null);function gn(){return(0,q.useContext)(hn)}function _n({runId:e,children:t}){let n=(0,q.useMemo)(()=>({get:t=>mn.get(e)?.get(t),set:(t,n)=>{let r=mn.get(e)??new Map;r.set(t,n),mn.set(e,r)}}),[e]);return(0,J.jsx)(hn.Provider,{value:n,children:t})}var vn=(0,q.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function yn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function bn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function xn(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 Sn(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Cn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var wn=new Map;function Tn(e,t){wn.set(e,t)}function En(e){return wn.get(e)}var Dn=new Map;function On(e,t){Dn.set(e,t)}function kn(e,t){let n=Dn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var An=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),jn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Mn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Nn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Pn=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Fn(e){let t=Y(e);return t===void 0?void 0:An.format(t)}function In(e){let t=Y(e);return t===void 0?void 0:jn.format(t)}var Ln=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Rn(e){let t=Y(e);return t===void 0?void 0:Ln(t)}function zn(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Ln(n);return r===Ln(t)?`Today`:r===Ln(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Mn:Nn).format(n)}function Bn(e,t){let n=Y(e),r=Y(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 Vn({ts:e}){let t=Fn(e);return t===void 0?null:(0,J.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:In(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Hn({startedAt:e,completedAt:t}){let n=Fn(t);if(n===void 0)return null;let r=Bn(e,t);return(0,J.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,J.jsx)(`time`,{dateTime:t,title:In(t),children:n}),r===void 0?null:(0,J.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Un({ts:e}){let t=zn(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Pn.format(n);return(0,J.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,J.jsx)(`time`,{dateTime:Rn(e),title:r,children:t}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function Wn(e,t){let n={};for(let r of[...t??[],e])n[r.id]=r.steps.find(e=>e.id===r.currentStepId)?.backend??r.runner;return n}function Gn(e,t){let n={[e.id]:r(e)};for(let e of t??[])n[e.id]=r(e);return n}function X(e,t){return t?.[e]??`Task`}function Kn(e,t){return e.senderRunId===t?`outbound`:`inbound`}function qn(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`;default:return e}}function Jn(e){switch(e){case`pending`:return`Pending`;case`replied`:return`Replied`;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`;default:return e}}function Yn(e){if(e.outcome)return Jn(e.outcome.status);if(e.delivery===`not-delivered`)return Xn(`not-delivered`)}function Xn(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`;default:return e}}var Zn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg`,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`,accent:`text-message-agent-accent`,body:`max-w-[65ch] text-[15px] md:text-[14px]`}};function Qn({role:e,children:t,className:n,ts:r,...i}){let a=Zn[e];return(0,J.jsxs)(`article`,{...i,"data-role":e,"aria-label":a.speaker,className:H(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes,n),children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex w-full min-w-0 items-start justify-between gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(vt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),a.label]}),r!==void 0&&Fn(r)!==void 0?(0,J.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,J.jsx)(Vn,{ts:r})}):null]}),(0,J.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,a.body,`leading-[1.6]`),children:t})]})}function $n({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:o=`Edit message`,removeLabel:s=`Remove message`}){let c=t-n.length,[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(e),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(),v=()=>{f(e),g(void 0),u(!0)},y=async()=>{let t=d.trim();if(!t||t===e){u(!1);return}m(!0),g(void 0);try{await i?.(t),u(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},b=async()=>{m(!0),g(void 0);try{await a?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return l?(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,J.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),u(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},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,J.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(!1),disabled:p,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,J.jsx)(`button`,{type:`button`,onClick:()=>void y(),disabled:p,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:p?(0,J.jsx)(_t,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,J.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,J.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,J.jsx)(`button`,{type:`button`,"aria-label":o,onClick:v,disabled:p,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,J.jsx)(qt,{className:`size-3.5`})}):null,a?(0,J.jsx)(`button`,{type:`button`,"aria-label":s,onClick:()=>void b(),disabled:p,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,J.jsx)(_,{className:`size-3.5`})}):null]}):null,h?(0,J.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,J.jsx)(xt,{breaks:!0,children:e}),n.length>0?(0,J.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>ke(e.split(`/`).pop()??``)?(0,J.jsx)(jt,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,J.jsxs)(`a`,{href:Ce(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,J.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,c>0?(0,J.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[c,` image`,c>1?`s`:``,` attached`]}):null]})}function er({text:e,ts:t}){return(0,J.jsx)(Qn,{role:`agent`,ts:t,"data-slot":`assistant-message`,children:(0,J.jsx)(xt,{children:e})})}var tr={outbound:{classes:`border-message-outbound-border bg-message-outbound-bg`,accent:`text-message-outbound-accent`},inbound:{classes:`border-message-inbound-border bg-message-inbound-bg`,accent:`text-message-inbound-accent`}},nr=`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 rr({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,J.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,J.jsx)(ir,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function ir({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let i=Kn(e.messages[0]??{senderRunId:e.senderRunId},t),a=tr[i],o=cr(e.messages.map(e=>i===`outbound`?e.recipientRunId:e.senderRunId)),s=i===`outbound`?`SENT to`:`RECEIVED from`,c=`${s} ${o.map(e=>X(e,n)).join(`, `)}`,l=e.messages[0],u=l?.createdAt??l?.recordedAt,d=l?Yn(l):void 0;return(0,J.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":i,"data-kind":e.kind,className:H(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes),children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsx)(`span`,{children:s}),o.map((e,t)=>(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,J.jsx)(W,{className:nr,to:`/tasks/${e}`,"aria-label":`${s} ${X(e,n)}`,children:X(e,n)})]},e))]}),(0,J.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:qn(e.kind)}),e.messages.length===1&&d?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:d}):null]}),u!==void 0&&Fn(u)!==void 0?(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-[11px] text-soft-foreground`,children:[e.messages.length>1?`First sent`:null,(0,J.jsx)(Vn,{ts:u})]}):null]}),(0,J.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,J.jsx)(xt,{breaks:!0,children:e.text})}),[...new Set(e.messages.map(e=>e.instruction??(e.delivery===`queued`?`${r?.[e.recipientRunId]===`cursor`?`Queued for delivery. If Cursor is in a turn, delivery waits for that turn to end.`:r?.[e.recipientRunId]?`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`?`Not delivered. The recipient needs a new instruction to resume. A parent can resume its owned worker with --resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0)))].map(e=>e?(0,J.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,J.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=Yn(e),i=e.createdAt??e.recordedAt;return(0,J.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(W,{className:nr,to:`/tasks/${e.recipientRunId}`,"aria-label":`${X(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:X(e.recipientRunId,n)}),r?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,J.jsx)(ar,{message:e,runId:t,taskTitles:n}),i!==void 0&&Fn(i)!==void 0?(0,J.jsx)(`span`,{className:`ml-auto whitespace-nowrap`,children:(0,J.jsx)(Vn,{ts:i})}):null]},e.id)})}):null,e.messages.length===1&&l?(0,J.jsx)(ar,{message:l,runId:t,taskTitles:n}):null,(0,J.jsx)(or,{batch:e,heading:c})]})}function ar({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,q.useContext)(vn),o=e.requestId?r.get(e.requestId):void 0,s=e.requestId?o?[o]:[]:i.get(e.messageId)??[],c=e.requestId?`request`:`reply`;return s.length===0?e.requestId||e.outcome?.replyId?(0,J.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,c,` is outside loaded history.`]}):null:s.map(e=>{let r=Kn(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(nr,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,X(i,n)]},e.message.messageId)})}function or({batch:e,heading:t}){return(0,J.jsxs)(je,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,J.jsxs)(Ae,{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,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,J.jsx)(U,{children:(0,J.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>sr(e)).map((e,t)=>(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,J.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function sr(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:Xn(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 cr(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function lr({note:e}){return e.icon===`handoff`?(0,J.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,J.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,J.jsx)(Xe,{className:`size-3`})}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,J.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:H(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var ur={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function dr({incident:e}){let t=ur[e.provider];return(0,J.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,J.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function fr({text:e}){let t=(0,q.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$r as r,Ba as i,Br as a,Ci as o,Di as s,Dt as c,Et as l,Ga as u,H as d,Ha as f,Hn as p,Ia as m,In as h,J as g,Jt as _,Mi as v,Oa as y,Or as b,Pt as x,Q as S,Ra as C,Rn as w,Rt as T,Ui as E,Va as D,Vr as O,Wi as k,X as A,Xa as j,Y as M,Ya as N,Z as P,Zn as F,_i as ee,at as te,d as I,dr as ne,en as L,et as R,fr as re,hr as ie,ht as ae,ii as oe,in as z,it as se,jn as ce,mn as le,n as ue,nr as de,nt as fe,qa as B,qt as pe,t as me,ui as he,vi as ge,vn as _e,wa as ve,xt as ye,ya as V}from"./centered-state-B5dpq65a.js";import{C as be,S as xe,T as Se,c as Ce,i as we,n as Te,s as Ee,t as H,w as De,x as Oe,y as ke}from"./utils-Cv6VpwoW.js";import{n as U,r as Ae,t as je}from"./collapsible-Be7f34CZ.js";import{n as Me,s as Ne,t as Pe}from"./agent-accounts-xNBY6ogh.js";import{t as Fe}from"./textarea-bn5bn1st.js";import{t as Ie}from"./createLucideIcon-BHp8sXmF.js";import{A as Le,M as Re,O as ze,S as Be,c as Ve,d as He,f as Ue,g as We,h as Ge,u as Ke,v as qe}from"./pill-DzKHyuy3.js";import{a as Je,c as Ye,d as Xe,f as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as at}from"./run-header-CJzRxOq_.js";import{t as ot}from"./external-link-BE6y205O.js";import{L as st,S as ct,_ as lt,b as ut,c as dt,g as ft,l as pt,v as mt,x as ht}from"./prompt-templates-xPSqYS6C.js";import{s as gt,t as W,u as _t}from"./project-router-JF2eAjIT.js";import{t as vt}from"./message-square-B-MD-8rD.js";import{t as yt}from"./search-x-I9Q8pgUa.js";import{t as bt}from"./square-terminal-B6RYYieR.js";import{t as xt}from"./markdown-DMJKzyRf.js";import{c as St,i as Ct,l as wt,n as Tt,o as Et,s as Dt,t as Ot}from"./thread-loading-C06KXeIB.js";import{t as kt}from"./use-submit-shortcut-KWJsC906.js";import{t as At}from"./lib-BQXq3kEf.js";import{t as jt}from"./zoomable-image-DUpvct4v.js";import{t as Mt}from"./run-diff-CrcC1Yup.js";import{t as Nt}from"./use-desktop-BaYgO7YW.js";var Pt=120;function Ft(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function It(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Pt?`${t.slice(0,Pt-1)}…`:t}function G(e,...t){if(Ft(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return It(t)}}function Lt(e){if(!Ft(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return It(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return It(e.join(` `))}}function Rt(e){if(!Ft(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)Ft(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function zt(e){return G(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function K(e,t){return t?`${e} ${t}`:e}function Bt(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:K(`Ran`,Lt(t)),subtitle:G(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:K(`Write`,G(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:K(`Edit`,G(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Rt(t);return{toolKind:`edit`,title:K(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:K(`Read`,G(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:K(`View image`,G(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:K(`Search`,G(t,`pattern`,`query`)),subtitle:G(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:K(`Fetch`,G(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:K(`Web search`,G(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=G(t,`subagent_type`,`subagentType`),i=G(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=G(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:G(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=G(t,`server`),n=G(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:zt(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?It(e):`Tool`,subtitle:zt(t)}}var Vt=class extends B{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:N(t,n.data),hasPreviousPage:j(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Ht(e,t){return f(e,Vt,t)}var Ut=Ie(`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`}]]),Wt=Ie(`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`}]]),Gt=Ie(`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`}]]),Kt=Ie(`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`}]]),qt=Ie(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),q=e(t(),1),Jt=[`run-event`,`ui-event`];function Yt(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function Xt(e,t={}){let[n,r]=(0,q.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,q.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=Yt(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(we(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Jt)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var Zt=5,Qt=200,$t=5e3;function en(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function tn(e){let t=Ee(),n=u(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],a=Ht({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>E(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Zt,retry:1}),o=D({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>k(e,{signal:t}),retry:1}),s=a.isError||o.isError,c=Xt(s?e:void 0),l=a.data?.pages??[],d=l.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,q.useRef)(!1),p=(0,q.useCallback)(()=>{e===void 0||f.current||(f.current=!0,E(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>Zt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=Xt(!s&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:$t,compactAt:Qt,onCompact:p}),h=(0,q.useMemo)(()=>en(...l.map(e=>e.events)),[l]),g=(0,q.useMemo)(()=>s?c:en(h,m),[s,c,h,m]),_=(0,q.useMemo)(()=>{if(s)return c;let e=o.data?.contextEvents??[],t=o.data?.asOfSeq??0;return en(e,g.filter(({seq:e})=>e>t))},[o.data,s,c,g]),v=(0,q.useCallback)(async()=>{await a.fetchPreviousPage()},[a.fetchPreviousPage]),y=(0,q.useCallback)(async()=>{s||await n.resetQueries({queryKey:r,exact:!0})},[s,r,n]);return{visibleEvents:g,currentEvents:_,isPending:!s&&a.isPending,contextPending:!s&&o.isPending,fallback:s,hasOlder:!s&&!!a.hasPreviousPage,isFetchingOlder:a.isFetchingPreviousPage,olderError:a.isFetchPreviousPageError?a.error instanceof Error?a.error.message:`Could not load earlier items`:void 0,loadOlder:v,jumpToLatest:y,retainedPages:l.length}}var J=n();function nn({run:e}){let t=u(),n=i({mutationFn:()=>ee(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:z.runs.detail(e.id)}),t.invalidateQueries({queryKey:z.runs.list()}),V(`This task will not resume itself`)},onError:e=>V(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,J.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,J.jsx)(Le,{tone:`pending`,pulse:!0}),(0,J.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,J.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,J.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,J.jsx)(y,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var rn=e=>e.kind===`tool`,an=e=>e.kind===`conversation`,on=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,sn=(e,t,n)=>`${e} ${e===1?t:n}`;function cn(e,t){let n=[];return e>0&&n.push(sn(e,`file`,`files`)),t>0&&n.push(sn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function ln(e){return`${e} earlier tool call${e===1?``:`s`}`}var un=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function dn(e){for(let t of un)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function fn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(rn).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:cn(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 pn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if(an(e)){s(),c.push(e);continue}l(),rn(e)&&on(e)&&!r.has(e.id)?o.push(e):(s(),rn(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 pn(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.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 mn=new Map,hn=(0,q.createContext)(null);function gn(){return(0,q.useContext)(hn)}function _n({runId:e,children:t}){let n=(0,q.useMemo)(()=>({get:t=>mn.get(e)?.get(t),set:(t,n)=>{let r=mn.get(e)??new Map;r.set(t,n),mn.set(e,r)}}),[e]);return(0,J.jsx)(hn.Provider,{value:n,children:t})}var vn=(0,q.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function yn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function bn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function xn(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 Sn(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Cn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var wn=new Map;function Tn(e,t){wn.set(e,t)}function En(e){return wn.get(e)}var Dn=new Map;function On(e,t){Dn.set(e,t)}function kn(e,t){let n=Dn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}var An=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}),jn=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`medium`}),Mn=new Intl.DateTimeFormat(void 0,{weekday:`short`,month:`short`,day:`numeric`}),Nn=new Intl.DateTimeFormat(void 0,{weekday:`short`,year:`numeric`,month:`short`,day:`numeric`}),Pn=new Intl.DateTimeFormat(void 0,{dateStyle:`full`});function Y(e){if(typeof e!=`string`||e===``)return;let t=new Date(e);return Number.isFinite(t.getTime())?t:void 0}function Fn(e){let t=Y(e);return t===void 0?void 0:An.format(t)}function In(e){let t=Y(e);return t===void 0?void 0:jn.format(t)}var Ln=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`;function Rn(e){let t=Y(e);return t===void 0?void 0:Ln(t)}function zn(e,t=new Date){let n=Y(e);if(n===void 0)return;let r=Ln(n);return r===Ln(t)?`Today`:r===Ln(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1))?`Yesterday`:(n.getFullYear()===t.getFullYear()?Mn:Nn).format(n)}function Bn(e,t){let n=Y(e),r=Y(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 Vn({ts:e}){let t=Fn(e);return t===void 0?null:(0,J.jsx)(`time`,{"data-slot":`message-time`,dateTime:e,title:In(e),className:`text-[11px] leading-none text-soft-foreground`,children:t})}function Hn({startedAt:e,completedAt:t}){let n=Fn(t);if(n===void 0)return null;let r=Bn(e,t);return(0,J.jsxs)(`div`,{"data-slot":`turn-time`,className:`flex items-center gap-1.5 px-0.5 text-[11px] leading-none text-soft-foreground`,children:[(0,J.jsx)(`time`,{dateTime:t,title:In(t),children:n}),r===void 0?null:(0,J.jsxs)(`span`,{title:`Replied in ${r}`,children:[`· `,r]})]})}function Un({ts:e}){let t=zn(e),n=Y(e);if(t===void 0||n===void 0)return null;let r=Pn.format(n);return(0,J.jsxs)(`div`,{"data-slot":`day-separator`,role:`separator`,"aria-label":t===`Today`||t===`Yesterday`?`${t}, ${r}`:r,className:`flex items-center gap-3 py-1 text-[11px] font-medium text-soft-foreground`,children:[(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),(0,J.jsx)(`time`,{dateTime:Rn(e),title:r,children:t}),(0,J.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]})}function Wn(e,t){let n={};for(let r of[...t??[],e])n[r.id]=r.steps.find(e=>e.id===r.currentStepId)?.backend??r.runner;return n}function Gn(e,t){let n={[e.id]:r(e)};for(let e of t??[])n[e.id]=r(e);return n}function X(e,t){return t?.[e]??`Task`}function Kn(e,t){return e.senderRunId===t?`outbound`:`inbound`}function qn(e){switch(e){case`request`:return`Request`;case`progress`:return`Progress`;case`follow-up`:return`Follow-up`;case`reply`:return`Reply`;default:return e}}function Jn(e){switch(e){case`pending`:return`Pending`;case`replied`:return`Replied`;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`;default:return e}}function Yn(e){if(e.outcome)return Jn(e.outcome.status);if(e.delivery===`not-delivered`)return Xn(`not-delivered`)}function Xn(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`consumed`:return`Read`;case`not-delivered`:return`Not delivered`;default:return e}}var Zn={user:{label:`YOUR MESSAGE`,speaker:`Your message`,classes:`border-message-user-border bg-message-user-bg`,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`,accent:`text-message-agent-accent`,body:`max-w-[65ch] text-[15px] md:text-[14px]`}};function Qn({role:e,children:t,className:n,ts:r,...i}){let a=Zn[e];return(0,J.jsxs)(`article`,{...i,"data-role":e,"aria-label":a.speaker,className:H(`flex w-full min-w-0 flex-col gap-2 self-stretch rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes,n),children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex w-full min-w-0 items-start justify-between gap-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(vt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),a.label]}),r!==void 0&&Fn(r)!==void 0?(0,J.jsx)(`span`,{className:`shrink-0 font-normal tracking-normal normal-case`,children:(0,J.jsx)(Vn,{ts:r})}):null]}),(0,J.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] text-foreground select-text [overflow-wrap:anywhere]`,a.body,`leading-[1.6]`),children:t})]})}function $n({text:e,imageCount:t=0,images:n=[],ts:r,onEdit:i,onRemove:a,editLabel:o=`Edit message`,removeLabel:s=`Remove message`}){let c=t-n.length,[l,u]=(0,q.useState)(!1),[d,f]=(0,q.useState)(e),[p,m]=(0,q.useState)(!1),[h,g]=(0,q.useState)(),v=()=>{f(e),g(void 0),u(!0)},y=async()=>{let t=d.trim();if(!t||t===e){u(!1);return}m(!0),g(void 0);try{await i?.(t),u(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},b=async()=>{m(!0),g(void 0);try{await a?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return l?(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,J.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),u(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},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,J.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,J.jsx)(`button`,{type:`button`,onClick:()=>u(!1),disabled:p,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,J.jsx)(`button`,{type:`button`,onClick:()=>void y(),disabled:p,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:p?(0,J.jsx)(_t,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,J.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,J.jsxs)(Qn,{role:`user`,ts:r,"data-slot":`user-bubble`,className:`group`,children:[i||a?(0,J.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[i?(0,J.jsx)(`button`,{type:`button`,"aria-label":o,onClick:v,disabled:p,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,J.jsx)(qt,{className:`size-3.5`})}):null,a?(0,J.jsx)(`button`,{type:`button`,"aria-label":s,onClick:()=>void b(),disabled:p,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,J.jsx)(_,{className:`size-3.5`})}):null]}):null,h?(0,J.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,J.jsx)(xt,{breaks:!0,children:e}),n.length>0?(0,J.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>ke(e.split(`/`).pop()??``)?(0,J.jsx)(jt,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,J.jsxs)(`a`,{href:Ce(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,J.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,J.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,c>0?(0,J.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[c,` image`,c>1?`s`:``,` attached`]}):null]})}function er({text:e,ts:t}){return(0,J.jsx)(Qn,{role:`agent`,ts:t,"data-slot":`assistant-message`,children:(0,J.jsx)(xt,{children:e})})}var tr={outbound:{classes:`border-message-outbound-border bg-message-outbound-bg`,accent:`text-message-outbound-accent`},inbound:{classes:`border-message-inbound-border bg-message-inbound-bg`,accent:`text-message-inbound-accent`}},nr=`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 rr({block:e,runId:t,taskTitles:n,recipientBackends:r}){return(0,J.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,J.jsx)(ir,{batch:e,runId:t,taskTitles:n,recipientBackends:r},e.id))})}function ir({batch:e,runId:t,taskTitles:n,recipientBackends:r}){let i=Kn(e.messages[0]??{senderRunId:e.senderRunId},t),a=tr[i],o=cr(e.messages.map(e=>i===`outbound`?e.recipientRunId:e.senderRunId)),s=i===`outbound`?`SENT to`:`RECEIVED from`,c=`${s} ${o.map(e=>X(e,n)).join(`, `)}`,l=e.messages[0],u=l?.createdAt??l?.recordedAt,d=l?Yn(l):void 0;return(0,J.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":i,"data-kind":e.kind,className:H(`flex w-full min-w-0 flex-col gap-2 rounded-[8px] border p-3 md:px-4 md:py-[14px]`,a.classes),children:[(0,J.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-start gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-[1.2] font-semibold tracking-[0.6px] uppercase`,a.accent),children:[(0,J.jsx)(`span`,{children:s}),o.map((e,t)=>(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,J.jsx)(W,{className:nr,to:`/tasks/${e}`,"aria-label":`${s} ${X(e,n)}`,children:X(e,n)})]},e))]}),(0,J.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[11px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:qn(e.kind)}),e.messages.length===1&&d?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:d}):null]}),u!==void 0&&Fn(u)!==void 0?(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center justify-self-end gap-1 whitespace-nowrap text-[11px] text-soft-foreground`,children:[e.messages.length>1?`First sent`:null,(0,J.jsx)(Vn,{ts:u})]}):null]}),(0,J.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,J.jsx)(xt,{breaks:!0,children:e.text})}),[...new Set(e.messages.map(e=>e.instruction??(e.delivery===`queued`?`${r?.[e.recipientRunId]===`cursor`?`Queued for delivery. If Cursor is in a turn, delivery waits for that turn to end.`:r?.[e.recipientRunId]?`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`?`Not delivered. The recipient needs a new instruction to resume. A parent can resume its owned worker with --resume; workers cannot resume parents.`:e.state===`destroyed`?`Not delivered. This worker was destroyed.`:void 0)))].map(e=>e?(0,J.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,J.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=Yn(e),i=e.createdAt??e.recordedAt;return(0,J.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,J.jsx)(W,{className:nr,to:`/tasks/${e.recipientRunId}`,"aria-label":`${X(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:X(e.recipientRunId,n)}),r?(0,J.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,J.jsx)(ar,{message:e,runId:t,taskTitles:n}),i!==void 0&&Fn(i)!==void 0?(0,J.jsx)(`span`,{className:`ml-auto whitespace-nowrap`,children:(0,J.jsx)(Vn,{ts:i})}):null]},e.id)})}):null,e.messages.length===1&&l?(0,J.jsx)(ar,{message:l,runId:t,taskTitles:n}):null,(0,J.jsx)(or,{batch:e,heading:c})]})}function ar({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,q.useContext)(vn),o=e.requestId?r.get(e.requestId):void 0,s=e.requestId?o?[o]:[]:i.get(e.messageId)??[],c=e.requestId?`request`:`reply`;return s.length===0?e.requestId||e.outcome?.replyId?(0,J.jsxs)(`p`,{"data-slot":`conversation-connector`,className:`text-xs text-muted-foreground`,children:[`Linked `,c,` is outside loaded history.`]}):null:s.map(e=>{let r=Kn(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,J.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(nr,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,J.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,X(i,n)]},e.message.messageId)})}function or({batch:e,heading:t}){return(0,J.jsxs)(je,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,J.jsxs)(Ae,{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,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,J.jsx)(U,{children:(0,J.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,J.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>sr(e)).map((e,t)=>(0,J.jsxs)(`div`,{children:[(0,J.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,J.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function sr(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:Xn(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 cr(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function lr({note:e}){return e.icon===`handoff`?(0,J.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,J.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,J.jsx)(Xe,{className:`size-3`})}),(0,J.jsx)(`span`,{className:`min-w-0 break-words`,children:e.text})]}):(0,J.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:H(`px-0.5 text-xs`,e.tone===`danger`?`text-danger [.light_&]:text-red-700`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var ur={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function dr({incident:e}){let t=ur[e.provider];return(0,J.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,J.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,J.jsx)(W,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function fr({text:e}){let t=(0,q.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
2
|
`,1)[0]??``,r=n.length<e.length;return(0,J.jsxs)(je,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,J.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,J.jsx)(P,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,J.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,J.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,J.jsx)(xt,{inline:!0,children:n})}),r?(0,J.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,J.jsx)(Ae,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,J.jsx)(U,{children:(0,J.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,J.jsx)(xt,{children:e})})})]})}function pr(){return(0,J.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,J.jsx)(_t,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,J.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var mr={read:Ze,edit:qt,delete:_,move:Gt,search:T,execute:bt,think:Ut,fetch:Re,task:g,plan:c,other:L},hr=e=>e.split(`
|
|
3
3
|
`).length;function gr({text:e,streaming:t}){let[n,r]=(0,q.useState)(!1),i=(0,q.useRef)(null),a=(0,q.useRef)(!0);(0,q.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=hr(e),s=!t&&!n&&o>12;return(0,J.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,J.jsxs)(`div`,{className:`relative`,children:[(0,J.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Sn(e.currentTarget)}:void 0,className:H(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,J.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,J.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,J.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function _r({diffs:e}){return(0,J.jsx)(J.Fragment,{children:e.map((e,t)=>(0,J.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,J.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...vr(e.oldText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...vr(e.newText).map((e,t)=>(0,J.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
4
|
`).map((e,t)=>(0,J.jsx)(yr,{text:e},t))})]},`${e.path}:${t}`))})}function vr(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{_ as n,d as r,f as i,g as a,h as o,m as s,p as c,tn as l,v as u}from"./centered-state-
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{_ as n,d as r,f as i,g as a,h as o,m as s,p as c,tn as l,v as u}from"./centered-state-B5dpq65a.js";import{t as d}from"./utils-Cv6VpwoW.js";e();var f=t();function p({...e}){return(0,f.jsx)(i,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(n,{"data-slot":`dialog-portal`,...e})}function h({className:e,...t}){return(0,f.jsx)(a,{"data-slot":`dialog-overlay`,className:d(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function g({className:e,children:t,showCloseButton:n=!0,...r}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(h,{}),(0,f.jsxs)(s,{"data-slot":`dialog-content`,className:d(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,f.jsxs)(c,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(l,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function _({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:d(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function v({className:e,showCloseButton:t=!1,children:n,...i}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:d(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...i,children:[n,t&&(0,f.jsx)(c,{asChild:!0,children:(0,f.jsx)(r,{variant:`outline`,children:`Close`})})]})}function y({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-title`,className:d(`text-lg leading-none font-semibold`,e),...t})}function b({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:d(`text-sm text-muted-foreground`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(`textarea`,{"data-slot":`textarea`,className:d(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-[var(--task-brand-bg)] px-3 py-2 text-base shadow-none transition-[color,box-shadow] outline-none placeholder:text-soft-foreground 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 md:text-sm`,e),...t})}export{v as a,b as i,p as n,_ as o,g as r,y as s,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,G as i,Ga as a,Gt as o,Or as s,Pt as ee,X as te,Y as ne,_ as c,br as re,d as l,f as ie,g as ae,gr as oe,h as u,ia as se,in as ce,m as d,p as f,qt as le,t as ue,tn as de,v as fe,y as pe,ya as p}from"./centered-state-kOb8j_BL.js";import{_ as me,b as m,t as h,v as he}from"./utils-BW1-Ibnd.js";import{a as ge,i as _e,r as ve}from"./agent-accounts-Bh1l3ZSb.js";import{D as ye,I as be,M as xe,N as Se,r as Ce}from"./prompt-templates-BgXzCOlY.js";import{u as we}from"./project-router-CS_oeLqi.js";import{i as Te,n as Ee,r as De,t as Oe}from"./skills-DFBiAuJG.js";import{t as ke}from"./use-submit-shortcut-KWJsC906.js";var g=n(),_=e(t(),1);function Ae(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function je(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function v(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target)&&!je(e.target))}function Me(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{v(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Ne(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target))}function y(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function b(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{Ne(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function x({...e}){return(0,g.jsx)(ie,{"data-slot":`sheet`,...e})}function Pe({...e}){return(0,g.jsx)(pe,{"data-slot":`sheet-trigger`,...e})}function Fe({...e}){return(0,g.jsx)(f,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,g.jsx)(c,{"data-slot":`sheet-portal`,...e})}function Ie({className:e,...t}){return(0,g.jsx)(ae,{"data-slot":`sheet-overlay`,className:h(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function C({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,g.jsxs)(S,{children:[(0,g.jsx)(Ie,{className:i}),(0,g.jsxs)(d,{"data-slot":`sheet-content`,className:h(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,g.jsxs)(f,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,g.jsx)(de,{className:`size-4`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Le({className:e,...t}){return(0,g.jsx)(`div`,{"data-slot":`sheet-header`,className:h(`flex flex-col gap-1.5 p-4`,e),...t})}function Re({className:e,...t}){return(0,g.jsx)(fe,{"data-slot":`sheet-title`,className:h(`font-semibold text-foreground`,e),...t})}function w({className:e,...t}){return(0,g.jsx)(u,{"data-slot":`sheet-description`,className:h(`text-sm text-muted-foreground`,e),...t})}function T(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(s())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var E={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function ze(e){return he(e.type)?e.type:E[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function Be(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=ze(e)??`application/octet-stream`,a=m(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${me(i)}`),isImage:a}}function Ve(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(ze(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var He=new Set([`/`,`@`]);function Ue(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(He.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function We(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Ge(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function D(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ke(e){let[t,n]=_.useState(null),r=_.useRef(null),i=_.useRef(``),[a]=_.useState(()=>Ge()!==void 0),o=_.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return _.useEffect(()=>o,[o]),{supported:a,recording:t,start:_.useCallback(()=>{if(r.current)return;let t=Ge();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=D(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:_.useCallback(()=>o(),[o]),finish:_.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function O(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var qe=new Map,Je={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Ye({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:s,finishing:c=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:f=!1,idleFeedback:ue,pendingLabel:fe=`Starting task…`,failureHint:pe=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:me=!0,onPendingChange:m,value:he,onValueChange:we,autoFocus:je=!1,mobileCollapsible:v=!1,mobileDisclosureKey:Me,footerStart:Ne,footerEnd:y,sessionControls:b,executionOptions:x,agentOptions:Pe,sendAriaLabel:Fe=`Send`,disabled:S=!1,disabledReason:Ie=`Session closed — Continue to reopen.`,allowEmptySubmit:C=!1,placeholder:Le=`Reply — / for skills, @ for files…`,ariaLabel:Re=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:T=!1,getMentionCandidates:E,ref:ze}){let[He,Ge]=(0,_.useState)(``),D=he??He,O=(0,_.useRef)(D);O.current=D;let Ye=(0,_.useRef)(we);Ye.current=we;let k=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;Ge(t),Ye.current?.(t)},[]),[A,j]=(0,_.useState)([]),M=(0,_.useRef)(A);M.current=A;let[Qe,$e]=(0,_.useState)(!1),N=u||Qe,P=(0,_.useRef)(N);P.current=N;let F=D.trim()!==``||A.length>0,et=!F&&(n!==void 0&&ae||N),tt=!F&&!et&&s!==void 0,nt=et||tt||!F&&d!==void 0,rt=!F&&d?d:Fe,[I,L]=(0,_.useState)(!1),R=(0,_.useRef)(!1),it=(0,_.useRef)(0),z=(0,_.useRef)(!0);(0,_.useEffect)(()=>(z.current=!0,()=>{z.current=!1}),[]);let[B,V]=(0,_.useState)(null),H=N||t&&I,U=()=>P.current||t&&R.current,[W,G]=(0,_.useState)(null),[at,ot]=(0,_.useState)(``),[st,ct]=(0,_.useState)(!1),K=(0,_.useRef)(null),q=(0,_.useId)(),lt=(0,_.useId)(),ut=(0,_.useRef)(new Map),dt=Me===void 0?ut.current:qe,ft=Me??`default`,[,pt]=(0,_.useReducer)(e=>e+1,0),J=dt.get(ft)??!1,mt=v&&!J,ht=(0,_.useRef)(null),Y=(0,_.useRef)(null),gt=oe(w&&st),X=re(),_t=a(),Z=Ke(e=>p(e,{tone:`danger`}));(0,_.useEffect)(()=>{je&&K.current?.focus()},[]),(0,_.useImperativeHandle)(ze,()=>({insertAtCaret:e=>{if(U())return;let t=K.current,n=Ce(O.current,t?.selectionStart??O.current.length,e);k(n.text),Y.current=n.caret,t?.focus()}}),[k,t]);let vt=(0,_.useCallback)(()=>{let e=K.current;if(!e||S||U()){G(null);return}let t=Ue(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&E===void 0)return G(null);t?.trigger===`/`&&ct(!0),G(t)},[w,S,E,t]),Q=(0,_.useMemo)(()=>W===null?[]:W.trigger===`/`?Ee(gt.data??[],W.query,X.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:Te(e)})):(E?.()??[]).filter(e=>De(e,W.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[E,gt.data,W,X.data?.skillUsage]),yt=Q.some(e=>e.value===at)?at:Q[0]?.value,bt=W!==null,xt=(0,_.useCallback)(()=>G(null),[]),St=e=>{let t=K.current;if(!t||W===null||U())return;let n=t.selectionStart??t.value.length,r=We(t.value,W,n,e.insert);W.trigger===`/`&&X.data!==void 0&&se({skillUsage:Oe(X.data.skillUsage,e.insert)}).then(()=>_t.invalidateQueries({queryKey:ce.uiState})).catch(()=>{}),k(r.text),Y.current=r.caret,G(null),t.focus()};(0,_.useLayoutEffect)(()=>{let e=Y.current,t=K.current;e!==null&&t&&(t.setSelectionRange(e,e),Y.current=null)},[D]),(0,_.useLayoutEffect)(()=>{let e=K.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D,J]);let Ct=(0,_.useCallback)(e=>{if(S||U())return;let n=it.current,r=Ve(e,M.current.length);for(let e of r.rejected)p(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!z.current||t&&R.current&&!P.current||n!==it.current||j(t=>t.length>=4?t:[...t,e])},()=>p(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[S,t]),wt=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Ct(t))},Tt=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Ct(t))},$=(0,_.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(S||u||R.current)&&!(a===``&&r.length===0&&!C)){R.current=!0,t&&(it.current+=1),L(!0),V(null),m?.(!0),G(null),i&&!t&&(k(``),j([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),z.current&&t&&me&&(O.current===n&&k(``),M.current===r&&j([]))}catch(e){if(!z.current&&t)return;let a=e instanceof Error?e.message:String(e);t?V(a):(p(a,{tone:`danger`}),i&&(k(e=>e===``?n:`${n}\n${e}`),j(e=>[...r,...e].slice(0,4))))}finally{R.current=!1,z.current&&(m?.(!1),L(!1))}}},[C,S,u,e,t,me,m,k]),Et=(0,_.useCallback)(()=>{S||u||R.current||$(O.current,M.current,!0)},[S,u,$]),Dt=async()=>{if(!(!n||u||R.current)){R.current=!0,L(!0),$e(!0),V(null);try{await n()}catch(e){z.current&&V(e instanceof Error?e.message:String(e))}finally{R.current=!1,z.current&&(L(!1),$e(!1))}}},Ot=e=>{if(bt){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Q.length===0)return;let t=Q.findIndex(e=>e.value===yt),n=e.key===`ArrowDown`?1:-1,r=Q[(t+n+Q.length)%Q.length];ot(r.value);return}if(e.key===`Escape`){e.preventDefault(),xt();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Q.find(e=>e.value===yt);if(t){e.preventDefault(),St(t);return}xt()}}ke({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Et())};(0,_.useEffect)(()=>{if(!T||S)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Ae(e.target))return;let t=Je[e.code];t!==void 0&&(e.preventDefault(),$(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,T,$]);let kt=e=>{if(S||P.current||R.current&&(e||t))return;let n=Z.finish();if(n===``)return;let r=D.trim()===``?n:`${D.replace(/\s*$/,``)} ${n}`;if(e){t&&k(r),$(r,A,!0);return}k(r),Y.current=r.length,K.current?.focus()},At=Z.recording,jt=Z.supported?(0,g.jsxs)(l,{type:`button`,variant:`ghost`,size:`sm`,disabled:S||H,"aria-label":`Start dictation`,title:`Dictation`,className:h(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,mt&&`hidden md:inline-flex`),onClick:()=>{U()||Z.start()},children:[(0,g.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),x||b?null:`Dictation`]}):null,Mt=tt?(0,g.jsxs)(l,{type:`button`,"data-slot":`composer-finish`,"aria-label":c?`Finishing…`:`Finish`,"aria-busy":c||void 0,title:`Close the session and mark this task done`,disabled:I||N||c,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void s?.(),children:[(0,g.jsx)(ne,{"aria-hidden":`true`}),c?`Finishing…`:`Finish`]}):null,Nt=n||N?(0,g.jsxs)(l,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":N?`Stopping…`:`Stop`,"aria-busy":N||void 0,title:N?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:I||N,className:h(`h-11 min-w-11 active:opacity-80`,nt?`w-auto px-3`:`w-11`),onClick:()=>void Dt(),children:[(0,g.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),nt?N?`Stopping…`:`Stop`:null]}):null,Pt=N||I||B!==null||ue!=null,Ft=(0,g.jsx)(g.Fragment,{children:t||n||u?(0,g.jsx)(`div`,{className:h(`overflow-y-auto text-xs leading-5 text-muted-foreground`,f&&!Pt?`h-0`:`px-3 pb-2 md:px-4`,f?Pt&&`min-h-6`:`h-24 md:h-20`),children:(0,g.jsx)(`div`,{id:`${q}-submission`,role:B===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:B===null?void 0:0,className:`break-words`,children:N?`Stopping execution. Your draft is kept.`:I?fe:B===null?ue??null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground`,children:B}),(0,g.jsx)(`p`,{children:pe})]})})}):null}),It=(0,g.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:h(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,x&&`new-task-submission`),children:[x||b?null:jt,y?(0,g.jsx)(`div`,{id:lt,"data-slot":`composer-footer-end`,className:h(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,x&&`mr-auto`,v&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,mt?`hidden md:flex`:`flex`),children:(0,g.jsx)(`div`,{className:`contents`,inert:H||void 0,children:y})}):null,(0,g.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Nt??ie,Mt,!et&&!tt?(0,g.jsxs)(l,{type:`button`,size:`icon-sm`,"aria-label":rt,"aria-busy":I&&!N||void 0,disabled:S||I||N||!F&&!C,className:h(x?`h-12 w-full gap-2 px-6`:b?`h-11 w-auto gap-2 px-5`:`size-11`,!F&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Et,children:[!b&&!F&&d?(0,g.jsx)(be,{"aria-hidden":`true`}):null,x||b||!F&&d?rt:null,b||F||!d?(0,g.jsx)(i,{"aria-hidden":`true`}):null]}):null]})]});return(0,g.jsxs)(ve,{open:bt,onOpenChange:e=>e?void 0:xt(),children:[(0,g.jsx)(_e,{asChild:!0,children:(0,g.jsxs)(`div`,{ref:ht,"data-slot":`composer`,"data-disabled":S||void 0,onDrop:Tt,onDragOver:e=>e.preventDefault(),className:h(x&&`new-task-composer`,b&&`session-composer`,S&&`opacity-80`),children:[(0,g.jsxs)(`div`,{"data-slot":`composer-editor`,className:h(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,x&&`new-task-editor`),children:[A.length>0?(0,g.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pt-3 md:flex-wrap md:overflow-visible`,children:A.map((e,t)=>(0,g.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:H?`Attachment submitted`:`Click to remove`,disabled:H,className:h(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{U()||j(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,g.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,g.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,g.jsx)(de,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,g.jsx)(`label`,{htmlFor:q,className:x?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:x?`Task description`:Re}),(0,g.jsx)(`textarea`,{ref:K,id:q,autoComplete:`off`,rows:1,value:D,disabled:S,readOnly:H,"aria-busy":H||void 0,"aria-describedby":t?`${q}-submission`:void 0,"aria-label":Re,placeholder:S?Ie:Le,className:h(`block min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,mt?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,x&&`md:text-base`),onChange:e=>{U()||(k(e.target.value),vt())},onKeyDown:Ot,onSelect:vt,onPaste:wt}),x?(0,g.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pt-3 pb-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(le,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,b&&At?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:b}):null,At?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Ze,{transcript:At.transcript,startedAt:At.startedAt,insertionDisabled:H,onCancel:Z.cancel,onInsert:()=>kt(!1),onInsertAndSend:()=>kt(!0)}),Nt?(0,g.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Nt}):null]}):(0,g.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[b?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:b}):null,(0,g.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:h(`flex min-w-0 flex-wrap items-center gap-1`,x&&`w-full`),children:[(0,g.jsx)(Xe,{disabled:S||H,onFiles:Ct}),v?(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":J?`Collapse composer`:`Expand composer`,"aria-expanded":J,"aria-controls":y?`${q} ${lt}`:q,onClick:()=>{dt.set(ft,!J),pt()},children:(0,g.jsx)(te,{"aria-hidden":`true`,className:h(`transition-transform motion-reduce:transition-none`,!J&&`rotate-180`)})}):null,(0,g.jsx)(`div`,{className:`contents`,inert:H||void 0,children:Ne}),x||b?(0,g.jsx)(`div`,{children:jt}):null]}),x?null:It]}),x?null:Ft]}),x?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:H||void 0,children:Pe}),(0,g.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:H||void 0,children:x}),It,(0,g.jsx)(`div`,{"data-slot":`composer-feedback`,children:Ft})]}):null]})}),(0,g.jsx)(ge,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{ht.current?.contains(e.target)&&e.preventDefault()},children:(0,g.jsx)(ye,{shouldFilter:!1,value:yt??``,onValueChange:ot,children:(0,g.jsx)(Se,{"data-slot":`composer-menu`,"data-trigger":W?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Q.length===0?(0,g.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:W?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:gt.isPending?`Loading skills…`:`No matching skills.`}):Q.map(e=>(0,g.jsxs)(xe,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>St(e),children:[(0,g.jsx)(`span`,{className:h(`shrink-0 truncate`,e.emphasized&&`font-semibold`,W?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,g.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Xe({disabled:e,onFiles:t}){let n=(0,_.useRef)(null);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,g.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ze({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:a,onInsertAndSend:o}){let s=T(1e3);return(0,g.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,g.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:O(t,s)}),(0,g.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,g.jsx)(de,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:a,children:(0,g.jsx)(ne,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,g.jsx)(i,{"aria-hidden":`true`})})]})}function k(){return(0,g.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,g.jsx)(ue,{icon:(0,g.jsx)(we,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{Fe as a,Le as c,y as d,Me as f,x as i,Re as l,Ye as n,C as o,b as p,T as r,w as s,k as t,Pe as u};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{At as r,G as i,Ga as a,Gt as o,Or as s,Pt as ee,X as te,Y as ne,_ as c,br as re,d as l,f as ie,g as ae,gr as oe,h as u,ia as se,in as ce,m as d,p as f,qt as le,t as ue,tn as de,v as fe,y as pe,ya as p}from"./centered-state-B5dpq65a.js";import{_ as me,b as m,t as h,v as he}from"./utils-Cv6VpwoW.js";import{a as ge,i as _e,r as ve}from"./agent-accounts-xNBY6ogh.js";import{D as ye,I as be,M as xe,N as Se,r as Ce}from"./prompt-templates-xPSqYS6C.js";import{u as we}from"./project-router-JF2eAjIT.js";import{i as Te,n as Ee,r as De,t as Oe}from"./skills-DFBiAuJG.js";import{t as ke}from"./use-submit-shortcut-KWJsC906.js";var g=n(),_=e(t(),1);function Ae(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function je(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function v(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target)&&!je(e.target))}function Me(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{v(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Ne(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||Ae(e.target))}function y(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function b(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{Ne(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function x({...e}){return(0,g.jsx)(ie,{"data-slot":`sheet`,...e})}function Pe({...e}){return(0,g.jsx)(pe,{"data-slot":`sheet-trigger`,...e})}function Fe({...e}){return(0,g.jsx)(f,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,g.jsx)(c,{"data-slot":`sheet-portal`,...e})}function Ie({className:e,...t}){return(0,g.jsx)(ae,{"data-slot":`sheet-overlay`,className:h(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function C({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,g.jsxs)(S,{children:[(0,g.jsx)(Ie,{className:i}),(0,g.jsxs)(d,{"data-slot":`sheet-content`,className:h(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...a,children:[t,r&&(0,g.jsxs)(f,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,g.jsx)(de,{className:`size-4`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Le({className:e,...t}){return(0,g.jsx)(`div`,{"data-slot":`sheet-header`,className:h(`flex flex-col gap-1.5 p-4`,e),...t})}function Re({className:e,...t}){return(0,g.jsx)(fe,{"data-slot":`sheet-title`,className:h(`font-semibold text-foreground`,e),...t})}function w({className:e,...t}){return(0,g.jsx)(u,{"data-slot":`sheet-description`,className:h(`text-sm text-muted-foreground`,e),...t})}function T(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{if(s())return;let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var E={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function ze(e){return he(e.type)?e.type:E[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function Be(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n),i=ze(e)??`application/octet-stream`,a=m(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${me(i)}`),isImage:a}}function Ve(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(ze(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var He=new Set([`/`,`@`]);function Ue(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(He.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function We(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function Ge(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function D(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function Ke(e){let[t,n]=_.useState(null),r=_.useRef(null),i=_.useRef(``),[a]=_.useState(()=>Ge()!==void 0),o=_.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return _.useEffect(()=>o,[o]),{supported:a,recording:t,start:_.useCallback(()=>{if(r.current)return;let t=Ge();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=D(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:_.useCallback(()=>o(),[o]),finish:_.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function O(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var qe=new Map,Je={KeyA:`Yes, approved.`,KeyC:`Continue.`};function Ye({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:s,finishing:c=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:f=!1,idleFeedback:ue,pendingLabel:fe=`Starting task…`,failureHint:pe=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:me=!0,onPendingChange:m,value:he,onValueChange:we,autoFocus:je=!1,mobileCollapsible:v=!1,mobileDisclosureKey:Me,footerStart:Ne,footerEnd:y,sessionControls:b,executionOptions:x,agentOptions:Pe,sendAriaLabel:Fe=`Send`,disabled:S=!1,disabledReason:Ie=`Session closed — Continue to reopen.`,allowEmptySubmit:C=!1,placeholder:Le=`Reply — / for skills, @ for files…`,ariaLabel:Re=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:T=!1,getMentionCandidates:E,ref:ze}){let[He,Ge]=(0,_.useState)(``),D=he??He,O=(0,_.useRef)(D);O.current=D;let Ye=(0,_.useRef)(we);Ye.current=we;let k=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;Ge(t),Ye.current?.(t)},[]),[A,j]=(0,_.useState)([]),M=(0,_.useRef)(A);M.current=A;let[Qe,$e]=(0,_.useState)(!1),N=u||Qe,P=(0,_.useRef)(N);P.current=N;let F=D.trim()!==``||A.length>0,et=!F&&(n!==void 0&&ae||N),tt=!F&&!et&&s!==void 0,nt=et||tt||!F&&d!==void 0,rt=!F&&d?d:Fe,[I,L]=(0,_.useState)(!1),R=(0,_.useRef)(!1),it=(0,_.useRef)(0),z=(0,_.useRef)(!0);(0,_.useEffect)(()=>(z.current=!0,()=>{z.current=!1}),[]);let[B,V]=(0,_.useState)(null),H=N||t&&I,U=()=>P.current||t&&R.current,[W,G]=(0,_.useState)(null),[at,ot]=(0,_.useState)(``),[st,ct]=(0,_.useState)(!1),K=(0,_.useRef)(null),q=(0,_.useId)(),lt=(0,_.useId)(),ut=(0,_.useRef)(new Map),dt=Me===void 0?ut.current:qe,ft=Me??`default`,[,pt]=(0,_.useReducer)(e=>e+1,0),J=dt.get(ft)??!1,mt=v&&!J,ht=(0,_.useRef)(null),Y=(0,_.useRef)(null),gt=oe(w&&st),X=re(),_t=a(),Z=Ke(e=>p(e,{tone:`danger`}));(0,_.useEffect)(()=>{je&&K.current?.focus()},[]),(0,_.useImperativeHandle)(ze,()=>({insertAtCaret:e=>{if(U())return;let t=K.current,n=Ce(O.current,t?.selectionStart??O.current.length,e);k(n.text),Y.current=n.caret,t?.focus()}}),[k,t]);let vt=(0,_.useCallback)(()=>{let e=K.current;if(!e||S||U()){G(null);return}let t=Ue(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&E===void 0)return G(null);t?.trigger===`/`&&ct(!0),G(t)},[w,S,E,t]),Q=(0,_.useMemo)(()=>W===null?[]:W.trigger===`/`?Ee(gt.data??[],W.query,X.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:Te(e)})):(E?.()??[]).filter(e=>De(e,W.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[E,gt.data,W,X.data?.skillUsage]),yt=Q.some(e=>e.value===at)?at:Q[0]?.value,bt=W!==null,xt=(0,_.useCallback)(()=>G(null),[]),St=e=>{let t=K.current;if(!t||W===null||U())return;let n=t.selectionStart??t.value.length,r=We(t.value,W,n,e.insert);W.trigger===`/`&&X.data!==void 0&&se({skillUsage:Oe(X.data.skillUsage,e.insert)}).then(()=>_t.invalidateQueries({queryKey:ce.uiState})).catch(()=>{}),k(r.text),Y.current=r.caret,G(null),t.focus()};(0,_.useLayoutEffect)(()=>{let e=Y.current,t=K.current;e!==null&&t&&(t.setSelectionRange(e,e),Y.current=null)},[D]),(0,_.useLayoutEffect)(()=>{let e=K.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D,J]);let Ct=(0,_.useCallback)(e=>{if(S||U())return;let n=it.current,r=Ve(e,M.current.length);for(let e of r.rejected)p(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!z.current||t&&R.current&&!P.current||n!==it.current||j(t=>t.length>=4?t:[...t,e])},()=>p(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[S,t]),wt=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Ct(t))},Tt=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Ct(t))},$=(0,_.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(S||u||R.current)&&!(a===``&&r.length===0&&!C)){R.current=!0,t&&(it.current+=1),L(!0),V(null),m?.(!0),G(null),i&&!t&&(k(``),j([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),z.current&&t&&me&&(O.current===n&&k(``),M.current===r&&j([]))}catch(e){if(!z.current&&t)return;let a=e instanceof Error?e.message:String(e);t?V(a):(p(a,{tone:`danger`}),i&&(k(e=>e===``?n:`${n}\n${e}`),j(e=>[...r,...e].slice(0,4))))}finally{R.current=!1,z.current&&(m?.(!1),L(!1))}}},[C,S,u,e,t,me,m,k]),Et=(0,_.useCallback)(()=>{S||u||R.current||$(O.current,M.current,!0)},[S,u,$]),Dt=async()=>{if(!(!n||u||R.current)){R.current=!0,L(!0),$e(!0),V(null);try{await n()}catch(e){z.current&&V(e instanceof Error?e.message:String(e))}finally{R.current=!1,z.current&&(L(!1),$e(!1))}}},Ot=e=>{if(bt){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Q.length===0)return;let t=Q.findIndex(e=>e.value===yt),n=e.key===`ArrowDown`?1:-1,r=Q[(t+n+Q.length)%Q.length];ot(r.value);return}if(e.key===`Escape`){e.preventDefault(),xt();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Q.find(e=>e.value===yt);if(t){e.preventDefault(),St(t);return}xt()}}ke({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Et())};(0,_.useEffect)(()=>{if(!T||S)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Ae(e.target))return;let t=Je[e.code];t!==void 0&&(e.preventDefault(),$(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,T,$]);let kt=e=>{if(S||P.current||R.current&&(e||t))return;let n=Z.finish();if(n===``)return;let r=D.trim()===``?n:`${D.replace(/\s*$/,``)} ${n}`;if(e){t&&k(r),$(r,A,!0);return}k(r),Y.current=r.length,K.current?.focus()},At=Z.recording,jt=Z.supported?(0,g.jsxs)(l,{type:`button`,variant:`ghost`,size:`sm`,disabled:S||H,"aria-label":`Start dictation`,title:`Dictation`,className:h(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,mt&&`hidden md:inline-flex`),onClick:()=>{U()||Z.start()},children:[(0,g.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),x||b?null:`Dictation`]}):null,Mt=tt?(0,g.jsxs)(l,{type:`button`,"data-slot":`composer-finish`,"aria-label":c?`Finishing…`:`Finish`,"aria-busy":c||void 0,title:`Close the session and mark this task done`,disabled:I||N||c,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void s?.(),children:[(0,g.jsx)(ne,{"aria-hidden":`true`}),c?`Finishing…`:`Finish`]}):null,Nt=n||N?(0,g.jsxs)(l,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":N?`Stopping…`:`Stop`,"aria-busy":N||void 0,title:N?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:I||N,className:h(`h-11 min-w-11 active:opacity-80`,nt?`w-auto px-3`:`w-11`),onClick:()=>void Dt(),children:[(0,g.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),nt?N?`Stopping…`:`Stop`:null]}):null,Pt=N||I||B!==null||ue!=null,Ft=(0,g.jsx)(g.Fragment,{children:t||n||u?(0,g.jsx)(`div`,{className:h(`overflow-y-auto text-xs leading-5 text-muted-foreground`,f&&!Pt?`h-0`:`px-3 pb-2 md:px-4`,f?Pt&&`min-h-6`:`h-24 md:h-20`),children:(0,g.jsx)(`div`,{id:`${q}-submission`,role:B===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:B===null?void 0:0,className:`break-words`,children:N?`Stopping execution. Your draft is kept.`:I?fe:B===null?ue??null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground`,children:B}),(0,g.jsx)(`p`,{children:pe})]})})}):null}),It=(0,g.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:h(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,x&&`new-task-submission`),children:[x||b?null:jt,y?(0,g.jsx)(`div`,{id:lt,"data-slot":`composer-footer-end`,className:h(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,x&&`mr-auto`,v&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,mt?`hidden md:flex`:`flex`),children:(0,g.jsx)(`div`,{className:`contents`,inert:H||void 0,children:y})}):null,(0,g.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Nt??ie,Mt,!et&&!tt?(0,g.jsxs)(l,{type:`button`,size:`icon-sm`,"aria-label":rt,"aria-busy":I&&!N||void 0,disabled:S||I||N||!F&&!C,className:h(x?`h-12 w-full gap-2 px-6`:b?`h-11 w-auto gap-2 px-5`:`size-11`,!F&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Et,children:[!b&&!F&&d?(0,g.jsx)(be,{"aria-hidden":`true`}):null,x||b||!F&&d?rt:null,b||F||!d?(0,g.jsx)(i,{"aria-hidden":`true`}):null]}):null]})]});return(0,g.jsxs)(ve,{open:bt,onOpenChange:e=>e?void 0:xt(),children:[(0,g.jsx)(_e,{asChild:!0,children:(0,g.jsxs)(`div`,{ref:ht,"data-slot":`composer`,"data-disabled":S||void 0,onDrop:Tt,onDragOver:e=>e.preventDefault(),className:h(x&&`new-task-composer`,b&&`session-composer`,S&&`opacity-80`),children:[(0,g.jsxs)(`div`,{"data-slot":`composer-editor`,className:h(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,x&&`new-task-editor`),children:[A.length>0?(0,g.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pt-3 md:flex-wrap md:overflow-visible`,children:A.map((e,t)=>(0,g.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:H?`Attachment submitted`:`Click to remove`,disabled:H,className:h(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{U()||j(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,g.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,g.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,g.jsx)(de,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,g.jsx)(`label`,{htmlFor:q,className:x?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:x?`Task description`:Re}),(0,g.jsx)(`textarea`,{ref:K,id:q,autoComplete:`off`,rows:1,value:D,disabled:S,readOnly:H,"aria-busy":H||void 0,"aria-describedby":t?`${q}-submission`:void 0,"aria-label":Re,placeholder:S?Ie:Le,className:h(`block min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,mt?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`,x&&`md:text-base`),onChange:e=>{U()||(k(e.target.value),vt())},onKeyDown:Ot,onSelect:vt,onPaste:wt}),x?(0,g.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pt-3 pb-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(le,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,b&&At?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:b}):null,At?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Ze,{transcript:At.transcript,startedAt:At.startedAt,insertionDisabled:H,onCancel:Z.cancel,onInsert:()=>kt(!1),onInsertAndSend:()=>kt(!0)}),Nt?(0,g.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Nt}):null]}):(0,g.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[b?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:b}):null,(0,g.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:h(`flex min-w-0 flex-wrap items-center gap-1`,x&&`w-full`),children:[(0,g.jsx)(Xe,{disabled:S||H,onFiles:Ct}),v?(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":J?`Collapse composer`:`Expand composer`,"aria-expanded":J,"aria-controls":y?`${q} ${lt}`:q,onClick:()=>{dt.set(ft,!J),pt()},children:(0,g.jsx)(te,{"aria-hidden":`true`,className:h(`transition-transform motion-reduce:transition-none`,!J&&`rotate-180`)})}):null,(0,g.jsx)(`div`,{className:`contents`,inert:H||void 0,children:Ne}),x||b?(0,g.jsx)(`div`,{children:jt}):null]}),x?null:It]}),x?null:Ft]}),x?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:H||void 0,children:Pe}),(0,g.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:H||void 0,children:x}),It,(0,g.jsx)(`div`,{"data-slot":`composer-feedback`,children:Ft})]}):null]})}),(0,g.jsx)(ge,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{ht.current?.contains(e.target)&&e.preventDefault()},children:(0,g.jsx)(ye,{shouldFilter:!1,value:yt??``,onValueChange:ot,children:(0,g.jsx)(Se,{"data-slot":`composer-menu`,"data-trigger":W?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Q.length===0?(0,g.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:W?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:gt.isPending?`Loading skills…`:`No matching skills.`}):Q.map(e=>(0,g.jsxs)(xe,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>St(e),children:[(0,g.jsx)(`span`,{className:h(`shrink-0 truncate`,e.emphasized&&`font-semibold`,W?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,g.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Xe({disabled:e,onFiles:t}){let n=(0,_.useRef)(null);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,g.jsx)(ee,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,g.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ze({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:a,onInsertAndSend:o}){let s=T(1e3);return(0,g.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,g.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,g.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:O(t,s)}),(0,g.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,g.jsx)(l,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,g.jsx)(de,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:a,children:(0,g.jsx)(ne,{"aria-hidden":`true`})}),(0,g.jsx)(l,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,g.jsx)(i,{"aria-hidden":`true`})})]})}function k(){return(0,g.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,g.jsx)(ue,{icon:(0,g.jsx)(we,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{Fe as a,Le as c,y as d,Me as f,x as i,Re as l,Ye as n,C as o,b as p,T as r,w as s,k as t,Pe as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-Cv6VpwoW.js";import{r as n}from"./markdown-DMJKzyRf.js";var r=e();function i(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function a(e,t){return`Input tokens: ${i(e)}; output tokens: ${i(t)}`}function o(e,t,r=`compact`){let i=e===void 0?`—`:n(e),a=t===void 0?`—`:n(t);return r===`table`?`${i} / ${a}`:`IN ${i} · OUT ${a}`}function s({inputTokens:e,outputTokens:n,variant:i=`compact`,omitWhenUnknown:s=!0,className:c,title:l}){return s&&e===void 0&&n===void 0?null:(0,r.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":a(e,n),title:l,className:t(`font-mono tabular-nums`,c),children:o(e,n,i)})}function c(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}export{o as i,s as n,a as r,c as t};
|