chat-js 1.0.0-alpha.7 → 1.0.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 (305) hide show
  1. package/README.md +8 -6
  2. package/dist/index.js +7487 -6859
  3. package/package.json +2 -2
  4. package/templates/chat-app/AGENTS.md +1 -1
  5. package/templates/chat-app/agent/agent.ts +0 -2
  6. package/templates/chat-app/agent/hooks/followup-suggestions.ts +1 -1
  7. package/templates/chat-app/agent/hooks/projects.ts +1 -1
  8. package/templates/chat-app/agent/hooks/search.ts +1 -1
  9. package/templates/chat-app/agent/instructions/projects.ts +1 -1
  10. package/templates/chat-app/agent/tools/mcp.ts +1 -1
  11. package/templates/chat-app/app/(auth)/device-login/page.tsx +1 -1
  12. package/templates/chat-app/app/(chat)/api/files/upload/route.ts +1 -1
  13. package/templates/chat-app/app/(chat)/chat/{[id] → [chatId]}/page.tsx +4 -4
  14. package/templates/chat-app/app/(chat)/project/[projectId]/chat/[chatId]/page.tsx +1 -1
  15. package/templates/chat-app/app/(chat)/project/[projectId]/page.tsx +1 -1
  16. package/templates/chat-app/app/(chat)/settings/connectors/[connectorId]/page.tsx +1 -1
  17. package/templates/chat-app/app/(chat)/settings/connectors/page.tsx +1 -1
  18. package/templates/chat-app/app/(chat)/settings/models/page.tsx +1 -1
  19. package/templates/chat-app/app/(chat)/share/[id]/page.tsx +1 -1
  20. package/templates/chat-app/app/api/agent-conversations/route.test.ts +5 -5
  21. package/templates/chat-app/app/api/agent-conversations/route.ts +2 -2
  22. package/templates/chat-app/app/api/agent-response-groups/route.test.ts +5 -5
  23. package/templates/chat-app/app/api/agent-response-groups/route.ts +1 -1
  24. package/templates/chat-app/app/api/eve/[...path]/route.test.ts +133 -4
  25. package/templates/chat-app/app/api/eve/[...path]/route.ts +175 -49
  26. package/templates/chat-app/app/api/eve-guest/route.ts +1 -1
  27. package/templates/chat-app/app/api/mcp/oauth/callback/route.ts +1 -1
  28. package/templates/chat-app/app/editor.css +0 -6
  29. package/templates/chat-app/app/layout.tsx +11 -18
  30. package/templates/chat-app/app/opengraph-image.png +0 -0
  31. package/templates/chat-app/chat.config.ts +0 -44
  32. package/templates/chat-app/chatjs/core/chat/compose.ts +4 -4
  33. package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -6
  34. package/templates/chat-app/chatjs/core/gateway/runtime.ts +0 -7
  35. package/templates/chat-app/chatjs/core/installation/contracts.ts +0 -7
  36. package/templates/chat-app/chatjs/core/ui/slots.tsx +15 -5
  37. package/templates/chat-app/chatjs/generated/installed-auth-ui.ts +2 -2
  38. package/templates/chat-app/chatjs/generated/installed-auth.ts +4 -2
  39. package/templates/chat-app/chatjs/generated/installed-billing.ts +2 -2
  40. package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +28 -24
  41. package/templates/chat-app/chatjs/generated/installed-chat.ts +12 -12
  42. package/templates/chat-app/chatjs/generated/installed-cleanup.ts +4 -4
  43. package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +8 -2
  44. package/templates/chat-app/chatjs/generated/installed-layout.ts +2 -2
  45. package/templates/chat-app/chatjs/generated/installed-model-visibility.ts +2 -2
  46. package/templates/chat-app/chatjs/generated/installed-navigation.ts +2 -2
  47. package/templates/chat-app/chatjs/generated/installed-routers.ts +18 -19
  48. package/templates/chat-app/chatjs/generated/installed-session-profiles.ts +5 -3
  49. package/templates/chat-app/chatjs/generated/installed-sign-out.ts +2 -2
  50. package/templates/chat-app/chatjs/generated/installed-signed-out.ts +2 -2
  51. package/templates/chat-app/chatjs/generated/installed-uploads.ts +2 -2
  52. package/templates/chat-app/chatjs/generated/installed.ts +2 -0
  53. package/templates/chat-app/chatjs/plugins/ai-titles/{chat.ts → chat-server.ts} +3 -1
  54. package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +7 -9
  55. package/templates/chat-app/chatjs/plugins/ai-titles/{chatjs.json → plugin.json} +3 -4
  56. package/templates/chat-app/chatjs/plugins/ai-titles/title-queries.ts +4 -4
  57. package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts} +1 -3
  58. package/templates/chat-app/chatjs/plugins/attachment-uploads/plugin.json +16 -0
  59. package/templates/chat-app/chatjs/plugins/credits/billing.ts +3 -1
  60. package/templates/chat-app/chatjs/plugins/credits/{client-plugin.ts → chat-ui.ts} +1 -1
  61. package/templates/chat-app/chatjs/plugins/credits/{chatjs.json → plugin.json} +4 -13
  62. package/templates/chat-app/chatjs/plugins/credits/router.ts +4 -2
  63. package/templates/chat-app/chatjs/plugins/desktop/auth-form.tsx +3 -1
  64. package/templates/chat-app/chatjs/plugins/desktop/auth-server.ts +3 -1
  65. package/templates/chat-app/chatjs/plugins/desktop/{client-plugin.ts → layout-ui.ts} +1 -1
  66. package/templates/chat-app/chatjs/plugins/desktop/navigation.ts +3 -1
  67. package/templates/chat-app/chatjs/plugins/desktop/{chatjs.json → plugin.json} +4 -16
  68. package/templates/chat-app/chatjs/plugins/desktop/sign-out.ts +3 -1
  69. package/templates/chat-app/chatjs/plugins/feedback/chat-server.ts +13 -0
  70. package/templates/chat-app/chatjs/plugins/feedback/{client-plugin.ts → chat-ui.ts} +1 -1
  71. package/templates/chat-app/chatjs/plugins/feedback/feedback-actions.tsx +4 -4
  72. package/templates/chat-app/chatjs/plugins/feedback/feedback-queries.ts +11 -11
  73. package/templates/chat-app/chatjs/plugins/feedback/feedback-schema.ts +2 -2
  74. package/templates/chat-app/chatjs/plugins/feedback/{chatjs.json → plugin.json} +5 -14
  75. package/templates/chat-app/chatjs/plugins/feedback/router.ts +9 -7
  76. package/templates/chat-app/chatjs/plugins/feedback/vote-message.ts +3 -6
  77. package/templates/chat-app/chatjs/plugins/followup-suggestions/{chat.ts → chat-server.ts} +3 -1
  78. package/templates/chat-app/chatjs/plugins/followup-suggestions/{client-plugin.ts → chat-ui.ts} +1 -1
  79. package/templates/chat-app/chatjs/plugins/followup-suggestions/followup-queries.ts +2 -2
  80. package/templates/chat-app/chatjs/plugins/followup-suggestions/{chatjs.json → plugin.json} +5 -17
  81. package/templates/chat-app/chatjs/plugins/followup-suggestions/router.ts +8 -9
  82. package/templates/chat-app/chatjs/plugins/followup-suggestions/suggestions.tsx +2 -7
  83. package/templates/chat-app/chatjs/plugins/followup-suggestions/use-followups.ts +2 -2
  84. package/templates/chat-app/chatjs/plugins/guest-chat/cleanup.ts +1 -7
  85. package/templates/chat-app/chatjs/plugins/guest-chat/guest-auth.ts +1 -0
  86. package/templates/chat-app/chatjs/plugins/guest-chat/instrumentation.ts +6 -0
  87. package/templates/chat-app/chatjs/plugins/guest-chat/{chatjs.json → plugin.json} +6 -12
  88. package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +3 -1
  89. package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +53 -24
  90. package/templates/chat-app/chatjs/plugins/image-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
  91. package/templates/chat-app/chatjs/plugins/image-viewer/plugin.json +11 -0
  92. package/templates/chat-app/chatjs/plugins/mcp/{client-plugin.ts → chat-ui.ts} +1 -1
  93. package/templates/chat-app/chatjs/plugins/mcp/db/encrypted-text.ts +1 -1
  94. package/templates/chat-app/chatjs/plugins/mcp/{chatjs.json → plugin.json} +5 -13
  95. package/templates/chat-app/chatjs/plugins/mcp/router.ts +4 -2
  96. package/templates/chat-app/chatjs/plugins/mcp/routes/connectors-page.tsx +4 -1
  97. package/templates/chat-app/chatjs/plugins/mcp/setup.ts +2 -2
  98. package/templates/chat-app/chatjs/plugins/mcp/ui/connectors-settings.tsx +1 -1
  99. package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-connect-dialog.tsx +1 -1
  100. package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-create-dialog.tsx +1 -1
  101. package/templates/chat-app/chatjs/plugins/mcp/{mcp-env.ts → validate-env.ts} +2 -1
  102. package/templates/chat-app/chatjs/plugins/model-preferences/{client-plugin.ts → chat-ui.ts} +1 -3
  103. package/templates/chat-app/chatjs/plugins/model-preferences/model-row.tsx +3 -0
  104. package/templates/chat-app/chatjs/plugins/model-preferences/{use-model-preferences.ts → model-visibility.ts} +1 -1
  105. package/templates/chat-app/chatjs/plugins/model-preferences/models-settings.tsx +1 -0
  106. package/templates/chat-app/chatjs/plugins/model-preferences/{chatjs.json → plugin.json} +5 -13
  107. package/templates/chat-app/chatjs/plugins/model-preferences/router.ts +5 -1
  108. package/templates/chat-app/chatjs/plugins/projects/{chat.ts → chat-server.ts} +3 -1
  109. package/templates/chat-app/chatjs/plugins/projects/{client-plugin.ts → chat-ui.ts} +1 -1
  110. package/templates/chat-app/chatjs/plugins/projects/conversation-hook.ts +1 -1
  111. package/templates/chat-app/chatjs/plugins/projects/db/project-queries.ts +2 -2
  112. package/templates/chat-app/chatjs/plugins/projects/{chatjs.json → plugin.json} +5 -14
  113. package/templates/chat-app/chatjs/plugins/projects/router.ts +7 -7
  114. package/templates/chat-app/chatjs/plugins/projects/routes/project-page.tsx +10 -1
  115. package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +3 -3
  116. package/templates/chat-app/chatjs/plugins/projects/ui/delete-project-dialog.tsx +0 -3
  117. package/templates/chat-app/chatjs/plugins/projects/ui/eve-move-project-dialog.tsx +1 -1
  118. package/templates/chat-app/chatjs/plugins/projects/ui/project-icon-picker.tsx +1 -0
  119. package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +12 -11
  120. package/templates/chat-app/chatjs/plugins/search/{chat.ts → chat-server.ts} +8 -6
  121. package/templates/chat-app/chatjs/plugins/search/{client-plugin.ts → chat-ui.ts} +1 -1
  122. package/templates/chat-app/chatjs/plugins/search/{chatjs.json → plugin.json} +5 -14
  123. package/templates/chat-app/chatjs/plugins/search/router.ts +4 -2
  124. package/templates/chat-app/chatjs/plugins/search/search-backfill.ts +4 -4
  125. package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +1 -1
  126. package/templates/chat-app/chatjs/plugins/search/search-hook.ts +2 -2
  127. package/templates/chat-app/chatjs/plugins/search/search-queries.ts +13 -13
  128. package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +2 -2
  129. package/templates/chat-app/chatjs/plugins/search/search-schema.ts +3 -3
  130. package/templates/chat-app/chatjs/plugins/sharing/{chat.ts → chat-server.ts} +3 -1
  131. package/templates/chat-app/chatjs/plugins/sharing/{client-plugin.ts → chat-ui.ts} +1 -1
  132. package/templates/chat-app/chatjs/plugins/sharing/{chatjs.json → plugin.json} +5 -14
  133. package/templates/chat-app/chatjs/plugins/sharing/router.ts +4 -2
  134. package/templates/chat-app/chatjs/plugins/sharing/ui/chat-contributions.tsx +9 -11
  135. package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +6 -6
  136. package/templates/chat-app/chatjs/plugins/sharing/ui/share-dialog.tsx +9 -9
  137. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
  138. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/plugin.json +12 -0
  139. package/templates/chat-app/chatjs/plugins/streamdown-math/chat-ui.ts +11 -0
  140. package/templates/chat-app/chatjs/plugins/streamdown-math/plugin.json +6 -0
  141. package/templates/chat-app/chatjs/plugins/streamdown-mermaid/chat-ui.ts +10 -0
  142. package/templates/chat-app/chatjs/plugins/streamdown-mermaid/plugin.json +6 -0
  143. package/templates/chat-app/chatjs/plugins/video-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
  144. package/templates/chat-app/chatjs/plugins/video-viewer/plugin.json +10 -0
  145. package/templates/chat-app/chatjs/providers/gateway.ts +49 -55
  146. package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +2 -2
  147. package/templates/chat-app/chatjs/tools/generate-image/tool.test.ts +3 -14
  148. package/templates/chat-app/components/ai-elements/response.tsx +16 -15
  149. package/templates/chat-app/components/auth-form-view.tsx +35 -43
  150. package/templates/chat-app/components/chat/chat-composer.tsx +90 -27
  151. package/templates/chat-app/components/chat/chat-conversation-screen.tsx +3 -3
  152. package/templates/chat-app/components/chat/chat-navigation.tsx +11 -1
  153. package/templates/chat-app/components/chat/chat-sidebar.tsx +8 -9
  154. package/templates/chat-app/components/chat/chat-transcript.tsx +52 -23
  155. package/templates/chat-app/components/chat-slots.tsx +1 -1
  156. package/templates/chat-app/components/composer/composer-menu.tsx +5 -4
  157. package/templates/chat-app/components/composer/prompt-form.tsx +7 -1
  158. package/templates/chat-app/components/eve/eve-chat-error.tsx +12 -2
  159. package/templates/chat-app/components/eve/eve-chat-header.tsx +5 -7
  160. package/templates/chat-app/components/eve/eve-chat-page.tsx +9 -9
  161. package/templates/chat-app/components/eve/eve-composer.tsx +16 -5
  162. package/templates/chat-app/components/eve/eve-conversation.tsx +342 -209
  163. package/templates/chat-app/components/eve/eve-creation-recovery.tsx +53 -3
  164. package/templates/chat-app/components/eve/eve-deletion-provider.tsx +10 -12
  165. package/templates/chat-app/components/eve/eve-history-list.tsx +4 -9
  166. package/templates/chat-app/components/eve/eve-logical-context.tsx +1 -0
  167. package/templates/chat-app/components/eve/eve-logical-navigation.tsx +3 -3
  168. package/templates/chat-app/components/eve/eve-message-content.tsx +252 -0
  169. package/templates/chat-app/components/eve/eve-message-part.tsx +13 -58
  170. package/templates/chat-app/components/eve/eve-pending-input.tsx +82 -5
  171. package/templates/chat-app/components/eve/eve-runtime-provider.tsx +74 -15
  172. package/templates/chat-app/components/eve/use-eve-composer-draft.ts +64 -26
  173. package/templates/chat-app/components/eve/use-eve-fork.ts +14 -16
  174. package/templates/chat-app/components/eve/use-logical-commands.ts +3 -3
  175. package/templates/chat-app/components/eve/use-new-eve-conversation.tsx +42 -7
  176. package/templates/chat-app/components/model-selection-indicator.tsx +12 -10
  177. package/templates/chat-app/components/model-selector-view.tsx +211 -186
  178. package/templates/chat-app/components/new-chat-button.tsx +1 -1
  179. package/templates/chat-app/components/parallel-responses/model-picker.tsx +5 -1
  180. package/templates/chat-app/components/parallel-responses/responses.tsx +2 -2
  181. package/templates/chat-app/components/settings/settings-nav.tsx +1 -1
  182. package/templates/chat-app/components/settings/settings-navigation-link.tsx +1 -0
  183. package/templates/chat-app/components/sidebar-top-row.tsx +1 -1
  184. package/templates/chat-app/components/ui/sidebar.tsx +1 -1
  185. package/templates/chat-app/components/ui/trace.tsx +1 -1
  186. package/templates/chat-app/hooks/use-auto-focus.ts +12 -13
  187. package/templates/chat-app/integrations/routers.ts +1 -1
  188. package/templates/chat-app/lib/ai/active-gateway.ts +0 -9
  189. package/templates/chat-app/lib/ai/app-models.test.ts +0 -4
  190. package/templates/chat-app/lib/ai/app-models.ts +11 -6
  191. package/templates/chat-app/lib/ai/gateways/registry.ts +4 -31
  192. package/templates/chat-app/lib/ai/model-catalog.ts +50 -0
  193. package/templates/chat-app/lib/ai/models.ts +4 -39
  194. package/templates/chat-app/lib/ai/providers.ts +2 -16
  195. package/templates/chat-app/lib/chat-after-create.test.ts +1 -1
  196. package/templates/chat-app/lib/chat-after-create.ts +1 -1
  197. package/templates/chat-app/lib/config-schema.ts +0 -96
  198. package/templates/chat-app/lib/db/eve-creation-failure.ts +3 -3
  199. package/templates/chat-app/lib/db/eve-current-copy.ts +11 -11
  200. package/templates/chat-app/lib/db/eve-deletion.ts +19 -19
  201. package/templates/chat-app/lib/db/eve-dispatch.ts +115 -18
  202. package/templates/chat-app/lib/db/eve-file-purge.ts +4 -4
  203. package/templates/chat-app/lib/db/eve-files.ts +13 -13
  204. package/templates/chat-app/lib/db/eve-queries.ts +28 -43
  205. package/templates/chat-app/lib/db/eve-response-groups.ts +30 -112
  206. package/templates/chat-app/lib/db/eve-subagents.ts +8 -8
  207. package/templates/chat-app/lib/db/eve-title.ts +2 -2
  208. package/templates/chat-app/lib/db/eve-workspace-deletion.ts +3 -3
  209. package/templates/chat-app/lib/db/eve-workspace-turns.ts +37 -5
  210. package/templates/chat-app/lib/db/eve-workspaces.ts +3 -3
  211. package/templates/chat-app/lib/db/migrations/0029_branch_identifiers.sql +23 -0
  212. package/templates/chat-app/lib/db/migrations/meta/0029_snapshot.json +2547 -0
  213. package/templates/chat-app/lib/db/migrations/meta/_journal.json +7 -0
  214. package/templates/chat-app/lib/db/schema.ts +19 -25
  215. package/templates/chat-app/lib/devtools-disabled.ts +1 -0
  216. package/templates/chat-app/lib/eve/completed-copy-source.test.ts +12 -2
  217. package/templates/chat-app/lib/eve/completed-copy-source.ts +5 -2
  218. package/templates/chat-app/lib/eve/contracts.test.ts +5 -5
  219. package/templates/chat-app/lib/eve/contracts.ts +1 -1
  220. package/templates/chat-app/lib/eve/conversation-scope.test.ts +2 -2
  221. package/templates/chat-app/lib/eve/conversation-scope.ts +4 -4
  222. package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +1 -1
  223. package/templates/chat-app/lib/eve/create-response-group.test.ts +3 -3
  224. package/templates/chat-app/lib/eve/delete-local-conversation.ts +3 -3
  225. package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
  226. package/templates/chat-app/lib/eve/generated-files.ts +2 -2
  227. package/templates/chat-app/lib/eve/logical-chat.test.ts +17 -17
  228. package/templates/chat-app/lib/eve/logical-chat.ts +27 -31
  229. package/templates/chat-app/lib/eve/logical-response-slots.ts +4 -7
  230. package/templates/chat-app/lib/eve/message-delivery.ts +1 -0
  231. package/templates/chat-app/lib/eve/model-selection.test.ts +47 -50
  232. package/templates/chat-app/lib/eve/model-selection.ts +5 -37
  233. package/templates/chat-app/lib/eve/pending-create.test.ts +46 -7
  234. package/templates/chat-app/lib/eve/pending-create.ts +36 -4
  235. package/templates/chat-app/lib/eve/persisted-wire-order.test.ts +2 -2
  236. package/templates/chat-app/lib/eve/prepare-deletion.ts +3 -3
  237. package/templates/chat-app/lib/eve/purge-local-resources.ts +3 -3
  238. package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -2
  239. package/templates/chat-app/lib/eve/request-policy.ts +1 -0
  240. package/templates/chat-app/lib/eve/resolve-creation-request.ts +1 -1
  241. package/templates/chat-app/lib/eve/response-group-contracts.ts +1 -1
  242. package/templates/chat-app/lib/eve/response-group-lineage.test.ts +12 -12
  243. package/templates/chat-app/lib/eve/response-group-lineage.ts +21 -24
  244. package/templates/chat-app/lib/eve/response-group.test.ts +2 -2
  245. package/templates/chat-app/lib/eve/response-group.ts +1 -1
  246. package/templates/chat-app/lib/eve/response-model.ts +11 -1
  247. package/templates/chat-app/lib/eve/restore-message-attachments.test.ts +1 -1
  248. package/templates/chat-app/lib/eve/restore-message-attachments.ts +3 -3
  249. package/templates/chat-app/lib/eve/retire-session.ts +3 -3
  250. package/templates/chat-app/lib/eve/steer-rejected.ts +7 -0
  251. package/templates/chat-app/lib/eve/tool-cost.test.ts +18 -6
  252. package/templates/chat-app/lib/eve/tool-cost.ts +10 -18
  253. package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +27 -0
  254. package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +20 -13
  255. package/templates/chat-app/oxfmt.config.ts +0 -2
  256. package/templates/chat-app/package.json +7 -9
  257. package/templates/chat-app/playwright.config.ts +5 -1
  258. package/templates/chat-app/proxy.ts +2 -4
  259. package/templates/chat-app/scripts/agent-status.ts +6 -19
  260. package/templates/chat-app/scripts/build-eve.test.ts +56 -0
  261. package/templates/chat-app/scripts/build-eve.ts +12 -5
  262. package/templates/chat-app/scripts/check-env.ts +77 -73
  263. package/templates/chat-app/scripts/environment-validation-report.ts +1 -20
  264. package/templates/chat-app/scripts/installed-environment-validation.ts +14 -15
  265. package/templates/chat-app/trpc/init.ts +2 -0
  266. package/templates/chat-app/trpc/react.tsx +2 -2
  267. package/templates/chat-app/trpc/routers/_app.test.ts +56 -0
  268. package/templates/chat-app/trpc/routers/_app.ts +12 -11
  269. package/templates/chat-app/trpc/routers/eve.router.ts +2 -2
  270. package/templates/electron/forge.config.ts +1 -19
  271. package/templates/electron/scripts/write-branding.ts +1 -5
  272. package/templates/chat-app/app/privacy/page.tsx +0 -153
  273. package/templates/chat-app/app/terms/page.tsx +0 -270
  274. package/templates/chat-app/chatjs/core/installation/plugin.ts +0 -13
  275. package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -22
  276. package/templates/chat-app/chatjs/plugins/credits/server-plugin.ts +0 -5
  277. package/templates/chat-app/chatjs/plugins/feedback/chat.ts +0 -13
  278. package/templates/chat-app/chatjs/plugins/feedback/server-plugin.ts +0 -8
  279. package/templates/chat-app/chatjs/plugins/followup-suggestions/server-plugin.ts +0 -8
  280. package/templates/chat-app/chatjs/plugins/guest-chat/server-plugin.ts +0 -12
  281. package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +0 -17
  282. package/templates/chat-app/chatjs/plugins/mcp/server-plugin.ts +0 -5
  283. package/templates/chat-app/chatjs/plugins/model-preferences/server-plugin.ts +0 -8
  284. package/templates/chat-app/chatjs/plugins/projects/server-plugin.ts +0 -8
  285. package/templates/chat-app/chatjs/plugins/search/server-plugin.ts +0 -5
  286. package/templates/chat-app/chatjs/plugins/sharing/server-plugin.ts +0 -5
  287. package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +0 -18
  288. package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +0 -16
  289. package/templates/chat-app/components/ai-elements/context-hover.radix.tsx +0 -15
  290. package/templates/chat-app/components/ai-elements/context-hover.tsx +0 -17
  291. package/templates/chat-app/components/ai-elements/context.tsx +0 -405
  292. package/templates/chat-app/components/composer/editor.css +0 -96
  293. package/templates/chat-app/components/lexical-chat-input.tsx +0 -276
  294. package/templates/chat-app/components/model-selection-indicator.radix.tsx +0 -17
  295. package/templates/chat-app/components/ui/resizable.tsx +0 -49
  296. package/templates/chat-app/lib/ai/gateways/fallback-models.ts +0 -29
  297. package/templates/chat-app/lib/ai/models.generated.ts +0 -4242
  298. package/templates/chat-app/lib/ai/usage-token-details.test.ts +0 -76
  299. package/templates/chat-app/lib/ai/usage-token-details.ts +0 -33
  300. package/templates/chat-app/lib/chat-route.ts +0 -18
  301. package/templates/chat-app/providers/parse-chat-id-from-pathname.test.ts +0 -126
  302. package/templates/chat-app/providers/parse-chat-id-from-pathname.ts +0 -51
  303. package/templates/chat-app/scripts/fetch-models.ts +0 -30
  304. package/templates/chat-app/scripts/gateway-snapshot-warning.test.ts +0 -9
  305. /package/templates/chat-app/chatjs/plugins/attachment-uploads/{integration.tsx → uploads.ts} +0 -0
