@sourcegraph/cody-web 0.7.6 → 0.7.7

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,7 +2,7 @@ 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 } from "react/jsx-runtime";
5
- import { g as getDefaultExportFromCjs, L as Ls, k as ke$1, a as ks, F as Fi$1, _ as _s, b as ds, c as bs, i as ii$1, q as qe$1, y as ys, x as xi$1, K as K$2, J as J$2, R as R$3, e as ws, B as B$2, f as g$5, h as h$4, j as _i, S as Ss, l as Br, m as ln, n as bi$1, v as vn, o as xn, N as Nn, r as mn, s as li$1, u as n$1, z as ns, M as M$4, D as Ds, A as le$2, E as c$4, G as oe$1, H as z$1, I as yi$1, W as W$2, U as Ue$1, O as I$2, P as Se$2, Q as O$2, V as F$1, X as Ni$1, Y as ee$1, Z as we$2, $ as b$2, a0 as T$3, a1 as s$2, a2 as o$4, a3 as w$3, a4 as i$1, a5 as k$3, a6 as D$5, a7 as p$8, a8 as m$7, a9 as S$4, aa as v$4, ab as P$2, ac as E$6, ad as Wi$1, ae as L$3, af as d$2, ag as a$3, ah as l$2, ai as f$2, aj as u$6, ak as r$6, al as t$2, am as displayPathBasename, an as FILE_CONTEXT_MENTION_PROVIDER, ao as SYMBOL_CONTEXT_MENTION_PROVIDER, ap as REMOTE_REPOSITORY_PROVIDER_URI, aq as REMOTE_FILE_PROVIDER_URI, ar as REMOTE_DIRECTORY_PROVIDER_URI, as as CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI, at as WEB_PROVIDER_URI, au as displayPath, av as displayLineRange, aw as displayPathDirname, ax as IGNORED_FILE_WARNING_LABEL, ay as LARGE_FILE_WARNING_LABEL, az as Ei$1, aA as xe$2, aB as V$2, aC as Es, aD as U$2, aE as e, aF as Ns, aG as an, aH as gs, aI as serializeContextItem, aJ as CONTEXT_ITEM_MENTION_NODE_TYPE, aK as contextItemMentionNodeDisplayText, C as ContextItemSource, aL as URI, aM as qr, aN as _$2, aO as TEMPLATE_INPUT_NODE_TYPE, aP as N$2, aQ as parseMentionQuery, aR as NO_SYMBOL_MATCHES_HELP_LABEL, aS as FILE_RANGE_TOOLTIP_LABEL, aT as createExtensionAPI, aU as createMessageAPIForWebview, aV as lodashExports, aW as memoizeLastValue, aX as toSerializedPromptEditorValue, aY as ri$1, aZ as scanForMentionTriggerInUserTextInput, a_ as fs, a$ as Ts, b0 as ps, b1 as hydrateAfterPostMessage, b2 as isCodyProUser, b3 as CodyIDE, b4 as webviewOpenURIForContextItem, b5 as commonjsGlobal, b6 as CodyTaskState, b7 as cryptoJsExports, b8 as isError, b9 as RateLimitError, ba as CODY_FEEDBACK_URL, bb as isDefined, bc as reformatBotMessageForChat, p as ps$1, bd as isAbortErrorOrSocketHangUp, be as isEqual, bf as serializedPromptEditorStateFromChatMessage, bg as contextItemsFromPromptEditorValue, bh as filterContextItemsFromPromptEditorValue, bi as pluralize, bj as isCodyProModel, bk as ModelTag, bl as isMacOS, bm as textContentFromSerializedLexicalNode, bn as FAST_CHAT_INPUT_TOKEN_BUDGET, bo as deserializeContextItem, bp as View, bq as ACCOUNT_USAGE_URL, br as getRelativeChatPeriod, bs as truncateTextStart, bt as CHAT_INPUT_TOKEN_BUDGET, bu as browser, bv as isErrorLike, bw as setDisplayPathEnvInfo, bx as PromptString } from "./browser-5V4RMNo3.mjs";
5
+ import { g as getDefaultExportFromCjs, L as Ls, k as ke$1, a as ks, F as Fi$1, _ as _s, b as ds, c as bs, i as ii$1, q as qe$1, y as ys, x as xi$1, K as K$2, J as J$2, R as R$3, e as ws, B as B$2, f as g$5, h as h$4, j as _i, S as Ss, l as Br, m as ln, n as bi$1, v as vn, o as xn, N as Nn, r as mn, s as li$1, u as n$1, z as ns, M as M$4, D as Ds, A as le$2, E as c$4, G as oe$1, H as z$1, I as yi$1, W as W$2, U as Ue$1, O as I$2, P as Se$2, Q as O$2, V as F$1, X as Ni$1, Y as ee$1, Z as we$2, $ as b$2, a0 as T$3, a1 as s$2, a2 as o$4, a3 as w$3, a4 as i$1, a5 as k$3, a6 as D$5, a7 as p$8, a8 as m$7, a9 as S$4, aa as v$4, ab as P$2, ac as E$6, ad as Wi$1, ae as L$3, af as d$2, ag as a$3, ah as l$2, ai as f$2, aj as u$6, ak as r$6, al as t$2, am as displayPathBasename, an as FILE_CONTEXT_MENTION_PROVIDER, ao as SYMBOL_CONTEXT_MENTION_PROVIDER, ap as REMOTE_REPOSITORY_PROVIDER_URI, aq as REMOTE_FILE_PROVIDER_URI, ar as REMOTE_DIRECTORY_PROVIDER_URI, as as WEB_PROVIDER_URI, at as displayPath, au as displayLineRange, av as displayPathDirname, aw as IGNORED_FILE_WARNING_LABEL, ax as LARGE_FILE_WARNING_LABEL, ay as Ei$1, az as xe$2, aA as V$2, aB as Es, aC as U$2, aD as e, aE as Ns, aF as an, aG as gs, aH as serializeContextItem, aI as CONTEXT_ITEM_MENTION_NODE_TYPE, aJ as contextItemMentionNodeDisplayText, C as ContextItemSource, aK as URI, aL as qr, aM as _$2, aN as TEMPLATE_INPUT_NODE_TYPE, aO as N$2, aP as parseMentionQuery, aQ as NO_SYMBOL_MATCHES_HELP_LABEL, aR as FILE_RANGE_TOOLTIP_LABEL, aS as createExtensionAPI, aT as createMessageAPIForWebview, aU as lodashExports, aV as memoizeLastValue, aW as toSerializedPromptEditorValue, aX as ri$1, aY as scanForMentionTriggerInUserTextInput, aZ as fs, a_ as Ts, a$ as ps, b0 as hydrateAfterPostMessage, b1 as isCodyProUser, b2 as CodyIDE, b3 as webviewOpenURIForContextItem, b4 as commonjsGlobal, b5 as CodyTaskState, b6 as cryptoJsExports, b7 as isError, b8 as RateLimitError, b9 as CODY_FEEDBACK_URL, ba as isDefined, bb as reformatBotMessageForChat, p as ps$1, bc as isAbortErrorOrSocketHangUp, bd as isEqual, be as serializedPromptEditorStateFromChatMessage, bf as contextItemsFromPromptEditorValue, bg as filterContextItemsFromPromptEditorValue, bh as pluralize, bi as isCodyProModel, bj as ModelTag, bk as CustomCommandType, bl as isMacOS, bm as textContentFromSerializedLexicalNode, bn as FAST_CHAT_INPUT_TOKEN_BUDGET, bo as deserializeContextItem, bp as View, bq as truncateTextStart, br as CHAT_INPUT_TOKEN_BUDGET, bs as ACCOUNT_USAGE_URL, bt as getRelativeChatPeriod, bu as browser, bv as isErrorLike, bw as setDisplayPathEnvInfo, bx as PromptString } from "./browser-hDxNMh5y.mjs";
6
6
  import * as React from "react";
7
7
  import React__default, { createContext, useContext, useMemo, useLayoutEffect, useEffect, forwardRef, useState, useCallback, useRef, Suspense, createElement, memo, useImperativeHandle, Children, isValidElement, cloneElement, Fragment as Fragment$1, useReducer } from "react";
8
8
  var classnames = { exports: {} };
@@ -7844,31 +7844,6 @@ const Brain = createLucideIcon("Brain", [
7844
7844
  ["path", { d: "M6 18a4 4 0 0 1-1.967-.516", key: "2e4loj" }],
7845
7845
  ["path", { d: "M19.967 17.484A4 4 0 0 1 18 18", key: "159ez6" }]
7846
7846
  ]);
7847
- /**
7848
- * @license lucide-react v0.378.0 - ISC
7849
- *
7850
- * This source code is licensed under the ISC license.
7851
- * See the LICENSE file in the root directory of this source tree.
7852
- */
7853
- const Bug = createLucideIcon("Bug", [
7854
- ["path", { d: "m8 2 1.88 1.88", key: "fmnt4t" }],
7855
- ["path", { d: "M14.12 3.88 16 2", key: "qol33r" }],
7856
- ["path", { d: "M9 7.13v-1a3.003 3.003 0 1 1 6 0v1", key: "d7y7pr" }],
7857
- [
7858
- "path",
7859
- {
7860
- d: "M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",
7861
- key: "xs1cw7"
7862
- }
7863
- ],
7864
- ["path", { d: "M12 20v-9", key: "1qisl0" }],
7865
- ["path", { d: "M6.53 9C4.6 8.8 3 7.1 3 5", key: "32zzws" }],
7866
- ["path", { d: "M6 13H2", key: "82j7cp" }],
7867
- ["path", { d: "M3 21c0-2.1 1.7-3.9 3.8-4", key: "4p0ekp" }],
7868
- ["path", { d: "M20.97 5c0 2.1-1.6 3.8-3.5 4", key: "18gb23" }],
7869
- ["path", { d: "M22 13h-4", key: "1jl80f" }],
7870
- ["path", { d: "M17.2 17c2.1.1 3.8 1.9 3.8 4", key: "k3fwyw" }]
7871
- ]);
7872
7847
  /**
7873
7848
  * @license lucide-react v0.378.0 - ISC
7874
7849
  *
@@ -7933,17 +7908,6 @@ const ChevronsUpDown = createLucideIcon("ChevronsUpDown", [
7933
7908
  ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
7934
7909
  ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
7935
7910
  ]);
7936
- /**
7937
- * @license lucide-react v0.378.0 - ISC
7938
- *
7939
- * This source code is licensed under the ISC license.
7940
- * See the LICENSE file in the root directory of this source tree.
7941
- */
7942
- const CirclePlus = createLucideIcon("CirclePlus", [
7943
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
7944
- ["path", { d: "M8 12h8", key: "1wcyev" }],
7945
- ["path", { d: "M12 8v8", key: "napkw2" }]
7946
- ]);
7947
7911
  /**
7948
7912
  * @license lucide-react v0.378.0 - ISC
7949
7913
  *
@@ -7965,20 +7929,6 @@ const Columns2 = createLucideIcon("Columns2", [
7965
7929
  ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
7966
7930
  ["path", { d: "M12 3v18", key: "108xh3" }]
7967
7931
  ]);
7968
- /**
7969
- * @license lucide-react v0.378.0 - ISC
7970
- *
7971
- * This source code is licensed under the ISC license.
7972
- * See the LICENSE file in the root directory of this source tree.
7973
- */
7974
- const Combine = createLucideIcon("Combine", [
7975
- ["rect", { width: "8", height: "8", x: "2", y: "2", rx: "2", key: "z1hh3n" }],
7976
- ["path", { d: "M14 2c1.1 0 2 .9 2 2v4c0 1.1-.9 2-2 2", key: "83orz6" }],
7977
- ["path", { d: "M20 2c1.1 0 2 .9 2 2v4c0 1.1-.9 2-2 2", key: "k86dmt" }],
7978
- ["path", { d: "M10 18H5c-1.7 0-3-1.3-3-3v-1", key: "6vokjl" }],
7979
- ["polyline", { points: "7 21 10 18 7 15", key: "1k02g0" }],
7980
- ["rect", { width: "8", height: "8", x: "14", y: "14", rx: "2", key: "1fa9i4" }]
7981
- ]);
7982
7932
  /**
7983
7933
  * @license lucide-react v0.378.0 - ISC
7984
7934
  *
@@ -8034,17 +7984,6 @@ const ExternalLink = createLucideIcon("ExternalLink", [
8034
7984
  ["path", { d: "M10 14 21 3", key: "gplh6r" }],
8035
7985
  ["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
8036
7986
  ]);
8037
- /**
8038
- * @license lucide-react v0.378.0 - ISC
8039
- *
8040
- * This source code is licensed under the ISC license.
8041
- * See the LICENSE file in the root directory of this source tree.
8042
- */
8043
- const FileQuestion = createLucideIcon("FileQuestion", [
8044
- ["path", { d: "M12 17h.01", key: "p32p05" }],
8045
- ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z", key: "1mlx9k" }],
8046
- ["path", { d: "M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3", key: "mhlwft" }]
8047
- ]);
8048
7987
  /**
8049
7988
  * @license lucide-react v0.378.0 - ISC
8050
7989
  *
@@ -8073,23 +8012,6 @@ const FolderGit = createLucideIcon("FolderGit", [
8073
8012
  ["path", { d: "M14 13h3", key: "1dgedf" }],
8074
8013
  ["path", { d: "M7 13h3", key: "1pygq7" }]
8075
8014
  ]);
8076
- /**
8077
- * @license lucide-react v0.378.0 - ISC
8078
- *
8079
- * This source code is licensed under the ISC license.
8080
- * See the LICENSE file in the root directory of this source tree.
8081
- */
8082
- const Hammer = createLucideIcon("Hammer", [
8083
- ["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
8084
- ["path", { d: "m18 15 4-4", key: "16gjal" }],
8085
- [
8086
- "path",
8087
- {
8088
- d: "m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",
8089
- key: "b7pghm"
8090
- }
8091
- ]
8092
- ]);
8093
8015
  /**
8094
8016
  * @license lucide-react v0.378.0 - ISC
8095
8017
  *
@@ -8128,17 +8050,6 @@ const Link$1 = createLucideIcon("Link", [
8128
8050
  ["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
8129
8051
  ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
8130
8052
  ]);
8131
- /**
8132
- * @license lucide-react v0.378.0 - ISC
8133
- *
8134
- * This source code is licensed under the ISC license.
8135
- * See the LICENSE file in the root directory of this source tree.
8136
- */
8137
- const MessageCircleCode = createLucideIcon("MessageCircleCode", [
8138
- ["path", { d: "M10 9.5 8 12l2 2.5", key: "3mjy60" }],
8139
- ["path", { d: "m14 9.5 2 2.5-2 2.5", key: "1bir2l" }],
8140
- ["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22z", key: "k85zhp" }]
8141
- ]);
8142
8053
  /**
8143
8054
  * @license lucide-react v0.378.0 - ISC
8144
8055
  *
@@ -8187,18 +8098,9 @@ const Option$2 = createLucideIcon("Option", [
8187
8098
  * This source code is licensed under the ISC license.
8188
8099
  * See the LICENSE file in the root directory of this source tree.
8189
8100
  */
