@shawnstack/quickforge 1.3.19 → 1.3.21
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/README.md +348 -348
- package/dist/assets/{anthropic-Bj3HAZgj.js → anthropic--qj3xmqE.js} +1 -1
- package/dist/assets/{azure-openai-responses-IdZZrSrI.js → azure-openai-responses-DDRaS-MZ.js} +1 -1
- package/dist/assets/{google-Brt_lS1J.js → google-C-8-FIZS.js} +1 -1
- package/dist/assets/{google-vertex-B6HsoZ34.js → google-vertex-Dw2y_nqS.js} +1 -1
- package/dist/assets/{index-D0W9hAl_.css → index-B-WkttzD.css} +1 -1
- package/dist/assets/{index-D0CVLdX_.js → index-DRGbHzkd.js} +4 -4
- package/dist/assets/{mistral-CenXqwPz.js → mistral-u_5S4wj6.js} +1 -1
- package/dist/assets/{openai-codex-responses-D9ffGwbj.js → openai-codex-responses-CWZGpchs.js} +1 -1
- package/dist/assets/{openai-completions-eWdeSGBG.js → openai-completions-C_DdwPuH.js} +1 -1
- package/dist/assets/{openai-responses-Cavpmjeu.js → openai-responses-CMp0ziUV.js} +1 -1
- package/dist/assets/{openai-responses-shared-DF3ZGaUx.js → openai-responses-shared-CORWeerT.js} +1 -1
- package/dist/index.html +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +201 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +62 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +156 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +16 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +80 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +11 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +10 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +4 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +69 -0
- package/node_modules/@aws-sdk/token-providers/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/index.js +3 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +3 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +12 -142
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +184 -0
- package/node_modules/@smithy/core/dist-es/index.js +6 -6
- package/node_modules/@smithy/core/dist-es/submodules/client/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/index.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +3 -4
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/{protocols/url-parser → transport}/parseUrl.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/{endpoints → transport}/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/package.json +19 -10
- package/node_modules/@smithy/core/transport.js +5 -0
- package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/eventsource-parser/README.md +31 -0
- package/node_modules/eventsource-parser/dist/index.cjs +21 -10
- package/node_modules/eventsource-parser/dist/index.js +21 -10
- package/node_modules/eventsource-parser/dist/stream.cjs +4 -3
- package/node_modules/eventsource-parser/dist/stream.js +4 -3
- package/node_modules/eventsource-parser/package.json +8 -8
- package/package.json +1 -1
- package/server/subagents.mjs +2 -2
- package/node_modules/@smithy/core/dist-cjs/getSmithyContext.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +0 -46
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js +0 -24
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/getHttpSigningMiddleware.js +0 -19
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/httpSigningMiddleware.js +0 -27
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/index.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/normalizeProvider.js +0 -10
- package/node_modules/@smithy/core/dist-cjs/pagination/createPaginator.js +0 -44
- package/node_modules/@smithy/core/dist-cjs/request-builder/requestBuilder.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/setFeature.js +0 -14
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +0 -18
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +0 -38
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +0 -15
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/noAuth.js +0 -9
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/memoizeIdentityProvider.js +0 -61
- package/node_modules/@smithy/core/dist-es/request-builder/requestBuilder.js +0 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js +0 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/TestVectors.fixture.js +0 -146
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/vectorTypes.fixture.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/index.js +0 -2
- package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
- package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
- package/node_modules/@smithy/signature-v4/dist-es/suite.fixture.js +0 -399
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{pagination → legacy-root-exports/pagination}/createPaginator.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{getSmithyContext.js → submodules/transport/getSmithyContext.js} +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpRequest.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpResponse.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/isValidHostname.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{client/util-middleware → transport}/normalizeProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/querystring-parser → transport}/parseQueryString.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,d as t,l as n,r,t as i,u as a}from"./index-D0CVLdX_.js";import{i as o,r as s,t as c}from"./transform-messages-CmnxG9RB.js";import{t as l}from"./hash-Bt1aVMQ3.js";var u=Object.prototype.hasOwnProperty;function d(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!u.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}var f={eu:`https://api.mistral.ai`};function p(e){let t=e.serverURL,n={};t||=f[e.server??`eu`]||``;let r=d(t)(n);return new URL(r)}var m={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function h(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function g(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function _(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}var v=(e,t)=>t==null?fetch(e):fetch(e,t),ee=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||v}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},te=/\s*;\s*/g;function ne(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(te);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(te),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}var re=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!re.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function ie(e,t,n){return y(e,t)&&ne(e,n)}function ae(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function se(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var ce=class{beforeRequest(e,t){let n=`mistral-client-typescript/${m.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}},le=`x-model-deprecation-timestamp`,ue=class{afterSuccess(e,t){return t.headers.has(le)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(le)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function de(e){let t=new ce;e.registerBeforeRequestHook(t);let n=new ue;e.registerAfterSuccessHook(n)}var fe=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);de(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},pe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},me=class extends pe{name=`UnexpectedClientError`},he=class extends pe{name=`InvalidRequestError`},ge=class extends pe{name=`RequestAbortedError`},_e=class extends pe{name=`RequestTimeoutError`},ve=class extends pe{name=`ConnectionError`};function ye(e){return{ok:!0,value:e}}function be(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}var xe=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Se=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ce=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},we={};function Te(e){return e&&Object.assign(we,e),we}function Ee(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function De(e,t){return typeof t==`bigint`?t.toString():t}function Oe(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ke(e){return e==null}function Ae(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function je(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Me=Symbol(`evaluating`);function S(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Me)return r===void 0&&(r=Me,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ze=Oe(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}var He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,De,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
|
|
1
|
+
import{c as e,d as t,l as n,r,t as i,u as a}from"./index-DRGbHzkd.js";import{i as o,r as s,t as c}from"./transform-messages-CmnxG9RB.js";import{t as l}from"./hash-Bt1aVMQ3.js";var u=Object.prototype.hasOwnProperty;function d(e,t){let n=/\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;return function(r={}){return e.replace(n,function(e,n){if(!u.call(r,n))throw Error(`Parameter '${n}' is required`);let i=r[n];if(typeof i!=`string`&&typeof i!=`number`)throw Error(`Parameter '${n}' must be a string or number`);return t?.charEncoding===`percent`?encodeURIComponent(`${i}`):`${i}`}).replace(/^\/+/,``)}}var f={eu:`https://api.mistral.ai`};function p(e){let t=e.serverURL,n={};t||=f[e.server??`eu`]||``;let r=d(t)(n);return new URL(r)}var m={language:`typescript`,openapiDocVersion:`1.0.0`,sdkVersion:`2.2.1`,genVersion:`2.881.4`,userAgent:`speakeasy-sdk/typescript 2.2.1 2.881.4 1.0.0 @mistralai/mistralai`};async function h(e){let t=e.getReader(),n=[],r=0,i=!1;for(;!i;){let{value:e,done:a}=await t.read();a?i=!0:(n.push(e),r+=e.length)}let a=new Uint8Array(r),o=0;for(let e of n)a.set(e,o),o+=e.length;return a.buffer}function g(e){if(!e)return null;let t=e.toLowerCase().split(`.`).pop();return t&&{json:`application/json`,xml:`application/xml`,html:`text/html`,htm:`text/html`,txt:`text/plain`,csv:`text/csv`,pdf:`application/pdf`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,svg:`image/svg+xml`,js:`application/javascript`,css:`text/css`,zip:`application/zip`,tar:`application/x-tar`,gz:`application/gzip`,mp4:`video/mp4`,mp3:`audio/mpeg`,wav:`audio/wav`,webp:`image/webp`,ico:`image/x-icon`,woff:`font/woff`,woff2:`font/woff2`,ttf:`font/ttf`,otf:`font/otf`}[t]||null}function _(e,t){return e instanceof Uint8Array?new Blob([new Uint8Array(e)],{type:t}):new Blob([e],{type:t})}var v=(e,t)=>t==null?fetch(e):fetch(e,t),ee=class e{options;fetcher;requestHooks=[];requestErrorHooks=[];responseHooks=[];constructor(e={}){this.options=e,this.fetcher=e.fetcher||v}async request(e){let t=e;for(let e of this.requestHooks){let n=await e(t);n&&(t=n)}try{let e=await this.fetcher(t);for(let n of this.responseHooks)await n(e,t);return e}catch(e){for(let n of this.requestErrorHooks)await n(e,t);throw e}}addHook(...e){if(e[0]===`beforeRequest`)this.requestHooks.push(e[1]);else if(e[0]===`requestError`)this.requestErrorHooks.push(e[1]);else if(e[0]===`response`)this.responseHooks.push(e[1]);else throw Error(`Invalid hook type: ${e[0]}`);return this}removeHook(...e){let t;if(e[0]===`beforeRequest`)t=this.requestHooks;else if(e[0]===`requestError`)t=this.requestErrorHooks;else if(e[0]===`response`)t=this.responseHooks;else throw Error(`Invalid hook type: ${e[0]}`);let n=t.findIndex(t=>t===e[1]);return n>=0&&t.splice(n,1),this}clone(){let t=new e(this.options);return t.requestHooks=this.requestHooks.slice(),t.requestErrorHooks=this.requestErrorHooks.slice(),t.responseHooks=this.responseHooks.slice(),t}},te=/\s*;\s*/g;function ne(e,t){if(t===`*`)return!0;let n=e.headers.get(`content-type`)?.trim()||`application/octet-stream`;n=n.toLowerCase();let[r=``,...i]=t.toLowerCase().trim().split(te);if(r.split(`/`).length!==2)return!1;let[a=``,...o]=n.split(te),[s=``,c=``]=a.split(`/`);if(!s||!c||r!==`*/*`&&a!==r&&`${s}/*`!==r&&`*/${c}`!==r||o.length<i.length)return!1;let l=new Set(o);for(let e of i)if(!l.has(e))return!1;return!0}var re=RegExp(`^[0-9]xx$`,`i`);function y(e,t){let n=`${e.status}`,r=Array.isArray(t)?t:[t];return r.length?r.some(e=>{let t=`${e}`;if(t===`default`)return!0;if(!re.test(`${t}`))return t===n;let r=t.charAt(0);if(!r)throw Error(`Invalid status code range`);let i=n.charAt(0);if(!i)throw Error(`Invalid response status code: ${n}`);return i===r}):!1}function ie(e,t,n){return y(e,t)&&ne(e,n)}function ae(e){if(typeof e!=`object`||!e)return!1;let t=e instanceof TypeError&&e.message.toLowerCase().startsWith(`failed to fetch`),n=e instanceof TypeError&&e.message.toLowerCase().startsWith(`fetch failed`),r=`name`in e&&e.name===`ConnectionError`,i=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnreset`;return t||n||i||r}function oe(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`TimeoutError`,n=`code`in e&&e.code===23,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}function se(e){if(typeof e!=`object`||!e)return!1;let t=`name`in e&&e.name===`AbortError`,n=`code`in e&&e.code===20,r=`code`in e&&typeof e.code==`string`&&e.code.toLowerCase()===`econnaborted`;return t||n||r}var ce=class{beforeRequest(e,t){let n=`mistral-client-typescript/${m.sdkVersion}`;return t.headers.set(`user-agent`,n),t.headers.get(`user-agent`)||t.headers.set(`x-mistral-user-agent`,n),t}},le=`x-model-deprecation-timestamp`,ue=class{afterSuccess(e,t){return t.headers.has(le)&&t.clone().json().then(e=>{let n=e.model;console.warn(`WARNING: The model ${n} is deprecated and will be removed on ${t.headers.get(le)}. Please refer to https://docs.mistral.ai/getting-started/models/#api-versioning for more information.`)}),t}};function de(e){let t=new ce;e.registerBeforeRequestHook(t);let n=new ue;e.registerAfterSuccessHook(n)}var fe=class{sdkInitHooks=[];beforeCreateRequestHooks=[];beforeRequestHooks=[];afterSuccessHooks=[];afterErrorHooks=[];constructor(){for(let e of[])`sdkInit`in e&&this.registerSDKInitHook(e),`beforeCreateRequest`in e&&this.registerBeforeCreateRequestHook(e),`beforeRequest`in e&&this.registerBeforeRequestHook(e),`afterSuccess`in e&&this.registerAfterSuccessHook(e),`afterError`in e&&this.registerAfterErrorHook(e);de(this)}registerSDKInitHook(e){this.sdkInitHooks.push(e)}registerBeforeCreateRequestHook(e){this.beforeCreateRequestHooks.push(e)}registerBeforeRequestHook(e){this.beforeRequestHooks.push(e)}registerAfterSuccessHook(e){this.afterSuccessHooks.push(e)}registerAfterErrorHook(e){this.afterErrorHooks.push(e)}sdkInit(e){return this.sdkInitHooks.reduce((e,t)=>t.sdkInit(e),e)}beforeCreateRequest(e,t){let n=t;for(let t of this.beforeCreateRequestHooks)n=t.beforeCreateRequest(e,n);return n}async beforeRequest(e,t){let n=t;for(let t of this.beforeRequestHooks)n=await t.beforeRequest(e,n);return n}async afterSuccess(e,t){let n=t;for(let t of this.afterSuccessHooks)n=await t.afterSuccess(e,n);return n}async afterError(e,t,n){let r=t,i=n;for(let t of this.afterErrorHooks){let n=await t.afterError(e,r,i);r=n.response,i=n.error}return{response:r,error:i}}},pe=class extends Error{cause;name=`HTTPClientError`;constructor(e,t){let n=e;t?.cause&&(n+=`: ${t.cause}`),super(n,t),this.cause===void 0&&(this.cause=t?.cause)}},me=class extends pe{name=`UnexpectedClientError`},he=class extends pe{name=`InvalidRequestError`},ge=class extends pe{name=`RequestAbortedError`},_e=class extends pe{name=`RequestTimeoutError`},ve=class extends pe{name=`ConnectionError`};function ye(e){return{ok:!0,value:e}}function be(e){return{ok:!1,error:e}}async function b(e){let t=await e;if(!t.ok)throw t.error;return t.value}var xe=Object.freeze({status:`aborted`});function x(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var Se=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ce=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},we={};function Te(e){return e&&Object.assign(we,e),we}function Ee(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function De(e,t){return typeof t==`bigint`?t.toString():t}function Oe(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ke(e){return e==null}function Ae(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function je(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Me=Symbol(`evaluating`);function S(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Me)return r===void 0&&(r=Me,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ne(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Pe(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Fe(e){return JSON.stringify(e)}function Ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Le=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ze=Oe(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Be(e){if(Re(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Re(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ve(e){return Be(e)?{...e}:Array.isArray(e)?[...e]:e}var He=new Set([`string`,`number`,`symbol`]);function Ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function We(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function C(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Ke={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ne(this,`shape`,e),e},checks:[]}))}function Je(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return We(e,Pe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ne(this,`shape`,r),r},checks:[]}))}function Ye(e,t){if(!Be(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Xe(e,t){if(!Be(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ne(this,`shape`,n),n}}))}function Ze(e,t){return We(e,Pe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ne(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qe(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ne(this,`shape`,i),i},checks:[]}))}function $e(e,t,n){return We(t,Pe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ne(this,`shape`,i),i}}))}function et(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nt(e){return typeof e==`string`?e:e?.message}function rt(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nt(e.inst?._zod.def?.error?.(e))??nt(t?.error?.(e))??nt(n.customError?.(e))??nt(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function it(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function at(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ot=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,De,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},st=x(`$ZodError`,ot),ct=x(`$ZodError`,ot,{Parent:Error});function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function dt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ft(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${dt(e.path)}`);return t.join(`
|
|
2
2
|
`)}var pt=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Se;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,Te())));throw Le(t,i?.callee),t}return o.value},mt=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>rt(e,a,Te())));throw Le(t,i?.callee),t}return o.value},ht=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Se;return a.issues.length?{success:!1,error:new(e??st)(a.issues.map(e=>rt(e,i,Te())))}:{success:!0,data:a.value}},gt=ht(ct),_t=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rt(e,i,Te())))}:{success:!0,data:a.value}},vt=_t(ct),yt=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pt(e)(t,n,i)},bt=e=>(t,n,r)=>pt(e)(t,n,r),xt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return mt(e)(t,n,i)},St=e=>async(t,n,r)=>mt(e)(t,n,r),Ct=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return ht(e)(t,n,i)},wt=e=>(t,n,r)=>ht(e)(t,n,r),Tt=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return _t(e)(t,n,i)},Et=e=>async(t,n,r)=>_t(e)(t,n,r),Dt=/^[cC][^\s-]{8,}$/,Ot=/^[0-9a-z]+$/,kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,At=/^[0-9a-vA-V]{20}$/,jt=/^[A-Za-z0-9]{27}$/,Mt=/^[a-zA-Z0-9_-]{21}$/,Nt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Pt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ft=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,It=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Lt=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Rt(){return new RegExp(Lt,`u`)}var zt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Vt=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ht=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ut=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Wt=/^[A-Za-z0-9_-]*$/,Gt=/^\+[1-9]\d{6,14}$/,Kt=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,qt=RegExp(`^${Kt}$`);function Jt(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yt(e){return RegExp(`^${Jt(e)}$`)}function Xt(e){let t=Jt({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Kt}T(?:${r})$`)}var Zt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Qt=/^-?\d+$/,$t=/^-?\d+(?:\.\d+)?$/,en=/^(?:true|false)$/i,tn=/^[^A-Z]*$/,nn=/^[^a-z]*$/,rn=x(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),an={number:`number`,bigint:`bigint`,object:`date`},on=x(`$ZodCheckLessThan`,(e,t)=>{rn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sn=x(`$ZodCheckGreaterThan`,(e,t)=>{rn.init(e,t);let n=an[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),cn=x(`$ZodCheckMultipleOf`,(e,t)=>{rn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):je(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ln=x(`$ZodCheckNumberFormat`,(e,t)=>{rn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ke[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Qt)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),un=x(`$ZodCheckMaxLength`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ke(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=it(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dn=x(`$ZodCheckMinLength`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ke(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=it(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=x(`$ZodCheckLengthEquals`,(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ke(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=it(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),pn=x(`$ZodCheckStringFormat`,(e,t)=>{var n,r;rn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),mn=x(`$ZodCheckRegex`,(e,t)=>{pn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),hn=x(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=tn,pn.init(e,t)}),gn=x(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=nn,pn.init(e,t)}),_n=x(`$ZodCheckIncludes`,(e,t)=>{rn.init(e,t);let n=Ue(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),vn=x(`$ZodCheckStartsWith`,(e,t)=>{rn.init(e,t);let n=RegExp(`^${Ue(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),yn=x(`$ZodCheckEndsWith`,(e,t)=>{rn.init(e,t);let n=RegExp(`.*${Ue(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),bn=x(`$ZodCheckOverwrite`,(e,t)=>{rn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
3
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
4
|
`))}},Sn={major:4,minor:3,patch:6},Cn=x(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Sn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=et(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Se;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=et(e,t))});else{if(e.issues.length===t)continue;r||=et(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(et(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Se;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Se;return o.then(e=>t(e,r,a))}return t(o,r,a)}}S(e,`~standard`,()=>({validate:t=>{try{let n=gt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return vt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),wn=x(`$ZodString`,(e,t)=>{Cn.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Tn=x(`$ZodStringFormat`,(e,t)=>{pn.init(e,t),wn.init(e,t)}),En=x(`$ZodGUID`,(e,t)=>{t.pattern??=Pt,Tn.init(e,t)}),Dn=x(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ft(e)}else t.pattern??=Ft();Tn.init(e,t)}),On=x(`$ZodEmail`,(e,t)=>{t.pattern??=It,Tn.init(e,t)}),kn=x(`$ZodURL`,(e,t)=>{Tn.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),An=x(`$ZodEmoji`,(e,t)=>{t.pattern??=Rt(),Tn.init(e,t)}),jn=x(`$ZodNanoID`,(e,t)=>{t.pattern??=Mt,Tn.init(e,t)}),Mn=x(`$ZodCUID`,(e,t)=>{t.pattern??=Dt,Tn.init(e,t)}),Nn=x(`$ZodCUID2`,(e,t)=>{t.pattern??=Ot,Tn.init(e,t)}),Pn=x(`$ZodULID`,(e,t)=>{t.pattern??=kt,Tn.init(e,t)}),Fn=x(`$ZodXID`,(e,t)=>{t.pattern??=At,Tn.init(e,t)}),In=x(`$ZodKSUID`,(e,t)=>{t.pattern??=jt,Tn.init(e,t)}),Ln=x(`$ZodISODateTime`,(e,t)=>{t.pattern??=Xt(t),Tn.init(e,t)}),Rn=x(`$ZodISODate`,(e,t)=>{t.pattern??=qt,Tn.init(e,t)}),zn=x(`$ZodISOTime`,(e,t)=>{t.pattern??=Yt(t),Tn.init(e,t)}),Bn=x(`$ZodISODuration`,(e,t)=>{t.pattern??=Nt,Tn.init(e,t)}),Vn=x(`$ZodIPv4`,(e,t)=>{t.pattern??=zt,Tn.init(e,t),e._zod.bag.format=`ipv4`}),Hn=x(`$ZodIPv6`,(e,t)=>{t.pattern??=Bt,Tn.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),Un=x(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Vt,Tn.init(e,t)}),Wn=x(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ht,Tn.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Gn(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Kn=x(`$ZodBase64`,(e,t)=>{t.pattern??=Ut,Tn.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Gn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function qn(e){if(!Wt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Gn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Jn=x(`$ZodBase64URL`,(e,t)=>{t.pattern??=Wt,Tn.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{qn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Yn=x(`$ZodE164`,(e,t)=>{t.pattern??=Gt,Tn.init(e,t)});function Xn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Zn=x(`$ZodJWT`,(e,t)=>{Tn.init(e,t),e._zod.check=n=>{Xn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Qn=x(`$ZodNumber`,(e,t)=>{Cn.init(e,t),e._zod.pattern=e._zod.bag.pattern??$t,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),$n=x(`$ZodNumberFormat`,(e,t)=>{ln.init(e,t),Qn.init(e,t)}),er=x(`$ZodBoolean`,(e,t)=>{Cn.init(e,t),e._zod.pattern=en,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),tr=x(`$ZodAny`,(e,t)=>{Cn.init(e,t),e._zod.parse=e=>e}),nr=x(`$ZodUnknown`,(e,t)=>{Cn.init(e,t),e._zod.parse=e=>e}),rr=x(`$ZodNever`,(e,t)=>{Cn.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ir=x(`$ZodVoid`,(e,t)=>{Cn.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),ar=x(`$ZodDate`,(e,t)=>{Cn.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function or(e,t,n){e.issues.length&&t.issues.push(...tt(n,e.issues)),t.value[n]=e.value}var sr=x(`$ZodArray`,(e,t)=>{Cn.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>or(t,n,e))):or(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function cr(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...tt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function lr(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ur(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>cr(e,n,i,t,u))):cr(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var dr=x(`$ZodObject`,(e,t)=>{if(Cn.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=Oe(()=>lr(t));S(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Re,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>cr(n,t,e,s,r))):cr(i,t,e,s,r)}return i?ur(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),fr=x(`$ZodObjectJIT`,(e,t)=>{dr.init(e,t);let n=e._zod.parse,r=Oe(()=>lr(t)),i=e=>{let t=new xn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Fe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Fe(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
package/dist/assets/{openai-codex-responses-D9ffGwbj.js → openai-codex-responses-CWZGpchs.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,i,o as a,s as o,u as s}from"./index-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,o as a,s as o,u as s}from"./index-DRGbHzkd.js";import{t as c}from"./headers-5EYI0_pl.js";import{r as l}from"./transform-messages-CmnxG9RB.js";import{n as u,r as d,t as f}from"./openai-responses-shared-CORWeerT.js";var p=null;typeof process<`u`&&(process.versions?.node||process.versions?.bun)&&(e=>r(()=>import(e),[]))(`node:os`).then(e=>{p=e});var m=`https://chatgpt.com/backend-api`,h=`https://api.openai.com/auth`,g=3,_=1e3,v=new Set([`openai`,`openai-codex`,`opencode`]),y=1009,b=new Set([`completed`,`incomplete`,`failed`,`cancelled`,`queued`,`in_progress`]);function ee(e,t){return e===429||e===500||e===502||e===503||e===504?!0:/rate.?limit|overloaded|service.?unavailable|upstream.?connect|connection.?refused/i.test(t)}function x(e,t){return new Promise((n,r)=>{if(t?.aborted){r(Error(`Request was aborted`));return}let i=setTimeout(n,e);t?.addEventListener(`abort`,()=>{clearTimeout(i),r(Error(`Request was aborted`))})})}var S=(r,a,o)=>{let s=new t;return(async()=>{let t={role:`assistant`,content:[],api:`openai-codex-responses`,provider:r.provider,model:r.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let l=o?.apiKey||n(r.provider)||``;if(!l)throw Error(`No API key for provider: ${r.provider}`);let u=_e(l),d=te(r,a,o),f=await o?.onPayload?.(d,r);f!==void 0&&(d=f);let p=o?.sessionId||ve(),m=ye(r.headers,o?.headers,u,l,o?.sessionId),h=be(r.headers,o?.headers,u,l,p),v=JSON.stringify(d),y=o?.transport||`auto`,b=y!==`sse`&&z(o?.sessionId);if(b&&B(o?.sessionId),y!==`sse`&&!b){let n=!1;try{if(await Q(ne(r.baseUrl),d,h,t,s,r,()=>{n=!0},o),o?.signal?.aborted)throw Error(`Request was aborted`);s.push({type:`done`,reason:t.stopReason,message:t}),s.end();return}catch(r){if(o?.signal?.aborted||A(r)||(i(t,e(`provider_transport_failure`,r,{configuredTransport:y,fallbackTransport:n?void 0:`sse`,eventsEmitted:n,phase:n?`after_message_stream_start`:`before_message_stream_start`,requestBytes:new TextEncoder().encode(v).byteLength})),V(o?.sessionId,r),n))throw r;B(o?.sessionId)}}let S,C;for(let e=0;e<=g;e++){if(o?.signal?.aborted)throw Error(`Request was aborted`);try{if(S=await fetch(D(r.baseUrl),{method:`POST`,headers:m,body:v,signal:o?.signal}),await o?.onResponse?.({status:S.status,headers:c(S.headers)},r),S.ok)break;let t=await S.text();if(e<g&&ee(S.status,t)){await x(_*2**e,o?.signal);continue}let n=await ge(new Response(t,{status:S.status,statusText:S.statusText}));throw Error(n.friendlyMessage||n.message)}catch(t){if(t instanceof Error&&(t.name===`AbortError`||t.message===`Request was aborted`))throw Error(`Request was aborted`);if(C=t instanceof Error?t:Error(String(t)),e<g&&!C.message.includes(`usage limit`)){await x(_*2**e,o?.signal);continue}throw C}}if(!S?.ok)throw C??Error(`Failed after retries`);if(!S.body)throw Error(`No response body`);if(s.push({type:`start`,partial:t}),await re(S,t,s,r,o),o?.signal?.aborted)throw Error(`Request was aborted`);s.push({type:`done`,reason:t.stopReason,message:t}),s.end()}catch(e){for(let e of t.content)delete e.partialJson;t.stopReason=o?.signal?.aborted?`aborted`:`error`,t.errorMessage=e instanceof Error?e.message:String(e),s.push({type:`error`,reason:t.stopReason,error:t}),s.end()}})(),s},C=(e,t,r)=>{let i=r?.apiKey||n(e.provider);if(!i)throw Error(`No API key for provider: ${e.provider}`);let a=l(e,r,i),o=r?.reasoning?s(e,r.reasoning):void 0,c=o===`off`?void 0:o;return S(e,t,{...a,reasoningEffort:c})};function te(e,t,n){let r=f(e,t,v,{includeSystemPrompt:!1}),i={model:e.id,store:!1,stream:!0,instructions:t.systemPrompt||`You are a helpful assistant.`,input:r,text:{verbosity:n?.textVerbosity||`low`},include:[`reasoning.encrypted_content`],prompt_cache_key:n?.sessionId,tool_choice:`auto`,parallel_tool_calls:!0};if(n?.temperature!==void 0&&(i.temperature=n.temperature),n?.serviceTier!==void 0&&(i.service_tier=n.serviceTier),t.tools&&t.tools.length>0&&(i.tools=u(t.tools,{strict:null})),n?.reasoningEffort!==void 0){let t=n.reasoningEffort===`none`?e.thinkingLevelMap?.off??`none`:e.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort;t!==null&&(i.reasoning={effort:t,summary:n.reasoningSummary??`auto`})}return i}function w(e,t){switch(t){case`flex`:return .5;case`priority`:return e.id===`gpt-5.5`?2.5:2;default:return 1}}function T(e,t,n){let r=w(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 E(e,t){return e===`default`&&(t===`flex`||t===`priority`)?t:e??t}function D(e){let t=(e&&e.trim().length>0?e:m).replace(/\/+$/,``);return t.endsWith(`/codex/responses`)?t:t.endsWith(`/codex`)?`${t}/responses`:`${t}/codex/responses`}function ne(e){let t=new URL(D(e));return t.protocol===`https:`&&(t.protocol=`wss:`),t.protocol===`http:`&&(t.protocol=`ws:`),t.toString()}async function re(e,t,n,r,i){await d(j(ae(e)),t,n,r,{serviceTier:i?.serviceTier,resolveServiceTier:E,applyServiceTierPricing:(e,t)=>T(e,t,r)})}var O=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}},k=class extends Error{payload;constructor(e,t){super(e),this.name=`CodexProtocolError`,this.payload=t?.payload,this.cause=t?.cause}};function A(e){return e instanceof O||e instanceof k}async function*j(e){for await(let t of e){let e=typeof t.type==`string`?t.type:void 0;if(e){if(e===`error`){let e=t.code||``;throw new O(`Codex error: ${t.message||e||JSON.stringify(t)}`,{code:e||void 0,payload:t})}if(e===`response.failed`){let e=t.response,n=e?.error?.code,r=e?.error?.message;throw new O(r||`Codex response failed`,{code:n,payload:t})}if(e===`response.done`||e===`response.completed`||e===`response.incomplete`){let e=t.response,n=e&&{...e,status:ie(e.status)};yield{...t,type:`response.completed`,response:n};return}yield t}}}function ie(e){if(typeof e==`string`)return b.has(e)?e:void 0}async function*ae(e){if(!e.body)return;let t=e.body.getReader(),n=new TextDecoder,r=``;try{for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let o=r.indexOf(`
|
|
2
2
|
|
|
3
3
|
`);for(;o!==-1;){let e=r.slice(0,o);r=r.slice(o+2);let t=e.split(`
|
|
4
4
|
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trim());if(t.length>0){let e=t.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,d as t,l as n,r,u as i}from"./index-
|
|
1
|
+
import{c as e,d as t,l as n,r,u as i}from"./index-DRGbHzkd.js";import{t as a}from"./headers-5EYI0_pl.js";import{i as o,r as s,t as c}from"./transform-messages-CmnxG9RB.js";import{i as l,n as u,r as d,t as f}from"./github-copilot-headers-CMb2BbzT.js";import{n as p}from"./openai-Cn7eGqwa.js";function m(e){for(let t of e)if(t.role===`toolResult`||t.role===`assistant`&&t.content.some(e=>e.type===`toolCall`))return!0;return!1}function h(e){return e.type===`text`}function g(e){return e.type===`thinking`}function _(e){return e.type===`toolCall`}function v(e){return e.type===`image`}function y(e){return e||(typeof process<`u`&&{}.PI_CACHE_RETENTION===`long`?`long`:`short`)}var b=(n,i,o)=>{let s=new e;return(async()=>{let e={role:`assistant`,content:[],api:n.api,provider:n.provider,model:n.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let c=o?.apiKey||t(n.provider)||``,l=L(n),u=y(o?.cacheRetention),d=u===`none`?void 0:o?.sessionId,f=S(n,i,c,o?.headers,d,l),p=C(n,i,o,l,u),m=await o?.onPayload?.(p,n);m!==void 0&&(p=m);let h={...o?.signal?{signal:o.signal}:{},...o?.timeoutMs===void 0?{}:{timeout:o.timeoutMs},...o?.maxRetries===void 0?{}:{maxRetries:o.maxRetries}},{data:g,response:_}=await f.chat.completions.create(p,h).withResponse();await o?.onResponse?.({status:_.status,headers:a(_.headers)},n),s.push({type:`start`,partial:e});let v=null,b=null,x=new Map,w=new Map,T=e.content,E=e=>T.indexOf(e),D=t=>{let n=E(t);n!==-1&&(t.type===`text`?s.push({type:`text_end`,contentIndex:n,content:t.text,partial:e}):t.type===`thinking`?s.push({type:`thinking_end`,contentIndex:n,content:t.thinking,partial:e}):t.type===`toolCall`&&(t.arguments=r(t.partialArgs),delete t.partialArgs,delete t.streamIndex,s.push({type:`toolcall_end`,contentIndex:n,toolCall:t,partial:e})))},O=()=>(v||(v={type:`text`,text:``},T.push(v),s.push({type:`text_start`,contentIndex:E(v),partial:e})),v),k=t=>(b||(b={type:`thinking`,thinking:``,thinkingSignature:t},T.push(b),s.push({type:`thinking_start`,contentIndex:E(b),partial:e})),b),A=t=>{let n=typeof t.index==`number`?t.index:void 0,r=n===void 0?void 0:x.get(n);return!r&&t.id&&(r=w.get(t.id)),r||(r={type:`toolCall`,id:t.id||``,name:t.function?.name||``,arguments:{},partialArgs:``,streamIndex:n},n!==void 0&&x.set(n,r),t.id&&w.set(t.id,r),T.push(r),s.push({type:`toolcall_start`,contentIndex:E(r),partial:e})),n!==void 0&&r.streamIndex===void 0&&(r.streamIndex=n,x.set(n,r)),t.id&&w.set(t.id,r),r};for await(let t of g){if(!t||typeof t!=`object`)continue;e.responseId||=t.id,typeof t.model==`string`&&t.model.length>0&&t.model!==n.id&&(e.responseModel||=t.model),t.usage&&(e.usage=P(t.usage,n));let i=Array.isArray(t.choices)?t.choices[0]:void 0;if(i){if(!t.usage&&i.usage&&(e.usage=P(i.usage,n)),i.finish_reason){let t=F(i.finish_reason);e.stopReason=t.stopReason,t.errorMessage&&(e.errorMessage=t.errorMessage)}if(i.delta){if(i.delta.content!==null&&i.delta.content!==void 0&&i.delta.content.length>0){let t=O();t.text+=i.delta.content,s.push({type:`text_delta`,contentIndex:E(t),delta:i.delta.content,partial:e})}let t=[`reasoning_content`,`reasoning`,`reasoning_text`],n=i.delta,a=null;for(let e of t){let t=n[e];if(typeof t==`string`&&t.length>0){a=e;break}}if(a){let t=n[a];if(typeof t==`string`&&t.length>0){let n=k(a);n.thinking+=t,s.push({type:`thinking_delta`,contentIndex:E(n),delta:t,partial:e})}}if(i?.delta?.tool_calls)for(let t of i.delta.tool_calls){let n=A(t);!n.id&&t.id&&(n.id=t.id,w.set(t.id,n)),!n.name&&t.function?.name&&(n.name=t.function.name);let i=``;t.function?.arguments&&(i=t.function.arguments,n.partialArgs=(n.partialArgs??``)+t.function.arguments,n.arguments=r(n.partialArgs)),s.push({type:`toolcall_delta`,contentIndex:E(n),delta:i,partial:e})}let o=i.delta.reasoning_details;if(o&&Array.isArray(o)){for(let t of o)if(t.type===`reasoning.encrypted`&&t.id&&t.data){let n=e.content.find(e=>e.type===`toolCall`&&e.id===t.id);n&&(n.thoughtSignature=JSON.stringify(t))}}}}}for(let e of T)D(e);if(o?.signal?.aborted||e.stopReason===`aborted`)throw Error(`Request was aborted`);if(e.stopReason===`error`)throw Error(e.errorMessage||`Provider returned an error stop reason`);s.push({type:`done`,reason:e.stopReason,message:e}),s.end()}catch(t){for(let t of e.content)delete t.index,delete t.partialArgs,delete t.streamIndex;e.stopReason=o?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t);let n=t?.error?.metadata?.raw;n&&(e.errorMessage+=`\n${n}`),s.push({type:`error`,reason:e.stopReason,error:e}),s.end()}})(),s},x=(e,n,r)=>{let a=r?.apiKey||t(e.provider);if(!a)throw Error(`No API key for provider: ${e.provider}`);let o=s(e,r,a),c=r?.reasoning?i(e,r.reasoning):void 0,l=c===`off`?void 0:c,u=r?.toolChoice;return b(e,n,{...o,reasoningEffort:l,toolChoice:u})};function S(e,t,n,r,i,a=L(e)){if(!n){if(!{}.OPENAI_API_KEY)throw Error(`OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.`);n={}.OPENAI_API_KEY}let o={...e.headers};if(e.provider===`github-copilot`){let e=u(t.messages),n=f({messages:t.messages,hasImages:e});Object.assign(o,n)}i&&a.sendSessionAffinityHeaders&&(o.session_id=i,o[`x-client-request-id`]=i,o[`x-session-affinity`]=i),r&&Object.assign(o,r);let s=e.provider===`cloudflare-ai-gateway`?{...o,Authorization:o.Authorization??null,"cf-aig-authorization":`Bearer ${n}`}:o;return new p({apiKey:n,baseURL:d(e.provider)?l(e):e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:s})}function C(e,t,n,r=L(e),i=y(n?.cacheRetention)){let a=M(e,t,r),o=w(r,i),s={model:e.id,messages:a,stream:!0,prompt_cache_key:e.baseUrl.includes(`api.openai.com`)&&i!==`none`||i===`long`&&r.supportsLongCacheRetention?n?.sessionId:void 0,prompt_cache_retention:i===`long`&&r.supportsLongCacheRetention?`24h`:void 0};if(r.supportsUsageInStreaming!==!1&&(s.stream_options={include_usage:!0}),r.supportsStore&&(s.store=!1),n?.maxTokens&&(r.maxTokensField===`max_tokens`?s.max_tokens=n.maxTokens:s.max_completion_tokens=n.maxTokens),n?.temperature!==void 0&&(s.temperature=n.temperature),t.tools&&t.tools.length>0?(s.tools=N(t.tools,r),r.zaiToolStream&&(s.tool_stream=!0)):m(t.messages)&&(s.tools=[]),o&&T(a,s.tools,o),n?.toolChoice&&(s.tool_choice=n.toolChoice),r.thinkingFormat===`zai`&&e.reasoning)s.enable_thinking=!!n?.reasoningEffort;else if(r.thinkingFormat===`qwen`&&e.reasoning)s.enable_thinking=!!n?.reasoningEffort;else if(r.thinkingFormat===`qwen-chat-template`&&e.reasoning)s.chat_template_kwargs={enable_thinking:!!n?.reasoningEffort,preserve_thinking:!0};else if(r.thinkingFormat===`deepseek`&&e.reasoning)s.thinking={type:n?.reasoningEffort?`enabled`:`disabled`},n?.reasoningEffort&&(s.reasoning_effort=e.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort);else if(r.thinkingFormat===`openrouter`&&e.reasoning){let t=s;n?.reasoningEffort?t.reasoning={effort:e.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort}:e.thinkingLevelMap?.off!==null&&(t.reasoning={effort:e.thinkingLevelMap?.off??`none`})}else if(n?.reasoningEffort&&e.reasoning&&r.supportsReasoningEffort)s.reasoning_effort=e.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort;else if(!n?.reasoningEffort&&e.reasoning&&r.supportsReasoningEffort){let t=e.thinkingLevelMap?.off;typeof t==`string`&&(s.reasoning_effort=t)}if(e.baseUrl.includes(`openrouter.ai`)&&e.compat?.openRouterRouting&&(s.provider=e.compat.openRouterRouting),e.baseUrl.includes(`ai-gateway.vercel.sh`)&&e.compat?.vercelGatewayRouting){let t=e.compat.vercelGatewayRouting;if(t.only||t.order){let e={};t.only&&(e.only=t.only),t.order&&(e.order=t.order),s.providerOptions={gateway:e}}}return s}function w(e,t){if(e.cacheControlFormat!==`anthropic`||t===`none`)return;let n=t===`long`&&e.supportsLongCacheRetention?`1h`:void 0;return{type:`ephemeral`,...n?{ttl:n}:{}}}function T(e,t,n){E(e,n),O(t,n),D(e,n)}function E(e,t){for(let n of e)if(n.role===`system`||n.role===`developer`){k(n,t);return}}function D(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if((r.role===`user`||r.role===`assistant`)&&A(r,t))return}}function O(e,t){if(!e||e.length===0)return;let n=e[e.length-1];n.cache_control=t}function k(e,t){return j(e,t)}function A(e,t){return e.role===`user`||e.role===`assistant`?j(e,t):!1}function j(e,t){let n=e.content;if(typeof n==`string`)return n.length===0?!1:(e.content=[{type:`text`,text:n,cache_control:t}],!0);if(!Array.isArray(n))return!1;for(let e=n.length-1;e>=0;e--){let r=n[e];if(r?.type===`text`){let e=r;return e.cache_control=t,!0}}return!1}function M(e,t,n){let r=[],i=t=>{if(t.includes(`|`)){let[e]=t.split(`|`);return e.replace(/[^a-zA-Z0-9_-]/g,`_`).slice(0,40)}return e.provider===`openai`&&t.length>40?t.slice(0,40):t},a=c(t.messages,e,e=>i(e));if(t.systemPrompt){let i=e.reasoning&&n.supportsDeveloperRole?`developer`:`system`;r.push({role:i,content:o(t.systemPrompt)})}let s=null;for(let t=0;t<a.length;t++){let i=a[t];if(n.requiresAssistantAfterToolResult&&s===`toolResult`&&i.role===`user`&&r.push({role:`assistant`,content:`I have processed the tool results.`}),i.role===`user`)if(typeof i.content==`string`)r.push({role:`user`,content:o(i.content)});else{let e=i.content.map(e=>e.type===`text`?{type:`text`,text:o(e.text)}:{type:`image_url`,image_url:{url:`data:${e.mimeType};base64,${e.data}`}});if(e.length===0)continue;r.push({role:`user`,content:e})}else if(i.role===`assistant`){let t={role:`assistant`,content:n.requiresAssistantAfterToolResult?``:null},a=i.content.filter(h).filter(e=>e.text.trim().length>0).map(e=>({type:`text`,text:o(e.text)})),s=a.map(e=>e.text).join(``),c=i.content.filter(g).filter(e=>e.thinking.trim().length>0);if(c.length>0)if(n.requiresThinkingAsText)t.content=[{type:`text`,text:c.map(e=>o(e.thinking)).join(`
|
|
2
2
|
|
|
3
3
|
`)},...a];else{s.length>0&&(t.content=s);let e=c[0].thinkingSignature;e&&e.length>0&&(t[e]=c.map(e=>e.thinking).join(`
|
|
4
4
|
`))}else s.length>0&&(t.content=s);let l=i.content.filter(_);if(l.length>0){t.tool_calls=l.map(e=>({id:e.id,type:`function`,function:{name:e.name,arguments:JSON.stringify(e.arguments)}}));let e=l.filter(e=>e.thoughtSignature).map(e=>{try{return JSON.parse(e.thoughtSignature)}catch{return null}}).filter(Boolean);e.length>0&&(t.reasoning_details=e)}n.requiresReasoningContentOnAssistantMessages&&e.reasoning&&t.reasoning_content===void 0&&(t.reasoning_content=``);let u=t.content;if(!(u!=null&&u.length>0)&&!t.tool_calls)continue;r.push(t)}else if(i.role===`toolResult`){let i=[],c=t;for(;c<a.length&&a[c].role===`toolResult`;c++){let t=a[c],s=t.content.filter(h).map(e=>e.text).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,d as t,u as n}from"./index-
|
|
1
|
+
import{c as e,d as t,u as n}from"./index-DRGbHzkd.js";import{t as r}from"./headers-5EYI0_pl.js";import{r as i}from"./transform-messages-CmnxG9RB.js";import{i as a,n as o,r as s,t as c}from"./github-copilot-headers-CMb2BbzT.js";import{n as l}from"./openai-Cn7eGqwa.js";import{n as u,r as d,t as f}from"./openai-responses-shared-CORWeerT.js";var p=new Set([`openai`,`openai-codex`,`opencode`]);function m(e){return e||(typeof process<`u`&&{}.PI_CACHE_RETENTION===`long`?`long`:`short`)}function h(e){return{sendSessionIdHeader:e.compat?.sendSessionIdHeader??!0,supportsLongCacheRetention:e.compat?.supportsLongCacheRetention??!0}}function g(e,t){return t===`long`&&e.supportsLongCacheRetention?`24h`:void 0}var _=(n,i,a)=>{let o=new e;return(async()=>{let e={role:`assistant`,content:[],api:n.api,provider:n.provider,model:n.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`stop`,timestamp:Date.now()};try{let s=a?.apiKey||t(n.provider)||``,c=m(a?.cacheRetention)===`none`?void 0:a?.sessionId,l=y(n,i,s,a?.headers,c),u=b(n,i,a),f=await a?.onPayload?.(u,n);f!==void 0&&(u=f);let p={...a?.signal?{signal:a.signal}:{},...a?.timeoutMs===void 0?{}:{timeout:a.timeoutMs},...a?.maxRetries===void 0?{}:{maxRetries:a.maxRetries}},{data:h,response:g}=await l.responses.create(u,p).withResponse();if(await a?.onResponse?.({status:g.status,headers:r(g.headers)},n),o.push({type:`start`,partial:e}),await d(h,e,o,n,{serviceTier:a?.serviceTier,applyServiceTierPricing:(e,t)=>S(e,t,n)}),a?.signal?.aborted)throw Error(`Request was aborted`);if(e.stopReason===`aborted`||e.stopReason===`error`)throw Error(`An unknown error occurred`);o.push({type:`done`,reason:e.stopReason,message:e}),o.end()}catch(t){for(let t of e.content)delete t.index,delete t.partialJson;e.stopReason=a?.signal?.aborted?`aborted`:`error`,e.errorMessage=t instanceof Error?t.message:JSON.stringify(t),o.push({type:`error`,reason:e.stopReason,error:e}),o.end()}})(),o},v=(e,r,a)=>{let o=a?.apiKey||t(e.provider);if(!o)throw Error(`No API key for provider: ${e.provider}`);let s=i(e,a,o),c=a?.reasoning?n(e,a.reasoning):void 0,l=c===`off`?void 0:c;return _(e,r,{...s,reasoningEffort:l})};function y(e,t,n,r,i){if(!n){if(!{}.OPENAI_API_KEY)throw Error(`OpenAI API key is required. Set OPENAI_API_KEY environment variable or pass it as an argument.`);n={}.OPENAI_API_KEY}let u=h(e),d={...e.headers};if(e.provider===`github-copilot`){let e=o(t.messages),n=c({messages:t.messages,hasImages:e});Object.assign(d,n)}i&&(u.sendSessionIdHeader&&(d.session_id=i),d[`x-client-request-id`]=i),r&&Object.assign(d,r);let f=e.provider===`cloudflare-ai-gateway`?{...d,Authorization:d.Authorization??null,"cf-aig-authorization":`Bearer ${n}`}:d;return new l({apiKey:n,baseURL:s(e.provider)?a(e):e.baseUrl,dangerouslyAllowBrowser:!0,defaultHeaders:f})}function b(e,t,n){let r=f(e,t,p),i=m(n?.cacheRetention),a=h(e),o={model:e.id,input:r,stream:!0,prompt_cache_key:i===`none`?void 0:n?.sessionId,prompt_cache_retention:g(a,i),store:!1};return n?.maxTokens&&(o.max_output_tokens=n?.maxTokens),n?.temperature!==void 0&&(o.temperature=n?.temperature),n?.serviceTier!==void 0&&(o.service_tier=n.serviceTier),t.tools&&t.tools.length>0&&(o.tools=u(t.tools)),e.reasoning&&(n?.reasoningEffort||n?.reasoningSummary?(o.reasoning={effort:n?.reasoningEffort?e.thinkingLevelMap?.[n.reasoningEffort]??n.reasoningEffort:`medium`,summary:n?.reasoningSummary||`auto`},o.include=[`reasoning.encrypted_content`]):e.provider!==`github-copilot`&&e.thinkingLevelMap?.off!==null&&(o.reasoning={effort:e.thinkingLevelMap?.off??`none`})),o}function x(e,t){switch(t){case`flex`:return .5;case`priority`:return e.id===`gpt-5.5`?2.5:2;default:return 1}}function S(e,t,n){let r=x(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)}export{_ as streamOpenAIResponses,v as streamSimpleOpenAIResponses};
|
package/dist/assets/{openai-responses-shared-DF3ZGaUx.js → openai-responses-shared-CORWeerT.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{l as e,r as t}from"./index-
|
|
1
|
+
import{l as e,r as t}from"./index-DRGbHzkd.js";import{i as n,t as r}from"./transform-messages-CmnxG9RB.js";import{t as i}from"./hash-Bt1aVMQ3.js";function a(e,t){let n={v:1,id:e};return t&&(n.phase=t),JSON.stringify(n)}function o(e){if(e){if(e.startsWith(`{`))try{let t=JSON.parse(e);if(t.v===1&&typeof t.id==`string`)return t.phase===`commentary`||t.phase===`final_answer`?{id:t.id,phase:t.phase}:{id:t.id}}catch{}return{id:e}}}function s(e,t,a,s){let c=[],l=e=>{let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);return(t.length>64?t.slice(0,64):t).replace(/_+$/,``)},u=e=>{let t=`fc_${i(e)}`;return t.length>64?t.slice(0,64):t},d=r(t.messages,e,(t,n,r)=>{if(!a.has(e.provider)||!t.includes(`|`))return l(t);let[i,o]=t.split(`|`),s=l(i),c=r.provider!==e.provider||r.api!==e.api?u(o):l(o);return c.startsWith(`fc_`)||(c=l(`fc_${c}`)),`${s}|${c}`});if((s?.includeSystemPrompt??!0)&&t.systemPrompt){let r=e.reasoning?`developer`:`system`;c.push({role:r,content:n(t.systemPrompt)})}let f=0;for(let t of d){if(t.role===`user`)if(typeof t.content==`string`)c.push({role:`user`,content:[{type:`input_text`,text:n(t.content)}]});else{let e=t.content.map(e=>e.type===`text`?{type:`input_text`,text:n(e.text)}:{type:`input_image`,detail:`auto`,image_url:`data:${e.mimeType};base64,${e.data}`});if(e.length===0)continue;c.push({role:`user`,content:e})}else if(t.role===`assistant`){let r=[],a=t,s=a.model!==e.id&&a.provider===e.provider&&a.api===e.api;for(let e of t.content)if(e.type===`thinking`){if(e.thinkingSignature){let t=JSON.parse(e.thinkingSignature);r.push(t)}}else if(e.type===`text`){let t=e,a=o(t.textSignature),s=a?.id;s?s.length>64&&(s=`msg_${i(s)}`):s=`msg_${f}`,r.push({type:`message`,role:`assistant`,content:[{type:`output_text`,text:n(t.text),annotations:[]}],status:`completed`,id:s,phase:a?.phase})}else if(e.type===`toolCall`){let t=e,[n,i]=t.id.split(`|`),a=i;s&&a?.startsWith(`fc_`)&&(a=void 0),r.push({type:`function_call`,id:a,call_id:n,name:t.name,arguments:JSON.stringify(t.arguments)})}if(r.length===0)continue;c.push(...r)}else if(t.role===`toolResult`){let r=t.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
2
2
|
`),i=t.content.some(e=>e.type===`image`),a=r.length>0,[o]=t.toolCallId.split(`|`),s;if(i&&e.input.includes(`image`)){let e=[];a&&e.push({type:`input_text`,text:n(r)});for(let n of t.content)n.type===`image`&&e.push({type:`input_image`,detail:`auto`,image_url:`data:${n.mimeType};base64,${n.data}`});s=e}else s=n(a?r:`(see attached image)`);c.push({type:`function_call_output`,call_id:o,output:s})}f++}return c}function c(e,t){let n=t?.strict===void 0?!1:t.strict;return e.map(e=>({type:`function`,name:e.name,description:e.description,parameters:e.parameters,strict:n}))}async function l(n,r,i,o,s){let c=null,l=null,d=r.content,f=()=>d.length-1;for await(let d of n)if(d.type===`response.created`)r.responseId=d.response.id;else if(d.type===`response.output_item.added`){let e=d.item;e.type===`reasoning`?(c=e,l={type:`thinking`,thinking:``},r.content.push(l),i.push({type:`thinking_start`,contentIndex:f(),partial:r})):e.type===`message`?(c=e,l={type:`text`,text:``},r.content.push(l),i.push({type:`text_start`,contentIndex:f(),partial:r})):e.type===`function_call`&&(c=e,l={type:`toolCall`,id:`${e.call_id}|${e.id}`,name:e.name,arguments:{},partialJson:e.arguments||``},r.content.push(l),i.push({type:`toolcall_start`,contentIndex:f(),partial:r}))}else if(d.type===`response.reasoning_summary_part.added`)c&&c.type===`reasoning`&&(c.summary=c.summary||[],c.summary.push(d.part));else if(d.type===`response.reasoning_summary_text.delta`){if(c?.type===`reasoning`&&l?.type===`thinking`){c.summary=c.summary||[];let e=c.summary[c.summary.length-1];e&&(l.thinking+=d.delta,e.text+=d.delta,i.push({type:`thinking_delta`,contentIndex:f(),delta:d.delta,partial:r}))}}else if(d.type===`response.reasoning_summary_part.done`){if(c?.type===`reasoning`&&l?.type===`thinking`){c.summary=c.summary||[];let e=c.summary[c.summary.length-1];e&&(l.thinking+=`
|
|
3
3
|
|
|
4
4
|
`,e.text+=`
|
package/dist/index.html
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
<meta name="apple-mobile-web-app-title" content="QuickForge" />
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
13
13
|
<title>速构 QuickForge</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-DRGbHzkd.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-CkqCuyE9.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/lit-vendor-Dr3cpBGF.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/css-utils-rkE68RDy.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/icons-BHkxP7oT.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CmyL2roG.js">
|
|
20
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
20
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B-WkttzD.css">
|
|
21
21
|
</head>
|
|
22
22
|
<body>
|
|
23
23
|
<div id="root"></div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-bedrock-runtime",
|
|
3
3
|
"description": "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1055.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@aws-sdk/eventstream-handler-node": "^3.972.17",
|
|
35
35
|
"@aws-sdk/middleware-eventstream": "^3.972.13",
|
|
36
36
|
"@aws-sdk/middleware-websocket": "^3.972.22",
|
|
37
|
-
"@aws-sdk/token-providers": "3.
|
|
37
|
+
"@aws-sdk/token-providers": "3.1055.0",
|
|
38
38
|
"@aws-sdk/types": "^3.973.9",
|
|
39
39
|
"@smithy/core": "^3.24.3",
|
|
40
40
|
"@smithy/fetch-http-handler": "^5.4.3",
|
package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @aws-sdk/token-providers
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@aws-sdk/token-providers)
|
|
4
|
+
[](https://www.npmjs.com/package/@aws-sdk/token-providers)
|
|
5
|
+
|
|
6
|
+
A collection of all token providers. The token providers should be used when the authorization
|
|
7
|
+
type is going to be token based. For example, the `bearer` authorization type set using
|
|
8
|
+
[httpBearerAuth trait][http-bearer-auth-trait] in Smithy.
|
|
9
|
+
|
|
10
|
+
## Static Token Provider
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { fromStatic } from "@aws-sdk/token-providers";
|
|
14
|
+
|
|
15
|
+
const token = { token: "TOKEN" };
|
|
16
|
+
const staticTokenProvider = fromStatic(token);
|
|
17
|
+
|
|
18
|
+
const staticToken = await staticTokenProvider(); // returns { token: "TOKEN" }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## SSO Token Provider
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { fromSso } from "@aws-sdk/token-providers";
|
|
25
|
+
|
|
26
|
+
// returns token from SSO token cache or ssoOidc.createToken() call.
|
|
27
|
+
const ssoToken = await fromSso();
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Env Token Provider with Signing Name
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { fromEnvSigningName } from "@aws-sdk/token-providers";
|
|
34
|
+
|
|
35
|
+
// returns token from environment, where token's key is based on signing name.
|
|
36
|
+
const envSigningNameToken = await fromEnvSigningName({ signingName: "signing name" });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Token Provider Chain
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { nodeProvider } from "@aws-sdk/token-providers";
|
|
43
|
+
|
|
44
|
+
// returns token from default providers.
|
|
45
|
+
const token = await nodeProvider();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
[http-bearer-auth-trait]: https://smithy.io/2.0/spec/authentication-traits.html#smithy-api-httpbearerauth-trait
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### Development
|
|
53
|
+
|
|
54
|
+
This package contains a minimal copy of the SSO OIDC client, instead of relying on the full client, which
|
|
55
|
+
would cause a circular dependency.
|
|
56
|
+
|
|
57
|
+
When regenerating the bundled version of the SSO OIDC client, run the esbuild.js script and then make the following changes:
|
|
58
|
+
|
|
59
|
+
- Remove any dependency of the generated client on the credential chain such that it would create
|
|
60
|
+
a circular dependency back to this package. Because we only need the `CreateTokenCommand`, the client, and this command's
|
|
61
|
+
associated `Exception`s, it is possible to remove auth dependencies.
|
|
62
|
+
- Ensure all required packages are declared in the `package.json` of token-providers.
|