@sourcegraph/cody-web 0.32.12 → 0.34.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.
@@ -17,9 +17,9 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
17
17
  return __privateGet2(obj, member, getter);
18
18
  }
19
19
  });
20
- var _a2, _b, _c, _d, _e, _constructing, _f, _g, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn2, moveToTail_fn, _h, _i, _j, _k, _l;
21
- import { O as Observable, aW as unsubscribe, aX as AsyncSerialScheduler, aY as authStatus, aZ as pick, a_ as distinctUntilChanged$1, a$ as switchMapReplayOperation, b0 as pendingOperation, b1 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b2 as retry$1, b3 as logError$2, aI as firstResultFromOperation, b4 as graphqlClient, b5 as semver, b6 as debounceTime, b7 as interval, b8 as filter$2, b9 as startWith$1, ba as switchMap$1, ax as firstValueFrom$1, ay as skipPendingOperation, bb as logDebug$1, bc as isAbortError, am as ModelTag, bd as getModelInfo, be as CHAT_INPUT_TOKEN_BUDGET, bf as CHAT_OUTPUT_TOKEN_BUDGET, bg as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bh as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, ac as LRUCache$1, bi as TRANSIENT_REFETCH_INTERVAL_HINT, bj as createSubscriber, bk as fromVSCodeEvent, D as isEqual, bl as cenv, ag as lodashExports, bm as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bn as currentAuthStatus, bo as isFileURI, w as wrapInActiveSpan, bp as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bq as onAbort, br as addCodyClientIdentificationHeaders, bs as addTraceparent, bt as addAuthHeaders, bu as fetch$2, bv as verifyResponseCode, H as combineLatest$1, bw as take$2, bx as clientCapabilities, by as shareReplay$1, bz as tap$2, bA as featureFlagProvider, $ as FeatureFlag, a7 as isCodyProUser, bB as isFreeUser, bC as telemetryRecorder, bD as getEnterpriseContextWindow, bE as ANSWER_TOKENS, bF as currentAuthStatusOrNotReadyYet, bG as mockAuthStatus, bH as storeLastValue, bI as resolvedConfig, bJ as userProductSubscription, bK as isEnterpriseUser, bL as ps, bM as GuardrailsMode, bN as currentResolvedConfig, aS as PromptString, a8 as CodyIDE, bO as CORPUS_CONTEXT_ALLOCATION, bP as isCustomModel, bQ as recordErrorToSpan, bR as addClientInfoParams, bS as dependentAbortController, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, C as ContextItemSource, bT as isS2, bU as GIT_OPENCTX_PROVIDER_URI, bV as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, bW as currentOpenCtxController, m as URI, bX as MulticastSubject, bY as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bZ as workspace, p as path, b_ as vscode, b$ as Range, c0 as commands$1, c1 as window$1, c2 as Selection, U as Uri, c3 as AgentEventEmitter, c4 as MarkdownString, c5 as Disposable, c6 as TextEditorRevealType, c7 as ThemeIcon, c8 as StatusBarAlignment, c9 as readFile, ca as env, cb as UIKind, cc as languages$1, c as commonjsGlobal, cd as InvalidAccessTokenError, ce as _baseAssignValue, cf as eq_1, cg as isArrayLike_1, ch as isObjectLike_1, ci as _copyObject, cj as keysIn_1, ck as _cloneBufferExports, cl as _cloneTypedArray, cm as _copyArray, cn as _initCloneObject, co as isArguments_1, cp as isArray_1, cq as isBufferExports, cr as isFunction_1, cs as isObject_1, ct as isPlainObject_1, cu as isTypedArray_1, cv as _Stack, cw as identity_1, cx as _overRest, cy as _setToString, cz as _isIndex, X as isSourcegraphToken, aG as v4, cA as CONFIG_KEY, aP as CodyAutoSuggestionMode, cB as ConfigurationTarget, cC as pathBrowserify, cD as stat, cE as extensions, cF as version$2, cG as setExtensionVersion, cH as withLatestFrom, cI as NEVER$1, cJ as abortableOperation, cK as isNeedsAuthChallengeError, cL as EMPTY$1, cM as disposableSubscription, cN as setAuthStatusObservable, cO as DOTCOM_URL, V as isAvailabilityError, cP as isInvalidAccessTokenError, cQ as normalizeServerEndpointURL, cR as isEnterpriseUserDotComError, cS as ProgressLocation, cT as AuthConfigError, cU as SourcegraphGraphQLAPIClient, cV as isExternalProviderAuthError, cW as isNetworkLikeError, cX as NeedsAuthChallengeError, cY as AvailabilityError, cZ as EnterpriseUserDotComError, c_ as resolveAuth, c$ as QuickPickItemKind, aK as isWorkspaceInstance, d0 as getAuthHeaders, d1 as toLightweightChatTranscript, d2 as SUPPORTED_URI_SCHEMAS, d3 as _baseIsEqual, d4 as keys_1, d5 as _baseGet, d6 as _castPath, d7 as isLength_1, d8 as _toKey, d9 as _isKey, da as toNumber_1, db as _baseFindIndex, dc as require$$0$2, dd as NetworkError, de as isRateLimitError, Q as isAuthError, df as FileType, dg as dedent$1, dh as FoldingRange, di as CancellationTokenSource, dj as SymbolKind, dk as convertGitCloneURLToCodebaseName, ai as isDefined, dl as pluck, dm as toRangeData, dn as Position, dp as DefaultChatCommands, dq as pathFunctionsForURI, dr as uriParseNameAndExtension, ds as uriDirname, dt as Utils$1, du as uriExtname, dv as uriBasename, dw as DefaultEditCommands, dx as subscriptionDisposable, dy as updateGlobalTelemetryInstances, dz as TelemetryRecorderProvider, dA as telemetryRecorderProvider, dB as createGitDiff, dC as catchError$1, dD as AgentWorkspaceEdit, dE as TextDocumentChangeReason, dF as omit$1, dG as displayPathWithoutWorkspaceFolderPrefix, dH as getEditorInsertSpaces, dI as escapeRegExp$1, dJ as TimeoutError, dK as isNetworkError, dL as http, dM as open, dN as defer$2, dO as merge$2, dP as ruleSearchPaths, dQ as isRuleFilename, dR as parseRuleFile, dS as languageFromFilename, f as displayLineRange, e as displayPath, dT as ruleTitle, as as isCodyProModel, dU as debounce_1, aR as isErrorLike, dV as isWindows, dW as GLOBAL_SEARCH_PROVIDER_URI, dX as mentionProvidersMetadata, dY as currentUserProductSubscription, dZ as checkIfEnterpriseUser, d_ as ThemeColor, d$ as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e0 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e1 as CodeLens, e2 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e3 as EndOfLine, e4 as ViewColumn, e5 as Location, e6 as onDidChangeActiveTextEditor, e7 as tabGroups, e8 as workspaceTextDocuments, e9 as visibleTextEditors, ea as onDidChangeVisibleTextEditors, eb as fs, ec as onDidCloseTextDocument, ed as setCreateWebviewPanel, ee as getAugmentedNamespace, ef as extensionConfiguration, eg as main$1, eh as setAgent, ei as setWorkspaceDocuments, ej as setLastOpenedWorkspaceFolder, ek as onDidRegisterNewCodeActionProvider, el as onDidUnregisterNewCodeActionProvider, em as onDidRegisterNewCodeLensProvider, en as onDidUnregisterNewCodeLensProvider, eo as setClientInfo, ep as AgentWorkspaceConfiguration, eq as firstNonPendingAuthStatus, er as workspaceFolders$1, es as setWorkspaceFolders, et as onDidChangeWorkspaceFolders, eu as onDidChangeWindowState, ev as onDidOpenTextDocument, ew as onDidSaveTextDocument, ex as onDidRenameFiles, ey as packageJson, ez as progressBars, eA as CodeActionTriggerKind, eB as CodeAction, eC as UriString, eD as DiagnosticSeverity, eE as diagnostics, eF as isIntegrationTesting, eG as TESTING_TELEMETRY_EXPORTER, eH as dist, eI as completionProvider, eJ as InlineCompletionTriggerKind, eK as currentAuthStatusAuthed, eL as waitUntilComplete, eM as setExtensionConfiguration, eN as onDidChangeConfiguration, eO as onDidChangeTextDocument, eP as onDidChangeTextEditorSelection, eQ as isTokenOrEndpointChange, at as isMacOS, av as CustomCommandType, eR as RelativePattern, aQ as setDisplayPathEnvInfo, aM as ACCOUNT_USAGE_URL, z as debounce$1, eS as structuredPatch, eT as isDotComAuthed, eU as dedupeWith$1, eV as AbortError, eW as createDisposables, eX as isNodeResponse, eY as getClientInfoQueryParams, eZ as tracer, e_ as getActiveTraceAndSpanId, e$ as getClientIdentificationHeaders, f0 as setJSONAcceptContentTypeHeaders, f1 as logResponseHeadersToSpan, f2 as isCustomAuthChallengeResponse, f3 as TracedError, _ as SpanStatusCode, ae as RateLimitError$1, f4 as capitalize, f5 as InlineCompletionItem, f6 as createTwoFilesPatch, f7 as vsCodeMocks, a2 as whitespace, a0 as svg, a3 as find$1, a4 as stringify$1, a5 as stringify$2, a6 as ccount, a1 as html$3, f8 as getEditorTabSize$1, f9 as metrics, fa as _, aH as deserializeContextItem, fb as editorStateFromPromptString, fc as _baseGetTag, al as isAbortErrorOrSocketHangUp, fd as inputTextWithoutContextChipsFromPromptEditorState, an as DeepCodyAgentID, fe as exec, s as spawn, aC as UIToolStatus, i as displayPathBasename, ff as expandToLineRange, fg as openctxController, fh as openCtxProviderMetadata, fi as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aE as diffWithLineNum, aF as UITerminalOutputType, fj as getPlatform$1, fk as PromptMode, fl as skip$1, Z as context, fm as extractContextFromTraceparent, fn as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ak as reformatBotMessageForChat, M as hydrateAfterPostMessage, fo as addMessageListenersForExtensionAPI, fp as createMessageAPIForExtension, ar as View, aJ as ChatHistoryType, fq as CodeActionKind, aB as pluralize, fr as assertFileURI, d as RULES_PROVIDER_URI, fs as createCodeSearchProvider, ft as ProgrammingLanguage, fu as MAX_CURRENT_FILE_TOKENS, fv as psDedent, fw as formatRuleForPrompt, fx as posixFilePaths, fy as DecorationRangeBehavior, fz as SURROUNDING_LINES, fA as diffLines, fB as CODY_SUPPORT_URL, fC as CODY_DOC_URL, fD as CODY_FEEDBACK_URL, fE as DISCORD_URL, fF as globalAgentRef, fG as VSCODE_CHANGELOG_URL, fH as SG_CHANGELOG_URL, fI as ACCOUNT_LIMITS_INFO_URL, fJ as assertUnreachable, fK as promise, fL as ExtensionMode, fM as setLogger, fN as setClientCapabilities, fO as setResolvedConfigurationObservable, fP as setClientNameVersion, fQ as setOpenCtxControllerObservable, aO as browser$4 } from "./vscode-shim-FP11UcS5.mjs";
22
- import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-n4JO9qgH.mjs";
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";
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");
@@ -674,7 +674,7 @@ var __awaiter = function(thisArg, _arguments, P, generator) {
674
674
  step6((generator = generator.apply(thisArg, _arguments || [])).next());
675
675
  });
676
676
  };
677
- function filter$1(test) {
677
+ function filter$2(test) {
678
678
  return (observable) => {
679
679
  return new Observable((observer) => {
680
680
  const scheduler = new AsyncSerialScheduler(observer);
@@ -697,13 +697,13 @@ function filter$1(test) {
697
697
  });
698
698
  };
699
699
  }
700
- var define_process_default$n = { env: {} };
700
+ var define_process_default$o = { env: {} };
701
701
  let _editorWindowIsFocused;
702
702
  function setEditorWindowIsFocused(editorWindowIsFocused2) {
703
703
  _editorWindowIsFocused = editorWindowIsFocused2;
704
704
  }
705
705
  function editorWindowIsFocused() {
706
- if (define_process_default$n.env.VITEST) {
706
+ if (define_process_default$o.env.VITEST) {
707
707
  return true;
708
708
  }
709
709
  if (!_editorWindowIsFocused) {
@@ -830,7 +830,7 @@ function parseDateFromPreReleaseVersion(version2) {
830
830
  return void 0;
831
831
  }
832
832
  }
833
- var define_process_default$m = { env: {} };
833
+ var define_process_default$n = { env: {} };
834
834
  const _ClientConfigSingleton = class _ClientConfigSingleton {
835
835
  constructor() {
836
836
  // Default values for the legacy GraphQL features API, used when a Sourcegraph instance
@@ -855,7 +855,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
855
855
  // activity that can cause OS warnings or authorization flows when the
856
856
  // user is not using Cody. See
857
857
  // linear.app/sourcegraph/issue/CODY-3745/codys-background-periodic-network-access-causes-2fa.
858
- filter$2((_value) => editorWindowIsFocused()),
858
+ filter$3((_value) => editorWindowIsFocused()),
859
859
  startWith$1(void 0),
860
860
  switchMap$1(
861
861
  () => promiseFactoryToObservable((signal2) => this.fetchConfig(signal2))
@@ -867,7 +867,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
867
867
  distinctUntilChanged$1()
868
868
  ));
869
869
  __publicField2(this, "updates", this.changes.pipe(
870
- filter$2((value) => value !== void 0 && value !== pendingOperation),
870
+ filter$3((value) => value !== void 0 && value !== pendingOperation),
871
871
  distinctUntilChanged$1()
872
872
  ));
873
873
  }
@@ -943,6 +943,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
943
943
  message: (notice == null ? void 0 : notice.message) ?? ""
944
944
  })
945
945
  );
946
+ config.chatCodeHighlightingEnabled = (viewerSettings == null ? void 0 : viewerSettings["cody.chatCodeSyntaxHighlightingEnabled"]) ?? true;
946
947
  }
947
948
  return config;
948
949
  });
@@ -1013,7 +1014,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
1013
1014
  };
1014
1015
  __publicField2(_ClientConfigSingleton, "instance");
1015
1016
  // REFETCH_INTERVAL is only updated via process.env during test execution, otherwise it is 60 seconds.
1016
- __publicField2(_ClientConfigSingleton, "REFETCH_INTERVAL", define_process_default$m.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL ? Number.parseInt(define_process_default$m.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL, 10) : 60 * 1e3);
1017
+ __publicField2(_ClientConfigSingleton, "REFETCH_INTERVAL", define_process_default$n.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL ? Number.parseInt(define_process_default$n.env.CODY_CLIENT_CONFIG_SINGLETON_REFETCH_INTERVAL, 10) : 60 * 1e3);
1017
1018
  let ClientConfigSingleton = _ClientConfigSingleton;
