@sourcegraph/cody-web 0.32.11 → 0.32.12

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/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
5
- import { g as getDefaultExportFromCjs, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, d as RULES_PROVIDER_URI, e as displayPath, f as displayLineRange, h as displayPathDirname, i as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, o as object, l as literal, j as string$2, k as displayPathWithLines, m as URI, n as is$3, q as serializeContextItem, r as CONTEXT_ITEM_MENTION_NODE_TYPE, t as contextItemMentionNodeDisplayText, T as TEMPLATE_INPUT_NODE_TYPE, u as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, v as FILE_RANGE_TOOLTIP_LABEL, O as Observable, x as createExtensionAPI, y as createMessageAPIForWebview, z as debounce$1, C as ContextItemSource, A as memoizeLastValue, B as toSerializedPromptEditorValue$1, D as isEqual, E as scanForMentionTriggerInUserTextInput, G as getMentionOperations, H as combineLatest, J as map$3, K as forceHydration, M as hydrateAfterPostMessage, P as isDotCom, Q as isAuthError, V as isAvailabilityError, X as isSourcegraphToken, Y as trace, Z as context$1, _ as SpanStatusCode, $ as FeatureFlag, c as commonjsGlobal, a0 as svg, a1 as html$2, a2 as whitespace, a3 as find, a4 as stringify, a5 as stringify$1, a6 as ccount, a7 as isCodyProUser, a8 as CodyIDE, a9 as CodyTaskState, aa as cryptoJsExports, ab as GuardrailsCheckStatus, ac as LRUCache, ad as isError, ae as RateLimitError, af as upperFirst, ag as lodashExports, ah as createContextItem, ai as isDefined, aj as isCodeSearchContextItem, ak as reformatBotMessageForChat, al as isAbortErrorOrSocketHangUp, am as ModelTag, an as DeepCodyAgentID, ao as serializedPromptEditorStateFromChatMessage, ap as contextItemsFromPromptEditorValue, aq as filterContextItemsFromPromptEditorValue, ar as View, as as isCodyProModel, at as isMacOS, au as ToolCodyModelName, av as CustomCommandType, aw as textContentFromSerializedLexicalNode, ax as firstValueFrom, ay as skipPendingOperation, az as FAST_CHAT_INPUT_TOKEN_BUDGET, aA as webviewOpenURIForContextItem, aB as pluralize, aC as UIToolStatus, aD as getFileDiff, aE as diffWithLineNum, aF as UITerminalOutputType, aG as v4, aH as deserializeContextItem, aI as firstResultFromOperation, aJ as ChatHistoryType, aK as isWorkspaceInstance, aL as S2_URL, aM as ACCOUNT_USAGE_URL, aN as CODY_DOC_QUICKSTART_URL, aO as browser, aP as CodyAutoSuggestionMode, aQ as setDisplayPathEnvInfo, aR as isErrorLike, aS as PromptString, aT as createGuardrailsImpl, U as Uri } from "./vscode-shim-B21LtK8E.mjs";
6
- import { aV, aU } from "./vscode-shim-B21LtK8E.mjs";
5
+ import { g as getDefaultExportFromCjs, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, d as RULES_PROVIDER_URI, e as displayPath, f as displayLineRange, h as displayPathDirname, i as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, o as object, l as literal, j as string$2, k as displayPathWithLines, m as URI, n as is$3, q as serializeContextItem, r as CONTEXT_ITEM_MENTION_NODE_TYPE, t as contextItemMentionNodeDisplayText, T as TEMPLATE_INPUT_NODE_TYPE, u as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, v as FILE_RANGE_TOOLTIP_LABEL, O as Observable, x as createExtensionAPI, y as createMessageAPIForWebview, z as debounce$1, C as ContextItemSource, A as memoizeLastValue, B as toSerializedPromptEditorValue$1, D as isEqual, E as scanForMentionTriggerInUserTextInput, G as getMentionOperations, H as combineLatest, J as map$3, K as forceHydration, M as hydrateAfterPostMessage, P as isDotCom, Q as isAuthError, V as isAvailabilityError, X as isSourcegraphToken, Y as trace, Z as context$1, _ as SpanStatusCode, $ as FeatureFlag, c as commonjsGlobal, a0 as svg, a1 as html$2, a2 as whitespace, a3 as find, a4 as stringify, a5 as stringify$1, a6 as ccount, a7 as isCodyProUser, a8 as CodyIDE, a9 as CodyTaskState, aa as cryptoJsExports, ab as GuardrailsCheckStatus, ac as LRUCache, ad as isError, ae as RateLimitError, af as upperFirst, ag as lodashExports, ah as createContextItem, ai as isDefined, aj as isCodeSearchContextItem, ak as reformatBotMessageForChat, al as isAbortErrorOrSocketHangUp, am as ModelTag, an as DeepCodyAgentID, ao as serializedPromptEditorStateFromChatMessage, ap as contextItemsFromPromptEditorValue, aq as filterContextItemsFromPromptEditorValue, ar as View, as as isCodyProModel, at as isMacOS, au as ToolCodyModelName, av as CustomCommandType, aw as textContentFromSerializedLexicalNode, ax as firstValueFrom, ay as skipPendingOperation, az as FAST_CHAT_INPUT_TOKEN_BUDGET, aA as webviewOpenURIForContextItem, aB as pluralize, aC as UIToolStatus, aD as getFileDiff, aE as diffWithLineNum, aF as UITerminalOutputType, aG as v4, aH as deserializeContextItem, aI as firstResultFromOperation, aJ as ChatHistoryType, aK as isWorkspaceInstance, aL as S2_URL, aM as ACCOUNT_USAGE_URL, aN as CODY_DOC_QUICKSTART_URL, aO as browser, aP as CodyAutoSuggestionMode, aQ as setDisplayPathEnvInfo, aR as isErrorLike, aS as PromptString, aT as createGuardrailsImpl, U as Uri } from "./vscode-shim-FP11UcS5.mjs";
6
+ import { aV, aU } from "./vscode-shim-FP11UcS5.mjs";
7
7
  import * as React$2 from "react";
