fluxflow-cli 4.16.2 → 4.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{ai-6RTKBZ7C.js → ai-7NAPUVPT.js} +1 -1
- package/dist/chunks/app-EFZ3IOWI.js +283 -0
- package/dist/chunks/{chunk-5PKBYQB2.js → chunk-2XZBVZAF.js} +156 -155
- package/dist/chunks/{chunk-TCBC5P3S.js → chunk-AZGFDR6K.js} +1 -1
- package/dist/chunks/chunk-HNUV7OHA.js +48 -0
- package/dist/chunks/{chunk-YVFWOJHY.js → chunk-POB3KUHE.js} +1 -1
- package/dist/chunks/{chunk-ZKQ5PQXN.js → chunk-Q2DA5ED2.js} +1 -1
- package/dist/chunks/{exec_command-7MOYM7IQ.js → exec_command-GJFLZQRS.js} +1 -1
- package/dist/chunks/{invoke-D7WH5BU6.js → invoke-WUFZZUDC.js} +2 -2
- package/dist/chunks/{invokeSync-722CH233.js → invokeSync-NHNXTDRE.js} +2 -2
- package/dist/chunks/{update_file-UFCBJOW5.js → update_file-U2ZALD44.js} +1 -1
- package/dist/chunks/{usageServer-JKD3OZQ7.js → usageServer-M7OKG6CP.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/app-CZ4F6LXZ.js +0 -279
- package/dist/chunks/chunk-M3KCPUDW.js +0 -51
|
@@ -1112,7 +1112,7 @@ import{n as v}from"./chunk-WKHYRBBK.js";import{c as f}from"./chunk-FDNLMLIM.js";
|
|
|
1112
1112
|
<circle cx="12" cy="12" r="2" fill="#EC4899"/>
|
|
1113
1113
|
</svg>\`;
|
|
1114
1114
|
} else if (p.includes('aihubmix') || p.includes('hubmix')) {
|
|
1115
|
-
return \`<svg width="
|
|
1115
|
+
return \`<svg width="\${size}" height="\${size}" viewBox="0 0 24 24" fill="none" style="vertical-align: middle; flex-shrink: 0;" xmlns="http://www.w3.org/2000/svg">
|
|
1116
1116
|
<circle cx="12" cy="4.5" r="2.8" fill="#A855F7"/>
|
|
1117
1117
|
<circle cx="5" cy="18" r="2.8" fill="#D946EF"/>
|
|
1118
1118
|
<circle cx="19" cy="18" r="2.8" fill="#EC4899"/>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import{c as X}from"./chunk-FDNLMLIM.js";import G from"os";var R=t=>typeof t!="string"?t:t.length>12?(t+"").replace("",""):t,v=(t,o)=>{if(!t)return"";let p=/\x1B\[[0-?]*[ -/]*[@-~]/g,x=t.split(`
|
|
2
|
+
`),h=[];if(o<=5)return t;let a=e=>e<32||e>=127&&e<160||e>=768&&e<=879||e>=7616&&e<=7679||e>=8400&&e<=8447||e>=65056&&e<=65071?0:e>=4352&&e<=4447||e>=9001&&e<=9002||e>=11904&&e<=12350||e>=12352&&e<=42191||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=127744&&e<=128591||e>=128640&&e<=128767||e>=131072&&e<=262141?2:1,d=e=>{let s=e.replace(p,""),r=0;for(let l=0;l<s.length;l++){let i=s.codePointAt(l);i>65535&&l++,r+=a(i)}return r},y=(e,s)=>{let r=0,l=e.length,i=!1;for(let $=0;$<e.length;$++){if(e[$]==="\x1B"&&e[$+1]==="["&&(i=!0),i){(e[$]==="m"||e[$]>="@"&&e[$]<="~"&&e[$]!=="[")&&(i=!1);continue}let b=e.codePointAt($);b>65535&&$++;let k=a(b);if(r+k>s){l=b>65535?$-1:$;break}if(r+=k,r>=s){l=$+1;break}}return{head:e.substring(0,l),tail:e.substring(l)}};return x.forEach(e=>{if(d(e)<=o){h.push(e);return}let r=e.split(/(\s+)/),l="",i=0,$=e.match(/^(\s*)/),b=$?$[1]:"";r.forEach(k=>{if(k.length===0)return;let u=k;for(;u.length>0;){let S=d(u);if(i+S<=o){l+=u,i+=S;break}l.trim().length>0&&(h.push(l.trimEnd()),l=b.substring(0,Math.min(b.length,8)),i=d(l));let n=Math.max(1,o-i);if(d(u)>n){let{head:f,tail:c}=y(u,n);h.push((l+f).trimEnd()),l=b.substring(0,Math.min(b.length,8)),i=d(l),u=c}else l+=u,i+=d(u),u=""}}),(l.trimEnd().length>0||l===b)&&h.push(l.trimEnd())}),R(h.join(`
|
|
3
|
+
`))},rt=t=>{if(!t)return 0;let o=0,p=t.match(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g);p&&(o+=p.length*.55);let x=t.replace(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g," "),h=x.match(/[<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+/g);h&&(o+=h.length);let a=x.split(/[\s<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+/g).filter(Boolean);return o+=a.length,Math.max(.1,o)},st=t=>t?t.match(/[\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]|\s+|[<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}-]+|[^\s<>/\._@#$%^&*+=`~|\\:;!?'"()\[\]{}\-\u4e00-\u9fa5\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]+/g)||[t]:[],ot=t=>{if(!t&&t!==0)return"0.0k";let o=typeof t=="string"?parseFloat(t):t;return o>=1e6?`${(o/1e6).toFixed(1)}m`:o>=1e3?`${(o/1e3).toFixed(1)}k`:o.toString()},lt=(t,o=40)=>{let p=X.replaceAll("\\\\","\\");if(t=t.replace(G.homedir(),"~").replace(p,"FluxFlow").replaceAll("\\","/"),!t||t.length<=o)return R(t);let x=Math.floor((o-3)/2);return R(t.substring(0,x)+"..."+t.substring(t.length-x).replaceAll("\\","/"))},at=t=>{let o=[],p=new Set,x=t.allowMultiple===!0||String(t.allowMultiple).toLowerCase()==="true";Object.keys(t).forEach(e=>{let s=e.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(s){let r=s[2]?parseInt(s[2],10):1;p.add(r)}});let h=Array.from(p).sort((e,s)=>e-s),a=["searchContent","search_content","replaceContent","replace_content","content_to_replace","searchBlock","search_block"],d=["newContent","new_content","content_to_add","newBlock","new_block"],y=(e,s,r)=>{let l,i;for(let $ of s){let b=e===1?[`${$}1`,$,`${$}_1`]:[`${$}${e}`,`${$}_${e}`];for(let k of b)if(t[k]!==void 0){l=t[k];break}if(l!==void 0)break}for(let $ of r){let b=e===1?[`${$}1`,$,`${$}_1`]:[`${$}${e}`,`${$}_${e}`];for(let k of b)if(t[k]!==void 0){i=t[k];break}if(i!==void 0)break}return{r:l,n:i}};for(let e of h){let{r:s,n:r}=y(e,a,d);if(s!==void 0&&r!==void 0)o.push({replace:s,new:r});else if(s!==void 0||r!==void 0)return{error:`Mismatched replacement pair for index ${e}. Both replacement and new content must be provided.`,allowMultiple:x}}return{patchPairs:o,allowMultiple:x}},V=t=>{if(!t)return null;let o="",p=0,x=t.length;for(;p<x;){let h=t[p];if(h==="\\"){for(;p<x&&t[p]==="\\";)p++;o+="\\\\*"}else if(h===`
|
|
4
|
+
`)o+="(?:\\r?\\n|\\\\*n|\\\\*r|\\s*)",p++;else if(h==="\r")o+="(?:\\r|\\\\*r)?",p++;else if(h===" ")o+="(?:\\t|\\\\*t|\\s*)",p++;else if(h==='"'||h==="'"||h==="`")o.endsWith("\\\\*")||(o+="\\\\*"),o+=h,p++;else if(/[.*+?^${}()|[\]]/.test(h))o+="\\"+h,p++;else if(/\s/.test(h)){for(;p<x&&/\s/.test(t[p])&&t[p]!==`
|
|
5
|
+
`&&t[p]!=="\r"&&t[p]!==" ";)p++;o+="\\s*"}else o+=h,p++}if(!o)return null;try{return new RegExp(o,"g")}catch{return null}},ct=(t,o,p={})=>{let x=typeof p=="boolean"?p:!!(p&&p.allowMultiple),h=t.replace(/\r\n/g,`
|
|
6
|
+
`).replace(/\r/g,`
|
|
7
|
+
`),a=n=>n.replace(/^```[\w]*\n?/,"").replace(/```\s*$/,"").replace(/\r\n/g,`
|
|
8
|
+
`).replace(/\r/g,`
|
|
9
|
+
`),d=n=>n.match(/^\s*/)[0],y=n=>{let f=n.split(`
|
|
10
|
+
`).filter(C=>C.trim()!=="");if(f.length===0)return"";let c=d(f[0]);for(let C of f){let w=d(C);w.length<c.length&&(c=w)}return c},e=(n,f,c="")=>{if(!n||f===void 0)return n;let w=/^\t/m.test(f)?" ":" ",I=E=>E.split(`
|
|
11
|
+
`).find(M=>M.trim()!=="")??"",L=I(f).match(/^\s*/)[0].length,g=I(n).match(/^\s*/)[0].length,m=L-g,F=(c.match(/^\s*/)||[""])[0].length;return n.split(`
|
|
12
|
+
`).map((E,M)=>{if(E.trim()===""&&M!==0)return"";let T=E.match(/^\s*/)[0].length,_=Math.max(0,T+m);return M===0&&(_=Math.max(0,_-F)),w.repeat(_)+E.trimStart()}).join(`
|
|
13
|
+
`)},s=[];for(let n=0;n<o.length;n++){let f=o[n],c=(f.replace||"").trim(),C=a(f.new||"");if(c.startsWith("^LINE:")&&c.endsWith("$")){let F=c.slice(6,-1).trim().split(".."),A=parseInt(F[0]),E=F[1]!==void 0?parseInt(F[1]):A;if(!isNaN(A)&&!isNaN(E)){let M=h.split(`
|
|
14
|
+
`);if(A<1||A>M.length||E<A||E>M.length){s.push({index:n,success:!1,error:`Block ${n+1}: Line range ^LINE:${A}..${E}$ out of bounds (file has ${M.length} lines).`});continue}let _=M.slice(A-1,E).join(`
|
|
15
|
+
`),O=0;for(let N=0;N<A-1;N++)O+=M[N].length+1;s.push({index:n,success:!0,startPos:O,firstMatchContent:_,content_to_add:C});continue}}let w=a(f.replace||"");if(w===""&&C===""){s.push({index:n,success:!1,error:`Block ${n+1}: Empty replace and add content.`});continue}let I=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),L=null;if(w!==""&&h.includes(w))L=new RegExp(I,"g");else{let m=w.split(`
|
|
16
|
+
`).map(F=>F.trim()).filter(F=>F.length>0).map(F=>F.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\s+/g,"\\s*"));if(m.length>0){let F=m.join("\\s*");try{L=new RegExp(F,"g")}catch{L=new RegExp(I,"g")}}else L=new RegExp(I,"g")}let g=[...h.matchAll(L)];if(g.length===0&&w!==""){let m=V(w);m&&(g=[...h.matchAll(m)])}if(g.length===0){s.push({index:n,success:!1,error:`Block ${n+1}: Could not find match.`});continue}if(g.length>1&&!x){s.push({index:n,success:!1,error:`Block ${n+1}: Found ${g.length} matches (must be unique or use allowMultiple: true if sure).`});continue}for(let m of g)s.push({index:n,success:!0,startPos:m.index,firstMatchContent:m[0],content_to_add:C})}let r=s.filter(n=>n.success).sort((n,f)=>n.startPos-f.startPos);for(let n=0;n<r.length-1;n++){let f=r[n],c=r[n+1];f.startPos+f.firstMatchContent.length>c.startPos&&(f.success=!1,f.error=`Block ${f.index+1}: Overlaps with another block.`,c.success=!1,c.error=`Block ${c.index+1}: Overlaps with another block.`)}let l=new Map,i=h,$=0,b=0,k=s.filter(n=>n.success).sort((n,f)=>n.startPos-f.startPos);for(let n of k){let f=n.startPos,c=h.substring(0,f).split(`
|
|
17
|
+
`).length,C=f+$,w=c+b,I=i.lastIndexOf(`
|
|
18
|
+
`,C)+1,L=i.substring(I,C),g=e(n.content_to_add,n.firstMatchContent,L),m=i.split(`
|
|
19
|
+
`),F=[];for(let T=Math.max(0,w-4);T<w-1;T++)F.push({num:T+1,text:m[T]});let A=n.firstMatchContent.split(`
|
|
20
|
+
`),E=[],M=w+A.length-1;for(let T=M;T<Math.min(m.length,M+3);T++)E.push({num:T+1,text:m[T]});l.set(n,{success:!0,index:n.index,oldContent:n.firstMatchContent,newContent:g,originalStartLine:c,finalStartLine:w,contextBefore:F,contextAfter:E}),i=i.substring(0,C)+g+i.substring(C+n.firstMatchContent.length),$+=g.length-n.firstMatchContent.length,b+=g.split(`
|
|
21
|
+
`).length-n.firstMatchContent.split(`
|
|
22
|
+
`).length}let u=[];for(let n=0;n<o.length;n++){let f=k.filter(c=>c.index===n);if(f.length>0)for(let c of f)l.has(c)&&u.push(l.get(c));else{let c=s.find(C=>C.index===n);u.push({success:!1,error:c?c.error:`Block ${n+1}: Unknown error.`})}}let S=u.filter(n=>!n.success&&n.error&&n.error.includes("Could not find match"));if(S.length===1)S[0].error+=" (Use Line Anchor or Run tool safely if search string fails)";else if(S.length>1){let n=S[S.length-1];n.error+=`
|
|
23
|
+
(Tip: Use Line Anchor or Run tool safely if search string fails)`}return{content:i,results:u}},ft=(t,o,p,x=8,h=!1)=>{if(!p||p.length===0)return"";let a=t.split(/\r?\n/),d=o.split(/\r?\n/),y=Math.max(a.length,d.length,1),e=Math.max(4,String(y).length),s=k=>String(k).padStart(e," "),r=`[DIFF_START]
|
|
24
|
+
`,l="\u2550".repeat(88),i=0,$=null,b=p.filter(k=>k.success).sort((k,u)=>k.originalStartLine-u.originalStartLine);if(b.forEach((k,u)=>{let S=k.finalStartLine!==void 0?k.finalStartLine:k.originalStartLine;if($===null)for(i=Math.max(0,S-4);i<S-1;)r+=`[UI_CONTEXT] ${s(i+1)} |${d[i]||""}
|
|
25
|
+
`,i++;else{let L=$,g=L.originalStartLine+L.oldContent.split(`
|
|
26
|
+
`).length-1;if(k.originalStartLine-g-1>=x){let F=Math.min(d.length,i+3);for(;i<F;)r+=`[UI_CONTEXT] ${s(i+1)} |${d[i]||""}
|
|
27
|
+
`,i++;for(r+=`[UI_CONTEXT] ${l}
|
|
28
|
+
`,i=Math.max(i,S-4);i<S-1;)r+=`[UI_CONTEXT] ${s(i+1)} |${d[i]||""}
|
|
29
|
+
`,i++}else for(;i<S-1;)r+=`[UI_CONTEXT] ${s(i+1)} |${d[i]||""}
|
|
30
|
+
`,i++}let n=k.originalStartLine-1,f=a[n]||"",c=k.oldContent.split(`
|
|
31
|
+
`),C=f.match(/^\s*/),w=C?C[0]:"";c.forEach((L,g)=>{let m=L;if(c.length===1&&f.trim().length>0&&f.includes(L.trim()))m=f;else if(g===0){let F=L.match(/^\s*/);(F?F[0]:"").length<w.length&&f.includes(L.trim())&&(m=w+L.trimStart())}r+=`-${s(k.originalStartLine+g)} |${m}
|
|
32
|
+
`});let I=i;if(k.finalStartLine!==void 0)I=k.finalStartLine-1+(k.newContent?k.newContent.split(`
|
|
33
|
+
`).length:0);else{let L=k.originalStartLine+c.length-1,g=a[L]||null;if(g!==null){let m=u<b.length-1?(b[u+1].originalStartLine||d.length)+10:d.length;for(let F=i;F<m;F++){if(d[F]===g){I=F;break}F===d.length-1&&(I=d.length)}}else I=d.length}for(;i<I;)r+=`+${s(i+1)} |${d[i]||""}
|
|
34
|
+
`,i++;$=k}),$!==null){let k=Math.min(d.length,i+3);for(;i<k;)r+=`[UI_CONTEXT] ${s(i+1)} |${d[i]||""}
|
|
35
|
+
`,i++}if(h){let k=`[DIFF_START]
|
|
36
|
+
`,u=r.substring(k.length),S=`[UI_CONTEXT] ${l}
|
|
37
|
+
`,f=u.split(S).map(c=>c.split(`
|
|
38
|
+
`).filter(w=>w.trim()!=="").length>45?`[[VERIFIED]]
|
|
39
|
+
${c}
|
|
40
|
+
[[/VERIFIED]]`:c);r=k+f.join(S)}return r+="[DIFF_END]",R(r)},K=t=>{if(!t)return null;let o=t.replace("[UI_CONTEXT]","").replace(/\r/g,""),p=o.startsWith("-"),x=o.startsWith("+"),h=p||x?o.substring(1):o,a=h.indexOf("|"),d=a!==-1?R(h.substring(0,a).trim()):"",y=R(a!==-1?h.substring(a+1):h);return{isR:p,isA:x,num:d,content:y}},Y=(t,o)=>{if(!t&&!o)return 1;if(!t||!o)return 0;let p=t.length,x=o.length,h=t,a=o;p<x&&(h=o,a=t);let d=h.length,y=a.length,e=new Int32Array(y+1),s=new Int32Array(y+1);for(let i=0;i<=y;i++)e[i]=i;for(let i=1;i<=d;i++){s[0]=i;let $=h[i-1];for(let b=1;b<=y;b++)$===a[b-1]?s[b]=e[b-1]:s[b]=Math.min(e[b],s[b-1],e[b-1])+1;e.set(s)}let r=e[y],l=Math.max(p,x);return l===0?1:1-r/l},z=t=>{let o=[],p=[];t.forEach((r,l)=>{r.parsed.isR?o.push({index:l,content:r.parsed.content}):r.parsed.isA&&p.push({index:l,content:r.parsed.content})});let x=o.length,h=p.length;if(x===0||h===0)return;let a=Array.from({length:x+1},()=>Array(h+1).fill(0)),d=Array.from({length:x+1},()=>Array(h+1).fill(""));for(let r=1;r<=x;r++)d[r][0]="up";for(let r=1;r<=h;r++)d[0][r]="left";let y=Array.from({length:x},()=>Array(h).fill(0));for(let r=0;r<x;r++)for(let l=0;l<h;l++)y[r][l]=Y(o[r].content.trim(),p[l].content.trim());for(let r=1;r<=x;r++)for(let l=1;l<=h;l++){let i=y[r-1][l-1],$=i>=.2?i:-10,b=a[r-1][l-1]+$,k=a[r-1][l],u=a[r][l-1];b>=k&&b>=u?(a[r][l]=b,d[r][l]="diag"):k>=u?(a[r][l]=k,d[r][l]="up"):(a[r][l]=u,d[r][l]="left")}let e=x,s=h;for(;e>0||s>0;)if(d[e][s]==="diag"){if(y[e-1][s-1]>=.2){let l=o[e-1].index,i=p[s-1].index;t[l].pairContent=t[i].parsed.content,t[i].pairContent=t[l].parsed.content}e--,s--}else d[e][s]==="up"?e--:s--},B=new Map,P=new Map,H=200,W=5,U=(t,o)=>{o.set(t.key,t),t.type==="chunk"&&t.blocks&&t.blocks.forEach(p=>U(p,o))},ht=(t,o)=>{if(!t)return{completed:[],active:[]};let p=`${t.id}-${t.text?.length||0}-${o}-${t.isStreaming}-${t.workedDuration||0}`;if(!t.isStreaming&&B.has(p))return B.get(p);let x=R(et(t.text||"",t.role)),h=`${t.id}-${o}`,a=new Map;if(t.isStreaming){let u=P.get(h);u&&x.startsWith(u.text)&&(a=u.blocksMap)}let d=(u,S,n,f={})=>{let c=a.get(u);if(c&&c.text===n&&c.type===S&&!!c.isActiveBlock==!!f.isActiveBlock&&!!c.isStreaming==!!f.isStreaming&&c.pairContent===f.pairContent)return c;let C=R(n),w={...f};return typeof w.pairContent=="string"&&(w.pairContent=R(w.pairContent)),Array.isArray(w.wrappedLines)&&(w.wrappedLines=w.wrappedLines.map(R)),{key:u,isStreamingMsg:!!t.isStreaming,workedDuration:t.workedDuration,type:S,text:C,msg:S==="full-message"?t:void 0,...w}};if(x.includes("- Content Preview:")){let u="",S=x.match(/File\s+\[(.*?)\]/i);S&&(u=S[1].split(".").pop().toLowerCase());let w=((x.split("- Content Preview:")[1]||"").split("[SYSTEM] Check the content preview for verification [/SYSTEM]")[0]?.trim()||"").split(`
|
|
41
|
+
`).map(E=>E.replace(/\r$/,"")),I=String(w.length).length,L=[],g=null,m=[],F=()=>{if(!m.length)return;let E=m;m=[],L.push(E.length===1?E[0]:{key:`${E[0].key}-chunk`,type:"chunk",blocks:E})},A=o-(I+6);return w.forEach((E,M)=>{let T=M===w.length-1,_=v(E,A).split(`
|
|
42
|
+
`),O=d(`${t.id||Date.now()}-write-line-${M}`,"write-line",E,{gutterWidth:I,lineNum:M+1,isFirstLine:M===0,isLastLine:T,extension:u,wrappedLines:_});T&&t.isStreaming?(F(),g=O):(m.push(O),m.length>=W&&F())}),F(),{completed:L,active:g?[g]:[]}}if(x.includes("[DIFF_START]")){let u=x.match(/\[DIFF_START\]([\s\S]*?)(?:\[DIFF_END\]|$)/),n=(u?u[1].trim():"").split(`
|
|
43
|
+
`).map(g=>g.replace(/\r$/,"")),f=n.map(g=>({line:g,parsed:K(g),pairContent:null})),c=[];for(let g=0;g<f.length;g++){let m=f[g];m.parsed&&(m.parsed.isR||m.parsed.isA)?c.push(m):c.length>0&&(z(c),c=[])}c.length>0&&z(c);let C=[],w=null,I=[],L=()=>{if(!I.length)return;let g=I;I=[],C.push(g.length===1?g[0]:{key:`${g[0].key}-chunk`,type:"chunk",blocks:g})};return n.forEach((g,m)=>{let F=m===n.length-1,A=f[m].parsed,E=null;A&&(E=v(A.content,o-17).split(`
|
|
44
|
+
`));let M=d(`${t.id||Date.now()}-diff-${m}`,"diff-line",g,{isFirstLine:m===0,isLastLine:F,pairContent:f[m].pairContent,wrappedLines:E});F&&t.isStreaming?(L(),w=M):(I.push(M),I.length>=W&&L())}),L(),{completed:C,active:w?[w]:[]}}if(t.role==="system"||t.isLogo||t.isHelpRecord||t.isTerminalRecord||t.isHomeWarning||t.isImageStats||t.isAskRecord||t.isAboutRecord||t.isUpdateNotification||t.role==="user")return{completed:[d(`${t.id||Date.now()}-full`,"full-message",x)],active:[]};if(!x&&!t.isStreaming){let u={completed:[],active:[]};return B.set(p,u),u}let y=[],e=null,s=[],r=null,l=()=>{if(!s.length)return;let u=s;s=[],r=null,y.push(u.length===1?u[0]:{key:`${t.id||"x"}-chunk-${u[0].key}`,type:"chunk",blocks:u})},i=(u,S=!1)=>{if(r!==null&&r!==u.type&&l(),s.push(u),r=u.type,s.length>=W){if(t.isStreaming&&S)return;l()}},$=Math.max(20,(o||80)-6),b=Math.max(20,(o||80)-8);if(t.role==="think"){y.push(d(`${t.id}-header`,"think-header",""));let u=x.split(`
|
|
45
|
+
`),S=[];u.forEach(n=>{v(n,b).split(`
|
|
46
|
+
`).forEach(c=>S.push(c))}),S.forEach((n,f)=>{let c=f===S.length-1;i(d(`${t.id}-${f}`,"think-line",n,{}),c)}),t.isStreaming||(l(),y.push({key:`${t.id}-footer-padding`,type:"think-footer-padding",text:""}))}else{let u=x.split(`
|
|
47
|
+
`),S=!1,n=[],f=!1,c="",C=0,w=0,I=[];u.forEach(L=>{let g=L.trim();g.startsWith("```")?(f=!f,I.push(L)):f||g.startsWith("|")?I.push(L):v(L,$).split(`
|
|
48
|
+
`).forEach(F=>I.push(F))}),f=!1,I.forEach((L,g)=>{let m=g===I.length-1,F=L.trim().startsWith("|"),A=L.trim().startsWith("```");if(f)A?(f=!1,i(d(`${t.id}-code-close-${w}`,"code-fence-close","",{}),m)):(C++,i(d(`${t.id}-code-line-${g}`,"code-line",L,{lineNum:C,lang:c}),m));else if(A)f=!0,w=g,C=0,c=L.trim().replace(/^```/,"").trim(),i(d(`${t.id}-code-open-${g}`,"code-fence-open",c,{}),m);else if(F){if(S||(S=!0,n=[]),n.push(L),n.length===2){let E=n[0],M=E.split("|");M[0]!==void 0&&M[0].trim()===""&&M.shift(),M.length>0&&M[M.length-1].trim()===""&&M.pop();let T=M.map(_=>_.trim());i(d(`${t.id}-table-hdr-${g}`,"table-header",E,{colHeaders:T,colCount:T.length}),m)}else if(n.length>2){let E=L.split("|");E[0]!==void 0&&E[0].trim()===""&&E.shift(),E.length>0&&E[E.length-1].trim()===""&&E.pop();let M=E.map(N=>N.trim()),T=n[0].split("|");T[0]!==void 0&&T[0].trim()===""&&T.shift(),T.length>0&&T[T.length-1].trim()===""&&T.pop();let _=T.map(N=>N.trim()),O=Math.max(1,_.length);i(d(`${t.id}-table-row-${g}`,"table-row",L,{cells:M,colHeaders:_,colCount:O,rowIndex:n.length-3}),m)}m&&!t.isStreaming&&(l(),i(d(`${t.id}-table-end-${g}`,"table-close","",{}),!0))}else S&&(i(d(`${t.id}-table-end-${g}`,"table-close","",{}),m),S=!1,n=[]),i(d(`${t.id}-${g}`,"agent-line",L,{}),m)}),!t.isStreaming&&t.workedDuration&&(l(),y.push(d(`${t.id}-worked-duration`,"worked-duration","")))}t.isStreaming&&s.length>0?e=s.length===1?s[0]:{key:`${t.id||"x"}-chunk-active-${s[0].key}`,type:"chunk",blocks:s}:l();let k={completed:y,active:e?[e]:[]};if(t.isStreaming){let u=new Map;if(y.forEach(S=>U(S,u)),e&&U(e,u),P.set(h,{text:x,blocksMap:u}),P.size>H){let S=P.keys().next().value;P.delete(S)}}else{if(B.set(p,k),B.size>H){let u=B.keys().next().value;B.delete(u)}P.delete(h)}return k},q={},Z=/(\r?\n){2}(?=\[?(?:tool:functions|tool\.functions|agent:generalist|agent\.generalist|\s*turn\s*:))/gi,D=(t,o)=>{let p=!1,x=!1,h=0;for(;h<o;){if(t.startsWith("```",h)){x=!x,h+=3;continue}!x&&t[h]==="`"&&(h===0||t[h-1]!=="\\")&&(p=!p),h++}return x||p},J=/\[SYSTEM\][\s\S]*?\[\/SYSTEM\]|\[ANSWER\][\s\S]*?(?:\[\/ANSWER\]|$)|\[TOOL RESULT\]:?\s*|^\s*(SUCCESS|ERROR):.*(\r?\n)?|\[\s*turn\s*:\s*(continue|finish)\s*\]|\[\[END\]\]|\[\s*turn\s*:?.*?$|\n\s*turn\s*:?.*?$|\[\s*(?:turn|ANSWER|TOOL).*?$|\n\nResponded on .*|\n\n\[Prompted on: .*\]|@\[TerminalName:.*?, ProcessId:.*?\]/gm,Q=/(\$?\\?\/?\\rightarrow\$?|\$\\rightarrow\$)|(\$?\\?\/?\\leftarrow\$?|\$\\leftarrow\$)|(\$?\\?\/?\\uparrow\$?|\$\\uparrow\$)|(\$?\\?\/?\\downarrow\$?|\$\\downarrow\$)|(\$?\\?\/?\\leftrightarrow\$?|\$\\leftrightarrow\$)/gi,tt=/\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,j=!1,et=(t,o="agent")=>{if(!t)return t;let p=o===!0||o==="think",x=o===!1||o==="agent",h=t.replace(/<\|channel>thought/gi,"<think>").replace(/<channel\|>/gi,"</think>");if(p)return h.replace(/^<(think|thought|thoughts|thinking)>/gi,"").replace(/<\/(think|thought|thoughts|thinking)>$/gi,"").replace(/^\r?\n+/,"").replace(/\r?\n+$/,"");let a=h;x&&(a=a.replace(/<\/?(?:think|thought|thoughts|thinking)>/gi,(e,s,r)=>D(r,s)?e:""),a=a.replace(Z,(e,s,r,l)=>!j&&D(l,r)?e:""),a&&a.includes("[tool:")&&(a=a.replace(/<(\w+)(?:[^>]*)>\s*([\s\S]*?\[tool:[^\]]*\][\s\S]*?)\s*<\/\1>/gi,(e,s,r)=>r&&r.includes("[tool:")?r.trim():e),j&&(a=a.replace(/```(?:tool|yaml|function|json)?\s*\n?([\s\S]*?)\n?\```/gi,(e,s)=>s.includes("[tool:")?s.trim():e))));let d="tool:functions.",y="agent:generalist.";if(x&&(a.toLowerCase().includes(d)||a.toLowerCase().includes(y)))for(;;){let e=a.toLowerCase(),s=e.indexOf(d),r=e.indexOf(y),l=d,i=s;if((s===-1||r!==-1&&r<s)&&(l=y,i=r),i===-1)break;if(!j&&D(a,i)){let c=i+l.length,C=e.indexOf(d,c),w=e.indexOf(y,c);if(C===-1&&w===-1)break;let I=-1,L=0;for(;;){let g=e.indexOf(d,L),m=e.indexOf(y,L),F=-1,A=d;if(g===-1&&m===-1)break;if(g===-1||m!==-1&&m<g?(F=m,A=y):F=g,!D(a,F)){I=F,l=A;break}L=F+A.length}if(I===-1)break;i=I}let $=i,b=!1,k=i-1;for(;k>=0&&/\s/.test(a[k]);)k--;k>=0&&a[k]==="["&&($=k,b=!0);let u=0,S=!1,n=null,f=i;for(;f<a.length;){let c=a[f];if(!n&&(c==="'"||c==='"'||c==="`")?n=c:n&&c===n&&a[f-1]!=="\\"&&(n=null),n||(c==="("?(u++,S=!0):c===")"&&u--),S&&u===0&&!n){let C=f;if(b){let w=f+1;for(;w<a.length&&/\s/.test(a[w]);)w++;w<a.length&&a[w]==="]"&&(C=w)}a=a.substring(0,$)+a.substring(C+1);break}if(f++,f===a.length)return S&&u>0&&(a=a.substring(0,$)),a}}return a=a.replace(J,""),a=a.replace(Q,e=>{let s=e.toLowerCase();return s.includes("leftrightarrow")?"\u2194":s.includes("rightarrow")?"\u2192":s.includes("leftarrow")?"\u2190":s.includes("uparrow")?"\u2191":s.includes("downarrow")?"\u2193":e}),a=a.replace(tt,e=>q[e.toLowerCase()]||e),a.trim()},ut=()=>{B.clear(),P.clear()};export{R as a,v as b,rt as c,st as d,ot as e,lt as f,at as g,ct as h,ft as i,K as j,z as k,ht as l,j as m,et as n,ut as o};
|
|
@@ -42,7 +42,7 @@ Tool Rules:
|
|
|
42
42
|
- Max 5 tools/turn${e==="Flux"||e.toLowerCase()==="fluxcu"?" (Goal: 5+)":""}
|
|
43
43
|
${e==="Flux"||e.toLowerCase()==="fluxcu"?`${f}`:""}
|
|
44
44
|
**User Communication**
|
|
45
|
-
- AskUser(question=string, optionA
|
|
45
|
+
- AskUser(question=string, optionA?="title::description", ...MAX4). Ambiguity, path divergence, security risk
|
|
46
46
|
|
|
47
47
|
**Web Tools**
|
|
48
48
|
- WebSearch(query=string, aiMode?=bool, limit?=int[3..10]). Proactive use for unknown/latest info. aiMode: exclude limit
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,b as T}from"./chunk-
|
|
1
|
+
import{a as b,b as T}from"./chunk-POB3KUHE.js";import{a as A}from"./chunk-Y5JU726N.js";import{spawn as C}from"child_process";var P=null;try{let f=await import("node-pty");P=f.default||f}catch{}var _=!!P,S=f=>typeof f!="string"?f:f.replace(/[\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=u=>{for(let e=0;e<u.length;e++){let s=u[e];if(s===`
|
|
2
2
|
`)for(n++,o=0;n>=p.length;)p.push([]);else if(s==="\r")o=0;else{for(;n>=p.length;)p.push([]);let t=p[n];for(;o>t.length;)t.push(" ");t[o]=s,o++}}};for(;(h=w.exec(f))!==null;){d(f.substring(g,h.index));let u=h[1],e=h[2],s=u?u.split(";").map(Number):[];if(e==="A"){let t=s[0]||1;n=Math.max(0,n-t)}else if(e==="B"){let t=s[0]||1;for(n=n+t;n>=p.length;)p.push([])}else if(e==="C"){let t=s[0]||1;o=o+t}else if(e==="D"){let t=s[0]||1;o=Math.max(0,o-t)}else if(e==="G"){let t=(s[0]||1)-1;o=Math.max(0,t)}else if(e==="H"||e==="f"){let t=(s[0]||1)-1,r=(s[1]||1)-1;for(n=Math.max(0,t),o=Math.max(0,r);n>=p.length;)p.push([])}else if(e==="K"){let t=s[0]||0;if(n<p.length){let r=p[n];if(t===0)r.length=o;else if(t===1)for(let c=0;c<o&&c<r.length;c++)r[c]=" ";else t===2&&(r.length=0)}}else if(e==="J"){let t=s[0]||0;(t===2||t===3)&&(p.length=0,p.push([]),n=0,o=0)}g=w.lastIndex}d(f.substring(g));let O=p.map(u=>u.join(""));for(;O.length>0&&O[O.length-1]==="";)O.pop();return O.join(`
|
|
3
3
|
`)},x=null,k=!1,D=f=>{try{x&&(k&&typeof x.write=="function"?x.write(f):x.stdin&&x.stdin.writable&&x.stdin.write(f))}catch{}},F=()=>{if(x){try{k&&typeof x.destroy=="function"?x.destroy():typeof x.kill=="function"&&(process.platform==="win32"?C("taskkill",["/pid",x.pid,"/f","/t"]):x.kill("SIGKILL"))}catch{}x=null,k=!1}},v=(f,p=!1)=>{if(process.platform!=="win32")return f;let n=[],o="",w=null,g=!1;for(let e=0;e<f.length;e++){let s=f[e];if(g){o+=s,g=!1;continue}if(s==="\\"){if(f[e+1]===" "){o+=" ",e++;continue}o+=s,g=!0;continue}w?(s===w&&(w=null),o+=s):s==='"'||s==="'"?(w=s,o+=s):s===";"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push(p?";":"&")):s==="&"&&!o.includes("://")?f[e+1]==="&"?(o.length>0&&(n.push(o),o=""),n.push("&&"),e++):(o.length>0&&(n.push(o),o=""),n.push("&")):s==="|"&&!o.includes("://")?(o.length>0&&(n.push(o),o=""),n.push("|")):/\s/.test(s)?o.length>0&&(n.push(o),o=""):o+=s}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 s=n[e];if(s==="mkdir"&&p&&b()){let t=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;c!=="-p"&&c!=="--parents"&&c!=="-v"&&c!=="--verbose"&&t.push(c),r++}if(t.length>0){let c=t.map(i=>{let a=i.replace(/^['"]|['"]$/g,""),l=i;return h(a)&&(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(s==="rm"&&p&&b()){let t=[],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:t.push(l),i++}let a=["Remove-Item"];if(r&&a.push("-Recurse"),c&&a.push("-Force"),t.length>0){let l=t.map(m=>{let $=m.replace(/^['"]|['"]$/g,""),R=m;return h($)&&(R=m.replace(/\//g,"\\")),R});a.push("-Path",l.join(","))}d.push(...a),e=i-1;continue}if(s==="cp"&&p&&b()){let t=[],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:t.push(l),i++}let a=["Copy-Item"];if(r&&a.push("-Recurse"),c&&a.push("-Force"),t.length>0){let l=t.map(m=>{let $=m.replace(/^['"]|['"]$/g,""),R=m;return h($)&&(R=m.replace(/\//g,"\\")),R});if(l.length>1){let m=l.pop();a.push("-Path",l.join(","),"-Destination",m)}else a.push("-Path",l[0])}d.push(...a),e=i-1;continue}if(s==="touch"&&p&&b()){let t=[],r=e+1;for(;r<n.length;){let c=n[r];if([">",">>","<","&","&&","|","||",";"].includes(c))break;t.push(c),r++}if(t.length>0){let i=`(${t.map(a=>{let l=a.replace(/^['"]|['"]$/g,""),m=a;return h(l)&&(m=a.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(s==="|"&&n[e+1]==="tee"){n[e+2]==="-a"?(d.push(">>"),e+=2):(d.push(">"),e+=1);continue}if(s==="|"&&n[e+1]==="cat"&&n[e+2]===">"){d.push(">"),e+=2;continue}if(s==="|"){let t=n[e+1];if(t){let r=t.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(s)}let O=!1,u=d.map(e=>{if(e==="echo")return O=!0,e;[">",">>","<","&","&&","|","||",";"].includes(e)&&(O=!1);let t=/^['"]|['"]$/.test(e),r=e;O&&t&&(r=e.replace(/^['"]|['"]$/g,""));let c=/^['"]|['"]$/.test(r),i=r.replace(/^['"]|['"]$/g,"");h(i)&&(r=r.replace(/\//g,"\\"));let a=r.replace(/^['"]|['"]$/g,"");return a.includes(" ")&&!c&&(r=`"${a}"`),r});if(p){let e="",s=0;for(let t=0;t<u.length;t++){let r=u[t];r==="&&"?(e+="; if ($?) {",s++):r===";"?(e+=" }".repeat(s)+";",s=0):(e&&!e.endsWith(" ")&&!e.endsWith("{")&&(e+=" "),e+=r)}return e+=" }".repeat(s),e}return u.join(" ")},M=async(f,p={})=>{let{command:n}=A(f),{onChunk:o}=p;if(!n)return'ERROR: Missing "command" argument for exec_command.';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=u=>{let e=u==="pwsh"||u==="powershell",s=v(n,e),t;w?u==="pwsh"?t="pwsh.exe":u==="powershell"?t="powershell.exe":t="cmd.exe":t=process.env.SHELL||"bash";let r=w?e?["-NoProfile","-Command",s]:["/c",s]:["-c",s];if(g.networkAccess===!1&&!w){let c=t,i=[...r];if(process.platform==="linux")t="unshare",r=["-n","-r",c,...i];else if(process.platform==="darwin"){let a=`(version 1)
|
|
4
4
|
(allow default)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-Q2DA5ED2.js";import"./chunk-POB3KUHE.js";import"./chunk-Y5JU726N.js";export{c as activeChildProcess,g as adjustWindowsCommand,b as cleanTerminalOutput,h as exec_command,d as isActiveCommandPty,a as isPtyAvailable,f as terminateActiveCommand,e as writeToActiveCommand};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-
|
|
1
|
+
import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-7NAPUVPT.js"),l=b(w),c=l.task||l.instruction||l.prompt,C=l.model||null,E=l.title||null,m=l.tools||null;if(!c)return'ERROR: Missing "task" argument for invoke.';let f=null;if(m)try{let t=m.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),f=t.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let i=`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,h=null,S=null,$=new Promise((t,n)=>{h=t,S=n}),e={id:i,title:E||c.substring(0,30),task:c,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:t=>{t&&e.pendingSteerMessages.push(t)},completionPromise:$,_resolveCompletion:h,_rejectCompletion:S,progress:[]},r={chunks:[],totalWords:0};k.push(e),s.onSubagentUpdate&&s.onSubagentUpdate();let a=[],M={...s,taskId:i,onAskMain:async t=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,p=new Promise(g=>{o=g}),u={id:n,question:t,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return e.questions.push(u),e.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" is WAITING FOR YOUR INPUT: "${t}"
|
|
2
2
|
Respond using tool: [tool:functions.Answer(id="${i}", answer="...")]
|
|
3
3
|
[/SYSTEM]`),await p},onVisualFeedback:t=>{e.lastChunkTime=Date.now();let n=t.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?e.currentTool=o[1].trim():e.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(t,n)=>{let o=Date.now();if(e.lastChunkTime=o,e.currentTool="Thinking",typeof n=="number"&&n>0){r.totalWords+=n,r.chunks.push({time:o,words:n});let p=o-400;if(r.chunks=r.chunks.filter(u=>u.time>=p),r.chunks.length>0){let u=r.chunks.reduce((_,A)=>_+A.words,0),T=r.chunks[0].time,g=Math.max(.4,(o-T)/1e3);e.wps=Math.round(u/g)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return U(c,M,C,f,50,t=>{if(e.status==="cancelled")return;if(t.startsWith("[Subagent Turn")&&a.length>0&&(e.progress.push([...a]),a=[]),t.includes("[Executing Tool]")){let o=t.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!e.currentTool||e.currentTool==="Thinking")&&(e.currentTool=o[1])}let n=t;if(n.startsWith("[Tool Result]")){let o=n.split(`
|
|
4
4
|
`);o.length>5&&(n=o.slice(0,4).join(`
|
|
5
5
|
`)+`
|
|
6
|
-
... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-
|
|
6
|
+
... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-7NAPUVPT.js");if(t.message==="Subagent task was cancelled."||e.status==="cancelled"||n()){e.status="cancelled",a.push("[SUBAGENT CANCELLED] Task was cancelled."),e.progress.push([...a]),s.onSubagentUpdate&&s.onSubagentUpdate(),e._resolveCompletion&&e._resolveCompletion(null);return}a.push(`[SUBAGENT FAILURE] Error: ${t.message}`),e.progress.push([...a]),e.status="failed",e.error=t.message,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) FAILED with error: ${t.message}. [/SYSTEM]`),e._rejectCompletion&&e._rejectCompletion(t)}),`SUCCESS: Background subagent started. Task ID: ${i}`};export{I as invoke};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-
|
|
2
|
-
`),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-
|
|
1
|
+
import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-7NAPUVPT.js"),s=o(b),a=s.task||s.instruction||s.prompt,m=s.model||null,l=s.tools||null;if(!a)return'ERROR: Missing "task" argument for invokeSync.';let r=null;if(l)try{let e=l.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),r=e.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let n=s.title||a.substring(0,30);try{t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n}`);let e=await u(a,t,m,r,50);return t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} [COMPLETED]
|
|
2
|
+
`),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-7NAPUVPT.js"),c=e.message==="Subagent task was cancelled by user."||i();if(t.onVisualFeedback){let d=c?"[CANCELLED]":"[FAILED]";t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} ${d}
|
|
3
3
|
`)}return`ERROR: Subagent execution failed: ${e.message}`}};export{k as invokeSync};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as h,h as m,i as R}from"./chunk-
|
|
1
|
+
import{g as h,h as m,i as R}from"./chunk-HNUV7OHA.js";import{a as F}from"./chunk-KFM2OZWJ.js";import{l as g}from"./chunk-AAPXJU65.js";import"./chunk-SIINYZWE.js";import"./chunk-FDNLMLIM.js";import{a as $}from"./chunk-Y5JU726N.js";import c from"fs";import M from"path";var v=async(w,S={})=>{let n=$(w),t=n.path;if(!t)return'ERROR: Missing "path" argument for PatchFile.';let{patchPairs:o,allowMultiple:C,error:p}=h(n);if(p)return`ERROR: ${p}`;if(o.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let E=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":C,i=M.resolve(process.cwd(),t);try{if(!c.existsSync(i))return`ERROR: File [${t}] does not exist. Use WriteFile instead.`;let e=S.forcedContent||c.readFileSync(i,"utf8");e.startsWith("\uFEFF")&&(e=e.slice(1));let s=e.replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`),{content:u,results:l}=m(s,o,{allowMultiple:E}),a=l.filter(r=>!r.success),f=l.filter(r=>r.success);if(f.length===0)return`ERROR: Patch Failed to apply to [${t}].
|
|
4
4
|
${a.map(r=>` \u2022 ${r.error}`).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-AZGFDR6K.js";import"./chunk-WKHYRBBK.js";import"./chunk-AAPXJU65.js";import"./chunk-SIINYZWE.js";import"./chunk-FDNLMLIM.js";export{b as openUsageDashboard,a as startUsageServer};
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import{a as m}from"./chunks/chunk-FDNLMLIM.js";import{spawn as ce}from"child_process";import{fileURLToPath as D}from"url";import ue from"os";import B from"path";import h from"fs";import w from"dotenv";try{let e=B.join(m,"AGENTS.md"),r=B.join(m,"FLUXFLOW.md");h.existsSync(m)||h.mkdirSync(m,{recursive:!0}),h.existsSync(e)||h.writeFileSync(e,"","utf8"),h.existsSync(r)||h.writeFileSync(r,"","utf8")}catch{}w.config({path:"./.env",override:!0,quiet:!0});w.config({path:`${m}/.env`,override:!0,quiet:!0});w.config({path:`${m}/.env.agents`,override:!0,quiet:!0});w.config({path:`${m}/.env.fluxflow`,override:!0,quiet:!0});w.config({path:"./.env.agents",override:!0,quiet:!0});w.config({path:"./.env.fluxflow",override:!0,quiet:!0});process.env.NO_INS=!1;var me=ue.totalmem(),j=me/(1024*1024),pe=.5,de=Math.floor(j*pe),G=process.argv.slice(2),U=G.indexOf("--allocation"),s=U!==-1?parseInt(G[U+1],10):NaN,ge=process.env.EXPERIMENTAL_MEMORY_MANAGER==="true"||process.env.EXPERIMENTAL_MEMORY_MANAGER==="1"||process.env.EXPERIMENTAL_MEMORY_MANAGER===!0||process.env.EXPERIMENTAL_MEMORY_MANAGER===1||!1,fe=!isNaN(s)||ge||!1;!isNaN(s)&&s<64&&(console.error(`
|
|
3
3
|
[ERROR] Allocation value '${s} MB' is too low. Minimum: 64 MB, Recommended: 4096 MB.
|
|
4
4
|
`),process.exit(1));var M=Math.floor(j*.75),xe=!isNaN(s)&&s>0?Math.min(s,M):Math.max(1536,Math.min(32768,de)),he=D(import.meta.url).endsWith(".js");if(he&&!process.execArgv.some(e=>e.includes("max-old-space-size"))&&fe)Number.isNaN(s)||(console.log(`
|
|
5
|
-
[MEMORY] Starting with: '${s>M?M:s} MB' Allocation${s>M?" (Max allowed: '"+M+" MB')":""}. Please Wait...`),await new Promise(r=>setTimeout(r,5e3))),ce(process.execPath,[`--max-old-space-size=${xe}`,"--expose-gc","--max-semi-space-size=1",D(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",r=>process.exit(r||0));else{let e=process.argv.slice(2),r=e.includes("--help")&&e[e.indexOf("--help")+1]==="commands",P=e.includes("--help")&&!r,N=e.includes("--version")||e.includes("-v"),R=e[0]==="--update",I=e[0]==="--export";if(e[0]==="--usage"||e.includes("--usage")||e[0]==="--budget"||e.includes("--budget")){let{openUsageDashboard:o}=await import("./chunks/usageServer-
|
|
5
|
+
[MEMORY] Starting with: '${s>M?M:s} MB' Allocation${s>M?" (Max allowed: '"+M+" MB')":""}. Please Wait...`),await new Promise(r=>setTimeout(r,5e3))),ce(process.execPath,[`--max-old-space-size=${xe}`,"--expose-gc","--max-semi-space-size=1",D(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",r=>process.exit(r||0));else{let e=process.argv.slice(2),r=e.includes("--help")&&e[e.indexOf("--help")+1]==="commands",P=e.includes("--help")&&!r,N=e.includes("--version")||e.includes("-v"),R=e[0]==="--update",I=e[0]==="--export";if(e[0]==="--usage"||e.includes("--usage")||e[0]==="--budget"||e.includes("--budget")){let{openUsageDashboard:o}=await import("./chunks/usageServer-M7OKG6CP.js"),{url:a}=await o();console.log(`
|
|
6
6
|
\u2726 FluxFlow Token Usage & Analytics Dashboard
|
|
7
7
|
\u2800\u2800\u2514\u2500 Serving at: ${a}
|
|
8
8
|
\u2800\u2800\u2514\u2500 Opened in default browser. Press Ctrl+C to stop.
|
|
@@ -63,4 +63,4 @@ Usage: fluxflow --export error`),process.exit(1)}if(N&&(console.log(`v${d}`),pro
|
|
|
63
63
|
/docs View documentation
|
|
64
64
|
/fluxflow init Create FluxFlow.md template
|
|
65
65
|
/update check Check for new version
|
|
66
|
-
/update latest Install latest release`),process.exit(0)),R){let y=e[1]||"latest";if(y==="check"){let l=e[2]==="latest";try{let x=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;x||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(l?`Latest version: v${x}`:x!==d?`A new version of FluxFlow is available: v${x} (current: v${d}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${d}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(y==="latest"){console.log("Checking latest version and settings...");try{let n=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;n||(console.error("Error: Could not retrieve latest version."),process.exit(1)),n===d&&(console.log(`FluxFlow is already up to date (v${d}).`),process.exit(0));let x=async()=>{let t=(await import("react")).default,{useState:L}=t,{render:K,Box:f,Text:b}=await import("ink"),Q=(await import("ink-select-input")).default,Z=(await import("ink-text-input")).default;return new Promise(ee=>{let oe=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],te=({label:S,isSelected:C})=>t.createElement(f,{width:"100%"},t.createElement(b,{bold:C},"\u2514\u2500 ",C?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",S)),T,se=()=>{let[S,C]=L("select"),[ae,ne]=L(""),ie=F=>{F.value==="custom"?C("custom"):_({manager:F.value})},le=F=>{_({manager:"custom",customCommand:F})};return S==="custom"?t.createElement(f,{flexDirection:"column",marginY:1},t.createElement(f,{marginBottom:1},t.createElement(b,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),t.createElement(f,{flexDirection:"row"},t.createElement(b,{color:"cyan",bold:!0}," \u276F "),t.createElement(Z,{value:ae,onChange:ne,onSubmit:le})),t.createElement(f,{marginTop:1},t.createElement(b,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):t.createElement(f,{flexDirection:"column",marginY:1},t.createElement(f,{marginBottom:1},t.createElement(b,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),t.createElement(Q,{items:oe,onSelect:ie,itemComponent:te,indicatorComponent:()=>null}))},_=S=>{T&&T(),ee(S)},{unmount:re}=K(t.createElement(se,null));T=re})},u,O="",E;try{let{loadSettings:t}=await import("./chunks/settings-2IFZMDUD.js");E=await t(),u=E?.systemSettings?.updateManager||E?.updateManager}catch{}if(!u){let t=await x();u=t.manager,O=t.customCommand}let g="";u==="pnpm"?g=`pnpm add -g fluxflow-cli@${n}`:u==="bun"?g=`bun add -g fluxflow-cli@${n}`:u==="yarn"?g=`yarn global add fluxflow-cli@${n}`:u==="custom"?g=O||E?.customUpdateCommand||`npm install -g fluxflow-cli@${n}`:g=`npm install -g fluxflow-cli@${n}`,console.log(`Updating FluxFlow to v${n} using ${u}...`),console.log(`Running: ${g}`);let{execSync:J}=await import("child_process");J(g,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${n}.\x1B[0m`)}catch(l){console.error("\x1B[31m\u274C Update failed:\x1B[0m",l.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:Y}=await import("react"),{render:W}=await import("ink"),{default:q}=await import("./chunks/app-
|
|
66
|
+
/update latest Install latest release`),process.exit(0)),R){let y=e[1]||"latest";if(y==="check"){let l=e[2]==="latest";try{let x=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;x||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(l?`Latest version: v${x}`:x!==d?`A new version of FluxFlow is available: v${x} (current: v${d}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${d}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(y==="latest"){console.log("Checking latest version and settings...");try{let n=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;n||(console.error("Error: Could not retrieve latest version."),process.exit(1)),n===d&&(console.log(`FluxFlow is already up to date (v${d}).`),process.exit(0));let x=async()=>{let t=(await import("react")).default,{useState:L}=t,{render:K,Box:f,Text:b}=await import("ink"),Q=(await import("ink-select-input")).default,Z=(await import("ink-text-input")).default;return new Promise(ee=>{let oe=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],te=({label:S,isSelected:C})=>t.createElement(f,{width:"100%"},t.createElement(b,{bold:C},"\u2514\u2500 ",C?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",S)),T,se=()=>{let[S,C]=L("select"),[ae,ne]=L(""),ie=F=>{F.value==="custom"?C("custom"):_({manager:F.value})},le=F=>{_({manager:"custom",customCommand:F})};return S==="custom"?t.createElement(f,{flexDirection:"column",marginY:1},t.createElement(f,{marginBottom:1},t.createElement(b,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),t.createElement(f,{flexDirection:"row"},t.createElement(b,{color:"cyan",bold:!0}," \u276F "),t.createElement(Z,{value:ae,onChange:ne,onSubmit:le})),t.createElement(f,{marginTop:1},t.createElement(b,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):t.createElement(f,{flexDirection:"column",marginY:1},t.createElement(f,{marginBottom:1},t.createElement(b,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),t.createElement(Q,{items:oe,onSelect:ie,itemComponent:te,indicatorComponent:()=>null}))},_=S=>{T&&T(),ee(S)},{unmount:re}=K(t.createElement(se,null));T=re})},u,O="",E;try{let{loadSettings:t}=await import("./chunks/settings-2IFZMDUD.js");E=await t(),u=E?.systemSettings?.updateManager||E?.updateManager}catch{}if(!u){let t=await x();u=t.manager,O=t.customCommand}let g="";u==="pnpm"?g=`pnpm add -g fluxflow-cli@${n}`:u==="bun"?g=`bun add -g fluxflow-cli@${n}`:u==="yarn"?g=`yarn global add fluxflow-cli@${n}`:u==="custom"?g=O||E?.customUpdateCommand||`npm install -g fluxflow-cli@${n}`:g=`npm install -g fluxflow-cli@${n}`,console.log(`Updating FluxFlow to v${n} using ${u}...`),console.log(`Running: ${g}`);let{execSync:J}=await import("child_process");J(g,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${n}.\x1B[0m`)}catch(l){console.error("\x1B[31m\u274C Update failed:\x1B[0m",l.message),process.exit(1)}process.exit(0)}else console.error("Unknown update command. Available options: --update, --update check, --update check latest, --update latest"),process.exit(1)}}let{default:Y}=await import("react"),{render:W}=await import("ink"),{default:q}=await import("./chunks/app-EFZ3IOWI.js");process.env.NODE_NO_WARNINGS="1";let X=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],H=console.log,V=console.warn,z=console.error,k=o=>{let a=o.map(String).join(" ");return X.some(i=>a.includes(i))};console.log=(...o)=>!k(o)&&H(...o),console.warn=(...o)=>!k(o)&&V(...o),console.error=(...o)=>!k(o)&&z(...o);let A=e.findIndex(o=>o==="--cwd"||o==="--path");if(A!==-1&&A+1<e.length){let o=e[A+1],a=await import("path"),i=await import("fs-extra"),p=a.default.resolve(o);try{i.default.existsSync(p)&&i.default.statSync(p).isDirectory()?process.chdir(p):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(v){console.error(`[ERROR] Failed to change directory to "${o}": ${v.message}`),process.exit(0)}}process.stdout.write("\x1B[2J\x1B[3J\x1B[H"),process.stdout.isTTY&&(process.stdout.write("\x1B]0;FluxFlow\x07"),process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow\x07"),process.stdout.write("\x1B[?2004h"));let $=()=>{process.stdout.isTTY&&process.stdout.write("\x1B[?2004l")};if(process.on("exit",$),["SIGINT","SIGTERM","SIGHUP"].forEach(o=>{process.once(o,()=>{$(),process.exit(0)})}),e.includes("--playground")){let o=process.cwd();process.argv.push("--original-cwd",o);let{DATA_DIR:a}=await import("./chunks/paths-PM7MFWJK.js"),i=await import("path"),p=await import("fs-extra"),v=i.default.join(a,"playground");try{p.default.ensureDirSync(v),process.chdir(v)}catch{}}W(Y.createElement(q,{args:process.argv.slice(2)}),{exitOnCtrlC:!1})}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED