@chat-js/registry 0.2.0-beta.1 → 0.2.0-beta.10

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 (280) hide show
  1. package/README.md +16 -12
  2. package/dist/r/ai-titles.json +14 -17
  3. package/dist/r/akamai-storage.json +13 -1
  4. package/dist/r/alibaba-storage.json +13 -1
  5. package/dist/r/appwrite-storage.json +8 -1
  6. package/dist/r/archil-storage.json +8 -1
  7. package/dist/r/attach-workspace-file.json +82 -0
  8. package/dist/r/attachment-uploads.json +24 -35
  9. package/dist/r/azure-storage.json +8 -1
  10. package/dist/r/backblaze-b2-storage.json +13 -1
  11. package/dist/r/base/ai-titles.json +14 -17
  12. package/dist/r/base/akamai-storage.json +13 -1
  13. package/dist/r/base/alibaba-storage.json +13 -1
  14. package/dist/r/base/appwrite-storage.json +8 -1
  15. package/dist/r/base/archil-storage.json +8 -1
  16. package/dist/r/base/attach-workspace-file.json +82 -0
  17. package/dist/r/base/attachment-uploads.json +24 -35
  18. package/dist/r/base/azure-storage.json +8 -1
  19. package/dist/r/base/backblaze-b2-storage.json +13 -1
  20. package/dist/r/base/bunny-storage-storage.json +2 -1
  21. package/dist/r/base/cloudinary-storage.json +2 -1
  22. package/dist/r/base/credits.json +24 -46
  23. package/dist/r/base/deep-research.json +55 -141
  24. package/dist/r/base/default-sandbox.json +35 -0
  25. package/dist/r/base/desktop.json +129 -0
  26. package/dist/r/base/digitalocean-spaces-storage.json +13 -1
  27. package/dist/r/base/docker-sandbox.json +35 -0
  28. package/dist/r/base/dropbox-storage.json +2 -1
  29. package/dist/r/base/exoscale-storage.json +13 -1
  30. package/dist/r/base/feedback.json +31 -53
  31. package/dist/r/base/filebase-storage.json +8 -1
  32. package/dist/r/base/firebase-storage-storage.json +2 -1
  33. package/dist/r/base/followup-suggestions.json +44 -66
  34. package/dist/r/base/ftp-storage.json +18 -1
  35. package/dist/r/base/gcs-storage.json +8 -1
  36. package/dist/r/base/generate-image.json +22 -16
  37. package/dist/r/base/generate-video.json +16 -10
  38. package/dist/r/base/google-drive-storage.json +2 -1
  39. package/dist/r/base/guest-chat.json +166 -0
  40. package/dist/r/base/hetzner-storage.json +13 -1
  41. package/dist/r/base/ibm-cos-storage.json +13 -1
  42. package/dist/r/base/idrive-e2-storage.json +13 -1
  43. package/dist/r/base/image-viewer.json +49 -0
  44. package/dist/r/base/just-bash-sandbox.json +32 -0
  45. package/dist/r/base/litellm-gateway.json +5 -8
  46. package/dist/r/base/mcp.json +128 -121
  47. package/dist/r/base/memory-storage.json +5 -3
  48. package/dist/r/base/minio-storage.json +13 -1
  49. package/dist/r/base/model-preferences.json +41 -55
  50. package/dist/r/base/neon-storage.json +8 -1
  51. package/dist/r/base/netlify-blobs-storage.json +10 -2
  52. package/dist/r/base/onedrive-storage.json +2 -1
  53. package/dist/r/base/openai-compatible-gateway.json +5 -8
  54. package/dist/r/base/openai-gateway.json +5 -8
  55. package/dist/r/base/openrouter-gateway.json +4 -8
  56. package/dist/r/base/oracle-cloud-storage.json +18 -1
  57. package/dist/r/base/ovhcloud-storage.json +13 -1
  58. package/dist/r/base/pocketbase-storage.json +2 -1
  59. package/dist/r/base/projects.json +107 -108
  60. package/dist/r/base/r2-storage.json +9 -1
  61. package/dist/r/base/registry.json +2340 -2555
  62. package/dist/r/base/s3-storage.json +15 -1
  63. package/dist/r/base/scaleway-storage.json +13 -1
  64. package/dist/r/base/search.json +74 -66
  65. package/dist/r/base/sftp-storage.json +18 -1
  66. package/dist/r/base/sharepoint-storage.json +2 -1
  67. package/dist/r/base/sharing.json +58 -64
  68. package/dist/r/base/spreadsheet-grid.json +20 -0
  69. package/dist/r/base/spreadsheet-viewer.json +62 -0
  70. package/dist/r/base/storj-storage.json +8 -1
  71. package/dist/r/base/streamdown-math.json +35 -0
  72. package/dist/r/base/streamdown-mermaid.json +34 -0
  73. package/dist/r/base/supabase-storage.json +8 -1
  74. package/dist/r/base/tencent-storage.json +13 -1
  75. package/dist/r/base/tigris-storage.json +8 -1
  76. package/dist/r/base/uploadthing-storage.json +2 -1
  77. package/dist/r/base/vercel-blob-storage.json +3 -1
  78. package/dist/r/base/vercel-gateway.json +7 -9
  79. package/dist/r/base/vercel-sandbox.json +8 -26
  80. package/dist/r/base/video-viewer.json +42 -0
  81. package/dist/r/base/vultr-storage.json +13 -1
  82. package/dist/r/base/wasabi-storage.json +13 -1
  83. package/dist/r/base/webdav-storage.json +13 -1
  84. package/dist/r/base/yandex-storage.json +8 -1
  85. package/dist/r/bunny-storage-storage.json +2 -1
  86. package/dist/r/cloudinary-storage.json +2 -1
  87. package/dist/r/credits.json +24 -46
  88. package/dist/r/deep-research.json +55 -141
  89. package/dist/r/default-sandbox.json +35 -0
  90. package/dist/r/desktop.json +129 -0
  91. package/dist/r/digitalocean-spaces-storage.json +13 -1
  92. package/dist/r/docker-sandbox.json +35 -0
  93. package/dist/r/dropbox-storage.json +2 -1
  94. package/dist/r/eve/deep-research.json +47 -0
  95. package/dist/r/eve/registry.json +53 -0
  96. package/dist/r/exoscale-storage.json +13 -1
  97. package/dist/r/feedback.json +31 -53
  98. package/dist/r/filebase-storage.json +8 -1
  99. package/dist/r/firebase-storage-storage.json +2 -1
  100. package/dist/r/followup-suggestions.json +44 -66
  101. package/dist/r/ftp-storage.json +18 -1
  102. package/dist/r/gcs-storage.json +8 -1
  103. package/dist/r/generate-image.json +22 -16
  104. package/dist/r/generate-video.json +16 -10
  105. package/dist/r/google-drive-storage.json +2 -1
  106. package/dist/r/guest-chat.json +166 -0
  107. package/dist/r/hetzner-storage.json +13 -1
  108. package/dist/r/ibm-cos-storage.json +13 -1
  109. package/dist/r/idrive-e2-storage.json +13 -1
  110. package/dist/r/image-viewer.json +49 -0
  111. package/dist/r/just-bash-sandbox.json +32 -0
  112. package/dist/r/litellm-gateway.json +5 -8
  113. package/dist/r/mcp.json +128 -121
  114. package/dist/r/memory-storage.json +5 -3
  115. package/dist/r/minio-storage.json +13 -1
  116. package/dist/r/model-preferences.json +41 -55
  117. package/dist/r/neon-storage.json +8 -1
  118. package/dist/r/netlify-blobs-storage.json +10 -2
  119. package/dist/r/onedrive-storage.json +2 -1
  120. package/dist/r/openai-compatible-gateway.json +5 -8
  121. package/dist/r/openai-gateway.json +5 -8
  122. package/dist/r/openrouter-gateway.json +4 -8
  123. package/dist/r/oracle-cloud-storage.json +18 -1
  124. package/dist/r/ovhcloud-storage.json +13 -1
  125. package/dist/r/pocketbase-storage.json +2 -1
  126. package/dist/r/projects.json +107 -108
  127. package/dist/r/r2-storage.json +9 -1
  128. package/dist/r/radix/ai-titles.json +14 -17
  129. package/dist/r/radix/akamai-storage.json +13 -1
  130. package/dist/r/radix/alibaba-storage.json +13 -1
  131. package/dist/r/radix/appwrite-storage.json +8 -1
  132. package/dist/r/radix/archil-storage.json +8 -1
  133. package/dist/r/radix/attach-workspace-file.json +82 -0
  134. package/dist/r/radix/attachment-uploads.json +24 -35
  135. package/dist/r/radix/azure-storage.json +8 -1
  136. package/dist/r/radix/backblaze-b2-storage.json +13 -1
  137. package/dist/r/radix/bunny-storage-storage.json +2 -1
  138. package/dist/r/radix/cloudinary-storage.json +2 -1
  139. package/dist/r/radix/credits.json +24 -46
  140. package/dist/r/radix/deep-research.json +55 -141
  141. package/dist/r/radix/default-sandbox.json +35 -0
  142. package/dist/r/radix/desktop.json +129 -0
  143. package/dist/r/radix/digitalocean-spaces-storage.json +13 -1
  144. package/dist/r/radix/docker-sandbox.json +35 -0
  145. package/dist/r/radix/dropbox-storage.json +2 -1
  146. package/dist/r/radix/exoscale-storage.json +13 -1
  147. package/dist/r/radix/feedback.json +31 -53
  148. package/dist/r/radix/filebase-storage.json +8 -1
  149. package/dist/r/radix/firebase-storage-storage.json +2 -1
  150. package/dist/r/radix/followup-suggestions.json +44 -66
  151. package/dist/r/radix/ftp-storage.json +18 -1
  152. package/dist/r/radix/gcs-storage.json +8 -1
  153. package/dist/r/radix/generate-image.json +22 -16
  154. package/dist/r/radix/generate-video.json +16 -10
  155. package/dist/r/radix/google-drive-storage.json +2 -1
  156. package/dist/r/radix/guest-chat.json +166 -0
  157. package/dist/r/radix/hetzner-storage.json +13 -1
  158. package/dist/r/radix/ibm-cos-storage.json +13 -1
  159. package/dist/r/radix/idrive-e2-storage.json +13 -1
  160. package/dist/r/radix/image-viewer.json +49 -0
  161. package/dist/r/radix/just-bash-sandbox.json +32 -0
  162. package/dist/r/radix/litellm-gateway.json +5 -8
  163. package/dist/r/radix/mcp.json +128 -121
  164. package/dist/r/radix/memory-storage.json +5 -3
  165. package/dist/r/radix/minio-storage.json +13 -1
  166. package/dist/r/radix/model-preferences.json +41 -55
  167. package/dist/r/radix/neon-storage.json +8 -1
  168. package/dist/r/radix/netlify-blobs-storage.json +10 -2
  169. package/dist/r/radix/onedrive-storage.json +2 -1
  170. package/dist/r/radix/openai-compatible-gateway.json +5 -8
  171. package/dist/r/radix/openai-gateway.json +5 -8
  172. package/dist/r/radix/openrouter-gateway.json +4 -8
  173. package/dist/r/radix/oracle-cloud-storage.json +18 -1
  174. package/dist/r/radix/ovhcloud-storage.json +13 -1
  175. package/dist/r/radix/pocketbase-storage.json +2 -1
  176. package/dist/r/radix/projects.json +107 -108
  177. package/dist/r/radix/r2-storage.json +9 -1
  178. package/dist/r/radix/registry.json +2339 -2554
  179. package/dist/r/radix/s3-storage.json +15 -1
  180. package/dist/r/radix/scaleway-storage.json +13 -1
  181. package/dist/r/radix/search.json +74 -66
  182. package/dist/r/radix/sftp-storage.json +18 -1
  183. package/dist/r/radix/sharepoint-storage.json +2 -1
  184. package/dist/r/radix/sharing.json +58 -64
  185. package/dist/r/radix/spreadsheet-grid.json +20 -0
  186. package/dist/r/radix/spreadsheet-viewer.json +62 -0
  187. package/dist/r/radix/storj-storage.json +8 -1
  188. package/dist/r/radix/streamdown-math.json +35 -0
  189. package/dist/r/radix/streamdown-mermaid.json +34 -0
  190. package/dist/r/radix/supabase-storage.json +8 -1
  191. package/dist/r/radix/tencent-storage.json +13 -1
  192. package/dist/r/radix/tigris-storage.json +8 -1
  193. package/dist/r/radix/uploadthing-storage.json +2 -1
  194. package/dist/r/radix/vercel-blob-storage.json +3 -1
  195. package/dist/r/radix/vercel-gateway.json +7 -9
  196. package/dist/r/radix/vercel-sandbox.json +8 -26
  197. package/dist/r/radix/video-viewer.json +42 -0
  198. package/dist/r/radix/vultr-storage.json +13 -1
  199. package/dist/r/radix/wasabi-storage.json +13 -1
  200. package/dist/r/radix/webdav-storage.json +13 -1
  201. package/dist/r/radix/yandex-storage.json +8 -1
  202. package/dist/r/registry.json +2340 -2555
  203. package/dist/r/s3-storage.json +15 -1
  204. package/dist/r/scaleway-storage.json +13 -1
  205. package/dist/r/search.json +74 -66
  206. package/dist/r/sftp-storage.json +18 -1
  207. package/dist/r/sharepoint-storage.json +2 -1
  208. package/dist/r/sharing.json +58 -64
  209. package/dist/r/spreadsheet-grid.json +20 -0
  210. package/dist/r/spreadsheet-viewer.json +62 -0
  211. package/dist/r/storj-storage.json +8 -1
  212. package/dist/r/streamdown-math.json +35 -0
  213. package/dist/r/streamdown-mermaid.json +34 -0
  214. package/dist/r/supabase-storage.json +8 -1
  215. package/dist/r/tencent-storage.json +13 -1
  216. package/dist/r/tigris-storage.json +8 -1
  217. package/dist/r/uploadthing-storage.json +2 -1
  218. package/dist/r/vercel-blob-storage.json +3 -1
  219. package/dist/r/vercel-gateway.json +7 -9
  220. package/dist/r/vercel-sandbox.json +8 -26
  221. package/dist/r/video-viewer.json +42 -0
  222. package/dist/r/vultr-storage.json +13 -1
  223. package/dist/r/wasabi-storage.json +13 -1
  224. package/dist/r/webdav-storage.json +13 -1
  225. package/dist/r/yandex-storage.json +8 -1
  226. package/package.json +19 -40
  227. package/dist/r/base/code-documents.json +0 -96
  228. package/dist/r/base/code-execution-runtime.json +0 -25
  229. package/dist/r/base/code-execution-ui.json +0 -32
  230. package/dist/r/base/code-execution.json +0 -69
  231. package/dist/r/base/daytona-sandbox.json +0 -55
  232. package/dist/r/base/delete-document.json +0 -58
  233. package/dist/r/base/firecrawl-search.json +0 -72
  234. package/dist/r/base/get-weather.json +0 -52
  235. package/dist/r/base/langfuse.json +0 -63
  236. package/dist/r/base/read-document.json +0 -34
  237. package/dist/r/base/retrieve-url.json +0 -69
  238. package/dist/r/base/saved-code-execution.json +0 -84
  239. package/dist/r/base/sheet-documents.json +0 -94
  240. package/dist/r/base/tavily-search.json +0 -72
  241. package/dist/r/base/text-documents.json +0 -117
  242. package/dist/r/base/vercel-analytics.json +0 -46
  243. package/dist/r/base/vercel-speed-insights.json +0 -46
  244. package/dist/r/base/word-count.json +0 -51
  245. package/dist/r/code-documents.json +0 -96
  246. package/dist/r/code-execution-runtime.json +0 -25
  247. package/dist/r/code-execution-ui.json +0 -32
  248. package/dist/r/code-execution.json +0 -69
  249. package/dist/r/daytona-sandbox.json +0 -55
  250. package/dist/r/delete-document.json +0 -58
  251. package/dist/r/firecrawl-search.json +0 -72
  252. package/dist/r/get-weather.json +0 -52
  253. package/dist/r/langfuse.json +0 -63
  254. package/dist/r/radix/code-documents.json +0 -96
  255. package/dist/r/radix/code-execution-runtime.json +0 -25
  256. package/dist/r/radix/code-execution-ui.json +0 -32
  257. package/dist/r/radix/code-execution.json +0 -69
  258. package/dist/r/radix/daytona-sandbox.json +0 -55
  259. package/dist/r/radix/delete-document.json +0 -58
  260. package/dist/r/radix/firecrawl-search.json +0 -72
  261. package/dist/r/radix/get-weather.json +0 -52
  262. package/dist/r/radix/langfuse.json +0 -63
  263. package/dist/r/radix/read-document.json +0 -34
  264. package/dist/r/radix/retrieve-url.json +0 -69
  265. package/dist/r/radix/saved-code-execution.json +0 -84
  266. package/dist/r/radix/sheet-documents.json +0 -94
  267. package/dist/r/radix/tavily-search.json +0 -72
  268. package/dist/r/radix/text-documents.json +0 -117
  269. package/dist/r/radix/vercel-analytics.json +0 -46
  270. package/dist/r/radix/vercel-speed-insights.json +0 -46
  271. package/dist/r/radix/word-count.json +0 -51
  272. package/dist/r/read-document.json +0 -34
  273. package/dist/r/retrieve-url.json +0 -69
  274. package/dist/r/saved-code-execution.json +0 -84
  275. package/dist/r/sheet-documents.json +0 -94
  276. package/dist/r/tavily-search.json +0 -72
  277. package/dist/r/text-documents.json +0 -117
  278. package/dist/r/vercel-analytics.json +0 -46
  279. package/dist/r/vercel-speed-insights.json +0 -46
  280. package/dist/r/word-count.json +0 -51
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
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.",
4
+ "title": "No persistent storage",
5
+ "description": "Files are temporary and disappear when the server restarts.",
6
6
  "dependencies": [
7
7
  "files-sdk@2.5.0"
8
8
  ],
@@ -11,12 +11,14 @@
11
11
  "path": "src/storage/memory/storage-provider.ts",
12
12
  "content": "export { memory as createStorageAdapter } from \"files-sdk/memory\";\n",
13
13
  "type": "registry:file",
14
- "target": "~/lib/storage-provider.ts"
14
+ "target": "~/chatjs/providers/storage.ts"
15
15
  }
16
16
  ],
17
17
  "meta": {
18
+ "icon": "minus",
18
19
  "chatjs": {
19
20
  "configKeys": [],
21
+ "configFields": [],
20
22
  "contractVersion": 1,
21
23
  "envRequirements": [],
22
24
  "id": "memory",
@@ -14,7 +14,7 @@
14
14
  "path": "src/storage/minio/storage-provider.ts",
15
15
  "content": "export { minio as createStorageAdapter } from \"files-sdk/minio\";\n",
16
16
  "type": "registry:file",
17
- "target": "~/lib/storage-provider.ts"
17
+ "target": "~/chatjs/providers/storage.ts"
18
18
  }
19
19
  ],
20
20
  "meta": {
@@ -23,6 +23,18 @@
23
23
  "bucket",
24
24
  "endpoint"
25
25
  ],
26
+ "configFields": [
27
+ {
28
+ "key": "bucket",
29
+ "label": "bucket",
30
+ "type": "text"
31
+ },
32
+ {
33
+ "key": "endpoint",
34
+ "label": "endpoint",
35
+ "type": "text"
36
+ }
37
+ ],
26
38
  "contractVersion": 1,
