@sourcegraph/cody-web 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent.worker-BKTrW_fZ.mjs → agent.worker-BLjjG8ds.mjs} +288 -389
- package/dist/agent.worker.js +2 -2
- package/dist/{git-log-7kbEzZhk.mjs → git-log-C0C2_x8P.mjs} +1 -1
- package/dist/index.js +155 -288
- package/dist/lib/agent/agent.client.d.ts.map +1 -1
- package/dist/{lite-BobkBW3_.mjs → lite-b2NFi2v9.mjs} +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{util-CCLzYWyF.mjs → util-C44wiTt8.mjs} +1 -1
- package/dist/{vscode-shim-DpWxvTpJ.mjs → vscode-shim-H_ThTWLs.mjs} +3617 -3755
- package/package.json +1 -1
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 isCodyProModel, ao as isMacOS, ap as ToolCodyModelName, aq as CustomCommandType, ar as textContentFromSerializedLexicalNode, as as firstValueFrom, at as skipPendingOperation, au as FAST_CHAT_INPUT_TOKEN_BUDGET, av as webviewOpenURIForContextItem, aw as pluralize, ax as UIToolStatus, ay as getFileDiff, az as diffWithLineNum, aA as UITerminalOutputType, aB as isCodeSearchContextItem, aC as v4, aD as lodashExports, aE as deserializeContextItem, aF as firstResultFromOperation, aG as ChatHistoryType, aH as S2_URL, aI as ACCOUNT_USAGE_URL, aJ as CODY_DOC_QUICKSTART_URL, aK as isPlgEsAccessDisabled, aL as isDefined, aM as browser, aN as CodyAutoSuggestionMode, aO as setDisplayPathEnvInfo, aP as isErrorLike, aQ as PromptString, aR as createGuardrailsImpl, U as Uri } from "./vscode-shim-H_ThTWLs.mjs";
|
|
7
|
+
import { aT, aS } from "./vscode-shim-H_ThTWLs.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: {} };
|
|
@@ -71413,14 +71413,7 @@ function useConfig() {
|
|
|
71413
71413
|
return config;
|
|
71414
71414
|
}
|
|
71415
71415
|
function useUserAccountInfo() {
|
|
71416
|
-
const {
|
|
71417
|
-
authStatus,
|
|
71418
|
-
isDotComUser,
|
|
71419
|
-
clientCapabilities,
|
|
71420
|
-
userProductSubscription,
|
|
71421
|
-
siteHasCodyEnabled,
|
|
71422
|
-
currentUserCodySubscription
|
|
71423
|
-
} = useConfig();
|
|
71416
|
+
const { authStatus, clientCapabilities, siteHasCodyEnabled, currentUserCodySubscription } = useConfig();
|
|
71424
71417
|
if (!authStatus.authenticated) {
|
|
71425
71418
|
throw new Error(
|
|
71426
71419
|
"useUserAccountInfo must be used within a ConfigProvider with authenticated user"
|
|
@@ -71428,23 +71421,12 @@ function useUserAccountInfo() {
|
|
|
71428
71421
|
}
|
|
71429
71422
|
return useMemo$1(
|
|
71430
71423
|
() => ({
|
|
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
71424
|
user: authStatus,
|
|
71436
71425
|
IDE: clientCapabilities.agentIDE,
|
|
71437
71426
|
siteHasCodyEnabled,
|
|
71438
71427
|
currentUserCodySubscription
|
|
71439
71428
|
}),
|
|
71440
|
-
[
|
|
71441
|
-
authStatus,
|
|
71442
|
-
isDotComUser,
|
|
71443
|
-
clientCapabilities,
|
|
71444
|
-
userProductSubscription,
|
|
71445
|
-
siteHasCodyEnabled,
|
|
71446
|
-
currentUserCodySubscription
|
|
71447
|
-
]
|
|
71429
|
+
[authStatus, clientCapabilities, siteHasCodyEnabled, currentUserCodySubscription]
|
|
71448
71430
|
);
|
|
71449
71431
|
}
|
|
71450
71432
|
const ALLOWED_URI_REGEXP = /^((https?|file|vscode):\/\/[^\s#$./?].\S*$|(command:_?cody.*))/i;
|
|
@@ -80908,21 +80890,14 @@ const styles$g = {
|
|
|
80908
80890
|
requestErrorTitle,
|
|
80909
80891
|
errorContent
|
|
80910
80892
|
};
|
|
80911
|
-
const ErrorItem = ({ error: error2,
|
|
80893
|
+
const ErrorItem = ({ error: error2, postMessage, humanMessage }) => {
|
|
80912
80894
|
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
|
-
);
|
|
80895
|
+
return /* @__PURE__ */ jsx(RateLimitErrorItem, { error: error2, postMessage });
|
|
80921
80896
|
}
|
|
80922
80897
|
return /* @__PURE__ */ jsx(RequestErrorItem, { error: error2, humanMessage });
|
|
80923
80898
|
};
|
|
80924
80899
|
const RequestErrorItem = ({ error: error2, humanMessage }) => {
|
|
80925
|
-
const errorMessage =
|
|
80900
|
+
const errorMessage = error2.message || (error2.name ? `${error2.name}: ${error2.cause}` : "Unknown Error");
|
|
80926
80901
|
const isApiVersionError = errorMessage.includes("unable to determine Cody API version");
|
|
80927
80902
|
const actions2 = isApiVersionError && humanMessage ? [
|
|
80928
80903
|
{
|
|
@@ -80948,22 +80923,15 @@ const RequestErrorItem = ({ error: error2, humanMessage }) => {
|
|
|
80948
80923
|
] }) }, label)) }) }) })
|
|
80949
80924
|
] });
|
|
80950
80925
|
};
|
|
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";
|
|
80926
|
+
const RateLimitErrorItem = ({ error: error2, postMessage }) => {
|
|
80955
80927
|
const telemetryRecorder = useMemo$1(() => createWebviewTelemetryRecorder(postMessage), [postMessage]);
|
|
80956
80928
|
React__default.useEffect(() => {
|
|
80957
|
-
telemetryRecorder.recordEvent(
|
|
80958
|
-
|
|
80959
|
-
|
|
80960
|
-
|
|
80961
|
-
privateMetadata: {
|
|
80962
|
-
limit_type: "chat_commands",
|
|
80963
|
-
tier
|
|
80964
|
-
}
|
|
80929
|
+
telemetryRecorder.recordEvent("cody.abuseUsageLimitCTA", "shown", {
|
|
80930
|
+
privateMetadata: {
|
|
80931
|
+
limit_type: "chat_commands",
|
|
80932
|
+
tier: "enterprise"
|
|
80965
80933
|
}
|
|
80966
|
-
);
|
|
80934
|
+
});
|
|
80967
80935
|
}, [telemetryRecorder]);
|
|
80968
80936
|
const onButtonClick = useCallback(
|
|
80969
80937
|
(page, call_to_action) => {
|
|
@@ -80971,12 +80939,12 @@ const RateLimitErrorItem = ({ error: error2, userInfo, postMessage }) => {
|
|
|
80971
80939
|
privateMetadata: {
|
|
80972
80940
|
limit_type: "chat_commands",
|
|
80973
80941
|
call_to_action,
|
|
80974
|
-
tier
|
|
80942
|
+
tier: "enterprise"
|
|
80975
80943
|
}
|
|
80976
80944
|
});
|
|
80977
80945
|
postMessage({ command: "show-page", page });
|
|
80978
80946
|
},
|
|
80979
|
-
[postMessage,
|
|
80947
|
+
[postMessage, telemetryRecorder]
|
|
80980
80948
|
);
|
|
80981
80949
|
let ctaText = "Unable to Send Message";
|
|
80982
80950
|
const fallbackToFlash = useFeatureFlag(FeatureFlag.FallbackToFlash);
|
|
@@ -81066,7 +81034,6 @@ const AssistantMessageCell = memo$2(
|
|
|
81066
81034
|
message: message2,
|
|
81067
81035
|
models,
|
|
81068
81036
|
humanMessage,
|
|
81069
|
-
userInfo,
|
|
81070
81037
|
chatEnabled,
|
|
81071
81038
|
chatCodeHighlightingEnabled,
|
|
81072
81039
|
isLoading,
|
|
@@ -81099,7 +81066,6 @@ const AssistantMessageCell = memo$2(
|
|
|
81099
81066
|
ErrorItem,
|
|
81100
81067
|
{
|
|
81101
81068
|
error: message2.error,
|
|
81102
|
-
userInfo,
|
|
81103
81069
|
postMessage,
|
|
81104
81070
|
humanMessage
|
|
81105
81071
|
}
|
|
@@ -81961,7 +81927,6 @@ const ModelSelectField = ({
|
|
|
81961
81927
|
models,
|
|
81962
81928
|
onModelSelect: parentOnModelSelect,
|
|
81963
81929
|
serverSentModelsEnabled,
|
|
81964
|
-
userInfo,
|
|
81965
81930
|
onCloseByEscape,
|
|
81966
81931
|
className,
|
|
81967
81932
|
intent,
|
|
@@ -81972,16 +81937,13 @@ const ModelSelectField = ({
|
|
|
81972
81937
|
var _a2;
|
|
81973
81938
|
const telemetryRecorder = useTelemetryRecorder();
|
|
81974
81939
|
const selectedModel = models[0];
|
|
81975
|
-
const isCodyProUser2 = userInfo.isDotComUser && userInfo.isCodyProUser;
|
|
81976
|
-
const isEnterpriseUser = !userInfo.isDotComUser;
|
|
81977
|
-
const showCodyProBadge = !isEnterpriseUser && !isCodyProUser2;
|
|
81978
81940
|
const onModelSelect = useCallback(
|
|
81979
81941
|
(model) => {
|
|
81980
81942
|
if (selectedModel.id !== model.id) {
|
|
81981
81943
|
telemetryRecorder.recordEvent("cody.modelSelector", "select", {
|
|
81982
81944
|
metadata: {
|
|
81983
81945
|
modelIsCodyProOnly: isCodyProModel(model) ? 1 : 0,
|
|
81984
|
-
isCodyProUser:
|
|
81946
|
+
isCodyProUser: 0
|
|
81985
81947
|
},
|
|
81986
81948
|
privateMetadata: {
|
|
81987
81949
|
modelId: model.id,
|
|
@@ -81994,30 +81956,17 @@ const ModelSelectField = ({
|
|
|
81994
81956
|
}
|
|
81995
81957
|
});
|
|
81996
81958
|
}
|
|
81997
|
-
if (showCodyProBadge && isCodyProModel(model)) {
|
|
81998
|
-
getVSCodeAPI().postMessage({
|
|
81999
|
-
command: "links",
|
|
82000
|
-
value: "https://sourcegraph.com/cody/subscription"
|
|
82001
|
-
});
|
|
82002
|
-
return;
|
|
82003
|
-
}
|
|
82004
81959
|
parentOnModelSelect(model);
|
|
82005
81960
|
},
|
|
82006
|
-
[
|
|
82007
|
-
selectedModel,
|
|
82008
|
-
telemetryRecorder.recordEvent,
|
|
82009
|
-
showCodyProBadge,
|
|
82010
|
-
parentOnModelSelect,
|
|
82011
|
-
isCodyProUser2
|
|
82012
|
-
]
|
|
81961
|
+
[selectedModel, telemetryRecorder.recordEvent, parentOnModelSelect]
|
|
82013
81962
|
);
|
|
82014
|
-
const readOnly = !
|
|
81963
|
+
const readOnly = !serverSentModelsEnabled;
|
|
82015
81964
|
const onOpenChange = useCallback(
|
|
82016
81965
|
(open) => {
|
|
82017
81966
|
if (open) {
|
|
82018
81967
|
telemetryRecorder.recordEvent("cody.modelSelector", "open", {
|
|
82019
81968
|
metadata: {
|
|
82020
|
-
isCodyProUser:
|
|
81969
|
+
isCodyProUser: 0,
|
|
82021
81970
|
totalModels: models.length
|
|
82022
81971
|
},
|
|
82023
81972
|
billingMetadata: {
|
|
@@ -82027,11 +81976,11 @@ const ModelSelectField = ({
|
|
|
82027
81976
|
});
|
|
82028
81977
|
}
|
|
82029
81978
|
},
|
|
82030
|
-
[telemetryRecorder.recordEvent,
|
|
81979
|
+
[telemetryRecorder.recordEvent, models.length]
|
|
82031
81980
|
);
|
|
82032
81981
|
const options = useMemo$1(
|
|
82033
81982
|
() => models.map((m2) => {
|
|
82034
|
-
const availability = modelAvailability(
|
|
81983
|
+
const availability = modelAvailability(serverSentModelsEnabled, m2, intent);
|
|
82035
81984
|
if (availability === "needs-cody-pro") {
|
|
82036
81985
|
return void 0;
|
|
82037
81986
|
}
|
|
@@ -82053,7 +82002,7 @@ const ModelSelectField = ({
|
|
|
82053
82002
|
tooltip: getTooltip(m2, availability)
|
|
82054
82003
|
};
|
|
82055
82004
|
}).filter(Boolean),
|
|
82056
|
-
[models,
|
|
82005
|
+
[models, serverSentModelsEnabled, intent]
|
|
82057
82006
|
);
|
|
82058
82007
|
const optionsByGroup = useMemo$1(() => {
|
|
82059
82008
|
return optionByGroup(options);
|
|
@@ -82150,43 +82099,6 @@ const ModelSelectField = ({
|
|
|
82150
82099
|
) })
|
|
82151
82100
|
]
|
|
82152
82101
|
}
|
|
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
82102
|
) })
|
|
82191
82103
|
]
|
|
82192
82104
|
}
|
|
@@ -82206,17 +82118,13 @@ const ModelSelectField = ({
|
|
|
82206
82118
|
}
|
|
82207
82119
|
);
|
|
82208
82120
|
};
|
|
82209
|
-
|
|
82210
|
-
function modelAvailability(userInfo, serverSentModelsEnabled, model, intent) {
|
|
82121
|
+
function modelAvailability(serverSentModelsEnabled, model, intent) {
|
|
82211
82122
|
if (model.disabled) {
|
|
82212
82123
|
return "not-selectable-on-enterprise";
|
|
82213
82124
|
}
|
|
82214
|
-
if (!
|
|
82125
|
+
if (!serverSentModelsEnabled) {
|
|
82215
82126
|
return "not-selectable-on-enterprise";
|
|
82216
82127
|
}
|
|
82217
|
-
if (isCodyProModel(model) && userInfo.isDotComUser && !userInfo.isCodyProUser) {
|
|
82218
|
-
return "needs-cody-pro";
|
|
82219
|
-
}
|
|
82220
82128
|
if (intent === "agentic" && !model.tags.includes(ModelTag.Default)) {
|
|
82221
82129
|
return "not-selectable-on-enterprise";
|
|
82222
82130
|
}
|
|
@@ -83405,7 +83313,6 @@ const SubmitButton = ({ onClick, state = "submittable" }) => {
|
|
|
83405
83313
|
) });
|
|
83406
83314
|
};
|
|
83407
83315
|
const Toolbar = ({
|
|
83408
|
-
userInfo,
|
|
83409
83316
|
isEditorFocused,
|
|
83410
83317
|
onSubmitClick,
|
|
83411
83318
|
submitState,
|
|
@@ -83431,13 +83338,10 @@ const Toolbar = ({
|
|
|
83431
83338
|
[onGapClick]
|
|
83432
83339
|
);
|
|
83433
83340
|
const isImageUploadEnabled = useMemo$1(() => {
|
|
83434
|
-
var _a2
|
|
83435
|
-
const isDotCom2 = userInfo == null ? void 0 : userInfo.isDotComUser;
|
|
83341
|
+
var _a2;
|
|
83436
83342
|
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]]);
|
|
83343
|
+
return (_a2 = selectedModel == null ? void 0 : selectedModel.tags) == null ? void 0 : _a2.includes(ModelTag.Vision);
|
|
83344
|
+
}, [models == null ? void 0 : models[0]]);
|
|
83441
83345
|
const modelSelectorRef = useRef$1(null);
|
|
83442
83346
|
const promptSelectorRef = useRef$1(null);
|
|
83443
83347
|
useEffect$2(() => {
|
|
@@ -83495,8 +83399,6 @@ const Toolbar = ({
|
|
|
83495
83399
|
{
|
|
83496
83400
|
className,
|
|
83497
83401
|
_intent: intent,
|
|
83498
|
-
isDotComUser: userInfo == null ? void 0 : userInfo.isDotComUser,
|
|
83499
|
-
isCodyProUser: userInfo == null ? void 0 : userInfo.isCodyProUser,
|
|
83500
83402
|
manuallySelectIntent: setLastManuallySelectedIntent
|
|
83501
83403
|
}
|
|
83502
83404
|
),
|
|
@@ -83504,7 +83406,6 @@ const Toolbar = ({
|
|
|
83504
83406
|
ModelSelectFieldToolbarItem,
|
|
83505
83407
|
{
|
|
83506
83408
|
models,
|
|
83507
|
-
userInfo,
|
|
83508
83409
|
focusEditor,
|
|
83509
83410
|
modelSelectorRef,
|
|
83510
83411
|
className: "tw-mr-1",
|
|
@@ -83538,7 +83439,7 @@ const PromptSelectFieldToolbarItem = ({ focusEditor, className, promptSelectorRe
|
|
|
83538
83439
|
}
|
|
83539
83440
|
);
|
|
83540
83441
|
};
|
|
83541
|
-
const ModelSelectFieldToolbarItem = ({
|
|
83442
|
+
const ModelSelectFieldToolbarItem = ({ focusEditor, className, models, extensionAPI, modelSelectorRef, intent }) => {
|
|
83542
83443
|
const clientConfig = useClientConfig();
|
|
83543
83444
|
const serverSentModelsEnabled = !!(clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled);
|
|
83544
83445
|
const agenticModel = useMemo$1(() => models.find((m2) => m2.tags.includes(ModelTag.Default)), [models]);
|
|
@@ -83559,13 +83460,12 @@ const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className, models,
|
|
|
83559
83460
|
},
|
|
83560
83461
|
[extensionAPI.setChatModel, focusEditor]
|
|
83561
83462
|
);
|
|
83562
|
-
return !!(models == null ? void 0 : models.length) &&
|
|
83463
|
+
return !!(models == null ? void 0 : models.length) && serverSentModelsEnabled && /* @__PURE__ */ jsx(
|
|
83563
83464
|
ModelSelectField,
|
|
83564
83465
|
{
|
|
83565
83466
|
models,
|
|
83566
83467
|
onModelSelect,
|
|
83567
83468
|
serverSentModelsEnabled,
|
|
83568
|
-
userInfo,
|
|
83569
83469
|
className,
|
|
83570
83470
|
"data-testid": "chat-model-selector",
|
|
83571
83471
|
modelSelectorRef,
|
|
@@ -83579,7 +83479,6 @@ const ModelSelectFieldToolbarItem = ({ userInfo, focusEditor, className, models,
|
|
|
83579
83479
|
};
|
|
83580
83480
|
const HumanMessageEditor = ({
|
|
83581
83481
|
models,
|
|
83582
|
-
userInfo,
|
|
83583
83482
|
initialEditorState,
|
|
83584
83483
|
placeholder: placeholder2,
|
|
83585
83484
|
isFirstMessage,
|
|
@@ -83876,7 +83775,6 @@ const HumanMessageEditor = ({
|
|
|
83876
83775
|
Toolbar,
|
|
83877
83776
|
{
|
|
83878
83777
|
models,
|
|
83879
|
-
userInfo,
|
|
83880
83778
|
isEditorFocused: focused2,
|
|
83881
83779
|
onSubmitClick,
|
|
83882
83780
|
submitState,
|
|
@@ -83910,7 +83808,6 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83910
83808
|
const {
|
|
83911
83809
|
models,
|
|
83912
83810
|
initialEditorState,
|
|
83913
|
-
userInfo,
|
|
83914
83811
|
chatEnabled = true,
|
|
83915
83812
|
isFirstMessage,
|
|
83916
83813
|
isSent,
|
|
@@ -83935,7 +83832,6 @@ const HumanMessageCellContent = memo$2((props) => {
|
|
|
83935
83832
|
HumanMessageEditor,
|
|
83936
83833
|
{
|
|
83937
83834
|
models,
|
|
83938
|
-
userInfo,
|
|
83939
83835
|
initialEditorState,
|
|
83940
83836
|
placeholder: isFirstMessage ? "Ask anything. Use @ to specify context..." : "Use @ to add more context...",
|
|
83941
83837
|
isFirstMessage,
|
|
@@ -86603,7 +86499,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86603
86499
|
isLastInteraction,
|
|
86604
86500
|
isLastSentInteraction,
|
|
86605
86501
|
priorAssistantMessageIsLoading,
|
|
86606
|
-
userInfo,
|
|
86607
86502
|
chatEnabled,
|
|
86608
86503
|
chatCodeHighlightingEnabled,
|
|
86609
86504
|
postMessage,
|
|
@@ -86627,50 +86522,44 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86627
86522
|
const onUserAction = useCallback(
|
|
86628
86523
|
(action, manuallySelectedIntent) => {
|
|
86629
86524
|
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;
|
|
86525
|
+
const startMark = performance.mark("startSubmit");
|
|
86526
|
+
const spanManager2 = new SpanManager("cody-webview");
|
|
86527
|
+
const span = spanManager2.startSpan("chat-interaction", {
|
|
86528
|
+
attributes: {
|
|
86529
|
+
sampled: true,
|
|
86530
|
+
"render.state": "started",
|
|
86531
|
+
"startSubmit.mark": startMark.startTime
|
|
86651
86532
|
}
|
|
86652
|
-
|
|
86653
|
-
|
|
86654
|
-
|
|
86655
|
-
|
|
86656
|
-
|
|
86657
|
-
|
|
86658
|
-
|
|
86659
|
-
|
|
86660
|
-
|
|
86661
|
-
|
|
86662
|
-
|
|
86663
|
-
|
|
86664
|
-
|
|
86665
|
-
|
|
86666
|
-
|
|
86667
|
-
|
|
86668
|
-
|
|
86669
|
-
|
|
86670
|
-
|
|
86533
|
+
});
|
|
86534
|
+
if (!span) {
|
|
86535
|
+
throw new Error("Failed to start span for chat interaction");
|
|
86536
|
+
}
|
|
86537
|
+
const spanContext = trace.setSpan(context$1.active(), span);
|
|
86538
|
+
setActiveChatContext(spanContext);
|
|
86539
|
+
const currentSpanContext = span.spanContext();
|
|
86540
|
+
const traceparent = getTraceparentFromSpanContext(currentSpanContext);
|
|
86541
|
+
const editorValue = (_a2 = humanEditorRef.current) == null ? void 0 : _a2.getSerializedValue();
|
|
86542
|
+
if (!editorValue) {
|
|
86543
|
+
console.error("Failed to serialize editor value");
|
|
86544
|
+
return;
|
|
86545
|
+
}
|
|
86546
|
+
const commonProps = {
|
|
86547
|
+
editorValue,
|
|
86548
|
+
traceparent,
|
|
86549
|
+
manuallySelectedIntent
|
|
86550
|
+
};
|
|
86551
|
+
if (action === "edit") {
|
|
86552
|
+
if (isLastSentInteraction) {
|
|
86553
|
+
(_b = lastEditorRef.current) == null ? void 0 : _b.filterMentions((item2) => !isCodeSearchContextItem(item2));
|
|
86671
86554
|
}
|
|
86672
|
-
|
|
86673
|
-
|
|
86555
|
+
editHumanMessage({
|
|
86556
|
+
messageIndexInTranscript: humanMessage.index,
|
|
86557
|
+
...commonProps
|
|
86558
|
+
});
|
|
86559
|
+
} else {
|
|
86560
|
+
submitHumanMessage({
|
|
86561
|
+
...commonProps
|
|
86562
|
+
});
|
|
86674
86563
|
}
|
|
86675
86564
|
},
|
|
86676
86565
|
[humanMessage, setActiveChatContext, isLastSentInteraction, lastEditorRef]
|
|
@@ -86856,7 +86745,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86856
86745
|
/* @__PURE__ */ jsx(
|
|
86857
86746
|
HumanMessageCell,
|
|
86858
86747
|
{
|
|
86859
|
-
userInfo,
|
|
86860
86748
|
models,
|
|
86861
86749
|
chatEnabled,
|
|
86862
86750
|
message: humanMessage,
|
|
@@ -86903,7 +86791,6 @@ const TranscriptInteraction = memo$2((props) => {
|
|
|
86903
86791
|
assistantMessage && (!isContextLoading || assistantMessage.subMessages && assistantMessage.subMessages.length > 0) && /* @__PURE__ */ jsx(
|
|
86904
86792
|
AssistantMessageCell,
|
|
86905
86793
|
{
|
|
86906
|
-
userInfo,
|
|
86907
86794
|
models,
|
|
86908
86795
|
chatEnabled,
|
|
86909
86796
|
chatCodeHighlightingEnabled,
|
|
@@ -87001,8 +86888,7 @@ const Chat = ({
|
|
|
87001
86888
|
guardrails,
|
|
87002
86889
|
showWelcomeMessage = true,
|
|
87003
86890
|
showIDESnippetActions = true,
|
|
87004
|
-
setView
|
|
87005
|
-
isWorkspacesUpgradeCtaEnabled
|
|
86891
|
+
setView
|
|
87006
86892
|
}) => {
|
|
87007
86893
|
const transcriptRef = useRef$1(transcript);
|
|
87008
86894
|
transcriptRef.current = transcript;
|
|
@@ -87247,9 +87133,6 @@ const Notices = ({ user, instanceNotices }) => {
|
|
|
87247
87133
|
}
|
|
87248
87134
|
return CODY_DEPRECATION_MESSAGES.ENTERPRISE_STARTER_WITHOUT_CODY;
|
|
87249
87135
|
}
|
|
87250
|
-
if (user.isCodyProUser) {
|
|
87251
|
-
return CODY_DEPRECATION_MESSAGES.PRO_USER;
|
|
87252
|
-
}
|
|
87253
87136
|
const hasSubscription = user.currentUserCodySubscription !== null && user.currentUserCodySubscription !== void 0;
|
|
87254
87137
|
if (hasSubscription && ((_a2 = user.currentUserCodySubscription) == null ? void 0 : _a2.status) !== "CANCELED") {
|
|
87255
87138
|
return CODY_DEPRECATION_MESSAGES.FREE_USER_WITH_CODY;
|
|
@@ -87257,87 +87140,84 @@ const Notices = ({ user, instanceNotices }) => {
|
|
|
87257
87140
|
return CODY_DEPRECATION_MESSAGES.FREE_USER_WITHOUT_CODY;
|
|
87258
87141
|
}, [user]);
|
|
87259
87142
|
const notices = useMemo$1(
|
|
87260
|
-
() =>
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87272
|
-
|
|
87273
|
-
|
|
87274
|
-
|
|
87275
|
-
|
|
87276
|
-
|
|
87277
|
-
|
|
87278
|
-
|
|
87279
|
-
|
|
87280
|
-
|
|
87281
|
-
|
|
87282
|
-
|
|
87283
|
-
|
|
87284
|
-
|
|
87285
|
-
|
|
87286
|
-
|
|
87287
|
-
|
|
87288
|
-
|
|
87289
|
-
|
|
87290
|
-
|
|
87291
|
-
|
|
87292
|
-
|
|
87293
|
-
|
|
87294
|
-
|
|
87295
|
-
|
|
87296
|
-
|
|
87297
|
-
|
|
87298
|
-
|
|
87299
|
-
|
|
87300
|
-
|
|
87301
|
-
|
|
87302
|
-
|
|
87303
|
-
|
|
87304
|
-
|
|
87305
|
-
|
|
87306
|
-
|
|
87307
|
-
|
|
87308
|
-
|
|
87309
|
-
|
|
87310
|
-
|
|
87311
|
-
|
|
87312
|
-
|
|
87313
|
-
|
|
87314
|
-
|
|
87315
|
-
|
|
87316
|
-
|
|
87317
|
-
|
|
87318
|
-
|
|
87319
|
-
{
|
|
87320
|
-
|
|
87321
|
-
|
|
87322
|
-
|
|
87323
|
-
|
|
87324
|
-
|
|
87325
|
-
|
|
87326
|
-
|
|
87327
|
-
|
|
87328
|
-
|
|
87329
|
-
|
|
87330
|
-
|
|
87331
|
-
|
|
87332
|
-
|
|
87333
|
-
|
|
87334
|
-
|
|
87335
|
-
|
|
87336
|
-
|
|
87337
|
-
|
|
87338
|
-
}
|
|
87339
|
-
];
|
|
87340
|
-
},
|
|
87143
|
+
() => [
|
|
87144
|
+
...instanceNotices.map((notice) => ({
|
|
87145
|
+
id: notice.key,
|
|
87146
|
+
isVisible: true,
|
|
87147
|
+
content: /* @__PURE__ */ jsx(
|
|
87148
|
+
MarkdownNotice,
|
|
87149
|
+
{
|
|
87150
|
+
title: notice.title,
|
|
87151
|
+
content: notice.message,
|
|
87152
|
+
onDismiss: () => dismissNotice(notice.key)
|
|
87153
|
+
}
|
|
87154
|
+
)
|
|
87155
|
+
})),
|
|
87156
|
+
/**
|
|
87157
|
+
* Cody Deprecation Notice
|
|
87158
|
+
*/
|
|
87159
|
+
{
|
|
87160
|
+
id: "CodyDeprecation",
|
|
87161
|
+
isVisible: isWorkspaceInstance(user.user.endpoint),
|
|
87162
|
+
content: /* @__PURE__ */ jsx(
|
|
87163
|
+
NoticeContent,
|
|
87164
|
+
{
|
|
87165
|
+
id: "CodyDeprecation",
|
|
87166
|
+
variant: "default",
|
|
87167
|
+
title: "Important Notice",
|
|
87168
|
+
message: getCodyDeprecationMessage(),
|
|
87169
|
+
onDismiss: () => dismissNotice("CodyDeprecation", "sessional"),
|
|
87170
|
+
actions: [
|
|
87171
|
+
{
|
|
87172
|
+
label: "Try Amp",
|
|
87173
|
+
variant: "default",
|
|
87174
|
+
href: "https://ampcode.com"
|
|
87175
|
+
},
|
|
87176
|
+
{
|
|
87177
|
+
label: "Learn more",
|
|
87178
|
+
variant: "ghost",
|
|
87179
|
+
href: "https://sourcegraph.com/blog/changes-to-cody-free-pro-and-enterprise-starter-plans"
|
|
87180
|
+
}
|
|
87181
|
+
]
|
|
87182
|
+
}
|
|
87183
|
+
)
|
|
87184
|
+
},
|
|
87185
|
+
/**
|
|
87186
|
+
* For Sourcegraph team members who are using Sourcegraph.com to remind them that we want to be dogfooding S2.
|
|
87187
|
+
*/
|
|
87188
|
+
{
|
|
87189
|
+
id: "DogfoodS2",
|
|
87190
|
+
isVisible: false,
|
|
87191
|
+
content: /* @__PURE__ */ jsx(
|
|
87192
|
+
NoticeContent,
|
|
87193
|
+
{
|
|
87194
|
+
id: "DogfoodS2",
|
|
87195
|
+
variant: "warning",
|
|
87196
|
+
title: "",
|
|
87197
|
+
message: "Sourcegraph team members should use S2 not dotcom (except when testing dotcom-specific behavior) so that we dogfood our enterprise customer experience.",
|
|
87198
|
+
onDismiss: () => dismissNotice("DogfoodS2", "sessional"),
|
|
87199
|
+
actions: [
|
|
87200
|
+
{
|
|
87201
|
+
label: "Switch to S2",
|
|
87202
|
+
onClick: () => getVSCodeAPI().postMessage({
|
|
87203
|
+
command: "auth",
|
|
87204
|
+
authKind: "switch",
|
|
87205
|
+
endpoint: S2_URL.href
|
|
87206
|
+
}),
|
|
87207
|
+
variant: "default",
|
|
87208
|
+
icon: /* @__PURE__ */ jsx(ArrowLeftRight, { size: 14 }),
|
|
87209
|
+
iconPosition: "end"
|
|
87210
|
+
},
|
|
87211
|
+
{
|
|
87212
|
+
label: "Dismiss",
|
|
87213
|
+
onClick: () => dismissNotice("DogfoodS2", "sessional"),
|
|
87214
|
+
variant: "secondary"
|
|
87215
|
+
}
|
|
87216
|
+
]
|
|
87217
|
+
}
|
|
87218
|
+
)
|
|
87219
|
+
}
|
|
87220
|
+
],
|
|
87341
87221
|
[user, dismissNotice, instanceNotices, getCodyDeprecationMessage]
|
|
87342
87222
|
);
|
|
87343
87223
|
const activeNotice = useMemo$1(
|
|
@@ -89097,7 +88977,6 @@ const UserMenu = ({
|
|
|
89097
88977
|
onCloseByEscape,
|
|
89098
88978
|
allowEndpointChange,
|
|
89099
88979
|
__storybook__open,
|
|
89100
|
-
isWorkspacesUpgradeCtaEnabled,
|
|
89101
88980
|
IDE,
|
|
89102
88981
|
setTabView
|
|
89103
88982
|
}) => {
|
|
@@ -89637,7 +89516,7 @@ const styles$3 = {
|
|
|
89637
89516
|
const TabsBar = memo$2((props) => {
|
|
89638
89517
|
var _a2;
|
|
89639
89518
|
const { currentView, setView, user, endpointHistory, showOpenInEditor } = props;
|
|
89640
|
-
const {
|
|
89519
|
+
const { IDE } = user;
|
|
89641
89520
|
const tabItems = useTabs({ user });
|
|
89642
89521
|
const {
|
|
89643
89522
|
config: { webviewType, multipleWebviewsEnabled, allowEndpointChange }
|
|
@@ -89725,11 +89604,10 @@ const TabsBar = memo$2((props) => {
|
|
|
89725
89604
|
UserMenu,
|
|
89726
89605
|
{
|
|
89727
89606
|
authStatus: user.user,
|
|
89728
|
-
isProUser:
|
|
89607
|
+
isProUser: false,
|
|
89729
89608
|
endpointHistory,
|
|
89730
89609
|
allowEndpointChange,
|
|
89731
89610
|
className: "!tw-opacity-100 tw-h-full",
|
|
89732
|
-
isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled,
|
|
89733
89611
|
IDE,
|
|
89734
89612
|
setTabView: setView
|
|
89735
89613
|
}
|
|
@@ -89913,7 +89791,7 @@ const TabViewContext = createContext({
|
|
|
89913
89791
|
const CodyPanel = ({
|
|
89914
89792
|
view,
|
|
89915
89793
|
setView,
|
|
89916
|
-
configuration: { config, clientCapabilities
|
|
89794
|
+
configuration: { config, clientCapabilities },
|
|
89917
89795
|
errorMessages,
|
|
89918
89796
|
setErrorMessages,
|
|
89919
89797
|
chatEnabled,
|
|
@@ -89929,7 +89807,6 @@ const CodyPanel = ({
|
|
|
89929
89807
|
onExtensionApiReady,
|
|
89930
89808
|
guardrails
|
|
89931
89809
|
}) => {
|
|
89932
|
-
var _a2;
|
|
89933
89810
|
const tabContainerRef = useRef$1(null);
|
|
89934
89811
|
const user = useUserAccountInfo();
|
|
89935
89812
|
const externalAPI = useExternalAPI();
|
|
@@ -89938,13 +89815,12 @@ const CodyPanel = ({
|
|
|
89938
89815
|
const { value: mcpServers } = useObservable(
|
|
89939
89816
|
useMemo$1(
|
|
89940
89817
|
() => {
|
|
89941
|
-
var
|
|
89942
|
-
return (
|
|
89818
|
+
var _a2;
|
|
89819
|
+
return (_a2 = api2.mcpSettings()) == null ? void 0 : _a2.map((servers) => servers == null ? void 0 : servers.map((s2) => getMcpServerType(s2)));
|
|
89943
89820
|
},
|
|
89944
89821
|
[api2.mcpSettings]
|
|
89945
89822
|
)
|
|
89946
89823
|
);
|
|
89947
|
-
const isWorkspacesUpgradeCtaEnabled = useFeatureFlag(FeatureFlag.SourcegraphTeamsUpgradeCTA) && isDotComUser && ((_a2 = config.endpointHistory) == null ? void 0 : _a2.length) === 1;
|
|
89948
89824
|
useEffect$2(() => {
|
|
89949
89825
|
onExternalApiReady == null ? void 0 : onExternalApiReady(externalAPI);
|
|
89950
89826
|
}, [onExternalApiReady, externalAPI]);
|
|
@@ -89958,10 +89834,10 @@ const CodyPanel = ({
|
|
|
89958
89834
|
}, [onExtensionApiReady, api2]);
|
|
89959
89835
|
useEffect$2(() => {
|
|
89960
89836
|
const subscription = api2.clientActionBroadcast().subscribe((action) => {
|
|
89961
|
-
var
|
|
89837
|
+
var _a2;
|
|
89962
89838
|
switch (action.type) {
|
|
89963
89839
|
case "open-recently-prompts": {
|
|
89964
|
-
(
|
|
89840
|
+
(_a2 = document.querySelector("button[aria-label='Insert prompt']")) == null ? void 0 : _a2.click();
|
|
89965
89841
|
}
|
|
89966
89842
|
}
|
|
89967
89843
|
});
|
|
@@ -89985,7 +89861,6 @@ const CodyPanel = ({
|
|
|
89985
89861
|
currentView: view,
|
|
89986
89862
|
setView,
|
|
89987
89863
|
endpointHistory: config.endpointHistory ?? [],
|
|
89988
|
-
isWorkspacesUpgradeCtaEnabled,
|
|
89989
89864
|
showOpenInEditor: !!(config == null ? void 0 : config.multipleWebviewsEnabled)
|
|
89990
89865
|
}
|
|
89991
89866
|
),
|
|
@@ -90011,8 +89886,7 @@ const CodyPanel = ({
|
|
|
90011
89886
|
guardrails,
|
|
90012
89887
|
showIDESnippetActions,
|
|
90013
89888
|
showWelcomeMessage,
|
|
90014
|
-
setView
|
|
90015
|
-
isWorkspacesUpgradeCtaEnabled
|
|
89889
|
+
setView
|
|
90016
89890
|
}
|
|
90017
89891
|
),
|
|
90018
89892
|
view === View.History && /* @__PURE__ */ jsx(
|
|
@@ -90116,22 +89990,18 @@ async function createAgentClient({
|
|
|
90116
89990
|
debug = true,
|
|
90117
89991
|
trace: trace2 = false
|
|
90118
89992
|
}) {
|
|
90119
|
-
console.log("[Cody] Creating agent worker");
|
|
90120
89993
|
const worker = createAgentWorker();
|
|
90121
89994
|
const rpc = browser.createMessageConnection(
|
|
90122
89995
|
new browser.BrowserMessageReader(worker),
|
|
90123
89996
|
new browser.BrowserMessageWriter(worker),
|
|
90124
89997
|
console
|
|
90125
89998
|
);
|
|
90126
|
-
console.log("[Cody] Agent worker is created");
|
|
90127
89999
|
if (trace2) {
|
|
90128
90000
|
rpc.trace(browser.Trace.Verbose, { log: (...args) => console.debug("agent: debug:", ...args) });
|
|
90129
90001
|
}
|
|
90130
90002
|
rpc.onClose(() => {
|
|
90131
|
-
console.log("[Cody] connection closed");
|
|
90132
90003
|
console.error("agent: connection closed");
|
|
90133
90004
|
});
|
|
90134
|
-
console.log("[Cody] Listen for rpc from the agent");
|
|
90135
90005
|
rpc.listen();
|
|
90136
90006
|
rpc.onNotification("debug/message", (message2) => {
|
|
90137
90007
|
if (debug) {
|
|
@@ -90143,11 +90013,10 @@ async function createAgentClient({
|
|
|
90143
90013
|
console.debug("agent: debug:", message2);
|
|
90144
90014
|
}
|
|
90145
90015
|
});
|
|
90146
|
-
console.log("[Cody] Send init agent worker command");
|
|
90147
90016
|
const serverInfo = await rpc.sendRequest("initialize", {
|
|
90148
90017
|
name: "web",
|
|
90149
90018
|
version: "0.0.1",
|
|
90150
|
-
// This is not used in cody web. Instead
|
|
90019
|
+
// This is not used in cody web. Instead we trigger `workspaceFolder/didChange` to notify
|
|
90151
90020
|
// the agent about the current workspace.
|
|
90152
90021
|
workspaceRootUri: "",
|
|
90153
90022
|
capabilities: {
|
|
@@ -90174,13 +90043,11 @@ async function createAgentClient({
|
|
|
90174
90043
|
}
|
|
90175
90044
|
}
|
|
90176
90045
|
});
|
|
90177
|
-
console.log("[Cody] Send success init agent worker command");
|
|
90178
90046
|
await rpc.sendNotification("initialized", null);
|
|
90179
90047
|
return {
|
|
90180
90048
|
rpc,
|
|
90181
90049
|
serverInfo,
|
|
90182
90050
|
dispose() {
|
|
90183
|
-
console.log("[Cody] Worker dispose call");
|
|
90184
90051
|
rpc.end();
|
|
90185
90052
|
worker.terminate();
|
|
90186
90053
|
}
|
|
@@ -90844,6 +90711,6 @@ export {
|
|
|
90844
90711
|
ChatSkeleton,
|
|
90845
90712
|
CodyPromptTemplate,
|
|
90846
90713
|
CodyWebChat,
|
|
90847
|
-
|
|
90848
|
-
|
|
90714
|
+
aT as deserialize,
|
|
90715
|
+
aS as serialize
|
|
90849
90716
|
};
|