@entrydesk/cli 1.11.19 → 1.12.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.
- package/README.md +17 -17
- package/dist/{agents-6SL2CJJJ.js → agents-YIPPGKPY.js} +1 -1
- package/dist/{budget-XMLYDL5J.js → budget-ZZG44RXO.js} +1 -1
- package/dist/{chunk-6AL7OBSG.js → chunk-HHCG7UQG.js} +1 -1
- package/dist/{config-FLAGIMCN.js → config-CTC4CBIG.js} +1 -1
- package/dist/{config-ASV5NL7Z.js → config-JU3KJETZ.js} +1 -1
- package/dist/config-help-HHCW7XFB.js +2 -0
- package/dist/{connectors-CWI5IVDN.js → connectors-ZGWBL6TL.js} +1 -1
- package/dist/{help-Z5YLPTUZ.js → help-NESOCXU4.js} +31 -31
- package/dist/index.js +1 -1
- package/dist/{login-JXFYDARD.js → login-FVBYXP32.js} +1 -1
- package/dist/{logout-Q55UDAOR.js → logout-PNYLTJQN.js} +1 -1
- package/dist/{mcp-3EUOE6DQ.js → mcp-DC7H7XHP.js} +1 -1
- package/dist/{models-3XO5UL2T.js → models-W6IJTX2A.js} +1 -1
- package/dist/{profile-37GMFZPS.js → profile-JOKK2XKJ.js} +1 -1
- package/dist/{schedules-TKPFSTIL.js → schedules-A6QPLBMI.js} +1 -1
- package/dist/{skills-CQFFZAZY.js → skills-OM2KB43P.js} +1 -1
- package/dist/{status-NIH542GP.js → status-QVELZ6DI.js} +1 -1
- package/dist/{chat-UGJ345HC.js → task-AMCTDHXH.js} +83 -83
- package/dist/tasks-BWEMFPPU.js +19 -0
- package/dist/{tool-I5NZCJP7.js → tool-VDBXLXT4.js} +5 -5
- package/dist/{usage-FKKIXVFK.js → usage-TGX24GRZ.js} +1 -1
- package/dist/version-IQPTL53K.js +2 -0
- package/dist/{workspaces-QJAHQQ2L.js → workspaces-ZAQAF3RJ.js} +1 -1
- package/package.json +1 -1
- package/dist/chats-O7AN67QW.js +0 -19
- package/dist/config-help-W3HXZ7F6.js +0 -2
- package/dist/version-6NQBVGVC.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as ce,b as ge,c as Yt,g as ft,h as ye,k as Qe,n as xn,o as Ve,q as yn}from"./chunk-
|
|
2
|
+
import{a as ce,b as ge,c as Yt,g as ft,h as ye,k as Qe,n as xn,o as Ve,q as yn}from"./chunk-HHCG7UQG.js";import{render as ks}from"ink";import{v4 as jt}from"uuid";import{exec as $o}from"child_process";import Io from"fs";import We from"fs/promises";import bn from"os";import Vt from"path";import{promisify as So}from"util";import{glob as vo}from"glob";var Po=So($o),_o=`## Filesystem Tool Instructions
|
|
3
3
|
|
|
4
4
|
You have access to filesystem tools that allow you to interact with the user's local filesystem.
|
|
5
5
|
|
|
@@ -26,15 +26,15 @@ You have access to filesystem tools that allow you to interact with the user's l
|
|
|
26
26
|
- The user's home directory is: ${bn.homedir()}
|
|
27
27
|
`,Eo=[{name:"filesystem__read_file",description:"Read the contents of a file from the local filesystem.",inputSchema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file to read."}},required:["path"]}},{name:"filesystem__read_multiple_files",description:"Read multiple files at once (max 10 files).",inputSchema:{type:"object",properties:{paths:{type:"array",items:{type:"string"},description:"Array of absolute file paths to read."}},required:["paths"]}},{name:"filesystem__write_file",description:"Create or overwrite a file with the given content.",inputSchema:{type:"object",properties:{path:{type:"string",description:"The absolute path to the file to write."},content:{type:"string",description:"The content to write to the file."}},required:["path","content"]}},{name:"filesystem__create_directory",description:"Create a new directory (including parent directories if needed).",inputSchema:{type:"object",properties:{path:{type:"string",description:"The absolute path of the directory to create."}},required:["path"]}},{name:"filesystem__list_directory",description:"List files and subdirectories in a directory.",inputSchema:{type:"object",properties:{path:{type:"string",description:"The absolute path of the directory to list."}},required:["path"]}},{name:"filesystem__search_files",description:"Search for files matching a glob pattern.",inputSchema:{type:"object",properties:{pattern:{type:"string",description:'Glob pattern to match files (e.g., "**/*.ts").'},cwd:{type:"string",description:"Base directory to search in (optional)."}},required:["pattern"]}},{name:"filesystem__get_file_info",description:"Get metadata about a file or directory.",inputSchema:{type:"object",properties:{path:{type:"string",description:"The absolute path to get info for."}},required:["path"]}},{name:"filesystem__move_file",description:"Move or rename a file or directory.",inputSchema:{type:"object",properties:{source:{type:"string",description:"The source path."},destination:{type:"string",description:"The destination path."}},required:["source","destination"]}},{name:"filesystem__execute_command",description:"Execute a shell command on the local machine.",inputSchema:{type:"object",properties:{command:{type:"string",description:"The command to execute."},cwd:{type:"string",description:"Working directory for the command (optional)."},timeout:{type:"number",description:"Timeout in milliseconds (default: 30000, max: 300000)."}},required:["command"]}}];function wn(){return{name:"filesystem",systemPrompt:_o,tools:Eo}}function Re(e){return e.startsWith("~/")?Vt.join(bn.homedir(),e.slice(2)):e}function vt(e,t=1e5){return e.length<=t?e:e.slice(0,t)+`
|
|
28
28
|
|
|
29
|
-
... (truncated, ${e.length-t} more characters)`}async function
|
|
29
|
+
... (truncated, ${e.length-t} more characters)`}async function Tn(e,t){try{switch(e){case"filesystem__read_file":{let n=Re(t.path),r=await We.readFile(n,"utf-8");return{success:!0,result:vt(r)}}case"filesystem__read_multiple_files":{let n=t.paths.slice(0,10),r={};for(let i of n){let l=Re(i);try{let f=await We.readFile(l,"utf-8");r[i]=vt(f,5e4)}catch(f){r[i]={error:f instanceof Error?f.message:String(f)}}}return{success:!0,result:r}}case"filesystem__write_file":{let n=Re(t.path),r=t.content;return await We.mkdir(Vt.dirname(n),{recursive:!0}),await We.writeFile(n,r,"utf-8"),{success:!0,result:{written:n}}}case"filesystem__create_directory":{let n=Re(t.path);return await We.mkdir(n,{recursive:!0}),{success:!0,result:{created:n}}}case"filesystem__list_directory":{let n=Re(t.path);return{success:!0,result:(await We.readdir(n,{withFileTypes:!0})).map(l=>({name:l.name,type:l.isDirectory()?"directory":l.isFile()?"file":l.isSymbolicLink()?"symlink":"other"}))}}case"filesystem__search_files":{let n=t.pattern,r=t.cwd?Re(t.cwd):process.cwd(),i=await vo(n,{cwd:r,nodir:!0,maxDepth:10});return{success:!0,result:{files:i.slice(0,100),total:i.length,truncated:i.length>100}}}case"filesystem__get_file_info":{let n=Re(t.path),r=await We.stat(n);return{success:!0,result:{path:n,type:r.isDirectory()?"directory":r.isFile()?"file":"other",size:r.size,created:r.birthtime.toISOString(),modified:r.mtime.toISOString(),accessed:r.atime.toISOString(),mode:r.mode.toString(8)}}}case"filesystem__move_file":{let n=Re(t.source),r=Re(t.destination);return await We.mkdir(Vt.dirname(r),{recursive:!0}),await We.rename(n,r),{success:!0,result:{moved:{from:n,to:r}}}}case"filesystem__execute_command":{let n=t.command,r=t.cwd?Re(t.cwd):process.cwd(),i=Math.min(t.timeout||3e4,3e5);if(!Io.existsSync(r))return{success:!1,error:`Working directory does not exist: ${r}`};let{stdout:l,stderr:f}=await Po(n,{cwd:r,timeout:i,maxBuffer:10*1024*1024});return{success:!0,result:{stdout:vt(l,5e4),stderr:vt(f,5e4)}}}default:return{success:!1,error:`Unknown tool: ${e}`}}}catch(n){return{success:!1,error:n instanceof Error?n.message:String(n)}}}function zt(e){return e.startsWith("filesystem__")}function kn(){return[wn()]}function Pt(){return kn().flatMap(e=>e.tools)}function _t(){return kn().map(e=>e.systemPrompt).filter(Boolean).join(`
|
|
30
30
|
|
|
31
|
-
`)}function Ue(e){return zt(e)}async function Et(e,t){return zt(e)?
|
|
32
|
-
`){t.push(
|
|
33
|
-
|
|
31
|
+
`)}function Ue(e){return zt(e)}async function Et(e,t){return zt(e)?Tn(e,t):{success:!1,error:`Unknown client tool: ${e}`}}import{Box as ke,Text as K,useInput as pn}from"ink";import mn from"ink-spinner";import{useCallback as gn,useEffect as Ut,useRef as go,useState as ms}from"react";import{Box as Nt,Text as pt}from"ink";import{jsx as At,jsxs as mt}from"react/jsx-runtime";function Cn(e,t){return e.length<=t?e:t<=3?".".repeat(t):e.slice(0,t-3)+"..."}function $n({items:e,activeIndex:t,selectedIds:n,multiSelect:r=!1,visible:i,title:l,pageSize:f=10}){if(!i||e.length===0)return null;let m=process.stdout.columns??80,y=r?4:0,g=Math.max(20,m-2-2-y),j=Math.max(1,f),D=Math.floor(t/j)*j,I=Math.min(e.length,D+j),P=e.slice(D,I);return mt(Nt,{flexDirection:"column",marginBottom:1,children:[At(pt,{bold:!0,color:"cyan",children:l}),At(Nt,{borderStyle:"single",borderColor:"gray",flexDirection:"column",children:P.map((C,x)=>{let M=D+x===t,J=n?.has(C.id),X=Cn(C.name,g),oe=C.description?Cn(C.description,Math.max(0,g-y)):"",Y=r?" ".repeat(y):"";return mt(Nt,{paddingX:1,flexDirection:"column",children:[mt(Nt,{children:[r&&At(pt,{color:J?"green":"gray",children:J?"[\u2713] ":"[ ] "}),At(pt,{backgroundColor:M?"cyan":void 0,color:M?"black":J?"green":"white",bold:!0,children:X})]}),oe&&mt(pt,{dimColor:!0,children:[Y,"\xB7 ",oe]})]},C.id)})}),mt(pt,{dimColor:!0,children:[r?"\u2191\u2193 Navigate \xB7 Space Toggle \xB7 a All \xB7 n None \xB7 Enter Confirm \xB7 Esc Cancel":"\u2191\u2193 Navigate \xB7 Enter Select \xB7 Esc Cancel",e.length>j?` \xB7 Showing ${D+1}-${I} of ${e.length}`:""]})]})}import{Box as Xt,Text as gt}from"ink";import{jsx as ht,jsxs as Qt}from"react/jsx-runtime";function In({suggestions:e,activeIndex:t,visible:n}){return!n||e.length===0?null:Qt(Xt,{flexDirection:"column",marginBottom:1,children:[ht(Xt,{borderStyle:"single",borderColor:"gray",flexDirection:"column",children:e.map((r,i)=>{let l=i===t,f=r.aliases.length>0?` (${r.aliases.join(", ")})`:"";return Qt(Xt,{paddingX:1,children:[Qt(gt,{backgroundColor:l?"cyan":void 0,color:l?"black":"cyan",bold:l,children:["/",r.name]}),ht(gt,{dimColor:!0,children:f}),ht(gt,{children:" - "}),ht(gt,{color:l?"white":"gray",children:r.description})]},r.name)})}),ht(gt,{dimColor:!0,children:"\u2191\u2193 Navigate \xB7 Tab/Enter Select \xB7 Esc Cancel"})]})}import{Box as No,Text as Sn,useInput as Ao,useStdout as Do}from"ink";import{useCallback as vn,useEffect as Pn,useMemo as Zt,useRef as _n,useState as En}from"react";import{jsx as nn}from"react/jsx-runtime";function Dt(e,t){return e<0?0:e>t?t:e}function en(e){return Array.from(e)}function Rt(e){return/\s/.test(e)}function tn(e,t){let n=t;for(;n>0&&Rt(e[n-1]??"");)n-=1;for(;n>0&&!Rt(e[n-1]??"");)n-=1;return n}function Nn(e,t){let n=t;for(;n<e.length&&Rt(e[n]??"");)n+=1;for(;n<e.length&&!Rt(e[n]??"");)n+=1;return n}function Ro(e){let t=[],n=[],r=[],i=0;n.push(0),e.forEach((f,m)=>{if(f===`
|
|
32
|
+
`){t.push(r),r=[],i=m+1,n.push(i);return}r.push(f)}),t.push(r);let l=t.map(f=>f.length);return{lines:t,lineStarts:n,lineLengths:l}}function An(e,t,n){for(let i=0;i<t.length;i+=1){let l=t[i]??0,f=n[i]??0,m=l+f;if(e<=m)return{row:i,col:e-l}}let r=Math.max(0,t.length-1);return{row:r,col:n[r]??0}}var Lo=2;function Dn({value:e,onChange:t,onSubmit:n,onPaste:r,focus:i=!0,leadingOffset:l=0,multiline:f=!1}){let[m,y]=En(()=>en(e).length),g=_n(null),[j,D]=En(0),I=_n(null),{stdout:P}=Do(),C=Zt(()=>en(e),[e]),{lines:x,lineStarts:v,lineLengths:M}=Zt(()=>Ro(C),[C]),{row:J,col:X}=Zt(()=>An(m,v,M),[m,v,M]),oe=Math.max(1,(P?.columns??80)-l);Pn(()=>{g.current!==e?(y(C.length),I.current=null):y(O=>Dt(O,C.length)),g.current=e},[e,C.length]),Pn(()=>{D(O=>{let k=O;X<k?k=X:X>=k+oe&&(k=X-oe+1);let S=M[J]??0,R=X===S?S+1:S,G=Math.max(0,R-oe);return k>G&&(k=G),k<0&&(k=0),k})},[oe,X,J,M]);let Y=vn((O,k)=>{g.current=O,t(O),y(k),I.current=null},[t]),xe=vn(async(O,k)=>{if(!i)return;let{row:S,col:R}=An(m,v,M),G=x[S]??[],_=M[S]??0,ue=x.length>1;if(f&&(k.meta&&k.return||k.ctrl&&O==="j"||k.shift&&k.return)){let N=[...C.slice(0,m),`
|
|
33
|
+
`,...C.slice(m)].join("");Y(N,m+1);return}if(k.return){n(e);return}if(k.leftArrow){k.ctrl||k.meta?(R===0&&S>0?y(v[S]-1):y(v[S]+tn(G,R)),I.current=null):(R===0&&S>0?y(v[S]-1):y(N=>Dt(N-1,C.length)),I.current=null);return}if(k.rightArrow){k.ctrl||k.meta?(R>=_&&S<x.length-1?y(v[S+1]):y(v[S]+Nn(G,R)),I.current=null):(R>=_&&S<x.length-1?y(v[S+1]):y(N=>Dt(N+1,C.length)),I.current=null);return}if(f&&ue&&k.upArrow){let N=I.current??R,c=Math.max(0,S-1),ne=Math.min(N,M[c]??0);y((v[c]??0)+ne),I.current=N;return}if(f&&ue&&k.downArrow){let N=I.current??R,c=Math.min(x.length-1,S+1),ne=Math.min(N,M[c]??0);y((v[c]??0)+ne),I.current=N;return}if(k.ctrl){if(O==="a"){y(v[S]??0),I.current=null;return}if(O==="e"){y((v[S]??0)+_),I.current=null;return}if(O==="u"){if(R>0){let N=v[S]??0,c=[...C.slice(0,N),...C.slice(m)].join("");Y(c,N)}return}if(O==="k"){if(R<_){let N=(v[S]??0)+_,c=[...C.slice(0,m),...C.slice(N)].join("");Y(c,m)}return}if(O==="w"){if(R===0&&S>0){let c=[...C.slice(0,m-1),...C.slice(m)].join("");Y(c,m-1);return}let N=tn(G,R);if(N!==R){let c=(v[S]??0)+N,ne=[...C.slice(0,c),...C.slice(m)].join("");Y(ne,c)}return}if(O==="d"){if(m<C.length){let N=[...C.slice(0,m),...C.slice(m+1)].join("");Y(N,m)}return}return}if(k.meta){O==="b"?(R===0&&S>0?y(v[S]-1):y(v[S]+tn(G,R)),I.current=null):O==="f"&&(R>=_&&S<x.length-1?y(v[S+1]):y(v[S]+Nn(G,R)),I.current=null);return}if(k.backspace||k.delete){if(m<=0)return;let N=[...C.slice(0,m-1),...C.slice(m)].join("");Y(N,m-1);return}if(!(k.tab||k.escape)&&O.length>0){let N=f?O.replace(/\r\n/g,`
|
|
34
34
|
`).replace(/\r/g,`
|
|
35
35
|
`):O.replace(/\r?\n/g,"");if(!N||(N=N.replace(/^\x1b?\[200~/,"").replace(/\x1b?\[201~$/,""),!N))return;if((N.length>=Lo||N.includes(`
|
|
36
|
-
`))&&
|
|
37
|
-
`);return me(Le,{paddingLeft:Wn,flexDirection:"column",children:me(ze,{color:"yellow",children:t})})},On=an.memo(
|
|
36
|
+
`))&&r){let V=!1,$={text:N,preventDefault:()=>{V=!0}};if(await Promise.resolve(r($)),V)return}let ne=en(N),de=[...C.slice(0,m),...ne,...C.slice(m)].join("");Y(de,m+ne.length)}},[C,m,i,M,v,x,f,r,n,Y,e]);return Ao(xe,{isActive:i}),nn(No,{flexDirection:"column",children:x.map((O,k)=>{let S=k===J,G=(S&&X===O.length?[...O," "]:O).slice(j,j+oe),_=G.join("");if(!S)return nn(Sn,{children:_||" "},k);let ue=Dt(X-j,Math.max(0,G.length-1)),N=G.slice(0,ue).join(""),c=G[ue]??" ",ne=G.slice(ue+1).join(""),$=`${N}\x1B[7m${c}\x1B[27m${ne}`;return nn(Sn,{children:$},k)})})}import{Box as Le,Text as ze}from"ink";import an from"react";import{Text as _e}from"ink";import Fo from"react";import{Fragment as Wo,jsx as Ae,jsxs as Fn}from"react/jsx-runtime";var on=2,sn=1,rn=2,Oo=1,Rn=3,Ln=4,Bo=({text:e,defaultColor:t,linkColor:n,codeColor:r})=>{let i=t;if(!/[*_~`<[https?:]/.test(e))return Ae(_e,{color:i,children:e});let l=[],f=0,m=/(\*\*.*?\*\*|\*.*?\*|_.*?_|~~.*?~~|\[.*?\]\(.*?\)|`+.+?`+|<u>.*?<\/u>|https?:\/\/\S+)/g,y;for(;(y=m.exec(e))!==null;){y.index>f&&l.push(Ae(_e,{color:i,children:e.slice(f,y.index)},`t-${f}`));let g=y[0],j=null,D=`m-${y.index}`;try{if(g.startsWith("**")&&g.endsWith("**")&&g.length>on*2)j=Ae(_e,{bold:!0,color:i,children:g.slice(on,-on)},D);else if(g.length>sn*2&&(g.startsWith("*")&&g.endsWith("*")||g.startsWith("_")&&g.endsWith("_"))&&!/\w/.test(e.substring(y.index-1,y.index))&&!/\w/.test(e.substring(m.lastIndex,m.lastIndex+1))&&!/\S[./\\]/.test(e.substring(y.index-2,y.index))&&!/[./\\]\S/.test(e.substring(m.lastIndex,m.lastIndex+2)))j=Ae(_e,{italic:!0,color:i,children:g.slice(sn,-sn)},D);else if(g.startsWith("~~")&&g.endsWith("~~")&&g.length>rn*2)j=Ae(_e,{strikethrough:!0,color:i,children:g.slice(rn,-rn)},D);else if(g.startsWith("`")&&g.endsWith("`")&&g.length>Oo){let I=g.match(/^(`+)(.+?)\1$/s);I&&I[2]&&(j=Ae(_e,{color:r,children:I[2]},D))}else if(g.startsWith("[")&&g.includes("](")&&g.endsWith(")")){let I=g.match(/\[(.*?)\]\((.*?)\)/);if(I){let P=I[1],C=I[2];j=Fn(_e,{color:i,children:[P,Fn(_e,{color:n,children:[" (",C,")"]})]},D)}}else g.startsWith("<u>")&&g.endsWith("</u>")&&g.length>Rn+Ln-1?j=Ae(_e,{underline:!0,color:i,children:g.slice(Rn,-Ln)},D):g.match(/^https?:\/\//)&&(j=Ae(_e,{color:n,children:g},D))}catch{j=null}l.push(j??Ae(_e,{color:i,children:g},D)),f=m.lastIndex}return f<e.length&&l.push(Ae(_e,{color:i,children:e.slice(f)},`t-${f}`)),Ae(Wo,{children:l.filter(g=>g!==null)})},xt=Fo.memo(Bo);import{Fragment as Ho,jsx as me,jsxs as Un}from"react/jsx-runtime";var Uo=1,Wn=1,jo=1,Mo=1,Go=({content:e})=>{let t=e.join(`
|
|
37
|
+
`);return me(Le,{paddingLeft:Wn,flexDirection:"column",children:me(ze,{color:"yellow",children:t})})},On=an.memo(Go),qo=({itemText:e,type:t,marker:n,leadingWhitespace:r=""})=>{let i=t==="ol"?`${n}. `:`${n} `,l=i.length,f=r.length;return Un(Le,{paddingLeft:f+jo,flexDirection:"row",children:[me(Le,{width:l,children:me(ze,{children:i})}),me(Le,{flexGrow:Mo,children:me(ze,{wrap:"wrap",children:me(xt,{text:e,defaultColor:void 0,linkColor:"cyan",codeColor:"yellow"})})})]})},Bn=an.memo(qo),Ko=({text:e,renderMarkdown:t=!0})=>{if(!e)return null;if(!t)return me(Le,{paddingLeft:Wn,flexDirection:"column",children:me(ze,{wrap:"wrap",children:e})});let n=e.split(/\r?\n/),r=/^ *(#{1,4}) +(.*)/,i=/^ *(`{3,}|~{3,}) *(\w*?) *$/,l=/^([ \t]*)([-*+]) +(.*)/,f=/^([ \t]*)(\d+)\. +(.*)/,m=/^ *([-*_] *){3,} *$/,y=/^ *> ?(.*)/,g=[],j=!1,D=!0,I=[],P="";function C(x){x&&(g.push(x),D=!1)}return n.forEach((x,v)=>{let M=`line-${v}`;if(j){let k=x.match(i);k&&k[1].startsWith(P[0])&&k[1].length>=P.length?(C(me(On,{content:I},M)),j=!1,I=[],P=""):I.push(x);return}let J=x.match(i),X=x.match(r),oe=x.match(l),Y=x.match(f),xe=x.match(m),O=x.match(y);if(J)j=!0,P=J[1];else if(xe)C(me(Le,{children:me(ze,{dimColor:!0,children:"---"})},M));else if(X){let k=X[1].length,S=X[2],R=k<=2?"cyan":"blue";C(me(Le,{children:me(ze,{color:R,...(k===4?"italic":"bold")==="italic"?{italic:!0}:{bold:!0},children:me(xt,{text:S,defaultColor:R,linkColor:"cyan",codeColor:"yellow"})})},M))}else if(O){let k=O[1];C(me(Le,{paddingLeft:1,children:Un(ze,{dimColor:!0,children:["> ",me(xt,{text:k,defaultColor:"gray",linkColor:"cyan",codeColor:"yellow"})]})},M))}else if(oe){let k=oe[1],S=oe[2],R=oe[3];C(me(Bn,{itemText:R,type:"ul",marker:S,leadingWhitespace:k},M))}else if(Y){let k=Y[1],S=Y[2],R=Y[3];C(me(Bn,{itemText:R,type:"ol",marker:S,leadingWhitespace:k},M))}else x.trim().length===0?D||(g.push(me(Le,{height:Uo},`spacer-${v}`)),D=!0):C(me(Le,{children:me(ze,{wrap:"wrap",children:me(xt,{text:x,defaultColor:void 0,linkColor:"cyan",codeColor:"yellow"})})},M))}),j&&C(me(On,{content:I},"line-eof")),me(Ho,{children:g})},ln=an.memo(Ko);import{execFile as Jo}from"child_process";import Yo from"fs";import at from"fs/promises";import jn from"os";import Ft from"path";import{promisify as Vo}from"util";var Lt=Vo(Jo);async function zo(){let e=Ft.join(jn.tmpdir(),`entrydesk-clipboard-${Date.now()}.png`);try{let t=`
|
|
38
38
|
set imageData to the clipboard as "PNGf"
|
|
39
39
|
set fileRef to open for access POSIX file "${e}" with write permission
|
|
40
40
|
set eof fileRef to 0
|
|
@@ -48,135 +48,135 @@ You have access to filesystem tools that allow you to interact with the user's l
|
|
|
48
48
|
$img.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
|
|
49
49
|
[System.Convert]::ToBase64String($ms.ToArray())
|
|
50
50
|
}
|
|
51
|
-
`,{stdout:t}=await Lt("powershell.exe",["-command",e]),n=t.trim();if(!n)return;let
|
|
52
|
-
`);return i?t||i.length<=200?i:i.slice(0,200)+"...":"(result)"}let
|
|
53
|
-
${
|
|
54
|
-
`))}else if(
|
|
51
|
+
`,{stdout:t}=await Lt("powershell.exe",["-command",e]),n=t.trim();if(!n)return;let r=Buffer.from(n,"base64");return r.length===0?void 0:{buffer:r,mime:"image/png"}}catch{return}}async function Qo(){try{let{stdout:e}=await Lt("wl-paste",["-t","image/png"],{encoding:"buffer",maxBuffer:52428800});if(e&&e.length>0)return{buffer:e,mime:"image/png"}}catch{}try{let{stdout:e}=await Lt("xclip",["-selection","clipboard","-t","image/png","-o"],{encoding:"buffer",maxBuffer:52428800});if(e&&e.length>0)return{buffer:e,mime:"image/png"}}catch{}}async function Mn(){let e=jn.platform();if(e==="darwin")return zo();if(e==="win32")return Xo();if(e==="linux")return Qo()}var Zo=new Set([".png",".jpg",".jpeg",".gif",".webp",".bmp",".ico",".heic",".heif",".pdf",".txt",".md",".rtf",".csv",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".key",".pages",".numbers",".odt",".ods",".odp",".json",".xml",".yaml",".yml"]);function Gn(e){let t=Ft.extname(e).toLowerCase();return Zo.has(t)}function es(e){let t=Ft.extname(e).toLowerCase();return{".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp",".ico":"image/x-icon",".heic":"image/heic",".heif":"image/heif",".txt":"text/plain",".md":"text/markdown",".pdf":"application/pdf",".csv":"text/csv",".rtf":"application/rtf",".doc":"application/msword",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".ppt":"application/vnd.ms-powerpoint",".pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation",".key":"application/vnd.apple.keynote",".pages":"application/vnd.apple.pages",".numbers":"application/vnd.apple.numbers",".odt":"application/vnd.oasis.opendocument.text",".ods":"application/vnd.oasis.opendocument.spreadsheet",".odp":"application/vnd.oasis.opendocument.presentation",".json":"application/json",".xml":"application/xml",".yaml":"text/yaml",".yml":"text/yaml"}[t]||"application/octet-stream"}function Ot(e){let t=e.trim();return t.startsWith("file://")&&(t=decodeURIComponent(t.slice(7))),(t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"'))&&(t=t.slice(1,-1)),t=t.replace(/\\(.)/g,"$1"),t}async function qn(e){let t=Ot(e);if(/^https?:\/\//.test(t))return!1;try{return await at.access(t),!0}catch{return!1}}async function Kn(e){let t=Ot(e);try{if(!(await at.stat(t)).isFile())return;let r=await at.readFile(t),i=es(t),l=Ft.basename(t);return{buffer:r,mimeType:i,filename:l}}catch{return}}var Ee="\x1B[2m",ee="\x1B[0m",Te="\x1B[36m",lt="\x1B[32m",Hn="\x1B[31m",Ze="\x1B[38;2;59;91;204m",cn="\x1B[38;2;126;200;248m",un="\x1B[38;2;244;196;78m";import{useState as je}from"react";import{v4 as Jn}from"uuid";function Yn(e,t){let[n,r]=je({status:"loading"}),[i,l]=je([]),[f,m]=je(""),[y,g]=je(()=>e||Jn()),[j,D]=je(t),[I,P]=je(!!e),[C,x]=je(null),[v,M]=je(""),[J,X]=je(!1),oe=xe=>{l(O=>[...O,{role:"system",content:xe}])};return{state:n,setState:r,messages:i,setMessages:l,input:f,setInput:m,taskId:y,setTaskId:g,currentTaskTitle:j,setCurrentTaskTitle:D,hasPersistedTask:I,setHasPersistedTask:P,credentials:C,setCredentials:x,currentResponse:v,setCurrentResponse:M,fullOutput:J,setFullOutput:X,addSystemMessage:oe,startNewTask:xe=>{let O=Jn();g(O),D(void 0),P(!1),l([]),xe&&oe(xe)}}}import{useEffect as ts,useState as Vn}from"react";function zn(e){let[t,n]=Vn(null),[r,i]=Vn(!0);return ts(()=>{let l=!1;async function f(){try{let m=await Ve();if(l)return;n({accessToken:m.accessToken,workspaceId:m.workspaceId}),i(!1)}catch(m){if(l)return;if(m instanceof Qe){if(m.code==="not-logged-in"){e({status:"not-logged-in"}),i(!1);return}if(m.code==="no-workspace"){e({status:"no-workspace"}),i(!1);return}}let y=m instanceof Error?m.message:"Failed to authenticate";e({status:"error",message:y}),i(!1)}}return f(),()=>{l=!0}},[e]),{credentials:t,loading:r}}import{useEffect as ns,useState as yt}from"react";function Xn(e){let[t,n]=yt([]),[r,i]=yt([]),[l,f]=yt([]),[m,y]=yt([]),[g,j]=yt(!1);return ns(()=>{if(!e)return;let D=!1;j(!0);async function I(){if(e)try{let P=new ye,[C,x,v,M]=await Promise.all([P.getConnectors(e.accessToken,e.workspaceId),P.getModels(e.accessToken,e.workspaceId),P.getAgents(e.accessToken,e.workspaceId),P.getModelProviders(e.accessToken,e.workspaceId)]);if(D)return;n(C.connectors),i(x.models),f(v.agents),y(M.providers??[])}catch{}finally{D||j(!1)}}return I(),()=>{D=!0}},[e]),{availableConnectors:t,availableModels:r,availableAgents:l,modelProviders:m,loading:g}}import ct from"fs";import Zn from"path";import{useCallback as os}from"react";import{v4 as ss}from"uuid";function Qn(e,t){if(!e)return"(no result)";if(typeof e!="object"){let i=String(e);return t||i.length<=200?i:i.slice(0,200)+"..."}let n=e;if("structuredContent"in n&&n.structuredContent){let i=n.structuredContent;if(i.stdout&&typeof i.stdout=="string"){let l=i.stdout.trim();return t||l.length<=200?l:l.slice(0,200)+"..."}}if("content"in n&&Array.isArray(n.content)){let i=n.content.filter(l=>l.type==="text"&&l.text).map(l=>l.text).join(`
|
|
52
|
+
`);return i?t||i.length<=200?i:i.slice(0,200)+"...":"(result)"}let r=JSON.stringify(e,null,t?2:void 0);return t||r.length<=200?r:r.slice(0,200)+"..."}function et(e,t=!1){let n=[];for(let r of e)if(r.type==="text"&&r.text)n.push(r.text);else if(r.type==="reasoning"&&r.text)t?n.push(`${Ee}[Thinking]
|
|
53
|
+
${r.text}${ee}`):n.push(`${Ee}[Thinking...]${ee}`);else if(r.type==="tool-call"&&r.toolName){let i=[];if(i.push(`${Te}\u250C\u2500 Tool: ${r.toolName}${ee}`),r.args){let l=JSON.stringify(r.args,null,t?2:void 0),f=t||l.length<=100?l:l.slice(0,100)+"...";i.push(`${Ee}\u2502 Args: ${f}${ee}`)}r.result!==void 0?(i.push(`${lt}\u2502 Result: ${Qn(r.result,t)}${ee}`),i.push(`${Te}\u2514\u2500 completed${ee}`)):i.push(`${Te}\u2514\u2500${ee}`),n.push(i.join(`
|
|
54
|
+
`))}else if(r.type.startsWith("tool-")&&r.type!=="tool-call"){let i=r.title||r.type.slice(5).replace(/__/g," "),l=[];if(l.push(`${Te}\u250C\u2500 Tool: ${i}${ee}`),r.input){let f=JSON.stringify(r.input,null,t?2:void 0),m=t||f.length<=100?f:f.slice(0,100)+"...";l.push(`${Ee}\u2502 Input: ${m}${ee}`)}r.output!==void 0&&r.state==="output-available"?(l.push(`${lt}\u2502 Output: ${Qn(r.output,t)}${ee}`),l.push(`${Te}\u2514\u2500 completed${ee}`)):r.state==="error"?l.push(`${Te}\u2514\u2500 failed${ee}`):l.push(`${Te}\u2514\u2500${ee}`),n.push(l.join(`
|
|
55
55
|
`))}return n.join(`
|
|
56
56
|
|
|
57
|
-
`).trim()}var Bt=class{pendingToolCalls=new Map;hasPending(){return this.pendingToolCalls.size>0}hasExecuting(){for(let t of this.pendingToolCalls.values())if(t.status==="executing")return!0;return!1}clear(t){this.pendingToolCalls.delete(t)}buildToolDisplay(){if(this.pendingToolCalls.size===0)return"";let t=[];for(let[,n]of this.pendingToolCalls){let
|
|
57
|
+
`).trim()}var Bt=class{pendingToolCalls=new Map;hasPending(){return this.pendingToolCalls.size>0}hasExecuting(){for(let t of this.pendingToolCalls.values())if(t.status==="executing")return!0;return!1}clear(t){this.pendingToolCalls.delete(t)}buildToolDisplay(){if(this.pendingToolCalls.size===0)return"";let t=[];for(let[,n]of this.pendingToolCalls){let r=n.toolName.replace(/__/g," "),i=`
|
|
58
58
|
|
|
59
|
-
${
|
|
59
|
+
${Te}\u250C\u2500 Tool: ${r}${ee}`;if(n.args){let l=n.args.length>100?n.args.slice(0,100)+"...":n.args;i+=`
|
|
60
60
|
${Ee}\u2502 Input: ${l}${ee}`}if(n.output){let l=n.output.length>150?n.output.slice(0,150)+"...":n.output;i+=`
|
|
61
61
|
${lt}\u2502 Output: ${l}${ee}`}else if(n.status==="executing"){let l=n.startedAt??Date.now(),f=Math.floor((Date.now()-l)/1e3);i+=`
|
|
62
|
-
${
|
|
63
|
-
${
|
|
62
|
+
${Te}\u2502${ee} (executing... ${f}s)`}else n.status==="preparing"&&(i+=`
|
|
63
|
+
${Te}\u2502${ee} (preparing...)`);t.push(i)}return t.join("")}flushPending(t){if(this.pendingToolCalls.size===0)return t;for(let[n,r]of this.pendingToolCalls){let i=r.toolName.replace(/__/g," "),l=typeof r.args=="string"&&r.args.length>100?r.args.slice(0,100)+"...":r.args||"";t+=`
|
|
64
64
|
|
|
65
|
-
${
|
|
65
|
+
${Te}\u250C\u2500 Tool: ${i}${ee}`,l&&(t+=`
|
|
66
66
|
${Ee}\u2502 Input: ${l}${ee}`),t+=`
|
|
67
|
-
${
|
|
68
|
-
`,this.pendingToolCalls.delete(n)}return t}handleToolInputStart(t){return t.toolCallId&&t.toolName?(this.pendingToolCalls.set(t.toolCallId,{toolName:t.toolName,args:"",status:"preparing"}),this.buildToolDisplay()):null}handleToolInputDelta(t){if(t.toolCallId&&t.inputTextDelta){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.args=(n.args||"")+t.inputTextDelta,n.status="executing",n.startedAt??=Date.now(),this.buildToolDisplay()}return null}handleToolOutputStart(t){if(t.toolCallId){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.output="",n.status="output",this.buildToolDisplay()}return null}handleToolOutputDelta(t){if(t.toolCallId&&t.outputTextDelta){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.output=(n.output||"")+t.outputTextDelta,this.buildToolDisplay()}return null}handleToolOutputEnd(t,n){if(!t.toolCallId)return null;let
|
|
67
|
+
${Te}\u2514\u2500 completed${ee}
|
|
68
|
+
`,this.pendingToolCalls.delete(n)}return t}handleToolInputStart(t){return t.toolCallId&&t.toolName?(this.pendingToolCalls.set(t.toolCallId,{toolName:t.toolName,args:"",status:"preparing"}),this.buildToolDisplay()):null}handleToolInputDelta(t){if(t.toolCallId&&t.inputTextDelta){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.args=(n.args||"")+t.inputTextDelta,n.status="executing",n.startedAt??=Date.now(),this.buildToolDisplay()}return null}handleToolOutputStart(t){if(t.toolCallId){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.output="",n.status="output",this.buildToolDisplay()}return null}handleToolOutputDelta(t){if(t.toolCallId&&t.outputTextDelta){let n=this.pendingToolCalls.get(t.toolCallId);if(n)return n.output=(n.output||"")+t.outputTextDelta,this.buildToolDisplay()}return null}handleToolOutputEnd(t,n){if(!t.toolCallId)return null;let r=this.pendingToolCalls.get(t.toolCallId);if(!r)return null;let i=r.toolName.replace(/__/g," "),l=typeof r.args=="string"&&r.args.length>100?r.args.slice(0,100)+"...":r.args||"",f=(r.output||"").length>200?(r.output||"").slice(0,200)+"...":r.output||"";return n+=`
|
|
69
69
|
|
|
70
|
-
${
|
|
70
|
+
${Te}\u250C\u2500 Tool: ${i}${ee}`,l&&(n+=`
|
|
71
71
|
${Ee}\u2502 Input: ${l}${ee}`),n+=`
|
|
72
72
|
${lt}\u2502 Output: ${f}${ee}`,n+=`
|
|
73
|
-
${
|
|
73
|
+
${Te}\u2514\u2500 completed${ee}
|
|
74
74
|
`,this.pendingToolCalls.delete(t.toolCallId),{fullResponse:n,toolDisplay:this.buildToolDisplay()}}handleToolError(t,n){if(!t.toolCallId)return null;let i=(this.pendingToolCalls.get(t.toolCallId)?.toolName||t.toolName||"Tool").replace(/__/g," "),l=t.errorText||"Unknown error",f=l.length>200?l.slice(0,200)+"...":l;return n+=`
|
|
75
75
|
|
|
76
|
-
${
|
|
76
|
+
${Te}\u250C\u2500 Tool: ${i}${ee}`,n+=`
|
|
77
77
|
${Hn}\u2502 Error: ${f}${ee}`,n+=`
|
|
78
|
-
${
|
|
79
|
-
`,this.pendingToolCalls.delete(t.toolCallId),{fullResponse:n,toolDisplay:this.buildToolDisplay()}}};var bt=Zn.join(process.env.HOME||"/tmp",".entrydesk","stream-debug.log");function
|
|
80
|
-
DATA: ${JSON.stringify(t,null,2)}`),
|
|
81
|
-
`;try{ct.appendFileSync(bt,
|
|
82
|
-
`)}}catch{}}function Wt(e){if(!e)return{};if(typeof e=="string")try{return JSON.parse(e)}catch{return{}}return typeof e=="object"?e:{}}function eo({
|
|
83
|
-
`);de=F.pop()||"";for(let h of F)if(h.trim()!=="data: [DONE]"&&h.startsWith("data: "))try{let a=JSON.parse(h.slice(6));switch(
|
|
84
|
-
${
|
|
85
|
-
[Executing ${a.toolName} locally...]`)}else
|
|
86
|
-
`);fe.push({type:`tool-${a.toolName}`,toolName:a.toolName,toolCallId:a.toolCallId,input:a.args,output:Q,isError:h.isError})}}if(
|
|
87
|
-
`);de=b.pop()||"";for(let Q of b)if(Q.trim()!=="data: [DONE]"&&Q.startsWith("data: "))try{let A=JSON.parse(Q.slice(6));switch(
|
|
88
|
-
${
|
|
78
|
+
${Te}\u2514\u2500 failed${ee}
|
|
79
|
+
`,this.pendingToolCalls.delete(t.toolCallId),{fullResponse:n,toolDisplay:this.buildToolDisplay()}}};var bt=Zn.join(process.env.HOME||"/tmp",".entrydesk","stream-debug.log");function se(e,t){if(!process.env.DEBUG)return;let r=`[${new Date().toISOString()}] ${e}`;t!==void 0&&(r+=`
|
|
80
|
+
DATA: ${JSON.stringify(t,null,2)}`),r+=`
|
|
81
|
+
`;try{ct.appendFileSync(bt,r)}catch{}}function rs(){try{if(ct.existsSync(bt)&&ct.unlinkSync(bt),process.env.DEBUG){let e=Zn.dirname(bt);ct.existsSync(e)||ct.mkdirSync(e,{recursive:!0}),ct.writeFileSync(bt,`=== Debug session started at ${new Date().toISOString()} ===
|
|
82
|
+
`)}}catch{}}function Wt(e){if(!e)return{};if(typeof e=="string")try{return JSON.parse(e)}catch{return{}}return typeof e=="object"?e:{}}function eo({taskId:e,credentials:t,currentAgentId:n,currentModel:r,activeConnectorIds:i,sandbox:l,webSearch:f,imageGeneration:m,chart:y,localTools:g,fullOutput:j,setMessages:D,setState:I,setCurrentResponse:P,setCredentials:C,setHasPersistedTask:x,getFileIds:v,clearFiles:M}){let J=g?Pt():void 0,X=g?_t():void 0;return{sendMessage:os(async(Y,xe,O)=>{rs(),se("=== sendMessage called ===",{text:Y,localTools:g,clientToolsCount:J?.length});let k=xe||t?.accessToken,S=O||t?.workspaceId;if(!k||!S)try{let _=await Ve();k=_.accessToken,S=_.workspaceId,C(_)}catch(_){if(_ instanceof Qe){if(_.code==="not-logged-in"){I({status:"not-logged-in"});return}if(_.code==="no-workspace"){I({status:"no-workspace"});return}}let ue=_ instanceof Error?_.message:"Authentication failed";I({status:"error",message:ue});return}else try{let _=await xn();_!==k&&(k=_,C({accessToken:_,workspaceId:S}))}catch(_){if(_ instanceof Qe&&_.code==="not-logged-in"){I({status:"not-logged-in"});return}let ue=_ instanceof Error?_.message:"Authentication failed";I({status:"error",message:ue});return}D(_=>[..._,{role:"user",content:Y}]),I({status:"sending"}),P("");let R=null,G=null;try{let _=new ye,ue=v?.()??[],N={id:e,message:{id:ss(),createdAt:new Date,role:"user",parts:[{type:"text",text:Y}]}};ue.length>0&&(N.fileIds=ue),n?N.agentId=n:(r&&(N.model=r),N.connectorIds=i??[],N.enableSandbox=l,N.enableWebSearch=f,N.enableImageGeneration=m,N.enableChart=y),J&&(N.clientTools=J),X&&(N.clientToolSystemPrompt=X);let c=await _.task(k,S,N);if(!c.ok){let U=await c.text();throw new Error(`API error ${c.status}: ${U}`)}if(!c.body)throw new Error("No response body from server");R=c.body.getReader();let ne=new TextDecoder,de="",V="",$="",be="",B="",te="",Ce="",W=new Bt,H=[],L=[],fe=[],pe=()=>{let U=W.hasExecuting();U&&!G?G=setInterval(()=>{if(!W.hasExecuting()){G&&(clearInterval(G),G=null);return}P(V+W.buildToolDisplay())},1e3):!U&&G&&(clearInterval(G),G=null)};for(;;){let{done:U,value:Z}=await R.read();if(U)break;de+=ne.decode(Z,{stream:!0});let F=de.split(`
|
|
83
|
+
`);de=F.pop()||"";for(let h of F)if(h.trim()!=="data: [DONE]"&&h.startsWith("data: "))try{let a=JSON.parse(h.slice(6));switch(se(`SSE event received: ${a.type}`,a),a.type){case"reasoning-start":be=a.id||"0",$="";break;case"reasoning-delta":a.delta&&($+=a.delta,P(`${Ee}[Thinking...]${ee}
|
|
84
|
+
${$}`)),a.providerMetadata?.anthropic?.signature&&(B=a.providerMetadata.anthropic.signature);break;case"reasoning-end":if($){let b={type:"reasoning",id:be,text:$,state:"done"};B&&(b.providerMetadata={anthropic:{signature:B}}),L.push(b),se("Added reasoning to messageParts",{reasoningLength:$.length,hasSignature:!!B,messagePartsCount:L.length})}$="",B="",P("");break;case"text-delta":a.delta&&(W.hasPending()&&(V=W.flushPending(V)),V+=a.delta,te+=a.delta,P(V));break;case"tool-input-start":{let b=W.handleToolInputStart(a);b&&P(V+b),pe();break}case"tool-input-delta":{let b=W.handleToolInputDelta(a);b&&P(V+b),pe();break}case"tool-call":case"tool-input-available":{if(se(`=== Tool event: ${a.type} ===`,{toolCallId:a.toolCallId,toolName:a.toolName,localTools:g,isClientToolResult:a.toolName?Ue(a.toolName):"no toolName",args:a.args,input:a.input}),a.toolCallId&&a.toolName){let b=Wt(a.args??a.input);L.push({type:a.type,toolCallId:a.toolCallId,toolName:a.toolName,args:b}),se("Added tool to messageParts",{messagePartsCount:L.length})}if(g&&a.toolCallId&&a.toolName&&Ue(a.toolName)){let b=Wt(a.args??a.input);H.push({toolCallId:a.toolCallId,toolName:a.toolName,args:b}),se("Added to pendingClientTools",{pendingCount:H.length,pendingClientTools:H}),P(V+W.buildToolDisplay()+`
|
|
85
|
+
[Executing ${a.toolName} locally...]`)}else se("NOT added to pendingClientTools - conditions not met",{localTools:g,hasToolCallId:!!a.toolCallId,hasToolName:!!a.toolName,isClientTool:a.toolName?Ue(a.toolName):!1});break}case"tool-output-start":{let b=W.handleToolOutputStart(a);b&&P(V+b),pe();break}case"tool-output-delta":{let b=W.handleToolOutputDelta(a);b&&P(V+b),pe();break}case"tool-output-end":{let b=W.handleToolOutputEnd(a,V);b&&(V=b.fullResponse,P(V+b.toolDisplay)),pe();break}case"tool-input-error":case"tool-output-error":{let b=W.handleToolError(a,V);b&&(V=b.fullResponse,P(V+b.toolDisplay)),pe();break}case"start":a.messageId&&(Ce=a.messageId,se("Captured messageId from start event",{messageId:Ce}));break;case"start-step":case"text-start":case"text-end":case"finish-step":case"message-metadata":case"finish":break;case"error":a.errorText&&console.error("Stream error:",a.errorText);break}}catch{}}if(te){let U=L.findIndex(F=>F.type!=="reasoning"),Z=U===-1?L.length:U;L.splice(Z,0,{type:"text",text:te}),se("Added accumulated text to messageParts",{textLength:te.length,insertIndex:Z})}for(se("=== Initial stream ended ===",{pendingClientToolsCount:H.length,pendingClientTools:H,messagePartsCount:L.length,messageParts:L.map(U=>({type:U.type,toolCallId:U.toolCallId,toolName:U.toolName}))});H.length>0;){se("=== Starting pending tools execution loop ===",{pendingCount:H.length});let U=[];for(let h of H){se(`Executing tool: ${h.toolName}`,{toolCallId:h.toolCallId,args:h.args}),W.handleToolInputStart({toolCallId:h.toolCallId,toolName:h.toolName}),W.handleToolInputDelta({toolCallId:h.toolCallId,inputTextDelta:JSON.stringify(h.args)}),P(V+W.buildToolDisplay()),pe();let a=await Et(h.toolName,h.args);se(`Tool execution result: ${h.toolName}`,{success:a.success,resultPreview:a.success?JSON.stringify(a.result).slice(0,200):a.error});let b=a.success?JSON.stringify(a.result):a.error||"Unknown error";if(U.push({toolCallId:h.toolCallId,toolName:h.toolName,content:[{type:"text",text:b}],isError:!a.success}),a.success){W.handleToolOutputStart({toolCallId:h.toolCallId}),W.handleToolOutputDelta({toolCallId:h.toolCallId,outputTextDelta:JSON.stringify(a.result).slice(0,200)});let Q=W.handleToolOutputEnd({toolCallId:h.toolCallId},V);Q&&(V=Q.fullResponse)}else{let Q=W.handleToolError({toolCallId:h.toolCallId,errorText:a.error},V);Q&&(V=Q.fullResponse)}P(V+W.buildToolDisplay()),pe()}H.length=0;for(let h of U){let a=L.find(b=>(b.type==="tool-input-available"||b.type==="tool-call")&&b.toolCallId===h.toolCallId);if(a){let b=[];for(let A of h.content)A.type==="text"?b.push(A.text):A.type==="image"?b.push("[Image]"):A.type==="audio"?b.push("[Audio]"):(A.type==="resource"||A.type==="resource_link")&&b.push("[Resource]");let Q=b.join(`
|
|
86
|
+
`);fe.push({type:`tool-${a.toolName}`,toolName:a.toolName,toolCallId:a.toolCallId,input:a.args,output:Q,isError:h.isError})}}if(se("=== Sending clientToolResults for continuation ===",{toolResultsCount:U.length,toolResults:U.map(h=>({toolCallId:h.toolCallId,toolName:h.toolName,isError:h.isError}))}),R)try{R.releaseLock()}catch{}let Z={id:e,clientToolResults:U};n?Z.agentId=n:(r&&(Z.model=r),Z.connectorIds=i??[],Z.enableSandbox=l,Z.enableWebSearch=f,Z.enableImageGeneration=m,Z.enableChart=y),J&&(Z.clientTools=J),X&&(Z.clientToolSystemPrompt=X),se("=== Sending continuation request ===",{taskId:e,hasAgentId:!!Z.agentId,hasModel:!!Z.model,clientToolResultsCount:U.length});let F=await _.task(k,S,Z);if(se("=== Continuation response received ===",{ok:F.ok,status:F.status}),!F.ok){let h=await F.text();throw new Error(`Continuation failed: ${F.status}: ${h}`)}if(!F.body)break;for(se("=== Processing continuation stream ==="),R=F.body.getReader(),L.length=0,te="",$="",be="",B="";;){let{done:h,value:a}=await R.read();if(h){se("=== Continuation stream done ===");break}de+=ne.decode(a,{stream:!0});let b=de.split(`
|
|
87
|
+
`);de=b.pop()||"";for(let Q of b)if(Q.trim()!=="data: [DONE]"&&Q.startsWith("data: "))try{let A=JSON.parse(Q.slice(6));switch(se(`Continuation SSE: ${A.type}`,A),A.type){case"reasoning-start":be=A.id||"0",$="";break;case"reasoning-delta":A.delta&&($+=A.delta,P(`${Ee}[Thinking...]${ee}
|
|
88
|
+
${$}`)),A.providerMetadata?.anthropic?.signature&&(B=A.providerMetadata.anthropic.signature);break;case"reasoning-end":if($){let he={type:"reasoning",id:be,text:$,state:"done"};B&&(he.providerMetadata={anthropic:{signature:B}}),L.push(he),se("Continuation: Added reasoning to messageParts",{reasoningLength:$.length,hasSignature:!!B,messagePartsCount:L.length})}$="",B="",P(V);break;case"text-delta":A.delta&&(V+=A.delta,te+=A.delta,P(V));break;case"tool-call":case"tool-input-available":if(A.toolCallId&&A.toolName){let he=Wt(A.args??A.input);L.push({type:A.type,toolCallId:A.toolCallId,toolName:A.toolName,args:he})}if(g&&A.toolCallId&&A.toolName&&Ue(A.toolName)){let he=Wt(A.args??A.input);H.push({toolCallId:A.toolCallId,toolName:A.toolName,args:he}),se("Continuation: Added to pendingClientTools",{pendingCount:H.length})}break;case"finish":se("Continuation finish event",A);break}}catch{}}if(te){let h=L.findIndex(b=>b.type!=="reasoning"),a=h===-1?L.length:h;L.splice(a,0,{type:"text",text:te})}se("=== Continuation stream processing complete ===",{pendingClientToolsCount:H.length,messagePartsCount:L.length,fullResponseLength:V.length})}if(g&&J&&J.length>0){let U=[];for(let F of fe)U.push({type:String(F.type),title:String(F.toolName).replace(/__/g," "),input:F.input,output:F.output,state:F.isError?"error":"output-available"});for(let F of L)F.type==="text"&&F.text&&U.push({type:"text",text:F.text});let Z=et(U,j);se("=== Using formatted parts for local tools ===",{executedToolsCount:fe.length,textPartsCount:L.filter(F=>F.type==="text").length,contentLength:Z.length}),D(F=>[...F,{role:"assistant",content:Z,parts:U}])}else{se("=== Fetching message from API ===",{fullResponseLength:V.length,fullResponsePreview:V.slice(0,200)});try{let{messages:U}=await _.getMessages(k,S,e,10);se("=== API messages received ===",{count:U.length,roles:U.map(F=>F.role)});let Z=U.find(F=>F.role==="assistant");if(Z){let F=Z.parts,h=et(F,j);se("=== Setting message from API ===",{partsCount:F.length,partTypes:F.map(a=>a.type),contentLength:h.length,contentPreview:h.slice(0,200)}),D(a=>[...a,{role:"assistant",content:h,parts:F}])}else se("=== No assistant message found, using fallback ==="),D(F=>[...F,{role:"assistant",content:V}])}catch(U){se("=== API fetch failed, using fallback ===",{error:U instanceof Error?U.message:String(U)}),D(Z=>[...Z,{role:"assistant",content:V}])}}se("=== Message handling complete ==="),P(""),I({status:"ready"}),x(!0),ue.length>0&&M?.()}catch(_){se("=== ERROR ===",{message:_ instanceof Error?_.message:String(_),stack:_ instanceof Error?_.stack:void 0});let ue=_ instanceof Error?_.message:"Failed to send message";I({status:"error",message:ue})}finally{if(G&&(clearInterval(G),G=null),R)try{R.releaseLock()}catch{}}},[t,e,n,r,i,l,f,m,y,g,J,X,j,D,I,P,C,x,v,M])}}import{useState as wt}from"react";var to={sandbox:{id:"sandbox",apiKey:"sandbox",name:"Sandbox",description:"Code execution",type:"server"},webSearch:{id:"webSearch",apiKey:"web_search",name:"Web Search",description:"Search the web",type:"server"},imageGeneration:{id:"imageGeneration",apiKey:"image_generation",name:"Image Generation",description:"Generate images",type:"server"},chart:{id:"chart",apiKey:"chart",name:"Chart",description:"Create charts",type:"server"},fileSystem:{id:"fileSystem",apiKey:"file_system",name:"FileSystem",description:"Local file operations",type:"client"}},no=new Map(Object.values(to).map(e=>[e.apiKey,e.name]));function oo(){return Object.values(to)}function so(e,t,n,r,i){let[l,f]=wt(e),[m,y]=wt(t),[g,j]=wt(n),[D,I]=wt(r),[P,C]=wt(i);return{sandbox:l,setSandbox:f,webSearch:m,setWebSearch:y,imageGeneration:g,setImageGeneration:j,chart:D,setChart:I,fileSystem:P,setFileSystem:C,capabilityLabelMap:no}}import{useEffect as is,useState as as}from"react";function ro(e,t){let[n,r]=as(null);return is(()=>{let i=!1;async function l(){if(!e||!t){r(null);return}try{let m=await new ye().getAgent(t.accessToken,t.workspaceId,e);i||r(m)}catch{i||r(null)}}return l(),()=>{i=!0}},[e,t]),{currentAgentDetails:n}}import{useState as dn}from"react";function io(e,t,n){let[r,i]=dn(e),[l,f]=dn(t),[m,y]=dn(n);return{currentModel:r,setCurrentModel:i,currentAgentId:l,setCurrentAgentId:f,activeConnectorIds:m,setActiveConnectorIds:y}}import{useApp as cs,useInput as us}from"ink";import{useCallback as Me,useRef as ds,useState as Ie}from"react";import{spawn as ls}from"child_process";function ao(e){return new Promise((t,n)=>{let r,i;process.platform==="darwin"?(r="open",i=[e]):process.platform==="win32"?(r="cmd",i=["/c","start","",e]):(r="xdg-open",i=[e]);let l=ls(r,i,{stdio:"ignore",detached:!0});l.once("error",f=>{n(f)}),l.once("spawn",()=>{l.unref(),t()})})}var lo=[{name:"help",aliases:["h","?"],description:"Show available commands"},{name:"clear",aliases:["cls","new"],description:"Start a new task"},{name:"model",aliases:["m"],description:"Show/switch model",hasArgs:!0},{name:"agent",aliases:["a"],description:"Show/switch agent",hasArgs:!0},{name:"skills",aliases:["sk"],description:"List skills",hasArgs:!0},{name:"schedules",aliases:["sch"],description:"List schedules",hasArgs:!0},{name:"connectors",aliases:["conn"],description:"Select connectors"},{name:"capabilities",aliases:["cap"],description:"Select capabilities"},{name:"tasks",aliases:["c"],description:"Switch to another task"},{name:"workspace",aliases:["ws"],description:"List/switch workspace",hasArgs:!0},{name:"budget",aliases:["bg"],description:"View/set workspace budget",hasArgs:!0},{name:"usage",aliases:["u"],description:"View current month usage"},{name:"status",aliases:["s"],description:"Show session status"},{name:"profile",aliases:["p"],description:"Manage profiles",hasArgs:!0},{name:"open-in-browser",aliases:[],description:"Open current task in browser"},{name:"share",aliases:[],description:"Get share link for current task"},{name:"delete",aliases:["del"],description:"Delete current task"},{name:"quit",aliases:["exit","q"],description:"Exit task"}];function co(e){if(!e.startsWith("/"))return[];let t=e.slice(1).toLowerCase();return t?lo.filter(n=>n.name.startsWith(t)||n.aliases.some(r=>r.startsWith(t))):lo}function uo(e){let t=e.trim();if(!t.startsWith("/"))return null;let n=t.slice(1).split(/\s+/),r=n[0]?.toLowerCase(),i=n.slice(1).join(" ");switch(r){case"help":case"h":case"?":return{type:"help"};case"clear":case"cls":case"new":return{type:"clear"};case"model":case"m":return{type:"model",value:i||void 0};case"agent":case"a":return{type:"agent",value:i||void 0};case"skills":case"sk":return{type:"skills",value:i||void 0};case"schedules":case"sch":return{type:"schedules",value:i||void 0};case"connectors":case"conn":return{type:"connectors"};case"capabilities":case"cap":return{type:"capabilities"};case"tasks":case"c":return{type:"tasks"};case"workspace":case"ws":return{type:"workspace",value:i||void 0};case"budget":case"bg":return{type:"budget",value:i||void 0};case"usage":case"u":return{type:"usage"};case"status":case"s":return{type:"status"};case"profile":case"p":return{type:"profile",value:i||void 0};case"open-in-browser":return{type:"open-in-browser"};case"share":return{type:"share"};case"delete":case"del":return{type:"delete"};case"quit":case"exit":case"q":return{type:"quit"};default:return{type:"unknown",input:t}}}var fo=`Available commands:
|
|
89
89
|
/help, /h, /? Show this help message
|
|
90
|
-
/clear, /cls, /new Start a new
|
|
90
|
+
/clear, /cls, /new Start a new task
|
|
91
91
|
/model [name], /m Show current model or switch to [name]
|
|
92
92
|
/agent [name], /a Show current agent or switch to [name]
|
|
93
93
|
/skills [name], /sk List skills or show details for [name]
|
|
94
94
|
/schedules [id], /sch List schedules or show details for [id]
|
|
95
95
|
/connectors, /conn Select active connectors
|
|
96
96
|
/capabilities, /cap Select capabilities (sandbox, web, etc.)
|
|
97
|
-
/
|
|
97
|
+
/tasks, /c Switch to another task
|
|
98
98
|
/workspace [id], /ws List or switch workspace
|
|
99
99
|
/budget [amount], /bg View or set workspace budget
|
|
100
100
|
/usage, /u View current month usage (top 10 by cost)
|
|
101
101
|
/status, /s Show current session status
|
|
102
102
|
/profile [args], /p Manage profiles (list/show/use/create/delete/rename/clone)
|
|
103
|
-
/open-in-browser Open current
|
|
104
|
-
/share Get share link for current
|
|
105
|
-
/delete, /del Delete current
|
|
103
|
+
/open-in-browser Open current task in browser
|
|
104
|
+
/share Get share link for current task
|
|
105
|
+
/delete, /del Delete current task
|
|
106
106
|
/quit, /exit, /q Exit interactive mode
|
|
107
107
|
|
|
108
108
|
Note: For detailed usage with sorting/limits, use: entrydesk usage --help
|
|
109
109
|
|
|
110
110
|
Keyboard shortcuts:
|
|
111
111
|
Ctrl+O Toggle full output mode
|
|
112
|
-
Ctrl+C Exit`;function fn(e){if(e.type==="no-repeat")return"No repeat";let{interval:t}=e;switch(t.unit){case"minutes":return`Every ${t.every} min`;case"hours":return`Every ${t.every} hr`;case"days":return`Every ${t.every} day at ${String(t.time.hour).padStart(2,"0")}:${String(t.time.minute).padStart(2,"0")}`;case"weeks":return`Every ${t.every} week`;case"months":return`Every ${t.every} month`;default:return"Unknown"}}function po({input:e,setInput:t,
|
|
113
|
-
Available: ${
|
|
114
|
-
Available: ${
|
|
112
|
+
Ctrl+C Exit`;function fn(e){if(e.type==="no-repeat")return"No repeat";let{interval:t}=e;switch(t.unit){case"minutes":return`Every ${t.every} min`;case"hours":return`Every ${t.every} hr`;case"days":return`Every ${t.every} day at ${String(t.time.hour).padStart(2,"0")}:${String(t.time.minute).padStart(2,"0")}`;case"weeks":return`Every ${t.every} week`;case"months":return`Every ${t.every} month`;default:return"Unknown"}}function po({input:e,setInput:t,taskId:n,setTaskId:r,currentTaskTitle:i,setCurrentTaskTitle:l,currentModel:f,setCurrentModel:m,currentAgentId:y,setCurrentAgentId:g,currentAgentDetails:j,setCurrentAgentDetails:D,activeConnectorIds:I,setActiveConnectorIds:P,sandbox:C,setSandbox:x,webSearch:v,setWebSearch:M,imageGeneration:J,setImageGeneration:X,chart:oe,setChart:Y,fileSystem:xe,setFileSystem:O,availableModels:k,availableAgents:S,availableConnectors:R,messages:G,hasPersistedTask:_,setHasPersistedTask:ue,setMessages:N,addSystemMessage:c,startNewTask:ne,sendMessage:de,setFullOutput:V,credentials:$,setCredentials:be,setState:B,defaultCapabilities:te,capabilityLabelMap:Ce,hasUploadingFiles:W=!1}){let{exit:H}=cs(),[L,fe]=Ie([]),[pe,U]=Ie(0),[Z,F]=Ie(!1),[h,a]=Ie(null),[b,Q]=Ie([]),[A,he]=Ie(0),[Ge,qe]=Ie(new Set),[ve,Ke]=Ie(new Set),[Kt,kt]=Ie([]),[Ne,tt]=Ie([]),[Fe,Ct]=Ie([]),[He,Ht]=Ie([]),[De,Oe]=Ie(null),[$t,nt]=Ie(""),Xe=ds(!1),[Je,ot]=Ie(!1),st=Me(async()=>{if(!$)return[];let w=new ye,d=[],o;do{let s=await w.listAvailableSkills($.accessToken,$.workspaceId,{limit:100,nextKey:o});d.push(...s.skills),o=s.nextKey}while(o);return tt(d),d},[$]),rt=Me(async()=>{if(!$)return[];let w=new ye,d=[],o;do{let s=await w.getSchedules($.accessToken,$.workspaceId,{limit:100,nextKey:o});d.push(...s.schedules),o=s.nextKey}while(o);return Ct(d),d},[$]),$e=Me(async w=>{if(w==="model"){if(k.length===0){c("No models available.");return}let d=k.map(s=>({id:s.id,name:s.name,description:s.description}));Q(d);let o=f?d.findIndex(s=>s.id===f):-1;he(Math.max(o,0)),a("model")}else if(w==="agent"){if(S.length===0){c("No agents available.");return}let d=S.map(s=>({id:s.id,name:s.name,description:s.description}));Q(d);let o=y?d.findIndex(s=>s.id===y):-1;he(Math.max(o,0)),a("agent")}else if(w==="skills"){let d=Ne;if(d.length===0)try{d=await st()}catch{c("Failed to load skills.");return}if(d.length===0){c("No skills available.");return}let o=d.map(s=>({id:s.id,name:s.name,description:s.description}));Q(o),he(0),a("skills")}else if(w==="schedules"){let d=Fe;if(d.length===0)try{d=await rt()}catch{c("Failed to load schedules.");return}if(d.length===0){c("No schedules found.");return}let o=d.map(s=>({id:s.id,name:s.name,description:`${s.agent.name} - ${s.isActive?"Active":"Paused"}`}));Q(o),he(0),a("schedules")}else if(w==="connectors"){if(R.length===0){c("No connectors available.");return}let d=R.map(o=>({id:o.id,name:o.name}));Q(d),he(0),qe(new Set(I??[])),a("connectors")}else if(w==="capabilities"){let d=oo().map(s=>({id:s.id,name:s.name,description:s.description}));Q(d),he(0);let o=new Set;C&&o.add("sandbox"),v&&o.add("webSearch"),J&&o.add("imageGeneration"),oe&&o.add("chart"),xe&&o.add("fileSystem"),Ke(o),a("capabilities")}else if(w==="tasks"){if(!$){c("Not authenticated.");return}try{let d=new ye,{tasks:o}=await d.getTasks($.accessToken,$.workspaceId,20);if(o.length===0){c("No tasks available.");return}kt(o);let s=o.map(T=>({id:T.id,name:T.title||"Untitled",description:new Date(T.createdAt).toLocaleDateString()}));Q(s);let u=s.findIndex(T=>T.id===n);he(Math.max(u,0)),a("tasks")}catch{c("Failed to load tasks.")}}else if(w==="profile"){let d=ce.getProfileNames(),o=ce.getCurrentProfileName(),s=d.map(T=>({id:T,name:T,description:T===o?"(current)":void 0}));Q(s);let u=s.findIndex(T=>T.id===o);he(Math.max(u,0)),a("profile")}F(!1),fe([])},[k,S,Ne,Fe,R,I,f,y,st,rt,C,v,J,oe,xe,$,n,c]),le=Me(w=>{let d=ge.getAll(w);m(d.model?.default),g(void 0),D(null);let o=d.connectors?.defaults;P(o&&o.length>0?o:void 0);let s=d.capabilities;x(s?.sandbox??te.sandbox),M(s?.webSearch??te.webSearch),X(s?.imageGeneration??te.imageGeneration),Y(s?.chart??te.chart);let u=d.localTools;O(u?.fileSystem??te.fileSystem)},[m,g,D,P,x,M,X,Y,O,te]),Be=Me(async()=>{try{let w=await Ve();be({accessToken:w.accessToken,workspaceId:w.workspaceId}),B({status:"ready"})}catch(w){if(be(null),w instanceof Qe){if(w.code==="not-logged-in"){B({status:"not-logged-in"});return}if(w.code==="no-workspace"){B({status:"no-workspace"});return}}let d=w instanceof Error?w.message:"Failed to authenticate";B({status:"error",message:d})}},[be,B]),it=Me(async w=>{switch(w.type){case"help":return c(fo),!0;case"clear":return ne("Started a new task."),!0;case"model":{if(w.value){let d=w.value.toLowerCase(),o=k.find(s=>s.id.toLowerCase()===d||s.name.toLowerCase().includes(d));if(o)y?ne(`Switched to model: ${o.name} (new task)`):c(`Switched to model: ${o.name}`),m(o.id),g(void 0),D(null),ge.setDefaultModel(o.id);else{let s=k.map(u=>u.name).join(", ");c(`Model "${w.value}" not found.
|
|
113
|
+
Available: ${s||"none"}`)}}else{let d=k.find(o=>o.id===f)?.name||f;c(f?`Current model: ${d}`:"No model selected. Using agent mode.")}return!0}case"agent":{if(!w.value)return S.length===0?(c("No agents available."),!0):($e("agent"),!0);let d=w.value.toLowerCase(),o=S.find(s=>s.id.toLowerCase()===d||s.name.toLowerCase().includes(d));if(o)o.id!==y?ne(`Switched to agent: ${o.name} (new task)`):c(`Switched to agent: ${o.name}`),g(o.id),m(void 0);else{let s=S.map(u=>u.name).join(", ");c(`Agent "${w.value}" not found.
|
|
114
|
+
Available: ${s||"none"}`)}return!0}case"skills":{if(!w.value)return $e("skills"),!0;let d=w.value.toLowerCase();return(Ne.length>0?Promise.resolve(Ne):st().catch(()=>[])).then(s=>{let u=s.find(T=>T.id.toLowerCase()===d||T.name.toLowerCase().includes(d));c(u?`Skill: ${u.name}
|
|
115
115
|
${u.description}
|
|
116
116
|
Provider: ${u.provider}
|
|
117
117
|
Author: ${u.author.name}
|
|
118
|
-
ID: ${u.id}`:`Skill "${w.value}" not found.`)}),!0}case"schedules":{if(!w.value)return
|
|
118
|
+
ID: ${u.id}`:`Skill "${w.value}" not found.`)}),!0}case"schedules":{if(!w.value)return $e("schedules"),!0;let d=w.value.toLowerCase();return(Fe.length>0?Promise.resolve(Fe):rt().catch(()=>[])).then(s=>{let u=s.find(T=>T.id.toLowerCase()===d||T.name.toLowerCase().includes(d));if(u){let T=u.nextRunAt?new Date(u.nextRunAt).toLocaleString():"-";c(`Schedule: ${u.name}
|
|
119
119
|
Agent: ${u.agent.name}
|
|
120
120
|
Status: ${u.isActive?"Active":"Paused"}
|
|
121
121
|
Repeat: ${fn(u.config)}
|
|
122
|
-
Next Run: ${
|
|
123
|
-
ID: ${u.id}`)}else c(`Schedule "${w.value}" not found.`)}),!0}case"connectors":{if(y){let o=j?.connectors??[];if(o.length===0)c("No agent connectors.");else{let
|
|
122
|
+
Next Run: ${T}
|
|
123
|
+
ID: ${u.id}`)}else c(`Schedule "${w.value}" not found.`)}),!0}case"connectors":{if(y){let o=j?.connectors??[];if(o.length===0)c("No agent connectors.");else{let s=o.map(u=>` - ${u.name}`).join(`
|
|
124
124
|
`);c(`Agent connectors:
|
|
125
|
-
${
|
|
125
|
+
${s}`)}return!0}let d=R.filter(o=>I?.includes(o.id));if(d.length===0)c("No active connectors.");else{let o=d.map(s=>` - ${s.name}`).join(`
|
|
126
126
|
`);c(`Active connectors:
|
|
127
|
-
${o}`)}return!0}case"capabilities":{if(y){let
|
|
128
|
-
${
|
|
129
|
-
`)}`:"No agent capabilities."),!0}let d=[];return
|
|
127
|
+
${o}`)}return!0}case"capabilities":{if(y){let s=(j?.capabilities??[]).map(u=>Ce.get(u)??u);return c(s.length>0?`Agent capabilities:
|
|
128
|
+
${s.map(u=>` - ${u}`).join(`
|
|
129
|
+
`)}`:"No agent capabilities."),!0}let d=[];return C&&d.push("Sandbox"),v&&d.push("Web Search"),J&&d.push("Image Generation"),oe&&d.push("Chart"),xe&&d.push("FileSystem"),c(d.length>0?`Active capabilities:
|
|
130
130
|
${d.map(o=>` - ${o}`).join(`
|
|
131
|
-
`)}`:"No capabilities enabled."),!0}case"
|
|
132
|
-
ID: ${
|
|
131
|
+
`)}`:"No capabilities enabled."),!0}case"tasks":return c(i?`Current task: ${i}`:`Current task: ${n.slice(0,8)}...`),!0;case"workspace":{if(!$)return c("Not authenticated."),!0;let d=new ye;if(!w.value){try{let{workspaces:s}=await d.getWorkspaces($.accessToken);if(s.length===0)c("No workspaces found.");else{let u=s.map(T=>` ${T.id===$.workspaceId?"* ":" "}${T.name}
|
|
132
|
+
ID: ${T.id}`);c(`Workspaces:
|
|
133
133
|
${u.join(`
|
|
134
|
-
`)}`)}}catch(
|
|
135
|
-
`))}catch(o){c(`Failed to get usage: ${o instanceof Error?o.message:"Unknown error"}`)}return!0}case"status":{let d=ce.getCurrentProfileName(),o=f?
|
|
136
|
-
`))}).catch(()=>{let p=[`Profile: ${d}`,"Not logged in",_?`
|
|
137
|
-
`))}),!0}case"profile":{let d=w.value?w.value.split(/\s+/).filter(Boolean):[];if(d.length===0)return
|
|
138
|
-
`)),!0}if(o==="current")return c(`Current profile: ${p}`),!0;if(o==="show"){let q=ae(
|
|
139
|
-
`)),!0}if(o==="create"){let q=
|
|
140
|
-
Switched to profile: ${Pe.currentProfile} (new
|
|
141
|
-
Switched to profile: ${Ye} (new
|
|
142
|
-
URL: ${p}`)}return!0}case"share":{if(
|
|
143
|
-
Type /help for available commands.`),!0;default:return!1}},[c,
|
|
134
|
+
`)}`)}}catch(s){c(`Failed to load workspaces: ${s instanceof Error?s.message:"Unknown error"}`)}return!0}let o=w.value;try{let{workspaces:s}=await d.getWorkspaces($.accessToken),u=s.find(T=>T.id===o);if(!u)return c(`Workspace not found: ${o}`),!0;await ft.saveWorkspaceId(o),c(`Switched to workspace: ${u.name}`),c("Please restart the task to apply changes.")}catch(s){c(`Failed to switch workspace: ${s instanceof Error?s.message:"Unknown error"}`)}return!0}case"budget":{if(!$)return c("Not authenticated."),!0;let d=new ye;if(!w.value){try{let u=await d.getBudget($.accessToken,$.workspaceId);u.budget===null?c("No budget set for this workspace."):c(`Current budget: $${u.budget}`)}catch(u){c(`Failed to get budget: ${u instanceof Error?u.message:"Unknown error"}`)}return!0}let o=w.value.toLowerCase();if(o==="clear"||o==="null"){try{await d.updateBudget($.accessToken,$.workspaceId,null),c("Budget cleared.")}catch(u){c(`Failed to clear budget: ${u instanceof Error?u.message:"Unknown error"}`)}return!0}let s=parseFloat(o);if(isNaN(s)||s<0)return c("Invalid budget amount. Must be a positive number."),!0;try{await d.updateBudget($.accessToken,$.workspaceId,o),c(`Budget set to: $${o}`)}catch(u){c(`Failed to set budget: ${u instanceof Error?u.message:"Unknown error"}`)}return!0}case"usage":{if(!$)return c("Not authenticated."),!0;let d=new ye;try{let o=[],s,u=0,T=10;do{let we=await d.getMonthlyUsages($.accessToken,$.workspaceId,{nextKey:s,limit:20});if(o.push(...we.monthlyUsages),s=we.nextKey,u++,u>=T){c(`Warning: Showing first ${o.length} entries (pagination limit reached)`);break}}while(s);if(o.length===0)return c("No usage data found for this workspace."),!0;let p=0,E=0;for(let we of o)p+=parseFloat(we.totalCost),E+=we.operationCount;let ae=[...o].toSorted((we,Ye)=>parseFloat(Ye.totalCost)-parseFloat(we.totalCost)),q=10,re=ae.slice(0,q),Pe=[`Total Cost: $${p.toFixed(2)}`,`Total Operations: ${E.toLocaleString()}`,`Users: ${o.length}`,"",`Top ${re.length} Users by Cost:`,...re.map(we=>` ${we.user.name}: $${parseFloat(we.totalCost).toFixed(2)} (${we.operationCount.toLocaleString()} ops)`)];o.length>q&&(Pe.push("",`... and ${o.length-q} more users`),Pe.push("Use CLI command for full list: entrydesk usage --limit <n> --sort-by <cost|operations>")),c(Pe.join(`
|
|
135
|
+
`))}catch(o){c(`Failed to get usage: ${o instanceof Error?o.message:"Unknown error"}`)}return!0}case"status":{let d=ce.getCurrentProfileName(),o=f?k.find(p=>p.id===f)?.name||f:null,s=y?S.find(p=>p.id===y)?.name||y:null,u=I?R.filter(p=>I.includes(p.id)).map(p=>p.name):[],T=[];return C&&T.push("Sandbox"),v&&T.push("Web Search"),J&&T.push("Image Gen"),oe&&T.push("Chart"),xe&&T.push("FileSystem"),ft.getEmail().then(p=>{let E=[`Profile: ${d}${d!=="default"?" (non-default)":""}`,p?`Logged in as: ${p}`:"Not logged in",$?.workspaceId?`Workspace: ${$.workspaceId}`:null,_?`Task ID: ${n}`:null,o?`Model: ${o}`:null,s?`Agent: ${s}`:null,`Connectors: ${u.length>0?u.join(", "):"none"}`,`Capabilities: ${T.length>0?T.join(", "):"none"}`].filter(Boolean);c(E.join(`
|
|
136
|
+
`))}).catch(()=>{let p=[`Profile: ${d}`,"Not logged in",_?`Task ID: ${n}`:null,o?`Model: ${o}`:null,s?`Agent: ${s}`:null,`Connectors: ${u.length>0?u.join(", "):"none"}`,`Capabilities: ${T.length>0?T.join(", "):"none"}`].filter(Boolean);c(p.join(`
|
|
137
|
+
`))}),!0}case"profile":{let d=w.value?w.value.split(/\s+/).filter(Boolean):[];if(d.length===0)return $e("profile"),!0;let o=d[0]?.toLowerCase()||"list",s=d[1],u=d[2],T=ce.getProfileNames(),p=ce.getCurrentProfileName(),E=ce.getOverrideProfile(),ae=(q,re=!1)=>{if(q)return q;if(re&&T.length===1)return T[0];throw new Error("Profile name is required when multiple profiles exist.")};try{if(o==="list"){let q=[`Profiles (${T.length}):`];for(let re of T){let Pe=re===p?" (current)":"";q.push(` ${re}${Pe}`)}return c(q.join(`
|
|
138
|
+
`)),!0}if(o==="current")return c(`Current profile: ${p}`),!0;if(o==="show"){let q=ae(s,!0),re=ge.getAll(q),Pe=await ft.getAll(q),we=!!Pe?.accessToken,Ye=re.capabilities?Object.entries(re.capabilities).filter(([,Jt])=>Jt).map(([Jt])=>Jt):[],ko=re.connectors?.defaults&&re.connectors.defaults.length>0?re.connectors.defaults.join(", "):"unset",Co=[`Profile: ${q}${q===p?" (current)":""}`,`API URL: ${re.apiUrl??"default"}`,`Hub URL: ${re.hubUrl??"default"}`,`Model: ${re.model?.default??"unset"}`,`Connectors: ${ko}`,`Capabilities: ${Ye.length>0?Ye.join(", "):"none"}`,we?`Logged in as: ${Pe?.email??"unknown"}`:"Not logged in",we&&Pe?.workspaceId?`Workspace ID: ${Pe.workspaceId}`:null].filter(Boolean);return c(Co.join(`
|
|
139
|
+
`)),!0}if(o==="create"){let q=s||ce.DEFAULT_PROFILE;return ce.createProfile(q),c(`Profile created: ${q}`),!0}if(o==="use"||o==="switch"){let q=ae(s,!0);return ce.setOverrideProfile(q),ce.setCurrentProfile(q),le(q),await Be(),ne(`Switched to profile: ${q} (new task)`),!0}if(o==="delete"||o==="remove"||o==="rm"){let q=ae(s,!0),re=q===p,Pe=ce.deleteProfile(q),we=`Profile deleted: ${q}`;if(re)ce.setOverrideProfile(Pe.currentProfile),le(Pe.currentProfile),await Be(),ne(`${we}
|
|
140
|
+
Switched to profile: ${Pe.currentProfile} (new task)`);else if(E===q){let Ye=ce.getCurrentProfileName();ce.setOverrideProfile(Ye),le(Ye),await Be(),ne(`${we}
|
|
141
|
+
Switched to profile: ${Ye} (new task)`)}else c(we);return!0}if(o==="rename"||o==="move"||o==="mv"){let q=ae(s,!0);if(!u)throw new Error("New profile name is required.");let re=ce.renameProfile(q,u);return c(`Profile renamed: ${q} -> ${u}`),E===q?(ce.setOverrideProfile(u),le(u)):re.currentProfile===u&&le(u),!0}if(o==="clone"||o==="copy"){let q=ae(s,!0);if(!u)throw new Error("Target profile name is required.");let re=ge.getAll(q);return ce.createProfile(u),ge.setAll(re,u),await ft.clear(u),c(`Profile cloned: ${q} -> ${u}`),!0}c(`Unknown profile command: ${o}`)}catch(q){let re=q instanceof Error?q.message:"Unknown error";c(`Profile error: ${re}`)}return!0}case"open-in-browser":{let d=Yt().hubUrl.replace(/\/$/,""),o=_||G.some(E=>E.role!=="system"),s=$?`/${$.workspaceId}`:"",u=o?`${s}/task/${n}`:`${s}/task/new`,T=y?`?agentId=${encodeURIComponent(y)}`:"",p=`${d}${u}${T}`;try{await ao(p),c(`Opened in browser: ${p}`)}catch(E){c(`Failed to open browser: ${E instanceof Error?E.message:"Unknown error"}
|
|
142
|
+
URL: ${p}`)}return!0}case"share":{if(!$)return c("Not authenticated."),!0;if(!(_||G.some(o=>o.role!=="system")))return c("No conversation to share. Start a task first."),!0;try{let s=await new ye().createTaskShare($.accessToken,$.workspaceId,n,"public"),T=`${Yt().hubUrl.replace(/\/$/,"")}/share/${s.id}`;c(`Share link: ${T}`)}catch(o){c(`Failed to create share link: ${o instanceof Error?o.message:"Unknown error"}`)}return!0}case"delete":return $?_?(ot(!0),c("Delete this task? (y/N)"),!0):(c("No task to delete."),!0):(c("Not authenticated."),!0);case"quit":return H(),!0;case"unknown":return c(`Unknown command: ${w.input}
|
|
143
|
+
Type /help for available commands.`),!0;default:return!1}},[c,k,S,R,Ne,Fe,f,y,I,C,v,J,oe,xe,n,i,H,$e,ne,Ce,j,_,G,st,rt,N,m,g,D,m,le,Be]),It=Me(w=>{if(Xe.current=!1,Je){(w===""||w.startsWith("/"))&&(t(w),w.startsWith("/")&&ot(!1));return}if(t(w),nt(w),De!==null&&Oe(null),h&&(a(null),Q([])),w.startsWith("/")&&!w.includes(" ")){let d=co(w);fe(d),U(0),F(d.length>0)}else F(!1),fe([])},[h,De,Je,t]),dt=Me((w,d=!1)=>{if(w>=0&&w<L.length){let o=L[w];F(!1),fe([]),o.name==="model"?(t("/model "),$e("model")):o.name==="agent"?(t("/agent "),$e("agent")):o.name==="skills"?(t("/skills "),$e("skills")):o.name==="schedules"?(t("/schedules "),$e("schedules")):o.name==="connectors"?(t("/connectors "),$e("connectors")):o.name==="capabilities"?(t("/capabilities "),$e("capabilities")):o.name==="tasks"?(t("/tasks "),$e("tasks")):o.name==="profile"?(t("/profile "),$e("profile")):d?(t(""),it({type:o.name})):t(`/${o.name}`)}},[L,$e,t,it]),St=Me(async w=>{Xe.current=!1;let d=w.trim();if(!d||Je)return;if(h==="model"&&b.length>0){let s=b[A];s&&(y?ne(`Switched to model: ${s.name} (new task)`):c(`Switched to model: ${s.name}`),m(s.id),g(void 0),D(null)),a(null),Q([]),t("");return}if(h==="agent"&&b.length>0){let s=b[A];s&&(s.id!==y?ne(`Switched to agent: ${s.name} (new task)`):c(`Switched to agent: ${s.name}`),g(s.id),m(void 0)),a(null),Q([]),t("");return}if(h==="skills"&&b.length>0){let s=b[A];if(s){let u=Ne.find(T=>T.id===s.id);u&&c(`Skill: ${u.name}
|
|
144
144
|
${u.description}
|
|
145
145
|
Provider: ${u.provider}
|
|
146
146
|
Author: ${u.author.name}
|
|
147
|
-
ID: ${u.id}`)}a(null),Q([]),t("");return}if(h==="schedules"&&b.length>0){let
|
|
147
|
+
ID: ${u.id}`)}a(null),Q([]),t("");return}if(h==="schedules"&&b.length>0){let s=b[A];if(s){let u=Fe.find(T=>T.id===s.id);if(u){let T=u.nextRunAt?new Date(u.nextRunAt).toLocaleString():"-";c(`Schedule: ${u.name}
|
|
148
148
|
Agent: ${u.agent.name}
|
|
149
149
|
Status: ${u.isActive?"Active":"Paused"}
|
|
150
150
|
Repeat: ${fn(u.config)}
|
|
151
|
-
Next Run: ${
|
|
152
|
-
ID: ${u.id}`)}}a(null),Q([]),t("");return}if(h==="connectors"){let
|
|
153
|
-
${
|
|
154
|
-
Provider: ${
|
|
155
|
-
Author: ${
|
|
156
|
-
ID: ${
|
|
157
|
-
Agent: ${
|
|
158
|
-
Status: ${
|
|
159
|
-
Repeat: ${fn(
|
|
151
|
+
Next Run: ${T}
|
|
152
|
+
ID: ${u.id}`)}}a(null),Q([]),t("");return}if(h==="connectors"){let s=Array.from(Ge);P(s.length>0?s:void 0),ge.setDefaultConnectorIds(s);let u=R.filter(T=>Ge.has(T.id)).map(T=>T.name);c(u.length>0?`Active connectors: ${u.join(", ")}`:"All connectors disabled."),a(null),Q([]),t("");return}if(h==="capabilities"){let s=ve.has("sandbox"),u=ve.has("webSearch"),T=ve.has("imageGeneration"),p=ve.has("chart"),E=ve.has("fileSystem");x(s),M(u),X(T),Y(p),O(E),ge.setCapabilities({sandbox:s,webSearch:u,imageGeneration:T,chart:p}),ge.setLocalTools({fileSystem:E});let ae=[];s&&ae.push("Sandbox"),u&&ae.push("Web Search"),T&&ae.push("Image Generation"),p&&ae.push("Chart"),E&&ae.push("FileSystem"),c(ae.length>0?`Active capabilities: ${ae.join(", ")}`:"All capabilities disabled."),a(null),Q([]),t("");return}if(h==="profile"&&b.length>0){let s=b[A];if(s){let u=ce.getCurrentProfileName();s.id!==u?(ce.setOverrideProfile(s.id),ce.setCurrentProfile(s.id),le(s.id),Be(),ne(`Switched to profile: ${s.name}`)):c(`Already using profile: ${s.name}`)}a(null),Q([]),t("");return}if(Z&&L.length>0){dt(pe,!0);return}Oe(null),nt(""),Ht(s=>s.length>0&&s.at(-1)===d?s:[...s,d]);let o=uo(d);if(o){await it(o),t(""),F(!1);return}if(W){c("Please wait for file uploads to complete.");return}t(""),F(!1),de(d)},[de,it,Z,L,pe,dt,h,b,A,Ge,ve,R,Ne,Fe,c,t,y,ne,m,g,D,P,x,M,X,Y,O,W,le,Be,Je,$,_,n]);return us((w,d)=>{if(d.ctrl&&w==="c"){if(e.length>0){It(""),Xe.current=!0,c("Press Ctrl+C again to exit.");return}if(Xe.current){H();return}H();return}if(d.ctrl&&w==="o"){V(o=>!o);return}if(Je){if(d.escape||d.return||w==="n"||w==="N"){ot(!1),t(""),c("Task deletion cancelled.");return}if(w==="y"||w==="Y"){ot(!1),t(""),$&&_&&new ye().deleteTask($.accessToken,$.workspaceId,n).then(()=>{ne("Task deleted. Started a new task.")}).catch(s=>{c(`Failed to delete task: ${s.message||"Unknown error"}`)});return}return}if(h&&b.length>0){if(d.upArrow){he(o=>o<=0?b.length-1:o-1);return}if(d.downArrow){he(o=>o>=b.length-1?0:o+1);return}if(d.escape){a(null),Q([]),t("");return}if(d.return){if(h==="model"){let o=b[A];o&&(y?ne(`Switched to model: ${o.name} (new task)`):c(`Switched to model: ${o.name}`),m(o.id),g(void 0),D(null),ge.setDefaultModel(o.id))}else if(h==="agent"){let o=b[A];o&&(o.id!==y?ne(`Switched to agent: ${o.name} (new task)`):c(`Switched to agent: ${o.name}`),g(o.id),m(void 0))}else if(h==="skills"){let o=b[A];if(o){let s=Ne.find(u=>u.id===o.id);s&&c(`Skill: ${s.name}
|
|
153
|
+
${s.description}
|
|
154
|
+
Provider: ${s.provider}
|
|
155
|
+
Author: ${s.author.name}
|
|
156
|
+
ID: ${s.id}`)}}else if(h==="schedules"){let o=b[A];if(o){let s=Fe.find(u=>u.id===o.id);if(s){let u=s.nextRunAt?new Date(s.nextRunAt).toLocaleString():"-";c(`Schedule: ${s.name}
|
|
157
|
+
Agent: ${s.agent.name}
|
|
158
|
+
Status: ${s.isActive?"Active":"Paused"}
|
|
159
|
+
Repeat: ${fn(s.config)}
|
|
160
160
|
Next Run: ${u}
|
|
161
|
-
ID: ${
|
|
162
|
-
`)||He.length===0)return;if(De===null){nt(e);let
|
|
163
|
-
`)||De===null)return;if(De>=He.length-1){Oe(null),t(
|
|
164
|
-
`),
|
|
165
|
-
`).map(n=>n.length))}function
|
|
161
|
+
ID: ${s.id}`)}}}else if(h==="connectors"){let o=Array.from(Ge);P(o.length>0?o:void 0),ge.setDefaultConnectorIds(o);let s=R.filter(u=>Ge.has(u.id)).map(u=>u.name);c(s.length>0?`Active connectors: ${s.join(", ")}`:"All connectors disabled.")}else if(h==="capabilities"){let o=ve.has("sandbox"),s=ve.has("webSearch"),u=ve.has("imageGeneration"),T=ve.has("chart"),p=ve.has("fileSystem");x(o),M(s),X(u),Y(T),O(p),ge.setCapabilities({sandbox:o,webSearch:s,imageGeneration:u,chart:T}),ge.setLocalTools({fileSystem:p});let E=[];o&&E.push("Sandbox"),s&&E.push("Web Search"),u&&E.push("Image Generation"),T&&E.push("Chart"),p&&E.push("FileSystem"),c(E.length>0?`Active capabilities: ${E.join(", ")}`:"All capabilities disabled.")}else if(h==="tasks"){let o=b[A];if(o){let s=Kt.find(u=>u.id===o.id);s&&$&&(r(s.id),l(s.title||void 0),ue(!0),new ye().getMessages($.accessToken,$.workspaceId,s.id,20).then(({messages:T})=>{let p=T.filter(E=>E.role==="user"||E.role==="assistant").map(E=>({role:E.role,content:et(E.parts,!1),parts:E.parts})).filter(E=>E.content).toReversed();N(p),c(`Switched to: ${s.title||"Untitled"}`)}).catch(()=>{c("Failed to load task messages.")}))}}else if(h==="profile"){let o=b[A];if(o){let s=ce.getCurrentProfileName();o.id!==s?(ce.setOverrideProfile(o.id),ce.setCurrentProfile(o.id),le(o.id),Be(),ne(`Switched to profile: ${o.name}`)):c(`Already using profile: ${o.name}`)}}a(null),Q([]),t("");return}if(w===" "&&(h==="connectors"||h==="capabilities")){let o=b[A];o&&(h==="connectors"?qe:Ke)(u=>{let T=new Set(u);return T.has(o.id)?T.delete(o.id):T.add(o.id),T});return}if(w==="a"&&(h==="connectors"||h==="capabilities")){(h==="connectors"?qe:Ke)(new Set(b.map(s=>s.id)));return}if(w==="n"&&(h==="connectors"||h==="capabilities")){(h==="connectors"?qe:Ke)(new Set);return}return}if(Z&&L.length>0){if(d.upArrow){U(o=>o<=0?L.length-1:o-1);return}if(d.downArrow){U(o=>o>=L.length-1?0:o+1);return}if(d.escape){F(!1),fe([]);return}if(d.tab){dt(pe);return}}if(d.upArrow){if(e.includes(`
|
|
162
|
+
`)||He.length===0)return;if(De===null){nt(e);let s=He.length-1;Oe(s),t(He[s]);return}let o=Math.max(0,De-1);Oe(o),t(He[o]);return}if(d.downArrow){if(e.includes(`
|
|
163
|
+
`)||De===null)return;if(De>=He.length-1){Oe(null),t($t);return}let o=De+1;Oe(o),t(He[o])}}),{suggestions:L,suggestionIndex:pe,showSuggestions:Z,argMode:h,argItems:b,argIndex:A,selectedConnectorIds:Ge,selectedCapabilities:ve,deleteConfirmMode:Je,handleInputChange:It,handleSubmit:St}}import{useCallback as Tt,useRef as fs,useState as ps}from"react";function mo({credentials:e,currentModel:t,modelProviders:n,onUploadSuccess:r,onUploadError:i}){let[l,f]=ps([]),m=fs(0),y=Tt(x=>{if(!(!Array.isArray(n)||n.length===0)){for(let v of n)if(v.models.some(J=>J.id===x))return v.id;return n[0]?.id}},[n]),g=Tt(async x=>{if(!e){i?.(x.filename,"Not logged in");return}if(!Array.isArray(n)||n.length===0){i?.(x.filename,"Model providers not loaded yet. Please wait and try again.");return}let v=t?y(t):n[0]?.id;if(!v){i?.(x.filename,"No model provider available");return}let M=`file-${++m.current}`;f(J=>[...J,{id:M,filename:x.filename,mimeType:x.mimeType,status:"uploading"}]);try{let X=await new ye().uploadFile(e.accessToken,e.workspaceId,x,v);f(oe=>oe.map(Y=>Y.id===M?{...Y,status:"uploaded",fileId:X.id}:Y)),r?.(x.filename)}catch(J){let X=J instanceof Error?J.message:"Upload failed";f(oe=>oe.map(Y=>Y.id===M?{...Y,status:"error",error:X}:Y)),i?.(x.filename,X)}},[e,t,y,n,r,i]),j=Tt(x=>{f(v=>v.filter(M=>M.id!==x))},[]),D=Tt(()=>{f([])},[]),I=Tt(()=>l.filter(x=>x.status==="uploaded"&&x.fileId).map(x=>x.fileId),[l]),P=l.some(x=>x.status==="uploading"),C=l.length>0;return{pendingFiles:l,addFile:g,removeFile:j,clearFiles:D,getUploadedFileIds:I,hasUploadingFiles:P,hasFiles:C}}import{jsx as z,jsxs as ie}from"react/jsx-runtime";var gs=[" ______ _ ____ _","| ____| | | | _ \\ | |","| |__ _ __ | |_ _ __ _ _ | | | | ___ ___| | __","| __| | '_ \\| __| '__| | | || | | |/ _ \\/ __| |/ /","| |____| | | | |_| | | |_| || |_| | __/\\__ \\ <","|______|_| |_|\\__|_| \\__, ||____/ \\___||___/_|\\_\\"," __/ |"," |___/"],hs=[un,un,cn,cn,Ze,Ze,Ze,Ze],ho=gs.map((e,t)=>`${hs[t]??Ze}${e}${ee}`).join(`
|
|
164
|
+
`),xs=`${Ze}EntryDesk${ee}`,ys=500;function bs(e){let t="",n=0;for(;n<e.length;){if(e.charCodeAt(n)===27&&e[n+1]==="["){for(n+=2;n<e.length;){let r=e.charCodeAt(n);if(r>=64&&r<=126){n+=1;break}n+=1}continue}t+=e[n],n+=1}return t}function ws(e){let t=bs(e);return Math.max(...t.split(`
|
|
165
|
+
`).map(n=>n.length))}function Ts(e){let t=ws(ho);return e>=t?ho:xs}function xo({agentId:e,model:t,message:n,taskId:r,taskTitle:i,connectorIds:l,enableSandbox:f=!0,enableWebSearch:m=!1,enableImageGeneration:y=!1,enableChart:g=!1,enableFileSystem:j=!0}){let D=process.stdout.columns??80,I=Ts(D),P=go(null),C=Yn(r,i),{state:x,setState:v,messages:M,setMessages:J,input:X,setInput:oe,taskId:Y,setTaskId:xe,currentTaskTitle:O,setCurrentTaskTitle:k,hasPersistedTask:S,setHasPersistedTask:R,credentials:G,setCredentials:_,currentResponse:ue,setCurrentResponse:N,fullOutput:c,setFullOutput:ne,addSystemMessage:de,startNewTask:V}=C,{credentials:$}=zn(v);Ut(()=>{$&&!G&&_($)},[$,G,_]);let{availableConnectors:be,availableModels:B,availableAgents:te,modelProviders:Ce,loading:W}=Xn(G),{currentModel:H,setCurrentModel:L,currentAgentId:fe,setCurrentAgentId:pe,activeConnectorIds:U,setActiveConnectorIds:Z}=io(t,e,l),F=go(!1);Ut(()=>{if(!F.current){if(F.current=!0,!t&&!e){let p=ge.getDefaultModel();p&&L(p)}if(!l&&!e){let p=ge.getDefaultConnectorIds();p&&Z(p.length>0?p:void 0)}}},[t,e,l,L,Z]);let{currentAgentDetails:h}=ro(fe,G),{sandbox:a,setSandbox:b,webSearch:Q,setWebSearch:A,imageGeneration:he,setImageGeneration:Ge,chart:qe,setChart:ve,fileSystem:Ke,setFileSystem:Kt,capabilityLabelMap:kt}=so(f,m,y,g,j),{pendingFiles:Ne,addFile:tt,removeFile:Fe,clearFiles:Ct,getUploadedFileIds:He,hasUploadingFiles:Ht,hasFiles:De}=mo({credentials:G,currentModel:H,modelProviders:Ce,onUploadSuccess:p=>{de(`\u2713 Attached: ${p}`)},onUploadError:(p,E)=>{de(`\u2717 Failed to upload ${p}: ${E}`)}}),{sendMessage:Oe}=eo({taskId:Y,credentials:G,currentAgentId:fe,currentModel:H,activeConnectorIds:U,sandbox:a,webSearch:Q,imageGeneration:he,chart:qe,localTools:Ke,fullOutput:c,setMessages:J,setState:v,setCurrentResponse:N,setCredentials:_,setHasPersistedTask:R,getFileIds:He,clearFiles:Ct}),$t=gn(p=>{V(p),N("")},[V]),[nt,Xe]=ms(!1),Je=gn(async p=>{let E=p.text.trim(),ae=Ot(E);if(/^https?:\/\//.test(ae))return;if(await qn(E)&&Gn(ae)){let re=await Kn(E);re&&(p.preventDefault(),await tt(re))}},[tt]),ot=gn(async()=>{if(!(nt||x.status!=="ready")){if(W||Ce.length===0){de("Please wait for resources to load before pasting images.");return}de("Reading clipboard..."),Xe(!0);try{let p=await Mn();if(p){let E=`clipboard-${Date.now()}.png`;de(`Uploading: ${E} (${Math.round(p.buffer.length/1024)}KB)`),await tt({buffer:p.buffer,filename:E,mimeType:p.mime})}else de("No image found in clipboard. Copy an image first.")}catch(p){let E=p instanceof Error?p.message:"Failed to read clipboard";de(`Clipboard error: ${E}`)}finally{Xe(!1)}}},[tt,de,nt,x.status,W,Ce.length]),{suggestions:st,suggestionIndex:rt,showSuggestions:$e,argMode:le,argItems:Be,argIndex:it,selectedConnectorIds:It,selectedCapabilities:dt,deleteConfirmMode:St,handleInputChange:w,handleSubmit:d}=po({input:X,setInput:oe,taskId:Y,setTaskId:xe,currentTaskTitle:O,setCurrentTaskTitle:k,currentModel:H,setCurrentModel:L,currentAgentId:fe,setCurrentAgentId:pe,currentAgentDetails:h,setCurrentAgentDetails:()=>{},activeConnectorIds:U,setActiveConnectorIds:Z,sandbox:a,setSandbox:b,webSearch:Q,setWebSearch:A,imageGeneration:he,setImageGeneration:Ge,chart:qe,setChart:ve,fileSystem:Ke,setFileSystem:Kt,availableModels:B,availableAgents:te,availableConnectors:be,messages:M,hasPersistedTask:S,setHasPersistedTask:R,setMessages:J,addSystemMessage:de,startNewTask:$t,sendMessage:Oe,setFullOutput:ne,credentials:G,setCredentials:_,setState:v,defaultCapabilities:{sandbox:f,webSearch:m,imageGeneration:y,chart:g,fileSystem:j},capabilityLabelMap:kt,hasUploadingFiles:Ht});if(pn((p,E)=>{(E.ctrl||E.meta)&&p==="v"&&ot()},{isActive:x.status==="ready"&&!le}),pn((p,E)=>{if(!E.escape)return;let ae=Date.now(),q=P.current;P.current=ae,!(!q||ae-q>ys)&&(le||$e||(P.current=null,De&&Ct(),X.length>0&&w("")))},{isActive:x.status==="ready"}),pn((p,E)=>{E.return&&($t("Started a new task."),v({status:"ready"}))},{isActive:x.status==="error"}),Ut(()=>{if(G&&!W&&x.status==="loading")if(!H&&!fe){let p=ge.getDefaultModel(),E=p&&B.some(q=>q.id===p),ae=E?p:B[0]?.id;ae?(E||ge.setDefaultModel(ae),L(ae),v({status:"ready"})):te.length===0?v({status:"no-model"}):v({status:"ready"})}else v({status:"ready"})},[G,W,H,fe,B,te,x.status,L,v]),Ut(()=>{n&&G&&x.status==="ready"&&Oe(n)},[G,n]),x.status==="loading")return ie(ke,{flexDirection:"column",children:[z(K,{children:I}),ie(ke,{children:[z(K,{color:"cyan",children:z(mn,{type:"dots"})}),z(K,{children:" Initializing task..."})]})]});if(x.status==="not-logged-in")return ie(ke,{flexDirection:"column",children:[z(K,{children:I}),z(K,{color:"yellow",children:"Not logged in"}),z(K,{dimColor:!0,children:"Run `entrydesk login` to authenticate first."})]});if(x.status==="no-workspace")return ie(ke,{flexDirection:"column",children:[z(K,{children:I}),z(K,{color:"yellow",children:"No workspace selected"}),z(K,{dimColor:!0,children:"Run `entrydesk workspaces` to select a workspace first."})]});if(x.status==="no-model")return ie(ke,{flexDirection:"column",children:[z(K,{children:I}),z(K,{color:"yellow",children:"No model or agent specified"}),r&&z(K,{dimColor:!0,children:"Could not determine the model used in this task."}),z(K,{dimColor:!0,children:"Please specify a model with --model or use an agent with -a."}),z(K,{dimColor:!0,children:"Example: entrydesk task -c 1 -i --model gemini-2.5-flash-lite"})]});if(x.status==="error")return ie(ke,{flexDirection:"column",children:[z(K,{children:I}),ie(K,{color:"red",children:["Error: ",x.message]}),z(K,{dimColor:!0,children:"Press Enter to start a new task, or Ctrl+C to exit"})]});let o=fe?h?h.connectors&&h.connectors.length>0?h.connectors.map(p=>p.name).join(", "):"none":"loading...":U&&U.length>0?be.filter(p=>U.includes(p.id)).map(p=>p.name).join(", ")||`${U.length} connector(s)`:"none",s=[];if(fe)if(h?.capabilities)for(let p of h.capabilities)s.push(kt.get(p)??p);else s.push("loading...");else a&&s.push("Sandbox"),Q&&s.push("Web"),he&&s.push("Image"),qe&&s.push("Chart");Ke&&s.push("FileSystem");let u=ce.getCurrentProfileName(),T=u!=="default";return ie(ke,{flexDirection:"column",children:[ie(ke,{marginBottom:1,flexDirection:"column",children:[z(K,{children:I}),ie(ke,{children:[z(K,{bold:!0,color:"cyan",children:O?`Continuing: ${O}`:"EntryDesk CLI"}),ie(K,{dimColor:!0,children:[" v","1.12.1"]}),T&&ie(K,{color:"magenta",children:[" [",u,"]"]}),z(K,{dimColor:!0,children:" (type /help for commands)"})]})]}),M.map((p,E)=>{let ae=p.parts&&c?et(p.parts,!0):p.content,q=p.role==="user"?"green":p.role==="system"?"yellow":"blue",re=p.role==="user"?"You":p.role==="system"?"System":"Assistant";return ie(ke,{flexDirection:"column",marginBottom:1,children:[ie(K,{bold:!0,color:q,children:[re,":"]}),z(ln,{text:ae})]},E)}),ue&&ie(ke,{flexDirection:"column",marginBottom:1,children:[z(K,{bold:!0,color:"blue",children:"Assistant:"}),z(ln,{text:ue})]}),x.status==="ready"&&z(In,{suggestions:st,activeIndex:rt,visible:$e}),x.status==="ready"&&le&&z($n,{items:Be,activeIndex:it,pageSize:le==="agent"||le==="skills"||le==="model"?5:10,selectedIds:le==="connectors"?It:le==="capabilities"?dt:void 0,multiSelect:le==="connectors"||le==="capabilities",visible:!0,title:le==="model"?"Select model:":le==="agent"?"Select agent:":le==="skills"?"Select skill:":le==="connectors"?"Select connectors:":le==="capabilities"?"Select capabilities:":"Select task:"}),x.status==="sending"&&!ue?ie(ke,{children:[z(K,{color:"cyan",children:z(mn,{type:"dots"})}),z(K,{children:" Thinking..."})]}):x.status==="ready"&&!le?ie(ke,{flexDirection:"column",children:[St&&z(ke,{marginBottom:1,children:z(K,{color:"yellow",children:"\u26A0\uFE0F Delete this task? (y/N) "})}),De&&!St&&ie(ke,{marginBottom:1,flexDirection:"row",gap:1,children:[z(K,{dimColor:!0,children:"Attachments:"}),Ne.map((p,E)=>ie(K,{children:[p.status==="uploading"?ie(K,{color:"yellow",children:[z(mn,{type:"dots"})," ",p.filename]}):p.status==="error"?ie(K,{color:"red",children:["\u2717 ",p.filename]}):ie(K,{color:"green",children:["\u2713 ",p.filename]}),E<Ne.length-1&&z(K,{children:", "})]},p.id))]}),ie(ke,{children:[z(K,{color:"green",children:"> "}),z(Dn,{value:X,onChange:w,onSubmit:d,onPaste:Je,leadingOffset:2,multiline:!0})]})]}):null,ie(ke,{marginTop:1,flexDirection:"column",children:[ie(ke,{gap:2,children:[ie(K,{children:[z(K,{dimColor:!0,children:"Model: "}),z(K,{color:"magenta",children:fe?h?.model?.name||"loading...":B.find(p=>p.id===H)?.name||H||"none"})]}),ie(K,{children:[z(K,{dimColor:!0,children:"Connectors: "}),z(K,{color:"cyan",children:o})]}),ie(K,{children:[z(K,{dimColor:!0,children:"Capabilities: "}),z(K,{color:"green",children:s.length>0?s.join(", "):"none"})]})]}),ie(K,{dimColor:!0,children:["Esc Esc: Clear input & attachments | Ctrl+V: Paste image | Ctrl+O: Toggle full output ",c?"(ON)":"(OFF)"," | Ctrl+C: Exit"]})]})]})}import{jsx as Ss}from"react/jsx-runtime";async function Cs(){let e=[];for await(let t of process.stdin)e.push(t);return Buffer.concat(e).toString("utf8").trim()}async function $s(e,t,n,r){if(r<1)return console.error("Task number must be 1 or greater"),null;let{tasks:i}=await e.getTasks(t,n,20);if(i.length===0)return console.error("No tasks found. Start a new task first."),null;if(r>i.length)return console.error(`Task number ${r} not found. You have ${i.length} recent tasks.`),console.error("Use `entrydesk tasks` to see available tasks."),null;let l=i[r-1],f;if(!l.agentId){let{messages:m}=await e.getMessages(t,n,l.id,10);f=m.find(g=>g.role==="assistant"&&g.modelId)?.modelId}return{task:l,modelId:f}}var ut="\x1B[2m",Se="\x1B[0m",hn="\x1B[36m",To="\x1B[33m",Mt="\x1B[32m",yo="stream-json";function bo(e,t,n,r){e&&t&&(console.error(`Error: Cannot use both ${n} and ${r}`),process.exit(1))}function Gt(e,t){let n=t===void 0?{event:e}:{event:e,data:t};process.stdout.write(`${JSON.stringify(n)}
|
|
166
166
|
`)}function qt(e,t){if(t)return e;let n=e.split(`
|
|
167
|
-
`);if(n.length<=20)return e;let
|
|
168
|
-
`)}function
|
|
167
|
+
`);if(n.length<=20)return e;let r=n.slice(0,5),i=n.slice(-5),l=n.length-10;return[...r,`${ut}... (${l} lines omitted, use --full-output to see all) ...${Se}`,...i].join(`
|
|
168
|
+
`)}function Is(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}function wo(e,t){if(!e)return"(no result)";if(typeof e!="object")return qt(String(e),t);let n=e;if("structuredContent"in n&&n.structuredContent){let r=n.structuredContent,i=[];if(r.stdout&&typeof r.stdout=="string"&&r.stdout.trim()&&i.push(r.stdout.trim()),r.stderr&&typeof r.stderr=="string"&&r.stderr.trim()&&i.push(`${To}[stderr]${Se} ${r.stderr.trim()}`),r.urls&&Array.isArray(r.urls)){let l=r.urls;for(let f of l)f.path&&f.url&&i.push(`${f.path}: ${f.url}`)}return i.length===0&&i.push(JSON.stringify(r,null,2)),qt(i.join(`
|
|
169
169
|
`),t)}if("content"in n&&Array.isArray(n.content)){let i=n.content.filter(l=>l.type==="text"&&l.text).map(l=>l.text).join(`
|
|
170
|
-
`);return qt(i||JSON.stringify(e,null,2),t)}return qt(JSON.stringify(e,null,2),t)}async function Mi(e){let t,n;try{let B=await Ve();t=B.accessToken,n=B.workspaceId}catch(B){yn(B)}let
|
|
171
|
-
Could not determine model for this
|
|
172
|
-
`)}let P=e.agentId||D
|
|
173
|
-
`);W=Z.pop()||"";for(let F of Z){let h=F.trimEnd();if(h==="data: [DONE]"){
|
|
170
|
+
`);return qt(i||JSON.stringify(e,null,2),t)}return qt(JSON.stringify(e,null,2),t)}async function Mi(e){let t,n;try{let B=await Ve();t=B.accessToken,n=B.workspaceId}catch(B){yn(B)}let r=e.output===yo;e.output&&!r&&(console.error(`Invalid --output value. Supported: ${yo}`),process.exit(1));let i=!r&&(e.plain||!process.stdout.isTTY),l=ge.getDefaultModel(),f=e.message;!f&&!process.stdin.isTTY&&(f=await Cs());let m=new ye;async function y(){if(!l)try{let{models:B}=await m.getModels(t,n),te=B[0]?.id;if(!te)return;ge.setDefaultModel(te),l=te}catch{}}let g,j,D,I;if(e.continue){let B=await $s(m,t,n,e.continue);B||process.exit(1),g=B.task.id,j=B.task.title??void 0,D=B.task.agentId??void 0,I=B.modelId;let te=e.agentId||e.model||D||I||l;!te&&!e.interactive&&(await y(),te=e.agentId||e.model||D||I||l),!te&&!e.interactive&&(i||console.log(`Continuing task: ${B.task.title||"Untitled"}`),console.error(`
|
|
171
|
+
Could not determine model for this task. Please specify --model or -a.`),console.error('Example: entrydesk task -c 1 -m "message" --model gemini-2.5-flash-lite'),process.exit(1)),!i&&!e.interactive&&console.log(`Continuing task: ${B.task.title||"Untitled"}
|
|
172
|
+
`)}let P=e.agentId||D,C=e.model||I||l||void 0;!P&&!C&&(await y(),C=e.model||I||l||void 0),bo(e.sandbox,e.noSandbox,"--sandbox","--no-sandbox"),bo(e.fileSystem,e.noFileSystem,"--file-system","--no-file-system");let x=ge.getCapabilities(),v=e.noSandbox?!1:e.sandbox?!0:x?.sandbox??!0,M=e.webSearch??x?.webSearch??!1,J=e.imageGen??x?.imageGeneration??!1,X=e.chart??x?.chart??!1,oe=ge.getDefaultConnectorIds(),Y=e.connectors??oe??void 0,xe=ge.getLocalTools(),O=e.noFileSystem?!1:e.fileSystem?!0:xe?.fileSystem??!0;if(e.interactive){ks(Ss(xo,{agentId:P,model:C,message:e.message,taskId:g,taskTitle:j??void 0,connectorIds:Y,enableSandbox:v,enableWebSearch:M,enableImageGeneration:J,enableChart:X,enableFileSystem:O}),{exitOnCtrlC:!1});return}let k=!e.continue&&!C&&!P;(!f||k)&&(console.error("Usage: entrydesk task -m <message> --model <model>"),console.error(" entrydesk task -m <message> -a <agent>"),console.error(" entrydesk task -c <number> -m <message>"),console.error(' echo "message" | entrydesk task --model <model>'),console.error(" entrydesk task -i (interactive mode)"),console.error(""),console.error("Options:"),console.error(" -m, --message Message to send (or pipe via stdin)"),console.error(" --model Model ID to use (required if no agent and no default)"),console.error(" -a, --agent Agent ID to use (required if no model)"),console.error(" -c, --continue Continue recent task by number (1 = most recent)"),console.error(" -i Interactive mode"),console.error(" --plain Plain text output (no colors/formatting)"),console.error(" --output stream-json Stream JSON events (for scripting)"),console.error(" --full-output Show full tool results without truncation"),console.error(" --dangerously-auto-approve-tools"),console.error(" Auto-approve all server-side tool calls (required for"),console.error(" non-interactive use with connectors/MCP tools)"),console.error(""),console.error("List available models: entrydesk models"),console.error("List available agents: entrydesk agents"),console.error("List recent tasks: entrydesk tasks"),process.exit(1));let S=e.fullOutput??!1,R=e.dangerouslyAutoApproveTools??!1,G=g||jt(),_=O?Pt():void 0,ue=O?_t():void 0,N=[],c=jt(),ne=(B,te,Ce)=>{let W={id:G,...R&&{toolApprovalMode:"allow_always"}};return B&&(W.message={id:B.id,createdAt:new Date,role:"user",parts:[{type:"text",text:B.text}]}),P?W.agentId=P:(C&&(W.model=C),W.connectorIds=Y??[],W.enableSandbox=v,W.enableWebSearch=M,W.enableImageGeneration=J,W.enableChart=X),_&&(W.clientTools=_),ue&&(W.clientToolSystemPrompt=ue),te&&te.length>0&&(W.clientToolResults=te),Ce&&Ce.length>0&&(W.previousMessages=Ce),W},de=async B=>{if(!B.body)throw new Error("No response body");let te=B.body.getReader(),Ce=new TextDecoder,W="",H=new Map,L=[],fe=[];for(;;){let{done:pe,value:U}=await te.read();if(pe)break;W+=Ce.decode(U,{stream:!0});let Z=W.split(`
|
|
173
|
+
`);W=Z.pop()||"";for(let F of Z){let h=F.trimEnd();if(h==="data: [DONE]"){r&&Gt("done");continue}if(h.startsWith("data: "))try{let a=JSON.parse(h.slice(6));if(a.type&&fe.push(a),r){a.type==="text-delta"&&a.delta!==void 0?Gt("text-delta",a.delta):a.type==="reasoning-delta"&&a.delta!==void 0?Gt("reasoning-delta",a.delta):Gt(a.type||"event",a);continue}if(i){if(a.type==="text-delta"&&a.delta&&process.stdout.write(a.delta),O&&(a.type==="tool-input-available"||a.type==="tool-call")&&a.toolCallId&&a.toolName&&Ue(a.toolName)){let b=a.args||a.input||{};L.push({toolCallId:a.toolCallId,toolName:a.toolName,args:b})}continue}switch(a.type){case"reasoning-delta":a.delta&&process.stdout.write(`${ut}${a.delta}${Se}`);break;case"reasoning-end":process.stdout.write(`
|
|
174
174
|
|
|
175
175
|
`);break;case"text-delta":a.delta&&process.stdout.write(a.delta);break;case"tool-call-streaming-start":case"tool-input-start":if(a.toolCallId&&a.toolName){H.set(a.toolCallId,{toolName:a.toolName});let Q=O&&Ue(a.toolName)?`${Mt}[LOCAL]${Se} `:"";console.log(`
|
|
176
|
-
${hn}\u250C\u2500 ${Q}Tool Call: ${a.toolName}${Se}`)}break;case"tool-call":case"tool-input-available":if(a.toolCallId&&a.toolName){let b=a.args||a.input||{},Q=
|
|
176
|
+
${hn}\u250C\u2500 ${Q}Tool Call: ${a.toolName}${Se}`)}break;case"tool-call":case"tool-input-available":if(a.toolCallId&&a.toolName){let b=a.args||a.input||{},Q=Is(b);console.log(`${To}\u2502 Arguments:${Se}`);for(let A of Q.split(`
|
|
177
177
|
`))console.log(`${ut}\u2502 ${A}${Se}`);O&&Ue(a.toolName)&&(H.set(a.toolCallId,{toolName:a.toolName,args:b}),L.push({toolCallId:a.toolCallId,toolName:a.toolName,args:b}))}break;case"tool-result":if(a.toolCallId){let b=H.get(a.toolCallId),Q=wo(a.result,S);console.log(`${Mt}\u2502 Result:${Se}`);for(let A of Q.split(`
|
|
178
178
|
`))console.log(`${ut}\u2502 ${A}${Se}`);console.log(`${hn}\u2514\u2500 ${b?.toolName||"Tool"} completed${Se}
|
|
179
|
-
`),H.delete(a.toolCallId)}break;case"error":a.errorText&&console.error(`${ut}Error: ${a.errorText}${Se}`);break}}catch{}}}return{pendingClientTools:L,messageParts:fe}},V=ne({id:jt(),text:f})
|
|
179
|
+
`),H.delete(a.toolCallId)}break;case"error":a.errorText&&console.error(`${ut}Error: ${a.errorText}${Se}`);break}}catch{}}}return{pendingClientTools:L,messageParts:fe}},V=ne({id:jt(),text:f}),$=await m.task(t,n,V),be=await de($);for(N=be.messageParts;be.pendingClientTools.length>0;){let B=[];for(let H of be.pendingClientTools){!i&&!r&&console.log(`${Mt}\u2502 Executing locally...${Se}`);let L=await Et(H.toolName,H.args),fe=L.success?JSON.stringify(L.result):L.error||"Unknown error";if(B.push({toolCallId:H.toolCallId,toolName:H.toolName,content:[{type:"text",text:fe}],isError:!L.success}),!i&&!r){let pe=wo(L.success?L.result:{error:L.error},S);console.log(`${Mt}\u2502 Result:${Se}`);for(let U of pe.split(`
|
|
180
180
|
`))console.log(`${ut}\u2502 ${U}${Se}`);console.log(`${hn}\u2514\u2500 ${H.toolName} completed${Se}
|
|
181
181
|
`)}}let te=N.map(H=>{if(H.type==="tool-call"){let L=B.find(pe=>pe.toolCallId===H.toolCallId),fe=L?.content.filter(pe=>pe.type==="text").map(pe=>pe.text).join(`
|
|
182
|
-
`);return{type:"tool-invocation",toolCallId:H.toolCallId,toolName:H.toolName,args:H.args,state:L?.isError?"output-error":"output-available",output:fe}}return H})
|
|
182
|
+
`);return{type:"tool-invocation",toolCallId:H.toolCallId,toolName:H.toolName,args:H.args,state:L?.isError?"output-error":"output-available",output:fe}}return H}),Ce=[{id:c,role:"assistant",parts:te}];c=jt();let W=ne(void 0,B,Ce);$=await m.task(t,n,W),be=await de($),N=be.messageParts}r||console.log("")}export{Mi as runTask};
|