@entrydesk/cli 2.0.0 → 2.1.0-beta.1

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 (78) hide show
  1. package/README.md +279 -0
  2. package/dist/add-Lh_kLR85.js +2 -0
  3. package/dist/agents-CLcXSbBp.js +2 -0
  4. package/dist/billing-DHrYi0SU.js +2 -0
  5. package/dist/{budget-DcULs51p.js → budget-D_DDPBBb.js} +1 -1
  6. package/dist/build-task-request-config-Y9X2h9Ia.js +2 -0
  7. package/dist/commands-3Yqb38G_.js +2 -0
  8. package/dist/commands-CdnyYMrx.js +2 -0
  9. package/dist/{config-CI3k8CUK.js → config-hGzOCx4u.js} +2 -2
  10. package/dist/connectors-CxzG22No.js +3 -0
  11. package/dist/file-upload-BmP4AJY0.js +16 -0
  12. package/dist/format-C3tQC6LL.js +2 -0
  13. package/dist/index.js +83 -10
  14. package/dist/instruction-CRCyBKQf.js +2 -0
  15. package/dist/{login-y8SlHgZ4.js → login-CwXjzUnO.js} +1 -1
  16. package/dist/{logout-CGGEe0it.js → logout-BYCFpaxh.js} +1 -1
  17. package/dist/{marketplace-CaIuJP0T.js → marketplace-NSEUjhXf.js} +1 -1
  18. package/dist/{mcp-Yz1qXxIb.js → mcp-B7wo_sRO.js} +2 -2
  19. package/dist/mcp-client-DMOEcmul.js +2 -0
  20. package/dist/meeting-yS83In45.js +3 -0
  21. package/dist/models-AN9cWKSj.js +3 -0
  22. package/dist/notifications-QF11-X32.js +2 -0
  23. package/dist/options-D6fCp3Q_.js +2 -0
  24. package/dist/paginate-CfIrho1f.js +2 -0
  25. package/dist/paths-C9BPsZVF.js +2 -0
  26. package/dist/{profile-1uJ5EHdo.js → profile-WtKtO0yp.js} +1 -1
  27. package/dist/profile-storage-Dv0xRb8J.js +58 -0
  28. package/dist/project-BhPYRsaZ.js +2 -0
  29. package/dist/project-context-Cc_Js6n4.js +2 -0
  30. package/dist/project-governance-C7rl6gDW.js +2 -0
  31. package/dist/project-sources-CzylP6oS.js +2 -0
  32. package/dist/project-sources-write-6cBfdUfV.js +2 -0
  33. package/dist/project-tasks-DaGBt4Cp.js +2 -0
  34. package/dist/push-Ce79oiu0.js +2 -0
  35. package/dist/{recordings-C0Ij3tfP.js → recordings-DoExjM1F.js} +1 -1
  36. package/dist/remove-bHAmCTdf.js +2 -0
  37. package/dist/resolve-f238uD6C.js +6 -0
  38. package/dist/schedules-tDaIGaad.js +21 -0
  39. package/dist/{skills-16msznfK.js → skills-CDd-emMc.js} +1 -1
  40. package/dist/status-CDMSNVD8.js +2 -0
  41. package/dist/{status-D6ebFbsw.js → status-gK3MA1oe.js} +1 -1
  42. package/dist/stdin-DzzLUF6W.js +2 -0
  43. package/dist/task-CHnFR-Zp.js +103 -0
  44. package/dist/tasks-D4RIFT8Y.js +14 -0
  45. package/dist/tasks-acCatE6n.js +2 -0
  46. package/dist/{tool-3NEPlGNR.js → tool-BEivzspP.js} +1 -1
  47. package/dist/update-CJlVgq8V.js +2 -0
  48. package/dist/usage-DOI9sowA.js +3 -0
  49. package/dist/{usage-audit-e6kpW0LZ.js → usage-audit-1GZx4VBG.js} +3 -3
  50. package/dist/version-C37EX5li.js +2 -0
  51. package/dist/workflow-DhomAltH.js +6 -0
  52. package/dist/{workspaces-BQiFZ5pV.js → workspaces-D0VOrP2A.js} +1 -1
  53. package/package.json +8 -4
  54. package/dist/add-CDlJBikf.js +0 -2
  55. package/dist/agents-vivPBsWo.js +0 -2
  56. package/dist/billing-BietwbvI.js +0 -2
  57. package/dist/build-task-request-config-Bbffa_rv.js +0 -2
  58. package/dist/commands-BCLJEd6x.js +0 -2
  59. package/dist/commands-CpuinJar.js +0 -2
  60. package/dist/connectors-CbkKDKQQ.js +0 -3
  61. package/dist/custom-connector-CxGNx65S.js +0 -2
  62. package/dist/format-BNEUX5Xv.js +0 -2
  63. package/dist/mcp-client-DdryEToX.js +0 -2
  64. package/dist/meeting-CWv3iUU6.js +0 -3
  65. package/dist/models-DFEIoTPH.js +0 -2
  66. package/dist/notifications-CBLIBZtc.js +0 -2
  67. package/dist/paths-Cqjaa_lJ.js +0 -2
  68. package/dist/profile-storage-DYUIMuP0.js +0 -72
  69. package/dist/push-BBY3QXxO.js +0 -2
  70. package/dist/remove-D-UQJ0IM.js +0 -2
  71. package/dist/schedules-CFjtG3p4.js +0 -21
  72. package/dist/status-kRSNf0Ap.js +0 -2
  73. package/dist/task-DKK82ixE.js +0 -115
  74. package/dist/tasks-DX7CQir8.js +0 -14
  75. package/dist/update-DhNwkiwD.js +0 -2
  76. package/dist/usage-050zvE6Q.js +0 -3
  77. package/dist/version-orM51hu_.js +0 -2
  78. package/dist/workflow-DHTrGTRn.js +0 -6
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,St as t,T as n}from"./profile-storage-Dv0xRb8J.js";import{t as r}from"./paginate-CfIrho1f.js";import{T as i,a,d as o,n as s,o as c,r as l,v as u,x as d,y as f}from"./resolve-f238uD6C.js";import{t as p}from"./stdin-DzzLUF6W.js";import{n as m,t as h}from"./instruction-CRCyBKQf.js";async function g(e){let t={};if(e.name!==void 0&&(t.name=e.name),e.description!==void 0&&(t.description=e.description),e.clearInstruction)t.instruction=null;else{let n=await m(e);n!==void 0&&(t.instruction=n)}if(Object.keys(t).length===0)throw new c(`no_fields_to_update`,`No fields provided to update. Pass --name, --description, --instruction, --instruction-file, or --clear-instruction.`);return t}function _(e){return!e.all&&e.nextKey===void 0&&(e.filter??`all`)===`all`&&(e.limit??20)<=20}const v=`You are not a member of any project yet. Create one in the Hub, or ask a project owner to add you.`;async function y(e){await o(e,async t=>{if(e.all){let n=await r(async n=>{let r=await s(t,{limit:e.limit??100,filter:e.filter,nextKey:n});return{items:r.projects,nextKey:r.nextKey}});if(e.json){f({projects:n});return}if(n.length===0){console.log(v);return}d(n,{numbered:!1});return}let{projects:n,nextKey:i}=await s(t,{limit:e.limit,nextKey:e.nextKey,filter:e.filter});if(e.json){f({projects:n,nextKey:i});return}if(n.length===0){console.log(v);return}d(n,{numbered:_(e)}),i&&console.log(`Next page: --next-key ${i}`)})}async function b(e,t){await o(t,async n=>{let r=await l(n,e);if(t.json){f(r);return}u(r)})}async function x(e,t){await o(t,async n=>{let r=await l(n,e);if(t.json){f({id:r.id,instruction:r.instruction});return}r.instruction&&process.stdout.write(i(r.instruction))})}async function S(e,t){await o(t,async r=>{let i=await g(t),o=await a(r,e),s=await r.client.updateProject(r.accessToken,r.workspaceId,o,i);if(t.json){f(s);return}console.log(`Updated project: ${n(s.name)}`),console.log(` ID: ${s.id}`)})}const C=`A work note needs content. Pass -m <text>, -f <file>, or pipe the text in.`;async function w(e){if(e.message!==void 0)return e.message;if(e.file!==void 0)return h(e.file,`note`);if(process.stdin.isTTY)throw new c(`note_content_missing`,C);return p()}async function T(e){let n=await w(e),r=n.trim();if(r.length===0)throw new c(`note_content_missing`,C);if(r.length>1e5)throw new c(`note_content_too_long`,`The note is too long: the maximum is ${t} characters.`);return{content:n,...e.title!==void 0&&{title:e.title}}}async function E(t,n){await o(n,async r=>{let i=await T(n),o=await a(r,t),s=await r.client.createProjectNote(r.accessToken,r.workspaceId,o,i),c=e(`/${r.workspaceId}/task/${s.taskId}`);if(n.json){f({...s,url:c});return}console.log(`Reported a work note. It is a private task under your name, and no AI reply was triggered.`),console.log(` Task ID: ${s.taskId}`),console.log(` Hub: ${c}`)})}export{S as editProject,y as listProjects,E as reportProjectNote,b as showProject,x as showProjectInstruction};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{Ct as e,T as t}from"./profile-storage-Dv0xRb8J.js";import{T as n,a as r,b as i,f as a,g as o,o as s,u as c,y as l}from"./resolve-f238uD6C.js";const u=e.options.join(`, `),d=`tasks:read`;function f(e,t){return a(t,t=>r(t,e))}function p(n){return e.safeParse(n).success?null:n===`asset`||n===`assets`?new s(`asset_not_on_context_surface`,`Assets are not part of the CLI context surface — open them in the Hub. Pass one of: ${u}.`):new s(`invalid_context_source_type`,`"${t(n)}" is not a context source type. Pass one of: ${u}.`)}function m(e,t){return new s(`invalid_argument`,`${e} ${t}.`)}function h(e,t,n,r){if(!/^[+-]?\d+$/u.test(t.trim()))return m(e,`must be an integer`);let i=Number.parseInt(t,10);return i<n||i>r?m(e,`must be between ${n} and ${r}`):null}async function g(e,t,n,r,i){if(t===void 0)return;let a=h(e,t,n,r);return a&&await c(i,a),Number.parseInt(t,10)}async function _(e,t){let n=e.trim();return n.length===0&&await c(t,m(`<query>`,`must not be empty`)),n.length>200&&await c(t,m(`<query>`,`must be at most 200 characters`)),n}async function v(e,t){let n=p(e);return n&&await c(t,n),e}async function y(e,n,r){let i=await _(n,r),s=r.type?await v(r.type,r):void 0,c=await g(`--limit`,r.limit,1,20,r),u=await f(e,r);await a(r,async e=>{let{results:n}=await e.client.searchProjectContext(e.accessToken,e.workspaceId,u,{q:i,...s&&{type:s},...c!==void 0&&{limit:c}});if(r.json){l({results:n});return}if(n.length===0){console.log(`Nothing matched ${t(i)}.`);return}o(n)},d)}function b(e){return e.nextOffset===void 0?`Output was truncated at this source's text limit.`:`Output was truncated. Read on with --offset ${e.nextOffset}.`}function x(e,t){if(t.json){l(e);return}process.stdout.write(n(e.content)),e.truncated&&console.error(b(e))}function S(e){let n=t(e.title);return e.status===`download`?`"${n}" holds no text to read. Download it instead — the link is short-lived and tied to you: ${t(e.downloadUrl)}`:e.status===`pending`?`"${n}" is still being fetched. Try again once its snapshot is ready.`:`"${n}" could not be fetched: ${t(e.error)}`}function C(e,t){t.json?i(e):console.error(`Error: ${S(e)}`),process.exit(1)}async function w(e,t,n,r){let i=await v(t,r),o=await g(`--offset`,r.offset,0,2**53-1,r),s=await f(e,r),c=await a(r,async e=>e.client.readProjectContext(e.accessToken,e.workspaceId,s,{sourceType:i,sourceId:n},{depth:r.full||o!==void 0?`full`:`summary`,...o!==void 0&&{offset:o}}),d);if(c.status===`text`){x(c,r);return}C(c,r)}export{w as readProjectContext,y as searchProjectContext};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{O as e,T as t,_t as n,bt as r}from"./profile-storage-Dv0xRb8J.js";import{t as i}from"./confirm-BrJZbaxf.js";import{S as a,_ as o,a as s,d as c,l,o as u,p as d,r as f,y as p}from"./resolve-f238uD6C.js";import{n as m}from"./instruction-CRCyBKQf.js";import{validate as h}from"uuid";function g(e,t){return new u(`project_field_too_long`,`${e} is too long: the maximum is ${t} characters.`)}async function _(e){let t=e.name?.trim()??``;if(t.length===0)throw new u(`project_name_missing`,`A project needs a name. Pass --name <text>.`);if(t.length>255)throw g(`Name`,255);if(e.description!==void 0&&e.description.length>2e3)throw g(`Description`,n);if(e.instruction!==void 0&&e.instructionFile!==void 0)throw new u(`conflicting_options`,`Pass either --instruction or --instruction-file, not both.`);let r=await m(e);return{name:t,...e.description!==void 0&&{description:e.description},...r!==void 0&&{instruction:r}}}async function v(n){await c(n,async r=>{let i=await _(n),a=await r.client.createProject(r.accessToken,r.workspaceId,i),o=e(`/${r.workspaceId}/projects/${a.id}`);if(n.json){p({...a,url:o});return}console.log(`Created project: ${t(a.name)}`),console.log(` ID: ${a.id}`),console.log(` Hub: ${o}`)})}function y(e){if(!e.yes&&!process.stdin.isTTY)throw new u(`confirmation_required`,`Deleting a project needs confirmation. Re-run with --yes.`)}async function b(e,t){let n=await e.client.getProject(e.accessToken,e.workspaceId,t);if(n.role!==`owner`)throw l();return o(n),i(`Delete this project?`)}async function x(e,t){await c(t,async n=>{y(t);let r=await s(n,e);if(!t.yes&&!await b(n,r)){console.log(`Aborted.`);return}if(await n.client.deleteProject(n.accessToken,n.workspaceId,r),t.json){p({id:r,deleted:!0});return}console.log(`Deleted project ${r}.`)})}async function S(e,t){await c(t,async n=>{let r=await f(n,e);if(t.json){p({projectId:r.id,members:r.members});return}a(r)})}function C(e){if(!h(e))throw new u(`invalid_user_id`,"A user id is a UUID. `entrydesk project members <project>` prints the id beside each member.")}async function w(e,t,n){await c(n,async r=>{C(t);let i=await s(r,e),a=await r.client.addProjectMember(r.accessToken,r.workspaceId,i,t);if(n.json){p({projectId:i,...a});return}console.log(`Added ${d(a)}.`),console.log(` User ID: ${a.userId}`)})}async function T(e,t,n){await c(n,async r=>{C(t);let i=await s(r,e);if(await r.client.removeProjectMember(r.accessToken,r.workspaceId,i,t),n.json){p({projectId:i,userId:t,removed:!0});return}console.log(`Removed ${t} from project ${i}.`)})}function E(e){let t=r.safeParse(e);if(!t.success)throw new u(`invalid_role`,`Pass --role owner or --role member.`);return t.data}async function D(e,t,n){await c(n,async r=>{C(t);let i=E(n.role),a=await s(r,e);if(await r.client.updateProjectMemberRole(r.accessToken,r.workspaceId,a,t,{role:i}),n.json){p({projectId:a,userId:t,role:i});return}console.log(`${t} is now ${i} of project ${a}.`)})}export{w as addProjectMember,v as createProject,x as deleteProject,S as listProjectMembers,T as removeProjectMember,D as setProjectMemberRole};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import"./profile-storage-Dv0xRb8J.js";import{a as e,d as t,h as n,m as r,w as i,y as a}from"./resolve-f238uD6C.js";function o(e,t){return e.length>=200||t.length>=200}async function s(s,c){await t(c,async t=>{let l=await e(t,s),[{files:u},{links:d}]=await Promise.all([t.client.listProjectFiles(t.accessToken,t.workspaceId,l),t.client.listProjectLinks(t.accessToken,t.workspaceId,l)]),f=[...u.map(r),...d.map(n)],p=o(u,d);if(c.json){a({sources:f,truncated:p});return}if(f.length===0){console.log(`This project has no sources yet. Add the files and links you want every task in it to draw on.`);return}i(f),p&&console.error(`This listing stops at 200 files and 200 links, which it reached — the project may hold more. See them all in the Hub.`)})}export{s as listProjectSources};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{Mt as e,T as t,a as n,wt as r}from"./profile-storage-Dv0xRb8J.js";import{C as i,a,d as o,h as s,m as c,o as l,s as u,u as d,y as f}from"./resolve-f238uD6C.js";import{n as p,t as m}from"./file-upload-BmP4AJY0.js";const h=[`file`,`link`],g=h.join(`, `),_=/^https?:\/\//iu;function v(e){return h.some(t=>t===e)}function y(e){return e===`asset`||e===`assets`?new l(`asset_not_a_source`,`Assets are managed in the Hub, not through \`sources-*\`. Pass one of: ${g}.`):new l(`invalid_source_type`,`"${t(e)}" is not a source type. Pass one of: ${g}.`)}async function b(e,t){return v(e)?e:d(t,y(e))}async function x(e){if(e.description===void 0)return;let t=r.safeParse({description:e.description});return t.success?t.data.description:d(e,new l(`description_too_long`,`--description ${t.error.issues[0]?.message??`is invalid`}.`))}async function S(n,r){let i=e.safeParse(n);return i.success?i.data:d(r,new l(`invalid_link_url`,`${t(n)} is not a link the project can fetch: ${i.error.issues[0]?.message??`invalid URL`}. Pass a public http(s) URL.`))}function C(e){let n=t(e.filePath);switch(e.problem){case`missing`:return new l(`local_file_not_found`,`No file at ${n}. Pass the path of a local file, or an http(s):// URL to add a link.`);case`not_a_file`:return new l(`local_path_not_a_file`,`${n} is not a regular file. Pass the path of one file at a time.`);default:return new l(`local_file_unreadable`,`Cannot read ${n}. Check its permissions and try again.`)}}async function w(e,t){try{return await p(e)}catch(e){if(!(e instanceof m))throw e;return d(t,C(e))}}async function T(e,t,n,r){let{client:i,accessToken:a,workspaceId:o}=e;return n.type===`file`?c(await i.updateProjectFileDescription(a,o,t,n.id,{description:r})):s(await i.updateProjectLinkDescription(a,o,t,n.id,{description:r}))}async function E(e,t,n){return s(await e.client.addProjectLink(e.accessToken,e.workspaceId,t,{url:n}))}async function D(e,r,i){let a=await u(i,{client:e.client}),o=`${t(r.name)} was uploaded as file ${r.id} before the project refused it; that upload is attached to nothing, and running the command again uploads the file afresh.`;return new l(a?.code??`file_not_attached`,`${a?.message??n(i).message} ${o}`)}async function O(e,t,n){let{client:r,accessToken:i,workspaceId:a}=e,o=await r.uploadFile(i,a,n,`openai`);try{return c(await r.attachProjectFile(i,a,t,{fileId:o.id}))}catch(t){throw await D(e,o,t)}}function k(e,t,n){if(n.json){f(t);return}i(e,t,t.status===`pending`?"Its snapshot is being fetched; `entrydesk project sources <project>` shows when it is ready.":void 0)}async function A(e,t){return _.test(e)?{kind:`link`,url:await S(e,t)}:{kind:`file`,file:await w(e,t)}}async function j(e,t,r){let i=(await u(r,{client:e.client}))?.message??n(r).message;return new l(`description_not_saved`,`The ${t.type} was added, but its description was not saved: ${i} Set it with \`entrydesk project sources-edit <project> ${t.type} ${t.id} --description <text>\`.`)}async function M(e,t,n,r,i){try{return await T(e,t,n,r)}catch(t){throw k(`Added`,n,i),await j(e,n,t)}}async function N(e,t,n){let r=await x(n),i=await A(t,n);await o(n,async t=>{let o=await a(t,e),s=i.kind===`link`?await E(t,o,i.url):await O(t,o,i.file);r!==void 0&&(s=await M(t,o,s,r,n)),k(`Added`,s,n)})}async function P(e,t,n,r){let i=await b(t,r),s=await x(r);if(s===void 0)return d(r,new l(`description_missing`,`Pass --description <text>. An empty string clears the description.`));await o(r,async t=>{k(`Updated`,await T(t,await a(t,e),{type:i,id:n},s),r)})}async function F(e,t,n){await o(n,async r=>{let i=await a(r,e);k(`Refetching`,s(await r.client.refetchProjectLink(r.accessToken,r.workspaceId,i,t)),n)})}async function I(e,n,r,i){let s=await b(n,i);await o(i,async n=>{let{client:o,accessToken:c,workspaceId:l}=n,u=await a(n,e);if(s===`file`?await o.removeProjectFile(c,l,u,r):await o.removeProjectLink(c,l,u,r),i.json){f({type:s,id:r,removed:!0});return}console.log(`Removed ${s}: ${t(r)}`)})}export{N as addProjectSource,P as editProjectSource,F as refetchProjectSource,I as removeProjectSource};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{at as e}from"./profile-storage-Dv0xRb8J.js";import{a as t}from"./options-D6fCp3Q_.js";import{f as n,i as r,o as i,t as a,u as o,y as s}from"./resolve-f238uD6C.js";import{n as c}from"./tasks-D4RIFT8Y.js";import{validate as l}from"uuid";const u=e.extract([`self`,`project`]),d=`Pass exactly one of --add-user <userId>, --remove-user <userId> or --visibility ${u.options.join(`|`)}.`;function f(e){return new i(`invalid_argument`,e)}async function p(e,n){return l(e)?e:o(n,f(`<taskId> must be a task id — ${t}.`))}async function m(e,t,n){return t===!0?o(n,f(`${e} needs a userId.`)):l(t)?t:o(n,f(`${e} must be a user id. \`entrydesk project get <project> --json\` lists the members with their ids.`))}async function h(e){let{addUser:t,removeUser:n,visibility:r}=e,i=[t,n,r].filter(e=>e!==void 0).length;if(i===0)return o(e,f(d));if(i>1)return o(e,f(`--add-user, --remove-user and --visibility are mutually exclusive. ${d}`));if(t!==void 0)return{kind:`add`,userId:await m(`--add-user`,t,e)};if(n!==void 0)return{kind:`remove`,userId:await m(`--remove-user`,n,e)};let a=u.safeParse(r);return a.success?{kind:`visibility`,level:a.data}:o(e,f(`--visibility must be one of: ${u.options.join(`, `)}.`))}async function g(e,t,n){if(await a(e,t),(await e.client.getTask(e.accessToken,e.workspaceId,n)).project?.id!==t)throw new i(`task_not_in_this_project`,"This task is not in this project. `entrydesk project tasks <project>` lists the ones that are.")}function _(e,t){if(t.json){s(e.json);return}console.log(e.text)}async function v(e,t){await c(void 0,{...t,project:e})}async function y(e,t,i){let a=await p(t,i),o=await r(e,i.json??!1);_({json:await n(i,e=>e.client.assignTaskProject(e.accessToken,e.workspaceId,a,{projectId:o,...i.confirmAssetSharing&&{confirmAssetSharing:!0}})),text:`Moved task ${a} into the project.`},i)}async function b(e,t,i){let a=await p(t,i),o=await r(e,i.json??!1);_({json:await n(i,async e=>(await g(e,o,a),e.client.assignTaskProject(e.accessToken,e.workspaceId,a,{projectId:null}))),text:`Removed task ${a} from the project. Any assets it produced stay in the project.`},i)}async function x({client:e,accessToken:t,workspaceId:n},r,i){switch(i.kind){case`add`:{let a=await e.grantTaskShareMember(t,n,r,i.userId);return{json:a,text:`Shared task ${r} with ${a.name} <${a.email}>.`}}case`remove`:return await e.revokeTaskShareMember(t,n,r,i.userId),{json:{taskId:r,userId:i.userId,removed:!0},text:`Stopped sharing task ${r} with user ${i.userId}.`};case`visibility`:return{json:await e.upsertTaskShare(t,n,r,i.level),text:i.level===`project`?`Task ${r} is now visible to every member of the project.`:`Task ${r} is now visible only to you and the members you shared it with by name.`}}}async function S(e,t,i){let a=await h(i),o=await p(t,i),s=await r(e,i.json??!1);_(await n(i,async e=>(await g(e,s,o),x(e,o,a))),i)}export{y as addTaskToProject,v as listProjectTasks,b as removeTaskFromProject,S as shareProjectTask};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{g as e,i as t,m as n,n as r,p as i}from"./paths-C9BPsZVF.js";import{t as a}from"./hash-Ddmw8YE4.js";import{t as o}from"./remote-nEFOyIM2.js";import s from"node:fs";import c from"node:os";import l from"node:path";import u from"archiver";function d(e){return typeof e!=`object`||!e?!1:e.response?.status===404||/\b404\b/u.test(e.message??``)}function f(e){return e.remoteHash===null?`create`:e.currentHash===e.baseHash?`noop`:!e.force&&e.remoteHash!==e.lastPulledHash?`stale`:`push`}function p(e){return new Promise((t,n)=>{let r=[],i=u(`zip`,{zlib:{level:9}});i.on(`data`,e=>r.push(e)),i.on(`error`,n),i.on(`end`,()=>t(Buffer.concat(r))),i.directory(e,!1),i.finalize()})}async function m(e,t){let{url:n}=await e.client.downloadSkillCurrent(e.accessToken,e.workspaceId,t),r=await fetch(n);if(!r.ok)throw Error(`download for staleness check failed: ${r.status}`);let i=s.mkdtempSync(l.join(c.tmpdir(),`ed-push-cmp-`));try{let{default:e}=await import(`adm-zip`);for(let t of new e(Buffer.from(await r.arrayBuffer())).getEntries()){if(t.isDirectory)continue;let e=l.resolve(i,t.entryName);e.startsWith(l.resolve(i)+l.sep)&&(s.mkdirSync(l.dirname(e),{recursive:!0}),s.writeFileSync(e,t.getData()))}return a(i)}finally{s.rmSync(i,{recursive:!0,force:!0})}}async function h(t,n,r,i,a,o,s){let c=await p(i),l=new FormData;l.append(`file`,new Blob([c],{type:`application/zip`}),`${r}.zip`),s&&l.append(`force`,`true`);let u=await t.client.uploadSkill(t.accessToken,t.workspaceId,l);e(n,r,{...o,skillId:u.id,localHash:a,lastPulledHash:a})}async function g(e,t,n,i,c){let l=r(t,n);if(!s.existsSync(l))throw Error(`No local copy for ${n}`);let u=a(l);if(i.skillId){let r=null;try{r=await m(e,i.skillId)}catch(e){if(!d(e))throw e}if(r!==null){let a=f({currentHash:u,baseHash:i.localHash,lastPulledHash:i.lastPulledHash,remoteHash:r,force:c});return a===`noop`||a===`stale`||await h(e,t,n,l,u,i,!0),a}}let p=(await o(e.client,e.accessToken,e.workspaceId)).find(e=>e.name===n);return p&&!c?`name-conflict`:(await h(e,t,n,l,u,i,!!p),`create`)}async function _(e,r,a){let{rootDir:o,workspaceId:s}=t(!!r.global,a.workspaceId),c={...a,workspaceId:s},l=!!r.force,u=e?[e]:Object.keys(n(o).skills);if(u.length===0){console.info(`Nothing to push — no tracked skills.`);return}let d=!1;for(let e of u){let t=i(o,e);if(!t){console.info(`✗ ${e}: not tracked (run: entrydesk skills add <source>)`),d=!0;continue}let n=await g(c,o,e,t,l),r={create:`✓ pushed ${e} (created in workspace)`,push:`✓ pushed ${e}`,noop:`· ${e} unchanged`,stale:`✗ ${e} rejected — remote changed since last pull. Run 'entrydesk skills pull ${e}' first (or --force).`,"name-conflict":`✗ ${e} rejected — a different skill named "${e}" already exists in the workspace. Pull it first, or --force to overwrite.`};console.info(r[n]),(n===`stale`||n===`name-conflict`)&&(d=!0)}d&&(process.exitCode=1)}export{_ as runSkillsPush};
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import{b as e,l as t}from"./profile-storage-DYUIMuP0.js";import{t as n}from"./format-BNEUX5Xv.js";import{t as r}from"./confirm-BrJZbaxf.js";async function i(r){let{accessToken:i,workspaceId:a}=await t(),{recordings:o,nextKey:s}=await new e().listRecordings(i,a,{limit:r.limit,nextKey:r.nextKey,search:r.search});if(r.json){console.log(JSON.stringify({recordings:o,nextKey:s}));return}if(o.length===0){console.log("No recordings yet. Import one with `entrydesk recordings import <url>`.");return}console.log(`Recordings (${o.length}):\n`);for(let e of o){let t=e.processingStatus??`ready`;console.log(` ${e.title}`),console.log(` ID: ${e.id}`),console.log(` ${n(e.duration)} · ${t}${e.source?` · ${e.source}`:``}`),console.log(``)}s&&console.log(`More results: --next-key ${s}`)}async function a(r,i){let{accessToken:a,workspaceId:o}=await t(),s=await new e().getRecording(a,o,r);if(i.json){console.log(JSON.stringify(s));return}if(console.log(s.title),console.log(`ID: ${s.id}`),console.log(`Status: ${s.processingStatus??`ready`}`),console.log(`Duration: ${n(s.duration)}`),s.recordedAt&&console.log(`Recorded: ${s.recordedAt}`),s.summary&&console.log(`\nSummary:\n${s.summary}`),s.actionItems&&s.actionItems.length>0){console.log(`
2
+ import{b as e,u as t}from"./profile-storage-Dv0xRb8J.js";import{t as n}from"./format-C3tQC6LL.js";import{t as r}from"./confirm-BrJZbaxf.js";async function i(r){let{accessToken:i,workspaceId:a}=await t(),{recordings:o,nextKey:s}=await new e().listRecordings(i,a,{limit:r.limit,nextKey:r.nextKey,search:r.search});if(r.json){console.log(JSON.stringify({recordings:o,nextKey:s}));return}if(o.length===0){console.log("No recordings yet. Import one with `entrydesk recordings import <url>`.");return}console.log(`Recordings (${o.length}):\n`);for(let e of o){let t=e.processingStatus??`ready`;console.log(` ${e.title}`),console.log(` ID: ${e.id}`),console.log(` ${n(e.duration)} · ${t}${e.source?` · ${e.source}`:``}`),console.log(``)}s&&console.log(`More results: --next-key ${s}`)}async function a(r,i){let{accessToken:a,workspaceId:o}=await t(),s=await new e().getRecording(a,o,r);if(i.json){console.log(JSON.stringify(s));return}if(console.log(s.title),console.log(`ID: ${s.id}`),console.log(`Status: ${s.processingStatus??`ready`}`),console.log(`Duration: ${n(s.duration)}`),s.recordedAt&&console.log(`Recorded: ${s.recordedAt}`),s.summary&&console.log(`\nSummary:\n${s.summary}`),s.actionItems&&s.actionItems.length>0){console.log(`
3
3
  Action items:`);for(let e of s.actionItems)console.log(` - ${e.description}`)}s.transcript&&console.log(`\nTranscript available — view with: entrydesk meeting transcript ${s.id}`)}async function o(n,r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().importRecordingMedia(i,a,{url:n,title:r.title,modelId:r.model,preferredLanguage:r.language});if(r.json){console.log(JSON.stringify(o));return}console.log(`Importing ${o.source} recording.`),console.log(` Recording ID: ${o.recordingId}`),console.log(` ${o.message}`),console.log(` Check status: entrydesk recordings get ${o.recordingId}`)}async function s(r,i){let{accessToken:a,workspaceId:o}=await t(),s=await new e().previewRecordingMedia(a,o,r);if(i.json){console.log(JSON.stringify(s));return}console.log(`${s.title} [${s.type}]`),s.channelName&&console.log(`Channel: ${s.channelName}`),s.duration!=null&&console.log(`Duration: ${n(s.duration)}`),s.contentType&&console.log(`Type: ${s.contentType}`)}async function c(n,r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().getRecordingAudioUrl(i,a,n);if(r.json){console.log(JSON.stringify(o));return}console.log(`Stream: ${o.url}`),console.log(`Download: ${o.downloadUrl}`)}async function l(n,r){let{accessToken:i,workspaceId:a}=await t(),o=await new e().retryRecording(i,a,n);if(r.json){console.log(JSON.stringify(o));return}console.log(o.message)}async function u(n,i){let{accessToken:a,workspaceId:o}=await t();if(!i.yes&&(process.stdin.isTTY||(console.error(`Deleting recording ${n} needs confirmation. Re-run with --yes.`),process.exit(1)),!await r(`Delete recording ${n}? This can't be undone from the CLI.`))){console.log(`Aborted.`);return}if(await new e().deleteRecording(a,o,n),i.json){console.log(JSON.stringify({id:n,deleted:!0}));return}console.log(`Deleted recording ${n}.`)}export{u as deleteRecording,o as importRecording,i as listRecordings,s as previewRecording,l as retryRecording,a as showRecording,c as showRecordingAudioUrl};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{h as e,i as t,n,p as r,t as i}from"./paths-C9BPsZVF.js";import{a,i as o,n as s,t as c}from"./installer-iaoPJQn3.js";import l from"node:fs";import u from"node:path";function d(e,t,n,r){let i=[],a=[];for(let d of c){let c=u.join(s(d,t),e);try{l.lstatSync(c)}catch{continue}r||o(c,n)?i.push(d.id):a.push(d.id)}return{removable:i,preserved:a}}async function f(o,u,f){i(o);let{rootDir:p,workspaceId:m}=t(!!u.global,f.workspaceId),h=r(p,o),g=n(p,o),_=l.existsSync(g),v=!!h||_,{removable:y,preserved:b}=d(o,p,g,v);if(!(v||y.length>0)&&!(u.remote&&h?.skillId)){b.length>0?console.info(`Left ${o} untouched in ${b.join(`, `)} — not EntryDesk-managed; remove it manually if intended.`):console.info(`Nothing to remove — ${o} is not installed.`);return}let x=!1;u.remote&&(h?.skillId?(await f.client.deleteSkill(f.accessToken,m,h.skillId),x=!0):console.info(`· skipped --remote: no known workspace skillId for ${o} (it was never pushed from here).`));for(let e of c)y.includes(e.id)&&a(s(e,p),o);_&&l.rmSync(g,{recursive:!0,force:!0}),e(p,o);let S={name:o,canonicalRemoved:_,agentsUnlinked:y,agentsPreserved:b,untracked:!h,remoteDeleted:x};if(u.json){console.info(JSON.stringify(S,null,2));return}let C=y.length>0?` (agents: ${y.join(`, `)})`:``,w=b.length>0?` — kept non-managed entries in ${b.join(`, `)}`:``;console.info(`✓ removed ${o}${C}${x?` + deleted from workspace`:``}${w}`)}export{f as runSkillsRemove};
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import{T as e,a as t,b as n,g as r,o as i,u as a,w as o,x as s}from"./profile-storage-Dv0xRb8J.js";import{i as c,n as l}from"./format-C3tQC6LL.js";import{HTTPError as u}from"ky";import{validate as d}from"uuid";function f(t){return e(t)}function p(e){return e.split(`
3
+ `).map(f)}function m(e,{numbered:t}){console.log(`Projects (${e.length}):\n`);for(let[n,r]of e.entries()){let e=t?`${String(n+1).padStart(2,` `)} `:``;console.log(` ${e}${f(r.name)}`),console.log(` ${r.role} · updated ${l(r.updatedAt)}`),console.log(` ID: ${r.id}`),console.log(``)}t||console.log("This listing is filtered or paged, so its positions are not the numbers `<project>` takes — pass an ID above.")}function h(e){return`${f(e.name)} <${f(e.email)}> · ${e.role}`}function g(e){console.log(`${f(e.name)}\n`),console.log(` ID: ${e.id}`),console.log(` Role: ${e.role}`),e.description&&console.log(` Description: ${f(e.description)}`),console.log(` Updated: ${l(e.updatedAt)}`),console.log(` Sources: ${e.sourceCount} · Tasks: ${e.taskCount} · Assets: ${e.assetCount}`),console.log(`\n Members (${e.members.length}):`);for(let t of e.members)console.log(` - ${h(t)}`);if(console.log(`
4
+ Instruction:`),!e.instruction){console.log(` (none)`);return}for(let t of p(e.instruction))console.log(` ${t}`)}function _(e){console.log(`Members of ${f(e.name)} (${e.members.length}):\n`);for(let t of e.members)console.log(` - ${h(t)}`),console.log(` ID: ${t.userId}`)}function v(e){console.log(`Deleting project: ${f(e.name)}`),console.log(` ID: ${e.id}\n`),console.log(`This will:`),console.log(` - Detach its ${c(e.taskCount,`task`)}; each returns to its owner's main list`),console.log(` - Delete its ${c(e.sourceCount,`source`)} — the files and links in it`),console.log(` - Delete its ${c(e.assetCount,`asset`)}, with every version in their history`),console.log(`
5
+ This can't be undone.`)}function y(e){return process.stdout.isTTY?p(e).join(`
6
+ `):e}function b(e){let t=JSON.stringify(e);console.log(process.stdout.isTTY?f(t):t)}function x(e){let t=JSON.stringify(e);process.stderr.write(`${process.stderr.isTTY?f(t):t}\n`)}function S(e){return{type:`file`,id:e.id,title:e.name,description:e.description,status:`ready`}}function C(e){return{type:`link`,id:e.id,title:e.title??e.url,description:e.description,status:e.status,url:e.url,fetchError:e.fetchError}}function w(e){return e.status===`failed`&&e.fetchError?`${e.status} — ${f(e.fetchError)}`:e.status}function T(e){console.log(`Sources (${e.length}):\n`);for(let t of e)console.log(` [${t.type}] ${f(t.title)}`),console.log(` ID: ${t.id}`),console.log(` Status: ${w(t)}`),t.url&&console.log(` URL: ${f(t.url)}`),console.log(` Description: ${t.description?f(t.description):`(none)`}`),console.log(``)}function E(e,t,n){console.log(`${e} ${t.type}: ${f(t.title)}`),console.log(` ID: ${t.id}`),console.log(` Status: ${w(t)}`),n&&console.log(n)}function D(e){for(let t of p(e))console.log(` ${t}`)}function O(e){console.log(`Results (${e.length}):\n`);for(let t of e)console.log(` [${t.type}] ${f(t.title)}`),t.type===`task`?(console.log(` ID: ${t.taskId}`),console.log(` Updated: ${l(t.updatedAt)}`)):(console.log(` ID: ${t.sourceId}`),t.description&&console.log(` Description: ${f(t.description)}`)),t.snippet&&D(t.snippet),console.log(``)}var k=class extends Error{code;constructor(e,t){super(t),this.code=e,this.name=`ProjectCommandError`}};const A=`Project not found`,j="Source not found. Check the type and id against `entrydesk project sources <project>`.";function M(){return new k(`project_not_found`,A)}function N(){return new k(`project_feature_disabled`,"Projects are not enabled on this server. Ask an operator to set ENABLE_PROJECT, or point `entrydesk config set apiUrl <url>` at a server that has them.")}const P={context_source_not_found:`Context source not found. Check the id, and note that assets are not part of the CLI context surface — view them in the Hub.`,project_owner_required:`Only a project owner can do this. Ask an owner, or have one make you an owner first.`,project_last_owner_required:`This is the last owner of the project. Promote another member to owner before removing or demoting them.`,project_invitee_not_in_workspace:`That user is not a member of this workspace, so they cannot be added to a project in it.`,project_member_already_exists:`That user is already a member of this project.`,project_member_not_found:`That user is not a member of this project.`,task_not_found:`Task not found. Only a task you own can be moved or shared, and only by its id.`,asset_sharing_confirmation_required:`This task produced assets the project does not hold yet. Moving it in shares them with every member of the project — re-run with --confirm-asset-sharing to confirm.`,task_not_in_project:`This task is not in a project, so there are no project members to share it with.`,not_project_member:"This person is not a member of the project. `entrydesk project get <project> --json` lists the members with their ids.",sharing_disabled:`Sharing is turned off for this workspace by an admin.`,share_visibility_not_allowed:`This share level is not allowed by the workspace share policy set by an admin.`,project_not_found:A,project_file_not_found:j,project_link_not_found:j,file_not_found:`The uploaded file is no longer there to attach. Run the command again.`,project_file_already_attached:`This file is already a source of the project.`,project_link_fetch_in_progress:"This link is already being fetched. Wait for `entrydesk project sources <project>` to show it as ready or failed, then refetch."};function F(){return new k(`project_owner_required`,P.project_owner_required)}function I(e){let{status:t}=e.response;if(t<400||t>=500)return null;let n=o(e.data);if(n===void 0)return null;let r=P[n];return r===void 0?null:new k(n,r)}async function L(e){try{let{features:t}=await e.getRuntimeConfig();if(!t.enableProject)return N()}catch{}return M()}const R=[/\/projects\/[^/]+\/notes$/u,/\/projects\/[^/]+\/tasks$/u,/\/tasks\/[^/]+$/u,/\/tasks\/[^/]+\/project$/u,/\/tasks\/[^/]+\/shares(?:\/members\/[^/]+)?$/u,/\/workspaces\/[^/]+\/files$/u];function z(e){let{pathname:t}=new URL(e.request.url),n=R.some(e=>e.test(t));return e.request.method.toUpperCase()===`GET`?n?`tasks:read`:`projects:read`:n?`tasks:write`:`projects:write`}function B(e){let t=null;try{t=r()}catch{}return t?.authSource===`pat-env`?`This token is missing the \`${e}\` scope. Issue a personal access token that grants it, then set ENTRYDESK_TOKEN to it.`:`Your session is missing the \`${e}\` scope — it predates project support. Run \`entrydesk login\` again to grant it.`}function V(e){return new k(`insufficient_scope`,B(e))}function H(e){if(!(e instanceof s))return null;switch(e.code){case`project_not_found`:return M();case`project_not_enabled`:return N();case`insufficient_scope`:return V(`tasks:write`);default:return null}}async function U(e,t,n){if(t instanceof k)return t;if(!(t instanceof u))return null;let r=t.response.status;return r===403&&o(t.data)===`insufficient_scope`?V(n??z(t)):r===404&&e?I(t)??L(e):I(t)}async function W(e,t={}){return U(t.client,e,t.requiredScope)}async function G(n,r,a,o){let s=await U(n,r,o);a.json||(s||i(r),console.error(`Error: ${e(s.message)}`),process.exit(1)),x({error:s?{code:s.code,message:s.message}:{code:`request_failed`,message:t(r).message}}),process.exit(1)}function K(e,t){return G(void 0,t,e)}async function q(e,t,r){let i=new n;try{let{accessToken:e,workspaceId:n}=await a();return await t({client:i,accessToken:e,workspaceId:n})}catch(t){return G(i,t,e,r)}}async function J(e,t){await q(e,t)}async function Y({client:e,accessToken:t,workspaceId:n},r){return e.listProjects(t,n,{limit:r.limit??20,nextKey:r.nextKey,filter:r.filter})}async function X(e,t){if(d(t))return t;if(!/^\d+$/u.test(t))throw M();let n=Number.parseInt(t,10),{projects:r}=await Y(e,{filter:`all`});if(n<1||n>r.length)throw new k(`project_index_out_of_range`,`No project numbered ${n}. \`entrydesk project list\` shows ${r.length}.`);return r[n-1].id}async function Z(e,t){let n=await X(e,t);return e.client.getProject(e.accessToken,e.workspaceId,n)}async function Q(e,t){await e.client.getTasks(e.accessToken,e.workspaceId,{limit:1,projectId:t})}async function $(e,t){return q({json:t},t=>X(t,e),`projects:read`)}export{E as C,_ as S,y as T,v as _,X as a,x as b,H as c,J as d,q as f,O as g,C as h,$ as i,F as l,S as m,Y as n,k as o,h as p,Z as r,W as s,Q as t,K as u,g as v,T as w,m as x,b as y};
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env node
2
+ import{T as e,b as t,ht as n,lt as r,u as i}from"./profile-storage-Dv0xRb8J.js";import{t as a}from"./paginate-CfIrho1f.js";import{n as o}from"./build-task-request-config-Y9X2h9Ia.js";import{isHTTPError as s}from"ky";function c(e){return`${String(e.hour).padStart(2,`0`)}:${String(e.minute).padStart(2,`0`)}`}const l=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function u(e){return e?.length?` (windows: ${e.map(e=>`${c(e.start)}-${c(e.end)}`).join(`, `)})`:``}function d(e){return e?.length?` [days: ${e.map(e=>l[e]).join(`, `)}]`:``}function f(e){if(e.type===`no-repeat`)return`No repeat`;let{interval:t}=e;switch(t.unit){case`minutes`:return`Every ${t.every} minute${t.every>1?`s`:``}`+u(t.dailyWindows)+d(t.daysOfWeek);case`hours`:return`Every ${t.every} hour${t.every>1?`s`:``} at :${String(t.minute).padStart(2,`0`)}`+u(t.dailyWindows)+d(t.daysOfWeek);case`days`:{let e=`Every ${t.every} day${t.every>1?`s`:``} at ${c(t.time)}`;return t.times?.length&&(e+=` (times: ${t.times.map(c).join(`, `)})`),e+=d(t.daysOfWeek),e}case`weeks`:{let e=t.daysOfWeek.map(e=>l[e]).join(`, `);return`Every ${t.every} week${t.every>1?`s`:``} on ${e} at ${c(t.time)}`}case`months`:{let e=t.lastDayOfMonth?t.daysOfMonth.length>0?`${t.daysOfMonth.join(`, `)} and last day`:`last day`:t.daysOfMonth.join(`, `);return`Every ${t.every} month${t.every>1?`s`:``} on day ${e} at ${String(t.time.hour).padStart(2,`0`)}:${String(t.time.minute).padStart(2,`0`)}`}default:return`Unknown`}}function p(e,t){let n=new Date(e),r=t.match(/^([+-])(\d{2}):(\d{2})$/);if(!r)return n.toISOString();let i=r[1]===`+`?1:-1,a=Number.parseInt(r[2],10),o=Number.parseInt(r[3],10),s=i*(a*60+o)*60*1e3;return`${new Date(n.getTime()+s).toISOString().replace(`T`,` `).slice(0,19)} (${t})`}function m(e){console.log(`
3
+ Schedule: ${e.name}
4
+ ${`━`.repeat(50)}
5
+ ID: ${e.id}
6
+ Agent: ${e.agent.name}
7
+ Status: ${e.isActive?`Active`:`Paused`}
8
+ Timezone: ${e.utcOffset}
9
+
10
+ Prompt:
11
+ ${e.prompt.slice(0,200)}${e.prompt.length>200?`…`:``}
12
+
13
+ Schedule:
14
+ ${f(e.config)}
15
+
16
+ Holiday Calendars: ${e.holidayCalendarIds?.length?e.holidayCalendarIds.join(`, `):`-`}
17
+
18
+ Next run: ${e.nextRunAt?p(e.nextRunAt,e.utcOffset):`-`}
19
+ Created: ${p(e.createdAt,e.utcOffset)}
20
+ Updated: ${p(e.updatedAt,e.utcOffset)}
21
+ `)}function h(e){console.log(`Runs (${e.length}):\n`);for(let t of e){let e=new Date(t.scheduledAt).toLocaleString(),n;n=t.status===`skipped`?t.skipReason===`holiday`?`Skipped (holiday)`:`Skipped`:t.task?.title??`(task unavailable)`;let r=t.task&&!t.task.read?` (unread)`:``;console.log(` ${e}`),console.log(` Task: ${n}${r}`),t.task&&console.log(` Task ID: ${t.task.id}`),console.log(` Run ID: ${t.id}`),console.log(``)}}function g(t){if(t.length===0){console.log(`No connected calendar accounts. Connect one in the Hub first.`);return}console.log(`Connected calendar accounts (${t.length}):\n`);for(let n of t){let t=e(n.provider),r=e(n.email);console.log(` ${t} (${r})`),console.log(` Account ID: ${n.id}`);for(let t of n.calendars){let n=t.isVisible?``:` (hidden)`,r=e(t.name);console.log(` ${t.id} ${r}${n}`)}console.log(``)}}function _(e,t,n){return e.type===`no-repeat`?t===void 0?(n?.length??0)>0?[]:void 0:[]:t??n??void 0}function v(e){let t=e.repeatType||`no-repeat`;e.times!==void 0&&t!==`days`&&(console.error(`--times is only supported with --repeat-type days.`),process.exit(1)),e.dailyWindows!==void 0&&t!==`minutes`&&t!==`hours`&&(console.error(`--daily-windows is only supported with --repeat-type minutes or hours.`),process.exit(1)),e.daysOfWeek!==void 0&&t!==`minutes`&&t!==`hours`&&t!==`days`&&t!==`weeks`&&(console.error(`--days-of-week is only supported with --repeat-type minutes, hours, days, or weeks.`),process.exit(1))}function y(e){if(e.type!==`repeat`)return;let{interval:t}=e;t.unit===`hours`&&(t.every<24||((t.dailyWindows?.length??0)>0&&(console.error(`--daily-windows is not available with --repeat-type hours and --every 24 or more (equivalent to a daily interval, and the existing schedule already has active windows set) — use --repeat-type days instead.`),process.exit(1)),(t.daysOfWeek?.length??0)>0&&(console.error(`--days-of-week is not available with --repeat-type hours and --every 24 or more (equivalent to a daily interval, and the existing schedule already has a weekday filter set) — use --repeat-type days instead.`),process.exit(1))))}function b(e,t){let n=e.repeatType||`no-repeat`;if(n===`no-repeat`)return{type:`no-repeat`};let r=t?.type===`repeat`&&t.interval.unit===n?t.interval:void 0,i=e.every??r?.every??1;function a(){return e.time?e.time:r&&`time`in r?r.time:{hour:9,minute:0}}switch(n){case`minutes`:return{type:`repeat`,interval:{unit:`minutes`,every:i,dailyWindows:e.dailyWindows??(r?.unit===`minutes`?r.dailyWindows:void 0),daysOfWeek:e.daysOfWeek??(r?.unit===`minutes`?r.daysOfWeek:void 0)}};case`hours`:return{type:`repeat`,interval:{unit:`hours`,every:i,minute:e.time?a().minute:r?.unit===`hours`?r.minute:0,dailyWindows:e.dailyWindows??(r?.unit===`hours`?r.dailyWindows:void 0),daysOfWeek:e.daysOfWeek??(r?.unit===`hours`?r.daysOfWeek:void 0)}};case`days`:return{type:`repeat`,interval:{unit:`days`,every:i,time:a(),times:e.times??(r?.unit===`days`?r.times:void 0),daysOfWeek:e.daysOfWeek??(r?.unit===`days`?r.daysOfWeek:void 0)}};case`weeks`:return{type:`repeat`,interval:{unit:`weeks`,every:i,daysOfWeek:e.daysOfWeek??(r?.unit===`weeks`?r.daysOfWeek:[1]),time:a()}};case`months`:return{type:`repeat`,interval:{unit:`months`,every:i,daysOfMonth:e.daysOfMonth??(r?.unit===`months`?r.daysOfMonth:[1]),lastDayOfMonth:e.lastDayOfMonth??(r?.unit===`months`&&r.lastDayOfMonth),time:a()}};default:return{type:`no-repeat`}}}async function x(e){let{accessToken:n,workspaceId:r}=await i(),a=new t,o=[],s;do{let e=await a.getSchedules(n,r,{nextKey:s,limit:100});o.push(...e.schedules),s=e.nextKey}while(s);if(e.json){console.log(JSON.stringify(o));return}if(o.length===0){console.log("No schedules in this workspace yet. Create one with `entrydesk schedules create --name <name> --prompt <text> --agent-id <id> --starts-at <time>`.");return}console.log(`Schedules (${o.length}):\n`);for(let e of o){let t=e.isActive?`\x1B[32mActive\x1B[0m`:`\x1B[33mPaused\x1B[0m`;console.log(` ${e.name}`),console.log(` Agent: ${e.agent.name}`),console.log(` Repeat: ${f(e.config)}`),console.log(` Status: ${t}`),console.log(` Next run: ${e.nextRunAt?p(e.nextRunAt,e.utcOffset):`-`}`),console.log(` ID: ${e.id}`),console.log(``)}}async function S(e,n){let{accessToken:r,workspaceId:a}=await i(),o=await new t().getSchedule(r,a,e);if(n.json){console.log(JSON.stringify(o));return}m(o)}function C({toolApprovalMode:e,approvalHandling:t,allowedTools:i,disallowedTools:a}){if(e===void 0!=(t===void 0)&&(console.error(`Pass --tool-approval-mode and --approval-handling together.`),process.exit(1)),e!==void 0&&n(e,t)===void 0){let e=r.map(e=>`${e.toolApprovalMode} + ${e.approvalHandling}`).join(`, `);console.error(`Unsupported posture. Supported: ${e}.`),process.exit(1)}let s=o({allowedTools:i,disallowedTools:a});return{...e!==void 0&&t!==void 0?{toolApprovalMode:e,approvalHandling:t}:{},...s?{toolPolicies:s}:{}}}function w(e,t){let n=new Map(e?.map(e=>[e.toolName,e.policy]));for(let e of t)n.set(e.toolName,e.policy);return[...n].map(([e,t])=>({toolName:e,policy:t}))}async function T(e){let n=C(e);v(e);let r=b(e);y(r);let{accessToken:a,workspaceId:o}=await i(),s={name:e.name,prompt:e.prompt,agentId:e.agentId,startsAt:e.startsAt,config:r,utcOffset:e.utcOffset||`+00:00`,...n,holidayCalendarIds:_(r,e.holidayCalendars,void 0)},c=await new t().createSchedule(a,o,s);if(n.toolApprovalMode===void 0&&console.error(`Note: this schedule will run every tool automatically, including ones an admin marked as needing approval. To gate them instead, pass --tool-approval-mode auto with --approval-handling ask (pause until approved in Hub) or deny (skip the tool).`),e.json){console.log(JSON.stringify(c));return}console.log(`Created schedule: ${c.name}`),console.log(` ID: ${c.id}`),console.log(` Next run: ${c.nextRunAt?p(c.nextRunAt,c.utcOffset):`-`}`)}async function E(e,t,n,r,i){try{return(await e.getAgentVersionByNumber(t,n,r,i))?.id}catch(a){if(!s(a)||a.response.status!==403)throw a;return(await e.getAgent(t,n,r)).selectableVersions?.find(e=>e.versionNumber===i)?.id}}async function D(e,n){let{toolPolicies:r,...a}=C(n),{accessToken:o,workspaceId:s}=await i(),c=new t,l=await c.getSchedule(o,s,e),u=n.agentId??l.agent?.id,d=n.agentId!==void 0&&n.agentId!==l.agent?.id;u||(console.error(`This schedule is not agent-based; the CLI can only edit agent schedules.`),process.exit(1)),n.agentVersion!==void 0&&d&&(console.error(`--agent-version cannot be combined with a different --agent-id; save the agent change first.`),process.exit(1));let f;n.agentVersion!==void 0&&(f=await E(c,o,s,u,n.agentVersion)),n.agentVersion!==void 0&&!f&&(console.error(`Agent version v${n.agentVersion} is not available.`),process.exit(1)),(n.every!==void 0||n.time!==void 0||n.daysOfWeek!==void 0||n.daysOfMonth!==void 0||n.lastDayOfMonth!==void 0||n.dailyWindows!==void 0||n.times!==void 0)&&!n.repeatType&&(console.error(`To change the cadence, pass --repeat-type along with the repeat options.`),process.exit(1)),n.repeatType&&v(n);let p=n.repeatType?b(n,l.config):l.config;n.repeatType&&y(p);let m={name:n.name??l.name,prompt:n.prompt??l.prompt,agentId:u,...f?{agentVersionId:f}:{},startsAt:n.startsAt??l.startsAt,config:p,utcOffset:n.utcOffset??l.utcOffset,...a,...r?{toolPolicies:w(l.toolPolicies,r)}:{},holidayCalendarIds:_(p,n.holidayCalendars,d?void 0:l.holidayCalendarIds)};if(await c.updateSchedule(o,s,e,m),l.isActive||await c.deactivateSchedule(o,s,e),n.json){console.log(JSON.stringify({id:e,updated:!0}));return}console.log(`Updated schedule: ${e}`)}async function O(e,n,r){let{accessToken:a,workspaceId:o}=await i(),s=new t;if(await(n?s.activateSchedule(a,o,e):s.deactivateSchedule(a,o,e)),r.json){console.log(JSON.stringify({id:e,isActive:n}));return}console.log(`${n?`Activated`:`Paused`} schedule: ${e}`)}async function k(e,n){let{accessToken:r,workspaceId:a}=await i(),{taskId:o}=await new t().runScheduleNow(r,a,e);if(n.json){console.log(JSON.stringify({taskId:o}));return}console.log(`Started run for schedule ${e}`),console.log(` Task ID: ${o}`)}async function A(e,n){let{accessToken:r,workspaceId:o}=await i(),s=new t;if(n.all){let t=await a(async t=>{let i=await s.getScheduleRuns(r,o,e,{limit:n.limit??20,nextKey:t});return{items:i.runs,nextKey:i.nextKey}});if(n.json){console.log(JSON.stringify({runs:t}));return}if(t.length===0){console.log(`No runs for this schedule.`);return}h(t);return}let{runs:c,nextKey:l}=await s.getScheduleRuns(r,o,e,{limit:n.limit,nextKey:n.nextKey});if(n.json){console.log(JSON.stringify({runs:c,nextKey:l}));return}if(c.length===0){console.log(`No runs for this schedule.`);return}h(c),l&&console.log(`Next page: --next-key ${l}`)}async function j(e){let{accessToken:n,workspaceId:r}=await i();await new t().deleteSchedule(n,r,e),console.log(`Deleted schedule: ${e}`)}async function M(e){let{accessToken:n,workspaceId:r}=await i(),{accounts:a}=await new t().getCalendarAccounts(n,r);if(e.json){console.log(JSON.stringify({accounts:a}));return}g(a)}export{T as createSchedule,j as deleteSchedule,D as editSchedule,M as listCalendarAccounts,A as listScheduleRuns,x as listSchedules,k as runScheduleNow,O as setScheduleActive,S as showSchedule};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{b as e,j as t,l as n}from"./profile-storage-DYUIMuP0.js";import{p as r,r as i}from"./paths-Cqjaa_lJ.js";import{n as a,t as o}from"./commands-CpuinJar.js";import{t as s}from"./remote-nEFOyIM2.js";import c from"node:fs";import l from"node:os";import u from"node:path";import{isHTTPError as d}from"ky";import f from"node:crypto";import p from"node:fs/promises";import{Readable as m}from"node:stream";import{pipeline as h}from"node:stream/promises";import g from"adm-zip";import _ from"archiver";function v(e){return e.all?`all`:e.remote&&!e.local?`remote`:e.local&&!e.remote?`local`:`all`}function y(e,t,n){let r=new Map(t.map(e=>[e.name,e])),i=new Map(Object.entries(e)),a=new Set;if(n!==`remote`)for(let e of i.keys())a.add(e);if(n!==`local`)for(let e of r.keys())a.add(e);let o=[];for(let e of a){let t=i.get(e),n=r.get(e);o.push({name:e,local:!!t,remote:!!n,sourceType:t?.sourceType,skillId:t?.skillId??n?.id})}return o.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)),o}function b(e){return e.local&&e.remote?`local+remote`:e.local?`local-only`:`remote-only`}async function x(e,t){let n=v(e),{rootDir:a,workspaceId:o}=i(!!e.global,t.workspaceId),c=y(n===`remote`?{}:r(a).skills,n===`local`?[]:await s(t.client,t.accessToken,o),n);if(e.json){console.info(JSON.stringify(c,null,2));return}if(c.length===0){console.info(n===`local`?`No skills tracked locally.`:`No skills available in the workspace.`);return}let l=(e,t)=>e.padEnd(t);console.info(`${l(`NAME`,28)}${l(`WHERE`,14)}SOURCE`);for(let e of c)console.info(`${l(e.name,28)}${l(b(e),14)}${e.sourceType??`—`}`)}async function S(){let{accessToken:t,workspaceId:r}=await n();return{accessToken:t,workspaceId:r,client:new e}}function C(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..`)&&!u.isAbsolute(n)}async function w(e){let t=await p.realpath(e),n=[process.cwd(),l.homedir()];if(!(await Promise.all(n.map(async e=>{try{return await p.realpath(e)}catch{return u.resolve(e)}}))).some(e=>C(e,t)))throw Error(`Invalid upload path: must be within the current directory or your home directory.`)}async function T(e){let t=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-`)),n=u.join(t,`${u.basename(e)}.zip`);return await new Promise((t,r)=>{let i=c.createWriteStream(n),a=_(`zip`,{zlib:{level:9}});i.on(`close`,()=>t()),i.on(`error`,r),a.on(`error`,r),a.pipe(i),a.directory(e,!1),a.finalize()}),{zipPath:n,cleanupDir:t}}function E(e){console.log(`Versions (${e.length}):\n`);for(let t of e){let e=new Date(t.createdAt).toLocaleString();if(console.log(` v${t.versionNumber} · ${e}`),t.description){let e=t.description.length>100?`${t.description.slice(0,100)}…`:t.description;console.log(` ${e}`)}console.log(` Version ID: ${t.id}`),console.log(``)}}function D(e){let n=t(e);if(console.log(`User grants (${n.length}):`),n.length===0){console.log(` (none)`);return}for(let e of n)console.log(` - ${e.user.name} <${e.user.email}> · ${e.role}`),console.log(` ID: ${e.userId}`)}async function O(e){let t=await S();if(e.local||e.remote||e.all){await x(e,t);return}let n=[],r;do{let i=await t.client.listAvailableSkills(t.accessToken,t.workspaceId,{createdBy:e.mine?`me`:void 0,nextKey:r,limit:100});n.push(...i.skills),r=i.nextKey}while(r);if(e.json){console.log(JSON.stringify(n));return}if(n.length===0){console.log("No skills in this workspace yet. Upload one with `entrydesk skills upload <path>`, or browse `entrydesk marketplace`.");return}console.log(`Available skills (${n.length}):\n`);for(let e of n)console.log(` ${e.name} (${e.provider})`),console.log(` ${e.description.slice(0,120)}`),console.log(` ID: ${e.id}`),console.log(` Author: ${e.author.name}`),console.log(``)}async function k(t,r){let{accessToken:i,workspaceId:a}=await n(),o=new e,s=u.resolve(t),c;try{c=await p.stat(s)}catch{console.error(`File not found: ${s}`),process.exit(1)}let l=s,f=null;try{try{await w(s)}catch(e){let t=e instanceof Error?e.message:`Invalid upload path.`;console.error(t),process.exit(1)}if(c.isDirectory()){let e=await T(s);l=e.zipPath,f=e.cleanupDir}else c.isFile()||(console.error(`Not a file or directory: ${s}`),process.exit(1));u.extname(l).toLowerCase()!==`.zip`&&(console.error(`Only .zip files are supported for upload.`),process.exit(1));let e=await p.readFile(l),t=new FormData;t.append(`file`,new Blob([e],{type:`application/zip`}),u.basename(l)),r.force&&t.append(`force`,`true`);let n;try{n=await o.uploadSkill(i,a,t)}catch(e){throw d(e)&&e.response.status===409&&(console.error(`Upload failed: A skill with this name already exists.`),console.error(`Use --force to overwrite the existing skill.`),process.exit(1)),e}if(r.json){console.log(JSON.stringify(n));return}console.log(`Uploaded skill: ${n.name}`),console.log(` ID: ${n.id}`),console.log(` Version ID: ${n.versionId}`),console.log(` Description: ${n.description}`)}finally{f&&await p.rm(f,{recursive:!0,force:!0})}}async function A(t,r){!r.enable&&!r.disable&&(console.error(`Pass exactly one of --enable or --disable.`),process.exit(1));let i=!!r.enable,{accessToken:a,workspaceId:o}=await n(),s=await new e().updateSkillPreference(a,o,t,i);if(r.json){console.log(JSON.stringify(s));return}console.log(`${s.isEnabled?`Enabled`:`Disabled`} skill for you: ${t}`)}async function j(t,r){let{accessToken:i,workspaceId:a}=await n(),o=await new e().getSkillVersions(i,a,t);if(r.json){console.log(JSON.stringify(o));return}if(o.versions.length===0){console.log(`No versions for this skill.`);return}E(o.versions)}async function M(t,r){let{accessToken:i,workspaceId:a}=await n(),o=new e;if(r.addUser){let e=await o.upsertSkillGrant(i,a,t,r.addUser,r.role);if(r.json){console.log(JSON.stringify(e));return}console.log(`Granted ${r.role} to user ${r.addUser}`);return}if(r.removeUser){if(await o.removeSkillGrant(i,a,t,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.getSkillGrants(i,a,t);if(r.json){console.log(JSON.stringify(s));return}D(s)}async function N(t){let{accessToken:r,workspaceId:i}=await n();await new e().deleteSkill(r,i,t),console.log(`Deleted skill: ${t}`)}async function P(t,r){let{accessToken:i,workspaceId:a}=await n(),{url:o,name:s}=await new e().downloadSkillCurrent(i,a,t);(s.includes(`/`)||s.includes(u.sep)||s===`.`||s===`..`||!s)&&(console.error(`Invalid skill name for output directory: ${s}`),process.exit(1));let d=u.resolve(s),_=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-download-`)),v=u.join(_,`${s}.zip`);try{let e=await fetch(o);if(!e.ok)throw Error(`Failed to download skill zip: ${e.status} ${e.statusText}`);if(!e.body)throw Error(`Response body is empty`);let n=c.createWriteStream(v);await h(m.fromWeb(e.body),n);let i=await p.mkdtemp(u.join(u.dirname(d),`.entrydesk-skill-extract-`)),a=null;try{r.json||console.log(`Extracting…`);let e=new g(v),t=u.resolve(i)+u.sep;for(let n of e.getEntries()){if(n.isDirectory)continue;let e=u.resolve(i,n.entryName);if(!e.startsWith(t))throw Error(`Zip entry contains path traversal: ${n.entryName}`);await p.mkdir(u.dirname(e),{recursive:!0}),await p.writeFile(e,n.getData())}c.existsSync(d)&&(a=u.join(u.dirname(d),`.entrydesk-backup-${f.randomUUID()}`),r.json||console.log(`Replacing existing directory: ${d}`),await p.rename(d,a));try{await p.rename(i,d),a&&c.existsSync(a)&&(await p.rm(a,{recursive:!0,force:!0}),a=null)}catch(e){throw a&&c.existsSync(a)&&(await p.rename(a,d),a=null),e}}catch(e){if(await p.rm(i,{recursive:!0,force:!0}),a&&c.existsSync(a))try{await p.rename(a,d)}catch{console.error(`Warning: Could not restore backup. Your original files are at: ${a}`)}throw e}if(r.json){console.log(JSON.stringify({skillId:t,skillName:s,outputDir:d}));return}console.log(`Downloaded skill "${s}" to ${d}`)}finally{await p.rm(_,{recursive:!0,force:!0})}}async function F(e,t){let{runSkillsAdd:n}=await import(`./add-CDlJBikf.js`);await n(e,t,await S())}async function I(e,t){await a(e,t,await S())}async function L(e,t){let{runSkillsPush:n}=await import(`./push-BBY3QXxO.js`);await n(e,t,await S())}async function R(e){let{runSkillsStatus:t}=await import(`./status-kRSNf0Ap.js`);await t(e,await S())}async function z(e,t){let{runSkillsRemove:n}=await import(`./remove-D-UQJ0IM.js`);await n(e,t,await S())}async function B(e,t){o(e,t,await S())}export{F as addSkill,N as deleteSkill,P as downloadSkill,B as linkSkillsDirectory,j as listSkillVersions,O as listSkills,I as pullSkill,L as pushSkill,z as removeSkill,M as shareSkill,R as showSkillsStatus,A as toggleSkill,k as uploadSkill};
2
+ import{F as e,b as t,u as n}from"./profile-storage-Dv0xRb8J.js";import{i as r,m as i}from"./paths-C9BPsZVF.js";import{n as a,t as o}from"./commands-3Yqb38G_.js";import{t as s}from"./remote-nEFOyIM2.js";import c from"node:fs";import l from"node:os";import u from"node:path";import{isHTTPError as d}from"ky";import f from"node:crypto";import p from"node:fs/promises";import{Readable as m}from"node:stream";import{pipeline as h}from"node:stream/promises";import g from"adm-zip";import _ from"archiver";function v(e){return e.all?`all`:e.remote&&!e.local?`remote`:e.local&&!e.remote?`local`:`all`}function y(e,t,n){let r=new Map(t.map(e=>[e.name,e])),i=new Map(Object.entries(e)),a=new Set;if(n!==`remote`)for(let e of i.keys())a.add(e);if(n!==`local`)for(let e of r.keys())a.add(e);let o=[];for(let e of a){let t=i.get(e),n=r.get(e);o.push({name:e,local:!!t,remote:!!n,sourceType:t?.sourceType,skillId:t?.skillId??n?.id})}return o.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)),o}function b(e){return e.local&&e.remote?`local+remote`:e.local?`local-only`:`remote-only`}async function x(e,t){let n=v(e),{rootDir:a,workspaceId:o}=r(!!e.global,t.workspaceId),c=y(n===`remote`?{}:i(a).skills,n===`local`?[]:await s(t.client,t.accessToken,o),n);if(e.json){console.info(JSON.stringify(c,null,2));return}if(c.length===0){console.info(n===`local`?`No skills tracked locally.`:`No skills available in the workspace.`);return}let l=(e,t)=>e.padEnd(t);console.info(`${l(`NAME`,28)}${l(`WHERE`,14)}SOURCE`);for(let e of c)console.info(`${l(e.name,28)}${l(b(e),14)}${e.sourceType??`—`}`)}async function S(){let{accessToken:e,workspaceId:r}=await n();return{accessToken:e,workspaceId:r,client:new t}}function C(e,t){let n=u.relative(e,t);return n===``||!n.startsWith(`..`)&&!u.isAbsolute(n)}async function w(e){let t=await p.realpath(e),n=[process.cwd(),l.homedir()];if(!(await Promise.all(n.map(async e=>{try{return await p.realpath(e)}catch{return u.resolve(e)}}))).some(e=>C(e,t)))throw Error(`Invalid upload path: must be within the current directory or your home directory.`)}async function T(e){let t=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-`)),n=u.join(t,`${u.basename(e)}.zip`);return await new Promise((t,r)=>{let i=c.createWriteStream(n),a=_(`zip`,{zlib:{level:9}});i.on(`close`,()=>t()),i.on(`error`,r),a.on(`error`,r),a.pipe(i),a.directory(e,!1),a.finalize()}),{zipPath:n,cleanupDir:t}}function E(e){console.log(`Versions (${e.length}):\n`);for(let t of e){let e=new Date(t.createdAt).toLocaleString();if(console.log(` v${t.versionNumber} · ${e}`),t.description){let e=t.description.length>100?`${t.description.slice(0,100)}…`:t.description;console.log(` ${e}`)}console.log(` Version ID: ${t.id}`),console.log(``)}}function D(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 O(e){let t=await S();if(e.local||e.remote||e.all){await x(e,t);return}let n=[],r;do{let i=await t.client.listAvailableSkills(t.accessToken,t.workspaceId,{createdBy:e.mine?`me`:void 0,nextKey:r,limit:100});n.push(...i.skills),r=i.nextKey}while(r);if(e.json){console.log(JSON.stringify(n));return}if(n.length===0){console.log("No skills in this workspace yet. Upload one with `entrydesk skills upload <path>`, or browse `entrydesk marketplace`.");return}console.log(`Available skills (${n.length}):\n`);for(let e of n)console.log(` ${e.name} (${e.provider})`),console.log(` ${e.description.slice(0,120)}`),console.log(` ID: ${e.id}`),console.log(` Author: ${e.author.name}`),console.log(``)}async function k(e,r){let{accessToken:i,workspaceId:a}=await n(),o=new t,s=u.resolve(e),c;try{c=await p.stat(s)}catch{console.error(`File not found: ${s}`),process.exit(1)}let l=s,f=null;try{try{await w(s)}catch(e){let t=e instanceof Error?e.message:`Invalid upload path.`;console.error(t),process.exit(1)}if(c.isDirectory()){let e=await T(s);l=e.zipPath,f=e.cleanupDir}else c.isFile()||(console.error(`Not a file or directory: ${s}`),process.exit(1));u.extname(l).toLowerCase()!==`.zip`&&(console.error(`Only .zip files are supported for upload.`),process.exit(1));let e=await p.readFile(l),t=new FormData;t.append(`file`,new Blob([e],{type:`application/zip`}),u.basename(l)),r.force&&t.append(`force`,`true`);let n;try{n=await o.uploadSkill(i,a,t)}catch(e){throw d(e)&&e.response.status===409&&(console.error(`Upload failed: A skill with this name already exists.`),console.error(`Use --force to overwrite the existing skill.`),process.exit(1)),e}if(r.json){console.log(JSON.stringify(n));return}console.log(`Uploaded skill: ${n.name}`),console.log(` ID: ${n.id}`),console.log(` Version ID: ${n.versionId}`),console.log(` Description: ${n.description}`)}finally{f&&await p.rm(f,{recursive:!0,force:!0})}}async function A(e,r){!r.enable&&!r.disable&&(console.error(`Pass exactly one of --enable or --disable.`),process.exit(1));let i=!!r.enable,{accessToken:a,workspaceId:o}=await n(),s=await new t().updateSkillPreference(a,o,e,i);if(r.json){console.log(JSON.stringify(s));return}console.log(`${s.isEnabled?`Enabled`:`Disabled`} skill for you: ${e}`)}async function j(e,r){let{accessToken:i,workspaceId:a}=await n(),o=await new t().getSkillVersions(i,a,e);if(r.json){console.log(JSON.stringify(o));return}if(o.versions.length===0){console.log(`No versions for this skill.`);return}E(o.versions)}async function M(e,r){let{accessToken:i,workspaceId:a}=await n(),o=new t;if(r.addUser){let t=await o.upsertSkillGrant(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.removeSkillGrant(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.getSkillGrants(i,a,e);if(r.json){console.log(JSON.stringify(s));return}D(s)}async function N(e){let{accessToken:r,workspaceId:i}=await n();await new t().deleteSkill(r,i,e),console.log(`Deleted skill: ${e}`)}async function P(e,r){let{accessToken:i,workspaceId:a}=await n(),{url:o,name:s}=await new t().downloadSkillCurrent(i,a,e);(s.includes(`/`)||s.includes(u.sep)||s===`.`||s===`..`||!s)&&(console.error(`Invalid skill name for output directory: ${s}`),process.exit(1));let d=u.resolve(s),_=await p.mkdtemp(u.join(l.tmpdir(),`entrydesk-skill-download-`)),v=u.join(_,`${s}.zip`);try{let t=await fetch(o);if(!t.ok)throw Error(`Failed to download skill zip: ${t.status} ${t.statusText}`);if(!t.body)throw Error(`Response body is empty`);let n=c.createWriteStream(v);await h(m.fromWeb(t.body),n);let i=await p.mkdtemp(u.join(u.dirname(d),`.entrydesk-skill-extract-`)),a=null;try{r.json||console.log(`Extracting…`);let e=new g(v),t=u.resolve(i)+u.sep;for(let n of e.getEntries()){if(n.isDirectory)continue;let e=u.resolve(i,n.entryName);if(!e.startsWith(t))throw Error(`Zip entry contains path traversal: ${n.entryName}`);await p.mkdir(u.dirname(e),{recursive:!0}),await p.writeFile(e,n.getData())}c.existsSync(d)&&(a=u.join(u.dirname(d),`.entrydesk-backup-${f.randomUUID()}`),r.json||console.log(`Replacing existing directory: ${d}`),await p.rename(d,a));try{await p.rename(i,d),a&&c.existsSync(a)&&(await p.rm(a,{recursive:!0,force:!0}),a=null)}catch(e){throw a&&c.existsSync(a)&&(await p.rename(a,d),a=null),e}}catch(e){if(await p.rm(i,{recursive:!0,force:!0}),a&&c.existsSync(a))try{await p.rename(a,d)}catch{console.error(`Warning: Could not restore backup. Your original files are at: ${a}`)}throw e}if(r.json){console.log(JSON.stringify({skillId:e,skillName:s,outputDir:d}));return}console.log(`Downloaded skill "${s}" to ${d}`)}finally{await p.rm(_,{recursive:!0,force:!0})}}async function F(e,t){let{runSkillsAdd:n}=await import(`./add-Lh_kLR85.js`);await n(e,t,await S())}async function I(e,t){await a(e,t,await S())}async function L(e,t){let{runSkillsPush:n}=await import(`./push-Ce79oiu0.js`);await n(e,t,await S())}async function R(e){let{runSkillsStatus:t}=await import(`./status-CDMSNVD8.js`);await t(e,await S())}async function z(e,t){let{runSkillsRemove:n}=await import(`./remove-bHAmCTdf.js`);await n(e,t,await S())}async function B(e,t){o(e,t,await S())}export{F as addSkill,N as deleteSkill,P as downloadSkill,B as linkSkillsDirectory,j as listSkillVersions,O as listSkills,I as pullSkill,L as pushSkill,z as removeSkill,M as shareSkill,R as showSkillsStatus,A as toggleSkill,k as uploadSkill};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{i as e,m as t,n}from"./paths-C9BPsZVF.js";import{t as r}from"./hash-Ddmw8YE4.js";import{t as i}from"./remote-nEFOyIM2.js";import a from"node:fs";function o(e,t,n){return t?(n??e.localHash)===e.lastPulledHash?`synced`:`ahead`:e.skillId?`remote-deleted`:`local-only`}const s={synced:`—`,ahead:`push (local edits)`,"local-only":`push (never uploaded)`,"remote-deleted":`push to restore, or remove`,"remote-only":`add / pull to install`},c={synced:`✓`,ahead:`↑`,"local-only":`⊙`,"remote-deleted":`⚠`,"remote-only":`☁`};async function l(l,u){let d=!!l.global,{rootDir:f,workspaceId:p}=e(d,u.workspaceId),m=d?`global`:`project`,h=t(f).skills,g=await i(u.client,u.accessToken,p),_=new Map(g.map(e=>[e.id,e])),v=new Map(g.map(e=>[e.name,e])),y=[],b=new Set;for(let[e,t]of Object.entries(h)){let i=t.skillId?_.get(t.skillId):v.get(e);i&&b.add(i.id);let c=n(f,e),l=a.existsSync(c)?r(c):null,u=o(t,!!i,l);y.push({name:e,scope:m,state:u,hint:s[u]})}for(let e of g)b.has(e.id)||y.push({name:e.name,scope:m,state:`remote-only`,hint:s[`remote-only`]});if(y.sort((e,t)=>e.name<t.name?-1:+(e.name>t.name)),l.json){console.info(JSON.stringify(y,null,2));return}if(y.length===0){console.info(`No skills tracked locally or available in the workspace.`);return}let x=(e,t)=>e.padEnd(t);console.info(`${x(`NAME`,26)}${x(`SCOPE`,9)}STATUS`);for(let e of y)console.info(`${x(e.name,26)}${x(e.scope,9)}${c[e.state]} ${x(e.state,16)}${e.hint}`)}export{l as runSkillsStatus};
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- import{C as e,O as t,S as n,b as r,c as i,g as a,s as o,t as s}from"./profile-storage-DYUIMuP0.js";async function c(c){let l=s.getEffectiveProfileName(),u=e(),d={model:t.getDefaultModel(),connectors:t.getDefaultConnectorIds()},f=a();if(f){c.json?console.log(JSON.stringify({loggedIn:!0,authSource:f.authSource,profile:l,server:u,workspaceId:f.workspaceId,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Authenticated via ${f.label} (no login required)`),console.log(`Workspace ID: ${f.workspaceId}`));return}let p=await n.getAll();if(!p){c.json?console.log(JSON.stringify({loggedIn:!1,profile:l,server:u,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Not logged in`),console.log("Run `entrydesk login` to log in"));return}let m;if(p.workspaceId)try{let e=new r,t=await i(),{workspaces:n}=await e.getWorkspaces(t);m=n.find(e=>e.id===p.workspaceId)?.name}catch(e){if(e instanceof o){c.json?console.log(JSON.stringify({loggedIn:!1,profile:l,server:u,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Not logged in`),console.log("Run `entrydesk login` to log in"));return}}c.json?console.log(JSON.stringify({loggedIn:!0,authSource:`file`,profile:l,server:u,email:p.email,workspaceId:p.workspaceId,workspaceName:m,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Logged in as ${p.email}`),m&&console.log(`Workspace: ${m}`),p.workspaceId&&console.log(`Workspace ID: ${p.workspaceId}`))}export{c as runStatus};
2
+ import{C as e,E as t,M as n,b as r,c as i,g as a,l as o,t as s}from"./profile-storage-Dv0xRb8J.js";async function c(c){let l=s.getEffectiveProfileName(),u=t(),d={model:n.getDefaultModel(),connectors:n.getDefaultConnectorIds()},f=a();if(f){c.json?console.log(JSON.stringify({loggedIn:!0,authSource:f.authSource,profile:l,server:u,workspaceId:f.workspaceId,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Authenticated via ${f.label} (no login required)`),console.log(`Workspace ID: ${f.workspaceId}`));return}let p=await e.getAll();if(!p){c.json?console.log(JSON.stringify({loggedIn:!1,profile:l,server:u,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Not logged in`),console.log("Run `entrydesk login` to log in"));return}let m;if(p.workspaceId)try{let e=new r,t=await o(),{workspaces:n}=await e.getWorkspaces(t);m=n.find(e=>e.id===p.workspaceId)?.name}catch(e){if(e instanceof i){c.json?console.log(JSON.stringify({loggedIn:!1,profile:l,server:u,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Not logged in`),console.log("Run `entrydesk login` to log in"));return}}c.json?console.log(JSON.stringify({loggedIn:!0,authSource:`file`,profile:l,server:u,email:p.email,workspaceId:p.workspaceId,workspaceName:m,defaults:d})):(console.log(`Profile: ${l}`),console.log(`Server: ${u}`),console.log(`Logged in as ${p.email}`),m&&console.log(`Workspace: ${m}`),p.workspaceId&&console.log(`Workspace ID: ${p.workspaceId}`))}export{c as runStatus};
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ async function e(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString(`utf8`)}export{e as t};