8
8
  import React__default, { createContext, useContext, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, useEffect as useEffect$2, forwardRef, useState as useState$1, useCallback, useRef as useRef$1, Suspense, createElement, memo as memo$2, useImperativeHandle, Children, isValidElement, cloneElement, Fragment as Fragment$2, useReducer, useId as useId$2, useInsertionEffect as useInsertionEffect$1, Component } from "react";
9
9
  var classnames = { exports: {} };
@@ -71470,7 +71470,14 @@ function useConfig() {
71470
71470
  return config;
71471
71471
  }
71472
71472
  function useUserAccountInfo() {
71473
- const { authStatus, isDotComUser, clientCapabilities, userProductSubscription } = useConfig();
71473
+ const {
71474
+ authStatus,
71475
+ isDotComUser,
71476
+ clientCapabilities,
71477
+ userProductSubscription,
71478
+ siteHasCodyEnabled,
71479
+ currentUserCodySubscription
71480
+ } = useConfig();
71474
71481
  if (!authStatus.authenticated) {
71475
71482
  throw new Error(
71476
71483
  "useUserAccountInfo must be used within a ConfigProvider with authenticated user"
@@ -71483,9 +71490,18 @@ function useUserAccountInfo() {
71483
71490
  // with E2E tests where change the DOTCOM_URL via the env variable CODY_OVERRIDE_DOTCOM_URL.
71484
71491
  isDotComUser,
71485
71492
  user: authStatus,
71486
- IDE: clientCapabilities.agentIDE
71493
+ IDE: clientCapabilities.agentIDE,
71494
+ siteHasCodyEnabled,
71495
+ currentUserCodySubscription
71487
71496
  }),
71488
- [authStatus, isDotComUser, clientCapabilities, userProductSubscription]
71497
+ [
71498
+ authStatus,
71499
+ isDotComUser,
71500
+ clientCapabilities,
71501
+ userProductSubscription,
71502
+ siteHasCodyEnabled,
71503
+ currentUserCodySubscription
71504
+ ]
71489
71505
  );
71490
71506
  }
71491
71507
  const ALLOWED_URI_REGEXP = /^((https?|file|vscode):\/\/[^\s#$./?].\S*$|(command:_?cody.*))/i;
@@ -88493,6 +88509,18 @@ const ScrollbarMarkers = (props) => {
88493
88509
  }
88494
88510
  );
88495
88511
  };
