@fungi.computer/grove 0.14.4 → 0.16.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-By4Z1bIQ.js → anthropic-messages-BoQicMvu.js} +3 -3
- package/dist/assets/{azure-openai-responses-BsDOUkgl.js → azure-openai-responses-FDabgA7u.js} +1 -1
- package/dist/assets/base-face-BYExcFAP.js +1 -0
- package/dist/assets/burger-B7R4zMC1.js +1 -0
- package/dist/assets/cat-IVcMI3Kr.js +1 -0
- package/dist/assets/{classifier-shared-DvEpCno6.js → classifier-shared-Deocnyea.js} +1 -1
- package/dist/assets/{cloudflare-workers-ai-system-one-DPsBwamJ.js → cloudflare-workers-ai-system-one-CGH_pK-e.js} +1 -1
- package/dist/assets/{compat-CUOPBfwj.js → compat-CfHbT1sC.js} +2 -2
- package/dist/assets/conversation-toast-BrxLLwNS.js +32 -0
- package/dist/assets/document-BiiUDQ73.js +1 -0
- package/dist/assets/document-EWUYmKg3.js +1 -0
- package/dist/assets/{extension-hook-CejZHRxr.js → extension-hook-Cmt9U0vD.js} +129 -129
- package/dist/assets/{google-generative-ai-DUCr7VeE.js → google-generative-ai-Ceyomei_.js} +1 -1
- package/dist/assets/{google-shared-frBE3xCX.js → google-shared-Ck6ywoif.js} +1 -1
- package/dist/assets/{google-vertex-CD8r-zzv.js → google-vertex-BnLh-cet.js} +1 -1
- package/dist/assets/index-Du7GFgpE.js +117 -0
- package/dist/assets/{mistral-conversations-Bw8p4PjN.js → mistral-conversations-DpJGrx0P.js} +1 -1
- package/dist/assets/{mushroom-a_sE2Lmz.js → mushroom-CjQXC8r7.js} +1 -1
- package/dist/assets/{node.browser-BZ5SwBMx.js → node.browser-CrrUeMCV.js} +1 -1
- package/dist/assets/{openai-codex-responses-Dle2iCls.js → openai-codex-responses-BMXymyOJ.js} +1 -1
- package/dist/assets/{openai-codex.models-2MmGMdv7.js → openai-codex.models-DXmil0i7.js} +1 -1
- package/dist/assets/{openai-completions-B4WqFHby.js → openai-completions-FGvQd2Wf.js} +1 -1
- package/dist/assets/{openai-decisions-CVKh6c0B.js → openai-decisions-D2COFIXF.js} +1 -1
- package/dist/assets/{openai-responses-shared-Clw6C8fA.js → openai-responses-shared-DpDj6Ky1.js} +1 -1
- package/dist/assets/{openai-responses-CkPbCkKF.js → openai-responses-ySTmwOIj.js} +1 -1
- package/dist/assets/{openrouter-images-BjBROYh8.js → openrouter-images-BU5Yii-E.js} +1 -1
- package/dist/assets/parakeet-CXq4unKH.js +36 -0
- package/dist/assets/parakeet-conversation-UnWYlJ1w.js +4 -0
- package/dist/assets/{pi-messages-9oLqnyFC.js → pi-messages-RlRIpxdV.js} +1 -1
- package/dist/assets/renderer-DOUDAFcS.js +1 -0
- package/dist/assets/{runtime-core-Bfm0wdUM.js → runtime-core-Nu5SPlul.js} +2 -2
- package/dist/assets/{system-one-shared-Bv09betA.js → system-one-shared-BncCsH1N.js} +1 -1
- package/dist/assets/{transform-messages-Btz1iqkc.js → transform-messages-DXxBwHSL.js} +1 -1
- package/dist/assets/{typesafe-system-one-DbReeYyW.js → typesafe-system-one-aoUo0GON.js} +1 -1
- package/dist/assets/{website-conversation-MEoi-Lrs.js → website-conversation-CtgsyFag.js} +1 -1
- package/dist/index.html +6 -6
- package/package.json +9 -9
- package/dist/assets/animation-Ca8A_H2p.js +0 -1
- package/dist/assets/base-face-Biu4f93I.js +0 -1
- package/dist/assets/burger-X7GJ8_Mj.js +0 -1
- package/dist/assets/cat-CNPpI38P.js +0 -1
- package/dist/assets/conversation-toast-D_EnORj5.js +0 -31
- package/dist/assets/document-CEriO-BY.js +0 -1
- package/dist/assets/index-D_xvnJKX.js +0 -117
- package/dist/assets/parakeet-DopRJWw7.js +0 -36
- package/dist/assets/parakeet-conversation-2EAHj4_-.js +0 -4
- package/dist/assets/renderer-BvWy-oBw.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e,n as t}from"./text-_WthCHzw.js";import{a as n,l as r}from"./preload-helper-CfILh1TC.js";import{a as i}from"./diagnostics-CxvqSC4Q.js";import{r as a}from"./error-body-C7MTmn8e.js";import{t as o}from"./hash-yQufAZII.js";import{t as s}from"./headers-FK4rgixo.js";import{n as c}from"./streaming-json-Dg-jk7Sx.js";import{t as l}from"./sanitize-unicode-DmIE6hZJ.js";import{g as u,i as d,n as f,p}from"./transform-messages-
|
|
1
|
+
import{i as e,n as t}from"./text-_WthCHzw.js";import{a as n,l as r}from"./preload-helper-CfILh1TC.js";import{a as i}from"./diagnostics-CxvqSC4Q.js";import{r as a}from"./error-body-C7MTmn8e.js";import{t as o}from"./hash-yQufAZII.js";import{t as s}from"./headers-FK4rgixo.js";import{n as c}from"./streaming-json-Dg-jk7Sx.js";import{t as l}from"./sanitize-unicode-DmIE6hZJ.js";import{g as u,i as d,n as f,p}from"./transform-messages-DXxBwHSL.js";import{t as m}from"./abort-signals-joV34wzR.js";import{calculateCost as h,clampThinkingLevel as g,getIdentityHeaders as _}from"./compat-CfHbT1sC.js";var v=9,y=4e3,b=(e,t,n)=>{let a=new i,o=r(t,e.compat?.supportsMidConvoSystemMessages);return(async()=>{let t=S(e);try{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let i=C(),s=f(o.messages,e,e=>i(e)),c=V(e,o,s,n),l=await n?.onPayload?.(c,e);l!==void 0&&(c=l);let u=await D(e,c,r,n);if(a.push({type:`start`,partial:t}),await W(e,t,a,u,n?.onProviderStreamEvent),n?.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){t.stopReason=n?.signal?.aborted?`aborted`:`error`,t.errorMessage=T(e),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},x=(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},a=n?.reasoning?g(e,n.reasoning):void 0,o=a===`off`?void 0:a,s=e.reasoning?e.thinkingLevelMap:void 0,c=s?o?s[o]??`high`:s.off??void 0:void 0;return b(e,t,{...i,promptMode:e.reasoning&&!s&&o?`reasoning`:void 0,reasoningEffort:c})};function S(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 C(){let e=new Map,t=new Map;return n=>{let r=e.get(n);if(r)return r;let i=0;for(;;){let r=w(n,i),a=t.get(r);if(!a||a===n)return e.set(n,r),t.set(r,n),r;i++}}}function w(e,t){let n=e.replace(/[^a-zA-Z0-9]/g,``);if(t===0&&n.length===v)return n;let r=n||e,i=t===0?r:`${r}:${t}`;return o(i).replace(/[^a-zA-Z0-9]/g,``).slice(0,v)}function T(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}): ${a(r,y)}`:n===void 0?e.message:`Mistral API error (${n}): ${e.message}`}return E(e)}function E(e){try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}async function D(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=k(e,n,r),c=r?.timeoutMs??6e4,l=AbortSignal.timeout(c),u=m([r?.signal,l]),d;try{d=await(r?.fetch??globalThis.fetch)(a,{method:`POST`,headers:o,body:JSON.stringify(M(t)),signal:u.signal})}catch(e){throw l.aborted&&!r?.signal?.aborted?Error(`Mistral response headers timed out after ${c}ms`):e}finally{u.cleanup()}if(await r?.onResponse?.({status:d.status,headers:s(d.headers)},e),!d.ok){let e=await d.text();throw new O(d.status,e,d.statusText)}if(!d.body)throw Error(`Mistral response has no body`);return R(d.body,r?.signal)}var O=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 k(e,t,n){let r=new Headers({..._(e,n?.identity),accept:`text/event-stream`,authorization:`Bearer ${t}`,"content-type":`application/json`});A(r,e.headers),A(r,n?.headers);let i=j(e.headers,`x-affinity`)||j(n?.headers,`x-affinity`);return H(n)&&!i&&r.set(`x-affinity`,n.sessionId),r}function A(e,t){if(t)for(let[n,r]of Object.entries(t))r===null?e.delete(n):e.set(n,r)}function j(e,t){return!!e&&Object.keys(e).some(e=>e.toLowerCase()===t)}function M(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`]])F(t,e,n);t.messages=e.messages.map(e=>N(e));let n=t.response_format;if(I(n)){let e={...n};F(e,`jsonSchema`,`json_schema`);let r=e.json_schema;if(I(r)){let t={...r};F(t,`schemaDefinition`,`schema`),e.json_schema=t}t.response_format=e}return t}function N(e){let t={...e};return F(t,`toolCalls`,`tool_calls`),F(t,`toolCallId`,`tool_call_id`),Array.isArray(e.content)&&(t.content=e.content.map(e=>P(e))),t}function P(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`]])F(t,e,n);return t}function F(e,t,n){t in e&&(e[n]=e[t],delete e[t])}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var L=Symbol(`mistral-stream-done`);async function*R(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=z(i);for(;o;){let e=B(i.slice(0,o.index));if(i=i.slice(o.index+o.length),e===L)return;e&&(yield e),o=z(i)}if(e)break}if(i.trim()){let e=B(i);e!==L&&e&&(yield e)}}finally{t?.removeEventListener(`abort`,a);try{await n.cancel()}catch{}try{n.releaseLock()}catch{}}}function z(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 B(e){let t=e.split(/\r\n|\r|\n/u).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
2
2
|
`).trim();if(!t)return;if(t===`[DONE]`)return L;let n=JSON.parse(t);if(!I(n)||!Array.isArray(n.choices))throw Error(`Invalid Mistral streaming event`);return{data:n}}function V(e,t,r,i){let a={model:e.id,stream:!0,messages:q(r,e.input.includes(`image`))},o=n(t.messages);return o.length>0&&(a.tools=G(o)),i?.temperature!==void 0&&(a.temperature=i.temperature),i?.maxTokens!==void 0&&(a.maxTokens=i.maxTokens),i?.toolChoice&&(a.toolChoice=Y(i.toolChoice)),i?.promptMode&&(a.promptMode=i.promptMode),i?.reasoningEffort&&(a.reasoningEffort=i.reasoningEffort),H(i)&&(a.promptCacheKey=i.sessionId),a}function H(e){return e?.cacheRetention!==`none`&&!!e?.sessionId}function U(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 W(e,t,n,r,i){let a=null,o=t.content,s=()=>o.length-1,u=new Map,d=e=>{if(e){if(e.type===`text`){n.push({type:`text_end`,contentIndex:s(),content:e.text,partial:t});return}e.type===`thinking`&&n.push({type:`thinking_end`,contentIndex:s(),content:e.thinking,partial:t})}};for await(let o of r){let r=o.data;if(await i?.(r,e),t.responseId||=r.id,r.usage){let n=r.usage.prompt_tokens||0,i=U(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,h(e,t.usage)}let f=r.choices[0];if(!f)continue;if(f.finish_reason){t.rawStopReason=f.finish_reason;let e=X(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=l(r);if(!e)continue;(!a||a.type!==`text`)&&(d(a),a={type:`text`,text:``},t.content.push(a),n.push({type:`text_start`,contentIndex:s(),partial:t})),a.text+=e,n.push({type:`text_delta`,contentIndex:s(),delta:e,partial:t});continue}if(r.type===`thinking`){let e=(r.thinking??[]).map(e=>e.text??``).filter(e=>e.length>0).join(``),i=l(e);if(!i)continue;(!a||a.type!==`thinking`)&&(d(a),a={type:`thinking`,thinking:``},t.content.push(a),n.push({type:`thinking_start`,contentIndex:s(),partial:t})),a.thinking+=i,n.push({type:`thinking_delta`,contentIndex:s(),delta:i,partial:t});continue}if(r.type===`text`){let e=l(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:s(),partial:t})),a.text+=e,n.push({type:`text_delta`,contentIndex:s(),delta:e,partial:t})}}}let m=p.tool_calls||[];for(let e of m){a&&=(d(a),null);let r=e.id&&e.id!==`null`?e.id:w(`toolcall:${e.index??0}`,0),i=e.index??r,o=u.get(i);o||(t.content.push({type:`toolCall`,id:r,name:e.function.name,arguments:{}}),o={contentIndex:t.content.length-1,arguments:new c},u.set(i,o),n.push({type:`toolcall_start`,contentIndex:o.contentIndex,partial:t}));let s=typeof e.function.arguments==`string`?e.function.arguments:JSON.stringify(e.function.arguments||{});t.content[o.contentIndex].arguments=o.arguments.append(s),n.push({type:`toolcall_delta`,contentIndex:o.contentIndex,delta:s,partial:t})}}d(a);for(let e of u.values()){let r=t.content[e.contentIndex];Object.assign(r,e.arguments.finish()),n.push({type:`toolcall_end`,contentIndex:e.contentIndex,toolCall:r,partial:t})}}function G(e){return e.map(e=>{let t=u(e,!0);return{type:`function`,function:{name:e.name,description:e.description,parameters:K(p(e,t)),strict:t??!1}}})}function K(e){if(Array.isArray(e))return e.map(e=>K(e));if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=K(r);return t}return e}function q(n,r){let i=[];for(let[a,o]of n.entries()){if(o.role===`system`){let n=a===0?t(o):e(o);n.length>0&&i.push({role:`system`,content:l(n)});continue}if(o.role===`user`){if(typeof o.content==`string`){i.push({role:`user`,content:l(o.content)});continue}let e=o.content.some(e=>e.type===`image`),t=o.content.filter(e=>e.type===`text`||r).map(e=>e.type===`text`?{type:`text`,text:l(e.text)}:{type:`image_url`,imageUrl:`data:${e.mimeType};base64,${e.data}`});if(t.length>0){i.push({role:`user`,content:t});continue}e&&!r&&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:l(n.text)});continue}if(n.type===`thinking`){n.thinking.trim().length>0&&e.push({type:`thinking`,thinking:[{type:`text`,text:l(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 n=[],s=J(o.content.filter(e=>e.type===`text`).map(e=>e.type===`text`?l(e.text):``).join(`
|
|
3
3
|
`),o.content.some(e=>e.type===`image`),r,o.isError);n.push({type:`text`,text:s});for(let e of o.content)r&&e.type===`image`&&n.push({type:`image_url`,imageUrl:`data:${e.mimeType};base64,${e.data}`});i.push({role:`tool`,toolCallId:o.toolCallId,name:o.toolName,content:n})}return i}function J(e,t,n,r){let i=e.trim(),a=r?`[tool error] `:``;return i.length>0?`${a}${i}${t&&!n?`
|
|
4
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 Y(e){if(e)return e===`auto`||e===`none`||e===`any`||e===`required`?e:{type:`function`,function:{name:e.function.name}}}function X(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 (server error)`};default:return{stopReason:`error`,errorMessage:`Provider stopped with: ${e}`}}}export{b as stream,x as streamSimple};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./document-CEriO-BY.js";import{t}from"./renderer-BvWy-oBw.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`},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"}}],"palette":{"body":"#fff7e4","cap":"#f98284","capSpot":"#ffe6c6","eye":"#28282e","mouth":"#28282e","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-96","medium":"node-96","big":"node-96"}},"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:e.parse(n),render:t};export{r as default};
|
|
1
|
+
import{t as e}from"./document-EWUYmKg3.js";import{t}from"./renderer-DOUDAFcS.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`},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"}}],"palette":{"body":"#fff7e4","cap":"#f98284","capSpot":"#ffe6c6","eye":"#28282e","mouth":"#28282e","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-96","medium":"node-96","big":"node-96"}},"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:e.parse(n),render:t};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./error-BTdmRKoB.js";import{n as t,r as n}from"./anthropic-messages-
|
|
1
|
+
import{a as e}from"./error-BTdmRKoB.js";import{n as t,r as n}from"./anthropic-messages-BoQicMvu.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};
|
package/dist/assets/{openai-codex-responses-Dle2iCls.js → openai-codex-responses-BMXymyOJ.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./text-_WthCHzw.js";import{c as t,l as n,o as r,s as i,u as a}from"./preload-helper-CfILh1TC.js";import{t as o}from"./provider-env-CcCbsTJq.js";import{a as s,i as c,n as l,t as u}from"./diagnostics-CxvqSC4Q.js";import{t as d}from"./session-resources-CTNtT8Oa.js";import{n as f,t as p}from"./error-body-C7MTmn8e.js";import{t as m}from"./headers-FK4rgixo.js";import{d as h,i as g}from"./transform-messages-Btz1iqkc.js";import{t as _}from"./openai-prompt-cache-DXo9f3w5.js";import{i as v,n as y,r as b,t as x}from"./openai-responses-shared-Clw6C8fA.js";import{t as S}from"./abort-signals-joV34wzR.js";import{clampThinkingLevel as C,getIdentityHeaders as w}from"./compat-CUOPBfwj.js";import{n as ee}from"./runtime-core-Bfm0wdUM.js";var T={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function E(e,t){let n=e.toLowerCase(),r=e.toUpperCase();return t?.[n]||t?.[r]||o(n)||o(r)||``}function D(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function O(e){return e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e}function k(e){let t=e.trim().toLowerCase();if(!t)return;if(t.startsWith(`[`)){let e=t.indexOf(`]`);if(e!==-1){let n=t.slice(1,e),r=t.slice(e+1);if(r.startsWith(`:`)){let e=Number.parseInt(r.slice(1),10);return{host:n,port:Number.isNaN(e)?0:e}}return{host:n,port:0}}}if(t.includes(`:`)&&t.split(`:`).length>2)return{host:t,port:0};let n=t.lastIndexOf(`:`);if(n!==-1&&n===t.indexOf(`:`)){let e=t.slice(0,n),r=Number.parseInt(t.slice(n+1),10);if(!Number.isNaN(r))return{host:e,port:r}}return{host:t,port:0}}function A(e,t,n){let r=E(`no_proxy`,n).toLowerCase();if(!r)return!0;if(r===`*`)return!1;let i=O(e.toLowerCase());return r.split(/[,\s]/).every(e=>{let n=k(e);if(!n||n.port&&n.port!==t)return!0;let r=O(n.host);return r.startsWith(`*.`)?r=r.slice(2):(r.startsWith(`.`)||r.startsWith(`*`))&&(r=r.slice(1)),!r||!(i===r||i.endsWith(`.${r}`))})}function te(e,t){let n=D(e);if(!n?.protocol||!n.host)return``;let r=n.protocol.split(`:`,1)[0];if(!A(O(n.hostname||n.host.replace(/:\d*$/,``)),Number.parseInt(n.port,10)||T[r]||0,t))return``;let i=E(`${r}_proxy`,t)||E(`all_proxy`,t);return i&&!i.includes(`://`)&&(i=`${r}://${i}`),i}var j=`Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.`;function M(e,t){let n=te(e,t);if(!n)return;let r;try{r=new URL(n)}catch(e){throw Error(`Invalid proxy URL ${JSON.stringify(n)}: ${e instanceof Error?e.message:String(e)}`)}if(r.protocol!==`http:`&&r.protocol!==`https:`)throw Error(`${j} Got ${r.protocol}`);return r}var N=`https://chatgpt.com/backend-api`,ne=`https://api.openai.com/auth`,re=0,P=1e3,ie=6e4,ae=15e3,oe=3,F=new Set([`openai`,`openai-codex`,`opencode`]),se=1009,ce=`websocket_connection_limit_reached`,le=`previous_response_not_found`,ue=new Set([`completed`,`incomplete`,`failed`,`cancelled`,`queued`,`in_progress`]);function I(e){if(e.stopReason===`pending`)throw Error(`Codex stream ended without a stop reason`);if(e.stopReason===`error`||e.stopReason===`aborted`)throw Error(e.errorMessage||`An unknown error occurred`)}function de(e){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(e)}function fe(e,t){return e===429&&de(t)?!1:e===429||e===500||e===502||e===503||e===504||/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(t)}function pe(e){let t=e.get(`retry-after-ms`);if(t!==null){let e=Number(t);if(Number.isFinite(e))return Math.max(0,e)}let n=e.get(`retry-after`);if(!n)return;let r=Number(n);if(Number.isFinite(r))return Math.max(0,r*1e3);let i=Date.parse(n);if(!Number.isNaN(i))return Math.max(0,i-Date.now())}var L=class extends Error{};function me(e,t){let n=t?.maxRetryDelayMs??ie;if(n>0&&e>n)throw new L(`Server requested ${Math.ceil(e/1e3)}s retry delay (max: ${Math.ceil(n/1e3)}s)`);return e}function R(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Error(`Request was aborted`));return}let i=()=>{clearTimeout(a),r(Error(`Request was aborted`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})})}function he(e){if(e!==void 0){if(!Number.isFinite(e)||e<0)throw Error(`Invalid timeoutMs: ${String(e)}`);return Math.floor(e)}}function ge(){return typeof process>`u`||!(process.versions?.node||process.versions?.bun)?null:process.getBuiltinModule?.(`node:zlib`)??null}function _e(e){let t=ge();if(!t||typeof t.zstdCompressSync!=`function`)return null;try{let n=t.zstdCompressSync(e,{params:{[t.constants.ZSTD_c_compressionLevel]:oe}});return new Uint8Array(n)}catch{return null}}var ve=(e,t,i)=>{let a=new s,o=n(t,e.compat?.supportsMidConvoSystemMessages);return(async()=>{let t={role:`assistant`,content:[],api:`openai-codex-responses`,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{let n=i?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let s=rt(n),c=h(r(o.messages),e.compat?.supportsOpenAIGrammarTools??!1),d=i?.cacheRetention===`none`?void 0:i?.sessionId,f=_(d),p=be(e,o,i,f,c),g=await i?.onPayload?.(p,e);g!==void 0&&(p=g);let v=f||ee(),y={originator:`pi`,...w(e,i?.identity)},b=at(y,e.headers,i?.headers,s,n,f),x=ot(y,e.headers,i?.headers,s,n,v),C=JSON.stringify(p),T=he(i?.timeoutMs),E=he(i?.websocketConnectTimeoutMs),D=i?.transport||`auto`,O=!1,k=D!==`sse`&&J(d);if(k&&Re(d),D!==`sse`&&!k){let n=!1,r=!1,o=!1;for(;;){n=!1;try{if(await tt(Te(e.baseUrl),p,x,t,a,e,()=>{n=!0,O||(O=!0,a.push({type:`start`,partial:t}))},T,E,d,s,c,i),i?.signal?.aborted)throw Error(`Request was aborted`);I(t),a.push({type:`done`,reason:t.stopReason,message:t}),a.end();return}catch(e){let a=i?.signal?.aborted,s=!n&&Oe(e),c=ke(e);if(!a&&c&&!o){o=!0;continue}if(!a&&s&&!r){r=!0;continue}if(a||De(e)&&!s||(u(t,l(`provider_transport_failure`,e,{configuredTransport:D,...n?{}:{fallbackTransport:`sse`},eventsEmitted:n,phase:n?`after_message_stream_start`:`before_message_stream_start`,requestBytes:new TextEncoder().encode(C).byteLength})),ze(d,e),n))throw e;Re(d);break}}}let A=_e(C);A&&b.set(`content-encoding`,`zstd`);let te=A??C,j,M,N=i?.maxRetries??re;for(let t=0;t<=N;t++){if(i?.signal?.aborted)throw Error(`Request was aborted`);try{let n=T!==void 0&&T>0?AbortSignal.timeout(T):void 0,r=S([i?.signal,n]);try{j=await(i?.fetch??globalThis.fetch)(we(e.baseUrl),{method:`POST`,headers:b,body:te,signal:r.signal})}catch(e){throw n?.aborted&&!i?.signal?.aborted?Error(`Codex SSE response headers timed out after ${T}ms`):e}finally{r.cleanup()}if(await i?.onResponse?.({status:j.status,headers:m(j.headers)},e),j.ok)break;let a=await j.text();if(t<N&&fe(j.status,a)){let e=pe(j.headers);await R(e===void 0?P*2**t:me(e,i),i?.signal);continue}let o=await nt(new Response(a,{status:j.status,statusText:j.statusText}));throw Error(o.friendlyMessage||o.message)}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.message===`Request was aborted`))throw Error(`Request was aborted`);if(M=e instanceof Error?e:Error(String(e)),t<N&&!(M instanceof L)&&!M.message.includes(`usage limit`)){await R(P*2**t,i?.signal);continue}throw M}}if(!j?.ok)throw M??Error(`Failed after retries`);if(!j.body)throw Error(`No response body`);if(O||(O=!0,a.push({type:`start`,partial:t})),await Ee(j,t,a,e,c,i),i?.signal?.aborted)throw Error(`Request was aborted`);I(t),a.push({type:`done`,reason:t.stopReason,message:t}),a.end()}catch(e){t.stopReason=i?.signal?.aborted?`aborted`:`error`,t.errorMessage=p(f(e)),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},ye=(e,t,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let i={...g(e,t,n,r),toolChoice:n?.toolChoice},a=n?.reasoning?C(e,n.reasoning):void 0,o=a===`off`?void 0:a;return ve(e,t,{...i,reasoningEffort:o})};function be(t,n,o,s,c=h(r(n.messages),t.compat?.supportsOpenAIGrammarTools??!1)){let l=t.compat?.supportsStrictMode??!0,u=t.compat?.supportsOpenAIGrammarTools??!1,d=t.compat?.supportsAdditionalTools??!1,f=t.compat?.supportsToolSearch??!1,p=a(n.messages,b({supportsMidConvoSystemMessages:t.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:d,supportsToolSearch:f})),m=x(t,n,F,{includeSystemPrompt:!1,grammarToolInputProperties:c,supportsMidConvoSystemMessages:t.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:d,supportsToolSearch:f,toolOptions:{strict:null,supportsStrictMode:l,supportsOpenAIGrammarTools:u}}),g=i(n.messages),_=g?e(g):``,v={model:t.id,store:!1,stream:!0,instructions:_||`You are a helpful assistant.`,input:m,text:{verbosity:o?.textVerbosity||`low`},include:[`reasoning.encrypted_content`],prompt_cache_key:s,tool_choice:o?.toolChoice??`auto`,parallel_tool_calls:!0};if(o?.temperature!==void 0&&(v.temperature=o.temperature),o?.serviceTier!==void 0&&(v.service_tier=o.serviceTier),p.requestTools.length>0&&(v.tools=y(p.requestTools,{strict:null,supportsStrictMode:l,supportsOpenAIGrammarTools:u})),o?.reasoningEffort!==void 0){let e=o.reasoningEffort===`none`?t.thinkingLevelMap?.off===void 0?`none`:t.thinkingLevelMap.off:t.thinkingLevelMap?.[o.reasoningEffort]??o.reasoningEffort;e!==null&&(v.reasoning={effort:e,summary:o.reasoningSummary??`auto`})}else t.reasoning&&t.thinkingLevelMap?.off!==null&&(v.reasoning={effort:t.thinkingLevelMap?.off??`none`});return v}function xe(e,t){switch(t){case`flex`:return .5;case`priority`:return e.id===`gpt-5.5`?2.5:2;default:return 1}}function Se(e,t,n){let r=xe(n,t);r!==1&&(e.cost.input*=r,e.cost.output*=r,e.cost.cacheRead*=r,e.cost.cacheWrite*=r,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite)}function Ce(e,t){return e==="default"&&(t===`flex`||t===`priority`)?t:e??t}function we(e){let t=(e&&e.trim().length>0?e:N).replace(/\/+$/,``);return t.endsWith(`/codex/responses`)?t:t.endsWith(`/codex`)?`${t}/responses`:`${t}/codex/responses`}function Te(e){let t=new URL(we(e));return t.protocol===`https:`&&(t.protocol=`wss:`),t.protocol===`http:`&&(t.protocol=`ws:`),t.toString()}async function Ee(e,t,n,r,i,a){await v(H(Me(e,a?.signal),t,r,a?.onProviderStreamEvent),t,n,r,{serviceTier:a?.serviceTier,grammarToolInputProperties:i,resolveServiceTier:Ce,applyServiceTierPricing:(e,t)=>Se(e,t,r)})}var z=class extends Error{code;payload;constructor(e,t){super(e),this.name=`CodexApiError`,this.code=t?.code,this.payload=t?.payload,this.cause=t?.cause}},B=class extends Error{payload;constructor(e,t){super(e),this.name=`CodexProtocolError`,this.payload=t?.payload,this.cause=t?.cause}},V=class extends Error{constructor(e){super(c(e)),this.name=`ProviderStreamEventCallbackError`,this.cause=e}};function De(e){return e instanceof z||e instanceof B||e instanceof V}function Oe(e){return e instanceof z&&e.code===ce}function ke(e){return e instanceof z&&e.code===le}function Ae(e){let t=e.error&&typeof e.error==`object`?e.error:void 0;return{code:typeof e.code==`string`?e.code:typeof t?.code==`string`?t.code:void 0,message:typeof e.message==`string`?e.message:typeof t?.message==`string`?t.message:void 0}}async function*H(e,t,n,r){for await(let i of e){try{await r?.(i,n)}catch(e){throw new V(e)}let e=typeof i.type==`string`?i.type:void 0;if(e){if(e===`error`){let{code:e,message:t}=Ae(i);throw new z(`Codex error: ${t||e||JSON.stringify(i)}`,{code:e,payload:i})}if(e===`response.failed`){let e=i.response,t=e?.error?.code,n=e?.error?.message;throw new z(n||`Codex response failed`,{code:t,payload:i})}if(e===`response.done`||e===`response.completed`||e===`response.incomplete`){let e=i.response;typeof e?.end_turn==`boolean`&&(t.endTurn=e.end_turn);let n=e&&{...e,status:je(e.status)};yield{...i,type:`response.completed`,response:n};return}yield i}}}function je(e){if(typeof e==`string`)return ue.has(e)?e:void 0}async function*Me(e,t){if(!e.body)return;let n=e.body.getReader(),r=new TextDecoder,i=``,a=()=>{n.cancel().catch(()=>{})};t?.addEventListener(`abort`,a,{once:!0});try{for(;;){if(t?.aborted)throw Error(`Request was aborted`);let{done:e,value:a}=await n.read();if(t?.aborted)throw Error(`Request was aborted`);i+=e?r.decode():r.decode(a,{stream:!0}),e&&i.trim()&&(i+=`
|
|
1
|
+
import{n as e}from"./text-_WthCHzw.js";import{c as t,l as n,o as r,s as i,u as a}from"./preload-helper-CfILh1TC.js";import{t as o}from"./provider-env-CcCbsTJq.js";import{a as s,i as c,n as l,t as u}from"./diagnostics-CxvqSC4Q.js";import{t as d}from"./session-resources-CTNtT8Oa.js";import{n as f,t as p}from"./error-body-C7MTmn8e.js";import{t as m}from"./headers-FK4rgixo.js";import{d as h,i as g}from"./transform-messages-DXxBwHSL.js";import{t as _}from"./openai-prompt-cache-DXo9f3w5.js";import{i as v,n as y,r as b,t as x}from"./openai-responses-shared-DpDj6Ky1.js";import{t as S}from"./abort-signals-joV34wzR.js";import{clampThinkingLevel as C,getIdentityHeaders as w}from"./compat-CfHbT1sC.js";import{n as ee}from"./runtime-core-Nu5SPlul.js";var T={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function E(e,t){let n=e.toLowerCase(),r=e.toUpperCase();return t?.[n]||t?.[r]||o(n)||o(r)||``}function D(e){if(e instanceof URL)return e;try{return new URL(e)}catch{return}}function O(e){return e.startsWith(`[`)&&e.endsWith(`]`)?e.slice(1,-1):e}function k(e){let t=e.trim().toLowerCase();if(!t)return;if(t.startsWith(`[`)){let e=t.indexOf(`]`);if(e!==-1){let n=t.slice(1,e),r=t.slice(e+1);if(r.startsWith(`:`)){let e=Number.parseInt(r.slice(1),10);return{host:n,port:Number.isNaN(e)?0:e}}return{host:n,port:0}}}if(t.includes(`:`)&&t.split(`:`).length>2)return{host:t,port:0};let n=t.lastIndexOf(`:`);if(n!==-1&&n===t.indexOf(`:`)){let e=t.slice(0,n),r=Number.parseInt(t.slice(n+1),10);if(!Number.isNaN(r))return{host:e,port:r}}return{host:t,port:0}}function A(e,t,n){let r=E(`no_proxy`,n).toLowerCase();if(!r)return!0;if(r===`*`)return!1;let i=O(e.toLowerCase());return r.split(/[,\s]/).every(e=>{let n=k(e);if(!n||n.port&&n.port!==t)return!0;let r=O(n.host);return r.startsWith(`*.`)?r=r.slice(2):(r.startsWith(`.`)||r.startsWith(`*`))&&(r=r.slice(1)),!r||!(i===r||i.endsWith(`.${r}`))})}function te(e,t){let n=D(e);if(!n?.protocol||!n.host)return``;let r=n.protocol.split(`:`,1)[0];if(!A(O(n.hostname||n.host.replace(/:\d*$/,``)),Number.parseInt(n.port,10)||T[r]||0,t))return``;let i=E(`${r}_proxy`,t)||E(`all_proxy`,t);return i&&!i.includes(`://`)&&(i=`${r}://${i}`),i}var j=`Unsupported proxy protocol. SOCKS and PAC proxy URLs are not supported; use an HTTP or HTTPS proxy URL.`;function M(e,t){let n=te(e,t);if(!n)return;let r;try{r=new URL(n)}catch(e){throw Error(`Invalid proxy URL ${JSON.stringify(n)}: ${e instanceof Error?e.message:String(e)}`)}if(r.protocol!==`http:`&&r.protocol!==`https:`)throw Error(`${j} Got ${r.protocol}`);return r}var N=`https://chatgpt.com/backend-api`,ne=`https://api.openai.com/auth`,re=0,P=1e3,ie=6e4,ae=15e3,oe=3,F=new Set([`openai`,`openai-codex`,`opencode`]),se=1009,ce=`websocket_connection_limit_reached`,le=`previous_response_not_found`,ue=new Set([`completed`,`incomplete`,`failed`,`cancelled`,`queued`,`in_progress`]);function I(e){if(e.stopReason===`pending`)throw Error(`Codex stream ended without a stop reason`);if(e.stopReason===`error`||e.stopReason===`aborted`)throw Error(e.errorMessage||`An unknown error occurred`)}function de(e){return/GoUsageLimitError|FreeUsageLimitError|Monthly usage limit reached|available balance|insufficient_quota|out of budget|quota exceeded|billing/i.test(e)}function fe(e,t){return e===429&&de(t)?!1:e===429||e===500||e===502||e===503||e===504||/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(t)}function pe(e){let t=e.get(`retry-after-ms`);if(t!==null){let e=Number(t);if(Number.isFinite(e))return Math.max(0,e)}let n=e.get(`retry-after`);if(!n)return;let r=Number(n);if(Number.isFinite(r))return Math.max(0,r*1e3);let i=Date.parse(n);if(!Number.isNaN(i))return Math.max(0,i-Date.now())}var L=class extends Error{};function me(e,t){let n=t?.maxRetryDelayMs??ie;if(n>0&&e>n)throw new L(`Server requested ${Math.ceil(e/1e3)}s retry delay (max: ${Math.ceil(n/1e3)}s)`);return e}function R(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Error(`Request was aborted`));return}let i=()=>{clearTimeout(a),r(Error(`Request was aborted`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})})}function he(e){if(e!==void 0){if(!Number.isFinite(e)||e<0)throw Error(`Invalid timeoutMs: ${String(e)}`);return Math.floor(e)}}function ge(){return typeof process>`u`||!(process.versions?.node||process.versions?.bun)?null:process.getBuiltinModule?.(`node:zlib`)??null}function _e(e){let t=ge();if(!t||typeof t.zstdCompressSync!=`function`)return null;try{let n=t.zstdCompressSync(e,{params:{[t.constants.ZSTD_c_compressionLevel]:oe}});return new Uint8Array(n)}catch{return null}}var ve=(e,t,i)=>{let a=new s,o=n(t,e.compat?.supportsMidConvoSystemMessages);return(async()=>{let t={role:`assistant`,content:[],api:`openai-codex-responses`,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{let n=i?.apiKey;if(!n)throw Error(`No API key for provider: ${e.provider}`);let s=rt(n),c=h(r(o.messages),e.compat?.supportsOpenAIGrammarTools??!1),d=i?.cacheRetention===`none`?void 0:i?.sessionId,f=_(d),p=be(e,o,i,f,c),g=await i?.onPayload?.(p,e);g!==void 0&&(p=g);let v=f||ee(),y={originator:`pi`,...w(e,i?.identity)},b=at(y,e.headers,i?.headers,s,n,f),x=ot(y,e.headers,i?.headers,s,n,v),C=JSON.stringify(p),T=he(i?.timeoutMs),E=he(i?.websocketConnectTimeoutMs),D=i?.transport||`auto`,O=!1,k=D!==`sse`&&J(d);if(k&&Re(d),D!==`sse`&&!k){let n=!1,r=!1,o=!1;for(;;){n=!1;try{if(await tt(Te(e.baseUrl),p,x,t,a,e,()=>{n=!0,O||(O=!0,a.push({type:`start`,partial:t}))},T,E,d,s,c,i),i?.signal?.aborted)throw Error(`Request was aborted`);I(t),a.push({type:`done`,reason:t.stopReason,message:t}),a.end();return}catch(e){let a=i?.signal?.aborted,s=!n&&Oe(e),c=ke(e);if(!a&&c&&!o){o=!0;continue}if(!a&&s&&!r){r=!0;continue}if(a||De(e)&&!s||(u(t,l(`provider_transport_failure`,e,{configuredTransport:D,...n?{}:{fallbackTransport:`sse`},eventsEmitted:n,phase:n?`after_message_stream_start`:`before_message_stream_start`,requestBytes:new TextEncoder().encode(C).byteLength})),ze(d,e),n))throw e;Re(d);break}}}let A=_e(C);A&&b.set(`content-encoding`,`zstd`);let te=A??C,j,M,N=i?.maxRetries??re;for(let t=0;t<=N;t++){if(i?.signal?.aborted)throw Error(`Request was aborted`);try{let n=T!==void 0&&T>0?AbortSignal.timeout(T):void 0,r=S([i?.signal,n]);try{j=await(i?.fetch??globalThis.fetch)(we(e.baseUrl),{method:`POST`,headers:b,body:te,signal:r.signal})}catch(e){throw n?.aborted&&!i?.signal?.aborted?Error(`Codex SSE response headers timed out after ${T}ms`):e}finally{r.cleanup()}if(await i?.onResponse?.({status:j.status,headers:m(j.headers)},e),j.ok)break;let a=await j.text();if(t<N&&fe(j.status,a)){let e=pe(j.headers);await R(e===void 0?P*2**t:me(e,i),i?.signal);continue}let o=await nt(new Response(a,{status:j.status,statusText:j.statusText}));throw Error(o.friendlyMessage||o.message)}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.message===`Request was aborted`))throw Error(`Request was aborted`);if(M=e instanceof Error?e:Error(String(e)),t<N&&!(M instanceof L)&&!M.message.includes(`usage limit`)){await R(P*2**t,i?.signal);continue}throw M}}if(!j?.ok)throw M??Error(`Failed after retries`);if(!j.body)throw Error(`No response body`);if(O||(O=!0,a.push({type:`start`,partial:t})),await Ee(j,t,a,e,c,i),i?.signal?.aborted)throw Error(`Request was aborted`);I(t),a.push({type:`done`,reason:t.stopReason,message:t}),a.end()}catch(e){t.stopReason=i?.signal?.aborted?`aborted`:`error`,t.errorMessage=p(f(e)),a.push({type:`error`,reason:t.stopReason,error:t}),a.end()}})(),a},ye=(e,t,n)=>{let r=n?.apiKey;if(!r)throw Error(`No API key for provider: ${e.provider}`);let i={...g(e,t,n,r),toolChoice:n?.toolChoice},a=n?.reasoning?C(e,n.reasoning):void 0,o=a===`off`?void 0:a;return ve(e,t,{...i,reasoningEffort:o})};function be(t,n,o,s,c=h(r(n.messages),t.compat?.supportsOpenAIGrammarTools??!1)){let l=t.compat?.supportsStrictMode??!0,u=t.compat?.supportsOpenAIGrammarTools??!1,d=t.compat?.supportsAdditionalTools??!1,f=t.compat?.supportsToolSearch??!1,p=a(n.messages,b({supportsMidConvoSystemMessages:t.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:d,supportsToolSearch:f})),m=x(t,n,F,{includeSystemPrompt:!1,grammarToolInputProperties:c,supportsMidConvoSystemMessages:t.compat?.supportsMidConvoSystemMessages??!1,supportsAdditionalTools:d,supportsToolSearch:f,toolOptions:{strict:null,supportsStrictMode:l,supportsOpenAIGrammarTools:u}}),g=i(n.messages),_=g?e(g):``,v={model:t.id,store:!1,stream:!0,instructions:_||`You are a helpful assistant.`,input:m,text:{verbosity:o?.textVerbosity||`low`},include:[`reasoning.encrypted_content`],prompt_cache_key:s,tool_choice:o?.toolChoice??`auto`,parallel_tool_calls:!0};if(o?.temperature!==void 0&&(v.temperature=o.temperature),o?.serviceTier!==void 0&&(v.service_tier=o.serviceTier),p.requestTools.length>0&&(v.tools=y(p.requestTools,{strict:null,supportsStrictMode:l,supportsOpenAIGrammarTools:u})),o?.reasoningEffort!==void 0){let e=o.reasoningEffort===`none`?t.thinkingLevelMap?.off===void 0?`none`:t.thinkingLevelMap.off:t.thinkingLevelMap?.[o.reasoningEffort]??o.reasoningEffort;e!==null&&(v.reasoning={effort:e,summary:o.reasoningSummary??`auto`})}else t.reasoning&&t.thinkingLevelMap?.off!==null&&(v.reasoning={effort:t.thinkingLevelMap?.off??`none`});return v}function xe(e,t){switch(t){case`flex`:return .5;case`priority`:return e.id===`gpt-5.5`?2.5:2;default:return 1}}function Se(e,t,n){let r=xe(n,t);r!==1&&(e.cost.input*=r,e.cost.output*=r,e.cost.cacheRead*=r,e.cost.cacheWrite*=r,e.cost.total=e.cost.input+e.cost.output+e.cost.cacheRead+e.cost.cacheWrite)}function Ce(e,t){return e==="default"&&(t===`flex`||t===`priority`)?t:e??t}function we(e){let t=(e&&e.trim().length>0?e:N).replace(/\/+$/,``);return t.endsWith(`/codex/responses`)?t:t.endsWith(`/codex`)?`${t}/responses`:`${t}/codex/responses`}function Te(e){let t=new URL(we(e));return t.protocol===`https:`&&(t.protocol=`wss:`),t.protocol===`http:`&&(t.protocol=`ws:`),t.toString()}async function Ee(e,t,n,r,i,a){await v(H(Me(e,a?.signal),t,r,a?.onProviderStreamEvent),t,n,r,{serviceTier:a?.serviceTier,grammarToolInputProperties:i,resolveServiceTier:Ce,applyServiceTierPricing:(e,t)=>Se(e,t,r)})}var z=class extends Error{code;payload;constructor(e,t){super(e),this.name=`CodexApiError`,this.code=t?.code,this.payload=t?.payload,this.cause=t?.cause}},B=class extends Error{payload;constructor(e,t){super(e),this.name=`CodexProtocolError`,this.payload=t?.payload,this.cause=t?.cause}},V=class extends Error{constructor(e){super(c(e)),this.name=`ProviderStreamEventCallbackError`,this.cause=e}};function De(e){return e instanceof z||e instanceof B||e instanceof V}function Oe(e){return e instanceof z&&e.code===ce}function ke(e){return e instanceof z&&e.code===le}function Ae(e){let t=e.error&&typeof e.error==`object`?e.error:void 0;return{code:typeof e.code==`string`?e.code:typeof t?.code==`string`?t.code:void 0,message:typeof e.message==`string`?e.message:typeof t?.message==`string`?t.message:void 0}}async function*H(e,t,n,r){for await(let i of e){try{await r?.(i,n)}catch(e){throw new V(e)}let e=typeof i.type==`string`?i.type:void 0;if(e){if(e===`error`){let{code:e,message:t}=Ae(i);throw new z(`Codex error: ${t||e||JSON.stringify(i)}`,{code:e,payload:i})}if(e===`response.failed`){let e=i.response,t=e?.error?.code,n=e?.error?.message;throw new z(n||`Codex response failed`,{code:t,payload:i})}if(e===`response.done`||e===`response.completed`||e===`response.incomplete`){let e=i.response;typeof e?.end_turn==`boolean`&&(t.endTurn=e.end_turn);let n=e&&{...e,status:je(e.status)};yield{...i,type:`response.completed`,response:n};return}yield i}}}function je(e){if(typeof e==`string`)return ue.has(e)?e:void 0}async function*Me(e,t){if(!e.body)return;let n=e.body.getReader(),r=new TextDecoder,i=``,a=()=>{n.cancel().catch(()=>{})};t?.addEventListener(`abort`,a,{once:!0});try{for(;;){if(t?.aborted)throw Error(`Request was aborted`);let{done:e,value:a}=await n.read();if(t?.aborted)throw Error(`Request was aborted`);i+=e?r.decode():r.decode(a,{stream:!0}),e&&i.trim()&&(i+=`
|
|
2
2
|
|
|
3
3
|
`);let o=i.indexOf(`
|
|
4
4
|
|