tarsk 0.4.19 → 0.4.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +140 -19
- package/dist/public/assets/{account-view-Bbhl_jIc.js → account-view-D1kGyryt.js} +1 -1
- package/dist/public/assets/alert-dialog-Bk7neo_n.js +1 -0
- package/dist/public/assets/{api-B28NOxKR.js → api-DL5XaoTS.js} +1 -1
- package/dist/public/assets/browser-tab-BUOT-D_w.js +1 -0
- package/dist/public/assets/chat-input-container-2a99CMGs.js +1 -0
- package/dist/public/assets/{context-menu-Bs2ogSXU.js → context-menu-DHHElhQ1.js} +1 -1
- package/dist/public/assets/conversation-history-view-HVFzgO9e.js +1 -0
- package/dist/public/assets/{dialogs-config-D3xml4W2.js → dialogs-config-DmDjliuA.js} +6 -6
- package/dist/public/assets/diff-view-DXIv51Tn.js +3 -0
- package/dist/public/assets/{dist-OF8pavjm.js → dist-CIGnaqp2.js} +7 -7
- package/dist/public/assets/explorer-tab-view-tyn_6pBh.js +2 -0
- package/dist/public/assets/explorer-tree-DOg67ane.js +1 -0
- package/dist/public/assets/explorer-view-Bw3-gTSX.js +1 -0
- package/dist/public/assets/history-view-BOjZoBCb.js +1 -0
- package/dist/public/assets/index-BPF49zet.css +1 -0
- package/dist/public/assets/index-DAw9BEzt.js +50 -0
- package/dist/public/assets/onboarding-BgEjTEKs.js +1 -0
- package/dist/public/assets/onboarding-dialog-EiVl-ynw.js +1 -0
- package/dist/public/assets/page-toolbar-CvreDTwj.js +1 -0
- package/dist/public/assets/{project-settings-view-BsGGUbat.js → project-settings-view-BJYR_l3u.js} +1 -1
- package/dist/public/assets/provider-details-view-B1eTEo0M.js +1 -0
- package/dist/public/assets/providers-sidebar-Df50eL_5.js +1 -0
- package/dist/public/assets/react-vendor-CaS5zjF7.js +17 -0
- package/dist/public/assets/resizable-DJ5w1ZWX.js +1 -0
- package/dist/public/assets/run-stop-button-iZHomql0.js +2 -0
- package/dist/public/assets/settings-view-C38jeeqJ.js +2 -0
- package/dist/public/assets/side-panel-container-BqWSTCOr.js +2 -0
- package/dist/public/assets/standard-list-item-CpBjveM0.js +1 -0
- package/dist/public/assets/store-CAPnOXso.js +2 -0
- package/dist/public/assets/{tab-context-CnzSKG0L.js → tab-context-Bmd79Rk0.js} +1 -1
- package/dist/public/assets/tabs-DEmnnGvq.js +1 -0
- package/dist/public/assets/{terminal-panel-BhJSKgOW.js → terminal-panel-r8cb3-tk.js} +1 -1
- package/dist/public/assets/{textarea-C1e4J_5m.js → textarea-BjfyGfGR.js} +1 -1
- package/dist/public/assets/todos-view-MAb840dD.js +1 -0
- package/dist/public/assets/{use-toast-BZ7ir6gB.js → use-toast-C9B1H3P9.js} +1 -1
- package/dist/public/assets/{utils-CLxr_0Ql.js → utils-BG_JNnOl.js} +1 -1
- package/dist/public/index.html +20 -12
- package/package.json +16 -16
- package/dist/public/assets/browser-tab-os7ReSAI.js +0 -1
- package/dist/public/assets/conversation-history-view-DjyJh65Y.js +0 -1
- package/dist/public/assets/diff-view-702Bpg9H.js +0 -3
- package/dist/public/assets/explorer-tab-view-BvmxzUAs.js +0 -2
- package/dist/public/assets/explorer-tree-mCR_Wwfz.js +0 -1
- package/dist/public/assets/explorer-view-BN9RAXjq.js +0 -1
- package/dist/public/assets/history-view-BnRtfSte.js +0 -1
- package/dist/public/assets/index-BQ391mCU.css +0 -1
- package/dist/public/assets/index-CSGl7zru.js +0 -51
- package/dist/public/assets/onboarding-dialog-Ic62dkfi.js +0 -1
- package/dist/public/assets/onboarding-eQed-ZzK.js +0 -1
- package/dist/public/assets/provider-details-view-Di1Hw9Bi.js +0 -1
- package/dist/public/assets/providers-sidebar-klkFVN5y.js +0 -1
- package/dist/public/assets/react-vendor-DcsTuVun.js +0 -17
- package/dist/public/assets/settings-view-CF-gBfNl.js +0 -2
- package/dist/public/assets/store-erJP4KTe.js +0 -2
- package/dist/public/assets/todos-view-BtDv09d6.js +0 -1
- /package/dist/public/assets/{monaco-DvsnxTfD.js → monaco-c-HyCuEi.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,$i as n,Bn as r,C as i,Cr as a,Ct as o,Er as s,Fi as c,Gn as l,Gt as u,Hn as d,Ii as f,Ji as p,K as m,Nn as h,Pi as g,Pn as _,Ri as v,Rn as y,Sr as b,T as x,Tr as S,Un as C,Vn as w,W as T,Wn as E,cr as D,hi as O,hr as k,ia as A,kn as ee,la as te,oa as j,rn as ne,sa as M,vi as N,yr as P,zn as re}from"./dialogs-config-DmDjliuA.js";import{_ as ie,a as F,c as I,i as L,l as R,n as z,o as B,r as V,s as H,u as U}from"./history-view-BOjZoBCb.js";var W=e(te(),1),G=M(),K=a();function q(e){if(!e)return`Unknown Model`;let t=(e.split(`/`).filter(Boolean).pop()??e).replace(/[-_]+/g,` `).trim();return t?t.split(/\s+/g).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `):e}var J=`Checkbox`,[ae,oe]=b(J),[se,Y]=ae(J);function ce(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=P({prop:n,defaultProp:i??!1,onChange:c,caller:J}),[m,h]=W.useState(null),[g,_]=W.useState(null),v=W.useRef(!1),y=m?!!o||!!m.closest(`form`):!0,b={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,required:l,defaultChecked:Q(i)?!1:i,isFormControl:y,bubbleInput:g,setBubbleInput:_};return(0,K.jsx)(se,{scope:t,...b,children:me(d)?d(b):r})}var X=`CheckboxTrigger`,le=W.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:c,checked:l,required:u,setControl:d,setChecked:f,hasConsumerStoppedPropagationRef:p,isFormControl:m,bubbleInput:h}=Y(X,e),g=S(i,d),_=W.useRef(l);return W.useEffect(()=>{let e=a?.form;if(e){let t=()=>f(_.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,f]),(0,K.jsx)(k.button,{type:`button`,role:`checkbox`,"aria-checked":Q(l)?`mixed`:l,"aria-required":u,"data-state":he(l),"data-disabled":c?``:void 0,disabled:c,value:o,...r,ref:g,onKeyDown:s(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:s(n,e=>{f(e=>Q(e)?!0:!e),h&&m&&(p.current=e.isPropagationStopped(),p.current||e.stopPropagation())})})});le.displayName=X;var Z=W.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,K.jsx)(ce,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(le,{...d,ref:t,__scopeCheckbox:n}),e&&(0,K.jsx)(pe,{__scopeCheckbox:n})]})})});Z.displayName=J;var ue=`CheckboxIndicator`,de=W.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Y(ue,n);return(0,K.jsx)(D,{present:r||Q(a.checked)||a.checked===!0,children:(0,K.jsx)(k.span,{"data-state":he(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});de.displayName=ue;var fe=`CheckboxBubbleInput`,pe=W.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Y(fe,e),m=S(n,p),h=B(a),g=ie(r);W.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Q(a),n.call(e,Q(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let _=W.useRef(Q(a)?!1:a);return(0,K.jsx)(k.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??_.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});pe.displayName=fe;function me(e){return typeof e==`function`}function Q(e){return e===`indeterminate`}function he(e){return Q(e)?`indeterminate`:e?`checked`:`unchecked`}var $=W.forwardRef((e,t)=>{let r=(0,G.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=E(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,i),r[3]=i,r[4]=o);let s;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(de,{className:E(`flex items-center justify-center text-current`),children:(0,K.jsx)(n,{className:`h-4 w-4`})}),r[5]=s):s=r[5];let c;return r[6]!==a||r[7]!==t||r[8]!==o?(c=(0,K.jsx)(Z,{ref:t,className:o,...a,children:s}),r[6]=a,r[7]=t,r[8]=o,r[9]=c):c=r[9],c});$.displayName=Z.displayName;function ge({selectedProvider:e,onProviderChange:t,showApiKeyInput:n=!0,onApiKeyChange:r,isLoading:i,error:a,variant:s=`dropdown`}){let[c,l]=(0,W.useState)([]),[d,p]=(0,W.useState)(!1),m=async e=>{try{await u(e)}catch(e){console.error(`Failed to open provider website:`,e)}};return(0,W.useEffect)(()=>{(async()=>{p(!0);try{let n=await o();l(n),n.length>0&&!e&&t(n[0])}catch(e){console.error(`Failed to load providers:`,e)}finally{p(!1)}})()},[e,t]),d?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-4`,children:(0,K.jsx)(O,{className:`h-4 w-4 animate-spin text-muted-foreground`})}):s===`dropdown`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a&&(0,K.jsx)(`p`,{className:`text-sm text-destructive`,children:a}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(`label`,{className:`text-sm font-medium`,children:`AI Provider`}),(0,K.jsxs)(z,{value:e?.name??``,onValueChange:e=>{let n=c.find(t=>t.name===e);n&&t(n)},children:[(0,K.jsx)(F,{children:e?e.name:`Select a provider`}),(0,K.jsx)(V,{children:c.map(e=>(0,K.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}),e?.url&&(0,K.jsx)(R,{children:(0,K.jsxs)(H,{children:[(0,K.jsx)(U,{asChild:!0,children:(0,K.jsxs)(_,{variant:`ghost`,size:`sm`,onClick:()=>m(e.url),className:`flex items-center gap-1 text-sm text-brand h-auto p-0`,children:[`Visit provider website `,(0,K.jsx)(f,{className:`h-3.5 w-3.5`})]})}),(0,K.jsx)(I,{children:(0,K.jsx)(`p`,{children:e.url})})]})}),n&&e&&(0,K.jsx)(_e,{provider:e,value:e.apiKey??``,onChange:r,isLoading:i})]}):null}function _e(e){let t=(0,G.c)(24),{provider:n,value:r,onChange:i,isLoading:a}=e,[o,s]=(0,W.useState)(!1);if(n.authType!==`APIKey`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This provider uses OAuth for authentication.`}),t[0]=e):e=t[0];let r;return t[1]===n.name?r=t[2]:(r=(0,K.jsxs)(`div`,{className:`rounded-md bg-muted/30 p-4 text-center`,children:[e,(0,K.jsxs)(_,{variant:`outline`,size:`sm`,className:`mt-2`,disabled:!0,children:[`Sign in with `,n.name]})]}),t[1]=n.name,t[2]=r),r}let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,K.jsx)(R,{children:(0,K.jsxs)(H,{children:[(0,K.jsx)(U,{asChild:!0,children:(0,K.jsx)(`label`,{htmlFor:`api-key`,className:`text-sm font-medium cursor-help`,children:`API Key`})}),(0,K.jsx)(I,{children:`Your API key is stored locally and never shared.`})]})})}),t[3]=l):l=t[3];let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(N,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),t[4]=u):u=t[4];let d=o?`text`:`password`,f=n.keyName??`Enter API Key`,p;t[5]===i?p=t[6]:(p=e=>i?.(e.target.value),t[5]=i,t[6]=p);let m;t[7]!==a||t[8]!==d||t[9]!==f||t[10]!==p||t[11]!==r?(m=(0,K.jsx)(h,{id:`api-key`,type:d,placeholder:f,className:`pl-10 pr-10`,value:r,onChange:p,disabled:a}),t[7]=a,t[8]=d,t[9]=f,t[10]=p,t[11]=r,t[12]=m):m=t[12];let v;t[13]===o?v=t[14]:(v=()=>s(!o),t[13]=o,t[14]=v);let y=(a??!1)||!r,b;t[15]===o?b=t[16]:(b=o?(0,K.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}):(0,K.jsx)(g,{className:`h-4 w-4 text-muted-foreground`}),t[15]=o,t[16]=b);let x;t[17]!==v||t[18]!==y||t[19]!==b?(x=(0,K.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:v,disabled:y,children:b}),t[17]=v,t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;return t[21]!==x||t[22]!==m?(S=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[l,(0,K.jsxs)(`div`,{className:`relative`,children:[u,m,x]})]}),t[21]=x,t[22]=m,t[23]=S):S=t[23],S}function ve({provider:e,onModelsChange:n,isLoading:r,disabled:i,displayMode:a=`grid`}){let[o,s]=(0,W.useState)([]),[c,u]=(0,W.useState)(new Set),[d,f]=(0,W.useState)(new Map),[p,h]=(0,W.useState)(!1),[g,y]=(0,W.useState)(``),[b,x]=(0,W.useState)(`alphabetical`);(0,W.useEffect)(()=>{S()},[e]);let S=async()=>{h(!0),y(``),x(`alphabetical`);try{s(await m(e));let n=(await t())[e]||[];u(new Set(n.map(e=>e.id))),f(new Map)}catch(t){console.error(`Failed to load models for ${e}:`,t),s([]),u(new Set)}finally{h(!1)}},C=(e,t)=>{let r=new Set(e);o.forEach(e=>{t.has(e.id)&&(t.get(e.id)?r.add(e.id):r.delete(e.id))}),n?.(r)},w=e=>{f(t=>{let n=new Map(t),r=c.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),C(c,n),n})},T=e=>{f(t=>{let n=new Map(t);return o.forEach(t=>{let r=c.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),C(c,n),n})},D=e=>q(e.id),k=o.filter(e=>{let t=g.toLowerCase(),n=D(e);return e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t)}).sort((e,t)=>{let n=+!c.has(e.id),r=+!c.has(t.id);if(n!==r)return n-r;if(b===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(b===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((t.pricing.prompt??0)+(t.pricing.completion??0))/2-r}return D(e).localeCompare(D(t))});return p||r?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(O,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):o.length===0?(0,K.jsx)(`div`,{className:`text-center py-8`,children:(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models available for this provider.`})}):a===`compact`?(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsxs)(`div`,{className:E(`flex items-center justify-between`,i&&`opacity-25`),children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)($,{id:`select-all-models`,disabled:i,checked:o.every(e=>{let t=d.has(e.id),n=d.get(e.id);return t?n:c.has(e.id)}),onCheckedChange:e=>T(e===!0)}),(0,K.jsx)(`label`,{htmlFor:`select-all-models`,className:`text-sm cursor-pointer`,children:`Select all models`})]}),(0,K.jsx)(R,{children:(0,K.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,K.jsxs)(H,{children:[(0,K.jsx)(U,{asChild:!0,children:(0,K.jsx)(_,{type:`button`,variant:b===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>x(`alphabetical`),disabled:i,children:(0,K.jsx)(j,{className:`h-4 w-4`})})}),(0,K.jsx)(I,{children:`Sort A–Z`})]}),(0,K.jsxs)(H,{children:[(0,K.jsx)(U,{asChild:!0,children:(0,K.jsx)(_,{type:`button`,variant:b===`price-low`||b===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>{x(b===`price-low`?`price-high`:`price-low`)},disabled:i,children:(0,K.jsx)(v,{className:`h-4 w-4`})})}),(0,K.jsx)(I,{children:`Sort by price`})]})]})})]}),(0,K.jsx)(R,{children:(0,K.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:k.length===0?(0,K.jsx)(`div`,{className:`text-center py-4`,children:(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models available.`})}):k.map(e=>{let t=c.has(e.id),n=d.has(e.id),r=d.get(e.id),a=n?r:t,o=e.pricing;return(0,K.jsxs)(H,{children:[(0,K.jsx)(U,{asChild:!0,children:(0,K.jsxs)(`div`,{className:E(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0`,i&&`opacity-25`),children:[(0,K.jsx)($,{id:e.id,disabled:i,checked:a??!1,onCheckedChange:()=>w(e.id),className:`mt-0`}),(0,K.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,K.jsx)(`label`,{htmlFor:e.id,className:`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`,children:D(e)}),o&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(o.prompt??0)<=0&&(o.completion??0)<=0?`Free`:`${l(o.prompt??0)} in | ${l(o.completion??0)} out`})]})]})}),e.description&&(0,K.jsx)(I,{side:`top`,className:`max-w-xs`,children:(0,K.jsx)(`p`,{className:`text-sm`,children:e.description})})]},e.id)})})})]}):null}function ye({open:e,onOpenChange:t,onComplete:a}){let[s,c]=(0,W.useState)(`git-check`),[l,u]=(0,W.useState)(null),[h,g]=(0,W.useState)(!1),[v,b]=(0,W.useState)([]),[S,D]=(0,W.useState)(null),[k,te]=(0,W.useState)(``),[j,M]=(0,W.useState)(!1),[N,P]=(0,W.useState)(``),[ie,F]=(0,W.useState)(new Set),[I,L]=(0,W.useState)(!1),[R,z]=(0,W.useState)(!1);(0,W.useEffect)(()=>{e&&s===`git-check`&&B()},[e,s]),(0,W.useEffect)(()=>{e&&s===`provider-selection`&&v.length===0&&V()},[e,s,v.length]),(0,W.useEffect)(()=>{e&&s===`model-selection`&&S&&H()},[e,s,S]);let B=async()=>{g(!0);try{u((await i()).gitInstalled)}catch(e){console.error(`Failed to check git installation:`,e),u(!1)}finally{g(!1)}},V=async()=>{try{let e=await o();b(e),e.length>0&&!S&&D(e[0])}catch(e){console.error(`Failed to load providers:`,e)}},H=async()=>{if(S){L(!0);try{await m(S.name),F(new Set)}catch(e){console.error(`Failed to load models:`,e)}finally{L(!1)}}},U=async()=>{if(!S||!k.trim()){P(`Please enter an API key`);return}M(!0),P(``);try{await ne(S.slug,k),c(`model-selection`)}catch(e){P(e instanceof Error?e.message:`Failed to validate API key`)}finally{M(!1)}},G=async()=>{if(S){z(!0);try{for(let e of ie)await T(S.name,e);await x(),a?.(),t(!1)}catch(e){console.error(`Failed to complete onboarding:`,e)}finally{z(!1)}}},q=async()=>{z(!0);try{await x(),a?.(),t(!1)}catch(e){console.error(`Failed to skip onboarding:`,e)}finally{z(!1)}};return(0,K.jsx)(y,{open:e,onOpenChange:t,children:(0,K.jsxs)(re,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,K.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,K.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[(0,K.jsx)(`div`,{className:E(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium`,s===`git-check`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`1`}),(0,K.jsx)(`div`,{className:E(`h-0.5 flex-1`,s===`provider-selection`||s===`model-selection`?`bg-primary`:`bg-muted`)}),(0,K.jsx)(`div`,{className:E(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium`,s===`provider-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`2`}),(0,K.jsx)(`div`,{className:E(`h-0.5 flex-1`,s===`model-selection`?`bg-primary`:`bg-muted`)}),(0,K.jsx)(`div`,{className:E(`flex items-center justify-center h-8 w-8 rounded-full text-sm font-medium`,s===`model-selection`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`),children:`3`})]}),(0,K.jsxs)(d,{children:[s===`git-check`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{children:`Let's get started`}),(0,K.jsx)(r,{children:`First, we need to check that Git is installed on your system.`})]}),s===`provider-selection`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{children:`Select an AI Provider`}),(0,K.jsx)(r,{children:`Choose your preferred AI provider and enter your API key.`})]}),s===`model-selection`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(C,{children:`Select Models`}),(0,K.jsx)(r,{children:`Choose which models you want to use with this provider.`})]})]})]}),(0,K.jsx)(ee,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,K.jsxs)(`div`,{className:`px-6 py-4`,children:[s===`git-check`&&(0,K.jsx)(`div`,{className:`space-y-4`,children:h?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(O,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):l?(0,K.jsxs)(`div`,{className:`rounded-lg border border-green-200 bg-green-50 p-4 flex items-start gap-3`,children:[(0,K.jsx)(n,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h4`,{className:`font-medium text-green-900`,children:`Git is installed`}),(0,K.jsx)(`p`,{className:`text-sm text-green-800`,children:`You're all set to use Git features in Tarsk.`})]})]}):(0,K.jsxs)(`div`,{className:`rounded-lg border border-yellow-200 bg-yellow-50 p-4 flex items-start gap-3`,children:[(0,K.jsx)(p,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`h4`,{className:`font-medium text-yellow-900`,children:`Git is not installed`}),(0,K.jsx)(`p`,{className:`text-sm text-yellow-800 mt-1`,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),(0,K.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 text-sm text-blue-600 hover:underline mt-2`,children:[`Download Git `,(0,K.jsx)(f,{className:`h-3 w-3`})]})]})]})}),s===`provider-selection`&&(0,K.jsx)(`div`,{className:`space-y-4`,children:S&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{selectedProvider:S,onProviderChange:e=>{D(e),te(e.apiKey??``),P(``)},showApiKeyInput:!0,variant:`dropdown`,isLoading:j}),N&&(0,K.jsx)(`div`,{className:`rounded-md bg-destructive/10 p-3 text-sm text-destructive`,children:N})]})}),s===`model-selection`&&S&&(0,K.jsx)(`div`,{className:`space-y-4`,children:(0,K.jsx)(ve,{provider:S.slug,isLoading:I,displayMode:`compact`,disabled:!1,onModelsChange:F})})]})}),(0,K.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,K.jsxs)(w,{className:`flex items-center justify-between`,children:[(0,K.jsx)(`div`,{children:s===`provider-selection`&&(0,K.jsx)(_,{variant:`ghost`,onClick:()=>q(),disabled:R,children:`Skip for now`})}),(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[s!==`git-check`&&(0,K.jsx)(_,{variant:`outline`,onClick:()=>{s===`provider-selection`?c(`git-check`):s===`model-selection`&&c(`provider-selection`)},disabled:R,children:`Back`}),s===`git-check`&&(0,K.jsxs)(_,{onClick:()=>{c(`provider-selection`)},disabled:h,className:`gap-2`,children:[`Continue `,(0,K.jsx)(A,{className:`h-4 w-4`})]}),s===`provider-selection`&&(0,K.jsx)(_,{onClick:U,disabled:j||!k.trim()||!S,className:`gap-2`,children:j?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(O,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,K.jsxs)(K.Fragment,{children:[`Next `,(0,K.jsx)(A,{className:`h-4 w-4`})]})}),s===`model-selection`&&(0,K.jsx)(_,{onClick:G,disabled:R,className:`gap-2`,children:R?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(O,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,K.jsxs)(K.Fragment,{children:[`Finish `,(0,K.jsx)(n,{className:`h-4 w-4`})]})})]})]})})]})})}export{$ as n,q as r,ye as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./onboarding-BgEjTEKs.js";export{e as OnboardingDialog,e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cr as e,Wn as t,sa as n}from"./dialogs-config-DmDjliuA.js";var r=n(),i=e();function a(e){let n=(0,r.c)(5),{children:a,className:o}=e,s;n[0]===o?s=n[1]:(s=t(`flex min-h-[71px] shrink-0 items-center gap-2 px-4 py-2 electrobun-webkit-app-region-drag`,o),n[0]=o,n[1]=s);let c;return n[2]!==a||n[3]!==s?(c=(0,i.jsx)(`header`,{className:s,children:a}),n[2]=a,n[3]=s,n[4]=c):c=n[4],c}export{a as t};
|
package/dist/public/assets/{project-settings-view-BsGGUbat.js → project-settings-view-BJYR_l3u.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Mn as n,Nn as r,Or as i,Pn as a,gn as o,hi as s,hn as c,la as l,mn as u,o as d,vn as f,yn as p,yt as m}from"./dialogs-config-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Mn as n,Nn as r,Or as i,Pn as a,gn as o,hi as s,hn as c,la as l,mn as u,o as d,vn as f,yn as p,yt as m}from"./dialogs-config-DmDjliuA.js";import{gt as h}from"./react-vendor-CaS5zjF7.js";import{t as g}from"./textarea-BjfyGfGR.js";import{t as _}from"./use-toast-C9B1H3P9.js";var v=e(l(),1),y=t();function b({projectId:e,onProjectUpdated:t}){let l=h(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(d.PullRequest),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(!1),[I,L]=(0,v.useState)(``),[R,z]=(0,v.useState)(``),[B,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(``),[W,G]=(0,v.useState)(d.PullRequest),K=(0,v.useCallback)(async()=>{if(e){F(!0);try{let t=await m(e),n=t.name??``,r=t.setupScript??``,i=t.validationScript??``,a=t.runCommand??``,o=t.commitMethod??d.PullRequest;x(n),C(r),k(i),T(a),D(o),L(n),z(r),V(i),U(a),G(o)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{F(!1)}}},[e]);return(0,v.useEffect)(()=>{K()},[K]),e?(0,y.jsxs)(`div`,{className:`p-6`,children:[(0,y.jsxs)(`div`,{className:`mb-6`,children:[(0,y.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Project Settings`}),(0,y.jsx)(`p`,{className:`text-muted-foreground`,children:`Configure settings for your project.`})]}),(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`projectName`,children:`Project Name`}),(0,y.jsx)(r,{id:`projectName`,value:b,onChange:e=>x(e.target.value),placeholder:`Enter project name`,className:`text-sm`,disabled:P})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`setupScript`,children:`Setup Script`}),(0,y.jsx)(g,{id:`setupScript`,value:S,onChange:e=>C(e.target.value),placeholder:`e.g. npm install`,className:`font-mono text-sm min-h-[80px] resize-none`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This script runs automatically after cloning the repo for new threads.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`validationScript`,children:`Validation Script`}),(0,y.jsx)(g,{id:`validationScript`,value:O,onChange:e=>k(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono text-sm min-h-[80px] resize-none`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(n,{htmlFor:`runCommand`,children:`Run Command`}),(0,y.jsx)(a,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){N(!0);try{let t=await u(e);t.runCommand?(T(t.runCommand),_({title:`Success`,description:`Suggested: ${t.runCommand}`})):_({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{N(!1)}}},disabled:M||P,className:`text-xs h-6 px-2 gap-1`,children:M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(i,{className:`h-3 w-3`}),`Suggest`]})})]}),(0,y.jsx)(r,{id:`runCommand`,value:w,onChange:e=>T(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono text-sm`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The command to start the dev server. Leave empty to disable run functionality.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{children:`Commit Method`}),(0,y.jsxs)(`div`,{className:`flex gap-4`,children:[(0,y.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`radio`,name:`commitMethod`,value:d.PullRequest,checked:E===d.PullRequest,onChange:e=>D(e.target.value),disabled:P}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Pull Requests`})]}),(0,y.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`radio`,name:`commitMethod`,value:d.Direct,checked:E===d.Direct,onChange:e=>D(e.target.value),disabled:P}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Direct Commits`})]})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E===d.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`})]}),(0,y.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,y.jsx)(a,{onClick:async()=>{if(e){j(!0);try{b!==I&&await o(e,b),S!==R&&await f(e,S.trim()||null,!1),O!==B&&await c(e,{validationScript:O.trim()||null}),w!==H&&await p(e,w.trim()||null),E!==W&&await c(e,{commitMethod:E}),_({title:`Success`,description:`Project settings saved`}),t?.(),l(`/`),L(b),z(S),V(O),U(w),G(E)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{j(!1)}}},disabled:A||P,children:A?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})})]})]}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Project Selected`}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a project from the sidebar to view its settings.`})]})})}export{b as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Br as n,Cr as r,Ct as i,Fi as a,G as o,Gn as s,Gt as c,H as ee,Ii as te,Jr as ne,K as re,Nn as l,Pi as ie,Pn as u,Q as ae,Ri as oe,St as se,U as ce,V as le,W as ue,Wn as d,hi as f,kn as de,la as p,oa as m,rn as fe,vi as pe}from"./dialogs-config-DmDjliuA.js";import{c as h,l as g,s as _,u as v}from"./history-view-BOjZoBCb.js";import{n as y,r as me}from"./onboarding-BgEjTEKs.js";import{i as he,n as ge,r as _e,t as ve}from"./tabs-DEmnnGvq.js";var b=e(p(),1),x=r();function S({selectedProviderName:e,className:r}){let[p,S]=(0,b.useState)(null),[C,ye]=(0,b.useState)(``),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)([]),[M,N]=(0,b.useState)(new Set),[P,F]=(0,b.useState)(new Set),[I,L]=(0,b.useState)(new Map),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(`alphabetical`),[H,be]=(0,b.useState)(`all`),[U,xe]=(0,b.useState)(!1),[W,G]=(0,b.useState)(``),[Se,Ce]=(0,b.useState)(``),[we,Te]=(0,b.useState)(`coding`),[K,Ee]=(0,b.useState)([]),[q,J]=(0,b.useState)(new Set),[De,Oe]=(0,b.useState)(new Set),[Y,X]=(0,b.useState)(new Map),Z=e=>me(e.id);(0,b.useEffect)(()=>{(async()=>{k(``);try{let t=await i();if(e){let n=t.find(t=>t.name===e);S(n??null),Ce(n?.apiKey??``),ye(n?.apiKey??``),n&&(Ae(n.slug),ke(n.slug))}}catch(e){k(e instanceof Error?e.message:`Failed to load providers`)}})()},[e]);let ke=async e=>{D(null);try{let t=await se(e);t.status===`success`&&D(t.balance)}catch(t){console.error(`Failed to load balance for ${e}:`,t)}},Ae=async e=>{T(!0),z(``),V(`alphabetical`),be(`all`),Te(`coding`);try{let[n,r,i,a]=await Promise.all([re(e),o(e),t(),ae()]);j(n),Ee(r);let s=new Set((i[e]||[]).map(e=>e.id));N(s),F(s);let c=new Set((a[e]||[]).map(e=>e.id));J(c),Oe(c),L(new Map),X(new Map)}catch(t){console.error(`Failed to load models for ${e}:`,t),j([]),Ee([]),N(new Set),F(new Set),J(new Set),Oe(new Set)}finally{T(!1)}},je=(e,t)=>{p?.name===e&&(ye(t),Me(t))},Me=async e=>{if(!(!p||e===Se))try{await fe(p.slug,e),Ce(e),G(`API key saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save API key`)}},Ne=(e,t)=>{t===`image`?X(t=>{let n=new Map(t),r=q.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):L(t=>{let n=new Map(t),r=M.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`coding`),n})},Q=async(e,t,n=`coding`)=>{if(p)try{n===`image`?(t?(await ce(p.slug,e),J(t=>new Set([...t,e]))):(await le(p.slug,e),J(t=>{let n=new Set(t);return n.delete(e),n})),X(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ue(p.slug,e),N(t=>new Set([...t,e]))):(await ee(p.slug,e),N(t=>{let n=new Set(t);return n.delete(e),n})),L(t=>{let n=new Map(t);return n.delete(e),n})),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},Pe=(e,t=`coding`)=>{let n=t===`image`?K:A,r=t===`image`?q:M;n.forEach(n=>{r.has(n.id)!==e&&Q(n.id,e,t)}),t===`image`?X(new Map):L(new Map)},Fe=async e=>{try{await c(e)}catch(e){console.error(`Failed to open provider website:`,e)}},$=C!==void 0&&C.trim().length>0,Ie=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Le=({codingIndex:e,modelName:t})=>{let r=Ie(e);return r===0?null:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,x.jsx)(n,{className:`h-3 w-3 ${e<=r?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,x.jsx)(h,{children:(0,x.jsxs)(`p`,{className:`text-sm`,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},Re=A.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!P.has(e.id),r=+!P.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((t.pricing.prompt??0)+(t.pricing.completion??0))/2-r}if(B===`coding-index`){let n=e.coding_index!==void 0&&e.coding_index!==null;return n===(t.coding_index!==void 0&&t.coding_index!==null)?!e.coding_index||!t.coding_index?0:t.coding_index-e.coding_index:n?-1:1}return Z(e).localeCompare(Z(t))}),ze=K.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!De.has(e.id),r=+!De.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((t.pricing.prompt??0)+(t.pricing.completion??0))/2-((e.pricing.prompt??0)+(e.pricing.completion??0))/2:n?-1:1}return Z(e).localeCompare(Z(t))});return O?(0,x.jsxs)(`div`,{className:d(`flex flex-1 flex-col items-center justify-center gap-2`,r),children:[(0,x.jsx)(`p`,{className:`text-sm text-destructive`,children:O}),(0,x.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):p?(0,x.jsx)(de,{className:d(`flex-1`,r),children:(0,x.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,x.jsxs)(`div`,{className:`mb-6`,children:[(0,x.jsxs)(`h1`,{className:`text-2xl font-bold`,children:[p.name,` Settings`]}),(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:`Configure API keys and models for this provider.`})]}),(0,x.jsxs)(`div`,{className:`space-y-6`,children:[(0,x.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2`,children:E===null?(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,x.jsxs)(`span`,{className:`text-xs font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`,children:[(0,x.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,s(E),` `,`balance`]})}),p.url?(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:()=>Fe(p.url),className:`flex items-center gap-1 text-xs text-brand h-auto p-3`,children:[`Visit provider website `,(0,x.jsx)(te,{className:`h-3 w-3`})]})}),(0,x.jsx)(h,{children:(0,x.jsx)(`p`,{children:p.url})})]})}):(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`span`,{className:`text-sm font-medium cursor-help`,children:`API Key`})}),(0,x.jsx)(h,{children:`Your API key is stored locally and never shared.`})]})})}),p.authType===`APIKey`?(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(pe,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,x.jsx)(l,{type:U?`text`:`password`,placeholder:p.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:C,onChange:e=>{je(p.name,e.target.value)}}),(0,x.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>xe(!U),disabled:!C,children:U?(0,x.jsx)(a,{className:`h-4 w-4 text-muted-foreground`}):(0,x.jsx)(ie,{className:`h-4 w-4 text-muted-foreground`})})]}):(0,x.jsxs)(`div`,{className:`rounded-md bg-muted/30 p-4 text-center`,children:[(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This provider uses OAuth for authentication.`}),(0,x.jsxs)(u,{variant:`outline`,size:`sm`,className:`mt-2`,disabled:!0,children:[`Sign in with `,p.name]})]})]}),(0,x.jsxs)(ve,{value:we,onValueChange:e=>{Te(e),z(``),V(`alphabetical`)},children:[(0,x.jsxs)(_e,{className:`mb-4`,children:[(0,x.jsx)(he,{value:`coding`,children:`Coding`}),p?.name.toLowerCase()===`openrouter`&&(0,x.jsx)(he,{value:`image`,children:`Image`})]}),(0,x.jsx)(ge,{value:`coding`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&A.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-models`,disabled:!$,checked:A.every(e=>{let t=I.has(e.id),n=I.get(e.id);return t?n:M.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`coding`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(m,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(oe,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`coding-index`),children:(0,x.jsx)(n,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(f,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):A.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:Re.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):Re.map(e=>{let t=M.has(e.id),n=I.has(e.id),r=I.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`coding`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:e.id,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[B===`coding-index`&&(0,x.jsx)(Le,{codingIndex:e.coding_index,modelName:Z(e)}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,x.jsx)(ge,{value:`image`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&K.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-image-models`,disabled:!$,checked:K.every(e=>{let t=Y.has(e.id),n=Y.get(e.id);return t?n:q.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`image`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-image-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(m,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(oe,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(f,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):K.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No image models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:ze.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):ze.map(e=>{let t=q.has(e.id),n=Y.has(e.id),r=Y.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`image`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:`image-${e.id}`,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]},e.id)})})})]})})]}),W&&(0,x.jsx)(`div`,{className:`text-sm p-2 rounded-md ${W.includes(`error`)||W.includes(`Failed`)?`text-destructive bg-destructive/10`:`text-green-600 bg-green-50`}`,children:W})]})]})}):(0,x.jsx)(`div`,{className:d(`flex flex-1 items-center justify-center h-screen`,r),children:(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`Select a Provider`}),(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose a provider from the sidebar to configure its settings.`})]})})}export{S as ProviderDetailsView,S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$i as t,Cr as n,Ct as r,Pn as i,Wn as a,la as o}from"./dialogs-config-DmDjliuA.js";import{t as s}from"./standard-list-item-CpBjveM0.js";var c=e(o(),1),l=n();function u({selectedProvider:e,onProviderSelect:n,className:o}){let[u,d]=(0,c.useState)([]),[f,p]=(0,c.useState)(!1),[m,h]=(0,c.useState)(``);(0,c.useEffect)(()=>{(async()=>{p(!0),h(``);try{d(await r())}catch(e){h(e instanceof Error?e.message:`Failed to load providers`)}finally{p(!1)}})()},[]);let g=[...u].sort((e,t)=>{let n=!!e.apiKey,r=!!t.apiKey;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)});return f?(0,l.jsx)(`div`,{className:a(`p-2`,o),children:(0,l.jsxs)(`div`,{className:`animate-pulse space-y-2`,children:[(0,l.jsx)(`div`,{className:`h-8 bg-muted rounded`}),(0,l.jsx)(`div`,{className:`h-8 bg-muted rounded`}),(0,l.jsx)(`div`,{className:`h-8 bg-muted rounded`})]})}):m?(0,l.jsx)(`div`,{className:a(`p-2`,o),children:(0,l.jsxs)(`div`,{className:`text-center`,children:[(0,l.jsx)(`p`,{className:`text-sm text-destructive mb-2`,children:m}),(0,l.jsx)(i,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]})}):(0,l.jsx)(`div`,{className:a(`space-y-1`,o),children:g.map(r=>(0,l.jsx)(s,{onClick:()=>n(r.name),selected:e===r.name,asChild:!0,children:(0,l.jsxs)(`button`,{className:`justify-between group`,children:[(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`img`,{src:`https://models.tarsk.io/svg/${r.slug}.svg`,alt:`${r.name} logo`,className:`h-4 w-4 flex-shrink-0`,onError:e=>{e.currentTarget.style.visibility=`hidden`}}),(0,l.jsx)(`span`,{className:a(r.apiKey&&`font-bold text-foreground`),children:r.name})]}),r.apiKey&&(0,l.jsx)(t,{className:`h-3.5 w-3.5 text-green-500`})]})},r.name))})}export{u as ProvidersSidebar,u as default};
|