@@ -1,4 +1,4 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { creditsBilling as pluginBilling } from "@/chatjs/plugins/credits/billing";
2
+ import creditsBilling from "@/chatjs/plugins/credits/billing";
3
3
  import type { UsageBilling } from "@/chatjs/core/billing/contracts";
4
- export const installedBilling: readonly UsageBilling[] = [pluginBilling];
4
+ export const installedBilling: readonly UsageBilling[] = [creditsBilling];
@@ -1,29 +1,33 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
2
  "use client";
3
- import { attachmentUploadsClient as plugin0 } from "@/chatjs/plugins/attachment-uploads/client-plugin";
4
- import { creditsClient as plugin1 } from "@/chatjs/plugins/credits/client-plugin";
5
- import { feedbackClient as plugin2 } from "@/chatjs/plugins/feedback/client-plugin";
6
- import { followupSuggestionsClient as plugin3 } from "@/chatjs/plugins/followup-suggestions/client-plugin";
7
- import { imageViewerClient as plugin4 } from "@/chatjs/plugins/image-viewer/client-plugin";
8
- import { mcpClient as plugin5 } from "@/chatjs/plugins/mcp/client-plugin";
9
- import { modelPreferencesClient as plugin6 } from "@/chatjs/plugins/model-preferences/client-plugin";
10
- import { projectsClient as plugin7 } from "@/chatjs/plugins/projects/client-plugin";
11
- import { searchClient as plugin8 } from "@/chatjs/plugins/search/client-plugin";
12
- import { sharingClient as plugin9 } from "@/chatjs/plugins/sharing/client-plugin";
13
- import { spreadsheetViewerClient as plugin10 } from "@/chatjs/plugins/spreadsheet-viewer/client-plugin";
14
- import { videoViewerClient as plugin11 } from "@/chatjs/plugins/video-viewer/client-plugin";
3
+ import { chatUi as attachmentUploadsClient } from "@/chatjs/plugins/attachment-uploads/chat-ui";
4
+ import { chatUi as creditsClient } from "@/chatjs/plugins/credits/chat-ui";
5
+ import { chatUi as feedbackClient } from "@/chatjs/plugins/feedback/chat-ui";
6
+ import { chatUi as followupSuggestionsClient } from "@/chatjs/plugins/followup-suggestions/chat-ui";
7
+ import { chatUi as imageViewerClient } from "@/chatjs/plugins/image-viewer/chat-ui";
8
+ import { chatUi as mcpClient } from "@/chatjs/plugins/mcp/chat-ui";
9
+ import { chatUi as modelPreferencesClient } from "@/chatjs/plugins/model-preferences/chat-ui";
10
+ import { chatUi as projectsClient } from "@/chatjs/plugins/projects/chat-ui";
11
+ import { chatUi as searchClient } from "@/chatjs/plugins/search/chat-ui";
12
+ import { chatUi as sharingClient } from "@/chatjs/plugins/sharing/chat-ui";
13
+ import { chatUi as spreadsheetViewerClient } from "@/chatjs/plugins/spreadsheet-viewer/chat-ui";
14
+ import { chatUi as streamdownMathClient } from "@/chatjs/plugins/streamdown-math/chat-ui";
15
+ import { chatUi as streamdownMermaidClient } from "@/chatjs/plugins/streamdown-mermaid/chat-ui";
16
+ import { chatUi as videoViewerClient } from "@/chatjs/plugins/video-viewer/chat-ui";
15
17
  import type { UiPlugin } from "@/chatjs/core/ui/slots";
