fluxflow-cli 5.1.0 → 5.2.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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{9router-LRFKCJF4.js → 9router-KRJQK6JP.js} +1 -1
  3. package/dist/chunks/{addMemScore-PBVNSFPN.js → addMemScore-VUSJ2Q64.js} +1 -1
  4. package/dist/chunks/ai-BINPY3GV.js +1 -0
  5. package/dist/chunks/{aihubmix-TETL5QYQ.js → aihubmix-KJIG7CZO.js} +1 -1
  6. package/dist/chunks/{apinex-FAYOPQSL.js → apinex-EP3JJPZO.js} +1 -1
  7. package/dist/chunks/app-DRT7CX3P.js +331 -0
  8. package/dist/chunks/{auto_completion-FUOGJILX.js → auto_completion-I2GVIND6.js} +1 -1
  9. package/dist/chunks/{chat-ISCVWNVN.js → chat-OYRESDTX.js} +1 -1
  10. package/dist/chunks/{chunk-QESQR5GB.js → chunk-25EUCCH5.js} +1 -1
  11. package/dist/chunks/chunk-75OCC24T.js +2 -0
  12. package/dist/chunks/{chunk-J4J3F6BT.js → chunk-7CCULUZN.js} +1 -1
  13. package/dist/chunks/{chunk-52STSLCN.js → chunk-BLAXTPPN.js} +1 -1
  14. package/dist/chunks/chunk-BM4FWHBO.js +885 -0
  15. package/dist/chunks/{chunk-UIL6OCU4.js → chunk-BNKY5QOA.js} +2 -2
  16. package/dist/chunks/{chunk-IHDJDAG3.js → chunk-E5CFO23P.js} +1 -1
  17. package/dist/chunks/chunk-KIPZOUEA.js +44 -0
  18. package/dist/chunks/{chunk-6EYQQ7GQ.js → chunk-KOCMIEPK.js} +1 -1
  19. package/dist/chunks/chunk-L22YGL6T.js +15 -0
  20. package/dist/chunks/{chunk-P5HBJA23.js → chunk-NTZSL2UT.js} +1 -1
  21. package/dist/chunks/{chunk-EXT42EJZ.js → chunk-QVRPR3DJ.js} +1 -1
  22. package/dist/chunks/{chunk-GM5VNNTU.js → chunk-RINQH4H4.js} +1 -1
  23. package/dist/chunks/{chunk-B4UKMX5E.js → chunk-UMS5SEYB.js} +1 -1
  24. package/dist/chunks/{chunk-ZNO55RNG.js → chunk-VDO5TP6E.js} +1 -1
  25. package/dist/chunks/{chunk-V36DXF56.js → chunk-XAPXZ6KO.js} +1 -1
  26. package/dist/chunks/{chunk-HFTI3R3Q.js → chunk-XPIXBWTZ.js} +1 -1
  27. package/dist/chunks/{chunk-GBH7XI5A.js → chunk-XRTIQISS.js} +1 -1
  28. package/dist/chunks/chunk-YFIWMGCS.js +2 -0
  29. package/dist/chunks/{click-AWHZCV2E.js → click-3BB6KDIJ.js} +2 -2
  30. package/dist/chunks/{computer_action-MO2JR2XH.js → computer_action-6RHVNLZG.js} +1 -1
  31. package/dist/chunks/custom_openai-ODYQEMOR.js +3 -0
  32. package/dist/chunks/{deepseek-WNWZJTNE.js → deepseek-I2J4A7WQ.js} +1 -1
  33. package/dist/chunks/{drag-D2GVPIQB.js → drag-ZGNVQGXW.js} +1 -1
  34. package/dist/chunks/{emergency_rollback-ZHQXCIHW.js → emergency_rollback-LC4ZBOLP.js} +1 -1
  35. package/dist/chunks/{exec_command-6V5SM6WI.js → exec_command-SQB5LU5X.js} +1 -1
  36. package/dist/chunks/{explabs-XHHXTERB.js → explabs-OYP64XS6.js} +1 -1
  37. package/dist/chunks/{export-RU6LCZUB.js → export-I5DB7ESY.js} +1 -1
  38. package/dist/chunks/{file_map-UA4BA5OH.js → file_map-K6JQYV35.js} +1 -1
  39. package/dist/chunks/find_file-5RUNVQJO.js +4 -0
  40. package/dist/chunks/{generate_image-45UQ6P2B.js → generate_image-7UBJ3ODS.js} +1 -1
  41. package/dist/chunks/{inferx-HP5AGET3.js → inferx-B6PKXWLZ.js} +1 -1
  42. package/dist/chunks/{infron-ULXG7VDA.js → infron-4SLX3HMD.js} +1 -1
  43. package/dist/chunks/{invoke-HKCOHTBD.js → invoke-IXWW3N4C.js} +2 -2
  44. package/dist/chunks/{invokeSync-NWRHVGJ3.js → invokeSync-EUHHQZ2H.js} +2 -2
  45. package/dist/chunks/{key_press-AQNKL6UM.js → key_press-LO75QEJK.js} +1 -1
  46. package/dist/chunks/{keyboard_typing-QSBPTZJ6.js → keyboard_typing-DJ3HHTO7.js} +1 -1
  47. package/dist/chunks/{memory-7YOYCOXE.js → memory-AT7ARTG3.js} +1 -1
  48. package/dist/chunks/{mistral-ON6RQMK7.js → mistral-H23J6UYA.js} +1 -1
  49. package/dist/chunks/model_config-IVWGOIBK.js +1 -0
  50. package/dist/chunks/{nvidia-I6DPWP6U.js → nvidia-BUWXTYGV.js} +1 -1
  51. package/dist/chunks/{ollama-6WSZPCI5.js → ollama-53BJCQQX.js} +1 -1
  52. package/dist/chunks/{openrouter-6MRG4RT6.js → openrouter-LSG67TST.js} +1 -1
  53. package/dist/chunks/paths-MJECGRI2.js +1 -0
  54. package/dist/chunks/{poolside-ODFAIK4C.js → poolside-KWCBEP3P.js} +1 -1
  55. package/dist/chunks/{recapture_screen-PPXYK2YY.js → recapture_screen-LONV6G4U.js} +1 -1
  56. package/dist/chunks/{saveSummary-W2JMDVZJ.js → saveSummary-ZJDPCZSR.js} +1 -1
  57. package/dist/chunks/{screen_grid-3RU324CV.js → screen_grid-LK6IVH4B.js} +1 -1
  58. package/dist/chunks/{scroll-TSU6MTGU.js → scroll-XBXSN2EF.js} +1 -1
  59. package/dist/chunks/search_keyword-IRLPX555.js +9 -0
  60. package/dist/chunks/{secrets-TNMLVMST.js → secrets-LHP6ATGQ.js} +1 -1
  61. package/dist/chunks/{secrets_v2-OBRWR3UT.js → secrets_v2-4ZICSEV6.js} +1 -1
  62. package/dist/chunks/{sensenova-3K44URJQ.js → sensenova-MLFZTP7U.js} +1 -1
  63. package/dist/chunks/settings-IZC7UDNU.js +1 -0
  64. package/dist/chunks/{todo-CJLWLWJB.js → todo-YFLPXYFL.js} +1 -1
  65. package/dist/chunks/{tokenharbor-YV2GV2LM.js → tokenharbor-Y6HSTTHA.js} +1 -1
  66. package/dist/chunks/update_file-CH6YILXO.js +15 -0
  67. package/dist/chunks/{usage-EBE2OVES.js → usage-G7HRNQNU.js} +1 -1
  68. package/dist/chunks/{usageServer-RTK5N5KE.js → usageServer-SHBKSO4I.js} +13 -5
  69. package/dist/chunks/view_file-OYV2IEYG.js +1 -0
  70. package/dist/chunks/{web_scrape-J3PL2PXT.js → web_scrape-MVSCRDKO.js} +1 -1
  71. package/dist/chunks/{web_search-KBGH67IV.js → web_search-C3WKDOSZ.js} +1 -1
  72. package/dist/chunks/{write_docx-E3MTFXTQ.js → write_docx-QGW25TF7.js} +1 -1
  73. package/dist/chunks/write_file-WX4O436W.js +34 -0
  74. package/dist/chunks/{write_pdf-TPGUF4VT.js → write_pdf-5HOQYVQO.js} +1 -1
  75. package/dist/chunks/{xkiro-B2LYGZTF.js → xkiro-D3DTPVWY.js} +1 -1
  76. package/dist/cli.js +8 -8
  77. package/dist/package.json +2 -2
  78. package/package.json +2 -2
  79. package/dist/chunks/ai-ZMBQQ3QP.js +0 -1
  80. package/dist/chunks/app-DJV7SIS6.js +0 -325
  81. package/dist/chunks/chunk-26BQ45XP.js +0 -2
  82. package/dist/chunks/chunk-4BLSASW6.js +0 -13
  83. package/dist/chunks/chunk-7SGZ66KT.js +0 -44
  84. package/dist/chunks/chunk-LQM3JK7N.js +0 -1
  85. package/dist/chunks/chunk-WS35FH7W.js +0 -866
  86. package/dist/chunks/custom_openai-K554R7Q5.js +0 -3
  87. package/dist/chunks/find_file-HYHHFHUJ.js +0 -4
  88. package/dist/chunks/model_config-QRYAVWHF.js +0 -1
  89. package/dist/chunks/paths-RQRI2XRY.js +0 -1
  90. package/dist/chunks/search_keyword-4W6Q7Q7T.js +0 -8
  91. package/dist/chunks/settings-PUFSRWT3.js +0 -1
  92. package/dist/chunks/update_file-TGEB5UWK.js +0 -13
  93. package/dist/chunks/view_file-I77KYUO5.js +0 -1
  94. package/dist/chunks/write_file-O6OF7Z2W.js +0 -32
package/README.md CHANGED
@@ -39,7 +39,7 @@ fluxflow-cli
39
39
  - **CrofAI** (*Removed from v4.16 onwards*)
40
40
  - **InferX**
41
41
  - **SenseNovaAI**
42
- - **Poolside**
42
+ - **Poolside** (*Removed due to provider inference shutdown*)
43
43
  - **Token Harbor**
44
44
  - **APInex**
45
45
  - **Infron**
@@ -1,2 +1,2 @@
1
- import{a as M}from"./chunk-PTFCY2D5.js";import{a as R}from"./chunk-HFTI3R3Q.js";import"./chunk-26BQ45XP.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-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(`
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-P5HBJA23.js";import{k as n}from"./chunk-26BQ45XP.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-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};
@@ -0,0 +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-BM4FWHBO.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,2 +1,2 @@
1
- import{a as b}from"./chunk-PTFCY2D5.js";import{a as T}from"./chunk-HFTI3R3Q.js";import"./chunk-26BQ45XP.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-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(`
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-HFTI3R3Q.js";import"./chunk-26BQ45XP.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-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(`
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};