@sourcegraph/cody-web 0.32.12 → 0.33.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.
@@ -18,8 +18,8 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
18
18
  }
19
19
  });
20
20
  var _a2, _b, _c, _d, _e, _constructing, _f, _g, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn2, moveToTail_fn, _h, _i, _j, _k, _l;
21
- import { O as Observable, aW as unsubscribe, aX as AsyncSerialScheduler, aY as authStatus, aZ as pick, a_ as distinctUntilChanged$1, a$ as switchMapReplayOperation, b0 as pendingOperation, b1 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b2 as retry$1, b3 as logError$2, aI as firstResultFromOperation, b4 as graphqlClient, b5 as semver, b6 as debounceTime, b7 as interval, b8 as filter$2, b9 as startWith$1, ba as switchMap$1, ax as firstValueFrom$1, ay as skipPendingOperation, bb as logDebug$1, bc as isAbortError, am as ModelTag, bd as getModelInfo, be as CHAT_INPUT_TOKEN_BUDGET, bf as CHAT_OUTPUT_TOKEN_BUDGET, bg as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bh as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, ac as LRUCache$1, bi as TRANSIENT_REFETCH_INTERVAL_HINT, bj as createSubscriber, bk as fromVSCodeEvent, D as isEqual, bl as cenv, ag as lodashExports, bm as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bn as currentAuthStatus, bo as isFileURI, w as wrapInActiveSpan, bp as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bq as onAbort, br as addCodyClientIdentificationHeaders, bs as addTraceparent, bt as addAuthHeaders, bu as fetch$2, bv as verifyResponseCode, H as combineLatest$1, bw as take$2, bx as clientCapabilities, by as shareReplay$1, bz as tap$2, bA as featureFlagProvider, $ as FeatureFlag, a7 as isCodyProUser, bB as isFreeUser, bC as telemetryRecorder, bD as getEnterpriseContextWindow, bE as ANSWER_TOKENS, bF as currentAuthStatusOrNotReadyYet, bG as mockAuthStatus, bH as storeLastValue, bI as resolvedConfig, bJ as userProductSubscription, bK as isEnterpriseUser, bL as ps, bM as GuardrailsMode, bN as currentResolvedConfig, aS as PromptString, a8 as CodyIDE, bO as CORPUS_CONTEXT_ALLOCATION, bP as isCustomModel, bQ as recordErrorToSpan, bR as addClientInfoParams, bS as dependentAbortController, 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, C as ContextItemSource, bT as isS2, bU as GIT_OPENCTX_PROVIDER_URI, bV as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, bW as currentOpenCtxController, m as URI, bX as MulticastSubject, bY as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bZ as workspace, p as path, b_ as vscode, b$ as Range, c0 as commands$1, c1 as window$1, c2 as Selection, U as Uri, c3 as AgentEventEmitter, c4 as MarkdownString, c5 as Disposable, c6 as TextEditorRevealType, c7 as ThemeIcon, c8 as StatusBarAlignment, c9 as readFile, ca as env, cb as UIKind, cc as languages$1, c as commonjsGlobal, cd as InvalidAccessTokenError, ce as _baseAssignValue, cf as eq_1, cg as isArrayLike_1, ch as isObjectLike_1, ci as _copyObject, cj as keysIn_1, ck as _cloneBufferExports, cl as _cloneTypedArray, cm as _copyArray, cn as _initCloneObject, co as isArguments_1, cp as isArray_1, cq as isBufferExports, cr as isFunction_1, cs as isObject_1, ct as isPlainObject_1, cu as isTypedArray_1, cv as _Stack, cw as identity_1, cx as _overRest, cy as _setToString, cz as _isIndex, X as isSourcegraphToken, aG as v4, cA as CONFIG_KEY, aP as CodyAutoSuggestionMode, cB as ConfigurationTarget, cC as pathBrowserify, cD as stat, cE as extensions, cF as version$2, cG as setExtensionVersion, cH as withLatestFrom, cI as NEVER$1, cJ as abortableOperation, cK as isNeedsAuthChallengeError, cL as EMPTY$1, cM as disposableSubscription, cN as setAuthStatusObservable, cO as DOTCOM_URL, V as isAvailabilityError, cP as isInvalidAccessTokenError, cQ as normalizeServerEndpointURL, cR as isEnterpriseUserDotComError, cS as ProgressLocation, cT as AuthConfigError, cU as SourcegraphGraphQLAPIClient, cV as isExternalProviderAuthError, cW as isNetworkLikeError, cX as NeedsAuthChallengeError, cY as AvailabilityError, cZ as EnterpriseUserDotComError, c_ as resolveAuth, c$ as QuickPickItemKind, aK as isWorkspaceInstance, d0 as getAuthHeaders, d1 as toLightweightChatTranscript, d2 as SUPPORTED_URI_SCHEMAS, d3 as _baseIsEqual, d4 as keys_1, d5 as _baseGet, d6 as _castPath, d7 as isLength_1, d8 as _toKey, d9 as _isKey, da as toNumber_1, db as _baseFindIndex, dc as require$$0$2, dd as NetworkError, de as isRateLimitError, Q as isAuthError, df as FileType, dg as dedent$1, dh as FoldingRange, di as CancellationTokenSource, dj as SymbolKind, dk as convertGitCloneURLToCodebaseName, ai as isDefined, dl as pluck, dm as toRangeData, dn as Position, dp as DefaultChatCommands, dq as pathFunctionsForURI, dr as uriParseNameAndExtension, ds as uriDirname, dt as Utils$1, du as uriExtname, dv as uriBasename, dw as DefaultEditCommands, dx as subscriptionDisposable, dy as updateGlobalTelemetryInstances, dz as TelemetryRecorderProvider, dA as telemetryRecorderProvider, dB as createGitDiff, dC as catchError$1, dD as AgentWorkspaceEdit, dE as TextDocumentChangeReason, dF as omit$1, dG as displayPathWithoutWorkspaceFolderPrefix, dH as getEditorInsertSpaces, dI as escapeRegExp$1, dJ as TimeoutError, dK as isNetworkError, dL as http, dM as open, dN as defer$2, dO as merge$2, dP as ruleSearchPaths, dQ as isRuleFilename, dR as parseRuleFile, dS as languageFromFilename, f as displayLineRange, e as displayPath, dT as ruleTitle, as as isCodyProModel, dU as debounce_1, aR as isErrorLike, dV as isWindows, dW as GLOBAL_SEARCH_PROVIDER_URI, dX as mentionProvidersMetadata, dY as currentUserProductSubscription, dZ as checkIfEnterpriseUser, d_ as ThemeColor, d$ as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e0 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e1 as CodeLens, e2 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e3 as EndOfLine, e4 as ViewColumn, e5 as Location, e6 as onDidChangeActiveTextEditor, e7 as tabGroups, e8 as workspaceTextDocuments, e9 as visibleTextEditors, ea as onDidChangeVisibleTextEditors, eb as fs, ec as onDidCloseTextDocument, ed as setCreateWebviewPanel, ee as getAugmentedNamespace, ef as extensionConfiguration, eg as main$1, eh as setAgent, ei as setWorkspaceDocuments, ej as setLastOpenedWorkspaceFolder, ek as onDidRegisterNewCodeActionProvider, el as onDidUnregisterNewCodeActionProvider, em as onDidRegisterNewCodeLensProvider, en as onDidUnregisterNewCodeLensProvider, eo as setClientInfo, ep as AgentWorkspaceConfiguration, eq as firstNonPendingAuthStatus, er as workspaceFolders$1, es as setWorkspaceFolders, et as onDidChangeWorkspaceFolders, eu as onDidChangeWindowState, ev as onDidOpenTextDocument, ew as onDidSaveTextDocument, ex as onDidRenameFiles, ey as packageJson, ez as progressBars, eA as CodeActionTriggerKind, eB as CodeAction, eC as UriString, eD as DiagnosticSeverity, eE as diagnostics, eF as isIntegrationTesting, eG as TESTING_TELEMETRY_EXPORTER, eH as dist, eI as completionProvider, eJ as InlineCompletionTriggerKind, eK as currentAuthStatusAuthed, eL as waitUntilComplete, eM as setExtensionConfiguration, eN as onDidChangeConfiguration, eO as onDidChangeTextDocument, eP as onDidChangeTextEditorSelection, eQ as isTokenOrEndpointChange, at as isMacOS, av as CustomCommandType, eR as RelativePattern, aQ as setDisplayPathEnvInfo, aM as ACCOUNT_USAGE_URL, z as debounce$1, eS as structuredPatch, eT as isDotComAuthed, eU as dedupeWith$1, eV as AbortError, eW as createDisposables, eX as isNodeResponse, eY as getClientInfoQueryParams, eZ as tracer, e_ as getActiveTraceAndSpanId, e$ as getClientIdentificationHeaders, f0 as setJSONAcceptContentTypeHeaders, f1 as logResponseHeadersToSpan, f2 as isCustomAuthChallengeResponse, f3 as TracedError, _ as SpanStatusCode, ae as RateLimitError$1, f4 as capitalize, f5 as InlineCompletionItem, f6 as createTwoFilesPatch, f7 as vsCodeMocks, a2 as whitespace, a0 as svg, a3 as find$1, a4 as stringify$1, a5 as stringify$2, a6 as ccount, a1 as html$3, f8 as getEditorTabSize$1, f9 as metrics, fa as _, aH as deserializeContextItem, fb as editorStateFromPromptString, fc as _baseGetTag, al as isAbortErrorOrSocketHangUp, fd as inputTextWithoutContextChipsFromPromptEditorState, an as DeepCodyAgentID, fe as exec, s as spawn, aC as UIToolStatus, i as displayPathBasename, ff as expandToLineRange, fg as openctxController, fh as openCtxProviderMetadata, fi as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aE as diffWithLineNum, aF as UITerminalOutputType, fj as getPlatform$1, fk as PromptMode, fl as skip$1, Z as context, fm as extractContextFromTraceparent, fn as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ak as reformatBotMessageForChat, M as hydrateAfterPostMessage, fo as addMessageListenersForExtensionAPI, fp as createMessageAPIForExtension, ar as View, aJ as ChatHistoryType, fq as CodeActionKind, aB as pluralize, fr as assertFileURI, d as RULES_PROVIDER_URI, fs as createCodeSearchProvider, ft as ProgrammingLanguage, fu as MAX_CURRENT_FILE_TOKENS, fv as psDedent, fw as formatRuleForPrompt, fx as posixFilePaths, fy as DecorationRangeBehavior, fz as SURROUNDING_LINES, fA as diffLines, fB as CODY_SUPPORT_URL, fC as CODY_DOC_URL, fD as CODY_FEEDBACK_URL, fE as DISCORD_URL, fF as globalAgentRef, fG as VSCODE_CHANGELOG_URL, fH as SG_CHANGELOG_URL, fI as ACCOUNT_LIMITS_INFO_URL, fJ as assertUnreachable, fK as promise, fL as ExtensionMode, fM as setLogger, fN as setClientCapabilities, fO as setResolvedConfigurationObservable, fP as setClientNameVersion, fQ as setOpenCtxControllerObservable, aO as browser$4 } from "./vscode-shim-FP11UcS5.mjs";
22
- import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-n4JO9qgH.mjs";
21
+ import { O as Observable, aV as unsubscribe, aW as AsyncSerialScheduler, aX as authStatus, aY as pick, aZ as distinctUntilChanged$1, a_ as switchMapReplayOperation, a$ as pendingOperation, b0 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b1 as retry$1, b2 as logError$2, aG as firstResultFromOperation, b3 as graphqlClient, b4 as semver, b5 as debounceTime, b6 as interval, b7 as filter$2, b8 as startWith$1, b9 as switchMap$1, at as firstValueFrom$1, au as skipPendingOperation, ba as logDebug$1, bb as isAbortError, ai as ModelTag, bc as getModelInfo, bd as CHAT_INPUT_TOKEN_BUDGET, be as CHAT_OUTPUT_TOKEN_BUDGET, bf as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bg as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, ac as LRUCache$1, bh as TRANSIENT_REFETCH_INTERVAL_HINT, bi as createSubscriber, bj as fromVSCodeEvent, D as isEqual, bk as cenv, aE as lodashExports, bl as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bm as currentAuthStatus, bn as isFileURI, w as wrapInActiveSpan, bo as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bp as onAbort, bq as addCodyClientIdentificationHeaders, br as addTraceparent, bs as addAuthHeaders, bt as fetch$2, bu as verifyResponseCode, H as combineLatest$1, bv as take$2, bw as clientCapabilities, bx as shareReplay$1, by as tap$2, bz as featureFlagProvider, af as FeatureFlag, a7 as isCodyProUser, bA as isFreeUser, bB as telemetryRecorder, bC as getEnterpriseContextWindow, bD as ANSWER_TOKENS, bE as currentAuthStatusOrNotReadyYet, bF as mockAuthStatus, bG as storeLastValue, bH as resolvedConfig, bI as userProductSubscription, bJ as isEnterpriseUser, bK as ps, bL as GuardrailsMode, bM as currentResolvedConfig, aR as PromptString, a8 as CodyIDE, bN as CORPUS_CONTEXT_ALLOCATION, bO as isCustomModel, bP as recordErrorToSpan, bQ as addClientInfoParams, bR as dependentAbortController, 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, C as ContextItemSource, bS as isS2, bT as GIT_OPENCTX_PROVIDER_URI, bU as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, bV as currentOpenCtxController, m as URI, bW as MulticastSubject, bX as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bY as workspace, p as path, bZ as vscode, b_ as Range, b$ as commands$1, c0 as window$1, c1 as Selection, U as Uri, c2 as AgentEventEmitter, c3 as MarkdownString, c4 as Disposable, c5 as TextEditorRevealType, c6 as ThemeIcon, c7 as StatusBarAlignment, c8 as readFile, c9 as env, ca as UIKind, cb as languages$1, c as commonjsGlobal, cc as InvalidAccessTokenError, cd as _baseAssignValue, ce as eq_1, cf as isArrayLike_1, cg as isObjectLike_1, ch as _copyObject, ci as keysIn_1, cj as _cloneBufferExports, ck as _cloneTypedArray, cl as _copyArray, cm as _initCloneObject, cn as isArguments_1, co as isArray_1, cp as isBufferExports, cq as isFunction_1, cr as isObject_1, cs as isPlainObject_1, ct as isTypedArray_1, cu as _Stack, cv as identity_1, cw as _overRest, cx as _setToString, cy as _isIndex, Y as isSourcegraphToken, aD as v4, cz as CONFIG_KEY, aO as CodyAutoSuggestionMode, cA as ConfigurationTarget, cB as pathBrowserify, cC as stat, cD as extensions, cE as version$2, cF as setExtensionVersion, cG as withLatestFrom, cH as NEVER$1, cI as abortableOperation, cJ as isNeedsAuthChallengeError, cK as EMPTY$1, cL as disposableSubscription, cM as setAuthStatusObservable, cN as DOTCOM_URL, X as isAvailabilityError, cO as isInvalidAccessTokenError, cP as normalizeServerEndpointURL, cQ as isEnterpriseUserDotComError, cR as ProgressLocation, cS as AuthConfigError, cT as SourcegraphGraphQLAPIClient, cU as isExternalProviderAuthError, cV as isNetworkLikeError, cW as NeedsAuthChallengeError, cX as AvailabilityError, cY as EnterpriseUserDotComError, cZ as resolveAuth, c_ as QuickPickItemKind, Q as isWorkspaceInstance, c$ as getAuthHeaders, d0 as toLightweightChatTranscript, d1 as SUPPORTED_URI_SCHEMAS, d2 as _baseIsEqual, d3 as keys_1, d4 as _baseGet, d5 as _castPath, d6 as isLength_1, d7 as _toKey, d8 as _isKey, d9 as toNumber_1, da as _baseFindIndex, db as require$$0$2, dc as NetworkError, dd as isRateLimitError, V as isAuthError, de as FileType, df as dedent$1, dg as FoldingRange, dh as CancellationTokenSource, di as SymbolKind, dj as convertGitCloneURLToCodebaseName, aM as isDefined, dk as pluck, dl as toRangeData, dm as Position, dn as DefaultChatCommands, dp as pathFunctionsForURI, dq as uriParseNameAndExtension, dr as uriDirname, ds as Utils$1, dt as uriExtname, du as uriBasename, dv as DefaultEditCommands, dw as subscriptionDisposable, dx as updateGlobalTelemetryInstances, dy as TelemetryRecorderProvider, dz as telemetryRecorderProvider, dA as createGitDiff, dB as catchError$1, dC as AgentWorkspaceEdit, dD as TextDocumentChangeReason, dE as omit$1, dF as displayPathWithoutWorkspaceFolderPrefix, dG as getEditorInsertSpaces, dH as escapeRegExp$1, dI as TimeoutError, dJ as isNetworkError, dK as http, dL as open, dM as defer$2, dN as merge$2, dO as ruleSearchPaths, dP as isRuleFilename, dQ as parseRuleFile, dR as languageFromFilename, f as displayLineRange, e as displayPath, dS as ruleTitle, ao as isCodyProModel, dT as debounce_1, aQ as isErrorLike, dU as isWindows, dV as GLOBAL_SEARCH_PROVIDER_URI, dW as mentionProvidersMetadata, dX as currentUserProductSubscription, dY as checkIfEnterpriseUser, dZ as ThemeColor, d_ as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, d$ as GENERAL_HELP_LABEL, a9 as CodyTaskState, e0 as CodeLens, e1 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e2 as EndOfLine, e3 as ViewColumn, e4 as Location, e5 as onDidChangeActiveTextEditor, e6 as tabGroups, e7 as workspaceTextDocuments, e8 as visibleTextEditors, e9 as onDidChangeVisibleTextEditors, ea as fs, eb as onDidCloseTextDocument, ec as setCreateWebviewPanel, ed as getAugmentedNamespace, ee as extensionConfiguration, ef as main$1, eg as setAgent, eh as setWorkspaceDocuments, ei as setLastOpenedWorkspaceFolder, ej as onDidRegisterNewCodeActionProvider, ek as onDidUnregisterNewCodeActionProvider, el as onDidRegisterNewCodeLensProvider, em as onDidUnregisterNewCodeLensProvider, en as setClientInfo, eo as AgentWorkspaceConfiguration, ep as firstNonPendingAuthStatus, eq as workspaceFolders$1, er as setWorkspaceFolders, es as onDidChangeWorkspaceFolders, et as onDidChangeWindowState, eu as onDidOpenTextDocument, ev as onDidSaveTextDocument, ew as onDidRenameFiles, ex as packageJson, ey as progressBars, ez as CodeActionTriggerKind, eA as CodeAction, eB as UriString, eC as DiagnosticSeverity, eD as diagnostics, eE as isIntegrationTesting, eF as TESTING_TELEMETRY_EXPORTER, eG as dist, eH as completionProvider, eI as InlineCompletionTriggerKind, eJ as currentAuthStatusAuthed, eK as waitUntilComplete, eL as setExtensionConfiguration, eM as onDidChangeConfiguration, eN as onDidChangeTextDocument, eO as onDidChangeTextEditorSelection, eP as isTokenOrEndpointChange, ap as isMacOS, ar as CustomCommandType, eQ as RelativePattern, aP as setDisplayPathEnvInfo, aJ as ACCOUNT_USAGE_URL, z as debounce$1, eR as structuredPatch, eS as isDotComAuthed, eT as dedupeWith$1, eU as AbortError, eV as createDisposables, eW as isNodeResponse, eX as getClientInfoQueryParams, eY as tracer, eZ as getActiveTraceAndSpanId, e_ as getClientIdentificationHeaders, e$ as setJSONAcceptContentTypeHeaders, f0 as logResponseHeadersToSpan, f1 as isCustomAuthChallengeResponse, f2 as TracedError, $ as SpanStatusCode, ae as RateLimitError$1, f3 as capitalize, f4 as InlineCompletionItem, f5 as createTwoFilesPatch, f6 as vsCodeMocks, a2 as whitespace, a0 as svg, a3 as find$1, a4 as stringify$1, a5 as stringify$2, a6 as ccount, a1 as html$3, f7 as getEditorTabSize$1, f8 as metrics, f9 as _, aF as deserializeContextItem, fa as editorStateFromPromptString, fb as _baseGetTag, ah as isAbortErrorOrSocketHangUp, fc as inputTextWithoutContextChipsFromPromptEditorState, aj as DeepCodyAgentID, fd as exec, s as spawn, ay as UIToolStatus, i as displayPathBasename, fe as expandToLineRange, ff as openctxController, fg as openCtxProviderMetadata, fh as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aA as diffWithLineNum, aB as UITerminalOutputType, fi as getPlatform$1, fj as PromptMode, fk as skip$1, _ as context, fl as extractContextFromTraceparent, fm as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ag as reformatBotMessageForChat, M as hydrateAfterPostMessage, fn as addMessageListenersForExtensionAPI, fo as createMessageAPIForExtension, an as View, aH as ChatHistoryType, fp as CodeActionKind, ax as pluralize, fq as assertFileURI, d as RULES_PROVIDER_URI, fr as createCodeSearchProvider, fs as ProgrammingLanguage, ft as MAX_CURRENT_FILE_TOKENS, fu as psDedent, fv as formatRuleForPrompt, fw as posixFilePaths, fx as DecorationRangeBehavior, fy as SURROUNDING_LINES, fz as diffLines, fA as CODY_SUPPORT_URL, fB as CODY_DOC_URL, fC as CODY_FEEDBACK_URL, fD as DISCORD_URL, fE as globalAgentRef, fF as VSCODE_CHANGELOG_URL, fG as SG_CHANGELOG_URL, fH as ACCOUNT_LIMITS_INFO_URL, fI as assertUnreachable, fJ as promise, fK as ExtensionMode, fL as setLogger, fM as setClientCapabilities, fN as setResolvedConfigurationObservable, fO as setClientNameVersion, fP as setOpenCtxControllerObservable, aL as isPlgEsAccessDisabled, aN as browser$4 } from "./vscode-shim-DCfZW3km.mjs";
22
+ import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-BcM-aRzi.mjs";
23
23
  var NOTHING = Symbol.for("immer-nothing");
