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,2 +1,2 @@
1
- import{a as M}from"./chunk-PTFCY2D5.js";import{a as R}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.js";var P=async function*(m,_,N,D,d,j,b,O,$=1){let y=[];D&&y.push({role:"system",content:D});for(let r of N){let x=r.role==="user"?"user":"assistant",e=[];if(Array.isArray(r.parts)){for(let o of r.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,c=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${c}`}})}}else{let o=r.text||"";o&&e.push({type:"text",text:o})}y.push({role:x,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=R("9router",_,d)||R("9Router",_,d),w=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[d],U={model:_,messages:y,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};w&&w!=="none"&&(k!==null||d!=="Fast")&&(U.reasoning_effort=w);let v=(process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1").trim(),l=v.replace(/\/+$/,"");if(!l.endsWith("/v1")&&!l.endsWith("/v1/chat/completions"))throw new Error(`Invalid 9Router URL: "${v}". Endpoint URL MUST end with /v1 (e.g. http://127.0.0.1:20128/v1 or https://.../v1).`);let A=l.endsWith("/chat/completions")?l:`${l}/chat/completions`,C={"Content-Type":"application/json"},L=m&&m!=="LOCAL"?m:process.env.NINEROUTER_KEY||"dummy-key";C.Authorization=`Bearer ${L}`;let u=await M(A,{method:"POST",headers:C,body:JSON.stringify(U),signal:O});if(!u.ok){let r=await u.json().catch(()=>({}));throw new Error(`9router Error (${u.status}): ${r.error?.message||u.statusText}`)}let S=u.body.getReader(),W=new TextDecoder,T="",t=[],p=null,h=Date.now(),a=!1;for(;;){let{done:r,value:x}=await S.read();if(r){a&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}T+=W.decode(x,{stream:!0});let e=T.split(`
1
+ import{a as M}from"./chunk-PTFCY2D5.js";import{a as R}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var P=async function*(m,_,N,D,d,j,b,O,$=1){let y=[];D&&y.push({role:"system",content:D});for(let r of N){let x=r.role==="user"?"user":"assistant",e=[];if(Array.isArray(r.parts)){for(let o of r.parts)if(o.text)e.push({type:"text",text:o.text});else if(o.inlineData&&b){let i=o.inlineData.mimeType,c=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${c}`}})}}else{let o=r.text||"";o&&e.push({type:"text",text:o})}y.push({role:x,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=R("9router",_,d)||R("9Router",_,d),w=k!==null?k:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[d],U={model:_,messages:y,stream:!0,stream_options:{include_usage:!0},temperature:$,tools:[],tool_choice:"none"};w&&w!=="none"&&(k!==null||d!=="Fast")&&(U.reasoning_effort=w);let v=(process.env["9ROUTER_URL"]||process.env.NINEROUTER_URL||"http://127.0.0.1:20128/v1").trim(),l=v.replace(/\/+$/,"");if(!l.endsWith("/v1")&&!l.endsWith("/v1/chat/completions"))throw new Error(`Invalid 9Router URL: "${v}". Endpoint URL MUST end with /v1 (e.g. http://127.0.0.1:20128/v1 or https://.../v1).`);let A=l.endsWith("/chat/completions")?l:`${l}/chat/completions`,C={"Content-Type":"application/json"},L=m&&m!=="LOCAL"?m:process.env.NINEROUTER_KEY||"dummy-key";C.Authorization=`Bearer ${L}`;let u=await M(A,{method:"POST",headers:C,body:JSON.stringify(U),signal:O});if(!u.ok){let r=await u.json().catch(()=>({}));throw new Error(`9router Error (${u.status}): ${r.error?.message||u.statusText}`)}let S=u.body.getReader(),W=new TextDecoder,T="",t=[],p=null,h=Date.now(),a=!1;for(;;){let{done:r,value:x}=await S.read();if(r){a&&(t.length>0||p)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:p});break}T+=W.decode(x,{stream:!0});let e=T.split(`
2
2
  `);T=e.pop();for(let o of e){let i=o.trim();if(!i||!i.startsWith("data: "))continue;let c=!1;if(i==="data: [DONE]")c=!0;else try{let f=JSON.parse(i.substring(6)),n=f.choices?.[0]?.delta,s=f.usage;if(f.choices?.[0]?.finish_reason&&(c=!0),s&&(p={totalTokenCount:s.total_tokens||(s.prompt_tokens||0)+(s.completion_tokens||0),promptTokenCount:s.prompt_tokens||0,candidatesTokenCount:s.completion_tokens||0,cachedContentTokenCount:s.prompt_tokens_details?.cached_tokens||0,thoughtsTokenCount:s.completion_tokens_details?.reasoning_tokens||s.reasoning_tokens||0},a=!0),n){let g=n.reasoning_content||n.reasoning||n.thinking||null;!g&&Array.isArray(n.reasoning_details)&&n.reasoning_details.length>0&&(g=n.reasoning_details.map(E=>typeof E=="string"?E:E?.text||"").filter(Boolean).join("")),g&&(t.push({text:g,thought:!0}),a=!0),n.content&&(t.push({text:n.content}),a=!0)}}catch{}if((c||Date.now()-h>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),a=!1),c)break}Date.now()-h>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:p},t=[],h=Date.now(),a=!1)}};export{P as getNineRouterStream};
