edoardo 1.0.6 → 1.0.8

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.
@@ -70,7 +70,13 @@ ${c}
70
70
  \`\`\``}}}catch{}}return r});return{...a,content:o}}function $x(a){const o=a.split("__");return o.length!==2?null:{pluginId:o[0],toolName:o[1]}}async function Hj(a,o,r,i="gpt-5.2",c=!1){const f=o.map(S=>S.role==="tool"?{role:"tool",tool_call_id:S.toolCallId,content:S.content}:S.role==="assistant"&&S.toolCalls&&S.toolCalls.length>0?{role:"assistant",content:S.content||null,tool_calls:S.toolCalls.map(C=>({id:C.id,type:"function",function:{name:C.name,arguments:JSON.stringify(C.arguments)}}))}:{role:S.role,content:S.content}),m={model:i,messages:f,stream:c};r&&r.length>0&&(m.tools=r,m.tool_choice="auto");const h=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(m)});if(!h.ok){const S=await h.json().catch(()=>({}));throw new Error(S.error?.message||`OpenAI API error: ${h.status}`)}if(c){const S=h.body?.getReader(),C=new TextDecoder;if(!S)throw new Error("No response body reader available");let b="",N=new Map,E="stop";try{for(;;){const{done:A,value:O}=await S.read();if(A)break;const D=C.decode(O,{stream:!0}).split(`
71
71
  `).filter(V=>V.trim()!=="");for(const V of D)if(V.startsWith("data: ")){const K=V.slice(6);if(K==="[DONE]")continue;try{const k=JSON.parse(K).choices?.[0];if(!k)continue;const Y=k.delta;if(Y?.content&&(b+=Y.content),Y?.tool_calls)for(const ee of Y.tool_calls){const ae=ee.index,ne=N.get(ae)||{arguments:""};ee.id&&(ne.id=ee.id),ee.function?.name&&(ne.name=ee.function.name),ee.function?.arguments&&(ne.arguments+=ee.function.arguments),N.set(ae,ne)}k.finish_reason&&(E=k.finish_reason==="tool_calls"?"tool_calls":"stop")}catch(J){console.warn("[OpenAI SSE] Failed to parse line:",V,J)}}}}finally{S.releaseLock()}if(E==="tool_calls"&&N.size>0){const A=[];return N.forEach(O=>{O.id&&O.name&&A.push({id:O.id,name:O.name,arguments:JSON.parse(O.arguments||"{}")})}),{content:b||"",toolCalls:A,finishReason:"tool_calls"}}return{content:b||"No response from OpenAI",finishReason:"stop"}}const g=(await h.json()).choices[0],x=g?.message;return g?.finish_reason==="tool_calls"&&x?.tool_calls?{content:x.content||"",toolCalls:x.tool_calls.map(S=>({id:S.id,name:S.function.name,arguments:JSON.parse(S.function.arguments||"{}")})),finishReason:"tool_calls"}:{content:x?.content||"No response from OpenAI",finishReason:"stop"}}async function Pj(a,o,r="llama-3.1-sonar-large-128k-online",i=!1){const c=o.filter(p=>p.role!=="tool").map(p=>({role:p.role==="user"?"user":"assistant",content:p.content})),f=await fetch("https://api.perplexity.ai/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r,messages:c,stream:i})});if(!f.ok){const p=await f.json().catch(()=>({}));throw new Error(p.error?.message||`Perplexity API error: ${f.status}`)}return{content:(await f.json()).choices?.[0]?.message?.content||"No response from Perplexity",finishReason:"stop"}}function Gj(a){return a==="grok-imagine-image"||a==="grok-imagine-image-pro"}function Vj(a){return a==="grok-imagine-video"}async function qj(a,o,r="grok-imagine-image"){const i=await fetch("https://api.x.ai/v1/images/generations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r,prompt:o,n:1})});if(!i.ok){const h=await i.json().catch(()=>({}));throw new Error(h.error?.message||`Grok Image API error: ${i.status}`)}const f=(await i.json()).data||[];return f.length===0?{content:"No image was generated",finishReason:"stop"}:{content:f.map((h,p)=>h.url?`![Generated Image ${p+1}](${h.url})`:h.b64_json?`![Generated Image ${p+1}](data:image/png;base64,${h.b64_json})`:"").filter(Boolean).join(`
72
72
 
73
- `)||"Image generated but no URL returned",finishReason:"stop"}}async function Yj(a,o,r="grok-imagine-video"){const i=await fetch("https://api.x.ai/v1/videos/generations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r,prompt:o})});if(!i.ok){const h=await i.json().catch(()=>({}));throw new Error(h.error?.message||`Grok Video API error: ${i.status}`)}const f=(await i.json()).data||[];return f.length===0?{content:"No video was generated",finishReason:"stop"}:{content:f.map((h,p)=>h.url?`🎬 **Generated Video ${p+1}**
73
+ `)||"Image generated but no URL returned",finishReason:"stop"}}async function Yj(a,o,r="grok-imagine-video"){const i=await fetch("https://api.x.ai/v1/videos/generations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify({model:r,prompt:o})});if(!i.ok){const h=await i.json().catch(()=>({}));throw new Error(h.error?.message||`Grok Video API error: ${i.status}`)}const c=await i.json();if(c.request_id)return{content:`🎬 **Video generation started!**
74
+
75
+ Your video is being generated. This process can take a few minutes.
76
+
77
+ **Request ID:** \`${c.request_id}\`
78
+
79
+ Check your xAI console or use the API to retrieve the result when ready.`,finishReason:"stop"};const f=c.data||[];return f.length===0?{content:"Video generation initiated but no immediate result. Check xAI console.",finishReason:"stop"}:{content:f.map((h,p)=>h.url?`🎬 **Generated Video ${p+1}**
74
80
 
75
81
  [Click to view video](${h.url})`:"").filter(Boolean).join(`
76
82
 
package/dist/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <title>Edoardo</title>
8
- <script type="module" crossorigin src="/assets/index-jEp4Zb3j.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-B9SBtUwA.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-Cp6s2BCA.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edoardo",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "AI Agent with MCP plugin support - Chat with AI models and extend capabilities with plugins",
5
5
  "type": "module",
6
6
  "bin": {