fluxflow-cli 4.35.1 → 4.36.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.
Files changed (36) hide show
  1. package/dist/chunks/{ai-2KKP7NFF.js → ai-DUQ7JTFT.js} +1 -1
  2. package/dist/chunks/app-3RT5WIFW.js +322 -0
  3. package/dist/chunks/{chunk-KHJAWDBM.js → chunk-ARVJHIPP.js} +1 -1
  4. package/dist/chunks/{chunk-H4KXMWYP.js → chunk-EKTQJIFL.js} +1 -1
  5. package/dist/chunks/chunk-HWQD4HC4.js +13 -0
  6. package/dist/chunks/chunk-NJADNSYK.js +1 -0
  7. package/dist/chunks/chunk-NXGWQV2R.js +1 -0
  8. package/dist/chunks/{chunk-VMFH7MSG.js → chunk-PUCRX3HD.js} +206 -206
  9. package/dist/chunks/{click-PN3BLFOY.js → click-YDLHTDEK.js} +2 -2
  10. package/dist/chunks/{computer_action-VMC545YJ.js → computer_action-2JLV6MY4.js} +1 -1
  11. package/dist/chunks/{drag-NMHO3BAW.js → drag-PUEGJCAB.js} +1 -1
  12. package/dist/chunks/{generate_image-ZNBMY2PT.js → generate_image-L2LXNTNE.js} +1 -1
  13. package/dist/chunks/halloween-MX3VNQRW.js +1 -0
  14. package/dist/chunks/{invoke-QP4USBCP.js → invoke-7S44ZFQY.js} +2 -2
  15. package/dist/chunks/{invokeSync-UHGKK3NF.js → invokeSync-SAKOE3G5.js} +2 -2
  16. package/dist/chunks/{key_press-RJIPXDAB.js → key_press-KR2O7S6E.js} +1 -1
  17. package/dist/chunks/{keyboard_typing-VXT53PRV.js → keyboard_typing-V4ALD3BD.js} +1 -1
  18. package/dist/chunks/{mistral-N6352JPY.js → mistral-O5VGMA23.js} +1 -1
  19. package/dist/chunks/model_config-C72R7DKL.js +1 -0
  20. package/dist/chunks/{nvidia-L6QMFBL3.js → nvidia-OVQSNJOT.js} +1 -1
  21. package/dist/chunks/{screen_grid-PMTAQA3B.js → screen_grid-XZKZBWOH.js} +1 -1
  22. package/dist/chunks/{scroll-OMBQDZHP.js → scroll-YTLIQ6C5.js} +1 -1
  23. package/dist/chunks/{settings-Q5OBKUO6.js → settings-LO76WAO4.js} +1 -1
  24. package/dist/chunks/{update_file-BD3AWZNQ.js → update_file-HGCNRGTK.js} +1 -1
  25. package/dist/chunks/usage-MHRBABMW.js +1 -0
  26. package/dist/chunks/{usageServer-SQHTSGOH.js → usageServer-YSHTV2E3.js} +52 -11
  27. package/dist/chunks/{write_file-AMAYRCUC.js → write_file-A67UXLZ2.js} +1 -1
  28. package/dist/cli.js +3 -3
  29. package/dist/package.json +2 -2
  30. package/package.json +2 -2
  31. package/dist/chunks/app-JERPNQ7V.js +0 -315
  32. package/dist/chunks/chunk-63V6P5DU.js +0 -1
  33. package/dist/chunks/chunk-KZTDLEUL.js +0 -1
  34. package/dist/chunks/chunk-X6YW3TVC.js +0 -12
  35. package/dist/chunks/model_config-EN3OYDPU.js +0 -1
  36. package/dist/chunks/usage-OUCURLG4.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as z}from"./chunk-KHJAWDBM.js";import{f as U}from"./chunk-H4KXMWYP.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-PMTAQA3B.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
