@chat-js/registry 0.1.2 → 0.2.0-beta.0

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.
Files changed (89) hide show
  1. package/README.md +60 -8
  2. package/dist/r/ai-titles.json +47 -0
  3. package/dist/r/akamai-storage.json +44 -0
  4. package/dist/r/alibaba-storage.json +44 -0
  5. package/dist/r/appwrite-storage.json +50 -0
  6. package/dist/r/archil-storage.json +52 -0
  7. package/dist/r/attachment-uploads.json +87 -0
  8. package/dist/r/azure-storage.json +51 -0
  9. package/dist/r/backblaze-b2-storage.json +44 -0
  10. package/dist/r/bunny-storage-storage.json +48 -0
  11. package/dist/r/cloudinary-storage.json +43 -0
  12. package/dist/r/code-documents.json +96 -0
  13. package/dist/r/code-execution-runtime.json +25 -0
  14. package/dist/r/code-execution-ui.json +31 -0
  15. package/dist/r/code-execution.json +69 -0
  16. package/dist/r/credits.json +98 -0
  17. package/dist/r/daytona-sandbox.json +55 -0
  18. package/dist/r/deep-research.json +220 -0
  19. package/dist/r/delete-document.json +58 -0
  20. package/dist/r/digitalocean-spaces-storage.json +44 -0
  21. package/dist/r/dropbox-storage.json +43 -0
  22. package/dist/r/exoscale-storage.json +44 -0
  23. package/dist/r/feedback.json +105 -0
  24. package/dist/r/filebase-storage.json +43 -0
  25. package/dist/r/firebase-storage-storage.json +52 -0
  26. package/dist/r/firecrawl-search.json +72 -0
  27. package/dist/r/followup-suggestions.json +147 -0
  28. package/dist/r/ftp-storage.json +54 -0
  29. package/dist/r/gcs-storage.json +33 -0
  30. package/dist/r/generate-image.json +101 -0
  31. package/dist/r/generate-video.json +70 -0
  32. package/dist/r/get-weather.json +52 -0
  33. package/dist/r/google-drive-storage.json +47 -0
  34. package/dist/r/hetzner-storage.json +44 -0
  35. package/dist/r/ibm-cos-storage.json +44 -0
  36. package/dist/r/idrive-e2-storage.json +44 -0
  37. package/dist/r/langfuse.json +63 -0
  38. package/dist/r/litellm-gateway.json +67 -0
  39. package/dist/r/mcp.json +304 -0
  40. package/dist/r/memory-storage.json +28 -0
  41. package/dist/r/minio-storage.json +44 -0
  42. package/dist/r/model-preferences.json +125 -0
  43. package/dist/r/neon-storage.json +44 -0
  44. package/dist/r/netlify-blobs-storage.json +31 -0
  45. package/dist/r/onedrive-storage.json +48 -0
  46. package/dist/r/openai-compatible-gateway.json +69 -0
  47. package/dist/r/openai-gateway.json +67 -0
  48. package/dist/r/openrouter-gateway.json +75 -0
  49. package/dist/r/oracle-cloud-storage.json +45 -0
  50. package/dist/r/ovhcloud-storage.json +44 -0
  51. package/dist/r/pocketbase-storage.json +50 -0
  52. package/dist/r/projects.json +266 -0
  53. package/dist/r/r2-storage.json +44 -0
  54. package/dist/r/read-document.json +34 -0
  55. package/dist/r/registry.json +4870 -0
  56. package/dist/r/retrieve-url.json +67 -0
  57. package/dist/r/s3-storage.json +44 -0
  58. package/dist/r/saved-code-execution.json +81 -0
  59. package/dist/r/scaleway-storage.json +44 -0
  60. package/dist/r/search.json +140 -0
  61. package/dist/r/sftp-storage.json +58 -0
  62. package/dist/r/sharepoint-storage.json +50 -0
  63. package/dist/r/sharing.json +137 -0
  64. package/dist/r/sheet-documents.json +93 -0
  65. package/dist/r/storj-storage.json +43 -0
  66. package/dist/r/supabase-storage.json +48 -0
  67. package/dist/r/tavily-search.json +72 -0
  68. package/dist/r/tencent-storage.json +44 -0
  69. package/dist/r/text-documents.json +116 -0
  70. package/dist/r/tigris-storage.json +43 -0
  71. package/dist/r/uploadthing-storage.json +38 -0
  72. package/dist/r/vercel-analytics.json +46 -0
  73. package/dist/r/vercel-blob-storage.json +42 -0
  74. package/dist/r/vercel-gateway.json +77 -0
  75. package/dist/r/vercel-sandbox.json +67 -0
  76. package/dist/r/vercel-speed-insights.json +46 -0
  77. package/dist/r/vultr-storage.json +44 -0
  78. package/dist/r/wasabi-storage.json +44 -0
  79. package/dist/r/webdav-storage.json +52 -0
  80. package/dist/r/word-count.json +51 -0
  81. package/dist/r/yandex-storage.json +43 -0
  82. package/package.json +110 -31
  83. package/index.d.ts +0 -4
  84. package/index.js +0 -1
  85. package/index.json +0 -19
  86. package/items/get-weather.json +0 -26
  87. package/items/retrieve-url.json +0 -35
  88. package/items/toolkit-renderer.json +0 -29
  89. package/items/word-count.json +0 -22
