@entrydesk/cli 2.1.0-beta.1 → 2.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +101 -28
  2. package/dist/{add-Lh_kLR85.js → add-4VqDcbIj.js} +9 -1
  3. package/dist/agents-CCOqroYN.js +10 -0
  4. package/dist/{billing-DHrYi0SU.js → billing-BV5kdyQb.js} +9 -1
  5. package/dist/{budget-D_DDPBBb.js → budget-CnxbNkne.js} +9 -1
  6. package/dist/build-task-request-config-CjKDSNjv.js +10 -0
  7. package/dist/commands-DRUlUd-I.js +10 -0
  8. package/dist/{commands-3Yqb38G_.js → commands-gyHmiEsC.js} +9 -1
  9. package/dist/{config-hGzOCx4u.js → config-CJf4r7wp.js} +9 -1
  10. package/dist/confirm-Ct432t3K.js +10 -0
  11. package/dist/connectors-C_Re7e0l.js +11 -0
  12. package/dist/{file-upload-BmP4AJY0.js → file-upload-D2s_clGk.js} +8 -0
  13. package/dist/{format-C3tQC6LL.js → format-DCvznP70.js} +8 -0
  14. package/dist/{hash-Ddmw8YE4.js → hash-CnSb1n2t.js} +8 -0
  15. package/dist/index.js +52 -16
  16. package/dist/{installer-iaoPJQn3.js → installer-CKB3jBE-.js} +8 -0
  17. package/dist/instruction-DYgn39xF.js +10 -0
  18. package/dist/isRecord-BNZWvqVS.js +10 -0
  19. package/dist/{login-CwXjzUnO.js → login-C0Zz6tHG.js} +9 -1
  20. package/dist/logout-DnFBlXMZ.js +10 -0
  21. package/dist/{marketplace-NSEUjhXf.js → marketplace-DQsEzT6T.js} +9 -1
  22. package/dist/{mcp-B7wo_sRO.js → mcp-DHXuIFWP.js} +9 -1
  23. package/dist/{mcp-client-DMOEcmul.js → mcp-client-EK-Fh8gM.js} +9 -1
  24. package/dist/{meeting-yS83In45.js → meeting-C6H_GJB7.js} +9 -1
  25. package/dist/message-utils-Cq_Fel5P.js +15 -0
  26. package/dist/{models-AN9cWKSj.js → models-DT78HZxx.js} +9 -1
  27. package/dist/{notifications-QF11-X32.js → notifications-3UrKbGaT.js} +9 -1
  28. package/dist/options-Dpxg1wT1.js +10 -0
  29. package/dist/paginate-Brd-j5V8.js +10 -0
  30. package/dist/{paths-C9BPsZVF.js → paths-mBL9tt9p.js} +9 -1
  31. package/dist/{profile-WtKtO0yp.js → profile-D4m5ZAG7.js} +9 -1
  32. package/dist/profile-storage-CPg61h-2.js +68 -0
  33. package/dist/project-C5_rCWCh.js +10 -0
  34. package/dist/project-context-DnIuy1T0.js +10 -0
  35. package/dist/{project-governance-C7rl6gDW.js → project-governance-CxDZSThr.js} +9 -1
  36. package/dist/{project-sources-CzylP6oS.js → project-sources-D17oXXhL.js} +9 -1
  37. package/dist/project-sources-write-C-W8gjLg.js +10 -0
  38. package/dist/{project-tasks-DaGBt4Cp.js → project-tasks-t4HFgEoZ.js} +9 -1
  39. package/dist/{push-Ce79oiu0.js → push-CJZLFEdk.js} +9 -1
  40. package/dist/{recordings-DoExjM1F.js → recordings-DeB1LqiS.js} +9 -1
  41. package/dist/remote-D3JMUBbh.js +10 -0
  42. package/dist/{remove-bHAmCTdf.js → remove-ChV-BE95.js} +9 -1
  43. package/dist/resolve-Czx_OkYk.js +14 -0
  44. package/dist/resource-grants-zAoqe73P.js +10 -0
  45. package/dist/{rolldown-runtime-CIdiawuB.js → rolldown-runtime-CiM6yMNq.js} +8 -0
  46. package/dist/{schedules-tDaIGaad.js → schedules-COBaV-Be.js} +10 -2
  47. package/dist/skills-OLZywcSs.js +10 -0
  48. package/dist/{status-CDMSNVD8.js → status-CpfDbB9S.js} +9 -1
  49. package/dist/{status-gK3MA1oe.js → status-Oo8upbyy.js} +9 -1
  50. package/dist/stdin-B18x8pUF.js +10 -0
  51. package/dist/task-C8PttINZ.js +108 -0
  52. package/dist/tasks-CAmfAGsn.js +22 -0
  53. package/dist/tasks-dv0gJ38_.js +10 -0
  54. package/dist/tool-kEevHrsQ.js +17 -0
  55. package/dist/{update-CJlVgq8V.js → update-Y9S-P4wG.js} +9 -1
  56. package/dist/{usage-DOI9sowA.js → usage-CHIhyA8S.js} +9 -1
  57. package/dist/{usage-audit-1GZx4VBG.js → usage-audit-C1xGe42N.js} +9 -1
  58. package/dist/version-Dgsb7T5N.js +10 -0
  59. package/dist/workflow-DWmgcRJ_.js +14 -0
  60. package/dist/{workspaces-D0VOrP2A.js → workspaces-3PFiXy1I.js} +9 -1
  61. package/package.json +11 -7
  62. package/dist/agents-CLcXSbBp.js +0 -2
  63. package/dist/build-task-request-config-Y9X2h9Ia.js +0 -2
  64. package/dist/commands-CdnyYMrx.js +0 -2
  65. package/dist/confirm-BrJZbaxf.js +0 -2
  66. package/dist/connectors-CxzG22No.js +0 -3
  67. package/dist/instruction-CRCyBKQf.js +0 -2
  68. package/dist/logout-BYCFpaxh.js +0 -2
  69. package/dist/options-D6fCp3Q_.js +0 -2
  70. package/dist/paginate-CfIrho1f.js +0 -2
  71. package/dist/profile-storage-Dv0xRb8J.js +0 -58
  72. package/dist/project-BhPYRsaZ.js +0 -2
  73. package/dist/project-context-Cc_Js6n4.js +0 -2
  74. package/dist/project-sources-write-6cBfdUfV.js +0 -2
  75. package/dist/remote-nEFOyIM2.js +0 -2
  76. package/dist/resolve-f238uD6C.js +0 -6
  77. package/dist/skills-CDd-emMc.js +0 -2
  78. package/dist/stdin-DzzLUF6W.js +0 -2
  79. package/dist/task-CHnFR-Zp.js +0 -103
  80. package/dist/tasks-D4RIFT8Y.js +0 -14
  81. package/dist/tasks-acCatE6n.js +0 -2
  82. package/dist/tool-BEivzspP.js +0 -5
  83. package/dist/version-C37EX5li.js +0 -2
  84. package/dist/workflow-DhomAltH.js +0 -6
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{n as e}from"./tasks-D4RIFT8Y.js";export{e as runTasks};
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import{i as e,s as t}from"./profile-storage-Dv0xRb8J.js";import{n,r}from"./mcp-client-DMOEcmul.js";import i from"node:fs";import a from"node:os";import o from"node:path";import s from"node:fs/promises";const c=!process.env.NO_COLOR&&process.stdout.isTTY,l={green:c?`\x1B[32m`:``,yellow:c?`\x1B[33m`:``,reset:c?`\x1B[0m`:``},u=8*1024;function d(){return o.join(a.homedir(),`.entrydesk`,`tool-results`)}function f(e){let t=e.trim().replace(/[/\\:*?"<>|\s]/g,`_`).replace(/_+/g,`_`).replace(/^[._]+|[._]+$/g,``).slice(0,100);return!t||t===`.`||t===`..`?`unnamed_tool`:t}function p(e){try{return JSON.stringify(e,(e,t)=>typeof t==`bigint`?`${t}n`:typeof t==`function`?`[Function]`:typeof t==`symbol`?t.toString():t,2)}catch{return String(e)}}function m(e){let t=new Date;return`${[t.getFullYear(),String(t.getMonth()+1).padStart(2,`0`),String(t.getDate()).padStart(2,`0`)].join(`-`)+`_`+[String(t.getHours()).padStart(2,`0`),String(t.getMinutes()).padStart(2,`0`),String(t.getSeconds()).padStart(2,`0`)].join(`-`)}_${f(e)}.json`}async function h(e,t){try{return await s.writeFile(e,t,{encoding:`utf8`,flag:`wx`}),!0}catch(e){if(e instanceof Error&&`code`in e&&e.code===`EEXIST`)return!1;throw e}}async function g(e,t){try{let n=d();await s.mkdir(n,{recursive:!0});let r=m(e),i=o.extname(r),a=r.slice(0,-i.length),c=p(t),l=o.join(n,r);if(await h(l,c))return l;for(let e=1;e<=100;e++){let t=o.join(n,`${a}-${e}${i}`);if(await h(t,c))return t}let u=Math.random().toString(36).slice(2,10),f=o.join(n,`${a}-${u}${i}`);return await s.writeFile(f,c,{encoding:`utf8`,flag:`wx`}),f}catch(e){let t=e instanceof Error?e.message:`unknown error`;return console.error(`${l.yellow}Warning: Could not save result to file: ${t}${l.reset}`),null}}function _(e,t){let n=Buffer.byteLength(e,`utf8`);if(n<=10240)return e;let r=e.slice(0,u),i=e.slice(-2048),a=` … (skipped ${((n-u-2048)/1024).toFixed(1)}KB of ${(n/1024).toFixed(1)}KB) …`;return t&&(a+=`
3
- Tip: jq -r '.structuredContent.field' <file> | grep/head/tail`),`${r}\n\n${a}\n\n${i}`}function v(e){console.log(`${l.green}Tool execution result saved to: ${e}${l.reset}`),console.log()}function y(){console.log(`${l.green}Tool execution result:${l.reset}`)}function b(e){return e.split(`__`)[0]??e}function x(e,t,n){console.error(n?JSON.stringify({error:{code:e,message:t}}):`Error [${e}]: ${t}`),process.exit(1)}function S(n,r,i=`CONNECTION_FAILED`){t(n)&&x(i,e(),r);let a=n instanceof Error?n.message:`Unknown error`;a.includes(`Not logged in`)||a.includes(`not-logged-in`)?x(`AUTH_MISSING`,a,r):x(i,a,r)}async function C(){return process.stdin.isTTY?null:new Promise(e=>{let t=[],n=!1,r=!1,i,a,o,s,c=()=>{clearTimeout(i),process.stdin.removeListener(`data`,a),process.stdin.removeListener(`end`,o),process.stdin.removeListener(`error`,s)},l=t=>{r||(r=!0,c(),e(t))};a=e=>{n=!0,clearTimeout(i),t.push(e)},o=()=>{t.length===0?l(null):l(Buffer.concat(t).toString(`utf-8`).trim())},s=()=>{l(null)},i=setTimeout(()=>{n||l(null)},100),process.stdin.on(`data`,a),process.stdin.on(`end`,o),process.stdin.on(`error`,s),process.stdin.resume()})}var w=class extends Error{constructor(e){super(e),this.name=`InputError`}};async function T(e,t){if(e)return e;if(t)try{return i.readFileSync(t,`utf-8`).trim()}catch(e){throw new w(`Failed to read input file: ${e instanceof Error?e.message:`Failed to read input file`}`)}let n=await C();if(n)return n;throw new w(`Input JSON is required. Use --input, --input-file, or pipe it via stdin.`)}function E(e){let t=[`Tool: ${e.name}`];return e.description&&t.push(` Description: ${e.description}`),t.join(`
4
- `)}function D(e){let t=[`Tool: ${e.name}`];return e.description&&(t.push(`Description:`),t.push(` ${e.description}`)),t.push(`Input Schema:`),t.push(JSON.stringify(e.inputSchema,null,2)),t.join(`
5
- `)}async function O(e){let t=e.json??!1,i=await n().catch(e=>{S(e,t)});try{let n=(await i.listTools({},r())).tools;if(e.prefix){let t=e.prefix.toLowerCase();n=n.filter(e=>b(e.name).toLowerCase().startsWith(t))}if(t)console.log(JSON.stringify(n,null,2));else{let t=e.prefix?` (prefix: ${e.prefix})`:``;console.log(`Available tools (${n.length})${t}:\n`);for(let e of n)console.log(E(e)),console.log()}}catch(e){S(e,t)}finally{await i.close().catch(()=>{})}}async function k(e,t){let i=t.json??!1,a=await n().catch(e=>{S(e,i)});try{let t=(await a.listTools({},r())).tools.find(t=>t.name===e);t||x(`TOOL_NOT_FOUND`,`Tool not found: ${e}`,i),console.log(i?JSON.stringify(t,null,2):D(t))}catch(e){S(e,i)}finally{await a.close().catch(()=>{})}}async function A(e,t,i){let a;try{a=JSON.parse(t)}catch(e){x(`INVALID_INPUT`,e instanceof Error?`Invalid JSON input: ${e.message}`:`Invalid JSON input`,i)}let o=await n().catch(e=>{S(e,i,`TOOL_CALL_FAILED`)}),s=!1;try{let t=await o.callTool({name:e,arguments:a},r());if(i)console.log(JSON.stringify(t,null,2));else{let n=await g(e,t);n&&v(n),y();for(let e of t.content)e.type===`text`?console.log(e.text):e.type===`image`?console.log(`[Image: ${e.mimeType}]`):e.type===`resource`?console.log(`[Resource: ${e.resource.uri}]`):console.log(JSON.stringify(e,null,2));if(t.structuredContent){let e=_(JSON.stringify(t.structuredContent,null,2),n);console.log(e)}}t.isError&&(s=!0)}catch(e){S(e,i,`TOOL_CALL_FAILED`)}finally{await o.close().catch(()=>{})}s&&process.exit(1)}async function j(e,t){let n=t.json??!1,r;try{r=await T(t.input,t.inputFile)}catch(e){throw e instanceof w&&x(`INVALID_INPUT`,e.message,n),e}await A(e,r,n)}export{k as getTool,O as listTools,j as runToolCall};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- function e(){return`2.1.0-beta.1`}export{e as t};
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import{F as e,b as t,u as n}from"./profile-storage-Dv0xRb8J.js";import{n as r}from"./format-C3tQC6LL.js";import{t as i}from"./paginate-CfIrho1f.js";import{readFileSync as a}from"node:fs";const o=262144,s=new Set([`completed`,`failed`,`cancelled`]);function c(e){let t;try{t=a(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`)>o&&(console.error(`Script file exceeds ${o} bytes.`),process.exit(1)),t}function l(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 u(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: ${r(e.updatedAt)}`);let n=e.scriptSource.split(`
3
- `).length;t?(console.log(`\n Script (${n} lines):\n`),console.log(e.scriptSource)):console.log(` Script: ${n} lines (use --show-source to print)`)}function d(e){console.log(`Runs (${e.length}):\n`);for(let t of e){let e=r(t.startedAt??t.createdAt);console.log(` ${t.status}${e?` · ${e}`:``}`),console.log(` ID: ${t.id}`)}}function f(e){console.log(`Run ${e.id}`),console.log(` Workflow: ${e.workflowId}`),console.log(` Status: ${e.status}`),e.startedAt&&console.log(` Started: ${r(e.startedAt)}`),e.completedAt&&console.log(` Completed: ${r(e.completedAt)}`),e.error!=null&&console.log(` Error: ${JSON.stringify(e.error)}`);let t=Object.entries(e.context?.nodes??{});if(t.length>0){console.log(`\n Nodes (${t.length}):`);for(let[e,n]of t){let t=[n.kind??`node`,n.status];n.durationMs!=null&&t.push(`${n.durationMs}ms`),console.log(` - ${n.label??e} [${t.join(` · `)}]`)}}let n=e.context?.logs??[];if(n.length>0){console.log(`
4
- Logs:`);for(let e of n)console.log(` ${e}`)}e.context?.spent!=null&&console.log(`\n Tokens spent: ${e.context.spent}`)}function p(t){let n=e(t);if(console.log(`User grants (${n.length}):`),n.length===0){console.log(` (none)`);return}for(let e of n)console.log(` - ${e.user.name} <${e.user.email}> · ${e.role}`),console.log(` ID: ${e.userId}`)}async function m(e,t,n,r,i){for(let a=0;a<600;a++){let o=await e.getWorkflowRun(t,n,r,i);if(s.has(o.status))return a>0&&process.stderr.write(`
5
- `),o;let c=a*2;process.stderr.write(`\rWaiting… ${o.status} (${c}s)`),await new Promise(e=>setTimeout(e,2e3))}throw process.stderr.write(`
6
- `),Error(`Run ${i} did not finish within the wait window.`)}function h(e){let t;if(e.argsFile===void 0)t=e.args;else try{t=a(e.argsFile,`utf8`)}catch{console.error(`Cannot read args file: ${e.argsFile}`),process.exit(1)}if(t!==void 0)try{return JSON.parse(t)}catch{console.error(`--args/--args-file must be valid JSON.`),process.exit(1)}}const g="No workflows in this workspace yet. Create one with `entrydesk workflow create --name <name> --file <path.js>`.";async function _(e){let{accessToken:r,workspaceId:a}=await n(),o=new t;if(e.all){let t=await i(async t=>{let n=await o.getWorkflows(r,a,{limit:e.limit??20,nextKey:t,search:e.search});return{items:n.workflows,nextKey:n.nextKey}});if(e.json){console.log(JSON.stringify({workflows:t}));return}if(t.length===0){console.log(g);return}l(t);return}let{workflows:s,nextKey:c}=await o.getWorkflows(r,a,{limit:e.limit,nextKey:e.nextKey,search:e.search});if(e.json){console.log(JSON.stringify({workflows:s,nextKey:c}));return}if(s.length===0){console.log(g);return}l(s),c&&console.log(`Next page: --next-key ${c}`)}async function v(e,r){let{accessToken:i,workspaceId:a}=await n(),o=await new t().getWorkflow(i,a,e);if(r.json){console.log(JSON.stringify(o));return}u(o,!!r.showSource)}async function y(e){let{accessToken:r,workspaceId:i}=await n(),a=await new t().createWorkflow(r,i,{name:e.name,description:e.description,scriptSource:c(e.file)});if(e.json){console.log(JSON.stringify(a));return}console.log(`Created workflow: ${a.name}`),console.log(` ID: ${a.id}`)}async function b(e,r){let i={};r.name!==void 0&&(i.name=r.name),r.description!==void 0&&(i.description=r.description),r.file!==void 0&&(i.scriptSource=c(r.file)),r.activate&&(i.isActive=!0),r.deactivate&&(i.isActive=!1),Object.keys(i).length===0&&(console.error(`No fields provided to update.`),process.exit(1));let{accessToken:a,workspaceId:o}=await n();if(await new t().updateWorkflow(a,o,e,i),r.json){console.log(JSON.stringify({id:e,updated:!0}));return}console.log(`Updated workflow: ${e}`)}async function x(e,r){let i=h(r),{accessToken:a,workspaceId:o}=await n(),s=new t,{runId:c}=await s.triggerWorkflowRun(a,o,e,i);if(!r.wait){if(r.json){console.log(JSON.stringify({runId:c}));return}console.log(`Started run: ${c}`),console.log(` Check: entrydesk workflow run-get ${e} ${c}`);return}let l=await m(s,a,o,e,c);r.json?console.log(JSON.stringify(l)):f(l),l.status!==`completed`&&process.exit(1)}async function S(e,r){let{accessToken:a,workspaceId:o}=await n(),s=new t;if(r.all){let t=await i(async t=>{let n=await s.getWorkflowRuns(a,o,e,{limit:r.limit??20,nextKey:t});return{items:n.runs,nextKey:n.nextKey}});if(r.json){console.log(JSON.stringify({runs:t}));return}if(t.length===0){console.log(`No runs for this workflow.`);return}d(t);return}let{runs:c,nextKey:l}=await s.getWorkflowRuns(a,o,e,{limit:r.limit,nextKey:r.nextKey});if(r.json){console.log(JSON.stringify({runs:c,nextKey:l}));return}if(c.length===0){console.log(`No runs for this workflow.`);return}d(c),l&&console.log(`Next page: --next-key ${l}`)}async function C(e,r,i){let{accessToken:a,workspaceId:o}=await n(),s=await new t().getWorkflowRun(a,o,e,r);if(i.json){console.log(JSON.stringify(s));return}f(s)}async function w(e,r){let{accessToken:i,workspaceId:a}=await n(),o=new t;if(r.addUser){let t=await o.upsertWorkflowGrant(i,a,e,r.addUser,r.role);if(r.json){console.log(JSON.stringify(t));return}console.log(`Granted ${r.role} to user ${r.addUser}`);return}if(r.removeUser){if(await o.removeWorkflowGrant(i,a,e,r.removeUser),r.json){console.log(JSON.stringify({userId:r.removeUser,removed:!0}));return}console.log(`Revoked access for user ${r.removeUser}`);return}let s=await o.getWorkflowGrants(i,a,e);if(r.json){console.log(JSON.stringify(s));return}p(s)}export{y as createWorkflow,S as listWorkflowRuns,_ as listWorkflows,w as shareWorkflow,v as showWorkflow,C as showWorkflowRun,x as triggerWorkflowRun,b as updateWorkflow};