@entrydesk/cli 1.18.0 → 1.20.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.
- package/dist/{agents-7XASAILN.js → agents-ILNVMFJT.js} +1 -1
- package/dist/billing-FWDGBFXX.js +24 -0
- package/dist/{budget-E4MIKV33.js → budget-HC4RRKBM.js} +1 -1
- package/dist/{meeting-DWJABQ3Q.js → chunk-CECPYYET.js} +11 -77
- package/dist/chunk-EIX7AV4F.js +4 -0
- package/dist/chunk-YBS4DYFH.js +2 -0
- package/dist/{config-MAO5TQEB.js → config-BRLPQW3X.js} +1 -1
- package/dist/{config-JRJVFRT3.js → config-Y6VAHJFF.js} +1 -1
- package/dist/{config-help-ZWR52H55.js → config-help-ZTHSANAW.js} +1 -1
- package/dist/connectors-GWHJEIPL.js +39 -0
- package/dist/help-RTXIBJ6C.js +4 -0
- package/dist/index.js +1 -1
- package/dist/{login-GGUSZBMP.js → login-62SHYTYL.js} +1 -1
- package/dist/{logout-DDKAWMZ4.js → logout-DUDWGSSH.js} +1 -1
- package/dist/marketplace-I5CPHCMV.js +38 -0
- package/dist/{mcp-VIM4EXHV.js → mcp-42I2ILS7.js} +1 -1
- package/dist/meeting-F55223JK.js +68 -0
- package/dist/{models-LBT6N52A.js → models-5L2J4PIS.js} +1 -1
- package/dist/{notifications-XQVFALKW.js → notifications-GK2XLM5S.js} +1 -1
- package/dist/{profile-QNR7NAEU.js → profile-SA5GTVBZ.js} +1 -1
- package/dist/recordings-DQUNZHXK.js +42 -0
- package/dist/{schedules-JPOOWXID.js → schedules-O25TSYEY.js} +1 -1
- package/dist/skills-GMI3HSG6.js +27 -0
- package/dist/{status-Y4MUTFMJ.js → status-J77PC3PX.js} +1 -1
- package/dist/{task-C3ITCXH4.js → task-UA3BYLVA.js} +60 -35
- package/dist/tasks-KOMITUOV.js +41 -0
- package/dist/{tool-HOWJ4M6M.js → tool-TW2I32SE.js} +6 -6
- package/dist/usage-4ZIO6EC5.js +29 -0
- package/dist/{version-OVZYDUUX.js → version-7UBQKXV7.js} +1 -1
- package/dist/{workflow-TXNP3Z53.js → workflow-U5OA6K4T.js} +1 -1
- package/dist/{workspaces-ENEOI2LZ.js → workspaces-BWXFSML5.js} +1 -1
- package/package.json +3 -3
- package/dist/chunk-GQWF4JEC.js +0 -4
- package/dist/connectors-KHWU2ZWF.js +0 -3
- package/dist/help-CJZSDNUL.js +0 -215
- package/dist/skills-QIEVXMWP.js +0 -25
- package/dist/tasks-LJHCATKL.js +0 -21
- package/dist/usage-R366J6YU.js +0 -18
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{h as I,q as A,r as O,t as v}from"./chunk-EIX7AV4F.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(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function w(t,n){if(n)return t;let r=t.split(`
|
|
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(`
|
|
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(`
|
|
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(`
|
|
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
|
+
`))}return r.join(`
|
|
14
|
+
|
|
15
|
+
`).trim()}function U(){console.log(`
|
|
16
|
+
Usage: entrydesk tasks [taskId] [options]
|
|
17
|
+
|
|
18
|
+
List your tasks, search them, or view a single task's messages.
|
|
19
|
+
|
|
20
|
+
Options:
|
|
21
|
+
-q, --search <query> Filter tasks by a search query
|
|
22
|
+
--limit <n> Max tasks to return (1-50)
|
|
23
|
+
--next-key <key> Pagination cursor from a previous page
|
|
24
|
+
-s, --share <shareId> View a shared task's messages (no login needed)
|
|
25
|
+
--output stream-json Stream a task's messages as JSON events
|
|
26
|
+
--full-output Show full tool outputs when viewing a task
|
|
27
|
+
--json Output JSON
|
|
28
|
+
|
|
29
|
+
Examples:
|
|
30
|
+
entrydesk tasks # List recent tasks
|
|
31
|
+
entrydesk tasks -q "deploy" --limit 20 # Search tasks
|
|
32
|
+
entrydesk tasks <taskId> # View a task's messages
|
|
33
|
+
entrydesk tasks <taskId> --full-output # ...with full tool outputs
|
|
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(`
|
|
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};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{c as S,
|
|
2
|
+
import{c as S,r as _}from"./chunk-EIX7AV4F.js";import"./chunk-KURQCTT3.js";import R from"fs";import{Client as L}from"@modelcontextprotocol/sdk/client/index.js";import{StreamableHTTPClientTransport as v}from"@modelcontextprotocol/sdk/client/streamableHttp.js";async function A(e={}){let t=e.apiUrl,n=e.accessToken,o=e.workspaceId;if(!n||!o){let l=await _();n=n||l.accessToken,o=o||l.workspaceId}t||(t=S().apiUrl);let i=new L({name:"entrydesk-cli",version:"1.0.0"}),s=new URL(`${t}/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 F(e){let t=e.trim().replace(/[/\\:*?"<>|\s]/g,"_").replace(/_+/g,"_").replace(/^[._]+|[._]+$/g,"").slice(0,b);return!t||t==="."||t===".."?"unnamed_tool":t}function J(e){try{return JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}n`:typeof n=="function"?"[Function]":typeof n=="symbol"?n.toString():n,2)}catch{return String(e)}}function B(e){let t=new Date,n=[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("-"),o=F(e);return`${n}_${o}.json`}async function N(e,t){try{return await h.writeFile(e,t,{encoding:"utf8",flag:"wx"}),!0}catch(n){if(n instanceof Error&&"code"in n&&n.code==="EEXIST")return!1;throw n}}async function C(e,t){try{let n=U();await h.mkdir(n,{recursive:!0});let o=B(e),i=d.extname(o),s=o.slice(0,-i.length),r=J(t),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(e,t){let n=Buffer.byteLength(e,"utf8");if(n<=P)return e;let o=e.slice(0,O),i=e.slice(-I),r=((n-O-I)/1024).toFixed(1),l=(n/1024).toFixed(1),u=` ... (skipped ${r}KB of ${l}KB) ...`;return t&&(u+=`
|
|
3
3
|
Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${o}
|
|
4
4
|
|
|
5
5
|
${u}
|
|
6
6
|
|
|
7
|
-
${i}`}function $(e){console.log(`${p.green}Tool execution result saved to: ${e}${p.reset}`),console.log()}function E(){console.log(`${p.green}Tool execution result:${p.reset}`)}function
|
|
8
|
-
`)}function
|
|
9
|
-
`)}async function
|
|
10
|
-
`);for(let r of i)console.log(
|
|
7
|
+
${i}`}function $(e){console.log(`${p.green}Tool execution result saved to: ${e}${p.reset}`),console.log()}function E(){console.log(`${p.green}Tool execution result:${p.reset}`)}function H(e){return e.split("__")[0]??e}function f(e,t,n){console.error(n?JSON.stringify({error:{code:e,message:t}}):`Error [${e}]: ${t}`),process.exit(1)}function g(e,t,n="CONNECTION_FAILED"){let o=e instanceof Error?e.message:"Unknown error";o.includes("Not logged in")||o.includes("not-logged-in")?f("AUTH_MISSING",o,t):f(n,o,t)}async function Y(){return process.stdin.isTTY?null:new Promise(e=>{let t=[],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(),e(c))};s=c=>{n=!0,clearTimeout(i),t.push(c)},r=()=>{t.length===0?a(null):a(Buffer.concat(t).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(t){super(t),this.name="InputError"}};async function V(e,t){if(e)return e;if(t)try{return R.readFileSync(t,"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(e){let t=[];return t.push(`Tool: ${e.name}`),e.description&&t.push(` Description: ${e.description}`),t.join(`
|
|
8
|
+
`)}function X(e){let t=[];return t.push(`Tool: ${e.name}`),e.description&&(t.push("Description:"),t.push(` ${e.description}`)),t.push("Input Schema:"),t.push(JSON.stringify(e.inputSchema,null,2)),t.join(`
|
|
9
|
+
`)}async function z(e,t){let n=await T().catch(o=>{g(o,e)});try{let i=(await n.listTools()).tools;if(t){let s=t.toLowerCase();i=i.filter(r=>H(r.name).toLowerCase().startsWith(s))}if(e)console.log(JSON.stringify(i,null,2));else{let s=t?` (prefix: ${t})`:"";console.log(`Available Tools (${i.length})${s}:
|
|
10
|
+
`);for(let r of i)console.log(q(r)),console.log()}}catch(o){g(o,e)}finally{await n.close().catch(()=>{})}}async function G(e,t){let n=await T().catch(o=>{g(o,t)});try{let i=(await n.listTools()).tools.find(s=>s.name===e);i||f("TOOL_NOT_FOUND",`Tool not found: ${e}`,t),console.log(t?JSON.stringify(i,null,2):X(i))}catch(o){g(o,t)}finally{await n.close().catch(()=>{})}}async function K(e,t,n){let o;try{o=JSON.parse(t)}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:e,arguments:o});if(n)console.log(JSON.stringify(r,null,2));else{let l=await C(e,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 x(){console.log(`Usage: entrydesk tool <action> [options]
|
|
11
11
|
|
|
12
12
|
Actions:
|
|
13
13
|
list List all available tools
|
|
@@ -32,4 +32,4 @@ Examples:
|
|
|
32
32
|
entrydesk tool call agent__search_agents --input '{"limit": 5}'
|
|
33
33
|
entrydesk tool call agent__search_agents --input-file input.json
|
|
34
34
|
echo '{"limit": 5}' | entrydesk tool call agent__search_agents
|
|
35
|
-
`);break}}export{m as InputError,
|
|
35
|
+
`)}async function at(e){let t=e.json??!1;if(e.help){x();return}switch(e.action){case"list":await z(t,e.prefix);break;case"get":e.name||f("INVALID_INPUT","Tool name is required",t),await G(e.name,t);break;case"call":{e.name||f("INVALID_INPUT","Tool name is required",t);let n;try{n=await V(e.input,e.inputFile)}catch(o){throw o instanceof m&&f("INVALID_INPUT",o.message,t),o}await K(e.name,n,t);break}default:x();break}}export{m as InputError,V as getInputJson,x as printToolUsage,Y as readStdin,at as runTool};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{h as d,r as y,t as U}from"./chunk-EIX7AV4F.js";import"./chunk-KURQCTT3.js";import{writeFileSync as S}from"fs";function $(){console.log(`
|
|
3
|
+
Usage: entrydesk usage [balance|me|consumptions|export] [options]
|
|
4
|
+
|
|
5
|
+
Commands:
|
|
6
|
+
(default) Per-user monthly cost/operations summary
|
|
7
|
+
balance Workspace USD balance, spend, and limits
|
|
8
|
+
me Your own usage and availability
|
|
9
|
+
consumptions Per-user extra-usage breakdown (--limit/--offset)
|
|
10
|
+
export Export per-user usage as CSV (-o <file>, else stdout)
|
|
11
|
+
|
|
12
|
+
Options:
|
|
13
|
+
--limit <number> Limit rows (default: all for summary; 20 for consumptions)
|
|
14
|
+
--sort-by cost|operations Sort the summary by cost or operations (default: cost)
|
|
15
|
+
--offset <number> Offset for consumptions pagination
|
|
16
|
+
--period-start <ISO> Period start for consumptions/export
|
|
17
|
+
-o, --output <file> Write export CSV to a file (default: stdout)
|
|
18
|
+
--json Output JSON
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
entrydesk usage balance
|
|
22
|
+
entrydesk usage me
|
|
23
|
+
entrydesk usage consumptions --limit 20
|
|
24
|
+
entrydesk usage export -o usage.csv
|
|
25
|
+
`)}function s(o){return`$${o.toFixed(2)}`}function C(o){console.log(`Extra-usage balance: ${s(o.balanceUsd)}`);let n=o.currentSpentUsedPercent!=null?` (${o.currentSpentUsedPercent}% of limit)`:"";console.log(`Spent this period: ${s(o.currentSpentUsd)}${n}`),o.monthlyExtraUsageLimitUsd!=null&&console.log(`Workspace limit: ${s(o.monthlyExtraUsageLimitUsd)} / month`),o.memberMonthlyExtraUsageLimitUsd!=null&&console.log(`Per-member limit: ${s(o.memberMonthlyExtraUsageLimitUsd)} / month`),o.nextExpiry&&console.log(`Next expiry: ${s(o.nextExpiry.amountUsd)} at ${new Date(o.nextExpiry.expiresAt).toLocaleString()}`),console.log(`Period: ${new Date(o.period.startAt).toLocaleDateString()} \u2013 ${new Date(o.period.endAt).toLocaleDateString()}`)}function b(o){console.log(`Seat type: ${o.seatType}`),o.hourly&&console.log(`Hourly used: ${o.hourly.usedPercent}%`),console.log(`Weekly used: ${o.weekly.usedPercent}%`),console.log(`Extra spent: ${s(o.extraUsage.spentUsd)}`),console.log(`Available: ${o.availability.allowed?"yes":`no (${o.availability.reason??"unknown"})`}`),o.trial&&console.log(`Trial: ${o.trial.remainingDays} days remaining`)}function k(o){console.log(`Consumptions (${o.items.length} of ${o.total}):
|
|
26
|
+
`);for(let n of o.items)console.log(` ${n.user.name} (${n.user.email})`),console.log(` Seat: ${n.seatType} \xB7 Extra usage: ${s(n.extraUsage)}`),console.log(` User ID: ${n.user.id}`),console.log("")}async function P(o){if(o.help){$();return}let n,i;try{let e=await y();n=e.accessToken,i=e.workspaceId}catch(e){let a=e instanceof Error?e.message:"Authentication failed";console.error(a),process.exit(1)}let r=new d;try{if(o.action==="balance"){let t=await r.getUsageOverview(n,i);if(o.json){console.log(JSON.stringify(t));return}C(t);return}if(o.action==="me"){let t=await r.getUsageMe(n,i);if(o.json){console.log(JSON.stringify(t));return}b(t);return}if(o.action==="consumptions"){let t=await r.getUsageConsumptions(n,i,{limit:o.limit,offset:o.offset,periodStart:o.periodStart});if(o.json){console.log(JSON.stringify(t));return}if(t.items.length===0){console.log("No consumptions for this period.");return}k(t);return}if(o.action==="export"){let t=await r.exportUsageCsv(n,i,o.periodStart);o.output?(S(o.output,t),console.log(`Wrote usage CSV to ${o.output}`)):process.stdout.write(t);return}o.action&&(console.error(`Unknown usage command: ${o.action}`),$(),process.exit(1));let e=[],a,u=0,h=100;do{let t=await r.getMonthlyUsages(n,i,{nextKey:a,limit:100});if(e.push(...t.monthlyUsages),a=t.nextKey,u++,u>=h){console.error(`Warning: Showing first ${e.length} entries (pagination limit reached)`);break}}while(a);if(o.json){console.log(JSON.stringify(e));return}if(e.length===0){console.log("No usage data found for this workspace.");return}console.log(`Current Month Usage:
|
|
27
|
+
`);let g=0,p=0;for(let t of e)g+=parseFloat(t.totalCost),p+=t.operationCount;console.log(`Total Cost: $${g.toFixed(2)}`),console.log(`Total Operations: ${p.toLocaleString()}`),console.log(`Users: ${e.length}
|
|
28
|
+
`);let m=o.sortBy||"cost",f=[...e].toSorted((t,c)=>m==="cost"?parseFloat(c.totalCost)-parseFloat(t.totalCost):c.operationCount-t.operationCount),x=o.limit&&o.limit>0?o.limit:f.length,l=f.slice(0,x);console.log(`Usage by User (sorted by ${m}, showing ${l.length} of ${e.length}):
|
|
29
|
+
`);for(let t of l){let c=parseFloat(t.totalCost);console.log(` ${t.user.name} (${t.user.email})`),console.log(` Cost: $${c.toFixed(2)}`),console.log(` Operations: ${t.operationCount.toLocaleString()}`),console.log("")}l.length<e.length&&console.log(`... and ${e.length-l.length} more users`)}catch(e){U(e)}}export{P as runUsage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-KURQCTT3.js";function n(){console.log("entrydesk 1.
|
|
2
|
+
import"./chunk-KURQCTT3.js";function n(){console.log("entrydesk 1.20.0")}export{n as printVersion};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{h as u,
|
|
2
|
+
import{h as u,r as p,t as g}from"./chunk-EIX7AV4F.js";import"./chunk-KURQCTT3.js";import{readFileSync as $}from"fs";var k=262144,x=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:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{g as a,h as w,
|
|
2
|
+
import{g as a,h as w,q as k}from"./chunk-EIX7AV4F.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.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"typescript": "^6.0.3",
|
|
38
38
|
"vitest": "^4.1.6",
|
|
39
39
|
"@entrydesk/ci": "^0.0.0",
|
|
40
|
-
"@entrydesk/
|
|
41
|
-
"@entrydesk/
|
|
40
|
+
"@entrydesk/shared": "^0.0.0",
|
|
41
|
+
"@entrydesk/utils": "^0.0.0"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
44
|
"keytar": "^7.9.0"
|
package/dist/chunk-GQWF4JEC.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import U from"fs";import y from"fs";import Ue from"os";import T from"path";import{HTTPError as Ie,TimeoutError as Me}from"ky";import{HTTPError as xe}from"ky";import we,{TimeoutError as ke,isHTTPError as ve}from"ky";import E from"crypto";import d from"fs";import ue from"path";var de="ENTRYDESK_FORCE_FILE_STORAGE",R="EntryDesk CLI",pe="__entrydesk_keychain_test__",he="profile:",fe=".credentials.key",Q={keychain:!1,permissions:!1,corruptFile:!1,windowsFile:!1};function k(s,e){Q[s]||(Q[s]=!0,console.error(e))}function ye(){return process.env.ENTRYDESK_DEBUG?.toLowerCase()==="true"}function ee(s){if(!s||typeof s!="object")return!1;let e=s;return!(!("accessToken"in e||"refreshToken"in e||"email"in e||"workspaceId"in e)||"accessToken"in e&&typeof e.accessToken!="string"||"refreshToken"in e&&typeof e.refreshToken!="string"||"email"in e&&typeof e.email!="string"||"workspaceId"in e&&typeof e.workspaceId!="string")}function me(s){if(!s||typeof s!="object")return!1;let e=s;return typeof e.getPassword=="function"&&typeof e.setPassword=="function"&&typeof e.deletePassword=="function"}function z(s){return a.getProfileCredentialsFile(s)}var F=class{getKeyFilePath(e){return ue.join(a.getProfileDir(e),fe)}loadEncryptionKey(e){let t=this.getKeyFilePath(e);try{if(!d.existsSync(t))return null;let r=d.readFileSync(t);return r.length!==32?null:(this.ensureSecureFilePermissions(t),r)}catch{return null}}createEncryptionKey(e){a.ensureProfileDir(e);let t=this.getKeyFilePath(e),r=E.randomBytes(32);return d.writeFileSync(t,r,{mode:384}),this.ensureSecureFilePermissions(t),r}getOrCreateEncryptionKey(e){let t=this.loadEncryptionKey(e);return t||this.createEncryptionKey(e)}encrypt(e,t){let r=E.randomBytes(16),n=E.createCipheriv("aes-256-gcm",t,r),i=n.update(e,"utf8","hex");i+=n.final("hex");let o=n.getAuthTag();return`${r.toString("hex")}:${o.toString("hex")}:${i}`}decrypt(e,t){let r=e.split(":");if(r.length!==3)throw new Error("Invalid encrypted data format");let n=Buffer.from(r[0],"hex"),i=Buffer.from(r[1],"hex"),o=r[2],S=E.createDecipheriv("aes-256-gcm",t,n,{authTagLength:16});S.setAuthTag(i);let u=S.update(o,"hex","utf8");return u+=S.final("utf8"),u}tryDecrypt(e,t){try{return this.decrypt(e,t)}catch{return null}}tryParseCredentials(e){try{let t=JSON.parse(e);return ee(t)?t:null}catch{return null}}ensureSecureFilePermissions(e){if(process.platform!=="win32"){try{d.chmodSync(e,384)}catch{k("permissions","Warning: Failed to set secure permissions on credentials file.");return}try{(d.statSync(e).mode&511)!==384&&k("permissions","Warning: Credentials file permissions are too permissive.")}catch{k("permissions","Warning: Failed to verify credentials file permissions.")}}}async getCredentials(e){let t=z(e);try{if(!d.existsSync(t))return null;let r=d.readFileSync(t,"utf-8").trim();if(!r)return null;let n=this.loadEncryptionKey(e),i=n?this.tryDecrypt(r,n):null;if(i){let o=this.tryParseCredentials(i);if(o)return o}return k("corruptFile","Warning: Credentials file is unreadable. Please run `entrydesk login` again."),null}catch{return null}}async setCredentials(e,t){a.ensureProfileDir(e);let r=z(e),n=this.getOrCreateEncryptionKey(e),i=this.encrypt(JSON.stringify(t),n);d.writeFileSync(r,i,{mode:384}),this.ensureSecureFilePermissions(r)}async deleteCredentials(e){let t=z(e);try{d.existsSync(t)&&d.unlinkSync(t)}catch{}}},N=class{keytarModule=null;keytarLoadAttempted=!1;keychainAvailable=null;async getKeytar(){if(this.keytarLoadAttempted)return this.keytarModule;this.keytarLoadAttempted=!0;try{let t=await import("keytar"),r=t&&typeof t=="object"&&"default"in t?t.default:t;this.keytarModule=me(r)?r:null}catch{this.keytarModule=null}return this.keytarModule}getAccount(e){return`${he}${e}`}async checkKeychainAvailability(){if(this.keychainAvailable!==null)return this.keychainAvailable;try{let e=await this.getKeytar();if(!e)return this.keychainAvailable=!1,!1;let t=`${pe}${E.randomBytes(8).toString("hex")}`,r="test";await e.setPassword(R,t,r);let n=await e.getPassword(R,t),i=await e.deletePassword(R,t);return this.keychainAvailable=!!(i&&n===r),this.keychainAvailable}catch{return this.keychainAvailable=!1,!1}}async isAvailable(){return this.checkKeychainAvailability()}async getCredentials(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");let r=await t.getPassword(R,this.getAccount(e));if(!r)return null;let n=this.tryParseKeychainPayload(r);return n||k("corruptFile",`Warning: Keychain entry for profile "${e}" is unreadable.`),n}async setCredentials(e,t){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let r=await this.getKeytar();if(!r)throw new Error("Keytar module not available");let n=JSON.stringify(t);await r.setPassword(R,this.getAccount(e),n)}async deleteCredentials(e){if(!await this.checkKeychainAvailability())throw new Error("Keychain is not available");let t=await this.getKeytar();if(!t)throw new Error("Keytar module not available");await t.deletePassword(R,this.getAccount(e))}tryParseKeychainPayload(e){try{let t=JSON.parse(e);return ee(t)?t:null}catch{return null}}},O=class{keychainStorage=null;fileStorage=new F;keychainAvailable=null;initPromise=null;shouldForceFileStorage(){return process.env[de]?.toLowerCase()==="true"}async initializeStorage(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}try{let e=new N,t=await e.isAvailable();this.keychainAvailable=t,this.keychainStorage=t?e:null}catch{this.keychainAvailable=!1,this.keychainStorage=null}!this.keychainAvailable&&!this.shouldForceFileStorage()&&(ye()&&k("keychain","Keychain unavailable. Falling back to file-based credentials."),process.platform==="win32"&&k("windowsFile","Warning: File-based credentials on Windows may be readable by other users."))}async ensureInitialized(){if(this.shouldForceFileStorage()){this.keychainAvailable=!1,this.keychainStorage=null;return}this.keychainAvailable===null&&(this.initPromise??=this.initializeStorage(),await this.initPromise)}disableKeychain(){this.shouldForceFileStorage()||k("keychain","Keychain error encountered. Falling back to file-based credentials."),this.keychainAvailable=!1,this.keychainStorage=null}async getKeychainStorage(){return await this.ensureInitialized(),this.shouldForceFileStorage()?null:this.keychainAvailable?this.keychainStorage:null}async getCredentials(e){let t=await this.getKeychainStorage();if(!t)return this.fileStorage.getCredentials(e);try{let n=await t.getCredentials(e);if(n)return n}catch{return this.disableKeychain(),this.fileStorage.getCredentials(e)}let r=await this.fileStorage.getCredentials(e);if(r)try{await t.setCredentials(e,r),await this.fileStorage.deleteCredentials(e)}catch{}return r}async setCredentials(e,t){let r=await this.getKeychainStorage();if(!r){await this.fileStorage.setCredentials(e,t);return}try{await r.setCredentials(e,t),await this.fileStorage.deleteCredentials(e)}catch{this.disableKeychain(),await this.fileStorage.setCredentials(e,t)}}async deleteCredentials(e){let t=await this.getKeychainStorage();if(t)try{await t.deleteCredentials(e)}catch{this.disableKeychain()}await this.fileStorage.deleteCredentials(e)}},l=new O,p={async saveAccessToken(s,e){let t=a.getEffectiveProfileName(e),r=await l.getCredentials(t)??{};r.accessToken=s,await l.setCredentials(t,r)},async getAccessToken(s){let e=a.getEffectiveProfileName(s);return(await l.getCredentials(e))?.accessToken??null},async saveRefreshToken(s,e){let t=a.getEffectiveProfileName(e),r=await l.getCredentials(t)??{};r.refreshToken=s,await l.setCredentials(t,r)},async getRefreshToken(s){let e=a.getEffectiveProfileName(s);return(await l.getCredentials(e))?.refreshToken??null},async saveEmail(s,e){let t=a.getEffectiveProfileName(e),r=await l.getCredentials(t)??{};r.email=s,await l.setCredentials(t,r)},async getEmail(s){let e=a.getEffectiveProfileName(s);return(await l.getCredentials(e))?.email??null},async saveWorkspaceId(s,e){let t=a.getEffectiveProfileName(e),r=await l.getCredentials(t)??{};r.workspaceId=s,await l.setCredentials(t,r)},async getWorkspaceId(s){let e=a.getEffectiveProfileName(s);return(await l.getCredentials(e))?.workspaceId??null},async saveAll(s,e){let t=a.getEffectiveProfileName(e);await l.setCredentials(t,s)},async getAll(s){let e=a.getEffectiveProfileName(s);return l.getCredentials(e)},async clear(s){let e=a.getEffectiveProfileName(s);await l.deleteCredentials(e)},async isLoggedIn(s){let e=a.getEffectiveProfileName(s);return(await l.getCredentials(e))?.accessToken!=null}};var x=class s{client;baseUrl;constructor(e,t){this.baseUrl=e||B(t),K().ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",process.env.DEBUG&&console.log("[DEBUG] ApiClient: SSL certificate validation disabled")),this.client=we.create({baseUrl:this.baseUrl.replace(/\/?$/,"/"),timeout:3e4,retry:{limit:3,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504]},hooks:{beforeError:[({error:n})=>(ve(n)&&(n.request.headers.delete("authorization"),n.request.headers.delete("Authorization")),n)]}})}getBaseUrl(){return this.baseUrl}async refreshOAuthToken(e){return this.client.post("v1/oauth/token",{json:{grant_type:"refresh_token",refresh_token:e.refreshToken,client_id:e.clientId}}).json()}async revokeOAuthToken(e){await this.client.post("v1/oauth/revoke",{json:{token:e.token,token_type_hint:"refresh_token",client_id:e.clientId}})}async getWorkspaces(e){try{return process.env.DEBUG&&console.log(`[DEBUG] Calling getWorkspaces API: ${this.baseUrl}/v1/workspaces`),await this.client.get("v1/workspaces",{headers:{Authorization:`Bearer ${e}`}}).json()}catch(t){throw process.env.DEBUG&&(console.error("[DEBUG] getWorkspaces error:",t),t instanceof Error&&"cause"in t&&console.error("[DEBUG] Error cause:",t.cause)),t}}async getAgents(e,t,r){let n={limit:r?.limit??100};return r?.nextKey&&(n.nextKey=r.nextKey),r?.search&&(n.search=r.search),await this.client.get(`v1/workspaces/${t}/availableAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async createAgent(e,t,r){return await this.client.post(`v1/workspaces/${t}/agents`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async updateAgent(e,t,r,n){await this.client.put(`v1/workspaces/${t}/agents/${r}`,{headers:{Authorization:`Bearer ${e}`},json:n})}async deleteAgent(e,t,r){await this.client.delete(`v1/workspaces/${t}/agents/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getMyAgents(e,t,r){let n={limit:r?.limit??100};return r?.nextKey&&(n.nextKey=r.nextKey),r?.search&&(n.search=r.search),await this.client.get(`v1/workspaces/${t}/myAgents`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async publishAgent(e,t,r){await this.client.post(`v1/workspaces/${t}/agents/${r}/publish`,{headers:{Authorization:`Bearer ${e}`}})}async getAgentGrants(e,t,r){return await this.client.get(`v1/workspaces/${t}/agents/${r}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertAgentGrant(e,t,r,n,i){return await this.client.put(`v1/workspaces/${t}/agents/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeAgentGrant(e,t,r,n){await this.client.delete(`v1/workspaces/${t}/agents/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetings(e,t,r){let n={limit:r?.limit??20};return r?.nextKey&&(n.nextKey=r.nextKey),r?.search&&(n.search=r.search),r?.filter&&(n.filter=r.filter),r?.sortBy&&(n.sortBy=r.sortBy),await this.client.get(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async getMeeting(e,t,r){return await this.client.get(`v1/workspaces/${t}/meetings/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createMeeting(e,t,r){return await this.client.post(`v1/workspaces/${t}/meetings`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async updateMeeting(e,t,r,n){return await this.client.patch(`v1/workspaces/${t}/meetings/${r}`,{headers:{Authorization:`Bearer ${e}`},json:n}).json()}async deleteMeeting(e,t,r){await this.client.delete(`v1/workspaces/${t}/meetings/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getMeetingPreviousBrief(e,t,r){return await this.client.get(`v1/workspaces/${t}/meetings/${r}/previous`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getRecording(e,t,r){return await this.client.get(`v1/workspaces/${t}/recordings/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getMeetingShares(e,t,r){return await this.client.get(`v1/workspaces/${t}/meetings/${r}/shares`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertMeetingUserGrant(e,t,r,n,i){return await this.client.put(`v1/workspaces/${t}/meetings/${r}/shares/users/${n}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingUserGrant(e,t,r,n){await this.client.delete(`v1/workspaces/${t}/meetings/${r}/shares/users/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async upsertMeetingTeamGrant(e,t,r,n,i){return await this.client.put(`v1/workspaces/${t}/meetings/${r}/shares/teams/${n}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeMeetingTeamGrant(e,t,r,n){await this.client.delete(`v1/workspaces/${t}/meetings/${r}/shares/teams/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getWorkflows(e,t,r){let n={limit:r?.limit??20};return r?.nextKey&&(n.nextKey=r.nextKey),r?.search&&(n.search=r.search),await this.client.get(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async getWorkflow(e,t,r){return await this.client.get(`v1/workspaces/${t}/workflows/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createWorkflow(e,t,r){return await this.client.post(`v1/workspaces/${t}/workflows`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async updateWorkflow(e,t,r,n){await this.client.put(`v1/workspaces/${t}/workflows/${r}`,{headers:{Authorization:`Bearer ${e}`},json:n})}async triggerWorkflowRun(e,t,r,n){return await this.client.post(`v1/workspaces/${t}/workflows/${r}/runs`,{headers:{Authorization:`Bearer ${e}`},json:n===void 0?{}:{args:n}}).json()}async getWorkflowRuns(e,t,r,n){let i={limit:n?.limit??20};return n?.nextKey&&(i.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/workflows/${r}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async getWorkflowRun(e,t,r,n){return await this.client.get(`v1/workspaces/${t}/workflows/${r}/runs/${n}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getWorkflowGrants(e,t,r){return await this.client.get(`v1/workspaces/${t}/workflows/${r}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertWorkflowGrant(e,t,r,n,i){return await this.client.put(`v1/workspaces/${t}/workflows/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeWorkflowGrant(e,t,r,n){await this.client.delete(`v1/workspaces/${t}/workflows/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async getNotifications(e,t,r){let n={limit:r?.limit??20};return r?.tab&&(n.tab=r.tab),r?.eventType&&(n.eventType=r.eventType),r?.cursor&&(n.cursor=r.cursor),await this.client.get(`v1/workspaces/${t}/notifications`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async getNotificationUnreadCount(e,t){return await this.client.get(`v1/workspaces/${t}/notifications/unreadCount`,{headers:{Authorization:`Bearer ${e}`}}).json()}async markNotificationRead(e,t,r){await this.client.post(`v1/workspaces/${t}/notifications/${r}/read`,{headers:{Authorization:`Bearer ${e}`}})}async markAllNotificationsRead(e,t){await this.client.post(`v1/workspaces/${t}/notifications/readAll`,{headers:{Authorization:`Bearer ${e}`}})}async getModels(e,t){return await this.client.get(`v1/workspaces/${t}/models`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getConnectors(e,t){return await this.client.get(`v1/workspaces/${t}/availableConnectors`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:100,connectionStatus:"connected"}}).json()}async getTasks(e,t,r=20){return await this.client.get(`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:r}}).json()}async searchTasks(e,t,r,n){let i={q:r,limit:n?.limit??20};return n?.nextKey&&(i.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/tasks/search`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}async getMessages(e,t,r,n=50){return await this.client.get(`v1/workspaces/${t}/tasks/${r}/messages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{limit:n}}).json()}async getAgent(e,t,r){return await this.client.get(`v1/workspaces/${t}/agents/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async listAvailableSkills(e,t,r){return await this.client.get(`v1/workspaces/${t}/availableSkills`,{headers:{Authorization:`Bearer ${e}`},searchParams:{createdBy:r?.createdBy,nextKey:r?.nextKey,limit:r?.limit??20}}).json()}async uploadSkill(e,t,r){return await this.client.post(`v1/workspaces/${t}/skills`,{headers:{Authorization:`Bearer ${e}`},body:r}).json()}async deleteSkill(e,t,r){await this.client.delete(`v1/workspaces/${t}/skills/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async updateSkillPreference(e,t,r,n){return await this.client.patch(`v1/workspaces/${t}/skills/${r}/preference`,{headers:{Authorization:`Bearer ${e}`},json:{isEnabled:n}}).json()}async getSkillVersions(e,t,r){return await this.client.get(`v1/workspaces/${t}/skills/${r}/versions`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getSkillGrants(e,t,r){return await this.client.get(`v1/workspaces/${t}/skills/${r}/grants`,{headers:{Authorization:`Bearer ${e}`}}).json()}async upsertSkillGrant(e,t,r,n,i){return await this.client.put(`v1/workspaces/${t}/skills/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`},json:{role:i}}).json()}async removeSkillGrant(e,t,r,n){await this.client.delete(`v1/workspaces/${t}/skills/${r}/grants/${n}`,{headers:{Authorization:`Bearer ${e}`}})}async downloadSkillCurrent(e,t,r){return await this.client.get(`v1/workspaces/${t}/skills/${r}/download`,{headers:{Authorization:`Bearer ${e}`}}).json()}async task(e,t,r){try{let n=await this.client.post(`v1/workspaces/${t}/tasks`,{headers:{Authorization:`Bearer ${e}`},json:r,timeout:6e4,throwHttpErrors:!1});if(!n.ok){let o=await n.text();throw new Error(`Task API failed (${n.status}): ${o}`)}let i=await n.json();return i.noop||!i.streamId?new Response(`data: [DONE]
|
|
3
|
-
|
|
4
|
-
`,{headers:{"Content-Type":"text/event-stream"}}):await this.taskStream(e,t,i.taskId)}catch(n){throw n instanceof ke?new TypeError("Request timed out. Please check your connection and try again.",{cause:n}):n}}async taskStream(e,t,r){let n=await this.client.get(`v1/workspaces/${t}/tasks/${r}/stream`,{headers:{Authorization:`Bearer ${e}`,Accept:"text/event-stream"},timeout:!1,throwHttpErrors:!1});if(!n.ok){let i=await n.text();throw new Error(`Task stream failed (${n.status}): ${i}`)}return n}async getBudget(e,t){return await this.client.get(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`}}).json()}async updateBudget(e,t,r){await this.client.put(`v1/workspaces/${t}/budget`,{headers:{Authorization:`Bearer ${e}`},json:{budget:r}})}async getMonthlyUsages(e,t,r){return await this.client.get(`v1/workspaces/${t}/monthlyUsages`,{headers:{Authorization:`Bearer ${e}`},searchParams:{nextKey:r?.nextKey,limit:r?.limit??20}}).json()}async createTaskShare(e,t,r,n="public"){return await this.client.post(`v1/workspaces/${t}/tasks/${r}/shares`,{headers:{Authorization:`Bearer ${e}`},json:{visibility:n}}).json()}async getSharedTask(e,t){let r={};return t&&(r.Authorization=`Bearer ${t}`),await this.client.get(`v1/shares/${e}`,{headers:r}).json()}async getSharedMessages(e,t=50,r){let n={};return r&&(n.Authorization=`Bearer ${r}`),await this.client.get(`v1/shares/${e}/messages`,{headers:n,searchParams:{limit:t}}).json()}async deleteTask(e,t,r){await this.client.delete(`v1/workspaces/${t}/tasks/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async getModelProviders(e,t){return await this.client.get(`v1/workspaces/${t}/modelProviders`,{headers:{Authorization:`Bearer ${e}`}}).json()}async uploadFile(e,t,r,n){let i=new FormData,o=new Blob([r.buffer],{type:r.mimeType});return i.append("file",o,r.filename),i.append("modelProviderId",n),await this.client.post(`v1/workspaces/${t}/files`,{headers:{Authorization:`Bearer ${e}`},body:i,timeout:12e4}).json()}async getSchedules(e,t,r){let n={limit:r?.limit??20};return r?.nextKey&&(n.nextKey=r.nextKey),r?.search&&(n.search=r.search),await this.client.get(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},searchParams:n}).json()}async getSchedule(e,t,r){return await this.client.get(`v1/workspaces/${t}/schedules/${r}`,{headers:{Authorization:`Bearer ${e}`}}).json()}async createSchedule(e,t,r){return await this.client.post(`v1/workspaces/${t}/schedules`,{headers:{Authorization:`Bearer ${e}`},json:r}).json()}async updateSchedule(e,t,r,n){await this.client.put(`v1/workspaces/${t}/schedules/${r}`,{headers:{Authorization:`Bearer ${e}`},json:n})}async deleteSchedule(e,t,r){await this.client.delete(`v1/workspaces/${t}/schedules/${r}`,{headers:{Authorization:`Bearer ${e}`}})}async activateSchedule(e,t,r){await this.client.post(`v1/workspaces/${t}/schedules/${r}/activate`,{headers:{Authorization:`Bearer ${e}`}})}async deactivateSchedule(e,t,r){await this.client.post(`v1/workspaces/${t}/schedules/${r}/deactivate`,{headers:{Authorization:`Bearer ${e}`}})}async runScheduleNow(e,t,r){return await this.client.post(`v1/workspaces/${t}/schedules/${r}/run`,{headers:{Authorization:`Bearer ${e}`}}).json()}async getScheduleRuns(e,t,r,n){let i={limit:n?.limit??20};return n?.nextKey&&(i.nextKey=n.nextKey),await this.client.get(`v1/workspaces/${t}/schedules/${r}/runs`,{headers:{Authorization:`Bearer ${e}`},searchParams:i}).json()}static async getAuthenticatedClient(e){let t=await p.getAll(e);return t?{client:new s(void 0,e),accessToken:t.accessToken,workspaceId:t.workspaceId??null}:null}};function Pe(){return process.env.ENTRYDESK_SANDBOX==="true"}function _(){if(!Pe())return null;let s=process.env.ENTRYDESK_SANDBOX_ACCESS_TOKEN?.trim(),e=process.env.ENTRYDESK_SANDBOX_WORKSPACE_ID?.trim();if(!s||!e){let t=[];throw s||t.push("ENTRYDESK_SANDBOX_ACCESS_TOKEN"),e||t.push("ENTRYDESK_SANDBOX_WORKSPACE_ID"),new Error(`Sandbox mode enabled but missing credentials: ${t.join(", ")}`)}return{accessToken:s,workspaceId:e}}function L(){let s=process.env.ENTRYDESK_TOKEN?.trim();if(!s)return null;let e=process.env.ENTRYDESK_WORKSPACE_ID?.trim();if(!e)throw new Error("ENTRYDESK_TOKEN is set but ENTRYDESK_WORKSPACE_ID is missing. Both are required for PAT authentication.");return{accessToken:s,workspaceId:e}}function rt(){let s=_();if(s)return{authSource:"sandbox-env",label:"sandbox environment (ENTRYDESK_SANDBOX)",workspaceId:s.workspaceId};let e=L();return e?{authSource:"pat-env",label:"personal access token (ENTRYDESK_TOKEN)",workspaceId:e.workspaceId}:null}import{execFile as Se}from"child_process";import{setTimeout as Ae}from"timers/promises";import{decodeJwt as Re}from"jose";import $e,{HTTPError as Te,isHTTPError as Ee}from"ky";function te(s){if(s===null||typeof s!="object")return{error:""};let e=s;return{code:typeof e.code=="string"?e.code:void 0,error:typeof e.error=="string"?e.error:""}}var I="entrydesk-cli",be="offline_access workspaces:read tasks:read tasks:write tasks:delete agents:read agents:write connectors:read connectors:write tools:read tools:execute skills:read skills:write meetings:read meetings:write workflows:read workflows:write notifications:read notifications:write publishes:read publishes:write calendar:read calendar:write schedules:read schedules:write user:read user:write";function Ce(s){return new Promise((e,t)=>{let r=process.platform,n,i;switch(r){case"darwin":n="open",i=[s];break;case"win32":n="cmd",i=["/c","start","",s];break;default:n="xdg-open",i=[s];break}Se(n,i,o=>{o?t(new Error(`Failed to open browser. Please manually visit: ${s}`,{cause:o})):e()})})}async function ut(s){let e=B(),t=re(),r=K(),n=process.env.NODE_TLS_REJECT_UNAUTHORIZED;r.ignoreSslErrors&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0",console.error("WARNING: SSL certificate validation is disabled globally for this process during the login flow. All connections in this process will skip TLS verification. Only use ENTRYDESK_IGNORE_SSL_ERRORS for local development."));try{let i=$e.create({baseUrl:e.replace(/\/?$/,"/"),timeout:3e4,hooks:{beforeError:[({error:c})=>(Ee(c)&&(c.request.headers.delete("authorization"),c.request.headers.delete("Authorization")),c)]}}),o;try{o=await i.post("v1/oauth/device/code",{json:{client_id:I,scope:be}}).json()}catch(c){let w=c instanceof Error?c:new Error("Failed to request device code");throw s?.onError?.(w),w}let{device_code:S,user_code:u,expires_in:ae,interval:ce}=o,V=new URL("/oauth/device",t);V.searchParams.set("user_code",u);let X=V.toString();s?.onDeviceCodeReceived?.(u,X),s?.onBrowserOpening?.();try{await Ce(X)}catch(c){process.env.DEBUG&&console.error("[DEBUG] Failed to open browser:",c)}s?.onWaitingForAuthorization?.();let Z=Math.max(ce,5)*1e3,le=Date.now()+ae*1e3;for(;Date.now()<le;){await Ae(Z);try{let c=await i.post("v1/oauth/token",{json:{grant_type:"urn:ietf:params:oauth:grant-type:device_code",device_code:S,client_id:I}}).json();s?.onAuthorized?.();let w={};try{w=Re(c.access_token)}catch{}return{accessToken:c.access_token,refreshToken:c.refresh_token??void 0,email:w.email||"",scopes:c.scope.split(" ").filter(D=>D.length>0)}}catch(c){if(c instanceof Te){let{code:D,error:ge}=te(c.data),j=D||ge;if(!j)continue;switch(j){case"authorization_pending":continue;case"slow_down":Z+=5e3;continue;case"access_denied":throw new Error("Authorization denied by user",{cause:c});case"expired_token":throw new Error("Device code expired. Please try again.",{cause:c});default:throw new Error(`Authorization failed: ${j||"Unknown error"}`,{cause:c})}}let w=c instanceof Error?c:new Error("Unknown error during authorization");throw s?.onError?.(w),w}}throw new Error("Device code expired. Please try again.")}finally{n===void 0?delete process.env.NODE_TLS_REJECT_UNAUTHORIZED:process.env.NODE_TLS_REJECT_UNAUTHORIZED=n}}function Be(s){if(s instanceof xe){let e=s.response.status;return e===400||e===401}return!1}var h=class extends Error{code;constructor(e,t){super(t),this.code=e}};function Ke(s){try{let e=s.split(".");if(e.length<2)return null;let t=e[1].replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4,n=t.padEnd(t.length+r,"="),i=Buffer.from(n,"base64").toString("utf8");return JSON.parse(i)}catch{return null}}function _e(s,e=300){let r=Ke(s)?.exp;if(typeof r!="number")return!1;let n=Math.floor(Date.now()/1e3);return r-n<=e}async function se(s){let e=s.accessToken;if(!_e(e))return e;if(!s.refreshToken)throw await p.clear(),new h("session-expired","Session expired. Please run `entrydesk login` again.");let t=s.refreshToken;try{let n=await new x().refreshOAuthToken({refreshToken:t,clientId:I}),i=await p.getAll();return i?.accessToken&&i.refreshToken&&i.refreshToken!==t?i.accessToken:(await p.saveAll({...i??s,accessToken:n.access_token,refreshToken:n.refresh_token??i?.refreshToken??t}),n.access_token)}catch(r){if(!Be(r))throw new h("refresh-failed","Could not refresh your session (auth server unreachable). Please try again.");let n=await p.getAll();if(n?.accessToken&&n.refreshToken&&n.refreshToken!==t)return n.accessToken;throw await p.clear(),new h("session-expired","Session expired. Please run `entrydesk login` again.")}}async function wt(){let s=_();if(s)return s.accessToken;let e=await p.getAll();if(!e?.accessToken)throw new h("not-logged-in","Not logged in. Run `entrydesk login` first.");return se(e)}async function kt(){let s=_();if(s)return{accessToken:s.accessToken,workspaceId:s.workspaceId};let e=L();if(e)return e;let t=await p.getAll();if(!t?.accessToken)throw new h("not-logged-in","Not logged in. Run `entrydesk login` first.");if(!t.workspaceId)throw new h("no-workspace","No workspace selected. Run `entrydesk workspaces` first.");return{accessToken:await se(t),workspaceId:t.workspaceId}}var f=class extends Error{constructor(t,r=1,n){super(t);this.exitCode=r;this.cause=n;this.name="CLIError"}exitCode;cause};function At(s){let e=!!process.env.DEBUG;if(s instanceof f&&(console.error(`Error: ${s.message}`),s.cause&&(console.error(`Cause: ${s.cause.message}`),e&&s.cause.stack&&console.error(s.cause.stack)),process.exit(s.exitCode)),s instanceof h&&(console.error(s.message),e&&s.stack&&console.error(s.stack),process.exit(1)),s instanceof Me&&(console.error("Request timed out. Please check your connection and try again."),e&&s.stack&&console.error(s.stack),process.exit(1)),s instanceof Ie){let t=s.response.status;console.error(t===401?"Not authorized (401). Your session may have expired \u2014 run `entrydesk login`.":t===403?"Forbidden (403). Your account or token lacks permission for this action. If your token predates a recently added feature, run `entrydesk login` to refresh its scopes; otherwise you may lack permission in this workspace.":`Request failed (${t}): ${s.response.statusText}`),e&&s.stack&&console.error(s.stack),process.exit(1)}s instanceof Error&&(console.error(`Unexpected error: ${s.message}`),e&&s.stack&&console.error(s.stack),process.exit(1)),console.error("An unknown error occurred"),process.exit(1)}var P="default",De=/^[A-Za-z0-9_-]+$/,G=null;function H(){return T.join(Ue.homedir(),".entrydesk")}function ie(){return T.join(H(),"profiles")}function oe(){return T.join(H(),"profiles.json")}function M(s){return T.join(ie(),s)}function Y(s){if(!y.existsSync(s))y.mkdirSync(s,{mode:448,recursive:!0});else try{y.chmodSync(s,448)}catch{}}function je(){Y(H())}function W(){Y(ie())}function ze(){let s=oe();try{if(!y.existsSync(s))return null;let e=y.readFileSync(s,"utf-8");return JSON.parse(e)}catch{return null}}function $(s){je();let e=oe();y.writeFileSync(e,JSON.stringify(s,null,2),{mode:384});try{y.chmodSync(e,384)}catch{}}function Fe(s){let e=s.profiles?.length?Array.from(new Set(s.profiles)):[],t=s.currentProfile&&e.includes(s.currentProfile)?s.currentProfile:e[0]||P;return e.length===0&&e.push(P),e.includes(t)||e.unshift(t),{currentProfile:t,profiles:e}}function C(s){W(),Y(M(s))}function v(){let s=ze();if(!s){let t={currentProfile:P,profiles:[P]};return $(t),W(),C(P),t}let e=Fe(s);return(e.currentProfile!==s.currentProfile||e.profiles.length!==s.profiles.length)&&$(e),W(),e}function A(s){if(!s)throw new f("Profile name is required.");if(!De.test(s))throw new f("Invalid profile name. Use letters, numbers, dash, or underscore.")}function b(s,e){if(!s.profiles.includes(e))throw new f(`Profile not found: ${e}`)}function ne(s,e){if(s.profiles.includes(e))throw new f(`Profile already exists: ${e}`)}var a={DEFAULT_PROFILE:P,setOverrideProfile(s){G=s},getOverrideProfile(){return G},getProfileDir(s){return M(s)},getProfileConfigFile(s){return T.join(a.getProfileDir(s),"config.json")},getProfileCredentialsFile(s){return T.join(a.getProfileDir(s),"credentials.json")},getProfileNames(){return[...v().profiles]},getProfileCount(){return a.getProfileNames().length},getCurrentProfileName(){return v().currentProfile},getEffectiveProfileName(s){let e=v(),t=s||G||e.currentProfile;return A(t),b(e,t),t},ensureProfileExists(s){let e=v();A(s),b(e,s)},createProfile(s){A(s);let e=v();ne(e,s);let t={currentProfile:e.currentProfile,profiles:[...e.profiles,s]};$(t),C(s)},deleteProfile(s){A(s);let e=v();if(b(e,s),e.profiles.length===1)throw new f("Cannot delete the last profile.");let t=e.profiles.filter(i=>i!==s),r=e.currentProfile;r===s&&(r=t.includes(P)?P:t[0]),$({currentProfile:r,profiles:t});try{y.rmSync(a.getProfileDir(s),{recursive:!0,force:!0})}catch{}return{currentProfile:r}},renameProfile(s,e){A(s),A(e);let t=v();b(t,s),ne(t,e);let r=M(s),n=M(e);if(y.existsSync(r))try{y.renameSync(r,n)}catch(u){throw new f("Failed to rename profile directory.",1,u)}else C(e);let i=t.profiles.map(u=>u===s?e:u),o=t.currentProfile===s?e:t.currentProfile;return $({currentProfile:o,profiles:i}),{currentProfile:o}},setCurrentProfile(s){A(s);let e=v();b(e,s);let t={currentProfile:s,profiles:e.profiles};$(t),C(s)},ensureProfileDir:C};function Ne(s){let e=a.getEffectiveProfileName(s);return a.getProfileConfigFile(e)}function g(s){let e=Ne(s);try{if(!U.existsSync(e))return{};let t=U.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return{}}}function m(s,e){let t=a.getEffectiveProfileName(e);a.ensureProfileDir(t);let r=a.getProfileConfigFile(t);U.writeFileSync(r,JSON.stringify(s,null,2),{mode:384});try{U.chmodSync(r,384)}catch{}}var J={getApiUrl(s){return g(s).apiUrl??null},setApiUrl(s,e){let t=g(e);t.apiUrl=s,m(t,e)},clearApiUrl(s){let e=g(s);delete e.apiUrl,m(e,s)},getHubUrl(s){return g(s).hubUrl??null},setHubUrl(s,e){let t=g(e);t.hubUrl=s,m(t,e)},getAll(s){return g(s)},setAll(s,e){m(s,e)},set(s,e,t){let r=g(t);r[s]=e,m(r,t)},get(s,e){return g(e)[s]},unset(s,e){let t=g(e);delete t[s],m(t,e)},getDefaultModel(s){return g(s).model?.default??null},setDefaultModel(s,e){let t=g(e);t.model={...t.model,default:s},m(t,e)},getDefaultConnectorIds(s){return g(s).connectors?.defaults??null},setDefaultConnectorIds(s,e){let t=g(e);t.connectors={...t.connectors,defaults:s},m(t,e)},getLocalTools(s){return g(s).localTools??null},setLocalTools(s,e){let t=g(e);t.localTools={...t.localTools,...s},m(t,e)}};var Oe="https://api.entrydesk.com",Le="https://app.entrydesk.com",Ge=3100,We=300*1e3;function q(s){return{apiUrl:J.getApiUrl(s)||process.env.ENTRYDESK_API_URL||Oe,hubUrl:J.getHubUrl(s)||process.env.ENTRYDESK_HUB_URL||Le,mcp:{httpPort:Ge},auth:{loginTimeout:We,ignoreSslErrors:process.env.ENTRYDESK_IGNORE_SSL_ERRORS==="true"||!1}}}function B(s){return q(s).apiUrl}function re(s){return q(s).hubUrl}function K(){return q().auth}export{a,J as b,q as c,B as d,re as e,K as f,p as g,x as h,rt as i,te as j,I as k,ut as l,h as m,_e as n,se as o,wt as p,kt as q,f as r,At as s};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as c,q as s,s as i}from"./chunk-GQWF4JEC.js";import"./chunk-KURQCTT3.js";async function p(l){try{let n,t;try{let o=await s();n=o.accessToken,t=o.workspaceId}catch(o){let r=o instanceof Error?o.message:"Authentication failed";console.error(r),process.exit(1)}let a=new c,{connectors:e}=await a.getConnectors(n,t);if(l.json){console.log(JSON.stringify(e));return}if(e.length===0){console.log("No connectors found in this workspace.");return}console.log(`Connected Connectors (${e.length}):
|
|
3
|
-
`);for(let o of e){let r=o.connected?"connected":"disconnected";console.log(` ${o.name} (${r})`),console.log(` Provider: ${o.provider}`),console.log(` ID: ${o.id}`),console.log("")}}catch(n){i(n)}}export{p as runConnectors};
|
package/dist/help-CJZSDNUL.js
DELETED
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import"./chunk-KURQCTT3.js";function e(){console.log(`
|
|
3
|
-
EntryDesk CLI - Interact with EntryDesk from your terminal
|
|
4
|
-
|
|
5
|
-
Usage: entrydesk <command> [options]
|
|
6
|
-
|
|
7
|
-
Commands:
|
|
8
|
-
login Authenticate with EntryDesk
|
|
9
|
-
logout Sign out and clear credentials
|
|
10
|
-
status Show current authentication status
|
|
11
|
-
workspaces List or switch workspaces
|
|
12
|
-
models List available models
|
|
13
|
-
agents List available agents
|
|
14
|
-
meeting List, view, or manage meetings and recordings
|
|
15
|
-
workflow List, create, run, or manage workflows
|
|
16
|
-
notifications List, count, or mark notifications read
|
|
17
|
-
skills List or upload skills
|
|
18
|
-
schedules List or manage scheduled tasks
|
|
19
|
-
connectors List connected connectors
|
|
20
|
-
tool List, get, or call MCP tools
|
|
21
|
-
profile Manage profiles
|
|
22
|
-
tasks List recent tasks or view messages
|
|
23
|
-
task Send a message or start interactive task
|
|
24
|
-
budget View or manage workspace budget
|
|
25
|
-
usage View current month usage statistics
|
|
26
|
-
mcp-server Start MCP server (stdio or HTTP)
|
|
27
|
-
config Manage CLI configuration
|
|
28
|
-
help Show this help message
|
|
29
|
-
version Show version number
|
|
30
|
-
|
|
31
|
-
Global Options:
|
|
32
|
-
--json Output in JSON format (for scripting)
|
|
33
|
-
-i Interactive mode (for task)
|
|
34
|
-
--profile Use a specific profile for this command
|
|
35
|
-
|
|
36
|
-
Login:
|
|
37
|
-
entrydesk login # Open browser login (OAuth Device Flow)
|
|
38
|
-
|
|
39
|
-
Task:
|
|
40
|
-
entrydesk task -m "Hello" --model <model> # Send with model
|
|
41
|
-
entrydesk task -m "Hello" -a <agent> # Send with agent
|
|
42
|
-
entrydesk task -c 1 -m "Follow up" # Continue recent task
|
|
43
|
-
entrydesk task -i # Interactive mode
|
|
44
|
-
echo "Hello" | entrydesk task --model <m> # Pipe input from stdin
|
|
45
|
-
entrydesk task -m "Hi" --model <m> --plain # Plain text output
|
|
46
|
-
entrydesk task -m "Hi" --model <m> --output stream-json # Stream JSON
|
|
47
|
-
entrydesk task -i --no-file-system # Disable local file operations
|
|
48
|
-
entrydesk task -i --connectors id1,id2 # Use specific connectors
|
|
49
|
-
|
|
50
|
-
MCP Server:
|
|
51
|
-
entrydesk mcp-server # Start stdio server
|
|
52
|
-
entrydesk mcp-server --http --port 3100 # Start HTTP server
|
|
53
|
-
|
|
54
|
-
Tool Operations:
|
|
55
|
-
entrydesk tool list # List all available tools
|
|
56
|
-
entrydesk tool list --prefix sandbox # Filter by prefix
|
|
57
|
-
entrydesk tool get <name> # Get tool details
|
|
58
|
-
entrydesk tool call <name> --input {} # Execute a tool
|
|
59
|
-
|
|
60
|
-
Workspaces:
|
|
61
|
-
entrydesk workspaces # List all workspaces
|
|
62
|
-
entrydesk workspaces switch <id> # Switch to a workspace
|
|
63
|
-
entrydesk workspaces use <id> # Alias for switch
|
|
64
|
-
|
|
65
|
-
Budget:
|
|
66
|
-
entrydesk budget # Show current budget
|
|
67
|
-
entrydesk budget get # Show current budget
|
|
68
|
-
entrydesk budget set 100.00 # Set budget to $100.00
|
|
69
|
-
entrydesk budget clear # Remove budget
|
|
70
|
-
|
|
71
|
-
Usage:
|
|
72
|
-
entrydesk usage # Show current month usage (top users by cost)
|
|
73
|
-
entrydesk usage --limit 20 # Show top 20 users
|
|
74
|
-
entrydesk usage --sort-by operations # Sort by operations instead of cost
|
|
75
|
-
entrydesk usage --limit 10 --sort-by cost # Top 10 by cost
|
|
76
|
-
entrydesk usage --json # Get usage as JSON
|
|
77
|
-
|
|
78
|
-
Tasks:
|
|
79
|
-
entrydesk tasks # List recent tasks
|
|
80
|
-
entrydesk tasks --search "bug fix" # Search tasks (title + content)
|
|
81
|
-
entrydesk tasks -q "\u5831\u8868" --limit 10 # Search, short flag + page size
|
|
82
|
-
entrydesk tasks 1 # View task #1 messages
|
|
83
|
-
entrydesk tasks <uuid> # View task by ID
|
|
84
|
-
entrydesk tasks --share <shareId> # View shared task by share ID
|
|
85
|
-
entrydesk tasks -s <shareId> # Short form for --share
|
|
86
|
-
entrydesk tasks --share <id> --json # Get shared task as JSON
|
|
87
|
-
|
|
88
|
-
Examples:
|
|
89
|
-
$ entrydesk login
|
|
90
|
-
$ entrydesk status
|
|
91
|
-
$ entrydesk workspaces # List workspaces
|
|
92
|
-
$ entrydesk workspaces switch <workspaceId> # Switch workspace
|
|
93
|
-
$ entrydesk budget # View budget
|
|
94
|
-
$ entrydesk budget set 100.00 # Set budget
|
|
95
|
-
$ entrydesk budget clear # Clear budget
|
|
96
|
-
$ entrydesk usage # View usage (all users, sorted by cost)
|
|
97
|
-
$ entrydesk usage --limit 10 # Show top 10 users
|
|
98
|
-
$ entrydesk usage --sort-by operations # Sort by operation count
|
|
99
|
-
$ entrydesk models --json
|
|
100
|
-
$ entrydesk agents --json
|
|
101
|
-
$ entrydesk agents create --name "My Agent" --description "..." --system-prompt "..." --model-id <modelId>
|
|
102
|
-
$ entrydesk agents update <agentId> --name "New Name" --description "..." --system-prompt "..." --model-id <modelId>
|
|
103
|
-
$ entrydesk agents delete <agentId>
|
|
104
|
-
$ entrydesk skills
|
|
105
|
-
$ entrydesk skills upload ./my-skill.zip
|
|
106
|
-
$ entrydesk skills upload ./my-skill-folder
|
|
107
|
-
$ entrydesk task -m "Hello" --model gemini-2.5-flash-lite
|
|
108
|
-
$ entrydesk tasks # List recent tasks
|
|
109
|
-
$ entrydesk tasks 1 # View task #1 messages
|
|
110
|
-
$ entrydesk task -c 1 -m "Tell me more" # Continue task #1
|
|
111
|
-
$ entrydesk tasks 0 --output stream-json # Stream recent task as JSON
|
|
112
|
-
$ entrydesk tasks --share <shareId> # View shared task
|
|
113
|
-
|
|
114
|
-
Piping:
|
|
115
|
-
$ echo "Explain this code" | entrydesk task --model gemini-2.5-flash-lite
|
|
116
|
-
$ cat file.txt | entrydesk task -c 1 # Pipe file content
|
|
117
|
-
$ entrydesk task -m "Hi" --model <m> > out.txt # Save to file
|
|
118
|
-
|
|
119
|
-
Usage Examples:
|
|
120
|
-
$ entrydesk usage # Show all users, sorted by cost
|
|
121
|
-
$ entrydesk usage --limit 10 # Show top 10 users
|
|
122
|
-
$ entrydesk usage --sort-by operations # Sort by operation count
|
|
123
|
-
|
|
124
|
-
Configuration:
|
|
125
|
-
entrydesk config # Show current config
|
|
126
|
-
entrydesk config set <key> <value> # Set a config value
|
|
127
|
-
entrydesk config unset <key> # Remove a config value
|
|
128
|
-
|
|
129
|
-
Profiles:
|
|
130
|
-
entrydesk profile # List profiles
|
|
131
|
-
entrydesk profile create <name> # Create a profile
|
|
132
|
-
entrydesk profile use <name> # Switch active profile
|
|
133
|
-
entrydesk profile delete <name> # Delete a profile
|
|
134
|
-
entrydesk profile rename <from> <to> # Rename a profile
|
|
135
|
-
entrydesk profile clone <from> <to> # Clone config defaults (no credentials)
|
|
136
|
-
|
|
137
|
-
Skills:
|
|
138
|
-
entrydesk skills # List skills
|
|
139
|
-
entrydesk skills list --me # List my skills
|
|
140
|
-
entrydesk skills toggle <id> --disable # Turn a skill off for yourself
|
|
141
|
-
entrydesk skills versions <id> # Version history
|
|
142
|
-
entrydesk skills share <id> --add-user <userId> --role editor
|
|
143
|
-
entrydesk skills upload <file.zip> # Upload a skill zip
|
|
144
|
-
entrydesk skills upload <folder> # Upload a skill folder
|
|
145
|
-
entrydesk skills upload <file.zip> --force
|
|
146
|
-
entrydesk skills delete <skillId>
|
|
147
|
-
|
|
148
|
-
Agents:
|
|
149
|
-
entrydesk agents # List agents
|
|
150
|
-
entrydesk agents --mine # List your own agents (with publish state)
|
|
151
|
-
entrydesk agents show <agentId> # Show one agent's full details
|
|
152
|
-
entrydesk agents create --name "My Agent" --description "..." --system-prompt "..." --model-id <modelId>
|
|
153
|
-
entrydesk agents update <agentId> --name "New Name" --description "..." --system-prompt "..." --model-id <modelId>
|
|
154
|
-
entrydesk agents publish <agentId> # Publish to the workspace
|
|
155
|
-
entrydesk agents share <agentId> --add-user <userId> --role editor
|
|
156
|
-
entrydesk agents delete <agentId>
|
|
157
|
-
|
|
158
|
-
Meetings:
|
|
159
|
-
entrydesk meeting # List meetings
|
|
160
|
-
entrydesk meeting list --filter mine # Only my meetings
|
|
161
|
-
entrydesk meeting list --search "sprint" # Search meetings
|
|
162
|
-
entrydesk meeting get <meetingId> # Meeting details + recordings
|
|
163
|
-
entrydesk meeting create --title "Sprint Planning" --start 2026-06-20T09:00:00Z
|
|
164
|
-
entrydesk meeting update <meetingId> --status completed
|
|
165
|
-
entrydesk meeting delete <meetingId>
|
|
166
|
-
entrydesk meeting summary <meetingId> # Print summary to stdout
|
|
167
|
-
entrydesk meeting transcript <recordingId> # Print transcript (--raw for timestamps)
|
|
168
|
-
entrydesk meeting previous <meetingId> # Previous meeting brief
|
|
169
|
-
entrydesk meeting share <meetingId> # Show sharing (visibility + grants)
|
|
170
|
-
entrydesk meeting share <meetingId> --visibility workspace
|
|
171
|
-
entrydesk meeting share <meetingId> --add-user <userId> --role editor
|
|
172
|
-
entrydesk meeting transcript <recordingId> | entrydesk task -m "List action items"
|
|
173
|
-
|
|
174
|
-
Workflows:
|
|
175
|
-
entrydesk workflow # List workflows
|
|
176
|
-
entrydesk workflow list --search report
|
|
177
|
-
entrydesk workflow get <workflowId> # Details (--show-source for script)
|
|
178
|
-
entrydesk workflow create --name "Nightly" --file ./flow.js
|
|
179
|
-
entrydesk workflow update <workflowId> --deactivate
|
|
180
|
-
entrydesk workflow run <workflowId> --args '{"date":"2026-06-20"}' --wait
|
|
181
|
-
entrydesk workflow runs <workflowId> # List runs
|
|
182
|
-
entrydesk workflow run-get <workflowId> <runId>
|
|
183
|
-
entrydesk workflow share <workflowId> --add-user <userId> --role editor
|
|
184
|
-
|
|
185
|
-
Notifications:
|
|
186
|
-
entrydesk notifications # List notifications
|
|
187
|
-
entrydesk notifications --tab action # Only actionable ones
|
|
188
|
-
entrydesk notifications unread # Unread count
|
|
189
|
-
entrydesk notifications read <id> # Mark one read
|
|
190
|
-
entrydesk notifications read-all # Mark all read
|
|
191
|
-
|
|
192
|
-
Schedules:
|
|
193
|
-
entrydesk schedules # List schedules
|
|
194
|
-
entrydesk schedules get <id> # Show schedule details
|
|
195
|
-
entrydesk schedules edit <id> --prompt "New prompt" # Update fields
|
|
196
|
-
entrydesk schedules pause <id> # Pause / activate <id> to resume
|
|
197
|
-
entrydesk schedules run <id> # Run now (prints taskId)
|
|
198
|
-
entrydesk schedules runs <id> # Run history
|
|
199
|
-
entrydesk schedules create \\
|
|
200
|
-
--name "Daily Report" \\
|
|
201
|
-
--agent-id <agentId> \\
|
|
202
|
-
--prompt "Generate report" \\
|
|
203
|
-
--starts-at "2025-01-01T09:00:00Z" \\
|
|
204
|
-
--repeat-type days --every 1 --time 09:00 \\
|
|
205
|
-
--utc-offset "+08:00"
|
|
206
|
-
entrydesk schedules delete <id> # Delete a schedule
|
|
207
|
-
|
|
208
|
-
Available keys: apiUrl, hubUrl
|
|
209
|
-
|
|
210
|
-
Local Development:
|
|
211
|
-
$ entrydesk config set apiUrl http://localhost:3200
|
|
212
|
-
$ entrydesk config set hubUrl http://localhost:3000
|
|
213
|
-
|
|
214
|
-
For more information, visit https://entrydesk.com/docs/cli
|
|
215
|
-
`)}export{e as printHelp};
|
package/dist/skills-QIEVXMWP.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as D,j as I,q as U,s as z}from"./chunk-GQWF4JEC.js";import"./chunk-KURQCTT3.js";import j from"crypto";import v from"fs";import c from"fs/promises";import x from"os";import s from"path";import{Readable as N}from"stream";import{pipeline as E}from"stream/promises";import O from"adm-zip";import A from"archiver";import{isHTTPError as R}from"ky";function w(){console.log(`
|
|
3
|
-
Usage: entrydesk skills [list|upload|delete|download|toggle|versions|share] [options]
|
|
4
|
-
|
|
5
|
-
Commands:
|
|
6
|
-
list List available skills (default)
|
|
7
|
-
upload <file.zip> Upload a skill zip file
|
|
8
|
-
upload <folder> Upload a skill folder (auto-zipped)
|
|
9
|
-
delete <skillId> Delete a skill you own
|
|
10
|
-
download <skillId> Download and extract a skill to ./<skill-name>/
|
|
11
|
-
toggle <skillId> Enable/disable a skill for yourself (--enable/--disable)
|
|
12
|
-
versions <skillId> List a skill's version history
|
|
13
|
-
share <skillId> Show or manage sharing (user grants)
|
|
14
|
-
|
|
15
|
-
Options:
|
|
16
|
-
--me Only list skills created by me
|
|
17
|
-
--force Overwrite an existing skill with the same name
|
|
18
|
-
--enable / --disable For toggle: turn the skill on/off for yourself
|
|
19
|
-
--add-user <userId> For share: grant a user access (use with --role)
|
|
20
|
-
--remove-user <userId> For share: revoke a user's access
|
|
21
|
-
--role owner|editor|viewer Role for --add-user (default: viewer)
|
|
22
|
-
--json Output JSON (for list/upload)
|
|
23
|
-
`)}function F(e,r){let i=s.relative(e,r);return i===""||!i.startsWith("..")&&!s.isAbsolute(i)}async function J(e){let r=await c.realpath(e),i=[process.cwd(),x.homedir()];if(!(await Promise.all(i.map(async f=>{try{return await c.realpath(f)}catch{return s.resolve(f)}}))).some(f=>F(f,r)))throw new Error("Invalid upload path: must be within the current directory or your home directory.")}async function T(e){let r=await c.mkdtemp(s.join(x.tmpdir(),"entrydesk-skill-")),i=s.join(r,`${s.basename(e)}.zip`);return await new Promise((p,u)=>{let f=v.createWriteStream(i),k=A("zip",{zlib:{level:9}});f.on("close",()=>p()),f.on("error",u),k.on("error",u),k.pipe(f),k.directory(e,!1),k.finalize()}),{zipPath:i,cleanupDir:r}}function K(e){console.log(`Versions (${e.length}):
|
|
24
|
-
`);for(let r of e){let i=new Date(r.createdAt).toLocaleString();if(console.log(` v${r.versionNumber} \xB7 ${i}`),r.description){let p=r.description.length>100?`${r.description.slice(0,100)}...`:r.description;console.log(` ${p}`)}console.log(` Version ID: ${r.id}`),console.log("")}}function V(e){if(console.log(`User grants (${e.grants.length}):`),e.grants.length===0){console.log(" (none)");return}for(let r of e.grants)console.log(` - ${r.user.name} <${r.user.email}> \xB7 ${r.role}`),console.log(` ID: ${r.userId}`)}async function oe(e){let r,i;try{let o=await U();r=o.accessToken,i=o.workspaceId}catch(o){z(o)}let p=e.action||"list",u=new D;if(p==="upload"){let o=e.configKey;o||(console.error("Missing file path."),w(),process.exit(1));let n=s.resolve(o),t;try{t=await c.stat(n)}catch{console.error(`File not found: ${n}`),process.exit(1)}let a=n,y=null;try{try{await J(n)}catch(d){let l=d instanceof Error?d.message:"Invalid upload path.";console.error(l),process.exit(1)}if(t.isDirectory()){let d=await T(n);a=d.zipPath,y=d.cleanupDir}else t.isFile()||(console.error(`Not a file or directory: ${n}`),process.exit(1));s.extname(a).toLowerCase()!==".zip"&&(console.error("Only .zip files are supported for upload."),process.exit(1));let $=await c.readFile(a),m=new FormData;m.append("file",new Blob([$],{type:"application/zip"}),s.basename(a)),e.force&&m.append("force","true");let g;try{g=await u.uploadSkill(r,i,m)}catch(d){if(R(d)&&d.response.status===409){let{code:l}=I(d.data);l==="skill_name_conflict"?console.error("Upload failed: A skill with this name is owned by another user."):(console.error("Upload failed: A skill with this name already exists."),console.error("Use --force to overwrite the existing skill.")),process.exit(1)}throw d}if(e.json){console.log(JSON.stringify(g));return}console.log(`Uploaded skill: ${g.name}`),console.log(` ID: ${g.id}`),console.log(` Version ID: ${g.versionId}`),console.log(` Description: ${g.description}`);return}finally{y&&await c.rm(y,{recursive:!0,force:!0})}}if(p==="toggle"){let o=e.configKey;o||(console.error("Missing skill ID."),w(),process.exit(1)),e.enable===e.disable&&(console.error("Pass exactly one of --enable or --disable."),process.exit(1));let n=!!e.enable,t=await u.updateSkillPreference(r,i,o,n);if(e.json){console.log(JSON.stringify(t));return}console.log(`${t.isEnabled?"Enabled":"Disabled"} skill for you: ${o}`);return}if(p==="versions"){let o=e.configKey;o||(console.error("Missing skill ID."),w(),process.exit(1));let n=await u.getSkillVersions(r,i,o);if(e.json){console.log(JSON.stringify(n));return}if(n.versions.length===0){console.log("No versions for this skill.");return}K(n.versions);return}if(p==="share"){let o=e.configKey;o||(console.error("Missing skill ID."),w(),process.exit(1));let n=e.role??"viewer";if(e.addUser){let a=await u.upsertSkillGrant(r,i,o,e.addUser,n);if(e.json){console.log(JSON.stringify(a));return}console.log(`Granted ${n} to user ${e.addUser}`);return}if(e.removeUser){if(await u.removeSkillGrant(r,i,o,e.removeUser),e.json){console.log(JSON.stringify({userId:e.removeUser,removed:!0}));return}console.log(`Revoked access for user ${e.removeUser}`);return}let t=await u.getSkillGrants(r,i,o);if(e.json){console.log(JSON.stringify(t));return}V(t);return}if(p==="delete"){let o=e.configKey;o||(console.error("Missing skill ID."),w(),process.exit(1)),await u.deleteSkill(r,i,o),console.log(`Deleted skill: ${o}`);return}if(p==="download"){let o=e.configKey;o||(console.error("Missing skill ID."),w(),process.exit(1));let{url:n,name:t}=await u.downloadSkillCurrent(r,i,o);(t.includes("/")||t.includes(s.sep)||t==="."||t===".."||!t)&&(console.error(`Invalid skill name for output directory: ${t}`),process.exit(1));let a=s.resolve(t),y=await c.mkdtemp(s.join(x.tmpdir(),"entrydesk-skill-download-")),$=s.join(y,`${t}.zip`);try{let m=await fetch(n);if(!m.ok)throw new Error(`Failed to download skill zip: ${m.status} ${m.statusText}`);if(!m.body)throw new Error("Response body is empty");let g=v.createWriteStream($);await E(N.fromWeb(m.body),g);let d=await c.mkdtemp(s.join(s.dirname(a),".entrydesk-skill-extract-")),l=null;try{e.json||console.log("Extracting...");let b=new O($),P=s.resolve(d)+s.sep;for(let h of b.getEntries()){if(h.isDirectory)continue;let S=s.resolve(d,h.entryName);if(!S.startsWith(P))throw new Error(`Zip entry contains path traversal: ${h.entryName}`);await c.mkdir(s.dirname(S),{recursive:!0}),await c.writeFile(S,h.getData())}v.existsSync(a)&&(l=s.join(s.dirname(a),`.entrydesk-backup-${j.randomUUID()}`),e.json||console.log(`Replacing existing directory: ${a}`),await c.rename(a,l));try{await c.rename(d,a),l&&v.existsSync(l)&&(await c.rm(l,{recursive:!0,force:!0}),l=null)}catch(h){throw l&&v.existsSync(l)&&(await c.rename(l,a),l=null),h}}catch(b){if(await c.rm(d,{recursive:!0,force:!0}),l&&v.existsSync(l))try{await c.rename(l,a)}catch{console.error(`Warning: Could not restore backup. Your original files are at: ${l}`)}throw b}if(e.json){console.log(JSON.stringify({skillId:o,skillName:t,outputDir:a}));return}console.log(`Downloaded skill "${t}" to ${a}`)}finally{await c.rm(y,{recursive:!0,force:!0})}return}p!=="list"&&(console.error(`Unknown skills command: ${p}`),w(),process.exit(1));let f=[],k;do{let o=await u.listAvailableSkills(r,i,{createdBy:e.createdBy,nextKey:k,limit:100});f.push(...o.skills),k=o.nextKey}while(k);if(e.json){console.log(JSON.stringify(f));return}if(f.length===0){console.log("No skills found in this workspace.");return}console.log(`Available Skills (${f.length}):
|
|
25
|
-
`);for(let o of f)console.log(` ${o.name} (${o.provider})`),console.log(` ${o.description.slice(0,120)}`),console.log(` ID: ${o.id}`),console.log(` Author: ${o.author.name}`),console.log("")}export{oe as runSkills};
|
package/dist/tasks-LJHCATKL.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as A,p as I,q as b,s as O}from"./chunk-GQWF4JEC.js";import"./chunk-KURQCTT3.js";var h="\x1B[2m",a="\x1B[0m",p="\x1B[36m",w="\x1B[33m",R="\x1B[32m",v="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 D="\x1B[1m";function j(t){return t.replace(/<mark>/g,D).replace(/<\/mark>/g,a).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function T(t,n){if(n)return t;let r=t.split(`
|
|
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 E(t){if(!t||typeof t!="object")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function J(t,n){if(!t)return"(no result)";if(typeof t!="object")return T(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(`${w}[stderr]${a} ${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)),T(o.join(`
|
|
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 T(o||JSON.stringify(t,null,2),n)}return T(JSON.stringify(t,null,2),n)}function M(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}${a}`);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}${a}`),e.args){o.push(`${w}\u2502 Arguments:${a}`);let i=E(e.args);for(let s of i.split(`
|
|
8
|
-
`))o.push(`${h}\u2502 ${s}${a}`)}if(e.result!==void 0){o.push(`${R}\u2502 Result:${a}`);let i=J(e.result,n);for(let s of i.split(`
|
|
9
|
-
`))o.push(`${h}\u2502 ${s}${a}`);o.push(`${p}\u2514\u2500 ${e.toolName} completed${a}`)}else e.state==="call"?o.push(`${p}\u2514\u2500 (awaiting result)${a}`):o.push(`${p}\u2514\u2500${a}`);r.push(o.join(`
|
|
10
|
-
`))}else if(e.type.startsWith("tool-")&&e.type!=="tool-call"){let o=M(e),i=[];if(i.push(`${p}\u250C\u2500 Tool: ${o}${a}`),e.input){i.push(`${w}\u2502 Input:${a}`);let s=E(e.input);for(let c of s.split(`
|
|
11
|
-
`))i.push(`${h}\u2502 ${c}${a}`)}if(e.output!==void 0&&e.state==="output-available"){i.push(`${R}\u2502 Output:${a}`);let s=J(e.output,n);for(let c of s.split(`
|
|
12
|
-
`))i.push(`${h}\u2502 ${c}${a}`);i.push(`${p}\u2514\u2500 completed${a}`)}else e.state==="call"||e.state==="partial-call"?i.push(`${p}\u2514\u2500 (in progress)${a}`):i.push(`${p}\u2514\u2500${a}`);r.push(i.join(`
|
|
13
|
-
`))}return r.join(`
|
|
14
|
-
|
|
15
|
-
`).trim()}async function Y(t){let n=t.output===v;t.output&&!n&&(console.error(`Invalid --output value. Supported: ${v}`),process.exit(1));let r=new A;if(t.shareId){let s;try{s=await I()}catch{}try{let c=await r.getSharedTask(t.shareId,s),{messages:l}=await r.getSharedMessages(t.shareId,50,s);if(t.json){console.log(JSON.stringify({task:c,messages:l}));return}if(n){if(f("task",c),l.length===0)f("info","No messages in this shared task.");else for(let u of l.toReversed())f("message",u);f("done");return}if(console.log(`Shared Task: ${c.title||"Untitled"}`),console.log(`Visibility: ${c.visibility}`),c.agent&&console.log(`Agent: ${c.agent.name}`),console.log(`${l.length} messages
|
|
16
|
-
`),l.length===0){console.log("No messages in this shared task.");return}let d=l.toReversed(),k=t.fullOutput??!1;for(let u of d){let y=L(u.parts,k);if(!y)continue;let x=u.role==="user"?"You":"Assistant";console.log(`[${x}] ${S(u.createdAt)}`),console.log(y),console.log("")}return}catch(c){if(c instanceof Error){let l=c.message.toLowerCase();l.includes("401")||l.includes("unauthorized")?console.error("Access denied. This shared task requires authentication or is not accessible to you."):l.includes("404")||l.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: ${c.message}`)}else console.error("Failed to fetch shared task");process.exit(1)}}let e,o;try{let s=await b();e=s.accessToken,o=s.workspaceId}catch(s){O(s)}if(t.taskId){let s=t.taskId,c=!1,l=null,d=parseInt(t.taskId,10);if(!isNaN(d)&&d>=0&&/^\d+$/.test(t.taskId)){let g=d===0?1:d,{tasks:$}=await r.getTasks(e,o,20);g>$.length&&(console.error(`Task number ${g} not found. You have ${$.length} recent tasks.`),process.exit(1));let m=$[g-1];s=m.id,c=!0,l=m,n||console.log(`Task: ${m.title||"Untitled"}
|
|
17
|
-
`)}let{messages:u}=await r.getMessages(e,o,s,50);if(t.json){console.log(JSON.stringify(u));return}if(n){if(l&&f("task",l),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;c||console.log(`Task: ${t.taskId.slice(0,8)}...`),console.log(`${u.length} messages
|
|
18
|
-
`);for(let g of y){let $=L(g.parts,x);if(!$)continue;let m=g.role==="user"?"You":"Assistant";console.log(`[${m}] ${S(g.createdAt)}`),console.log($),console.log("")}return}if(t.search){let{results:s,nextKey:c}=await r.searchTasks(e,o,t.search,{limit:t.limit,nextKey:t.nextKey});if(n){for(let l of s)f("task",l);f("done");return}if(t.json){console.log(JSON.stringify({results:s,nextKey:c}));return}if(s.length===0){console.log(`No tasks match "${t.search}".`);return}console.log(`Search results for "${t.search}" (${s.length}):
|
|
19
|
-
`),s.forEach((l,d)=>{let k=(d+1).toString().padStart(2," "),u=l.titleHighlight?j(l.titleHighlight):l.title||"Untitled";console.log(` ${k}. ${h}${S(l.createdAt)}${a} ${u}`),l.contentSnippet&&console.log(` ${j(l.contentSnippet)}`),console.log(` ${h}ID: ${l.id}${a}`)}),c&&console.log(`
|
|
20
|
-
Next page: --next-key ${c}`);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}):
|
|
21
|
-
`),i.forEach((s,c)=>{let l=(c+1).toString().padStart(2," ");console.log(` ${l}. ${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{j as renderHighlight,Y as runTasks};
|
package/dist/usage-R366J6YU.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{h as d,q as f}from"./chunk-GQWF4JEC.js";import"./chunk-KURQCTT3.js";function U(){console.log(`
|
|
3
|
-
Usage: entrydesk usage [options]
|
|
4
|
-
|
|
5
|
-
Options:
|
|
6
|
-
--limit <number> Limit number of users shown (default: all)
|
|
7
|
-
--sort-by cost|operations Sort by cost or operations (default: cost)
|
|
8
|
-
--json Output JSON
|
|
9
|
-
|
|
10
|
-
Examples:
|
|
11
|
-
entrydesk usage # Show all users, sorted by cost
|
|
12
|
-
entrydesk usage --limit 10 # Show top 10 users
|
|
13
|
-
entrydesk usage --sort-by operations # Sort by operation count
|
|
14
|
-
entrydesk usage --json # JSON output
|
|
15
|
-
`)}async function k(e){if(e.help){U();return}let l,a;try{let o=await f();l=o.accessToken,a=o.workspaceId}catch(o){let s=o instanceof Error?o.message:"Authentication failed";console.error(s),process.exit(1)}let h=new d,t=[],r,i=0,m=100;do{let o=await h.getMonthlyUsages(l,a,{nextKey:r,limit:100});if(t.push(...o.monthlyUsages),r=o.nextKey,i++,i>=m){console.error(`Warning: Showing first ${t.length} entries (pagination limit reached)`);break}}while(r);if(e.json){console.log(JSON.stringify(t));return}if(t.length===0){console.log("No usage data found for this workspace.");return}console.log(`Current Month Usage:
|
|
16
|
-
`);let c=0,g=0;for(let o of t)c+=parseFloat(o.totalCost),g+=o.operationCount;console.log(`Total Cost: $${c.toFixed(2)}`),console.log(`Total Operations: ${g.toLocaleString()}`),console.log(`Users: ${t.length}
|
|
17
|
-
`);let u=e.sortBy||"cost",p=[...t].toSorted((o,s)=>u==="cost"?parseFloat(s.totalCost)-parseFloat(o.totalCost):s.operationCount-o.operationCount),y=e.limit&&e.limit>0?e.limit:p.length,n=p.slice(0,y);console.log(`Usage by User (sorted by ${u}, showing ${n.length} of ${t.length}):
|
|
18
|
-
`);for(let o of n){let s=parseFloat(o.totalCost);console.log(` ${o.user.name} (${o.user.email})`),console.log(` Cost: $${s.toFixed(2)}`),console.log(` Operations: ${o.operationCount.toLocaleString()}`),console.log("")}n.length<t.length&&console.log(`... and ${t.length-n.length} more users`)}export{k as runUsage};
|