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
|
@@ -4,7 +4,7 @@ import { ComposerExtensions, SettingsLinks } from "@/components/chat-slots";
|
|
|
4
4
|
import { ConnectorsControl } from "./composer";
|
|
5
5
|
import { ConnectorsSettingsLink } from "./settings";
|
|
6
6
|
|
|
7
|
-
export const
|
|
7
|
+
export const chatUi = definePlugin({
|
|
8
8
|
id: "mcp",
|
|
9
9
|
slots: [
|
|
10
10
|
slot(ComposerExtensions, ConnectorsControl),
|
|
@@ -2,7 +2,7 @@ import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
|
2
2
|
|
|
3
3
|
import { customType } from "drizzle-orm/pg-core";
|
|
4
4
|
|
|
5
|
-
import { readMcpEncryptionKey } from "@/chatjs/plugins/mcp/
|
|
5
|
+
import { readMcpEncryptionKey } from "@/chatjs/plugins/mcp/validate-env";
|
|
6
6
|
|
|
7
7
|
const isJsonObject = (value: unknown): value is Record<string, unknown> =>
|
|
8
8
|
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
+
"contractVersion": 3,
|
|
3
|
+
"uiBase": "base",
|
|
2
4
|
"id": "mcp",
|
|
3
5
|
"kind": "plugin",
|
|
4
6
|
"files": [
|
|
@@ -20,9 +22,9 @@
|
|
|
20
22
|
"chatjs/plugins/mcp/connector-menu-item.tsx",
|
|
21
23
|
"chatjs/plugins/mcp/db/mcp-schema.ts",
|
|
22
24
|
"chatjs/plugins/mcp/db/encrypted-text.ts",
|
|
23
|
-
"chatjs/plugins/mcp/mcp-env.ts",
|
|
24
25
|
"chatjs/plugins/mcp/settings.tsx",
|
|
25
26
|
"chatjs/plugins/mcp/setup.ts",
|
|
27
|
+
"chatjs/plugins/mcp/validate-env.ts",
|
|
26
28
|
"chatjs/plugins/mcp/oauth/cache.ts",
|
|
27
29
|
"chatjs/plugins/mcp/oauth/mcp-client-manager.ts",
|
|
28
30
|
"chatjs/plugins/mcp/oauth/mcp-client.ts",
|
|
@@ -38,18 +40,8 @@
|
|
|
38
40
|
"chatjs/plugins/mcp/search/mcp-search-params.ts",
|
|
39
41
|
"chatjs/plugins/mcp/search/mcp-search-params.server.ts",
|
|
40
42
|
"chatjs/plugins/mcp/router.ts",
|
|
41
|
-
"chatjs/plugins/mcp/
|
|
42
|
-
"chatjs/plugins/mcp/server-plugin.ts"
|
|
43
|
+
"chatjs/plugins/mcp/chat-ui.ts"
|
|
43
44
|
],
|
|
44
|
-
"environmentValidation": "mcp-env.ts",
|
|
45
45
|
"databaseSchemas": ["chatjs/plugins/mcp/db/mcp-schema.ts"],
|
|
46
|
-
"envRequirements": [{ "options": [["MCP_ENCRYPTION_KEY"]] }]
|
|
47
|
-
"server": { "export": "mcp", "routers": ["mcp"] },
|
|
48
|
-
"client": {
|
|
49
|
-
"export": "mcpClient",
|
|
50
|
-
"composerControls": ["mcp"],
|
|
51
|
-
"settingsItems": ["mcp"]
|
|
52
|
-
},
|
|
53
|
-
"contractVersion": 2,
|
|
54
|
-
"uiBase": "base"
|
|
46
|
+
"envRequirements": [{ "options": [["MCP_ENCRYPTION_KEY"]] }]
|
|
55
47
|
}
|
|
@@ -217,7 +217,7 @@ const publicConnector = (connector: PublicConnectorInput): PublicConnector => ({
|
|
|
217
217
|
userId: connector.userId,
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
const mcpProcedures = {
|
|
221
221
|
/**
|
|
222
222
|
* Initiate OAuth authorization for an MCP connector.
|
|
223
223
|
* Returns the authorization URL that the client should open in a popup.
|
|
@@ -849,4 +849,6 @@ export const mcpRouter = createTRPCRouter({
|
|
|
849
849
|
return { success: true };
|
|
850
850
|
}
|
|
851
851
|
),
|
|
852
|
-
}
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
export const router = createTRPCRouter({ mcp: mcpProcedures });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
|
|
2
|
+
import { NuqsAdapter } from "nuqs/adapters/next/app";
|
|
2
3
|
import { connection } from "next/server";
|
|
3
4
|
import React, { Suspense } from "react";
|
|
4
5
|
|
|
@@ -32,7 +33,9 @@ const ConnectorsSettingsContent = async (): Promise<React.JSX.Element> => {
|
|
|
32
33
|
<HydrationBoundary state={dehydrate(queryClient)}>
|
|
33
34
|
<SettingsPage>
|
|
34
35
|
<ConnectorsSettingsHeader />
|
|
35
|
-
<
|
|
36
|
+
<NuqsAdapter>
|
|
37
|
+
<ConnectorsSettings />
|
|
38
|
+
</NuqsAdapter>
|
|
36
39
|
</SettingsPage>
|
|
37
40
|
</HydrationBoundary>
|
|
38
41
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import descriptor from "@/chatjs/plugins/mcp/
|
|
2
|
-
import
|
|
1
|
+
import descriptor from "@/chatjs/plugins/mcp/plugin.json";
|
|
2
|
+
import validateEnvironment from "./validate-env";
|
|
3
3
|
import {
|
|
4
4
|
MissingCredentialsError,
|
|
5
5
|
requireCredentials,
|
|
@@ -123,7 +123,7 @@ export const McpConnectDialog = ({
|
|
|
123
123
|
}}
|
|
124
124
|
open={open}
|
|
125
125
|
>
|
|
126
|
-
<DialogContent className="sm:max-w-md">
|
|
126
|
+
<DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md">
|
|
127
127
|
<DialogHeader className="overflow-hidden">
|
|
128
128
|
<div className="flex items-center gap-3 overflow-hidden">
|
|
129
129
|
<div className="bg-muted flex size-10 shrink-0 items-center justify-center rounded-md">
|
|
@@ -169,7 +169,7 @@ export const McpCreateDialog = ({
|
|
|
169
169
|
}}
|
|
170
170
|
open={open}
|
|
171
171
|
>
|
|
172
|
-
<DialogContent className="sm:max-w-md">
|
|
172
|
+
<DialogContent className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md">
|
|
173
173
|
<DialogHeader>
|
|
174
174
|
<DialogTitle className="flex items-center gap-2">
|
|
175
175
|
Add custom connector
|
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
import { definePlugin, slot } from "@/chatjs/core/ui/slots";
|
|
3
3
|
import { ModelSettingsLink } from "@/components/chat-slots";
|
|
4
4
|
import { ModelPreferencesLink } from "./settings-link";
|
|
5
|
-
import { useModelPreferences } from "./use-model-preferences";
|
|
6
5
|
|
|
7
|
-
export const
|
|
6
|
+
export const chatUi = definePlugin({
|
|
8
7
|
id: "model-preferences",
|
|
9
8
|
slots: [slot(ModelSettingsLink, ModelPreferencesLink)],
|
|
10
|
-
useModelVisibility: useModelPreferences,
|
|
11
9
|
});
|
|
@@ -44,6 +44,9 @@ const ModelRowComponent = ({
|
|
|
44
44
|
</TableCell>
|
|
45
45
|
<TableCell className="py-2.5 pr-0">
|
|
46
46
|
<Switch
|
|
47
|
+
aria-label={
|
|
48
|
+
model.reasoning === true ? `${model.name} (reasoning)` : model.name
|
|
49
|
+
}
|
|
47
50
|
checked={isEnabled}
|
|
48
51
|
onCheckedChange={() => {
|
|
49
52
|
onToggle(model.id, isEnabled);
|
|
@@ -6,7 +6,7 @@ import { useSession } from "@/providers/session-provider";
|
|
|
6
6
|
import { useTRPC } from "@/trpc/react";
|
|
7
7
|
import { applyModelPreferences } from "./apply-model-preferences";
|
|
8
8
|
|
|
9
|
-
export const
|
|
9
|
+
export const useModelVisibility = (
|
|
10
10
|
defaults: ReadonlySet<string>
|
|
11
11
|
): ReadonlySet<string> => {
|
|
12
12
|
const trpc = useTRPC();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"contractVersion": 3,
|
|
3
|
+
"uiBase": "base",
|
|
2
4
|
"id": "model-preferences",
|
|
3
5
|
"kind": "plugin",
|
|
4
6
|
"files": [
|
|
5
7
|
"chatjs/plugins/model-preferences/apply-model-preferences.ts",
|
|
6
|
-
"chatjs/plugins/model-preferences/
|
|
8
|
+
"chatjs/plugins/model-preferences/chat-ui.ts",
|
|
7
9
|
"chatjs/plugins/model-preferences/settings-link.tsx",
|
|
8
10
|
"chatjs/plugins/model-preferences/model-preferences-queries.ts",
|
|
9
11
|
"chatjs/plugins/model-preferences/model-preferences-schema.ts",
|
|
@@ -12,20 +14,10 @@
|
|
|
12
14
|
"chatjs/plugins/model-preferences/models-settings.tsx",
|
|
13
15
|
"chatjs/plugins/model-preferences/models-table.tsx",
|
|
14
16
|
"chatjs/plugins/model-preferences/router.ts",
|
|
15
|
-
"chatjs/plugins/model-preferences/
|
|
16
|
-
"chatjs/plugins/model-preferences/use-model-preferences.ts",
|
|
17
|
+
"chatjs/plugins/model-preferences/model-visibility.ts",
|
|
17
18
|
"app/(chat)/settings/models/page.tsx"
|
|
18
19
|
],
|
|
19
20
|
"databaseSchemas": [
|
|
20
21
|
"chatjs/plugins/model-preferences/model-preferences-schema.ts"
|
|
21
|
-
]
|
|
22
|
-
"server": { "export": "modelPreferences", "routers": ["modelPreferences"] },
|
|
23
|
-
"client": {
|
|
24
|
-
"export": "modelPreferencesClient",
|
|
25
|
-
"composerControls": [],
|
|
26
|
-
"settingsItems": ["models"],
|
|
27
|
-
"modelVisibility": true
|
|
28
|
-
},
|
|
29
|
-
"contractVersion": 2,
|
|
30
|
-
"uiBase": "base"
|
|
22
|
+
]
|
|
31
23
|
}
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { createTRPCRouter, protectedProcedure } from "@/trpc/init";
|
|
9
9
|
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const modelPreferencesProcedures = {
|
|
12
12
|
getModelPreferences: protectedProcedure.query(
|
|
13
13
|
async ({
|
|
14
14
|
ctx,
|
|
@@ -43,4 +43,8 @@ export const modelPreferencesRouter = createTRPCRouter({
|
|
|
43
43
|
return { success: true };
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const router = createTRPCRouter({
|
|
49
|
+
modelPreferences: modelPreferencesProcedures,
|
|
46
50
|
});
|
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
import { eveChatProject } from "./db/project-schema";
|
|
10
10
|
import { assignCreationProject } from "./creation";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const projectsChat = {
|
|
13
13
|
onCreate: assignCreationProject,
|
|
14
14
|
historyFilter: (
|
|
15
15
|
{ projectId }: { readonly projectId?: string | null },
|
|
@@ -53,3 +53,5 @@ export const projectsChat = {
|
|
|
53
53
|
await tx.delete(eveChatProject).where(eq(eveChatProject.chatId, chatId));
|
|
54
54
|
},
|
|
55
55
|
} satisfies ChatServerIntegration;
|
|
56
|
+
|
|
57
|
+
export default projectsChat;
|
|
@@ -95,7 +95,7 @@ const assignEveConversationProject = async (
|
|
|
95
95
|
ownerId: string,
|
|
96
96
|
routeId: string,
|
|
97
97
|
projectId: string | null
|
|
98
|
-
): Promise<{
|
|
98
|
+
): Promise<{ id: string; projectId: string | null } | null> =>
|
|
99
99
|
await updateOwnedChat(
|
|
100
100
|
{ ownerId, chatId: routeId },
|
|
101
101
|
async ({ tx, chatId }) => {
|
|
@@ -120,7 +120,7 @@ const assignEveConversationProject = async (
|
|
|
120
120
|
target: eveChatProject.chatId,
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
return {
|
|
123
|
+
return { id: routeId, projectId };
|
|
124
124
|
}
|
|
125
125
|
);
|
|
126
126
|
const getEveConversationProject = async (
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
+
"contractVersion": 3,
|
|
3
|
+
"uiBase": "base",
|
|
2
4
|
"id": "projects",
|
|
3
5
|
"kind": "plugin",
|
|
4
6
|
"files": [
|
|
5
|
-
"chatjs/plugins/projects/chat.ts",
|
|
6
|
-
"chatjs/plugins/projects/
|
|
7
|
+
"chatjs/plugins/projects/chat-server.ts",
|
|
8
|
+
"chatjs/plugins/projects/chat-ui.ts",
|
|
7
9
|
"chatjs/plugins/projects/conversation-hook.ts",
|
|
8
10
|
"chatjs/plugins/projects/creation.ts",
|
|
9
11
|
"chatjs/plugins/projects/db/project-queries.ts",
|
|
@@ -14,7 +16,6 @@
|
|
|
14
16
|
"chatjs/plugins/projects/router.ts",
|
|
15
17
|
"chatjs/plugins/projects/routes/project-chat-page.tsx",
|
|
16
18
|
"chatjs/plugins/projects/routes/project-page.tsx",
|
|
17
|
-
"chatjs/plugins/projects/server-plugin.ts",
|
|
18
19
|
"chatjs/plugins/projects/ui/chat-contributions.tsx",
|
|
19
20
|
"chatjs/plugins/projects/ui/move-menu-item.tsx",
|
|
20
21
|
"chatjs/plugins/projects/ui/delete-project-dialog.tsx",
|
|
@@ -36,15 +37,5 @@
|
|
|
36
37
|
"app/(chat)/project/[projectId]/chat/[chatId]/page.tsx",
|
|
37
38
|
"app/(chat)/project/[projectId]/page.tsx"
|
|
38
39
|
],
|
|
39
|
-
"databaseSchemas": ["chatjs/plugins/projects/db/project-schema.ts"]
|
|
40
|
-
"chat": { "export": "projectsChat" },
|
|
41
|
-
"server": { "export": "projects", "routers": ["project"] },
|
|
42
|
-
"client": {
|
|
43
|
-
"export": "projectsClient",
|
|
44
|
-
"composerControls": [],
|
|
45
|
-
"settingsItems": [],
|
|
46
|
-
"chat": true
|
|
47
|
-
},
|
|
48
|
-
"contractVersion": 2,
|
|
49
|
-
"uiBase": "base"
|
|
40
|
+
"databaseSchemas": ["chatjs/plugins/projects/db/project-schema.ts"]
|
|
50
41
|
}
|
|
@@ -19,11 +19,9 @@ import { generateUUID } from "@/lib/id";
|
|
|
19
19
|
import { createTRPCRouter, protectedProcedure } from "@/trpc/init";
|
|
20
20
|
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const projectProcedures = {
|
|
23
23
|
assign: protectedProcedure
|
|
24
|
-
.input(
|
|
25
|
-
z.object({ conversationId: z.uuid(), projectId: z.uuid().nullable() })
|
|
26
|
-
)
|
|
24
|
+
.input(z.object({ id: z.uuid(), projectId: z.uuid().nullable() }))
|
|
27
25
|
.mutation(
|
|
28
26
|
async ({
|
|
29
27
|
ctx,
|
|
@@ -31,13 +29,13 @@ export const projectRouter = createTRPCRouter({
|
|
|
31
29
|
}: {
|
|
32
30
|
readonly ctx: { readonly user: { readonly id: string } };
|
|
33
31
|
readonly input: ReadonlyNativeSurface<{
|
|
34
|
-
|
|
32
|
+
id: string;
|
|
35
33
|
projectId: string | null;
|
|
36
34
|
}>;
|
|
37
35
|
}) => {
|
|
38
36
|
const assigned = await assignEveConversationProject(
|
|
39
37
|
ctx.user.id,
|
|
40
|
-
input.
|
|
38
|
+
input.id,
|
|
41
39
|
input.projectId
|
|
42
40
|
);
|
|
43
41
|
if (!assigned) {
|
|
@@ -313,4 +311,6 @@ export const projectRouter = createTRPCRouter({
|
|
|
313
311
|
return { success: true };
|
|
314
312
|
}
|
|
315
313
|
),
|
|
316
|
-
}
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export const router = createTRPCRouter({ project: projectProcedures });
|
|
@@ -3,6 +3,8 @@ import { notFound, redirect } from "next/navigation";
|
|
|
3
3
|
import React, { Suspense } from "react";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
|
+
import { InternalLink } from "@/components/internal-link";
|
|
7
|
+
import { buttonVariants } from "@/components/ui/button";
|
|
6
8
|
import { EveCreationRecovery } from "@/components/eve/eve-creation-recovery";
|
|
7
9
|
import { EveProjectHome } from "@/chatjs/plugins/projects/ui/eve-project-home";
|
|
8
10
|
import { auth } from "@/lib/auth";
|
|
@@ -29,9 +31,10 @@ const ProjectContent = async ({
|
|
|
29
31
|
const project = await getProjectById({ id: projectId });
|
|
30
32
|
if (project === undefined || project.userId !== session.user.id) {
|
|
31
33
|
return (
|
|
32
|
-
<div className="p-4">
|
|
34
|
+
<div className="space-y-4 p-4">
|
|
33
35
|
<h1 className="text-xl font-semibold">Project unavailable</h1>
|
|
34
36
|
<EveCreationRecovery
|
|
37
|
+
missingRequestMessage="This project may have been deleted, or your account may not have access."
|
|
35
38
|
firstMessage=""
|
|
36
39
|
ownerId={session.user.id}
|
|
37
40
|
scope={{
|
|
@@ -41,6 +44,12 @@ const ProjectContent = async ({
|
|
|
41
44
|
},
|
|
42
45
|
}}
|
|
43
46
|
/>
|
|
47
|
+
<InternalLink
|
|
48
|
+
className={buttonVariants({ variant: "outline" })}
|
|
49
|
+
href="/"
|
|
50
|
+
>
|
|
51
|
+
Back to chats
|
|
52
|
+
</InternalLink>
|
|
44
53
|
</div>
|
|
45
54
|
);
|
|
46
55
|
}
|
|
@@ -24,11 +24,11 @@ import { getProjectColorName, getProjectIconName } from "../project-icons";
|
|
|
24
24
|
import { EveMoveProjectDialog } from "./eve-move-project-dialog";
|
|
25
25
|
|
|
26
26
|
export const ProjectsSidebar = ({
|
|
27
|
-
|
|
27
|
+
chatId,
|
|
28
28
|
allowManagement = true,
|
|
29
29
|
onProjectSelect,
|
|
30
30
|
}: {
|
|
31
|
-
readonly
|
|
31
|
+
readonly chatId?: string;
|
|
32
32
|
readonly allowManagement?: boolean;
|
|
33
33
|
readonly onProjectSelect?: (id: string) => void;
|
|
34
34
|
}): React.JSX.Element | null => {
|
|
@@ -38,7 +38,7 @@ export const ProjectsSidebar = ({
|
|
|
38
38
|
<SidebarGroupLabel>Projects</SidebarGroupLabel>
|
|
39
39
|
<SidebarMenu>
|
|
40
40
|
<SidebarProjects
|
|
41
|
-
|
|
41
|
+
chatId={chatId}
|
|
42
42
|
allowManagement={allowManagement}
|
|
43
43
|
onProjectSelect={onProjectSelect}
|
|
44
44
|
/>
|
|
@@ -40,9 +40,6 @@ export const DeleteProjectDialog = ({
|
|
|
40
40
|
|
|
41
41
|
const deleteMutation = useMutation(
|
|
42
42
|
trpc.project.remove.mutationOptions({
|
|
43
|
-
onError: () => {
|
|
44
|
-
toast.error("Failed to delete project");
|
|
45
|
-
},
|
|
46
43
|
onSuccess: async () => {
|
|
47
44
|
await Promise.all([
|
|
48
45
|
queryClient.invalidateQueries({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import React, { useState } from "react";
|
|
4
4
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { useParams, useRouter } from "next/navigation";
|
|
7
7
|
|
|
8
8
|
import { FolderPlus } from "lucide-react";
|
|
9
9
|
|
|
@@ -21,19 +21,19 @@ import {
|
|
|
21
21
|
} from "@/components/ui/sidebar";
|
|
22
22
|
import type { ReadonlyNativeSurface } from "@/lib/readonly-native-surface";
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { useActiveChatId } from "@/components/chat/chat-navigation";
|
|
25
25
|
import { useTRPC } from "@/trpc/react";
|
|
26
26
|
|
|
27
27
|
export const SidebarProjects = ({
|
|
28
|
-
|
|
28
|
+
chatId,
|
|
29
29
|
allowManagement = true,
|
|
30
30
|
onProjectSelect,
|
|
31
31
|
}: {
|
|
32
|
-
readonly
|
|
32
|
+
readonly chatId?: string;
|
|
33
33
|
readonly allowManagement?: boolean;
|
|
34
34
|
readonly onProjectSelect?: (id: string) => void;
|
|
35
35
|
}): ReactJSX.Element => {
|
|
36
|
-
const
|
|
36
|
+
const params = useParams();
|
|
37
37
|
const router = useRouter();
|
|
38
38
|
const trpc = useTRPC();
|
|
39
39
|
const queryClient = useQueryClient();
|
|
@@ -43,17 +43,18 @@ export const SidebarProjects = ({
|
|
|
43
43
|
);
|
|
44
44
|
const [newProjectDialogOpen, setNewProjectDialogOpen] = useState(false);
|
|
45
45
|
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const routeChatId = useActiveChatId();
|
|
47
|
+
const activeChatId = chatId ?? routeChatId;
|
|
48
48
|
const membership = useQuery(
|
|
49
49
|
trpc.project.forChat.queryOptions(
|
|
50
|
-
{ id:
|
|
51
|
-
{ enabled: Boolean(
|
|
50
|
+
{ id: activeChatId ?? "" },
|
|
51
|
+
{ enabled: Boolean(activeChatId) }
|
|
52
52
|
)
|
|
53
53
|
);
|
|
54
54
|
const currentProjectId =
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
typeof params?.projectId === "string"
|
|
56
|
+
? params.projectId
|
|
57
|
+
: membership.data?.id;
|
|
57
58
|
|
|
58
59
|
const createProjectMutation = useMutation(
|
|
59
60
|
trpc.project.create.mutationOptions({
|
|
@@ -2,17 +2,19 @@ import { inArray } from "drizzle-orm";
|
|
|
2
2
|
import type { ChatServerIntegration } from "@/chatjs/core/chat/contracts";
|
|
3
3
|
import { eveSearchText } from "./search-schema";
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
afterBranch: async ({ ownerId,
|
|
5
|
+
const searchChat = {
|
|
6
|
+
afterBranch: async ({ ownerId, branchId, sessionId }) => {
|
|
7
7
|
const { backfillEveSearchConversation } = await import("./search-backfill");
|
|
8
|
-
await backfillEveSearchConversation(ownerId,
|
|
8
|
+
await backfillEveSearchConversation(ownerId, branchId, sessionId);
|
|
9
9
|
},
|
|
10
|
-
onDeleteConversations: async (tx, {
|
|
11
|
-
if (
|
|
10
|
+
onDeleteConversations: async (tx, { branchIds }) => {
|
|
11
|
+
if (branchIds.length === 0) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
await tx
|
|
15
15
|
.delete(eveSearchText)
|
|
16
|
-
.where(inArray(eveSearchText.
|
|
16
|
+
.where(inArray(eveSearchText.branchId, [...branchIds]));
|
|
17
17
|
},
|
|
18
18
|
} satisfies ChatServerIntegration;
|
|
19
|
+
|
|
20
|
+
export default searchChat;
|
|
@@ -3,7 +3,7 @@ import { definePlugin, slot } from "@/chatjs/core/ui/slots";
|
|
|
3
3
|
import { SidebarHeaderItems } from "@/components/chat-slots";
|
|
4
4
|
import { SearchSidebarItem } from "./sidebar-item";
|
|
5
5
|
|
|
6
|
-
export const
|
|
6
|
+
export const chatUi = definePlugin({
|
|
7
7
|
id: "search",
|
|
8
8
|
slots: [slot(SidebarHeaderItems, SearchSidebarItem)],
|
|
9
9
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
+
"contractVersion": 3,
|
|
3
|
+
"uiBase": "base",
|
|
2
4
|
"id": "search",
|
|
3
5
|
"kind": "plugin",
|
|
4
6
|
"files": [
|
|
5
7
|
"chatjs/plugins/search/backfill.ts",
|
|
6
|
-
"chatjs/plugins/search/chat.ts",
|
|
7
|
-
"chatjs/plugins/search/
|
|
8
|
+
"chatjs/plugins/search/chat-server.ts",
|
|
9
|
+
"chatjs/plugins/search/chat-ui.ts",
|
|
8
10
|
"chatjs/plugins/search/sidebar-item.tsx",
|
|
9
11
|
"chatjs/plugins/search/router.ts",
|
|
10
12
|
"chatjs/plugins/search/search-backfill.ts",
|
|
@@ -16,19 +18,8 @@
|
|
|
16
18
|
"chatjs/plugins/search/search-results-view.tsx",
|
|
17
19
|
"chatjs/plugins/search/search-schema.ts",
|
|
18
20
|
"chatjs/plugins/search/search-text.ts",
|
|
19
|
-
"chatjs/plugins/search/server-plugin.ts",
|
|
20
21
|
"chatjs/plugins/search/use-debounced-search.ts",
|
|
21
22
|
"agent/hooks/search.ts"
|
|
22
23
|
],
|
|
23
|
-
"databaseSchemas": ["chatjs/plugins/search/search-schema.ts"]
|
|
24
|
-
"chat": { "export": "searchChat" },
|
|
25
|
-
"server": { "export": "search", "routers": ["search"] },
|
|
26
|
-
"client": {
|
|
27
|
-
"export": "searchClient",
|
|
28
|
-
"composerControls": [],
|
|
29
|
-
"settingsItems": [],
|
|
30
|
-
"chat": true
|
|
31
|
-
},
|
|
32
|
-
"contractVersion": 2,
|
|
33
|
-
"uiBase": "base"
|
|
24
|
+
"databaseSchemas": ["chatjs/plugins/search/search-schema.ts"]
|
|
34
25
|
}
|
|
@@ -7,7 +7,7 @@ import { MAX_SEARCH_QUERY_LENGTH } from "./search-text";
|
|
|
7
7
|
import { searchEveConversations } from "./search-queries";
|
|
8
8
|
|
|
9
9
|
const MAX_OWNER_SCOPE_LENGTH = 128;
|
|
10
|
-
|
|
10
|
+
const searchProcedures = {
|
|
11
11
|
query: eveOwnedProcedure
|
|
12
12
|
.input(
|
|
13
13
|
z.object({
|
|
@@ -43,4 +43,6 @@ export const searchRouter = createTRPCRouter({
|
|
|
43
43
|
return await searchEveConversations(ctx.eveOwnerId, input);
|
|
44
44
|
}
|
|
45
45
|
),
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const router = createTRPCRouter({ search: searchProcedures });
|