feat(ai): move API implementations to src/api with lazy wrappers (phase 2)

Stream implementations move from src/providers/ to src/api/, renamed by
API id (anthropic.ts -> anthropic-messages.ts, google.ts ->
google-generative-ai.ts, mistral.ts -> mistral-conversations.ts,
amazon-bedrock.ts -> bedrock-converse-stream.ts). Every module now
exports exactly stream/streamSimple; shared helpers move alongside.

New ProviderStreams dispatch contract in types.ts, lazyApi() wrapper in
api/lazy.ts, and one .lazy.ts wrapper per API. Bedrock's wrapper keeps
the node-only variable-specifier import and setBedrockProviderModule()
(now taking ProviderStreams).

providers/register-builtins.ts deleted; interim until the compat
entrypoint lands, builtin api-registry registration lives in stream.ts
and lazy wrappers are exported from the root barrel. Old per-API lazy
exports (streamAnthropic, ...) are gone; package.json subpaths retarget
to dist/api/.
This commit is contained in:
Mario Zechner
2026-06-10 20:08:59 +02:00
parent ee276e4db5
commit ba93da9a93
66 changed files with 283 additions and 560 deletions
+16 -16
View File
@@ -11,36 +11,36 @@
"import": "./dist/index.js"
},
"./anthropic": {
"types": "./dist/providers/anthropic.d.ts",
"import": "./dist/providers/anthropic.js"
"types": "./dist/api/anthropic-messages.d.ts",
"import": "./dist/api/anthropic-messages.js"
},
"./azure-openai-responses": {
"types": "./dist/providers/azure-openai-responses.d.ts",
"import": "./dist/providers/azure-openai-responses.js"
"types": "./dist/api/azure-openai-responses.d.ts",
"import": "./dist/api/azure-openai-responses.js"
},
"./google": {
"types": "./dist/providers/google.d.ts",
"import": "./dist/providers/google.js"
"types": "./dist/api/google-generative-ai.d.ts",
"import": "./dist/api/google-generative-ai.js"
},
"./google-vertex": {
"types": "./dist/providers/google-vertex.d.ts",
"import": "./dist/providers/google-vertex.js"
"types": "./dist/api/google-vertex.d.ts",
"import": "./dist/api/google-vertex.js"
},
"./mistral": {
"types": "./dist/providers/mistral.d.ts",
"import": "./dist/providers/mistral.js"
"types": "./dist/api/mistral-conversations.d.ts",
"import": "./dist/api/mistral-conversations.js"
},
"./openai-codex-responses": {
"types": "./dist/providers/openai-codex-responses.d.ts",
"import": "./dist/providers/openai-codex-responses.js"
"types": "./dist/api/openai-codex-responses.d.ts",
"import": "./dist/api/openai-codex-responses.js"
},
"./openai-completions": {
"types": "./dist/providers/openai-completions.d.ts",
"import": "./dist/providers/openai-completions.js"
"types": "./dist/api/openai-completions.d.ts",
"import": "./dist/api/openai-completions.js"
},
"./openai-responses": {
"types": "./dist/providers/openai-responses.d.ts",
"import": "./dist/providers/openai-responses.js"
"types": "./dist/api/openai-responses.d.ts",
"import": "./dist/api/openai-responses.js"
},
"./oauth": {
"types": "./dist/oauth.d.ts",