16
18
  export const installedChatPlugins: readonly UiPlugin[] = [
17
- plugin0,
18
- plugin1,
19
- plugin2,
20
- plugin3,
21
- plugin4,
22
- plugin5,
23
- plugin6,
24
- plugin7,
25
- plugin8,
26
- plugin9,
27
- plugin10,
28
- plugin11,
19
+ attachmentUploadsClient,
20
+ creditsClient,
21
+ feedbackClient,
22
+ followupSuggestionsClient,
23
+ imageViewerClient,
24
+ mcpClient,
25
+ modelPreferencesClient,
26
+ projectsClient,
27
+ searchClient,
28
+ sharingClient,
29
+ spreadsheetViewerClient,
30
+ streamdownMathClient,
31
+ streamdownMermaidClient,
32
+ videoViewerClient,
29
33
  ];
@@ -1,16 +1,16 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { aiTitlesChat as chat0 } from "@/chatjs/plugins/ai-titles/chat";
3
- import { feedbackChat as chat1 } from "@/chatjs/plugins/feedback/chat";
4
- import { followupChat as chat2 } from "@/chatjs/plugins/followup-suggestions/chat";
5
- import { projectsChat as chat3 } from "@/chatjs/plugins/projects/chat";
6
- import { searchChat as chat4 } from "@/chatjs/plugins/search/chat";
7
- import { sharingChat as chat5 } from "@/chatjs/plugins/sharing/chat";
2
+ import aiTitlesChat from "@/chatjs/plugins/ai-titles/chat-server";
3
+ import feedbackChat from "@/chatjs/plugins/feedback/chat-server";
4
+ import followupSuggestionsChat from "@/chatjs/plugins/followup-suggestions/chat-server";
5
+ import projectsChat from "@/chatjs/plugins/projects/chat-server";
6
+ import searchChat from "@/chatjs/plugins/search/chat-server";
7
+ import sharingChat from "@/chatjs/plugins/sharing/chat-server";
8
8
  import type { ChatServerIntegration } from "@/chatjs/core/chat/contracts";
