@wjarka/cezarion 0.14.5 → 0.14.6
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/README.md +4 -1
- package/dist/automations/types.d.ts +2 -0
- package/dist/contract/automations.d.ts +8 -0
- package/dist/contract/delegation.d.ts +1 -0
- package/dist/contract/index.js +5 -1
- package/dist/contract/runs.d.ts +7 -0
- package/dist/contract/skills.d.ts +1 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/delegation/cli.js +5 -3
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/execution-identity.d.ts +92 -4
- package/dist/delegation/execution-identity.js +40 -10
- package/dist/delegation/execution-identity.js.map +1 -1
- package/dist/delegation/provision.js +5 -2
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +1 -0
- package/dist/delegation/service.js +95 -13
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +1 -0
- package/dist/runs/store.d.ts +1 -0
- package/dist/server/server.d.ts +68 -0
- package/dist/workflows/load.d.ts +2 -0
- package/dist/workflows/load.js +5 -0
- package/dist/workflows/load.js.map +1 -1
- package/dist/workflows/run.d.ts +37 -2
- package/dist/workflows/run.js +160 -47
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +5 -1
- package/dist/workflows/types.js +6 -2
- package/dist/workflows/types.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-accounts-4EqNShyp.js → agent-accounts-lP_xK83o.js} +1 -1
- package/web/dist/assets/{alert-dialog-CVF_qvQ8.js → alert-dialog-CmDuefYh.js} +1 -1
- package/web/dist/assets/{collapsible-DVDGHZAE.js → collapsible-BqX8REmY.js} +1 -1
- package/web/dist/assets/{commit-list-BuNsBn8P.js → commit-list-BWvv1H7A.js} +1 -1
- package/web/dist/assets/{compare-variants-BnQ1O8Ix.js → compare-variants-Bg7eLW3z.js} +1 -1
- package/web/dist/assets/{diff-DWmKlqw52.js → diff-0GBum40Q2.js} +2 -2
- package/web/dist/assets/{diff-controls-CuqRa-63.js → diff-controls-HwWHHait.js} +1 -1
- package/web/dist/assets/{diff-stat-BXriPIds.js → diff-stat-mNkhAc5m.js} +1 -1
- package/web/dist/assets/{diff-view-DLPDcgEV.js → diff-view-DW64doDY.js} +1 -1
- package/web/dist/assets/{dropdown-menu-IsTcumXE.js → dropdown-menu-sZjYPcLh.js} +1 -1
- package/web/dist/assets/{git-toolbar-BjMzETip.js → git-toolbar-DBW5EIcY.js} +1 -1
- package/web/dist/assets/{github-BvowTAuy.js → github-CkZ4hWI5.js} +1 -1
- package/web/dist/assets/{image-preview-WXKTY8KT.js → image-preview-DZicGNkU.js} +1 -1
- package/web/dist/assets/{index-Cz3N9b18.js → index-DWWI-B9n.js} +3 -3
- package/web/dist/assets/{markdown-gFxX4dDH.js → markdown-AY2K3kIV.js} +1 -1
- package/web/dist/assets/{pill-BlaWNkHk.js → pill-CcJqA1cL.js} +1 -1
- package/web/dist/assets/{project-router-CX1jLqj-.js → project-router-SwsXRKXs.js} +1 -1
- package/web/dist/assets/{prompt-templates-DwdQcfSc.js → prompt-templates-iV2WD2jy.js} +1 -1
- package/web/dist/assets/{repo-git-DnbE8dR5.js → repo-git-BW3TOs3U.js} +1 -1
- package/web/dist/assets/{run-diff-Mfc85irR.js → run-diff-DPUNj56q.js} +1 -1
- package/web/dist/assets/{run-header-CDO3LV4z.js → run-header-DbDluWoV.js} +1 -1
- package/web/dist/assets/{skills-DHfsyXTQ.js → skills-Dv8Vwv5D.js} +1 -1
- package/web/dist/assets/{tab-link-DhREnUYE.js → tab-link-DSftvkZS.js} +1 -1
- package/web/dist/assets/{task-changes-Cfo-vtEl.js → task-changes-CTCuVls1.js} +1 -1
- package/web/dist/assets/{task-commits-CvK4flXT.js → task-commits-weJQ5GSl.js} +1 -1
- package/web/dist/assets/{task-files-BwVGUObK.js → task-files-B4bUimY8.js} +1 -1
- package/web/dist/assets/{task-thread-g1vc4tKn.js → task-thread-BuXrVB9K.js} +1 -1
- package/web/dist/assets/{textarea-DCP8bOOf.js → textarea-CxRdTWlq.js} +1 -1
- package/web/dist/assets/{thread-loading-D9DbIsIS.js → thread-loading-JlP6dUpX.js} +1 -1
- package/web/dist/assets/{token-metrics-PSnNTJZF.js → token-metrics-Z3UFYbuD.js} +1 -1
- package/web/dist/assets/{utils-DNvmfH6b.js → utils-CUnaAifW.js} +1 -1
- package/web/dist/assets/{workflows-BDdUJIFT.js → workflows-vA27Yi8W.js} +3 -3
- package/web/dist/assets/{zoomable-image-yNqiuVu7.js → zoomable-image-DUE1KFJ0.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{Aa as r,En as i,Gt as a,It as o,Ln as s,Lt as c,Q as l,Rt as u,Sr as d,Ta as f,U as p,Ut as m,Wt as h,Yi as g,Yt as _,Zi as v,br as y,d as b,fr as x,gi as S,in as C,jt as w,l as T,nn as E,ot as D,pr as O,ri as k,sa as A,ti as j,ui as M,vr as N,wa as P}from"./alert-dialog-CVF_qvQ8.js";import{t as F}from"./utils-DNvmfH6b.js";import{a as ee,i as te,n as ne,o as re,r as ie,s as ae}from"./textarea-DCP8bOOf.js";import{T as oe}from"./prompt-templates-DwdQcfSc.js";import{c as I,t as L}from"./project-router-CX1jLqj-.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-Cz3N9b18.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function le(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function Y(e,t){return le(e)??[...t]}function X({projectId:e}){let t=r(),n=y(),s=i(),[c,l]=(0,q.useState)(``),f=O(e,!!e),p=s.data??[],m=(0,q.useMemo)(()=>p.map(e=>e.name),[p]),v=(0,q.useRef)([]);v.current=m;let b=(0,q.useMemo)(()=>new Set(Y(n.data,m)),[n.data,m]),x=(0,q.useRef)(Promise.resolve()),S=(0,q.useRef)(0),E=(0,q.useCallback)(e=>{let n=d.uiState,r=t.getQueryData(n),i=e(Y(r,v.current));t.setQueryData(n,{...r,importedSkills:i});let a=++S.current;x.current=x.current.then(async()=>{try{let e=await g({importedSkills:i});a===S.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:C.skills}))}catch(e){A(e instanceof Error?e.message:String(e),{tone:`danger`}),a===S.current&&t.invalidateQueries({queryKey:n})}})},[t]),D=(0,q.useCallback)(e=>{E(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[E]),k=m.length>0&&m.every(e=>b.has(e)),j=(0,q.useCallback)(()=>{if(k){let e=new Set(v.current);E(t=>t.filter(t=>!e.has(t)))}else E(e=>[...new Set([...e,...v.current])])},[k,E]);if(s.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:s.error.message});let M=z(p,c);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-[10px] 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:ce,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:f.data,loadError:f.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)(u,{"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:c,onChange:e=>l(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:j,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:[k?(0,J.jsx)(w,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),k?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:s.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):M.length>0?M.map(e=>{let t=b.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:()=>D(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(h,{"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)(a,{"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:p.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=r(),a=I(),o=(0,q.useRef)(0),[s,u]=(0,q.useState)(!1),p=f({mutationFn:()=>S({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),a(oe(e))},onError:e=>A(e.message,{tone:`danger`})}),m=(t,n)=>{n.seq===o.current&&(i.setQueryData(d.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:C.skills}),A(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},h=(e,t)=>{t.seq===o.current&&A(e.message,{tone:`danger`})},g=f({mutationFn:t=>M(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),_=f({mutationFn:t=>k(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),v=e=>{let n=++o.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):g.mutate({action:e,seq:n})},y=t?.scopes.some(e=>e.skills.length>0)??!1,x=t?.status===`error`,w=y&&(t?.available||x),T=_.isPending||t?.status===`updating`,E=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],D=t?.scopes.filter(e=>e.updatedAt&&!E.includes(e))??[],O=`Checking installed Open Mercato skills…`;return n?O=`Update status is unavailable right now.`:t?.status===`available`?O=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?O=`Updating installed Open Mercato skills…`:t?.status===`current`?O=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?O=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(O=`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:O}),(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,E.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,E.map(e=>Z(e.scope)).join(`, `),D.length?`; updated: ${D.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),w?(0,J.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:T,onClick:()=>v(`apply`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:F(`size-3.5`,T&&`motion-safe:animate-spin`)}),T?`Updating…`:x?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`check`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`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)(l,{"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:s,onOpenChange:e=>p.isPending?void 0:u(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)(b,{type:`button`,variant:`outline`,disabled:p.isPending,onClick:()=>u(!1),children:`No`}),(0,J.jsx)(b,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.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=x(),t=N(),n=i(),[a]=P(),[o,l]=(0,q.useState)(``),d=r(),h=s(),g=j().projectId??h.data?.bootProject??``,y=f({mutationFn:()=>v(),onSuccess:e=>{d.setQueryData(C.skills,e),A(`Team skills refreshed.`)},onError:e=>A(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let b=V(e.data??[]),S=(n.data?.length??0)>0,w=a.get(`skill`),O=w===Q||w===$||w!==null&&b.some(e=>e.name===w)?w:b[0]?.name??(S?$:Q),k=b.find(e=>e.name===O)??null,M=B(b,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:[S?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":O===$?`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)(D,{"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":O===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)(E,{"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`,w===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(u,{"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=>l(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:y.isPending,onClick:()=>y.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)(c,{"aria-hidden":`true`,className:F(`size-3`,y.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`,w===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…`}):M.length>0?M.map(e=>(0,J.jsx)(pe,{skill:e,active:O===e.name,highlighted:O===$&&e===b[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:b.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`,w===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)(p,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),O===$?(0,J.jsx)(X,{projectId:g}):O===Q?(0,J.jsx)(K,{skills:b}):k?(0,J.jsx)(G,{skill:k,usedBy:H(t.data?.workflows??[],k.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)(T,{icon:(0,J.jsx)(m,{}),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{Aa as r,En as i,Gt as a,It as o,Ln as s,Lt as c,Q as l,Rt as u,Sr as d,Ta as f,U as p,Ut as m,Wt as h,Yi as g,Yt as _,Zi as v,br as y,d as b,fr as x,gi as S,in as C,jt as w,l as T,nn as E,ot as D,pr as O,ri as k,sa as A,ti as j,ui as M,vr as N,wa as P}from"./alert-dialog-CmDuefYh.js";import{t as F}from"./utils-CUnaAifW.js";import{a as ee,i as te,n as ne,o as re,r as ie,s as ae}from"./textarea-CxRdTWlq.js";import{T as oe}from"./prompt-templates-iV2WD2jy.js";import{c as I,t as L}from"./project-router-SwsXRKXs.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-DWWI-B9n.js";import{t as se}from"./skill-empty-hint-oOtzR3v0.js";var q=e(t(),1),J=n(),ce=`https://github.com/open-mercato/skills`;function le(e){let t=e?.importedSkills;if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&!!e)}function Y(e,t){return le(e)??[...t]}function X({projectId:e}){let t=r(),n=y(),s=i(),[c,l]=(0,q.useState)(``),f=O(e,!!e),p=s.data??[],m=(0,q.useMemo)(()=>p.map(e=>e.name),[p]),v=(0,q.useRef)([]);v.current=m;let b=(0,q.useMemo)(()=>new Set(Y(n.data,m)),[n.data,m]),x=(0,q.useRef)(Promise.resolve()),S=(0,q.useRef)(0),E=(0,q.useCallback)(e=>{let n=d.uiState,r=t.getQueryData(n),i=e(Y(r,v.current));t.setQueryData(n,{...r,importedSkills:i});let a=++S.current;x.current=x.current.then(async()=>{try{let e=await g({importedSkills:i});a===S.current&&(t.setQueryData(n,e),t.invalidateQueries({queryKey:C.skills}))}catch(e){A(e instanceof Error?e.message:String(e),{tone:`danger`}),a===S.current&&t.invalidateQueries({queryKey:n})}})},[t]),D=(0,q.useCallback)(e=>{E(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[E]),k=m.length>0&&m.every(e=>b.has(e)),j=(0,q.useCallback)(()=>{if(k){let e=new Set(v.current);E(t=>t.filter(t=>!e.has(t)))}else E(e=>[...new Set([...e,...v.current])])},[k,E]);if(s.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load importable skills`,subtitle:s.error.message});let M=z(p,c);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-[10px] 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:ce,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:f.data,loadError:f.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)(u,{"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:c,onChange:e=>l(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:j,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:[k?(0,J.jsx)(w,{"aria-hidden":`true`,className:`size-4`}):(0,J.jsx)(o,{"aria-hidden":`true`,className:`size-4`}),k?`Remove all`:`Enable all`]})]}),(0,J.jsx)(`div`,{"data-slot":`import-list`,className:`mt-3 flex flex-col gap-1.5`,children:s.isPending?(0,J.jsx)(`p`,{className:`px-1 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):M.length>0?M.map(e=>{let t=b.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:()=>D(e.name),className:`peer absolute inset-0 m-0 size-5 opacity-0`}),t?(0,J.jsx)(h,{"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)(a,{"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:p.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=r(),a=I(),o=(0,q.useRef)(0),[s,u]=(0,q.useState)(!1),p=f({mutationFn:()=>S({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{u(!1),a(oe(e))},onError:e=>A(e.message,{tone:`danger`})}),m=(t,n)=>{n.seq===o.current&&(i.setQueryData(d.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(i.invalidateQueries({queryKey:C.skills}),A(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),u(!0)))},h=(e,t)=>{t.seq===o.current&&A(e.message,{tone:`danger`})},g=f({mutationFn:t=>M(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),_=f({mutationFn:t=>k(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>m(e,t),onError:(e,t)=>h(e,t)}),v=e=>{let n=++o.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):g.mutate({action:e,seq:n})},y=t?.scopes.some(e=>e.skills.length>0)??!1,x=t?.status===`error`,w=y&&(t?.available||x),T=_.isPending||t?.status===`updating`,E=t?.scopes.filter(e=>e.status===`error`||e.status===`unavailable`)??[],D=t?.scopes.filter(e=>e.updatedAt&&!E.includes(e))??[],O=`Checking installed Open Mercato skills…`;return n?O=`Update status is unavailable right now.`:t?.status===`available`?O=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?O=`Updating installed Open Mercato skills…`:t?.status===`current`?O=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?O=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(O=`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:O}),(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,E.length>0?(0,J.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,E.map(e=>Z(e.scope)).join(`, `),D.length?`; updated: ${D.map(e=>Z(e.scope)).join(`, `)}`:``,`.`]}):null]}),w?(0,J.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:T,onClick:()=>v(`apply`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:F(`size-3.5`,T&&`motion-safe:animate-spin`)}),T?`Updating…`:x?`Retry`:`Update now`]}):t?.status===`current`?(0,J.jsxs)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`check`),children:[(0,J.jsx)(c,{"aria-hidden":`true`,className:`size-4`}),`Check again`]}):t?.status===`unavailable`||n?(0,J.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:g.isPending,onClick:()=>v(`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)(l,{"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:s,onOpenChange:e=>p.isPending?void 0:u(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)(b,{type:`button`,variant:`outline`,disabled:p.isPending,onClick:()=>u(!1),children:`No`}),(0,J.jsx)(b,{type:`button`,disabled:p.isPending,onClick:()=>p.mutate(),children:p.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=x(),t=N(),n=i(),[a]=P(),[o,l]=(0,q.useState)(``),d=r(),h=s(),g=j().projectId??h.data?.bootProject??``,y=f({mutationFn:()=>v(),onSuccess:e=>{d.setQueryData(C.skills,e),A(`Team skills refreshed.`)},onError:e=>A(e.message,{tone:`danger`})});if(e.isError)return(0,J.jsx)(T,{icon:(0,J.jsx)(_,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:e.error.message});let b=V(e.data??[]),S=(n.data?.length??0)>0,w=a.get(`skill`),O=w===Q||w===$||w!==null&&b.some(e=>e.name===w)?w:b[0]?.name??(S?$:Q),k=b.find(e=>e.name===O)??null,M=B(b,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:[S?(0,J.jsxs)(L,{to:`/skills?skill=${$}`,"data-slot":`import-skills-row`,"aria-current":O===$?`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)(D,{"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":O===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)(E,{"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`,w===null?`flex`:`hidden`),children:[(0,J.jsxs)(`div`,{className:`sw-search relative w-full min-w-0 flex-1`,children:[(0,J.jsx)(u,{"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=>l(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:y.isPending,onClick:()=>y.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)(c,{"aria-hidden":`true`,className:F(`size-3`,y.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`,w===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…`}):M.length>0?M.map(e=>(0,J.jsx)(pe,{skill:e,active:O===e.name,highlighted:O===$&&e===b[0]},e.path)):(0,J.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:b.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`,w===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)(p,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),O===$?(0,J.jsx)(X,{projectId:g}):O===Q?(0,J.jsx)(K,{skills:b}):k?(0,J.jsx)(G,{skill:k,usedBy:H(t.data?.workflows??[],k.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)(T,{icon:(0,J.jsx)(m,{}),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-CUnaAifW.js";import{t as n}from"./project-router-SwsXRKXs.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{$n as r,Aa as i,Ca as a,Gi as o,Jn as s,Kr as c,Li as l,Qn as u,Ta as d,_i as f,_t as p,d as m,di as h,ea as g,in as _,ji as v,l as y,lt as b,ni as x,sa as S,wn as C,zi as w}from"./alert-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Aa as i,Ca as a,Gi as o,Jn as s,Kr as c,Li as l,Qn as u,Ta as d,_i as f,_t as p,d as m,di as h,ea as g,in as _,ji as v,l as y,lt as b,ni as x,sa as S,wn as C,zi as w}from"./alert-dialog-CmDuefYh.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-CxRdTWlq.js";import{p as M,u as ee}from"./pill-CcJqA1cL.js";import{i as N,n as P,r as F}from"./git-toolbar-DBW5EIcY.js";import{t as I}from"./run-header-DbDluWoV.js";import{t as L}from"./use-submit-shortcut-KWJsC906.js";import{n as R,r as z}from"./index-DWWI-B9n.js";import{t as B}from"./diff-0GBum40Q2.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 r=i(),[a,o]=(0,V.useState)(``),s=c(e),l=(0,V.useRef)(s);l.current=s,(0,V.useEffect)(()=>{t&&o(l.current)},[t]);let u=d({mutationFn:t=>h(e.id,t),onSuccess:t=>{S(`Committed ${t.sha.slice(0,7)}`),n(!1),r.invalidateQueries({queryKey:_.runs.changes(e.id)}),r.invalidateQueries({queryKey:_.runs.all})},onError:e=>S(e.message,{tone:`danger`})}),f=()=>{let e=a.trim();e.length===0||u.isPending||u.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:a,onChange:e=>o(e.target.value),onKeyDown:e=>{L({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:a.trim().length===0||u.isPending,onClick:f,children:u.isPending?`Committing…`:`Commit`})]})]})})}function X(){let{id:e}=a(),t=u(e);return t.isPending?(0,J.jsx)(z,{tab:`changes`}):t.isError?(0,J.jsx)(R,{tab:`changes`,error:t.error}):(0,J.jsx)(Z,{run:t.data})}function Z({run:e}){let t=C(),n=s(),a=r(e.id,ee(e.status)),c=te(),[u,m]=(0,V.useState)(`unified`),[h,v]=(0,V.useState)(!1),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(!1),k=(0,V.useRef)(null),A=i(),j=()=>A.invalidateQueries({queryKey:_.runs.all}),L=e=>S(e.message,{tone:`danger`}),R=d({mutationFn:()=>o(e.id),onSuccess:e=>S(e.upstreamSet?`Pushed ${e.branch} to ${e.remote} (upstream set)`:`Pushed ${e.branch} to ${e.remote}`),onError:L}),z=d({mutationFn:()=>f(e.id),onSuccess:e=>{S(`Draft PR created — ${e.url}`),j()},onError:L}),H=d({mutationFn:()=>w(e.id),onError:e=>{if(e instanceof x&&e.command){navigator.clipboard.writeText(e.command).then(()=>S(`No terminal found — command copied to clipboard.`)).catch(()=>S(`Run manually: ${e.command}`));return}L(e)}}),U=d({mutationFn:t=>l(e.id,t),onError:L}),W=a.isError&&a.error instanceof x&&a.error.status===409,G=q({status:e.status,hasWorktree:!!e.worktreePath&&!W,branch:e.branch,changedFiles:a.data?.stat.files,remote:n.data?.info?.remote,forge:t.data?.forge??null,localHandoff:t.data?.capabilities.localHandoff??!1,hasSession:M(e)!==void 0,prUrl:e.pullRequestUrl}),K=e=>{switch(e){case`commit`:O(!0);break;case`push`:R.mutate();break;case`create-pr`:z.mutate();break;case`open-terminal`:H.mutate();break;case`view-pr`:break}},X=a.data?.files??[],Z=(0,V.useMemo)(()=>F(X),[X]),Q=c?u:`unified`,$=!c||h;return(0,J.jsxs)(`div`,{"data-route":`task-changes`,className:`flex min-h-full flex-col`,children:[(0,J.jsx)(I,{run:e,tab:`changes`}),(0,J.jsx)(P,{bar:G,branch:e.branch,stat:a.data?.stat,mode:Q,wrap:$,onModeChange:m,onWrapChange:v,onAction:K}),a.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:a.data.repointedHead.headBranch}),`, not this task's branch`,` `,(0,J.jsx)(`code`,{children:a.data.repointedHead.taskBranch}),` — showing only what this task changed there.`]}):null,a.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…`}):a.isError?(0,J.jsx)(y,{icon:W?(0,J.jsx)(b,{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:a.error.message}):X.length===0?(0,J.jsx)(y,{icon:(0,J.jsx)(b,{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)(N,{root:Z,selected:T,onSelect:e=>{E(e),k.current?.scrollToPath(e)}})]}),(0,J.jsx)(B,{files:X,viewRef:k,mode:Q,wrap:$,loadFileText:t=>ne(e.id,t),imageSrc:t=>g(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 v(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{$n as r,Ca as i,Qn as a,U as o,Yt as s,_t as c,ct as l,d as u,er as d,l as f,ni as p,tr as m}from"./alert-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$n as r,Ca as i,Qn as a,U as o,Yt as s,_t as c,ct as l,d as u,er as d,l as f,ni as p,tr as m}from"./alert-dialog-CmDuefYh.js";import{u as h}from"./pill-CcJqA1cL.js";import{n as g}from"./diff-controls-HwWHHait.js";import{t as _}from"./run-header-DbDluWoV.js";import{t as v}from"./project-router-SwsXRKXs.js";import{t as y}from"./search-x-I9Q8pgUa.js";import{t as b}from"./diff-stat-mNkhAc5m.js";import{n as x,r as S}from"./index-DWWI-B9n.js";import{t as C}from"./diff-0GBum40Q2.js";import{t as w}from"./use-desktop-BaYgO7YW.js";import{t as T}from"./commit-list-BWvv1H7A.js";var E=e(t(),1),D=n();function O(){let{id:e}=i(),t=a(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}=i(),n=m(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)(_,{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)(f,{icon:(0,D.jsx)(c,{size:16}),tone:n.error instanceof p&&n.error.status===409?`neutral`:`danger`,heading:`h2`,title:n.error instanceof p&&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)(f,{icon:(0,D.jsx)(c,{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=d(e,t),r=w(),[i,a]=(0,E.useState)(`unified`),[l,m]=(0,E.useState)(!1),h=n.isError&&n.error instanceof p&&n.error.status===409,_=r?i:`unified`,x=!r||l;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)(u,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,D.jsxs)(v,{to:`/tasks/${e}/commits`,children:[(0,D.jsx)(o,{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)(g,{mode:i,wrap:l,onModeChange:a,onWrapChange:m})})]}),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)(f,{icon:h?(0,D.jsx)(y,{}):(0,D.jsx)(s,{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)(f,{icon:(0,D.jsx)(c,{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:_,wrap:x,className:`min-w-0`})})]})]})}function j({run:e}){let t=r(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-[15px] 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)(l,{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{Ca as r,Qn as i,Rt as a,Yt as o,Z as s,ct as c,d as l,dt as u,ea as d,l as f,ni as p,rr as m,ut as h}from"./alert-dialog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ca as r,Qn as i,Rt as a,Yt as o,Z as s,ct as c,d as l,dt as u,ea as d,l as f,ni as p,rr as m,ut as h}from"./alert-dialog-CmDuefYh.js";import{t as g}from"./utils-CUnaAifW.js";import{t as _}from"./createLucideIcon-BHp8sXmF.js";import{t as v}from"./run-header-DbDluWoV.js";import{a as y,i as b,r as x}from"./highlighter-CdHqIwFr.js";import{h as S,n as C,r as w}from"./index-DWWI-B9n.js";var T=_(`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`}]]),E=_(`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`}]]),D=_(`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`}]]),O=_(`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`}]]),k=_(`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`}]]),A=e(t(),1),j=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function M(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:j.has(t.slice(n+1).toLowerCase())}function N(e){return e.tooLarge?`too-large`:M(e.path)?`image`:e.binary?`binary`:`text`}function P(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}var F=n();function I({runId:e,path:t,className:n}){let r=m(e,t??void 0);if(t===null)return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:(0,F.jsx)(h,{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,F.jsx)(R,{className:n,children:(0,F.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 p&&r.error.status===409;return(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:e?(0,F.jsx)(D,{}):(0,F.jsx)(o,{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,F.jsx)(L,{runId:e,entry:r.data,className:n}):(0,F.jsx)(R,{className:n,children:(0,F.jsx)(f,{icon:(0,F.jsx)(E,{}),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 L({runId:e,entry:t,className:n}){let r=N(t);return(0,F.jsxs)(R,{className:n,children:[(0,F.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,F.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,F.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:P(t.size)})]}),r===`image`?(0,F.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,F.jsx)(`img`,{"data-slot":`file-preview-image`,src:d(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,F.jsx)(f,{icon:(0,F.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${P(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,F.jsx)(f,{icon:(0,F.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${P(t.size)} of binary data — no text preview.`}):(0,F.jsx)(V,{path:t.path,text:t.content??``})]})}function R({className:e,children:t}){return(0,F.jsx)(`section`,{"data-slot":`file-preview`,className:g(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var z=1500;function B(e,t){let n=(0,A.useMemo)(()=>t.split(`
|
|
2
2
|
`).map(e=>[{content:e}]),[t]),r=(0,A.useMemo)(()=>y(e),[e]),i=n.length>z,[a,o]=(0,A.useState)(null);return(0,A.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(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:b(t,r)?.tokens??n}function V({path:e,text:t}){let n=B(e,t);return(0,F.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":y(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex px-4`,children:[(0,F.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,F.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}function H({runId:e,selected:t,onSelect:n}){return(0,F.jsx)(`nav`,{"data-slot":`files-tree`,"aria-label":`Worktree files`,className:`min-w-0 text-[13px]`,children:(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:``,depth:0,selected:t,onSelect:n})})})}function U({runId:e,path:t,depth:n,selected:r,onSelect:i}){let a=m(e,t);return a.isPending?(0,F.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,F.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,F.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,F.jsx)(F.Fragment,{children:a.data.entries.map(a=>a.type===`dir`?(0,F.jsx)(W,{runId:e,name:a.name,path:t===``?a.name:`${t}/${a.name}`,depth:n,selected:r,onSelect:i},a.name):(0,F.jsx)(G,{name:a.name,path:t===``?a.name:`${t}/${a.name}`,size:a.size,depth:n,selected:r,onSelect:i},a.name))}):null}function W({runId:e,name:t,path:n,depth:r,selected:i,onSelect:a}){let[o,c]=(0,A.useState)(!1);return(0,F.jsxs)(`li`,{children:[(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-dir`,"data-path":n,"data-state":o?`open`:`closed`,"aria-expanded":o,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,F.jsx)(s,{size:16,"aria-hidden":`true`,className:g(`order-last ml-auto size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,o&&`rotate-90`)}),(0,F.jsx)(u,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate font-normal`,children:t})]}),o?(0,F.jsx)(`ul`,{className:`flex flex-col gap-px`,children:(0,F.jsx)(U,{runId:e,path:n,depth:r+1,selected:i,onSelect:a})}):null]})}function G({name:e,path:t,size:n,depth:r,selected:i,onSelect:a}){let o=i===t,s=M(t)?k:c;return(0,F.jsx)(`li`,{children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`files-file`,"data-path":t,"aria-current":o?`true`:void 0,onClick:()=>a(t),className:g(`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,F.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e}),n===void 0?null:(0,F.jsx)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] tabular-nums text-soft-foreground`,children:P(n)})]})})}function K(){let{id:e}=r(),t=i(e);return t.isPending?(0,F.jsx)(w,{tab:`files`}):t.isError?(0,F.jsx)(C,{tab:`files`,error:t.error}):(0,F.jsx)(q,{run:t.data})}function q({run:e}){let t=m(e.id,``),[n,r]=(0,A.useState)(null),[i,s]=(0,A.useState)(``),c=t.isError&&t.error instanceof p&&t.error.status===409;return(0,F.jsxs)(`div`,{"data-route":`task-files`,className:`flex min-h-full flex-col`,children:[(0,F.jsx)(v,{run:e,tab:`files`}),t.isSuccess?(0,F.jsxs)(`form`,{className:`flex min-w-0 gap-2 px-[18px] pt-[22px] md:px-9`,onSubmit:e=>{e.preventDefault(),i.trim()&&r(i.trim())},children:[(0,F.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,F.jsx)(a,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,F.jsx)(S,{"aria-label":`File path in the worktree`,placeholder:`Open a file by path…`,value:i,onChange:e=>s(e.target.value),className:`h-11 min-w-0 bg-card pl-10`})]}),(0,F.jsx)(l,{type:`submit`,variant:`outline`,className:`h-11 shrink-0`,disabled:!i.trim(),children:`Open file`})]}):null,t.isPending?(0,F.jsx)(`p`,{"data-slot":`files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading files…`}):t.isError?(0,F.jsx)(f,{icon:c?(0,F.jsx)(O,{}):(0,F.jsx)(o,{size:16}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`No files to browse`:`Could not load the files`,subtitle:t.error.message}):(0,F.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,F.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,F.jsx)(`h2`,{className:`sr-only`,children:`Worktree files`}),(0,F.jsx)(H,{runId:e.id,selected:n,onSelect:r})]}),(0,F.jsx)(I,{runId:e.id,path:n,className:`min-h-[200px] min-w-0 flex-1 bg-card md:min-h-[400px]`})]}),(0,F.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.`})]})}export{K 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{Aa as r,Ca as i,Da as a,Dt as o,Ea as s,Et as c,Fa as l,Fr as u,H as d,J as f,Jt as p,Kr as m,Ma as h,Mi as g,Mn as _,Ni as v,On as y,Pa as b,Pn as x,Pr as S,Pt as C,Q as w,Qn as T,Rn as E,Rt as D,Ta as O,X as k,Xr as A,Y as j,Z as M,_i as N,at as P,ci as F,cr as ee,d as I,dr as L,en as te,et as ne,fa as R,fn as re,gn as ie,ht as ae,in as z,it as oe,l as se,ma as ce,ni as le,nt as ue,pi as B,qn as de,qt as fe,sa as V,si as pe,sr as me,u as he,xa as ge,xi as _e,xt as ve}from"./alert-dialog-CVF_qvQ8.js";import{C as ye,S as be,T as xe,c as Se,i as Ce,n as we,s as Te,t as H,w as Ee,x as De,y as Oe}from"./utils-DNvmfH6b.js";import{n as U,r as W,t as G}from"./collapsible-DVDGHZAE.js";import{n as ke,s as Ae,t as je}from"./agent-accounts-4EqNShyp.js";import{t as Me}from"./textarea-DCP8bOOf.js";import{t as Ne}from"./createLucideIcon-BHp8sXmF.js";import{D as Pe,_ as Fe,d as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,s as He,u as Ue,x as We}from"./pill-BlaWNkHk.js";import{t as Ge}from"./external-link-BE6y205O.js";import{I as Ke,S as qe,_ as Je,b as Ye,c as Xe,g as Ze,l as Qe,v as $e,x as et}from"./prompt-templates-DwdQcfSc.js";import{a as tt,c as nt,i as rt,l as it,n as at,o as ot,r as st,s as ct,t as lt,u as ut}from"./run-header-CDO3LV4z.js";import{s as dt,t as K,u as ft}from"./project-router-CX1jLqj-.js";import{t as pt}from"./message-square-B-MD-8rD.js";import{t as mt}from"./search-x-I9Q8pgUa.js";import{t as ht}from"./square-terminal-B6RYYieR.js";import{t as gt}from"./markdown-gFxX4dDH.js";import{c as _t,i as vt,l as yt,n as bt,o as xt,s as St,t as Ct}from"./thread-loading-D9DbIsIS.js";import{t as wt}from"./use-submit-shortcut-KWJsC906.js";import{t as Tt}from"./lib-BQXq3kEf.js";import{t as Et}from"./zoomable-image-yNqiuVu7.js";import{t as Dt}from"./run-diff-Mfc85irR.js";import{t as Ot}from"./use-desktop-BaYgO7YW.js";var kt=120;function At(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jt(e){let t=e.replace(/\s+/g,` `).trim();return t.length>kt?`${t.slice(0,kt-1)}…`:t}function q(e,...t){if(At(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return jt(t)}}function Mt(e){if(!At(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return jt(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return jt(e.join(` `))}}function Nt(e){if(!At(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)At(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function Pt(e){return q(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function J(e,t){return t?`${e} ${t}`:e}function Ft(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:J(`Ran`,Mt(t)),subtitle:q(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:J(`Write`,q(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Nt(t);return{toolKind:`edit`,title:J(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:J(`Read`,q(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:J(`View image`,q(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:J(`Search`,q(t,`pattern`,`query`)),subtitle:q(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:J(`Fetch`,q(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:J(`Web search`,q(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=q(t,`subagent_type`,`subagentType`),i=q(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=q(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:q(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=q(t,`server`),n=q(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:Pt(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()!==``?jt(e):`Tool`,subtitle:Pt(t)}}var It=class extends h{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,u=o&&c===`forward`,d=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!u&&!f,isRefetching:a&&!d&&!p}}};function Lt(e,t){return a(e,It,t)}var Rt=Ne(`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`}]]),zt=Ne(`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`}]]),Bt=Ne(`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`}]]),Vt=Ne(`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`}]]),Ht=Ne(`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`}]]),Y=e(t(),1),Ut=[`run-event`,`ui-event`];function Wt(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 Gt(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=Wt(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(Ce(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Ut)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 Kt=5,qt=200,Jt=5e3;function Yt(...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 Xt(e){let t=Te(),n=r(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=Lt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>g(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Kt,retry:1}),c=s({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>v(e,{signal:t}),retry:1}),l=o.isError||c.isError,u=Gt(l?e:void 0),d=o.data?.pages??[],f=d.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),p=(0,Y.useRef)(!1),m=(0,Y.useCallback)(()=>{e===void 0||p.current||(p.current=!0,g(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>Kt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{p.current=!1}))},[n,e,t]),h=Gt(!l&&f?e:void 0,{cursor:f?.liveCursor,afterSeq:f?.asOfSeq,maxEvents:Jt,compactAt:qt,onCompact:m}),_=(0,Y.useMemo)(()=>Yt(...d.map(e=>e.events)),[d]),y=(0,Y.useMemo)(()=>l?u:Yt(_,h),[l,u,_,h]),b=(0,Y.useMemo)(()=>{if(l)return u;let e=c.data?.contextEvents??[],t=c.data?.asOfSeq??0;return Yt(e,y.filter(({seq:e})=>e>t))},[c.data,l,u,y]),x=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),S=(0,Y.useCallback)(async()=>{l||await n.resetQueries({queryKey:i,exact:!0})},[l,i,n]);return{visibleEvents:y,currentEvents:b,isPending:!l&&o.isPending,contextPending:!l&&c.isPending,fallback:l,hasOlder:!l&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:x,jumpToLatest:S,retainedPages:d.length}}var X=n();function Zt({run:e}){let t=r(),n=O({mutationFn:()=>pe(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 i=new Date(e.autoResumeAt);if(!Number.isFinite(i.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(i);return(0,X.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ze,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,X.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,X.jsx)(ce,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var Qt=e=>e.kind===`tool`,$t=e=>e.kind===`conversation`,en=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,tn=(e,t,n)=>`${e} ${e===1?t:n}`;function nn(e,t){let n=[];return e>0&&n.push(tn(e,`file`,`files`)),t>0&&n.push(tn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function rn(e){return`${e} earlier tool call${e===1?``:`s`}`}var an=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function on(e){for(let t of an)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 sn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Qt).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:nn(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 cn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if($t(e)){s(),c.push(e);continue}l(),Qt(e)&&en(e)&&!r.has(e.id)?o.push(e):(s(),Qt(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 cn(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 ln=new Map,un=(0,Y.createContext)(null);function dn(){return(0,Y.useContext)(un)}function fn({runId:e,children:t}){let n=(0,Y.useMemo)(()=>({get:t=>ln.get(e)?.get(t),set:(t,n)=>{let r=ln.get(e)??new Map;r.set(t,n),ln.set(e,r)}}),[e]);return(0,X.jsx)(un.Provider,{value:n,children:t})}var pn=(0,Y.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function mn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function hn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function gn(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 _n(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function vn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var yn=new Map;function bn(e,t){yn.set(e,t)}function xn(e){return yn.get(e)}var Sn=new Map;function Cn(e,t){Sn.set(e,t)}function wn(e,t){let n=Sn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Tn(e,t){let n={[e.id]:m(e)};for(let e of t??[])n[e.id]=m(e);return n}function Z(e,t){return t?.[e]??`Task`}function En(e,t){return e.senderRunId===t?`outbound`:`inbound`}function Dn(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 On(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`;default:return e}}function kn(e){if(e.outcome)return On(e.outcome.status);if(e.messageKind===`request`&&e.delivery===`not-delivered`)return An(`not-delivered`)}function An(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`not-delivered`:return`Not delivered`;default:return e}}var jn={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-md:text-[13px]`}};function Mn({role:e,children:t,className:n,...r}){let i=jn[e];return(0,X.jsxs)(`article`,{...r,"data-role":e,"aria-label":i.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]`,i.classes,n),children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex items-center gap-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(pt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i.label]}),(0,X.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,i.body),children:t})]})}function Nn({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(e),[f,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(),_=()=>{d(e),g(void 0),l(!0)},v=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}m(!0),g(void 0);try{await r?.(t),l(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},y=async()=>{m(!0),g(void 0);try{await i?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return c?(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,X.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,X.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`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,X.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:f,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:f?(0,X.jsx)(ft,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,X.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,className:`group`,children:[r||i?(0,X.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,X.jsx)(`button`,{type:`button`,"aria-label":a,onClick:_,disabled:f,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,X.jsx)(Ht,{className:`size-3.5`})}):null,i?(0,X.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void y(),disabled:f,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,X.jsx)(p,{className:`size-3.5`})}):null]}):null,h?(0,X.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,X.jsx)(gt,{breaks:!0,children:e}),n.length>0?(0,X.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>Oe(e.split(`/`).pop()??``)?(0,X.jsx)(Et,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,X.jsxs)(`a`,{href:Se(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,X.jsx)(C,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,X.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Pn({text:e}){return(0,X.jsx)(Mn,{role:`agent`,"data-slot":`assistant-message`,children:(0,X.jsx)(gt,{children:e})})}var Fn={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`}},In=`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 Ln({block:e,runId:t,taskTitles:n}){return(0,X.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,X.jsx)(Rn,{batch:e,runId:t,taskTitles:n},e.id))})}function Rn({batch:e,runId:t,taskTitles:n}){let r=En(e.messages[0]??{senderRunId:e.senderRunId},t),i=Fn[r],a=Hn(e.messages.map(e=>r===`outbound`?e.recipientRunId:e.senderRunId)),o=r===`outbound`?`SENT to`:`RECEIVED from`,s=`${o} ${a.map(e=>Z(e,n)).join(`, `)}`,c=e.messages[0],l=c?kn(c):void 0;return(0,X.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":r,"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]`,i.classes),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(`span`,{children:o}),a.map((e,t)=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,X.jsx)(K,{className:In,to:`/tasks/${e}`,"aria-label":`${o} ${Z(e,n)}`,children:Z(e,n)})]},e))]}),(0,X.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:Dn(e.kind)}),e.kind===`request`&&e.messages.length===1&&l?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:l}):null]}),(0,X.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,X.jsx)(gt,{breaks:!0,children:e.text})}),e.kind===`request`&&e.messages.length>1?(0,X.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=kn(e);return(0,X.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(K,{className:In,to:`/tasks/${e.recipientRunId}`,"aria-label":`${Z(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:Z(e.recipientRunId,n)}),r?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,X.jsx)(zn,{message:e,runId:t,taskTitles:n})]},e.id)})}):null,e.messages.length===1&&c?(0,X.jsx)(zn,{message:c,runId:t,taskTitles:n}):null,(0,X.jsx)(Bn,{batch:e,heading:s})]})}function zn({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,Y.useContext)(pn),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,X.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=En(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(In,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,Z(i,n)]},e.message.messageId)})}function Bn({batch:e,heading:t}){return(0,X.jsxs)(G,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,X.jsxs)(W,{type:`button`,className:`inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-left text-xs font-medium text-muted-foreground hover:bg-background/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,X.jsx)(U,{children:(0,X.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>Vn(e)).map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,X.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function Vn(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:An(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.deadline&&t.push({label:`Deadline`,value:e.deadline}),e.requestHash&&t.push({label:`Hash`,value:e.requestHash}),t}function Hn(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Un({note:e}){return(0,X.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 Wn={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function Gn({incident:e}){let t=Wn[e.provider];return(0,X.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,X.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,X.jsx)(K,{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 Kn({text:e}){let t=(0,Y.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{Aa as r,Ca as i,Da as a,Dt as o,Ea as s,Et as c,Fa as l,Fr as u,H as d,J as f,Jt as p,Kr as m,Ma as h,Mi as g,Mn as _,Ni as v,On as y,Pa as b,Pn as x,Pr as S,Pt as C,Q as w,Qn as T,Rn as E,Rt as D,Ta as O,X as k,Xr as A,Y as j,Z as M,_i as N,at as P,ci as F,cr as ee,d as I,dr as L,en as te,et as ne,fa as R,fn as re,gn as ie,ht as ae,in as z,it as oe,l as se,ma as ce,ni as le,nt as ue,pi as B,qn as de,qt as fe,sa as V,si as pe,sr as me,u as he,xa as ge,xi as _e,xt as ve}from"./alert-dialog-CmDuefYh.js";import{C as ye,S as be,T as xe,c as Se,i as Ce,n as we,s as Te,t as H,w as Ee,x as De,y as Oe}from"./utils-CUnaAifW.js";import{n as U,r as W,t as G}from"./collapsible-BqX8REmY.js";import{n as ke,s as Ae,t as je}from"./agent-accounts-lP_xK83o.js";import{t as Me}from"./textarea-CxRdTWlq.js";import{t as Ne}from"./createLucideIcon-BHp8sXmF.js";import{D as Pe,_ as Fe,d as Ie,h as Le,j as Re,k as ze,l as Be,m as Ve,s as He,u as Ue,x as We}from"./pill-CcJqA1cL.js";import{t as Ge}from"./external-link-BE6y205O.js";import{I as Ke,S as qe,_ as Je,b as Ye,c as Xe,g as Ze,l as Qe,v as $e,x as et}from"./prompt-templates-iV2WD2jy.js";import{a as tt,c as nt,i as rt,l as it,n as at,o as ot,r as st,s as ct,t as lt,u as ut}from"./run-header-DbDluWoV.js";import{s as dt,t as K,u as ft}from"./project-router-SwsXRKXs.js";import{t as pt}from"./message-square-B-MD-8rD.js";import{t as mt}from"./search-x-I9Q8pgUa.js";import{t as ht}from"./square-terminal-B6RYYieR.js";import{t as gt}from"./markdown-AY2K3kIV.js";import{c as _t,i as vt,l as yt,n as bt,o as xt,s as St,t as Ct}from"./thread-loading-JlP6dUpX.js";import{t as wt}from"./use-submit-shortcut-KWJsC906.js";import{t as Tt}from"./lib-BQXq3kEf.js";import{t as Et}from"./zoomable-image-DUE1KFJ0.js";import{t as Dt}from"./run-diff-DPUNj56q.js";import{t as Ot}from"./use-desktop-BaYgO7YW.js";var kt=120;function At(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function jt(e){let t=e.replace(/\s+/g,` `).trim();return t.length>kt?`${t.slice(0,kt-1)}…`:t}function q(e,...t){if(At(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return jt(t)}}function Mt(e){if(!At(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return jt(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return jt(e.join(` `))}}function Nt(e){if(!At(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)At(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function Pt(e){return q(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function J(e,t){return t?`${e} ${t}`:e}function Ft(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:J(`Ran`,Mt(t)),subtitle:q(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:J(`Write`,q(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:J(`Edit`,q(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Nt(t);return{toolKind:`edit`,title:J(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:J(`Read`,q(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:J(`View image`,q(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:J(`Search`,q(t,`pattern`,`query`)),subtitle:q(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:J(`Fetch`,q(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:J(`Web search`,q(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=q(t,`subagent_type`,`subagentType`),i=q(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=q(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:q(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=q(t,`server`),n=q(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:Pt(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()!==``?jt(e):`Tool`,subtitle:Pt(t)}}var It=class extends h{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,u=o&&c===`forward`,d=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:b(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!u&&!f,isRefetching:a&&!d&&!p}}};function Lt(e,t){return a(e,It,t)}var Rt=Ne(`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`}]]),zt=Ne(`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`}]]),Bt=Ne(`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`}]]),Vt=Ne(`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`}]]),Ht=Ne(`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`}]]),Y=e(t(),1),Ut=[`run-event`,`ui-event`];function Wt(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 Gt(e,t={}){let[n,r]=(0,Y.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,Y.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=Wt(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(Ce(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of Ut)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 Kt=5,qt=200,Jt=5e3;function Yt(...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 Xt(e){let t=Te(),n=r(),i=[`run-history`,t,e],a=[`run-history-context`,t,e],o=Lt({queryKey:i,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>g(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:Kt,retry:1}),c=s({queryKey:a,enabled:e!==void 0,queryFn:({signal:t})=>v(e,{signal:t}),retry:1}),l=o.isError||c.isError,u=Gt(l?e:void 0),d=o.data?.pages??[],f=d.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),p=(0,Y.useRef)(!1),m=(0,Y.useCallback)(()=>{e===void 0||p.current||(p.current=!0,g(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>Kt;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{p.current=!1}))},[n,e,t]),h=Gt(!l&&f?e:void 0,{cursor:f?.liveCursor,afterSeq:f?.asOfSeq,maxEvents:Jt,compactAt:qt,onCompact:m}),_=(0,Y.useMemo)(()=>Yt(...d.map(e=>e.events)),[d]),y=(0,Y.useMemo)(()=>l?u:Yt(_,h),[l,u,_,h]),b=(0,Y.useMemo)(()=>{if(l)return u;let e=c.data?.contextEvents??[],t=c.data?.asOfSeq??0;return Yt(e,y.filter(({seq:e})=>e>t))},[c.data,l,u,y]),x=(0,Y.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),S=(0,Y.useCallback)(async()=>{l||await n.resetQueries({queryKey:i,exact:!0})},[l,i,n]);return{visibleEvents:y,currentEvents:b,isPending:!l&&o.isPending,contextPending:!l&&c.isPending,fallback:l,hasOlder:!l&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:x,jumpToLatest:S,retainedPages:d.length}}var X=n();function Zt({run:e}){let t=r(),n=O({mutationFn:()=>pe(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 i=new Date(e.autoResumeAt);if(!Number.isFinite(i.getTime()))return null;let a=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(i);return(0,X.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(ze,{tone:`pending`,pulse:!0}),(0,X.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,X.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:a})]}),(0,X.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,X.jsx)(ce,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var Qt=e=>e.kind===`tool`,$t=e=>e.kind===`conversation`,en=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,tn=(e,t,n)=>`${e} ${e===1?t:n}`;function nn(e,t){let n=[];return e>0&&n.push(tn(e,`file`,`files`)),t>0&&n.push(tn(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function rn(e){return`${e} earlier tool call${e===1?``:`s`}`}var an=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function on(e){for(let t of an)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 sn(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(Qt).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:nn(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 cn(c).batches)a.push({kind:`worker-conversation`,id:`worker:${e.messages[0].id}`,batches:[e]});c=[]}};for(let e of i){if($t(e)){s(),c.push(e);continue}l(),Qt(e)&&en(e)&&!r.has(e.id)?o.push(e):(s(),Qt(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 cn(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 ln=new Map,un=(0,Y.createContext)(null);function dn(){return(0,Y.useContext)(un)}function fn({runId:e,children:t}){let n=(0,Y.useMemo)(()=>({get:t=>ln.get(e)?.get(t),set:(t,n)=>{let r=ln.get(e)??new Map;r.set(t,n),ln.set(e,r)}}),[e]);return(0,X.jsx)(un.Provider,{value:n,children:t})}var pn=(0,Y.createContext)({targets:new Map,replies:new Map,navigate:()=>{}});function mn(e){return e.scrollTop<Math.max(600,e.clientHeight)}function hn(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function gn(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 _n(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function vn(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var yn=new Map;function bn(e,t){yn.set(e,t)}function xn(e){return yn.get(e)}var Sn=new Map;function Cn(e,t){Sn.set(e,t)}function wn(e,t){let n=Sn.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Tn(e,t){let n={[e.id]:m(e)};for(let e of t??[])n[e.id]=m(e);return n}function Z(e,t){return t?.[e]??`Task`}function En(e,t){return e.senderRunId===t?`outbound`:`inbound`}function Dn(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 On(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`;default:return e}}function kn(e){if(e.outcome)return On(e.outcome.status);if(e.messageKind===`request`&&e.delivery===`not-delivered`)return An(`not-delivered`)}function An(e){switch(e){case`queued`:return`Queued`;case`delivered`:return`Delivered`;case`not-delivered`:return`Not delivered`;default:return e}}var jn={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-md:text-[13px]`}};function Mn({role:e,children:t,className:n,...r}){let i=jn[e];return(0,X.jsxs)(`article`,{...r,"data-role":e,"aria-label":i.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]`,i.classes,n),children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex items-center gap-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(pt,{"aria-hidden":`true`,className:`size-4 shrink-0`}),i.label]}),(0,X.jsx)(`div`,{className:H(`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,i.body),children:t})]})}function Nn({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(e),[f,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(),_=()=>{d(e),g(void 0),l(!0)},v=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}m(!0),g(void 0);try{await r?.(t),l(!1)}catch(e){g(e instanceof Error?e.message:`Could not save the message`)}finally{m(!1)}},y=async()=>{m(!0),g(void 0);try{await i?.()}catch(e){g(e instanceof Error?e.message:`Could not remove the message`)}finally{m(!1)}};return c?(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,"data-editing":`true`,children:[(0,X.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),v())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,X.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`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,X.jsx)(`button`,{type:`button`,onClick:()=>void v(),disabled:f,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:f?(0,X.jsx)(ft,{className:`size-3.5 animate-spin`}):`Save`})]}),h?(0,X.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:h}):null]}):(0,X.jsxs)(Mn,{role:`user`,"data-slot":`user-bubble`,className:`group`,children:[r||i?(0,X.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,X.jsx)(`button`,{type:`button`,"aria-label":a,onClick:_,disabled:f,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,X.jsx)(Ht,{className:`size-3.5`})}):null,i?(0,X.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void y(),disabled:f,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,X.jsx)(p,{className:`size-3.5`})}):null]}):null,h?(0,X.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:h}):null,(0,X.jsx)(gt,{breaks:!0,children:e}),n.length>0?(0,X.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap items-center justify-end gap-1.5`,children:n.map(e=>Oe(e.split(`/`).pop()??``)?(0,X.jsx)(Et,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e):(0,X.jsxs)(`a`,{href:Se(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,X.jsx)(C,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`truncate`,children:e.split(`/`).pop()})]},e))}):null,s>0?(0,X.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Pn({text:e}){return(0,X.jsx)(Mn,{role:`agent`,"data-slot":`assistant-message`,children:(0,X.jsx)(gt,{children:e})})}var Fn={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`}},In=`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 Ln({block:e,runId:t,taskTitles:n}){return(0,X.jsx)(`div`,{"data-slot":`worker-conversation`,className:`flex min-w-0 flex-col gap-2`,children:e.batches.map(e=>(0,X.jsx)(Rn,{batch:e,runId:t,taskTitles:n},e.id))})}function Rn({batch:e,runId:t,taskTitles:n}){let r=En(e.messages[0]??{senderRunId:e.senderRunId},t),i=Fn[r],a=Hn(e.messages.map(e=>r===`outbound`?e.recipientRunId:e.senderRunId)),o=r===`outbound`?`SENT to`:`RECEIVED from`,s=`${o} ${a.map(e=>Z(e,n)).join(`, `)}`,c=e.messages[0],l=c?kn(c):void 0;return(0,X.jsxs)(`article`,{"data-slot":`worker-conversation-card`,"data-direction":r,"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]`,i.classes),children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsxs)(`p`,{className:H(`m-0 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] leading-none font-semibold tracking-[0.6px] uppercase`,i.accent),children:[(0,X.jsx)(`span`,{children:o}),a.map((e,t)=>(0,X.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-x-2 normal-case tracking-normal`,children:[t>0?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`,`}):null,(0,X.jsx)(K,{className:In,to:`/tasks/${e}`,"aria-label":`${o} ${Z(e,n)}`,children:Z(e,n)})]},e))]}),(0,X.jsx)(`span`,{"data-slot":`conversation-kind`,className:`rounded-full bg-background/60 px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-foreground uppercase`,children:Dn(e.kind)}),e.kind===`request`&&e.messages.length===1&&l?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,className:`text-xs font-medium text-muted-foreground`,children:l}):null]}),(0,X.jsx)(`div`,{className:`min-w-0 break-words text-[14px] leading-[1.6] text-foreground select-text [overflow-wrap:anywhere]`,children:(0,X.jsx)(gt,{breaks:!0,children:e.text})}),e.kind===`request`&&e.messages.length>1?(0,X.jsx)(`ul`,{className:`grid min-w-0 gap-1 text-xs text-muted-foreground`,children:e.messages.map(e=>{let r=kn(e);return(0,X.jsxs)(`li`,{className:`flex min-h-11 min-w-0 flex-wrap items-center gap-2`,children:[(0,X.jsx)(K,{className:In,to:`/tasks/${e.recipientRunId}`,"aria-label":`${Z(e.recipientRunId,n)}${r?` — ${r}`:``}`,children:Z(e.recipientRunId,n)}),r?(0,X.jsx)(`span`,{"data-slot":`conversation-outcome`,children:r}):null,(0,X.jsx)(zn,{message:e,runId:t,taskTitles:n})]},e.id)})}):null,e.messages.length===1&&c?(0,X.jsx)(zn,{message:c,runId:t,taskTitles:n}):null,(0,X.jsx)(Bn,{batch:e,heading:s})]})}function zn({message:e,runId:t,taskTitles:n}){let{targets:r,replies:i,navigate:a}=(0,Y.useContext)(pn),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,X.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=En(e.message,t)===`outbound`,i=r?e.message.recipientRunId:e.message.senderRunId;return(0,X.jsxs)(`button`,{type:`button`,"data-slot":`conversation-connector`,className:H(In,`w-fit gap-1.5 text-xs text-muted-foreground`),onClick:()=>a(e),children:[(0,X.jsx)(`span`,{"aria-hidden":!0,children:`↗`}),`View `,c,` `,r?`to`:`from`,` `,Z(i,n)]},e.message.messageId)})}function Bn({batch:e,heading:t}){return(0,X.jsxs)(G,{"data-slot":`conversation-details`,className:`group/details`,children:[(0,X.jsxs)(W,{type:`button`,className:`inline-flex min-h-11 min-w-11 items-center gap-1.5 rounded-md px-2 text-left text-xs font-medium text-muted-foreground hover:bg-background/40 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[(0,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/details:rotate-90`}),`Details`]}),(0,X.jsx)(U,{children:(0,X.jsxs)(`dl`,{className:`grid min-w-0 gap-1 break-all px-2 pb-1 font-mono text-[11px] text-muted-foreground`,children:[(0,X.jsx)(`div`,{className:`sr-only`,children:t}),e.messages.flatMap(e=>Vn(e)).map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`dt`,{className:`inline font-sans font-medium text-soft-foreground`,children:[e.label,`: `]}),(0,X.jsx)(`dd`,{className:`inline`,children:e.value})]},`${e.label}:${e.value}:${t}`))]})})]})}function Vn(e){let t=[{label:`Message`,value:e.messageId},{label:`Sender`,value:e.senderRunId},{label:`Recipient`,value:e.recipientRunId},{label:`Delivery`,value:An(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.deadline&&t.push({label:`Deadline`,value:e.deadline}),e.requestHash&&t.push({label:`Hash`,value:e.requestHash}),t}function Hn(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}function Un({note:e}){return(0,X.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 Wn={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`,cursor:`Cursor`};function Gn({incident:e}){let t=Wn[e.provider];return(0,X.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,X.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,X.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,X.jsx)(K,{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 Kn({text:e}){let t=(0,Y.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
2
|
`,1)[0]??``,r=n.length<e.length;return(0,X.jsxs)(G,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,X.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,X.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,X.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,X.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,X.jsx)(gt,{inline:!0,children:n})}),r?(0,X.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,X.jsx)(W,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,X.jsx)(U,{children:(0,X.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,X.jsx)(gt,{children:e})})})]})}function qn(){return(0,X.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,X.jsx)(ft,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,X.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var Jn={read:ut,edit:Ht,delete:p,move:Bt,search:D,execute:ht,think:Rt,fetch:Re,task:f,plan:o,other:te},Yn=e=>e.split(`
|
|
3
3
|
`).length;function Xn({text:e,streaming:t}){let[n,r]=(0,Y.useState)(!1),i=(0,Y.useRef)(null),a=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Yn(e),s=!t&&!n&&o>12;return(0,X.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=_n(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,X.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,X.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,X.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Zn({diffs:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,X.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Qn(e.oldText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Qn(e.newText).map((e,t)=>(0,X.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
4
|
`).map((e,t)=>(0,X.jsx)($n,{text:e},t))})]},`${e.path}:${t}`))})}function Qn(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"./alert-dialog-
|
|
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"./alert-dialog-CmDuefYh.js";import{t as d}from"./utils-CUnaAifW.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{Aa as r,At as i,G as a,Gt as o,Pt as s,X as ee,Y as te,_ as ne,d as c,f as l,fr as re,g as ie,h as ae,hr as oe,in as se,l as u,m as d,p as ce,qi as le,qt as ue,sa as f,tn as de,v as fe,y as pe}from"./alert-dialog-CVF_qvQ8.js";import{_ as me,b as he,t as p,v as m}from"./utils-DNvmfH6b.js";import{a as ge,i as _e,r as ve}from"./agent-accounts-4EqNShyp.js";import{E as ye,F as be,M as xe,j as Se,r as Ce}from"./prompt-templates-DwdQcfSc.js";import{u as we}from"./project-router-CX1jLqj-.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 h=n(),g=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 Me(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 _(e,t){let n=g.useRef(t);g.useLayoutEffect(()=>{n.current=t}),g.useEffect(()=>{let t=t=>{Me(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 Pe(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function v(e,t){let n=g.useRef(t);g.useLayoutEffect(()=>{n.current=t}),g.useEffect(()=>{let t=t=>{Ne(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function y({...e}){return(0,h.jsx)(l,{"data-slot":`sheet`,...e})}function Fe({...e}){return(0,h.jsx)(pe,{"data-slot":`sheet-trigger`,...e})}function b({...e}){return(0,h.jsx)(ce,{"data-slot":`sheet-close`,...e})}function Ie({...e}){return(0,h.jsx)(ne,{"data-slot":`sheet-portal`,...e})}function Le({className:e,...t}){return(0,h.jsx)(ie,{"data-slot":`sheet-overlay`,className:p(`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 x({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,h.jsxs)(Ie,{children:[(0,h.jsx)(Le,{className:i}),(0,h.jsxs)(d,{"data-slot":`sheet-content`,className:p(`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,h.jsxs)(ce,{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,h.jsx)(de,{className:`size-4`}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Re({className:e,...t}){return(0,h.jsx)(`div`,{"data-slot":`sheet-header`,className:p(`flex flex-col gap-1.5 p-4`,e),...t})}function S({className:e,...t}){return(0,h.jsx)(fe,{"data-slot":`sheet-title`,className:p(`font-semibold text-foreground`,e),...t})}function ze({className:e,...t}){return(0,h.jsx)(ae,{"data-slot":`sheet-description`,className:p(`text-sm text-muted-foreground`,e),...t})}function C(e){let[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var w={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 T(e){return m(e.type)?e.type:w[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=T(e)??`application/octet-stream`,a=he(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(T(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 E=new Set([`/`,`@`]);function He(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(E.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Ue(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 We(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Ge(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]=g.useState(null),r=g.useRef(null),i=g.useRef(``),[a]=g.useState(()=>We()!==void 0),o=g.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 g.useEffect(()=>o,[o]),{supported:a,recording:t,start:g.useCallback(()=>{if(r.current)return;let t=We();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=Ge(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:g.useCallback(()=>o(),[o]),finish:g.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 qe(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var Je=new Map,Ye={KeyA:`Yes, approved.`,KeyC:`Continue.`};function D({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:ne,finishing:l=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:ce=!1,idleFeedback:fe,pendingLabel:pe=`Starting task…`,failureHint:me=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:he=!0,onPendingChange:m,value:we,onValueChange:je,autoFocus:Me=!1,mobileCollapsible:_=!1,mobileDisclosureKey:Ne,footerStart:Pe,footerEnd:v,sessionControls:y,sessionModel:Fe,executionOptions:b,agentOptions:Ie,sendAriaLabel:Le=`Send`,disabled:x=!1,disabledReason:Re=`Session closed — Continue to reopen.`,allowEmptySubmit:S=!1,placeholder:ze=`Reply — / for skills, @ for files…`,ariaLabel:C=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:T=!1,getMentionCandidates:E,ref:We}){let[Ge,qe]=(0,g.useState)(``),D=we??Ge,O=(0,g.useRef)(D);O.current=D;let Qe=(0,g.useRef)(je);Qe.current=je;let k=(0,g.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;qe(t),Qe.current?.(t)},[]),[A,j]=(0,g.useState)([]),M=(0,g.useRef)(A);M.current=A;let[$e,et]=(0,g.useState)(!1),N=u||$e,P=(0,g.useRef)(N);P.current=N;let F=D.trim()!==``||A.length>0,tt=!F&&(n!==void 0&&ae||N),nt=!F&&!tt&&ne!==void 0,rt=tt||nt||!F&&d!==void 0,it=!F&&d?d:Le,[I,L]=(0,g.useState)(!1),R=(0,g.useRef)(!1),at=(0,g.useRef)(0),z=(0,g.useRef)(!0);(0,g.useEffect)(()=>(z.current=!0,()=>{z.current=!1}),[]);let[B,V]=(0,g.useState)(null),H=N||t&&I,U=()=>P.current||t&&R.current,[W,G]=(0,g.useState)(null),[ot,st]=(0,g.useState)(``),[ct,lt]=(0,g.useState)(!1),K=(0,g.useRef)(null),q=(0,g.useId)(),ut=(0,g.useId)(),dt=(0,g.useRef)(new Map),ft=Ne===void 0?dt.current:Je,pt=Ne??`default`,[,mt]=(0,g.useReducer)(e=>e+1,0),J=ft.get(pt)??!1,ht=_&&!J,gt=(0,g.useRef)(null),Y=(0,g.useRef)(null),_t=re(w&&ct),vt=oe(),yt=r(),X=Ke(e=>f(e,{tone:`danger`}));(0,g.useEffect)(()=>{Me&&K.current?.focus()},[]),(0,g.useImperativeHandle)(We,()=>({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 bt=(0,g.useCallback)(()=>{let e=K.current;if(!e||x||U()){G(null);return}let t=He(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&E===void 0)return G(null);t?.trigger===`/`&<(!0),G(t)},[w,x,E,t]),Z=(0,g.useMemo)(()=>W===null?[]:W.trigger===`/`?Ee(_t.data??[],W.query,vt.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,_t.data,W,vt.data?.skillUsage]),xt=Z.some(e=>e.value===ot)?ot:Z[0]?.value,St=W!==null,Ct=(0,g.useCallback)(()=>G(null),[]),wt=e=>{let t=K.current;if(!t||W===null||U())return;let n=t.selectionStart??t.value.length,r=Ue(t.value,W,n,e.insert);W.trigger===`/`&&vt.data!==void 0&&le({skillUsage:Oe(vt.data.skillUsage,e.insert)}).then(()=>yt.invalidateQueries({queryKey:se.uiState})).catch(()=>{}),k(r.text),Y.current=r.caret,G(null),t.focus()};(0,g.useLayoutEffect)(()=>{let e=Y.current,t=K.current;e!==null&&t&&(t.setSelectionRange(e,e),Y.current=null)},[D]),(0,g.useLayoutEffect)(()=>{let e=K.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D,J]);let Tt=(0,g.useCallback)(e=>{if(x||U())return;let n=at.current,r=Ve(e,M.current.length);for(let e of r.rejected)f(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!z.current||t&&R.current&&!P.current||n!==at.current||j(t=>t.length>=4?t:[...t,e])},()=>f(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[x,t]),Et=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Tt(t))},Dt=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Tt(t))},Q=(0,g.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(x||u||R.current)&&!(a===``&&r.length===0&&!S)){R.current=!0,t&&(at.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&&he&&(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):(f(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))}}},[S,x,u,e,t,he,m,k]),Ot=(0,g.useCallback)(()=>{x||u||R.current||Q(O.current,M.current,!0)},[x,u,Q]),kt=async()=>{if(!(!n||u||R.current)){R.current=!0,L(!0),et(!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),et(!1))}}},At=e=>{if(St){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Z.length===0)return;let t=Z.findIndex(e=>e.value===xt),n=e.key===`ArrowDown`?1:-1,r=Z[(t+n+Z.length)%Z.length];st(r.value);return}if(e.key===`Escape`){e.preventDefault(),Ct();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Z.find(e=>e.value===xt);if(t){e.preventDefault(),wt(t);return}Ct()}}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(),Ot())};(0,g.useEffect)(()=>{if(!T||x)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Ae(e.target))return;let t=Ye[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,T,Q]);let jt=e=>{if(x||P.current||R.current&&(e||t))return;let n=X.finish();if(n===``)return;let r=D.trim()===``?n:`${D.replace(/\s*$/,``)} ${n}`;if(e){t&&k(r),Q(r,A,!0);return}k(r),Y.current=r.length,K.current?.focus()},$=X.recording,Mt=X.supported?(0,h.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,disabled:x||H,"aria-label":`Start dictation`,title:`Dictation`,className:p(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,ht&&`hidden md:inline-flex`),onClick:()=>{U()||X.start()},children:[(0,h.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),b||y?null:`Dictation`]}):null,Nt=nt?(0,h.jsxs)(c,{type:`button`,"data-slot":`composer-finish`,"aria-label":l?`Finishing…`:`Finish`,"aria-busy":l||void 0,title:`Close the session and mark this task done`,disabled:I||N||l,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void ne?.(),children:[(0,h.jsx)(te,{"aria-hidden":`true`}),l?`Finishing…`:`Finish`]}):null,Pt=n||N?(0,h.jsxs)(c,{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:p(`h-11 min-w-11 active:opacity-80`,rt?`w-auto px-3`:`w-11`),onClick:()=>void kt(),children:[(0,h.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),rt?N?`Stopping…`:`Stop`:null]}):null,Ft=(0,h.jsx)(h.Fragment,{children:t||n||u?(0,h.jsx)(`div`,{className:p(`overflow-y-auto px-3 pb-2 text-xs leading-5 text-muted-foreground md:px-4`,ce?`min-h-6`:`h-24 md:h-20`),children:(0,h.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?pe:B===null?fe??null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground`,children:B}),(0,h.jsx)(`p`,{children:me})]})})}):null}),It=(0,h.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:p(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,b&&`new-task-submission`),children:[b||y?null:Mt,v?(0,h.jsx)(`div`,{id:ut,"data-slot":`composer-footer-end`,className:p(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,b&&`mr-auto`,_&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,ht?`hidden md:flex`:`flex`),children:(0,h.jsx)(`div`,{className:`contents`,inert:H||void 0,children:v})}):null,(0,h.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Pt??ie,Nt,!tt&&!nt?(0,h.jsxs)(c,{type:`button`,size:`icon-sm`,"aria-label":it,"aria-busy":I&&!N||void 0,disabled:x||I||N||!F&&!S,className:p(b?`h-12 w-full gap-2 px-6`:y?`h-11 w-auto gap-2 px-5`:`size-11`,!F&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Ot,children:[!y&&!F&&d?(0,h.jsx)(be,{"aria-hidden":`true`}):null,b||y||!F&&d?it:null,y||F||!d?(0,h.jsx)(a,{"aria-hidden":`true`}):null]}):null]})]});return(0,h.jsxs)(ve,{open:St,onOpenChange:e=>e?void 0:Ct(),children:[(0,h.jsx)(_e,{asChild:!0,children:(0,h.jsxs)(`div`,{ref:gt,"data-slot":`composer`,"data-disabled":x||void 0,onDrop:Dt,onDragOver:e=>e.preventDefault(),className:p(b&&`new-task-composer`,y&&`session-composer`,x&&`opacity-80`),children:[(0,h.jsxs)(`div`,{"data-slot":`composer-editor`,className:p(`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`,b&&`new-task-editor`),children:[A.length>0?(0,h.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,h.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:H?`Attachment submitted`:`Click to remove`,disabled:H,className:p(`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,h.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,h.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,h.jsx)(de,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,h.jsx)(`label`,{htmlFor:q,className:b?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:b?`Task description`:C}),(0,h.jsx)(`textarea`,{ref:K,id:q,autoComplete:`off`,rows:1,value:D,disabled:x,readOnly:H,"aria-busy":H||void 0,"aria-describedby":t?`${q}-submission`:void 0,"aria-label":C,placeholder:x?Re:ze,className:p(`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`,ht?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`),onChange:e=>{U()||(k(e.target.value),bt())},onKeyDown:At,onSelect:bt,onPaste:Et}),b?(0,h.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,h.jsx)(ue,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,y&&$?(0,h.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:y}):null,$?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Ze,{transcript:$.transcript,startedAt:$.startedAt,insertionDisabled:H,onCancel:X.cancel,onInsert:()=>jt(!1),onInsertAndSend:()=>jt(!0)}),Pt?(0,h.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Pt}):null]}):(0,h.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:[y?(0,h.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:y}):null,(0,h.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:p(`flex min-w-0 flex-wrap items-center gap-1`,b&&`w-full`),children:[(0,h.jsx)(Xe,{disabled:x||H,onFiles:Tt}),_?(0,h.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":J?`Collapse composer`:`Expand composer`,"aria-expanded":J,"aria-controls":v?`${q} ${ut}`:q,onClick:()=>{ft.set(pt,!J),mt()},children:(0,h.jsx)(ee,{"aria-hidden":`true`,className:p(`transition-transform motion-reduce:transition-none`,!J&&`rotate-180`)})}):null,(0,h.jsx)(`div`,{className:`contents`,inert:H||void 0,children:Pe}),b||y?(0,h.jsx)(`div`,{children:Mt}):null]}),Fe?(0,h.jsx)(`div`,{"data-slot":`session-model`,inert:H||void 0,children:Fe}):null,b?null:It]}),b?null:Ft]}),b?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:H||void 0,children:Ie}),(0,h.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:H||void 0,children:b}),It,(0,h.jsx)(`div`,{"data-slot":`composer-feedback`,children:Ft})]}):null]})}),(0,h.jsx)(ge,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{gt.current?.contains(e.target)&&e.preventDefault()},children:(0,h.jsx)(ye,{shouldFilter:!1,value:xt??``,onValueChange:st,children:(0,h.jsx)(xe,{"data-slot":`composer-menu`,"data-trigger":W?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Z.length===0?(0,h.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.`:_t.isPending?`Loading skills…`:`No matching skills.`}):Z.map(e=>(0,h.jsxs)(Se,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>wt(e),children:[(0,h.jsx)(`span`,{className:p(`shrink-0 truncate`,e.emphasized&&`font-semibold`,W?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,h.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,g.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{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,h.jsx)(s,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.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:i,onInsertAndSend:o}){let s=C(1e3);return(0,h.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,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,h.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:qe(t,s)}),(0,h.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,h.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,h.jsx)(de,{"aria-hidden":`true`})}),(0,h.jsx)(c,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:i,children:(0,h.jsx)(te,{"aria-hidden":`true`})}),(0,h.jsx)(c,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,h.jsx)(a,{"aria-hidden":`true`})})]})}function O(){return(0,h.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,h.jsx)(u,{icon:(0,h.jsx)(we,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{b as a,Re as c,Pe as d,_ as f,y as i,S as l,D as n,x as o,v as p,C as r,ze as s,O as t,Fe 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{Aa as r,At as i,G as a,Gt as o,Pt as s,X as ee,Y as te,_ as ne,d as c,f as l,fr as re,g as ie,h as ae,hr as oe,in as se,l as u,m as d,p as ce,qi as le,qt as ue,sa as f,tn as de,v as fe,y as pe}from"./alert-dialog-CmDuefYh.js";import{_ as me,b as he,t as p,v as m}from"./utils-CUnaAifW.js";import{a as ge,i as _e,r as ve}from"./agent-accounts-lP_xK83o.js";import{E as ye,F as be,M as xe,j as Se,r as Ce}from"./prompt-templates-iV2WD2jy.js";import{u as we}from"./project-router-SwsXRKXs.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 h=n(),g=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 Me(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 _(e,t){let n=g.useRef(t);g.useLayoutEffect(()=>{n.current=t}),g.useEffect(()=>{let t=t=>{Me(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 Pe(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function v(e,t){let n=g.useRef(t);g.useLayoutEffect(()=>{n.current=t}),g.useEffect(()=>{let t=t=>{Ne(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function y({...e}){return(0,h.jsx)(l,{"data-slot":`sheet`,...e})}function Fe({...e}){return(0,h.jsx)(pe,{"data-slot":`sheet-trigger`,...e})}function b({...e}){return(0,h.jsx)(ce,{"data-slot":`sheet-close`,...e})}function Ie({...e}){return(0,h.jsx)(ne,{"data-slot":`sheet-portal`,...e})}function Le({className:e,...t}){return(0,h.jsx)(ie,{"data-slot":`sheet-overlay`,className:p(`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 x({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,h.jsxs)(Ie,{children:[(0,h.jsx)(Le,{className:i}),(0,h.jsxs)(d,{"data-slot":`sheet-content`,className:p(`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,h.jsxs)(ce,{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,h.jsx)(de,{className:`size-4`}),(0,h.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function Re({className:e,...t}){return(0,h.jsx)(`div`,{"data-slot":`sheet-header`,className:p(`flex flex-col gap-1.5 p-4`,e),...t})}function S({className:e,...t}){return(0,h.jsx)(fe,{"data-slot":`sheet-title`,className:p(`font-semibold text-foreground`,e),...t})}function ze({className:e,...t}){return(0,h.jsx)(ae,{"data-slot":`sheet-description`,className:p(`text-sm text-muted-foreground`,e),...t})}function C(e){let[t,n]=g.useState(()=>Date.now());return g.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var w={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 T(e){return m(e.type)?e.type:w[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=T(e)??`application/octet-stream`,a=he(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(T(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 E=new Set([`/`,`@`]);function He(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(E.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function Ue(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 We(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Ge(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]=g.useState(null),r=g.useRef(null),i=g.useRef(``),[a]=g.useState(()=>We()!==void 0),o=g.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 g.useEffect(()=>o,[o]),{supported:a,recording:t,start:g.useCallback(()=>{if(r.current)return;let t=We();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=Ge(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:g.useCallback(()=>o(),[o]),finish:g.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 qe(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var Je=new Map,Ye={KeyA:`Yes, approved.`,KeyC:`Continue.`};function D({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:ne,finishing:l=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:ce=!1,idleFeedback:fe,pendingLabel:pe=`Starting task…`,failureHint:me=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:he=!0,onPendingChange:m,value:we,onValueChange:je,autoFocus:Me=!1,mobileCollapsible:_=!1,mobileDisclosureKey:Ne,footerStart:Pe,footerEnd:v,sessionControls:y,sessionModel:Fe,executionOptions:b,agentOptions:Ie,sendAriaLabel:Le=`Send`,disabled:x=!1,disabledReason:Re=`Session closed — Continue to reopen.`,allowEmptySubmit:S=!1,placeholder:ze=`Reply — / for skills, @ for files…`,ariaLabel:C=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:T=!1,getMentionCandidates:E,ref:We}){let[Ge,qe]=(0,g.useState)(``),D=we??Ge,O=(0,g.useRef)(D);O.current=D;let Qe=(0,g.useRef)(je);Qe.current=je;let k=(0,g.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;qe(t),Qe.current?.(t)},[]),[A,j]=(0,g.useState)([]),M=(0,g.useRef)(A);M.current=A;let[$e,et]=(0,g.useState)(!1),N=u||$e,P=(0,g.useRef)(N);P.current=N;let F=D.trim()!==``||A.length>0,tt=!F&&(n!==void 0&&ae||N),nt=!F&&!tt&&ne!==void 0,rt=tt||nt||!F&&d!==void 0,it=!F&&d?d:Le,[I,L]=(0,g.useState)(!1),R=(0,g.useRef)(!1),at=(0,g.useRef)(0),z=(0,g.useRef)(!0);(0,g.useEffect)(()=>(z.current=!0,()=>{z.current=!1}),[]);let[B,V]=(0,g.useState)(null),H=N||t&&I,U=()=>P.current||t&&R.current,[W,G]=(0,g.useState)(null),[ot,st]=(0,g.useState)(``),[ct,lt]=(0,g.useState)(!1),K=(0,g.useRef)(null),q=(0,g.useId)(),ut=(0,g.useId)(),dt=(0,g.useRef)(new Map),ft=Ne===void 0?dt.current:Je,pt=Ne??`default`,[,mt]=(0,g.useReducer)(e=>e+1,0),J=ft.get(pt)??!1,ht=_&&!J,gt=(0,g.useRef)(null),Y=(0,g.useRef)(null),_t=re(w&&ct),vt=oe(),yt=r(),X=Ke(e=>f(e,{tone:`danger`}));(0,g.useEffect)(()=>{Me&&K.current?.focus()},[]),(0,g.useImperativeHandle)(We,()=>({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 bt=(0,g.useCallback)(()=>{let e=K.current;if(!e||x||U()){G(null);return}let t=He(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&E===void 0)return G(null);t?.trigger===`/`&<(!0),G(t)},[w,x,E,t]),Z=(0,g.useMemo)(()=>W===null?[]:W.trigger===`/`?Ee(_t.data??[],W.query,vt.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,_t.data,W,vt.data?.skillUsage]),xt=Z.some(e=>e.value===ot)?ot:Z[0]?.value,St=W!==null,Ct=(0,g.useCallback)(()=>G(null),[]),wt=e=>{let t=K.current;if(!t||W===null||U())return;let n=t.selectionStart??t.value.length,r=Ue(t.value,W,n,e.insert);W.trigger===`/`&&vt.data!==void 0&&le({skillUsage:Oe(vt.data.skillUsage,e.insert)}).then(()=>yt.invalidateQueries({queryKey:se.uiState})).catch(()=>{}),k(r.text),Y.current=r.caret,G(null),t.focus()};(0,g.useLayoutEffect)(()=>{let e=Y.current,t=K.current;e!==null&&t&&(t.setSelectionRange(e,e),Y.current=null)},[D]),(0,g.useLayoutEffect)(()=>{let e=K.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D,J]);let Tt=(0,g.useCallback)(e=>{if(x||U())return;let n=at.current,r=Ve(e,M.current.length);for(let e of r.rejected)f(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!z.current||t&&R.current&&!P.current||n!==at.current||j(t=>t.length>=4?t:[...t,e])},()=>f(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[x,t]),Et=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Tt(t))},Dt=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Tt(t))},Q=(0,g.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(x||u||R.current)&&!(a===``&&r.length===0&&!S)){R.current=!0,t&&(at.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&&he&&(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):(f(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))}}},[S,x,u,e,t,he,m,k]),Ot=(0,g.useCallback)(()=>{x||u||R.current||Q(O.current,M.current,!0)},[x,u,Q]),kt=async()=>{if(!(!n||u||R.current)){R.current=!0,L(!0),et(!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),et(!1))}}},At=e=>{if(St){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Z.length===0)return;let t=Z.findIndex(e=>e.value===xt),n=e.key===`ArrowDown`?1:-1,r=Z[(t+n+Z.length)%Z.length];st(r.value);return}if(e.key===`Escape`){e.preventDefault(),Ct();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Z.find(e=>e.value===xt);if(t){e.preventDefault(),wt(t);return}Ct()}}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(),Ot())};(0,g.useEffect)(()=>{if(!T||x)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||Ae(e.target))return;let t=Ye[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[x,T,Q]);let jt=e=>{if(x||P.current||R.current&&(e||t))return;let n=X.finish();if(n===``)return;let r=D.trim()===``?n:`${D.replace(/\s*$/,``)} ${n}`;if(e){t&&k(r),Q(r,A,!0);return}k(r),Y.current=r.length,K.current?.focus()},$=X.recording,Mt=X.supported?(0,h.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,disabled:x||H,"aria-label":`Start dictation`,title:`Dictation`,className:p(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,ht&&`hidden md:inline-flex`),onClick:()=>{U()||X.start()},children:[(0,h.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),b||y?null:`Dictation`]}):null,Nt=nt?(0,h.jsxs)(c,{type:`button`,"data-slot":`composer-finish`,"aria-label":l?`Finishing…`:`Finish`,"aria-busy":l||void 0,title:`Close the session and mark this task done`,disabled:I||N||l,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void ne?.(),children:[(0,h.jsx)(te,{"aria-hidden":`true`}),l?`Finishing…`:`Finish`]}):null,Pt=n||N?(0,h.jsxs)(c,{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:p(`h-11 min-w-11 active:opacity-80`,rt?`w-auto px-3`:`w-11`),onClick:()=>void kt(),children:[(0,h.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),rt?N?`Stopping…`:`Stop`:null]}):null,Ft=(0,h.jsx)(h.Fragment,{children:t||n||u?(0,h.jsx)(`div`,{className:p(`overflow-y-auto px-3 pb-2 text-xs leading-5 text-muted-foreground md:px-4`,ce?`min-h-6`:`h-24 md:h-20`),children:(0,h.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?pe:B===null?fe??null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`p`,{className:`font-medium text-foreground`,children:B}),(0,h.jsx)(`p`,{children:me})]})})}):null}),It=(0,h.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:p(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,b&&`new-task-submission`),children:[b||y?null:Mt,v?(0,h.jsx)(`div`,{id:ut,"data-slot":`composer-footer-end`,className:p(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,b&&`mr-auto`,_&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,ht?`hidden md:flex`:`flex`),children:(0,h.jsx)(`div`,{className:`contents`,inert:H||void 0,children:v})}):null,(0,h.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Pt??ie,Nt,!tt&&!nt?(0,h.jsxs)(c,{type:`button`,size:`icon-sm`,"aria-label":it,"aria-busy":I&&!N||void 0,disabled:x||I||N||!F&&!S,className:p(b?`h-12 w-full gap-2 px-6`:y?`h-11 w-auto gap-2 px-5`:`size-11`,!F&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Ot,children:[!y&&!F&&d?(0,h.jsx)(be,{"aria-hidden":`true`}):null,b||y||!F&&d?it:null,y||F||!d?(0,h.jsx)(a,{"aria-hidden":`true`}):null]}):null]})]});return(0,h.jsxs)(ve,{open:St,onOpenChange:e=>e?void 0:Ct(),children:[(0,h.jsx)(_e,{asChild:!0,children:(0,h.jsxs)(`div`,{ref:gt,"data-slot":`composer`,"data-disabled":x||void 0,onDrop:Dt,onDragOver:e=>e.preventDefault(),className:p(b&&`new-task-composer`,y&&`session-composer`,x&&`opacity-80`),children:[(0,h.jsxs)(`div`,{"data-slot":`composer-editor`,className:p(`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`,b&&`new-task-editor`),children:[A.length>0?(0,h.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,h.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:H?`Attachment submitted`:`Click to remove`,disabled:H,className:p(`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,h.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,h.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,h.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,h.jsx)(de,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,h.jsx)(`label`,{htmlFor:q,className:b?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:b?`Task description`:C}),(0,h.jsx)(`textarea`,{ref:K,id:q,autoComplete:`off`,rows:1,value:D,disabled:x,readOnly:H,"aria-busy":H||void 0,"aria-describedby":t?`${q}-submission`:void 0,"aria-label":C,placeholder:x?Re:ze,className:p(`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`,ht?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`),onChange:e=>{U()||(k(e.target.value),bt())},onKeyDown:At,onSelect:bt,onPaste:Et}),b?(0,h.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,h.jsx)(ue,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,y&&$?(0,h.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:y}):null,$?(0,h.jsxs)(`div`,{children:[(0,h.jsx)(Ze,{transcript:$.transcript,startedAt:$.startedAt,insertionDisabled:H,onCancel:X.cancel,onInsert:()=>jt(!1),onInsertAndSend:()=>jt(!0)}),Pt?(0,h.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Pt}):null]}):(0,h.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:[y?(0,h.jsx)(`div`,{"data-slot":`session-controls`,inert:H||void 0,children:y}):null,(0,h.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:p(`flex min-w-0 flex-wrap items-center gap-1`,b&&`w-full`),children:[(0,h.jsx)(Xe,{disabled:x||H,onFiles:Tt}),_?(0,h.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":J?`Collapse composer`:`Expand composer`,"aria-expanded":J,"aria-controls":v?`${q} ${ut}`:q,onClick:()=>{ft.set(pt,!J),mt()},children:(0,h.jsx)(ee,{"aria-hidden":`true`,className:p(`transition-transform motion-reduce:transition-none`,!J&&`rotate-180`)})}):null,(0,h.jsx)(`div`,{className:`contents`,inert:H||void 0,children:Pe}),b||y?(0,h.jsx)(`div`,{children:Mt}):null]}),Fe?(0,h.jsx)(`div`,{"data-slot":`session-model`,inert:H||void 0,children:Fe}):null,b?null:It]}),b?null:Ft]}),b?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:H||void 0,children:Ie}),(0,h.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:H||void 0,children:b}),It,(0,h.jsx)(`div`,{"data-slot":`composer-feedback`,children:Ft})]}):null]})}),(0,h.jsx)(ge,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{gt.current?.contains(e.target)&&e.preventDefault()},children:(0,h.jsx)(ye,{shouldFilter:!1,value:xt??``,onValueChange:st,children:(0,h.jsx)(xe,{"data-slot":`composer-menu`,"data-trigger":W?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Z.length===0?(0,h.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.`:_t.isPending?`Loading skills…`:`No matching skills.`}):Z.map(e=>(0,h.jsxs)(Se,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>wt(e),children:[(0,h.jsx)(`span`,{className:p(`shrink-0 truncate`,e.emphasized&&`font-semibold`,W?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,h.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,g.useRef)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c,{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,h.jsx)(s,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,h.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:i,onInsertAndSend:o}){let s=C(1e3);return(0,h.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,h.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,h.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:qe(t,s)}),(0,h.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,h.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,h.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,h.jsx)(de,{"aria-hidden":`true`})}),(0,h.jsx)(c,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:i,children:(0,h.jsx)(te,{"aria-hidden":`true`})}),(0,h.jsx)(c,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,h.jsx)(a,{"aria-hidden":`true`})})]})}function O(){return(0,h.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,h.jsx)(u,{icon:(0,h.jsx)(we,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{b as a,Re as c,Pe as d,_ as f,y as i,S as l,D as n,x as o,v as p,C as r,ze as s,O as t,Fe 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-CUnaAifW.js";import{n}from"./markdown-AY2K3kIV.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};
|