fluxflow-cli 4.25.5 → 4.26.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 +15 -4
- package/dist/chunks/9router-J5GHSSMY.js +2 -0
- package/dist/chunks/ai-CANLJJ2L.js +1 -0
- package/dist/chunks/aihubmix-ZANBMI5F.js +2 -0
- package/dist/chunks/apinex-MSG2QNBL.js +2 -0
- package/dist/chunks/{app-EIBVHMQV.js → app-2JPMBSNL.js} +133 -133
- package/dist/chunks/{chunk-2AUIP6N5.js → chunk-37QHXCGM.js} +1 -1
- package/dist/chunks/chunk-HM3CMNOJ.js +1 -0
- package/dist/chunks/chunk-JS5ZIGFR.js +1 -0
- package/dist/chunks/{chunk-4XXLWMY6.js → chunk-LKJUPSJM.js} +1 -1
- package/dist/chunks/chunk-NL4MAQSB.js +1 -0
- package/dist/chunks/{chunk-AF7LASZ3.js → chunk-PYZ4PPIR.js} +1 -1
- package/dist/chunks/{chunk-BM3FXMTK.js → chunk-QNUIT5G4.js} +1 -1
- package/dist/chunks/chunk-QWTKV7Q4.js +1 -0
- package/dist/chunks/chunk-TURMMMY5.js +878 -0
- package/dist/chunks/chunk-ZLWYMCCW.js +1 -0
- package/dist/chunks/{click-5I5YOSNC.js → click-BIP2KIKK.js} +2 -2
- package/dist/chunks/{computer_action-RTEC7VUX.js → computer_action-W532LBFE.js} +1 -1
- package/dist/chunks/deepseek-Y4NFGKGV.js +2 -0
- package/dist/chunks/{drag-6TRBT2C3.js → drag-XXDYAMBU.js} +1 -1
- package/dist/chunks/explabs-4D3EJOBE.js +2 -0
- package/dist/chunks/{generate_image-4LIDEIYO.js → generate_image-MTPDDZY7.js} +1 -1
- package/dist/chunks/inferx-R7LOBSCS.js +3 -0
- package/dist/chunks/infron-6QUT2E5V.js +2 -0
- package/dist/chunks/{invoke-R75DZFQB.js → invoke-VUBKZKFI.js} +2 -2
- package/dist/chunks/{invokeSync-JS3JUZLM.js → invokeSync-EJMZYWUM.js} +2 -2
- package/dist/chunks/{key_press-Z3OXF74E.js → key_press-EJFHIVWP.js} +1 -1
- package/dist/chunks/{keyboard_typing-F2SAZLI2.js → keyboard_typing-4M63JGZ4.js} +1 -1
- package/dist/chunks/mistral-7PATNJTO.js +2 -0
- package/dist/chunks/{model_config-M24OEKJE.js → model_config-YD5AWI33.js} +1 -1
- package/dist/chunks/nvidia-FORTI2DZ.js +2 -0
- package/dist/chunks/ollama-ZPTZJK7V.js +2 -0
- package/dist/chunks/openrouter-M3ZZMDXU.js +2 -0
- package/dist/chunks/poolside-IS5XCHAE.js +2 -0
- package/dist/chunks/{screen_grid-RAKJUJQA.js → screen_grid-BK5KF7MP.js} +1 -1
- package/dist/chunks/{scroll-7JYRU34H.js → scroll-5V7P3DXY.js} +1 -1
- package/dist/chunks/search_keyword-7WJ4M737.js +6 -0
- package/dist/chunks/{secrets-LPVNWDTB.js → secrets-4GLUJF7A.js} +1 -1
- package/dist/chunks/sensenova-AJZGPQZ5.js +2 -0
- package/dist/chunks/{settings-KKYNW25D.js → settings-RB45GKVI.js} +1 -1
- package/dist/chunks/tokenharbor-3ZMTIJ2M.js +2 -0
- package/dist/chunks/{update_file-KNEQRJAG.js → update_file-FUWOJ4JN.js} +1 -1
- package/dist/chunks/{usage-VLICZGBC.js → usage-DWONGEYS.js} +1 -1
- package/dist/chunks/usageServer-AXINXVIN.js +1 -0
- package/dist/chunks/{write_file-7X2GQFWK.js → write_file-HH7WRRDJ.js} +1 -1
- package/dist/cli.js +3 -3
- package/dist/model_config.json +7 -6
- package/dist/package.json +1 -1
- package/model_config.json +7 -6
- package/package.json +1 -1
- package/dist/chunks/ai-ZBSCEHTS.js +0 -1
- package/dist/chunks/chunk-3CZWTXIR.js +0 -1
- package/dist/chunks/chunk-GRQ7JZZP.js +0 -1
- package/dist/chunks/chunk-KA7IQD5D.js +0 -892
- package/dist/chunks/chunk-OSDQRSY6.js +0 -1
- package/dist/chunks/search_keyword-CSRQFPHQ.js +0 -6
- package/dist/chunks/usageServer-HY4ME2BW.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as u}from"./chunk-QWTKV7Q4.js";import{e as m,f as c}from"./chunk-L3W2X74K.js";import{b as s}from"./chunk-DSVLWYIT.js";import n from"fs-extra";import g from"path";var r={mode:"Flux",display:0,thinkingLevel:"Medium",aiProvider:"Google",activeModel:u("Google","Free")||"gemma-4-31b-it",showFullThinking:!0,apiTier:"Free",quotas:{agentLimit:999999,backgroundLimit:999999,searchLimit:100,customModelId:"",customLimit:0,providerTiers:{Google:"Free",DeepSeek:"Free",NVIDIA:"Free",OpenRouter:"Free",InferX:"Free",SenseNova:"Free",Poolside:"Free",ExpLabs:"Free",TokenHarbor:"Free",Infron:"Free",APInex:"Free"}},systemSettings:{memory:!1,theme:"Dark",compression:0,autoExec:!0,allowExternalAccess:!1,advanceRollback:!1,autoDeleteHistory:"7d",useExternalData:!1,externalDataPath:"",preserveThinking:!0,loadingPhrases:!0,progressiveRendering:!0,showTPMEstimate:!0,subAgents:!1,CustomSubAgent:!1,SubAgentModel:"Default",SubAgentProvider:"",dynamicDirAwareness:!1,indentationTree:!0,ollamaEndpoint:"Cloud",compressToolResults:!1,autoTruncateResults:!0,imageHistoryCU:"Standard",contextLength:"256k",keepReasoningContext:!1,autoExcludeMetadata:!1,disableTodo:!1},profileData:{name:null,nickname:null,instructions:null},imageSettings:{keyType:"Default",quality:"Low-High",apiKey:""}},f=async()=>{let t={...r};try{if(await n.exists(s)){let e=m(s);if(e.imageSettings&&e.imageSettings.apiKey)try{let a=e.imageSettings.apiKey,{saveSecret:i}=await import("./secrets-4GLUJF7A.js");await i("POLLINATIONS_API_KEY",a),e.imageSettings.apiKey="",c(s,e)}catch{}t={...r,...e,quotas:{...r.quotas,...e.quotas,providerTiers:{...r.quotas.providerTiers,...e.quotas?.providerTiers||{}}},systemSettings:{...r.systemSettings,...e.systemSettings},profileData:{...r.profileData,...e.profileData},imageSettings:{...r.imageSettings,...e.imageSettings}}}}catch(e){console.error("Failed to load settings:",e)}try{let{getSecret:e}=await import("./secrets-4GLUJF7A.js"),a=await e("POLLINATIONS_API_KEY");a&&(t.imageSettings.apiKey=a)}catch{}if(t.showFullThinking===!1){t.showFullThinking=!0;try{c(s,t)}catch{}}return t},S=async t=>{let{FLUXFLOW_DIR:e}=await import("./paths-2EXHWUSL.js"),a=["logs","secret"];for(let i of a){let l=g.join(e,i),o=g.join(t,i);try{await n.exists(l)&&(await n.ensureDir(o),await n.copy(l,o,{overwrite:!0}))}catch(d){console.error(`Migration failed for ${i}:`,d)}}},D=async t=>{try{let e=await f();if(!e.systemSettings.useExternalData&&t.systemSettings?.useExternalData&&t.systemSettings?.externalDataPath&&await S(t.systemSettings.externalDataPath),t.imageSettings&&t.imageSettings.apiKey!==void 0){let{saveSecret:i,removeSecret:l}=await import("./secrets-4GLUJF7A.js"),o=t.imageSettings.apiKey;o?await i("POLLINATIONS_API_KEY",o):await l("POLLINATIONS_API_KEY")}let a={...e,...t};return a.systemSettings&&(a.systemSettings.dynamicDirAwareness=!1),a.imageSettings&&(a.imageSettings={...a.imageSettings,apiKey:""}),await n.ensureDir(g.dirname(s)),c(s,a),!0}catch(e){return console.error("Failed to save settings:",e),!1}};export{f as a,D as b};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as z}from"./chunk-
|
|
2
|
-
`)){let i=s.split(" ");if(i.length<12||parseInt(i[0])!==5)continue;let o=i[2],f=i[3],a=i[4],h=parseInt(i[6]),g=parseInt(i[7]),w=parseInt(i[8]),M=parseInt(i[9]),c=parseFloat(i[10]),p=i.slice(11).join(" ").trim();if(!p||c<0)continue;let x={x0:h,y0:g,x1:h+w,y1:g+M},y={text:p,confidence:c,bbox:x};n.push(y);let d=`${o}_${f}_${a}`;e.has(d)||e.set(d,{words:[],bbox:{x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}});let u=e.get(d);u.words.push(y),u.bbox.x0=Math.min(u.bbox.x0,x.x0),u.bbox.y0=Math.min(u.bbox.y0,x.y0),u.bbox.x1=Math.max(u.bbox.x1,x.x1),u.bbox.y1=Math.max(u.bbox.y1,x.y1)}let r=[];for(let s of e.values())s.words.length>0&&r.push({text:s.words.map(i=>i.text).join(" "),bbox:s.bbox,words:s.words});return{words:n,lines:r}}function Z(t){if(!(t.words&&t.words.length>0)){if(t.blocks&&t.blocks.length>0){t.words=[],t.lines=[];for(let n of t.blocks)for(let e of n.paragraphs||[])for(let r of e.lines||[]){r.bbox&&t.lines.push(r);for(let s of r.words||[])s.bbox&&t.words.push(s)}if(t.words.length>0)return}if(t.tsv){let n=V(t.tsv);t.words=n.words,t.lines=n.lines}}}function A(t,n,e=0,r=0,s=1){Z(t);let i=o=>({x0:Math.round(o.x0/s)+e,y0:Math.round(o.y0/s)+r,x1:Math.round(o.x1/s)+e,y1:Math.round(o.y1/s)+r}),l=[];if(t.lines&&t.lines.length>0)for(let o of t.lines){let f=o.text?o.text.toLowerCase().trim():"";if(!f||!o.bbox||!(f===n||new RegExp(`\\b${J(n)}\\b`,"i").test(f)))continue;let h=o.words||(t.words?t.words.filter(c=>c.bbox&&c.bbox.x0>=o.bbox.x0-5&&c.bbox.x1<=o.bbox.x1+5&&c.bbox.y0>=o.bbox.y0-5&&c.bbox.y1<=o.bbox.y1+5):[]),g=n.split(/\s+/),w=g.map(c=>c.replace(/[^a-z0-9]/g,"")).join(" "),M=!1;if(h.length>0)for(let c=0;c<=h.length-g.length;c++){let p=h.slice(c,c+g.length),x=p.map(y=>(y.text||"").toLowerCase().trim().replace(/[^a-z0-9]/g,"")).join(" ");if(x===w||x.includes(w)){let y={x0:Math.min(...p.map(d=>d.bbox.x0)),y0:Math.min(...p.map(d=>d.bbox.y0)),x1:Math.max(...p.map(d=>d.bbox.x1)),y1:Math.max(...p.map(d=>d.bbox.y1))};l.push(i(y)),M=!0}}M||l.push(i(o.bbox))}if(l.length===0&&t.words&&t.words.length>0)for(let o of t.words){let f=o.text?o.text.toLowerCase().trim().replace(/[^a-z0-9]/g,""):"",a=n.replace(/[^a-z0-9]/g,"");f===a&&o.bbox&&l.push(i(o.bbox))}if(l.length===0&&t.words&&t.words.length>0){let o=Q(n.length);for(let f of t.words){let a=f.text?f.text.toLowerCase().trim():"";a.length>=3&&Math.abs(a.length-n.length)<=o&&K(a,n,o)<=o&&f.bbox&&l.push(i(f.bbox))}}return l}function E(t,n){let e=null,r=1/0;for(let s of t){let i=Math.round((s.x0+s.x1)/2),l=Math.round((s.y0+s.y1)/2),o=n.x>=s.x0&&n.x<=s.x1&&n.y>=s.y0&&n.y<=s.y1,f=Math.hypot(i-n.x,l-n.y),a=o?0:f;a<r&&(r=a,e={x:i,y:l,dist:f,containsPoint:o,bbox:s})}return e}function X(t,n,e,r){let l=Math.ceil(t/4),o=Math.ceil(n/2),f=[];for(let a=0;a<2;a++)for(let h=0;h<4;h++){let g=h*l,w=a*o,M=Math.min(l,t-g),c=Math.min(o,n-w),p=g+M/2,x=w+c/2,y=e>=g&&e<g+M&&r>=w&&r<w+c;f.push({x0:g,y0:w,w:M,h:c,cx:p,cy:x,containsTarget:y})}return f.sort((a,h)=>{if(a.containsTarget)return-1;if(h.containsTarget)return 1;let g=Math.hypot(a.cx-e,a.cy-r),w=Math.hypot(h.cx-e,h.cy-r);return g-w})}var W=null;async function Y(){return W||(W=(async()=>{let{createWorker:t}=await import("tesseract.js"),n=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-2EXHWUSL.js");return n.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw W=null,t})),W}var O=null,N=null;async function tt(){let{getActiveDisplay:t}=await import("./screen_grid-
|
|
1
|
+
import{a as z}from"./chunk-QNUIT5G4.js";import{f as U}from"./chunk-37QHXCGM.js";import{a as j}from"./chunk-Y5JU726N.js";import F from"screenshot-desktop";import I from"sharp";import G from"fs-extra";import H from"path";import"@nut-tree-fork/nut-js";async function P(t,n,e){if(!(!process.env.SHOW_DEBUG_GRID&&!process.env.DEBUG_OCR))try{let r=H.resolve(process.cwd(),"screenshots",t);await G.ensureDir(r),await G.writeFile(H.join(r,n),e)}catch{}}function J(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function K(t,n,e=1/0){if(t===n)return 0;if(t.length===0)return n.length;if(n.length===0)return t.length;if(Math.abs(t.length-n.length)>e)return e+1;let r=Array.from({length:n.length+1},(s,i)=>i);for(let s=1;s<=t.length;s++){let i=[s],l=s;for(let o=1;o<=n.length;o++){let f=t[s-1]===n[o-1]?0:1,a=Math.min(i[o-1]+1,r[o]+1,r[o-1]+f);i.push(a),a<l&&(l=a)}if(r=i,l>e)return e+1}return r[n.length]}function Q(t){return t<=4?0:t<=8?1:2}async function B(t,n=3){let e=await I(t).metadata();return I(t).resize(Math.round(e.width*n),Math.round(e.height*n),{kernel:"lanczos3"}).greyscale().normalise().toBuffer()}function V(t){if(!t)return{words:[],lines:[]};let n=[],e=new Map;for(let s of t.split(`
|
|
2
|
+
`)){let i=s.split(" ");if(i.length<12||parseInt(i[0])!==5)continue;let o=i[2],f=i[3],a=i[4],h=parseInt(i[6]),g=parseInt(i[7]),w=parseInt(i[8]),M=parseInt(i[9]),c=parseFloat(i[10]),p=i.slice(11).join(" ").trim();if(!p||c<0)continue;let x={x0:h,y0:g,x1:h+w,y1:g+M},y={text:p,confidence:c,bbox:x};n.push(y);let d=`${o}_${f}_${a}`;e.has(d)||e.set(d,{words:[],bbox:{x0:1/0,y0:1/0,x1:-1/0,y1:-1/0}});let u=e.get(d);u.words.push(y),u.bbox.x0=Math.min(u.bbox.x0,x.x0),u.bbox.y0=Math.min(u.bbox.y0,x.y0),u.bbox.x1=Math.max(u.bbox.x1,x.x1),u.bbox.y1=Math.max(u.bbox.y1,x.y1)}let r=[];for(let s of e.values())s.words.length>0&&r.push({text:s.words.map(i=>i.text).join(" "),bbox:s.bbox,words:s.words});return{words:n,lines:r}}function Z(t){if(!(t.words&&t.words.length>0)){if(t.blocks&&t.blocks.length>0){t.words=[],t.lines=[];for(let n of t.blocks)for(let e of n.paragraphs||[])for(let r of e.lines||[]){r.bbox&&t.lines.push(r);for(let s of r.words||[])s.bbox&&t.words.push(s)}if(t.words.length>0)return}if(t.tsv){let n=V(t.tsv);t.words=n.words,t.lines=n.lines}}}function A(t,n,e=0,r=0,s=1){Z(t);let i=o=>({x0:Math.round(o.x0/s)+e,y0:Math.round(o.y0/s)+r,x1:Math.round(o.x1/s)+e,y1:Math.round(o.y1/s)+r}),l=[];if(t.lines&&t.lines.length>0)for(let o of t.lines){let f=o.text?o.text.toLowerCase().trim():"";if(!f||!o.bbox||!(f===n||new RegExp(`\\b${J(n)}\\b`,"i").test(f)))continue;let h=o.words||(t.words?t.words.filter(c=>c.bbox&&c.bbox.x0>=o.bbox.x0-5&&c.bbox.x1<=o.bbox.x1+5&&c.bbox.y0>=o.bbox.y0-5&&c.bbox.y1<=o.bbox.y1+5):[]),g=n.split(/\s+/),w=g.map(c=>c.replace(/[^a-z0-9]/g,"")).join(" "),M=!1;if(h.length>0)for(let c=0;c<=h.length-g.length;c++){let p=h.slice(c,c+g.length),x=p.map(y=>(y.text||"").toLowerCase().trim().replace(/[^a-z0-9]/g,"")).join(" ");if(x===w||x.includes(w)){let y={x0:Math.min(...p.map(d=>d.bbox.x0)),y0:Math.min(...p.map(d=>d.bbox.y0)),x1:Math.max(...p.map(d=>d.bbox.x1)),y1:Math.max(...p.map(d=>d.bbox.y1))};l.push(i(y)),M=!0}}M||l.push(i(o.bbox))}if(l.length===0&&t.words&&t.words.length>0)for(let o of t.words){let f=o.text?o.text.toLowerCase().trim().replace(/[^a-z0-9]/g,""):"",a=n.replace(/[^a-z0-9]/g,"");f===a&&o.bbox&&l.push(i(o.bbox))}if(l.length===0&&t.words&&t.words.length>0){let o=Q(n.length);for(let f of t.words){let a=f.text?f.text.toLowerCase().trim():"";a.length>=3&&Math.abs(a.length-n.length)<=o&&K(a,n,o)<=o&&f.bbox&&l.push(i(f.bbox))}}return l}function E(t,n){let e=null,r=1/0;for(let s of t){let i=Math.round((s.x0+s.x1)/2),l=Math.round((s.y0+s.y1)/2),o=n.x>=s.x0&&n.x<=s.x1&&n.y>=s.y0&&n.y<=s.y1,f=Math.hypot(i-n.x,l-n.y),a=o?0:f;a<r&&(r=a,e={x:i,y:l,dist:f,containsPoint:o,bbox:s})}return e}function X(t,n,e,r){let l=Math.ceil(t/4),o=Math.ceil(n/2),f=[];for(let a=0;a<2;a++)for(let h=0;h<4;h++){let g=h*l,w=a*o,M=Math.min(l,t-g),c=Math.min(o,n-w),p=g+M/2,x=w+c/2,y=e>=g&&e<g+M&&r>=w&&r<w+c;f.push({x0:g,y0:w,w:M,h:c,cx:p,cy:x,containsTarget:y})}return f.sort((a,h)=>{if(a.containsTarget)return-1;if(h.containsTarget)return 1;let g=Math.hypot(a.cx-e,a.cy-r),w=Math.hypot(h.cx-e,h.cy-r);return g-w})}var W=null;async function Y(){return W||(W=(async()=>{let{createWorker:t}=await import("tesseract.js"),n=await import("fs-extra"),{CU_CACHE_DIR:e}=await import("./paths-2EXHWUSL.js");return n.ensureDirSync(e),t("eng",1,{cachePath:e,logger:()=>{}})})().catch(t=>{throw W=null,t})),W}var O=null,N=null;async function tt(){let{getActiveDisplay:t}=await import("./screen_grid-BK5KF7MP.js"),n=await t();if(O&&N===n)return O;N=n,O={format:"png"};try{let e=await F.listDisplays();e&&e.length>0&&(O={format:"png",screen:(e[n]||e[0]).id})}catch{}return O}var ut=async(t,n={})=>{let e=j(t),r=e.gridId||e.grid||e.coordinate||e.target||e.id,s=(e.type||e.clickType||"single").toLowerCase(),i=(e.button||"left").toLowerCase(),l=e.intendedClickText||e.text||"",o=e.ocrCorrection!==void 0?e.ocrCorrection===!0||e.ocrCorrection==="true":e.useOCR!==void 0?e.useOCR===!0||e.useOCR==="true":!0;if(!r&&!l)return'ERROR: Missing required "gridId" parameter for Click tool.';let f=r;if(o&&l)try{let h=r?U(r):null,g=await tt(),w=await F(g),M=await I(w).metadata(),c=M.width||1920,p=M.height||1080,x=h?{x:Math.round(h.x*(c/1280)),y:Math.round(h.y*(p/720))}:{x:c/2,y:p/2},y=l.toLowerCase().trim(),d=await Y(),u=null,$="",q=h?320:500;if(h){let _=Math.min(Math.round(c/2),c),k=Math.min(Math.round(p/2),p),b=Math.max(0,Math.min(c-_,x.x-Math.floor(_/2))),m=Math.max(0,Math.min(p-k,x.y-Math.floor(k/2))),T=await I(w).extract({left:b,top:m,width:_,height:k}).toBuffer(),D=2,R=await B(T,D),v=y.replace(/[^a-z0-9]/g,"_");await P("cropped",`crop_${Date.now()}_${v}.png`,R),await d.setParameters({tessedit_pageseg_mode:"11"});let{data:C}=await d.recognize(R,{},{tsv:!0,blocks:!0});if(C&&C.text){let L=A(C,y,b,m,D);if(L.length>0){let S=E(L,x);S&&(S.containsPoint||S.dist<=q)&&(u=S,$="centered target crop OCR")}}}if(!u){let _=await B(w,2),k=y.replace(/[^a-z0-9]/g,"_");await P("fullscreen",`full_${Date.now()}_${k}.png`,_),await d.setParameters({tessedit_pageseg_mode:"3"});let{data:b}=await d.recognize(_,{},{tsv:!0,blocks:!0});if(b&&b.text){let m=A(b,y,0,0,2);if(m.length>0){let T=E(m,x);T&&(u=T,$="full-screen OCR")}}}if(!u){let _=X(c,p,x.x,x.y),k=y.replace(/[^a-z0-9]/g,"_");await d.setParameters({tessedit_pageseg_mode:"11"});for(let b=0;b<_.length;b++){let m=_[b],T=await I(w).extract({left:m.x0,top:m.y0,width:m.w,height:m.h}).toBuffer(),D=await B(T,3);await P("tiles",`tile_${b+1}_${Date.now()}_${k}.png`,D);let{data:R}=await d.recognize(D,{},{tsv:!0,blocks:!0});if(!R||!R.text)continue;let v=A(R,y,m.x0,m.y0,3);if(v.length>0){let C=E(v,x);if(C){u=C,$=`tile ${b+1} OCR (${m.containsTarget?"target tile":`offset ${m.x0},${m.y0}`})`;break}}}}if(u){let _={x:Math.round(u.x*(1280/c)),y:Math.round(u.y*(720/p))};return`${await z("click",_,{button:i,clickType:s})} (${$} for "${l}" at ${Math.round(u.dist)}px distance)`}}catch{}return await z("click",f,{button:i,clickType:s})};export{ut as click};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i,b as s}from"./chunk-
|
|
1
|
+
import{a as i,b as s}from"./chunk-QNUIT5G4.js";import"./chunk-37QHXCGM.js";import{a as c}from"./chunk-Y5JU726N.js";var d=async(a,p={})=>{let e=c(a),r=e.action||e.type||e.cmd,n=e.target||e.grid||e.gridCode||e.location||e.input;if(!r)return'ERROR: Missing required "action" argument for computer_action (e.g. move, click, drag, scroll, type, key_press, key_combination).';let t=r.toLowerCase();if(t.startsWith("mouse_")||["move","click","drag","scroll"].includes(t)){let o=t.replace("mouse_","");return await i(o,n,{button:e.button,clickType:e.clickType||e.type,from:e.from,to:e.to,direction:e.direction,amount:e.amount?parseInt(e.amount,10):void 0})}if(t.startsWith("key_")||t==="type"||t==="press"){let o=t;t==="press"&&(o="key_press");let u=e.autoPressEnter===!0||e.autoPressEnter==="true"||e.enter===!0||e.enter==="true";return await s(o,n||e.text||e.keys,{...e,autoPressEnter:u})}return`ERROR: Unrecognized action "${r}". Supported actions: move, click, drag, scroll, type, key_press, key_combination.`};export{d as computer_action};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var B=async function*(C,y,M,x,g,O,S,E,$=1){let m=[];x&&m.push({role:"system",content:x});for(let o of M){let k=o.role==="user"?"user":"assistant",a=[];if(Array.isArray(o.parts)){for(let e of o.parts)if(e.text)a.push({type:"text",text:e.text});else if((e.inlineData||e.inline_data)&&S){let s=e.inlineData||e.inline_data,r=s.mimeType||s.mime_type||"image/jpeg",l=s.data;r.startsWith("image/")&&a.push({type:"image_url",image_url:{url:`data:${r};base64,${l}`}})}}else{let e=o.text||"";e&&a.push({type:"text",text:e})}m.push({role:k,content:a.length===1&&a[0].type==="text"?a[0].text:a})}let f={model:y,messages:m,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"},D=T("DeepSeek",y,g),c=D!==null?D:g!=="Fast"?{Low:"low",Medium:"high",Standard:"high",High:"max",xHigh:"max"}[g]||"high":null;c&&c!=="disabled"&&c!=="none"&&c!=="false"&&c!==!1?(f.reasoning_effort=c,f.extra_body={thinking:{type:"enabled"}}):f.extra_body={thinking:{type:"disabled"}};let p=await b("https://api.deepseek.com/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"Content-Type":"application/json"},body:JSON.stringify(f),signal:E});if(!p.ok){let o=await p.json().catch(()=>({}));throw new Error(`DeepSeek Error (${p.status}): ${o.error?.message||p.statusText}`)}let j=p.body.getReader(),N=new TextDecoder,_="",t=[],d=null,h=Date.now(),n=!1;for(;;){let{done:o,value:k}=await j.read();if(o){n&&(t.length>0||d)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:d});break}_+=N.decode(k,{stream:!0});let a=_.split(`
|
|
2
|
+
`);_=a.pop();for(let e of a){let s=e.trim();if(!s||!s.startsWith("data: "))continue;let r=!1;if(s==="data: [DONE]")r=!0;else try{let l=JSON.parse(s.substring(6)),u=l.choices?.[0]?.delta,i=l.usage;if(l.choices?.[0]?.finish_reason&&(r=!0),i&&(d={totalTokenCount:i.total_tokens||i.prompt_tokens+i.completion_tokens,promptTokenCount:i.prompt_tokens||0,candidatesTokenCount:i.completion_tokens||0,cachedContentTokenCount:i.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:i.completion_tokens_details?.reasoning_tokens||0},n=!0),u){let w=u.reasoning_content||null;w&&(t.push({text:w,thought:!0}),n=!0),u.content&&(t.push({text:u.content}),n=!0)}}catch{}if((r||Date.now()-h>=150)&&n&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:d},t=[],h=Date.now(),n=!1),r)break}Date.now()-h>=150&&n&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:d},t=[],h=Date.now(),n=!1)}};export{B as getDeepSeekStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-QNUIT5G4.js";import"./chunk-37QHXCGM.js";import{a as d}from"./chunk-Y5JU726N.js";var m=async(a,i={})=>{let r=d(a),o=r.fromGridId||r.from||r.start,t=r.toGridId||r.to||r.end;return!o||!t?'ERROR: Drag requires both "fromGridId" and "toGridId" parameters.':await e("drag",o,{from:o,to:t})};export{m as drag};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as A}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var U=async function*(L,_,b,y,x,R,P,S,C=1){let g=[];y&&g.push({role:"system",content:y});for(let o of b){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&P){let i=n.inlineData.mimeType,p=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=A("ExpLabs",_,x),E=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],w={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:C,tools:[],tool_choice:"none"};E&&(w.reasoning_effort=E);let M=process.env.EXPLABS_URL||process.env.EXPERIENTIALLABS_URL||"https://api.experientiallabs.ai/v1/chat/completions",T={"Content-Type":"application/json"},v=L||process.env.EXPLABS_API_KEY||process.env.EXPERIENTIALLABS_API_KEY||"";T.Authorization=`Bearer ${v}`;let c=await D(M,{method:"POST",headers:T,body:JSON.stringify(w),signal:S});if(!c.ok){let o=await c.json().catch(()=>({}));throw new Error(`Experiential Labs Error (${c.status}): ${o.error?.message||o.message||c.statusText}`)}let B=c.body.getReader(),I=new TextDecoder,h="",t=[],l=null,f=Date.now(),a=!1;for(;;){let{done:o,value:m}=await B.read();if(o){a&&(t.length>0||l)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:l});break}h+=I.decode(m,{stream:!0});let e=h.split(`
|
|
2
|
+
`);h=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let d=JSON.parse(i.substring(6)),r=d.choices?.[0]?.delta,s=d.usage;if(s&&(l={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let u=r.reasoning_content||r.reasoning||null;!u&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(u=r.reasoning_details.map(N=>N.text||"").filter(Boolean).join("")),u&&(t.push({text:u,thought:!0}),a=!0),r.content&&(t.push({text:r.content}),a=!0)}}catch{}if((p||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1),p)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1)}};export{U as getExpLabsStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as k}from"./chunk-FQBBOFNP.js";import{a as b}from"./chunk-Y5JU726N.js";import{q as B,r as T,s as $}from"./chunk-
|
|
1
|
+
import{a as k}from"./chunk-FQBBOFNP.js";import{a as b}from"./chunk-Y5JU726N.js";import{q as B,r as T,s as $}from"./chunk-LKJUPSJM.js";import{a as I}from"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";import C from"fs-extra";import x from"path";var F=(a,y={})=>{try{if(a.length<8||a[0]!==137||a[1]!==80||a[2]!==78||a[3]!==71)return a;let s=[],c=[];for(let r=0;r<256;r++){let e=r;for(let n=0;n<8;n++)e&1?e=3988292384^e>>>1:e=e>>>1;c[r]=e}let l=r=>{let e=4294967295;for(let n=0;n<r.length;n++)e=c[(e^r[n])&255]^e>>>8;return(e^4294967295)>>>0},f=(r,e)=>{let n=Buffer.from(r,"ascii"),i=Buffer.from(e,"utf-8"),u=n.length+1+i.length,o=Buffer.alloc(8+u+4);o.writeUInt32BE(u,0),o.write("tEXt",4,"ascii"),n.copy(o,8),o[8+n.length]=0,i.copy(o,8+n.length+1);let w=l(o.subarray(4,8+u));return o.writeUInt32BE(w,8+u),o};for(let[r,e]of Object.entries(y))e!=null&&s.push(f(r,String(e)));if(s.length===0)return a;if(a.subarray(12,16).toString("ascii")==="IHDR"){let e=a.subarray(0,33),n=a.subarray(33);return Buffer.concat([e,...s,n])}return a}catch{return a}},N=async(a,y={})=>{let s=b(a),c=s.prompt||s.text,l=s.path||s.outputPath||s.output||"generated_image.png",f=s.ratio;if(!c)return'ERROR: Missing "prompt" argument for generate_image.';let r=["nsfw","naked","nudity","nude","porn","sex","xxx","erotic","gore","bloody","violence","abuse","suicide","murder","hentai","pedophile","rape"],e=c.toLowerCase();if(r.some(i=>e.includes(i)))return"ERROR: Prompt blocked by system safety filter (inappropriate or unsafe content detected).";try{let i=await I();if(!await B(i))return`ERROR: Insufficient Quota for selected quality. Either tell user reduce quality or wait for next refresh cycle (${(await T()).nextResetMin||60}m).`;let o=i.imageSettings||{keyType:"Default",quality:"Low-High",apiKey:""},w=o.keyType==="Custom"&&o.apiKey?o.apiKey:FALLBACK_IMAGE_KEY,E={Low:"flux","Low-High":"zimage",Medium:"gptimage","Medium-High":"gptimage",High:"qwen-image",Ultra:"gptimage-large",Premium:"nanobanana-pro"}[o.quality]||"zimage",g=1024,m=1024;if(f){let t=f.replace(/\s+/g,"");t==="16:9"?(g=1024,m=576):t==="9:16"?(g=576,m=1024):t==="4:3"?(g=1024,m=768):t==="3:4"?(g=768,m=1024):t==="1:1"&&(g=1024,m=1024)}let M=Math.floor(Math.random()*1e7),S=`https://gen.pollinations.ai/image/${encodeURIComponent(c)}?model=${E}&width=${g}&height=${m}&seed=${M}&enhance=true&reasoning=high&quality=high&negative=${encodeURIComponent("deformed, distorted, disfigured, poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, disconnected limbs, mutation, mutated hands and fingers, blurry, low quality, low resolution, extra fingers, censored, watermarks, signatures")}`,d=await fetch(S,{method:"GET",headers:{Authorization:`Bearer ${w}`}});if(!d.ok){let t=d.status,h="";try{h=await d.text()}catch{}return t===402||h.includes("Insufficient balance")||h.includes("PAYMENT_REQUIRED")?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed with status [${t}]: ${h||"Unknown API Error"}`}if((d.headers.get("content-type")||"").includes("application/json")){let t=await d.json();return t.status===402||t.error&&t.error.code==="PAYMENT_REQUIRED"?"ERROR: Image Generation Currently unavailable. Try again later.":`ERROR: Image Generation failed: ${t.error?.message||JSON.stringify(t)}`}let O=await d.arrayBuffer(),p=Buffer.from(O),P={Title:c,Description:"Generated via FluxFlow CLI",Software:"FluxFlow CLI",Author:"FluxFlow","Creation Time":new Date().toISOString(),Prompt:c,Model:`Fluxflow:${E}`,Ratio:f||"1:1",Seed:String(M)};p=F(p,P);let R=x.resolve(process.cwd(),l);await C.ensureDir(x.dirname(R)),await k.recordFileChange(R),await C.writeFile(R,p),await $(i);let v=x.extname(l).toLowerCase(),L={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp"}[v]||"image/png";return y.isMultiModal!==!1?{text:`Image successfully generated from prompt [${c}] and saved to [${l}]. Output attached to multimodal part`,binaryPart:{inlineData:{data:p.toString("base64"),mimeType:L}}}:`Image successfully generated from prompt [${c}] and saved to [${l}].`}catch(i){return`ERROR: Failed during image generation: ${i instanceof Error?i.message:String(i)}`}};export{N as generate_image};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var v=async function*(S,r,E,x,y,J,P,L,N=1){let h=[];x&&h.push({role:"system",content:x});for(let t of E){let o=t.role==="user"?"user":"assistant",e="";if(Array.isArray(t.parts))for(let f of t.parts)f.text&&(e+=(e?`
|
|
2
|
+
`:"")+f.text);else e=t.text||"";h.push({role:o,content:e})}let g=b("InferX",r,y),T=g!==null?g:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],O=r&&r.toLowerCase().includes("qwen3.8-27b")&&g===null,q=r&&(r.toLowerCase().includes("qwen3.8-27b")||r.toLowerCase().includes("qwen3.6-35b-a3b-fp8")),m={model:r,messages:h.filter(t=>t.content&&String(t.content).trim().length>0),stream:!0,stream_options:{include_usage:!0},temperature:N,tools:[],tool_choice:"none"};!O&&T&&(m.stream_options={include_usage:!0},m.reasoning_effort=T);let c=await D("https://model.inferx.net/endpoints/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${S}`,"Content-Type":"application/json"},body:JSON.stringify(m),signal:L});if(!c.ok){let t=await c.text().catch(()=>""),o="";try{let e=JSON.parse(t);o=e.error?.message||e.error?.detail||e.message||e.detail||(typeof e.error=="string"?e.error:"")||(t&&t!=="{}"?t:"")}catch{o=t}throw(!o||o==="{}")&&(o=c.statusText||"Unknown error"),new Error(`InferX Error (${c.status}): ${o}`)}let A=c.body.getReader(),F=new TextDecoder,k="",n=[],i=null,u=Date.now(),a=!1,C=!0;for(;;){let{done:t,value:o}=await A.read();if(t){a&&(n.length>0||i)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:i});break}k+=F.decode(o,{stream:!0});let e=k.split(`
|
|
3
|
+
`);k=e.pop();for(let f of e){let d=f.trim();if(!d||!d.startsWith("data: "))continue;let w=!1;if(d==="data: [DONE]")w=!0;else try{let _=JSON.parse(d.substring(6)),l=_.choices?.[0]?.delta,s=_.usage;if(s&&(i={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),l){let M=l.reasoning||l.reasoning_content||null;if(M&&(n.push({text:M,thought:!0}),a=!0),l.content){let p=l.content;q&&C&&p.length>0&&(p="<think>"+p,C=!1),n.push({text:p}),a=!0}}}catch{}if((w||Date.now()-u>=150||i)&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],u=Date.now(),a=!1),w)break}Date.now()-u>=150&&a&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:i},n=[],u=Date.now(),a=!1)}};export{v as getInferXStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var B=async function*(F,_,M,y,k,S,N,A,E=1){let g=[];y&&g.push({role:"system",content:y});for(let o of M){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&N){let i=n.inlineData.mimeType,u=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${u}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let x=b("Infron",_,k),w=x!==null?x:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],T={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:E,tools:[],tool_choice:"none"};w&&(T.reasoning={effort:w});let I=process.env.INFRON_URL||"https://llm.onerouter.pro/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},O=F||process.env.INFRON_API_KEY||"";D.Authorization=`Bearer ${O}`;let l=await C(I,{method:"POST",headers:D,body:JSON.stringify(T),signal:A});if(!l.ok){let o=await l.json().catch(()=>({}));throw new Error(`Infron Error (${l.status}): ${o.error?.message||o.message||l.statusText}`)}let v=l.body.getReader(),P=new TextDecoder,h="",t=[],c=null,f=Date.now(),a=!1;for(;;){let{done:o,value:m}=await v.read();if(o){a&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=P.decode(m,{stream:!0});let e=h.split(`
|
|
2
|
+
`);h=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let u=!1;if(i==="data: [DONE]")u=!0;else try{let p=JSON.parse(i.substring(6)),r=p.choices?.[0]?.delta,s=p.usage;if(s&&(c={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let d=r.reasoning_content||r.reasoning||null;!d&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(d=r.reasoning_details.map(R=>R.text||"").filter(Boolean).join("")),d&&(t.push({text:d,thought:!0}),a=!0),r.content&&(t.push({text:r.content}),a=!0)}}catch{}if((u||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),a=!1),u)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),a=!1)}};export{B as getInfronStream};
|
|
@@ -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-CANLJJ2L.js"),l=b(w),c=l.task||l.instruction||l.prompt,E=l.model||null,C=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:C||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=[],A={...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: [action: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((M,_)=>M+_.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,A,E,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]")||n.startsWith("[Action 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-CANLJJ2L.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)}),`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-CANLJJ2L.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-CANLJJ2L.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 +1 @@
|
|
|
1
|
-
import{b as e}from"./chunk-
|
|
1
|
+
import{b as e}from"./chunk-QNUIT5G4.js";import"./chunk-37QHXCGM.js";import{a as i}from"./chunk-Y5JU726N.js";var k=async(s,c={})=>{let t=i(s),a=t.key||t.keys||t.input||t.shortcut;if(!a)return'ERROR: Missing required "key" parameter for KeyPress tool.';let r=String(a).trim().toLowerCase();if(r==="clearinput"||r==="clear_input"||r==="clear")return await e("clear_input");if(r==="back"||r==="browser_back"||r==="browserBack")return await e("browser_back");if(r.includes(";")||r.includes("+")){let o=r.split(/[;+]/).map(n=>n.trim()).filter(Boolean);return await e("key_combination",o)}return await e("key_press",r)};export{k as key_press};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n}from"./chunk-
|
|
1
|
+
import{b as n}from"./chunk-QNUIT5G4.js";import"./chunk-37QHXCGM.js";import{a as r}from"./chunk-Y5JU726N.js";var p=async(o,u={})=>{let t=r(o),e=t.text||t.input||t.value||"",s=t.autoPressEnter===!0||t.autoPressEnter==="true"||t.enter===!0||t.enter==="true";return e==null?'ERROR: Missing required "text" parameter for KeyboardTyping tool.':await n("type",String(e),{autoPressEnter:s})};export{p as keyboard_typing};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as O,b as j,c as f}from"./chunk-NL4MAQSB.js";import{a as N}from"./chunk-JS5ZIGFR.js";import"./chunk-QWTKV7Q4.js";import"./chunk-DSVLWYIT.js";var X=async function*(M,T,B,b,m,K,E,J,P=1,W=null){let w=[];b&&w.push({role:"system",content:b});for(let t of B){let g=t.role==="user"?"user":"assistant",e=[];if(Array.isArray(t.parts)){for(let i of t.parts)if(i.text)e.push({type:"text",text:i.text});else if(i.inlineData&&E){let p=i.inlineData.mimeType,d=i.inlineData.data;p.startsWith("image/")&&e.push({type:"image_url",image_url:`data:${p};base64,${d}`})}}else{let i=t.text||"";i&&e.push({type:"text",text:i})}e.length>0&&w.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let S={Fast:"none",Low:"none",Medium:"high",Standard:"high",High:"high",xHigh:"high"},F=`${M.slice(-5)}${W||""}${m}${T}`,H=await j(F),C={model:T,messages:w,stream:!0,temperature:P,prompt_cache_key:H,tools:[],tool_choice:"none"},h=N("Mistral",T,m);h!==null&&h!=="none"?h&&h!=="none"&&h!=="disabled"&&h!==!1&&(C.reasoning_effort=h):m&&S[m]!=="none"&&(C.reasoning_effort=S[m]||"high");let y=await O("https://api.mistral.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(C),signal:J});if(!y.ok){let t=await y.text().catch(()=>""),g=y.statusText;try{let e=JSON.parse(t);g=e.error?.message||e.message||JSON.stringify(e.detail||e)}catch{t&&(g=t)}throw new Error(`Mistral Error (${y.status}): ${JSON.stringify(g)}`)}let R=y.body.getReader(),q=new TextDecoder,D="",n=[],x=null,k=Date.now(),r=!1,o=t=>t?typeof t=="string"?f(t):Array.isArray(t)?t.map(o).filter(Boolean).join(""):typeof t=="object"&&t!==null?typeof t.text=="string"?f(t.text):typeof t.content=="string"?f(t.content):typeof t.thinking=="string"?f(t.thinking):typeof t.reasoning_content=="string"?f(t.reasoning_content):typeof t.reasoning=="string"?f(t.reasoning):typeof t.value=="string"?f(t.value):t.text?o(t.text):t.content?o(t.content):t.thinking?o(t.thinking):t.reasoning_content?o(t.reasoning_content):t.reasoning?o(t.reasoning):t.value?o(t.value):"":f(String(t)):"";for(;;){let{done:t,value:g}=await R.read();if(t){r&&(n.length>0||x)&&(yield{candidates:n.length>0?[{content:{parts:n}}]:[],usageMetadata:x});break}D+=q.decode(g,{stream:!0});let e=D.split(`
|
|
2
|
+
`);D=e.pop();for(let i of e){let p=i.trim();if(!p||!p.startsWith("data: "))continue;let d=!1;if(p==="data: [DONE]")d=!0;else try{let _=JSON.parse(p.substring(6)),c=_.choices?.[0]?.delta,u=_.usage;if(_.choices?.[0]?.finish_reason&&(d=!0),u&&(x={totalTokenCount:u.total_tokens||(u.prompt_tokens||0)+(u.completion_tokens||0),promptTokenCount:u.prompt_tokens||0,candidatesTokenCount:u.completion_tokens||0,cachedContentTokenCount:u.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:u.completion_tokens_details?.reasoning_tokens||0},r=!0),c){let z=c.thinking||c.reasoning_content||c.reasoning,$=o(z);$&&(n.push({text:$,thought:!0}),r=!0);let a=c.content||(!c.thinking&&!c.reasoning_content&&!c.reasoning?c.text:null);if(a)if(Array.isArray(a))for(let s of a)if(typeof s=="object"&&s!==null){let l=s.type==="thinking"||s.type==="reasoning"||!!s.thought,A=o(s);A&&(n.push({text:A,...l?{thought:!0}:{}}),r=!0)}else{let l=o(s);l&&(n.push({text:l}),r=!0)}else if(typeof a=="object"&&a!==null){let s=a.type==="thinking"||a.type==="reasoning"||!!a.thought,l=o(a);l&&(n.push({text:l,...s?{thought:!0}:{}}),r=!0)}else{let s=o(a);s&&(n.push({text:s}),r=!0)}}}catch{}if((d||Date.now()-k>=150)&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1),d)break}Date.now()-k>=150&&r&&(yield{candidates:n.length>0?[{content:{parts:[...n]}}]:[],usageMetadata:x},n=[],k=Date.now(),r=!1)}};export{X as getMistralStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk-QWTKV7Q4.js";import"./chunk-DSVLWYIT.js";export{a as DEFAULT_MODEL_CONFIG,n as getDefaultModel,o as getFallbackValue,b as getModelConfig,m as getModels,l as hasModelReasoning,k as isModelMultimodal,g as removeModelFromProvider,h as renameModelInProvider,c as saveModelConfigToDisk,d as saveModelToProvider,i as setCustomMultimodal,f as setDefaultModelForProvider,e as setModelMultimodalInProvider,j as setOllamaMultimodal};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as j}from"./chunk-NL4MAQSB.js";import{a as R}from"./chunk-JS5ZIGFR.js";import{k as K}from"./chunk-QWTKV7Q4.js";import"./chunk-DSVLWYIT.js";var le=async function*(H,e,k,c,g,S,w=!1,I,M=1){let D=[];c&&D.push({role:"system",content:c}),k.forEach(i=>{let x=i.role==="model"?"assistant":"user",m=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)m.push({type:"text",text:u.text});else if(u.inlineData&&w){let r=u.inlineData.mimeType,f=u.inlineData.data;r.startsWith("image/")&&K(e)&&m.push({type:"image_url",image_url:{url:`data:${r};base64,${f}`}})}}),D.push({role:x,content:m.length===1&&m[0].type==="text"?m[0].text:m})});let A=R("NVIDIA",e,g),t=A!==null?A:{Fast:"Fast",Low:"Fast",Medium:"Standard",Standard:"Standard",High:"High",xHigh:"High"}[g]||"High",o=t!=="Fast"&&t!=="none"&&t!=="disabled"&&t!==!1,s=e.includes("kimi"),n=e.includes("gemma"),h=e.includes("deepseek"),y=e.includes("glm"),z=e.includes("mistral"),$=e.includes("minimax"),J=e.includes("gpt"),W=e.includes("qwen"),Y=e.includes("nemotron"),Q=e.includes("llama-3"),X=e.includes("seed"),B=e.includes("poolside"),C=e.includes("thinkingmachines")||e.includes("muse"),Z=Q,ee={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},te={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},se={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},V=$||h||B||C?16384:32768;V=process.env.NVIDIA_BASE_URL?1024:V;let a={model:e,messages:D,max_tokens:V,stream:!0,stream_options:{include_usage:!0},temperature:M,tools:[],tool_choice:"none",...J&&{thinking:ee[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||Z))if(s)a.chat_template_kwargs={thinking:o};else if(n)a.chat_template_kwargs={enable_thinking:o};else if(h)if(o){let i=t==="High"?"max":"high";a.chat_template_kwargs={thinking:!0,reasoning_effort:i}}else a.chat_template_kwargs={thinking:!1};else y?a.chat_template_kwargs={enable_thinking:o,clear_thinking:!o}:z?a.reasoning_effort=o?"high":"none":$&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:W?a.chat_template_kwargs={enable_thinking:o}:Y?t==="High"?a.chat_template_kwargs={enable_thinking:!0}:t==="Standard"?a.chat_template_kwargs={enable_thinking:!0,medium_effort:!0}:a.chat_template_kwargs={enable_thinking:!1}:X?o&&(a.extra_body={thinking_budget:parseInt(te[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=se[t]||"medium");let q=0,G=6,P=!1,T=process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1/chat/completions",ne=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:H;for(T.endsWith("/chat/completions")||(T=T.replace(/\/+$/,"")+"/chat/completions");q<G;){q++;try{let i=await j(T,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ne}`},body:JSON.stringify(a),signal:I});if(!i.ok){let b=await i.text().catch(()=>""),v=i.statusText;try{let d=JSON.parse(b);v=d.error?.message||d.message||JSON.stringify(d.detail||d)}catch{b&&(v=b)}let N=new Error(`NVIDIA API Error (${i.status}): ${v}`);throw N.status=i.status,N}let x=i.body.getReader(),m=new TextDecoder,u="",r=[],f=null,U=Date.now(),_=!1;for(;;){let{done:b,value:v}=await x.read();if(b){_&&(r.length>0||f)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:f},P=!0);break}u+=m.decode(v,{stream:!0});let N=u.split(`
|
|
2
|
+
`);u=N.pop();let d=!1;for(let ae of N){let E=ae.trim();if(E){if(E==="data: [DONE]"){d=!0;break}if(E.startsWith("data: ")){let p;try{p=JSON.parse(E.substring(6))}catch{continue}if(p.error)throw new Error(`NVIDIA Stream Error: ${p.error.message||JSON.stringify(p.error)}`);try{let l=p.usage;l&&(f={totalTokenCount:l.total_tokens||l.prompt_tokens+l.completion_tokens,promptTokenCount:l.prompt_tokens||0,candidatesTokenCount:l.completion_tokens||0,cachedContentTokenCount:l.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:(l.completion_tokens_details?.reasoning_tokens||0)+(l.completion_tokens_details?.thoughts_tokens||0)},_=!0);let F=p.choices?.[0]?.delta?.reasoning||p.choices?.[0]?.delta?.reasoning_content||"",O=p.choices?.[0]?.delta?.content||"";F&&(r.push({text:F,thought:!0}),_=!0),O&&(r.push({text:O}),_=!0)}catch{}}}}if((d||Date.now()-U>=350)&&_&&(yield{candidates:r.length>0?[{content:{parts:[...r]}}]:[],usageMetadata:f},P=!0,r=[],U=Date.now(),_=!1),d)break}break}catch(i){if(P||q>=G)throw i;await new Promise(x=>setTimeout(x,3500))}}},ce=async function*(H,e){let k=[],c=null,g=!1,S=null,w=s=>{if(k.push(s),c){let n=c;c=null,n()}},I=e.split("/").pop(),M=Array.from(new Set([I,I.replace(/\./g,"-"),I.replace(/\./g,"_")])),A=["https://buildapi.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy","https://api.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy"].flatMap(s=>M.map(n=>`${s}/${n}`)),L=!1,t=null,o=async()=>{try{let n=await(await Promise.any(A.map(async h=>{let y=await fetch(h);if(!y.ok)throw new Error(`HTTP ${y.status}`);return y}))).json();if(n&&n.queues&&n.queues[0]&&typeof n.queues[0].queueDepth=="number"){let h=n.queues[0].queueDepth;L||w({value:{type:"status",content:`Queue ${h||1}`},done:!1})}}catch{}};process.env.NVIDIA_BASE_URL||(o(),t=setInterval(o,5e3)),(async()=>{try{let s=H[Symbol.asyncIterator]();for(;;){let{value:n,done:h}=await s.next();if(h)break;L=!0,t&&(clearInterval(t),t=null),w({value:n,done:!1})}g=!0,w(null)}catch(s){if(S=s,t&&(clearInterval(t),t=null),c){let n=c;c=null,n()}}})();try{for(;;){if(S)throw S;if(k.length>0){let s=k.shift();if(s===null&&g)break;yield s.value}else{if(g)break;await new Promise(s=>{c=s})}}}finally{t&&(clearInterval(t),t=null)}};export{le as getNVIDIAStream,ce as wrapNvidiaStreamWithQueueDepth};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as O}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";import{Ollama as D}from"ollama";var y=async function*(r,p,M,d,u,b,S,T,v=1,w="Cloud"){let m=[];d&&m.push({role:"system",content:d});for(let t of M){let l=t.role==="user"?"user":"assistant",a="",c=[];if(Array.isArray(t.parts)){a=t.parts.map(o=>o.text||"").filter(Boolean).join(`
|
|
2
|
+
`);for(let o of t.parts){let h=o.inlineData||o.inline_data;h&&h.data&&c.push(h.data)}}else a=t.text||"";if(a||c.length>0){let o={role:l,content:a};c.length>0&&(o.images=c),m.push(o)}}let f=w==="Local"||!r||r==="LOCAL",g={host:f?process.env.OLLAMA_HOST||"http://127.0.0.1:11434":process.env.OLLAMA_HOST||"https://ollama.com"};!f&&r&&(g.headers={Authorization:"Bearer "+r});let C=new D(g),e=[],i=null,_=Date.now(),n=!1,s=O("Ollama",p,u),k={Fast:!1,Low:"medium",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},A=s!==null?s==="false"||s===!1?!1:s==="true"||s===!0?!0:s:k[u]!==void 0?k[u]:!0,x={model:p,messages:m,stream:!0,think:A,keep_alive:"10m",tools:[],tool_choice:"none",options:{temperature:v}},L=await C.chat(x);for await(let t of L){if(T?.aborted)throw new DOMException("The user aborted a request.","AbortError");if(t.message?.thinking&&(e.push({text:t.message.thinking,thought:!0}),n=!0),t.message?.content&&(e.push({text:t.message.content}),n=!0),t.done){let l=t.prompt_cached_count||0;if(!l&&t.prompt_eval_count){let a=t.prompt_eval_duration||0;a>0&&a<5e7&&(l=t.prompt_eval_count)}i={totalTokenCount:(t.prompt_eval_count||0)+(t.eval_count||0),promptTokenCount:t.prompt_eval_count||0,candidatesTokenCount:t.eval_count||0,cachedContentTokenCount:l,thoughtsTokenCount:0},n=!0}(t.done||Date.now()-_>=150&&n)&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:i},e=[],_=Date.now(),n=!1)}n&&(e.length>0||i)&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:i})};export{y as getOllamaStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as b,b as E}from"./chunk-NL4MAQSB.js";import{a as R}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var U=async function*($,d,S,O,h,A,M,F,N=1,P=null){let y=[];O&&y.push({role:"system",content:[{type:"text",text:O}]});for(let e of S){let r=e.role==="user"?"user":"assistant",t=[];if(Array.isArray(e.parts)){for(let n of e.parts)if(n.text)t.push({type:"text",text:n.text});else if(n.inlineData&&M){let i=n.inlineData.mimeType,l=n.inlineData.data;i.startsWith("image/")?t.push({type:"image_url",image_url:{url:`data:${i};base64,${l}`}}):t.push({type:"file",file:{filename:n.filename||"file",file_data:`data:${i};base64,${l}`}})}}else{let n=e.text||"";n&&t.push({type:"text",text:n})}y.push({role:r,content:t.length===1&&t[0].type==="text"?t[0].text:t})}let j={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},v=["free","nitro","floor","exacto"],x=d,f=null,m=null;if(d.includes(":")){let e=d.split(":");if(e.length>1){let r=e[e.length-1].toLowerCase().trim();(r==="flex"||r==="priority")&&(m=r,e.pop())}if(e.length>1){let r=e[e.length-1].toLowerCase().trim();if(!v.includes(r)){let t=e.pop().trim();t&&(f={only:[t],allow_fallbacks:!1})}}x=e.join(":").trim()}let I=`${$.slice(-5)}${P||""}${h}${x}${m||""}${f?JSON.stringify(f):""}`,J=await E(I),g={model:x,messages:y,stream:!0,temperature:N,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:J};m&&(g.service_tier=m),f&&(g.provider=f);let k=R("OpenRouter",d,h),T=k!==null?k:j[h];T&&T!=="none"&&(k!==null||h!=="Fast")&&(g.reasoning_effort=T);let u=await b("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${$}`,"Content-Type":"application/json","HTTP-Referer":"https://fluxflow-cli.onrender.com/","X-Title":"FluxFlow CLI","X-OpenRouter-Title":"FluxFlow CLI","X-Cache":"true","X-OpenRouter-Cache":"true"},body:JSON.stringify(g),signal:F});if(!u.ok){let e=await u.json().catch(()=>({})),r=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||u.statusText||"Unknown error";throw new Error(`OpenRouter Error (${u.status}): ${r}`)}let L=u.body.getReader(),W=new TextDecoder,C="",a=[],_=null,D=Date.now(),c=!1;for(;;){let{done:e,value:r}=await L.read();if(e){c&&(a.length>0||_)&&(yield{candidates:a.length>0?[{content:{parts:a}}]:[],usageMetadata:_});break}C+=W.decode(r,{stream:!0});let t=C.split(`
|
|
2
|
+
`);C=t.pop();for(let n of t){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let l=!1;if(i==="data: [DONE]")l=!0;else try{let o=JSON.parse(i.substring(6));if(o.error){let w=o.error.metadata?.raw||o.error.message||JSON.stringify(o.error);throw new Error(`OpenRouter Stream Error: ${w}`)}let p=o.choices?.[0]?.delta,s=o.usage;if(o.choices?.[0]?.finish_reason&&(l=!0),s&&(_={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||s.prompt_tokens_details?.cache_read_input_tokens||s.cache_read_input_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||0},c=!0),p){let w=p.reasoning||(p.reasoning_details?p.reasoning_details.map(X=>X.text).join(""):null);w&&(a.push({text:w,thought:!0}),c=!0),p.content&&(a.push({text:p.content}),c=!0)}}catch(o){if(o.message&&o.message.startsWith("OpenRouter Stream Error:"))throw o}if((l||Date.now()-D>=150)&&c&&(yield{candidates:a.length>0?[{content:{parts:[...a]}}]:[],usageMetadata:_},a=[],D=Date.now(),c=!1),l)break}}};export{U as getOpenRouterStream};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as D}from"./chunk-NL4MAQSB.js";import{a as x}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var F=async function*(b,k,C,y,w,S,P,M,$=1){let g=[];y&&g.push({role:"system",content:y});for(let i of C){let _=i.role==="user"?"user":"assistant",e=[];if(Array.isArray(i.parts)){for(let n of i.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&P){let r=n.inlineData.mimeType,l=n.inlineData.data;r.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${r};base64,${l}`}})}}else{let n=i.text||"";n&&e.push({type:"text",text:n})}g.push({role:_,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let s=x("Poolside",k,w),j=s!==null?s===!1||s==="false"||s==="none"||s==="Fast":w==="Fast",f={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};j?f.chat_template_kwargs={enable_thinking:!1}:s!==null&&typeof s=="object"?f.chat_template_kwargs=s:f.chat_template_kwargs={enable_thinking:!0};let c=await D("https://inference.poolside.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${b}`,"Content-Type":"application/json"},body:JSON.stringify(f),signal:M});if(!c.ok){let i=await c.json().catch(()=>({}));throw new Error(`Poolside Error (${c.status}): ${i.error?.message||c.statusText}`)}let N=c.body.getReader(),O=new TextDecoder,m="",t=[],p=null,h=Date.now(),o=!1;for(;;){let{done:i,value:_}=await N.read();if(i){o&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}m+=O.decode(_,{stream:!0});let e=m.split(`
|
|
2
|
+
`);m=e.pop();for(let n of e){let r=n.trim();if(!r||!r.startsWith("data: "))continue;let l=!1;if(r==="data: [DONE]")l=!0;else try{let u=JSON.parse(r.substring(6)),d=u.choices?.[0]?.delta,a=u.usage;if(u.choices?.[0]?.finish_reason&&(l=!0),a&&(p={totalTokenCount:a.total_tokens||(a.prompt_tokens||0)+(a.completion_tokens||0),promptTokenCount:a.prompt_tokens||0,candidatesTokenCount:a.completion_tokens||0,cachedContentTokenCount:a.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||a.reasoning_tokens||0},o=!0),d){let T=d.reasoning_content||d.reasoning||null;T&&(t.push({text:T,thought:!0}),o=!0),d.content&&(t.push({text:d.content}),o=!0)}}catch{}if((l||Date.now()-h>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1),l)break}Date.now()-h>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),o=!1)}};export{F as getPoolsideStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g}from"./chunk-37QHXCGM.js";export{a as GRID_CONFIG,e as captureGriddedScreenshot,d as getActiveDisplay,g as gridToNativeCoordinates,f as parseGridCodeTo720p,c as rawModelOnly,b as useModel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-QNUIT5G4.js";import"./chunk-37QHXCGM.js";import{a as t}from"./chunk-Y5JU726N.js";var m=async(n,i={})=>{let o=t(n),e=(o.direction||"down").toLowerCase(),c=o.amount?parseInt(o.amount,10):6,s=o.gridId||o.grid||o.coordinate||o.target||o.id||null;return await r("scroll",s,{direction:e,amount:c})};export{m as scroll};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as V}from"./chunk-Y5JU726N.js";import{w as j,x as H}from"./chunk-DSVLWYIT.js";import K from"fs/promises";import z from"path";import Z from"fast-glob";import{Minimatch as q}from"minimatch";async function O(a,n,s=a,g=1){if(g>12)return[];let c=[],r;try{r=await K.readdir(a,{withFileTypes:!0})}catch{return[]}for(let t of r){let l=z.join(a,t.name),m=z.relative(s,l),L=m.split(z.sep).map($=>$.toLowerCase()),W=t.name.toLowerCase();if(!n.some($=>{let E=$.toLowerCase();return E.startsWith(".")&&W.endsWith(E)?!0:L.some(v=>v===E||v.startsWith(".pnpm"))}))if(t.isDirectory()){let $=await O(l,n,s,g+1);c=c.concat($)}else t.isFile()&&c.push({fullPath:l,relativePath:m})}return c}function Y(a,n,s=1/0){if(a===n)return 0;if(a.length===0)return n.length;if(n.length===0)return a.length;if(Math.abs(a.length-n.length)>s)return s+1;let g=Array.from({length:n.length+1},(c,r)=>r);for(let c=1;c<=a.length;c++){let r=[c],t=c;for(let l=1;l<=n.length;l++){let m=a[c-1]===n[l-1]?0:1,L=Math.min(r[l-1]+1,g[l]+1,g[l-1]+m);r.push(L),L<t&&(t=L)}if(g=r,t>s)return s+1}return g[n.length]}function tt(a,n){if(!a||!n)return!1;let s=a.toLowerCase(),g=n.toLowerCase();if(s.includes(g))return!0;let c=s.split(/[^a-z0-9]+/).filter(t=>t.length>0),r=g.split(/[^a-z0-9]+/).filter(t=>t.length>1||g.length===1&&t.length>0);return r.length===0?!1:r.every(t=>{let l=t.length<=2?0:t.length<=5?1:2;for(let m of c)if(m.includes(t)||t.length>=3&&m.length>=3&&Math.abs(m.length-t.length)<=l&&Y(t,m,l)<=l)return!0;return!1})}var at=async a=>{let{keyword:n,path:s,fuzzy:g,subString:c,regex:r}=V(a);if(n==null)return'ERROR: Missing "keyword" argument.';let t=String(n);if(s){let e=s.trim().toLowerCase();if(e==="#docs"||e==="#doc"||e==="#documentation"||e.includes("#skill/global/fluxflow")||e.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let l=e=>e===!0||e==="true"||e===1||e==="1"||e==="yes",m=r===!1||r==="false"||r===0||r==="0"||r==="no",L=r===!0||r==="true"||r===1||r==="1"||r==="yes",W=l(g)||l(c),A=null,$=null;if(m)W||($=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{A=new RegExp(t,"i")}catch(e){if(L)return`ERROR: Invalid regex pattern "${t}": ${e.message}`}$=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let E=Array.from(new Set([...j,...H(process.cwd())])),v=150;try{let e=[],x=process.cwd(),h=null;if(s){let o=s.split(";").map(i=>i.trim()).filter(Boolean),y=o.some(i=>i.startsWith("!"));if(o.some(i=>Z.isDynamicPattern(i)||/[*?{}[\]()|+]/.test(i))){h="glob";let i=s.replace(/\\/g,"/"),F=o.map(u=>u.replace(/\\/g,"/")),f=E.map(u=>u.startsWith(".")?`**/*${u}`:`**/${u}/**`);if(y&&!o.some(u=>!u.startsWith("!"))){let u=await O(x,E,x),w=d=>d.endsWith("/")?d+"**":d,p=F.filter(d=>d.startsWith("!")).map(d=>w(d.slice(1))),M=F.filter(d=>!d.startsWith("!")).map(w);e=u.filter(d=>{let R=d.relativePath.replace(/\\/g,"/"),_=M.length===0||M.some(b=>{try{return new q(b).match(R)}catch{return!1}}),k=p.some(b=>{try{return new q(b).match(R)}catch{return!1}});return _&&!k})}else{let u=F.some(p=>/[\(\)\|]|\.\*/.test(p)),w=[];if(!u)try{w=await Z(F,{cwd:x,ignore:f,dot:!0,onlyFiles:!0,absolute:!1})}catch{w=[]}if(w.length===0&&(u||Z.isDynamicPattern(i))){let p=i.match(/^([^\*\?\(\)\|\[\]\s]+)\//),M=p&&!/[\*\?\(\)\|\[\]]/.test(p[1])?z.resolve(x,p[1]):x,d=await O(M,E,x);try{let R=i.replace(/^\.\//,"");R=R.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!R.startsWith("^")&&!R.startsWith(".*")&&(R=`.*${R}`);let _=new RegExp(R.endsWith("$")?R:`${R}$`,"i");e=d.filter(k=>{let b=k.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{e=[]}}else e=w.map(p=>({fullPath:z.resolve(x,p),relativePath:p}))}}else{let i=[],F=!1,f=!1;for(let S of o){let u=S.replace(/[\/\\]+$/,""),w=z.resolve(x,u);try{let p=await K.stat(w);if(p.isDirectory()){f=!0;let M=await O(w,E,x);i.push(...M)}else if(p.isFile())F=!0,i.push({fullPath:w,relativePath:z.relative(x,w)});else return`ERROR: Path is neither a file nor a directory: ${S}`}catch{return`ERROR: Path not found: ${S}`}}e=i,F&&!f?h="file":h="dir"}}else e=await O(x,E);let J=e.map(async o=>{try{let y=await K.readFile(o.fullPath,"utf-8");if(y.includes("\0"))return[];let P=y.split(/\r?\n/),i=[];for(let f=0;f<P.length;f++)(W?P[f].toLowerCase().includes(t.toLowerCase())||tt(P[f],t):m?$&&$.test(P[f]):A&&A.test(P[f])||$&&$.test(P[f]))&&i.push({line:f+1,content:P[f].trim()});return i.length===0?null:{path:o.relativePath.replace(/\\/g,"/"),matches:i}}catch{return[]}}),Q=await Promise.all(J),D=[],C=0;for(let o of Q){if(!o||!o.matches)continue;if(C>=v)break;let y=v-C,P=o.matches.slice(0,y);D.push({path:o.path,matches:P}),C+=P.length}typeof global.gc=="function"&&global.gc();let G=W?"(fuzzy mode)":L?"(regex mode)":m?"(keyword mode)":"(standard mode)";if(D.length===0){let o=h==="file"?` in '${s}'`:h==="dir"||h==="glob"?` in '${s}'`:". Try to specify files",y=h==="dir"?"[DIR]":h==="glob"?"[GLOB]":"";return`${y}${y?" ":""}Found 0 matches of '${t}'${o}${G?` ${G}`:""}`}let N=G?` ${G}`:"",T=`${D.length} file${D.length===1?"":"s"}`,U=`${C} match${C===1?"":"es"}`,I;h==="file"?I=`Found ${U} of '${t}' in '${s}'${N}:`:h==="dir"||h==="glob"?I=`Found ${U} of '${t}' in '${s}' across ${T}${N}:`:I=`Found ${U} of '${t}' across ${T}${N}:`;let X=h==="dir"?"[DIR]":h==="glob"?"[GLOB]":"",B=`${X}${X?" ":""}${I}
|
|
2
|
+
|
|
3
|
+
`;for(let o of D){B+=`${o.path}
|
|
4
|
+
`;for(let y of o.matches)B+=` ${y.line}: ${y.content}
|
|
5
|
+
`;B+=`
|
|
6
|
+
`}return B.trimEnd()}catch(e){return`ERROR: ${e.message}`}};export{at as search_keyword};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-HM3CMNOJ.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{a as getAPIKey,b as getProviderAPIKey,f as getSearchSecrets,d as getSecret,k as removeAPIKey,j as removeSecret,g as saveAPIKey,c as saveProviderAPIKey,i as saveSearchId,h as saveSearchKey,e as saveSecret};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as C}from"./chunk-NL4MAQSB.js";import{a as T}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var W=async function*(M,m,S,k,_,O,b,N,v=1){let f=[];k&&f.push({role:"system",content:k});for(let s of S){let g=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let o of s.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,l=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${l}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}f.push({role:g,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let y=T("SenseNova",m,_),w=y!==null?y:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[_],x={model:m,messages:f,stream:!0,stream_options:{include_usage:!0},temperature:v,tools:[],tool_choice:"none"};w&&(x.reasoning_effort=w);let c=await C("https://token.sensenova.ai/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(x),signal:N});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`SenseNova Error (${c.status}): ${s.error?.message||c.statusText}`)}let E=c.body.getReader(),$=new TextDecoder,h="",t=[],r=null,p=Date.now(),a=!1;for(;;){let{done:s,value:g}=await E.read();if(s){a&&(t.length>0||r)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:r});break}h+=$.decode(g,{stream:!0});let e=h.split(`
|
|
2
|
+
`);h=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let l=!1;if(i==="data: [DONE]")l=!0;else try{let d=JSON.parse(i.substring(6)),u=d.choices?.[0]?.delta,n=d.usage;if(n&&(r={totalTokenCount:n.total_tokens||(n.prompt_tokens||0)+(n.completion_tokens||0),promptTokenCount:n.prompt_tokens||0,candidatesTokenCount:n.completion_tokens||0,cachedContentTokenCount:n.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:n.completion_tokens_details?.reasoning_tokens||n.reasoning_tokens||0},a=!0),u){let D=u.reasoning||u.reasoning_content||null;D&&(t.push({text:D,thought:!0}),a=!0),u.content&&(t.push({text:u.content}),a=!0)}}catch{}if((l||Date.now()-p>=150||r)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1),l)break}Date.now()-p>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:r},t=[],p=Date.now(),a=!1)}};export{W as getSenseNovaStream};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b}from"./chunk-
|
|
1
|
+
import{a,b}from"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{a as loadSettings,b as saveSettings};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as A}from"./chunk-NL4MAQSB.js";import{a as b}from"./chunk-JS5ZIGFR.js";import"./chunk-DSVLWYIT.js";var $=async function*(E,_,O,k,T,F,R,H,C=1){let g=[];k&&g.push({role:"system",content:k});for(let n of O){let m=n.role==="user"?"user":"assistant",t=[];if(Array.isArray(n.parts)){for(let o of n.parts)if(o.text)t.push({type:"text",text:o.text});else if(o.inlineData&&R){let i=o.inlineData.mimeType,p=o.inlineData.data;i.startsWith("image/")&&t.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let o=n.text||"";o&&t.push({type:"text",text:o})}g.push({role:m,content:t.length===1&&t[0].type==="text"?t[0].text:t})}let y=b("TokenHarbor",_,T),x=y!==null?y:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[T],w={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:C,tools:[],tool_choice:"none"};x&&(w.reasoning_effort=x);let M=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},N=E||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";D.Authorization=`Bearer ${N}`;let l=await A(M,{method:"POST",headers:D,body:JSON.stringify(w),signal:H});if(!l.ok){let n=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${n.error?.message||n.message||l.statusText}`)}let v=l.body.getReader(),B=new TextDecoder,h="",e=[],c=null,u=Date.now(),a=!1;for(;;){let{done:n,value:m}=await v.read();if(n){a&&(e.length>0||c)&&(yield{candidates:e.length>0?[{content:{parts:e}}]:[],usageMetadata:c});break}h+=B.decode(m,{stream:!0});let t=h.split(`
|
|
2
|
+
`);h=t.pop();for(let o of t){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let f=JSON.parse(i.substring(6)),r=f.choices?.[0]?.delta,s=f.usage;if(s&&(c={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),r){let d=r.reasoning_content||r.reasoning||null;!d&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(d=r.reasoning_details.map(K=>K.text||"").filter(Boolean).join("")),d&&(e.push({text:d,thought:!0}),a=!0),r.content&&(e.push({text:r.content}),a=!0)}}catch{}if((p||Date.now()-u>=150)&&a&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),a=!1),p)break}Date.now()-u>=150&&a&&(yield{candidates:e.length>0?[{content:{parts:[...e]}}]:[],usageMetadata:c},e=[],u=Date.now(),a=!1)}};export{$ as getTokenHarborStream};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as h,h as m,i as R}from"./chunk-6NWU3ML6.js";import{a as F}from"./chunk-FQBBOFNP.js";import{a as $}from"./chunk-Y5JU726N.js";import{a as g}from"./chunk-
|
|
1
|
+
import{g as h,h as m,i as R}from"./chunk-6NWU3ML6.js";import{a as F}from"./chunk-FQBBOFNP.js";import{a as $}from"./chunk-Y5JU726N.js";import{a as g}from"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";import c from"fs";import P from"path";var j=async(w,y={})=>{let n=$(w),t=n.path;if(!t)return'ERROR: Missing "path" argument for PatchFile.';let{patchPairs:o,allowMultiple:E,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 M=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":E,i=P.resolve(process.cwd(),t);try{if(!c.existsSync(i))return`ERROR: File [${t}] does not exist. Use WriteFile instead.`;let e=y.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:M}),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,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"./chunk-
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"./chunk-LKJUPSJM.js";import"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{k as addToUsage,q as checkImageQuota,n as checkQuota,m as checkQuotaDetailed,c as forceFlushUsage,t as getAllUsageData,l as getCustomPeriodUsage,g as getDailyUsage,o as getImageQuotaBuckets,p as getImageQuotaLimit,r as getImageQuotaStats,h as getMonthlyUsage,e as getTimedUsage,i as incrementUsage,f as initUsage,s as recordImageGeneration,d as recordTimedUsage,j as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk-PYZ4PPIR.js";import"./chunk-LKJUPSJM.js";import"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{b as openUsageDashboard,a as startUsageServer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as S}from"./chunk-FQBBOFNP.js";import{a as y}from"./chunk-Y5JU726N.js";import{a as R}from"./chunk-
|
|
1
|
+
import{a as S}from"./chunk-FQBBOFNP.js";import{a as y}from"./chunk-Y5JU726N.js";import{a as R}from"./chunk-ZLWYMCCW.js";import"./chunk-QWTKV7Q4.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";import r from"fs";import F from"path";var B=async(v,E={})=>{let{path:s,content:o}=y(v);if(!s)return'ERROR: Missing "path" argument for WriteFile.';if(o===void 0)return'ERROR: Missing "content" argument for WriteFile.';o=o.replace(/^```[\w]*\n?/,"").replace(/```\s*$/,"").replace(/\r\n/g,`
|
|
2
2
|
`).replace(/\r/g,`
|
|
3
3
|
`);let t=F.resolve(process.cwd(),s),m=F.dirname(t);try{await S.recordFileChange(t);let n="";if(r.existsSync(t))try{n=`Old File contents:
|
|
4
4
|
${r.readFileSync(t,"utf8").split(/\r?\n/).map((g,j)=>`${j+1} | ${g}`).join(`
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import{a as b}from"./chunks/chunk-DSVLWYIT.js";import{spawn as we}from"child_process";import{fileURLToPath as re}from"url";import he from"os";import j from"path";import T from"fs";import R from"dotenv";try{let t=j.join(b,"AGENTS.md"),f=j.join(b,"FLUXFLOW.md");T.existsSync(b)||T.mkdirSync(b,{recursive:!0}),T.existsSync(t)||T.writeFileSync(t,"","utf8"),T.existsSync(f)||T.writeFileSync(f,"","utf8")}catch{}R.config({path:"./.env",override:!0,quiet:!0});R.config({path:`${b}/.env`,override:!0,quiet:!0});R.config({path:`${b}/.env.agents`,override:!0,quiet:!0});R.config({path:`${b}/.env.fluxflow`,override:!0,quiet:!0});R.config({path:"./.env.agents",override:!0,quiet:!0});R.config({path:"./.env.fluxflow",override:!0,quiet:!0});process.env.NO_INS=!1;var ve=he.totalmem(),ne=ve/(1024*1024),ye=.5,Se=Math.floor(ne*ye),ie=process.argv.slice(2),se=ie.indexOf("--allocation"),u=se!==-1?parseInt(ie[se+1],10):NaN,be=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,Ce=!isNaN(u)||be||!1;!isNaN(u)&&u<64&&(console.error(`
|
|
3
3
|
[ERROR] Allocation value '${u} MB' is too low. Minimum: 64 MB, Recommended: 4096 MB.
|
|
4
4
|
`),process.exit(1));var U=Math.floor(ne*.75),$e=!isNaN(u)&&u>0?Math.min(u,U):Math.max(1536,Math.min(32768,Se)),Ae=re(import.meta.url).endsWith(".js");if(Ae&&!process.execArgv.some(t=>t.includes("max-old-space-size"))&&Ce)Number.isNaN(u)||(console.log(`
|
|
5
|
-
[MEMORY] Starting with: '${u>U?U:u} MB' Allocation${u>U?" (Max allowed: '"+U+" MB')":""}. Please Wait...`),await new Promise(f=>setTimeout(f,5e3))),we(process.execPath,[`--max-old-space-size=${$e}`,"--expose-gc","--max-semi-space-size=1",re(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",f=>process.exit(f||0));else{let t=process.argv.slice(2),f=t.includes("--help")&&t[t.indexOf("--help")+1]==="commands",K=t.includes("--help")&&!f,Q=t.includes("--version")||t.includes("-v"),Z=t[0]==="--update",ee=t[0]==="--export";if(t[0]==="--usage"||t.includes("--usage")||t[0]==="--budget"||t.includes("--budget")){let{openUsageDashboard:o}=await import("./chunks/usageServer-
|
|
5
|
+
[MEMORY] Starting with: '${u>U?U:u} MB' Allocation${u>U?" (Max allowed: '"+U+" MB')":""}. Please Wait...`),await new Promise(f=>setTimeout(f,5e3))),we(process.execPath,[`--max-old-space-size=${$e}`,"--expose-gc","--max-semi-space-size=1",re(import.meta.url),...process.argv.slice(2)],{stdio:"inherit"}).on("exit",f=>process.exit(f||0));else{let t=process.argv.slice(2),f=t.includes("--help")&&t[t.indexOf("--help")+1]==="commands",K=t.includes("--help")&&!f,Q=t.includes("--version")||t.includes("-v"),Z=t[0]==="--update",ee=t[0]==="--export";if(t[0]==="--usage"||t.includes("--usage")||t[0]==="--budget"||t.includes("--budget")){let{openUsageDashboard:o}=await import("./chunks/usageServer-AXINXVIN.js"),{url:m}=await o();console.log(`
|
|
6
6
|
\u2726 FluxFlow Token Usage & Analytics Dashboard
|
|
7
7
|
\u2800\u2800\u2514\u2500 Serving at: ${m}
|
|
8
8
|
\u2800\u2800\u2514\u2500 Opened in default browser. Press Ctrl+C to stop.
|
|
@@ -66,7 +66,7 @@ Usage: fluxflow --export error`),process.exit(1)}if(Q&&(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)),Z){let C=t[1]||"latest";if(C==="check"){let g=t[2]==="latest";try{let h=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;h||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(g?`Latest version: v${h}`:h!==n?`A new version of FluxFlow is available: v${h} (current: v${n}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${n}).`)}catch(l){console.error("Error checking for updates:",l.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let c=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;c||(console.error("Error: Could not retrieve latest version."),process.exit(1)),c===n&&(console.log(`FluxFlow is already up to date (v${n}).`),process.exit(0));let h=async()=>{let s=(await import("react")).default,{useState:N}=s,{render:_,Box:y,Text:S}=await import("ink"),D=(await import("ink-select-input")).default,E=(await import("ink-text-input")).default;return new Promise(W=>{let M=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:k,isSelected:F})=>s.createElement(y,{width:"100%"},s.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",k)),O,X=()=>{let[k,F]=N("select"),[z,J]=N(""),P=e=>{e.value==="custom"?F("custom"):B({manager:e.value})},L=e=>{B({manager:"custom",customCommand:e})};return k==="custom"?s.createElement(y,{flexDirection:"column",marginY:1},s.createElement(y,{marginBottom:1},s.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),s.createElement(y,{flexDirection:"row"},s.createElement(S,{color:"cyan",bold:!0}," \u276F "),s.createElement(E,{value:z,onChange:J,onSubmit:L})),s.createElement(y,{marginTop:1},s.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):s.createElement(y,{flexDirection:"column",marginY:1},s.createElement(y,{marginBottom:1},s.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),s.createElement(D,{items:M,onSelect:P,itemComponent:H,indicatorComponent:()=>null}))},B=k=>{O&&O(),W(k)},{unmount:V}=_(s.createElement(X,null));O=V})},i,$="",A;try{let{loadSettings:s}=await import("./chunks/settings-
|
|
69
|
+
/update latest Install latest release`),process.exit(0)),Z){let C=t[1]||"latest";if(C==="check"){let g=t[2]==="latest";try{let h=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;h||(console.error("Error: Could not retrieve latest version."),process.exit(1)),console.log(g?`Latest version: v${h}`:h!==n?`A new version of FluxFlow is available: v${h} (current: v${n}). Run "fluxflow --update latest" to upgrade.`:`FluxFlow is up to date (v${n}).`)}catch(l){console.error("Error checking for updates:",l.message),process.exit(1)}process.exit(0)}else if(C==="latest"){console.log("Checking latest version and settings...");try{let c=(await(await fetch("https://registry.npmjs.org/fluxflow-cli",{cache:"no-store"})).json())["dist-tags"]?.latest;c||(console.error("Error: Could not retrieve latest version."),process.exit(1)),c===n&&(console.log(`FluxFlow is already up to date (v${n}).`),process.exit(0));let h=async()=>{let s=(await import("react")).default,{useState:N}=s,{render:_,Box:y,Text:S}=await import("ink"),D=(await import("ink-select-input")).default,E=(await import("ink-text-input")).default;return new Promise(W=>{let M=[{label:"NPM",value:"npm"},{label:"PNPM",value:"pnpm"},{label:"Yarn",value:"yarn"},{label:"Bun",value:"bun"},{label:"Custom Command",value:"custom"}],H=({label:k,isSelected:F})=>s.createElement(y,{width:"100%"},s.createElement(S,{bold:F},"\u2514\u2500 ",F?"\x1B[32m\u25CF\x1B[0m":"\u25CB"," ",k)),O,X=()=>{let[k,F]=N("select"),[z,J]=N(""),P=e=>{e.value==="custom"?F("custom"):B({manager:e.value})},L=e=>{B({manager:"custom",customCommand:e})};return k==="custom"?s.createElement(y,{flexDirection:"column",marginY:1},s.createElement(y,{marginBottom:1},s.createElement(S,{color:"magenta",bold:!0},"\u{1F527} Enter custom update command:")),s.createElement(y,{flexDirection:"row"},s.createElement(S,{color:"cyan",bold:!0}," \u276F "),s.createElement(E,{value:z,onChange:J,onSubmit:L})),s.createElement(y,{marginTop:1},s.createElement(S,{color:"gray",dimColor:!0,italic:!0}," (Press Enter to confirm)"))):s.createElement(y,{flexDirection:"column",marginY:1},s.createElement(y,{marginBottom:1},s.createElement(S,{color:"magenta",bold:!0},"\u{1F4E6} Select a package manager for the update:")),s.createElement(D,{items:M,onSelect:P,itemComponent:H,indicatorComponent:()=>null}))},B=k=>{O&&O(),W(k)},{unmount:V}=_(s.createElement(X,null));O=V})},i,$="",A;try{let{loadSettings:s}=await import("./chunks/settings-RB45GKVI.js");A=await s(),i=A?.systemSettings?.updateManager||A?.updateManager}catch{}if(!i){let s=await h();i=s.manager,$=s.customCommand}let p="";i==="pnpm"?p=`pnpm add -g fluxflow-cli@${c}`:i==="bun"?p=`bun add -g fluxflow-cli@${c}`:i==="yarn"?p=`yarn global add fluxflow-cli@${c}`:i==="custom"?p=$||A?.customUpdateCommand||`npm install -g fluxflow-cli@${c}`:p=`npm install -g fluxflow-cli@${c}`,console.log(`Updating FluxFlow to v${c} using ${i}...`),console.log(`Running: ${p}`);let{execSync:v}=await import("child_process");v(p,{stdio:"inherit"}),console.log(`\x1B[32m\u2705 Update successful! FluxFlow updated to v${c}.\x1B[0m`)}catch(g){console.error("\x1B[31m\u274C Update failed:\x1B[0m",g.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:ae}=await import("react"),{render:le}=await import("ink"),{default:ce}=await import("./chunks/app-2JPMBSNL.js");process.env.NODE_NO_WARNINGS="1";let pe=["cuimp","Found existing binary","Binary verified","curl.exe not found","Falling back to .bat file","DeprecationWarning"],me=console.log,de=console.warn,ue=console.error,G=o=>{let m=o.map(String).join(" ");return pe.some(r=>m.includes(r))};console.log=(...o)=>!G(o)&&me(...o),console.warn=(...o)=>!G(o)&&de(...o),console.error=(...o)=>!G(o)&&ue(...o);let Y=t.findIndex(o=>o==="--cwd"||o==="--path");if(Y!==-1&&Y+1<t.length){let o=t[Y+1],m=await import("path"),r=await import("fs-extra"),d=m.default.resolve(o);try{r.default.existsSync(d)&&r.default.statSync(d).isDirectory()?process.chdir(d):(console.error(`[ERROR] Directory not found: "${o}"`),process.exit(0))}catch(x){console.error(`[ERROR] Failed to change directory to "${o}": ${x.message}`),process.exit(0)}}let I=t.includes("--commit_8f4a2b9c"),q=t.findIndex(o=>o==="-p"||o==="--prompt");if(q!==-1||I){let o=t.includes("--new")||t.includes("-n"),r=(q!==-1?t.slice(q+1).filter(e=>e!=="-n"&&e!=="--new"):[])[0];if(I)try{let{execSync:e}=await import("child_process"),a=e("git diff --cached",{encoding:"utf8",stdio:["ignore","pipe","pipe"]}).trim();a||process.exit(0),r=`Git Staged Diff:
|
|
70
70
|
${a}
|
|
71
71
|
---
|
|
72
72
|
|
|
@@ -78,7 +78,7 @@ ${r}`:r=n}if(!I&&!process.stdin.isTTY){let e=[];for await(let w of process.stdin
|
|
|
78
78
|
${a}
|
|
79
79
|
---
|
|
80
80
|
|
|
81
|
-
${r}`:r=a}}r||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-
|
|
81
|
+
${r}`:r=a}}r||(console.error("[ERROR] -p/--prompt requires a prompt string (or piped stdin input)."),process.exit(1));let{loadSettings:C}=await import("./chunks/settings-RB45GKVI.js"),{getProviderAPIKey:g}=await import("./chunks/secrets-4GLUJF7A.js"),{getDefaultModel:l}=await import("./chunks/model_config-YD5AWI33.js"),{generateSimpleContent:c}=await import("./chunks/ai-CANLJJ2L.js"),{checkQuotaDetailed:h}=await import("./chunks/usage-DWONGEYS.js"),i=await C(),$=t.filter(e=>e!=="-p"&&e!=="--prompt"&&e!==r&&e!=="-n"&&e!=="--new"),A=I||$.includes("--raw")||t.includes("--raw"),p=e=>{for(let a of e){let w=$.indexOf(a);if(w!==-1&&w+1<$.length)return $[w+1]}return null},v=p(["--provider"])||i.aiProvider||"Google",s=p(["--model"])||i.activeModel||l(v,i.apiTier)||l(v,"paid"),N=p(["--key"])||await g(v);N||(console.error(`[ERROR] No API key resolved for provider "${v}".`),process.exit(1));let _=await h("agent",{aiProvider:v});_.allowed||(console.error(`[ERROR] ${_.reason||"Budget Exhausted"} - adjust with /budget set.`),process.exit(1));let{name:y="",nickname:S="",instructions:D=""}=i?.profileData??{},E={aiProvider:v,apiKey:N,model:s,mode:"flow",thinkingLevel:p(["--thinking"])||"Fast",systemSettings:i.systemSettings||{}},W=process.platform==="win32"?"Windows":process.platform==="darwin"?"macOS":"Linux",M=new Date,H=M.getFullYear(),O=M.toLocaleString("en-US",{month:"short"}).toUpperCase(),X=String(M.getDate()).padStart(2,"0"),B=M.toLocaleTimeString([],{hour:"2-digit",hour12:!0}),V=`${H}-${O}-${X}, ${B}`,k=`Identity: FluxFlow. Sassy, CLI Assistant
|
|
82
82
|
Use NO markdown, only plain text
|
|
83
83
|
Additional Context:
|
|
84
84
|
- OS: ${W}
|
package/dist/model_config.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 0,
|
|
3
|
-
"release":
|
|
3
|
+
"release": 20261004,
|
|
4
4
|
"fallbacks": {
|
|
5
|
-
"janitor_default": "gemini-3.
|
|
5
|
+
"janitor_default": "gemini-3.5-flash-lite",
|
|
6
6
|
"janitor_attempts_fallback": "gemma-4-26b-a4b-it",
|
|
7
7
|
"janitor_open_router": "google/gemma-4-26b-a4b-it:free",
|
|
8
|
-
"general_fallback": "gemini-3.
|
|
8
|
+
"general_fallback": "gemini-3.5-flash-lite",
|
|
9
9
|
"deepseek_fast_fallback": "deepseek-v4-flash",
|
|
10
|
-
"deepseek_level_1": "deepseek-
|
|
11
|
-
"deepseek_level_2": "deepseek-
|
|
10
|
+
"deepseek_level_1": "deepseek-flash",
|
|
11
|
+
"deepseek_level_2": "deepseek-pro",
|
|
12
12
|
"mistral_janitor_fallback": "",
|
|
13
13
|
"mistral_level_1": "",
|
|
14
14
|
"nvidia_janitor_fallback": "mistralai/mistral-nemotron",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"poolside_fallback": "",
|
|
26
26
|
"9router_fallback": "",
|
|
27
27
|
"explabs_fallback": "",
|
|
28
|
-
"tokenharbor_fallback": ""
|
|
28
|
+
"tokenharbor_fallback": "",
|
|
29
|
+
"infron_fallback": ""
|
|
29
30
|
},
|
|
30
31
|
"providers": {}
|
|
31
32
|
}
|
package/dist/package.json
CHANGED
package/model_config.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 0,
|
|
3
|
-
"release":
|
|
3
|
+
"release": 20261004,
|
|
4
4
|
"fallbacks": {
|
|
5
|
-
"janitor_default": "gemini-3.
|
|
5
|
+
"janitor_default": "gemini-3.5-flash-lite",
|
|
6
6
|
"janitor_attempts_fallback": "gemma-4-26b-a4b-it",
|
|
7
7
|
"janitor_open_router": "google/gemma-4-26b-a4b-it:free",
|
|
8
|
-
"general_fallback": "gemini-3.
|
|
8
|
+
"general_fallback": "gemini-3.5-flash-lite",
|
|
9
9
|
"deepseek_fast_fallback": "deepseek-v4-flash",
|
|
10
|
-
"deepseek_level_1": "deepseek-
|
|
11
|
-
"deepseek_level_2": "deepseek-
|
|
10
|
+
"deepseek_level_1": "deepseek-flash",
|
|
11
|
+
"deepseek_level_2": "deepseek-pro",
|
|
12
12
|
"mistral_janitor_fallback": "",
|
|
13
13
|
"mistral_level_1": "",
|
|
14
14
|
"nvidia_janitor_fallback": "mistralai/mistral-nemotron",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"poolside_fallback": "",
|
|
26
26
|
"9router_fallback": "",
|
|
27
27
|
"explabs_fallback": "",
|
|
28
|
-
"tokenharbor_fallback": ""
|
|
28
|
+
"tokenharbor_fallback": "",
|
|
29
|
+
"infron_fallback": ""
|
|
29
30
|
},
|
|
30
31
|
"providers": {}
|
|
31
32
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{A as p,B as q,C as r,D as s,E as t,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-KA7IQD5D.js";import"./chunk-56EJGQU3.js";import"./chunk-7SFAWGE2.js";import"./chunk-U2NRX2PX.js";import"./chunk-VYTQ6J56.js";import"./chunk-RZTZPIC5.js";import"./chunk-6NWU3ML6.js";import"./chunk-FQBBOFNP.js";import"./chunk-Y5JU726N.js";import"./chunk-3CZWTXIR.js";import"./chunk-4XXLWMY6.js";import"./chunk-GRQ7JZZP.js";import{k as a}from"./chunk-OSDQRSY6.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{c as RE_LEADING_THINK,q as compressHistory,b as convertChannelThinkTags,r as deleteChatSummary,e as findGenuineThinkClose,p as generateSimpleContent,s as getAIStream,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,o as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,n as runJanitorTask,t as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as E,d as _}from"./chunk-L3W2X74K.js";import{e as s}from"./chunk-DSVLWYIT.js";import I from"fs-extra";import l from"path";var a=l.join(s,"secrets.json"),f=async()=>{try{let t=E(a,{});if(t.API_KEY)return t.API_KEY}catch{}return null},o=async t=>{try{let e=E(a,{});if(t==="Google")return e.GOOGLE_API_KEY||e.API_KEY||null;if(t==="DeepSeek")return e.DEEPSEEK_API_KEY||null;if(t==="OpenRouter")return e.OPENROUTER_API_KEY||null;if(t==="Mistral")return e.MISTRAL_API_KEY||null;if(t==="NVIDIA")return e.NVIDIA_API_KEY||null;if(t==="Ollama")return e.OLLAMA_API_KEY||"LOCAL";if(t==="InferX")return e.INFERX_API_KEY||null;if(t==="SenseNova"||t==="Sensenova")return e.SENSENOVA_API_KEY||null;if(t==="Poolside"||t==="poolside")return e.POOLSIDE_API_KEY||null;if(t==="9router"||t==="9Router")return e["9ROUTER_API_KEY"]||"LOCAL";if(t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs")return e.EXPLABS_API_KEY||e.EXPERIENTIALLABS_API_KEY||null;if(t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk")return e.TOKENHARBOR_API_KEY||e.TOKEN_HARBOR_API_KEY||null;if(t==="APInex"||t==="apinex"||t==="apx")return e.APINEX_API_KEY||null}catch{}return null},O=async(t,e)=>{t==="Google"?(await n("GOOGLE_API_KEY",e),await n("API_KEY",e)):t==="DeepSeek"?await n("DEEPSEEK_API_KEY",e):t==="OpenRouter"?await n("OPENROUTER_API_KEY",e):t==="Mistral"?await n("MISTRAL_API_KEY",e):t==="NVIDIA"?await n("NVIDIA_API_KEY",e):t==="Ollama"?await n("OLLAMA_API_KEY",e):t==="InferX"?await n("INFERX_API_KEY",e):t==="SenseNova"||t==="Sensenova"?await n("SENSENOVA_API_KEY",e):t==="Poolside"||t==="poolside"?await n("POOLSIDE_API_KEY",e):t==="9router"||t==="9Router"?await n("9ROUTER_API_KEY",e):t==="ExpLabs"||t==="ExperientialLabs"||t==="ExperimentalLabs"||t==="explabs"?await n("EXPLABS_API_KEY",e):t==="TokenHarbor"||t==="Token Harbor"||t==="tokenharbor"||t==="token_harbor"||t==="thk"?await n("TOKENHARBOR_API_KEY",e):(t==="APInex"||t==="apinex"||t==="apx")&&await n("APINEX_API_KEY",e)},r=async t=>{try{return E(a,{})[t]||null}catch{return null}},n=async(t,e)=>{await I.ensureDir(s);let A=E(a,{});A[t]=e,_(a,A,!0)},S=async()=>{try{let t=E(a,{});return{key:t.GOOGLE_API_KEY||t.API_KEY,cx:t.SEARCH_ID}}catch{}return{key:null,cx:null}},R=async t=>n("API_KEY",t),x=async t=>n("GOOGLE_API_KEY",t),L=async t=>n("SEARCH_ID",t),P=async t=>{try{let e=E(a,{});delete e[t],_(a,e,!0)}catch{}},N=async()=>P("API_KEY");export{f as a,o as b,O as c,r as d,n as e,S as f,R as g,x as h,L as i,P as j,N as k};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as u}from"./chunk-OSDQRSY6.js";import{e as m,f as c}from"./chunk-L3W2X74K.js";import{b as s}from"./chunk-DSVLWYIT.js";import n from"fs-extra";import g from"path";var r={mode:"Flux",display:0,thinkingLevel:"Medium",aiProvider:"Google",activeModel:u("Google","Free")||"gemma-4-31b-it",showFullThinking:!0,apiTier:"Free",quotas:{agentLimit:999999,backgroundLimit:999999,searchLimit:100,customModelId:"",customLimit:0,providerTiers:{Google:"Free",DeepSeek:"Free",NVIDIA:"Free",OpenRouter:"Free",InferX:"Free",SenseNova:"Free",Poolside:"Free",ExpLabs:"Free",TokenHarbor:"Free",APInex:"Free"}},systemSettings:{memory:!1,theme:"Dark",compression:0,autoExec:!0,allowExternalAccess:!1,advanceRollback:!1,autoDeleteHistory:"7d",useExternalData:!1,externalDataPath:"",preserveThinking:!0,loadingPhrases:!0,progressiveRendering:!0,showTPMEstimate:!0,subAgents:!1,CustomSubAgent:!1,SubAgentModel:"Default",SubAgentProvider:"",dynamicDirAwareness:!1,indentationTree:!0,ollamaEndpoint:"Cloud",compressToolResults:!1,autoTruncateResults:!0,imageHistoryCU:"Standard",contextLength:"256k",keepReasoningContext:!1,autoExcludeMetadata:!1,disableTodo:!1},profileData:{name:null,nickname:null,instructions:null},imageSettings:{keyType:"Default",quality:"Low-High",apiKey:""}},S=async()=>{let t={...r};try{if(await n.exists(s)){let e=m(s);if(e.imageSettings&&e.imageSettings.apiKey)try{let a=e.imageSettings.apiKey,{saveSecret:i}=await import("./secrets-LPVNWDTB.js");await i("POLLINATIONS_API_KEY",a),e.imageSettings.apiKey="",c(s,e)}catch{}t={...r,...e,quotas:{...r.quotas,...e.quotas,providerTiers:{...r.quotas.providerTiers,...e.quotas?.providerTiers||{}}},systemSettings:{...r.systemSettings,...e.systemSettings},profileData:{...r.profileData,...e.profileData},imageSettings:{...r.imageSettings,...e.imageSettings}}}}catch(e){console.error("Failed to load settings:",e)}try{let{getSecret:e}=await import("./secrets-LPVNWDTB.js"),a=await e("POLLINATIONS_API_KEY");a&&(t.imageSettings.apiKey=a)}catch{}if(t.showFullThinking===!1){t.showFullThinking=!0;try{c(s,t)}catch{}}return t},f=async t=>{let{FLUXFLOW_DIR:e}=await import("./paths-2EXHWUSL.js"),a=["logs","secret"];for(let i of a){let l=g.join(e,i),o=g.join(t,i);try{await n.exists(l)&&(await n.ensureDir(o),await n.copy(l,o,{overwrite:!0}))}catch(d){console.error(`Migration failed for ${i}:`,d)}}},D=async t=>{try{let e=await S();if(!e.systemSettings.useExternalData&&t.systemSettings?.useExternalData&&t.systemSettings?.externalDataPath&&await f(t.systemSettings.externalDataPath),t.imageSettings&&t.imageSettings.apiKey!==void 0){let{saveSecret:i,removeSecret:l}=await import("./secrets-LPVNWDTB.js"),o=t.imageSettings.apiKey;o?await i("POLLINATIONS_API_KEY",o):await l("POLLINATIONS_API_KEY")}let a={...e,...t};return a.systemSettings&&(a.systemSettings.dynamicDirAwareness=!1),a.imageSettings&&(a.imageSettings={...a.imageSettings,apiKey:""}),await n.ensureDir(g.dirname(s)),c(s,a),!0}catch(e){return console.error("Failed to save settings:",e),!1}};export{S as a,D as b};
|