9
9
  export const installedChat: readonly ChatServerIntegration[] = [
10
- chat0,
11
- chat1,
12
- chat2,
13
- chat3,
14
- chat4,
15
- chat5,
10
+ aiTitlesChat,
11
+ feedbackChat,
12
+ followupSuggestionsChat,
13
+ projectsChat,
14
+ searchChat,
15
+ sharingChat,
16
16
  ];
@@ -1,6 +1,6 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { guestCleanup as cleanup0 } from "@/chatjs/plugins/guest-chat/cleanup";
2
+ import guestChatCleanup from "@/chatjs/plugins/guest-chat/cleanup";
3
3
  import type { CleanupTask } from "@/lib/cleanup/contracts";
4
- if (cleanup0.id !== "guest-chat")
5
- throw new Error("Cleanup identity disagrees with its descriptor.");
6
- export const installedCleanupTasks: readonly CleanupTask[] = [cleanup0];
4
+ export const installedCleanupTasks: readonly CleanupTask[] = [
5
+ { id: "guest-chat", run: guestChatCleanup },
6
+ ];
@@ -1,5 +1,11 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { guestChat as plugin0 } from "@/chatjs/plugins/guest-chat/server-plugin";
3
2
  import type { InstrumentationRegistration } from "@/chatjs/core/installation/contracts";