+ import{a as z}from"./chunk-ARVJHIPP.js";import{f as U}from"./chunk-EKTQJIFL.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-XZKZBWOH.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-KHJAWDBM.js";import"./chunk-H4KXMWYP.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};
1
+ import{a as i,b as s}from"./chunk-ARVJHIPP.js";import"./chunk-EKTQJIFL.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};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-KHJAWDBM.js";import"./chunk-H4KXMWYP.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};
1
+ import{a as e}from"./chunk-ARVJHIPP.js";import"./chunk-EKTQJIFL.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};
@@ -1 +1 @@
1
- import{a as k}from"./chunk-FQBBOFNP.js";import{a as b}from"./chunk-Y5JU726N.js";import{s as B,t as T,u as $}from"./chunk-X6YW3TVC.js";import{a as I}from"./chunk-KZTDLEUL.js";import"./chunk-63V6P5DU.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};
1
+ import{a as k}from"./chunk-FQBBOFNP.js";import{a as b}from"./chunk-Y5JU726N.js";import{t as B,u as T,v as $}from"./chunk-HWQD4HC4.js";import{a as I}from"./chunk-NXGWQV2R.js";import"./chunk-NJADNSYK.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 @@
1
+ var e=[" \u2584\u2588\u2588\u2584 "," \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2584 "," \u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 "," \u2588\u2588\u2588\u2588 \u2588\u2588 \u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 \u2588\u2588 \u2588\u2588 "," \u2580\u2580 \u2580\u2580 \u2580\u2580 "],o=[" \u2584\u2588\u2588\u2584 "," \u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2584 "," \u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 "," \u2588\u2588\u2588 \u2588\u2588 \u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588 \u2588\u2588 \u2588\u2588 "," \u2580\u2580 \u2580\u2580 \u2580\u2580 "],t=[" "," \u2584\u2588\u2584 \u2584\u2588\u2584 "," \u2588\u2588\u2588\u2588\u2584 \u2584\u2588 \u2588\u2584 \u2584\u2588\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584\u2588\u2588\u2584\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 "," \u2580\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2580 "," \u2580\u2588\u2588\u2588\u2588\u2580 \u2580\u2580\u2580\u2580 \u2580\u2588\u2588\u2588\u2588\u2580 "," \u2580\u2580 \u2580\u2580 "," "];export{e as halloweenArtSide,o as halloweenArtUser,t as halloweenBat};
@@ -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-2KKP7NFF.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}"
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-DUQ7JTFT.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-2KKP7NFF.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};
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-DUQ7JTFT.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-2KKP7NFF.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-2KKP7NFF.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}
1
+ import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-DUQ7JTFT.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-DUQ7JTFT.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-KHJAWDBM.js";import"./chunk-H4KXMWYP.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
+ import{b as e}from"./chunk-ARVJHIPP.js";import"./chunk-EKTQJIFL.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-KHJAWDBM.js";import"./chunk-H4KXMWYP.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};
1
+ import{b as n}from"./chunk-ARVJHIPP.js";import"./chunk-EKTQJIFL.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};
@@ -1,2 +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-63V6P5DU.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(`
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-NJADNSYK.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
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};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-NJADNSYK.js";import"./chunk-DSVLWYIT.js";export{a as DEFAULT_MODEL_CONFIG,o as getDefaultModel,q as getFallbackValue,b as getModelConfig,p as getModelPricing,n as getModels,m as hasModelReasoning,l as isModelMultimodal,h as removeModelFromProvider,i as renameModelInProvider,c as saveModelConfigToDisk,d as saveModelToProvider,j as setCustomMultimodal,g as setDefaultModelForProvider,f as setModelMultimodalInProvider,k as setOllamaMultimodal,e as updateModelInfoInProvider};
@@ -1,2 +1,2 @@
1
- import{a as j}from"./chunk-NL4MAQSB.js";import{a as W}from"./chunk-JS5ZIGFR.js";import{k as K}from"./chunk-63V6P5DU.js";import"./chunk-DSVLWYIT.js";var ue=async function*(M,e,k,c,g,D,w=!1,I,H=1){let A=[];c&&A.push({role:"system",content:c}),k.forEach(i=>{let N=i.role==="model"?"assistant":"user",d=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)d.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)&&d.push({type:"image_url",image_url:{url:`data:${r};base64,${f}`}})}}),A.push({role:N,content:d.length===1&&d[0].type==="text"?d[0].text:d})});let T=W("NVIDIA",e,g),t=T!==null?T:{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"),P=e.includes("minimax"),J=e.includes("gpt"),Y=e.includes("qwen"),Q=e.includes("nemotron"),X=e.includes("llama-3"),Z=e.includes("seed"),B=e.includes("poolside"),C=e.includes("thinkingmachines")||e.includes("muse"),ee=X,te={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},se={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},ne={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=P||h||B||C?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none",...J&&{thinking:te[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||ee))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":P&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:Y?a.chat_template_kwargs={enable_thinking:o}:Q?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}:Z?o&&(a.extra_body={thinking_budget:parseInt(se[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=ne[t]||"medium");let V=0,G=6,$=!1,R=(process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1").trim(),v=R.replace(/\/+$/,"");if(!v.endsWith("/v1")&&!v.endsWith("/v1/chat/completions"))throw new Error(`Invalid NVIDIA Base URL: "${R}". Endpoint URL MUST end with /v1 (e.g. https://integrate.api.nvidia.com/v1 or http://.../v1).`);let ae=v.endsWith("/chat/completions")?v:`${v}/chat/completions`,ie=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:M;for(;V<G;){V++;try{let i=await j(ae,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ie}`},body:JSON.stringify(a),signal:I});if(!i.ok){let x=await i.text().catch(()=>""),S=i.statusText;try{let m=JSON.parse(x);S=m.error?.message||m.message||JSON.stringify(m.detail||m)}catch{x&&(S=x)}let b=new Error(`NVIDIA API Error (${i.status}): ${S}`);throw b.status=i.status,b}let N=i.body.getReader(),d=new TextDecoder,u="",r=[],f=null,q=Date.now(),_=!1;for(;;){let{done:x,value:S}=await N.read();if(x){_&&(r.length>0||f)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:f},$=!0);break}u+=d.decode(S,{stream:!0});let b=u.split(`
1
+ import{a as j}from"./chunk-NL4MAQSB.js";import{a as W}from"./chunk-JS5ZIGFR.js";import{l as K}from"./chunk-NJADNSYK.js";import"./chunk-DSVLWYIT.js";var ue=async function*(M,e,k,c,g,D,w=!1,I,H=1){let A=[];c&&A.push({role:"system",content:c}),k.forEach(i=>{let N=i.role==="model"?"assistant":"user",d=[];Array.isArray(i.parts)&&i.parts.forEach(u=>{if(u.text)d.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)&&d.push({type:"image_url",image_url:{url:`data:${r};base64,${f}`}})}}),A.push({role:N,content:d.length===1&&d[0].type==="text"?d[0].text:d})});let T=W("NVIDIA",e,g),t=T!==null?T:{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"),P=e.includes("minimax"),J=e.includes("gpt"),Y=e.includes("qwen"),Q=e.includes("nemotron"),X=e.includes("llama-3"),Z=e.includes("seed"),B=e.includes("poolside"),C=e.includes("thinkingmachines")||e.includes("muse"),ee=X,te={Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},se={Fast:"64",Low:"64",Medium:"4096",Standard:"4096",High:"16384",xHigh:"16384"},ne={Fast:"none",Low:"minimal",Medium:"medium",Standard:"medium",High:"max",xHigh:"max"},U=P||h||B||C?16384:32768;U=process.env.NVIDIA_BASE_URL?1024:U;let a={model:e,messages:A,max_tokens:U,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none",...J&&{thinking:te[g]||"high"}};if(!(process.env.NVIDIA_BASE_URL||ee))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":P&&e.includes("minimax-m3")?a.chat_template_kwargs={thinking_mode:o?"enabled":"disabled"}:Y?a.chat_template_kwargs={enable_thinking:o}:Q?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}:Z?o&&(a.extra_body={thinking_budget:parseInt(se[t]??"4096")}):B?a.chat_template_kwargs={enable_thinking:o}:C&&(a.reasoning_effort=ne[t]||"medium");let V=0,G=6,$=!1,R=(process.env.NVIDIA_BASE_URL||"https://integrate.api.nvidia.com/v1").trim(),v=R.replace(/\/+$/,"");if(!v.endsWith("/v1")&&!v.endsWith("/v1/chat/completions"))throw new Error(`Invalid NVIDIA Base URL: "${R}". Endpoint URL MUST end with /v1 (e.g. https://integrate.api.nvidia.com/v1 or http://.../v1).`);let ae=v.endsWith("/chat/completions")?v:`${v}/chat/completions`,ie=process.env.NVIDIA_API_KEY&&process.env.NVIDIA_BASE_URL?process.env.NVIDIA_API_KEY:M;for(;V<G;){V++;try{let i=await j(ae,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ie}`},body:JSON.stringify(a),signal:I});if(!i.ok){let x=await i.text().catch(()=>""),S=i.statusText;try{let m=JSON.parse(x);S=m.error?.message||m.message||JSON.stringify(m.detail||m)}catch{x&&(S=x)}let b=new Error(`NVIDIA API Error (${i.status}): ${S}`);throw b.status=i.status,b}let N=i.body.getReader(),d=new TextDecoder,u="",r=[],f=null,q=Date.now(),_=!1;for(;;){let{done:x,value:S}=await N.read();if(x){_&&(r.length>0||f)&&(yield{candidates:r.length>0?[{content:{parts:r}}]:[],usageMetadata:f},$=!0);break}u+=d.decode(S,{stream:!0});let b=u.split(`
2
2
  `);u=b.pop();let m=!1;for(let oe of b){let E=oe.trim();if(E){if(E==="data: [DONE]"){m=!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((m||Date.now()-q>=350)&&_&&(yield{candidates:r.length>0?[{content:{parts:[...r]}}]:[],usageMetadata:f},$=!0,r=[],q=Date.now(),_=!1),m)break}break}catch(i){if($||V>=G)throw i;await new Promise(N=>setTimeout(N,3500))}}},he=async function*(M,e){let k=[],c=null,g=!1,D=null,w=s=>{if(k.push(s),c){let n=c;c=null,n()}},I=e.split("/").pop(),H=Array.from(new Set([I,I.replace(/\./g,"-"),I.replace(/\./g,"_")])),T=["https://buildapi.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy","https://api.ngc.nvidia.com/v2/predict/queues/models/qc69jvmznzxy"].flatMap(s=>H.map(n=>`${s}/${n}`)),L=!1,t=null,o=async()=>{try{let n=await(await Promise.any(T.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=M[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(D=s,t&&(clearInterval(t),t=null),c){let n=c;c=null,n()}}})();try{for(;;){if(D)throw D;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{ue as getNVIDIAStream,he as wrapNvidiaStreamWithQueueDepth};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g}from"./chunk-H4KXMWYP.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
+ import{a,b,c,d,e,f,g}from"./chunk-EKTQJIFL.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-KHJAWDBM.js";import"./chunk-H4KXMWYP.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};
1
+ import{a as r}from"./chunk-ARVJHIPP.js";import"./chunk-EKTQJIFL.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};
@@ -1 +1 @@
1
- import{a,b}from"./chunk-KZTDLEUL.js";import"./chunk-63V6P5DU.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{a as loadSettings,b as saveSettings};
1
+ import{a,b}from"./chunk-NXGWQV2R.js";import"./chunk-NJADNSYK.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{a as loadSettings,b as saveSettings};
@@ -1,4 +1,4 @@
1
- import{g as h,h as m,i as R}from"./chunk-4MDSKJGX.js";import{a as F}from"./chunk-FQBBOFNP.js";import{a as $}from"./chunk-Y5JU726N.js";import{a as g}from"./chunk-KZTDLEUL.js";import"./chunk-63V6P5DU.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,`
1
+ import{g as h,h as m,i as R}from"./chunk-4MDSKJGX.js";import{a as F}from"./chunk-FQBBOFNP.js";import{a as $}from"./chunk-Y5JU726N.js";import{a as g}from"./chunk-NXGWQV2R.js";import"./chunk-NJADNSYK.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(`
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./chunk-HWQD4HC4.js";import"./chunk-NXGWQV2R.js";import"./chunk-NJADNSYK.js";import"./chunk-L3W2X74K.js";import"./chunk-DSVLWYIT.js";export{n as addToUsage,c as calculateTokenCost,t as checkImageQuota,q as checkQuota,p as checkQuotaDetailed,e as forceFlushUsage,w as getAllUsageData,o as getCustomPeriodUsage,j as getDailyUsage,r as getImageQuotaBuckets,s as getImageQuotaLimit,u as getImageQuotaStats,k as getMonthlyUsage,h as getTimedUsage,l as incrementUsage,i as initUsage,d as invalidateCachedBaseUrl,g as purgeTimedUsage,v as recordImageGeneration,f as recordTimedUsage,m as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};