@sourcegraph/cody-web 0.40.0 → 0.41.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/dist/index.js CHANGED
@@ -3,8 +3,8 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  var _a;
5
5
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
6
- import { dn as getDefaultExportFromCjs, aY as FILE_CONTEXT_MENTION_PROVIDER, aZ as SYMBOL_CONTEXT_MENTION_PROVIDER, b0 as REMOTE_REPOSITORY_PROVIDER_URI, b1 as REMOTE_FILE_PROVIDER_URI, b2 as REMOTE_DIRECTORY_PROVIDER_URI, b3 as WEB_PROVIDER_URI, b8 as RULES_PROVIDER_URI, T as displayPath, m as displayLineRange, Y as displayPathDirname, W as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, dp as object, dq as literal, dr as string$2, V as displayPathWithLines, c as URI, ds as is$3, c5 as serializeContextItem, c3 as CONTEXT_ITEM_MENTION_NODE_TYPE, cb as contextItemMentionNodeDisplayText, c4 as TEMPLATE_INPUT_NODE_TYPE, aU as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, F as FILE_RANGE_TOOLTIP_LABEL, dt as Observable, cd as createExtensionAPI, bb as createMessageAPIForWebview, du as debounce$1, C as ContextItemSource, cu as memoizeLastValue, bW as toSerializedPromptEditorValue$1, dv as isEqual, aV as scanForMentionTriggerInUserTextInput, c9 as getMentionOperations, ct as combineLatest, dw as map$3, a0 as forceHydration, a1 as hydrateAfterPostMessage, ag as isDotCom, be as isWorkspaceInstance, au as isAuthError, av as isAvailabilityError, dx as isSourcegraphToken, dy as trace, dz as context$1, dA as SpanStatusCode, dm as commonjsGlobal, dB as svg, dC as html$2, dD as whitespace, dE as find, dF as stringify, dG as stringify$1, dH as ccount, bT as CodyIDE, dI as CodyTaskState, dJ as cryptoJsExports, a6 as GuardrailsCheckStatus, dK as LRUCache, a as isError, aq as RateLimitError, a2 as FeatureFlag, r as reformatBotMessageForChat, at as isAbortErrorOrSocketHangUp, M as ModelTag, dL as DeepCodyAgentID, bY as serializedPromptEditorStateFromChatMessage, bZ as contextItemsFromPromptEditorValue, b$ as filterContextItemsFromPromptEditorValue, dM as View, E as isMacOS, dN as ToolCodyModelName, g as CustomCommandType, c0 as textContentFromSerializedLexicalNode, ci as firstValueFrom, d0 as skipPendingOperation, bO as FAST_CHAT_INPUT_TOKEN_BUDGET, f as webviewOpenURIForContextItem, l as pluralize, dk as UIToolStatus, dO as getFileDiff, dP as diffWithLineNum, dl as UITerminalOutputType, dQ as isCodeSearchContextItem, dR as v4, dS as lodashExports, c6 as deserializeContextItem, d1 as firstResultFromOperation, dT as ChatHistoryType, dU as ACCOUNT_USAGE_URL, dV as CODY_DOC_QUICKSTART_URL, b as isDefined, dW as browser, bU as CodyAutoSuggestionMode, _ as setDisplayPathEnvInfo, k as isErrorLike, bE as PromptString, a4 as createGuardrailsImpl, U as Uri } from "./vscode-shim-BM22pmQn.mjs";
7
- import { bh, bg } from "./vscode-shim-BM22pmQn.mjs";
6
+ import { dn as getDefaultExportFromCjs, aY as FILE_CONTEXT_MENTION_PROVIDER, aZ as SYMBOL_CONTEXT_MENTION_PROVIDER, b0 as REMOTE_REPOSITORY_PROVIDER_URI, b1 as REMOTE_FILE_PROVIDER_URI, b2 as REMOTE_DIRECTORY_PROVIDER_URI, b3 as WEB_PROVIDER_URI, b8 as RULES_PROVIDER_URI, T as displayPath, m as displayLineRange, Y as displayPathDirname, W as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, dp as object, dq as literal, dr as string$2, V as displayPathWithLines, c as URI, ds as is$3, c5 as serializeContextItem, c3 as CONTEXT_ITEM_MENTION_NODE_TYPE, cb as contextItemMentionNodeDisplayText, c4 as TEMPLATE_INPUT_NODE_TYPE, aU as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, F as FILE_RANGE_TOOLTIP_LABEL, dt as Observable, cd as createExtensionAPI, bb as createMessageAPIForWebview, du as debounce$1, C as ContextItemSource, cu as memoizeLastValue, bW as toSerializedPromptEditorValue$1, dv as isEqual, aV as scanForMentionTriggerInUserTextInput, c9 as getMentionOperations, ct as combineLatest, dw as map$3, a0 as forceHydration, a1 as hydrateAfterPostMessage, ag as isDotCom, be as isWorkspaceInstance, au as isAuthError, av as isAvailabilityError, dx as isSourcegraphToken, dy as trace, dz as context$1, dA as SpanStatusCode, dm as commonjsGlobal, dB as svg, dC as html$2, dD as whitespace, dE as find, dF as stringify, dG as stringify$1, dH as ccount, bT as CodyIDE, dI as CodyTaskState, dJ as cryptoJsExports, a6 as GuardrailsCheckStatus, dK as LRUCache, a as isError, aq as RateLimitError, a2 as FeatureFlag, r as reformatBotMessageForChat, at as isAbortErrorOrSocketHangUp, M as ModelTag, dL as DeepCodyAgentID, bY as serializedPromptEditorStateFromChatMessage, bZ as contextItemsFromPromptEditorValue, b$ as filterContextItemsFromPromptEditorValue, dM as View, E as isMacOS, dN as ToolCodyModelName, g as CustomCommandType, c0 as textContentFromSerializedLexicalNode, ci as firstValueFrom, d0 as skipPendingOperation, bO as FAST_CHAT_INPUT_TOKEN_BUDGET, f as webviewOpenURIForContextItem, l as pluralize, dk as UIToolStatus, dO as getFileDiff, dP as diffWithLineNum, dl as UITerminalOutputType, dQ as isCodeSearchContextItem, dR as v4, dS as lodashExports, c6 as deserializeContextItem, d1 as firstResultFromOperation, dT as ChatHistoryType, dU as ACCOUNT_USAGE_URL, dV as CODY_DOC_QUICKSTART_URL, b as isDefined, dW as browser, bU as CodyAutoSuggestionMode, _ as setDisplayPathEnvInfo, k as isErrorLike, bE as PromptString, a4 as createGuardrailsImpl, U as Uri } from "./vscode-shim-BytjAIYm.mjs";
7
+ import { bh, bg } from "./vscode-shim-BytjAIYm.mjs";
8
8
  import * as React$2 from "react";