3
+
4
4
  export const installedInstrumentation: readonly InstrumentationRegistration[] =
5
- [plugin0().instrumentation];
5
+ [
6
+ async () => {
7
+ const { default: registerGuestChat } =
8
+ await import("@/chatjs/plugins/guest-chat/instrumentation");
9
+ await registerGuestChat();
10
+ },
11
+ ];
@@ -1,5 +1,5 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
2
  "use client";
3
- import { desktopClient as plugin0 } from "@/chatjs/plugins/desktop/client-plugin";
3
+ import { layoutUi as desktopLayout } from "@/chatjs/plugins/desktop/layout-ui";
4
4
  import type { UiPlugin } from "@/chatjs/core/ui/slots";
5
- export const installedLayoutPlugins: readonly UiPlugin[] = [plugin0];
5
+ export const installedLayoutPlugins: readonly UiPlugin[] = [desktopLayout];
@@ -1,6 +1,6 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { modelPreferencesClient as plugin0 } from "@/chatjs/plugins/model-preferences/client-plugin";
2
+ import { useModelVisibility } from "@/chatjs/plugins/model-preferences/model-visibility";
3
3
  import type { ModelVisibility } from "@/chatjs/core/installation/contracts";
4
4
  export const installedModelVisibility: readonly ModelVisibility[] = [
5
- plugin0.useModelVisibility,
5
+ useModelVisibility,
6
6
  ];
@@ -1,5 +1,5 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { desktopNavigation as navigate } from "@/chatjs/plugins/desktop/navigation";
2
+ import desktopNavigation from "@/chatjs/plugins/desktop/navigation";
3
3
  export const installedNavigationHandlers: readonly (() => boolean)[] = [
4
- navigate,
4
+ desktopNavigation,
5
5
  ];
