fluxflow-cli 4.4.5 → 4.5.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/README.md +1 -0
- package/dist/chunks/ai-AVOSDKYR.js +1 -0
- package/dist/chunks/{app-EDFWPGE6.js → app-WQSGYJ4N.js} +128 -120
- package/dist/chunks/chunk-6KXFTLJG.js +822 -0
- package/dist/chunks/chunk-INAFOYCM.js +1892 -0
- package/dist/chunks/chunk-XGA3P7TV.js +1 -0
- package/dist/chunks/usageServer-C2QUDNFE.js +1 -0
- package/dist/cli.js +17 -11
- package/dist/package.json +1 -1
- package/package.json +1 -1
- package/surprise.js +1 -1
- package/dist/chunks/ai-MUATXJWY.js +0 -1
- package/dist/chunks/chunk-7LA2RQEK.js +0 -822
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as K}from"./chunk-N5EE3XWJ.js";import{a as et,b as _}from"./chunk-SIINYZWE.js";import{h as G,i as L}from"./chunk-I27MASHH.js";import p from"fs-extra";import st from"path";var ut=()=>Math.random().toString(36).substring(2)+Date.now().toString(36),r=null,A=null,ot=0,F=!1,S={agent:0,background:0,search:0,toolSuccess:0,toolFailure:0,toolDenied:0,duration:0,tokens:0,cachedTokens:0,candidateTokens:0,linesAdded:0,linesRemoved:0,imageCalls:[]},O=(e,i)=>{if(!e)return{};let n=Object.keys(e),c=new Date(new Date(i).getTime()-720*60*60*1e3),t={};for(let s of n)new Date(s)>=c&&(t[s]=e[s]);return t},j=async()=>{let e=new Date().toISOString().split("T")[0];try{!await p.exists(L)&&await p.exists(G)&&(await p.ensureDir(st.dirname(L)),await p.move(G,L))}catch{}let i=L+".tmp",n=null;try{if(await p.exists(i)){let t=(await p.readFile(i,"utf8")).trim(),s=null;if(t.startsWith("{")||t.startsWith("[")?s=JSON.parse(t):s=JSON.parse(_(t)),s&&s.date&&s.stats){n=s;try{await p.rename(i,L)}catch{}}else try{await p.remove(i)}catch{}}}catch{try{await p.remove(i)}catch{}}if(!n)try{if(await p.exists(L)){let t=(await p.readFile(L,"utf8")).trim();t.startsWith("{")||t.startsWith("[")?n=JSON.parse(t):n=JSON.parse(_(t))}}catch{}let c=n;if(c){let t=c.stats||{...S},s={...S,...t};Array.isArray(s.imageCalls)||(s.imageCalls=[]);let a=c.history||{},o=O(a,e);if(Object.keys(a).length!==Object.keys(o).length&&(F=!0),c.date===e)return{...c,stats:s,history:o};{let l=c.date,f=s,d={...o};return l&&(d[l]=f),{date:e,stats:{...S},history:O(d,e)}}}return{date:e,stats:{...S},history:{}}},$=async()=>{if(!(!F||!r))try{await p.ensureDir(st.dirname(L));let e=null;try{if(await p.exists(L)){let t=(await p.readFile(L,"utf8")).trim();t.startsWith("{")||t.startsWith("[")?e=JSON.parse(t):e=JSON.parse(_(t))}}catch{}if(e&&e.date===r.date&&e.stats){for(let t in r.stats)if(e.stats[t]!==void 0){if(Array.isArray(r.stats[t])){let s=Array.isArray(e.stats[t])?e.stats[t]:[],a=r.stats[t],o=new Map;for(let l of[...s,...a])l&&l.timestamp&&o.set(l.timestamp,l);r.stats[t]=Array.from(o.values())}else if(typeof r.stats[t]=="number")r.stats[t]=Math.max(r.stats[t],Number(e.stats[t])||0);else if(r.stats[t]&&typeof r.stats[t]=="object"){let s=e.stats[t]||{},a=r.stats[t];for(let o in s)if(typeof s[o]=="number")a[o]=Math.max(a[o]||0,s[o]);else if(s[o]&&typeof s[o]=="object"){a[o]||(a[o]={});for(let l in s[o])if(typeof s[o][l]=="number")a[o][l]=Math.max(a[o][l]||0,s[o][l]);else if(s[o][l]&&typeof s[o][l]=="object"){a[o][l]||(a[o][l]={});for(let f in s[o][l])a[o][l][f]=Math.max(a[o][l][f]||0,s[o][l][f])}}}}}if(e&&e.history){let t={...r.history||{}};for(let s in e.history)if(t[s])for(let a in t[s])if(a==="imageCalls"){let o=Array.isArray(e.history[s].imageCalls)?e.history[s].imageCalls:[],l=Array.isArray(t[s].imageCalls)?t[s].imageCalls:[],f=new Map;for(let d of[...o,...l])d&&d.timestamp&&f.set(d.timestamp,d);t[s].imageCalls=Array.from(f.values())}else typeof t[s][a]=="number"&&(t[s][a]=Math.max(t[s][a],Number(e.history[s][a])||0));else t[s]=e.history[s];r.history=O(t,r.date||today)}else if(r&&r.history){let t=new Date().toISOString().split("T")[0];r.history=O(r.history,t)}r.saveId=ut();let i=L+".tmp",n=et(JSON.stringify(r,null,2));await p.writeFile(i,n,"utf8");let c=await p.open(i,"r+");await p.fsync(c),await p.close(c),await p.rename(i,L),F=!1,ot=Date.now()}catch{}},J=()=>{if(F=!0,A)return;let e=Date.now(),i=Math.max(0,1500-(e-ot));A=setTimeout(async()=>{await $(),A=null},i),A.unref&&A.unref()},wt=async()=>{r=await j(),F&&J()},Tt=async()=>{A&&(clearTimeout(A),A=null),await $()},v=async()=>{let e=new Date().toISOString().split("T")[0];if(!r)r=await j();else if(r.date!==e){let i=r.date,n=r.stats,c=r.history||{};n&&(c[i]=n),r={date:e,stats:{...S},history:O(c,e)},F=!0,await $()}return r&&r.stats&&!Array.isArray(r.stats.imageCalls)&&(r.stats.imageCalls=[]),r.stats},it=async()=>{let e=new Date().toISOString().split("T")[0];r||(r=await j()),r.date!==e&&await v();let i=r.history||{},n=O(i,e);r.history=n;let c=r.stats||{...S},t={...S};t.imageCalls=[],t.models={};let s=(a,o)=>{for(let l in a)if(l==="imageCalls")a.imageCalls=[...a.imageCalls||[],...o.imageCalls||[]];else if(l==="models"){let f=o.models||{};for(let d in f){a.models[d]||(a.models[d]={});for(let m in f[d]){a.models[d][m]||(a.models[d][m]={tokens:0,cachedTokens:0,candidateTokens:0});let u=a.models[d][m],h=f[d][m];u.tokens+=h.tokens||0,u.cachedTokens+=h.cachedTokens||0,u.candidateTokens+=h.candidateTokens||0}}}else typeof a[l]=="number"&&(a[l]+=o[l]||0)};s(t,c);for(let a in n)s(t,n[a]);return t},Lt=async(e,i)=>{e==="toolSuccess"?q.toolSuccess++:e==="toolFailure"?q.toolFailure++:e==="toolDenied"&&q.toolDenied++;let n=await v();n[e]!==void 0&&n[e]++,i&&e==="agent"&&(n.providerRequests||(n.providerRequests={}),n.providerRequests[i]=(n.providerRequests[i]||0)+1),J()},q={linesAdded:0,linesRemoved:0,toolSuccess:0,toolFailure:0,toolDenied:0},Dt=async(e,i,n,c)=>{e==="linesAdded"?q.linesAdded+=i:e==="linesRemoved"&&(q.linesRemoved+=i);let t=await v();if(t[e]!==void 0&&(t[e]+=Math.floor(i)),n&&c&&(e==="tokens"||e==="cachedTokens"||e==="candidateTokens")){t.models||(t.models={}),t.models[n]||(t.models[n]={}),t.models[n][c]||(t.models[n][c]={tokens:0,cachedTokens:0,candidateTokens:0});let s=t.models[n][c];e==="tokens"&&(s.tokens+=Math.floor(i)),e==="cachedTokens"&&(s.cachedTokens+=Math.floor(i)),e==="candidateTokens"&&(s.candidateTokens+=Math.floor(i))}J()},at=async(e=1)=>{let i=new Date,n=i.toISOString().split("T")[0];r||(r=await j()),r.date!==n&&await v();let c=i.getFullYear(),t=i.getMonth();i.getDate()<e&&(t-=1,t<0&&(t=11,c-=1));let o=new Date(c,t,e).toISOString().split("T")[0],l=r.history||{},f=r.stats||{...S},d={...S};d.imageCalls=[],d.models={};let m=(u,h)=>{for(let k in u)if(k==="imageCalls")u.imageCalls=[...u.imageCalls||[],...h.imageCalls||[]];else if(k==="models"){let D=h.models||{};for(let y in D){u.models[y]||(u.models[y]={});for(let w in D[y]){u.models[y][w]||(u.models[y][w]={tokens:0,cachedTokens:0,candidateTokens:0});let C=u.models[y][w],M=D[y][w];C.tokens+=M.tokens||0,C.cachedTokens+=M.cachedTokens||0,C.candidateTokens+=M.candidateTokens||0}}}else typeof u[k]=="number"&&(u[k]+=h[k]||0)};m(d,f);for(let u in l)u>=o&&u<n&&m(d,l[u]);return d},ft=async(e,i={})=>{let n=await K().catch(()=>({})),c=i.apiTier||n.apiTier||"Free",t=i.quotas||i.systemSettings?.quotas||n.quotas||{},s=t.providerBudgets||{},a=!!s.__useProvider,o=i.aiProvider||n.aiProvider||"Google",l=a&&!!s[o],f=()=>{if(l){let d=s[o];return{agentLimit:typeof d.agentLimit=="number"&&d.agentLimit>0?d.agentLimit:99999999,tokenLimit:typeof d.tokenLimit=="number"&&d.tokenLimit>0?d.tokenLimit:99999999999999,monthlyTokenLimit:typeof d.monthlyTokenLimit=="number"&&d.monthlyTokenLimit>0?d.monthlyTokenLimit:99999999999999}}return{agentLimit:t.agentLimit||99999999,tokenLimit:t.tokenLimit||99999999999999,monthlyTokenLimit:t.monthlyTokenLimit||99999999999999}};if(e==="agent"){let{agentLimit:d,tokenLimit:m,monthlyTokenLimit:u}=f(),h=await v(),k;t.resetMode==="Custom"?k=await at(t.resetDay||1):k=await it();let D=0,y=0,w=0;if(l){D=h.providerRequests?.[o]||0;let C=h.models?.[o]||{};for(let I in C)y+=C[I]?.tokens||0;let M=k.models?.[o]||{};for(let I in M)w+=M[I]?.tokens||0}else D=h.agent||0,y=h.tokens||0,w=k.tokens||0;return c==="Free"&&h.agent+h.background>=999999?{allowed:!1,reason:"Free Tier Daily Usage Limit Exceeded"}:D>=d?{allowed:!1,reason:l?`Daily Request Limit Reached for ${o}`:"Daily Agent Request Limit Reached"}:y>=m?{allowed:!1,reason:l?`Daily Token Budget Exhausted for ${o}`:"Daily Token Budget Exhausted"}:w>=u?{allowed:!1,reason:l?`Monthly Token Budget Exhausted for ${o}`:"Monthly Token Budget Exhausted"}:{allowed:!0}}if(e==="background"){let d=await v();if(c==="Free"&&d.agent+d.background>=999999)return{allowed:!1,reason:"Free Tier Background Limit Exceeded"};let m=d.background<(t.backgroundLimit||999999);return{allowed:m,reason:m?void 0:"Background Request Limit Exceeded"}}if(e==="search"){let m=(await v()).search<(t.searchLimit||100);return{allowed:m,reason:m?void 0:"Search Quota Exceeded"}}return{allowed:!0}},Mt=async(e,i={})=>(await ft(e,i)).allowed,Y=e=>{if(!e||e.length===0)return[];let n=[...e].sort((t,s)=>t.timestamp-s.timestamp),c=[];for(let t of n){if(c.length>0){let s=c[c.length-1];if(t.timestamp>=s.start&&t.timestamp<s.end){s.calls.push(t),s.spent+=t.cost;continue}}c.push({start:t.timestamp,end:t.timestamp+36e5,calls:[t],spent:t.cost})}return c},nt=(e,i)=>{if(!e||e.length===0)return .025;let c=Y(e);if(c.length===0)return .025;let t=[];for(let m of c){let u=.025;if(t.length>0){let k=t[t.length-1],D=!1;if(t.length>=2){let y=t[t.length-2];k.ratio>=.8&&y.ratio>=.8&&(D=!0)}if(D)u=.015;else{let y=k.limit,w=k.ratio;w>=.8?u=y===.015?.015:y:w<.4?u=Math.min(.025,y+.005):w>=.4&&w<.6?u=Math.min(.025,y+.004):u=Math.min(.025,y+.002)}}let h=u>0?m.spent/u:0;t.push({limit:u,spent:m.spent,ratio:h})}let s=c[c.length-1];if(i<s.end)return t[t.length-1].limit;let a=t[t.length-1].limit,o=a,l=t[t.length-1].ratio,f=s.end,d=0;for(let m=t.length-1;m>=0&&t[m].ratio>=.8;m--)d++;for(;f<=i;){let m=.025;d>=2?m=.015:l>=.8?m=o===.015?.015:o:l<.4?m=Math.min(.025,o+.005):l>=.4&&l<.6?m=Math.min(.025,o+.004):m=Math.min(.025,o+.002),o=m,l=0,d=0,f+=36e5,a=m}return a},St=async e=>{let i=e.imageSettings||{keyType:"Default",quality:"Low-High"};if(i.keyType!=="Default")return!0;let c={Low:.001,"Low-High":.002,Medium:.008,"Medium-High":.01,High:.045,Ultra:.0488,Premium:.15}[i.quality]||.002,t=await v();t.imageCalls||(t.imageCalls=[]);let s=Date.now(),a=Y(t.imageCalls),o=0;if(a.length>0){let f=a[a.length-1];s>=f.start&&s<f.end&&(o=f.spent)}let l=nt(t.imageCalls,s);return o+c<=l},vt=async()=>{let e=await v();e.imageCalls||(e.imageCalls=[]);let i=Date.now(),n=Y(e.imageCalls),c=[],t=0,s=0;if(n.length>0){let f=n[n.length-1];i>=f.start&&i<f.end&&(c=f.calls,t=f.spent,s=Math.max(0,Math.ceil((f.end-i)/(60*1e3))))}let a=nt(e.imageCalls,i),o=Math.max(0,a-t),l=t;return{totalSpent:t,remaining:o,activeCallsCount:c.length,nextResetMin:s,reclaimCost:l,limit:a}},Ct=async e=>{let i=e.imageSettings||{keyType:"Default",quality:"Low-High"},c={Low:.001,"Low-High":.002,Medium:.008,"Medium-High":.01,High:.045,Ultra:.0488,Premium:.1}[i.quality]||.002,t=await v();t.imageCalls||(t.imageCalls=[]),t.imageCalls.push({timestamp:Date.now(),cost:c}),J()},xt=async()=>{let e=new Date().toISOString().split("T")[0];r||(r=await j()),r.date!==e&&await v();let i=r.stats||{...S},n=r.history||{},c=new Set(Object.keys(n));c.add(e);let s=Array.from(c).sort().map(T=>{let x=T===e?i:n[T]||{},g={...S,...x},B=g.tokens||0,P=g.cachedTokens||0,H=g.candidateTokens||0,N=Math.max(0,B-H),E=Math.max(0,N-P),b=g.agent||0,R=g.background||0,U=g.search||0,rt=b+R+U,Q=g.toolSuccess||0,V=g.toolFailure||0,X=g.toolDenied||0,W=Q+V+X,lt=W>0?(Q/W*100).toFixed(1):"100.0",z=g.linesAdded||0,Z=g.linesRemoved||0,tt=Array.isArray(g.imageCalls)?g.imageCalls:[],ct=tt.reduce((dt,mt)=>dt+(mt.cost||0),0);return{date:T,tokens:B,cachedTokens:P,candidateTokens:H,promptTokens:N,uncachedPromptTokens:E,agent:b,background:R,search:U,totalRequests:rt,toolSuccess:Q,toolFailure:V,toolDenied:X,totalTools:W,toolSuccessRate:parseFloat(lt),linesAdded:z,linesRemoved:Z,netLines:z-Z,duration:g.duration||0,imageCallsCount:tt.length,imageCost:ct,models:g.models||{},providerRequests:g.providerRequests||{}}}),a=await K().catch(()=>({})),o=a.quotas||{},l=a.apiTier||"Free",f=await it().catch(()=>({tokens:0,agent:0})),d=null;o.resetMode==="Custom"&&(d=await at(o.resetDay||1).catch(()=>({tokens:0})));let m=o.tokenLimit||0,u=o.monthlyTokenLimit||0,h=o.agentLimit||0,k=o.resetMode||"Daily",D=o.resetDay||1,y=o.providerBudgets||{},w=!!y.__useProvider,C=["Google","Anthropic","OpenAI","DeepSeek","Mistral","NVIDIA","OpenRouter","Ollama","CrofAI","InferX","SenseNova","AIHubMix"];Object.keys(y).forEach(T=>{T!=="__useProvider"&&!C.includes(T)&&C.push(T)});let M=[];for(let T of C){let x=y[T];if(x&&(x.agentLimit||x.tokenLimit||x.monthlyTokenLimit)){let g=0,B=i.models?.[T]||{};for(let U in B)g+=B[U]?.tokens||0;let P=0,H=(o.resetMode==="Custom"?d?.models:f?.models)?.[T]||{};for(let U in H)P+=H[U]?.tokens||0;let N=i.providerRequests?.[T]||0,E=x.tokenLimit||0,b=x.monthlyTokenLimit||0,R=x.agentLimit||0;M.push({provider:T,dailyTokens:g,dailyTokenLimit:E,isDailyUnlimited:E>=9999999999999||E===0,monthlyTokens:P,monthlyTokenLimit:b,isMonthlyUnlimited:b>=9999999999999||b===0,dailyRequests:N,dailyAgentLimit:R,isRequestsUnlimited:R>=9999999||R===0})}}let I={apiTier:l,resetMode:k,resetDay:D,quotas:o,usingProviderBudgets:w&&M.length>0||M.length>0,providerBudgetsList:M,daily:{tokensUsed:i.tokens||0,tokenLimit:m,agentRequests:i.agent||0,agentLimit:h,isUnlimitedTokens:m>=9999999999999||m===0,isUnlimitedRequests:h>=9999999||h===0},monthly:{tokensUsed:(o.resetMode==="Custom"?d?.tokens:f?.tokens)||0,tokenLimit:u,isUnlimitedTokens:u>=9999999999999||u===0},providerBudgets:y};return{currentDate:e,todayStats:i,history:n,timeline:s,budget:I,runtimeSession:{...q}}};export{wt as a,Tt as b,v as c,it as d,Lt as e,q as f,Dt as g,at as h,ft as i,Mt as j,St as k,vt as l,Ct as m,xt as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-INAFOYCM.js";import"./chunk-XGA3P7TV.js";import"./chunk-N5EE3XWJ.js";import"./chunk-SIINYZWE.js";import"./chunk-I27MASHH.js";export{b as openUsageDashboard,a as startUsageServer};
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{spawn as ne}from"child_process";import{fileURLToPath as _}from"url";import ie from"os";import
|
|
2
|
+
import{spawn as ne}from"child_process";import{fileURLToPath as _}from"url";import ie from"os";import A from"dotenv";A.config({quiet:!0});A.config({path:"./fluxflow.env",override:!0,quiet:!0});A.config({path:"./.fluxflow.env",override:!0,quiet:!0});var le=ie.totalmem(),L=le/(1024*1024),ce=.5,ue=Math.floor(L*ce),D=process.argv.slice(2),B=D.indexOf("--allocation"),s=B!==-1?parseInt(D[B+1],10):NaN,pe=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,me=!isNaN(s)||pe||!1;!isNaN(s)&&s<64&&(console.error(`
|
|
3
3
|
[ERROR] Allocation value '${s} MB' is too low. Minimum: 64 MB, Recommended: 4096 MB.
|
|
4
|
-
`),process.exit(1));var y=Math.floor(L*.75),de=!isNaN(s)&&s>0?Math.min(s,y):Math.max(1536,Math.min(32768,
|
|
5
|
-
[MEMORY] Starting with: '${s>y?y:s} MB' Allocation${s>y?" (Max allowed: '"+y+" MB')":""}. Please Wait...`),await new Promise(
|
|
6
|
-
|
|
4
|
+
`),process.exit(1));var y=Math.floor(L*.75),de=!isNaN(s)&&s>0?Math.min(s,y):Math.max(1536,Math.min(32768,ue)),ge=_(import.meta.url).endsWith(".js");if(ge&&!process.execArgv.some(o=>o.includes("max-old-space-size"))&&me)Number.isNaN(s)||(console.log(`
|
|
5
|
+
[MEMORY] Starting with: '${s>y?y:s} MB' Allocation${s>y?" (Max allowed: '"+y+" MB')":""}. Please Wait...`),await new Promise(u=>setTimeout(u,5e3))),ne(process.execPath,[`--max-old-space-size=${de}`,"--expose-gc","--max-semi-space-size=1",_(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",u=>process.exit(u||0));else{let o=process.argv.slice(2),u=o.includes("--help")&&o[o.indexOf("--help")+1]==="commands",F=o.includes("--help")&&!u,T=o.includes("--version")||o.includes("-v"),P=o[0]==="--update",R=o[0]==="--export";if(o[0]==="--usage"||o.includes("--usage")||o[0]==="--budget"||o.includes("--budget")){let{openUsageDashboard:e}=await import("./chunks/usageServer-C2QUDNFE.js"),{url:a}=await e();console.log(`
|
|
6
|
+
\u2726 FluxFlow Token Usage & Analytics Dashboard
|
|
7
|
+
\u2800\u2800\u2514\u2500 Serving at: ${a}
|
|
8
|
+
\u2800\u2800\u2514\u2500 Opened in default browser. Press Ctrl+C to stop.
|
|
9
|
+
`),await new Promise(()=>{})}if(T||F||u||P||R){let e=await import("fs"),a=await import("path"),{fileURLToPath:n}=await import("url"),p=a.join(a.dirname(n(import.meta.url)),"../package.json"),m=JSON.parse(e.readFileSync(p,"utf8")).version;if(R){let w=(o[1]||"").toLowerCase();if(w==="error"||w==="logs")try{let{exportErrorLogs:i}=await import("./chunks/export-NRMLNZUN.js"),l=await i();console.log(`[EXPORT LOGS] Exported ${l.entryCount} error log entries (FluxFlow: ${l.fluxflowCount}, Memory: ${l.memoryCount}) to "${l.exportFile}"`),process.exit(0)}catch(i){console.error(`[EXPORT ERROR] Failed to export error logs: ${i.message}`),process.exit(1)}else console.error(`[EXPORT ERROR] Invalid export target "${o[1]||""}". --export only supports 'error'.
|
|
10
|
+
Usage: fluxflow --export error`),process.exit(1)}if(T&&(console.log(`v${m}`),process.exit(0)),F&&(console.log(`FluxFlow CLI Arguments:
|
|
7
11
|
--mode <flux|flow> Set startup mode (flux: Agent / flow: Chat)
|
|
8
12
|
--model <model_name> Set startup AI model
|
|
9
13
|
--key <key@provider> Set API key and provider
|
|
@@ -21,12 +25,13 @@ Usage: fluxflow --export error`),process.exit(1)}if(T&&(console.log(`v${u}`),pro
|
|
|
21
25
|
--help Show this help menu
|
|
22
26
|
--help commands Show available /commands
|
|
23
27
|
--playground Launch in Playground mode (fixed session, CWD: DATA_DIR/playground)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
--cwd <path> Set working directory to path
|
|
29
|
+
--path <path> Same as --cwd, set working directory
|
|
30
|
+
--usage Open token usage analytics dashboard in browser
|
|
31
|
+
--export error Export system error logs to fluxflow-error-<timestamp>.txt
|
|
32
|
+
--update check Check for new updates
|
|
33
|
+
--update check latest Show the latest version available on npm
|
|
34
|
+
--update [latest] Update the app to the latest version (latest is default)`),process.exit(0)),u&&(console.log(`FluxFlow Chat /Commands:
|
|
30
35
|
/quit Exit and shutdown Flux
|
|
31
36
|
/help Show help menu
|
|
32
37
|
/clear Clear terminal screen
|
|
@@ -51,10 +56,11 @@ Usage: fluxflow --export error`),process.exit(1)}if(T&&(console.log(`v${u}`),pro
|
|
|
51
56
|
/profile Edit developer persona
|
|
52
57
|
/memory Manage agent memory
|
|
53
58
|
/stats Show session usage
|
|
59
|
+
/usage Open graphical token analytics dashboard in browser
|
|
54
60
|
/reset Wipe all project data
|
|
55
61
|
/about Project info & credits
|
|
56
62
|
/changelog View latest updates
|
|
57
63
|
/docs View documentation
|
|
58
64
|
/fluxflow init Create FluxFlow.md template
|
|
59
65
|
/update check Check for new version
|
|
60
|
-
/update latest Install latest release`),process.exit(0)),
|
|
66
|
+
/update latest Install latest release`),process.exit(0)),P){let w=o[1]||"latest";if(w==="check"){let i=o[2]==="latest";try{let f=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;f||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(i?`Latest version: v${f}`:f!==m?`A new version of FluxFlow is available: v${f} (current: v${m}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${m}).`)}catch(l){console.error("Error checking for updates:",l.message),process.exit(1)}process.exit(0)}else if(w==="latest"){console.log("Checking latest version and settings...");try{let r=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;r||(console.error("Error: Could not retrieve latest version."),process.exit(1)),r===m&&(console.log(`FluxFlow is already up to date (v${m}).`),process.exit(0));let f=async()=>{let t=(await import("react")).default,{useState:$}=t,{render:q,Box:g,Text:h}=await import("ink"),z=(await import("ink-select-input")).default,J=(await import("ink-text-input")).default;return new Promise(K=>{let Q=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],Z=({label:v,isSelected:M})=>t.createElement(g,{width:"100%"},t.createElement(h,{bold:M},"\u2514\u2500 ",M?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",v)),k,ee=()=>{let[v,M]=$("select"),[te,se]=$(""),ae=E=>{E.value==="custom"?M("custom"):O({manager:E.value})},re=E=>{O({manager:"custom",customCommand:E})};return v==="custom"?t.createElement(g,{flexDirection:"column",marginY:1},t.createElement(g,{marginBottom:1},t.createElement(h,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),t.createElement(g,{flexDirection:"row"},t.createElement(h,{color:"cyan",bold:!0}," \u276F "),t.createElement(J,{value:te,onChange:se,onSubmit:re})),t.createElement(g,{marginTop:1},t.createElement(h,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):t.createElement(g,{flexDirection:"column",marginY:1},t.createElement(g,{marginBottom:1},t.createElement(h,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),t.createElement(z,{items:Q,onSelect:ae,itemComponent:Z,indicatorComponent:()=>null}))},O=v=>{k&&k(),K(v)},{unmount:oe}=q(t.createElement(ee,null));k=oe})},c,N="",b;try{let{loadSettings:t}=await import("./chunks/settings-TAIBP5U4.js");b=await t(),c=b?.systemSettings?.updateManager||b?.updateManager}catch{}if(!c){let t=await f();c=t.manager,N=t.customCommand}let d="";c==="pnpm"?d=`pnpm add -g fluxflow-cli@${r}`:c==="bun"?d=`bun add -g fluxflow-cli@${r}`:c==="yarn"?d=`yarn global add fluxflow-cli@${r}`:c==="custom"?d=N||b?.customUpdateCommand||`npm install -g fluxflow-cli@${r}`:d=`npm install -g fluxflow-cli@${r}`,console.log(`Updating FluxFlow to v${r} using ${c}...`),console.log(`Running: ${d}`);let{execSync:X}=await import("child_process");X(d,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${r}.\x1B[0m`)}catch(i){console.error("\x1B[31m\u274C Update failed:\x1B[0m",i.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:U}=await import("react"),{render:j}=await import("ink"),{default:Y}=await import("./chunks/app-WQSGYJ4N.js");process.env.NODE_NO_WARNINGS="1";let G=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],H=console.log,W=console.warn,V=console.error,S=e=>{let a=e.map(String).join(" ");return G.some(n=>a.includes(n))};console.log=(...e)=>!S(e)&&H(...e),console.warn=(...e)=>!S(e)&&W(...e),console.error=(...e)=>!S(e)&&V(...e);let C=o.findIndex(e=>e==="--cwd"||e==="--path");if(C!==-1&&C+1<o.length){let e=o[C+1],a=await import("path"),n=await import("fs-extra"),p=a.default.resolve(e);try{n.default.existsSync(p)&&n.default.statSync(p).isDirectory()?process.chdir(p):(console.error(`[ERROR] Directory not found: "${e}"`),process.exit(0))}catch(x){console.error(`[ERROR] Failed to change directory to "${e}": ${x.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 I=()=>{process.stdout.isTTY&&process.stdout.write("\x1B[?2004l")};if(process.on("exit",I),["SIGINT","SIGTERM","SIGHUP"].forEach(e=>{process.once(e,()=>{I(),process.exit(0)})}),o.includes("--playground")){let e=process.cwd();process.argv.push("--original-cwd",e);let{DATA_DIR:a}=await import("./chunks/paths-R3DD7CRF.js"),n=await import("path"),p=await import("fs-extra"),x=n.default.join(a,"playground");try{p.default.ensureDirSync(x),process.chdir(x)}catch{}}j(U.createElement(Y,{args:process.argv.slice(2)}),{exitOnCtrlC:!1})}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
package/surprise.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
const W = process.stdout.columns || 100;
|
|
6
6
|
const H = Math.min(process.stdout.rows || 30, 40);
|
|
7
|
-
const DURATION_MS =
|
|
7
|
+
const DURATION_MS = 60000;
|
|
8
8
|
|
|
9
9
|
const COLORS = [196, 202, 208, 214, 220, 226, 118, 46, 51, 87, 123, 159, 213, 207, 201];
|
|
10
10
|
const SPARK_CHARS = ['*', '+', '·', '✦', '˙', '.'];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$ as l,R as b,S as c,T as d,U as e,V as f,W as g,X as h,Y as i,Z as j,_ as k,aa as m,ba as n,ca as o,da as p,ea as q,fa as r}from"./chunk-7LA2RQEK.js";import"./chunk-ACHIC75V.js";import{c as a}from"./chunk-N5EE3XWJ.js";import"./chunk-SIINYZWE.js";import"./chunk-I27MASHH.js";import"./chunk-56EJGQU3.js";import"./chunk-LXTXILI5.js";export{c as RE_LEADING_THINK,o as compressHistory,b as convertChannelThinkTags,p as deleteChatSummary,e as findGenuineThinkClose,q as getAIStream,i as getCleanGroupedLength,l as getGoogleClient,f as getLeadingThinkBlock,n as initAI,d as isInsideBacktick,a as isModelMultimodal,k as isTerminationSignaled,m as runJanitorTask,r as runSubagent,j as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags};
|