turbollm 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -6
- package/dist/cli.js +863 -223
- package/dist/webdist/assets/{AgentEditPage-CyzZ8vDr.js → AgentEditPage-DNvZR3cu.js} +1 -1
- package/dist/webdist/assets/{ChatScreen-DWVblPWw.js → ChatScreen-DTUqWzkB.js} +1 -1
- package/dist/webdist/assets/{CodeComposer-BvNMY6PI.js → CodeComposer-pkcqzmvN.js} +1 -1
- package/dist/webdist/assets/{CodeHomeScreen-CmzaqOmH.js → CodeHomeScreen-BGDfKjR5.js} +1 -1
- package/dist/webdist/assets/{CodeSessionScreen-BtA5u3li.js → CodeSessionScreen-XUVJOHoy.js} +1 -1
- package/dist/webdist/assets/{CustomizeScreen-ACC_4SMn.js → CustomizeScreen-C-CB17f_.js} +1 -1
- package/dist/webdist/assets/{DeveloperScreen-CSJZh91v.js → DeveloperScreen-Cf2h3q1h.js} +1 -1
- package/dist/webdist/assets/{EnginesScreen-ChGdOOW9.js → EnginesScreen-BVr8azYB.js} +1 -1
- package/dist/webdist/assets/{FsBrowser-D9RjrjvO.js → FsBrowser-ClSut33T.js} +1 -1
- package/dist/webdist/assets/{ModelLoadMenu-DzaxKmIV.js → ModelLoadMenu-BVi-8jbR.js} +2 -2
- package/dist/webdist/assets/{ModelsScreen-wuI7h511.js → ModelsScreen-DD-4WyKD.js} +1 -1
- package/dist/webdist/assets/SettingsScreen-C3yC3oot.js +2 -0
- package/dist/webdist/assets/{SkillEditPage-XGTaeQ8o.js → SkillEditPage-DChREtc6.js} +1 -1
- package/dist/webdist/assets/{TokensScreen-B02y3G-H.js → TokensScreen-CelKSaRC.js} +1 -1
- package/dist/webdist/assets/{ToolApprovalBar-D4YRUMat.js → ToolApprovalBar-K6AKnQqc.js} +3 -3
- package/dist/webdist/assets/WorkspaceScreen-S_J_Og1H.js +1 -0
- package/dist/webdist/assets/{agent-api-D86F96i6.js → agent-api-CPRm67XA.js} +1 -1
- package/dist/webdist/assets/{arc-BScxM0vj.js → arc-BWQn2h61.js} +1 -1
- package/dist/webdist/assets/{architectureDiagram-3BPJPVTR-DbIjWGrc.js → architectureDiagram-3BPJPVTR-Cge0ZKH0.js} +1 -1
- package/dist/webdist/assets/{arrow-left-Cz7XgLgo.js → arrow-left-DoxsLtKs.js} +1 -1
- package/dist/webdist/assets/{badge-CRVn2top.js → badge-kjHBKzhx.js} +1 -1
- package/dist/webdist/assets/{blockDiagram-GPEHLZMM-COy0nYNX.js → blockDiagram-GPEHLZMM-BssC0Yh7.js} +1 -1
- package/dist/webdist/assets/{bot-C-sGABri.js → bot-DTtcsWn-.js} +1 -1
- package/dist/webdist/assets/{c4Diagram-AAUBKEIU-CoiZua-v.js → c4Diagram-AAUBKEIU-BqvriUK6.js} +1 -1
- package/dist/webdist/assets/channel-Vz8UyuMe.js +1 -0
- package/dist/webdist/assets/{chat-api-CdVOTSst.js → chat-api-DZ49knUn.js} +1 -1
- package/dist/webdist/assets/{chat-queries-DINfS8uv.js → chat-queries-VupDrbfF.js} +1 -1
- package/dist/webdist/assets/check-lvVdiPFE.js +1 -0
- package/dist/webdist/assets/{chevron-left-CbPqt11D.js → chevron-left-DwdYJZHs.js} +1 -1
- package/dist/webdist/assets/{chevron-right-C8EPnhrg.js → chevron-right-BTbLU6GN.js} +1 -1
- package/dist/webdist/assets/{chunk-2J33WTMH-B-ggs358.js → chunk-2J33WTMH-B984SOW_.js} +1 -1
- package/dist/webdist/assets/{chunk-4BX2VUAB-CBSHARpe.js → chunk-4BX2VUAB-C1dpPi76.js} +1 -1
- package/dist/webdist/assets/{chunk-55IACEB6-BikCaTgS.js → chunk-55IACEB6-LDla5pGM.js} +1 -1
- package/dist/webdist/assets/{chunk-727SXJPM-B8Uooh_X.js → chunk-727SXJPM-0eWWK0EB.js} +1 -1
- package/dist/webdist/assets/{chunk-AQP2D5EJ-C-wZiAmx.js → chunk-AQP2D5EJ-D5O05AQQ.js} +1 -1
- package/dist/webdist/assets/{chunk-FMBD7UC4-lkRMU7V5.js → chunk-FMBD7UC4-wuTFD4_w.js} +1 -1
- package/dist/webdist/assets/{chunk-ND2GUHAM-CTBUDTXK.js → chunk-ND2GUHAM-CyryisdR.js} +1 -1
- package/dist/webdist/assets/{chunk-QZHKN3VN-CKOXFQ-c.js → chunk-QZHKN3VN-Dkg5s8Vt.js} +1 -1
- package/dist/webdist/assets/{circle-check-dbo4u23c.js → circle-check-BMWD0nBQ.js} +1 -1
- package/dist/webdist/assets/{circle-x-CuPWHB4Y.js → circle-x-L9dERUsF.js} +1 -1
- package/dist/webdist/assets/classDiagram-4FO5ZUOK-m7OsEmbJ.js +1 -0
- package/dist/webdist/assets/classDiagram-v2-Q7XG4LA2-m7OsEmbJ.js +1 -0
- package/dist/webdist/assets/{common-RZkQjs09.js → common-B-Q9ODI5.js} +1 -1
- package/dist/webdist/assets/{copy-button-DKUAZ6Ig.js → copy-button-DKb_WA32.js} +1 -1
- package/dist/webdist/assets/{cose-bilkent-S5V4N54A-L3BPlYev.js → cose-bilkent-S5V4N54A-DPKlqM99.js} +1 -1
- package/dist/webdist/assets/{dagre-BM42HDAG-DdFZFhxI.js → dagre-BM42HDAG-DCXg7Kdg.js} +1 -1
- package/dist/webdist/assets/{diagram-2AECGRRQ-Bx4JyVtd.js → diagram-2AECGRRQ-CboDux1B.js} +1 -1
- package/dist/webdist/assets/{diagram-5GNKFQAL-DYxtCUYO.js → diagram-5GNKFQAL-CGhi-mVg.js} +1 -1
- package/dist/webdist/assets/{diagram-KO2AKTUF-BSV0zTVR.js → diagram-KO2AKTUF-DVTJUAeJ.js} +1 -1
- package/dist/webdist/assets/{diagram-LMA3HP47-CS-L_g7_.js → diagram-LMA3HP47-Vnh4TKLV.js} +1 -1
- package/dist/webdist/assets/{diagram-OG6HWLK6-D8uK9mOu.js → diagram-OG6HWLK6-BpWm07Oi.js} +1 -1
- package/dist/webdist/assets/{dialog-fsfhY_Ib.js → dialog-DdlXu__o.js} +1 -1
- package/dist/webdist/assets/{dropdown-menu-B6pYEdad.js → dropdown-menu-DDpkyyj8.js} +1 -1
- package/dist/webdist/assets/{erDiagram-TEJ5UH35-DX-3blsY.js → erDiagram-TEJ5UH35-Bd8Ei8bx.js} +1 -1
- package/dist/webdist/assets/{flowDiagram-I6XJVG4X-DUTsLqgt.js → flowDiagram-I6XJVG4X--gnh3dk5.js} +1 -1
- package/dist/webdist/assets/{ganttDiagram-6RSMTGT7-CwH0oq0S.js → ganttDiagram-6RSMTGT7-BK29kYkV.js} +1 -1
- package/dist/webdist/assets/{git-branch-BiMfcJ1j.js → git-branch-nhepGrNO.js} +1 -1
- package/dist/webdist/assets/{gitGraphDiagram-PVQCEYII-CmLeqvWh.js → gitGraphDiagram-PVQCEYII-Qrtx7EuN.js} +1 -1
- package/dist/webdist/assets/index-C8wNg6Wi.js +10 -0
- package/dist/webdist/assets/index-R8A5k2CE.css +1 -0
- package/dist/webdist/assets/{infoDiagram-5YYISTIA-BFTUzkbq.js → infoDiagram-5YYISTIA-Bj9TCuBe.js} +1 -1
- package/dist/webdist/assets/{ishikawaDiagram-YF4QCWOH-BdQIrqQU.js → ishikawaDiagram-YF4QCWOH-D6vdcQx7.js} +1 -1
- package/dist/webdist/assets/{journeyDiagram-JHISSGLW-D1HmHaNc.js → journeyDiagram-JHISSGLW-DjnUUitB.js} +1 -1
- package/dist/webdist/assets/{kanban-definition-UN3LZRKU-C5USgc8m.js → kanban-definition-UN3LZRKU-B1L_a7lS.js} +1 -1
- package/dist/webdist/assets/{linear-BDGxyxLo.js → linear-o0IfwOne.js} +1 -1
- package/dist/webdist/assets/{lock-DCb387O_.js → lock-Agz9n58r.js} +1 -1
- package/dist/webdist/assets/{mermaid.core-DWCJxsCl.js → mermaid.core-DgaDcZ7N.js} +4 -4
- package/dist/webdist/assets/{mindmap-definition-RKZ34NQL-BV3H5rWG.js → mindmap-definition-RKZ34NQL-CmH7NPeo.js} +1 -1
- package/dist/webdist/assets/{pencil-BegDY0Zk.js → pencil-B6MqYBDR.js} +1 -1
- package/dist/webdist/assets/{personas-DNCENHUd.js → personas-37gn2PeP.js} +1 -1
- package/dist/webdist/assets/{pieDiagram-4H26LBE5-DDN9VAOL.js → pieDiagram-4H26LBE5-C_lc9Bmi.js} +1 -1
- package/dist/webdist/assets/{plus-DrZmKBTt.js → plus-BvgdS6Vk.js} +1 -1
- package/dist/webdist/assets/{quadrantDiagram-W4KKPZXB-Bx16Ru8w.js → quadrantDiagram-W4KKPZXB-6RWw_N1H.js} +1 -1
- package/dist/webdist/assets/{refresh-cw-B7Qjdj47.js → refresh-cw-ynvrvFZw.js} +1 -1
- package/dist/webdist/assets/{requirementDiagram-4Y6WPE33-k0upGaul.js → requirementDiagram-4Y6WPE33-BX9QhEnx.js} +1 -1
- package/dist/webdist/assets/{rotate-ccw-B7o8hLk6.js → rotate-ccw-B5F4Bcwl.js} +1 -1
- package/dist/webdist/assets/{sankeyDiagram-5OEKKPKP-xyOWBpSr.js → sankeyDiagram-5OEKKPKP-C0Vy-PzM.js} +1 -1
- package/dist/webdist/assets/{sequenceDiagram-3UESZ5HK-BhBclCRW.js → sequenceDiagram-3UESZ5HK-BniJLZOt.js} +1 -1
- package/dist/webdist/assets/{skeleton-D15eL_7e.js → skeleton-BWLBT8PZ.js} +1 -1
- package/dist/webdist/assets/{sliders-horizontal-C4_t3PES.js → sliders-horizontal-_Pw_fPxo.js} +1 -1
- package/dist/webdist/assets/{sparkles-BT45JGMR.js → sparkles-CopaJ0vX.js} +1 -1
- package/dist/webdist/assets/{star-SskkfhIb.js → star-DRBODCiH.js} +1 -1
- package/dist/webdist/assets/{stateDiagram-AJRCARHV-902Ow1i4.js → stateDiagram-AJRCARHV-BLP70Zkk.js} +1 -1
- package/dist/webdist/assets/stateDiagram-v2-BHNVJYJU-Dd5BhBJB.js +1 -0
- package/dist/webdist/assets/{switch-C-l-ej5M.js → switch-DBoQ3-k9.js} +1 -1
- package/dist/webdist/assets/{terminal-55Og1Fyx.js → terminal-BDZDh7uk.js} +1 -1
- package/dist/webdist/assets/{timeline-definition-PNZ67QCA-BEyTzrTZ.js → timeline-definition-PNZ67QCA-gd66aHo1.js} +1 -1
- package/dist/webdist/assets/{trash-2-B9nMCHMA.js → trash-2-BMQd9RUh.js} +1 -1
- package/dist/webdist/assets/{useIsDesktop-D2KX8NOA.js → useIsDesktop-C-xkBB_K.js} +1 -1
- package/dist/webdist/assets/{vennDiagram-CIIHVFJN-C77U6Nzk.js → vennDiagram-CIIHVFJN-Cqjj2Yol.js} +1 -1
- package/dist/webdist/assets/{wardley-L42UT6IY-BZ10FiAs.js → wardley-L42UT6IY-BpM_o2mZ.js} +1 -1
- package/dist/webdist/assets/{wardleyDiagram-YWT4CUSO-DgrAaqyf.js → wardleyDiagram-YWT4CUSO-BXA5Tvdx.js} +1 -1
- package/dist/webdist/assets/{wrench-DMY_WSQ9.js → wrench-BWX7piNS.js} +1 -1
- package/dist/webdist/assets/{xychartDiagram-2RQKCTM6-BlzVJUn3.js → xychartDiagram-2RQKCTM6-CSkEzqLU.js} +1 -1
- package/dist/webdist/index.html +2 -2
- package/package.json +1 -1
- package/dist/webdist/assets/SettingsScreen-DsKi9vxM.js +0 -1
- package/dist/webdist/assets/WorkspaceScreen-DRoUxluw.js +0 -1
- package/dist/webdist/assets/channel-8eXCTkKl.js +0 -1
- package/dist/webdist/assets/check-Do9IgpFj.js +0 -1
- package/dist/webdist/assets/classDiagram-4FO5ZUOK-D5bPDMhb.js +0 -1
- package/dist/webdist/assets/classDiagram-v2-Q7XG4LA2-D5bPDMhb.js +0 -1
- package/dist/webdist/assets/index-CXwfn7-U.css +0 -1
- package/dist/webdist/assets/index-DaNuMYPC.js +0 -10
- package/dist/webdist/assets/stateDiagram-v2-BHNVJYJU-B5LKF3CJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-j_81dozL.js";import{r as l}from"./vendor-BFom-Mq6.js";import{g as _,H as Je,f as y,X as ve,L as Ve,B as D,I as et,t as tt}from"./index-DaNuMYPC.js";import{D as ee,a as te,C as ne,b as se,c as w,d as nt}from"./dropdown-menu-B6pYEdad.js";import{b as st,T as rt,M as at,d as ye,e as it}from"./ModelLoadMenu-DzaxKmIV.js";import{S as ot,a as lt,b as ct,c as dt,d as xt}from"./useIsDesktop-D2KX8NOA.js";import{F as we}from"./chat-queries-DINfS8uv.js";import{C as z}from"./check-Do9IgpFj.js";import{F as ht,G as I}from"./git-branch-BiMfcJ1j.js";import{P as ut}from"./plus-DrZmKBTt.js";const pt=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],mt=_("corner-down-right",pt);const ft=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 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 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Ne=_("folder-git-2",ft);const gt=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],bt=_("list-todo",gt);const jt=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],kt=_("wand-sparkles",jt);function L(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function vt(s){return s<0?"Unlimited":s===0?"Off":L(s)}function yt(s){return s<0?"Thinking budget: unlimited — no cap is sent":s===0?"Thinking: off":`Thinking budget: ${s.toLocaleString()} tokens`}function E({label:s,value:r,suffix:a,title:i}){return e.jsxs("span",{className:"inline-flex items-baseline gap-1 whitespace-nowrap",title:i,children:[s&&e.jsx("span",{children:s}),e.jsx("span",{className:"font-mono tabular-nums text-ink",children:r}),a&&e.jsx("span",{className:"font-mono tabular-nums",children:a})]})}function Se(){return e.jsx("span",{"aria-hidden":!0,className:"select-none opacity-50",children:"·"})}function wt({thinkingBudget:s,ctxUsed:r,ctxMax:a,lastPromptTokens:i,lastGenTokens:d,lastPromptTps:c,lastGenTps:n,branch:x,cwd:b,hint:m}){const N=a>0?Math.round(Math.min(1,r/a)*100):0,j=[e.jsx(E,{label:"Think",value:vt(s),title:yt(s)},"think")];return a>0&&j.push(e.jsx(E,{label:"Context",value:`${N}%`,suffix:`of ${L(a)}`,title:`Context: ${r.toLocaleString()} / ${a.toLocaleString()} tokens (${N}%)`},"ctx")),i!==void 0&&d!==void 0&&j.push(e.jsx(E,{label:"Last turn",value:`↑${L(i)} ↓${L(d)}`,title:`Last turn: ${i.toLocaleString()} prompt tokens`+(c!==void 0?` (${c.toFixed(0)} tok/s prefill)`:"")+`, ${d.toLocaleString()} generated`+(n!==void 0?` (${n.toFixed(1)} tok/s)`:"")},"turn")),n!==void 0&&j.push(e.jsx(E,{value:`${n.toFixed(1)} tok/s`,title:"Generation speed on the last turn"},"tps")),(x||b)&&j.push(e.jsxs("span",{className:"inline-flex min-w-0 items-baseline gap-1",title:b,children:[x&&e.jsx("span",{className:"truncate text-ink",children:x}),x&&b&&e.jsx(Se,{}),b&&e.jsx("span",{className:"truncate",children:Je(b)})]},"repo")),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-[11px] leading-5 text-faint",children:[j.map((F,S)=>e.jsxs(l.Fragment,{children:[S>0&&e.jsx(Se,{}),F]},S)),m&&e.jsx("span",{className:"ml-auto min-w-0 truncate pl-2",children:m})]})}const Nt=26,St=3;function Me(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function Ie(s){const r=Math.max(0,Math.min(1,s));if(r<=.5){const i=Math.round(r/.5*100);return`color-mix(in srgb, var(--warn) ${i}%, var(--ok) ${100-i}%)`}const a=Math.round((r-.5)/.5*100);return`color-mix(in srgb, var(--err) ${a}%, var(--warn) ${100-a}%)`}function Ce({pct:s,size:r=Nt,stroke:a=St}){const i=(r-a)/2,d=2*Math.PI*i,c=d*s;return e.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:"shrink-0","aria-hidden":!0,children:[e.jsx("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:"var(--border)",strokeWidth:a}),e.jsx("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:Ie(s),strokeWidth:a,strokeLinecap:"round",strokeDasharray:`${c} ${d-c}`,transform:`rotate(-90 ${r/2} ${r/2})`,style:{transition:"stroke-dasharray 0.3s ease, stroke 0.3s ease"}})]})}function Mt({used:s,max:r}){const[a,i]=l.useState(!1),d=r>0?s/r:0,c=Math.min(1,d),n=Math.round(c*100);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>i(!0),title:`Context: ${s.toLocaleString()} / ${r.toLocaleString()} tokens · ${n}%`,"aria-label":`Context usage, ${n} percent — open details`,className:"grid h-8 w-8 shrink-0 place-items-center rounded-md transition-colors hover:bg-panel-2",children:e.jsx(Ce,{pct:c})}),e.jsx(ot,{open:a,onOpenChange:i,modal:!1,children:e.jsxs(lt,{className:"overflow-y-auto p-5",onPointerDownOutside:x=>x.preventDefault(),children:[e.jsxs(ct,{children:[e.jsx(dt,{children:"Context usage"}),e.jsx(xt,{children:"How much of this task's context window is filled."})]}),e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-3 rounded-lg border border-border bg-panel-2 py-6",children:[e.jsxs("div",{className:"relative grid place-items-center",children:[e.jsx(Ce,{pct:c,size:96,stroke:9}),e.jsxs("span",{className:"absolute text-[22px] font-semibold tracking-[-0.01em] text-ink tabular-nums",children:[n,"%"]})]}),e.jsx("span",{className:"text-[12px] text-muted",children:"of context window used"})]}),e.jsxs("div",{className:"mt-4 flex flex-col divide-y divide-border overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Used"}),e.jsxs("span",{className:"text-[13px] font-medium text-ink tabular-nums",children:[s.toLocaleString()," tokens (",Me(s),")"]})]}),e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Max"}),e.jsxs("span",{className:"text-[13px] font-medium text-ink tabular-nums",children:[r.toLocaleString()," tokens (",Me(r),")"]})]}),e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Percentage"}),e.jsxs("span",{className:"text-[13px] font-medium tabular-nums",style:{color:Ie(c)},children:[n,"%"]})]})]})]})})]})}const Ct=[{id:"auto",label:"Auto",desc:"Plans and edits end-to-end, asks only when blocked"},{id:"plan",label:"Plan first",desc:"Shows a plan for approval before touching files"},{id:"ask",label:"Ask each step",desc:"Approval gate on every file edit and command"}],Ut=["Fix the failing test in engine-groups.test.ts","Add a --verbose flag to the CLI","Write unit tests for lib/vram.ts","Explain how gateway auto model-swap works"],$e={auto:kt,plan:bt,ask:st},$t=new Set(["node_modules","dist","build","out","coverage","target",".turbo",".next",".cache",".venv","venv","__pycache__",".git"]),re=500,De=150,Dt=8;async function zt(s){const r=[];let a=0,i=[s];for(;i.length&&a<De&&r.length<re;){const d=await Promise.all(i.map(n=>et(n).catch(()=>null))),c=[];for(const n of d)if(n){a++;for(const x of n.entries)x.isDir?$t.has(x.name)||c.push(x.path):r.length<re&&r.push({path:x.path,rel:It(s,x.path)});if(a>=De||r.length>=re)break}i=c}return r}function It(s,r){const a=c=>c.replace(/\\/g,"/").replace(/\/+$/,""),i=a(s),d=a(r);return d.startsWith(`${i}/`)?d.slice(i.length+1):d}const ze=8*1024*1024;function Et(s){return new Promise((r,a)=>{const i=new FileReader;i.onload=()=>r(i.result),i.onerror=()=>a(i.error),i.readAsDataURL(s)})}function Ht({inputRef:s,value:r,onValueChange:a,onSubmit:i,placeholder:d,textareaDisabled:c,repo:n,repoRoot:x,repoBranch:b,mode:m,onModeChange:N,models:j,loadedKey:F,loadedName:S,modelPending:Ee,ejecting:Le,onLoadModel:_e,onEjectModel:Fe,onModelSettings:Re,ctxUsed:ae,ctxMax:ie,live:k,onStop:R,sendDisabled:oe,onAddContext:le,contextFiles:ce,onRemoveContextFile:de,hintText:Ae,statusText:xe,slashCommands:he=[],thinkingBudget:ue,onThinkingBudgetChange:Be,onImagesChange:Te,lastPromptTokens:Pe,lastGenTokens:Oe,lastPromptTps:We,lastGenTps:Ue}){const He=$e[m.id],A=/^\/([a-z0-9-]*)$/i.exec(r),B=A?.[1]?.toLowerCase()??"",v=A?he.filter(t=>!B||t.id.includes(B)):[],T=!!A&&v.length>0&&!k,[P,O]=l.useState(0);l.useEffect(()=>{O(0)},[B,T]);const W=t=>{a(`/${t.id} `)};l.useEffect(()=>{const t=s.current;t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)},[r,s]);const f=n?.repoPath??x,[U,H]=l.useState(0),Ke=r.slice(0,U),K=/(?:^|\s)@([^\s@]*)$/.exec(Ke),q=K?.[1]?.toLowerCase()??"",g=K?U-K[1].length-1:-1,[qe,Q]=l.useState(!1),pe=l.useRef(-1);l.useEffect(()=>{g!==pe.current&&(Q(!1),pe.current=g)},[g]);const[me,fe]=l.useState(null),[ge,be]=l.useState(!1),je=l.useRef(null);l.useEffect(()=>{!f||g===-1||je.current!==f&&(je.current=f,be(!0),fe(null),zt(f).then(fe).finally(()=>be(!1)))},[f,g]);const p=me?me.filter(t=>!q||t.rel.toLowerCase().includes(q)).slice(0,Dt):[],X=g!==-1&&!qe&&!k&&!!f&&(ge||p.length>0),[G,Y]=l.useState(0);l.useEffect(()=>{Y(0)},[q,X]);const M=l.useRef(null),Z=t=>{if(g===-1)return;const o=r.slice(0,g),h=r.slice(U),u=`@${t.rel} `;a(o+u+h),M.current=o.length+u.length,Q(!0)};l.useEffect(()=>{if(M.current==null)return;const t=M.current;M.current=null;const o=s.current;o&&(o.focus(),o.setSelectionRange(t,t),H(t))},[r,s]);const[C,J]=l.useState([]);l.useEffect(()=>{Te?.(C)},[C]);const[Qe,V]=l.useState(!1),ke=async t=>{if(t.size>ze){tt.error(`${t.name||"Image"} is too large (${(t.size/(1024*1024)).toFixed(1)} MB — max ${ze/(1024*1024)} MB).`);return}const o=await Et(t);J(h=>[...h,{id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:t.name||"pasted-image.png",dataUrl:o,size:t.size}])},Xe=t=>J(o=>o.filter(h=>h.id!==t)),Ge=t=>{const h=Array.from(t.clipboardData?.items??[]).filter(u=>u.kind==="file"&&u.type.startsWith("image/")).map(u=>u.getAsFile()).filter(u=>!!u);if(h.length!==0){t.preventDefault();for(const u of h)ke(u)}},Ye=t=>{Array.from(t.dataTransfer?.types??[]).includes("Files")&&(t.preventDefault(),V(!0))},Ze=t=>{t.preventDefault(),V(!1);const o=Array.from(t.dataTransfer?.files??[]).filter(h=>h.type.startsWith("image/"));for(const h of o)ke(h)},$=t=>{J([]),i(t)};return e.jsxs("div",{children:[e.jsxs("div",{className:"relative",children:[T&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-full max-w-sm overflow-hidden rounded-lg border border-border bg-panel shadow-[var(--shadow-2)]",children:v.map((t,o)=>e.jsxs("button",{type:"button",onClick:()=>W(t),className:y("flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-[13px]",o===P?"bg-panel-2":"hover:bg-panel-2"),children:[e.jsxs("span",{className:"text-ink",children:["/",t.id]}),e.jsx("span",{className:"text-[12px] text-muted",children:t.description})]},t.id))}),X&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-full max-w-sm overflow-hidden rounded-lg border border-border bg-panel shadow-[var(--shadow-2)]",children:ge&&p.length===0?e.jsx("div",{className:"px-3 py-2 text-[12px] text-muted",children:"Indexing repo files…"}):p.length===0?e.jsx("div",{className:"px-3 py-2 text-[12px] text-muted",children:"No matching files."}):p.map((t,o)=>e.jsxs("button",{type:"button",onClick:()=>Z(t),className:y("flex w-full items-center gap-2 px-3 py-2 text-left text-[13px]",o===G?"bg-panel-2":"hover:bg-panel-2"),children:[e.jsx(we,{size:12,className:"shrink-0 text-faint"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",title:t.rel,children:t.rel})]},t.path))}),e.jsxs("div",{className:y("overflow-hidden rounded-[var(--radius-lg)] border bg-panel shadow-[var(--shadow-2)] transition-colors focus-within:border-[color:var(--accent)]",Qe?"border-[color:var(--accent)]":"border-border"),onDragOver:Ye,onDragLeave:()=>V(!1),onDrop:Ze,children:[n&&e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2.5",children:[e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:"Choose a repository",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors hover:border-border-strong hover:text-ink",children:[e.jsx(Ne,{size:12}),n.repoPath?n.repoPath.split(/[\\/]/).filter(Boolean).pop()||n.repoPath:"Choose a repo…",e.jsx(ne,{size:11,className:"text-faint"})]})}),e.jsxs(se,{align:"start",children:[n.recentRepos.length===0&&e.jsx(w,{disabled:!0,children:"No recent repos yet"}),n.recentRepos.map(t=>e.jsxs(w,{onSelect:()=>n.onChoose(t),children:[e.jsx(Ne,{size:13,className:"text-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",title:t,children:t.split(/[\\/]/).filter(Boolean).pop()||t}),t===n.repoPath&&e.jsx(z,{size:13,className:"shrink-0 text-accent"})]},t)),e.jsx(nt,{}),e.jsxs(w,{onSelect:n.onBrowse,children:[e.jsx(ht,{size:13,className:"text-muted"}),e.jsx("span",{className:"flex-1",children:"Browse…"})]})]})]}),n.repoPath&&e.jsxs("span",{title:n.branchTitle,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted",children:[e.jsx(I,{size:12}),n.branchLabel]}),e.jsxs("label",{title:"Tick to run this task in a git worktree — an isolated checkout on its own branch. Untick to work directly in the repo folder on the current branch.",className:y("inline-flex cursor-pointer select-none items-center gap-1.5 rounded-full border px-2.5 py-1 text-[12px] leading-none transition-colors","has-[:focus-visible]:[outline:2px_solid_color-mix(in_srgb,var(--accent)_40%,transparent)] has-[:focus-visible]:[outline-offset:1px]",n.useWorktree?"border-[color:var(--accent)] text-accent":"border-border bg-panel-2 text-muted hover:border-border-strong hover:text-ink"),style:n.useWorktree?{background:"color-mix(in srgb, var(--accent) 10%, transparent)"}:void 0,children:[e.jsx("input",{type:"checkbox",className:"sr-only",checked:n.useWorktree,onChange:t=>n.onWorktreeChange(t.target.checked)}),e.jsx("span",{className:"grid h-3.5 w-3.5 place-items-center rounded-[3px] border transition-colors",style:n.useWorktree?{background:"var(--accent)",borderColor:"var(--accent)"}:{borderColor:"var(--border-strong)"},"aria-hidden":!0,children:n.useWorktree&&e.jsx(z,{size:9,strokeWidth:3.5,style:{color:"var(--on-accent)"}})}),"Use worktree"]})]}),e.jsx("div",{className:y("grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",n.useWorktree?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),inert:!n.useWorktree,"aria-hidden":!n.useWorktree,children:e.jsx("div",{className:"min-h-0 overflow-hidden",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pb-2.5",children:[e.jsxs("label",{title:"Branch for the worktree — leave empty to accept the suggestion",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors focus-within:border-[color:var(--accent)]",children:[e.jsx(I,{size:12,className:"shrink-0"}),e.jsx("input",{value:n.branchName,onChange:t=>n.onBranchNameChange(t.target.value),placeholder:n.branchNamePlaceholder,"aria-label":"New branch name",spellCheck:!1,autoComplete:"off",className:"w-[164px] bg-transparent text-ink placeholder:text-faint md:w-[220px]",style:{outline:"none"}})]}),e.jsx("span",{className:"text-[11px] text-faint",children:"from"}),e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:"Base branch — where the new branch starts from",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors hover:border-border-strong hover:text-ink",children:[e.jsx(I,{size:12}),n.baseBranch,e.jsx(ne,{size:11,className:"text-faint"})]})}),e.jsxs(se,{align:"start",children:[n.repoBranches.length===0&&e.jsx(w,{disabled:!0,children:n.currentBranch||"No branches found"}),n.repoBranches.map(t=>e.jsxs(w,{onSelect:()=>n.onBaseBranchChange(t),children:[e.jsx(I,{size:13,className:"text-muted"}),e.jsx("span",{className:"flex-1",children:t}),t===n.currentBranch&&e.jsx("span",{className:"text-[11px] text-faint",children:"current"}),t===n.baseBranch&&e.jsx(z,{size:13,className:"text-accent"})]},t))]})]}),e.jsx("span",{className:"ml-auto hidden text-[11px] text-faint lg:inline",children:"Isolated copy — your checkout stays untouched"})]})})})]}),!!ce?.length&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-3 py-2",children:ce.map(t=>e.jsxs("span",{title:t,className:"inline-flex max-w-[220px] items-center gap-1 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] text-muted",children:[e.jsx(we,{size:11,className:"shrink-0 text-faint"}),e.jsx("span",{className:"min-w-0 truncate",children:t.split(/[\\/]/).filter(Boolean).pop()||t}),de&&e.jsx("button",{type:"button",onClick:()=>de(t),"aria-label":`Remove ${t}`,className:"shrink-0 text-faint transition-colors hover:text-ink",children:e.jsx(ve,{size:11})})]},t))}),C.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-3 py-2",children:C.map(t=>e.jsxs("span",{title:t.name,className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-panel-2 py-1 pl-1 pr-2 text-[12px] text-muted",children:[e.jsx("img",{src:t.dataUrl,alt:"",className:"h-8 w-8 shrink-0 rounded object-cover"}),e.jsx("span",{className:"max-w-[120px] truncate",children:t.name}),e.jsx("button",{type:"button",onClick:()=>Xe(t.id),"aria-label":`Remove ${t.name}`,className:"shrink-0 text-faint transition-colors hover:text-ink",children:e.jsx(ve,{size:11})})]},t.id))}),xe&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2 text-[13px] font-medium",style:{borderColor:"var(--instruction-border)",background:"var(--status-banner-bg)",color:"var(--accent)"},children:[e.jsx(Ve,{size:14,className:"shrink-0 animate-spin"}),e.jsx("span",{children:xe})]}),e.jsx("textarea",{ref:s,rows:n?2:1,value:r,disabled:c,onChange:t=>{a(t.target.value),H(t.target.selectionStart??t.target.value.length)},onSelect:t=>H(t.currentTarget.selectionStart??0),onPaste:Ge,onKeyDown:t=>{if(T){if(t.key==="ArrowDown"){t.preventDefault(),O(o=>Math.min(o+1,v.length-1));return}if(t.key==="ArrowUp"){t.preventDefault(),O(o=>Math.max(o-1,0));return}if(t.key==="Tab"){t.preventDefault(),W(v[Math.min(P,v.length-1)]);return}if(t.key==="Enter"&&!t.shiftKey){t.preventDefault(),W(v[Math.min(P,v.length-1)]);return}if(t.key==="Escape"){t.preventDefault(),a("");return}}else if(X&&p.length>0){if(t.key==="ArrowDown"){t.preventDefault(),Y(o=>Math.min(o+1,p.length-1));return}if(t.key==="ArrowUp"){t.preventDefault(),Y(o=>Math.max(o-1,0));return}if(t.key==="Tab"){t.preventDefault(),Z(p[Math.min(G,p.length-1)]);return}if(t.key==="Enter"&&!t.shiftKey){t.preventDefault(),Z(p[Math.min(G,p.length-1)]);return}if(t.key==="Escape"){t.preventDefault(),Q(!0);return}}else if(t.key==="Escape"&&k&&R){t.preventDefault(),R();return}t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),$())},placeholder:d,className:y("w-full resize-none bg-transparent text-[15px] text-ink placeholder:text-faint",n?"max-h-48 min-h-[64px] px-4 pt-3.5":"max-h-40 min-h-9 px-4 py-3"),style:{outline:"none"}}),e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto px-2.5 pb-2.5",children:[e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:`${m.label} — ${m.desc}`,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium text-muted transition-colors hover:bg-panel-2 hover:text-ink",children:[e.jsx(He,{size:13}),m.label,e.jsx(ne,{size:12,className:"text-faint"})]})}),e.jsx(se,{align:"start",children:Ct.map(t=>{const o=$e[t.id];return e.jsxs(w,{onSelect:()=>N(t),children:[e.jsx(o,{size:13,className:"mt-0.5 self-start text-muted"}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"text-ink",children:t.label}),e.jsx("span",{className:"text-[12px] text-muted",children:t.desc})]}),t.id===m.id&&e.jsx(z,{size:13,className:"ml-2 shrink-0 self-start text-accent"})]},t.id)})})]}),le&&e.jsx("button",{type:"button",onClick:le,title:"Add context — files, folders, or URLs","aria-label":"Add context",className:"grid h-8 w-8 shrink-0 place-items-center rounded-md text-muted transition-colors hover:bg-panel-2 hover:text-ink",children:e.jsx(ut,{size:15})}),e.jsx("div",{className:"flex-1"}),e.jsx(Mt,{used:ae,max:ie}),e.jsx(rt,{value:ue,onChange:Be}),e.jsx(at,{models:j,loadedKey:F,loadedName:S,pending:Ee,ejecting:Le,onLoad:_e,onEject:Fe,onSettings:Re,align:"end"}),k?e.jsxs(e.Fragment,{children:[!oe&&e.jsxs(e.Fragment,{children:[e.jsx(D,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:()=>$("steer"),"aria-label":"Steer the current turn",title:"Steer — interject into the current turn, redirecting what it's doing right now",children:e.jsx(mt,{size:15})}),e.jsx(D,{size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>$("followUp"),"aria-label":"Queue follow-up",title:"Queue — runs as a new turn after the current one finishes",children:e.jsx(ye,{size:15})})]}),e.jsx(D,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:R,"aria-label":"Stop this run",title:"Stop this run",children:e.jsx(it,{size:15})})]}):e.jsx(D,{size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>$(),disabled:oe,"aria-label":"Send",children:e.jsx(ye,{size:15})})]})]})]}),e.jsx(wt,{thinkingBudget:ue,ctxUsed:ae,ctxMax:ie,lastPromptTokens:Pe,lastGenTokens:Oe,lastPromptTps:We,lastGenTps:Ue,branch:n?void 0:b,cwd:n?void 0:f,hint:[c?null:Ae,!k&&he.length>0?"/ for commands":null,!k&&f?"@ to mention a file":null,k?"Esc to stop":null].filter(Boolean).join(" · ")})]})}export{Ct as A,Ht as C,Ut as S,mt as a,Mt as b,wt as c};
|
|
1
|
+
import{j as e}from"./radix-j_81dozL.js";import{r as l}from"./vendor-BFom-Mq6.js";import{g as _,H as Je,f as y,X as ve,L as Ve,B as D,I as et,t as tt}from"./index-C8wNg6Wi.js";import{D as ee,a as te,C as ne,b as se,c as w,d as nt}from"./dropdown-menu-DDpkyyj8.js";import{b as st,T as rt,M as at,d as ye,e as it}from"./ModelLoadMenu-BVi-8jbR.js";import{S as ot,a as lt,b as ct,c as dt,d as xt}from"./useIsDesktop-C-xkBB_K.js";import{F as we}from"./chat-queries-VupDrbfF.js";import{C as z}from"./check-lvVdiPFE.js";import{F as ht,G as I}from"./git-branch-nhepGrNO.js";import{P as ut}from"./plus-BvgdS6Vk.js";const pt=[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]],mt=_("corner-down-right",pt);const ft=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 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 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],Ne=_("folder-git-2",ft);const gt=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],bt=_("list-todo",gt);const jt=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],kt=_("wand-sparkles",jt);function L(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function vt(s){return s<0?"Unlimited":s===0?"Off":L(s)}function yt(s){return s<0?"Thinking budget: unlimited — no cap is sent":s===0?"Thinking: off":`Thinking budget: ${s.toLocaleString()} tokens`}function E({label:s,value:r,suffix:a,title:i}){return e.jsxs("span",{className:"inline-flex items-baseline gap-1 whitespace-nowrap",title:i,children:[s&&e.jsx("span",{children:s}),e.jsx("span",{className:"font-mono tabular-nums text-ink",children:r}),a&&e.jsx("span",{className:"font-mono tabular-nums",children:a})]})}function Se(){return e.jsx("span",{"aria-hidden":!0,className:"select-none opacity-50",children:"·"})}function wt({thinkingBudget:s,ctxUsed:r,ctxMax:a,lastPromptTokens:i,lastGenTokens:d,lastPromptTps:c,lastGenTps:n,branch:x,cwd:b,hint:m}){const N=a>0?Math.round(Math.min(1,r/a)*100):0,j=[e.jsx(E,{label:"Think",value:vt(s),title:yt(s)},"think")];return a>0&&j.push(e.jsx(E,{label:"Context",value:`${N}%`,suffix:`of ${L(a)}`,title:`Context: ${r.toLocaleString()} / ${a.toLocaleString()} tokens (${N}%)`},"ctx")),i!==void 0&&d!==void 0&&j.push(e.jsx(E,{label:"Last turn",value:`↑${L(i)} ↓${L(d)}`,title:`Last turn: ${i.toLocaleString()} prompt tokens`+(c!==void 0?` (${c.toFixed(0)} tok/s prefill)`:"")+`, ${d.toLocaleString()} generated`+(n!==void 0?` (${n.toFixed(1)} tok/s)`:"")},"turn")),n!==void 0&&j.push(e.jsx(E,{value:`${n.toFixed(1)} tok/s`,title:"Generation speed on the last turn"},"tps")),(x||b)&&j.push(e.jsxs("span",{className:"inline-flex min-w-0 items-baseline gap-1",title:b,children:[x&&e.jsx("span",{className:"truncate text-ink",children:x}),x&&b&&e.jsx(Se,{}),b&&e.jsx("span",{className:"truncate",children:Je(b)})]},"repo")),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-[11px] leading-5 text-faint",children:[j.map((F,S)=>e.jsxs(l.Fragment,{children:[S>0&&e.jsx(Se,{}),F]},S)),m&&e.jsx("span",{className:"ml-auto min-w-0 truncate pl-2",children:m})]})}const Nt=26,St=3;function Me(s){return s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}k`:String(s)}function Ie(s){const r=Math.max(0,Math.min(1,s));if(r<=.5){const i=Math.round(r/.5*100);return`color-mix(in srgb, var(--warn) ${i}%, var(--ok) ${100-i}%)`}const a=Math.round((r-.5)/.5*100);return`color-mix(in srgb, var(--err) ${a}%, var(--warn) ${100-a}%)`}function Ce({pct:s,size:r=Nt,stroke:a=St}){const i=(r-a)/2,d=2*Math.PI*i,c=d*s;return e.jsxs("svg",{width:r,height:r,viewBox:`0 0 ${r} ${r}`,className:"shrink-0","aria-hidden":!0,children:[e.jsx("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:"var(--border)",strokeWidth:a}),e.jsx("circle",{cx:r/2,cy:r/2,r:i,fill:"none",stroke:Ie(s),strokeWidth:a,strokeLinecap:"round",strokeDasharray:`${c} ${d-c}`,transform:`rotate(-90 ${r/2} ${r/2})`,style:{transition:"stroke-dasharray 0.3s ease, stroke 0.3s ease"}})]})}function Mt({used:s,max:r}){const[a,i]=l.useState(!1),d=r>0?s/r:0,c=Math.min(1,d),n=Math.round(c*100);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>i(!0),title:`Context: ${s.toLocaleString()} / ${r.toLocaleString()} tokens · ${n}%`,"aria-label":`Context usage, ${n} percent — open details`,className:"grid h-8 w-8 shrink-0 place-items-center rounded-md transition-colors hover:bg-panel-2",children:e.jsx(Ce,{pct:c})}),e.jsx(ot,{open:a,onOpenChange:i,modal:!1,children:e.jsxs(lt,{className:"overflow-y-auto p-5",onPointerDownOutside:x=>x.preventDefault(),children:[e.jsxs(ct,{children:[e.jsx(dt,{children:"Context usage"}),e.jsx(xt,{children:"How much of this task's context window is filled."})]}),e.jsxs("div",{className:"mt-2 flex flex-col items-center gap-3 rounded-lg border border-border bg-panel-2 py-6",children:[e.jsxs("div",{className:"relative grid place-items-center",children:[e.jsx(Ce,{pct:c,size:96,stroke:9}),e.jsxs("span",{className:"absolute text-[22px] font-semibold tracking-[-0.01em] text-ink tabular-nums",children:[n,"%"]})]}),e.jsx("span",{className:"text-[12px] text-muted",children:"of context window used"})]}),e.jsxs("div",{className:"mt-4 flex flex-col divide-y divide-border overflow-hidden rounded-lg border border-border",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Used"}),e.jsxs("span",{className:"text-[13px] font-medium text-ink tabular-nums",children:[s.toLocaleString()," tokens (",Me(s),")"]})]}),e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Max"}),e.jsxs("span",{className:"text-[13px] font-medium text-ink tabular-nums",children:[r.toLocaleString()," tokens (",Me(r),")"]})]}),e.jsxs("div",{className:"flex items-center justify-between px-3 py-2.5",children:[e.jsx("span",{className:"text-[13px] text-muted",children:"Percentage"}),e.jsxs("span",{className:"text-[13px] font-medium tabular-nums",style:{color:Ie(c)},children:[n,"%"]})]})]})]})})]})}const Ct=[{id:"auto",label:"Auto",desc:"Plans and edits end-to-end, asks only when blocked"},{id:"plan",label:"Plan first",desc:"Shows a plan for approval before touching files"},{id:"ask",label:"Ask each step",desc:"Approval gate on every file edit and command"}],Ut=["Fix the failing test in engine-groups.test.ts","Add a --verbose flag to the CLI","Write unit tests for lib/vram.ts","Explain how gateway auto model-swap works"],$e={auto:kt,plan:bt,ask:st},$t=new Set(["node_modules","dist","build","out","coverage","target",".turbo",".next",".cache",".venv","venv","__pycache__",".git"]),re=500,De=150,Dt=8;async function zt(s){const r=[];let a=0,i=[s];for(;i.length&&a<De&&r.length<re;){const d=await Promise.all(i.map(n=>et(n).catch(()=>null))),c=[];for(const n of d)if(n){a++;for(const x of n.entries)x.isDir?$t.has(x.name)||c.push(x.path):r.length<re&&r.push({path:x.path,rel:It(s,x.path)});if(a>=De||r.length>=re)break}i=c}return r}function It(s,r){const a=c=>c.replace(/\\/g,"/").replace(/\/+$/,""),i=a(s),d=a(r);return d.startsWith(`${i}/`)?d.slice(i.length+1):d}const ze=8*1024*1024;function Et(s){return new Promise((r,a)=>{const i=new FileReader;i.onload=()=>r(i.result),i.onerror=()=>a(i.error),i.readAsDataURL(s)})}function Ht({inputRef:s,value:r,onValueChange:a,onSubmit:i,placeholder:d,textareaDisabled:c,repo:n,repoRoot:x,repoBranch:b,mode:m,onModeChange:N,models:j,loadedKey:F,loadedName:S,modelPending:Ee,ejecting:Le,onLoadModel:_e,onEjectModel:Fe,onModelSettings:Re,ctxUsed:ae,ctxMax:ie,live:k,onStop:R,sendDisabled:oe,onAddContext:le,contextFiles:ce,onRemoveContextFile:de,hintText:Ae,statusText:xe,slashCommands:he=[],thinkingBudget:ue,onThinkingBudgetChange:Be,onImagesChange:Te,lastPromptTokens:Pe,lastGenTokens:Oe,lastPromptTps:We,lastGenTps:Ue}){const He=$e[m.id],A=/^\/([a-z0-9-]*)$/i.exec(r),B=A?.[1]?.toLowerCase()??"",v=A?he.filter(t=>!B||t.id.includes(B)):[],T=!!A&&v.length>0&&!k,[P,O]=l.useState(0);l.useEffect(()=>{O(0)},[B,T]);const W=t=>{a(`/${t.id} `)};l.useEffect(()=>{const t=s.current;t&&(t.style.height="auto",t.style.height=`${t.scrollHeight}px`)},[r,s]);const f=n?.repoPath??x,[U,H]=l.useState(0),Ke=r.slice(0,U),K=/(?:^|\s)@([^\s@]*)$/.exec(Ke),q=K?.[1]?.toLowerCase()??"",g=K?U-K[1].length-1:-1,[qe,Q]=l.useState(!1),pe=l.useRef(-1);l.useEffect(()=>{g!==pe.current&&(Q(!1),pe.current=g)},[g]);const[me,fe]=l.useState(null),[ge,be]=l.useState(!1),je=l.useRef(null);l.useEffect(()=>{!f||g===-1||je.current!==f&&(je.current=f,be(!0),fe(null),zt(f).then(fe).finally(()=>be(!1)))},[f,g]);const p=me?me.filter(t=>!q||t.rel.toLowerCase().includes(q)).slice(0,Dt):[],X=g!==-1&&!qe&&!k&&!!f&&(ge||p.length>0),[G,Y]=l.useState(0);l.useEffect(()=>{Y(0)},[q,X]);const M=l.useRef(null),Z=t=>{if(g===-1)return;const o=r.slice(0,g),h=r.slice(U),u=`@${t.rel} `;a(o+u+h),M.current=o.length+u.length,Q(!0)};l.useEffect(()=>{if(M.current==null)return;const t=M.current;M.current=null;const o=s.current;o&&(o.focus(),o.setSelectionRange(t,t),H(t))},[r,s]);const[C,J]=l.useState([]);l.useEffect(()=>{Te?.(C)},[C]);const[Qe,V]=l.useState(!1),ke=async t=>{if(t.size>ze){tt.error(`${t.name||"Image"} is too large (${(t.size/(1024*1024)).toFixed(1)} MB — max ${ze/(1024*1024)} MB).`);return}const o=await Et(t);J(h=>[...h,{id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:t.name||"pasted-image.png",dataUrl:o,size:t.size}])},Xe=t=>J(o=>o.filter(h=>h.id!==t)),Ge=t=>{const h=Array.from(t.clipboardData?.items??[]).filter(u=>u.kind==="file"&&u.type.startsWith("image/")).map(u=>u.getAsFile()).filter(u=>!!u);if(h.length!==0){t.preventDefault();for(const u of h)ke(u)}},Ye=t=>{Array.from(t.dataTransfer?.types??[]).includes("Files")&&(t.preventDefault(),V(!0))},Ze=t=>{t.preventDefault(),V(!1);const o=Array.from(t.dataTransfer?.files??[]).filter(h=>h.type.startsWith("image/"));for(const h of o)ke(h)},$=t=>{J([]),i(t)};return e.jsxs("div",{children:[e.jsxs("div",{className:"relative",children:[T&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-full max-w-sm overflow-hidden rounded-lg border border-border bg-panel shadow-[var(--shadow-2)]",children:v.map((t,o)=>e.jsxs("button",{type:"button",onClick:()=>W(t),className:y("flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-[13px]",o===P?"bg-panel-2":"hover:bg-panel-2"),children:[e.jsxs("span",{className:"text-ink",children:["/",t.id]}),e.jsx("span",{className:"text-[12px] text-muted",children:t.description})]},t.id))}),X&&e.jsx("div",{className:"absolute bottom-full left-0 mb-2 w-full max-w-sm overflow-hidden rounded-lg border border-border bg-panel shadow-[var(--shadow-2)]",children:ge&&p.length===0?e.jsx("div",{className:"px-3 py-2 text-[12px] text-muted",children:"Indexing repo files…"}):p.length===0?e.jsx("div",{className:"px-3 py-2 text-[12px] text-muted",children:"No matching files."}):p.map((t,o)=>e.jsxs("button",{type:"button",onClick:()=>Z(t),className:y("flex w-full items-center gap-2 px-3 py-2 text-left text-[13px]",o===G?"bg-panel-2":"hover:bg-panel-2"),children:[e.jsx(we,{size:12,className:"shrink-0 text-faint"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",title:t.rel,children:t.rel})]},t.path))}),e.jsxs("div",{className:y("overflow-hidden rounded-[var(--radius-lg)] border bg-panel shadow-[var(--shadow-2)] transition-colors focus-within:border-[color:var(--accent)]",Qe?"border-[color:var(--accent)]":"border-border"),onDragOver:Ye,onDragLeave:()=>V(!1),onDrop:Ze,children:[n&&e.jsxs("div",{className:"border-b border-border",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-2.5",children:[e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:"Choose a repository",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors hover:border-border-strong hover:text-ink",children:[e.jsx(Ne,{size:12}),n.repoPath?n.repoPath.split(/[\\/]/).filter(Boolean).pop()||n.repoPath:"Choose a repo…",e.jsx(ne,{size:11,className:"text-faint"})]})}),e.jsxs(se,{align:"start",children:[n.recentRepos.length===0&&e.jsx(w,{disabled:!0,children:"No recent repos yet"}),n.recentRepos.map(t=>e.jsxs(w,{onSelect:()=>n.onChoose(t),children:[e.jsx(Ne,{size:13,className:"text-muted"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",title:t,children:t.split(/[\\/]/).filter(Boolean).pop()||t}),t===n.repoPath&&e.jsx(z,{size:13,className:"shrink-0 text-accent"})]},t)),e.jsx(nt,{}),e.jsxs(w,{onSelect:n.onBrowse,children:[e.jsx(ht,{size:13,className:"text-muted"}),e.jsx("span",{className:"flex-1",children:"Browse…"})]})]})]}),n.repoPath&&e.jsxs("span",{title:n.branchTitle,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted",children:[e.jsx(I,{size:12}),n.branchLabel]}),e.jsxs("label",{title:"Tick to run this task in a git worktree — an isolated checkout on its own branch. Untick to work directly in the repo folder on the current branch.",className:y("inline-flex cursor-pointer select-none items-center gap-1.5 rounded-full border px-2.5 py-1 text-[12px] leading-none transition-colors","has-[:focus-visible]:[outline:2px_solid_color-mix(in_srgb,var(--accent)_40%,transparent)] has-[:focus-visible]:[outline-offset:1px]",n.useWorktree?"border-[color:var(--accent)] text-accent":"border-border bg-panel-2 text-muted hover:border-border-strong hover:text-ink"),style:n.useWorktree?{background:"color-mix(in srgb, var(--accent) 10%, transparent)"}:void 0,children:[e.jsx("input",{type:"checkbox",className:"sr-only",checked:n.useWorktree,onChange:t=>n.onWorktreeChange(t.target.checked)}),e.jsx("span",{className:"grid h-3.5 w-3.5 place-items-center rounded-[3px] border transition-colors",style:n.useWorktree?{background:"var(--accent)",borderColor:"var(--accent)"}:{borderColor:"var(--border-strong)"},"aria-hidden":!0,children:n.useWorktree&&e.jsx(z,{size:9,strokeWidth:3.5,style:{color:"var(--on-accent)"}})}),"Use worktree"]})]}),e.jsx("div",{className:y("grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",n.useWorktree?"grid-rows-[1fr] opacity-100":"grid-rows-[0fr] opacity-0"),inert:!n.useWorktree,"aria-hidden":!n.useWorktree,children:e.jsx("div",{className:"min-h-0 overflow-hidden",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 px-3 pb-2.5",children:[e.jsxs("label",{title:"Branch for the worktree — leave empty to accept the suggestion",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors focus-within:border-[color:var(--accent)]",children:[e.jsx(I,{size:12,className:"shrink-0"}),e.jsx("input",{value:n.branchName,onChange:t=>n.onBranchNameChange(t.target.value),placeholder:n.branchNamePlaceholder,"aria-label":"New branch name",spellCheck:!1,autoComplete:"off",className:"w-[164px] bg-transparent text-ink placeholder:text-faint md:w-[220px]",style:{outline:"none"}})]}),e.jsx("span",{className:"text-[11px] text-faint",children:"from"}),e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:"Base branch — where the new branch starts from",className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] leading-none text-muted transition-colors hover:border-border-strong hover:text-ink",children:[e.jsx(I,{size:12}),n.baseBranch,e.jsx(ne,{size:11,className:"text-faint"})]})}),e.jsxs(se,{align:"start",children:[n.repoBranches.length===0&&e.jsx(w,{disabled:!0,children:n.currentBranch||"No branches found"}),n.repoBranches.map(t=>e.jsxs(w,{onSelect:()=>n.onBaseBranchChange(t),children:[e.jsx(I,{size:13,className:"text-muted"}),e.jsx("span",{className:"flex-1",children:t}),t===n.currentBranch&&e.jsx("span",{className:"text-[11px] text-faint",children:"current"}),t===n.baseBranch&&e.jsx(z,{size:13,className:"text-accent"})]},t))]})]}),e.jsx("span",{className:"ml-auto hidden text-[11px] text-faint lg:inline",children:"Isolated copy — your checkout stays untouched"})]})})})]}),!!ce?.length&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-3 py-2",children:ce.map(t=>e.jsxs("span",{title:t,className:"inline-flex max-w-[220px] items-center gap-1 rounded-full border border-border bg-panel-2 px-2.5 py-1 text-[12px] text-muted",children:[e.jsx(we,{size:11,className:"shrink-0 text-faint"}),e.jsx("span",{className:"min-w-0 truncate",children:t.split(/[\\/]/).filter(Boolean).pop()||t}),de&&e.jsx("button",{type:"button",onClick:()=>de(t),"aria-label":`Remove ${t}`,className:"shrink-0 text-faint transition-colors hover:text-ink",children:e.jsx(ve,{size:11})})]},t))}),C.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 border-b border-border px-3 py-2",children:C.map(t=>e.jsxs("span",{title:t.name,className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-panel-2 py-1 pl-1 pr-2 text-[12px] text-muted",children:[e.jsx("img",{src:t.dataUrl,alt:"",className:"h-8 w-8 shrink-0 rounded object-cover"}),e.jsx("span",{className:"max-w-[120px] truncate",children:t.name}),e.jsx("button",{type:"button",onClick:()=>Xe(t.id),"aria-label":`Remove ${t.name}`,className:"shrink-0 text-faint transition-colors hover:text-ink",children:e.jsx(ve,{size:11})})]},t.id))}),xe&&e.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2 text-[13px] font-medium",style:{borderColor:"var(--instruction-border)",background:"var(--status-banner-bg)",color:"var(--accent)"},children:[e.jsx(Ve,{size:14,className:"shrink-0 animate-spin"}),e.jsx("span",{children:xe})]}),e.jsx("textarea",{ref:s,rows:n?2:1,value:r,disabled:c,onChange:t=>{a(t.target.value),H(t.target.selectionStart??t.target.value.length)},onSelect:t=>H(t.currentTarget.selectionStart??0),onPaste:Ge,onKeyDown:t=>{if(T){if(t.key==="ArrowDown"){t.preventDefault(),O(o=>Math.min(o+1,v.length-1));return}if(t.key==="ArrowUp"){t.preventDefault(),O(o=>Math.max(o-1,0));return}if(t.key==="Tab"){t.preventDefault(),W(v[Math.min(P,v.length-1)]);return}if(t.key==="Enter"&&!t.shiftKey){t.preventDefault(),W(v[Math.min(P,v.length-1)]);return}if(t.key==="Escape"){t.preventDefault(),a("");return}}else if(X&&p.length>0){if(t.key==="ArrowDown"){t.preventDefault(),Y(o=>Math.min(o+1,p.length-1));return}if(t.key==="ArrowUp"){t.preventDefault(),Y(o=>Math.max(o-1,0));return}if(t.key==="Tab"){t.preventDefault(),Z(p[Math.min(G,p.length-1)]);return}if(t.key==="Enter"&&!t.shiftKey){t.preventDefault(),Z(p[Math.min(G,p.length-1)]);return}if(t.key==="Escape"){t.preventDefault(),Q(!0);return}}else if(t.key==="Escape"&&k&&R){t.preventDefault(),R();return}t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),$())},placeholder:d,className:y("w-full resize-none bg-transparent text-[15px] text-ink placeholder:text-faint",n?"max-h-48 min-h-[64px] px-4 pt-3.5":"max-h-40 min-h-9 px-4 py-3"),style:{outline:"none"}}),e.jsxs("div",{className:"flex items-center gap-1 overflow-x-auto px-2.5 pb-2.5",children:[e.jsxs(ee,{children:[e.jsx(te,{asChild:!0,children:e.jsxs("button",{type:"button",title:`${m.label} — ${m.desc}`,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium text-muted transition-colors hover:bg-panel-2 hover:text-ink",children:[e.jsx(He,{size:13}),m.label,e.jsx(ne,{size:12,className:"text-faint"})]})}),e.jsx(se,{align:"start",children:Ct.map(t=>{const o=$e[t.id];return e.jsxs(w,{onSelect:()=>N(t),children:[e.jsx(o,{size:13,className:"mt-0.5 self-start text-muted"}),e.jsxs("span",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"text-ink",children:t.label}),e.jsx("span",{className:"text-[12px] text-muted",children:t.desc})]}),t.id===m.id&&e.jsx(z,{size:13,className:"ml-2 shrink-0 self-start text-accent"})]},t.id)})})]}),le&&e.jsx("button",{type:"button",onClick:le,title:"Add context — files, folders, or URLs","aria-label":"Add context",className:"grid h-8 w-8 shrink-0 place-items-center rounded-md text-muted transition-colors hover:bg-panel-2 hover:text-ink",children:e.jsx(ut,{size:15})}),e.jsx("div",{className:"flex-1"}),e.jsx(Mt,{used:ae,max:ie}),e.jsx(rt,{value:ue,onChange:Be}),e.jsx(at,{models:j,loadedKey:F,loadedName:S,pending:Ee,ejecting:Le,onLoad:_e,onEject:Fe,onSettings:Re,align:"end"}),k?e.jsxs(e.Fragment,{children:[!oe&&e.jsxs(e.Fragment,{children:[e.jsx(D,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:()=>$("steer"),"aria-label":"Steer the current turn",title:"Steer — interject into the current turn, redirecting what it's doing right now",children:e.jsx(mt,{size:15})}),e.jsx(D,{size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>$("followUp"),"aria-label":"Queue follow-up",title:"Queue — runs as a new turn after the current one finishes",children:e.jsx(ye,{size:15})})]}),e.jsx(D,{size:"icon",variant:"outline",className:"h-8 w-8 shrink-0",onClick:R,"aria-label":"Stop this run",title:"Stop this run",children:e.jsx(it,{size:15})})]}):e.jsx(D,{size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>$(),disabled:oe,"aria-label":"Send",children:e.jsx(ye,{size:15})})]})]})]}),e.jsx(wt,{thinkingBudget:ue,ctxUsed:ae,ctxMax:ie,lastPromptTokens:Pe,lastGenTokens:Oe,lastPromptTps:We,lastGenTps:Ue,branch:n?void 0:b,cwd:n?void 0:f,hint:[c?null:Ae,!k&&he.length>0?"/ for commands":null,!k&&f?"@ to mention a file":null,k?"Esc to stop":null].filter(Boolean).join(" · ")})]})}export{Ct as A,Ht as C,Ut as S,mt as a,Mt as b,wt as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-j_81dozL.js";import{r as o,b as Ce}from"./vendor-BFom-Mq6.js";import{i as Re,j as Le,k as Me,l as Be,f as X,B as Ae,m as Ee,t as y,A as W}from"./index-DaNuMYPC.js";import{g as De}from"./personas-DNCENHUd.js";import{u as Oe,M as Te}from"./useIsDesktop-D2KX8NOA.js";import{r as $e,S as We,s as Fe,u as Pe,C as Ie,a as _e,P as Ke,c as ze}from"./ModelLoadMenu-DzaxKmIV.js";import{F as Z}from"./FsBrowser-D9RjrjvO.js";import{S as ne}from"./skeleton-D15eL_7e.js";import{A as He,S as Ge,C as Qe}from"./CodeComposer-BvNMY6PI.js";import"./dialog-fsfhY_Ib.js";import"./copy-button-DKUAZ6Ig.js";import"./check-Do9IgpFj.js";import"./dropdown-menu-B6pYEdad.js";import"./sliders-horizontal-C4_t3PES.js";import"./rotate-ccw-B7o8hLk6.js";import"./chat-queries-DINfS8uv.js";import"./chat-api-CdVOTSst.js";import"./collapsible-tffcj0HQ.js";import"./chevron-right-C8EPnhrg.js";import"./plus-DrZmKBTt.js";import"./chevron-left-CbPqt11D.js";import"./pencil-BegDY0Zk.js";import"./trash-2-B9nMCHMA.js";import"./star-SskkfhIb.js";import"./common-RZkQjs09.js";import"./git-branch-BiMfcJ1j.js";const ae=[0,20,45,70,100],S=20,E=4,ee=4,Ue={1:"Mon",3:"Wed",5:"Fri"};function Je(s,a){if(s<=0||a<=0)return 0;const i=s/a;return i>.75?4:i>.5?3:i>.25?2:1}function te(s){return s===0?"var(--panel-2)":`color-mix(in srgb, var(--accent) ${ae[s]}%, var(--panel-2))`}function Ve(s){return`${s.date}: ${s.sessions} agent session${s.sessions===1?"":"s"}`}function Ye({days:s}){const a=o.useRef(null);if(o.useLayoutEffect(()=>{const n=a.current;n&&(n.scrollLeft=n.scrollWidth)},[s]),!s.length)return null;const i=Math.max(1,...s.map(n=>n.sessions)),r=new Date(`${s[0].date}T00:00:00`).getDay(),h=[...Array(r).fill(null),...s],p=Math.ceil(h.length/7),b=[...h,...Array(p*7-h.length).fill(null)],x=[];let N=-1;for(let n=0;n<p;n++)for(let d=0;d<7;d++){const L=b[n*7+d];if(!L)continue;const v=new Date(`${L.date}T00:00:00`);if(v.getDate()<=7){v.getMonth()!==N&&(N=v.getMonth(),x.push({col:n,label:v.toLocaleDateString(void 0,{month:"short"})}));break}}return e.jsx("div",{className:"overflow-x-auto",ref:a,children:e.jsxs("div",{className:"inline-block",children:[e.jsx("div",{className:"relative mb-1",style:{height:14,display:"grid",gridTemplateColumns:`repeat(${p}, ${S}px)`,columnGap:E,marginLeft:34},children:x.map(({col:n,label:d})=>e.jsx("span",{style:{gridColumn:n+1},className:"text-[10px] text-faint",children:d},n))}),e.jsxs("div",{className:"flex",style:{gap:E},children:[e.jsx("div",{className:"flex w-[30px] shrink-0 flex-col pr-1",style:{gap:E},children:[0,1,2,3,4,5,6].map(n=>e.jsx("div",{style:{height:S},className:"flex items-center text-[10px] text-faint",children:Ue[n]??""},n))}),e.jsx("div",{style:{display:"grid",gridTemplateRows:`repeat(7, ${S}px)`,gridAutoFlow:"column",gap:E},children:b.map((n,d)=>n?e.jsx("div",{title:Ve(n),style:{width:S,height:S,borderRadius:ee,background:te(Je(n.sessions,i))}},d):e.jsx("div",{style:{width:S,height:S}},d))})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1 text-[11px] text-muted",children:[e.jsx("span",{children:"Less"}),ae.map((n,d)=>e.jsx("div",{style:{width:14,height:14,borderRadius:ee,background:te(d)}},n)),e.jsx("span",{children:"More"})]})]})})}const oe="tllm.code.recentRepos";function re(){try{const s=localStorage.getItem(oe),a=s?JSON.parse(s):[];return Array.isArray(a)?a.filter(i=>typeof i=="string"):[]}catch{return[]}}function qe(s){const a=[s,...re().filter(i=>i!==s)].slice(0,6);try{localStorage.setItem(oe,JSON.stringify(a))}catch{}return a}function se(s){const a=s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").split("-").slice(0,4).join("-");return a?`turbo/${a}`:"turbo/my-task"}function Xe({className:s}){const a=Array.from({length:8},(i,r)=>{const h=r*Math.PI/4,p=x=>Math.round((12+Math.cos(h)*x)*100)/100,b=x=>Math.round((12+Math.sin(h)*x)*100)/100;return e.jsx("line",{x1:p(4.4),y1:b(4.4),x2:p(9.6),y2:b(9.6)},r)});return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.6,strokeLinecap:"round",className:s,"aria-hidden":!0,children:a})}function Ze({value:s,onChange:a,options:i}){return e.jsx("div",{className:"flex shrink-0 overflow-hidden rounded-lg border border-border",children:i.map(r=>e.jsx("button",{type:"button",onClick:()=>a(r.value),className:"px-3 py-1.5 text-[12px] font-medium transition-colors",style:{background:s===r.value?"var(--accent)":"transparent",color:s===r.value?"var(--on-accent)":"var(--muted)"},children:r.label},r.value))})}function g({label:s,value:a,loading:i}){return e.jsxs("div",{className:"rounded-lg border border-border bg-panel p-4 transition-colors hover:border-border-strong",children:[e.jsx("div",{className:"text-[12px] text-muted",children:s}),i?e.jsx(ne,{className:"mt-1.5 h-6 w-16"}):e.jsx("div",{className:"mt-1 truncate text-[20px] font-semibold tracking-[-0.01em] text-ink tabular-nums",children:a})]})}function Ct(){const s=Ce(),[a,i]=o.useState("all"),[r,h]=o.useState(null),[p,b]=o.useState(()=>re()),[x,N]=o.useState(!1),[n,d]=o.useState([]),[L,v]=o.useState(!1),f=Re(r,!!r),j=f.data?.isRepo?f.data.branch:"",ie=f.data?.isRepo?f.data.branches:[],F=Le(),k=F.data?.model??null,D=F.data?.engine.state,P=D==="running"&&!!k,le=Me(),w=Be(),de=(le.data?.models??[]).filter(t=>t.compatibleWithActiveEngine),ce=w.load.isPending||w.eject.isPending||D==="starting"||D==="stopping",[me,I]=o.useState(null),ue=t=>{w.load.mutate({key:t},{onError:c=>y.error(c instanceof W?c.message:"Could not load model.")})},he=()=>{w.eject.mutate(void 0,{onError:t=>y.error(t instanceof W?t.message:"Could not eject model.")})},[_,pe]=o.useState(He[0]),[C,O]=o.useState(""),[xe,fe]=o.useState(()=>{const t=localStorage.getItem("tllm.thinkingBudget.default");return t!==null?Number(t):-1}),ge=t=>{localStorage.setItem("tllm.thinkingBudget.default",String(t)),fe(t)},[K,z]=o.useState(!1),[M,H]=o.useState(!1),[G,T]=o.useState(""),[Q,U]=o.useState(""),B=o.useRef(null),m=Oe(),[A,be]=o.useState(!0),[J,R]=o.useState(!1),[ve,je]=o.useState(()=>Math.min(Math.max($e(),We),Fe())),V=o.useRef(null),Y=De().userName.trim(),u=Pe(a),l=u.data;o.useEffect(()=>{m&&B.current?.focus()},[m]),o.useEffect(()=>{j&&U(j)},[j]);const q=t=>{h(t),T(""),b(qe(t))},Se=()=>{O(""),H(!1),T(""),B.current?.focus()},ke=t=>{O(t),B.current?.focus()},ye=new Set(["compact"]),$=/^\/([a-z0-9-]+)\b/i.exec(C.trim()),Ne=async()=>{const t=C.trim();if(!(!t||K)){if($&&ye.has($[1].toLowerCase())){y.error(`/${$[1]} only works inside an existing session — start a task first, then use it as a follow-up.`);return}if(!r){y.error("Choose a repository first.");return}if(!P||!k){y.error("Load a model first.");return}z(!0);try{const{sessionId:c}=await ze({repoRoot:r,repoBranch:j||void 0,modelKey:k.key,mode:_.id,task:t,useWorktree:M,worktreeBranch:M?G.trim()||se(t):void 0,worktreeBase:M?Q:void 0,contextFiles:n.length?n:void 0});s(`/workspace/code/${c}`)}catch(c){y.error(c instanceof W?c.message:"Could not start the task.")}finally{z(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-full overflow-hidden",children:[!m&&J&&e.jsx("div",{className:"fixed inset-0 z-30 bg-black/40 md:hidden",onClick:()=>R(!1),"aria-hidden":!0}),e.jsx("div",{ref:V,className:X("tllm-chat-sidebar",m?A?"shrink-0":"w-10 shrink-0":X("fixed inset-y-0 left-0 z-40 w-[84vw] max-w-[300px] shadow-[var(--shadow-2)]",J?"translate-x-0":"-translate-x-full")),style:m&&A?{width:ve}:void 0,children:e.jsx(Ie,{activeId:null,onSelect:t=>{s(`/workspace/chat/${t}`),m||R(!1)},onNew:()=>{Se(),m||R(!1)},collapsed:m?!A:!1,onToggle:m?()=>be(t=>!t):()=>R(!1)})}),m&&A&&e.jsx(_e,{sidebarRef:V,onCommit:je}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex h-12 shrink-0 items-center gap-1.5 border-b border-border px-3 md:gap-3 md:px-8",children:e.jsx(Ae,{size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0 md:hidden",onClick:()=>R(!0),title:"History","aria-label":"Open sidebar",children:e.jsx(Ke,{size:16})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"flex w-full flex-col px-4 py-6 md:px-8",children:[e.jsxs("div",{className:"tllm-rise flex flex-col items-center text-center",children:[e.jsx(Xe,{className:"h-9 w-9 text-accent"}),e.jsxs("h1",{className:"mt-4 text-[28px] font-semibold leading-tight tracking-[-0.02em] text-ink",children:["What’s up next",Y?`, ${Y}`:"","?"]}),e.jsx("p",{className:"mt-1.5 text-[13px] text-muted",children:"Hand a coding task to an agent that runs entirely on your machine."})]}),e.jsxs("div",{className:"tllm-rise mt-12",style:{animationDelay:"50ms"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Coding activity"}),e.jsx(Ze,{value:a,onChange:i,options:[{value:"all",label:"All"},{value:"30d",label:"30d"},{value:"7d",label:"7d"}]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(g,{label:"Sessions",value:(l?.sessions??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Tasks shipped",value:(l?.tasksShipped??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Files touched",value:(l?.filesTouched??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Diff shipped",value:Ee(l?.diffAdded??0,l?.diffRemoved??0),loading:u.isLoading}),e.jsx(g,{label:"Active days",value:(l?.activeDays??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Current streak",value:`${l?.currentStreak??0}d`,loading:u.isLoading}),e.jsx(g,{label:"Longest streak",value:`${l?.longestStreak??0}d`,loading:u.isLoading}),e.jsx(g,{label:"Favorite model",value:l?.favoriteModel??"—",loading:u.isLoading})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-panel p-4",children:[e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Session activity"}),e.jsx("span",{className:"text-[11px] text-faint",children:"one box = one day"})]}),u.isLoading?e.jsx(ne,{className:"h-[122px] w-full"}):e.jsx(Ye,{days:l?.heatmap??[]}),!!l&&l.diffAdded>0&&e.jsxs("p",{className:"mt-3 text-center text-[12px] italic text-muted",children:["Agents have added ",l.diffAdded.toLocaleString()," line",l.diffAdded===1?"":"s"," here."]})]})]})]})}),e.jsxs("div",{className:"shrink-0 px-3 pb-3 md:px-8 md:pb-5",children:[e.jsx("div",{className:"mb-3 flex flex-wrap justify-center gap-2",children:Ge.map(t=>e.jsx("button",{type:"button",onClick:()=>ke(t),className:"rounded-full border border-border bg-panel px-3 py-1.5 text-[12px] text-muted transition-all hover:-translate-y-px hover:border-[color:var(--accent)] hover:text-ink",children:t},t))}),e.jsx(Qe,{inputRef:B,value:C,onValueChange:O,onSubmit:()=>{Ne()},placeholder:"Describe a task or ask a question…",repo:{repoPath:r,recentRepos:p,onChoose:q,onBrowse:()=>N(!0),branchLabel:f.isFetching?"…":f.data?.isRepo?j||"no commits":"no git",branchTitle:f.isFetching?"Reading branch…":f.data?.isRepo?`Checked-out branch: ${j||"(no commits yet)"}`:"Not a git repository — no branch info",useWorktree:M,onWorktreeChange:H,branchName:G,onBranchNameChange:T,branchNamePlaceholder:se(C),baseBranch:Q,onBaseBranchChange:U,repoBranches:ie,currentBranch:j},mode:_,onModeChange:pe,models:de,loadedKey:k?.key??null,loadedName:k?.name??null,modelPending:ce,ejecting:w.eject.isPending,onLoadModel:ue,onEjectModel:he,thinkingBudget:xe,onThinkingBudgetChange:ge,onModelSettings:t=>I(t),ctxUsed:0,ctxMax:k?.ctx??0,sendDisabled:!C.trim()||!r||!P||K,onAddContext:()=>v(!0),contextFiles:n,onRemoveContextFile:t=>d(c=>c.filter(we=>we!==t)),hintText:"Enter to start · Shift+Enter for newline · 100% local — your code never leaves this machine"})]})]})]}),e.jsx(Z,{open:x,onOpenChange:N,onSelect:q,mode:"folder",title:"Choose a repository",description:"Open the project folder you want the agent to work in, then click Select this folder."}),e.jsx(Z,{open:L,onOpenChange:v,onSelect:t=>d(c=>c.includes(t)?c:[...c,t]),mode:"file",startPath:r??void 0,title:"Add context",description:"Pick a file to point the agent at — it'll read it if relevant to the task."}),e.jsx(Te,{modelKey:me,onClose:()=>I(null)})]})}export{Ct as CodeHomeScreen};
|
|
1
|
+
import{j as e}from"./radix-j_81dozL.js";import{r as o,b as Ce}from"./vendor-BFom-Mq6.js";import{i as Re,j as Le,k as Me,l as Be,f as X,B as Ae,m as Ee,t as y,A as W}from"./index-C8wNg6Wi.js";import{g as De}from"./personas-37gn2PeP.js";import{u as Oe,M as Te}from"./useIsDesktop-C-xkBB_K.js";import{r as $e,S as We,s as Fe,u as Pe,C as Ie,a as _e,P as Ke,c as ze}from"./ModelLoadMenu-BVi-8jbR.js";import{F as Z}from"./FsBrowser-ClSut33T.js";import{S as ne}from"./skeleton-BWLBT8PZ.js";import{A as He,S as Ge,C as Qe}from"./CodeComposer-pkcqzmvN.js";import"./dialog-DdlXu__o.js";import"./copy-button-DKb_WA32.js";import"./check-lvVdiPFE.js";import"./dropdown-menu-DDpkyyj8.js";import"./sliders-horizontal-_Pw_fPxo.js";import"./rotate-ccw-B5F4Bcwl.js";import"./chat-queries-VupDrbfF.js";import"./chat-api-DZ49knUn.js";import"./collapsible-tffcj0HQ.js";import"./chevron-right-BTbLU6GN.js";import"./plus-BvgdS6Vk.js";import"./chevron-left-DwdYJZHs.js";import"./pencil-B6MqYBDR.js";import"./trash-2-BMQd9RUh.js";import"./star-DRBODCiH.js";import"./common-B-Q9ODI5.js";import"./git-branch-nhepGrNO.js";const ae=[0,20,45,70,100],S=20,E=4,ee=4,Ue={1:"Mon",3:"Wed",5:"Fri"};function Je(s,a){if(s<=0||a<=0)return 0;const i=s/a;return i>.75?4:i>.5?3:i>.25?2:1}function te(s){return s===0?"var(--panel-2)":`color-mix(in srgb, var(--accent) ${ae[s]}%, var(--panel-2))`}function Ve(s){return`${s.date}: ${s.sessions} agent session${s.sessions===1?"":"s"}`}function Ye({days:s}){const a=o.useRef(null);if(o.useLayoutEffect(()=>{const n=a.current;n&&(n.scrollLeft=n.scrollWidth)},[s]),!s.length)return null;const i=Math.max(1,...s.map(n=>n.sessions)),r=new Date(`${s[0].date}T00:00:00`).getDay(),h=[...Array(r).fill(null),...s],p=Math.ceil(h.length/7),b=[...h,...Array(p*7-h.length).fill(null)],x=[];let N=-1;for(let n=0;n<p;n++)for(let d=0;d<7;d++){const L=b[n*7+d];if(!L)continue;const v=new Date(`${L.date}T00:00:00`);if(v.getDate()<=7){v.getMonth()!==N&&(N=v.getMonth(),x.push({col:n,label:v.toLocaleDateString(void 0,{month:"short"})}));break}}return e.jsx("div",{className:"overflow-x-auto",ref:a,children:e.jsxs("div",{className:"inline-block",children:[e.jsx("div",{className:"relative mb-1",style:{height:14,display:"grid",gridTemplateColumns:`repeat(${p}, ${S}px)`,columnGap:E,marginLeft:34},children:x.map(({col:n,label:d})=>e.jsx("span",{style:{gridColumn:n+1},className:"text-[10px] text-faint",children:d},n))}),e.jsxs("div",{className:"flex",style:{gap:E},children:[e.jsx("div",{className:"flex w-[30px] shrink-0 flex-col pr-1",style:{gap:E},children:[0,1,2,3,4,5,6].map(n=>e.jsx("div",{style:{height:S},className:"flex items-center text-[10px] text-faint",children:Ue[n]??""},n))}),e.jsx("div",{style:{display:"grid",gridTemplateRows:`repeat(7, ${S}px)`,gridAutoFlow:"column",gap:E},children:b.map((n,d)=>n?e.jsx("div",{title:Ve(n),style:{width:S,height:S,borderRadius:ee,background:te(Je(n.sessions,i))}},d):e.jsx("div",{style:{width:S,height:S}},d))})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-end gap-1 text-[11px] text-muted",children:[e.jsx("span",{children:"Less"}),ae.map((n,d)=>e.jsx("div",{style:{width:14,height:14,borderRadius:ee,background:te(d)}},n)),e.jsx("span",{children:"More"})]})]})})}const oe="tllm.code.recentRepos";function re(){try{const s=localStorage.getItem(oe),a=s?JSON.parse(s):[];return Array.isArray(a)?a.filter(i=>typeof i=="string"):[]}catch{return[]}}function qe(s){const a=[s,...re().filter(i=>i!==s)].slice(0,6);try{localStorage.setItem(oe,JSON.stringify(a))}catch{}return a}function se(s){const a=s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").split("-").slice(0,4).join("-");return a?`turbo/${a}`:"turbo/my-task"}function Xe({className:s}){const a=Array.from({length:8},(i,r)=>{const h=r*Math.PI/4,p=x=>Math.round((12+Math.cos(h)*x)*100)/100,b=x=>Math.round((12+Math.sin(h)*x)*100)/100;return e.jsx("line",{x1:p(4.4),y1:b(4.4),x2:p(9.6),y2:b(9.6)},r)});return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.6,strokeLinecap:"round",className:s,"aria-hidden":!0,children:a})}function Ze({value:s,onChange:a,options:i}){return e.jsx("div",{className:"flex shrink-0 overflow-hidden rounded-lg border border-border",children:i.map(r=>e.jsx("button",{type:"button",onClick:()=>a(r.value),className:"px-3 py-1.5 text-[12px] font-medium transition-colors",style:{background:s===r.value?"var(--accent)":"transparent",color:s===r.value?"var(--on-accent)":"var(--muted)"},children:r.label},r.value))})}function g({label:s,value:a,loading:i}){return e.jsxs("div",{className:"rounded-lg border border-border bg-panel p-4 transition-colors hover:border-border-strong",children:[e.jsx("div",{className:"text-[12px] text-muted",children:s}),i?e.jsx(ne,{className:"mt-1.5 h-6 w-16"}):e.jsx("div",{className:"mt-1 truncate text-[20px] font-semibold tracking-[-0.01em] text-ink tabular-nums",children:a})]})}function Ct(){const s=Ce(),[a,i]=o.useState("all"),[r,h]=o.useState(null),[p,b]=o.useState(()=>re()),[x,N]=o.useState(!1),[n,d]=o.useState([]),[L,v]=o.useState(!1),f=Re(r,!!r),j=f.data?.isRepo?f.data.branch:"",ie=f.data?.isRepo?f.data.branches:[],F=Le(),k=F.data?.model??null,D=F.data?.engine.state,P=D==="running"&&!!k,le=Me(),w=Be(),de=(le.data?.models??[]).filter(t=>t.compatibleWithActiveEngine),ce=w.load.isPending||w.eject.isPending||D==="starting"||D==="stopping",[me,I]=o.useState(null),ue=t=>{w.load.mutate({key:t},{onError:c=>y.error(c instanceof W?c.message:"Could not load model.")})},he=()=>{w.eject.mutate(void 0,{onError:t=>y.error(t instanceof W?t.message:"Could not eject model.")})},[_,pe]=o.useState(He[0]),[C,O]=o.useState(""),[xe,fe]=o.useState(()=>{const t=localStorage.getItem("tllm.thinkingBudget.default");return t!==null?Number(t):-1}),ge=t=>{localStorage.setItem("tllm.thinkingBudget.default",String(t)),fe(t)},[K,z]=o.useState(!1),[M,H]=o.useState(!1),[G,T]=o.useState(""),[Q,U]=o.useState(""),B=o.useRef(null),m=Oe(),[A,be]=o.useState(!0),[J,R]=o.useState(!1),[ve,je]=o.useState(()=>Math.min(Math.max($e(),We),Fe())),V=o.useRef(null),Y=De().userName.trim(),u=Pe(a),l=u.data;o.useEffect(()=>{m&&B.current?.focus()},[m]),o.useEffect(()=>{j&&U(j)},[j]);const q=t=>{h(t),T(""),b(qe(t))},Se=()=>{O(""),H(!1),T(""),B.current?.focus()},ke=t=>{O(t),B.current?.focus()},ye=new Set(["compact"]),$=/^\/([a-z0-9-]+)\b/i.exec(C.trim()),Ne=async()=>{const t=C.trim();if(!(!t||K)){if($&&ye.has($[1].toLowerCase())){y.error(`/${$[1]} only works inside an existing session — start a task first, then use it as a follow-up.`);return}if(!r){y.error("Choose a repository first.");return}if(!P||!k){y.error("Load a model first.");return}z(!0);try{const{sessionId:c}=await ze({repoRoot:r,repoBranch:j||void 0,modelKey:k.key,mode:_.id,task:t,useWorktree:M,worktreeBranch:M?G.trim()||se(t):void 0,worktreeBase:M?Q:void 0,contextFiles:n.length?n:void 0});s(`/workspace/code/${c}`)}catch(c){y.error(c instanceof W?c.message:"Could not start the task.")}finally{z(!1)}}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex h-full overflow-hidden",children:[!m&&J&&e.jsx("div",{className:"fixed inset-0 z-30 bg-black/40 md:hidden",onClick:()=>R(!1),"aria-hidden":!0}),e.jsx("div",{ref:V,className:X("tllm-chat-sidebar",m?A?"shrink-0":"w-10 shrink-0":X("fixed inset-y-0 left-0 z-40 w-[84vw] max-w-[300px] shadow-[var(--shadow-2)]",J?"translate-x-0":"-translate-x-full")),style:m&&A?{width:ve}:void 0,children:e.jsx(Ie,{activeId:null,onSelect:t=>{s(`/workspace/chat/${t}`),m||R(!1)},onNew:()=>{Se(),m||R(!1)},collapsed:m?!A:!1,onToggle:m?()=>be(t=>!t):()=>R(!1)})}),m&&A&&e.jsx(_e,{sidebarRef:V,onCommit:je}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"flex h-12 shrink-0 items-center gap-1.5 border-b border-border px-3 md:gap-3 md:px-8",children:e.jsx(Ae,{size:"icon",variant:"ghost",className:"h-8 w-8 shrink-0 md:hidden",onClick:()=>R(!0),title:"History","aria-label":"Open sidebar",children:e.jsx(Ke,{size:16})})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"flex w-full flex-col px-4 py-6 md:px-8",children:[e.jsxs("div",{className:"tllm-rise flex flex-col items-center text-center",children:[e.jsx(Xe,{className:"h-9 w-9 text-accent"}),e.jsxs("h1",{className:"mt-4 text-[28px] font-semibold leading-tight tracking-[-0.02em] text-ink",children:["What’s up next",Y?`, ${Y}`:"","?"]}),e.jsx("p",{className:"mt-1.5 text-[13px] text-muted",children:"Hand a coding task to an agent that runs entirely on your machine."})]}),e.jsxs("div",{className:"tllm-rise mt-12",style:{animationDelay:"50ms"},children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"text-[13px] font-semibold uppercase tracking-wide text-faint",children:"Coding activity"}),e.jsx(Ze,{value:a,onChange:i,options:[{value:"all",label:"All"},{value:"30d",label:"30d"},{value:"7d",label:"7d"}]})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(g,{label:"Sessions",value:(l?.sessions??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Tasks shipped",value:(l?.tasksShipped??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Files touched",value:(l?.filesTouched??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Diff shipped",value:Ee(l?.diffAdded??0,l?.diffRemoved??0),loading:u.isLoading}),e.jsx(g,{label:"Active days",value:(l?.activeDays??0).toLocaleString(),loading:u.isLoading}),e.jsx(g,{label:"Current streak",value:`${l?.currentStreak??0}d`,loading:u.isLoading}),e.jsx(g,{label:"Longest streak",value:`${l?.longestStreak??0}d`,loading:u.isLoading}),e.jsx(g,{label:"Favorite model",value:l?.favoriteModel??"—",loading:u.isLoading})]}),e.jsxs("div",{className:"mt-3 rounded-lg border border-border bg-panel p-4",children:[e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"text-[13px] font-medium text-ink",children:"Session activity"}),e.jsx("span",{className:"text-[11px] text-faint",children:"one box = one day"})]}),u.isLoading?e.jsx(ne,{className:"h-[122px] w-full"}):e.jsx(Ye,{days:l?.heatmap??[]}),!!l&&l.diffAdded>0&&e.jsxs("p",{className:"mt-3 text-center text-[12px] italic text-muted",children:["Agents have added ",l.diffAdded.toLocaleString()," line",l.diffAdded===1?"":"s"," here."]})]})]})]})}),e.jsxs("div",{className:"shrink-0 px-3 pb-3 md:px-8 md:pb-5",children:[e.jsx("div",{className:"mb-3 flex flex-wrap justify-center gap-2",children:Ge.map(t=>e.jsx("button",{type:"button",onClick:()=>ke(t),className:"rounded-full border border-border bg-panel px-3 py-1.5 text-[12px] text-muted transition-all hover:-translate-y-px hover:border-[color:var(--accent)] hover:text-ink",children:t},t))}),e.jsx(Qe,{inputRef:B,value:C,onValueChange:O,onSubmit:()=>{Ne()},placeholder:"Describe a task or ask a question…",repo:{repoPath:r,recentRepos:p,onChoose:q,onBrowse:()=>N(!0),branchLabel:f.isFetching?"…":f.data?.isRepo?j||"no commits":"no git",branchTitle:f.isFetching?"Reading branch…":f.data?.isRepo?`Checked-out branch: ${j||"(no commits yet)"}`:"Not a git repository — no branch info",useWorktree:M,onWorktreeChange:H,branchName:G,onBranchNameChange:T,branchNamePlaceholder:se(C),baseBranch:Q,onBaseBranchChange:U,repoBranches:ie,currentBranch:j},mode:_,onModeChange:pe,models:de,loadedKey:k?.key??null,loadedName:k?.name??null,modelPending:ce,ejecting:w.eject.isPending,onLoadModel:ue,onEjectModel:he,thinkingBudget:xe,onThinkingBudgetChange:ge,onModelSettings:t=>I(t),ctxUsed:0,ctxMax:k?.ctx??0,sendDisabled:!C.trim()||!r||!P||K,onAddContext:()=>v(!0),contextFiles:n,onRemoveContextFile:t=>d(c=>c.filter(we=>we!==t)),hintText:"Enter to start · Shift+Enter for newline · 100% local — your code never leaves this machine"})]})]})]}),e.jsx(Z,{open:x,onOpenChange:N,onSelect:q,mode:"folder",title:"Choose a repository",description:"Open the project folder you want the agent to work in, then click Select this folder."}),e.jsx(Z,{open:L,onOpenChange:v,onSelect:t=>d(c=>c.includes(t)?c:[...c,t]),mode:"file",startPath:r??void 0,title:"Add context",description:"Pick a file to point the agent at — it'll read it if relevant to the task."}),e.jsx(Te,{modelKey:me,onClose:()=>I(null)})]})}export{Ct as CodeHomeScreen};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./radix-j_81dozL.js";import{r as R,u as Io,b as zo}from"./vendor-BFom-Mq6.js";import{g as rt,A as _e,B as $t,f as ft,t as K,L as bi,ak as Ho,h as Wo,U as Fo,V as jo,u as $o,j as Ko,al as Uo,k as qo,l as Vo,a as Yo,H as Go,m as Xo,N as Jo,J as Zo}from"./index-DaNuMYPC.js";import{f as Qo,a as ea}from"./agent-api-D86F96i6.js";import{f as ta,g as ia,h as sa,i as ra,j as na,d as oa,k as dn,l as aa,b as la,T as ha,M as ca,m as da,n as ua,o as _a,p as fa,q as pa,t as ma,r as ga,S as va,s as Sa,v as hr,w as Ue,x as ba,y as wa,C as ya,a as Ca,P as xa,z as cr,A as ka,B as Ea,D as Ba,E as Ra,F as Da}from"./ModelLoadMenu-DzaxKmIV.js";import{a as Ma,u as La,b as Ta,c as Pa,d as Na,A as Aa,T as Oa}from"./ToolApprovalBar-D4YRUMat.js";import{D as Ia,a as za,b as Ha,c as Wa,d as Fa,e as ja,E as $a,A as Ka,h as Ua,i as qa,j as Va,k as Ya,l as Ga,m as Xa,n as Ni}from"./dialog-fsfhY_Ib.js";import{C as Ja,E as Za,D as Qa,a as el,b as tl,c as dr}from"./dropdown-menu-B6pYEdad.js";import{e as il,u as sl,M as rl}from"./useIsDesktop-D2KX8NOA.js";import{F as nl}from"./FsBrowser-D9RjrjvO.js";import{a as ol,b as al,c as ll,A as ur,C as hl}from"./CodeComposer-BvNMY6PI.js";import{C as un}from"./chevron-right-C8EPnhrg.js";import{F as Fs}from"./chat-queries-DINfS8uv.js";import{S as cl}from"./sparkles-BT45JGMR.js";import{G as Ji,F as dl}from"./git-branch-BiMfcJ1j.js";import{C as ul}from"./check-Do9IgpFj.js";import{f as Zi}from"./tool-explain-B8rnv8bW.js";import{C as _n}from"./copy-button-DKUAZ6Ig.js";import{S as Ai}from"./skeleton-D15eL_7e.js";import{C as fn}from"./circle-check-dbo4u23c.js";import{R as ai}from"./rotate-ccw-B7o8hLk6.js";import{T as Qi}from"./terminal-55Og1Fyx.js";import{C as _l}from"./circle-x-CuPWHB4Y.js";import{P as fl}from"./pencil-BegDY0Zk.js";import"./collapsible-tffcj0HQ.js";import"./plus-DrZmKBTt.js";import"./chevron-left-CbPqt11D.js";import"./sliders-horizontal-C4_t3PES.js";import"./trash-2-B9nMCHMA.js";import"./star-SskkfhIb.js";import"./chat-api-CdVOTSst.js";import"./refresh-cw-B7Qjdj47.js";import"./index-BP-7GzAI.js";import"./common-RZkQjs09.js";const pl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],ml=rt("clock",pl);const gl=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],vl=rt("cloud-upload",gl);const Sl=[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]],bl=rt("diff",Sl);const wl=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],yl=rt("eraser",wl);const Cl=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],xl=rt("file-pen",Cl);const kl=[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],El=rt("file-plus",kl);const Bl=[["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"}]],Rl=rt("folder-tree",Bl);const Dl=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Ml=rt("list-checks",Dl);function qe(e,t,i){return i(e??{assistantId:t,content:"",reasoning:"",timeline:[]})}class js{constructor(t,i,s=ta){this.sessionId=t,this.handlers=i,this.streamFn=s}sessionId;handlers;streamFn;static RECONNECT_MAX=6;live=null;lastSeq=0;activeAssistantId="";active=!1;ac=null;get isActive(){return this.active}emitLive(t){this.live=t,this.handlers.onLive(t)}connect(){if(this.active)return;this.active=!0;const t=new AbortController;this.ac=t;let i=0;const s=async()=>{try{for await(const r of this.streamFn(this.sessionId,this.lastSeq,t.signal))if(typeof r.seq=="number"&&(this.lastSeq=Math.max(this.lastSeq,r.seq+1)),r.event==="meta"){i=0,this.activeAssistantId=r.data.assistantMessageId;const n=r.data.assistantMessageId;this.emitLive(this.live&&this.live.assistantId===n?this.live:{assistantId:n,content:"",reasoning:"",timeline:[]}),this.handlers.onTurnStart()}else if(r.event==="queue")this.handlers.onQueue(r.data.queued);else if(r.event==="compaction"){const n=r.data.phase==="start";this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,compacting:n})))}else if(r.event==="reasoning"){const n=r.data.delta;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,reasoning:o.reasoning+n,prefill:null})))}else if(r.event==="prefill"){const n=r.data;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,prefill:n})))}else if(r.event==="delta"){const n=r.data.delta;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,content:o.content+n,timeline:Ma(o.timeline,n),prefill:null})))}else if(r.event==="tool_call"){const n=r.data,o={id:n.id,name:n.name,args:n.args,status:n.status,result:n.result,diff:n.diff,patch:n.patch,firstChangedLine:n.firstChangedLine};this.emitLive(qe(this.live,this.activeAssistantId,a=>({...a,timeline:La(a.timeline,o)})))}else if(r.event==="tool_progress"){const{id:n,partial:o}=r.data;this.emitLive(qe(this.live,this.activeAssistantId,a=>({...a,timeline:Ta(a.timeline,n,o)})))}else if(r.event==="turn"){if(r.data.phase==="start"&&r.data.index>0){const n=r.data.index;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,timeline:Pa(o.timeline,n)})))}}else if(r.event==="retry"){const n=r.data.phase==="start"?{attempt:r.data.attempt,maxAttempts:r.data.maxAttempts,message:r.data.message}:null;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,retry:n})))}else if(r.event==="todos"){const n=r.data.todos;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,todos:n})))}else r.event==="done"?(this.emitLive(null),this.handlers.onTurnDone()):r.event==="error"&&(this.emitLive(null),this.handlers.onTurnError(r.data.message));this.active=!1,this.emitLive(null),this.handlers.onIdle()}catch(r){if(t.signal.aborted){this.active=!1;return}i+=1,i<=js.RECONNECT_MAX&&this.ac===t?setTimeout(()=>{this.ac===t&&!t.signal.aborted&&s()},Math.min(500*i,3e3)):(this.active=!1,this.emitLive(null),this.handlers.onLostConnection(r instanceof _e&&r.status===404))}};s()}abort(){this.ac?.abort(),this.active=!1}}const pn=[{id:"compact",description:"Summarize the conversation so far into one summary, to free up context",pattern:/^\/compact\b\s*(.*)$/i},{id:"clear",description:"Clear the chat — repo, worktree, and branch stay as they are",pattern:/^\/clear\b\s*$/i},{id:"resume",description:"Bring back a cleared or reverted chat",pattern:/^\/resume\b\s*$/i,pickerVisible:e=>e.cleared},{id:"init",description:"Set up an AGENTS.md — the agent inspects your repo and drafts one",pattern:/^\/init\b\s*$/i},{id:"details",description:"Toggle showing full tool-call details for every step",pattern:/^\/details\b\s*$/i},{id:"thinking",description:"Toggle always showing the agent's reasoning",pattern:/^\/thinking\b\s*$/i},{id:"shell",description:"Run a shell command yourself (! feeds output to the model, !! does not)",pattern:/^(!{1,2})(?!!)\s*(\S[\s\S]*)$/,pickerVisible:()=>!1}];function _r(e){for(const t of pn){const i=t.pattern.exec(e);if(i)return{id:t.id,match:i}}return null}function Ll(e){return pn.filter(t=>!t.pickerVisible||t.pickerVisible(e)).map(t=>({id:t.id,description:t.description}))}const mn={details:"tllm.code.details",thinking:"tllm.code.thinking"},es=new Set;function gn(e){return localStorage.getItem(mn[e])==="1"}function Tl(e){const t=!gn(e);return localStorage.setItem(mn[e],t?"1":"0"),es.forEach(i=>i()),t}function Pl(e){return es.add(e),()=>{es.delete(e)}}function $s(e){return R.useSyncExternalStore(Pl,()=>gn(e),()=>!1)}function Nl({skillCount:e,hasAgentsMd:t}){const[i,s]=R.useState(!1),r=t.project||t.global,n=`${e} skill${e===1?"":"s"}`;return c.jsxs("div",{className:"shrink-0 border-b border-border text-[11px] text-muted",children:[c.jsxs("button",{type:"button",onClick:()=>s(o=>!o),"aria-expanded":i,"aria-label":"Loaded resources",className:"flex w-full items-center gap-2 px-4 py-1.5 transition-colors hover:text-ink md:px-8",children:[i?c.jsx(Ja,{size:12,className:"shrink-0 text-faint"}):c.jsx(un,{size:12,className:"shrink-0 text-faint"}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Fs,{size:11,className:"shrink-0 text-faint"}),r?"AGENTS.md":"No AGENTS.md"]}),c.jsx("span",{"aria-hidden":!0,className:"text-faint",children:"·"}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(cl,{size:11,className:"shrink-0 text-faint"}),n]})]}),i&&c.jsxs("dl",{className:"flex flex-col gap-1 px-4 pb-2 pl-9 md:px-8 md:pl-[3.25rem]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Project"}),c.jsx("dd",{children:t.project?"AGENTS.md loaded":"not found"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Global"}),c.jsx("dd",{children:t.global?"agents.md loaded":"not found"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Skills"}),c.jsx("dd",{children:e===0?"none available":`${n} reachable via invoke_skill`})]})]})]})}const Al={diverged:"Push rejected: your branch has diverged from the remote. Pull or rebase first — nothing is ever force-pushed automatically.",no_remote:"This repo has no remote configured — add one (e.g. `git remote add origin <url>`) before pushing.",detached_head:"Can't push from a detached HEAD — check out a branch first.",not_a_repo:"This folder isn't a git repository."};function Ol(e){return Al[e.reason]??e.message}function Il({sessionId:e,open:t,onOpenChange:i}){const s=ia(e,t),r=s.data?.status,n=sa(e,t&&!!r&&!r.detached&&!!r.branch),o=ra(),a=na(),[h,l]=R.useState(""),[_,u]=R.useState(new Set),[d,p]=R.useState(null);R.useEffect(()=>{t&&(l(""),u(new Set),p(null))},[t,e]);const f=r?.files??[],m=L=>{u(z=>{const $=new Set(z);return $.has(L)?$.delete(L):$.add(L),$})},b=f.length-_.size,k=_.size===0,I=()=>{const L=h.trim();if(!L){K.error("A commit message is required.");return}const z=k?void 0:f.map($=>$.path).filter($=>!_.has($));o.mutate({sessionId:e,message:L,files:z},{onSuccess:$=>{K.success(`Committed ${$.filesCommitted} file${$.filesCommitted===1?"":"s"}.`),l(""),u(new Set)},onError:$=>K.error($ instanceof _e?$.message:"Commit failed.")})},N=()=>{p(null),a.mutate(e,{onSuccess:L=>{p(L),L.ok&&K.success(`Pushed to ${L.remote}/${L.branch}.`)},onError:L=>K.error(L instanceof _e?L.message:"Push failed.")})},M=(d?.ok?d.compareUrl:void 0)??n.data?.compareUrl??null;return c.jsx(Ia,{open:t,onOpenChange:i,children:c.jsxs(za,{className:"max-w-lg",children:[c.jsxs(Ha,{children:[c.jsxs(Wa,{className:"flex items-center gap-2",children:[c.jsx(Ji,{size:16,className:"text-muted"})," Git"]}),c.jsx(Fa,{children:r?.branch?`On ${r.branch}${r.detached?" (detached)":""}`:"Commit and push changes for this session."})]}),s.isLoading&&c.jsx("p",{className:"py-6 text-center text-[13px] text-muted",children:"Checking git status…"}),!s.isLoading&&r&&!r.isRepo&&c.jsx("p",{className:"py-6 text-center text-[13px] text-muted",children:"This session's folder isn't a git repository."}),!s.isLoading&&r?.isRepo&&c.jsxs("div",{className:"flex flex-col gap-4",children:[f.length===0?c.jsx("p",{className:"rounded-md border border-border bg-panel-2 px-3 py-2 text-[13px] text-muted",children:"Working tree is clean — nothing to commit."}):c.jsx("div",{className:"flex max-h-48 flex-col gap-0.5 overflow-y-auto rounded-md border border-border p-1.5",children:f.map(L=>{const z=!_.has(L.path);return c.jsxs("label",{className:"flex cursor-pointer select-none items-center gap-2 rounded px-1.5 py-1 text-[12px] hover:bg-panel-2",children:[c.jsx("input",{type:"checkbox",className:"sr-only",checked:z,onChange:()=>m(L.path)}),c.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center rounded-[3px] border transition-colors",style:z?{background:"var(--accent)",borderColor:"var(--accent)"}:{borderColor:"var(--border-strong)"},"aria-hidden":!0,children:z&&c.jsx(ul,{size:9,strokeWidth:3.5,style:{color:"var(--on-accent)"}})}),c.jsx("span",{className:"rounded bg-panel-2 px-1 py-0.5 font-mono text-[10px] text-muted",children:L.code.trim()||"?"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:L.path})]},L.path)})}),f.length>0&&c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("textarea",{value:h,onChange:L=>l(L.target.value),placeholder:"Commit message",rows:2,className:"w-full resize-none rounded-md border border-border bg-panel px-2.5 py-1.5 text-[13px] text-ink outline-none focus-visible:border-accent"}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("span",{className:"text-[11px] text-faint",children:[b," of ",f.length," file",f.length===1?"":"s"," selected"]}),c.jsx($t,{size:"sm",onClick:I,disabled:o.isPending||b===0||!h.trim(),children:o.isPending?"Committing…":"Commit"})]})]}),c.jsxs("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[12px] text-muted",children:r.hasRemote?r.ahead>0?`${r.ahead} commit${r.ahead===1?"":"s"} ahead of ${r.hasUpstream?"origin":"(not yet pushed)"}`:r.hasUpstream?"Up to date with origin":"Not yet pushed":"No remote configured"}),c.jsxs($t,{size:"sm",variant:"outline",onClick:N,disabled:a.isPending||!r.hasRemote||r.detached,children:[c.jsx(vl,{size:13})," ",a.isPending?"Pushing…":"Push"]})]}),d&&!d.ok&&c.jsx("p",{className:"rounded-md border px-2.5 py-1.5 text-[12px]",style:{borderColor:"var(--err)",background:"color-mix(in srgb, var(--err) 8%, transparent)",color:"var(--err)"},children:Ol(d)}),M&&c.jsxs("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:ft("inline-flex items-center gap-1.5 self-start text-[12px] font-medium text-accent hover:underline"),children:["Create PR ",c.jsx(Za,{size:11})]})]})]}),c.jsx(ja,{children:c.jsx($t,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Close"})})]})})}function vn(e){return{id:e.id,name:e.name,args:e.args,status:e.error?"error":"done",result:e.error??e.result,diff:e.diff}}function zl(e){return{id:e.id,name:e.name,args:e.args,status:e.status,result:e.result,diff:e.diff,partial:e.partial}}const Sn=new Set(["edit"]),bn=new Set(["write"]),wi=new Set(["bash"]),wn=new Set(["read"]),yn=new Set(["grep","find"]);function Hl(e){return Sn.has(e)?xl:bn.has(e)?El:wi.has(e)?Qi:wn.has(e)?Fs:yn.has(e)?il:e==="ls"?Rl:Qi}const Wl=new Set(["edit","write","bash"]);function Fl(e){return Wl.has(e)}function jl(e,t){return Sn.has(e)?`Modifies ${t}`:bn.has(e)?`Creates or overwrites ${t}`:wi.has(e)?"Runs a shell command — may read or write anywhere":wn.has(e)?`Reads ${t}`:yn.has(e)?`Searches for ${t}`:e==="ls"?`Lists ${t}`:Zi(e)}function $l(e,t){const i=t.path;return typeof i=="string"&&i.trim()?i:wi.has(e)&&typeof t.command=="string"?t.command:e==="invoke_skill"&&typeof t.skillId=="string"&&t.skillId.trim()?`${Zi(e)} (${t.skillId})`:Zi(e)}const ei={pending:"var(--accent)",done:"var(--ok)",error:"var(--err)",awaiting_approval:"var(--warn)"};function Cn({status:e}){return e==="pending"?c.jsx(bi,{size:13,className:"shrink-0 animate-spin",style:{color:ei.pending}}):e==="done"?c.jsx(fn,{size:13,className:"shrink-0",style:{color:ei.done}}):e==="error"?c.jsx(_l,{size:13,className:"shrink-0",style:{color:ei.error}}):c.jsx(la,{size:13,className:"shrink-0",style:{color:ei.awaiting_approval}})}function Kl(e){let t=0,i=0;for(const s of e.split(`
|
|
1
|
+
import{j as c}from"./radix-j_81dozL.js";import{r as R,u as Io,b as zo}from"./vendor-BFom-Mq6.js";import{g as rt,A as _e,B as $t,f as ft,t as K,L as bi,an as Ho,h as Wo,a6 as Fo,a7 as jo,u as $o,j as Ko,ao as Uo,k as qo,l as Vo,a as Yo,H as Go,m as Xo,N as Jo,J as Zo}from"./index-C8wNg6Wi.js";import{f as Qo,a as ea}from"./agent-api-CPRm67XA.js";import{f as ta,g as ia,h as sa,i as ra,j as na,d as oa,k as dn,l as aa,b as la,T as ha,M as ca,m as da,n as ua,o as _a,p as fa,q as pa,t as ma,r as ga,S as va,s as Sa,v as hr,w as Ue,x as ba,y as wa,C as ya,a as Ca,P as xa,z as cr,A as ka,B as Ea,D as Ba,E as Ra,F as Da}from"./ModelLoadMenu-BVi-8jbR.js";import{a as Ma,u as La,b as Ta,c as Pa,d as Na,A as Aa,T as Oa}from"./ToolApprovalBar-K6AKnQqc.js";import{D as Ia,a as za,b as Ha,c as Wa,d as Fa,e as ja,E as $a,A as Ka,h as Ua,i as qa,j as Va,k as Ya,l as Ga,m as Xa,n as Ni}from"./dialog-DdlXu__o.js";import{C as Ja,E as Za,D as Qa,a as el,b as tl,c as dr}from"./dropdown-menu-DDpkyyj8.js";import{e as il,u as sl,M as rl}from"./useIsDesktop-C-xkBB_K.js";import{F as nl}from"./FsBrowser-ClSut33T.js";import{a as ol,b as al,c as ll,A as ur,C as hl}from"./CodeComposer-pkcqzmvN.js";import{C as un}from"./chevron-right-BTbLU6GN.js";import{F as Fs}from"./chat-queries-VupDrbfF.js";import{S as cl}from"./sparkles-CopaJ0vX.js";import{G as Ji,F as dl}from"./git-branch-nhepGrNO.js";import{C as ul}from"./check-lvVdiPFE.js";import{f as Zi}from"./tool-explain-B8rnv8bW.js";import{C as _n}from"./copy-button-DKb_WA32.js";import{S as Ai}from"./skeleton-BWLBT8PZ.js";import{C as fn}from"./circle-check-BMWD0nBQ.js";import{R as ai}from"./rotate-ccw-B5F4Bcwl.js";import{T as Qi}from"./terminal-BDZDh7uk.js";import{C as _l}from"./circle-x-L9dERUsF.js";import{P as fl}from"./pencil-B6MqYBDR.js";import"./collapsible-tffcj0HQ.js";import"./plus-BvgdS6Vk.js";import"./chevron-left-DwdYJZHs.js";import"./sliders-horizontal-_Pw_fPxo.js";import"./trash-2-BMQd9RUh.js";import"./star-DRBODCiH.js";import"./chat-api-DZ49knUn.js";import"./refresh-cw-ynvrvFZw.js";import"./index-BP-7GzAI.js";import"./common-B-Q9ODI5.js";const pl=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],ml=rt("clock",pl);const gl=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],vl=rt("cloud-upload",gl);const Sl=[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]],bl=rt("diff",Sl);const wl=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],yl=rt("eraser",wl);const Cl=[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]],xl=rt("file-pen",Cl);const kl=[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],El=rt("file-plus",kl);const Bl=[["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"}]],Rl=rt("folder-tree",Bl);const Dl=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Ml=rt("list-checks",Dl);function qe(e,t,i){return i(e??{assistantId:t,content:"",reasoning:"",timeline:[]})}class js{constructor(t,i,s=ta){this.sessionId=t,this.handlers=i,this.streamFn=s}sessionId;handlers;streamFn;static RECONNECT_MAX=6;live=null;lastSeq=0;activeAssistantId="";active=!1;ac=null;get isActive(){return this.active}emitLive(t){this.live=t,this.handlers.onLive(t)}connect(){if(this.active)return;this.active=!0;const t=new AbortController;this.ac=t;let i=0;const s=async()=>{try{for await(const r of this.streamFn(this.sessionId,this.lastSeq,t.signal))if(typeof r.seq=="number"&&(this.lastSeq=Math.max(this.lastSeq,r.seq+1)),r.event==="meta"){i=0,this.activeAssistantId=r.data.assistantMessageId;const n=r.data.assistantMessageId;this.emitLive(this.live&&this.live.assistantId===n?this.live:{assistantId:n,content:"",reasoning:"",timeline:[]}),this.handlers.onTurnStart()}else if(r.event==="queue")this.handlers.onQueue(r.data.queued);else if(r.event==="compaction"){const n=r.data.phase==="start";this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,compacting:n})))}else if(r.event==="reasoning"){const n=r.data.delta;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,reasoning:o.reasoning+n,prefill:null})))}else if(r.event==="prefill"){const n=r.data;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,prefill:n})))}else if(r.event==="delta"){const n=r.data.delta;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,content:o.content+n,timeline:Ma(o.timeline,n),prefill:null})))}else if(r.event==="tool_call"){const n=r.data,o={id:n.id,name:n.name,args:n.args,status:n.status,result:n.result,diff:n.diff,patch:n.patch,firstChangedLine:n.firstChangedLine};this.emitLive(qe(this.live,this.activeAssistantId,a=>({...a,timeline:La(a.timeline,o)})))}else if(r.event==="tool_progress"){const{id:n,partial:o}=r.data;this.emitLive(qe(this.live,this.activeAssistantId,a=>({...a,timeline:Ta(a.timeline,n,o)})))}else if(r.event==="turn"){if(r.data.phase==="start"&&r.data.index>0){const n=r.data.index;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,timeline:Pa(o.timeline,n)})))}}else if(r.event==="retry"){const n=r.data.phase==="start"?{attempt:r.data.attempt,maxAttempts:r.data.maxAttempts,message:r.data.message}:null;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,retry:n})))}else if(r.event==="todos"){const n=r.data.todos;this.emitLive(qe(this.live,this.activeAssistantId,o=>({...o,todos:n})))}else r.event==="done"?(this.emitLive(null),this.handlers.onTurnDone()):r.event==="error"&&(this.emitLive(null),this.handlers.onTurnError(r.data.message));this.active=!1,this.emitLive(null),this.handlers.onIdle()}catch(r){if(t.signal.aborted){this.active=!1;return}i+=1,i<=js.RECONNECT_MAX&&this.ac===t?setTimeout(()=>{this.ac===t&&!t.signal.aborted&&s()},Math.min(500*i,3e3)):(this.active=!1,this.emitLive(null),this.handlers.onLostConnection(r instanceof _e&&r.status===404))}};s()}abort(){this.ac?.abort(),this.active=!1}}const pn=[{id:"compact",description:"Summarize the conversation so far into one summary, to free up context",pattern:/^\/compact\b\s*(.*)$/i},{id:"clear",description:"Clear the chat — repo, worktree, and branch stay as they are",pattern:/^\/clear\b\s*$/i},{id:"resume",description:"Bring back a cleared or reverted chat",pattern:/^\/resume\b\s*$/i,pickerVisible:e=>e.cleared},{id:"init",description:"Set up an AGENTS.md — the agent inspects your repo and drafts one",pattern:/^\/init\b\s*$/i},{id:"details",description:"Toggle showing full tool-call details for every step",pattern:/^\/details\b\s*$/i},{id:"thinking",description:"Toggle always showing the agent's reasoning",pattern:/^\/thinking\b\s*$/i},{id:"shell",description:"Run a shell command yourself (! feeds output to the model, !! does not)",pattern:/^(!{1,2})(?!!)\s*(\S[\s\S]*)$/,pickerVisible:()=>!1}];function _r(e){for(const t of pn){const i=t.pattern.exec(e);if(i)return{id:t.id,match:i}}return null}function Ll(e){return pn.filter(t=>!t.pickerVisible||t.pickerVisible(e)).map(t=>({id:t.id,description:t.description}))}const mn={details:"tllm.code.details",thinking:"tllm.code.thinking"},es=new Set;function gn(e){return localStorage.getItem(mn[e])==="1"}function Tl(e){const t=!gn(e);return localStorage.setItem(mn[e],t?"1":"0"),es.forEach(i=>i()),t}function Pl(e){return es.add(e),()=>{es.delete(e)}}function $s(e){return R.useSyncExternalStore(Pl,()=>gn(e),()=>!1)}function Nl({skillCount:e,hasAgentsMd:t}){const[i,s]=R.useState(!1),r=t.project||t.global,n=`${e} skill${e===1?"":"s"}`;return c.jsxs("div",{className:"shrink-0 border-b border-border text-[11px] text-muted",children:[c.jsxs("button",{type:"button",onClick:()=>s(o=>!o),"aria-expanded":i,"aria-label":"Loaded resources",className:"flex w-full items-center gap-2 px-4 py-1.5 transition-colors hover:text-ink md:px-8",children:[i?c.jsx(Ja,{size:12,className:"shrink-0 text-faint"}):c.jsx(un,{size:12,className:"shrink-0 text-faint"}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Fs,{size:11,className:"shrink-0 text-faint"}),r?"AGENTS.md":"No AGENTS.md"]}),c.jsx("span",{"aria-hidden":!0,className:"text-faint",children:"·"}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(cl,{size:11,className:"shrink-0 text-faint"}),n]})]}),i&&c.jsxs("dl",{className:"flex flex-col gap-1 px-4 pb-2 pl-9 md:px-8 md:pl-[3.25rem]",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Project"}),c.jsx("dd",{children:t.project?"AGENTS.md loaded":"not found"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Global"}),c.jsx("dd",{children:t.global?"agents.md loaded":"not found"})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("dt",{className:"w-16 shrink-0 text-faint",children:"Skills"}),c.jsx("dd",{children:e===0?"none available":`${n} reachable via invoke_skill`})]})]})]})}const Al={diverged:"Push rejected: your branch has diverged from the remote. Pull or rebase first — nothing is ever force-pushed automatically.",no_remote:"This repo has no remote configured — add one (e.g. `git remote add origin <url>`) before pushing.",detached_head:"Can't push from a detached HEAD — check out a branch first.",not_a_repo:"This folder isn't a git repository."};function Ol(e){return Al[e.reason]??e.message}function Il({sessionId:e,open:t,onOpenChange:i}){const s=ia(e,t),r=s.data?.status,n=sa(e,t&&!!r&&!r.detached&&!!r.branch),o=ra(),a=na(),[h,l]=R.useState(""),[_,u]=R.useState(new Set),[d,p]=R.useState(null);R.useEffect(()=>{t&&(l(""),u(new Set),p(null))},[t,e]);const f=r?.files??[],m=L=>{u(z=>{const $=new Set(z);return $.has(L)?$.delete(L):$.add(L),$})},b=f.length-_.size,k=_.size===0,I=()=>{const L=h.trim();if(!L){K.error("A commit message is required.");return}const z=k?void 0:f.map($=>$.path).filter($=>!_.has($));o.mutate({sessionId:e,message:L,files:z},{onSuccess:$=>{K.success(`Committed ${$.filesCommitted} file${$.filesCommitted===1?"":"s"}.`),l(""),u(new Set)},onError:$=>K.error($ instanceof _e?$.message:"Commit failed.")})},N=()=>{p(null),a.mutate(e,{onSuccess:L=>{p(L),L.ok&&K.success(`Pushed to ${L.remote}/${L.branch}.`)},onError:L=>K.error(L instanceof _e?L.message:"Push failed.")})},M=(d?.ok?d.compareUrl:void 0)??n.data?.compareUrl??null;return c.jsx(Ia,{open:t,onOpenChange:i,children:c.jsxs(za,{className:"max-w-lg",children:[c.jsxs(Ha,{children:[c.jsxs(Wa,{className:"flex items-center gap-2",children:[c.jsx(Ji,{size:16,className:"text-muted"})," Git"]}),c.jsx(Fa,{children:r?.branch?`On ${r.branch}${r.detached?" (detached)":""}`:"Commit and push changes for this session."})]}),s.isLoading&&c.jsx("p",{className:"py-6 text-center text-[13px] text-muted",children:"Checking git status…"}),!s.isLoading&&r&&!r.isRepo&&c.jsx("p",{className:"py-6 text-center text-[13px] text-muted",children:"This session's folder isn't a git repository."}),!s.isLoading&&r?.isRepo&&c.jsxs("div",{className:"flex flex-col gap-4",children:[f.length===0?c.jsx("p",{className:"rounded-md border border-border bg-panel-2 px-3 py-2 text-[13px] text-muted",children:"Working tree is clean — nothing to commit."}):c.jsx("div",{className:"flex max-h-48 flex-col gap-0.5 overflow-y-auto rounded-md border border-border p-1.5",children:f.map(L=>{const z=!_.has(L.path);return c.jsxs("label",{className:"flex cursor-pointer select-none items-center gap-2 rounded px-1.5 py-1 text-[12px] hover:bg-panel-2",children:[c.jsx("input",{type:"checkbox",className:"sr-only",checked:z,onChange:()=>m(L.path)}),c.jsx("span",{className:"grid h-3.5 w-3.5 shrink-0 place-items-center rounded-[3px] border transition-colors",style:z?{background:"var(--accent)",borderColor:"var(--accent)"}:{borderColor:"var(--border-strong)"},"aria-hidden":!0,children:z&&c.jsx(ul,{size:9,strokeWidth:3.5,style:{color:"var(--on-accent)"}})}),c.jsx("span",{className:"rounded bg-panel-2 px-1 py-0.5 font-mono text-[10px] text-muted",children:L.code.trim()||"?"}),c.jsx("span",{className:"min-w-0 flex-1 truncate text-ink",children:L.path})]},L.path)})}),f.length>0&&c.jsxs("div",{className:"flex flex-col gap-1.5",children:[c.jsx("textarea",{value:h,onChange:L=>l(L.target.value),placeholder:"Commit message",rows:2,className:"w-full resize-none rounded-md border border-border bg-panel px-2.5 py-1.5 text-[13px] text-ink outline-none focus-visible:border-accent"}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("span",{className:"text-[11px] text-faint",children:[b," of ",f.length," file",f.length===1?"":"s"," selected"]}),c.jsx($t,{size:"sm",onClick:I,disabled:o.isPending||b===0||!h.trim(),children:o.isPending?"Committing…":"Commit"})]})]}),c.jsxs("div",{className:"flex flex-col gap-2 border-t border-border pt-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("span",{className:"text-[12px] text-muted",children:r.hasRemote?r.ahead>0?`${r.ahead} commit${r.ahead===1?"":"s"} ahead of ${r.hasUpstream?"origin":"(not yet pushed)"}`:r.hasUpstream?"Up to date with origin":"Not yet pushed":"No remote configured"}),c.jsxs($t,{size:"sm",variant:"outline",onClick:N,disabled:a.isPending||!r.hasRemote||r.detached,children:[c.jsx(vl,{size:13})," ",a.isPending?"Pushing…":"Push"]})]}),d&&!d.ok&&c.jsx("p",{className:"rounded-md border px-2.5 py-1.5 text-[12px]",style:{borderColor:"var(--err)",background:"color-mix(in srgb, var(--err) 8%, transparent)",color:"var(--err)"},children:Ol(d)}),M&&c.jsxs("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:ft("inline-flex items-center gap-1.5 self-start text-[12px] font-medium text-accent hover:underline"),children:["Create PR ",c.jsx(Za,{size:11})]})]})]}),c.jsx(ja,{children:c.jsx($t,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Close"})})]})})}function vn(e){return{id:e.id,name:e.name,args:e.args,status:e.error?"error":"done",result:e.error??e.result,diff:e.diff}}function zl(e){return{id:e.id,name:e.name,args:e.args,status:e.status,result:e.result,diff:e.diff,partial:e.partial}}const Sn=new Set(["edit"]),bn=new Set(["write"]),wi=new Set(["bash"]),wn=new Set(["read"]),yn=new Set(["grep","find"]);function Hl(e){return Sn.has(e)?xl:bn.has(e)?El:wi.has(e)?Qi:wn.has(e)?Fs:yn.has(e)?il:e==="ls"?Rl:Qi}const Wl=new Set(["edit","write","bash"]);function Fl(e){return Wl.has(e)}function jl(e,t){return Sn.has(e)?`Modifies ${t}`:bn.has(e)?`Creates or overwrites ${t}`:wi.has(e)?"Runs a shell command — may read or write anywhere":wn.has(e)?`Reads ${t}`:yn.has(e)?`Searches for ${t}`:e==="ls"?`Lists ${t}`:Zi(e)}function $l(e,t){const i=t.path;return typeof i=="string"&&i.trim()?i:wi.has(e)&&typeof t.command=="string"?t.command:e==="invoke_skill"&&typeof t.skillId=="string"&&t.skillId.trim()?`${Zi(e)} (${t.skillId})`:Zi(e)}const ei={pending:"var(--accent)",done:"var(--ok)",error:"var(--err)",awaiting_approval:"var(--warn)"};function Cn({status:e}){return e==="pending"?c.jsx(bi,{size:13,className:"shrink-0 animate-spin",style:{color:ei.pending}}):e==="done"?c.jsx(fn,{size:13,className:"shrink-0",style:{color:ei.done}}):e==="error"?c.jsx(_l,{size:13,className:"shrink-0",style:{color:ei.error}}):c.jsx(la,{size:13,className:"shrink-0",style:{color:ei.awaiting_approval}})}function Kl(e){let t=0,i=0;for(const s of e.split(`
|
|
2
2
|
`))s.startsWith("+++")||s.startsWith("---")||(s.startsWith("+")?t++:s.startsWith("-")&&i++);return{add:t,del:i}}function Ul({diff:e}){const t=e.replace(/\n$/,"").split(`
|
|
3
3
|
`);let i=0,s=0;return c.jsx("div",{className:"max-h-[420px] overflow-auto rounded-md border border-border",children:c.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-relaxed",children:c.jsx("tbody",{children:t.map((r,n)=>{const o=r.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(o)return i=parseInt(o[1],10),s=parseInt(o[2],10),c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"select-none whitespace-pre px-3 py-1",style:{color:"var(--accent)",background:"var(--diff-hunk-bg)"},children:r})},n);if(r.startsWith("+++")||r.startsWith("---"))return c.jsx("tr",{children:c.jsx("td",{colSpan:3,className:"select-none whitespace-pre px-3 py-1 text-faint",children:r})},n);const a=r.startsWith("+"),h=r.startsWith("-"),l=r.startsWith("\\"),_=a||l?null:i,u=h||l?null:s;!a&&!l&&i++,!h&&!l&&s++;const d=a?"var(--diff-add-bg)":h?"var(--diff-del-bg)":void 0,p=a?"var(--ok)":h?"var(--err)":"var(--ink)";return c.jsxs("tr",{style:{background:d},children:[c.jsx("td",{className:"w-px select-none px-2 text-right text-faint tabular-nums",children:_??""}),c.jsx("td",{className:"w-px select-none px-2 text-right text-faint tabular-nums",children:u??""}),c.jsx("td",{className:"whitespace-pre px-2",style:{color:p},children:r||" "})]},n)})})})})}function ts({text:e,streaming:t}){const i=e.length>4e3?t?`…(earlier output hidden)
|
|
4
4
|
${e.slice(-4e3)}`:`${e.slice(0,4e3)}
|