@entrydesk/cli 1.11.5 → 1.11.7
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 +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -200,7 +200,7 @@ ID: ${u.id}`)}}}else if(f==="connectors"){let l=Array.from(nt);S(l.length>0?l:vo
|
|
|
200
200
|
`)||it.length===0)return;if(Ge===null){yt(e);let u=it.length-1;qe(u),t(it[u]);return}let l=Math.max(0,Ge-1);qe(l),t(it[l]);return}if(g.downArrow){if(e.includes(`
|
|
201
201
|
`)||Ge===null)return;if(Ge>=it.length-1){qe(null),t(Yt);return}let l=Ge+1;qe(l),t(it[l])}}),{suggestions:q,suggestionIndex:Te,showSuggestions:ne,argMode:f,argItems:T,argIndex:U,selectedConnectorIds:nt,selectedCapabilities:Le,deleteConfirmMode:at,handleInputChange:Xt,handleSubmit:Zt}}import{useCallback as Wt,useRef as Fs,useState as js}from"react";function ir({credentials:e,currentModel:t,modelProviders:o,onUploadSuccess:r,onUploadError:n}){let[s,i]=js([]),a=Fs(0),c=Wt(h=>{if(!(!Array.isArray(o)||o.length===0)){for(let b of o)if(b.models.some(K=>K.id===h))return b.id;return o[0]?.id}},[o]),d=Wt(async h=>{if(!e){n?.(h.filename,"Not logged in");return}if(!Array.isArray(o)||o.length===0){n?.(h.filename,"Model providers not loaded yet. Please wait and try again.");return}let b=t?c(t):o[0]?.id;if(!b){n?.(h.filename,"No model provider available");return}let L=`file-${++a.current}`;i(K=>[...K,{id:L,filename:h.filename,mimeType:h.mimeType,status:"uploading"}]);try{let j=await new V().uploadFile(e.accessToken,e.workspaceId,h,b);i(se=>se.map(Y=>Y.id===L?{...Y,status:"uploaded",fileId:j.id}:Y)),r?.(h.filename)}catch(K){let j=K instanceof Error?K.message:"Upload failed";i(se=>se.map(Y=>Y.id===L?{...Y,status:"error",error:j}:Y)),n?.(h.filename,j)}},[e,t,c,o,r,n]),k=Wt(h=>{i(b=>b.filter(L=>L.id!==h))},[]),C=Wt(()=>{i([])},[]),$=Wt(()=>s.filter(h=>h.status==="uploaded"&&h.fileId).map(h=>h.fileId),[s]),S=s.some(h=>h.status==="uploading"),y=s.length>0;return{pendingFiles:s,addFile:d,removeFile:k,clearFiles:C,getUploadedFileIds:$,hasUploadingFiles:S,hasFiles:y}}import{jsx as X,jsxs as ue}from"react/jsx-runtime";var Ws=[" ______ _ ____ _","| ____| | | | _ \\ | |","| |__ _ __ | |_ _ __ _ _ | | | | ___ ___| | __","| __| | '_ \\| __| '__| | | || | | |/ _ \\/ __| |/ /","| |____| | | | |_| | | |_| || |_| | __/\\__ \\ <","|______|_| |_|\\__|_| \\__, ||____/ \\___||___/_|\\_\\"," __/ |"," |___/"],Ms=[Bo,Bo,jo,jo,pt,pt,pt,pt],lr=Ws.map((e,t)=>`${Ms[t]??pt}${e}${re}`).join(`
|
|
202
202
|
`),Js=`${pt}EntryDesk${re}`,Gs=500;function Vs(e){let t="",o=0;for(;o<e.length;){if(e.charCodeAt(o)===27&&e[o+1]==="["){for(o+=2;o<e.length;){let r=e.charCodeAt(o);if(r>=64&&r<=126){o+=1;break}o+=1}continue}t+=e[o],o+=1}return t}function Hs(e){let t=Vs(e);return Math.max(...t.split(`
|
|
203
|
-
`).map(o=>o.length))}function Ks(e){let t=Hs(lr);return e>=t?lr:Js}function cr({agentId:e,model:t,message:o,chatId:r,chatTitle:n,connectorIds:s,enableSandbox:i=!0,enableWebSearch:a=!1,enableImageGeneration:c=!1,enableChart:d=!1,enableFileSystem:k=!0}){let C=process.stdout.columns??80,$=Ks(C),S=ar(null),y=Wn(r,n),{state:h,setState:b,messages:L,setMessages:K,input:j,setInput:se,chatId:Y,setChatId:$e,currentChatTitle:F,setCurrentChatTitle:A,hasPersistedChat:N,setHasPersistedChat:R,credentials:W,setCredentials:E,currentResponse:ge,setCurrentResponse:D,fullOutput:p,setFullOutput:ie,addSystemMessage:we,startNewChat:z}=y,{credentials:P}=Jn(b);po(()=>{P&&!W&&E(P)},[P,W,E]);let{availableConnectors:ee,availableModels:Q,availableAgents:pe,modelProviders:le,loading:M}=Gn(W),{currentModel:Z,setCurrentModel:q,currentAgentId:de,setCurrentAgentId:Te,activeConnectorIds:B,setActiveConnectorIds:ne}=Qn(t,e,s),O=ar(!1);po(()=>{if(!O.current){if(O.current=!0,!t&&!e){let x=oe.getDefaultModel();x&&q(x)}if(!s&&!e){let x=oe.getDefaultConnectorIds();x&&ne(x.length>0?x:void 0)}}},[t,e,s,q,ne]);let{currentAgentDetails:f}=Zn(de,W),{sandbox:w,setSandbox:T,webSearch:te,setWebSearch:U,imageGeneration:be,setImageGeneration:nt,chart:rt,setChart:Le,fileSystem:st,setFileSystem:Co,capabilityLabelMap:zt}=Xn(i,a,c,d,k),{pendingFiles:Be,addFile:ht,removeFile:ze,clearFiles:qt,getUploadedFileIds:it,hasUploadingFiles:$o,hasFiles:Ge}=ir({credentials:W,currentModel:Z,modelProviders:le,onUploadSuccess:x=>{we(`\u2713 Attached: ${x}`)},onUploadError:(x,_)=>{we(`\u2717 Failed to upload ${x}: ${_}`)}}),{sendMessage:qe}=Kn({chatId:Y,credentials:W,currentAgentId:de,currentModel:Z,activeConnectorIds:B,sandbox:w,webSearch:te,imageGeneration:be,chart:rt,localTools:st,fullOutput:p,setMessages:K,setState:b,setCurrentResponse:D,setCredentials:E,setHasPersistedChat:R,getFileIds:it,clearFiles:qt}),Yt=Vo(x=>{z(x),D("")},[z]),[yt,ft]=Bs(!1),at=Vo(async x=>{let _=x.text.trim(),me=co(_);if(/^https?:\/\//.test(me))return;if(await Un(_)&&Rn(me)){let ce=await Fn(_);ce&&(x.preventDefault(),await ht(ce))}},[ht]),wt=Vo(async()=>{if(!(yt||h.status!=="ready")){if(M||le.length===0){we("Please wait for resources to load before pasting images.");return}we("Reading clipboard..."),ft(!0);try{let x=await Ln();if(x){let _=`clipboard-${Date.now()}.png`;we(`Uploading: ${_} (${Math.round(x.buffer.length/1024)}KB)`),await ht({buffer:x.buffer,filename:_,mimeType:x.mime})}else we("No image found in clipboard. Copy an image first.")}catch(x){let _=x instanceof Error?x.message:"Failed to read clipboard";we(`Clipboard error: ${_}`)}finally{ft(!1)}}},[ht,we,yt,h.status,M,le.length]),{suggestions:kt,suggestionIndex:xt,showSuggestions:Ee,argMode:he,argItems:Ye,argIndex:bt,selectedConnectorIds:Xt,selectedCapabilities:Et,deleteConfirmMode:Zt,handleInputChange:I,handleSubmit:g}=sr({input:j,setInput:se,chatId:Y,setChatId:$e,currentChatTitle:F,setCurrentChatTitle:A,currentModel:Z,setCurrentModel:q,currentAgentId:de,setCurrentAgentId:Te,currentAgentDetails:f,setCurrentAgentDetails:()=>{},activeConnectorIds:B,setActiveConnectorIds:ne,sandbox:w,setSandbox:T,webSearch:te,setWebSearch:U,imageGeneration:be,setImageGeneration:nt,chart:rt,setChart:Le,fileSystem:st,setFileSystem:Co,availableModels:Q,availableAgents:pe,availableConnectors:ee,messages:L,hasPersistedChat:N,setHasPersistedChat:R,setMessages:K,addSystemMessage:we,startNewChat:Yt,sendMessage:qe,setFullOutput:ie,credentials:W,setCredentials:E,setState:b,defaultCapabilities:{sandbox:i,webSearch:a,imageGeneration:c,chart:d,fileSystem:k},capabilityLabelMap:zt,hasUploadingFiles:$o});if(Jo((x,_)=>{(_.ctrl||_.meta)&&x==="v"&&wt()},{isActive:h.status==="ready"&&!he}),Jo((x,_)=>{if(!_.escape)return;let me=Date.now(),J=S.current;S.current=me,!(!J||me-J>Gs)&&(he||Ee||(S.current=null,Ge&&qt(),j.length>0&&I("")))},{isActive:h.status==="ready"}),Jo((x,_)=>{_.return&&(Yt("Started a new chat."),b({status:"ready"}))},{isActive:h.status==="error"}),po(()=>{if(W&&!M&&h.status==="loading")if(!Z&&!de){let x=oe.getDefaultModel(),_=x&&Q.some(J=>J.id===x),me=_?x:Q[0]?.id;me?(_||oe.setDefaultModel(me),q(me),b({status:"ready"})):pe.length===0?b({status:"no-model"}):b({status:"ready"})}else b({status:"ready"})},[W,M,Z,de,Q,pe,h.status,q,b]),po(()=>{o&&W&&h.status==="ready"&&qe(o)},[W,o]),h.status==="loading")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),ue(Pe,{children:[X(H,{color:"cyan",children:X(Go,{type:"dots"})}),X(H,{children:" Initializing chat..."})]})]});if(h.status==="not-logged-in")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"Not logged in"}),X(H,{dimColor:!0,children:"Run `entrydesk login` to authenticate first."})]});if(h.status==="no-workspace")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"No workspace selected"}),X(H,{dimColor:!0,children:"Run `entrydesk workspaces` to select a workspace first."})]});if(h.status==="no-model")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"No model or agent specified"}),r&&X(H,{dimColor:!0,children:"Could not determine the model used in this chat."}),X(H,{dimColor:!0,children:"Please specify a model with --model or use an agent with -a."}),X(H,{dimColor:!0,children:"Example: entrydesk chat -c 1 -i --model gemini-2.5-flash-lite"})]});if(h.status==="error")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),ue(H,{color:"red",children:["Error: ",h.message]}),X(H,{dimColor:!0,children:"Press Enter to start a new chat, or Ctrl+C to exit"})]});let l=de?f?f.connectors&&f.connectors.length>0?f.connectors.map(x=>x.name).join(", "):"none":"loading...":B&&B.length>0?ee.filter(x=>B.includes(x.id)).map(x=>x.name).join(", ")||`${B.length} connector(s)`:"none",u=[];if(de)if(f?.capabilities)for(let x of f.capabilities)u.push(zt.get(x)??x);else u.push("loading...");else w&&u.push("Sandbox"),te&&u.push("Web"),be&&u.push("Image"),rt&&u.push("Chart");st&&u.push("FileSystem");let m=G.getCurrentProfileName(),v=m!=="default";return ue(Pe,{flexDirection:"column",children:[ue(Pe,{marginBottom:1,flexDirection:"column",children:[X(H,{children:$}),ue(Pe,{children:[X(H,{bold:!0,color:"cyan",children:F?`Continuing: ${F}`:"EntryDesk CLI"}),ue(H,{dimColor:!0,children:[" v","1.11.
|
|
203
|
+
`).map(o=>o.length))}function Ks(e){let t=Hs(lr);return e>=t?lr:Js}function cr({agentId:e,model:t,message:o,chatId:r,chatTitle:n,connectorIds:s,enableSandbox:i=!0,enableWebSearch:a=!1,enableImageGeneration:c=!1,enableChart:d=!1,enableFileSystem:k=!0}){let C=process.stdout.columns??80,$=Ks(C),S=ar(null),y=Wn(r,n),{state:h,setState:b,messages:L,setMessages:K,input:j,setInput:se,chatId:Y,setChatId:$e,currentChatTitle:F,setCurrentChatTitle:A,hasPersistedChat:N,setHasPersistedChat:R,credentials:W,setCredentials:E,currentResponse:ge,setCurrentResponse:D,fullOutput:p,setFullOutput:ie,addSystemMessage:we,startNewChat:z}=y,{credentials:P}=Jn(b);po(()=>{P&&!W&&E(P)},[P,W,E]);let{availableConnectors:ee,availableModels:Q,availableAgents:pe,modelProviders:le,loading:M}=Gn(W),{currentModel:Z,setCurrentModel:q,currentAgentId:de,setCurrentAgentId:Te,activeConnectorIds:B,setActiveConnectorIds:ne}=Qn(t,e,s),O=ar(!1);po(()=>{if(!O.current){if(O.current=!0,!t&&!e){let x=oe.getDefaultModel();x&&q(x)}if(!s&&!e){let x=oe.getDefaultConnectorIds();x&&ne(x.length>0?x:void 0)}}},[t,e,s,q,ne]);let{currentAgentDetails:f}=Zn(de,W),{sandbox:w,setSandbox:T,webSearch:te,setWebSearch:U,imageGeneration:be,setImageGeneration:nt,chart:rt,setChart:Le,fileSystem:st,setFileSystem:Co,capabilityLabelMap:zt}=Xn(i,a,c,d,k),{pendingFiles:Be,addFile:ht,removeFile:ze,clearFiles:qt,getUploadedFileIds:it,hasUploadingFiles:$o,hasFiles:Ge}=ir({credentials:W,currentModel:Z,modelProviders:le,onUploadSuccess:x=>{we(`\u2713 Attached: ${x}`)},onUploadError:(x,_)=>{we(`\u2717 Failed to upload ${x}: ${_}`)}}),{sendMessage:qe}=Kn({chatId:Y,credentials:W,currentAgentId:de,currentModel:Z,activeConnectorIds:B,sandbox:w,webSearch:te,imageGeneration:be,chart:rt,localTools:st,fullOutput:p,setMessages:K,setState:b,setCurrentResponse:D,setCredentials:E,setHasPersistedChat:R,getFileIds:it,clearFiles:qt}),Yt=Vo(x=>{z(x),D("")},[z]),[yt,ft]=Bs(!1),at=Vo(async x=>{let _=x.text.trim(),me=co(_);if(/^https?:\/\//.test(me))return;if(await Un(_)&&Rn(me)){let ce=await Fn(_);ce&&(x.preventDefault(),await ht(ce))}},[ht]),wt=Vo(async()=>{if(!(yt||h.status!=="ready")){if(M||le.length===0){we("Please wait for resources to load before pasting images.");return}we("Reading clipboard..."),ft(!0);try{let x=await Ln();if(x){let _=`clipboard-${Date.now()}.png`;we(`Uploading: ${_} (${Math.round(x.buffer.length/1024)}KB)`),await ht({buffer:x.buffer,filename:_,mimeType:x.mime})}else we("No image found in clipboard. Copy an image first.")}catch(x){let _=x instanceof Error?x.message:"Failed to read clipboard";we(`Clipboard error: ${_}`)}finally{ft(!1)}}},[ht,we,yt,h.status,M,le.length]),{suggestions:kt,suggestionIndex:xt,showSuggestions:Ee,argMode:he,argItems:Ye,argIndex:bt,selectedConnectorIds:Xt,selectedCapabilities:Et,deleteConfirmMode:Zt,handleInputChange:I,handleSubmit:g}=sr({input:j,setInput:se,chatId:Y,setChatId:$e,currentChatTitle:F,setCurrentChatTitle:A,currentModel:Z,setCurrentModel:q,currentAgentId:de,setCurrentAgentId:Te,currentAgentDetails:f,setCurrentAgentDetails:()=>{},activeConnectorIds:B,setActiveConnectorIds:ne,sandbox:w,setSandbox:T,webSearch:te,setWebSearch:U,imageGeneration:be,setImageGeneration:nt,chart:rt,setChart:Le,fileSystem:st,setFileSystem:Co,availableModels:Q,availableAgents:pe,availableConnectors:ee,messages:L,hasPersistedChat:N,setHasPersistedChat:R,setMessages:K,addSystemMessage:we,startNewChat:Yt,sendMessage:qe,setFullOutput:ie,credentials:W,setCredentials:E,setState:b,defaultCapabilities:{sandbox:i,webSearch:a,imageGeneration:c,chart:d,fileSystem:k},capabilityLabelMap:zt,hasUploadingFiles:$o});if(Jo((x,_)=>{(_.ctrl||_.meta)&&x==="v"&&wt()},{isActive:h.status==="ready"&&!he}),Jo((x,_)=>{if(!_.escape)return;let me=Date.now(),J=S.current;S.current=me,!(!J||me-J>Gs)&&(he||Ee||(S.current=null,Ge&&qt(),j.length>0&&I("")))},{isActive:h.status==="ready"}),Jo((x,_)=>{_.return&&(Yt("Started a new chat."),b({status:"ready"}))},{isActive:h.status==="error"}),po(()=>{if(W&&!M&&h.status==="loading")if(!Z&&!de){let x=oe.getDefaultModel(),_=x&&Q.some(J=>J.id===x),me=_?x:Q[0]?.id;me?(_||oe.setDefaultModel(me),q(me),b({status:"ready"})):pe.length===0?b({status:"no-model"}):b({status:"ready"})}else b({status:"ready"})},[W,M,Z,de,Q,pe,h.status,q,b]),po(()=>{o&&W&&h.status==="ready"&&qe(o)},[W,o]),h.status==="loading")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),ue(Pe,{children:[X(H,{color:"cyan",children:X(Go,{type:"dots"})}),X(H,{children:" Initializing chat..."})]})]});if(h.status==="not-logged-in")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"Not logged in"}),X(H,{dimColor:!0,children:"Run `entrydesk login` to authenticate first."})]});if(h.status==="no-workspace")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"No workspace selected"}),X(H,{dimColor:!0,children:"Run `entrydesk workspaces` to select a workspace first."})]});if(h.status==="no-model")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),X(H,{color:"yellow",children:"No model or agent specified"}),r&&X(H,{dimColor:!0,children:"Could not determine the model used in this chat."}),X(H,{dimColor:!0,children:"Please specify a model with --model or use an agent with -a."}),X(H,{dimColor:!0,children:"Example: entrydesk chat -c 1 -i --model gemini-2.5-flash-lite"})]});if(h.status==="error")return ue(Pe,{flexDirection:"column",children:[X(H,{children:$}),ue(H,{color:"red",children:["Error: ",h.message]}),X(H,{dimColor:!0,children:"Press Enter to start a new chat, or Ctrl+C to exit"})]});let l=de?f?f.connectors&&f.connectors.length>0?f.connectors.map(x=>x.name).join(", "):"none":"loading...":B&&B.length>0?ee.filter(x=>B.includes(x.id)).map(x=>x.name).join(", ")||`${B.length} connector(s)`:"none",u=[];if(de)if(f?.capabilities)for(let x of f.capabilities)u.push(zt.get(x)??x);else u.push("loading...");else w&&u.push("Sandbox"),te&&u.push("Web"),be&&u.push("Image"),rt&&u.push("Chart");st&&u.push("FileSystem");let m=G.getCurrentProfileName(),v=m!=="default";return ue(Pe,{flexDirection:"column",children:[ue(Pe,{marginBottom:1,flexDirection:"column",children:[X(H,{children:$}),ue(Pe,{children:[X(H,{bold:!0,color:"cyan",children:F?`Continuing: ${F}`:"EntryDesk CLI"}),ue(H,{dimColor:!0,children:[" v","1.11.7"]}),v&&ue(H,{color:"magenta",children:[" [",m,"]"]}),X(H,{dimColor:!0,children:" (type /help for commands)"})]})]}),L.map((x,_)=>{let me=x.parts&&p?mt(x.parts,!0):x.content,J=x.role==="user"?"green":x.role==="system"?"yellow":"blue",ce=x.role==="user"?"You":x.role==="system"?"System":"Assistant";return ue(Pe,{flexDirection:"column",marginBottom:1,children:[ue(H,{bold:!0,color:J,children:[ce,":"]}),X(Fo,{text:me})]},_)}),ge&&ue(Pe,{flexDirection:"column",marginBottom:1,children:[X(H,{bold:!0,color:"blue",children:"Assistant:"}),X(Fo,{text:ge})]}),h.status==="ready"&&X(wn,{suggestions:kt,activeIndex:xt,visible:Ee}),h.status==="ready"&&he&&X(yn,{items:Ye,activeIndex:bt,pageSize:he==="agent"||he==="skills"||he==="model"?5:10,selectedIds:he==="connectors"?Xt:he==="capabilities"?Et: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?ue(Pe,{children:[X(H,{color:"cyan",children:X(Go,{type:"dots"})}),X(H,{children:" Thinking..."})]}):h.status==="ready"&&!he?ue(Pe,{flexDirection:"column",children:[Zt&&X(Pe,{marginBottom:1,children:X(H,{color:"yellow",children:"\u26A0\uFE0F Delete this chat? (y/N) "})}),Ge&&!Zt&&ue(Pe,{marginBottom:1,flexDirection:"row",gap:1,children:[X(H,{dimColor:!0,children:"Attachments:"}),Be.map((x,_)=>ue(H,{children:[x.status==="uploading"?ue(H,{color:"yellow",children:[X(Go,{type:"dots"})," ",x.filename]}):x.status==="error"?ue(H,{color:"red",children:["\u2717 ",x.filename]}):ue(H,{color:"green",children:["\u2713 ",x.filename]}),_<Be.length-1&&X(H,{children:", "})]},x.id))]}),ue(Pe,{children:[X(H,{color:"green",children:"> "}),X(In,{value:j,onChange:I,onSubmit:g,onPaste:at,leadingOffset:2,multiline:!0})]})]}):null,ue(Pe,{marginTop:1,flexDirection:"column",children:[ue(Pe,{gap:2,children:[ue(H,{children:[X(H,{dimColor:!0,children:"Model: "}),X(H,{color:"magenta",children:de?f?.model?.name||"loading...":Q.find(x=>x.id===Z)?.name||Z||"none"})]}),ue(H,{children:[X(H,{dimColor:!0,children:"Connectors: "}),X(H,{color:"cyan",children:l})]}),ue(H,{children:[X(H,{dimColor:!0,children:"Capabilities: "}),X(H,{color:"green",children:u.length>0?u.join(", "):"none"})]})]}),ue(H,{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 Zs}from"react/jsx-runtime";async function qs(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}async function Ys(e,t,o,r){if(r<1)return console.error("Chat number must be 1 or greater"),null;let{chats:n}=await e.getChats(t,o,20);if(n.length===0)return console.error("No chats found. Start a new chat first."),null;if(r>n.length)return console.error(`Chat number ${r} not found. You have ${n.length} recent chats.`),console.error("Use `entrydesk chats` to see available chats."),null;let s=n[r-1],i;if(!s.agentId){let{messages:a}=await e.getMessages(t,o,s.id,10);i=a.find(d=>d.role==="assistant"&&d.modelId)?.modelId}return{chat:s,modelId:i}}var Tt="\x1B[2m",Oe="\x1B[0m",Ho="\x1B[36m",pr="\x1B[33m",go="\x1B[32m",ur="stream-json";function dr(e,t,o,r){e&&t&&(console.error(`Error: Cannot use both ${o} and ${r}`),process.exit(1))}function ho(e,t){let o=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(o)}
|
|
204
204
|
`)}function yo(e,t){if(t)return e;let o=e.split(`
|
|
205
205
|
`);if(o.length<=20)return e;let r=o.slice(0,5),n=o.slice(-5),s=o.length-10;return[...r,`${Tt}... (${s} lines omitted, use --full-output to see all) ...${Oe}`,...n].join(`
|
|
206
206
|
`)}function Xs(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function fr(e,t){if(!e)return"(no result)";if(typeof e!="object")return yo(String(e),t);let o=e;if("structuredContent"in o&&o.structuredContent){let r=o.structuredContent,n=[];if(r.stdout&&typeof r.stdout=="string"&&r.stdout.trim()&&n.push(r.stdout.trim()),r.stderr&&typeof r.stderr=="string"&&r.stderr.trim()&&n.push(`${pr}[stderr]${Oe} ${r.stderr.trim()}`),r.urls&&Array.isArray(r.urls)){let s=r.urls;for(let i of s)i.path&&i.url&&n.push(`${i.path}: ${i.url}`)}return n.length===0&&n.push(JSON.stringify(r,null,2)),yo(n.join(`
|
|
@@ -528,7 +528,7 @@ Examples:
|
|
|
528
528
|
`)}async function Jr(e){if(e.help){Gi();return}let t,o;try{let y=await fe();t=y.accessToken,o=y.workspaceId}catch(y){let h=y instanceof Error?y.message:"Authentication failed";console.error(h),process.exit(1)}let r=new V,n=[],s,i=0,a=100;do{let y=await r.getMonthlyUsages(t,o,{nextKey:s,limit:100});if(n.push(...y.monthlyUsages),s=y.nextKey,i++,i>=a){console.error(`Warning: Showing first ${n.length} entries (pagination limit reached)`);break}}while(s);if(e.json){console.log(JSON.stringify(n));return}if(n.length===0){console.log("No usage data found for this workspace.");return}console.log(`Current Month Usage:
|
|
529
529
|
`);let c=0,d=0;for(let y of n)c+=parseFloat(y.totalCost),d+=y.operationCount;console.log(`Total Cost: $${c.toFixed(2)}`),console.log(`Total Operations: ${d.toLocaleString()}`),console.log(`Users: ${n.length}
|
|
530
530
|
`);let k=e.sortBy||"cost",C=[...n].toSorted((y,h)=>k==="cost"?parseFloat(h.totalCost)-parseFloat(y.totalCost):h.operationCount-y.operationCount),$=e.limit&&e.limit>0?e.limit:C.length,S=C.slice(0,$);console.log(`Usage by User (sorted by ${k}, showing ${S.length} of ${n.length}):
|
|
531
|
-
`);for(let y of S){let h=parseFloat(y.totalCost);console.log(` ${y.user.name} (${y.user.email})`),console.log(` Cost: $${h.toFixed(2)}`),console.log(` Operations: ${y.operationCount.toLocaleString()}`),console.log("")}S.length<n.length&&console.log(`... and ${n.length-S.length} more users`)}function en(){console.log("entrydesk 1.11.
|
|
531
|
+
`);for(let y of S){let h=parseFloat(y.totalCost);console.log(` ${y.user.name} (${y.user.email})`),console.log(` Cost: $${h.toFixed(2)}`),console.log(` Operations: ${y.operationCount.toLocaleString()}`),console.log("")}S.length<n.length&&console.log(`... and ${n.length-S.length} more users`)}function en(){console.log("entrydesk 1.11.7")}function tn(){console.log(`
|
|
532
532
|
Usage: entrydesk workspaces [list|switch|use] [options]
|
|
533
533
|
|
|
534
534
|
Commands:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entrydesk/cli",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.7",
|
|
4
4
|
"description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@modelcontextprotocol/sdk": "1.
|
|
14
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
15
15
|
"adm-zip": "^0.5.16",
|
|
16
16
|
"archiver": "^7.0.1",
|
|
17
17
|
"glob": "^13.0.1",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
39
|
"typescript": "6.0.2",
|
|
40
40
|
"vitest": "^4.1.1",
|
|
41
|
-
"@entrydesk/shared": "0.0.0"
|
|
41
|
+
"@entrydesk/shared": "^0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
44
|
"keytar": "^7.9.0"
|