27
39
  "envRequirements": [
28
40
  {
@@ -13,118 +13,104 @@
13
13
  "path": "src/plugins/model-preferences/src/apply-model-preferences.ts",
14
14
  "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",
15
15
  "type": "registry:file",
16
- "target": "~/plugins/model-preferences/apply-model-preferences.ts"
16
+ "target": "~/chatjs/plugins/model-preferences/apply-model-preferences.ts"
17
17
  },
18
18
  {
19
- "path": "src/plugins/model-preferences/src/client-plugin.ts",
20
- "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",
19
+ "path": "src/plugins/model-preferences/src/chat-ui.ts",
20
+ "content": "\"use client\";\nimport { definePlugin, slot } from \"@/chatjs/core/ui/slots\";\nimport { ModelSettingsLink } from \"@/components/chat-slots\";\nimport { ModelPreferencesLink } from \"./settings-link\";\n\nexport const chatUi = definePlugin({\n id: \"model-preferences\",\n slots: [slot(ModelSettingsLink, ModelPreferencesLink)],\n});\n",
21
21
  "type": "registry:file",
22
- "target": "~/plugins/model-preferences/client-plugin.ts"
22
+ "target": "~/chatjs/plugins/model-preferences/chat-ui.ts"
23
+ },
24
+ {
25
+ "path": "src/plugins/model-preferences/src/settings-link.tsx",
26
+ "content": "\"use client\";\nimport { Cpu, ChevronRightIcon } from \"lucide-react\";\nimport { SettingsLink } from \"@/components/settings/settings-navigation-link\";\nimport { SidebarLink } from \"@/components/navigation-links\";\nimport { SidebarMenuItem } from \"@/components/ui/sidebar\";\nimport { InternalLink } from \"@/components/internal-link\";\nimport { buttonVariants } from \"@/components/ui/button\";\n\nexport const ModelPreferencesLink = ({\n surface,\n}: {\n readonly surface: \"sidebar\" | \"settings\" | \"picker\";\n}) => {\n if (surface === \"settings\") {\n return (\n <SettingsLink href=\"/settings/models\">\n <Cpu className=\"size-4\" />\n Models\n </SettingsLink>\n );\n }\n if (surface === \"sidebar\") {\n return (\n <SidebarMenuItem>\n <SidebarLink\n tooltip=\"Models\"\n aria-label=\"Models\"\n href=\"/settings/models\"\n >\n <Cpu className=\"size-4\" />\n <span className=\"group-data-[collapsible=icon]:hidden\">Models</span>\n </SidebarLink>\n </SidebarMenuItem>\n );\n }\n return (\n <div className=\"border-t p-2\">\n <InternalLink\n href=\"/settings/models\"\n className={buttonVariants({\n className: \"w-full justify-between\",\n size: \"sm\",\n variant: \"ghost\",\n })}\n >\n Manage models\n <ChevronRightIcon className=\"h-4 w-4\" />\n </InternalLink>\n </div>\n );\n};\n",
27
+ "type": "registry:file",
28
+ "target": "~/chatjs/plugins/model-preferences/settings-link.tsx"
23
29
  },
24
30
  {
25
31
  "path": "src/plugins/model-preferences/src/model-preferences-queries.ts",
26
32
  "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",
27
33
  "type": "registry:file",
28
- "target": "~/plugins/model-preferences/model-preferences-queries.ts"
34
+ "target": "~/chatjs/plugins/model-preferences/model-preferences-queries.ts"
29
35
  },
30
36
  {
31
37
  "path": "src/plugins/model-preferences/src/model-preferences-schema.ts",
32
38
  "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",
33
39
  "type": "registry:file",
34
- "target": "~/plugins/model-preferences/model-preferences-schema.ts"
40
+ "target": "~/chatjs/plugins/model-preferences/model-preferences-schema.ts"
35
41
  },
36
42
  {
37
43
  "path": "src/plugins/model-preferences/src/model-row.tsx",
38
- "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",
44
+ "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 whitespace-normal\">\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 aria-label={\n model.reasoning === true ? `${model.name} (reasoning)` : model.name\n }\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",
39
45
  "type": "registry:file",
40
- "target": "~/plugins/model-preferences/model-row.tsx"
46
+ "target": "~/chatjs/plugins/model-preferences/model-row.tsx"
41
47
  },
42
48
  {
43
49
  "path": "src/plugins/model-preferences/src/models-page.tsx",
44
50
  "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",
45
51
  "type": "registry:file",
46
- "target": "~/plugins/model-preferences/models-page.tsx"
52
+ "target": "~/chatjs/plugins/model-preferences/models-page.tsx"
47
53
  },
48
54
  {
49
55
  "path": "src/plugins/model-preferences/src/models-settings.tsx",
50
- "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",
56
+ "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 aria-label=\"Refresh model preferences\"\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",
51
57
  "type": "registry:file",
52
- "target": "~/plugins/model-preferences/models-settings.tsx"
58
+ "target": "~/chatjs/plugins/model-preferences/models-settings.tsx"
53
59
  },
54
60
  {
55
61
  "path": "src/plugins/model-preferences/src/models-table.tsx",
56
62
  "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",
57
63
  "type": "registry:file",
58
- "target": "~/plugins/model-preferences/models-table.tsx"
64
+ "target": "~/chatjs/plugins/model-preferences/models-table.tsx"
59
65
  },
60
66
  {
61
67
  "path": "src/plugins/model-preferences/src/router.ts",
62
- "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",
68
+ "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\nconst modelPreferencesProcedures = {\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\nexport const router = createTRPCRouter({\n modelPreferences: modelPreferencesProcedures,\n});\n",
63
69
  "type": "registry:file",
64
- "target": "~/plugins/model-preferences/router.ts"
70
+ "target": "~/chatjs/plugins/model-preferences/router.ts"
65
71
  },
66
72
  {
67
- "path": "src/plugins/model-preferences/src/server-plugin.ts",
68
- "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",
73
+ "path": "src/plugins/model-preferences/src/model-visibility.ts",
74
+ "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 useModelVisibility = (\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
75
  "type": "registry:file",
70
- "target": "~/plugins/model-preferences/server-plugin.ts"
71
- },
72
- {
73
- "path": "src/plugins/model-preferences/src/use-model-preferences.ts",
74
- "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",
75
- "type": "registry:file",
76
- "target": "~/plugins/model-preferences/use-model-preferences.ts"
76
+ "target": "~/chatjs/plugins/model-preferences/model-visibility.ts"
77
77
  },
78
78
  {
79
79
  "path": "src/plugins/model-preferences/adapters/app/(chat)/settings/models/page.tsx",
80
- "content": "export { ModelsSettingsPage as default } from \"@/plugins/model-preferences/models-page\";\n",
80
+ "content": "// ChatJS source: model-preferences. Ownership: chatjs/plugins/model-preferences/plugin.json.\nexport { ModelsSettingsPage as default } from \"@/chatjs/plugins/model-preferences/models-page\";\n",
81
81
  "type": "registry:file",
82
82
  "target": "~/app/(chat)/settings/models/page.tsx"
83
83
  },
84
84
  {
85
85
  "path": "dist/source/model-preferences.json",
86
- "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",
86
+ "content": "{\n \"contractVersion\": 3,\n \"uiBase\": \"base\",\n \"id\": \"model-preferences\",\n \"kind\": \"plugin\",\n \"files\": [\n \"chatjs/plugins/model-preferences/apply-model-preferences.ts\",\n \"chatjs/plugins/model-preferences/chat-ui.ts\",\n \"chatjs/plugins/model-preferences/settings-link.tsx\",\n \"chatjs/plugins/model-preferences/model-preferences-queries.ts\",\n \"chatjs/plugins/model-preferences/model-preferences-schema.ts\",\n \"chatjs/plugins/model-preferences/model-row.tsx\",\n \"chatjs/plugins/model-preferences/models-page.tsx\",\n \"chatjs/plugins/model-preferences/models-settings.tsx\",\n \"chatjs/plugins/model-preferences/models-table.tsx\",\n \"chatjs/plugins/model-preferences/router.ts\",\n \"chatjs/plugins/model-preferences/model-visibility.ts\",\n \"app/(chat)/settings/models/page.tsx\"\n ],\n \"databaseSchemas\": [\n \"chatjs/plugins/model-preferences/model-preferences-schema.ts\"\n ]\n}\n",
87
87
  "type": "registry:file",
88
- "target": "~/plugins/model-preferences/chatjs.json"
88
+ "target": "~/chatjs/plugins/model-preferences/plugin.json"
89
89
  }
90
90
  ],