@@ -1,20 +1,19 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { credits as plugin0 } from "@/chatjs/plugins/credits/server-plugin";
3
- import { feedback as plugin1 } from "@/chatjs/plugins/feedback/server-plugin";
4
- import { followupSuggestions as plugin2 } from "@/chatjs/plugins/followup-suggestions/server-plugin";
5
- import { mcp as plugin3 } from "@/chatjs/plugins/mcp/server-plugin";
6
- import { modelPreferences as plugin4 } from "@/chatjs/plugins/model-preferences/server-plugin";
7
- import { projects as plugin5 } from "@/chatjs/plugins/projects/server-plugin";
8
- import { search as plugin6 } from "@/chatjs/plugins/search/server-plugin";
9
- import { sharing as plugin7 } from "@/chatjs/plugins/sharing/server-plugin";
10
- import type { InstalledRouters } from "@/chatjs/core/installation/contracts";
11
- export const installedRouters = {
12
- credits: plugin0().routers.credits,
13
- feedback: plugin1().routers.feedback,
14
- followupSuggestions: plugin2().routers.followupSuggestions,
15
- mcp: plugin3().routers.mcp,
16
- modelPreferences: plugin4().routers.modelPreferences,
17
- project: plugin5().routers.project,
18
- search: plugin6().routers.search,
19
- sharing: plugin7().routers.sharing,
20
- } satisfies InstalledRouters;
2
+ import { router as creditsRouter } from "@/chatjs/plugins/credits/router";
3
+ import { router as feedbackRouter } from "@/chatjs/plugins/feedback/router";
4
+ import { router as followupSuggestionsRouter } from "@/chatjs/plugins/followup-suggestions/router";
5
+ import { router as mcpRouter } from "@/chatjs/plugins/mcp/router";
6
+ import { router as modelPreferencesRouter } from "@/chatjs/plugins/model-preferences/router";
7
+ import { router as projectsRouter } from "@/chatjs/plugins/projects/router";
8
+ import { router as searchRouter } from "@/chatjs/plugins/search/router";
9
+ import { router as sharingRouter } from "@/chatjs/plugins/sharing/router";
10
+ export const installedRouters = [
11
+ creditsRouter,
12
+ feedbackRouter,
13
+ followupSuggestionsRouter,
14
+ mcpRouter,
15
+ modelPreferencesRouter,
16
+ projectsRouter,
17
+ searchRouter,
18
+ sharingRouter,
19
+ ] as const;
@@ -1,6 +1,8 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { guestSessionProfile as profile0 } from "@/chatjs/plugins/guest-chat/session-profile";
2
+ import guestChatProfile from "@/chatjs/plugins/guest-chat/session-profile";
3
3
  import type { SessionProfile } from "@/chatjs/core/session/contracts";
4
- if (profile0.authenticator !== "chatjs-disposable-guest")
4
+ if (guestChatProfile.authenticator !== "chatjs-disposable-guest")
5
5
  throw new Error("Session profile identity disagrees with its descriptor.");
6
- export const installedSessionProfiles: readonly SessionProfile[] = [profile0];
6
+ export const installedSessionProfiles: readonly SessionProfile[] = [
7
+ guestChatProfile,
8
+ ];
@@ -1,5 +1,5 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { signOutDesktop as pluginSignOut } from "@/chatjs/plugins/desktop/sign-out";
2
+ import desktopSignOut from "@/chatjs/plugins/desktop/sign-out";
3
3
  import type { AuthenticationUi } from "@/chatjs/core/authentication/contracts";
4
4
  export const installedSignOutHandlers: readonly AuthenticationUi["signOut"][] =
5
- [pluginSignOut];
5
+ [desktopSignOut];
@@ -1,6 +1,6 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { GuestChatScreen as pluginScreen } from "@/chatjs/plugins/guest-chat/signed-out";
2
+ import guestChatScreen from "@/chatjs/plugins/guest-chat/signed-out";
3
3
  import type { ComponentType } from "react";
4
4
  export const installedSignedOutScreens: readonly ComponentType[] = [
5
- pluginScreen,
5
+ guestChatScreen,
6
6
  ];
@@ -1,6 +1,6 @@
1
1
  // Generated by chat-js sync. Do not edit. Customize integrations/ or plugin source; inspect ownership with chat-js status.
2
- import { attachmentUploadsClient as plugin0 } from "@/chatjs/plugins/attachment-uploads/client-plugin";
2
+ import { attachmentUploads } from "@/chatjs/plugins/attachment-uploads/uploads";
3
3
  import type { AttachmentUploadIntegration } from "@/chatjs/core/installation/contracts";
4
4
  export const installedUploads: readonly AttachmentUploadIntegration[] = [
5
- plugin0.uploads,
5
+ attachmentUploads,
6
6
  ];
@@ -14,5 +14,7 @@ export const installedPlugins: ReadonlySet<string> = new Set([
14
14
  "search",
15
15
  "sharing",
16
16
  "spreadsheet-viewer",
17
+ "streamdown-math",
18
+ "streamdown-mermaid",
17
19
  "video-viewer",
18
20
  ]);
@@ -1,9 +1,11 @@
1
1
  import type { ChatServerIntegration } from "@/chatjs/core/chat/contracts";
2
2
 
3
- export const aiTitlesChat = {
3
+ const aiTitlesChat = {
4
4
  afterCreate: async (context) => {
5
5
  const { persistGeneratedEveConversationTitle } =
6
6
  await import("./generate-title");
7
7
  await persistGeneratedEveConversationTitle(context);
8
8
  },
9
9
  } satisfies ChatServerIntegration;
10
+
11
+ export default aiTitlesChat;
@@ -61,25 +61,23 @@ Rules (strictly follow all):
61
61
  }
62
62
  };
