@fungi.computer/grove 0.0.0-stage → 0.0.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.
- package/LICENSE +21 -0
- package/README.md +106 -2
- package/dist/assets/Effect-BEduymlz.js +76 -0
- package/dist/assets/MapleMono-VF-CCDrizxw.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-cyrillic-BsWUdSU9.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-cyrillic-ext-Cb1j0nGJ.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-latin-BYs3GYNf.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-latin-ext-0RvtKGDy.woff2 +0 -0
- package/dist/assets/Nunito-VF-8c6a9bb-vietnamese-cS2dauUA.woff2 +0 -0
- package/dist/assets/anthropic-messages-Bnv5qjAJ.js +41 -0
- package/dist/assets/azure-openai-responses-QZaJy-8U.js +1 -0
- package/dist/assets/base-face-CJPKiwfc.js +1 -0
- package/dist/assets/burger-DMbWZ2jd.js +1 -0
- package/dist/assets/cat-UfLh6DHG.js +1 -0
- package/dist/assets/cloudflare-workers-ai-system-one-Bq-3_D9p.js +1 -0
- package/dist/assets/compat-CvJ9Wfru.js +2 -0
- package/dist/assets/diagnostics-CmW2yJSB.js +1 -0
- package/dist/assets/error-CJ3RHG07.js +1 -0
- package/dist/assets/error-body-pkrba6pf.js +1 -0
- package/dist/assets/extension-hook-DvcdepgP.js +560 -0
- package/dist/assets/extensions-1Fd4Wd8r.js +1 -0
- package/dist/assets/github-copilot-headers-DRgtIyTm.js +1 -0
- package/dist/assets/google-generative-ai-DP-8xZvz.js +1 -0
- package/dist/assets/google-shared-Cs5udoZV.js +8 -0
- package/dist/assets/google-vertex-BJiAIGUd.js +1 -0
- package/dist/assets/hash-yQufAZII.js +1 -0
- package/dist/assets/headers-FK4rgixo.js +1 -0
- package/dist/assets/index-DBHVAvuX.css +1 -0
- package/dist/assets/index-hJphFjkO.js +171 -0
- package/dist/assets/json-parse-nqKewMRF.js +3 -0
- package/dist/assets/mistral-conversations-mRYg3mWw.js +4 -0
- package/dist/assets/models-CcNnosqL.js +1 -0
- package/dist/assets/mushroom-BBaCYNmw.js +1 -0
- package/dist/assets/node.browser-CwSOSQcL.js +1 -0
- package/dist/assets/node.browser-DFtqp6Hr.js +1 -0
- package/dist/assets/openai-Cpe0uoXQ.js +19 -0
- package/dist/assets/openai-codex-responses-BMz-j1hp.js +9 -0
- package/dist/assets/openai-completions-BxBCgHHI.js +5 -0
- package/dist/assets/openai-prompt-cache-DXo9f3w5.js +1 -0
- package/dist/assets/openai-responses-cvwOEFWg.js +1 -0
- package/dist/assets/openai-responses-shared-DzD8B6NI.js +10 -0
- package/dist/assets/openrouter-images-DwousKhc.js +1 -0
- package/dist/assets/parakeet-conversation-C3pQoKx-.js +3 -0
- package/dist/assets/parakeet-conversation-COndlivb.css +1 -0
- package/dist/assets/pi-messages-CfXPQ4jp.js +7 -0
- package/dist/assets/preload-helper-mbhLTglw.js +8 -0
- package/dist/assets/provider-env-CcCbsTJq.js +1 -0
- package/dist/assets/provider-retry-CSlu6hjs.js +1 -0
- package/dist/assets/renderer-BdjuCi44.js +1 -0
- package/dist/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/dist/assets/runtime-core-CvcjUkf6.js +2 -0
- package/dist/assets/sanitize-unicode-DmIE6hZJ.js +1 -0
- package/dist/assets/system-one-shared-CGF8IYMZ.js +1 -0
- package/dist/assets/transform-messages-CrQEqmfx.js +1 -0
- package/dist/assets/typesafe-system-one-CWcJw-Ys.js +1 -0
- package/dist/index.html +17 -0
- package/package.json +172 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{t as e}from"./rolldown-runtime-hePW80VL.js";var t=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.ALL=e.COLLECTION=e.ATOM=e.SPECIAL=e.INF=e._INFINITY=e.INFINITY=e.NAN=e.BOOL=e.NULL=e.OBJ=e.ARR=e.NUM=e.STR=void 0,e.STR=1,e.NUM=2,e.ARR=4,e.OBJ=8,e.NULL=16,e.BOOL=32,e.NAN=64,e.INFINITY=128,e._INFINITY=256,e.INF=e.INFINITY|e._INFINITY,e.SPECIAL=e.NULL|e.BOOL|e.INF|e.NAN,e.ATOM=e.STR|e.NUM|e.SPECIAL,e.COLLECTION=e.ARR|e.OBJ,e.ALL=e.ATOM|e.COLLECTION,e.Allow={STR:e.STR,NUM:e.NUM,ARR:e.ARR,OBJ:e.OBJ,NULL:e.NULL,BOOL:e.BOOL,NAN:e.NAN,INFINITY:e.INFINITY,_INFINITY:e._INFINITY,INF:e.INF,SPECIAL:e.SPECIAL,ATOM:e.ATOM,COLLECTION:e.COLLECTION,ALL:e.ALL},e.default=e.Allow})),n=e((e=>{var n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.Allow=e.MalformedJSON=e.PartialJSON=e.parseJSON=e.parse=void 0;var i=t();Object.defineProperty(e,"Allow",{enumerable:!0,get:function(){return i.Allow}}),r(t(),e);var a=class extends Error{};e.PartialJSON=a;var o=class extends Error{};e.MalformedJSON=o;function s(e,t=i.Allow.ALL){if(typeof e!=`string`)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return c(e.trim(),t)}e.parseJSON=s;var c=(e,t)=>{let n=e.length,r=0,s=e=>{throw new a(`${e} at position ${r}`)},c=e=>{throw new o(`${e} at position ${r}`)},l=()=>(m(),r>=n&&s(`Unexpected end of input`),e[r]===`"`?u():e[r]===`{`?d():e[r]===`[`?f():e.substring(r,r+4)===`null`||i.Allow.NULL&t&&n-r<4&&`null`.startsWith(e.substring(r))?(r+=4,null):e.substring(r,r+4)===`true`||i.Allow.BOOL&t&&n-r<4&&`true`.startsWith(e.substring(r))?(r+=4,!0):e.substring(r,r+5)===`false`||i.Allow.BOOL&t&&n-r<5&&`false`.startsWith(e.substring(r))?(r+=5,!1):e.substring(r,r+8)===`Infinity`||i.Allow.INFINITY&t&&n-r<8&&`Infinity`.startsWith(e.substring(r))?(r+=8,1/0):e.substring(r,r+9)===`-Infinity`||i.Allow._INFINITY&t&&1<n-r&&n-r<9&&`-Infinity`.startsWith(e.substring(r))?(r+=9,-1/0):e.substring(r,r+3)===`NaN`||i.Allow.NAN&t&&n-r<3&&`NaN`.startsWith(e.substring(r))?(r+=3,NaN):p()),u=()=>{let a=r,o=!1;for(r++;r<n&&(e[r]!==`"`||o&&e[r-1]===`\\`);)o=e[r]===`\\`&&!o,r++;if(e.charAt(r)==`"`)try{return JSON.parse(e.substring(a,++r-Number(o)))}catch(e){c(String(e))}else if(i.Allow.STR&t)try{return JSON.parse(e.substring(a,r-Number(o))+`"`)}catch{return JSON.parse(e.substring(a,e.lastIndexOf(`\\`))+`"`)}s(`Unterminated string literal`)},d=()=>{r++,m();let a={};try{for(;e[r]!==`}`;){if(m(),r>=n&&i.Allow.OBJ&t)return a;let o=u();m(),r++;try{a[o]=l()}catch(e){if(i.Allow.OBJ&t)return a;throw e}m(),e[r]===`,`&&r++}}catch{if(i.Allow.OBJ&t)return a;s(`Expected '}' at end of object`)}return r++,a},f=()=>{r++;let n=[];try{for(;e[r]!==`]`;)n.push(l()),m(),e[r]===`,`&&r++}catch{if(i.Allow.ARR&t)return n;s(`Expected ']' at end of array`)}return r++,n},p=()=>{if(r===0){e===`-`&&c(`Not sure what '-' is`);try{return JSON.parse(e)}catch(n){if(i.Allow.NUM&t)try{return JSON.parse(e.substring(0,e.lastIndexOf(`e`)))}catch{}c(String(n))}}let a=r;for(e[r]===`-`&&r++;e[r]&&`,]}`.indexOf(e[r])===-1;)r++;r==n&&!(i.Allow.NUM&t)&&s(`Unterminated number literal`);try{return JSON.parse(e.substring(a,r))}catch{e.substring(a,r)===`-`&&s(`Not sure what '-' is`);try{return JSON.parse(e.substring(a,e.lastIndexOf(`e`)))}catch(e){c(String(e))}}},m=()=>{for(;r<n&&`
|
|
2
|
+
\r `.includes(e[r]);)r++};return l()};e.parse=s}))(),r=new Set([`"`,`\\`,`/`,`b`,`f`,`n`,`r`,`t`,`u`]);function i(e){let t=e.codePointAt(0);return t!==void 0&&t>=0&&t<=31}function a(e){switch(e){case`\b`:return`\\b`;case`\f`:return`\\f`;case`
|
|
3
|
+
`:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;default:return`\\u${e.codePointAt(0)?.toString(16).padStart(4,`0`)??`0000`}`}}function o(e){let t=``,n=!1;for(let o=0;o<e.length;o++){let s=e[o];if(!n){t+=s,s===`"`&&(n=!0);continue}if(s===`"`){t+=s,n=!1;continue}if(s===`\\`){let n=e[o+1];if(n===void 0){t+=`\\\\`;continue}if(n===`u`){let n=e.slice(o+2,o+6);if(/^[0-9a-fA-F]{4}$/.test(n)){t+=`\\u${n}`,o+=5;continue}}if(r.has(n)){t+=`\\${n}`,o+=1;continue}t+=`\\\\`;continue}t+=i(s)?a(s):s}return t}function s(e){try{return JSON.parse(e)}catch(t){let n=o(e);if(n!==e)return JSON.parse(n);throw t}}function c(e){if(!e||e.trim()===``)return{};try{return s(e)}catch{try{return(0,n.parse)(e)??{}}catch{try{return(0,n.parse)(o(e))??{}}catch{return{}}}}}export{c as n,o as r,s as t};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{_ as e,f as t,o as n,v as r}from"./preload-helper-mbhLTglw.js";import{a as i}from"./diagnostics-CmW2yJSB.js";import{n as a,t as o}from"./models-CcNnosqL.js";import{t as s}from"./headers-FK4rgixo.js";import{n as c}from"./json-parse-nqKewMRF.js";import{f as l,p as u,r as d,t as f,u as p}from"./transform-messages-CrQEqmfx.js";import{t as m}from"./sanitize-unicode-DmIE6hZJ.js";import{t as h}from"./hash-yQufAZII.js";var g=9,_=4e3,v=(e,n,r)=>{let a=new i,o=t(n,e.compat?.supportsMidConvoSystemMessages);return(async()=>{let t=b(e);try{let n=r?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let i=x(),s=f(o.messages,e,e=>i(e)),c=B(e,o,s,r),l=await r?.onPayload?.(c,e);l!==void 0&&(c=l);let u=await E(e,c,n,r);if(a.push({type:`start`,partial:t}),await U(e,t,a,u,r?.onProviderStreamEvent),r?.signal?.aborted)throw Error(`Request was aborted`);if(t.stopReason===`pending`)throw Error(`Mistral stream ended without a finish reason`);if(t.stopReason===`aborted`||t.stopReason===`error`)throw Error(t.errorMessage||`An unknown error occurred`);a.push({type:`done`,reason:t.stopReason,message:t}),a.end()}catch(e){for(let e of t.content)delete e.partialArgs;t.stopReason=r?.signal?.aborted?`aborted`:`error`,t.errorMessage=C(e),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},y=(e,t,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let i={...d(e,t,n,r),toolChoice:n?.toolChoice},o=n?.reasoning?a(e,n.reasoning):void 0,s=o===`off`?void 0:o,c=e.reasoning?e.thinkingLevelMap:void 0,l=c?s?c[s]??`high`:c.off??void 0:void 0;return v(e,t,{...i,promptMode:e.reasoning&&!c&&s?`reasoning`:void 0,reasoningEffort:l})};function b(e){return{role:`assistant`,content:[],api:e.api,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()}}function x(){let e=new Map,t=new Map;return n=>{let r=e.get(n);if(r)return r;let i=0;for(;;){let r=S(n,i),a=t.get(r);if(!a||a===n)return e.set(n,r),t.set(r,n),r;i++}}}function S(e,t){let n=e.replace(/[^a-zA-Z0-9]/g,``);if(t===0&&n.length===g)return n;let r=n||e,i=t===0?r:`${r}:${t}`;return h(i).replace(/[^a-zA-Z0-9]/g,``).slice(0,g)}function C(e){if(e instanceof Error){let t=e,n=typeof t.statusCode==`number`?t.statusCode:void 0,r=typeof t.body==`string`?t.body.trim():void 0;return n!==void 0&&r?`Mistral API error (${n}): ${w(r,_)}`:n===void 0?e.message:`Mistral API error (${n}): ${e.message}`}return T(e)}function w(e,t){return e.length<=t?e:`${e.slice(0,t)}... [truncated ${e.length-t} chars]`}function T(e){try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}async function E(e,t,n,r){let i=new URL(e.baseUrl);i.pathname=`${i.pathname.replace(/\/+$/u,``)}/`;let a=new URL(`v1/chat/completions`,i),o=O(e,n,r),c=AbortSignal.timeout(r?.timeoutMs??6e4),l=r?.signal?AbortSignal.any([r.signal,c]):c,u=await(r?.fetch??globalThis.fetch)(a,{method:`POST`,headers:o,body:JSON.stringify(j(t)),signal:l});if(await r?.onResponse?.({status:u.status,headers:s(u.headers)},e),!u.ok){let e=await u.text();throw new D(u.status,e,u.statusText)}if(!u.body)throw Error(`Mistral response has no body`);return L(u.body,l)}var D=class extends Error{statusCode;body;constructor(e,t,n){super(n||`Request failed with status ${e}`),this.name=`MistralHttpError`,this.statusCode=e,this.body=t}};function O(e,t,n){let r=new Headers({"User-Agent":u(),accept:`text/event-stream`,authorization:`Bearer ${t}`,"content-type":`application/json`});k(r,e.headers),k(r,n?.headers);let i=A(e.headers,`x-affinity`)||A(n?.headers,`x-affinity`);return V(n)&&!i&&r.set(`x-affinity`,n.sessionId),r}function k(e,t){if(t)for(let[n,r]of Object.entries(t))r===null?e.delete(n):e.set(n,r)}function A(e,t){return!!e&&Object.keys(e).some(e=>e.toLowerCase()===t)}function j(e){let t={...e};for(let[e,n]of[[`topP`,`top_p`],[`maxTokens`,`max_tokens`],[`randomSeed`,`random_seed`],[`responseFormat`,`response_format`],[`toolChoice`,`tool_choice`],[`presencePenalty`,`presence_penalty`],[`frequencyPenalty`,`frequency_penalty`],[`parallelToolCalls`,`parallel_tool_calls`],[`reasoningEffort`,`reasoning_effort`],[`promptMode`,`prompt_mode`],[`promptCacheKey`,`prompt_cache_key`],[`safePrompt`,`safe_prompt`]])P(t,e,n);t.messages=e.messages.map(e=>M(e));let n=t.response_format;if(F(n)){let e={...n};P(e,`jsonSchema`,`json_schema`);let r=e.json_schema;if(F(r)){let t={...r};P(t,`schemaDefinition`,`schema`),e.json_schema=t}t.response_format=e}return t}function M(e){let t={...e};return P(t,`toolCalls`,`tool_calls`),P(t,`toolCallId`,`tool_call_id`),Array.isArray(e.content)&&(t.content=e.content.map(e=>N(e))),t}function N(e){let t={...e};for(let[e,n]of[[`imageUrl`,`image_url`],[`documentUrl`,`document_url`],[`documentName`,`document_name`],[`fileId`,`file_id`],[`referenceIds`,`reference_ids`],[`inputAudio`,`input_audio`]])P(t,e,n);return t}function P(e,t,n){t in e&&(e[n]=e[t],delete e[t])}function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var I=Symbol(`mistral-stream-done`);async function*L(e,t){let n=e.getReader(),r=new TextDecoder,i=``,a=()=>{n.cancel().catch(()=>{})};t.addEventListener(`abort`,a,{once:!0});try{for(;;){if(t.aborted)throw t.reason;let{done:e,value:a}=await n.read();if(t.aborted)throw t.reason;i+=e?r.decode():r.decode(a,{stream:!0});let o=R(i);for(;o;){let e=z(i.slice(0,o.index));if(i=i.slice(o.index+o.length),e===I)return;e&&(yield e),o=R(i)}if(e)break}if(i.trim()){let e=z(i);e!==I&&e&&(yield e)}}finally{t.removeEventListener(`abort`,a);try{await n.cancel()}catch{}try{n.releaseLock()}catch{}}}function R(e){let t=/\r\n\r\n|\r\n\r|\r\n\n|\r\r\n|\n\r\n|\r\r|\n\r|\n\n/u.exec(e);return t?.index===void 0?void 0:{index:t.index,length:t[0].length}}function z(e){let t=e.split(/\r\n|\r|\n/u).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
2
|
+
`).trim();if(!t)return;if(t===`[DONE]`)return I;let n=JSON.parse(t);if(!F(n)||!Array.isArray(n.choices))throw Error(`Invalid Mistral streaming event`);return{data:n}}function B(e,t,r,i){let a={model:e.id,stream:!0,messages:K(r,e.input.includes(`image`))},o=n(t.messages);return o.length>0&&(a.tools=W(o)),i?.temperature!==void 0&&(a.temperature=i.temperature),i?.maxTokens!==void 0&&(a.maxTokens=i.maxTokens),i?.toolChoice&&(a.toolChoice=J(i.toolChoice)),i?.promptMode&&(a.promptMode=i.promptMode),i?.reasoningEffort&&(a.reasoningEffort=i.reasoningEffort),V(i)&&(a.promptCacheKey=i.sessionId),a}function V(e){return e?.cacheRetention!==`none`&&!!e?.sessionId}function H(e,t){let n=e,r=n.promptTokensDetails?.cachedTokens??n.prompt_tokens_details?.cached_tokens??n.promptTokenDetails?.cachedTokens??n.prompt_token_details?.cached_tokens??n.numCachedTokens??n.num_cached_tokens??0;return Math.min(t,Math.max(0,typeof r==`number`&&Number.isFinite(r)?r:0))}async function U(e,t,n,r,i){let a=null,s=t.content,l=()=>s.length-1,u=new Map,d=e=>{if(e){if(e.type===`text`){n.push({type:`text_end`,contentIndex:l(),content:e.text,partial:t});return}e.type===`thinking`&&n.push({type:`thinking_end`,contentIndex:l(),content:e.thinking,partial:t})}};for await(let s of r){let r=s.data;if(await i?.(r,e),t.responseId||=r.id,r.usage){let n=r.usage.prompt_tokens||0,i=H(r.usage,n);t.usage.input=Math.max(0,n-i),t.usage.output=r.usage.completion_tokens||0,t.usage.cacheRead=i,t.usage.cacheWrite=0,t.usage.totalTokens=r.usage.total_tokens||t.usage.input+t.usage.output+t.usage.cacheRead+t.usage.cacheWrite,o(e,t.usage)}let f=r.choices[0];if(!f)continue;if(f.finish_reason){t.rawStopReason=f.finish_reason;let e=Y(f.finish_reason);t.stopReason=e.stopReason,e.errorMessage&&(t.errorMessage=e.errorMessage)}let p=f.delta;if(p.content!==null&&p.content!==void 0){let e=typeof p.content==`string`?[p.content]:p.content;for(let r of e){if(typeof r==`string`){let e=m(r);if(!e)continue;(!a||a.type!==`text`)&&(d(a),a={type:`text`,text:``},t.content.push(a),n.push({type:`text_start`,contentIndex:l(),partial:t})),a.text+=e,n.push({type:`text_delta`,contentIndex:l(),delta:e,partial:t});continue}if(r.type===`thinking`){let e=(r.thinking??[]).map(e=>e.text??``).filter(e=>e.length>0).join(``),i=m(e);if(!i)continue;(!a||a.type!==`thinking`)&&(d(a),a={type:`thinking`,thinking:``},t.content.push(a),n.push({type:`thinking_start`,contentIndex:l(),partial:t})),a.thinking+=i,n.push({type:`thinking_delta`,contentIndex:l(),delta:i,partial:t});continue}if(r.type===`text`){let e=m(r.text??``);if(!e)continue;(!a||a.type!==`text`)&&(d(a),a={type:`text`,text:``},t.content.push(a),n.push({type:`text_start`,contentIndex:l(),partial:t})),a.text+=e,n.push({type:`text_delta`,contentIndex:l(),delta:e,partial:t})}}}let h=p.tool_calls||[];for(let e of h){a&&=(d(a),null);let r=e.id&&e.id!==`null`?e.id:S(`toolcall:${e.index??0}`,0),i=e.index??r,o=u.get(i),s;if(o!==void 0){let e=t.content[o];e?.type===`toolCall`&&(s=e)}s||(s={type:`toolCall`,id:r,name:e.function.name,arguments:{},partialArgs:``},t.content.push(s),u.set(i,t.content.length-1),n.push({type:`toolcall_start`,contentIndex:t.content.length-1,partial:t}));let l=typeof e.function.arguments==`string`?e.function.arguments:JSON.stringify(e.function.arguments||{});s.partialArgs=(s.partialArgs||``)+l,s.arguments=c(s.partialArgs),n.push({type:`toolcall_delta`,contentIndex:u.get(i),delta:l,partial:t})}}d(a);for(let e of u.values()){let r=t.content[e];if(r.type!==`toolCall`)continue;let i=r;i.arguments=c(i.partialArgs),delete i.partialArgs,n.push({type:`toolcall_end`,contentIndex:e,toolCall:i,partial:t})}}function W(e){return e.map(e=>{let t=l(e,!0);return{type:`function`,function:{name:e.name,description:e.description,parameters:G(p(e,t)),strict:t??!1}}})}function G(e){if(Array.isArray(e))return e.map(e=>G(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=G(r);return t}return e}function K(t,n){let i=[];for(let[a,o]of t.entries()){if(o.role===`system`){let t=a===0?e(o):r(o);t.length>0&&i.push({role:`system`,content:m(t)});continue}if(o.role===`user`){if(typeof o.content==`string`){i.push({role:`user`,content:m(o.content)});continue}let e=o.content.some(e=>e.type===`image`),t=o.content.filter(e=>e.type===`text`||n).map(e=>e.type===`text`?{type:`text`,text:m(e.text)}:{type:`image_url`,imageUrl:`data:${e.mimeType};base64,${e.data}`});if(t.length>0){i.push({role:`user`,content:t});continue}e&&!n&&i.push({role:`user`,content:`(image omitted: model does not support images)`});continue}if(o.role===`assistant`){let e=[],t=[];for(let n of o.content){if(n.type===`text`){n.text.trim().length>0&&e.push({type:`text`,text:m(n.text)});continue}if(n.type===`thinking`){n.thinking.trim().length>0&&e.push({type:`thinking`,thinking:[{type:`text`,text:m(n.thinking)}]});continue}t.push({id:n.id,type:`function`,function:{name:n.name,arguments:JSON.stringify(n.arguments||{})},index:0})}let n={role:`assistant`,prefix:!1};e.length>0&&(n.content=e),t.length>0&&(n.toolCalls=t),(e.length>0||t.length>0)&&i.push(n);continue}let t=[],s=q(o.content.filter(e=>e.type===`text`).map(e=>e.type===`text`?m(e.text):``).join(`
|
|
3
|
+
`),o.content.some(e=>e.type===`image`),n,o.isError);t.push({type:`text`,text:s});for(let e of o.content)n&&e.type===`image`&&t.push({type:`image_url`,imageUrl:`data:${e.mimeType};base64,${e.data}`});i.push({role:`tool`,toolCallId:o.toolCallId,name:o.toolName,content:t})}return i}function q(e,t,n,r){let i=e.trim(),a=r?`[tool error] `:``;return i.length>0?`${a}${i}${t&&!n?`
|
|
4
|
+
[tool image omitted: model does not support images]`:``}`:t?n?r?`[tool error] (see attached image)`:`(see attached image)`:r?`[tool error] (image omitted: model does not support images)`:`(image omitted: model does not support images)`:r?`[tool error] (no tool output)`:`(no tool output)`}function J(e){if(e)return e===`auto`||e===`none`||e===`any`||e===`required`?e:{type:`function`,function:{name:e.function.name}}}function Y(e){if(e===null)return{stopReason:`stop`};switch(e){case`stop`:return{stopReason:`stop`};case`length`:case`model_length`:return{stopReason:`length`};case`tool_calls`:return{stopReason:`toolUse`};case`error`:return{stopReason:`error`,errorMessage:`Provider stopped with: error`};default:return{stopReason:`error`,errorMessage:`Provider stopped with: ${e}`}}}export{v as stream,y as streamSimple};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,t}from"./preload-helper-mbhLTglw.js";import{a as n,i as r}from"./diagnostics-CmW2yJSB.js";function i(e,t){return{role:`assistant`,content:[],api:e.api,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:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function a(e){return typeof e.result==`function`}async function o(e,t){for await(let n of t)e.push(n);e.end(a(t)?await t.result():void 0)}function s(e,t){let r=new n;return t().then(e=>o(r,e)).catch(t=>{let n=i(e,t);r.push({type:`error`,reason:`error`,error:n}),r.end(n)}),r}function c(e,t){let n={stream:(t,n,r)=>s(t,async()=>(await e()).stream(t,n,r)),streamSimple:(t,n,r)=>s(t,async()=>(await e()).streamSimple(t,n,r))};return t?.fetchDeferred&&(n.fetchDeferred=(t,n,r)=>s(t,async()=>{let i=await e();if(!i.fetchDeferred)throw Error(`API does not support deferred responses`);return i.fetchDeferred(t,n,r)})),t?.cancelDeferred&&(n.cancelDeferred=async(t,n,r)=>{let i=await e();if(!i.cancelDeferred)throw Error(`API cannot cancel deferred responses`);await i.cancelDeferred(t,n,r)}),n}var l=function(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e},u=e=>t(()=>import(l(e)),[]);function d(){return globalThis.process?.env}function f(){return{async env(e){let t=d()?.[e];return typeof t==`string`&&t.trim().length>0?t:void 0},async fileExists(e){try{let t=await u(`node:fs/promises`),n=e;return n.startsWith(`~`)&&(n=(await u(`node:os`)).homedir()+n.slice(1)),await t.access(n),!0}catch{return!1}}}}function p(e){if(e.reason!==void 0)return e.reason;let t=Error(`The operation was aborted`);return t.name=`AbortError`,t}function m(e){return e??new AbortController().signal}function h(e,t){return t.aborted?(e.catch(()=>{}),Promise.reject(p(t))):new Promise((n,r)=>{let i=!1,a=()=>t.removeEventListener(`abort`,o),o=()=>{i||(i=!0,a(),r(p(t)))};t.addEventListener(`abort`,o,{once:!0}),e.then(e=>{i||(i=!0,a(),n(e))},e=>{i||(i=!0,a(),r(e))}),t.aborted&&o()})}var g=class{credentials=new Map;chains=new Map;enqueue(e,t,n){let r=m(n?.signal),i=this.chains.get(e)??Promise.resolve(),a=(async()=>(await i.catch(()=>{}),r.throwIfAborted(),t()))(),o=a.catch(()=>{});return this.chains.set(e,o),o.then(()=>{this.chains.get(e)===o&&this.chains.delete(e)}),h(a,r)}async read(e,t){return t?.signal?.throwIfAborted(),this.credentials.get(e)}async list(e){return e?.signal?.throwIfAborted(),[...this.credentials].map(([e,t])=>({providerId:e,type:t.type}))}modify(e,t,n){return this.enqueue(e,async()=>{let r=this.credentials.get(e),i=await t(r);return n?.signal?.throwIfAborted(),i!==void 0&&this.credentials.set(e,i),i??r},n)}delete(e,t){return this.enqueue(e,async()=>{this.credentials.delete(e)},t)}},_=class extends Error{code;constructor(e,t,n){super(v(t,n?.cause),n),this.name=`ModelsError`,this.code=e}};function v(e,t){if(t==null)return e;let n=r(t).trim();return!n||e.includes(n)?e:`${e}: ${n}`}function y(e,t,n,r){let i=m(r?.signal);return h(b(e,t,n,r,i),i)}async function b(e,t,n,r,i){i.throwIfAborted();let a=r?.env?x(n,r.env):n;if(r?.apiKey!==void 0&&e.auth.apiKey)return T(a,e.auth.apiKey,e.id,{type:`api_key`,key:r.apiKey,env:r.env},i);let o=await E(t,e.id,i);if(o){if(o.type===`oauth`&&e.auth.oauth)return w(t,e.id,e.auth.oauth,o,i,r?.minOAuthValidityMs);if(o.type===`api_key`&&e.auth.apiKey){let t=r?.env?{...o,env:{...o.env,...r.env}}:o;return T(a,e.auth.apiKey,e.id,t,i)}return}return e.auth.apiKey?T(a,e.auth.apiKey,e.id,void 0,i):void 0}function x(e,t){return{env:async n=>t[n]||await e.env(n),fileExists:t=>e.fileExists(t)}}var S=3e5,C=15e3;async function w(e,t,n,r,i,a){let o=Math.max(S,a??0),s=e=>Date.now()+o>=e.expires,c=r;if(s(c)){let r;try{r=await e.modify(t,async e=>{if(e?.type===`oauth`&&s(e))try{let t=AbortSignal.any([i,AbortSignal.timeout(C)]);return await n.refresh(e,t)}catch(e){throw new _(`oauth`,`OAuth refresh failed for ${t}`,{cause:e})}},{signal:i})}catch(e){throw e instanceof _?e:new _(`auth`,`Credential store modify failed for ${t}`,{cause:e})}if(r?.type!==`oauth`)return;if(c=r,a!==void 0&&s(c))throw new _(`oauth`,`OAuth refresh returned a token that expires too soon for ${t}`)}try{return{auth:await n.toAuth(c),source:`OAuth`}}catch(e){throw new _(`oauth`,`OAuth auth derivation failed for ${t}`,{cause:e})}}async function T(e,t,n,r,i){try{return await t.resolve({ctx:e,credential:r,signal:i})}catch(e){throw new _(`auth`,`API key auth failed for provider ${n}`,{cause:e})}}async function E(e,t,n){try{return await e.read(t,{signal:n})}catch(e){throw new _(`auth`,`Credential store read failed for ${t}`,{cause:e})}}var D=class{entries=new Map;async read(e,t){t?.signal?.throwIfAborted();let n=this.entries.get(e);return n?structuredClone(n):void 0}async write(e,t,n){n?.signal?.throwIfAborted(),this.entries.set(e,structuredClone(t))}async delete(e,t){t?.signal?.throwIfAborted(),this.entries.delete(e)}};function O(e){return e.type??`chat`}function k(e,t){return O(e)===t}function A(e){if(!k(e,`chat`))throw new _(`provider`,`Model ${e.provider}/${e.id} is not a chat model`)}function j(e){if(!k(e,`image`))throw new _(`provider`,`Model ${e.provider}/${e.id} is not an image model`)}function M(e){if(!k(e,`classifier`))throw new _(`provider`,`Model ${e.provider}/${e.id} is not a classifier model`)}function N(e,t,n=!1){return{api:e.api,provider:e.provider,model:e.id,output:[],stopReason:n?`aborted`:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}function P(e,t,n=!1){return{api:e.api,provider:e.provider,model:e.id,answers:{},stopReason:n?`aborted`:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}var F={chat:!0,image:!0,classifier:!0};function I(e){return Object.hasOwn(F,O(e))}function L(e){return{...e,models:e.models.filter(I)}}function R(e,t){if(!e&&!t)return;let n={...e};for(let[e,r]of Object.entries(t??{})){let t=e.toLowerCase();for(let e of Object.keys(n))e.toLowerCase()===t&&delete n[e];n[e]=r}return n}var z=class{providers=new Map;credentials;modelsStore;authContext;refreshGenerations=new Map;refreshControllers=new Map;publicationChains=new Map;constructor(e){this.credentials=e?.credentials??new g,this.modelsStore=e?.modelsStore??new D,this.authContext=e?.authContext??f()}setProvider(e){this.supersedeProviderRefresh(e.id),this.providers.set(e.id,e)}deleteProvider(e){this.supersedeProviderRefresh(e),this.providers.delete(e)}clearProviders(){for(let e of new Set([...this.providers.keys(),...this.refreshControllers.keys()]))this.supersedeProviderRefresh(e);this.providers.clear()}getProviders(){return Array.from(this.providers.values())}getProvider(e){return this.providers.get(e)}getModels(e){if(e!==void 0){let t=this.providers.get(e);if(!t)return[];try{return t.getModels()}catch{return[]}}let t=[];for(let e of this.providers.values())try{t.push(...e.getModels())}catch{}return t}getAllModels(e){if(e!==void 0){let t=this.providers.get(e);if(!t)return[];try{return t.getAllModels?.()??t.getModels()}catch{return[]}}let t=[];for(let e of this.providers.values())try{t.push(...e.getAllModels?.()??e.getModels())}catch{}return t}getModelsOfType(e,t){return this.getAllModels(t).filter(t=>k(t,e))}getModel(e,t){return this.getModels(e).find(e=>e.id===t)}getModelOfType(e,t,n){return this.getModelsOfType(e,t).find(e=>e.id===n)}supersedeProviderRefresh(e){let t=(this.refreshGenerations.get(e)??0)+1;this.refreshGenerations.set(e,t);let n=this.refreshControllers.get(e);return n&&(this.refreshControllers.delete(e),n.abort()),t}beginProviderRefresh(e){let t=this.supersedeProviderRefresh(e),n=new AbortController;return this.refreshControllers.set(e,n),{generation:t,controller:n}}publishProviderModels(e,t,n,r){let i=this.publicationChains.get(e)??Promise.resolve(),a=(async()=>(await i.catch(()=>{}),n.aborted||this.refreshGenerations.get(e)!==t||(r.persist===null?await this.modelsStore.delete(e,{signal:n}):r.persist!==void 0&&await this.modelsStore.write(e,structuredClone(r.persist),{signal:n}),n.aborted||this.refreshGenerations.get(e)!==t)?!1:(r.update?.(),!0)))(),o=a.catch(()=>{});return this.publicationChains.set(e,o),o.then(()=>{this.publicationChains.get(e)===o&&this.publicationChains.delete(e)}),h(a,n)}async runProviderRefreshPhase(e,t,n,r,i,a){let o=await this.modelsStore.read(e.id,{signal:a});await e.refreshModels({credential:t,stored:o?L(structuredClone(o)):void 0,publish:t=>this.publishProviderModels(e.id,i,a,t),allowNetwork:n,force:n?r:void 0,signal:a})}async refresh(e={}){let t=e.allowNetwork??!0,n=m(e.signal),r=new Map;if(n.aborted)return{aborted:!0,errors:r};let i=e.providers?new Set(e.providers):void 0,a=Array.from(this.providers.values()).filter(e=>e.refreshModels!==void 0&&(!i||i.has(e.id))),o=Promise.all(a.map(async i=>{let{generation:a,controller:o}=this.beginProviderRefresh(i.id),s=AbortSignal.any([n,o.signal]),c=(async()=>{let n,r;try{n=await this.readCredential(i.id,s)}catch(e){r=e}if(await this.runProviderRefreshPhase(i,n,!1,void 0,a,s),r!==void 0)throw r;if(!t||s.aborted)return;let o=await this.resolveRefreshCredential(i,n,s);o&&await this.runProviderRefreshPhase(i,o,!0,e.force,a,s)})();try{await h(c,s)}catch(e){s.aborted||r.set(i.id,e instanceof Error?e:new _(`model_source`,`Model refresh failed for ${i.id}`,{cause:e}))}finally{this.refreshControllers.get(i.id)===o&&this.refreshControllers.delete(i.id)}}));try{await h(o,n)}catch(e){if(!n.aborted)throw e}return{aborted:n.aborted,errors:new Map(r)}}async resolveRefreshCredential(e,t,n){if(t?.type===`oauth`){let r=e.auth.oauth;if(!r)return;if(Date.now()<t.expires)return t;if(n.aborted)return;let i=await this.credentials.modify(e.id,async e=>{if(!(e?.type!==`oauth`||Date.now()<e.expires))return r.refresh(e,n)},{signal:n});return i?.type===`oauth`?i:void 0}let r=e.auth.apiKey;if(!r)return;let i=t?.type===`api_key`?t:void 0,a=await r.resolve({ctx:this.authContext,credential:i,signal:n});if(a)return{type:`api_key`,key:a.auth.apiKey,env:a.env}}async readCredential(e,t){try{return await this.credentials.read(e,{signal:t})}catch(t){throw new _(`auth`,`Credential store read failed for ${e}`,{cause:t})}}async checkProviderAuth(e,t,n){if(t?.type===`oauth`)return e.auth.oauth?{source:`OAuth`,type:`oauth`}:void 0;let r=e.auth.apiKey;if(!r)return;if(r.check)try{return await r.check({ctx:this.authContext,credential:t?.type===`api_key`?t:void 0,signal:n})}catch(t){throw new _(`auth`,`API key auth check failed for provider ${e.id}`,{cause:t})}let i=await y(e,this.credentials,this.authContext,{signal:n});return i?{source:i.source,type:`api_key`}:void 0}checkAuth(e,t){let n=m(t?.signal);return h((async()=>{n.throwIfAborted();let t=this.providers.get(e);if(t)return this.checkProviderAuth(t,await this.readCredential(e,n),n)})(),n)}async getAuthenticatedProviders(e,t){t.throwIfAborted();let n=e?[this.providers.get(e)].filter(e=>e!==void 0):this.getProviders();return(await Promise.all(n.map(async e=>{let n=await this.readCredential(e.id,t);return{provider:e,credential:n,auth:await this.checkProviderAuth(e,n,t)}}))).filter(e=>e.auth!==void 0)}getAvailable(e,t){let n=m(t?.signal);return h((async()=>(await this.getAuthenticatedProviders(e,n)).flatMap(({provider:e,credential:t})=>{let n=e.getModels();return e.filterModels?.(n,t)??n}))(),n)}async getAvailableOfType(e,t,n){return(await this.getAllAvailable(t,n)).filter(t=>k(t,e))}getAllAvailable(e,t){let n=m(t?.signal);return h((async()=>(await this.getAuthenticatedProviders(e,n)).flatMap(({provider:e,credential:t})=>{let n=e.getAllModels?.()??e.getModels();if(e.filterAllModels)return e.filterAllModels(n,t);if(!e.filterModels)return n;let r=new Set(e.filterModels(e.getModels(),t).map(e=>e.id));return n.filter(e=>!k(e,`chat`)||r.has(e.id))}))(),n)}async getAuth(e,t){let n=m(t?.signal),r=typeof e==`string`?e:e.provider,i=this.providers.get(r);if(!i)return;let a=await y(i,this.credentials,this.authContext,{...t,signal:n});return!a||typeof e==`string`||!e.headers?a:{...a,auth:{...a.auth,headers:R(a.auth.headers,e.headers)}}}async login(e,t,n,r){let i=m(n.signal);i.throwIfAborted();let a=this.providers.get(e);if(!a)throw new _(`provider`,`Unknown provider: ${e}`);let o=t===`oauth`?a.auth.oauth:a.auth.apiKey;if(!o?.login)throw new _(`auth`,`${a.name} does not support ${t} login`);let s=await h(o.login({...n,signal:i},r),i),c=!1,l,u=new Promise(e=>{l=e}),d=this.credentials.modify(e,async()=>(c=!0,l?.(),s),{signal:i});d.catch(()=>{});try{await new Promise((e,t)=>{let n=()=>{c||t(i.reason)};i.addEventListener(`abort`,n,{once:!0}),Promise.race([u,d]).then(()=>{i.removeEventListener(`abort`,n),e()},e=>{i.removeEventListener(`abort`,n),t(e)}),i.aborted&&n()}),await d}catch(t){throw i.throwIfAborted(),new _(`auth`,`Credential store modify failed for ${e}`,{cause:t})}return s}async logout(e,t){let n=m(t?.signal);n.throwIfAborted();try{await this.credentials.delete(e,{signal:n})}catch(t){throw n.throwIfAborted(),new _(`auth`,`Credential store delete failed for ${e}`,{cause:t})}}requireProvider(e){let t=this.providers.get(e.provider);if(!t)throw new _(`provider`,`Unknown provider: ${e.provider}`);return t}requireChatProvider(e){return A(e),this.requireProvider(e)}async applyAuth(e,t){this.requireProvider(e);let n=await this.getAuth(e,{apiKey:t?.apiKey,env:t?.env,signal:t?.signal});if(!n)throw new _(`auth`,`Provider is not configured: ${e.provider}`);let r=n.auth,i=t?.apiKey??r.apiKey,a=R(r.headers,t?.headers);t?.transformHeaders&&(a=await t.transformHeaders(a??{}));let o=n.env||t?.env?{...n.env??{},...t?.env??{}}:void 0,s=r.baseUrl?{...e,baseUrl:r.baseUrl}:e,{transformHeaders:c,...l}=t??{};return{requestModel:s,requestOptions:{...l,apiKey:i,headers:a,env:o}}}stream(t,n,r){let i=e(n);return s(t,async()=>{let e=this.requireChatProvider(t),{requestModel:n,requestOptions:a}=await this.applyAuth(t,r);return e.stream(n,i,a)})}async complete(e,t,n){return this.stream(e,t,n).result()}streamSimple(t,n,r){let i=e(n);return s(t,async()=>{let e=this.requireChatProvider(t),{requestModel:n,requestOptions:a}=await this.applyAuth(t,r);return e.streamSimple(n,i,a)})}async completeSimple(e,t,n){return this.streamSimple(e,t,n).result()}streamDeferred(e,t,n){return s(e,async()=>{let r=this.requireChatProvider(e);if(!r.fetchDeferred)throw new _(`provider`,`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return r.fetchDeferred(i,t,a)})}async fetchDeferred(e,t,n){return this.streamDeferred(e,t,n).result()}async cancelDeferred(e,t,n){let r=this.requireChatProvider(e);if(!r.cancelDeferred)throw new _(`provider`,`Provider ${e.provider} does not support deferred responses`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);await r.cancelDeferred(i,t,a)}async generateImages(e,t,n){try{j(e);let r=this.requireProvider(e);if(!r.generateImages)throw new _(`provider`,`Provider ${e.provider} does not support image generation`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return await r.generateImages(i,t,a)}catch(t){return N(e,t,n?.signal?.aborted)}}async classify(e,t,n){try{M(e);let r=this.requireProvider(e);if(!r.classify)throw new _(`provider`,`Provider ${e.provider} does not support classification`);let{requestModel:i,requestOptions:a}=await this.applyAuth(e,n);return await r.classify(i,t,a)}catch(t){return P(e,t,n?.signal?.aborted)}}};function B(e){return new z(e)}function V(e){let t=e.api&&typeof e.api.stream==`function`?e.api:void 0,n=t||!e.api?void 0:e.api,r=e.images,i=e.classifiers,a=t?[t]:Object.values(n??{}).filter(e=>e!==void 0),o=Object.values(r??{}).filter(e=>e!==void 0),c=Object.values(i??{}).filter(e=>e!==void 0);if(a.length===0&&o.length===0&&c.length===0)throw Error(`Provider ${e.id}: at least one of "api", "images", or "classifiers" is required.`);let l=e.models,u=[],d=e.fetchModels,f=()=>{let e=[...l];for(let t of u){let n=e.findIndex(e=>O(e)===O(t)&&e.id===t.id);n>=0?e[n]=t:e.push(t)}return e},p=e=>t??n?.[e.api],m=(t,n)=>{let r=p(t);return r?n(r):s(t,async()=>{throw new _(`stream`,`Provider ${e.id} has no API implementation for "${t.api}"`)})},h={id:e.id,name:e.name??e.id,baseUrl:e.baseUrl,headers:e.headers,auth:e.auth,getModels:()=>f().filter(e=>k(e,`chat`)),getAllModels:f,refreshModels:d?async t=>{if(t.stored){let n=t.stored.models.filter(t=>t.provider===e.id).map(e=>e);if(!await t.publish({update:()=>{u=n}}))return}if(!t.allowNetwork||t.signal.aborted)return;let n=await d(t);if(t.signal.aborted)return;let r=n.filter(I);await t.publish({persist:{models:r,checkedAt:Date.now()},update:()=>{u=r}})}:void 0,filterModels:e.filterModels,filterAllModels:e.filterAllModels,stream:(e,t,n)=>m(e,r=>r.stream(e,t,n)),streamSimple:(e,t,n)=>m(e,r=>r.streamSimple(e,t,n))};return a.some(e=>e.fetchDeferred!==void 0)&&(h.fetchDeferred=(t,n,r)=>s(t,async()=>{let i=p(t);if(!i?.fetchDeferred)throw new _(`provider`,`Provider ${e.id} does not support deferred responses for "${t.api}"`);return i.fetchDeferred(t,n,r)})),a.some(e=>e.cancelDeferred!==void 0)&&(h.cancelDeferred=async(t,n,r)=>{let i=p(t);if(!i?.cancelDeferred)throw new _(`provider`,`Provider ${e.id} cannot cancel deferred responses for "${t.api}"`);await i.cancelDeferred(t,n,r)}),r&&o.length>0&&(h.generateImages=async(t,n,i)=>{let a=r[t.api];return a?a.generateImages(t,n,i):N(t,new _(`provider`,`Provider ${e.id} has no image generation implementation for "${t.api}"`))}),i&&c.length>0&&(h.classify=async(t,n,r)=>{let a=i[t.api];return a?a.classify(t,n,r):P(t,new _(`provider`,`Provider ${e.id} has no classifier implementation for "${t.api}"`))}),h}function H(e,t){let n=t.input+t.cacheRead+t.cacheWrite,r=e.cost,i=-1;for(let t of e.cost.tiers??[])n>t.inputTokensAbove&&t.inputTokensAbove>i&&(r=t,i=t.inputTokensAbove);let a=t.cacheWrite1h??0,o=t.cacheWrite-a;return t.cost.input=r.input/1e6*t.input,t.cost.output=r.output/1e6*t.output,t.cost.cacheRead=r.cacheRead/1e6*t.cacheRead,t.cost.cacheWrite=(r.cacheWrite*o+r.input*2*a)/1e6,t.cost.total=t.cost.input+t.cost.output+t.cost.cacheRead+t.cost.cacheWrite,t.cost}var U=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`];function W(e){return e.reasoning?U.filter(t=>{let n=e.thinkingLevelMap?.[t];return n===null?!1:t===`xhigh`||t===`max`?n!==void 0:!0}):[`off`]}function G(e,t){let n=W(e);if(n.includes(t))return t;let r=U.indexOf(t);if(r===-1)return n[0]??`off`;for(let e=r;e<U.length;e++){let t=U[e];if(n.includes(t))return t}for(let e=r-1;e>=0;e--){let t=U[e];if(n.includes(t))return t}return n[0]??`off`}export{W as a,D as c,f as d,c as f,V as i,_ as l,G as n,O as o,s as p,B as r,k as s,H as t,g as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./renderer-BdjuCi44.js";import{t}from"./index-hJphFjkO.js";var n={version:1,name:`mushroom`,renderer:`zdog`,controls:{body:{type:`color`,label:`body`,default:`#fff7e4`},cap:{type:`color`,label:`cap`,default:`#f98284`},capSpot:{type:`color`,label:`capSpot`,default:`#ffe6c6`},eye:{type:`color`,label:`eye`,default:`#28282e`},mouth:{type:`color`,label:`mouth`,default:`#28282e`},blush:{type:`color`,label:`blush`,default:`#feaae4`},dead:{type:`color`,label:`dead`,default:`#6c5671`},deadTongue:{type:`color`,label:`deadTongue`,default:`#d9c8bf`},tongue:{type:`color`,label:`tongue`,default:`#f98284`},sweat:{type:`color`,label:`sweat`,default:`#accce4`},white:{type:`color`,label:`white`,default:`#ffffff`}},data:JSON.parse(`{"root":"node-0","nodes":[{"id":"node-0","kind":"group","options":{"name":"root"}},{"id":"node-1","parent":"node-0","kind":"group","options":{"name":"body","updateSort":true}},{"id":"node-2","parent":"node-1","kind":"hemisphere","options":{"name":"body.hemisphere","translate":{"y":2},"rotate":{"x":4.71238898038469},"color":"\\u0000sprite-color:body","stroke":false,"backface":"\\u0000sprite-color:cap","diameter":32}},{"id":"node-3","parent":"node-1","kind":"hemisphere","options":{"name":"cap.hemisphere","translate":{"y":2},"rotate":{"x":1.5707963267948966},"color":"\\u0000sprite-color:cap","stroke":false,"backface":"\\u0000sprite-color:capSpot","diameter":42}},{"id":"node-4","parent":"node-3","kind":"shape","options":{"name":"cap.spot.front","translate":{"x":-8,"y":8,"z":12},"color":"\\u0000sprite-color:capSpot","stroke":12,"path":[{"x":0,"y":0}]}},{"id":"node-5","parent":"node-3","kind":"shape","options":{"name":"cap.spot.top","translate":{"x":8,"y":-4,"z":13},"color":"\\u0000sprite-color:capSpot","stroke":18,"path":[{"x":0,"y":0}]}},{"id":"node-6","parent":"node-1","kind":"group","options":{"name":"face","translate":{"y":7,"z":8}}},{"id":"node-7","parent":"node-6","kind":"group","options":{"name":"eyes"}},{"id":"node-8","parent":"node-7","kind":"group","options":{"name":"eyes.normal"}},{"id":"node-9","parent":"node-8","kind":"group","options":{"translate":{"x":-6,"y":-2}}},{"id":"node-10","parent":"node-9","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-11","parent":"node-9","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-12","parent":"node-8","kind":"group","options":{"translate":{"x":6,"y":-2}}},{"id":"node-13","parent":"node-12","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-14","parent":"node-12","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-15","parent":"node-7","kind":"group","options":{"name":"eyes.sad"}},{"id":"node-16","parent":"node-15","kind":"group","options":{"translate":{"x":-6,"y":-1},"rotate":{"z":0.2}}},{"id":"node-17","parent":"node-16","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":4}},{"id":"node-18","parent":"node-16","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-19","parent":"node-15","kind":"group","options":{"translate":{"x":6,"y":-1},"rotate":{"z":-0.2}}},{"id":"node-20","parent":"node-19","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":4}},{"id":"node-21","parent":"node-19","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-22","parent":"node-7","kind":"group","options":{"name":"eyes.surprised"}},{"id":"node-23","parent":"node-22","kind":"group","options":{"translate":{"x":-6,"y":-2}}},{"id":"node-24","parent":"node-23","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":4,"height":5}},{"id":"node-25","parent":"node-23","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-26","parent":"node-22","kind":"group","options":{"translate":{"x":6,"y":-2}}},{"id":"node-27","parent":"node-26","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":4,"height":5}},{"id":"node-28","parent":"node-26","kind":"ellipse","options":{"translate":{"y":-1,"z":1},"color":"\\u0000sprite-color:white","stroke":0.5,"fill":true,"width":1.5,"height":2}},{"id":"node-29","parent":"node-7","kind":"group","options":{"name":"eyes.happy"}},{"id":"node-30","parent":"node-29","kind":"shape","options":{"translate":{"x":-6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":-1,"y":-1.5},{"x":1,"y":-1.5},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-31","parent":"node-29","kind":"shape","options":{"translate":{"x":6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":-1,"y":-1.5},{"x":1,"y":-1.5},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-32","parent":"node-7","kind":"group","options":{"name":"eyes.angry"}},{"id":"node-33","parent":"node-32","kind":"group","options":{"translate":{"x":-6,"y":-1},"rotate":{"z":-0.3}}},{"id":"node-34","parent":"node-33","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":4}},{"id":"node-35","parent":"node-33","kind":"shape","options":{"translate":{"y":-1},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-3,"y":-3},{"x":3,"y":-2}]}},{"id":"node-36","parent":"node-32","kind":"group","options":{"translate":{"x":6,"y":-1},"rotate":{"z":0.3}}},{"id":"node-37","parent":"node-36","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":4}},{"id":"node-38","parent":"node-36","kind":"shape","options":{"translate":{"y":-1},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-3,"y":-3},{"x":3,"y":-2}]}},{"id":"node-39","parent":"node-7","kind":"group","options":{"name":"eyes.dead"}},{"id":"node-40","parent":"node-39","kind":"group","options":{"translate":{"x":-6,"y":-2}}},{"id":"node-41","parent":"node-40","kind":"shape","options":{"color":"\\u0000sprite-color:dead","stroke":1.5,"path":[{"x":-2,"y":-3},{"x":2,"y":3}]}},{"id":"node-42","parent":"node-40","kind":"shape","options":{"color":"\\u0000sprite-color:dead","stroke":1.5,"path":[{"x":2,"y":-3},{"x":-2,"y":3}]}},{"id":"node-43","parent":"node-39","kind":"group","options":{"translate":{"x":6,"y":-2}}},{"id":"node-44","parent":"node-43","kind":"shape","options":{"color":"\\u0000sprite-color:dead","stroke":1.5,"path":[{"x":-2,"y":-3},{"x":2,"y":3}]}},{"id":"node-45","parent":"node-43","kind":"shape","options":{"color":"\\u0000sprite-color:dead","stroke":1.5,"path":[{"x":2,"y":-3},{"x":-2,"y":3}]}},{"id":"node-46","parent":"node-7","kind":"group","options":{"name":"eyes.confused"}},{"id":"node-47","parent":"node-46","kind":"group","options":{"translate":{"x":-6,"y":-2}}},{"id":"node-48","parent":"node-47","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-49","parent":"node-47","kind":"shape","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-3,"y":-4},{"x":3,"y":-2}]}},{"id":"node-50","parent":"node-46","kind":"group","options":{"translate":{"x":6,"y":-2}}},{"id":"node-51","parent":"node-50","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-52","parent":"node-7","kind":"group","options":{"name":"eyes.sleepy"}},{"id":"node-53","parent":"node-52","kind":"shape","options":{"translate":{"x":-6,"y":-1},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":1},{"bezier":[{"x":-1,"y":0},{"x":1,"y":0},{"x":2.5,"y":1}]}],"closed":false}},{"id":"node-54","parent":"node-52","kind":"shape","options":{"translate":{"x":6,"y":-1},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":1},{"bezier":[{"x":-1,"y":0},{"x":1,"y":0},{"x":2.5,"y":1}]}],"closed":false}},{"id":"node-55","parent":"node-7","kind":"group","options":{"name":"eyes.nervous"}},{"id":"node-56","parent":"node-55","kind":"group","options":{"translate":{"x":-6,"y":-2}}},{"id":"node-57","parent":"node-56","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-58","parent":"node-55","kind":"group","options":{"translate":{"x":6,"y":-2}}},{"id":"node-59","parent":"node-58","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-60","parent":"node-55","kind":"group","options":{"translate":{"x":10,"y":4}}},{"id":"node-61","parent":"node-60","kind":"shape","options":{"color":"\\u0000sprite-color:sweat","stroke":2,"path":[{"x":0,"y":-4}]}},{"id":"node-62","parent":"node-60","kind":"ellipse","options":{"translate":{"y":2},"color":"\\u0000sprite-color:sweat","stroke":0,"fill":true,"width":3,"height":4}},{"id":"node-63","parent":"node-7","kind":"group","options":{"name":"eyes.shy"}},{"id":"node-64","parent":"node-63","kind":"ellipse","options":{"translate":{"x":-6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":2.5,"height":2}},{"id":"node-65","parent":"node-63","kind":"ellipse","options":{"translate":{"x":6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":2.5,"height":2}},{"id":"node-66","parent":"node-7","kind":"group","options":{"name":"eyes.cute"}},{"id":"node-67","parent":"node-66","kind":"group","options":{"translate":{"x":-6,"y":-1}}},{"id":"node-68","parent":"node-67","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":5,"height":6}},{"id":"node-69","parent":"node-67","kind":"ellipse","options":{"translate":{"y":-1.5,"z":1},"color":"\\u0000sprite-color:white","stroke":0,"fill":true,"width":2.5,"height":3}},{"id":"node-70","parent":"node-67","kind":"ellipse","options":{"translate":{"x":-1.5,"y":1.5,"z":1},"color":"\\u0000sprite-color:white","stroke":0,"fill":true,"width":1,"height":1}},{"id":"node-71","parent":"node-66","kind":"group","options":{"translate":{"x":6,"y":-1}}},{"id":"node-72","parent":"node-71","kind":"ellipse","options":{"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":5,"height":6}},{"id":"node-73","parent":"node-71","kind":"ellipse","options":{"translate":{"y":-1.5,"z":1},"color":"\\u0000sprite-color:white","stroke":0,"fill":true,"width":2.5,"height":3}},{"id":"node-74","parent":"node-71","kind":"ellipse","options":{"translate":{"x":-1.5,"y":1.5,"z":1},"color":"\\u0000sprite-color:white","stroke":0,"fill":true,"width":1,"height":1}},{"id":"node-75","parent":"node-7","kind":"group","options":{"name":"eyes.wink"}},{"id":"node-76","parent":"node-75","kind":"group","options":{"name":"eyes.wink.left"}},{"id":"node-77","parent":"node-76","kind":"shape","options":{"translate":{"x":-6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":-1,"y":-1.5},{"x":1,"y":-1.5},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-78","parent":"node-76","kind":"ellipse","options":{"translate":{"x":6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-79","parent":"node-75","kind":"group","options":{"name":"eyes.wink.right"}},{"id":"node-80","parent":"node-79","kind":"shape","options":{"translate":{"x":6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":-1,"y":-1.5},{"x":1,"y":-1.5},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-81","parent":"node-79","kind":"ellipse","options":{"translate":{"x":-6,"y":-2},"color":"\\u0000sprite-color:eye","stroke":1.5,"fill":true,"width":3,"height":5}},{"id":"node-82","parent":"node-6","kind":"group","options":{"name":"mouth"}},{"id":"node-83","parent":"node-82","kind":"shape","options":{"name":"mouth.normal","translate":{"y":2},"color":"\\u0000sprite-color:mouth","stroke":1.5,"path":[{"x":-2.5,"y":0},{"x":2.5,"y":0}],"closed":false}},{"id":"node-84","parent":"node-82","kind":"shape","options":{"name":"mouth.happy","translate":{"y":2},"color":"\\u0000sprite-color:mouth","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":0,"y":4},{"x":2.5,"y":2},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-85","parent":"node-82","kind":"shape","options":{"name":"mouth.sad","translate":{"y":2},"color":"\\u0000sprite-color:mouth","stroke":1.5,"path":[{"x":-2.5,"y":2},{"bezier":[{"x":0,"y":0},{"x":2.5,"y":2},{"x":2.5,"y":2}]}],"closed":false}},{"id":"node-86","parent":"node-82","kind":"shape","options":{"name":"mouth.small","translate":{"y":2},"color":"\\u0000sprite-color:mouth","stroke":1,"path":[{"x":-1.5,"y":0},{"x":1.5,"y":0}],"closed":false}},{"id":"node-87","parent":"node-82","kind":"shape","options":{"name":"mouth.worried","translate":{"y":2},"color":"\\u0000sprite-color:mouth","stroke":1,"path":[{"x":-2,"y":1},{"bezier":[{"x":-0.5,"y":0.5},{"x":0.5,"y":0.5},{"x":2,"y":1}]}],"closed":false}},{"id":"node-88","parent":"node-82","kind":"ellipse","options":{"name":"mouth.pout","translate":{"y":3},"color":"\\u0000sprite-color:mouth","stroke":1.5,"fill":true,"width":2,"height":2.5}},{"id":"node-89","parent":"node-82","kind":"ellipse","options":{"name":"mouth.surprised","translate":{"y":3},"color":"\\u0000sprite-color:mouth","stroke":1.5,"fill":true,"width":3,"height":4}},{"id":"node-90","parent":"node-82","kind":"group","options":{"name":"mouth.dead","translate":{"y":5}}},{"id":"node-91","parent":"node-90","kind":"ellipse","options":{"color":"\\u0000sprite-color:dead","stroke":1.5,"fill":true,"width":3,"height":2}},{"id":"node-92","parent":"node-90","kind":"ellipse","options":{"translate":{"y":0.5},"color":"\\u0000sprite-color:deadTongue","stroke":0,"fill":true,"width":1.5,"height":1}},{"id":"node-93","parent":"node-82","kind":"group","options":{"name":"mouth.open","translate":{"y":2}}},{"id":"node-94","parent":"node-93","kind":"ellipse","options":{"color":"\\u0000sprite-color:mouth","stroke":1.5,"fill":true,"width":6,"height":4}},{"id":"node-95","parent":"node-93","kind":"ellipse","options":{"name":"mouth.tongue","translate":{"y":1},"color":"\\u0000sprite-color:tongue","stroke":0,"fill":true,"width":3,"height":1.5}},{"id":"node-96","parent":"node-6","kind":"group","options":{"name":"blush.off"}},{"id":"node-97","parent":"node-6","kind":"group","options":{"name":"blush.medium"}},{"id":"node-98","parent":"node-97","kind":"ellipse","options":{"translate":{"x":-10,"y":4},"color":"\\u0000sprite-color:blush","stroke":1,"fill":true,"width":5,"height":2.5}},{"id":"node-99","parent":"node-97","kind":"ellipse","options":{"translate":{"x":10,"y":4},"color":"\\u0000sprite-color:blush","stroke":1,"fill":true,"width":5,"height":2.5}}],"palette":{"body":"#fff7e4","cap":"#f98284","capSpot":"#ffe6c6","eye":"#28282e","mouth":"#28282e","blush":"#feaae4","dead":"#6c5671","deadTongue":"#d9c8bf","tongue":"#f98284","sweat":"#accce4","white":"#ffffff"},"variants":{"eyes":{"normal":"node-8","happy":"node-29","sad":"node-15","angry":"node-32","surprised":"node-22","dead":"node-39","confused":"node-46","sleepy":"node-52","nervous":"node-55","shy":"node-63","wink":"node-76","cute":"node-66","wink.left":"node-76","wink.right":"node-79"},"mouth":{"normal":"node-83","happy":"node-84","sad":"node-85","angry":"node-85","surprised":"node-89","dead":"node-90","small":"node-86","worried":"node-87","pout":"node-88","open":"node-93"},"blush":{"off":"node-96","small":"node-97","medium":"node-97","big":"node-97"}},"expressions":{"angry":{"variants":{"eyes":"angry","mouth":"angry","blush":"off"},"motion":{"target":"root","translate":{"x":1,"y":0},"durationMs":150,"repeat":"none"}},"confused":{"variants":{"eyes":"confused","mouth":"normal","blush":"off"},"motion":{"target":"root","translate":{"x":0,"y":0.5},"durationMs":150,"repeat":"none"}},"cute":{"variants":{"eyes":"cute","mouth":"happy","blush":"big"},"motion":{"target":"root","translate":{"x":0,"y":-2.5},"durationMs":150,"repeat":"none"}},"dead":{"variants":{"eyes":"dead","mouth":"dead","blush":"off"}},"happy":{"variants":{"eyes":"happy","mouth":"happy","blush":"medium"},"motion":{"target":"root","translate":{"x":0,"y":-2},"durationMs":150,"repeat":"none"}},"nervous":{"variants":{"eyes":"nervous","mouth":"worried","blush":"off"},"motion":{"target":"root","translate":{"x":-0.5,"y":-1},"durationMs":150,"repeat":"none"}},"normal":{"variants":{"eyes":"normal","mouth":"normal","blush":"off"},"motion":{"target":"root","translate":{"x":0,"y":1},"durationMs":150,"repeat":"none"}},"pleading":{"variants":{"eyes":"cute","mouth":"pout","blush":"medium"},"motion":{"target":"root","translate":{"x":0,"y":-1},"durationMs":150,"repeat":"none"}},"sad":{"variants":{"eyes":"sad","mouth":"sad","blush":"off"},"motion":{"target":"root","translate":{"x":0,"y":2},"durationMs":150,"repeat":"none"}},"shy":{"variants":{"eyes":"shy","mouth":"small","blush":"small"},"motion":{"target":"root","translate":{"x":0,"y":1.5},"durationMs":150,"repeat":"none"}},"sleepy":{"variants":{"eyes":"sleepy","mouth":"small","blush":"off"},"motion":{"target":"root","translate":{"x":0,"y":2},"durationMs":150,"repeat":"none"}},"surprised":{"variants":{"eyes":"surprised","mouth":"surprised","blush":"off"},"motion":{"target":"root","translate":{"x":0,"y":-3},"durationMs":150,"repeat":"none"}},"wink":{"variants":{"mouth":"happy","blush":"small"},"variantChoices":{"eyes":["wink.left","wink.right"]},"motion":{"target":"root","translate":{"x":0,"y":-1.5},"durationMs":150,"repeat":"none"}}},"activities":{"idle":{"motion":{"target":"root","translate":{"y":0.5},"durationMs":2000,"repeat":"yoyo"},"mouseInfluence":1},"listening":{"motion":{"target":"root","rotate":{"x":-0.2},"durationMs":300,"repeat":"yoyo"},"mouseInfluence":0.3},"processing":{"mouseInfluence":0.2},"speaking":{"motion":{"target":"root","translate":{"y":0.5},"durationMs":1500,"repeat":"yoyo"},"mouseInfluence":0,"mouthCycle":[{"durationMs":100,"mouth":"open"},{"durationMs":150,"mouth":"base"},{"durationMs":100,"mouth":"open"},{"durationMs":200,"mouth":"base"}]},"thinking":{"motion":{"target":"root","rotate":{"z":0.1},"durationMs":800,"repeat":"yoyo"},"mouseInfluence":0},"error":{"motion":{"target":"root","rotate":{"x":0.9},"durationMs":600,"repeat":"none"},"mouseInfluence":0.1,"geometry":{"eyes":"dead","mouth":"dead"}}},"defaultPresentation":{"activity":"idle","expression":"sleepy"}}`)},r={document:t.parse(n),render:e};export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./error-CJ3RHG07.js";import{n as t,r as n}from"./anthropic-messages-Bnv5qjAJ.js";function r(t){throw new e(`${t} requires Node.js or a Node-compatible runtime`)}var i=3e4,a=`.anthropic-memory-store`,o=class extends e{constructor(e,t){super(e),this.name=`SessionMemoryError`,t!==void 0&&(this.cause=t)}},s=class{constructor(e,t){r(`SessionMemoryStores`)}get roots(){return r(`SessionMemoryStores`)}get readOnlyRoots(){return r(`SessionMemoryStores`)}download(e){return r(`SessionMemoryStores`)}finish(){return r(`SessionMemoryStores`)}syncAll(e){return r(`SessionMemoryStores`)}syncIfDue(){return r(`SessionMemoryStores`)}flushWrites(e){return r(`SessionMemoryStores`)}dispose(){return r(`SessionMemoryStores`)}};function c(e){return r(`setupSkills`)}function l(e,t){return r(`extractSkillArchive`)}function u(e){return r(`betaAgentToolset20260401`)}function d(e,t){return r(`resolvePath`)}var f=class extends e{constructor(e){super(`bash command timed out after ${e}ms`),this.name=`BashTimeoutError`,this.timeoutMs=e}},p=class{constructor(e,t){r(`BashSession`)}get closed(){return r(`BashSession`)}exec(e,t={}){return r(`BashSession`)}close(){r(`BashSession`)}};function m(e){return r(`betaBashTool`)}function h(e){return r(`betaReadTool`)}function g(e){return r(`betaWriteTool`)}function _(e){return r(`betaEditTool`)}function v(e){return r(`betaGlobTool`)}function y(e){return r(`betaGrepTool`)}export{p as BashSession,f as BashTimeoutError,t as DEFAULT_MEMORY_SYNC_INTERVAL_MS,a as MARKER_PATH,i as MEMORY_FLUSH_TIMEOUT_MS,n as MIN_MEMORY_SYNC_INTERVAL_MS,o as SessionMemoryError,s as SessionMemoryStores,u as betaAgentToolset20260401,m as betaBashTool,_ as betaEditTool,v as betaGlobTool,y as betaGrepTool,h as betaReadTool,g as betaWriteTool,l as extractSkillArchive,d as resolvePath,c as setupSkills};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./error-CJ3RHG07.js";function t(t){return new Proxy({},{get(n,r){if(typeof r!=`symbol`)throw new e(`\`${t}.${r}\` is not available in this environment; it needs a Node.js-compatible runtime`)}})}t(`child_process`),t(`crypto`);var n=t(`fs`);t(`os`);var r=t(`path`);t(`stream`),t(`util`);export{n as fs,r as path};
|