91
91
  "meta": {
92
92
  "chatjs": {
93
+ "contractVersion": 3,
94
+ "uiBase": "base",
93
95
  "id": "model-preferences",
94
96
  "kind": "plugin",
95
97
  "files": [
96
- "plugins/model-preferences/apply-model-preferences.ts",
97
- "plugins/model-preferences/client-plugin.ts",
98
- "plugins/model-preferences/model-preferences-queries.ts",
99
- "plugins/model-preferences/model-preferences-schema.ts",
100
- "plugins/model-preferences/model-row.tsx",
101
- "plugins/model-preferences/models-page.tsx",
102
- "plugins/model-preferences/models-settings.tsx",
103
- "plugins/model-preferences/models-table.tsx",
104
- "plugins/model-preferences/router.ts",
105
- "plugins/model-preferences/server-plugin.ts",
106
- "plugins/model-preferences/use-model-preferences.ts",
98
+ "chatjs/plugins/model-preferences/apply-model-preferences.ts",
99
+ "chatjs/plugins/model-preferences/chat-ui.ts",
100
+ "chatjs/plugins/model-preferences/settings-link.tsx",
101
+ "chatjs/plugins/model-preferences/model-preferences-queries.ts",
102
+ "chatjs/plugins/model-preferences/model-preferences-schema.ts",
103
+ "chatjs/plugins/model-preferences/model-row.tsx",
104
+ "chatjs/plugins/model-preferences/models-page.tsx",
105
+ "chatjs/plugins/model-preferences/models-settings.tsx",
106
+ "chatjs/plugins/model-preferences/models-table.tsx",
107
+ "chatjs/plugins/model-preferences/router.ts",
108
+ "chatjs/plugins/model-preferences/model-visibility.ts",
107
109
  "app/(chat)/settings/models/page.tsx"
108
110
  ],
109
111
  "databaseSchemas": [
110
- "plugins/model-preferences/model-preferences-schema.ts"
111
- ],
112
- "server": {
113
- "export": "modelPreferences",
114
- "routers": [
115
- "modelPreferences"
116
- ]
117
- },
118
- "client": {
119
- "export": "modelPreferencesClient",
120
- "composerControls": [],
121
- "settingsItems": [
122
- "models"
123
- ],
124
- "modelVisibility": true
125
- },
126
- "contractVersion": 2,
127
- "uiBase": "base"
112
+ "chatjs/plugins/model-preferences/model-preferences-schema.ts"
113
+ ]
128
114
  }