1018
1019
  const configOverwrites = authStatus.pipe(
1019
1020
  pick("authenticated", "endpoint", "pendingValidation"),
@@ -1198,7 +1199,7 @@ createModel({
1198
1199
  usage: [ModelUsage.Chat],
1199
1200
  tags: [ModelTag.Enterprise]
1200
1201
  });
1201
- var define_process_default$l = { env: {} };
1202
+ var define_process_default$m = { env: {} };
1202
1203
  const version$1 = "0.5.1";
1203
1204
  class ResponseError extends Error {
1204
1205
  constructor(error, status_code) {
@@ -1238,8 +1239,8 @@ const checkOk = async (response) => {
1238
1239
  function getPlatform() {
1239
1240
  if (typeof window !== "undefined" && window.navigator) {
1240
1241
  return `${window.navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`;
1241
- } else if (typeof define_process_default$l !== "undefined") {
1242
- return `${define_process_default$l.arch} ${define_process_default$l.platform} Node.js/${define_process_default$l.version}`;
1242
+ } else if (typeof define_process_default$m !== "undefined") {
1243
+ return `${define_process_default$m.arch} ${define_process_default$m.platform} Node.js/${define_process_default$m.version}`;
1243
1244
  }
1244
1245
  return "";
1245
1246
  }
@@ -1482,6 +1483,1344 @@ let Ollama$1 = class Ollama {
1482
1483
  }
1483
1484
  };
1484
1485
  const browser$3 = new Ollama$1();
1486
+ const MAX_PATTERN_LENGTH = 1024 * 64;
1487
+ const assertValidPattern = (pattern) => {
1488
+ if (typeof pattern !== "string") {
1489
+ throw new TypeError("invalid pattern");
1490
+ }
1491
+ if (pattern.length > MAX_PATTERN_LENGTH) {
1492
+ throw new TypeError("pattern is too long");
1493
+ }
1494
+ };
1495
+ const posixClasses = {
1496
+ "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
1497
+ "[:alpha:]": ["\\p{L}\\p{Nl}", true],
1498
+ "[:ascii:]": ["\\x00-\\x7f", false],
1499
+ "[:blank:]": ["\\p{Zs}\\t", true],
1500
+ "[:cntrl:]": ["\\p{Cc}", true],
1501
+ "[:digit:]": ["\\p{Nd}", true],
1502
+ "[:graph:]": ["\\p{Z}\\p{C}", true, true],
1503
+ "[:lower:]": ["\\p{Ll}", true],
1504
+ "[:print:]": ["\\p{C}", true],
1505
+ "[:punct:]": ["\\p{P}", true],
1506
+ "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
1507
+ "[:upper:]": ["\\p{Lu}", true],
1508
+ "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
1509
+ "[:xdigit:]": ["A-Fa-f0-9", false]
1510
+ };
1511
+ const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
1512
+ const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1513
+ const rangesToString = (ranges2) => ranges2.join("");
1514
+ const parseClass = (glob, position) => {
1515
+ const pos2 = position;
1516
+ if (glob.charAt(pos2) !== "[") {
1517
+ throw new Error("not in a brace expression");
1518
+ }
1519
+ const ranges2 = [];
1520
+ const negs = [];
1521
+ let i2 = pos2 + 1;
1522
+ let sawStart = false;
1523
+ let uflag = false;
1524
+ let escaping = false;
1525
+ let negate = false;
1526
+ let endPos = pos2;
1527
+ let rangeStart = "";
1528
+ WHILE: while (i2 < glob.length) {
1529
+ const c = glob.charAt(i2);
1530
+ if ((c === "!" || c === "^") && i2 === pos2 + 1) {
1531
+ negate = true;
1532
+ i2++;
1533
+ continue;
1534
+ }
1535
+ if (c === "]" && sawStart && !escaping) {
1536
+ endPos = i2 + 1;
1537
+ break;
1538
+ }
1539
+ sawStart = true;
1540
+ if (c === "\\") {
1541
+ if (!escaping) {
1542
+ escaping = true;
1543
+ i2++;
1544
+ continue;
1545
+ }
1546
+ }
1547
+ if (c === "[" && !escaping) {
1548
+ for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
1549
+ if (glob.startsWith(cls, i2)) {
1550
+ if (rangeStart) {
1551
+ return ["$.", false, glob.length - pos2, true];
1552
+ }
1553
+ i2 += cls.length;
1554
+ if (neg)
1555
+ negs.push(unip);
1556
+ else
1557
+ ranges2.push(unip);
1558
+ uflag = uflag || u;
1559
+ continue WHILE;
1560
+ }
1561
+ }
1562
+ }
1563
+ escaping = false;
1564
+ if (rangeStart) {
1565
+ if (c > rangeStart) {
1566
+ ranges2.push(braceEscape(rangeStart) + "-" + braceEscape(c));
1567
+ } else if (c === rangeStart) {
1568
+ ranges2.push(braceEscape(c));
1569
+ }
1570
+ rangeStart = "";
1571
+ i2++;
1572
+ continue;
1573
+ }
1574
+ if (glob.startsWith("-]", i2 + 1)) {
1575
+ ranges2.push(braceEscape(c + "-"));
1576
+ i2 += 2;
1577
+ continue;
1578
+ }
1579
+ if (glob.startsWith("-", i2 + 1)) {
1580
+ rangeStart = c;
1581
+ i2 += 2;
1582
+ continue;
1583
+ }
1584
+ ranges2.push(braceEscape(c));
1585
+ i2++;
1586
+ }
1587
+ if (endPos < i2) {
1588
+ return ["", false, 0, false];
1589
+ }
1590
+ if (!ranges2.length && !negs.length) {
1591
+ return ["$.", false, glob.length - pos2, true];
1592
+ }
1593
+ if (negs.length === 0 && ranges2.length === 1 && /^\\?.$/.test(ranges2[0]) && !negate) {
1594
+ const r2 = ranges2[0].length === 2 ? ranges2[0].slice(-1) : ranges2[0];
1595
+ return [regexpEscape(r2), false, endPos - pos2, false];
1596
+ }
1597
+ const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges2) + "]";
1598
+ const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
1599
+ const comb = ranges2.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges2.length ? sranges : snegs;
1600
+ return [comb, uflag, endPos - pos2, true];
1601
+ };
1602
+ const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
1603
+ return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
1604
+ };
1605
+ const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
1606
+ const isExtglobType = (c) => types.has(c);
1607
+ const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
1608
+ const startNoDot = "(?!\\.)";
1609
+ const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
1610
+ const justDots = /* @__PURE__ */ new Set(["..", "."]);
1611
+ const reSpecials = new Set("().*{}+?[]^$\\!");
1612
+ const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1613
+ const qmark$1 = "[^/]";
1614
+ const star$2 = qmark$1 + "*?";
1615
+ const starNoEmpty = qmark$1 + "+?";
1616
+ const _AST = class _AST {
1617
+ constructor(type, parent, options = {}) {
1618
+ __privateAdd2(this, _AST_instances);
1619
+ __publicField2(this, "type");
1620
+ __privateAdd2(this, _root);
1621
+ __privateAdd2(this, _hasMagic);
1622
+ __privateAdd2(this, _uflag, false);
1623
+ __privateAdd2(this, _parts, []);
1624
+ __privateAdd2(this, _parent);
1625
+ __privateAdd2(this, _parentIndex);
1626
+ __privateAdd2(this, _negs);
1627
+ __privateAdd2(this, _filledNegs, false);
1628
+ __privateAdd2(this, _options);
1629
+ __privateAdd2(this, _toString);
1630
+ // set to true if it's an extglob with no children
1631
+ // (which really means one child of '')
1632
+ __privateAdd2(this, _emptyExt, false);
1633
+ this.type = type;
1634
+ if (type)
1635
+ __privateSet2(this, _hasMagic, true);
1636
+ __privateSet2(this, _parent, parent);
1637
+ __privateSet2(this, _root, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _root) : this);
1638
+ __privateSet2(this, _options, __privateGet2(this, _root) === this ? options : __privateGet2(__privateGet2(this, _root), _options));
1639
+ __privateSet2(this, _negs, __privateGet2(this, _root) === this ? [] : __privateGet2(__privateGet2(this, _root), _negs));
1640
+ if (type === "!" && !__privateGet2(__privateGet2(this, _root), _filledNegs))
1641
+ __privateGet2(this, _negs).push(this);
1642
+ __privateSet2(this, _parentIndex, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0);
1643
+ }
1644
+ get hasMagic() {
1645
+ if (__privateGet2(this, _hasMagic) !== void 0)
1646
+ return __privateGet2(this, _hasMagic);
1647
+ for (const p2 of __privateGet2(this, _parts)) {
1648
+ if (typeof p2 === "string")
1649
+ continue;
1650
+ if (p2.type || p2.hasMagic)
1651
+ return __privateSet2(this, _hasMagic, true);
1652
+ }
1653
+ return __privateGet2(this, _hasMagic);
1654
+ }
1655
+ // reconstructs the pattern
1656
+ toString() {
1657
+ if (__privateGet2(this, _toString) !== void 0)
1658
+ return __privateGet2(this, _toString);
1659
+ if (!this.type) {
1660
+ return __privateSet2(this, _toString, __privateGet2(this, _parts).map((p2) => String(p2)).join(""));
1661
+ } else {
1662
+ return __privateSet2(this, _toString, this.type + "(" + __privateGet2(this, _parts).map((p2) => String(p2)).join("|") + ")");
1663
+ }
1664
+ }
1665
+ push(...parts2) {
1666
+ for (const p2 of parts2) {
1667
+ if (p2 === "")
1668
+ continue;
1669
+ if (typeof p2 !== "string" && !(p2 instanceof _AST && __privateGet2(p2, _parent) === this)) {
1670
+ throw new Error("invalid part: " + p2);
1671
+ }
1672
+ __privateGet2(this, _parts).push(p2);
1673
+ }
1674
+ }
1675
+ toJSON() {
1676
+ var _a3;
1677
+ const ret2 = this.type === null ? __privateGet2(this, _parts).slice().map((p2) => typeof p2 === "string" ? p2 : p2.toJSON()) : [this.type, ...__privateGet2(this, _parts).map((p2) => p2.toJSON())];
1678
+ if (this.isStart() && !this.type)
1679
+ ret2.unshift([]);
1680
+ if (this.isEnd() && (this === __privateGet2(this, _root) || __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")) {
1681
+ ret2.push({});
1682
+ }
1683
+ return ret2;
1684
+ }
1685
+ isStart() {
1686
+ var _a3;
1687
+ if (__privateGet2(this, _root) === this)
1688
+ return true;
1689
+ if (!((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.isStart()))
1690
+ return false;
1691
+ if (__privateGet2(this, _parentIndex) === 0)
1692
+ return true;
1693
+ const p2 = __privateGet2(this, _parent);
1694
+ for (let i2 = 0; i2 < __privateGet2(this, _parentIndex); i2++) {
1695
+ const pp = __privateGet2(p2, _parts)[i2];
1696
+ if (!(pp instanceof _AST && pp.type === "!")) {
1697
+ return false;
1698
+ }
1699
+ }
1700
+ return true;
1701
+ }
1702
+ isEnd() {
1703
+ var _a3, _b2, _c2;
1704
+ if (__privateGet2(this, _root) === this)
1705
+ return true;
1706
+ if (((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")
1707
+ return true;
1708
+ if (!((_b2 = __privateGet2(this, _parent)) == null ? void 0 : _b2.isEnd()))
1709
+ return false;
1710
+ if (!this.type)
1711
+ return (_c2 = __privateGet2(this, _parent)) == null ? void 0 : _c2.isEnd();
1712
+ const pl = __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0;
1713
+ return __privateGet2(this, _parentIndex) === pl - 1;
1714
+ }
1715
+ copyIn(part) {
1716
+ if (typeof part === "string")
1717
+ this.push(part);
1718
+ else
1719
+ this.push(part.clone(this));
1720
+ }
1721
+ clone(parent) {
1722
+ const c = new _AST(this.type, parent);
1723
+ for (const p2 of __privateGet2(this, _parts)) {
1724
+ c.copyIn(p2);
1725
+ }
1726
+ return c;
1727
+ }
1728
+ static fromGlob(pattern, options = {}) {
1729
+ var _a3;
1730
+ const ast = new _AST(null, void 0, options);
1731
+ __privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, pattern, ast, 0, options);
1732
+ return ast;
1733
+ }
1734
+ // returns the regular expression if there's magic, or the unescaped
1735
+ // string if not.
1736
+ toMMPattern() {
1737
+ if (this !== __privateGet2(this, _root))
1738
+ return __privateGet2(this, _root).toMMPattern();
1739
+ const glob = this.toString();
1740
+ const [re, body2, hasMagic, uflag] = this.toRegExpSource();
1741
+ const anyMagic = hasMagic || __privateGet2(this, _hasMagic) || __privateGet2(this, _options).nocase && !__privateGet2(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
1742
+ if (!anyMagic) {
1743
+ return body2;
1744
+ }
1745
+ const flags2 = (__privateGet2(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
1746
+ return Object.assign(new RegExp(`^${re}$`, flags2), {
1747
+ _src: re,
1748
+ _glob: glob
1749
+ });
1750
+ }
1751
+ get options() {
1752
+ return __privateGet2(this, _options);
1753
+ }
1754
+ // returns the string match, the regexp source, whether there's magic
1755
+ // in the regexp (so a regular expression is required) and whether or
1756
+ // not the uflag is needed for the regular expression (for posix classes)
1757
+ // TODO: instead of injecting the start/end at this point, just return
1758
+ // the BODY of the regexp, along with the start/end portions suitable
1759
+ // for binding the start/end in either a joined full-path makeRe context
1760
+ // (where we bind to (^|/), or a standalone matchPart context (where
1761
+ // we bind to ^, and not /). Otherwise slashes get duped!
1762
+ //
1763
+ // In part-matching mode, the start is:
1764
+ // - if not isStart: nothing
1765
+ // - if traversal possible, but not allowed: ^(?!\.\.?$)
1766
+ // - if dots allowed or not possible: ^
1767
+ // - if dots possible and not allowed: ^(?!\.)
1768
+ // end is:
1769
+ // - if not isEnd(): nothing
1770
+ // - else: $
1771
+ //
1772
+ // In full-path matching mode, we put the slash at the START of the
1773
+ // pattern, so start is:
1774
+ // - if first pattern: same as part-matching mode
1775
+ // - if not isStart(): nothing
1776
+ // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
1777
+ // - if dots allowed or not possible: /
1778
+ // - if dots possible and not allowed: /(?!\.)
1779
+ // end is:
1780
+ // - if last pattern, same as part-matching mode
1781
+ // - else nothing
1782
+ //
1783
+ // Always put the (?:$|/) on negated tails, though, because that has to be
1784
+ // there to bind the end of the negated pattern portion, and it's easier to
1785
+ // just stick it in now rather than try to inject it later in the middle of
1786
+ // the pattern.
1787
+ //
1788
+ // We can just always return the same end, and leave it up to the caller
1789
+ // to know whether it's going to be used joined or in parts.
1790
+ // And, if the start is adjusted slightly, can do the same there:
1791
+ // - if not isStart: nothing
1792
+ // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
1793
+ // - if dots allowed or not possible: (?:/|^)
1794
+ // - if dots possible and not allowed: (?:/|^)(?!\.)
1795
+ //
1796
+ // But it's better to have a simpler binding without a conditional, for
1797
+ // performance, so probably better to return both start options.
1798
+ //
1799
+ // Then the caller just ignores the end if it's not the first pattern,
1800
+ // and the start always gets applied.
1801
+ //
1802
+ // But that's always going to be $ if it's the ending pattern, or nothing,
1803
+ // so the caller can just attach $ at the end of the pattern when building.
1804
+ //
1805
+ // So the todo is:
1806
+ // - better detect what kind of start is needed
1807
+ // - return both flavors of starting pattern
1808
+ // - attach $ at the end of the pattern when creating the actual RegExp
1809
+ //
1810
+ // Ah, but wait, no, that all only applies to the root when the first pattern
1811
+ // is not an extglob. If the first pattern IS an extglob, then we need all
1812
+ // that dot prevention biz to live in the extglob portions, because eg
1813
+ // +(*|.x*) can match .xy but not .yx.
1814
+ //
1815
+ // So, return the two flavors if it's #root and the first child is not an
1816
+ // AST, otherwise leave it to the child AST to handle it, and there,
1817
+ // use the (?:^|/) style of start binding.
1818
+ //
1819
+ // Even simplified further:
1820
+ // - Since the start for a join is eg /(?!\.) and the start for a part
1821
+ // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
1822
+ // or start or whatever) and prepend ^ or / at the Regexp construction.
1823
+ toRegExpSource(allowDot) {
1824
+ var _a3;
1825
+ const dot2 = allowDot ?? !!__privateGet2(this, _options).dot;
1826
+ if (__privateGet2(this, _root) === this)
1827
+ __privateMethod2(this, _AST_instances, fillNegs_fn).call(this);
1828
+ if (!this.type) {
1829
+ const noEmpty = this.isStart() && this.isEnd();
1830
+ const src = __privateGet2(this, _parts).map((p2) => {
1831
+ var _a4;
1832
+ const [re, _2, hasMagic, uflag] = typeof p2 === "string" ? __privateMethod2(_a4 = _AST, _AST_static, parseGlob_fn).call(_a4, p2, __privateGet2(this, _hasMagic), noEmpty) : p2.toRegExpSource(allowDot);
1833
+ __privateSet2(this, _hasMagic, __privateGet2(this, _hasMagic) || hasMagic);
1834
+ __privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
1835
+ return re;
1836
+ }).join("");
1837
+ let start3 = "";
1838
+ if (this.isStart()) {
1839
+ if (typeof __privateGet2(this, _parts)[0] === "string") {
1840
+ const dotTravAllowed = __privateGet2(this, _parts).length === 1 && justDots.has(__privateGet2(this, _parts)[0]);
1841
+ if (!dotTravAllowed) {
1842
+ const aps = addPatternStart;
1843
+ const needNoTrav = (
1844
+ // dots are allowed, and the pattern starts with [ or .
1845
+ dot2 && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
1846
+ src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
1847
+ src.startsWith("\\.\\.") && aps.has(src.charAt(4))
1848
+ );
1849
+ const needNoDot = !dot2 && !allowDot && aps.has(src.charAt(0));
1850
+ start3 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
1851
+ }
1852
+ }
1853
+ }
1854
+ let end = "";
1855
+ if (this.isEnd() && __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!") {
1856
+ end = "(?:$|\\/)";
1857
+ }
1858
+ const final2 = start3 + src + end;
1859
+ return [
1860
+ final2,
1861
+ unescape(src),
1862
+ __privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
1863
+ __privateGet2(this, _uflag)
1864
+ ];
1865
+ }
1866
+ const repeated = this.type === "*" || this.type === "+";
1867
+ const start2 = this.type === "!" ? "(?:(?!(?:" : "(?:";
1868
+ let body2 = __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, dot2);
1869
+ if (this.isStart() && this.isEnd() && !body2 && this.type !== "!") {
1870
+ const s = this.toString();
1871
+ __privateSet2(this, _parts, [s]);
1872
+ this.type = null;
1873
+ __privateSet2(this, _hasMagic, void 0);
1874
+ return [s, unescape(this.toString()), false, false];
1875
+ }
1876
+ let bodyDotAllowed = !repeated || allowDot || dot2 || !startNoDot ? "" : __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, true);
1877
+ if (bodyDotAllowed === body2) {
1878
+ bodyDotAllowed = "";
1879
+ }
1880
+ if (bodyDotAllowed) {
1881
+ body2 = `(?:${body2})(?:${bodyDotAllowed})*?`;
1882
+ }
1883
+ let final = "";
1884
+ if (this.type === "!" && __privateGet2(this, _emptyExt)) {
1885
+ final = (this.isStart() && !dot2 ? startNoDot : "") + starNoEmpty;
1886
+ } else {
1887
+ const close = this.type === "!" ? (
1888
+ // !() must match something,but !(x) can match ''
1889
+ "))" + (this.isStart() && !dot2 && !allowDot ? startNoDot : "") + star$2 + ")"
1890
+ ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
1891
+ final = start2 + body2 + close;
1892
+ }
1893
+ return [
1894
+ final,
1895
+ unescape(body2),
1896
+ __privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
1897
+ __privateGet2(this, _uflag)
1898
+ ];
1899
+ }
1900
+ };
1901
+ _root = new WeakMap();
1902
+ _hasMagic = new WeakMap();
1903
+ _uflag = new WeakMap();
1904
+ _parts = new WeakMap();
1905
+ _parent = new WeakMap();
1906
+ _parentIndex = new WeakMap();
1907
+ _negs = new WeakMap();
1908
+ _filledNegs = new WeakMap();
1909
+ _options = new WeakMap();
1910
+ _toString = new WeakMap();
1911
+ _emptyExt = new WeakMap();
1912
+ _AST_instances = new WeakSet();
1913
+ fillNegs_fn = function() {
1914
+ if (this !== __privateGet2(this, _root))
1915
+ throw new Error("should only call on root");
1916
+ if (__privateGet2(this, _filledNegs))
1917
+ return this;
1918
+ this.toString();
1919
+ __privateSet2(this, _filledNegs, true);
1920
+ let n;
1921
+ while (n = __privateGet2(this, _negs).pop()) {
1922
+ if (n.type !== "!")
1923
+ continue;
1924
+ let p2 = n;
1925
+ let pp = __privateGet2(p2, _parent);
1926
+ while (pp) {
1927
+ for (let i2 = __privateGet2(p2, _parentIndex) + 1; !pp.type && i2 < __privateGet2(pp, _parts).length; i2++) {
1928
+ for (const part of __privateGet2(n, _parts)) {
1929
+ if (typeof part === "string") {
1930
+ throw new Error("string part in extglob AST??");
1931
+ }
1932
+ part.copyIn(__privateGet2(pp, _parts)[i2]);
1933
+ }
1934
+ }
1935
+ p2 = pp;
1936
+ pp = __privateGet2(p2, _parent);
1937
+ }
1938
+ }
1939
+ return this;
1940
+ };
1941
+ _AST_static = new WeakSet();
1942
+ parseAST_fn = function(str, ast, pos2, opt) {
1943
+ var _a3, _b2;
1944
+ let escaping = false;
1945
+ let inBrace = false;
1946
+ let braceStart = -1;
1947
+ let braceNeg = false;
1948
+ if (ast.type === null) {
1949
+ let i3 = pos2;
1950
+ let acc2 = "";
1951
+ while (i3 < str.length) {
1952
+ const c = str.charAt(i3++);
1953
+ if (escaping || c === "\\") {
1954
+ escaping = !escaping;
1955
+ acc2 += c;
1956
+ continue;
1957
+ }
1958
+ if (inBrace) {
1959
+ if (i3 === braceStart + 1) {
1960
+ if (c === "^" || c === "!") {
1961
+ braceNeg = true;
1962
+ }
1963
+ } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
1964
+ inBrace = false;
1965
+ }
1966
+ acc2 += c;
1967
+ continue;
1968
+ } else if (c === "[") {
1969
+ inBrace = true;
1970
+ braceStart = i3;
1971
+ braceNeg = false;
1972
+ acc2 += c;
1973
+ continue;
1974
+ }
1975
+ if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
1976
+ ast.push(acc2);
1977
+ acc2 = "";
1978
+ const ext2 = new _AST(c, ast);
1979
+ i3 = __privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, str, ext2, i3, opt);
1980
+ ast.push(ext2);
1981
+ continue;
1982
+ }
1983
+ acc2 += c;
1984
+ }
1985
+ ast.push(acc2);
1986
+ return i3;
1987
+ }
1988
+ let i2 = pos2 + 1;
1989
+ let part = new _AST(null, ast);
1990
+ const parts2 = [];
1991
+ let acc = "";
1992
+ while (i2 < str.length) {
1993
+ const c = str.charAt(i2++);
1994
+ if (escaping || c === "\\") {
1995
+ escaping = !escaping;
1996
+ acc += c;
1997
+ continue;
1998
+ }
1999
+ if (inBrace) {
2000
+ if (i2 === braceStart + 1) {
2001
+ if (c === "^" || c === "!") {
2002
+ braceNeg = true;
2003
+ }
2004
+ } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
2005
+ inBrace = false;
2006
+ }
2007
+ acc += c;
2008
+ continue;
2009
+ } else if (c === "[") {
2010
+ inBrace = true;
2011
+ braceStart = i2;
2012
+ braceNeg = false;
2013
+ acc += c;
2014
+ continue;
2015
+ }
2016
+ if (isExtglobType(c) && str.charAt(i2) === "(") {
2017
+ part.push(acc);
2018
+ acc = "";
2019
+ const ext2 = new _AST(c, part);
2020
+ part.push(ext2);
2021
+ i2 = __privateMethod2(_b2 = _AST, _AST_static, parseAST_fn).call(_b2, str, ext2, i2, opt);
2022
+ continue;
2023
+ }
2024
+ if (c === "|") {
2025
+ part.push(acc);
2026
+ acc = "";
2027
+ parts2.push(part);
2028
+ part = new _AST(null, ast);
2029
+ continue;
2030
+ }
2031
+ if (c === ")") {
2032
+ if (acc === "" && __privateGet2(ast, _parts).length === 0) {
2033
+ __privateSet2(ast, _emptyExt, true);
2034
+ }
2035
+ part.push(acc);
2036
+ acc = "";
2037
+ ast.push(...parts2, part);
2038
+ return i2;
2039
+ }
2040
+ acc += c;
2041
+ }
2042
+ ast.type = null;
2043
+ __privateSet2(ast, _hasMagic, void 0);
2044
+ __privateSet2(ast, _parts, [str.substring(pos2 - 1)]);
2045
+ return i2;
2046
+ };
2047
+ partsToRegExp_fn = function(dot2) {
2048
+ return __privateGet2(this, _parts).map((p2) => {
2049
+ if (typeof p2 === "string") {
2050
+ throw new Error("string type in extglob ast??");
2051
+ }
2052
+ const [re, _2, _hasMagic2, uflag] = p2.toRegExpSource(dot2);
2053
+ __privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
2054
+ return re;
2055
+ }).filter((p2) => !(this.isStart() && this.isEnd()) || !!p2).join("|");
2056
+ };
2057
+ parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
2058
+ let escaping = false;
2059
+ let re = "";
2060
+ let uflag = false;
2061
+ for (let i2 = 0; i2 < glob.length; i2++) {
2062
+ const c = glob.charAt(i2);
2063
+ if (escaping) {
2064
+ escaping = false;
2065
+ re += (reSpecials.has(c) ? "\\" : "") + c;
2066
+ continue;
2067
+ }
2068
+ if (c === "\\") {
2069
+ if (i2 === glob.length - 1) {
2070
+ re += "\\\\";
2071
+ } else {
2072
+ escaping = true;
2073
+ }
2074
+ continue;
2075
+ }
2076
+ if (c === "[") {
2077
+ const [src, needUflag, consumed, magic] = parseClass(glob, i2);
2078
+ if (consumed) {
2079
+ re += src;
2080
+ uflag = uflag || needUflag;
2081
+ i2 += consumed - 1;
2082
+ hasMagic = hasMagic || magic;
2083
+ continue;
2084
+ }
2085
+ }
2086
+ if (c === "*") {
2087
+ if (noEmpty && glob === "*")
2088
+ re += starNoEmpty;
2089
+ else
2090
+ re += star$2;
2091
+ hasMagic = true;
2092
+ continue;
2093
+ }
2094
+ if (c === "?") {
2095
+ re += qmark$1;
2096
+ hasMagic = true;
2097
+ continue;
2098
+ }
2099
+ re += regExpEscape$1(c);
2100
+ }
2101
+ return [re, unescape(glob), !!hasMagic, uflag];
2102
+ };
2103
+ __privateAdd2(_AST, _AST_static);
2104
+ let AST = _AST;
2105
+ const escape$1 = (s, { windowsPathsNoEscape = false } = {}) => {
2106
+ return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
2107
+ };
2108
+ var define_process_default$l = { env: {} };
2109
+ const minimatch = (p2, pattern, options = {}) => {
2110
+ assertValidPattern(pattern);
2111
+ if (!options.nocomment && pattern.charAt(0) === "#") {
2112
+ return false;
2113
+ }
2114
+ return new Minimatch(pattern, options).match(p2);
2115
+ };
2116
+ const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
2117
+ const starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
2118
+ const starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
2119
+ const starDotExtTestNocase = (ext2) => {
2120
+ ext2 = ext2.toLowerCase();
2121
+ return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
2122
+ };
2123
+ const starDotExtTestNocaseDot = (ext2) => {
2124
+ ext2 = ext2.toLowerCase();
2125
+ return (f) => f.toLowerCase().endsWith(ext2);
2126
+ };
2127
+ const starDotStarRE = /^\*+\.\*+$/;
2128
+ const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
2129
+ const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
2130
+ const dotStarRE = /^\.\*+$/;
2131
+ const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
2132
+ const starRE = /^\*+$/;
2133
+ const starTest = (f) => f.length !== 0 && !f.startsWith(".");
2134
+ const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
2135
+ const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
2136
+ const qmarksTestNocase = ([$0, ext2 = ""]) => {
2137
+ const noext = qmarksTestNoExt([$0]);
2138
+ if (!ext2)
2139
+ return noext;
2140
+ ext2 = ext2.toLowerCase();
2141
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
2142
+ };
2143
+ const qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
2144
+ const noext = qmarksTestNoExtDot([$0]);
2145
+ if (!ext2)
2146
+ return noext;
2147
+ ext2 = ext2.toLowerCase();
2148
+ return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
2149
+ };
2150
+ const qmarksTestDot = ([$0, ext2 = ""]) => {
2151
+ const noext = qmarksTestNoExtDot([$0]);
2152
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
2153
+ };
2154
+ const qmarksTest = ([$0, ext2 = ""]) => {
2155
+ const noext = qmarksTestNoExt([$0]);
2156
+ return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
2157
+ };
2158
+ const qmarksTestNoExt = ([$0]) => {
2159
+ const len2 = $0.length;
2160
+ return (f) => f.length === len2 && !f.startsWith(".");
2161
+ };
2162
+ const qmarksTestNoExtDot = ([$0]) => {
2163
+ const len2 = $0.length;
2164
+ return (f) => f.length === len2 && f !== "." && f !== "..";
2165
+ };
2166
+ const defaultPlatform = typeof define_process_default$l === "object" && define_process_default$l ? typeof define_process_default$l.env === "object" && define_process_default$l.env && define_process_default$l.env.__MINIMATCH_TESTING_PLATFORM__ || define_process_default$l.platform : "posix";
2167
+ const path = {
2168
+ win32: { sep: "\\" },
2169
+ posix: { sep: "/" }
2170
+ };
2171
+ const sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
2172
+ minimatch.sep = sep;
2173
+ const GLOBSTAR = Symbol("globstar **");
2174
+ minimatch.GLOBSTAR = GLOBSTAR;
2175
+ const qmark = "[^/]";
2176
+ const star$1 = qmark + "*?";
2177
+ const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
2178
+ const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
2179
+ const filter$1 = (pattern, options = {}) => (p2) => minimatch(p2, pattern, options);
2180
+ minimatch.filter = filter$1;
2181
+ const ext = (a, b = {}) => Object.assign({}, a, b);
2182
+ const defaults = (def) => {
2183
+ if (!def || typeof def !== "object" || !Object.keys(def).length) {
2184
+ return minimatch;
2185
+ }
2186
+ const orig = minimatch;
2187
+ const m = (p2, pattern, options = {}) => orig(p2, pattern, ext(def, options));
2188
+ return Object.assign(m, {
2189
+ Minimatch: class Minimatch extends orig.Minimatch {
2190
+ constructor(pattern, options = {}) {
2191
+ super(pattern, ext(def, options));
2192
+ }
2193
+ static defaults(options) {
2194
+ return orig.defaults(ext(def, options)).Minimatch;
2195
+ }
2196
+ },
2197
+ AST: class AST extends orig.AST {
2198
+ /* c8 ignore start */
2199
+ constructor(type, parent, options = {}) {
2200
+ super(type, parent, ext(def, options));
2201
+ }
2202
+ /* c8 ignore stop */
2203
+ static fromGlob(pattern, options = {}) {
2204
+ return orig.AST.fromGlob(pattern, ext(def, options));
2205
+ }
2206
+ },
2207
+ unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
2208
+ escape: (s, options = {}) => orig.escape(s, ext(def, options)),
2209
+ filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
2210
+ defaults: (options) => orig.defaults(ext(def, options)),
2211
+ makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
2212
+ braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
2213
+ match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
2214
+ sep: orig.sep,
2215
+ GLOBSTAR
2216
+ });
2217
+ };
2218
+ minimatch.defaults = defaults;
2219
+ const braceExpand = (pattern, options = {}) => {
2220
+ assertValidPattern(pattern);
2221
+ if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
2222
+ return [pattern];
2223
+ }
2224
+ return expand(pattern);
2225
+ };
2226
+ minimatch.braceExpand = braceExpand;
2227
+ const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
2228
+ minimatch.makeRe = makeRe;
2229
+ const match$1 = (list, pattern, options = {}) => {
2230
+ const mm = new Minimatch(pattern, options);
2231
+ list = list.filter((f) => mm.match(f));
2232
+ if (mm.options.nonull && !list.length) {
2233
+ list.push(pattern);
2234
+ }
2235
+ return list;
2236
+ };
2237
+ minimatch.match = match$1;
2238
+ const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
2239
+ const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2240
+ class Minimatch {
2241
+ constructor(pattern, options = {}) {
2242
+ __publicField2(this, "options");
2243
+ __publicField2(this, "set");
2244
+ __publicField2(this, "pattern");
2245
+ __publicField2(this, "windowsPathsNoEscape");
2246
+ __publicField2(this, "nonegate");
2247
+ __publicField2(this, "negate");
2248
+ __publicField2(this, "comment");
2249
+ __publicField2(this, "empty");
2250
+ __publicField2(this, "preserveMultipleSlashes");
2251
+ __publicField2(this, "partial");
2252
+ __publicField2(this, "globSet");
2253
+ __publicField2(this, "globParts");
2254
+ __publicField2(this, "nocase");
2255
+ __publicField2(this, "isWindows");
2256
+ __publicField2(this, "platform");
2257
+ __publicField2(this, "windowsNoMagicRoot");
2258
+ __publicField2(this, "regexp");
2259
+ assertValidPattern(pattern);
2260
+ options = options || {};
2261
+ this.options = options;
2262
+ this.pattern = pattern;
2263
+ this.platform = options.platform || defaultPlatform;
2264
+ this.isWindows = this.platform === "win32";
2265
+ this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
2266
+ if (this.windowsPathsNoEscape) {
2267
+ this.pattern = this.pattern.replace(/\\/g, "/");
2268
+ }
2269
+ this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
2270
+ this.regexp = null;
2271
+ this.negate = false;
2272
+ this.nonegate = !!options.nonegate;
2273
+ this.comment = false;
2274
+ this.empty = false;
2275
+ this.partial = !!options.partial;
2276
+ this.nocase = !!this.options.nocase;
2277
+ this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
2278
+ this.globSet = [];
2279
+ this.globParts = [];
2280
+ this.set = [];
2281
+ this.make();
2282
+ }
2283
+ hasMagic() {
2284
+ if (this.options.magicalBraces && this.set.length > 1) {
2285
+ return true;
2286
+ }
2287
+ for (const pattern of this.set) {
2288
+ for (const part of pattern) {
2289
+ if (typeof part !== "string")
2290
+ return true;
2291
+ }
2292
+ }
2293
+ return false;
2294
+ }
2295
+ debug(..._2) {
2296
+ }
2297
+ make() {
2298
+ const pattern = this.pattern;
2299
+ const options = this.options;
2300
+ if (!options.nocomment && pattern.charAt(0) === "#") {
2301
+ this.comment = true;
2302
+ return;
2303
+ }
2304
+ if (!pattern) {
2305
+ this.empty = true;
2306
+ return;
2307
+ }
2308
+ this.parseNegate();
2309
+ this.globSet = [...new Set(this.braceExpand())];
2310
+ if (options.debug) {
2311
+ this.debug = (...args2) => console.error(...args2);
2312
+ }
2313
+ this.debug(this.pattern, this.globSet);
2314
+ const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
2315
+ this.globParts = this.preprocess(rawGlobParts);
2316
+ this.debug(this.pattern, this.globParts);
2317
+ let set2 = this.globParts.map((s, _2, __) => {
2318
+ if (this.isWindows && this.windowsNoMagicRoot) {
2319
+ const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
2320
+ const isDrive = /^[a-z]:/i.test(s[0]);
2321
+ if (isUNC) {
2322
+ return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
2323
+ } else if (isDrive) {
2324
+ return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
2325
+ }
2326
+ }
2327
+ return s.map((ss) => this.parse(ss));
2328
+ });
2329
+ this.debug(this.pattern, set2);
2330
+ this.set = set2.filter((s) => s.indexOf(false) === -1);
2331
+ if (this.isWindows) {
2332
+ for (let i2 = 0; i2 < this.set.length; i2++) {
2333
+ const p2 = this.set[i2];
2334
+ if (p2[0] === "" && p2[1] === "" && this.globParts[i2][2] === "?" && typeof p2[3] === "string" && /^[a-z]:$/i.test(p2[3])) {
2335
+ p2[2] = "?";
2336
+ }
2337
+ }
2338
+ }
2339
+ this.debug(this.pattern, this.set);
2340
+ }
2341
+ // various transforms to equivalent pattern sets that are
2342
+ // faster to process in a filesystem walk. The goal is to
2343
+ // eliminate what we can, and push all ** patterns as far
2344
+ // to the right as possible, even if it increases the number
2345
+ // of patterns that we have to process.
2346
+ preprocess(globParts) {
2347
+ if (this.options.noglobstar) {
2348
+ for (let i2 = 0; i2 < globParts.length; i2++) {
2349
+ for (let j = 0; j < globParts[i2].length; j++) {
2350
+ if (globParts[i2][j] === "**") {
2351
+ globParts[i2][j] = "*";
2352
+ }
2353
+ }
2354
+ }
2355
+ }
2356
+ const { optimizationLevel = 1 } = this.options;
2357
+ if (optimizationLevel >= 2) {
2358
+ globParts = this.firstPhasePreProcess(globParts);
2359
+ globParts = this.secondPhasePreProcess(globParts);
2360
+ } else if (optimizationLevel >= 1) {
2361
+ globParts = this.levelOneOptimize(globParts);
2362
+ } else {
2363
+ globParts = this.adjascentGlobstarOptimize(globParts);
2364
+ }
2365
+ return globParts;
2366
+ }
2367
+ // just get rid of adjascent ** portions
2368
+ adjascentGlobstarOptimize(globParts) {
2369
+ return globParts.map((parts2) => {
2370
+ let gs = -1;
2371
+ while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
2372
+ let i2 = gs;
2373
+ while (parts2[i2 + 1] === "**") {
2374
+ i2++;
2375
+ }
2376
+ if (i2 !== gs) {
2377
+ parts2.splice(gs, i2 - gs);
2378
+ }
2379
+ }
2380
+ return parts2;
2381
+ });
2382
+ }
2383
+ // get rid of adjascent ** and resolve .. portions
2384
+ levelOneOptimize(globParts) {
2385
+ return globParts.map((parts2) => {
2386
+ parts2 = parts2.reduce((set2, part) => {
2387
+ const prev = set2[set2.length - 1];
2388
+ if (part === "**" && prev === "**") {
2389
+ return set2;
2390
+ }
2391
+ if (part === "..") {
2392
+ if (prev && prev !== ".." && prev !== "." && prev !== "**") {
2393
+ set2.pop();
2394
+ return set2;
2395
+ }
2396
+ }
2397
+ set2.push(part);
2398
+ return set2;
2399
+ }, []);
2400
+ return parts2.length === 0 ? [""] : parts2;
2401
+ });
2402
+ }
2403
+ levelTwoFileOptimize(parts2) {
2404
+ if (!Array.isArray(parts2)) {
2405
+ parts2 = this.slashSplit(parts2);
2406
+ }
2407
+ let didSomething = false;
2408
+ do {
2409
+ didSomething = false;
2410
+ if (!this.preserveMultipleSlashes) {
2411
+ for (let i2 = 1; i2 < parts2.length - 1; i2++) {
2412
+ const p2 = parts2[i2];
2413
+ if (i2 === 1 && p2 === "" && parts2[0] === "")
2414
+ continue;
2415
+ if (p2 === "." || p2 === "") {
2416
+ didSomething = true;
2417
+ parts2.splice(i2, 1);
2418
+ i2--;
2419
+ }
2420
+ }
2421
+ if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
2422
+ didSomething = true;
2423
+ parts2.pop();
2424
+ }
2425
+ }
2426
+ let dd2 = 0;
2427
+ while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
2428
+ const p2 = parts2[dd2 - 1];
2429
+ if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
2430
+ didSomething = true;
2431
+ parts2.splice(dd2 - 1, 2);
2432
+ dd2 -= 2;
2433
+ }
2434
+ }
2435
+ } while (didSomething);
2436
+ return parts2.length === 0 ? [""] : parts2;
2437
+ }
2438
+ // First phase: single-pattern processing
2439
+ // <pre> is 1 or more portions
2440
+ // <rest> is 1 or more portions
2441
+ // <p> is any portion other than ., .., '', or **
2442
+ // <e> is . or ''
2443
+ //
2444
+ // **/.. is *brutal* for filesystem walking performance, because
2445
+ // it effectively resets the recursive walk each time it occurs,
2446
+ // and ** cannot be reduced out by a .. pattern part like a regexp
2447
+ // or most strings (other than .., ., and '') can be.
2448
+ //
2449
+ // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
2450
+ // <pre>/<e>/<rest> -> <pre>/<rest>
2451
+ // <pre>/<p>/../<rest> -> <pre>/<rest>
2452
+ // **/**/<rest> -> **/<rest>
2453
+ //
2454
+ // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
2455
+ // this WOULD be allowed if ** did follow symlinks, or * didn't
2456
+ firstPhasePreProcess(globParts) {
2457
+ let didSomething = false;
2458
+ do {
2459
+ didSomething = false;
2460
+ for (let parts2 of globParts) {
2461
+ let gs = -1;
2462
+ while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
2463
+ let gss = gs;
2464
+ while (parts2[gss + 1] === "**") {
2465
+ gss++;
2466
+ }
2467
+ if (gss > gs) {
2468
+ parts2.splice(gs + 1, gss - gs);
2469
+ }
2470
+ let next = parts2[gs + 1];
2471
+ const p2 = parts2[gs + 2];
2472
+ const p22 = parts2[gs + 3];
2473
+ if (next !== "..")
2474
+ continue;
2475
+ if (!p2 || p2 === "." || p2 === ".." || !p22 || p22 === "." || p22 === "..") {
2476
+ continue;
2477
+ }
2478
+ didSomething = true;
2479
+ parts2.splice(gs, 1);
2480
+ const other = parts2.slice(0);
2481
+ other[gs] = "**";
2482
+ globParts.push(other);
2483
+ gs--;
2484
+ }
2485
+ if (!this.preserveMultipleSlashes) {
2486
+ for (let i2 = 1; i2 < parts2.length - 1; i2++) {
2487
+ const p2 = parts2[i2];
2488
+ if (i2 === 1 && p2 === "" && parts2[0] === "")
2489
+ continue;
2490
+ if (p2 === "." || p2 === "") {
2491
+ didSomething = true;
2492
+ parts2.splice(i2, 1);
2493
+ i2--;
2494
+ }
2495
+ }
2496
+ if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
2497
+ didSomething = true;
2498
+ parts2.pop();
2499
+ }
2500
+ }
2501
+ let dd2 = 0;
2502
+ while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
2503
+ const p2 = parts2[dd2 - 1];
2504
+ if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
2505
+ didSomething = true;
2506
+ const needDot = dd2 === 1 && parts2[dd2 + 1] === "**";
2507
+ const splin = needDot ? ["."] : [];
2508
+ parts2.splice(dd2 - 1, 2, ...splin);
2509
+ if (parts2.length === 0)
2510
+ parts2.push("");
2511
+ dd2 -= 2;
2512
+ }
2513
+ }
2514
+ }
2515
+ } while (didSomething);
2516
+ return globParts;
2517
+ }
2518
+ // second phase: multi-pattern dedupes
2519
+ // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
2520
+ // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
2521
+ // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
2522
+ //
2523
+ // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
2524
+ // ^-- not valid because ** doens't follow symlinks
2525
+ secondPhasePreProcess(globParts) {
2526
+ for (let i2 = 0; i2 < globParts.length - 1; i2++) {
2527
+ for (let j = i2 + 1; j < globParts.length; j++) {
2528
+ const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
2529
+ if (!matched)
2530
+ continue;
2531
+ globParts[i2] = matched;
2532
+ globParts[j] = [];
2533
+ }
2534
+ }
2535
+ return globParts.filter((gs) => gs.length);
2536
+ }
2537
+ partsMatch(a, b, emptyGSMatch = false) {
2538
+ let ai = 0;
2539
+ let bi = 0;
2540
+ let result = [];
2541
+ let which = "";
2542
+ while (ai < a.length && bi < b.length) {
2543
+ if (a[ai] === b[bi]) {
2544
+ result.push(which === "b" ? b[bi] : a[ai]);
2545
+ ai++;
2546
+ bi++;
2547
+ } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
2548
+ result.push(a[ai]);
2549
+ ai++;
2550
+ } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
2551
+ result.push(b[bi]);
2552
+ bi++;
2553
+ } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
2554
+ if (which === "b")
2555
+ return false;
2556
+ which = "a";
2557
+ result.push(a[ai]);
2558
+ ai++;
2559
+ bi++;
2560
+ } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
2561
+ if (which === "a")
2562
+ return false;
2563
+ which = "b";
2564
+ result.push(b[bi]);
2565
+ ai++;
2566
+ bi++;
2567
+ } else {
2568
+ return false;
2569
+ }
2570
+ }
2571
+ return a.length === b.length && result;
2572
+ }
2573
+ parseNegate() {
2574
+ if (this.nonegate)
2575
+ return;
2576
+ const pattern = this.pattern;
2577
+ let negate = false;
2578
+ let negateOffset = 0;
2579
+ for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
2580
+ negate = !negate;
2581
+ negateOffset++;
2582
+ }
2583
+ if (negateOffset)
2584
+ this.pattern = pattern.slice(negateOffset);
2585
+ this.negate = negate;
2586
+ }
2587
+ // set partial to true to test if, for example,
2588
+ // "/a/b" matches the start of "/*/b/*/d"
2589
+ // Partial means, if you run out of file before you run
2590
+ // out of pattern, then that's fine, as long as all
2591
+ // the parts match.
2592
+ matchOne(file, pattern, partial = false) {
2593
+ const options = this.options;
2594
+ if (this.isWindows) {
2595
+ const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
2596
+ const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
2597
+ const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
2598
+ const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
2599
+ const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
2600
+ const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
2601
+ if (typeof fdi === "number" && typeof pdi === "number") {
2602
+ const [fd, pd] = [file[fdi], pattern[pdi]];
2603
+ if (fd.toLowerCase() === pd.toLowerCase()) {
2604
+ pattern[pdi] = fd;
2605
+ if (pdi > fdi) {
2606
+ pattern = pattern.slice(pdi);
2607
+ } else if (fdi > pdi) {
2608
+ file = file.slice(fdi);
2609
+ }
2610
+ }
2611
+ }
2612
+ }
2613
+ const { optimizationLevel = 1 } = this.options;
2614
+ if (optimizationLevel >= 2) {
2615
+ file = this.levelTwoFileOptimize(file);
2616
+ }
2617
+ this.debug("matchOne", this, { file, pattern });
2618
+ this.debug("matchOne", file.length, pattern.length);
2619
+ for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
2620
+ this.debug("matchOne loop");
2621
+ var p2 = pattern[pi];
2622
+ var f = file[fi];
2623
+ this.debug(pattern, p2, f);
2624
+ if (p2 === false) {
2625
+ return false;
2626
+ }
2627
+ if (p2 === GLOBSTAR) {
2628
+ this.debug("GLOBSTAR", [pattern, p2, f]);
2629
+ var fr = fi;
2630
+ var pr = pi + 1;
2631
+ if (pr === pl) {
2632
+ this.debug("** at the end");
2633
+ for (; fi < fl; fi++) {
2634
+ if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
2635
+ return false;
2636
+ }
2637
+ return true;
2638
+ }
2639
+ while (fr < fl) {
2640
+ var swallowee = file[fr];
2641
+ this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
2642
+ if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
2643
+ this.debug("globstar found match!", fr, fl, swallowee);
2644
+ return true;
2645
+ } else {
2646
+ if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
2647
+ this.debug("dot detected!", file, fr, pattern, pr);
2648
+ break;
2649
+ }
2650
+ this.debug("globstar swallow a segment, and continue");
2651
+ fr++;
2652
+ }
2653
+ }
2654
+ if (partial) {
2655
+ this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
2656
+ if (fr === fl) {
2657
+ return true;
2658
+ }
2659
+ }
2660
+ return false;
2661
+ }
2662
+ let hit2;
2663
+ if (typeof p2 === "string") {
2664
+ hit2 = f === p2;
2665
+ this.debug("string match", p2, f, hit2);
2666
+ } else {
2667
+ hit2 = p2.test(f);
2668
+ this.debug("pattern match", p2, f, hit2);
2669
+ }
2670
+ if (!hit2)
2671
+ return false;
2672
+ }
2673
+ if (fi === fl && pi === pl) {
2674
+ return true;
2675
+ } else if (fi === fl) {
2676
+ return partial;
2677
+ } else if (pi === pl) {
2678
+ return fi === fl - 1 && file[fi] === "";
2679
+ } else {
2680
+ throw new Error("wtf?");
2681
+ }
2682
+ }
2683
+ braceExpand() {
2684
+ return braceExpand(this.pattern, this.options);
2685
+ }
2686
+ parse(pattern) {
2687
+ assertValidPattern(pattern);
2688
+ const options = this.options;
2689
+ if (pattern === "**")
2690
+ return GLOBSTAR;
2691
+ if (pattern === "")
2692
+ return "";
2693
+ let m;
2694
+ let fastTest = null;
2695
+ if (m = pattern.match(starRE)) {
2696
+ fastTest = options.dot ? starTestDot : starTest;
2697
+ } else if (m = pattern.match(starDotExtRE)) {
2698
+ fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
2699
+ } else if (m = pattern.match(qmarksRE)) {
2700
+ fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
2701
+ } else if (m = pattern.match(starDotStarRE)) {
2702
+ fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
2703
+ } else if (m = pattern.match(dotStarRE)) {
2704
+ fastTest = dotStarTest;
2705
+ }
2706
+ const re = AST.fromGlob(pattern, this.options).toMMPattern();
2707
+ if (fastTest && typeof re === "object") {
2708
+ Reflect.defineProperty(re, "test", { value: fastTest });
2709
+ }
2710
+ return re;
2711
+ }
2712
+ makeRe() {
2713
+ if (this.regexp || this.regexp === false)
2714
+ return this.regexp;
2715
+ const set2 = this.set;
2716
+ if (!set2.length) {
2717
+ this.regexp = false;
2718
+ return this.regexp;
2719
+ }
2720
+ const options = this.options;
2721
+ const twoStar = options.noglobstar ? star$1 : options.dot ? twoStarDot : twoStarNoDot;
2722
+ const flags2 = new Set(options.nocase ? ["i"] : []);
2723
+ let re = set2.map((pattern) => {
2724
+ const pp = pattern.map((p2) => {
2725
+ if (p2 instanceof RegExp) {
2726
+ for (const f of p2.flags.split(""))
2727
+ flags2.add(f);
2728
+ }
2729
+ return typeof p2 === "string" ? regExpEscape(p2) : p2 === GLOBSTAR ? GLOBSTAR : p2._src;
2730
+ });
2731
+ pp.forEach((p2, i2) => {
2732
+ const next = pp[i2 + 1];
2733
+ const prev = pp[i2 - 1];
2734
+ if (p2 !== GLOBSTAR || prev === GLOBSTAR) {
2735
+ return;
2736
+ }
2737
+ if (prev === void 0) {
2738
+ if (next !== void 0 && next !== GLOBSTAR) {
2739
+ pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
2740
+ } else {
2741
+ pp[i2] = twoStar;
2742
+ }
2743
+ } else if (next === void 0) {
2744
+ pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
2745
+ } else if (next !== GLOBSTAR) {
2746
+ pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
2747
+ pp[i2 + 1] = GLOBSTAR;
2748
+ }
2749
+ });
2750
+ return pp.filter((p2) => p2 !== GLOBSTAR).join("/");
2751
+ }).join("|");
2752
+ const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
2753
+ re = "^" + open2 + re + close + "$";
2754
+ if (this.negate)
2755
+ re = "^(?!" + re + ").+$";
2756
+ try {
2757
+ this.regexp = new RegExp(re, [...flags2].join(""));
2758
+ } catch (ex) {
2759
+ this.regexp = false;
2760
+ }
2761
+ return this.regexp;
2762
+ }
2763
+ slashSplit(p2) {
2764
+ if (this.preserveMultipleSlashes) {
2765
+ return p2.split("/");
2766
+ } else if (this.isWindows && /^\/\/[^\/]+/.test(p2)) {
2767
+ return ["", ...p2.split(/\/+/)];
2768
+ } else {
2769
+ return p2.split(/\/+/);
2770
+ }
2771
+ }
2772
+ match(f, partial = this.partial) {
2773
+ this.debug("match", f, this.pattern);
2774
+ if (this.comment) {
2775
+ return false;
2776
+ }
2777
+ if (this.empty) {
2778
+ return f === "";
2779
+ }
2780
+ if (f === "/" && partial) {
2781
+ return true;
2782
+ }
2783
+ const options = this.options;
2784
+ if (this.isWindows) {
2785
+ f = f.split("\\").join("/");
2786
+ }
2787
+ const ff = this.slashSplit(f);
2788
+ this.debug(this.pattern, "split", ff);
2789
+ const set2 = this.set;
2790
+ this.debug(this.pattern, "set", set2);
2791
+ let filename = ff[ff.length - 1];
2792
+ if (!filename) {
2793
+ for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
2794
+ filename = ff[i2];
2795
+ }
2796
+ }
2797
+ for (let i2 = 0; i2 < set2.length; i2++) {
2798
+ const pattern = set2[i2];
2799
+ let file = ff;
2800
+ if (options.matchBase && pattern.length === 1) {
2801
+ file = [filename];
2802
+ }
2803
+ const hit2 = this.matchOne(file, pattern, partial);
2804
+ if (hit2) {
2805
+ if (options.flipNegate) {
2806
+ return true;
2807
+ }
2808
+ return !this.negate;
2809
+ }
2810
+ }
2811
+ if (options.flipNegate) {
2812
+ return false;
2813
+ }
2814
+ return this.negate;
2815
+ }
2816
+ static defaults(def) {
2817
+ return minimatch.defaults(def).Minimatch;
2818
+ }
2819
+ }
2820
+ minimatch.AST = AST;
2821
+ minimatch.Minimatch = Minimatch;
2822
+ minimatch.escape = escape$1;
2823
+ minimatch.unescape = unescape;
1485
2824
  /*!
1486
2825
  * re2js
1487
2826
  * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
@@ -2995,10 +4334,10 @@ const _Regexp = class _Regexp {
2995
4334
  break;
2996
4335
  }
2997
4336
  case _Regexp.Op.ALTERNATE: {
2998
- let sep = "";
4337
+ let sep2 = "";
2999
4338
  for (let sub2 of this.subs) {
3000
- out2 += sep;
3001
- sep = "|";
4339
+ out2 += sep2;
4340
+ sep2 = "|";
3002
4341
  out2 += sub2.appendTo();
3003
4342
  }
3004
4343
  break;
@@ -6583,7 +7922,10 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6583
7922
  }
6584
7923
  // Visible for testing.
6585
7924
  get timerStateForTest() {
6586
- return { delay: this.lastFetchDelay, lifetime: this.lastResultLifetime };
7925
+ return {
7926
+ delay: this.lastFetchDelay,
7927
+ lifetime: this.lastResultLifetime
7928
+ };
6587
7929
  }
6588
7930
  // Fetches context filters and updates the cached filter results
6589
7931
  async fetchContextFilters() {
@@ -6658,9 +8000,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6658
8000
  await this.lastResultLifetime;
6659
8001
  }
6660
8002
  async isRepoNameIgnored(repoName) {
6661
- if (isDotCom(currentAuthStatus())) {
6662
- return false;
6663
- }
6664
8003
  await this.fetchIfNeeded();
6665
8004
  return this.isRepoNameIgnored__noFetch(repoName);
6666
8005
  }
@@ -6687,13 +8026,19 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6687
8026
  return isIgnored;
6688
8027
  }
6689
8028
  async isUriIgnored(uri) {
6690
- if (isDotCom(currentAuthStatus())) {
8029
+ if (!uri || allowedSchemes.has(uri.scheme)) {
6691
8030
  return false;
6692
8031
  }
6693
- if (!uri || allowedSchemes.has(uri.scheme)) {
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")) {
6694
8034
  return false;
6695
8035
  }
6696
8036
  await this.fetchIfNeeded();
8037
+ if (_ContextFiltersProvider.excludePatternGetter) {
8038
+ if (await this.isExcludedByPatterns(uri)) {
8039
+ return "exclude-pattern-match";
8040
+ }
8041
+ }
6697
8042
  if (this.hasAllowEverythingFilters()) {
6698
8043
  return false;
6699
8044
  }
@@ -6728,6 +8073,41 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6728
8073
  }
6729
8074
  return false;
6730
8075
  }
8076
+ async isExcludedByPatterns(uri) {
8077
+ try {
8078
+ const workspaceFolder = _ContextFiltersProvider.excludePatternGetter.getWorkspaceFolder(uri);
8079
+ const excludePatternString = await _ContextFiltersProvider.excludePatternGetter.getExcludePattern(workspaceFolder);
8080
+ const patterns = this.parseExcludePatternString(excludePatternString);
8081
+ let relativePath;
8082
+ if (workspaceFolder) {
8083
+ const workspacePath = workspaceFolder.uri.fsPath;
8084
+ if (uri.fsPath.startsWith(workspacePath)) {
8085
+ relativePath = uri.fsPath.substring(workspacePath.length + 1).replace(/\\/g, "/");
8086
+ } else {
8087
+ return false;
8088
+ }
8089
+ } else {
8090
+ relativePath = uri.fsPath.replace(/\\/g, "/");
8091
+ }
8092
+ return patterns.some((pattern) => minimatch(relativePath, pattern, { dot: true }));
8093
+ } catch (error) {
8094
+ logDebug$1("ContextFiltersProvider", "isExcludedByPatterns error", { error });
8095
+ return false;
8096
+ }
8097
+ }
8098
+ parseExcludePatternString(patternString) {
8099
+ if (!patternString || typeof patternString !== "string") {
8100
+ return [];
8101
+ }
8102
+ if (patternString.startsWith("{") && patternString.endsWith("}")) {
8103
+ const content = patternString.slice(1, -1);
8104
+ return content ? content.split(",").filter((pattern) => pattern.trim() !== "") : [];
8105
+ }
8106
+ if (patternString.includes(",") || patternString.includes("{") || patternString.includes("}")) {
8107
+ return [];
8108
+ }
8109
+ return [patternString.trim()].filter((pattern) => pattern !== "");
8110
+ }
6731
8111
  reset() {
6732
8112
  this.lastFetchTimestamp = 0;
6733
8113
  this.lastResultLifetime = Promise.resolve(TRANSIENT_REFETCH_INTERVAL_HINT);
@@ -6740,7 +8120,7 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6740
8120
  this.reset();
6741
8121
  }
6742
8122
  hasAllowEverythingFilters() {
6743
- return isDotCom(currentAuthStatus()) || this.lastContextFiltersResponse === INCLUDE_EVERYTHING_CONTEXT_FILTERS;
8123
+ return this.lastContextFiltersResponse === INCLUDE_EVERYTHING_CONTEXT_FILTERS;
6744
8124
  }
6745
8125
  hasIgnoreEverythingFilters() {
6746
8126
  return this.lastContextFiltersResponse === EXCLUDE_EVERYTHING_CONTEXT_FILTERS;
@@ -6752,6 +8132,7 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
6752
8132
  }
6753
8133
  };
6754
8134
  __publicField2(_ContextFiltersProvider, "repoNameResolver");
8135
+ __publicField2(_ContextFiltersProvider, "excludePatternGetter");
6755
8136
  let ContextFiltersProvider = _ContextFiltersProvider;
6756
8137
  function matchesContextFilter(parsedFilter, repoName) {
6757
8138
  return Boolean(parsedFilter.repoNamePattern.matcher(repoName).find(0));
@@ -8161,7 +9542,7 @@ async function getTokenCounterUtils() {
8161
9542
  const browser2 = detect();
8162
9543
  if (browser2 && browser2.name === "safari") {
8163
9544
  _tokenCounterUtilsPromise = import("./cl100k_base-B4kyDDRQ.mjs").then(async (tokenizer2) => {
8164
- const tiktoken = await import("./lite-DCslm11Y.mjs");
9545
+ const tiktoken = await import("./lite-BobkBW3_.mjs");
8165
9546
  return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
8166
9547
  });
8167
9548
  } else {
@@ -9600,7 +10981,7 @@ class APIClient {
9600
10981
  const socketKeepAliveInterval = 60 * 1e3;
9601
10982
  const keepAliveTimeout = setTimeout(() => {
9602
10983
  var _a3, _b2;
9603
- if ((_a3 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _a3.sockets) {
10984
+ if (fetchOptions && ((_a3 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _a3.sockets)) {
9604
10985
  for (const socket of Object.values((_b2 = fetchOptions == null ? void 0 : fetchOptions.agent) == null ? void 0 : _b2.sockets).flat()) {
9605
10986
  if (socket == null ? void 0 : socket.setKeepAlive) {
9606
10987
  socket.setKeepAlive(true, socketKeepAliveInterval);
@@ -12311,13 +13692,11 @@ const events$2 = [
12311
13692
  event(
12312
13693
  "cody.chat-question/submitted",
12313
13694
  ({ feature: feature2, action }) => (params) => {
12314
- const recordTranscript = params.authStatus.endpoint && isDotCom(params.authStatus);
12315
- const gitMetadata = isDotCom(params.authStatus) && params.repoIsPublic && lodashExports.isArray(params.repoMetadata) ? params.repoMetadata : void 0;
12316
13695
  telemetryRecorder.recordEvent(feature2, action, {
12317
13696
  metadata: {
12318
- // Flag indicating this is a transcript event to go through ML data pipeline. Only for DotCom users
13697
+ // Flag indicating this is a transcript event to go through ML data pipeline. Not for enterprise users
12319
13698
  // See https://github.com/sourcegraph/sourcegraph/pull/59524
12320
- recordsPrivateMetadataTranscript: recordTranscript ? 1 : 0,
13699
+ recordsPrivateMetadataTranscript: 0,
12321
13700
  isPublicRepo: params.repoIsPublic ? 1 : 0,
12322
13701
  // TODO: Remove this field when the transition from commands to prompts is complete
12323
13702
  isCommand: params.command ? 1 : 0,
@@ -12331,11 +13710,8 @@ const events$2 = [
12331
13710
  requestID: params.requestID,
12332
13711
  sessionID: params.sessionID,
12333
13712
  traceId: params.traceId,
12334
- // 🚨 SECURITY: chat transcripts are to be included only for DotCom users AND for V2 telemetry
12335
- // V2 telemetry exports privateMetadata only for DotCom users
12336
- // the condition below is an additional safeguard measure
12337
- promptText: recordTranscript ? truncatePromptString(params.promptText, CHAT_INPUT_TOKEN_BUDGET) : void 0,
12338
- gitMetadata,
13713
+ promptText: void 0,
13714
+ gitMetadata: void 0,
12339
13715
  chatAgent: params.chatAgent
12340
13716
  },
12341
13717
  billingMetadata: {
@@ -12351,7 +13727,7 @@ const events$2 = [
12351
13727
  event(
12352
13728
  "cody.chat-question/executed",
12353
13729
  ({ feature: feature2, action, map: map2 }) => (params, spans) => {
12354
- const recordTranscript = params.authStatus.endpoint && (isDotCom(params.authStatus) || isS2(params.authStatus));
13730
+ const recordTranscript = params.authStatus.endpoint && isS2(params.authStatus);
12355
13731
  const gitMetadata = recordTranscript && params.repoIsPublic && lodashExports.isArray(params.repoMetadata) ? params.repoMetadata : void 0;
12356
13732
  const metadata2 = lodashExports.isArray(params.context) ? publicContextSummary("context", params.context) : {
12357
13733
  ...publicContextSummary("context.used", params.context.used),
@@ -12376,8 +13752,8 @@ const events$2 = [
12376
13752
  userSpecifiedIntent: params.userSpecifiedIntent,
12377
13753
  traceId: spans.current.spanContext().traceId,
12378
13754
  gitMetadata,
12379
- // 🚨 SECURITY: Chat transcripts are to be included only for S2 & Dotcom users AND for V2 telemetry.
12380
- // V2 telemetry exports privateMetadata only for S2 & Dotcom users. The condition below is an additional safeguard measure.
13755
+ // 🚨 SECURITY: Chat transcripts are to be included only for S2 users AND for V2 telemetry.
13756
+ // V2 telemetry exports privateMetadata only for S2 users. The condition below is an additional safeguard measure.
12381
13757
  // Check `SRC_TELEMETRY_SENSITIVEMETADATA_ADDITIONAL_ALLOWED_EVENT_TYPES` env to learn more.
12382
13758
  promptText: recordTranscript ? truncatePromptString(params.promptText, CHAT_INPUT_TOKEN_BUDGET) : void 0,
12383
13759
  chatAgent: params.chatAgent
@@ -14324,7 +15700,7 @@ function createRuleService(providers, {
14324
15700
  const BUILTIN_RULES = [RULE_EDITING_HELPER_RULE];
14325
15701
  const own$2 = {}.hasOwnProperty;
14326
15702
  function zwitch(key2, options) {
14327
- const settings = options;
15703
+ const settings = options || {};
14328
15704
  function one2(value, ...parameters) {
14329
15705
  let fn = one2.invalid;
14330
15706
  const handlers2 = one2.handlers;
@@ -14765,7 +16141,7 @@ function observeProviderCall(providerClients, fn, { emitPartial, errorHook, logg
14765
16141
  console.error(error);
14766
16142
  }
14767
16143
  return Observable.of(null);
14768
- })).pipe(map$1((items) => items === EMIT_PARTIAL_SENTINEL ? items : (items || []).map((item) => ({ ...item, providerUri: uri })))))) : Observable.of([])), filter$1((result) => !emitPartial || result.length === 0 || result.some((v) => v !== EMIT_PARTIAL_SENTINEL)), map$1((result) => result.filter((v) => v !== null && v !== EMIT_PARTIAL_SENTINEL).flat()), distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), tap$1((items) => {
16144
+ })).pipe(map$1((items) => items === EMIT_PARTIAL_SENTINEL ? items : (items || []).map((item) => ({ ...item, providerUri: uri })))))) : Observable.of([])), filter$2((result) => !emitPartial || result.length === 0 || result.some((v) => v !== EMIT_PARTIAL_SENTINEL)), map$1((result) => result.filter((v) => v !== null && v !== EMIT_PARTIAL_SENTINEL).flat()), distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)), tap$1((items) => {
14769
16145
  }));
14770
16146
  }
14771
16147
  function observeMeta(providerClients, params, opts) {
@@ -18018,16 +19394,16 @@ function resolveProviderUrisInConfig(config, scope) {
18018
19394
  return void 0;
18019
19395
  }
18020
19396
  return Object.fromEntries(Object.entries(providers).map(([providerUri, settings]) => {
18021
- const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path.sep}`) || providerUri.startsWith(`.${path.sep}`);
19397
+ const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path$1.sep}`) || providerUri.startsWith(`.${path$1.sep}`);
18022
19398
  if (isRelativeFilePath) {
18023
- providerUri = fromUri.with({ path: path.resolve(fromUri.path, providerUri) }).toString();
19399
+ providerUri = fromUri.with({ path: path$1.resolve(fromUri.path, providerUri) }).toString();
18024
19400
  }
18025
19401
  return [providerUri, settings];
18026
19402
  }));
18027
19403
  }
18028
19404
  const scopeUri = scope && ("uri" in scope ? scope.uri : "fsPath" in scope ? scope : scope.uri);
18029
19405
  const workspaceFile = (_a3 = workspace.workspaceFile) == null ? void 0 : _a3.with({
18030
- path: path.dirname(workspace.workspaceFile.path)
19406
+ path: path$1.dirname(workspace.workspaceFile.path)
18031
19407
  });
18032
19408
  const workspaceFolder = scopeUri ? workspace.getWorkspaceFolder(scopeUri) : void 0;
18033
19409
  const workspaceFolderSettingsFileUri = workspaceFolder ? workspaceFolder.uri.with({ path: workspaceFolder.uri.path + "/.vscode" }) : void 0;
@@ -20044,9 +21420,9 @@ function requireBuffer() {
20044
21420
  Object.setPrototypeOf(newBuf, Buffer2.prototype);
20045
21421
  return newBuf;
20046
21422
  };
20047
- function checkOffset(offset2, ext, length) {
21423
+ function checkOffset(offset2, ext2, length) {
20048
21424
  if (offset2 % 1 !== 0 || offset2 < 0) throw new RangeError("offset is not uint");
20049
- if (offset2 + ext > length) throw new RangeError("Trying to access beyond buffer length");
21425
+ if (offset2 + ext2 > length) throw new RangeError("Trying to access beyond buffer length");
20050
21426
  }
20051
21427
  Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset2, byteLength3, noAssert) {
20052
21428
  offset2 = offset2 >>> 0;
@@ -20221,10 +21597,10 @@ function requireBuffer() {
20221
21597
  if (!noAssert) checkOffset(offset2, 8, this.length);
20222
21598
  return ieee7542.read(this, offset2, false, 52, 8);
20223
21599
  };
20224
- function checkInt(buf, value, offset2, ext, max, min) {
21600
+ function checkInt(buf, value, offset2, ext2, max, min) {
20225
21601
  if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
20226
21602
  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
20227
- if (offset2 + ext > buf.length) throw new RangeError("Index out of range");
21603
+ if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
20228
21604
  }
20229
21605
  Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset2, byteLength3, noAssert) {
20230
21606
  value = +value;
@@ -20436,8 +21812,8 @@ function requireBuffer() {
20436
21812
  Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset2 = 0) {
20437
21813
  return wrtBigUInt64BE(this, value, offset2, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
20438
21814
  });
20439
- function checkIEEE754(buf, value, offset2, ext, max, min) {
20440
- if (offset2 + ext > buf.length) throw new RangeError("Index out of range");
21815
+ function checkIEEE754(buf, value, offset2, ext2, max, min) {
21816
+ if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
20441
21817
  if (offset2 < 0) throw new RangeError("Index out of range");
20442
21818
  }
20443
21819
  function writeFloat(buf, value, offset2, littleEndian, noAssert) {
@@ -20845,7 +22221,7 @@ function requireBuffer_list() {
20845
22221
  }
20846
22222
  }
20847
22223
  function _createClass(Constructor, protoProps, staticProps) {
20848
- _defineProperties(Constructor.prototype, protoProps);
22224
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
20849
22225
  Object.defineProperty(Constructor, "prototype", { writable: false });
20850
22226
  return Constructor;
20851
22227
  }
@@ -20857,11 +22233,11 @@ function requireBuffer_list() {
20857
22233
  if (typeof input !== "object" || input === null) return input;
20858
22234
  var prim2 = input[Symbol.toPrimitive];
20859
22235
  if (prim2 !== void 0) {
20860
- var res = prim2.call(input, hint);
22236
+ var res = prim2.call(input, hint || "default");
20861
22237
  if (typeof res !== "object") return res;
20862
22238
  throw new TypeError("@@toPrimitive must return a primitive value.");
20863
22239
  }
20864
- return String(input);
22240
+ return (hint === "string" ? String : Number)(input);
20865
22241
  }
20866
22242
  var _require = requireBuffer(), Buffer2 = _require.Buffer;
20867
22243
  var _require2 = requireUtil(), inspect = _require2.inspect;
@@ -23943,6 +25319,13 @@ class LocalStorage {
23943
25319
  const accountKey = getKeyForAuthStatus(authStatus2);
23944
25320
  return (history == null ? void 0 : history[accountKey]) ?? { chat: {} };
23945
25321
  }
25322
+ /**
25323
+ * Get all chat history for all accounts without authentication check
25324
+ * Useful for export functionality when user can't authenticate
25325
+ */
25326
+ getAllChatHistory() {
25327
+ return this.storage.get(this.KEY_LOCAL_HISTORY, null);
25328
+ }
23946
25329
  async setChatHistory(authStatus2, history) {
23947
25330
  try {
23948
25331
  const key2 = getKeyForAuthStatus(authStatus2);
@@ -24293,19 +25676,22 @@ var define_process_default$h = { env: {} };
24293
25676
  const CODY_OUTPUT_CHANNEL = "Cody by Sourcegraph";
24294
25677
  class OutputChannelManager {
24295
25678
  constructor() {
24296
- __publicField2(this, "defaultOutputChannel", window$1.createOutputChannel(CODY_OUTPUT_CHANNEL, "json"));
25679
+ __publicField2(this, "defaultOutputChannel", window$1.createOutputChannel(CODY_OUTPUT_CHANNEL, { log: true }));
24297
25680
  __publicField2(this, "outputChannels", /* @__PURE__ */ new Map());
24298
25681
  }
24299
25682
  getOutputChannel(feature2) {
24300
- if (!this.outputChannels.has(feature2) && false) ;
25683
+ if (!this.outputChannels.has(feature2) && false) {
25684
+ const channel2 = window$1.createOutputChannel(`Cody ${feature2}`, { log: true });
25685
+ this.outputChannels.set(feature2, channel2);
25686
+ }
24301
25687
  return this.outputChannels.get(feature2);
24302
25688
  }
24303
- appendLine(text2, feature2) {
24304
- var _a3;
24305
- (_a3 = this.defaultOutputChannel) == null ? void 0 : _a3.appendLine(text2);
25689
+ 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);
24306
25692
  if (feature2) {
24307
25693
  const channel2 = this.getOutputChannel(feature2);
24308
- channel2 == null ? void 0 : channel2.appendLine(text2);
25694
+ level2 === "error" ? channel2 == null ? void 0 : channel2.error(text2) : channel2 == null ? void 0 : channel2.debug(text2);
24309
25695
  }
24310
25696
  const path2 = define_process_default$h.env.CODY_LOG_FILE;
24311
25697
  if (path2) {
@@ -24359,7 +25745,7 @@ class Logger {
24359
25745
  args: args2,
24360
25746
  debugVerbose
24361
25747
  });
24362
- outputChannelManager.appendLine(message, feature2);
25748
+ outputChannelManager.appendLine(level2, message, feature2);
24363
25749
  }
24364
25750
  }
24365
25751
  const outputChannelLogger = new Logger();
@@ -24984,8 +26370,8 @@ async function signOut(endpoint) {
24984
26370
  }
24985
26371
  }