@@ -1 +1 @@
1
- import{c as i,d as m}from"./chunk-NTZSL2UT.js";import{k as n}from"./chunk-YFIWMGCS.js";var y=async(a,u={})=>{let s=(r=>{let t=new RegExp(`${r}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),o=a.match(t);return o?o[2].trim():null})("id");if(!s)return"ERROR: Missing 'id' parameter for addMemScore tool.";try{let r=i(n,[]),t=!1,o=[];for(let e of r)e.score===void 0&&(e.score=.5),e.id===s?(e.score=Math.min(2,e.score+.2),t=!0):(e.score*=.98,e.score<.05&&(e.score=0)),e.score=Math.round(e.score*1e5)/1e5,e.score>0&&o.push(e);if(m(n,o),!t)return`WARNING: Memory ID [${s}] not found. Other memories decayed by -0.01.`;let c=o.find(e=>e.id===s),f=c?c.score.toFixed(2):"deleted (score <= 0)",d=r.length-o.length;return`Adjusted memory scores. Target [${s}] is now ${f}.${d>0?` Purged ${d} decayed memories.`:""}`}catch(r){let t=r instanceof Error?r.message:String(r);return`ERROR: Failed to adjust memory score for [${s}]: ${t}`}};export{y as addMemScore};
1
+ import{c as i,d as m}from"./chunk-ZGORMZE5.js";import{k as n}from"./chunk-NPXJIGAI.js";var y=async(a,u={})=>{let s=(r=>{let t=new RegExp(`${r}\\s*[:=]\\s*(["'])(.*?)\\1(?=\\s*[,)]|\\s+\\w+\\s*[:=]|$)`,"s"),o=a.match(t);return o?o[2].trim():null})("id");if(!s)return"ERROR: Missing 'id' parameter for addMemScore tool.";try{let r=i(n,[]),t=!1,o=[];for(let e of r)e.score===void 0&&(e.score=.5),e.id===s?(e.score=Math.min(2,e.score+.2),t=!0):(e.score*=.98,e.score<.05&&(e.score=0)),e.score=Math.round(e.score*1e5)/1e5,e.score>0&&o.push(e);if(m(n,o),!t)return`WARNING: Memory ID [${s}] not found. Other memories decayed by -0.01.`;let c=o.find(e=>e.id===s),f=c?c.score.toFixed(2):"deleted (score <= 0)",d=r.length-o.length;return`Adjusted memory scores. Target [${s}] is now ${f}.${d>0?` Purged ${d} decayed memories.`:""}`}catch(r){let t=r instanceof Error?r.message:String(r);return`ERROR: Failed to adjust memory score for [${s}]: ${t}`}};export{y as addMemScore};
@@ -1 +1 @@
1
- import{A as p,B as q,C as r,D as s,E as t,F as u,G as v,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-46PS7WA4.js";import"./chunk-XPIXBWTZ.js";import"./chunk-BLAXTPPN.js";import"./chunk-56EJGQU3.js";import"./chunk-L22YGL6T.js";import"./chunk-KIPZOUEA.js";import"./chunk-BNKY5QOA.js";import"./chunk-QVRPR3DJ.js";import"./chunk-KOCMIEPK.js";import"./chunk-Y5JU726N.js";import"./chunk-25EUCCH5.js";import"./chunk-7CCULUZN.js";import"./chunk-XAPXZ6KO.js";import"./chunk-UMS5SEYB.js";import{l as a}from"./chunk-75OCC24T.js";import"./chunk-NTZSL2UT.js";import"./chunk-YFIWMGCS.js";export{c as RE_LEADING_THINK,b as convertChannelThinkTags,r as detectToolCalls,e as findGenuineThinkClose,t as generateSimpleContent,u as getAIStream,q as getActiveToolContext,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,s as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,o as maskCodeSpans,p as maskExecutedTools,n as runJanitorTask,v as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
1
+ import{A as p,B as q,C as r,D as s,E as t,F as u,G as v,m as b,n as c,o as d,p as e,q as f,r as g,s as h,t as i,u as j,v as k,w as l,x as m,y as n,z as o}from"./chunk-AUXKQKSZ.js";import"./chunk-UM5SNZ6X.js";import"./chunk-NJTM7OYZ.js";import"./chunk-56EJGQU3.js";import"./chunk-4PTLFXTU.js";import"./chunk-JMMO76HS.js";import"./chunk-BNKY5QOA.js";import"./chunk-VOUGMIAJ.js";import"./chunk-2RTYI6K3.js";import"./chunk-Y5JU726N.js";import"./chunk-3HGLLXBK.js";import"./chunk-IWIVGFAT.js";import"./chunk-5MJKHQVE.js";import"./chunk-KQNW7DK5.js";import{l as a}from"./chunk-Y6O7SAPD.js";import"./chunk-ZGORMZE5.js";import"./chunk-NPXJIGAI.js";export{c as RE_LEADING_THINK,b as convertChannelThinkTags,r as detectToolCalls,e as findGenuineThinkClose,t as generateSimpleContent,u as getAIStream,q as getActiveToolContext,j as getCleanGroupedLength,m as getGoogleClient,f as getLeadingThinkBlock,s as initAI,d as isInsideBacktick,a as isModelMultimodal,l as isTerminationSignaled,o as maskCodeSpans,p as maskExecutedTools,n as runJanitorTask,v as runSubagent,k as signalTermination,g as stripLeadingThinking,h as stripNakedXmlTags,i as stripTrailingFluffAfterTools};
@@ -1,2 +1,2 @@
1
- import{a as b}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.js";var P=async function*(M,g,C,_,k,I,A,E,H=1){let d=[];_&&d.push({role:"system",content:_});for(let s of C){let m=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&&A){let i=o.inlineData.mimeType,r=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${r}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}d.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let x=T("AIHubMix",g,k),y=x!==null?x:{Fast:"minimal",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],w={model:g,messages:d,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none"};y&&(w.reasoning_effort=y);let c=await b("https://aihubmix.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(w),signal:E});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`AIHubMix Error (${c.status}): ${s.error?.message||c.statusText}`)}let S=c.body.getReader(),$=new TextDecoder,h="",t=[],l=null,f=Date.now(),a=!1;for(;;){let{done:s,value:m}=await S.read();if(s){a&&(t.length>0||l)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:l});break}h+=$.decode(m,{stream:!0});let e=h.split(`
1
+ import{a as b}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var P=async function*(M,g,C,_,k,I,A,E,H=1){let d=[];_&&d.push({role:"system",content:_});for(let s of C){let m=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&&A){let i=o.inlineData.mimeType,r=o.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${r}`}})}}else{let o=s.text||"";o&&e.push({type:"text",text:o})}d.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let x=T("AIHubMix",g,k),y=x!==null?x:{Fast:"minimal",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[k],w={model:g,messages:d,stream:!0,stream_options:{include_usage:!0},temperature:H,tools:[],tool_choice:"none"};y&&(w.reasoning_effort=y);let c=await b("https://aihubmix.com/v1/chat/completions",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(w),signal:E});if(!c.ok){let s=await c.json().catch(()=>({}));throw new Error(`AIHubMix Error (${c.status}): ${s.error?.message||c.statusText}`)}let S=c.body.getReader(),$=new TextDecoder,h="",t=[],l=null,f=Date.now(),a=!1;for(;;){let{done:s,value:m}=await S.read();if(s){a&&(t.length>0||l)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:l});break}h+=$.decode(m,{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 r=!1;if(i==="data: [DONE]")r=!0;else try{let u=JSON.parse(i.substring(6)),p=u.choices?.[0]?.delta,n=u.usage;if(u.choices?.[0]?.finish_reason&&(r=!0),n&&(l={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),p){let D=p.reasoning_content||null;D&&(t.push({text:D,thought:!0}),a=!0),p.content&&(t.push({text:p.content}),a=!0)}}catch{}if((r||Date.now()-f>=150)&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1),r)break}Date.now()-f>=150&&a&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:l},t=[],f=Date.now(),a=!1)}};export{P as getAIHubMixStream};
@@ -1,2 +1,2 @@
1
- import{a as P}from"./chunk-PTFCY2D5.js";import{a as A}from"./chunk-XPIXBWTZ.js";import"./chunk-YFIWMGCS.js";var H=async function*(b,_,E,x,y,j,C,M,I=1){let g=[];x&&g.push({role:"system",content:x});for(let o of E){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&C){let i=n.inlineData.mimeType,p=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=A("APInex",_,y),w=k!==null?k:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],T={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:I,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let F=process.env.APINEX_URL||"https://api.apinex.bond/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},N=b||process.env.APINEX_API_KEY||"";D.Authorization=`Bearer ${N}`;let l=await P(F,{method:"POST",headers:D,body:JSON.stringify(T),signal:M});if(!l.ok){let o=await l.json().catch(()=>({}));throw new Error(`APInex Error (${l.status}): ${o.error?.message||o.message||l.statusText}`)}let v=l.body.getReader(),S=new TextDecoder,h="",t=[],c=null,u=Date.now(),s=!1;for(;;){let{done:o,value:m}=await v.read();if(o){s&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=S.decode(m,{stream:!0});let e=h.split(`
1
+ import{a as P}from"./chunk-PTFCY2D5.js";import{a as A}from"./chunk-UM5SNZ6X.js";import"./chunk-NPXJIGAI.js";var H=async function*(b,_,E,x,y,j,C,M,I=1){let g=[];x&&g.push({role:"system",content:x});for(let o of E){let m=o.role==="user"?"user":"assistant",e=[];if(Array.isArray(o.parts)){for(let n of o.parts)if(n.text)e.push({type:"text",text:n.text});else if(n.inlineData&&C){let i=n.inlineData.mimeType,p=n.inlineData.data;i.startsWith("image/")&&e.push({type:"image_url",image_url:{url:`data:${i};base64,${p}`}})}}else{let n=o.text||"";n&&e.push({type:"text",text:n})}g.push({role:m,content:e.length===1&&e[0].type==="text"?e[0].text:e})}let k=A("APInex",_,y),w=k!==null?k:{Fast:"low",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"high"}[y],T={model:_,messages:g,stream:!0,stream_options:{include_usage:!0},temperature:I,tools:[],tool_choice:"none"};w&&(T.reasoning_effort=w);let F=process.env.APINEX_URL||"https://api.apinex.bond/v1/chat/completions",D={"Content-Type":"application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow","HTTP-Referer":"https://fluxflow-cli.onrender.com/"},N=b||process.env.APINEX_API_KEY||"";D.Authorization=`Bearer ${N}`;let l=await P(F,{method:"POST",headers:D,body:JSON.stringify(T),signal:M});if(!l.ok){let o=await l.json().catch(()=>({}));throw new Error(`APInex Error (${l.status}): ${o.error?.message||o.message||l.statusText}`)}let v=l.body.getReader(),S=new TextDecoder,h="",t=[],c=null,u=Date.now(),s=!1;for(;;){let{done:o,value:m}=await v.read();if(o){s&&(t.length>0||c)&&(yield{candidates:t.length>0?[{content:{parts:t}}]:[],usageMetadata:c});break}h+=S.decode(m,{stream:!0});let e=h.split(`
2
2
  `);h=e.pop();for(let n of e){let i=n.trim();if(!i||!i.startsWith("data: "))continue;let p=!1;if(i==="data: [DONE]")p=!0;else try{let d=JSON.parse(i.substring(6)),r=d.choices?.[0]?.delta,a=d.usage;if(a&&(c={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},s=!0),r){let f=r.reasoning_content||r.reasoning||null;!f&&Array.isArray(r.reasoning_details)&&r.reasoning_details.length>0&&(f=r.reasoning_details.map($=>$.text||"").filter(Boolean).join("")),f&&(t.push({text:f,thought:!0}),s=!0),r.content&&(t.push({text:r.content}),s=!0)}}catch{}if((p||Date.now()-u>=150)&&s&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),s=!1),p)break}Date.now()-u>=150&&s&&(yield{candidates:t.length>0?[{content:{parts:[...t]}}]:[],usageMetadata:c},t=[],u=Date.now(),s=!1)}};export{H as getAPInexStream};