88512
+ function useDebouncedBoolean(value, delay2) {
88513
+ const [debouncedValue, setDebouncedValue] = useState$1(value);
88514
+ useEffect$2(() => {
88515
+ const handler = setTimeout(() => {
88516
+ setDebouncedValue(value);
88517
+ }, delay2);
88518
+ return () => {
88519
+ clearTimeout(handler);
88520
+ };
88521
+ }, [value, delay2]);
88522
+ return debouncedValue;
88523
+ }
88496
88524
  const Transcript = (props) => {
88497
88525
  const {
88498
88526
  activeChatContext,
@@ -88519,6 +88547,7 @@ const Transcript = (props) => {
88519
88547
  const expectedAutoScrollTopRef = useRef$1(0);
88520
88548
  const [scrollableContainer, setScrollableContainer] = useState$1(null);
88521
88549
  const [isAtBottom, setIsAtBottom] = useState$1(false);
88550
+ const isAtBottomDebounced = useDebouncedBoolean(isAtBottom, 150);
88522
88551
  useEffect$2(() => {
88523
88552
  const handleCopyEvent = (event) => {
88524
88553
  var _a;
@@ -88652,7 +88681,7 @@ const Transcript = (props) => {
88652
88681
  }
88653
88682
  ),
88654
88683
  scrollableContainer && /* @__PURE__ */ jsx(ScrollbarMarkers, { scrollContainer: scrollableContainer }),
88655
- !isAtBottom && /* @__PURE__ */ jsx(ScrollDown, { onClick: scrollTotheBottom }),
88684
+ !isAtBottomDebounced && /* @__PURE__ */ jsx(ScrollDown, { onClick: scrollTotheBottom }),
88656
88685
  /* @__PURE__ */ jsx("div", { className: "tw-bg-[var(--vscode-input-background)]", children: inputInteractionAtTheBottom && renderTranscriptInteraction(
88657
88686
  inputInteractionAtTheBottom,
88658
88687
  interactions.length - 1
@@ -89481,6 +89510,13 @@ const StorageWarningBanner = ({ extensionAPI, vscodeAPI }) => {
89481
89510
  );
89482
89511
  };
89483
89512
  const storageKey = "DismissedWelcomeNotices";
89513
+ const CODY_DEPRECATION_MESSAGES = {
89514
+ ENTERPRISE_STARTER_WITH_CODY: "Cody in Enterprise Starter is being sunset. You can continue using Cody until July 23rd. Your code indexing and code search capabilities will not be affected. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
89515
+ ENTERPRISE_STARTER_WITHOUT_CODY: "Cody in Enterprise Starter is being sunset. Because you signed up after 6/25, your account doesn't have Cody, we encourage you to try Amp, Sourcegraph's new agentic coding tool.",
89516
+ PRO_USER: "Cody Pro is being sunset. You can continue using Cody until July 23rd, and your subscription will not renew. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
89517
+ FREE_USER_WITH_CODY: "Cody Free is being sunset. You can continue using Cody until July 23rd. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
89518
+ FREE_USER_WITHOUT_CODY: "Cody Free is being sunset. Because you signed up after 6/25, your account doesn't have Cody. We encourage you to try Amp, Sourcegraph's new agentic coding tool."
89519
+ };
89484
89520
  const Notices = ({ user, instanceNotices }) => {
89485
89521
  const telemetryRecorder = useTelemetryRecorder();
89486
89522
  const [dismissedNotices, setDismissedNotices] = useLocalStorage(storageKey, "");
@@ -89498,6 +89534,23 @@ const Notices = ({ user, instanceNotices }) => {
89498
89534
  },
89499
89535
  [telemetryRecorder, setDismissedNotices]
89500
89536
  );
89537
+ const getCodyDeprecationMessage = useCallback(() => {
89538
+ if (isWorkspaceInstance(user.user.endpoint)) {
89539
+ const hasCodyEnabled = user.siteHasCodyEnabled === true;
89540
+ if (hasCodyEnabled) {
89541
+ return CODY_DEPRECATION_MESSAGES.ENTERPRISE_STARTER_WITH_CODY;
89542
+ }
89543
+ return CODY_DEPRECATION_MESSAGES.ENTERPRISE_STARTER_WITHOUT_CODY;
89544
+ }
89545
+ if (user.isCodyProUser) {
89546
+ return CODY_DEPRECATION_MESSAGES.PRO_USER;
89547
+ }
89548
+ const hasSubscription = user.currentUserCodySubscription && user.currentUserCodySubscription !== null;
89549
+ if (hasSubscription) {
89550
+ return CODY_DEPRECATION_MESSAGES.FREE_USER_WITH_CODY;
89551
+ }
89552
+ return CODY_DEPRECATION_MESSAGES.FREE_USER_WITHOUT_CODY;
89553
+ }, [user]);
89501
89554
  const notices = useMemo$1(
89502
89555
  () => {
89503
89556
  var _a;
@@ -89526,7 +89579,7 @@ const Notices = ({ user, instanceNotices }) => {
89526
89579
  id: "CodyDeprecation",
89527
89580
  variant: "default",
89528
89581
  title: "Important Notice",
89529
- message: isWorkspaceInstance(user.user.endpoint) ? "Cody in Enterprise Starter is being sunset. You can continue using Cody until July 23rd. Your code indexing and code search capabilities will not be affected. We encourage you to try Amp, Sourcegraph's new agentic coding tool." : user.isCodyProUser ? "Cody Pro is being sunset. You can continue using Cody until July 23rd, and your subscription will not renew. We encourage you to try Amp, Sourcegraph's new agentic coding tool." : "Cody Free will be sunset on July 23rd. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
89582
+ message: getCodyDeprecationMessage(),
89530
89583
  onDismiss: () => dismissNotice("CodyDeprecation", "sessional"),
89531
89584
  actions: [
89532
89585
  {
@@ -89580,7 +89633,7 @@ const Notices = ({ user, instanceNotices }) => {
89580
89633
  }
89581
89634
  ];
89582
89635
  },
89583
- [user, dismissNotice, instanceNotices]
89636
+ [user, dismissNotice, instanceNotices, getCodyDeprecationMessage]
89584
89637
  );
89585
89638
  const activeNotice = useMemo$1(
89586
89639
  () => notices.find((notice) => {
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { b as base64Js } from "./agent.worker-Qda9Vtb_.mjs";
4
+ import { b as base64Js } from "./agent.worker-DP5t54b3.mjs";
5
5
  var __defProp2 = Object.defineProperty;
6
6
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __publicField2 = (obj, key, value) => {