@entrydesk/cli 2.0.0-beta → 2.0.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 (50) hide show
  1. package/dist/{add-Cu0kBobt.js → add-CDlJBikf.js} +1 -1
  2. package/dist/agents-vivPBsWo.js +2 -0
  3. package/dist/billing-BietwbvI.js +2 -0
  4. package/dist/{budget-DhX2gt5z.js → budget-DcULs51p.js} +1 -1
  5. package/dist/build-task-request-config-Bbffa_rv.js +2 -0
  6. package/dist/commands-BCLJEd6x.js +2 -0
  7. package/dist/{commands-DbXuQqse.js → commands-CpuinJar.js} +1 -1
  8. package/dist/{config-eCQwQAt1.js → config-CI3k8CUK.js} +1 -1
  9. package/dist/connectors-CbkKDKQQ.js +3 -0
  10. package/dist/custom-connector-CxGNx65S.js +2 -0
  11. package/dist/format-BNEUX5Xv.js +2 -0
  12. package/dist/index.js +9 -9
  13. package/dist/{login-IvudGta0.js → login-y8SlHgZ4.js} +1 -1
  14. package/dist/{logout-Bjmk9YUh.js → logout-CGGEe0it.js} +1 -1
  15. package/dist/{marketplace-BPY5cD0d.js → marketplace-CaIuJP0T.js} +1 -1
  16. package/dist/{mcp-ydzvH8kz.js → mcp-Yz1qXxIb.js} +1 -1
  17. package/dist/{mcp-client-Cr_sHGPw.js → mcp-client-DdryEToX.js} +1 -1
  18. package/dist/{meeting-BDhBTbm3.js → meeting-CWv3iUU6.js} +1 -1
  19. package/dist/{models-BFnezI1c.js → models-DFEIoTPH.js} +1 -1
  20. package/dist/{notifications-4bo-vcIW.js → notifications-CBLIBZtc.js} +1 -1
  21. package/dist/{paths-BAZ2NsXN.js → paths-Cqjaa_lJ.js} +1 -1
  22. package/dist/{profile-BZo9STO2.js → profile-1uJ5EHdo.js} +1 -1
  23. package/dist/profile-storage-DYUIMuP0.js +72 -0
  24. package/dist/{push-Mb0Xb42_.js → push-BBY3QXxO.js} +1 -1
  25. package/dist/recordings-C0Ij3tfP.js +3 -0
  26. package/dist/{remove-CJiRVixg.js → remove-D-UQJ0IM.js} +1 -1
  27. package/dist/schedules-CFjtG3p4.js +21 -0
  28. package/dist/{skills-DYS1EQMn.js → skills-16msznfK.js} +1 -1
  29. package/dist/{status-BgIfKAmr.js → status-D6ebFbsw.js} +1 -1
  30. package/dist/{status-DzGv21m4.js → status-kRSNf0Ap.js} +1 -1
  31. package/dist/task-DKK82ixE.js +115 -0
  32. package/dist/{tasks-Dd-GdHfu.js → tasks-DX7CQir8.js} +2 -2
  33. package/dist/{tool-B6W8erW6.js → tool-3NEPlGNR.js} +1 -1
  34. package/dist/{update-CYieYkZl.js → update-DhNwkiwD.js} +1 -1
  35. package/dist/usage-050zvE6Q.js +3 -0
  36. package/dist/usage-audit-e6kpW0LZ.js +4 -0
  37. package/dist/version-orM51hu_.js +2 -0
  38. package/dist/{workflow-DlQtL_J-.js → workflow-DHTrGTRn.js} +1 -1
  39. package/dist/{workspaces-IAJitqaO.js → workspaces-BQiFZ5pV.js} +1 -1
  40. package/package.json +7 -7
  41. package/dist/agents--2Fw5-et.js +0 -2
  42. package/dist/billing-B96487c6.js +0 -2
  43. package/dist/commands-C1wX8XQY.js +0 -2
  44. package/dist/connectors-DGmZ4zTG.js +0 -3
  45. package/dist/profile-storage-mtd3aKrx.js +0 -72
  46. package/dist/recordings-D9jnWpxs.js +0 -3
  47. package/dist/schedules-BFoirR6r.js +0 -21
  48. package/dist/task-Db4UcJ6G.js +0 -115
  49. package/dist/usage-BLdNvuse.js +0 -3
  50. package/dist/version-Cos6L15W.js +0 -2
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{a as e,b as t,c as n,l as r}from"./profile-storage-mtd3aKrx.js";const i=`\x1B[2m`,a=`\x1B[0m`,o=`\x1B[36m`,s=`\x1B[33m`,c=`\x1B[32m`;function l(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}\n`)}function u(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Yesterday`:r<7?`${r} days ago`:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function d(e){return e.replace(/<mark>/g,`\x1B[1m`).replace(/<\/mark>/g,a).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#39;/g,`'`).replace(/&amp;/g,`&`)}function f(e,t){if(t)return e;let n=e.split(`
2
+ import{a as e,b as t,c as n,l as r}from"./profile-storage-DYUIMuP0.js";const i=`\x1B[2m`,a=`\x1B[0m`,o=`\x1B[36m`,s=`\x1B[33m`,c=`\x1B[32m`;function l(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}\n`)}function u(e){let t=new Date(e),n=new Date().getTime()-t.getTime(),r=Math.floor(n/(1e3*60*60*24));return r===0?t.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`}):r===1?`Yesterday`:r<7?`${r} days ago`:t.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})}function d(e){return e.replace(/<mark>/g,`\x1B[1m`).replace(/<\/mark>/g,a).replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&#39;/g,`'`).replace(/&amp;/g,`&`)}function f(e,t){if(t)return e;let n=e.split(`
3
3
  `);if(n.length<=15)return e;let r=n.slice(0,6),i=n.slice(-4),a=n.length-10;return[...r,`… (${a} lines omitted, use --full-output to see all) …`,...i].join(`
4
4
  `)}function p(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(p);let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&r.length>200?t[n]=r.slice(0,150)+`… (truncated)`:typeof r==`object`&&r?t[n]=p(r):t[n]=r;return t}function m(e){if(!e||typeof e!=`object`)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function h(e,t){if(!e)return`(no result)`;if(typeof e!=`object`)return f(String(e),t);let n=t?e:p(e);if(`structuredContent`in n&&n.structuredContent){let e=n.structuredContent,r=[];if(e.stdout&&typeof e.stdout==`string`&&e.stdout.trim()&&r.push(e.stdout.trim()),e.stderr&&typeof e.stderr==`string`&&e.stderr.trim()&&r.push(`${s}[stderr]${a} ${e.stderr.trim()}`),e.urls&&Array.isArray(e.urls)){let t=e.urls;for(let e of t)e.path&&e.url&&r.push(`${e.path}: ${e.url}`)}return r.length===0&&r.push(JSON.stringify(e,null,2)),f(r.join(`
5
5
  `),t)}return`content`in n&&Array.isArray(n.content)?f(n.content.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
@@ -11,4 +11,4 @@ import{a as e,b as t,c as n,l as r}from"./profile-storage-mtd3aKrx.js";const i=`
11
11
  `))l.push(`${i}│ ${t}${a}`);l.push(`${o}└─ completed${a}`)}else r.state===`call`||r.state===`partial-call`?l.push(`${o}└─ (in progress)${a}`):l.push(`${o}└─${a}`);n.push(l.join(`
12
12
  `))}return n.join(`
13
13
 
14
- `).trim()}async function v(o,s){let c=s.output!==void 0,f=new t;if(s.share){let e;try{e=await n()}catch{}try{let t=await f.getSharedTask(s.share,e),{messages:n}=await f.getSharedMessages(s.share,50,e);if(s.json){console.log(JSON.stringify({task:t,messages:n}));return}if(c){if(l(`task`,t),n.length===0)l(`info`,`No messages in this shared task.`);else for(let e of n.toReversed())l(`message`,e);l(`done`);return}if(console.log(`Shared task: ${t.title||`Untitled`}`),console.log(`Visibility: ${t.visibility}`),t.agent&&console.log(`Agent: ${t.agent.name}`),console.log(`${n.length} messages\n`),n.length===0){console.log(`No messages in this shared task.`);return}let r=n.toReversed(),i=s.fullOutput??!1;for(let e of r){let t=_(e.parts,i);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${u(e.createdAt)}`),console.log(t),console.log(``)}return}catch(e){if(e instanceof Error){let t=e.message.toLowerCase();t.includes(`401`)||t.includes(`unauthorized`)?console.error(`Access denied. This shared task requires authentication or is not accessible to you.`):t.includes(`404`)||t.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: ${e.message}`)}else console.error(`Failed to fetch shared task`);process.exit(1)}}let p,m;try{let e=await r();p=e.accessToken,m=e.workspaceId}catch(t){e(t)}if(o){let e=o,t=!1,n=null,r=Number.parseInt(o,10);if(!Number.isNaN(r)&&r>=0&&/^\d+$/.test(o)){let i=r===0?1:r,{tasks:a}=await f.getTasks(p,m,20);i>a.length&&(console.error(`Task number ${i} not found. You have ${a.length} recent tasks.`),process.exit(1));let o=a[i-1];e=o.id,t=!0,n=o,c||console.log(`Task: ${o.title||`Untitled`}\n`)}let{messages:i}=await f.getMessages(p,m,e,50);if(s.json){console.log(JSON.stringify(i));return}if(c){if(n&&l(`task`,n),i.length===0)l(`info`,`No messages in this task.`);else for(let e of i.toReversed())l(`message`,e);l(`done`);return}if(i.length===0){console.log(`No messages in this task.`);return}let a=i.toReversed(),d=s.fullOutput??!1;t||console.log(`Task: ${o.slice(0,8)}…`),console.log(`${i.length} messages\n`);for(let e of a){let t=_(e.parts,d);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${u(e.createdAt)}`),console.log(t),console.log(``)}return}if(s.search){let{results:e,nextKey:t}=await f.searchTasks(p,m,s.search,{limit:s.limit,nextKey:s.nextKey});if(c){for(let t of e)l(`task`,t);l(`done`);return}if(s.json){console.log(JSON.stringify({results:e,nextKey:t}));return}if(e.length===0){console.log(`No tasks match "${s.search}".`);return}console.log(`Search results for "${s.search}" (${e.length}):\n`);for(let[t,n]of e.entries()){let e=(t+1).toString().padStart(2,` `),r=n.titleHighlight?d(n.titleHighlight):n.title||`Untitled`;console.log(` ${e}. ${i}${u(n.createdAt)}${a} ${r}`),n.contentSnippet&&console.log(` ${d(n.contentSnippet)}`),console.log(` ${i}ID: ${n.id}${a}`)}t&&console.log(`\nNext page: --next-key ${t}`);return}let{tasks:h}=await f.getTasks(p,m,20);if(c){for(let e of h)l(`task`,e);l(`done`);return}if(s.json){console.log(JSON.stringify(h));return}if(h.length===0){console.log('No tasks yet. Start one with `entrydesk task -m "..."`.');return}console.log(`Recent tasks (${h.length}):\n`);for(let[e,t]of h.entries()){let n=(e+1).toString().padStart(2,` `);console.log(` ${n}. ${u(t.createdAt).padEnd(12)} ${t.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{v as runTasks};
14
+ `).trim()}async function v(o,c){let f=c.output!==void 0,p=new t;if(c.share){let e;try{e=await n()}catch{}try{let t=await p.getSharedTask(c.share,e),{messages:n}=await p.getSharedMessages(c.share,50,e);if(c.json){console.log(JSON.stringify({task:t,messages:n}));return}if(f){if(l(`task`,t),n.length===0)l(`info`,`No messages in this shared task.`);else for(let e of n.toReversed())l(`message`,e);l(`done`);return}if(console.log(`Shared task: ${t.title||`Untitled`}`),console.log(`Visibility: ${t.visibility}`),t.agent&&console.log(`Agent: ${t.agent.name}`),console.log(`${n.length} messages\n`),n.length===0){console.log(`No messages in this shared task.`);return}let r=n.toReversed(),i=c.fullOutput??!1;for(let e of r){let t=_(e.parts,i);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${u(e.createdAt)}`),console.log(t),console.log(``)}return}catch(e){if(e instanceof Error){let t=e.message.toLowerCase();t.includes(`401`)||t.includes(`unauthorized`)?console.error(`Access denied. This shared task requires authentication or is not accessible to you.`):t.includes(`404`)||t.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: ${e.message}`)}else console.error(`Failed to fetch shared task`);process.exit(1)}}let m,h;try{let e=await r();m=e.accessToken,h=e.workspaceId}catch(t){e(t)}if(o){let e=o,t=!1,n=null,r=Number.parseInt(o,10);if(!Number.isNaN(r)&&r>=0&&/^\d+$/.test(o)){let i=r===0?1:r,{tasks:a}=await p.getTasks(m,h,20);i>a.length&&(console.error(`Task number ${i} not found. You have ${a.length} recent tasks.`),process.exit(1));let o=a[i-1];e=o.id,t=!0,n=o,f||console.log(`Task: ${o.title||`Untitled`}\n`)}let{messages:i}=await p.getMessages(m,h,e,50);if(c.json){console.log(JSON.stringify(i));return}if(f){if(n&&l(`task`,n),i.length===0)l(`info`,`No messages in this task.`);else for(let e of i.toReversed())l(`message`,e);l(`done`);return}if(i.length===0){console.log(`No messages in this task.`);return}let a=i.toReversed(),s=c.fullOutput??!1;t||console.log(`Task: ${o.slice(0,8)}…`),console.log(`${i.length} messages\n`);for(let e of a){let t=_(e.parts,s);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${u(e.createdAt)}`),console.log(t),console.log(``)}return}if(c.search){let{results:e,nextKey:t}=await p.searchTasks(m,h,c.search,{limit:c.limit,nextKey:c.nextKey});if(f){for(let t of e)l(`task`,t);l(`done`);return}if(c.json){console.log(JSON.stringify({results:e,nextKey:t}));return}if(e.length===0){console.log(`No tasks match "${c.search}".`);return}console.log(`Search results for "${c.search}" (${e.length}):\n`);for(let[t,n]of e.entries()){let e=(t+1).toString().padStart(2,` `),r=n.titleHighlight?d(n.titleHighlight):n.title||`Untitled`;console.log(` ${e}. ${i}${u(n.createdAt)}${a} ${r}`),n.contentSnippet&&console.log(` ${d(n.contentSnippet)}`),console.log(` ${i}ID: ${n.id}${a}`)}t&&console.log(`\nNext page: --next-key ${t}`);return}let{tasks:g}=await p.getTasks(m,h,20);if(f){for(let e of g)l(`task`,e);l(`done`);return}if(c.json){console.log(JSON.stringify(g));return}if(g.length===0){console.log('No tasks yet. Start one with `entrydesk task -m "..."`.');return}console.log(`Recent tasks (${g.length}):\n`);for(let[e,t]of g.entries()){let n=(e+1).toString().padStart(2,` `),r=t.waitingReason===`approval`?` ${s}[waiting approval]${a}`:``;console.log(` ${n}. ${u(t.createdAt).padEnd(12)} ${t.title||`Untitled`}${r}`)}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{v as runTasks};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{i as e,o as t}from"./profile-storage-mtd3aKrx.js";import{n,r}from"./mcp-client-Cr_sHGPw.js";import i from"node:fs";import a from"node:os";import o from"node:path";import s from"node:fs/promises";const c=!process.env.NO_COLOR&&process.stdout.isTTY,l={green:c?`\x1B[32m`:``,yellow:c?`\x1B[33m`:``,reset:c?`\x1B[0m`:``},u=8*1024;function d(){return o.join(a.homedir(),`.entrydesk`,`tool-results`)}function f(e){let t=e.trim().replace(/[/\\:*?"<>|\s]/g,`_`).replace(/_+/g,`_`).replace(/^[._]+|[._]+$/g,``).slice(0,100);return!t||t===`.`||t===`..`?`unnamed_tool`:t}function p(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}n`:typeof t==`function`?`[Function]`:typeof t==`symbol`?t.toString():t,2)}catch{return String(e)}}function m(e){let t=new Date;return`${[t.getFullYear(),String(t.getMonth()+1).padStart(2,`0`),String(t.getDate()).padStart(2,`0`)].join(`-`)+`_`+[String(t.getHours()).padStart(2,`0`),String(t.getMinutes()).padStart(2,`0`),String(t.getSeconds()).padStart(2,`0`)].join(`-`)}_${f(e)}.json`}async function h(e,t){try{return await s.writeFile(e,t,{encoding:`utf8`,flag:`wx`}),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`EEXIST`)return!1;throw e}}async function g(e,t){try{let n=d();await s.mkdir(n,{recursive:!0});let r=m(e),i=o.extname(r),a=r.slice(0,-i.length),c=p(t),l=o.join(n,r);if(await h(l,c))return l;for(let e=1;e<=100;e++){let t=o.join(n,`${a}-${e}${i}`);if(await h(t,c))return t}let u=Math.random().toString(36).slice(2,10),f=o.join(n,`${a}-${u}${i}`);return await s.writeFile(f,c,{encoding:`utf8`,flag:`wx`}),f}catch(e){let t=e instanceof Error?e.message:`unknown error`;return console.error(`${l.yellow}Warning: Could not save result to file: ${t}${l.reset}`),null}}function _(e,t){let n=Buffer.byteLength(e,`utf8`);if(n<=10240)return e;let r=e.slice(0,u),i=e.slice(-2048),a=` … (skipped ${((n-u-2048)/1024).toFixed(1)}KB of ${(n/1024).toFixed(1)}KB) …`;return t&&(a+=`
2
+ import{i as e,o as t}from"./profile-storage-DYUIMuP0.js";import{n,r}from"./mcp-client-DdryEToX.js";import i from"node:fs";import a from"node:os";import o from"node:path";import s from"node:fs/promises";const c=!process.env.NO_COLOR&&process.stdout.isTTY,l={green:c?`\x1B[32m`:``,yellow:c?`\x1B[33m`:``,reset:c?`\x1B[0m`:``},u=8*1024;function d(){return o.join(a.homedir(),`.entrydesk`,`tool-results`)}function f(e){let t=e.trim().replace(/[/\\:*?"<>|\s]/g,`_`).replace(/_+/g,`_`).replace(/^[._]+|[._]+$/g,``).slice(0,100);return!t||t===`.`||t===`..`?`unnamed_tool`:t}function p(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}n`:typeof t==`function`?`[Function]`:typeof t==`symbol`?t.toString():t,2)}catch{return String(e)}}function m(e){let t=new Date;return`${[t.getFullYear(),String(t.getMonth()+1).padStart(2,`0`),String(t.getDate()).padStart(2,`0`)].join(`-`)+`_`+[String(t.getHours()).padStart(2,`0`),String(t.getMinutes()).padStart(2,`0`),String(t.getSeconds()).padStart(2,`0`)].join(`-`)}_${f(e)}.json`}async function h(e,t){try{return await s.writeFile(e,t,{encoding:`utf8`,flag:`wx`}),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`EEXIST`)return!1;throw e}}async function g(e,t){try{let n=d();await s.mkdir(n,{recursive:!0});let r=m(e),i=o.extname(r),a=r.slice(0,-i.length),c=p(t),l=o.join(n,r);if(await h(l,c))return l;for(let e=1;e<=100;e++){let t=o.join(n,`${a}-${e}${i}`);if(await h(t,c))return t}let u=Math.random().toString(36).slice(2,10),f=o.join(n,`${a}-${u}${i}`);return await s.writeFile(f,c,{encoding:`utf8`,flag:`wx`}),f}catch(e){let t=e instanceof Error?e.message:`unknown error`;return console.error(`${l.yellow}Warning: Could not save result to file: ${t}${l.reset}`),null}}function _(e,t){let n=Buffer.byteLength(e,`utf8`);if(n<=10240)return e;let r=e.slice(0,u),i=e.slice(-2048),a=` … (skipped ${((n-u-2048)/1024).toFixed(1)}KB of ${(n/1024).toFixed(1)}KB) …`;return t&&(a+=`
3
3
  Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${r}\n\n${a}\n\n${i}`}function v(e){console.log(`${l.green}Tool execution result saved to: ${e}${l.reset}`),console.log()}function y(){console.log(`${l.green}Tool execution result:${l.reset}`)}function b(e){return e.split(`__`)[0]??e}function x(e,t,n){console.error(n?JSON.stringify({error:{code:e,message:t}}):`Error [${e}]: ${t}`),process.exit(1)}function S(n,r,i=`CONNECTION_FAILED`){t(n)&&x(i,e(),r);let a=n instanceof Error?n.message:`Unknown error`;a.includes(`Not logged in`)||a.includes(`not-logged-in`)?x(`AUTH_MISSING`,a,r):x(i,a,r)}async function C(){return process.stdin.isTTY?null:new Promise(e=>{let t=[],n=!1,r=!1,i,a,o,s,c=()=>{clearTimeout(i),process.stdin.removeListener(`data`,a),process.stdin.removeListener(`end`,o),process.stdin.removeListener(`error`,s)},l=t=>{r||(r=!0,c(),e(t))};a=e=>{n=!0,clearTimeout(i),t.push(e)},o=()=>{t.length===0?l(null):l(Buffer.concat(t).toString(`utf-8`).trim())},s=()=>{l(null)},i=setTimeout(()=>{n||l(null)},100),process.stdin.on(`data`,a),process.stdin.on(`end`,o),process.stdin.on(`error`,s),process.stdin.resume()})}var w=class extends Error{constructor(e){super(e),this.name=`InputError`}};async function T(e,t){if(e)return e;if(t)try{return i.readFileSync(t,`utf-8`).trim()}catch(e){throw new w(`Failed to read input file: ${e instanceof Error?e.message:`Failed to read input file`}`)}let n=await C();if(n)return n;throw new w(`Input JSON is required. Use --input, --input-file, or pipe it via stdin.`)}function E(e){let t=[`Tool: ${e.name}`];return e.description&&t.push(` Description: ${e.description}`),t.join(`
4
4
  `)}function D(e){let t=[`Tool: ${e.name}`];return e.description&&(t.push(`Description:`),t.push(` ${e.description}`)),t.push(`Input Schema:`),t.push(JSON.stringify(e.inputSchema,null,2)),t.join(`
5
5
  `)}async function O(e){let t=e.json??!1,i=await n().catch(e=>{S(e,t)});try{let n=(await i.listTools({},r())).tools;if(e.prefix){let t=e.prefix.toLowerCase();n=n.filter(e=>b(e.name).toLowerCase().startsWith(t))}if(t)console.log(JSON.stringify(n,null,2));else{let t=e.prefix?` (prefix: ${e.prefix})`:``;console.log(`Available tools (${n.length})${t}:\n`);for(let e of n)console.log(E(e)),console.log()}}catch(e){S(e,t)}finally{await i.close().catch(()=>{})}}async function k(e,t){let i=t.json??!1,a=await n().catch(e=>{S(e,i)});try{let t=(await a.listTools({},r())).tools.find(t=>t.name===e);t||x(`TOOL_NOT_FOUND`,`Tool not found: ${e}`,i),console.log(i?JSON.stringify(t,null,2):D(t))}catch(e){S(e,i)}finally{await a.close().catch(()=>{})}}async function A(e,t,i){let a;try{a=JSON.parse(t)}catch(e){x(`INVALID_INPUT`,e instanceof Error?`Invalid JSON input: ${e.message}`:`Invalid JSON input`,i)}let o=await n().catch(e=>{S(e,i,`TOOL_CALL_FAILED`)}),s=!1;try{let t=await o.callTool({name:e,arguments:a},r());if(i)console.log(JSON.stringify(t,null,2));else{let n=await g(e,t);n&&v(n),y();for(let e of t.content)e.type===`text`?console.log(e.text):e.type===`image`?console.log(`[Image: ${e.mimeType}]`):e.type===`resource`?console.log(`[Resource: ${e.resource.uri}]`):console.log(JSON.stringify(e,null,2));if(t.structuredContent){let e=_(JSON.stringify(t.structuredContent,null,2),n);console.log(e)}}t.isError&&(s=!0)}catch(e){S(e,i,`TOOL_CALL_FAILED`)}finally{await o.close().catch(()=>{})}s&&process.exit(1)}async function j(e,t){let n=t.json??!1,r;try{r=await T(t.input,t.inputFile)}catch(e){throw e instanceof w&&x(`INVALID_INPUT`,e.message,n),e}await A(e,r,n)}export{k as getTool,O as listTools,j as runToolCall};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{r as e}from"./profile-storage-mtd3aKrx.js";import{t}from"./version-Cos6L15W.js";import{spawn as n}from"node:child_process";const r=`@entrydesk/cli`;function i(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u.exec(e.trim());return t?{nums:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]??null}:null}function a(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let n=e.split(`.`),r=t.split(`.`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=n[e],i=r[e];if(t!==i){let e=/^\d+$/u.test(t),n=/^\d+$/u.test(i);return e&&n?Number(t)<Number(i)?-1:1:e?-1:n?1:t<i?-1:1}}return n.length===r.length?0:n.length<r.length?-1:1}function o(e,t){let n=i(e),r=i(t);if(!n||!r)return n?1:r?-1:0;for(let e=0;e<3;e++)if(n.nums[e]!==r.nums[e])return n.nums[e]<r.nums[e]?-1:1;return a(n.prerelease,r.prerelease)}function s(){return process.platform===`win32`?`npm.cmd`:`npm`}function c(e,{inheritOutput:t}){return new Promise((r,i)=>{let a=n(s(),e,{stdio:t?[`ignore`,`inherit`,`inherit`]:[`ignore`,`pipe`,`pipe`]}),o=``,c=``;a.stdout?.on(`data`,e=>{o+=String(e)}),a.stderr?.on(`data`,e=>{c+=String(e)}),a.once(`error`,i),a.once(`close`,e=>{r({exitCode:e??1,stdout:o,stderr:c})})})}async function l(){let t;try{t=await c([`view`,r,`version`],{inheritOutput:!1})}catch(t){throw new e(`Failed to run npm — is npm installed and on your PATH?`,1,t instanceof Error?t:void 0)}let n=t.stdout.trim();if(t.exitCode!==0||!n)throw new e(`Failed to look up the latest ${r} version from the npm registry.${t.stderr?`\n${t.stderr.trim()}`:``}`);if(!i(n))throw new e(`Unexpected version from the npm registry: ${JSON.stringify(n)}`);return n}async function u(n){let i=t(),a=await l(),s=o(i,a),u=s>=0;if(n.check||u){n.json?console.log(JSON.stringify({current:i,latest:a,upToDate:u,updated:!1})):console.log(s>0?`entrydesk ${i} is newer than the latest published version (${a}). Nothing to do.`:u?`entrydesk ${i} is already the latest version.`:`Update available: ${i} → ${a}. Run \`entrydesk update\` to install.`);return}n.json||console.log(`Updating entrydesk ${i} → ${a}…`);let d=await c([`install`,`-g`,`${r}@${a}`],{inheritOutput:!n.json});if(d.exitCode!==0){let t=d.stderr?`\n${d.stderr.trim()}`:``;throw new e(`npm install failed (exit code ${d.exitCode}). You can update manually with \`npm install -g ${r}@latest\`.`+t,d.exitCode)}n.json?console.log(JSON.stringify({current:i,latest:a,upToDate:u,updated:!0})):console.log(`entrydesk updated to ${a}.`)}export{u as runUpdate};
2
+ import{r as e}from"./profile-storage-DYUIMuP0.js";import{t}from"./version-orM51hu_.js";import{spawn as n}from"node:child_process";const r=`@entrydesk/cli`;function i(e){let t=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/u.exec(e.trim());return t?{nums:[Number(t[1]),Number(t[2]),Number(t[3])],prerelease:t[4]??null}:null}function a(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let n=e.split(`.`),r=t.split(`.`),i=Math.min(n.length,r.length);for(let e=0;e<i;e++){let t=n[e],i=r[e];if(t!==i){let e=/^\d+$/u.test(t),n=/^\d+$/u.test(i);return e&&n?Number(t)<Number(i)?-1:1:e?-1:n?1:t<i?-1:1}}return n.length===r.length?0:n.length<r.length?-1:1}function o(e,t){let n=i(e),r=i(t);if(!n||!r)return n?1:r?-1:0;for(let e=0;e<3;e++)if(n.nums[e]!==r.nums[e])return n.nums[e]<r.nums[e]?-1:1;return a(n.prerelease,r.prerelease)}function s(){return process.platform===`win32`?`npm.cmd`:`npm`}function c(e,{inheritOutput:t}){return new Promise((r,i)=>{let a=n(s(),e,{stdio:t?[`ignore`,`inherit`,`inherit`]:[`ignore`,`pipe`,`pipe`]}),o=``,c=``;a.stdout?.on(`data`,e=>{o+=String(e)}),a.stderr?.on(`data`,e=>{c+=String(e)}),a.once(`error`,i),a.once(`close`,e=>{r({exitCode:e??1,stdout:o,stderr:c})})})}async function l(){let t;try{t=await c([`view`,r,`version`],{inheritOutput:!1})}catch(t){throw new e(`Failed to run npm — is npm installed and on your PATH?`,1,t instanceof Error?t:void 0)}let n=t.stdout.trim();if(t.exitCode!==0||!n)throw new e(`Failed to look up the latest ${r} version from the npm registry.${t.stderr?`\n${t.stderr.trim()}`:``}`);if(!i(n))throw new e(`Unexpected version from the npm registry: ${JSON.stringify(n)}`);return n}async function u(n){let i=t(),a=await l(),s=o(i,a),u=s>=0;if(n.check||u){n.json?console.log(JSON.stringify({current:i,latest:a,upToDate:u,updated:!1})):console.log(s>0?`entrydesk ${i} is newer than the latest published version (${a}). Nothing to do.`:u?`entrydesk ${i} is already the latest version.`:`Update available: ${i} → ${a}. Run \`entrydesk update\` to install.`);return}n.json||console.log(`Updating entrydesk ${i} → ${a}…`);let d=await c([`install`,`-g`,`${r}@${a}`],{inheritOutput:!n.json});if(d.exitCode!==0){let t=d.stderr?`\n${d.stderr.trim()}`:``;throw new e(`npm install failed (exit code ${d.exitCode}). You can update manually with \`npm install -g ${r}@latest\`.`+t,d.exitCode)}n.json?console.log(JSON.stringify({current:i,latest:a,upToDate:u,updated:!0})):console.log(`entrydesk updated to ${a}.`)}export{u as runUpdate};
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import{b as e,l as t}from"./profile-storage-DYUIMuP0.js";import{n}from"./format-BNEUX5Xv.js";import{writeFileSync as r}from"node:fs";function i(e){console.log(`Extra-usage balance: ${n(e.balanceUsd)}`);let t=e.currentSpentUsedPercent==null?``:` (${e.currentSpentUsedPercent}% of limit)`;console.log(`Spent this period: ${n(e.currentSpentUsd)}${t}`),e.monthlyExtraUsageLimitUsd!=null&&console.log(`Workspace limit: ${n(e.monthlyExtraUsageLimitUsd)} / month`),e.memberMonthlyExtraUsageLimitUsd!=null&&console.log(`Per-member limit: ${n(e.memberMonthlyExtraUsageLimitUsd)} / month`),e.nextExpiry&&console.log(`Next expiry: ${n(e.nextExpiry.amountUsd)} at ${new Date(e.nextExpiry.expiresAt).toLocaleString()}`),console.log(`Period: ${new Date(e.period.startAt).toLocaleDateString()} – ${new Date(e.period.endAt).toLocaleDateString()}`)}function a(e){console.log(`Seat type: ${e.seatType}`),e.hourly&&console.log(`Hourly used: ${e.hourly.usedPercent}%`),console.log(`Weekly used: ${e.weekly.usedPercent}%`),console.log(`Extra spent: ${n(e.extraUsage.spentUsd)}`),console.log(`Available: ${e.availability.allowed?`yes`:`no (${e.availability.reason??`unknown`})`}`),e.trial&&console.log(`Trial: ${e.trial.remainingDays} days remaining`)}function o(e){console.log(`Consumptions (${e.items.length} of ${e.total}):\n`);for(let t of e.items)console.log(` ${t.user.name} (${t.user.email})`),console.log(` Seat: ${t.seatType} · Extra usage: ${n(t.extraUsage)}`),console.log(` User ID: ${t.user.id}`),console.log(``)}async function s(n){let{accessToken:r,workspaceId:a}=await t(),o=await new e().getUsageOverview(r,a);if(n.json){console.log(JSON.stringify(o));return}i(o)}async function c(n){let{accessToken:r,workspaceId:i}=await t(),o=await new e().getUsageMe(r,i);if(n.json){console.log(JSON.stringify(o));return}a(o)}async function l(n){let{accessToken:r,workspaceId:i}=await t(),a=await new e().getUsageConsumptions(r,i,{limit:n.limit,offset:n.offset,periodStart:n.periodStart});if(n.json){console.log(JSON.stringify(a));return}if(a.items.length===0){console.log(`No consumptions for this period.`);return}o(a)}async function u(n){let{accessToken:i,workspaceId:a}=await t(),o=await new e().exportUsageCsv(i,a,n.periodStart);if(n.output){r(n.output,o),console.log(`Wrote usage CSV to ${n.output}`);return}process.stdout.write(o)}async function d(n){let{accessToken:r,workspaceId:i}=await t(),a=new e,o=[],s,c=0;do{let e=await a.getMonthlyUsages(r,i,{nextKey:s,limit:100});if(o.push(...e.monthlyUsages),s=e.nextKey,c++,c>=100){console.error(`Warning: Showing first ${o.length} entries (pagination limit reached)`);break}}while(s);if(n.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:
3
+ `);let l=0,u=0;for(let e of o)l+=Number.parseFloat(e.totalCost),u+=e.operationCount;console.log(`Total cost: $${l.toFixed(2)}`),console.log(`Total operations: ${u.toLocaleString()}`),console.log(`Users: ${o.length}\n`);let d=[...o].toSorted((e,t)=>n.sortBy===`cost`?Number.parseFloat(t.totalCost)-Number.parseFloat(e.totalCost):t.operationCount-e.operationCount),f=n.limit??d.length,p=d.slice(0,f);console.log(`Usage by user (sorted by ${n.sortBy}, showing ${p.length} of ${o.length}):\n`);for(let e of p)console.log(` ${e.user.name} (${e.user.email})`),console.log(` Cost: $${Number.parseFloat(e.totalCost).toFixed(2)}`),console.log(` Operations: ${e.operationCount.toLocaleString()}`),console.log(``);p.length<o.length&&console.log(`… and ${o.length-p.length} more users`)}export{u as exportUsage,l as listUsageConsumptions,c as showOwnUsage,s as showUsageBalance,d as showUsageSummary};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import{G as e,m as t,r as n}from"./profile-storage-DYUIMuP0.js";import{n as r}from"./format-BNEUX5Xv.js";import{n as i,r as a}from"./mcp-client-DdryEToX.js";function o(e){return Array.isArray(e)&&t(e.map(e=>typeof e==`object`&&e&&`text`in e?String(e.text):``).filter(Boolean).join(`
3
+ `))||`usage-audit tool call failed`}async function s(e,t,r){let i=await e.callTool({name:t,arguments:r},a());if(i.isError){let e=o(i.content);throw/not found/i.test(e)?new n(`This deployment does not expose the usage-audit tools (${t}). Credit-billed workspaces record spend in a separate ledger — use \`entrydesk usage consumptions\` and \`entrydesk usage balance\` instead.`):new n(e)}if(i.structuredContent==null)throw new n(`${t} returned no structured content; the workspace may not expose the usage-audit tools.`);return i.structuredContent}async function c(e){let t=await i();try{return await e(t)}finally{await t.close().catch(()=>{})}}function l(e){return e.toLocaleString()}function u(e){return e==null?`—`:`${e>0?`+`:``}${e}%`}function d(e){return e?e.slice(0,10):`never`}async function f(t){let n=await c(n=>s(n,e.GET_COST_RANKING,{groupBy:t.by,...t.days!=null&&{windowDays:t.days},...t.model&&{model:t.model},...t.limit!=null&&{limit:t.limit}}));if(t.json){console.log(JSON.stringify(n,null,2));return}let i=n.windowDays==null?`all time`:`last ${n.windowDays} days`,a=t.model?` · model ~ "${t.model}"`:``;if(console.log(`Cost ranking by ${t.by} · ${i}${a}\n`),n.rows.length===0){console.log(` No spend in this window.`);return}let o=Math.max(...n.rows.map(e=>r(e.cost).length));for(let e of n.rows){let t=e.ownerEmail?` · ${e.ownerEmail}`:``;console.log(` ${r(e.cost).padStart(o)} ${u(e.costChangePct).padEnd(7)} ${l(e.calls).padStart(8)} calls ${e.key}${t}`)}console.log(`\n ${n.rows.length} rows.`)}async function p(t,n){let[i,a]=await c(r=>Promise.all([s(r,e.GET_USER_BREAKDOWN,{email:t,sinceDays:n.days,minCost:n.minCost??0}),s(r,e.GET_USER_DAILY_TREND,{emails:[t],days:n.days})]));if(n.json){console.log(JSON.stringify({breakdown:i,trend:a},null,2));return}if(console.log(`${t} · last ${n.days} days\n`),console.log(`By agent / operation:`),i.breakdown.length===0)console.log(` (no spend)`);else{let e=Math.max(...i.breakdown.map(e=>r(e.cost).length));for(let t of i.breakdown)console.log(` ${r(t.cost).padStart(e)} ${l(t.calls).padStart(8)} calls ${t.agentOrOperation}`)}let o=a.trends[0]?.days??[];if(o.length>0){console.log(`
4
+ Daily:`);for(let e of o)console.log(` ${e.date} ${r(e.cost).padStart(10)} ${l(e.calls).padStart(8)} calls`)}if(i.activeSchedules.length>0){console.log(`\nActive schedules (${i.activeSchedules.length}):`);for(let e of i.activeSchedules){let t=e.agentName?` · ${e.agentName}`:``;console.log(` ${e.name}${t} (${e.scheduleType}, last run ${d(e.lastTaskAt)})`)}}}async function m(t){let{stale:n,toolCalls:i}=await c(async n=>{let r=await s(n,e.FIND_STALE_SCHEDULES,{sinceDays:t.days,...t.minCost!=null&&{minCost:t.minCost},...t.limit!=null&&{limit:t.limit}}),i=r.schedules.map(e=>e.scheduleId),a=[];for(let e=0;e<i.length;e+=20)a.push(i.slice(e,e+20));return{stale:r,toolCalls:{schedules:(await Promise.all(a.map(r=>s(n,e.GET_SCHEDULE_TOOL_CALLS,{scheduleIds:r,sinceDays:t.days,recentRuns:5})))).flatMap(e=>e.schedules)}}});if(t.json){console.log(JSON.stringify({stale:n,toolCalls:i},null,2));return}if(console.log(`Schedules spending with unread output · last ${t.days} days\n`),n.schedules.length===0){console.log(` Nothing flagged.`);return}let a=new Map(i.schedules.map(e=>[e.scheduleId,e.toolCalls]));for(let e of n.schedules){console.log(` ${r(e.cost)} ${l(e.runs)} runs ${e.unreadPct}% unread last read ${d(e.lastReadAt)}`),console.log(` ${e.scheduleName} · ${e.ownerEmail}`);let t=a.get(e.scheduleId)??[];if(t.length===0){console.log(` no tool calls in the last 5 runs — deactivation candidate`);continue}console.log(` tools (last 5 runs): ${t.map(e=>`${e.tool} ${e.calls}`).join(`, `)}`);let n=t.filter(e=>e.failedCalls>0);n.length>0&&console.log(` failing: ${n.map(e=>`${e.tool} ${e.failedCalls}`).join(`, `)} — may be spinning on retries`)}console.log(`\n ${n.schedules.length} schedules.`)}export{p as drillUsage,m as findUsageWaste,f as rankUsage};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ function e(){return`2.0.0`}export{e as t};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{b as e,j as t,l as n}from"./profile-storage-mtd3aKrx.js";import{readFileSync as r}from"node:fs";const i=262144,a=new Set([`completed`,`failed`,`cancelled`]);function o(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function s(e){let t;try{t=r(e,`utf8`)}catch{console.error(`Cannot read script file: ${e}`),process.exit(1)}return t.trim().length===0&&(console.error(`Script file is empty: ${e}`),process.exit(1)),Buffer.byteLength(t,`utf8`)>i&&(console.error(`Script file exceeds ${i} bytes.`),process.exit(1)),t}function c(e){console.log(`Workflows (${e.length}):\n`);for(let t of e){let e=t.isActive?`active`:`inactive`;if(console.log(` ${t.name} (${e})`),t.description){let e=t.description.length>80?`${t.description.slice(0,80)}…`:t.description;console.log(` ${e}`)}console.log(` ${t.myRole??`no-role`} · ID: ${t.id}`),console.log(``)}}function l(e,t){console.log(`${e.name}\n`),console.log(` ID: ${e.id}`),console.log(` Active: ${e.isActive}`),console.log(` My role: ${e.myRole??`no-role`}`),e.description&&console.log(` Description: ${e.description}`),console.log(` Updated: ${o(e.updatedAt)}`);let n=e.scriptSource.split(`
2
+ import{b as e,j as t,l as n}from"./profile-storage-DYUIMuP0.js";import{readFileSync as r}from"node:fs";const i=262144,a=new Set([`completed`,`failed`,`cancelled`]);function o(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function s(e){let t;try{t=r(e,`utf8`)}catch{console.error(`Cannot read script file: ${e}`),process.exit(1)}return t.trim().length===0&&(console.error(`Script file is empty: ${e}`),process.exit(1)),Buffer.byteLength(t,`utf8`)>i&&(console.error(`Script file exceeds ${i} bytes.`),process.exit(1)),t}function c(e){console.log(`Workflows (${e.length}):\n`);for(let t of e){let e=t.isActive?`active`:`inactive`;if(console.log(` ${t.name} (${e})`),t.description){let e=t.description.length>80?`${t.description.slice(0,80)}…`:t.description;console.log(` ${e}`)}console.log(` ${t.myRole??`no-role`} · ID: ${t.id}`),console.log(``)}}function l(e,t){console.log(`${e.name}\n`),console.log(` ID: ${e.id}`),console.log(` Active: ${e.isActive}`),console.log(` My role: ${e.myRole??`no-role`}`),e.description&&console.log(` Description: ${e.description}`),console.log(` Updated: ${o(e.updatedAt)}`);let n=e.scriptSource.split(`
3
3
  `).length;t?(console.log(`\n Script (${n} lines):\n`),console.log(e.scriptSource)):console.log(` Script: ${n} lines (use --show-source to print)`)}function u(e){console.log(`Runs (${e.length}):\n`);for(let t of e){let e=o(t.startedAt??t.createdAt);console.log(` ${t.status}${e?` · ${e}`:``}`),console.log(` ID: ${t.id}`)}}function d(e){console.log(`Run ${e.id}`),console.log(` Workflow: ${e.workflowId}`),console.log(` Status: ${e.status}`),e.startedAt&&console.log(` Started: ${o(e.startedAt)}`),e.completedAt&&console.log(` Completed: ${o(e.completedAt)}`),e.error!=null&&console.log(` Error: ${JSON.stringify(e.error)}`);let t=Object.entries(e.context?.nodes??{});if(t.length>0){console.log(`\n Nodes (${t.length}):`);for(let[e,n]of t){let t=[n.kind??`node`,n.status];n.durationMs!=null&&t.push(`${n.durationMs}ms`),console.log(` - ${n.label??e} [${t.join(` · `)}]`)}}let n=e.context?.logs??[];if(n.length>0){console.log(`
4
4
  Logs:`);for(let e of n)console.log(` ${e}`)}e.context?.spent!=null&&console.log(`\n Tokens spent: ${e.context.spent}`)}function f(e){let n=t(e);if(console.log(`User grants (${n.length}):`),n.length===0){console.log(` (none)`);return}for(let e of n)console.log(` - ${e.user.name} <${e.user.email}> · ${e.role}`),console.log(` ID: ${e.userId}`)}async function p(e,t,n,r,i){for(let o=0;o<600;o++){let s=await e.getWorkflowRun(t,n,r,i);if(a.has(s.status))return o>0&&process.stderr.write(`
5
5
  `),s;let c=o*2;process.stderr.write(`\rWaiting… ${s.status} (${c}s)`),await new Promise(e=>setTimeout(e,2e3))}throw process.stderr.write(`
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{S as e,b as t,c as n}from"./profile-storage-mtd3aKrx.js";async function r(r){let i=await e.getAll(),a=await n(),{workspaces:o}=await new t().getWorkspaces(a);if(r.json){console.log(JSON.stringify(o));return}if(o.length===0){console.log(`No workspaces found.`);return}console.log(`Workspaces (${o.length}):\n`);for(let e of o){let t=e.id===i?.workspaceId?` (current)`:``;console.log(` ${e.name}${t}`),console.log(` ID: ${e.id}`),console.log(``)}}async function i(r,i){let a=await n(),{workspaces:o}=await new t().getWorkspaces(a),s=o.find(e=>e.id===r);if(!s){console.error(`Workspace not found: ${r}`),console.error(`
2
+ import{S as e,b as t,c as n}from"./profile-storage-DYUIMuP0.js";async function r(r){let i=await e.getAll(),a=await n(),{workspaces:o}=await new t().getWorkspaces(a);if(r.json){console.log(JSON.stringify(o));return}if(o.length===0){console.log(`No workspaces found.`);return}console.log(`Workspaces (${o.length}):\n`);for(let e of o){let t=e.id===i?.workspaceId?` (current)`:``;console.log(` ${e.name}${t}`),console.log(` ID: ${e.id}`),console.log(``)}}async function i(r,i){let a=await n(),{workspaces:o}=await new t().getWorkspaces(a),s=o.find(e=>e.id===r);if(!s){console.error(`Workspace not found: ${r}`),console.error(`
3
3
  Available workspaces:`);for(let e of o)console.error(` ${e.name}: ${e.id}`);process.exit(1)}if(await e.saveWorkspaceId(r),i.json){console.log(JSON.stringify({workspaceId:r,workspaceName:s.name}));return}console.log(`Switched to workspace: ${s.name}`),console.log(` ID: ${r}`)}export{r as listWorkspaces,i as switchWorkspace};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entrydesk/cli",
3
- "version": "2.0.0-beta",
3
+ "version": "2.0.0",
4
4
  "description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,6 +28,11 @@
28
28
  "uuid": "^14.0.0"
29
29
  },
30
30
  "devDependencies": {
31
+ "@entrydesk/client-tools": "^0.0.0",
32
+ "@entrydesk/shared": "^0.0.0",
33
+ "@gntc/ci": "^0.0.0",
34
+ "@gntc/utils": "^0.0.0",
35
+ "@gntc/vitest": "^0.0.0",
31
36
  "@rolldown/plugin-babel": "^0.2.3",
32
37
  "@testing-library/react": "^16.3.2",
33
38
  "@types/archiver": "^7.0.0",
@@ -40,12 +45,7 @@
40
45
  "oxlint": "^1.78.0",
41
46
  "tsdown": "^0.22.14",
42
47
  "typescript": "^7.0.2",
43
- "vitest": "^4.1.8",
44
- "@entrydesk/client-tools": "^0.0.0",
45
- "@entrydesk/shared": "^0.0.0",
46
- "@gntc/vitest": "^0.0.0",
47
- "@gntc/utils": "^0.0.0",
48
- "@gntc/ci": "^0.0.0"
48
+ "vitest": "^4.1.8"
49
49
  },
50
50
  "optionalDependencies": {
51
51
  "keytar": "^7.9.0"
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{U as e,Z as t,b as n,et as r,j as i,l as a,tt as o}from"./profile-storage-mtd3aKrx.js";function s(e){return e?o([...new Set(e)]):t}function c(e){console.log(`Available agents (${e.length}):\n`);for(let t of e){if(console.log(` ${t.name} (${t.visibility})`),t.description){let e=t.description.length>80?`${t.description.slice(0,80)}…`:t.description;console.log(` ${e}`)}console.log(` ID: ${t.id}`),console.log(``)}}function l(e){console.log(`My agents (${e.length}):\n`);for(let t of e){let e=[];t.latestVersionNumber!=null&&e.push(`v${t.latestVersionNumber}`),t.hasUnpublishedChanges&&e.push(`unpublished changes`);let n=e.length>0?` (${e.join(` · `)})`:``;if(console.log(` ${t.name}${n}`),t.description){let e=t.description.length>80?`${t.description.slice(0,80)}…`:t.description;console.log(` ${e}`)}console.log(` ${t.myRole??`no-role`} · ID: ${t.id}`),console.log(``)}}function u(t){if(console.log(`${t.name}\n`),console.log(` ID: ${t.id}`),t.visibility&&console.log(` Visibility: ${t.visibility}`),t.model&&console.log(` Model: ${t.model.name}`),t.author&&console.log(` Author: ${t.author.name}${t.author.isMe?` (you)`:``}`),t.description&&console.log(` Description: ${t.description}`),t.capabilities){let n=r(t.capabilities).map(t=>e(t));n.length>0&&console.log(` Capabilities: ${n.join(`, `)}`)}t.connectors&&t.connectors.length>0&&console.log(` Connectors: ${t.connectors.map(e=>e.name).join(`, `)}`),t.tools&&t.tools.length>0&&console.log(` Tools: ${t.tools.length}`),t.conversationStarters&&t.conversationStarters.length>0&&console.log(` Starters: ${t.conversationStarters.length}`),t.systemPrompt&&console.log(`\n System prompt:\n${t.systemPrompt}`)}function d(e){let t=i(e);if(console.log(`User grants (${t.length}):`),t.length===0){console.log(` (none)`);return}for(let e of t)console.log(` - ${e.user.name} <${e.user.email}> · ${e.role}`),console.log(` ID: ${e.userId}`)}async function f(e){let{accessToken:t,workspaceId:r}=await a(),i=new n;if(e.mine){let n=[],a=e.all?void 0:e.nextKey;for(let o=0;;o++){o>=100&&(console.error(`Reached maximum page limit (100). Use --limit and --next-key for manual pagination.`),process.exit(1));let s=await i.getMyAgents(t,r,{limit:e.limit,nextKey:a});if(n.push(...s.agents),a=s.nextKey,!e.all||!a)break}if(e.json){console.log(JSON.stringify({agents:n,nextKey:a}));return}if(n.length===0){console.log("You own no agents in this workspace. Create one with `entrydesk agents create --name <name> …`, or browse `entrydesk marketplace`.");return}l(n),!e.all&&a&&console.log(`Next page: --next-key ${a}`);return}if(e.all){let n=[],a;for(let o=0;;o++){o>=100&&(console.error(`Reached maximum page limit (100). Use --limit and --next-key for manual pagination.`),process.exit(1));let s=await i.getAgents(t,r,{limit:e.limit??100,nextKey:a});if(n.push(...s.agents),a=s.nextKey,!a)break}if(e.json){console.log(JSON.stringify({agents:n}));return}if(n.length===0){console.log("No agents in this workspace yet. Create one with `entrydesk agents create`, or browse `entrydesk marketplace`.");return}c(n);return}let{agents:o,nextKey:s}=await i.getAgents(t,r,{limit:e.limit,nextKey:e.nextKey});if(e.json){console.log(JSON.stringify({agents:o,nextKey:s}));return}if(o.length===0){console.log("No agents in this workspace yet. Create one with `entrydesk agents create`, or browse `entrydesk marketplace`.");return}c(o),s&&console.log(`Next page: --next-key ${s}`)}async function p(e,t){let{accessToken:r,workspaceId:i}=await a(),o=await new n().getAgent(r,i,e);if(t.json){console.log(JSON.stringify(o));return}u(o)}async function m(e){let{accessToken:t,workspaceId:r}=await a(),i=await new n().createAgent(t,r,{name:e.name,description:e.description,systemPrompt:e.systemPrompt,modelId:e.modelId,connectorIds:e.connectorIds??[],capabilities:s(e.capabilities),conversationStarters:e.conversationStarters??[],tools:e.tools,iconId:e.iconId});if(e.json){console.log(JSON.stringify(i));return}console.log(`Created agent: ${i.name}`),console.log(` ID: ${i.id}`)}async function h(e,t){let{accessToken:r,workspaceId:i}=await a(),o=new n,c=await o.getAgent(r,i,e),l={name:t.name??c.name,description:t.description??c.description,systemPrompt:t.systemPrompt??c.systemPrompt??``,modelId:t.modelId??c.model?.id??``,connectorIds:t.connectorIds??c.connectors?.map(e=>e.id)??[],capabilities:t.capabilities?s(t.capabilities):c.capabilities??{},conversationStarters:t.conversationStarters??c.conversationStarters??[],tools:t.tools??c.tools??[],iconId:t.iconId??c.iconId};await o.updateAgent(r,i,e,l),console.log(`Updated agent: ${e}`)}async function g(e){let{accessToken:t,workspaceId:r}=await a();await new n().deleteAgent(t,r,e),console.log(`Deleted agent: ${e}`)}async function _(e,t){let{accessToken:r,workspaceId:i}=await a();if(await new n().publishAgent(r,i,e),t.json){console.log(JSON.stringify({id:e,published:!0}));return}console.log(`Published agent to the workspace: ${e}`)}async function v(e,t){let{accessToken:r,workspaceId:i}=await a(),o=new n;if(t.addUser){let n=await o.upsertAgentGrant(r,i,e,t.addUser,t.role);if(t.json){console.log(JSON.stringify(n));return}console.log(`Granted ${t.role} to user ${t.addUser}`);return}if(t.removeUser){if(await o.removeAgentGrant(r,i,e,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.getAgentGrants(r,i,e);if(t.json){console.log(JSON.stringify(s));return}d(s)}export{m as createAgent,g as deleteAgent,f as listAgents,_ as publishAgent,v as shareAgent,p as showAgent,h as updateAgent};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,l as t,v as n}from"./profile-storage-mtd3aKrx.js";function r(e){return`$${e.toFixed(2)}`}function i(e){if(console.log(`Billing status: ${e.lifecycle.kind}`),e.subscription){let t=e.subscription,n=t.nextInvoiceDueAt?` · next invoice ${new Date(t.nextInvoiceDueAt).toLocaleDateString()}`:``;console.log(` Plan: ${t.planName} · ~${r(t.estimatedMonthlyChargeUsd)}/month${n}`)}else console.log(` Plan: (no active subscription)`);let t=e.seats;console.log(` Seats: pro ${t.assigned.pro}/${t.purchased.pro}, premium ${t.assigned.premium}/${t.purchased.premium} (assigned/purchased)`);let n=e.extraUsage;console.log(` Balance: ${r(n.balanceUsd)} extra usage`),console.log(` Spent: ${r(n.currentSpentUsd)} this period`),n.monthlyExtraUsageLimitUsd!=null&&console.log(` Limit: ${r(n.monthlyExtraUsageLimitUsd)} / month`)}function a(e){console.log(`Invoices (${e.length}):\n`);for(let t of e){let e=new Date(t.billingDate).toLocaleDateString();console.log(` ${e} · ${t.type} · ${t.status} · ${r(t.totalUsd)}`),t.hostedInvoiceUrl&&console.log(` ${t.hostedInvoiceUrl}`),console.log(` ID: ${t.id}`),console.log(``)}}async function o(){return n()&&(console.error("Billing requires an interactive login. A workspace PAT (ENTRYDESK_TOKEN) cannot read billing — run `entrydesk login`."),process.exit(1)),t()}async function s(t){let{accessToken:n,workspaceId:r}=await o(),a=await new e().getBillingOverview(n,r);if(t.json){console.log(JSON.stringify(a));return}i(a)}async function c(t){let{accessToken:n,workspaceId:r}=await o(),i=new e;if(t.all){let e=[],o;for(let a=0;;a++){a>=100&&(console.error(`Reached maximum page limit (100). Use --limit and --next-key for manual pagination.`),process.exit(1));let s=await i.getBillingInvoices(n,r,{limit:t.limit??20,nextKey:o});if(e.push(...s.invoices),o=s.nextKey,!o)break}if(t.json){console.log(JSON.stringify({invoices:e}));return}if(e.length===0){console.log(`No invoices.`);return}a(e);return}let{invoices:s,nextKey:c}=await i.getBillingInvoices(n,r,{limit:t.limit,nextKey:t.nextKey});if(t.json){console.log(JSON.stringify({invoices:s,nextKey:c}));return}if(s.length===0){console.log(`No invoices.`);return}a(s),c&&console.log(`Next page: --next-key ${c}`)}export{c as listInvoices,s as showBillingStatus};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{r as e}from"./commands-DbXuQqse.js";export{e as runSkillsUnlink};
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- import{b as e,l as t}from"./profile-storage-mtd3aKrx.js";import{t as n}from"./confirm-BrJZbaxf.js";async function r(n){let{accessToken:r,workspaceId:i}=await t(),{connectors:a,nextKey:o}=await new e().getConnectors(r,i,{connectionStatus:n.all?`all`:`connected`,search:n.search,limit:n.limit,nextKey:n.nextKey});if(n.json){console.log(JSON.stringify({connectors:a,nextKey:o}));return}if(a.length===0){console.log(n.all?`No connectors found.`:`No connected connectors. Use --all to browse connectable ones.`);return}let s=n.all?`Connectors`:`Connected connectors`;console.log(`${s} (${a.length}):\n`);for(let e of a){let t=e.connected?`connected`:`not connected`;console.log(` ${e.name} (${t})`),console.log(` Provider: ${e.provider}`),console.log(` ID: ${e.id}`),e.authorization?.type&&console.log(` Auth: ${e.authorization.type}`),console.log(``)}o&&console.log(`More results: --next-key ${o}`)}async function i(n,r){let{accessToken:i,workspaceId:a}=await t(),{tools:o}=await new e().getConnectorTools(i,a,n);if(r.json){console.log(JSON.stringify({tools:o}));return}if(o.length===0){console.log(`This connector exposes no tools.`);return}console.log(`Tools (${o.length}):\n`);for(let e of o)console.log(` ${e.name} [${e.policy}]`),e.description&&console.log(` ${e.description}`)}async function a(n,r){let{accessToken:i,workspaceId:a}=await t(),o=new e;if(r.oauth){let{url:e}=await o.getConnectorAuthUrl(i,a,n);if(r.json){console.log(JSON.stringify({url:e}));return}console.log(`Open this URL in your browser to authorize the connector:`),console.log(` ${e}`),console.log(`
3
- After you approve, the connection is saved automatically — re-run`),console.log("`entrydesk connectors` to confirm it shows as connected.");return}let s;r.token?s={token:r.token}:r.username&&r.password?s={username:r.username,password:r.password}:(console.error(`Provide --token, or --username and --password, or --oauth to connect.`),process.exit(1)),await o.connectConnectorToken(i,a,n,s),console.log(r.json?JSON.stringify({id:n,connected:!0}):`Connected connector ${n}.`)}async function o(r,i){let{accessToken:a,workspaceId:o}=await t();if(!i.yes&&(process.stdin.isTTY||(console.error(`Disconnecting connector ${r} needs confirmation. Re-run with --yes.`),process.exit(1)),!await n(`Disconnect connector ${r}?`))){console.log(`Aborted.`);return}await new e().disconnectConnector(a,o,r),console.log(i.json?JSON.stringify({id:r,disconnected:!0}):`Disconnected connector ${r}.`)}export{a as connectConnector,o as disconnectConnector,i as listConnectorTools,r as listConnectors};