8190
- const Pencil = createLucideIcon("Pencil", [
8191
- ["path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z", key: "5qss01" }],
8192
- ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
8193
- ]);
8194
- /**
8195
- * @license lucide-react v0.378.0 - ISC
8196
- *
8197
- * This source code is licensed under the ISC license.
8198
- * See the LICENSE file in the root directory of this source tree.
8199
- */
8200
- const Play = createLucideIcon("Play", [
8201
- ["polygon", { points: "6 3 20 12 6 21 6 3", key: "1oa8hb" }]
8101
+ const Plus = createLucideIcon("Plus", [
8102
+ ["path", { d: "M5 12h14", key: "1ays0h" }],
8103
+ ["path", { d: "M12 5v14", key: "s699le" }]
8202
8104
  ]);
8203
8105
  /**
8204
8106
  * @license lucide-react v0.378.0 - ISC
@@ -8216,22 +8118,6 @@ const Settings = createLucideIcon("Settings", [
8216
8118
  ],
8217
8119
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
8218
8120
  ]);
8219
- /**
8220
- * @license lucide-react v0.378.0 - ISC
8221
- *
8222
- * This source code is licensed under the ISC license.
8223
- * See the LICENSE file in the root directory of this source tree.
8224
- */
8225
- const ShieldCheck = createLucideIcon("ShieldCheck", [
8226
- [
8227
- "path",
8228
- {
8229
- d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
8230
- key: "oel41y"
8231
- }
8232
- ],
8233
- ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
8234
- ]);
8235
8121
  /**
8236
8122
  * @license lucide-react v0.378.0 - ISC
8237
8123
  *
@@ -8388,7 +8274,6 @@ const iconForProvider = {
8388
8274
  [REMOTE_REPOSITORY_PROVIDER_URI]: FolderGit,
8389
8275
  [REMOTE_FILE_PROVIDER_URI]: File,
8390
8276
  [REMOTE_DIRECTORY_PROVIDER_URI]: FolderGit,
8391
- [CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI]: FolderGit,
8392
8277
  [WEB_PROVIDER_URI]: Link$1
8393
8278
  };
8394
8279
  const contextItemMentionNode = "_context-item-mention-node_1eamp_1";
@@ -9075,8 +8960,8 @@ function L({ options: e2, onQueryChange: n2, onSelectOption: o2, onOpen: r2, onC
9075
8960
  };
9076
8961
  }, [v2, g2, n2, x2, I2, T2]), null === x2 || null === v2 ? null : jsx(R, { close: I2, resolution: x2, editor: v2, anchorElementRef: O2, options: e2, menuRenderFn: i2, shouldSplitNodeWithQuery: true, onSelectOption: o2, commandPriority: y2 });
9077
8962
  }
9078
- const popoverDimensions = "_popover-dimensions_18ann_1";
9079
- const popover = "_popover_18ann_1";
8963
+ const popoverDimensions = "_popover-dimensions_1uf3m_1";
8964
+ const popover = "_popover_1uf3m_1";
9080
8965
  const styles$i = {
9081
8966
  popoverDimensions,
9082
8967
  popover
@@ -9091,13 +8976,15 @@ function contextItemID(item2) {
9091
8976
  item2.range ? `${item2.range.start.line}:${item2.range.start.character}-${item2.range.end.line}:${item2.range.end.character}` : ""
9092
8977
  ]);
9093
8978
  }
9094
- const container$2 = "_container_101x5_1";
9095
- const item = "_item_101x5_8";
9096
- const contextItem$1 = "_context-item_101x5_9";
8979
+ const container$2 = "_container_fr158_1";
8980
+ const item = "_item_fr158_8";
8981
+ const contextItem$1 = "_context-item_fr158_9";
8982
+ const experimental = "_experimental_fr158_17";
9097
8983
  const styles$h = {
9098
8984
  container: container$2,
9099
8985
  item,
9100
- contextItem: contextItem$1
8986
+ contextItem: contextItem$1,
8987
+ experimental
9101
8988
  };
9102
8989
  const MentionMenu = ({
9103
8990
  params,
@@ -9321,6 +9208,21 @@ function getItemsHeading(parentItem, mentionQuery) {
9321
9208
  if (parentItem.id === SYMBOL_CONTEXT_MENTION_PROVIDER.id || parentItem.id === FILE_CONTEXT_MENTION_PROVIDER.id) {
9322
9209
  return "";
9323
9210
  }
9211
+ if (parentItem.id === REMOTE_DIRECTORY_PROVIDER_URI) {
9212
+ return /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-gap-2 tw-items-center tw-justify-between", children: [
9213
+ /* @__PURE__ */ jsx("div", { children: mentionQuery.text.includes(":") ? "Directory - Select a directory" : "Directory - Select a repository" }),
9214
+ /* @__PURE__ */ jsx(
9215
+ "div",
9216
+ {
9217
+ className: clsx$1(
9218
+ "tw-text-xs tw-rounded tw-px-2 tw-text-foreground",
9219
+ styles$h.experimental
9220
+ ),
9221
+ children: "Experimental"
9222
+ }
9223
+ )
9224
+ ] });
9225
+ }
9324
9226
  return parentItem.title ?? parentItem.id;
9325
9227
  }
9326
9228
  const COMMAND_ROW_CLASS_NAME = "!tw-p-3 !tw-text-md !tw-leading-[1.2] !tw-h-[30px] !tw-rounded-none";
@@ -9411,8 +9313,7 @@ function useMentionMenuParams() {
9411
9313
  const isRemoteLikeProviderActive = mentionSettings.resolutionMode === "remote" || [
9412
9314
  REMOTE_FILE_PROVIDER_URI,
9413
9315
  REMOTE_DIRECTORY_PROVIDER_URI,
9414
- REMOTE_REPOSITORY_PROVIDER_URI,
9415
- CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI
9316
+ REMOTE_REPOSITORY_PROVIDER_URI
9416
9317
  ].includes(((_a = params.parentItem) == null ? void 0 : _a.id) || "");
9417
9318
  const debounceTime = isRemoteLikeProviderActive ? 300 : 10;
9418
9319
  const debouncedUpdateQuery = useMemo(
@@ -17346,25 +17247,18 @@ const Command = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__
17346
17247
  }
17347
17248
  ));
17348
17249
  Command.displayName = He.displayName;
17349
- const CommandInput = React.forwardRef(({ wrapperClassName, className, ...props }, ref2) => /* @__PURE__ */ jsx(
17350
- "div",
17250
+ const CommandInput = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsx("div", { className: "tw-flex tw-items-center tw-border-b tw-border-b-border", "cmdk-input-wrapper": "", children: /* @__PURE__ */ jsx(
17251
+ He.Input,
17351
17252
  {
17352
- className: cn("tw-flex tw-items-center tw-border-b tw-border-b-border", wrapperClassName),
17353
- "cmdk-input-wrapper": "",
17354
- children: /* @__PURE__ */ jsx(
17355
- He.Input,
17356
- {
17357
- ref: ref2,
17358
- className: cn(
17359
- "tw-flex tw-w-full tw-border-solid tw-border tw-border-transparent tw-bg-transparent tw-pt-4 tw-pb-3 tw-px-3 tw-text-md tw-leading-none placeholder:tw-text-muted-foreground disabled:tw-cursor-not-allowed disabled:tw-opacity-50 focus:tw-outline-none",
17360
- className
17361
- ),
17362
- inputMode: "search",
17363
- ...props
17364
- }
17365
- )
17253
+ ref: ref2,
17254
+ className: cn(
17255
+ "tw-flex tw-w-full tw-border-solid tw-border tw-border-transparent tw-bg-transparent tw-pt-4 tw-pb-3 tw-px-3 tw-text-md tw-leading-none placeholder:tw-text-muted-foreground disabled:tw-cursor-not-allowed disabled:tw-opacity-50 focus:tw-outline-none",
17256
+ className
17257
+ ),
17258
+ inputMode: "search",
17259
+ ...props
17366
17260
  }
17367
- ));
17261
+ ) }));
17368
17262
  CommandInput.displayName = He.Input.displayName;
