@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,101 @@
|
|
|
1
|
+
import { Type, type Static } from "typebox";
|
|
2
|
+
export declare const AnthropicEventSchema: Type.TUnion<[Type.TObject<{
|
|
3
|
+
type: Type.TLiteral<"message_start">;
|
|
4
|
+
message: Type.TObject<{
|
|
5
|
+
id: Type.TString;
|
|
6
|
+
model: Type.TString;
|
|
7
|
+
usage: Type.TObject<{
|
|
8
|
+
input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
9
|
+
output_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
10
|
+
cache_read_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
11
|
+
cache_creation_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
12
|
+
cache_creation: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
13
|
+
ephemeral_1h_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
14
|
+
}>, Type.TNull]>>;
|
|
15
|
+
output_tokens_details: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
16
|
+
thinking_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
17
|
+
}>, Type.TNull]>>;
|
|
18
|
+
speed: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
}>, Type.TObject<{
|
|
22
|
+
type: Type.TLiteral<"message_delta">;
|
|
23
|
+
delta: Type.TObject<{
|
|
24
|
+
stop_reason: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
25
|
+
stop_details: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
26
|
+
explanation: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
27
|
+
}>, Type.TNull]>>;
|
|
28
|
+
}>;
|
|
29
|
+
usage: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
30
|
+
input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
31
|
+
output_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
32
|
+
cache_read_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
33
|
+
cache_creation_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
34
|
+
cache_creation: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
35
|
+
ephemeral_1h_input_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
36
|
+
}>, Type.TNull]>>;
|
|
37
|
+
output_tokens_details: Type.TOptional<Type.TUnion<[Type.TObject<{
|
|
38
|
+
thinking_tokens: Type.TOptional<Type.TUnion<[Type.TInteger, Type.TNull]>>;
|
|
39
|
+
}>, Type.TNull]>>;
|
|
40
|
+
speed: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
41
|
+
}>, Type.TNull]>>;
|
|
42
|
+
}>, Type.TObject<{
|
|
43
|
+
type: Type.TLiteral<"message_stop">;
|
|
44
|
+
}>, Type.TObject<{
|
|
45
|
+
type: Type.TLiteral<"content_block_start">;
|
|
46
|
+
index: Type.TInteger;
|
|
47
|
+
content_block: Type.TUnion<[Type.TObject<{
|
|
48
|
+
type: Type.TLiteral<"text">;
|
|
49
|
+
text: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
50
|
+
}>, Type.TObject<{
|
|
51
|
+
type: Type.TLiteral<"thinking">;
|
|
52
|
+
thinking: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
53
|
+
signature: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
54
|
+
}>, Type.TObject<{
|
|
55
|
+
type: Type.TLiteral<"redacted_thinking">;
|
|
56
|
+
data: Type.TString;
|
|
57
|
+
}>, Type.TObject<{
|
|
58
|
+
type: Type.TLiteral<"tool_use">;
|
|
59
|
+
id: Type.TString;
|
|
60
|
+
name: Type.TString;
|
|
61
|
+
input: Type.TOptional<Type.TUnion<[Type.TRecord<"^.*$", Type.TUnknown>, Type.TNull]>>;
|
|
62
|
+
}>]>;
|
|
63
|
+
}>, Type.TObject<{
|
|
64
|
+
type: Type.TLiteral<"content_block_delta">;
|
|
65
|
+
index: Type.TInteger;
|
|
66
|
+
delta: Type.TUnion<[Type.TObject<{
|
|
67
|
+
type: Type.TLiteral<"text_delta">;
|
|
68
|
+
text: Type.TString;
|
|
69
|
+
}>, Type.TObject<{
|
|
70
|
+
type: Type.TLiteral<"thinking_delta">;
|
|
71
|
+
thinking: Type.TString;
|
|
72
|
+
}>, Type.TObject<{
|
|
73
|
+
type: Type.TLiteral<"input_json_delta">;
|
|
74
|
+
partial_json: Type.TString;
|
|
75
|
+
}>, Type.TObject<{
|
|
76
|
+
type: Type.TLiteral<"signature_delta">;
|
|
77
|
+
signature: Type.TString;
|
|
78
|
+
}>]>;
|
|
79
|
+
}>, Type.TObject<{
|
|
80
|
+
type: Type.TLiteral<"content_block_stop">;
|
|
81
|
+
index: Type.TInteger;
|
|
82
|
+
}>]>;
|
|
83
|
+
export type AnthropicEvent = Static<typeof AnthropicEventSchema>;
|
|
84
|
+
export declare const AnthropicEventTypeSchema: Type.TUnion<[Type.TLiteral<"message_start">, Type.TLiteral<"message_delta">, Type.TLiteral<"message_stop">, Type.TLiteral<"content_block_start">, Type.TLiteral<"content_block_delta">, Type.TLiteral<"content_block_stop">]>;
|
|
85
|
+
/**
|
|
86
|
+
* Unknown block variants are forward-compatible. Malformed *known* variants must
|
|
87
|
+
* not fall through this alternative, so its exclusions derive from the schemas above.
|
|
88
|
+
*/
|
|
89
|
+
export declare const IgnoredAnthropicEventSchema: Type.TUnion<[Type.TObject<{
|
|
90
|
+
type: Type.TLiteral<"content_block_start">;
|
|
91
|
+
index: Type.TInteger;
|
|
92
|
+
content_block: Type.TObject<{
|
|
93
|
+
type: Type.TString;
|
|
94
|
+
}>;
|
|
95
|
+
}>, Type.TObject<{
|
|
96
|
+
type: Type.TLiteral<"content_block_delta">;
|
|
97
|
+
index: Type.TInteger;
|
|
98
|
+
delta: Type.TObject<{
|
|
99
|
+
type: Type.TString;
|
|
100
|
+
}>;
|
|
101
|
+
}>]>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AnthropicEventSchema2,
|
|
3
|
+
AnthropicEventTypeSchema2,
|
|
4
|
+
IgnoredAnthropicEventSchema2
|
|
5
|
+
} from "../../chunks/account-limits-cache-3ykqmnj5.js";
|
|
6
|
+
import"../../chunks/account-limits-cache-736tdyme.js";
|
|
7
|
+
export {
|
|
8
|
+
AnthropicEventSchema2 as AnthropicEventSchema,
|
|
9
|
+
AnthropicEventTypeSchema2 as AnthropicEventTypeSchema,
|
|
10
|
+
IgnoredAnthropicEventSchema2 as IgnoredAnthropicEventSchema
|
|
11
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Anthropic Messages adapter: request parameters, the event stream, and
|
|
3
|
+
* the simple reasoning mapping.
|
|
4
|
+
*/
|
|
5
|
+
import Anthropic from "@anthropic-ai/sdk";
|
|
6
|
+
import type { MessageCreateParamsStreaming } from "@anthropic-ai/sdk/resources/beta/messages/messages.js";
|
|
7
|
+
import type { SimpleStreamOptions, StreamFunction, StreamOptions } from "../types.ts";
|
|
8
|
+
declare const ANTHROPIC_EFFORTS: readonly ["low", "medium", "high", "xhigh", "max"];
|
|
9
|
+
export type AnthropicEffort = (typeof ANTHROPIC_EFFORTS)[number];
|
|
10
|
+
export type AnthropicThinkingDisplay = "summarized" | "omitted";
|
|
11
|
+
export interface AnthropicOptions extends StreamOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Anthropic inference speed. Fast mode is available only for first-party
|
|
14
|
+
* Claude Opus 5 and Claude Opus 4.8 requests.
|
|
15
|
+
*/
|
|
16
|
+
speed?: NonNullable<MessageCreateParamsStreaming["speed"]>;
|
|
17
|
+
/**
|
|
18
|
+
* Enable extended thinking.
|
|
19
|
+
* For adaptive thinking models: the model decides when/how much to think.
|
|
20
|
+
* For older models: uses budget-based thinking with thinkingBudgetTokens.
|
|
21
|
+
* Default: undefined (thinking is omitted unless `streamSimple()` maps
|
|
22
|
+
* a simple reasoning level to this option, or callers set it explicitly).
|
|
23
|
+
*/
|
|
24
|
+
thinkingEnabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Token budget for extended thinking (older models only).
|
|
27
|
+
* Ignored for adaptive thinking models.
|
|
28
|
+
* Default: 1024 when `thinkingEnabled` is true and no budget is provided.
|
|
29
|
+
*/
|
|
30
|
+
thinkingBudgetTokens?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Effort level for adaptive thinking models.
|
|
33
|
+
* Controls how much thinking Claude allocates:
|
|
34
|
+
* - "max": Always thinks with no constraints (Opus 4.6 only)
|
|
35
|
+
* - "xhigh": Highest reasoning level (Opus 4.7+, Fable 5)
|
|
36
|
+
* - "high": Always thinks, deep reasoning
|
|
37
|
+
* - "medium": Moderate thinking, may skip for simple queries
|
|
38
|
+
* - "low": Minimal thinking, skips for simple tasks
|
|
39
|
+
* Ignored for older models.
|
|
40
|
+
* Default: omitted unless `streamSimple()` maps a simple reasoning
|
|
41
|
+
* level to this option.
|
|
42
|
+
*/
|
|
43
|
+
effort?: AnthropicEffort;
|
|
44
|
+
/**
|
|
45
|
+
* Controls how thinking content is returned in API responses.
|
|
46
|
+
* - "summarized": Thinking blocks contain summarized thinking text.
|
|
47
|
+
* - "omitted": Thinking blocks return an empty thinking field; the encrypted
|
|
48
|
+
* signature still travels back for multi-turn continuity. Use for faster
|
|
49
|
+
* time-to-first-text-token when your UI does not surface thinking.
|
|
50
|
+
*
|
|
51
|
+
* Note: Anthropic's API default for Claude Opus 4.7 and Claude Mythos Preview
|
|
52
|
+
* is "omitted". We default to "summarized" here to keep behavior consistent
|
|
53
|
+
* with older Claude 4 models. Set this explicitly to "omitted" to opt in.
|
|
54
|
+
* Default: "summarized" when thinking is enabled.
|
|
55
|
+
*/
|
|
56
|
+
thinkingDisplay?: AnthropicThinkingDisplay;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to request the interleaved thinking beta header for non-adaptive
|
|
59
|
+
* thinking models. Adaptive thinking models have interleaved thinking built in,
|
|
60
|
+
* so the header is skipped for them regardless of this setting.
|
|
61
|
+
* Default: true.
|
|
62
|
+
*/
|
|
63
|
+
interleavedThinking?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Anthropic tool choice behavior. String values map to Anthropic's built-in
|
|
66
|
+
* choices; `{ type: "tool", name }` forces a specific tool.
|
|
67
|
+
* Default: omitted (Anthropic default behavior, currently equivalent to auto).
|
|
68
|
+
*/
|
|
69
|
+
toolChoice?: "auto" | "any" | "none" | {
|
|
70
|
+
type: "tool";
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Pre-built Anthropic client instance. When provided, skips internal client
|
|
75
|
+
* construction entirely. Use this to inject alternative SDK clients such as
|
|
76
|
+
* `AnthropicVertex` that shares the same messaging API.
|
|
77
|
+
*/
|
|
78
|
+
client?: Anthropic;
|
|
79
|
+
}
|
|
80
|
+
export declare const stream: StreamFunction<"anthropic-messages", AnthropicOptions>;
|
|
81
|
+
/**
|
|
82
|
+
* Maps a simple reasoning level onto Anthropic thinking. Adaptive models take an effort;
|
|
83
|
+
* budget models clamp the level to what the model supports before choosing a thinking-token
|
|
84
|
+
* budget. An undefined `maxTokens` means the caller set no output cap, so the model cap is
|
|
85
|
+
* used; it is never coerced to 0, which would make the thinking budget the whole `max_tokens`.
|
|
86
|
+
*/
|
|
87
|
+
export declare const streamSimple: StreamFunction<"anthropic-messages", SimpleStreamOptions>;
|
|
88
|
+
export {};
|