@sourcegraph/cody-web 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/{agent.worker-BKTrW_fZ.mjs → agent.worker-CF9GgIzt.mjs} +998 -1308
- package/dist/agent.worker.js +2 -2
- package/dist/{git-log-7kbEzZhk.mjs → git-log-Dihxu1-Z.mjs} +1 -1
- package/dist/index.js +185 -569
- package/dist/lib/agent/agent.client.d.ts.map +1 -1
- package/dist/lib/components/CodyWebChat.d.ts.map +1 -1
- package/dist/{lite-BobkBW3_.mjs → lite-CQAWMpwn.mjs} +1 -1
- package/dist/style.css +0 -19
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{util-CCLzYWyF.mjs → util-D8ltdME7.mjs} +1 -1
- package/dist/{vscode-shim-DpWxvTpJ.mjs → vscode-shim-Csgwpsv8.mjs} +3748 -4099
- package/package.json +17 -15
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
var _a;
|
|
5
5
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
6
|
-
import { g as getDefaultExportFromCjs, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, d as RULES_PROVIDER_URI, e as displayPath, f as displayLineRange, h as displayPathDirname, i as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, o as object, l as literal, j as string$2, k as displayPathWithLines, m as URI, n as is$3, q as serializeContextItem, r as CONTEXT_ITEM_MENTION_NODE_TYPE, t as contextItemMentionNodeDisplayText, T as TEMPLATE_INPUT_NODE_TYPE, u as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, v as FILE_RANGE_TOOLTIP_LABEL, O as Observable, x as createExtensionAPI, y as createMessageAPIForWebview, z as debounce$1, C as ContextItemSource, A as memoizeLastValue, B as toSerializedPromptEditorValue$1, D as isEqual, E as scanForMentionTriggerInUserTextInput, G as getMentionOperations, H as combineLatest, J as map$3, K as forceHydration, M as hydrateAfterPostMessage, P as isDotCom, Q as isWorkspaceInstance, V as isAuthError, X as isAvailabilityError, Y as isSourcegraphToken, Z as trace, _ as context$1, $ as SpanStatusCode, c as commonjsGlobal, a0 as svg, a1 as html$2, a2 as whitespace, a3 as find, a4 as stringify, a5 as stringify$1, a6 as ccount, a7 as
|
|
7
|
-
import {
|
|
6
|
+
import { g as getDefaultExportFromCjs, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, d as RULES_PROVIDER_URI, e as displayPath, f as displayLineRange, h as displayPathDirname, i as displayPathBasename, I as IGNORED_FILE_WARNING_LABEL, L as LARGE_FILE_WARNING_LABEL, o as object, l as literal, j as string$2, k as displayPathWithLines, m as URI, n as is$3, q as serializeContextItem, r as CONTEXT_ITEM_MENTION_NODE_TYPE, t as contextItemMentionNodeDisplayText, T as TEMPLATE_INPUT_NODE_TYPE, u as parseMentionQuery, N as NO_SYMBOL_MATCHES_HELP_LABEL, v as FILE_RANGE_TOOLTIP_LABEL, O as Observable, x as createExtensionAPI, y as createMessageAPIForWebview, z as debounce$1, C as ContextItemSource, A as memoizeLastValue, B as toSerializedPromptEditorValue$1, D as isEqual, E as scanForMentionTriggerInUserTextInput, G as getMentionOperations, H as combineLatest, J as map$3, K as forceHydration, M as hydrateAfterPostMessage, P as isDotCom, Q as isWorkspaceInstance, V as isAuthError, X as isAvailabilityError, Y as isSourcegraphToken, Z as trace, _ as context$1, $ as SpanStatusCode, c as commonjsGlobal, a0 as svg, a1 as html$2, a2 as whitespace, a3 as find, a4 as stringify, a5 as stringify$1, a6 as ccount, a7 as CodyIDE, a8 as CodyTaskState, a9 as cryptoJsExports, aa as GuardrailsCheckStatus, ab as LRUCache, ac as isError, ad as RateLimitError, ae as FeatureFlag, af as reformatBotMessageForChat, ag as isAbortErrorOrSocketHangUp, ah as ModelTag, ai as DeepCodyAgentID, aj as serializedPromptEditorStateFromChatMessage, ak as contextItemsFromPromptEditorValue, al as filterContextItemsFromPromptEditorValue, am as View, an as isMacOS, ao as ToolCodyModelName, ap as CustomCommandType, aq as textContentFromSerializedLexicalNode, ar as firstValueFrom, as as skipPendingOperation, at as FAST_CHAT_INPUT_TOKEN_BUDGET, au as webviewOpenURIForContextItem, av as pluralize, aw as UIToolStatus, ax as getFileDiff, ay as diffWithLineNum, az as UITerminalOutputType, aA as isCodeSearchContextItem, aB as v4, aC as lodashExports, aD as deserializeContextItem, aE as firstResultFromOperation, aF as ChatHistoryType, aG as ACCOUNT_USAGE_URL, aH as CODY_DOC_QUICKSTART_URL, aI as isDefined, aJ as browser, aK as CodyAutoSuggestionMode, aL as setDisplayPathEnvInfo, aM as isErrorLike, aN as PromptString, aO as createGuardrailsImpl, U as Uri } from "./vscode-shim-Csgwpsv8.mjs";
|
|
7
|
+
import { aQ, aP } from "./vscode-shim-Csgwpsv8.mjs";
|
|
8
8
|
import * as React$2 from "react";
|
|
9
9
|
import React__default, { createContext, useContext, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, useEffect as useEffect$2, forwardRef, useState as useState$1, useCallback, useRef as useRef$1, Suspense, createElement, memo as memo$2, useImperativeHandle, Children, isValidElement, cloneElement, Fragment as Fragment$2, useReducer, useId as useId$2, useInsertionEffect as useInsertionEffect$1, Component } from "react";
|
|
10
10
|
var classnames = { exports: {} };
|
|
@@ -11868,25 +11868,6 @@ const Building2 = createLucideIcon("Building2", [
|
|
|
11868
11868
|
["path", { d: "M10 14h4", key: "kelpxr" }],
|
|
11869
11869
|
["path", { d: "M10 18h4", key: "1ulq68" }]
|
|
11870
11870
|
]);
|
|
11871
|
-
/**
|
|
11872
|
-
* @license lucide-react v0.378.0 - ISC
|
|
11873
|
-
*
|
|
11874
|
-
* This source code is licensed under the ISC license.
|
|
11875
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11876
|
-
*/
|
|
11877
|
-
const Building = createLucideIcon("Building", [
|
|
11878
|
-
["rect", { width: "16", height: "20", x: "4", y: "2", rx: "2", ry: "2", key: "76otgf" }],
|
|
11879
|
-
["path", { d: "M9 22v-4h6v4", key: "r93iot" }],
|
|
11880
|
-
["path", { d: "M8 6h.01", key: "1dz90k" }],
|
|
11881
|
-
["path", { d: "M16 6h.01", key: "1x0f13" }],
|
|
11882
|
-
["path", { d: "M12 6h.01", key: "1vi96p" }],
|
|
11883
|
-
["path", { d: "M12 10h.01", key: "1nrarc" }],
|
|
11884
|
-
["path", { d: "M12 14h.01", key: "1etili" }],
|
|
11885
|
-
["path", { d: "M16 10h.01", key: "1m94wz" }],
|
|
11886
|
-
["path", { d: "M16 14h.01", key: "1gbofw" }],
|
|
11887
|
-
["path", { d: "M8 10h.01", key: "19clt8" }],
|
|
11888
|
-
["path", { d: "M8 14h.01", key: "6423bh" }]
|
|
11889
|
-
]);
|
|
11890
11871
|
/**
|
|
11891
11872
|
* @license lucide-react v0.378.0 - ISC
|
|
11892
11873
|
*
|
|
@@ -12059,16 +12040,6 @@ const ExternalLink = createLucideIcon("ExternalLink", [
|
|
|
12059
12040
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
12060
12041
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
12061
12042
|
]);
|
|
12062
|
-
/**
|
|
12063
|
-
* @license lucide-react v0.378.0 - ISC
|
|
12064
|
-
*
|
|
12065
|
-
* This source code is licensed under the ISC license.
|
|
12066
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12067
|
-
*/
|
|
12068
|
-
const Eye = createLucideIcon("Eye", [
|
|
12069
|
-
["path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z", key: "rwhkz3" }],
|
|
12070
|
-
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
12071
|
-
]);
|
|
12072
12043
|
/**
|
|
12073
12044
|
* @license lucide-react v0.378.0 - ISC
|
|
12074
12045
|
*
|
|
@@ -12200,21 +12171,6 @@ const Hammer = createLucideIcon("Hammer", [
|
|
|
12200
12171
|
}
|
|
12201
12172
|
]
|
|
12202
12173
|
]);
|
|
12203
|
-
/**
|
|
12204
|
-
* @license lucide-react v0.378.0 - ISC
|
|
12205
|
-
*
|
|
12206
|
-
* This source code is licensed under the ISC license.
|
|
12207
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12208
|
-
*/
|
|
12209
|
-
const Heart = createLucideIcon("Heart", [
|
|
12210
|
-
[
|
|
12211
|
-
"path",
|
|
12212
|
-
{
|
|
12213
|
-
d: "M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",
|
|
12214
|
-
key: "c3ymky"
|
|
12215
|
-
}
|
|
12216
|
-
]
|
|
12217
|
-
]);
|
|
12218
12174
|
/**
|
|
12219
12175
|
* @license lucide-react v0.378.0 - ISC
|
|
12220
12176
|
*
|
|
@@ -40858,7 +40814,6 @@ const styles$l = {
|
|
|
40858
40814
|
error: error$1,
|
|
40859
40815
|
closeBtn
|
|
40860
40816
|
};
|
|
40861
|
-
const SourcegraphIcon = "data:image/svg+xml,%3csvg%20viewBox='0%200%2052%2052'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M30.8%2051.8c-2.8.5-5.5-1.3-6-4.1L17.2%206.2c-.5-2.8%201.3-5.5%204.1-6s5.5%201.3%206%204.1l7.6%2041.5c.5%202.8-1.4%205.5-4.1%206z'%20fill='%23FF5543'/%3e%3cpath%20d='M10.9%2044.7C9.1%2045%207.3%2044.4%206%2043c-1.8-2.2-1.6-5.4.6-7.2L38.7%208.5c2.2-1.8%205.4-1.6%207.2.6%201.8%202.2%201.6%205.4-.6%207.2l-32%2027.3c-.7.6-1.6%201-2.4%201.1z'%20fill='%23A112FF'/%3e%3cpath%20d='M46.8%2038.1c-.9.2-1.8.1-2.6-.2L4.4%2023.8c-2.7-1-4.1-3.9-3.1-6.6%201-2.7%203.9-4.1%206.6-3.1l39.7%2014.1c2.7%201%204.1%203.9%203.1%206.6-.6%201.8-2.2%203-3.9%203.3z'%20fill='%2300CBEC'/%3e%3c/svg%3e";
|
|
40862
40817
|
const roundedIconStyles = "tw-flex tw-items-center tw-justify-center !tw-rounded-full !tw-p-2 tw-border";
|
|
40863
40818
|
const buttonVariants$1 = cva(
|
|
40864
40819
|
"tw-inline-flex tw-items-center tw-justify-center tw-rounded-md focus-visible:tw-border-ring focus-visible:tw-outline-none disabled:tw-pointer-events-none disabled:tw-opacity-50 tw-gap-3 tw-transition tw-duration-75 tw-cursor-pointer",
|
|
@@ -41591,14 +41546,7 @@ function getTraceparentFromSpanContext(spanContext) {
|
|
|
41591
41546
|
return `00-${spanContext.traceId}-${spanContext.spanId}-${spanContext.traceFlags.toString(16).padStart(2, "0")}`;
|
|
41592
41547
|
}
|
|
41593
41548
|
memo$2(
|
|
41594
|
-
({
|
|
41595
|
-
className,
|
|
41596
|
-
authStatus,
|
|
41597
|
-
vscodeAPI,
|
|
41598
|
-
telemetryRecorder,
|
|
41599
|
-
allowEndpointChange,
|
|
41600
|
-
isPlgEsAccessDisabled: isPlgEsAccessDisabled2
|
|
41601
|
-
}) => {
|
|
41549
|
+
({ className, authStatus, vscodeAPI, telemetryRecorder, allowEndpointChange }) => {
|
|
41602
41550
|
const [formState, setFormState] = useState$1({
|
|
41603
41551
|
showAccessTokenField: false,
|
|
41604
41552
|
isSubmitting: false,
|
|
@@ -41609,21 +41557,21 @@ memo$2(
|
|
|
41609
41557
|
accessToken: ""
|
|
41610
41558
|
}
|
|
41611
41559
|
});
|
|
41612
|
-
const validateEndpointUrl = useCallback(
|
|
41613
|
-
(url)
|
|
41614
|
-
|
|
41615
|
-
|
|
41616
|
-
|
|
41617
|
-
|
|
41618
|
-
return "This instance does not have access to Cody";
|
|
41619
|
-
}
|
|
41620
|
-
return null;
|
|
41621
|
-
} catch {
|
|
41622
|
-
return "Invalid URL format";
|
|
41560
|
+
const validateEndpointUrl = useCallback((url) => {
|
|
41561
|
+
if (!url) return "URL is required";
|
|
41562
|
+
try {
|
|
41563
|
+
const urlObj = new URL(url);
|
|
41564
|
+
if (urlObj.protocol !== "https:" && urlObj.hostname !== "localhost") {
|
|
41565
|
+
return "URL must use HTTPS protocol";
|
|
41623
41566
|
}
|
|
41624
|
-
|
|
41625
|
-
|
|
41626
|
-
|
|
41567
|
+
if (isDotCom({ endpoint: urlObj.href }) || isWorkspaceInstance({ endpoint: urlObj.href })) {
|
|
41568
|
+
return "This instance does not have access to Cody";
|
|
41569
|
+
}
|
|
41570
|
+
return null;
|
|
41571
|
+
} catch {
|
|
41572
|
+
return "Invalid URL format";
|
|
41573
|
+
}
|
|
41574
|
+
}, []);
|
|
41627
41575
|
const handleInputChange = useCallback(
|
|
41628
41576
|
(e2) => {
|
|
41629
41577
|
const { name: name2, value } = e2.target;
|
|
@@ -41689,9 +41637,7 @@ memo$2(
|
|
|
41689
41637
|
disabled: !allowEndpointChange
|
|
41690
41638
|
}
|
|
41691
41639
|
),
|
|
41692
|
-
/* @__PURE__ */ jsx(FormMessage, {
|
|
41693
|
-
/* @__PURE__ */ jsx(FormMessage, { match: "valueMissing", children: "URL is required." }),
|
|
41694
|
-
formState.validationError && /* @__PURE__ */ jsx("div", { className: "tw-text-red-500 tw-text-sm tw-mt-1 tw-font-medium", children: formState.validationError })
|
|
41640
|
+
formState.validationError && /* @__PURE__ */ jsx(FormMessage, { children: formState.validationError })
|
|
41695
41641
|
] }),
|
|
41696
41642
|
/* @__PURE__ */ jsxs(
|
|
41697
41643
|
FormField,
|
|
@@ -71413,14 +71359,7 @@ function useConfig() {
|
|
|
71413
71359
|
return config;
|
|
71414
71360
|
}
|
|
71415
71361
|
function useUserAccountInfo() {
|
|
71416
|
-
const {
|
|
71417
|
-
authStatus,
|
|
71418
|
-
isDotComUser,
|
|
71419
|
-
clientCapabilities,
|
|
71420
|
-
userProductSubscription,
|
|
71421
|
-
siteHasCodyEnabled,
|
|
71422
|
-
currentUserCodySubscription
|
|
71423
|
-
} = useConfig();
|
|
71362
|
+
const { authStatus, clientCapabilities, siteHasCodyEnabled } = useConfig();
|
|
71424
71363
|
if (!authStatus.authenticated) {
|
|
71425
71364
|
throw new Error(
|
|
71426
71365
|
"useUserAccountInfo must be used within a ConfigProvider with authenticated user"
|
|
@@ -71428,23 +71367,11 @@ function useUserAccountInfo() {
|
|
|
71428
71367
|
}
|
|
71429
71368
|
return useMemo$1(
|
|
71430
71369
|
() => ({
|
|
71431
|
-
isCodyProUser: isCodyProUser(authStatus, userProductSubscription ?? null),
|
|
71432
|
-
// Receive this value from the extension backend to make it work
|
|
71433
|
-
// with E2E tests where change the DOTCOM_URL via the env variable CODY_OVERRIDE_DOTCOM_URL.
|
|
71434
|
-
isDotComUser,
|
|
71435
71370
|
user: authStatus,
|
|
71436
71371
|
IDE: clientCapabilities.agentIDE,
|
|
71437
|
-
siteHasCodyEnabled
|
|
71438
|
-
currentUserCodySubscription
|
|
71372
|
+
siteHasCodyEnabled
|
|
71439
71373
|
}),
|
|
71440
|
-
[
|
|
71441
|
-
authStatus,
|
|
71442
|
-
isDotComUser,
|
|
71443
|
-
clientCapabilities,
|
|
71444
|
-
userProductSubscription,
|
|
71445
|
-
siteHasCodyEnabled,
|
|
71446
|
-
currentUserCodySubscription
|
|
71447
|
-
]
|
|
71374
|
+
[authStatus, clientCapabilities, siteHasCodyEnabled]
|
|
71448
71375
|
);
|
|
71449
71376
|
}
|
|
71450
71377
|
const ALLOWED_URI_REGEXP = /^((https?|file|vscode):\/\/[^\s#$./?].\S*$|(command:_?cody.*))/i;
|
|
@@ -80908,21 +80835,14 @@ const styles$g = {
|
|
|
80908
80835
|
requestErrorTitle,
|
|
80909
80836
|
errorContent
|
|
80910
80837
|
};
|
|
80911
|
-
const ErrorItem = ({ error: error2,
|
|
80838
|
+
const ErrorItem = ({ error: error2, postMessage, humanMessage }) => {
|
|
80912
80839
|
if (typeof error2 !== "string" && error2.name === RateLimitError.errorName && postMessage) {
|
|
80913
|
-
return /* @__PURE__ */ jsx(
|
|
80914
|
-
RateLimitErrorItem,
|
|
80915
|
-
{
|
|
80916
|
-
error: error2,
|
|
80917
|
-
userInfo,
|
|
80918
|
-
postMessage
|
|
80919
|
-
}
|
|
80920
|
-
);
|
|
80840
|
+
return /* @__PURE__ */ jsx(RateLimitErrorItem, { error: error2, postMessage });
|
|
80921
80841
|
}
|
|
80922
80842
|
return /* @__PURE__ */ jsx(RequestErrorItem, { error: error2, humanMessage });
|
|
80923
80843
|
};
|
|
80924
80844
|
const RequestErrorItem = ({ error: error2, humanMessage }) => {
|
|
80925
|
-
const errorMessage =
|
|
80845
|
+
const errorMessage = error2.message || (error2.name ? `${error2.name}: ${error2.cause}` : "Unknown Error");
|
|
80926
80846
|
const isApiVersionError = errorMessage.includes("unable to determine Cody API version");
|
|
80927
80847
|
const actions2 = isApiVersionError && humanMessage ? [
|
|
80928
80848
|
{
|
|
@@ -80948,22 +80868,15 @@ const RequestErrorItem = ({ error: error2, humanMessage }) => {
|
|
|
80948
80868
|
] }) }, label)) }) }) })
|
|
80949
80869
|
] });
|
|
80950
80870
|
};
|
|
80951
|
-
const RateLimitErrorItem = ({ error: error2,
|
|
80952
|
-
const isEnterpriseUser = userInfo.isDotComUser !== true;
|
|
80953
|
-
const canUpgrade = error2.upgradeIsAvailable && !(userInfo == null ? void 0 : userInfo.isCodyProUser);
|
|
80954
|
-
const tier = isEnterpriseUser ? "enterprise" : canUpgrade ? "free" : "pro";
|
|
80871
|
+
const RateLimitErrorItem = ({ error: error2, postMessage }) => {
|
|
80955
80872
|
const telemetryRecorder = useMemo$1(() => createWebviewTelemetryRecorder(postMessage), [postMessage]);
|
|
80956
80873
|
React__default.useEffect(() => {
|
|
80957
|
-
telemetryRecorder.recordEvent(
|
|
80958
|
-
|
|
80959
|
-
|
|
80960
|
-
|
|
80961
|
-
privateMetadata: {
|
|
80962
|
-
limit_type: "chat_commands",
|
|
80963
|
-
tier
|
|
80964
|
-
}
|
|
80874
|
+
telemetryRecorder.recordEvent("cody.abuseUsageLimitCTA", "shown", {
|
|
80875
|
+
privateMetadata: {
|
|
80876
|
+
limit_type: "chat_commands",
|
|
80877
|
+
tier: "enterprise"
|
|
80965
80878
|
}
|
|
80966
|
-
);
|
|
80879
|
+
});
|
|
80967
80880
|
}, [telemetryRecorder]);
|
|
80968
80881
|
const onButtonClick = useCallback(
|
|
80969
80882
|
(page, call_to_action) => {
|
|
@@ -80971,12 +80884,12 @@ const RateLimitErrorItem = ({ error: error2, userInfo, postMessage }) => {
|
|
|
80971
80884
|
privateMetadata: {
|
|
80972
80885
|
limit_type: "chat_commands",
|
|
80973
80886
|
call_to_action,
|
|
80974
|
-
tier
|
|
80887
|
+
tier: "enterprise"
|
|
80975
80888
|
}
|
|
80976
80889
|
});
|
|
80977
80890
|
postMessage({ command: "show-page", page });
|
|
80978
80891
|
},
|
|
80979
|
-
[postMessage,
|
|
80892
|
+
[postMessage, telemetryRecorder]
|
|
80980
80893
|
);
|
|
80981
80894
|
let ctaText = "Unable to Send Message";
|
|
80982
80895
|
const fallbackToFlash = useFeatureFlag(FeatureFlag.FallbackToFlash);
|
|
@@ -81066,7 +80979,6 @@ const AssistantMessageCell = memo$2(
|
|
|
81066
80979
|
message: message2,
|
|
81067
80980
|
models,
|
|
81068
80981
|
humanMessage,
|
|
81069
|
-
userInfo,
|
|
81070
80982
|
chatEnabled,
|
|
81071
80983
|
chatCodeHighlightingEnabled,
|
|
81072
80984
|
isLoading,
|
|
@@ -81099,7 +81011,6 @@ const AssistantMessageCell = memo$2(
|
|
|
81099
81011
|
ErrorItem,
|
|
81100
81012
|
{
|
|
81101
81013
|
error: message2.error,
|
|
81102
|
-
userInfo,
|
|
81103
81014
|
postMessage,
|
|
81104
81015
|
humanMessage
|
|
81105
81016
|
}
|
|
@@ -81322,48 +81233,6 @@ const styles$e = {
|
|
|
81322
81233
|
focused: focused$1,
|
|
81323
81234
|
editorContentEditable: editorContentEditable$1
|
|
81324
81235
|
};
|
|
81325
|
-
const CodyLogo = ({ size: size2, ...props }) => /* @__PURE__ */ jsxs(
|
|
81326
|
-
"svg",
|
|
81327
|
-
{
|
|
81328
|
-
width: size2,
|
|
81329
|
-
height: size2,
|
|
81330
|
-
viewBox: "0 0 25 25",
|
|
81331
|
-
fill: "none",
|
|
81332
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
81333
|
-
role: "img",
|
|
81334
|
-
"aria-label": "Cody logo",
|
|
81335
|
-
...props,
|
|
81336
|
-
children: [
|
|
81337
|
-
/* @__PURE__ */ jsx(
|
|
81338
|
-
"path",
|
|
81339
|
-
{
|
|
81340
|
-
fillRule: "evenodd",
|
|
81341
|
-
clipRule: "evenodd",
|
|
81342
|
-
d: "M17.799 -1.0423e-07C19.1159 -4.66655e-08 20.1835 1.06758 20.1835 2.38451L20.1835 6.62365C20.1835 7.94058 19.1159 9.00816 17.799 9.00816C16.482 9.00816 15.4144 7.94058 15.4144 6.62365L15.4144 2.38451C15.4144 1.06758 16.482 -1.61795e-07 17.799 -1.0423e-07Z",
|
|
81343
|
-
fill: "#FF5543"
|
|
81344
|
-
}
|
|
81345
|
-
),
|
|
81346
|
-
/* @__PURE__ */ jsx(
|
|
81347
|
-
"path",
|
|
81348
|
-
{
|
|
81349
|
-
fillRule: "evenodd",
|
|
81350
|
-
clipRule: "evenodd",
|
|
81351
|
-
d: "M2.6969 5.56396C2.6969 4.24703 3.76448 3.17944 5.08141 3.17944H9.32055C10.6375 3.17944 11.7051 4.24703 11.7051 5.56396C11.7051 6.88089 10.6375 7.94847 9.32055 7.94847H5.08141C3.76448 7.94847 2.6969 6.88089 2.6969 5.56396Z",
|
|
81352
|
-
fill: "#A112FF"
|
|
81353
|
-
}
|
|
81354
|
-
),
|
|
81355
|
-
/* @__PURE__ */ jsx(
|
|
81356
|
-
"path",
|
|
81357
|
-
{
|
|
81358
|
-
fillRule: "evenodd",
|
|
81359
|
-
clipRule: "evenodd",
|
|
81360
|
-
d: "M23.4979 12.5055C24.3466 13.3117 24.381 14.6533 23.5748 15.502L22.8246 16.2917C16.9538 22.4715 7.05634 22.3175 1.38065 15.9582C0.601182 15.0848 0.677291 13.745 1.55064 12.9655C2.424 12.186 3.76387 12.2621 4.54334 13.1355C8.5685 17.6455 15.5877 17.7546 19.7512 13.372L20.5014 12.5823C21.3077 11.7336 22.6493 11.6992 23.4979 12.5055Z",
|
|
81361
|
-
fill: "#00CBEC"
|
|
81362
|
-
}
|
|
81363
|
-
)
|
|
81364
|
-
]
|
|
81365
|
-
}
|
|
81366
|
-
);
|
|
81367
81236
|
const CodyLogoBW = ({ size: size2, ...props }) => /* @__PURE__ */ jsxs(
|
|
81368
81237
|
"svg",
|
|
81369
81238
|
{
|
|
@@ -81961,7 +81830,6 @@ const ModelSelectField = ({
|
|
|
81961
81830
|
models,
|
|
81962
81831
|
onModelSelect: parentOnModelSelect,
|
|
81963
81832
|
serverSentModelsEnabled,
|
|
81964
|
-
userInfo,
|
|
81965
81833
|
onCloseByEscape,
|
|
81966
81834
|
className,
|
|
81967
81835
|
intent,
|
|
@@ -81972,17 +81840,10 @@ const ModelSelectField = ({
|
|
|
81972
81840
|
var _a2;
|
|
81973
81841
|
const telemetryRecorder = useTelemetryRecorder();
|
|
81974
81842
|
const selectedModel = models[0];
|
|
81975
|
-
const isCodyProUser2 = userInfo.isDotComUser && userInfo.isCodyProUser;
|
|
81976
|
-
const isEnterpriseUser = !userInfo.isDotComUser;
|
|
81977
|
-
const showCodyProBadge = !isEnterpriseUser && !isCodyProUser2;
|
|
81978
81843
|
const onModelSelect = useCallback(
|
|
81979
81844
|
(model) => {
|
|
81980
81845
|
if (selectedModel.id !== model.id) {
|
|
81981
81846
|
telemetryRecorder.recordEvent("cody.modelSelector", "select", {
|
|
81982
|
-
metadata: {
|
|
81983
|
-
modelIsCodyProOnly: isCodyProModel(model) ? 1 : 0,
|
|
81984
|
-
isCodyProUser: isCodyProUser2 ? 1 : 0
|
|
81985
|
-
},
|
|
81986
81847
|
privateMetadata: {
|
|
81987
81848
|
modelId: model.id,
|
|
81988
81849
|
modelProvider: model.provider,
|
|
@@ -81994,30 +81855,17 @@ const ModelSelectField = ({
|
|
|
81994
81855
|
}
|
|
81995
81856
|
});
|
|
81996
81857
|
}
|
|
81997
|
-
if (showCodyProBadge && isCodyProModel(model)) {
|
|
81998
|
-
getVSCodeAPI().postMessage({
|
|
81999
|
-
command: "links",
|
|
82000
|
-
value: "https://sourcegraph.com/cody/subscription"
|
|
82001
|
-
});
|
|
82002
|
-
return;
|
|
82003
|
-
}
|
|
82004
81858
|
parentOnModelSelect(model);
|
|
82005
81859
|
},
|
|
82006
|
-
[
|
|
82007
|
-
selectedModel,
|
|
82008
|
-
telemetryRecorder.recordEvent,
|
|
82009
|
-
showCodyProBadge,
|
|
82010
|
-
parentOnModelSelect,
|
|
82011
|
-
isCodyProUser2
|
|
82012
|
-
]
|
|
81860
|
+
[selectedModel, telemetryRecorder.recordEvent, parentOnModelSelect]
|
|
82013
81861
|
);
|
|
82014
|
-
const readOnly = !
|
|
81862
|
+
const readOnly = !serverSentModelsEnabled;
|
|
82015
81863
|
const onOpenChange = useCallback(
|
|
82016
81864
|
(open) => {
|
|
82017
81865
|
if (open) {
|
|
82018
81866
|
telemetryRecorder.recordEvent("cody.modelSelector", "open", {
|
|
82019
81867
|
metadata: {
|
|
82020
|
-
isCodyProUser:
|
|
81868
|
+
isCodyProUser: 0,
|
|
82021
81869
|
totalModels: models.length
|
|
82022
81870
|
},
|
|
82023
81871
|
billingMetadata: {
|
|
@@ -82027,11 +81875,11 @@ const ModelSelectField = ({
|
|
|
82027
81875
|
});
|
|
82028
81876
|
}
|
|
82029
81877
|
},
|
|
82030
|
-
[telemetryRecorder.recordEvent,
|
|
81878
|
+
[telemetryRecorder.recordEvent, models.length]
|
|
82031
81879
|
);
|
|
82032
81880
|
const options = useMemo$1(
|
|
82033
81881
|
() => models.map((m2) => {
|
|
82034
|
-
const availability = modelAvailability(
|
|
81882
|
+
const availability = modelAvailability(serverSentModelsEnabled, m2, intent);
|
|
82035
81883
|
if (availability === "needs-cody-pro") {
|
|
82036
81884
|
return void 0;
|
|
82037
81885
|
}
|
|
@@ -82053,7 +81901,7 @@ const ModelSelectField = ({
|
|
|
82053
81901
|
tooltip: getTooltip(m2, availability)
|
|
82054
81902
|
};
|
|
82055
81903
|
}).filter(Boolean),
|
|
82056
|
-
[models,
|
|
81904
|
+
[models, serverSentModelsEnabled, intent]
|
|
82057
81905
|
);
|
|
82058
81906
|
const optionsByGroup = useMemo$1(() => {
|
|
82059
81907
|
return optionByGroup(options);
|
|
@@ -82150,43 +81998,6 @@ const ModelSelectField = ({
|
|
|
82150
81998
|
) })
|
|
82151
81999
|
]
|
|
82152
82000
|
}
|
|
82153
|
-
) }),
|
|
82154
|
-
userInfo.isDotComUser && /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
|
|
82155
|
-
CommandLink,
|
|
82156
|
-
{
|
|
82157
|
-
href: ENTERPRISE_MODEL_DOCS_PAGE,
|
|
82158
|
-
target: "_blank",
|
|
82159
|
-
rel: "noreferrer",
|
|
82160
|
-
onSelect: () => {
|
|
82161
|
-
telemetryRecorder.recordEvent(
|
|
82162
|
-
"cody.modelSelector",
|
|
82163
|
-
"clickEnterpriseModelOption",
|
|
82164
|
-
{
|
|
82165
|
-
billingMetadata: {
|
|
82166
|
-
product: "cody",
|
|
82167
|
-
category: "billable"
|
|
82168
|
-
}
|
|
82169
|
-
}
|
|
82170
|
-
);
|
|
82171
|
-
},
|
|
82172
|
-
className: styles$c.modelTitleWithIcon,
|
|
82173
|
-
children: [
|
|
82174
|
-
/* @__PURE__ */ jsxs("span", { className: styles$c.modelIcon, children: [
|
|
82175
|
-
/* @__PURE__ */ jsx(Building, { size: 16, strokeWidth: 2 }),
|
|
82176
|
-
" "
|
|
82177
|
-
] }),
|
|
82178
|
-
/* @__PURE__ */ jsx("span", { className: styles$c.modelName, children: "Enterprise Model Options" }),
|
|
82179
|
-
/* @__PURE__ */ jsx("span", { className: styles$c.rightIcon, children: /* @__PURE__ */ jsx(
|
|
82180
|
-
ExternalLink,
|
|
82181
|
-
{
|
|
82182
|
-
size: 16,
|
|
82183
|
-
strokeWidth: 1.25,
|
|
82184
|
-
className: "tw-opacity-80"
|
|
82185
|
-
}
|
|
82186
|
-
) })
|
|
82187
|
-
]
|
|
82188
|
-
},
|
|
82189
|
-
"enterprise-model-options"
|
|
82190
82001
|
) })
|
|
82191
82002
|
]
|
|
82192
82003
|
}
|
|
@@ -82206,17 +82017,13 @@ const ModelSelectField = ({
|
|
|
82206
82017
|
}
|
|
82207
82018
|
);
|
|
82208
82019
|
};
|
|
82209
|
-
|
|
82210
|
-
function modelAvailability(userInfo, serverSentModelsEnabled, model, intent) {
|
|
82020
|
+
function modelAvailability(serverSentModelsEnabled, model, intent) {
|
|
82211
82021
|
if (model.disabled) {
|
|
82212
82022
|
return "not-selectable-on-enterprise";
|
|
82213
82023
|
}
|
|
82214
|
-
if (!
|
|
82024
|
+
if (!serverSentModelsEnabled) {
|
|
82215
82025
|
return "not-selectable-on-enterprise";
|
|
82216
82026
|
}
|
|
82217
|
-
if (isCodyProModel(model) && userInfo.isDotComUser && !userInfo.isCodyProUser) {
|
|
82218
|
-
return "needs-cody-pro";
|
|
82219
|
-
}
|
|
82220
82027
|
if (intent === "agentic" && !model.tags.includes(ModelTag.Default)) {
|
|
82221
82028
|
return "not-selectable-on-enterprise";
|
|
82222
82029
|
}
|
|
@@ -82226,12 +82033,6 @@ function getTooltip(model, availability) {
|
|
|
82226
82033
|
if (model.id.includes(DeepCodyAgentID)) {
|
|
82227
82034
|
return "Agentic chat reflects on your request and uses tools to dynamically retrieve relevant context, improving accuracy and response quality.";
|
|
82228
82035
|
}
|
|
82229
|
-
if (model.tags.includes(ModelTag.Waitlist)) {
|
|
82230
|
-
return "Request access to this new model";
|
|
82231
|
-
}
|
|
82232
|
-
if (model.tags.includes(ModelTag.OnWaitlist)) {
|
|
82233
|
-
return "Request received, we will reach out with next steps";
|
|
82234
|
-
}
|
|
82235
82036
|
if (model.disabled) {
|
|
82236
82037
|
return "This model is currently unavailable due to rate limiting. Please try a faster model.";
|
|
82237
82038
|
}
|
|
@@ -82247,8 +82048,6 @@ const getBadgeText = (model) => {
|
|
|
82247
82048
|
const tagToText = {
|
|
82248
82049
|
[ModelTag.Internal]: "Internal",
|
|
82249
82050
|
[ModelTag.Experimental]: "Experimental",
|
|
82250
|
-
[ModelTag.Waitlist]: "Join Waitlist",
|
|
82251
|
-
[ModelTag.OnWaitlist]: "On Waitlist",
|
|
82252
82051
|
[ModelTag.EarlyAccess]: "Early Access",
|
|
82253
82052
|
[ModelTag.Recommended]: "Recommended",
|
|
82254
82053
|
[ModelTag.Deprecated]: "Deprecated",
|
|
@@ -82547,7 +82346,7 @@ const PromptList = (props) => {
|
|
|
82547
82346
|
promptFilters
|
|
82548
82347
|
} = props;
|
|
82549
82348
|
const { clientCapabilities, authStatus } = useConfig();
|
|
82550
|
-
const endpointURL = new URL(authStatus.endpoint);
|
|
82349
|
+
const endpointURL = authStatus.endpoint ? new URL(authStatus.endpoint) : void 0;
|
|
82551
82350
|
const telemetryRecorder = useTelemetryRecorder();
|
|
82552
82351
|
const [lastUsedActions = {}] = useLocalStorage("last-used-actions-v2", {});
|
|
82553
82352
|
const telemetryPublicMetadata = {
|
|
@@ -82680,7 +82479,7 @@ const PromptList = (props) => {
|
|
|
82680
82479
|
/* @__PURE__ */ jsx(
|
|
82681
82480
|
"a",
|
|
82682
82481
|
{
|
|
82683
|
-
href: new URL("/prompts/new", endpointURL).toString(),
|
|
82482
|
+
href: endpointURL ? new URL("/prompts/new", endpointURL).toString() : "#",
|
|
82684
82483
|
target: "_blank",
|
|
82685
82484
|
rel: "noreferrer",
|
|
82686
82485
|
children: "Add a prompt"
|
|
@@ -82702,7 +82501,7 @@ const PromptList = (props) => {
|
|
|
82702
82501
|
/* @__PURE__ */ jsx(CommandSeparator, { alwaysRender: true }),
|
|
82703
82502
|
/* @__PURE__ */ jsxs(CommandLoading, { className: "tw-px-4", children: [
|
|
82704
82503
|
"Prompt Library is not yet available on ",
|
|
82705
|
-
endpointURL.hostname,
|
|
82504
|
+
endpointURL == null ? void 0 : endpointURL.hostname,
|
|
82706
82505
|
". Ask your site admin to upgrade to Sourcegraph 5.6 or later."
|
|
82707
82506
|
] })
|
|
82708
82507
|
] }),
|
|
@@ -83259,11 +83058,11 @@ const INTENT_MAPPING = {
|
|
|
83259
83058
|
insert: "Insert"
|
|
83260
83059
|
/* Insert */
|
|
83261
83060
|
};
|
|
83262
|
-
const ModeSelectorField = ({ className, _intent = "chat", manuallySelectIntent }) => {
|
|
83061
|
+
const ModeSelectorField = ({ className, _intent = "chat", manuallySelectIntent, userInfo }) => {
|
|
83263
83062
|
const {
|
|
83264
83063
|
clientCapabilities: { edit }
|
|
83265
83064
|
} = useConfig();
|
|
83266
|
-
const agenticChatEnabled = useFeatureFlag(FeatureFlag.NextAgenticChatInternal);
|
|
83065
|
+
const agenticChatEnabled = useFeatureFlag(FeatureFlag.NextAgenticChatInternal) && userInfo.IDE !== CodyIDE.Web;
|
|
83267
83066
|
const intentOptions = useMemo$1(() => {
|
|
83268
83067
|
const isEditEnabled = edit !== "none";
|
|
83269
83068
|
return [
|
|
@@ -83405,7 +83204,6 @@ const SubmitButton = ({ onClick, state = "submittable" }) => {
|
|
|
83405
83204
|
) });
|
|
83406
83205
|
};
|
|
83407
83206
|
const Toolbar = ({
|
|
83408
|
-
userInfo,
|
|
83409
83207
|
isEditorFocused,
|
|
83410
83208
|
onSubmitClick,
|
|
83411
83209
|
submitState,
|
|
@@ -83417,7 +83215,8 @@ const Toolbar = ({
|
|
|
83417
83215
|
intent,
|
|
83418
83216
|
extensionAPI,
|
|
83419
83217
|
onMediaUpload,
|
|
83420
|
-
setLastManuallySelectedIntent
|
|
83218
|
+
setLastManuallySelectedIntent,
|
|
83219
|
+
userInfo
|
|
83421
83220
|
}) => {
|
|
83422
83221
|
const onMaybeGapClick = useCallback(
|
|
83423
83222
|
(event) => {
|
|
@@ -83431,13 +83230,10 @@ const Toolbar = ({
|
|
|
83431
83230
|
[onGapClick]
|
|
83432
83231
|
);
|
|
83433
83232
|
const isImageUploadEnabled = useMemo$1(() => {
|
|
83434
|
-
var _a2
|
|
83435
|
-
const isDotCom2 = userInfo == null ? void 0 : userInfo.isDotComUser;
|
|
83233
|
+
var _a2;
|
|
83436
83234
|
const selectedModel = models == null ? void 0 : models[0];
|
|
83437
|
-
|
|
83438
|
-
|
|
83439
|
-
return (!isDotCom2 || isBYOK) && isVision;
|
|
83440
|
-
}, [userInfo == null ? void 0 : userInfo.isDotComUser, models == null ? void 0 : models[0]]);
|
|
83235
|
+
return (_a2 = selectedModel == null ? void 0 : selectedModel.tags) == null ? void 0 : _a2.includes(ModelTag.Vision);
|
|
83236
|
+
}, [models == null ? void 0 : models[0]]);
|
|
83441
83237
|
const modelSelectorRef = useRef$1(null);
|
|
83442
83238
|
const promptSelectorRef = useRef$1(null);
|
|
83443
83239
|
useEffect$2(() => {
|
|
@@ -83495,16 +83291,14 @@ const Toolbar = ({
|
|
|
83495
83291
|
{
|
|
83496
83292
|
className,
|
|
83497
83293
|
_intent: intent,
|
|
83498
|
-
|
|
83499
|
-
|
|
83500
|
-
manuallySelectIntent: setLastManuallySelectedIntent
|
|
83294
|
+
manuallySelectIntent: setLastManuallySelectedIntent,
|
|
83295
|
+
userInfo
|
|
83501
83296
|
}
|
|
83502
83297
|
),
|
|
83503
83298
|
(models == null ? void 0 : models.length) >= 2 && /* @__PURE__ */ jsx(
|
|
83504
83299
|
ModelSelectFieldToolbarItem,
|
|
83505
83300
|
{
|
|
83506
83301
|
models,
|
|
83507
|
-
userInfo,
|
|
83508
83302
|
focusEditor,
|
|
83509
83303
|
modelSelectorRef,
|
|
83510
83304
|
className: "tw-mr-1",
|
|
@@ -83538,7 +83332,7 @@ const PromptSelectFieldToolbarItem = ({ focusEditor, className, promptSelectorRe
|
|
|
83538
83332
|
}
|
|
83539
83333
|
);
|
|
83540
83334
|
};
|
|
83541
|
-
const ModelSelectFieldToolbarItem = ({
|
|
83335
|
+
const ModelSelectFieldToolbarItem = ({ focusEditor, className, models, extensionAPI, modelSelectorRef, intent }) => {
|
|
83542
83336
|
const clientConfig = useClientConfig();
|
|
83543
83337
|
const serverSentModelsEnabled = !!(clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled);
|
|
83544
83338
|
const agenticModel = useMemo$1(() => models.find((m2) => m2.tags.includes(ModelTag.Default)), [models]);
|
|
@@ -83559,13 +83353,12 @@ const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className, models,
|
|
|
83559
83353
|
},
|
|
83560
83354
|
[extensionAPI.setChatModel, focusEditor]
|
|
83561
83355
|
);
|
|
83562
|
-
return !!(models == null ? void 0 : models.length) &&
|
|
83356
|
+
return !!(models == null ? void 0 : models.length) && serverSentModelsEnabled && /* @__PURE__ */ jsx(
|
|
83563
83357
|
ModelSelectField,
|
|
83564
83358
|
{
|
|
83565
83359
|
models,
|
|
83566
83360
|
onModelSelect,
|
|
83567
83361
|
serverSentModelsEnabled,
|
|
83568
|
-
userInfo,
|
|
83569
83362
|
className,
|
|
83570
83363
|
"data-testid": "chat-model-selector",
|
|
83571
83364
|
modelSelectorRef,
|
|
@@ -83579,7 +83372,6 @@ const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className, models,
|
|
|
83579
83372
|
};
|
|
83580
83373
|
const HumanMessageEditor = ({
|
|
83581
83374
|
models,
|
|
83582
|
-
userInfo,
|
|
83583
83375
|
initialEditorState,
|
|
83584
83376
|
placeholder: placeholder2,
|
|
83585
83377
|
isFirstMessage,
|
|
@@ -83596,7 +83388,8 @@ const HumanMessageEditor = ({
|
|
|
83596
83388
|
__storybook__focus,
|
|
83597
83389
|
onEditorFocusChange: parentOnEditorFocusChange,
|
|
83598
83390
|
selectedIntent,
|
|
83599
|
-
manuallySelectIntent
|
|
83391
|
+
manuallySelectIntent,
|
|
83392
|
+
userInfo
|
|
83600
83393
|
}) => {
|
|
83601
83394
|
var _a2, _b, _c;
|
|
83602
83395
|
const telemetryRecorder = useTelemetryRecorder();
|
|
@@ -83876,7 +83669,6 @@ const HumanMessageEditor = ({
|
|
|
83876
83669
|
Toolbar,
|
|
83877
83670
|
{
|
|
83878
83671
|
models,
|
|
83879
|
-
userInfo,
|
|
83880
83672
|
isEditorFocused: focused2,
|
|
83881
83673
|
onSubmitClick,
|
|
83882
83674
|
submitState,
|
|
@@ -83887,7 +83679,8 @@ const HumanMessageEditor = ({
|
|
|
83887
83679
|
intent: selectedIntent,
|
|
83888
83680
|
extensionAPI,
|
|
83889
83681
|
onMediaUpload,
|
|
83890
|
-
setLastManuallySelectedIntent: manuallySelectIntent
|
|
83682
|
+
setLastManuallySelectedIntent: manuallySelectIntent,
|
|
83683
|
+
userInfo
|
|
83891
83684
|
}
|
|
83892
83685
|
)
|
|
83893
83686
|
]
|
|
@@ -83910,7 +83703,6 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83910
83703
|
const {
|
|
83911
83704
|
models,
|
|
83912
83705
|
initialEditorState,
|
|
83913
|
-
userInfo,
|
|
83914
83706
|
chatEnabled = true,
|
|
83915
83707
|
isFirstMessage,
|
|
83916
83708
|
isSent,
|
|
@@ -83926,7 +83718,8 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83926
83718
|
__storybook__focus,
|
|
83927
83719
|
onEditorFocusChange,
|
|
83928
83720
|
manuallySelectIntent,
|
|
83929
|
-
intent
|
|
83721
|
+
intent,
|
|
83722
|
+
userInfo
|
|
83930
83723
|
} = props;
|
|
83931
83724
|
return /* @__PURE__ */ jsx(
|
|
83932
83725
|
BaseMessageCell,
|
|
@@ -83935,7 +83728,6 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83935
83728
|
HumanMessageEditor,
|
|
83936
83729
|
{
|
|
83937
83730
|
models,
|
|
83938
|
-
userInfo,
|
|
83939
83731
|
initialEditorState,
|
|
83940
83732
|
placeholder: isFirstMessage ? "Ask anything. Use @ to specify context..." : "Use @ to add more context...",
|
|
83941
83733
|
isFirstMessage,
|
|
@@ -83952,7 +83744,8 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83952
83744
|
__storybook__focus,
|
|
83953
83745
|
onEditorFocusChange,
|
|
83954
83746
|
selectedIntent: intent,
|
|
83955
|
-
manuallySelectIntent
|
|
83747
|
+
manuallySelectIntent,
|
|
83748
|
+
userInfo
|
|
83956
83749
|
}
|
|
83957
83750
|
),
|
|
83958
83751
|
className,
|
|
@@ -86603,7 +86396,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86603
86396
|
isLastInteraction,
|
|
86604
86397
|
isLastSentInteraction,
|
|
86605
86398
|
priorAssistantMessageIsLoading,
|
|
86606
|
-
userInfo,
|
|
86607
86399
|
chatEnabled,
|
|
86608
86400
|
chatCodeHighlightingEnabled,
|
|
86609
86401
|
postMessage,
|
|
@@ -86611,7 +86403,8 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86611
86403
|
insertButtonOnSubmit,
|
|
86612
86404
|
copyButtonOnSubmit,
|
|
86613
86405
|
smartApply,
|
|
86614
|
-
editorRef: parentEditorRef
|
|
86406
|
+
editorRef: parentEditorRef,
|
|
86407
|
+
userInfo
|
|
86615
86408
|
} = props;
|
|
86616
86409
|
const { activeChatContext, setActiveChatContext } = props;
|
|
86617
86410
|
const humanEditorRef = useRef$1(null);
|
|
@@ -86627,50 +86420,44 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86627
86420
|
const onUserAction = useCallback(
|
|
86628
86421
|
(action, manuallySelectedIntent) => {
|
|
86629
86422
|
var _a2, _b;
|
|
86630
|
-
|
|
86631
|
-
|
|
86632
|
-
|
|
86633
|
-
|
|
86634
|
-
|
|
86635
|
-
|
|
86636
|
-
|
|
86637
|
-
"startSubmit.mark": startMark.startTime
|
|
86638
|
-
}
|
|
86639
|
-
});
|
|
86640
|
-
if (!span) {
|
|
86641
|
-
throw new Error("Failed to start span for chat interaction");
|
|
86642
|
-
}
|
|
86643
|
-
const spanContext = trace.setSpan(context$1.active(), span);
|
|
86644
|
-
setActiveChatContext(spanContext);
|
|
86645
|
-
const currentSpanContext = span.spanContext();
|
|
86646
|
-
const traceparent = getTraceparentFromSpanContext(currentSpanContext);
|
|
86647
|
-
const editorValue = (_a2 = humanEditorRef.current) == null ? void 0 : _a2.getSerializedValue();
|
|
86648
|
-
if (!editorValue) {
|
|
86649
|
-
console.error("Failed to serialize editor value");
|
|
86650
|
-
return;
|
|
86423
|
+
const startMark = performance.mark("startSubmit");
|
|
86424
|
+
const spanManager2 = new SpanManager("cody-webview");
|
|
86425
|
+
const span = spanManager2.startSpan("chat-interaction", {
|
|
86426
|
+
attributes: {
|
|
86427
|
+
sampled: true,
|
|
86428
|
+
"render.state": "started",
|
|
86429
|
+
"startSubmit.mark": startMark.startTime
|
|
86651
86430
|
}
|
|
86652
|
-
|
|
86653
|
-
|
|
86654
|
-
|
|
86655
|
-
|
|
86656
|
-
|
|
86657
|
-
|
|
86658
|
-
|
|
86659
|
-
|
|
86660
|
-
|
|
86661
|
-
|
|
86662
|
-
|
|
86663
|
-
|
|
86664
|
-
|
|
86665
|
-
|
|
86666
|
-
|
|
86667
|
-
|
|
86668
|
-
|
|
86669
|
-
|
|
86670
|
-
|
|
86431
|
+
});
|
|
86432
|
+
if (!span) {
|
|
86433
|
+
throw new Error("Failed to start span for chat interaction");
|
|
86434
|
+
}
|
|
86435
|
+
const spanContext = trace.setSpan(context$1.active(), span);
|
|
86436
|
+
setActiveChatContext(spanContext);
|
|
86437
|
+
const currentSpanContext = span.spanContext();
|
|
86438
|
+
const traceparent = getTraceparentFromSpanContext(currentSpanContext);
|
|
86439
|
+
const editorValue = (_a2 = humanEditorRef.current) == null ? void 0 : _a2.getSerializedValue();
|
|
86440
|
+
if (!editorValue) {
|
|
86441
|
+
console.error("Failed to serialize editor value");
|
|
86442
|
+
return;
|
|
86443
|
+
}
|
|
86444
|
+
const commonProps = {
|
|
86445
|
+
editorValue,
|
|
86446
|
+
traceparent,
|
|
86447
|
+
manuallySelectedIntent
|
|
86448
|
+
};
|
|
86449
|
+
if (action === "edit") {
|
|
86450
|
+
if (isLastSentInteraction) {
|
|
86451
|
+
(_b = lastEditorRef.current) == null ? void 0 : _b.filterMentions((item2) => !isCodeSearchContextItem(item2));
|
|
86671
86452
|
}
|
|
86672
|
-
|
|
86673
|
-
|
|
86453
|
+
editHumanMessage({
|
|
86454
|
+
messageIndexInTranscript: humanMessage.index,
|
|
86455
|
+
...commonProps
|
|
86456
|
+
});
|
|
86457
|
+
} else {
|
|
86458
|
+
submitHumanMessage({
|
|
86459
|
+
...commonProps
|
|
86460
|
+
});
|
|
86674
86461
|
}
|
|
86675
86462
|
},
|
|
86676
86463
|
[humanMessage, setActiveChatContext, isLastSentInteraction, lastEditorRef]
|
|
@@ -86856,7 +86643,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86856
86643
|
/* @__PURE__ */ jsx(
|
|
86857
86644
|
HumanMessageCell,
|
|
86858
86645
|
{
|
|
86859
|
-
userInfo,
|
|
86860
86646
|
models,
|
|
86861
86647
|
chatEnabled,
|
|
86862
86648
|
message: humanMessage,
|
|
@@ -86871,7 +86657,8 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86871
86657
|
editorRef: humanEditorRef,
|
|
86872
86658
|
className: "tw-transition",
|
|
86873
86659
|
intent: selectedIntent,
|
|
86874
|
-
manuallySelectIntent: setSelectedIntent
|
|
86660
|
+
manuallySelectIntent: setSelectedIntent,
|
|
86661
|
+
userInfo
|
|
86875
86662
|
},
|
|
86876
86663
|
humanMessage.index
|
|
86877
86664
|
),
|
|
@@ -86903,7 +86690,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86903
86690
|
assistantMessage && (!isContextLoading || assistantMessage.subMessages && assistantMessage.subMessages.length > 0) && /* @__PURE__ */ jsx(
|
|
86904
86691
|
AssistantMessageCell,
|
|
86905
86692
|
{
|
|
86906
|
-
userInfo,
|
|
86907
86693
|
models,
|
|
86908
86694
|
chatEnabled,
|
|
86909
86695
|
chatCodeHighlightingEnabled,
|
|
@@ -87001,8 +86787,7 @@ const Chat = ({
|
|
|
87001
86787
|
guardrails,
|
|
87002
86788
|
showWelcomeMessage = true,
|
|
87003
86789
|
showIDESnippetActions = true,
|
|
87004
|
-
setView
|
|
87005
|
-
isWorkspacesUpgradeCtaEnabled
|
|
86790
|
+
setView
|
|
87006
86791
|
}) => {
|
|
87007
86792
|
const transcriptRef = useRef$1(transcript);
|
|
87008
86793
|
transcriptRef.current = transcript;
|
|
@@ -87214,17 +86999,10 @@ const StorageWarningBanner = ({ extensionAPI, vscodeAPI }) => {
|
|
|
87214
86999
|
);
|
|
87215
87000
|
};
|
|
87216
87001
|
const storageKey = "DismissedWelcomeNotices";
|
|
87217
|
-
const
|
|
87218
|
-
ENTERPRISE_STARTER_WITH_CODY: "Cody in Enterprise Starter is being sunset. You can continue using Cody until July 23rd. Your code indexing and code search capabilities will not be affected. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
|
|
87219
|
-
ENTERPRISE_STARTER_WITHOUT_CODY: "Cody in Enterprise Starter is being sunset. Because you signed up after 6/25, your account doesn't have Cody, we encourage you to try Amp, Sourcegraph's new agentic coding tool.",
|
|
87220
|
-
PRO_USER: "Cody Pro is being sunset. You can continue using Cody until July 23rd, and your subscription will not renew. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
|
|
87221
|
-
FREE_USER_WITH_CODY: "Cody Free is being sunset. You can continue using Cody until July 23rd. We encourage you to try Amp, Sourcegraph's new agentic coding tool.",
|
|
87222
|
-
FREE_USER_WITHOUT_CODY: "Cody Free is being sunset. Because you signed up after 6/25, your account doesn't have Cody. We encourage you to try Amp, Sourcegraph's new agentic coding tool."
|
|
87223
|
-
};
|
|
87224
|
-
const Notices = ({ user, instanceNotices }) => {
|
|
87002
|
+
const Notices = ({ instanceNotices }) => {
|
|
87225
87003
|
const telemetryRecorder = useTelemetryRecorder();
|
|
87226
87004
|
const [dismissedNotices, setDismissedNotices] = useLocalStorage(storageKey, "");
|
|
87227
|
-
const [
|
|
87005
|
+
const [_2, setSessionDismissedNotices] = useState$1([]);
|
|
87228
87006
|
const dismissNotice = useCallback(
|
|
87229
87007
|
(noticeId, type = "permanent") => {
|
|
87230
87008
|
if (type === "permanent") {
|
|
@@ -87238,203 +87016,34 @@ const Notices = ({ user, instanceNotices }) => {
|
|
|
87238
87016
|
},
|
|
87239
87017
|
[telemetryRecorder, setDismissedNotices]
|
|
87240
87018
|
);
|
|
87241
|
-
const getCodyDeprecationMessage = useCallback(() => {
|
|
87242
|
-
var _a2;
|
|
87243
|
-
if (isWorkspaceInstance(user.user.endpoint)) {
|
|
87244
|
-
const hasCodyEnabled = user.siteHasCodyEnabled === true;
|
|
87245
|
-
if (hasCodyEnabled) {
|
|
87246
|
-
return CODY_DEPRECATION_MESSAGES.ENTERPRISE_STARTER_WITH_CODY;
|
|
87247
|
-
}
|
|
87248
|
-
return CODY_DEPRECATION_MESSAGES.ENTERPRISE_STARTER_WITHOUT_CODY;
|
|
87249
|
-
}
|
|
87250
|
-
if (user.isCodyProUser) {
|
|
87251
|
-
return CODY_DEPRECATION_MESSAGES.PRO_USER;
|
|
87252
|
-
}
|
|
87253
|
-
const hasSubscription = user.currentUserCodySubscription !== null && user.currentUserCodySubscription !== void 0;
|
|
87254
|
-
if (hasSubscription && ((_a2 = user.currentUserCodySubscription) == null ? void 0 : _a2.status) !== "CANCELED") {
|
|
87255
|
-
return CODY_DEPRECATION_MESSAGES.FREE_USER_WITH_CODY;
|
|
87256
|
-
}
|
|
87257
|
-
return CODY_DEPRECATION_MESSAGES.FREE_USER_WITHOUT_CODY;
|
|
87258
|
-
}, [user]);
|
|
87259
87019
|
const notices = useMemo$1(
|
|
87260
|
-
() =>
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87272
|
-
|
|
87273
|
-
|
|
87274
|
-
|
|
87275
|
-
/**
|
|
87276
|
-
* Cody Deprecation Notice
|
|
87277
|
-
*/
|
|
87278
|
-
{
|
|
87279
|
-
id: "CodyDeprecation",
|
|
87280
|
-
isVisible: user.isDotComUser || isWorkspaceInstance(user.user.endpoint),
|
|
87281
|
-
content: /* @__PURE__ */ jsx(
|
|
87282
|
-
NoticeContent,
|
|
87283
|
-
{
|
|
87284
|
-
id: "CodyDeprecation",
|
|
87285
|
-
variant: "default",
|
|
87286
|
-
title: "Important Notice",
|
|
87287
|
-
message: getCodyDeprecationMessage(),
|
|
87288
|
-
onDismiss: () => dismissNotice("CodyDeprecation", "sessional"),
|
|
87289
|
-
actions: [
|
|
87290
|
-
{
|
|
87291
|
-
label: "Try Amp",
|
|
87292
|
-
variant: "default",
|
|
87293
|
-
href: "https://ampcode.com"
|
|
87294
|
-
},
|
|
87295
|
-
{
|
|
87296
|
-
label: "Learn more",
|
|
87297
|
-
variant: "ghost",
|
|
87298
|
-
href: "https://sourcegraph.com/blog/changes-to-cody-free-pro-and-enterprise-starter-plans"
|
|
87299
|
-
}
|
|
87300
|
-
]
|
|
87301
|
-
}
|
|
87302
|
-
)
|
|
87303
|
-
},
|
|
87304
|
-
/**
|
|
87305
|
-
* For Sourcegraph team members who are using Sourcegraph.com to remind them that we want to be dogfooding S2.
|
|
87306
|
-
*/
|
|
87307
|
-
{
|
|
87308
|
-
id: "DogfoodS2",
|
|
87309
|
-
isVisible: user.isDotComUser && ((_a2 = user.user.organizations) == null ? void 0 : _a2.some((org) => org.name === "sourcegraph")) && user.IDE !== CodyIDE.Web,
|
|
87310
|
-
content: /* @__PURE__ */ jsx(
|
|
87311
|
-
NoticeContent,
|
|
87312
|
-
{
|
|
87313
|
-
id: "DogfoodS2",
|
|
87314
|
-
variant: "warning",
|
|
87315
|
-
title: "",
|
|
87316
|
-
message: "Sourcegraph team members should use S2 not dotcom (except when testing dotcom-specific behavior) so that we dogfood our enterprise customer experience.",
|
|
87317
|
-
onDismiss: () => dismissNotice("DogfoodS2", "sessional"),
|
|
87318
|
-
actions: [
|
|
87319
|
-
{
|
|
87320
|
-
label: "Switch to S2",
|
|
87321
|
-
onClick: () => getVSCodeAPI().postMessage({
|
|
87322
|
-
command: "auth",
|
|
87323
|
-
authKind: "switch",
|
|
87324
|
-
endpoint: S2_URL.href
|
|
87325
|
-
}),
|
|
87326
|
-
variant: "default",
|
|
87327
|
-
icon: /* @__PURE__ */ jsx(ArrowLeftRight, { size: 14 }),
|
|
87328
|
-
iconPosition: "end"
|
|
87329
|
-
},
|
|
87330
|
-
{
|
|
87331
|
-
label: "Dismiss",
|
|
87332
|
-
onClick: () => dismissNotice("DogfoodS2", "sessional"),
|
|
87333
|
-
variant: "secondary"
|
|
87334
|
-
}
|
|
87335
|
-
]
|
|
87336
|
-
}
|
|
87337
|
-
)
|
|
87338
|
-
}
|
|
87339
|
-
];
|
|
87340
|
-
},
|
|
87341
|
-
[user, dismissNotice, instanceNotices, getCodyDeprecationMessage]
|
|
87020
|
+
() => [
|
|
87021
|
+
...instanceNotices.map((notice) => ({
|
|
87022
|
+
id: notice.key,
|
|
87023
|
+
isVisible: true,
|
|
87024
|
+
content: /* @__PURE__ */ jsx(
|
|
87025
|
+
MarkdownNotice,
|
|
87026
|
+
{
|
|
87027
|
+
title: notice.title,
|
|
87028
|
+
content: notice.message,
|
|
87029
|
+
onDismiss: () => dismissNotice(notice.key)
|
|
87030
|
+
}
|
|
87031
|
+
)
|
|
87032
|
+
}))
|
|
87033
|
+
],
|
|
87034
|
+
[dismissNotice, instanceNotices]
|
|
87342
87035
|
);
|
|
87343
87036
|
const activeNotice = useMemo$1(
|
|
87344
87037
|
() => notices.find((notice) => {
|
|
87345
|
-
if (notice.id === "DogfoodS2" || notice.id === "CodyDeprecation") {
|
|
87346
|
-
return notice.isVisible && !sessionDismissedNotices.includes(notice.id);
|
|
87347
|
-
}
|
|
87348
87038
|
return notice.isVisible && !(dismissedNotices == null ? void 0 : dismissedNotices.includes(notice.id));
|
|
87349
87039
|
}),
|
|
87350
|
-
[dismissedNotices,
|
|
87040
|
+
[dismissedNotices, notices]
|
|
87351
87041
|
);
|
|
87352
87042
|
if (!activeNotice) {
|
|
87353
87043
|
return null;
|
|
87354
87044
|
}
|
|
87355
87045
|
return /* @__PURE__ */ jsx("div", { className: "tw-flex tw-flex-col tw-mx-2 tw-my-2 tw-p-2 tw-gap-2", children: activeNotice.content });
|
|
87356
87046
|
};
|
|
87357
|
-
const NoticeContent = ({
|
|
87358
|
-
variant,
|
|
87359
|
-
title: title2,
|
|
87360
|
-
message: message2,
|
|
87361
|
-
actions: actions2,
|
|
87362
|
-
id: id2,
|
|
87363
|
-
info,
|
|
87364
|
-
footer: footer2,
|
|
87365
|
-
onDismiss
|
|
87366
|
-
}) => {
|
|
87367
|
-
const telemetryRecorder = useTelemetryRecorder();
|
|
87368
|
-
const bgColor = {
|
|
87369
|
-
default: "tw-bg-accent tw-bg-opacity-50 tw-text-accent-foreground",
|
|
87370
|
-
warning: "tw-bg-red-700 tw-text-white"
|
|
87371
|
-
}[variant];
|
|
87372
|
-
const header2 = {
|
|
87373
|
-
DeepCodyDotCom: /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(CodyLogo, { size: 16 }) }),
|
|
87374
|
-
DeepCodyEnterprise: /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(CodyLogo, { size: 16 }) }),
|
|
87375
|
-
DogfoodS2: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
87376
|
-
/* @__PURE__ */ jsx(Eye, {}),
|
|
87377
|
-
/* @__PURE__ */ jsx(Heart, {}),
|
|
87378
|
-
/* @__PURE__ */ jsx(Building, {})
|
|
87379
|
-
] }),
|
|
87380
|
-
TeamsUpgrade: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
87381
|
-
/* @__PURE__ */ jsx(CodyLogo, { size: 16 }),
|
|
87382
|
-
/* @__PURE__ */ jsx(ArrowRight, { size: 16 }),
|
|
87383
|
-
/* @__PURE__ */ jsx("img", { src: SourcegraphIcon, alt: "Sourcegraph Logo", className: "tw-h-[16px]" })
|
|
87384
|
-
] }),
|
|
87385
|
-
CodyDeprecation: null
|
|
87386
|
-
}[id2];
|
|
87387
|
-
return /* @__PURE__ */ jsxs(
|
|
87388
|
-
"aside",
|
|
87389
|
-
{
|
|
87390
|
-
className: `tw-w-full tw-relative tw-rounded-md tw-flex tw-flex-col tw-gap-2 tw-p-4 ${bgColor}`,
|
|
87391
|
-
children: [
|
|
87392
|
-
/* @__PURE__ */ jsx("div", { className: "tw-flex tw-gap-3 tw-mb-2", children: header2 }),
|
|
87393
|
-
title2 && /* @__PURE__ */ jsx("h1", { className: "tw-text-lg tw-font-semibold", children: title2 }),
|
|
87394
|
-
info && /* @__PURE__ */ jsxs("p", { className: "tw-mb-2", children: [
|
|
87395
|
-
"ⓘ ",
|
|
87396
|
-
info
|
|
87397
|
-
] }),
|
|
87398
|
-
/* @__PURE__ */ jsx("p", { children: message2 }),
|
|
87399
|
-
/* @__PURE__ */ jsx("div", { className: "tw-mt-3 tw-flex tw-gap-3", children: actions2.map((action, _index) => /* @__PURE__ */ jsxs(
|
|
87400
|
-
Button,
|
|
87401
|
-
{
|
|
87402
|
-
variant: action.variant,
|
|
87403
|
-
size: "sm",
|
|
87404
|
-
onClick: () => {
|
|
87405
|
-
var _a2;
|
|
87406
|
-
(_a2 = action.onClick) == null ? void 0 : _a2.call(action);
|
|
87407
|
-
telemetryRecorder.recordEvent("cody.notice.cta", "clicked", {
|
|
87408
|
-
privateMetadata: {
|
|
87409
|
-
noticeId: id2,
|
|
87410
|
-
title: action.label
|
|
87411
|
-
}
|
|
87412
|
-
});
|
|
87413
|
-
},
|
|
87414
|
-
className: "tw-flex tw-gap-1",
|
|
87415
|
-
children: [
|
|
87416
|
-
action.iconPosition === "start" && action.icon,
|
|
87417
|
-
action.href ? /* @__PURE__ */ jsx(
|
|
87418
|
-
"a",
|
|
87419
|
-
{
|
|
87420
|
-
href: action.href,
|
|
87421
|
-
target: "_blank",
|
|
87422
|
-
rel: "noreferrer",
|
|
87423
|
-
className: "tw-text-inherit hover:!tw-text-inherit",
|
|
87424
|
-
children: action.label
|
|
87425
|
-
}
|
|
87426
|
-
) : /* @__PURE__ */ jsx("span", { children: action.label }),
|
|
87427
|
-
action.iconPosition === "end" && action.icon
|
|
87428
|
-
]
|
|
87429
|
-
},
|
|
87430
|
-
action.label + "-button"
|
|
87431
|
-
)) }),
|
|
87432
|
-
footer2 && /* @__PURE__ */ jsx("p", { className: "tw-mt-2", children: footer2 }),
|
|
87433
|
-
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onDismiss, className: "tw-absolute tw-top-2 tw-right-2", children: /* @__PURE__ */ jsx(X$2, { size: "14" }) })
|
|
87434
|
-
]
|
|
87435
|
-
}
|
|
87436
|
-
);
|
|
87437
|
-
};
|
|
87438
87047
|
const MarkdownNotice = (props) => {
|
|
87439
87048
|
const { title: title2, content: content2, onDismiss } = props;
|
|
87440
87049
|
const message2 = content2.length > 240 ? `${content2.slice(0, 240)}...` : content2;
|
|
@@ -87859,7 +87468,7 @@ const StateDebugOverlayInner = ({
|
|
|
87859
87468
|
{ id: "resolvedConfig", value: resolvedConfig },
|
|
87860
87469
|
{
|
|
87861
87470
|
id: "authStatus",
|
|
87862
|
-
title: `authStatus ${authStatus ? `(${new URL(authStatus.endpoint).hostname})` : "(undefined)"}`,
|
|
87471
|
+
title: `authStatus ${(authStatus == null ? void 0 : authStatus.endpoint) ? `(${new URL(authStatus.endpoint).hostname})` : "(undefined)"}`,
|
|
87863
87472
|
value: authStatus
|
|
87864
87473
|
},
|
|
87865
87474
|
{ id: "modelsData", value: modelsData },
|
|
@@ -89097,7 +88706,6 @@ const UserMenu = ({
|
|
|
89097
88706
|
onCloseByEscape,
|
|
89098
88707
|
allowEndpointChange,
|
|
89099
88708
|
__storybook__open,
|
|
89100
|
-
isWorkspacesUpgradeCtaEnabled,
|
|
89101
88709
|
IDE,
|
|
89102
88710
|
setTabView
|
|
89103
88711
|
}) => {
|
|
@@ -89114,26 +88722,22 @@ const UserMenu = ({
|
|
|
89114
88722
|
accessToken: ""
|
|
89115
88723
|
});
|
|
89116
88724
|
const [validationError, setValidationError] = useState$1("");
|
|
89117
|
-
const
|
|
89118
|
-
|
|
89119
|
-
(
|
|
89120
|
-
|
|
89121
|
-
|
|
89122
|
-
|
|
89123
|
-
|
|
89124
|
-
|
|
89125
|
-
setValidationError("This instance does not have access to Cody");
|
|
89126
|
-
} else {
|
|
89127
|
-
setValidationError("");
|
|
89128
|
-
}
|
|
89129
|
-
} catch {
|
|
88725
|
+
const handleInputChange = useCallback((e2) => {
|
|
88726
|
+
const { name: name2, value } = e2.target;
|
|
88727
|
+
if (name2 === "endpoint") {
|
|
88728
|
+
try {
|
|
88729
|
+
const urlObj = new URL(value);
|
|
88730
|
+
if (isDotCom({ endpoint: urlObj.href }) || isWorkspaceInstance({ endpoint: urlObj.href })) {
|
|
88731
|
+
setValidationError("This instance does not have access to Cody");
|
|
88732
|
+
} else {
|
|
89130
88733
|
setValidationError("");
|
|
89131
88734
|
}
|
|
88735
|
+
} catch {
|
|
88736
|
+
setValidationError("");
|
|
89132
88737
|
}
|
|
89133
|
-
|
|
89134
|
-
}
|
|
89135
|
-
|
|
89136
|
-
);
|
|
88738
|
+
}
|
|
88739
|
+
setAddFormData((prev) => ({ ...prev, [name2]: value }));
|
|
88740
|
+
}, []);
|
|
89137
88741
|
const onAddAndSwitchAccountSubmit = useCallback(
|
|
89138
88742
|
(e2) => {
|
|
89139
88743
|
e2 == null ? void 0 : e2.preventDefault();
|
|
@@ -89637,7 +89241,7 @@ const styles$3 = {
|
|
|
89637
89241
|
const TabsBar = memo$2((props) => {
|
|
89638
89242
|
var _a2;
|
|
89639
89243
|
const { currentView, setView, user, endpointHistory, showOpenInEditor } = props;
|
|
89640
|
-
const {
|
|
89244
|
+
const { IDE } = user;
|
|
89641
89245
|
const tabItems = useTabs({ user });
|
|
89642
89246
|
const {
|
|
89643
89247
|
config: { webviewType, multipleWebviewsEnabled, allowEndpointChange }
|
|
@@ -89725,11 +89329,10 @@ const TabsBar = memo$2((props) => {
|
|
|
89725
89329
|
UserMenu,
|
|
89726
89330
|
{
|
|
89727
89331
|
authStatus: user.user,
|
|
89728
|
-
isProUser:
|
|
89332
|
+
isProUser: false,
|
|
89729
89333
|
endpointHistory,
|
|
89730
89334
|
allowEndpointChange,
|
|
89731
89335
|
className: "!tw-opacity-100 tw-h-full",
|
|
89732
|
-
isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled,
|
|
89733
89336
|
IDE,
|
|
89734
89337
|
setTabView: setView
|
|
89735
89338
|
}
|
|
@@ -89913,7 +89516,7 @@ const TabViewContext = createContext({
|
|
|
89913
89516
|
const CodyPanel = ({
|
|
89914
89517
|
view,
|
|
89915
89518
|
setView,
|
|
89916
|
-
configuration: { config, clientCapabilities
|
|
89519
|
+
configuration: { config, clientCapabilities },
|
|
89917
89520
|
errorMessages,
|
|
89918
89521
|
setErrorMessages,
|
|
89919
89522
|
chatEnabled,
|
|
@@ -89929,7 +89532,6 @@ const CodyPanel = ({
|
|
|
89929
89532
|
onExtensionApiReady,
|
|
89930
89533
|
guardrails
|
|
89931
89534
|
}) => {
|
|
89932
|
-
var _a2;
|
|
89933
89535
|
const tabContainerRef = useRef$1(null);
|
|
89934
89536
|
const user = useUserAccountInfo();
|
|
89935
89537
|
const externalAPI = useExternalAPI();
|
|
@@ -89938,13 +89540,12 @@ const CodyPanel = ({
|
|
|
89938
89540
|
const { value: mcpServers } = useObservable(
|
|
89939
89541
|
useMemo$1(
|
|
89940
89542
|
() => {
|
|
89941
|
-
var
|
|
89942
|
-
return (
|
|
89543
|
+
var _a2;
|
|
89544
|
+
return (_a2 = api2.mcpSettings()) == null ? void 0 : _a2.map((servers) => servers == null ? void 0 : servers.map((s2) => getMcpServerType(s2)));
|
|
89943
89545
|
},
|
|
89944
89546
|
[api2.mcpSettings]
|
|
89945
89547
|
)
|
|
89946
89548
|
);
|
|
89947
|
-
const isWorkspacesUpgradeCtaEnabled = useFeatureFlag(FeatureFlag.SourcegraphTeamsUpgradeCTA) && isDotComUser && ((_a2 = config.endpointHistory) == null ? void 0 : _a2.length) === 1;
|
|
89948
89549
|
useEffect$2(() => {
|
|
89949
89550
|
onExternalApiReady == null ? void 0 : onExternalApiReady(externalAPI);
|
|
89950
89551
|
}, [onExternalApiReady, externalAPI]);
|
|
@@ -89958,10 +89559,10 @@ const CodyPanel = ({
|
|
|
89958
89559
|
}, [onExtensionApiReady, api2]);
|
|
89959
89560
|
useEffect$2(() => {
|
|
89960
89561
|
const subscription = api2.clientActionBroadcast().subscribe((action) => {
|
|
89961
|
-
var
|
|
89562
|
+
var _a2;
|
|
89962
89563
|
switch (action.type) {
|
|
89963
89564
|
case "open-recently-prompts": {
|
|
89964
|
-
(
|
|
89565
|
+
(_a2 = document.querySelector("button[aria-label='Insert prompt']")) == null ? void 0 : _a2.click();
|
|
89965
89566
|
}
|
|
89966
89567
|
}
|
|
89967
89568
|
});
|
|
@@ -89977,7 +89578,7 @@ const CodyPanel = ({
|
|
|
89977
89578
|
orientation: "vertical",
|
|
89978
89579
|
className: styles$l.outerContainer,
|
|
89979
89580
|
children: [
|
|
89980
|
-
/* @__PURE__ */ jsx(Notices, {
|
|
89581
|
+
/* @__PURE__ */ jsx(Notices, { instanceNotices }),
|
|
89981
89582
|
config.webviewType !== "editor" && /* @__PURE__ */ jsx(
|
|
89982
89583
|
TabsBar,
|
|
89983
89584
|
{
|
|
@@ -89985,7 +89586,6 @@ const CodyPanel = ({
|
|
|
89985
89586
|
currentView: view,
|
|
89986
89587
|
setView,
|
|
89987
89588
|
endpointHistory: config.endpointHistory ?? [],
|
|
89988
|
-
isWorkspacesUpgradeCtaEnabled,
|
|
89989
89589
|
showOpenInEditor: !!(config == null ? void 0 : config.multipleWebviewsEnabled)
|
|
89990
89590
|
}
|
|
89991
89591
|
),
|
|
@@ -90011,8 +89611,7 @@ const CodyPanel = ({
|
|
|
90011
89611
|
guardrails,
|
|
90012
89612
|
showIDESnippetActions,
|
|
90013
89613
|
showWelcomeMessage,
|
|
90014
|
-
setView
|
|
90015
|
-
isWorkspacesUpgradeCtaEnabled
|
|
89614
|
+
setView
|
|
90016
89615
|
}
|
|
90017
89616
|
),
|
|
90018
89617
|
view === View.History && /* @__PURE__ */ jsx(
|
|
@@ -90116,22 +89715,18 @@ async function createAgentClient({
|
|
|
90116
89715
|
debug = true,
|
|
90117
89716
|
trace: trace2 = false
|
|
90118
89717
|
}) {
|
|
90119
|
-
console.log("[Cody] Creating agent worker");
|
|
90120
89718
|
const worker = createAgentWorker();
|
|
90121
89719
|
const rpc = browser.createMessageConnection(
|
|
90122
89720
|
new browser.BrowserMessageReader(worker),
|
|
90123
89721
|
new browser.BrowserMessageWriter(worker),
|
|
90124
89722
|
console
|
|
90125
89723
|
);
|
|
90126
|
-
console.log("[Cody] Agent worker is created");
|
|
90127
89724
|
if (trace2) {
|
|
90128
89725
|
rpc.trace(browser.Trace.Verbose, { log: (...args) => console.debug("agent: debug:", ...args) });
|
|
90129
89726
|
}
|
|
90130
89727
|
rpc.onClose(() => {
|
|
90131
|
-
console.log("[Cody] connection closed");
|
|
90132
89728
|
console.error("agent: connection closed");
|
|
90133
89729
|
});
|
|
90134
|
-
console.log("[Cody] Listen for rpc from the agent");
|
|
90135
89730
|
rpc.listen();
|
|
90136
89731
|
rpc.onNotification("debug/message", (message2) => {
|
|
90137
89732
|
if (debug) {
|
|
@@ -90143,11 +89738,10 @@ async function createAgentClient({
|
|
|
90143
89738
|
console.debug("agent: debug:", message2);
|
|
90144
89739
|
}
|
|
90145
89740
|
});
|
|
90146
|
-
console.log("[Cody] Send init agent worker command");
|
|
90147
89741
|
const serverInfo = await rpc.sendRequest("initialize", {
|
|
90148
89742
|
name: "web",
|
|
90149
89743
|
version: "0.0.1",
|
|
90150
|
-
// This is not used in cody web. Instead
|
|
89744
|
+
// This is not used in cody web. Instead we trigger `workspaceFolder/didChange` to notify
|
|
90151
89745
|
// the agent about the current workspace.
|
|
90152
89746
|
workspaceRootUri: "",
|
|
90153
89747
|
capabilities: {
|
|
@@ -90174,13 +89768,11 @@ async function createAgentClient({
|
|
|
90174
89768
|
}
|
|
90175
89769
|
}
|
|
90176
89770
|
});
|
|
90177
|
-
console.log("[Cody] Send success init agent worker command");
|
|
90178
89771
|
await rpc.sendNotification("initialized", null);
|
|
90179
89772
|
return {
|
|
90180
89773
|
rpc,
|
|
90181
89774
|
serverInfo,
|
|
90182
89775
|
dispose() {
|
|
90183
|
-
console.log("[Cody] Worker dispose call");
|
|
90184
89776
|
rpc.end();
|
|
90185
89777
|
worker.terminate();
|
|
90186
89778
|
}
|
|
@@ -90580,29 +90172,53 @@ const CodyWebPanel = (props) => {
|
|
|
90580
90172
|
icon: "search"
|
|
90581
90173
|
});
|
|
90582
90174
|
} else {
|
|
90583
|
-
|
|
90584
|
-
|
|
90585
|
-
|
|
90586
|
-
|
|
90587
|
-
|
|
90588
|
-
|
|
90589
|
-
|
|
90175
|
+
const fileUrl = `/${repository.name}/-/blob/${fileURL}`;
|
|
90176
|
+
const basename2 = fileURL.split("/").pop() || fileURL;
|
|
90177
|
+
const fileContextItem = {
|
|
90178
|
+
type: "openctx",
|
|
90179
|
+
provider: "openctx",
|
|
90180
|
+
title: basename2,
|
|
90181
|
+
description: fileURL,
|
|
90182
|
+
uri: URI.parse(fileUrl),
|
|
90183
|
+
providerUri: REMOTE_FILE_PROVIDER_URI,
|
|
90590
90184
|
source: ContextItemSource.Initial,
|
|
90185
|
+
mention: {
|
|
90186
|
+
uri: fileUrl,
|
|
90187
|
+
data: {
|
|
90188
|
+
repoName: repository.name,
|
|
90189
|
+
rev: "HEAD",
|
|
90190
|
+
filePath: fileURL
|
|
90191
|
+
},
|
|
90192
|
+
description: fileURL
|
|
90193
|
+
},
|
|
90591
90194
|
icon: "file"
|
|
90592
|
-
}
|
|
90195
|
+
};
|
|
90196
|
+
initialContext.push(fileContextItem);
|
|
90593
90197
|
if (initialContextData == null ? void 0 : initialContextData.fileRange) {
|
|
90198
|
+
const rangeUrl = `${fileUrl}?L${initialContextData.fileRange.startLine + 1}:1-${initialContextData.fileRange.endLine + 1}:1`;
|
|
90594
90199
|
initialContext.push({
|
|
90595
|
-
type: "
|
|
90596
|
-
|
|
90597
|
-
title:
|
|
90200
|
+
type: "openctx",
|
|
90201
|
+
provider: "openctx",
|
|
90202
|
+
title: `${basename2} (lines ${initialContextData.fileRange.startLine + 1}-${initialContextData.fileRange.endLine + 1})`,
|
|
90203
|
+
description: `${fileURL}:${initialContextData.fileRange.startLine + 1}-${initialContextData.fileRange.endLine + 1}`,
|
|
90204
|
+
uri: URI.parse(rangeUrl),
|
|
90205
|
+
providerUri: REMOTE_FILE_PROVIDER_URI,
|
|
90598
90206
|
range: {
|
|
90599
90207
|
start: { line: initialContextData.fileRange.startLine, character: 0 },
|
|
90600
90208
|
end: { line: initialContextData.fileRange.endLine + 1, character: 0 }
|
|
90601
90209
|
},
|
|
90602
|
-
repoName: repository.name,
|
|
90603
|
-
remoteRepositoryName: repository.name,
|
|
90604
|
-
uri: URI.file(`${repository.name}/${fileURL}`),
|
|
90605
90210
|
source: ContextItemSource.Initial,
|
|
90211
|
+
mention: {
|
|
90212
|
+
uri: rangeUrl,
|
|
90213
|
+
data: {
|
|
90214
|
+
repoName: repository.name,
|
|
90215
|
+
rev: "HEAD",
|
|
90216
|
+
filePath: fileURL,
|
|
90217
|
+
startLine: initialContextData.fileRange.startLine,
|
|
90218
|
+
endLine: initialContextData.fileRange.endLine
|
|
90219
|
+
},
|
|
90220
|
+
description: `${fileURL}:${initialContextData.fileRange.startLine + 1}-${initialContextData.fileRange.endLine + 1}`
|
|
90221
|
+
},
|
|
90606
90222
|
icon: "list-selection"
|
|
90607
90223
|
});
|
|
90608
90224
|
}
|
|
@@ -90844,6 +90460,6 @@ export {
|
|
|
90844
90460
|
ChatSkeleton,
|
|
90845
90461
|
CodyPromptTemplate,
|
|
90846
90462
|
CodyWebChat,
|
|
90847
|
-
|
|
90848
|
-
|
|
90463
|
+
aQ as deserialize,
|
|
90464
|
+
aP as serialize
|
|
90849
90465
|
};
|