9
9
  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";
10
10
  var classnames = { exports: {} };
@@ -82864,7 +82864,7 @@ function useClientConfig() {
82864
82864
  return useContext(ClientConfigContext);
82865
82865
  }
82866
82866
  const ALLOWED_MIME_TYPES = ["image/png", "image/jpeg", "image/webp", "image/heic", "image/heif"];
82867
- const MediaUploadButton = ({ onMediaUpload, submitState, className }) => {
82867
+ const MediaUploadButton = ({ onMediaUpload, submitState, className, disabled: disabled2, disabledReason }) => {
82868
82868
  const [uploadedImages, setUploadedImages] = useState$1([]);
82869
82869
  const [errorMessage, setErrorMessage] = useState$1(null);
82870
82870
  const submitBtnState = useRef$1(submitState);
@@ -82996,7 +82996,7 @@ const MediaUploadButton = ({ onMediaUpload, submitState, className }) => {
82996
82996
  (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
82997
82997
  }, []);
82998
82998
  return /* @__PURE__ */ jsx("div", { className: "tw-inline-flex", children: /* @__PURE__ */ jsx("div", { ref: dropZoneRef, className: "tw-inline-flex", children: /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 0, children: [
82999
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
82999
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "tw-inline-flex tw-cursor-default", children: /* @__PURE__ */ jsx(
83000
83000
  Button,
83001
83001
  {
83002
83002
  variant: "ghost",
@@ -83004,17 +83004,18 @@ const MediaUploadButton = ({ onMediaUpload, submitState, className }) => {
83004
83004
  "aria-label": "Upload images",
83005
83005
  ref: buttonRef,
83006
83006
  className,
83007
+ disabled: disabled2,
83007
83008
  children: /* @__PURE__ */ jsx(
83008
83009
  Image,
83009
83010
  {
83010
83011
  onClick: handleButtonClick,
83011
- className: "tw-w-8 tw-h-8",
83012
+ className: `tw-w-8 tw-h-8 ${disabled2 ? "tw-opacity-30" : ""}`,
83012
83013
  strokeWidth: 1.25
83013
83014
  }
83014
83015
  )
83015
83016
  }
83016
- ) }),
83017
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: errorMessage ? /* @__PURE__ */ jsx("div", { className: "tw-text-red-500", children: errorMessage }) : /* @__PURE__ */ jsxs("div", { className: "tw-text-center", children: [
83017
+ ) }) }),
83018
+ /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: disabled2 && disabledReason ? /* @__PURE__ */ jsx("div", { children: disabledReason }) : errorMessage ? /* @__PURE__ */ jsx("div", { className: "tw-text-red-500", children: errorMessage }) : /* @__PURE__ */ jsxs("div", { className: "tw-text-center", children: [
83018
83019
  /* @__PURE__ */ jsx("div", { children: "Upload images (PNG, JPEG, WEBP, HEIC, HEIF)" }),
83019
83020
  /* @__PURE__ */ jsx("div", { className: "tw-text-sm tw-opacity-75 tw-mt-1", children: "Copy and paste, or click to select" }),
83020
83021
  /* @__PURE__ */ jsx("div", { className: "tw-text-sm tw-font-medium tw-text-primary tw-mt-2", children: "Multiple images supported!" })
@@ -83234,6 +83235,8 @@ const Toolbar = ({
83234
83235
  },
83235
83236
  [onGapClick]
83236
83237
  );
83238
+ const clientConfig = useClientConfig();
83239
+ const isVisionDisabledByServer = (clientConfig == null ? void 0 : clientConfig.chatVisionEnabled) === false;
83237
83240
  const isImageUploadEnabled = useMemo$1(() => {
83238
83241
  var _a2;
83239
83242
  const selectedModel = models == null ? void 0 : models[0];
@@ -83280,6 +83283,8 @@ const Toolbar = ({
83280
83283
  onMediaUpload,
83281
83284
  isEditorFocused,
83282
83285
  submitState,
83286
+ disabled: isVisionDisabledByServer,
83287
+ disabledReason: "Vision is not enabled. Please contact your site admin.",
83283
83288
  className: `tw-opacity-60 focus-visible:tw-opacity-100 hover:tw-opacity-100 tw-mr-2 tw-gap-0.5 ${toolbarStyles.button} ${toolbarStyles.buttonSmallIcon}`
83284
83289
  }
83285
83290
  ),
@@ -90255,26 +90260,6 @@ const CodyWebPanel = (props) => {
90255
90260
  } else {
90256
90261
  const fileUrl = `/${repository.name}/-/blob/${fileURL}`;
90257
90262
  const basename2 = fileURL.split("/").pop() || fileURL;
90258
- const fileContextItem = {
90259
- type: "openctx",
90260
- provider: "openctx",
90261
- title: basename2,
90262
- description: fileURL,
90263
- uri: URI.parse(fileUrl),
90264
- providerUri: REMOTE_FILE_PROVIDER_URI,
90265
- source: ContextItemSource.Initial,
90266
- mention: {
90267
- uri: fileUrl,
90268
- data: {
90269
- repoName: repository.name,
90270
- rev: "HEAD",
90271
- filePath: fileURL
90272
- },
90273
- description: fileURL
90274
- },
90275
- icon: "file"
90276
- };
90277
- initialContext.push(fileContextItem);
90278
90263
  if (initialContextData == null ? void 0 : initialContextData.fileRange) {
90279
90264
  const rangeUrl = `${fileUrl}?L${initialContextData.fileRange.startLine + 1}:1-${initialContextData.fileRange.endLine + 1}:1`;
90280
90265
  initialContext.push({
@@ -90302,6 +90287,26 @@ const CodyWebPanel = (props) => {
90302
90287
  },
90303
90288
  icon: "list-selection"
90304
90289
  });
90290
+ } else {
90291
+ initialContext.push({
90292
+ type: "openctx",
90293
+ provider: "openctx",
90294
+ title: basename2,
90295
+ description: fileURL,
90296
+ uri: URI.parse(fileUrl),
90297
+ providerUri: REMOTE_FILE_PROVIDER_URI,
90298
+ source: ContextItemSource.Initial,
90299
+ mention: {
90300
+ uri: fileUrl,
90301
+ data: {
90302
+ repoName: repository.name,
90303
+ rev: "HEAD",
90304
+ filePath: fileURL
90305
+ },
90306
+ description: fileURL
90307
+ },
90308
+ icon: "file"
90309
+ });
90305
90310
  }
90306
90311
  }
90307
90312
  }
@@ -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-Di-hO351.mjs";
4
+ import { b as base64Js } from "./agent.worker-DHasPDnb.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) => {
package/dist/style.css CHANGED
@@ -4021,6 +4021,9 @@ imported in Sourcegraph shell.
4021
4021
  .\!tw-opacity-100 {
4022
4022
  opacity: 1 !important;
4023
4023
  }
4024
+ .tw-opacity-30 {
4025
+ opacity: 0.3;
4026
+ }
4024
4027
  .tw-opacity-50 {
4025
4028
  opacity: 0.5;
4026
4029
  }