@entrydesk/cli 2.2.0-beta.2 → 2.2.0-beta.3
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/README.md +72 -3
- package/dist/{add-BYupRwo_.js → add-QRCNes33.js} +1 -1
- package/dist/{agents-CeXkI4US.js → agents-C6_4nYx3.js} +1 -1
- package/dist/{billing-BeaQvLSK.js → billing-B52QpxBo.js} +1 -1
- package/dist/{budget-B4SKcu-1.js → budget-CCZUSzQX.js} +1 -1
- package/dist/build-task-request-config-D1BoTQ_r.js +10 -0
- package/dist/{commands-Bisc9IY0.js → commands-DT40svYr.js} +1 -1
- package/dist/{commands-Drf0_Uu8.js → commands-OQF1wQ6Z.js} +1 -1
- package/dist/{config-ROg2C1qz.js → config-DRasb4uc.js} +2 -2
- package/dist/connectors-CGdm_hGV.js +11 -0
- package/dist/{file-upload-ClVCUJp1.js → file-upload-DuXlHqyj.js} +1 -1
- package/dist/{format-B6a10P86.js → format-C0MI0rzh.js} +1 -1
- package/dist/index.js +43 -23
- package/dist/{instruction-D0Sy5WJu.js → instruction-OdStaJMu.js} +1 -1
- package/dist/{login-7nuzjqqL.js → login-BJK-C-yF.js} +1 -1
- package/dist/{logout-O7uVmxmK.js → logout-b335WkA6.js} +1 -1
- package/dist/{marketplace-8V1DNOld.js → marketplace-B5HXnl23.js} +2 -2
- package/dist/{mcp-client-DpDabxv9.js → mcp-client-mMhJPPZN.js} +1 -1
- package/dist/{mcp-DwMCTWU-.js → mcp-hLbWIery.js} +1 -1
- package/dist/{meeting-DCMyPA59.js → meeting-2Z2c7Ppj.js} +1 -1
- package/dist/{message-utils-C6JS91tT.js → message-utils-BHtHL44l.js} +7 -7
- package/dist/{models-BdxCIBZD.js → models-Cd725_l2.js} +1 -1
- package/dist/{notifications-BZxmGqEM.js → notifications-D1-iA_h8.js} +1 -1
- package/dist/{paginate-B-nHzQ0j.js → paginate-y3CJuqRW.js} +1 -1
- package/dist/{paths-ZPsPG0IC.js → paths-CIj_zxDF.js} +1 -1
- package/dist/profile-B1Jui2gr.js +10 -0
- package/dist/profile-storage-BPBUFvA6.js +74 -0
- package/dist/{project-Ba5LBPMF.js → project-DwR8Pf3y.js} +1 -1
- package/dist/project-context-CiI3hHaT.js +10 -0
- package/dist/{project-governance-B66BEQxO.js → project-governance-OVpv9LXv.js} +1 -1
- package/dist/{project-sources-D4m1oEvu.js → project-sources-CtSvnInR.js} +1 -1
- package/dist/{project-sources-write-CCICd6f8.js → project-sources-write-BaWV2jtH.js} +1 -1
- package/dist/{project-tasks-ylwpld2n.js → project-tasks-BKdZe3qu.js} +1 -1
- package/dist/{push-CNZNGP6D.js → push-CMRb7H6f.js} +1 -1
- package/dist/{recordings-DpDUq0iw.js → recordings-Bz6wVqBM.js} +1 -1
- package/dist/{remove-CbGljmXk.js → remove-B7p4PV6f.js} +1 -1
- package/dist/resolve-DdZsf3QT.js +14 -0
- package/dist/resource-grants-HDU2bPhQ.js +10 -0
- package/dist/{schedules-CTFIi2SL.js → schedules-DrzGEvSR.js} +2 -2
- package/dist/{skills-DbFd9oBS.js → skills-CdcBhRxn.js} +1 -1
- package/dist/{status-Br8KI96N.js → status-p4tJRN-I.js} +1 -1
- package/dist/status-wTfceoHq.js +10 -0
- package/dist/task-CyuwUFin.js +116 -0
- package/dist/tasks-B0x5P4UU.js +22 -0
- package/dist/{tasks-CNUJbs7w.js → tasks-BpqBNtta.js} +1 -1
- package/dist/{team-BfBb-uk2.js → team-R67MPRfp.js} +1 -1
- package/dist/{teams-47YS8wYw.js → teams-DvACXgpt.js} +1 -1
- package/dist/{token-CvjOXFDB.js → token-Diy_e8pF.js} +1 -1
- package/dist/{tool-D_n28XK0.js → tool-CFaX5Q8e.js} +7 -7
- package/dist/{update-B8gxXkSO.js → update-CvHLQuTu.js} +1 -1
- package/dist/{usage-BPyHU-GL.js → usage-Bv04bmPn.js} +1 -1
- package/dist/{usage-audit-STxCfVta.js → usage-audit-D65sU87J.js} +3 -3
- package/dist/{version-Ca4arzgb.js → version-BFfQldMJ.js} +1 -1
- package/dist/{webhook-B0E0M2EK.js → webhook-h1JuRyJf.js} +1 -1
- package/dist/{workflow-B-iN8d5R.js → workflow-CrOwbORs.js} +1 -1
- package/dist/{workspaces-DmqtYNX1.js → workspaces-CJP3Q8wV.js} +1 -1
- package/package.json +4 -4
- package/dist/build-task-request-config-eOeyGAfk.js +0 -10
- package/dist/connectors-jktsuWlk.js +0 -11
- package/dist/profile-D4jP-vQE.js +0 -10
- package/dist/profile-storage--QCh_u_Q.js +0 -73
- package/dist/project-context-8lb14kaU.js +0 -10
- package/dist/resolve-Di6ohyyF.js +0 -14
- package/dist/resource-grants-DojPWFs8.js +0 -10
- package/dist/status-DLI2OgMv.js +0 -10
- package/dist/task-CRwWxEOf.js +0 -116
- package/dist/tasks-VEfTbXVT.js +0 -22
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __entrydeskNodeFloor = 24;
|
|
3
|
+
if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
4
|
+
process.stderr.write(
|
|
5
|
+
'entrydesk: Node.js ' + __entrydeskNodeFloor + ' or newer is required, but this is Node ' + process.versions.node + '.\n' +
|
|
6
|
+
'Upgrade Node (https://nodejs.org/en/download), then reinstall @entrydesk/cli.\n'
|
|
7
|
+
);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
import{C as e,d as t,jn as n,k as r,p as i,s as a}from"./profile-storage-BPBUFvA6.js";import{n as o,r as s,t as c}from"./terminal-text-cBPBiP3x.js";import{d as l,i as u,o as d,p as f,t as p}from"./resolve-DdZsf3QT.js";import{a as m,i as h,n as g,r as _,s as v}from"./message-utils-BHtHL44l.js";const y=`\x1B[2m`,b=`\x1B[0m`,x=`\x1B[36m`,S=`\x1B[33m`,C=`\x1B[32m`;function w(e){return`Next page: --next-key ${r(e)}`}function T(e,t){t&&console.log(`Older messages: \`entrydesk tasks ${r(e)} --next-key ${r(t)}\``)}function E(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${c(n)}\n`)}function D(e){E(`done`,e?{nextKey:e}:void 0)}function O(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 k(e){return e.replace(/<mark>/g,`\x1B[1m`).replace(/<\/mark>/g,b).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`)}function A(e,t){if(t)return e;let n=e.split(`
|
|
11
|
+
`);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(`
|
|
12
|
+
`)}function j(e){if(Array.isArray(e))return e.map(j);if(!n(e))return e;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]=j(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 N(e){return s(M(e))}function P(e,t){if(!e)return`(no result)`;if(typeof e!=`object`)return A(s(String(e)),t);let r=t?e:j(e),i=n(r)?r:{},a=i.structuredContent;if(a){let e=n(a)?a:{},r=[];if(e.stdout&&typeof e.stdout==`string`&&e.stdout.trim()&&r.push(s(e.stdout.trim())),e.stderr&&typeof e.stderr==`string`&&e.stderr.trim()&&r.push(`${S}[stderr]${b} ${s(e.stderr.trim())}`),e.urls&&Array.isArray(e.urls)){let t=e.urls;for(let e of t)e.path&&e.url&&r.push(s(`${e.path}: ${e.url}`))}return r.length===0&&r.push(s(JSON.stringify(a,null,2))),A(r.join(`
|
|
13
|
+
`),t)}return`content`in i&&Array.isArray(i.content)?A(s(i.content.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
14
|
+
`)||JSON.stringify(e,null,2)),t):i.type===`text`&&typeof i.content==`string`?A(s(i.content),t):A(s(JSON.stringify(e,null,2)),t)}function F(e){if(typeof e.title==`string`)return e.title;if(typeof e.toolName==`string`)return e.toolName;let t=e.type;return t.startsWith(`tool-`)?t.slice(5).replaceAll(`__`,` `).replace(/_/g,` `):t}function I(e,t){let n=[];for(let r of e)if(r.type===`reasoning`&&r.text)n.push(`${y}${s(r.text)}${b}`);else if(r.type===`text`&&r.text)n.push(s(r.text));else if(r.type===`data-background-run-receipt`){let e=g(r.data);e&&n.push(e)}else if(r.type===`tool-call`&&r.toolName){let e=[`${x}┌─ Tool: ${o(String(r.toolName))}${b}`];if(r.args){e.push(`${S}│ Input:${b}`);let t=N(r.args);for(let n of t.split(`
|
|
15
|
+
`))e.push(`${y}│ ${n}${b}`)}if(r.result!==void 0){e.push(`${C}│ Output:${b}`);let n=P(r.result,t);for(let t of n.split(`
|
|
16
|
+
`))e.push(`${y}│ ${t}${b}`);e.push(`${x}└─ ${r.toolName} completed${b}`)}else r.state===`call`?e.push(`${x}└─ (awaiting result)${b}`):e.push(`${x}└─${b}`);n.push(e.join(`
|
|
17
|
+
`))}else if(r.type.startsWith(`tool-`)&&r.type!==`tool-call`){if(m(r))continue;let e=_(r);if(e){n.push(e);continue}let i=o(F(r)),a=[`${x}┌─ Tool: ${i}${b}`];if(r.input){a.push(`${S}│ Input:${b}`);let e=N(r.input);for(let t of e.split(`
|
|
18
|
+
`))a.push(`${y}│ ${t}${b}`)}let c=v({state:r.state,output:r.output,errorText:r.errorText});if(r.output!==void 0&&r.state===`output-available`){a.push(`${C}│ Output:${b}`);let e=P(r.output,t);for(let t of e.split(`
|
|
19
|
+
`))a.push(`${y}│ ${t}${b}`);let n=h(r.approval);n&&a.push(`${y}│ ${n}${b}`),a.push(`${x}└─ completed${b}`)}else c===void 0?r.state===`call`||r.state===`partial-call`?a.push(`${x}└─ (in progress)${b}`):a.push(`${x}└─${b}`):(c&&a.push(`${y}│ ${s(c)}${b}`),a.push(`${x}└─ failed${b}`));n.push(a.join(`
|
|
20
|
+
`))}return n.join(`
|
|
21
|
+
|
|
22
|
+
`).trim()}function L(){return{empty:'No tasks yet. Start one with `entrydesk task -m "..."`.',heading:e=>`Recent tasks (${e}):`,label:(e,t)=>`${(t+1).toString().padStart(2,` `)}.`,footer:e=>["Use `entrydesk tasks 1` to view the most recent task",'Use `entrydesk task -c 1 -m "message"` to continue it',...e?[w(e)]:[]]}}function R(e){return{empty:`No tasks you can see in this project yet. Start one with \`entrydesk task --project ${e} -m "..."\`.`,heading:e=>`Tasks in this project (${e}):`,label:e=>`${y}${e.id}${b}`,footer:e=>["Use `entrydesk tasks <taskId>` to view one of them",...e?[w(e)]:[]]}}async function z(e,t,n,r){if(!/^\d+$/.test(r))return{taskId:r};let i=Math.max(Number.parseInt(r,10),1),{tasks:a}=await e.getTasks(t,n),o=a[i-1];return o===void 0&&(console.error(`Task number ${i} not found. You have ${a.length} recent tasks.`),process.exit(1)),{taskId:o.id,task:o}}async function B(n,r){let o=r.output!==void 0,s=new e,m=r.limit??50;if(n&&r.project&&await l(r,new d(`project_not_applicable`,"`--project` narrows the listing and the search; drop it to view a task.")),r.share){let e;try{e=await t()}catch{}try{let t=await s.getSharedTask(r.share,e),{messages:n,nextKey:i}=await s.getSharedMessages(r.share,m,e,r.nextKey);if(r.json){console.log(c({task:t,messages:n,nextKey:i}));return}if(o){if(E(`task`,t),n.length===0)E(`info`,`No messages in this shared task.`);else for(let e of n.toReversed())E(`message`,e);D(i);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 a=n.toReversed(),l=r.fullOutput??!1;for(let e of a){let t=I(e.parts,l);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${O(e.createdAt)}`),console.log(t),console.log(``)}T(`--share ${r.share}`,i);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 h=r.project?await u(r.project,r.json??!1):void 0,g=e=>h?f({json:r.json??!1},e,`tasks:read`):e(),_,v;try{let e=await i();_=e.accessToken,v=e.workspaceId}catch(e){a(e)}if(n){let{taskId:e,task:t}=await z(s,_,v,n);t&&!o&&console.log(`Task: ${t.title||`Untitled`}\n`);let{messages:i,nextKey:a}=await s.getMessages(_,v,e,m,r.nextKey);if(r.json){console.log(c({messages:i,nextKey:a}));return}if(o){if(t&&E(`task`,t),i.length===0)E(`info`,`No messages in this task.`);else for(let e of i.toReversed())E(`message`,e);D(a);return}if(i.length===0){console.log(`No messages in this task.`);return}let l=i.toReversed(),u=r.fullOutput??!1;t||console.log(`Task: ${n.slice(0,8)}…`),console.log(`${i.length} messages\n`);for(let e of l){let t=I(e.parts,u);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${O(e.createdAt)}`),console.log(t),console.log(``)}T(e,a);return}let x=r.search;if(x){h&&await g(()=>p({client:s,accessToken:_,workspaceId:v},h));let{results:e,nextKey:t}=await g(()=>s.searchTasks(_,v,x,{limit:r.limit,nextKey:r.nextKey,projectId:h}));if(o){for(let t of e)E(`task`,t);D(t);return}if(r.json){console.log(c({results:e,nextKey:t}));return}if(e.length===0){console.log(`No tasks match "${r.search}".`);return}console.log(`Search results for "${r.search}" (${e.length}):\n`);for(let[t,n]of e.entries()){let e=(t+1).toString().padStart(2,` `),r=n.titleHighlight?k(n.titleHighlight):n.title||`Untitled`;console.log(` ${e}. ${y}${O(n.createdAt)}${b} ${r}`),n.contentSnippet&&console.log(` ${k(n.contentSnippet)}`),console.log(` ${y}ID: ${n.id}${b}`)}t&&console.log(`\n${w(t)}`);return}let C=h&&r.project?R(r.project):L(),{tasks:A,nextKey:j}=await g(()=>s.getTasks(_,v,{limit:r.limit,nextKey:r.nextKey,projectId:h}));if(o){for(let e of A)E(`task`,e);D(j);return}if(r.json){console.log(c({tasks:A,nextKey:j}));return}if(A.length===0){console.log(C.empty);return}console.log(`${C.heading(A.length)}\n`);for(let[e,t]of A.entries()){let n=t.waitingReason===`approval`?` ${S}[waiting approval]${b}`:t.waitingReason===`client`?` ${S}[waiting device]${b}`:t.waitingReason===`background`?` [34m[waiting background]${b}`:``;console.log(` ${C.label(t,e)} ${O(t.createdAt).padEnd(12)} ${t.title||`Untitled`}${n}`)}console.log(``);for(let e of C.footer(j))console.log(e)}const V={stopped:`Stopped`,not_running:`Task is not running`,not_found:`Task not found, or it is not your task`};async function H(t,n){let{accessToken:r,workspaceId:a}=await i(),s=new e,{taskId:l}=await z(s,r,a,t),u=await s.stopTask(r,a,l);if(n.json)console.log(c({taskId:l,status:u}));else{let e=`${V[u]}: ${o(l)}`;u===`not_found`?console.error(e):console.log(e)}u===`not_found`&&(process.exitCode=1)}export{B as n,H as r,k as t};
|
|
@@ -7,5 +7,5 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{
|
|
10
|
+
import{k as e}from"./profile-storage-BPBUFvA6.js";import{o as t}from"./resolve-DdZsf3QT.js";import{validate as n}from"uuid";function r(t){return t.map(t=>` - ${e(t.name)} (${t.teamId})`).join(`
|
|
11
11
|
`)}function i(e){return e.toLocaleLowerCase(`en`)}function a(e,i,a){return new t(`project_team_not_found`,`${n(e)?`No team with id ${e}.`:`No team named "${e}".`} ${i}${a.length>0?`\nA name has to match exactly, including case. Teams with a similar name:\n${r(a)}`:``}`)}function o(e,t){return e.teamId.toLowerCase()===t.toLowerCase()}function s(e,t){return n(t)?e.filter(e=>o(e,t)):e.filter(e=>e.name===t)}function c(e,o,c){let l=s(e,o),[u]=l;if(l.length===1&&u!==void 0)return u;if(l.length>1)throw new t(`team_ambiguous`,`More than one team is named "${o}". Pass one of these ids with --team:\n${r(l)}`);if(n(o))throw a(o,c,[]);let d=i(o);throw a(o,c,e.filter(e=>i(e.name).includes(d)))}export{c as n,s as t};
|
|
@@ -7,4 +7,4 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{C as e,
|
|
10
|
+
import{C as e,k as t,p as n}from"./profile-storage-BPBUFvA6.js";import{t as r}from"./terminal-text-cBPBiP3x.js";async function i(i){let{accessToken:a,workspaceId:o}=await n(),s=new e,c=[],l;do{let e=await s.listTeams(a,o,{nextKey:l,search:i.search});c.push(...e.teams),l=e.nextKey}while(l);if(i.json){console.log(r(c));return}if(c.length===0){console.log(`No teams found.`);return}console.log(`Teams (${c.length}):\n`);for(let e of c){let n=e.currentUserRole?` · you are ${e.currentUserRole}`:``;console.log(` ${t(e.name)} (${e.memberCount} members, ${e.visibility}${n})`),console.log(` ID: ${e.id}`),console.log(``)}}export{i as listTeams};
|
|
@@ -7,4 +7,4 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{f as e,u as t}from"./profile-storage
|
|
10
|
+
import{f as e,u as t}from"./profile-storage-BPBUFvA6.js";async function n(n){let{accessToken:r,workspaceId:i}=await e();if(!n.json){process.stdout.write(`${r}\n`);return}let a=t(r)?.exp;process.stdout.write(`${JSON.stringify({token:r,expiresAt:typeof a==`number`?new Date(a*1e3).toISOString():void 0,workspaceId:i})}\n`)}export{n as printAccessToken};
|
|
@@ -7,11 +7,11 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{
|
|
11
|
-
Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${r}\n\n${a}\n\n${i}`}function C(e){console.log(`${m.green}Tool execution result saved to: ${e}${m.reset}`),console.log()}function w(){console.log(`${m.green}Tool execution result:${m.reset}`)}function T(
|
|
12
|
-
`)}async function F(t,n
|
|
13
|
-
`);throw Error(e||`Tool discovery failed: ${
|
|
14
|
-
`));let a=
|
|
10
|
+
import{Ut as e,c as t,i as n,jn as r,l as i}from"./profile-storage-BPBUFvA6.js";import{t as a}from"./terminal-text-cBPBiP3x.js";import{n as o,r as s}from"./mcp-client-mMhJPPZN.js";import{t as c}from"./stdin-B18x8pUF.js";import l from"node:fs";import u from"node:os";import d from"node:path";import f from"node:fs/promises";const p=!process.env.NO_COLOR&&process.stdout.isTTY,m={green:p?`\x1B[32m`:``,yellow:p?`\x1B[33m`:``,reset:p?`\x1B[0m`:``},h=8*1024;function g(){return d.join(u.homedir(),`.entrydesk`,`tool-results`)}function _(e){let t=e.trim().replace(/[/\\:*?"<>|\s]/g,`_`).replace(/_+/g,`_`).replace(/^[._]+|[._]+$/g,``).slice(0,100);return!t||t===`.`||t===`..`?`unnamed_tool`:t}function v(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 y(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(`-`)}_${_(e)}.json`}async function b(e,t){try{return await f.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 x(e,t){try{let n=g();await f.mkdir(n,{recursive:!0});let r=y(e),i=d.extname(r),a=r.slice(0,-i.length),o=v(t),s=d.join(n,r);if(await b(s,o))return s;for(let e=1;e<=100;e++){let t=d.join(n,`${a}-${e}${i}`);if(await b(t,o))return t}let c=Math.random().toString(36).slice(2,10),l=d.join(n,`${a}-${c}${i}`);return await f.writeFile(l,o,{encoding:`utf8`,flag:`wx`}),l}catch(e){let t=e instanceof Error?e.message:`unknown error`;return console.error(`${m.yellow}Warning: Could not save result to file: ${t}${m.reset}`),null}}function S(e,t){let n=Buffer.byteLength(e,`utf8`);if(n<=10240)return e;let r=e.slice(0,h),i=e.slice(-2048),a=` … (skipped ${((n-h-2048)/1024).toFixed(1)}KB of ${(n/1024).toFixed(1)}KB) …`;return t&&(a+=`
|
|
11
|
+
Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${r}\n\n${a}\n\n${i}`}function C(e){console.log(`${m.green}Tool execution result saved to: ${e}${m.reset}`),console.log()}function w(){console.log(`${m.green}Tool execution result:${m.reset}`)}function T(e){return r(e)&&typeof e.name==`string`&&(e.description===void 0||typeof e.description==`string`)}function E(e){return Array.isArray(e.primaryTools)&&e.primaryTools.every(T)&&(e.relatedTools===void 0||Array.isArray(e.relatedTools)&&e.relatedTools.every(T))&&(e.toolSchemas===void 0||r(e.toolSchemas))&&(e.authStatuses===void 0||Array.isArray(e.authStatuses)&&e.authStatuses.every(e=>r(e)&&typeof e.toolNamespace==`string`&&typeof e.connected==`boolean`&&(e.authStatusMessage===void 0||typeof e.authStatusMessage==`string`)))&&[e.recommendedPlanSteps,e.knownPitfalls].every(e=>e===void 0||Array.isArray(e)&&e.every(e=>typeof e==`string`))&&(e.error===null||typeof e.error==`string`)}function D(e){return e.split(`__`)[0]??e}function O(e,t,n){console.error(n?a({error:{code:e,message:t}}):`Error [${e}]: ${t}`),process.exitCode=1}function k(e,t,n){O(e,t,n),process.exit(1)}function A(e,r,a=`CONNECTION_FAILED`){if(t(e)){O(a,n(),r);return}let o=e instanceof Error?e.message:`Unknown error`;e instanceof i&&e.code===`not-logged-in`?O(`AUTH_MISSING`,o,r):O(a,o,r)}function j(e,t,n=`CONNECTION_FAILED`){A(e,t,n),process.exit(1)}var M=class extends Error{constructor(e){super(e),this.name=`InputError`}};async function N(e,t){if(e)return e;if(t)try{return l.readFileSync(t,`utf-8`).trim()}catch(e){throw new M(`Failed to read input file: ${e instanceof Error?e.message:`Failed to read input file`}`)}if(!process.stdin.isTTY){let e;try{e=await c()}catch(e){throw new M(`Failed to read stdin: ${e instanceof Error?e.message:`Failed to read stdin`}`)}let t=e.trim();if(t)return t}throw new M(`Input JSON is required. Use --input, --input-file, or pipe it via stdin.`)}function P(e){let t=[`Tool: ${e.name}`];return e.description&&t.push(` Description: ${e.description}`),t.join(`
|
|
12
|
+
`)}async function F(e,t,n){let i=await e.callTool({name:t,arguments:n},s());if(i.isError){let e=i.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
13
|
+
`);throw Error(e||`Tool discovery failed: ${t}`)}if(!r(i.structuredContent))throw Error(`Tool discovery returned no structured content: ${t}`);return i.structuredContent}async function I(t,n){let r=await F(t,e.GET_TOOL_SCHEMAS,{toolNames:[n]}),i=r.errors;if(i?.length)throw Error(i.join(`
|
|
14
|
+
`));let a=r.toolSchemas?.[n];if(a?.inputSchema)return{name:n,...a};throw Error(`Could not retrieve an input schema for ${n}. The name may be incorrect, or its connector may need authorization or be unavailable. Use entrydesk tool search "<English query>" to discover tool names, or entrydesk connectors --all to check connections.`)}async function L(t,n){let r=n.json??!1,i=await o().catch(e=>{j(e,r)}),s;try{let r=await F(i,e.SEARCH_TOOLS,{query:t,...n.namespace&&{toolNamespaces:n.namespace}});if(!E(r))throw Error(`Tool discovery returned invalid search results`);s=r}catch(e){A(e,r,`TOOL_DISCOVERY_FAILED`);return}finally{await i.close().catch(()=>{})}if(r)console.log(a(s,2));else{console.log(`Matched tools (${s.primaryTools.length}):\n`);for(let e of s.primaryTools)console.log(P(e));if(s.relatedTools?.length){console.log(`
|
|
15
15
|
Related tools:`);for(let e of s.relatedTools)console.log(P(e))}for(let e of s.authStatuses??[])e.connected||console.log(`\n${e.toolNamespace}: ${e.authStatusMessage??`Not connected. Run entrydesk connectors --all to check authorization.`}`);for(let e of s.recommendedPlanSteps??[])console.log(e);for(let e of s.knownPitfalls??[])console.log(e);console.log(`
|
|
16
|
-
Next: entrydesk tool get <name> --json`),console.log(`Then: entrydesk tool call <name> --input-file input.json --json`)}s.error&&O(`TOOL_DISCOVERY_FAILED`,s.error,
|
|
17
|
-
`)}async function z(e){let t=e.json??!1,n=await o().catch(e=>{j(e,t)});try{let{tools:r}=await n.listTools({},s());if(e.prefix){let t=e.prefix.toLowerCase();r=r.filter(e=>D(e.name).toLowerCase().startsWith(t))}if(t)console.log(a(r,2));else{let t=e.prefix?` (prefix: ${e.prefix})`:``;console.log(`Directly listed tools (${r.length})${t}:\n`);for(let e of r)console.log(P(e)),console.log();console.log(`Connector tools may be available without appearing here. Use entrydesk tool search "<English query>" or entrydesk tool get <name>.`)}}catch(e){j(e,t)}finally{await n.close().catch(()=>{})}}async function B(e,t){let n=t.json??!1,r=await o().catch(e=>{j(e,n)}),i;try{let{tools:t}=await r.listTools({},s());i=t.find(t=>t.name===e)??await I(r,e)}catch(e){A(e,n,`TOOL_DISCOVERY_FAILED`);return}finally{await r.close().catch(()=>{})}console.log(n?a(i,2):R(i))}async function V(t,n
|
|
16
|
+
Next: entrydesk tool get <name> --json`),console.log(`Then: entrydesk tool call <name> --input-file input.json --json`)}s.error&&O(`TOOL_DISCOVERY_FAILED`,s.error,r)}function R(e){let t=[`Tool: ${e.name}`];return e.description&&(t.push(`Description:`),t.push(` ${e.description}`)),t.push(`Input Schema:`),t.push(a(e.inputSchema,2)),t.join(`
|
|
17
|
+
`)}async function z(e){let t=e.json??!1,n=await o().catch(e=>{j(e,t)});try{let{tools:r}=await n.listTools({},s());if(e.prefix){let t=e.prefix.toLowerCase();r=r.filter(e=>D(e.name).toLowerCase().startsWith(t))}if(t)console.log(a(r,2));else{let t=e.prefix?` (prefix: ${e.prefix})`:``;console.log(`Directly listed tools (${r.length})${t}:\n`);for(let e of r)console.log(P(e)),console.log();console.log(`Connector tools may be available without appearing here. Use entrydesk tool search "<English query>" or entrydesk tool get <name>.`)}}catch(e){j(e,t)}finally{await n.close().catch(()=>{})}}async function B(e,t){let n=t.json??!1,r=await o().catch(e=>{j(e,n)}),i;try{let{tools:t}=await r.listTools({},s());i=t.find(t=>t.name===e)??await I(r,e)}catch(e){A(e,n,`TOOL_DISCOVERY_FAILED`);return}finally{await r.close().catch(()=>{})}console.log(n?a(i,2):R(i))}async function V(e,t,n){let i;try{i=JSON.parse(t)}catch(e){k(`INVALID_INPUT`,e instanceof Error?`Invalid JSON input: ${e.message}`:`Invalid JSON input`,n)}r(i)||k(`INVALID_INPUT`,`Input must be a JSON object`,n);let c=await o().catch(e=>{j(e,n,`TOOL_CALL_FAILED`)}),l=!1;try{let t=await c.callTool({name:e,arguments:i},s());if(n)console.log(a(t,2));else{let n=await x(e,t);n&&C(n),w();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(a(e,2));if(t.structuredContent){let e=S(a(t.structuredContent,2),n);console.log(e)}}t.isError&&(l=!0)}catch(e){j(e,n,`TOOL_CALL_FAILED`)}finally{await c.close().catch(()=>{})}l&&process.exit(1)}async function H(e,t){let n=t.json??!1,r;try{r=await N(t.input,t.inputFile)}catch(e){throw e instanceof M&&k(`INVALID_INPUT`,e.message,n),e}await V(e,r,n)}export{B as getTool,z as listTools,H as runToolCall,L as searchTools};
|
|
@@ -7,4 +7,4 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{r as e}from"./profile-storage
|
|
10
|
+
import{r as e}from"./profile-storage-BPBUFvA6.js";import{t}from"./version-BFfQldMJ.js";import{t as n}from"./terminal-text-cBPBiP3x.js";import r from"cross-spawn";const i=`@entrydesk/cli`;function a(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 o(e,t){if(e===t)return 0;if(e===null)return 1;if(t===null)return-1;let n=e.split(`.`),r=t.split(`.`);for(let[e,t]of n.entries()){let n=r[e];if(n===void 0)break;if(t!==n){let e=/^\d+$/u.test(t),r=/^\d+$/u.test(n);return e&&r?Number(t)<Number(n)?-1:1:e?-1:r?1:t<n?-1:1}}return n.length===r.length?0:n.length<r.length?-1:1}function s(e,t){let n=a(e),r=a(t);if(!n||!r)return n?1:r?-1:0;for(let[e,t]of n.nums.entries()){let n=r.nums[e];if(n!==void 0&&t!==n)return t<n?-1:1}return o(n.prerelease,r.prerelease)}function c(e,{inheritOutput:t}){return new Promise((n,i)=>{let a=r(`npm`,e,{stdio:t?[`ignore`,`inherit`,`inherit`]:[`ignore`,`pipe`,`pipe`]}),o=``,s=``;a.stdout?.on(`data`,e=>{o+=String(e)}),a.stderr?.on(`data`,e=>{s+=String(e)}),a.once(`error`,i),a.once(`close`,e=>{n({exitCode:e??1,stdout:o,stderr:s})})})}async function l(){let t;try{t=await c([`view`,i,`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 ${i} version from the npm registry.${t.stderr?`\n${t.stderr.trim()}`:``}`);if(!a(n))throw new e(`Unexpected version from the npm registry: ${JSON.stringify(n)}`);return n}async function u(r){let a=t(),o=await l(),u=s(a,o),d=u>=0;if(r.check||d){r.json?console.log(n({current:a,latest:o,upToDate:d,updated:!1})):console.log(u>0?`entrydesk ${a} is newer than the latest published version (${o}). Nothing to do.`:d?`entrydesk ${a} is already the latest version.`:`Update available: ${a} → ${o}. Run \`entrydesk update\` to install.`);return}r.json||console.log(`Updating entrydesk ${a} → ${o}…`);let f=await c([`install`,`-g`,`${i}@${o}`],{inheritOutput:!r.json});if(f.exitCode!==0){let t=f.stderr?`\n${f.stderr.trim()}`:``;throw new e(`npm install failed (exit code ${f.exitCode}). You can update manually with \`npm install -g ${i}@latest\`.`+t,f.exitCode)}r.json?console.log(n({current:a,latest:o,upToDate:d,updated:!0})):console.log(`entrydesk updated to ${o}.`)}export{u as runUpdate};
|
|
@@ -7,5 +7,5 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{C as e,p as t}from"./profile-storage
|
|
10
|
+
import{C as e,p as t}from"./profile-storage-BPBUFvA6.js";import{t as n}from"./terminal-text-cBPBiP3x.js";import{i as r,n as i}from"./format-C0MI0rzh.js";import{writeFileSync as a}from"node:fs";function o(e){console.log(`Extra-usage balance: ${r(e.balanceUsd)}`);let t=e.currentSpentUsedPercent==null?``:` (${e.currentSpentUsedPercent}% of limit)`;console.log(`Spent this period: ${i(e.currentSpentUsd)}${t}`),e.monthlyExtraUsageLimitUsd!=null&&console.log(`Workspace limit: ${r(e.monthlyExtraUsageLimitUsd)} / month`),e.memberMonthlyExtraUsageLimitUsd!=null&&console.log(`Per-member limit: ${r(e.memberMonthlyExtraUsageLimitUsd)} / month`),e.nextExpiry&&console.log(`Next expiry: ${r(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 s(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: ${i(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 c(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: ${i(t.extraUsage)}`),console.log(` User ID: ${t.user.id}`),console.log(``)}async function l(r){let{accessToken:i,workspaceId:a}=await t(),s=await new e().getUsageOverview(i,a);if(r.json){console.log(n(s));return}o(s)}async function u(r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().getUsageMe(i,a);if(r.json){console.log(n(o));return}s(o)}async function d(r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().getUsageConsumptions(i,a,{limit:r.limit,offset:r.offset,periodStart:r.periodStart});if(r.json){console.log(n(o));return}if(o.items.length===0){console.log(`No consumptions for this period.`);return}c(o)}async function f(n){let{accessToken:r,workspaceId:i}=await t(),o=await new e().exportUsageCsv(r,i,n.periodStart);if(n.output){a(n.output,o),console.log(`Wrote usage CSV to ${n.output}`);return}process.stdout.write(o)}async function p(r){let{accessToken:a,workspaceId:o}=await t(),s=new e,c=[],l,u=0;do{let e=await s.getMonthlyUsages(a,o,{nextKey:l,limit:100});if(c.push(...e.monthlyUsages),l=e.nextKey,u++,u>=100){console.error(`Warning: Showing first ${c.length} entries (pagination limit reached)`);break}}while(l);if(r.json){console.log(n(c));return}if(c.length===0){console.log(`No usage data found for this workspace.`);return}console.log(`Current month usage:
|
|
11
11
|
`);let d=0,f=0;for(let e of c)d+=Number.parseFloat(e.totalCost),f+=e.operationCount;console.log(`Total cost: ${i(d)}`),console.log(`Total operations: ${f.toLocaleString()}`),console.log(`Users: ${c.length}\n`);let p=[...c].toSorted((e,t)=>r.sortBy===`cost`?Number.parseFloat(t.totalCost)-Number.parseFloat(e.totalCost):t.operationCount-e.operationCount),m=r.limit??p.length,h=p.slice(0,m);console.log(`Usage by user (sorted by ${r.sortBy}, showing ${h.length} of ${c.length}):\n`);for(let e of h)console.log(` ${e.user.name} (${e.user.email})`),console.log(` Cost: ${i(e.totalCost)}`),console.log(` Operations: ${e.operationCount.toLocaleString()}`),console.log(``);h.length<c.length&&console.log(`… and ${c.length-h.length} more users`)}export{f as exportUsage,d as listUsageConsumptions,u as showOwnUsage,l as showUsageBalance,p as showUsageSummary};
|
|
@@ -7,6 +7,6 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{
|
|
11
|
-
`))||`usage-audit tool call failed`}async function c(e,t,r){let i=await e.callTool({name:t,arguments:r},o());if(i.isError){let e=s(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 l(e){let t=await a();try{return await e(t)}finally{await t.close().catch(()=>{})}}function u(e){return e.toLocaleString()}function d(e){return e==null?`—`:`${e>0?`+`:``}${e}%`}function f(e){return e?e.slice(0,10):`never`}async function p(
|
|
12
|
-
Daily:`);for(let e of s)console.log(` ${e.date} ${i(e.cost).padStart(10)} ${u(e.calls).padStart(8)} calls`)}if(a.activeSchedules.length>0){console.log(`\nActive schedules (${a.activeSchedules.length}):`);for(let e of a.activeSchedules){let t=e.agentName?` · ${e.agentName}`:``;console.log(` ${e.name}${t} (${e.scheduleType}, last run ${f(e.lastTaskAt)})`)}}}async function h(
|
|
10
|
+
import{Gt as e,k as t,r as n}from"./profile-storage-BPBUFvA6.js";import{t as r}from"./terminal-text-cBPBiP3x.js";import{i}from"./format-C0MI0rzh.js";import{n as a,r as o}from"./mcp-client-mMhJPPZN.js";function s(e){return Array.isArray(e)&&t(e.map(e=>typeof e==`object`&&e&&`text`in e?String(e.text):``).filter(Boolean).join(`
|
|
11
|
+
`))||`usage-audit tool call failed`}async function c(e,t,r){let i=await e.callTool({name:t,arguments:r},o());if(i.isError){let e=s(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 l(e){let t=await a();try{return await e(t)}finally{await t.close().catch(()=>{})}}function u(e){return e.toLocaleString()}function d(e){return e==null?`—`:`${e>0?`+`:``}${e}%`}function f(e){return e?e.slice(0,10):`never`}async function p(t){let n=await l(n=>c(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(r(n,2));return}let a=n.windowDays==null?`all time`:`last ${n.windowDays} days`,o=t.model?` · model ~ "${t.model}"`:``;if(console.log(`Cost ranking by ${t.by} · ${a}${o}\n`),n.rows.length===0){console.log(` No spend in this window.`);return}let s=Math.max(...n.rows.map(e=>i(e.cost).length));for(let e of n.rows){let t=e.ownerEmail?` · ${e.ownerEmail}`:``;console.log(` ${i(e.cost).padStart(s)} ${d(e.costChangePct).padEnd(7)} ${u(e.calls).padStart(8)} calls ${e.key}${t}`)}console.log(`\n ${n.rows.length} rows.`)}async function m(t,n){let[a,o]=await l(r=>Promise.all([c(r,e.GET_USER_BREAKDOWN,{email:t,sinceDays:n.days,minCost:n.minCost??0}),c(r,e.GET_USER_DAILY_TREND,{emails:[t],days:n.days})]));if(n.json){console.log(r({breakdown:a,trend:o},2));return}if(console.log(`${t} · last ${n.days} days\n`),console.log(`By agent / operation:`),a.breakdown.length===0)console.log(` (no spend)`);else{let e=Math.max(...a.breakdown.map(e=>i(e.cost).length));for(let t of a.breakdown)console.log(` ${i(t.cost).padStart(e)} ${u(t.calls).padStart(8)} calls ${t.agentOrOperation}`)}let s=o.trends[0]?.days??[];if(s.length>0){console.log(`
|
|
12
|
+
Daily:`);for(let e of s)console.log(` ${e.date} ${i(e.cost).padStart(10)} ${u(e.calls).padStart(8)} calls`)}if(a.activeSchedules.length>0){console.log(`\nActive schedules (${a.activeSchedules.length}):`);for(let e of a.activeSchedules){let t=e.agentName?` · ${e.agentName}`:``;console.log(` ${e.name}${t} (${e.scheduleType}, last run ${f(e.lastTaskAt)})`)}}}async function h(t){let{stale:n,toolCalls:a}=await l(async n=>{let r=await c(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=>c(n,e.GET_SCHEDULE_TOOL_CALLS,{scheduleIds:r,sinceDays:t.days,recentRuns:5})))).flatMap(e=>e.schedules)}}});if(t.json){console.log(r({stale:n,toolCalls:a},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 o=new Map(a.schedules.map(e=>[e.scheduleId,e.toolCalls]));for(let e of n.schedules){console.log(` ${i(e.cost)} ${u(e.runs)} runs ${e.unreadPct}% unread last read ${f(e.lastReadAt)}`),console.log(` ${e.scheduleName} · ${e.ownerEmail}`);let t=o.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{m as drillUsage,h as findUsageWaste,p as rankUsage};
|
|
@@ -7,5 +7,5 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{C as e,
|
|
10
|
+
import{C as e,O as t,a as n,k as r,o as i,p as a}from"./profile-storage-BPBUFvA6.js";import{t as o}from"./terminal-text-cBPBiP3x.js";import{t as s}from"./paginate-y3CJuqRW.js";import{t as c}from"./confirm-Ct432t3K.js";import{HTTPError as l}from"ky";var u=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`WebhookCommandError`}};const d={webhook_destination_not_found:"Webhook destination not found. `entrydesk webhook list` shows the destinations in this workspace.",webhook_delivery_not_found:"Delivery not found. `entrydesk webhook deliveries <id>` lists the deliveries to a destination.",webhook_destination_disabled:"This destination is disabled. Run `entrydesk webhook enable <id>` first.",webhook_destination_limit_reached:`This workspace already has the maximum number of webhook destinations. Delete one first.`,insufficient_permissions:`Managing webhooks needs the Manage workspace permission in this workspace.`};async function f(e){try{let{features:t}=await e.getRuntimeConfig();if(!t.enableOutgoingWebhooks)return new u(`webhooks_not_enabled`,`Outgoing webhooks are not enabled on this EntryDesk environment.`)}catch(e){return new u(`not_found`,`Not found, and this EntryDesk environment's feature flags could not be read to tell whether webhooks are enabled (${n(e).message.replace(/^Error: /u,``)}).`)}return new u(`not_found`,`Not found.`)}async function p(e,n){if(n instanceof u)return n;if(!(n instanceof l))return null;let r=t(n.data);if(r===`insufficient_scope`)return new u(r,"Your token lacks the workspaces:read / workspaces:write scope webhooks need. Run `entrydesk login` again, or issue a token with those scopes and set ENTRYDESK_TOKEN.");let i=r&&Object.hasOwn(d,r)?d[r]:void 0;return r&&i?new u(r,i):n.response.status===404?f(e):null}async function m(t,n){let s=new e;try{let{accessToken:e,workspaceId:t}=await a();await n({client:s,accessToken:e,workspaceId:t})}catch(e){let{code:n,message:a}=await p(s,e)??i(e),c={code:n,message:a.replace(/^Error: /u,``)};t.json?console.error(o({error:c})):console.error(`Error: ${r(c.message)}`),process.exit(1)}}function h(e){return e?r(e):``}function g(e){return e===null?`—`:`${(e*100).toFixed(1)}%`}function _(e){return e===null?`—`:`${e} ms`}function v(e){return e.httpStatus===null?e.error===null?`In progress`:`${h(e.error)}, ${_(e.responseTimeMs)}`:`HTTP ${e.httpStatus}, ${_(e.responseTimeMs)}`}function y(e){let t=[e.status];return e.disabledReason===`consecutive_failures`&&t.push(`after repeated failures`),e.verifiedAt||t.push(`unverified`),t.join(`, `)}function b(e){return e===null?`All events`:e.join(`, `)}function x(e){let{metrics:t}=e;console.log(`${h(e.name)} (${e.id})`),console.log(` URL: ${h(e.url)}`),e.description&&console.log(` Description: ${h(e.description)}`),console.log(` Status: ${y(e)}`),console.log(` Listening to: ${b(e.eventTypes)}`),console.log(` API version: ${e.apiVersion}`),console.log(` Last 7 days: ${t.deliveryCount} deliveries, ${g(t.errorRate)} errors, p50 ${_(t.p50ResponseTimeMs)}`),e.previousSecretExpiresAt&&console.log(` Previous secret signs until ${e.previousSecretExpiresAt}`)}function S(e){console.log(``),console.log(`Signing secret: ${e}`),console.log(`Store it now; it is not shown again. Verify X-ED-Signature as v1=HMAC-SHA256(secret, "{X-ED-Timestamp}.{raw body}").`)}function C(e){let t=e.lastHttpStatus?`HTTP ${e.lastHttpStatus}`:h(e.lastError)||`—`,n=e.nextAttemptAt?`, next attempt ${e.nextAttemptAt}`:``;console.log(`${e.id} ${e.status.padEnd(9)} ${e.eventType} attempts ${e.attempts} ${t}${n} ${e.createdAt}`)}function w(e){return e.allEvents?{eventTypes:null}:e.events?{eventTypes:e.events}:{}}async function T(e){await m(e,async({client:t,accessToken:n,workspaceId:r})=>{let i=await t.listWebhookDestinations(n,r);if(e.json){console.log(o(i));return}if(i.items.length===0){console.log("No webhook destinations. Create one with `entrydesk webhook create`.");return}for(let e of i.items)console.log(`${e.id} ${h(e.name)} ${h(e.url)} [${y(e)}] ${b(e.eventTypes)} errors ${g(e.metrics.errorRate)}`)})}async function E(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{let a=await n.getWebhookDestination(r,i,e);if(t.json){console.log(o(a));return}x(a)})}async function D(e){await m(e,async({client:t,accessToken:n,workspaceId:r})=>{if(!e.events&&!e.allEvents)throw new u(`events_required`,`Pass --events <types> or --all-events.`);let i=await t.createWebhookDestination(n,r,{url:e.url,name:e.name,description:e.description?.trim()||null,eventTypes:e.allEvents?null:e.events??null,...e.apiVersion?{apiVersion:e.apiVersion}:{}});if(e.json){console.log(o(i));return}console.log(`Created webhook destination.`),x(i.destination),S(i.signingSecret)})}async function O(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{let a={...t.url===void 0?{}:{url:t.url},...t.name===void 0?{}:{name:t.name},...t.description===void 0?{}:{description:t.description.trim()||null},...t.apiVersion===void 0?{}:{apiVersion:t.apiVersion},...w(t)};if(Object.keys(a).length===0)throw new u(`nothing_to_update`,`Pass at least one of --url, --name, --description, --events, --all-events or --api-version.`);let s=await n.updateWebhookDestination(r,i,e,a);if(t.json){console.log(o(s));return}console.log(`Updated webhook destination.`),x(s)})}async function k(e,t,n){await m(n,async({client:r,accessToken:i,workspaceId:a})=>{let s=await r.updateWebhookDestination(i,a,e,{status:t?`active`:`disabled`});if(n.json){console.log(o(s));return}console.log(t?`Enabled ${h(s.name)}. Events from while it was disabled are not resent.`:`Disabled ${h(s.name)}. No events are delivered until you enable it again.`)})}async function A(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{if(!t.yes){if(!process.stdin.isTTY||t.json)throw new u(`confirmation_required`,`Deleting webhook destination ${e} needs confirmation. Re-run with --yes.`);if(!await c(`Delete webhook destination ${e}? Its signing secret is destroyed and deliveries stop.`)){console.log(`Aborted.`);return}}if(await n.deleteWebhookDestination(r,i,e),t.json){console.log(o({id:e,deleted:!0}));return}console.log(`Deleted webhook destination ${e}.`)})}async function j(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{let a=await n.rotateWebhookSecret(r,i,e,t.expirePrevious===void 0?{}:{expirePreviousInSeconds:t.expirePrevious});if(t.json){console.log(o(a));return}console.log(a.previousSecretExpiresAt?`Rotated. The previous secret keeps signing until ${a.previousSecretExpiresAt}.`:`Rotated. The previous secret no longer signs.`),S(a.signingSecret)})}async function M(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{let a=a=>n.listWebhookDeliveries(r,i,e,{status:t.status,eventType:t.eventType,limit:t.all?100:t.limit,nextKey:a}),c=t.all?{items:await s(async e=>{let t=await a(e);return{items:t.items,nextKey:t.nextKey??void 0}}),nextKey:null}:await a(t.nextKey);if(t.json){console.log(o(c));return}if(c.items.length===0){console.log(`No deliveries.`);return}for(let e of c.items)C(e);c.nextKey&&console.log(`\nMore deliveries: --next-key ${h(c.nextKey)}`)})}async function N(e,t,n){await m(n,async({client:r,accessToken:i,workspaceId:a})=>{let s=await r.getWebhookDelivery(i,a,e,t);if(n.json){console.log(o(s));return}C(s),console.log(`\nEvent ${s.eventId}, occurred ${s.occurredAt}`),console.log(`
|
|
11
11
|
Request body:`),console.log(h(s.requestBody));for(let e of s.attemptHistory)console.log(`\nAttempt ${e.attempt} at ${e.attemptedAt} (X-ED-Delivery-Id ${e.id})`),console.log(` Result: ${v(e)}`),e.responseBody&&console.log(` Response: ${h(e.responseBody)}`)})}async function P(e,t,n){await m(n,async({client:r,accessToken:i,workspaceId:a})=>{let s=await r.resendWebhookDelivery(i,a,e,t);if(n.json){console.log(o(s));return}console.log(`Queued delivery ${t} again (event ${s.delivery.eventId}). Check it with \`entrydesk webhook delivery ${e} ${t}\`.`)})}async function F(e,t){await m(t,async({client:n,accessToken:r,workspaceId:i})=>{let a=await n.sendWebhookTest(r,i,e,t.eventType?{eventType:t.eventType}:{});if(t.json){console.log(o(a));return}let{outcome:s,delivery:c}=a,l=s.httpStatus?`HTTP ${s.httpStatus}`:h(s.error);console.log(`${s.succeeded?`Delivered`:`Failed`}: ${l}${s.responseTimeMs===null?``:` in ${_(s.responseTimeMs)}`} (delivery ${c.id}).`),!s.succeeded&&c.nextAttemptAt&&console.log(`Retrying at ${c.nextAttemptAt}.`)})}async function I(e){await m(e,async({client:t,accessToken:n,workspaceId:r})=>{let i=await t.listWebhookEventTypes(n,r);if(e.json){console.log(o(i));return}for(let e of i.items.filter(e=>e.subscribable))console.log(`${e.type} (since ${e.addedIn})`),console.log(` ${e.description}`)})}export{D as createWebhook,A as deleteWebhook,M as listWebhookDeliveries,I as listWebhookEventTypes,T as listWebhooks,P as resendWebhookDelivery,j as rotateWebhookSecret,F as sendWebhookTest,k as setWebhookEnabled,E as showWebhook,N as showWebhookDelivery,O as updateWebhook};
|
|
@@ -7,7 +7,7 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{C as e,p as t}from"./profile-storage
|
|
10
|
+
import{C as e,p as t}from"./profile-storage-BPBUFvA6.js";import{t as n}from"./terminal-text-cBPBiP3x.js";import{t as r}from"./resource-grants-HDU2bPhQ.js";import{r as i}from"./format-C0MI0rzh.js";import{t as a}from"./paginate-y3CJuqRW.js";import{readFileSync as o}from"node:fs";import{setTimeout as s}from"node:timers/promises";const c=262144,l=new Set([`completed`,`failed`,`cancelled`]);function u(e){let t;try{t=o(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`)>c&&(console.error(`Script file exceeds ${c} bytes.`),process.exit(1)),t}function d(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 f(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: ${i(e.updatedAt)}`);let n=e.scriptSource.split(`
|
|
11
11
|
`).length;t?(console.log(`\n Script (${n} lines):\n`),console.log(e.scriptSource)):console.log(` Script: ${n} lines (use --show-source to print)`)}function p(e){console.log(`Runs (${e.length}):\n`);for(let t of e){let e=i(t.startedAt??t.createdAt);console.log(` ${t.status}${e?` · ${e}`:``}`),console.log(` ID: ${t.id}`)}}function m(e){console.log(`Run ${e.id}`),console.log(` Workflow: ${e.workflowId}`),console.log(` Status: ${e.status}`),e.startedAt&&console.log(` Started: ${i(e.startedAt)}`),e.completedAt&&console.log(` Completed: ${i(e.completedAt)}`),e.error!=null&&console.log(` Error: ${n(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 r=e.context?.logs??[];if(r.length>0){console.log(`
|
|
12
12
|
Logs:`);for(let e of r)console.log(` ${e}`)}e.context?.spent!=null&&console.log(`\n Tokens spent: ${e.context.spent}`)}async function h(e,t,n,r,i){for(let a=0;a<600;a++){let o=await e.getWorkflowRun(t,n,r,i);if(l.has(o.status))return a>0&&process.stderr.write(`
|
|
13
13
|
`),o;let c=a*2;process.stderr.write(`\rWaiting… ${o.status} (${c}s)`),await s(2e3)}throw process.stderr.write(`
|
|
@@ -7,5 +7,5 @@ if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
|
7
7
|
);
|
|
8
8
|
process.exit(1);
|
|
9
9
|
}
|
|
10
|
-
import{C as e,
|
|
10
|
+
import{C as e,D as t,d as n}from"./profile-storage-BPBUFvA6.js";import{t as r}from"./terminal-text-cBPBiP3x.js";async function i(i){let a=await t.getAll(),o=await n(),{workspaces:s}=await new e().getWorkspaces(o);if(i.json){console.log(r(s));return}if(s.length===0){console.log(`No workspaces found.`);return}console.log(`Workspaces (${s.length}):\n`);for(let e of s){let t=e.id===a?.workspaceId?` (current)`:``;console.log(` ${e.name}${t}`),console.log(` ID: ${e.id}`),console.log(``)}}async function a(i,a){let o=await n(),{workspaces:s}=await new e().getWorkspaces(o),c=s.find(e=>e.id===i);if(!c){console.error(`Workspace not found: ${i}`),console.error(`
|
|
11
11
|
Available workspaces:`);for(let e of s)console.error(` ${e.name}: ${e.id}`);process.exit(1)}if(await t.saveWorkspaceId(i),a.json){console.log(r({workspaceId:i,workspaceName:c.name}));return}console.log(`Switched to workspace: ${c.name}`),console.log(` ID: ${i}`)}export{i as listWorkspaces,a as switchWorkspace};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@entrydesk/cli",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.3",
|
|
4
4
|
"description": "EntryDesk CLI - Interact with EntryDesk from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"README.md"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ai-sdk/react": "^4.0.
|
|
14
|
+
"@ai-sdk/react": "^4.0.152",
|
|
15
15
|
"@commander-js/extra-typings": "^15.0.0",
|
|
16
16
|
"@modelcontextprotocol/client": "^2.3.1",
|
|
17
17
|
"@modelcontextprotocol/node": "^2.1.1",
|
|
18
18
|
"@modelcontextprotocol/server": "^2.3.1",
|
|
19
19
|
"@vscode/ripgrep": "1.18.0",
|
|
20
20
|
"adm-zip": "^0.6.1",
|
|
21
|
-
"ai": "^7.0.
|
|
21
|
+
"ai": "^7.0.148",
|
|
22
22
|
"archiver": "^7.0.1",
|
|
23
23
|
"commander": "^15.0.0",
|
|
24
24
|
"cross-spawn": "^7.0.6",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@vitest/coverage-v8": "^5.0.3",
|
|
50
50
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
51
51
|
"happy-dom": "^20.8.9",
|
|
52
|
-
"oxlint": "^1.
|
|
52
|
+
"oxlint": "^1.89.0",
|
|
53
53
|
"tsdown": "^0.22.14",
|
|
54
54
|
"typescript": "^7.0.2",
|
|
55
55
|
"vitest": "^5.0.3"
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __entrydeskNodeFloor = 24;
|
|
3
|
-
if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
4
|
-
process.stderr.write(
|
|
5
|
-
'entrydesk: Node.js ' + __entrydeskNodeFloor + ' or newer is required, but this is Node ' + process.versions.node + '.\n' +
|
|
6
|
-
'Upgrade Node (https://nodejs.org/en/download), then reinstall @entrydesk/cli.\n'
|
|
7
|
-
);
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
import{Ct as e,Ht as t,St as n,Ut as r}from"./profile-storage--QCh_u_Q.js";function i({allowedTools:t,disallowedTools:r}){if(!(!t?.length&&!r?.length))return[...e(t?.map(e=>({toolName:e,policy:n.ALWAYS_ALLOW})),r?.map(e=>({toolName:e,policy:n.BLOCK})))].map(([e,t])=>({toolName:e,policy:t}))}function a(t,r){let i=[...r].map(e=>({toolName:e,policy:n.ALWAYS_ALLOW}));return i.length===0?t:[...e(t,i)].map(([e,t])=>({toolName:e,policy:t}))}function o({agentId:e,model:n,projectId:i,pinnedConnectorIds:a,clientTools:o,clientToolSystemPrompt:s,toolApprovalMode:c,toolPolicies:l}){return{...i?{projectId:i}:{},...e?{agentId:e}:{...n?{model:n}:{},...a?.length?{pinnedConnectorIds:a}:{}},...o?{clientTools:r(o,t.DIRECT)}:{},...s?{clientToolSystemPrompt:s}:{},...c?{toolApprovalMode:c}:{},...l?.length?{toolPolicies:l}:{}}}export{i as n,a as r,o as t};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __entrydeskNodeFloor = 24;
|
|
3
|
-
if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
4
|
-
process.stderr.write(
|
|
5
|
-
'entrydesk: Node.js ' + __entrydeskNodeFloor + ' or newer is required, but this is Node ' + process.versions.node + '.\n' +
|
|
6
|
-
'Upgrade Node (https://nodejs.org/en/download), then reinstall @entrydesk/cli.\n'
|
|
7
|
-
);
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
import{C as e,Ft as t,It as n,Lt as r,jt as i,kt as a,p as o}from"./profile-storage--QCh_u_Q.js";import{t as s}from"./terminal-text-cBPBiP3x.js";import{t as c}from"./confirm-Ct432t3K.js";function l(e,n){return n?t(n)?`Next: entrydesk connectors connect ${e} --oauth`:n===`credentials`?`Next: entrydesk connectors connect ${e} --username <username> --password <password>`:`Next: entrydesk connectors connect ${e} --token <token>`:`This connector needs no authorization — there is no connect step.`}async function u(t){let{accessToken:n,workspaceId:r}=await o(),{connectors:i,nextKey:a}=await new e().getConnectors(n,r,{connectionStatus:t.all?`all`:`connected`,search:t.search,limit:t.limit,nextKey:t.nextKey});if(t.json){console.log(s({connectors:i,nextKey:a}));return}if(i.length===0){console.log(t.all?`No connectors found.`:`No connected connectors. Use --all to browse connectable ones.`);return}let c=t.all?`Connectors`:`Connected connectors`;console.log(`${c} (${i.length}):\n`);for(let e of i){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(``)}a&&console.log(`More results: --next-key ${a}`)}async function d(t,n){let{accessToken:r,workspaceId:i}=await o(),{tools:a}=await new e().getConnectorTools(r,i,t);if(n.json){console.log(s({tools:a}));return}if(a.length===0){console.log(`This connector exposes no tools.`);return}console.log(`Tools (${a.length}):\n`);for(let e of a)console.log(` ${e.name} [${e.policy}]`),e.description&&console.log(` ${e.description}`)}async function f(t,n){let{accessToken:r,workspaceId:i}=await o();await new e().syncConnectorTools(r,i,t),console.log(n.json?s({id:t,synced:!0}):`Synced tools for connector ${t}.`)}async function p(t,n){let{accessToken:r,workspaceId:i}=await o(),a=new e;if(n.oauth){let{url:e}=await a.getConnectorAuthUrl(r,i,t);if(n.json){console.log(s({url:e}));return}console.log(`Open this URL in your browser to authorize the connector:`),console.log(` ${e}`),console.log(`
|
|
11
|
-
After you approve, the connection is saved automatically — re-run`),console.log("`entrydesk connectors` to confirm it shows as connected.");return}let c;n.token?c={token:n.token}:n.username&&n.password?c={username:n.username,password:n.password}:(console.error(`Provide --token, or --username and --password, or --oauth to connect.`),process.exit(1)),await a.connectConnectorToken(r,i,t,c),console.log(n.json?s({id:t,connected:!0}):`Connected connector ${t}.`)}function m(e){let t=e.auth===`oauth`||e.auth===`google-iap`;if(t&&(!e.provider||!e.scope?.length)&&(console.error(`--auth ${e.auth} needs --provider and at least one --scope.`),process.exit(1)),!t&&(e.provider||e.scope?.length)&&(console.error(e.auth?`--provider and --scope apply only to --auth oauth and --auth google-iap, not --auth ${e.auth}.`:`--provider and --scope need --auth oauth or --auth google-iap.`),process.exit(1)),e.auth!==void 0)return e.auth===!1?null:{type:e.auth,...e.provider?{provider:e.provider}:{},...e.scope?.length?{scopes:e.scope}:{}}}async function h(t){let c=m(t),u=t.toolNamespace??t.toolPrefix,d=u??n(t.name),f=i(d);if(f){let e=a[f];console.error(u?`--tool-namespace ${e}.`:`The tool namespace derived from --name ("${d}") ${e}. Pass --tool-namespace explicitly.`),process.exit(1)}let{accessToken:p,workspaceId:h}=await o(),g=await new e().createCustomConnector(p,h,{type:r.CUSTOM_REMOTE_URL,name:t.name,description:t.description,transport:t.transport,url:t.url,toolNamespace:d,...c?{authorization:c}:{}});if(t.json){console.log(s(g));return}console.log(`Created connector ${g.name}.`),console.log(` ID: ${g.id}`),console.log(` URL: ${g.url}`),console.log(` Tool namespace: ${g.toolNamespace}`),console.log(`\n${l(g.id,t.auth)}`)}function g(e,t){return t===void 0?e:t===null||t.type!==e?.type?t:{...e,...t}}async function _(t,n){[n.name,n.url,n.description,n.transport,n.toolNamespace,n.auth,n.provider,n.scope].every(e=>e===void 0)&&(console.error(`Nothing to update. Pass at least one of --name, --url, --description, --transport, --tool-namespace, --auth or --no-auth.`),process.exit(1));let i=m(n),{accessToken:a,workspaceId:c}=await o(),l=new e,u=await l.getCustomConnector(a,c,t),d=await l.updateCustomConnector(a,c,t,{type:r.CUSTOM_REMOTE_URL,name:n.name??u.name,description:n.description??u.description,transport:n.transport??u.transport,url:n.url??u.url,toolNamespace:n.toolNamespace??u.toolNamespace,authorization:g(u.authorization,i)});if(n.json){console.log(s(d));return}console.log(`Updated connector ${d.name}.`),console.log(` ID: ${d.id}`),console.log(` URL: ${d.url}`),console.log(` Tool namespace: ${d.toolNamespace}`)}async function v(t,n){let{accessToken:r,workspaceId:i}=await o();if(!n.yes&&(process.stdin.isTTY||(console.error(`Disconnecting connector ${t} needs confirmation. Re-run with --yes.`),process.exit(1)),!await c(`Disconnect connector ${t}?`))){console.log(`Aborted.`);return}await new e().disconnectConnector(r,i,t),console.log(n.json?s({id:t,disconnected:!0}):`Disconnected connector ${t}.`)}export{p as connectConnector,h as createConnector,v as disconnectConnector,d as listConnectorTools,u as listConnectors,f as syncConnectorTools,_ as updateConnector};
|
package/dist/profile-D4jP-vQE.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
var __entrydeskNodeFloor = 24;
|
|
3
|
-
if (parseInt(process.versions.node, 10) < __entrydeskNodeFloor) {
|
|
4
|
-
process.stderr.write(
|
|
5
|
-
'entrydesk: Node.js ' + __entrydeskNodeFloor + ' or newer is required, but this is Node ' + process.versions.node + '.\n' +
|
|
6
|
-
'Upgrade Node (https://nodejs.org/en/download), then reinstall @entrydesk/cli.\n'
|
|
7
|
-
);
|
|
8
|
-
process.exit(1);
|
|
9
|
-
}
|
|
10
|
-
import{B as e,E as t,r as n,t as r,z as i}from"./profile-storage--QCh_u_Q.js";import{t as a}from"./terminal-text-cBPBiP3x.js";function o(e,t){let i=e??t.profile;if(i)return i;let a=r.getProfileNames(),[o]=a;if(a.length===1&&o!==void 0)return o;throw new n(`Profile name is required when multiple profiles exist.`)}function s(t,n){let r=e(t,n);r&&console.error(r)}function c(e){let t=r.getCurrentProfileName(),n=r.getProfileNames();if(e.json){console.log(a({currentProfile:t,profiles:n.map(e=>({name:e,isCurrent:e===t}))}));return}console.log(`Profiles (${n.length}):`);for(let e of n)console.log(` ${e}${e===t?` (current)`:``}`)}function l(e){let t=r.getCurrentProfileName();if(e.json){console.log(a({name:t,isCurrent:!0}));return}console.log(`Current profile: ${t}`)}async function u(e,n){let s=o(e,n),c=i.getAll(s),l=await t.getAll(s),u=!!l?.accessToken,d=s===r.getCurrentProfileName();if(n.json){console.log(a({name:s,isCurrent:d,config:c,auth:u?{loggedIn:!0,email:l?.email??null,workspaceId:l?.workspaceId??null}:{loggedIn:!1}}));return}console.log(`Profile: ${s}${d?` (current)`:``}`),console.log(` API URL: ${c.apiUrl??`default`}`),console.log(` Hub URL: ${c.hubUrl??`default`}`),console.log(` Model: ${c.model?.default??`unset`}`);let f=c.connectors?.defaults&&c.connectors.defaults.length>0?c.connectors.defaults.join(`, `):`unset`;console.log(` Connectors: ${f}`),console.log(u?` Logged in as: ${l?.email??`unknown`}`:` Not logged in`),u&&l?.workspaceId&&console.log(` Workspace ID: ${l.workspaceId}`)}async function d(e,t){let n=e??t.profile??r.DEFAULT_PROFILE,o=t.use??!0,c={...t.apiUrl&&{apiUrl:t.apiUrl},...t.hubUrl&&{hubUrl:t.hubUrl}};r.createProfile(n),i.setAll(c,n),c.apiUrl&&s(`apiUrl`,c.apiUrl),o&&r.setCurrentProfile(n);let l={name:n,created:!0,current:o,config:c};if(t.json||(console.log(`Profile created: ${n}${o?` (current)`:``}`),c.apiUrl&&console.log(` API URL: ${c.apiUrl}`),c.hubUrl&&console.log(` Hub URL: ${c.hubUrl}`)),!t.login){t.json&&console.log(a(l));return}r.setOverrideProfile(n);let{performLogin:u,printLoginResult:d}=await import(`./login-7nuzjqqL.js`),f=await u(t);t.json?console.log(a({...l,login:f})):d(f,t)}function f(e,t){let n=o(e,t);if(r.setCurrentProfile(n),t.json){console.log(a({name:n,current:!0}));return}console.log(`Switched to profile: ${n}`)}async function p(e,n){let i=o(e,n),s=r.deleteProfile(i);if(await t.deleteProfileCredentials(i),n.json){console.log(a({deleted:i,currentProfile:s.currentProfile}));return}console.log(`Profile deleted: ${i}`),console.log(`Current profile: ${s.currentProfile}`)}async function m(e,n,i){let o=r.renameProfile(e,n);if(await t.moveProfileCredentials(e,n),i.json){console.log(a({renamed:e,name:n,currentProfile:o.currentProfile}));return}console.log(`Profile renamed: ${e} -> ${n}`),console.log(`Current profile: ${o.currentProfile}`)}async function h(e,n,o){let s=i.getAll(e);if(r.createProfile(n),i.setAll(s,n),await t.clear(n),o.json){console.log(a({source:e,name:n,cloned:!0}));return}console.log(`Profile cloned: ${e} -> ${n}`)}function g(e,t){let n=r.getEffectiveProfileName(t.profile),o=i.get(e,n);if(t.json){console.log(a({profile:n,[e]:o??null}));return}console.log(o||`Not set`)}function _(e,t,n){let a=r.getEffectiveProfileName(n.profile);i.set(e,t,a),console.log(`Set ${e}=${t}`),console.error(`(profile: ${a})`),s(e,t)}function v(e,t){let n=r.getEffectiveProfileName(t.profile);i.unset(e,n),console.log(`Unset ${e}`),console.error(`(profile: ${n})`)}export{h as cloneProfile,d as createProfile,p as deleteProfile,g as getProfileValue,c as listProfiles,m as renameProfile,_ as setProfileValue,l as showCurrentProfile,u as showProfile,v as unsetProfileValue,f as useProfile};
|