fluxflow-cli 4.21.5 → 4.22.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.
@@ -1,13 +1,13 @@
1
- import{a as T}from"./chunk-Y5JU726N.js";import{a as I}from"./chunk-RI37VZYB.js";import s from"fs";import g from"path";var X=i=>{if(!i)return null;let o=i.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!o)return null;let e=o[1];if((o[2]||"").trim().length===0)return null;let r="",a=e.match(/^name:\s*(.+)$/m);return a&&(r=a[1].trim().replace(/^["']|["']$/g,"")),r?{name:r}:null},Y=i=>{let o=[];if(!i||!s.existsSync(i))return o;let e=(u,r=0)=>{if(!(r>5))try{let a=s.readdirSync(u,{withFileTypes:!0});for(let n of a){let c=g.join(u,n.name),f=n.name.toLowerCase();n.isFile()?f==="skill.md"&&o.push(c):n.isDirectory()&&(r===0?(f==="skills"||f===".skills"||f==="skill"||f===".skill")&&e(c,r+1):e(c,r+1))}}catch{}};return e(i,0),o},q=i=>i.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\s*(\r?\n)?/,""),U=(i,o)=>{if(!o)return null;let e=g.join(i,o);if(s.existsSync(e))try{if(s.statSync(e).isFile())return e}catch{}if(!o.toLowerCase().endsWith(".md")){let n=g.join(i,`${o}.md`);if(s.existsSync(n))try{if(s.statSync(n).isFile())return n}catch{}}let u=o.replace(/\\/g,"/").split("/").filter(Boolean),r=i,a=!0;for(let n=0;n<u.length;n++){let c=u[n].toLowerCase(),f=n===u.length-1;try{if(!s.existsSync(r)||!s.statSync(r).isDirectory()){a=!1;break}let L=s.readdirSync(r).find(M=>{let k=M.toLowerCase();return!!(k===c||f&&!c.endsWith(".md")&&k===`${c}.md`)});if(!L){a=!1;break}let $=g.join(r,L);if(f){if(s.statSync($).isFile())return $;a=!1}else r=$}catch{a=!1;break}}if(u.length===1){let n=u[0],c=["references","reference","scripts","script","examples","example","resources","resource"];for(let f of c){let y=g.join(i,f);if(s.existsSync(y)){let L=U(y,n);if(L)return L}}}return null},Q=async(i,o={})=>{let{path:e,StartLine:u,EndLine:r,start_line:a,end_line:n,startLine:c,endLine:f}=T(i),y=parseInt(u||a||c),L=parseInt(r||n||f),$=!isNaN(y),M=!isNaN(L),k=y||1,N=L||(y?y+800:800);if(!e)return'ERROR: Missing "path" argument for ReadFile.';if(e.trim().toLowerCase().startsWith("#skill")){let d=e.trim().replace(/\\/g,"/").replace(/^#skills?\/?/i,"").split("/").filter(Boolean),C=null,p="",m="";if(d[0]?.toLowerCase()==="global"||d[0]?.toLowerCase()==="project"?(C=d[0].toLowerCase(),p=d[1],m=d.slice(2).join("/")):(p=d[0],m=d.slice(1).join("/")),!p)return`ERROR: Missing skill name in path [${e}].`;let R=t=>{let l=Y(t);for(let h of l)try{let x=s.readFileSync(h,"utf8"),F=X(x),D=g.basename(g.dirname(h)).toLowerCase();if(F?.name&&F.name.toLowerCase()===p.toLowerCase()||D===p.toLowerCase()||h.toLowerCase()===g.join(t,"skill.md").toLowerCase()&&p.toLowerCase()==="skill")return h}catch{}return null},w=null,b=!1;if(C){let t=C==="global"?I:process.cwd();w=R(t)}else{let t=R(process.cwd()),l=R(I);t&&l&&(b=!0),w=t||l}if(!w)return`No '${p}' exist in given scope.`;let E=g.dirname(w),j=w,v=!0;if(m){let t=U(E,m);if(!t)return`No such file or reference '${m}' exist for skill '${p}'. It could be standard file path?`;j=t,v=!1}try{let t=s.readFileSync(j,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1)),t=t.replace(/\r\n/g,`
1
+ import{a as T}from"./chunk-Y5JU726N.js";import{a as I}from"./chunk-RI37VZYB.js";import s from"fs";import g from"path";var X=i=>{if(!i)return null;let o=i.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!o)return null;let e=o[1];if((o[2]||"").trim().length===0)return null;let r="",a=e.match(/^name:\s*(.+)$/m);return a&&(r=a[1].trim().replace(/^["']|["']$/g,"")),r?{name:r}:null},Y=i=>{let o=[];if(!i||!s.existsSync(i))return o;let e=(u,r=0)=>{if(!(r>5))try{let a=s.readdirSync(u,{withFileTypes:!0});for(let n of a){let c=g.join(u,n.name),f=n.name.toLowerCase();n.isFile()?f==="skill.md"&&o.push(c):n.isDirectory()&&(r===0?(f==="skills"||f===".skills"||f==="skill"||f===".skill")&&e(c,r+1):e(c,r+1))}}catch{}};return e(i,0),o},q=i=>i.replace(/^\s*---\r?\n[\s\S]*?\r?\n---\s*(\r?\n)?/,""),U=(i,o)=>{if(!o)return null;let e=g.join(i,o);if(s.existsSync(e))try{if(s.statSync(e).isFile())return e}catch{}if(!o.toLowerCase().endsWith(".md")){let n=g.join(i,`${o}.md`);if(s.existsSync(n))try{if(s.statSync(n).isFile())return n}catch{}}let u=o.replace(/\\/g,"/").split("/").filter(Boolean),r=i,a=!0;for(let n=0;n<u.length;n++){let c=u[n].toLowerCase(),f=n===u.length-1;try{if(!s.existsSync(r)||!s.statSync(r).isDirectory()){a=!1;break}let F=s.readdirSync(r).find(M=>{let R=M.toLowerCase();return!!(R===c||f&&!c.endsWith(".md")&&R===`${c}.md`)});if(!F){a=!1;break}let $=g.join(r,F);if(f){if(s.statSync($).isFile())return $;a=!1}else r=$}catch{a=!1;break}}if(u.length===1){let n=u[0],c=["references","reference","scripts","script","examples","example","resources","resource"];for(let f of c){let y=g.join(i,f);if(s.existsSync(y)){let F=U(y,n);if(F)return F}}}return null},Q=async(i,o={})=>{let{path:e,StartLine:u,EndLine:r,start_line:a,end_line:n,startLine:c,endLine:f}=T(i),y=parseInt(u||a||c),F=parseInt(r||n||f),$=!isNaN(y),M=!isNaN(F),R=y||1,N=F||(y?y+800:800);if(!e)return'ERROR: Missing "path" argument for ReadFile.';if(e.trim().toLowerCase().startsWith("#skill")){let d=e.trim().replace(/\\/g,"/").replace(/^#skills?\/?/i,"").split("/").filter(Boolean),C=null,p="",m="";if(d[0]?.toLowerCase()==="global"||d[0]?.toLowerCase()==="project"?(C=d[0].toLowerCase(),p=d[1],m=d.slice(2).join("/")):(p=d[0],m=d.slice(1).join("/")),!p)return`ERROR: Missing skill name in path [${e}].`;let k=t=>{let l=Y(t);for(let h of l)try{let x=s.readFileSync(h,"utf8"),L=X(x),D=g.basename(g.dirname(h)).toLowerCase();if(L?.name&&L.name.toLowerCase()===p.toLowerCase()||D===p.toLowerCase()||h.toLowerCase()===g.join(t,"skill.md").toLowerCase()&&p.toLowerCase()==="skill")return h}catch{}return null},w=null,b=!1;if(C){let t=C==="global"?I:process.cwd();w=k(t)}else{let t=k(process.cwd()),l=k(I);t&&l&&(b=!0),w=t||l}if(!w)return`No '${p}' exist in given scope.`;let E=g.dirname(w),j=w,v=!0;if(m){let t=U(E,m);if(!t)return`No such file or reference '${m}' exist for skill '${p}'. It could be standard file path?`;j=t,v=!1}try{let t=s.readFileSync(j,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1)),t=t.replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `),v&&(t=q(t));let l=t.split(`
4
- `),h=l.length,x=$?Math.max(0,k-1):0,F=M?Math.min(h,N):h,D=l.slice(x,F),P=e.replace(/\\/g,"/").toLowerCase(),W=P.includes("#skill/global/fluxflow")||P.includes("#skills/global/fluxflow"),_=b?` (Found ${e} in both global & project scope. Loaded [project] as default fallback. Use '#skills/global/...' if needed global)`:"",B=`${W?"DOCs":"Skill"}: [${e.replace(/\\/g,"/")}]${_}`,z=D.map(A=>A.trimEnd()).join(`
4
+ `),h=l.length,x=$?Math.max(0,R-1):0,L=M?Math.min(h,N):h,D=l.slice(x,L),P=e.replace(/\\/g,"/").toLowerCase(),W=P.includes("#skill/global/fluxflow")||P.includes("#skills/global/fluxflow"),_=b?` (Found ${e} in both global & project scope. Loaded [project] as default fallback. Use '#skills/global/...' if needed global)`:"",B=`${W?"DOCs":"Skill"}: [${e.replace(/\\/g,"/")}]${_}`,z=D.map(A=>A.trimEnd()).join(`
5
5
  `);return`${B}
6
6
 
7
- ${z}`}catch(t){let l=t instanceof Error?t.message:String(t);return`ERROR: Failed to read skill file [${e}]: ${l}`}}try{let S=g.resolve(process.cwd(),e);if(!s.existsSync(S))return`ERROR: File [${e}] does not exist.`;if(s.statSync(S).isDirectory())return`ERROR: Path [${e}] is a directory. Use list_files instead.`;let d=g.extname(e).toLowerCase();if([".mp4",".mkv",".avi",".mov",".webm",".flv",".wmv",".mpeg",".mpg"].includes(d))return`ERROR: Unable to read. Type ${d.slice(1).toUpperCase()} not supported`;let p={".pdf":"application/pdf",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};if(p[d]){if(!(o.isMultiModal!==!1))return`ERROR: Multimodality is not supported for the current model. Unable to load [${e}].`;let x=s.readFileSync(S).toString("base64"),F=p[d];return{text:`[BINARY FILE]: ${e} (${F}) - Loaded as multimodal part.`,binaryPart:{inlineData:{data:x,mimeType:F}}}}let m=s.readFileSync(S,"utf8");m.startsWith("\uFEFF")&&(m=m.slice(1)),m=m.replace(/\r\n/g,`
7
+ ${z}`}catch(t){let l=t instanceof Error?t.message:String(t);return`ERROR: Failed to read skill file [${e}]: ${l}`}}try{let S=g.resolve(process.cwd(),e);if(!s.existsSync(S))return`ERROR: File [${e}] does not exist.`;if(s.statSync(S).isDirectory())return`ERROR: Path [${e}] is a directory. Use ReadFolder instead.`;let d=g.extname(e).toLowerCase();if([".mp4",".mkv",".avi",".mov",".webm",".flv",".wmv",".mpeg",".mpg"].includes(d))return`ERROR: Unable to read. Type ${d.slice(1).toUpperCase()} not supported`;let p={".pdf":"application/pdf",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};if(p[d]){if(!(o.isMultiModal!==!1))return`ERROR: Multimodality is not supported for the current model. Unable to load [${e}].`;let x=s.readFileSync(S).toString("base64"),L=p[d];return{text:`[BINARY FILE]: ${e} (${L}) - Loaded as multimodal part.`,binaryPart:{inlineData:{data:x,mimeType:L}}}}let m=s.readFileSync(S,"utf8");m.startsWith("\uFEFF")&&(m=m.slice(1)),m=m.replace(/\r\n/g,`
8
8
  `).replace(/\r/g,`
9
- `);let R=m.split(`
10
- `),w=R.length;!$&&!M&&w>800&&(k=1,N=50);let b=Math.max(0,k-1),E=Math.min(w,N),j=R.slice(b,E),v=`File: [${e}] (Showing lines ${b+1}-${E} of ${w}).`,t=j.map((l,h)=>`${String(b+h+1).padStart(4)}: ${l.trimEnd()}`).join(`
9
+ `);let k=m.split(`
10
+ `),w=k.length;!$&&!M&&w>800&&(R=1,N=50);let b=Math.max(0,R-1),E=Math.min(w,N),j=k.slice(b,E),v=`File: [${e}] (Showing lines ${b+1}-${E} of ${w}).`,t=j.map((l,h)=>`${String(b+h+1).padStart(4)}: ${l.trimEnd()}`).join(`
11
11
  `);return`${v}
12
12
 
13
13
  ${t}`}catch(S){let O=S instanceof Error?S.message:String(S);return`ERROR: Failed to read file [${e}]: ${O}`}};export{Q as a};
@@ -1,19 +1,19 @@
1
- import{a as R,b as T}from"./chunk-A4CCI7SQ.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][\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 s=a[e];if(s===`
1
+ import{a as b,b as T}from"./chunk-IU4E277E.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 D=!!P,S=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 s=a[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 a=h[1],e=h[2],s=a?a.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(a=>a.join(""));for(;O.length>0&&O[O.length-1]==="";)O.pop();return O.join(`
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.endsWith("2>")&&f[e+1]==="1"?(n.push("2>&1"),o="",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&&R()){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 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(s==="rm"&&p&&R()){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 u=["Remove-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),t.length>0){let l=t.map(m=>{let $=m.replace(/^['"]|['"]$/g,""),b=m;return h($)&&(b=m.replace(/\//g,"\\")),b});u.push("-Path",l.join(","))}d.push(...u),e=i-1;continue}if(s==="cp"&&p&&R()){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 u=["Copy-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),t.length>0){let l=t.map(m=>{let $=m.replace(/^['"]|['"]$/g,""),b=m;return h($)&&(b=m.replace(/\//g,"\\")),b});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(s==="touch"&&p&&R()){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(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(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,a=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 u=r.replace(/^['"]|['"]$/g,"");return u.includes(" ")&&!c&&(r=`"${u}"`),r});if(p){let e="",s=0;for(let t=0;t<a.length;t++){let r=a[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 a.join(" ")},W=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=a=>{let e=a==="pwsh"||a==="powershell",s=v(n,e),t;w?a==="pwsh"?t="pwsh.exe":a==="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 u=`(version 1)
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{}},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.endsWith("2>")&&f[e+1]==="1"?(n.push("2>&1"),o="",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 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(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 u=["Remove-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),t.length>0){let l=t.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(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 u=["Copy-Item"];if(r&&u.push("-Recurse"),c&&u.push("-Force"),t.length>0){let l=t.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(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(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(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,a=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 u=r.replace(/^['"]|['"]$/g,"");return u.includes(" ")&&!c&&(r=`"${u}"`),r});if(p){let e="",s=0;for(let t=0;t<a.length;t++){let r=a[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 a.join(" ")},W=async(f,p={})=>{let{command:n}=A(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",s=v(n,e),t;w?a==="pwsh"?t="pwsh.exe":a==="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 u=`(version 1)
4
4
  (allow default)
5
5
  (deny network-outbound)
6
6
  (allow network-outbound (remote ip "localhost:*"))
7
7
  (allow network-outbound (remote ip "127.0.0.1:*"))
8
8
  `;t="sandbox-exec",r=["-p",u,c,...i]}}if(P)try{let c=P.spawn(t,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=S(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(`SUCCESS: Dev server started successfully in background.
9
9
 
10
- ${m}`),500))}}),c.onExit(({exitCode:l})=>{if(u)return;x=null;let m=E(i||""),$=S(m).replace(/\n{3,}/g,`
10
+ ${m}`),500))}}),c.onExit(({exitCode:l})=>{if(u)return;x=null;let m=E(i||""),R=S(m).replace(/\n{3,}/g,`
11
11
 
12
12
  `)||"Command executed with no output.";d(l!==0?`ERROR: Command [${n}] failed with exit code [${l}].
13
13
 
14
- ${$}`:`SUCCESS: Command [${n}] completed.
14
+ ${R}`:`SUCCESS: Command [${n}] completed.
15
15
 
16
- ${$}`)}),!0}catch(c){return w&&(a==="pwsh"||a==="powershell")&&c.code==="ENOENT"?!1:(y(d,s,n,h,o,a,g),!0)}else return y(d,s,n,h,o,a,g),!0};if(w){let a=T();O(a)||(a==="pwsh"&&!O("powershell")||a==="powershell")&&O("cmd")}else O("bash")})},y=(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)
16
+ ${R}`)}),!0}catch(c){return w&&(a==="pwsh"||a==="powershell")&&c.code==="ENOENT"?!1:(y(d,s,n,h,o,a,g),!0)}else return y(d,s,n,h,o,a,g),!0};if(w){let a=T();O(a)||(a==="pwsh"&&!O("powershell")||a==="powershell")&&O("cmd")}else O("bash")})},y=(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
17
  (allow default)
18
18
  (deny network-outbound)
19
19
  (allow network-outbound (remote ip "localhost:*"))
@@ -22,12 +22,12 @@ ${$}`)}),!0}catch(c){return w&&(a==="pwsh"||a==="powershell")&&c.code==="ENOENT"
22
22
 
23
23
  ${l}`),500))}}),s.stderr.on("data",i=>{if(!c){let u=i.toString();r+=u,w&&w(u)}}),s.on("close",i=>{if(c)return;x=null;let u=[],l=E(t),m=E(r);l&&u.push(`STDOUT:
24
24
  ${l}`),m&&u.push(`STDERR:
25
- ${m}`),i!==0&&u.push(`EXIT CODE: ${i}`);let $=u.join(`
25
+ ${m}`),i!==0&&u.push(`EXIT CODE: ${i}`);let R=u.join(`
26
26
 
27
- `)||"Command executed with no output.",b=S($).replace(/\n{3,}/g,`
27
+ `)||"Command executed with no output.",$=S(R).replace(/\n{3,}/g,`
28
28
 
29
29
  `);f(i!==0?`ERROR: Command [${n}] failed with exit code [${i}].
30
30
 
31
- ${b}`:`SUCCESS: Command [${n}] completed.
31
+ ${$}`:`SUCCESS: Command [${n}] completed.
32
32
 
33
- ${b}`)}),s.on("error",i=>{if(d&&i.code==="ENOENT"){if(g==="pwsh"){let l=v(n,!0);return y(f,l,n,o,w,"powershell",h)}else if(g==="powershell"){let l=v(n,!1);return y(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{_ as a,S as b,E as c,x as d,k as e,D as f,F as g,v as h,W as i};
33
+ ${$}`)}),s.on("error",i=>{if(d&&i.code==="ENOENT"){if(g==="pwsh"){let l=v(n,!0);return y(f,l,n,o,w,"powershell",h)}else if(g==="powershell"){let l=v(n,!1);return y(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{D as a,S as b,E as c,x as d,k as e,_ as f,F as g,v as h,W as i};
@@ -1,23 +1,23 @@
1
- import{execSync as o}from"child_process";var t=null,k=()=>{if(process.platform!=="win32")return!1;if(t!==null)return t;try{o("where.exe pwsh.exe",{stdio:"ignore",windowsHide:!0}),t=!0}catch{t=!1}return t},r=null,a=()=>{if(process.platform!=="win32")return!1;if(r!==null)return r;try{o("where.exe powershell.exe",{stdio:"ignore",windowsHide:!0}),r=!0}catch{r=!1}return r},w=()=>k()?"pwsh":a()?"powershell":"cmd",n=null,x=(e,l,c,u,d=!1,g=!0,p,f=!1)=>{n===null&&(n=d);let h=`- Mandatorily JSON escape literal sequences (backslash: \\\\, newLine: \\ n)
2
- - Same file, multiple edits? One PatchFile (\u226415 blocks)${p?"":`
1
+ import{execSync as a}from"child_process";var t=null,k=()=>{if(process.platform!=="win32")return!1;if(t!==null)return t;try{a("where.exe pwsh.exe",{stdio:"ignore",windowsHide:!0}),t=!0}catch{t=!1}return t},r=null,l=()=>{if(process.platform!=="win32")return!1;if(r!==null)return r;try{a("where.exe powershell.exe",{stdio:"ignore",windowsHide:!0}),r=!0}catch{r=!1}return r},w=()=>k()?"pwsh":l()?"powershell":"cmd",n=null,y=(e,c,u,d,g=!1,p=!0,f,i=!1)=>{n===null&&(n=g);let m=`- Mandatorily JSON escape literal sequences (backslash: \\\\, newLine: \\ n)
2
+ - Same file, multiple edits? One PatchFile (\u226415 blocks)${f?"":`
3
3
  - Tool denied? Ask for guidance`}
4
4
  - Need text or huge file? CodeSearch > Full Read
5
5
  - Avoid unnecessary large file chunk reads
6
6
  - Dont hallucinate tool results, verify, fix errors
7
7
  - Stuck on syntax error? Tell user > waste time
8
- `,i=`**Workspace Tools (path = relative; first argument; separator: '/')**
9
- - ReadFile(path=string, startLine?=int, endLine?=int)${u==="Google"||c?". Supports images":""}
8
+ `,s=`**Workspace Tools (path = relative; first argument; separator: '/')**
9
+ - ReadFile(path=string, startLine?=int, endLine?=int)${d==="Google"||u?". Supports images":""}
10
10
  - ReadFolder(path=string, recurse?=int[1..3])
11
11
  - PatchFile(path=string, allowMultiple?=bool, searchContent1="string match OR ^LINE:start..end$", newContent1=string, ...MAX15). Small searchString. Line Anchor: ^LINE:...$ syntax, must for large blocks & escape sequences
12
12
  - WriteFile(path=string, content=string). Creates/Overwrites. File Exist? PatchFile > WriteFile
13
- - CodeSearch(keyword=string, path?="dir/file/glob/regex, inclusion/exclusion ;-separated", regex?=bool:auto). Find relevant code, standard junk excluded
14
- - Run(command=string). Runs ${l==="Windows"?a()?"powershell":"windows CMD":"bash"} command. Destructive command \u2192 Ask user${f?"":`
13
+ - CodeSearch(keyword=string, path?="dir/file/glob, inclusion/exclusion ;-separated", regex?=bool:auto). Find relevant code
14
+ - Run(command=string). Runs ${c==="Windows"?l()?"powershell":"windows CMD":"bash"} command. Destructive command \u2192 Ask user${i?"":`
15
15
  - Goal(method="create/append/get", tasks=string[], markDone=string[]). If long multi-task: create Goals before starting. get + markDone marks complete`}
16
16
  ${n?`
17
17
  **Emergency Tools**
18
18
  Info: initial = current task prompt. Revert id = turn before disaster (eg. disaster: turn_3 \u2192 revert: turn_2). Reason explicitly
19
19
  - EmergencyRollback(method="getCheckpoint/forceRevert", id=string). Rollback workspace in this agent loop. ONLY for catastrophic corruption. Before ending, verify no catastrophe. getCheckpoint: id excluded
20
- `:""}${g?`
20
+ `:""}${p?`
21
21
  **Sub Agent Tools**
22
22
  Default to always using subagents whenever helpful, no user nudge needed
23
23
  Invocations:
@@ -27,9 +27,9 @@ Invocations:
27
27
  - Await(id=string, timeout=int[..=180]). Event-driven wait
28
28
  - GetProgress(id=string). Poll sparingly; NO initial poll. Work or await. Never end while subagent runs
29
29
  - Steer(id=string, message=string). Inject additional instruction or redirection into active async subagent
30
- - Cancel(id=string). Cancel async task ONLY if stalled (2m+) or incorrect`:""}`,m=`**Creative Tools (path = relative; first argument, path separator: '/')**
30
+ - Cancel(id=string). Cancel async task ONLY if stalled (2m+) or incorrect`:""}`,h=`**Creative Tools (path = relative; first argument, path separator: '/')**
31
31
  - WritePDF(path=string, content=string, orientation="landscape/portrait"). Proactive A4 page breaks must in css. HTML/CSS for premium layout, stable margins & headers/footers, no watermarks
32
- - WriteDoc(path=string, content=string). A4 Word document, no watermarks, stable margins & headers/footers`,s=`**Computer Use Tools (GUI Desktop Automation)**
32
+ - WriteDoc(path=string, content=string). A4 Word document, no watermarks, stable margins & headers/footers`,o=`**Computer Use Tools (GUI Desktop Automation)**
33
33
  - Click(gridId=int, type="single/double", button="left/middle/right", intendedClickText=string). Click target grid number, intendedClickText: literal text/symbol on screen (OCR scannable, upto 3 words). Double click desktop icons
34
34
  - Drag(fromGridId=int, toGridId=int). Drag mouse from start grid number to target grid number
35
35
  - Scroll(direction="up/down", gridId=int). Scroll viewport vertically
@@ -37,11 +37,10 @@ Invocations:
37
37
  - KeyPress(key="key or ;-separated combination, eg: enter, back, backspace, clearInput, ctrl;c, alt;tab, f5, f11, alt;f4"). Press key, shortcut, function key (f1-f12), or clear active input field
38
38
  - RecaptureScreen(). Request fresh gridded screenshot`;return`
39
39
  -- TOOLS --
40
- You cant execute tools. Instead output in chat the exact string [tool:ToolName(arg1="value1")] \u2190 mandatory, in NEW line
41
-
40
+ You cant execute tools. In chat output the format [tool:ToolName(arg1="value1")] \u2190 mandatory, NEW line
42
41
  Tool Rules:
43
- - Max 5 tools/turn${e==="Flux"||e.toLowerCase()==="fluxcu"?" (Goal: 5+)":""}
44
- ${e==="Flux"||e.toLowerCase()==="fluxcu"?`${h}`:""}
42
+ - Max 5 tools/turn${e==="Flux"||e.toLowerCase()==="fluxcu"&&!i?" (Goal: 5+)":""}
43
+ ${e==="Flux"||e.toLowerCase()==="fluxcu"?`${m}`:""}
45
44
  **User Communication**
46
45
  - AskUser(question=string, optionA?="title::description", ...MAX4). Ambiguity, path divergence, security risk
47
46
 
@@ -49,5 +48,5 @@ ${e==="Flux"||e.toLowerCase()==="fluxcu"?`${h}`:""}
49
48
  - WebSearch(query=string, aiMode?=bool, limit?=int[3..10]). Proactive use for unknown/latest info. aiMode: slower, exclude limit
50
49
  - WebScrape(url=string). Proactive use for specific webpage/docs
51
50
 
52
- ${e==="ICU"?`${s}`:e==="FluxCU"?`${i}
53
- ${s}`:e==="Flux"?`${i}`:`${m}`}`.trim()};export{a,w as b,x as c};
51
+ ${e==="ICU"?`${o}`:e==="FluxCU"?`${s}
52
+ ${o}`:e==="Flux"?`${s}`:`${h}`}`.trim()};export{l as a,w as b,y as c};