@entrydesk/cli 1.23.1 → 1.24.0

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 (34) hide show
  1. package/dist/agents-DFOYNMYK.js +43 -0
  2. package/dist/{billing-QKAGGKLE.js → billing-SAYH5EB7.js} +1 -1
  3. package/dist/{budget-VDIBB2G7.js → budget-VMRIKUAD.js} +1 -1
  4. package/dist/chunk-AJ4WRMUZ.js +97 -0
  5. package/dist/{chunk-YKH2UWFC.js → chunk-UWTX2MZZ.js} +2 -2
  6. package/dist/{config-ZZEWQRKI.js → config-DD5WRAEN.js} +1 -1
  7. package/dist/{config-EHPADRGK.js → config-TFD5BJJO.js} +1 -1
  8. package/dist/{config-help-MDC62DDX.js → config-help-DS2LTR5S.js} +1 -1
  9. package/dist/{connectors-NKSDT2HG.js → connectors-FHYWNO5W.js} +1 -1
  10. package/dist/index.js +1 -1
  11. package/dist/{login-O77HDVW3.js → login-CJAEUMVX.js} +1 -1
  12. package/dist/{logout-A7CYWGTM.js → logout-FQMPTUEL.js} +1 -1
  13. package/dist/{marketplace-CAXL5PH4.js → marketplace-LIW2SN7A.js} +5 -5
  14. package/dist/{mcp-D7GHEFAP.js → mcp-FW5USUH2.js} +3 -3
  15. package/dist/{meeting-6YXQJKT5.js → meeting-5BTYIWGD.js} +1 -1
  16. package/dist/{models-BQT6MNN3.js → models-Y2Q2FX4V.js} +1 -1
  17. package/dist/{notifications-ZE4MQURK.js → notifications-4U7KBVDF.js} +1 -1
  18. package/dist/{profile-PQUC4VYR.js → profile-HEUIWMVW.js} +1 -1
  19. package/dist/{recordings-EIAQWZ6J.js → recordings-LKICUUCK.js} +1 -1
  20. package/dist/{schedules-LWXLUKOS.js → schedules-QZUI6HKS.js} +1 -1
  21. package/dist/skills-B5E2GJFV.js +30 -0
  22. package/dist/{status-XMD5WLMC.js → status-VF7DKVXN.js} +1 -1
  23. package/dist/{task-53WFEYLH.js → task-NMVJ4NDH.js} +50 -50
  24. package/dist/{tasks-7T7RUCWK.js → tasks-PDRHMFWK.js} +13 -13
  25. package/dist/tool-SF3NK5EN.js +35 -0
  26. package/dist/{usage-4F4AGUYD.js → usage-PVIH4OC6.js} +1 -1
  27. package/dist/{version-ULX7NNGK.js → version-4TEIO7G3.js} +1 -1
  28. package/dist/{workflow-LUR7AL3C.js → workflow-FXSMA7T3.js} +11 -11
  29. package/dist/{workspaces-65YARQ7K.js → workspaces-3KKM3FBA.js} +1 -1
  30. package/package.json +5 -5
  31. package/dist/agents-JCLIHY4P.js +0 -43
  32. package/dist/chunk-DJHTNXHH.js +0 -97
  33. package/dist/skills-INLQDLRZ.js +0 -30
  34. package/dist/tool-J25QCBER.js +0 -35
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import{h as I,q as A,r as O,t as v}from"./chunk-YKH2UWFC.js";import"./chunk-KURQCTT3.js";var h="\x1B[2m",c="\x1B[0m",p="\x1B[36m",T="\x1B[33m",b="\x1B[32m",R="stream-json";function f(t,n){let r=n===void 0?{event:t}:{event:t,data:n};process.stdout.write(`${JSON.stringify(r)}
3
- `)}function S(t){let n=new Date(t),e=new Date().getTime()-n.getTime(),o=Math.floor(e/(1e3*60*60*24));return o===0?n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}):o===1?"Yesterday":o<7?`${o} days ago`:n.toLocaleDateString("en-US",{month:"short",day:"numeric"})}var M="\x1B[1m";function j(t){return t.replace(/<mark>/g,M).replace(/<\/mark>/g,c).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function w(t,n){if(n)return t;let r=t.split(`
2
+ import{h as I,p as A,q as O,s as v}from"./chunk-UWTX2MZZ.js";import"./chunk-KURQCTT3.js";var h="\x1B[2m",c="\x1B[0m",p="\x1B[36m",N="\x1B[33m",R="\x1B[32m",j="stream-json";function f(t,n){let r=n===void 0?{event:t}:{event:t,data:n};process.stdout.write(`${JSON.stringify(r)}
3
+ `)}function S(t){let n=new Date(t),e=new Date().getTime()-n.getTime(),o=Math.floor(e/(1e3*60*60*24));return o===0?n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}):o===1?"Yesterday":o<7?`${o} days ago`:n.toLocaleDateString("en-US",{month:"short",day:"numeric"})}var M="\x1B[1m";function J(t){return t.replace(/<mark>/g,M).replace(/<\/mark>/g,c).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}function w(t,n){if(n)return t;let r=t.split(`
4
4
  `);if(r.length<=15)return t;let e=r.slice(0,6),o=r.slice(-4),i=r.length-10;return[...e,`... (${i} lines omitted, use --full-output to see all) ...`,...o].join(`
5
- `)}function N(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(N);let n={};for(let[r,e]of Object.entries(t))typeof e=="string"&&e.length>200?n[r]=e.slice(0,150)+"... (truncated)":typeof e=="object"&&e!==null?n[r]=N(e):n[r]=e;return n}function J(t){if(!t||typeof t!="object")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function E(t,n){if(!t)return"(no result)";if(typeof t!="object")return w(String(t),n);let r=n?t:N(t);if("structuredContent"in r&&r.structuredContent){let e=r.structuredContent,o=[];if(e.stdout&&typeof e.stdout=="string"&&e.stdout.trim()&&o.push(e.stdout.trim()),e.stderr&&typeof e.stderr=="string"&&e.stderr.trim()&&o.push(`${T}[stderr]${c} ${e.stderr.trim()}`),e.urls&&Array.isArray(e.urls)){let i=e.urls;for(let s of i)s.path&&s.url&&o.push(`${s.path}: ${s.url}`)}return o.length===0&&o.push(JSON.stringify(e,null,2)),w(o.join(`
5
+ `)}function x(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(x);let n={};for(let[r,e]of Object.entries(t))typeof e=="string"&&e.length>200?n[r]=e.slice(0,150)+"... (truncated)":typeof e=="object"&&e!==null?n[r]=x(e):n[r]=e;return n}function E(t){if(!t||typeof t!="object")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function L(t,n){if(!t)return"(no result)";if(typeof t!="object")return w(String(t),n);let r=n?t:x(t);if("structuredContent"in r&&r.structuredContent){let e=r.structuredContent,o=[];if(e.stdout&&typeof e.stdout=="string"&&e.stdout.trim()&&o.push(e.stdout.trim()),e.stderr&&typeof e.stderr=="string"&&e.stderr.trim()&&o.push(`${N}[stderr]${c} ${e.stderr.trim()}`),e.urls&&Array.isArray(e.urls)){let i=e.urls;for(let s of i)s.path&&s.url&&o.push(`${s.path}: ${s.url}`)}return o.length===0&&o.push(JSON.stringify(e,null,2)),w(o.join(`
6
6
  `),n)}if("content"in r&&Array.isArray(r.content)){let o=r.content.filter(i=>i.type==="text"&&i.text).map(i=>i.text).join(`
7
- `);return w(o||JSON.stringify(t,null,2),n)}return w(JSON.stringify(t,null,2),n)}function D(t){if(typeof t.title=="string")return t.title;if(typeof t.toolName=="string")return t.toolName;let n=t.type;return n.startsWith("tool-")?n.slice(5).replace(/__/g," ").replace(/_/g," "):n}function L(t,n){let r=[];for(let e of t)if(e.type==="reasoning"&&e.text)r.push(`${h}${e.text}${c}`);else if(e.type==="text"&&e.text)r.push(e.text);else if(e.type==="tool-call"&&e.toolName){let o=[];if(o.push(`${p}\u250C\u2500 Tool Call: ${e.toolName}${c}`),e.args){o.push(`${T}\u2502 Arguments:${c}`);let i=J(e.args);for(let s of i.split(`
8
- `))o.push(`${h}\u2502 ${s}${c}`)}if(e.result!==void 0){o.push(`${b}\u2502 Result:${c}`);let i=E(e.result,n);for(let s of i.split(`
7
+ `);return w(o||JSON.stringify(t,null,2),n)}return w(JSON.stringify(t,null,2),n)}function D(t){if(typeof t.title=="string")return t.title;if(typeof t.toolName=="string")return t.toolName;let n=t.type;return n.startsWith("tool-")?n.slice(5).replace(/__/g," ").replace(/_/g," "):n}function b(t,n){let r=[];for(let e of t)if(e.type==="reasoning"&&e.text)r.push(`${h}${e.text}${c}`);else if(e.type==="text"&&e.text)r.push(e.text);else if(e.type==="tool-call"&&e.toolName){let o=[`${p}\u250C\u2500 Tool Call: ${e.toolName}${c}`];if(e.args){o.push(`${N}\u2502 Arguments:${c}`);let i=E(e.args);for(let s of i.split(`
8
+ `))o.push(`${h}\u2502 ${s}${c}`)}if(e.result!==void 0){o.push(`${R}\u2502 Result:${c}`);let i=L(e.result,n);for(let s of i.split(`
9
9
  `))o.push(`${h}\u2502 ${s}${c}`);o.push(`${p}\u2514\u2500 ${e.toolName} completed${c}`)}else e.state==="call"?o.push(`${p}\u2514\u2500 (awaiting result)${c}`):o.push(`${p}\u2514\u2500${c}`);r.push(o.join(`
10
- `))}else if(e.type.startsWith("tool-")&&e.type!=="tool-call"){let o=D(e),i=[];if(i.push(`${p}\u250C\u2500 Tool: ${o}${c}`),e.input){i.push(`${T}\u2502 Input:${c}`);let s=J(e.input);for(let l of s.split(`
11
- `))i.push(`${h}\u2502 ${l}${c}`)}if(e.output!==void 0&&e.state==="output-available"){i.push(`${b}\u2502 Output:${c}`);let s=E(e.output,n);for(let l of s.split(`
10
+ `))}else if(e.type.startsWith("tool-")&&e.type!=="tool-call"){let o=D(e),i=[`${p}\u250C\u2500 Tool: ${o}${c}`];if(e.input){i.push(`${N}\u2502 Input:${c}`);let s=E(e.input);for(let l of s.split(`
11
+ `))i.push(`${h}\u2502 ${l}${c}`)}if(e.output!==void 0&&e.state==="output-available"){i.push(`${R}\u2502 Output:${c}`);let s=L(e.output,n);for(let l of s.split(`
12
12
  `))i.push(`${h}\u2502 ${l}${c}`);i.push(`${p}\u2514\u2500 completed${c}`)}else e.state==="call"||e.state==="partial-call"?i.push(`${p}\u2514\u2500 (in progress)${c}`):i.push(`${p}\u2514\u2500${c}`);r.push(i.join(`
13
13
  `))}return r.join(`
14
14
 
@@ -32,10 +32,10 @@ Examples:
32
32
  entrydesk tasks <taskId> # View a task's messages
33
33
  entrydesk tasks <taskId> --full-output # ...with full tool outputs
34
34
  entrydesk tasks -s <shareId> # View a shared task
35
- `)}async function q(t){if(t.help){U();return}let n=t.output===R;t.output&&!n&&(console.error(`Invalid --output value. Supported: ${R}`),process.exit(1));let r=new I;if(t.shareId){let s;try{s=await A()}catch{}try{let l=await r.getSharedTask(t.shareId,s),{messages:a}=await r.getSharedMessages(t.shareId,50,s);if(t.json){console.log(JSON.stringify({task:l,messages:a}));return}if(n){if(f("task",l),a.length===0)f("info","No messages in this shared task.");else for(let u of a.toReversed())f("message",u);f("done");return}if(console.log(`Shared Task: ${l.title||"Untitled"}`),console.log(`Visibility: ${l.visibility}`),l.agent&&console.log(`Agent: ${l.agent.name}`),console.log(`${a.length} messages
36
- `),a.length===0){console.log("No messages in this shared task.");return}let d=a.toReversed(),$=t.fullOutput??!1;for(let u of d){let y=L(u.parts,$);if(!y)continue;let x=u.role==="user"?"You":"Assistant";console.log(`[${x}] ${S(u.createdAt)}`),console.log(y),console.log("")}return}catch(l){if(l instanceof Error){let a=l.message.toLowerCase();a.includes("401")||a.includes("unauthorized")?console.error("Access denied. This shared task requires authentication or is not accessible to you."):a.includes("404")||a.includes("not found")?console.error("Shared task not found. The share ID may be invalid or the task was deleted."):console.error(`Failed to fetch shared task: ${l.message}`)}else console.error("Failed to fetch shared task");process.exit(1)}}let e,o;try{let s=await O();e=s.accessToken,o=s.workspaceId}catch(s){v(s)}if(t.taskId){let s=t.taskId,l=!1,a=null,d=parseInt(t.taskId,10);if(!isNaN(d)&&d>=0&&/^\d+$/.test(t.taskId)){let g=d===0?1:d,{tasks:k}=await r.getTasks(e,o,20);g>k.length&&(console.error(`Task number ${g} not found. You have ${k.length} recent tasks.`),process.exit(1));let m=k[g-1];s=m.id,l=!0,a=m,n||console.log(`Task: ${m.title||"Untitled"}
37
- `)}let{messages:u}=await r.getMessages(e,o,s,50);if(t.json){console.log(JSON.stringify(u));return}if(n){if(a&&f("task",a),u.length===0)f("info","No messages in this task.");else for(let g of u.toReversed())f("message",g);f("done");return}if(u.length===0){console.log("No messages in this task.");return}let y=u.toReversed(),x=t.fullOutput??!1;l||console.log(`Task: ${t.taskId.slice(0,8)}...`),console.log(`${u.length} messages
38
- `);for(let g of y){let k=L(g.parts,x);if(!k)continue;let m=g.role==="user"?"You":"Assistant";console.log(`[${m}] ${S(g.createdAt)}`),console.log(k),console.log("")}return}if(t.search){let{results:s,nextKey:l}=await r.searchTasks(e,o,t.search,{limit:t.limit,nextKey:t.nextKey});if(n){for(let a of s)f("task",a);f("done");return}if(t.json){console.log(JSON.stringify({results:s,nextKey:l}));return}if(s.length===0){console.log(`No tasks match "${t.search}".`);return}console.log(`Search results for "${t.search}" (${s.length}):
39
- `),s.forEach((a,d)=>{let $=(d+1).toString().padStart(2," "),u=a.titleHighlight?j(a.titleHighlight):a.title||"Untitled";console.log(` ${$}. ${h}${S(a.createdAt)}${c} ${u}`),a.contentSnippet&&console.log(` ${j(a.contentSnippet)}`),console.log(` ${h}ID: ${a.id}${c}`)}),l&&console.log(`
35
+ `)}async function V(t){if(t.help){U();return}let n=t.output===j;t.output&&!n&&(console.error(`Invalid --output value. Supported: ${j}`),process.exit(1));let r=new I;if(t.shareId){let s;try{s=await A()}catch{}try{let l=await r.getSharedTask(t.shareId,s),{messages:a}=await r.getSharedMessages(t.shareId,50,s);if(t.json){console.log(JSON.stringify({task:l,messages:a}));return}if(n){if(f("task",l),a.length===0)f("info","No messages in this shared task.");else for(let u of a.toReversed())f("message",u);f("done");return}if(console.log(`Shared Task: ${l.title||"Untitled"}`),console.log(`Visibility: ${l.visibility}`),l.agent&&console.log(`Agent: ${l.agent.name}`),console.log(`${a.length} messages
36
+ `),a.length===0){console.log("No messages in this shared task.");return}let d=a.toReversed(),$=t.fullOutput??!1;for(let u of d){let y=b(u.parts,$);if(!y)continue;let T=u.role==="user"?"You":"Assistant";console.log(`[${T}] ${S(u.createdAt)}`),console.log(y),console.log("")}return}catch(l){if(l instanceof Error){let a=l.message.toLowerCase();a.includes("401")||a.includes("unauthorized")?console.error("Access denied. This shared task requires authentication or is not accessible to you."):a.includes("404")||a.includes("not found")?console.error("Shared task not found. The share ID may be invalid or the task was deleted."):console.error(`Failed to fetch shared task: ${l.message}`)}else console.error("Failed to fetch shared task");process.exit(1)}}let e,o;try{let s=await O();e=s.accessToken,o=s.workspaceId}catch(s){v(s)}if(t.taskId){let s=t.taskId,l=!1,a=null,d=parseInt(t.taskId,10);if(!isNaN(d)&&d>=0&&/^\d+$/.test(t.taskId)){let g=d===0?1:d,{tasks:k}=await r.getTasks(e,o,20);g>k.length&&(console.error(`Task number ${g} not found. You have ${k.length} recent tasks.`),process.exit(1));let m=k[g-1];s=m.id,l=!0,a=m,n||console.log(`Task: ${m.title||"Untitled"}
37
+ `)}let{messages:u}=await r.getMessages(e,o,s,50);if(t.json){console.log(JSON.stringify(u));return}if(n){if(a&&f("task",a),u.length===0)f("info","No messages in this task.");else for(let g of u.toReversed())f("message",g);f("done");return}if(u.length===0){console.log("No messages in this task.");return}let y=u.toReversed(),T=t.fullOutput??!1;l||console.log(`Task: ${t.taskId.slice(0,8)}...`),console.log(`${u.length} messages
38
+ `);for(let g of y){let k=b(g.parts,T);if(!k)continue;let m=g.role==="user"?"You":"Assistant";console.log(`[${m}] ${S(g.createdAt)}`),console.log(k),console.log("")}return}if(t.search){let{results:s,nextKey:l}=await r.searchTasks(e,o,t.search,{limit:t.limit,nextKey:t.nextKey});if(n){for(let a of s)f("task",a);f("done");return}if(t.json){console.log(JSON.stringify({results:s,nextKey:l}));return}if(s.length===0){console.log(`No tasks match "${t.search}".`);return}console.log(`Search results for "${t.search}" (${s.length}):
39
+ `),s.forEach((a,d)=>{let $=(d+1).toString().padStart(2," "),u=a.titleHighlight?J(a.titleHighlight):a.title||"Untitled";console.log(` ${$}. ${h}${S(a.createdAt)}${c} ${u}`),a.contentSnippet&&console.log(` ${J(a.contentSnippet)}`),console.log(` ${h}ID: ${a.id}${c}`)}),l&&console.log(`
40
40
  Next page: --next-key ${l}`);return}let{tasks:i}=await r.getTasks(e,o,20);if(n){for(let s of i)f("task",s);f("done");return}if(t.json){console.log(JSON.stringify(i));return}if(i.length===0){console.log("No tasks found.");return}console.log(`Recent Tasks (${i.length}):
41
- `),i.forEach((s,l)=>{let a=(l+1).toString().padStart(2," ");console.log(` ${a}. ${S(s.createdAt).padEnd(12)} ${s.title||"Untitled"}`)}),console.log(""),console.log("Use `entrydesk tasks 1` to view the most recent task"),console.log('Use `entrydesk task -c 1 -m "message"` to continue it')}export{U as printTasksHelp,j as renderHighlight,q as runTasks};
41
+ `),i.forEach((s,l)=>{let a=(l+1).toString().padStart(2," ");console.log(` ${a}. ${S(s.createdAt).padEnd(12)} ${s.title||"Untitled"}`)}),console.log(""),console.log("Use `entrydesk tasks 1` to view the most recent task"),console.log('Use `entrydesk task -c 1 -m "message"` to continue it')}export{U as printTasksHelp,J as renderHighlight,V as runTasks};
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import{c as S,q as _}from"./chunk-UWTX2MZZ.js";import"./chunk-KURQCTT3.js";import R from"fs";import{Client as x}from"@modelcontextprotocol/sdk/client/index.js";import{StreamableHTTPClientTransport as v}from"@modelcontextprotocol/sdk/client/streamableHttp.js";async function A(t={}){let e=t.apiUrl,n=t.accessToken,o=t.workspaceId;if(!n||!o){let l=await _();n=n||l.accessToken,o=o||l.workspaceId}e||(e=S().apiUrl);let i=new x({name:"entrydesk-cli",version:"1.0.0"}),s=new URL(`${e}/v1/workspaces/${o}/mcp`),r=new v(s,{requestInit:{headers:{Authorization:`Bearer ${n}`}}});return await i.connect(r),i}async function T(){return A()}import h from"fs/promises";import D from"os";import d from"path";var y=!process.env.NO_COLOR&&!!process.stdout.isTTY,p={green:y?"\x1B[32m":"",yellow:y?"\x1B[33m":"",reset:y?"\x1B[0m":""},P=10*1024,O=8*1024,I=2*1024,b=100,M=100;function U(){return d.join(D.homedir(),".entrydesk","tool-results")}function B(t){let e=t.trim().replace(/[/\\:*?"<>|\s]/g,"_").replace(/_+/g,"_").replace(/^[._]+|[._]+$/g,"").slice(0,b);return!e||e==="."||e===".."?"unnamed_tool":e}function F(t){try{return JSON.stringify(t,(e,n)=>typeof n=="bigint"?`${n}n`:typeof n=="function"?"[Function]":typeof n=="symbol"?n.toString():n,2)}catch{return String(t)}}function J(t){let e=new Date,n=[e.getFullYear(),String(e.getMonth()+1).padStart(2,"0"),String(e.getDate()).padStart(2,"0")].join("-")+"_"+[String(e.getHours()).padStart(2,"0"),String(e.getMinutes()).padStart(2,"0"),String(e.getSeconds()).padStart(2,"0")].join("-"),o=B(t);return`${n}_${o}.json`}async function N(t,e){try{return await h.writeFile(t,e,{encoding:"utf8",flag:"wx"}),!0}catch(n){if(n instanceof Error&&"code"in n&&n.code==="EEXIST")return!1;throw n}}async function C(t,e){try{let n=U();await h.mkdir(n,{recursive:!0});let o=J(t),i=d.extname(o),s=o.slice(0,-i.length),r=F(e),l=d.join(n,o);if(await N(l,r))return l;for(let c=1;c<=M;c++){let w=d.join(n,`${s}-${c}${i}`);if(await N(w,r))return w}let u=Math.random().toString(36).slice(2,10),a=d.join(n,`${s}-${u}${i}`);return await h.writeFile(a,r,{encoding:"utf8",flag:"wx"}),a}catch(n){let o=n instanceof Error?n.message:"unknown error";return console.error(`${p.yellow}Warning: Could not save result to file: ${o}${p.reset}`),null}}function k(t,e){let n=Buffer.byteLength(t,"utf8");if(n<=P)return t;let o=t.slice(0,O),i=t.slice(-I),r=((n-O-I)/1024).toFixed(1),l=(n/1024).toFixed(1),u=` ... (skipped ${r}KB of ${l}KB) ...`;return e&&(u+=`
3
+ Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${o}
4
+
5
+ ${u}
6
+
7
+ ${i}`}function $(t){console.log(`${p.green}Tool execution result saved to: ${t}${p.reset}`),console.log()}function E(){console.log(`${p.green}Tool execution result:${p.reset}`)}function H(t){return t.split("__")[0]??t}function f(t,e,n){console.error(n?JSON.stringify({error:{code:t,message:e}}):`Error [${t}]: ${e}`),process.exit(1)}function g(t,e,n="CONNECTION_FAILED"){let o=t instanceof Error?t.message:"Unknown error";o.includes("Not logged in")||o.includes("not-logged-in")?f("AUTH_MISSING",o,e):f(n,o,e)}async function Y(){return process.stdin.isTTY?null:new Promise(t=>{let e=[],n=!1,o=!1,i,s,r,l,u=()=>{clearTimeout(i),process.stdin.removeListener("data",s),process.stdin.removeListener("end",r),process.stdin.removeListener("error",l)},a=c=>{o||(o=!0,u(),t(c))};s=c=>{n=!0,clearTimeout(i),e.push(c)},r=()=>{e.length===0?a(null):a(Buffer.concat(e).toString("utf-8").trim())},l=()=>{a(null)},i=setTimeout(()=>{n||a(null)},100),process.stdin.on("data",s),process.stdin.on("end",r),process.stdin.on("error",l),process.stdin.resume()})}var m=class extends Error{constructor(e){super(e),this.name="InputError"}};async function V(t,e){if(t)return t;if(e)try{return R.readFileSync(e,"utf-8").trim()}catch(o){let i=o instanceof Error?o.message:"Failed to read input file";throw new m(`Failed to read input file: ${i}`)}let n=await Y();if(n)return n;throw new m("Input JSON is required. Use --input, --input-file, or pipe via stdin")}function q(t){let e=[`Tool: ${t.name}`];return t.description&&e.push(` Description: ${t.description}`),e.join(`
8
+ `)}function X(t){let e=[`Tool: ${t.name}`];return t.description&&(e.push("Description:"),e.push(` ${t.description}`)),e.push("Input Schema:"),e.push(JSON.stringify(t.inputSchema,null,2)),e.join(`
9
+ `)}async function z(t,e){let n=await T().catch(o=>{g(o,t)});try{let i=(await n.listTools()).tools;if(e){let s=e.toLowerCase();i=i.filter(r=>H(r.name).toLowerCase().startsWith(s))}if(t)console.log(JSON.stringify(i,null,2));else{let s=e?` (prefix: ${e})`:"";console.log(`Available Tools (${i.length})${s}:
10
+ `);for(let r of i)console.log(q(r)),console.log()}}catch(o){g(o,t)}finally{await n.close().catch(()=>{})}}async function G(t,e){let n=await T().catch(o=>{g(o,e)});try{let i=(await n.listTools()).tools.find(s=>s.name===t);i||f("TOOL_NOT_FOUND",`Tool not found: ${t}`,e),console.log(e?JSON.stringify(i,null,2):X(i))}catch(o){g(o,e)}finally{await n.close().catch(()=>{})}}async function K(t,e,n){let o;try{o=JSON.parse(e)}catch(r){let l=r instanceof Error?`Invalid JSON input: ${r.message}`:"Invalid JSON input";f("INVALID_INPUT",l,n)}let i=await T().catch(r=>{g(r,n,"TOOL_CALL_FAILED")}),s=!1;try{let r=await i.callTool({name:t,arguments:o});if(n)console.log(JSON.stringify(r,null,2));else{let l=await C(t,r);l&&$(l),E();let u=r.content;for(let a of u)a.type==="text"?console.log(a.text):a.type==="image"?console.log(`[Image: ${a.mimeType}]`):a.type==="resource"?console.log(`[Resource: ${a.resource?.uri??"unknown"}]`):console.log(JSON.stringify(a,null,2));if(r.structuredContent){let a=JSON.stringify(r.structuredContent,null,2),c=k(a,l);console.log(c)}}r.isError&&(s=!0)}catch(r){g(r,n,"TOOL_CALL_FAILED")}finally{await i.close().catch(()=>{})}s&&process.exit(1)}function L(){console.log(`Usage: entrydesk tool <action> [options]
11
+
12
+ Actions:
13
+ list List all available tools
14
+ get <name> Get details of a specific tool
15
+ call <name> Call a tool with JSON input
16
+
17
+ Options:
18
+ --json Output in JSON format
19
+ -p, --prefix <name> Filter tools by prefix (for 'list' action)
20
+ -i, --input <json> JSON input for tool call
21
+ -f, --input-file <path> Read JSON input from file
22
+
23
+ Input Priority (for 'call' action):
24
+ 1. --input flag (direct JSON string)
25
+ 2. --input-file flag (read from file)
26
+ 3. stdin (piped input)
27
+
28
+ Examples:
29
+ entrydesk tool list
30
+ entrydesk tool list --prefix agent
31
+ entrydesk tool get agent__search_agents
32
+ entrydesk tool call agent__search_agents --input '{"limit": 5}'
33
+ entrydesk tool call agent__search_agents --input-file input.json
34
+ echo '{"limit": 5}' | entrydesk tool call agent__search_agents
35
+ `)}async function at(t){let e=t.json??!1;if(t.help){L();return}switch(t.action){case"list":await z(e,t.prefix);break;case"get":t.name||f("INVALID_INPUT","Tool name is required",e),await G(t.name,e);break;case"call":{t.name||f("INVALID_INPUT","Tool name is required",e);let n;try{n=await V(t.input,t.inputFile)}catch(o){throw o instanceof m&&f("INVALID_INPUT",o.message,e),o}await K(t.name,n,e);break}default:L();break}}export{m as InputError,V as getInputJson,L as printToolUsage,Y as readStdin,at as runTool};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{h as d,r as y,t as U}from"./chunk-YKH2UWFC.js";import"./chunk-KURQCTT3.js";import{writeFileSync as S}from"fs";function $(){console.log(`
2
+ import{h as d,q as y,s as U}from"./chunk-UWTX2MZZ.js";import"./chunk-KURQCTT3.js";import{writeFileSync as S}from"fs";function $(){console.log(`
3
3
  Usage: entrydesk usage [balance|me|consumptions|export] [options]
4
4
 
5
5
  Commands:
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import"./chunk-KURQCTT3.js";function n(){console.log("entrydesk 1.23.1")}export{n as printVersion};
2
+ import"./chunk-KURQCTT3.js";function n(){console.log("entrydesk 1.24.0")}export{n as printVersion};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{h as u,r as p,t as g}from"./chunk-YKH2UWFC.js";import"./chunk-KURQCTT3.js";import{readFileSync as $}from"fs";var k=262144,x=new Set(["completed","failed","cancelled"]);function f(){console.log(`
2
+ import{c as u}from"./chunk-AJ4WRMUZ.js";import{h as p,q as g,s as k}from"./chunk-UWTX2MZZ.js";import"./chunk-KURQCTT3.js";import{readFileSync as I}from"fs";var m=262144,R=new Set(["completed","failed","cancelled"]);function f(){console.log(`
3
3
  Usage: entrydesk workflow [list|get|create|update|run|runs|run-get|share] [options]
4
4
 
5
5
  Commands:
@@ -48,15 +48,15 @@ Examples:
48
48
  entrydesk workflow runs <workflowId>
49
49
  entrydesk workflow run-get <workflowId> <runId>
50
50
  entrydesk workflow share <workflowId> --add-user <userId> --role editor
51
- `)}function a(o){if(!o)return"";let e=new Date(o);return isNaN(e.getTime())?o:e.toLocaleString()}function m(o){let e;try{e=$(o,"utf8")}catch{console.error(`Cannot read script file: ${o}`),process.exit(1)}return e.trim().length===0&&(console.error(`Script file is empty: ${o}`),process.exit(1)),Buffer.byteLength(e,"utf8")>k&&(console.error(`Script file exceeds ${k} bytes.`),process.exit(1)),e}function A(o){o.args!==void 0&&o.argsFile!==void 0&&(console.error("Use only one of --args or --args-file."),process.exit(1));let e;if(o.argsFile!==void 0)try{e=$(o.argsFile,"utf8")}catch{console.error(`Cannot read args file: ${o.argsFile}`),process.exit(1)}else e=o.args;if(e!==void 0)try{return JSON.parse(e)}catch{console.error("--args/--args-file must be valid JSON."),process.exit(1)}}function h(o){console.log(`Workflows (${o.length}):
52
- `);for(let e of o){let r=e.isActive?"active":"inactive";if(console.log(` ${e.name} (${r})`),e.description){let t=e.description.length>80?`${e.description.slice(0,80)}...`:e.description;console.log(` ${t}`)}console.log(` ${e.myRole??"no-role"} \xB7 ID: ${e.id}`),console.log("")}}function R(o,e){console.log(`${o.name}
53
- `),console.log(` ID: ${o.id}`),console.log(` Active: ${o.isActive}`),console.log(` My role: ${o.myRole??"no-role"}`),o.description&&console.log(` Description: ${o.description}`),console.log(` Updated: ${a(o.updatedAt)}`);let r=o.scriptSource.split(`
51
+ `)}function a(o){if(!o)return"";let e=new Date(o);return isNaN(e.getTime())?o:e.toLocaleString()}function h(o){let e;try{e=I(o,"utf8")}catch{console.error(`Cannot read script file: ${o}`),process.exit(1)}return e.trim().length===0&&(console.error(`Script file is empty: ${o}`),process.exit(1)),Buffer.byteLength(e,"utf8")>m&&(console.error(`Script file exceeds ${m} bytes.`),process.exit(1)),e}function A(o){o.args!==void 0&&o.argsFile!==void 0&&(console.error("Use only one of --args or --args-file."),process.exit(1));let e;if(o.argsFile!==void 0)try{e=I(o.argsFile,"utf8")}catch{console.error(`Cannot read args file: ${o.argsFile}`),process.exit(1)}else e=o.args;if(e!==void 0)try{return JSON.parse(e)}catch{console.error("--args/--args-file must be valid JSON."),process.exit(1)}}function y(o){console.log(`Workflows (${o.length}):
52
+ `);for(let e of o){let n=e.isActive?"active":"inactive";if(console.log(` ${e.name} (${n})`),e.description){let t=e.description.length>80?`${e.description.slice(0,80)}...`:e.description;console.log(` ${t}`)}console.log(` ${e.myRole??"no-role"} \xB7 ID: ${e.id}`),console.log("")}}function v(o,e){console.log(`${o.name}
53
+ `),console.log(` ID: ${o.id}`),console.log(` Active: ${o.isActive}`),console.log(` My role: ${o.myRole??"no-role"}`),o.description&&console.log(` Description: ${o.description}`),console.log(` Updated: ${a(o.updatedAt)}`);let n=o.scriptSource.split(`
54
54
  `).length;e?(console.log(`
55
- Script (${r} lines):
56
- `),console.log(o.scriptSource)):console.log(` Script: ${r} lines (use --show-source to print)`)}function y(o){console.log(`Runs (${o.length}):
57
- `);for(let e of o){let r=a(e.startedAt??e.createdAt);console.log(` ${e.status}${r?` \xB7 ${r}`:""}`),console.log(` ID: ${e.id}`)}}function S(o){console.log(`Run ${o.id}`),console.log(` Workflow: ${o.workflowId}`),console.log(` Status: ${o.status}`),o.startedAt&&console.log(` Started: ${a(o.startedAt)}`),o.completedAt&&console.log(` Completed: ${a(o.completedAt)}`),o.error!=null&&console.log(` Error: ${JSON.stringify(o.error)}`);let e=Object.entries(o.context?.nodes??{});if(e.length>0){console.log(`
58
- Nodes (${e.length}):`);for(let[t,i]of e){let n=[i.kind??"node",i.status];i.durationMs!=null&&n.push(`${i.durationMs}ms`),console.log(` - ${i.label??t} [${n.join(" \xB7 ")}]`)}}let r=o.context?.logs??[];if(r.length>0){console.log(`
59
- Logs:`);for(let t of r)console.log(` ${t}`)}o.context?.spent!=null&&console.log(`
60
- Tokens spent: ${o.context.spent}`)}function v(o){if(console.log(`User grants (${o.grants.length}):`),o.grants.length===0){console.log(" (none)");return}for(let e of o.grants)console.log(` - ${e.user.name} <${e.user.email}> \xB7 ${e.role}`),console.log(` ID: ${e.userId}`)}async function W(o,e,r,t,i){for(let s=0;s<600;s++){let l=await o.getWorkflowRun(e,r,t,i);if(x.has(l.status))return s>0&&process.stderr.write(`
55
+ Script (${n} lines):
56
+ `),console.log(o.scriptSource)):console.log(` Script: ${n} lines (use --show-source to print)`)}function S(o){console.log(`Runs (${o.length}):
57
+ `);for(let e of o){let n=a(e.startedAt??e.createdAt);console.log(` ${e.status}${n?` \xB7 ${n}`:""}`),console.log(` ID: ${e.id}`)}}function $(o){console.log(`Run ${o.id}`),console.log(` Workflow: ${o.workflowId}`),console.log(` Status: ${o.status}`),o.startedAt&&console.log(` Started: ${a(o.startedAt)}`),o.completedAt&&console.log(` Completed: ${a(o.completedAt)}`),o.error!=null&&console.log(` Error: ${JSON.stringify(o.error)}`);let e=Object.entries(o.context?.nodes??{});if(e.length>0){console.log(`
58
+ Nodes (${e.length}):`);for(let[t,i]of e){let r=[i.kind??"node",i.status];i.durationMs!=null&&r.push(`${i.durationMs}ms`),console.log(` - ${i.label??t} [${r.join(" \xB7 ")}]`)}}let n=o.context?.logs??[];if(n.length>0){console.log(`
59
+ Logs:`);for(let t of n)console.log(` ${t}`)}o.context?.spent!=null&&console.log(`
60
+ Tokens spent: ${o.context.spent}`)}function W(o){let e=u(o);if(console.log(`User grants (${e.length}):`),e.length===0){console.log(" (none)");return}for(let n of e)console.log(` - ${n.user.name} <${n.user.email}> \xB7 ${n.role}`),console.log(` ID: ${n.userId}`)}async function N(o,e,n,t,i){for(let s=0;s<600;s++){let l=await o.getWorkflowRun(e,n,t,i);if(R.has(l.status))return s>0&&process.stderr.write(`
61
61
  `),l;let c=s*2;process.stderr.write(`\rWaiting\u2026 ${l.status} (${c}s)`),await new Promise(d=>setTimeout(d,2e3))}throw process.stderr.write(`
62
- `),new Error(`Run ${i} did not finish within the wait window.`)}async function I(o){let r=[],t;for(let i=0;;i++){i>=100&&(console.error("Reached maximum page limit (100). Use --limit and --next-key for manual pagination."),process.exit(1));let n=await o(t);if(r.push(...n.items),t=n.nextKey,!t)break}return r}async function N(o,e,r,t){if(t.all&&t.nextKey&&(console.error("Cannot use --all and --next-key together."),process.exit(1)),t.all){let s=await I(async l=>{let c=await o.getWorkflows(e,r,{limit:t.limit??20,nextKey:l,search:t.search});return{items:c.workflows,nextKey:c.nextKey}});if(t.json){console.log(JSON.stringify({workflows:s}));return}if(s.length===0){console.log("No workflows found in this workspace.");return}h(s);return}let{workflows:i,nextKey:n}=await o.getWorkflows(e,r,{limit:t.limit,nextKey:t.nextKey,search:t.search});if(t.json){console.log(JSON.stringify({workflows:i,nextKey:n}));return}if(i.length===0){console.log("No workflows found in this workspace.");return}h(i),n&&console.log(`Next page: --next-key ${n}`)}async function O(o,e,r,t){if(!t.workflowId)throw new Error("Missing workflowId for share command");let i=t.workflowId,n=t.role??"viewer";if(t.addUser){let l=await o.upsertWorkflowGrant(e,r,i,t.addUser,n);if(t.json){console.log(JSON.stringify(l));return}console.log(`Granted ${n} to user ${t.addUser}`);return}if(t.removeUser){if(await o.removeWorkflowGrant(e,r,i,t.removeUser),t.json){console.log(JSON.stringify({userId:t.removeUser,removed:!0}));return}console.log(`Revoked access for user ${t.removeUser}`);return}let s=await o.getWorkflowGrants(e,r,i);if(t.json){console.log(JSON.stringify(s));return}v(s)}async function M(o){try{if(o.help){f();return}let{accessToken:e,workspaceId:r}=await p(),t=o.action||"list",i=new u;if(t==="list"){await N(i,e,r,o);return}if(t==="get"){if(!o.workflowId)throw new Error("Missing workflowId for get command");let n=await i.getWorkflow(e,r,o.workflowId);if(o.json){console.log(JSON.stringify(n));return}R(n,!!o.showSource);return}if(t==="create"){(!o.name||!o.file)&&(console.error("create requires --name and --file <path.js>."),f(),process.exit(1));let n=m(o.file),s=await i.createWorkflow(e,r,{name:o.name,description:o.description,scriptSource:n});if(o.json){console.log(JSON.stringify(s));return}console.log(`Created workflow: ${s.name}`),console.log(` ID: ${s.id}`);return}if(t==="update"){if(!o.workflowId)throw new Error("Missing workflowId for update command");o.activate&&o.deactivate&&(console.error("Cannot use --activate and --deactivate together."),process.exit(1));let n={};if(o.name!==void 0&&(n.name=o.name),o.description!==void 0&&(n.description=o.description),o.file!==void 0&&(n.scriptSource=m(o.file)),o.activate&&(n.isActive=!0),o.deactivate&&(n.isActive=!1),Object.keys(n).length===0&&(console.error("No fields provided to update."),f(),process.exit(1)),await i.updateWorkflow(e,r,o.workflowId,n),o.json){console.log(JSON.stringify({id:o.workflowId,updated:!0}));return}console.log(`Updated workflow: ${o.workflowId}`);return}if(t==="run"){if(!o.workflowId)throw new Error("Missing workflowId for run command");let n=A(o),{runId:s}=await i.triggerWorkflowRun(e,r,o.workflowId,n);if(!o.wait){if(o.json){console.log(JSON.stringify({runId:s}));return}console.log(`Started run: ${s}`),console.log(` Check: entrydesk workflow run-get ${o.workflowId} ${s}`);return}let l=await W(i,e,r,o.workflowId,s);o.json?console.log(JSON.stringify(l)):S(l),l.status!=="completed"&&process.exit(1);return}if(t==="runs"){if(!o.workflowId)throw new Error("Missing workflowId for runs command");if(o.all&&o.nextKey&&(console.error("Cannot use --all and --next-key together."),process.exit(1)),o.all){let l=o.workflowId,c=await I(async d=>{let w=await i.getWorkflowRuns(e,r,l,{limit:o.limit??20,nextKey:d});return{items:w.runs,nextKey:w.nextKey}});if(o.json){console.log(JSON.stringify({runs:c}));return}if(c.length===0){console.log("No runs for this workflow.");return}y(c);return}let{runs:n,nextKey:s}=await i.getWorkflowRuns(e,r,o.workflowId,{limit:o.limit,nextKey:o.nextKey});if(o.json){console.log(JSON.stringify({runs:n,nextKey:s}));return}if(n.length===0){console.log("No runs for this workflow.");return}y(n),s&&console.log(`Next page: --next-key ${s}`);return}if(t==="run-get"){if(!o.workflowId||!o.runId)throw new Error("Missing workflowId or runId for run-get command");let n=await i.getWorkflowRun(e,r,o.workflowId,o.runId);if(o.json){console.log(JSON.stringify(n));return}S(n);return}if(t==="share"){await O(i,e,r,o);return}console.error(`Unknown workflow command: ${t}`),f(),process.exit(1)}catch(e){g(e)}}export{M as runWorkflow};
62
+ `),new Error(`Run ${i} did not finish within the wait window.`)}async function x(o){let n=[],t;for(let i=0;;i++){i>=100&&(console.error("Reached maximum page limit (100). Use --limit and --next-key for manual pagination."),process.exit(1));let r=await o(t);if(n.push(...r.items),t=r.nextKey,!t)break}return n}async function O(o,e,n,t){if(t.all&&t.nextKey&&(console.error("Cannot use --all and --next-key together."),process.exit(1)),t.all){let s=await x(async l=>{let c=await o.getWorkflows(e,n,{limit:t.limit??20,nextKey:l,search:t.search});return{items:c.workflows,nextKey:c.nextKey}});if(t.json){console.log(JSON.stringify({workflows:s}));return}if(s.length===0){console.log("No workflows found in this workspace.");return}y(s);return}let{workflows:i,nextKey:r}=await o.getWorkflows(e,n,{limit:t.limit,nextKey:t.nextKey,search:t.search});if(t.json){console.log(JSON.stringify({workflows:i,nextKey:r}));return}if(i.length===0){console.log("No workflows found in this workspace.");return}y(i),r&&console.log(`Next page: --next-key ${r}`)}async function j(o,e,n,t){if(!t.workflowId)throw new Error("Missing workflowId for share command");let i=t.workflowId,r=t.role??"viewer";if(t.addUser){let l=await o.upsertWorkflowGrant(e,n,i,t.addUser,r);if(t.json){console.log(JSON.stringify(l));return}console.log(`Granted ${r} to user ${t.addUser}`);return}if(t.removeUser){if(await o.removeWorkflowGrant(e,n,i,t.removeUser),t.json){console.log(JSON.stringify({userId:t.removeUser,removed:!0}));return}console.log(`Revoked access for user ${t.removeUser}`);return}let s=await o.getWorkflowGrants(e,n,i);if(t.json){console.log(JSON.stringify(s));return}W(s)}async function C(o){try{if(o.help){f();return}let{accessToken:e,workspaceId:n}=await g(),t=o.action||"list",i=new p;if(t==="list"){await O(i,e,n,o);return}if(t==="get"){if(!o.workflowId)throw new Error("Missing workflowId for get command");let r=await i.getWorkflow(e,n,o.workflowId);if(o.json){console.log(JSON.stringify(r));return}v(r,!!o.showSource);return}if(t==="create"){(!o.name||!o.file)&&(console.error("create requires --name and --file <path.js>."),f(),process.exit(1));let r=h(o.file),s=await i.createWorkflow(e,n,{name:o.name,description:o.description,scriptSource:r});if(o.json){console.log(JSON.stringify(s));return}console.log(`Created workflow: ${s.name}`),console.log(` ID: ${s.id}`);return}if(t==="update"){if(!o.workflowId)throw new Error("Missing workflowId for update command");o.activate&&o.deactivate&&(console.error("Cannot use --activate and --deactivate together."),process.exit(1));let r={};if(o.name!==void 0&&(r.name=o.name),o.description!==void 0&&(r.description=o.description),o.file!==void 0&&(r.scriptSource=h(o.file)),o.activate&&(r.isActive=!0),o.deactivate&&(r.isActive=!1),Object.keys(r).length===0&&(console.error("No fields provided to update."),f(),process.exit(1)),await i.updateWorkflow(e,n,o.workflowId,r),o.json){console.log(JSON.stringify({id:o.workflowId,updated:!0}));return}console.log(`Updated workflow: ${o.workflowId}`);return}if(t==="run"){if(!o.workflowId)throw new Error("Missing workflowId for run command");let r=A(o),{runId:s}=await i.triggerWorkflowRun(e,n,o.workflowId,r);if(!o.wait){if(o.json){console.log(JSON.stringify({runId:s}));return}console.log(`Started run: ${s}`),console.log(` Check: entrydesk workflow run-get ${o.workflowId} ${s}`);return}let l=await N(i,e,n,o.workflowId,s);o.json?console.log(JSON.stringify(l)):$(l),l.status!=="completed"&&process.exit(1);return}if(t==="runs"){if(!o.workflowId)throw new Error("Missing workflowId for runs command");if(o.all&&o.nextKey&&(console.error("Cannot use --all and --next-key together."),process.exit(1)),o.all){let l=o.workflowId,c=await x(async d=>{let w=await i.getWorkflowRuns(e,n,l,{limit:o.limit??20,nextKey:d});return{items:w.runs,nextKey:w.nextKey}});if(o.json){console.log(JSON.stringify({runs:c}));return}if(c.length===0){console.log("No runs for this workflow.");return}S(c);return}let{runs:r,nextKey:s}=await i.getWorkflowRuns(e,n,o.workflowId,{limit:o.limit,nextKey:o.nextKey});if(o.json){console.log(JSON.stringify({runs:r,nextKey:s}));return}if(r.length===0){console.log("No runs for this workflow.");return}S(r),s&&console.log(`Next page: --next-key ${s}`);return}if(t==="run-get"){if(!o.workflowId||!o.runId)throw new Error("Missing workflowId or runId for run-get command");let r=await i.getWorkflowRun(e,n,o.workflowId,o.runId);if(o.json){console.log(JSON.stringify(r));return}$(r);return}if(t==="share"){await j(i,e,n,o);return}console.error(`Unknown workflow command: ${t}`),f(),process.exit(1)}catch(e){k(e)}}export{C as runWorkflow};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{g as a,h as w,q as k}from"./chunk-YKH2UWFC.js";import"./chunk-KURQCTT3.js";function l(){console.log(`
2
+ import{g as a,h as w,p as k}from"./chunk-UWTX2MZZ.js";import"./chunk-KURQCTT3.js";function l(){console.log(`
3
3
  Usage: entrydesk workspaces [list|switch|use] [options]
4
4
 
5
5
  Commands:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entrydesk/cli",
3
- "version": "1.23.1",
3
+ "version": "1.24.0",
4
4
  "description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,14 +31,14 @@
31
31
  "@types/react": "^19.2.14",
32
32
  "@vitest/coverage-v8": "^4.1.6",
33
33
  "happy-dom": "^20.8.9",
34
- "oxlint": "^1.69.0",
34
+ "oxlint": "^1.72.0",
35
35
  "strip-ansi": "^7.1.2",
36
36
  "tsup": "^8.5.0",
37
37
  "typescript": "^6.0.3",
38
38
  "vitest": "^4.1.6",
39
39
  "@entrydesk/ci": "^0.0.0",
40
- "@entrydesk/shared": "^0.0.0",
41
- "@entrydesk/utils": "^0.0.0"
40
+ "@entrydesk/utils": "^0.0.0",
41
+ "@entrydesk/shared": "^0.0.0"
42
42
  },
43
43
  "optionalDependencies": {
44
44
  "keytar": "^7.9.0"
@@ -49,7 +49,7 @@
49
49
  "scripts": {
50
50
  "build": "tsup",
51
51
  "dev": "tsup --watch",
52
- "lint": "oxlint --type-aware --type-check src/",
52
+ "lint": "oxlint --type-aware --type-check .",
53
53
  "start": "node dist/index.js",
54
54
  "test": "vitest run",
55
55
  "test:coverage": "vitest run --coverage",
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env node
2
- import{h as u,r as f,t as h}from"./chunk-YKH2UWFC.js";import"./chunk-KURQCTT3.js";function m(){console.log(`
3
- Usage: entrydesk agents [list|show|create|update|delete|publish|share] [options]
4
-
5
- Commands:
6
- list List available agents (default; --mine for your own)
7
- show <agentId> Show one agent's full details
8
- create Create a new agent
9
- update <agentId> Update an agent you own
10
- delete <agentId> Delete an agent you own
11
- publish <agentId> Publish an agent to the workspace
12
- share <agentId> Show or manage sharing (user grants)
13
-
14
- Create/Update Options:
15
- --name <name>
16
- --description <text>
17
- --system-prompt <text>
18
- --model-id <modelId>
19
- --connector-ids id1,id2
20
- --capabilities sandbox,web_search,image_generation,chart
21
- --conversation-starters s1,s2,s3
22
- --tools prefix__tool1,prefix__tool2
23
- --icon-id <iconId>
24
-
25
- List Options:
26
- --mine List agents you own/edit (with publish state)
27
- --limit <number> Max agents per page; also page size for --all (default: 100)
28
- --next-key <cursor> Fetch next page using cursor
29
- --all Fetch all agents (auto-paginate)
30
-
31
- Share Options:
32
- --add-user <userId> Grant a user access (use with --role)
33
- --remove-user <userId> Revoke a user's access
34
- --role owner|editor|viewer Role for --add-user (default: viewer)
35
-
36
- Flags:
37
- --json Output JSON
38
- `)}function w(e){if(!e)return[];let o=new Map([["sandbox","sandbox"],["web","web_search"],["web-search","web_search"],["web_search","web_search"],["image","image_generation"],["image-gen","image_generation"],["image_generation","image_generation"],["chart","chart"]]);return e.map(i=>o.get(i)??i)}function y(e){console.log(`Available Agents (${e.length}):
39
- `);for(let o of e){if(console.log(` ${o.name} (${o.visibility})`),o.description){let i=o.description.length>80?`${o.description.slice(0,80)}...`:o.description;console.log(` ${i}`)}console.log(` ID: ${o.id}`),console.log("")}}function I(e){console.log(`My Agents (${e.length}):
40
- `);for(let o of e){let i=[];o.latestVersionNumber!=null&&i.push(`v${o.latestVersionNumber}`),o.hasUnpublishedChanges&&i.push("unpublished changes");let s=i.length>0?` (${i.join(" \xB7 ")})`:"";if(console.log(` ${o.name}${s}`),o.description){let a=o.description.length>80?`${o.description.slice(0,80)}...`:o.description;console.log(` ${a}`)}console.log(` ${o.myRole??"no-role"} \xB7 ID: ${o.id}`),console.log("")}}function A(e){console.log(`${e.name}
41
- `),console.log(` ID: ${e.id}`),e.visibility&&console.log(` Visibility: ${e.visibility}`),e.model&&console.log(` Model: ${e.model.name}`),e.author&&console.log(` Author: ${e.author.name}${e.author.isMe?" (you)":""}`),e.description&&console.log(` Description: ${e.description}`),e.capabilities&&e.capabilities.length>0&&console.log(` Capabilities: ${e.capabilities.join(", ")}`),e.connectors&&e.connectors.length>0&&console.log(` Connectors: ${e.connectors.map(o=>o.name).join(", ")}`),e.tools&&e.tools.length>0&&console.log(` Tools: ${e.tools.length}`),e.conversationStarters&&e.conversationStarters.length>0&&console.log(` Starters: ${e.conversationStarters.length}`),e.systemPrompt&&console.log(`
42
- System Prompt:
43
- ${e.systemPrompt}`)}function b(e){if(console.log(`User grants (${e.grants.length}):`),e.grants.length===0){console.log(" (none)");return}for(let o of e.grants)console.log(` - ${o.user.name} <${o.user.email}> \xB7 ${o.role}`),console.log(` ID: ${o.userId}`)}function $(e){return(!e.name||!e.description||!e.systemPrompt||!e.modelId)&&(console.error("Missing required fields for agent create/update."),m(),process.exit(1)),{name:e.name,description:e.description,systemPrompt:e.systemPrompt,modelId:e.modelId,connectorIds:e.connectorIds??[],capabilities:w(e.capabilities),conversationStarters:e.conversationStarters??[],tools:e.tools,iconId:e.iconId}}async function k(e){try{if(e.help){m();return}let o=await f(),{accessToken:i,workspaceId:s}=o,a=e.action||"list",r=new u;if(a==="show"){if(!e.agentId)throw new Error("Missing agentId for show command");let t=await r.getAgent(i,s,e.agentId);if(e.json){console.log(JSON.stringify(t));return}A(t);return}if(a==="publish"){if(!e.agentId)throw new Error("Missing agentId for publish command");if(await r.publishAgent(i,s,e.agentId),e.json){console.log(JSON.stringify({id:e.agentId,published:!0}));return}console.log(`Published agent to the workspace: ${e.agentId}`);return}if(a==="share"){if(!e.agentId)throw new Error("Missing agentId for share command");let t=e.agentId,n=e.role??"viewer";if(e.addUser){let c=await r.upsertAgentGrant(i,s,t,e.addUser,n);if(e.json){console.log(JSON.stringify(c));return}console.log(`Granted ${n} to user ${e.addUser}`);return}if(e.removeUser){if(await r.removeAgentGrant(i,s,t,e.removeUser),e.json){console.log(JSON.stringify({userId:e.removeUser,removed:!0}));return}console.log(`Revoked access for user ${e.removeUser}`);return}let l=await r.getAgentGrants(i,s,t);if(e.json){console.log(JSON.stringify(l));return}b(l);return}if(a==="create"){let t=$(e),n=await r.createAgent(i,s,t);if(e.json){console.log(JSON.stringify(n));return}console.log(`Created agent: ${n.name}`),console.log(` ID: ${n.id}`);return}if(a==="update"){let t=e.agentId;if(!t)throw new Error("Missing agentId for update command");let n=await r.getAgent(i,s,t),l={name:e.name??n.name,description:e.description??n.description,systemPrompt:e.systemPrompt??n.systemPrompt??"",modelId:e.modelId??n.model?.id??"",connectorIds:e.connectorIds??n.connectors?.map(c=>c.id)??[],capabilities:e.capabilities?w(e.capabilities):n.capabilities??[],conversationStarters:e.conversationStarters??n.conversationStarters??[],tools:e.tools??n.tools??[],iconId:e.iconId??n.iconId};await r.updateAgent(i,s,t,l),console.log(`Updated agent: ${t}`);return}if(a==="delete"){let t=e.agentId;if(!t)throw new Error("Missing agentId for delete command");await r.deleteAgent(i,s,t),console.log(`Deleted agent: ${t}`);return}if(a!=="list"&&(console.error(`Unknown agents command: ${a}`),m(),process.exit(1)),e.all&&e.nextKey&&(console.error("Cannot use --all and --next-key together."),process.exit(1)),e.mine){let t=[],n=e.all?void 0:e.nextKey,l=100;for(let c=0;;c++){c>=l&&(console.error(`Reached maximum page limit (${l}). Use --limit and --next-key for manual pagination.`),process.exit(1));let d=await r.getMyAgents(i,s,{limit:e.limit,nextKey:n});if(t.push(...d.agents),n=d.nextKey,!e.all||!n)break}if(e.json){console.log(JSON.stringify({agents:t,nextKey:n}));return}if(t.length===0){console.log("You have no agents in this workspace.");return}I(t),!e.all&&n&&console.log(`Next page: --next-key ${n}`);return}if(e.all){let n=[],l;for(let c=0;;c++){c>=100&&(console.error("Reached maximum page limit (100). Use --limit and --next-key for manual pagination."),process.exit(1));let d=await r.getAgents(i,s,{limit:e.limit??100,nextKey:l});if(n.push(...d.agents),l=d.nextKey,!l)break}if(e.json){console.log(JSON.stringify({agents:n}));return}if(n.length===0){console.log("No agents found in this workspace.");return}y(n);return}let{agents:g,nextKey:p}=await r.getAgents(i,s,{limit:e.limit,nextKey:e.nextKey});if(e.json){console.log(JSON.stringify({agents:g,nextKey:p}));return}if(g.length===0){console.log("No agents found in this workspace.");return}y(g),p&&console.log(`Next page: --next-key ${p}`)}catch(o){h(o)}}export{k as runAgents};