@fungi.computer/grove 0.5.3 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{anthropic-messages-PpjTZ9Qc.js → anthropic-messages-CPEaUutD.js} +3 -3
- package/dist/assets/{azure-openai-responses-DdemZh8C.js → azure-openai-responses-v3mj5CZZ.js} +1 -1
- package/dist/assets/burger-CPCRQtwa.js +1 -0
- package/dist/assets/cat-BxITknTO.js +1 -0
- package/dist/assets/{compat-h2yyH1GZ.js → compat-CwkWF6ok.js} +2 -2
- package/dist/assets/{extension-hook-Fy2ELDvh.js → extension-hook-Br5iAg1w.js} +2 -2
- package/dist/assets/{extensions-rDRboKAG.js → extensions-CjtnEhJO.js} +1 -1
- package/dist/assets/{google-generative-ai-Boithehn.js → google-generative-ai-Cr31vBXM.js} +1 -1
- package/dist/assets/{google-shared-DHWV3vR-.js → google-shared-B7c3mJMP.js} +1 -1
- package/dist/assets/{google-vertex-cVdfvMil.js → google-vertex-DkitNPeW.js} +1 -1
- package/dist/assets/index-CKEriJXp.js +174 -0
- package/dist/assets/index-DVjf7FkJ.css +1 -0
- package/dist/assets/{mistral-conversations-BGFb0aa0.js → mistral-conversations-BP4PIzHA.js} +1 -1
- package/dist/assets/{mushroom-BsC1isWj.js → mushroom-DWyBmJbK.js} +1 -1
- package/dist/assets/{node.browser-XnCWysIj.js → node.browser-Dxo8S8wh.js} +1 -1
- package/dist/assets/{openai-codex-responses-B-ICwYa1.js → openai-codex-responses-BIR4H8vE.js} +1 -1
- package/dist/assets/{openai-completions-CUSUFQ70.js → openai-completions-rOTfBeMc.js} +1 -1
- package/dist/assets/{openai-responses-CHRVyRhP.js → openai-responses-CDJo-fey.js} +1 -1
- package/dist/assets/{openai-responses-shared-Cm1rsG_k.js → openai-responses-shared-mHodHbGd.js} +1 -1
- package/dist/assets/{parakeet-conversation-CJ7yBye3.js → parakeet-conversation-C7vaUI2C.js} +1 -1
- package/dist/assets/{renderer-CxJalNXb.js → renderer-BMvbFBH6.js} +1 -1
- package/dist/assets/{runtime-core-B3SNLVQt.js → runtime-core-BCAZGL-z.js} +1 -1
- package/dist/assets/{transform-messages-V_M0bbzY.js → transform-messages-CiA_d5H1.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +9 -9
- package/dist/assets/burger-BGVlehwJ.js +0 -1
- package/dist/assets/cat-DdFI26cH.js +0 -1
- package/dist/assets/index-BqLkutl9.js +0 -174
- package/dist/assets/index-DRqG5MfY.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,m as t,n,s as r}from"./preload-helper-DY31Aviq.js";import{a as i}from"./diagnostics-CxvqSC4Q.js";import{n as a,t as o}from"./models-BM_0GHMS.js";import{n as s}from"./headers-FK4rgixo.js";import{h as c,i as l}from"./transform-messages-
|
|
1
|
+
import{a as e,m as t,n,s as r}from"./preload-helper-DY31Aviq.js";import{a as i}from"./diagnostics-CxvqSC4Q.js";import{n as a,t as o}from"./models-BM_0GHMS.js";import{n as s}from"./headers-FK4rgixo.js";import{h as c,i as l}from"./transform-messages-CiA_d5H1.js";import{t as u}from"./sanitize-unicode-DmIE6hZJ.js";import{n as d,t as f}from"./error-body-pkrba6pf.js";import{a as p,c as m,d as h,f as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,s as w,t as T,u as E}from"./google-shared-B7c3mJMP.js";var D=0,O=(e,t,r)=>{let a=new i,s=n(t);return(async()=>{let t={role:`assistant`,content:[],api:`google-generative-ai`,provider:e.provider,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`pending`,timestamp:Date.now()};try{if(r?.fetch&&r.fetch!==globalThis.fetch)throw Error(`Custom fetch is not supported by the Google Generative AI adapter`);let n=r?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let i=A(e,n,r?.headers),c=j(e,s,r),l=await r?.onPayload?.(c,e);l!==void 0&&(c=l);let u=await v(()=>i.models.generateContentStream(c),r);a.push({type:`start`,partial:t});let d=null,f=t.content,h=()=>f.length-1;for await(let n of u){await r?.onProviderStreamEvent?.(n,e),t.responseId||=n.responseId;let i=n.candidates?.[0];if(i?.content?.parts)for(let e of i.content.parts){if(e.text!==void 0){let n=_(e);(!d||n&&d.type!==`thinking`||!n&&d.type!==`text`)&&(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:f.length-1,content:d.text,partial:t}):a.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:t})),n?(d={type:`thinking`,thinking:``,thinkingSignature:void 0},t.content.push(d),a.push({type:`thinking_start`,contentIndex:h(),partial:t})):(d={type:`text`,text:``},t.content.push(d),a.push({type:`text_start`,contentIndex:h(),partial:t}))),d.type===`thinking`?(d.thinking+=e.text,d.thinkingSignature=m(d.thinkingSignature,e.thoughtSignature),a.push({type:`thinking_delta`,contentIndex:h(),delta:e.text,partial:t})):(d.text+=e.text,d.textSignature=m(d.textSignature,e.thoughtSignature),a.push({type:`text_delta`,contentIndex:h(),delta:e.text,partial:t}))}if(e.functionCall){d&&=(d.type===`text`?a.push({type:`text_end`,contentIndex:h(),content:d.text,partial:t}):a.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:t}),null);let n=e.functionCall.id,r={type:`toolCall`,id:!n||t.content.some(e=>e.type===`toolCall`&&e.id===n)?`${e.functionCall.name}_${Date.now()}_${++D}`:n,name:e.functionCall.name||``,arguments:e.functionCall.args??{},...e.thoughtSignature&&{thoughtSignature:e.thoughtSignature}};t.content.push(r),a.push({type:`toolcall_start`,contentIndex:h(),partial:t}),a.push({type:`toolcall_delta`,contentIndex:h(),delta:JSON.stringify(r.arguments),partial:t}),a.push({type:`toolcall_end`,contentIndex:h(),toolCall:r,partial:t})}}i?.finishReason&&(t.rawStopReason=i.finishReason,t.stopReason=p(i.finishReason),t.content.some(e=>e.type===`toolCall`)&&t.stopReason===`stop`&&(t.stopReason=`toolUse`)),n.usageMetadata&&(t.usage={input:(n.usageMetadata.promptTokenCount||0)-(n.usageMetadata.cachedContentTokenCount||0),output:(n.usageMetadata.candidatesTokenCount||0)+(n.usageMetadata.thoughtsTokenCount||0),cacheRead:n.usageMetadata.cachedContentTokenCount||0,cacheWrite:0,reasoning:n.usageMetadata.thoughtsTokenCount||0,totalTokens:n.usageMetadata.totalTokenCount||0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},o(e,t.usage))}if(d&&(d.type===`text`?a.push({type:`text_end`,contentIndex:h(),content:d.text,partial:t}):a.push({type:`thinking_end`,contentIndex:h(),content:d.thinking,partial:t})),r?.signal?.aborted)throw Error(`Request was aborted`);if(t.stopReason===`pending`)throw Error(`Google stream ended without a finish reason`);if(t.stopReason===`aborted`||t.stopReason===`error`){let e=t.rawStopReason?`Provider stopped with: ${t.rawStopReason}`:`An unknown error occurred`;throw Error(e)}a.push({type:`done`,reason:t.stopReason,message:t}),a.end()}catch(e){for(let e of t.content)`index`in e&&delete e.index;t.stopReason=r?.signal?.aborted?`aborted`:`error`,t.errorMessage=f(d(e)),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},k=(e,t,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let i={...l(e,t,n,r),toolChoice:n?.toolChoice};if(!n?.reasoning)return O(e,t,{...i,thinking:{enabled:!1}});let o=a(e,n.reasoning);if(o===`off`)return O(e,t,{...i,thinking:{enabled:!1}});let s=w(e,o);return S(e)?O(e,t,{...i,thinking:{enabled:!0,level:g(s)}}):O(e,t,{...i,thinking:{enabled:!0,budgetTokens:M(e,s,n.thinkingBudgets)}})};function A(e,t,n){let r={};e.baseUrl&&(r.baseUrl=e.baseUrl,r.apiVersion=``);let i=s({"User-Agent":c(),...e.headers,...n});return i&&(r.headers=i),new y({apiKey:t,httpOptions:Object.keys(r).length>0?r:void 0})}function j(n,i,a={}){let o=T(n,i),s=r(i.messages),c=e(i.messages),l={};a.temperature!==void 0&&(l.temperature=a.temperature),a.maxTokens!==void 0&&(l.maxOutputTokens=a.maxTokens);let d=E(n.id),f=c.length>0?x(c,a.toolChoice,d):void 0,p=s?t(s):``,m={...Object.keys(l).length>0&&l,...p&&{systemInstruction:u(p)},...c.length>0&&{tools:b(c,!1,d)},...f!==void 0&&{toolConfig:{functionCallingConfig:{mode:f}}}};if(a.thinking?.enabled&&n.reasoning){let e={includeThoughts:!0};a.thinking.level===void 0?a.thinking.budgetTokens!==void 0&&(e.thinkingBudget=a.thinking.budgetTokens):e.thinkingLevel=h(a.thinking.level),m.thinkingConfig=e}else n.reasoning&&a.thinking&&!a.thinking.enabled&&(m.thinkingConfig=C(n));if(a.signal){if(a.signal.aborted)throw Error(`Request aborted`);m.abortSignal=a.signal}return{model:n.id,contents:o,config:m}}function M(e,t,n){return n?.[t]===void 0?e.id.includes(`2.5-pro`)?{minimal:128,low:2048,medium:8192,high:32768}[t]:e.id.includes(`2.5-flash-lite`)?{minimal:512,low:2048,medium:8192,high:24576}[t]:e.id.includes(`2.5-flash`)?{minimal:128,low:2048,medium:8192,high:24576}[t]:-1:n[t]}export{O as stream,k as streamSimple};
|