@sourcegraph/cody-web 0.32.11 → 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, dV as RelativePattern, aR as isErrorLike, dW as isWindows, dX as GLOBAL_SEARCH_PROVIDER_URI, dY as mentionProvidersMetadata, dZ as currentUserProductSubscription, d_ as checkIfEnterpriseUser, d$ as ThemeColor, e0 as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e1 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e2 as CodeLens, e3 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e4 as EndOfLine, e5 as ViewColumn, e6 as Location, e7 as onDidChangeActiveTextEditor, e8 as tabGroups, e9 as workspaceTextDocuments, ea as visibleTextEditors, eb as onDidChangeVisibleTextEditors, ec as fs, ed as onDidCloseTextDocument, ee as setCreateWebviewPanel, ef as getAugmentedNamespace, eg as extensionConfiguration, eh as main$1, ei as setAgent, ej as setWorkspaceDocuments, ek as setLastOpenedWorkspaceFolder, el as onDidRegisterNewCodeActionProvider, em as onDidUnregisterNewCodeActionProvider, en as onDidRegisterNewCodeLensProvider, eo as onDidUnregisterNewCodeLensProvider, ep as setClientInfo, eq as AgentWorkspaceConfiguration, er as firstNonPendingAuthStatus, es as workspaceFolders$1, et as setWorkspaceFolders, eu as onDidChangeWorkspaceFolders, ev as onDidChangeWindowState, ew as onDidOpenTextDocument, ex as onDidSaveTextDocument, ey as onDidRenameFiles, ez as packageJson, eA as progressBars, eB as CodeActionTriggerKind, eC as CodeAction, eD as UriString, eE as DiagnosticSeverity, eF as diagnostics, eG as isIntegrationTesting, eH as TESTING_TELEMETRY_EXPORTER, eI as dist, eJ as completionProvider, eK as InlineCompletionTriggerKind, eL as currentAuthStatusAuthed, eM as waitUntilComplete, eN as setExtensionConfiguration, eO as onDidChangeConfiguration, eP as onDidChangeTextDocument, eQ as onDidChangeTextEditorSelection, eR as isTokenOrEndpointChange, at as isMacOS, av as CustomCommandType, 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-B21LtK8E.mjs";
22
- import { a as util$5, i as inherits_browserExports } from "./util-Bw-hmK0e.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-IdTumKP8.mjs");
8165
+ const tiktoken = await import("./lite-ch5VbcSy.mjs");
8165
8166
  return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
8166
8167
  });
