From c8fd001892c6752b406f5d4de0f0f4b558e1c820 Mon Sep 17 00:00:00 2001 From: Vova Kulikov Date: Tue, 30 Jul 2024 12:34:43 -0300 Subject: [PATCH] Bump cody web to most recent package @sourcegraph/cody-web (#64149) A few things this PR does - Update cody web to the most updated version and package name which is (`@sourcegraph/cody-web`) - Support custom telemetry name for cody web events (on dotcom it should be `dotcom.web` and `server.web` on the enterprise instance - The most updated release of Cody Web includes - fixes for remote LLM models on enterprise - improvements for performance rendering Chat UI - telemetry fixes ## Test plan - Manual checks over Cody Web chat UI (standalone chat page and the blob UI side panel chat) --- client/web/BUILD.bazel | 2 +- .../cody/chat/new-chat/NewCodyChatPage.tsx | 4 +- .../new-chat/components/chat-ui/ChatUi.tsx | 5 +- .../NewCodySidebarWebChat.tsx | 5 +- client/web/src/telemetry/index.ts | 2 +- package.json | 2 +- pnpm-lock.yaml | 52 +++++++++---------- 7 files changed, 38 insertions(+), 34 deletions(-) diff --git a/client/web/BUILD.bazel b/client/web/BUILD.bazel index f4c8470b956..e535e4914c8 100644 --- a/client/web/BUILD.bazel +++ b/client/web/BUILD.bazel @@ -1808,6 +1808,7 @@ ts_project( "//:node_modules/@reach/tabs", "//:node_modules/@reach/visually-hidden", "//:node_modules/@sentry/browser", + "//:node_modules/@sourcegraph/cody-web", "//:node_modules/@sourcegraph/extension-api-classes", "//:node_modules/@stripe/react-stripe-js", "//:node_modules/@stripe/stripe-js", @@ -1838,7 +1839,6 @@ ts_project( "//:node_modules/apollo3-cache-persist", "//:node_modules/bloomfilter", "//:node_modules/classnames", - "//:node_modules/cody-web-experimental", "//:node_modules/copy-to-clipboard", "//:node_modules/d3-scale-chromatic", "//:node_modules/d3-time-format", diff --git a/client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx b/client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx index a12f42168b6..c3783979d7b 100644 --- a/client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx +++ b/client/web/src/cody/chat/new-chat/NewCodyChatPage.tsx @@ -1,13 +1,14 @@ import type { FC } from 'react' -import { CodyWebHistory, CodyWebChatProvider } from 'cody-web-experimental' import { Navigate } from 'react-router-dom' +import { CodyWebHistory, CodyWebChatProvider } from '@sourcegraph/cody-web' import { ButtonLink, PageHeader, ProductStatusBadge, Text } from '@sourcegraph/wildcard' import { Page } from '../../../components/Page' import { PageTitle } from '../../../components/PageTitle' import { PageRoutes } from '../../../routes.constants' +import { getTelemetrySourceClient } from '../../../telemetry' import { CodyProRoutes } from '../../codyProRoutes' import { CodyColorIcon } from '../CodyPageIcon' @@ -35,6 +36,7 @@ export const NewCodyChatPage: FC = props => { accessToken="" serverEndpoint={window.location.origin} customHeaders={window.context.xhrHeaders} + telemetryClientName={getTelemetrySourceClient()} > {history => ( diff --git a/client/web/src/cody/chat/new-chat/components/chat-ui/ChatUi.tsx b/client/web/src/cody/chat/new-chat/components/chat-ui/ChatUi.tsx index fa5cf3403a2..bd22545bc11 100644 --- a/client/web/src/cody/chat/new-chat/components/chat-ui/ChatUi.tsx +++ b/client/web/src/cody/chat/new-chat/components/chat-ui/ChatUi.tsx @@ -1,9 +1,10 @@ import type { FC } from 'react' import classnames from 'classnames' -import { CodyWebChat } from 'cody-web-experimental' -import 'cody-web-experimental/dist/style.css' +import { CodyWebChat } from '@sourcegraph/cody-web' + +import '@sourcegraph/cody-web/dist/style.css' import styles from './ChatUI.module.scss' diff --git a/client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebarWebChat.tsx b/client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebarWebChat.tsx index 110af74393c..5620aba207d 100644 --- a/client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebarWebChat.tsx +++ b/client/web/src/cody/sidebar/new-cody-sidebar/NewCodySidebarWebChat.tsx @@ -1,9 +1,9 @@ import { type FC, memo, useCallback, useMemo } from 'react' -import { CodyWebChatProvider } from 'cody-web-experimental' - +import { CodyWebChatProvider } from '@sourcegraph/cody-web' import { useLocalStorage } from '@sourcegraph/wildcard' +import { getTelemetrySourceClient } from '../../../telemetry' import { ChatUi } from '../../chat/new-chat/components/chat-ui/ChatUi' interface Repository { @@ -49,6 +49,7 @@ export const NewCodySidebarWebChat: FC = memo(functi initialContext={contextInfo} serverEndpoint={window.location.origin} customHeaders={window.context.xhrHeaders} + telemetryClientName={getTelemetrySourceClient()} onNewChatCreated={handleNewChatCreated} > diff --git a/client/web/src/telemetry/index.ts b/client/web/src/telemetry/index.ts index 783442e6be1..dea703319c8 100644 --- a/client/web/src/telemetry/index.ts +++ b/client/web/src/telemetry/index.ts @@ -12,7 +12,7 @@ import { import { ApolloTelemetryExporter } from './apolloTelemetryExporter' -function getTelemetrySourceClient(): string { +export function getTelemetrySourceClient(): string { if (window.context?.sourcegraphDotComMode) { return 'dotcom.web' } diff --git a/package.json b/package.json index ad90e2568c3..32e0a4dc3c5 100644 --- a/package.json +++ b/package.json @@ -309,6 +309,7 @@ "@reach/visually-hidden": "^0.16.0", "@react-aria/live-announcer": "^3.1.0", "@sentry/browser": "^7.8.1", + "@sourcegraph/cody-web": "^0.3.0", "@sourcegraph/extension-api-classes": "^1.1.0", "@stripe/react-stripe-js": "^2.7.0", "@stripe/stripe-js": "^3.3.0", @@ -333,7 +334,6 @@ "bloomfilter": "^0.0.18", "buffer": "^6.0.3", "classnames": "^2.2.6", - "cody-web-experimental": "^0.2.7", "comlink": "^4.3.0", "copy-to-clipboard": "^3.3.1", "core-js": "^3.8.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 722fe275123..68675507690 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -145,6 +145,9 @@ importers: '@sentry/browser': specifier: ^7.8.1 version: 7.8.1 + '@sourcegraph/cody-web': + specifier: ^0.3.0 + version: 0.3.0 '@sourcegraph/extension-api-classes': specifier: ^1.1.0 version: 1.1.0(sourcegraph@client+extension-api) @@ -217,9 +220,6 @@ importers: classnames: specifier: ^2.2.6 version: 2.3.2 - cody-web-experimental: - specifier: ^0.2.7 - version: 0.2.7 comlink: specifier: ^4.3.0 version: 4.3.0 @@ -6031,7 +6031,7 @@ packages: dependencies: '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.0 + '@types/node': 20.11.19 jest-mock: 29.7.0 dev: false @@ -6041,7 +6041,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@sinonjs/fake-timers': 10.3.0 - '@types/node': 20.8.0 + '@types/node': 20.11.19 jest-message-util: 29.7.0 jest-mock: 29.7.0 jest-util: 29.7.0 @@ -6080,7 +6080,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.8.0 + '@types/node': 20.11.19 '@types/yargs': 15.0.19 chalk: 4.1.2 dev: false @@ -6103,7 +6103,7 @@ packages: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.6 '@types/istanbul-reports': 3.0.4 - '@types/node': 20.8.0 + '@types/node': 20.11.19 '@types/yargs': 17.0.23 chalk: 4.1.2 @@ -9720,6 +9720,10 @@ packages: resolution: {integrity: sha512-Uf7wMo5Fu3+g03gl2jvU2qHMaDp0p9RK9U2ucmy6VxWaavxALCC8iy47JL5GdgR5qG3ekEd5mAQV0dIIfoKELA==} dev: true + /@sourcegraph/cody-web@0.3.0: + resolution: {integrity: sha512-Dh29FumKyuSIA437iT/0JAiD+xGdcKLqy2/4+99aqJRGns8/crGamGpY6M4ZvmkCZCEgtElslPsAxZ+L5yJRtg==} + dev: false + /@sourcegraph/eslint-config@0.37.1(@testing-library/dom@8.13.0)(eslint@8.57.0)(typescript@5.4.2): resolution: {integrity: sha512-3G0d3OUgifaADfd27Bdk/kSpECj21BfQ6srbYMY/HVWOv/N8AVuFWNwUMT4Y4slt026RXO5XcwoZhfnaskr5hQ==} dependencies: @@ -10331,7 +10335,7 @@ packages: '@storybook/preview-api': 7.6.17 '@storybook/theming': 7.6.17(react-dom@18.1.0)(react@18.1.0) '@storybook/types': 7.6.17 - '@types/lodash': 4.14.167 + '@types/lodash': 4.17.0 color-convert: 2.0.1 dequal: 2.0.3 lodash: 4.17.21 @@ -12208,7 +12212,7 @@ packages: /@types/graceful-fs@4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: - '@types/node': 20.8.0 + '@types/node': 20.11.19 dev: true /@types/har-format@1.2.4: @@ -14983,7 +14987,7 @@ packages: engines: {node: '>=12.13.0'} hasBin: true dependencies: - '@types/node': 20.8.0 + '@types/node': 20.11.19 escape-string-regexp: 4.0.0 is-wsl: 2.2.0 lighthouse-logger: 1.4.2 @@ -15018,7 +15022,7 @@ packages: /chromium-edge-launcher@1.0.0: resolution: {integrity: sha512-pgtgjNKZ7i5U++1g1PWv75umkHvhVTDOQIZ+sjeUX9483S7Y6MUvO0lrd7ShGlQlFHMN4SwKTCq/X8hWrbv2KA==} dependencies: - '@types/node': 20.8.0 + '@types/node': 20.11.19 escape-string-regexp: 4.0.0 is-wsl: 2.2.0 lighthouse-logger: 1.4.2 @@ -15226,10 +15230,6 @@ packages: resolution: {integrity: sha512-92MNNTlZTndHN+kNUa4ojrZMIxgl78o+wswOhdzmIQm/FJFi977rnuQPSg/bV5jm8S3y3pdwUM7SUTqCKlwSHw==} dev: false - /cody-web-experimental@0.2.7: - resolution: {integrity: sha512-OI2nW/3CKqSajDyl3Sojlb4bX4fJcwIY2TQ3k0Sw1CSGyNxbqkxCA37dlhBLPMEq3ByC9trX68ppNJEi2ZFuWg==} - dev: false - /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -16748,7 +16748,7 @@ packages: base64id: 2.0.0 cookie: 0.4.2 cors: 2.8.5 - debug: 4.3.4 + debug: 4.3.5 engine.io-parser: 5.2.2 ws: 8.11.0 transitivePeerDependencies: @@ -20163,7 +20163,7 @@ packages: '@jest/environment': 29.7.0 '@jest/fake-timers': 29.7.0 '@jest/types': 29.6.3 - '@types/node': 20.8.0 + '@types/node': 20.11.19 jest-mock: 29.7.0 jest-util: 29.7.0 dev: false @@ -20184,7 +20184,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.5 - '@types/node': 20.8.0 + '@types/node': 20.11.19 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -20242,7 +20242,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.8.0 + '@types/node': 20.11.19 jest-util: 29.7.0 dev: false @@ -20256,7 +20256,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.8.0 + '@types/node': 20.11.19 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -20287,7 +20287,7 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 20.8.0 + '@types/node': 20.11.19 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -21149,7 +21149,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.5 flatted: 3.3.1 rfdc: 1.3.0 streamroller: 3.1.5 @@ -25674,7 +25674,7 @@ packages: /socket.io-adapter@2.5.4: resolution: {integrity: sha512-wDNHGXGewWAjQPt3pyeYBtpWSq9cLE5UW1ZUPL/2eGK9jtse/FpXib7epSTsz0Q0m+6sg6Y4KtcFTlah1bdOVg==} dependencies: - debug: 4.3.4 + debug: 4.3.5 ws: 8.11.0 transitivePeerDependencies: - bufferutil @@ -25686,7 +25686,7 @@ packages: engines: {node: '>=10.0.0'} dependencies: '@socket.io/component-emitter': 3.1.2 - debug: 4.3.4 + debug: 4.3.5 dev: true /socket.io@4.7.5: @@ -25696,7 +25696,7 @@ packages: accepts: 1.3.8 base64id: 2.0.0 cors: 2.8.5 - debug: 4.3.4 + debug: 4.3.5 engine.io: 6.5.4 socket.io-adapter: 2.5.4 socket.io-parser: 4.2.4 @@ -25988,7 +25988,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.4 + debug: 4.3.5 fs-extra: 8.1.0 dev: true