@sourcegraph/cody-web 0.34.0 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,8 +18,8 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
18
18
  }
19
19
  });
20
20
  var _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _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, 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$3, 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, bh as expand, ac as LRUCache$1, bi as TRANSIENT_REFETCH_INTERVAL_HINT, bj as createSubscriber, bk as fromVSCodeEvent, D as isEqual, bl as cenv, aE as lodashExports, bm as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, 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 currentAuthStatus, bK as isEnterpriseUser, bL as ps, bM as GuardrailsMode, bN as currentResolvedConfig, aR 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$1, 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, Y as isSourcegraphToken, aD as v4, cA as CONFIG_KEY, aO 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, X 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, Q as isWorkspaceInstance, d0 as getAuthHeaders, d1 as toLightweightChatTranscript, d2 as SUPPORTED_URI_SCHEMAS, d3 as RelativePattern, d4 as _baseIsEqual, d5 as keys_1, d6 as _baseGet, d7 as _castPath, d8 as isLength_1, d9 as _toKey, da as _isKey, db as toNumber_1, dc as _baseFindIndex, dd as require$$0$2, de as NetworkError, df as isRateLimitError, V as isAuthError, dg as FileType, dh as dedent$1, di as FoldingRange, dj as CancellationTokenSource, dk as SymbolKind, dl as convertGitCloneURLToCodebaseName, aM as isDefined, dm as pluck, dn as toRangeData, dp as Position, dq as DefaultChatCommands, dr as pathFunctionsForURI, ds as uriParseNameAndExtension, dt as uriDirname, du as Utils$1, dv as uriExtname, dw as uriBasename, dx as DefaultEditCommands, dy as subscriptionDisposable, dz as updateGlobalTelemetryInstances, dA as TelemetryRecorderProvider, dB as telemetryRecorderProvider, dC as createGitDiff, dD as catchError$1, dE as AgentWorkspaceEdit, dF as TextDocumentChangeReason, dG as omit$1, dH as displayPathWithoutWorkspaceFolderPrefix, dI as getEditorInsertSpaces, dJ as escapeRegExp$1, dK as TimeoutError, dL as isNetworkError, dM as http, dN as open, dO as defer$2, dP as merge$2, dQ as ruleSearchPaths, dR as isRuleFilename, dS as parseRuleFile, dT as languageFromFilename, f as displayLineRange, e as displayPath, dU as ruleTitle, ao as isCodyProModel, dV as debounce_1, aQ 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, ap as isMacOS, ar as CustomCommandType, aP as setDisplayPathEnvInfo, aJ 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 _, aF as deserializeContextItem, fb as editorStateFromPromptString, fc as _baseGetTag, ah as isAbortErrorOrSocketHangUp, fd as inputTextWithoutContextChipsFromPromptEditorState, aj as DeepCodyAgentID, fe as exec, s as spawn, ay as UIToolStatus, i as displayPathBasename, ff as expandToLineRange, fg as openctxController, fh as openCtxProviderMetadata, fi as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aA as diffWithLineNum, aB as UITerminalOutputType, fj as getPlatform$1, fk as PromptMode, fl as skip$1, _ as context, fm as extractContextFromTraceparent, fn as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ag as reformatBotMessageForChat, M as hydrateAfterPostMessage, fo as addMessageListenersForExtensionAPI, fp as createMessageAPIForExtension, an as View, aH as ChatHistoryType, fq as CodeActionKind, ax 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, aL as isPlgEsAccessDisabled, aN as browser$4 } from "./vscode-shim-DpWxvTpJ.mjs";
22
- import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-CCLzYWyF.mjs";
21
+ import { O as Observable, aR as unsubscribe, aS as AsyncSerialScheduler, aT as authStatus, aU as pick, aV as distinctUntilChanged$1, aW as switchMapReplayOperation, aX as pendingOperation, aY as promiseFactoryToObservable, J as map$1, ac as isError$3, aZ as retry$1, a_ as logError$2, aE as firstResultFromOperation, a$ as graphqlClient, P as isDotCom, b0 as semver, b1 as debounceTime, b2 as interval, b3 as filter$3, b4 as startWith$1, b5 as switchMap$1, ar as firstValueFrom$1, as as skipPendingOperation, b6 as logDebug$1, b7 as isAbortError, b8 as expand, ab as LRUCache$1, b9 as TRANSIENT_REFETCH_INTERVAL_HINT, ba as createSubscriber, bb as fromVSCodeEvent, D as isEqual, bc as cenv, aC as lodashExports, bd as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, be as isFileURI, w as wrapInActiveSpan, bf as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bg as onAbort, bh as CHAT_INPUT_TOKEN_BUDGET, bi as CHAT_OUTPUT_TOKEN_BUDGET, ah as ModelTag, bj as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bk as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, bl as addCodyClientIdentificationHeaders, bm as addTraceparent, bn as addAuthHeaders, bo as fetch$2, bp as verifyResponseCode, H as combineLatest$1, bq as take$2, br as clientCapabilities, bs as shareReplay$1, bt as tap$2, bu as featureFlagProvider, ae as FeatureFlag, bv as telemetryRecorder, bw as currentAuthStatusOrNotReadyYet, bx as mockAuthStatus, by as storeLastValue, bz as resolvedConfig, bA as ps, bB as GuardrailsMode, bC as currentResolvedConfig, aN as PromptString, a7 as CodyIDE, bD as CORPUS_CONTEXT_ALLOCATION, bE as recordErrorToSpan, bF as addClientInfoParams, bG 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, bH as isS2, bI as GIT_OPENCTX_PROVIDER_URI, bJ as CODE_SEARCH_PROVIDER_URI, a9 as cryptoJsExports, bK as currentOpenCtxController, m as URI, bL as MulticastSubject, bM as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bN as workspace, p as path$1, bO as vscode, bP as Range, bQ as commands$1, bR as window$1, bS as Selection, U as Uri, bT as AgentEventEmitter, bU as MarkdownString, bV as Disposable, bW as TextEditorRevealType, bX as ThemeIcon, bY as StatusBarAlignment, bZ as readFile, b_ as env, b$ as UIKind, c0 as languages$1, c as commonjsGlobal, c1 as InvalidAccessTokenError, c2 as _baseAssignValue, c3 as eq_1, c4 as isArrayLike_1, c5 as isObjectLike_1, c6 as _copyObject, c7 as keysIn_1, c8 as _cloneBufferExports, c9 as _cloneTypedArray, ca as _copyArray, cb as _initCloneObject, cc as isArguments_1, cd as isArray_1, ce as isBufferExports, cf as isFunction_1, cg as isObject_1, ch as isPlainObject_1, ci as isTypedArray_1, cj as _Stack, ck as identity_1, cl as _overRest, cm as _setToString, cn as _isIndex, Y as isSourcegraphToken, aB as v4, co as CONFIG_KEY, aK as CodyAutoSuggestionMode, cp as ConfigurationTarget, cq as pathBrowserify, cr as stat, cs as extensions, ct as version$2, cu as setExtensionVersion, cv as isInvalidAccessTokenError, cw as DOTCOM_URL, cx as isNeedsAuthChallengeError, cy as EMPTY$1, cz as disposableSubscription, cA as externalAuthRefresh, cB as setAuthStatusObservable, X as isAvailabilityError, cC as normalizeServerEndpointURL, cD as AuthConfigError, Q as isWorkspaceInstance, cE as SourcegraphGraphQLAPIClient, cF as isExternalProviderAuthError, cG as isNetworkLikeError, cH as NeedsAuthChallengeError, cI as AvailabilityError, cJ as currentAuthStatus, cK as resolveAuth, cL as QuickPickItemKind, cM as getAuthHeaders, cN as toLightweightChatTranscript, cO as SUPPORTED_URI_SCHEMAS, cP as RelativePattern, cQ as _baseIsEqual, cR as keys_1, cS as _baseGet, cT as _castPath, cU as isLength_1, cV as _toKey, cW as _isKey, cX as toNumber_1, cY as _baseFindIndex, cZ as require$$0$2, c_ as NetworkError, c$ as isRateLimitError, V as isAuthError, d0 as FileType, d1 as dedent$1, d2 as FoldingRange, d3 as CancellationTokenSource, d4 as SymbolKind, d5 as convertGitCloneURLToCodebaseName, aI as isDefined, d6 as pluck, d7 as toRangeData, d8 as Position, d9 as DefaultChatCommands, da as pathFunctionsForURI, db as uriParseNameAndExtension, dc as uriDirname, dd as Utils$1, de as uriExtname, df as uriBasename, dg as DefaultEditCommands, dh as subscriptionDisposable, di as updateGlobalTelemetryInstances, dj as TelemetryRecorderProvider, dk as telemetryRecorderProvider, dl as createGitDiff, dm as AgentWorkspaceEdit, dn as TextDocumentChangeReason, dp as omit$1, dq as getEditorInsertSpaces, dr as escapeRegExp$1, ds as TimeoutError, dt as isNetworkError, du as displayPathWithoutWorkspaceFolderPrefix, dv as http, dw as open, dx as defer$2, dy as merge$2, dz as abortableOperation, dA as ruleSearchPaths, dB as isRuleFilename, dC as parseRuleFile, dD as languageFromFilename, f as displayLineRange, e as displayPath, dE as ruleTitle, dF as debounce_1, aM as isErrorLike, dG as isWindows, dH as GLOBAL_SEARCH_PROVIDER_URI, dI as mentionProvidersMetadata, dJ as ThemeColor, dK as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, dL as GENERAL_HELP_LABEL, a8 as CodyTaskState, dM as CodeLens, dN as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, dO as EndOfLine, dP as ViewColumn, dQ as Location, dR as onDidChangeActiveTextEditor, dS as tabGroups, dT as workspaceTextDocuments, dU as visibleTextEditors, dV as onDidChangeVisibleTextEditors, dW as fs, dX as onDidCloseTextDocument, dY as setCreateWebviewPanel, dZ as getAugmentedNamespace, d_ as extensionConfiguration, d$ as main$1, e0 as setAgent, e1 as setWorkspaceDocuments, e2 as setLastOpenedWorkspaceFolder, e3 as onDidRegisterNewCodeActionProvider, e4 as onDidUnregisterNewCodeActionProvider, e5 as onDidRegisterNewCodeLensProvider, e6 as onDidUnregisterNewCodeLensProvider, e7 as setClientInfo, e8 as firstNonPendingAuthStatus, e9 as workspaceFolders$1, ea as setWorkspaceFolders, eb as onDidChangeWorkspaceFolders, ec as onDidChangeWindowState, ed as onDidOpenTextDocument, ee as onDidSaveTextDocument, ef as onDidRenameFiles, eg as packageJson, eh as progressBars, ei as CodeActionTriggerKind, ej as CodeAction, ek as UriString, el as DiagnosticSeverity, em as diagnostics, en as isIntegrationTesting, eo as TESTING_TELEMETRY_EXPORTER, ep as ProgressLocation, eq as dist, er as completionProvider, es as InlineCompletionTriggerKind, et as currentAuthStatusAuthed, eu as waitUntilComplete, ev as setExtensionConfiguration, ew as onDidChangeConfiguration, ex as onDidChangeTextDocument, ey as onDidChangeTextEditorSelection, an as isMacOS, ap as CustomCommandType, aL as setDisplayPathEnvInfo, aG as ACCOUNT_USAGE_URL, z as debounce$1, ez as structuredPatch, eA as dedupeWith$1, eB as AbortError, eC as createDisposables, eD as isNodeResponse, eE as getClientInfoQueryParams, eF as tracer, eG as getActiveTraceAndSpanId, eH as getClientIdentificationHeaders, eI as setJSONAcceptContentTypeHeaders, eJ as logResponseHeadersToSpan, eK as isCustomAuthChallengeResponse, eL as TracedError, $ as SpanStatusCode, ad as RateLimitError$1, eM as capitalize, eN as InlineCompletionItem, eO as createTwoFilesPatch, eP 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, eQ as getEditorTabSize$1, eR as metrics, eS as _, aD as deserializeContextItem, eT as editorStateFromPromptString, eU as _baseGetTag, ag as isAbortErrorOrSocketHangUp, eV as inputTextWithoutContextChipsFromPromptEditorState, ai as DeepCodyAgentID, eW as exec, s as spawn, aw as UIToolStatus, i as displayPathBasename, eX as expandToLineRange, eY as openctxController, eZ as openCtxProviderMetadata, e_ as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, e$ as catchError$1, ay as diffWithLineNum, az as UITerminalOutputType, f0 as getPlatform$1, f1 as PromptMode, f2 as skip$1, _ as context, f3 as extractContextFromTraceparent, f4 as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, af as reformatBotMessageForChat, M as hydrateAfterPostMessage, f5 as addMessageListenersForExtensionAPI, f6 as createMessageAPIForExtension, am as View, aF as ChatHistoryType, f7 as NEVER$1, f8 as CodeActionKind, av as pluralize, f9 as assertFileURI, d as RULES_PROVIDER_URI, fa as createCodeSearchProvider, fb as ProgrammingLanguage, fc as psDedent, fd as formatRuleForPrompt, fe as posixFilePaths, ff as DecorationRangeBehavior, fg as diffLines, fh as CODY_SUPPORT_URL, fi as CODY_DOC_URL, fj as CODY_FEEDBACK_URL, fk as DISCORD_URL, fl as globalAgentRef, fm as VSCODE_CHANGELOG_URL, fn as SG_CHANGELOG_URL, fo as ACCOUNT_LIMITS_INFO_URL, fp as assertUnreachable, fq as promise, fr as ExtensionMode, fs as setLogger, ft as setClientCapabilities, fu as setResolvedConfigurationObservable, fv as setClientNameVersion, fw as setOpenCtxControllerObservable, aJ as browser$4 } from "./vscode-shim-Csgwpsv8.mjs";
22
+ import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-D8ltdME7.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");
@@ -733,7 +733,7 @@ const siteVersion = authStatus.pipe(
733
733
  map$1((siteVersion2) => {
734
734
  return isError$3(siteVersion2) ? siteVersion2 : {
735
735
  siteVersion: siteVersion2,
736
- codyAPIVersion: inferCodyApiVersion(siteVersion2, isDotCom(authStatus2))
736
+ codyAPIVersion: inferCodyApiVersion(siteVersion2)
737
737
  };
738
738
  })
739
739
  );
@@ -762,7 +762,7 @@ async function currentSiteVersion() {
762
762
  }
763
763
  return {
764
764
  siteVersion: siteVersion2,
765
- codyAPIVersion: inferCodyApiVersion(siteVersion2, isDotComUser)
765
+ codyAPIVersion: inferCodyApiVersion(siteVersion2)
766
766
  };
767
767
  }
