@entrydesk/cli 2.1.0-beta.2 → 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.
- package/README.md +69 -12
- package/dist/{add-DXYghmJz.js → add-4VqDcbIj.js} +9 -1
- package/dist/agents-CCOqroYN.js +10 -0
- package/dist/{billing-Bkk1BhAw.js → billing-BV5kdyQb.js} +9 -1
- package/dist/{budget-dazpYOON.js → budget-CnxbNkne.js} +9 -1
- package/dist/build-task-request-config-CjKDSNjv.js +10 -0
- package/dist/commands-DRUlUd-I.js +10 -0
- package/dist/{commands-DUKXJUfr.js → commands-gyHmiEsC.js} +9 -1
- package/dist/{config-CSJx1Xlt.js → config-CJf4r7wp.js} +9 -1
- package/dist/confirm-Ct432t3K.js +10 -0
- package/dist/connectors-C_Re7e0l.js +11 -0
- package/dist/{file-upload-BmP4AJY0.js → file-upload-D2s_clGk.js} +8 -0
- package/dist/{format-C3tQC6LL.js → format-DCvznP70.js} +8 -0
- package/dist/{hash-Ddmw8YE4.js → hash-CnSb1n2t.js} +8 -0
- package/dist/index.js +50 -15
- package/dist/{installer-iaoPJQn3.js → installer-CKB3jBE-.js} +8 -0
- package/dist/instruction-DYgn39xF.js +10 -0
- package/dist/isRecord-BNZWvqVS.js +10 -0
- package/dist/{login-ACaFCfsh.js → login-C0Zz6tHG.js} +9 -1
- package/dist/logout-DnFBlXMZ.js +10 -0
- package/dist/{marketplace-S_4fkbWt.js → marketplace-DQsEzT6T.js} +9 -1
- package/dist/{mcp-DOUHU2_Z.js → mcp-DHXuIFWP.js} +9 -1
- package/dist/{mcp-client-LcmqajIh.js → mcp-client-EK-Fh8gM.js} +9 -1
- package/dist/{meeting-BG76tnT9.js → meeting-C6H_GJB7.js} +9 -1
- package/dist/message-utils-Cq_Fel5P.js +15 -0
- package/dist/{models-CkepW_-c.js → models-DT78HZxx.js} +9 -1
- package/dist/{notifications-BAMcYXhl.js → notifications-3UrKbGaT.js} +9 -1
- package/dist/options-Dpxg1wT1.js +10 -0
- package/dist/paginate-Brd-j5V8.js +10 -0
- package/dist/{paths-DQh1PdjS.js → paths-mBL9tt9p.js} +9 -1
- package/dist/{profile-BzXbLYDw.js → profile-D4m5ZAG7.js} +9 -1
- package/dist/profile-storage-CPg61h-2.js +68 -0
- package/dist/{project-B9uLW5nn.js → project-C5_rCWCh.js} +9 -1
- package/dist/project-context-DnIuy1T0.js +10 -0
- package/dist/{project-governance-CwVlxGE2.js → project-governance-CxDZSThr.js} +9 -1
- package/dist/{project-sources-BzMkopCj.js → project-sources-D17oXXhL.js} +9 -1
- package/dist/project-sources-write-C-W8gjLg.js +10 -0
- package/dist/{project-tasks-CnXLm061.js → project-tasks-t4HFgEoZ.js} +9 -1
- package/dist/{push-DWIgzvqe.js → push-CJZLFEdk.js} +9 -1
- package/dist/{recordings-_HnTtukO.js → recordings-DeB1LqiS.js} +9 -1
- package/dist/remote-D3JMUBbh.js +10 -0
- package/dist/{remove-Cpen9pWn.js → remove-ChV-BE95.js} +9 -1
- package/dist/resolve-Czx_OkYk.js +14 -0
- package/dist/resource-grants-zAoqe73P.js +10 -0
- package/dist/{rolldown-runtime-CIdiawuB.js → rolldown-runtime-CiM6yMNq.js} +8 -0
- package/dist/{schedules-DACWrdY_.js → schedules-COBaV-Be.js} +10 -2
- package/dist/skills-OLZywcSs.js +10 -0
- package/dist/{status-BKd81bGK.js → status-CpfDbB9S.js} +9 -1
- package/dist/{status-ErhWpQxW.js → status-Oo8upbyy.js} +9 -1
- package/dist/stdin-B18x8pUF.js +10 -0
- package/dist/task-C8PttINZ.js +108 -0
- package/dist/tasks-CAmfAGsn.js +22 -0
- package/dist/tasks-dv0gJ38_.js +10 -0
- package/dist/tool-kEevHrsQ.js +17 -0
- package/dist/{update-D09UponU.js → update-Y9S-P4wG.js} +9 -1
- package/dist/{usage-Dibnsgtg.js → usage-CHIhyA8S.js} +9 -1
- package/dist/{usage-audit-Be431Kj1.js → usage-audit-C1xGe42N.js} +9 -1
- package/dist/version-Dgsb7T5N.js +10 -0
- package/dist/workflow-DWmgcRJ_.js +14 -0
- package/dist/{workspaces-rVOwf5zp.js → workspaces-3PFiXy1I.js} +9 -1
- package/package.json +11 -7
- package/dist/agents-Drg2ZD85.js +0 -2
- package/dist/build-task-request-config-BDlX-M_P.js +0 -2
- package/dist/commands-FVFeS1MV.js +0 -2
- package/dist/confirm-BrJZbaxf.js +0 -2
- package/dist/connectors-CHcopt49.js +0 -3
- package/dist/instruction-BXKEUplM.js +0 -2
- package/dist/logout-BX4YsOqw.js +0 -2
- package/dist/options-CgmngSTC.js +0 -2
- package/dist/paginate-DUu8qbek.js +0 -2
- package/dist/profile-storage-DlaupNlV.js +0 -60
- package/dist/project-context-VlX5GZxr.js +0 -2
- package/dist/project-sources-write-D3WzWqet.js +0 -2
- package/dist/remote-nEFOyIM2.js +0 -2
- package/dist/resolve-7OXPmNrX.js +0 -6
- package/dist/resource-grants-D-ImlByb.js +0 -2
- package/dist/skills-BenhDHKq.js +0 -2
- package/dist/stdin-DzzLUF6W.js +0 -2
- package/dist/task-CvQD8Y4d.js +0 -104
- package/dist/tasks-C4dAgHmR.js +0 -2
- package/dist/tasks-CnncSIan.js +0 -14
- package/dist/terminal-text-D04u1hg1.js +0 -2
- package/dist/tool-CpSoLUlR.js +0 -5
- package/dist/version-BTqAbDeB.js +0 -2
- package/dist/workflow-Dx41WM43.js +0 -6
package/dist/tasks-CnncSIan.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{b as e,l as t,o as n,u as r}from"./profile-storage-DlaupNlV.js";import{f as i,i as a,o,t as s,u as c}from"./resolve-7OXPmNrX.js";import{n as l,t as u}from"./terminal-text-D04u1hg1.js";const d=`\x1B[2m`,f=`\x1B[0m`,p=`\x1B[36m`,m=`\x1B[33m`,h=`\x1B[32m`;function g(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}\n`)}function _(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 v(e){return e.replace(/<mark>/g,`\x1B[1m`).replace(/<\/mark>/g,f).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`)}function y(e,t){if(t)return e;let n=e.split(`
|
|
3
|
-
`);if(n.length<=15)return e;let r=n.slice(0,6),i=n.slice(-4),a=n.length-10;return[...r,`… (${a} lines omitted, use --full-output to see all) …`,...i].join(`
|
|
4
|
-
`)}function b(e){if(!e||typeof e!=`object`)return e;if(Array.isArray(e))return e.map(b);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]=b(r):t[n]=r;return t}function x(e){if(!e||typeof e!=`object`)return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function S(e){return l(x(e))}function C(e,t){if(!e)return`(no result)`;if(typeof e!=`object`)return y(l(String(e)),t);let n=t?e:b(e);if(`structuredContent`in n&&n.structuredContent){let e=n.structuredContent,r=[];if(e.stdout&&typeof e.stdout==`string`&&e.stdout.trim()&&r.push(l(e.stdout.trim())),e.stderr&&typeof e.stderr==`string`&&e.stderr.trim()&&r.push(`${m}[stderr]${f} ${l(e.stderr.trim())}`),e.urls&&Array.isArray(e.urls)){let t=e.urls;for(let e of t)e.path&&e.url&&r.push(l(`${e.path}: ${e.url}`))}return r.length===0&&r.push(l(JSON.stringify(e,null,2))),y(r.join(`
|
|
5
|
-
`),t)}return`content`in n&&Array.isArray(n.content)?y(l(n.content.filter(e=>e.type===`text`&&e.text).map(e=>e.text).join(`
|
|
6
|
-
`)||JSON.stringify(e,null,2)),t):n.type===`text`&&typeof n.content==`string`?y(l(n.content),t):y(l(JSON.stringify(e,null,2)),t)}function w(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 T(e,t){let n=[];for(let r of e)if(r.type===`reasoning`&&r.text)n.push(`${d}${l(r.text)}${f}`);else if(r.type===`text`&&r.text)n.push(l(r.text));else if(r.type===`tool-call`&&r.toolName){let e=[`${p}┌─ Tool: ${u(String(r.toolName))}${f}`];if(r.args){e.push(`${m}│ Input:${f}`);let t=S(r.args);for(let n of t.split(`
|
|
7
|
-
`))e.push(`${d}│ ${n}${f}`)}if(r.result!==void 0){e.push(`${h}│ Output:${f}`);let n=C(r.result,t);for(let t of n.split(`
|
|
8
|
-
`))e.push(`${d}│ ${t}${f}`);e.push(`${p}└─ ${r.toolName} completed${f}`)}else r.state===`call`?e.push(`${p}└─ (awaiting result)${f}`):e.push(`${p}└─${f}`);n.push(e.join(`
|
|
9
|
-
`))}else if(r.type.startsWith(`tool-`)&&r.type!==`tool-call`){let e=u(w(r)),i=[`${p}┌─ Tool: ${e}${f}`];if(r.input){i.push(`${m}│ Input:${f}`);let e=S(r.input);for(let t of e.split(`
|
|
10
|
-
`))i.push(`${d}│ ${t}${f}`)}if(r.output!==void 0&&r.state===`output-available`){i.push(`${h}│ Output:${f}`);let e=C(r.output,t);for(let t of e.split(`
|
|
11
|
-
`))i.push(`${d}│ ${t}${f}`);i.push(`${p}└─ completed${f}`)}else r.state===`call`||r.state===`partial-call`?i.push(`${p}└─ (in progress)${f}`):i.push(`${p}└─${f}`);n.push(i.join(`
|
|
12
|
-
`))}return n.join(`
|
|
13
|
-
|
|
14
|
-
`).trim()}function E(){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?[`Next page: --next-key ${e}`]:[]]}}function D(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=>`${d}${e.id}${f}`,footer:e=>["Use `entrydesk tasks <taskId>` to view one of them",...e?[`Next page: --next-key ${e}`]:[]]}}async function O(l,u){let p=u.output!==void 0,h=new e;if(l&&u.project&&await c(u,new o(`project_not_applicable`,"`--project` narrows the listing and the search; drop it to view a task.")),u.share){let e;try{e=await t()}catch{}try{let t=await h.getSharedTask(u.share,e),{messages:n}=await h.getSharedMessages(u.share,50,e);if(u.json){console.log(JSON.stringify({task:t,messages:n}));return}if(p){if(g(`task`,t),n.length===0)g(`info`,`No messages in this shared task.`);else for(let e of n.toReversed())g(`message`,e);g(`done`);return}if(console.log(`Shared task: ${t.title||`Untitled`}`),console.log(`Visibility: ${t.visibility}`),t.agent&&console.log(`Agent: ${t.agent.name}`),console.log(`${n.length} messages\n`),n.length===0){console.log(`No messages in this shared task.`);return}let r=n.toReversed(),i=u.fullOutput??!1;for(let e of r){let t=T(e.parts,i);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${_(e.createdAt)}`),console.log(t),console.log(``)}return}catch(e){if(e instanceof Error){let t=e.message.toLowerCase();t.includes(`401`)||t.includes(`unauthorized`)?console.error(`Access denied. This shared task requires authentication or is not accessible to you.`):t.includes(`404`)||t.includes(`not found`)?console.error(`Shared task not found. The share ID may be invalid or the task was deleted.`):console.error(`Failed to fetch shared task: ${e.message}`)}else console.error(`Failed to fetch shared task`);process.exit(1)}}let y=u.project?await a(u.project,u.json??!1):void 0,b=e=>y?i({json:u.json??!1},e,`tasks:read`):e(),x,S;try{let e=await r();x=e.accessToken,S=e.workspaceId}catch(e){n(e)}if(l){let e=l,t=!1,n=null,r=Number.parseInt(l,10);if(!Number.isNaN(r)&&r>=0&&/^\d+$/.test(l)){let i=r===0?1:r,{tasks:a}=await h.getTasks(x,S);i>a.length&&(console.error(`Task number ${i} not found. You have ${a.length} recent tasks.`),process.exit(1));let o=a[i-1];e=o.id,t=!0,n=o,p||console.log(`Task: ${o.title||`Untitled`}\n`)}let{messages:i}=await h.getMessages(x,S,e,50);if(u.json){console.log(JSON.stringify(i));return}if(p){if(n&&g(`task`,n),i.length===0)g(`info`,`No messages in this task.`);else for(let e of i.toReversed())g(`message`,e);g(`done`);return}if(i.length===0){console.log(`No messages in this task.`);return}let a=i.toReversed(),o=u.fullOutput??!1;t||console.log(`Task: ${l.slice(0,8)}…`),console.log(`${i.length} messages\n`);for(let e of a){let t=T(e.parts,o);if(!t)continue;let n=e.role===`user`?`You`:`Assistant`;console.log(`[${n}] ${_(e.createdAt)}`),console.log(t),console.log(``)}return}let C=u.search;if(C){y&&await b(()=>s({client:h,accessToken:x,workspaceId:S},y));let{results:e,nextKey:t}=await b(()=>h.searchTasks(x,S,C,{limit:u.limit,nextKey:u.nextKey,projectId:y}));if(p){for(let t of e)g(`task`,t);g(`done`);return}if(u.json){console.log(JSON.stringify({results:e,nextKey:t}));return}if(e.length===0){console.log(`No tasks match "${u.search}".`);return}console.log(`Search results for "${u.search}" (${e.length}):\n`);for(let[t,n]of e.entries()){let e=(t+1).toString().padStart(2,` `),r=n.titleHighlight?v(n.titleHighlight):n.title||`Untitled`;console.log(` ${e}. ${d}${_(n.createdAt)}${f} ${r}`),n.contentSnippet&&console.log(` ${v(n.contentSnippet)}`),console.log(` ${d}ID: ${n.id}${f}`)}t&&console.log(`\nNext page: --next-key ${t}`);return}let w=y&&u.project?D(u.project):E(),{tasks:O,nextKey:k}=await b(()=>h.getTasks(x,S,{limit:u.limit,nextKey:u.nextKey,projectId:y}));if(p){for(let e of O)g(`task`,e);g(`done`);return}if(u.json){console.log(JSON.stringify(O));return}if(O.length===0){console.log(w.empty);return}console.log(`${w.heading(O.length)}\n`);for(let[e,t]of O.entries()){let n=t.waitingReason===`approval`?` ${m}[waiting approval]${f}`:``;console.log(` ${w.label(t,e)} ${_(t.createdAt).padEnd(12)} ${t.title||`Untitled`}${n}`)}console.log(``);for(let e of w.footer(k))console.log(e)}export{O as n,v as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
function e(e,t){return e.replace(/\u001B\][^\u001B\u0007]*(?:\u0007|\u001B\\)/gu,``).replace(/\u001B\[[0-?]*[ -/]*[@-~]/gu,``).replace(t,``)}function t(t){return e(t,/[\u0000-\u001F\u007F-\u009F]/gu)}function n(t){return e(t,/[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/gu)}export{n,t};
|
package/dist/tool-CpSoLUlR.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{i as e,s as t}from"./profile-storage-DlaupNlV.js";import{n,r}from"./mcp-client-LcmqajIh.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};
|
package/dist/version-BTqAbDeB.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import{b as e,u as t}from"./profile-storage-DlaupNlV.js";import{t as n}from"./resource-grants-D-ImlByb.js";import{n as r}from"./format-C3tQC6LL.js";import{t as i}from"./paginate-DUu8qbek.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}`)}async function p(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 m(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 h="No workflows in this workspace yet. Create one with `entrydesk workflow create --name <name> --file <path.js>`.";async function g(n){let{accessToken:r,workspaceId:a}=await t(),o=new e;if(n.all){let e=await i(async e=>{let t=await o.getWorkflows(r,a,{limit:n.limit??20,nextKey:e,search:n.search});return{items:t.workflows,nextKey:t.nextKey}});if(n.json){console.log(JSON.stringify({workflows:e}));return}if(e.length===0){console.log(h);return}l(e);return}let{workflows:s,nextKey:c}=await o.getWorkflows(r,a,{limit:n.limit,nextKey:n.nextKey,search:n.search});if(n.json){console.log(JSON.stringify({workflows:s,nextKey:c}));return}if(s.length===0){console.log(h);return}l(s),c&&console.log(`Next page: --next-key ${c}`)}async function _(n,r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().getWorkflow(i,a,n);if(r.json){console.log(JSON.stringify(o));return}u(o,!!r.showSource)}async function v(n){let{accessToken:r,workspaceId:i}=await t(),a=await new e().createWorkflow(r,i,{name:n.name,description:n.description,scriptSource:c(n.file)});if(n.json){console.log(JSON.stringify(a));return}console.log(`Created workflow: ${a.name}`),console.log(` ID: ${a.id}`)}async function y(n,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 t();if(await new e().updateWorkflow(a,o,n,i),r.json){console.log(JSON.stringify({id:n,updated:!0}));return}console.log(`Updated workflow: ${n}`)}async function b(n,r){let i=m(r),{accessToken:a,workspaceId:o}=await t(),s=new e,{runId:c}=await s.triggerWorkflowRun(a,o,n,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 ${n} ${c}`);return}let l=await p(s,a,o,n,c);r.json?console.log(JSON.stringify(l)):f(l),l.status!==`completed`&&process.exit(1)}async function x(n,r){let{accessToken:a,workspaceId:o}=await t(),s=new e;if(r.all){let e=await i(async e=>{let t=await s.getWorkflowRuns(a,o,n,{limit:r.limit??20,nextKey:e});return{items:t.runs,nextKey:t.nextKey}});if(r.json){console.log(JSON.stringify({runs:e}));return}if(e.length===0){console.log(`No runs for this workflow.`);return}d(e);return}let{runs:c,nextKey:l}=await s.getWorkflowRuns(a,o,n,{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 S(n,r,i){let{accessToken:a,workspaceId:o}=await t(),s=await new e().getWorkflowRun(a,o,n,r);if(i.json){console.log(JSON.stringify(s));return}f(s)}async function C(r,i){let{accessToken:a,workspaceId:o}=await t(),s=new e;if(i.addUser){let e=await s.upsertWorkflowGrant(a,o,r,i.addUser,i.role);if(i.json){console.log(JSON.stringify(e));return}console.log(`Granted ${i.role} to user ${i.addUser}`);return}if(i.removeUser){if(await s.removeWorkflowGrant(a,o,r,i.removeUser),i.json){console.log(JSON.stringify({userId:i.removeUser,removed:!0}));return}console.log(`Revoked access for user ${i.removeUser}`);return}let c=await s.getWorkflowGrants(a,o,r);if(i.json){console.log(JSON.stringify(c));return}n(c)}export{v as createWorkflow,x as listWorkflowRuns,g as listWorkflows,C as shareWorkflow,_ as showWorkflow,S as showWorkflowRun,b as triggerWorkflowRun,y as updateWorkflow};
|