tarsk 0.5.72 → 0.5.73

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.
Files changed (80) hide show
  1. package/dist/index.js +5505 -2902
  2. package/dist/public/assets/{account-view-C_WBVXA3.js → account-view-DKQdyGPK.js} +1 -1
  3. package/dist/public/assets/{alert-dialog-FQ5_FqBX.js → alert-dialog-Cb1PEgra.js} +1 -1
  4. package/dist/public/assets/api-BMo_Lz8f.js +2 -0
  5. package/dist/public/assets/{async-error-boundary-DCDTsNTO.js → async-error-boundary-J8P6NVvc.js} +1 -1
  6. package/dist/public/assets/{async-loading-fallback-C173aA9v.js → async-loading-fallback-B_JNgWJR.js} +1 -1
  7. package/dist/public/assets/browser-tab-D_GXZ93G.js +12 -0
  8. package/dist/public/assets/{button-sfGyFWfz.js → button-DeNw35VZ.js} +1 -1
  9. package/dist/public/assets/{card-D5k0GHxM.js → card-B4eI0NI-.js} +1 -1
  10. package/dist/public/assets/{chat-dock-context-DIyMsJHM.js → chat-dock-context-BXoAs38w.js} +1 -1
  11. package/dist/public/assets/{commit-dialog-Bmh1QdHK.js → commit-dialog-DDLaQVzY.js} +1 -1
  12. package/dist/public/assets/{commit-error-dialog-Dpu8C-0w.js → commit-error-dialog-Cp0Aic7I.js} +1 -1
  13. package/dist/public/assets/{commit-method-fields-CYzy7rmY.js → commit-method-fields-CD3PTIox.js} +1 -1
  14. package/dist/public/assets/{context-menu-Bo0OMC7-.js → context-menu-Dx5Jy21w.js} +1 -1
  15. package/dist/public/assets/{conversation-history-view-COFXqD0e.js → conversation-history-view-JymxZFJ2.js} +1 -1
  16. package/dist/public/assets/{create-project-dialog-DQ4AbwQP.js → create-project-dialog-qbwqSqGU.js} +2 -2
  17. package/dist/public/assets/{create-project-workspace-BiRMezO9.js → create-project-workspace-BcIx6FNf.js} +1 -1
  18. package/dist/public/assets/{create-repo-dialog-CYiCHWgi.js → create-repo-dialog-DcvSMy3g.js} +1 -1
  19. package/dist/public/assets/{delete-confirm-dialog-B99gEJN8.js → delete-confirm-dialog-C9NASyh6.js} +1 -1
  20. package/dist/public/assets/{dialog-CP2cYR59.js → dialog-Do98zzAW.js} +1 -1
  21. package/dist/public/assets/{diff-view-Cnuntc3l.js → diff-view-ePD0sdsW.js} +2 -2
  22. package/dist/public/assets/dist-BWuYHVi8.js +2 -0
  23. package/dist/public/assets/{dist-DrpdKPSI.js → dist-CjhvxqFU.js} +1 -1
  24. package/dist/public/assets/{explorer-tab-view-BoCoREoE.js → explorer-tab-view-D6hsKrXY.js} +2 -2
  25. package/dist/public/assets/{explorer-tree-DvD1-WW3.js → explorer-tree-BG8ShRwn.js} +1 -1
  26. package/dist/public/assets/{explorer-view-B4WJUy7s.js → explorer-view-BZcNnLd9.js} +2 -2
  27. package/dist/public/assets/{git-history-dialog-DHdzijZS.js → git-history-dialog-DWhJ1-ba.js} +1 -1
  28. package/dist/public/assets/index-DhOeeft5.css +1 -0
  29. package/dist/public/assets/index-DjaVbFDB.js +3386 -0
  30. package/dist/public/assets/{markdown-renderer-Dx9-Ljv0.js → markdown-renderer-qLede1zH.js} +4 -4
  31. package/dist/public/assets/{mcp-server-card-DPNG9Up7.js → mcp-server-card-zm-ss-7h.js} +1 -1
  32. package/dist/public/assets/{merged-pr-dialog-CEvS2z8D.js → merged-pr-dialog-Due9WdB4.js} +1 -1
  33. package/dist/public/assets/{model-list-controls-ChoemIJa.js → model-list-controls-D86_87E4.js} +1 -1
  34. package/dist/public/assets/{onboarding-dialog-DCull5p_.js → onboarding-dialog-DlqbPvG0.js} +1 -1
  35. package/dist/public/assets/{project-env-vars-view-DTGwl4wr.js → project-env-vars-view-N1Io1Pau.js} +1 -1
  36. package/dist/public/assets/{project-model-aliases-view-CEDz_6NW.js → project-model-aliases-view-B4FEze4g.js} +1 -1
  37. package/dist/public/assets/{project-settings-view-DniUno1i.js → project-settings-view-BalZ6Fe1.js} +1 -1
  38. package/dist/public/assets/{project-tools-view-DknCaJu_.js → project-tools-view-OnCN0jKz.js} +1 -1
  39. package/dist/public/assets/{providers-list-view-D_n1Ai6S.js → providers-list-view-DXvcxXDM.js} +1 -1
  40. package/dist/public/assets/pull-request-dialog-BeeTNIN_.js +1 -0
  41. package/dist/public/assets/{pull-with-changes-dialog-rKmqSi73.js → pull-with-changes-dialog-B9y2_lt_.js} +1 -1
  42. package/dist/public/assets/{push-before-pr-dialog-BeEx6Po_.js → push-before-pr-dialog-D3pMFe9A.js} +1 -1
  43. package/dist/public/assets/{settings-general-view-CVHlxpTM.js → settings-general-view-CAYlYs3J.js} +1 -1
  44. package/dist/public/assets/{settings-instructions-view-Bpx_dUaJ.js → settings-instructions-view-GjQivhLy.js} +1 -1
  45. package/dist/public/assets/{settings-list-PMi8ZniW.js → settings-list-DU82HNPX.js} +1 -1
  46. package/dist/public/assets/{settings-logs-view-64Aq1hEw.js → settings-logs-view-DnQ_4O9b.js} +4 -4
  47. package/dist/public/assets/{settings-mcp-servers-view-B84c4h47.js → settings-mcp-servers-view-C6OZHR3K.js} +1 -1
  48. package/dist/public/assets/{settings-models-view-DdRC4YXo.js → settings-models-view-CTjnBd74.js} +1 -1
  49. package/dist/public/assets/{settings-rules-view-CGLh95Ta.js → settings-rules-view-DiTC-cBE.js} +1 -1
  50. package/dist/public/assets/settings-skills-view-DHoSorOw.js +3 -0
  51. package/dist/public/assets/{settings-slack-view-OFNrG_DW.js → settings-slack-view-CiuJZ-9i.js} +1 -1
  52. package/dist/public/assets/{settings-slash-commands-view-DOo0BimH.js → settings-slash-commands-view-CnXff39A.js} +1 -1
  53. package/dist/public/assets/{settings-statistics-view-DpaSoVqG.js → settings-statistics-view-D8SvAGE_.js} +1 -1
  54. package/dist/public/assets/{settings-storage-view-DlyXWB__.js → settings-storage-view-CUsa7Lwv.js} +1 -1
  55. package/dist/public/assets/{settings-subagents-view-D7o69YzB.js → settings-subagents-view-B4HugfzU.js} +1 -1
  56. package/dist/public/assets/{settings-system-prompt-view-BFGfrXfe.js → settings-system-prompt-view-DNQKxcFg.js} +1 -1
  57. package/dist/public/assets/{settings-view-Dw1Zh2Qn.js → settings-view-DoZmXguf.js} +2 -2
  58. package/dist/public/assets/store-BaMSfYoJ.js +9 -0
  59. package/dist/public/assets/{table-B2TDbGGl.js → table-B3fLagUj.js} +1 -1
  60. package/dist/public/assets/tasks-view-BaMd8ZM0.js +2 -0
  61. package/dist/public/assets/{terminal-panel-DBZpuMz9.js → terminal-panel-BjD6z-3y.js} +2 -2
  62. package/dist/public/assets/{toggle-group-BiUqOiP6.js → toggle-group-5tREtjoW.js} +1 -1
  63. package/dist/public/assets/{use-active-dock-panel-instance-CcCdDHzX.js → use-active-dock-panel-instance-BSch6-Fx.js} +1 -1
  64. package/dist/public/assets/{use-installed-ai-files-BNrsyACe.js → use-installed-ai-files-E4BAFIPG.js} +1 -1
  65. package/dist/public/assets/{use-open-chat-dock-panel-D1D5bnsL.js → use-open-chat-dock-panel-Cr1bQYOH.js} +1 -1
  66. package/dist/public/assets/{web-C5UYr_H-.js → web-BKpP7kYB.js} +1 -1
  67. package/dist/public/assets/{web-DaSLtaQ7.js → web-CtDn8Ggo.js} +1 -1
  68. package/dist/public/assets/{web-Rx_XWVAQ.js → web-DaiDQ9WA.js} +1 -1
  69. package/dist/public/assets/{web-iwWEZ1P2.js → web-W5CC9Cq4.js} +1 -1
  70. package/dist/public/index.html +14 -14
  71. package/package.json +2 -1
  72. package/dist/public/assets/api-ODizoHnY.js +0 -2
  73. package/dist/public/assets/browser-tab-Cl9d7ESj.js +0 -12
  74. package/dist/public/assets/dist-ZlK7I-y-.js +0 -2
  75. package/dist/public/assets/index-Bmkj1Qwa.js +0 -3380
  76. package/dist/public/assets/index-DPMRI86E.css +0 -1
  77. package/dist/public/assets/pull-request-dialog-BkQBaJkw.js +0 -1
  78. package/dist/public/assets/settings-skills-view-DeVnXDl-.js +0 -3
  79. package/dist/public/assets/store-Be_7VK0D.js +0 -8
  80. package/dist/public/assets/tasks-view-FR7c1qFr.js +0 -2
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{at as i}from"./dist-ZlK7I-y-.js";import{J as a,n as o}from"./store-Be_7VK0D.js";import{n as s,t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-sfGyFWfz.js";import{B as u,L as d,R as f,U as p,V as m,kt as h}from"./api-ODizoHnY.js";import{r as g}from"./tooltip-B6ziVyTv.js";import{n as _}from"./async-loading-fallback-C173aA9v.js";import{t as v}from"./suspense-resource-DnYnmTbs.js";import{t as y}from"./use-suspense-resource-Dkz6ddFN.js";import{Bn as b,Et as x,I as S,In as C,L as w,Ln as ee,Nn as T,On as E,kn as D,o as O,pn as te}from"./index-Bmkj1Qwa.js";import{a as k,i as A,n as j,r as M,t as N}from"./table-B2TDbGGl.js";import{n as P,t as ne}from"./toggle-group-BiUqOiP6.js";import{n as F,t as I}from"./commit-method-fields-CYzy7rmY.js";import{t as L}from"./async-error-boundary-DCDTsNTO.js";import{t as re}from"./sorting-DqwxPMRN.js";import{o as ie,s as R}from"./settings-list-PMi8ZniW.js";import{t as ae}from"./use-deferred-search-Dgxosq55.js";import{n as oe,r as z,t as B}from"./model-list-controls-ChoemIJa.js";var V=e(n(),1),H=t();function U(e){return`settings-models:coding:${e}`}function W(e){return`settings-models:image:${e}`}async function G(){let e=(await h()).filter(e=>e.apiKey),t=await p(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function K(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await p(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var q=r(),J=`table-fixed`,se=`h-9`,ce=c(i.body,`py-1.5`),le=`w-10 py-1.5`,ue=`w-24 py-1.5 text-right`,de=c(i.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),fe=c(i.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),pe=`h-9 w-24 bg-transparent py-2 text-right`,me=`h-9 w-20 bg-transparent py-2 text-right`,he=`h-9 w-48 bg-transparent py-2 text-right`;function Y(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${s(e.prompt??0)} in | $${s(e.completion??0)} out`}function ge(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function X(e){let t=(0,H.c)(9),{showIntelligence:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(`w-full caption-bottom`,J,i.body),t[0]=r):r=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(A,{className:`h-9 w-10 bg-transparent py-2`}),o=(0,q.jsx)(A,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n?(0,q.jsx)(A,{className:pe,children:`Intelligence`}):null,t[3]=n,t[4]=s);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,q.jsx)(A,{className:me,children:`TPS`}),u=(0,q.jsx)(A,{className:he,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===s?d=t[8]:(d=(0,q.jsx)(`table`,{className:r,children:(0,q.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,q.jsxs)(`tr`,{children:[a,o,s,l,u]})})}),t[7]=s,t[8]=d),d}function Z(e){let t=(0,H.c)(15),{models:n,enabledIds:r,checkboxIdPrefix:a,showIntelligence:o,getModelDisplayName:s,onToggleModel:l}=e,u;if(t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==o){let e;t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==l||t[11]!==o?(e=e=>{let t=`${a}${e.id}`;return(0,q.jsxs)(k,{className:se,children:[(0,q.jsx)(M,{className:le,children:(0,q.jsx)(O,{id:t,checked:r.has(e.id),onCheckedChange:()=>l(e.id),className:`mt-0`})}),(0,q.jsx)(M,{className:ce,children:(0,q.jsx)(`label`,{htmlFor:t,className:c(i.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:s(e)})}),o?(0,q.jsx)(M,{className:ue,children:(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(z,{codingIndex:e.coding_index,modelName:s(e)})})}):null,(0,q.jsx)(M,{className:de,children:ge(e.avgTPS)}),(0,q.jsx)(M,{className:fe,children:Y(e.pricing)})]},e.id)},t[7]=a,t[8]=r,t[9]=s,t[10]=l,t[11]=o,t[12]=e):e=t[12],u=n.map(e),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=l,t[5]=o,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,q.jsx)(N,{className:J,children:(0,q.jsx)(j,{children:u})}),t[13]=u,t[14]=d),d}function Q(e){let t=(0,H.c)(25),{providerName:n,providerSlug:r,action:a,tableHeader:o,children:s}=e,l;t[0]!==n||t[1]!==r?(l=(0,q.jsx)(x,{provider:{name:n,slug:r}}),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(i.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===n?d=t[5]:(d=(0,q.jsx)(`h2`,{className:u,children:n}),t[4]=n,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a?(0,q.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:a}):null,t[9]=a,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===o?h=t[15]:(h=o?(0,q.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:o}):null,t[14]=o,t[15]=h);let g=o?`pt-0`:`pt-6`,_;t[16]===g?_=t[17]:(_=c(`px-6 pb-6`,g),t[16]=g,t[17]=_);let v;t[18]!==s||t[19]!==_?(v=(0,q.jsx)(`div`,{className:_,children:s}),t[18]=s,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==m||t[23]!==h?(y=(0,q.jsxs)(b,{className:`shrink-0`,children:[m,h,v]}),t[21]=v,t[22]=m,t[23]=h,t[24]=y):y=t[24],y}function _e({providers:e,globalSearchQuery:t,modelSortBy:n,filterAndSortModels:r,getModelDisplayName:i,onSaveStatus:s}){let c=o(),l=y(W(0),()=>K(e)),[f]=(0,V.useState)(l.allImageModels),[p,m]=(0,V.useState)(l.enabledImageModelIds);async function h(e,t){try{p[e]?.has(t)?(await d(e,t),m(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await u(e,t),m(n=>({...n,[e]:new Set([...n[e]||[],t])}))),c({type:a.ConfigUpdated}),s(`Model preferences saved successfully`)}catch(e){s(e instanceof Error?e.message:`Failed to save model changes`)}}async function _(e,t){let n=f[e],r=p[e];if(n)for(let i of n)r?.has(i.id)!==t&&await h(e,i.id)}return(0,q.jsx)(q.Fragment,{children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let a=f[e.slug]||[],o=p[e.slug]||new Set,s=r(a,o,n);return s.length===0&&t?null:(0,q.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:s.length>0?(0,q.jsx)(B,{id:`select-all-image-${e.slug}`,checked:s.every(e=>o.has(e.id)),onChange:t=>void _(e.slug,t)}):null,tableHeader:s.length>0?(0,q.jsx)(X,{showIntelligence:!1}):void 0,children:s.length===0?(0,q.jsx)(R,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,q.jsx)(g,{children:(0,q.jsx)(Z,{models:s,enabledIds:o,checkboxIdPrefix:`image-`,showIntelligence:!1,getModelDisplayName:i,onToggleModel:t=>void h(e.slug,t)})})},e.slug)})})}function ve({loadVersion:e}){let t=o(),n=y(U(e),()=>G()),r=n.providers,[s]=(0,V.useState)(n.allModels),[l,u]=(0,V.useState)(n.enabledModelIds),[d,p]=(0,V.useState)(`coding`),{query:h,setQuery:v,deferredQuery:x}=ae(),[O,k]=(0,V.useState)(`alphabetical`),[A,j]=(0,V.useState)(``),M=e=>te(e.id),N=async(e,n)=>{try{l[e]?.has(n)?(await f(e,n),u(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await m(e,n),u(t=>({...t,[e]:new Set([...t[e]||[],n])}))),t({type:a.ConfigUpdated}),j(`Model preferences saved successfully`),setTimeout(()=>j(``),3e3)}catch(e){j(e instanceof Error?e.message:`Failed to save model changes`)}},L=async(e,t)=>{let n=s[e],r=l[e];if(n)for(let i of n)r?.has(i.id)!==t&&await N(e,i.id)},z=(e,t,n)=>re({models:e,query:x,sortBy:n,getDisplayName:M,getPriority:e=>+!t.has(e.id)});if(r.length===0)return(0,q.jsx)(C,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`});let H=r.some(e=>e.name.toLowerCase()===`openrouter`);return(0,q.jsx)(T,{loading:!1,children:(0,q.jsxs)(S,{value:d,className:`flex flex-col gap-2.5`,children:[(0,q.jsxs)(b,{className:`shrink-0`,children:[(0,q.jsx)(D,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,q.jsx)(ie,{placeholder:`Search`,value:h,onChange:v,className:`mb-0 w-64`}),sticky:!1}),(0,q.jsx)(ee,{className:`max-w-none pt-6`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[H?(0,q.jsxs)(ne,{type:`single`,value:d,onValueChange:e=>{(e===`coding`||e===`image`)&&(p(e),v(``))},"aria-label":`Model type`,className:c(I,`shrink-0`),children:[(0,q.jsx)(P,{value:`coding`,"aria-label":`Coding`,className:c(i.body,F),children:`Coding`}),(0,q.jsx)(P,{value:`image`,"aria-label":`Image`,className:c(i.body,F),children:`Image`})]}):null,A?(0,q.jsx)(E,{variant:A.includes(`error`)||A.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:A}):null,(0,q.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,q.jsx)(oe,{sortBy:O,showCodingIndex:d===`coding`,showIntelligenceByPrice:d===`coding`,onSortByChange:k})})]})})]}),(0,q.jsx)(w,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:r.map(e=>{let t=s[e.slug]||[],n=l[e.slug]||new Set,r=z(t,n,O);return r.length===0&&h?null:(0,q.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:r.length>0?(0,q.jsx)(B,{id:`select-all-${e.slug}`,checked:r.every(e=>n.has(e.id)),onChange:t=>void L(e.slug,t)}):null,tableHeader:r.length>0?(0,q.jsx)(X,{showIntelligence:O===`coding-index`||O===`intelligence-by-price`}):void 0,children:r.length===0?(0,q.jsx)(R,{message:h?`No models matching your search.`:`No models available for this provider.`}):(0,q.jsx)(g,{children:(0,q.jsx)(Z,{models:r,enabledIds:n,checkboxIdPrefix:``,showIntelligence:O===`coding-index`||O===`intelligence-by-price`,getModelDisplayName:M,onToggleModel:t=>void N(e.slug,t)})})},e.slug)})}),(0,q.jsx)(w,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:d===`image`?(0,q.jsx)(V.Suspense,{fallback:(0,q.jsx)(_,{className:`py-12`,size:`sm`}),children:(0,q.jsx)(_e,{providers:r,globalSearchQuery:h,modelSortBy:O,filterAndSortModels:z,getModelDisplayName:M,onSaveStatus:e=>{j(e),e.includes(`Failed`)||setTimeout(()=>j(``),3e3)}})}):null})]})})}function $(){let e=(0,H.c)(8),[t,n]=(0,V.useState)(0),r;e[0]===t?r=e[1]:(r=function(){v(U(t)),n(be)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(_,{label:`Loading models...`,size:`lg`}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,q.jsx)(V.Suspense,{fallback:a,children:(0,q.jsx)(ve,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:(0,q.jsx)(L,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ye,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ye(e,t){return(0,q.jsx)(C,{title:`Failed to load models`,action:(0,q.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function be(e){return e+1}export{$ as SettingsModelsView,$ as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{ot as i}from"./dist-BWuYHVi8.js";import{Q as a,n as o}from"./store-BaMSfYoJ.js";import{n as s,t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{B as u,L as d,R as f,U as p,V as m,kt as h}from"./api-BMo_Lz8f.js";import{r as g}from"./tooltip-B6ziVyTv.js";import{n as _}from"./async-loading-fallback-B_JNgWJR.js";import{t as v}from"./suspense-resource-DnYnmTbs.js";import{t as y}from"./use-suspense-resource-Dkz6ddFN.js";import{Bn as b,Et as x,I as S,In as C,L as w,Ln as ee,Nn as T,On as E,kn as D,o as O,pn as te}from"./index-DjaVbFDB.js";import{a as k,i as A,n as j,r as M,t as N}from"./table-B3fLagUj.js";import{n as P,t as ne}from"./toggle-group-5tREtjoW.js";import{n as F,t as I}from"./commit-method-fields-CD3PTIox.js";import{t as L}from"./async-error-boundary-J8P6NVvc.js";import{t as re}from"./sorting-DqwxPMRN.js";import{o as ie,s as R}from"./settings-list-DU82HNPX.js";import{t as ae}from"./use-deferred-search-Dgxosq55.js";import{n as oe,r as z,t as B}from"./model-list-controls-D86_87E4.js";var V=e(n(),1),H=t();function U(e){return`settings-models:coding:${e}`}function W(e){return`settings-models:image:${e}`}async function G(){let e=(await h()).filter(e=>e.apiKey),t=await p(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function K(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await p(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var q=r(),J=`table-fixed`,se=`h-9`,ce=c(i.body,`py-1.5`),le=`w-10 py-1.5`,ue=`w-24 py-1.5 text-right`,de=c(i.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),fe=c(i.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),pe=`h-9 w-24 bg-transparent py-2 text-right`,me=`h-9 w-20 bg-transparent py-2 text-right`,he=`h-9 w-48 bg-transparent py-2 text-right`;function Y(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${s(e.prompt??0)} in | $${s(e.completion??0)} out`}function ge(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function X(e){let t=(0,H.c)(9),{showIntelligence:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(`w-full caption-bottom`,J,i.body),t[0]=r):r=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(A,{className:`h-9 w-10 bg-transparent py-2`}),o=(0,q.jsx)(A,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n?(0,q.jsx)(A,{className:pe,children:`Intelligence`}):null,t[3]=n,t[4]=s);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,q.jsx)(A,{className:me,children:`TPS`}),u=(0,q.jsx)(A,{className:he,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===s?d=t[8]:(d=(0,q.jsx)(`table`,{className:r,children:(0,q.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,q.jsxs)(`tr`,{children:[a,o,s,l,u]})})}),t[7]=s,t[8]=d),d}function Z(e){let t=(0,H.c)(15),{models:n,enabledIds:r,checkboxIdPrefix:a,showIntelligence:o,getModelDisplayName:s,onToggleModel:l}=e,u;if(t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==o){let e;t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==l||t[11]!==o?(e=e=>{let t=`${a}${e.id}`;return(0,q.jsxs)(k,{className:se,children:[(0,q.jsx)(M,{className:le,children:(0,q.jsx)(O,{id:t,checked:r.has(e.id),onCheckedChange:()=>l(e.id),className:`mt-0`})}),(0,q.jsx)(M,{className:ce,children:(0,q.jsx)(`label`,{htmlFor:t,className:c(i.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:s(e)})}),o?(0,q.jsx)(M,{className:ue,children:(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsx)(z,{codingIndex:e.coding_index,modelName:s(e)})})}):null,(0,q.jsx)(M,{className:de,children:ge(e.avgTPS)}),(0,q.jsx)(M,{className:fe,children:Y(e.pricing)})]},e.id)},t[7]=a,t[8]=r,t[9]=s,t[10]=l,t[11]=o,t[12]=e):e=t[12],u=n.map(e),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=l,t[5]=o,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,q.jsx)(N,{className:J,children:(0,q.jsx)(j,{children:u})}),t[13]=u,t[14]=d),d}function Q(e){let t=(0,H.c)(25),{providerName:n,providerSlug:r,action:a,tableHeader:o,children:s}=e,l;t[0]!==n||t[1]!==r?(l=(0,q.jsx)(x,{provider:{name:n,slug:r}}),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(i.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===n?d=t[5]:(d=(0,q.jsx)(`h2`,{className:u,children:n}),t[4]=n,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a?(0,q.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:a}):null,t[9]=a,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===o?h=t[15]:(h=o?(0,q.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:o}):null,t[14]=o,t[15]=h);let g=o?`pt-0`:`pt-6`,_;t[16]===g?_=t[17]:(_=c(`px-6 pb-6`,g),t[16]=g,t[17]=_);let v;t[18]!==s||t[19]!==_?(v=(0,q.jsx)(`div`,{className:_,children:s}),t[18]=s,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==m||t[23]!==h?(y=(0,q.jsxs)(b,{className:`shrink-0`,children:[m,h,v]}),t[21]=v,t[22]=m,t[23]=h,t[24]=y):y=t[24],y}function _e({providers:e,globalSearchQuery:t,modelSortBy:n,filterAndSortModels:r,getModelDisplayName:i,onSaveStatus:s}){let c=o(),l=y(W(0),()=>K(e)),[f]=(0,V.useState)(l.allImageModels),[p,m]=(0,V.useState)(l.enabledImageModelIds);async function h(e,t){try{p[e]?.has(t)?(await d(e,t),m(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}})):(await u(e,t),m(n=>({...n,[e]:new Set([...n[e]||[],t])}))),c({type:a.ConfigUpdated}),s(`Model preferences saved successfully`)}catch(e){s(e instanceof Error?e.message:`Failed to save model changes`)}}async function _(e,t){let n=f[e],r=p[e];if(n)for(let i of n)r?.has(i.id)!==t&&await h(e,i.id)}return(0,q.jsx)(q.Fragment,{children:e.filter(e=>e.name.toLowerCase()===`openrouter`).map(e=>{let a=f[e.slug]||[],o=p[e.slug]||new Set,s=r(a,o,n);return s.length===0&&t?null:(0,q.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:s.length>0?(0,q.jsx)(B,{id:`select-all-image-${e.slug}`,checked:s.every(e=>o.has(e.id)),onChange:t=>void _(e.slug,t)}):null,tableHeader:s.length>0?(0,q.jsx)(X,{showIntelligence:!1}):void 0,children:s.length===0?(0,q.jsx)(R,{message:t?`No models matching your search.`:`No image models available for this provider.`}):(0,q.jsx)(g,{children:(0,q.jsx)(Z,{models:s,enabledIds:o,checkboxIdPrefix:`image-`,showIntelligence:!1,getModelDisplayName:i,onToggleModel:t=>void h(e.slug,t)})})},e.slug)})})}function ve({loadVersion:e}){let t=o(),n=y(U(e),()=>G()),r=n.providers,[s]=(0,V.useState)(n.allModels),[l,u]=(0,V.useState)(n.enabledModelIds),[d,p]=(0,V.useState)(`coding`),{query:h,setQuery:v,deferredQuery:x}=ae(),[O,k]=(0,V.useState)(`alphabetical`),[A,j]=(0,V.useState)(``),M=e=>te(e.id),N=async(e,n)=>{try{l[e]?.has(n)?(await f(e,n),u(t=>{let r=new Set(t[e]??[]);return r.delete(n),{...t,[e]:r}})):(await m(e,n),u(t=>({...t,[e]:new Set([...t[e]||[],n])}))),t({type:a.ConfigUpdated}),j(`Model preferences saved successfully`),setTimeout(()=>j(``),3e3)}catch(e){j(e instanceof Error?e.message:`Failed to save model changes`)}},L=async(e,t)=>{let n=s[e],r=l[e];if(n)for(let i of n)r?.has(i.id)!==t&&await N(e,i.id)},z=(e,t,n)=>re({models:e,query:x,sortBy:n,getDisplayName:M,getPriority:e=>+!t.has(e.id)});if(r.length===0)return(0,q.jsx)(C,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`});let H=r.some(e=>e.name.toLowerCase()===`openrouter`);return(0,q.jsx)(T,{loading:!1,children:(0,q.jsxs)(S,{value:d,className:`flex flex-col gap-2.5`,children:[(0,q.jsxs)(b,{className:`shrink-0`,children:[(0,q.jsx)(D,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,q.jsx)(ie,{placeholder:`Search`,value:h,onChange:v,className:`mb-0 w-64`}),sticky:!1}),(0,q.jsx)(ee,{className:`max-w-none pt-6`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[H?(0,q.jsxs)(ne,{type:`single`,value:d,onValueChange:e=>{(e===`coding`||e===`image`)&&(p(e),v(``))},"aria-label":`Model type`,className:c(I,`shrink-0`),children:[(0,q.jsx)(P,{value:`coding`,"aria-label":`Coding`,className:c(i.body,F),children:`Coding`}),(0,q.jsx)(P,{value:`image`,"aria-label":`Image`,className:c(i.body,F),children:`Image`})]}):null,A?(0,q.jsx)(E,{variant:A.includes(`error`)||A.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:A}):null,(0,q.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,q.jsx)(oe,{sortBy:O,showCodingIndex:d===`coding`,showIntelligenceByPrice:d===`coding`,onSortByChange:k})})]})})]}),(0,q.jsx)(w,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:r.map(e=>{let t=s[e.slug]||[],n=l[e.slug]||new Set,r=z(t,n,O);return r.length===0&&h?null:(0,q.jsx)(Q,{providerName:e.name,providerSlug:e.slug,action:r.length>0?(0,q.jsx)(B,{id:`select-all-${e.slug}`,checked:r.every(e=>n.has(e.id)),onChange:t=>void L(e.slug,t)}):null,tableHeader:r.length>0?(0,q.jsx)(X,{showIntelligence:O===`coding-index`||O===`intelligence-by-price`}):void 0,children:r.length===0?(0,q.jsx)(R,{message:h?`No models matching your search.`:`No models available for this provider.`}):(0,q.jsx)(g,{children:(0,q.jsx)(Z,{models:r,enabledIds:n,checkboxIdPrefix:``,showIntelligence:O===`coding-index`||O===`intelligence-by-price`,getModelDisplayName:M,onToggleModel:t=>void N(e.slug,t)})})},e.slug)})}),(0,q.jsx)(w,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:d===`image`?(0,q.jsx)(V.Suspense,{fallback:(0,q.jsx)(_,{className:`py-12`,size:`sm`}),children:(0,q.jsx)(_e,{providers:r,globalSearchQuery:h,modelSortBy:O,filterAndSortModels:z,getModelDisplayName:M,onSaveStatus:e=>{j(e),e.includes(`Failed`)||setTimeout(()=>j(``),3e3)}})}):null})]})})}function $(){let e=(0,H.c)(8),[t,n]=(0,V.useState)(0),r;e[0]===t?r=e[1]:(r=function(){v(U(t)),n(be)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(_,{label:`Loading models...`,size:`lg`}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,q.jsx)(V.Suspense,{fallback:a,children:(0,q.jsx)(ve,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,q.jsx)(`div`,{className:`h-full min-h-0`,children:(0,q.jsx)(L,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ye,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ye(e,t){return(0,q.jsx)(C,{title:`Failed to load models`,action:(0,q.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function be(e){return e+1}export{$ as SettingsModelsView,$ as default};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{at as r}from"./dist-ZlK7I-y-.js";import{J as i}from"./dist-DIjomljy.js";import{t as a}from"./utils-CT-Dw22R.js";import{t as o}from"./button-sfGyFWfz.js";import{Jn as s,bn as c,tr as l}from"./api-ODizoHnY.js";import{t as u}from"./use-toast-xpb5jNtN.js";import{r as d,t as f}from"./dialog-CP2cYR59.js";import{Bn as p,Dn as m,En as h,Ft as g,In as _,Ln as v,Nn as y,On as b,Y as x,kn as S,zn as C}from"./index-Bmkj1Qwa.js";import{t as w}from"./delete-confirm-dialog-B99gEJN8.js";import{t as T}from"./use-settings-page-loading-BTySlInF.js";import{a as E,i as D,o as O,r as k}from"./settings-list-PMi8ZniW.js";import{t as A}from"./use-deferred-search-Dgxosq55.js";import{t as j}from"./switch-pIBaqatj.js";import{a as M,i as N,n as P,r as F,t as I}from"./mcp-server-card-DPNG9Up7.js";import{t as L}from"./use-installed-ai-files-BNrsyACe.js";var R=e(t(),1),z=n();function B({threadId:e,onRuleCreated:t}){let[n,i]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[l,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),v=N(n),y=F(v),b=async()=>{if(!(!y||!e)){p(!0);try{let n=`---
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{J as i}from"./dist-DIjomljy.js";import{t as a}from"./utils-CT-Dw22R.js";import{t as o}from"./button-DeNw35VZ.js";import{Yn as s,bn as c,nr as l}from"./api-BMo_Lz8f.js";import{t as u}from"./use-toast-xpb5jNtN.js";import{r as d,t as f}from"./dialog-Do98zzAW.js";import{Bn as p,Dn as m,En as h,Ft as g,In as _,Ln as v,Nn as y,On as b,Y as x,kn as S,zn as C}from"./index-DjaVbFDB.js";import{t as w}from"./delete-confirm-dialog-C9NASyh6.js";import{t as T}from"./use-settings-page-loading-BTySlInF.js";import{a as E,i as D,o as O,r as k}from"./settings-list-DU82HNPX.js";import{t as A}from"./use-deferred-search-Dgxosq55.js";import{t as j}from"./switch-pIBaqatj.js";import{a as M,i as N,n as P,r as F,t as I}from"./mcp-server-card-zm-ss-7h.js";import{t as L}from"./use-installed-ai-files-E4BAFIPG.js";var R=e(t(),1),z=n();function B({threadId:e,onRuleCreated:t}){let[n,i]=(0,R.useState)(``),[o,s]=(0,R.useState)(``),[l,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(!1),v=N(n),y=F(v),b=async()=>{if(!(!y||!e)){p(!0);try{let n=`---
2
2
  description: ${o.trim()}
3
3
  alwaysApply: ${l}
4
4
  ---
@@ -0,0 +1,3 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{t as i}from"./markdown-renderer-qLede1zH.js";import{ot as a,w as o}from"./dist-BWuYHVi8.js";import{r as s}from"./store-BaMSfYoJ.js";import{At as c,Et as l,Jt as u,dn as d,kn as f,ot as p,rt as m,st as h,x as g}from"./dist-DIjomljy.js";import{a as _,t as v}from"./utils-CT-Dw22R.js";import{t as y}from"./button-DeNw35VZ.js";import{$n as b,Gn as x,Ii as S,Kn as C,Ni as w,Qn as T,T as E,Xn as D,Xr as O,Xt as k,Zr as A,ai as j,bn as M,er as N,gi as ee,ir as P,pi as F,qn as I,rr as L,tr as te}from"./api-BMo_Lz8f.js";import{i as ne,n as re,r as ie,t as ae}from"./tooltip-B6ziVyTv.js";import{n as R}from"./async-loading-fallback-B_JNgWJR.js";import{t as z}from"./use-toast-xpb5jNtN.js";import{a as B,i as V,o as H,r as U,s as W,t as G}from"./dialog-Do98zzAW.js";import{a as oe,c as se,i as ce,n as le,o as ue,r as de,s as fe,t as pe}from"./alert-dialog-Cb1PEgra.js";import{At as me,Bn as he,Dn as ge,Dt as _e,En as ve,Ft as K,In as ye,Ln as be,Mt as xe,Nn as Se,Nt as Ce,On as we,Ot as Te,Pt as q,Tn as Ee,Y as De,a as Oe,gn as ke,kn as J,kt as Ae,vn as je,xn as Me,yn as Y,zn as Ne}from"./index-DjaVbFDB.js";import{t as Pe}from"./delete-confirm-dialog-C9NASyh6.js";import{t as Fe}from"./use-settings-page-loading-BTySlInF.js";import{a as Ie,i as Le,o as Re,r as ze}from"./settings-list-DU82HNPX.js";import{t as Be}from"./use-deferred-search-Dgxosq55.js";import{a as Ve,i as He,n as Ue,r as We,t as Ge}from"./mcp-server-card-zm-ss-7h.js";import{t as Ke}from"./use-installed-ai-files-E4BAFIPG.js";var X=t(),Z=e(n(),1),Q=r();function qe({threadId:e,onSkillCreated:t}){let[n,r]=(0,Z.useState)(``),[i,o]=(0,Z.useState)(``),[s,c]=(0,Z.useState)(!1),l=He(n),u=We(l),d=async()=>{if(!(!u||!i.trim()||!e)){c(!0);try{let n=await E(e,l,i.trim());z({title:`Skill created`,description:`Skill '${l}' was created successfully.`}),r(``),o(``),t?.(n.path,`SKILL.md`)}catch(e){z({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{c(!1)}}};return e?(0,Q.jsx)(Ne,{children:(0,Q.jsxs)(ve,{children:[(0,Q.jsx)(J,{title:`Add Skill`,description:`Saved as SKILL.md in .agents/skills.`,sticky:!0,className:`pr-10`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(ge,{title:`Skill Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,Q.jsx)(K,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),n?(0,Q.jsxs)(`p`,{className:v(a.caption,`mt-2`),children:[`Folder name: `,(0,Q.jsx)(`span`,{className:`font-mono`,children:l||`...`})]}):null]}),(0,Q.jsx)(ge,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,Q.jsx)(De,{id:`skillDescription`,value:i,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,Q.jsx)(Ve,{onContinue:()=>void d(),disabled:!u||!i.trim(),creating:s})]})]})}):(0,Q.jsx)(ye,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}function Je(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
2
+ `)}function Ye(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function Xe(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function Ze(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function Qe({open:e,onOpenChange:t,skill:n,catalogSourceId:r,onInstall:o}){let[s,c]=(0,Z.useState)([]),[l,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,w]=(0,Z.useState)(!1),T=Ze(n,r),E=!!T;(0,Z.useEffect)(()=>{if(!e||!n)return;let t=n,i=Ze(t,r),a=!1;async function o(){h(!0),x(null),c([]),d(null),p(``);try{if(i){let e=await I(i,t.id);if(a)return;c(e.files),d(Xe(e.files))}else{if(a)return;c([`SKILL.md`]),d(`SKILL.md`),p(Je(t))}}catch(e){if(a)return;x(e instanceof Error?e.message:`Failed to load skill files`)}finally{a||h(!1)}}return o(),()=>{a=!0}},[e,n,r]),(0,Z.useEffect)(()=>{if(!e||!n||!l||!E||!T)return;let t=n,r=l,i=!1;async function a(){_(!0),x(null);try{let e=await C(T,t.id,r);if(i)return;p(e.content)}catch(e){if(i)return;x(e instanceof Error?e.message:`Failed to load file`),p(``)}finally{i||_(!1)}}return a(),()=>{i=!0}},[e,n,l,E,T]);let D=(0,Z.useCallback)(async()=>{if(!n)return;let e=T?{...n,sourceId:T}:n;w(!0);try{await o(e),t(!1)}finally{w(!1)}},[n,T,o,t]),O=m||E&&g,k=l?Ye(l):!1,A=(0,Z.useMemo)(()=>s.map(e=>(0,Q.jsxs)(_e,{selected:e===l,onClick:()=>d(e),className:`gap-2 cursor-pointer`,children:[(0,Q.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Q.jsx)(`span`,{className:v(a.caption,`truncate`),children:e})]},e)),[s,l]);return(0,Q.jsx)(G,{open:e,onOpenChange:t,children:(0,Q.jsxs)(U,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Q.jsxs)(H,{className:`border-b border-border px-6 py-4`,children:[(0,Q.jsx)(W,{children:n?.name??`Review skill`}),n?.description?(0,Q.jsx)(V,{children:n.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Q.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,Q.jsx)(`div`,{className:v(a.labelMuted,`px-3 py-2`),children:`Files`}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?(0,Q.jsx)(R,{className:`py-8`,label:`Loading files...`}):s.length===0?(0,Q.jsx)(`p`,{className:v(a.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):A})]}),(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:b?(0,Q.jsx)(`p`,{className:v(a.body,`text-destructive`),children:b}):O?(0,Q.jsx)(R,{className:`py-12`,label:`Loading preview...`}):k?(0,Q.jsx)(i,{content:f,enableMermaid:!1}):(0,Q.jsx)(`pre`,{className:v(a.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:f})})]}),(0,Q.jsxs)(B,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Q.jsx)(y,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Q.jsx)(y,{type:`button`,onClick:()=>void D(),disabled:S||!n,children:S?`Installing...`:`Install`})]})]})})}var $=new Map;function $e(e){let t=$.get(e);if(t)return t;let n=T(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function et(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function tt(){let e=(0,X.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,Z.useState)(t),[i,a]=(0,Z.useState)(F),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[s,c]=(0,Z.useState)(o),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(!1),p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{try{r(await b())}catch{r([])}},e[2]=p):p=e[2];let m=p,h,g;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{(async function(){let e=j();if(e.length>0)try{await N(e),O()}catch{}await m()})()},g=[m],e[3]=h,e[4]=g):(h=e[3],g=e[4]),(0,Z.useEffect)(h,g);let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a(e),w(e)},e[5]=_):_=e[5];let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(rt)),v(e.id)},e[6]=y):y=e[6];let x=y,C;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(nt)),A(e.id)},e[7]=C):C=e[7];let T=C,E;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{r(t=>t.filter(t=>t.id!==e)),A(e),a(t=>t===e?(w(`default`),`default`):t)},e[8]=E):E=e[8];let D=E,k,M;e[9]===i?(k=e[10],M=e[11]):(M=()=>{if(i==="default"){c([]),u(!1),f(!1);return}let e=ee(i);e?.skills?(c(et(i,e.skills)),u(!1)):(c([]),u(!0));let t=!1;return f(!!e?.skills),$e(i).then(e=>{if(t)return;let n=et(i,e);c(n),S(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||c([]),z({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(u(!1),f(!1))}),()=>{t=!0}},k=[i],e[9]=i,e[10]=k,e[11]=M),(0,Z.useEffect)(M,k);let P;return e[12]!==s||e[13]!==l||e[14]!==d||e[15]!==i||e[16]!==n?(P={sources:n,selectedSourceId:i,setSelectedSourceId:v,addSource:x,updateSource:T,removeSource:D,reloadSources:m,catalogSkills:s,isLoadingCatalog:l,isRefreshingCatalog:d},e[12]=s,e[13]=l,e[14]=d,e[15]=i,e[16]=n,e[17]=P):P=e[17],P}function nt(e,t){return e.title.localeCompare(t.title)}function rt(e,t){return e.title.localeCompare(t.title)}function it({open:e,onOpenChange:t,editingSource:n,onSourceAdded:r,onSourceUpdated:i,onSourceDeleted:o}){let[s,c]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(!1),[b,S]=(0,Z.useState)(!1),C=n!=null;function w(){c(``),d(``),p(null),h(!1),_(!1),S(!1)}function T(e){e||w(),t(e)}(0,Z.useEffect)(()=>{if(e){if(n){c(n.title),d(n.url),p(null);return}c(``),d(``),p(null)}},[e,n]);async function E(){let e=s.trim(),t=u.trim();if(!e||!t){p(`Title and URL are required.`);return}h(!0),p(null);try{if(C&&n){let r=await L(n.id,e,t);i?.(r.source)}else r((await P(e,t)).source);T(!1)}catch(e){p(e instanceof Error?e.message:`Failed to verify skill source`)}finally{h(!1)}}async function D(){if(n){_(!0),p(null);try{await x(n.id),o?.(n.id),S(!1),T(!1)}catch(e){p(e instanceof Error?e.message:`Failed to delete skill source`),S(!1)}finally{_(!1)}}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{open:e,onOpenChange:T,children:(0,Q.jsxs)(U,{className:`sm:max-w-lg`,children:[(0,Q.jsxs)(H,{children:[(0,Q.jsx)(W,{children:C?`Edit Skill Source`:`Add Skill Source`}),(0,Q.jsx)(V,{children:C?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,Q.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(q,{htmlFor:`skill-source-title`,children:`Title`}),(0,Q.jsx)(K,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>c(e.target.value),disabled:m||g,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Q.jsx)(q,{htmlFor:`skill-source-url`,children:`URL`}),(0,Q.jsx)(K,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:u,onChange:e=>d(e.target.value),disabled:m||g})]}),f?(0,Q.jsx)(`p`,{className:v(a.caption,`text-destructive`),children:f}):null]}),(0,Q.jsxs)(B,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[C?(0,Q.jsx)(y,{type:`button`,variant:`destructive`,onClick:()=>S(!0),disabled:m||g,children:`Delete`}):(0,Q.jsx)(`div`,{className:`hidden sm:block`}),(0,Q.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Q.jsx)(y,{variant:`outline`,onClick:()=>T(!1),disabled:m||g,children:`Cancel`}),(0,Q.jsx)(y,{onClick:()=>void E(),disabled:m||g||!s.trim()||!u.trim(),children:m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):C?`Save Changes`:`Add Source`})]})]})]})}),(0,Q.jsx)(pe,{open:b,onOpenChange:S,children:(0,Q.jsxs)(ce,{children:[(0,Q.jsxs)(fe,{children:[(0,Q.jsx)(se,{children:`Delete Skill Source`}),(0,Q.jsxs)(oe,{children:[`Are you sure you want to delete "`,n?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Q.jsxs)(ue,{children:[(0,Q.jsx)(de,{disabled:g,children:`Cancel`}),(0,Q.jsx)(le,{onClick:()=>void D(),disabled:g,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:g?`Deleting...`:`Delete`})]})]})})]})}var at=`https://tarsk.io/skills/list/`;function ot(e){let t=(0,X.c)(20),{onSelectMode:n,manualDisabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Ee,{asChild:!0,children:(0,Q.jsxs)(y,{className:`gap-1`,children:[`Add Skill`,(0,Q.jsx)(f,{className:`h-4 w-4 opacity-70`})]})}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=v(a.body,`gap-2`),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=()=>n(`manual`),t[2]=n,t[3]=s);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(h,{className:`h-4 w-4 shrink-0`}),t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==s?(u=(0,Q.jsxs)(Y,{className:o,disabled:r,onSelect:s,children:[l,`Manually Enter`]}),t[5]=r,t[6]=s,t[7]=u):u=t[7];let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=v(a.body,`gap-2`),t[8]=p):p=t[8];let m;t[9]===n?m=t[10]:(m=()=>n(`url`),t[9]=n,t[10]=m);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(c,{className:`h-4 w-4 shrink-0`}),t[11]=g):g=t[11];let _;t[12]===m?_=t[13]:(_=(0,Q.jsxs)(Y,{className:p,onSelect:m,children:[g,`Via URL`]}),t[12]=m,t[13]=_);let b;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(Me,{}),t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=v(a.body,`gap-2`),t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(Y,{className:x,onSelect:st,children:[(0,Q.jsx)(d,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),t[16]=S):S=t[16];let C;return t[17]!==u||t[18]!==_?(C=(0,Q.jsxs)(ke,{children:[i,(0,Q.jsxs)(je,{align:`end`,className:`w-44`,children:[u,_,b,S]})]}),t[17]=u,t[18]=_,t[19]=C):C=t[19],C}function st(){k(at)}function ct(e){let t=e.trim();if(!t)return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}if(t.startsWith(`tarsk://`))try{let e=new URL(`https://tarsk.invalid/${t.slice(8)}`);if(e.pathname===`/skill-install`&&e.searchParams.get(`url`))return e.searchParams.get(`url`)}catch{return null}return null}function lt(e){let t=(0,X.c)(40),{open:n,onOpenChange:r,onSubmit:i}=e,[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(){s(``),l(null)},t[0]=u):u=t[0];let d=u,f;t[1]===r?f=t[2]:(f=function(e){e||d(),r(e)},t[1]=r,t[2]=f);let p=f,m,h;t[3]===n?(m=t[4],h=t[5]):(m=()=>{n&&d()},h=[n],t[3]=n,t[4]=m,t[5]=h),(0,Z.useEffect)(m,h);let g;t[6]!==p||t[7]!==i||t[8]!==o?(g=function(){let e=ct(o);if(!e){l(`Enter a valid http(s) URL for the plugin archive or paste a tarsk:// install link.`);return}i(e),p(!1)},t[6]=p,t[7]=i,t[8]=o,t[9]=g):g=t[9];let _=g,b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsxs)(H,{children:[(0,Q.jsx)(W,{children:`Add Skill via URL`}),(0,Q.jsx)(V,{children:`Paste the URL of a plugin archive. Its skills and MCP servers are installed into this project.`})]}),t[10]=b):b=t[10];let x;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(q,{htmlFor:`add-skill-url`,children:`URL`}),t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[12]=S):S=t[12];let C;t[13]===_?C=t[14]:(C=e=>{e.key===`Enter`&&(e.preventDefault(),_())},t[13]=_,t[14]=C);let w;t[15]!==C||t[16]!==o?(w=(0,Q.jsx)(K,{id:`add-skill-url`,placeholder:`https://example.com/my-plugin.zip`,value:o,onChange:S,autoFocus:!0,onKeyDown:C}),t[15]=C,t[16]=o,t[17]=w):w=t[17];let T;t[18]===c?T=t[19]:(T=c?(0,Q.jsx)(`p`,{className:v(a.caption,`text-destructive`),children:c}):null,t[18]=c,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,Q.jsx)(`div`,{className:`grid gap-4 py-2`,children:(0,Q.jsxs)(`div`,{className:`grid gap-2`,children:[x,w,T]})}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===p?D=t[24]:(D=(0,Q.jsx)(y,{variant:`outline`,onClick:()=>p(!1),children:`Cancel`}),t[23]=p,t[24]=D);let O;t[25]===o?O=t[26]:(O=o.trim(),t[25]=o,t[26]=O);let k=!O,A;t[27]!==_||t[28]!==k?(A=(0,Q.jsx)(y,{onClick:_,disabled:k,children:`Continue`}),t[27]=_,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==D||t[31]!==A?(j=(0,Q.jsxs)(B,{children:[D,A]}),t[30]=D,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==E||t[34]!==j?(M=(0,Q.jsxs)(U,{className:`sm:max-w-lg`,children:[b,E,j]}),t[33]=E,t[34]=j,t[35]=M):M=t[35];let N;return t[36]!==p||t[37]!==n||t[38]!==M?(N=(0,Q.jsx)(G,{open:n,onOpenChange:p,children:M}),t[36]=p,t[37]=n,t[38]=M,t[39]=N):N=t[39],N}function ut(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...ut(n.children))}return t}function dt(e){return`.agents/skills/${e}/SKILL.md`}function ft(e,t){let n=t.trim();if(!n)return e;let r=n.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(r)||e.description.toLowerCase().includes(r))}function pt(e){let t=(0,X.c)(9),{items:n,installedFilePaths:r,onPreview:i}=e,a;if(t[0]!==r||t[1]!==n||t[2]!==i){let e;t[4]!==r||t[5]!==i?(e=e=>{let t=dt(e.id),n=r.has(t);return(0,Q.jsx)(Ge,{className:`bg-background hover:bg-background`,name:Ue(e.name),description:e.description,installed:n,onClick:()=>{n||i(e)},showInstalledControls:!1},e.id)},t[4]=r,t[5]=i,t[6]=e):e=t[6],a=n.map(e),t[0]=r,t[1]=n,t[2]=i,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,Q.jsx)(Le,{children:a}),t[7]=a,t[8]=o),o}function mt(e){let t=(0,X.c)(21),{skills:n,threadId:r,onOpenSkill:i,onDelete:a,onAddManual:o,onAddUrl:s}=e,c=!r,l;t[0]!==o||t[1]!==s?(l=e=>{e===`manual`?o():s()},t[0]=o,t[1]=s,t[2]=l):l=t[2];let u;t[3]!==c||t[4]!==l?(u=(0,Q.jsx)(J,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,Q.jsx)(ot,{manualDisabled:c,onSelectMode:l}),sticky:!1}),t[3]=c,t[4]=l,t[5]=u):u=t[5];let d;t[6]===r?d=t[7]:(d=!r&&(0,Q.jsx)(we,{children:`Select a thread to add or install skills.`}),t[6]=r,t[7]=d);let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f={icon:g,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},t[8]=f):f=t[8];let p;t[9]===i?p=t[10]:(p=e=>i(e.path),t[9]=i,t[10]=p);let m;t[11]!==a||t[12]!==n||t[13]!==p?(m=(0,Q.jsx)(ze,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:f,getKey:vt,renderContent:_t,onItemClick:p,itemClickLabel:gt,onDelete:a,deleteAriaLabel:ht,deleteTooltip:`Remove this skill from the project`}),t[11]=a,t[12]=n,t[13]=p,t[14]=m):m=t[14];let h;t[15]!==d||t[16]!==m?(h=(0,Q.jsxs)(be,{className:`pt-6`,children:[d,m]}),t[15]=d,t[16]=m,t[17]=h):h=t[17];let _;return t[18]!==u||t[19]!==h?(_=(0,Q.jsxs)(he,{className:`shrink-0`,children:[u,h]}),t[18]=u,t[19]=h,t[20]=_):_=t[20],_}function ht(e){return`Delete ${e.name}`}function gt(e){return`Open ${e.name} in Files`}function _t(e){return(0,Q.jsx)(`span`,{className:v(a.body,`truncate text-left`),children:e.name})}function vt(e){return e.id}function yt(e){let t=(0,X.c)(40),{availableSearch:n,onSearchChange:r,selectedSourceId:i,onSourceChange:a,sources:o,selectedCustomSource:s,availableCatalogLoading:c,isDefaultSource:l,filteredPopular:u,filteredCatalog:d,installedFilePaths:f,onPreviewPopular:h,onPreviewCatalog:g,onAddSource:_}=e,v;t[0]!==n||t[1]!==r?(v=(0,Q.jsx)(Re,{placeholder:`Search`,value:n,onChange:r,className:`mb-0 w-64`}),t[0]=n,t[1]=r,t[2]=v):v=t[2];let b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(xe,{className:`w-40`,"aria-label":`Skill source`,children:(0,Q.jsx)(Ce,{placeholder:`Default`})}),t[3]=b):b=t[3];let x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(me,{value:`default`,children:`Default`}),t[4]=x):x=t[4];let S;t[5]===o?S=t[6]:(S=o.map(bt),t[5]=o,t[6]=S);let C;t[7]===S?C=t[8]:(C=(0,Q.jsxs)(Ae,{children:[x,S]}),t[7]=S,t[8]=C);let w;t[9]!==a||t[10]!==i||t[11]!==C?(w=(0,Q.jsxs)(Te,{value:i,onValueChange:a,children:[b,C]}),t[9]=a,t[10]=i,t[11]=C,t[12]=w):w=t[12];let T=s?`Edit skill source`:`Add skill source`,E;t[13]===s?E=t[14]:(E=s?(0,Q.jsx)(p,{className:`h-4 w-4`}):(0,Q.jsx)(m,{className:`h-4 w-4`}),t[13]=s,t[14]=E);let D;t[15]!==_||t[16]!==T||t[17]!==E?(D=(0,Q.jsx)(ne,{asChild:!0,children:(0,Q.jsx)(y,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:_,"aria-label":T,children:E})}),t[15]=_,t[16]=T,t[17]=E,t[18]=D):D=t[18];let O=s?`Edit this custom skill source`:`Add a custom skill source`,k;t[19]===O?k=t[20]:(k=(0,Q.jsx)(re,{children:O}),t[19]=O,t[20]=k);let A;t[21]!==k||t[22]!==D?(A=(0,Q.jsx)(ie,{children:(0,Q.jsxs)(ae,{children:[D,k]})}),t[21]=k,t[22]=D,t[23]=A):A=t[23];let j;t[24]!==v||t[25]!==A||t[26]!==w?(j=(0,Q.jsx)(J,{title:`Available Skills`,description:`Browse and install skills from the catalog.`,action:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[v,w,A]}),sticky:!1}),t[24]=v,t[25]=A,t[26]=w,t[27]=j):j=t[27];let M;t[28]!==c||t[29]!==n||t[30]!==d||t[31]!==u||t[32]!==f||t[33]!==l||t[34]!==g||t[35]!==h?(M=(0,Q.jsx)(be,{className:`pt-6`,children:c?(0,Q.jsx)(R,{className:`py-12`,label:`Loading skills...`}):l?u.length===0?(0,Q.jsx)(Ie,{searchQuery:n,emptyLabel:`No available skills found.`}):(0,Q.jsx)(pt,{items:u,installedFilePaths:f,onPreview:h}):d.length===0?(0,Q.jsx)(Ie,{searchQuery:n,emptyLabel:`No available skills found.`}):(0,Q.jsx)(pt,{items:d,installedFilePaths:f,onPreview:g})}),t[28]=c,t[29]=n,t[30]=d,t[31]=u,t[32]=f,t[33]=l,t[34]=g,t[35]=h,t[36]=M):M=t[36];let N;return t[37]!==j||t[38]!==M?(N=(0,Q.jsxs)(he,{className:`shrink-0`,children:[j,M]}),t[37]=j,t[38]=M,t[39]=N):N=t[39],N}function bt(e){return(0,Q.jsx)(me,{value:e.id,children:e.title},e.id)}function xt(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:r,deleteConfirm:i,setDeleteConfirm:a,deleting:c,installedFilePaths:l,setInstalledFilePaths:u,loadItems:d,handleDelete:f,handleOpenInExplorer:p,triggerExplorerRefresh:m}=Ke({findItems:ut,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`}),h=s(e=>e.projects),g=(0,Z.useMemo)(()=>h.find(t=>t.projectId===e)??null,[h,e]),[v,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)([]),[E,O]=(0,Z.useState)(!0),[k,A]=(0,Z.useState)(null),[j,N]=(0,Z.useState)(!1),{query:ee,setQuery:P,deferredQuery:F}=Be(),{sources:I,selectedSourceId:L,setSelectedSourceId:ne,addSource:re,updateSource:ie,removeSource:ae,catalogSkills:R,isLoadingCatalog:B}=tt(),V=L==="default",H=(0,Z.useMemo)(()=>o(L)?I.find(e=>e.id===L)??null:null,[L,I]);(0,Z.useEffect)(()=>{O(!0),D().then(T).catch(()=>T([])).finally(()=>O(!1))},[]);let W=Fe(e?`${e}:${t??``}`:null,[r,E]),oe=(0,Z.useCallback)(async e=>{let n=`.agents/skills/${e.id}/SKILL.md`;if(!t||l.has(n))return;let r=e.sourceId??(L==="default"?void 0:L);try{if(r)await te(t,r,e.id,`.agents/skills/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.allowedTools&&r.push(`allowed-tools: ${e.allowedTools}`),e.license&&r.push(`license: ${e.license}`),r.push(`---`,``,e.instructions??``),await M(t,n,r.join(`
3
+ `))}u(e=>new Set(e).add(n)),m(),d(),z({title:`Skill installed`,description:e.name})}catch(e){throw z({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}},[t,L,l,m,d]),se=(0,Z.useMemo)(()=>ft(w,F),[w,F]),ce=(0,Z.useMemo)(()=>ft(R,F),[R,F]),le=!V&&B&&R.length===0;return e?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Se,{loading:W,children:[(0,Q.jsx)(mt,{skills:n,threadId:t,onOpenSkill:p,onDelete:a,onAddManual:()=>y(!0),onAddUrl:()=>x(!0)}),(0,Q.jsx)(yt,{availableSearch:ee,onSearchChange:P,selectedSourceId:L,onSourceChange:ne,sources:I,selectedCustomSource:H,availableCatalogLoading:le,isDefaultSource:V,filteredPopular:se,filteredCatalog:ce,installedFilePaths:l,onPreviewPopular:e=>A(e),onPreviewCatalog:e=>A({...e,sourceId:e.sourceId??L}),onAddSource:()=>N(!0)})]}),(0,Q.jsx)(Qe,{open:k!==null,onOpenChange:e=>{e||A(null)},skill:k,catalogSourceId:V?void 0:L,onInstall:oe}),(0,Q.jsx)(it,{open:j,onOpenChange:N,editingSource:H,onSourceAdded:e=>{re(e),z({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},onSourceUpdated:e=>{ie(e),z({title:`Skill source updated`,description:`${e.title} has been saved.`})},onSourceDeleted:e=>{ae(e),z({title:`Skill source removed`,description:`The custom source has been deleted.`})}}),(0,Q.jsx)(G,{open:v,onOpenChange:y,children:(0,Q.jsx)(U,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Q.jsx)(qe,{threadId:t,onSkillCreated:()=>{y(!1),d(),m()}})})}),(0,Q.jsx)(lt,{open:b,onOpenChange:x,onSubmit:e=>C(e)}),(0,Q.jsx)(Oe,{url:S,projectId:e,projectName:g?_(g):null,projects:h,onSelectProject:()=>{},onClose:()=>C(null),onInstalled:({mcpOnly:e})=>{d(),m(),z({title:e?`MCP server installed`:`Plugin installed`,description:e?`Its MCP servers were added to this project.`:`Its skills and MCP servers were added to this project.`})}}),(0,Q.jsx)(Pe,{open:i!==null,onOpenChange:e=>!e&&a(null),title:`Delete Skill`,description:`Are you sure you want to delete the skill "${i?.name}"? This action cannot be undone.`,onConfirm:()=>{i&&f(i)},confirming:c})]}):(0,Q.jsx)(ye,{children:`Select a project to manage skills.`})}export{xt as SettingsSkillsView,xt as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{at as r}from"./dist-ZlK7I-y-.js";import{D as i,Et as a,mn as o,yn as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-sfGyFWfz.js";import{Cn as u,Ft as d,M as f,Pt as p,Tt as m,p as h,x as g}from"./api-ODizoHnY.js";import{t as _}from"./use-toast-xpb5jNtN.js";import{An as v,At as y,Dn as b,Fn as x,Ft as S,Mt as C,Nt as w,Ot as T,Rn as E,kt as D}from"./index-Bmkj1Qwa.js";var O=e(t(),1),k=n();function A(){let[e,t]=(0,O.useState)(null),[n,A]=(0,O.useState)([]),[j,M]=(0,O.useState)(``),[N,P]=(0,O.useState)(``),[F,I]=(0,O.useState)(``),[L,R]=(0,O.useState)(``),[z,B]=(0,O.useState)(``),[V,H]=(0,O.useState)(!0),[U,W]=(0,O.useState)(!1),[G,K]=(0,O.useState)(!1),q=(0,O.useCallback)(async()=>{let[e,n]=await Promise.all([d(),m()]);t(e),A(n.projects)},[]);(0,O.useEffect)(()=>{let e=!1;async function n(){H(!0);try{let[n,r,i]=await Promise.all([d(),m(),p()]);e||(t(n),A(r.projects),B(i.manifest),r.projects[0]&&!L&&R(r.projects[0].projectId))}catch(e){_({title:`Failed to load Slack settings`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{e||H(!1)}}return n(),()=>{e=!0}},[]);async function J(){if(!(!j.trim()||!N.trim())){W(!0);try{await u({botToken:j.trim(),appToken:N.trim()}),M(``),P(``),await q(),_({title:`Slack tokens saved`})}catch(e){_({title:`Failed to save tokens`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{W(!1)}}}async function Y(){W(!0);try{await h(),await q(),_({title:`Slack tokens cleared`})}catch(e){_({title:`Failed to clear tokens`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{W(!1)}}async function X(){let t=F.trim();if(!(!t||!L)){K(!0);try{let n=e?.channels.find(e=>e.id===t);await g({slackChannelId:t,projectId:L,...n?{slackChannelName:n.name}:{}}),I(``),await q(),_({title:`Channel bound`})}catch(e){_({title:`Failed to bind channel`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{K(!1)}}}async function Z(e){try{await f(e.slackTeamId,e.slackChannelId),await q(),_({title:`Binding removed`})}catch(e){_({title:`Failed to remove binding`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}}async function Q(){try{await navigator.clipboard.writeText(z||(await p()).manifest),_({title:`Manifest copied`})}catch(e){_({title:`Failed to copy manifest`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}}if(V||!e)return(0,k.jsx)(E,{title:`Slack`,description:`Loading Slack settings…`,children:(0,k.jsxs)(`div`,{className:c(`flex items-center gap-2 text-muted-foreground`,r.compact),children:[(0,k.jsx)(a,{className:`h-4 w-4 animate-spin`}),`Loading Slack settings…`]})});let $=e.configured?[e.botUsername?`@${e.botUsername}`:e.botTokenPreview,`Bridge ${e.bridgeRunning?`running`:`stopped`}`,e.teamName].filter(Boolean).join(` · `):`Not configured`;return(0,k.jsx)(E,{title:`Slack`,description:`Connect a Slack app (Socket Mode) and bind channels to Tarsk projects.`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(v,{title:`Slack App`}),(0,k.jsxs)(x,{children:[(0,k.jsx)(b,{title:`App Manifest`,description:`Create a Slack app from this manifest, enable Socket Mode, then paste the Bot and App-Level tokens below. The Slack manifest cannot include an app icon — download the Tarsk logo and upload it under Basic Information after creating the app.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void Q(),children:[(0,k.jsx)(s,{className:`mr-2 h-4 w-4`}),`Copy app manifest`]}),(0,k.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,asChild:!0,children:(0,k.jsxs)(`a`,{href:`/slack-app-icon.png`,download:`tarsk-slack-app-icon.png`,children:[(0,k.jsx)(o,{className:`mr-2 h-4 w-4`}),`Download app icon`]})})]})}),(0,k.jsx)(b,{title:`Status`,description:`Bot identity and Socket Mode bridge status.`,children:(0,k.jsx)(`span`,{className:c(`text-muted-foreground`,r.bodyMuted),children:$})}),(0,k.jsx)(b,{title:`Bot Token`,description:`Bot User OAuth Token from your Slack app (starts with xoxb-).`,children:(0,k.jsx)(S,{id:`slack-bot-token`,type:`password`,autoComplete:`off`,placeholder:e.botTokenPreview||`xoxb-…`,value:j,onChange:e=>M(e.target.value)})}),(0,k.jsx)(b,{title:`App-Level Token`,description:`App-Level Token with connections:write for Socket Mode (starts with xapp-).`,children:(0,k.jsx)(S,{id:`slack-app-token`,type:`password`,autoComplete:`off`,placeholder:e.appTokenPreview||`xapp-…`,value:N,onChange:e=>P(e.target.value)})}),(0,k.jsx)(b,{title:`Tokens`,description:`Save both tokens to start the bridge, or clear them to disconnect.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsxs)(l,{type:`button`,onClick:()=>void J(),disabled:U||!j.trim()||!N.trim(),children:[U?(0,k.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Save`]}),e.configured?(0,k.jsx)(l,{type:`button`,variant:`outline`,onClick:()=>void Y(),disabled:U,children:`Clear`}):null]})})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(v,{title:`Channel Bindings`}),(0,k.jsxs)(x,{children:[(0,k.jsx)(b,{title:`Slack Channel`,description:`Invite the bot to the channel first. Only channels the bot can see are listed.`,children:e.channels.length>0?(0,k.jsxs)(T,{value:F||void 0,onValueChange:I,children:[(0,k.jsx)(C,{id:`slack-channel`,"aria-label":`Slack Channel`,children:(0,k.jsx)(w,{placeholder:`Select a channel…`})}),(0,k.jsx)(D,{children:e.channels.map(e=>(0,k.jsx)(y,{value:e.id,children:e.name},e.id))})]}):(0,k.jsx)(S,{id:`slack-channel`,placeholder:`Channel ID (C…)`,value:F,onChange:e=>I(e.target.value)})}),(0,k.jsx)(b,{title:`Tarsk Project`,description:`Each Slack channel maps to one Tarsk project.`,children:(0,k.jsxs)(T,{value:L||void 0,onValueChange:R,disabled:n.length===0,children:[(0,k.jsx)(C,{id:`slack-project`,"aria-label":`Tarsk Project`,children:(0,k.jsx)(w,{placeholder:n.length===0?`No projects`:`Select a project…`})}),(0,k.jsx)(D,{children:n.map(e=>(0,k.jsx)(y,{value:e.projectId,children:e.name},e.projectId))})]})}),(0,k.jsx)(b,{title:`Bind`,description:`Create a channel ↔ project binding.`,controlLayout:`row-end`,action:(0,k.jsxs)(l,{type:`button`,onClick:()=>void X(),disabled:G||!F.trim()||!L,children:[G?(0,k.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Bind channel`]})})]}),(0,k.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:e.bindings.length===0?(0,k.jsx)(`p`,{className:c(`text-muted-foreground`,r.compact),children:`No bindings yet.`}):e.bindings.map(e=>{let t=n.find(t=>t.projectId===e.projectId)?.name||e.projectId;return(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[(0,k.jsxs)(`div`,{className:c(r.compact),children:[(0,k.jsx)(`div`,{className:`font-medium`,children:e.slackChannelName||e.slackChannelId}),(0,k.jsx)(`div`,{className:`text-muted-foreground`,children:t})]}),(0,k.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>void Z(e),"aria-label":`Remove binding`,children:(0,k.jsx)(i,{className:`h-4 w-4`})})]},`${e.slackTeamId}:${e.slackChannelId}`)})})]})]})})}export{A as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{D as i,Et as a,mn as o,yn as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{Ft as u,M as d,Pt as f,Tt as p,p as m,wn as h,x as g}from"./api-BMo_Lz8f.js";import{t as _}from"./use-toast-xpb5jNtN.js";import{An as v,At as y,Dn as b,Fn as x,Ft as S,Mt as C,Nt as w,Ot as T,Rn as E,kt as D}from"./index-DjaVbFDB.js";var O=e(t(),1),k=n();function A(){let[e,t]=(0,O.useState)(null),[n,A]=(0,O.useState)([]),[j,M]=(0,O.useState)(``),[N,P]=(0,O.useState)(``),[F,I]=(0,O.useState)(``),[L,R]=(0,O.useState)(``),[z,B]=(0,O.useState)(``),[V,H]=(0,O.useState)(!0),[U,W]=(0,O.useState)(!1),[G,K]=(0,O.useState)(!1),q=(0,O.useCallback)(async()=>{let[e,n]=await Promise.all([u(),p()]);t(e),A(n.projects)},[]);(0,O.useEffect)(()=>{let e=!1;async function n(){H(!0);try{let[n,r,i]=await Promise.all([u(),p(),f()]);e||(t(n),A(r.projects),B(i.manifest),r.projects[0]&&!L&&R(r.projects[0].projectId))}catch(e){_({title:`Failed to load Slack settings`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{e||H(!1)}}return n(),()=>{e=!0}},[]);async function J(){if(!(!j.trim()||!N.trim())){W(!0);try{await h({botToken:j.trim(),appToken:N.trim()}),M(``),P(``),await q(),_({title:`Slack tokens saved`})}catch(e){_({title:`Failed to save tokens`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{W(!1)}}}async function Y(){W(!0);try{await m(),await q(),_({title:`Slack tokens cleared`})}catch(e){_({title:`Failed to clear tokens`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{W(!1)}}async function X(){let t=F.trim();if(!(!t||!L)){K(!0);try{let n=e?.channels.find(e=>e.id===t);await g({slackChannelId:t,projectId:L,...n?{slackChannelName:n.name}:{}}),I(``),await q(),_({title:`Channel bound`})}catch(e){_({title:`Failed to bind channel`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{K(!1)}}}async function Z(e){try{await d(e.slackTeamId,e.slackChannelId),await q(),_({title:`Binding removed`})}catch(e){_({title:`Failed to remove binding`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}}async function Q(){try{await navigator.clipboard.writeText(z||(await f()).manifest),_({title:`Manifest copied`})}catch(e){_({title:`Failed to copy manifest`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}}if(V||!e)return(0,k.jsx)(E,{title:`Slack`,description:`Loading Slack settings…`,children:(0,k.jsxs)(`div`,{className:c(`flex items-center gap-2 text-muted-foreground`,r.compact),children:[(0,k.jsx)(a,{className:`h-4 w-4 animate-spin`}),`Loading Slack settings…`]})});let $=e.configured?[e.botUsername?`@${e.botUsername}`:e.botTokenPreview,`Bridge ${e.bridgeRunning?`running`:`stopped`}`,e.teamName].filter(Boolean).join(` · `):`Not configured`;return(0,k.jsx)(E,{title:`Slack`,description:`Connect a Slack app (Socket Mode) and bind channels to Tarsk projects.`,children:(0,k.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(v,{title:`Slack App`}),(0,k.jsxs)(x,{children:[(0,k.jsx)(b,{title:`App Manifest`,description:`Create a Slack app from this manifest, enable Socket Mode, then paste the Bot and App-Level tokens below. The Slack manifest cannot include an app icon — download the Tarsk logo and upload it under Basic Information after creating the app.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsxs)(l,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>void Q(),children:[(0,k.jsx)(s,{className:`mr-2 h-4 w-4`}),`Copy app manifest`]}),(0,k.jsx)(l,{type:`button`,variant:`outline`,size:`sm`,asChild:!0,children:(0,k.jsxs)(`a`,{href:`/slack-app-icon.png`,download:`tarsk-slack-app-icon.png`,children:[(0,k.jsx)(o,{className:`mr-2 h-4 w-4`}),`Download app icon`]})})]})}),(0,k.jsx)(b,{title:`Status`,description:`Bot identity and Socket Mode bridge status.`,children:(0,k.jsx)(`span`,{className:c(`text-muted-foreground`,r.bodyMuted),children:$})}),(0,k.jsx)(b,{title:`Bot Token`,description:`Bot User OAuth Token from your Slack app (starts with xoxb-).`,children:(0,k.jsx)(S,{id:`slack-bot-token`,type:`password`,autoComplete:`off`,placeholder:e.botTokenPreview||`xoxb-…`,value:j,onChange:e=>M(e.target.value)})}),(0,k.jsx)(b,{title:`App-Level Token`,description:`App-Level Token with connections:write for Socket Mode (starts with xapp-).`,children:(0,k.jsx)(S,{id:`slack-app-token`,type:`password`,autoComplete:`off`,placeholder:e.appTokenPreview||`xapp-…`,value:N,onChange:e=>P(e.target.value)})}),(0,k.jsx)(b,{title:`Tokens`,description:`Save both tokens to start the bridge, or clear them to disconnect.`,controlLayout:`row-end`,action:(0,k.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,k.jsxs)(l,{type:`button`,onClick:()=>void J(),disabled:U||!j.trim()||!N.trim(),children:[U?(0,k.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Save`]}),e.configured?(0,k.jsx)(l,{type:`button`,variant:`outline`,onClick:()=>void Y(),disabled:U,children:`Clear`}):null]})})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(v,{title:`Channel Bindings`}),(0,k.jsxs)(x,{children:[(0,k.jsx)(b,{title:`Slack Channel`,description:`Invite the bot to the channel first. Only channels the bot can see are listed.`,children:e.channels.length>0?(0,k.jsxs)(T,{value:F||void 0,onValueChange:I,children:[(0,k.jsx)(C,{id:`slack-channel`,"aria-label":`Slack Channel`,children:(0,k.jsx)(w,{placeholder:`Select a channel…`})}),(0,k.jsx)(D,{children:e.channels.map(e=>(0,k.jsx)(y,{value:e.id,children:e.name},e.id))})]}):(0,k.jsx)(S,{id:`slack-channel`,placeholder:`Channel ID (C…)`,value:F,onChange:e=>I(e.target.value)})}),(0,k.jsx)(b,{title:`Tarsk Project`,description:`Each Slack channel maps to one Tarsk project.`,children:(0,k.jsxs)(T,{value:L||void 0,onValueChange:R,disabled:n.length===0,children:[(0,k.jsx)(C,{id:`slack-project`,"aria-label":`Tarsk Project`,children:(0,k.jsx)(w,{placeholder:n.length===0?`No projects`:`Select a project…`})}),(0,k.jsx)(D,{children:n.map(e=>(0,k.jsx)(y,{value:e.projectId,children:e.name},e.projectId))})]})}),(0,k.jsx)(b,{title:`Bind`,description:`Create a channel ↔ project binding.`,controlLayout:`row-end`,action:(0,k.jsxs)(l,{type:`button`,onClick:()=>void X(),disabled:G||!F.trim()||!L,children:[G?(0,k.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}):null,`Bind channel`]})})]}),(0,k.jsx)(`div`,{className:`mt-4 flex flex-col gap-2`,children:e.bindings.length===0?(0,k.jsx)(`p`,{className:c(`text-muted-foreground`,r.compact),children:`No bindings yet.`}):e.bindings.map(e=>{let t=n.find(t=>t.projectId===e.projectId)?.name||e.projectId;return(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border px-3 py-2`,children:[(0,k.jsxs)(`div`,{className:c(r.compact),children:[(0,k.jsx)(`div`,{className:`font-medium`,children:e.slackChannelName||e.slackChannelId}),(0,k.jsx)(`div`,{className:`text-muted-foreground`,children:t})]}),(0,k.jsx)(l,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>void Z(e),"aria-label":`Remove binding`,children:(0,k.jsx)(i,{className:`h-4 w-4`})})]},`${e.slackTeamId}:${e.slackChannelId}`)})})]})]})})}export{A as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{at as r}from"./dist-ZlK7I-y-.js";import{r as i}from"./store-Be_7VK0D.js";import{k as a}from"./dist-DIjomljy.js";import{t as o}from"./utils-CT-Dw22R.js";import{t as s}from"./button-sfGyFWfz.js";import{It as c,N as l,S as u,Xn as d,tr as f}from"./api-ODizoHnY.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{r as m,t as h}from"./dialog-CP2cYR59.js";import{n as g}from"./explorer-tab-context-BxUVwWQQ.js";import{t as _}from"./use-open-chat-dock-panel-D1D5bnsL.js";import{Bn as v,Dn as y,En as b,Ft as x,In as S,Ln as C,Nn as w,On as ee,Pt as T,kn as E,zn as D}from"./index-Bmkj1Qwa.js";import{t as O}from"./delete-confirm-dialog-B99gEJN8.js";import{n as k,t as A}from"./radio-group-CU59hGiA.js";import{t as j}from"./use-settings-page-loading-BTySlInF.js";import{a as M,i as N,o as te,r as P}from"./settings-list-PMi8ZniW.js";import{a as F,i as I,r as L,t as R}from"./mcp-server-card-DPNG9Up7.js";var z=e(t(),1),B=n();function V({projectId:e,threadId:t,onCommandCreated:n}){let[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,d]=(0,z.useState)(``),[f,m]=(0,z.useState)(`default`),[h,g]=(0,z.useState)(!1),_=I(i),v=L(_),C=async()=>{if(!(!v||!e)){g(!0);try{await u(_,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:f===`plan`?`plan`:void 0},`project`,t??void 0),p({title:`Command created`,description:`Command '/${_}' was created successfully.`}),a(``),c(``),d(``),m(`default`),n?.(_)}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{g(!1)}}};return e?(0,B.jsx)(D,{children:(0,B.jsxs)(b,{children:[(0,B.jsx)(E,{title:`Add Slash Command`,description:`Saved as a .md file in ~/.agents/commands.`,sticky:!0,className:`pr-10`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(y,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,B.jsx)(x,{id:`commandName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,B.jsxs)(`p`,{className:o(r.caption,`mt-2`),children:[`Command: `,(0,B.jsxs)(`span`,{className:`font-mono`,children:[`/`,_||`...`]})]}):null]}),(0,B.jsx)(y,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(x,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,B.jsx)(y,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(x,{id:`argumentHint`,value:l,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,B.jsx)(y,{title:`Mode`,description:f==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsxs)(A,{value:f,onValueChange:e=>m(e),className:`flex gap-4`,disabled:h,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(k,{value:`default`,id:`mode-default`}),(0,B.jsx)(T,{htmlFor:`mode-default`,className:o(r.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(k,{value:`plan`,id:`mode-plan`}),(0,B.jsx)(T,{htmlFor:`mode-plan`,className:o(r.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,B.jsx)(F,{onContinue:()=>void C(),disabled:!v,creating:h})]})]})}):(0,B.jsx)(S,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function H(){let e=i(e=>e.selectedProjectId),t=i(e=>e.selectedThreadId),{openChatDockPanel:n}=_(),{setPendingExplorerPath:y,triggerExplorerRefresh:b,setExplorerClearPath:x}=g(),[T,D]=(0,z.useState)([]),[k,A]=(0,z.useState)(!0),[F,I]=(0,z.useState)(!1),[L,H]=(0,z.useState)(null),[U,W]=(0,z.useState)(!1),[G,K]=(0,z.useState)([]),[q,J]=(0,z.useState)(!0),[Y,X]=(0,z.useState)(new Map),[Z,ne]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(!t){A(!1),D([]),X(new Map);return}A(!0);try{let e=await c(t);D(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{D([]),X(new Map)}finally{A(!1)}},[t]);(0,z.useLayoutEffect)(()=>{t&&A(!0)},[e,t]),(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{J(!0),d().then(K).catch(()=>K([])).finally(()=>J(!1))},[]);let re=j(e?`${e}:${t??``}`:null,[k,q]),ie=(0,z.useCallback)(async e=>{W(!0);try{await l(e.filePath),x(e.filePath),b(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),p({title:`Command removed`,description:`/${e.name}`}),H(null),await Q()}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{W(!1)}},[Q,b,x]),ae=(0,z.useCallback)(e=>{y(e),n(`explorer`)},[y,n]),oe=(0,z.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),se=(0,z.useCallback)(async e=>{if(!(!t||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let n=`.agents/commands`;await f(t,e.gitHubRepo,e.gitHubFolder,n);let r=`${n}/${e.name}.md`;X(t=>new Map(t).set(e.name,r))}else{let n=await u(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,t);X(t=>new Map(t).set(e.name,n.filePath))}b(),Q(),p({title:`Command installed`,description:`/${e.name}`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[t,Y,b,Q]),$=Z.trim()?G.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):G;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(w,{loading:re,children:[(0,B.jsxs)(v,{className:`shrink-0`,children:[(0,B.jsx)(E,{title:`Installed Slash Commands`,description:`Project slash commands you run with / in chat.`,action:(0,B.jsx)(s,{onClick:()=>I(!0),disabled:!t,children:`Add Command`}),sticky:!1}),(0,B.jsxs)(C,{className:`pt-6`,children:[!t&&(0,B.jsx)(ee,{children:`Select a thread to add or install slash commands.`}),(0,B.jsx)(P,{showHeader:!1,loading:!1,items:T,emptyState:{icon:a,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},getKey:e=>e.filePath,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:e=>(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsxs)(`div`,{className:o(r.body,`truncate`),children:[`/`,e.name]}),(0,B.jsx)(`div`,{className:o(r.compact,`truncate text-muted-foreground`),children:oe(e)})]}),renderMiddle:e=>e.metadata?.mode?(0,B.jsx)(`span`,{className:o(r.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,B.jsx)(`div`,{}),onItemClick:e=>ae(e.filePath),itemClickLabel:e=>`Open /${e.name} in Files`,onDelete:H,deleteAriaLabel:e=>`Delete /${e.name}`,deleteTooltip:`Remove this slash command from the project`})]})]}),(0,B.jsxs)(v,{className:`shrink-0`,children:[(0,B.jsx)(E,{title:`Available Slash Commands`,description:`Browse and install slash commands from the catalog.`,action:(0,B.jsx)(te,{placeholder:`Search`,value:Z,onChange:ne,className:`mb-0 w-64`}),sticky:!1}),(0,B.jsx)(C,{className:`pt-6`,children:$.length===0?(0,B.jsx)(M,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,B.jsx)(N,{children:$.map(e=>{let t=Y.has(e.name);return(0,B.jsx)(R,{className:`bg-background hover:bg-background`,name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||se(e)},showInstalledControls:!1},e.id)})})})]})]}),(0,B.jsx)(h,{open:F,onOpenChange:I,children:(0,B.jsx)(m,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{projectId:e,threadId:t,onCommandCreated:()=>{I(!1),Q(),b()}})})}),(0,B.jsx)(O,{open:L!==null,onOpenChange:e=>!e&&H(null),title:`Delete Slash Command`,description:`Are you sure you want to delete "/${L?.name}"? This action cannot be undone.`,onConfirm:()=>{L&&ie(L)},confirming:U})]}):(0,B.jsx)(S,{children:`Select a project to manage slash commands.`})}export{H as SettingsSlashCommandsView,H as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{r as i}from"./store-BaMSfYoJ.js";import{k as a}from"./dist-DIjomljy.js";import{t as o}from"./utils-CT-Dw22R.js";import{t as s}from"./button-DeNw35VZ.js";import{It as c,N as l,S as u,Zn as d,nr as f}from"./api-BMo_Lz8f.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{r as m,t as h}from"./dialog-Do98zzAW.js";import{n as g}from"./explorer-tab-context-BxUVwWQQ.js";import{t as _}from"./use-open-chat-dock-panel-Cr1bQYOH.js";import{Bn as v,Dn as y,En as b,Ft as x,In as S,Ln as C,Nn as w,On as ee,Pt as T,kn as E,zn as D}from"./index-DjaVbFDB.js";import{t as O}from"./delete-confirm-dialog-C9NASyh6.js";import{n as k,t as A}from"./radio-group-CU59hGiA.js";import{t as j}from"./use-settings-page-loading-BTySlInF.js";import{a as M,i as N,o as te,r as P}from"./settings-list-DU82HNPX.js";import{a as F,i as I,r as L,t as R}from"./mcp-server-card-zm-ss-7h.js";var z=e(t(),1),B=n();function V({projectId:e,threadId:t,onCommandCreated:n}){let[i,a]=(0,z.useState)(``),[s,c]=(0,z.useState)(``),[l,d]=(0,z.useState)(``),[f,m]=(0,z.useState)(`default`),[h,g]=(0,z.useState)(!1),_=I(i),v=L(_),C=async()=>{if(!(!v||!e)){g(!0);try{await u(_,``,{description:s.trim()||void 0,argumentHint:l.trim()||void 0,mode:f===`plan`?`plan`:void 0},`project`,t??void 0),p({title:`Command created`,description:`Command '/${_}' was created successfully.`}),a(``),c(``),d(``),m(`default`),n?.(_)}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{g(!1)}}};return e?(0,B.jsx)(D,{children:(0,B.jsxs)(b,{children:[(0,B.jsx)(E,{title:`Add Slash Command`,description:`Saved as a .md file in ~/.agents/commands.`,sticky:!0,className:`pr-10`}),(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(y,{title:`Command Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,B.jsx)(x,{id:`commandName`,value:i,onChange:e=>a(e.target.value),placeholder:`e.g. review`,disabled:h}),i?(0,B.jsxs)(`p`,{className:o(r.caption,`mt-2`),children:[`Command: `,(0,B.jsxs)(`span`,{className:`font-mono`,children:[`/`,_||`...`]})]}):null]}),(0,B.jsx)(y,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(x,{id:`commandDescription`,value:s,onChange:e=>c(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:h})}),(0,B.jsx)(y,{title:`Argument Hint`,description:`Shows after the command name to guide users what to type`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsx)(x,{id:`argumentHint`,value:l,onChange:e=>d(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:h})}),(0,B.jsx)(y,{title:`Mode`,description:f==="default"?`Standard chat mode`:`Activates plan mode when this command is used`,controlLayout:`stack`,className:`pt-6`,children:(0,B.jsxs)(A,{value:f,onValueChange:e=>m(e),className:`flex gap-4`,disabled:h,children:[(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(k,{value:`default`,id:`mode-default`}),(0,B.jsx)(T,{htmlFor:`mode-default`,className:o(r.labelNormal,`cursor-pointer`),children:`Default`})]}),(0,B.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,B.jsx)(k,{value:`plan`,id:`mode-plan`}),(0,B.jsx)(T,{htmlFor:`mode-plan`,className:o(r.labelNormal,`cursor-pointer`),children:`Plan`})]})]})}),(0,B.jsx)(F,{onContinue:()=>void C(),disabled:!v,creating:h})]})]})}):(0,B.jsx)(S,{title:`No project selected`,children:`Please select a project to add a slash command.`})}function H(){let e=i(e=>e.selectedProjectId),t=i(e=>e.selectedThreadId),{openChatDockPanel:n}=_(),{setPendingExplorerPath:y,triggerExplorerRefresh:b,setExplorerClearPath:x}=g(),[T,D]=(0,z.useState)([]),[k,A]=(0,z.useState)(!0),[F,I]=(0,z.useState)(!1),[L,H]=(0,z.useState)(null),[U,W]=(0,z.useState)(!1),[G,K]=(0,z.useState)([]),[q,J]=(0,z.useState)(!0),[Y,X]=(0,z.useState)(new Map),[Z,ne]=(0,z.useState)(``),Q=(0,z.useCallback)(async()=>{if(!t){A(!1),D([]),X(new Map);return}A(!0);try{let e=await c(t);D(e.filter(e=>!e.isBuiltIn)),X(new Map(e.map(e=>[e.name,e.filePath])))}catch{D([]),X(new Map)}finally{A(!1)}},[t]);(0,z.useLayoutEffect)(()=>{t&&A(!0)},[e,t]),(0,z.useEffect)(()=>{Q()},[Q]),(0,z.useEffect)(()=>{J(!0),d().then(K).catch(()=>K([])).finally(()=>J(!1))},[]);let re=j(e?`${e}:${t??``}`:null,[k,q]),ie=(0,z.useCallback)(async e=>{W(!0);try{await l(e.filePath),x(e.filePath),b(),X(t=>{let n=new Map(t);return n.delete(e.name),n}),p({title:`Command removed`,description:`/${e.name}`}),H(null),await Q()}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to remove command`,variant:`destructive`})}finally{W(!1)}},[Q,b,x]),ae=(0,z.useCallback)(e=>{y(e),n(`explorer`)},[y,n]),oe=(0,z.useCallback)(e=>{let t=e.metadata?.description?.trim();return t&&t.length>0?t:`No description`},[]),se=(0,z.useCallback)(async e=>{if(!(!t||Y.has(e.name)))try{if(e.gitHubRepo&&e.gitHubFolder){let n=`.agents/commands`;await f(t,e.gitHubRepo,e.gitHubFolder,n);let r=`${n}/${e.name}.md`;X(t=>new Map(t).set(e.name,r))}else{let n=await u(e.name,e.content,{description:e.description,argumentHint:e.argumentHint},`project`,t);X(t=>new Map(t).set(e.name,n.filePath))}b(),Q(),p({title:`Command installed`,description:`/${e.name}`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to install command`,variant:`destructive`})}},[t,Y,b,Q]),$=Z.trim()?G.filter(e=>e.name.toLowerCase().includes(Z.toLowerCase())||e.description.toLowerCase().includes(Z.toLowerCase())):G;return e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(w,{loading:re,children:[(0,B.jsxs)(v,{className:`shrink-0`,children:[(0,B.jsx)(E,{title:`Installed Slash Commands`,description:`Project slash commands you run with / in chat.`,action:(0,B.jsx)(s,{onClick:()=>I(!0),disabled:!t,children:`Add Command`}),sticky:!1}),(0,B.jsxs)(C,{className:`pt-6`,children:[!t&&(0,B.jsx)(ee,{children:`Select a thread to add or install slash commands.`}),(0,B.jsx)(P,{showHeader:!1,loading:!1,items:T,emptyState:{icon:a,title:`No slash commands installed`,description:`Add slash commands to create quick actions in chat.`},getKey:e=>e.filePath,columnsClassName:`grid-cols-[minmax(0,1fr)_auto_1.75rem]`,renderContent:e=>(0,B.jsxs)(`div`,{className:`min-w-0 text-left`,children:[(0,B.jsxs)(`div`,{className:o(r.body,`truncate`),children:[`/`,e.name]}),(0,B.jsx)(`div`,{className:o(r.compact,`truncate text-muted-foreground`),children:oe(e)})]}),renderMiddle:e=>e.metadata?.mode?(0,B.jsx)(`span`,{className:o(r.compact,`bg-muted px-1.5 py-0.5 rounded flex-shrink-0`),children:e.metadata.mode}):(0,B.jsx)(`div`,{}),onItemClick:e=>ae(e.filePath),itemClickLabel:e=>`Open /${e.name} in Files`,onDelete:H,deleteAriaLabel:e=>`Delete /${e.name}`,deleteTooltip:`Remove this slash command from the project`})]})]}),(0,B.jsxs)(v,{className:`shrink-0`,children:[(0,B.jsx)(E,{title:`Available Slash Commands`,description:`Browse and install slash commands from the catalog.`,action:(0,B.jsx)(te,{placeholder:`Search`,value:Z,onChange:ne,className:`mb-0 w-64`}),sticky:!1}),(0,B.jsx)(C,{className:`pt-6`,children:$.length===0?(0,B.jsx)(M,{searchQuery:Z,emptyLabel:`No available commands found.`}):(0,B.jsx)(N,{children:$.map(e=>{let t=Y.has(e.name);return(0,B.jsx)(R,{className:`bg-background hover:bg-background`,name:`/${e.name}`,description:e.description,installed:t,onClick:()=>{t||se(e)},showInstalledControls:!1},e.id)})})})]})]}),(0,B.jsx)(h,{open:F,onOpenChange:I,children:(0,B.jsx)(m,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,B.jsx)(V,{projectId:e,threadId:t,onCommandCreated:()=>{I(!1),Q(),b()}})})}),(0,B.jsx)(O,{open:L!==null,onOpenChange:e=>!e&&H(null),title:`Delete Slash Command`,description:`Are you sure you want to delete "/${L?.name}"? This action cannot be undone.`,onConfirm:()=>{L&&ie(L)},confirming:U})]}):(0,B.jsx)(S,{children:`Select a project to manage slash commands.`})}export{H as SettingsSlashCommandsView,H as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{at as i,x as a}from"./dist-ZlK7I-y-.js";import{t as o}from"./utils-CT-Dw22R.js";import{ut as s}from"./api-ODizoHnY.js";import{Rn as c}from"./index-Bmkj1Qwa.js";import{a as l,i as u,n as d,r as f,t as p}from"./table-B2TDbGGl.js";import{n as m,t as h}from"./toggle-group-BiUqOiP6.js";var g=t(),_=e(n(),1),v=a(`app.use-latency-stats.hook`),y={tools:[],models:[]};function b(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),[o,c]=(0,_.useState)(null),l=(0,_.useCallback)(async function(){try{c(null);let e=await s();t(e.tools??y.tools),r(e.models??y.models)}catch(e){v.error(`Failed to load latency statistics`,e),c(e instanceof Error?e.message:`Failed to load statistics`)}finally{a(!1)}},[]);return(0,_.useEffect)(()=>{l()},[l]),{tools:e,models:n,isLoading:i,error:o,refresh:l}}var x=r(),S=[{value:`tools`,label:`Tools`},{value:`models`,label:`Models`}],C=`inline-flex rounded-full border bg-muted/40 p-1`,w=`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`,T=`h-9`,E=`table-fixed`,D=o(i.body,`py-1.5`),O=o(i.body,`w-28 py-1.5 text-right tabular-nums`),k=o(i.body,`w-32 py-1.5 text-right tabular-nums`),A=`h-9 w-28 bg-transparent py-2 text-right`,j=`h-9 w-32 bg-transparent py-2 text-right`;function M(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function N(e){let t=(0,g.c)(3),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=o(`w-full caption-bottom`,E,i.body),t[0]=r):r=t[0];let a;return t[1]===n?a=t[2]:(a=(0,x.jsx)(`table`,{className:r,children:(0,x.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,x.jsx)(`tr`,{children:n===`tools`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u,{className:`h-9 bg-transparent py-2`,children:`Tool`}),(0,x.jsx)(u,{className:A,children:`Calls`}),(0,x.jsx)(u,{className:j,children:`Latency`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u,{className:`h-9 bg-transparent py-2`,children:`Model`}),(0,x.jsx)(u,{className:A,children:`Requests`}),(0,x.jsx)(u,{className:j,children:`Latency`})]})})})}),t[1]=n,t[2]=a),a}function P(){let e=(0,g.c)(19),{tools:t,models:n,isLoading:r,error:a}=b(),[s,l]=(0,_.useState)(`tools`),u=s===`tools`&&!r&&t.length>0,f=s===`models`&&!r&&n.length>0,m=u||f,v;e[0]!==m||e[1]!==s?(v=m?(0,x.jsx)(N,{view:s}):void 0,e[0]=m,e[1]=s,e[2]=v):v=e[2];let y;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{(e===`tools`||e===`models`)&&l(e)},e[3]=y):y=e[3];let w;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=S.map(L),e[4]=w):w=e[4];let T;e[5]===s?T=e[6]:(T=(0,x.jsx)(h,{type:`single`,value:s,onValueChange:y,"aria-label":`Statistics view`,variant:`outline`,className:C,children:w}),e[5]=s,e[6]=T);let D;e[7]===a?D=e[8]:(D=a?(0,x.jsx)(`p`,{className:o(i.bodyMuted,`mb-6 text-destructive`),children:a}):null,e[7]=a,e[8]=D);let O;e[9]!==r||e[10]!==n||e[11]!==t||e[12]!==s?(O=s===`tools`?r?(0,x.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):t.length===0?(0,x.jsx)(`p`,{className:i.bodyMuted,children:`No tool call timings recorded yet. Stats appear after agent tool calls complete.`}):(0,x.jsx)(p,{className:E,children:(0,x.jsx)(d,{children:t.map(I)})}):r?(0,x.jsx)(`p`,{className:i.bodyMuted,children:`Loading…`}):n.length===0?(0,x.jsx)(`p`,{className:i.bodyMuted,children:`No model timings recorded yet. Stats appear after assistant responses complete.`}):(0,x.jsx)(p,{className:E,children:(0,x.jsx)(d,{children:n.map(F)})}),e[9]=r,e[10]=n,e[11]=t,e[12]=s,e[13]=O):O=e[13];let k;return e[14]!==v||e[15]!==T||e[16]!==D||e[17]!==O?(k=(0,x.jsxs)(c,{title:`Statistics`,description:`Average latency and request counts for tool calls and model responses.`,tableHeader:v,action:T,children:[D,O]}),e[14]=v,e[15]=T,e[16]=D,e[17]=O,e[18]=k):k=e[18],k}function F(e){return(0,x.jsxs)(l,{className:T,children:[(0,x.jsx)(f,{className:D,children:e.modelId}),(0,x.jsx)(f,{className:O,children:e.requestCount.toLocaleString()}),(0,x.jsx)(f,{className:k,children:M(e.averageDurationMs)})]},e.modelId)}function I(e){return(0,x.jsxs)(l,{className:T,children:[(0,x.jsx)(f,{className:D,children:e.toolName}),(0,x.jsx)(f,{className:O,children:e.callCount.toLocaleString()}),(0,x.jsx)(f,{className:k,children:M(e.averageDurationMs)})]},e.toolName)}function L(e){return(0,x.jsx)(m,{value:e.value,"aria-label":e.label,className:w,children:e.label},e.value)}export{P as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{S as i,ot as a}from"./dist-BWuYHVi8.js";import{t as o}from"./utils-CT-Dw22R.js";import{ut as s}from"./api-BMo_Lz8f.js";import{Rn as c}from"./index-DjaVbFDB.js";import{a as l,i as u,n as d,r as f,t as p}from"./table-B3fLagUj.js";import{n as m,t as h}from"./toggle-group-5tREtjoW.js";var g=t(),_=e(n(),1),v=i(`app.use-latency-stats.hook`),y={tools:[],models:[]};function b(){let[e,t]=(0,_.useState)([]),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),[o,c]=(0,_.useState)(null),l=(0,_.useCallback)(async function(){try{c(null);let e=await s();t(e.tools??y.tools),r(e.models??y.models)}catch(e){v.error(`Failed to load latency statistics`,e),c(e instanceof Error?e.message:`Failed to load statistics`)}finally{a(!1)}},[]);return(0,_.useEffect)(()=>{l()},[l]),{tools:e,models:n,isLoading:i,error:o,refresh:l}}var x=r(),S=[{value:`tools`,label:`Tools`},{value:`models`,label:`Models`}],C=`inline-flex rounded-full border bg-muted/40 p-1`,w=`rounded-full border-0 px-4 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`,T=`h-9`,E=`table-fixed`,D=o(a.body,`py-1.5`),O=o(a.body,`w-28 py-1.5 text-right tabular-nums`),k=o(a.body,`w-32 py-1.5 text-right tabular-nums`),A=`h-9 w-28 bg-transparent py-2 text-right`,j=`h-9 w-32 bg-transparent py-2 text-right`;function M(e){if(!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;return t<10?`${t.toFixed(1)}s`:`${Math.round(t)}s`}function N(e){let t=(0,g.c)(3),{view:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=o(`w-full caption-bottom`,E,a.body),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,x.jsx)(`table`,{className:r,children:(0,x.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,x.jsx)(`tr`,{children:n===`tools`?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u,{className:`h-9 bg-transparent py-2`,children:`Tool`}),(0,x.jsx)(u,{className:A,children:`Calls`}),(0,x.jsx)(u,{className:j,children:`Latency`})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(u,{className:`h-9 bg-transparent py-2`,children:`Model`}),(0,x.jsx)(u,{className:A,children:`Requests`}),(0,x.jsx)(u,{className:j,children:`Latency`})]})})})}),t[1]=n,t[2]=i),i}function P(){let e=(0,g.c)(19),{tools:t,models:n,isLoading:r,error:i}=b(),[s,l]=(0,_.useState)(`tools`),u=s===`tools`&&!r&&t.length>0,f=s===`models`&&!r&&n.length>0,m=u||f,v;e[0]!==m||e[1]!==s?(v=m?(0,x.jsx)(N,{view:s}):void 0,e[0]=m,e[1]=s,e[2]=v):v=e[2];let y;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{(e===`tools`||e===`models`)&&l(e)},e[3]=y):y=e[3];let w;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(w=S.map(L),e[4]=w):w=e[4];let T;e[5]===s?T=e[6]:(T=(0,x.jsx)(h,{type:`single`,value:s,onValueChange:y,"aria-label":`Statistics view`,variant:`outline`,className:C,children:w}),e[5]=s,e[6]=T);let D;e[7]===i?D=e[8]:(D=i?(0,x.jsx)(`p`,{className:o(a.bodyMuted,`mb-6 text-destructive`),children:i}):null,e[7]=i,e[8]=D);let O;e[9]!==r||e[10]!==n||e[11]!==t||e[12]!==s?(O=s===`tools`?r?(0,x.jsx)(`p`,{className:a.bodyMuted,children:`Loading…`}):t.length===0?(0,x.jsx)(`p`,{className:a.bodyMuted,children:`No tool call timings recorded yet. Stats appear after agent tool calls complete.`}):(0,x.jsx)(p,{className:E,children:(0,x.jsx)(d,{children:t.map(I)})}):r?(0,x.jsx)(`p`,{className:a.bodyMuted,children:`Loading…`}):n.length===0?(0,x.jsx)(`p`,{className:a.bodyMuted,children:`No model timings recorded yet. Stats appear after assistant responses complete.`}):(0,x.jsx)(p,{className:E,children:(0,x.jsx)(d,{children:n.map(F)})}),e[9]=r,e[10]=n,e[11]=t,e[12]=s,e[13]=O):O=e[13];let k;return e[14]!==v||e[15]!==T||e[16]!==D||e[17]!==O?(k=(0,x.jsxs)(c,{title:`Statistics`,description:`Average latency and request counts for tool calls and model responses.`,tableHeader:v,action:T,children:[D,O]}),e[14]=v,e[15]=T,e[16]=D,e[17]=O,e[18]=k):k=e[18],k}function F(e){return(0,x.jsxs)(l,{className:T,children:[(0,x.jsx)(f,{className:D,children:e.modelId}),(0,x.jsx)(f,{className:O,children:e.requestCount.toLocaleString()}),(0,x.jsx)(f,{className:k,children:M(e.averageDurationMs)})]},e.modelId)}function I(e){return(0,x.jsxs)(l,{className:T,children:[(0,x.jsx)(f,{className:D,children:e.toolName}),(0,x.jsx)(f,{className:O,children:e.callCount.toLocaleString()}),(0,x.jsx)(f,{className:k,children:M(e.averageDurationMs)})]},e.toolName)}function L(e){return(0,x.jsx)(m,{value:e.value,"aria-label":e.label,className:w,children:e.label},e.value)}export{P as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{a as i,at as a}from"./dist-ZlK7I-y-.js";import{W as o,r as s,z as c}from"./store-Be_7VK0D.js";import{D as l,Et as u,In as d,zn as f}from"./dist-DIjomljy.js";import{a as p,t as m}from"./utils-CT-Dw22R.js";import{t as h}from"./button-sfGyFWfz.js";import{i as g,n as _,t as v}from"./tooltip-B6ziVyTv.js";import{n as y}from"./async-loading-fallback-C173aA9v.js";import{n as ee}from"./use-toast-xpb5jNtN.js";import{$ as te,Ln as ne,ft as re,hn as ie,kn as ae}from"./index-Bmkj1Qwa.js";import{t as oe}from"./delete-confirm-dialog-B99gEJN8.js";import{i as se,r as b}from"./table-B2TDbGGl.js";import{t as ce}from"./settings-list-PMi8ZniW.js";import{t as le}from"./is-macos-client-BIb4ZSEa.js";var x=t(),S=e(n(),1),C=r(),ue=36,de=`table-fixed`,fe=`h-9 w-48 bg-transparent py-2`,pe=`h-9 bg-transparent py-2`,me=`h-9 w-32 bg-transparent py-2`,he=`h-9 w-10 bg-transparent py-2`,ge=m(a.bodyMuted,`w-48 truncate py-1.5`),_e=m(a.body,`truncate py-1.5`),ve=m(a.bodyMuted,`w-32 truncate py-1.5`),ye=`w-10 py-1.5`,be={column:`project`,direction:`asc`};function xe(e){let t=(0,x.c)(4),n;if(t[0]!==e){let{style:r,...i}=e,o;t[2]===r?o=t[3]:(o={...r,width:`100%`},t[2]=r,t[3]=o),n=(0,C.jsx)(`table`,{...i,style:o,className:m(`w-full caption-bottom`,de,a.body,i.className)}),t[0]=e,t[1]=n}else n=t[1];return n}function Se(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`hidden`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`thead`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`[&_tr:last-child]:border-0`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`tbody`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function we(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`frosted-scrollbar`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`div`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function w(e,t){return t?i(t,e):e}function T(e,t,n){switch(t){case`project`:return e.projectName;case`path`:return w(e.path,n);case`branch`:return e.branch}}function Te(e){let t=[];for(let n of e){let e=p(n);for(let r of n.threads)t.push({threadId:r.threadId,projectId:n.projectId,projectName:e,path:r.path,branch:r.currentBranch||r.title})}return t}function Ee(e,t,n,r){return[...e].sort((e,i)=>{let a=T(e,t,r).localeCompare(T(i,t,r),void 0,{sensitivity:`base`});return n===`asc`?a:-a})}function E(e){let t=(0,x.c)(17),{label:n,column:r,sortColumn:i,sortDirection:a,className:o,onSort:s}=e,c=i===r,l=a===`asc`?d:f,u=c?`text-foreground`:`text-muted-foreground`,p;t[0]===u?p=t[1]:(p=m(`inline-flex items-center gap-1 transition-colors hover:text-foreground`,u),t[0]=u,t[1]=p);let h;t[2]!==r||t[3]!==s?(h=()=>s(r),t[2]=r,t[3]=s,t[4]=h):h=t[4];let g=c?a===`asc`?`ascending`:`descending`:`none`,_;t[5]!==l||t[6]!==c?(_=c?(0,C.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):null,t[5]=l,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==n||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==_?(v=(0,C.jsxs)(`button`,{type:`button`,className:p,onClick:h,"aria-sort":g,children:[n,_]}),t[8]=n,t[9]=p,t[10]=h,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;return t[14]!==o||t[15]!==v?(y=(0,C.jsx)(se,{className:o,children:v}),t[14]=o,t[15]=v,t[16]=y):y=t[16],y}function D(){let e=(0,x.c)(55),t=s(Fe),n=s(Pe),r=s(Ne),i=s(Me),c=s(je),d=s(Ae),f=s(ke),p=s(Oe),{handleDeleteThread:T,refreshWorkspaces:D}=te(),{toast:O}=ee(),[k,Ie]=(0,S.useState)(null),[A,Le]=(0,S.useState)(be),Re=le()?`Finder`:`Explorer`,j,M;e[0]===D?(j=e[1],M=e[2]):(j=()=>{D()},M=[D],e[0]=D,e[1]=j,e[2]=M),(0,S.useEffect)(j,M);let N;e[3]!==n||e[4]!==t||e[5]!==A.column||e[6]!==A.direction?(N=Ee(Te(t),A.column,A.direction,n),e[3]=n,e[4]=t,e[5]=A.column,e[6]=A.direction,e[7]=N):N=e[7];let P=N,F;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){Le(t=>t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:`asc`})},e[8]=F):F=e[8];let ze=F,I;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){let{...t}=e;return(0,C.jsx)(`tr`,{...t,className:m(`group border-0 transition-colors hover:bg-muted/50`,t.className)})},e[9]=I):I=e[9];let Be=I,L;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(L={Table:xe,TableHead:Se,TableBody:Ce,TableRow:Be,Scroller:we},e[10]=L):L=e[10];let Ve=L,R;e[11]!==T||e[12]!==k?(R=function(){if(!k)return;let{projectId:e,threadId:t}=k;Ie(null),T(e,t)},e[11]=T,e[12]=k,e[13]=R):R=e[13];let He=R,z;e[14]===O?z=e[15]:(z=async function(e){try{await re(e.threadId,`.`)}catch{O({title:`Error`,description:`Failed to open folder in ${Re}.`,variant:`destructive`})}},e[14]=O,e[15]=z);let Ue=z,B;e[16]!==n||e[17]!==d||e[18]!==i||e[19]!==Ue||e[20]!==p||e[21]!==c||e[22]!==f?(B=function(e,t){let r=i.includes(t.threadId),s=o(t.threadId,c,f,p),y=d.includes(t.threadId),ee=!s&&!r&&!y,te=w(t.path,n);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{className:ge,children:t.projectName}),(0,C.jsx)(b,{className:_e,children:(0,C.jsx)(`button`,{type:`button`,className:m(a.body,`block w-full truncate text-left hover:underline`),title:`${t.path}\nOpen in ${Re}`,onClick:()=>void Ue(t),children:te})}),(0,C.jsx)(b,{className:ve,children:t.branch}),(0,C.jsx)(b,{className:ye,children:(0,C.jsx)(`div`,{className:`ml-auto flex h-7 w-7 items-center justify-center`,children:r?(0,C.jsx)(u,{className:`h-4 w-4 animate-spin text-muted-foreground`,"aria-label":`Deleting`}):ee?(0,C.jsxs)(v,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsxs)(h,{variant:`ghost`,size:`icon-sm`,className:ce,onClick:e=>{e.stopPropagation(),Ie(t)},children:[(0,C.jsx)(l,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Delete workspace`})]})}),(0,C.jsx)(_,{side:`left`,children:`Delete branch and files from the repo`})]}):null})})]})},e[16]=n,e[17]=d,e[18]=i,e[19]=Ue,e[20]=p,e[21]=c,e[22]=f,e[23]=B):B=e[23];let We=B,V;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=m(`w-full caption-bottom`,de,a.body),e[24]=V):V=e[24];let H,U,W;e[25]!==A.column||e[26]!==A.direction?(H=(0,C.jsx)(E,{label:`Project`,column:`project`,sortColumn:A.column,sortDirection:A.direction,className:fe,onSort:ze}),U=(0,C.jsx)(E,{label:`Path`,column:`path`,sortColumn:A.column,sortDirection:A.direction,className:pe,onSort:ze}),W=(0,C.jsx)(E,{label:`Branch`,column:`branch`,sortColumn:A.column,sortDirection:A.direction,className:me,onSort:ze}),e[25]=A.column,e[26]=A.direction,e[27]=H,e[28]=U,e[29]=W):(H=e[27],U=e[28],W=e[29]);let G;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,C.jsx)(se,{className:he,children:(0,C.jsx)(`span`,{className:`sr-only`,children:`Actions`})}),e[30]=G):G=e[30];let K;e[31]!==H||e[32]!==U||e[33]!==W?(K=(0,C.jsx)(`table`,{className:V,children:(0,C.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,C.jsxs)(`tr`,{children:[H,U,W,G]})})}),e[31]=H,e[32]=U,e[33]=W,e[34]=K):K=e[34];let Ge=K,Ke=P.length>0?Ge:void 0,q;e[35]===Ke?q=e[36]:(q=(0,C.jsx)(ae,{title:`Storage`,description:`Workspaces and branches stored on disk across all projects.`,tableHeader:Ke}),e[35]=Ke,e[36]=q);let J;e[37]!==r||e[38]!==We||e[39]!==P?(J=(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:r&&P.length===0?(0,C.jsx)(y,{label:`Loading workspaces...`,size:`lg`}):P.length===0?(0,C.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,C.jsxs)(`div`,{className:`max-w-md space-y-2 text-center`,children:[(0,C.jsx)(`h3`,{className:a.emptyStateTitle,children:`No workspaces`}),(0,C.jsx)(`p`,{className:a.bodyMuted,children:`No branches or workspaces found yet.`})]})}):(0,C.jsx)(ie,{style:{height:`100%`},data:P,computeItemKey:De,itemContent:We,defaultItemHeight:ue,increaseViewportBy:ue*5,components:Ve})}),e[37]=r,e[38]=We,e[39]=P,e[40]=J):J=e[40];let Y;e[41]!==q||e[42]!==J?(Y=(0,C.jsxs)(ne,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[q,J]}),e[41]=q,e[42]=J,e[43]=Y):Y=e[43];let qe=k!==null,X;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(X=e=>{e||Ie(null)},e[44]=X):X=e[44];let Z;e[45]!==n||e[46]!==k?(Z=k?`Are you sure you want to delete the workspace at "${w(k.path,n)}"? This removes the branch and all its files. This action cannot be undone.`:``,e[45]=n,e[46]=k,e[47]=Z):Z=e[47];let Q;e[48]!==He||e[49]!==qe||e[50]!==Z?(Q=(0,C.jsx)(oe,{open:qe,onOpenChange:X,title:`Delete workspace?`,description:Z,onConfirm:He,confirmLabel:`Delete`,confirmingLabel:`Deleting...`}),e[48]=He,e[49]=qe,e[50]=Z,e[51]=Q):Q=e[51];let $;return e[52]!==Y||e[53]!==Q?($=(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:[Y,Q]}),e[52]=Y,e[53]=Q,e[54]=$):$=e[54],$}function De(e,t){return t.threadId}function Oe(e){return e.pendingChatMessage}function ke(e){return c(e.threadStreamingStates)}function Ae(e){return e.completedThreadIds}function je(e){return e.processingThreadIds}function Me(e){return e.deletingThreadIds}function Ne(e){return e.projectsLoading}function Pe(e){return e.cloneRootPath}function Fe(e){return e.projects}export{D as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{o as i,ot as a}from"./dist-BWuYHVi8.js";import{J as o,U as s,r as c}from"./store-BaMSfYoJ.js";import{D as l,Et as u,In as d,zn as f}from"./dist-DIjomljy.js";import{a as p,t as m}from"./utils-CT-Dw22R.js";import{t as h}from"./button-DeNw35VZ.js";import{i as g,n as _,t as v}from"./tooltip-B6ziVyTv.js";import{n as y}from"./async-loading-fallback-B_JNgWJR.js";import{n as ee}from"./use-toast-xpb5jNtN.js";import{$ as te,Ln as ne,ft as re,hn as ie,kn as ae}from"./index-DjaVbFDB.js";import{t as oe}from"./delete-confirm-dialog-C9NASyh6.js";import{i as se,r as b}from"./table-B3fLagUj.js";import{t as ce}from"./settings-list-DU82HNPX.js";import{t as le}from"./is-macos-client-BIb4ZSEa.js";var x=t(),S=e(n(),1),C=r(),ue=36,de=`table-fixed`,fe=`h-9 w-48 bg-transparent py-2`,pe=`h-9 bg-transparent py-2`,me=`h-9 w-32 bg-transparent py-2`,he=`h-9 w-10 bg-transparent py-2`,ge=m(a.bodyMuted,`w-48 truncate py-1.5`),_e=m(a.body,`truncate py-1.5`),ve=m(a.bodyMuted,`w-32 truncate py-1.5`),ye=`w-10 py-1.5`,be={column:`project`,direction:`asc`};function xe(e){let t=(0,x.c)(4),n;if(t[0]!==e){let{style:r,...i}=e,o;t[2]===r?o=t[3]:(o={...r,width:`100%`},t[2]=r,t[3]=o),n=(0,C.jsx)(`table`,{...i,style:o,className:m(`w-full caption-bottom`,de,a.body,i.className)}),t[0]=e,t[1]=n}else n=t[1];return n}function Se(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`hidden`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`thead`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`[&_tr:last-child]:border-0`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`tbody`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function we(e){let t=(0,x.c)(5),n;t[0]===e.className?n=t[1]:(n=m(`frosted-scrollbar`,e.className),t[0]=e.className,t[1]=n);let r;return t[2]!==e||t[3]!==n?(r=(0,C.jsx)(`div`,{...e,className:n}),t[2]=e,t[3]=n,t[4]=r):r=t[4],r}function w(e,t){return t?i(t,e):e}function T(e,t,n){switch(t){case`project`:return e.projectName;case`path`:return w(e.path,n);case`branch`:return e.branch}}function Te(e){let t=[];for(let n of e){let e=p(n);for(let r of n.threads)t.push({threadId:r.threadId,projectId:n.projectId,projectName:e,path:r.path,branch:r.currentBranch||r.title})}return t}function Ee(e,t,n,r){return[...e].sort((e,i)=>{let a=T(e,t,r).localeCompare(T(i,t,r),void 0,{sensitivity:`base`});return n===`asc`?a:-a})}function E(e){let t=(0,x.c)(17),{label:n,column:r,sortColumn:i,sortDirection:a,className:o,onSort:s}=e,c=i===r,l=a===`asc`?d:f,u=c?`text-foreground`:`text-muted-foreground`,p;t[0]===u?p=t[1]:(p=m(`inline-flex items-center gap-1 transition-colors hover:text-foreground`,u),t[0]=u,t[1]=p);let h;t[2]!==r||t[3]!==s?(h=()=>s(r),t[2]=r,t[3]=s,t[4]=h):h=t[4];let g=c?a===`asc`?`ascending`:`descending`:`none`,_;t[5]!==l||t[6]!==c?(_=c?(0,C.jsx)(l,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":`true`}):null,t[5]=l,t[6]=c,t[7]=_):_=t[7];let v;t[8]!==n||t[9]!==p||t[10]!==h||t[11]!==g||t[12]!==_?(v=(0,C.jsxs)(`button`,{type:`button`,className:p,onClick:h,"aria-sort":g,children:[n,_]}),t[8]=n,t[9]=p,t[10]=h,t[11]=g,t[12]=_,t[13]=v):v=t[13];let y;return t[14]!==o||t[15]!==v?(y=(0,C.jsx)(se,{className:o,children:v}),t[14]=o,t[15]=v,t[16]=y):y=t[16],y}function D(){let e=(0,x.c)(55),t=c(Fe),n=c(Pe),r=c(Ne),i=c(Me),s=c(je),d=c(Ae),f=c(ke),p=c(Oe),{handleDeleteThread:T,refreshWorkspaces:D}=te(),{toast:O}=ee(),[k,Ie]=(0,S.useState)(null),[A,Le]=(0,S.useState)(be),Re=le()?`Finder`:`Explorer`,j,M;e[0]===D?(j=e[1],M=e[2]):(j=()=>{D()},M=[D],e[0]=D,e[1]=j,e[2]=M),(0,S.useEffect)(j,M);let N;e[3]!==n||e[4]!==t||e[5]!==A.column||e[6]!==A.direction?(N=Ee(Te(t),A.column,A.direction,n),e[3]=n,e[4]=t,e[5]=A.column,e[6]=A.direction,e[7]=N):N=e[7];let P=N,F;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(F=function(e){Le(t=>t.column===e?{column:e,direction:t.direction===`asc`?`desc`:`asc`}:{column:e,direction:`asc`})},e[8]=F):F=e[8];let ze=F,I;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){let{...t}=e;return(0,C.jsx)(`tr`,{...t,className:m(`group border-0 transition-colors hover:bg-muted/50`,t.className)})},e[9]=I):I=e[9];let Be=I,L;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(L={Table:xe,TableHead:Se,TableBody:Ce,TableRow:Be,Scroller:we},e[10]=L):L=e[10];let Ve=L,R;e[11]!==T||e[12]!==k?(R=function(){if(!k)return;let{projectId:e,threadId:t}=k;Ie(null),T(e,t)},e[11]=T,e[12]=k,e[13]=R):R=e[13];let He=R,z;e[14]===O?z=e[15]:(z=async function(e){try{await re(e.threadId,`.`)}catch{O({title:`Error`,description:`Failed to open folder in ${Re}.`,variant:`destructive`})}},e[14]=O,e[15]=z);let Ue=z,B;e[16]!==n||e[17]!==d||e[18]!==i||e[19]!==Ue||e[20]!==p||e[21]!==s||e[22]!==f?(B=function(e,t){let r=i.includes(t.threadId),c=o(t.threadId,s,f,p),y=d.includes(t.threadId),ee=!c&&!r&&!y,te=w(t.path,n);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(b,{className:ge,children:t.projectName}),(0,C.jsx)(b,{className:_e,children:(0,C.jsx)(`button`,{type:`button`,className:m(a.body,`block w-full truncate text-left hover:underline`),title:`${t.path}\nOpen in ${Re}`,onClick:()=>void Ue(t),children:te})}),(0,C.jsx)(b,{className:ve,children:t.branch}),(0,C.jsx)(b,{className:ye,children:(0,C.jsx)(`div`,{className:`ml-auto flex h-7 w-7 items-center justify-center`,children:r?(0,C.jsx)(u,{className:`h-4 w-4 animate-spin text-muted-foreground`,"aria-label":`Deleting`}):ee?(0,C.jsxs)(v,{children:[(0,C.jsx)(g,{asChild:!0,children:(0,C.jsxs)(h,{variant:`ghost`,size:`icon-sm`,className:ce,onClick:e=>{e.stopPropagation(),Ie(t)},children:[(0,C.jsx)(l,{}),(0,C.jsx)(`span`,{className:`sr-only`,children:`Delete workspace`})]})}),(0,C.jsx)(_,{side:`left`,children:`Delete branch and files from the repo`})]}):null})})]})},e[16]=n,e[17]=d,e[18]=i,e[19]=Ue,e[20]=p,e[21]=s,e[22]=f,e[23]=B):B=e[23];let We=B,V;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=m(`w-full caption-bottom`,de,a.body),e[24]=V):V=e[24];let H,U,W;e[25]!==A.column||e[26]!==A.direction?(H=(0,C.jsx)(E,{label:`Project`,column:`project`,sortColumn:A.column,sortDirection:A.direction,className:fe,onSort:ze}),U=(0,C.jsx)(E,{label:`Path`,column:`path`,sortColumn:A.column,sortDirection:A.direction,className:pe,onSort:ze}),W=(0,C.jsx)(E,{label:`Branch`,column:`branch`,sortColumn:A.column,sortDirection:A.direction,className:me,onSort:ze}),e[25]=A.column,e[26]=A.direction,e[27]=H,e[28]=U,e[29]=W):(H=e[27],U=e[28],W=e[29]);let G;e[30]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,C.jsx)(se,{className:he,children:(0,C.jsx)(`span`,{className:`sr-only`,children:`Actions`})}),e[30]=G):G=e[30];let K;e[31]!==H||e[32]!==U||e[33]!==W?(K=(0,C.jsx)(`table`,{className:V,children:(0,C.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,C.jsxs)(`tr`,{children:[H,U,W,G]})})}),e[31]=H,e[32]=U,e[33]=W,e[34]=K):K=e[34];let Ge=K,Ke=P.length>0?Ge:void 0,q;e[35]===Ke?q=e[36]:(q=(0,C.jsx)(ae,{title:`Storage`,description:`Workspaces and branches stored on disk across all projects.`,tableHeader:Ke}),e[35]=Ke,e[36]=q);let J;e[37]!==r||e[38]!==We||e[39]!==P?(J=(0,C.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:r&&P.length===0?(0,C.jsx)(y,{label:`Loading workspaces...`,size:`lg`}):P.length===0?(0,C.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,C.jsxs)(`div`,{className:`max-w-md space-y-2 text-center`,children:[(0,C.jsx)(`h3`,{className:a.emptyStateTitle,children:`No workspaces`}),(0,C.jsx)(`p`,{className:a.bodyMuted,children:`No branches or workspaces found yet.`})]})}):(0,C.jsx)(ie,{style:{height:`100%`},data:P,computeItemKey:De,itemContent:We,defaultItemHeight:ue,increaseViewportBy:ue*5,components:Ve})}),e[37]=r,e[38]=We,e[39]=P,e[40]=J):J=e[40];let Y;e[41]!==q||e[42]!==J?(Y=(0,C.jsxs)(ne,{className:`flex w-full max-w-none min-w-0 min-h-0 flex-1 flex-col pb-0 pt-0`,children:[q,J]}),e[41]=q,e[42]=J,e[43]=Y):Y=e[43];let qe=k!==null,X;e[44]===Symbol.for(`react.memo_cache_sentinel`)?(X=e=>{e||Ie(null)},e[44]=X):X=e[44];let Z;e[45]!==n||e[46]!==k?(Z=k?`Are you sure you want to delete the workspace at "${w(k.path,n)}"? This removes the branch and all its files. This action cannot be undone.`:``,e[45]=n,e[46]=k,e[47]=Z):Z=e[47];let Q;e[48]!==He||e[49]!==qe||e[50]!==Z?(Q=(0,C.jsx)(oe,{open:qe,onOpenChange:X,title:`Delete workspace?`,description:Z,onConfirm:He,confirmLabel:`Delete`,confirmingLabel:`Deleting...`}),e[48]=He,e[49]=qe,e[50]=Z,e[51]=Q):Q=e[51];let $;return e[52]!==Y||e[53]!==Q?($=(0,C.jsxs)(`div`,{className:`flex h-full min-h-0 w-full min-w-0 flex-1 flex-col`,children:[Y,Q]}),e[52]=Y,e[53]=Q,e[54]=$):$=e[54],$}function De(e,t){return t.threadId}function Oe(e){return e.pendingChatMessage}function ke(e){return s(e.threadStreamingStates)}function Ae(e){return e.completedThreadIds}function je(e){return e.processingThreadIds}function Me(e){return e.deletingThreadIds}function Ne(e){return e.projectsLoading}function Pe(e){return e.cloneRootPath}function Fe(e){return e.projects}export{D as default};
@@ -1,2 +1,2 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{at as r}from"./dist-ZlK7I-y-.js";import{S as i}from"./dist-DIjomljy.js";import{t as a}from"./utils-CT-Dw22R.js";import{t as o}from"./button-sfGyFWfz.js";import{bn as s,qn as c,tr as l,w as u}from"./api-ODizoHnY.js";import{t as d}from"./use-toast-xpb5jNtN.js";import{r as f,t as p}from"./dialog-CP2cYR59.js";import{Bn as m,Dn as h,En as g,Ft as _,In as v,Ln as y,Nn as b,On as x,Y as S,kn as C,zn as w}from"./index-Bmkj1Qwa.js";import{t as T}from"./delete-confirm-dialog-B99gEJN8.js";import{t as E}from"./use-settings-page-loading-BTySlInF.js";import{a as D,i as O,o as k,r as A}from"./settings-list-PMi8ZniW.js";import{a as j,i as M,r as N,t as P}from"./mcp-server-card-DPNG9Up7.js";import{t as F}from"./use-installed-ai-files-BNrsyACe.js";var I=e(t(),1),L=n();function R({threadId:e,onAgentCreated:t}){let[n,i]=(0,I.useState)(``),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[f,p]=(0,I.useState)(!1),m=M(n),y=N(m),b=async()=>{if(!(!y||!o.trim()||!e)){p(!0);try{let n=await u(e,m,o.trim(),c.trim()||void 0);d({title:`Agent created`,description:`Agent '${m}' was created successfully.`}),i(``),s(``),l(``),t?.(n.path,`AGENTS.md`)}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{p(!1)}}};return e?(0,L.jsx)(w,{children:(0,L.jsxs)(g,{children:[(0,L.jsx)(C,{title:`Add Agent`,description:`Saved as AGENT.md in .agents/agents.`,sticky:!0,className:`pr-10`}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(h,{title:`Agent Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,L.jsx)(_,{id:`agentName`,value:n,onChange:e=>i(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:f}),n?(0,L.jsxs)(`p`,{className:a(r.caption,`mt-2`),children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:m||`...`})]}):null]}),(0,L.jsx)(h,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,L.jsx)(S,{id:`agentDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:f})}),(0,L.jsx)(h,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,controlLayout:`stack`,className:`pt-6`,children:(0,L.jsx)(_,{id:`agentTools`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:f})}),(0,L.jsx)(j,{onContinue:()=>void b(),disabled:!y||!o.trim(),creating:f})]})]})}):(0,L.jsx)(v,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:u,deleteConfirm:h,setDeleteConfirm:g,deleting:_,installedFilePaths:S,setInstalledFilePaths:w,loadItems:j,handleDelete:M,handleOpenInExplorer:N,triggerExplorerRefresh:B}=F({findItems:z,installedPathSuffix:`/AGENT.md`,explorerPathSuffix:`/AGENT.md`,sortByName:!0,removedToastTitle:`Agent removed`}),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)([]),[G,K]=(0,I.useState)(!0),[q,J]=(0,I.useState)(``);(0,I.useEffect)(()=>{K(!0),c().then(W).catch(()=>W([])).finally(()=>K(!1))},[]);let Y=E(e?`${e}:${t??``}`:null,[u,G]),X=(0,I.useCallback)(async e=>{let n=`.agents/agents/${e.id}/AGENT.md`;if(!(!t||S.has(n)))try{if(e.gitHubRepo&&e.gitHubFolder)await l(t,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await s(t,n,r.join(`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{S as i}from"./dist-DIjomljy.js";import{t as a}from"./utils-CT-Dw22R.js";import{t as o}from"./button-DeNw35VZ.js";import{Jn as s,bn as c,nr as l,w as u}from"./api-BMo_Lz8f.js";import{t as d}from"./use-toast-xpb5jNtN.js";import{r as f,t as p}from"./dialog-Do98zzAW.js";import{Bn as m,Dn as h,En as g,Ft as _,In as v,Ln as y,Nn as b,On as x,Y as S,kn as C,zn as w}from"./index-DjaVbFDB.js";import{t as T}from"./delete-confirm-dialog-C9NASyh6.js";import{t as E}from"./use-settings-page-loading-BTySlInF.js";import{a as D,i as O,o as k,r as A}from"./settings-list-DU82HNPX.js";import{a as j,i as M,r as N,t as P}from"./mcp-server-card-zm-ss-7h.js";import{t as F}from"./use-installed-ai-files-E4BAFIPG.js";var I=e(t(),1),L=n();function R({threadId:e,onAgentCreated:t}){let[n,i]=(0,I.useState)(``),[o,s]=(0,I.useState)(``),[c,l]=(0,I.useState)(``),[f,p]=(0,I.useState)(!1),m=M(n),y=N(m),b=async()=>{if(!(!y||!o.trim()||!e)){p(!0);try{let n=await u(e,m,o.trim(),c.trim()||void 0);d({title:`Agent created`,description:`Agent '${m}' was created successfully.`}),i(``),s(``),l(``),t?.(n.path,`AGENTS.md`)}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{p(!1)}}};return e?(0,L.jsx)(w,{children:(0,L.jsxs)(g,{children:[(0,L.jsx)(C,{title:`Add Agent`,description:`Saved as AGENT.md in .agents/agents.`,sticky:!0,className:`pr-10`}),(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(h,{title:`Agent Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,L.jsx)(_,{id:`agentName`,value:n,onChange:e=>i(e.target.value),placeholder:`e.g. Code Reviewer`,disabled:f}),n?(0,L.jsxs)(`p`,{className:a(r.caption,`mt-2`),children:[`Folder name: `,(0,L.jsx)(`span`,{className:`font-mono`,children:m||`...`})]}):null]}),(0,L.jsx)(h,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,L.jsx)(S,{id:`agentDescription`,value:o,onChange:e=>s(e.target.value),placeholder:`Describe the agent's purpose and behavior...`,className:`resize-none min-h-[120px]`,disabled:f})}),(0,L.jsx)(h,{title:`Tools`,description:`Optional space-separated list of tools this agent can use`,controlLayout:`stack`,className:`pt-6`,children:(0,L.jsx)(_,{id:`agentTools`,value:c,onChange:e=>l(e.target.value),placeholder:`e.g. read grep glob`,disabled:f})}),(0,L.jsx)(j,{onContinue:()=>void b(),disabled:!y||!o.trim(),creating:f})]})]})}):(0,L.jsx)(v,{title:`No thread selected`,children:`Please select a thread to add an agent.`})}function z(e){let t=[];for(let n of e)n.path.startsWith(`.agents/agents/`)&&n.type===`folder`&&t.push(n),n.children&&n.children.length>0&&t.push(...z(n.children));return t}function B(){let{selectedProjectId:e,selectedThreadId:t,items:n,loading:u,deleteConfirm:h,setDeleteConfirm:g,deleting:_,installedFilePaths:S,setInstalledFilePaths:w,loadItems:j,handleDelete:M,handleOpenInExplorer:N,triggerExplorerRefresh:B}=F({findItems:z,installedPathSuffix:`/AGENT.md`,explorerPathSuffix:`/AGENT.md`,sortByName:!0,removedToastTitle:`Agent removed`}),[V,H]=(0,I.useState)(!1),[U,W]=(0,I.useState)([]),[G,K]=(0,I.useState)(!0),[q,J]=(0,I.useState)(``);(0,I.useEffect)(()=>{K(!0),s().then(W).catch(()=>W([])).finally(()=>K(!1))},[]);let Y=E(e?`${e}:${t??``}`:null,[u,G]),X=(0,I.useCallback)(async e=>{let n=`.agents/agents/${e.id}/AGENT.md`;if(!(!t||S.has(n)))try{if(e.gitHubRepo&&e.gitHubFolder)await l(t,e.gitHubRepo,e.gitHubFolder,`.agents/agents/${e.id}`);else{let r=[`---`,`name: ${e.id}`,`description: ${e.description}`];e.tools&&r.push(`tools: ${e.tools}`),r.push(`---`,``,e.systemPrompt),await c(t,n,r.join(`
2
2
  `))}w(e=>new Set(e).add(n)),B(),j(),d({title:`Agent installed`,description:e.name})}catch(e){d({title:`Error`,description:e instanceof Error?e.message:`Failed to install agent`,variant:`destructive`})}},[t,S,B,j]),Z=q.trim()?U.filter(e=>e.name.toLowerCase().includes(q.toLowerCase())||e.description.toLowerCase().includes(q.toLowerCase())):U;return e?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(b,{loading:Y,children:[(0,L.jsxs)(m,{className:`shrink-0`,children:[(0,L.jsx)(C,{title:`Installed Subagents`,description:`Specialized agents for focused tasks in this project.`,action:(0,L.jsx)(o,{onClick:()=>H(!0),disabled:!t,children:`Add Subagent`}),sticky:!1}),(0,L.jsxs)(y,{className:`pt-6`,children:[!t&&(0,L.jsx)(x,{children:`Select a thread to add or install subagents.`}),(0,L.jsx)(A,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:{icon:i,title:`No subagents installed`,description:`Add subagents for specialized, focused tasks.`,bordered:!1},getKey:e=>e.id,renderContent:e=>(0,L.jsx)(`span`,{className:a(r.body,`truncate text-left`),children:e.name}),onItemClick:e=>N(e.path),itemClickLabel:e=>`Open ${e.name} in Files`,onDelete:g,deleteAriaLabel:e=>`Delete ${e.name}`,deleteTooltip:`Remove this subagent from the project`})]})]}),(0,L.jsxs)(m,{className:`shrink-0`,children:[(0,L.jsx)(C,{title:`Available Subagents`,description:`Browse and install subagents from the catalog.`,action:(0,L.jsx)(k,{placeholder:`Search`,value:q,onChange:J,className:`mb-0 w-64`}),sticky:!1}),(0,L.jsx)(y,{className:`pt-6`,children:Z.length===0?(0,L.jsx)(D,{searchQuery:q,emptyLabel:`No available subagents found.`}):(0,L.jsx)(O,{children:Z.map(e=>{let t=`.agents/agents/${e.id}/AGENT.md`,n=S.has(t);return(0,L.jsx)(P,{className:`bg-background hover:bg-background`,name:e.name,description:e.description,installed:n,onClick:()=>{n||X(e)},showInstalledControls:!1},e.id)})})})]})]}),(0,L.jsx)(p,{open:V,onOpenChange:H,children:(0,L.jsx)(f,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,L.jsx)(R,{threadId:t,onAgentCreated:()=>{H(!1),j(),B()}})})}),(0,L.jsx)(T,{open:h!==null,onOpenChange:e=>!e&&g(null),title:`Delete Subagent`,description:`Are you sure you want to delete the subagent "${h?.name}"? This action cannot be undone.`,onConfirm:()=>{h&&M(h)},confirming:_})]}):(0,L.jsx)(v,{children:`Select a project to manage subagents.`})}export{B as SettingsSubagentsView,B as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{at as r}from"./dist-ZlK7I-y-.js";import{r as i}from"./store-Be_7VK0D.js";import{Et as a}from"./dist-DIjomljy.js";import{t as o}from"./utils-CT-Dw22R.js";import{t as s}from"./button-sfGyFWfz.js";import{Ct as c,Rn as l,qt as ee}from"./api-ODizoHnY.js";import{i as u,n as d,t as f}from"./tooltip-B6ziVyTv.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./alert-dialog-FQ5_FqBX.js";import{In as S,Ln as C,Mn as w,Y as T,jn as E,kn as D,vt as O}from"./index-Bmkj1Qwa.js";import{t as k}from"./use-settings-page-loading-BTySlInF.js";var A=e(t(),1),j=n();function M(){let e=i(e=>e.selectedProjectId),[t,n]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[P,F]=(0,A.useState)(!0),[I,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(!0),[H,U]=(0,A.useState)(!1),[W,G]=(0,A.useState)(!1);(0,A.useLayoutEffect)(()=>{e&&V(!0)},[e]),(0,A.useEffect)(()=>{if(!e){V(!1);return}V(!0),c(e).then(e=>{let t=e.useCustomSystemPrompt;n(e.generatedPrompt),L(t),z(e.customSystemPrompt),F(!t),N(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{n(``),N(``),F(!0),L(!1),z(``)}).finally(()=>V(!1))},[e]);let K=k(e,[B]);function q(){return P?I:M.trim()!==R.trim()}function J(e){N(e),P&&F(!1)}function Y(){N(t),F(!0)}function X(e){if(!e){F(!1);return}if(M===t){Y();return}G(!0)}function Z(){Y(),G(!1)}function Q(){G(!1)}async function $(){if(e){if(!P&&!M.trim()){p({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}U(!0);try{await l(e,{customSystemPrompt:P?null:M.trim(),useCustomSystemPrompt:!P}),ee(),L(!P),z(P?``:M.trim()),p({title:`System prompt settings saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{U(!1)}}}return e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{loading:K,children:(0,j.jsx)(E,{children:(0,j.jsxs)(C,{className:`w-full flex-1 flex flex-col min-h-0 pt-0`,children:[(0,j.jsx)(D,{title:`System Prompt`,description:`View the default system prompt or override it for this project.`,sticky:!1,action:(0,j.jsx)(s,{onClick:$,disabled:H||!q(),children:H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,j.jsxs)(`div`,{className:`mb-4 flex w-full items-center justify-end gap-2`,children:[(0,j.jsxs)(f,{children:[(0,j.jsx)(u,{asChild:!0,children:(0,j.jsx)(`span`,{tabIndex:0,className:o(r.label,`cursor-help`),children:`Generated`})}),(0,j.jsx)(d,{side:`top`,className:`max-w-xs`,children:`Use the auto-generated system prompt instead of a custom override.`})]}),(0,j.jsx)(O,{value:P,onChange:X,disabled:H,ariaLabel:`Generated system prompt`})]}),(0,j.jsx)(T,{value:M,onChange:e=>J(e.target.value),className:o(r.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:H})]})})}),(0,j.jsx)(x,{open:W,onOpenChange:G,children:(0,j.jsxs)(g,{children:[(0,j.jsxs)(b,{children:[(0,j.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,j.jsx)(m,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,j.jsxs)(v,{children:[(0,j.jsx)(y,{onClick:Q,children:`No`}),(0,j.jsx)(_,{onClick:Z,children:`Yes`})]})]})})]}):(0,j.jsx)(S,{children:`Select a project to edit the system prompt.`})}export{M as SettingsSystemPromptView,M as default};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{r as i}from"./store-BaMSfYoJ.js";import{Et as a}from"./dist-DIjomljy.js";import{t as o}from"./utils-CT-Dw22R.js";import{t as s}from"./button-DeNw35VZ.js";import{Ct as c,qt as l,zn as ee}from"./api-BMo_Lz8f.js";import{i as u,n as d,t as f}from"./tooltip-B6ziVyTv.js";import{t as p}from"./use-toast-xpb5jNtN.js";import{a as m,c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./alert-dialog-Cb1PEgra.js";import{In as S,Ln as C,Mn as w,Y as T,jn as E,kn as D,vt as O}from"./index-DjaVbFDB.js";import{t as k}from"./use-settings-page-loading-BTySlInF.js";var A=e(t(),1),j=n();function M(){let e=i(e=>e.selectedProjectId),[t,n]=(0,A.useState)(``),[M,N]=(0,A.useState)(``),[P,F]=(0,A.useState)(!0),[I,L]=(0,A.useState)(!1),[R,z]=(0,A.useState)(``),[B,V]=(0,A.useState)(!0),[H,U]=(0,A.useState)(!1),[W,G]=(0,A.useState)(!1);(0,A.useLayoutEffect)(()=>{e&&V(!0)},[e]),(0,A.useEffect)(()=>{if(!e){V(!1);return}V(!0),c(e).then(e=>{let t=e.useCustomSystemPrompt;n(e.generatedPrompt),L(t),z(e.customSystemPrompt),F(!t),N(t?e.customSystemPrompt:e.generatedPrompt)}).catch(()=>{n(``),N(``),F(!0),L(!1),z(``)}).finally(()=>V(!1))},[e]);let K=k(e,[B]);function q(){return P?I:M.trim()!==R.trim()}function J(e){N(e),P&&F(!1)}function Y(){N(t),F(!0)}function X(e){if(!e){F(!1);return}if(M===t){Y();return}G(!0)}function Z(){Y(),G(!1)}function Q(){G(!1)}async function $(){if(e){if(!P&&!M.trim()){p({title:`System prompt required`,description:`Enter a system prompt or enable Generated.`,variant:`destructive`});return}U(!0);try{await ee(e,{customSystemPrompt:P?null:M.trim(),useCustomSystemPrompt:!P}),l(),L(!P),z(P?``:M.trim()),p({title:`System prompt settings saved`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save system prompt settings`,variant:`destructive`})}finally{U(!1)}}}return e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(w,{loading:K,children:(0,j.jsx)(E,{children:(0,j.jsxs)(C,{className:`w-full flex-1 flex flex-col min-h-0 pt-0`,children:[(0,j.jsx)(D,{title:`System Prompt`,description:`View the default system prompt or override it for this project.`,sticky:!1,action:(0,j.jsx)(s,{onClick:$,disabled:H||!q(),children:H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})}),(0,j.jsxs)(`div`,{className:`mb-4 flex w-full items-center justify-end gap-2`,children:[(0,j.jsxs)(f,{children:[(0,j.jsx)(u,{asChild:!0,children:(0,j.jsx)(`span`,{tabIndex:0,className:o(r.label,`cursor-help`),children:`Generated`})}),(0,j.jsx)(d,{side:`top`,className:`max-w-xs`,children:`Use the auto-generated system prompt instead of a custom override.`})]}),(0,j.jsx)(O,{value:P,onChange:X,disabled:H,ariaLabel:`Generated system prompt`})]}),(0,j.jsx)(T,{value:M,onChange:e=>J(e.target.value),className:o(r.mono,`flex-1 min-h-0 resize-none`),placeholder:`System prompt will appear here...`,disabled:H})]})})}),(0,j.jsx)(x,{open:W,onOpenChange:G,children:(0,j.jsxs)(g,{children:[(0,j.jsxs)(b,{children:[(0,j.jsx)(h,{children:`Overwrite custom system prompt?`}),(0,j.jsx)(m,{children:`This will replace your custom system prompt with the generated default. You can save the change after confirming.`})]}),(0,j.jsxs)(v,{children:[(0,j.jsx)(y,{onClick:Q,children:`No`}),(0,j.jsx)(_,{onClick:Z,children:`Yes`})]})]})})]}):(0,j.jsx)(S,{children:`Select a project to edit the system prompt.`})}export{M as SettingsSystemPromptView,M as default};