63
63
  const persistGeneratedEveConversationTitle = async ({
64
- conversationId,
64
+ branchId,
65
65
  message,
66
66
  ownerId,
67
67
  }: Readonly<{
68
- conversationId: string;
68
+ branchId: string;
69
69
  message: ReadonlyEveMessageInput;
70
70
  ownerId: string;
71
71
  }>): Promise<EveTitleResult | undefined> => {
72
72
  const fallbackTitle = eveConversationTitleFallback(message);
73
73
  try {
74
- if (
75
- !(await isEveRootTitlePending(ownerId, conversationId, fallbackTitle))
76
- ) {
74
+ if (!(await isEveRootTitlePending(ownerId, branchId, fallbackTitle))) {
77
75
  return undefined;
78
76
  }
79
77
  } catch (error) {
80
78
  log.warn(
81
79
  {
82
- conversationId,
80
+ branchId,
83
81
  errorName: error instanceof Error ? error.name : typeof error,
84
82
  },
85
83
  "Eve title eligibility check failed"
@@ -91,15 +89,15 @@ const persistGeneratedEveConversationTitle = async ({
91
89
  await (generated.source === "generated"
92
90
  ? replaceEveRootFallbackTitle(
93
91
  ownerId,
94
- conversationId,
92
+ branchId,
95
93
  fallbackTitle,
96
94
  generated.title
97
95
  )
98
- : settleEveRootFallbackTitle(ownerId, conversationId, fallbackTitle));
96
+ : settleEveRootFallbackTitle(ownerId, branchId, fallbackTitle));
99
97
  } catch (error) {
100
98
  log.warn(
101
99
  {
102
- conversationId,
100
+ branchId,
103
101
  errorName: error instanceof Error ? error.name : typeof error,
104
102
  },
105
103
  "Eve title persistence failed"
@@ -1,11 +1,10 @@
1
1
  {
2
+ "contractVersion": 3,
2
3
  "id": "ai-titles",
3
4
  "kind": "plugin",
4
5
  "files": [
5
- "chatjs/plugins/ai-titles/chat.ts",
6
+ "chatjs/plugins/ai-titles/chat-server.ts",
6
7
  "chatjs/plugins/ai-titles/generate-title.ts",
7
8
  "chatjs/plugins/ai-titles/title-queries.ts"
8
- ],
9
- "chat": { "export": "aiTitlesChat" },
10
- "contractVersion": 1
9
+ ]
11
10
  }
@@ -5,7 +5,7 @@ import { eveChat, eveConversation } from "@/lib/db/schema";
5
5
  const SINGLE_MATCH_LIMIT = 1;
6
6
  const isEveRootTitlePending = async (
7
7
  ownerId: string,
8
- conversationId: string,
8
+ branchId: string,
9
9
  fallbackTitle: string
10
10
  ): Promise<boolean> => {
11
11
  const [row] = await db
@@ -20,7 +20,7 @@ const isEveRootTitlePending = async (
20
20
  )
21
21
  .where(
22
22
  and(
23
- eq(eveConversation.id, conversationId),
23
+ eq(eveConversation.id, branchId),
24
24
  eq(eveConversation.ownerId, ownerId),
25
25
  eq(eveConversation.state, "bound"),
26
26
  eq(eveChat.title, fallbackTitle),
@@ -33,7 +33,7 @@ const isEveRootTitlePending = async (
33
33
 
34
34
  const replaceEveRootFallbackTitle = async (
35
35
  ownerId: string,
36
- conversationId: string,
36
+ branchId: string,
37
37
  fallbackTitle: string,
38
38
  generatedTitle: string
39
39
  ): Promise<boolean> => {
@@ -43,7 +43,7 @@ const replaceEveRootFallbackTitle = async (
43
43
  .from(eveConversation)
44
44
  .where(
45
45
  and(
46
- eq(eveConversation.id, conversationId),
46
+ eq(eveConversation.id, branchId),
47
47
  eq(eveConversation.ownerId, ownerId),
48
48
  eq(eveConversation.state, "bound"),
49
49
  eq(eveChat.id, eveConversation.chatId),
@@ -1,14 +1,12 @@
1
1
  "use client";
2
2
  import { definePlugin, slot } from "@/chatjs/core/ui/slots";
3
3
  import { ComposerAttachments } from "@/components/chat-slots";
4
- import { attachmentUploads } from "./integration";
5
4
  import { AttachFilesControl, TakePhotoControl } from "./controls";
6
5
 
7
- export const attachmentUploadsClient = definePlugin({
6
+ export const chatUi = definePlugin({
8
7
  id: "attachment-uploads",
9
8
  slots: [
10
9
  slot(ComposerAttachments, AttachFilesControl),
11
10
  slot(ComposerAttachments, TakePhotoControl),
12
11
  ],
13
- uploads: attachmentUploads,
14
12
  });
@@ -0,0 +1,16 @@
1
+ {
2
+ "contractVersion": 3,
3
+ "uiBase": "base",
4
+ "id": "attachment-uploads",
5
+ "kind": "plugin",
6
+ "files": [
7
+ "chatjs/plugins/attachment-uploads/controls.tsx",
8
+ "chatjs/plugins/attachment-uploads/uploads.ts",
9
+ "chatjs/plugins/attachment-uploads/upload.ts",
10
+ "chatjs/plugins/attachment-uploads/upload-prep.ts",
11
+ "app/(chat)/api/files/upload/route.ts",
12
+ "chatjs/plugins/attachment-uploads/routes/upload.ts",
13
+ "chatjs/plugins/attachment-uploads/chat-ui.ts"
14
+ ],
15
+ "requiresStorage": true
16
+ }
@@ -4,7 +4,7 @@ import { getBalanceCents } from "./credits-queries";
4
4
  import { userCredit } from "./credits-schema";
5
5
 
6
6
  /** Core supplies its usage transaction, with the registered owner already locked. */
7
- export const creditsBilling = {
7
+ const creditsBilling = {
8
8
  canSpend: async (ownerId) => (await getBalanceCents(ownerId)) > 0,
9
9
  debit: async (tx, { ownerId, cents }) => {
10
10
  await tx
@@ -17,3 +17,5 @@ export const creditsBilling = {
17
17
  .where(eq(userCredit.userId, ownerId));
18
18
  },
19
19
  } satisfies UsageBilling;
20
+
21
+ export default creditsBilling;
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
3
3
  import { AccountSummary } from "@/components/chat-slots";
4
4
  import { CreditBalance } from "./balance";
5
5
 
6
- export const creditsClient = definePlugin({
6
+ export const chatUi = definePlugin({
7
7
  id: "credits",
8
8
  slots: [slot(AccountSummary, CreditBalance)],
9
9
  });
@@ -1,25 +1,16 @@
1
1
  {
2
+ "contractVersion": 3,
3
+ "uiBase": "base",
2
4
  "id": "credits",
3
5
  "kind": "plugin",
4
6
  "files": [
5
7
  "chatjs/plugins/credits/balance.tsx",
6
8
  "chatjs/plugins/credits/billing.ts",
7
- "chatjs/plugins/credits/client-plugin.ts",
9
+ "chatjs/plugins/credits/chat-ui.ts",
8
10
  "chatjs/plugins/credits/credits-queries.ts",
9
11
  "chatjs/plugins/credits/credits-schema.ts",
10
12
  "chatjs/plugins/credits/router.ts",
11
- "chatjs/plugins/credits/server-plugin.ts",
12
13
  "chatjs/plugins/credits/use-credits.ts"
13
14
  ],
14
- "databaseSchemas": ["chatjs/plugins/credits/credits-schema.ts"],
15
- "billing": { "export": "creditsBilling" },
16
- "server": { "export": "credits", "routers": ["credits"] },
17
- "client": {
18
- "export": "creditsClient",
19
- "composerControls": [],
20
- "settingsItems": [],
21
- "accountSummary": true
22
- },
23
- "contractVersion": 2,
24
- "uiBase": "base"
15
+ "databaseSchemas": ["chatjs/plugins/credits/credits-schema.ts"]
25
16
  }
@@ -1,7 +1,7 @@
1
1
  import { getBalanceCents } from "./credits-queries";
2
2
  import { createTRPCRouter, protectedProcedure } from "@/trpc/init";
3
3
 
4
- export const creditsRouter = createTRPCRouter({
4
+ const creditsProcedures = {
5
5
  getAvailableCredits: protectedProcedure.query(
6
6
  async ({
7
7
  ctx,
@@ -12,4 +12,6 @@ export const creditsRouter = createTRPCRouter({
12
12
  return { balanceCents };
13
13
  }
14
14
  ),
15
- });
15
+ };
16
+
17
+ export const router = createTRPCRouter({ credits: creditsProcedures });
@@ -44,7 +44,7 @@ const BrowserTransfer = ({
44
44
  );
45
45
  };
46
46
 
47
- export const DesktopAuthForm = ({
47
+ const DesktopAuthForm = ({
48
48
  mode,
49
49
  children,
50
50
  }: {
@@ -79,3 +79,5 @@ export const DesktopAuthForm = ({
79
79
  }
80
80
  return children;
81
81
  };
82
+
83
+ export default DesktopAuthForm;
@@ -39,7 +39,7 @@ const electronAuthPlugin = {
39
39
  },
40
40
  };
41
41
 
42
- export const desktopAuth = {
42
+ const desktopAuth = {
43
43
  plugins: [electronAuthPlugin],
44
44
  trustedOrigins: [`${ELECTRON_APP_SCHEME}:/`],
45
45
  isAuthRoute: (url) =>
@@ -48,3 +48,5 @@ export const desktopAuth = {
48
48
  url.searchParams.get("client_id") === ELECTRON_AUTH_CLIENT_ID),
49
49
  } satisfies AuthenticationIntegration;
50
50
  export { electronAuthPlugin };
51
+
52
+ export default desktopAuth;
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
3
3
  import { LayoutEffects } from "@/components/layout-slots";
4
4
  import { ElectronAuthHandler } from "./auth-handler";
5
5
 
6
- export const desktopClient = definePlugin({
6
+ export const layoutUi = definePlugin({
7
7
  id: "desktop",
8
8
  slots: [slot(LayoutEffects, ElectronAuthHandler)],
9
9
  });
@@ -1,3 +1,5 @@
1
1
  import { isElectronRenderer } from "./bridge";
2
2
 
3
- export const desktopNavigation = (): boolean => isElectronRenderer();
3
+ const desktopNavigation = (): boolean => isElectronRenderer();
4
+
5
+ export default desktopNavigation;
@@ -1,4 +1,6 @@
1
1
  {
2
+ "contractVersion": 3,
3
+ "uiBase": "base",
2
4
  "id": "desktop",
3
5
  "kind": "plugin",
4
6
  "files": [
@@ -8,7 +10,7 @@
8
10
  "chatjs/plugins/desktop/auth-server.ts",
9
11
  "chatjs/plugins/desktop/auth-ui.tsx",
10
12
  "chatjs/plugins/desktop/bridge.ts",
11
- "chatjs/plugins/desktop/client-plugin.ts",
13
+ "chatjs/plugins/desktop/layout-ui.ts",
12
14
  "chatjs/plugins/desktop/navigation.ts",
13
15
  "chatjs/plugins/desktop/protocol.ts",
14
16
  "chatjs/plugins/desktop/device-login-page.tsx",
@@ -16,19 +18,5 @@
16
18
  "chatjs/plugins/desktop/electron-auth.ts",
17
19
  "chatjs/plugins/desktop/sign-out.ts",
18
20
  "app/(auth)/device-login/page.tsx"
19
- ],
20
- "authentication": { "export": "desktopAuth" },
21
- "authenticationUi": {
22
- "form": "DesktopAuthForm",
23
- "signOut": "signOutDesktop"
24
- },
25
- "navigation": { "export": "desktopNavigation" },
26
- "client": {
27
- "export": "desktopClient",
28
- "composerControls": [],
29
- "settingsItems": [],
30
- "layout": true
31
- },
32
- "contractVersion": 2,
33
- "uiBase": "base"
21
+ ]
34
22
  }
@@ -1,6 +1,6 @@
1
1
  import { isElectronRenderer } from "./bridge";
2
2
 
3
- export const signOutDesktop = async (): Promise<boolean> => {
3
+ const signOutDesktop = async (): Promise<boolean> => {
4
4
  if (!isElectronRenderer()) {
5
5
  return false;
6
6
  }
@@ -16,3 +16,5 @@ export const signOutDesktop = async (): Promise<boolean> => {
16
16
  }
17
17
  return true;
18
18
  };
19
+
20
+ export default signOutDesktop;
@@ -0,0 +1,13 @@
1
+ import { inArray } from "drizzle-orm";
2
+ import type { ChatServerIntegration } from "@/chatjs/core/chat/contracts";
3
+ import { eveVote } from "./feedback-schema";
4
+
5
+ const feedbackChat = {
6
+ onDeleteConversations: async (tx, { branchIds }) => {
7
+ if (branchIds.length > 0) {
8
+ await tx.delete(eveVote).where(inArray(eveVote.branchId, [...branchIds]));
9
+ }
10
+ },
11
+ } satisfies ChatServerIntegration;
12
+
13
+ export default feedbackChat;
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
3
3
  import { MessageActions } from "@/components/chat-slots";
4
4
  import { FeedbackActions } from "./feedback-actions";
5
5
 
6
- export const feedbackClient = definePlugin({
6
+ export const chatUi = definePlugin({
7
7
  id: "feedback",
8
8
  slots: [slot(MessageActions, FeedbackActions)],
9
9
  });
@@ -8,11 +8,11 @@ import { MessageVoteActions } from "./message-vote-actions";
8
8
  import { useTRPC } from "@/trpc/react";
9
9
 
10
10
  export const FeedbackActions = ({
11
- conversationId,
11
+ branchId,
12
12
  messageId,
13
13
  disabled,
14
14
  }: {
15
- readonly conversationId: string;
15
+ readonly branchId: string;
16
16
  readonly messageId: string;
17
17
  readonly disabled: boolean;
18
18
  }): ReactJSX.Element => {
@@ -20,7 +20,7 @@ export const FeedbackActions = ({
20
20
  const trpc = useTRPC();
21
21
  const queryClient = useQueryClient();
22
22
  // All messages share one cached query and one request per conversation.
23
- const options = trpc.feedback.votes.queryOptions({ conversationId });
23
+ const options = trpc.feedback.votes.queryOptions({ branchId });
24
24
  const votes = useQuery(options);
25
25
  const mutation = useMutation(
26
26
  trpc.feedback.vote.mutationOptions({
@@ -60,7 +60,7 @@ export const FeedbackActions = ({
60
60
  <MessageVoteActions
61
61
  disabled={disabled || votes.isPending || mutation.isPending}
62
62
  onVote={async (type) =>
63
- await mutation.mutateAsync({ conversationId, messageId, type })
63
+ await mutation.mutateAsync({ branchId, messageId, type })
64
64
  }
65
65
  vote={votes.data?.find((vote) => vote.messageId === messageId)}
66
66
  />