768
768
  async function isValidVersion({ minimumVersion }) {
@@ -785,8 +785,8 @@ const LOCAL_BUILD_VERSION_NUMBER = "0.0.0+dev";
785
785
  function serverSupportsPromptCaching() {
786
786
  return _LatestCodyAPIVersion >= 7;
787
787
  }
788
- function inferCodyApiVersion(version2, isDotCom2) {
789
- if (isDotCom2 || version2 === LOCAL_BUILD_VERSION_NUMBER) {
788
+ function inferCodyApiVersion(version2) {
789
+ if (version2 === LOCAL_BUILD_VERSION_NUMBER) {
790
790
  if (_LatestCodyAPIVersion && _LatestCodyAPIVersion >= LastKnownCodyAPIVersion) {
791
791
  return _LatestCodyAPIVersion;
792
792
  }
@@ -968,7 +968,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
968
968
  smartContextWindowEnabled: smartContextWindow,
969
969
  // Things that did not exist before logically default to disabled.
970
970
  modelsAPIEnabled: false,
971
- userShouldUseEnterprise: false,
971
+ userShouldUseEnterprise: true,
972
972
  notices: [],
973
973
  omniBoxEnabled: false,
974
974
  codeSearchEnabled: false
@@ -1047,158 +1047,6 @@ const configOverwrites = authStatus.pipe(
1047
1047
  // the operation catches its own errors, so errors will never get here
1048
1048
  );
1049
1049
  configOverwrites.subscribe({});
1050
- var ModelUsage = /* @__PURE__ */ ((ModelUsage2) => {
1051
- ModelUsage2["Chat"] = "chat";
1052
- ModelUsage2["Edit"] = "edit";
1053
- ModelUsage2["Autocomplete"] = "autocomplete";
1054
- ModelUsage2["Unlimited"] = "unlimitedChat";
1055
- return ModelUsage2;
1056
- })(ModelUsage || {});
1057
- function createModel({
1058
- id,
1059
- modelRef: modelRefInput,
1060
- usage,
1061
- contextWindow: contextWindow2 = {
1062
- input: CHAT_INPUT_TOKEN_BUDGET,
1063
- output: CHAT_OUTPUT_TOKEN_BUDGET
1064
- },
1065
- clientSideConfig,
1066
- tags = [],
1067
- provider,
1068
- title
1069
- }) {
1070
- var _a3, _b2;
1071
- let modelRef;
1072
- if (typeof modelRefInput === "object") {
1073
- modelRef = modelRefInput;
1074
- } else if (typeof modelRefInput === "string") {
1075
- modelRef = parseModelRef(modelRefInput);
1076
- } else {
1077
- const info2 = getModelInfo(id);
1078
- modelRef = {
1079
- providerId: provider ?? info2.provider,
1080
- apiVersionId: "unknown",
1081
- modelId: title ?? info2.title
1082
- };
1083
- }
1084
- if ((_b2 = (_a3 = clientSideConfig == null ? void 0 : clientSideConfig.options) == null ? void 0 : _a3.categories) == null ? void 0 : _b2.includes(ModelTag.Vision)) {
1085
- tags.push(ModelTag.Vision);
1086
- }
1087
- return {
1088
- id,
1089
- modelRef,
1090
- usage,
1091
- contextWindow: contextWindow2,
1092
- clientSideConfig,
1093
- tags,
1094
- provider: modelRef.providerId,
1095
- title: title ?? modelRef.modelId
1096
- };
1097
- }
1098
- function createModelFromServerModel({
1099
- modelRef,
1100
- displayName,
1101
- capabilities,
1102
- category,
1103
- tier,
1104
- status,
1105
- clientSideConfig,
1106
- contextWindow: contextWindow2
1107
- }, enhancedContextWindowFlagEnabled) {
1108
- const ref = parseModelRef(modelRef);
1109
- const { maxInputTokens, maxOutputTokens } = contextWindow2;
1110
- const _contextWindow = {
1111
- input: maxInputTokens,
1112
- output: maxOutputTokens
1113
- };
1114
- const usage = capabilities.flatMap(capabilityToUsage);
1115
- if (capabilities.includes("reasoning") && usage.includes(ModelUsage.Edit)) {
1116
- usage.splice(usage.indexOf(ModelUsage.Edit), 1);
1117
- }
1118
- if (maxInputTokens === EXTENDED_CHAT_INPUT_TOKEN_BUDGET + EXTENDED_USER_CONTEXT_TOKEN_BUDGET) {
1119
- _contextWindow.input = EXTENDED_CHAT_INPUT_TOKEN_BUDGET;
1120
- _contextWindow.context = { user: EXTENDED_USER_CONTEXT_TOKEN_BUDGET };
1121
- }
1122
- if (enhancedContextWindowFlagEnabled && contextWindow2.maxUserInputTokens && contextWindow2.maxInputTokens > 0 && contextWindow2.maxInputTokens > contextWindow2.maxUserInputTokens) {
1123
- _contextWindow.input = contextWindow2.maxUserInputTokens;
1124
- _contextWindow.context = {
1125
- user: contextWindow2.maxInputTokens - contextWindow2.maxUserInputTokens
1126
- };
1127
- }
1128
- return createModel({
1129
- id: modelRef,
1130
- modelRef: ref,
1131
- usage,
1132
- contextWindow: _contextWindow,
1133
- clientSideConfig,
1134
- tags: getServerModelTags(capabilities, category, status, tier),
1135
- provider: ref.providerId,
1136
- title: displayName
1137
- });
1138
- }
1139
- function capabilityToUsage(capability) {
1140
- switch (capability) {
1141
- case "autocomplete":
1142
- return [ModelUsage.Autocomplete];
1143
- case "chat":
1144
- return [ModelUsage.Chat];
1145
- case "edit":
1146
- return [ModelUsage.Edit];
1147
- default:
1148
- return [];
1149
- }
1150
- }
1151
- function modelTier(model2) {
1152
- const tierSet = /* @__PURE__ */ new Set([ModelTag.Pro, ModelTag.Enterprise]);
1153
- return model2.tags.find((tag2) => tierSet.has(tag2)) ?? ModelTag.Free;
1154
- }
1155
- function parseModelRef(ref) {
1156
- try {
1157
- const [providerId, apiVersionId, modelId] = ref.split("::", 3);
1158
- return {
1159
- providerId,
1160
- apiVersionId,
1161
- modelId
1162
- };
1163
- } catch {
1164
- const [providerId, modelId] = ref.split("/", 2);
1165
- return {
1166
- providerId,
1167
- modelId,
1168
- apiVersionId: "unknown"
1169
- };
1170
- }
1171
- }
1172
- function getServerModelTags(capabilities, category, status, tier) {
1173
- const tags = [tier];
1174
- if (capabilities.includes("vision")) {
1175
- tags.push(ModelTag.Vision);
1176
- }
1177
- if (capabilities.includes("reasoning")) {
1178
- tags.push(ModelTag.Reasoning);
1179
- }
1180
- if (status === "waitlist") {
1181
- tags.push(ModelTag.Waitlist);
1182
- if (tier === ModelTag.Pro) {
1183
- tags.push(ModelTag.StreamDisabled);
1184
- }
1185
- } else if (status === "internal") {
1186
- tags.push(ModelTag.Internal);
1187
- } else if (status === "experimental") {
1188
- tags.push(ModelTag.Experimental);
1189
- }
1190
- if (category === "accuracy") {
1191
- tags.push(ModelTag.Power);
1192
- } else {
1193
- tags.push(category);
1194
- }
1195
- return tags;
1196
- }
1197
- createModel({
1198
- id: "my-model",
1199
- usage: [ModelUsage.Chat],
1200
- tags: [ModelTag.Enterprise]
1201
- });
1202
1050
  var define_process_default$m = { env: {} };
1203
1051
  const version$1 = "0.5.1";
1204
1052
  class ResponseError extends Error {
@@ -8029,10 +7877,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
8029
7877
  if (!uri || allowedSchemes.has(uri.scheme)) {
8030
7878
  return false;
8031
7879
  }
8032
- const path2 = uri.path.toLowerCase();
8033
- if (path2.includes("main.java") || path2.includes("index.html") || path2.includes("var.go") || path2.includes("visualize.go") || path2.includes("buzz.ts")) {
8034
- return false;
8035
- }
8036
7880
  await this.fetchIfNeeded();
8037
7881
  if (_ContextFiltersProvider.excludePatternGetter) {
8038
7882
  if (await this.isExcludedByPatterns(uri)) {
@@ -8220,6 +8064,224 @@ async function ollamaChatClient({
8220
8064
  }
8221
8065
  const OLLAMA_DEFAULT_URL = "http://localhost:11434";
8222
8066
  const OLLAMA_DEFAULT_CONTEXT_WINDOW = 2048;
8067
+ var ModelUsage = /* @__PURE__ */ ((ModelUsage2) => {
8068
+ ModelUsage2["Chat"] = "chat";
8069
+ ModelUsage2["Edit"] = "edit";
8070
+ ModelUsage2["Autocomplete"] = "autocomplete";
8071
+ ModelUsage2["Unlimited"] = "unlimitedChat";
8072
+ return ModelUsage2;
8073
+ })(ModelUsage || {});
8074
+ const ANSWER_TOKENS = 1e3;
8075
+ const MAX_CURRENT_FILE_TOKENS = 1e3;
8076
+ const SURROUNDING_LINES = 50;
8077
+ function getProviderName(name2) {
8078
+ const providerName = name2.toLowerCase();
8079
+ switch (providerName) {
8080
+ case "anthropic":
8081
+ return "Anthropic";
8082
+ case "openai":
8083
+ return "OpenAI";
8084
+ case "ollama":
8085
+ return "Ollama";
8086
+ case "google":
8087
+ return "Google";
8088
+ default:
8089
+ return providerName;
8090
+ }
8091
+ }
8092
+ function getModelInfo(modelID) {
8093
+ const [providerID, ...rest] = modelID.split("/");
8094
+ const provider = getProviderName(providerID);
8095
+ const title = (rest.at(-1) || "").replace(/-/g, " ");
8096
+ return { provider, title };
8097
+ }
8098
+ function isCustomModel(model2) {
8099
+ return modelHasTag(model2, ModelTag.Local) || modelHasTag(model2, ModelTag.Dev) || modelHasTag(model2, ModelTag.BYOK);
8100
+ }
8101
+ function modelHasTag(model2, modelTag) {
8102
+ return model2.tags.includes(modelTag);
8103
+ }
8104
+ function getEnterpriseContextWindow(chatModel, configOverwrites2, configuration) {
8105
+ const { chatModelMaxTokens, smartContextWindow } = configOverwrites2;
8106
+ let contextWindow2 = {
8107
+ input: chatModelMaxTokens ?? CHAT_INPUT_TOKEN_BUDGET,
8108
+ output: getEnterpriseOutputLimit(chatModel)
8109
+ };
8110
+ if (smartContextWindow && isModelWithExtendedContextWindowSupport(chatModel)) {
8111
+ contextWindow2 = {
8112
+ input: EXTENDED_CHAT_INPUT_TOKEN_BUDGET,
8113
+ output: CHAT_OUTPUT_TOKEN_BUDGET,
8114
+ context: { user: EXTENDED_USER_CONTEXT_TOKEN_BUDGET }
8115
+ };
8116
+ }
8117
+ return applyLocalTokenLimitOverwrite(configuration, chatModel, contextWindow2);
8118
+ }
8119
+ function applyLocalTokenLimitOverwrite({ providerLimitPrompt }, chatModel, contextWindow2) {
8120
+ if (providerLimitPrompt && providerLimitPrompt <= contextWindow2.input) {
8121
+ return { ...contextWindow2, input: providerLimitPrompt };
8122
+ }
8123
+ if (providerLimitPrompt) {
8124
+ logDebug$1(
8125
+ "getEnterpriseContextWindow",
8126
+ `Invalid token limit configured for ${chatModel}`,
8127
+ providerLimitPrompt
8128
+ );
8129
+ }
8130
+ return contextWindow2;
8131
+ }
8132
+ const modelWithExpandedWindowSubStrings = [
8133
+ "opus",
8134
+ "sonnet",
8135
+ // Covers claude 3 sonnet & 3.5 sonnet
8136
+ "gemini-1.5",
8137
+ "gpt-4o",
8138
+ "gpt-4-turbo"
8139
+ ];
8140
+ function isModelWithExtendedContextWindowSupport(chatModel) {
8141
+ return modelWithExpandedWindowSubStrings.some((keyword) => chatModel.toLowerCase().includes(keyword));
8142
+ }
8143
+ function getEnterpriseOutputLimit(model2) {
8144
+ if (model2 && isModelWithExtendedContextWindowSupport(model2)) {
8145
+ return CHAT_OUTPUT_TOKEN_BUDGET;
8146
+ }
8147
+ return ANSWER_TOKENS;
8148
+ }
8149
+ function createModel({
8150
+ id,
8151
+ modelRef: modelRefInput,
8152
+ usage,
8153
+ contextWindow: contextWindow2 = {
8154
+ input: CHAT_INPUT_TOKEN_BUDGET,
8155
+ output: CHAT_OUTPUT_TOKEN_BUDGET
8156
+ },
8157
+ clientSideConfig,
8158
+ tags = [],
8159
+ provider,
8160
+ title
8161
+ }) {
8162
+ var _a3, _b2;
8163
+ let modelRef;
8164
+ if (typeof modelRefInput === "object") {
8165
+ modelRef = modelRefInput;
8166
+ } else if (typeof modelRefInput === "string") {
8167
+ modelRef = parseModelRef(modelRefInput);
8168
+ } else {
8169
+ const info2 = getModelInfo(id);
8170
+ modelRef = {
8171
+ providerId: provider ?? info2.provider,
8172
+ apiVersionId: "unknown",
8173
+ modelId: title ?? info2.title
8174
+ };
8175
+ }
8176
+ if ((_b2 = (_a3 = clientSideConfig == null ? void 0 : clientSideConfig.options) == null ? void 0 : _a3.categories) == null ? void 0 : _b2.includes(ModelTag.Vision)) {
8177
+ tags.push(ModelTag.Vision);
8178
+ }
8179
+ return {
8180
+ id,
8181
+ modelRef,
8182
+ usage,
8183
+ contextWindow: contextWindow2,
8184
+ clientSideConfig,
8185
+ tags,
8186
+ provider: modelRef.providerId,
8187
+ title: title ?? modelRef.modelId
8188
+ };
8189
+ }
8190
+ function createModelFromServerModel({
8191
+ modelRef,
8192
+ displayName,
8193
+ capabilities,
8194
+ category,
8195
+ tier,
8196
+ status,
8197
+ clientSideConfig,
8198
+ contextWindow: contextWindow2
8199
+ }, enhancedContextWindowFlagEnabled) {
8200
+ const ref = parseModelRef(modelRef);
8201
+ const { maxInputTokens, maxOutputTokens } = contextWindow2;
8202
+ const _contextWindow = {
8203
+ input: maxInputTokens,
8204
+ output: maxOutputTokens
8205
+ };
8206
+ const usage = capabilities.flatMap(capabilityToUsage);
8207
+ if (capabilities.includes("reasoning") && usage.includes(ModelUsage.Edit)) {
8208
+ usage.splice(usage.indexOf(ModelUsage.Edit), 1);
8209
+ }
8210
+ if (maxInputTokens === EXTENDED_CHAT_INPUT_TOKEN_BUDGET + EXTENDED_USER_CONTEXT_TOKEN_BUDGET) {
8211
+ _contextWindow.input = EXTENDED_CHAT_INPUT_TOKEN_BUDGET;
8212
+ _contextWindow.context = { user: EXTENDED_USER_CONTEXT_TOKEN_BUDGET };
8213
+ }
8214
+ if (enhancedContextWindowFlagEnabled && contextWindow2.maxUserInputTokens && contextWindow2.maxInputTokens > 0 && contextWindow2.maxInputTokens > contextWindow2.maxUserInputTokens) {
8215
+ _contextWindow.input = contextWindow2.maxUserInputTokens;
8216
+ _contextWindow.context = {
8217
+ user: contextWindow2.maxInputTokens - contextWindow2.maxUserInputTokens
8218
+ };
8219
+ }
8220
+ return createModel({
8221
+ id: modelRef,
8222
+ modelRef: ref,
8223
+ usage,
8224
+ contextWindow: _contextWindow,
8225
+ clientSideConfig,
8226
+ tags: getServerModelTags(capabilities, category, status, tier),
8227
+ provider: ref.providerId,
8228
+ title: displayName
8229
+ });
8230
+ }
8231
+ function capabilityToUsage(capability) {
8232
+ switch (capability) {
8233
+ case "autocomplete":
8234
+ return [ModelUsage.Autocomplete];
8235
+ case "chat":
8236
+ return [ModelUsage.Chat];
8237
+ case "edit":
8238
+ return [ModelUsage.Edit];
8239
+ default:
8240
+ return [];
8241
+ }
8242
+ }
8243
+ function parseModelRef(ref) {
8244
+ try {
8245
+ const [providerId, apiVersionId, modelId] = ref.split("::", 3);
8246
+ return {
8247
+ providerId,
8248
+ apiVersionId,
8249
+ modelId
8250
+ };
8251
+ } catch {
8252
+ const [providerId, modelId] = ref.split("/", 2);
8253
+ return {
8254
+ providerId,
8255
+ modelId,
8256
+ apiVersionId: "unknown"
8257
+ };
8258
+ }
8259
+ }
8260
+ function getServerModelTags(capabilities, category, status, tier) {
8261
+ const tags = [tier];
8262
+ if (capabilities.includes("vision")) {
8263
+ tags.push(ModelTag.Vision);
8264
+ }
8265
+ if (capabilities.includes("reasoning")) {
8266
+ tags.push(ModelTag.Reasoning);
8267
+ }
8268
+ if (status === "internal") {
8269
+ tags.push(ModelTag.Internal);
8270
+ } else if (status === "experimental") {
8271
+ tags.push(ModelTag.Experimental);
8272
+ }
8273
+ if (category === "accuracy") {
8274
+ tags.push(ModelTag.Power);
8275
+ } else {
8276
+ tags.push(category);
8277
+ }
8278
+ return tags;
8279
+ }
8280
+ createModel({
8281
+ id: "my-model",
8282
+ usage: [ModelUsage.Chat],
8283
+ tags: [ModelTag.Enterprise]
8284
+ });
8223
8285
  async function fetchLocalOllamaModels() {
8224
8286
  var _a3;
8225
8287
  if (cenv.CODY_OVERRIDE_DISABLE_OLLAMA) {
@@ -8307,8 +8369,7 @@ function syncModels({
8307
8369
  authStatus: authStatus2,
8308
8370
  configOverwrites: configOverwrites2,
8309
8371
  clientConfig,
8310
- fetchServerSideModels_ = fetchServerSideModels,
8311
- userProductSubscription: userProductSubscription2 = Observable.of(null)
8372
+ fetchServerSideModels_ = fetchServerSideModels
8312
8373
  }) {
8313
8374
  const localModels = combineLatest$1(
8314
8375
  resolvedConfig2.pipe(
@@ -8349,8 +8410,14 @@ function syncModels({
8349
8410
  ),
8350
8411
  distinctUntilChanged$1()
8351
8412
  );
8352
- const userModelPreferences = resolvedConfig2.pipe(
8353
- map$1((config) => {
8413
+ const userModelPreferences = combineLatest$1(resolvedConfig2, authStatus2).pipe(
8414
+ map$1(([config, authStatus22]) => {
8415
+ if (!config.auth.serverEndpoint || authStatus22.endpoint !== config.auth.serverEndpoint || authStatus22.pendingValidation) {
8416
+ return pendingOperation;
8417
+ }
8418
+ if (!authStatus22.authenticated) {
8419
+ return EMPTY_PREFERENCES;
8420
+ }
8354
8421
  const prevPreferences = config.clientState.modelPreferences[config.auth.serverEndpoint];
8355
8422
  return deepClone$1(prevPreferences ?? EMPTY_PREFERENCES);
8356
8423
  }),
@@ -8360,22 +8427,21 @@ function syncModels({
8360
8427
  }),
8361
8428
  shareReplay$1()
8362
8429
  );
8363
- const remoteModelsData = combineLatest$1(relevantConfig, authStatus2, userProductSubscription2).pipe(
8364
- switchMapReplayOperation(([config, authStatus22, userProductSubscription22]) => {
8365
- if (authStatus22.endpoint !== config.auth.serverEndpoint || authStatus22.pendingValidation || userProductSubscription22 === pendingOperation) {
8430
+ const remoteModelsData = combineLatest$1(relevantConfig, authStatus2).pipe(
8431
+ switchMapReplayOperation(([config, authStatus22]) => {
8432
+ if (!authStatus22.endpoint || authStatus22.endpoint !== config.auth.serverEndpoint || authStatus22.pendingValidation) {
8366
8433
  return Observable.of(pendingOperation);
8367
8434
  }
8368
8435
  if (!authStatus22.authenticated) {
8369
8436
  return Observable.of({ primaryModels: [], preferences: null });
8370
8437
  }
8371
- const isDotComUser = isDotCom(authStatus22);
8372
- const isCodyFreeUser = userProductSubscription22 == null || userProductSubscription22.userCanUpgrade === true;
8438
+ const configWithEndpoint = config;
8373
8439
  const serverModelsConfig = clientConfig.pipe(
8374
8440
  switchMapReplayOperation((maybeServerSideClientConfig) => {
8375
- if (isDotComUser || (maybeServerSideClientConfig == null ? void 0 : maybeServerSideClientConfig.modelsAPIEnabled)) {
8441
+ if (maybeServerSideClientConfig == null ? void 0 : maybeServerSideClientConfig.modelsAPIEnabled) {
8376
8442
  logDebug$1("ModelsService", "new models API enabled");
8377
8443
  return promiseFactoryToObservable(
8378
- (signal2) => fetchServerSideModels_(config, signal2)
8444
+ (signal2) => fetchServerSideModels_(configWithEndpoint, signal2)
8379
8445
  ).pipe(
8380
8446
  switchMap$1((serverModelsConfig2) => {
8381
8447
  const data = {
@@ -8383,12 +8449,6 @@ function syncModels({
8383
8449
  primaryModels: []
8384
8450
  };
8385
8451
  return combineLatest$1(
8386
- featureFlagProvider.evaluatedFeatureFlag(
8387
- FeatureFlag.CodyEarlyAccess
8388
- ),
8389
- featureFlagProvider.evaluatedFeatureFlag(
8390
- FeatureFlag.CodyChatDefaultToClaude35Haiku
8391
- ),
8392
8452
  featureFlagProvider.evaluatedFeatureFlag(
8393
8453
  FeatureFlag.EnhancedContextWindow,
8394
8454
  true
@@ -8400,162 +8460,124 @@ function syncModels({
8400
8460
  /** force refresh */
8401
8461
  )
8402
8462
  ).pipe(
8403
- switchMap$1(
8404
- ([
8405
- hasEarlyAccess,
8406
- defaultToHaiku,
8407
- enhancedContextWindowFlag,
8408
- fallbackToFlashFlag
8409
- ]) => {
8410
- if (serverModelsConfig2) {
8411
- const filteredModels = serverModelsConfig2 == null ? void 0 : serverModelsConfig2.models.filter(
8412
- (m) => m.status !== "deprecated" && (isDotComUser || m.status !== "waitlist")
8413
- );
8414
- data.primaryModels = maybeAdjustContextWindows(
8415
- filteredModels,
8416
- {
8417
- tier: isDotComUser ? isCodyProUser(
8418
- authStatus22,
8419
- userProductSubscription22
8420
- ) ? "pro" : "free" : "enterprise",
8421
- enhancedContextWindowFlagEnabled: enhancedContextWindowFlag
8422
- }
8423
- ).map(
8424
- (model2) => createModelFromServerModel(
8425
- model2,
8426
- enhancedContextWindowFlag
8427
- )
8428
- );
8429
- data.preferences.defaults = defaultModelPreferencesFromServerModelsConfig(
8430
- serverModelsConfig2
8463
+ switchMap$1(([enhancedContextWindowFlag, fallbackToFlashFlag]) => {
8464
+ if (serverModelsConfig2) {
8465
+ const filteredModels = serverModelsConfig2 == null ? void 0 : serverModelsConfig2.models.filter(
8466
+ (m) => m.status !== "deprecated"
8467
+ );
8468
+ data.primaryModels = maybeAdjustContextWindows(
8469
+ filteredModels,
8470
+ {
8471
+ tier: "enterprise",
8472
+ enhancedContextWindowFlagEnabled: enhancedContextWindowFlag
8473
+ }
8474
+ ).map(
8475
+ (model2) => createModelFromServerModel(
8476
+ model2,
8477
+ enhancedContextWindowFlag
8478
+ )
8479
+ );
8480
+ data.preferences.defaults = defaultModelPreferencesFromServerModelsConfig(
8481
+ serverModelsConfig2
8482
+ );
8483
+ }
8484
+ data.primaryModels = data.primaryModels.map((m) => ({
8485
+ ...m,
8486
+ tags: m.provider === "google" ? m.tags.filter((t) => t !== ModelTag.Vision) : m.tags
8487
+ }));
8488
+ if (fallbackToFlashFlag) {
8489
+ if (authStatus22.rateLimited) {
8490
+ const hasUnlimitedModels = data.primaryModels.some(
8491
+ (model2) => model2.tags.includes(ModelTag.Unlimited)
8431
8492
  );
8432
- }
8433
- if (isDotComUser && hasEarlyAccess) {
8434
8493
  data.primaryModels = data.primaryModels.map(
8435
8494
  (model2) => {
8436
- if (model2.tags.includes(ModelTag.Waitlist)) {
8437
- const newTags = model2.tags.filter(
8438
- (tag2) => tag2 !== ModelTag.Waitlist
8439
- );
8440
- newTags.push(
8441
- hasEarlyAccess ? ModelTag.EarlyAccess : ModelTag.OnWaitlist
8442
- );
8443
- return { ...model2, tags: newTags };
8495
+ if (hasUnlimitedModels) {
8496
+ if (!model2.tags.includes(
8497
+ ModelTag.Unlimited
8498
+ )) {
8499
+ return {
8500
+ ...model2,
8501
+ disabled: true
8502
+ };
8503
+ }
8504
+ } else {
8505
+ if (!model2.tags.includes(ModelTag.Speed)) {
8506
+ return {
8507
+ ...model2,
8508
+ disabled: true
8509
+ };
8510
+ }
8444
8511
  }
8445
8512
  return model2;
8446
8513
  }
8447
8514
  );
8448
- }
8449
- const isVisionSupported = !isDotComUser && hasEarlyAccess;
8450
- data.primaryModels = data.primaryModels.map((m) => ({
8451
- ...m,
8452
- // Gateway doesn't suppoort vision models for Google yet
8453
- tags: isVisionSupported && m.provider !== "google" ? m.tags : m.tags.filter((t) => t !== ModelTag.Vision)
8454
- }));
8455
- const haikuModel = data.primaryModels.find(
8456
- (m) => m.id.includes("5-haiku")
8457
- );
8458
- if (isDotComUser && isCodyFreeUser && defaultToHaiku && haikuModel) {
8459
- data.preferences.defaults.chat = haikuModel.id;
8460
- }
8461
- if (fallbackToFlashFlag && !isFreeUser(authStatus22, userProductSubscription22)) {
8462
- if (authStatus22.rateLimited) {
8463
- const hasUnlimitedModels = data.primaryModels.some(
8464
- (model2) => model2.tags.includes(ModelTag.Unlimited)
8515
+ if (data.preferences) {
8516
+ const modelToFallback = data.preferences.defaults.unlimitedChat || "google::v1::gemini-2.0-flash";
8517
+ let defaultModel = data.primaryModels.find(
8518
+ (model2) => model2.id === modelToFallback
8465
8519
  );
8466
- data.primaryModels = data.primaryModels.map(
8467
- (model2) => {
8468
- if (hasUnlimitedModels) {
8469
- if (!model2.tags.includes(
8470
- ModelTag.Unlimited
8471
- )) {
8472
- return {
8473
- ...model2,
8474
- disabled: true
8475
- };
8476
- }
8477
- } else {
8478
- if (!model2.tags.includes(
8479
- ModelTag.Speed
8480
- )) {
8481
- return {
8482
- ...model2,
8483
- disabled: true
8484
- };
8520
+ if (!defaultModel) {
8521
+ defaultModel = data.primaryModels.find(
8522
+ (model2) => model2.tags.includes(ModelTag.Speed)
8523
+ );
8524
+ }
8525
+ if (defaultModel) {
8526
+ rateLimitState.chatModel = data.preferences.defaults.chat || "";
8527
+ rateLimitState.editModel = data.preferences.defaults.edit || "";
8528
+ data.preferences.defaults.chat = defaultModel.id;
8529
+ data.preferences.defaults.edit = defaultModel.id;
8530
+ telemetryRecorder.recordEvent(
8531
+ "cody.rateLimit",
8532
+ "hit",
8533
+ {
8534
+ privateMetadata: {
8535
+ chatModel: defaultModel.id
8485
8536
  }
8486
8537
  }
8487
- return model2;
8488
- }
8489
- );
8490
- if (data.preferences) {
8491
- const modelToFallback = data.preferences.defaults.unlimitedChat || "google::v1::gemini-2.0-flash";
8492
- let defaultModel = data.primaryModels.find(
8493
- (model2) => model2.id === modelToFallback
8494
8538
  );
8495
- if (!defaultModel) {
8496
- defaultModel = data.primaryModels.find(
8497
- (model2) => model2.tags.includes(
8498
- ModelTag.Speed
8499
- )
8500
- );
8501
- }
8502
- if (defaultModel) {
8503
- rateLimitState.chatModel = data.preferences.defaults.chat || "";
8504
- rateLimitState.editModel = data.preferences.defaults.edit || "";
8505
- data.preferences.defaults.chat = defaultModel.id;
8506
- data.preferences.defaults.edit = defaultModel.id;
8507
- telemetryRecorder.recordEvent(
8508
- "cody.rateLimit",
8509
- "hit",
8510
- {
8511
- privateMetadata: {
8512
- chatModel: defaultModel.id
8513
- }
8514
- }
8515
- );
8516
- }
8517
8539
  }
8518
- } else {
8519
- data.primaryModels = data.primaryModels.map(
8520
- (model2) => {
8521
- if (!model2.tags.includes(ModelTag.Speed)) {
8522
- return {
8523
- ...model2,
8524
- disabled: false
8525
- };
8526
- }
8527
- return model2;
8540
+ }
8541
+ } else {
8542
+ data.primaryModels = data.primaryModels.map(
8543
+ (model2) => {
8544
+ if (!model2.tags.includes(ModelTag.Speed)) {
8545
+ return {
8546
+ ...model2,
8547
+ disabled: false
8548
+ };
8528
8549
  }
8529
- );
8530
- const originalChatModel = data.primaryModels.find(
8531
- (model2) => model2.id === rateLimitState.chatModel
8532
- );
8533
- const originalEditModel = data.primaryModels.find(
8534
- (model2) => model2.id === rateLimitState.editModel
8535
- );
8536
- if (originalChatModel && data.preferences) {
8537
- data.preferences.defaults.chat = originalChatModel.id;
8538
- }
8539
- if (originalEditModel && data.preferences) {
8540
- data.preferences.defaults.edit = originalEditModel.id;
8550
+ return model2;
8541
8551
  }
8552
+ );
8553
+ const originalChatModel = data.primaryModels.find(
8554
+ (model2) => model2.id === rateLimitState.chatModel
8555
+ );
8556
+ const originalEditModel = data.primaryModels.find(
8557
+ (model2) => model2.id === rateLimitState.editModel
8558
+ );
8559
+ if (originalChatModel && data.preferences) {
8560
+ data.preferences.defaults.chat = originalChatModel.id;
8542
8561
  }
8543
- }
8544
- data.primaryModels.push(
8545
- ...getModelsFromVSCodeConfiguration(config)
8546
- );
8547
- data.primaryModels = data.primaryModels.map((model2) => {
8548
- if (model2.modelRef === data.preferences.defaults.chat) {
8549
- return {
8550
- ...model2,
8551
- tags: [...model2.tags, ModelTag.Default]
8552
- };
8562
+ if (originalEditModel && data.preferences) {
8563
+ data.preferences.defaults.edit = originalEditModel.id;
8553
8564
  }
8554
- return model2;
8555
- });
8556
- return Observable.of(data);
8565
+ }
8557
8566
  }
8558
- )
8567
+ data.primaryModels.push(
8568
+ ...getModelsFromVSCodeConfiguration(config)
8569
+ );
8570
+ data.primaryModels = data.primaryModels.map((model2) => {
8571
+ if (model2.modelRef === data.preferences.defaults.chat) {
8572
+ return {
8573
+ ...model2,
8574
+ tags: [...model2.tags, ModelTag.Default]
8575
+ };
8576
+ }
8577
+ return model2;
8578
+ });
8579
+ return Observable.of(data);
8580
+ })
8559
8581
  );
8560
8582
  })
8561
8583
  );
@@ -8597,7 +8619,7 @@ function syncModels({
8597
8619
  return combineLatest$1(localModels, remoteModelsData, userModelPreferences, authStatus2).pipe(
8598
8620
  map$1(
8599
8621
  ([localModels2, remoteModelsData2, userModelPreferences2, currentAuthStatus2]) => {
8600
- if (remoteModelsData2 === pendingOperation) {
8622
+ if (remoteModelsData2 === pendingOperation || userModelPreferences2 === pendingOperation) {
8601
8623
  return pendingOperation;
8602
8624
  }
8603
8625
  const isRateLimited2 = !!("rateLimited" in currentAuthStatus2 && currentAuthStatus2.rateLimited);
@@ -8665,7 +8687,11 @@ function getModelsFromVSCodeConfiguration({
8665
8687
  )) ?? [];
8666
8688
  }
8667
8689
  async function fetchServerSideModels(config, signal2) {
8668
- const client = new RestClient(config.auth, config.configuration.customHeaders);
8690
+ if (!config.auth.serverEndpoint) {
8691
+ return;
8692
+ }
8693
+ const authWithEndpoint = config.auth;
8694
+ const client = new RestClient(authWithEndpoint, config.configuration.customHeaders);
8669
8695
  return await client.getAvailableModels(signal2);
8670
8696
  }
8671
8697
  const maybeAdjustContextWindows = (models, config) => {
@@ -8734,8 +8760,7 @@ class ModelsService {
8734
8760
  ),
8735
8761
  authStatus,
8736
8762
  configOverwrites,
8737
- clientConfig: ClientConfigSingleton.getInstance().changes,
8738
- userProductSubscription
8763
+ clientConfig: ClientConfigSingleton.getInstance().changes
8739
8764
  }));
8740
8765
  if (testing__mockModelsChanges) {
8741
8766
  this.modelsChanges = testing__mockModelsChanges;
@@ -8749,42 +8774,50 @@ class ModelsService {
8749
8774
  this.syncPreferencesSubscription = combineLatest$1(
8750
8775
  this.modelsChanges,
8751
8776
  featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyEditDefaultToGpt4oMini),
8752
- featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyDeepSeekChat)
8777
+ featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyDeepSeekChat),
8778
+ authStatus
8753
8779
  ).pipe(
8754
- tap$2(([data, shouldEditDefaultToGpt4oMini, shouldChatDefaultToDeepSeek]) => {
8755
- var _a3, _b2, _c2, _d2;
8756
- if (data === pendingOperation) {
8757
- return;
8758
- }
8759
- const isEnrolled = (_a3 = this.storage) == null ? void 0 : _a3.getEnrollmentHistory(
8760
- FeatureFlag.CodyEditDefaultToGpt4oMini
8761
- );
8762
- const isEnrolledDeepSeekChat = (_b2 = this.storage) == null ? void 0 : _b2.getEnrollmentHistory(
8763
- FeatureFlag.CodyDeepSeekChat
8764
- );
8765
- const gpt4oMini = data.primaryModels.find(
8766
- (model2) => {
8767
- var _a4;
8768
- return ((_a4 = model2 == null ? void 0 : model2.modelRef) == null ? void 0 : _a4.modelId) === "gpt-4o-mini";
8780
+ tap$2(
8781
+ async ([
8782
+ data,
8783
+ shouldEditDefaultToGpt4oMini,
8784
+ shouldChatDefaultToDeepSeek,
8785
+ currentAuthStatus2
8786
+ ]) => {
8787
+ var _a3, _b2, _c2, _d2;
8788
+ if (data === pendingOperation || currentAuthStatus2.pendingValidation === true || currentAuthStatus2.authenticated === false) {
8789
+ return;
8769
8790
  }
8770
- );
8771
- const deepseekModel = data.primaryModels.find(
8772
- (model2) => (model2 == null ? void 0 : model2.id) === "fireworks::v1::deepseek-v3"
8773
- );
8774
- const allSitePrefs = (_c2 = this.storage) == null ? void 0 : _c2.getModelPreferences();
8775
- const currentAccountPrefs = { ...data.preferences };
8776
- if (!isEnrolled && shouldEditDefaultToGpt4oMini && gpt4oMini) {
8777
- currentAccountPrefs.selected.edit = gpt4oMini.id;
8778
- }
8779
- if (!isEnrolledDeepSeekChat && shouldChatDefaultToDeepSeek && deepseekModel) {
8780
- currentAccountPrefs.selected.chat = deepseekModel.id;
8791
+ const isEnrolled = (_a3 = this.storage) == null ? void 0 : _a3.getEnrollmentHistory(
8792
+ FeatureFlag.CodyEditDefaultToGpt4oMini
8793
+ );
8794
+ const isEnrolledDeepSeekChat = (_b2 = this.storage) == null ? void 0 : _b2.getEnrollmentHistory(
8795
+ FeatureFlag.CodyDeepSeekChat
8796
+ );
8797
+ const gpt4oMini = data.primaryModels.find(
8798
+ (model2) => {
8799
+ var _a4;
8800
+ return ((_a4 = model2 == null ? void 0 : model2.modelRef) == null ? void 0 : _a4.modelId) === "gpt-4o-mini";
8801
+ }
8802
+ );
8803
+ const deepseekModel = data.primaryModels.find(
8804
+ (model2) => (model2 == null ? void 0 : model2.id) === "fireworks::v1::deepseek-v3"
8805
+ );
8806
+ const allSitePrefs = (_c2 = this.storage) == null ? void 0 : _c2.getModelPreferences();
8807
+ const currentAccountPrefs = { ...data.preferences };
8808
+ if (!isEnrolled && shouldEditDefaultToGpt4oMini && gpt4oMini) {
8809
+ currentAccountPrefs.selected.edit = gpt4oMini.id;
8810
+ }
8811
+ if (!isEnrolledDeepSeekChat && shouldChatDefaultToDeepSeek && deepseekModel) {
8812
+ currentAccountPrefs.selected.chat = deepseekModel.id;
8813
+ }
8814
+ const updated = {
8815
+ ...allSitePrefs,
8816
+ [currentAuthStatus2.endpoint]: currentAccountPrefs
8817
+ };
8818
+ await ((_d2 = this.storage) == null ? void 0 : _d2.setModelPreferences(updated));
8781
8819
  }
8782
- const updated = {
8783
- ...allSitePrefs,
8784
- [currentAuthStatus().endpoint]: currentAccountPrefs
8785
- };
8786
- (_d2 = this.storage) == null ? void 0 : _d2.setModelPreferences(updated);
8787
- })
8820
+ )
8788
8821
  ).subscribe({});
8789
8822
  }
8790
8823
  dispose() {
@@ -8801,16 +8834,6 @@ class ModelsService {
8801
8834
  const data = this.storedValue.value.last;
8802
8835
  return data ? data.primaryModels.concat(data.localModels) : [];
8803
8836
  }
8804
- getModelsByType(usage) {
8805
- return this.modelsChanges.pipe(
8806
- map$1((models) => {
8807
- return models === pendingOperation ? pendingOperation : [...models.primaryModels, ...models.localModels].filter(
8808
- (model2) => model2.usage.includes(usage)
8809
- );
8810
- }),
8811
- distinctUntilChanged$1()
8812
- );
8813
- }
8814
8837
  /**
8815
8838
  * Gets the available models of the specified usage type, with the default model first.
8816
8839
  *
@@ -8833,42 +8856,23 @@ class ModelsService {
8833
8856
  shareReplay$1()
8834
8857
  );
8835
8858
  }
8836
- async getModelsAvailabilityStatus(type) {
8837
- const models = await firstResultFromOperation(modelsService.getModels(type));
8838
- return Promise.all(
8839
- models.map(async (model2) => {
8840
- const isModelAvailable = await firstResultFromOperation(this.isModelAvailable(model2));
8841
- return { model: model2, isModelAvailable };
8842
- })
8843
- );
8844
- }
8845
- getDefaultModel(type) {
8846
- return combineLatest$1(
8847
- this.getModelsByType(type),
8848
- this.modelsChanges,
8849
- authStatus,
8850
- userProductSubscription
8851
- ).pipe(
8852
- map$1(([models, modelsData, authStatus2, userProductSubscription2]) => {
8853
- if (models === pendingOperation || modelsData === pendingOperation || userProductSubscription2 === pendingOperation) {
8859
+ getDefaultModel(usage) {
8860
+ return this.modelsChanges.pipe(
8861
+ map$1((modelsData) => {
8862
+ if (modelsData === pendingOperation) {
8854
8863
  return pendingOperation;
8855
8864
  }
8856
- models = models.filter((model2) => !model2.tags.includes(ModelTag.Deprecated));
8857
- const firstModelUserCanUse = models.find(
8858
- (m) => this._isModelAvailable(modelsData, authStatus2, userProductSubscription2, m) === true && !m.tags.includes(ModelTag.Reasoning)
8865
+ const models = [...modelsData.primaryModels, ...modelsData.localModels].filter(
8866
+ (model2) => model2.usage.includes(usage) && !model2.tags.includes(ModelTag.Deprecated)
8859
8867
  );
8868
+ const firstModelUserCanUse = models.find((m) => !m.tags.includes(ModelTag.Reasoning));
8860
8869
  if (modelsData.preferences) {
8861
8870
  const selected = this.resolveModel(
8862
8871
  modelsData,
8863
- modelsData.preferences.selected[type] ?? modelsData.preferences.defaults[type]
8872
+ modelsData.preferences.selected[usage] ?? modelsData.preferences.defaults[usage]
8864
8873
  );
8865
8874
  if (selected && // Don't set default model for ModelUsage.Edit if the model has certain tags
8866
- !(type === ModelUsage.Edit && (selected.tags.includes(ModelTag.Reasoning) || selected.tags.includes(ModelTag.Deprecated))) && this._isModelAvailable(
8867
- modelsData,
8868
- authStatus2,
8869
- userProductSubscription2,
8870
- selected
8871
- ) === true) {
8875
+ !(usage === ModelUsage.Edit && (selected.tags.includes(ModelTag.Reasoning) || selected.tags.includes(ModelTag.Deprecated)))) {
8872
8876
  return selected;
8873
8877
  }
8874
8878
  }
@@ -8919,7 +8923,10 @@ class ModelsService {
8919
8923
  if (!this.storage) {
8920
8924
  throw new Error("ModelsService.storage is not set");
8921
8925
  }
8922
- const serverEndpoint = currentAuthStatus().endpoint;
8926
+ const serverEndpoint = (await firstResultFromOperation(authStatus)).endpoint;
8927
+ if (!serverEndpoint) {
8928
+ throw new Error("No server endpoint found");
8929
+ }
8923
8930
  const currentPrefs = deepClone(this.storage.getModelPreferences());
8924
8931
  if (!currentPrefs[serverEndpoint]) {
8925
8932
  currentPrefs[serverEndpoint] = modelsData.preferences;
@@ -8927,28 +8934,6 @@ class ModelsService {
8927
8934
  currentPrefs[serverEndpoint].selected[type] = resolved.id;
8928
8935
  await this.storage.setModelPreferences(currentPrefs);
8929
8936
  }
8930
- isModelAvailable(model2) {
8931
- return combineLatest$1(authStatus, this.modelsChanges, userProductSubscription).pipe(
8932
- map$1(
8933
- ([authStatus2, modelsData, userProductSubscription2]) => modelsData === pendingOperation || userProductSubscription2 === pendingOperation ? pendingOperation : this._isModelAvailable(modelsData, authStatus2, userProductSubscription2, model2)
8934
- ),
8935
- distinctUntilChanged$1()
8936
- );
8937
- }
8938
- _isModelAvailable(modelsData, authStatus2, sub2, model2) {
8939
- const resolved = this.resolveModel(modelsData, model2);
8940
- if (!resolved) {
8941
- return false;
8942
- }
8943
- const tier = modelTier(resolved);
8944
- if (isEnterpriseUser(authStatus2)) {
8945
- return true;
8946
- }
8947
- if (isCodyProUser(authStatus2, sub2)) {
8948
- return tier !== "enterprise" && !resolved.tags.includes(ModelTag.Waitlist) && !resolved.tags.includes(ModelTag.OnWaitlist);
8949
- }
8950
- return tier === "free";
8951
- }
8952
8937
  // does an approximate match on the model id, seeing if there are any models in the
8953
8938
  // cache that are contained within the given model id. This allows passing a qualified,
8954
8939
  // unqualified or ModelRefStr in as the model id will be a substring
@@ -9225,9 +9210,15 @@ function getDefaultSystemPrompt() {
9225
9210
  const SMART_APPLY_PREAMBLE = ps`If your answer contains fenced code blocks in Markdown, include the relevant full file path in the code block tag using this structure: \`\`\`$LANGUAGE:$FILEPATH\`\`\`
9226
9211
  For executable terminal commands: enclose each command in individual "bash" language code block without comments and new lines inside.`;
9227
9212
  const TERMINAL_TOOL_PREAMBLE = ps`\n\nCheck if you have access to terminal/shell tools. If so, use it to execute commands to gather information. The terminal output is included in your context. You can reference and analyze this output in your response.`;
9228
- const CHAT_PREAMBLE = DEFAULT_PREAMBLE.concat(SMART_APPLY_PREAMBLE).concat(TERMINAL_TOOL_PREAMBLE);
9229
- function getSimplePreamble(model2, apiVersion, type, preInstruction) {
9230
- const preamble = type === "Chat" ? CHAT_PREAMBLE : DEFAULT_PREAMBLE;
9213
+ function getChatPreamble(includeTerminalToolPreamble) {
9214
+ const basePreamble = DEFAULT_PREAMBLE.concat(SMART_APPLY_PREAMBLE);
9215
+ if (includeTerminalToolPreamble) {
9216
+ return basePreamble.concat(TERMINAL_TOOL_PREAMBLE);
9217
+ }
9218
+ return basePreamble;
9219
+ }
9220
+ function getSimplePreamble(model2, apiVersion, type, preInstruction, includeTerminalToolPreamble) {
9221
+ const preamble = type === "Chat" ? getChatPreamble(includeTerminalToolPreamble) : DEFAULT_PREAMBLE;
9231
9222
  const intro = ps`${preamble}\n\n${preInstruction ?? ""}`.trim();
9232
9223
  if (apiVersion >= 1 && (model2 == null ? void 0 : model2.includes("claude-3"))) {
9233
9224
  return [
@@ -9542,7 +9533,7 @@ async function getTokenCounterUtils() {
9542
9533
  const browser2 = detect();
9543
9534
  if (browser2 && browser2.name === "safari") {
9544
9535
  _tokenCounterUtilsPromise = import("./cl100k_base-B4kyDDRQ.mjs").then(async (tokenizer2) => {
9545
- const tiktoken = await import("./lite-BobkBW3_.mjs");
9536
+ const tiktoken = await import("./lite-CQAWMpwn.mjs");
9546
9537
  return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
9547
9538
  });
9548
9539
  } else {
@@ -9919,19 +9910,20 @@ function defaultOnOpen(response) {
9919
9910
  }
9920
9911
  }
9921
9912
  class CompletionsResponseBuilder {
9922
- constructor(apiVersion) {
9913
+ constructor(apiVersion, model2) {
9923
9914
  __publicField2(this, "totalCompletion", "");
9924
9915
  __publicField2(this, "thinkingBuffer", []);
9925
9916
  __publicField2(this, "toolCalled", /* @__PURE__ */ new Map());
9926
9917
  __publicField2(this, "lastToolCallId");
9927
9918
  this.apiVersion = apiVersion;
9919
+ this.model = model2;
9928
9920
  }
9929
9921
  /**
9930
9922
  * Creates a builder from a URL with api-version parameter
9931
9923
  */
9932
- static fromUrl(url) {
9924
+ static fromUrl(url, model2) {
9933
9925
  const apiVersion = Number.parseInt(new URL(url).searchParams.get("api-version") ?? "0", 10);
9934
- return new CompletionsResponseBuilder(apiVersion);
9926
+ return new CompletionsResponseBuilder(apiVersion, model2);
9935
9927
  }
9936
9928
  /**
9937
9929
  * Processes the next chunk of completion text
@@ -13467,7 +13459,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
13467
13459
  try {
13468
13460
  await addAuthHeaders(config.auth, headersInstance, url);
13469
13461
  } catch (error) {
13470
- cb.onError(error.message);
13462
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
13471
13463
  abort2.abort();
13472
13464
  console.error(error);
13473
13465
  return;
@@ -13477,7 +13469,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
13477
13469
  if (trace) {
13478
13470
  headersInstance.set("X-Sourcegraph-Should-Trace", "true");
13479
13471
  }
13480
- const builder = new CompletionsResponseBuilder(apiVersion);
13472
+ const builder = new CompletionsResponseBuilder(apiVersion, params.model);
13481
13473
  headersInstance.set("Accept-Encoding", "gzip;q=0");
13482
13474
  fetchEventSource(url.toString(), {
13483
13475
  method: "POST",
@@ -13489,7 +13481,10 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
13489
13481
  async onopen(response) {
13490
13482
  if (!response.ok && response.headers.get("content-type") !== "text/event-stream") {
13491
13483
  const error = await verifyResponseCode(response).catch((err2) => err2);
13492
- cb.onError(error, response.status);
13484
+ cb.onError(
13485
+ error instanceof Error ? error : new Error(String(error)),
13486
+ response.status
13487
+ );
13493
13488
  abort2.abort();
13494
13489
  return;
13495
13490
  }
@@ -13522,21 +13517,21 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
13522
13517
  }
13523
13518
  this.sendEvents(events2, cb);
13524
13519
  } catch (error) {
13525
- cb.onError(error.message);
13520
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
13526
13521
  abort2.abort();
13527
13522
  console.error(error);
13528
13523
  throw error;
13529
13524
  }
13530
13525
  },
13531
13526
  onerror(error) {
13532
- cb.onError(error.message);
13527
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
13533
13528
  abort2.abort();
13534
13529
  console.error(error);
13535
13530
  throw error;
13536
13531
  },
13537
13532
  fetch: globalThis.fetch
13538
13533
  }).catch((error) => {
13539
- cb.onError(error.message);
13534
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
13540
13535
  abort2.abort();
13541
13536
  console.error(error);
13542
13537
  });
@@ -13572,7 +13567,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
13572
13567
  }
13573
13568
  } catch (error) {
13574
13569
  console.error(error);
13575
- cb.onError(error instanceof Error ? error : new Error(`${error}`));
13570
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
13576
13571
  }
13577
13572
  }
13578
13573
  }
@@ -13694,9 +13689,6 @@ const events$2 = [
13694
13689
  ({ feature: feature2, action }) => (params) => {
13695
13690
  telemetryRecorder.recordEvent(feature2, action, {
13696
13691
  metadata: {
13697
- // Flag indicating this is a transcript event to go through ML data pipeline. Not for enterprise users
13698
- // See https://github.com/sourcegraph/sourcegraph/pull/59524
13699
- recordsPrivateMetadataTranscript: 0,
13700
13692
  isPublicRepo: params.repoIsPublic ? 1 : 0,
13701
13693
  // TODO: Remove this field when the transition from commands to prompts is complete
13702
13694
  isCommand: params.command ? 1 : 0,
@@ -13710,8 +13702,6 @@ const events$2 = [
13710
13702
  requestID: params.requestID,
13711
13703
  sessionID: params.sessionID,
13712
13704
  traceId: params.traceId,
13713
- promptText: void 0,
13714
- gitMetadata: void 0,
13715
13705
  chatAgent: params.chatAgent
13716
13706
  },
13717
13707
  billingMetadata: {
@@ -15485,7 +15475,7 @@ async function groqChatClient({
15485
15475
  log2 == null ? void 0 : log2.onComplete(completionResponse);
15486
15476
  }).catch((error) => {
15487
15477
  log2 == null ? void 0 : log2.onError(error);
15488
- cb.onError(error);
15478
+ cb.onError(error instanceof Error ? error : new Error(String(error)));
15489
15479
  });
15490
15480
  }
15491
15481
  const getContextForChatMessage = async (message, parentSignal) => {
@@ -25214,6 +25204,7 @@ class LocalStorage {
25214
25204
  * access it as a singleton via the module import.
25215
25205
  */
25216
25206
  __publicField2(this, "_storage", null);
25207
+ __publicField2(this, "_cache", null);
25217
25208
  __publicField2(this, "onChange", new AgentEventEmitter());
25218
25209
  __publicField2(this, "createdAnonymousUserID", false);
25219
25210
  }
@@ -25226,17 +25217,20 @@ class LocalStorage {
25226
25217
  setStorage(storage) {
25227
25218
  if (storage === "inMemory") {
25228
25219
  this._storage = inMemoryEphemeralLocalStorage;
25220
+ this._cache = null;
25229
25221
  } else if (storage === "noop") {
25230
25222
  this._storage = noopLocalStorage;
25223
+ this._cache = null;
25231
25224
  } else {
25232
25225
  this._storage = storage;
25226
+ this._cache = /* @__PURE__ */ new Map();
25233
25227
  }
25234
25228
  this.clearDeprecatedKeys();
25235
25229
  }
25236
- getClientState() {
25230
+ async getClientState() {
25237
25231
  return {
25238
25232
  lastUsedEndpoint: this.getEndpoint(),
25239
- anonymousUserID: this.anonymousUserID(),
25233
+ anonymousUserID: await this.anonymousUserID(),
25240
25234
  lastUsedChatModality: this.getLastUsedChatModality(),
25241
25235
  modelPreferences: this.getModelPreferences()
25242
25236
  };
@@ -25244,17 +25238,12 @@ class LocalStorage {
25244
25238
  get clientStateChanges() {
25245
25239
  return fromVSCodeEvent(this.onChange.event).pipe(
25246
25240
  startWith$1(void 0),
25247
- map$1(() => this.getClientState()),
25241
+ map$1(async () => await this.getClientState()),
25248
25242
  distinctUntilChanged$1()
25249
25243
  );
25250
25244
  }
25251
25245
  getEndpoint() {
25252
- const endpoint = this.storage.get(this.LAST_USED_ENDPOINT, null);
25253
- if (endpoint && isSourcegraphToken(endpoint)) {
25254
- this.deleteEndpoint(endpoint);
25255
- return null;
25256
- }
25257
- return endpoint;
25246
+ return this.get(this.LAST_USED_ENDPOINT) || null;
25258
25247
  }
25259
25248
  /**
25260
25249
  * Save the server endpoint to local storage *and* the access token to secret storage, but wait
@@ -25271,7 +25260,11 @@ class LocalStorage {
25271
25260
  }
25272
25261
  const serverEndpoint = new URL(auth2.serverEndpoint).href;
25273
25262
  await this.set(this.LAST_USED_ENDPOINT, serverEndpoint, false);
25274
- await this.addEndpointHistory(serverEndpoint, false);
25263
+ const history = this.getEndpointHistory();
25264
+ const historySet = new Set(history);
25265
+ historySet.delete(auth2.serverEndpoint);
25266
+ historySet.add(auth2.serverEndpoint);
25267
+ await this.set(this.CODY_ENDPOINT_HISTORY, [...historySet], false);
25275
25268
  if (auth2.credentials && "token" in auth2.credentials) {
25276
25269
  await secretStorage.storeToken(
25277
25270
  serverEndpoint,
@@ -25281,41 +25274,34 @@ class LocalStorage {
25281
25274
  }
25282
25275
  this.onChange.fire();
25283
25276
  }
25284
- async deleteEndpoint(endpoint) {
25285
- await this.set(endpoint, null);
25286
- await this.deleteEndpointFromHistory(endpoint);
25277
+ async deleteEndpointAndToken(endpoint) {
25278
+ if (this.getEndpoint() === endpoint) {
25279
+ await this.delete(this.LAST_USED_ENDPOINT, false);
25280
+ }
25281
+ const history = this.getEndpointHistory();
25282
+ const historySet = new Set(history);
25283
+ historySet.delete(endpoint);
25284
+ await this.set(this.CODY_ENDPOINT_HISTORY, [...historySet], false);
25285
+ await secretStorage.deleteToken(endpoint);
25286
+ this.onChange.fire();
25287
25287
  }
25288
25288
  // Deletes and returns the endpoint history
25289
25289
  async deleteEndpointHistory() {
25290
25290
  const history = this.getEndpointHistory();
25291
+ const deleteTokens = (history == null ? void 0 : history.map((endpoint) => secretStorage.deleteToken(endpoint))) ?? [];
25291
25292
  await Promise.all([
25292
- this.deleteEndpoint(this.LAST_USED_ENDPOINT),
25293
- this.set(this.CODY_ENDPOINT_HISTORY, null)
25293
+ this.delete(this.LAST_USED_ENDPOINT, false),
25294
+ this.delete(this.CODY_ENDPOINT_HISTORY, false),
25295
+ ...deleteTokens
25294
25296
  ]);
25297
+ this.onChange.fire();
25295
25298
  return history || [];
25296
25299
  }
25297
- // Deletes and returns the endpoint history
25298
- async deleteEndpointFromHistory(endpoint) {
25299
- const history = this.getEndpointHistory();
25300
- const historySet = new Set(history);
25301
- historySet.delete(endpoint);
25302
- await this.set(this.CODY_ENDPOINT_HISTORY, [...historySet]);
25303
- }
25304
25300
  getEndpointHistory() {
25305
25301
  return this.get(this.CODY_ENDPOINT_HISTORY);
25306
25302
  }
25307
- async addEndpointHistory(endpoint, fire = true) {
25308
- if (isSourcegraphToken(endpoint)) {
25309
- return;
25310
- }
25311
- const history = this.storage.get(this.CODY_ENDPOINT_HISTORY, null);
25312
- const historySet = new Set(history);
25313
- historySet.delete(endpoint);
25314
- historySet.add(endpoint);
25315
- await this.set(this.CODY_ENDPOINT_HISTORY, [...historySet], fire);
25316
- }
25317
25303
  getChatHistory(authStatus2) {
25318
- const history = this.storage.get(this.KEY_LOCAL_HISTORY, null);
25304
+ const history = this.get(this.KEY_LOCAL_HISTORY) || null;
25319
25305
  const accountKey = getKeyForAuthStatus(authStatus2);
25320
25306
  return (history == null ? void 0 : history[accountKey]) ?? { chat: {} };
25321
25307
  }
@@ -25324,15 +25310,12 @@ class LocalStorage {
25324
25310
  * Useful for export functionality when user can't authenticate
25325
25311
  */
25326
25312
  getAllChatHistory() {
25327
- return this.storage.get(this.KEY_LOCAL_HISTORY, null);
25313
+ return this.get(this.KEY_LOCAL_HISTORY) || null;
25328
25314
  }
25329
25315
  async setChatHistory(authStatus2, history) {
25330
25316
  try {
25331
25317
  const key2 = getKeyForAuthStatus(authStatus2);
25332
- let fullHistory = this.storage.get(
25333
- this.KEY_LOCAL_HISTORY,
25334
- null
25335
- );
25318
+ let fullHistory = this.get(this.KEY_LOCAL_HISTORY) || null;
25336
25319
  if (fullHistory) {
25337
25320
  fullHistory[key2] = history;
25338
25321
  } else {
@@ -25347,10 +25330,7 @@ class LocalStorage {
25347
25330
  }
25348
25331
  async importChatHistory(history, shouldMerge) {
25349
25332
  if (shouldMerge) {
25350
- const fullHistory = this.storage.get(
25351
- this.KEY_LOCAL_HISTORY,
25352
- null
25353
- );
25333
+ const fullHistory = this.get(this.KEY_LOCAL_HISTORY) || null;
25354
25334
  merge$1(history, fullHistory);
25355
25335
  }
25356
25336
  await this.storage.update(this.KEY_LOCAL_HISTORY, history);
@@ -25405,7 +25385,7 @@ class LocalStorage {
25405
25385
  * so that the caller can log the first enrollment event.
25406
25386
  */
25407
25387
  getEnrollmentHistory(featureName) {
25408
- const history = this.storage.get(this.CODY_ENROLLMENT_HISTORY, []) || [];
25388
+ const history = this.get(this.CODY_ENROLLMENT_HISTORY) || [];
25409
25389
  const hasEnrolled = (history == null ? void 0 : history.includes(featureName)) || false;
25410
25390
  if (!hasEnrolled) {
25411
25391
  history.push(featureName);
@@ -25418,12 +25398,12 @@ class LocalStorage {
25418
25398
  * occurs on a fresh installation). Callers can check
25419
25399
  * {@link LocalStorage.checkIfCreatedAnonymousUserID} to see if a new anonymous ID was created.
25420
25400
  */
25421
- anonymousUserID() {
25422
- let id = this.storage.get(this.ANONYMOUS_USER_ID_KEY);
25401
+ async anonymousUserID() {
25402
+ let id = this.get(this.ANONYMOUS_USER_ID_KEY);
25423
25403
  if (!id) {
25424
25404
  this.createdAnonymousUserID = true;
25425
25405
  id = v4();
25426
- this.set(this.ANONYMOUS_USER_ID_KEY, id).catch((error) => console.error(error));
25406
+ await this.set(this.ANONYMOUS_USER_ID_KEY, id).catch((error) => console.error(error));
25427
25407
  }
25428
25408
  return id;
25429
25409
  }
@@ -25440,8 +25420,8 @@ class LocalStorage {
25440
25420
  getConfig() {
25441
25421
  return this.get(this.KEY_CONFIG);
25442
25422
  }
25443
- setLastUsedChatModality(modality) {
25444
- this.set(this.LAST_USED_CHAT_MODALITY, modality);
25423
+ async setLastUsedChatModality(modality) {
25424
+ await this.set(this.LAST_USED_CHAT_MODALITY, modality);
25445
25425
  }
25446
25426
  getLastUsedChatModality() {
25447
25427
  return this.get(this.LAST_USED_CHAT_MODALITY) ?? "sidebar";
@@ -25459,10 +25439,22 @@ class LocalStorage {
25459
25439
  await this.set(this.DEVICE_PIXEL_RATIO, ratio);
25460
25440
  }
25461
25441
  get(key2) {
25442
+ if (this._cache) {
25443
+ if (this._cache.has(key2)) {
25444
+ return this._cache.get(key2);
25445
+ }
25446
+ const value = this.storage.get(key2, null);
25447
+ if (value !== null) {
25448
+ this._cache.set(key2, value);
25449
+ }
25450
+ return value;
25451
+ }
25462
25452
  return this.storage.get(key2, null);
25463
25453
  }
25464
25454
  async set(key2, value, fire = true) {
25455
+ var _a3;
25465
25456
  try {
25457
+ (_a3 = this._cache) == null ? void 0 : _a3.set(key2, value);
25466
25458
  await this.storage.update(key2, value);
25467
25459
  if (fire) {
25468
25460
  this.onChange.fire();
@@ -25471,21 +25463,30 @@ class LocalStorage {
25471
25463
  console.error(error);
25472
25464
  }
25473
25465
  }
25474
- async delete(key2) {
25466
+ async delete(key2, fire = true) {
25467
+ var _a3;
25468
+ (_a3 = this._cache) == null ? void 0 : _a3.delete(key2);
25475
25469
  await this.storage.update(key2, void 0);
25476
- this.onChange.fire();
25470
+ if (fire) {
25471
+ this.onChange.fire();
25472
+ }
25477
25473
  }
25478
25474
  async clearDeprecatedKeys() {
25479
25475
  try {
25480
25476
  const deprecatedKeys = Object.values(this.deprecatedKeys);
25481
25477
  for (const key2 of deprecatedKeys) {
25482
- const value = this.storage.get(key2);
25483
- if (value) await this.storage.update(key2, null);
25478
+ const value = this.get(key2);
25479
+ if (value) await this.delete(key2, false);
25484
25480
  }
25481
+ this.onChange.fire();
25485
25482
  } catch (error) {
25486
25483
  console.error("Error clearing deprecated keys:", error);
25487
25484
  }
25488
25485
  }
25486
+ resetCache() {
25487
+ this._cache = /* @__PURE__ */ new Map();
25488
+ this.onChange.fire();
25489
+ }
25489
25490
  }
25490
25491
  const localStorage = new LocalStorage();
25491
25492
  function getKeyForAuthStatus(authStatus2) {
@@ -25687,11 +25688,23 @@ class OutputChannelManager {
25687
25688
  return this.outputChannels.get(feature2);
25688
25689
  }
25689
25690
  appendLine(level2, text2, feature2) {
25690
- var _a3, _b2;
25691
- level2 === "error" ? (_a3 = this.defaultOutputChannel) == null ? void 0 : _a3.error(text2) : (_b2 = this.defaultOutputChannel) == null ? void 0 : _b2.debug(text2);
25691
+ var _a3, _b2, _c2;
25692
+ if (level2 === "error") {
25693
+ (_a3 = this.defaultOutputChannel) == null ? void 0 : _a3.error(text2);
25694
+ } else if (level2 === "info") {
25695
+ (_b2 = this.defaultOutputChannel) == null ? void 0 : _b2.info(text2);
25696
+ } else {
25697
+ (_c2 = this.defaultOutputChannel) == null ? void 0 : _c2.debug(text2);
25698
+ }
25692
25699
  if (feature2) {
25693
25700
  const channel2 = this.getOutputChannel(feature2);
25694
- level2 === "error" ? channel2 == null ? void 0 : channel2.error(text2) : channel2 == null ? void 0 : channel2.debug(text2);
25701
+ if (level2 === "error") {
25702
+ channel2 == null ? void 0 : channel2.error(text2);
25703
+ } else if (level2 === "info") {
25704
+ channel2 == null ? void 0 : channel2.info(text2);
25705
+ } else {
25706
+ channel2 == null ? void 0 : channel2.debug(text2);
25707
+ }
25695
25708
  }
25696
25709
  const path2 = define_process_default$h.env.CODY_LOG_FILE;
25697
25710
  if (path2) {
@@ -25716,6 +25729,15 @@ class Logger {
25716
25729
  args: args2
25717
25730
  });
25718
25731
  }
25732
+ logInfo(filterLabel, text2, ...args2) {
25733
+ this.log({
25734
+ level: "info",
25735
+ feature: this.feature,
25736
+ filterLabel,
25737
+ text: text2,
25738
+ args: args2
25739
+ });
25740
+ }
25719
25741
  logError(filterLabel, text2, ...args2) {
25720
25742
  this.log({
25721
25743
  level: "error",
@@ -25752,6 +25774,9 @@ const outputChannelLogger = new Logger();
25752
25774
  function logDebug(filterLabel, text2, ...args2) {
25753
25775
  outputChannelLogger.logDebug(filterLabel, text2, ...args2);
25754
25776
  }
25777
+ function logInfo(filterLabel, text2, ...args2) {
25778
+ outputChannelLogger.logInfo(filterLabel, text2, ...args2);
25779
+ }
25755
25780
  function logError$1(filterLabel, text2, ...args2) {
25756
25781
  outputChannelLogger.logError(filterLabel, text2, ...args2);
25757
25782
  }
@@ -25814,52 +25839,23 @@ const version = ((_i = (_h = extensions.getExtension("sourcegraph.cody-ai")) ==
25814
25839
  setExtensionVersion(version);
25815
25840
  const HAS_AUTHENTICATED_BEFORE_KEY = "has-authenticated-before";
25816
25841
  class AuthProvider {
25817
- constructor(setAuthStatusObservable$1 = setAuthStatusObservable, resolvedConfig$1 = resolvedConfig) {
25842
+ constructor(setAuthStatusObservable$1 = setAuthStatusObservable) {
25818
25843
  __publicField2(this, "status", new MulticastSubject());
25819
- __publicField2(this, "refreshRequests", new MulticastSubject());
25820
25844
  /**
25821
25845
  * Credentials that were already validated with
25822
25846
  * {@link AuthProvider.validateAndStoreCredentials}.
25823
25847
  */
25824
- __publicField2(this, "lastValidatedAndStoredCredentials", new MulticastSubject());
25825
- __publicField2(this, "lastEndpoint");
25826
- __publicField2(this, "hasAuthed", false);
25848
+ __publicField2(this, "lastValidated", { credentials: null, auth: null });
25827
25849
  __publicField2(this, "subscriptions", []);
25828
- setAuthStatusObservable$1(this.status.pipe(distinctUntilChanged$1()));
25829
- const credentialsChangesNeedingValidation = resolvedConfig$1.pipe(
25830
- withLatestFrom(this.lastValidatedAndStoredCredentials.pipe(startWith$1(null))),
25831
- switchMap$1(([config, lastValidatedCredentials]) => {
25832
- const credentials = toCredentialsOnlyNormalized(config);
25833
- return isEqual(credentials, lastValidatedCredentials) ? NEVER$1 : Observable.of(credentials);
25834
- }),
25835
- distinctUntilChanged$1()
25836
- );
25837
- this.subscriptions.push(
25838
- ClientConfigSingleton.getInstance().updates.pipe(
25839
- abortableOperation(async (config, signal2) => {
25840
- const nextAuthStatus = await validateCredentials(
25841
- await currentResolvedConfig(),
25842
- signal2,
25843
- config
25844
- );
25845
- if (!nextAuthStatus.authenticated && isEnterpriseUserDotComError(nextAuthStatus.error)) {
25846
- this.status.next(nextAuthStatus);
25847
- }
25848
- })
25849
- ).subscribe({})
25850
- );
25851
- this.subscriptions.push(
25852
- combineLatest$1(
25853
- credentialsChangesNeedingValidation,
25854
- this.refreshRequests.pipe(startWith$1(true))
25855
- ).pipe(
25856
- abortableOperation(async ([config, resetInitialAuthStatus], signal2) => {
25857
- if (clientCapabilities().isCodyWeb) {
25858
- return;
25859
- }
25860
- await this.validateAndUpdateAuthStatus(config, signal2, resetInitialAuthStatus);
25850
+ setAuthStatusObservable$1(
25851
+ this.status.pipe(
25852
+ distinctUntilChanged$1(),
25853
+ startWith$1({
25854
+ authenticated: false,
25855
+ endpoint: DOTCOM_URL.toString(),
25856
+ pendingValidation: false
25861
25857
  })
25862
- ).subscribe({})
25858
+ )
25863
25859
  );
25864
25860
  this.subscriptions.push(
25865
25861
  authStatus.pipe(
@@ -25871,13 +25867,12 @@ class AuthProvider {
25871
25867
  return EMPTY$1;
25872
25868
  })
25873
25869
  ).subscribe(() => {
25874
- this.refreshRequests.next(false);
25870
+ this.refresh();
25875
25871
  })
25876
25872
  );
25877
25873
  this.subscriptions.push(
25878
25874
  authStatus.subscribe((authStatus2) => {
25879
25875
  try {
25880
- this.lastEndpoint = authStatus2.endpoint;
25881
25876
  if (isRunningInsideAgent()) {
25882
25877
  commands$1.executeCommand("authStatus.update", authStatus2);
25883
25878
  }
@@ -25896,111 +25891,129 @@ class AuthProvider {
25896
25891
  }
25897
25892
  })
25898
25893
  );
25899
- this.subscriptions.push(startAuthTelemetryReporter());
25894
+ this.subscriptions.push(
25895
+ authStatus.subscribe((authStatus2) => {
25896
+ try {
25897
+ this.reportAuthTelemetryEvent(authStatus2);
25898
+ } catch (error) {
25899
+ logError$1("AuthProvider", "Unexpected error while reporting auth telemetry", error);
25900
+ }
25901
+ })
25902
+ );
25900
25903
  this.subscriptions.push(
25901
25904
  disposableSubscription(
25902
25905
  commands$1.registerCommand("cody.auth.refresh", () => this.refresh())
25903
25906
  )
25904
25907
  );
25905
- }
25906
- async validateAndUpdateAuthStatus(credentials, signal2, resetInitialAuthStatus) {
25907
- if (resetInitialAuthStatus ?? true) {
25908
- this.status.next({
25909
- authenticated: false,
25910
- pendingValidation: true,
25911
- endpoint: credentials.auth.serverEndpoint
25912
- });
25913
- }
25914
- try {
25915
- const authStatus2 = await validateCredentials(credentials, signal2, void 0);
25916
- signal2 == null ? void 0 : signal2.throwIfAborted();
25917
- this.status.next(authStatus2);
25918
- await this.handleAuthTelemetry(authStatus2, signal2);
25919
- } catch (error) {
25920
- if (!isAbortError(error)) {
25921
- logError$1("AuthProvider", "Unexpected error validating credentials", error);
25922
- }
25923
- }
25924
- }
25925
- async handleAuthTelemetry(authStatus2, signal2) {
25926
- const hasAuthed = this.hasAuthed;
25927
- this.hasAuthed = true;
25928
- if (!hasAuthed && authStatus2.authenticated) {
25929
- await this.setHasAuthenticatedBefore();
25930
- signal2 == null ? void 0 : signal2.throwIfAborted();
25931
- } else if (authStatus2.authenticated) {
25932
- this.handleFirstEverAuthentication();
25933
- }
25934
- }
25935
- dispose() {
25936
- for (const subscription of this.subscriptions) {
25937
- subscription.unsubscribe();
25938
- }
25939
- }
25940
- /**
25941
- * Refresh the auth status.
25942
- */
25943
- refresh(resetInitialAuthStatus = true) {
25944
- this.lastValidatedAndStoredCredentials.next(null);
25945
- this.refreshRequests.next(resetInitialAuthStatus);
25946
- }
25947
- signout(endpoint) {
25948
- if (this.lastEndpoint !== endpoint) {
25949
- return;
25950
- }
25951
- this.lastValidatedAndStoredCredentials.next(null);
25952
- this.status.next({
25953
- authenticated: false,
25954
- endpoint: DOTCOM_URL.toString(),
25955
- pendingValidation: false
25956
- });
25908
+ this.subscriptions.push(
25909
+ resolvedConfig.pipe(
25910
+ map$1((config) => this.toCredentialsOnlyNormalized(config)),
25911
+ distinctUntilChanged$1(isEqual)
25912
+ ).subscribe((authConfig) => {
25913
+ this.validateAndStoreCredentials(authConfig, "store-if-valid");
25914
+ })
25915
+ );
25916
+ this.subscriptions.push(
25917
+ externalAuthRefresh.subscribe(() => {
25918
+ this.refresh();
25919
+ })
25920
+ );
25957
25921
  }
25958
25922
  async validateAndStoreCredentials(config, mode) {
25923
+ var _a3;
25959
25924
  let credentials;
25960
25925
  if ("auth" in config) {
25961
- credentials = toCredentialsOnlyNormalized(config);
25926
+ credentials = this.toCredentialsOnlyNormalized(config);
25962
25927
  } else {
25963
25928
  const prevConfig = await currentResolvedConfig();
25964
- credentials = toCredentialsOnlyNormalized({
25929
+ credentials = this.toCredentialsOnlyNormalized({
25965
25930
  configuration: prevConfig.configuration,
25966
25931
  auth: config,
25967
25932
  clientState: prevConfig.clientState
25968
25933
  });
25969
25934
  }
25970
- const authStatus2 = await validateCredentials(credentials, void 0);
25935
+ if (isEqual(credentials, this.lastValidated.credentials) && ((_a3 = this.lastValidated.auth) == null ? void 0 : _a3.authenticated)) {
25936
+ return this.lastValidated.auth;
25937
+ }
25938
+ this.setAuthPendingToEndpoint(credentials.auth.serverEndpoint);
25939
+ const authStatus2 = await validateCredentials(credentials);
25971
25940
  const shouldStore = mode === "always-store" || authStatus2.authenticated;
25972
25941
  if (shouldStore) {
25973
25942
  await Promise.all([
25974
25943
  localStorage.saveEndpointAndToken(credentials.auth),
25975
25944
  this.serializeUninstallerInfo(authStatus2)
25976
25945
  ]);
25977
- this.lastValidatedAndStoredCredentials.next(credentials);
25978
- this.status.next(authStatus2);
25979
- }
25980
- if (!shouldStore) {
25981
- reportAuthTelemetryEvent(authStatus2);
25946
+ } else if (!authStatus2.authenticated && !authStatus2.pendingValidation) {
25947
+ const status = authStatus2;
25948
+ if (status.endpoint && isInvalidAccessTokenError(status.error)) {
25949
+ await localStorage.deleteEndpointAndToken(status.endpoint);
25950
+ }
25982
25951
  }
25983
- await this.handleAuthTelemetry(authStatus2, void 0);
25952
+ this.lastValidated = { credentials, auth: authStatus2 };
25953
+ this.status.next(authStatus2);
25984
25954
  return authStatus2;
25985
25955
  }
25986
- setAuthPendingToEndpoint(endpoint) {
25987
- this.status.next({ authenticated: false, endpoint, pendingValidation: true });
25988
- }
25989
- // Logs a telemetry event if the user has never authenticated to Sourcegraph.
25990
- handleFirstEverAuthentication() {
25991
- if (localStorage.get(HAS_AUTHENTICATED_BEFORE_KEY)) {
25956
+ reportAuthTelemetryEvent(authStatus2) {
25957
+ if (authStatus2.pendingValidation) {
25992
25958
  return;
25993
25959
  }
25994
- telemetryRecorder.recordEvent("cody.auth.login", "firstEver", {
25995
- billingMetadata: {
25996
- product: "cody",
25997
- category: "billable"
25998
- }
25999
- });
26000
- this.setHasAuthenticatedBefore();
25960
+ let eventValue;
25961
+ if (!authStatus2.authenticated && (isAvailabilityError(authStatus2.error) || isInvalidAccessTokenError(authStatus2.error))) {
25962
+ eventValue = "failed";
25963
+ } else if (authStatus2.authenticated) {
25964
+ eventValue = "connected";
25965
+ } else {
25966
+ eventValue = "disconnected";
25967
+ }
25968
+ telemetryRecorder.recordEvent("cody.auth", eventValue);
25969
+ const hasAuthedBefore = localStorage.get(HAS_AUTHENTICATED_BEFORE_KEY) || false;
25970
+ if (!hasAuthedBefore && authStatus2.authenticated) {
25971
+ telemetryRecorder.recordEvent("cody.auth.login", "firstEver", {
25972
+ billingMetadata: {
25973
+ product: "cody",
25974
+ category: "billable"
25975
+ }
25976
+ });
25977
+ localStorage.set(HAS_AUTHENTICATED_BEFORE_KEY, "true");
25978
+ }
26001
25979
  }
26002
- setHasAuthenticatedBefore() {
26003
- return localStorage.set(HAS_AUTHENTICATED_BEFORE_KEY, "true");
25980
+ toCredentialsOnlyNormalized(config) {
25981
+ return {
25982
+ configuration: {
25983
+ customHeaders: config.configuration.customHeaders
25984
+ },
25985
+ auth: {
25986
+ ...config.auth,
25987
+ serverEndpoint: config.auth.serverEndpoint ? normalizeServerEndpointURL(config.auth.serverEndpoint) : void 0
25988
+ },
25989
+ clientState: { anonymousUserID: config.clientState.anonymousUserID }
25990
+ };
25991
+ }
25992
+ async getCurrentConfig() {
25993
+ return await currentResolvedConfig();
25994
+ }
25995
+ dispose() {
25996
+ for (const subscription of this.subscriptions) {
25997
+ subscription.unsubscribe();
25998
+ }
25999
+ }
26000
+ async refresh() {
26001
+ this.lastValidated = { credentials: null, auth: null };
26002
+ const config = await this.getCurrentConfig();
26003
+ await this.validateAndStoreCredentials(config, "store-if-valid");
26004
+ }
26005
+ signout(endpoint) {
26006
+ if (localStorage.getEndpoint() === endpoint) {
26007
+ this.lastValidated = { credentials: null, auth: null };
26008
+ this.status.next({
26009
+ authenticated: false,
26010
+ endpoint,
26011
+ pendingValidation: false
26012
+ });
26013
+ }
26014
+ }
26015
+ setAuthPendingToEndpoint(endpoint) {
26016
+ this.status.next({ authenticated: false, endpoint, pendingValidation: true });
26004
26017
  }
26005
26018
  // When the auth status is updated, we serialize the current configuration to disk,
26006
26019
  // so that it can be sent with Telemetry when the post-uninstall script runs.
@@ -26027,52 +26040,7 @@ class AuthProvider {
26027
26040
  }
26028
26041
  }
26029
26042
  const authProvider = new AuthProvider();
26030
- function startAuthTelemetryReporter() {
26031
- return authStatus.subscribe((authStatus2) => {
26032
- reportAuthTelemetryEvent(authStatus2);
26033
- });
26034
- }
26035
- function reportAuthTelemetryEvent(authStatus2) {
26036
- if (authStatus2.pendingValidation) {
26037
- return;
26038
- }
26039
- let eventValue;
26040
- if (!authStatus2.authenticated && (isAvailabilityError(authStatus2.error) || isInvalidAccessTokenError(authStatus2.error))) {
26041
- eventValue = "failed";
26042
- } else if (authStatus2.authenticated) {
26043
- eventValue = "connected";
26044
- } else {
26045
- eventValue = "disconnected";
26046
- }
26047
- telemetryRecorder.recordEvent("cody.auth", eventValue);
26048
- }
26049
- function toCredentialsOnlyNormalized(config) {
26050
- return {
26051
- configuration: {
26052
- customHeaders: config.configuration.customHeaders
26053
- },
26054
- auth: { ...config.auth, serverEndpoint: normalizeServerEndpointURL(config.auth.serverEndpoint) },
26055
- clientState: { anonymousUserID: config.clientState.anonymousUserID }
26056
- };
26057
- }
26058
26043
  let runningAuthProgressIndicator = null;
26059
- function startAuthProgressIndicator() {
26060
- window$1.withProgress(
26061
- {
26062
- location: ProgressLocation.Notification,
26063
- title: "Signing in to Sourcegraph...",
26064
- cancellable: true
26065
- },
26066
- (progress, token) => {
26067
- token.onCancellationRequested(() => {
26068
- runningAuthProgressIndicator = null;
26069
- });
26070
- return new Promise((resolve) => {
26071
- runningAuthProgressIndicator = resolve;
26072
- });
26073
- }
26074
- );
26075
- }
26076
26044
  function closeAuthProgressIndicator() {
26077
26045
  runningAuthProgressIndicator == null ? void 0 : runningAuthProgressIndicator();
26078
26046
  runningAuthProgressIndicator = null;
@@ -26092,7 +26060,7 @@ async function showEnterpriseInstanceUrlFlow(endpoint) {
26092
26060
  await showAuthResultMessage(endpoint, authStatus2);
26093
26061
  }
26094
26062
  }
26095
- async function showSignInMenu(type, uri) {
26063
+ async function showSignInMenu() {
26096
26064
  const authStatus2 = currentAuthStatus();
26097
26065
  const mode = authStatus2.authenticated ? "switch" : "signin";
26098
26066
  logDebug("AuthProvider:signinMenu", mode);
@@ -26119,9 +26087,6 @@ async function showSignInMenu(type, uri) {
26119
26087
  redirectToEndpointLogin(instanceUrl);
26120
26088
  break;
26121
26089
  }
26122
- case "dotcom":
26123
- redirectToEndpointLogin(DOTCOM_URL.href);
26124
- break;
26125
26090
  case "token": {
26126
26091
  const instanceUrl = await showInstanceURLInputBox(item.uri);
26127
26092
  if (!instanceUrl) {
@@ -26134,18 +26099,18 @@ async function showSignInMenu(type, uri) {
26134
26099
  const selectedEndpoint = item.uri;
26135
26100
  const { configuration } = await currentResolvedConfig();
26136
26101
  const auth2 = await resolveAuth(selectedEndpoint, configuration, secretStorage);
26137
- let authStatus22 = await authProvider.validateAndStoreCredentials(auth2, "store-if-valid");
26138
- if (!(authStatus22 == null ? void 0 : authStatus22.authenticated) && isInvalidAccessTokenError(authStatus22.error)) {
26102
+ let authStatus3 = await authProvider.validateAndStoreCredentials(auth2, "store-if-valid");
26103
+ if (!(authStatus3 == null ? void 0 : authStatus3.authenticated) && isInvalidAccessTokenError(authStatus3.error)) {
26139
26104
  const token = await showAccessTokenInputBox(selectedEndpoint);
26140
26105
  if (!token) {
26141
26106
  return;
26142
26107
  }
26143
- authStatus22 = await authProvider.validateAndStoreCredentials(
26108
+ authStatus3 = await authProvider.validateAndStoreCredentials(
26144
26109
  { serverEndpoint: selectedEndpoint, credentials: { token, source: "paste" } },
26145
26110
  "store-if-valid"
26146
26111
  );
26147
26112
  }
26148
- await showAuthResultMessage(selectedEndpoint, authStatus22);
26113
+ await showAuthResultMessage(selectedEndpoint, authStatus3);
26149
26114
  logDebug("AuthProvider:signinMenu", mode, selectedEndpoint);
26150
26115
  }
26151
26116
  }
@@ -26371,10 +26336,11 @@ async function signOut(endpoint) {
26371
26336
  }
26372
26337
  );
26373
26338
  authProvider.signout(endpoint);
26374
- await Promise.all([secretStorage.deleteToken(endpoint), localStorage.deleteEndpoint(endpoint)]);
26339
+ await firstResultFromOperation(authStatus.filter((status) => status.authenticated === false));
26340
+ await localStorage.deleteEndpointAndToken(endpoint);
26375
26341
  }
26376
- async function validateCredentials(config, signal2, clientConfig) {
26377
- var _a3, _b2;
26342
+ async function validateCredentials(config) {
26343
+ var _a3;
26378
26344
  if (config.auth.error !== void 0) {
26379
26345
  logDebug(
26380
26346
  "auth",
@@ -26388,6 +26354,13 @@ async function validateCredentials(config, signal2, clientConfig) {
26388
26354
  error: new AuthConfigError(((_a3 = config.auth.error) == null ? void 0 : _a3.message) ?? config.auth.error)
26389
26355
  };
26390
26356
  }
26357
+ if (!config.auth.serverEndpoint || isDotCom(config.auth.serverEndpoint) || isWorkspaceInstance(config.auth.serverEndpoint)) {
26358
+ return {
26359
+ authenticated: false,
26360
+ endpoint: config.auth.serverEndpoint,
26361
+ pendingValidation: false
26362
+ };
26363
+ }
26391
26364
  if (!config.auth.credentials && !clientCapabilities().isCodyWeb) {
26392
26365
  return { authenticated: false, endpoint: config.auth.serverEndpoint, pendingValidation: false };
26393
26366
  }
@@ -26402,8 +26375,7 @@ async function validateCredentials(config, signal2, clientConfig) {
26402
26375
  };
26403
26376
  const client = SourcegraphGraphQLAPIClient.withStaticConfig(apiClientConfig);
26404
26377
  try {
26405
- const userInfo = await client.getCurrentUserInfo(signal2);
26406
- signal2 == null ? void 0 : signal2.throwIfAborted();
26378
+ const userInfo = await client.getCurrentUserInfo();
26407
26379
  if (isError$3(userInfo)) {
26408
26380
  if (isExternalProviderAuthError(userInfo)) {
26409
26381
  logDebug("auth", userInfo.message);
@@ -26442,24 +26414,6 @@ async function validateCredentials(config, signal2, clientConfig) {
26442
26414
  pendingValidation: false
26443
26415
  };
26444
26416
  }
26445
- if (isDotCom(config.auth.serverEndpoint)) {
26446
- if (!clientConfig) {
26447
- clientConfig = await ClientConfigSingleton.getInstance().fetchConfigWithToken(
26448
- apiClientConfig,
26449
- signal2
26450
- );
26451
- }
26452
- if (clientConfig == null ? void 0 : clientConfig.userShouldUseEnterprise) {
26453
- return {
26454
- authenticated: false,
26455
- endpoint: config.auth.serverEndpoint,
26456
- pendingValidation: false,
26457
- error: new EnterpriseUserDotComError(
26458
- getEnterpriseName(((_b2 = userInfo.primaryEmail) == null ? void 0 : _b2.email) || "")
26459
- )
26460
- };
26461
- }
26462
- }
26463
26417
  logDebug("auth", `Authentication succeed to endpoint ${config.auth.serverEndpoint}`);
26464
26418
  return newAuthStatus({
26465
26419
  ...userInfo,
@@ -26471,34 +26425,30 @@ async function validateCredentials(config, signal2, clientConfig) {
26471
26425
  client.dispose();
26472
26426
  }
26473
26427
  }
26474
- function getEnterpriseName(email) {
26475
- const domain = email.split("@")[1];
26476
- const name2 = domain.split(".")[0];
26477
- return name2.charAt(0).toUpperCase() + name2.slice(1);
26478
- }
26479
26428
  async function requestEndpointSettingsDeliveryToSearchPlugin() {
26480
26429
  const searchExtension = extensions.all.find(
26481
26430
  ({ packageJSON }) => ["sourcegraph.@sourcegraph/vscode", "sourcegraph.sourcegraph"].includes(packageJSON.id)
26482
26431
  );
26483
26432
  const config = await firstResultFromOperation(resolvedConfig);
26433
+ const endpoint = config.auth.serverEndpoint;
26434
+ if (!endpoint) {
26435
+ return "";
26436
+ }
26484
26437
  searchExtension == null ? void 0 : searchExtension.activate().then(async () => {
26485
26438
  var _a3;
26486
26439
  const commandId = "sourcegraph.setEndpointSettings";
26487
26440
  const commands2 = (_a3 = searchExtension.packageJSON.contributes) == null ? void 0 : _a3.commands;
26488
26441
  if (Array.isArray(commands2)) {
26489
26442
  if (commands2.find(({ command }) => command === commandId)) {
26490
- const authHeaders = await getAuthHeaders(
26491
- config.auth,
26492
- new URL(config.auth.serverEndpoint)
26493
- );
26443
+ const authHeaders = await getAuthHeaders(config.auth, new URL(endpoint));
26494
26444
  commands$1.executeCommand(commandId, {
26495
- instanceUrl: config.auth.serverEndpoint,
26445
+ instanceUrl: endpoint,
26496
26446
  headers: authHeaders
26497
26447
  });
26498
26448
  }
26499
26449
  }
26500
26450
  });
26501
- return config.auth.serverEndpoint;
26451
+ return endpoint;
26502
26452
  }
26503
26453
  class ChatHistoryManager {
26504
26454
  constructor() {
@@ -26755,10 +26705,11 @@ async function readIgnoreFile(uri) {
26755
26705
  if (line.endsWith("/")) {
26756
26706
  line = line.slice(0, -1);
26757
26707
  }
26758
- if (!line.startsWith("/") && !line.startsWith("**/")) {
26759
- line = `**/${line}`;
26708
+ if (!line.includes("*") && !line.includes("/") && !line.includes(".")) {
26709
+ ignore[`${line}/**`] = true;
26710
+ } else {
26711
+ ignore[line] = true;
26760
26712
  }
26761
- ignore[line] = true;
26762
26713
  }
26763
26714
  } catch (error) {
26764
26715
  }
@@ -34614,12 +34565,6 @@ class SentryService {
34614
34565
  debug: !isProd,
34615
34566
  // Only send errors when connected to dotcom in the production build.
34616
34567
  beforeSend: (event2, hint) => {
34617
- if (isProd && isDotCom(auth2.serverEndpoint) && shouldErrorBeReported(
34618
- hint.originalException,
34619
- !!configuration.isRunningInsideAgent
34620
- )) {
34621
- return event2;
34622
- }
34623
34568
  return null;
34624
34569
  }
34625
34570
  };
@@ -36433,11 +36378,6 @@ class RepoNameResolver {
36433
36378
  authStatus
36434
36379
  ).pipe(
36435
36380
  switchMapReplayOperation(([remoteUrls, authStatus2]) => {
36436
- if (isDotCom(authStatus2)) {
36437
- return Observable.of(
36438
- remoteUrls.map(convertGitCloneURLToCodebaseName).filter(isDefined)
36439
- );
36440
- }
36441
36381
  if (remoteUrls.length === 0) {
36442
36382
  return Observable.of([]);
36443
36383
  }
@@ -37651,200 +37591,6 @@ class PersistenceTracker {
37651
37591
  }
37652
37592
  }
37653
37593
  }
37654
- const MAX_REPO_COUNT = 10;
37655
- const workspaceFolders = fromVSCodeEvent(
37656
- workspace.onDidChangeWorkspaceFolders
37657
- ).pipe(
37658
- startWith$1(void 0),
37659
- map$1(() => workspace.workspaceFolders)
37660
- );
37661
- const remoteReposForAllWorkspaceFolders = combineLatest$1(
37662
- workspaceFolders.pipe(
37663
- // The vscode.git extension has a delay before we can fetch a workspace folder's remote.
37664
- debounceTime(vscodeGitAPI ? 2e3 : 0)
37665
- ),
37666
- authStatus
37667
- ).pipe(
37668
- switchMapReplayOperation(
37669
- ([workspaceFolders2]) => {
37670
- if (!workspaceFolders2 || workspaceFolders2.length === 0) {
37671
- return Observable.of([]);
37672
- }
37673
- return combineLatest$1(
37674
- ...workspaceFolders2.map((folder2) => repoNameResolver.getRepoNamesContainingUri(folder2.uri))
37675
- ).pipe(
37676
- map$1((repoNamesLists) => {
37677
- const completedResults = repoNamesLists.filter((names) => Array.isArray(names)).flat().filter((name2) => typeof name2 === "string");
37678
- return completedResults.length > 0 ? completedResults : [];
37679
- }),
37680
- abortableOperation(async (repoNames, signal2) => {
37681
- if (repoNames.length === 0) {
37682
- return [];
37683
- }
37684
- const reposOrError = await graphqlClient.getRepoIds(
37685
- repoNames,
37686
- MAX_REPO_COUNT,
37687
- signal2
37688
- );
37689
- if (isError$3(reposOrError)) {
37690
- throw reposOrError;
37691
- }
37692
- return reposOrError;
37693
- })
37694
- );
37695
- }
37696
- )
37697
- );
37698
- async function remoteReposForWorkspaceFolder(folder2) {
37699
- return firstValueFrom$1(
37700
- repoNameResolver.getRepoNamesContainingUri(folder2.uri).pipe(skipPendingOperation())
37701
- );
37702
- }
37703
- async function workspaceFolderForRepo(repoName) {
37704
- for (const folder2 of workspace.workspaceFolders ?? []) {
37705
- const remoteRepos = await remoteReposForWorkspaceFolder(folder2);
37706
- if (remoteRepos.some((remoteRepo) => remoteRepo === repoName)) {
37707
- return folder2;
37708
- }
37709
- }
37710
- return void 0;
37711
- }
37712
- const _GitHubDotComRepoMetadata = class _GitHubDotComRepoMetadata {
37713
- constructor() {
37714
- __publicField2(this, "cache", /* @__PURE__ */ new Map());
37715
- this.cache.clear();
37716
- const localStorageData = localStorage.getGitHubRepoAccessibility();
37717
- for (const data of localStorageData) {
37718
- this.cache.set(data.repoName, data);
37719
- }
37720
- }
37721
- static getInstance() {
37722
- if (!_GitHubDotComRepoMetadata.instance) {
37723
- _GitHubDotComRepoMetadata.instance = new _GitHubDotComRepoMetadata();
37724
- }
37725
- return _GitHubDotComRepoMetadata.instance;
37726
- }
37727
- getRepoMetadataIfCached(repoBaseName) {
37728
- const normalizedRepoName = this.getNormalizedRepoNameFromBaseRepoName(repoBaseName);
37729
- if (!normalizedRepoName) {
37730
- return void 0;
37731
- }
37732
- return this.cache.get(normalizedRepoName);
37733
- }
37734
- async getRepoMetadataUsingRepoName(repoBaseName, signal2) {
37735
- const repoMetadata = this.getRepoMetadataIfCached(repoBaseName);
37736
- if (repoMetadata) {
37737
- return repoMetadata;
37738
- }
37739
- const repoMetaData = await this.ghMetadataFromGit(repoBaseName, signal2);
37740
- if (repoMetaData) {
37741
- this.updateCachedDataToLocalStorageIfNeeded(repoMetaData);
37742
- }
37743
- return repoMetaData;
37744
- }
37745
- async ghMetadataFromGit(repoBaseName, signal2) {
37746
- const ownerAndRepoName = this.parseOwnerAndRepoName(repoBaseName);
37747
- if (!ownerAndRepoName) {
37748
- return void 0;
37749
- }
37750
- const repoMetaData = await this.queryGitHubApi(
37751
- ownerAndRepoName.owner,
37752
- ownerAndRepoName.repoName,
37753
- signal2
37754
- );
37755
- return repoMetaData;
37756
- }
37757
- async queryGitHubApi(owner2, repoName, signal2) {
37758
- const apiUrl = `https://api.github.com/repos/${owner2}/${repoName}`;
37759
- const normalizedRepoName = this.getNormalizedRepoNameFromOwnerAndRepoName(owner2, repoName);
37760
- const metadata2 = { repoName: normalizedRepoName, isPublic: false, timestamp: Date.now() };
37761
- try {
37762
- const response = await fetch(apiUrl, { method: "HEAD", signal: signal2 });
37763
- metadata2.isPublic = response.ok;
37764
- } catch (error) {
37765
- if (!isAbortError(error)) {
37766
- logDebug(
37767
- "queryGitHubApi",
37768
- "error querying GitHub API (assuming repository is non-public",
37769
- `${owner2}/${repoName}`,
37770
- error
37771
- );
37772
- }
37773
- }
37774
- return metadata2;
37775
- }
37776
- getNormalizedRepoNameFromBaseRepoName(repoBaseName) {
37777
- const ownerAndRepoName = this.parseOwnerAndRepoName(repoBaseName);
37778
- if (!ownerAndRepoName) {
37779
- return void 0;
37780
- }
37781
- return this.getNormalizedRepoNameFromOwnerAndRepoName(
37782
- ownerAndRepoName.owner,
37783
- ownerAndRepoName.repoName
37784
- );
37785
- }
37786
- getNormalizedRepoNameFromOwnerAndRepoName(owner2, repoName) {
37787
- return `github.com/${owner2}/${repoName}`;
37788
- }
37789
- parseOwnerAndRepoName(repoBaseName) {
37790
- const match2 = repoBaseName == null ? void 0 : repoBaseName.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);
37791
- if (!match2) {
37792
- return void 0;
37793
- }
37794
- const [, owner2, repoName] = match2;
37795
- return { owner: owner2, repoName };
37796
- }
37797
- updateCachedDataToLocalStorageIfNeeded(repoMetaData) {
37798
- var _a3;
37799
- if (((_a3 = this.cache.get(repoMetaData.repoName)) == null ? void 0 : _a3.isPublic) === repoMetaData.isPublic) {
37800
- return;
37801
- }
37802
- this.cache.set(repoMetaData.repoName, repoMetaData);
37803
- const repoAccessibilityData = Array.from(this.cache.values()).filter(isDefined);
37804
- localStorage.setGitHubRepoAccessibility(repoAccessibilityData);
37805
- }
37806
- };
37807
- // This class is used to get the metadata from the gitApi.
37808
- __publicField2(_GitHubDotComRepoMetadata, "instance", null);
37809
- let GitHubDotComRepoMetadata = _GitHubDotComRepoMetadata;
37810
- const NO_PUBLIC_METADATA = { isPublic: false, repoMetadata: void 0 };
37811
- const publicRepoMetadataIfAllWorkspaceReposArePublic = remoteReposForAllWorkspaceFolders.pipe(
37812
- map$1((remoteRepos) => isError$3(remoteRepos) ? [] : remoteRepos),
37813
- switchMap$1((remoteRepos) => {
37814
- if (remoteRepos === pendingOperation) {
37815
- return Observable.of(pendingOperation);
37816
- }
37817
- if (remoteRepos.length === 0) {
37818
- return Observable.of(NO_PUBLIC_METADATA);
37819
- }
37820
- return combineLatest$1(
37821
- ...remoteRepos.map(
37822
- (remoteRepo) => promiseFactoryToObservable(
37823
- (signal2) => (
37824
- // This is cached, so it's fast.
37825
- GitHubDotComRepoMetadata.getInstance().getRepoMetadataUsingRepoName(
37826
- remoteRepo.name,
37827
- signal2
37828
- )
37829
- )
37830
- )
37831
- )
37832
- ).pipe(
37833
- map$1((repoMetadatas) => {
37834
- const allReposArePublic = repoMetadatas.length >= 1 && repoMetadatas.every((repoMetadata) => (repoMetadata == null ? void 0 : repoMetadata.isPublic) ?? false);
37835
- return allReposArePublic ? { isPublic: true, repoMetadata: repoMetadatas.filter(isDefined) } : NO_PUBLIC_METADATA;
37836
- }),
37837
- catchError$1((error) => {
37838
- logDebug(
37839
- "publicRepoMetadataIfAllWorkspaceReposArePublic",
37840
- "error getting repository metadata",
37841
- error
37842
- );
37843
- return Observable.of(NO_PUBLIC_METADATA);
37844
- })
37845
- );
37846
- })
37847
- );
37848
37594
  const executeSmartApply = async (args2) => {
37849
37595
  return commands$1.executeCommand("cody.command.smart-apply", args2);
37850
37596
  };
@@ -38016,7 +37762,7 @@ async function getSmartApplyModel(authStatus2) {
38016
37762
  if (isInstantModeEnabled) {
38017
37763
  return SMART_APPLY_MODEL_IDENTIFIERS.FireworksQwenCodeDefault;
38018
37764
  }
38019
- if (isDotCom(authStatus2) || isS2(authStatus2)) {
37765
+ if (isS2(authStatus2)) {
38020
37766
  const defaultModel = "anthropic::2024-10-22::claude-3-5-sonnet-latest";
38021
37767
  return defaultModel;
38022
37768
  }
@@ -38447,17 +38193,6 @@ class UpstreamHealthProvider {
38447
38193
  span2.setAttribute("sampled", true);
38448
38194
  return measureLatencyToUri(upstreamHeaders, url.toString());
38449
38195
  });
38450
- if (isDotCom(auth2.serverEndpoint)) {
38451
- const gatewayHeaders = new Headers(sharedHeaders);
38452
- const uri = "https://cody-gateway.sourcegraph.com/-/__version";
38453
- const gatewayResult = await wrapInActiveSpan("upstream-latency.gateway", (span2) => {
38454
- span2.setAttribute("sampled", true);
38455
- return measureLatencyToUri(gatewayHeaders, uri);
38456
- });
38457
- if (!("error" in gatewayResult)) {
38458
- this.lastGatewayLatency = gatewayResult.latency;
38459
- }
38460
- }
38461
38196
  if ("error" in upstreamResult) {
38462
38197
  this.lastUpstreamLatency = void 0;
38463
38198
  logDebug$1("UpstreamHealth", "Failed to ping upstream host", {
@@ -38557,37 +38292,6 @@ class AutocompleteStageCounter {
38557
38292
  }
38558
38293
  }
38559
38294
  new AutocompleteStageCounter();
38560
- class GitMetadataForCurrentEditor {
38561
- constructor() {
38562
- __publicField2(this, "gitIdentifiersForFile");
38563
- window$1.onDidChangeActiveTextEditor(() => this.updateStatus());
38564
- }
38565
- getGitIdentifiersForFile() {
38566
- if (this.gitIdentifiersForFile === void 0) {
38567
- this.updateStatus().catch(() => {
38568
- });
38569
- }
38570
- return this.gitIdentifiersForFile;
38571
- }
38572
- async updateStatus() {
38573
- var _a3, _b2, _c2;
38574
- let newGitIdentifiersForFile = void 0;
38575
- const currentFile = (_c2 = (_b2 = (_a3 = getEditor()) == null ? void 0 : _a3.active) == null ? void 0 : _b2.document) == null ? void 0 : _c2.uri;
38576
- if (currentFile) {
38577
- const repoName = currentFile ? (await firstResultFromOperation(
38578
- repoNameResolver.getRepoNamesContainingUri(currentFile)
38579
- )).at(0) : void 0;
38580
- const commit2 = gitCommitIdFromGitExtension(currentFile);
38581
- newGitIdentifiersForFile = {
38582
- filePath: displayPathWithoutWorkspaceFolderPrefix(currentFile),
38583
- repoName,
38584
- commit: commit2
38585
- };
38586
- }
38587
- this.gitIdentifiersForFile = newGitIdentifiersForFile;
38588
- }
38589
- }
38590
- const gitMetadataForCurrentEditor = new GitMetadataForCurrentEditor();
38591
38295
  function getLanguageConfig(languageId) {
38592
38296
  switch (languageId) {
38593
38297
  case "astro":
@@ -39799,7 +39503,7 @@ const MODEL_PROVIDER_ICONS = {
39799
39503
  google: "$(gemini-logo)"
39800
39504
  };
39801
39505
  const getModelProviderIcon = (provider) => MODEL_PROVIDER_ICONS[provider.toLowerCase()] || "$(cody-logo)";
39802
- const getModelOptionItems = (modelOptions, isCodyPro, isEnterpriseUser2) => {
39506
+ const getModelOptionItems = (modelOptions) => {
39803
39507
  const allOptions = modelOptions.map((modelOption) => {
39804
39508
  const icon = getModelProviderIcon(modelOption.provider);
39805
39509
  const title = modelOption.title || modelOption.id;
@@ -39808,17 +39512,13 @@ const getModelOptionItems = (modelOptions, isCodyPro, isEnterpriseUser2) => {
39808
39512
  description: `by ${modelOption.provider}`,
39809
39513
  alwaysShow: true,
39810
39514
  model: modelOption.id,
39811
- modelTitle: title,
39812
- codyProOnly: isCodyProModel(modelOption) && !isEnterpriseUser2
39515
+ modelTitle: title
39813
39516
  };
39814
39517
  }).filter(isDefined);
39815
- if (!isCodyPro && !isEnterpriseUser2) {
39816
- return allOptions.filter((option2) => !option2.codyProOnly);
39817
- }
39818
39518
  return allOptions;
39819
39519
  };
39820
- const getModelInputItems = (modelOptions, activeModel, isCodyPro, isEnterpriseUser2) => {
39821
- const modelItems = getModelOptionItems(modelOptions, isCodyPro, isEnterpriseUser2);
39520
+ const getModelInputItems = (modelOptions, activeModel) => {
39521
+ const modelItems = getModelOptionItems(modelOptions);
39822
39522
  const activeItem = modelItems.find((item) => item.model === activeModel);
39823
39523
  if (activeItem) {
39824
39524
  activeItem.label = activeItem.label.replace(
@@ -40939,21 +40639,10 @@ const _ChatBuilder = class _ChatBuilder {
40939
40639
  */
40940
40640
  static resolvedModelForChat(chat2) {
40941
40641
  return (chat2 instanceof Observable ? chat2 : chat2.changes).pipe(
40942
- map$1((chat22) => chat22.selectedModel),
40943
- distinctUntilChanged$1(),
40944
40642
  switchMap$1(
40945
- (selectedModel) => selectedModel ? modelsService.isModelAvailable(selectedModel).pipe(
40946
- switchMap$1((isModelAvailable) => {
40947
- if (isModelAvailable) {
40948
- return Observable.of(selectedModel);
40949
- }
40950
- if (chat2 instanceof _ChatBuilder) {
40951
- chat2.setSelectedModel(void 0);
40952
- }
40953
- return modelsService.getDefaultChatModel();
40954
- })
40955
- ) : modelsService.getDefaultChatModel()
40956
- )
40643
+ (chat22) => chat22.selectedModel ? Observable.of(chat22.selectedModel) : modelsService.getDefaultChatModel()
40644
+ ),
40645
+ distinctUntilChanged$1()
40957
40646
  );
40958
40647
  }
40959
40648
  /**
@@ -41555,9 +41244,7 @@ class EditInputFlow {
41555
41244
  __publicField2(this, "selectedContextItems", /* @__PURE__ */ new Map());
41556
41245
  __publicField2(this, "contextItems", /* @__PURE__ */ new Map());
41557
41246
  __publicField2(this, "textDocumentListener");
41558
- __publicField2(this, "modelAvailability", []);
41559
- __publicField2(this, "isCodyPro", false);
41560
- __publicField2(this, "isEnterpriseUser", false);
41247
+ __publicField2(this, "models", []);
41561
41248
  __publicField2(this, "onTitleChangeCallback");
41562
41249
  this.document = document2;
41563
41250
  this.editInput = editInput;
@@ -41586,14 +41273,10 @@ class EditInputFlow {
41586
41273
  });
41587
41274
  }
41588
41275
  async init() {
41589
- const sub2 = await currentUserProductSubscription();
41590
- this.isEnterpriseUser = await checkIfEnterpriseUser();
41591
- this.isCodyPro = Boolean(sub2 && !sub2.userCanUpgrade);
41592
- this.modelAvailability = await modelsService.getModelsAvailabilityStatus(ModelUsage.Edit);
41593
- const modelOptions = this.modelAvailability.map((it) => it.model);
41594
- this.modelItems = getModelOptionItems(modelOptions, this.isCodyPro, this.isEnterpriseUser);
41276
+ this.models = await firstResultFromOperation(modelsService.getModels(ModelUsage.Edit));
41277
+ this.modelItems = getModelOptionItems(this.models);
41595
41278
  this.activeModelItem = this.modelItems.find((item) => item.model === this.activeModel);
41596
- this.showModelSelector = modelOptions.length > 1;
41279
+ this.showModelSelector = this.models.length > 1;
41597
41280
  this.rulesToApply = this.editInput.rules ?? await firstValueFrom$1(ruleService.rulesForPaths([this.document.uri]));
41598
41281
  this.editor.revealRange(this.activeRange, TextEditorRevealType.InCenterIfOutsideViewport);
41599
41282
  }
@@ -41607,12 +41290,7 @@ class EditInputFlow {
41607
41290
  );
41608
41291
  }
41609
41292
  getModelInputItems() {
41610
- return getModelInputItems(
41611
- this.modelAvailability.map((it) => it.model),
41612
- this.activeModel,
41613
- this.isCodyPro,
41614
- this.isEnterpriseUser
41615
- );
41293
+ return getModelInputItems(this.models, this.activeModel);
41616
41294
  }
41617
41295
  getRangeSymbolInputItems() {
41618
41296
  return getRangeSymbolInputItems(this.activeRange.start, this.symbolsPromise);
@@ -41626,7 +41304,7 @@ class EditInputFlow {
41626
41304
  );
41627
41305
  }
41628
41306
  getAvailableModels() {
41629
- return this.modelAvailability;
41307
+ return this.models;
41630
41308
  }
41631
41309
  getContextWindowForModel(model2) {
41632
41310
  var _a3;
@@ -41670,9 +41348,6 @@ class EditInputFlow {
41670
41348
  )}`
41671
41349
  );
41672
41350
  }
41673
- if (item.codyProOnly && !this.isCodyPro && !this.isEnterpriseUser) {
41674
- return { requiresUpgrade: true, modelTitle: item.modelTitle };
41675
- }
41676
41351
  try {
41677
41352
  await modelsService.setSelectedModel(ModelUsage.Edit, item.model);
41678
41353
  } catch (e) {
@@ -44420,11 +44095,9 @@ function registerNativeWebviewHandlers(agent2, webviewBundleLocalPrefix, config)
44420
44095
  );
44421
44096
  webviewProtocolDelegate.registerWebview(panel2.handle, {
44422
44097
  didReceiveMessage(message) {
44423
- console.log("[Cody] webviewProtocolDelegate didReceiveMessage");
44424
44098
  panel2.webview.didReceiveMessageEmitter.fire(message);
44425
44099
  },
44426
44100
  didDispose() {
44427
- console.log("[Cody] webviewProtocolDelegate didDispose");
44428
44101
  panel2.didDispose();
44429
44102
  }
44430
44103
  });
@@ -44555,12 +44228,10 @@ class NativeWebviewPanel {
44555
44228
  this.delegate.reveal(this.handle, viewColumn, preserveFocus);
44556
44229
  }
44557
44230
  dispose() {
44558
- console.log("[Cody] dispose weview panel");
44559
44231
  this.delegate.dispose(this.handle);
44560
44232
  }
44561
44233
  // Called when the client disposes the webview.
44562
44234
  didDispose() {
44563
- console.log("[Cody] didDispose weview panel");
44564
44235
  this.disposeEmitter.fire();
44565
44236
  }
44566
44237
  }
@@ -45610,7 +45281,7 @@ class AgentGlobalState {
45610
45281
  }
45611
45282
  async reset() {
45612
45283
  this.db.clear();
45613
- await localStorage.delete("");
45284
+ localStorage.resetCache();
45614
45285
  }
45615
45286
  keys() {
45616
45287
  if (this.manager === "server") {
@@ -45959,7 +45630,7 @@ class Agent extends MessageHandler {
45959
45630
  this.params = params;
45960
45631
  setAgent(this);
45961
45632
  this.registerRequest("initialize", async (clientInfo) => {
45962
- var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m, _n;
45633
+ var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2;
45963
45634
  languages$1.registerFoldingRangeProvider(
45964
45635
  "*",
45965
45636
  new IndentationBasedFoldingRangeProvider()
@@ -45998,12 +45669,7 @@ class Agent extends MessageHandler {
45998
45669
  (codeLensProvider) => this.codeLens.removeProvider(codeLensProvider)
45999
45670
  );
46000
45671
  }
46001
- if (((_f2 = clientInfo.capabilities) == null ? void 0 : _f2.ignore) === "enabled") {
46002
- contextFiltersProvider.onContextFiltersChanged(() => {
46003
- this.notify("ignore/didChange", null);
46004
- });
46005
- }
46006
- if (((_g2 = clientInfo.capabilities) == null ? void 0 : _g2.authentication) === "enabled") {
45672
+ if (((_f2 = clientInfo.capabilities) == null ? void 0 : _f2.authentication) === "enabled") {
46007
45673
  this.authenticationHandler = new AgentAuthHandler();
46008
45674
  }
46009
45675
  if (define_process_default$8.env.CODY_DEBUG === "true") {
@@ -46015,8 +45681,8 @@ class Agent extends MessageHandler {
46015
45681
  setClientInfo(clientInfo);
46016
45682
  this.clientInfo = clientInfo;
46017
45683
  try {
46018
- const secrets = ((_h2 = clientInfo.capabilities) == null ? void 0 : _h2.secrets) === "client-managed" ? new AgentClientManagedSecretStorage(this, this.secretsDidChange) : new AgentStatelessSecretStorage({
46019
- [formatURL(((_i2 = clientInfo.extensionConfiguration) == null ? void 0 : _i2.serverEndpoint) ?? "") ?? ""]: ((_j2 = clientInfo.extensionConfiguration) == null ? void 0 : _j2.accessToken) ?? void 0
45684
+ const secrets = ((_g2 = clientInfo.capabilities) == null ? void 0 : _g2.secrets) === "client-managed" ? new AgentClientManagedSecretStorage(this, this.secretsDidChange) : new AgentStatelessSecretStorage({
45685
+ [formatURL(((_h2 = clientInfo.extensionConfiguration) == null ? void 0 : _h2.serverEndpoint) ?? "") ?? ""]: ((_i2 = clientInfo.extensionConfiguration) == null ? void 0 : _i2.accessToken) ?? void 0
46020
45686
  });
46021
45687
  await initializeVscodeExtension(
46022
45688
  params.extensionActivate,
@@ -46024,10 +45690,8 @@ class Agent extends MessageHandler {
46024
45690
  this.globalState,
46025
45691
  secrets
46026
45692
  );
46027
- const ideType = AgentWorkspaceConfiguration.clientNameToIDE(((_k2 = this.clientInfo) == null ? void 0 : _k2.name) ?? "");
46028
- const forceAuthentication = !!clientInfo.extensionConfiguration && (!!((_l2 = clientInfo.extensionConfiguration) == null ? void 0 : _l2.accessToken) || ideType === CodyIDE.Web);
46029
- const webviewKind = ((_m = clientInfo.capabilities) == null ? void 0 : _m.webview) || "agentic";
46030
- const nativeWebviewConfig = (_n = clientInfo.capabilities) == null ? void 0 : _n.webviewNativeConfig;
45693
+ const webviewKind = ((_j2 = clientInfo.capabilities) == null ? void 0 : _j2.webview) || "agentic";
45694
+ const nativeWebviewConfig = (_k2 = clientInfo.capabilities) == null ? void 0 : _k2.webviewNativeConfig;
46031
45695
  if (webviewKind === "native") {
46032
45696
  if (!nativeWebviewConfig) {
46033
45697
  throw new Error(
@@ -46042,9 +45706,7 @@ class Agent extends MessageHandler {
46042
45706
  } else {
46043
45707
  this.registerWebviewHandlers();
46044
45708
  }
46045
- const status = clientInfo.extensionConfiguration ? await this.handleConfigChanges(clientInfo.extensionConfiguration, {
46046
- forceAuthentication
46047
- }) : await firstNonPendingAuthStatus();
45709
+ const status = clientInfo.extensionConfiguration ? await this.handleConfigChanges(clientInfo.extensionConfiguration) : await firstNonPendingAuthStatus();
46048
45710
  return {
46049
45711
  name: "cody-agent",
46050
45712
  authenticated: status.authenticated,
@@ -46577,20 +46239,6 @@ class Agent extends MessageHandler {
46577
46239
  }
46578
46240
  throw id;
46579
46241
  });
46580
- this.registerAuthenticatedRequest("graphql/currentUserIsPro", async () => {
46581
- const res = await graphqlClient.getCurrentUserCodyProEnabled();
46582
- if (res instanceof Error) {
46583
- throw res;
46584
- }
46585
- return Boolean(res == null ? void 0 : res.codyProEnabled);
46586
- });
46587
- this.registerAuthenticatedRequest("graphql/getCurrentUserCodySubscription", async () => {
46588
- const res = await graphqlClient.getCurrentUserCodySubscription();
46589
- if (res instanceof Error) {
46590
- throw res;
46591
- }
46592
- return res;
46593
- });
46594
46242
  this.registerAuthenticatedRequest("telemetry/recordEvent", async (event2) => {
46595
46243
  telemetryRecorder.recordEvent(
46596
46244
  // 👷 HACK: We have no control over what gets sent over JSON RPC,
@@ -46744,7 +46392,7 @@ class Agent extends MessageHandler {
46744
46392
  const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
46745
46393
  return {
46746
46394
  readOnly: !(clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled),
46747
- models: await modelsService.getModelsAvailabilityStatus(modelUsage)
46395
+ models: await firstResultFromOperation(modelsService.getModels(modelUsage))
46748
46396
  };
46749
46397
  });
46750
46398
  this.registerAuthenticatedRequest("chat/export", async (input) => {
@@ -46876,17 +46524,6 @@ class Agent extends MessageHandler {
46876
46524
  limitHit: ((_b2 = result == null ? void 0 : result.attribution) == null ? void 0 : _b2.limitHit) || false
46877
46525
  };
46878
46526
  });
46879
- this.registerAuthenticatedRequest("ignore/test", async ({ uri: uriString }) => {
46880
- const uri = Uri.parse(uriString);
46881
- const isIgnored = await contextFiltersProvider.isUriIgnored(uri);
46882
- return {
46883
- policy: isIgnored ? "ignore" : "use"
46884
- };
46885
- });
46886
- this.registerAuthenticatedRequest("testing/ignore/overridePolicy", async (contextFilters) => {
46887
- contextFiltersProvider.setTestingContextFilters(contextFilters);
46888
- return null;
46889
- });
46890
46527
  this.registerAuthenticatedRequest("internal/getAuthHeaders", async (url) => {
46891
46528
  const config = await firstResultFromOperation(resolvedConfig);
46892
46529
  return await getAuthHeaders(config.auth, new URL(url));
@@ -46932,11 +46569,10 @@ class Agent extends MessageHandler {
46932
46569
  var _a3;
46933
46570
  return ((_a3 = this.clientInfo) == null ? void 0 : _a3.capabilities) ?? void 0;
46934
46571
  }
46935
- async handleConfigChanges(config, params) {
46936
- const isAuthChange = isTokenOrEndpointChange(config);
46572
+ async handleConfigChanges(config) {
46937
46573
  setExtensionConfiguration(config);
46938
46574
  try {
46939
- if ((isAuthChange || (params == null ? void 0 : params.forceAuthentication)) && config.serverEndpoint) {
46575
+ if (config.serverEndpoint) {
46940
46576
  await authProvider.validateAndStoreCredentials(
46941
46577
  {
46942
46578
  configuration: {
@@ -46952,7 +46588,6 @@ class Agent extends MessageHandler {
46952
46588
  },
46953
46589
  "always-store"
46954
46590
  );
46955
- await firstResultFromOperation(localStorage.clientStateChanges);
46956
46591
  }
46957
46592
  } catch (error) {
46958
46593
  console.log("Authentication failed", error);
@@ -48255,7 +47890,7 @@ class CommandsProvider {
48255
47890
  if (!isFileURI(uri)) {
48256
47891
  throw new Error("history only supported on local file paths");
48257
47892
  }
48258
- const { getContextFileFromGitLog } = await import("./git-log-7kbEzZhk.mjs");
47893
+ const { getContextFileFromGitLog } = await import("./git-log-Dihxu1-Z.mjs");
48259
47894
  return getContextFileFromGitLog(uri, options);
48260
47895
  }
48261
47896
  dispose() {
@@ -48389,8 +48024,7 @@ const isReinstalling = async () => {
48389
48024
  };
48390
48025
  async function showAccountMenu() {
48391
48026
  const authStatus2 = currentAuthStatusAuthed();
48392
- const sub2 = await currentUserProductSubscription();
48393
- const selected = await openAccountMenuFirstStep(authStatus2, sub2);
48027
+ const selected = await openAccountMenuFirstStep(authStatus2);
48394
48028
  if (selected === void 0) {
48395
48029
  return;
48396
48030
  }
@@ -48410,12 +48044,11 @@ async function showAccountMenu() {
48410
48044
  break;
48411
48045
  }
48412
48046
  }
48413
- async function openAccountMenuFirstStep(authStatus2, sub2) {
48047
+ async function openAccountMenuFirstStep(authStatus2) {
48414
48048
  const isDotComInstance = isDotCom(authStatus2.endpoint);
48415
48049
  const displayName = authStatus2.displayName || authStatus2.username;
48416
48050
  const email = authStatus2.primaryEmail || "No Email";
48417
48051
  const username = authStatus2.username || authStatus2.displayName;
48418
- const planDetail = sub2 ? `Plan: ${sub2.userCanUpgrade ? "Cody Free" : "Cody Pro"}` : "";
48419
48052
  const enterpriseDetail = `Enterprise Instance:
48420
48053
  ${authStatus2.endpoint}`;
48421
48054
  const options = isDotComInstance ? [
@@ -48429,7 +48062,7 @@ ${authStatus2.endpoint}`;
48429
48062
  );
48430
48063
  const messageOptions = {
48431
48064
  modal: true,
48432
- detail: isDotComInstance ? planDetail : enterpriseDetail
48065
+ detail: enterpriseDetail
48433
48066
  };
48434
48067
  const message = isDotComInstance ? `Signed in as ${displayName} (${email})` : `Signed in as @${username}`;
48435
48068
  const option2 = await window$1.showInformationMessage(message, messageOptions, ...options);
@@ -150783,12 +150416,6 @@ const _ContextRetrieverDataCollection = class _ContextRetrieverDataCollection {
150783
150416
  }
150784
150417
  return dataLoggingContext;
150785
150418
  }
150786
- shouldCollectContextDatapoint() {
150787
- if (!isDotComAuthed() || this.dataCollectionRetrievers.length === 0) {
150788
- return false;
150789
- }
150790
- return true;
150791
- }
150792
150419
  createRetriever(config) {
150793
150420
  switch (config.identifier) {
150794
150421
  case RetrieverIdentifier.RecentEditsRetriever:
@@ -150984,17 +150611,9 @@ class ContextMixer {
150984
150611
  return resultsWithDataLogging.filter((result) => originalIdentifiers.has(result.identifier));
150985
150612
  }
150986
150613
  maybeAddDataLoggingRetrievers(originalRetrievers) {
150987
- const dataCollectionRetrievers = this.getDataCollectionRetrievers();
150988
- const combinedRetrievers = [...originalRetrievers, ...dataCollectionRetrievers];
150614
+ const combinedRetrievers = [...originalRetrievers];
150989
150615
  return dedupeWith$1(combinedRetrievers, "identifier");
150990
150616
  }
150991
- getDataCollectionRetrievers() {
150992
- var _a3;
150993
- if (!((_a3 = this.contextDataCollector) == null ? void 0 : _a3.shouldCollectContextDatapoint())) {
150994
- return [];
150995
- }
150996
- return this.contextDataCollector.dataCollectionRetrievers;
150997
- }
150998
150617
  dispose() {
150999
150618
  for (const disposable of this.disposables) {
151000
150619
  disposable.dispose();
@@ -152247,43 +151866,29 @@ const providerModes = {
152247
151866
  standard: {
152248
151867
  tokenLimit: defaultTokenLimit,
152249
151868
  promptProvider: void 0,
152250
- models: {
152251
- dotcom: "autoedits-deepseek-lite-default",
152252
- sgInstance: "fireworks::v1::autoedits-deepseek-lite-default"
152253
- }
151869
+ model: "fireworks::v1::autoedits-deepseek-lite-default"
152254
151870
  },
152255
151871
  hotStreak: {
152256
151872
  tokenLimit: hotStreakTokenLimit,
152257
151873
  promptProvider: "long-suggestion-prompt-provider",
152258
- models: {
152259
- dotcom: "autoedits-long-suggestion-default",
152260
- sgInstance: "fireworks::v1::autoedits-long-suggestion-default"
152261
- }
151874
+ model: "fireworks::v1::autoedits-long-suggestion-default"
152262
151875
  }
152263
151876
  };
152264
- const providerConfigs = {
152265
- dotCom: {
152266
- provider: "cody-gateway",
152267
- url: "https://cody-gateway.sourcegraph.com/v1/completions/fireworks",
152268
- isChatModel: false,
152269
- timeoutMs: 1e4
152270
- },
152271
- sgInstance: {
152272
- provider: "sourcegraph",
152273
- url: "",
152274
- isChatModel: false,
152275
- timeoutMs: 1e4
152276
- }
151877
+ const providerConfig = {
151878
+ provider: "sourcegraph",
151879
+ url: "",
151880
+ isChatModel: false,
151881
+ timeoutMs: 1e4
152277
151882
  };
152278
151883
  function getBaseProviderConfig() {
152279
151884
  const mode = isHotStreakEnabled() ? "hotStreak" : "standard";
152280
151885
  const config = providerModes[mode];
152281
- const authConfig = isDotComAuthed() ? providerConfigs.dotCom : providerConfigs.sgInstance;
151886
+ const authConfig = providerConfig;
152282
151887
  return {
152283
151888
  ...authConfig,
152284
151889
  promptProvider: config.promptProvider,
152285
151890
  tokenLimit: config.tokenLimit,
152286
- model: isDotComAuthed() ? config.models.dotcom : config.models.sgInstance
151891
+ model: config.model
152287
151892
  };
152288
151893
  }
152289
151894
  function getAutoeditsProviderConfig() {
@@ -153290,8 +152895,7 @@ class DefaultCodeCompletionsClient {
153290
152895
  });
153291
152896
  logResponseHeadersToSpan(span2, response);
153292
152897
  if (response.status === 429) {
153293
- const upgradeIsAvailable = response.headers.get("x-is-cody-pro-user") === "false" && typeof response.headers.get("x-is-cody-pro-user") !== "undefined";
153294
- throw await createRateLimitErrorFromResponse(response, upgradeIsAvailable);
152898
+ throw await createRateLimitErrorFromResponse(response);
153295
152899
  }
153296
152900
  if (!response.ok) {
153297
152901
  throw isCustomAuthChallengeResponse(response) ? new NeedsAuthChallengeError() : new NetworkError(response, await response.text(), traceId);
@@ -153403,13 +153007,12 @@ class DefaultCodeCompletionsClient {
153403
153007
  }
153404
153008
  const defaultCodeCompletionsClient = singletonNotYetSet();
153405
153009
  setSingleton(defaultCodeCompletionsClient, new DefaultCodeCompletionsClient());
153406
- async function createRateLimitErrorFromResponse(response, upgradeIsAvailable) {
153010
+ async function createRateLimitErrorFromResponse(response) {
153407
153011
  const retryAfter = response.headers.get("retry-after");
153408
153012
  const limit = response.headers.get("x-ratelimit-limit");
153409
153013
  return new RateLimitError$1(
153410
153014
  "autocompletions",
153411
153015
  await response.text(),
153412
- upgradeIsAvailable,
153413
153016
  limit ? Number.parseInt(limit, 10) : void 0,
153414
153017
  retryAfter
153415
153018
  );
@@ -154658,8 +154261,6 @@ class AutoeditAnalyticsLogger {
154658
154261
  otherCompletionProviders: otherCompletionProviders2,
154659
154262
  upstreamLatency: upstreamHealthProvider.getUpstreamLatency(),
154660
154263
  gatewayLatency: upstreamHealthProvider.getGatewayLatency(),
154661
- // 🚨 SECURITY: included only for DotCom users.
154662
- codeToRewrite: isDotComAuthed() ? codeToRewrite : void 0,
154663
154264
  ...restPayload
154664
154265
  }
154665
154266
  };
@@ -154704,8 +154305,6 @@ class AutoeditAnalyticsLogger {
154704
154305
  payload: {
154705
154306
  ...request.payload,
154706
154307
  id: stableId,
154707
- // 🚨 SECURITY: included only for DotCom users.
154708
- prediction: isDotComAuthed() && prediction.length < 300 ? prediction : void 0,
154709
154308
  source,
154710
154309
  isFuzzyMatch,
154711
154310
  responseHeaders: "responseHeaders" in modelResponse ? modelResponse.responseHeaders : {},
@@ -155097,14 +154696,8 @@ class AutoEditBetaOnboarding {
155097
154696
  return localStorage.setAutoeditBetaEnrollment();
155098
154697
  }
155099
154698
  async isUserEligibleForAutoEditFeature() {
155100
- const authStatus2 = currentAuthStatus();
155101
- const productSubscription = await currentUserProductSubscription();
155102
154699
  const autoEditFeatureFlag = this.isAutoEditFeatureFlagEnabled();
155103
- const { isUserEligible } = isUserEligibleForAutoeditsFeature(
155104
- autoEditFeatureFlag,
155105
- authStatus2,
155106
- productSubscription
155107
- );
154700
+ const { isUserEligible } = isUserEligibleForAutoeditsFeature(autoEditFeatureFlag);
155108
154701
  return isUserEligible;
155109
154702
  }
155110
154703
  isAutoEditFeatureFlagEnabled() {
@@ -172584,6 +172177,64 @@ class Fzf {
172584
172177
  this.find = this.finder.find.bind(this.finder);
172585
172178
  }
172586
172179
  }
172180
+ const MAX_REPO_COUNT = 10;
172181
+ const workspaceFolders = fromVSCodeEvent(
172182
+ workspace.onDidChangeWorkspaceFolders
172183
+ ).pipe(
172184
+ startWith$1(void 0),
172185
+ map$1(() => workspace.workspaceFolders)
172186
+ );
172187
+ const remoteReposForAllWorkspaceFolders = combineLatest$1(
172188
+ workspaceFolders.pipe(
172189
+ // The vscode.git extension has a delay before we can fetch a workspace folder's remote.
172190
+ debounceTime(vscodeGitAPI ? 2e3 : 0)
172191
+ ),
172192
+ authStatus
172193
+ ).pipe(
172194
+ switchMapReplayOperation(
172195
+ ([workspaceFolders2]) => {
172196
+ if (!workspaceFolders2 || workspaceFolders2.length === 0) {
172197
+ return Observable.of([]);
172198
+ }
172199
+ return combineLatest$1(
172200
+ ...workspaceFolders2.map((folder2) => repoNameResolver.getRepoNamesContainingUri(folder2.uri))
172201
+ ).pipe(
172202
+ map$1((repoNamesLists) => {
172203
+ const completedResults = repoNamesLists.filter((names) => Array.isArray(names)).flat().filter((name2) => typeof name2 === "string");
172204
+ return completedResults.length > 0 ? completedResults : [];
172205
+ }),
172206
+ abortableOperation(async (repoNames, signal2) => {
172207
+ if (repoNames.length === 0) {
172208
+ return [];
172209
+ }
172210
+ const reposOrError = await graphqlClient.getRepoIds(
172211
+ repoNames,
172212
+ MAX_REPO_COUNT,
172213
+ signal2
172214
+ );
172215
+ if (isError$3(reposOrError)) {
172216
+ throw reposOrError;
172217
+ }
172218
+ return reposOrError;
172219
+ })
172220
+ );
172221
+ }
172222
+ )
172223
+ );
172224
+ async function remoteReposForWorkspaceFolder(folder2) {
172225
+ return firstValueFrom$1(
172226
+ repoNameResolver.getRepoNamesContainingUri(folder2.uri).pipe(skipPendingOperation())
172227
+ );
172228
+ }
172229
+ async function workspaceFolderForRepo(repoName) {
172230
+ for (const folder2 of workspace.workspaceFolders ?? []) {
172231
+ const remoteRepos = await remoteReposForWorkspaceFolder(folder2);
172232
+ if (remoteRepos.some((remoteRepo) => remoteRepo === repoName)) {
172233
+ return folder2;
172234
+ }
172235
+ }
172236
+ return void 0;
172237
+ }
172587
172238
  function starTiebreaker(a, b) {
172588
172239
  return b.item.stars - a.item.stars;
172589
172240
  }
@@ -173289,25 +172940,6 @@ async function getLocalCommands(input) {
173289
172940
  (c) => matchesQuery(query2, c.key) || matchesQuery(query2, c.description ?? "") || matchesQuery(query2, c.prompt)
173290
172941
  );
173291
172942
  }
173292
- class AuthProviderSimplified {
173293
- async openExternalAuthUrl(method, tokenReceiverUrl) {
173294
- if (!await openExternalAuthUrl(method, tokenReceiverUrl)) {
173295
- return false;
173296
- }
173297
- authProvider.setAuthPendingToEndpoint(DOTCOM_URL.toString());
173298
- return true;
173299
- }
173300
- }
173301
- function openExternalAuthUrl(provider, tokenReceiverUrl) {
173302
- const referralCode = getCodyAuthReferralCode(env.uriScheme);
173303
- const tokenReceiver = tokenReceiverUrl ? `&tokenReceiverUrl=${tokenReceiverUrl}` : "";
173304
- const redirect = encodeURIComponent(
173305
- `/user/settings/tokens/new/callback?requestFrom=${referralCode}${tokenReceiver}`
173306
- );
173307
- const site = DOTCOM_URL.toString();
173308
- const uriSpec = provider === "github" || provider === "gitlab" || provider === "google" ? `${site}.auth/openidconnect/login?prompt_auth=${provider}&pc=sams&redirect=${redirect}` : `${site}sign-in?returnTo=${redirect}`;
173309
- return env.openExternal(uriSpec);
173310
- }
173311
172943
  const TraceSender = {
173312
172944
  send(spanData) {
173313
172945
  void doSendTraceData(spanData).catch((error) => {
@@ -174314,7 +173946,14 @@ class DefaultPrompter {
174314
173946
  const promptBuilder = await PromptBuilder.create(contextWindow2);
174315
173947
  const preInstruction = (await currentResolvedConfig()).configuration.chatPreInstruction;
174316
173948
  const chatModel = await firstResultFromOperation(ChatBuilder.resolvedModelForChat(chat2));
174317
- const preambleMessages = getSimplePreamble(chatModel, codyApiVersion, "Chat", preInstruction);
173949
+ const includeTerminalToolPreamble = false;
173950
+ const preambleMessages = getSimplePreamble(
173951
+ chatModel,
173952
+ codyApiVersion,
173953
+ "Chat",
173954
+ preInstruction,
173955
+ includeTerminalToolPreamble
173956
+ );
174318
173957
  if (!promptBuilder.tryAddToPrefix(preambleMessages)) {
174319
173958
  throw new Error(`Preamble length exceeded context window ${contextWindow2.input}`);
174320
173959
  }
@@ -174627,7 +174266,8 @@ const _DeepCodyHandler = class _DeepCodyHandler extends ChatHandler {
174627
174266
  };
174628
174267
  }
174629
174268
  static isAgenticChatEnabled() {
174630
- return _DeepCodyHandler.isToolboxEnabled && Boolean(_DeepCodyHandler.model) && !isCodyTesting;
174269
+ const currentIDE = clientCapabilities().agentIDE;
174270
+ return _DeepCodyHandler.isToolboxEnabled && Boolean(_DeepCodyHandler.model) && !isCodyTesting && currentIDE !== CodyIDE.Web;
174631
174271
  }
174632
174272
  static getFeatureError(feature2) {
174633
174273
  switch (feature2) {
@@ -174660,7 +174300,6 @@ __publicField2(_DeepCodyHandler, "observable", combineLatest$1(
174660
174300
  featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.AgenticContextDisabled),
174661
174301
  featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.ContextAgentDefaultChatModel),
174662
174302
  featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.DeepCodyShellContext),
174663
- userProductSubscription.pipe(distinctUntilChanged$1()),
174664
174303
  modelsService.modelsChanges.pipe(
174665
174304
  map$1((models) => models === pendingOperation ? null : models),
174666
174305
  distinctUntilChanged$1()
@@ -174674,13 +174313,11 @@ __publicField2(_DeepCodyHandler, "observable", combineLatest$1(
174674
174313
  isDisabledOnInstance,
174675
174314
  useDefaultChatModel,
174676
174315
  instanceShellContextFlag,
174677
- sub2,
174678
174316
  models,
174679
174317
  config
174680
174318
  ]) => {
174681
174319
  var _a3, _b2, _c2, _d2;
174682
- const isDotComUser = isDotCom(auth2.endpoint);
174683
- if (sub2 === pendingOperation || isDotComUser && (sub2 == null ? void 0 : sub2.userCanUpgrade) || !models || isCodyTesting || isDisabledOnInstance || ((_a3 = config.configuration) == null ? void 0 : _a3.chatAgenticContext) === false) {
174320
+ if (!models || isCodyTesting || isDisabledOnInstance || ((_a3 = config.configuration) == null ? void 0 : _a3.chatAgenticContext) === false) {
174684
174321
  _DeepCodyHandler.model = void 0;
174685
174322
  _DeepCodyHandler.isToolboxEnabled = false;
174686
174323
  return null;
@@ -182328,7 +181965,11 @@ function getCorpusContextItemsForEditorState() {
182328
181965
  return pendingOperation;
182329
181966
  }
182330
181967
  if (isError$3(remoteReposForAllWorkspaceFolders2)) {
182331
- throw remoteReposForAllWorkspaceFolders2;
181968
+ logError$2(
181969
+ "initialContext",
181970
+ "Failed to get remote repos for all workspace folders"
181971
+ );
181972
+ remoteReposForAllWorkspaceFolders2 = [];
182332
181973
  }
182333
181974
  for (const repo of remoteReposForAllWorkspaceFolders2) {
182334
181975
  if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
@@ -183657,11 +183298,11 @@ class ChatsController {
183657
183298
  };
183658
183299
  this.disposables.push(
183659
183300
  commands$1.registerCommand("cody.chat.moveToEditor", async () => {
183660
- localStorage.setLastUsedChatModality("editor");
183301
+ await localStorage.setLastUsedChatModality("editor");
183661
183302
  return await this.moveChatFromPanelToEditor();
183662
183303
  }),
183663
183304
  commands$1.registerCommand("cody.chat.moveFromEditor", async () => {
183664
- localStorage.setLastUsedChatModality("sidebar");
183305
+ await localStorage.setLastUsedChatModality("sidebar");
183665
183306
  return await this.moveChatFromEditorToPanel();
183666
183307
  }),
183667
183308
  commands$1.registerCommand("cody.action.chat", (args2) => this.submitChat(args2)),
@@ -183670,7 +183311,7 @@ class ChatsController {
183670
183311
  () => commands$1.executeCommand("cody.chat.focus")
183671
183312
  ),
183672
183313
  commands$1.registerCommand("cody.chat.newPanel", async (args2) => {
183673
- localStorage.setLastUsedChatModality("sidebar");
183314
+ await localStorage.setLastUsedChatModality("sidebar");
183674
183315
  const isVisible = this.panel.isVisible();
183675
183316
  await this.panel.clearAndRestartSession();
183676
183317
  try {
@@ -183685,7 +183326,7 @@ class ChatsController {
183685
183326
  }
183686
183327
  }),
183687
183328
  commands$1.registerCommand("cody.chat.newEditorPanel", async (args2) => {
183688
- localStorage.setLastUsedChatModality("editor");
183329
+ await localStorage.setLastUsedChatModality("editor");
183689
183330
  const panel2 = await this.getOrCreateEditorChatController();
183690
183331
  try {
183691
183332
  const { contextItems } = JSON.parse(args2) || {};
@@ -184031,7 +183672,6 @@ class ChatsController {
184031
183672
  ...this.options,
184032
183673
  chatClient: this.chatClient,
184033
183674
  guardrails: this.guardrails,
184034
- startTokenReceiver: this.options.startTokenReceiver,
184035
183675
  contextRetriever: this.contextRetriever,
184036
183676
  extensionClient: this.extensionClient
184037
183677
  });
@@ -184183,6 +183823,142 @@ class InitDoer {
184183
183823
  });
184184
183824
  }
184185
183825
  }
183826
+ const _GitHubDotComRepoMetadata = class _GitHubDotComRepoMetadata {
183827
+ constructor() {
183828
+ __publicField2(this, "cache", /* @__PURE__ */ new Map());
183829
+ this.cache.clear();
183830
+ const localStorageData = localStorage.getGitHubRepoAccessibility();
183831
+ for (const data of localStorageData) {
183832
+ this.cache.set(data.repoName, data);
183833
+ }
183834
+ }
183835
+ static getInstance() {
183836
+ if (!_GitHubDotComRepoMetadata.instance) {
183837
+ _GitHubDotComRepoMetadata.instance = new _GitHubDotComRepoMetadata();
183838
+ }
183839
+ return _GitHubDotComRepoMetadata.instance;
183840
+ }
183841
+ getRepoMetadataIfCached(repoBaseName) {
183842
+ const normalizedRepoName = this.getNormalizedRepoNameFromBaseRepoName(repoBaseName);
183843
+ if (!normalizedRepoName) {
183844
+ return void 0;
183845
+ }
183846
+ return this.cache.get(normalizedRepoName);
183847
+ }
183848
+ async getRepoMetadataUsingRepoName(repoBaseName, signal2) {
183849
+ const repoMetadata = this.getRepoMetadataIfCached(repoBaseName);
183850
+ if (repoMetadata) {
183851
+ return repoMetadata;
183852
+ }
183853
+ const repoMetaData = await this.ghMetadataFromGit(repoBaseName, signal2);
183854
+ if (repoMetaData) {
183855
+ this.updateCachedDataToLocalStorageIfNeeded(repoMetaData);
183856
+ }
183857
+ return repoMetaData;
183858
+ }
183859
+ async ghMetadataFromGit(repoBaseName, signal2) {
183860
+ const ownerAndRepoName = this.parseOwnerAndRepoName(repoBaseName);
183861
+ if (!ownerAndRepoName) {
183862
+ return void 0;
183863
+ }
183864
+ const repoMetaData = await this.queryGitHubApi(
183865
+ ownerAndRepoName.owner,
183866
+ ownerAndRepoName.repoName,
183867
+ signal2
183868
+ );
183869
+ return repoMetaData;
183870
+ }
183871
+ async queryGitHubApi(owner2, repoName, signal2) {
183872
+ const apiUrl = `https://api.github.com/repos/${owner2}/${repoName}`;
183873
+ const normalizedRepoName = this.getNormalizedRepoNameFromOwnerAndRepoName(owner2, repoName);
183874
+ const metadata2 = { repoName: normalizedRepoName, isPublic: false, timestamp: Date.now() };
183875
+ try {
183876
+ const response = await fetch(apiUrl, { method: "HEAD", signal: signal2 });
183877
+ metadata2.isPublic = response.ok;
183878
+ } catch (error) {
183879
+ if (!isAbortError(error)) {
183880
+ logDebug(
183881
+ "queryGitHubApi",
183882
+ "error querying GitHub API (assuming repository is non-public",
183883
+ `${owner2}/${repoName}`,
183884
+ error
183885
+ );
183886
+ }
183887
+ }
183888
+ return metadata2;
183889
+ }
183890
+ getNormalizedRepoNameFromBaseRepoName(repoBaseName) {
183891
+ const ownerAndRepoName = this.parseOwnerAndRepoName(repoBaseName);
183892
+ if (!ownerAndRepoName) {
183893
+ return void 0;
183894
+ }
183895
+ return this.getNormalizedRepoNameFromOwnerAndRepoName(
183896
+ ownerAndRepoName.owner,
183897
+ ownerAndRepoName.repoName
183898
+ );
183899
+ }
183900
+ getNormalizedRepoNameFromOwnerAndRepoName(owner2, repoName) {
183901
+ return `github.com/${owner2}/${repoName}`;
183902
+ }
183903
+ parseOwnerAndRepoName(repoBaseName) {
183904
+ const match2 = repoBaseName == null ? void 0 : repoBaseName.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);
183905
+ if (!match2) {
183906
+ return void 0;
183907
+ }
183908
+ const [, owner2, repoName] = match2;
183909
+ return { owner: owner2, repoName };
183910
+ }
183911
+ updateCachedDataToLocalStorageIfNeeded(repoMetaData) {
183912
+ var _a3;
183913
+ if (((_a3 = this.cache.get(repoMetaData.repoName)) == null ? void 0 : _a3.isPublic) === repoMetaData.isPublic) {
183914
+ return;
183915
+ }
183916
+ this.cache.set(repoMetaData.repoName, repoMetaData);
183917
+ const repoAccessibilityData = Array.from(this.cache.values()).filter(isDefined);
183918
+ localStorage.setGitHubRepoAccessibility(repoAccessibilityData);
183919
+ }
183920
+ };
183921
+ // This class is used to get the metadata from the gitApi.
183922
+ __publicField2(_GitHubDotComRepoMetadata, "instance", null);
183923
+ let GitHubDotComRepoMetadata = _GitHubDotComRepoMetadata;
183924
+ const NO_PUBLIC_METADATA = { isPublic: false, repoMetadata: void 0 };
183925
+ const publicRepoMetadataIfAllWorkspaceReposArePublic = remoteReposForAllWorkspaceFolders.pipe(
183926
+ map$1((remoteRepos) => isError$3(remoteRepos) ? [] : remoteRepos),
183927
+ switchMap$1((remoteRepos) => {
183928
+ if (remoteRepos === pendingOperation) {
183929
+ return Observable.of(pendingOperation);
183930
+ }
183931
+ if (remoteRepos.length === 0) {
183932
+ return Observable.of(NO_PUBLIC_METADATA);
183933
+ }
183934
+ return combineLatest$1(
183935
+ ...remoteRepos.map(
183936
+ (remoteRepo) => promiseFactoryToObservable(
183937
+ (signal2) => (
183938
+ // This is cached, so it's fast.
183939
+ GitHubDotComRepoMetadata.getInstance().getRepoMetadataUsingRepoName(
183940
+ remoteRepo.name,
183941
+ signal2
183942
+ )
183943
+ )
183944
+ )
183945
+ )
183946
+ ).pipe(
183947
+ map$1((repoMetadatas) => {
183948
+ const allReposArePublic = repoMetadatas.length >= 1 && repoMetadatas.every((repoMetadata) => (repoMetadata == null ? void 0 : repoMetadata.isPublic) ?? false);
183949
+ return allReposArePublic ? { isPublic: true, repoMetadata: repoMetadatas.filter(isDefined) } : NO_PUBLIC_METADATA;
183950
+ }),
183951
+ catchError$1((error) => {
183952
+ logDebug(
183953
+ "publicRepoMetadataIfAllWorkspaceReposArePublic",
183954
+ "error getting repository metadata",
183955
+ error
183956
+ );
183957
+ return Observable.of(NO_PUBLIC_METADATA);
183958
+ })
183959
+ );
183960
+ })
183961
+ );
184186
183962
  class OmniboxTelemetry {
184187
183963
  constructor(baseProperties) {
184188
183964
  __publicField2(this, "intentInfo");
@@ -187299,14 +187075,15 @@ async function getFileMentions(repoName, filePath) {
187299
187075
  const query2 = `repo:${repoRe} file:${fileRe} type:file count:10`;
187300
187076
  const { auth: auth2 } = await currentResolvedConfig();
187301
187077
  const dataOrError = await graphqlClient.searchFileMatches(query2);
187302
- if (isError$3(dataOrError) || dataOrError === null) {
187078
+ const endpoint = auth2.serverEndpoint;
187079
+ if (isError$3(dataOrError) || dataOrError === null || !endpoint) {
187303
187080
  return [];
187304
187081
  }
187305
187082
  return dataOrError.search.results.results.map((result) => {
187306
187083
  if (result.__typename !== "FileMatch") {
187307
187084
  return null;
187308
187085
  }
187309
- const url = `${auth2.serverEndpoint.replace(/\/$/, "")}${result.file.url}`;
187086
+ const url = `${endpoint.replace(/\/$/, "")}${result.file.url}`;
187310
187087
  const basename2 = displayPathBasename(URI.parse(result.file.path));
187311
187088
  return {
187312
187089
  uri: url,
@@ -187324,14 +187101,15 @@ async function getFileItem(repoName, filePath, rev2 = "HEAD") {
187324
187101
  var _a3, _b2;
187325
187102
  const { auth: auth2 } = await currentResolvedConfig();
187326
187103
  const dataOrError = await graphqlClient.getFileContents(repoName, filePath, rev2);
187327
- if (isError$3(dataOrError)) {
187104
+ const endpoint = auth2.serverEndpoint;
187105
+ if (isError$3(dataOrError) || dataOrError === null || !endpoint) {
187328
187106
  return [];
187329
187107
  }
187330
187108
  const file = (_b2 = (_a3 = dataOrError == null ? void 0 : dataOrError.repository) == null ? void 0 : _a3.commit) == null ? void 0 : _b2.file;
187331
187109
  if (!file) {
187332
187110
  return [];
187333
187111
  }
187334
- const url = `${auth2.serverEndpoint.replace(/\/$/, "")}${file.url}`;
187112
+ const url = `${endpoint.replace(/\/$/, "")}${file.url}`;
187335
187113
  return [
187336
187114
  {
187337
187115
  url,
@@ -187623,7 +187401,6 @@ class ChatController {
187623
187401
  chatClient,
187624
187402
  editor,
187625
187403
  guardrails,
187626
- startTokenReceiver,
187627
187404
  contextRetriever,
187628
187405
  extensionClient
187629
187406
  }) {
@@ -187633,7 +187410,6 @@ class ChatController {
187633
187410
  __publicField2(this, "editor");
187634
187411
  __publicField2(this, "extensionClient");
187635
187412
  __publicField2(this, "guardrails");
187636
- __publicField2(this, "startTokenReceiver");
187637
187413
  __publicField2(this, "lastKnownTokenUsage");
187638
187414
  __publicField2(this, "disposables", []);
187639
187415
  __publicField2(this, "clientBroadcast", new MulticastSubject());
@@ -187652,7 +187428,6 @@ class ChatController {
187652
187428
  this.contextRetriever = contextRetriever;
187653
187429
  this.chatBuilder = new ChatBuilder(void 0);
187654
187430
  this.guardrails = guardrails;
187655
- this.startTokenReceiver = startTokenReceiver;
187656
187431
  if (TestSupport.instance) {
187657
187432
  TestSupport.instance.chatPanelProvider.set(this);
187658
187433
  }
@@ -187693,7 +187468,7 @@ class ChatController {
187693
187468
  * @param message is the message from the view.
187694
187469
  */
187695
187470
  async onDidReceiveMessage(message) {
187696
- var _a3, _b2, _c2;
187471
+ var _a3, _b2;
187697
187472
  try {
187698
187473
  switch (message.command) {
187699
187474
  case "ready":
@@ -187908,52 +187683,7 @@ class ChatController {
187908
187683
  break;
187909
187684
  case "auth": {
187910
187685
  if (message.authKind === "refresh") {
187911
- authProvider.refresh();
187912
- break;
187913
- }
187914
- if (message.authKind === "simplified-onboarding") {
187915
- const endpoint = DOTCOM_URL.href;
187916
- let tokenReceiverUrl = void 0;
187917
- closeAuthProgressIndicator();
187918
- startAuthProgressIndicator();
187919
- tokenReceiverUrl = await ((_c2 = this.startTokenReceiver) == null ? void 0 : _c2.call(
187920
- this,
187921
- endpoint,
187922
- async (credentials) => {
187923
- closeAuthProgressIndicator();
187924
- const authStatus2 = await authProvider.validateAndStoreCredentials(
187925
- credentials,
187926
- "store-if-valid"
187927
- );
187928
- telemetryRecorder.recordEvent(
187929
- "cody.auth.fromTokenReceiver.web",
187930
- "succeeded",
187931
- {
187932
- metadata: {
187933
- success: authStatus2.authenticated ? 1 : 0
187934
- },
187935
- billingMetadata: {
187936
- product: "cody",
187937
- category: "billable"
187938
- }
187939
- }
187940
- );
187941
- if (!authStatus2.authenticated) {
187942
- void window$1.showErrorMessage(
187943
- "Authentication failed. Please check your token and try again."
187944
- );
187945
- }
187946
- }
187947
- ));
187948
- const authProviderSimplified = new AuthProviderSimplified();
187949
- const authMethod = message.authMethod || "dotcom";
187950
- const successfullyOpenedUrl = await authProviderSimplified.openExternalAuthUrl(
187951
- authMethod,
187952
- tokenReceiverUrl
187953
- );
187954
- if (!successfullyOpenedUrl) {
187955
- closeAuthProgressIndicator();
187956
- }
187686
+ await authProvider.refresh();
187957
187687
  break;
187958
187688
  }
187959
187689
  if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
@@ -187996,29 +187726,6 @@ class ChatController {
187996
187726
  await commands$1.executeCommand(`cody.auth.${message.authKind}`);
187997
187727
  break;
187998
187728
  }
187999
- case "simplified-onboarding": {
188000
- if (message.onboardingKind === "web-sign-in-token") {
188001
- void window$1.showInputBox({ prompt: "Enter web sign-in token" }).then(async (token) => {
188002
- if (!token) {
188003
- return;
188004
- }
188005
- const authStatus2 = await authProvider.validateAndStoreCredentials(
188006
- {
188007
- serverEndpoint: DOTCOM_URL.href,
188008
- credentials: { token }
188009
- },
188010
- "store-if-valid"
188011
- );
188012
- if (!authStatus2.authenticated) {
188013
- void window$1.showErrorMessage(
188014
- "Authentication failed. Please check your token and try again."
188015
- );
188016
- }
188017
- });
188018
- break;
188019
- }
188020
- break;
188021
- }
188022
187729
  case "log": {
188023
187730
  const logger2 = message.level === "debug" ? logDebug : logError$2;
188024
187731
  logger2(message.filterLabel, message.message);
@@ -188056,11 +187763,9 @@ class ChatController {
188056
187763
  const sidebarViewOnly = ((_b2 = (_a3 = this.extensionClient.capabilities) == null ? void 0 : _a3.webviewNativeConfig) == null ? void 0 : _b2.view) === "single";
188057
187764
  const isEditorViewType = ((_c2 = this.webviewPanelOrView) == null ? void 0 : _c2.viewType) === "cody.editorPanel";
188058
187765
  const webviewType = isEditorViewType && !sidebarViewOnly ? "editor" : "sidebar";
188059
- const uiKindIsWeb = (cenv.CODY_OVERRIDE_UI_KIND ?? env.uiKind) === UIKind.Web;
188060
187766
  const endpoints = localStorage.getEndpointHistory() ?? [];
188061
187767
  const attribution = ((_d2 = await ClientConfigSingleton.getInstance().getConfig()) == null ? void 0 : _d2.attribution) ?? GuardrailsMode.Off;
188062
187768
  return {
188063
- uiKindIsWeb,
188064
187769
  serverEndpoint: auth2.serverEndpoint,
188065
187770
  endpointHistory: [...endpoints],
188066
187771
  experimentalNoodle: configuration.experimentalNoodle,
@@ -188090,15 +187795,10 @@ class ChatController {
188090
187795
  const configForWebview = await this.getConfigForWebview();
188091
187796
  const workspaceFolderUris = ((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.map((folder2) => folder2.uri.toString())) ?? [];
188092
187797
  let siteHasCodyEnabled = null;
188093
- let currentUserCodySubscription = null;
188094
187798
  if (authStatus2.authenticated && !isCodyTesting) {
188095
187799
  try {
188096
- const [siteResult, subscriptionResult] = await Promise.all([
188097
- graphqlClient.getSiteHasCodyEnabled(),
188098
- graphqlClient.getCurrentUserCodySubscription()
188099
- ]);
187800
+ const siteResult = await graphqlClient.getSiteHasCodyEnabled();
188100
187801
  siteHasCodyEnabled = isError$3(siteResult) ? null : siteResult;
188101
- currentUserCodySubscription = isError$3(subscriptionResult) ? null : subscriptionResult;
188102
187802
  } catch (error) {
188103
187803
  console.error("Failed to fetch additional user data", error);
188104
187804
  }
@@ -188108,11 +187808,8 @@ class ChatController {
188108
187808
  config: configForWebview,
188109
187809
  clientCapabilities: clientCapabilities(),
188110
187810
  authStatus: authStatus2,
188111
- userProductSubscription: await currentUserProductSubscription(),
188112
187811
  workspaceFolderUris,
188113
- isDotComUser: isDotCom(authStatus2),
188114
- siteHasCodyEnabled,
188115
- currentUserCodySubscription
187812
+ siteHasCodyEnabled
188116
187813
  });
188117
187814
  logDebug("ChatController", "updateViewConfig", {
188118
187815
  verbose: configForWebview
@@ -188983,9 +188680,6 @@ class ChatController {
188983
188680
  authStatus: () => authStatus,
188984
188681
  transcript: () => this.chatBuilder.changes.pipe(map$1((chat2) => chat2.getDehydratedMessages())),
188985
188682
  userHistory: (type) => type === ChatHistoryType.Full ? chatHistory.changes : chatHistory.lightweightChanges,
188986
- userProductSubscription: () => userProductSubscription.pipe(
188987
- map$1((value) => value === pendingOperation ? null : value)
188988
- ),
188989
188683
  // Existing tools endpoint - update to include MCP tools
188990
188684
  mcpSettings: () => {
188991
188685
  return featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.AgenticChatWithMCP).pipe(
@@ -189259,42 +188953,39 @@ function createAutoEditsProvider({
189259
188953
  }
189260
188954
  return NEVER$1;
189261
188955
  }
189262
- return combineLatest$1(
189263
- promiseFactoryToObservable(async () => await currentUserProductSubscription())
189264
- ).pipe(
189265
- skipPendingOperation(),
189266
- createDisposables(([userProductSubscription2]) => {
189267
- const userEligibilityInfo = isUserEligibleForAutoeditsFeature(
189268
- autoeditFeatureFlagEnabled,
189269
- authStatus2,
189270
- userProductSubscription2
189271
- );
189272
- if (!userEligibilityInfo.isUserEligible) {
189273
- handleAutoeditsNotificationForNonEligibleUser(userEligibilityInfo.nonEligibilityReason);
189274
- return [];
189275
- }
189276
- const shouldHotStreak = !isRunningInsideAgent() && (autoeditHotStreakEnabled || isHotStreakEnabledInSettings());
189277
- const provider = new AutoeditsProvider(chatClient, fixupController, statusBar, {
189278
- shouldHotStreak,
189279
- allowUsingWebSocket: autoeditUseWebSocketEnabled
189280
- });
189281
- return [
189282
- commands$1.registerCommand(
189283
- "cody.command.autoedit-manual-trigger",
189284
- async () => provider.manuallyTriggerCompletion()
189285
- ),
189286
- languages$1.registerInlineCompletionItemProvider(
189287
- [{ scheme: "file", language: "*" }, { notebookType: "*" }],
189288
- provider
189289
- ),
189290
- commands$1.registerCommand("cody.command.autoedit.open-debug-panel", () => {
189291
- AutoeditDebugPanel.showPanel(context2);
189292
- }),
188956
+ return new Observable((observer) => {
188957
+ const userEligibilityInfo = isUserEligibleForAutoeditsFeature(autoeditFeatureFlagEnabled);
188958
+ if (!userEligibilityInfo.isUserEligible) {
188959
+ handleAutoeditsNotificationForNonEligibleUser(userEligibilityInfo.nonEligibilityReason);
188960
+ observer.complete();
188961
+ return () => {
188962
+ };
188963
+ }
188964
+ const shouldHotStreak = !isRunningInsideAgent() && (autoeditHotStreakEnabled || isHotStreakEnabledInSettings());
188965
+ const provider = new AutoeditsProvider(chatClient, fixupController, statusBar, {
188966
+ shouldHotStreak,
188967
+ allowUsingWebSocket: autoeditUseWebSocketEnabled
188968
+ });
188969
+ const disposables = [
188970
+ commands$1.registerCommand(
188971
+ "cody.command.autoedit-manual-trigger",
188972
+ async () => provider.manuallyTriggerCompletion()
188973
+ ),
188974
+ languages$1.registerInlineCompletionItemProvider(
188975
+ [{ scheme: "file", language: "*" }, { notebookType: "*" }],
189293
188976
  provider
189294
- ];
189295
- }),
189296
- map$1(() => void 0)
189297
- );
188977
+ ),
188978
+ commands$1.registerCommand("cody.command.autoedit.open-debug-panel", () => {
188979
+ AutoeditDebugPanel.showPanel(context2);
188980
+ }),
188981
+ provider
188982
+ ];
188983
+ return () => {
188984
+ for (const d2 of disposables) {
188985
+ d2.dispose();
188986
+ }
188987
+ };
188988
+ }).pipe(map$1(() => void 0));
189298
188989
  }
189299
188990
  async function handleAutoeditsNotificationForNonEligibleUser(nonEligibilityReason) {
189300
188991
  if (!nonEligibilityReason || !isSettingsEditorOpen()) {
@@ -189329,13 +189020,7 @@ function isSettingsEditorOpen() {
189329
189020
  }
189330
189021
  return activeTab.label === "Settings";
189331
189022
  }
189332
- function isUserEligibleForAutoeditsFeature(autoeditsFeatureFlagEnabled, authStatus2, productSubscription) {
189333
- if (isFreeUser(authStatus2, productSubscription)) {
189334
- return {
189335
- isUserEligible: false,
189336
- nonEligibilityReason: AUTOEDITS_NON_ELIGIBILITY_MESSAGES.PRO_USER_ONLY
189337
- };
189338
- }
189023
+ function isUserEligibleForAutoeditsFeature(autoeditsFeatureFlagEnabled) {
189339
189024
  return {
189340
189025
  isUserEligible: autoeditsFeatureFlagEnabled,
189341
189026
  nonEligibilityReason: autoeditsFeatureFlagEnabled ? void 0 : AUTOEDITS_NON_ELIGIBILITY_MESSAGES.FEATURE_FLAG_NOT_ELIGIBLE
@@ -190623,8 +190308,8 @@ function parseMentionURI(uri) {
190623
190308
  }
190624
190309
  }
190625
190310
  async function execFileAsync(program2, args2, { cwd }) {
190626
- const { promisify } = await import("./util-CCLzYWyF.mjs").then((n) => n.u);
190627
- const { execFile } = await import("./vscode-shim-DpWxvTpJ.mjs").then((n) => n.fR);
190311
+ const { promisify } = await import("./util-D8ltdME7.mjs").then((n) => n.u);
190312
+ const { execFile } = await import("./vscode-shim-Csgwpsv8.mjs").then((n) => n.fx);
190628
190313
  return promisify(execFile)(program2, args2, { cwd });
190629
190314
  }
190630
190315
  var __create = Object.create;
@@ -192596,7 +192281,7 @@ async function getDirectoryMentions(repoName, directoryPath) {
192596
192281
  auth: { serverEndpoint }
192597
192282
  } = await currentResolvedConfig();
192598
192283
  const dataOrError = await graphqlClient.searchFileMatches(query2);
192599
- if (isError$3(dataOrError) || dataOrError === null) {
192284
+ if (!serverEndpoint || isError$3(dataOrError) || dataOrError === null) {
192600
192285
  return [];
192601
192286
  }
192602
192287
  return dataOrError.search.results.results.map((result) => {
@@ -192618,10 +192303,11 @@ async function getDirectoryMentions(repoName, directoryPath) {
192618
192303
  }).filter(isDefined);
192619
192304
  }
192620
192305
  async function getDirectoryItem(query2, repoID, directoryPath) {
192306
+ const directoryRe = directoryPath ? escapeRegExp(directoryPath) : "";
192621
192307
  const dataOrError = await graphqlClient.contextSearch({
192622
192308
  repoIDs: [repoID],
192623
192309
  query: query2,
192624
- filePatterns: [`^${directoryPath}.*`]
192310
+ filePatterns: [`^${directoryRe}.*`]
192625
192311
  });
192626
192312
  if (isError$3(dataOrError) || dataOrError === null) {
192627
192313
  return [];
@@ -193143,6 +192829,37 @@ class EditGuardrails {
193143
192829
  }
193144
192830
  }
193145
192831
  }
192832
+ class GitMetadataForCurrentEditor {
192833
+ constructor() {
192834
+ __publicField2(this, "gitIdentifiersForFile");
192835
+ window$1.onDidChangeActiveTextEditor(() => this.updateStatus());
192836
+ }
192837
+ getGitIdentifiersForFile() {
192838
+ if (this.gitIdentifiersForFile === void 0) {
192839
+ this.updateStatus().catch(() => {
192840
+ });
192841
+ }
192842
+ return this.gitIdentifiersForFile;
192843
+ }
192844
+ async updateStatus() {
192845
+ var _a3, _b2, _c2;
192846
+ let newGitIdentifiersForFile = void 0;
192847
+ const currentFile = (_c2 = (_b2 = (_a3 = getEditor()) == null ? void 0 : _a3.active) == null ? void 0 : _b2.document) == null ? void 0 : _c2.uri;
192848
+ if (currentFile) {
192849
+ const repoName = currentFile ? (await firstResultFromOperation(
192850
+ repoNameResolver.getRepoNamesContainingUri(currentFile)
192851
+ )).at(0) : void 0;
192852
+ const commit2 = gitCommitIdFromGitExtension(currentFile);
192853
+ newGitIdentifiersForFile = {
192854
+ filePath: displayPathWithoutWorkspaceFolderPrefix(currentFile),
192855
+ repoName,
192856
+ commit: commit2
192857
+ };
192858
+ }
192859
+ this.gitIdentifiersForFile = newGitIdentifiersForFile;
192860
+ }
192861
+ }
192862
+ const gitMetadataForCurrentEditor = new GitMetadataForCurrentEditor();
193146
192863
  const MAX_LOGGING_PAYLOAD_SIZE_BYTES = 1024 * 1024;
193147
192864
  class EditLoggingFeatureFlagManager {
193148
192865
  constructor() {
@@ -193316,7 +193033,7 @@ function getEditLoggingContext(param) {
193316
193033
  }
193317
193034
  function shouldLogEditContextItem(payload, isFeatureFlagEnabledForLogging) {
193318
193035
  const authStatus2 = currentAuthStatus();
193319
- if ((isDotComAuthed() || isS2(authStatus2)) && isFeatureFlagEnabledForLogging) {
193036
+ if (isS2(authStatus2) && isFeatureFlagEnabledForLogging) {
193320
193037
  const payloadSize = calculatePayloadSizeInBytes(payload);
193321
193038
  return payloadSize !== void 0 && payloadSize < MAX_LOGGING_PAYLOAD_SIZE_BYTES;
193322
193039
  }
@@ -198961,8 +198678,7 @@ const _CodyStatusBar = class _CodyStatusBar {
198961
198678
  this.errors.changes,
198962
198679
  this.loaders.changes,
198963
198680
  this.ignoreStatus,
198964
- featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyAutoEditExperimentEnabledFeatureFlag),
198965
- promiseFactoryToObservable(async () => await currentUserProductSubscription())
198681
+ featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyAutoEditExperimentEnabledFeatureFlag)
198966
198682
  ).pipe(
198967
198683
  map$1((combined) => {
198968
198684
  return {
@@ -199111,7 +198827,7 @@ const _CodyStatusBar = class _CodyStatusBar {
199111
198827
  assertUnreachable(newState.style);
199112
198828
  }
199113
198829
  }
199114
- buildState(authStatus2, config, errors, loaders, ignoreStatus, autoeditsFeatureFlagEnabled, userProductSubscription2) {
198830
+ buildState(authStatus2, config, errors, loaders, ignoreStatus, autoeditsFeatureFlagEnabled) {
199115
198831
  const tags = /* @__PURE__ */ new Set();
199116
198832
  if (authStatus2.authenticated) {
199117
198833
  tags.add(InvisibleStatusBarTag.IsAuthenticated);
@@ -199155,9 +198871,7 @@ const _CodyStatusBar = class _CodyStatusBar {
199155
198871
  config,
199156
198872
  errors,
199157
198873
  isIgnored: ignoreStatus,
199158
- autoeditsFeatureFlagEnabled,
199159
- userProductSubscription: userProductSubscription2,
199160
- authStatus: authStatus2
198874
+ autoeditsFeatureFlagEnabled
199161
198875
  })
199162
198876
  };
199163
198877
  }
@@ -199190,9 +198904,7 @@ const _CodyStatusBar = class _CodyStatusBar {
199190
198904
  config,
199191
198905
  errors,
199192
198906
  isIgnored: ignoreStatus,
199193
- autoeditsFeatureFlagEnabled,
199194
- userProductSubscription: userProductSubscription2,
199195
- authStatus: authStatus2
198907
+ autoeditsFeatureFlagEnabled
199196
198908
  })
199197
198909
  };
199198
198910
  }
@@ -199207,9 +198919,7 @@ const _CodyStatusBar = class _CodyStatusBar {
199207
198919
  config,
199208
198920
  errors,
199209
198921
  isIgnored: ignoreStatus,
199210
- autoeditsFeatureFlagEnabled,
199211
- userProductSubscription: userProductSubscription2,
199212
- authStatus: authStatus2
198922
+ autoeditsFeatureFlagEnabled
199213
198923
  })
199214
198924
  };
199215
198925
  }
@@ -199219,9 +198929,7 @@ const _CodyStatusBar = class _CodyStatusBar {
199219
198929
  config,
199220
198930
  errors,
199221
198931
  isIgnored: ignoreStatus,
199222
- autoeditsFeatureFlagEnabled,
199223
- userProductSubscription: userProductSubscription2,
199224
- authStatus: authStatus2
198932
+ autoeditsFeatureFlagEnabled
199225
198933
  })
199226
198934
  };
199227
198935
  }
@@ -199247,9 +198955,7 @@ function interactDefault({
199247
198955
  config,
199248
198956
  errors,
199249
198957
  isIgnored,
199250
- autoeditsFeatureFlagEnabled,
199251
- userProductSubscription: userProductSubscription2,
199252
- authStatus: authStatus2
198958
+ autoeditsFeatureFlagEnabled
199253
198959
  }) {
199254
198960
  return async (abort2) => {
199255
198961
  var _a3;
@@ -199327,12 +199033,7 @@ function interactDefault({
199327
199033
  }
199328
199034
  ),
199329
199035
  { label: currentSuggestionMode, kind: QuickPickItemKind.Separator },
199330
- await createFeatureEnumChoice(
199331
- "Code Suggestion Settings",
199332
- autoeditsFeatureFlagEnabled,
199333
- userProductSubscription2,
199334
- authStatus2
199335
- ),
199036
+ await createFeatureEnumChoice("Code Suggestion Settings", autoeditsFeatureFlagEnabled),
199336
199037
  { label: "settings", kind: QuickPickItemKind.Separator },
199337
199038
  {
199338
199039
  label: "$(gear) Cody Extension Settings",
@@ -199400,13 +199101,9 @@ function interactDefault({
199400
199101
  };
199401
199102
  }
199402
199103
  function featureCodySuggestionEnumBuilder(workspaceConfig) {
199403
- return async (name2, autoeditsFeatureFlagEnabled, userProductSubscription2, authStatus2) => {
199104
+ return async (name2, autoeditsFeatureFlagEnabled) => {
199404
199105
  const currentSuggestionMode = await getCurrentCodySuggestionMode(workspaceConfig);
199405
- const { isUserEligible } = isUserEligibleForAutoeditsFeature(
199406
- autoeditsFeatureFlagEnabled,
199407
- authStatus2,
199408
- userProductSubscription2
199409
- );
199106
+ const { isUserEligible } = isUserEligibleForAutoeditsFeature(autoeditsFeatureFlagEnabled);
199410
199107
  const suggestionModes = [
199411
199108
  {
199412
199109
  label: "Autocomplete",
@@ -200231,7 +199928,7 @@ async function start(context2, platform2) {
200231
199928
  if (secretStorage instanceof VSCodeSecretStorage) {
200232
199929
  secretStorage.setStorage(context2.secrets);
200233
199930
  }
200234
- setLogger({ logDebug, logError: logError$1 });
199931
+ setLogger({ logDebug, logError: logError$1, logInfo });
200235
199932
  setClientCapabilities({
200236
199933
  configuration: getConfiguration(),
200237
199934
  agentCapabilities: platform2.extensionClient.capabilities
@@ -200373,13 +200070,6 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
200373
200070
  })
200374
200071
  )
200375
200072
  );
200376
- if (isPlgEsAccessDisabled()) {
200377
- const endpoints = localStorage.getEndpointHistory() || [];
200378
- const endpointsToLogout = endpoints.filter(
200379
- (endpoint) => isDotCom({ endpoint }) || isWorkspaceInstance({ endpoint })
200380
- );
200381
- void Promise.all(endpointsToLogout.map((endpoint) => signOut(endpoint)));
200382
- }
200383
200073
  disposables.push(
200384
200074
  subscriptionDisposable(
200385
200075
  resolvedConfig.subscribe((config) => {