129
115
  },
130
116
  "type": "registry:item"
@@ -14,7 +14,7 @@
14
14
  "path": "src/storage/neon/storage-provider.ts",
15
15
  "content": "export { neon as createStorageAdapter } from \"files-sdk/neon\";\n",
16
16
  "type": "registry:file",
17
- "target": "~/lib/storage-provider.ts"
17
+ "target": "~/chatjs/providers/storage.ts"
18
18
  }
19
19
  ],
20
20
  "meta": {
@@ -22,6 +22,13 @@
22
22
  "configKeys": [
23
23
  "bucket"
24
24
  ],
25
+ "configFields": [
26
+ {
27
+ "key": "bucket",
28
+ "label": "bucket",
29
+ "type": "text"
30
+ }
31
+ ],
25
32
  "contractVersion": 1,
26
33
  "envRequirements": [
27
34
  {
@@ -12,13 +12,21 @@
12
12
  "path": "src/storage/netlify-blobs/storage-provider.ts",
13
13
  "content": "export { netlifyBlobs as createStorageAdapter } from \"files-sdk/netlify-blobs\";\n",
14
14
  "type": "registry:file",
15
- "target": "~/lib/storage-provider.ts"
15
+ "target": "~/chatjs/providers/storage.ts"
16
16
  }
17
17
  ],
18
18
  "meta": {
19
19
  "chatjs": {
20
20
  "configKeys": [
21
- "store name"
21
+ "name"
22
+ ],
23
+ "configFields": [
24
+ {
25
+ "key": "name",
26
+ "label": "store name",
27
+ "type": "text",
28
+ "legacyKey": "store name"
29
+ }
22
30
  ],
23
31
  "contractVersion": 1,
24
32
  "envRequirements": [],
@@ -13,12 +13,13 @@
13
13
  "path": "src/storage/onedrive/storage-provider.ts",
14
14
  "content": "export { onedrive as createStorageAdapter } from \"files-sdk/onedrive\";\n",
15
15
  "type": "registry:file",
16
- "target": "~/lib/storage-provider.ts"
16
+ "target": "~/chatjs/providers/storage.ts"
17
17
  }
18
18
  ],
19
19
  "meta": {
20
20
  "chatjs": {
21
21
  "configKeys": [],
22
+ "configFields": [],
22
23
  "contractVersion": 1,
23
24
  "envRequirements": [
24
25
  {
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
3
  "name": "openai-compatible-gateway",
4
- "title": "OpenAICompatibleGateway",
4
+ "title": "OpenAI Compatible",
5
5
  "dependencies": [
6
- "@chat-js/gateways@0.2.0",
7
- "@ai-sdk/openai-compatible@3.0.44",
6
+ "@ai-sdk/openai-compatible@3.0.92",
8
7
  "zod@4.5.4"
9
8
  ],
10
9
  "files": [
11
10
  {
12
11
  "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",
12
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\n\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\n\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\n\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\n\nimport type { ImageModel } from \"ai\";\nimport { createOpenAICompatible } from \"@ai-sdk/openai-compatible\";\nimport { z } from \"zod\";\n\nconst MODEL_DISCOVERY_TIMEOUT_MS = 10_000;\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 throw new Error(\"OPENAI_COMPATIBLE_BASE_URL is not configured\");\n }\n\n const url = `${baseURL}/models`;\n this.log.debug({ url }, \"Fetching models from OpenAI-compatible provider\");\n\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 signal: AbortSignal.timeout(MODEL_DISCOVERY_TIMEOUT_MS),\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(\n `Failed to fetch models: ${response.status} ${response.statusText}`\n );\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 }\n}\nexport { OpenAICompatibleGateway as Gateway, OpenAICompatibleGateway };\n",
14
13
  "type": "registry:file",
15
- "target": "~/lib/ai/gateway.ts"
14
+ "target": "~/chatjs/providers/gateway.ts"
16
15
  }
17
16
  ],
18
17
  "meta": {
18
+ "icon": "plug",
19
19
  "chatjs": {
20
20
  "capabilities": {
21
21
  "image": true,
@@ -23,9 +23,6 @@
23
23
  },
24
24
  "contractVersion": 1,
25
25
  "defaults": {
26
- "anonymousModels": [
27
- "gpt-5-nano"
28
- ],
29
26
  "curatedDefaults": [
30
27
  "gpt-5-nano",
31
28
  "gpt-5-mini",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
3
  "name": "openai-gateway",
4
- "title": "OpenAIGateway",
4
+ "title": "OpenAI",
5
5
  "dependencies": [
6
- "@chat-js/gateways@0.2.0",
7
- "@ai-sdk/openai@4.0.59",
6
+ "@ai-sdk/openai@4.0.117",
8
7
  "zod@4.5.4"
9
8
  ],
10
9
  "files": [
11
10
  {
12
11
  "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",
12
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\n\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\n\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\n\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\n\nimport type { ImageModel } from \"ai\";\nimport { createOpenAI } from \"@ai-sdk/openai\";\nimport { z } from \"zod\";\n\nconst MODEL_DISCOVERY_TIMEOUT_MS = 10_000;\nconst MODEL_ID_PARAMETER_INDEX = 0;\ntype OpenAiLanguageModelId = Parameters<\n ReturnType<typeof createOpenAI>[\"languageModel\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\ntype OpenAiImageModelId = Parameters<\n ReturnType<typeof createOpenAI>[\"image\"]\n>[typeof MODEL_ID_PARAMETER_INDEX];\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(modelId: OpenAiLanguageModelId): 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 throw new Error(\"OPENAI_API_KEY is not configured\");\n }\n\n const url = \"https://api.openai.com/v1/models\";\n this.log.debug({ url }, \"Fetching models from OpenAI\");\n\n const response = await this.fetch(url, {\n signal: AbortSignal.timeout(MODEL_DISCOVERY_TIMEOUT_MS),\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(\n `Failed to fetch models: ${response.status} ${response.statusText}`\n );\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 }\n}\nexport { OpenAIGateway as Gateway, OpenAIGateway };\n",
14
13
  "type": "registry:file",
15
- "target": "~/lib/ai/gateway.ts"
14
+ "target": "~/chatjs/providers/gateway.ts"
16
15
  }
17
16
  ],
18
17
  "meta": {
18
+ "icon": "setup/openai",
19
19
  "chatjs": {
20
20
  "capabilities": {
21
21
  "image": true,
@@ -23,9 +23,6 @@
23
23
  },
24
24
  "contractVersion": 1,
25
25
  "defaults": {
26
- "anonymousModels": [
27
- "gpt-5-nano"
28
- ],
29
26
  "curatedDefaults": [
30
27
  "gpt-5-nano",
31
28
  "gpt-5-mini",
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
3
3
  "name": "openrouter-gateway",
4
- "title": "OpenRouterGateway",
4
+ "title": "OpenRouter",
5
5
  "dependencies": [
6
- "@chat-js/gateways@0.2.0",
7
6
  "@openrouter/ai-sdk-provider@3.0.0",
8
7
  "zod@4.5.4"
9
8
  ],
10
9
  "files": [
11
10
  {
12
11
  "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",
12
+ "content": "import type { LanguageModelV4 } from \"@ai-sdk/provider\";\nimport type { AiGatewayModel } from \"@/chatjs/core/gateway/models\";\n\nimport type { GatewayProvider } from \"@/chatjs/core/gateway/gateway-provider\";\n\nimport { GatewayRuntime } from \"@/chatjs/core/gateway/runtime\";\n\nimport { createOpenRouter } from \"@openrouter/ai-sdk-provider\";\n\nimport { z } from \"zod\";\n\nconst MODEL_DISCOVERY_TIMEOUT_MS = 10_000;\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 throw new Error(\"OPENROUTER_API_KEY is not configured\");\n }\n\n const url = OPENROUTER_MODELS_URL;\n this.log.debug({ url }, \"Fetching models from OpenRouter\");\n\n const response = await this.fetch(url, {\n signal: AbortSignal.timeout(MODEL_DISCOVERY_TIMEOUT_MS),\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(\n `Failed to fetch models: ${response.status} ${response.statusText}`\n );\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 }\n}\nexport { OpenRouterGateway as Gateway, OpenRouterGateway };\n",
14
13
  "type": "registry:file",
15
- "target": "~/lib/ai/gateway.ts"
14
+ "target": "~/chatjs/providers/gateway.ts"
16
15
  }
17
16
  ],
18
17
  "meta": {
18
+ "icon": "setup/openrouter",
19
19
  "chatjs": {
20
20
  "capabilities": {
21
21
  "image": false,
@@ -23,10 +23,6 @@
23
23
  },
24
24
  "contractVersion": 1,
25
25
  "defaults": {
26
- "anonymousModels": [
27
- "google/gemini-2.5-flash-lite",
28
- "openai/gpt-5-nano"
29
- ],
30
26
  "curatedDefaults": [
31
27
  "openai/gpt-5-nano",
32
28
  "openai/gpt-5-mini",
@@ -14,7 +14,7 @@
14
14
  "path": "src/storage/oracle-cloud/storage-provider.ts",
15
15
  "content": "export { oracleCloud as createStorageAdapter } from \"files-sdk/oracle-cloud\";\n",
16
16
  "type": "registry:file",
17
- "target": "~/lib/storage-provider.ts"
17
+ "target": "~/chatjs/providers/storage.ts"
18
18
  }
19
19
  ],
20
20
  "meta": {
@@ -24,6 +24,23 @@
24
24
  "region",
25
25
  "endpoint"
26
26
  ],
27
+ "configFields": [
28
+ {
29
+ "key": "bucket",
30
+ "label": "bucket",
31
+ "type": "text"
32
+ },
33
+ {
34
+ "key": "region",
35
+ "label": "region",
36
+ "type": "text"
37
+ },
38
+ {
39
+ "key": "endpoint",
40
+ "label": "endpoint",
41
+ "type": "text"
42
+ }
43
+ ],
27
44
  "contractVersion": 1,
28
45
  "envRequirements": [
29
46
  {
@@ -14,7 +14,7 @@
14
14
  "path": "src/storage/ovhcloud/storage-provider.ts",
15
15
  "content": "export { ovhcloud as createStorageAdapter } from \"files-sdk/ovhcloud\";\n",
16
16
  "type": "registry:file",
17
- "target": "~/lib/storage-provider.ts"
17
+ "target": "~/chatjs/providers/storage.ts"
18
18
  }
19
19
  ],
20
20
  "meta": {
@@ -23,6 +23,18 @@
23
23
  "bucket",
24
24
  "region"
25
25
  ],
26
+ "configFields": [
27
+ {
28
+ "key": "bucket",
29
+ "label": "bucket",
30
+ "type": "text"
31
+ },
32
+ {
33
+ "key": "region",
34
+ "label": "region",
35
+ "type": "text"
36
+ }
37
+ ],
26
38
  "contractVersion": 1,
27
39
  "envRequirements": [
28
40
  {
@@ -12,12 +12,13 @@
12
12
  "path": "src/storage/pocketbase/storage-provider.ts",
13
13
  "content": "export { pocketbase as createStorageAdapter } from \"files-sdk/pocketbase\";\n",
14
14
  "type": "registry:file",
15
- "target": "~/lib/storage-provider.ts"
15
+ "target": "~/chatjs/providers/storage.ts"
16
16
  }
17
17
  ],
18
18
  "meta": {
19
19
  "chatjs": {
20
20
  "configKeys": [],
21
+ "configFields": [],
21
22
  "contractVersion": 1,
22
23
  "envRequirements": [
23
24
  {