24986
26372
  );
24987
- await Promise.all([secretStorage.deleteToken(endpoint), localStorage.deleteEndpoint(endpoint)]);
24988
26373
  authProvider.signout(endpoint);
26374
+ await Promise.all([secretStorage.deleteToken(endpoint), localStorage.deleteEndpoint(endpoint)]);
24989
26375
  }
24990
26376
  async function validateCredentials(config, signal2, clientConfig) {
24991
26377
  var _a3, _b2;
@@ -25259,6 +26645,132 @@ function getEditor() {
25259
26645
  };
25260
26646
  return get2();
25261
26647
  }
26648
+ async function findWorkspaceFiles() {
26649
+ var _a3;
26650
+ const excludePatternStrings = await Promise.all(
26651
+ ((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.flatMap(
26652
+ (workspaceFolder) => getExcludePattern(workspaceFolder)
26653
+ )) ?? []
26654
+ );
26655
+ const allExcludePatterns = [];
26656
+ for (const patternString of excludePatternStrings) {
26657
+ if ((patternString == null ? void 0 : patternString.startsWith("{")) && patternString.endsWith("}")) {
26658
+ const content = patternString.slice(1, -1);
26659
+ if (content) {
26660
+ allExcludePatterns.push(...content.split(",").filter((p2) => p2.trim()));
26661
+ }
26662
+ }
26663
+ }
26664
+ const config = workspace.getConfiguration();
26665
+ const filesExclude = config.get("files.exclude") || {};
26666
+ const searchExclude = config.get("search.exclude") || {};
26667
+ for (const [pattern, enabled] of Object.entries(filesExclude)) {
26668
+ if (enabled) {
26669
+ allExcludePatterns.push(pattern);
26670
+ }
26671
+ }
26672
+ for (const [pattern, enabled] of Object.entries(searchExclude)) {
26673
+ if (enabled) {
26674
+ allExcludePatterns.push(pattern);
26675
+ }
26676
+ }
26677
+ allExcludePatterns.push("**/.vscode/**");
26678
+ const excludePattern = allExcludePatterns.length > 0 ? `{${allExcludePatterns.join(",")}}` : "";
26679
+ return workspace.findFiles("**/*", excludePattern);
26680
+ }
26681
+ const excludeCache = /* @__PURE__ */ new Map();
26682
+ const fileWatchers = /* @__PURE__ */ new Map();
26683
+ function getCacheKey(workspaceFolder) {
26684
+ return (workspaceFolder == null ? void 0 : workspaceFolder.uri.toString()) ?? "no-workspace";
26685
+ }
26686
+ function setupFileWatcher(workspaceFolder) {
26687
+ const filename = ".sourcegraph/ignore";
26688
+ const watcherKey = `${workspaceFolder.uri.toString()}:${filename}`;
26689
+ if (fileWatchers.has(watcherKey)) {
26690
+ return;
26691
+ }
26692
+ const pattern = new RelativePattern(workspaceFolder, filename);
26693
+ const watcher = workspace.createFileSystemWatcher(pattern);
26694
+ const updateCache = async () => {
26695
+ const cacheKey = getCacheKey(workspaceFolder);
26696
+ const fileUri = Uri.joinPath(workspaceFolder.uri, filename);
26697
+ const ignoreData = await readIgnoreFile(fileUri);
26698
+ excludeCache.set(cacheKey, ignoreData);
26699
+ };
26700
+ watcher.onDidChange(updateCache);
26701
+ watcher.onDidCreate(updateCache);
26702
+ watcher.onDidDelete(async () => {
26703
+ const cacheKey = getCacheKey(workspaceFolder);
26704
+ excludeCache.set(cacheKey, {});
26705
+ });
26706
+ fileWatchers.set(watcherKey, watcher);
26707
+ }
26708
+ async function initializeCache(workspaceFolder) {
26709
+ const cacheKey = getCacheKey(workspaceFolder);
26710
+ if (excludeCache.has(cacheKey)) {
26711
+ return;
26712
+ }
26713
+ let sgignoreExclude = {};
26714
+ if (workspaceFolder) {
26715
+ sgignoreExclude = await readIgnoreFile(
26716
+ Uri.joinPath(workspaceFolder.uri, ".sourcegraph", "ignore")
26717
+ );
26718
+ setupFileWatcher(workspaceFolder);
26719
+ }
26720
+ excludeCache.set(cacheKey, sgignoreExclude);
26721
+ }
26722
+ async function getExcludePattern(workspaceFolder) {
26723
+ await initializeCache(workspaceFolder);
26724
+ const cacheKey = getCacheKey(workspaceFolder);
26725
+ const cached2 = excludeCache.get(cacheKey);
26726
+ const sgignoreExclude = cached2 ?? {};
26727
+ const mergedExclude = {
26728
+ ...sgignoreExclude
26729
+ };
26730
+ const excludePatterns = Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
26731
+ if (excludePatterns.length === 0) {
26732
+ return "";
26733
+ }
26734
+ if (excludePatterns.length === 1) {
26735
+ return excludePatterns[0];
26736
+ }
26737
+ return `{${excludePatterns.join(",")}}`;
26738
+ }
26739
+ async function readIgnoreFile(uri) {
26740
+ const ignore = {};
26741
+ try {
26742
+ const data = await workspace.fs.readFile(uri);
26743
+ const content = Buffer.from(data).toString("utf-8");
26744
+ for (let line of content.split("\n")) {
26745
+ if (line.startsWith("!")) {
26746
+ continue;
26747
+ }
26748
+ line = line.replace(/\s*(#.*)?$/, "").trim();
26749
+ if (line === "") {
26750
+ continue;
26751
+ }
26752
+ if (line.includes(",")) {
26753
+ line = line.replace(/,/g, ".");
26754
+ }
26755
+ if (line.endsWith("/")) {
26756
+ line = line.slice(0, -1);
26757
+ }
26758
+ if (!line.startsWith("/") && !line.startsWith("**/")) {
26759
+ line = `**/${line}`;
26760
+ }
26761
+ ignore[line] = true;
26762
+ }
26763
+ } catch (error) {
26764
+ }
26765
+ return ignore;
26766
+ }
26767
+ function disposeFileWatchers() {
26768
+ for (const watcher of fileWatchers.values()) {
26769
+ watcher.dispose();
26770
+ }
26771
+ fileWatchers.clear();
26772
+ excludeCache.clear();
26773
+ }
25262
26774
  function ignoreReason(isIgnore) {
25263
26775
  if (lodashExports.isError(isIgnore)) {
25264
26776
  return isIgnore.message;
@@ -25290,6 +26802,15 @@ async function isUriIgnoredByContextFilterWithNotification(uri, feature2) {
25290
26802
  }
25291
26803
  return isIgnored;
25292
26804
  }
26805
+ function initializeContextFiltersProvider() {
26806
+ ContextFiltersProvider.excludePatternGetter = {
26807
+ getExcludePattern,
26808
+ getWorkspaceFolder: (uri) => workspace.getWorkspaceFolder(uri) ?? null
26809
+ };
26810
+ return {
26811
+ dispose: disposeFileWatchers
26812
+ };
26813
+ }
25293
26814
  const executeChat = async (args2) => {
25294
26815
  const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
25295
26816
  const isCommand = Boolean(args2.command);
@@ -26886,7 +28407,8 @@ var treeSitter = { exports: {} };
26886
28407
  setValue(lengthAddress, 0, "i32");
26887
28408
  }
26888
28409
  }
26889
- var keepRuntimeAlive = () => noExitRuntime;
28410
+ var runtimeKeepaliveCounter = 0;
28411
+ var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
26890
28412
  var _proc_exit = (code18) => {
26891
28413
  var _a3;
26892
28414
  EXITSTATUS = code18;
@@ -27621,14 +29143,14 @@ var treeSitter = { exports: {} };
27621
29143
  }
27622
29144
  return this._namedChildren;
27623
29145
  }
27624
- descendantsOfType(types, startPosition, endPosition) {
27625
- if (!Array.isArray(types)) types = [types];
29146
+ descendantsOfType(types2, startPosition, endPosition) {
29147
+ if (!Array.isArray(types2)) types2 = [types2];
27626
29148
  if (!startPosition) startPosition = ZERO_POINT;
27627
29149
  if (!endPosition) endPosition = ZERO_POINT;
27628
29150
  const symbols = [];
27629
29151
  const typesBySymbol = this.tree.language.types;
27630
29152
  for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
27631
- if (types.includes(typesBySymbol[i2])) {
29153
+ if (types2.includes(typesBySymbol[i2])) {
27632
29154
  symbols.push(i2);
27633
29155
  }
27634
29156
  }
@@ -33144,7 +34666,7 @@ async function createParser$1(settings) {
33144
34666
  if (cachedParser) {
33145
34667
  return cachedParser;
33146
34668
  }
33147
- const wasmPath = path.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
34669
+ const wasmPath = path$1.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
33148
34670
  if (!await isRegularFile(Uri.file(wasmPath))) {
33149
34671
  return void 0;
33150
34672
  }
@@ -35370,10 +36892,10 @@ function getSearchPatternForTestFiles(file, currentDirectoryOnly, fileNameMatche
35370
36892
  return root2 + osSep + testPattern;
35371
36893
  }
35372
36894
  function isValidTestFile(uri) {
35373
- const ext = uriExtname(uri);
35374
- const fileNameWithoutExt = uriBasename(uri, ext);
36895
+ const ext2 = uriExtname(uri);
36896
+ const fileNameWithoutExt = uriBasename(uri, ext2);
35375
36897
  const prefixTest = /\.(?:py|rb)$/;
35376
- if (prefixTest.test(ext)) {
36898
+ if (prefixTest.test(ext2)) {
35377
36899
  if (fileNameWithoutExt.startsWith("test_")) {
35378
36900
  return true;
35379
36901
  }
@@ -35780,7 +37302,7 @@ async function executeDefaultCommand(id, args2) {
35780
37302
  case DefaultEditCommands.Doc:
35781
37303
  return executeDocCommand(args2);
35782
37304
  case DefaultEditCommands.Edit:
35783
- return { task: await executeEdit(args2), type: "edit" };
37305
+ return { task: await executeEdit(args2 || {}), type: "edit" };
35784
37306
  default:
35785
37307
  console.log("not a default command");
35786
37308
  return void 0;
@@ -36377,7 +37899,7 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
36377
37899
  if (!isFileProvided) {
36378
37900
  return fallbackUri;
36379
37901
  }
36380
- const rootDir = Uri.parse(path.join(...uri.split(separatorsRegex).slice(0, 2)));
37902
+ const rootDir = Uri.parse(path$1.join(...uri.split(separatorsRegex).slice(0, 2)));
36381
37903
  const hasExistingRoot = await doesFileExist(rootDir);
36382
37904
  if (hasExistingRoot) {
36383
37905
  return Uri.file(uri);
@@ -36385,7 +37907,7 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
36385
37907
  if (!baseDirUri) {
36386
37908
  return fallbackUri;
36387
37909
  }
36388
- const filepath = path.join(baseDirUri.path, uri);
37910
+ const filepath = path$1.join(baseDirUri.path, uri);
36389
37911
  const hasExistingFile = await doesFileExist(Uri.file(filepath));
36390
37912
  if (hasExistingFile) {
36391
37913
  return Uri.file(filepath);
@@ -36398,7 +37920,7 @@ function smartJoinPath(baseDirUri, relativeFileUri) {
36398
37920
  const commonPartLength = filePath.findIndex((segment) => segment === workspacePath.at(-1)) + 1;
36399
37921
  const hasCommonPart = commonPartLength > 0 && isEqual(workspacePath.slice(-commonPartLength), filePath.slice(0, commonPartLength));
36400
37922
  const uniqueFilePath = hasCommonPart ? filePath.slice(commonPartLength) : filePath;
36401
- const resultPath = path.join(baseDirUri.path, ...uniqueFilePath);
37923
+ const resultPath = path$1.join(baseDirUri.path, ...uniqueFilePath);
36402
37924
  return Uri.file(resultPath);
36403
37925
  }
36404
37926
  const defaultLastStoredCode = {
@@ -36524,6 +38046,10 @@ async function handleSmartApply({
36524
38046
  }
36525
38047
  const document2 = uri ? await workspace.openTextDocument(uri) : activeEditor == null ? void 0 : activeEditor.document;
36526
38048
  if (!document2) {
38049
+ if (!window$1.activeTextEditor && !uri) {
38050
+ console.warn("Smart apply operation cancelled - no active editor available");
38051
+ return;
38052
+ }
36527
38053
  throw new Error("No editor found to insert text");
36528
38054
  }
36529
38055
  if (isPrefetch) {
@@ -37980,9 +39506,9 @@ const ruleFileInteractiveChanges = defer$2(
37980
39506
  merge$2(
37981
39507
  fromVSCodeEvent(workspace.onDidCreateFiles),
37982
39508
  fromVSCodeEvent(workspace.onDidDeleteFiles)
37983
- ).pipe(filter$1((e) => e.files.some(isRuleFile))),
39509
+ ).pipe(filter$2((e) => e.files.some(isRuleFile))),
37984
39510
  fromVSCodeEvent(workspace.onDidChangeTextDocument).pipe(
37985
- filter$1((e) => isRuleFile(e.document.uri))
39511
+ filter$2((e) => isRuleFile(e.document.uri))
37986
39512
  )
37987
39513
  ).pipe(debounceTime(1e3))
37988
39514
  );
@@ -39028,57 +40554,6 @@ function toVSCodeRange(range) {
39028
40554
  }
39029
40555
  return new Range(range.start.line, range.start.character, range.end.line, range.end.character);
39030
40556
  }
39031
- async function findWorkspaceFiles() {
39032
- var _a3;
39033
- const excludePatterns = await Promise.all(
39034
- ((_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.flatMap((workspaceFolder) => {
39035
- return getExcludePattern(workspaceFolder);
39036
- })) ?? []
39037
- );
39038
- return workspace.findFiles("**/*", `{${excludePatterns.join(",")}}`);
39039
- }
39040
- async function getExcludePattern(workspaceFolder) {
39041
- const config = workspace.getConfiguration("", workspaceFolder);
39042
- const filesExclude = config.get("files.exclude", {});
39043
- const searchExclude = config.get("search.exclude", {});
39044
- const useIgnoreFiles = config.get("search.useIgnoreFiles");
39045
- const gitignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".gitignore")) : {};
39046
- const ignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".ignore")) : {};
39047
- const mergedExclude = {
39048
- ...filesExclude,
39049
- ...searchExclude,
39050
- ...gitignoreExclude,
39051
- ...ignoreExclude
39052
- };
39053
- return Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
39054
- }
39055
- async function readIgnoreFile(uri) {
39056
- const ignore = {};
39057
- try {
39058
- const data = await workspace.fs.readFile(uri);
39059
- for (let line of Buffer.from(data).toString("utf-8").split("\n")) {
39060
- if (line.startsWith("!")) {
39061
- continue;
39062
- }
39063
- line = line.replace(/\s*(#.*)?$/, "").trim();
39064
- if (line === "") {
39065
- continue;
39066
- }
39067
- if (line.includes(",")) {
39068
- line = line.replace(",", ".");
39069
- }
39070
- if (line.endsWith("/")) {
39071
- line = line.slice(0, -1);
39072
- }
39073
- if (!line.startsWith("/") && !line.startsWith("**/")) {
39074
- line = `**/${line}`;
39075
- }
39076
- ignore[line] = true;
39077
- }
39078
- } catch {
39079
- }
39080
- return ignore;
39081
- }
39082
40557
  const lowScoringPathSegments = ["bin"];
39083
40558
  const throttledFindFiles = throttle$1(() => findWorkspaceFiles(), 1e4);
39084
40559
  async function getFileContextFiles(options) {
@@ -39141,7 +40616,9 @@ async function getFileContextFiles(options) {
39141
40616
  }
39142
40617
  const LARGE_SCORE = 1e5;
39143
40618
  const adjustedResults = [...results].map((result) => {
39144
- if (openDocuments.has(result.obj.uri.path)) {
40619
+ const isVSCodeConfigFile = result.obj.uri.path.includes("/.vscode/");
40620
+ const isOpenDoc = openDocuments.has(result.obj.uri.path);
40621
+ if (isOpenDoc && !isVSCodeConfigFile) {
39145
40622
  return {
39146
40623
  ...result,
39147
40624
  score: result.score + LARGE_SCORE
@@ -39156,6 +40633,13 @@ async function getFileContextFiles(options) {
39156
40633
  };
39157
40634
  }
39158
40635
  }
40636
+ if (result.obj.uri.path.includes("/.vscode/")) {
40637
+ return {
40638
+ ...result,
40639
+ score: result.score - LARGE_SCORE * 10
40640
+ // Increase penalty significantly to prevent .vscode files from showing up
40641
+ };
40642
+ }
39159
40643
  return result;
39160
40644
  });
39161
40645
  const sortedResults = (await Promise.all(
@@ -39259,6 +40743,7 @@ async function createContextFileFromUri(uri, source, type, selectionRange, kind2
39259
40743
  const range = toRangeData(selectionRange);
39260
40744
  const repoNames = await firstResultFromOperation(repoNameResolver.getRepoNamesContainingUri(uri));
39261
40745
  const repoName = repoNames[0];
40746
+ const isIgnored = await contextFiltersProvider.isUriIgnored(uri);
39262
40747
  return [
39263
40748
  type === "file" ? {
39264
40749
  type,
@@ -39266,7 +40751,7 @@ async function createContextFileFromUri(uri, source, type, selectionRange, kind2
39266
40751
  range,
39267
40752
  source,
39268
40753
  repoName,
39269
- isIgnored: Boolean(await contextFiltersProvider.isUriIgnored(uri))
40754
+ isIgnored: Boolean(isIgnored)
39270
40755
  } : {
39271
40756
  type,
39272
40757
  symbolName,
@@ -39375,7 +40860,10 @@ async function resolveFileOrSymbolContextItem(contextItem, editor, signal2) {
39375
40860
  if (contextItem.remoteRepositoryName) {
39376
40861
  const repository = contextItem.remoteRepositoryName;
39377
40862
  const path2 = contextItem.uri.path.slice(repository.length + 1, contextItem.uri.path.length);
39378
- const ranges2 = contextItem.range ? { startLine: contextItem.range.start.line, endLine: contextItem.range.end.line + 1 } : void 0;
40863
+ const ranges2 = contextItem.range ? {
40864
+ startLine: contextItem.range.start.line,
40865
+ endLine: contextItem.range.end.line + 1
40866
+ } : void 0;
39379
40867
  const { auth: auth2 } = await currentResolvedConfig();
39380
40868
  const resultOrError = await graphqlClient.getFileContent(repository, path2, ranges2, signal2);
39381
40869
  if (!isErrorLike(resultOrError)) {
@@ -40321,10 +41809,10 @@ const getInput = async (document2, initialValues, source) => {
40321
41809
  const disposables = [];
40322
41810
  disposables.push(editFlow);
40323
41811
  const updateTitle = (newTitle) => {
40324
- modelInput.input.title = newTitle;
40325
- rangeSymbolsInput.input.title = newTitle;
40326
- rangeInput.input.title = newTitle;
40327
- editInput.input.title = newTitle;
41812
+ if (modelInput) modelInput.input.title = newTitle;
41813
+ if (rangeSymbolsInput) rangeSymbolsInput.input.title = newTitle;
41814
+ if (rangeInput) rangeInput.input.title = newTitle;
41815
+ if (editInput) editInput.input.title = newTitle;
40328
41816
  };
40329
41817
  const titleListenerCallback = (newTitle) => {
40330
41818
  editor.setDecorations(PREVIEW_RANGE_DECORATION, []);
@@ -41933,7 +43421,7 @@ function getMapping() {
41933
43421
  return mapping;
41934
43422
  }
41935
43423
  function getLanguageForFileName(filePath) {
41936
- const fileName = path.basename(filePath);
43424
+ const fileName = path$1.basename(filePath);
41937
43425
  const extension = fileName.split(".").pop() || fileName;
41938
43426
  const language = getMapping().get(extension);
41939
43427
  return language || extension;
@@ -42932,9 +44420,11 @@ function registerNativeWebviewHandlers(agent2, webviewBundleLocalPrefix, config)
42932
44420
  );
42933
44421
  webviewProtocolDelegate.registerWebview(panel2.handle, {
42934
44422
  didReceiveMessage(message) {
44423
+ console.log("[Cody] webviewProtocolDelegate didReceiveMessage");
42935
44424
  panel2.webview.didReceiveMessageEmitter.fire(message);
42936
44425
  },
42937
44426
  didDispose() {
44427
+ console.log("[Cody] webviewProtocolDelegate didDispose");
42938
44428
  panel2.didDispose();
42939
44429
  }
42940
44430
  });
@@ -42945,13 +44435,13 @@ function vscodeEnableCommandUrisToAgentEnableOnlyCommandUris(enableCommandUris)
42945
44435
  return Array.isArray(enableCommandUris) ? enableCommandUris : !enableCommandUris ? [] : null;
42946
44436
  }
42947
44437
  class NativeWebview {
42948
- constructor(delegate, handle2, _options) {
44438
+ constructor(delegate, handle2, _options2) {
42949
44439
  __publicField2(this, "didReceiveMessageEmitter", new AgentEventEmitter());
42950
44440
  __publicField2(this, "onDidReceiveMessage", this.didReceiveMessageEmitter.event);
42951
44441
  __publicField2(this, "_html", "");
42952
44442
  this.delegate = delegate;
42953
44443
  this.handle = handle2;
42954
- this._options = _options;
44444
+ this._options = _options2;
42955
44445
  }
42956
44446
  get html() {
42957
44447
  return this._html;
@@ -43065,10 +44555,12 @@ class NativeWebviewPanel {
43065
44555
  this.delegate.reveal(this.handle, viewColumn, preserveFocus);
43066
44556
  }
43067
44557
  dispose() {
44558
+ console.log("[Cody] dispose weview panel");
43068
44559
  this.delegate.dispose(this.handle);
43069
44560
  }
43070
44561
  // Called when the client disposes the webview.
43071
44562
  didDispose() {
44563
+ console.log("[Cody] didDispose weview panel");
43072
44564
  this.disposeEmitter.fire();
43073
44565
  }
43074
44566
  }
@@ -44170,7 +45662,7 @@ class LocalStorageDB {
44170
45662
  constructor(ide, dir) {
44171
45663
  __publicField2(this, "storage");
44172
45664
  const quota = 1024 * 1024 * 256;
44173
- this.storage = new LocalStorage_2(path.join(dir, `${ide}-globalState`), quota);
45665
+ this.storage = new LocalStorage_2(path$1.join(dir, `${ide}-globalState`), quota);
44174
45666
  }
44175
45667
  clear() {
44176
45668
  this.storage.clear();
@@ -44334,8 +45826,8 @@ var define_process_default$8 = { env: {} };
44334
45826
  function copyExtensionRelativeResources(extensionPath, extensionClient) {
44335
45827
  var _a3, _b2, _c2;
44336
45828
  const copySources = (relativeSource) => {
44337
- const source = path.join("/tmp/__dirname", relativeSource);
44338
- const target = path.join(extensionPath, "dist", relativeSource);
45829
+ const source = path$1.join("/tmp/__dirname", relativeSource);
45830
+ const target = path$1.join(extensionPath, "dist", relativeSource);
44339
45831
  try {
44340
45832
  const stat2 = statSync(source);
44341
45833
  if (!(stat2.isFile() || stat2.isDirectory())) {
@@ -44346,7 +45838,7 @@ function copyExtensionRelativeResources(extensionPath, extensionClient) {
44346
45838
  return;
44347
45839
  }
44348
45840
  try {
44349
- mkdirSync(path.dirname(target), { recursive: true });
45841
+ mkdirSync(path$1.dirname(target), { recursive: true });
44350
45842
  copySync(source, target);
44351
45843
  } catch (err2) {
44352
45844
  logDebug$1("copyExtensionRelativeResources", `Failed to copy ${source} to dist ${target}`, err2);
@@ -45251,7 +46743,7 @@ class Agent extends MessageHandler {
45251
46743
  this.registerAuthenticatedRequest("chat/models", async ({ modelUsage }) => {
45252
46744
  const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
45253
46745
  return {
45254
- readOnly: !(isDotCom(currentAuthStatus()) || (clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled)),
46746
+ readOnly: !(clientConfig == null ? void 0 : clientConfig.modelsAPIEnabled),
45255
46747
  models: await modelsService.getModelsAvailabilityStatus(modelUsage)
45256
46748
  };
45257
46749
  });
@@ -46763,7 +48255,7 @@ class CommandsProvider {
46763
48255
  if (!isFileURI(uri)) {
46764
48256
  throw new Error("history only supported on local file paths");
46765
48257
  }
46766
- const { getContextFileFromGitLog } = await import("./git-log-BWXBE9bQ.mjs");
48258
+ const { getContextFileFromGitLog } = await import("./git-log-7kbEzZhk.mjs");
46767
48259
  return getContextFileFromGitLog(uri, options);
46768
48260
  }
46769
48261
  dispose() {
@@ -46880,7 +48372,7 @@ class ExtensionApi {
46880
48372
  this.extensionMode = extensionMode;
46881
48373
  }
46882
48374
  }
46883
- const uninstallMarker = path.join(codyPaths().config, "uninstall-marker");
48375
+ const uninstallMarker = path$1.join(codyPaths().config, "uninstall-marker");
46884
48376
  let isReinstall = void 0;
46885
48377
  const isReinstalling = async () => {
46886
48378
  if (typeof isReinstall === "boolean") {
@@ -147117,7 +148609,8 @@ function readDocType$1(xmlData, i2) {
147117
148609
  } else if (hasBody && isElement(xmlData, i2)) i2 += 8;
147118
148610
  else if (hasBody && isAttlist(xmlData, i2)) i2 += 8;
147119
148611
  else if (hasBody && isNotation(xmlData, i2)) i2 += 9;
147120
- else comment2 = true;
148612
+ else if (isComment) comment2 = true;
148613
+ else throw new Error("Invalid DOCTYPE");
147121
148614
  angleBracketsCount++;
147122
148615
  exp = "";
147123
148616
  } else if (xmlData[i2] === ">") {
@@ -147160,6 +148653,10 @@ function readEntityExp(xmlData, i2) {
147160
148653
  }
147161
148654
  return [entityName2, val2, i2];
147162
148655
  }
148656
+ function isComment(xmlData, i2) {
148657
+ if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "-" && xmlData[i2 + 3] === "-") return true;
148658
+ return false;
148659
+ }
147163
148660
  function isEntity(xmlData, i2) {
147164
148661
  if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "N" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "I" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "Y") return true;
147165
148662
  return false;
@@ -158514,7 +160011,7 @@ var canvaskit = { exports: {} };
158514
160011
  Object.assign(c, arguments);
158515
160012
  if (a.includes("j")) {
158516
160013
  var f = w["dynCall_" + a];
158517
- f = c.length ? f.apply(null, [b].concat(c)) : f.call(null, b);
160014
+ f = c && c.length ? f.apply(null, [b].concat(c)) : f.call(null, b);
158518
160015
  } else f = Xa.get(b).apply(null, c);
158519
160016
  return f;
158520
160017
  };
@@ -158856,6 +160353,7 @@ var canvaskit = { exports: {} };
158856
160353
  return !(a && !Z);
158857
160354
  }
158858
160355
  function yd(a) {
160356
+ a || (a = A);
158859
160357
  if (!a.Xf) {
158860
160358
  a.Xf = true;
158861
160359
  var b = a.fe;
@@ -160814,7 +162312,7 @@ let canvasKitInitPromise = null;
160814
162312
  let canvasKit = null;
160815
162313
  let fontCache = null;
160816
162314
  async function initFont() {
160817
- const fontPath = path.join("/tmp/__dirname", "DejaVuSansMono.ttf");
162315
+ const fontPath = path$1.join("/tmp/__dirname", "DejaVuSansMono.ttf");
160818
162316
  const buffer2 = await fs.readFile(fontPath);
160819
162317
  return new Uint8Array(buffer2).buffer;
160820
162318
  }
@@ -161596,13 +163094,13 @@ var CachedFn = class {
161596
163094
  }
161597
163095
  };
161598
163096
  var Theme = class {
161599
- constructor(_colorMap, _defaults, _root) {
163097
+ constructor(_colorMap, _defaults, _root2) {
161600
163098
  __publicField2(this, "_cachedMatchRoot", new CachedFn(
161601
163099
  (scopeName) => this._root.match(scopeName)
161602
163100
  ));
161603
163101
  this._colorMap = _colorMap;
161604
163102
  this._defaults = _defaults;
161605
- this._root = _root;
163103
+ this._root = _root2;
161606
163104
  }
161607
163105
  static createFromRawTheme(source, colorMap) {
161608
163106
  return this.createFromParsedTheme(parseTheme(source), colorMap);
@@ -161851,13 +163349,13 @@ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
161851
163349
  }
161852
163350
  }
161853
163351
  let colorMap = new ColorMap(_colorMap);
161854
- let defaults = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
163352
+ let defaults2 = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
161855
163353
  let root2 = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
161856
163354
  for (let i2 = 0, len2 = parsedThemeRules.length; i2 < len2; i2++) {
161857
163355
  let rule = parsedThemeRules[i2];
161858
163356
  root2.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
161859
163357
  }
161860
- return new Theme(colorMap, defaults, root2);
163358
+ return new Theme(colorMap, defaults2, root2);
161861
163359
  }
161862
163360
  var ColorMap = class {
161863
163361
  constructor(_colorMap) {
@@ -166555,8 +168053,8 @@ function mergeToken(merged, variantsOrder, cssVariablePrefix, defaultColor) {
166555
168053
  function codeToHast(internal, code18, options, transformerContext = {
166556
168054
  meta: {},
166557
168055
  options,
166558
- codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
166559
- codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
168056
+ codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
168057
+ codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
166560
168058
  }) {
166561
168059
  var _a3, _b2;
166562
168060
  let input = code18;
@@ -166795,8 +168293,8 @@ function codeToHtml(internal, code18, options) {
166795
168293
  const context2 = {
166796
168294
  meta: {},
166797
168295
  options,
166798
- codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
166799
- codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
168296
+ codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
168297
+ codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
166800
168298
  };
166801
168299
  let result = toHtml(codeToHast(internal, code18, options, context2));
166802
168300
  for (const transformer of getTransformers(options))
@@ -172009,48 +173507,6 @@ async function doRewrite(completionsClient, query2, signal2) {
172009
173507
  const match2 = text2.match(/<query>(.*?)<\/query>/);
172010
173508
  return (match2 == null ? void 0 : match2[1]) ?? query2.toString();
172011
173509
  }
172012
- async function extractKeywords(completionsClient, query2, signal2) {
172013
- const preamble = getSimplePreamble(void 0, LEGACY_API_VERSION, "Default");
172014
- const client = new ChatClient(completionsClient);
172015
- const stream = await client.chat(
172016
- [
172017
- ...preamble,
172018
- {
172019
- speaker: "human",
172020
- text: ps`You are helping the user search over a codebase. List terms that could be found literally in code snippets or file names relevant to answering the user's query. Limit your results to terms that are in the user's query. Present your results in a *single* XML list in the following format: <keywords><keyword>a single keyword</keyword></keywords>. Here is the user query: <userQuery>${query2}</userQuery>`
172021
- }
172022
- ],
172023
- {
172024
- maxTokensToSample: 400,
172025
- temperature: 0,
172026
- topK: 1,
172027
- fast: true
172028
- },
172029
- signal2
172030
- );
172031
- let lastMessageText = "<keywords></keywords>";
172032
- for await (const message of stream) {
172033
- switch (message.type) {
172034
- case "change": {
172035
- lastMessageText = message.text;
172036
- break;
172037
- }
172038
- case "error": {
172039
- throw message.error;
172040
- }
172041
- }
172042
- }
172043
- const document2 = new fxp.XMLParser().parse(lastMessageText);
172044
- let keywords = [];
172045
- if (document2.keywords) {
172046
- if (Array.isArray(document2.keywords.keyword)) {
172047
- keywords = document2.keywords.keyword;
172048
- } else if (document2.keywords.keyword) {
172049
- keywords = [document2.keywords.keyword];
172050
- }
172051
- }
172052
- return keywords.flatMap((keyword) => keyword.split(" ").filter((v) => v !== ""));
172053
- }
172054
173510
  async function searchSymf(symf, editor, workspaceRoot, userText, blockOnIndex = false) {
172055
173511
  return wrapInActiveSpan("chat.context.symf", async () => {
172056
173512
  if (!symf) {
@@ -172236,20 +173692,6 @@ class ContextRetriever {
172236
173692
  skipQueryRewrite
172237
173693
  );
172238
173694
  }
172239
- /**
172240
- * Computes a "Did you mean?" suggestion for a given query by extracting keywords.
172241
- * Only attempts to extract keywords for queries that look like search queries.
172242
- */
172243
- async computeDidYouMean(query2, signal2) {
172244
- if (!looksLikeSearch(query2.toString())) {
172245
- return void 0;
172246
- }
172247
- const keywords = await extractKeywords(this.llms, query2, signal2);
172248
- if (keywords.length > 0) {
172249
- return keywords.join(" ");
172250
- }
172251
- return void 0;
172252
- }
172253
173695
  async _retrieveContext(roots, query2, span2, signal2, skipQueryRewrite = false) {
172254
173696
  if (roots.length === 0) {
172255
173697
  return [];
@@ -172454,7 +173896,7 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
172454
173896
  const relLocalFiles = /* @__PURE__ */ new Set();
172455
173897
  const localFiles = localFilesByRoot[i2] || [];
172456
173898
  for (const localFile of localFiles) {
172457
- relLocalFiles.add(path.relative(localRoot.fsPath, localFile));
173899
+ relLocalFiles.add(path$1.relative(localRoot.fsPath, localFile));
172458
173900
  }
172459
173901
  for (const remoteRepo of remoteRepos) {
172460
173902
  repoNameToLocalFiles.set(remoteRepo.name, relLocalFiles);
@@ -172480,21 +173922,6 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
172480
173922
  }
172481
173923
  return { keep: keep2, remove };
172482
173924
  }
172483
- const searchPatterns = [
172484
- /^where is/i,
172485
- /^look for/i,
172486
- /^search for/i,
172487
- /^find all/i,
172488
- /^list all/i,
172489
- /^get all/i,
172490
- /^show all/i,
172491
- /occurrences of/i,
172492
- /^where do we/i,
172493
- /examples of/i
172494
- ];
172495
- function looksLikeSearch(query2) {
172496
- return searchPatterns.some((pattern) => pattern.test(query2.trim()));
172497
- }
172498
173925
  function sortContextItemsIfInTest(files) {
172499
173926
  {
172500
173927
  return files;
@@ -172949,7 +174376,6 @@ class ChatHandler {
172949
174376
  model: model2
172950
174377
  }, delegate) {
172951
174378
  mentions = mentions.map((m) => m.source ? m : { ...m, source: ContextItemSource.User });
172952
- const didYouMeanPromise = this.contextRetriever.computeDidYouMean(inputText, signal2);
172953
174379
  const contextResult = await this.computeContext(
172954
174380
  requestID,
172955
174381
  { text: inputText, mentions },
@@ -172962,7 +174388,7 @@ class ChatHandler {
172962
174388
  delegate.postError(contextResult.error, "transcript");
172963
174389
  }
172964
174390
  if (contextResult.abort) {
172965
- delegate.postDone({ abort: contextResult.abort });
174391
+ delegate.postDone();
172966
174392
  return;
172967
174393
  }
172968
174394
  const corpusContext = contextResult.contextItems ?? [];
@@ -172977,25 +174403,11 @@ class ChatHandler {
172977
174403
  const { prompt } = await this.buildPrompt(prompter2, chatBuilder, signal2, versions.codyAPIVersion);
172978
174404
  recorder2.recordChatQuestionExecuted(corpusContext, { addMetadata: true, current: span2 });
172979
174405
  signal2.throwIfAborted();
172980
- const didYouMeanQuery = await didYouMeanPromise;
172981
- const delegateWithDidYouMean = {
172982
- ...delegate,
172983
- postMessageInProgress: (message) => {
172984
- delegate.postMessageInProgress({ ...message, didYouMeanQuery });
172985
- }
172986
- };
172987
- delegateWithDidYouMean.postMessageInProgress({
174406
+ delegate.postMessageInProgress({
172988
174407
  speaker: "assistant",
172989
174408
  model: model2
172990
174409
  });
172991
- this.streamAssistantResponse(
172992
- requestID,
172993
- prompt,
172994
- model2,
172995
- signal2,
172996
- chatBuilder,
172997
- delegateWithDidYouMean
172998
- );
174410
+ this.streamAssistantResponse(requestID, prompt, model2, signal2, chatBuilder, delegate);
172999
174411
  }
173000
174412
  /**
173001
174413
  * Issue the chat request and stream the results back, updating the model and view
@@ -173314,7 +174726,7 @@ async function getContextFileFromShell(command) {
173314
174726
  return [];
173315
174727
  }
173316
174728
  const cwd = (_e2 = (_d2 = (_c2 = workspace.workspaceFolders) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.uri) == null ? void 0 : _e2.fsPath;
173317
- const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path.sep}`);
174729
+ const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path$1.sep}`);
173318
174730
  const allowList = new Set((agenticShellConfig == null ? void 0 : agenticShellConfig.allow) ?? []);
173319
174731
  const blockList = /* @__PURE__ */ new Set([...BASE_DISALLOWED_COMMANDS, ...(agenticShellConfig == null ? void 0 : agenticShellConfig.block) ?? []]);
173320
174732
  try {
@@ -175931,9 +177343,9 @@ class ZodUnion extends ZodType {
175931
177343
  return this._def.options;
175932
177344
  }
175933
177345
  }
175934
- ZodUnion.create = (types, params) => {
177346
+ ZodUnion.create = (types2, params) => {
175935
177347
  return new ZodUnion({
175936
- options: types,
177348
+ options: types2,
175937
177349
  typeName: ZodFirstPartyTypeKind.ZodUnion,
175938
177350
  ...processCreateParams(params)
175939
177351
  });
@@ -178013,8 +179425,8 @@ class McpError extends Error {
178013
179425
  }
178014
179426
  const DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
178015
179427
  class Protocol {
178016
- constructor(_options) {
178017
- this._options = _options;
179428
+ constructor(_options2) {
179429
+ this._options = _options2;
178018
179430
  this._requestMessageId = 0;
178019
179431
  this._requestHandlers = /* @__PURE__ */ new Map();
178020
179432
  this._requestHandlerAbortControllers = /* @__PURE__ */ new Map();
@@ -180880,74 +182292,88 @@ function getCorpusContextItemsForEditorState() {
180880
182292
  ),
180881
182293
  distinctUntilChanged$1()
180882
182294
  );
180883
- return combineLatest$1(relevantAuthStatus, remoteReposForAllWorkspaceFolders).pipe(
180884
- abortableOperation(async ([authStatus2, remoteReposForAllWorkspaceFolders2], signal2) => {
180885
- var _a3;
180886
- const items = [];
180887
- const workspaceFolder = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3.at(0);
180888
- if (workspaceFolder) {
180889
- items.push({
180890
- type: "tree",
180891
- uri: workspaceFolder.uri,
180892
- title: "Current Repository",
180893
- name: workspaceFolder.name,
180894
- description: workspaceFolder.name,
180895
- isWorkspaceRoot: true,
180896
- content: null,
180897
- source: ContextItemSource.Initial,
180898
- icon: "folder"
180899
- });
180900
- }
180901
- if (authStatus2.allowRemoteContext) {
180902
- if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
180903
- return pendingOperation;
180904
- }
180905
- if (isError$3(remoteReposForAllWorkspaceFolders2)) {
180906
- throw remoteReposForAllWorkspaceFolders2;
182295
+ return combineLatest$1(
182296
+ relevantAuthStatus,
182297
+ remoteReposForAllWorkspaceFolders,
182298
+ activeTextEditor,
182299
+ featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.SymfRetrievalDisabled)
182300
+ ).pipe(
182301
+ abortableOperation(
182302
+ async ([authStatus2, remoteReposForAllWorkspaceFolders2, activeEditor, symfRetrievalDisabled], signal2) => {
182303
+ var _a3;
182304
+ const items = [];
182305
+ const workspaceFolders2 = workspace.workspaceFolders;
182306
+ if (workspaceFolders2 && !symfRetrievalDisabled) {
182307
+ let currentWorkspaceFolder;
182308
+ const activeVisibleEditor = activeEditor || window$1.visibleTextEditors[0];
182309
+ currentWorkspaceFolder = activeVisibleEditor ? workspace.getWorkspaceFolder((_a3 = activeVisibleEditor.document) == null ? void 0 : _a3.uri) : workspaceFolders2[0];
182310
+ for (const workspaceFolder of workspaceFolders2) {
182311
+ const isCurrentFolder = currentWorkspaceFolder && workspaceFolder.uri.toString() === currentWorkspaceFolder.uri.toString();
182312
+ items.push({
182313
+ type: "tree",
182314
+ uri: workspaceFolder.uri,
182315
+ title: isCurrentFolder ? "Current Repository" : workspaceFolder.name,
182316
+ name: workspaceFolder.name,
182317
+ description: workspaceFolder.name,
182318
+ isWorkspaceRoot: true,
182319
+ content: null,
182320
+ // Current folder goes to initial context (pre-filled), others go to corpus context (@ mention menu)
182321
+ source: isCurrentFolder ? ContextItemSource.Initial : ContextItemSource.User,
182322
+ icon: "folder"
182323
+ });
182324
+ }
180907
182325
  }
180908
- for (const repo of remoteReposForAllWorkspaceFolders2) {
180909
- if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
180910
- continue;
182326
+ if (authStatus2.allowRemoteContext) {
182327
+ if (remoteReposForAllWorkspaceFolders2 === pendingOperation) {
182328
+ return pendingOperation;
180911
182329
  }
180912
- if (repo.id === void 0) {
180913
- continue;
182330
+ if (isError$3(remoteReposForAllWorkspaceFolders2)) {
182331
+ throw remoteReposForAllWorkspaceFolders2;
180914
182332
  }
180915
- items.push({
180916
- ...contextItemMentionFromOpenCtxItem(
180917
- await createRepositoryMention(
180918
- {
180919
- id: repo.id,
180920
- name: repo.name,
180921
- url: repo.name
180922
- },
180923
- REMOTE_REPOSITORY_PROVIDER_URI,
180924
- authStatus2
180925
- )
180926
- ),
180927
- title: "Current Codebase",
180928
- description: repo.name,
180929
- source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180930
- icon: "search"
180931
- });
180932
- }
180933
- if (authStatus2.isEnterpriseUser && remoteReposForAllWorkspaceFolders2.length === 0) {
180934
- if (!clientCapabilities().isCodyWeb) {
182333
+ for (const repo of remoteReposForAllWorkspaceFolders2) {
182334
+ if (await contextFiltersProvider.isRepoNameIgnored(repo.name)) {
182335
+ continue;
182336
+ }
182337
+ if (repo.id === void 0) {
182338
+ continue;
182339
+ }
180935
182340
  items.push({
180936
- type: "open-link",
180937
- title: "Current Codebase",
180938
- badge: "Not yet available",
180939
- content: null,
180940
- uri: URI.parse(
180941
- "https://sourcegraph.com/docs/cody/prompts-guide#indexing-your-repositories-for-context"
182341
+ ...contextItemMentionFromOpenCtxItem(
182342
+ await createRepositoryMention(
182343
+ {
182344
+ id: repo.id,
182345
+ name: repo.name,
182346
+ url: repo.name
182347
+ },
182348
+ REMOTE_REPOSITORY_PROVIDER_URI,
182349
+ authStatus2
182350
+ )
180942
182351
  ),
180943
- name: "",
182352
+ title: "Current Codebase",
182353
+ description: repo.name,
182354
+ source: items.length > 0 ? ContextItemSource.Unified : ContextItemSource.Initial,
180944
182355
  icon: "search"
180945
182356
  });
180946
182357
  }
182358
+ if (authStatus2.isEnterpriseUser && remoteReposForAllWorkspaceFolders2.length === 0) {
182359
+ if (!clientCapabilities().isCodyWeb) {
182360
+ items.push({
182361
+ type: "open-link",
182362
+ title: "Current Codebase",
182363
+ badge: "Not yet available",
182364
+ content: null,
182365
+ uri: URI.parse(
182366
+ "https://sourcegraph.com/docs/cody/prompts-guide#indexing-your-repositories-for-context"
182367
+ ),
182368
+ name: "",
182369
+ icon: "search"
182370
+ });
182371
+ }
182372
+ }
180947
182373
  }
182374
+ return items;
180948
182375
  }
180949
- return items;
180950
- })
182376
+ )
180951
182377
  );
180952
182378
  }
180953
182379
  function getOpenCtxContextItems() {
@@ -182280,6 +183706,10 @@ class ChatsController {
182280
183706
  }),
182281
183707
  commands$1.registerCommand("cody.chat.toggle", async () => this.toggleChatPanel()),
182282
183708
  commands$1.registerCommand("cody.chat.history.export", () => this.exportHistory()),
183709
+ commands$1.registerCommand(
183710
+ "cody.chat.history.export.all",
183711
+ () => this.exportAllChatsUnauthenticated()
183712
+ ),
182283
183713
  commands$1.registerCommand("cody.chat.history.clear", (arg) => this.clearHistory(arg)),
182284
183714
  commands$1.registerCommand("cody.chat.history.delete", (item) => this.clearHistory(item)),
182285
183715
  commands$1.registerCommand("cody.chat.history.rename", (arg) => this.renameHistory(arg)),
@@ -182459,6 +183889,61 @@ class ChatsController {
182459
183889
  }
182460
183890
  }
182461
183891
  }
183892
+ /**
183893
+ * Export all chat history to file system without authentication check
183894
+ * Useful for users who can't authenticate but still have local chat data
183895
+ */
183896
+ async exportAllChatsUnauthenticated() {
183897
+ var _a3, _b2;
183898
+ telemetryRecorder.recordEvent("cody.exportAllChats", "clicked", {
183899
+ billingMetadata: {
183900
+ product: "cody",
183901
+ category: "billable"
183902
+ }
183903
+ });
183904
+ try {
183905
+ const allChatHistory = localStorage.getAllChatHistory();
183906
+ if (!allChatHistory || Object.keys(allChatHistory).length === 0) {
183907
+ void window$1.showInformationMessage("No chat history found to export.");
183908
+ return;
183909
+ }
183910
+ const allChats = Object.values(allChatHistory).flatMap(
183911
+ (userHistory) => Object.values(userHistory.chat || {})
183912
+ );
183913
+ if (allChats.length === 0) {
183914
+ void window$1.showInformationMessage("No chat history found to export.");
183915
+ return;
183916
+ }
183917
+ const workspaceFolder = (_b2 = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.uri;
183918
+ const defaultDir = workspaceFolder || Uri.file(require("node:os").homedir());
183919
+ const filename = `cody-all-chats-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.json`;
183920
+ const exportPath = await window$1.showSaveDialog({
183921
+ title: "Cody: Export All Chat History",
183922
+ filters: { "Chat History": ["json"] },
183923
+ defaultUri: Uri.joinPath(defaultDir, filename)
183924
+ });
183925
+ if (!exportPath) {
183926
+ return;
183927
+ }
183928
+ const logContent = new TextEncoder().encode(JSON.stringify(allChats, null, 2));
183929
+ await workspace.fs.writeFile(exportPath, logContent);
183930
+ void window$1.showInformationMessage(
183931
+ `Successfully exported ${allChats.length} chat conversations.`,
183932
+ "Open"
183933
+ ).then((choice) => {
183934
+ if (choice === "Open") {
183935
+ void commands$1.executeCommand("vscode.open", exportPath);
183936
+ }
183937
+ });
183938
+ } catch (error) {
183939
+ logError$1(
183940
+ "ChatsController:exportAllChatsUnauthenticated",
183941
+ "Failed to export all chat history",
183942
+ error
183943
+ );
183944
+ void window$1.showErrorMessage("Failed to export chat history. See output for details.");
183945
+ }
183946
+ }
182462
183947
  async clearHistory(chatID) {
182463
183948
  const ClearWithoutConfirmID = "clear-all-no-confirm";
182464
183949
  const isClearAll = !chatID || chatID === ClearWithoutConfirmID;
@@ -183434,17 +184919,17 @@ const getDefaultOptions = (options) => ({
183434
184919
  ...options
183435
184920
  });
183436
184921
  const getRefs = (options) => {
183437
- const _options = getDefaultOptions(options);
183438
- const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
184922
+ const _options2 = getDefaultOptions(options);
184923
+ const currentPath = _options2.name !== void 0 ? [..._options2.basePath, _options2.definitionPath, _options2.name] : _options2.basePath;
183439
184924
  return {
183440
- ..._options,
184925
+ ..._options2,
183441
184926
  currentPath,
183442
184927
  propertyPath: void 0,
183443
- seen: new Map(Object.entries(_options.definitions).map(([name2, def]) => [
184928
+ seen: new Map(Object.entries(_options2.definitions).map(([name2, def]) => [
183444
184929
  def._def,
183445
184930
  {
183446
184931
  def: def._def,
183447
- path: [..._options.basePath, _options.definitionPath, name2],
184932
+ path: [..._options2.basePath, _options2.definitionPath, name2],
183448
184933
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
183449
184934
  jsonSchema: void 0
183450
184935
  }
@@ -184106,15 +185591,15 @@ function parseUnionDef(def, refs) {
184106
185591
  return asAnyOf(def, refs);
184107
185592
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
184108
185593
  if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
184109
- const types = options.reduce((types2, x) => {
185594
+ const types2 = options.reduce((types3, x) => {
184110
185595
  const type = primitiveMappings[x._def.typeName];
184111
- return type && !types2.includes(type) ? [...types2, type] : types2;
185596
+ return type && !types3.includes(type) ? [...types3, type] : types3;
184112
185597
  }, []);
184113
185598
  return {
184114
- type: types.length > 1 ? types : types[0]
185599
+ type: types2.length > 1 ? types2 : types2[0]
184115
185600
  };
184116
185601
  } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
184117
- const types = options.reduce((acc, x) => {
185602
+ const types2 = options.reduce((acc, x) => {
184118
185603
  const type = typeof x._def.value;
184119
185604
  switch (type) {
184120
185605
  case "string":
@@ -184133,8 +185618,8 @@ function parseUnionDef(def, refs) {
184133
185618
  return acc;
184134
185619
  }
184135
185620
  }, []);
184136
- if (types.length === options.length) {
184137
- const uniqueTypes = types.filter((x, i2, a) => a.indexOf(x) === i2);
185621
+ if (types2.length === options.length) {
185622
+ const uniqueTypes = types2.filter((x, i2, a) => a.indexOf(x) === i2);
184138
185623
  return {
184139
185624
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
184140
185625
  enum: options.reduce((acc, x) => {
@@ -186209,343 +187694,352 @@ class ChatController {
186209
187694
  */
186210
187695
  async onDidReceiveMessage(message) {
186211
187696
  var _a3, _b2, _c2;
186212
- switch (message.command) {
186213
- case "ready":
186214
- await this.handleReady();
186215
- break;
186216
- case "initialized":
186217
- await this.handleInitialized();
186218
- this.setWebviewToChat();
186219
- break;
186220
- case "submit": {
186221
- await this.handleUserMessage({
186222
- requestID: v4(),
186223
- inputText: PromptString.unsafe_fromUserQuery(message.text),
186224
- mentions: message.contextItems ?? [],
186225
- editorState: message.editorState,
186226
- signal: this.startNewSubmitOrEditOperation(),
186227
- source: "chat",
186228
- manuallySelectedIntent: message.manuallySelectedIntent,
186229
- traceparent: message.traceparent
186230
- });
186231
- break;
186232
- }
186233
- case "edit": {
186234
- this.cancelSubmitOrEditOperation();
186235
- await this.handleEdit({
186236
- requestID: v4(),
186237
- text: PromptString.unsafe_fromUserQuery(message.text),
186238
- index: message.index ?? void 0,
186239
- contextFiles: message.contextItems ?? [],
186240
- editorState: message.editorState,
186241
- manuallySelectedIntent: message.manuallySelectedIntent
186242
- });
186243
- break;
186244
- }
186245
- case "reevaluateSearchWithSelectedFilters": {
186246
- await this.reevaluateSearchWithSelectedFilters({
186247
- index: message.index ?? void 0,
186248
- selectedFilters: message.selectedFilters
186249
- });
186250
- break;
186251
- }
186252
- case "abort":
186253
- this.handleAbort();
186254
- break;
186255
- case "insert":
186256
- await handleCodeFromInsertAtCursor(message.text);
186257
- break;
186258
- case "copy":
186259
- await handleCopiedCode(message.text, message.eventType);
186260
- break;
186261
- case "smartApplyPrefetch":
186262
- case "smartApplySubmit":
186263
- await handleSmartApply({
186264
- id: message.id,
186265
- code: message.code,
186266
- authStatus: currentAuthStatus(),
186267
- instruction: message.instruction || "",
186268
- fileUri: message.fileName,
186269
- traceparent: message.traceparent || void 0,
186270
- isPrefetch: message.command === "smartApplyPrefetch"
186271
- });
186272
- break;
186273
- case "trace-export":
186274
- TraceSender.send(message.traceSpanEncodedJson);
186275
- break;
186276
- case "smartApplyAccept":
186277
- await commands$1.executeCommand("cody.command.smart-apply.accept", {
186278
- taskId: message.id
186279
- });
186280
- break;
186281
- case "smartApplyReject":
186282
- await commands$1.executeCommand("cody.command.smart-apply.reject", {
186283
- taskId: message.id
186284
- });
186285
- break;
186286
- case "openURI":
186287
- commands$1.executeCommand("vscode.open", message.uri, {
186288
- selection: message.range
186289
- });
186290
- break;
186291
- case "links": {
186292
- void openExternalLinks(message.value);
186293
- break;
186294
- }
186295
- case "openFileLink":
186296
- {
186297
- if ((_b2 = (_a3 = message == null ? void 0 : message.uri) == null ? void 0 : _a3.scheme) == null ? void 0 : _b2.startsWith("http")) {
186298
- this.openRemoteFile(message.uri, true);
186299
- return;
186300
- }
186301
- const isInSidebar = this._webviewPanelOrView && !("viewColumn" in this._webviewPanelOrView);
186302
- commands$1.executeCommand("vscode.open", message.uri, {
186303
- selection: message.range,
186304
- preserveFocus: true,
186305
- background: false,
186306
- preview: true,
186307
- // Use the active column if in sidebar, otherwise use Beside
186308
- viewColumn: isInSidebar ? ViewColumn.Active : ViewColumn.Beside
187697
+ try {
187698
+ switch (message.command) {
187699
+ case "ready":
187700
+ await this.handleReady();
187701
+ break;
187702
+ case "initialized":
187703
+ await this.handleInitialized();
187704
+ this.setWebviewToChat();
187705
+ break;
187706
+ case "submit": {
187707
+ await this.handleUserMessage({
187708
+ requestID: v4(),
187709
+ inputText: PromptString.unsafe_fromUserQuery(message.text),
187710
+ mentions: message.contextItems ?? [],
187711
+ editorState: message.editorState,
187712
+ signal: this.startNewSubmitOrEditOperation(),
187713
+ source: "chat",
187714
+ manuallySelectedIntent: message.manuallySelectedIntent,
187715
+ traceparent: message.traceparent
186309
187716
  });
187717
+ break;
186310
187718
  }
186311
- break;
186312
- case "openRemoteFile":
186313
- this.openRemoteFile(message.uri, message.tryLocal ?? false);
186314
- break;
186315
- case "newFile":
186316
- await handleCodeFromSaveToNewFile(message.text, this.editor);
186317
- break;
186318
- case "show-page":
186319
- await commands$1.executeCommand("cody.show-page", message.page);
186320
- break;
186321
- case "attribution-search":
186322
- await this.handleAttributionSearch(message.snippet);
186323
- break;
186324
- case "restoreHistory":
186325
- this.restoreSession(message.chatID);
186326
- this.setWebviewToChat();
186327
- break;
186328
- case "chatSession":
186329
- switch (message.action) {
186330
- case "new":
186331
- this.clearAndRestartSession();
186332
- break;
186333
- case "duplicate":
186334
- await this.duplicateSession(message.sessionID ?? this.chatBuilder.sessionID);
186335
- break;
187719
+ case "edit": {
187720
+ this.cancelSubmitOrEditOperation();
187721
+ await this.handleEdit({
187722
+ requestID: v4(),
187723
+ text: PromptString.unsafe_fromUserQuery(message.text),
187724
+ index: message.index ?? void 0,
187725
+ contextFiles: message.contextItems ?? [],
187726
+ editorState: message.editorState,
187727
+ manuallySelectedIntent: message.manuallySelectedIntent
187728
+ });
187729
+ break;
186336
187730
  }
186337
- break;
186338
- case "command":
186339
- commands$1.executeCommand(message.id, message.arg ?? message.args);
186340
- break;
186341
- case "mcp": {
186342
- const mcpManager = MCPManager.instance;
186343
- if (!mcpManager) {
186344
- logDebug("ChatController", "MCP Manager is not initialized");
187731
+ case "abort":
187732
+ this.handleAbort();
187733
+ break;
187734
+ case "insert":
187735
+ await handleCodeFromInsertAtCursor(message.text);
187736
+ break;
187737
+ case "copy":
187738
+ await handleCopiedCode(message.text, message.eventType);
187739
+ break;
187740
+ case "smartApplyPrefetch":
187741
+ case "smartApplySubmit":
187742
+ await handleSmartApply({
187743
+ id: message.id,
187744
+ code: message.code,
187745
+ authStatus: currentAuthStatus(),
187746
+ instruction: message.instruction || "",
187747
+ fileUri: message.fileName,
187748
+ traceparent: message.traceparent || void 0,
187749
+ isPrefetch: message.command === "smartApplyPrefetch"
187750
+ });
187751
+ break;
187752
+ case "trace-export":
187753
+ TraceSender.send(message.traceSpanEncodedJson);
187754
+ break;
187755
+ case "smartApplyAccept":
187756
+ await commands$1.executeCommand("cody.command.smart-apply.accept", {
187757
+ taskId: message.id
187758
+ });
187759
+ break;
187760
+ case "smartApplyReject":
187761
+ await commands$1.executeCommand("cody.command.smart-apply.reject", {
187762
+ taskId: message.id
187763
+ });
187764
+ break;
187765
+ case "openURI":
187766
+ commands$1.executeCommand("vscode.open", message.uri, {
187767
+ selection: message.range
187768
+ });
187769
+ break;
187770
+ case "links": {
187771
+ void openExternalLinks(message.value);
186345
187772
  break;
186346
187773
  }
186347
- const serverName = message.name;
186348
- try {
186349
- if (message.type === "updateServer" && !serverName) {
186350
- mcpManager.refreshServers();
186351
- break;
187774
+ case "openFileLink":
187775
+ {
187776
+ if ((_b2 = (_a3 = message == null ? void 0 : message.uri) == null ? void 0 : _a3.scheme) == null ? void 0 : _b2.startsWith("http")) {
187777
+ this.openRemoteFile(message.uri, true);
187778
+ return;
187779
+ }
187780
+ const isInSidebar = this._webviewPanelOrView && !("viewColumn" in this._webviewPanelOrView);
187781
+ commands$1.executeCommand("vscode.open", message.uri, {
187782
+ selection: message.range,
187783
+ preserveFocus: true,
187784
+ background: false,
187785
+ preview: true,
187786
+ // Use the active column if in sidebar, otherwise use Beside
187787
+ viewColumn: isInSidebar ? ViewColumn.Active : ViewColumn.Beside
187788
+ });
187789
+ }
187790
+ break;
187791
+ case "openRemoteFile":
187792
+ this.openRemoteFile(message.uri, message.tryLocal ?? false);
187793
+ break;
187794
+ case "newFile":
187795
+ await handleCodeFromSaveToNewFile(message.text, this.editor);
187796
+ break;
187797
+ case "show-page":
187798
+ await commands$1.executeCommand("cody.show-page", message.page);
187799
+ break;
187800
+ case "attribution-search":
187801
+ await this.handleAttributionSearch(message.snippet);
187802
+ break;
187803
+ case "restoreHistory":
187804
+ this.restoreSession(message.chatID);
187805
+ this.setWebviewToChat();
187806
+ break;
187807
+ case "chatSession":
187808
+ switch (message.action) {
187809
+ case "new":
187810
+ this.clearAndRestartSession();
187811
+ break;
187812
+ case "duplicate":
187813
+ await this.duplicateSession(message.sessionID ?? this.chatBuilder.sessionID);
187814
+ break;
186352
187815
  }
186353
- if (!serverName) {
187816
+ break;
187817
+ case "command":
187818
+ commands$1.executeCommand(message.id, message.arg ?? message.args);
187819
+ break;
187820
+ case "mcp": {
187821
+ const mcpManager = MCPManager.instance;
187822
+ if (!mcpManager) {
187823
+ logDebug("ChatController", "MCP Manager is not initialized");
186354
187824
  break;
186355
187825
  }
186356
- switch (message.type) {
186357
- case "addServer": {
186358
- if (!message.config) {
187826
+ const serverName = message.name;
187827
+ try {
187828
+ if (message.type === "updateServer" && !serverName) {
187829
+ mcpManager.refreshServers();
187830
+ break;
187831
+ }
187832
+ if (!serverName) {
187833
+ break;
187834
+ }
187835
+ switch (message.type) {
187836
+ case "addServer": {
187837
+ if (!message.config) {
187838
+ break;
187839
+ }
187840
+ await mcpManager.addServer(serverName, message.config);
187841
+ const newServer = mcpManager.getServers().find((s) => s.name === serverName);
187842
+ if (newServer) {
187843
+ void this.postMessage({
187844
+ type: "clientAction",
187845
+ mcpServerChanged: {
187846
+ name: newServer.name,
187847
+ server: newServer
187848
+ }
187849
+ });
187850
+ }
186359
187851
  break;
186360
187852
  }
186361
- await mcpManager.addServer(serverName, message.config);
186362
- const newServer = mcpManager.getServers().find((s) => s.name === serverName);
186363
- if (newServer) {
186364
- void this.postMessage({
187853
+ case "updateServer":
187854
+ if (message.config) {
187855
+ await mcpManager.updateServer(serverName, message.config);
187856
+ } else if (message.toolName) {
187857
+ const isDisabled = message.toolDisabled === true;
187858
+ await mcpManager.setToolState(
187859
+ serverName,
187860
+ message.toolName,
187861
+ isDisabled
187862
+ );
187863
+ }
187864
+ break;
187865
+ case "removeServer": {
187866
+ await mcpManager.deleteServer(serverName);
187867
+ this.postMessage({
186365
187868
  type: "clientAction",
186366
187869
  mcpServerChanged: {
186367
- name: newServer.name,
186368
- server: newServer
187870
+ name: serverName,
187871
+ server: null
186369
187872
  }
186370
187873
  });
187874
+ break;
186371
187875
  }
186372
- break;
186373
- }
186374
- case "updateServer":
186375
- if (message.config) {
186376
- await mcpManager.updateServer(serverName, message.config);
186377
- } else if (message.toolName) {
186378
- const isDisabled = message.toolDisabled === true;
186379
- await mcpManager.setToolState(serverName, message.toolName, isDisabled);
186380
- }
186381
- break;
186382
- case "removeServer": {
186383
- await mcpManager.deleteServer(serverName);
186384
- this.postMessage({
186385
- type: "clientAction",
186386
- mcpServerChanged: {
186387
- name: serverName,
186388
- server: null
186389
- }
186390
- });
186391
- break;
187876
+ default:
187877
+ logDebug("ChatController", `Unknown MCP operation: ${message.type}`);
186392
187878
  }
186393
- default:
186394
- logDebug("ChatController", `Unknown MCP operation: ${message.type}`);
187879
+ } catch (error) {
187880
+ const errorMessage = error instanceof Error ? error.message : String(error);
187881
+ logDebug("ChatController", `Failed to ${message.type} server`, errorMessage);
187882
+ void this.postMessage({
187883
+ type: "clientAction",
187884
+ mcpServerError: {
187885
+ name: "name" in message ? serverName : "",
187886
+ error: errorMessage
187887
+ },
187888
+ mcpServerChanged: null
187889
+ });
186395
187890
  }
186396
- } catch (error) {
186397
- const errorMessage = error instanceof Error ? error.message : String(error);
186398
- logDebug("ChatController", `Failed to ${message.type} server`, errorMessage);
186399
- void this.postMessage({
186400
- type: "clientAction",
186401
- mcpServerError: {
186402
- name: "name" in message ? serverName : "",
186403
- error: errorMessage
186404
- },
186405
- mcpServerChanged: null
186406
- });
186407
- }
186408
- break;
186409
- }
186410
- case "recordEvent":
186411
- telemetryRecorder.recordEvent(
186412
- // 👷 HACK: We have no control over what gets sent over JSON RPC,
186413
- // so we depend on client implementations to give type guidance
186414
- // to ensure that we don't accidentally share arbitrary,
186415
- // potentially sensitive string values. In this RPC handler,
186416
- // when passing the provided event to the TelemetryRecorder
186417
- // implementation, we forcibly cast all the inputs below
186418
- // (feature, action, parameters) into known types (strings
186419
- // 'feature', 'action', 'key') so that the recorder will accept
186420
- // it. DO NOT do this elsewhere!
186421
- message.feature,
186422
- message.action,
186423
- message.parameters
186424
- );
186425
- break;
186426
- case "auth": {
186427
- if (message.authKind === "refresh") {
186428
- authProvider.refresh();
186429
187891
  break;
186430
187892
  }
186431
- if (message.authKind === "simplified-onboarding") {
186432
- const endpoint = DOTCOM_URL.href;
186433
- let tokenReceiverUrl = void 0;
186434
- closeAuthProgressIndicator();
186435
- startAuthProgressIndicator();
186436
- tokenReceiverUrl = await ((_c2 = this.startTokenReceiver) == null ? void 0 : _c2.call(this, endpoint, async (credentials) => {
187893
+ case "recordEvent":
187894
+ telemetryRecorder.recordEvent(
187895
+ // 👷 HACK: We have no control over what gets sent over JSON RPC,
187896
+ // so we depend on client implementations to give type guidance
187897
+ // to ensure that we don't accidentally share arbitrary,
187898
+ // potentially sensitive string values. In this RPC handler,
187899
+ // when passing the provided event to the TelemetryRecorder
187900
+ // implementation, we forcibly cast all the inputs below
187901
+ // (feature, action, parameters) into known types (strings
187902
+ // 'feature', 'action', 'key') so that the recorder will accept
187903
+ // it. DO NOT do this elsewhere!
187904
+ message.feature,
187905
+ message.action,
187906
+ message.parameters
187907
+ );
187908
+ break;
187909
+ case "auth": {
187910
+ 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;
186437
187917
  closeAuthProgressIndicator();
186438
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186439
- credentials,
186440
- "store-if-valid"
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
186441
187953
  );
186442
- telemetryRecorder.recordEvent("cody.auth.fromTokenReceiver.web", "succeeded", {
186443
- metadata: {
186444
- success: authStatus2.authenticated ? 1 : 0
186445
- },
186446
- billingMetadata: {
186447
- product: "cody",
186448
- category: "billable"
187954
+ if (!successfullyOpenedUrl) {
187955
+ closeAuthProgressIndicator();
187956
+ }
187957
+ break;
187958
+ }
187959
+ if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
187960
+ try {
187961
+ const { endpoint, value: token } = message;
187962
+ let auth2 = void 0;
187963
+ if (token) {
187964
+ auth2 = {
187965
+ credentials: { token, source: "paste" },
187966
+ serverEndpoint: endpoint
187967
+ };
187968
+ } else {
187969
+ const { configuration } = await currentResolvedConfig();
187970
+ auth2 = await resolveAuth(endpoint, configuration, secretStorage);
186449
187971
  }
186450
- });
186451
- if (!authStatus2.authenticated) {
186452
- void window$1.showErrorMessage(
186453
- "Authentication failed. Please check your token and try again."
186454
- );
187972
+ if (!auth2 || !auth2.credentials) {
187973
+ return redirectToEndpointLogin(endpoint);
187974
+ }
187975
+ await authProvider.validateAndStoreCredentials(auth2, "always-store");
187976
+ } catch (error) {
187977
+ void window$1.showErrorMessage(`Authentication failed: ${error}`);
187978
+ this.postError(new Error(`Authentication failed: ${error}`));
186455
187979
  }
186456
- }));
186457
- const authProviderSimplified = new AuthProviderSimplified();
186458
- const authMethod = message.authMethod || "dotcom";
186459
- const successfullyOpenedUrl = await authProviderSimplified.openExternalAuthUrl(
186460
- authMethod,
186461
- tokenReceiverUrl
186462
- );
186463
- if (!successfullyOpenedUrl) {
186464
- closeAuthProgressIndicator();
187980
+ break;
186465
187981
  }
186466
- break;
186467
- }
186468
- if ((message.authKind === "signin" || message.authKind === "callback") && message.endpoint) {
186469
- try {
186470
- const { endpoint, value: token } = message;
186471
- let auth2 = void 0;
186472
- if (token) {
186473
- auth2 = {
186474
- credentials: { token, source: "paste" },
186475
- serverEndpoint: endpoint
186476
- };
187982
+ if (message.authKind === "signout") {
187983
+ const serverEndpoint = message.endpoint;
187984
+ if (serverEndpoint) {
187985
+ await signOut(serverEndpoint);
186477
187986
  } else {
186478
- const { configuration } = await currentResolvedConfig();
186479
- auth2 = await resolveAuth(endpoint, configuration, secretStorage);
186480
- }
186481
- if (!auth2 || !auth2.credentials) {
186482
- return redirectToEndpointLogin(endpoint);
187987
+ await showSignOutMenu();
186483
187988
  }
186484
- await authProvider.validateAndStoreCredentials(auth2, "always-store");
186485
- } catch (error) {
186486
- void window$1.showErrorMessage(`Authentication failed: ${error}`);
186487
- this.postError(new Error(`Authentication failed: ${error}`));
187989
+ await this.sendConfig(currentAuthStatus());
187990
+ break;
186488
187991
  }
187992
+ if (message.authKind === "switch") {
187993
+ await showSignInMenu();
187994
+ break;
187995
+ }
187996
+ await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186489
187997
  break;
186490
187998
  }
186491
- if (message.authKind === "signout") {
186492
- const serverEndpoint = message.endpoint;
186493
- if (serverEndpoint) {
186494
- await signOut(serverEndpoint);
186495
- } else {
186496
- await showSignOutMenu();
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;
186497
188019
  }
186498
- await this.sendConfig(currentAuthStatus());
186499
188020
  break;
186500
188021
  }
186501
- if (message.authKind === "switch") {
186502
- await showSignInMenu();
188022
+ case "log": {
188023
+ const logger2 = message.level === "debug" ? logDebug : logError$2;
188024
+ logger2(message.filterLabel, message.message);
186503
188025
  break;
186504
188026
  }
186505
- await commands$1.executeCommand(`cody.auth.${message.authKind}`);
186506
- break;
186507
- }
186508
- case "simplified-onboarding": {
186509
- if (message.onboardingKind === "web-sign-in-token") {
186510
- void window$1.showInputBox({ prompt: "Enter web sign-in token" }).then(async (token) => {
186511
- if (!token) {
186512
- return;
186513
- }
186514
- const authStatus2 = await authProvider.validateAndStoreCredentials(
186515
- {
186516
- serverEndpoint: DOTCOM_URL.href,
186517
- credentials: { token }
186518
- },
186519
- "store-if-valid"
186520
- );
186521
- if (!authStatus2.authenticated) {
186522
- void window$1.showErrorMessage(
186523
- "Authentication failed. Please check your token and try again."
186524
- );
186525
- }
188027
+ case "devicePixelRatio": {
188028
+ localStorage.setDevicePixelRatio(message.devicePixelRatio);
188029
+ break;
188030
+ }
188031
+ case "regenerateCodeBlock": {
188032
+ await this.handleRegenerateCodeBlock({
188033
+ requestID: message.id,
188034
+ code: PromptString.unsafe_fromLLMResponse(message.code),
188035
+ language: message.language ? PromptString.unsafe_fromLLMResponse(message.language) : void 0,
188036
+ index: message.index
186526
188037
  });
186527
188038
  break;
186528
188039
  }
186529
- break;
186530
- }
186531
- case "log": {
186532
- const logger2 = message.level === "debug" ? logDebug : logError$2;
186533
- logger2(message.filterLabel, message.message);
186534
- break;
186535
- }
186536
- case "devicePixelRatio": {
186537
- localStorage.setDevicePixelRatio(message.devicePixelRatio);
186538
- break;
186539
- }
186540
- case "regenerateCodeBlock": {
186541
- await this.handleRegenerateCodeBlock({
186542
- requestID: message.id,
186543
- code: PromptString.unsafe_fromLLMResponse(message.code),
186544
- language: message.language ? PromptString.unsafe_fromLLMResponse(message.language) : void 0,
186545
- index: message.index
186546
- });
186547
- break;
186548
188040
  }
188041
+ } catch (error) {
188042
+ this.postError(error);
186549
188043
  }
186550
188044
  }
186551
188045
  isSmartApplyEnabled() {
@@ -186559,15 +188053,6 @@ class ChatController {
186559
188053
  async getConfigForWebview() {
186560
188054
  var _a3, _b2, _c2, _d2;
186561
188055
  const { configuration, auth: auth2 } = await currentResolvedConfig();
186562
- const [experimentalPromptEditorEnabled, internalAgentModeEnabled] = await Promise.all([
186563
- firstValueFrom$1(
186564
- featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.CodyExperimentalPromptEditor)
186565
- ),
186566
- firstValueFrom$1(
186567
- featureFlagProvider.evaluatedFeatureFlag(FeatureFlag.NextAgenticChatInternal)
186568
- )
186569
- ]);
186570
- const experimentalAgenticChatEnabled = internalAgentModeEnabled && isS2(auth2.serverEndpoint);
186571
188056
  const sidebarViewOnly = ((_b2 = (_a3 = this.extensionClient.capabilities) == null ? void 0 : _a3.webviewNativeConfig) == null ? void 0 : _b2.view) === "single";
186572
188057
  const isEditorViewType = ((_c2 = this.webviewPanelOrView) == null ? void 0 : _c2.viewType) === "cody.editorPanel";
186573
188058
  const webviewType = isEditorViewType && !sidebarViewOnly ? "editor" : "sidebar";
@@ -186587,8 +188072,6 @@ class ChatController {
186587
188072
  internalDebugContext: configuration.internalDebugContext,
186588
188073
  internalDebugTokenUsage: configuration.internalDebugTokenUsage,
186589
188074
  allowEndpointChange: configuration.overrideServerEndpoint === void 0,
186590
- experimentalPromptEditorEnabled,
186591
- experimentalAgenticChatEnabled,
186592
188075
  attribution
186593
188076
  };
186594
188077
  }
@@ -186806,16 +188289,14 @@ class ChatController {
186806
188289
  });
186807
188290
  return confirmation;
186808
188291
  },
186809
- postDone: async (op) => {
188292
+ postDone: async () => {
188293
+ var _a3;
186810
188294
  span2.end();
186811
- if ((op == null ? void 0 : op.abort) || signal2.aborted) {
186812
- throw new Error("aborted");
188295
+ if ((_a3 = this.chatBuilder) == null ? void 0 : _a3.isEmpty()) {
188296
+ this.postViewTranscript();
188297
+ return;
186813
188298
  }
186814
- if (manuallySelectedIntent === "agentic") {
186815
- this.saveSession();
186816
- } else if (messageInProgress && (["search", "insert", "edit"].includes((messageInProgress == null ? void 0 : messageInProgress.intent) ?? "") || (messageInProgress == null ? void 0 : messageInProgress.search) || (messageInProgress == null ? void 0 : messageInProgress.error))) {
186817
- this.chatBuilder.addBotMessage(messageInProgress, model2);
186818
- } else if (messageInProgress.subMessages && messageInProgress.subMessages.length > 0) {
188299
+ if (["search", "insert", "edit"].includes((messageInProgress == null ? void 0 : messageInProgress.intent) ?? "") || (messageInProgress == null ? void 0 : messageInProgress.search) || (messageInProgress == null ? void 0 : messageInProgress.error) || messageInProgress.subMessages && messageInProgress.subMessages.length > 0) {
186819
188300
  this.chatBuilder.addBotMessage(messageInProgress, model2);
186820
188301
  } else if (messageInProgress == null ? void 0 : messageInProgress.text) {
186821
188302
  this.addBotMessage(
@@ -186826,6 +188307,7 @@ class ChatController {
186826
188307
  );
186827
188308
  }
186828
188309
  this.postViewTranscript();
188310
+ void this.saveSession();
186829
188311
  }
186830
188312
  }
186831
188313
  );
@@ -186939,72 +188421,6 @@ class ChatController {
186939
188421
  (_a3 = this.submitOrEditOperation) == null ? void 0 : _a3.abort();
186940
188422
  this.submitOrEditOperation = void 0;
186941
188423
  }
186942
- async reevaluateSearchWithSelectedFilters({
186943
- index: index2,
186944
- selectedFilters
186945
- }) {
186946
- var _a3;
186947
- if (index2 === void 0 || !Array.isArray(selectedFilters)) {
186948
- return;
186949
- }
186950
- this.handleAbort();
186951
- const humanMessage = this.chatBuilder.getMessages().at(index2);
186952
- const assistantMessage = this.chatBuilder.getMessages().at(index2 + 1);
186953
- if ((humanMessage == null ? void 0 : humanMessage.speaker) !== "human" || humanMessage.intent !== "search" || (assistantMessage == null ? void 0 : assistantMessage.speaker) !== "assistant" || !((_a3 = assistantMessage == null ? void 0 : assistantMessage.search) == null ? void 0 : _a3.query)) {
186954
- return;
186955
- }
186956
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186957
- ...assistantMessage,
186958
- search: {
186959
- ...assistantMessage.search,
186960
- selectedFilters
186961
- },
186962
- text: void 0
186963
- });
186964
- this.postViewTranscript();
186965
- try {
186966
- const query2 = this.appendSelectedFiltersToSearchQuery({
186967
- query: assistantMessage.search.query,
186968
- filters: selectedFilters
186969
- });
186970
- const response = await graphqlClient.nlsSearchQuery({ query: query2 });
186971
- this.chatBuilder.updateAssistantMessageAtIndex(index2 + 1, {
186972
- ...assistantMessage,
186973
- error: void 0,
186974
- search: {
186975
- ...assistantMessage.search,
186976
- queryWithSelectedFilters: query2,
186977
- response,
186978
- selectedFilters
186979
- },
186980
- text: ps`search found ${(response == null ? void 0 : response.results.results.length) || 0} results`
186981
- });
186982
- } catch (err2) {
186983
- this.chatBuilder.addErrorAsBotMessage(err2, ChatBuilder.NO_MODEL);
186984
- } finally {
186985
- void this.saveSession();
186986
- this.postViewTranscript();
186987
- }
186988
- }
186989
- appendSelectedFiltersToSearchQuery({
186990
- query: query2,
186991
- filters
186992
- }) {
186993
- var _a3;
186994
- if (!filters.length) {
186995
- return query2;
186996
- }
186997
- const repoFilters = filters.filter((filter2) => filter2.kind === "repo");
186998
- const repoFilter = repoFilters.length ? `repo:^(${repoFilters.map((filter2) => filter2.value.replace("repo:^", "").replace(/\$$/, "")).join("|")})$` : "";
186999
- let count = 50;
187000
- switch ((_a3 = filters.find((filter2) => filter2.kind === "type")) == null ? void 0 : _a3.value) {
187001
- case "type:path":
187002
- case "type:repo":
187003
- count = 20;
187004
- break;
187005
- }
187006
- return `${query2} ${filters.filter((f) => f.kind !== "repo").map((f) => f.value).join(" ")} ${repoFilter} count:${count}`;
187007
- }
187008
188424
  /**
187009
188425
  * Handles editing a human chat message in current chat session.
187010
188426
  *
@@ -187320,7 +188736,6 @@ class ChatController {
187320
188736
  async addBotMessage(requestID, rawResponse, didYouMeanQuery, model2) {
187321
188737
  const messageText = reformatBotMessageForChat(rawResponse);
187322
188738
  this.chatBuilder.addBotMessage({ text: messageText, didYouMeanQuery }, model2);
187323
- void this.saveSession();
187324
188739
  this.postViewTranscript();
187325
188740
  const authStatus2 = currentAuthStatus();
187326
188741
  const generatedCode = countGeneratedCode(messageText.toString());
@@ -187416,12 +188831,13 @@ class ChatController {
187416
188831
  }
187417
188832
  clearAndRestartSession(chatMessages) {
187418
188833
  var _a3;
187419
- this.cancelSubmitOrEditOperation();
187420
188834
  if (!((_a3 = this.chatBuilder) == null ? void 0 : _a3.isEmpty())) {
188835
+ this.saveSession();
187421
188836
  this.chatBuilder = new ChatBuilder(this.chatBuilder.selectedModel, void 0, chatMessages);
187422
188837
  this.lastKnownTokenUsage = void 0;
187423
188838
  this.postViewTranscript();
187424
188839
  }
188840
+ this.cancelSubmitOrEditOperation();
187425
188841
  }
187426
188842
  get webviewPanelOrView() {
187427
188843
  return this._webviewPanelOrView;
@@ -189207,8 +190623,8 @@ function parseMentionURI(uri) {
189207
190623
  }
189208
190624
  }
189209
190625
  async function execFileAsync(program2, args2, { cwd }) {
189210
- const { promisify } = await import("./util-n4JO9qgH.mjs").then((n) => n.u);
189211
- const { execFile } = await import("./vscode-shim-FP11UcS5.mjs").then((n) => n.fR);
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);
189212
190628
  return promisify(execFile)(program2, args2, { cwd });
189213
190629
  }
189214
190630
  var __create = Object.create;
@@ -189701,7 +191117,8 @@ var require_DocTypeReader = __commonJS({
189701
191117
  } else if (hasBody && isElement2(xmlData, i2)) i2 += 8;
189702
191118
  else if (hasBody && isAttlist2(xmlData, i2)) i2 += 8;
189703
191119
  else if (hasBody && isNotation2(xmlData, i2)) i2 += 9;
189704
- else comment2 = true;
191120
+ else if (isComment2) comment2 = true;
191121
+ else throw new Error("Invalid DOCTYPE");
189705
191122
  angleBracketsCount++;
189706
191123
  exp = "";
189707
191124
  } else if (xmlData[i2] === ">") {
@@ -189744,6 +191161,10 @@ var require_DocTypeReader = __commonJS({
189744
191161
  }
189745
191162
  return [entityName2, val2, i2];
189746
191163
  }
191164
+ function isComment2(xmlData, i2) {
191165
+ if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "-" && xmlData[i2 + 3] === "-") return true;
191166
+ return false;
191167
+ }
189747
191168
  function isEntity2(xmlData, i2) {
189748
191169
  if (xmlData[i2 + 1] === "!" && xmlData[i2 + 2] === "E" && xmlData[i2 + 3] === "N" && xmlData[i2 + 4] === "T" && xmlData[i2 + 5] === "I" && xmlData[i2 + 6] === "T" && xmlData[i2 + 7] === "Y") return true;
189749
191170
  return false;
@@ -191044,8 +192465,8 @@ async function getAccessTokenLinearConnect() {
191044
192465
  if (!vscode2) {
191045
192466
  return void 0;
191046
192467
  }
191047
- const ext = vscode2.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID);
191048
- if (!ext) {
192468
+ const ext2 = vscode2.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID);
192469
+ if (!ext2) {
191049
192470
  vscode2.window.showWarningMessage(
191050
192471
  "Cody requires the Linear Connect extension to be installed and activated."
191051
192472
  );
@@ -191602,14 +193023,14 @@ async function getViewerSettingsProviders() {
191602
193023
  }
191603
193024
  }
191604
193025
  async function warnIfOpenCtxExtensionConflict() {
191605
- const ext = extensions.getExtension("sourcegraph.openctx");
191606
- if (!ext) {
193026
+ const ext2 = extensions.getExtension("sourcegraph.openctx");
193027
+ if (!ext2) {
191607
193028
  return;
191608
193029
  }
191609
193030
  window$1.showWarningMessage(
191610
193031
  "Cody directly provides OpenCtx support, please disable the Sourcegraph OpenCtx extension."
191611
193032
  );
191612
- await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[ext.id]]);
193033
+ await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[ext2.id]]);
191613
193034
  }
191614
193035
  const logger = new Logger();
191615
193036
  const LOG_LABEL = "Guardrails";
@@ -191956,7 +193377,7 @@ he.exports;
191956
193377
  (function(module2, exports2) {
191957
193378
  (function(root2) {
191958
193379
  var freeExports = exports2;
191959
- var freeModule = module2.exports == freeExports && module2;
193380
+ var freeModule = module2 && module2.exports == freeExports && module2;
191960
193381
  var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal;
191961
193382
  if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
191962
193383
  root2 = freeGlobal;
@@ -192006,14 +193427,14 @@ he.exports;
192006
193427
  }
192007
193428
  return false;
192008
193429
  };
192009
- var merge2 = function(options, defaults) {
193430
+ var merge2 = function(options, defaults2) {
192010
193431
  if (!options) {
192011
- return defaults;
193432
+ return defaults2;
192012
193433
  }
192013
193434
  var result = {};
192014
193435
  var key3;
192015
- for (key3 in defaults) {
192016
- result[key3] = has2(options, key3) ? options[key3] : defaults[key3];
193436
+ for (key3 in defaults2) {
193437
+ result[key3] = has2(options, key3) ? options[key3] : defaults2[key3];
192017
193438
  }
192018
193439
  return result;
192019
193440
  };
@@ -198819,7 +200240,7 @@ async function start(context2, platform2) {
198819
200240
  setResolvedConfigurationObservable(
198820
200241
  combineLatest$1(
198821
200242
  fromVSCodeEvent(workspace.onDidChangeConfiguration).pipe(
198822
- filter$1(
200243
+ filter$2(
198823
200244
  (event2) => event2.affectsConfiguration("cody") || event2.affectsConfiguration("openctx") || event2.affectsConfiguration("http")
198824
200245
  ),
198825
200246
  startWith$1(void 0),
@@ -198952,6 +200373,13 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
198952
200373
  })
198953
200374
  )
198954
200375
  );
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
+ }
198955
200383
  disposables.push(
198956
200384
  subscriptionDisposable(
198957
200385
  resolvedConfig.subscribe((config) => {
@@ -198959,6 +200387,7 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
198959
200387
  })
198960
200388
  )
198961
200389
  );
200390
+ disposables.push(initializeContextFiltersProvider());
198962
200391
  return Disposable.from(...disposables);
198963
200392
  };
198964
200393
  async function initializeSingletons(platform2, disposables) {
@@ -199071,12 +200500,22 @@ async function registerCodyCommands({
199071
200500
  (a) => unifiedPromptsEnabled ? executeTestChatCommand(a) : executeTestEditCommand(a)
199072
200501
  )
199073
200502
  ];
199074
- const unifiedPromptsCommands = [
199075
- commands$1.registerCommand(
199076
- "cody.command.prompt-document-code",
199077
- (a) => executeDocChatCommand(a)
199078
- )
199079
- ];
200503
+ const unifiedPromptsCommands = [];
200504
+ try {
200505
+ unifiedPromptsCommands.push(
200506
+ commands$1.registerCommand(
200507
+ "cody.command.prompt-document-code",
200508
+ (a) => executeDocChatCommand(a)
200509
+ )
200510
+ );
200511
+ } catch (error) {
200512
+ if (false !== "true") {
200513
+ throw error;
200514
+ }
200515
+ console.warn(
200516
+ "Command cody.command.prompt-document-code already registered (testing mode)"
200517
+ );
200518
+ }
199080
200519
  return unifiedPromptsEnabled ? [
199081
200520
  ...chatCommands,
199082
200521
  ...editCommands,
@@ -199153,7 +200592,7 @@ function registerAuthCommands(disposables) {
199153
200592
  )
199154
200593
  );
199155
200594
  }
199156
- async function registerTestCommands(context2, disposables) {
200595
+ async function registerTestCommands(_context, disposables) {
199157
200596
  await commands$1.executeCommand("setContext", "cody.devOrTest", true);
199158
200597
  disposables.push(
199159
200598
  commands$1.registerCommand("cody.test.set-context-filters", async () => {
@@ -199274,7 +200713,7 @@ function registerAutocomplete(platform2, statusBar, disposables) {
199274
200713
  if (res === NEVER$1 && !authStatus2.pendingValidation) {
199275
200714
  finishLoading();
199276
200715
  }
199277
- return res.tap((res2) => {
200716
+ return res.tap((_res) => {
199278
200717
  finishLoading();
199279
200718
  });
199280
200719
  }),
@@ -199889,7 +201328,7 @@ const extractSafariExtensionDetails = (func2, filename) => {
199889
201328
  const MAX_ALLOWED_STRING_LENGTH = 1024;
199890
201329
  const INTEGRATION_NAME$5 = "Breadcrumbs";
199891
201330
  const _breadcrumbsIntegration = (options = {}) => {
199892
- const _options = {
201331
+ const _options2 = {
199893
201332
  console: true,
199894
201333
  dom: true,
199895
201334
  fetch: true,
@@ -199905,22 +201344,22 @@ const _breadcrumbsIntegration = (options = {}) => {
199905
201344
  },
199906
201345
  // eslint-disable-line @typescript-eslint/no-empty-function
199907
201346
  setup(client) {
199908
- if (_options.console) {
201347
+ if (_options2.console) {
199909
201348
  addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));
199910
201349
  }
199911
- if (_options.dom) {
199912
- addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom));
201350
+ if (_options2.dom) {
201351
+ addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options2.dom));
199913
201352
  }
199914
- if (_options.xhr) {
201353
+ if (_options2.xhr) {
199915
201354
  addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client));
199916
201355
  }
199917
- if (_options.fetch) {
201356
+ if (_options2.fetch) {
199918
201357
  addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client));
199919
201358
  }
199920
- if (_options.history) {
201359
+ if (_options2.history) {
199921
201360
  addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client));
199922
201361
  }
199923
- if (_options.sentry && client.on) {
201362
+ if (_options2.sentry && client.on) {
199924
201363
  client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client));
199925
201364
  }
199926
201365
  }
@@ -200263,7 +201702,7 @@ function _getFramesFromEvent(event2) {
200263
201702
  }
200264
201703
  const INTEGRATION_NAME$3 = "GlobalHandlers";
200265
201704
  const _globalHandlersIntegration = (options = {}) => {
200266
- const _options = {
201705
+ const _options2 = {
200267
201706
  onerror: true,
200268
201707
  onunhandledrejection: true,
200269
201708
  ...options
@@ -200274,11 +201713,11 @@ const _globalHandlersIntegration = (options = {}) => {
200274
201713
  Error.stackTraceLimit = 50;
200275
201714
  },
200276
201715
  setup(client) {
200277
- if (_options.onerror) {
201716
+ if (_options2.onerror) {
200278
201717
  _installGlobalOnErrorHandler(client);
200279
201718
  globalHandlerLog("onerror");
200280
201719
  }
200281
- if (_options.onunhandledrejection) {
201720
+ if (_options2.onunhandledrejection) {
200282
201721
  _installGlobalOnUnhandledRejectionHandler(client);
200283
201722
  globalHandlerLog("onunhandledrejection");
200284
201723
  }
@@ -200502,7 +201941,7 @@ const DEFAULT_EVENT_TARGET = [
200502
201941
  ];
200503
201942
  const INTEGRATION_NAME = "TryCatch";
200504
201943
  const _browserApiErrorsIntegration = (options = {}) => {
200505
- const _options = {
201944
+ const _options2 = {
200506
201945
  XMLHttpRequest: true,
200507
201946
  eventTarget: true,
200508
201947
  requestAnimationFrame: true,
@@ -200515,19 +201954,19 @@ const _browserApiErrorsIntegration = (options = {}) => {
200515
201954
  // TODO: This currently only works for the first client this is setup
200516
201955
  // We may want to adjust this to check for client etc.
200517
201956
  setupOnce() {
200518
- if (_options.setTimeout) {
201957
+ if (_options2.setTimeout) {
200519
201958
  fill(WINDOW, "setTimeout", _wrapTimeFunction);
200520
201959
  }
200521
- if (_options.setInterval) {
201960
+ if (_options2.setInterval) {
200522
201961
  fill(WINDOW, "setInterval", _wrapTimeFunction);
200523
201962
  }
200524
- if (_options.requestAnimationFrame) {
201963
+ if (_options2.requestAnimationFrame) {
200525
201964
  fill(WINDOW, "requestAnimationFrame", _wrapRAF);
200526
201965
  }
200527
- if (_options.XMLHttpRequest && "XMLHttpRequest" in WINDOW) {
201966
+ if (_options2.XMLHttpRequest && "XMLHttpRequest" in WINDOW) {
200528
201967
  fill(XMLHttpRequest.prototype, "send", _wrapXHR);
200529
201968
  }
200530
- const eventTargetOption = _options.eventTarget;
201969
+ const eventTargetOption = _options2.eventTarget;
200531
201970
  if (eventTargetOption) {
200532
201971
  const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET;
200533
201972
  eventTarget.forEach(_wrapEventTarget);
@@ -200667,7 +202106,7 @@ const defaultIntegrations = [
200667
202106
  dedupeIntegration(),
200668
202107
  httpContextIntegration()
200669
202108
  ];
200670
- function getDefaultIntegrations(_options) {
202109
+ function getDefaultIntegrations(_options2) {
200671
202110
  return [
200672
202111
  // eslint-disable-next-line deprecation/deprecation
200673
202112
  ...defaultIntegrations