fluxflow-cli 4.44.0 → 4.46.0
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/dist/chunks/ai-ES7GEGZ2.js +1 -0
- package/dist/chunks/app-FR7775JT.js +333 -0
- package/dist/chunks/{auto_completion-FSSLSASK.js → auto_completion-ZGT6WREW.js} +1 -1
- package/dist/chunks/{chunk-2SMAZY6E.js → chunk-2ZGSUC4G.js} +1 -1
- package/dist/chunks/chunk-7D7IG3AG.js +1 -0
- package/dist/chunks/chunk-BKGKMEQ4.js +943 -0
- package/dist/chunks/{chunk-UFLKOWYM.js → chunk-FXGGSOXY.js} +1 -1
- package/dist/chunks/chunk-HTOLY3HR.js +1 -0
- package/dist/chunks/{chunk-VHCXFHUU.js → chunk-JPJB2SJL.js} +1 -1
- package/dist/chunks/{chunk-3HU67EUI.js → chunk-KYQFLMZE.js} +11 -11
- package/dist/chunks/chunk-MAXLHC7A.js +1 -0
- package/dist/chunks/chunk-MKC4AVAL.js +44 -0
- package/dist/chunks/chunk-MXADZLMH.js +1 -0
- package/dist/chunks/chunk-TQOQHYJ6.js +33 -0
- package/dist/chunks/{click-C4LULADR.js → click-ZZBBIP7F.js} +2 -2
- package/dist/chunks/{computer_action-HG5P5DOG.js → computer_action-5SW7LW5R.js} +1 -1
- package/dist/chunks/{drag-CIAOFEBD.js → drag-OBMCSGER.js} +1 -1
- package/dist/chunks/{exec_command-GXJWBNEI.js → exec_command-BDFXJQZJ.js} +1 -1
- package/dist/chunks/{generate_image-RAFSX2PO.js → generate_image-ALAAHL2E.js} +1 -1
- package/dist/chunks/getProgress-J34K43Y7.js +24 -0
- package/dist/chunks/{invoke-K5DKH37G.js → invoke-DCX72AHI.js} +2 -2
- package/dist/chunks/{invokeSync-U5FLY2AB.js → invokeSync-GQPUH52H.js} +2 -2
- package/dist/chunks/{key_press-3MUADXYA.js → key_press-65GEUW4K.js} +1 -1
- package/dist/chunks/{keyboard_typing-RDYAUO2I.js → keyboard_typing-GCMJCV7O.js} +1 -1
- package/dist/chunks/{mistral-KIAEM23F.js → mistral-YTTOZB2J.js} +1 -1
- package/dist/chunks/{model_config-Q3PYM77Y.js → model_config-JTMSQGKH.js} +1 -1
- package/dist/chunks/{nvidia-2N7GMNVP.js → nvidia-ON4Q6Q26.js} +1 -1
- package/dist/chunks/{recapture_screen-CGAT4ZDO.js → recapture_screen-QB65V5CM.js} +1 -1
- package/dist/chunks/{screen_grid-PAVYL4U2.js → screen_grid-M5K7ZHKD.js} +1 -1
- package/dist/chunks/{scroll-V3SVOZW6.js → scroll-LTWDNSC6.js} +1 -1
- package/dist/chunks/{search_keyword-OHDFK7MO.js → search_keyword-GT5GEEJW.js} +1 -1
- package/dist/chunks/secrets-HSGGFVG5.js +1 -0
- package/dist/chunks/secrets_v2-YV7YCUN7.js +1 -0
- package/dist/chunks/{settings-PADKHNGC.js → settings-4RNTQJ75.js} +1 -1
- package/dist/chunks/{update_file-XM5PHLQU.js → update_file-ALQM76Y4.js} +1 -1
- package/dist/chunks/{usage-PVC3CXDR.js → usage-67IZJXM2.js} +1 -1
- package/dist/chunks/{usageServer-SMP52LUG.js → usageServer-HBVYDUQK.js} +1 -1
- package/dist/chunks/{write_file-NTWH4NCN.js → write_file-XHSRFBMF.js} +5 -5
- package/dist/cli.js +5 -5
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/ai-3J4SUC3U.js +0 -1
- package/dist/chunks/app-JSYMH7WB.js +0 -332
- package/dist/chunks/chunk-BB5UISPJ.js +0 -1
- package/dist/chunks/chunk-H3IDSRDO.js +0 -1
- package/dist/chunks/chunk-JDSDLNHL.js +0 -1
- package/dist/chunks/chunk-NN5WVXEF.js +0 -938
- package/dist/chunks/chunk-SML2NARF.js +0 -44
- package/dist/chunks/chunk-TXMOUQPV.js +0 -33
- package/dist/chunks/getProgress-FXNG2ISE.js +0 -26
- package/dist/chunks/secrets-FRPTIOJI.js +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import{c as U}from"./chunk-26BQ45XP.js";import G from"os";import{structuredPatch as V}from"diff";var R=e=>typeof e!="string"?e:e.length>12?(e+"").replace("",""):e,W=(e,o)=>{if(!e)return"";let d=/\x1B\[[0-?]*[ -/]*[@-~]/g,p=e.split(`
|
|
2
|
-
`),c=[];if(o<=5)return e;let i=t=>t<32||t>=127&&t<160||t>=768&&t<=879||t>=7616&&t<=7679||t>=8400&&t<=8447||t>=65056&&t<=65071?0:t>=4352&&t<=4447||t>=9001&&t<=9002||t>=11904&&t<=12350||t>=12352&&t<=42191||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65135||t>=65280&&t<=65376||t>=65504&&t<=65510||t>=127744&&t<=128591||t>=128640&&t<=128767||t>=131072&&t<=262141?2:1,x=t=>{let r=t.replace(d,""),s=0;for(let l=0;l<r.length;l++){let u=r.codePointAt(l);u>65535&&l++,s+=i(u)}return s},y=(t,r)=>{let s=0,l=t.length,u=!1;for(let g=0;g<t.length;g++){if(t[g]==="\x1B"&&t[g+1]==="["&&(u=!0),u){(t[g]==="m"||t[g]>="@"&&t[g]<="~"&&t[g]!=="[")&&(u=!1);continue}let $=t.codePointAt(g);$>65535&&g++;let S=i($);if(s+S>r){l=$>65535?g-1:g;break}if(s+=S,s>=r){l=g+1;break}}return{head:t.substring(0,l),tail:t.substring(l)}};return p.forEach(t=>{if(x(t)<=o){c.push(t);return}let s=t.split(/(\s+)/),l="",u=0,g=t.match(/^(\s*)/),$=g?g[1]:"";s.forEach(S=>{if(S.length===0)return;let h=S;for(;h.length>0;){let F=x(h);if(u+F<=o){l+=h,u+=F;break}l.trim().length>0&&(c.push(l.trimEnd()),l=$.substring(0,Math.min($.length,8)),u=x(l));let n=Math.max(1,o-u);if(x(h)>n){let{head:a,tail:f}=y(h,n);c.push((l+a).trimEnd()),l=$.substring(0,Math.min($.length,8)),u=x(l),h=f}else l+=h,u+=x(h),h=""}}),(l.trimEnd().length>0||l===$)&&c.push(l.trimEnd())}),R(c.join(`
|
|
3
|
-
`))},oe=e=>{if(!e)return 0;let o=0,d=e.match(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g);d&&(o+=d.length*.55);let p=e.replace(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g," "),c=p.match(/[<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+/g);c&&(o+=c.length);let i=p.split(/[\s<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+/g).filter(Boolean);return o+=i.length,Math.max(.1,o)},le=e=>e?e.match(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]|\s+|[<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+|[^\s<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}\-\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g)||[e]:[],ce=e=>{if(!e&&e!==0)return"0.0k";let o=typeof e=="string"?parseFloat(e):e;return o>=1e6?`${(o/1e6).toFixed(1)}m`:o>=1e3?`${(o/1e3).toFixed(1)}k`:o.toString()},ae=(e,o=40)=>{let d=U.replaceAll("\\\\","\\");if(e=e.replace(G.homedir(),"~").replace(d,"FluxFlow").replaceAll("\\","/"),!e||e.length<=o)return R(e);let p=Math.floor((o-3)/2);return R(e.substring(0,p)+"..."+e.substring(e.length-p).replaceAll("\\","/"))},fe=e=>{let o=[],d=new Set,p=e.allowMultiple===!0||String(e.allowMultiple).toLowerCase()==="true";Object.keys(e).forEach(t=>{let r=t.match(/^(searchContent|search_content|replaceContent|replace_content|newContent|new_content|content_to_replace|content_to_add|searchBlock|search_block|newBlock|new_block)_?(\d+)?$/i);if(r){let s=r[2]?parseInt(r[2],10):1;d.add(s)}});let c=Array.from(d).sort((t,r)=>t-r),i=["searchContent","search_content","replaceContent","replace_content","content_to_replace","searchBlock","search_block"],x=["newContent","new_content","content_to_add","newBlock","new_block"],y=(t,r,s)=>{let l,u;for(let g of r){let $=t===1?[`${g}1`,g,`${g}_1`]:[`${g}${t}`,`${g}_${t}`];for(let S of $)if(e[S]!==void 0){l=e[S];break}if(l!==void 0)break}for(let g of s){let $=t===1?[`${g}1`,g,`${g}_1`]:[`${g}${t}`,`${g}_${t}`];for(let S of $)if(e[S]!==void 0){u=e[S];break}if(u!==void 0)break}return{r:l,n:u}};for(let t of c){let{r,n:s}=y(t,i,x);if(r!==void 0&&s!==void 0)o.push({replace:r,new:s});else if(r!==void 0||s!==void 0)return{error:`Mismatched replacement pair for index ${t}. Both replacement and new content must be provided.`,allowMultiple:p}}return{patchPairs:o,allowMultiple:p}},Z=e=>{if(!e)return null;let o="",d=0,p=e.length;for(;d<p;){let c=e[d];if(c==="\\"){for(;d<p&&e[d]==="\\";)d++;o+="\\\\*"}else if(c===`
|
|
4
|
-
`)o+="(?:\\r?\\n|\\\\*n|\\\\*r|\\s*)",d++;else if(c==="\r")o+="(?:\\r|\\\\*r)?",d++;else if(c===" ")o+="(?:\\t|\\\\*t|\\s*)",d++;else if(c==='"'||c==="'"||c==="`")o.endsWith("\\\\*")||(o+="\\\\*"),o+=c,d++;else if(/[.*+?^${}()|[\]]/.test(c))o+="\\"+c,d++;else if(/\s/.test(c)){for(;d<p&&/\s/.test(e[d])&&e[d]!==`
|
|
5
|
-
`&&e[d]!=="\r"&&e[d]!==" ";)d++;o+="\\s*"}else o+=c,d++}if(!o)return null;try{return new RegExp(o,"g")}catch{return null}},ue=(e,o,d={})=>{let p=typeof d=="boolean"?d:!!(d&&d.allowMultiple),c=e.replace(/\r\n/g,`
|
|
6
|
-
`).replace(/\r/g,`
|
|
7
|
-
`),i=n=>n.replace(/^```[\w]*\n?/,"").replace(/```\s*$/,"").replace(/\r\n/g,`
|
|
8
|
-
`).replace(/\r/g,`
|
|
9
|
-
`),x=n=>n.match(/^\s*/)[0],y=n=>{let a=n.split(`
|
|
10
|
-
`).filter(E=>E.trim()!=="");if(a.length===0)return"";let f=x(a[0]);for(let E of a){let w=x(E);w.length<f.length&&(f=w)}return f},t=(n,a,f="")=>{if(!n||a===void 0)return n;let w=/^\t/m.test(a)?" ":" ",C=b=>b.split(`
|
|
11
|
-
`).find(I=>I.trim()!=="")??"",L=C(a).match(/^\s*/)[0].length,m=C(n).match(/^\s*/)[0].length,k=L-m,_=(f.match(/^\s*/)||[""])[0].length;return n.split(`
|
|
12
|
-
`).map((b,I)=>{if(b.trim()===""&&I!==0)return"";let A=b.match(/^\s*/)[0].length,T=Math.max(0,A+k);return I===0&&(T=Math.max(0,T-_)),w.repeat(T)+b.trimStart()}).join(`
|
|
13
|
-
`)},r=[];for(let n=0;n<o.length;n++){let a=o[n],f=(a.replace||"").trim(),E=i(a.new||"");if(f.startsWith("^LINE:")&&f.endsWith("$")){let _=f.slice(6,-1).trim().split(".."),M=parseInt(_[0]),b=_[1]!==void 0?parseInt(_[1]):M;if(!isNaN(M)&&!isNaN(b)){let I=c.split(`
|
|
14
|
-
`);if(M<1||M>I.length||b<M||b>I.length){r.push({index:n,success:!1,error:`Block ${n+1}: Line range ^LINE:${M}..${b}$ out of bounds (file has ${I.length} lines).`});continue}let T=I.slice(M-1,b).join(`
|
|
15
|
-
`),O=0;for(let P=0;P<M-1;P++)O+=I[P].length+1;r.push({index:n,success:!0,startPos:O,firstMatchContent:T,content_to_add:E});continue}}let w=i(a.replace||"");if(w===""&&E===""){r.push({index:n,success:!1,error:`Block ${n+1}: Empty replace and add content.`});continue}let C=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=null;if(w!==""&&c.includes(w))L=new RegExp(C,"g");else{let k=w.split(`
|
|
16
|
-
`).map(_=>_.trim()).filter(_=>_.length>0).map(_=>_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s*"));if(k.length>0){let _=k.join("\\s*");try{L=new RegExp(_,"g")}catch{L=new RegExp(C,"g")}}else L=new RegExp(C,"g")}let m=[...c.matchAll(L)];if(m.length===0&&w!==""){let k=Z(w);k&&(m=[...c.matchAll(k)])}if(m.length===0){r.push({index:n,success:!1,error:`Block ${n+1}: Could not find match.`});continue}if(m.length>1&&!p){r.push({index:n,success:!1,error:`Block ${n+1}: Found ${m.length} matches (must be unique or use allowMultiple: true if sure).`});continue}for(let k of m)r.push({index:n,success:!0,startPos:k.index,firstMatchContent:k[0],content_to_add:E})}let s=r.filter(n=>n.success).sort((n,a)=>n.startPos-a.startPos);for(let n=0;n<s.length-1;n++){let a=s[n],f=s[n+1];a.startPos+a.firstMatchContent.length>f.startPos&&(a.success=!1,a.error=`Block ${a.index+1}: Overlaps with another block.`,f.success=!1,f.error=`Block ${f.index+1}: Overlaps with another block.`)}let l=new Map,u=c,g=0,$=0,S=r.filter(n=>n.success).sort((n,a)=>n.startPos-a.startPos);for(let n of S){let a=n.startPos,f=c.substring(0,a).split(`
|
|
17
|
-
`).length,E=a+g,w=f+$,C=u.lastIndexOf(`
|
|
18
|
-
`,E)+1,L=u.substring(C,E),m=t(n.content_to_add,n.firstMatchContent,L),k=u.split(`
|
|
19
|
-
`),_=[];for(let A=Math.max(0,w-4);A<w-1;A++)_.push({num:A+1,text:k[A]});let M=n.firstMatchContent.split(`
|
|
20
|
-
`),b=[],I=w+M.length-1;for(let A=I;A<Math.min(k.length,I+3);A++)b.push({num:A+1,text:k[A]});l.set(n,{success:!0,index:n.index,oldContent:n.firstMatchContent,newContent:m,originalStartLine:f,finalStartLine:w,contextBefore:_,contextAfter:b}),u=u.substring(0,E)+m+u.substring(E+n.firstMatchContent.length),g+=m.length-n.firstMatchContent.length,$+=m.split(`
|
|
21
|
-
`).length-n.firstMatchContent.split(`
|
|
22
|
-
`).length}let h=[];for(let n=0;n<o.length;n++){let a=S.filter(f=>f.index===n);if(a.length>0)for(let f of a)l.has(f)&&h.push(l.get(f));else{let f=r.find(E=>E.index===n);h.push({success:!1,error:f?f.error:`Block ${n+1}: Unknown error.`})}}let F=h.filter(n=>!n.success&&n.error&&n.error.includes("Could not find match"));if(F.length===1)F[0].error+=" (Use Line Anchor or Run tool safely if search string fails)";else if(F.length>1){let n=F[F.length-1];n.error+=`
|
|
23
|
-
(Tip: Use Line Anchor or Run tool safely if search string fails)`}return{content:u,results:h}},he=(e,o,d,p=8,c=!1)=>{if(e===o)return"";let i=(e||"").split(/\r?\n/),x=(o||"").split(/\r?\n/),y=Math.max(i.length,x.length,1),t=Math.max(4,String(y).length),r=g=>String(g).padStart(t," "),s=`[DIFF_START]
|
|
24
|
-
`,l="\u2550".repeat(88),u=V("","",e||"",o||"","","",{context:3});if(!u||!u.hunks||u.hunks.length===0)return"";if(u.hunks.forEach((g,$)=>{$>0&&(s+=`[UI_CONTEXT] ${l}
|
|
25
|
-
`);let S=g.oldStart,h=g.newStart;for(let F of g.lines){let n=F[0],a=F.slice(1);n===" "?(s+=`[UI_CONTEXT] ${r(h)} |${a}
|
|
26
|
-
`,S++,h++):n==="-"?(s+=`-${r(S)} |${a}
|
|
27
|
-
`,S++):n==="+"&&(s+=`+${r(h)} |${a}
|
|
28
|
-
`,h++)}}),c){let g=`[DIFF_START]
|
|
29
|
-
`,$=s.substring(g.length),S=`[UI_CONTEXT] ${l}
|
|
30
|
-
`,F=$.split(S).map(n=>n.split(`
|
|
31
|
-
`).filter(f=>f.trim()!=="").length>120?`[[VERIFIED]]
|
|
32
|
-
${n}
|
|
33
|
-
[[/VERIFIED]]`:n);s=g+F.join(S)}return s+="[DIFF_END]",R(s)},K=e=>{if(!e)return null;let o=e.replace("[UI_CONTEXT]","").replace(/\r/g,""),d=o.startsWith("-"),p=o.startsWith("+"),c=d||p?o.substring(1):o,i=c.indexOf("|"),x=i!==-1?R(c.substring(0,i).trim()):"",y=R(i!==-1?c.substring(i+1):c);return{isR:d,isA:p,num:x,content:y}},Y=(e,o)=>{if(!e&&!o)return 1;if(!e||!o)return 0;let d=e.length,p=o.length,c=e,i=o;d<p&&(c=o,i=e);let x=c.length,y=i.length,t=new Int32Array(y+1),r=new Int32Array(y+1);for(let u=0;u<=y;u++)t[u]=u;for(let u=1;u<=x;u++){r[0]=u;let g=c[u-1];for(let $=1;$<=y;$++)g===i[$-1]?r[$]=t[$-1]:r[$]=Math.min(t[$],r[$-1],t[$-1])+1;t.set(r)}let s=t[y],l=Math.max(d,p);return l===0?1:1-s/l},X=e=>{let o=[],d=[];e.forEach((s,l)=>{s.parsed.isR?o.push({index:l,content:s.parsed.content}):s.parsed.isA&&d.push({index:l,content:s.parsed.content})});let p=o.length,c=d.length;if(p===0||c===0)return;let i=Array.from({length:p+1},()=>Array(c+1).fill(0)),x=Array.from({length:p+1},()=>Array(c+1).fill(""));for(let s=1;s<=p;s++)x[s][0]="up";for(let s=1;s<=c;s++)x[0][s]="left";let y=Array.from({length:p},()=>Array(c).fill(0));for(let s=0;s<p;s++)for(let l=0;l<c;l++)y[s][l]=Y(o[s].content.trim(),d[l].content.trim());for(let s=1;s<=p;s++)for(let l=1;l<=c;l++){let u=y[s-1][l-1],g=u>=.2?u:-10,$=i[s-1][l-1]+g,S=i[s-1][l],h=i[s][l-1];$>=S&&$>=h?(i[s][l]=$,x[s][l]="diag"):S>=h?(i[s][l]=S,x[s][l]="up"):(i[s][l]=h,x[s][l]="left")}let t=p,r=c;for(;t>0||r>0;)if(x[t][r]==="diag"){if(y[t-1][r-1]>=.2){let l=o[t-1].index,u=d[r-1].index;e[l].pairContent=e[u].parsed.content,e[u].pairContent=e[l].parsed.content}t--,r--}else x[t][r]==="up"?t--:r--},N=new Map,D=new Map,H=200,j=5,z=(e,o)=>{o.set(e.key,e),e.type==="chunk"&&e.blocks&&e.blocks.forEach(d=>z(d,o))},de=(e,o)=>{if(!e)return{completed:[],active:[]};let d=`${e.id}-${e.text?.length||0}-${o}-${e.isStreaming}-${e.workedDuration||0}`;if(!e.isStreaming&&N.has(d))return N.get(d);let p=R(ne(e.text||"",e.role)),c=`${e.id}-${o}`,i=new Map;if(e.isStreaming){let h=D.get(c);h&&p.startsWith(h.text)&&(i=h.blocksMap)}let x=(h,F,n,a={})=>{let f=i.get(h);if(f&&f.text===n&&f.type===F&&!!f.isActiveBlock==!!a.isActiveBlock&&!!f.isStreaming==!!a.isStreaming&&f.pairContent===a.pairContent)return f;let E=R(n),w={...a};return typeof w.pairContent=="string"&&(w.pairContent=R(w.pairContent)),Array.isArray(w.wrappedLines)&&(w.wrappedLines=w.wrappedLines.map(R)),{key:h,isStreamingMsg:!!e.isStreaming,workedDuration:e.workedDuration,type:F,text:E,msg:F==="full-message"?e:void 0,...w}};if(p.includes("- Content Preview:")){let h="",F=p.match(/File\s+\[(.*?)\]/i);F&&(h=F[1].split(".").pop().toLowerCase());let w=((p.split("- Content Preview:")[1]||"").split("[SYSTEM] Check the content preview for verification [/SYSTEM]")[0]?.trim()||"").split(`
|
|
34
|
-
`).map(b=>b.replace(/\r$/,"")),C=String(w.length).length,L=[],m=null,k=[],_=()=>{if(!k.length)return;let b=k;k=[],L.push(b.length===1?b[0]:{key:`${b[0].key}-chunk`,type:"chunk",blocks:b})},M=o-(C+6);return w.forEach((b,I)=>{let A=I===w.length-1,T=W(b,M).split(`
|
|
35
|
-
`),O=x(`${e.id||Date.now()}-write-line-${I}`,"write-line",b,{gutterWidth:C,lineNum:I+1,isFirstLine:I===0,isLastLine:A,extension:h,wrappedLines:T});A&&e.isStreaming?(_(),m=O):(k.push(O),k.length>=j&&_())}),_(),{completed:L,active:m?[m]:[]}}if(p.includes("[DIFF_START]")){let h=p.match(/\[DIFF_START\]([\s\S]*?)(?:\[DIFF_END\]|$)/),n=(h?h[1].trim():"").split(`
|
|
36
|
-
`).map(m=>m.replace(/\r$/,"")),a=n.map(m=>({line:m,parsed:K(m),pairContent:null})),f=[];for(let m=0;m<a.length;m++){let k=a[m];k.parsed&&(k.parsed.isR||k.parsed.isA)?f.push(k):f.length>0&&(X(f),f=[])}f.length>0&&X(f);let E=[],w=null,C=[],L=()=>{if(!C.length)return;let m=C;C=[],E.push(m.length===1?m[0]:{key:`${m[0].key}-chunk`,type:"chunk",blocks:m})};return n.forEach((m,k)=>{let _=k===n.length-1,M=a[k].parsed,b=null;M&&(b=W(M.content,o-17).split(`
|
|
37
|
-
`));let I=x(`${e.id||Date.now()}-diff-${k}`,"diff-line",m,{isFirstLine:k===0,isLastLine:_,pairContent:a[k].pairContent,wrappedLines:b});_&&e.isStreaming?(L(),w=I):(C.push(I),C.length>=j&&L())}),L(),{completed:E,active:w?[w]:[]}}if(e.role==="system"||e.isLogo||e.isHelpRecord||e.isTerminalRecord||e.isHomeWarning||e.isImageStats||e.isAskRecord||e.isAboutRecord||e.isUpdateNotification||e.role==="user")return{completed:[x(`${e.id||Date.now()}-full`,"full-message",p)],active:[]};if(!p&&!e.isStreaming){let h={completed:[],active:[]};return N.set(d,h),h}let y=[],t=null,r=[],s=null,l=()=>{if(!r.length)return;let h=r;r=[],s=null,y.push(h.length===1?h[0]:{key:`${e.id||"x"}-chunk-${h[0].key}`,type:"chunk",blocks:h})},u=(h,F=!1)=>{if(s!==null&&s!==h.type&&l(),r.push(h),s=h.type,r.length>=j){if(e.isStreaming&&F)return;l()}},g=Math.max(20,(o||80)-6),$=Math.max(20,(o||80)-8);if(e.role==="think"){y.push(x(`${e.id}-header`,"think-header","",{duration:e.duration}));let h=p.split(`
|
|
38
|
-
`),F=[];h.forEach(n=>{W(n,$).split(`
|
|
39
|
-
`).forEach(f=>F.push(f))}),F.forEach((n,a)=>{let f=a===F.length-1;u(x(`${e.id}-${a}`,"think-line",n,{}),f)}),e.isStreaming||(l(),y.push({key:`${e.id}-footer-padding`,type:"think-footer-padding",text:""}))}else{let h=p.split(`
|
|
40
|
-
`),F=!1,n=[],a=!1,f="",E=0,w=0,C=[];h.forEach(L=>{let m=L.trim();m.startsWith("```")?(a=!a,C.push(L)):a||m.startsWith("|")?C.push(L):W(L,g).split(`
|
|
41
|
-
`).forEach(_=>C.push(_))}),a=!1,C.forEach((L,m)=>{let k=m===C.length-1,_=L.trim().startsWith("|"),M=L.trim().startsWith("```");if(a)M?(a=!1,u(x(`${e.id}-code-close-${w}`,"code-fence-close","",{}),k)):(E++,u(x(`${e.id}-code-line-${m}`,"code-line",L,{lineNum:E,lang:f}),k));else if(M)a=!0,w=m,E=0,f=L.trim().replace(/^```/,"").trim(),u(x(`${e.id}-code-open-${m}`,"code-fence-open",f,{}),k);else if(_){if(F||(F=!0,n=[]),n.push(L),n.length===2){let b=n[0],I=b.split("|");I[0]!==void 0&&I[0].trim()===""&&I.shift(),I.length>0&&I[I.length-1].trim()===""&&I.pop();let A=I.map(T=>T.trim());u(x(`${e.id}-table-hdr-${m}`,"table-header",b,{colHeaders:A,colCount:A.length}),k)}else if(n.length>2){let b=L.split("|");b[0]!==void 0&&b[0].trim()===""&&b.shift(),b.length>0&&b[b.length-1].trim()===""&&b.pop();let I=b.map(P=>P.trim()),A=n[0].split("|");A[0]!==void 0&&A[0].trim()===""&&A.shift(),A.length>0&&A[A.length-1].trim()===""&&A.pop();let T=A.map(P=>P.trim()),O=Math.max(1,T.length);u(x(`${e.id}-table-row-${m}`,"table-row",L,{cells:I,colHeaders:T,colCount:O,rowIndex:n.length-3}),k)}k&&!e.isStreaming&&(l(),u(x(`${e.id}-table-end-${m}`,"table-close","",{}),!0))}else F&&(u(x(`${e.id}-table-end-${m}`,"table-close","",{}),k),F=!1,n=[]),u(x(`${e.id}-${m}`,"agent-line",L,{}),k)}),!e.isStreaming&&e.workedDuration&&(l(),y.push(x(`${e.id}-worked-duration`,"worked-duration","")))}e.isStreaming&&r.length>0?t=r.length===1?r[0]:{key:`${e.id||"x"}-chunk-active-${r[0].key}`,type:"chunk",blocks:r}:l();let S={completed:y,active:t?[t]:[]};if(e.isStreaming){let h=new Map;if(y.forEach(F=>z(F,h)),t&&z(t,h),D.set(c,{text:p,blocksMap:h}),D.size>H){let F=D.keys().next().value;D.delete(F)}}else{if(N.set(d,S),N.size>H){let h=N.keys().next().value;N.delete(h)}D.delete(c)}return S},q={},J=/(\r?\n){2}(?=\[?(?:tool:(?:functions\.)?|tool\.functions|action:(?:functions\.)?|action:|action\.functions|\s*turn\s*:))/gi,B=(e,o)=>{let d=!1,p=!1,c=0;for(;c<o;){if(e.startsWith("```",c)){d=!d,c+=3;continue}if(d){c++;continue}if(e[c]===`
|
|
42
|
-
`){p=!1,c++;continue}e[c]==="`"&&(c===0||e[c-1]!=="\\")&&(p=!p),c++}if(d)return!0;if(p){let i=e.indexOf(`
|
|
43
|
-
`,o),x=i===-1?e.length:i;if(e.substring(o,x).includes("`"))return!0}return!1},Q=/\[SYSTEM\][\s\S]*?\[\/SYSTEM\]|\[ANSWER\][\s\S]*?(?:\[\/ANSWER\]|$)|\[(?:TOOL|ACTION) RESULTS?\]:?\s*|\[\s*turn\s*:\s*(continue|finish)\s*\]|\[\[END\]\]|\[\s*turn\s*:?.*?$|\n\s*turn\s*:?.*?$|\[\s*(?:turn|ANSWER|TOOL|ACTION).*?$|\n\nResponded on .*|\n\n\[Prompted on: .*\]|@\[TerminalName:.*?, ProcessId:.*?\]/gm,ee=/(\$?\\?\/?\\rightarrow\$?|\$\\rightarrow\$)|(\$?\\?\/?\\leftarrow\$?|\$\\leftarrow\$)|(\$?\\?\/?\\uparrow\$?|\$\\uparrow\$)|(\$?\\?\/?\\downarrow\$?|\$\\downarrow\$)|(\$?\\?\/?\\leftrightarrow\$?|\$\\leftrightarrow\$)/gi,te=/\b(write_file|update_file|read_folder|view_file|exec_command|web_search|web_scrape|search_keyword|write_pdf|write_docx|generate_image)\b/gi,v=!1,ne=(e,o="agent")=>{if(!e)return e;let d=o===!0||o==="think",p=o===!1||o==="agent",c=e.replace(/<\|channel>thought/gi,"<think_fluxflow>").replace(/<channel\|>/gi,"</think_fluxflow>");if(d)return c.replace(/^<think_fluxflow>/gi,"").replace(/<\/think_fluxflow>$/gi,"").replace(/^\r?\n+/,"").replace(/\r?\n+$/,"");let i=c;p&&(i=i.replace(/<\/?think_fluxflow>/gi,(t,r,s)=>B(s,r)?t:""),i=i.replace(J,(t,r,s,l)=>!v&&B(l,s)?t:""),i&&(i.includes("[tool:")||i.includes("[action:"))&&(i=i.replace(/<(\w+)(?:[^>]*)>\s*([\s\S]*?\[(?:tool|action):[^\]]*\][\s\S]*?)\s*<\/\1>/gi,(t,r,s)=>s&&(s.includes("[tool:")||s.includes("[action:"))?s.trim():t),v&&(i=i.replace(/```(?:tool|action|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi,(t,r)=>r.includes("[tool:")||r.includes("[action:")?r.trim():t))));let x="tool:",y="action:";if(p&&(i.toLowerCase().includes(x)||i.toLowerCase().includes(y)))for(;;){let t=i.toLowerCase(),r=t.indexOf(x),s=t.indexOf(y),l=x,u=r;if((r===-1||s!==-1&&s<r)&&(l=y,u=s),u===-1)break;if(!v&&B(i,u)){let f=-1,E=0;for(;;){let w=t.indexOf(x,E),C=t.indexOf(y,E),L=-1,m=x;if(w===-1&&C===-1)break;if(w===-1||C!==-1&&C<w?(L=C,m=y):L=w,!B(i,L)){f=L,l=m;break}E=L+m.length}if(f===-1)break;u=f}let g=u,$=!1,S=u-1;for(;S>=0&&/\s/.test(i[S]);)S--;S>=0&&i[S]==="["&&(g=S,$=!0);let h=0,F=!1,n=null,a=u;for(;a<i.length;){let f=i[a];if(!n&&(f==="'"||f==='"'||f==="`")?n=f:n&&f===n&&i[a-1]!=="\\"&&(n=null),n||(f==="("?(h++,F=!0):f===")"&&h--),F&&h===0&&!n){let E=a;if($){let w=a+1;for(;w<i.length&&/\s/.test(i[w]);)w++;w<i.length&&i[w]==="]"&&(E=w)}i=i.substring(0,g)+i.substring(E+1);break}if(a++,a===i.length){i=i.substring(0,g);break}}}return p&&(i=i.replace(/\[\s*(?:tool|action):[a-zA-Z0-9_.]*\s*\([\s\S]*?\)\s*\]/gi,(t,r,s)=>!v&&B(s,r)?t:""),i=i.replace(/\[\s*(?:tool|action):[a-zA-Z0-9_.]*[\s\S]*$/gi,(t,r,s)=>!v&&B(s,r)?t:""),i=i.replace(/^(?:\s*=\s*["'][^"'\n]*["']|\s*[a-zA-Z0-9_]+\s*=\s*(?:["'][^"'\n]*["']|\d+|true|false))(?:\s*,\s*[a-zA-Z0-9_]+\s*=\s*(?:["'][^"'\n]*["']|\d+|true|false))*\s*\)?\]\s*/gm,(t,r,s)=>!v&&B(s,r)?t:""),i=i.replace(/(?:\r?\n|^)\s*=\s*["'][^"'\n]*["'][\s\S]*?\s*\)?\]\s*/g,(t,r,s)=>!v&&B(s,r)?t:`
|
|
44
|
-
`)),i=i.replace(Q,""),i=i.replace(ee,t=>{let r=t.toLowerCase();return r.includes("leftrightarrow")?"\u2194":r.includes("rightarrow")?"\u2192":r.includes("leftarrow")?"\u2190":r.includes("uparrow")?"\u2191":r.includes("downarrow")?"\u2193":t}),i=i.replace(te,t=>q[t.toLowerCase()]||t),i.trim()},pe=()=>{N.clear(),D.clear()};export{R as a,W as b,oe as c,le as d,ce as e,ae as f,fe as g,ue as h,he as i,K as j,X as k,de as l,ne as m,pe as n};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import{a as b,b as C}from"./chunk-3HU67EUI.js";import{a as S}from"./chunk-Y5JU726N.js";import{spawn as A}from"child_process";var P=null;try{let f=await import("node-pty");P=f.default||f}catch{}var I=!!P,y=f=>typeof f!="string"?f:f.replace(/(?:\u001b][\s\S]*?(?:\u0007|\u001b\\))|(?:[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><])/g,""),E=f=>{if(!f)return"";let p=[[]],n=0,o=0,w=/\x1b\[([0-9;]*?)([a-zA-Z])/g,g=0,h,d=a=>{for(let e=0;e<a.length;e++){let t=a[e];if(t===`
|
|
2
|
-
`)for(n++,o=0;n>=p.length;)p.push([]);else if(t==="\r")o=0;else{for(;n>=p.length;)p.push([]);let s=p[n];for(;o>s.length;)s.push(" ");s[o]=t,o++}}};for(;(h=w.exec(f))!==null;){d(f.substring(g,h.index));let a=h[1],e=h[2],t=a?a.split(";").map(Number):[];if(e==="A"){let s=t[0]||1;n=Math.max(0,n-s)}else if(e==="B"){let s=t[0]||1;for(n=n+s;n>=p.length;)p.push([])}else if(e==="C"){let s=t[0]||1;o=o+s}else if(e==="D"){let s=t[0]||1;o=Math.max(0,o-s)}else if(e==="G"){let s=(t[0]||1)-1;o=Math.max(0,s)}else if(e==="H"||e==="f"){let s=(t[0]||1)-1,r=(t[1]||1)-1;for(n=Math.max(0,s),o=Math.max(0,r);n>=p.length;)p.push([])}else if(e==="K"){let s=t[0]||0;if(n<p.length){let r=p[n];if(s===0)r.length=o;else if(s===1)for(let c=0;c<o&&c<r.length;c++)r[c]=" ";else s===2&&(r.length=0)}}else if(e==="J"){let s=t[0]||0;(s===2||s===3)&&(p.length=0,p.push([]),n=0,o=0)}g=w.lastIndex}d(f.substring(g));let O=p.map(a=>a.join(""));for(;O.length>0&&O[O.length-1]==="";)O.pop();return O.join(`
|
|
3
|
-
`)},x=null,k=!1,_=f=>{try{x&&(k&&typeof x.write=="function"?x.write(f):x.stdin&&x.stdin.writable&&x.stdin.write(f))}catch{}},W=()=>{if(x){try{k&&typeof x.destroy=="function"?x.destroy():typeof x.kill=="function"&&(process.platform==="win32"?A("taskkill",["/pid",x.pid,"/f","/t"]):x.kill("SIGKILL"))}catch{}x=null,k=!1}},T=(f,p=!1)=>{if(process.platform!=="win32"||process.env.ADJUST_WINDOWS_COMMAND!=="true")return f;let n=[],o="",w=null,g=!1;for(let e=0;e<f.length;e++){let t=f[e];if(g){o+=t,g=!1;continue}if(t==="\\"){if(!w&&f[e+1]===" "){o+=" ",e++;continue}o+=t,g=!0;continue}w?(t===w&&(w=null),o+=t):t==='"'||t==="'"?(w=t,o+=t):t===";"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push(p?";":"&")):t==="&"&&!o.includes("://")?f[e+1]==="&"?(o.length>0&&(n.push(o),o=""),n.push("&&"),e++):o.endsWith("2>")&&f[e+1]==="1"?(n.push("2>&1"),o="",e++):(o.length>0&&(n.push(o),o=""),n.push("&")):t==="|"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push("|")):(t===">"||t==="<")&&(e===0||/\s|['"]/.test(f[e-1]||""))?(o.length>0&&(n.push(o),o=""),t===">"&&f[e+1]===">"?(n.push(">>"),e++):n.push(t)):/\s/.test(t)?o.length>0&&(n.push(o),o=""):o+=t}o.length>0&&n.push(o);let h=e=>!(!e.includes("/")||/^(https?|file|ftp):\/\//i.test(e)||e.startsWith("@")||e.startsWith("/")&&(e.match(/\//g)||[]).length===1||/\s\/|\/\s/.test(e)||/[\(\)\{\}\;\<\>\=\'\"]/.test(e)),d=[];for(let e=0;e<n.length;e++){let t=n[e];if(t==="mkdir"&&p&&b()){let s=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;c!=="-p"&&c!=="--parents"&&c!=="-v"&&c!=="--verbose"&&s.push(c),r++}if(s.length>0){let c=s.map(i=>{let u=i.replace(/^['"]|['"]$/g,""),l=i;return h(u)&&(l=i.replace(/\//g,"\\")),l});d.push("New-Item","-ItemType","Directory","-Force","-Path",c.join(","))}else d.push("New-Item","-ItemType","Directory","-Force");e=r-1;continue}if(t==="rm"&&p&&b()){let s=[],r=!1,c=!1,i=e+1;for(;i<n.length;){let l=n[i];if([">",">>","<","&","&&","|","||",";"].includes(l))break;l==="-rf"||l==="-fr"?(r=!0,c=!0):l==="-r"||l==="-R"||l==="--recursive"?r=!0:l==="-f"||l==="--force"?c=!0:s.push(l),i++}let u=["Remove-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),s.length>0){let l=s.map(m=>{let R=m.replace(/^['"]|['"]$/g,""),$=m;return h(R)&&($=m.replace(/\//g,"\\")),$});u.push("-Path",l.join(","))}d.push(...u),e=i-1;continue}if(t==="cp"&&p&&b()){let s=[],r=!1,c=!1,i=e+1;for(;i<n.length;){let l=n[i];if([">",">>","<","&","&&","|","||",";"].includes(l))break;l==="-r"||l==="-R"||l==="--recursive"?r=!0:l==="-f"||l==="--force"?c=!0:s.push(l),i++}let u=["Copy-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),s.length>0){let l=s.map(m=>{let R=m.replace(/^['"]|['"]$/g,""),$=m;return h(R)&&($=m.replace(/\//g,"\\")),$});if(l.length>1){let m=l.pop();u.push("-Path",l.join(","),"-Destination",m)}else u.push("-Path",l[0])}d.push(...u),e=i-1;continue}if(t==="touch"&&p&&b()){let s=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;s.push(c),r++}if(s.length>0){let i=`(${s.map(u=>{let l=u.replace(/^['"]|['"]$/g,""),m=u;return h(l)&&(m=u.replace(/\//g,"\\")),m}).join(", ")}) | ForEach-Object { if (Test-Path $_) { (Get-Item $_).LastWriteTime = [System.DateTime]::Now } else { $null | Out-File -FilePath $_ } }`;d.push(i)}e=r-1;continue}if(t==="|"&&n[e+1]==="tee"){n[e+2]==="-a"?(d.push(">>"),e+=2):(d.push(">"),e+=1);continue}if(t==="|"&&n[e+1]==="cat"&&n[e+2]===">"){d.push(">"),e+=2;continue}if(t==="|"){let s=n[e+1];if(s){let r=s.replace(/^['"]|['"]$/g,""),c=/\.(txt|md|json|log|csv|html|css|py|js|xml|yaml|yml|pdf|docx|pptx|xlsx)$/i.test(r);if(h(r)&&c){d.push(">");continue}}}d.push(t)}let O=!1,a=d.map(e=>{if(e==="echo")return O=!0,e;[">",">>","<","&","&&","|","||",";"].includes(e)&&(O=!1);let s=/^['"]|['"]$/.test(e),r=e;O&&s&&(r=e.replace(/^['"]|['"]$/g,""));let c=/^['"]|['"]$/.test(r),i=r.replace(/^['"]|['"]$/g,"");h(i)&&(r=r.replace(/\//g,"\\"));let u=r.replace(/^['"]|['"]$/g,"");return u.includes(" ")&&!c&&(r=`"${u}"`),r});if(p){let e="",t=0;for(let s=0;s<a.length;s++){let r=a[s];r==="&&"?(e+="; if ($?) {",t++):r===";"?(e+=" }".repeat(t)+";",t=0):(e&&!e.endsWith(" ")&&!e.endsWith("{")&&(e+=" "),e+=r)}return e+=" }".repeat(t),e}return a.join(" ")},M=async(f,p={})=>{let{command:n}=S(f),{onChunk:o}=p;if(!n)return'ERROR: Missing "command" argument for Run.';let w=process.platform==="win32",g=p.systemSettings||{},h={};return g.networkAccess===!1&&(h.HTTP_PROXY="http://127.0.0.1:9999",h.HTTPS_PROXY="http://127.0.0.1:9999",h.ALL_PROXY="socks5://127.0.0.1:9999",h.http_proxy="http://127.0.0.1:9999",h.https_proxy="http://127.0.0.1:9999",h.all_proxy="socks5://127.0.0.1:9999",h.NO_PROXY="localhost,127.0.0.1"),new Promise(d=>{let O=a=>{let e=a==="pwsh"||a==="powershell",t=T(n,e),s;w?a==="pwsh"?s="pwsh.exe":a==="powershell"?s="powershell.exe":s="cmd.exe":s=process.env.SHELL||"bash";let r=w?e?["-NoProfile","-Command",t]:["/c",t]:["-c",t];if(g.networkAccess===!1&&!w){let c=s,i=[...r];if(process.platform==="linux")s="unshare",r=["-n","-r",c,...i];else if(process.platform==="darwin"){let u=`(version 1)
|
|
4
|
-
(allow default)
|
|
5
|
-
(deny network-outbound)
|
|
6
|
-
(allow network-outbound (remote ip "localhost:*"))
|
|
7
|
-
(allow network-outbound (remote ip "127.0.0.1:*"))
|
|
8
|
-
`;s="sandbox-exec",r=["-p",u,c,...i]}}if(P)try{let c=P.spawn(s,r,{name:"xterm-256color",cols:p.cols||120,rows:p.rows||30,cwd:process.cwd(),env:{...process.env,CI:"false",TERM:"xterm-256color",FORCE_COLOR:"1",...h}});x=c,k=!0;let i="",u=!1;return c.onData(l=>{if(!u){i+=l,o&&o(l);let m=y(i);/(?:Network:\s+use\s+--host\s+to|Network:\s+Type\s+--host\s+to|Local:\s+http:\/\/localhost:\d+|ready in \d+\s*ms|Compiled successfully|Development server is running|Listening on:)/i.test(m)&&(u=!0,setTimeout(()=>d(`Dev server started successfully in background.
|
|
9
|
-
|
|
10
|
-
${m}`),500))}}),c.onExit(({exitCode:l})=>{if(u)return;x=null;let m=E(i||""),R=y(m).replace(/\n{3,}/g,`
|
|
11
|
-
|
|
12
|
-
`)||"Command executed with no output.";d(l!==0?`ERROR: Command [${n}] failed with exit code [${l}].
|
|
13
|
-
|
|
14
|
-
${R}`:`Command [${n}] completed.
|
|
15
|
-
|
|
16
|
-
${R}`)}),!0}catch(c){return w&&(a==="pwsh"||a==="powershell")&&c.code==="ENOENT"?!1:(v(d,t,n,h,o,a,g),!0)}else return v(d,t,n,h,o,a,g),!0};if(w){let a=C();O(a)||(a==="pwsh"&&!O("powershell")||a==="powershell")&&O("cmd")}else O("bash")})},v=(f,p,n,o,w,g="powershell",h={})=>{let d=process.platform==="win32",O=g==="pwsh"||g==="powershell",a;d?g==="pwsh"?a="pwsh.exe":g==="powershell"?a="powershell.exe":a="cmd.exe":a=process.env.SHELL||"bash";let e=d?O?["-NoProfile","-Command",p]:["/c",p]:["-c",p];if(h.networkAccess===!1&&!d){let i=a,u=[...e];if(process.platform==="linux")a="unshare",e=["-n","-r",i,...u];else if(process.platform==="darwin"){let l=`(version 1)
|
|
17
|
-
(allow default)
|
|
18
|
-
(deny network-outbound)
|
|
19
|
-
(allow network-outbound (remote ip "localhost:*"))
|
|
20
|
-
(allow network-outbound (remote ip "127.0.0.1:*"))
|
|
21
|
-
`;a="sandbox-exec",e=["-p",l,i,...u]}}let t=d?A(a,e,{cwd:process.cwd(),env:{...process.env,...o}}):A(a,e,{cwd:process.cwd(),env:{...process.env,CI:"false",TERM:"xterm-256color",FORCE_COLOR:"1",...o}});x=t,k=!1,t.stdin&&t.stdin.on("error",()=>{x=null});let s="",r="",c=!1;t.stdout.on("data",i=>{if(!c){let u=i.toString();s+=u,w&&w(u);let l=y(s);/(?:Network:\s+use\s+--host\s+to|Network:\s+Type\s+--host\s+to|Local:\s+http:\/\/localhost:\d+|ready in \d+\s*ms|Compiled successfully|Development server is running|Listening on:)/i.test(l)&&(c=!0,setTimeout(()=>f(`Dev server started successfully in background.
|
|
22
|
-
|
|
23
|
-
${l}`),500))}}),t.stderr.on("data",i=>{if(!c){let u=i.toString();r+=u,w&&w(u)}}),t.on("close",i=>{if(c)return;x=null;let u=[],l=E(s),m=E(r);l&&u.push(`STDOUT:
|
|
24
|
-
${l}`),m&&u.push(`STDERR:
|
|
25
|
-
${m}`),i!==0&&u.push(`EXIT CODE: ${i}`);let R=u.join(`
|
|
26
|
-
|
|
27
|
-
`)||"Command executed with no output.",$=y(R).replace(/\n{3,}/g,`
|
|
28
|
-
|
|
29
|
-
`);f(i!==0?`ERROR: Command [${n}] failed with exit code [${i}].
|
|
30
|
-
|
|
31
|
-
${$}`:`Command [${n}] completed.
|
|
32
|
-
|
|
33
|
-
${$}`)}),t.on("error",i=>{if(d&&i.code==="ENOENT"){if(g==="pwsh"){let l=T(n,!0);return v(f,l,n,o,w,"powershell",h)}else if(g==="powershell"){let l=T(n,!1);return v(f,l,n,o,w,"cmd",h)}}x=null;let u=i instanceof Error?i.message:String(i);f(`ERROR: Failed to start command [${n}]: ${u}`)})};export{I as a,y as b,E as c,x as d,k as e,_ as f,W as g,T as h,M as i};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import{a as b}from"./chunk-56EJGQU3.js";import{a as S}from"./chunk-Y5JU726N.js";var U=async(k,$={})=>{let c=S(k).id;if(!c)return'ERROR: Missing "id" argument for getProgress.';let t=b.find(n=>n.id===c);if(!t)return`ERROR: Subagent task with ID [${c}] not found.`;let s=`Subagent Task Status: ${t.status.toUpperCase()}
|
|
2
|
-
`;if(s+=`Title: ${t.title}
|
|
3
|
-
`,s+=`Task: ${t.task}
|
|
4
|
-
`,t.startedAt){let n=Math.floor((Date.now()-t.startedAt)/1e3);s+=`Elapsed Time: ${n}s
|
|
5
|
-
`}if(s+=`Turns Completed: ${t.progress.length}
|
|
6
|
-
`,t.status==="running"||t.status==="waiting"){t.currentTool&&(s+=`Current Tool: ${t.currentTool}
|
|
7
|
-
`);let r=(t.lastChunkTime?Date.now()-t.lastChunkTime:9999)<1e3&&t.wps>0?Math.round(t.wps):0;r>0&&(s+=`tok/s: ${r}
|
|
8
|
-
`)}if(t.questions&&t.questions.length>0){let n=t.questions.filter(r=>!r.answered);n.length>0&&(s+=`
|
|
9
|
-
**PENDING QUESTION**
|
|
10
|
-
`,n.forEach(r=>{s+=`"${r.question}"
|
|
11
|
-
`}),s+=`Respond using tool: [tool:functions.Answer(id="${t.id}", answer="...")]
|
|
12
|
-
|
|
13
|
-
`)}return s+=`
|
|
14
|
-
Progress Log:
|
|
15
|
-
`,t.progress.forEach((n,r)=>{s+=`--- Turn ${r+1} ---
|
|
16
|
-
`;let E=n.filter(i=>!i.startsWith("[SUBAGENT SUCCESS]")).map(i=>{if(i.startsWith("[Subagent Response]")){let h="[Subagent Response]",e=i.substring(h.length),R="tool:";for(;;){let g=e.toLowerCase().indexOf(R);if(g===-1)break;let d=g,T=!1,u=g-1;for(;u>=0&&/\s/.test(e[u]);)u--;u>=0&&e[u]==="["&&(d=u,T=!0);let p=0,m=!1,o=null,a=g;for(;a<e.length;){let l=e[a];if(!o&&(l==="'"||l==='"'||l==="`")?o=l:o&&l===o&&e[a-1]!=="\\"&&(o=null),o||(l==="("?(p++,m=!0):l===")"&&p--),m&&p===0&&!o){let w=a;if(T){let f=a+1;for(;f<e.length&&/\s/.test(e[f]);)f++;f<e.length&&e[f]==="]"&&(w=f)}e=e.substring(0,d)+e.substring(w+1);break}if(a++,a===e.length){e=e.substring(0,d);break}}}return h+`
|
|
17
|
-
`+e.trim()}return i.startsWith("[Executing Tool]")&&i.length>256?i.substring(0,256)+"...[truncated from logs]":i});s+=E.join(`
|
|
18
|
-
`)+`
|
|
19
|
-
|
|
20
|
-
`}),t.status==="completed"&&t.finalAnswer?s+=`Final Answer:
|
|
21
|
-
${t.finalAnswer}
|
|
22
|
-
`:t.status==="failed"&&t.error&&(s+=`Failure Error: ${t.error}
|
|
23
|
-
`),s.replace(/\r\n/g,`
|
|
24
|
-
`).replace(/\n{3,}/g,`
|
|
25
|
-
|
|
26
|
-
`).trim().replace(/\[(?:TOOL|ACTION) RESULT\]/gi,"ACTION RESULT:")};export{U as getProgress};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-BB5UISPJ.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";export{a as getAPIKey,b as getProviderAPIKey,f as getSearchSecrets,d as getSecret,k as removeAPIKey,j as removeSecret,g as saveAPIKey,c as saveProviderAPIKey,i as saveSearchId,h as saveSearchKey,e as saveSecret};
|