fluxflow-cli 4.22.1 → 4.23.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/TOOLS.md +1 -2
- package/dist/chunks/{ai-RFTQLPYD.js → ai-JW7FGVQF.js} +1 -1
- package/dist/chunks/{app-D7ZS4M6W.js → app-ZUPKVM5U.js} +2 -2
- package/dist/chunks/{chunk-NXJB3LHY.js → chunk-NUZCHZRM.js} +76 -78
- package/dist/chunks/{chunk-IU4E277E.js → chunk-S25OD4YB.js} +9 -9
- package/dist/chunks/{chunk-57DBJNK7.js → chunk-XCUZ3OIF.js} +1 -1
- package/dist/chunks/{exec_command-BP3TON5E.js → exec_command-2AU2ICOX.js} +1 -1
- package/dist/chunks/{invoke-NX4ZZRZI.js → invoke-TNCJFZDK.js} +2 -2
- package/dist/chunks/{invokeSync-KKRTA6RL.js → invokeSync-MWJR3YU7.js} +2 -2
- package/dist/cli.js +18 -14
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
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,
|
|
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,v=(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
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
|
-
- Dont hallucinate tool results
|
|
6
|
+
- Dont hallucinate tool results
|
|
7
7
|
- Stuck on syntax error? Tell user > waste time
|
|
8
8
|
`,s=`**Workspace Tools (path = relative; first argument; separator: '/')**
|
|
9
9
|
- ReadFile(path=string, startLine?=int, endLine?=int)${d==="Google"||u?". Supports images":""}
|
|
@@ -19,14 +19,14 @@ Info: initial = current task prompt. Revert id = turn before disaster (eg. disas
|
|
|
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
20
|
`:""}${p?`
|
|
21
21
|
**Sub Agent Tools**
|
|
22
|
-
Default to
|
|
22
|
+
Default to using subagents whenever helpful, no user nudge needed
|
|
23
23
|
Invocations:
|
|
24
|
-
\u2022 Invoke (async/background, \u22647 parallel). Parallelize
|
|
24
|
+
\u2022 Invoke (async/background, \u22647 parallel). Parallelize tasks. May take time
|
|
25
25
|
\u2022 InvokeSync (sync/blocking). Sequential, repetitive or delegated tasks. Saves tokens/cost
|
|
26
|
-
- InvokeSync/Invoke(title=string, task=string). Task must be detailed:
|
|
27
|
-
- Await(id=string, timeout=int[..=180]). Event
|
|
26
|
+
- InvokeSync/Invoke(title=string, task=string). Task must be detailed: file paths, imports/exports, dependencies
|
|
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
|
-
- Steer(id=string, message=string). Inject additional instruction
|
|
29
|
+
- Steer(id=string, message=string). Inject additional instruction into active async subagent
|
|
30
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
32
|
- WriteDoc(path=string, content=string). A4 Word document, no watermarks, stable margins & headers/footers`,o=`**Computer Use Tools (GUI Desktop Automation)**
|
|
@@ -37,7 +37,7 @@ 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
|
-
|
|
40
|
+
To use tools in chat output the format [tool:ToolName(arg1="value1")] \u2190 mandatory, NEW line
|
|
41
41
|
Tool Rules:
|
|
42
42
|
- Max 5 tools/turn${e==="Flux"||e.toLowerCase()==="fluxcu"&&!i?" (Goal: 5+)":""}
|
|
43
43
|
${e==="Flux"||e.toLowerCase()==="fluxcu"?`${m}`:""}
|
|
@@ -49,4 +49,4 @@ ${e==="Flux"||e.toLowerCase()==="fluxcu"?`${m}`:""}
|
|
|
49
49
|
- WebScrape(url=string). Proactive use for specific webpage/docs
|
|
50
50
|
|
|
51
51
|
${e==="ICU"?`${o}`:e==="FluxCU"?`${s}
|
|
52
|
-
${o}`:e==="Flux"?`${s}`:`${h}`}`.trim()};export{l as a,w as b,
|
|
52
|
+
${o}`:e==="Flux"?`${s}`:`${h}`}`.trim()};export{l as a,w as b,v as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as b,b as T}from"./chunk-
|
|
1
|
+
import{a as b,b as T}from"./chunk-S25OD4YB.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
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)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i}from"./chunk-XCUZ3OIF.js";import"./chunk-S25OD4YB.js";import"./chunk-Y5JU726N.js";export{d as activeChildProcess,h as adjustWindowsCommand,c as cleanTerminalOutput,i as exec_command,e as isActiveCommandPty,a as isPtyAvailable,b as stripAnsi,g as terminateActiveCommand,f 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-JW7FGVQF.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: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-JW7FGVQF.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-JW7FGVQF.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-JW7FGVQF.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};
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{a as b}from"./chunks/chunk-RI37VZYB.js";import{spawn as
|
|
2
|
+
import{a as b}from"./chunks/chunk-RI37VZYB.js";import{spawn as ge}from"child_process";import{fileURLToPath as oe}from"url";import fe from"os";import _ from"path";import P from"fs";import T from"dotenv";try{let t=_.join(b,"AGENTS.md"),x=_.join(b,"FLUXFLOW.md");P.existsSync(b)||P.mkdirSync(b,{recursive:!0}),P.existsSync(t)||P.writeFileSync(t,"","utf8"),P.existsSync(x)||P.writeFileSync(x,"","utf8")}catch{}T.config({path:"./.env",override:!0,quiet:!0});T.config({path:`${b}/.env`,override:!0,quiet:!0});T.config({path:`${b}/.env.agents`,override:!0,quiet:!0});T.config({path:`${b}/.env.fluxflow`,override:!0,quiet:!0});T.config({path:"./.env.agents",override:!0,quiet:!0});T.config({path:"./.env.fluxflow",override:!0,quiet:!0});process.env.NO_INS=!1;var xe=fe.totalmem(),se=xe/(1024*1024),we=.5,he=Math.floor(se*we),re=process.argv.slice(2),te=re.indexOf("--allocation"),f=te!==-1?parseInt(re[te+1],10):NaN,ve=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,ye=!isNaN(f)||ve||!1;!isNaN(f)&&f<64&&(console.error(`
|
|
3
3
|
[ERROR] Allocation value '${f} MB' is too low. Minimum: 64 MB, Recommended: 4096 MB.
|
|
4
|
-
`),process.exit(1));var O=Math.floor(
|
|
5
|
-
[MEMORY] Starting with: '${f>O?O:f} MB' Allocation${f>O?" (Max allowed: '"+O+" MB')":""}. Please Wait...`),await new Promise(x=>setTimeout(x,5e3))),
|
|
4
|
+
`),process.exit(1));var O=Math.floor(se*.75),Se=!isNaN(f)&&f>0?Math.min(f,O):Math.max(1536,Math.min(32768,he)),be=oe(import.meta.url).endsWith(".js");if(be&&!process.execArgv.some(t=>t.includes("max-old-space-size"))&&ye)Number.isNaN(f)||(console.log(`
|
|
5
|
+
[MEMORY] Starting with: '${f>O?O:f} MB' Allocation${f>O?" (Max allowed: '"+O+" MB')":""}. Please Wait...`),await new Promise(x=>setTimeout(x,5e3))),ge(process.execPath,[`--max-old-space-size=${Se}`,"--expose-gc","--max-semi-space-size=1",oe(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",x=>process.exit(x||0));else{let t=process.argv.slice(2),x=t.includes("--help")&&t[t.indexOf("--help")+1]==="commands",V=t.includes("--help")&&!x,J=t.includes("--version")||t.includes("-v"),K=t[0]==="--update",Q=t[0]==="--export";if(t[0]==="--usage"||t.includes("--usage")||t[0]==="--budget"||t.includes("--budget")){let{openUsageDashboard:o}=await import("./chunks/usageServer-F2KOFF6O.js"),{url:d}=await o();console.log(`
|
|
6
6
|
\u2726 FluxFlow Token Usage & Analytics Dashboard
|
|
7
7
|
\u2800\u2800\u2514\u2500 Serving at: ${d}
|
|
8
8
|
\u2800\u2800\u2514\u2500 Opened in default browser. Press Ctrl+C to stop.
|
|
9
|
-
`),await new Promise(()=>{})}if(V||
|
|
10
|
-
Usage: fluxflow --export error`),process.exit(1)}if(
|
|
9
|
+
`),await new Promise(()=>{})}if(J||V||x||K||Q){let o=await import("fs"),d=await import("path"),{fileURLToPath:r}=await import("url"),u=d.join(d.dirname(r(import.meta.url)),"../package.json"),i=JSON.parse(o.readFileSync(u,"utf8")).version;if(Q){let C=(t[1]||"").toLowerCase();if(C==="error"||C==="logs")try{let{exportErrorLogs:w}=await import("./chunks/export-YTWRQ63I.js"),c=await w();console.log(`[EXPORT LOGS] Exported ${c.entryCount} error log entries (FluxFlow: ${c.fluxflowCount}, Memory: ${c.memoryCount}, Usage: ${c.usageCount}) to "${c.exportFile}"`),process.exit(0)}catch(w){console.error(`[EXPORT ERROR] Failed to export error logs: ${w.message}`),process.exit(1)}else console.error(`[EXPORT ERROR] Invalid export target "${t[1]||""}". --export only supports 'error'.
|
|
10
|
+
Usage: fluxflow --export error`),process.exit(1)}if(J&&(console.log(`v${i}`),process.exit(0)),V&&(console.log(`FluxFlow CLI Arguments:
|
|
11
11
|
--mode <flux|flow|icu|omni> Set startup mode (Agent / Chat / Computer Use / Sentient being)
|
|
12
12
|
--model <model_name> Set startup AI model
|
|
13
13
|
--key <key@provider> Set API key and provider
|
|
@@ -66,24 +66,28 @@ Usage: fluxflow --export error`),process.exit(1)}if(V&&(console.log(`v${n}`),pro
|
|
|
66
66
|
/docs View documentation
|
|
67
67
|
/fluxflow init Create FluxFlow.md template
|
|
68
68
|
/update check Check for new version
|
|
69
|
-
/update latest Install latest release`),process.exit(0)),
|
|
69
|
+
/update latest Install latest release`),process.exit(0)),K){let C=t[1]||"latest";if(C==="check"){let w=t[2]==="latest";try{let y=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;y||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(w?`Latest version: v${y}`:y!==i?`A new version of FluxFlow is available: v${y} (current: v${i}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${i}).`)}catch(c){console.error("Error checking for updates:",c.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let p=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;p||(console.error("Error: Could not retrieve latest version."),process.exit(1)),p===i&&(console.log(`FluxFlow is already up to date (v${i}).`),process.exit(0));let y=async()=>{let s=(await import("react")).default,{useState:R}=s,{render:L,Box:l,Text:$}=await import("ink"),k=(await import("ink-select-input")).default,Y=(await import("ink-text-input")).default;return new Promise(q=>{let H=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],W=({label:M,isSelected:v})=>s.createElement(l,{width:"100%"},s.createElement($,{bold:v},"\u2514\u2500 ",v?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",M)),I,X=()=>{let[M,v]=R("select"),[N,e]=R(""),n=F=>{F.value==="custom"?v("custom"):U({manager:F.value})},g=F=>{U({manager:"custom",customCommand:F})};return M==="custom"?s.createElement(l,{flexDirection:"column",marginY:1},s.createElement(l,{marginBottom:1},s.createElement($,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),s.createElement(l,{flexDirection:"row"},s.createElement($,{color:"cyan",bold:!0}," \u276F "),s.createElement(Y,{value:N,onChange:e,onSubmit:g})),s.createElement(l,{marginTop:1},s.createElement($,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):s.createElement(l,{flexDirection:"column",marginY:1},s.createElement(l,{marginBottom:1},s.createElement($,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),s.createElement(k,{items:H,onSelect:n,itemComponent:W,indicatorComponent:()=>null}))},U=M=>{I&&I(),q(M)},{unmount:z}=L(s.createElement(X,null));I=z})},a,A="",E;try{let{loadSettings:s}=await import("./chunks/settings-6BPZ6DG5.js");E=await s(),a=E?.systemSettings?.updateManager||E?.updateManager}catch{}if(!a){let s=await y();a=s.manager,A=s.customCommand}let m="";a==="pnpm"?m=`pnpm add -g fluxflow-cli@${p}`:a==="bun"?m=`bun add -g fluxflow-cli@${p}`:a==="yarn"?m=`yarn global add fluxflow-cli@${p}`:a==="custom"?m=A||E?.customUpdateCommand||`npm install -g fluxflow-cli@${p}`:m=`npm install -g fluxflow-cli@${p}`,console.log(`Updating FluxFlow to v${p} using ${a}...`),console.log(`Running: ${m}`);let{execSync:S}=await import("child_process");S(m,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${p}.\x1B[0m`)}catch(w){console.error("\x1B[31m\u274C Update failed:\x1B[0m",w.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:ne}=await import("react"),{render:ie}=await import("ink"),{default:ae}=await import("./chunks/app-ZUPKVM5U.js");process.env.NODE_NO_WARNINGS="1";let le=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],ce=console.log,pe=console.warn,me=console.error,B=o=>{let d=o.map(String).join(" ");return le.some(r=>d.includes(r))};console.log=(...o)=>!B(o)&&ce(...o),console.warn=(...o)=>!B(o)&&pe(...o),console.error=(...o)=>!B(o)&&me(...o);let D=t.findIndex(o=>o==="--cwd"||o==="--path");if(D!==-1&&D+1<t.length){let o=t[D+1],d=await import("path"),r=await import("fs-extra"),u=d.default.resolve(o);try{r.default.existsSync(u)&&r.default.statSync(u).isDirectory()?process.chdir(u):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(h){console.error(`[ERROR] Failed to change directory to "${o}": ${h.message}`),process.exit(0)}}let j=t.includes("--commit_8f4a2b9c"),G=t.findIndex(o=>o==="-p"||o==="--prompt");if(G!==-1||j){let o=t.includes("--new")||t.includes("-n"),r=(G!==-1?t.slice(G+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(j)try{let{execSync:e}=await import("child_process"),n=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();n||process.exit(0),r=`Git Staged Diff:
|
|
70
70
|
${n}
|
|
71
71
|
---
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
${
|
|
73
|
+
Summarize this in clean commit msg`}catch{process.exit(0)}let u=t.findIndex(e=>e==="-r"||e==="--run"),h=null,i=null;if(u!==-1&&u+1<t.length){h=t[u+1];try{let{execSync:e}=await import("child_process");i=e(h,{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim()}catch(e){i=(e.stdout?e.stdout.toString().trim():"")||(e.stderr?e.stderr.toString().trim():"")||e.message}}if(i){let{stripAnsi:e}=await import("./chunks/exec_command-2AU2ICOX.js");i=e(i).trim(),r?r=`Stdin Context (${h}):
|
|
74
|
+
${i}
|
|
75
75
|
---
|
|
76
76
|
|
|
77
|
-
${r}`:r=
|
|
77
|
+
${r}`:r=i}if(!process.stdin.isTTY){let e=[];for await(let g of process.stdin)e.push(g);let n=Buffer.concat(e).toString("utf8").trim();if(n){let{stripAnsi:g}=await import("./chunks/exec_command-2AU2ICOX.js");n=g(n).trim(),r?r=`Stdin Context:
|
|
78
|
+
${n}
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
${r}`:r=n}}r||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-6BPZ6DG5.js"),{getProviderAPIKey:w}=await import("./chunks/secrets-RFEEPY3S.js"),{getDefaultModel:c}=await import("./chunks/model_config-UZLNHYP5.js"),{generateSimpleContent:p}=await import("./chunks/ai-JW7FGVQF.js"),{checkQuotaDetailed:y}=await import("./chunks/usage-5LVLEH5S.js"),a=await C(),A=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==r&&e!=="-n"&&e!=="--new"),E=j||A.includes("--raw")||t.includes("--raw"),m=e=>{for(let n of e){let g=A.indexOf(n);if(g!==-1&&g+1<A.length)return A[g+1]}return null},S=m(["--provider"])||a.aiProvider||"Google",s=m(["--model"])||a.activeModel||c(S,a.apiTier)||c(S,"paid"),R=m(["--key"])||await w(S);R||(console.error(`[ERROR] No API key resolved for provider "${S}".`),process.exit(1));let L=await y("agent",{aiProvider:S});L.allowed||(console.error(`[ERROR] ${L.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let l={aiProvider:S,apiKey:R,model:s,mode:"flow",thinkingLevel:m(["--thinking"])||"Fast",systemSettings:a.systemSettings||{}},$=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",k=new Date,Y=k.getFullYear(),q=k.toLocaleString("en-US",{month:"short"}).toUpperCase(),H=String(k.getDate()).padStart(2,"0"),W=k.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),I=`${Y}-${q}-${H}, ${W}`,X=`Identity: FluxFlow. Sassy, CLI Assistant
|
|
78
82
|
Use NO markdown, only plain text
|
|
79
83
|
Additional Context:
|
|
80
84
|
- OS: ${$}
|
|
81
|
-
- Model: ${_.basename(
|
|
85
|
+
- Model: ${_.basename(l.model).trim().replace(":free","").replace("-free","").replace("/free","").replace("_free","").replace("free_","").replaceAll("-"," ").replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase().trim())}
|
|
82
86
|
- Approx time: ${I}
|
|
83
87
|
- Non interactive CLI, support piped inputs
|
|
84
|
-
- 'fluxflow' TUI has full agentic tools & capabilities`.trim(),{getPromptSessionHistory:U,savePromptSessionHistory:
|
|
85
|
-
`)}let{text:e}=await p(
|
|
88
|
+
- 'fluxflow' TUI has full agentic tools & capabilities`.trim(),{getPromptSessionHistory:U,savePromptSessionHistory:z,clearPromptSessionHistory:M}=await import("./chunks/sessionDaemon-GHQTAGDG.js"),v=[];o?await M():v=await U();let N=[];if(Array.isArray(v)&&v.length>0)for(let e of v)e.text&&N.push({role:e.role==="model"?"model":"user",parts:[{text:e.text}]});N.push({role:"user",parts:[{text:r}]});try{if(!E){let g="\x1B[36m",F="\x1B[35m",ee="\x1B[0m",de=_.basename(l.model).trim().replace(":free","").replace("-free","").replace("free/","").replaceAll("-"," ").replace(/\b\w/g,ue=>ue.toUpperCase().trim());process.stdout.write(`Responding with ${g}${de}${ee} from ${F}${l.aiProvider}${ee}:
|
|
89
|
+
`)}let{text:e}=await p(l,s,N,X,l.thinkingLevel),n=(e||"").trim();process.stdout.write(n+`
|
|
86
90
|
${E?"":`
|
|
87
|
-
`}`),
|
|
91
|
+
`}`),n&&await z(r,n)}catch(e){console.error(`[ERROR] Prompt request failed: ${e.message.trim()}
|
|
88
92
|
|
|
89
|
-
`),process.exit(1)}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
|
|
93
|
+
`),process.exit(1)}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 Z=()=>{process.stdout.isTTY&&process.stdout.write("\x1B[?2004l")};if(process.on("exit",Z),["SIGINT","SIGTERM","SIGHUP"].forEach(o=>{process.once(o,()=>{Z(),process.exit(0)})}),t.includes("--playground")){let o=process.cwd();process.argv.push("--original-cwd",o);let{DATA_DIR:d}=await import("./chunks/paths-Y7ACZJAE.js"),r=await import("path"),u=await import("fs-extra"),h=r.default.join(d,"playground");try{u.default.ensureDirSync(h),process.chdir(h)}catch{}}ie(ne.createElement(ae,{args:process.argv.slice(2)}),{exitOnCtrlC:!1})}
|
package/dist/package.json
CHANGED