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.
- package/README.md +8 -6
- package/dist/index.js +7487 -6859
- package/package.json +2 -2
- package/templates/chat-app/AGENTS.md +1 -1
- package/templates/chat-app/agent/agent.ts +0 -2
- package/templates/chat-app/agent/hooks/followup-suggestions.ts +1 -1
- package/templates/chat-app/agent/hooks/projects.ts +1 -1
- package/templates/chat-app/agent/hooks/search.ts +1 -1
- package/templates/chat-app/agent/instructions/projects.ts +1 -1
- package/templates/chat-app/agent/tools/mcp.ts +1 -1
- package/templates/chat-app/app/(auth)/device-login/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/api/files/upload/route.ts +1 -1
- package/templates/chat-app/app/(chat)/chat/{[id] → [chatId]}/page.tsx +4 -4
- package/templates/chat-app/app/(chat)/project/[projectId]/chat/[chatId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/project/[projectId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/[connectorId]/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/connectors/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/settings/models/page.tsx +1 -1
- package/templates/chat-app/app/(chat)/share/[id]/page.tsx +1 -1
- package/templates/chat-app/app/api/agent-conversations/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-conversations/route.ts +2 -2
- package/templates/chat-app/app/api/agent-response-groups/route.test.ts +5 -5
- package/templates/chat-app/app/api/agent-response-groups/route.ts +1 -1
- package/templates/chat-app/app/api/eve/[...path]/route.test.ts +133 -4
- package/templates/chat-app/app/api/eve/[...path]/route.ts +175 -49
- package/templates/chat-app/app/api/eve-guest/route.ts +1 -1
- package/templates/chat-app/app/api/mcp/oauth/callback/route.ts +1 -1
- package/templates/chat-app/app/editor.css +0 -6
- package/templates/chat-app/app/layout.tsx +11 -18
- package/templates/chat-app/app/opengraph-image.png +0 -0
- package/templates/chat-app/chat.config.ts +0 -44
- package/templates/chat-app/chatjs/core/chat/compose.ts +4 -4
- package/templates/chat-app/chatjs/core/chat/contracts.ts +6 -6
- package/templates/chat-app/chatjs/core/gateway/runtime.ts +0 -7
- package/templates/chat-app/chatjs/core/installation/contracts.ts +0 -7
- package/templates/chat-app/chatjs/core/ui/slots.tsx +15 -5
- package/templates/chat-app/chatjs/generated/installed-auth-ui.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-auth.ts +4 -2
- package/templates/chat-app/chatjs/generated/installed-billing.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-chat-ui.ts +28 -24
- package/templates/chat-app/chatjs/generated/installed-chat.ts +12 -12
- package/templates/chat-app/chatjs/generated/installed-cleanup.ts +4 -4
- package/templates/chat-app/chatjs/generated/installed-instrumentation.ts +8 -2
- package/templates/chat-app/chatjs/generated/installed-layout.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-model-visibility.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-navigation.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-routers.ts +18 -19
- package/templates/chat-app/chatjs/generated/installed-session-profiles.ts +5 -3
- package/templates/chat-app/chatjs/generated/installed-sign-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-signed-out.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed-uploads.ts +2 -2
- package/templates/chat-app/chatjs/generated/installed.ts +2 -0
- package/templates/chat-app/chatjs/plugins/ai-titles/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/ai-titles/generate-title.ts +7 -9
- package/templates/chat-app/chatjs/plugins/ai-titles/{chatjs.json → plugin.json} +3 -4
- package/templates/chat-app/chatjs/plugins/ai-titles/title-queries.ts +4 -4
- package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/attachment-uploads/plugin.json +16 -0
- package/templates/chat-app/chatjs/plugins/credits/billing.ts +3 -1
- package/templates/chat-app/chatjs/plugins/credits/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/credits/{chatjs.json → plugin.json} +4 -13
- package/templates/chat-app/chatjs/plugins/credits/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/desktop/auth-form.tsx +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/auth-server.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{client-plugin.ts → layout-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/desktop/navigation.ts +3 -1
- package/templates/chat-app/chatjs/plugins/desktop/{chatjs.json → plugin.json} +4 -16
- package/templates/chat-app/chatjs/plugins/desktop/sign-out.ts +3 -1
- package/templates/chat-app/chatjs/plugins/feedback/chat-server.ts +13 -0
- package/templates/chat-app/chatjs/plugins/feedback/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/feedback/feedback-actions.tsx +4 -4
- package/templates/chat-app/chatjs/plugins/feedback/feedback-queries.ts +11 -11
- package/templates/chat-app/chatjs/plugins/feedback/feedback-schema.ts +2 -2
- package/templates/chat-app/chatjs/plugins/feedback/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/feedback/router.ts +9 -7
- package/templates/chat-app/chatjs/plugins/feedback/vote-message.ts +3 -6
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/followup-suggestions/followup-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/followup-suggestions/{chatjs.json → plugin.json} +5 -17
- package/templates/chat-app/chatjs/plugins/followup-suggestions/router.ts +8 -9
- package/templates/chat-app/chatjs/plugins/followup-suggestions/suggestions.tsx +2 -7
- package/templates/chat-app/chatjs/plugins/followup-suggestions/use-followups.ts +2 -2
- package/templates/chat-app/chatjs/plugins/guest-chat/cleanup.ts +1 -7
- package/templates/chat-app/chatjs/plugins/guest-chat/guest-auth.ts +1 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/instrumentation.ts +6 -0
- package/templates/chat-app/chatjs/plugins/guest-chat/{chatjs.json → plugin.json} +6 -12
- package/templates/chat-app/chatjs/plugins/guest-chat/session-profile.ts +3 -1
- package/templates/chat-app/chatjs/plugins/guest-chat/signed-out.tsx +53 -24
- package/templates/chat-app/chatjs/plugins/image-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/image-viewer/plugin.json +11 -0
- package/templates/chat-app/chatjs/plugins/mcp/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/db/encrypted-text.ts +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/mcp/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/mcp/routes/connectors-page.tsx +4 -1
- package/templates/chat-app/chatjs/plugins/mcp/setup.ts +2 -2
- package/templates/chat-app/chatjs/plugins/mcp/ui/connectors-settings.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-connect-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/ui/mcp-create-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/mcp/{mcp-env.ts → validate-env.ts} +2 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/{client-plugin.ts → chat-ui.ts} +1 -3
- package/templates/chat-app/chatjs/plugins/model-preferences/model-row.tsx +3 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{use-model-preferences.ts → model-visibility.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/model-preferences/models-settings.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/model-preferences/{chatjs.json → plugin.json} +5 -13
- package/templates/chat-app/chatjs/plugins/model-preferences/router.ts +5 -1
- package/templates/chat-app/chatjs/plugins/projects/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/projects/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/projects/conversation-hook.ts +1 -1
- package/templates/chat-app/chatjs/plugins/projects/db/project-queries.ts +2 -2
- package/templates/chat-app/chatjs/plugins/projects/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/projects/router.ts +7 -7
- package/templates/chat-app/chatjs/plugins/projects/routes/project-page.tsx +10 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/chat-contributions.tsx +3 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/delete-project-dialog.tsx +0 -3
- package/templates/chat-app/chatjs/plugins/projects/ui/eve-move-project-dialog.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/projects/ui/project-icon-picker.tsx +1 -0
- package/templates/chat-app/chatjs/plugins/projects/ui/sidebar-projects.tsx +12 -11
- package/templates/chat-app/chatjs/plugins/search/{chat.ts → chat-server.ts} +8 -6
- package/templates/chat-app/chatjs/plugins/search/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/search/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/search/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/search/search-backfill.ts +4 -4
- package/templates/chat-app/chatjs/plugins/search/search-chats.tsx +1 -1
- package/templates/chat-app/chatjs/plugins/search/search-hook.ts +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-queries.ts +13 -13
- package/templates/chat-app/chatjs/plugins/search/search-results-view.tsx +2 -2
- package/templates/chat-app/chatjs/plugins/search/search-schema.ts +3 -3
- package/templates/chat-app/chatjs/plugins/sharing/{chat.ts → chat-server.ts} +3 -1
- package/templates/chat-app/chatjs/plugins/sharing/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/sharing/{chatjs.json → plugin.json} +5 -14
- package/templates/chat-app/chatjs/plugins/sharing/router.ts +4 -2
- package/templates/chat-app/chatjs/plugins/sharing/ui/chat-contributions.tsx +9 -11
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-button.tsx +6 -6
- package/templates/chat-app/chatjs/plugins/sharing/ui/share-dialog.tsx +9 -9
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/plugin.json +12 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/chat-ui.ts +11 -0
- package/templates/chat-app/chatjs/plugins/streamdown-math/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/chat-ui.ts +10 -0
- package/templates/chat-app/chatjs/plugins/streamdown-mermaid/plugin.json +6 -0
- package/templates/chat-app/chatjs/plugins/video-viewer/{client-plugin.ts → chat-ui.ts} +1 -1
- package/templates/chat-app/chatjs/plugins/video-viewer/plugin.json +10 -0
- package/templates/chat-app/chatjs/providers/gateway.ts +49 -55
- package/templates/chat-app/chatjs/tools/attach-workspace-file/tool.ts +2 -2
- package/templates/chat-app/chatjs/tools/generate-image/tool.test.ts +3 -14
- package/templates/chat-app/components/ai-elements/response.tsx +16 -15
- package/templates/chat-app/components/auth-form-view.tsx +35 -43
- package/templates/chat-app/components/chat/chat-composer.tsx +90 -27
- package/templates/chat-app/components/chat/chat-conversation-screen.tsx +3 -3
- package/templates/chat-app/components/chat/chat-navigation.tsx +11 -1
- package/templates/chat-app/components/chat/chat-sidebar.tsx +8 -9
- package/templates/chat-app/components/chat/chat-transcript.tsx +52 -23
- package/templates/chat-app/components/chat-slots.tsx +1 -1
- package/templates/chat-app/components/composer/composer-menu.tsx +5 -4
- package/templates/chat-app/components/composer/prompt-form.tsx +7 -1
- package/templates/chat-app/components/eve/eve-chat-error.tsx +12 -2
- package/templates/chat-app/components/eve/eve-chat-header.tsx +5 -7
- package/templates/chat-app/components/eve/eve-chat-page.tsx +9 -9
- package/templates/chat-app/components/eve/eve-composer.tsx +16 -5
- package/templates/chat-app/components/eve/eve-conversation.tsx +342 -209
- package/templates/chat-app/components/eve/eve-creation-recovery.tsx +53 -3
- package/templates/chat-app/components/eve/eve-deletion-provider.tsx +10 -12
- package/templates/chat-app/components/eve/eve-history-list.tsx +4 -9
- package/templates/chat-app/components/eve/eve-logical-context.tsx +1 -0
- package/templates/chat-app/components/eve/eve-logical-navigation.tsx +3 -3
- package/templates/chat-app/components/eve/eve-message-content.tsx +252 -0
- package/templates/chat-app/components/eve/eve-message-part.tsx +13 -58
- package/templates/chat-app/components/eve/eve-pending-input.tsx +82 -5
- package/templates/chat-app/components/eve/eve-runtime-provider.tsx +74 -15
- package/templates/chat-app/components/eve/use-eve-composer-draft.ts +64 -26
- package/templates/chat-app/components/eve/use-eve-fork.ts +14 -16
- package/templates/chat-app/components/eve/use-logical-commands.ts +3 -3
- package/templates/chat-app/components/eve/use-new-eve-conversation.tsx +42 -7
- package/templates/chat-app/components/model-selection-indicator.tsx +12 -10
- package/templates/chat-app/components/model-selector-view.tsx +211 -186
- package/templates/chat-app/components/new-chat-button.tsx +1 -1
- package/templates/chat-app/components/parallel-responses/model-picker.tsx +5 -1
- package/templates/chat-app/components/parallel-responses/responses.tsx +2 -2
- package/templates/chat-app/components/settings/settings-nav.tsx +1 -1
- package/templates/chat-app/components/settings/settings-navigation-link.tsx +1 -0
- package/templates/chat-app/components/sidebar-top-row.tsx +1 -1
- package/templates/chat-app/components/ui/sidebar.tsx +1 -1
- package/templates/chat-app/components/ui/trace.tsx +1 -1
- package/templates/chat-app/hooks/use-auto-focus.ts +12 -13
- package/templates/chat-app/integrations/routers.ts +1 -1
- package/templates/chat-app/lib/ai/active-gateway.ts +0 -9
- package/templates/chat-app/lib/ai/app-models.test.ts +0 -4
- package/templates/chat-app/lib/ai/app-models.ts +11 -6
- package/templates/chat-app/lib/ai/gateways/registry.ts +4 -31
- package/templates/chat-app/lib/ai/model-catalog.ts +50 -0
- package/templates/chat-app/lib/ai/models.ts +4 -39
- package/templates/chat-app/lib/ai/providers.ts +2 -16
- package/templates/chat-app/lib/chat-after-create.test.ts +1 -1
- package/templates/chat-app/lib/chat-after-create.ts +1 -1
- package/templates/chat-app/lib/config-schema.ts +0 -96
- package/templates/chat-app/lib/db/eve-creation-failure.ts +3 -3
- package/templates/chat-app/lib/db/eve-current-copy.ts +11 -11
- package/templates/chat-app/lib/db/eve-deletion.ts +19 -19
- package/templates/chat-app/lib/db/eve-dispatch.ts +115 -18
- package/templates/chat-app/lib/db/eve-file-purge.ts +4 -4
- package/templates/chat-app/lib/db/eve-files.ts +13 -13
- package/templates/chat-app/lib/db/eve-queries.ts +28 -43
- package/templates/chat-app/lib/db/eve-response-groups.ts +30 -112
- package/templates/chat-app/lib/db/eve-subagents.ts +8 -8
- package/templates/chat-app/lib/db/eve-title.ts +2 -2
- package/templates/chat-app/lib/db/eve-workspace-deletion.ts +3 -3
- package/templates/chat-app/lib/db/eve-workspace-turns.ts +37 -5
- package/templates/chat-app/lib/db/eve-workspaces.ts +3 -3
- package/templates/chat-app/lib/db/migrations/0029_branch_identifiers.sql +23 -0
- package/templates/chat-app/lib/db/migrations/meta/0029_snapshot.json +2547 -0
- package/templates/chat-app/lib/db/migrations/meta/_journal.json +7 -0
- package/templates/chat-app/lib/db/schema.ts +19 -25
- package/templates/chat-app/lib/devtools-disabled.ts +1 -0
- package/templates/chat-app/lib/eve/completed-copy-source.test.ts +12 -2
- package/templates/chat-app/lib/eve/completed-copy-source.ts +5 -2
- package/templates/chat-app/lib/eve/contracts.test.ts +5 -5
- package/templates/chat-app/lib/eve/contracts.ts +1 -1
- package/templates/chat-app/lib/eve/conversation-scope.test.ts +2 -2
- package/templates/chat-app/lib/eve/conversation-scope.ts +4 -4
- package/templates/chat-app/lib/eve/create-conversation-operation.test.ts +1 -1
- package/templates/chat-app/lib/eve/create-response-group.test.ts +3 -3
- package/templates/chat-app/lib/eve/delete-local-conversation.ts +3 -3
- package/templates/chat-app/lib/eve/generated-files.test.ts +1 -1
- package/templates/chat-app/lib/eve/generated-files.ts +2 -2
- package/templates/chat-app/lib/eve/logical-chat.test.ts +17 -17
- package/templates/chat-app/lib/eve/logical-chat.ts +27 -31
- package/templates/chat-app/lib/eve/logical-response-slots.ts +4 -7
- package/templates/chat-app/lib/eve/message-delivery.ts +1 -0
- package/templates/chat-app/lib/eve/model-selection.test.ts +47 -50
- package/templates/chat-app/lib/eve/model-selection.ts +5 -37
- package/templates/chat-app/lib/eve/pending-create.test.ts +46 -7
- package/templates/chat-app/lib/eve/pending-create.ts +36 -4
- package/templates/chat-app/lib/eve/persisted-wire-order.test.ts +2 -2
- package/templates/chat-app/lib/eve/prepare-deletion.ts +3 -3
- package/templates/chat-app/lib/eve/purge-local-resources.ts +3 -3
- package/templates/chat-app/lib/eve/reconcile-workspace-turn.ts +2 -2
- package/templates/chat-app/lib/eve/request-policy.ts +1 -0
- package/templates/chat-app/lib/eve/resolve-creation-request.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-contracts.ts +1 -1
- package/templates/chat-app/lib/eve/response-group-lineage.test.ts +12 -12
- package/templates/chat-app/lib/eve/response-group-lineage.ts +21 -24
- package/templates/chat-app/lib/eve/response-group.test.ts +2 -2
- package/templates/chat-app/lib/eve/response-group.ts +1 -1
- package/templates/chat-app/lib/eve/response-model.ts +11 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.test.ts +1 -1
- package/templates/chat-app/lib/eve/restore-message-attachments.ts +3 -3
- package/templates/chat-app/lib/eve/retire-session.ts +3 -3
- package/templates/chat-app/lib/eve/steer-rejected.ts +7 -0
- package/templates/chat-app/lib/eve/tool-cost.test.ts +18 -6
- package/templates/chat-app/lib/eve/tool-cost.ts +10 -18
- package/templates/chat-app/lib/eve/workspace-turn-evidence.test.ts +27 -0
- package/templates/chat-app/lib/eve/workspace-turn-evidence.ts +20 -13
- package/templates/chat-app/oxfmt.config.ts +0 -2
- package/templates/chat-app/package.json +7 -9
- package/templates/chat-app/playwright.config.ts +5 -1
- package/templates/chat-app/proxy.ts +2 -4
- package/templates/chat-app/scripts/agent-status.ts +6 -19
- package/templates/chat-app/scripts/build-eve.test.ts +56 -0
- package/templates/chat-app/scripts/build-eve.ts +12 -5
- package/templates/chat-app/scripts/check-env.ts +77 -73
- package/templates/chat-app/scripts/environment-validation-report.ts +1 -20
- package/templates/chat-app/scripts/installed-environment-validation.ts +14 -15
- package/templates/chat-app/trpc/init.ts +2 -0
- package/templates/chat-app/trpc/react.tsx +2 -2
- package/templates/chat-app/trpc/routers/_app.test.ts +56 -0
- package/templates/chat-app/trpc/routers/_app.ts +12 -11
- package/templates/chat-app/trpc/routers/eve.router.ts +2 -2
- package/templates/electron/forge.config.ts +1 -19
- package/templates/electron/scripts/write-branding.ts +1 -5
- package/templates/chat-app/app/privacy/page.tsx +0 -153
- package/templates/chat-app/app/terms/page.tsx +0 -270
- package/templates/chat-app/chatjs/core/installation/plugin.ts +0 -13
- package/templates/chat-app/chatjs/plugins/attachment-uploads/chatjs.json +0 -22
- package/templates/chat-app/chatjs/plugins/credits/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/feedback/chat.ts +0 -13
- package/templates/chat-app/chatjs/plugins/feedback/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/followup-suggestions/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/guest-chat/server-plugin.ts +0 -12
- package/templates/chat-app/chatjs/plugins/image-viewer/chatjs.json +0 -17
- package/templates/chat-app/chatjs/plugins/mcp/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/model-preferences/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/projects/server-plugin.ts +0 -8
- package/templates/chat-app/chatjs/plugins/search/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/sharing/server-plugin.ts +0 -5
- package/templates/chat-app/chatjs/plugins/spreadsheet-viewer/chatjs.json +0 -18
- package/templates/chat-app/chatjs/plugins/video-viewer/chatjs.json +0 -16
- package/templates/chat-app/components/ai-elements/context-hover.radix.tsx +0 -15
- package/templates/chat-app/components/ai-elements/context-hover.tsx +0 -17
- package/templates/chat-app/components/ai-elements/context.tsx +0 -405
- package/templates/chat-app/components/composer/editor.css +0 -96
- package/templates/chat-app/components/lexical-chat-input.tsx +0 -276
- package/templates/chat-app/components/model-selection-indicator.radix.tsx +0 -17
- package/templates/chat-app/components/ui/resizable.tsx +0 -49
- package/templates/chat-app/lib/ai/gateways/fallback-models.ts +0 -29
- package/templates/chat-app/lib/ai/models.generated.ts +0 -4242
- package/templates/chat-app/lib/ai/usage-token-details.test.ts +0 -76
- package/templates/chat-app/lib/ai/usage-token-details.ts +0 -33
- package/templates/chat-app/lib/chat-route.ts +0 -18
- package/templates/chat-app/providers/parse-chat-id-from-pathname.test.ts +0 -126
- package/templates/chat-app/providers/parse-chat-id-from-pathname.ts +0 -51
- package/templates/chat-app/scripts/fetch-models.ts +0 -30
- package/templates/chat-app/scripts/gateway-snapshot-warning.test.ts +0 -9
- /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
|
|
2
|
+
import creditsBilling from "@/chatjs/plugins/credits/billing";
|
|
3
3
|
import type { UsageBilling } from "@/chatjs/core/billing/contracts";
|
|
4
|
-
export const installedBilling: readonly UsageBilling[] = [
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
2
|
+
import guestChatCleanup from "@/chatjs/plugins/guest-chat/cleanup";
|
|
3
3
|
import type { CleanupTask } from "@/lib/cleanup/contracts";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
[
|
|
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 {
|
|
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[] = [
|
|
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 {
|
|
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
|
-
|
|
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
|
|
2
|
+
import desktopNavigation from "@/chatjs/plugins/desktop/navigation";
|
|
3
3
|
export const installedNavigationHandlers: readonly (() => boolean)[] = [
|
|
4
|
-
|
|
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 {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
|
2
|
+
import guestChatProfile from "@/chatjs/plugins/guest-chat/session-profile";
|
|
3
3
|
import type { SessionProfile } from "@/chatjs/core/session/contracts";
|
|
4
|
-
if (
|
|
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[] = [
|
|
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
|
|
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
|
-
[
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
5
|
+
attachmentUploads,
|
|
6
6
|
];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ChatServerIntegration } from "@/chatjs/core/chat/contracts";
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
64
|
+
branchId,
|
|
65
65
|
message,
|
|
66
66
|
ownerId,
|
|
67
67
|
}: Readonly<{
|
|
68
|
-
|
|
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
|
-
|
|
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
|
-
|
|
92
|
+
branchId,
|
|
95
93
|
fallbackTitle,
|
|
96
94
|
generated.title
|
|
97
95
|
)
|
|
98
|
-
: settleEveRootFallbackTitle(ownerId,
|
|
96
|
+
: settleEveRootFallbackTitle(ownerId, branchId, fallbackTitle));
|
|
99
97
|
} catch (error) {
|
|
100
98
|
log.warn(
|
|
101
99
|
{
|
|
102
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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,
|
|
46
|
+
eq(eveConversation.id, branchId),
|
|
47
47
|
eq(eveConversation.ownerId, ownerId),
|
|
48
48
|
eq(eveConversation.state, "bound"),
|
|
49
49
|
eq(eveChat.id, eveConversation.chatId),
|
package/templates/chat-app/chatjs/plugins/attachment-uploads/{client-plugin.ts → chat-ui.ts}
RENAMED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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/
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
6
|
+
export const layoutUi = definePlugin({
|
|
7
7
|
id: "desktop",
|
|
8
8
|
slots: [slot(LayoutEffects, ElectronAuthHandler)],
|
|
9
9
|
});
|
|
@@ -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/
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
11
|
+
branchId,
|
|
12
12
|
messageId,
|
|
13
13
|
disabled,
|
|
14
14
|
}: {
|
|
15
|
-
readonly
|
|
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({
|
|
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({
|
|
63
|
+
await mutation.mutateAsync({ branchId, messageId, type })
|
|
64
64
|
}
|
|
65
65
|
vote={votes.data?.find((vote) => vote.messageId === messageId)}
|
|
66
66
|
/>
|