fluxflow-cli 5.4.0 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/chunks/{9router-KRJQK6JP.js → 9router-XV5L5RWA.js} +1 -1
  2. package/dist/chunks/{addMemScore-VUSJ2Q64.js → addMemScore-U2KYMALL.js} +1 -1
  3. package/dist/chunks/{ai-5JYZZ6PM.js → ai-TVKJMVCH.js} +1 -1
  4. package/dist/chunks/{aihubmix-KJIG7CZO.js → aihubmix-5XK2DFNJ.js} +1 -1
  5. package/dist/chunks/{apinex-EP3JJPZO.js → apinex-COGJR7W4.js} +1 -1
  6. package/dist/chunks/{app-S5Y2PD6U.js → app-HBLCJLMN.js} +128 -128
  7. package/dist/chunks/{auto_completion-UFHKJGZC.js → auto_completion-SGFPH6MP.js} +1 -1
  8. package/dist/chunks/{chat-OYRESDTX.js → chat-V5FZDYET.js} +1 -1
  9. package/dist/chunks/{chunk-KOCMIEPK.js → chunk-2RTYI6K3.js} +1 -1
  10. package/dist/chunks/{chunk-25EUCCH5.js → chunk-3HGLLXBK.js} +1 -1
  11. package/dist/chunks/{chunk-XRTIQISS.js → chunk-3SMC2C3F.js} +1 -1
  12. package/dist/chunks/{chunk-L22YGL6T.js → chunk-4PTLFXTU.js} +1 -1
  13. package/dist/chunks/{chunk-XAPXZ6KO.js → chunk-5MJKHQVE.js} +1 -1
  14. package/dist/chunks/{chunk-46PS7WA4.js → chunk-AUXKQKSZ.js} +5 -5
  15. package/dist/chunks/{chunk-E5CFO23P.js → chunk-FMKFTJB3.js} +1 -1
  16. package/dist/chunks/{chunk-7CCULUZN.js → chunk-IWIVGFAT.js} +1 -1
  17. package/dist/chunks/{chunk-KIPZOUEA.js → chunk-JMMO76HS.js} +1 -1
  18. package/dist/chunks/{chunk-UMS5SEYB.js → chunk-KQNW7DK5.js} +1 -1
  19. package/dist/chunks/{chunk-BLAXTPPN.js → chunk-NJTM7OYZ.js} +1 -1
  20. package/dist/chunks/{chunk-YFIWMGCS.js → chunk-NPXJIGAI.js} +2 -2
  21. package/dist/chunks/{chunk-XPIXBWTZ.js → chunk-UM5SNZ6X.js} +1 -1
  22. package/dist/chunks/{chunk-QVRPR3DJ.js → chunk-VOUGMIAJ.js} +1 -1
  23. package/dist/chunks/{chunk-75OCC24T.js → chunk-Y6O7SAPD.js} +1 -1
  24. package/dist/chunks/{chunk-NTZSL2UT.js → chunk-ZGORMZE5.js} +1 -1
  25. package/dist/chunks/{chunk-VDO5TP6E.js → chunk-ZPSNXBWW.js} +1 -1
  26. package/dist/chunks/{click-3BB6KDIJ.js → click-WWAFZ4BZ.js} +2 -2
  27. package/dist/chunks/{computer_action-6RHVNLZG.js → computer_action-B6QH77NT.js} +1 -1
  28. package/dist/chunks/{custom_openai-ODYQEMOR.js → custom_openai-JUCNWDKV.js} +1 -1
  29. package/dist/chunks/{deepseek-I2J4A7WQ.js → deepseek-5FL3MI6P.js} +1 -1
  30. package/dist/chunks/{drag-ZGNVQGXW.js → drag-3VRYDGVU.js} +1 -1
  31. package/dist/chunks/{emergency_rollback-LC4ZBOLP.js → emergency_rollback-J3SMQXBP.js} +2 -2
  32. package/dist/chunks/{explabs-OYP64XS6.js → explabs-WJXK6SEY.js} +1 -1
  33. package/dist/chunks/{export-I5DB7ESY.js → export-MCZIN2ZJ.js} +1 -1
  34. package/dist/chunks/{file_map-K6JQYV35.js → file_map-U6SWDUPK.js} +1 -1
  35. package/dist/chunks/{find_file-5RUNVQJO.js → find_file-GBEBP5NZ.js} +1 -1
  36. package/dist/chunks/{generate_image-7UBJ3ODS.js → generate_image-2JIYAW5L.js} +1 -1
  37. package/dist/chunks/{inferx-B6PKXWLZ.js → inferx-5Q36576Q.js} +1 -1
  38. package/dist/chunks/{infron-4SLX3HMD.js → infron-KCX7Z3RE.js} +1 -1
  39. package/dist/chunks/{invoke-5S7NCXAS.js → invoke-JSHBXNXZ.js} +2 -2
  40. package/dist/chunks/{invokeSync-6TXH6V5Q.js → invokeSync-NP7Z3LUE.js} +2 -2
  41. package/dist/chunks/{key_press-LO75QEJK.js → key_press-J2ZSWOT2.js} +1 -1
  42. package/dist/chunks/{keyboard_typing-DJ3HHTO7.js → keyboard_typing-FFC7OTDM.js} +1 -1
  43. package/dist/chunks/{memory-AT7ARTG3.js → memory-QTLQAFG7.js} +1 -1
  44. package/dist/chunks/{mistral-H23J6UYA.js → mistral-WTUJY4U7.js} +1 -1
  45. package/dist/chunks/{model_config-IVWGOIBK.js → model_config-OPJXDFKG.js} +1 -1
  46. package/dist/chunks/{nvidia-BUWXTYGV.js → nvidia-I35DUUDV.js} +1 -1
  47. package/dist/chunks/{ollama-SMYO5EJG.js → ollama-BJHC4S6H.js} +1 -1
  48. package/dist/chunks/{openrouter-LSG67TST.js → openrouter-WKGHI2OP.js} +1 -1
  49. package/dist/chunks/{paths-MJECGRI2.js → paths-4NQOSFLK.js} +1 -1
  50. package/dist/chunks/{poolside-KWCBEP3P.js → poolside-F6QS6ZMC.js} +1 -1
  51. package/dist/chunks/{recapture_screen-LONV6G4U.js → recapture_screen-P7YVVVSF.js} +1 -1
  52. package/dist/chunks/{saveSummary-ZJDPCZSR.js → saveSummary-CVZIOQ4L.js} +1 -1
  53. package/dist/chunks/{screen_grid-LK6IVH4B.js → screen_grid-Z5JHZZKA.js} +1 -1
  54. package/dist/chunks/{scroll-XBXSN2EF.js → scroll-GBV6YRQT.js} +1 -1
  55. package/dist/chunks/{search_keyword-IRLPX555.js → search_keyword-KE5VBMVA.js} +1 -1
  56. package/dist/chunks/{secrets-LHP6ATGQ.js → secrets-OHIQHB63.js} +1 -1
  57. package/dist/chunks/{secrets_v2-4ZICSEV6.js → secrets_v2-W4225MDM.js} +1 -1
  58. package/dist/chunks/{sensenova-MLFZTP7U.js → sensenova-QE73BOHI.js} +1 -1
  59. package/dist/chunks/settings-Y7ODX5TH.js +1 -0
  60. package/dist/chunks/{todo-YFLPXYFL.js → todo-ZFQ6BQVI.js} +1 -1
  61. package/dist/chunks/{tokenharbor-Y6HSTTHA.js → tokenharbor-2TAFOMPU.js} +1 -1
  62. package/dist/chunks/{update_file-CH6YILXO.js → update_file-C5HRYCQN.js} +1 -1
  63. package/dist/chunks/{usage-G7HRNQNU.js → usage-3CNTEZUA.js} +1 -1
  64. package/dist/chunks/{usageServer-SHBKSO4I.js → usageServer-7NPU35BP.js} +1 -1
  65. package/dist/chunks/view_file-PEZ7HS36.js +1 -0
  66. package/dist/chunks/{web_scrape-MVSCRDKO.js → web_scrape-SJBA3RQF.js} +1 -1
  67. package/dist/chunks/{web_search-C3WKDOSZ.js → web_search-MOI3CNWS.js} +1 -1
  68. package/dist/chunks/{write_docx-QGW25TF7.js → write_docx-A3GAUZEW.js} +1 -1
  69. package/dist/chunks/{write_file-A6MKH4SC.js → write_file-MNAF43T6.js} +1 -1
  70. package/dist/chunks/{write_pdf-5HOQYVQO.js → write_pdf-YQ3JTZ5U.js} +1 -1
  71. package/dist/chunks/{xkiro-D3DTPVWY.js → xkiro-GN4FCYYQ.js} +1 -1
  72. package/dist/cli.js +6 -6
  73. package/dist/package.json +2 -2
  74. package/package.json +2 -2
  75. package/dist/chunks/settings-IZC7UDNU.js +0 -1
  76. package/dist/chunks/view_file-OYV2IEYG.js +0 -1
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"./chunk-75OCC24T.js";import"./chunk-YFIWMGCS.js";export{a as DEFAULT_MODEL_CONFIG,p as formatModelPricingText,o as getDefaultModel,r as getFallbackValue,b as getModelConfig,q 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
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r}from"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.js";export{a as DEFAULT_MODEL_CONFIG,p as formatModelPricingText,o as getDefaultModel,r as getFallbackValue,b as getModelConfig,q 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-PTFCY2D5.js";import{a as W}from"./chunk-XPIXBWTZ.js";import{l as K}from"./chunk-75OCC24T.js";import"./chunk-YFIWMGCS.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,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||(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-PTFCY2D5.js";import{a as W}from"./chunk-UM5SNZ6X.js";import{l as K}from"./chunk-Y6O7SAPD.js";import"./chunk-NPXJIGAI.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,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||(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,3 +1,3 @@
1
- import{a as L}from"./chunk-XPIXBWTZ.js";import{n as A}from"./chunk-7CCULUZN.js";import"./chunk-NTZSL2UT.js";import"./chunk-YFIWMGCS.js";import{Ollama as b}from"ollama";var _=new Map;async function D(a,e,n){let o=`${e}::${n}`;if(_.has(o))return _.get(o);try{let u=(await a.show({model:n}))?.thinking||null;return _.set(o,u),u}catch{return _.set(o,null),null}}function E(a,e){let n=a?.values,o=Array.isArray(n)&&n.some(d=>typeof d=="boolean"),m=Array.isArray(n)&&n.some(d=>typeof d=="string");if(o)switch(e){case"Fast":return!1;case"Low":case"Medium":case"Standard":case"High":case"xHigh":return!0;default:return!0}if(m)switch(e){case"Fast":return n.includes("low")?"low":!1;case"Low":return"low";case"Medium":case"Standard":return"medium";case"High":case"xHigh":return"high";default:return"medium"}let u={Fast:!1,Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"};return u[e]!==void 0?u[e]:!0}var $=async function*(a,e,n,o,m,u,d,x,O=1,H="Cloud"){let s=[];o&&s.push({role:"system",content:o});for(let t of n){let r=t.role==="user"?"user":"assistant",c="",w=[];if(Array.isArray(t.parts)){c=t.parts.map(l=>l.text||"").filter(Boolean).join(`
1
+ import{a as L}from"./chunk-UM5SNZ6X.js";import{n as A}from"./chunk-IWIVGFAT.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";import{Ollama as b}from"ollama";var _=new Map;async function D(a,e,n){let o=`${e}::${n}`;if(_.has(o))return _.get(o);try{let u=(await a.show({model:n}))?.thinking||null;return _.set(o,u),u}catch{return _.set(o,null),null}}function E(a,e){let n=a?.values,o=Array.isArray(n)&&n.some(d=>typeof d=="boolean"),m=Array.isArray(n)&&n.some(d=>typeof d=="string");if(o)switch(e){case"Fast":return!1;case"Low":case"Medium":case"Standard":case"High":case"xHigh":return!0;default:return!0}if(m)switch(e){case"Fast":return n.includes("low")?"low":!1;case"Low":return"low";case"Medium":case"Standard":return"medium";case"High":case"xHigh":return"high";default:return"medium"}let u={Fast:!1,Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"};return u[e]!==void 0?u[e]:!0}var $=async function*(a,e,n,o,m,u,d,x,O=1,H="Cloud"){let s=[];o&&s.push({role:"system",content:o});for(let t of n){let r=t.role==="user"?"user":"assistant",c="",w=[];if(Array.isArray(t.parts)){c=t.parts.map(l=>l.text||"").filter(Boolean).join(`
2
2
  `);for(let l of t.parts){let k=l.inlineData||l.inline_data;k&&k.data&&w.push(k.data)}}else c=t.text||"";if(c||w.length>0){let l={role:r,content:c};w.length>0&&(l.images=w),s.push(l)}}let C=a===A||H==="Local"||!a||a==="LOCAL",y=C?process.env.OLLAMA_HOST||"http://127.0.0.1:11434":process.env.OLLAMA_HOST||"https://ollama.com",M={host:y};!C&&a&&(M.headers={Authorization:"Bearer "+a});let T=new b(M),i=[],g=null,v=Date.now(),h=!1,f=L("Ollama",e,m),p;if(f!==null)p=f==="false"||f===!1?!1:f==="true"||f===!0?!0:f;else{let t=await D(T,y,e);p=E(t,m)}if(p&&e&&e.toLowerCase().includes("gemma4")){let t=s.findIndex(r=>r.role==="system");t!==-1?s[t].content.includes("<|think|>")||(s[t].content=`<|think|>
3
3
  ${s[t].content}`):s.unshift({role:"system",content:"<|think|>"})}let S={model:e,messages:s,stream:!0,think:p,keep_alive:"10m",tools:[],tool_choice:"none",options:{temperature:O}},N=await T.chat(S);for await(let t of N){if(x?.aborted)throw new DOMException("The user aborted a request.","AbortError");if(t.message?.thinking&&(i.push({text:t.message.thinking,thought:!0}),h=!0),t.message?.content&&(i.push({text:t.message.content}),h=!0),t.done){let r=t.prompt_eval_cached_count||0;if(!r&&t.prompt_eval_count){let c=t.prompt_eval_duration||0;c>0&&c<5e7&&(r=t.prompt_eval_count)}g={totalTokenCount:(t.prompt_eval_count||0)+(t.eval_count||0),promptTokenCount:t.prompt_eval_count||0,candidatesTokenCount:t.eval_count||0,cachedContentTokenCount:r,thoughtsTokenCount:0},h=!0}(t.done||Date.now()-v>=150&&h)&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:g},i=[],v=Date.now(),h=!1)}h&&(i.length>0||g)&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:g})};export{$ as getOllamaStream};
@@ -1,2 +1,2 @@
1
- import{a as E,b as R}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.js";var B=async function*(C,O,S,$,m,A,M,F,I=1,N=null){let y=[];$&&y.push({role:"system",content:[{type:"text",text:$}]});for(let e of S){let t=e.role==="user"?"user":"assistant",s=[];if(Array.isArray(e.parts)){for(let n of e.parts)if(n.text)s.push({type:"text",text:n.text});else if(n.inlineData&&M){let l=n.inlineData.mimeType,c=n.inlineData.data;l.startsWith("image/")?s.push({type:"image_url",image_url:{url:`data:${l};base64,${c}`}}):s.push({type:"file",file:{filename:n.filename||"file",file_data:`data:${l};base64,${c}`}})}}else{let n=e.text||"";n&&s.push({type:"text",text:n})}y.push({role:t,content:s.length===1&&s[0].type==="text"?s[0].text:s})}let j={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},r=O,u=null,h=null;if(typeof r=="string"&&r.includes("::")){let e=r.indexOf("::"),t=r.slice(0,e).trim();t&&(u={only:[t],allow_fallbacks:!1}),r=r.slice(e+2).trim()}if(r.includes(":")){let e=r.split(":");if(e.length>1){let t=e[e.length-1].toLowerCase().trim();(t==="flex"||t==="priority")&&(h=t,e.pop())}r=e.join(":").trim()}let v=`${C.slice(-5)}${N||""}${m}${r}${h||""}${u?JSON.stringify(u):""}`,P=await R(v),g={model:r,messages:y,stream:!0,temperature:I,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:P};h&&(g.service_tier=h),u&&(g.provider=u);let x=b("OpenRouter",O,m),k=x!==null?x:j[m];k&&k!=="none"&&(x!==null||m!=="Fast")&&(g.reasoning_effort=k);let d=await E("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"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(!d.ok){let e=await d.json().catch(()=>({})),t=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||d.statusText||"Unknown error";throw new Error(`OpenRouter Error (${d.status}): ${t}`)}let J=d.body.getReader(),W=new TextDecoder,T="",i=[],_=null,D=Date.now(),p=!1;for(;;){let{done:e,value:t}=await J.read();if(e){p&&(i.length>0||_)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:_});break}T+=W.decode(t,{stream:!0});let s=T.split(`
1
+ import{a as E,b as R}from"./chunk-PTFCY2D5.js";import{a as b}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var B=async function*(C,O,S,$,m,A,M,F,I=1,N=null){let y=[];$&&y.push({role:"system",content:[{type:"text",text:$}]});for(let e of S){let t=e.role==="user"?"user":"assistant",s=[];if(Array.isArray(e.parts)){for(let n of e.parts)if(n.text)s.push({type:"text",text:n.text});else if(n.inlineData&&M){let l=n.inlineData.mimeType,c=n.inlineData.data;l.startsWith("image/")?s.push({type:"image_url",image_url:{url:`data:${l};base64,${c}`}}):s.push({type:"file",file:{filename:n.filename||"file",file_data:`data:${l};base64,${c}`}})}}else{let n=e.text||"";n&&s.push({type:"text",text:n})}y.push({role:t,content:s.length===1&&s[0].type==="text"?s[0].text:s})}let j={Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"},r=O,u=null,h=null;if(typeof r=="string"&&r.includes("::")){let e=r.indexOf("::"),t=r.slice(0,e).trim();t&&(u={only:[t],allow_fallbacks:!1}),r=r.slice(e+2).trim()}if(r.includes(":")){let e=r.split(":");if(e.length>1){let t=e[e.length-1].toLowerCase().trim();(t==="flex"||t==="priority")&&(h=t,e.pop())}r=e.join(":").trim()}let v=`${C.slice(-5)}${N||""}${m}${r}${h||""}${u?JSON.stringify(u):""}`,P=await R(v),g={model:r,messages:y,stream:!0,temperature:I,cache_control:{type:"ephemeral"},tools:[],tool_choice:"none",session_id:P};h&&(g.service_tier=h),u&&(g.provider=u);let x=b("OpenRouter",O,m),k=x!==null?x:j[m];k&&k!=="none"&&(x!==null||m!=="Fast")&&(g.reasoning_effort=k);let d=await E("https://openrouter.ai/api/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${C}`,"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(!d.ok){let e=await d.json().catch(()=>({})),t=e.error?.metadata?.raw||e.error?.message||(typeof e.error=="string"?e.error:"")||d.statusText||"Unknown error";throw new Error(`OpenRouter Error (${d.status}): ${t}`)}let J=d.body.getReader(),W=new TextDecoder,T="",i=[],_=null,D=Date.now(),p=!1;for(;;){let{done:e,value:t}=await J.read();if(e){p&&(i.length>0||_)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:_});break}T+=W.decode(t,{stream:!0});let s=T.split(`
2
2
  `);T=s.pop();for(let n of s){let l=n.trim();if(!l||!l.startsWith("data: "))continue;let c=!1;if(l==="data: [DONE]")c=!0;else try{let o=JSON.parse(l.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 f=o.choices?.[0]?.delta,a=o.usage;if(o.choices?.[0]?.finish_reason&&(c=!0),a&&(_={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||a.prompt_tokens_details?.cache_read_input_tokens||a.cache_read_input_tokens||0,thoughtsTokenCount:a.completion_tokens_details?.reasoning_tokens||0},p=!0),f){let w=f.reasoning||(f.reasoning_details?f.reasoning_details.map(X=>X.text).join(""):null);w&&(i.push({text:w,thought:!0}),p=!0),f.content&&(i.push({text:f.content}),p=!0)}}catch(o){if(o.message&&o.message.startsWith("OpenRouter Stream Error:"))throw o}if((c||Date.now()-D>=150)&&p&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:_},i=[],D=Date.now(),p=!1),c)break}}};export{B as getOpenRouterStream};
@@ -1 +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,x,y,z}from"./chunk-YFIWMGCS.js";export{q as ACTIVE_TX_FILE,n as BACKUPS_DIR,s as CONTEXT_FILE,u as CU_CACHE_DIR,c as DATA_DIR,w as DEFAULT_EXCLUDES,a as FLUXFLOW_DIR,g as HISTORY_DIR,f as HISTORY_FILE,p as LEDGER_ADVANCE_FILE,o as LEDGER_FILE,d as LOGS_DIR,k as MEMORIES_FILE,t as PARSER_DIR,r as PATHS_FILE,e as SECRET_DIR,b as SETTINGS_FILE,m as TEMP_MEM_CHAT_FILE,l as TEMP_MEM_FILE,v as THINKING_CONFIG_FILE,i as USAGE_FILE,h as USAGE_FILE_OLD,j as USAGE_FILE_TIMED,x as getGitignoreExcludes,y as matchesPathPattern,z as resolvePathWithTilde};
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,x,y,z}from"./chunk-NPXJIGAI.js";export{q as ACTIVE_TX_FILE,n as BACKUPS_DIR,s as CONTEXT_FILE,u as CU_CACHE_DIR,c as DATA_DIR,w as DEFAULT_EXCLUDES,a as FLUXFLOW_DIR,g as HISTORY_DIR,f as HISTORY_FILE,p as LEDGER_ADVANCE_FILE,o as LEDGER_FILE,d as LOGS_DIR,k as MEMORIES_FILE,t as PARSER_DIR,r as PATHS_FILE,e as SECRET_DIR,b as SETTINGS_FILE,m as TEMP_MEM_CHAT_FILE,l as TEMP_MEM_FILE,v as THINKING_CONFIG_FILE,i as USAGE_FILE,h as USAGE_FILE_OLD,j as USAGE_FILE_TIMED,x as getGitignoreExcludes,y as matchesPathPattern,z as resolvePathWithTilde};
@@ -1,2 +1,2 @@
1
- import{a as D}from"./chunk-PTFCY2D5.js";import{a as x}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.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(`
1
+ import{a as D}from"./chunk-PTFCY2D5.js";import{a as x}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.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
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{f as n}from"./chunk-XRTIQISS.js";import{a as c}from"./chunk-Y5JU726N.js";var m=async(r,o={})=>{let t=typeof r=="string"?c(r):r||{},a=t.canvasMode===!0||t.canvasMode==="true"||t.canvas_mode===!0||t.canvas_mode==="true";try{let e=await n({canvasMode:a});if(e&&e.base64)return{text:`Screen recaptured${a?" (static canvas grid mode)":""}.`,binaryPart:{inlineData:{mimeType:e.mimeType,data:e.base64}}}}catch{}return"Screen recaptured."};export{m as recapture_screen};
1
+ import{f as n}from"./chunk-3SMC2C3F.js";import{a as c}from"./chunk-Y5JU726N.js";var m=async(r,o={})=>{let t=typeof r=="string"?c(r):r||{},a=t.canvasMode===!0||t.canvasMode==="true"||t.canvas_mode===!0||t.canvas_mode==="true";try{let e=await n({canvasMode:a});if(e&&e.base64)return{text:`Screen recaptured${a?" (static canvas grid mode)":""}.`,binaryPart:{inlineData:{mimeType:e.mimeType,data:e.base64}}}}catch{}return"Screen recaptured."};export{m as recapture_screen};
@@ -1 +1 @@
1
- import{c as a,d as n}from"./chunk-NTZSL2UT.js";import{l as s,m as o}from"./chunk-YFIWMGCS.js";var g=async(u,E={})=>{let m=r=>{let t=new RegExp(`${r}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),i=u.match(t);return i?i[2].trim():null},e=m("id"),c=m("summary");if(!e||!c)return"ERROR: Missing 'id' or 'summary' for saveSummary tool.";try{let r=a(s,{}),t=a(o,{});return t[e]=c,delete r[e],n(o,t),n(s,r),`Saved summary and purged raw memories for chat [${e}].`}catch(r){let t=r instanceof Error?r.message:String(r);return`ERROR: Failed to save summary for chat [${e}]: ${t}`}};export{g as saveSummary};
1
+ import{c as a,d as n}from"./chunk-ZGORMZE5.js";import{l as s,m as o}from"./chunk-NPXJIGAI.js";var g=async(u,E={})=>{let m=r=>{let t=new RegExp(`${r}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),i=u.match(t);return i?i[2].trim():null},e=m("id"),c=m("summary");if(!e||!c)return"ERROR: Missing 'id' or 'summary' for saveSummary tool.";try{let r=a(s,{}),t=a(o,{});return t[e]=c,delete r[e],n(o,t),n(s,r),`Saved summary and purged raw memories for chat [${e}].`}catch(r){let t=r instanceof Error?r.message:String(r);return`ERROR: Failed to save summary for chat [${e}]: ${t}`}};export{g as saveSummary};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i}from"./chunk-XRTIQISS.js";export{b as CANVAS_GRID_CONFIG,a as GRID_CONFIG,f as captureGriddedScreenshot,i as coordinates720pToGridId,e as getActiveDisplay,h as gridToNativeCoordinates,g as parseGridCodeTo720p,d as rawModelOnly,c as useModel};
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk-3SMC2C3F.js";export{b as CANVAS_GRID_CONFIG,a as GRID_CONFIG,f as captureGriddedScreenshot,i as coordinates720pToGridId,e as getActiveDisplay,h as gridToNativeCoordinates,g as parseGridCodeTo720p,d as rawModelOnly,c as useModel};
@@ -1 +1 @@
1
- import{a as r}from"./chunk-VDO5TP6E.js";import"./chunk-XRTIQISS.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-ZPSNXBWW.js";import"./chunk-3SMC2C3F.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,4 +1,4 @@
1
- import{a as st}from"./chunk-Y5JU726N.js";import{b as et}from"./chunk-UMS5SEYB.js";import"./chunk-75OCC24T.js";import"./chunk-NTZSL2UT.js";import{w as J,x as Q,y as Y,z as tt}from"./chunk-YFIWMGCS.js";import K from"fs/promises";import v from"path";import j from"fast-glob";import{Minimatch as rt}from"minimatch";async function O(f,l,y=f,m=1){if(m>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let e=v.join(f,t.name),w=v.relative(y,e),F=w.split(v.sep).map(L=>L.toLowerCase()),N=t.name.toLowerCase();if(!l.some(L=>{let E=L.toLowerCase();return E.startsWith(".")&&N.endsWith(E)?!0:F.some(P=>P===E||P.startsWith(".pnpm"))}))if(t.isDirectory()){let L=await O(e,l,y,m+1);h=h.concat(L)}else t.isFile()&&h.push({fullPath:e,relativePath:w})}return h}function lt(f,l,y=1/0){if(f===l)return 0;if(f.length===0)return l.length;if(l.length===0)return f.length;if(Math.abs(f.length-l.length)>y)return y+1;let m=Array.from({length:l.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let e=1;e<=l.length;e++){let w=f[h-1]===l[e-1]?0:1,F=Math.min(s[e-1]+1,m[e]+1,m[e-1]+w);s.push(F),F<t&&(t=F)}if(m=s,t>y)return y+1}return m[l.length]}function at(f,l){if(!f||!l)return!1;let y=f.toLowerCase(),m=l.toLowerCase();if(y.includes(m))return!0;let h=y.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=m.split(/[^a-z0-9]+/).filter(t=>t.length>1||m.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let e=t.length<=2?0:t.length<=5?1:2;for(let w of h)if(w.includes(t)||t.length>=3&&w.length>=3&&Math.abs(w.length-t.length)<=e&&lt(t,w,e)<=e)return!0;return!1})}var $t=async f=>{let{keyword:l,path:y,fuzzy:m,subString:h,regex:s}=st(f);if(l==null)return'ERROR: Missing "keyword" argument.';let t=String(l),e=y,w=!1;if(e){let{resolvedPath:n,isTildeResolved:d}=tt(e);e=n,w=d;let i=e.trim().toLowerCase();if(i==="#docs"||i==="#doc"||i==="#documentation"||i.includes("#skill/global/fluxflow")||i.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let F=n=>n===!0||n==="true"||n===1||n==="1"||n==="yes",N=s===!1||s==="false"||s===0||s==="0"||s==="no",B=s===!0||s==="true"||s===1||s==="1"||s==="yes",L=F(m)||F(h),E=null,P=null;if(N)L||(P=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{let n=t;E=new RegExp(n,"i")}catch(n){if(B)return`ERROR: Invalid regex pattern "${t}": ${n.message}`}P=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let S=Array.from(new Set([...J,...Q(process.cwd())])),X=150;try{let n=[],d=process.cwd(),i=null;if(e){let o=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),u=e.split(";").map(r=>r.trim()).filter(Boolean).map(o).filter(r=>r!=="!"),c=u.some(r=>r.startsWith("!"));if(u.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){i="glob";let r=e.replace(/\\/g,"/"),a=u.map(g=>g.replace(/\\/g,"/")),z=S.map(g=>g.startsWith(".")?`**/*${g}`:`**/${g}/**`);if(c&&!u.some(g=>!g.startsWith("!"))){let g=await O(d,S,d),R=$=>$.endsWith("/")?$+"**":$,p=a.filter($=>$.startsWith("!")).map($=>R($.slice(1))),M=a.filter($=>!$.startsWith("!")).map(R);n=g.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=M.length===0||M.some(b=>{try{return new rt(b).match(x)}catch{return!1}}),Z=p.some(b=>{try{return new rt(b).match(x)}catch{return!1}});return _&&!Z})}else{let g=a.some(p=>/[\(\)\|]|\.\*/.test(p)),R=[];if(!g)try{R=await j(a,{cwd:d,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(g||j.isDynamicPattern(r))){let p=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),M=p&&!/[\*\?\(\)\|\[\]]/.test(p[1])?v.resolve(d,p[1]):d,$=await O(M,S,d);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");n=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{n=[]}}else n=R.map(p=>({fullPath:v.resolve(d,p),relativePath:p}))}}else{let r=[],a=!1,z=!1;for(let k of u){let g=k.replace(/[\/\\]+$/,""),R=v.resolve(d,g);try{let p=await K.stat(R);if(p.isDirectory()){z=!0;let M=await O(R,S,d);r.push(...M)}else if(p.isFile())a=!0,r.push({fullPath:R,relativePath:v.relative(d,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}n=r,a&&!z?i="file":i="dir"}}else n=await O(d,S);let nt=n.map(async o=>{try{let u=await K.readFile(o.fullPath,"utf-8");if(u.includes("\0"))return[];let c=u.split(/\r?\n/),W=[];for(let a=0;a<c.length;a++)(L?c[a].toLowerCase().includes(t.toLowerCase())||at(c[a],t):N?P&&P.test(c[a]):E&&E.test(c[a])||P&&P.test(c[a]))&&W.push({line:a+1,content:c[a].trim()});return W.length===0?null:{path:o.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),it=await Promise.all(nt),D=[],A=0;for(let o of it){if(!o||!o.matches)continue;if(A>=X)break;let u=X-A,c=o.matches.slice(0,u);D.push({path:o.path,matches:c}),A+=c.length}typeof global.gc=="function"&&global.gc();let G=null;if(D.length===0){let o=i==="file"?` in '${e}'`:i==="dir"||i==="glob"?` in '${e}'`:". Try to specify files",u=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"";return`${u}${u?" ":""}Found 0 matches of '${t}'${o}${G?` ${G}`:""}`}let T=G?` ${G}`:"",H=`${D.length} file${D.length===1?"":"s"}`,U=`${A} match${A===1?"":"es"}`,I;i==="file"?I=`Found ${U} of '${t}' in '${e}'${T}:`:i==="dir"||i==="glob"?I=`Found ${U} of '${t}' in '${e}' across ${H}${T}:`:I=`Found ${U} of '${t}' across ${H}${T}:`;let V=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"",C=`${V}${V?" ":""}${I}
1
+ import{a as st}from"./chunk-Y5JU726N.js";import{b as et}from"./chunk-KQNW7DK5.js";import"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import{w as J,x as Q,y as Y,z as tt}from"./chunk-NPXJIGAI.js";import K from"fs/promises";import v from"path";import j from"fast-glob";import{Minimatch as rt}from"minimatch";async function O(f,l,y=f,m=1){if(m>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let e=v.join(f,t.name),w=v.relative(y,e),F=w.split(v.sep).map(L=>L.toLowerCase()),N=t.name.toLowerCase();if(!l.some(L=>{let E=L.toLowerCase();return E.startsWith(".")&&N.endsWith(E)?!0:F.some(P=>P===E||P.startsWith(".pnpm"))}))if(t.isDirectory()){let L=await O(e,l,y,m+1);h=h.concat(L)}else t.isFile()&&h.push({fullPath:e,relativePath:w})}return h}function lt(f,l,y=1/0){if(f===l)return 0;if(f.length===0)return l.length;if(l.length===0)return f.length;if(Math.abs(f.length-l.length)>y)return y+1;let m=Array.from({length:l.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let e=1;e<=l.length;e++){let w=f[h-1]===l[e-1]?0:1,F=Math.min(s[e-1]+1,m[e]+1,m[e-1]+w);s.push(F),F<t&&(t=F)}if(m=s,t>y)return y+1}return m[l.length]}function at(f,l){if(!f||!l)return!1;let y=f.toLowerCase(),m=l.toLowerCase();if(y.includes(m))return!0;let h=y.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=m.split(/[^a-z0-9]+/).filter(t=>t.length>1||m.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let e=t.length<=2?0:t.length<=5?1:2;for(let w of h)if(w.includes(t)||t.length>=3&&w.length>=3&&Math.abs(w.length-t.length)<=e&&lt(t,w,e)<=e)return!0;return!1})}var $t=async f=>{let{keyword:l,path:y,fuzzy:m,subString:h,regex:s}=st(f);if(l==null)return'ERROR: Missing "keyword" argument.';let t=String(l),e=y,w=!1;if(e){let{resolvedPath:n,isTildeResolved:d}=tt(e);e=n,w=d;let i=e.trim().toLowerCase();if(i==="#docs"||i==="#doc"||i==="#documentation"||i.includes("#skill/global/fluxflow")||i.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let F=n=>n===!0||n==="true"||n===1||n==="1"||n==="yes",N=s===!1||s==="false"||s===0||s==="0"||s==="no",B=s===!0||s==="true"||s===1||s==="1"||s==="yes",L=F(m)||F(h),E=null,P=null;if(N)L||(P=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{let n=t;E=new RegExp(n,"i")}catch(n){if(B)return`ERROR: Invalid regex pattern "${t}": ${n.message}`}P=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let S=Array.from(new Set([...J,...Q(process.cwd())])),X=150;try{let n=[],d=process.cwd(),i=null;if(e){let o=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),u=e.split(";").map(r=>r.trim()).filter(Boolean).map(o).filter(r=>r!=="!"),c=u.some(r=>r.startsWith("!"));if(u.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){i="glob";let r=e.replace(/\\/g,"/"),a=u.map(g=>g.replace(/\\/g,"/")),z=S.map(g=>g.startsWith(".")?`**/*${g}`:`**/${g}/**`);if(c&&!u.some(g=>!g.startsWith("!"))){let g=await O(d,S,d),R=$=>$.endsWith("/")?$+"**":$,p=a.filter($=>$.startsWith("!")).map($=>R($.slice(1))),M=a.filter($=>!$.startsWith("!")).map(R);n=g.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=M.length===0||M.some(b=>{try{return new rt(b).match(x)}catch{return!1}}),Z=p.some(b=>{try{return new rt(b).match(x)}catch{return!1}});return _&&!Z})}else{let g=a.some(p=>/[\(\)\|]|\.\*/.test(p)),R=[];if(!g)try{R=await j(a,{cwd:d,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(g||j.isDynamicPattern(r))){let p=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),M=p&&!/[\*\?\(\)\|\[\]]/.test(p[1])?v.resolve(d,p[1]):d,$=await O(M,S,d);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");n=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{n=[]}}else n=R.map(p=>({fullPath:v.resolve(d,p),relativePath:p}))}}else{let r=[],a=!1,z=!1;for(let k of u){let g=k.replace(/[\/\\]+$/,""),R=v.resolve(d,g);try{let p=await K.stat(R);if(p.isDirectory()){z=!0;let M=await O(R,S,d);r.push(...M)}else if(p.isFile())a=!0,r.push({fullPath:R,relativePath:v.relative(d,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}n=r,a&&!z?i="file":i="dir"}}else n=await O(d,S);let nt=n.map(async o=>{try{let u=await K.readFile(o.fullPath,"utf-8");if(u.includes("\0"))return[];let c=u.split(/\r?\n/),W=[];for(let a=0;a<c.length;a++)(L?c[a].toLowerCase().includes(t.toLowerCase())||at(c[a],t):N?P&&P.test(c[a]):E&&E.test(c[a])||P&&P.test(c[a]))&&W.push({line:a+1,content:c[a].trim()});return W.length===0?null:{path:o.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),it=await Promise.all(nt),D=[],A=0;for(let o of it){if(!o||!o.matches)continue;if(A>=X)break;let u=X-A,c=o.matches.slice(0,u);D.push({path:o.path,matches:c}),A+=c.length}typeof global.gc=="function"&&global.gc();let G=null;if(D.length===0){let o=i==="file"?` in '${e}'`:i==="dir"||i==="glob"?` in '${e}'`:". Try to specify files",u=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"";return`${u}${u?" ":""}Found 0 matches of '${t}'${o}${G?` ${G}`:""}`}let T=G?` ${G}`:"",H=`${D.length} file${D.length===1?"":"s"}`,U=`${A} match${A===1?"":"es"}`,I;i==="file"?I=`Found ${U} of '${t}' in '${e}'${T}:`:i==="dir"||i==="glob"?I=`Found ${U} of '${t}' in '${e}' across ${H}${T}:`:I=`Found ${U} of '${t}' across ${H}${T}:`;let V=i==="dir"?"[DIR]":i==="glob"?"[GLOB]":"",C=`${V}${V?" ":""}${I}
2
2
 
3
3
  `,q="";try{let o=await et();o?.systemSettings?.alwaysAskFiles&&(q=o.systemSettings.alwaysAskFiles)}catch{}for(let o of D)if(C+=`${o.path}:
4
4
  `,Y(o.path,q)){let c=o.matches.map(W=>`Line ${W.line}`).join(", ");C+=` ${c}. Line snapshot not available due to file restriction policy. ReadFile if needed
@@ -1 +1 @@
1
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-25EUCCH5.js";import{n as a}from"./chunk-7CCULUZN.js";import"./chunk-NTZSL2UT.js";import"./chunk-YFIWMGCS.js";export{a as NULL_KEY_SENTINEL,b as getAPIKey,c as getProviderAPIKey,h as getSearchSecrets,f as getSecret,m as removeAPIKey,l as removeSecret,e as replaceActiveProviderKey,i as saveAPIKey,d as saveProviderAPIKey,k as saveSearchId,j as saveSearchKey,g as saveSecret};
1
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m}from"./chunk-3HGLLXBK.js";import{n as a}from"./chunk-IWIVGFAT.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as NULL_KEY_SENTINEL,b as getAPIKey,c as getProviderAPIKey,h as getSearchSecrets,f as getSecret,m as removeAPIKey,l as removeSecret,e as replaceActiveProviderKey,i as saveAPIKey,d as saveProviderAPIKey,k as saveSearchId,j as saveSearchKey,g as saveSecret};
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-7CCULUZN.js";import"./chunk-NTZSL2UT.js";import"./chunk-YFIWMGCS.js";export{a as HIDDEN_FROM_SUMMARY,n as NULL_KEY_SENTINEL,b as PROVIDER_DEFS,A as addProviderKey,H as buildListLines,E as cleanProviderKeys,u as clearAllTempKeys,v as clearTempKey,j as countProviderKeys,G as formatBaseUrl,l as getActiveIndex,d as getCanonicalProviders,g as getProviderLabel,i as getProviderSlots,k as getProviderSummary,s as getTempKey,t as hasTempKey,f as isHiddenFromSummary,p as isNullMode,e as isUrlBearing,F as maskKey,h as migrateFromLegacy,c as normalizeProvider,C as removeProviderKey,B as replaceActiveProviderKey,x as resolveAPIKey,y as resolveBaseUrl,m as setActiveIndex,w as setNoticeHandler,q as setNullMode,r as setTempKey,o as supportsNullKey,D as useProviderKey,z as validateOpenAIBaseUrl};
1
+ import{A,B,C,D,E,F,G,H,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-IWIVGFAT.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as HIDDEN_FROM_SUMMARY,n as NULL_KEY_SENTINEL,b as PROVIDER_DEFS,A as addProviderKey,H as buildListLines,E as cleanProviderKeys,u as clearAllTempKeys,v as clearTempKey,j as countProviderKeys,G as formatBaseUrl,l as getActiveIndex,d as getCanonicalProviders,g as getProviderLabel,i as getProviderSlots,k as getProviderSummary,s as getTempKey,t as hasTempKey,f as isHiddenFromSummary,p as isNullMode,e as isUrlBearing,F as maskKey,h as migrateFromLegacy,c as normalizeProvider,C as removeProviderKey,B as replaceActiveProviderKey,x as resolveAPIKey,y as resolveBaseUrl,m as setActiveIndex,w as setNoticeHandler,q as setNullMode,r as setTempKey,o as supportsNullKey,D as useProviderKey,z as validateOpenAIBaseUrl};
@@ -1,2 +1,2 @@
1
- import{a as C}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.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(`
1
+ import{a as C}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.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
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};
@@ -0,0 +1 @@
1
+ import{a,b,c}from"./chunk-KQNW7DK5.js";import"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{a as PROVIDER_BASE_URLS,b as loadSettings,c as saveSettings};
@@ -1,4 +1,4 @@
1
- import{a as h}from"./chunk-KOCMIEPK.js";import{a as C}from"./chunk-Y5JU726N.js";import"./chunk-NTZSL2UT.js";import{c as $}from"./chunk-YFIWMGCS.js";import l from"fs";import R from"path";var E=async(x,S={})=>{let{method:f,tasks:m,markDone:d}=C(x),A=S.chatId||"default";if(!f)return'ERROR: Missing "method" argument for Goal tool (create/append/get).';let u=R.join($,"plan",A),o=R.join(u,"todo.md"),W=t=>{if(!t||Array.isArray(t))return t;let s=String(t).trim();if(s.startsWith("[")&&s.endsWith("]")){let i=s.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);return i?i.map(n=>n.slice(1,-1).replace(/\\(.)/g,"$1")):s.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean)}return t},k=t=>{let s=W(t);return s?(Array.isArray(s)?s:String(s).split(`
1
+ import{a as h}from"./chunk-2RTYI6K3.js";import{a as C}from"./chunk-Y5JU726N.js";import"./chunk-ZGORMZE5.js";import{c as $}from"./chunk-NPXJIGAI.js";import l from"fs";import R from"path";var E=async(x,S={})=>{let{method:f,tasks:m,markDone:d}=C(x),A=S.chatId||"default";if(!f)return'ERROR: Missing "method" argument for Goal tool (create/append/get).';let u=R.join($,"plan",A),o=R.join(u,"todo.md"),W=t=>{if(!t||Array.isArray(t))return t;let s=String(t).trim();if(s.startsWith("[")&&s.endsWith("]")){let i=s.match(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/g);return i?i.map(n=>n.slice(1,-1).replace(/\\(.)/g,"$1")):s.slice(1,-1).split(",").map(n=>n.trim()).filter(Boolean)}return t},k=t=>{let s=W(t);return s?(Array.isArray(s)?s:String(s).split(`
2
2
  `)).map(n=>{let r=String(n).trim();return r?r.startsWith("- [ ]")||r.startsWith("- [x]")||r.startsWith("- [X]")?r:`- [ ] ${r}`:null}).filter(Boolean).join(`
3
3
  `)+`
4
4
  `:""},y=(t,s)=>{if(!s)return{content:t,markedCount:0};let i=W(s),n=(Array.isArray(i)?i:[i]).map(p=>String(p).replace(/^- \[[xX ]\]\s*/i,"").trim()).filter(Boolean),r=t.split(`
@@ -1,2 +1,2 @@
1
- import{a as R}from"./chunk-PTFCY2D5.js";import{a as C}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.js";var J=async function*(A,k,N,y,x,$,M,v,B=1){let g=[];y&&g.push({role:"system",content:y});for(let s of N){let T=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let n of s.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&M){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=s.text||"";n&&e.push({type:"text",text:n})}g.push({role:T,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let w=C("TokenHarbor",k,x),H=w!==null?w:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],D={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:B,tools:[],tool_choice:"none"};H&&(D.reasoning_effort=H);let K=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",O={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},P=A||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";O.Authorization=`Bearer ${P}`;let l=await R(K,{method:"POST",headers:O,body:JSON.stringify(D),signal:v});if(!l.ok){let s=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${s.error?.message||s.message||l.statusText}`)}let F=l.body.getReader(),L=new TextDecoder,m="",t=[],c=null,f=Date.now(),o=!1,d=[],E=0,S=5,b=!0,_=()=>{d.length>0&&(t.push(...d),d=[],o=!0),b=!1};for(;;){let{done:s,value:T}=await F.read();if(s){_(),o&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}m+=L.decode(T,{stream:!0});let e=m.split(`
1
+ import{a as R}from"./chunk-PTFCY2D5.js";import{a as C}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var J=async function*(A,k,N,y,x,$,M,v,B=1){let g=[];y&&g.push({role:"system",content:y});for(let s of N){let T=s.role==="user"?"user":"assistant",e=[];if(Array.isArray(s.parts)){for(let n of s.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&M){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=s.text||"";n&&e.push({type:"text",text:n})}g.push({role:T,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let w=C("TokenHarbor",k,x),H=w!==null?w:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[x],D={model:k,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:B,tools:[],tool_choice:"none"};H&&(D.reasoning_effort=H);let K=process.env.TOKENHARBOR_URL||process.env.TOKEN_HARBOR_URL||"https://tokenharbor.ai/v1/chat/completions",O={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},P=A||process.env.TOKENHARBOR_API_KEY||process.env.TOKEN_HARBOR_API_KEY||"";O.Authorization=`Bearer ${P}`;let l=await R(K,{method:"POST",headers:O,body:JSON.stringify(D),signal:v});if(!l.ok){let s=await l.json().catch(()=>({}));throw new Error(`Token Harbor Error (${l.status}): ${s.error?.message||s.message||l.statusText}`)}let F=l.body.getReader(),L=new TextDecoder,m="",t=[],c=null,f=Date.now(),o=!1,d=[],E=0,S=5,b=!0,_=()=>{d.length>0&&(t.push(...d),d=[],o=!0),b=!1};for(;;){let{done:s,value:T}=await F.read();if(s){_(),o&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}m+=L.decode(T,{stream:!0});let e=m.split(`
2
2
  `);m=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)),a=p.choices?.[0]?.delta,r=p.usage;if(r&&(c={totalTokenCount:r.total_tokens||(r.prompt_tokens||0)+(r.completion_tokens||0),promptTokenCount:r.prompt_tokens||0,candidatesTokenCount:r.completion_tokens||0,cachedContentTokenCount:r.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:r.completion_tokens_details?.reasoning_tokens||r.reasoning_tokens||0},o=!0),a){let h=a.reasoning_content||a.reasoning||null;!h&&Array.isArray(a.reasoning_details)&&a.reasoning_details.length>0&&(h=a.reasoning_details.map(U=>U.text||"").filter(Boolean).join("")),h&&(t.push({text:h,thought:!0}),o=!0),a.content&&(b?(d.push({text:a.content}),E++,E>=S&&_()):(t.push({text:a.content}),o=!0))}}catch{}if((u||Date.now()-f>=150)&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),o=!1),u)break}Date.now()-f>=150&&o&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],f=Date.now(),o=!1)}};export{J as getTokenHarborStream};
@@ -1,4 +1,4 @@
1
- import{g as w,h as y,i as P,j as C}from"./chunk-KIPZOUEA.js";import{a as M}from"./chunk-KOCMIEPK.js";import{a as E}from"./chunk-Y5JU726N.js";import{o as F}from"./chunk-XAPXZ6KO.js";import{b as $}from"./chunk-UMS5SEYB.js";import"./chunk-75OCC24T.js";import"./chunk-NTZSL2UT.js";import{z as R}from"./chunk-YFIWMGCS.js";import p from"fs";import N from"path";var q=async(S,v={})=>{let n=E(S),e=n.path;if(!e)return'ERROR: Missing "path" argument for PatchFile.';let{resolvedPath:O,isTildeResolved:T}=R(e);e=O;let{patchPairs:i,allowMultiple:b,error:d}=w(n);if(d)return`ERROR: ${d}`;if(i.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let k=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":b,s=N.resolve(process.cwd(),e);try{if(!p.existsSync(s))return`ERROR: File [${e}] does not exist. Use WriteFile instead.`;let t=v.forcedContent||p.readFileSync(s,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1));let o=t.replace(/\r\n/g,`
1
+ import{g as w,h as y,i as P,j as C}from"./chunk-JMMO76HS.js";import{a as M}from"./chunk-2RTYI6K3.js";import{a as E}from"./chunk-Y5JU726N.js";import{o as F}from"./chunk-5MJKHQVE.js";import{b as $}from"./chunk-KQNW7DK5.js";import"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import{z as R}from"./chunk-NPXJIGAI.js";import p from"fs";import N from"path";var q=async(S,v={})=>{let n=E(S),e=n.path;if(!e)return'ERROR: Missing "path" argument for PatchFile.';let{resolvedPath:O,isTildeResolved:T}=R(e);e=O;let{patchPairs:i,allowMultiple:b,error:d}=w(n);if(d)return`ERROR: ${d}`;if(i.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let k=n.allowMultiple!==void 0?n.allowMultiple===!0||String(n.allowMultiple).toLowerCase()==="true":b,s=N.resolve(process.cwd(),e);try{if(!p.existsSync(s))return`ERROR: File [${e}] does not exist. Use WriteFile instead.`;let t=v.forcedContent||p.readFileSync(s,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1));let o=t.replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `),{content:a,results:l}=y(o,i,{allowMultiple:k}),c=l.filter(r=>!r.success),u=l.filter(r=>r.success);if(u.length===0)return`ERROR: Patch Failed to apply to [${e}].
4
4
  ${c.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,u,v,w,x,y}from"./chunk-XAPXZ6KO.js";import"./chunk-UMS5SEYB.js";import"./chunk-75OCC24T.js";import"./chunk-NTZSL2UT.js";import"./chunk-YFIWMGCS.js";export{p as addToUsage,c as calculateTokenCost,v as checkImageQuota,s as checkQuota,r as checkQuotaDetailed,e as forceFlushUsage,y as getAllUsageData,q as getCustomPeriodUsage,j as getDailyUsage,t as getImageQuotaBuckets,u as getImageQuotaLimit,w as getImageQuotaStats,k as getMonthlyUsage,h as getTimedUsage,l as incrementUsage,i as initUsage,d as invalidateCachedBaseUrl,n as onCodeChange,g as purgeTimedUsage,o as recordCodeChange,x as recordImageGeneration,f as recordTimedUsage,m as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};
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,x,y}from"./chunk-5MJKHQVE.js";import"./chunk-KQNW7DK5.js";import"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{p as addToUsage,c as calculateTokenCost,v as checkImageQuota,s as checkQuota,r as checkQuotaDetailed,e as forceFlushUsage,y as getAllUsageData,q as getCustomPeriodUsage,j as getDailyUsage,t as getImageQuotaBuckets,u as getImageQuotaLimit,w as getImageQuotaStats,k as getMonthlyUsage,h as getTimedUsage,l as incrementUsage,i as initUsage,d as invalidateCachedBaseUrl,n as onCodeChange,g as purgeTimedUsage,o as recordCodeChange,x as recordImageGeneration,f as recordTimedUsage,m as runtimeSession,b as sendUsageFinalize,a as sendUsageHeartbeat};