8167
8168
  } else {
@@ -20864,7 +20865,7 @@ function requireBuffer_list() {
20864
20865
  return String(input);
20865
20866
  }
20866
20867
  var _require = requireBuffer(), Buffer2 = _require.Buffer;
20867
- var _require2 = util$5, inspect = _require2.inspect;
20868
+ var _require2 = requireUtil(), inspect = _require2.inspect;
20868
20869
  var custom2 = inspect && inspect.custom || "inspect";
20869
20870
  function copyBuffer(src, target, offset2) {
20870
20871
  Buffer2.prototype.copy.call(src, target, offset2);
@@ -22456,9 +22457,9 @@ function require_stream_readable() {
22456
22457
  function _isUint8Array(obj) {
22457
22458
  return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
22458
22459
  }
22459
- var debugUtil = util$5;
22460
+ var debugUtil = requireUtil();
22460
22461
  var debug2;
22461
- if (debugUtil.debuglog) {
22462
+ if (debugUtil && debugUtil.debuglog) {
22462
22463
  debug2 = debugUtil.debuglog("stream");
22463
22464
  } else {
22464
22465
  debug2 = function debug22() {
@@ -23990,6 +23991,11 @@ class LocalStorage {
23990
23991
  async setAutoeditBetaEnrollment() {
23991
23992
  await this.set(this.AUTO_EDITS_BETA_ENROLLED, true);
23992
23993
  }
23994
+ async resetStorage() {
23995
+ for (const key2 of this.storage.keys()) {
23996
+ await this.storage.update(key2, void 0);
23997
+ }
23998
+ }
23993
23999
  async setGitHubRepoAccessibility(data) {
23994
24000
  await this.set(this.GIT_REPO_ACCESSIBILITY_KEY, data);
23995
24001
  }
@@ -24412,6 +24418,13 @@ async function serializeConfigSnapshot(uninstall) {
24412
24418
  await ensureDirectoryExists(directory);
24413
24419
  await writeSnapshot(directory, CONFIG_FILE, uninstall);
24414
24420
  }
24421
+ let cached;
24422
+ function isRunningInsideAgent() {
24423
+ if (cached === void 0) {
24424
+ cached = workspace.getConfiguration().get("cody.advanced.agent.running", false);
24425
+ }
24426
+ return cached;
24427
+ }
24415
24428
  const version = ((_i = (_h = extensions.getExtension("sourcegraph.cody-ai")) == null ? void 0 : _h.packageJSON) == null ? void 0 : _i.version) ?? version$2;
24416
24429
  setExtensionVersion(version);
24417
24430
  const HAS_AUTHENTICATED_BEFORE_KEY = "has-authenticated-before";
@@ -24480,7 +24493,9 @@ class AuthProvider {
24480
24493
  authStatus.subscribe((authStatus2) => {
24481
24494
  try {
24482
24495
  this.lastEndpoint = authStatus2.endpoint;
24483
- commands$1.executeCommand("authStatus.update", authStatus2);
24496
+ if (isRunningInsideAgent()) {
24497
+ commands$1.executeCommand("authStatus.update", authStatus2);
24498
+ }
24484
24499
  commands$1.executeCommand(
24485
24500
  "setContext",
24486
24501
  "cody.activated",
@@ -39014,17 +39029,14 @@ function toVSCodeRange(range) {
39014
39029
  }
39015
39030
  return new Range(range.start.line, range.start.character, range.end.line, range.end.character);
39016
39031
  }
39017
- async function findWorkspaceFiles(cancellationToken) {
39018
- return (await Promise.all(
39019
- (workspace.workspaceFolders ?? [null]).map(
39020
- async (workspaceFolder) => workspace.findFiles(
39021
- workspaceFolder ? new RelativePattern(workspaceFolder, "**") : "",
39022
- await getExcludePattern(workspaceFolder),
39023
- void 0,
39024
- cancellationToken
39025
- )
39026
- )
39027
- )).flat();
39032
+ async function findWorkspaceFiles() {
39033
+ var _a3;
39034
+ const excludePatterns = await Promise.all(
39035
+ ((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.flatMap((workspaceFolder) => {
39036
+ return getExcludePattern(workspaceFolder);
39037
+ })) ?? []
39038
+ );
39039
+ return workspace.findFiles("**/*", `{${excludePatterns.join(",")}}`);
39028
39040
  }
39029
39041
  async function getExcludePattern(workspaceFolder) {
39030
39042
  const config = workspace.getConfiguration("", workspaceFolder);
@@ -39039,8 +39051,7 @@ async function getExcludePattern(workspaceFolder) {
39039
39051
  ...gitignoreExclude,
39040
39052
  ...ignoreExclude
39041
39053
  };
39042
- const excludePatterns = Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
39043
- return `{${excludePatterns.join(",")}}`;
39054
+ return Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
39044
39055
  }
39045
39056
  async function readIgnoreFile(uri) {
39046
39057
  const ignore = {};
@@ -39050,10 +39061,13 @@ async function readIgnoreFile(uri) {
39050
39061
  if (line.startsWith("!")) {
39051
39062
  continue;
39052
39063
  }
39053
- line = line.replace(/\s*(#.*)?$/, "");
39064
+ line = line.replace(/\s*(#.*)?$/, "").trim();
39054
39065
  if (line === "") {
39055
39066
  continue;
39056
39067
  }
39068
+ if (line.includes(",")) {
39069
+ line = line.replace(",", ".");
39070
+ }
39057
39071
  if (line.endsWith("/")) {
39058
39072
  line = line.slice(0, -1);
39059
39073
  }
@@ -40503,13 +40517,6 @@ const getInput = async (document2, initialValues, source) => {
40503
40517
  }
40504
40518
  });
40505
40519
  };
40506
- let cached;
40507
- function isRunningInsideAgent() {
40508
- if (cached === void 0) {
40509
- cached = workspace.getConfiguration().get("cody.advanced.agent.running", false);
40510
- }
40511
- return cached;
40512
- }
40513
40520
  class ContentProvider {
40514
40521
  constructor() {
40515
40522
  // This stores the content of the document for each task ID
@@ -43534,7 +43541,7 @@ function requireLib() {
43534
43541
  const MurmurHash3 = requireImurmurhash();
43535
43542
  const { onExit } = requireCjs();
43536
43543
  const path2 = pathBrowserify;
43537
- const { promisify } = util$5;
43544
+ const { promisify } = requireUtil();
43538
43545
  const activeFiles = {};
43539
43546
  const threadId = function getId() {
43540
43547
  try {
@@ -44637,6 +44644,16 @@ class Agent extends MessageHandler {
44637
44644
  this.registerNotification("extensionConfiguration/didChange", (config) => {
44638
44645
  this.handleConfigChanges(config);
44639
44646
  });
44647
+ this.registerNotification("testing/runInAgent", (scenario) => {
44648
+ try {
44649
+ if (scenario === "configuration-test-configuration-update") {
44650
+ const configuration = workspace.getConfiguration();
44651
+ configuration.update("cody.dummy.setting", "random");
44652
+ }
44653
+ } catch (error) {
44654
+ console.error("Error in testing/runInAgent:", error);
44655
+ }
44656
+ });
44640
44657
  this.registerRequest("extensionConfiguration/change", async (config) => {
44641
44658
  return this.handleConfigChanges(config).then(toProtocolAuthStatus);
44642
44659
  });
@@ -45346,6 +45363,9 @@ class Agent extends MessageHandler {
45346
45363
  this.registerNotification("secrets/didChange", async ({ key: key2 }) => {
45347
45364
  this.secretsDidChange.fire({ key: key2 });
45348
45365
  });
45366
+ this.registerNotification("testing/resetStorage", () => {
45367
+ localStorage.resetStorage();
45368
+ });
45349
45369
  this.registerAuthenticatedRequest("featureFlags/getFeatureFlag", async ({ flagName }) => {
45350
45370
  return featureFlagProvider.evaluateFeatureFlagEphemerally(
45351
45371
  FeatureFlag[flagName]
@@ -46744,7 +46764,7 @@ class CommandsProvider {
46744
46764
  if (!isFileURI(uri)) {
46745
46765
  throw new Error("history only supported on local file paths");
46746
46766
  }
46747
- const { getContextFileFromGitLog } = await import("./git-log-DkGd4KuH.mjs");
46767
+ const { getContextFileFromGitLog } = await import("./git-log-Sw0MOWAb.mjs");
46748
46768
  return getContextFileFromGitLog(uri, options);
46749
46769
  }
46750
46770
  dispose() {
@@ -151708,6 +151728,11 @@ class DefaultCodeCompletionsClient {
151708
151728
  async complete(params, abortController, providerOptions) {
151709
151729
  const { auth: auth2, configuration } = await currentResolvedConfig();
151710
151730
  const query2 = new URLSearchParams(getClientInfoQueryParams());
151731
+ const siteVersion2 = await currentSiteVersion();
151732
+ if (isError$3(siteVersion2)) {
151733
+ throw siteVersion2;
151734
+ }
151735
+ query2.append("api-version", String(siteVersion2.codyAPIVersion));
151711
151736
  const url = new URL(`/.api/completions/code?${query2.toString()}`, auth2.serverEndpoint);
151712
151737
  const log2 = autocompleteLifecycleOutputChannelLogger == null ? void 0 : autocompleteLifecycleOutputChannelLogger.startCompletion(params, url.href);
151713
151738
  const { signal: signal2 } = abortController;
@@ -151791,9 +151816,12 @@ class DefaultCodeCompletionsClient {
151791
151816
  };
151792
151817
  if (isStreamingResponse && isNodeResponse(response)) {
151793
151818
  const iterator = createSSEIterator(response.body, {
151794
- aggregatedCompletionEvent: true
151819
+ // Disable aggregatedCompletionEvent for deltaText format (API v2+)
151820
+ // since we need all completion events to accumulate the text properly
151821
+ aggregatedCompletionEvent: siteVersion2.codyAPIVersion < 2
151795
151822
  });
151796
151823
  let chunkIndex = 0;
151824
+ let completionText = "";
151797
151825
  for await (const { event: event2, data } of iterator) {
151798
151826
  if (event2 === "error") {
151799
151827
  throw new TracedError(data, traceId);
@@ -151809,8 +151837,13 @@ class DefaultCodeCompletionsClient {
151809
151837
  }
151810
151838
  if (event2 === "completion") {
151811
151839
  const parsed = JSON.parse(data);
151840
+ if (siteVersion2.codyAPIVersion >= 2) {
151841
+ completionText += parsed.deltaText || "";
151842
+ } else {
151843
+ completionText = parsed.completion || "";
151844
+ }
151812
151845
  result.completionResponse = {
151813
- completion: parsed.completion || "",
151846
+ completion: completionText,
151814
151847
  stopReason: parsed.stopReason || CompletionStopReason.StreamingChunk
151815
151848
  };
151816
151849
  span2.addEvent("yield", {
@@ -171977,48 +172010,6 @@ async function doRewrite(completionsClient, query2, signal2) {
171977
172010
  const match2 = text2.match(/<query>(.*?)<\/query>/);
171978
172011
  return (match2 == null ? void 0 : match2[1]) ?? query2.toString();
171979
172012
  }
171980
- async function extractKeywords(completionsClient, query2, signal2) {
171981
- const preamble = getSimplePreamble(void 0, LEGACY_API_VERSION, "Default");
171982
- const client = new ChatClient(completionsClient);
171983
- const stream = await client.chat(
171984
- [
171985
- ...preamble,
171986
- {
171987
- speaker: "human",
171988
- 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>`
171989
- }
171990
- ],
171991
- {
171992
- maxTokensToSample: 400,
171993
- temperature: 0,
171994
- topK: 1,
171995
- fast: true
171996
- },
171997
- signal2
171998
- );
171999
- let lastMessageText = "<keywords></keywords>";
172000
- for await (const message of stream) {
172001
- switch (message.type) {
172002
- case "change": {
172003
- lastMessageText = message.text;
172004
- break;
172005
- }
172006
- case "error": {
172007
- throw message.error;
172008
- }
172009
- }
172010
- }
172011
- const document2 = new fxp.XMLParser().parse(lastMessageText);
172012
- let keywords = [];
172013
- if (document2.keywords) {
172014
- if (Array.isArray(document2.keywords.keyword)) {
172015
- keywords = document2.keywords.keyword;
172016
- } else if (document2.keywords.keyword) {
172017
- keywords = [document2.keywords.keyword];
172018
- }
172019
- }
172020
- return keywords.flatMap((keyword) => keyword.split(" ").filter((v) => v !== ""));
172021
- }
172022
172013
  async function searchSymf(symf, editor, workspaceRoot, userText, blockOnIndex = false) {
172023
172014
  return wrapInActiveSpan("chat.context.symf", async () => {
172024
172015
  if (!symf) {
@@ -172204,20 +172195,6 @@ class ContextRetriever {
172204
172195
  skipQueryRewrite
172205
172196
  );
172206
172197
  }
172207
- /**
172208
- * Computes a "Did you mean?" suggestion for a given query by extracting keywords.
172209
- * Only attempts to extract keywords for queries that look like search queries.
172210
- */
172211
- async computeDidYouMean(query2, signal2) {
172212
- if (!looksLikeSearch(query2.toString())) {
172213
- return void 0;
172214
- }
172215
- const keywords = await extractKeywords(this.llms, query2, signal2);
172216
- if (keywords.length > 0) {
172217
- return keywords.join(" ");
172218
- }
172219
- return void 0;
172220
- }
172221
172198
  async _retrieveContext(roots, query2, span2, signal2, skipQueryRewrite = false) {
172222
172199
  if (roots.length === 0) {
172223
172200
  return [];
@@ -172247,6 +172224,7 @@ class ContextRetriever {
172247
172224
  "Failed to get locally modified files, falling back to indexed context only",
172248
172225
  error
172249
172226
  );
172227
+ changedFilesByRoot = localRoots.map(() => []);
172250
172228
  }
172251
172229
  const [liveContext, indexedContext] = await Promise.all([
172252
172230
  this.retrieveLiveContext(query2, rewrittenQuery.rewritten, changedFiles, signal2),
@@ -172419,7 +172397,8 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
172419
172397
  continue;
172420
172398
  }
172421
172399
  const relLocalFiles = /* @__PURE__ */ new Set();
172422
- for (const localFile of localFilesByRoot[i2]) {
172400
+ const localFiles = localFilesByRoot[i2] || [];
172401
+ for (const localFile of localFiles) {
172423
172402
  relLocalFiles.add(path.relative(localRoot.fsPath, localFile));
172424
172403
  }
172425
172404
  for (const remoteRepo of remoteRepos) {
@@ -172446,21 +172425,6 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
172446
172425
  }
172447
172426
  return { keep: keep2, remove };
172448
172427
  }
172449
- const searchPatterns = [
172450
- /^where is/i,
172451
- /^look for/i,
172452
- /^search for/i,
172453
- /^find all/i,
172454
- /^list all/i,
172455
- /^get all/i,
172456
- /^show all/i,
172457
- /occurrences of/i,
172458
- /^where do we/i,
172459
- /examples of/i
172460
- ];
172461
- function looksLikeSearch(query2) {
172462
- return searchPatterns.some((pattern) => pattern.test(query2.trim()));
172463
- }
172464
172428
  function sortContextItemsIfInTest(files) {
172465
172429
  {
172466
172430
  return files;
@@ -172915,7 +172879,6 @@ class ChatHandler {
172915
172879
  model: model2
172916
172880
  }, delegate) {
172917
172881
  mentions = mentions.map((m) => m.source ? m : { ...m, source: ContextItemSource.User });
172918
- const didYouMeanPromise = this.contextRetriever.computeDidYouMean(inputText, signal2);
172919
172882
  const contextResult = await this.computeContext(
172920
172883
  requestID,
172921
172884
  { text: inputText, mentions },
@@ -172943,25 +172906,11 @@ class ChatHandler {
172943
172906
  const { prompt } = await this.buildPrompt(prompter2, chatBuilder, signal2, versions.codyAPIVersion);
172944
172907
  recorder2.recordChatQuestionExecuted(corpusContext, { addMetadata: true, current: span2 });
172945
172908
  signal2.throwIfAborted();
172946
- const didYouMeanQuery = await didYouMeanPromise;
172947
- const delegateWithDidYouMean = {
172948
- ...delegate,
172949
- postMessageInProgress: (message) => {
172950
- delegate.postMessageInProgress({ ...message, didYouMeanQuery });
172951
- }
172952
- };
172953
- delegateWithDidYouMean.postMessageInProgress({
172909
+ delegate.postMessageInProgress({
172954
172910
  speaker: "assistant",
172955
172911
  model: model2
172956
172912
  });
172957
- this.streamAssistantResponse(
172958
- requestID,
172959
- prompt,
172960
- model2,
172961
- signal2,
172962
- chatBuilder,
172963
- delegateWithDidYouMean
172964
- );
172913
+ this.streamAssistantResponse(requestID, prompt, model2, signal2, chatBuilder, delegate);
172965
172914
  }
172966
172915
  /**
172967
172916
  * Issue the chat request and stream the results back, updating the model and view
@@ -173262,7 +173211,7 @@ function getDeepCodyModel(models) {
173262
173211
  return matches2.find((m) => m !== void 0) || models.find((m) => m.tags.includes(ModelTag.Speed));
173263
173212
  }
173264
173213
  var define_process_default$4 = { env: {} };
173265
- const execAsync = util$5.promisify(exec);
173214
+ const execAsync = utilExports.promisify(exec);
173266
173215
  const HOME_DIR = define_process_default$4.env.HOME || define_process_default$4.env.USERPROFILE || "";
173267
173216
  const OUTPUT_WRAPPER = `
173268
173217
  Terminal output from the \`{command}\` command enclosed between <OUTPUT0412> tags:
@@ -180846,74 +180795,88 @@ function getCorpusContextItemsForEditorState() {
180846
180795
  ),
180847
180796
  distinctUntilChanged$1()
180848
180797
  );
180849
- return combineLatest$1(relevantAuthStatus, remoteReposForAllWorkspaceFolders).pipe(
180850
- abortableOperation(async ([authStatus2, remoteReposForAllWorkspaceFolders2], signal2) => {
180851
- var _a3;
180852
- const items = [];
180853
- const workspaceFolder = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.at(0);
180854
- if (workspaceFolder) {
180855
- items.push({
180856
- type: "tree",
180857
- uri: workspaceFolder.uri,
180858
- title: "Current Repository",
180859
- name: workspaceFolder.name,
180860
- description: workspaceFolder.name,
180861
- isWorkspaceRoot: true,
180862
- content: null,
180863
- source: ContextItemSource.Initial,
180864
- icon: "folder"
180865
- });
180866
- }
180867
- if (authStatus2.allowRemoteContext) {
180868
- if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
180869
- return pendingOperation;
180870
- }
180871
- if (isError$3(remoteReposForAllWorkspaceFolders2)) {
180872
- 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
+ }
180873
180828
  }
180874
- for (const repo of remoteReposForAllWorkspaceFolders2) {
180875
- if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
180876
- continue;
180829
+ if (authStatus2.allowRemoteContext) {
180830
+ if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
180831
+ return pendingOperation;
180877
180832
  }
180878
- if (repo.id === void 0) {
180879
- continue;
180833
+ if (isError$3(remoteReposForAllWorkspaceFolders2)) {
180834
+ throw remoteReposForAllWorkspaceFolders2;
180880
180835
  }
180881
- items.push({
180882
- ...contextItemMentionFromOpenCtxItem(
180883
- await createRepositoryMention(
180884
- {
180885
- id: repo.id,
180886
- name: repo.name,
180887
- url: repo.name
180888
- },
180889
- REMOTE_REPOSITORY_PROVIDER_URI,
180890
- authStatus2
180891
- )
180892
- ),
180893
- title: "Current Codebase",
180894
- description: repo.name,
180895
- source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180896
- icon: "search"
180897
- });
180898
- }
180899
- if (authStatus2.isEnterpriseUser && remoteReposForAllWorkspaceFolders2.length === 0) {
180900
- 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
+ }
180901
180843
  items.push({
180902
- type: "open-link",
180903
- title: "Current Codebase",
180904
- badge: "Not yet available",
180905
- content: null,
180906
- uri: URI.parse(
180907
- "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
+ )
180908
180854
  ),
180909
- name: "",
180855
+ title: "Current Codebase",
180856
+ description: repo.name,
180857
+ source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180910
180858
  icon: "search"
180911
180859
  });
180912
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
+ }
180913
180876
  }
180877
+ return items;
180914
180878
  }
180915
- return items;
180916
- })
180879
+ )
180917
180880
  );
180918
180881
  }
180919
180882
  function getOpenCtxContextItems() {
@@ -186175,343 +186138,352 @@ class ChatController {
186175
186138
  */
186176
186139
  async onDidReceiveMessage(message) {
186177
186140
  var _a3, _b2, _c2;
186178
- switch (message.command) {
186179
- case "ready":
186180
- await this.handleReady();
186181
- break;
186182
- case "initialized":
186183
- await this.handleInitialized();
186184
- this.setWebviewToChat();
186185
- break;
186186
- case "submit": {
186187
- await this.handleUserMessage({
186188
- requestID: v4(),
186189
- inputText: PromptString.unsafe_fromUserQuery(message.text),
186190
- mentions: message.contextItems ?? [],
186191
- editorState: message.editorState,
186192
- signal: this.startNewSubmitOrEditOperation(),
186193
- source: "chat",
186194
- manuallySelectedIntent: message.manuallySelectedIntent,
186195
- traceparent: message.traceparent
186196
- });
186197
- break;
186198
- }
186199
- case "edit": {
186200
- this.cancelSubmitOrEditOperation();
186201
- await this.handleEdit({
186202
- requestID: v4(),
186203
- text: PromptString.unsafe_fromUserQuery(message.text),
186204
- index: message.index ?? void 0,
186205
- contextFiles: message.contextItems ?? [],
186206
- editorState: message.editorState,
186207
- manuallySelectedIntent: message.manuallySelectedIntent
186208
- });
186209
- break;
186210
- }
186211
- case "reevaluateSearchWithSelectedFilters": {
186212
- await this.reevaluateSearchWithSelectedFilters({
186213
- index: message.index ?? void 0,
186214
- selectedFilters: message.selectedFilters
186215
- });
186216
- break;
186217
- }
186218
- case "abort":
186219
- this.handleAbort();
186220
- break;
186221
- case "insert":
186222
- await handleCodeFromInsertAtCursor(message.text);
186223
- break;
186224
- case "copy":
186225
- await handleCopiedCode(message.text, message.eventType);
186226
- break;
186227
- case "smartApplyPrefetch":
186228
- case "smartApplySubmit":
186229
- await handleSmartApply({
186230
- id: message.id,
186231
- code: message.code,
186232
- authStatus: currentAuthStatus(),
186233
- instruction: message.instruction || "",
186234
- fileUri: message.fileName,
186235
- traceparent: message.traceparent || void 0,
186236
- isPrefetch: message.command === "smartApplyPrefetch"
186237
- });
186238
- break;
186239
- case "trace-export":
186240
- TraceSender.send(message.traceSpanEncodedJson);
186241
- break;
186242
- case "smartApplyAccept":
186243
- await commands$1.executeCommand("cody.command.smart-apply.accept", {
186244
- taskId: message.id
186245
- });
186246
- break;
186247
- case "smartApplyReject":
186248
- await commands$1.executeCommand("cody.command.smart-apply.reject", {
186249
- taskId: message.id
186250
- });
186251
- break;
186252
- case "openURI":
186253
- commands$1.executeCommand("vscode.open", message.uri, {
186254
- selection: message.range
186255
- });
186256
- break;
186257
- case "links": {
186258
- void openExternalLinks(message.value);
186259
- break;
186260
- }
186261
- case "openFileLink":
186262
- {
186263
- if ((_b2 = (_a3 = message == null ? void 0 : message.uri) == null ? void 0 : _a3.scheme) == null ? void 0 : _b2.startsWith("http")) {
186264
- this.openRemoteFile(message.uri, true);
186265
- return;
186266
- }
186267
- const isInSidebar = this._webviewPanelOrView && !("viewColumn" in this._webviewPanelOrView);
186268
- commands$1.executeCommand("vscode.open", message.uri, {
186269
- selection: message.range,
186270
- preserveFocus: true,
186271
- background: false,
186272
- preview: true,
186273
- // Use the active column if in sidebar, otherwise use Beside
186274
- 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
186275
186160
  });
186161
+ break;
186276
186162
  }
186277
- break;
186278
- case "openRemoteFile":
186279
- this.openRemoteFile(message.uri, message.tryLocal ?? false);
186280
- break;
186281
- case "newFile":
186282
- await handleCodeFromSaveToNewFile(message.text, this.editor);
186283
- break;
186284
- case "show-page":
186285
- await commands$1.executeCommand("cody.show-page", message.page);
186286
- break;
186287
- case "attribution-search":
186288
- await this.handleAttributionSearch(message.snippet);
186289
- break;
186290
- case "restoreHistory":
186291
- this.restoreSession(message.chatID);
186292
- this.setWebviewToChat();
186293
- break;
186294
- case "chatSession":
186295
- switch (message.action) {
186296
- case "new":
186297
- this.clearAndRestartSession();
186298
- break;
186299
- case "duplicate":
186300
- await this.duplicateSession(message.sessionID ?? this.chatBuilder.sessionID);
186301
- 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;
186302
186174
  }
186303
- break;
186304
- case "command":
186305
- commands$1.executeCommand(message.id, message.arg ?? message.args);
186306
- break;
186307
- case "mcp": {
186308
- const mcpManager = MCPManager.instance;
186309
- if (!mcpManager) {
186310
- 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);
186311
186216
  break;
186312
186217
  }
186313
- const serverName = message.name;
186314
- try {
186315
- if (message.type === "updateServer" && !serverName) {
186316
- mcpManager.refreshServers();
186317
- 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;
186318
186259
  }
186319
- 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");
186320
186268
  break;
186321
186269
  }
186322
- switch (message.type) {
186323
- case "addServer": {
186324
- 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
+ }
186325
186295
  break;
186326
186296
  }
186327
- await mcpManager.addServer(serverName, message.config);
186328
- const newServer = mcpManager.getServers().find((s) => s.name === serverName);
186329
- if (newServer) {
186330
- 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({
186331
186312
  type: "clientAction",
186332
186313
  mcpServerChanged: {
186333
- name: newServer.name,
186334
- server: newServer
186314
+ name: serverName,
186315
+ server: null
186335
186316
  }
186336
186317
  });
186318
+ break;
186337
186319
  }
186338
- break;
186339
- }
186340
- case "updateServer":
186341
- if (message.config) {
186342
- await mcpManager.updateServer(serverName, message.config);
186343
- } else if (message.toolName) {
186344
- const isDisabled = message.toolDisabled === true;
186345
- await mcpManager.setToolState(serverName, message.toolName, isDisabled);
186346
- }
186347
- break;
186348
- case "removeServer": {
186349
- await mcpManager.deleteServer(serverName);
186350
- this.postMessage({
186351
- type: "clientAction",
186352
- mcpServerChanged: {
186353
- name: serverName,
186354
- server: null
186355
- }
186356
- });
186357
- break;
186320
+ default:
186321
+ logDebug("ChatController", `Unknown MCP operation: ${message.type}`);
186358
186322
  }
186359
- default:
186360
- 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
+ });
186361
186334
  }
186362
- } catch (error) {
186363
- const errorMessage = error instanceof Error ? error.message : String(error);
186364
- logDebug("ChatController", `Failed to ${message.type} server`, errorMessage);
186365
- void this.postMessage({
186366
- type: "clientAction",
186367
- mcpServerError: {
186368
- name: "name" in message ? serverName : "",
186369
- error: errorMessage
186370
- },
186371
- mcpServerChanged: null
186372
- });
186373
- }
186374
- break;
186375
- }
186376
- case "recordEvent":
186377
- telemetryRecorder.recordEvent(
186378
- // 👷 HACK: We have no control over what gets sent over JSON RPC,
186379
- // so we depend on client implementations to give type guidance
186380
- // to ensure that we don't accidentally share arbitrary,
186381
- // potentially sensitive string values. In this RPC handler,
186382
- // when passing the provided event to the TelemetryRecorder
186383
- // implementation, we forcibly cast all the inputs below
186384
- // (feature, action, parameters) into known types (strings
186385
- // 'feature', 'action', 'key') so that the recorder will accept
186386
- // it. DO NOT do this elsewhere!
186387
- message.feature,
186388
- message.action,
186389
- message.parameters
186390
- );
186391
- break;
186392
- case "auth": {
186393
- if (message.authKind === "refresh") {
186394
- authProvider.refresh();
186395
186335
  break;
186396
186336
  }
186397
- if (message.authKind === "simplified-onboarding") {
186398
- const endpoint = DOTCOM_URL.href;
186399
- let tokenReceiverUrl = void 0;
186400
- closeAuthProgressIndicator();
186401
- startAuthProgressIndicator();
186402
- 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;
186403
186361
  closeAuthProgressIndicator();
186404
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186405
- credentials,
186406
- "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
186407
186397
  );
186408
- telemetryRecorder.recordEvent("cody.auth.fromTokenReceiver.web", "succeeded", {
186409
- metadata: {
186410
- success: authStatus2.authenticated ? 1 : 0
186411
- },
186412
- billingMetadata: {
186413
- product: "cody",
186414
- 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);
186415
186415
  }
186416
- });
186417
- if (!authStatus2.authenticated) {
186418
- void window$1.showErrorMessage(
186419
- "Authentication failed. Please check your token and try again."
186420
- );
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}`));
186421
186423
  }
186422
- }));
186423
- const authProviderSimplified = new AuthProviderSimplified();
186424
- const authMethod = message.authMethod || "dotcom";
186425
- const successfullyOpenedUrl = await authProviderSimplified.openExternalAuthUrl(
186426
- authMethod,
186427
- tokenReceiverUrl
186428
- );
186429
- if (!successfullyOpenedUrl) {
186430
- closeAuthProgressIndicator();
186424
+ break;
186431
186425
  }
186432
- break;
186433
- }
186434
- if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
186435
- try {
186436
- const { endpoint, value: token } = message;
186437
- let auth2 = void 0;
186438
- if (token) {
186439
- auth2 = {
186440
- credentials: { token, source: "paste" },
186441
- serverEndpoint: endpoint
186442
- };
186426
+ if (message.authKind === "signout") {
186427
+ const serverEndpoint = message.endpoint;
186428
+ if (serverEndpoint) {
186429
+ await signOut(serverEndpoint);
186443
186430
  } else {
186444
- const { configuration } = await currentResolvedConfig();
186445
- auth2 = await resolveAuth(endpoint, configuration, secretStorage);
186446
- }
186447
- if (!auth2 || !auth2.credentials) {
186448
- return redirectToEndpointLogin(endpoint);
186431
+ await showSignOutMenu();
186449
186432
  }
186450
- await authProvider.validateAndStoreCredentials(auth2, "always-store");
186451
- } catch (error) {
186452
- void window$1.showErrorMessage(`Authentication failed: ${error}`);
186453
- this.postError(new Error(`Authentication failed: ${error}`));
186433
+ await this.sendConfig(currentAuthStatus());
186434
+ break;
186454
186435
  }
186436
+ if (message.authKind === "switch") {
186437
+ await showSignInMenu();
186438
+ break;
186439
+ }
186440
+ await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186455
186441
  break;
186456
186442
  }
186457
- if (message.authKind === "signout") {
186458
- const serverEndpoint = message.endpoint;
186459
- if (serverEndpoint) {
186460
- await signOut(serverEndpoint);
186461
- } else {
186462
- 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;
186463
186463
  }
186464
- await this.sendConfig(currentAuthStatus());
186465
186464
  break;
186466
186465
  }
186467
- if (message.authKind === "switch") {
186468
- await showSignInMenu();
186466
+ case "log": {
186467
+ const logger2 = message.level === "debug" ? logDebug : logError$2;
186468
+ logger2(message.filterLabel, message.message);
186469
186469
  break;
186470
186470
  }
186471
- await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186472
- break;
186473
- }
186474
- case "simplified-onboarding": {
186475
- if (message.onboardingKind === "web-sign-in-token") {
186476
- void window$1.showInputBox({ prompt: "Enter web sign-in token" }).then(async (token) => {
186477
- if (!token) {
186478
- return;
186479
- }
186480
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186481
- {
186482
- serverEndpoint: DOTCOM_URL.href,
186483
- credentials: { token }
186484
- },
186485
- "store-if-valid"
186486
- );
186487
- if (!authStatus2.authenticated) {
186488
- void window$1.showErrorMessage(
186489
- "Authentication failed. Please check your token and try again."
186490
- );
186491
- }
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
186492
186481
  });
186493
186482
  break;
186494
186483
  }
186495
- break;
186496
- }
186497
- case "log": {
186498
- const logger2 = message.level === "debug" ? logDebug : logError$2;
186499
- logger2(message.filterLabel, message.message);
186500
- break;
186501
- }
186502
- case "devicePixelRatio": {
186503
- localStorage.setDevicePixelRatio(message.devicePixelRatio);
186504
- break;
186505
- }
186506
- case "regenerateCodeBlock": {
186507
- await this.handleRegenerateCodeBlock({
186508
- requestID: message.id,
186509
- code: PromptString.unsafe_fromLLMResponse(message.code),
186510
- language: message.language ? PromptString.unsafe_fromLLMResponse(message.language) : void 0,
186511
- index: message.index
186512
- });
186513
- break;
186514
186484
  }
186485
+ } catch (error) {
186486
+ this.postError(error);
186515
186487
  }
186516
186488
  }
186517
186489
  isSmartApplyEnabled() {
@@ -186572,6 +186544,20 @@ class ChatController {
186572
186544
  }
186573
186545
  const configForWebview = await this.getConfigForWebview();
186574
186546
  const workspaceFolderUris = ((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.map((folder2) => folder2.uri.toString())) ?? [];
186547
+ let siteHasCodyEnabled = null;
186548
+ let currentUserCodySubscription = null;
186549
+ if (authStatus2.authenticated && !isCodyTesting) {
186550
+ try {
186551
+ const [siteResult, subscriptionResult] = await Promise.all([
186552
+ graphqlClient.getSiteHasCodyEnabled(),
186553
+ graphqlClient.getCurrentUserCodySubscription()
186554
+ ]);
186555
+ siteHasCodyEnabled = isError$3(siteResult) ? null : siteResult;
186556
+ currentUserCodySubscription = isError$3(subscriptionResult) ? null : subscriptionResult;
186557
+ } catch (error) {
186558
+ console.error("Failed to fetch additional user data", error);
186559
+ }
186560
+ }
186575
186561
  await this.postMessage({
186576
186562
  type: "config",
186577
186563
  config: configForWebview,
@@ -186579,7 +186565,9 @@ class ChatController {
186579
186565
  authStatus: authStatus2,
186580
186566
  userProductSubscription: await currentUserProductSubscription(),
186581
186567
  workspaceFolderUris,
186582
- isDotComUser: isDotCom(authStatus2)
186568
+ isDotComUser: isDotCom(authStatus2),
186569
+ siteHasCodyEnabled,
186570
+ currentUserCodySubscription
186583
186571
  });
186584
186572
  logDebug("ChatController", "updateViewConfig", {
186585
186573
  verbose: configForWebview
@@ -186889,72 +186877,6 @@ class ChatController {
186889
186877
  (_a3 = this.submitOrEditOperation) == null ? void 0 : _a3.abort();
186890
186878
  this.submitOrEditOperation = void 0;
186891
186879
  }
186892
- async reevaluateSearchWithSelectedFilters({
186893
- index: index2,
186894
- selectedFilters
186895
- }) {
186896
- var _a3;
186897
- if (index2 === void 0 || !Array.isArray(selectedFilters)) {
186898
- return;
186899
- }
186900
- this.handleAbort();
186901
- const humanMessage = this.chatBuilder.getMessages().at(index2);
186902
- const assistantMessage = this.chatBuilder.getMessages().at(index2 + 1);
186903
- 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)) {
186904
- return;
186905
- }
186906
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186907
- ...assistantMessage,
186908
- search: {
186909
- ...assistantMessage.search,
186910
- selectedFilters
186911
- },
186912
- text: void 0
186913
- });
186914
- this.postViewTranscript();
186915
- try {
186916
- const query2 = this.appendSelectedFiltersToSearchQuery({
186917
- query: assistantMessage.search.query,
186918
- filters: selectedFilters
186919
- });
186920
- const response = await graphqlClient.nlsSearchQuery({ query: query2 });
186921
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186922
- ...assistantMessage,
186923
- error: void 0,
186924
- search: {
186925
- ...assistantMessage.search,
186926
- queryWithSelectedFilters: query2,
186927
- response,
186928
- selectedFilters
186929
- },
186930
- text: ps`search found ${(response == null ? void 0 : response.results.results.length) || 0} results`
186931
- });
186932
- } catch (err2) {
186933
- this.chatBuilder.addErrorAsBotMessage(err2, ChatBuilder.NO_MODEL);
186934
- } finally {
186935
- void this.saveSession();
186936
- this.postViewTranscript();
186937
- }
186938
- }
186939
- appendSelectedFiltersToSearchQuery({
186940
- query: query2,
186941
- filters
186942
- }) {
186943
- var _a3;
186944
- if (!filters.length) {
186945
- return query2;
186946
- }
186947
- const repoFilters = filters.filter((filter2) => filter2.kind === "repo");
186948
- const repoFilter = repoFilters.length ? `repo:^(${repoFilters.map((filter2) => filter2.value.replace("repo:^", "").replace(/\$$/, "")).join("|")})$` : "";
186949
- let count = 50;
186950
- switch ((_a3 = filters.find((filter2) => filter2.kind === "type")) == null ? void 0 : _a3.value) {
186951
- case "type:path":
186952
- case "type:repo":
186953
- count = 20;
186954
- break;
186955
- }
186956
- return `${query2} ${filters.filter((f) => f.kind !== "repo").map((f) => f.value).join(" ")} ${repoFilter} count:${count}`;
186957
- }
186958
186880
  /**
186959
186881
  * Handles editing a human chat message in current chat session.
186960
186882
  *
@@ -187807,8 +187729,9 @@ function createAutoEditsProvider({
187807
187729
  handleAutoeditsNotificationForNonEligibleUser(userEligibilityInfo.nonEligibilityReason);
187808
187730
  return [];
187809
187731
  }
187732
+ const shouldHotStreak = !isRunningInsideAgent() && (autoeditHotStreakEnabled || isHotStreakEnabledInSettings());
187810
187733
  const provider = new AutoeditsProvider(chatClient, fixupController, statusBar, {
187811
- shouldHotStreak: autoeditHotStreakEnabled || isHotStreakEnabledInSettings(),
187734
+ shouldHotStreak,
187812
187735
  allowUsingWebSocket: autoeditUseWebSocketEnabled
187813
187736
  });
187814
187737
  return [
@@ -189156,8 +189079,8 @@ function parseMentionURI(uri) {
189156
189079
  }
189157
189080
  }
189158
189081
  async function execFileAsync(program2, args2, { cwd }) {
189159
- const { promisify } = await import("./util-Bw-hmK0e.mjs").then((n) => n.u);
189160
- const { execFile } = await import("./vscode-shim-B21LtK8E.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);
189161
189084
  return promisify(execFile)(program2, args2, { cwd });
189162
189085
  }
189163
189086
  var __create = Object.create;
@@ -198901,6 +198824,13 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
198901
198824
  })
198902
198825
  )
198903
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
+ }
198904
198834
  disposables.push(
198905
198835
  subscriptionDisposable(
198906
198836
  resolvedConfig.subscribe((config) => {