17369
17263
  const CommandList = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsx(
17370
17264
  He.List,
@@ -17419,7 +17313,7 @@ const CommandItem = React.forwardRef(({ className, tooltip, ...props }, ref2) =>
17419
17313
  {
17420
17314
  ref: ref2,
17421
17315
  className: cn(
17422
- "tw-relative tw-flex tw-cursor-pointer tw-select-none tw-items-center tw-rounded-sm tw-py-3 tw-px-2 tw-text-md tw-outline-none aria-selected:tw-bg-accent aria-selected:tw-text-accent-foreground hover:tw-bg-accent hover:tw-text-accent-foreground hover:tw-border-accent data-[disabled=true]:tw-pointer-events-none data-[disabled=true]:tw-opacity-50",
17316
+ "tw-relative tw-flex tw-cursor-pointer tw-select-none tw-items-center tw-rounded-sm tw-py-3 tw-px-2 tw-text-md tw-outline-none aria-selected:tw-bg-accent aria-selected:tw-text-accent-foreground hover:tw-bg-accent hover:tw-text-accent-foreground data-[disabled=true]:tw-pointer-events-none data-[disabled=true]:tw-opacity-50",
17423
17317
  className
17424
17318
  ),
17425
17319
  title: tooltip,
@@ -17429,16 +17323,6 @@ const CommandItem = React.forwardRef(({ className, tooltip, ...props }, ref2) =>
17429
17323
  return item2;
17430
17324
  });
17431
17325
  CommandItem.displayName = He.Item.displayName;
17432
- const CommandRow = ({ className, ...props }) => /* @__PURE__ */ jsx(
17433
- "div",
17434
- {
17435
- className: cn(
17436
- "tw-flex tw-flex-wrap tw-select-none tw-items-center tw-gap-x-3 tw-gap-y-1 tw-text-md tw-outline-none [&:not(:last-child)]:tw-border-border [&:not(:last-child)]:tw-border-b [&_[cmdk-item]]:tw-whitespace-nowrap",
17437
- className
17438
- ),
17439
- ...props
17440
- }
17441
- );
17442
17326
  const CommandLink = ({ href, className, children: children2, onSelect, ...props }) => {
17443
17327
  const linkRef = React.useRef(null);
17444
17328
  const isHandlingClick = React.useRef(false);
@@ -30200,7 +30084,7 @@ included via Enhanced Context (Remote Search)`,
30200
30084
  const iconTitle = source2 && hoverSourceLabels[source2] ? `Included ${hoverSourceLabels[source2]}` : void 0;
30201
30085
  return /* @__PURE__ */ jsxs("div", { className: clsx$1("tw-inline-flex tw-items-center tw-max-w-full", className), children: [
30202
30086
  (isIgnored || isTooLarge) && /* @__PURE__ */ jsx("i", { className: "codicon codicon-warning", title: linkDetails.tooltip }),
30203
- source2 === "unified" ? /* @__PURE__ */ jsxs(
30087
+ source2 === "unified" || uri.scheme === "http" || uri.scheme === "https" ? /* @__PURE__ */ jsxs(
30204
30088
  "a",
30205
30089
  {
30206
30090
  className: linkClassName,
@@ -72348,8 +72232,8 @@ const ContextCell = memo(
72348
72232
  },
72349
72233
  isEqual
72350
72234
  );
72351
- const userAvatar = "_user-avatar_yacrp_1";
72352
- const sourcegraphGradientBorder = "_sourcegraph-gradient-border_yacrp_10";
72235
+ const userAvatar = "_user-avatar_tzwlo_1";
72236
+ const sourcegraphGradientBorder = "_sourcegraph-gradient-border_tzwlo_12";
72353
72237
  const styles$7 = {
72354
72238
  userAvatar,
72355
72239
  sourcegraphGradientBorder
@@ -72405,9 +72289,8 @@ const InnerUserAvatar = ({
72405
72289
  "div",
72406
72290
  {
72407
72291
  title: title2,
72408
- className: clsx$1(styles$7.userAvatar, "tw-bg-muted tw-text-muted-foreground", className),
72292
+ className: clsx$1(styles$7.userAvatar, className),
72409
72293
  style: { width: `${size2}px`, height: `${size2}px` },
72410
- "data-user-avatar": true,
72411
72294
  children: /* @__PURE__ */ jsx("span", { className: styles$7.initials, children: getInitials((user == null ? void 0 : user.displayName) || (user == null ? void 0 : user.username) || "") })
72412
72295
  }
72413
72296
  );
@@ -73094,6 +72977,375 @@ const optionByGroup = (options) => {
73094
72977
  }
73095
72978
  return [...groups.entries()].sort(([a2], [b2]) => groupOrder.indexOf(a2) - groupOrder.indexOf(b2)).map(([group, options2]) => ({ group, options: options2 }));
73096
72979
  };
72980
+ const useDebounce = (value, delay) => {
72981
+ const [debouncedValue, setDebouncedValue] = useState(value);
72982
+ useEffect(() => {
72983
+ const handler = setTimeout(() => setDebouncedValue(value), delay);
72984
+ return () => clearTimeout(handler);
72985
+ }, [delay, value]);
72986
+ return debouncedValue;
72987
+ };
72988
+ function usePromptsQuery(query) {
72989
+ const prompts = useExtensionAPI().prompts;
72990
+ return useObservable(useMemo(() => prompts(query), [prompts, query]));
72991
+ }
72992
+ const PromptList = ({
72993
+ onSelect: parentOnSelect,
72994
+ onSelectActionLabels,
72995
+ showSearch = true,
72996
+ showOnlyPromptInsertableCommands,
72997
+ showInitialSelectedItem = true,
72998
+ showPromptLibraryUnsupportedMessage = true,
72999
+ showCommandOrigins = false,
73000
+ className,
73001
+ commandListClassName,
73002
+ telemetryLocation
73003
+ }) => {
73004
+ const telemetryRecorder = useTelemetryRecorder();
73005
+ const telemetryPublicMetadata = {
73006
+ [`in${telemetryLocation}`]: 1
73007
+ };
73008
+ const [query, setQuery] = useState("");
73009
+ const debouncedQuery = useDebounce(query, 250);
73010
+ const { value: result, error: error2 } = usePromptsQuery(debouncedQuery);
73011
+ const onSelect = useCallback(
73012
+ (rowValue) => {
73013
+ var _a, _b, _c;
73014
+ const prompt = (result == null ? void 0 : result.prompts.type) === "results" ? result.prompts.results.find(
73015
+ (p2) => commandRowValue({ type: "prompt", value: p2 }) === rowValue
73016
+ ) : void 0;
73017
+ const codyCommand = prompt === void 0 ? (_a = result == null ? void 0 : result.commands) == null ? void 0 : _a.find(
73018
+ (c2) => commandRowValue({ type: "command", value: c2 }) === rowValue
73019
+ ) : void 0;
73020
+ const entry = prompt ? { type: "prompt", value: prompt } : codyCommand ? { type: "command", value: codyCommand } : void 0;
73021
+ if (!entry) {
73022
+ return;
73023
+ }
73024
+ telemetryRecorder.recordEvent("cody.promptList", "select", {
73025
+ metadata: {
73026
+ isPrompt: prompt ? 1 : 0,
73027
+ isCommand: codyCommand ? 1 : 0,
73028
+ isCommandBuiltin: (codyCommand == null ? void 0 : codyCommand.type) === "default" ? 1 : 0,
73029
+ isCommandCustom: (codyCommand == null ? void 0 : codyCommand.type) !== "default" ? 1 : 0,
73030
+ ...telemetryPublicMetadata
73031
+ },
73032
+ privateMetadata: {
73033
+ nameWithOwner: prompt ? prompt.nameWithOwner : void 0
73034
+ }
73035
+ });
73036
+ if (result) {
73037
+ telemetryRecorder.recordEvent("cody.promptList", "query", {
73038
+ metadata: {
73039
+ queryLength: debouncedQuery.length,
73040
+ resultCount: (result.prompts.type === "results" ? result.prompts.results.length : 0) + (((_b = result.commands) == null ? void 0 : _b.length) ?? 0),
73041
+ resultCountPromptsOnly: result.prompts.type === "results" ? result.prompts.results.length : 0,
73042
+ resultCountCommandsOnly: ((_c = result.commands) == null ? void 0 : _c.length) ?? 0,
73043
+ supportsPrompts: result.prompts.type !== "unsupported" ? 1 : 0,
73044
+ hasUsePromptsQueryError: error2 ? 1 : 0,
73045
+ hasPromptsResultError: result.prompts.type === "error" ? 1 : 0,
73046
+ ...telemetryPublicMetadata
73047
+ },
73048
+ privateMetadata: {
73049
+ query: debouncedQuery,
73050
+ usePromptsQueryErrorMessage: error2 == null ? void 0 : error2.message,
73051
+ promptsResultErrorMessage: result.prompts.type === "error" ? result.prompts.error : void 0
73052
+ }
73053
+ });
73054
+ }
73055
+ parentOnSelect(entry);
73056
+ },
73057
+ [
73058
+ result,
73059
+ telemetryRecorder.recordEvent,
73060
+ parentOnSelect,
73061
+ telemetryPublicMetadata,
73062
+ debouncedQuery,
73063
+ error2
73064
+ ]
73065
+ );
73066
+ const endpointURL = new URL(useConfig().authStatus.endpoint);
73067
+ const filteredCommands = showOnlyPromptInsertableCommands ? result == null ? void 0 : result.commands.filter((c2) => c2.type !== "default") : result == null ? void 0 : result.commands;
73068
+ return /* @__PURE__ */ jsx(
73069
+ Command,
73070
+ {
73071
+ loop: true,
73072
+ tabIndex: 0,
73073
+ className: clsx$1("focus:tw-outline-none", className),
73074
+ shouldFilter: false,
73075
+ defaultValue: showInitialSelectedItem ? void 0 : "xxx-no-item",
73076
+ children: /* @__PURE__ */ jsxs(
73077
+ CommandList,
73078
+ {
73079
+ className: clsx$1(
73080
+ "[&_[cmdk-group]]:tw-pt-0 [&_[cmdk-group-heading]]:tw-flex [&_[cmdk-group-heading]]:tw-gap-2 [&_[cmdk-group-heading]]:tw-items-center [&_[cmdk-group-heading]]:!tw-min-h-[30px] [&_[cmdk-group-heading]]:tw--mx-2 [&_[cmdk-group-heading]]:tw-px-4 [&_[cmdk-group-heading]]:tw-mb-2 [&_[cmdk-group-heading]]:tw-bg-muted [&_[cmdk-group]]:!tw-border-0",
73081
+ commandListClassName
73082
+ ),
73083
+ children: [
73084
+ showSearch && /* @__PURE__ */ jsx(
73085
+ CommandInput,
73086
+ {
73087
+ value: query,
73088
+ onValueChange: setQuery,
73089
+ placeholder: "Search...",
73090
+ autoFocus: true
73091
+ }
73092
+ ),
73093
+ result && result.prompts.type !== "unsupported" && /* @__PURE__ */ jsxs(
73094
+ CommandGroup,
73095
+ {
73096
+ heading: /* @__PURE__ */ jsxs(Fragment, { children: [
73097
+ /* @__PURE__ */ jsx("span", { children: "Prompt Library" }),
73098
+ /* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
73099
+ /* @__PURE__ */ jsx(Button3, { variant: "ghost", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(
73100
+ "a",
73101
+ {
73102
+ href: new URL("/prompts", endpointURL).toString(),
73103
+ target: "_blank",
73104
+ rel: "noreferrer",
73105
+ className: "!tw-text-[unset]",
73106
+ children: "Manage"
73107
+ }
73108
+ ) }),
73109
+ /* @__PURE__ */ jsx(
73110
+ Button3,
73111
+ {
73112
+ variant: "ghost",
73113
+ size: "sm",
73114
+ className: "tw-flex tw-items-center tw-gap-0.5",
73115
+ asChild: true,
73116
+ children: /* @__PURE__ */ jsxs(
73117
+ "a",
73118
+ {
73119
+ href: new URL("/prompts/new", endpointURL).toString(),
73120
+ target: "_blank",
73121
+ rel: "noreferrer",
73122
+ className: "!tw-text-[unset]",
73123
+ children: [
73124
+ /* @__PURE__ */ jsx(Plus, { size: 12, strokeWidth: 1.25 }),
73125
+ "New"
73126
+ ]
73127
+ }
73128
+ )
73129
+ }
73130
+ )
73131
+ ] }),
73132
+ children: [
73133
+ result.prompts.type === "results" ? /* @__PURE__ */ jsxs(Fragment, { children: [
73134
+ result.prompts.results.length === 0 && /* @__PURE__ */ jsx(CommandLoading, { children: result.query === "" ? /* @__PURE__ */ jsxs(Fragment, { children: [
73135
+ "Your Prompt Library is empty.",
73136
+ " ",
73137
+ /* @__PURE__ */ jsx(
73138
+ "a",
73139
+ {
73140
+ href: new URL(
73141
+ "/prompts/new",
73142
+ endpointURL
73143
+ ).toString(),
73144
+ target: "_blank",
73145
+ rel: "noreferrer",
73146
+ children: "Add a prompt"
73147
+ }
73148
+ ),
73149
+ " ",
73150
+ "to reuse and share it."
73151
+ ] }) : /* @__PURE__ */ jsx(Fragment, { children: "No prompts found" }) }),
73152
+ result.prompts.results.map((prompt) => /* @__PURE__ */ jsx(
73153
+ PromptCommandItem,
73154
+ {
73155
+ prompt,
73156
+ onSelect,
73157
+ selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.prompt
73158
+ },
73159
+ prompt.id
73160
+ ))
73161
+ ] }) : null,
73162
+ result.prompts.type === "error" && /* @__PURE__ */ jsxs(CommandLoading, { children: [
73163
+ "Error: ",
73164
+ result.prompts.error
73165
+ ] })
73166
+ ]
73167
+ }
73168
+ ),
73169
+ result && filteredCommands && filteredCommands.length > 0 && /* @__PURE__ */ jsx(
73170
+ CommandGroup,
73171
+ {
73172
+ heading: /* @__PURE__ */ jsxs(Fragment, { children: [
73173
+ /* @__PURE__ */ jsx("span", { children: "Commands" }),
73174
+ /* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
73175
+ hasCustomCommands(filteredCommands) && /* @__PURE__ */ jsx(Button3, { variant: "ghost", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(
73176
+ "a",
73177
+ {
73178
+ className: "!tw-text-[unset]",
73179
+ href: "command:cody.menu.commands-settings",
73180
+ children: "Manage"
73181
+ }
73182
+ ) })
73183
+ ] }),
73184
+ children: filteredCommands.map((command) => /* @__PURE__ */ jsx(
73185
+ CodyCommandItem,
73186
+ {
73187
+ command,
73188
+ onSelect,
73189
+ selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.command,
73190
+ showCommandOrigins
73191
+ },
73192
+ command.key
73193
+ ))
73194
+ }
73195
+ ),
73196
+ showPromptLibraryUnsupportedMessage && result && result.prompts.type === "unsupported" && /* @__PURE__ */ jsxs(Fragment, { children: [
73197
+ /* @__PURE__ */ jsx(CommandSeparator, { alwaysRender: true }),
73198
+ /* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
73199
+ "Prompt Library is not yet available on ",
73200
+ endpointURL.hostname,
73201
+ ". Ask your site admin to upgrade to Sourcegraph 5.6 or later."
73202
+ ] })
73203
+ ] }),
73204
+ !result && !error2 && /* @__PURE__ */ jsx(CommandLoading, { className: "tw-px-4", children: "Loading..." }),
73205
+ error2 && /* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
73206
+ "Error: ",
73207
+ error2.message || "unknown"
73208
+ ] })
73209
+ ]
73210
+ }
73211
+ )
73212
+ }
73213
+ );
73214
+ };
73215
+ function hasCustomCommands(commands) {
73216
+ return commands.some(
73217
+ (command) => command.type === CustomCommandType.Workspace || command.type === CustomCommandType.User
73218
+ );
73219
+ }
73220
+ function commandRowValue(row2) {
73221
+ return row2.type === "prompt" ? `prompt-${row2.value.id}` : `command-${row2.value.key}`;
73222
+ }
73223
+ const PromptCommandItem = ({ prompt, onSelect, selectActionLabel }) => /* @__PURE__ */ jsxs(
73224
+ CommandItem,
73225
+ {
73226
+ value: commandRowValue({ type: "prompt", value: prompt }),
73227
+ onSelect,
73228
+ className: "!tw-items-start tw-group/[cmdk-item]",
73229
+ children: [
73230
+ /* @__PURE__ */ jsxs("div", { children: [
73231
+ /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-gap-3 tw-w-full tw-items-start", children: [
73232
+ /* @__PURE__ */ jsxs("span", { children: [
73233
+ /* @__PURE__ */ jsxs("span", { className: "tw-text-muted-foreground", children: [
73234
+ prompt.owner.namespaceName,
73235
+ " / "
73236
+ ] }),
73237
+ /* @__PURE__ */ jsx("strong", { children: prompt.name })
73238
+ ] }),
73239
+ prompt.draft && /* @__PURE__ */ jsx(Badge3, { variant: "secondary", className: "tw-text-xxs tw-mt-0.5", children: "Draft" })
73240
+ ] }),
73241
+ prompt.description && /* @__PURE__ */ jsx("span", { className: "tw-text-xs tw-text-muted-foreground tw-text-nowrap tw-overflow-hidden tw-text-ellipsis tw-w-full", children: prompt.description })
73242
+ ] }),
73243
+ /* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
73244
+ selectActionLabel && /* @__PURE__ */ jsx(CommandItemAction, { label: selectActionLabel })
73245
+ ]
73246
+ }
73247
+ );
73248
+ const CodyCommandItem = ({ command, onSelect, selectActionLabel, showCommandOrigins }) => /* @__PURE__ */ jsxs(
73249
+ CommandItem,
73250
+ {
73251
+ value: commandRowValue({ type: "command", value: command }),
73252
+ onSelect,
73253
+ className: "!tw-items-start tw-group/[cmdk-item]",
73254
+ children: [
73255
+ /* @__PURE__ */ jsxs("div", { children: [
73256
+ /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-wrap tw-gap-3 tw-w-full tw-items-start", children: [
73257
+ /* @__PURE__ */ jsx("strong", { className: "tw-whitespace-nowrap", children: command.type === "default" ? command.description : command.key }),
73258
+ showCommandOrigins && command.type !== "default" && /* @__PURE__ */ jsx(Badge3, { variant: "secondary", className: "tw-text-xxs tw-mt-0.5 tw-whitespace-nowrap", children: command.type === CustomCommandType.User ? "Local User Settings" : "Workspace Settings" })
73259
+ ] }),
73260
+ command.type !== "default" && command.description && /* @__PURE__ */ jsx("span", { className: "tw-text-xs tw-text-muted-foreground tw-text-nowrap tw-overflow-hidden tw-text-ellipsis tw-w-full", children: command.description })
73261
+ ] }),
73262
+ /* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
73263
+ selectActionLabel && /* @__PURE__ */ jsx(CommandItemAction, { label: selectActionLabel })
73264
+ ]
73265
+ }
73266
+ );
73267
+ const CommandItemAction = ({
73268
+ label,
73269
+ className
73270
+ }) => /* @__PURE__ */ jsxs(Tooltip, { children: [
73271
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
73272
+ Button3,
73273
+ {
73274
+ type: "button",
73275
+ variant: "default",
73276
+ size: "xs",
73277
+ className: clsx$1(
73278
+ 'tw-tracking-tight tw-text-accent-foreground tw-opacity-30 tw-bg-transparent hover:tw-bg-transparent tw-invisible group-[[aria-selected="true"]]/[cmdk-item]:tw-visible group-hover/[cmdk-item]:tw-visible',
73279
+ className
73280
+ ),
73281
+ children: label === "insert" ? "Insert" : "Run"
73282
+ }
73283
+ ) }),
73284
+ /* @__PURE__ */ jsx(TooltipContent, { children: label === "insert" ? "Append prompt text to chat message" : "Run command on current selection in editor" })
73285
+ ] });
73286
+ const PromptListSuitedForNonPopover = ({ className, commandListClassName, ...props }) => /* @__PURE__ */ jsx(
73287
+ PromptList,
73288
+ {
73289
+ ...props,
73290
+ showSearch: false,
73291
+ showInitialSelectedItem: false,
73292
+ className: clsx$1("tw-w-full !tw-max-w-[unset] !tw-bg-[unset]", className),
73293
+ commandListClassName: clsx$1("!tw-max-h-[unset]", commandListClassName)
73294
+ }
73295
+ );
73296
+ const PromptSelectField = ({ onSelect, onCloseByEscape, className, __storybook__open }) => {
73297
+ const telemetryRecorder = useTelemetryRecorder();
73298
+ const onOpenChange = useCallback(
73299
+ (open) => {
73300
+ if (open) {
73301
+ telemetryRecorder.recordEvent("cody.promptSelectField", "open", {});
73302
+ }
73303
+ },
73304
+ [telemetryRecorder.recordEvent]
73305
+ );
73306
+ const onKeyDown = useCallback(
73307
+ (event) => {
73308
+ if (event.key === "Escape") {
73309
+ onCloseByEscape == null ? void 0 : onCloseByEscape();
73310
+ }
73311
+ },
73312
+ [onCloseByEscape]
73313
+ );
73314
+ return /* @__PURE__ */ jsx(
73315
+ ToolbarPopoverItem,
73316
+ {
73317
+ role: "combobox",
73318
+ iconEnd: "chevron",
73319
+ className: cn("tw-justify-between", className),
73320
+ __storybook__open,
73321
+ tooltip: "Insert prompt from Prompt Library",
73322
+ "aria-label": "Insert prompt",
73323
+ popoverContent: (close) => /* @__PURE__ */ jsx(
73324
+ PromptList,
73325
+ {
73326
+ onSelect: (item2) => {
73327
+ onSelect(item2);
73328
+ close();
73329
+ },
73330
+ onSelectActionLabels: { prompt: "insert", command: "insert" },
73331
+ showSearch: true,
73332
+ showOnlyPromptInsertableCommands: true,
73333
+ showPromptLibraryUnsupportedMessage: true,
73334
+ telemetryLocation: "PromptSelectField"
73335
+ }
73336
+ ),
73337
+ popoverRootProps: { onOpenChange },
73338
+ popoverContentProps: {
73339
+ className: "tw-min-w-[325px] tw-w-[75vw] tw-max-w-[550px] !tw-p-0",
73340
+ onKeyDown,
73341
+ onCloseAutoFocus: (event) => {
73342
+ event.preventDefault();
73343
+ }
73344
+ },
73345
+ children: "Prompts"
73346
+ }
73347
+ );
73348
+ };
73097
73349
  const isMac = isMacOS();
73098
73350
  function keyTextOrSvg(key) {
73099
73351
  const iconClassName = "tw-w-[1em] tw-h-[1em]";
@@ -73227,6 +73479,7 @@ const Toolbar = ({
73227
73479
  submitState,
73228
73480
  onGapClick,
73229
73481
  focusEditor,
73482
+ appendTextToEditor,
73230
73483
  hidden: hidden2,
73231
73484
  className
73232
73485
  }) => {
@@ -73264,6 +73517,14 @@ const Toolbar = ({
73264
73517
  className: "tw-opacity-60 focus-visible:tw-opacity-100 hover:tw-opacity-100 tw-mr-2"
73265
73518
  }
73266
73519
  ),
73520
+ /* @__PURE__ */ jsx(
73521
+ PromptSelectFieldToolbarItem,
73522
+ {
73523
+ focusEditor,
73524
+ appendTextToEditor,
73525
+ className: "tw-ml-1 tw-mr-1"
73526
+ }
73527
+ ),
73267
73528
  /* @__PURE__ */ jsx(
73268
73529
  ModelSelectFieldToolbarItem,
73269
73530
  {
@@ -73286,6 +73547,16 @@ const Toolbar = ({
73286
73547
  )
73287
73548
  );
73288
73549
  };
73550
+ const PromptSelectFieldToolbarItem = ({ focusEditor, appendTextToEditor, className }) => {
73551
+ const onSelect = useCallback(
73552
+ (item2) => {
73553
+ appendTextToEditor(item2.type === "prompt" ? item2.value.definition.text : item2.value.prompt);
73554
+ focusEditor == null ? void 0 : focusEditor();
73555
+ },
73556
+ [appendTextToEditor, focusEditor]
73557
+ );
73558
+ return /* @__PURE__ */ jsx(PromptSelectField, { onSelect, onCloseByEscape: focusEditor, className });
73559
+ };
73289
73560
  const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className }) => {
73290
73561
  const config = useConfig();
73291
73562
  const api2 = useExtensionAPI();
@@ -73420,6 +73691,12 @@ const HumanMessageEditor = ({
73420
73691
  },
73421
73692
  [onGapClick]
73422
73693
  );
73694
+ const appendTextToEditor = useCallback((text2) => {
73695
+ if (!editorRef.current) {
73696
+ throw new Error("No editorRef");
73697
+ }
73698
+ editorRef.current.appendText(text2);
73699
+ }, []);
73423
73700
  const onMentionClick = useCallback(() => {
73424
73701
  if (!editorRef.current) {
73425
73702
  throw new Error("No editorRef");
@@ -73536,6 +73813,7 @@ const HumanMessageEditor = ({
73536
73813
  submitState,
73537
73814
  onGapClick,
73538
73815
  focusEditor,
73816
+ appendTextToEditor,
73539
73817
  hidden: !focused2 && isSent,
73540
73818
  className: styles$6.toolbar
73541
73819
  }
@@ -73910,399 +74188,18 @@ function useCollapsiblePanelOpenState(storageKey, initialOpen = false) {
73910
74188
  }
73911
74189
  ];
73912
74190
  }
73913
- const MenuExample = ({ children: children2 }) => /* @__PURE__ */ jsx("span", { className: "tw-p-1 tw-rounded tw-border tw-border-keybinding-border tw-bg-keybinding-background tw-whitespace-nowrap", children: children2 });
73914
- const FeatureRowInlineIcon = ({ Icon: Icon2 }) => /* @__PURE__ */ jsx(Icon2, { size: 16, strokeWidth: 1.25, className: "tw-flex-none tw-inline-flex tw-mt-1 tw-opacity-80" });
73915
- const FeatureRow = ({ icon: icon2, children: children2 }) => /* @__PURE__ */ jsxs("div", { className: "tw-py-2 tw-px-4 tw-inline-flex tw-gap-3 tw-text-foreground tw-items-start", children: [
73916
- /* @__PURE__ */ jsx(FeatureRowInlineIcon, { Icon: icon2 }),
73917
- /* @__PURE__ */ jsx("div", { className: "tw-grow", children: children2 })
73918
- ] });
73919
- const localStorageKey = "chat.welcome-message-dismissed";
73920
- const WelcomeMessage = ({
73921
- IDE
73922
- }) => {
73923
- localStorage.removeItem(localStorageKey);
73924
- return /* @__PURE__ */ jsx("div", { className: "tw-flex-1 tw-w-full tw-px-6 tw-transition-all", children: /* @__PURE__ */ jsxs(
73925
- CollapsiblePanel,
73926
- {
73927
- storageKey: "chat-help",
73928
- title: "Chat Help",
73929
- className: "tw-mb-12 tw-mt-8",
73930
- initialOpen: true,
73931
- children: [
73932
- IDE === CodyIDE.VSCode && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(FeatureRow, { icon: MessageSquarePlus, children: [
73933
- "Start a new chat using ",
73934
- /* @__PURE__ */ jsx(Kbd, { macOS: "opt+L", linuxAndWindows: "alt+L" }),
73935
- " or the command ",
73936
- /* @__PURE__ */ jsx(MenuExample, { children: "Cody: New Chat" })
73937
- ] }) }),
73938
- /* @__PURE__ */ jsxs(FeatureRow, { icon: AtSign, children: [
73939
- "Type ",
73940
- /* @__PURE__ */ jsx(Kbd, { macOS: "@", linuxAndWindows: "@" }),
73941
- " to add context to your chat"
73942
- ] }),
73943
- IDE === CodyIDE.VSCode && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(FeatureRow, { icon: Text, children: [
73944
- "To add code context from an editor, right click and use",
73945
- " ",
73946
- /* @__PURE__ */ jsx(MenuExample, { children: "Cody > Add File/Selection to Cody Chat" })
73947
- ] }) }),
73948
- /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-justify-center tw-items-center tw-w-full tw-gap-10 tw-px-4 tw-pt-4 tw-pb-3 tw-mt-2 tw-border-t tw-border-button-border tw-transition-all", children: [
73949
- /* @__PURE__ */ jsx(
73950
- "a",
73951
- {
73952
- href: "https://docs.sourcegraph.com/cody",
73953
- target: "_blank",
73954
- rel: "noopener noreferrer",
73955
- className: "tw-text-muted-foreground hover:tw-text-foreground",
73956
- children: "Documentation"
73957
- }
73958
- ),
73959
- /* @__PURE__ */ jsx(
73960
- "a",
73961
- {
73962
- href: "https://help.sourcegraph.com",
73963
- target: "_blank",
73964
- rel: "noopener noreferrer",
73965
- className: "tw-text-muted-foreground hover:tw-text-foreground",
73966
- children: "Help & Support"
73967
- }
73968
- )
73969
- ] })
73970
- ]
73971
- }
73972
- ) });
73973
- };
73974
- const MARGIN = 200;
73975
- function createScrollerAPI(element2) {
73976
- return {
73977
- root: element2,
73978
- getObserveElement: () => element2.firstElementChild,
73979
- getScrollTop: () => element2.scrollTop,
73980
- getScrollHeight: () => element2.scrollHeight,
73981
- getClientHeight: () => element2.getBoundingClientRect().height
73982
- };
73983
- }
73984
- const ScrollDown = (props) => {
73985
- const { scrollableParent, onClick: parentOnClick } = props;
73986
- const [canScrollDown, setCanScrollDown] = useState(false);
73987
- const scrollerAPI = useMemo(() => createScrollerAPI(scrollableParent), [scrollableParent]);
73988
- useEffect(() => {
73989
- function calculateScrollState() {
73990
- const scrollTop = scrollerAPI.getScrollTop();
73991
- const scrollHeight = scrollerAPI.getScrollHeight();
73992
- const clientHeight = scrollerAPI.getClientHeight();
73993
- setCanScrollDown(scrollTop + clientHeight < scrollHeight - MARGIN);
73994
- }
73995
- calculateScrollState();
73996
- const resizeObserver = new ResizeObserver(() => {
73997
- calculateScrollState();
73998
- });
73999
- resizeObserver.observe(scrollerAPI.getObserveElement());
74000
- scrollerAPI.root.addEventListener("scroll", calculateScrollState);
74001
- return () => {
74002
- resizeObserver.disconnect();
74003
- scrollerAPI.root.removeEventListener("scroll", calculateScrollState);
74004
- };
74005
- }, [scrollerAPI]);
74006
- const onClick = useCallback(() => {
74007
- setCanScrollDown(false);
74008
- scrollerAPI.root.scrollTo({
74009
- top: scrollerAPI.getScrollHeight()
74010
- });
74011
- parentOnClick == null ? void 0 : parentOnClick();
74012
- }, [parentOnClick, scrollerAPI]);
74013
- return canScrollDown ? /* @__PURE__ */ jsx("div", { className: "tw-sticky tw-bottom-0 tw-w-full tw-text-center tw-py-4", children: /* @__PURE__ */ jsxs(Button3, { variant: "outline", onClick, className: "tw-py-3 hover:tw-bg-primary-hover", children: [
74014
- /* @__PURE__ */ jsx(ArrowDown, { size: 16 }),
74015
- " Skip to end"
74016
- ] }) }) : null;
74017
- };
74018
- const useDebounce = (value, delay) => {
74019
- const [debouncedValue, setDebouncedValue] = useState(value);
74020
- useEffect(() => {
74021
- const handler = setTimeout(() => setDebouncedValue(value), delay);
74022
- return () => clearTimeout(handler);
74023
- }, [delay, value]);
74024
- return debouncedValue;
74025
- };
74026
- function usePromptsQuery(query) {
74027
- const prompts = useExtensionAPI().prompts;
74028
- return useObservable(useMemo(() => prompts(query), [prompts, query]));
74029
- }
74030
- const PromptList = ({
74031
- onSelect: parentOnSelect,
74032
- onSwitchToPromptsTab,
74033
- onSelectActionLabels,
74034
- showSearch = true,
74035
- showInitialSelectedItem = false,
74036
- showPromptLibraryUnsupportedMessage = true,
74037
- showCommandOrigins = false,
74038
- className,
74039
- commandListClassName,
74040
- showSwitchToPromptAction = false,
74041
- telemetryLocation
74042
- }) => {
74043
- var _a;
74044
- const telemetryRecorder = useTelemetryRecorder();
74045
- const telemetryPublicMetadata = {
74046
- [`in${telemetryLocation}`]: 1
74047
- };
74048
- const [query, setQuery] = useState("");
74049
- const debouncedQuery = useDebounce(query, 250);
74050
- const { value: result, error: error2 } = usePromptsQuery(debouncedQuery);
74051
- const onSelect = useCallback(
74052
- (rowValue) => {
74053
- var _a2, _b, _c;
74054
- const prompt = (result == null ? void 0 : result.prompts.type) === "results" ? result.prompts.results.find(
74055
- (p2) => commandRowValue({ type: "prompt", value: p2 }) === rowValue
74056
- ) : void 0;
74057
- const codyCommand = prompt === void 0 ? (_a2 = result == null ? void 0 : result.commands) == null ? void 0 : _a2.find(
74058
- (c2) => commandRowValue({ type: "command", value: c2 }) === rowValue
74059
- ) : void 0;
74060
- const entry = prompt ? { type: "prompt", value: prompt } : codyCommand ? { type: "command", value: codyCommand } : void 0;
74061
- if (!entry) {
74062
- return;
74063
- }
74064
- telemetryRecorder.recordEvent("cody.promptList", "select", {
74065
- metadata: {
74066
- isPrompt: prompt ? 1 : 0,
74067
- isCommand: codyCommand ? 1 : 0,
74068
- isCommandBuiltin: (codyCommand == null ? void 0 : codyCommand.type) === "default" ? 1 : 0,
74069
- isCommandCustom: (codyCommand == null ? void 0 : codyCommand.type) !== "default" ? 1 : 0,
74070
- ...telemetryPublicMetadata
74071
- },
74072
- privateMetadata: {
74073
- nameWithOwner: prompt ? prompt.nameWithOwner : void 0
74074
- }
74075
- });
74076
- if (result) {
74077
- telemetryRecorder.recordEvent("cody.promptList", "query", {
74078
- metadata: {
74079
- queryLength: debouncedQuery.length,
74080
- resultCount: (result.prompts.type === "results" ? result.prompts.results.length : 0) + (((_b = result.commands) == null ? void 0 : _b.length) ?? 0),
74081
- resultCountPromptsOnly: result.prompts.type === "results" ? result.prompts.results.length : 0,
74082
- resultCountCommandsOnly: ((_c = result.commands) == null ? void 0 : _c.length) ?? 0,
74083
- supportsPrompts: result.prompts.type !== "unsupported" ? 1 : 0,
74084
- hasUsePromptsQueryError: error2 ? 1 : 0,
74085
- hasPromptsResultError: result.prompts.type === "error" ? 1 : 0,
74086
- ...telemetryPublicMetadata
74087
- },
74088
- privateMetadata: {
74089
- query: debouncedQuery,
74090
- usePromptsQueryErrorMessage: error2 == null ? void 0 : error2.message,
74091
- promptsResultErrorMessage: result.prompts.type === "error" ? result.prompts.error : void 0
74092
- }
74093
- });
74094
- }
74095
- parentOnSelect(entry);
74096
- },
74097
- [
74098
- result,
74099
- telemetryRecorder.recordEvent,
74100
- parentOnSelect,
74101
- telemetryPublicMetadata,
74102
- debouncedQuery,
74103
- error2
74104
- ]
74105
- );
74106
- const endpointURL = new URL(useConfig().authStatus.endpoint);
74107
- const itemClassName = "tw-border tw-border-border !tw-rounded-lg !tw-p-4";
74108
- return /* @__PURE__ */ jsx(
74109
- Command,
74110
- {
74111
- loop: true,
74112
- tabIndex: 0,
74113
- className: clsx$1(
74114
- "!tw-overflow-visible focus:tw-outline-none tw-border-0 !tw-max-w-[unset] tw-w-full !tw-h-[unset] !tw-bg-[unset]",
74115
- className
74116
- ),
74117
- shouldFilter: false,
74118
- disablePointerSelection: true,
74119
- defaultValue: showInitialSelectedItem ? void 0 : "xxx-no-item",
74120
- children: /* @__PURE__ */ jsxs(
74121
- CommandList,
74122
- {
74123
- className: clsx$1(
74124
- "!tw-max-h-[unset] !tw-overflow-visible [&_[cmdk-group]]:tw-pt-0 [&_[cmdk-group-heading]]:tw-flex [&_[cmdk-group-heading]]:tw-gap-2 [&_[cmdk-group-heading]]:tw-items-center [&_[cmdk-group-heading]]:!tw-min-h-[30px] [&_[cmdk-group-heading]]:tw--mx-2 [&_[cmdk-group-heading]]:tw-px-4 [&_[cmdk-group-heading]]:tw-mb-2 [&_[cmdk-group-heading]]:tw-bg-muted [&_[cmdk-group]]:!tw-border-0",
74125
- commandListClassName
74126
- ),
74127
- children: [
74128
- showSearch && /* @__PURE__ */ jsx(
74129
- CommandInput,
74130
- {
74131
- value: query,
74132
- onValueChange: setQuery,
74133
- placeholder: "Search...",
74134
- autoFocus: true,
74135
- wrapperClassName: "!tw-border-0 tw-mb-3 tw-px-2",
74136
- className: "!tw-border-border tw-rounded-md focus:!tw-border-ring !tw-py-3"
74137
- }
74138
- ),
74139
- result && result.prompts.type !== "unsupported" && /* @__PURE__ */ jsxs(CommandGroup, { className: "[&_[cmdk-group-items]]:tw-space-y-4", children: [
74140
- result.prompts.type === "results" ? /* @__PURE__ */ jsxs(Fragment, { children: [
74141
- result.prompts.results.length === 0 && /* @__PURE__ */ jsx(CommandLoading, { children: result.query === "" ? /* @__PURE__ */ jsxs(Fragment, { children: [
74142
- "Your Prompt Library is empty.",
74143
- " ",
74144
- /* @__PURE__ */ jsx(
74145
- "a",
74146
- {
74147
- href: new URL(
74148
- "/prompts/new",
74149
- endpointURL
74150
- ).toString(),
74151
- target: "_blank",
74152
- rel: "noreferrer",
74153
- children: "Add a prompt"
74154
- }
74155
- ),
74156
- " ",
74157
- "to reuse and share it."
74158
- ] }) : /* @__PURE__ */ jsx(Fragment, { children: "No prompts found" }) }),
74159
- result.prompts.results.map((prompt) => /* @__PURE__ */ jsx(
74160
- PromptCommandItem,
74161
- {
74162
- prompt,
74163
- onSelect,
74164
- selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.prompt,
74165
- className: itemClassName
74166
- },
74167
- prompt.id
74168
- )),
74169
- (_a = result == null ? void 0 : result.commands) == null ? void 0 : _a.map((command) => /* @__PURE__ */ jsx(
74170
- CodyCommandItem,
74171
- {
74172
- command,
74173
- onSelect,
74174
- selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.command,
74175
- showCommandOrigins,
74176
- className: itemClassName
74177
- },
74178
- command.key
74179
- ))
74180
- ] }) : null,
74181
- result.prompts.type === "error" && /* @__PURE__ */ jsxs(CommandLoading, { children: [
74182
- "Error: ",
74183
- result.prompts.error
74184
- ] })
74185
- ] }),
74186
- showPromptLibraryUnsupportedMessage && result && result.prompts.type === "unsupported" && /* @__PURE__ */ jsxs(Fragment, { children: [
74187
- /* @__PURE__ */ jsx(CommandSeparator, { alwaysRender: true }),
74188
- /* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
74189
- "Prompt Library is not yet available on ",
74190
- endpointURL.hostname,
74191
- ". Ask your site admin to upgrade to Sourcegraph 5.6 or later."
74192
- ] })
74193
- ] }),
74194
- !result && !error2 && /* @__PURE__ */ jsx(CommandLoading, { className: "tw-px-4", children: "Loading..." }),
74195
- error2 && /* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
74196
- "Error: ",
74197
- error2.message || "unknown"
74198
- ] }),
74199
- showSwitchToPromptAction && /* @__PURE__ */ jsx(CommandRow, { className: "tw-items-center tw-justify-center tw-py-4", children: /* @__PURE__ */ jsx(Button3, { variant: "ghost", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(
74200
- "button",
74201
- {
74202
- type: "button",
74203
- className: "!tw-text-muted-foreground !hover:tw-text-button-foreground",
74204
- onClick: onSwitchToPromptsTab,
74205
- children: "Switch to Prompt Library"
74206
- }
74207
- ) }) })
74208
- ]
74209
- }
74210
- )
74211
- }
74212
- );
74213
- };
74214
- function commandRowValue(row2) {
74215
- return row2.type === "prompt" ? `prompt-${row2.value.id}` : `command-${row2.value.key}`;
74216
- }
74217
- const PromptCommandItem = ({ prompt, onSelect, selectActionLabel, className }) => /* @__PURE__ */ jsxs(
74218
- CommandItem,
74219
- {
74220
- value: commandRowValue({ type: "prompt", value: prompt }),
74221
- onSelect,
74222
- className: clsx$1("!tw-items-start tw-overflow-hidden tw-gap-3 tw-group/[cmdk-item]", className),
74223
- children: [
74224
- /* @__PURE__ */ jsx(
74225
- UserAvatar,
74226
- {
74227
- user: {
74228
- username: prompt.owner.namespaceName,
74229
- displayName: prompt.owner.displayName ?? void 0
74230
- },
74231
- size: 22,
74232
- className: "tw-flex-shrink-0 tw-text-xxs"
74233
- }
74234
- ),
74235
- /* @__PURE__ */ jsxs("div", { className: "tw-text-nowrap tw-text-ellipsis tw-overflow-hidden", children: [
74236
- /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-text-nowrap tw-gap-3 tw-w-full tw-items-start tw-overflow-hidden", children: [
74237
- /* @__PURE__ */ jsx("span", { className: "", children: prompt.name }),
74238
- prompt.draft && /* @__PURE__ */ jsx(Badge3, { variant: "secondary", className: "tw-text-xxs tw-mt-0.5", children: "Draft" })
74239
- ] }),
74240
- prompt.description && /* @__PURE__ */ jsx("span", { className: "tw-text-muted-foreground tw-w-full", children: prompt.description })
74241
- ] })
74242
- ]
74243
- }
74244
- );
74245
- const CodyCommandItem = ({ command, onSelect, selectActionLabel, showCommandOrigins, className }) => /* @__PURE__ */ jsxs(
74246
- CommandItem,
74247
- {
74248
- value: commandRowValue({ type: "command", value: command }),
74249
- onSelect,
74250
- className: clsx$1("!tw-items-start tw-overflow-hidden tw-gap-3 tw-group/[cmdk-item]", className),
74251
- children: [
74252
- /* @__PURE__ */ jsx("div", { className: "tw-w-[22px] tw-flex-shrink-0", children: /* @__PURE__ */ jsx(
74253
- CommandItemIcon,
74254
- {
74255
- command,
74256
- size: 13,
74257
- className: "tw-text-muted-foreground tw-mt-2 tw-mx-auto"
74258
- }
74259
- ) }),
74260
- /* @__PURE__ */ jsxs("div", { className: "tw-text-nowrap tw-text-ellipsis tw-overflow-hidden", children: [
74261
- /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-wrap tw-gap-3 tw-w-full tw-items-start", children: [
74262
- /* @__PURE__ */ jsx("span", { className: "tw-whitespace-nowrap", children: command.type === "default" ? command.description : command.key }),
74263
- showCommandOrigins && command.type !== "default" && /* @__PURE__ */ jsx(Badge3, { variant: "secondary", className: "tw-text-xxs tw-mt-0.5 tw-whitespace-nowrap", children: "Custom Command" })
74264
- ] }),
74265
- command.type !== "default" && command.description && /* @__PURE__ */ jsx("span", { className: "tw-text-xs tw-text-muted-foreground tw-text-nowrap tw-overflow-hidden tw-text-ellipsis tw-w-full", children: command.description })
74266
- ] })
74267
- ]
74268
- }
74269
- );
74270
- const CommandItemIcon = ({
74271
- command,
74272
- size: size2,
74273
- className
74274
- }) => {
74275
- const Icon2 = iconForCommand(command);
74276
- return /* @__PURE__ */ jsx(Icon2, { size: size2, className });
74277
- };
74278
- function iconForCommand(command) {
74279
- var _a;
74280
- return ((_a = ICON_KEYWORDS.find((icon2) => command.key.toLowerCase().includes(icon2.keyword))) == null ? void 0 : _a.icon) ?? Play;
74281
- }
74282
- const ICON_KEYWORDS = [
74283
- { keyword: "edit", icon: Pencil },
74284
- { keyword: "doc", icon: BookOpen },
74285
- { keyword: "explain", icon: FileQuestion },
74286
- { keyword: "test", icon: Hammer },
74287
- { keyword: "fix", icon: Bug },
74288
- { keyword: "debug", icon: Bug },
74289
- { keyword: "secur", icon: ShieldCheck },
74290
- { keyword: "refactor", icon: Combine },
74291
- { keyword: "review", icon: MessageCircleCode }
74292
- ];
74293
74191
  const PromptsTab = ({ setView }) => {
74294
74192
  const dispatchClientAction = useClientActionDispatcher();
74295
74193
  return /* @__PURE__ */ jsx("div", { className: "tw-overflow-auto tw-p-8", children: /* @__PURE__ */ jsx(
74296
- PromptList,
74194
+ PromptListSuitedForNonPopover,
74297
74195
  {
74298
74196
  onSelect: (item2) => onPromptSelectInPanel(item2, setView, dispatchClientAction),
74299
74197
  onSelectActionLabels: onPromptSelectInPanelActionLabels,
74300
74198
  showCommandOrigins: true,
74301
- showSearch: true,
74302
- showInitialSelectedItem: false,
74303
- showSwitchToPromptAction: false,
74304
74199
  showPromptLibraryUnsupportedMessage: true,
74305
- telemetryLocation: "PromptsTab"
74200
+ showOnlyPromptInsertableCommands: false,
74201
+ telemetryLocation: "PromptsTab",
74202
+ className: "tw-border tw-border-border"
74306
74203
  }
74307
74204
  ) });
74308
74205
  };
@@ -74335,216 +74232,279 @@ const onPromptSelectInPanelActionLabels = {
74335
74232
  command: "run",
74336
74233
  prompt: "insert"
74337
74234
  };
74338
- const AccountTab = () => {
74339
- const userInfo = useUserAccountInfo();
74340
- const { user, isCodyProUser: isCodyProUser2, isDotComUser, ide } = userInfo;
74341
- const { displayName, username, primaryEmail, endpoint } = user;
74342
- if (ide === CodyIDE.VSCode) {
74343
- return null;
74344
- }
74345
- const actions2 = [];
74346
- actions2.push({
74347
- text: "Switch Account...",
74348
- onClick: useCallback(() => {
74349
- if (userInfo.user.username) {
74350
- getVSCodeAPI().postMessage({ command: "command", id: "cody.auth.switchAccount" });
74235
+ const MenuExample = ({ children: children2 }) => /* @__PURE__ */ jsx("span", { className: "tw-p-1 tw-rounded tw-text-keybinding-foreground tw-border tw-border-keybinding-border tw-bg-keybinding-background tw-whitespace-nowrap", children: children2 });
74236
+ const FeatureRowInlineIcon = ({ Icon: Icon2 }) => /* @__PURE__ */ jsx(Icon2, { size: 16, strokeWidth: 1.25, className: "tw-flex-none tw-inline-flex tw-mt-1 tw-opacity-80" });
74237
+ const FeatureRow = ({ icon: icon2, children: children2 }) => /* @__PURE__ */ jsxs("div", { className: "tw-py-2 tw-px-4 tw-inline-flex tw-gap-3 tw-text-foreground tw-items-start", children: [
74238
+ /* @__PURE__ */ jsx(FeatureRowInlineIcon, { Icon: icon2 }),
74239
+ /* @__PURE__ */ jsx("div", { className: "tw-grow", children: children2 })
74240
+ ] });
74241
+ const localStorageKey = "chat.welcome-message-dismissed";
74242
+ const WelcomeMessage = ({
74243
+ IDE,
74244
+ setView
74245
+ }) => {
74246
+ localStorage.removeItem(localStorageKey);
74247
+ const dispatchClientAction = useClientActionDispatcher();
74248
+ return /* @__PURE__ */ jsxs("div", { className: "tw-flex-1 tw-flex tw-flex-col tw-items-start tw-w-full tw-px-6 tw-gap-6 tw-transition-all", children: [
74249
+ /* @__PURE__ */ jsx(
74250
+ CollapsiblePanel,
74251
+ {
74252
+ storageKey: "prompts",
74253
+ title: "Prompts & Commands",
74254
+ className: "tw-mb-6",
74255
+ contentClassName: "!tw-p-0 tw-overflow-clip",
74256
+ initialOpen: true,
74257
+ children: /* @__PURE__ */ jsx(
74258
+ PromptListSuitedForNonPopover,
74259
+ {
74260
+ onSelect: (item2) => onPromptSelectInPanel(item2, setView, dispatchClientAction),
74261
+ onSelectActionLabels: onPromptSelectInPanelActionLabels,
74262
+ telemetryLocation: "PromptsTab",
74263
+ showCommandOrigins: true,
74264
+ showPromptLibraryUnsupportedMessage: false,
74265
+ showOnlyPromptInsertableCommands: false,
74266
+ className: "tw-rounded-none"
74267
+ }
74268
+ )
74351
74269
  }
74352
- }, [userInfo])
74353
- });
74354
- if (isDotComUser) {
74355
- actions2.push({
74356
- text: "Manage Account",
74357
- onClick: useCallback(() => {
74358
- if (userInfo.user.username) {
74359
- const uri = URI.parse(ACCOUNT_USAGE_URL.toString()).with({
74360
- query: `cody_client_user=${encodeURIComponent(userInfo.user.username)}`
74361
- });
74362
- getVSCodeAPI().postMessage({ command: "links", value: uri.toString() });
74363
- }
74364
- }, [userInfo])
74365
- });
74366
- }
74367
- actions2.push({
74368
- text: "Settings",
74369
- onClick: () => getVSCodeAPI().postMessage({ command: "command", id: "cody.status-bar.interacted" })
74370
- });
74371
- actions2.push({
74372
- text: "Sign Out",
74373
- onClick: () => getVSCodeAPI().postMessage({ command: "auth", authKind: "signout" })
74374
- });
74375
- return /* @__PURE__ */ jsxs("div", { className: "tw-overflow-auto tw-flex-1 tw-flex tw-flex-col tw-items-start tw-w-full tw-px-8 tw-py-6 tw-gap-6", children: [
74376
- /* @__PURE__ */ jsx("h2", { children: "Account" }),
74377
- /* @__PURE__ */ jsxs("div", { className: "tw-w-full tw-px-8 tw-py-4 tw-flex tw-flex-col tw-gap-4 tw-bg-popover tw-border tw-border-border tw-rounded-lg", children: [
74378
- /* @__PURE__ */ jsx("div", { className: "tw-flex tw-justify-between tw-w-full tw-border-b tw-border-border tw-shadow-lg tw-shadow-border-500/50 tw-p-4 tw-pb-6", children: /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-self-stretch", children: [
74379
- /* @__PURE__ */ jsx(UserAvatar, { user, size: MESSAGE_CELL_AVATAR_SIZE }),
74380
- /* @__PURE__ */ jsxs("div", { className: "tw-ml-4", children: [
74381
- /* @__PURE__ */ jsx("p", { className: "tw-text-lg tw-font-semibold", children: displayName ?? username }),
74382
- /* @__PURE__ */ jsx("p", { className: "tw-text-sm tw-text-muted-foreground", children: primaryEmail })
74383
- ] })
74384
- ] }) }),
74385
- /* @__PURE__ */ jsxs("div", { className: "tw-grid tw-grid-cols-5 tw-gap-4", children: [
74386
- /* @__PURE__ */ jsx("div", { children: "Plan:" }),
74387
- /* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: isDotComUser ? isCodyProUser2 ? "Cody Pro" : "Cody Free" : "Enterprise" }),
74388
- /* @__PURE__ */ jsx("div", { children: "Endpoint:" }),
74389
- /* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: endpoint })
74390
- ] })
74391
- ] }),
74392
- actions2.map((a2) => /* @__PURE__ */ jsx(
74393
- Button3,
74270
+ ),
74271
+ /* @__PURE__ */ jsxs(
74272
+ CollapsiblePanel,
74394
74273
  {
74395
- variant: "secondary",
74396
- className: "tw-w-full tw-bg-popover tw-border tw-border-border",
74397
- onClick: a2.onClick,
74398
- title: a2.text,
74399
- children: a2.text
74400
- },
74401
- a2.text
74402
- ))
74274
+ storageKey: "chat-help",
74275
+ title: "Chat Help",
74276
+ className: "tw-mb-6 tw-mt-2",
74277
+ initialOpen: true,
74278
+ children: [
74279
+ /* @__PURE__ */ jsxs(FeatureRow, { icon: AtSign, children: [
74280
+ "Type ",
74281
+ /* @__PURE__ */ jsx(Kbd, { macOS: "@", linuxAndWindows: "@" }),
74282
+ " to add context to your chat"
74283
+ ] }),
74284
+ IDE === CodyIDE.VSCode && /* @__PURE__ */ jsxs(Fragment, { children: [
74285
+ /* @__PURE__ */ jsxs(FeatureRow, { icon: Text, children: [
74286
+ "To add code context from an editor, right click and use",
74287
+ " ",
74288
+ /* @__PURE__ */ jsx(MenuExample, { children: "Cody > Add File/Selection to Cody Chat" })
74289
+ ] }),
74290
+ /* @__PURE__ */ jsxs(FeatureRow, { icon: MessageSquarePlus, children: [
74291
+ "Start a new chat using ",
74292
+ /* @__PURE__ */ jsx(Kbd, { macOS: "opt+L", linuxAndWindows: "alt+L" })
74293
+ ] }),
74294
+ /* @__PURE__ */ jsxs(FeatureRow, { icon: Settings, children: [
74295
+ "Customize chat settings with the ",
74296
+ /* @__PURE__ */ jsx(FeatureRowInlineIcon, { Icon: Settings }),
74297
+ " ",
74298
+ "button, or see the",
74299
+ " ",
74300
+ /* @__PURE__ */ jsx("a", { href: "https://sourcegraph.com/docs/cody", children: "documentation" })
74301
+ ] })
74302
+ ] })
74303
+ ]
74304
+ }
74305
+ )
74403
74306
  ] });
74404
74307
  };
74405
- function getCreateNewChatCommand(options) {
74406
- const { IDE, webviewType, multipleWebviewsEnabled } = options;
74407
- return IDE === CodyIDE.Web ? "cody.chat.new" : webviewType === "sidebar" || !multipleWebviewsEnabled ? "cody.chat.newPanel" : "cody.chat.newEditorPanel";
74308
+ const MARGIN = 200;
74309
+ function createScrollerAPI(element2) {
74310
+ return {
74311
+ root: element2,
74312
+ getObserveElement: () => element2.firstElementChild,
74313
+ getScrollTop: () => element2.scrollTop,
74314
+ getScrollHeight: () => element2.scrollHeight,
74315
+ getClientHeight: () => element2.getBoundingClientRect().height
74316
+ };
74408
74317
  }
74409
- const HistoryTab = ({
74410
- userHistory,
74411
- IDE,
74412
- webviewType,
74413
- multipleWebviewsEnabled,
74414
- setView
74318
+ const ScrollDown = (props) => {
74319
+ const { scrollableParent, onClick: parentOnClick } = props;
74320
+ const [canScrollDown, setCanScrollDown] = useState(false);
74321
+ const scrollerAPI = useMemo(() => createScrollerAPI(scrollableParent), [scrollableParent]);
74322
+ useEffect(() => {
74323
+ function calculateScrollState() {
74324
+ const scrollTop = scrollerAPI.getScrollTop();
74325
+ const scrollHeight = scrollerAPI.getScrollHeight();
74326
+ const clientHeight = scrollerAPI.getClientHeight();
74327
+ setCanScrollDown(scrollTop + clientHeight < scrollHeight - MARGIN);
74328
+ }
74329
+ calculateScrollState();
74330
+ const resizeObserver = new ResizeObserver(() => {
74331
+ calculateScrollState();
74332
+ });
74333
+ resizeObserver.observe(scrollerAPI.getObserveElement());
74334
+ scrollerAPI.root.addEventListener("scroll", calculateScrollState);
74335
+ return () => {
74336
+ resizeObserver.disconnect();
74337
+ scrollerAPI.root.removeEventListener("scroll", calculateScrollState);
74338
+ };
74339
+ }, [scrollerAPI]);
74340
+ const onClick = useCallback(() => {
74341
+ setCanScrollDown(false);
74342
+ scrollerAPI.root.scrollTo({
74343
+ top: scrollerAPI.getScrollHeight()
74344
+ });
74345
+ parentOnClick == null ? void 0 : parentOnClick();
74346
+ }, [parentOnClick, scrollerAPI]);
74347
+ return canScrollDown ? /* @__PURE__ */ jsx("div", { className: "tw-sticky tw-bottom-0 tw-w-full tw-text-center tw-py-4", children: /* @__PURE__ */ jsxs(Button3, { variant: "outline", onClick, className: "tw-py-3 hover:tw-bg-primary-hover", children: [
74348
+ /* @__PURE__ */ jsx(ArrowDown, { size: 16 }),
74349
+ " Skip to end"
74350
+ ] }) }) : null;
74351
+ };
74352
+ const Chat = ({
74353
+ messageInProgress,
74354
+ transcript,
74355
+ vscodeAPI,
74356
+ isTranscriptError,
74357
+ chatEnabled = true,
74358
+ guardrails,
74359
+ scrollableParent,
74360
+ showWelcomeMessage = true,
74361
+ showIDESnippetActions = true,
74362
+ setView,
74363
+ smartApplyEnabled
74415
74364
  }) => {
74416
- const chatByPeriod = useMemo(
74417
- () => userHistory.filter((chat2) => chat2.interactions.length).reverse().reduce((acc, chat2) => {
74418
- const period = getRelativeChatPeriod(new Date(chat2.lastInteractionTimestamp));
74419
- acc.set(period, [...acc.get(period) || [], chat2]);
74420
- return acc;
74421
- }, /* @__PURE__ */ new Map()),
74422
- [userHistory]
74365
+ const telemetryRecorder = useTelemetryRecorder();
74366
+ const transcriptRef = useRef(transcript);
74367
+ transcriptRef.current = transcript;
74368
+ const userInfo = useUserAccountInfo();
74369
+ const feedbackButtonsOnSubmit = useCallback(
74370
+ (text2) => {
74371
+ var _a, _b;
74372
+ let FeedbackType;
74373
+ ((FeedbackType2) => {
74374
+ FeedbackType2[FeedbackType2["thumbsUp"] = 1] = "thumbsUp";
74375
+ FeedbackType2[FeedbackType2["thumbsDown"] = 0] = "thumbsDown";
74376
+ })(FeedbackType || (FeedbackType = {}));
74377
+ telemetryRecorder.recordEvent("cody.feedback", "submit", {
74378
+ metadata: {
74379
+ feedbackType: text2 === "thumbsUp" ? 1 : 0,
74380
+ lastChatUsedEmbeddings: ((_b = (_a = transcriptRef.current.at(-1)) == null ? void 0 : _a.contextFiles) == null ? void 0 : _b.some((file) => file.source === "embeddings")) ? 1 : 0,
74381
+ recordsPrivateMetadataTranscript: userInfo.isDotComUser ? 1 : 0
74382
+ },
74383
+ privateMetadata: {
74384
+ FeedbackText: text2,
74385
+ // 🚨 SECURITY: chat transcripts are to be included only for DotCom users AND for V2 telemetry
74386
+ // V2 telemetry exports privateMetadata only for DotCom users
74387
+ // the condition below is an aditional safegaurd measure
74388
+ responseText: userInfo.isDotComUser ? truncateTextStart(transcriptRef.current.toString(), CHAT_INPUT_TOKEN_BUDGET) : ""
74389
+ }
74390
+ });
74391
+ },
74392
+ [userInfo, telemetryRecorder]
74423
74393
  );
74424
- const onDeleteButtonClick = useCallback(
74425
- (id2) => {
74426
- if (userHistory.find((chat2) => chat2.id === id2)) {
74427
- getVSCodeAPI().postMessage({
74428
- command: "command",
74429
- id: "cody.chat.history.clear",
74430
- arg: id2
74431
- });
74432
- }
74394
+ const copyButtonOnSubmit = useCallback(
74395
+ (text2, eventType = "Button") => {
74396
+ const op = "copy";
74397
+ const code2 = eventType === "Button" ? text2.replace(/\n$/, "") : text2;
74398
+ vscodeAPI.postMessage({
74399
+ command: op,
74400
+ eventType,
74401
+ text: code2
74402
+ });
74433
74403
  },
74434
- [userHistory]
74404
+ [vscodeAPI]
74435
74405
  );
74436
- const handleStartNewChat = () => {
74437
- getVSCodeAPI().postMessage({
74438
- command: "command",
74439
- id: getCreateNewChatCommand({ IDE, webviewType, multipleWebviewsEnabled })
74440
- });
74441
- setView(View.Chat);
74442
- };
74443
- const chats = Array.from(chatByPeriod);
74444
- return /* @__PURE__ */ jsxs("div", { className: "tw-px-8 tw-pt-6 tw-pb-12 tw-flex tw-flex-col tw-gap-10", children: [
74445
- chats.map(([period, chats2]) => /* @__PURE__ */ jsx(
74446
- CollapsiblePanel,
74447
- {
74448
- storageKey: `history.${period}`,
74449
- title: period,
74450
- initialOpen: true,
74451
- children: chats2.map(({ interactions, id: id2 }) => {
74452
- var _a, _b, _c;
74453
- const lastMessage = (_c = (_b = (_a = interactions[interactions.length - 1]) == null ? void 0 : _a.humanMessage) == null ? void 0 : _b.text) == null ? void 0 : _c.trim();
74454
- return /* @__PURE__ */ jsxs("div", { className: "tw-inline-flex tw-justify-between", children: [
74455
- /* @__PURE__ */ jsxs(
74456
- Button3,
74457
- {
74458
- variant: "ghost",
74459
- title: lastMessage,
74460
- onClick: () => getVSCodeAPI().postMessage({
74461
- command: "restoreHistory",
74462
- chatID: id2
74463
- }),
74464
- className: "tw-text-left tw-truncate tw-w-full",
74465
- children: [
74466
- /* @__PURE__ */ jsx(
74467
- MessageSquareText,
74468
- {
74469
- className: "tw-w-8 tw-h-8 tw-opacity-80",
74470
- size: 16,
74471
- strokeWidth: "1.25"
74472
- }
74473
- ),
74474
- /* @__PURE__ */ jsx("span", { className: "tw-truncate tw-w-full", children: lastMessage })
74475
- ]
74476
- },
74477
- id2
74478
- ),
74479
- /* @__PURE__ */ jsx(
74480
- Button3,
74481
- {
74482
- variant: "ghost",
74483
- title: "Delete chat",
74484
- onClick: () => onDeleteButtonClick(id2),
74485
- children: /* @__PURE__ */ jsx(
74486
- Trash,
74487
- {
74488
- className: "tw-w-8 tw-h-8 tw-opacity-80",
74489
- size: 16,
74490
- strokeWidth: "1.25"
74491
- }
74492
- )
74493
- },
74494
- id2
74495
- )
74496
- ] }, id2);
74497
- })
74406
+ const insertButtonOnSubmit = useMemo(() => {
74407
+ if (showIDESnippetActions) {
74408
+ return (text2, newFile = false) => {
74409
+ const op = newFile ? "newFile" : "insert";
74410
+ vscodeAPI.postMessage({
74411
+ command: op,
74412
+ // remove the additional /n added by the text area at the end of the text
74413
+ text: text2.replace(/\n$/, "")
74414
+ });
74415
+ };
74416
+ }
74417
+ return;
74418
+ }, [vscodeAPI, showIDESnippetActions]);
74419
+ const smartApply = useMemo(() => {
74420
+ if (!showIDESnippetActions) {
74421
+ return;
74422
+ }
74423
+ return {
74424
+ onSubmit: (id2, text2, instruction, fileName) => {
74425
+ vscodeAPI.postMessage({
74426
+ command: "smartApplySubmit",
74427
+ id: id2,
74428
+ instruction: instruction == null ? void 0 : instruction.toString(),
74429
+ // remove the additional /n added by the text area at the end of the text
74430
+ code: text2.replace(/\n$/, ""),
74431
+ fileName
74432
+ });
74498
74433
  },
74499
- period
74500
- )),
74501
- chats.length === 0 && /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col tw-items-center tw-mt-6", children: [
74502
- /* @__PURE__ */ jsx(
74503
- History,
74504
- {
74505
- size: 20,
74506
- strokeWidth: 1.25,
74507
- className: "tw-mb-5 tw-text-muted-foreground"
74508
- }
74509
- ),
74510
- /* @__PURE__ */ jsx("span", { className: "tw-text-lg tw-mb-4 tw-text-muted-foreground", children: "You have no chat history" }),
74511
- /* @__PURE__ */ jsxs("span", { className: "tw-text-sm tw-text-muted-foreground tw-mb-8", children: [
74512
- "Explore all your previous chats here. Track and ",
74513
- /* @__PURE__ */ jsx("br", {}),
74514
- " search through what you’ve been working on."
74515
- ] }),
74516
- /* @__PURE__ */ jsxs(
74517
- Button3,
74518
- {
74519
- size: "sm",
74520
- variant: "secondary",
74521
- "aria-label": "Start a new chat",
74522
- className: "tw-px-4 tw-py-2",
74523
- onClick: handleStartNewChat,
74524
- children: [
74525
- /* @__PURE__ */ jsx(MessageSquarePlus, { size: 16, className: "tw-w-8 tw-h-8", strokeWidth: 1.25 }),
74526
- "Start a new chat"
74527
- ]
74528
- }
74529
- )
74530
- ] })
74434
+ onAccept: (id2) => {
74435
+ vscodeAPI.postMessage({
74436
+ command: "smartApplyAccept",
74437
+ id: id2
74438
+ });
74439
+ },
74440
+ onReject: (id2) => {
74441
+ vscodeAPI.postMessage({
74442
+ command: "smartApplyReject",
74443
+ id: id2
74444
+ });
74445
+ }
74446
+ };
74447
+ }, [vscodeAPI, showIDESnippetActions]);
74448
+ const postMessage = useCallback((msg) => vscodeAPI.postMessage(msg), [vscodeAPI]);
74449
+ useEffect(() => {
74450
+ function handleKeyDown(event) {
74451
+ if (event.key === "Escape" && messageInProgress) {
74452
+ vscodeAPI.postMessage({ command: "abort" });
74453
+ }
74454
+ if (event.metaKey && event.key === "o") {
74455
+ event.preventDefault();
74456
+ event.stopPropagation();
74457
+ }
74458
+ }
74459
+ window.addEventListener("keydown", handleKeyDown);
74460
+ return () => {
74461
+ window.removeEventListener("keydown", handleKeyDown);
74462
+ };
74463
+ }, [vscodeAPI, messageInProgress]);
74464
+ useEffect(() => {
74465
+ const onFocus = () => {
74466
+ const sel = window.getSelection();
74467
+ const focusNode = sel == null ? void 0 : sel.focusNode;
74468
+ const focusElement = focusNode instanceof Element ? focusNode : focusNode == null ? void 0 : focusNode.parentElement;
74469
+ const focusEditor = focusElement == null ? void 0 : focusElement.closest('[data-lexical-editor="true"]');
74470
+ if (focusEditor) {
74471
+ focusEditor.focus({ preventScroll: true });
74472
+ }
74473
+ };
74474
+ window.addEventListener("focus", onFocus);
74475
+ return () => {
74476
+ window.removeEventListener("focus", onFocus);
74477
+ };
74478
+ }, []);
74479
+ const handleScrollDownClick = useCallback(() => {
74480
+ if (transcript.length === 0) {
74481
+ return;
74482
+ }
74483
+ focusLastHumanMessageEditor();
74484
+ }, [transcript]);
74485
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
74486
+ !chatEnabled && /* @__PURE__ */ jsx("div", { className: styles$3.chatDisabled, children: "Cody chat is disabled by your Sourcegraph site administrator" }),
74487
+ /* @__PURE__ */ jsx(
74488
+ Transcript,
74489
+ {
74490
+ transcript,
74491
+ messageInProgress,
74492
+ feedbackButtonsOnSubmit,
74493
+ copyButtonOnSubmit,
74494
+ insertButtonOnSubmit,
74495
+ smartApply,
74496
+ isTranscriptError,
74497
+ userInfo,
74498
+ chatEnabled,
74499
+ postMessage,
74500
+ guardrails,
74501
+ smartApplyEnabled
74502
+ }
74503
+ ),
74504
+ transcript.length === 0 && showWelcomeMessage && /* @__PURE__ */ jsx(WelcomeMessage, { IDE: userInfo.ide, setView }),
74505
+ scrollableParent && /* @__PURE__ */ jsx(ScrollDown, { scrollableParent, onClick: handleScrollDownClick })
74531
74506
  ] });
74532
74507
  };
74533
- const SettingsTab = () => {
74534
- return /* @__PURE__ */ jsx("div", { className: "tw-overflow-auto tw-flex tw-flex-col tw-gap-4 tw-px-8 tw-mt-4", children: /* @__PURE__ */ jsx(
74535
- Button3,
74536
- {
74537
- variant: "secondary",
74538
- className: "tw-w-full tw-bg-popover",
74539
- onClick: () => getVSCodeAPI().postMessage({
74540
- command: "command",
74541
- id: "cody.status-bar.interacted"
74542
- }),
74543
- children: "Cody Settings"
74544
- },
74545
- "settings"
74546
- ) });
74547
- };
74548
74508
  var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
74549
74509
  var EVENT_OPTIONS = { bubbles: false, cancelable: true };
74550
74510
  var GROUP_NAME = "RovingFocusGroup";
@@ -74924,6 +74884,229 @@ var Root2 = Tabs2;
74924
74884
  var List = TabsList;
74925
74885
  var Trigger = TabsTrigger;
74926
74886
  var Content = TabsContent;
74887
+ const TabRoot = React__default.forwardRef(({ className, ...props }, ref2) => {
74888
+ return /* @__PURE__ */ jsx(Root2, { ref: ref2, ...props, orientation: "vertical", className });
74889
+ });
74890
+ const TabContainer = React__default.forwardRef(({ className, ...props }, ref2) => {
74891
+ return /* @__PURE__ */ jsx(
74892
+ Content,
74893
+ {
74894
+ ref: ref2,
74895
+ ...props,
74896
+ className: "tw-h-full tw-flex tw-flex-col tw-overflow-auto tw-gap-4"
74897
+ }
74898
+ );
74899
+ });
74900
+ const AccountTab = () => {
74901
+ const userInfo = useUserAccountInfo();
74902
+ const { user, isCodyProUser: isCodyProUser2, isDotComUser, ide } = userInfo;
74903
+ const { displayName, username, primaryEmail, endpoint } = user;
74904
+ if (ide === CodyIDE.VSCode) {
74905
+ return null;
74906
+ }
74907
+ const actions2 = [];
74908
+ actions2.push({
74909
+ text: "Switch Account...",
74910
+ onClick: useCallback(() => {
74911
+ if (userInfo.user.username) {
74912
+ getVSCodeAPI().postMessage({ command: "command", id: "cody.auth.switchAccount" });
74913
+ }
74914
+ }, [userInfo])
74915
+ });
74916
+ if (isDotComUser) {
74917
+ actions2.push({
74918
+ text: "Manage Account",
74919
+ onClick: useCallback(() => {
74920
+ if (userInfo.user.username) {
74921
+ const uri = URI.parse(ACCOUNT_USAGE_URL.toString()).with({
74922
+ query: `cody_client_user=${encodeURIComponent(userInfo.user.username)}`
74923
+ });
74924
+ getVSCodeAPI().postMessage({ command: "links", value: uri.toString() });
74925
+ }
74926
+ }, [userInfo])
74927
+ });
74928
+ }
74929
+ actions2.push({
74930
+ text: "Settings",
74931
+ onClick: () => getVSCodeAPI().postMessage({ command: "command", id: "cody.status-bar.interacted" })
74932
+ });
74933
+ actions2.push({
74934
+ text: "Sign Out",
74935
+ onClick: () => getVSCodeAPI().postMessage({ command: "auth", authKind: "signout" })
74936
+ });
74937
+ return /* @__PURE__ */ jsxs("div", { className: "tw-overflow-auto tw-flex-1 tw-flex tw-flex-col tw-items-start tw-w-full tw-px-8 tw-py-6 tw-gap-6", children: [
74938
+ /* @__PURE__ */ jsx("h2", { children: "Account" }),
74939
+ /* @__PURE__ */ jsxs("div", { className: "tw-w-full tw-px-8 tw-py-4 tw-flex tw-flex-col tw-gap-4 tw-bg-popover tw-border tw-border-border tw-rounded-lg", children: [
74940
+ /* @__PURE__ */ jsx("div", { className: "tw-flex tw-justify-between tw-w-full tw-border-b tw-border-border tw-shadow-lg tw-shadow-border-500/50 tw-p-4 tw-pb-6", children: /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-self-stretch", children: [
74941
+ /* @__PURE__ */ jsx(UserAvatar, { user, size: MESSAGE_CELL_AVATAR_SIZE }),
74942
+ /* @__PURE__ */ jsxs("div", { className: "tw-ml-4", children: [
74943
+ /* @__PURE__ */ jsx("p", { className: "tw-text-lg tw-font-semibold", children: displayName ?? username }),
74944
+ /* @__PURE__ */ jsx("p", { className: "tw-text-sm tw-text-muted-foreground", children: primaryEmail })
74945
+ ] })
74946
+ ] }) }),
74947
+ /* @__PURE__ */ jsxs("div", { className: "tw-grid tw-grid-cols-5 tw-gap-4", children: [
74948
+ /* @__PURE__ */ jsx("div", { children: "Plan:" }),
74949
+ /* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: isDotComUser ? isCodyProUser2 ? "Cody Pro" : "Cody Free" : "Enterprise" }),
74950
+ /* @__PURE__ */ jsx("div", { children: "Endpoint:" }),
74951
+ /* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: endpoint })
74952
+ ] })
74953
+ ] }),
74954
+ actions2.map((a2) => /* @__PURE__ */ jsx(
74955
+ Button3,
74956
+ {
74957
+ variant: "secondary",
74958
+ className: "tw-w-full tw-bg-popover tw-border tw-border-border",
74959
+ onClick: a2.onClick,
74960
+ title: a2.text,
74961
+ children: a2.text
74962
+ },
74963
+ a2.text
74964
+ ))
74965
+ ] });
74966
+ };
74967
+ function getCreateNewChatCommand(options) {
74968
+ const { IDE, webviewType, multipleWebviewsEnabled } = options;
74969
+ return IDE === CodyIDE.Web ? "cody.chat.new" : webviewType === "sidebar" || !multipleWebviewsEnabled ? "cody.chat.newPanel" : "cody.chat.newEditorPanel";
74970
+ }
74971
+ const HistoryTab = ({
74972
+ userHistory,
74973
+ IDE,
74974
+ webviewType,
74975
+ multipleWebviewsEnabled,
74976
+ setView
74977
+ }) => {
74978
+ const chatByPeriod = useMemo(
74979
+ () => userHistory.filter((chat2) => chat2.interactions.length).reverse().reduce((acc, chat2) => {
74980
+ const period = getRelativeChatPeriod(new Date(chat2.lastInteractionTimestamp));
74981
+ acc.set(period, [...acc.get(period) || [], chat2]);
74982
+ return acc;
74983
+ }, /* @__PURE__ */ new Map()),
74984
+ [userHistory]
74985
+ );
74986
+ const onDeleteButtonClick = useCallback(
74987
+ (id2) => {
74988
+ if (userHistory.find((chat2) => chat2.id === id2)) {
74989
+ getVSCodeAPI().postMessage({
74990
+ command: "command",
74991
+ id: "cody.chat.history.clear",
74992
+ arg: id2
74993
+ });
74994
+ }
74995
+ },
74996
+ [userHistory]
74997
+ );
74998
+ const handleStartNewChat = () => {
74999
+ getVSCodeAPI().postMessage({
75000
+ command: "command",
75001
+ id: getCreateNewChatCommand({ IDE, webviewType, multipleWebviewsEnabled })
75002
+ });
75003
+ setView(View.Chat);
75004
+ };
75005
+ const chats = Array.from(chatByPeriod);
75006
+ return /* @__PURE__ */ jsxs("div", { className: "tw-px-8 tw-pt-6 tw-pb-12 tw-flex tw-flex-col tw-gap-10", children: [
75007
+ chats.map(([period, chats2]) => /* @__PURE__ */ jsx(
75008
+ CollapsiblePanel,
75009
+ {
75010
+ storageKey: `history.${period}`,
75011
+ title: period,
75012
+ initialOpen: true,
75013
+ children: chats2.map(({ interactions, id: id2 }) => {
75014
+ var _a, _b, _c;
75015
+ const lastMessage = (_c = (_b = (_a = interactions[interactions.length - 1]) == null ? void 0 : _a.humanMessage) == null ? void 0 : _b.text) == null ? void 0 : _c.trim();
75016
+ return /* @__PURE__ */ jsxs("div", { className: "tw-inline-flex tw-justify-between", children: [
75017
+ /* @__PURE__ */ jsxs(
75018
+ Button3,
75019
+ {
75020
+ variant: "ghost",
75021
+ title: lastMessage,
75022
+ onClick: () => getVSCodeAPI().postMessage({
75023
+ command: "restoreHistory",
75024
+ chatID: id2
75025
+ }),
75026
+ className: "tw-text-left tw-truncate tw-w-full",
75027
+ children: [
75028
+ /* @__PURE__ */ jsx(
75029
+ MessageSquareText,
75030
+ {
75031
+ className: "tw-w-8 tw-h-8 tw-opacity-80",
75032
+ size: 16,
75033
+ strokeWidth: "1.25"
75034
+ }
75035
+ ),
75036
+ /* @__PURE__ */ jsx("span", { className: "tw-truncate tw-w-full", children: lastMessage })
75037
+ ]
75038
+ },
75039
+ id2
75040
+ ),
75041
+ /* @__PURE__ */ jsx(
75042
+ Button3,
75043
+ {
75044
+ variant: "ghost",
75045
+ title: "Delete chat",
75046
+ onClick: () => onDeleteButtonClick(id2),
75047
+ children: /* @__PURE__ */ jsx(
75048
+ Trash,
75049
+ {
75050
+ className: "tw-w-8 tw-h-8 tw-opacity-80",
75051
+ size: 16,
75052
+ strokeWidth: "1.25"
75053
+ }
75054
+ )
75055
+ },
75056
+ id2
75057
+ )
75058
+ ] }, id2);
75059
+ })
75060
+ },
75061
+ period
75062
+ )),
75063
+ chats.length === 0 && /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col tw-items-center tw-mt-6", children: [
75064
+ /* @__PURE__ */ jsx(
75065
+ History,
75066
+ {
75067
+ size: 20,
75068
+ strokeWidth: 1.25,
75069
+ className: "tw-mb-5 tw-text-muted-foreground"
75070
+ }
75071
+ ),
75072
+ /* @__PURE__ */ jsx("span", { className: "tw-text-lg tw-mb-4 tw-text-muted-foreground", children: "You have no chat history" }),
75073
+ /* @__PURE__ */ jsxs("span", { className: "tw-text-sm tw-text-muted-foreground tw-mb-8", children: [
75074
+ "Explore all your previous chats here. Track and ",
75075
+ /* @__PURE__ */ jsx("br", {}),
75076
+ " search through what you’ve been working on."
75077
+ ] }),
75078
+ /* @__PURE__ */ jsxs(
75079
+ Button3,
75080
+ {
75081
+ size: "sm",
75082
+ variant: "secondary",
75083
+ "aria-label": "Start a new chat",
75084
+ className: "tw-px-4 tw-py-2",
75085
+ onClick: handleStartNewChat,
75086
+ children: [
75087
+ /* @__PURE__ */ jsx(MessageSquarePlus, { size: 16, className: "tw-w-8 tw-h-8", strokeWidth: 1.25 }),
75088
+ "Start a new chat"
75089
+ ]
75090
+ }
75091
+ )
75092
+ ] })
75093
+ ] });
75094
+ };
75095
+ const SettingsTab = () => {
75096
+ return /* @__PURE__ */ jsx("div", { className: "tw-overflow-auto tw-flex tw-flex-col tw-gap-4 tw-px-8 tw-mt-4", children: /* @__PURE__ */ jsx(
75097
+ Button3,
75098
+ {
75099
+ variant: "secondary",
75100
+ className: "tw-w-full tw-bg-popover",
75101
+ onClick: () => getVSCodeAPI().postMessage({
75102
+ command: "command",
75103
+ id: "cody.status-bar.interacted"
75104
+ }),
75105
+ children: "Cody Settings"
75106
+ },
75107
+ "settings"
75108
+ ) });
75109
+ };
74927
75110
  const tabsRoot = "_tabs-root_1e23y_10";
74928
75111
  const tabsContainer = "_tabs-container_1e23y_18";
74929
75112
  const tabs = "_tabs_1e23y_10";
@@ -75031,13 +75214,12 @@ const TabsBar = ({ currentView, setView, IDE, onDownloadChatClick }) => {
75031
75214
  {
75032
75215
  Icon: subAction.Icon,
75033
75216
  title: subAction.title,
75034
- uri: subAction.uri,
75035
75217
  IDE,
75036
75218
  alwaysShowTitle: true,
75037
75219
  tooltipExtra: subAction.tooltipExtra,
75038
75220
  onClick: () => handleSubActionClick(subAction)
75039
75221
  }
75040
- ) }, `${subAction.command}/${subAction.uri ?? ""}`)) })
75222
+ ) }, subAction.command)) })
75041
75223
  ] }) });
75042
75224
  };
75043
75225
  const ActionButtonWithConfirmation = (props) => {
@@ -75096,26 +75278,21 @@ const TabButton = forwardRef((props, ref2) => {
75096
75278
  Icon: Icon2,
75097
75279
  isActive,
75098
75280
  onClick,
75099
- uri,
75100
75281
  title: title2,
75101
75282
  alwaysShowTitle,
75102
75283
  tooltipExtra,
75103
75284
  prominent,
75104
75285
  "data-testid": dataTestId
75105
75286
  } = props;
75106
- const Component = uri ? "a" : "button";
75107
75287
  return /* @__PURE__ */ jsxs(Tooltip, { children: [
75108
75288
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
75109
- Component,
75289
+ "button",
75110
75290
  {
75111
- type: uri ? void 0 : "button",
75112
- onClick: uri ? void 0 : onClick,
75113
- href: uri,
75114
- target: "_blank",
75115
- rel: "noopener noreferrer",
75291
+ type: "button",
75292
+ onClick,
75116
75293
  ref: ref2,
75117
75294
  className: clsx$1(
75118
- "tw-flex tw-gap-3 tw-items-center tw-leading-none tw-py-3 tw-px-2 !tw-font-normal !tw-text-inherit tw-opacity-80 hover:tw-opacity-100 tw-border-b-[1px] tw-border-transparent tw-transition tw-translate-y-[1px]",
75295
+ "tw-flex tw-gap-3 tw-items-center tw-leading-none tw-py-3 tw-px-2 tw-opacity-80 hover:tw-opacity-100 tw-border-b-[1px] tw-border-transparent tw-transition tw-translate-y-[1px]",
75119
75296
  {
75120
75297
  "!tw-opacity-100 !tw-border-[var(--vscode-tab-activeBorderTop)]": isActive,
75121
75298
  "!tw-opacity-100": prominent
@@ -75139,7 +75316,7 @@ TabButton.displayName = "TabButton";
75139
75316
  function useTabs(input) {
75140
75317
  const { IDE, onDownloadChatClick } = input;
75141
75318
  const {
75142
- config: { multipleWebviewsEnabled, serverEndpoint }
75319
+ config: { multipleWebviewsEnabled }
75143
75320
  } = useConfig();
75144
75321
  return useMemo(
75145
75322
  () => [
@@ -75184,21 +75361,7 @@ function useTabs(input) {
75184
75361
  view: View.Prompts,
75185
75362
  title: IDE === CodyIDE.Web ? "Prompts" : "Prompts & Commands",
75186
75363
  Icon: BookText,
75187
- changesView: true,
75188
- subActions: [
75189
- {
75190
- title: "Create prompt",
75191
- Icon: CirclePlus,
75192
- command: "",
75193
- uri: `${serverEndpoint}prompts/new`
75194
- },
75195
- {
75196
- title: "Open prompts library",
75197
- Icon: ExternalLink,
75198
- command: "",
75199
- uri: `${serverEndpoint}prompts`
75200
- }
75201
- ]
75364
+ changesView: true
75202
75365
  },
75203
75366
  multipleWebviewsEnabled ? {
75204
75367
  view: View.Settings,
@@ -75214,195 +75377,9 @@ function useTabs(input) {
75214
75377
  changesView: IDE !== CodyIDE.VSCode
75215
75378
  } : null
75216
75379
  ].filter(isDefined),
75217
- [IDE, onDownloadChatClick, multipleWebviewsEnabled, serverEndpoint]
75380
+ [IDE, onDownloadChatClick, multipleWebviewsEnabled]
75218
75381
  );
75219
75382
  }
75220
- const Chat = ({
75221
- IDE,
75222
- messageInProgress,
75223
- transcript,
75224
- vscodeAPI,
75225
- isTranscriptError,
75226
- chatEnabled = true,
75227
- guardrails,
75228
- scrollableParent,
75229
- showWelcomeMessage = true,
75230
- showIDESnippetActions = true,
75231
- setView,
75232
- smartApplyEnabled
75233
- }) => {
75234
- const telemetryRecorder = useTelemetryRecorder();
75235
- const transcriptRef = useRef(transcript);
75236
- transcriptRef.current = transcript;
75237
- const userInfo = useUserAccountInfo();
75238
- const feedbackButtonsOnSubmit = useCallback(
75239
- (text2) => {
75240
- var _a, _b;
75241
- let FeedbackType;
75242
- ((FeedbackType2) => {
75243
- FeedbackType2[FeedbackType2["thumbsUp"] = 1] = "thumbsUp";
75244
- FeedbackType2[FeedbackType2["thumbsDown"] = 0] = "thumbsDown";
75245
- })(FeedbackType || (FeedbackType = {}));
75246
- telemetryRecorder.recordEvent("cody.feedback", "submit", {
75247
- metadata: {
75248
- feedbackType: text2 === "thumbsUp" ? 1 : 0,
75249
- lastChatUsedEmbeddings: ((_b = (_a = transcriptRef.current.at(-1)) == null ? void 0 : _a.contextFiles) == null ? void 0 : _b.some((file) => file.source === "embeddings")) ? 1 : 0,
75250
- recordsPrivateMetadataTranscript: userInfo.isDotComUser ? 1 : 0
75251
- },
75252
- privateMetadata: {
75253
- FeedbackText: text2,
75254
- // 🚨 SECURITY: chat transcripts are to be included only for DotCom users AND for V2 telemetry
75255
- // V2 telemetry exports privateMetadata only for DotCom users
75256
- // the condition below is an aditional safegaurd measure
75257
- responseText: userInfo.isDotComUser ? truncateTextStart(transcriptRef.current.toString(), CHAT_INPUT_TOKEN_BUDGET) : ""
75258
- }
75259
- });
75260
- },
75261
- [userInfo, telemetryRecorder]
75262
- );
75263
- const copyButtonOnSubmit = useCallback(
75264
- (text2, eventType = "Button") => {
75265
- const op = "copy";
75266
- const code2 = eventType === "Button" ? text2.replace(/\n$/, "") : text2;
75267
- vscodeAPI.postMessage({
75268
- command: op,
75269
- eventType,
75270
- text: code2
75271
- });
75272
- },
75273
- [vscodeAPI]
75274
- );
75275
- const insertButtonOnSubmit = useMemo(() => {
75276
- if (showIDESnippetActions) {
75277
- return (text2, newFile = false) => {
75278
- const op = newFile ? "newFile" : "insert";
75279
- vscodeAPI.postMessage({
75280
- command: op,
75281
- // remove the additional /n added by the text area at the end of the text
75282
- text: text2.replace(/\n$/, "")
75283
- });
75284
- };
75285
- }
75286
- return;
75287
- }, [vscodeAPI, showIDESnippetActions]);
75288
- const smartApply = useMemo(() => {
75289
- if (!showIDESnippetActions) {
75290
- return;
75291
- }
75292
- return {
75293
- onSubmit: (id2, text2, instruction, fileName) => {
75294
- vscodeAPI.postMessage({
75295
- command: "smartApplySubmit",
75296
- id: id2,
75297
- instruction: instruction == null ? void 0 : instruction.toString(),
75298
- // remove the additional /n added by the text area at the end of the text
75299
- code: text2.replace(/\n$/, ""),
75300
- fileName
75301
- });
75302
- },
75303
- onAccept: (id2) => {
75304
- vscodeAPI.postMessage({
75305
- command: "smartApplyAccept",
75306
- id: id2
75307
- });
75308
- },
75309
- onReject: (id2) => {
75310
- vscodeAPI.postMessage({
75311
- command: "smartApplyReject",
75312
- id: id2
75313
- });
75314
- }
75315
- };
75316
- }, [vscodeAPI, showIDESnippetActions]);
75317
- const postMessage = useCallback((msg) => vscodeAPI.postMessage(msg), [vscodeAPI]);
75318
- useEffect(() => {
75319
- function handleKeyDown(event) {
75320
- if (event.key === "Escape" && messageInProgress) {
75321
- vscodeAPI.postMessage({ command: "abort" });
75322
- }
75323
- if (event.metaKey && event.key === "o") {
75324
- event.preventDefault();
75325
- event.stopPropagation();
75326
- }
75327
- }
75328
- window.addEventListener("keydown", handleKeyDown);
75329
- return () => {
75330
- window.removeEventListener("keydown", handleKeyDown);
75331
- };
75332
- }, [vscodeAPI, messageInProgress]);
75333
- useEffect(() => {
75334
- const onFocus = () => {
75335
- const sel = window.getSelection();
75336
- const focusNode = sel == null ? void 0 : sel.focusNode;
75337
- const focusElement = focusNode instanceof Element ? focusNode : focusNode == null ? void 0 : focusNode.parentElement;
75338
- const focusEditor = focusElement == null ? void 0 : focusElement.closest('[data-lexical-editor="true"]');
75339
- if (focusEditor) {
75340
- focusEditor.focus({ preventScroll: true });
75341
- }
75342
- };
75343
- window.addEventListener("focus", onFocus);
75344
- return () => {
75345
- window.removeEventListener("focus", onFocus);
75346
- };
75347
- }, []);
75348
- const dispatchClientAction = useClientActionDispatcher();
75349
- const handleScrollDownClick = useCallback(() => {
75350
- if (transcript.length === 0) {
75351
- return;
75352
- }
75353
- focusLastHumanMessageEditor();
75354
- }, [transcript]);
75355
- return /* @__PURE__ */ jsxs(Fragment, { children: [
75356
- !chatEnabled && /* @__PURE__ */ jsx("div", { className: styles$3.chatDisabled, children: "Cody chat is disabled by your Sourcegraph site administrator" }),
75357
- /* @__PURE__ */ jsx(
75358
- Transcript,
75359
- {
75360
- transcript,
75361
- messageInProgress,
75362
- feedbackButtonsOnSubmit,
75363
- copyButtonOnSubmit,
75364
- insertButtonOnSubmit,
75365
- smartApply,
75366
- isTranscriptError,
75367
- userInfo,
75368
- chatEnabled,
75369
- postMessage,
75370
- guardrails,
75371
- smartApplyEnabled
75372
- }
75373
- ),
75374
- transcript.length === 0 && /* @__PURE__ */ jsx(
75375
- PromptList,
75376
- {
75377
- telemetryLocation: "ChatTab",
75378
- showSearch: false,
75379
- showSwitchToPromptAction: true,
75380
- showInitialSelectedItem: false,
75381
- showCommandOrigins: true,
75382
- showPromptLibraryUnsupportedMessage: false,
75383
- className: "tw-rounded-none tw-px-4 tw-flex-shrink-0",
75384
- onSelectActionLabels: onPromptSelectInPanelActionLabels,
75385
- onSwitchToPromptsTab: () => setView(View.Prompts),
75386
- onSelect: (item2) => onPromptSelectInPanel(item2, setView, dispatchClientAction)
75387
- }
75388
- ),
75389
- transcript.length === 0 && showWelcomeMessage && /* @__PURE__ */ jsx(WelcomeMessage, { IDE: userInfo.ide, setView }),
75390
- scrollableParent && /* @__PURE__ */ jsx(ScrollDown, { scrollableParent, onClick: handleScrollDownClick })
75391
- ] });
75392
- };
75393
- const TabRoot = React__default.forwardRef(({ className, ...props }, ref2) => {
75394
- return /* @__PURE__ */ jsx(Root2, { ref: ref2, ...props, orientation: "vertical", className });
75395
- });
75396
- const TabContainer = React__default.forwardRef(({ className, ...props }, ref2) => {
75397
- return /* @__PURE__ */ jsx(
75398
- Content,
75399
- {
75400
- ref: ref2,
75401
- ...props,
75402
- className: "tw-h-full tw-flex tw-flex-col tw-overflow-auto tw-gap-4"
75403
- }
75404
- );
75405
- });
75406
75383
  const CodyPanel = ({
75407
75384
  view,
75408
75385
  setView,
@@ -75453,7 +75430,6 @@ const CodyPanel = ({
75453
75430
  view === View.Chat && /* @__PURE__ */ jsx(
75454
75431
  Chat,
75455
75432
  {
75456
- IDE: config.agentIDE || CodyIDE.VSCode,
75457
75433
  chatEnabled,
75458
75434
  messageInProgress,
75459
75435
  transcript,
@@ -75477,7 +75453,7 @@ const CodyPanel = ({
75477
75453
  userHistory
75478
75454
  }
75479
75455
  ),
75480
- view === View.Prompts && /* @__PURE__ */ jsx(PromptsTab, { setView, IDE: config.agentIDE || CodyIDE.VSCode }),
75456
+ view === View.Prompts && /* @__PURE__ */ jsx(PromptsTab, { setView }),
75481
75457
  view === View.Account && /* @__PURE__ */ jsx(AccountTab, {}),
75482
75458
  view === View.Settings && /* @__PURE__ */ jsx(SettingsTab, {})
75483
75459
  ] })