@@ -0,0 +1,28 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "memory-storage",
4
+ "title": "In-Memory",
5
+ "description": "In-memory store backed by a Map - the test/reference adapter. Zero dependencies, isomorphic (no node:fs), and non-persistent: everything is lost when the process exits. Ideal for unit tests; not for production.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0"
8
+ ],
9
+ "files": [
10
+ {
11
+ "path": "src/storage/memory/storage-provider.ts",
12
+ "content": "export { memory as createStorageAdapter } from \"files-sdk/memory\";\n",
13
+ "type": "registry:file",
14
+ "target": "~/lib/storage-provider.ts"
15
+ }
16
+ ],
17
+ "meta": {
18
+ "chatjs": {
19
+ "configKeys": [],
20
+ "contractVersion": 1,
21
+ "envRequirements": [],
22
+ "id": "memory",
23
+ "kind": "storage",
24
+ "optionalEnv": []
25
+ }
26
+ },
27
+ "type": "registry:item"
28
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "minio-storage",
4
+ "title": "MinIO",
5
+ "description": "MinIO and other self-hosted S3-compatible servers. Path-style addressing on by default; region defaulted; errors relabelled. `client: \"fetch\"` swaps in an @aws-sdk-free SigV4 fetch engine (the default inside Cloudflare Workers).",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@aws-sdk/client-s3@^3.1079.0",
9
+ "@aws-sdk/s3-presigned-post@^3.700.0",
10
+ "@aws-sdk/s3-request-presigner@^3.700.0"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/storage/minio/storage-provider.ts",
15
+ "content": "export { minio as createStorageAdapter } from \"files-sdk/minio\";\n",
16
+ "type": "registry:file",
17
+ "target": "~/lib/storage-provider.ts"
18
+ }
19
+ ],
20
+ "meta": {
21
+ "chatjs": {
22
+ "configKeys": [
23
+ "bucket",
24
+ "endpoint"
25
+ ],
26
+ "contractVersion": 1,
27
+ "envRequirements": [
28
+ {
29
+ "description": "MinIO credentials",
30
+ "options": [
31
+ [
32
+ "MINIO_ACCESS_KEY_ID",
33
+ "MINIO_SECRET_ACCESS_KEY"
34
+ ]
35
+ ]
36
+ }
37
+ ],
38
+ "id": "minio",
39
+ "kind": "storage",
40
+ "optionalEnv": []
41
+ }
42
+ },
43
+ "type": "registry:item"
44
+ }
@@ -0,0 +1,125 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "model-preferences",
4
+ "description": "Per-user model visibility and model settings",
5
+ "files": [
6
+ {
7
+ "path": "src/plugins/model-preferences/src/apply-model-preferences.ts",
8
+ "content": "/** Preferences change picker visibility, never the catalog or server eligibility. */\nexport const applyModelPreferences = (\n defaults: ReadonlySet<string>,\n preferences: readonly {\n readonly modelId: string;\n readonly enabled: boolean;\n }[]\n): ReadonlySet<string> => {\n const enabled = new Set(defaults);\n for (const preference of preferences) {\n if (preference.enabled) {\n enabled.add(preference.modelId);\n } else {\n enabled.delete(preference.modelId);\n }\n }\n return enabled;\n};\n",
9
+ "type": "registry:file",
10
+ "target": "~/plugins/model-preferences/apply-model-preferences.ts"
11
+ },
12
+ {
13
+ "path": "src/plugins/model-preferences/src/client-plugin.ts",
14
+ "content": "import { Cpu } from \"lucide-react\";\nimport type { ChatClientPlugin } from \"@/lib/plugin-contracts\";\nimport { useModelPreferences } from \"./use-model-preferences\";\n\nexport const modelPreferencesClient = () =>\n ({\n id: \"model-preferences\",\n settingsItems: [\n { href: \"/settings/models\", icon: Cpu, id: \"models\", label: \"Models\" },\n ],\n useModelVisibility: useModelPreferences,\n }) satisfies ChatClientPlugin;\n",
15
+ "type": "registry:file",
16
+ "target": "~/plugins/model-preferences/client-plugin.ts"
17
+ },
18
+ {
19
+ "path": "src/plugins/model-preferences/src/model-preferences-queries.ts",
20
+ "content": "import { eq } from \"drizzle-orm\";\nimport { db } from \"@/lib/db/client\";\nimport { userModelPreference } from \"./model-preferences-schema\";\nimport type { UserModelPreference } from \"./model-preferences-schema\";\n\nconst getUserModelPreferences = async ({\n userId,\n}: {\n readonly userId: string;\n}): Promise<UserModelPreference[]> =>\n await db\n .select()\n .from(userModelPreference)\n .where(eq(userModelPreference.userId, userId));\n\nconst upsertUserModelPreference = async ({\n userId,\n modelId,\n enabled,\n}: {\n readonly userId: string;\n readonly modelId: string;\n readonly enabled: boolean;\n}): Promise<void> => {\n await db\n .insert(userModelPreference)\n .values({\n createdAt: new Date(),\n enabled,\n modelId,\n updatedAt: new Date(),\n userId,\n })\n .onConflictDoUpdate({\n set: { enabled, updatedAt: new Date() },\n target: [userModelPreference.userId, userModelPreference.modelId],\n });\n};\n\nexport { getUserModelPreferences, upsertUserModelPreference };\n",
21
+ "type": "registry:file",
22
+ "target": "~/plugins/model-preferences/model-preferences-queries.ts"
23
+ },
24
+ {
25
+ "path": "src/plugins/model-preferences/src/model-preferences-schema.ts",
26
+ "content": "import type { InferSelectModel } from \"drizzle-orm\";\nimport {\n boolean,\n index,\n pgTable,\n primaryKey,\n text,\n timestamp,\n varchar,\n} from \"drizzle-orm/pg-core\";\nimport { user } from \"@/lib/db/schema\";\n\nconst userModelPreference = pgTable(\n \"UserModelPreference\",\n {\n createdAt: timestamp(\"createdAt\").notNull().defaultNow(),\n enabled: boolean(\"enabled\").notNull(),\n modelId: varchar(\"modelId\", { length: 256 }).notNull(),\n updatedAt: timestamp(\"updatedAt\")\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n userId: text(\"userId\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n },\n (columns) => [\n index(\"UserModelPreference_user_id_idx\").on(columns.userId),\n primaryKey({ columns: [columns.userId, columns.modelId] }),\n ]\n);\n\ntype UserModelPreference = InferSelectModel<typeof userModelPreference>;\n\nexport { userModelPreference };\nexport type { UserModelPreference };\n",
27
+ "type": "registry:file",
28
+ "target": "~/plugins/model-preferences/model-preferences-schema.ts"
29
+ },
30
+ {
31
+ "path": "src/plugins/model-preferences/src/model-row.tsx",
32
+ "content": "import React, { memo } from \"react\";\n\nimport { TableCell, TableRow } from \"@/components/ui/table\";\nimport { AVAILABLE_FEATURES } from \"@/lib/features-config\";\nimport { ModelSelectorLogo } from \"@/components/model-selector-logo\";\n\nimport { Switch } from \"@/components/ui/switch\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst ModelRowComponent = ({\n model,\n isEnabled,\n onToggle,\n}: {\n readonly model: {\n readonly id: string;\n readonly name: string;\n readonly reasoning?: boolean;\n };\n readonly isEnabled: boolean;\n readonly onToggle: (modelId: string, isEnabled: boolean) => void;\n}) => {\n const ReasoningIcon = AVAILABLE_FEATURES.reasoning.icon;\n\n return (\n <TableRow>\n <TableCell className=\"w-full py-2.5 pl-0\">\n <div className=\"flex items-center gap-2.5\">\n <ModelSelectorLogo modelId={model.id} />\n <span className=\"text-sm font-medium\">{model.name}</span>\n {}\n {model.reasoning === true && (\n <ReasoningIcon\n aria-label={AVAILABLE_FEATURES.reasoning.description}\n className={cn(\n \"text-muted-foreground size-3.5\",\n isEnabled && \"text-foreground\"\n )}\n />\n )}\n {}\n </div>\n </TableCell>\n <TableCell className=\"py-2.5 pr-0\">\n <Switch\n checked={isEnabled}\n onCheckedChange={() => {\n onToggle(model.id, isEnabled);\n }}\n />\n </TableCell>\n </TableRow>\n );\n};\n\nconst ModelRow = memo(ModelRowComponent);\n\nModelRow.displayName = \"PureModelRow\";\nexport { ModelRow };\n",
33
+ "type": "registry:file",
34
+ "target": "~/plugins/model-preferences/model-row.tsx"
35
+ },
36
+ {
37
+ "path": "src/plugins/model-preferences/src/models-page.tsx",
38
+ "content": "import React, { Suspense } from \"react\";\n\nimport { ModelsSettings } from \"./models-settings\";\nimport {\n SettingsPage,\n SettingsPageHeader,\n} from \"@/components/settings/settings-page\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { preloadQuery } from \"@/trpc/preload-query\";\nimport { HydrateClient, getQueryClient, trpc } from \"@/trpc/server\";\n\nconst ModelsSettingsHeader = (): React.JSX.Element => (\n <SettingsPageHeader>\n <h2 className=\"text-lg font-semibold\">Models</h2>\n <p className=\"text-muted-foreground text-sm\">\n Configure your AI model preferences.\n </p>\n </SettingsPageHeader>\n);\n\nconst ModelsSettingsContent = async (): Promise<React.JSX.Element> => {\n const queryClient = getQueryClient();\n\n // Preloading populates the settings hydration cache and intentionally swallows preload failures.\n await preloadQuery(\n queryClient.query(trpc.modelPreferences.getModelPreferences.queryOptions())\n );\n\n return (\n <HydrateClient>\n <SettingsPage>\n <ModelsSettingsHeader />\n <ModelsSettings />\n </SettingsPage>\n </HydrateClient>\n );\n};\n\nconst ModelsSettingsPage = (): React.JSX.Element => (\n <Suspense\n fallback={\n <SettingsPage>\n <ModelsSettingsHeader />\n <div className=\"flex flex-col gap-3\">\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-full\" />\n <Skeleton className=\"h-12 w-5/6\" />\n </div>\n </SettingsPage>\n }\n >\n <ModelsSettingsContent />\n </Suspense>\n);\nexport { ModelsSettingsPage };\n",
39
+ "type": "registry:file",
40
+ "target": "~/plugins/model-preferences/models-page.tsx"
41
+ },
42
+ {
43
+ "path": "src/plugins/model-preferences/src/models-settings.tsx",
44
+ "content": "\"use client\";\n\nimport React, { useDeferredValue, useState } from \"react\";\n\nimport { RefreshCw, Search } from \"lucide-react\";\n\nimport type { JSX as ReactJSX } from \"react\";\n\nimport { useQueryClient } from \"@tanstack/react-query\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Input } from \"@/components/ui/input\";\nimport { useTRPC } from \"@/trpc/react\";\n\nimport { ModelsTable } from \"./models-table\";\n\nimport {\n SettingsPageContent,\n SettingsPageScrollArea,\n} from \"@/components/settings/settings-page\";\n\nexport const ModelsSettings = (): ReactJSX.Element => {\n const trpc = useTRPC();\n const queryClient = useQueryClient();\n const [search, setSearch] = useState(\"\");\n const deferredSearch = useDeferredValue(search);\n\n return (\n <SettingsPageContent className=\"gap-4\">\n <div className=\"relative flex shrink-0 gap-4\">\n <Search className=\"text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2\" />\n <Input\n className=\"bg-muted/50 pr-10 pl-9\"\n onChange={(event: {\n readonly target: { readonly value: string };\n }) => {\n setSearch(event.target.value);\n }}\n placeholder=\"Search model\"\n value={search}\n />\n <Button\n onClick={() => {\n void queryClient.invalidateQueries({\n queryKey: trpc.modelPreferences.getModelPreferences.queryKey(),\n });\n }}\n size=\"icon\"\n variant=\"ghost\"\n >\n <RefreshCw className=\"size-4\" />\n </Button>\n </div>\n\n <SettingsPageScrollArea>\n <ModelsTable className=\"block px-4\" search={deferredSearch} />\n </SettingsPageScrollArea>\n </SettingsPageContent>\n );\n};\n",
45
+ "type": "registry:file",
46
+ "target": "~/plugins/model-preferences/models-settings.tsx"
47
+ },
48
+ {
49
+ "path": "src/plugins/model-preferences/src/models-table.tsx",
50
+ "content": "\"use client\";\n\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\n\nimport type { JSX as ReactJSX } from \"react\";\n\nimport { toast } from \"sonner\";\n\nimport { Table, TableBody } from \"@/components/ui/table\";\n\nimport type { AppModelId } from \"@/lib/ai/app-model-id\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\n\nimport { useChatModels } from \"@/providers/chat-models-provider\";\nimport { ModelRow } from \"./model-row\";\n\nimport { useTRPC } from \"@/trpc/react\";\n\nexport const ModelsTable = ({\n search,\n className,\n}: {\n readonly search: string;\n readonly className?: string;\n}): ReactJSX.Element => {\n const trpc = useTRPC();\n const queryClient = useQueryClient();\n const { allModels, models: enabledModels } = useChatModels();\n\n const { data: preferences, isLoading: prefsLoading } = useQuery(\n trpc.modelPreferences.getModelPreferences.queryOptions()\n );\n\n const queryKey = trpc.modelPreferences.getModelPreferences.queryKey();\n\n const { mutate: setModelEnabled } = useMutation(\n trpc.modelPreferences.setModelEnabled.mutationOptions({\n onError: (\n _err: unknown,\n _newData: unknown,\n context: { readonly prev: typeof preferences } | undefined\n ) => {\n queryClient.setQueryData(queryKey, context?.prev);\n toast.error(\"Failed to update model preference\");\n },\n onMutate: (newData) => {\n const prev = queryClient.getQueryData(queryKey);\n queryClient.setQueryData(\n queryKey,\n (old: ReadonlyNativeSurface<typeof preferences>) => {\n if (!old) {\n return old;\n }\n const idx = old.findIndex(\n (preference: { readonly modelId: string }) =>\n preference.modelId === newData.modelId\n );\n if (idx !== -1) {\n return old.with(idx, { ...old[idx], enabled: newData.enabled });\n }\n return [\n ...old,\n {\n createdAt: new Date(),\n enabled: newData.enabled,\n modelId: newData.modelId,\n updatedAt: new Date(),\n userId: \"\",\n },\n ];\n }\n );\n return { prev };\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey });\n },\n })\n );\n\n const enabledModelsSet = useMemo(\n () => new Set(enabledModels.map((model) => model.id)),\n [enabledModels]\n );\n\n // Keep existing rows in place when preferences change, including during saves.\n const [modelOrder, setModelOrder] = useState<readonly AppModelId[]>(() => {\n const enabledSet = new Set(\n enabledModels.map((model: { readonly id: AppModelId }) => model.id)\n );\n return [\n ...enabledModels.map((model: { readonly id: AppModelId }) => model.id),\n ...allModels\n .filter(\n (model: { readonly id: AppModelId }) => !enabledSet.has(model.id)\n )\n .map((model: { readonly id: AppModelId }) => model.id),\n ];\n });\n const modelMap = useMemo(\n () =>\n new Map(\n allModels.map(\n (model: ReadonlyNativeSurface<(typeof allModels)[number]>) => [\n model.id,\n model,\n ]\n )\n ),\n [allModels]\n );\n const orderedIds = new Set(modelOrder);\n const addedModels = allModels.filter((model) => !orderedIds.has(model.id));\n if (addedModels.length > 0 || modelOrder.some((id) => !modelMap.has(id))) {\n // Reconcile a refreshed catalog before children render. This guarded state\n // update removes unavailable models and appends new ones without moving\n // the surviving rows or mutating a ref during render.\n setModelOrder([\n ...modelOrder.filter((id) => modelMap.has(id)),\n ...addedModels.map((model) => model.id),\n ]);\n }\n const sortedModels = useMemo(\n () =>\n modelOrder\n .map((id) => modelMap.get(id))\n .filter((model) => model !== undefined),\n [modelMap, modelOrder]\n );\n\n const filteredModels = useMemo(() => {\n if (!search.trim()) {\n return sortedModels;\n }\n const query = search.toLowerCase();\n return sortedModels.filter(\n (model: {\n readonly name: { readonly toLowerCase: () => string };\n readonly owned_by: { readonly toLowerCase: () => string };\n readonly id: { readonly toLowerCase: () => string };\n }) =>\n model.name.toLowerCase().includes(query) ||\n model.owned_by?.toLowerCase().includes(query) ||\n model.id.toLowerCase().includes(query)\n );\n }, [sortedModels, search]);\n\n const handleToggle = useCallback(\n (modelId: string, currentlyEnabled: boolean) => {\n setModelEnabled({\n enabled: !currentlyEnabled,\n modelId,\n });\n },\n [setModelEnabled]\n );\n\n if (prefsLoading) {\n return (\n <div className=\"animate-pulse space-y-1\">\n {[1, 2, 3, 4, 5].map((placeholderId): React.JSX.Element => (\n <div className=\"bg-muted/50 h-11 rounded\" key={placeholderId} />\n ))}\n </div>\n );\n }\n\n return (\n <>\n <p className=\"text-muted-foreground mb-2 text-xs\">\n {filteredModels.length} model{filteredModels.length !== 1 && \"s\"}\n </p>\n <Table className={className}>\n <TableBody>\n {filteredModels.map(\n (\n model: ReadonlyNativeSurface<(typeof allModels)[number]>\n ): React.JSX.Element => (\n <ModelRow\n isEnabled={enabledModelsSet.has(model.id)}\n key={model.id}\n model={model}\n onToggle={handleToggle}\n />\n )\n )}\n </TableBody>\n </Table>\n\n {filteredModels.length === 0 && (\n <p className=\"text-muted-foreground py-8 text-center text-sm\">\n No models found.\n </p>\n )}\n </>\n );\n};\n",
51
+ "type": "registry:file",
52
+ "target": "~/plugins/model-preferences/models-table.tsx"
53
+ },
54
+ {
55
+ "path": "src/plugins/model-preferences/src/router.ts",
56
+ "content": "import { z } from \"zod\";\n\nimport {\n getUserModelPreferences,\n upsertUserModelPreference,\n} from \"./model-preferences-queries\";\n\nimport { createTRPCRouter, protectedProcedure } from \"@/trpc/init\";\nimport type { ReadonlyNativeSurface } from \"@/lib/readonly-native-surface\";\n\nexport const modelPreferencesRouter = createTRPCRouter({\n getModelPreferences: protectedProcedure.query(\n async ({\n ctx,\n }: {\n readonly ctx: { readonly user: { readonly id: string } };\n }) => await getUserModelPreferences({ userId: ctx.user.id })\n ),\n\n setModelEnabled: protectedProcedure\n .input(\n z.object({\n enabled: z.boolean(),\n modelId: z.string(),\n })\n )\n .mutation(\n async ({\n ctx,\n input,\n }: {\n readonly ctx: { readonly user: { readonly id: string } };\n readonly input: ReadonlyNativeSurface<{\n enabled: boolean;\n modelId: string;\n }>;\n }) => {\n await upsertUserModelPreference({\n enabled: input.enabled,\n modelId: input.modelId,\n userId: ctx.user.id,\n });\n return { success: true };\n }\n ),\n});\n",
57
+ "type": "registry:file",
58
+ "target": "~/plugins/model-preferences/router.ts"
59
+ },
60
+ {
61
+ "path": "src/plugins/model-preferences/src/server-plugin.ts",
62
+ "content": "import type { ChatPlugin } from \"@/lib/plugin-contracts\";\nimport { modelPreferencesRouter } from \"./router\";\n\nexport const modelPreferences = () =>\n ({\n id: \"model-preferences\",\n routers: { modelPreferences: modelPreferencesRouter },\n }) satisfies ChatPlugin;\n",
63
+ "type": "registry:file",
64
+ "target": "~/plugins/model-preferences/server-plugin.ts"
65
+ },
66
+ {
67
+ "path": "src/plugins/model-preferences/src/use-model-preferences.ts",
68
+ "content": "\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useSession } from \"@/providers/session-provider\";\nimport { useTRPC } from \"@/trpc/react\";\nimport { applyModelPreferences } from \"./apply-model-preferences\";\n\nexport const useModelPreferences = (\n defaults: ReadonlySet<string>\n): ReadonlySet<string> => {\n const trpc = useTRPC();\n const { data: session } = useSession();\n const authenticated = Boolean(session?.user);\n const { data: preferences } = useQuery({\n ...trpc.modelPreferences.getModelPreferences.queryOptions(),\n enabled: authenticated,\n });\n return useMemo(\n () =>\n authenticated && preferences\n ? applyModelPreferences(defaults, preferences)\n : defaults,\n [authenticated, defaults, preferences]\n );\n};\n",
69
+ "type": "registry:file",
70
+ "target": "~/plugins/model-preferences/use-model-preferences.ts"
71
+ },
72
+ {
73
+ "path": "src/plugins/model-preferences/adapters/app/(chat)/settings/models/page.tsx",
74
+ "content": "export { ModelsSettingsPage as default } from \"@/plugins/model-preferences/models-page\";\n",
75
+ "type": "registry:file",
76
+ "target": "~/app/(chat)/settings/models/page.tsx"
77
+ },
78
+ {
79
+ "path": "dist/source/model-preferences.json",
80
+ "content": "{\n \"id\": \"model-preferences\",\n \"kind\": \"plugin\",\n \"files\": [\n \"plugins/model-preferences/apply-model-preferences.ts\",\n \"plugins/model-preferences/client-plugin.ts\",\n \"plugins/model-preferences/model-preferences-queries.ts\",\n \"plugins/model-preferences/model-preferences-schema.ts\",\n \"plugins/model-preferences/model-row.tsx\",\n \"plugins/model-preferences/models-page.tsx\",\n \"plugins/model-preferences/models-settings.tsx\",\n \"plugins/model-preferences/models-table.tsx\",\n \"plugins/model-preferences/router.ts\",\n \"plugins/model-preferences/server-plugin.ts\",\n \"plugins/model-preferences/use-model-preferences.ts\",\n \"app/(chat)/settings/models/page.tsx\"\n ],\n \"databaseSchemas\": [\"plugins/model-preferences/model-preferences-schema.ts\"],\n \"server\": { \"export\": \"modelPreferences\", \"routers\": [\"modelPreferences\"] },\n \"client\": {\n \"export\": \"modelPreferencesClient\",\n \"composerControls\": [],\n \"settingsItems\": [\"models\"],\n \"modelVisibility\": true\n },\n \"contractVersion\": 2,\n \"uiBase\": \"base\"\n}\n",
81
+ "type": "registry:file",
82
+ "target": "~/plugins/model-preferences/chatjs.json"
83
+ }
84
+ ],
85
+ "meta": {
86
+ "chatjs": {
87
+ "id": "model-preferences",
88
+ "kind": "plugin",
89
+ "files": [
90
+ "plugins/model-preferences/apply-model-preferences.ts",
91
+ "plugins/model-preferences/client-plugin.ts",
92
+ "plugins/model-preferences/model-preferences-queries.ts",
93
+ "plugins/model-preferences/model-preferences-schema.ts",
94
+ "plugins/model-preferences/model-row.tsx",
95
+ "plugins/model-preferences/models-page.tsx",
96
+ "plugins/model-preferences/models-settings.tsx",
97
+ "plugins/model-preferences/models-table.tsx",
98
+ "plugins/model-preferences/router.ts",
99
+ "plugins/model-preferences/server-plugin.ts",
100
+ "plugins/model-preferences/use-model-preferences.ts",
101
+ "app/(chat)/settings/models/page.tsx"
102
+ ],
103
+ "databaseSchemas": [
104
+ "plugins/model-preferences/model-preferences-schema.ts"
105
+ ],
106
+ "server": {
107
+ "export": "modelPreferences",
108
+ "routers": [
109
+ "modelPreferences"
110
+ ]
111
+ },
112
+ "client": {
113
+ "export": "modelPreferencesClient",
114
+ "composerControls": [],
115
+ "settingsItems": [
116
+ "models"
117
+ ],
118
+ "modelVisibility": true
119
+ },
120
+ "contractVersion": 2,
121
+ "uiBase": "base"
122
+ }
123
+ },
124
+ "type": "registry:item"
125
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "neon-storage",
4
+ "title": "Neon",
5
+ "description": "Neon branchable object storage via the S3-compatible API. `neon dev` / `neon env pull` inject the standard AWS_* env vars for the linked branch; path-style addressing is required.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@aws-sdk/client-s3@^3.1079.0",
9
+ "@aws-sdk/s3-presigned-post@^3.700.0",
10
+ "@aws-sdk/s3-request-presigner@^3.700.0"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/storage/neon/storage-provider.ts",
15
+ "content": "export { neon as createStorageAdapter } from \"files-sdk/neon\";\n",
16
+ "type": "registry:file",
17
+ "target": "~/lib/storage-provider.ts"
18
+ }
19
+ ],
20
+ "meta": {
21
+ "chatjs": {
22
+ "configKeys": [
23
+ "bucket"
24
+ ],
25
+ "contractVersion": 1,
26
+ "envRequirements": [
27
+ {
28
+ "description": "Neon configuration",
29
+ "options": [
30
+ [
31
+ "AWS_ENDPOINT_URL_S3"
32
+ ]
33
+ ]
34
+ }
35
+ ],
36
+ "id": "neon",
37
+ "kind": "storage",
38
+ "optionalEnv": [
39
+ "AWS_REGION"
40
+ ]
41
+ }
42
+ },
43
+ "type": "registry:item"
44
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "netlify-blobs-storage",
4
+ "title": "Netlify Blobs",
5
+ "description": "Netlify Blobs via @netlify/blobs. Auto-detects siteID and token on Netlify runtimes; falls back to env vars elsewhere.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@netlify/blobs@^10.7.4 || ^11.0.0"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/storage/netlify-blobs/storage-provider.ts",
13
+ "content": "export { netlifyBlobs as createStorageAdapter } from \"files-sdk/netlify-blobs\";\n",
14
+ "type": "registry:file",
15
+ "target": "~/lib/storage-provider.ts"
16
+ }
17
+ ],
18
+ "meta": {
19
+ "chatjs": {
20
+ "configKeys": [
21
+ "store name"
22
+ ],
23
+ "contractVersion": 1,
24
+ "envRequirements": [],
25
+ "id": "netlify-blobs",
26
+ "kind": "storage",
27
+ "optionalEnv": []
28
+ }
29
+ },
30
+ "type": "registry:item"
31
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "onedrive-storage",
4
+ "title": "OneDrive",
5
+ "description": "OneDrive and SharePoint document libraries via Microsoft Graph. Path-addressable, no virtual-key bookkeeping.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@azure/identity@^4.5.0",
9
+ "@microsoft/microsoft-graph-client@^3.0.7"
10
+ ],
11
+ "files": [
12
+ {
13
+ "path": "src/storage/onedrive/storage-provider.ts",
14
+ "content": "export { onedrive as createStorageAdapter } from \"files-sdk/onedrive\";\n",
15
+ "type": "registry:file",
16
+ "target": "~/lib/storage-provider.ts"
17
+ }
18
+ ],
19
+ "meta": {
20
+ "chatjs": {
21
+ "configKeys": [],
22
+ "contractVersion": 1,
23
+ "envRequirements": [
24
+ {
25
+ "description": "OneDrive credentials",
26
+ "options": [
27
+ [
28
+ "ONEDRIVE_TENANT_ID",
29
+ "ONEDRIVE_CLIENT_ID",
30
+ "ONEDRIVE_CLIENT_SECRET"
31
+ ],
32
+ [
33
+ "ONEDRIVE_ACCESS_TOKEN"
34
+ ]
35
+ ]
36
+ }
37
+ ],
38
+ "id": "onedrive",
39
+ "kind": "storage",
40
+ "optionalEnv": [
41
+ "ONEDRIVE_DRIVE_ID",
42
+ "ONEDRIVE_SITE_ID",
43
+ "ONEDRIVE_USER_ID"
44
+ ]
45
+ }
46
+ },
47
+ "type": "registry:item"
48
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "openai-compatible-gateway",
4
+ "title": "OpenAICompatibleGateway",
5
+ "dependencies": [
6
+ "@chat-js/gateways@0.2.0",
7
+ "@ai-sdk/openai-compatible@3.0.44",
8
+ "zod"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/gateways/openai-compatible/gateway.ts",
13
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\n\nimport type { AiGatewayModel } from \"@chat-js/gateways/models\";\n\nimport type { GatewayProvider } from \"@chat-js/gateways/gateway-provider\";\n\nimport { GatewayRuntime } from \"@chat-js/gateways/runtime\";\n\nimport type { ImageModel } from \"ai\";\nimport { createOpenAICompatible } from \"@ai-sdk/openai-compatible\";\nimport { z } from \"zod\";\n\nconst providerModelSchema = z.object({\n created: z.number().nullish(),\n id: z.string(),\n owned_by: z.string().nullish(),\n});\ntype OpenAICompatibleModelResponse = z.output<typeof providerModelSchema>;\nconst providerModelListSchema = z.object({\n data: z.array(z.unknown()),\n});\n\nconst EMPTY_MODEL_COUNT = 0;\nconst UNKNOWN_MODEL_LIMIT = 0;\nconst UNKNOWN_MODEL_TIMESTAMP = 0;\nconst toAiGatewayModel = (\n model: Readonly<OpenAICompatibleModelResponse>\n): AiGatewayModel => ({\n context_window: UNKNOWN_MODEL_LIMIT,\n created: model.created ?? UNKNOWN_MODEL_TIMESTAMP,\n description: \"\",\n id: model.id,\n max_tokens: UNKNOWN_MODEL_LIMIT,\n name: model.id,\n object: \"model\",\n owned_by: model.owned_by ?? \"unknown\",\n pricing: {},\n type: \"language\",\n});\n\n// Validate the wire envelope separately from each model so valid neighbors survive.\nconst parseProviderModels = (value: unknown): AiGatewayModel[] => {\n const body = providerModelListSchema.parse(value);\n const result = body.data.flatMap((entry): AiGatewayModel[] => {\n const model = providerModelSchema.safeParse(entry);\n if (!model.success) {\n return [];\n }\n return [toAiGatewayModel(model.data)];\n });\n // A genuinely empty catalog is valid; a nonempty unparseable catalog is not.\n if (\n body.data.length > EMPTY_MODEL_COUNT &&\n result.length === EMPTY_MODEL_COUNT\n ) {\n throw new Error(\"Provider catalog contains no valid models.\");\n }\n return result;\n};\n\nclass OpenAICompatibleGateway\n extends GatewayRuntime\n implements GatewayProvider<\"openai-compatible\">\n{\n public readonly type = \"openai-compatible\" as const;\n\n private getProvider(): ReturnType<typeof createOpenAICompatible> {\n const apiKey = this.getApiKey();\n const baseURL = this.getBaseURL();\n if (!(typeof baseURL === \"string\" && baseURL !== \"\")) {\n throw new Error(\"OPENAI_COMPATIBLE_BASE_URL is not configured\");\n }\n return createOpenAICompatible({\n apiKey,\n baseURL,\n name: \"openai-compatible\",\n });\n }\n\n public createLanguageModel(modelId: string): LanguageModelV4 {\n const provider = this.getProvider();\n return provider(modelId);\n }\n\n public createImageModel(modelId: string): ImageModel {\n const provider = this.getProvider();\n return provider.imageModel(modelId);\n }\n\n public readonly createVideoModel = null;\n\n private getApiKey(): string | undefined {\n return this.env.OPENAI_COMPATIBLE_API_KEY;\n }\n\n private getBaseURL(): string | undefined {\n const baseURL = this.env.OPENAI_COMPATIBLE_BASE_URL;\n if (baseURL === undefined || baseURL === \"\") {\n return undefined;\n }\n return z.url().parse(baseURL);\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = this.getApiKey();\n const baseURL = this.getBaseURL();\n\n if (!(typeof baseURL === \"string\" && baseURL !== \"\")) {\n this.log.warn(\n \"No OPENAI_COMPATIBLE_BASE_URL found, using fallback models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n\n const url = `${baseURL}/models`;\n this.log.debug({ url }, \"Fetching models from OpenAI-compatible provider\");\n\n try {\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n };\n if (typeof apiKey === \"string\" && apiKey !== \"\") {\n headers.Authorization = `Bearer ${apiKey}`;\n }\n\n const response = await this.fetch(url, {\n headers,\n });\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"OpenAI-compatible provider returned non-OK response\"\n );\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const result = parseProviderModels(await response.json());\n\n this.log.info(\n { modelCount: result.length },\n \"Successfully fetched models from OpenAI-compatible provider\"\n );\n return result;\n } catch (error) {\n this.log.error(\n { err: error, url },\n \"Error fetching models from OpenAI-compatible provider, falling back to generated models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n }\n}\nexport { OpenAICompatibleGateway as Gateway, OpenAICompatibleGateway };\n",
14
+ "type": "registry:file",
15
+ "target": "~/lib/ai/gateway.ts"
16
+ }
17
+ ],
18
+ "meta": {
19
+ "chatjs": {
20
+ "capabilities": {
21
+ "image": true,
22
+ "video": false
23
+ },
24
+ "contractVersion": 1,
25
+ "defaults": {
26
+ "anonymousModels": [
27
+ "gpt-5-nano"
28
+ ],
29
+ "curatedDefaults": [
30
+ "gpt-5-nano",
31
+ "gpt-5-mini",
32
+ "gpt-5.2",
33
+ "gpt-5.2-chat-latest"
34
+ ],
35
+ "disabledModels": [],
36
+ "providerOrder": [
37
+ "openai"
38
+ ],
39
+ "roles": {
40
+ "fast": "gpt-5-nano",
41
+ "balanced": "gpt-5-mini",
42
+ "smart": "gpt-5-mini",
43
+ "image": "gpt-image-1"
44
+ },
45
+ "workflows": {
46
+ "chat": "gpt-5-mini",
47
+ "chatImageCompatible": "gpt-4o-mini",
48
+ "pdf": "gpt-5-mini",
49
+ "title": "gpt-5-nano"
50
+ }
51
+ },
52
+ "envRequirements": [
53
+ {
54
+ "options": [
55
+ [
56
+ "OPENAI_COMPATIBLE_BASE_URL"
57
+ ]
58
+ ]
59
+ }
60
+ ],
61
+ "id": "openai-compatible",
62
+ "kind": "gateway",
63
+ "optionalEnv": [
64
+ "OPENAI_COMPATIBLE_API_KEY"
65
+ ]
66
+ }
67
+ },
68
+ "type": "registry:item"
69
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "openai-gateway",
4
+ "title": "OpenAIGateway",
5
+ "dependencies": [
6
+ "@chat-js/gateways@0.2.0",
7
+ "@ai-sdk/openai@4.0.59",
8
+ "zod"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/gateways/openai/gateway.ts",
13
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\n\nimport type {\n ExtractImageModelIdFromProvider,\n ExtractModelIdFromProvider,\n} from \"@chat-js/gateways/provider-types\";\n\nimport type { AiGatewayModel } from \"@chat-js/gateways/models\";\n\nimport type { GatewayProvider } from \"@chat-js/gateways/gateway-provider\";\n\nimport { GatewayRuntime } from \"@chat-js/gateways/runtime\";\n\nimport type { ImageModel } from \"ai\";\nimport { createOpenAI } from \"@ai-sdk/openai\";\nimport { z } from \"zod\";\n\ntype OpenaiImageModelId = ExtractImageModelIdFromProvider<typeof createOpenAI>;\n\nconst providerModelSchema = z.object({\n created: z.number().nullish(),\n id: z.string(),\n owned_by: z.string().nullish(),\n});\ntype OpenAIModelResponse = z.output<typeof providerModelSchema>;\nconst providerModelListSchema = z.object({\n data: z.array(z.unknown()),\n});\n\nconst EMPTY_MODEL_COUNT = 0;\nconst UNKNOWN_MODEL_LIMIT = 0;\nconst UNKNOWN_MODEL_TIMESTAMP = 0;\nconst toAiGatewayModel = (\n model: Readonly<OpenAIModelResponse>\n): AiGatewayModel => ({\n context_window: UNKNOWN_MODEL_LIMIT,\n created: model.created ?? UNKNOWN_MODEL_TIMESTAMP,\n description: \"\",\n id: model.id,\n max_tokens: UNKNOWN_MODEL_LIMIT,\n name: model.id,\n object: \"model\",\n owned_by:\n (model.owned_by === \"system\" ? \"openai\" : model.owned_by) ?? \"openai\",\n pricing: {},\n type: \"language\",\n});\n\n// Validate the wire envelope separately from each model so valid neighbors survive.\nconst parseProviderModels = (value: unknown): AiGatewayModel[] => {\n const body = providerModelListSchema.parse(value);\n const result = body.data.flatMap((entry): AiGatewayModel[] => {\n const model = providerModelSchema.safeParse(entry);\n if (!model.success) {\n return [];\n }\n return [toAiGatewayModel(model.data)];\n });\n // A genuinely empty catalog is valid; a nonempty unparseable catalog is not.\n if (\n body.data.length > EMPTY_MODEL_COUNT &&\n result.length === EMPTY_MODEL_COUNT\n ) {\n throw new Error(\"Provider catalog contains no valid models.\");\n }\n return result;\n};\n\nclass OpenAIGateway\n extends GatewayRuntime\n implements GatewayProvider<\"openai\">\n{\n public readonly type = \"openai\" as const;\n\n private getProvider(): ReturnType<typeof createOpenAI> {\n const apiKey = this.getApiKey();\n if (!(typeof apiKey === \"string\" && apiKey !== \"\")) {\n throw new Error(\"OPENAI_API_KEY is not configured\");\n }\n return createOpenAI({ apiKey });\n }\n\n public createLanguageModel(\n modelId: ExtractModelIdFromProvider<typeof createOpenAI>\n ): LanguageModelV4 {\n const provider = this.getProvider();\n return provider(modelId);\n }\n\n public createImageModel(modelId: OpenaiImageModelId): ImageModel {\n const provider = this.getProvider();\n return provider.image(modelId);\n }\n\n public readonly createVideoModel = null;\n\n private getApiKey(): string | undefined {\n return this.env.OPENAI_API_KEY;\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = this.getApiKey();\n\n if (!(typeof apiKey === \"string\" && apiKey !== \"\")) {\n this.log.warn(\"No OPENAI_API_KEY found, using fallback models\");\n return [...this.getFallbackModels(this.type)];\n }\n\n const url = \"https://api.openai.com/v1/models\";\n this.log.debug({ url }, \"Fetching models from OpenAI\");\n\n try {\n const response = await this.fetch(url, {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n });\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"OpenAI returned non-OK response\"\n );\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const result = parseProviderModels(await response.json());\n\n this.log.info(\n { modelCount: result.length },\n \"Successfully fetched models from OpenAI\"\n );\n return result;\n } catch (error) {\n this.log.error(\n { err: error, url },\n \"Error fetching models from OpenAI, falling back to generated models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n }\n}\nexport { OpenAIGateway as Gateway, OpenAIGateway };\n",
14
+ "type": "registry:file",
15
+ "target": "~/lib/ai/gateway.ts"
16
+ }
17
+ ],
18
+ "meta": {
19
+ "chatjs": {
20
+ "capabilities": {
21
+ "image": true,
22
+ "video": false
23
+ },
24
+ "contractVersion": 1,
25
+ "defaults": {
26
+ "anonymousModels": [
27
+ "gpt-5-nano"
28
+ ],
29
+ "curatedDefaults": [
30
+ "gpt-5-nano",
31
+ "gpt-5-mini",
32
+ "gpt-5.2",
33
+ "gpt-5.2-chat-latest"
34
+ ],
35
+ "disabledModels": [],
36
+ "providerOrder": [
37
+ "openai"
38
+ ],
39
+ "roles": {
40
+ "fast": "gpt-5-nano",
41
+ "balanced": "gpt-5-mini",
42
+ "smart": "gpt-5-mini",
43
+ "image": "gpt-image-1"
44
+ },
45
+ "workflows": {
46
+ "chat": "gpt-5-mini",
47
+ "chatImageCompatible": "gpt-4o-mini",
48
+ "pdf": "gpt-5-mini",
49
+ "title": "gpt-5-nano"
50
+ }
51
+ },
52
+ "envRequirements": [
53
+ {
54
+ "options": [
55
+ [
56
+ "OPENAI_API_KEY"
57
+ ]
58
+ ]
59
+ }
60
+ ],
61
+ "id": "openai",
62
+ "kind": "gateway",
63
+ "optionalEnv": []
64
+ }
65
+ },
66
+ "type": "registry:item"
67
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "openrouter-gateway",
4
+ "title": "OpenRouterGateway",
5
+ "dependencies": [
6
+ "@chat-js/gateways@0.2.0",
7
+ "@openrouter/ai-sdk-provider@3.0.0",
8
+ "zod"
9
+ ],
10
+ "files": [
11
+ {
12
+ "path": "src/gateways/openrouter/gateway.ts",
13
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\nimport type { AiGatewayModel } from \"@chat-js/gateways/models\";\n\nimport type { GatewayProvider } from \"@chat-js/gateways/gateway-provider\";\n\nimport { GatewayRuntime } from \"@chat-js/gateways/runtime\";\n\nimport { createOpenRouter } from \"@openrouter/ai-sdk-provider\";\n\nimport { z } from \"zod\";\n\nconst MODEL_OWNER_SEGMENT_INDEX = 0;\nconst EMPTY_TAG_COUNT = 0;\nconst OPENROUTER_MODELS_URL = \"https://openrouter.ai/api/v1/models\";\n\nconst modalitiesSchema = z.array(z.string()).nullish();\nconst providerModelSchema = z.object({\n architecture: z\n .object({\n input_modalities: modalitiesSchema,\n output_modalities: modalitiesSchema,\n })\n .nullish(),\n context_length: z.number().nullish(),\n created: z.number().nullish(),\n description: z.string().nullish(),\n id: z.string(),\n name: z.string().nullish(),\n pricing: z\n .object({\n completion: z.string().optional(),\n image: z.string().optional(),\n input_cache_read: z.string().optional(),\n input_cache_write: z.string().optional(),\n prompt: z.string().optional(),\n web_search: z.string().optional(),\n })\n .nullish(),\n supported_parameters: z.array(z.string()).nullish(),\n top_provider: z\n .object({ max_completion_tokens: z.number().nullish() })\n .nullish(),\n});\ntype OpenRouterModelResponse = Omit<\n z.output<typeof providerModelSchema>,\n \"architecture\" | \"pricing\" | \"top_provider\" | \"supported_parameters\"\n> & {\n architecture?: {\n readonly input_modalities?: readonly string[] | null;\n readonly output_modalities?: readonly string[] | null;\n } | null;\n pricing?: Readonly<z.output<typeof providerModelSchema>[\"pricing\"]>;\n top_provider?: Readonly<z.output<typeof providerModelSchema>[\"top_provider\"]>;\n supported_parameters?: readonly string[] | null;\n};\nconst providerModelListSchema = z.object({\n data: z.array(z.unknown()),\n});\n\nconst deriveTags = (model: Readonly<OpenRouterModelResponse>): string[] => {\n const inputMods = (model.architecture ?? {}).input_modalities ?? [\"text\"];\n const outputMods = (model.architecture ?? {}).output_modalities ?? [\"text\"];\n const supportedParams = model.supported_parameters ?? [];\n\n const capabilities: readonly (readonly [boolean, string])[] = [\n [inputMods.includes(\"image\"), \"vision\"],\n [inputMods.includes(\"file\"), \"file-input\"],\n [outputMods.includes(\"image\"), \"image-generation\"],\n [\n supportedParams.includes(\"reasoning\") ||\n supportedParams.includes(\"include_reasoning\"),\n \"reasoning\",\n ],\n [supportedParams.includes(\"tools\"), \"tool-use\"],\n ];\n return capabilities.filter(([supported]) => supported).map(([, tag]) => tag);\n};\n\nconst EMPTY_MODEL_COUNT = 0;\nconst UNKNOWN_MODEL_LIMIT = 0;\nconst UNKNOWN_MODEL_TIMESTAMP = 0;\nconst toAiGatewayModel = (\n model: Readonly<OpenRouterModelResponse>\n): AiGatewayModel => {\n const tags = deriveTags(model);\n const outputMods = (model.architecture ?? {}).output_modalities ?? [\"text\"];\n\n let type: \"language\" | \"embedding\" | \"image\" = \"language\";\n if (!outputMods.includes(\"text\") && outputMods.includes(\"image\")) {\n type = \"image\";\n }\n\n const owned_by =\n model.id.split(\"/\").at(MODEL_OWNER_SEGMENT_INDEX) ?? \"unknown\";\n\n return {\n context_window: model.context_length ?? UNKNOWN_MODEL_LIMIT,\n created: model.created ?? UNKNOWN_MODEL_TIMESTAMP,\n description: model.description ?? \"\",\n id: model.id,\n max_tokens:\n (model.top_provider ?? {}).max_completion_tokens ?? UNKNOWN_MODEL_LIMIT,\n name: model.name ?? model.id,\n object: \"model\",\n owned_by,\n pricing: {\n image: (model.pricing ?? {}).image,\n input: (model.pricing ?? {}).prompt,\n input_cache_read: (model.pricing ?? {}).input_cache_read,\n input_cache_write: (model.pricing ?? {}).input_cache_write,\n output: (model.pricing ?? {}).completion,\n web_search: (model.pricing ?? {}).web_search,\n },\n tags: tags.length > EMPTY_TAG_COUNT ? tags : undefined,\n type,\n };\n};\n\n// Validate the wire envelope separately from each model so valid neighbors survive.\nconst parseProviderModels = (value: unknown): AiGatewayModel[] => {\n const body = providerModelListSchema.parse(value);\n const result = body.data.flatMap((entry): AiGatewayModel[] => {\n const model = providerModelSchema.safeParse(entry);\n if (!model.success) {\n return [];\n }\n return [toAiGatewayModel(model.data)];\n });\n // A genuinely empty catalog is valid; a nonempty unparseable catalog is not.\n if (\n body.data.length > EMPTY_MODEL_COUNT &&\n result.length === EMPTY_MODEL_COUNT\n ) {\n throw new Error(\"Provider catalog contains no valid models.\");\n }\n return result;\n};\n\nclass OpenRouterGateway\n extends GatewayRuntime\n implements GatewayProvider<\"openrouter\">\n{\n public readonly type = \"openrouter\" as const;\n\n private getProvider(): ReturnType<typeof createOpenRouter> {\n const apiKey = this.getApiKey();\n if (!(typeof apiKey === \"string\" && apiKey !== \"\")) {\n throw new Error(\"OPENROUTER_API_KEY is not configured\");\n }\n return createOpenRouter({ apiKey });\n }\n\n public createLanguageModel(modelId: string): LanguageModelV4 {\n const provider = this.getProvider();\n return provider.chat(modelId);\n }\n\n // OpenRouter generates images through multimodal language models.\n public readonly createImageModel = null;\n\n public readonly createVideoModel = null;\n\n private getApiKey(): string | undefined {\n return this.env.OPENROUTER_API_KEY;\n }\n\n public async fetchModels(): Promise<AiGatewayModel[]> {\n const apiKey = this.getApiKey();\n\n if (!(typeof apiKey === \"string\" && apiKey !== \"\")) {\n this.log.warn(\"No OPENROUTER_API_KEY found, using fallback models\");\n return [...this.getFallbackModels(this.type)];\n }\n\n const url = OPENROUTER_MODELS_URL;\n this.log.debug({ url }, \"Fetching models from OpenRouter\");\n\n try {\n const response = await this.fetch(url, {\n headers: {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n },\n });\n\n if (!response.ok) {\n this.log.error(\n { status: response.status, statusText: response.statusText, url },\n \"OpenRouter returned non-OK response\"\n );\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const result = parseProviderModels(await response.json());\n\n this.log.info(\n { modelCount: result.length },\n \"Successfully fetched models from OpenRouter\"\n );\n return result;\n } catch (error) {\n this.log.error(\n { err: error, url },\n \"Error fetching models from OpenRouter, falling back to generated models\"\n );\n return [...this.getFallbackModels(this.type)];\n }\n }\n}\nexport { OpenRouterGateway as Gateway, OpenRouterGateway };\n",
14
+ "type": "registry:file",
15
+ "target": "~/lib/ai/gateway.ts"
16
+ }
17
+ ],
18
+ "meta": {
19
+ "chatjs": {
20
+ "capabilities": {
21
+ "image": false,
22
+ "video": false
23
+ },
24
+ "contractVersion": 1,
25
+ "defaults": {
26
+ "anonymousModels": [
27
+ "google/gemini-2.5-flash-lite",
28
+ "openai/gpt-5-nano"
29
+ ],
30
+ "curatedDefaults": [
31
+ "openai/gpt-5-nano",
32
+ "openai/gpt-5-mini",
33
+ "openai/gpt-5.2",
34
+ "openai/gpt-5.2-chat",
35
+ "google/gemini-2.5-flash-lite",
36
+ "google/gemini-3-flash",
37
+ "google/gemini-3-pro-preview",
38
+ "anthropic/claude-sonnet-4.5",
39
+ "anthropic/claude-opus-4.5",
40
+ "xai/grok-4"
41
+ ],
42
+ "disabledModels": [],
43
+ "providerOrder": [
44
+ "openai",
45
+ "google",
46
+ "anthropic"
47
+ ],
48
+ "roles": {
49
+ "fast": "google/gemini-2.5-flash-lite",
50
+ "balanced": "openai/gpt-5-mini",
51
+ "smart": "google/gemini-3-flash"
52
+ },
53
+ "workflows": {
54
+ "chat": "openai/gpt-5-mini",
55
+ "chatImageCompatible": "openai/gpt-4o-mini",
56
+ "pdf": "openai/gpt-5-mini",
57
+ "title": "openai/gpt-5-nano"
58
+ }
59
+ },
60
+ "envRequirements": [
61
+ {
62
+ "options": [
63
+ [
64
+ "OPENROUTER_API_KEY"
65
+ ]
66
+ ]
67
+ }
68
+ ],
69
+ "id": "openrouter",
70
+ "kind": "gateway",
71
+ "optionalEnv": []
72
+ }
73
+ },
74
+ "type": "registry:item"
75
+ }
@@ -0,0 +1,45 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
+ "name": "oracle-cloud-storage",
4
+ "title": "Oracle Cloud Object Storage",
5
+ "description": "Oracle Cloud Infrastructure Object Storage via the S3 compatibility layer. Auth uses HMAC Customer Secret Keys, not regular API keys.",
6
+ "dependencies": [
7
+ "files-sdk@2.5.0",
8
+ "@aws-sdk/client-s3@^3.1079.0",
9
+ "@aws-sdk/s3-presigned-post@^3.700.0",
10
+ "@aws-sdk/s3-request-presigner@^3.700.0"
11
+ ],
12
+ "files": [
13
+ {
14
+ "path": "src/storage/oracle-cloud/storage-provider.ts",
15
+ "content": "export { oracleCloud as createStorageAdapter } from \"files-sdk/oracle-cloud\";\n",
16
+ "type": "registry:file",
17
+ "target": "~/lib/storage-provider.ts"
18
+ }
19
+ ],
20
+ "meta": {
21
+ "chatjs": {
22
+ "configKeys": [
23
+ "bucket",
24
+ "region",
25
+ "endpoint"
26
+ ],
27
+ "contractVersion": 1,
28
+ "envRequirements": [
29
+ {
30
+ "description": "Oracle Cloud Object Storage credentials",
31
+ "options": [
32
+ [
33
+ "OCI_ACCESS_KEY_ID",
34
+ "OCI_SECRET_ACCESS_KEY"
35
+ ]
36
+ ]
37
+ }
38
+ ],
39
+ "id": "oracle-cloud",
40
+ "kind": "storage",
41
+ "optionalEnv": []
42
+ }
43
+ },
44
+ "type": "registry:item"
45
+ }