@nyte-ai/ai 0.0.0-stage → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +170 -2
- package/THIRD-PARTY-NOTICES.md +800 -0
- package/dist/chunks/account-limits-cache-031vfpt3.js +37 -0
- package/dist/chunks/account-limits-cache-09vs98g6.js +41 -0
- package/dist/chunks/account-limits-cache-0af5gqeg.js +15 -0
- package/dist/chunks/account-limits-cache-0yd6bde8.js +103 -0
- package/dist/chunks/account-limits-cache-1jv43fhh.js +22 -0
- package/dist/chunks/account-limits-cache-3ykqmnj5.js +88 -0
- package/dist/chunks/account-limits-cache-4b8ckwqw.js +293 -0
- package/dist/chunks/account-limits-cache-4fn5w63p.js +295 -0
- package/dist/chunks/account-limits-cache-4hptgd2h.js +49 -0
- package/dist/chunks/account-limits-cache-53e64mhx.js +417 -0
- package/dist/chunks/account-limits-cache-5jdhn0e1.js +562 -0
- package/dist/chunks/account-limits-cache-5rx2pfm5.js +8 -0
- package/dist/chunks/account-limits-cache-5ygxyyss.js +19 -0
- package/dist/chunks/account-limits-cache-6250ykn6.js +21 -0
- package/dist/chunks/account-limits-cache-6x05n06z.js +49 -0
- package/dist/chunks/account-limits-cache-736tdyme.js +6 -0
- package/dist/chunks/account-limits-cache-75smws02.js +213 -0
- package/dist/chunks/account-limits-cache-7z9s8j16.js +139 -0
- package/dist/chunks/account-limits-cache-8137j3zp.js +37 -0
- package/dist/chunks/account-limits-cache-8qzk56vj.js +160 -0
- package/dist/chunks/account-limits-cache-8s8bz4dr.js +36 -0
- package/dist/chunks/account-limits-cache-8vzx8k6r.js +166 -0
- package/dist/chunks/account-limits-cache-8wfqg73s.js +135 -0
- package/dist/chunks/account-limits-cache-90c9c2eb.js +50 -0
- package/dist/chunks/account-limits-cache-9wqk28n5.js +25 -0
- package/dist/chunks/account-limits-cache-a1jyaq00.js +56 -0
- package/dist/chunks/account-limits-cache-a558rjbg.js +138 -0
- package/dist/chunks/account-limits-cache-a55e14fr.js +70 -0
- package/dist/chunks/account-limits-cache-a6cgeagz.js +77 -0
- package/dist/chunks/account-limits-cache-ag5b8dja.js +38 -0
- package/dist/chunks/account-limits-cache-b0x2sfya.js +45 -0
- package/dist/chunks/account-limits-cache-b23sbrke.js +26 -0
- package/dist/chunks/account-limits-cache-b4edaybk.js +8 -0
- package/dist/chunks/account-limits-cache-bsknrh6t.js +74 -0
- package/dist/chunks/account-limits-cache-c7v93krb.js +235 -0
- package/dist/chunks/account-limits-cache-csbxvam7.js +12 -0
- package/dist/chunks/account-limits-cache-cw7q7vfy.js +293 -0
- package/dist/chunks/account-limits-cache-d1ypzqzp.js +27 -0
- package/dist/chunks/account-limits-cache-d2a51dka.js +17 -0
- package/dist/chunks/account-limits-cache-dejeygdt.js +114 -0
- package/dist/chunks/account-limits-cache-eejm0vth.js +11 -0
- package/dist/chunks/account-limits-cache-ehy0ze2b.js +33 -0
- package/dist/chunks/account-limits-cache-emg5b4hj.js +53 -0
- package/dist/chunks/account-limits-cache-eqwweapz.js +6 -0
- package/dist/chunks/account-limits-cache-eyx1jcxc.js +8 -0
- package/dist/chunks/account-limits-cache-f9z00x8c.js +36 -0
- package/dist/chunks/account-limits-cache-fbkaq46e.js +113 -0
- package/dist/chunks/account-limits-cache-fdwad56n.js +399 -0
- package/dist/chunks/account-limits-cache-fht68jp2.js +22 -0
- package/dist/chunks/account-limits-cache-fp03ztsw.js +17 -0
- package/dist/chunks/account-limits-cache-fsktnetm.js +69 -0
- package/dist/chunks/account-limits-cache-fvadc36m.js +110 -0
- package/dist/chunks/account-limits-cache-ghe9ne4j.js +69 -0
- package/dist/chunks/account-limits-cache-gknnm1kv.js +13 -0
- package/dist/chunks/account-limits-cache-gqsrbky9.js +40 -0
- package/dist/chunks/account-limits-cache-gr671dr2.js +0 -0
- package/dist/chunks/account-limits-cache-gs8a3fhw.js +32 -0
- package/dist/chunks/account-limits-cache-gsa5tzck.js +37 -0
- package/dist/chunks/account-limits-cache-h92bzz1j.js +235 -0
- package/dist/chunks/account-limits-cache-hemxtapd.js +142 -0
- package/dist/chunks/account-limits-cache-hj1h48sc.js +92 -0
- package/dist/chunks/account-limits-cache-hj3ek3ty.js +128 -0
- package/dist/chunks/account-limits-cache-hwehc67r.js +509 -0
- package/dist/chunks/account-limits-cache-hyzn1jmk.js +46 -0
- package/dist/chunks/account-limits-cache-j2bt392s.js +63 -0
- package/dist/chunks/account-limits-cache-k0pkzhbx.js +74 -0
- package/dist/chunks/account-limits-cache-kjx405q0.js +277 -0
- package/dist/chunks/account-limits-cache-ks1sjym9.js +37 -0
- package/dist/chunks/account-limits-cache-me1x57bs.js +89 -0
- package/dist/chunks/account-limits-cache-n3yk6g5c.js +314 -0
- package/dist/chunks/account-limits-cache-nbhht7xz.js +72 -0
- package/dist/chunks/account-limits-cache-nbkyhs6v.js +42 -0
- package/dist/chunks/account-limits-cache-nn9jebsj.js +26 -0
- package/dist/chunks/account-limits-cache-nxkprk3g.js +13 -0
- package/dist/chunks/account-limits-cache-nyy770yd.js +38 -0
- package/dist/chunks/account-limits-cache-pfa86y8e.js +45 -0
- package/dist/chunks/account-limits-cache-pfr14mcn.js +59 -0
- package/dist/chunks/account-limits-cache-q1ebtvet.js +8 -0
- package/dist/chunks/account-limits-cache-q63mc41j.js +51 -0
- package/dist/chunks/account-limits-cache-re8hpzwn.js +104 -0
- package/dist/chunks/account-limits-cache-rz8p1g5y.js +9 -0
- package/dist/chunks/account-limits-cache-skbfmzqe.js +7 -0
- package/dist/chunks/account-limits-cache-tc38g0ca.js +20 -0
- package/dist/chunks/account-limits-cache-v4n30az2.js +24 -0
- package/dist/chunks/account-limits-cache-vwgfz727.js +281 -0
- package/dist/chunks/account-limits-cache-x9fvb3s5.js +8 -0
- package/dist/chunks/account-limits-cache-xds88kxd.js +209 -0
- package/dist/chunks/account-limits-cache-xz65wyd1.js +428 -0
- package/dist/chunks/account-limits-cache-ydq8p8qp.js +39 -0
- package/dist/chunks/account-limits-cache-ykbqsvv6.js +134 -0
- package/dist/chunks/account-limits-cache-za42x8a3.js +25 -0
- package/dist/chunks/account-limits-cache-zcbkmrvy.js +79 -0
- package/dist/chunks/account-limits-cache-zgzptd0z.js +62 -0
- package/dist/chunks/account-limits-cache-zn01kscn.js +252 -0
- package/dist/chunks/account-limits-cache-zpjmeyt0.js +113 -0
- package/dist/chunks/account-limits-cache-zqdb4yh4.js +8 -0
- package/dist/src/account-limits-cache.d.ts +16 -0
- package/dist/src/account-limits-cache.js +7 -0
- package/dist/src/api/anthropic-client.d.ts +25 -0
- package/dist/src/api/anthropic-client.js +30 -0
- package/dist/src/api/anthropic-convert.d.ts +17 -0
- package/dist/src/api/anthropic-convert.js +14 -0
- package/dist/src/api/anthropic-events.d.ts +101 -0
- package/dist/src/api/anthropic-events.js +11 -0
- package/dist/src/api/anthropic-messages.d.ts +88 -0
- package/dist/src/api/anthropic-messages.js +578 -0
- package/dist/src/api/anthropic-messages.lazy.d.ts +2 -0
- package/dist/src/api/anthropic-messages.lazy.js +11 -0
- package/dist/src/api/assistant-stream.d.ts +23 -0
- package/dist/src/api/assistant-stream.js +15 -0
- package/dist/src/api/claude-code.d.ts +12 -0
- package/dist/src/api/claude-code.js +12 -0
- package/dist/src/api/cloudflare.d.ts +8 -0
- package/dist/src/api/cloudflare.js +11 -0
- package/dist/src/api/constrained-sampling.d.ts +24 -0
- package/dist/src/api/constrained-sampling.js +16 -0
- package/dist/src/api/deferred.d.ts +7 -0
- package/dist/src/api/deferred.js +10 -0
- package/dist/src/api/github-copilot-headers.d.ts +15 -0
- package/dist/src/api/github-copilot-headers.js +12 -0
- package/dist/src/api/google-generative-ai.d.ts +22 -0
- package/dist/src/api/google-generative-ai.js +583 -0
- package/dist/src/api/google-generative-ai.lazy.d.ts +2 -0
- package/dist/src/api/google-generative-ai.lazy.js +11 -0
- package/dist/src/api/lazy.d.ts +18 -0
- package/dist/src/api/lazy.js +12 -0
- package/dist/src/api/openai-codex-compact.d.ts +14 -0
- package/dist/src/api/openai-codex-compact.js +389 -0
- package/dist/src/api/openai-codex-compaction-error.d.ts +7 -0
- package/dist/src/api/openai-codex-compaction-error.js +6 -0
- package/dist/src/api/openai-codex-protocol.d.ts +125 -0
- package/dist/src/api/openai-codex-protocol.js +48 -0
- package/dist/src/api/openai-codex-responses.d.ts +4 -0
- package/dist/src/api/openai-codex-responses.js +175 -0
- package/dist/src/api/openai-codex-responses.lazy.d.ts +2 -0
- package/dist/src/api/openai-codex-responses.lazy.js +11 -0
- package/dist/src/api/openai-codex-websocket.d.ts +13 -0
- package/dist/src/api/openai-codex-websocket.js +37 -0
- package/dist/src/api/openai-codex-wire.d.ts +44 -0
- package/dist/src/api/openai-codex-wire.js +34 -0
- package/dist/src/api/openai-compact.d.ts +9 -0
- package/dist/src/api/openai-compact.js +12 -0
- package/dist/src/api/openai-completions-convert.d.ts +58 -0
- package/dist/src/api/openai-completions-convert.js +21 -0
- package/dist/src/api/openai-completions-params.d.ts +29 -0
- package/dist/src/api/openai-completions-params.js +20 -0
- package/dist/src/api/openai-completions-reasoning.d.ts +54 -0
- package/dist/src/api/openai-completions-reasoning.js +22 -0
- package/dist/src/api/openai-completions.d.ts +22 -0
- package/dist/src/api/openai-completions.js +484 -0
- package/dist/src/api/openai-completions.lazy.d.ts +5 -0
- package/dist/src/api/openai-completions.lazy.js +11 -0
- package/dist/src/api/openai-prompt-cache.d.ts +1 -0
- package/dist/src/api/openai-prompt-cache.js +6 -0
- package/dist/src/api/openai-responses-convert.d.ts +58 -0
- package/dist/src/api/openai-responses-convert.js +16 -0
- package/dist/src/api/openai-responses-events.d.ts +379 -0
- package/dist/src/api/openai-responses-events.js +12 -0
- package/dist/src/api/openai-responses-stream.d.ts +36 -0
- package/dist/src/api/openai-responses-stream.js +25 -0
- package/dist/src/api/openai-responses.d.ts +18 -0
- package/dist/src/api/openai-responses.js +276 -0
- package/dist/src/api/openai-responses.lazy.d.ts +2 -0
- package/dist/src/api/openai-responses.lazy.js +11 -0
- package/dist/src/api/simple-options.d.ts +17 -0
- package/dist/src/api/simple-options.js +18 -0
- package/dist/src/api/token-count.d.ts +5 -0
- package/dist/src/api/token-count.js +8 -0
- package/dist/src/api/transform-messages.d.ts +9 -0
- package/dist/src/api/transform-messages.js +6 -0
- package/dist/src/api-options.d.ts +27 -0
- package/dist/src/api-options.js +0 -0
- package/dist/src/auth/context.d.ts +11 -0
- package/dist/src/auth/context.js +6 -0
- package/dist/src/auth/credential-store.d.ts +17 -0
- package/dist/src/auth/credential-store.js +7 -0
- package/dist/src/auth/helpers.d.ts +24 -0
- package/dist/src/auth/helpers.js +8 -0
- package/dist/src/auth/oauth/anthropic.d.ts +7 -0
- package/dist/src/auth/oauth/anthropic.js +12 -0
- package/dist/src/auth/oauth/authorization-input.d.ts +14 -0
- package/dist/src/auth/oauth/authorization-input.js +6 -0
- package/dist/src/auth/oauth/device-code.d.ts +29 -0
- package/dist/src/auth/oauth/device-code.js +9 -0
- package/dist/src/auth/oauth/github-copilot.d.ts +23 -0
- package/dist/src/auth/oauth/github-copilot.js +12 -0
- package/dist/src/auth/oauth/load.d.ts +14 -0
- package/dist/src/auth/oauth/load.js +10 -0
- package/dist/src/auth/oauth/oauth-page.d.ts +13 -0
- package/dist/src/auth/oauth/oauth-page.js +8 -0
- package/dist/src/auth/oauth/openai-codex.d.ts +10 -0
- package/dist/src/auth/oauth/openai-codex.js +18 -0
- package/dist/src/auth/oauth/pkce.d.ts +12 -0
- package/dist/src/auth/oauth/pkce.js +6 -0
- package/dist/src/auth/resolve.d.ts +38 -0
- package/dist/src/auth/resolve.js +12 -0
- package/dist/src/auth/store.d.ts +29 -0
- package/dist/src/auth/store.js +10 -0
- package/dist/src/auth/types.d.ts +291 -0
- package/dist/src/auth/types.js +8 -0
- package/dist/src/auth/verify.d.ts +13 -0
- package/dist/src/auth/verify.js +7 -0
- package/dist/src/bun-oauth.d.ts +2 -0
- package/dist/src/bun-oauth.js +25 -0
- package/dist/src/env-api-keys.d.ts +32 -0
- package/dist/src/env-api-keys.js +27 -0
- package/dist/src/file-models-store.d.ts +18 -0
- package/dist/src/file-models-store.js +9 -0
- package/dist/src/index.d.ts +62 -0
- package/dist/src/index.js +372 -0
- package/dist/src/model-capabilities.d.ts +21 -0
- package/dist/src/model-capabilities.js +14 -0
- package/dist/src/model-pricing.d.ts +6 -0
- package/dist/src/model-pricing.js +10 -0
- package/dist/src/model-variants.d.ts +21 -0
- package/dist/src/model-variants.js +19 -0
- package/dist/src/models-refresh.d.ts +27 -0
- package/dist/src/models-refresh.js +9 -0
- package/dist/src/models-store.d.ts +31 -0
- package/dist/src/models-store.js +6 -0
- package/dist/src/models-types.d.ts +206 -0
- package/dist/src/models-types.js +0 -0
- package/dist/src/models.d.ts +7 -0
- package/dist/src/models.js +44 -0
- package/dist/src/prompt-cache.d.ts +5 -0
- package/dist/src/prompt-cache.js +9 -0
- package/dist/src/provider.d.ts +23 -0
- package/dist/src/provider.js +14 -0
- package/dist/src/providers/account-limits.d.ts +13 -0
- package/dist/src/providers/account-limits.js +8 -0
- package/dist/src/providers/anthropic-limits.d.ts +9 -0
- package/dist/src/providers/anthropic-limits.js +10 -0
- package/dist/src/providers/anthropic.d.ts +2 -0
- package/dist/src/providers/anthropic.js +25 -0
- package/dist/src/providers/github-copilot-catalog.d.ts +5 -0
- package/dist/src/providers/github-copilot-catalog.js +7 -0
- package/dist/src/providers/github-copilot.d.ts +2 -0
- package/dist/src/providers/github-copilot.js +23 -0
- package/dist/src/providers/nyte-catalog.d.ts +15 -0
- package/dist/src/providers/nyte-catalog.js +63 -0
- package/dist/src/providers/openai-codex-limits.d.ts +8 -0
- package/dist/src/providers/openai-codex-limits.js +14 -0
- package/dist/src/providers/openai-codex.d.ts +2 -0
- package/dist/src/providers/openai-codex.js +23 -0
- package/dist/src/providers/openai.d.ts +2 -0
- package/dist/src/providers/openai.js +19 -0
- package/dist/src/providers/opencode-go.d.ts +5 -0
- package/dist/src/providers/opencode-go.js +22 -0
- package/dist/src/providers/opencode-headers.d.ts +5 -0
- package/dist/src/providers/opencode-headers.js +6 -0
- package/dist/src/providers/opencode.d.ts +14 -0
- package/dist/src/providers/opencode.js +23 -0
- package/dist/src/providers/openrouter.d.ts +2 -0
- package/dist/src/providers/openrouter.js +19 -0
- package/dist/src/providers/vercel-ai-gateway.d.ts +3 -0
- package/dist/src/providers/vercel-ai-gateway.js +19 -0
- package/dist/src/session-resources.d.ts +9 -0
- package/dist/src/session-resources.js +10 -0
- package/dist/src/types.d.ts +210 -0
- package/dist/src/types.js +1 -0
- package/dist/src/utils/abort.d.ts +12 -0
- package/dist/src/utils/abort.js +10 -0
- package/dist/src/utils/deferred-tools.d.ts +11 -0
- package/dist/src/utils/deferred-tools.js +6 -0
- package/dist/src/utils/diagnostics.d.ts +11 -0
- package/dist/src/utils/diagnostics.js +12 -0
- package/dist/src/utils/error-body.d.ts +26 -0
- package/dist/src/utils/error-body.js +10 -0
- package/dist/src/utils/estimate.d.ts +20 -0
- package/dist/src/utils/estimate.js +14 -0
- package/dist/src/utils/event-stream.d.ts +22 -0
- package/dist/src/utils/event-stream.js +11 -0
- package/dist/src/utils/failure.d.ts +49 -0
- package/dist/src/utils/failure.js +10 -0
- package/dist/src/utils/fifo-queue.d.ts +11 -0
- package/dist/src/utils/fifo-queue.js +6 -0
- package/dist/src/utils/hash.d.ts +5 -0
- package/dist/src/utils/hash.js +6 -0
- package/dist/src/utils/headers.d.ts +12 -0
- package/dist/src/utils/headers.js +14 -0
- package/dist/src/utils/json-parse.d.ts +33 -0
- package/dist/src/utils/json-parse.js +12 -0
- package/dist/src/utils/node-http-proxy.d.ts +6 -0
- package/dist/src/utils/node-http-proxy.js +9 -0
- package/dist/src/utils/nyte-home.d.ts +2 -0
- package/dist/src/utils/nyte-home.js +6 -0
- package/dist/src/utils/nyte-user-agent.d.ts +1 -0
- package/dist/src/utils/nyte-user-agent.js +6 -0
- package/dist/src/utils/overflow.d.ts +18 -0
- package/dist/src/utils/overflow.js +9 -0
- package/dist/src/utils/provider-env.d.ts +9 -0
- package/dist/src/utils/provider-env.js +6 -0
- package/dist/src/utils/provider-retry.d.ts +22 -0
- package/dist/src/utils/provider-retry.js +9 -0
- package/dist/src/utils/retry.d.ts +66 -0
- package/dist/src/utils/retry.js +18 -0
- package/dist/src/utils/sanitize-unicode.d.ts +24 -0
- package/dist/src/utils/sanitize-unicode.js +6 -0
- package/dist/src/utils/sse.d.ts +21 -0
- package/dist/src/utils/sse.js +6 -0
- package/dist/src/utils/text.d.ts +5 -0
- package/dist/src/utils/text.js +10 -0
- package/dist/src/utils/transcript.d.ts +5 -0
- package/dist/src/utils/transcript.js +36 -0
- package/dist/src/utils/typebox-helpers.d.ts +19 -0
- package/dist/src/utils/typebox-helpers.js +6 -0
- package/dist/src/utils/uuid.d.ts +2 -0
- package/dist/src/utils/uuid.js +6 -0
- package/dist/src/utils/validation.d.ts +13 -0
- package/dist/src/utils/validation.js +8 -0
- package/package.json +152 -3
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFastModeCostMultiplier2
|
|
3
|
+
} from "../chunks/account-limits-cache-f9z00x8c.js";
|
|
4
|
+
import {
|
|
5
|
+
FAST_MODEL_SUFFIX2,
|
|
6
|
+
fastModelId2,
|
|
7
|
+
supportsFastMode2,
|
|
8
|
+
withFastVariants2,
|
|
9
|
+
baseModel2,
|
|
10
|
+
providerIdentity2
|
|
11
|
+
} from "../chunks/account-limits-cache-031vfpt3.js";
|
|
12
|
+
import {
|
|
13
|
+
compactOpenAICodexContext2,
|
|
14
|
+
compactOpenAIResponsesContext2
|
|
15
|
+
} from "../chunks/account-limits-cache-fp03ztsw.js";
|
|
16
|
+
import"../chunks/account-limits-cache-nn9jebsj.js";
|
|
17
|
+
import {
|
|
18
|
+
EventStream2,
|
|
19
|
+
AssistantMessageEventStream2,
|
|
20
|
+
createAssistantMessageEventStream2
|
|
21
|
+
} from "../chunks/account-limits-cache-a6cgeagz.js";
|
|
22
|
+
import"../chunks/account-limits-cache-zcbkmrvy.js";
|
|
23
|
+
import"../chunks/account-limits-cache-fsktnetm.js";
|
|
24
|
+
import {
|
|
25
|
+
lazyStream2,
|
|
26
|
+
lazyApi2
|
|
27
|
+
} from "../chunks/account-limits-cache-90c9c2eb.js";
|
|
28
|
+
import {
|
|
29
|
+
OpenAICodexCompactionError2
|
|
30
|
+
} from "../chunks/account-limits-cache-eejm0vth.js";
|
|
31
|
+
import {
|
|
32
|
+
defaultProviderAuthContext2
|
|
33
|
+
} from "../chunks/account-limits-cache-1jv43fhh.js";
|
|
34
|
+
import"../chunks/account-limits-cache-j2bt392s.js";
|
|
35
|
+
import {
|
|
36
|
+
InMemoryCredentialStore2
|
|
37
|
+
} from "../chunks/account-limits-cache-emg5b4hj.js";
|
|
38
|
+
import {
|
|
39
|
+
envApiKeyAuth2,
|
|
40
|
+
lazyOAuth2
|
|
41
|
+
} from "../chunks/account-limits-cache-6x05n06z.js";
|
|
42
|
+
import {
|
|
43
|
+
OAuthTokenResponseSchema2,
|
|
44
|
+
readCredentialAccounts2
|
|
45
|
+
} from "../chunks/account-limits-cache-b0x2sfya.js";
|
|
46
|
+
import"../chunks/account-limits-cache-rz8p1g5y.js";
|
|
47
|
+
import {
|
|
48
|
+
defaultAuthPath2,
|
|
49
|
+
FileCredentialStore2
|
|
50
|
+
} from "../chunks/account-limits-cache-c7v93krb.js";
|
|
51
|
+
import {
|
|
52
|
+
defaultModelsStorePath2,
|
|
53
|
+
FileModelsStore2
|
|
54
|
+
} from "../chunks/account-limits-cache-a55e14fr.js";
|
|
55
|
+
import {
|
|
56
|
+
formatThrownValue2,
|
|
57
|
+
extractDiagnosticError2,
|
|
58
|
+
createAssistantMessageDiagnostic2,
|
|
59
|
+
appendAssistantMessageDiagnostic2
|
|
60
|
+
} from "../chunks/account-limits-cache-9wqk28n5.js";
|
|
61
|
+
import {
|
|
62
|
+
ModelsError2,
|
|
63
|
+
resolveProviderAuth2
|
|
64
|
+
} from "../chunks/account-limits-cache-7z9s8j16.js";
|
|
65
|
+
import"../chunks/account-limits-cache-b23sbrke.js";
|
|
66
|
+
import"../chunks/account-limits-cache-d1ypzqzp.js";
|
|
67
|
+
import {
|
|
68
|
+
oauthSuccessHtml2,
|
|
69
|
+
oauthErrorHtml2
|
|
70
|
+
} from "../chunks/account-limits-cache-8vzx8k6r.js";
|
|
71
|
+
import {
|
|
72
|
+
loadAnthropicOAuth2,
|
|
73
|
+
loadOpenAICodexOAuth2
|
|
74
|
+
} from "../chunks/account-limits-cache-v4n30az2.js";
|
|
75
|
+
import {
|
|
76
|
+
generatePKCE2
|
|
77
|
+
} from "../chunks/account-limits-cache-tc38g0ca.js";
|
|
78
|
+
import {
|
|
79
|
+
anthropicOAuth2
|
|
80
|
+
} from "../chunks/account-limits-cache-4fn5w63p.js";
|
|
81
|
+
import"../chunks/account-limits-cache-za42x8a3.js";
|
|
82
|
+
import"../chunks/account-limits-cache-gs8a3fhw.js";
|
|
83
|
+
import {
|
|
84
|
+
abortableSleep3,
|
|
85
|
+
pollOAuthDeviceCodeFlow2
|
|
86
|
+
} from "../chunks/account-limits-cache-4hptgd2h.js";
|
|
87
|
+
import {
|
|
88
|
+
githubCopilotOAuth2
|
|
89
|
+
} from "../chunks/account-limits-cache-cw7q7vfy.js";
|
|
90
|
+
import {
|
|
91
|
+
getAccountId2,
|
|
92
|
+
openaiCodexOAuth2
|
|
93
|
+
} from "../chunks/account-limits-cache-xz65wyd1.js";
|
|
94
|
+
import {
|
|
95
|
+
ANTHROPIC_AUTH_TOKEN_ENV2,
|
|
96
|
+
ANTHROPIC_OAUTH_TOKEN_ENV2,
|
|
97
|
+
ANTHROPIC_API_KEY_ENV2,
|
|
98
|
+
ANTHROPIC_FEDERATION_RULE_ID_ENV2,
|
|
99
|
+
ANTHROPIC_ORGANIZATION_ID_ENV2,
|
|
100
|
+
ANTHROPIC_SERVICE_ACCOUNT_ID_ENV2,
|
|
101
|
+
ANTHROPIC_IDENTITY_TOKEN_FILE_ENV2,
|
|
102
|
+
ANTHROPIC_WORKSPACE_ID_ENV2,
|
|
103
|
+
ANTHROPIC_ENV_KEYS2,
|
|
104
|
+
findEnvKeys2,
|
|
105
|
+
getEnvApiKey2
|
|
106
|
+
} from "../chunks/account-limits-cache-hyzn1jmk.js";
|
|
107
|
+
import"../chunks/account-limits-cache-hemxtapd.js";
|
|
108
|
+
import {
|
|
109
|
+
InMemoryModelsStore2
|
|
110
|
+
} from "../chunks/account-limits-cache-5ygxyyss.js";
|
|
111
|
+
import"../chunks/account-limits-cache-ag5b8dja.js";
|
|
112
|
+
import {
|
|
113
|
+
uuidv72
|
|
114
|
+
} from "../chunks/account-limits-cache-8137j3zp.js";
|
|
115
|
+
import"../chunks/account-limits-cache-zpjmeyt0.js";
|
|
116
|
+
import {
|
|
117
|
+
hasApi2,
|
|
118
|
+
calculateCost2,
|
|
119
|
+
getSupportedThinkingLevels2,
|
|
120
|
+
clampThinkingLevel2,
|
|
121
|
+
modelsAreEqual2
|
|
122
|
+
} from "../chunks/account-limits-cache-zgzptd0z.js";
|
|
123
|
+
import {
|
|
124
|
+
createProvider2
|
|
125
|
+
} from "../chunks/account-limits-cache-ykbqsvv6.js";
|
|
126
|
+
import {
|
|
127
|
+
DEFAULT_MODELS_CATALOG_URL2,
|
|
128
|
+
createModels2
|
|
129
|
+
} from "../chunks/account-limits-cache-5jdhn0e1.js";
|
|
130
|
+
import {
|
|
131
|
+
resolveCacheRetention2,
|
|
132
|
+
promptCacheMinimumTtlMs2
|
|
133
|
+
} from "../chunks/account-limits-cache-d2a51dka.js";
|
|
134
|
+
import {
|
|
135
|
+
registerSessionResourceCleanup2,
|
|
136
|
+
cleanupSessionResources2,
|
|
137
|
+
acquireSessionResources2
|
|
138
|
+
} from "../chunks/account-limits-cache-gqsrbky9.js";
|
|
139
|
+
import"../chunks/account-limits-cache-gr671dr2.js";
|
|
140
|
+
import {
|
|
141
|
+
calculateContextTokens2,
|
|
142
|
+
estimateTextTokens2,
|
|
143
|
+
estimateTextAndImageContentTokens2,
|
|
144
|
+
estimateMessageTokens2,
|
|
145
|
+
estimateContextTokens2
|
|
146
|
+
} from "../chunks/account-limits-cache-dejeygdt.js";
|
|
147
|
+
import {
|
|
148
|
+
repairJson2,
|
|
149
|
+
parseStreamingJson2,
|
|
150
|
+
parseToolCallArguments2,
|
|
151
|
+
unfinishedToolCallArguments2
|
|
152
|
+
} from "../chunks/account-limits-cache-fbkaq46e.js";
|
|
153
|
+
import {
|
|
154
|
+
reportsQuotaExhaustion2,
|
|
155
|
+
classifyAssistantFailure2,
|
|
156
|
+
retryCanHelp2
|
|
157
|
+
} from "../chunks/account-limits-cache-xds88kxd.js";
|
|
158
|
+
import {
|
|
159
|
+
overflowsContext2,
|
|
160
|
+
stoppedShort2
|
|
161
|
+
} from "../chunks/account-limits-cache-nxkprk3g.js";
|
|
162
|
+
import {
|
|
163
|
+
DEFAULT_MAX_AGENT_RETRY_DELAY_MS2,
|
|
164
|
+
retryDelayMs2,
|
|
165
|
+
assistantRetryDelayMs2,
|
|
166
|
+
retryAssistantCall2,
|
|
167
|
+
failedTransiently2
|
|
168
|
+
} from "../chunks/account-limits-cache-bsknrh6t.js";
|
|
169
|
+
import {
|
|
170
|
+
contentText2,
|
|
171
|
+
getSystemMessageText2,
|
|
172
|
+
renderSystemMessageUpdate2
|
|
173
|
+
} from "../chunks/account-limits-cache-b4edaybk.js";
|
|
174
|
+
import {
|
|
175
|
+
collapseSystemMessages2,
|
|
176
|
+
createInitialSystemMessage2,
|
|
177
|
+
declarationsEqual2,
|
|
178
|
+
getCurrentSystemMessage2,
|
|
179
|
+
getCurrentSystemPrompt2,
|
|
180
|
+
getCurrentTools2,
|
|
181
|
+
getDeclaredTools2,
|
|
182
|
+
getInitialSystemMessage2,
|
|
183
|
+
getToolStateChanges2,
|
|
184
|
+
hasNonAdditiveToolChanges2,
|
|
185
|
+
hasToolRedefinitions2,
|
|
186
|
+
normalizeContext2,
|
|
187
|
+
resolveTranscript2,
|
|
188
|
+
resolveTranscriptTools2,
|
|
189
|
+
toToolDeclaration2,
|
|
190
|
+
withoutInitialSystemMessage2
|
|
191
|
+
} from "../chunks/account-limits-cache-6250ykn6.js";
|
|
192
|
+
import {
|
|
193
|
+
StringEnum2
|
|
194
|
+
} from "../chunks/account-limits-cache-skbfmzqe.js";
|
|
195
|
+
import {
|
|
196
|
+
validateToolArguments2,
|
|
197
|
+
createToolArgumentParser2
|
|
198
|
+
} from "../chunks/account-limits-cache-kjx405q0.js";
|
|
199
|
+
import"../chunks/account-limits-cache-zqdb4yh4.js";
|
|
200
|
+
import"../chunks/account-limits-cache-ks1sjym9.js";
|
|
201
|
+
import"../chunks/account-limits-cache-ehy0ze2b.js";
|
|
202
|
+
import {
|
|
203
|
+
fetchAnthropicAccountLimits2
|
|
204
|
+
} from "../chunks/account-limits-cache-re8hpzwn.js";
|
|
205
|
+
import"../chunks/account-limits-cache-ydq8p8qp.js";
|
|
206
|
+
import {
|
|
207
|
+
anthropicProvider2
|
|
208
|
+
} from "../chunks/account-limits-cache-8wfqg73s.js";
|
|
209
|
+
import"../chunks/account-limits-cache-eyx1jcxc.js";
|
|
210
|
+
import"../chunks/account-limits-cache-q1ebtvet.js";
|
|
211
|
+
import {
|
|
212
|
+
githubCopilotProvider2
|
|
213
|
+
} from "../chunks/account-limits-cache-a1jyaq00.js";
|
|
214
|
+
import"../chunks/account-limits-cache-5rx2pfm5.js";
|
|
215
|
+
import"../chunks/account-limits-cache-gknnm1kv.js";
|
|
216
|
+
import"../chunks/account-limits-cache-fvadc36m.js";
|
|
217
|
+
import {
|
|
218
|
+
fetchOpenAICodexAccountLimits2
|
|
219
|
+
} from "../chunks/account-limits-cache-hj3ek3ty.js";
|
|
220
|
+
import {
|
|
221
|
+
openaiCodexProvider2
|
|
222
|
+
} from "../chunks/account-limits-cache-09vs98g6.js";
|
|
223
|
+
import {
|
|
224
|
+
openaiProvider2
|
|
225
|
+
} from "../chunks/account-limits-cache-gsa5tzck.js";
|
|
226
|
+
import"../chunks/account-limits-cache-fht68jp2.js";
|
|
227
|
+
import"../chunks/account-limits-cache-x9fvb3s5.js";
|
|
228
|
+
import {
|
|
229
|
+
opencodeProvider2
|
|
230
|
+
} from "../chunks/account-limits-cache-nbkyhs6v.js";
|
|
231
|
+
import {
|
|
232
|
+
opencodeGoProvider2
|
|
233
|
+
} from "../chunks/account-limits-cache-nyy770yd.js";
|
|
234
|
+
import {
|
|
235
|
+
openrouterProvider2
|
|
236
|
+
} from "../chunks/account-limits-cache-pfa86y8e.js";
|
|
237
|
+
import {
|
|
238
|
+
vercelAiGatewayProvider2
|
|
239
|
+
} from "../chunks/account-limits-cache-q63mc41j.js";
|
|
240
|
+
import {
|
|
241
|
+
defaultModelPerProvider2,
|
|
242
|
+
createNyteModels2,
|
|
243
|
+
nyteProviders2
|
|
244
|
+
} from "../chunks/account-limits-cache-ghe9ne4j.js";
|
|
245
|
+
|
|
246
|
+
// src/index.ts
|
|
247
|
+
import { Type } from "typebox";
|
|
248
|
+
export {
|
|
249
|
+
ANTHROPIC_API_KEY_ENV2 as ANTHROPIC_API_KEY_ENV,
|
|
250
|
+
ANTHROPIC_AUTH_TOKEN_ENV2 as ANTHROPIC_AUTH_TOKEN_ENV,
|
|
251
|
+
ANTHROPIC_ENV_KEYS2 as ANTHROPIC_ENV_KEYS,
|
|
252
|
+
ANTHROPIC_FEDERATION_RULE_ID_ENV2 as ANTHROPIC_FEDERATION_RULE_ID_ENV,
|
|
253
|
+
ANTHROPIC_IDENTITY_TOKEN_FILE_ENV2 as ANTHROPIC_IDENTITY_TOKEN_FILE_ENV,
|
|
254
|
+
ANTHROPIC_OAUTH_TOKEN_ENV2 as ANTHROPIC_OAUTH_TOKEN_ENV,
|
|
255
|
+
ANTHROPIC_ORGANIZATION_ID_ENV2 as ANTHROPIC_ORGANIZATION_ID_ENV,
|
|
256
|
+
ANTHROPIC_SERVICE_ACCOUNT_ID_ENV2 as ANTHROPIC_SERVICE_ACCOUNT_ID_ENV,
|
|
257
|
+
ANTHROPIC_WORKSPACE_ID_ENV2 as ANTHROPIC_WORKSPACE_ID_ENV,
|
|
258
|
+
AssistantMessageEventStream2 as AssistantMessageEventStream,
|
|
259
|
+
DEFAULT_MAX_AGENT_RETRY_DELAY_MS2 as DEFAULT_MAX_AGENT_RETRY_DELAY_MS,
|
|
260
|
+
DEFAULT_MODELS_CATALOG_URL2 as DEFAULT_MODELS_CATALOG_URL,
|
|
261
|
+
EventStream2 as EventStream,
|
|
262
|
+
FAST_MODEL_SUFFIX2 as FAST_MODEL_SUFFIX,
|
|
263
|
+
FileCredentialStore2 as FileCredentialStore,
|
|
264
|
+
FileModelsStore2 as FileModelsStore,
|
|
265
|
+
InMemoryCredentialStore2 as InMemoryCredentialStore,
|
|
266
|
+
InMemoryModelsStore2 as InMemoryModelsStore,
|
|
267
|
+
ModelsError2 as ModelsError,
|
|
268
|
+
OAuthTokenResponseSchema2 as OAuthTokenResponseSchema,
|
|
269
|
+
OpenAICodexCompactionError2 as OpenAICodexCompactionError,
|
|
270
|
+
StringEnum2 as StringEnum,
|
|
271
|
+
Type,
|
|
272
|
+
abortableSleep3 as abortableSleep,
|
|
273
|
+
acquireSessionResources2 as acquireSessionResources,
|
|
274
|
+
anthropicOAuth2 as anthropicOAuth,
|
|
275
|
+
anthropicProvider2 as anthropicProvider,
|
|
276
|
+
appendAssistantMessageDiagnostic2 as appendAssistantMessageDiagnostic,
|
|
277
|
+
assistantRetryDelayMs2 as assistantRetryDelayMs,
|
|
278
|
+
baseModel2 as baseModel,
|
|
279
|
+
calculateContextTokens2 as calculateContextTokens,
|
|
280
|
+
calculateCost2 as calculateCost,
|
|
281
|
+
clampThinkingLevel2 as clampThinkingLevel,
|
|
282
|
+
classifyAssistantFailure2 as classifyAssistantFailure,
|
|
283
|
+
cleanupSessionResources2 as cleanupSessionResources,
|
|
284
|
+
collapseSystemMessages2 as collapseSystemMessages,
|
|
285
|
+
compactOpenAICodexContext2 as compactOpenAICodexContext,
|
|
286
|
+
compactOpenAIResponsesContext2 as compactOpenAIResponsesContext,
|
|
287
|
+
contentText2 as contentText,
|
|
288
|
+
createAssistantMessageDiagnostic2 as createAssistantMessageDiagnostic,
|
|
289
|
+
createAssistantMessageEventStream2 as createAssistantMessageEventStream,
|
|
290
|
+
createInitialSystemMessage2 as createInitialSystemMessage,
|
|
291
|
+
createModels2 as createModels,
|
|
292
|
+
createNyteModels2 as createNyteModels,
|
|
293
|
+
createProvider2 as createProvider,
|
|
294
|
+
createToolArgumentParser2 as createToolArgumentParser,
|
|
295
|
+
declarationsEqual2 as declarationsEqual,
|
|
296
|
+
defaultAuthPath2 as defaultAuthPath,
|
|
297
|
+
defaultModelPerProvider2 as defaultModelPerProvider,
|
|
298
|
+
defaultModelsStorePath2 as defaultModelsStorePath,
|
|
299
|
+
defaultProviderAuthContext2 as defaultProviderAuthContext,
|
|
300
|
+
envApiKeyAuth2 as envApiKeyAuth,
|
|
301
|
+
estimateContextTokens2 as estimateContextTokens,
|
|
302
|
+
estimateMessageTokens2 as estimateMessageTokens,
|
|
303
|
+
estimateTextAndImageContentTokens2 as estimateTextAndImageContentTokens,
|
|
304
|
+
estimateTextTokens2 as estimateTextTokens,
|
|
305
|
+
extractDiagnosticError2 as extractDiagnosticError,
|
|
306
|
+
failedTransiently2 as failedTransiently,
|
|
307
|
+
fastModelId2 as fastModelId,
|
|
308
|
+
fetchAnthropicAccountLimits2 as fetchAnthropicAccountLimits,
|
|
309
|
+
fetchOpenAICodexAccountLimits2 as fetchOpenAICodexAccountLimits,
|
|
310
|
+
findEnvKeys2 as findEnvKeys,
|
|
311
|
+
formatThrownValue2 as formatThrownValue,
|
|
312
|
+
generatePKCE2 as generatePKCE,
|
|
313
|
+
getAccountId2 as getAccountId,
|
|
314
|
+
getCurrentSystemMessage2 as getCurrentSystemMessage,
|
|
315
|
+
getCurrentSystemPrompt2 as getCurrentSystemPrompt,
|
|
316
|
+
getCurrentTools2 as getCurrentTools,
|
|
317
|
+
getDeclaredTools2 as getDeclaredTools,
|
|
318
|
+
getEnvApiKey2 as getEnvApiKey,
|
|
319
|
+
getFastModeCostMultiplier2 as getFastModeCostMultiplier,
|
|
320
|
+
getInitialSystemMessage2 as getInitialSystemMessage,
|
|
321
|
+
getSupportedThinkingLevels2 as getSupportedThinkingLevels,
|
|
322
|
+
getSystemMessageText2 as getSystemMessageText,
|
|
323
|
+
getToolStateChanges2 as getToolStateChanges,
|
|
324
|
+
githubCopilotOAuth2 as githubCopilotOAuth,
|
|
325
|
+
githubCopilotProvider2 as githubCopilotProvider,
|
|
326
|
+
hasApi2 as hasApi,
|
|
327
|
+
hasNonAdditiveToolChanges2 as hasNonAdditiveToolChanges,
|
|
328
|
+
hasToolRedefinitions2 as hasToolRedefinitions,
|
|
329
|
+
lazyApi2 as lazyApi,
|
|
330
|
+
lazyOAuth2 as lazyOAuth,
|
|
331
|
+
lazyStream2 as lazyStream,
|
|
332
|
+
loadAnthropicOAuth2 as loadAnthropicOAuth,
|
|
333
|
+
loadOpenAICodexOAuth2 as loadOpenAICodexOAuth,
|
|
334
|
+
modelsAreEqual2 as modelsAreEqual,
|
|
335
|
+
normalizeContext2 as normalizeContext,
|
|
336
|
+
nyteProviders2 as nyteProviders,
|
|
337
|
+
oauthErrorHtml2 as oauthErrorHtml,
|
|
338
|
+
oauthSuccessHtml2 as oauthSuccessHtml,
|
|
339
|
+
openaiCodexOAuth2 as openaiCodexOAuth,
|
|
340
|
+
openaiCodexProvider2 as openaiCodexProvider,
|
|
341
|
+
openaiProvider2 as openaiProvider,
|
|
342
|
+
opencodeGoProvider2 as opencodeGoProvider,
|
|
343
|
+
opencodeProvider2 as opencodeProvider,
|
|
344
|
+
openrouterProvider2 as openrouterProvider,
|
|
345
|
+
overflowsContext2 as overflowsContext,
|
|
346
|
+
parseStreamingJson2 as parseStreamingJson,
|
|
347
|
+
parseToolCallArguments2 as parseToolCallArguments,
|
|
348
|
+
pollOAuthDeviceCodeFlow2 as pollOAuthDeviceCodeFlow,
|
|
349
|
+
promptCacheMinimumTtlMs2 as promptCacheMinimumTtlMs,
|
|
350
|
+
providerIdentity2 as providerIdentity,
|
|
351
|
+
readCredentialAccounts2 as readCredentialAccounts,
|
|
352
|
+
registerSessionResourceCleanup2 as registerSessionResourceCleanup,
|
|
353
|
+
renderSystemMessageUpdate2 as renderSystemMessageUpdate,
|
|
354
|
+
repairJson2 as repairJson,
|
|
355
|
+
reportsQuotaExhaustion2 as reportsQuotaExhaustion,
|
|
356
|
+
resolveCacheRetention2 as resolveCacheRetention,
|
|
357
|
+
resolveProviderAuth2 as resolveProviderAuth,
|
|
358
|
+
resolveTranscript2 as resolveTranscript,
|
|
359
|
+
resolveTranscriptTools2 as resolveTranscriptTools,
|
|
360
|
+
retryAssistantCall2 as retryAssistantCall,
|
|
361
|
+
retryCanHelp2 as retryCanHelp,
|
|
362
|
+
retryDelayMs2 as retryDelayMs,
|
|
363
|
+
stoppedShort2 as stoppedShort,
|
|
364
|
+
supportsFastMode2 as supportsFastMode,
|
|
365
|
+
toToolDeclaration2 as toToolDeclaration,
|
|
366
|
+
unfinishedToolCallArguments2 as unfinishedToolCallArguments,
|
|
367
|
+
uuidv72 as uuidv7,
|
|
368
|
+
validateToolArguments2 as validateToolArguments,
|
|
369
|
+
vercelAiGatewayProvider2 as vercelAiGatewayProvider,
|
|
370
|
+
withFastVariants2 as withFastVariants,
|
|
371
|
+
withoutInitialSystemMessage2 as withoutInitialSystemMessage
|
|
372
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Api, Model, ModelThinkingLevel, Usage } from "./types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Runtime-checked narrowing for dynamically looked-up models:
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* const model = models.getModel("anthropic", "claude-opus-4-7");
|
|
7
|
+
* if (model && hasApi(model, "anthropic-messages")) {
|
|
8
|
+
* // model: Model<"anthropic-messages">, stream options fully typed
|
|
9
|
+
* }
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasApi<TApi extends Api>(model: Model<Api>, api: TApi): model is Model<TApi>;
|
|
13
|
+
/** Fills `usage.cost` from the model's rates, using the tier the input size reaches. Anthropic charges 2x base input for 1h cache writes. */
|
|
14
|
+
export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage["cost"];
|
|
15
|
+
export declare function getSupportedThinkingLevels<TApi extends Api>(model: Model<TApi>): ModelThinkingLevel[];
|
|
16
|
+
export declare function clampThinkingLevel<TApi extends Api>(model: Model<TApi>, level: ModelThinkingLevel): ModelThinkingLevel;
|
|
17
|
+
/**
|
|
18
|
+
* Check if two models are equal by comparing both their id and provider.
|
|
19
|
+
* Returns false if either model is null or undefined.
|
|
20
|
+
*/
|
|
21
|
+
export declare function modelsAreEqual<TApi extends Api>(a: Model<TApi> | null | undefined, b: Model<TApi> | null | undefined): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
hasApi2,
|
|
3
|
+
calculateCost2,
|
|
4
|
+
getSupportedThinkingLevels2,
|
|
5
|
+
clampThinkingLevel2,
|
|
6
|
+
modelsAreEqual2
|
|
7
|
+
} from "../chunks/account-limits-cache-zgzptd0z.js";
|
|
8
|
+
export {
|
|
9
|
+
calculateCost2 as calculateCost,
|
|
10
|
+
clampThinkingLevel2 as clampThinkingLevel,
|
|
11
|
+
getSupportedThinkingLevels2 as getSupportedThinkingLevels,
|
|
12
|
+
hasApi2 as hasApi,
|
|
13
|
+
modelsAreEqual2 as modelsAreEqual
|
|
14
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Api, Model, Usage } from "./types.ts";
|
|
2
|
+
import type { ResponseCreateParamsStreaming } from "openai/resources/responses/responses.js";
|
|
3
|
+
export declare const ANTHROPIC_FAST_MODE_COST_MULTIPLIER = 2;
|
|
4
|
+
export declare function applyServiceTierPricing(usage: Usage, serviceTier: ResponseCreateParamsStreaming["service_tier"] | "fast" | undefined, model: Pick<Model<Api>, "id">): void;
|
|
5
|
+
/** An unknown provider's premium must not be presented as a standard rate. */
|
|
6
|
+
export declare function getFastModeCostMultiplier(model: Model<Api>): number | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ANTHROPIC_FAST_MODE_COST_MULTIPLIER2,
|
|
3
|
+
applyServiceTierPricing2,
|
|
4
|
+
getFastModeCostMultiplier2
|
|
5
|
+
} from "../chunks/account-limits-cache-f9z00x8c.js";
|
|
6
|
+
export {
|
|
7
|
+
ANTHROPIC_FAST_MODE_COST_MULTIPLIER2 as ANTHROPIC_FAST_MODE_COST_MULTIPLIER,
|
|
8
|
+
applyServiceTierPricing2 as applyServiceTierPricing,
|
|
9
|
+
getFastModeCostMultiplier2 as getFastModeCostMultiplier
|
|
10
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Api, Model } from "./types.ts";
|
|
2
|
+
export declare const FAST_MODEL_SUFFIX = "-fast";
|
|
3
|
+
export declare function fastModelId(base: string): string;
|
|
4
|
+
/** Advertises fast mode on an API whose premium is known. */
|
|
5
|
+
export declare function supportsFastMode(model: Model<Api>): boolean;
|
|
6
|
+
/** The catalog with a fast sibling after each eligible model; a real `<id>-fast` keeps its place. */
|
|
7
|
+
export declare function withFastVariants(models: readonly Model<Api>[]): readonly Model<Api>[];
|
|
8
|
+
/** The model a variant stands for; a base model is its own. */
|
|
9
|
+
export declare function baseModel<M extends Model<Api>>(model: M): M;
|
|
10
|
+
/** What the provider calls this model: the identity its answers, checkpoints and history carry. */
|
|
11
|
+
export declare function providerIdentity(model: Pick<Model<Api>, "provider" | "api" | "id" | "variant">): {
|
|
12
|
+
readonly provider: Model<Api>["provider"];
|
|
13
|
+
readonly api: Api;
|
|
14
|
+
readonly model: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function providerRequest<M extends Model<Api>, O extends {
|
|
17
|
+
fast?: boolean;
|
|
18
|
+
} | undefined>(model: M, options: O): {
|
|
19
|
+
readonly model: M;
|
|
20
|
+
readonly options: O;
|
|
21
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FAST_MODEL_SUFFIX2,
|
|
3
|
+
fastModelId2,
|
|
4
|
+
supportsFastMode2,
|
|
5
|
+
withFastVariants2,
|
|
6
|
+
baseModel2,
|
|
7
|
+
providerIdentity2,
|
|
8
|
+
providerRequest2
|
|
9
|
+
} from "../chunks/account-limits-cache-031vfpt3.js";
|
|
10
|
+
import"../chunks/account-limits-cache-f9z00x8c.js";
|
|
11
|
+
export {
|
|
12
|
+
FAST_MODEL_SUFFIX2 as FAST_MODEL_SUFFIX,
|
|
13
|
+
baseModel2 as baseModel,
|
|
14
|
+
fastModelId2 as fastModelId,
|
|
15
|
+
providerIdentity2 as providerIdentity,
|
|
16
|
+
providerRequest2 as providerRequest,
|
|
17
|
+
supportsFastMode2 as supportsFastMode,
|
|
18
|
+
withFastVariants2 as withFastVariants
|
|
19
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Credential, CredentialAccounts } from "./auth/types.ts";
|
|
2
|
+
import type { ModelsStore } from "./models-store.ts";
|
|
3
|
+
import type { Provider, RefreshModelsContext } from "./models-types.ts";
|
|
4
|
+
export declare class CatalogRefreshes {
|
|
5
|
+
private generations;
|
|
6
|
+
private controllers;
|
|
7
|
+
/** Settles once the running refresh for a provider has restored its cached catalog. */
|
|
8
|
+
private restorations;
|
|
9
|
+
private readonly publications;
|
|
10
|
+
private readonly modelsStore;
|
|
11
|
+
private readonly catalog;
|
|
12
|
+
constructor(modelsStore: ModelsStore, catalog: RefreshModelsContext["catalog"]);
|
|
13
|
+
/** Cancels the provider's running refresh, so a replaced or removed provider never publishes. */
|
|
14
|
+
supersede(providerId: string): number;
|
|
15
|
+
/** Providers with a refresh in flight. */
|
|
16
|
+
running(): Iterable<string>;
|
|
17
|
+
private publish;
|
|
18
|
+
private runPhase;
|
|
19
|
+
/**
|
|
20
|
+
* Refreshes one provider and returns its failure, if any; a superseded or cancelled run fails
|
|
21
|
+
* silently. The cached catalog is restored from the stored active account's credential first.
|
|
22
|
+
* An offline refresh only restores the cache, which a running refresh restores first, so it
|
|
23
|
+
* waits for that one instead of superseding it: superseding would cancel its network phase,
|
|
24
|
+
* and nothing would retry that until the next launch.
|
|
25
|
+
*/
|
|
26
|
+
run(provider: Provider, allowNetwork: boolean, force: boolean | undefined, callerSignal: AbortSignal, readAccounts: (signal: AbortSignal) => Promise<CredentialAccounts | undefined>, resolveCredential: (accounts: CredentialAccounts | undefined, signal: AbortSignal) => Promise<Credential | undefined>): Promise<Error | undefined>;
|
|
27
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CatalogRefreshes2
|
|
3
|
+
} from "../chunks/account-limits-cache-zpjmeyt0.js";
|
|
4
|
+
import"../chunks/account-limits-cache-7z9s8j16.js";
|
|
5
|
+
import"../chunks/account-limits-cache-9wqk28n5.js";
|
|
6
|
+
import"../chunks/account-limits-cache-j2bt392s.js";
|
|
7
|
+
export {
|
|
8
|
+
CatalogRefreshes2 as CatalogRefreshes
|
|
9
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ModelsStoreEntry {
|
|
2
|
+
/**
|
|
3
|
+
* Hosted catalog response as received. Each client validates and filters on
|
|
4
|
+
* read, so a client whose schema rejects a model never persists the loss.
|
|
5
|
+
*/
|
|
6
|
+
models: readonly unknown[];
|
|
7
|
+
/** Unix timestamp from the remote catalog's Last-Modified header. */
|
|
8
|
+
lastModified?: number;
|
|
9
|
+
/** Unix timestamp of the last completed remote check. */
|
|
10
|
+
checkedAt?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Opaque validator from the remote catalog's ETag header, stored verbatim
|
|
13
|
+
* (quotes included) and echoed back as If-None-Match.
|
|
14
|
+
*/
|
|
15
|
+
etag?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ModelsStoreOperationOptions {
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/** Persistent model catalogs keyed by provider ID. */
|
|
21
|
+
export interface ModelsStore {
|
|
22
|
+
read(providerId: string, options?: ModelsStoreOperationOptions): Promise<ModelsStoreEntry | undefined>;
|
|
23
|
+
write(providerId: string, entry: ModelsStoreEntry, options?: ModelsStoreOperationOptions): Promise<void>;
|
|
24
|
+
delete(providerId: string, options?: ModelsStoreOperationOptions): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export declare class InMemoryModelsStore implements ModelsStore {
|
|
27
|
+
private readonly entries;
|
|
28
|
+
read(providerId: string, options?: ModelsStoreOperationOptions): Promise<ModelsStoreEntry | undefined>;
|
|
29
|
+
write(providerId: string, entry: ModelsStoreEntry, options?: ModelsStoreOperationOptions): Promise<void>;
|
|
30
|
+
delete(providerId: string, options?: ModelsStoreOperationOptions): Promise<void>;
|
|
31
|
+
}
|