@sourcegraph/cody-web 0.7.4 → 0.7.6
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/{agent.worker-CiIPD-tv.mjs → agent.worker-cEJ-Id1V.mjs} +953 -855
- package/dist/agent.worker.js +2 -2
- package/dist/{browser-BTzYzFoB.mjs → browser-5V4RMNo3.mjs} +17200 -17208
- package/dist/{git-log-CKjP84c8.mjs → git-log-DUAthDkb.mjs} +2 -2
- package/dist/{index-D6VgQlqI.mjs → index-2bvntcGe.mjs} +2 -2
- package/dist/index.js +1163 -1072
- package/dist/lib/components/CodyWebChat.d.ts.map +1 -1
- package/dist/{shell-CvNNoU2J.mjs → shell-w-Sycwnw.mjs} +2 -2
- package/dist/style.css +97 -106
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
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
|
|
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";
|
|
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,6 +7844,31 @@ 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
|
+
]);
|
|
7847
7872
|
/**
|
|
7848
7873
|
* @license lucide-react v0.378.0 - ISC
|
|
7849
7874
|
*
|
|
@@ -7908,6 +7933,17 @@ const ChevronsUpDown = createLucideIcon("ChevronsUpDown", [
|
|
|
7908
7933
|
["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
|
|
7909
7934
|
["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
|
|
7910
7935
|
]);
|
|
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
|
+
]);
|
|
7911
7947
|
/**
|
|
7912
7948
|
* @license lucide-react v0.378.0 - ISC
|
|
7913
7949
|
*
|
|
@@ -7929,6 +7965,20 @@ const Columns2 = createLucideIcon("Columns2", [
|
|
|
7929
7965
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
|
|
7930
7966
|
["path", { d: "M12 3v18", key: "108xh3" }]
|
|
7931
7967
|
]);
|
|
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
|
+
]);
|
|
7932
7982
|
/**
|
|
7933
7983
|
* @license lucide-react v0.378.0 - ISC
|
|
7934
7984
|
*
|
|
@@ -7984,6 +8034,17 @@ const ExternalLink = createLucideIcon("ExternalLink", [
|
|
|
7984
8034
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
7985
8035
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
7986
8036
|
]);
|
|
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
|
+
]);
|
|
7987
8048
|
/**
|
|
7988
8049
|
* @license lucide-react v0.378.0 - ISC
|
|
7989
8050
|
*
|
|
@@ -8012,6 +8073,23 @@ const FolderGit = createLucideIcon("FolderGit", [
|
|
|
8012
8073
|
["path", { d: "M14 13h3", key: "1dgedf" }],
|
|
8013
8074
|
["path", { d: "M7 13h3", key: "1pygq7" }]
|
|
8014
8075
|
]);
|
|
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
|
+
]);
|
|
8015
8093
|
/**
|
|
8016
8094
|
* @license lucide-react v0.378.0 - ISC
|
|
8017
8095
|
*
|
|
@@ -8050,6 +8128,17 @@ const Link$1 = createLucideIcon("Link", [
|
|
|
8050
8128
|
["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" }],
|
|
8051
8129
|
["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" }]
|
|
8052
8130
|
]);
|
|
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
|
+
]);
|
|
8053
8142
|
/**
|
|
8054
8143
|
* @license lucide-react v0.378.0 - ISC
|
|
8055
8144
|
*
|
|
@@ -8098,9 +8187,18 @@ const Option$2 = createLucideIcon("Option", [
|
|
|
8098
8187
|
* This source code is licensed under the ISC license.
|
|
8099
8188
|
* See the LICENSE file in the root directory of this source tree.
|
|
8100
8189
|
*/
|
|
8101
|
-
const
|
|
8102
|
-
["path", { d: "
|
|
8103
|
-
["path", { d: "
|
|
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" }]
|
|
8104
8202
|
]);
|
|
8105
8203
|
/**
|
|
8106
8204
|
* @license lucide-react v0.378.0 - ISC
|
|
@@ -8118,6 +8216,22 @@ const Settings = createLucideIcon("Settings", [
|
|
|
8118
8216
|
],
|
|
8119
8217
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
8120
8218
|
]);
|
|
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
|
+
]);
|
|
8121
8235
|
/**
|
|
8122
8236
|
* @license lucide-react v0.378.0 - ISC
|
|
8123
8237
|
*
|
|
@@ -8373,7 +8487,7 @@ const useIsFocused = () => {
|
|
|
8373
8487
|
}, [editor2]);
|
|
8374
8488
|
return hasFocus;
|
|
8375
8489
|
};
|
|
8376
|
-
const MentionComponent = ({ nodeKey, node: node2, tooltip
|
|
8490
|
+
const MentionComponent = ({ nodeKey, node: node2, tooltip, icon: Icon2, className, focusedClassName, iconClassName }) => {
|
|
8377
8491
|
const { tooltipComponents, onContextItemMentionNodeMetaClick } = getGlobalPromptEditorConfig();
|
|
8378
8492
|
const [editor2] = u$5();
|
|
8379
8493
|
const isEditorFocused = useIsFocused();
|
|
@@ -8515,7 +8629,7 @@ const MentionComponent = ({ nodeKey, node: node2, tooltip: tooltip2, icon: Icon2
|
|
|
8515
8629
|
unregister();
|
|
8516
8630
|
};
|
|
8517
8631
|
}, [editor2, onArrowLeftPress, onArrowRightPress, onClick, onDelete, onBlur, onSelectionChange]);
|
|
8518
|
-
const content2 = /* @__PURE__ */ jsxs("span", { ref: ref2, className: composedClassNames, title: tooltipComponents ? void 0 :
|
|
8632
|
+
const content2 = /* @__PURE__ */ jsxs("span", { ref: ref2, className: composedClassNames, title: tooltipComponents ? void 0 : tooltip, children: [
|
|
8519
8633
|
Icon2 && /* @__PURE__ */ jsx(Icon2, { size: 14, strokeWidth: 2, className: clsx$1(iconClassName, "tw-shrink-0") }),
|
|
8520
8634
|
/* @__PURE__ */ jsx("span", { children: text2 })
|
|
8521
8635
|
] });
|
|
@@ -8525,7 +8639,7 @@ const MentionComponent = ({ nodeKey, node: node2, tooltip: tooltip2, icon: Icon2
|
|
|
8525
8639
|
const { Tooltip: Tooltip2, TooltipContent: TooltipContent2, TooltipTrigger: TooltipTrigger2 } = tooltipComponents;
|
|
8526
8640
|
return /* @__PURE__ */ jsxs(Tooltip2, { children: [
|
|
8527
8641
|
/* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: content2 }),
|
|
8528
|
-
|
|
8642
|
+
tooltip && /* @__PURE__ */ jsx(TooltipContent2, { children: tooltip })
|
|
8529
8643
|
] });
|
|
8530
8644
|
};
|
|
8531
8645
|
const MENTION_CLASS_NAME = styles$k.contextItemMentionNode;
|
|
@@ -8709,16 +8823,16 @@ const TemplateInputComponent = ({ editor: editor2, nodeKey, node: node2, classNa
|
|
|
8709
8823
|
editor2.registerCommand(_$2, onKeyDown, Ns)
|
|
8710
8824
|
);
|
|
8711
8825
|
}, [editor2, onClick, onKeyDown]);
|
|
8712
|
-
const
|
|
8826
|
+
const tooltip = "replaces template placeholder on keypress";
|
|
8713
8827
|
const text2 = node2.templateInput.placeholder;
|
|
8714
|
-
const content2 = /* @__PURE__ */ jsx("span", { ref: ref2, className: composedClassNames, title: tooltipComponents ? void 0 :
|
|
8828
|
+
const content2 = /* @__PURE__ */ jsx("span", { ref: ref2, className: composedClassNames, title: tooltipComponents ? void 0 : tooltip, children: /* @__PURE__ */ jsx("span", { children: text2 }) });
|
|
8715
8829
|
if (!tooltipComponents) {
|
|
8716
8830
|
return content2;
|
|
8717
8831
|
}
|
|
8718
8832
|
const { Tooltip: Tooltip2, TooltipContent: TooltipContent2, TooltipTrigger: TooltipTrigger2 } = tooltipComponents;
|
|
8719
8833
|
return /* @__PURE__ */ jsxs(Tooltip2, { children: [
|
|
8720
8834
|
/* @__PURE__ */ jsx(TooltipTrigger2, { asChild: true, children: content2 }),
|
|
8721
|
-
/* @__PURE__ */ jsx(TooltipContent2, { children:
|
|
8835
|
+
/* @__PURE__ */ jsx(TooltipContent2, { children: tooltip })
|
|
8722
8836
|
] });
|
|
8723
8837
|
};
|
|
8724
8838
|
const templateInputNode = "_template-input-node_14yoh_1";
|
|
@@ -9029,6 +9143,14 @@ const MentionMenu = ({
|
|
|
9029
9143
|
window.addEventListener("keydown", listener, { capture: true });
|
|
9030
9144
|
return () => window.removeEventListener("keydown", listener, { capture: true });
|
|
9031
9145
|
}, []);
|
|
9146
|
+
useEffect(() => {
|
|
9147
|
+
const listener = (e2) => {
|
|
9148
|
+
e2.preventDefault();
|
|
9149
|
+
e2.stopPropagation();
|
|
9150
|
+
};
|
|
9151
|
+
window.addEventListener("mousedown", listener, { capture: true });
|
|
9152
|
+
return () => window.removeEventListener("mousedown", listener, { capture: true });
|
|
9153
|
+
}, []);
|
|
9032
9154
|
const onProviderSelect = useCallback(
|
|
9033
9155
|
(value2) => {
|
|
9034
9156
|
const provider = data.providers.find((p2) => commandRowValue$1(p2) === value2);
|
|
@@ -9216,21 +9338,17 @@ function useClientState() {
|
|
|
9216
9338
|
const ChatMentionContext = createContext({
|
|
9217
9339
|
resolutionMode: "local"
|
|
9218
9340
|
});
|
|
9219
|
-
const context
|
|
9341
|
+
const context = createContext(void 0);
|
|
9220
9342
|
const ExtensionAPIProviderFromVSCodeAPI = ({ vscodeAPI, children: children2 }) => {
|
|
9221
|
-
const extensionAPI = useMemo(
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
prompts: proxyExtensionAPI(messageAPI, "prompts")
|
|
9227
|
-
};
|
|
9228
|
-
}, [vscodeAPI]);
|
|
9229
|
-
return /* @__PURE__ */ jsx(context$1.Provider, { value: extensionAPI, children: children2 });
|
|
9343
|
+
const extensionAPI = useMemo(
|
|
9344
|
+
() => createExtensionAPI(createMessageAPIForWebview(vscodeAPI)),
|
|
9345
|
+
[vscodeAPI]
|
|
9346
|
+
);
|
|
9347
|
+
return /* @__PURE__ */ jsx(context.Provider, { value: extensionAPI, children: children2 });
|
|
9230
9348
|
};
|
|
9231
|
-
context
|
|
9349
|
+
context.Provider;
|
|
9232
9350
|
function useExtensionAPI() {
|
|
9233
|
-
const extensionAPI = useContext(context
|
|
9351
|
+
const extensionAPI = useContext(context);
|
|
9234
9352
|
if (!extensionAPI) {
|
|
9235
9353
|
throw new Error(
|
|
9236
9354
|
"useExtensionAPI must be used within an ExtensionAPIProviderFromVSCodeAPI or ExtensionAPIProviderForTestsOnly component"
|
|
@@ -9374,7 +9492,7 @@ function useCallMentionMenuData({
|
|
|
9374
9492
|
const mentionQuery = useMemo(
|
|
9375
9493
|
() => ({
|
|
9376
9494
|
...parseMentionQuery(query ?? "", provider),
|
|
9377
|
-
|
|
9495
|
+
contextRemoteRepositoriesNames: mentionSettings.remoteRepositoriesNames
|
|
9378
9496
|
}),
|
|
9379
9497
|
[query, provider, mentionSettings]
|
|
9380
9498
|
);
|
|
@@ -12838,6 +12956,19 @@ const $a093c7e1ec25a057$var$PORTAL_NAME = "TooltipPortal";
|
|
|
12838
12956
|
const [$a093c7e1ec25a057$var$PortalProvider, $a093c7e1ec25a057$var$usePortalContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, {
|
|
12839
12957
|
forceMount: void 0
|
|
12840
12958
|
});
|
|
12959
|
+
const $a093c7e1ec25a057$export$7b36b8f925ab7497 = (props) => {
|
|
12960
|
+
const { __scopeTooltip, forceMount, children: children2, container: container2 } = props;
|
|
12961
|
+
const context2 = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, __scopeTooltip);
|
|
12962
|
+
return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$PortalProvider, {
|
|
12963
|
+
scope: __scopeTooltip,
|
|
12964
|
+
forceMount
|
|
12965
|
+
}, /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
|
|
12966
|
+
present: forceMount || context2.open
|
|
12967
|
+
}, /* @__PURE__ */ createElement($f1701beae083dbae$export$602eac185826482c, {
|
|
12968
|
+
asChild: true,
|
|
12969
|
+
container: container2
|
|
12970
|
+
}, children2)));
|
|
12971
|
+
};
|
|
12841
12972
|
const $a093c7e1ec25a057$var$CONTENT_NAME = "TooltipContent";
|
|
12842
12973
|
const $a093c7e1ec25a057$export$e9003e2be37ec060 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
12843
12974
|
const portalContext = $a093c7e1ec25a057$var$usePortalContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
|
|
@@ -13135,6 +13266,7 @@ function $a093c7e1ec25a057$var$getHullPresorted(points) {
|
|
|
13135
13266
|
const $a093c7e1ec25a057$export$2881499e37b75b9a = $a093c7e1ec25a057$export$f78649fb9ca566b8;
|
|
13136
13267
|
const $a093c7e1ec25a057$export$be92b6f5f03c0fe9 = $a093c7e1ec25a057$export$28c660c63b792dea;
|
|
13137
13268
|
const $a093c7e1ec25a057$export$41fb9f06171c75f4 = $a093c7e1ec25a057$export$8c610744efcf8a1d;
|
|
13269
|
+
const $a093c7e1ec25a057$export$602eac185826482c = $a093c7e1ec25a057$export$7b36b8f925ab7497;
|
|
13138
13270
|
const $a093c7e1ec25a057$export$7c6e2c02157bb7d2 = $a093c7e1ec25a057$export$e9003e2be37ec060;
|
|
13139
13271
|
const CLASS_PART_SEPARATOR = "-";
|
|
13140
13272
|
function createClassUtils(config) {
|
|
@@ -15623,19 +15755,22 @@ function cn(...inputs) {
|
|
|
15623
15755
|
const TooltipProvider = $a093c7e1ec25a057$export$2881499e37b75b9a;
|
|
15624
15756
|
const Tooltip = $a093c7e1ec25a057$export$be92b6f5f03c0fe9;
|
|
15625
15757
|
const TooltipTrigger = $a093c7e1ec25a057$export$41fb9f06171c75f4;
|
|
15626
|
-
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref2) =>
|
|
15627
|
-
$a093c7e1ec25a057$export$
|
|
15628
|
-
{
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
className
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15758
|
+
const TooltipContent = React.forwardRef(({ portal, className, sideOffset = 4, ...props }, ref2) => {
|
|
15759
|
+
const Portal = portal ? $a093c7e1ec25a057$export$602eac185826482c : React.Fragment;
|
|
15760
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
|
|
15761
|
+
$a093c7e1ec25a057$export$7c6e2c02157bb7d2,
|
|
15762
|
+
{
|
|
15763
|
+
ref: ref2,
|
|
15764
|
+
sideOffset,
|
|
15765
|
+
className: cn(
|
|
15766
|
+
"tw-z-50 tw-overflow-hidden tw-flex tw-items-center tw-rounded-md tw-border tw-border-border tw-leading-tight tw-bg-popover tw-px-3 tw-py-2 tw-text-sm tw-text-popover-foreground tw-max-w-72 tw-text-center tw-whitespace-pre-line tw-shadow-lg [&_kbd]:tw-ml-3 [&_kbd]:-tw-mr-1 [&_kbd]:tw-mt-[-4px] [&_kbd]:tw-mb-[-4px]",
|
|
15767
|
+
className
|
|
15768
|
+
),
|
|
15769
|
+
...props,
|
|
15770
|
+
children: props.children
|
|
15771
|
+
}
|
|
15772
|
+
) });
|
|
15773
|
+
});
|
|
15639
15774
|
TooltipContent.displayName = $a093c7e1ec25a057$export$7c6e2c02157bb7d2.displayName;
|
|
15640
15775
|
var U = 1, Y$1 = 0.9, H = 0.8, J = 0.17, p$1 = 0.1, u = 0.999, $ = 0.9999;
|
|
15641
15776
|
var k$1 = 0.99, m = /[\\\/_+.#"@\[\(\{&]/, B = /[\\\/_+.#"@\[\(\{&]/g, K = /[\s-]/, X$1 = /[\s-]/g;
|
|
@@ -17211,18 +17346,25 @@ const Command = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__
|
|
|
17211
17346
|
}
|
|
17212
17347
|
));
|
|
17213
17348
|
Command.displayName = He.displayName;
|
|
17214
|
-
const CommandInput = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsx(
|
|
17215
|
-
|
|
17349
|
+
const CommandInput = React.forwardRef(({ wrapperClassName, className, ...props }, ref2) => /* @__PURE__ */ jsx(
|
|
17350
|
+
"div",
|
|
17216
17351
|
{
|
|
17217
|
-
|
|
17218
|
-
|
|
17219
|
-
|
|
17220
|
-
|
|
17221
|
-
|
|
17222
|
-
|
|
17223
|
-
|
|
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
|
+
)
|
|
17224
17366
|
}
|
|
17225
|
-
)
|
|
17367
|
+
));
|
|
17226
17368
|
CommandInput.displayName = He.Input.displayName;
|
|
17227
17369
|
const CommandList = React.forwardRef(({ className, ...props }, ref2) => /* @__PURE__ */ jsx(
|
|
17228
17370
|
He.List,
|
|
@@ -17271,22 +17413,32 @@ const CommandSeparator = React.forwardRef(({ className, ...props }, ref2) => /*
|
|
|
17271
17413
|
}
|
|
17272
17414
|
));
|
|
17273
17415
|
CommandSeparator.displayName = He.Separator.displayName;
|
|
17274
|
-
const CommandItem = React.forwardRef(({ className, tooltip
|
|
17416
|
+
const CommandItem = React.forwardRef(({ className, tooltip, ...props }, ref2) => {
|
|
17275
17417
|
const item2 = /* @__PURE__ */ jsx(
|
|
17276
17418
|
He.Item,
|
|
17277
17419
|
{
|
|
17278
17420
|
ref: ref2,
|
|
17279
17421
|
className: cn(
|
|
17280
|
-
"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",
|
|
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",
|
|
17281
17423
|
className
|
|
17282
17424
|
),
|
|
17283
|
-
title:
|
|
17425
|
+
title: tooltip,
|
|
17284
17426
|
...props
|
|
17285
17427
|
}
|
|
17286
17428
|
);
|
|
17287
17429
|
return item2;
|
|
17288
17430
|
});
|
|
17289
17431
|
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
|
+
);
|
|
17290
17442
|
const CommandLink = ({ href, className, children: children2, onSelect, ...props }) => {
|
|
17291
17443
|
const linkRef = React.useRef(null);
|
|
17292
17444
|
const isHandlingClick = React.useRef(false);
|
|
@@ -29745,11 +29897,16 @@ function useConfig() {
|
|
|
29745
29897
|
}
|
|
29746
29898
|
function useUserAccountInfo() {
|
|
29747
29899
|
const value = useConfig();
|
|
29900
|
+
if (!value.authStatus.authenticated) {
|
|
29901
|
+
throw new Error(
|
|
29902
|
+
"useUserAccountInfo must be used within a ConfigProvider with authenticated user"
|
|
29903
|
+
);
|
|
29904
|
+
}
|
|
29748
29905
|
return {
|
|
29749
29906
|
isCodyProUser: isCodyProUser(value.authStatus),
|
|
29750
29907
|
// Receive this value from the extension backend to make it work
|
|
29751
29908
|
// with E2E tests where change the DOTCOM_URL via the env variable TESTING_DOTCOM_URL.
|
|
29752
|
-
isDotComUser: value.
|
|
29909
|
+
isDotComUser: value.isDotComUser,
|
|
29753
29910
|
user: value.authStatus,
|
|
29754
29911
|
ide: value.config.agentIDE ?? CodyIDE.VSCode
|
|
29755
29912
|
};
|
|
@@ -29889,23 +30046,6 @@ const GeminiLogo = ({
|
|
|
29889
30046
|
]
|
|
29890
30047
|
}
|
|
29891
30048
|
);
|
|
29892
|
-
const context = createContext({});
|
|
29893
|
-
const ChatModelContextProvider = context.Provider;
|
|
29894
|
-
function useChatModelContext() {
|
|
29895
|
-
return useContext(context);
|
|
29896
|
-
}
|
|
29897
|
-
function useChatModelByID(model) {
|
|
29898
|
-
const { chatModels } = useChatModelContext();
|
|
29899
|
-
return (chatModels == null ? void 0 : chatModels.find((m2) => m2.id === model)) ?? (model ? {
|
|
29900
|
-
id: model,
|
|
29901
|
-
title: model,
|
|
29902
|
-
provider: "unknown"
|
|
29903
|
-
} : void 0);
|
|
29904
|
-
}
|
|
29905
|
-
function useCurrentChatModel() {
|
|
29906
|
-
const { chatModels } = useChatModelContext();
|
|
29907
|
-
return chatModels == null ? void 0 : chatModels[0];
|
|
29908
|
-
}
|
|
29909
30049
|
const path$2 = "_path_kr5rq_1";
|
|
29910
30050
|
const excluded = "_excluded_kr5rq_7";
|
|
29911
30051
|
const styles$e = {
|
|
@@ -71208,8 +71348,8 @@ class GuardrailsStatusController {
|
|
|
71208
71348
|
if (repos.length === 1) {
|
|
71209
71349
|
return `${prefix} ${repos[0]}.`;
|
|
71210
71350
|
}
|
|
71211
|
-
const
|
|
71212
|
-
return limitHit ? `${
|
|
71351
|
+
const tooltip = `${prefix} ${repos.length} repositories: ${repos.join(", ")}`;
|
|
71352
|
+
return limitHit ? `${tooltip} or more...` : `${tooltip}.`;
|
|
71213
71353
|
}
|
|
71214
71354
|
}
|
|
71215
71355
|
function createButtons(preText, copyButtonOnSubmit, insertButtonOnSubmit) {
|
|
@@ -71790,13 +71930,14 @@ const FeedbackButtons = ({
|
|
|
71790
71930
|
] })
|
|
71791
71931
|
] });
|
|
71792
71932
|
};
|
|
71793
|
-
const BaseMessageCell = ({ speakerIcon, speakerTitle, content: content2, contentClassName, footer: footer2, className }) => /* @__PURE__ */ jsxs(
|
|
71933
|
+
const BaseMessageCell = ({ speakerIcon, speakerTitle, cellAction, content: content2, contentClassName, footer: footer2, className }) => /* @__PURE__ */ jsxs(
|
|
71794
71934
|
Cell,
|
|
71795
71935
|
{
|
|
71796
71936
|
header: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71797
71937
|
speakerIcon,
|
|
71798
71938
|
" ",
|
|
71799
|
-
/* @__PURE__ */ jsx("span", { className: "tw-mt-[-1px] tw-font-semibold", children: speakerTitle })
|
|
71939
|
+
/* @__PURE__ */ jsx("span", { className: "tw-mt-[-1px] tw-font-semibold", children: speakerTitle }),
|
|
71940
|
+
/* @__PURE__ */ jsx("div", { className: "tw-ml-auto", children: cellAction })
|
|
71800
71941
|
] }),
|
|
71801
71942
|
containerClassName: className,
|
|
71802
71943
|
contentClassName,
|
|
@@ -71873,7 +72014,7 @@ const ContextFocusActions = ({ humanMessage, className }) => {
|
|
|
71873
72014
|
"aria-label": "Try again with different context",
|
|
71874
72015
|
children: /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-wrap tw-items-center tw-gap-x-4 tw-gap-y-2", children: [
|
|
71875
72016
|
/* @__PURE__ */ jsx("h3", { className: "tw-flex tw-items-center tw-gap-3", children: "Try again with different context" }),
|
|
71876
|
-
/* @__PURE__ */ jsx("ul", { className: "tw-whitespace-nowrap tw-flex tw-gap-2 tw-flex-wrap", children: actions2.map(({ label, tooltip
|
|
72017
|
+
/* @__PURE__ */ jsx("ul", { className: "tw-whitespace-nowrap tw-flex tw-gap-2 tw-flex-wrap", children: actions2.map(({ label, tooltip, onClick }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
71877
72018
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
71878
72019
|
Button3,
|
|
71879
72020
|
{
|
|
@@ -71885,7 +72026,7 @@ const ContextFocusActions = ({ humanMessage, className }) => {
|
|
|
71885
72026
|
},
|
|
71886
72027
|
label
|
|
71887
72028
|
) }),
|
|
71888
|
-
/* @__PURE__ */ jsx(TooltipContent, { children:
|
|
72029
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: tooltip })
|
|
71889
72030
|
] }) }, label)) })
|
|
71890
72031
|
] })
|
|
71891
72032
|
}
|
|
@@ -72008,6 +72149,15 @@ function makeHumanMessageInfo({ humanMessage, assistantMessage }, humanEditorRef
|
|
|
72008
72149
|
}
|
|
72009
72150
|
};
|
|
72010
72151
|
}
|
|
72152
|
+
function useChatModelByID(model) {
|
|
72153
|
+
const models = useExtensionAPI().models;
|
|
72154
|
+
const chatModels = useObservable(useMemo(() => models(), [models])).value;
|
|
72155
|
+
return (chatModels == null ? void 0 : chatModels.find((m2) => m2.id === model)) ?? (model ? {
|
|
72156
|
+
id: model,
|
|
72157
|
+
title: model,
|
|
72158
|
+
provider: "unknown"
|
|
72159
|
+
} : void 0);
|
|
72160
|
+
}
|
|
72011
72161
|
const contextItem = "_context-item_13e3r_1";
|
|
72012
72162
|
const contextItemMetadata = "_context-item-metadata_13e3r_6";
|
|
72013
72163
|
const contextItemLink = "_context-item-link_13e3r_12";
|
|
@@ -72198,8 +72348,8 @@ const ContextCell = memo(
|
|
|
72198
72348
|
},
|
|
72199
72349
|
isEqual
|
|
72200
72350
|
);
|
|
72201
|
-
const userAvatar = "_user-
|
|
72202
|
-
const sourcegraphGradientBorder = "_sourcegraph-gradient-
|
|
72351
|
+
const userAvatar = "_user-avatar_yacrp_1";
|
|
72352
|
+
const sourcegraphGradientBorder = "_sourcegraph-gradient-border_yacrp_10";
|
|
72203
72353
|
const styles$7 = {
|
|
72204
72354
|
userAvatar,
|
|
72205
72355
|
sourcegraphGradientBorder
|
|
@@ -72255,8 +72405,9 @@ const InnerUserAvatar = ({
|
|
|
72255
72405
|
"div",
|
|
72256
72406
|
{
|
|
72257
72407
|
title: title2,
|
|
72258
|
-
className: clsx$1(styles$7.userAvatar, className),
|
|
72408
|
+
className: clsx$1(styles$7.userAvatar, "tw-bg-muted tw-text-muted-foreground", className),
|
|
72259
72409
|
style: { width: `${size2}px`, height: `${size2}px` },
|
|
72410
|
+
"data-user-avatar": true,
|
|
72260
72411
|
children: /* @__PURE__ */ jsx("span", { className: styles$7.initials, children: getInitials((user == null ? void 0 : user.displayName) || (user == null ? void 0 : user.username) || "") })
|
|
72261
72412
|
}
|
|
72262
72413
|
);
|
|
@@ -72555,7 +72706,7 @@ const ToolbarButton = forwardRef(
|
|
|
72555
72706
|
className,
|
|
72556
72707
|
variant,
|
|
72557
72708
|
asChild = false,
|
|
72558
|
-
tooltip
|
|
72709
|
+
tooltip,
|
|
72559
72710
|
iconStart: IconStart,
|
|
72560
72711
|
iconEnd: IconEnd,
|
|
72561
72712
|
children: children2,
|
|
@@ -72580,9 +72731,9 @@ const ToolbarButton = forwardRef(
|
|
|
72580
72731
|
]
|
|
72581
72732
|
}
|
|
72582
72733
|
);
|
|
72583
|
-
return
|
|
72734
|
+
return tooltip ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
72584
72735
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button2 }),
|
|
72585
|
-
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children:
|
|
72736
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: tooltip })
|
|
72586
72737
|
] }) : button2;
|
|
72587
72738
|
}
|
|
72588
72739
|
);
|
|
@@ -72943,375 +73094,6 @@ const optionByGroup = (options) => {
|
|
|
72943
73094
|
}
|
|
72944
73095
|
return [...groups.entries()].sort(([a2], [b2]) => groupOrder.indexOf(a2) - groupOrder.indexOf(b2)).map(([group, options2]) => ({ group, options: options2 }));
|
|
72945
73096
|
};
|
|
72946
|
-
const useDebounce = (value, delay) => {
|
|
72947
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
72948
|
-
useEffect(() => {
|
|
72949
|
-
const handler = setTimeout(() => setDebouncedValue(value), delay);
|
|
72950
|
-
return () => clearTimeout(handler);
|
|
72951
|
-
}, [delay, value]);
|
|
72952
|
-
return debouncedValue;
|
|
72953
|
-
};
|
|
72954
|
-
function usePromptsQuery(query) {
|
|
72955
|
-
const prompts = useExtensionAPI().prompts;
|
|
72956
|
-
return useObservable(useMemo(() => prompts(query), [prompts, query]));
|
|
72957
|
-
}
|
|
72958
|
-
const PromptList = ({
|
|
72959
|
-
onSelect: parentOnSelect,
|
|
72960
|
-
onSelectActionLabels,
|
|
72961
|
-
showSearch = true,
|
|
72962
|
-
showOnlyPromptInsertableCommands,
|
|
72963
|
-
showInitialSelectedItem = true,
|
|
72964
|
-
showPromptLibraryUnsupportedMessage = true,
|
|
72965
|
-
showCommandOrigins = false,
|
|
72966
|
-
className,
|
|
72967
|
-
commandListClassName,
|
|
72968
|
-
telemetryLocation
|
|
72969
|
-
}) => {
|
|
72970
|
-
const telemetryRecorder = useTelemetryRecorder();
|
|
72971
|
-
const telemetryPublicMetadata = {
|
|
72972
|
-
[`in${telemetryLocation}`]: 1
|
|
72973
|
-
};
|
|
72974
|
-
const [query, setQuery] = useState("");
|
|
72975
|
-
const debouncedQuery = useDebounce(query, 250);
|
|
72976
|
-
const { value: result, error: error2 } = usePromptsQuery(debouncedQuery);
|
|
72977
|
-
const onSelect = useCallback(
|
|
72978
|
-
(rowValue) => {
|
|
72979
|
-
var _a, _b, _c;
|
|
72980
|
-
const prompt = (result == null ? void 0 : result.prompts.type) === "results" ? result.prompts.results.find(
|
|
72981
|
-
(p2) => commandRowValue({ type: "prompt", value: p2 }) === rowValue
|
|
72982
|
-
) : void 0;
|
|
72983
|
-
const codyCommand = prompt === void 0 ? (_a = result == null ? void 0 : result.commands) == null ? void 0 : _a.find(
|
|
72984
|
-
(c2) => commandRowValue({ type: "command", value: c2 }) === rowValue
|
|
72985
|
-
) : void 0;
|
|
72986
|
-
const entry = prompt ? { type: "prompt", value: prompt } : codyCommand ? { type: "command", value: codyCommand } : void 0;
|
|
72987
|
-
if (!entry) {
|
|
72988
|
-
return;
|
|
72989
|
-
}
|
|
72990
|
-
telemetryRecorder.recordEvent("cody.promptList", "select", {
|
|
72991
|
-
metadata: {
|
|
72992
|
-
isPrompt: prompt ? 1 : 0,
|
|
72993
|
-
isCommand: codyCommand ? 1 : 0,
|
|
72994
|
-
isCommandBuiltin: (codyCommand == null ? void 0 : codyCommand.type) === "default" ? 1 : 0,
|
|
72995
|
-
isCommandCustom: (codyCommand == null ? void 0 : codyCommand.type) !== "default" ? 1 : 0,
|
|
72996
|
-
...telemetryPublicMetadata
|
|
72997
|
-
},
|
|
72998
|
-
privateMetadata: {
|
|
72999
|
-
nameWithOwner: prompt ? prompt.nameWithOwner : void 0
|
|
73000
|
-
}
|
|
73001
|
-
});
|
|
73002
|
-
if (result) {
|
|
73003
|
-
telemetryRecorder.recordEvent("cody.promptList", "query", {
|
|
73004
|
-
metadata: {
|
|
73005
|
-
queryLength: debouncedQuery.length,
|
|
73006
|
-
resultCount: (result.prompts.type === "results" ? result.prompts.results.length : 0) + (((_b = result.commands) == null ? void 0 : _b.length) ?? 0),
|
|
73007
|
-
resultCountPromptsOnly: result.prompts.type === "results" ? result.prompts.results.length : 0,
|
|
73008
|
-
resultCountCommandsOnly: ((_c = result.commands) == null ? void 0 : _c.length) ?? 0,
|
|
73009
|
-
supportsPrompts: result.prompts.type !== "unsupported" ? 1 : 0,
|
|
73010
|
-
hasUsePromptsQueryError: error2 ? 1 : 0,
|
|
73011
|
-
hasPromptsResultError: result.prompts.type === "error" ? 1 : 0,
|
|
73012
|
-
...telemetryPublicMetadata
|
|
73013
|
-
},
|
|
73014
|
-
privateMetadata: {
|
|
73015
|
-
query: debouncedQuery,
|
|
73016
|
-
usePromptsQueryErrorMessage: error2 == null ? void 0 : error2.message,
|
|
73017
|
-
promptsResultErrorMessage: result.prompts.type === "error" ? result.prompts.error : void 0
|
|
73018
|
-
}
|
|
73019
|
-
});
|
|
73020
|
-
}
|
|
73021
|
-
parentOnSelect(entry);
|
|
73022
|
-
},
|
|
73023
|
-
[
|
|
73024
|
-
result,
|
|
73025
|
-
telemetryRecorder.recordEvent,
|
|
73026
|
-
parentOnSelect,
|
|
73027
|
-
telemetryPublicMetadata,
|
|
73028
|
-
debouncedQuery,
|
|
73029
|
-
error2
|
|
73030
|
-
]
|
|
73031
|
-
);
|
|
73032
|
-
const endpointURL = new URL(useConfig().authStatus.endpoint);
|
|
73033
|
-
const filteredCommands = showOnlyPromptInsertableCommands ? result == null ? void 0 : result.commands.filter((c2) => c2.type !== "default") : result == null ? void 0 : result.commands;
|
|
73034
|
-
return /* @__PURE__ */ jsx(
|
|
73035
|
-
Command,
|
|
73036
|
-
{
|
|
73037
|
-
loop: true,
|
|
73038
|
-
tabIndex: 0,
|
|
73039
|
-
className: clsx$1("focus:tw-outline-none", className),
|
|
73040
|
-
shouldFilter: false,
|
|
73041
|
-
defaultValue: showInitialSelectedItem ? void 0 : "xxx-no-item",
|
|
73042
|
-
children: /* @__PURE__ */ jsxs(
|
|
73043
|
-
CommandList,
|
|
73044
|
-
{
|
|
73045
|
-
className: clsx$1(
|
|
73046
|
-
"[&_[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",
|
|
73047
|
-
commandListClassName
|
|
73048
|
-
),
|
|
73049
|
-
children: [
|
|
73050
|
-
showSearch && /* @__PURE__ */ jsx(
|
|
73051
|
-
CommandInput,
|
|
73052
|
-
{
|
|
73053
|
-
value: query,
|
|
73054
|
-
onValueChange: setQuery,
|
|
73055
|
-
placeholder: "Search...",
|
|
73056
|
-
autoFocus: true
|
|
73057
|
-
}
|
|
73058
|
-
),
|
|
73059
|
-
result && result.prompts.type !== "unsupported" && /* @__PURE__ */ jsxs(
|
|
73060
|
-
CommandGroup,
|
|
73061
|
-
{
|
|
73062
|
-
heading: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73063
|
-
/* @__PURE__ */ jsx("span", { children: "Prompt Library" }),
|
|
73064
|
-
/* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
|
|
73065
|
-
/* @__PURE__ */ jsx(Button3, { variant: "ghost", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(
|
|
73066
|
-
"a",
|
|
73067
|
-
{
|
|
73068
|
-
href: new URL("/prompts", endpointURL).toString(),
|
|
73069
|
-
target: "_blank",
|
|
73070
|
-
rel: "noreferrer",
|
|
73071
|
-
className: "!tw-text-[unset]",
|
|
73072
|
-
children: "Manage"
|
|
73073
|
-
}
|
|
73074
|
-
) }),
|
|
73075
|
-
/* @__PURE__ */ jsx(
|
|
73076
|
-
Button3,
|
|
73077
|
-
{
|
|
73078
|
-
variant: "ghost",
|
|
73079
|
-
size: "sm",
|
|
73080
|
-
className: "tw-flex tw-items-center tw-gap-0.5",
|
|
73081
|
-
asChild: true,
|
|
73082
|
-
children: /* @__PURE__ */ jsxs(
|
|
73083
|
-
"a",
|
|
73084
|
-
{
|
|
73085
|
-
href: new URL("/prompts/new", endpointURL).toString(),
|
|
73086
|
-
target: "_blank",
|
|
73087
|
-
rel: "noreferrer",
|
|
73088
|
-
className: "!tw-text-[unset]",
|
|
73089
|
-
children: [
|
|
73090
|
-
/* @__PURE__ */ jsx(Plus, { size: 12, strokeWidth: 1.25 }),
|
|
73091
|
-
"New"
|
|
73092
|
-
]
|
|
73093
|
-
}
|
|
73094
|
-
)
|
|
73095
|
-
}
|
|
73096
|
-
)
|
|
73097
|
-
] }),
|
|
73098
|
-
children: [
|
|
73099
|
-
result.prompts.type === "results" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73100
|
-
result.prompts.results.length === 0 && /* @__PURE__ */ jsx(CommandLoading, { children: result.query === "" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73101
|
-
"Your Prompt Library is empty.",
|
|
73102
|
-
" ",
|
|
73103
|
-
/* @__PURE__ */ jsx(
|
|
73104
|
-
"a",
|
|
73105
|
-
{
|
|
73106
|
-
href: new URL(
|
|
73107
|
-
"/prompts/new",
|
|
73108
|
-
endpointURL
|
|
73109
|
-
).toString(),
|
|
73110
|
-
target: "_blank",
|
|
73111
|
-
rel: "noreferrer",
|
|
73112
|
-
children: "Add a prompt"
|
|
73113
|
-
}
|
|
73114
|
-
),
|
|
73115
|
-
" ",
|
|
73116
|
-
"to reuse and share it."
|
|
73117
|
-
] }) : /* @__PURE__ */ jsx(Fragment, { children: "No prompts found" }) }),
|
|
73118
|
-
result.prompts.results.map((prompt) => /* @__PURE__ */ jsx(
|
|
73119
|
-
PromptCommandItem,
|
|
73120
|
-
{
|
|
73121
|
-
prompt,
|
|
73122
|
-
onSelect,
|
|
73123
|
-
selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.prompt
|
|
73124
|
-
},
|
|
73125
|
-
prompt.id
|
|
73126
|
-
))
|
|
73127
|
-
] }) : null,
|
|
73128
|
-
result.prompts.type === "error" && /* @__PURE__ */ jsxs(CommandLoading, { children: [
|
|
73129
|
-
"Error: ",
|
|
73130
|
-
result.prompts.error
|
|
73131
|
-
] })
|
|
73132
|
-
]
|
|
73133
|
-
}
|
|
73134
|
-
),
|
|
73135
|
-
result && filteredCommands && filteredCommands.length > 0 && /* @__PURE__ */ jsx(
|
|
73136
|
-
CommandGroup,
|
|
73137
|
-
{
|
|
73138
|
-
heading: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73139
|
-
/* @__PURE__ */ jsx("span", { children: "Commands" }),
|
|
73140
|
-
/* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
|
|
73141
|
-
hasCustomCommands(filteredCommands) && /* @__PURE__ */ jsx(Button3, { variant: "ghost", size: "sm", asChild: true, children: /* @__PURE__ */ jsx(
|
|
73142
|
-
"a",
|
|
73143
|
-
{
|
|
73144
|
-
className: "!tw-text-[unset]",
|
|
73145
|
-
href: "command:cody.menu.commands-settings",
|
|
73146
|
-
children: "Manage"
|
|
73147
|
-
}
|
|
73148
|
-
) })
|
|
73149
|
-
] }),
|
|
73150
|
-
children: filteredCommands.map((command) => /* @__PURE__ */ jsx(
|
|
73151
|
-
CodyCommandItem,
|
|
73152
|
-
{
|
|
73153
|
-
command,
|
|
73154
|
-
onSelect,
|
|
73155
|
-
selectActionLabel: onSelectActionLabels == null ? void 0 : onSelectActionLabels.command,
|
|
73156
|
-
showCommandOrigins
|
|
73157
|
-
},
|
|
73158
|
-
command.key
|
|
73159
|
-
))
|
|
73160
|
-
}
|
|
73161
|
-
),
|
|
73162
|
-
showPromptLibraryUnsupportedMessage && result && result.prompts.type === "unsupported" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
73163
|
-
/* @__PURE__ */ jsx(CommandSeparator, { alwaysRender: true }),
|
|
73164
|
-
/* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
|
|
73165
|
-
"Prompt Library is not yet available on ",
|
|
73166
|
-
endpointURL.hostname,
|
|
73167
|
-
". Ask your site admin to upgrade to Sourcegraph 5.6 or later."
|
|
73168
|
-
] })
|
|
73169
|
-
] }),
|
|
73170
|
-
!result && !error2 && /* @__PURE__ */ jsx(CommandLoading, { className: "tw-px-4", children: "Loading..." }),
|
|
73171
|
-
error2 && /* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
|
|
73172
|
-
"Error: ",
|
|
73173
|
-
error2.message || "unknown"
|
|
73174
|
-
] })
|
|
73175
|
-
]
|
|
73176
|
-
}
|
|
73177
|
-
)
|
|
73178
|
-
}
|
|
73179
|
-
);
|
|
73180
|
-
};
|
|
73181
|
-
function hasCustomCommands(commands) {
|
|
73182
|
-
return commands.some(
|
|
73183
|
-
(command) => command.type === CustomCommandType.Workspace || command.type === CustomCommandType.User
|
|
73184
|
-
);
|
|
73185
|
-
}
|
|
73186
|
-
function commandRowValue(row2) {
|
|
73187
|
-
return row2.type === "prompt" ? `prompt-${row2.value.id}` : `command-${row2.value.key}`;
|
|
73188
|
-
}
|
|
73189
|
-
const PromptCommandItem = ({ prompt, onSelect, selectActionLabel }) => /* @__PURE__ */ jsxs(
|
|
73190
|
-
CommandItem,
|
|
73191
|
-
{
|
|
73192
|
-
value: commandRowValue({ type: "prompt", value: prompt }),
|
|
73193
|
-
onSelect,
|
|
73194
|
-
className: "!tw-items-start tw-group/[cmdk-item]",
|
|
73195
|
-
children: [
|
|
73196
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
73197
|
-
/* @__PURE__ */ jsxs("div", { className: "tw-flex tw-gap-3 tw-w-full tw-items-start", children: [
|
|
73198
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
73199
|
-
/* @__PURE__ */ jsxs("span", { className: "tw-text-muted-foreground", children: [
|
|
73200
|
-
prompt.owner.namespaceName,
|
|
73201
|
-
" / "
|
|
73202
|
-
] }),
|
|
73203
|
-
/* @__PURE__ */ jsx("strong", { children: prompt.name })
|
|
73204
|
-
] }),
|
|
73205
|
-
prompt.draft && /* @__PURE__ */ jsx(Badge3, { variant: "secondary", className: "tw-text-xxs tw-mt-0.5", children: "Draft" })
|
|
73206
|
-
] }),
|
|
73207
|
-
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 })
|
|
73208
|
-
] }),
|
|
73209
|
-
/* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
|
|
73210
|
-
selectActionLabel && /* @__PURE__ */ jsx(CommandItemAction, { label: selectActionLabel })
|
|
73211
|
-
]
|
|
73212
|
-
}
|
|
73213
|
-
);
|
|
73214
|
-
const CodyCommandItem = ({ command, onSelect, selectActionLabel, showCommandOrigins }) => /* @__PURE__ */ jsxs(
|
|
73215
|
-
CommandItem,
|
|
73216
|
-
{
|
|
73217
|
-
value: commandRowValue({ type: "command", value: command }),
|
|
73218
|
-
onSelect,
|
|
73219
|
-
className: "!tw-items-start tw-group/[cmdk-item]",
|
|
73220
|
-
children: [
|
|
73221
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
73222
|
-
/* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-wrap tw-gap-3 tw-w-full tw-items-start", children: [
|
|
73223
|
-
/* @__PURE__ */ jsx("strong", { className: "tw-whitespace-nowrap", children: command.type === "default" ? command.description : command.key }),
|
|
73224
|
-
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" })
|
|
73225
|
-
] }),
|
|
73226
|
-
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 })
|
|
73227
|
-
] }),
|
|
73228
|
-
/* @__PURE__ */ jsx("div", { className: "tw-flex-grow" }),
|
|
73229
|
-
selectActionLabel && /* @__PURE__ */ jsx(CommandItemAction, { label: selectActionLabel })
|
|
73230
|
-
]
|
|
73231
|
-
}
|
|
73232
|
-
);
|
|
73233
|
-
const CommandItemAction = ({
|
|
73234
|
-
label,
|
|
73235
|
-
className
|
|
73236
|
-
}) => /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
73237
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
73238
|
-
Button3,
|
|
73239
|
-
{
|
|
73240
|
-
type: "button",
|
|
73241
|
-
variant: "default",
|
|
73242
|
-
size: "xs",
|
|
73243
|
-
className: clsx$1(
|
|
73244
|
-
'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',
|
|
73245
|
-
className
|
|
73246
|
-
),
|
|
73247
|
-
children: label === "insert" ? "Insert" : "Run"
|
|
73248
|
-
}
|
|
73249
|
-
) }),
|
|
73250
|
-
/* @__PURE__ */ jsx(TooltipContent, { children: label === "insert" ? "Append prompt text to chat message" : "Run command on current selection in editor" })
|
|
73251
|
-
] });
|
|
73252
|
-
const PromptListSuitedForNonPopover = ({ className, commandListClassName, ...props }) => /* @__PURE__ */ jsx(
|
|
73253
|
-
PromptList,
|
|
73254
|
-
{
|
|
73255
|
-
...props,
|
|
73256
|
-
showSearch: false,
|
|
73257
|
-
showInitialSelectedItem: false,
|
|
73258
|
-
className: clsx$1("tw-w-full !tw-max-w-[unset] !tw-bg-[unset]", className),
|
|
73259
|
-
commandListClassName: clsx$1("!tw-max-h-[unset]", commandListClassName)
|
|
73260
|
-
}
|
|
73261
|
-
);
|
|
73262
|
-
const PromptSelectField = ({ onSelect, onCloseByEscape, className, __storybook__open }) => {
|
|
73263
|
-
const telemetryRecorder = useTelemetryRecorder();
|
|
73264
|
-
const onOpenChange = useCallback(
|
|
73265
|
-
(open) => {
|
|
73266
|
-
if (open) {
|
|
73267
|
-
telemetryRecorder.recordEvent("cody.promptSelectField", "open", {});
|
|
73268
|
-
}
|
|
73269
|
-
},
|
|
73270
|
-
[telemetryRecorder.recordEvent]
|
|
73271
|
-
);
|
|
73272
|
-
const onKeyDown = useCallback(
|
|
73273
|
-
(event) => {
|
|
73274
|
-
if (event.key === "Escape") {
|
|
73275
|
-
onCloseByEscape == null ? void 0 : onCloseByEscape();
|
|
73276
|
-
}
|
|
73277
|
-
},
|
|
73278
|
-
[onCloseByEscape]
|
|
73279
|
-
);
|
|
73280
|
-
return /* @__PURE__ */ jsx(
|
|
73281
|
-
ToolbarPopoverItem,
|
|
73282
|
-
{
|
|
73283
|
-
role: "combobox",
|
|
73284
|
-
iconEnd: "chevron",
|
|
73285
|
-
className: cn("tw-justify-between", className),
|
|
73286
|
-
__storybook__open,
|
|
73287
|
-
tooltip: "Insert prompt from Prompt Library",
|
|
73288
|
-
"aria-label": "Insert prompt",
|
|
73289
|
-
popoverContent: (close) => /* @__PURE__ */ jsx(
|
|
73290
|
-
PromptList,
|
|
73291
|
-
{
|
|
73292
|
-
onSelect: (item2) => {
|
|
73293
|
-
onSelect(item2);
|
|
73294
|
-
close();
|
|
73295
|
-
},
|
|
73296
|
-
onSelectActionLabels: { prompt: "insert", command: "insert" },
|
|
73297
|
-
showSearch: true,
|
|
73298
|
-
showOnlyPromptInsertableCommands: true,
|
|
73299
|
-
showPromptLibraryUnsupportedMessage: true,
|
|
73300
|
-
telemetryLocation: "PromptSelectField"
|
|
73301
|
-
}
|
|
73302
|
-
),
|
|
73303
|
-
popoverRootProps: { onOpenChange },
|
|
73304
|
-
popoverContentProps: {
|
|
73305
|
-
className: "tw-min-w-[325px] tw-w-[75vw] tw-max-w-[550px] !tw-p-0",
|
|
73306
|
-
onKeyDown,
|
|
73307
|
-
onCloseAutoFocus: (event) => {
|
|
73308
|
-
event.preventDefault();
|
|
73309
|
-
}
|
|
73310
|
-
},
|
|
73311
|
-
children: "Prompts"
|
|
73312
|
-
}
|
|
73313
|
-
);
|
|
73314
|
-
};
|
|
73315
73097
|
const isMac = isMacOS();
|
|
73316
73098
|
function keyTextOrSvg(key) {
|
|
73317
73099
|
const iconClassName = "tw-w-[1em] tw-h-[1em]";
|
|
@@ -73445,7 +73227,6 @@ const Toolbar = ({
|
|
|
73445
73227
|
submitState,
|
|
73446
73228
|
onGapClick,
|
|
73447
73229
|
focusEditor,
|
|
73448
|
-
appendTextToEditor,
|
|
73449
73230
|
hidden: hidden2,
|
|
73450
73231
|
className
|
|
73451
73232
|
}) => {
|
|
@@ -73483,14 +73264,6 @@ const Toolbar = ({
|
|
|
73483
73264
|
className: "tw-opacity-60 focus-visible:tw-opacity-100 hover:tw-opacity-100 tw-mr-2"
|
|
73484
73265
|
}
|
|
73485
73266
|
),
|
|
73486
|
-
/* @__PURE__ */ jsx(
|
|
73487
|
-
PromptSelectFieldToolbarItem,
|
|
73488
|
-
{
|
|
73489
|
-
focusEditor,
|
|
73490
|
-
appendTextToEditor,
|
|
73491
|
-
className: "tw-ml-1 tw-mr-1"
|
|
73492
|
-
}
|
|
73493
|
-
),
|
|
73494
73267
|
/* @__PURE__ */ jsx(
|
|
73495
73268
|
ModelSelectFieldToolbarItem,
|
|
73496
73269
|
{
|
|
@@ -73513,31 +73286,25 @@ const Toolbar = ({
|
|
|
73513
73286
|
)
|
|
73514
73287
|
);
|
|
73515
73288
|
};
|
|
73516
|
-
const PromptSelectFieldToolbarItem = ({ focusEditor, appendTextToEditor, className }) => {
|
|
73517
|
-
const onSelect = useCallback(
|
|
73518
|
-
(item2) => {
|
|
73519
|
-
appendTextToEditor(item2.type === "prompt" ? item2.value.definition.text : item2.value.prompt);
|
|
73520
|
-
focusEditor == null ? void 0 : focusEditor();
|
|
73521
|
-
},
|
|
73522
|
-
[appendTextToEditor, focusEditor]
|
|
73523
|
-
);
|
|
73524
|
-
return /* @__PURE__ */ jsx(PromptSelectField, { onSelect, onCloseByEscape: focusEditor, className });
|
|
73525
|
-
};
|
|
73526
73289
|
const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className }) => {
|
|
73527
|
-
const
|
|
73290
|
+
const config = useConfig();
|
|
73291
|
+
const api2 = useExtensionAPI();
|
|
73528
73292
|
const onModelSelect = useCallback(
|
|
73529
73293
|
(model) => {
|
|
73530
|
-
|
|
73294
|
+
api2.setChatModel(model.id).subscribe({
|
|
73295
|
+
error: (error2) => console.error("setChatModel:", error2)
|
|
73296
|
+
});
|
|
73531
73297
|
focusEditor == null ? void 0 : focusEditor();
|
|
73532
73298
|
},
|
|
73533
|
-
[
|
|
73299
|
+
[api2.setChatModel, focusEditor]
|
|
73534
73300
|
);
|
|
73535
|
-
|
|
73301
|
+
const { value: chatModels } = useObservable(useMemo(() => api2.models(), [api2.models]));
|
|
73302
|
+
return !!(chatModels == null ? void 0 : chatModels.length) && (userInfo.isDotComUser || config.configFeatures.serverSentModels) && /* @__PURE__ */ jsx(
|
|
73536
73303
|
ModelSelectField,
|
|
73537
73304
|
{
|
|
73538
73305
|
models: chatModels,
|
|
73539
73306
|
onModelSelect,
|
|
73540
|
-
serverSentModelsEnabled:
|
|
73307
|
+
serverSentModelsEnabled: config.configFeatures.serverSentModels,
|
|
73541
73308
|
userInfo,
|
|
73542
73309
|
onCloseByEscape: focusEditor,
|
|
73543
73310
|
className
|
|
@@ -73653,12 +73420,6 @@ const HumanMessageEditor = ({
|
|
|
73653
73420
|
},
|
|
73654
73421
|
[onGapClick]
|
|
73655
73422
|
);
|
|
73656
|
-
const appendTextToEditor = useCallback((text2) => {
|
|
73657
|
-
if (!editorRef.current) {
|
|
73658
|
-
throw new Error("No editorRef");
|
|
73659
|
-
}
|
|
73660
|
-
editorRef.current.appendText(text2);
|
|
73661
|
-
}, []);
|
|
73662
73423
|
const onMentionClick = useCallback(() => {
|
|
73663
73424
|
if (!editorRef.current) {
|
|
73664
73425
|
throw new Error("No editorRef");
|
|
@@ -73698,9 +73459,11 @@ const HumanMessageEditor = ({
|
|
|
73698
73459
|
if (isSent) {
|
|
73699
73460
|
return;
|
|
73700
73461
|
}
|
|
73701
|
-
|
|
73702
|
-
editorRef.current
|
|
73703
|
-
|
|
73462
|
+
requestAnimationFrame(() => {
|
|
73463
|
+
if (editorRef.current) {
|
|
73464
|
+
editorRef.current.appendText(appendTextToLastPromptEditor);
|
|
73465
|
+
}
|
|
73466
|
+
});
|
|
73704
73467
|
}
|
|
73705
73468
|
},
|
|
73706
73469
|
[isSent]
|
|
@@ -73773,7 +73536,6 @@ const HumanMessageEditor = ({
|
|
|
73773
73536
|
submitState,
|
|
73774
73537
|
onGapClick,
|
|
73775
73538
|
focusEditor,
|
|
73776
|
-
appendTextToEditor,
|
|
73777
73539
|
hidden: !focused2 && isSent,
|
|
73778
73540
|
className: styles$6.toolbar
|
|
73779
73541
|
}
|
|
@@ -73783,6 +73545,11 @@ const HumanMessageEditor = ({
|
|
|
73783
73545
|
)
|
|
73784
73546
|
);
|
|
73785
73547
|
};
|
|
73548
|
+
function useCurrentChatModel() {
|
|
73549
|
+
var _a;
|
|
73550
|
+
const models = useExtensionAPI().models;
|
|
73551
|
+
return (_a = useObservable(useMemo(() => models(), [models])).value) == null ? void 0 : _a.at(0);
|
|
73552
|
+
}
|
|
73786
73553
|
const HumanMessageCell = memo(
|
|
73787
73554
|
({
|
|
73788
73555
|
message: message2,
|
|
@@ -73818,6 +73585,7 @@ const HumanMessageCell = memo(
|
|
|
73818
73585
|
}
|
|
73819
73586
|
),
|
|
73820
73587
|
speakerTitle: userInfo.user.displayName ?? userInfo.user.username,
|
|
73588
|
+
cellAction: isFirstMessage && /* @__PURE__ */ jsx(OpenInNewEditorAction, {}),
|
|
73821
73589
|
content: /* @__PURE__ */ jsx(
|
|
73822
73590
|
HumanMessageEditor,
|
|
73823
73591
|
{
|
|
@@ -73844,6 +73612,31 @@ const HumanMessageCell = memo(
|
|
|
73844
73612
|
},
|
|
73845
73613
|
isEqual
|
|
73846
73614
|
);
|
|
73615
|
+
const OpenInNewEditorAction = () => {
|
|
73616
|
+
const {
|
|
73617
|
+
config: { multipleWebviewsEnabled }
|
|
73618
|
+
} = useConfig();
|
|
73619
|
+
if (!multipleWebviewsEnabled) {
|
|
73620
|
+
return null;
|
|
73621
|
+
}
|
|
73622
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
73623
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
73624
|
+
"button",
|
|
73625
|
+
{
|
|
73626
|
+
type: "button",
|
|
73627
|
+
onClick: () => {
|
|
73628
|
+
getVSCodeAPI().postMessage({
|
|
73629
|
+
command: "command",
|
|
73630
|
+
id: "cody.chat.moveToEditor"
|
|
73631
|
+
});
|
|
73632
|
+
},
|
|
73633
|
+
className: "tw-flex tw-gap-3 tw-items-center tw-leading-none tw-opacity-80 hover:tw-opacity-100 tw-border-b-[1px] tw-border-transparent tw-transition tw-translate-y-[1px]",
|
|
73634
|
+
children: /* @__PURE__ */ jsx(Columns2, { size: 16, strokeWidth: 1.25, className: "tw-w-8 tw-h-8" })
|
|
73635
|
+
}
|
|
73636
|
+
) }),
|
|
73637
|
+
/* @__PURE__ */ jsx(TooltipContent, { children: "Open in Editor" })
|
|
73638
|
+
] });
|
|
73639
|
+
};
|
|
73847
73640
|
const Transcript = (props) => {
|
|
73848
73641
|
const {
|
|
73849
73642
|
chatEnabled,
|
|
@@ -74117,18 +73910,399 @@ function useCollapsiblePanelOpenState(storageKey, initialOpen = false) {
|
|
|
74117
73910
|
}
|
|
74118
73911
|
];
|
|
74119
73912
|
}
|
|
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
|
+
];
|
|
74120
74293
|
const PromptsTab = ({ setView }) => {
|
|
74121
74294
|
const dispatchClientAction = useClientActionDispatcher();
|
|
74122
74295
|
return /* @__PURE__ */ jsx("div", { className: "tw-overflow-auto tw-p-8", children: /* @__PURE__ */ jsx(
|
|
74123
|
-
|
|
74296
|
+
PromptList,
|
|
74124
74297
|
{
|
|
74125
74298
|
onSelect: (item2) => onPromptSelectInPanel(item2, setView, dispatchClientAction),
|
|
74126
74299
|
onSelectActionLabels: onPromptSelectInPanelActionLabels,
|
|
74127
74300
|
showCommandOrigins: true,
|
|
74301
|
+
showSearch: true,
|
|
74302
|
+
showInitialSelectedItem: false,
|
|
74303
|
+
showSwitchToPromptAction: false,
|
|
74128
74304
|
showPromptLibraryUnsupportedMessage: true,
|
|
74129
|
-
|
|
74130
|
-
telemetryLocation: "PromptsTab",
|
|
74131
|
-
className: "tw-border tw-border-border"
|
|
74305
|
+
telemetryLocation: "PromptsTab"
|
|
74132
74306
|
}
|
|
74133
74307
|
) });
|
|
74134
74308
|
};
|
|
@@ -74161,273 +74335,216 @@ const onPromptSelectInPanelActionLabels = {
|
|
|
74161
74335
|
command: "run",
|
|
74162
74336
|
prompt: "insert"
|
|
74163
74337
|
};
|
|
74164
|
-
const
|
|
74165
|
-
const
|
|
74166
|
-
const
|
|
74167
|
-
|
|
74168
|
-
|
|
74169
|
-
|
|
74170
|
-
|
|
74171
|
-
const
|
|
74172
|
-
|
|
74173
|
-
|
|
74174
|
-
|
|
74175
|
-
|
|
74176
|
-
|
|
74177
|
-
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: [
|
|
74178
|
-
/* @__PURE__ */ jsx(
|
|
74179
|
-
CollapsiblePanel,
|
|
74180
|
-
{
|
|
74181
|
-
storageKey: "prompts",
|
|
74182
|
-
title: "Prompts & Commands",
|
|
74183
|
-
className: "tw-mb-6",
|
|
74184
|
-
contentClassName: "!tw-p-0 tw-overflow-clip",
|
|
74185
|
-
initialOpen: true,
|
|
74186
|
-
children: /* @__PURE__ */ jsx(
|
|
74187
|
-
PromptListSuitedForNonPopover,
|
|
74188
|
-
{
|
|
74189
|
-
onSelect: (item2) => onPromptSelectInPanel(item2, setView, dispatchClientAction),
|
|
74190
|
-
onSelectActionLabels: onPromptSelectInPanelActionLabels,
|
|
74191
|
-
telemetryLocation: "PromptsTab",
|
|
74192
|
-
showCommandOrigins: true,
|
|
74193
|
-
showPromptLibraryUnsupportedMessage: false,
|
|
74194
|
-
showOnlyPromptInsertableCommands: false,
|
|
74195
|
-
className: "tw-rounded-none"
|
|
74196
|
-
}
|
|
74197
|
-
)
|
|
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" });
|
|
74198
74351
|
}
|
|
74199
|
-
)
|
|
74200
|
-
|
|
74201
|
-
|
|
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,
|
|
74202
74394
|
{
|
|
74203
|
-
|
|
74204
|
-
|
|
74205
|
-
|
|
74206
|
-
|
|
74207
|
-
children:
|
|
74208
|
-
|
|
74209
|
-
|
|
74210
|
-
|
|
74211
|
-
" to add context to your chat"
|
|
74212
|
-
] }),
|
|
74213
|
-
IDE === CodyIDE.VSCode && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74214
|
-
/* @__PURE__ */ jsxs(FeatureRow, { icon: Text, children: [
|
|
74215
|
-
"To add code context from an editor, right click and use",
|
|
74216
|
-
" ",
|
|
74217
|
-
/* @__PURE__ */ jsx(MenuExample, { children: "Cody > Add File/Selection to Cody Chat" })
|
|
74218
|
-
] }),
|
|
74219
|
-
/* @__PURE__ */ jsxs(FeatureRow, { icon: MessageSquarePlus, children: [
|
|
74220
|
-
"Start a new chat using ",
|
|
74221
|
-
/* @__PURE__ */ jsx(Kbd, { macOS: "opt+L", linuxAndWindows: "alt+L" })
|
|
74222
|
-
] }),
|
|
74223
|
-
/* @__PURE__ */ jsxs(FeatureRow, { icon: Settings, children: [
|
|
74224
|
-
"Customize chat settings with the ",
|
|
74225
|
-
/* @__PURE__ */ jsx(FeatureRowInlineIcon, { Icon: Settings }),
|
|
74226
|
-
" ",
|
|
74227
|
-
"button, or see the",
|
|
74228
|
-
" ",
|
|
74229
|
-
/* @__PURE__ */ jsx("a", { href: "https://sourcegraph.com/docs/cody", children: "documentation" })
|
|
74230
|
-
] })
|
|
74231
|
-
] })
|
|
74232
|
-
]
|
|
74233
|
-
}
|
|
74234
|
-
)
|
|
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
|
+
))
|
|
74235
74403
|
] });
|
|
74236
74404
|
};
|
|
74237
|
-
|
|
74238
|
-
|
|
74239
|
-
return
|
|
74240
|
-
root: element2,
|
|
74241
|
-
getObserveElement: () => element2.firstElementChild,
|
|
74242
|
-
getScrollTop: () => element2.scrollTop,
|
|
74243
|
-
getScrollHeight: () => element2.scrollHeight,
|
|
74244
|
-
getClientHeight: () => element2.getBoundingClientRect().height
|
|
74245
|
-
};
|
|
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";
|
|
74246
74408
|
}
|
|
74247
|
-
const
|
|
74248
|
-
|
|
74249
|
-
|
|
74250
|
-
|
|
74251
|
-
|
|
74252
|
-
|
|
74253
|
-
const scrollTop = scrollerAPI.getScrollTop();
|
|
74254
|
-
const scrollHeight = scrollerAPI.getScrollHeight();
|
|
74255
|
-
const clientHeight = scrollerAPI.getClientHeight();
|
|
74256
|
-
setCanScrollDown(scrollTop + clientHeight < scrollHeight - MARGIN);
|
|
74257
|
-
}
|
|
74258
|
-
calculateScrollState();
|
|
74259
|
-
const resizeObserver = new ResizeObserver(() => {
|
|
74260
|
-
calculateScrollState();
|
|
74261
|
-
});
|
|
74262
|
-
resizeObserver.observe(scrollerAPI.getObserveElement());
|
|
74263
|
-
scrollerAPI.root.addEventListener("scroll", calculateScrollState);
|
|
74264
|
-
return () => {
|
|
74265
|
-
resizeObserver.disconnect();
|
|
74266
|
-
scrollerAPI.root.removeEventListener("scroll", calculateScrollState);
|
|
74267
|
-
};
|
|
74268
|
-
}, [scrollerAPI]);
|
|
74269
|
-
const onClick = useCallback(() => {
|
|
74270
|
-
setCanScrollDown(false);
|
|
74271
|
-
scrollerAPI.root.scrollTo({
|
|
74272
|
-
top: scrollerAPI.getScrollHeight()
|
|
74273
|
-
});
|
|
74274
|
-
parentOnClick == null ? void 0 : parentOnClick();
|
|
74275
|
-
}, [parentOnClick, scrollerAPI]);
|
|
74276
|
-
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: [
|
|
74277
|
-
/* @__PURE__ */ jsx(ArrowDown, { size: 16 }),
|
|
74278
|
-
" Skip to end"
|
|
74279
|
-
] }) }) : null;
|
|
74280
|
-
};
|
|
74281
|
-
const Chat = ({
|
|
74282
|
-
messageInProgress,
|
|
74283
|
-
transcript,
|
|
74284
|
-
vscodeAPI,
|
|
74285
|
-
isTranscriptError,
|
|
74286
|
-
chatEnabled = true,
|
|
74287
|
-
guardrails,
|
|
74288
|
-
scrollableParent,
|
|
74289
|
-
showWelcomeMessage = true,
|
|
74290
|
-
showIDESnippetActions = true,
|
|
74291
|
-
setView,
|
|
74292
|
-
smartApplyEnabled
|
|
74409
|
+
const HistoryTab = ({
|
|
74410
|
+
userHistory,
|
|
74411
|
+
IDE,
|
|
74412
|
+
webviewType,
|
|
74413
|
+
multipleWebviewsEnabled,
|
|
74414
|
+
setView
|
|
74293
74415
|
}) => {
|
|
74294
|
-
const
|
|
74295
|
-
|
|
74296
|
-
|
|
74297
|
-
|
|
74298
|
-
|
|
74299
|
-
(
|
|
74300
|
-
|
|
74301
|
-
let FeedbackType;
|
|
74302
|
-
((FeedbackType2) => {
|
|
74303
|
-
FeedbackType2[FeedbackType2["thumbsUp"] = 1] = "thumbsUp";
|
|
74304
|
-
FeedbackType2[FeedbackType2["thumbsDown"] = 0] = "thumbsDown";
|
|
74305
|
-
})(FeedbackType || (FeedbackType = {}));
|
|
74306
|
-
telemetryRecorder.recordEvent("cody.feedback", "submit", {
|
|
74307
|
-
metadata: {
|
|
74308
|
-
feedbackType: text2 === "thumbsUp" ? 1 : 0,
|
|
74309
|
-
lastChatUsedEmbeddings: ((_b = (_a = transcriptRef.current.at(-1)) == null ? void 0 : _a.contextFiles) == null ? void 0 : _b.some((file) => file.source === "embeddings")) ? 1 : 0,
|
|
74310
|
-
recordsPrivateMetadataTranscript: userInfo.isDotComUser ? 1 : 0
|
|
74311
|
-
},
|
|
74312
|
-
privateMetadata: {
|
|
74313
|
-
FeedbackText: text2,
|
|
74314
|
-
// 🚨 SECURITY: chat transcripts are to be included only for DotCom users AND for V2 telemetry
|
|
74315
|
-
// V2 telemetry exports privateMetadata only for DotCom users
|
|
74316
|
-
// the condition below is an aditional safegaurd measure
|
|
74317
|
-
responseText: userInfo.isDotComUser ? truncateTextStart(transcriptRef.current.toString(), CHAT_INPUT_TOKEN_BUDGET) : ""
|
|
74318
|
-
}
|
|
74319
|
-
});
|
|
74320
|
-
},
|
|
74321
|
-
[userInfo, telemetryRecorder]
|
|
74322
|
-
);
|
|
74323
|
-
const copyButtonOnSubmit = useCallback(
|
|
74324
|
-
(text2, eventType = "Button") => {
|
|
74325
|
-
const op = "copy";
|
|
74326
|
-
const code2 = eventType === "Button" ? text2.replace(/\n$/, "") : text2;
|
|
74327
|
-
vscodeAPI.postMessage({
|
|
74328
|
-
command: op,
|
|
74329
|
-
eventType,
|
|
74330
|
-
text: code2
|
|
74331
|
-
});
|
|
74332
|
-
},
|
|
74333
|
-
[vscodeAPI]
|
|
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]
|
|
74334
74423
|
);
|
|
74335
|
-
const
|
|
74336
|
-
|
|
74337
|
-
|
|
74338
|
-
|
|
74339
|
-
|
|
74340
|
-
|
|
74341
|
-
|
|
74342
|
-
text: text2.replace(/\n$/, "")
|
|
74343
|
-
});
|
|
74344
|
-
};
|
|
74345
|
-
}
|
|
74346
|
-
return;
|
|
74347
|
-
}, [vscodeAPI, showIDESnippetActions]);
|
|
74348
|
-
const smartApply = useMemo(() => {
|
|
74349
|
-
if (!showIDESnippetActions) {
|
|
74350
|
-
return;
|
|
74351
|
-
}
|
|
74352
|
-
return {
|
|
74353
|
-
onSubmit: (id2, text2, instruction, fileName) => {
|
|
74354
|
-
vscodeAPI.postMessage({
|
|
74355
|
-
command: "smartApplySubmit",
|
|
74356
|
-
id: id2,
|
|
74357
|
-
instruction: instruction == null ? void 0 : instruction.toString(),
|
|
74358
|
-
// remove the additional /n added by the text area at the end of the text
|
|
74359
|
-
code: text2.replace(/\n$/, ""),
|
|
74360
|
-
fileName
|
|
74361
|
-
});
|
|
74362
|
-
},
|
|
74363
|
-
onAccept: (id2) => {
|
|
74364
|
-
vscodeAPI.postMessage({
|
|
74365
|
-
command: "smartApplyAccept",
|
|
74366
|
-
id: id2
|
|
74367
|
-
});
|
|
74368
|
-
},
|
|
74369
|
-
onReject: (id2) => {
|
|
74370
|
-
vscodeAPI.postMessage({
|
|
74371
|
-
command: "smartApplyReject",
|
|
74372
|
-
id: id2
|
|
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
|
|
74373
74431
|
});
|
|
74374
74432
|
}
|
|
74375
|
-
}
|
|
74376
|
-
|
|
74377
|
-
|
|
74378
|
-
|
|
74379
|
-
|
|
74380
|
-
|
|
74381
|
-
|
|
74382
|
-
|
|
74383
|
-
|
|
74384
|
-
|
|
74385
|
-
|
|
74386
|
-
|
|
74387
|
-
|
|
74388
|
-
|
|
74389
|
-
return () => {
|
|
74390
|
-
window.removeEventListener("keydown", handleKeyDown);
|
|
74391
|
-
};
|
|
74392
|
-
}, [vscodeAPI, messageInProgress]);
|
|
74393
|
-
useEffect(() => {
|
|
74394
|
-
const onFocus = () => {
|
|
74395
|
-
const sel = window.getSelection();
|
|
74396
|
-
const focusNode = sel == null ? void 0 : sel.focusNode;
|
|
74397
|
-
const focusElement = focusNode instanceof Element ? focusNode : focusNode == null ? void 0 : focusNode.parentElement;
|
|
74398
|
-
const focusEditor = focusElement == null ? void 0 : focusElement.closest('[data-lexical-editor="true"]');
|
|
74399
|
-
if (focusEditor) {
|
|
74400
|
-
focusEditor.focus({ preventScroll: true });
|
|
74401
|
-
}
|
|
74402
|
-
};
|
|
74403
|
-
window.addEventListener("focus", onFocus);
|
|
74404
|
-
return () => {
|
|
74405
|
-
window.removeEventListener("focus", onFocus);
|
|
74406
|
-
};
|
|
74407
|
-
}, []);
|
|
74408
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74409
|
-
!chatEnabled && /* @__PURE__ */ jsx("div", { className: styles$3.chatDisabled, children: "Cody chat is disabled by your Sourcegraph site administrator" }),
|
|
74410
|
-
/* @__PURE__ */ jsx(
|
|
74411
|
-
Transcript,
|
|
74433
|
+
},
|
|
74434
|
+
[userHistory]
|
|
74435
|
+
);
|
|
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,
|
|
74412
74447
|
{
|
|
74413
|
-
|
|
74414
|
-
|
|
74415
|
-
|
|
74416
|
-
|
|
74417
|
-
|
|
74418
|
-
|
|
74419
|
-
|
|
74420
|
-
|
|
74421
|
-
|
|
74422
|
-
|
|
74423
|
-
|
|
74424
|
-
|
|
74425
|
-
|
|
74426
|
-
|
|
74427
|
-
|
|
74428
|
-
|
|
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
|
+
})
|
|
74498
|
+
},
|
|
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
|
+
] })
|
|
74429
74531
|
] });
|
|
74430
74532
|
};
|
|
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
|
+
};
|
|
74431
74548
|
var ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus";
|
|
74432
74549
|
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
74433
74550
|
var GROUP_NAME = "RovingFocusGroup";
|
|
@@ -74807,247 +74924,24 @@ var Root2 = Tabs2;
|
|
|
74807
74924
|
var List = TabsList;
|
|
74808
74925
|
var Trigger = TabsTrigger;
|
|
74809
74926
|
var Content = TabsContent;
|
|
74810
|
-
const
|
|
74811
|
-
|
|
74812
|
-
|
|
74813
|
-
const
|
|
74814
|
-
|
|
74815
|
-
|
|
74816
|
-
|
|
74817
|
-
|
|
74818
|
-
|
|
74819
|
-
|
|
74820
|
-
|
|
74821
|
-
);
|
|
74822
|
-
});
|
|
74823
|
-
const AccountTab = () => {
|
|
74824
|
-
const userInfo = useUserAccountInfo();
|
|
74825
|
-
const { user, isCodyProUser: isCodyProUser2, isDotComUser, ide } = userInfo;
|
|
74826
|
-
const { displayName, username, primaryEmail, endpoint } = user;
|
|
74827
|
-
if (ide === CodyIDE.VSCode) {
|
|
74828
|
-
return null;
|
|
74829
|
-
}
|
|
74830
|
-
const actions2 = [];
|
|
74831
|
-
actions2.push({
|
|
74832
|
-
text: "Switch Account...",
|
|
74833
|
-
onClick: useCallback(() => {
|
|
74834
|
-
if (userInfo.user.username) {
|
|
74835
|
-
getVSCodeAPI().postMessage({ command: "command", id: "cody.auth.switchAccount" });
|
|
74836
|
-
}
|
|
74837
|
-
}, [userInfo])
|
|
74838
|
-
});
|
|
74839
|
-
if (isDotComUser) {
|
|
74840
|
-
actions2.push({
|
|
74841
|
-
text: "Manage Account",
|
|
74842
|
-
onClick: useCallback(() => {
|
|
74843
|
-
if (userInfo.user.username) {
|
|
74844
|
-
const uri = URI.parse(ACCOUNT_USAGE_URL.toString()).with({
|
|
74845
|
-
query: `cody_client_user=${encodeURIComponent(userInfo.user.username)}`
|
|
74846
|
-
});
|
|
74847
|
-
getVSCodeAPI().postMessage({ command: "links", value: uri.toString() });
|
|
74848
|
-
}
|
|
74849
|
-
}, [userInfo])
|
|
74850
|
-
});
|
|
74851
|
-
}
|
|
74852
|
-
actions2.push({
|
|
74853
|
-
text: "Settings",
|
|
74854
|
-
onClick: () => getVSCodeAPI().postMessage({ command: "command", id: "cody.status-bar.interacted" })
|
|
74855
|
-
});
|
|
74856
|
-
actions2.push({
|
|
74857
|
-
text: "Sign Out",
|
|
74858
|
-
onClick: () => getVSCodeAPI().postMessage({ command: "auth", authKind: "signout" })
|
|
74859
|
-
});
|
|
74860
|
-
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: [
|
|
74861
|
-
/* @__PURE__ */ jsx("h2", { children: "Account" }),
|
|
74862
|
-
/* @__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: [
|
|
74863
|
-
/* @__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: [
|
|
74864
|
-
/* @__PURE__ */ jsx(UserAvatar, { user, size: MESSAGE_CELL_AVATAR_SIZE }),
|
|
74865
|
-
/* @__PURE__ */ jsxs("div", { className: "tw-ml-4", children: [
|
|
74866
|
-
/* @__PURE__ */ jsx("p", { className: "tw-text-lg tw-font-semibold", children: displayName ?? username }),
|
|
74867
|
-
/* @__PURE__ */ jsx("p", { className: "tw-text-sm tw-text-muted-foreground", children: primaryEmail })
|
|
74868
|
-
] })
|
|
74869
|
-
] }) }),
|
|
74870
|
-
/* @__PURE__ */ jsxs("div", { className: "tw-grid tw-grid-cols-5 tw-gap-4", children: [
|
|
74871
|
-
/* @__PURE__ */ jsx("div", { children: "Plan:" }),
|
|
74872
|
-
/* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: isDotComUser ? isCodyProUser2 ? "Cody Pro" : "Cody Free" : "Enterprise" }),
|
|
74873
|
-
/* @__PURE__ */ jsx("div", { children: "Endpoint:" }),
|
|
74874
|
-
/* @__PURE__ */ jsx("div", { className: "tw-text-muted-foreground tw-col-span-4", children: endpoint })
|
|
74875
|
-
] })
|
|
74876
|
-
] }),
|
|
74877
|
-
actions2.map((a2) => /* @__PURE__ */ jsx(
|
|
74878
|
-
Button3,
|
|
74879
|
-
{
|
|
74880
|
-
variant: "secondary",
|
|
74881
|
-
className: "tw-w-full tw-bg-popover tw-border tw-border-border",
|
|
74882
|
-
onClick: a2.onClick,
|
|
74883
|
-
title: a2.text,
|
|
74884
|
-
children: a2.text
|
|
74885
|
-
},
|
|
74886
|
-
a2.text
|
|
74887
|
-
))
|
|
74888
|
-
] });
|
|
74889
|
-
};
|
|
74890
|
-
function getCreateNewChatCommand(options) {
|
|
74891
|
-
const { IDE, webviewType, multipleWebviewsEnabled } = options;
|
|
74892
|
-
return IDE === CodyIDE.Web ? "cody.chat.new" : webviewType === "sidebar" || !multipleWebviewsEnabled ? "cody.chat.newPanel" : "cody.chat.newEditorPanel";
|
|
74893
|
-
}
|
|
74894
|
-
const HistoryTab = ({
|
|
74895
|
-
userHistory,
|
|
74896
|
-
IDE,
|
|
74897
|
-
webviewType,
|
|
74898
|
-
multipleWebviewsEnabled,
|
|
74899
|
-
setView
|
|
74900
|
-
}) => {
|
|
74901
|
-
const chatByPeriod = useMemo(
|
|
74902
|
-
() => userHistory.filter((chat2) => chat2.interactions.length).reverse().reduce((acc, chat2) => {
|
|
74903
|
-
const period = getRelativeChatPeriod(new Date(chat2.lastInteractionTimestamp));
|
|
74904
|
-
acc.set(period, [...acc.get(period) || [], chat2]);
|
|
74905
|
-
return acc;
|
|
74906
|
-
}, /* @__PURE__ */ new Map()),
|
|
74907
|
-
[userHistory]
|
|
74908
|
-
);
|
|
74909
|
-
const onDeleteButtonClick = useCallback(
|
|
74910
|
-
(id2) => {
|
|
74911
|
-
if (userHistory.find((chat2) => chat2.id === id2)) {
|
|
74912
|
-
getVSCodeAPI().postMessage({
|
|
74913
|
-
command: "command",
|
|
74914
|
-
id: "cody.chat.history.clear",
|
|
74915
|
-
arg: id2
|
|
74916
|
-
});
|
|
74917
|
-
}
|
|
74918
|
-
},
|
|
74919
|
-
[userHistory]
|
|
74920
|
-
);
|
|
74921
|
-
const handleStartNewChat = () => {
|
|
74922
|
-
getVSCodeAPI().postMessage({
|
|
74923
|
-
command: "command",
|
|
74924
|
-
id: getCreateNewChatCommand({ IDE, webviewType, multipleWebviewsEnabled })
|
|
74925
|
-
});
|
|
74926
|
-
setView(View.Chat);
|
|
74927
|
-
};
|
|
74928
|
-
const chats = Array.from(chatByPeriod);
|
|
74929
|
-
return /* @__PURE__ */ jsxs("div", { className: "tw-px-8 tw-pt-6 tw-pb-12 tw-flex tw-flex-col tw-gap-10", children: [
|
|
74930
|
-
chats.map(([period, chats2]) => /* @__PURE__ */ jsx(
|
|
74931
|
-
CollapsiblePanel,
|
|
74932
|
-
{
|
|
74933
|
-
storageKey: `history.${period}`,
|
|
74934
|
-
title: period,
|
|
74935
|
-
initialOpen: true,
|
|
74936
|
-
children: chats2.map(({ interactions, id: id2 }) => {
|
|
74937
|
-
var _a, _b, _c;
|
|
74938
|
-
const lastMessage = (_c = (_b = (_a = interactions[interactions.length - 1]) == null ? void 0 : _a.humanMessage) == null ? void 0 : _b.text) == null ? void 0 : _c.trim();
|
|
74939
|
-
return /* @__PURE__ */ jsxs("div", { className: "tw-inline-flex tw-justify-between", children: [
|
|
74940
|
-
/* @__PURE__ */ jsxs(
|
|
74941
|
-
Button3,
|
|
74942
|
-
{
|
|
74943
|
-
variant: "ghost",
|
|
74944
|
-
title: lastMessage,
|
|
74945
|
-
onClick: () => getVSCodeAPI().postMessage({
|
|
74946
|
-
command: "restoreHistory",
|
|
74947
|
-
chatID: id2
|
|
74948
|
-
}),
|
|
74949
|
-
className: "tw-text-left tw-truncate tw-w-full",
|
|
74950
|
-
children: [
|
|
74951
|
-
/* @__PURE__ */ jsx(
|
|
74952
|
-
MessageSquareText,
|
|
74953
|
-
{
|
|
74954
|
-
className: "tw-w-8 tw-h-8 tw-opacity-80",
|
|
74955
|
-
size: 16,
|
|
74956
|
-
strokeWidth: "1.25"
|
|
74957
|
-
}
|
|
74958
|
-
),
|
|
74959
|
-
/* @__PURE__ */ jsx("span", { className: "tw-truncate tw-w-full", children: lastMessage })
|
|
74960
|
-
]
|
|
74961
|
-
},
|
|
74962
|
-
id2
|
|
74963
|
-
),
|
|
74964
|
-
/* @__PURE__ */ jsx(
|
|
74965
|
-
Button3,
|
|
74966
|
-
{
|
|
74967
|
-
variant: "ghost",
|
|
74968
|
-
title: "Delete chat",
|
|
74969
|
-
onClick: () => onDeleteButtonClick(id2),
|
|
74970
|
-
children: /* @__PURE__ */ jsx(
|
|
74971
|
-
Trash,
|
|
74972
|
-
{
|
|
74973
|
-
className: "tw-w-8 tw-h-8 tw-opacity-80",
|
|
74974
|
-
size: 16,
|
|
74975
|
-
strokeWidth: "1.25"
|
|
74976
|
-
}
|
|
74977
|
-
)
|
|
74978
|
-
},
|
|
74979
|
-
id2
|
|
74980
|
-
)
|
|
74981
|
-
] }, id2);
|
|
74982
|
-
})
|
|
74983
|
-
},
|
|
74984
|
-
period
|
|
74985
|
-
)),
|
|
74986
|
-
chats.length === 0 && /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col tw-items-center tw-mt-6", children: [
|
|
74987
|
-
/* @__PURE__ */ jsx(
|
|
74988
|
-
History,
|
|
74989
|
-
{
|
|
74990
|
-
size: 20,
|
|
74991
|
-
strokeWidth: 1.25,
|
|
74992
|
-
className: "tw-mb-5 tw-text-muted-foreground"
|
|
74993
|
-
}
|
|
74994
|
-
),
|
|
74995
|
-
/* @__PURE__ */ jsx("span", { className: "tw-text-lg tw-mb-4 tw-text-muted-foreground", children: "You have no chat history" }),
|
|
74996
|
-
/* @__PURE__ */ jsxs("span", { className: "tw-text-sm tw-text-muted-foreground tw-mb-8", children: [
|
|
74997
|
-
"Explore all your previous chats here. Track and ",
|
|
74998
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
74999
|
-
" search through what you’ve been working on."
|
|
75000
|
-
] }),
|
|
75001
|
-
/* @__PURE__ */ jsxs(
|
|
75002
|
-
Button3,
|
|
75003
|
-
{
|
|
75004
|
-
size: "sm",
|
|
75005
|
-
variant: "secondary",
|
|
75006
|
-
"aria-label": "Start a new chat",
|
|
75007
|
-
className: "tw-px-4 tw-py-2",
|
|
75008
|
-
onClick: handleStartNewChat,
|
|
75009
|
-
children: [
|
|
75010
|
-
/* @__PURE__ */ jsx(MessageSquarePlus, { size: 16, className: "tw-w-8 tw-h-8", strokeWidth: 1.25 }),
|
|
75011
|
-
"Start a new chat"
|
|
75012
|
-
]
|
|
75013
|
-
}
|
|
75014
|
-
)
|
|
75015
|
-
] })
|
|
75016
|
-
] });
|
|
75017
|
-
};
|
|
75018
|
-
const SettingsTab = () => {
|
|
75019
|
-
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(
|
|
75020
|
-
Button3,
|
|
75021
|
-
{
|
|
75022
|
-
variant: "secondary",
|
|
75023
|
-
className: "tw-w-full tw-bg-popover",
|
|
75024
|
-
onClick: () => getVSCodeAPI().postMessage({
|
|
75025
|
-
command: "command",
|
|
75026
|
-
id: "cody.status-bar.interacted"
|
|
75027
|
-
}),
|
|
75028
|
-
children: "Cody Settings"
|
|
75029
|
-
},
|
|
75030
|
-
"settings"
|
|
75031
|
-
) });
|
|
75032
|
-
};
|
|
75033
|
-
const tabsRoot = "_tabs-root_1do08_10";
|
|
75034
|
-
const tabsContainer = "_tabs-container_1do08_18";
|
|
75035
|
-
const tabs = "_tabs_1do08_10";
|
|
75036
|
-
const subTabs = "_sub-tabs_1do08_37";
|
|
75037
|
-
const tabActionLabel = "_tab-action-label_1do08_47";
|
|
75038
|
-
const tooltip = "_tooltip_1do08_51";
|
|
75039
|
-
const dialogOverlay = "_dialog-overlay_1do08_1";
|
|
75040
|
-
const dialogContent = "_dialog-content_1do08_1";
|
|
75041
|
-
const dialogTitle = "_dialog-title_1do08_1";
|
|
75042
|
-
const dialogDescription = "_dialog-description_1do08_1";
|
|
75043
|
-
const dialogFooter = "_dialog-footer_1do08_1";
|
|
74927
|
+
const tabsRoot = "_tabs-root_1e23y_10";
|
|
74928
|
+
const tabsContainer = "_tabs-container_1e23y_18";
|
|
74929
|
+
const tabs = "_tabs_1e23y_10";
|
|
74930
|
+
const subTabs = "_sub-tabs_1e23y_42";
|
|
74931
|
+
const tabActionLabel = "_tab-action-label_1e23y_53";
|
|
74932
|
+
const tabsRootCodyWeb = "_tabs-root--cody-web_1e23y_65";
|
|
74933
|
+
const dialogOverlay = "_dialog-overlay_1e23y_1";
|
|
74934
|
+
const dialogContent = "_dialog-content_1e23y_1";
|
|
74935
|
+
const dialogTitle = "_dialog-title_1e23y_1";
|
|
74936
|
+
const dialogDescription = "_dialog-description_1e23y_1";
|
|
74937
|
+
const dialogFooter = "_dialog-footer_1e23y_1";
|
|
75044
74938
|
const styles$2 = {
|
|
75045
74939
|
tabsRoot,
|
|
75046
74940
|
tabsContainer,
|
|
75047
74941
|
tabs,
|
|
75048
74942
|
subTabs,
|
|
75049
74943
|
tabActionLabel,
|
|
75050
|
-
|
|
74944
|
+
tabsRootCodyWeb,
|
|
75051
74945
|
dialogOverlay,
|
|
75052
74946
|
dialogContent,
|
|
75053
74947
|
dialogTitle,
|
|
@@ -75057,6 +74951,9 @@ const styles$2 = {
|
|
|
75057
74951
|
const TabsBar = ({ currentView, setView, IDE, onDownloadChatClick }) => {
|
|
75058
74952
|
var _a;
|
|
75059
74953
|
const tabItems = useTabs({ IDE, onDownloadChatClick });
|
|
74954
|
+
const {
|
|
74955
|
+
config: { webviewType, multipleWebviewsEnabled }
|
|
74956
|
+
} = useConfig();
|
|
75060
74957
|
const currentViewSubActions = ((_a = tabItems.find((tab2) => tab2.view === currentView)) == null ? void 0 : _a.subActions) ?? [];
|
|
75061
74958
|
const handleClick = useCallback(
|
|
75062
74959
|
(view, command, changesView) => {
|
|
@@ -75069,35 +74966,60 @@ const TabsBar = ({ currentView, setView, IDE, onDownloadChatClick }) => {
|
|
|
75069
74966
|
},
|
|
75070
74967
|
[setView]
|
|
75071
74968
|
);
|
|
75072
|
-
const handleSubActionClick = useCallback(
|
|
75073
|
-
|
|
75074
|
-
action.callback
|
|
75075
|
-
|
|
75076
|
-
|
|
75077
|
-
|
|
75078
|
-
|
|
75079
|
-
|
|
75080
|
-
|
|
75081
|
-
|
|
75082
|
-
}, []);
|
|
75083
|
-
return /* @__PURE__ */ jsx("div", { className: styles$2.tabsRoot, children: /* @__PURE__ */ jsxs(List, { "aria-label": "cody-webview", className: styles$2.tabsContainer, children: [
|
|
75084
|
-
/* @__PURE__ */ jsx("div", { className: styles$2.tabs, children: tabItems.map(({ Icon: Icon2, view, command, title: title2, changesView }) => /* @__PURE__ */ jsx(Trigger, { value: view, asChild: true, children: /* @__PURE__ */ jsx(
|
|
75085
|
-
TabButton,
|
|
75086
|
-
{
|
|
75087
|
-
Icon: Icon2,
|
|
75088
|
-
view,
|
|
75089
|
-
title: title2,
|
|
75090
|
-
isActive: currentView === view,
|
|
75091
|
-
onClick: () => handleClick(view, command, changesView),
|
|
75092
|
-
"data-testid": `tab-${view}`
|
|
74969
|
+
const handleSubActionClick = useCallback(
|
|
74970
|
+
(action) => {
|
|
74971
|
+
if (action.callback) {
|
|
74972
|
+
action.callback();
|
|
74973
|
+
} else {
|
|
74974
|
+
getVSCodeAPI().postMessage({
|
|
74975
|
+
command: "command",
|
|
74976
|
+
id: action.command,
|
|
74977
|
+
arg: action.arg
|
|
74978
|
+
});
|
|
75093
74979
|
}
|
|
75094
|
-
|
|
74980
|
+
},
|
|
74981
|
+
[]
|
|
74982
|
+
);
|
|
74983
|
+
return /* @__PURE__ */ jsx("div", { className: clsx$1(styles$2.tabsRoot, { [styles$2.tabsRootCodyWeb]: IDE === CodyIDE.Web }), children: /* @__PURE__ */ jsxs(List, { "aria-label": "cody-webview", className: styles$2.tabsContainer, children: [
|
|
74984
|
+
/* @__PURE__ */ jsxs("div", { className: styles$2.tabs, children: [
|
|
74985
|
+
tabItems.map(({ Icon: Icon2, view, command, title: title2, changesView }) => /* @__PURE__ */ jsx(Trigger, { value: view, asChild: true, children: /* @__PURE__ */ jsx(
|
|
74986
|
+
TabButton,
|
|
74987
|
+
{
|
|
74988
|
+
Icon: Icon2,
|
|
74989
|
+
view,
|
|
74990
|
+
title: title2,
|
|
74991
|
+
IDE,
|
|
74992
|
+
isActive: currentView === view,
|
|
74993
|
+
onClick: () => handleClick(view, command, changesView),
|
|
74994
|
+
"data-testid": `tab-${view}`
|
|
74995
|
+
}
|
|
74996
|
+
) }, view)),
|
|
74997
|
+
/* @__PURE__ */ jsx("div", { className: "tw-ml-auto", children: /* @__PURE__ */ jsx(
|
|
74998
|
+
TabButton,
|
|
74999
|
+
{
|
|
75000
|
+
prominent: true,
|
|
75001
|
+
Icon: MessageSquarePlus,
|
|
75002
|
+
title: "New Chat",
|
|
75003
|
+
IDE,
|
|
75004
|
+
alwaysShowTitle: true,
|
|
75005
|
+
tooltipExtra: /* @__PURE__ */ jsx(Fragment, { children: IDE === CodyIDE.VSCode && /* @__PURE__ */ jsx(Kbd, { macOS: "shift+opt+l", linuxAndWindows: "shift+alt+l" }) }),
|
|
75006
|
+
onClick: () => handleSubActionClick({
|
|
75007
|
+
command: getCreateNewChatCommand({
|
|
75008
|
+
IDE,
|
|
75009
|
+
webviewType,
|
|
75010
|
+
multipleWebviewsEnabled
|
|
75011
|
+
})
|
|
75012
|
+
})
|
|
75013
|
+
}
|
|
75014
|
+
) })
|
|
75015
|
+
] }),
|
|
75095
75016
|
/* @__PURE__ */ jsx("div", { className: styles$2.subTabs, children: currentViewSubActions.map((subAction) => /* @__PURE__ */ jsx(Fragment$1, { children: subAction.confirmation ? /* @__PURE__ */ jsx(
|
|
75096
75017
|
ActionButtonWithConfirmation,
|
|
75097
75018
|
{
|
|
75098
75019
|
title: subAction.title,
|
|
75099
75020
|
Icon: subAction.Icon,
|
|
75100
|
-
|
|
75021
|
+
IDE,
|
|
75022
|
+
alwaysShowTitle: true,
|
|
75101
75023
|
tooltipExtra: subAction.tooltipExtra,
|
|
75102
75024
|
dialogTitle: subAction.confirmation.title,
|
|
75103
75025
|
dialogDescription: subAction.confirmation.description,
|
|
@@ -75109,18 +75031,20 @@ const TabsBar = ({ currentView, setView, IDE, onDownloadChatClick }) => {
|
|
|
75109
75031
|
{
|
|
75110
75032
|
Icon: subAction.Icon,
|
|
75111
75033
|
title: subAction.title,
|
|
75112
|
-
|
|
75034
|
+
uri: subAction.uri,
|
|
75035
|
+
IDE,
|
|
75036
|
+
alwaysShowTitle: true,
|
|
75113
75037
|
tooltipExtra: subAction.tooltipExtra,
|
|
75114
|
-
onClick: () => handleSubActionClick(subAction)
|
|
75115
|
-
prominent: true
|
|
75038
|
+
onClick: () => handleSubActionClick(subAction)
|
|
75116
75039
|
}
|
|
75117
|
-
) }, subAction.command)) })
|
|
75040
|
+
) }, `${subAction.command}/${subAction.uri ?? ""}`)) })
|
|
75118
75041
|
] }) });
|
|
75119
75042
|
};
|
|
75120
75043
|
const ActionButtonWithConfirmation = (props) => {
|
|
75121
75044
|
const {
|
|
75122
75045
|
title: title2,
|
|
75123
75046
|
Icon: Icon2,
|
|
75047
|
+
IDE,
|
|
75124
75048
|
prominent,
|
|
75125
75049
|
alwaysShowTitle,
|
|
75126
75050
|
tooltipExtra,
|
|
@@ -75139,6 +75063,7 @@ const ActionButtonWithConfirmation = (props) => {
|
|
|
75139
75063
|
alwaysShowTitle,
|
|
75140
75064
|
tooltipExtra,
|
|
75141
75065
|
prominent,
|
|
75066
|
+
IDE,
|
|
75142
75067
|
onClick: () => setState(true)
|
|
75143
75068
|
}
|
|
75144
75069
|
),
|
|
@@ -75165,25 +75090,32 @@ const ActionButtonWithConfirmation = (props) => {
|
|
|
75165
75090
|
] })
|
|
75166
75091
|
] });
|
|
75167
75092
|
};
|
|
75168
|
-
const TabButton = forwardRef(
|
|
75169
|
-
|
|
75093
|
+
const TabButton = forwardRef((props, ref2) => {
|
|
75094
|
+
const {
|
|
75095
|
+
IDE,
|
|
75170
75096
|
Icon: Icon2,
|
|
75171
75097
|
isActive,
|
|
75172
75098
|
onClick,
|
|
75099
|
+
uri,
|
|
75173
75100
|
title: title2,
|
|
75174
75101
|
alwaysShowTitle,
|
|
75175
75102
|
tooltipExtra,
|
|
75176
75103
|
prominent,
|
|
75177
75104
|
"data-testid": dataTestId
|
|
75178
|
-
}
|
|
75105
|
+
} = props;
|
|
75106
|
+
const Component = uri ? "a" : "button";
|
|
75107
|
+
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
75179
75108
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
75180
|
-
|
|
75109
|
+
Component,
|
|
75181
75110
|
{
|
|
75182
|
-
type: "button",
|
|
75183
|
-
onClick,
|
|
75111
|
+
type: uri ? void 0 : "button",
|
|
75112
|
+
onClick: uri ? void 0 : onClick,
|
|
75113
|
+
href: uri,
|
|
75114
|
+
target: "_blank",
|
|
75115
|
+
rel: "noopener noreferrer",
|
|
75184
75116
|
ref: ref2,
|
|
75185
75117
|
className: clsx$1(
|
|
75186
|
-
"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]",
|
|
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]",
|
|
75187
75119
|
{
|
|
75188
75120
|
"!tw-opacity-100 !tw-border-[var(--vscode-tab-activeBorderTop)]": isActive,
|
|
75189
75121
|
"!tw-opacity-100": prominent
|
|
@@ -75196,18 +75128,18 @@ const TabButton = forwardRef(
|
|
|
75196
75128
|
]
|
|
75197
75129
|
}
|
|
75198
75130
|
) }),
|
|
75199
|
-
/* @__PURE__ */ jsxs(TooltipContent, {
|
|
75131
|
+
/* @__PURE__ */ jsxs(TooltipContent, { portal: IDE === CodyIDE.Web, children: [
|
|
75200
75132
|
title2,
|
|
75201
75133
|
" ",
|
|
75202
75134
|
tooltipExtra
|
|
75203
75135
|
] })
|
|
75204
|
-
] })
|
|
75205
|
-
);
|
|
75136
|
+
] });
|
|
75137
|
+
});
|
|
75206
75138
|
TabButton.displayName = "TabButton";
|
|
75207
75139
|
function useTabs(input) {
|
|
75208
75140
|
const { IDE, onDownloadChatClick } = input;
|
|
75209
75141
|
const {
|
|
75210
|
-
config: {
|
|
75142
|
+
config: { multipleWebviewsEnabled, serverEndpoint }
|
|
75211
75143
|
} = useConfig();
|
|
75212
75144
|
return useMemo(
|
|
75213
75145
|
() => [
|
|
@@ -75215,24 +75147,6 @@ function useTabs(input) {
|
|
|
75215
75147
|
view: View.Chat,
|
|
75216
75148
|
title: "Chat",
|
|
75217
75149
|
Icon: MessagesSquare,
|
|
75218
|
-
subActions: [
|
|
75219
|
-
{
|
|
75220
|
-
title: "New Chat",
|
|
75221
|
-
alwaysShowTitle: true,
|
|
75222
|
-
tooltipExtra: /* @__PURE__ */ jsx(Fragment, { children: IDE === CodyIDE.VSCode && /* @__PURE__ */ jsx(Kbd, { macOS: "shift+opt+l", linuxAndWindows: "shift+alt+l" }) }),
|
|
75223
|
-
Icon: MessageSquarePlus,
|
|
75224
|
-
command: getCreateNewChatCommand({
|
|
75225
|
-
IDE,
|
|
75226
|
-
webviewType,
|
|
75227
|
-
multipleWebviewsEnabled
|
|
75228
|
-
})
|
|
75229
|
-
},
|
|
75230
|
-
multipleWebviewsEnabled ? {
|
|
75231
|
-
title: "Open in Editor",
|
|
75232
|
-
Icon: Columns2,
|
|
75233
|
-
command: "cody.chat.moveToEditor"
|
|
75234
|
-
} : null
|
|
75235
|
-
].filter(isDefined),
|
|
75236
75150
|
changesView: true
|
|
75237
75151
|
},
|
|
75238
75152
|
{
|
|
@@ -75241,13 +75155,13 @@ function useTabs(input) {
|
|
|
75241
75155
|
Icon: History,
|
|
75242
75156
|
subActions: [
|
|
75243
75157
|
{
|
|
75244
|
-
title: "Export
|
|
75158
|
+
title: "Export",
|
|
75245
75159
|
Icon: Download,
|
|
75246
75160
|
command: "cody.chat.history.export",
|
|
75247
75161
|
callback: onDownloadChatClick
|
|
75248
75162
|
},
|
|
75249
75163
|
{
|
|
75250
|
-
title: "
|
|
75164
|
+
title: "Delete all",
|
|
75251
75165
|
Icon: Trash2,
|
|
75252
75166
|
command: "cody.chat.history.clear",
|
|
75253
75167
|
// Show Cody Chat UI confirmation modal with this message only for
|
|
@@ -75270,7 +75184,21 @@ function useTabs(input) {
|
|
|
75270
75184
|
view: View.Prompts,
|
|
75271
75185
|
title: IDE === CodyIDE.Web ? "Prompts" : "Prompts & Commands",
|
|
75272
75186
|
Icon: BookText,
|
|
75273
|
-
changesView: true
|
|
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
|
+
]
|
|
75274
75202
|
},
|
|
75275
75203
|
multipleWebviewsEnabled ? {
|
|
75276
75204
|
view: View.Settings,
|
|
@@ -75286,9 +75214,195 @@ function useTabs(input) {
|
|
|
75286
75214
|
changesView: IDE !== CodyIDE.VSCode
|
|
75287
75215
|
} : null
|
|
75288
75216
|
].filter(isDefined),
|
|
75289
|
-
[IDE,
|
|
75217
|
+
[IDE, onDownloadChatClick, multipleWebviewsEnabled, serverEndpoint]
|
|
75290
75218
|
);
|
|
75291
75219
|
}
|
|
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
|
+
});
|
|
75292
75406
|
const CodyPanel = ({
|
|
75293
75407
|
view,
|
|
75294
75408
|
setView,
|
|
@@ -75339,6 +75453,7 @@ const CodyPanel = ({
|
|
|
75339
75453
|
view === View.Chat && /* @__PURE__ */ jsx(
|
|
75340
75454
|
Chat,
|
|
75341
75455
|
{
|
|
75456
|
+
IDE: config.agentIDE || CodyIDE.VSCode,
|
|
75342
75457
|
chatEnabled,
|
|
75343
75458
|
messageInProgress,
|
|
75344
75459
|
transcript,
|
|
@@ -75362,7 +75477,7 @@ const CodyPanel = ({
|
|
|
75362
75477
|
userHistory
|
|
75363
75478
|
}
|
|
75364
75479
|
),
|
|
75365
|
-
view === View.Prompts && /* @__PURE__ */ jsx(PromptsTab, { setView }),
|
|
75480
|
+
view === View.Prompts && /* @__PURE__ */ jsx(PromptsTab, { setView, IDE: config.agentIDE || CodyIDE.VSCode }),
|
|
75366
75481
|
view === View.Account && /* @__PURE__ */ jsx(AccountTab, {}),
|
|
75367
75482
|
view === View.Settings && /* @__PURE__ */ jsx(SettingsTab, {})
|
|
75368
75483
|
] })
|
|
@@ -75385,7 +75500,7 @@ const ErrorBanner = ({ errors, setErrors }) => /* @__PURE__ */ jsx("div", { clas
|
|
|
75385
75500
|
)
|
|
75386
75501
|
] }, i2)
|
|
75387
75502
|
)) });
|
|
75388
|
-
function getAppWrappers(vscodeAPI, telemetryRecorder,
|
|
75503
|
+
function getAppWrappers(vscodeAPI, telemetryRecorder, clientState, config, chatEnvironmentContext) {
|
|
75389
75504
|
return [
|
|
75390
75505
|
{
|
|
75391
75506
|
provider: TelemetryRecorderContext.Provider,
|
|
@@ -75395,10 +75510,6 @@ function getAppWrappers(vscodeAPI, telemetryRecorder, chatModelContext, clientSt
|
|
|
75395
75510
|
component: ExtensionAPIProviderFromVSCodeAPI,
|
|
75396
75511
|
props: { vscodeAPI }
|
|
75397
75512
|
},
|
|
75398
|
-
{
|
|
75399
|
-
provider: ChatModelContextProvider,
|
|
75400
|
-
value: chatModelContext
|
|
75401
|
-
},
|
|
75402
75513
|
{
|
|
75403
75514
|
provider: ClientStateContextProvider,
|
|
75404
75515
|
value: clientState
|
|
@@ -75723,9 +75834,6 @@ const CodyWebChat = ({
|
|
|
75723
75834
|
}
|
|
75724
75835
|
) }) });
|
|
75725
75836
|
};
|
|
75726
|
-
const CONTEXT_MENTIONS_SETTINGS = {
|
|
75727
|
-
resolutionMode: "remote"
|
|
75728
|
-
};
|
|
75729
75837
|
const CodyWebPanel = (props) => {
|
|
75730
75838
|
const { vscodeAPI, initialContext, className } = props;
|
|
75731
75839
|
const dispatchClientAction = useClientActionDispatcher();
|
|
@@ -75733,7 +75841,6 @@ const CodyWebPanel = (props) => {
|
|
|
75733
75841
|
const [isTranscriptError, setIsTranscriptError] = useState(false);
|
|
75734
75842
|
const [messageInProgress, setMessageInProgress] = useState(null);
|
|
75735
75843
|
const [transcript, setTranscript] = useState([]);
|
|
75736
|
-
const [chatModels, setChatModels] = useState();
|
|
75737
75844
|
const [config, setConfig] = useState(null);
|
|
75738
75845
|
const [view, setView] = useState();
|
|
75739
75846
|
const [userHistory, setUserHistory] = useState();
|
|
@@ -75765,9 +75872,6 @@ const CodyWebPanel = (props) => {
|
|
|
75765
75872
|
case "transcript-errors":
|
|
75766
75873
|
setIsTranscriptError(message2.isTranscriptError);
|
|
75767
75874
|
break;
|
|
75768
|
-
case "chatModels":
|
|
75769
|
-
setChatModels(message2.models);
|
|
75770
|
-
break;
|
|
75771
75875
|
case "config":
|
|
75772
75876
|
message2.config.webviewType = "sidebar";
|
|
75773
75877
|
message2.config.multipleWebviewsEnabled = false;
|
|
@@ -75783,26 +75887,6 @@ const CodyWebPanel = (props) => {
|
|
|
75783
75887
|
});
|
|
75784
75888
|
}, [vscodeAPI, dispatchClientAction]);
|
|
75785
75889
|
const telemetryRecorder = useMemo(() => createWebviewTelemetryRecorder(vscodeAPI), [vscodeAPI]);
|
|
75786
|
-
const onCurrentChatModelChange = useCallback(
|
|
75787
|
-
(selected) => {
|
|
75788
|
-
if (!chatModels || !setChatModels) {
|
|
75789
|
-
return;
|
|
75790
|
-
}
|
|
75791
|
-
vscodeAPI.postMessage({
|
|
75792
|
-
command: "chatModel",
|
|
75793
|
-
model: selected.id
|
|
75794
|
-
});
|
|
75795
|
-
},
|
|
75796
|
-
[chatModels, vscodeAPI]
|
|
75797
|
-
);
|
|
75798
|
-
const chatModelContext = useMemo(
|
|
75799
|
-
() => ({
|
|
75800
|
-
chatModels,
|
|
75801
|
-
onCurrentChatModelChange,
|
|
75802
|
-
serverSentModelsEnabled: config == null ? void 0 : config.configFeatures.serverSentModels
|
|
75803
|
-
}),
|
|
75804
|
-
[chatModels, onCurrentChatModelChange, config]
|
|
75805
|
-
);
|
|
75806
75890
|
const clientState = useMemo(() => {
|
|
75807
75891
|
const { repository, fileURL, isDirectory } = initialContext ?? {};
|
|
75808
75892
|
if (!repository) {
|
|
@@ -75863,10 +75947,17 @@ const CodyWebPanel = (props) => {
|
|
|
75863
75947
|
}, [initialContext]);
|
|
75864
75948
|
const envVars = useMemo(() => ({ clientType: CodyIDE.Web }), []);
|
|
75865
75949
|
const wrappers = useMemo(
|
|
75866
|
-
() => getAppWrappers(vscodeAPI, telemetryRecorder,
|
|
75867
|
-
[vscodeAPI, telemetryRecorder,
|
|
75950
|
+
() => getAppWrappers(vscodeAPI, telemetryRecorder, clientState, config, envVars),
|
|
75951
|
+
[vscodeAPI, telemetryRecorder, clientState, config, envVars]
|
|
75868
75952
|
);
|
|
75869
|
-
const
|
|
75953
|
+
const CONTEXT_MENTIONS_SETTINGS = useMemo(() => {
|
|
75954
|
+
const { repository } = initialContext ?? {};
|
|
75955
|
+
return {
|
|
75956
|
+
resolutionMode: "remote",
|
|
75957
|
+
remoteRepositoriesNames: (repository == null ? void 0 : repository.name) ? [repository.name] : []
|
|
75958
|
+
};
|
|
75959
|
+
}, [initialContext]);
|
|
75960
|
+
const isLoading = !config || !view || !userHistory;
|
|
75870
75961
|
return /* @__PURE__ */ jsx("div", { className, "data-cody-web-chat": true, children: !isLoading && /* @__PURE__ */ jsx(ChatEnvironmentContext.Provider, { value: envVars, children: /* @__PURE__ */ jsx(ChatMentionContext.Provider, { value: CONTEXT_MENTIONS_SETTINGS, children: /* @__PURE__ */ jsx(ComposedWrappers, { wrappers, children: /* @__PURE__ */ jsx(
|
|
75871
75962
|
CodyPanel,
|
|
75872
75963
|
{
|