@chat-js/registry 0.2.0-beta.6 → 0.2.0-beta.8
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 +1 -1
- package/dist/r/attach-workspace-file.json +1 -1
- package/dist/r/base/attach-workspace-file.json +1 -1
- package/dist/r/base/deep-research.json +0 -4
- package/dist/r/base/guest-chat.json +2 -2
- package/dist/r/base/litellm-gateway.json +1 -2
- package/dist/r/base/mcp.json +1 -1
- package/dist/r/base/model-preferences.json +1 -1
- package/dist/r/base/openai-compatible-gateway.json +1 -2
- package/dist/r/base/openai-gateway.json +1 -2
- package/dist/r/base/openrouter-gateway.json +1 -2
- package/dist/r/base/registry.json +3 -10
- package/dist/r/base/vercel-gateway.json +4 -3
- package/dist/r/deep-research.json +0 -4
- package/dist/r/guest-chat.json +2 -2
- package/dist/r/litellm-gateway.json +1 -2
- package/dist/r/mcp.json +1 -1
- package/dist/r/model-preferences.json +1 -1
- package/dist/r/openai-compatible-gateway.json +1 -2
- package/dist/r/openai-gateway.json +1 -2
- package/dist/r/openrouter-gateway.json +1 -2
- package/dist/r/radix/attach-workspace-file.json +1 -1
- package/dist/r/radix/deep-research.json +0 -4
- package/dist/r/radix/guest-chat.json +2 -2
- package/dist/r/radix/litellm-gateway.json +1 -2
- package/dist/r/radix/mcp.json +1 -1
- package/dist/r/radix/model-preferences.json +1 -1
- package/dist/r/radix/openai-compatible-gateway.json +1 -2
- package/dist/r/radix/openai-gateway.json +1 -2
- package/dist/r/radix/openrouter-gateway.json +1 -2
- package/dist/r/radix/registry.json +3 -10
- package/dist/r/radix/vercel-gateway.json +4 -3
- package/dist/r/registry.json +3 -10
- package/dist/r/vercel-gateway.json +4 -3
- package/package.json +2 -3
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"name": "vercel-gateway",
|
|
4
4
|
"title": "Vercel AI Gateway",
|
|
5
5
|
"dependencies": [
|
|
6
|
-
"@
|
|
7
|
-
"@
|
|
6
|
+
"@ai-sdk/gateway@4.0.145",
|
|
7
|
+
"@vercel/oidc@3.2.0",
|
|
8
|
+
"zod@4.5.4"
|
|
8
9
|
],
|
|
9
10
|
"files": [
|
|
10
11
|
{
|
|
11
12
|
"path": "src/gateways/vercel/gateway.ts",
|
|
12
|
-
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n
|
|
13
|
+
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n aiGatewayModelSchema,\n isAiGatewayModelType,\n} from \"@/chatjs/core/gateway/models\";\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\nimport type { ImageModel } from \"ai\";\n\nimport { createGateway } from \"@ai-sdk/gateway\";\nimport type { gateway } from \"@ai-sdk/gateway\";\nimport { getVercelOidcToken } from \"@vercel/oidc\";\nimport { z } from \"zod\";\n\nconst MODEL_ID_PARAMETER_INDEX = 0;\ntype VercelImageModelId = Parameters<\n (typeof gateway)[\"imageModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\ntype VercelVideoModelId = Parameters<\n (typeof gateway)[\"videoModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\n\nconst EMPTY_MODEL_TYPE_COUNT = 0;\nconst modelDiscriminatorSchema = z.object({ type: z.string() });\nconst modelsEnvelopeSchema = z.object({\n data: z.array(z.unknown()),\n object: z.literal(\"list\"),\n});\nconst modelAvailability = z.object({\n model_eligibility: z\n .object({\n status: z.string(),\n category: z.string().optional(),\n })\n .optional(),\n});\n\nclass VercelGateway\n extends GatewayRuntime\n implements GatewayProvider<\"vercel\">\n{\n public readonly type = \"vercel\" as const;\n\n public createLanguageModel(\n modelId: Parameters<\n (typeof gateway)[\"languageModel\"]\n >[typeof MODEL_ID_PARAMETER_INDEX]\n ): LanguageModelV4 {\n return this.getProvider()(modelId);\n }\n\n public createImageModel(modelId: VercelImageModelId): ImageModel {\n return this.getProvider().imageModel(modelId);\n }\n\n public createVideoModel(\n modelId: VercelVideoModelId\n ): Experimental_VideoModelV4 {\n return this.getProvider().videoModel(modelId);\n }\n\n private provider?: ReturnType<typeof createGateway>;\n\n private getProvider(): ReturnType<typeof createGateway> {\n this.provider ??= createGateway({ apiKey: this.env.AI_GATEWAY_API_KEY });\n return this.provider;\n }\n\n private async getApiKey(): Promise<string | null> {\n const apiKey = this.env.AI_GATEWAY_API_KEY;\n\n if (typeof apiKey === \"string\" && apiKey !== \"\") {\n return apiKey;\n }\n const oidcToken = this.env.VERCEL_OIDC_TOKEN;\n if (typeof oidcToken === \"string\" && oidcToken !== \"\") {\n return oidcToken;\n }\n return await getVercelOidcToken().catch(() => null);\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = await this.getApiKey();\n const catalogUrl = \"https://ai-gateway.vercel.sh/v1/models\";\n const url =\n apiKey === null ? catalogUrl : `${catalogUrl}?include_availability`;\n this.log.debug({ url }, \"Fetching models from Vercel AI Gateway\");\n\n try {\n const response = await this.fetch(\n url,\n apiKey === null\n ? undefined\n : { headers: { Authorization: `Bearer ${apiKey}` } }\n );\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"Vercel AI Gateway returned non-OK response\"\n );\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const bodyRaw: unknown = await response.json();\n const body = modelsEnvelopeSchema.parse(bodyRaw);\n const unsupportedTypes = new Set<string>();\n const models: AiGatewayModel[] = [];\n\n for (const candidate of body.data) {\n const { type } = modelDiscriminatorSchema.parse(candidate);\n if (isAiGatewayModelType(type)) {\n const availability = modelAvailability.safeParse(candidate);\n const eligibility = availability.data?.model_eligibility;\n if (\n eligibility?.status === \"ineligible\" &&\n (eligibility.category === \"policy\" ||\n eligibility.category === \"configuration\")\n ) {\n continue;\n }\n models.push(aiGatewayModelSchema.parse(candidate));\n } else {\n unsupportedTypes.add(type);\n }\n }\n\n if (unsupportedTypes.size > EMPTY_MODEL_TYPE_COUNT) {\n this.log.warn(\n {\n modelCount: body.data.length,\n skippedModelCount: body.data.length - models.length,\n unsupportedTypes: [...unsupportedTypes],\n },\n \"Skipping models with unsupported types from Vercel AI Gateway\"\n );\n }\n\n this.log.info(\n { modelCount: models.length },\n \"Successfully fetched models from Vercel AI Gateway\"\n );\n return models;\n } catch (error) {\n this.log.error(\n { err: error, url },\n \"Error fetching models from Vercel AI Gateway, falling back to generated models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n }\n}\nexport { VercelGateway as Gateway, VercelGateway };\n",
|
|
13
14
|
"type": "registry:file",
|
|
14
15
|
"target": "~/chatjs/providers/gateway.ts"
|
|
15
16
|
}
|
package/dist/r/registry.json
CHANGED
|
@@ -1898,8 +1898,9 @@
|
|
|
1898
1898
|
"name": "vercel-gateway",
|
|
1899
1899
|
"title": "Vercel AI Gateway",
|
|
1900
1900
|
"dependencies": [
|
|
1901
|
-
"@
|
|
1902
|
-
"@
|
|
1901
|
+
"@ai-sdk/gateway@4.0.145",
|
|
1902
|
+
"@vercel/oidc@3.2.0",
|
|
1903
|
+
"zod@4.5.4"
|
|
1903
1904
|
],
|
|
1904
1905
|
"files": [
|
|
1905
1906
|
{
|
|
@@ -1970,7 +1971,6 @@
|
|
|
1970
1971
|
"name": "openai-gateway",
|
|
1971
1972
|
"title": "OpenAI",
|
|
1972
1973
|
"dependencies": [
|
|
1973
|
-
"@chat-js/gateways@0.2.2",
|
|
1974
1974
|
"@ai-sdk/openai@4.0.117",
|
|
1975
1975
|
"zod@4.5.4"
|
|
1976
1976
|
],
|
|
@@ -2033,7 +2033,6 @@
|
|
|
2033
2033
|
"name": "openai-compatible-gateway",
|
|
2034
2034
|
"title": "OpenAI Compatible",
|
|
2035
2035
|
"dependencies": [
|
|
2036
|
-
"@chat-js/gateways@0.2.2",
|
|
2037
2036
|
"@ai-sdk/openai-compatible@3.0.92",
|
|
2038
2037
|
"zod@4.5.4"
|
|
2039
2038
|
],
|
|
@@ -2098,7 +2097,6 @@
|
|
|
2098
2097
|
"name": "openrouter-gateway",
|
|
2099
2098
|
"title": "OpenRouter",
|
|
2100
2099
|
"dependencies": [
|
|
2101
|
-
"@chat-js/gateways@0.2.2",
|
|
2102
2100
|
"@openrouter/ai-sdk-provider@3.0.0",
|
|
2103
2101
|
"zod@4.5.4"
|
|
2104
2102
|
],
|
|
@@ -2168,7 +2166,6 @@
|
|
|
2168
2166
|
"name": "litellm-gateway",
|
|
2169
2167
|
"title": "LiteLLM",
|
|
2170
2168
|
"dependencies": [
|
|
2171
|
-
"@chat-js/gateways@0.2.2",
|
|
2172
2169
|
"@ai-sdk/openai-compatible@3.0.92"
|
|
2173
2170
|
],
|
|
2174
2171
|
"files": [
|
|
@@ -2633,10 +2630,6 @@
|
|
|
2633
2630
|
"dependencies": [
|
|
2634
2631
|
"lucide-react@0.553.0"
|
|
2635
2632
|
],
|
|
2636
|
-
"registryDependencies": [
|
|
2637
|
-
"trace",
|
|
2638
|
-
"badge"
|
|
2639
|
-
],
|
|
2640
2633
|
"files": [
|
|
2641
2634
|
{
|
|
2642
2635
|
"path": "src/tools/deep-research/renderer.tsx",
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
"name": "vercel-gateway",
|
|
4
4
|
"title": "Vercel AI Gateway",
|
|
5
5
|
"dependencies": [
|
|
6
|
-
"@
|
|
7
|
-
"@
|
|
6
|
+
"@ai-sdk/gateway@4.0.145",
|
|
7
|
+
"@vercel/oidc@3.2.0",
|
|
8
|
+
"zod@4.5.4"
|
|
8
9
|
],
|
|
9
10
|
"files": [
|
|
10
11
|
{
|
|
11
12
|
"path": "src/gateways/vercel/gateway.ts",
|
|
12
|
-
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n
|
|
13
|
+
"content": "import type {\n Experimental_VideoModelV4,\n LanguageModelV4,\n} from \"@ai-sdk/provider\";\nimport {\n aiGatewayModelSchema,\n isAiGatewayModelType,\n} from \"@/chatjs/core/gateway/models\";\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\nimport type { ImageModel } from \"ai\";\n\nimport { createGateway } from \"@ai-sdk/gateway\";\nimport type { gateway } from \"@ai-sdk/gateway\";\nimport { getVercelOidcToken } from \"@vercel/oidc\";\nimport { z } from \"zod\";\n\nconst MODEL_ID_PARAMETER_INDEX = 0;\ntype VercelImageModelId = Parameters<\n (typeof gateway)[\"imageModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\ntype VercelVideoModelId = Parameters<\n (typeof gateway)[\"videoModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\n\nconst EMPTY_MODEL_TYPE_COUNT = 0;\nconst modelDiscriminatorSchema = z.object({ type: z.string() });\nconst modelsEnvelopeSchema = z.object({\n data: z.array(z.unknown()),\n object: z.literal(\"list\"),\n});\nconst modelAvailability = z.object({\n model_eligibility: z\n .object({\n status: z.string(),\n category: z.string().optional(),\n })\n .optional(),\n});\n\nclass VercelGateway\n extends GatewayRuntime\n implements GatewayProvider<\"vercel\">\n{\n public readonly type = \"vercel\" as const;\n\n public createLanguageModel(\n modelId: Parameters<\n (typeof gateway)[\"languageModel\"]\n >[typeof MODEL_ID_PARAMETER_INDEX]\n ): LanguageModelV4 {\n return this.getProvider()(modelId);\n }\n\n public createImageModel(modelId: VercelImageModelId): ImageModel {\n return this.getProvider().imageModel(modelId);\n }\n\n public createVideoModel(\n modelId: VercelVideoModelId\n ): Experimental_VideoModelV4 {\n return this.getProvider().videoModel(modelId);\n }\n\n private provider?: ReturnType<typeof createGateway>;\n\n private getProvider(): ReturnType<typeof createGateway> {\n this.provider ??= createGateway({ apiKey: this.env.AI_GATEWAY_API_KEY });\n return this.provider;\n }\n\n private async getApiKey(): Promise<string | null> {\n const apiKey = this.env.AI_GATEWAY_API_KEY;\n\n if (typeof apiKey === \"string\" && apiKey !== \"\") {\n return apiKey;\n }\n const oidcToken = this.env.VERCEL_OIDC_TOKEN;\n if (typeof oidcToken === \"string\" && oidcToken !== \"\") {\n return oidcToken;\n }\n return await getVercelOidcToken().catch(() => null);\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = await this.getApiKey();\n const catalogUrl = \"https://ai-gateway.vercel.sh/v1/models\";\n const url =\n apiKey === null ? catalogUrl : `${catalogUrl}?include_availability`;\n this.log.debug({ url }, \"Fetching models from Vercel AI Gateway\");\n\n try {\n const response = await this.fetch(\n url,\n apiKey === null\n ? undefined\n : { headers: { Authorization: `Bearer ${apiKey}` } }\n );\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"Vercel AI Gateway returned non-OK response\"\n );\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const bodyRaw: unknown = await response.json();\n const body = modelsEnvelopeSchema.parse(bodyRaw);\n const unsupportedTypes = new Set<string>();\n const models: AiGatewayModel[] = [];\n\n for (const candidate of body.data) {\n const { type } = modelDiscriminatorSchema.parse(candidate);\n if (isAiGatewayModelType(type)) {\n const availability = modelAvailability.safeParse(candidate);\n const eligibility = availability.data?.model_eligibility;\n if (\n eligibility?.status === \"ineligible\" &&\n (eligibility.category === \"policy\" ||\n eligibility.category === \"configuration\")\n ) {\n continue;\n }\n models.push(aiGatewayModelSchema.parse(candidate));\n } else {\n unsupportedTypes.add(type);\n }\n }\n\n if (unsupportedTypes.size > EMPTY_MODEL_TYPE_COUNT) {\n this.log.warn(\n {\n modelCount: body.data.length,\n skippedModelCount: body.data.length - models.length,\n unsupportedTypes: [...unsupportedTypes],\n },\n \"Skipping models with unsupported types from Vercel AI Gateway\"\n );\n }\n\n this.log.info(\n { modelCount: models.length },\n \"Successfully fetched models from Vercel AI Gateway\"\n );\n return models;\n } catch (error) {\n this.log.error(\n { err: error, url },\n \"Error fetching models from Vercel AI Gateway, falling back to generated models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n }\n}\nexport { VercelGateway as Gateway, VercelGateway };\n",
|
|
13
14
|
"type": "registry:file",
|
|
14
15
|
"target": "~/chatjs/providers/gateway.ts"
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chat-js/registry",
|
|
3
|
-
"version": "0.2.0-beta.
|
|
3
|
+
"version": "0.2.0-beta.8",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ChatJS tool and gateway registry items",
|
|
6
6
|
"keywords": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:types": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
|
|
37
37
|
"test:unit": "bun test src",
|
|
38
38
|
"test:native": "bun run build && bun test --timeout 180000 test/native-eve.test.ts",
|
|
39
|
-
"test:installation": "bunx turbo run build --filter=@chat-js/
|
|
39
|
+
"test:installation": "bunx turbo run build --filter=@chat-js/thread && bun run --cwd ../cli template:sync && bun test --timeout 60000 test/installation-validation.test.ts",
|
|
40
40
|
"profile:validation": "bun scripts/validation-profile.ts",
|
|
41
41
|
"test:visual": "vitest run --config visual/vitest.config.ts",
|
|
42
42
|
"check": "bun run test:types && bun run test:unit && bun run test:visual",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"@ai-sdk/openai-compatible": "3.0.92",
|
|
55
55
|
"@ai-sdk/provider": "4.0.38",
|
|
56
56
|
"@better-auth/electron": "1.6.2",
|
|
57
|
-
"@chat-js/gateways": "workspace:*",
|
|
58
57
|
"@chat-js/registry-validation": "workspace:*",
|
|
59
58
|
"@hookform/resolvers": "^5.2.1",
|
|
60
59
|
"@lexical/react": "^0.32.1",
|