@entrydesk/cli 1.3.3 → 1.3.4

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 (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -195,7 +195,7 @@ ID: ${u.id}`)}}}else if(f==="connectors"){let c=Array.from(rt);C(c.length>0?c:vo
195
195
  `)||lt.length===0)return;if(He===null){wt(e);let u=lt.length-1;Ye(u),t(lt[u]);return}let c=Math.max(0,He-1);Ye(c),t(lt[c]);return}if(y.downArrow){if(e.includes(`
196
196
  `)||He===null)return;if(He>=lt.length-1){Ye(null),t(Vt);return}let c=He+1;Ye(c),t(lt[c])}}),{suggestions:z,suggestionIndex:Te,showSuggestions:se,argMode:f,argItems:T,argIndex:U,selectedConnectorIds:rt,selectedCapabilities:Oe,deleteConfirmMode:ct,handleInputChange:Kt,handleSubmit:qt}}import{useCallback as jt,useRef as xr,useState as Cr}from"react";function zn({credentials:e,currentModel:t,modelProviders:n,onUploadSuccess:s,onUploadError:o}){let[r,i]=Cr([]),a=xr(0),l=jt(h=>{if(!(!Array.isArray(n)||n.length===0)){for(let S of n)if(S.models.some(V=>V.id===h))return S.id;return n[0]?.id}},[n]),d=jt(async h=>{if(!e){o?.(h.filename,"Not logged in");return}if(!Array.isArray(n)||n.length===0){o?.(h.filename,"Model providers not loaded yet. Please wait and try again.");return}let S=t?l(t):n[0]?.id;if(!S){o?.(h.filename,"No model provider available");return}let R=`file-${++a.current}`;i(V=>[...V,{id:R,filename:h.filename,mimeType:h.mimeType,status:"uploading"}]);try{let Z=await new B().uploadFile(e.accessToken,e.workspaceId,h,S);i(ae=>ae.map(Y=>Y.id===R?{...Y,status:"uploaded",fileId:Z.id}:Y)),s?.(h.filename)}catch(V){let Z=V instanceof Error?V.message:"Upload failed";i(ae=>ae.map(Y=>Y.id===R?{...Y,status:"error",error:Z}:Y)),o?.(h.filename,Z)}},[e,t,l,n,s,o]),v=jt(h=>{i(S=>S.filter(R=>R.id!==h))},[]),b=jt(()=>{i([])},[]),x=jt(()=>r.filter(h=>h.status==="uploaded"&&h.fileId).map(h=>h.fileId),[r]),C=r.some(h=>h.status==="uploading"),m=r.length>0;return{pendingFiles:r,addFile:d,removeFile:v,clearFiles:b,getUploadedFileIds:x,hasUploadingFiles:C,hasFiles:m}}import{jsx as X,jsxs as de}from"react/jsx-runtime";var Sr=[" ______ _ ____ _","| ____| | | | _ \\ | |","| |__ _ __ | |_ _ __ _ _ | | | | ___ ___| | __","| __| | '_ \\| __| '__| | | || | | |/ _ \\/ __| |/ /","| |____| | | | |_| | | |_| || |_| | __/\\__ \\ <","|______|_| |_|\\__|_| \\__, ||____/ \\___||___/_|\\_\\"," __/ |"," |___/"],Tr=[Ro,Ro,Lo,Lo,gt,gt,gt,gt],Xn=Sr.map((e,t)=>`${Tr[t]??gt}${e}${re}`).join(`
197
197
  `),vr=`${gt}EntryDesk${re}`,Ir=500;function Pr(e){let t="",n=0;for(;n<e.length;){if(e.charCodeAt(n)===27&&e[n+1]==="["){for(n+=2;n<e.length;){let s=e.charCodeAt(n);if(s>=64&&s<=126){n+=1;break}n+=1}continue}t+=e[n],n+=1}return t}function Ar(e){let t=Pr(e);return Math.max(...t.split(`
198
- `).map(n=>n.length))}function Er(e){let t=Ar(Xn);return e>=t?Xn:vr}function Zn({agentId:e,model:t,message:n,chatId:s,chatTitle:o,connectorIds:r,enableSandbox:i=!0,enableWebSearch:a=!1,enableImageGeneration:l=!1,enableChart:d=!1,enableFileSystem:v=!0}){let b=process.stdout.columns??80,x=Er(b),C=Yn(null),m=En(s,o),{state:h,setState:S,messages:R,setMessages:V,input:Z,setInput:ae,chatId:Y,setChatId:Se,currentChatTitle:j,setCurrentChatTitle:P,hasPersistedChat:N,setHasPersistedChat:O,credentials:W,setCredentials:_,currentResponse:ge,setCurrentResponse:D,fullOutput:p,setFullOutput:ie,addSystemMessage:ke,startNewChat:q}=m,{credentials:A}=_n(S);co(()=>{A&&!W&&_(A)},[A,W,_]);let{availableConnectors:te,availableModels:ee,availableAgents:pe,modelProviders:ce,loading:M}=Dn(W),{currentModel:Q,setCurrentModel:z,currentAgentId:fe,setCurrentAgentId:Te,activeConnectorIds:F,setActiveConnectorIds:se}=Mn(t,e,r),L=Yn(!1);co(()=>{if(!L.current){if(L.current=!0,!t&&!e){let k=ne.getDefaultModel();k&&z(k)}if(!r&&!e){let k=ne.getDefaultConnectorIds();k&&se(k.length>0?k:void 0)}}},[t,e,r,z,se]);let{currentAgentDetails:f}=Wn(fe,W),{sandbox:w,setSandbox:T,webSearch:oe,setWebSearch:U,imageGeneration:Ce,setImageGeneration:rt,chart:it,setChart:Oe,fileSystem:at,setFileSystem:yo,capabilityLabelMap:Gt}=Fn(i,a,l,d,v),{pendingFiles:We,addFile:yt,removeFile:ze,clearFiles:Ht,getUploadedFileIds:lt,hasUploadingFiles:wo,hasFiles:He}=zn({credentials:W,currentModel:Q,modelProviders:ce,onUploadSuccess:k=>{ke(`\u2713 Attached: ${k}`)},onUploadError:(k,E)=>{ke(`\u2717 Failed to upload ${k}: ${E}`)}}),{sendMessage:Ye}=On({chatId:Y,credentials:W,currentAgentId:fe,currentModel:Q,activeConnectorIds:F,sandbox:w,webSearch:oe,imageGeneration:Ce,chart:it,localTools:at,fullOutput:p,setMessages:V,setState:S,setCurrentResponse:D,setCredentials:_,setHasPersistedChat:O,getFileIds:lt,clearFiles:Ht}),Vt=Fo(k=>{q(k),D("")},[q]),[wt,mt]=$r(!1),ct=Fo(async k=>{let E=k.text.trim(),J=ro(E);if(/^https?:\/\//.test(J))return;if(await vn(E)&&Tn(J)){let ue=await In(E);ue&&(k.preventDefault(),await yt(ue))}},[yt]),kt=Fo(async()=>{if(!(wt||h.status!=="ready")){if(M||ce.length===0){ke("Please wait for resources to load before pasting images.");return}ke("Reading clipboard..."),mt(!0);try{let k=await Sn();if(k){let E=`clipboard-${Date.now()}.png`;ke(`Uploading: ${E} (${Math.round(k.buffer.length/1024)}KB)`),await yt({buffer:k.buffer,filename:E,mimeType:k.mime})}else ke("No image found in clipboard. Copy an image first.")}catch(k){let E=k instanceof Error?k.message:"Failed to read clipboard";ke(`Clipboard error: ${E}`)}finally{mt(!1)}}},[yt,ke,wt,h.status,M,ce.length]),{suggestions:bt,suggestionIndex:xt,showSuggestions:_e,argMode:he,argItems:Xe,argIndex:Ct,selectedConnectorIds:Kt,selectedCapabilities:At,deleteConfirmMode:qt,handleInputChange:I,handleSubmit:y}=qn({input:Z,setInput:ae,chatId:Y,setChatId:Se,currentChatTitle:j,setCurrentChatTitle:P,currentModel:Q,setCurrentModel:z,currentAgentId:fe,setCurrentAgentId:Te,currentAgentDetails:f,setCurrentAgentDetails:()=>{},activeConnectorIds:F,setActiveConnectorIds:se,sandbox:w,setSandbox:T,webSearch:oe,setWebSearch:U,imageGeneration:Ce,setImageGeneration:rt,chart:it,setChart:Oe,fileSystem:at,setFileSystem:yo,availableModels:ee,availableAgents:pe,availableConnectors:te,messages:R,hasPersistedChat:N,setHasPersistedChat:O,setMessages:V,addSystemMessage:ke,startNewChat:Vt,sendMessage:Ye,setFullOutput:ie,credentials:W,setCredentials:_,setState:S,defaultCapabilities:{sandbox:i,webSearch:a,imageGeneration:l,chart:d,fileSystem:v},capabilityLabelMap:Gt,hasUploadingFiles:wo});if(jo((k,E)=>{(E.ctrl||E.meta)&&k==="v"&&kt()},{isActive:h.status==="ready"&&!he}),jo((k,E)=>{if(!E.escape)return;let J=Date.now(),G=C.current;C.current=J,!(!G||J-G>Ir)&&(he||_e||(C.current=null,He&&Ht(),Z.length>0&&I("")))},{isActive:h.status==="ready"}),jo((k,E)=>{E.return&&(Vt("Started a new chat."),S({status:"ready"}))},{isActive:h.status==="error"}),co(()=>{if(W&&!M&&h.status==="loading")if(!Q&&!fe){let k=ne.getDefaultModel(),E=k&&ee.some(G=>G.id===k),J=E?k:ee[0]?.id;J?(E||ne.setDefaultModel(J),z(J),S({status:"ready"})):pe.length===0?S({status:"no-model"}):S({status:"ready"})}else S({status:"ready"})},[W,M,Q,fe,ee,pe,h.status,z,S]),co(()=>{n&&W&&h.status==="ready"&&Ye(n)},[W,n]),h.status==="loading")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),de(Pe,{children:[X(K,{color:"cyan",children:X(Bo,{type:"dots"})}),X(K,{children:" Initializing chat..."})]})]});if(h.status==="not-logged-in")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"Not logged in"}),X(K,{dimColor:!0,children:"Run `entrydesk login` to authenticate first."})]});if(h.status==="no-workspace")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"No workspace selected"}),X(K,{dimColor:!0,children:"Run `entrydesk workspaces` to select a workspace first."})]});if(h.status==="no-model")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"No model or agent specified"}),s&&X(K,{dimColor:!0,children:"Could not determine the model used in this chat."}),X(K,{dimColor:!0,children:"Please specify a model with --model or use an agent with -a."}),X(K,{dimColor:!0,children:"Example: entrydesk chat -c 1 -i --model gemini-2.5-flash-lite"})]});if(h.status==="error")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),de(K,{color:"red",children:["Error: ",h.message]}),X(K,{dimColor:!0,children:"Press Enter to start a new chat, or Ctrl+C to exit"})]});let c=fe?f?f.connectors&&f.connectors.length>0?f.connectors.map(k=>k.name).join(", "):"none":"loading...":F&&F.length>0?te.filter(k=>F.includes(k.id)).map(k=>k.name).join(", ")||`${F.length} connector(s)`:"none",u=[];if(fe)if(f?.capabilities)for(let k of f.capabilities)u.push(Gt.get(k)??k);else u.push("loading...");else w&&u.push("Sandbox"),oe&&u.push("Web"),Ce&&u.push("Image"),it&&u.push("Chart");at&&u.push("FileSystem");let g=H.getCurrentProfileName(),$=g!=="default";return de(Pe,{flexDirection:"column",children:[de(Pe,{marginBottom:1,flexDirection:"column",children:[X(K,{children:x}),de(Pe,{children:[X(K,{bold:!0,color:"cyan",children:j?`Continuing: ${j}`:"EntryDesk CLI"}),de(K,{dimColor:!0,children:[" v","1.3.3"]}),$&&de(K,{color:"magenta",children:[" [",g,"]"]}),X(K,{dimColor:!0,children:" (type /help for commands)"})]})]}),R.map((k,E)=>{let J=k.parts&&p?ht(k.parts,!0):k.content,G=k.role==="user"?"green":k.role==="system"?"yellow":"blue",ue=k.role==="user"?"You":k.role==="system"?"System":"Assistant";return de(Pe,{flexDirection:"column",marginBottom:1,children:[de(K,{bold:!0,color:G,children:[ue,":"]}),X(Do,{text:J})]},E)}),ge&&de(Pe,{flexDirection:"column",marginBottom:1,children:[X(K,{bold:!0,color:"blue",children:"Assistant:"}),X(Do,{text:ge})]}),h.status==="ready"&&X(an,{suggestions:bt,activeIndex:xt,visible:_e}),h.status==="ready"&&he&&X(rn,{items:Xe,activeIndex:Ct,pageSize:he==="agent"||he==="skills"||he==="model"?5:10,selectedIds:he==="connectors"?Kt:he==="capabilities"?At:void 0,multiSelect:he==="connectors"||he==="capabilities",visible:!0,title:he==="model"?"Select model:":he==="agent"?"Select agent:":he==="skills"?"Select skill:":he==="connectors"?"Select connectors:":he==="capabilities"?"Select capabilities:":"Select chat:"}),h.status==="sending"&&!ge?de(Pe,{children:[X(K,{color:"cyan",children:X(Bo,{type:"dots"})}),X(K,{children:" Thinking..."})]}):h.status==="ready"&&!he?de(Pe,{flexDirection:"column",children:[qt&&X(Pe,{marginBottom:1,children:X(K,{color:"yellow",children:"\u26A0\uFE0F Delete this chat? (y/N) "})}),He&&!qt&&de(Pe,{marginBottom:1,flexDirection:"row",gap:1,children:[X(K,{dimColor:!0,children:"Attachments:"}),We.map((k,E)=>de(K,{children:[k.status==="uploading"?de(K,{color:"yellow",children:[X(Bo,{type:"dots"})," ",k.filename]}):k.status==="error"?de(K,{color:"red",children:["\u2717 ",k.filename]}):de(K,{color:"green",children:["\u2713 ",k.filename]}),E<We.length-1&&X(K,{children:", "})]},k.id))]}),de(Pe,{children:[X(K,{color:"green",children:"> "}),X(gn,{value:Z,onChange:I,onSubmit:y,onPaste:ct,leadingOffset:2,multiline:!0})]})]}):null,de(Pe,{marginTop:1,flexDirection:"column",children:[de(Pe,{gap:2,children:[de(K,{children:[X(K,{dimColor:!0,children:"Model: "}),X(K,{color:"magenta",children:fe?f?.model?.name||"loading...":ee.find(k=>k.id===Q)?.name||Q||"none"})]}),de(K,{children:[X(K,{dimColor:!0,children:"Connectors: "}),X(K,{color:"cyan",children:c})]}),de(K,{children:[X(K,{dimColor:!0,children:"Capabilities: "}),X(K,{color:"green",children:u.length>0?u.join(", "):"none"})]})]}),de(K,{dimColor:!0,children:["Esc Esc: Clear input & attachments | Ctrl+V: Paste image | Ctrl+O: Toggle full output ",p?"(ON)":"(OFF)"," | Ctrl+C: Exit"]})]})]})}import{jsx as Rr}from"react/jsx-runtime";async function _r(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}async function Dr(e,t,n,s){if(s<1)return console.error("Chat number must be 1 or greater"),null;let{chats:o}=await e.getChats(t,n,20);if(o.length===0)return console.error("No chats found. Start a new chat first."),null;if(s>o.length)return console.error(`Chat number ${s} not found. You have ${o.length} recent chats.`),console.error("Use `entrydesk chats` to see available chats."),null;let r=o[s-1],i;if(!r.agentId){let{messages:a}=await e.getMessages(t,n,r.id,10);i=a.find(d=>d.role==="assistant"&&d.modelId)?.modelId}return{chat:r,modelId:i}}var Tt="\x1B[2m",Re="\x1B[0m",Wo="\x1B[36m",os="\x1B[33m",fo="\x1B[32m",Qn="stream-json";function es(e,t,n,s){e&&t&&(console.error(`Error: Cannot use both ${n} and ${s}`),process.exit(1))}function po(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}
198
+ `).map(n=>n.length))}function Er(e){let t=Ar(Xn);return e>=t?Xn:vr}function Zn({agentId:e,model:t,message:n,chatId:s,chatTitle:o,connectorIds:r,enableSandbox:i=!0,enableWebSearch:a=!1,enableImageGeneration:l=!1,enableChart:d=!1,enableFileSystem:v=!0}){let b=process.stdout.columns??80,x=Er(b),C=Yn(null),m=En(s,o),{state:h,setState:S,messages:R,setMessages:V,input:Z,setInput:ae,chatId:Y,setChatId:Se,currentChatTitle:j,setCurrentChatTitle:P,hasPersistedChat:N,setHasPersistedChat:O,credentials:W,setCredentials:_,currentResponse:ge,setCurrentResponse:D,fullOutput:p,setFullOutput:ie,addSystemMessage:ke,startNewChat:q}=m,{credentials:A}=_n(S);co(()=>{A&&!W&&_(A)},[A,W,_]);let{availableConnectors:te,availableModels:ee,availableAgents:pe,modelProviders:ce,loading:M}=Dn(W),{currentModel:Q,setCurrentModel:z,currentAgentId:fe,setCurrentAgentId:Te,activeConnectorIds:F,setActiveConnectorIds:se}=Mn(t,e,r),L=Yn(!1);co(()=>{if(!L.current){if(L.current=!0,!t&&!e){let k=ne.getDefaultModel();k&&z(k)}if(!r&&!e){let k=ne.getDefaultConnectorIds();k&&se(k.length>0?k:void 0)}}},[t,e,r,z,se]);let{currentAgentDetails:f}=Wn(fe,W),{sandbox:w,setSandbox:T,webSearch:oe,setWebSearch:U,imageGeneration:Ce,setImageGeneration:rt,chart:it,setChart:Oe,fileSystem:at,setFileSystem:yo,capabilityLabelMap:Gt}=Fn(i,a,l,d,v),{pendingFiles:We,addFile:yt,removeFile:ze,clearFiles:Ht,getUploadedFileIds:lt,hasUploadingFiles:wo,hasFiles:He}=zn({credentials:W,currentModel:Q,modelProviders:ce,onUploadSuccess:k=>{ke(`\u2713 Attached: ${k}`)},onUploadError:(k,E)=>{ke(`\u2717 Failed to upload ${k}: ${E}`)}}),{sendMessage:Ye}=On({chatId:Y,credentials:W,currentAgentId:fe,currentModel:Q,activeConnectorIds:F,sandbox:w,webSearch:oe,imageGeneration:Ce,chart:it,localTools:at,fullOutput:p,setMessages:V,setState:S,setCurrentResponse:D,setCredentials:_,setHasPersistedChat:O,getFileIds:lt,clearFiles:Ht}),Vt=Fo(k=>{q(k),D("")},[q]),[wt,mt]=$r(!1),ct=Fo(async k=>{let E=k.text.trim(),J=ro(E);if(/^https?:\/\//.test(J))return;if(await vn(E)&&Tn(J)){let ue=await In(E);ue&&(k.preventDefault(),await yt(ue))}},[yt]),kt=Fo(async()=>{if(!(wt||h.status!=="ready")){if(M||ce.length===0){ke("Please wait for resources to load before pasting images.");return}ke("Reading clipboard..."),mt(!0);try{let k=await Sn();if(k){let E=`clipboard-${Date.now()}.png`;ke(`Uploading: ${E} (${Math.round(k.buffer.length/1024)}KB)`),await yt({buffer:k.buffer,filename:E,mimeType:k.mime})}else ke("No image found in clipboard. Copy an image first.")}catch(k){let E=k instanceof Error?k.message:"Failed to read clipboard";ke(`Clipboard error: ${E}`)}finally{mt(!1)}}},[yt,ke,wt,h.status,M,ce.length]),{suggestions:bt,suggestionIndex:xt,showSuggestions:_e,argMode:he,argItems:Xe,argIndex:Ct,selectedConnectorIds:Kt,selectedCapabilities:At,deleteConfirmMode:qt,handleInputChange:I,handleSubmit:y}=qn({input:Z,setInput:ae,chatId:Y,setChatId:Se,currentChatTitle:j,setCurrentChatTitle:P,currentModel:Q,setCurrentModel:z,currentAgentId:fe,setCurrentAgentId:Te,currentAgentDetails:f,setCurrentAgentDetails:()=>{},activeConnectorIds:F,setActiveConnectorIds:se,sandbox:w,setSandbox:T,webSearch:oe,setWebSearch:U,imageGeneration:Ce,setImageGeneration:rt,chart:it,setChart:Oe,fileSystem:at,setFileSystem:yo,availableModels:ee,availableAgents:pe,availableConnectors:te,messages:R,hasPersistedChat:N,setHasPersistedChat:O,setMessages:V,addSystemMessage:ke,startNewChat:Vt,sendMessage:Ye,setFullOutput:ie,credentials:W,setCredentials:_,setState:S,defaultCapabilities:{sandbox:i,webSearch:a,imageGeneration:l,chart:d,fileSystem:v},capabilityLabelMap:Gt,hasUploadingFiles:wo});if(jo((k,E)=>{(E.ctrl||E.meta)&&k==="v"&&kt()},{isActive:h.status==="ready"&&!he}),jo((k,E)=>{if(!E.escape)return;let J=Date.now(),G=C.current;C.current=J,!(!G||J-G>Ir)&&(he||_e||(C.current=null,He&&Ht(),Z.length>0&&I("")))},{isActive:h.status==="ready"}),jo((k,E)=>{E.return&&(Vt("Started a new chat."),S({status:"ready"}))},{isActive:h.status==="error"}),co(()=>{if(W&&!M&&h.status==="loading")if(!Q&&!fe){let k=ne.getDefaultModel(),E=k&&ee.some(G=>G.id===k),J=E?k:ee[0]?.id;J?(E||ne.setDefaultModel(J),z(J),S({status:"ready"})):pe.length===0?S({status:"no-model"}):S({status:"ready"})}else S({status:"ready"})},[W,M,Q,fe,ee,pe,h.status,z,S]),co(()=>{n&&W&&h.status==="ready"&&Ye(n)},[W,n]),h.status==="loading")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),de(Pe,{children:[X(K,{color:"cyan",children:X(Bo,{type:"dots"})}),X(K,{children:" Initializing chat..."})]})]});if(h.status==="not-logged-in")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"Not logged in"}),X(K,{dimColor:!0,children:"Run `entrydesk login` to authenticate first."})]});if(h.status==="no-workspace")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"No workspace selected"}),X(K,{dimColor:!0,children:"Run `entrydesk workspaces` to select a workspace first."})]});if(h.status==="no-model")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),X(K,{color:"yellow",children:"No model or agent specified"}),s&&X(K,{dimColor:!0,children:"Could not determine the model used in this chat."}),X(K,{dimColor:!0,children:"Please specify a model with --model or use an agent with -a."}),X(K,{dimColor:!0,children:"Example: entrydesk chat -c 1 -i --model gemini-2.5-flash-lite"})]});if(h.status==="error")return de(Pe,{flexDirection:"column",children:[X(K,{children:x}),de(K,{color:"red",children:["Error: ",h.message]}),X(K,{dimColor:!0,children:"Press Enter to start a new chat, or Ctrl+C to exit"})]});let c=fe?f?f.connectors&&f.connectors.length>0?f.connectors.map(k=>k.name).join(", "):"none":"loading...":F&&F.length>0?te.filter(k=>F.includes(k.id)).map(k=>k.name).join(", ")||`${F.length} connector(s)`:"none",u=[];if(fe)if(f?.capabilities)for(let k of f.capabilities)u.push(Gt.get(k)??k);else u.push("loading...");else w&&u.push("Sandbox"),oe&&u.push("Web"),Ce&&u.push("Image"),it&&u.push("Chart");at&&u.push("FileSystem");let g=H.getCurrentProfileName(),$=g!=="default";return de(Pe,{flexDirection:"column",children:[de(Pe,{marginBottom:1,flexDirection:"column",children:[X(K,{children:x}),de(Pe,{children:[X(K,{bold:!0,color:"cyan",children:j?`Continuing: ${j}`:"EntryDesk CLI"}),de(K,{dimColor:!0,children:[" v","1.3.4"]}),$&&de(K,{color:"magenta",children:[" [",g,"]"]}),X(K,{dimColor:!0,children:" (type /help for commands)"})]})]}),R.map((k,E)=>{let J=k.parts&&p?ht(k.parts,!0):k.content,G=k.role==="user"?"green":k.role==="system"?"yellow":"blue",ue=k.role==="user"?"You":k.role==="system"?"System":"Assistant";return de(Pe,{flexDirection:"column",marginBottom:1,children:[de(K,{bold:!0,color:G,children:[ue,":"]}),X(Do,{text:J})]},E)}),ge&&de(Pe,{flexDirection:"column",marginBottom:1,children:[X(K,{bold:!0,color:"blue",children:"Assistant:"}),X(Do,{text:ge})]}),h.status==="ready"&&X(an,{suggestions:bt,activeIndex:xt,visible:_e}),h.status==="ready"&&he&&X(rn,{items:Xe,activeIndex:Ct,pageSize:he==="agent"||he==="skills"||he==="model"?5:10,selectedIds:he==="connectors"?Kt:he==="capabilities"?At:void 0,multiSelect:he==="connectors"||he==="capabilities",visible:!0,title:he==="model"?"Select model:":he==="agent"?"Select agent:":he==="skills"?"Select skill:":he==="connectors"?"Select connectors:":he==="capabilities"?"Select capabilities:":"Select chat:"}),h.status==="sending"&&!ge?de(Pe,{children:[X(K,{color:"cyan",children:X(Bo,{type:"dots"})}),X(K,{children:" Thinking..."})]}):h.status==="ready"&&!he?de(Pe,{flexDirection:"column",children:[qt&&X(Pe,{marginBottom:1,children:X(K,{color:"yellow",children:"\u26A0\uFE0F Delete this chat? (y/N) "})}),He&&!qt&&de(Pe,{marginBottom:1,flexDirection:"row",gap:1,children:[X(K,{dimColor:!0,children:"Attachments:"}),We.map((k,E)=>de(K,{children:[k.status==="uploading"?de(K,{color:"yellow",children:[X(Bo,{type:"dots"})," ",k.filename]}):k.status==="error"?de(K,{color:"red",children:["\u2717 ",k.filename]}):de(K,{color:"green",children:["\u2713 ",k.filename]}),E<We.length-1&&X(K,{children:", "})]},k.id))]}),de(Pe,{children:[X(K,{color:"green",children:"> "}),X(gn,{value:Z,onChange:I,onSubmit:y,onPaste:ct,leadingOffset:2,multiline:!0})]})]}):null,de(Pe,{marginTop:1,flexDirection:"column",children:[de(Pe,{gap:2,children:[de(K,{children:[X(K,{dimColor:!0,children:"Model: "}),X(K,{color:"magenta",children:fe?f?.model?.name||"loading...":ee.find(k=>k.id===Q)?.name||Q||"none"})]}),de(K,{children:[X(K,{dimColor:!0,children:"Connectors: "}),X(K,{color:"cyan",children:c})]}),de(K,{children:[X(K,{dimColor:!0,children:"Capabilities: "}),X(K,{color:"green",children:u.length>0?u.join(", "):"none"})]})]}),de(K,{dimColor:!0,children:["Esc Esc: Clear input & attachments | Ctrl+V: Paste image | Ctrl+O: Toggle full output ",p?"(ON)":"(OFF)"," | Ctrl+C: Exit"]})]})]})}import{jsx as Rr}from"react/jsx-runtime";async function _r(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}async function Dr(e,t,n,s){if(s<1)return console.error("Chat number must be 1 or greater"),null;let{chats:o}=await e.getChats(t,n,20);if(o.length===0)return console.error("No chats found. Start a new chat first."),null;if(s>o.length)return console.error(`Chat number ${s} not found. You have ${o.length} recent chats.`),console.error("Use `entrydesk chats` to see available chats."),null;let r=o[s-1],i;if(!r.agentId){let{messages:a}=await e.getMessages(t,n,r.id,10);i=a.find(d=>d.role==="assistant"&&d.modelId)?.modelId}return{chat:r,modelId:i}}var Tt="\x1B[2m",Re="\x1B[0m",Wo="\x1B[36m",os="\x1B[33m",fo="\x1B[32m",Qn="stream-json";function es(e,t,n,s){e&&t&&(console.error(`Error: Cannot use both ${n} and ${s}`),process.exit(1))}function po(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}
199
199
  `)}function mo(e,t){if(t)return e;let n=e.split(`
200
200
  `);if(n.length<=20)return e;let s=n.slice(0,5),o=n.slice(-5),r=n.length-10;return[...s,`${Tt}... (${r} lines omitted, use --full-output to see all) ...${Re}`,...o].join(`
201
201
  `)}function Lr(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function ts(e,t){if(!e)return"(no result)";if(typeof e!="object")return mo(String(e),t);let n=e;if("structuredContent"in n&&n.structuredContent){let s=n.structuredContent,o=[];if(s.stdout&&typeof s.stdout=="string"&&s.stdout.trim()&&o.push(s.stdout.trim()),s.stderr&&typeof s.stderr=="string"&&s.stderr.trim()&&o.push(`${os}[stderr]${Re} ${s.stderr.trim()}`),s.urls&&Array.isArray(s.urls)){let r=s.urls;for(let i of r)i.path&&i.url&&o.push(`${i.path}: ${i.url}`)}return o.length===0&&o.push(JSON.stringify(s,null,2)),mo(o.join(`
@@ -486,7 +486,7 @@ Examples:
486
486
  `)}async function vs(e){if(e.help){mi();return}let t,n;try{let m=await ye();t=m.accessToken,n=m.workspaceId}catch(m){let h=m instanceof Error?m.message:"Authentication failed";console.error(h),process.exit(1)}let s=new B,o=[],r,i=0,a=100;do{let m=await s.getMonthlyUsages(t,n,{nextKey:r,limit:100});if(o.push(...m.monthlyUsages),r=m.nextKey,i++,i>=a){console.error(`Warning: Showing first ${o.length} entries (pagination limit reached)`);break}}while(r);if(e.json){console.log(JSON.stringify(o));return}if(o.length===0){console.log("No usage data found for this workspace.");return}console.log(`Current Month Usage:
487
487
  `);let l=0,d=0;for(let m of o)l+=parseFloat(m.totalCost),d+=m.operationCount;console.log(`Total Cost: $${l.toFixed(2)}`),console.log(`Total Operations: ${d.toLocaleString()}`),console.log(`Users: ${o.length}
488
488
  `);let v=e.sortBy||"cost",b=[...o].toSorted((m,h)=>v==="cost"?parseFloat(h.totalCost)-parseFloat(m.totalCost):h.operationCount-m.operationCount),x=e.limit&&e.limit>0?e.limit:b.length,C=b.slice(0,x);console.log(`Usage by User (sorted by ${v}, showing ${C.length} of ${o.length}):
489
- `);for(let m of C){let h=parseFloat(m.totalCost);console.log(` ${m.user.name} (${m.user.email})`),console.log(` Cost: $${h.toFixed(2)}`),console.log(` Operations: ${m.operationCount.toLocaleString()}`),console.log("")}C.length<o.length&&console.log(`... and ${o.length-C.length} more users`)}function qo(){console.log("entrydesk 1.3.3")}function zo(){console.log(`
489
+ `);for(let m of C){let h=parseFloat(m.totalCost);console.log(` ${m.user.name} (${m.user.email})`),console.log(` Cost: $${h.toFixed(2)}`),console.log(` Operations: ${m.operationCount.toLocaleString()}`),console.log("")}C.length<o.length&&console.log(`... and ${o.length-C.length} more users`)}function qo(){console.log("entrydesk 1.3.4")}function zo(){console.log(`
490
490
  Usage: entrydesk workspaces [list|switch|use] [options]
491
491
 
492
492
  Commands:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entrydesk/cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
5
5
  "type": "module",
6
6
  "bin": {