24
24
  var DRAFTABLE = Symbol.for("immer-draftable");
25
25
  var DRAFT_STATE = Symbol.for("immer-state");
@@ -943,6 +943,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
943
943
  message: (notice == null ? void 0 : notice.message) ?? ""
944
944
  })
945
945
  );
946
+ config.chatCodeHighlightingEnabled = (viewerSettings == null ? void 0 : viewerSettings["cody.chatCodeSyntaxHighlightingEnabled"]) ?? true;
946
947
  }
947
948
  return config;
948
949
  });
@@ -8161,7 +8162,7 @@ async function getTokenCounterUtils() {
8161
8162
  const browser2 = detect();
8162
8163
  if (browser2 && browser2.name === "safari") {
8163
8164
  _tokenCounterUtilsPromise = import("./cl100k_base-B4kyDDRQ.mjs").then(async (tokenizer2) => {
8164
- const tiktoken = await import("./lite-DCslm11Y.mjs");
8165
+ const tiktoken = await import("./lite-ch5VbcSy.mjs");
8165
8166
  return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
8166
8167
  });
8167
8168
  } else {
@@ -46763,7 +46764,7 @@ class CommandsProvider {
46763
46764
  if (!isFileURI(uri)) {
46764
46765
  throw new Error("history only supported on local file paths");
46765
46766
  }
46766
- const { getContextFileFromGitLog } = await import("./git-log-BWXBE9bQ.mjs");
46767
+ const { getContextFileFromGitLog } = await import("./git-log-Sw0MOWAb.mjs");
46767
46768
  return getContextFileFromGitLog(uri, options);
46768
46769
  }
46769
46770
  dispose() {
@@ -172009,48 +172010,6 @@ async function doRewrite(completionsClient, query2, signal2) {
172009
172010
  const match2 = text2.match(/<query>(.*?)<\/query>/);
172010
172011
  return (match2 == null ? void 0 : match2[1]) ?? query2.toString();
172011
172012
  }
172012
- async function extractKeywords(completionsClient, query2, signal2) {
172013
- const preamble = getSimplePreamble(void 0, LEGACY_API_VERSION, "Default");
172014
- const client = new ChatClient(completionsClient);
172015
- const stream = await client.chat(
172016
- [
172017
- ...preamble,
172018
- {
172019
- speaker: "human",
172020
- text: ps`You are helping the user search over a codebase. List terms that could be found literally in code snippets or file names relevant to answering the user's query. Limit your results to terms that are in the user's query. Present your results in a *single* XML list in the following format: <keywords><keyword>a single keyword</keyword></keywords>. Here is the user query: <userQuery>${query2}</userQuery>`
172021
- }
172022
- ],
172023
- {
172024
- maxTokensToSample: 400,
172025
- temperature: 0,
172026
- topK: 1,
172027
- fast: true
172028
- },
172029
- signal2
172030
- );
172031
- let lastMessageText = "<keywords></keywords>";
172032
- for await (const message of stream) {
172033
- switch (message.type) {
172034
- case "change": {
172035
- lastMessageText = message.text;
172036
- break;
172037
- }
172038
- case "error": {
172039
- throw message.error;
172040
- }
172041
- }
172042
- }
172043
- const document2 = new fxp.XMLParser().parse(lastMessageText);
172044
- let keywords = [];
172045
- if (document2.keywords) {
172046
- if (Array.isArray(document2.keywords.keyword)) {
172047
- keywords = document2.keywords.keyword;
172048
- } else if (document2.keywords.keyword) {
172049
- keywords = [document2.keywords.keyword];
172050
- }
172051
- }
172052
- return keywords.flatMap((keyword) => keyword.split(" ").filter((v) => v !== ""));
172053
- }
172054
172013
  async function searchSymf(symf, editor, workspaceRoot, userText, blockOnIndex = false) {
172055
172014
  return wrapInActiveSpan("chat.context.symf", async () => {
172056
172015
  if (!symf) {
@@ -172236,20 +172195,6 @@ class ContextRetriever {
172236
172195
  skipQueryRewrite
172237
172196
  );
172238
172197
  }
172239
- /**
172240
- * Computes a "Did you mean?" suggestion for a given query by extracting keywords.
172241
- * Only attempts to extract keywords for queries that look like search queries.
172242
- */
172243
- async computeDidYouMean(query2, signal2) {
172244
- if (!looksLikeSearch(query2.toString())) {
172245
- return void 0;
172246
- }
172247
- const keywords = await extractKeywords(this.llms, query2, signal2);
172248
- if (keywords.length > 0) {
172249
- return keywords.join(" ");
172250
- }
172251
- return void 0;
172252
- }
172253
172198
  async _retrieveContext(roots, query2, span2, signal2, skipQueryRewrite = false) {
172254
172199
  if (roots.length === 0) {
172255
172200
  return [];
@@ -172480,21 +172425,6 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
172480
172425
  }
172481
172426
  return { keep: keep2, remove };
172482
172427
  }
172483
- const searchPatterns = [
172484
- /^where is/i,
172485
- /^look for/i,
172486
- /^search for/i,
172487
- /^find all/i,
172488
- /^list all/i,
172489
- /^get all/i,
172490
- /^show all/i,
172491
- /occurrences of/i,
172492
- /^where do we/i,
172493
- /examples of/i
172494
- ];
172495
- function looksLikeSearch(query2) {
172496
- return searchPatterns.some((pattern) => pattern.test(query2.trim()));
172497
- }
172498
172428
  function sortContextItemsIfInTest(files) {
172499
172429
  {
172500
172430
  return files;
@@ -172949,7 +172879,6 @@ class ChatHandler {
172949
172879
  model: model2
172950
172880
  }, delegate) {
172951
172881
  mentions = mentions.map((m) => m.source ? m : { ...m, source: ContextItemSource.User });
172952
- const didYouMeanPromise = this.contextRetriever.computeDidYouMean(inputText, signal2);
172953
172882
  const contextResult = await this.computeContext(
172954
172883
  requestID,
172955
172884
  { text: inputText, mentions },
@@ -172977,25 +172906,11 @@ class ChatHandler {
172977
172906
  const { prompt } = await this.buildPrompt(prompter2, chatBuilder, signal2, versions.codyAPIVersion);
172978
172907
  recorder2.recordChatQuestionExecuted(corpusContext, { addMetadata: true, current: span2 });
172979
172908
  signal2.throwIfAborted();
172980
- const didYouMeanQuery = await didYouMeanPromise;
172981
- const delegateWithDidYouMean = {
172982
- ...delegate,
172983
- postMessageInProgress: (message) => {
172984
- delegate.postMessageInProgress({ ...message, didYouMeanQuery });
172985
- }
172986
- };
172987
- delegateWithDidYouMean.postMessageInProgress({
172909
+ delegate.postMessageInProgress({
172988
172910
  speaker: "assistant",
172989
172911
  model: model2
172990
172912
  });
172991
- this.streamAssistantResponse(
172992
- requestID,
172993
- prompt,
172994
- model2,
172995
- signal2,
172996
- chatBuilder,
172997
- delegateWithDidYouMean
172998
- );
172913
+ this.streamAssistantResponse(requestID, prompt, model2, signal2, chatBuilder, delegate);
172999
172914
  }
173000
172915
  /**
173001
172916
  * Issue the chat request and stream the results back, updating the model and view
@@ -180880,74 +180795,88 @@ function getCorpusContextItemsForEditorState() {
180880
180795
  ),
180881
180796
  distinctUntilChanged$1()
180882
180797
  );
180883
- return combineLatest$1(relevantAuthStatus, remoteReposForAllWorkspaceFolders).pipe(
180884
- abortableOperation(async ([authStatus2, remoteReposForAllWorkspaceFolders2], signal2) => {
180885
- var _a3;
180886
- const items = [];
180887
- const workspaceFolder = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.at(0);
180888
- if (workspaceFolder) {
180889
- items.push({
180890
- type: "tree",
180891
- uri: workspaceFolder.uri,
180892
- title: "Current Repository",
180893
- name: workspaceFolder.name,
180894
- description: workspaceFolder.name,
180895
- isWorkspaceRoot: true,
180896
- content: null,
180897
- source: ContextItemSource.Initial,
180898
- icon: "folder"
180899
- });
180900
- }
180901
- if (authStatus2.allowRemoteContext) {
180902
- if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
180903
- return pendingOperation;
180904
- }
180905
- if (isError$3(remoteReposForAllWorkspaceFolders2)) {
180906
- throw remoteReposForAllWorkspaceFolders2;
180798
+ return combineLatest$1(
180799
+ relevantAuthStatus,
180800
+ remoteReposForAllWorkspaceFolders,
180801
+ activeTextEditor,
180802
+ featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.SymfRetrievalDisabled)
180803
+ ).pipe(
180804
+ abortableOperation(
180805
+ async ([authStatus2, remoteReposForAllWorkspaceFolders2, activeEditor, symfRetrievalDisabled], signal2) => {
180806
+ var _a3;
180807
+ const items = [];
180808
+ const workspaceFolders2 = workspace.workspaceFolders;
180809
+ if (workspaceFolders2 && !symfRetrievalDisabled) {
180810
+ let currentWorkspaceFolder;
180811
+ const activeVisibleEditor = activeEditor || window$1.visibleTextEditors[0];
180812
+ currentWorkspaceFolder = activeVisibleEditor ? workspace.getWorkspaceFolder((_a3 = activeVisibleEditor.document) == null ? void 0 : _a3.uri) : workspaceFolders2[0];
180813
+ for (const workspaceFolder of workspaceFolders2) {
180814
+ const isCurrentFolder = currentWorkspaceFolder && workspaceFolder.uri.toString() === currentWorkspaceFolder.uri.toString();
180815
+ items.push({
180816
+ type: "tree",
180817
+ uri: workspaceFolder.uri,
180818
+ title: isCurrentFolder ? "Current Repository" : workspaceFolder.name,
180819
+ name: workspaceFolder.name,
180820
+ description: workspaceFolder.name,
180821
+ isWorkspaceRoot: true,
180822
+ content: null,
180823
+ // Current folder goes to initial context (pre-filled), others go to corpus context (@ mention menu)
180824
+ source: isCurrentFolder ? ContextItemSource.Initial : ContextItemSource.User,
180825
+ icon: "folder"
180826
+ });
180827
+ }
180907
180828
  }
180908
- for (const repo of remoteReposForAllWorkspaceFolders2) {
180909
- if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
180910
- continue;
180829
+ if (authStatus2.allowRemoteContext) {
180830
+ if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
180831
+ return pendingOperation;
180911
180832
  }
180912
- if (repo.id === void 0) {
180913
- continue;
180833
+ if (isError$3(remoteReposForAllWorkspaceFolders2)) {
180834
+ throw remoteReposForAllWorkspaceFolders2;
180914
180835
  }
180915
- items.push({
180916
- ...contextItemMentionFromOpenCtxItem(
180917
- await createRepositoryMention(
180918
- {
180919
- id: repo.id,
180920
- name: repo.name,
180921
- url: repo.name
180922
- },
180923
- REMOTE_REPOSITORY_PROVIDER_URI,
180924
- authStatus2
180925
- )
180926
- ),
180927
- title: "Current Codebase",
180928
- description: repo.name,
180929
- source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180930
- icon: "search"
180931
- });
180932
- }
180933
- if (authStatus2.isEnterpriseUser && remoteReposForAllWorkspaceFolders2.length === 0) {
180934
- if (!clientCapabilities().isCodyWeb) {
180836
+ for (const repo of remoteReposForAllWorkspaceFolders2) {
180837
+ if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
180838
+ continue;
180839
+ }
180840
+ if (repo.id === void 0) {
180841
+ continue;
180842
+ }
180935
180843
  items.push({
180936
- type: "open-link",
180937
- title: "Current Codebase",
180938
- badge: "Not yet available",
180939
- content: null,
180940
- uri: URI.parse(
180941
- "https://sourcegraph.com/docs/cody/prompts-guide#indexing-your-repositories-for-context"
180844
+ ...contextItemMentionFromOpenCtxItem(
180845
+ await createRepositoryMention(
180846
+ {
180847
+ id: repo.id,
180848
+ name: repo.name,
180849
+ url: repo.name
180850
+ },
180851
+ REMOTE_REPOSITORY_PROVIDER_URI,
180852
+ authStatus2
180853
+ )
180942
180854
  ),
180943
- name: "",
180855
+ title: "Current Codebase",
180856
+ description: repo.name,
180857
+ source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180944
180858
  icon: "search"
180945
180859
  });
180946
180860
  }
180861
+ if (authStatus2.isEnterpriseUser && remoteReposForAllWorkspaceFolders2.length === 0) {
180862
+ if (!clientCapabilities().isCodyWeb) {
180863
+ items.push({
180864
+ type: "open-link",
180865
+ title: "Current Codebase",
180866
+ badge: "Not yet available",
180867
+ content: null,
180868
+ uri: URI.parse(
180869
+ "https://sourcegraph.com/docs/cody/prompts-guide#indexing-your-repositories-for-context"
180870
+ ),
180871
+ name: "",
180872
+ icon: "search"
180873
+ });
180874
+ }
180875
+ }
180947
180876
  }
180877
+ return items;
180948
180878
  }
180949
- return items;
180950
- })
180879
+ )
180951
180880
  );
180952
180881
  }
180953
180882
  function getOpenCtxContextItems() {
@@ -186209,343 +186138,352 @@ class ChatController {
186209
186138
  */
186210
186139
  async onDidReceiveMessage(message) {
186211
186140
  var _a3, _b2, _c2;
186212
- switch (message.command) {
186213
- case "ready":
186214
- await this.handleReady();
186215
- break;
186216
- case "initialized":
186217
- await this.handleInitialized();
186218
- this.setWebviewToChat();
186219
- break;
186220
- case "submit": {
186221
- await this.handleUserMessage({
186222
- requestID: v4(),
186223
- inputText: PromptString.unsafe_fromUserQuery(message.text),
186224
- mentions: message.contextItems ?? [],
186225
- editorState: message.editorState,
186226
- signal: this.startNewSubmitOrEditOperation(),
186227
- source: "chat",
186228
- manuallySelectedIntent: message.manuallySelectedIntent,
186229
- traceparent: message.traceparent
186230
- });
186231
- break;
186232
- }
186233
- case "edit": {
186234
- this.cancelSubmitOrEditOperation();
186235
- await this.handleEdit({
186236
- requestID: v4(),
186237
- text: PromptString.unsafe_fromUserQuery(message.text),
186238
- index: message.index ?? void 0,
186239
- contextFiles: message.contextItems ?? [],
186240
- editorState: message.editorState,
186241
- manuallySelectedIntent: message.manuallySelectedIntent
186242
- });
186243
- break;
186244
- }
186245
- case "reevaluateSearchWithSelectedFilters": {
186246
- await this.reevaluateSearchWithSelectedFilters({
186247
- index: message.index ?? void 0,
186248
- selectedFilters: message.selectedFilters
186249
- });
186250
- break;
186251
- }
186252
- case "abort":
186253
- this.handleAbort();
186254
- break;
186255
- case "insert":
186256
- await handleCodeFromInsertAtCursor(message.text);
186257
- break;
186258
- case "copy":
186259
- await handleCopiedCode(message.text, message.eventType);
186260
- break;
186261
- case "smartApplyPrefetch":
186262
- case "smartApplySubmit":
186263
- await handleSmartApply({
186264
- id: message.id,
186265
- code: message.code,
186266
- authStatus: currentAuthStatus(),
186267
- instruction: message.instruction || "",
186268
- fileUri: message.fileName,
186269
- traceparent: message.traceparent || void 0,
186270
- isPrefetch: message.command === "smartApplyPrefetch"
186271
- });
186272
- break;
186273
- case "trace-export":
186274
- TraceSender.send(message.traceSpanEncodedJson);
186275
- break;
186276
- case "smartApplyAccept":
186277
- await commands$1.executeCommand("cody.command.smart-apply.accept", {
186278
- taskId: message.id
186279
- });
186280
- break;
186281
- case "smartApplyReject":
186282
- await commands$1.executeCommand("cody.command.smart-apply.reject", {
186283
- taskId: message.id
186284
- });
186285
- break;
186286
- case "openURI":
186287
- commands$1.executeCommand("vscode.open", message.uri, {
186288
- selection: message.range
186289
- });
186290
- break;
186291
- case "links": {
186292
- void openExternalLinks(message.value);
186293
- break;
186294
- }
186295
- case "openFileLink":
186296
- {
186297
- if ((_b2 = (_a3 = message == null ? void 0 : message.uri) == null ? void 0 : _a3.scheme) == null ? void 0 : _b2.startsWith("http")) {
186298
- this.openRemoteFile(message.uri, true);
186299
- return;
186300
- }
186301
- const isInSidebar = this._webviewPanelOrView && !("viewColumn" in this._webviewPanelOrView);
186302
- commands$1.executeCommand("vscode.open", message.uri, {
186303
- selection: message.range,
186304
- preserveFocus: true,
186305
- background: false,
186306
- preview: true,
186307
- // Use the active column if in sidebar, otherwise use Beside
186308
- viewColumn: isInSidebar ? ViewColumn.Active : ViewColumn.Beside
186141
+ try {
186142
+ switch (message.command) {
186143
+ case "ready":
186144
+ await this.handleReady();
186145
+ break;
186146
+ case "initialized":
186147
+ await this.handleInitialized();
186148
+ this.setWebviewToChat();
186149
+ break;
186150
+ case "submit": {
186151
+ await this.handleUserMessage({
186152
+ requestID: v4(),
186153
+ inputText: PromptString.unsafe_fromUserQuery(message.text),
186154
+ mentions: message.contextItems ?? [],
186155
+ editorState: message.editorState,
186156
+ signal: this.startNewSubmitOrEditOperation(),
186157
+ source: "chat",
186158
+ manuallySelectedIntent: message.manuallySelectedIntent,
186159
+ traceparent: message.traceparent
186309
186160
  });
186161
+ break;
186310
186162
  }
186311
- break;
186312
- case "openRemoteFile":
186313
- this.openRemoteFile(message.uri, message.tryLocal ?? false);
186314
- break;
186315
- case "newFile":
186316
- await handleCodeFromSaveToNewFile(message.text, this.editor);
186317
- break;
186318
- case "show-page":
186319
- await commands$1.executeCommand("cody.show-page", message.page);
186320
- break;
186321
- case "attribution-search":
186322
- await this.handleAttributionSearch(message.snippet);
186323
- break;
186324
- case "restoreHistory":
186325
- this.restoreSession(message.chatID);
186326
- this.setWebviewToChat();
186327
- break;
186328
- case "chatSession":
186329
- switch (message.action) {
186330
- case "new":
186331
- this.clearAndRestartSession();
186332
- break;
186333
- case "duplicate":
186334
- await this.duplicateSession(message.sessionID ?? this.chatBuilder.sessionID);
186335
- break;
186163
+ case "edit": {
186164
+ this.cancelSubmitOrEditOperation();
186165
+ await this.handleEdit({
186166
+ requestID: v4(),
186167
+ text: PromptString.unsafe_fromUserQuery(message.text),
186168
+ index: message.index ?? void 0,
186169
+ contextFiles: message.contextItems ?? [],
186170
+ editorState: message.editorState,
186171
+ manuallySelectedIntent: message.manuallySelectedIntent
186172
+ });
186173
+ break;
186336
186174
  }
186337
- break;
186338
- case "command":
186339
- commands$1.executeCommand(message.id, message.arg ?? message.args);
186340
- break;
186341
- case "mcp": {
186342
- const mcpManager = MCPManager.instance;
186343
- if (!mcpManager) {
186344
- logDebug("ChatController", "MCP Manager is not initialized");
186175
+ case "abort":
186176
+ this.handleAbort();
186177
+ break;
186178
+ case "insert":
186179
+ await handleCodeFromInsertAtCursor(message.text);
186180
+ break;
186181
+ case "copy":
186182
+ await handleCopiedCode(message.text, message.eventType);
186183
+ break;
186184
+ case "smartApplyPrefetch":
186185
+ case "smartApplySubmit":
186186
+ await handleSmartApply({
186187
+ id: message.id,
186188
+ code: message.code,
186189
+ authStatus: currentAuthStatus(),
186190
+ instruction: message.instruction || "",
186191
+ fileUri: message.fileName,
186192
+ traceparent: message.traceparent || void 0,
186193
+ isPrefetch: message.command === "smartApplyPrefetch"
186194
+ });
186195
+ break;
186196
+ case "trace-export":
186197
+ TraceSender.send(message.traceSpanEncodedJson);
186198
+ break;
186199
+ case "smartApplyAccept":
186200
+ await commands$1.executeCommand("cody.command.smart-apply.accept", {
186201
+ taskId: message.id
186202
+ });
186203
+ break;
186204
+ case "smartApplyReject":
186205
+ await commands$1.executeCommand("cody.command.smart-apply.reject", {
186206
+ taskId: message.id
186207
+ });
186208
+ break;
186209
+ case "openURI":
186210
+ commands$1.executeCommand("vscode.open", message.uri, {
186211
+ selection: message.range
186212
+ });
186213
+ break;
186214
+ case "links": {
186215
+ void openExternalLinks(message.value);
186345
186216
  break;
186346
186217
  }
186347
- const serverName = message.name;
186348
- try {
186349
- if (message.type === "updateServer" && !serverName) {
186350
- mcpManager.refreshServers();
186351
- break;
186218
+ case "openFileLink":
186219
+ {
186220
+ if ((_b2 = (_a3 = message == null ? void 0 : message.uri) == null ? void 0 : _a3.scheme) == null ? void 0 : _b2.startsWith("http")) {
186221
+ this.openRemoteFile(message.uri, true);
186222
+ return;
186223
+ }
186224
+ const isInSidebar = this._webviewPanelOrView && !("viewColumn" in this._webviewPanelOrView);
186225
+ commands$1.executeCommand("vscode.open", message.uri, {
186226
+ selection: message.range,
186227
+ preserveFocus: true,
186228
+ background: false,
186229
+ preview: true,
186230
+ // Use the active column if in sidebar, otherwise use Beside
186231
+ viewColumn: isInSidebar ? ViewColumn.Active : ViewColumn.Beside
186232
+ });
186233
+ }
186234
+ break;
186235
+ case "openRemoteFile":
186236
+ this.openRemoteFile(message.uri, message.tryLocal ?? false);
186237
+ break;
186238
+ case "newFile":
186239
+ await handleCodeFromSaveToNewFile(message.text, this.editor);
186240
+ break;
186241
+ case "show-page":
186242
+ await commands$1.executeCommand("cody.show-page", message.page);
186243
+ break;
186244
+ case "attribution-search":
186245
+ await this.handleAttributionSearch(message.snippet);
186246
+ break;
186247
+ case "restoreHistory":
186248
+ this.restoreSession(message.chatID);
186249
+ this.setWebviewToChat();
186250
+ break;
186251
+ case "chatSession":
186252
+ switch (message.action) {
186253
+ case "new":
186254
+ this.clearAndRestartSession();
186255
+ break;
186256
+ case "duplicate":
186257
+ await this.duplicateSession(message.sessionID ?? this.chatBuilder.sessionID);
186258
+ break;
186352
186259
  }
186353
- if (!serverName) {
186260
+ break;
186261
+ case "command":
186262
+ commands$1.executeCommand(message.id, message.arg ?? message.args);
186263
+ break;
186264
+ case "mcp": {
186265
+ const mcpManager = MCPManager.instance;
186266
+ if (!mcpManager) {
186267
+ logDebug("ChatController", "MCP Manager is not initialized");
186354
186268
  break;
186355
186269
  }
186356
- switch (message.type) {
186357
- case "addServer": {
186358
- if (!message.config) {
186270
+ const serverName = message.name;
186271
+ try {
186272
+ if (message.type === "updateServer" && !serverName) {
186273
+ mcpManager.refreshServers();
186274
+ break;
186275
+ }
186276
+ if (!serverName) {
186277
+ break;
186278
+ }
186279
+ switch (message.type) {
186280
+ case "addServer": {
186281
+ if (!message.config) {
186282
+ break;
186283
+ }
186284
+ await mcpManager.addServer(serverName, message.config);
186285
+ const newServer = mcpManager.getServers().find((s) => s.name === serverName);
186286
+ if (newServer) {
186287
+ void this.postMessage({
186288
+ type: "clientAction",
186289
+ mcpServerChanged: {
186290
+ name: newServer.name,
186291
+ server: newServer
186292
+ }
186293
+ });
186294
+ }
186359
186295
  break;
186360
186296
  }
186361
- await mcpManager.addServer(serverName, message.config);
186362
- const newServer = mcpManager.getServers().find((s) => s.name === serverName);
186363
- if (newServer) {
186364
- void this.postMessage({
186297
+ case "updateServer":
186298
+ if (message.config) {
186299
+ await mcpManager.updateServer(serverName, message.config);
186300
+ } else if (message.toolName) {
186301
+ const isDisabled = message.toolDisabled === true;
186302
+ await mcpManager.setToolState(
186303
+ serverName,
186304
+ message.toolName,
186305
+ isDisabled
186306
+ );
186307
+ }
186308
+ break;
186309
+ case "removeServer": {
186310
+ await mcpManager.deleteServer(serverName);
186311
+ this.postMessage({
186365
186312
  type: "clientAction",
186366
186313
  mcpServerChanged: {
186367
- name: newServer.name,
186368
- server: newServer
186314
+ name: serverName,
186315
+ server: null
186369
186316
  }
186370
186317
  });
186318
+ break;
186371
186319
  }
186372
- break;
186373
- }
186374
- case "updateServer":
186375
- if (message.config) {
186376
- await mcpManager.updateServer(serverName, message.config);
186377
- } else if (message.toolName) {
186378
- const isDisabled = message.toolDisabled === true;
186379
- await mcpManager.setToolState(serverName, message.toolName, isDisabled);
186380
- }
186381
- break;
186382
- case "removeServer": {
186383
- await mcpManager.deleteServer(serverName);
186384
- this.postMessage({
186385
- type: "clientAction",
186386
- mcpServerChanged: {
186387
- name: serverName,
186388
- server: null
186389
- }
186390
- });
186391
- break;
186320
+ default:
186321
+ logDebug("ChatController", `Unknown MCP operation: ${message.type}`);
186392
186322
  }
186393
- default:
186394
- logDebug("ChatController", `Unknown MCP operation: ${message.type}`);
186323
+ } catch (error) {
186324
+ const errorMessage = error instanceof Error ? error.message : String(error);
186325
+ logDebug("ChatController", `Failed to ${message.type} server`, errorMessage);
186326
+ void this.postMessage({
186327
+ type: "clientAction",
186328
+ mcpServerError: {
186329
+ name: "name" in message ? serverName : "",
186330
+ error: errorMessage
186331
+ },
186332
+ mcpServerChanged: null
186333
+ });
186395
186334
  }
186396
- } catch (error) {
186397
- const errorMessage = error instanceof Error ? error.message : String(error);
186398
- logDebug("ChatController", `Failed to ${message.type} server`, errorMessage);
186399
- void this.postMessage({
186400
- type: "clientAction",
186401
- mcpServerError: {
186402
- name: "name" in message ? serverName : "",
186403
- error: errorMessage
186404
- },
186405
- mcpServerChanged: null
186406
- });
186407
- }
186408
- break;
186409
- }
186410
- case "recordEvent":
186411
- telemetryRecorder.recordEvent(
186412
- // 👷 HACK: We have no control over what gets sent over JSON RPC,
186413
- // so we depend on client implementations to give type guidance
186414
- // to ensure that we don't accidentally share arbitrary,
186415
- // potentially sensitive string values. In this RPC handler,
186416
- // when passing the provided event to the TelemetryRecorder
186417
- // implementation, we forcibly cast all the inputs below
186418
- // (feature, action, parameters) into known types (strings
186419
- // 'feature', 'action', 'key') so that the recorder will accept
186420
- // it. DO NOT do this elsewhere!
186421
- message.feature,
186422
- message.action,
186423
- message.parameters
186424
- );
186425
- break;
186426
- case "auth": {
186427
- if (message.authKind === "refresh") {
186428
- authProvider.refresh();
186429
186335
  break;
186430
186336
  }
186431
- if (message.authKind === "simplified-onboarding") {
186432
- const endpoint = DOTCOM_URL.href;
186433
- let tokenReceiverUrl = void 0;
186434
- closeAuthProgressIndicator();
186435
- startAuthProgressIndicator();
186436
- tokenReceiverUrl = await ((_c2 = this.startTokenReceiver) == null ? void 0 : _c2.call(this, endpoint, async (credentials) => {
186337
+ case "recordEvent":
186338
+ telemetryRecorder.recordEvent(
186339
+ // 👷 HACK: We have no control over what gets sent over JSON RPC,
186340
+ // so we depend on client implementations to give type guidance
186341
+ // to ensure that we don't accidentally share arbitrary,
186342
+ // potentially sensitive string values. In this RPC handler,
186343
+ // when passing the provided event to the TelemetryRecorder
186344
+ // implementation, we forcibly cast all the inputs below
186345
+ // (feature, action, parameters) into known types (strings
186346
+ // 'feature', 'action', 'key') so that the recorder will accept
186347
+ // it. DO NOT do this elsewhere!
186348
+ message.feature,
186349
+ message.action,
186350
+ message.parameters
186351
+ );
186352
+ break;
186353
+ case "auth": {
186354
+ if (message.authKind === "refresh") {
186355
+ authProvider.refresh();
186356
+ break;
186357
+ }
186358
+ if (message.authKind === "simplified-onboarding") {
186359
+ const endpoint = DOTCOM_URL.href;
186360
+ let tokenReceiverUrl = void 0;
186437
186361
  closeAuthProgressIndicator();
186438
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186439
- credentials,
186440
- "store-if-valid"
186362
+ startAuthProgressIndicator();
186363
+ tokenReceiverUrl = await ((_c2 = this.startTokenReceiver) == null ? void 0 : _c2.call(
186364
+ this,
186365
+ endpoint,
186366
+ async (credentials) => {
186367
+ closeAuthProgressIndicator();
186368
+ const authStatus2 = await authProvider.validateAndStoreCredentials(
186369
+ credentials,
186370
+ "store-if-valid"
186371
+ );
186372
+ telemetryRecorder.recordEvent(
186373
+ "cody.auth.fromTokenReceiver.web",
186374
+ "succeeded",
186375
+ {
186376
+ metadata: {
186377
+ success: authStatus2.authenticated ? 1 : 0
186378
+ },
186379
+ billingMetadata: {
186380
+ product: "cody",
186381
+ category: "billable"
186382
+ }
186383
+ }
186384
+ );
186385
+ if (!authStatus2.authenticated) {
186386
+ void window$1.showErrorMessage(
186387
+ "Authentication failed. Please check your token and try again."
186388
+ );
186389
+ }
186390
+ }
186391
+ ));
186392
+ const authProviderSimplified = new AuthProviderSimplified();
186393
+ const authMethod = message.authMethod || "dotcom";
186394
+ const successfullyOpenedUrl = await authProviderSimplified.openExternalAuthUrl(
186395
+ authMethod,
186396
+ tokenReceiverUrl
186441
186397
  );
186442
- telemetryRecorder.recordEvent("cody.auth.fromTokenReceiver.web", "succeeded", {
186443
- metadata: {
186444
- success: authStatus2.authenticated ? 1 : 0
186445
- },
186446
- billingMetadata: {
186447
- product: "cody",
186448
- category: "billable"
186398
+ if (!successfullyOpenedUrl) {
186399
+ closeAuthProgressIndicator();
186400
+ }
186401
+ break;
186402
+ }
186403
+ if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
186404
+ try {
186405
+ const { endpoint, value: token } = message;
186406
+ let auth2 = void 0;
186407
+ if (token) {
186408
+ auth2 = {
186409
+ credentials: { token, source: "paste" },
186410
+ serverEndpoint: endpoint
186411
+ };
186412
+ } else {
186413
+ const { configuration } = await currentResolvedConfig();
186414
+ auth2 = await resolveAuth(endpoint, configuration, secretStorage);
186449
186415
  }
186450
- });
186451
- if (!authStatus2.authenticated) {
186452
- void window$1.showErrorMessage(
186453
- "Authentication failed. Please check your token and try again."
186454
- );
186416
+ if (!auth2 || !auth2.credentials) {
186417
+ return redirectToEndpointLogin(endpoint);
186418
+ }
186419
+ await authProvider.validateAndStoreCredentials(auth2, "always-store");
186420
+ } catch (error) {
186421
+ void window$1.showErrorMessage(`Authentication failed: ${error}`);
186422
+ this.postError(new Error(`Authentication failed: ${error}`));
186455
186423
  }
186456
- }));
186457
- const authProviderSimplified = new AuthProviderSimplified();
186458
- const authMethod = message.authMethod || "dotcom";
186459
- const successfullyOpenedUrl = await authProviderSimplified.openExternalAuthUrl(
186460
- authMethod,
186461
- tokenReceiverUrl
186462
- );
186463
- if (!successfullyOpenedUrl) {
186464
- closeAuthProgressIndicator();
186424
+ break;
186465
186425
  }
186466
- break;
186467
- }
186468
- if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
186469
- try {
186470
- const { endpoint, value: token } = message;
186471
- let auth2 = void 0;
186472
- if (token) {
186473
- auth2 = {
186474
- credentials: { token, source: "paste" },
186475
- serverEndpoint: endpoint
186476
- };
186426
+ if (message.authKind === "signout") {
186427
+ const serverEndpoint = message.endpoint;
186428
+ if (serverEndpoint) {
186429
+ await signOut(serverEndpoint);
186477
186430
  } else {
186478
- const { configuration } = await currentResolvedConfig();
186479
- auth2 = await resolveAuth(endpoint, configuration, secretStorage);
186480
- }
186481
- if (!auth2 || !auth2.credentials) {
186482
- return redirectToEndpointLogin(endpoint);
186431
+ await showSignOutMenu();
186483
186432
  }
186484
- await authProvider.validateAndStoreCredentials(auth2, "always-store");
186485
- } catch (error) {
186486
- void window$1.showErrorMessage(`Authentication failed: ${error}`);
186487
- this.postError(new Error(`Authentication failed: ${error}`));
186433
+ await this.sendConfig(currentAuthStatus());
186434
+ break;
186488
186435
  }
186436
+ if (message.authKind === "switch") {
186437
+ await showSignInMenu();
186438
+ break;
186439
+ }
186440
+ await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186489
186441
  break;
186490
186442
  }
186491
- if (message.authKind === "signout") {
186492
- const serverEndpoint = message.endpoint;
186493
- if (serverEndpoint) {
186494
- await signOut(serverEndpoint);
186495
- } else {
186496
- await showSignOutMenu();
186443
+ case "simplified-onboarding": {
186444
+ if (message.onboardingKind === "web-sign-in-token") {
186445
+ void window$1.showInputBox({ prompt: "Enter web sign-in token" }).then(async (token) => {
186446
+ if (!token) {
186447
+ return;
186448
+ }
186449
+ const authStatus2 = await authProvider.validateAndStoreCredentials(
186450
+ {
186451
+ serverEndpoint: DOTCOM_URL.href,
186452
+ credentials: { token }
186453
+ },
186454
+ "store-if-valid"
186455
+ );
186456
+ if (!authStatus2.authenticated) {
186457
+ void window$1.showErrorMessage(
186458
+ "Authentication failed. Please check your token and try again."
186459
+ );
186460
+ }
186461
+ });
186462
+ break;
186497
186463
  }
186498
- await this.sendConfig(currentAuthStatus());
186499
186464
  break;
186500
186465
  }
186501
- if (message.authKind === "switch") {
186502
- await showSignInMenu();
186466
+ case "log": {
186467
+ const logger2 = message.level === "debug" ? logDebug : logError$2;
186468
+ logger2(message.filterLabel, message.message);
186503
186469
  break;
186504
186470
  }
186505
- await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186506
- break;
186507
- }
186508
- case "simplified-onboarding": {
186509
- if (message.onboardingKind === "web-sign-in-token") {
186510
- void window$1.showInputBox({ prompt: "Enter web sign-in token" }).then(async (token) => {
186511
- if (!token) {
186512
- return;
186513
- }
186514
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186515
- {
186516
- serverEndpoint: DOTCOM_URL.href,
186517
- credentials: { token }
186518
- },
186519
- "store-if-valid"
186520
- );
186521
- if (!authStatus2.authenticated) {
186522
- void window$1.showErrorMessage(
186523
- "Authentication failed. Please check your token and try again."
186524
- );
186525
- }
186471
+ case "devicePixelRatio": {
186472
+ localStorage.setDevicePixelRatio(message.devicePixelRatio);
186473
+ break;
186474
+ }
186475
+ case "regenerateCodeBlock": {
186476
+ await this.handleRegenerateCodeBlock({
186477
+ requestID: message.id,
186478
+ code: PromptString.unsafe_fromLLMResponse(message.code),
186479
+ language: message.language ? PromptString.unsafe_fromLLMResponse(message.language) : void 0,
186480
+ index: message.index
186526
186481
  });
186527
186482
  break;
186528
186483
  }
186529
- break;
186530
- }
186531
- case "log": {
186532
- const logger2 = message.level === "debug" ? logDebug : logError$2;
186533
- logger2(message.filterLabel, message.message);
186534
- break;
186535
- }
186536
- case "devicePixelRatio": {
186537
- localStorage.setDevicePixelRatio(message.devicePixelRatio);
186538
- break;
186539
- }
186540
- case "regenerateCodeBlock": {
186541
- await this.handleRegenerateCodeBlock({
186542
- requestID: message.id,
186543
- code: PromptString.unsafe_fromLLMResponse(message.code),
186544
- language: message.language ? PromptString.unsafe_fromLLMResponse(message.language) : void 0,
186545
- index: message.index
186546
- });
186547
- break;
186548
186484
  }
186485
+ } catch (error) {
186486
+ this.postError(error);
186549
186487
  }
186550
186488
  }
186551
186489
  isSmartApplyEnabled() {
@@ -186939,72 +186877,6 @@ class ChatController {
186939
186877
  (_a3 = this.submitOrEditOperation) == null ? void 0 : _a3.abort();
186940
186878
  this.submitOrEditOperation = void 0;
186941
186879
  }
186942
- async reevaluateSearchWithSelectedFilters({
186943
- index: index2,
186944
- selectedFilters
186945
- }) {
186946
- var _a3;
186947
- if (index2 === void 0 || !Array.isArray(selectedFilters)) {
186948
- return;
186949
- }
186950
- this.handleAbort();
186951
- const humanMessage = this.chatBuilder.getMessages().at(index2);
186952
- const assistantMessage = this.chatBuilder.getMessages().at(index2 + 1);
186953
- if ((humanMessage == null ? void 0 : humanMessage.speaker) !== "human" || humanMessage.intent !== "search" || (assistantMessage == null ? void 0 : assistantMessage.speaker) !== "assistant" || !((_a3 = assistantMessage == null ? void 0 : assistantMessage.search) == null ? void 0 : _a3.query)) {
186954
- return;
186955
- }
186956
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186957
- ...assistantMessage,
186958
- search: {
186959
- ...assistantMessage.search,
186960
- selectedFilters
186961
- },
186962
- text: void 0
186963
- });
186964
- this.postViewTranscript();
186965
- try {
186966
- const query2 = this.appendSelectedFiltersToSearchQuery({
186967
- query: assistantMessage.search.query,
186968
- filters: selectedFilters
186969
- });
186970
- const response = await graphqlClient.nlsSearchQuery({ query: query2 });
186971
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186972
- ...assistantMessage,
186973
- error: void 0,
186974
- search: {
186975
- ...assistantMessage.search,
186976
- queryWithSelectedFilters: query2,
186977
- response,
186978
- selectedFilters
186979
- },
186980
- text: ps`search found ${(response == null ? void 0 : response.results.results.length) || 0} results`
186981
- });
186982
- } catch (err2) {
186983
- this.chatBuilder.addErrorAsBotMessage(err2, ChatBuilder.NO_MODEL);
186984
- } finally {
186985
- void this.saveSession();
186986
- this.postViewTranscript();
186987
- }
186988
- }
186989
- appendSelectedFiltersToSearchQuery({
186990
- query: query2,
186991
- filters
186992
- }) {
186993
- var _a3;
186994
- if (!filters.length) {
186995
- return query2;
186996
- }
186997
- const repoFilters = filters.filter((filter2) => filter2.kind === "repo");
186998
- const repoFilter = repoFilters.length ? `repo:^(${repoFilters.map((filter2) => filter2.value.replace("repo:^", "").replace(/\$$/, "")).join("|")})$` : "";
186999
- let count = 50;
187000
- switch ((_a3 = filters.find((filter2) => filter2.kind === "type")) == null ? void 0 : _a3.value) {
187001
- case "type:path":
187002
- case "type:repo":
187003
- count = 20;
187004
- break;
187005
- }
187006
- return `${query2} ${filters.filter((f) => f.kind !== "repo").map((f) => f.value).join(" ")} ${repoFilter} count:${count}`;
187007
- }
187008
186880
  /**
187009
186881
  * Handles editing a human chat message in current chat session.
187010
186882
  *
@@ -189207,8 +189079,8 @@ function parseMentionURI(uri) {
189207
189079
  }
189208
189080
  }
189209
189081
  async function execFileAsync(program2, args2, { cwd }) {
189210
- const { promisify } = await import("./util-n4JO9qgH.mjs").then((n) => n.u);
189211
- const { execFile } = await import("./vscode-shim-FP11UcS5.mjs").then((n) => n.fR);
189082
+ const { promisify } = await import("./util-BcM-aRzi.mjs").then((n) => n.u);
189083
+ const { execFile } = await import("./vscode-shim-DCfZW3km.mjs").then((n) => n.fQ);
189212
189084
  return promisify(execFile)(program2, args2, { cwd });
189213
189085
  }
189214
189086
  var __create = Object.create;
@@ -198952,6 +198824,13 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
198952
198824
  })
198953
198825
  )
198954
198826
  );
198827
+ if (isPlgEsAccessDisabled()) {
198828
+ const endpoints = localStorage.getEndpointHistory() || [];
198829
+ const endpointsToLogout = endpoints.filter(
198830
+ (endpoint) => isDotCom({ endpoint }) || isWorkspaceInstance({ endpoint })
198831
+ );
198832
+ void Promise.all(endpointsToLogout.map((endpoint) => signOut(endpoint)));
198833
+ }
198955
198834
  disposables.push(
198956
198835
  subscriptionDisposable(
198957
198836
  resolvedConfig.subscribe((config) => {