@sourcegraph/cody-web 0.32.8 → 0.32.9

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 _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, a_ as unsubscribe, a$ as AsyncSerialScheduler, b0 as authStatus, b1 as pick, b2 as distinctUntilChanged$1, b3 as switchMapReplayOperation, b4 as pendingOperation, b5 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b6 as retry$1, b7 as logError$2, aL as firstResultFromOperation, b8 as graphqlClient, b9 as semver, ba as debounceTime, bb as interval, bc as filter$3, bd as startWith$1, be as switchMap$1, ax as firstValueFrom$1, ay as skipPendingOperation, bf as logDebug$1, bg as isAbortError, am as ModelTag, bh as getModelInfo, bi as CHAT_INPUT_TOKEN_BUDGET, bj as CHAT_OUTPUT_TOKEN_BUDGET, bk as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bl as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, bm as expand, ac as LRUCache$1, bn as TRANSIENT_REFETCH_INTERVAL_HINT, bo as createSubscriber, bp as fromVSCodeEvent, D as isEqual, bq as cenv, ag as lodashExports, br as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bs as currentAuthStatus, bt as isFileURI, w as wrapInActiveSpan, bu as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bv as onAbort, bw as addCodyClientIdentificationHeaders, bx as addTraceparent, by as addAuthHeaders, bz as fetch$2, bA as verifyResponseCode, H as combineLatest$1, bB as take$2, bC as clientCapabilities, bD as shareReplay$1, bE as tap$2, bF as featureFlagProvider, $ as FeatureFlag, a7 as isCodyProUser, bG as isFreeUser, bH as telemetryRecorder, bI as getEnterpriseContextWindow, bJ as ANSWER_TOKENS, bK as currentAuthStatusOrNotReadyYet, bL as mockAuthStatus, bM as storeLastValue, bN as resolvedConfig, bO as userProductSubscription, bP as isEnterpriseUser, bQ as ps, bR as GuardrailsMode, bS as currentResolvedConfig, aW as PromptString, a8 as CodyIDE, bT as CORPUS_CONTEXT_ALLOCATION, bU as isCustomModel, bV as recordErrorToSpan, bW as addClientInfoParams, bX 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, bY as isS2, bZ as GIT_OPENCTX_PROVIDER_URI, b_ as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, b$ as currentOpenCtxController, m as URI, c0 as MulticastSubject, c1 as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, c2 as workspace, p as path$1, c3 as vscode, c4 as Range, c5 as commands$1, c6 as window$1, c7 as Selection, U as Uri, c8 as AgentEventEmitter, c9 as MarkdownString, ca as Disposable, cb as TextEditorRevealType, cc as ThemeIcon, cd as StatusBarAlignment, ce as readFile, cf as env, cg as UIKind, ch as languages$1, c as commonjsGlobal, ci as InvalidAccessTokenError, cj as _baseAssignValue, ck as eq_1, cl as isArrayLike_1, cm as isObjectLike_1, cn as _copyObject, co as keysIn_1, cp as _cloneBufferExports, cq as _cloneTypedArray, cr as _copyArray, cs as _initCloneObject, ct as isArguments_1, cu as isArray_1, cv as isBufferExports, cw as isFunction_1, cx as isObject_1, cy as isPlainObject_1, cz as isTypedArray_1, cA as _Stack, cB as identity_1, cC as _overRest, cD as _setToString, cE as _isIndex, X as isSourcegraphToken, aG as v4, cF as CONFIG_KEY, aT as CodyAutoSuggestionMode, cG as ConfigurationTarget, cH as pathBrowserify, cI as stat, cJ as extensions, cK as version$2, cL as setExtensionVersion, cM as withLatestFrom, cN as NEVER$1, cO as abortableOperation, cP as isNeedsAuthChallengeError, cQ as EMPTY$1, cR as disposableSubscription, cS as setAuthStatusObservable, cT as DOTCOM_URL, V as isAvailabilityError, cU as isInvalidAccessTokenError, cV as normalizeServerEndpointURL, cW as isEnterpriseUserDotComError, cX as ProgressLocation, cY as AuthConfigError, cZ as SourcegraphGraphQLAPIClient, c_ as isExternalProviderAuthError, c$ as isNetworkLikeError, d0 as NeedsAuthChallengeError, d1 as AvailabilityError, d2 as EnterpriseUserDotComError, d3 as resolveAuth, d4 as QuickPickItemKind, aN as isWorkspaceInstance, d5 as getAuthHeaders, d6 as toLightweightChatTranscript, d7 as SUPPORTED_URI_SCHEMAS, d8 as RelativePattern, d9 as _baseIsEqual, da as keys_1, db as _baseGet, dc as _castPath, dd as isLength_1, de as _toKey, df as _isKey, dg as toNumber_1, dh as _baseFindIndex, di as require$$0$2, dj as NetworkError, dk as isRateLimitError, Q as isAuthError, dl as FileType, dm as dedent$1, dn as FoldingRange, dp as CancellationTokenSource, dq as SymbolKind, dr as convertGitCloneURLToCodebaseName, ai as isDefined, ds as pluck, dt as toRangeData, du as Position, dv as DefaultChatCommands, dw as pathFunctionsForURI, dx as uriParseNameAndExtension, dy as uriDirname, dz as Utils$1, dA as uriExtname, dB as uriBasename, dC as DefaultEditCommands, dD as subscriptionDisposable, dE as updateGlobalTelemetryInstances, dF as TelemetryRecorderProvider, dG as telemetryRecorderProvider, dH as createGitDiff, dI as catchError$1, dJ as AgentWorkspaceEdit, dK as TextDocumentChangeReason, dL as omit$1, dM as displayPathWithoutWorkspaceFolderPrefix, dN as getEditorInsertSpaces, dO as escapeRegExp$1, dP as TimeoutError, dQ as isNetworkError, dR as http, dS as open, dT as defer$2, dU as merge$2, dV as ruleSearchPaths, dW as isRuleFilename, dX as parseRuleFile, dY as languageFromFilename, f as displayLineRange, e as displayPath, dZ as ruleTitle, as as isCodyProModel, d_ as debounce_1, aV as isErrorLike, d$ as isWindows, e0 as GLOBAL_SEARCH_PROVIDER_URI, e1 as mentionProvidersMetadata, e2 as currentUserProductSubscription, e3 as checkIfEnterpriseUser, e4 as ACCOUNT_UPGRADE_URL, e5 as ThemeColor, e6 as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e7 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e8 as CodeLens, e9 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, ea as EndOfLine, eb as ViewColumn, ec as Location, ed as onDidChangeActiveTextEditor, ee as tabGroups, ef as workspaceTextDocuments, eg as visibleTextEditors, eh as onDidChangeVisibleTextEditors, ei as fs, ej as onDidCloseTextDocument, ek as setCreateWebviewPanel, el as getAugmentedNamespace, em as extensionConfiguration, en as main$1, eo as setAgent, ep as setWorkspaceDocuments, eq as setLastOpenedWorkspaceFolder, er as onDidRegisterNewCodeActionProvider, es as onDidUnregisterNewCodeActionProvider, et as onDidRegisterNewCodeLensProvider, eu as onDidUnregisterNewCodeLensProvider, ev as setClientInfo, ew as AgentWorkspaceConfiguration, ex as firstNonPendingAuthStatus, ey as workspaceFolders$1, ez as setWorkspaceFolders, eA as onDidChangeWorkspaceFolders, eB as onDidChangeWindowState, eC as onDidOpenTextDocument, eD as onDidSaveTextDocument, eE as onDidRenameFiles, eF as packageJson, eG as progressBars, eH as CodeActionTriggerKind, eI as CodeAction, eJ as UriString, eK as DiagnosticSeverity, eL as diagnostics, eM as isIntegrationTesting, eN as TESTING_TELEMETRY_EXPORTER, eO as dist, eP as completionProvider, eQ as InlineCompletionTriggerKind, eR as currentAuthStatusAuthed, eS as waitUntilComplete, eT as setExtensionConfiguration, eU as onDidChangeConfiguration, eV as onDidChangeTextDocument, eW as onDidChangeTextEditorSelection, eX as isTokenOrEndpointChange, at as isMacOS, av as CustomCommandType, aU as setDisplayPathEnvInfo, aP as ACCOUNT_USAGE_URL, z as debounce$1, eY as structuredPatch, eZ as isDotComAuthed, e_ as dedupeWith$1, e$ as AbortError, f0 as createDisposables, f1 as isNodeResponse, f2 as getClientInfoQueryParams, f3 as tracer, f4 as getActiveTraceAndSpanId, f5 as getClientIdentificationHeaders, f6 as setJSONAcceptContentTypeHeaders, f7 as logResponseHeadersToSpan, f8 as isCustomAuthChallengeResponse, f9 as TracedError, _ as SpanStatusCode, ae as RateLimitError$1, fa as capitalize, fb as InlineCompletionItem, fc as createTwoFilesPatch, fd 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, fe as getEditorTabSize$1, ff as metrics, fg as _, aH as deserializeContextItem, fh as editorStateFromPromptString, fi as _baseGetTag, al as isAbortErrorOrSocketHangUp, fj as inputTextWithoutContextChipsFromPromptEditorState, an as DeepCodyAgentID, fk as exec, s as spawn, aC as UIToolStatus, i as displayPathBasename, fl as expandToLineRange, fm as openctxController, fn as openCtxProviderMetadata, fo as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aE as diffWithLineNum, aF as UITerminalOutputType, fp as getPlatform$1, fq as PromptMode, fr as skip$1, Z as context, fs as extractContextFromTraceparent, ft as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ak as reformatBotMessageForChat, M as hydrateAfterPostMessage, fu as addMessageListenersForExtensionAPI, fv as createMessageAPIForExtension, ar as View, aI as ChatHistoryType, fw as CodeActionKind, aB as pluralize, fx as assertFileURI, d as RULES_PROVIDER_URI, fy as createCodeSearchProvider, fz as ProgrammingLanguage, fA as MAX_CURRENT_FILE_TOKENS, fB as psDedent, fC as formatRuleForPrompt, fD as posixFilePaths, fE as DecorationRangeBehavior, fF as SURROUNDING_LINES, fG as diffLines, fH as CODY_SUPPORT_URL, fI as CODY_DOC_URL, fJ as CODY_FEEDBACK_URL, fK as DISCORD_URL, aJ as getRelativeChatPeriod, fL as globalAgentRef, fM as VSCODE_CHANGELOG_URL, fN as SG_CHANGELOG_URL, fO as ACCOUNT_LIMITS_INFO_URL, fP as assertUnreachable, fQ as promise, fR as ExtensionMode, fS as setLogger, fT as setClientCapabilities, fU as setResolvedConfigurationObservable, fV as setClientNameVersion, fW as setOpenCtxControllerObservable, aS as browser$4 } from "./vscode-shim-vO7kNcRR.mjs";
22
- import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-DokYc53k.mjs";
20
+ var _a2, _b, _c, _d, _e, _constructing, _f, _g, _max, _maxSize, _dispose, _disposeAfter, _fetchMethod, _size, _calculatedSize, _keyMap, _keyList, _valList, _next, _prev, _head, _tail, _free, _disposed, _sizes, _starts, _ttls, _hasDispose, _hasFetchMethod, _hasDisposeAfter, _LRUCache_instances, initializeTTLTracking_fn, _updateItemAge, _statusTTL, _setItemTTL, _isStale, initializeSizeTracking_fn, _removeItemSize, _addItemSize, _requireSize, indexes_fn, rindexes_fn, isValidIndex_fn, evict_fn, backgroundFetch_fn, isBackgroundFetch_fn, connect_fn2, moveToTail_fn, _h, _i, _j, _k, _l;
21
+ import { O as Observable, aW as unsubscribe, aX as AsyncSerialScheduler, aY as authStatus, aZ as pick, a_ as distinctUntilChanged$1, a$ as switchMapReplayOperation, b0 as pendingOperation, b1 as promiseFactoryToObservable, J as map$1, ad as isError$3, P as isDotCom, b2 as retry$1, b3 as logError$2, aI as firstResultFromOperation, b4 as graphqlClient, b5 as semver, b6 as debounceTime, b7 as interval, b8 as filter$2, b9 as startWith$1, ba as switchMap$1, ax as firstValueFrom$1, ay as skipPendingOperation, bb as logDebug$1, bc as isAbortError, am as ModelTag, bd as getModelInfo, be as CHAT_INPUT_TOKEN_BUDGET, bf as CHAT_OUTPUT_TOKEN_BUDGET, bg as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bh as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, ac as LRUCache$1, bi as TRANSIENT_REFETCH_INTERVAL_HINT, bj as createSubscriber, bk as fromVSCodeEvent, D as isEqual, bl as cenv, ag as lodashExports, bm as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bn as currentAuthStatus, bo as isFileURI, w as wrapInActiveSpan, bp as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bq as onAbort, br as addCodyClientIdentificationHeaders, bs as addTraceparent, bt as addAuthHeaders, bu as fetch$2, bv as verifyResponseCode, H as combineLatest$1, bw as take$2, bx as clientCapabilities, by as shareReplay$1, bz as tap$2, bA as featureFlagProvider, $ as FeatureFlag, a7 as isCodyProUser, bB as isFreeUser, bC as telemetryRecorder, bD as getEnterpriseContextWindow, bE as ANSWER_TOKENS, bF as currentAuthStatusOrNotReadyYet, bG as mockAuthStatus, bH as storeLastValue, bI as resolvedConfig, bJ as userProductSubscription, bK as isEnterpriseUser, bL as ps, bM as GuardrailsMode, bN as currentResolvedConfig, aS as PromptString, a8 as CodyIDE, bO as CORPUS_CONTEXT_ALLOCATION, bP as isCustomModel, bQ as recordErrorToSpan, bR as addClientInfoParams, bS as dependentAbortController, F as FILE_CONTEXT_MENTION_PROVIDER, S as SYMBOL_CONTEXT_MENTION_PROVIDER, R as REMOTE_REPOSITORY_PROVIDER_URI, a as REMOTE_FILE_PROVIDER_URI, b as REMOTE_DIRECTORY_PROVIDER_URI, W as WEB_PROVIDER_URI, C as ContextItemSource, bT as isS2, bU as GIT_OPENCTX_PROVIDER_URI, bV as CODE_SEARCH_PROVIDER_URI, aa as cryptoJsExports, bW as currentOpenCtxController, m as URI, bX as MulticastSubject, bY as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, bZ as workspace, p as path, b_ as vscode, b$ as Range, c0 as commands$1, c1 as window$1, c2 as Selection, U as Uri, c3 as AgentEventEmitter, c4 as MarkdownString, c5 as Disposable, c6 as TextEditorRevealType, c7 as ThemeIcon, c8 as StatusBarAlignment, c9 as readFile, ca as env, cb as UIKind, cc as languages$1, c as commonjsGlobal, cd as InvalidAccessTokenError, ce as _baseAssignValue, cf as eq_1, cg as isArrayLike_1, ch as isObjectLike_1, ci as _copyObject, cj as keysIn_1, ck as _cloneBufferExports, cl as _cloneTypedArray, cm as _copyArray, cn as _initCloneObject, co as isArguments_1, cp as isArray_1, cq as isBufferExports, cr as isFunction_1, cs as isObject_1, ct as isPlainObject_1, cu as isTypedArray_1, cv as _Stack, cw as identity_1, cx as _overRest, cy as _setToString, cz as _isIndex, X as isSourcegraphToken, aG as v4, cA as CONFIG_KEY, aP as CodyAutoSuggestionMode, cB as ConfigurationTarget, cC as pathBrowserify, cD as stat, cE as extensions, cF as version$2, cG as setExtensionVersion, cH as withLatestFrom, cI as NEVER$1, cJ as abortableOperation, cK as isNeedsAuthChallengeError, cL as EMPTY$1, cM as disposableSubscription, cN as setAuthStatusObservable, cO as DOTCOM_URL, V as isAvailabilityError, cP as isInvalidAccessTokenError, cQ as normalizeServerEndpointURL, cR as isEnterpriseUserDotComError, cS as ProgressLocation, cT as AuthConfigError, cU as SourcegraphGraphQLAPIClient, cV as isExternalProviderAuthError, cW as isNetworkLikeError, cX as NeedsAuthChallengeError, cY as AvailabilityError, cZ as EnterpriseUserDotComError, c_ as resolveAuth, c$ as QuickPickItemKind, aK as isWorkspaceInstance, d0 as getAuthHeaders, d1 as toLightweightChatTranscript, d2 as SUPPORTED_URI_SCHEMAS, d3 as _baseIsEqual, d4 as keys_1, d5 as _baseGet, d6 as _castPath, d7 as isLength_1, d8 as _toKey, d9 as _isKey, da as toNumber_1, db as _baseFindIndex, dc as require$$0$2, dd as NetworkError, de as isRateLimitError, Q as isAuthError, df as FileType, dg as dedent$1, dh as FoldingRange, di as CancellationTokenSource, dj as SymbolKind, dk as convertGitCloneURLToCodebaseName, ai as isDefined, dl as pluck, dm as toRangeData, dn as Position, dp as DefaultChatCommands, dq as pathFunctionsForURI, dr as uriParseNameAndExtension, ds as uriDirname, dt as Utils$1, du as uriExtname, dv as uriBasename, dw as DefaultEditCommands, dx as subscriptionDisposable, dy as updateGlobalTelemetryInstances, dz as TelemetryRecorderProvider, dA as telemetryRecorderProvider, dB as createGitDiff, dC as catchError$1, dD as AgentWorkspaceEdit, dE as TextDocumentChangeReason, dF as omit$1, dG as displayPathWithoutWorkspaceFolderPrefix, dH as getEditorInsertSpaces, dI as escapeRegExp$1, dJ as TimeoutError, dK as isNetworkError, dL as http, dM as open, dN as defer$2, dO as merge$2, dP as ruleSearchPaths, dQ as isRuleFilename, dR as parseRuleFile, dS as languageFromFilename, f as displayLineRange, e as displayPath, dT as ruleTitle, as as isCodyProModel, dU as debounce_1, dV as RelativePattern, aR as isErrorLike, dW as isWindows, dX as GLOBAL_SEARCH_PROVIDER_URI, dY as mentionProvidersMetadata, dZ as currentUserProductSubscription, d_ as checkIfEnterpriseUser, d$ as ThemeColor, e0 as QuickInputButtons, E as scanForMentionTriggerInUserTextInput, u as parseMentionQuery, L as LARGE_FILE_WARNING_LABEL, e1 as GENERAL_HELP_LABEL, a9 as CodyTaskState, e2 as CodeLens, e3 as defaultWebviewPanel, x as createExtensionAPI, y as createMessageAPIForWebview, e4 as EndOfLine, e5 as ViewColumn, e6 as Location, e7 as onDidChangeActiveTextEditor, e8 as tabGroups, e9 as workspaceTextDocuments, ea as visibleTextEditors, eb as onDidChangeVisibleTextEditors, ec as fs, ed as onDidCloseTextDocument, ee as setCreateWebviewPanel, ef as getAugmentedNamespace, eg as extensionConfiguration, eh as main$1, ei as setAgent, ej as setWorkspaceDocuments, ek as setLastOpenedWorkspaceFolder, el as onDidRegisterNewCodeActionProvider, em as onDidUnregisterNewCodeActionProvider, en as onDidRegisterNewCodeLensProvider, eo as onDidUnregisterNewCodeLensProvider, ep as setClientInfo, eq as AgentWorkspaceConfiguration, er as firstNonPendingAuthStatus, es as workspaceFolders$1, et as setWorkspaceFolders, eu as onDidChangeWorkspaceFolders, ev as onDidChangeWindowState, ew as onDidOpenTextDocument, ex as onDidSaveTextDocument, ey as onDidRenameFiles, ez as packageJson, eA as progressBars, eB as CodeActionTriggerKind, eC as CodeAction, eD as UriString, eE as DiagnosticSeverity, eF as diagnostics, eG as isIntegrationTesting, eH as TESTING_TELEMETRY_EXPORTER, eI as dist, eJ as completionProvider, eK as InlineCompletionTriggerKind, eL as currentAuthStatusAuthed, eM as waitUntilComplete, eN as setExtensionConfiguration, eO as onDidChangeConfiguration, eP as onDidChangeTextDocument, eQ as onDidChangeTextEditorSelection, eR as isTokenOrEndpointChange, at as isMacOS, av as CustomCommandType, aQ as setDisplayPathEnvInfo, aM as ACCOUNT_USAGE_URL, z as debounce$1, eS as structuredPatch, eT as isDotComAuthed, eU as dedupeWith$1, eV as AbortError, eW as createDisposables, eX as isNodeResponse, eY as getClientInfoQueryParams, eZ as tracer, e_ as getActiveTraceAndSpanId, e$ as getClientIdentificationHeaders, f0 as setJSONAcceptContentTypeHeaders, f1 as logResponseHeadersToSpan, f2 as isCustomAuthChallengeResponse, f3 as TracedError, _ as SpanStatusCode, ae as RateLimitError$1, f4 as capitalize, f5 as InlineCompletionItem, f6 as createTwoFilesPatch, f7 as vsCodeMocks, a2 as whitespace, a0 as svg, a3 as find$1, a4 as stringify$1, a5 as stringify$2, a6 as ccount, a1 as html$3, f8 as getEditorTabSize$1, f9 as metrics, fa as _, aH as deserializeContextItem, fb as editorStateFromPromptString, fc as _baseGetTag, al as isAbortErrorOrSocketHangUp, fd as inputTextWithoutContextChipsFromPromptEditorState, an as DeepCodyAgentID, fe as exec, s as spawn, aC as UIToolStatus, i as displayPathBasename, ff as expandToLineRange, fg as openctxController, fh as openCtxProviderMetadata, fi as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, aE as diffWithLineNum, aF as UITerminalOutputType, fj as getPlatform$1, fk as PromptMode, fl as skip$1, Z as context, fm as extractContextFromTraceparent, fn as isContextWindowLimitError, q as serializeContextItem, K as forceHydration, ak as reformatBotMessageForChat, M as hydrateAfterPostMessage, fo as addMessageListenersForExtensionAPI, fp as createMessageAPIForExtension, ar as View, aJ as ChatHistoryType, fq as CodeActionKind, aB as pluralize, fr as assertFileURI, d as RULES_PROVIDER_URI, fs as createCodeSearchProvider, ft as ProgrammingLanguage, fu as MAX_CURRENT_FILE_TOKENS, fv as psDedent, fw as formatRuleForPrompt, fx as posixFilePaths, fy as DecorationRangeBehavior, fz as SURROUNDING_LINES, fA as diffLines, fB as CODY_SUPPORT_URL, fC as CODY_DOC_URL, fD as CODY_FEEDBACK_URL, fE as DISCORD_URL, fF as globalAgentRef, fG as VSCODE_CHANGELOG_URL, fH as SG_CHANGELOG_URL, fI as ACCOUNT_LIMITS_INFO_URL, fJ as assertUnreachable, fK as promise, fL as ExtensionMode, fM as setLogger, fN as setClientCapabilities, fO as setResolvedConfigurationObservable, fP as setClientNameVersion, fQ as setOpenCtxControllerObservable, aO as browser$4 } from "./vscode-shim-DyPeDFnt.mjs";
22
+ import { r as requireUtil, i as inherits_browserExports, a as utilExports } from "./util-C63afKLY.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$2(test) {
677
+ function filter$1(test) {
678
678
  return (observable) => {
679
679
  return new Observable((observer) => {
680
680
  const scheduler = new AsyncSerialScheduler(observer);
@@ -697,13 +697,13 @@ function filter$2(test) {
697
697
  });
698
698
  };
699
699
  }
700
- var define_process_default$o = { env: {} };
700
+ var define_process_default$n = { 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$o.env.VITEST) {
706
+ if (define_process_default$n.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$n = { env: {} };
833
+ var define_process_default$m = { 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$3((_value) => editorWindowIsFocused()),
858
+ filter$2((_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$3((value) => value !== void 0 && value !== pendingOperation),
870
+ filter$2((value) => value !== void 0 && value !== pendingOperation),
871
871
  distinctUntilChanged$1()
872
872
  ));
873
873
  }
@@ -1013,7 +1013,7 @@ const _ClientConfigSingleton = class _ClientConfigSingleton {
1013
1013
  };
1014
1014
  __publicField2(_ClientConfigSingleton, "instance");
1015
1015
  // REFETCH_INTERVAL is only updated via process.env during test execution, otherwise it is 60 seconds.
1016
- __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);
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
1017
  let ClientConfigSingleton = _ClientConfigSingleton;
1018
1018
  const configOverwrites = authStatus.pipe(
1019
1019
  pick("authenticated", "endpoint", "pendingValidation"),
@@ -1198,7 +1198,7 @@ createModel({
1198
1198
  usage: [ModelUsage.Chat],
1199
1199
  tags: [ModelTag.Enterprise]
1200
1200
  });
1201
- var define_process_default$m = { env: {} };
1201
+ var define_process_default$l = { env: {} };
1202
1202
  const version$1 = "0.5.1";
1203
1203
  class ResponseError extends Error {
1204
1204
  constructor(error, status_code) {
@@ -1238,8 +1238,8 @@ const checkOk = async (response) => {
1238
1238
  function getPlatform() {
1239
1239
  if (typeof window !== "undefined" && window.navigator) {
1240
1240
  return `${window.navigator.platform.toLowerCase()} Browser/${navigator.userAgent};`;
1241
- } else if (typeof define_process_default$m !== "undefined") {
1242
- return `${define_process_default$m.arch} ${define_process_default$m.platform} Node.js/${define_process_default$m.version}`;
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}`;
1243
1243
  }
1244
1244
  return "";
1245
1245
  }
@@ -1482,1344 +1482,6 @@ let Ollama$1 = class Ollama {
1482
1482
  }
1483
1483
  };
1484
1484
  const browser$3 = new Ollama$1();
1485
- const MAX_PATTERN_LENGTH = 1024 * 64;
1486
- const assertValidPattern = (pattern) => {
1487
- if (typeof pattern !== "string") {
1488
- throw new TypeError("invalid pattern");
1489
- }
1490
- if (pattern.length > MAX_PATTERN_LENGTH) {
1491
- throw new TypeError("pattern is too long");
1492
- }
1493
- };
1494
- const posixClasses = {
1495
- "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
1496
- "[:alpha:]": ["\\p{L}\\p{Nl}", true],
1497
- "[:ascii:]": ["\\x00-\\x7f", false],
1498
- "[:blank:]": ["\\p{Zs}\\t", true],
1499
- "[:cntrl:]": ["\\p{Cc}", true],
1500
- "[:digit:]": ["\\p{Nd}", true],
1501
- "[:graph:]": ["\\p{Z}\\p{C}", true, true],
1502
- "[:lower:]": ["\\p{Ll}", true],
1503
- "[:print:]": ["\\p{C}", true],
1504
- "[:punct:]": ["\\p{P}", true],
1505
- "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
1506
- "[:upper:]": ["\\p{Lu}", true],
1507
- "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
1508
- "[:xdigit:]": ["A-Fa-f0-9", false]
1509
- };
1510
- const braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&");
1511
- const regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1512
- const rangesToString = (ranges2) => ranges2.join("");
1513
- const parseClass = (glob, position) => {
1514
- const pos2 = position;
1515
- if (glob.charAt(pos2) !== "[") {
1516
- throw new Error("not in a brace expression");
1517
- }
1518
- const ranges2 = [];
1519
- const negs = [];
1520
- let i2 = pos2 + 1;
1521
- let sawStart = false;
1522
- let uflag = false;
1523
- let escaping = false;
1524
- let negate = false;
1525
- let endPos = pos2;
1526
- let rangeStart = "";
1527
- WHILE: while (i2 < glob.length) {
1528
- const c = glob.charAt(i2);
1529
- if ((c === "!" || c === "^") && i2 === pos2 + 1) {
1530
- negate = true;
1531
- i2++;
1532
- continue;
1533
- }
1534
- if (c === "]" && sawStart && !escaping) {
1535
- endPos = i2 + 1;
1536
- break;
1537
- }
1538
- sawStart = true;
1539
- if (c === "\\") {
1540
- if (!escaping) {
1541
- escaping = true;
1542
- i2++;
1543
- continue;
1544
- }
1545
- }
1546
- if (c === "[" && !escaping) {
1547
- for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
1548
- if (glob.startsWith(cls, i2)) {
1549
- if (rangeStart) {
1550
- return ["$.", false, glob.length - pos2, true];
1551
- }
1552
- i2 += cls.length;
1553
- if (neg)
1554
- negs.push(unip);
1555
- else
1556
- ranges2.push(unip);
1557
- uflag = uflag || u;
1558
- continue WHILE;
1559
- }
1560
- }
1561
- }
1562
- escaping = false;
1563
- if (rangeStart) {
1564
- if (c > rangeStart) {
1565
- ranges2.push(braceEscape(rangeStart) + "-" + braceEscape(c));
1566
- } else if (c === rangeStart) {
1567
- ranges2.push(braceEscape(c));
1568
- }
1569
- rangeStart = "";
1570
- i2++;
1571
- continue;
1572
- }
1573
- if (glob.startsWith("-]", i2 + 1)) {
1574
- ranges2.push(braceEscape(c + "-"));
1575
- i2 += 2;
1576
- continue;
1577
- }
1578
- if (glob.startsWith("-", i2 + 1)) {
1579
- rangeStart = c;
1580
- i2 += 2;
1581
- continue;
1582
- }
1583
- ranges2.push(braceEscape(c));
1584
- i2++;
1585
- }
1586
- if (endPos < i2) {
1587
- return ["", false, 0, false];
1588
- }
1589
- if (!ranges2.length && !negs.length) {
1590
- return ["$.", false, glob.length - pos2, true];
1591
- }
1592
- if (negs.length === 0 && ranges2.length === 1 && /^\\?.$/.test(ranges2[0]) && !negate) {
1593
- const r2 = ranges2[0].length === 2 ? ranges2[0].slice(-1) : ranges2[0];
1594
- return [regexpEscape(r2), false, endPos - pos2, false];
1595
- }
1596
- const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges2) + "]";
1597
- const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
1598
- const comb = ranges2.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges2.length ? sranges : snegs;
1599
- return [comb, uflag, endPos - pos2, true];
1600
- };
1601
- const unescape = (s, { windowsPathsNoEscape = false } = {}) => {
1602
- return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
1603
- };
1604
- const types = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
1605
- const isExtglobType = (c) => types.has(c);
1606
- const startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
1607
- const startNoDot = "(?!\\.)";
1608
- const addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
1609
- const justDots = /* @__PURE__ */ new Set(["..", "."]);
1610
- const reSpecials = new Set("().*{}+?[]^$\\!");
1611
- const regExpEscape$1 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
1612
- const qmark$1 = "[^/]";
1613
- const star$2 = qmark$1 + "*?";
1614
- const starNoEmpty = qmark$1 + "+?";
1615
- const _AST = class _AST {
1616
- constructor(type, parent, options = {}) {
1617
- __privateAdd2(this, _AST_instances);
1618
- __publicField2(this, "type");
1619
- __privateAdd2(this, _root);
1620
- __privateAdd2(this, _hasMagic);
1621
- __privateAdd2(this, _uflag, false);
1622
- __privateAdd2(this, _parts, []);
1623
- __privateAdd2(this, _parent);
1624
- __privateAdd2(this, _parentIndex);
1625
- __privateAdd2(this, _negs);
1626
- __privateAdd2(this, _filledNegs, false);
1627
- __privateAdd2(this, _options);
1628
- __privateAdd2(this, _toString);
1629
- // set to true if it's an extglob with no children
1630
- // (which really means one child of '')
1631
- __privateAdd2(this, _emptyExt, false);
1632
- this.type = type;
1633
- if (type)
1634
- __privateSet2(this, _hasMagic, true);
1635
- __privateSet2(this, _parent, parent);
1636
- __privateSet2(this, _root, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _root) : this);
1637
- __privateSet2(this, _options, __privateGet2(this, _root) === this ? options : __privateGet2(__privateGet2(this, _root), _options));
1638
- __privateSet2(this, _negs, __privateGet2(this, _root) === this ? [] : __privateGet2(__privateGet2(this, _root), _negs));
1639
- if (type === "!" && !__privateGet2(__privateGet2(this, _root), _filledNegs))
1640
- __privateGet2(this, _negs).push(this);
1641
- __privateSet2(this, _parentIndex, __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0);
1642
- }
1643
- get hasMagic() {
1644
- if (__privateGet2(this, _hasMagic) !== void 0)
1645
- return __privateGet2(this, _hasMagic);
1646
- for (const p2 of __privateGet2(this, _parts)) {
1647
- if (typeof p2 === "string")
1648
- continue;
1649
- if (p2.type || p2.hasMagic)
1650
- return __privateSet2(this, _hasMagic, true);
1651
- }
1652
- return __privateGet2(this, _hasMagic);
1653
- }
1654
- // reconstructs the pattern
1655
- toString() {
1656
- if (__privateGet2(this, _toString) !== void 0)
1657
- return __privateGet2(this, _toString);
1658
- if (!this.type) {
1659
- return __privateSet2(this, _toString, __privateGet2(this, _parts).map((p2) => String(p2)).join(""));
1660
- } else {
1661
- return __privateSet2(this, _toString, this.type + "(" + __privateGet2(this, _parts).map((p2) => String(p2)).join("|") + ")");
1662
- }
1663
- }
1664
- push(...parts2) {
1665
- for (const p2 of parts2) {
1666
- if (p2 === "")
1667
- continue;
1668
- if (typeof p2 !== "string" && !(p2 instanceof _AST && __privateGet2(p2, _parent) === this)) {
1669
- throw new Error("invalid part: " + p2);
1670
- }
1671
- __privateGet2(this, _parts).push(p2);
1672
- }
1673
- }
1674
- toJSON() {
1675
- var _a3;
1676
- 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())];
1677
- if (this.isStart() && !this.type)
1678
- ret2.unshift([]);
1679
- if (this.isEnd() && (this === __privateGet2(this, _root) || __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")) {
1680
- ret2.push({});
1681
- }
1682
- return ret2;
1683
- }
1684
- isStart() {
1685
- var _a3;
1686
- if (__privateGet2(this, _root) === this)
1687
- return true;
1688
- if (!((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.isStart()))
1689
- return false;
1690
- if (__privateGet2(this, _parentIndex) === 0)
1691
- return true;
1692
- const p2 = __privateGet2(this, _parent);
1693
- for (let i2 = 0; i2 < __privateGet2(this, _parentIndex); i2++) {
1694
- const pp = __privateGet2(p2, _parts)[i2];
1695
- if (!(pp instanceof _AST && pp.type === "!")) {
1696
- return false;
1697
- }
1698
- }
1699
- return true;
1700
- }
1701
- isEnd() {
1702
- var _a3, _b2, _c2;
1703
- if (__privateGet2(this, _root) === this)
1704
- return true;
1705
- if (((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!")
1706
- return true;
1707
- if (!((_b2 = __privateGet2(this, _parent)) == null ? void 0 : _b2.isEnd()))
1708
- return false;
1709
- if (!this.type)
1710
- return (_c2 = __privateGet2(this, _parent)) == null ? void 0 : _c2.isEnd();
1711
- const pl = __privateGet2(this, _parent) ? __privateGet2(__privateGet2(this, _parent), _parts).length : 0;
1712
- return __privateGet2(this, _parentIndex) === pl - 1;
1713
- }
1714
- copyIn(part) {
1715
- if (typeof part === "string")
1716
- this.push(part);
1717
- else
1718
- this.push(part.clone(this));
1719
- }
1720
- clone(parent) {
1721
- const c = new _AST(this.type, parent);
1722
- for (const p2 of __privateGet2(this, _parts)) {
1723
- c.copyIn(p2);
1724
- }
1725
- return c;
1726
- }
1727
- static fromGlob(pattern, options = {}) {
1728
- var _a3;
1729
- const ast = new _AST(null, void 0, options);
1730
- __privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, pattern, ast, 0, options);
1731
- return ast;
1732
- }
1733
- // returns the regular expression if there's magic, or the unescaped
1734
- // string if not.
1735
- toMMPattern() {
1736
- if (this !== __privateGet2(this, _root))
1737
- return __privateGet2(this, _root).toMMPattern();
1738
- const glob = this.toString();
1739
- const [re, body2, hasMagic, uflag] = this.toRegExpSource();
1740
- const anyMagic = hasMagic || __privateGet2(this, _hasMagic) || __privateGet2(this, _options).nocase && !__privateGet2(this, _options).nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
1741
- if (!anyMagic) {
1742
- return body2;
1743
- }
1744
- const flags2 = (__privateGet2(this, _options).nocase ? "i" : "") + (uflag ? "u" : "");
1745
- return Object.assign(new RegExp(`^${re}$`, flags2), {
1746
- _src: re,
1747
- _glob: glob
1748
- });
1749
- }
1750
- get options() {
1751
- return __privateGet2(this, _options);
1752
- }
1753
- // returns the string match, the regexp source, whether there's magic
1754
- // in the regexp (so a regular expression is required) and whether or
1755
- // not the uflag is needed for the regular expression (for posix classes)
1756
- // TODO: instead of injecting the start/end at this point, just return
1757
- // the BODY of the regexp, along with the start/end portions suitable
1758
- // for binding the start/end in either a joined full-path makeRe context
1759
- // (where we bind to (^|/), or a standalone matchPart context (where
1760
- // we bind to ^, and not /). Otherwise slashes get duped!
1761
- //
1762
- // In part-matching mode, the start is:
1763
- // - if not isStart: nothing
1764
- // - if traversal possible, but not allowed: ^(?!\.\.?$)
1765
- // - if dots allowed or not possible: ^
1766
- // - if dots possible and not allowed: ^(?!\.)
1767
- // end is:
1768
- // - if not isEnd(): nothing
1769
- // - else: $
1770
- //
1771
- // In full-path matching mode, we put the slash at the START of the
1772
- // pattern, so start is:
1773
- // - if first pattern: same as part-matching mode
1774
- // - if not isStart(): nothing
1775
- // - if traversal possible, but not allowed: /(?!\.\.?(?:$|/))
1776
- // - if dots allowed or not possible: /
1777
- // - if dots possible and not allowed: /(?!\.)
1778
- // end is:
1779
- // - if last pattern, same as part-matching mode
1780
- // - else nothing
1781
- //
1782
- // Always put the (?:$|/) on negated tails, though, because that has to be
1783
- // there to bind the end of the negated pattern portion, and it's easier to
1784
- // just stick it in now rather than try to inject it later in the middle of
1785
- // the pattern.
1786
- //
1787
- // We can just always return the same end, and leave it up to the caller
1788
- // to know whether it's going to be used joined or in parts.
1789
- // And, if the start is adjusted slightly, can do the same there:
1790
- // - if not isStart: nothing
1791
- // - if traversal possible, but not allowed: (?:/|^)(?!\.\.?$)
1792
- // - if dots allowed or not possible: (?:/|^)
1793
- // - if dots possible and not allowed: (?:/|^)(?!\.)
1794
- //
1795
- // But it's better to have a simpler binding without a conditional, for
1796
- // performance, so probably better to return both start options.
1797
- //
1798
- // Then the caller just ignores the end if it's not the first pattern,
1799
- // and the start always gets applied.
1800
- //
1801
- // But that's always going to be $ if it's the ending pattern, or nothing,
1802
- // so the caller can just attach $ at the end of the pattern when building.
1803
- //
1804
- // So the todo is:
1805
- // - better detect what kind of start is needed
1806
- // - return both flavors of starting pattern
1807
- // - attach $ at the end of the pattern when creating the actual RegExp
1808
- //
1809
- // Ah, but wait, no, that all only applies to the root when the first pattern
1810
- // is not an extglob. If the first pattern IS an extglob, then we need all
1811
- // that dot prevention biz to live in the extglob portions, because eg
1812
- // +(*|.x*) can match .xy but not .yx.
1813
- //
1814
- // So, return the two flavors if it's #root and the first child is not an
1815
- // AST, otherwise leave it to the child AST to handle it, and there,
1816
- // use the (?:^|/) style of start binding.
1817
- //
1818
- // Even simplified further:
1819
- // - Since the start for a join is eg /(?!\.) and the start for a part
1820
- // is ^(?!\.), we can just prepend (?!\.) to the pattern (either root
1821
- // or start or whatever) and prepend ^ or / at the Regexp construction.
1822
- toRegExpSource(allowDot) {
1823
- var _a3;
1824
- const dot2 = allowDot ?? !!__privateGet2(this, _options).dot;
1825
- if (__privateGet2(this, _root) === this)
1826
- __privateMethod2(this, _AST_instances, fillNegs_fn).call(this);
1827
- if (!this.type) {
1828
- const noEmpty = this.isStart() && this.isEnd();
1829
- const src = __privateGet2(this, _parts).map((p2) => {
1830
- var _a4;
1831
- 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);
1832
- __privateSet2(this, _hasMagic, __privateGet2(this, _hasMagic) || hasMagic);
1833
- __privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
1834
- return re;
1835
- }).join("");
1836
- let start3 = "";
1837
- if (this.isStart()) {
1838
- if (typeof __privateGet2(this, _parts)[0] === "string") {
1839
- const dotTravAllowed = __privateGet2(this, _parts).length === 1 && justDots.has(__privateGet2(this, _parts)[0]);
1840
- if (!dotTravAllowed) {
1841
- const aps = addPatternStart;
1842
- const needNoTrav = (
1843
- // dots are allowed, and the pattern starts with [ or .
1844
- dot2 && aps.has(src.charAt(0)) || // the pattern starts with \., and then [ or .
1845
- src.startsWith("\\.") && aps.has(src.charAt(2)) || // the pattern starts with \.\., and then [ or .
1846
- src.startsWith("\\.\\.") && aps.has(src.charAt(4))
1847
- );
1848
- const needNoDot = !dot2 && !allowDot && aps.has(src.charAt(0));
1849
- start3 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
1850
- }
1851
- }
1852
- }
1853
- let end = "";
1854
- if (this.isEnd() && __privateGet2(__privateGet2(this, _root), _filledNegs) && ((_a3 = __privateGet2(this, _parent)) == null ? void 0 : _a3.type) === "!") {
1855
- end = "(?:$|\\/)";
1856
- }
1857
- const final2 = start3 + src + end;
1858
- return [
1859
- final2,
1860
- unescape(src),
1861
- __privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
1862
- __privateGet2(this, _uflag)
1863
- ];
1864
- }
1865
- const repeated = this.type === "*" || this.type === "+";
1866
- const start2 = this.type === "!" ? "(?:(?!(?:" : "(?:";
1867
- let body2 = __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, dot2);
1868
- if (this.isStart() && this.isEnd() && !body2 && this.type !== "!") {
1869
- const s = this.toString();
1870
- __privateSet2(this, _parts, [s]);
1871
- this.type = null;
1872
- __privateSet2(this, _hasMagic, void 0);
1873
- return [s, unescape(this.toString()), false, false];
1874
- }
1875
- let bodyDotAllowed = !repeated || allowDot || dot2 || !startNoDot ? "" : __privateMethod2(this, _AST_instances, partsToRegExp_fn).call(this, true);
1876
- if (bodyDotAllowed === body2) {
1877
- bodyDotAllowed = "";
1878
- }
1879
- if (bodyDotAllowed) {
1880
- body2 = `(?:${body2})(?:${bodyDotAllowed})*?`;
1881
- }
1882
- let final = "";
1883
- if (this.type === "!" && __privateGet2(this, _emptyExt)) {
1884
- final = (this.isStart() && !dot2 ? startNoDot : "") + starNoEmpty;
1885
- } else {
1886
- const close = this.type === "!" ? (
1887
- // !() must match something,but !(x) can match ''
1888
- "))" + (this.isStart() && !dot2 && !allowDot ? startNoDot : "") + star$2 + ")"
1889
- ) : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
1890
- final = start2 + body2 + close;
1891
- }
1892
- return [
1893
- final,
1894
- unescape(body2),
1895
- __privateSet2(this, _hasMagic, !!__privateGet2(this, _hasMagic)),
1896
- __privateGet2(this, _uflag)
1897
- ];
1898
- }
1899
- };
1900
- _root = new WeakMap();
1901
- _hasMagic = new WeakMap();
1902
- _uflag = new WeakMap();
1903
- _parts = new WeakMap();
1904
- _parent = new WeakMap();
1905
- _parentIndex = new WeakMap();
1906
- _negs = new WeakMap();
1907
- _filledNegs = new WeakMap();
1908
- _options = new WeakMap();
1909
- _toString = new WeakMap();
1910
- _emptyExt = new WeakMap();
1911
- _AST_instances = new WeakSet();
1912
- fillNegs_fn = function() {
1913
- if (this !== __privateGet2(this, _root))
1914
- throw new Error("should only call on root");
1915
- if (__privateGet2(this, _filledNegs))
1916
- return this;
1917
- this.toString();
1918
- __privateSet2(this, _filledNegs, true);
1919
- let n;
1920
- while (n = __privateGet2(this, _negs).pop()) {
1921
- if (n.type !== "!")
1922
- continue;
1923
- let p2 = n;
1924
- let pp = __privateGet2(p2, _parent);
1925
- while (pp) {
1926
- for (let i2 = __privateGet2(p2, _parentIndex) + 1; !pp.type && i2 < __privateGet2(pp, _parts).length; i2++) {
1927
- for (const part of __privateGet2(n, _parts)) {
1928
- if (typeof part === "string") {
1929
- throw new Error("string part in extglob AST??");
1930
- }
1931
- part.copyIn(__privateGet2(pp, _parts)[i2]);
1932
- }
1933
- }
1934
- p2 = pp;
1935
- pp = __privateGet2(p2, _parent);
1936
- }
1937
- }
1938
- return this;
1939
- };
1940
- _AST_static = new WeakSet();
1941
- parseAST_fn = function(str, ast, pos2, opt) {
1942
- var _a3, _b2;
1943
- let escaping = false;
1944
- let inBrace = false;
1945
- let braceStart = -1;
1946
- let braceNeg = false;
1947
- if (ast.type === null) {
1948
- let i3 = pos2;
1949
- let acc2 = "";
1950
- while (i3 < str.length) {
1951
- const c = str.charAt(i3++);
1952
- if (escaping || c === "\\") {
1953
- escaping = !escaping;
1954
- acc2 += c;
1955
- continue;
1956
- }
1957
- if (inBrace) {
1958
- if (i3 === braceStart + 1) {
1959
- if (c === "^" || c === "!") {
1960
- braceNeg = true;
1961
- }
1962
- } else if (c === "]" && !(i3 === braceStart + 2 && braceNeg)) {
1963
- inBrace = false;
1964
- }
1965
- acc2 += c;
1966
- continue;
1967
- } else if (c === "[") {
1968
- inBrace = true;
1969
- braceStart = i3;
1970
- braceNeg = false;
1971
- acc2 += c;
1972
- continue;
1973
- }
1974
- if (!opt.noext && isExtglobType(c) && str.charAt(i3) === "(") {
1975
- ast.push(acc2);
1976
- acc2 = "";
1977
- const ext2 = new _AST(c, ast);
1978
- i3 = __privateMethod2(_a3 = _AST, _AST_static, parseAST_fn).call(_a3, str, ext2, i3, opt);
1979
- ast.push(ext2);
1980
- continue;
1981
- }
1982
- acc2 += c;
1983
- }
1984
- ast.push(acc2);
1985
- return i3;
1986
- }
1987
- let i2 = pos2 + 1;
1988
- let part = new _AST(null, ast);
1989
- const parts2 = [];
1990
- let acc = "";
1991
- while (i2 < str.length) {
1992
- const c = str.charAt(i2++);
1993
- if (escaping || c === "\\") {
1994
- escaping = !escaping;
1995
- acc += c;
1996
- continue;
1997
- }
1998
- if (inBrace) {
1999
- if (i2 === braceStart + 1) {
2000
- if (c === "^" || c === "!") {
2001
- braceNeg = true;
2002
- }
2003
- } else if (c === "]" && !(i2 === braceStart + 2 && braceNeg)) {
2004
- inBrace = false;
2005
- }
2006
- acc += c;
2007
- continue;
2008
- } else if (c === "[") {
2009
- inBrace = true;
2010
- braceStart = i2;
2011
- braceNeg = false;
2012
- acc += c;
2013
- continue;
2014
- }
2015
- if (isExtglobType(c) && str.charAt(i2) === "(") {
2016
- part.push(acc);
2017
- acc = "";
2018
- const ext2 = new _AST(c, part);
2019
- part.push(ext2);
2020
- i2 = __privateMethod2(_b2 = _AST, _AST_static, parseAST_fn).call(_b2, str, ext2, i2, opt);
2021
- continue;
2022
- }
2023
- if (c === "|") {
2024
- part.push(acc);
2025
- acc = "";
2026
- parts2.push(part);
2027
- part = new _AST(null, ast);
2028
- continue;
2029
- }
2030
- if (c === ")") {
2031
- if (acc === "" && __privateGet2(ast, _parts).length === 0) {
2032
- __privateSet2(ast, _emptyExt, true);
2033
- }
2034
- part.push(acc);
2035
- acc = "";
2036
- ast.push(...parts2, part);
2037
- return i2;
2038
- }
2039
- acc += c;
2040
- }
2041
- ast.type = null;
2042
- __privateSet2(ast, _hasMagic, void 0);
2043
- __privateSet2(ast, _parts, [str.substring(pos2 - 1)]);
2044
- return i2;
2045
- };
2046
- partsToRegExp_fn = function(dot2) {
2047
- return __privateGet2(this, _parts).map((p2) => {
2048
- if (typeof p2 === "string") {
2049
- throw new Error("string type in extglob ast??");
2050
- }
2051
- const [re, _2, _hasMagic2, uflag] = p2.toRegExpSource(dot2);
2052
- __privateSet2(this, _uflag, __privateGet2(this, _uflag) || uflag);
2053
- return re;
2054
- }).filter((p2) => !(this.isStart() && this.isEnd()) || !!p2).join("|");
2055
- };
2056
- parseGlob_fn = function(glob, hasMagic, noEmpty = false) {
2057
- let escaping = false;
2058
- let re = "";
2059
- let uflag = false;
2060
- for (let i2 = 0; i2 < glob.length; i2++) {
2061
- const c = glob.charAt(i2);
2062
- if (escaping) {
2063
- escaping = false;
2064
- re += (reSpecials.has(c) ? "\\" : "") + c;
2065
- continue;
2066
- }
2067
- if (c === "\\") {
2068
- if (i2 === glob.length - 1) {
2069
- re += "\\\\";
2070
- } else {
2071
- escaping = true;
2072
- }
2073
- continue;
2074
- }
2075
- if (c === "[") {
2076
- const [src, needUflag, consumed, magic] = parseClass(glob, i2);
2077
- if (consumed) {
2078
- re += src;
2079
- uflag = uflag || needUflag;
2080
- i2 += consumed - 1;
2081
- hasMagic = hasMagic || magic;
2082
- continue;
2083
- }
2084
- }
2085
- if (c === "*") {
2086
- if (noEmpty && glob === "*")
2087
- re += starNoEmpty;
2088
- else
2089
- re += star$2;
2090
- hasMagic = true;
2091
- continue;
2092
- }
2093
- if (c === "?") {
2094
- re += qmark$1;
2095
- hasMagic = true;
2096
- continue;
2097
- }
2098
- re += regExpEscape$1(c);
2099
- }
2100
- return [re, unescape(glob), !!hasMagic, uflag];
2101
- };
2102
- __privateAdd2(_AST, _AST_static);
2103
- let AST = _AST;
2104
- const escape$1 = (s, { windowsPathsNoEscape = false } = {}) => {
2105
- return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
2106
- };
2107
- var define_process_default$l = { env: {} };
2108
- const minimatch = (p2, pattern, options = {}) => {
2109
- assertValidPattern(pattern);
2110
- if (!options.nocomment && pattern.charAt(0) === "#") {
2111
- return false;
2112
- }
2113
- return new Minimatch(pattern, options).match(p2);
2114
- };
2115
- const starDotExtRE = /^\*+([^+@!?\*\[\(]*)$/;
2116
- const starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
2117
- const starDotExtTestDot = (ext2) => (f) => f.endsWith(ext2);
2118
- const starDotExtTestNocase = (ext2) => {
2119
- ext2 = ext2.toLowerCase();
2120
- return (f) => !f.startsWith(".") && f.toLowerCase().endsWith(ext2);
2121
- };
2122
- const starDotExtTestNocaseDot = (ext2) => {
2123
- ext2 = ext2.toLowerCase();
2124
- return (f) => f.toLowerCase().endsWith(ext2);
2125
- };
2126
- const starDotStarRE = /^\*+\.\*+$/;
2127
- const starDotStarTest = (f) => !f.startsWith(".") && f.includes(".");
2128
- const starDotStarTestDot = (f) => f !== "." && f !== ".." && f.includes(".");
2129
- const dotStarRE = /^\.\*+$/;
2130
- const dotStarTest = (f) => f !== "." && f !== ".." && f.startsWith(".");
2131
- const starRE = /^\*+$/;
2132
- const starTest = (f) => f.length !== 0 && !f.startsWith(".");
2133
- const starTestDot = (f) => f.length !== 0 && f !== "." && f !== "..";
2134
- const qmarksRE = /^\?+([^+@!?\*\[\(]*)?$/;
2135
- const qmarksTestNocase = ([$0, ext2 = ""]) => {
2136
- const noext = qmarksTestNoExt([$0]);
2137
- if (!ext2)
2138
- return noext;
2139
- ext2 = ext2.toLowerCase();
2140
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
2141
- };
2142
- const qmarksTestNocaseDot = ([$0, ext2 = ""]) => {
2143
- const noext = qmarksTestNoExtDot([$0]);
2144
- if (!ext2)
2145
- return noext;
2146
- ext2 = ext2.toLowerCase();
2147
- return (f) => noext(f) && f.toLowerCase().endsWith(ext2);
2148
- };
2149
- const qmarksTestDot = ([$0, ext2 = ""]) => {
2150
- const noext = qmarksTestNoExtDot([$0]);
2151
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
2152
- };
2153
- const qmarksTest = ([$0, ext2 = ""]) => {
2154
- const noext = qmarksTestNoExt([$0]);
2155
- return !ext2 ? noext : (f) => noext(f) && f.endsWith(ext2);
2156
- };
2157
- const qmarksTestNoExt = ([$0]) => {
2158
- const len2 = $0.length;
2159
- return (f) => f.length === len2 && !f.startsWith(".");
2160
- };
2161
- const qmarksTestNoExtDot = ([$0]) => {
2162
- const len2 = $0.length;
2163
- return (f) => f.length === len2 && f !== "." && f !== "..";
2164
- };
2165
- 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";
2166
- const path = {
2167
- win32: { sep: "\\" },
2168
- posix: { sep: "/" }
2169
- };
2170
- const sep = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
2171
- minimatch.sep = sep;
2172
- const GLOBSTAR = Symbol("globstar **");
2173
- minimatch.GLOBSTAR = GLOBSTAR;
2174
- const qmark = "[^/]";
2175
- const star$1 = qmark + "*?";
2176
- const twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
2177
- const twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
2178
- const filter$1 = (pattern, options = {}) => (p2) => minimatch(p2, pattern, options);
2179
- minimatch.filter = filter$1;
2180
- const ext = (a, b = {}) => Object.assign({}, a, b);
2181
- const defaults = (def) => {
2182
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
2183
- return minimatch;
2184
- }
2185
- const orig = minimatch;
2186
- const m = (p2, pattern, options = {}) => orig(p2, pattern, ext(def, options));
2187
- return Object.assign(m, {
2188
- Minimatch: class Minimatch extends orig.Minimatch {
2189
- constructor(pattern, options = {}) {
2190
- super(pattern, ext(def, options));
2191
- }
2192
- static defaults(options) {
2193
- return orig.defaults(ext(def, options)).Minimatch;
2194
- }
2195
- },
2196
- AST: class AST extends orig.AST {
2197
- /* c8 ignore start */
2198
- constructor(type, parent, options = {}) {
2199
- super(type, parent, ext(def, options));
2200
- }
2201
- /* c8 ignore stop */
2202
- static fromGlob(pattern, options = {}) {
2203
- return orig.AST.fromGlob(pattern, ext(def, options));
2204
- }
2205
- },
2206
- unescape: (s, options = {}) => orig.unescape(s, ext(def, options)),
2207
- escape: (s, options = {}) => orig.escape(s, ext(def, options)),
2208
- filter: (pattern, options = {}) => orig.filter(pattern, ext(def, options)),
2209
- defaults: (options) => orig.defaults(ext(def, options)),
2210
- makeRe: (pattern, options = {}) => orig.makeRe(pattern, ext(def, options)),
2211
- braceExpand: (pattern, options = {}) => orig.braceExpand(pattern, ext(def, options)),
2212
- match: (list, pattern, options = {}) => orig.match(list, pattern, ext(def, options)),
2213
- sep: orig.sep,
2214
- GLOBSTAR
2215
- });
2216
- };
2217
- minimatch.defaults = defaults;
2218
- const braceExpand = (pattern, options = {}) => {
2219
- assertValidPattern(pattern);
2220
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
2221
- return [pattern];
2222
- }
2223
- return expand(pattern);
2224
- };
2225
- minimatch.braceExpand = braceExpand;
2226
- const makeRe = (pattern, options = {}) => new Minimatch(pattern, options).makeRe();
2227
- minimatch.makeRe = makeRe;
2228
- const match$1 = (list, pattern, options = {}) => {
2229
- const mm = new Minimatch(pattern, options);
2230
- list = list.filter((f) => mm.match(f));
2231
- if (mm.options.nonull && !list.length) {
2232
- list.push(pattern);
2233
- }
2234
- return list;
2235
- };
2236
- minimatch.match = match$1;
2237
- const globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
2238
- const regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2239
- class Minimatch {
2240
- constructor(pattern, options = {}) {
2241
- __publicField2(this, "options");
2242
- __publicField2(this, "set");
2243
- __publicField2(this, "pattern");
2244
- __publicField2(this, "windowsPathsNoEscape");
2245
- __publicField2(this, "nonegate");
2246
- __publicField2(this, "negate");
2247
- __publicField2(this, "comment");
2248
- __publicField2(this, "empty");
2249
- __publicField2(this, "preserveMultipleSlashes");
2250
- __publicField2(this, "partial");
2251
- __publicField2(this, "globSet");
2252
- __publicField2(this, "globParts");
2253
- __publicField2(this, "nocase");
2254
- __publicField2(this, "isWindows");
2255
- __publicField2(this, "platform");
2256
- __publicField2(this, "windowsNoMagicRoot");
2257
- __publicField2(this, "regexp");
2258
- assertValidPattern(pattern);
2259
- options = options || {};
2260
- this.options = options;
2261
- this.pattern = pattern;
2262
- this.platform = options.platform || defaultPlatform;
2263
- this.isWindows = this.platform === "win32";
2264
- this.windowsPathsNoEscape = !!options.windowsPathsNoEscape || options.allowWindowsEscape === false;
2265
- if (this.windowsPathsNoEscape) {
2266
- this.pattern = this.pattern.replace(/\\/g, "/");
2267
- }
2268
- this.preserveMultipleSlashes = !!options.preserveMultipleSlashes;
2269
- this.regexp = null;
2270
- this.negate = false;
2271
- this.nonegate = !!options.nonegate;
2272
- this.comment = false;
2273
- this.empty = false;
2274
- this.partial = !!options.partial;
2275
- this.nocase = !!this.options.nocase;
2276
- this.windowsNoMagicRoot = options.windowsNoMagicRoot !== void 0 ? options.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
2277
- this.globSet = [];
2278
- this.globParts = [];
2279
- this.set = [];
2280
- this.make();
2281
- }
2282
- hasMagic() {
2283
- if (this.options.magicalBraces && this.set.length > 1) {
2284
- return true;
2285
- }
2286
- for (const pattern of this.set) {
2287
- for (const part of pattern) {
2288
- if (typeof part !== "string")
2289
- return true;
2290
- }
2291
- }
2292
- return false;
2293
- }
2294
- debug(..._2) {
2295
- }
2296
- make() {
2297
- const pattern = this.pattern;
2298
- const options = this.options;
2299
- if (!options.nocomment && pattern.charAt(0) === "#") {
2300
- this.comment = true;
2301
- return;
2302
- }
2303
- if (!pattern) {
2304
- this.empty = true;
2305
- return;
2306
- }
2307
- this.parseNegate();
2308
- this.globSet = [...new Set(this.braceExpand())];
2309
- if (options.debug) {
2310
- this.debug = (...args2) => console.error(...args2);
2311
- }
2312
- this.debug(this.pattern, this.globSet);
2313
- const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
2314
- this.globParts = this.preprocess(rawGlobParts);
2315
- this.debug(this.pattern, this.globParts);
2316
- let set2 = this.globParts.map((s, _2, __) => {
2317
- if (this.isWindows && this.windowsNoMagicRoot) {
2318
- const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
2319
- const isDrive = /^[a-z]:/i.test(s[0]);
2320
- if (isUNC) {
2321
- return [...s.slice(0, 4), ...s.slice(4).map((ss) => this.parse(ss))];
2322
- } else if (isDrive) {
2323
- return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
2324
- }
2325
- }
2326
- return s.map((ss) => this.parse(ss));
2327
- });
2328
- this.debug(this.pattern, set2);
2329
- this.set = set2.filter((s) => s.indexOf(false) === -1);
2330
- if (this.isWindows) {
2331
- for (let i2 = 0; i2 < this.set.length; i2++) {
2332
- const p2 = this.set[i2];
2333
- if (p2[0] === "" && p2[1] === "" && this.globParts[i2][2] === "?" && typeof p2[3] === "string" && /^[a-z]:$/i.test(p2[3])) {
2334
- p2[2] = "?";
2335
- }
2336
- }
2337
- }
2338
- this.debug(this.pattern, this.set);
2339
- }
2340
- // various transforms to equivalent pattern sets that are
2341
- // faster to process in a filesystem walk. The goal is to
2342
- // eliminate what we can, and push all ** patterns as far
2343
- // to the right as possible, even if it increases the number
2344
- // of patterns that we have to process.
2345
- preprocess(globParts) {
2346
- if (this.options.noglobstar) {
2347
- for (let i2 = 0; i2 < globParts.length; i2++) {
2348
- for (let j = 0; j < globParts[i2].length; j++) {
2349
- if (globParts[i2][j] === "**") {
2350
- globParts[i2][j] = "*";
2351
- }
2352
- }
2353
- }
2354
- }
2355
- const { optimizationLevel = 1 } = this.options;
2356
- if (optimizationLevel >= 2) {
2357
- globParts = this.firstPhasePreProcess(globParts);
2358
- globParts = this.secondPhasePreProcess(globParts);
2359
- } else if (optimizationLevel >= 1) {
2360
- globParts = this.levelOneOptimize(globParts);
2361
- } else {
2362
- globParts = this.adjascentGlobstarOptimize(globParts);
2363
- }
2364
- return globParts;
2365
- }
2366
- // just get rid of adjascent ** portions
2367
- adjascentGlobstarOptimize(globParts) {
2368
- return globParts.map((parts2) => {
2369
- let gs = -1;
2370
- while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
2371
- let i2 = gs;
2372
- while (parts2[i2 + 1] === "**") {
2373
- i2++;
2374
- }
2375
- if (i2 !== gs) {
2376
- parts2.splice(gs, i2 - gs);
2377
- }
2378
- }
2379
- return parts2;
2380
- });
2381
- }
2382
- // get rid of adjascent ** and resolve .. portions
2383
- levelOneOptimize(globParts) {
2384
- return globParts.map((parts2) => {
2385
- parts2 = parts2.reduce((set2, part) => {
2386
- const prev = set2[set2.length - 1];
2387
- if (part === "**" && prev === "**") {
2388
- return set2;
2389
- }
2390
- if (part === "..") {
2391
- if (prev && prev !== ".." && prev !== "." && prev !== "**") {
2392
- set2.pop();
2393
- return set2;
2394
- }
2395
- }
2396
- set2.push(part);
2397
- return set2;
2398
- }, []);
2399
- return parts2.length === 0 ? [""] : parts2;
2400
- });
2401
- }
2402
- levelTwoFileOptimize(parts2) {
2403
- if (!Array.isArray(parts2)) {
2404
- parts2 = this.slashSplit(parts2);
2405
- }
2406
- let didSomething = false;
2407
- do {
2408
- didSomething = false;
2409
- if (!this.preserveMultipleSlashes) {
2410
- for (let i2 = 1; i2 < parts2.length - 1; i2++) {
2411
- const p2 = parts2[i2];
2412
- if (i2 === 1 && p2 === "" && parts2[0] === "")
2413
- continue;
2414
- if (p2 === "." || p2 === "") {
2415
- didSomething = true;
2416
- parts2.splice(i2, 1);
2417
- i2--;
2418
- }
2419
- }
2420
- if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
2421
- didSomething = true;
2422
- parts2.pop();
2423
- }
2424
- }
2425
- let dd2 = 0;
2426
- while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
2427
- const p2 = parts2[dd2 - 1];
2428
- if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
2429
- didSomething = true;
2430
- parts2.splice(dd2 - 1, 2);
2431
- dd2 -= 2;
2432
- }
2433
- }
2434
- } while (didSomething);
2435
- return parts2.length === 0 ? [""] : parts2;
2436
- }
2437
- // First phase: single-pattern processing
2438
- // <pre> is 1 or more portions
2439
- // <rest> is 1 or more portions
2440
- // <p> is any portion other than ., .., '', or **
2441
- // <e> is . or ''
2442
- //
2443
- // **/.. is *brutal* for filesystem walking performance, because
2444
- // it effectively resets the recursive walk each time it occurs,
2445
- // and ** cannot be reduced out by a .. pattern part like a regexp
2446
- // or most strings (other than .., ., and '') can be.
2447
- //
2448
- // <pre>/**/../<p>/<p>/<rest> -> {<pre>/../<p>/<p>/<rest>,<pre>/**/<p>/<p>/<rest>}
2449
- // <pre>/<e>/<rest> -> <pre>/<rest>
2450
- // <pre>/<p>/../<rest> -> <pre>/<rest>
2451
- // **/**/<rest> -> **/<rest>
2452
- //
2453
- // **/*/<rest> -> */**/<rest> <== not valid because ** doesn't follow
2454
- // this WOULD be allowed if ** did follow symlinks, or * didn't
2455
- firstPhasePreProcess(globParts) {
2456
- let didSomething = false;
2457
- do {
2458
- didSomething = false;
2459
- for (let parts2 of globParts) {
2460
- let gs = -1;
2461
- while (-1 !== (gs = parts2.indexOf("**", gs + 1))) {
2462
- let gss = gs;
2463
- while (parts2[gss + 1] === "**") {
2464
- gss++;
2465
- }
2466
- if (gss > gs) {
2467
- parts2.splice(gs + 1, gss - gs);
2468
- }
2469
- let next = parts2[gs + 1];
2470
- const p2 = parts2[gs + 2];
2471
- const p22 = parts2[gs + 3];
2472
- if (next !== "..")
2473
- continue;
2474
- if (!p2 || p2 === "." || p2 === ".." || !p22 || p22 === "." || p22 === "..") {
2475
- continue;
2476
- }
2477
- didSomething = true;
2478
- parts2.splice(gs, 1);
2479
- const other = parts2.slice(0);
2480
- other[gs] = "**";
2481
- globParts.push(other);
2482
- gs--;
2483
- }
2484
- if (!this.preserveMultipleSlashes) {
2485
- for (let i2 = 1; i2 < parts2.length - 1; i2++) {
2486
- const p2 = parts2[i2];
2487
- if (i2 === 1 && p2 === "" && parts2[0] === "")
2488
- continue;
2489
- if (p2 === "." || p2 === "") {
2490
- didSomething = true;
2491
- parts2.splice(i2, 1);
2492
- i2--;
2493
- }
2494
- }
2495
- if (parts2[0] === "." && parts2.length === 2 && (parts2[1] === "." || parts2[1] === "")) {
2496
- didSomething = true;
2497
- parts2.pop();
2498
- }
2499
- }
2500
- let dd2 = 0;
2501
- while (-1 !== (dd2 = parts2.indexOf("..", dd2 + 1))) {
2502
- const p2 = parts2[dd2 - 1];
2503
- if (p2 && p2 !== "." && p2 !== ".." && p2 !== "**") {
2504
- didSomething = true;
2505
- const needDot = dd2 === 1 && parts2[dd2 + 1] === "**";
2506
- const splin = needDot ? ["."] : [];
2507
- parts2.splice(dd2 - 1, 2, ...splin);
2508
- if (parts2.length === 0)
2509
- parts2.push("");
2510
- dd2 -= 2;
2511
- }
2512
- }
2513
- }
2514
- } while (didSomething);
2515
- return globParts;
2516
- }
2517
- // second phase: multi-pattern dedupes
2518
- // {<pre>/*/<rest>,<pre>/<p>/<rest>} -> <pre>/*/<rest>
2519
- // {<pre>/<rest>,<pre>/<rest>} -> <pre>/<rest>
2520
- // {<pre>/**/<rest>,<pre>/<rest>} -> <pre>/**/<rest>
2521
- //
2522
- // {<pre>/**/<rest>,<pre>/**/<p>/<rest>} -> <pre>/**/<rest>
2523
- // ^-- not valid because ** doens't follow symlinks
2524
- secondPhasePreProcess(globParts) {
2525
- for (let i2 = 0; i2 < globParts.length - 1; i2++) {
2526
- for (let j = i2 + 1; j < globParts.length; j++) {
2527
- const matched = this.partsMatch(globParts[i2], globParts[j], !this.preserveMultipleSlashes);
2528
- if (!matched)
2529
- continue;
2530
- globParts[i2] = matched;
2531
- globParts[j] = [];
2532
- }
2533
- }
2534
- return globParts.filter((gs) => gs.length);
2535
- }
2536
- partsMatch(a, b, emptyGSMatch = false) {
2537
- let ai = 0;
2538
- let bi = 0;
2539
- let result = [];
2540
- let which = "";
2541
- while (ai < a.length && bi < b.length) {
2542
- if (a[ai] === b[bi]) {
2543
- result.push(which === "b" ? b[bi] : a[ai]);
2544
- ai++;
2545
- bi++;
2546
- } else if (emptyGSMatch && a[ai] === "**" && b[bi] === a[ai + 1]) {
2547
- result.push(a[ai]);
2548
- ai++;
2549
- } else if (emptyGSMatch && b[bi] === "**" && a[ai] === b[bi + 1]) {
2550
- result.push(b[bi]);
2551
- bi++;
2552
- } else if (a[ai] === "*" && b[bi] && (this.options.dot || !b[bi].startsWith(".")) && b[bi] !== "**") {
2553
- if (which === "b")
2554
- return false;
2555
- which = "a";
2556
- result.push(a[ai]);
2557
- ai++;
2558
- bi++;
2559
- } else if (b[bi] === "*" && a[ai] && (this.options.dot || !a[ai].startsWith(".")) && a[ai] !== "**") {
2560
- if (which === "a")
2561
- return false;
2562
- which = "b";
2563
- result.push(b[bi]);
2564
- ai++;
2565
- bi++;
2566
- } else {
2567
- return false;
2568
- }
2569
- }
2570
- return a.length === b.length && result;
2571
- }
2572
- parseNegate() {
2573
- if (this.nonegate)
2574
- return;
2575
- const pattern = this.pattern;
2576
- let negate = false;
2577
- let negateOffset = 0;
2578
- for (let i2 = 0; i2 < pattern.length && pattern.charAt(i2) === "!"; i2++) {
2579
- negate = !negate;
2580
- negateOffset++;
2581
- }
2582
- if (negateOffset)
2583
- this.pattern = pattern.slice(negateOffset);
2584
- this.negate = negate;
2585
- }
2586
- // set partial to true to test if, for example,
2587
- // "/a/b" matches the start of "/*/b/*/d"
2588
- // Partial means, if you run out of file before you run
2589
- // out of pattern, then that's fine, as long as all
2590
- // the parts match.
2591
- matchOne(file, pattern, partial = false) {
2592
- const options = this.options;
2593
- if (this.isWindows) {
2594
- const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
2595
- const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
2596
- const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
2597
- const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
2598
- const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
2599
- const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
2600
- if (typeof fdi === "number" && typeof pdi === "number") {
2601
- const [fd, pd] = [file[fdi], pattern[pdi]];
2602
- if (fd.toLowerCase() === pd.toLowerCase()) {
2603
- pattern[pdi] = fd;
2604
- if (pdi > fdi) {
2605
- pattern = pattern.slice(pdi);
2606
- } else if (fdi > pdi) {
2607
- file = file.slice(fdi);
2608
- }
2609
- }
2610
- }
2611
- }
2612
- const { optimizationLevel = 1 } = this.options;
2613
- if (optimizationLevel >= 2) {
2614
- file = this.levelTwoFileOptimize(file);
2615
- }
2616
- this.debug("matchOne", this, { file, pattern });
2617
- this.debug("matchOne", file.length, pattern.length);
2618
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
2619
- this.debug("matchOne loop");
2620
- var p2 = pattern[pi];
2621
- var f = file[fi];
2622
- this.debug(pattern, p2, f);
2623
- if (p2 === false) {
2624
- return false;
2625
- }
2626
- if (p2 === GLOBSTAR) {
2627
- this.debug("GLOBSTAR", [pattern, p2, f]);
2628
- var fr = fi;
2629
- var pr = pi + 1;
2630
- if (pr === pl) {
2631
- this.debug("** at the end");
2632
- for (; fi < fl; fi++) {
2633
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
2634
- return false;
2635
- }
2636
- return true;
2637
- }
2638
- while (fr < fl) {
2639
- var swallowee = file[fr];
2640
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
2641
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
2642
- this.debug("globstar found match!", fr, fl, swallowee);
2643
- return true;
2644
- } else {
2645
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
2646
- this.debug("dot detected!", file, fr, pattern, pr);
2647
- break;
2648
- }
2649
- this.debug("globstar swallow a segment, and continue");
2650
- fr++;
2651
- }
2652
- }
2653
- if (partial) {
2654
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
2655
- if (fr === fl) {
2656
- return true;
2657
- }
2658
- }
2659
- return false;
2660
- }
2661
- let hit2;
2662
- if (typeof p2 === "string") {
2663
- hit2 = f === p2;
2664
- this.debug("string match", p2, f, hit2);
2665
- } else {
2666
- hit2 = p2.test(f);
2667
- this.debug("pattern match", p2, f, hit2);
2668
- }
2669
- if (!hit2)
2670
- return false;
2671
- }
2672
- if (fi === fl && pi === pl) {
2673
- return true;
2674
- } else if (fi === fl) {
2675
- return partial;
2676
- } else if (pi === pl) {
2677
- return fi === fl - 1 && file[fi] === "";
2678
- } else {
2679
- throw new Error("wtf?");
2680
- }
2681
- }
2682
- braceExpand() {
2683
- return braceExpand(this.pattern, this.options);
2684
- }
2685
- parse(pattern) {
2686
- assertValidPattern(pattern);
2687
- const options = this.options;
2688
- if (pattern === "**")
2689
- return GLOBSTAR;
2690
- if (pattern === "")
2691
- return "";
2692
- let m;
2693
- let fastTest = null;
2694
- if (m = pattern.match(starRE)) {
2695
- fastTest = options.dot ? starTestDot : starTest;
2696
- } else if (m = pattern.match(starDotExtRE)) {
2697
- fastTest = (options.nocase ? options.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
2698
- } else if (m = pattern.match(qmarksRE)) {
2699
- fastTest = (options.nocase ? options.dot ? qmarksTestNocaseDot : qmarksTestNocase : options.dot ? qmarksTestDot : qmarksTest)(m);
2700
- } else if (m = pattern.match(starDotStarRE)) {
2701
- fastTest = options.dot ? starDotStarTestDot : starDotStarTest;
2702
- } else if (m = pattern.match(dotStarRE)) {
2703
- fastTest = dotStarTest;
2704
- }
2705
- const re = AST.fromGlob(pattern, this.options).toMMPattern();
2706
- if (fastTest && typeof re === "object") {
2707
- Reflect.defineProperty(re, "test", { value: fastTest });
2708
- }
2709
- return re;
2710
- }
2711
- makeRe() {
2712
- if (this.regexp || this.regexp === false)
2713
- return this.regexp;
2714
- const set2 = this.set;
2715
- if (!set2.length) {
2716
- this.regexp = false;
2717
- return this.regexp;
2718
- }
2719
- const options = this.options;
2720
- const twoStar = options.noglobstar ? star$1 : options.dot ? twoStarDot : twoStarNoDot;
2721
- const flags2 = new Set(options.nocase ? ["i"] : []);
2722
- let re = set2.map((pattern) => {
2723
- const pp = pattern.map((p2) => {
2724
- if (p2 instanceof RegExp) {
2725
- for (const f of p2.flags.split(""))
2726
- flags2.add(f);
2727
- }
2728
- return typeof p2 === "string" ? regExpEscape(p2) : p2 === GLOBSTAR ? GLOBSTAR : p2._src;
2729
- });
2730
- pp.forEach((p2, i2) => {
2731
- const next = pp[i2 + 1];
2732
- const prev = pp[i2 - 1];
2733
- if (p2 !== GLOBSTAR || prev === GLOBSTAR) {
2734
- return;
2735
- }
2736
- if (prev === void 0) {
2737
- if (next !== void 0 && next !== GLOBSTAR) {
2738
- pp[i2 + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
2739
- } else {
2740
- pp[i2] = twoStar;
2741
- }
2742
- } else if (next === void 0) {
2743
- pp[i2 - 1] = prev + "(?:\\/|" + twoStar + ")?";
2744
- } else if (next !== GLOBSTAR) {
2745
- pp[i2 - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
2746
- pp[i2 + 1] = GLOBSTAR;
2747
- }
2748
- });
2749
- return pp.filter((p2) => p2 !== GLOBSTAR).join("/");
2750
- }).join("|");
2751
- const [open2, close] = set2.length > 1 ? ["(?:", ")"] : ["", ""];
2752
- re = "^" + open2 + re + close + "$";
2753
- if (this.negate)
2754
- re = "^(?!" + re + ").+$";
2755
- try {
2756
- this.regexp = new RegExp(re, [...flags2].join(""));
2757
- } catch (ex) {
2758
- this.regexp = false;
2759
- }
2760
- return this.regexp;
2761
- }
2762
- slashSplit(p2) {
2763
- if (this.preserveMultipleSlashes) {
2764
- return p2.split("/");
2765
- } else if (this.isWindows && /^\/\/[^\/]+/.test(p2)) {
2766
- return ["", ...p2.split(/\/+/)];
2767
- } else {
2768
- return p2.split(/\/+/);
2769
- }
2770
- }
2771
- match(f, partial = this.partial) {
2772
- this.debug("match", f, this.pattern);
2773
- if (this.comment) {
2774
- return false;
2775
- }
2776
- if (this.empty) {
2777
- return f === "";
2778
- }
2779
- if (f === "/" && partial) {
2780
- return true;
2781
- }
2782
- const options = this.options;
2783
- if (this.isWindows) {
2784
- f = f.split("\\").join("/");
2785
- }
2786
- const ff = this.slashSplit(f);
2787
- this.debug(this.pattern, "split", ff);
2788
- const set2 = this.set;
2789
- this.debug(this.pattern, "set", set2);
2790
- let filename = ff[ff.length - 1];
2791
- if (!filename) {
2792
- for (let i2 = ff.length - 2; !filename && i2 >= 0; i2--) {
2793
- filename = ff[i2];
2794
- }
2795
- }
2796
- for (let i2 = 0; i2 < set2.length; i2++) {
2797
- const pattern = set2[i2];
2798
- let file = ff;
2799
- if (options.matchBase && pattern.length === 1) {
2800
- file = [filename];
2801
- }
2802
- const hit2 = this.matchOne(file, pattern, partial);
2803
- if (hit2) {
2804
- if (options.flipNegate) {
2805
- return true;
2806
- }
2807
- return !this.negate;
2808
- }
2809
- }
2810
- if (options.flipNegate) {
2811
- return false;
2812
- }
2813
- return this.negate;
2814
- }
2815
- static defaults(def) {
2816
- return minimatch.defaults(def).Minimatch;
2817
- }
2818
- }
2819
- minimatch.AST = AST;
2820
- minimatch.Minimatch = Minimatch;
2821
- minimatch.escape = escape$1;
2822
- minimatch.unescape = unescape;
2823
1485
  /*!
2824
1486
  * re2js
2825
1487
  * RE2JS is the JavaScript port of RE2, a regular expression engine that provides linear time matching
@@ -4333,10 +2995,10 @@ const _Regexp = class _Regexp {
4333
2995
  break;
4334
2996
  }
4335
2997
  case _Regexp.Op.ALTERNATE: {
4336
- let sep2 = "";
2998
+ let sep = "";
4337
2999
  for (let sub2 of this.subs) {
4338
- out2 += sep2;
4339
- sep2 = "|";
3000
+ out2 += sep;
3001
+ sep = "|";
4340
3002
  out2 += sub2.appendTo();
4341
3003
  }
4342
3004
  break;
@@ -8032,11 +6694,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
8032
6694
  return false;
8033
6695
  }
8034
6696
  await this.fetchIfNeeded();
8035
- if (_ContextFiltersProvider.excludePatternGetter) {
8036
- if (await this.isExcludedByPatterns(uri)) {
8037
- return "exclude-pattern-match";
8038
- }
8039
- }
8040
6697
  if (this.hasAllowEverythingFilters()) {
8041
6698
  return false;
8042
6699
  }
@@ -8071,22 +6728,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
8071
6728
  }
8072
6729
  return false;
8073
6730
  }
8074
- async isExcludedByPatterns(uri) {
8075
- try {
8076
- const workspaceFolder = _ContextFiltersProvider.excludePatternGetter.getWorkspaceFolder(uri);
8077
- const excludePatternString = await _ContextFiltersProvider.excludePatternGetter.getExcludePattern(workspaceFolder);
8078
- const patterns = this.parseExcludePatternString(excludePatternString);
8079
- const relativePath = workspaceFolder ? uri.fsPath.substring(workspaceFolder.uri.fsPath.length + 1) : uri.fsPath;
8080
- return patterns.some((pattern) => minimatch(relativePath, pattern, { dot: true }));
8081
- } catch (error) {
8082
- logDebug$1("ContextFiltersProvider", "isExcludedByPatterns error", { error });
8083
- return false;
8084
- }
8085
- }
8086
- parseExcludePatternString(patternString) {
8087
- const content = patternString.slice(1, -1);
8088
- return content ? content.split(",") : [];
8089
- }
8090
6731
  reset() {
8091
6732
  this.lastFetchTimestamp = 0;
8092
6733
  this.lastResultLifetime = Promise.resolve(TRANSIENT_REFETCH_INTERVAL_HINT);
@@ -8111,7 +6752,6 @@ const _ContextFiltersProvider = class _ContextFiltersProvider {
8111
6752
  }
8112
6753
  };
8113
6754
  __publicField2(_ContextFiltersProvider, "repoNameResolver");
8114
- __publicField2(_ContextFiltersProvider, "excludePatternGetter");
8115
6755
  let ContextFiltersProvider = _ContextFiltersProvider;
8116
6756
  function matchesContextFilter(parsedFilter, repoName) {
8117
6757
  return Boolean(parsedFilter.repoNamePattern.matcher(repoName).find(0));
@@ -9203,7 +7843,8 @@ function getDefaultSystemPrompt() {
9203
7843
  }
9204
7844
  const SMART_APPLY_PREAMBLE = ps`If your answer contains fenced code blocks in Markdown, include the relevant full file path in the code block tag using this structure: \`\`\`$LANGUAGE:$FILEPATH\`\`\`
9205
7845
  For executable terminal commands: enclose each command in individual "bash" language code block without comments and new lines inside.`;
9206
- const CHAT_PREAMBLE = DEFAULT_PREAMBLE.concat(SMART_APPLY_PREAMBLE);
7846
+ const TERMINAL_TOOL_PREAMBLE = ps`\n\nCheck if you have access to terminal/shell tools. If so, use it to execute commands to gather information. The terminal output is included in your context. You can reference and analyze this output in your response.`;
7847
+ const CHAT_PREAMBLE = DEFAULT_PREAMBLE.concat(SMART_APPLY_PREAMBLE).concat(TERMINAL_TOOL_PREAMBLE);
9207
7848
  function getSimplePreamble(model2, apiVersion, type, preInstruction) {
9208
7849
  const preamble = type === "Chat" ? CHAT_PREAMBLE : DEFAULT_PREAMBLE;
9209
7850
  const intro = ps`${preamble}\n\n${preInstruction ?? ""}`.trim();
@@ -9520,7 +8161,7 @@ async function getTokenCounterUtils() {
9520
8161
  const browser2 = detect();
9521
8162
  if (browser2 && browser2.name === "safari") {
9522
8163
  _tokenCounterUtilsPromise = import("./cl100k_base-B4kyDDRQ.mjs").then(async (tokenizer2) => {
9523
- const tiktoken = await import("./lite-DzRgIRBr.mjs");
8164
+ const tiktoken = await import("./lite-BSVmXTp4.mjs");
9524
8165
  return createTokenCounterUtils(new tiktoken.Tiktoken(tokenizer2.default));
9525
8166
  });
9526
8167
  } else {
@@ -16124,7 +14765,7 @@ function observeProviderCall(providerClients, fn, { emitPartial, errorHook, logg
16124
14765
  console.error(error);
16125
14766
  }
16126
14767
  return Observable.of(null);
16127
- })).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) => {
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) => {
16128
14769
  }));
16129
14770
  }
16130
14771
  function observeMeta(providerClients, params, opts) {
@@ -19377,16 +18018,16 @@ function resolveProviderUrisInConfig(config, scope) {
19377
18018
  return void 0;
19378
18019
  }
19379
18020
  return Object.fromEntries(Object.entries(providers).map(([providerUri, settings]) => {
19380
- const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path$1.sep}`) || providerUri.startsWith(`.${path$1.sep}`);
18021
+ const isRelativeFilePath = providerUri.startsWith("../") || providerUri.startsWith("./") || providerUri.startsWith(`..${path.sep}`) || providerUri.startsWith(`.${path.sep}`);
19381
18022
  if (isRelativeFilePath) {
19382
- providerUri = fromUri.with({ path: path$1.resolve(fromUri.path, providerUri) }).toString();
18023
+ providerUri = fromUri.with({ path: path.resolve(fromUri.path, providerUri) }).toString();
19383
18024
  }
19384
18025
  return [providerUri, settings];
19385
18026
  }));
19386
18027
  }
19387
18028
  const scopeUri = scope && ("uri" in scope ? scope.uri : "fsPath" in scope ? scope : scope.uri);
19388
18029
  const workspaceFile = (_a3 = workspace.workspaceFile) == null ? void 0 : _a3.with({
19389
- path: path$1.dirname(workspace.workspaceFile.path)
18030
+ path: path.dirname(workspace.workspaceFile.path)
19390
18031
  });
19391
18032
  const workspaceFolder = scopeUri ? workspace.getWorkspaceFolder(scopeUri) : void 0;
19392
18033
  const workspaceFolderSettingsFileUri = workspaceFolder ? workspaceFolder.uri.with({ path: workspaceFolder.uri.path + "/.vscode" }) : void 0;
@@ -21403,9 +20044,9 @@ function requireBuffer() {
21403
20044
  Object.setPrototypeOf(newBuf, Buffer2.prototype);
21404
20045
  return newBuf;
21405
20046
  };
21406
- function checkOffset(offset2, ext2, length) {
20047
+ function checkOffset(offset2, ext, length) {
21407
20048
  if (offset2 % 1 !== 0 || offset2 < 0) throw new RangeError("offset is not uint");
21408
- if (offset2 + ext2 > length) throw new RangeError("Trying to access beyond buffer length");
20049
+ if (offset2 + ext > length) throw new RangeError("Trying to access beyond buffer length");
21409
20050
  }
21410
20051
  Buffer2.prototype.readUintLE = Buffer2.prototype.readUIntLE = function readUIntLE(offset2, byteLength3, noAssert) {
21411
20052
  offset2 = offset2 >>> 0;
@@ -21580,10 +20221,10 @@ function requireBuffer() {
21580
20221
  if (!noAssert) checkOffset(offset2, 8, this.length);
21581
20222
  return ieee7542.read(this, offset2, false, 52, 8);
21582
20223
  };
21583
- function checkInt(buf, value, offset2, ext2, max, min) {
20224
+ function checkInt(buf, value, offset2, ext, max, min) {
21584
20225
  if (!Buffer2.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
21585
20226
  if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
21586
- if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
20227
+ if (offset2 + ext > buf.length) throw new RangeError("Index out of range");
21587
20228
  }
21588
20229
  Buffer2.prototype.writeUintLE = Buffer2.prototype.writeUIntLE = function writeUIntLE(value, offset2, byteLength3, noAssert) {
21589
20230
  value = +value;
@@ -21795,8 +20436,8 @@ function requireBuffer() {
21795
20436
  Buffer2.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset2 = 0) {
21796
20437
  return wrtBigUInt64BE(this, value, offset2, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
21797
20438
  });
21798
- function checkIEEE754(buf, value, offset2, ext2, max, min) {
21799
- if (offset2 + ext2 > buf.length) throw new RangeError("Index out of range");
20439
+ function checkIEEE754(buf, value, offset2, ext, max, min) {
20440
+ if (offset2 + ext > buf.length) throw new RangeError("Index out of range");
21800
20441
  if (offset2 < 0) throw new RangeError("Index out of range");
21801
20442
  }
21802
20443
  function writeFloat(buf, value, offset2, littleEndian, noAssert) {
@@ -26628,120 +25269,6 @@ async function showCodyIgnoreNotification(feature2, isIgnored) {
26628
25269
  const prefix = feature2 === "autocomplete" ? "Failed to generate autocomplete" : feature2 === "edit" ? "Edit failed to run" : feature2 === "test" ? "Failed to generate test" : "Command failed to run";
26629
25270
  window$1.showErrorMessage(`${prefix}: ${ignoreReason(isIgnored)}`);
26630
25271
  }
26631
- const excludeCache = /* @__PURE__ */ new Map();
26632
- const fileWatchers = /* @__PURE__ */ new Map();
26633
- function getCacheKey(workspaceFolder) {
26634
- return (workspaceFolder == null ? void 0 : workspaceFolder.uri.toString()) ?? "no-workspace";
26635
- }
26636
- async function initializeCache(workspaceFolder) {
26637
- const cacheKey = getCacheKey(workspaceFolder);
26638
- if (excludeCache.has(cacheKey)) {
26639
- return;
26640
- }
26641
- const useIgnoreFiles = workspace.getConfiguration("", workspaceFolder).get("search.useIgnoreFiles");
26642
- let gitignoreExclude = {};
26643
- let ignoreExclude = {};
26644
- let sgignoreExclude = {};
26645
- if (useIgnoreFiles && workspaceFolder) {
26646
- gitignoreExclude = await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".gitignore"));
26647
- ignoreExclude = await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".ignore"));
26648
- sgignoreExclude = await readIgnoreFile(
26649
- Uri.joinPath(workspaceFolder.uri, ".sourcegraph", ".ignore")
26650
- );
26651
- setupFileWatcher(workspaceFolder, ".gitignore");
26652
- setupFileWatcher(workspaceFolder, ".ignore");
26653
- setupFileWatcher(workspaceFolder, ".sourcegraph/.ignore");
26654
- }
26655
- excludeCache.set(cacheKey, { gitignoreExclude, ignoreExclude, sgignoreExclude });
26656
- }
26657
- function setupFileWatcher(workspaceFolder, filename) {
26658
- const watcherKey = `${workspaceFolder.uri.toString()}:${filename}`;
26659
- if (fileWatchers.has(watcherKey)) {
26660
- return;
26661
- }
26662
- const pattern = new RelativePattern(workspaceFolder, filename);
26663
- const watcher = workspace.createFileSystemWatcher(pattern);
26664
- const updateCache = async () => {
26665
- const cacheKey = getCacheKey(workspaceFolder);
26666
- const cached2 = excludeCache.get(cacheKey);
26667
- if (!cached2) return;
26668
- const fileUri = Uri.joinPath(workspaceFolder.uri, filename);
26669
- const ignoreData = await readIgnoreFile(fileUri);
26670
- if (filename === ".gitignore") {
26671
- cached2.gitignoreExclude = ignoreData;
26672
- } else if (filename === ".ignore") {
26673
- cached2.ignoreExclude = ignoreData;
26674
- } else if (filename === ".sourcegraph/.ignore") {
26675
- cached2.sgignoreExclude = ignoreData;
26676
- }
26677
- };
26678
- watcher.onDidChange(updateCache);
26679
- watcher.onDidCreate(updateCache);
26680
- watcher.onDidDelete(() => {
26681
- const cacheKey = getCacheKey(workspaceFolder);
26682
- const cached2 = excludeCache.get(cacheKey);
26683
- if (!cached2) return;
26684
- if (filename === ".gitignore") {
26685
- cached2.gitignoreExclude = {};
26686
- } else if (filename === ".ignore") {
26687
- cached2.ignoreExclude = {};
26688
- } else if (filename === ".sourcegraph/.ignore") {
26689
- cached2.sgignoreExclude = {};
26690
- }
26691
- });
26692
- fileWatchers.set(watcherKey, watcher);
26693
- }
26694
- async function getExcludePattern(workspaceFolder) {
26695
- await initializeCache(workspaceFolder);
26696
- const config = workspace.getConfiguration("", workspaceFolder);
26697
- const filesExclude = config.get("files.exclude", {});
26698
- const searchExclude = config.get("search.exclude", {});
26699
- const cacheKey = getCacheKey(workspaceFolder);
26700
- const cached2 = excludeCache.get(cacheKey);
26701
- const gitignoreExclude = (cached2 == null ? void 0 : cached2.gitignoreExclude) ?? {};
26702
- const ignoreExclude = (cached2 == null ? void 0 : cached2.ignoreExclude) ?? {};
26703
- const sgignoreExclude = (cached2 == null ? void 0 : cached2.sgignoreExclude) ?? {};
26704
- const mergedExclude = {
26705
- ...filesExclude,
26706
- ...searchExclude,
26707
- ...gitignoreExclude,
26708
- ...ignoreExclude,
26709
- ...sgignoreExclude
26710
- };
26711
- const excludePatterns = Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
26712
- return `{${excludePatterns.join(",")}}`;
26713
- }
26714
- async function readIgnoreFile(uri) {
26715
- const ignore = {};
26716
- try {
26717
- const data = await workspace.fs.readFile(uri);
26718
- for (let line of Buffer.from(data).toString("utf-8").split("\n")) {
26719
- if (line.startsWith("!")) {
26720
- continue;
26721
- }
26722
- line = line.replace(/\s*(#.*)?$/, "");
26723
- if (line === "") {
26724
- continue;
26725
- }
26726
- if (line.endsWith("/")) {
26727
- line = line.slice(0, -1);
26728
- }
26729
- if (!line.startsWith("/") && !line.startsWith("**/")) {
26730
- line = `**/${line}`;
26731
- }
26732
- ignore[line] = true;
26733
- }
26734
- } catch {
26735
- }
26736
- return ignore;
26737
- }
26738
- function disposeFileWatchers() {
26739
- for (const watcher of fileWatchers.values()) {
26740
- watcher.dispose();
26741
- }
26742
- fileWatchers.clear();
26743
- excludeCache.clear();
26744
- }
26745
25272
  async function isUriIgnoredByContextFilterWithNotification(uri, feature2) {
26746
25273
  const isIgnored = await contextFiltersProvider.isUriIgnored(uri);
26747
25274
  if (isIgnored) {
@@ -26749,15 +25276,6 @@ async function isUriIgnoredByContextFilterWithNotification(uri, feature2) {
26749
25276
  }
26750
25277
  return isIgnored;
26751
25278
  }
26752
- function initializeContextFiltersProvider() {
26753
- ContextFiltersProvider.excludePatternGetter = {
26754
- getExcludePattern,
26755
- getWorkspaceFolder: (uri) => workspace.getWorkspaceFolder(uri) ?? null
26756
- };
26757
- return {
26758
- dispose: disposeFileWatchers
26759
- };
26760
- }
26761
25279
  const executeChat = async (args2) => {
26762
25280
  const clientConfig = await ClientConfigSingleton.getInstance().getConfig();
26763
25281
  const isCommand = Boolean(args2.command);
@@ -29089,14 +27607,14 @@ var treeSitter = { exports: {} };
29089
27607
  }
29090
27608
  return this._namedChildren;
29091
27609
  }
29092
- descendantsOfType(types2, startPosition, endPosition) {
29093
- if (!Array.isArray(types2)) types2 = [types2];
27610
+ descendantsOfType(types, startPosition, endPosition) {
27611
+ if (!Array.isArray(types)) types = [types];
29094
27612
  if (!startPosition) startPosition = ZERO_POINT;
29095
27613
  if (!endPosition) endPosition = ZERO_POINT;
29096
27614
  const symbols = [];
29097
27615
  const typesBySymbol = this.tree.language.types;
29098
27616
  for (let i2 = 0, n = typesBySymbol.length; i2 < n; i2++) {
29099
- if (types2.includes(typesBySymbol[i2])) {
27617
+ if (types.includes(typesBySymbol[i2])) {
29100
27618
  symbols.push(i2);
29101
27619
  }
29102
27620
  }
@@ -34612,7 +33130,7 @@ async function createParser$1(settings) {
34612
33130
  if (cachedParser) {
34613
33131
  return cachedParser;
34614
33132
  }
34615
- const wasmPath = path$1.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
33133
+ const wasmPath = path.resolve(grammarDirectory, DOCUMENT_LANGUAGE_TO_GRAMMAR[language]);
34616
33134
  if (!await isRegularFile(Uri.file(wasmPath))) {
34617
33135
  return void 0;
34618
33136
  }
@@ -36838,10 +35356,10 @@ function getSearchPatternForTestFiles(file, currentDirectoryOnly, fileNameMatche
36838
35356
  return root2 + osSep + testPattern;
36839
35357
  }
36840
35358
  function isValidTestFile(uri) {
36841
- const ext2 = uriExtname(uri);
36842
- const fileNameWithoutExt = uriBasename(uri, ext2);
35359
+ const ext = uriExtname(uri);
35360
+ const fileNameWithoutExt = uriBasename(uri, ext);
36843
35361
  const prefixTest = /\.(?:py|rb)$/;
36844
- if (prefixTest.test(ext2)) {
35362
+ if (prefixTest.test(ext)) {
36845
35363
  if (fileNameWithoutExt.startsWith("test_")) {
36846
35364
  return true;
36847
35365
  }
@@ -37845,7 +36363,7 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
37845
36363
  if (!isFileProvided) {
37846
36364
  return fallbackUri;
37847
36365
  }
37848
- const rootDir = Uri.parse(path$1.join(...uri.split(separatorsRegex).slice(0, 2)));
36366
+ const rootDir = Uri.parse(path.join(...uri.split(separatorsRegex).slice(0, 2)));
37849
36367
  const hasExistingRoot = await doesFileExist(rootDir);
37850
36368
  if (hasExistingRoot) {
37851
36369
  return Uri.file(uri);
@@ -37853,6 +36371,11 @@ async function resolveRelativeOrAbsoluteUri(baseDirUri, uri, fallbackUri) {
37853
36371
  if (!baseDirUri) {
37854
36372
  return fallbackUri;
37855
36373
  }
36374
+ const filepath = path.join(baseDirUri.path, uri);
36375
+ const hasExistingFile = await doesFileExist(Uri.file(filepath));
36376
+ if (hasExistingFile) {
36377
+ return Uri.file(filepath);
36378
+ }
37856
36379
  return smartJoinPath(baseDirUri, uri);
37857
36380
  }
37858
36381
  function smartJoinPath(baseDirUri, relativeFileUri) {
@@ -37861,7 +36384,7 @@ function smartJoinPath(baseDirUri, relativeFileUri) {
37861
36384
  const commonPartLength = filePath.findIndex((segment) => segment === workspacePath.at(-1)) + 1;
37862
36385
  const hasCommonPart = commonPartLength > 0 && isEqual(workspacePath.slice(-commonPartLength), filePath.slice(0, commonPartLength));
37863
36386
  const uniqueFilePath = hasCommonPart ? filePath.slice(commonPartLength) : filePath;
37864
- const resultPath = path$1.join(baseDirUri.path, ...uniqueFilePath);
36387
+ const resultPath = path.join(baseDirUri.path, ...uniqueFilePath);
37865
36388
  return Uri.file(resultPath);
37866
36389
  }
37867
36390
  const defaultLastStoredCode = {
@@ -38102,7 +36625,6 @@ const SPECIAL_DOCUMENT_CHANGE_TYPES = [
38102
36625
  "unexpected"
38103
36626
  // should not be logged because all the change sizes are covered by the keys above
38104
36627
  ];
38105
- window$1.activeTextEditor;
38106
36628
  const DOCUMENT_CHANGE_TYPES = [
38107
36629
  ...SPECIAL_DOCUMENT_CHANGE_TYPES,
38108
36630
  ...changeBoundariesKeys,
@@ -38114,11 +36636,12 @@ const DEFAULT_COUNTERS = DOCUMENT_CHANGE_TYPES.reduce((acc, changeType) => {
38114
36636
  acc[changeType] = 0;
38115
36637
  return acc;
38116
36638
  }, {});
38117
- class CharactersLogger {
36639
+ const _CharactersLogger = class _CharactersLogger {
38118
36640
  constructor(workspace$1 = workspace, window2 = window$1) {
38119
36641
  __publicField2(this, "disposables", []);
38120
36642
  __publicField2(this, "changeCounters", { ...DEFAULT_COUNTERS });
38121
36643
  __publicField2(this, "nextTimeoutId", null);
36644
+ __publicField2(this, "isDisposed", false);
38122
36645
  __publicField2(this, "windowFocused", true);
38123
36646
  __publicField2(this, "activeTextEditor");
38124
36647
  __publicField2(this, "lastChangeTimestamp", 0);
@@ -38150,15 +36673,22 @@ class CharactersLogger {
38150
36673
  }
38151
36674
  flush() {
38152
36675
  try {
38153
- this.nextTimeoutId = null;
38154
- telemetryRecorder.recordEvent("cody.characters", "flush", {
38155
- metadata: { ...this.changeCounters }
38156
- });
36676
+ if (this.nextTimeoutId) {
36677
+ clearTimeout(this.nextTimeoutId);
36678
+ this.nextTimeoutId = null;
36679
+ }
36680
+ if (!this.isDisposed) {
36681
+ telemetryRecorder.recordEvent("cody.characters", "flush", {
36682
+ metadata: { ...this.changeCounters }
36683
+ });
36684
+ }
38157
36685
  } catch (error) {
38158
36686
  outputChannelLogger.logError("CharactersLogger", "Failed to record telemetry event:", error);
38159
36687
  } finally {
38160
36688
  this.changeCounters = { ...DEFAULT_COUNTERS };
38161
- this.nextTimeoutId = setTimeout(() => this.flush(), LOG_INTERVAL$1);
36689
+ if (!this.isDisposed) {
36690
+ this.nextTimeoutId = setTimeout(() => this.flush(), LOG_INTERVAL$1);
36691
+ }
38162
36692
  }
38163
36693
  }
38164
36694
  async onDidChangeTextDocument(event2) {
@@ -38287,17 +36817,34 @@ class CharactersLogger {
38287
36817
  ]);
38288
36818
  return splitSafeMetadata(rawMetadata).metadata;
38289
36819
  }
36820
+ static getInstance() {
36821
+ var _a3;
36822
+ if (!_CharactersLogger.instance || _CharactersLogger.instance.isDisposed) {
36823
+ if ((_a3 = _CharactersLogger.instance) == null ? void 0 : _a3.isDisposed) {
36824
+ _CharactersLogger.instance = null;
36825
+ }
36826
+ _CharactersLogger.instance = new _CharactersLogger();
36827
+ }
36828
+ return _CharactersLogger.instance;
36829
+ }
38290
36830
  dispose() {
38291
- this.flush();
36831
+ this.isDisposed = true;
38292
36832
  if (this.nextTimeoutId) {
38293
36833
  clearTimeout(this.nextTimeoutId);
36834
+ this.nextTimeoutId = null;
38294
36835
  }
36836
+ this.flush();
38295
36837
  for (const disposable of this.disposables) {
38296
36838
  disposable.dispose();
38297
36839
  }
36840
+ if (_CharactersLogger.instance === this) {
36841
+ _CharactersLogger.instance = null;
36842
+ }
38298
36843
  }
38299
- }
38300
- const charactersLogger = new CharactersLogger();
36844
+ };
36845
+ __publicField2(_CharactersLogger, "instance", null);
36846
+ let CharactersLogger = _CharactersLogger;
36847
+ const charactersLogger = CharactersLogger.getInstance();
38301
36848
  var define_process_default$d = { env: {} };
38302
36849
  const PING_INTERVAL_MS = 10 * 60 * 1e3;
38303
36850
  const INITIAL_PING_DELAY_MS = 10 * 1e3;
@@ -39419,9 +37966,9 @@ const ruleFileInteractiveChanges = defer$2(
39419
37966
  merge$2(
39420
37967
  fromVSCodeEvent(workspace.onDidCreateFiles),
39421
37968
  fromVSCodeEvent(workspace.onDidDeleteFiles)
39422
- ).pipe(filter$2((e) => e.files.some(isRuleFile))),
37969
+ ).pipe(filter$1((e) => e.files.some(isRuleFile))),
39423
37970
  fromVSCodeEvent(workspace.onDidChangeTextDocument).pipe(
39424
- filter$2((e) => isRuleFile(e.document.uri))
37971
+ filter$1((e) => isRuleFile(e.document.uri))
39425
37972
  )
39426
37973
  ).pipe(debounceTime(1e3))
39427
37974
  );
@@ -39726,11 +38273,7 @@ const getModelOptionItems = (modelOptions, isCodyPro, isEnterpriseUser2) => {
39726
38273
  };
39727
38274
  }).filter(isDefined);
39728
38275
  if (!isCodyPro && !isEnterpriseUser2) {
39729
- return [
39730
- ...allOptions.filter((option2) => !option2.codyProOnly),
39731
- { label: "upgrade to cody pro", kind: QuickPickItemKind.Separator },
39732
- ...allOptions.filter((option2) => option2.codyProOnly)
39733
- ];
38276
+ return allOptions.filter((option2) => !option2.codyProOnly);
39734
38277
  }
39735
38278
  return allOptions;
39736
38279
  };
@@ -40483,6 +39026,46 @@ async function findWorkspaceFiles(cancellationToken) {
40483
39026
  )
40484
39027
  )).flat();
40485
39028
  }
39029
+ async function getExcludePattern(workspaceFolder) {
39030
+ const config = workspace.getConfiguration("", workspaceFolder);
39031
+ const filesExclude = config.get("files.exclude", {});
39032
+ const searchExclude = config.get("search.exclude", {});
39033
+ const useIgnoreFiles = config.get("search.useIgnoreFiles");
39034
+ const gitignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".gitignore")) : {};
39035
+ const ignoreExclude = useIgnoreFiles && workspaceFolder ? await readIgnoreFile(Uri.joinPath(workspaceFolder.uri, ".ignore")) : {};
39036
+ const mergedExclude = {
39037
+ ...filesExclude,
39038
+ ...searchExclude,
39039
+ ...gitignoreExclude,
39040
+ ...ignoreExclude
39041
+ };
39042
+ const excludePatterns = Object.keys(mergedExclude).filter((key2) => mergedExclude[key2] === true);
39043
+ return `{${excludePatterns.join(",")}}`;
39044
+ }
39045
+ async function readIgnoreFile(uri) {
39046
+ const ignore = {};
39047
+ try {
39048
+ const data = await workspace.fs.readFile(uri);
39049
+ for (let line of Buffer.from(data).toString("utf-8").split("\n")) {
39050
+ if (line.startsWith("!")) {
39051
+ continue;
39052
+ }
39053
+ line = line.replace(/\s*(#.*)?$/, "");
39054
+ if (line === "") {
39055
+ continue;
39056
+ }
39057
+ if (line.endsWith("/")) {
39058
+ line = line.slice(0, -1);
39059
+ }
39060
+ if (!line.startsWith("/") && !line.startsWith("**/")) {
39061
+ line = `**/${line}`;
39062
+ }
39063
+ ignore[line] = true;
39064
+ }
39065
+ } catch {
39066
+ }
39067
+ return ignore;
39068
+ }
40486
39069
  const lowScoringPathSegments = ["bin"];
40487
39070
  const throttledFindFiles = throttle$1(() => findWorkspaceFiles(), 1e4);
40488
39071
  async function getFileContextFiles(options) {
@@ -41587,18 +40170,7 @@ class EditInputFlow {
41587
40170
  );
41588
40171
  }
41589
40172
  if (item.codyProOnly && !this.isCodyPro && !this.isEnterpriseUser) {
41590
- const option2 = await window$1.showInformationMessage(
41591
- "Upgrade to Cody Pro",
41592
- {
41593
- modal: true,
41594
- detail: `Upgrade to Cody Pro to use ${item.modelTitle} for Edit`
41595
- },
41596
- "Upgrade",
41597
- "See Plans"
41598
- );
41599
- if (option2) {
41600
- void env.openExternal(Uri.parse(ACCOUNT_UPGRADE_URL.toString()));
41601
- }
40173
+ return { requiresUpgrade: true, modelTitle: item.modelTitle };
41602
40174
  }
41603
40175
  try {
41604
40176
  await modelsService.setSelectedModel(ModelUsage.Edit, item.model);
@@ -42109,27 +40681,11 @@ function getErrorLens(codeLensRange, task) {
42109
40681
  command: "cody.chat.signIn"
42110
40682
  };
42111
40683
  } else if (isRateLimitError(task.error)) {
42112
- if (task.error.upgradeIsAvailable) {
42113
- lens.command = {
42114
- title: "⚡️ Upgrade to Cody Pro",
42115
- command: "cody.show-rate-limit-modal",
42116
- arguments: [
42117
- task.error.userMessage,
42118
- task.error.retryMessage,
42119
- task.error.upgradeIsAvailable
42120
- ]
42121
- };
42122
- } else {
42123
- lens.command = {
42124
- title: "$(warning) Rate Limit Exceeded",
42125
- command: "cody.show-rate-limit-modal",
42126
- arguments: [
42127
- task.error.userMessage,
42128
- task.error.retryMessage,
42129
- task.error.upgradeIsAvailable
42130
- ]
42131
- };
42132
- }
40684
+ lens.command = {
40685
+ title: "$(warning) Rate Limit Exceeded",
40686
+ command: "cody.show-rate-limit-modal",
40687
+ arguments: [task.error.userMessage, task.error.retryMessage]
40688
+ };
42133
40689
  } else {
42134
40690
  lens.command = {
42135
40691
  title: "$(warning) Applying Edits Failed",
@@ -43371,7 +41927,7 @@ function getMapping() {
43371
41927
  return mapping;
43372
41928
  }
43373
41929
  function getLanguageForFileName(filePath) {
43374
- const fileName = path$1.basename(filePath);
41930
+ const fileName = path.basename(filePath);
43375
41931
  const extension = fileName.split(".").pop() || fileName;
43376
41932
  const language = getMapping().get(extension);
43377
41933
  return language || extension;
@@ -43465,7 +42021,12 @@ class AgentTextDocument {
43465
42021
  return new AgentTextDocument(ProtocolTextDocumentWithUri.from(uri, { ...document2, content }));
43466
42022
  }
43467
42023
  save() {
43468
- throw new Error("Method not implemented.");
42024
+ const workspaceEditor = new AgentWorkspaceEdit();
42025
+ workspaceEditor.createFile(this.uri.with({ scheme: "file" }), {
42026
+ ignoreIfExists: false,
42027
+ contents: new TextEncoder().encode(this.content)
42028
+ });
42029
+ return workspace.applyEdit(workspaceEditor);
43469
42030
  }
43470
42031
  // updates the content of an AgentTextDocument so that all references to this instance held throughout
43471
42032
  // agent see a consistent view on a text document, rather than different instances of this class per
@@ -44378,13 +42939,13 @@ function vscodeEnableCommandUrisToAgentEnableOnlyCommandUris(enableCommandUris)
44378
42939
  return Array.isArray(enableCommandUris) ? enableCommandUris : !enableCommandUris ? [] : null;
44379
42940
  }
44380
42941
  class NativeWebview {
44381
- constructor(delegate, handle2, _options2) {
42942
+ constructor(delegate, handle2, _options) {
44382
42943
  __publicField2(this, "didReceiveMessageEmitter", new AgentEventEmitter());
44383
42944
  __publicField2(this, "onDidReceiveMessage", this.didReceiveMessageEmitter.event);
44384
42945
  __publicField2(this, "_html", "");
44385
42946
  this.delegate = delegate;
44386
42947
  this.handle = handle2;
44387
- this._options = _options2;
42948
+ this._options = _options;
44388
42949
  }
44389
42950
  get html() {
44390
42951
  return this._html;
@@ -45603,7 +44164,7 @@ class LocalStorageDB {
45603
44164
  constructor(ide, dir) {
45604
44165
  __publicField2(this, "storage");
45605
44166
  const quota = 1024 * 1024 * 256;
45606
- this.storage = new LocalStorage_2(path$1.join(dir, `${ide}-globalState`), quota);
44167
+ this.storage = new LocalStorage_2(path.join(dir, `${ide}-globalState`), quota);
45607
44168
  }
45608
44169
  clear() {
45609
44170
  this.storage.clear();
@@ -45767,8 +44328,8 @@ var define_process_default$8 = { env: {} };
45767
44328
  function copyExtensionRelativeResources(extensionPath, extensionClient) {
45768
44329
  var _a3, _b2, _c2;
45769
44330
  const copySources = (relativeSource) => {
45770
- const source = path$1.join("/tmp/__dirname", relativeSource);
45771
- const target = path$1.join(extensionPath, "dist", relativeSource);
44331
+ const source = path.join("/tmp/__dirname", relativeSource);
44332
+ const target = path.join(extensionPath, "dist", relativeSource);
45772
44333
  try {
45773
44334
  const stat2 = statSync(source);
45774
44335
  if (!(stat2.isFile() || stat2.isDirectory())) {
@@ -45779,7 +44340,7 @@ function copyExtensionRelativeResources(extensionPath, extensionClient) {
45779
44340
  return;
45780
44341
  }
45781
44342
  try {
45782
- mkdirSync(path$1.dirname(target), { recursive: true });
44343
+ mkdirSync(path.dirname(target), { recursive: true });
45783
44344
  copySync(source, target);
45784
44345
  } catch (err2) {
45785
44346
  logDebug$1("copyExtensionRelativeResources", `Failed to copy ${source} to dist ${target}`, err2);
@@ -45897,21 +44458,6 @@ class Agent extends MessageHandler {
45897
44458
  __publicField2(this, "globalState", null);
45898
44459
  // ExtensionClient callbacks.
45899
44460
  __publicField2(this, "fixups");
45900
- __publicField2(this, "openNewDocument", async (_2, uri) => {
45901
- var _a3, _b2;
45902
- if (uri.scheme !== "untitled") {
45903
- return workspace.openTextDocument(uri);
45904
- }
45905
- if (((_b2 = (_a3 = this.clientInfo) == null ? void 0 : _a3.capabilities) == null ? void 0 : _b2.untitledDocuments) !== "enabled") {
45906
- const errorMessage = 'Client does not support untitled documents. To fix this problem, set `untitledDocuments: "enabled"` in client capabilities';
45907
- logError$2("Agent", "unsupported operation", errorMessage);
45908
- throw new Error(errorMessage);
45909
- }
45910
- const result = await this.request("textDocument/openUntitledDocument", {
45911
- uri: uri.toString()
45912
- });
45913
- return result ? workspace.openTextDocument(result.uri) : void 0;
45914
- });
45915
44461
  this.params = params;
45916
44462
  setAgent(this);
45917
44463
  this.registerRequest("initialize", async (clientInfo) => {
@@ -48198,7 +46744,7 @@ class CommandsProvider {
48198
46744
  if (!isFileURI(uri)) {
48199
46745
  throw new Error("history only supported on local file paths");
48200
46746
  }
48201
- const { getContextFileFromGitLog } = await import("./git-log-BcgEVtba.mjs");
46747
+ const { getContextFileFromGitLog } = await import("./git-log-CDcgkz10.mjs");
48202
46748
  return getContextFileFromGitLog(uri, options);
48203
46749
  }
48204
46750
  dispose() {
@@ -48211,7 +46757,6 @@ class CommandsProvider {
48211
46757
  function defaultVSCodeExtensionClient() {
48212
46758
  return {
48213
46759
  createFixupControlApplicator: (files) => new FixupCodeLenses(files),
48214
- openNewDocument: (workspace2, uri) => workspace2.openTextDocument(uri),
48215
46760
  clientName: "vscode",
48216
46761
  clientVersion: version,
48217
46762
  capabilities: void 0
@@ -48316,7 +46861,7 @@ class ExtensionApi {
48316
46861
  this.extensionMode = extensionMode;
48317
46862
  }
48318
46863
  }
48319
- const uninstallMarker = path$1.join(codyPaths().config, "uninstall-marker");
46864
+ const uninstallMarker = path.join(codyPaths().config, "uninstall-marker");
48320
46865
  let isReinstall = void 0;
48321
46866
  const isReinstalling = async () => {
48322
46867
  if (typeof isReinstall === "boolean") {
@@ -154973,31 +153518,8 @@ class AutoEditBetaOnboarding {
154973
153518
  await this.enrollUserToAutoEditBeta();
154974
153519
  }
154975
153520
  }
154976
- async suggestToEnrollUserToAutoEditBetaIfEligible() {
154977
- const isUserEligibleForAutoeditBeta = await this.isUserEligibleForAutoeditBetaOverride();
154978
- if (isUserEligibleForAutoeditBeta) {
154979
- window$1.showInformationMessage(
154980
- "Auto-edits are now available",
154981
- {
154982
- detail: "<html>An advanced mode for completions is now available. This is configured via <b>cody_settings.json</b>, give it a try now.</html>"
154983
- },
154984
- "Configure auto-edits",
154985
- "Open cody__settings.json"
154986
- ).then((answer) => {
154987
- if (answer === "Configure auto-edits") {
154988
- workspace.getConfiguration().update(
154989
- "cody.suggestions.mode",
154990
- CodyAutoSuggestionMode.Autoedit,
154991
- ConfigurationTarget.Global
154992
- );
154993
- } else if (answer === "Open cody__settings.json") {
154994
- commands$1.executeCommand("cody.settings.extension");
154995
- }
154996
- });
154997
- }
154998
- }
154999
153521
  async enrollUserToAutoEditBeta() {
155000
- const switchToAutocompleteText = "Switch to autocomplete";
153522
+ const switchToAutocompleteText = "Switch back to autocomplete";
155001
153523
  await workspace.getConfiguration().update(
155002
153524
  "cody.suggestions.mode",
155003
153525
  CodyAutoSuggestionMode.Autoedit,
@@ -162260,7 +160782,7 @@ let canvasKitInitPromise = null;
162260
160782
  let canvasKit = null;
162261
160783
  let fontCache = null;
162262
160784
  async function initFont() {
162263
- const fontPath = path$1.join("/tmp/__dirname", "DejaVuSansMono.ttf");
160785
+ const fontPath = path.join("/tmp/__dirname", "DejaVuSansMono.ttf");
162264
160786
  const buffer2 = await fs.readFile(fontPath);
162265
160787
  return new Uint8Array(buffer2).buffer;
162266
160788
  }
@@ -163042,13 +161564,13 @@ var CachedFn = class {
163042
161564
  }
163043
161565
  };
163044
161566
  var Theme = class {
163045
- constructor(_colorMap, _defaults, _root2) {
161567
+ constructor(_colorMap, _defaults, _root) {
163046
161568
  __publicField2(this, "_cachedMatchRoot", new CachedFn(
163047
161569
  (scopeName) => this._root.match(scopeName)
163048
161570
  ));
163049
161571
  this._colorMap = _colorMap;
163050
161572
  this._defaults = _defaults;
163051
- this._root = _root2;
161573
+ this._root = _root;
163052
161574
  }
163053
161575
  static createFromRawTheme(source, colorMap) {
163054
161576
  return this.createFromParsedTheme(parseTheme(source), colorMap);
@@ -163297,13 +161819,13 @@ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
163297
161819
  }
163298
161820
  }
163299
161821
  let colorMap = new ColorMap(_colorMap);
163300
- let defaults2 = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
161822
+ let defaults = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
163301
161823
  let root2 = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
163302
161824
  for (let i2 = 0, len2 = parsedThemeRules.length; i2 < len2; i2++) {
163303
161825
  let rule = parsedThemeRules[i2];
163304
161826
  root2.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
163305
161827
  }
163306
- return new Theme(colorMap, defaults2, root2);
161828
+ return new Theme(colorMap, defaults, root2);
163307
161829
  }
163308
161830
  var ColorMap = class {
163309
161831
  constructor(_colorMap) {
@@ -168001,8 +166523,8 @@ function mergeToken(merged, variantsOrder, cssVariablePrefix, defaultColor) {
168001
166523
  function codeToHast(internal, code18, options, transformerContext = {
168002
166524
  meta: {},
168003
166525
  options,
168004
- codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
168005
- codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
166526
+ codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
166527
+ codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
168006
166528
  }) {
168007
166529
  var _a3, _b2;
168008
166530
  let input = code18;
@@ -168241,8 +166763,8 @@ function codeToHtml(internal, code18, options) {
168241
166763
  const context2 = {
168242
166764
  meta: {},
168243
166765
  options,
168244
- codeToHast: (_code, _options2) => codeToHast(internal, _code, _options2),
168245
- codeToTokens: (_code, _options2) => codeToTokens(internal, _code, _options2)
166766
+ codeToHast: (_code, _options) => codeToHast(internal, _code, _options),
166767
+ codeToTokens: (_code, _options) => codeToTokens(internal, _code, _options)
168246
166768
  };
168247
166769
  let result = toHtml(codeToHast(internal, code18, options, context2));
168248
166770
  for (const transformer of getTransformers(options))
@@ -173390,165 +171912,6 @@ function getImageContent(data, mimeType) {
173390
171912
  const dataUrl = `data:${mimeType};base64,${cleanBase64}`;
173391
171913
  return { type: "image_url", image_url: { url: dataUrl } };
173392
171914
  }
173393
- var browser = { exports: {} };
173394
- var process = browser.exports = {};
173395
- var cachedSetTimeout;
173396
- var cachedClearTimeout;
173397
- function defaultSetTimout() {
173398
- throw new Error("setTimeout has not been defined");
173399
- }
173400
- function defaultClearTimeout() {
173401
- throw new Error("clearTimeout has not been defined");
173402
- }
173403
- (function() {
173404
- try {
173405
- if (typeof setTimeout === "function") {
173406
- cachedSetTimeout = setTimeout;
173407
- } else {
173408
- cachedSetTimeout = defaultSetTimout;
173409
- }
173410
- } catch (e) {
173411
- cachedSetTimeout = defaultSetTimout;
173412
- }
173413
- try {
173414
- if (typeof clearTimeout === "function") {
173415
- cachedClearTimeout = clearTimeout;
173416
- } else {
173417
- cachedClearTimeout = defaultClearTimeout;
173418
- }
173419
- } catch (e) {
173420
- cachedClearTimeout = defaultClearTimeout;
173421
- }
173422
- })();
173423
- function runTimeout(fun2) {
173424
- if (cachedSetTimeout === setTimeout) {
173425
- return setTimeout(fun2, 0);
173426
- }
173427
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
173428
- cachedSetTimeout = setTimeout;
173429
- return setTimeout(fun2, 0);
173430
- }
173431
- try {
173432
- return cachedSetTimeout(fun2, 0);
173433
- } catch (e) {
173434
- try {
173435
- return cachedSetTimeout.call(null, fun2, 0);
173436
- } catch (e2) {
173437
- return cachedSetTimeout.call(this, fun2, 0);
173438
- }
173439
- }
173440
- }
173441
- function runClearTimeout(marker2) {
173442
- if (cachedClearTimeout === clearTimeout) {
173443
- return clearTimeout(marker2);
173444
- }
173445
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
173446
- cachedClearTimeout = clearTimeout;
173447
- return clearTimeout(marker2);
173448
- }
173449
- try {
173450
- return cachedClearTimeout(marker2);
173451
- } catch (e) {
173452
- try {
173453
- return cachedClearTimeout.call(null, marker2);
173454
- } catch (e2) {
173455
- return cachedClearTimeout.call(this, marker2);
173456
- }
173457
- }
173458
- }
173459
- var queue = [];
173460
- var draining = false;
173461
- var currentQueue;
173462
- var queueIndex = -1;
173463
- function cleanUpNextTick() {
173464
- if (!draining || !currentQueue) {
173465
- return;
173466
- }
173467
- draining = false;
173468
- if (currentQueue.length) {
173469
- queue = currentQueue.concat(queue);
173470
- } else {
173471
- queueIndex = -1;
173472
- }
173473
- if (queue.length) {
173474
- drainQueue();
173475
- }
173476
- }
173477
- function drainQueue() {
173478
- if (draining) {
173479
- return;
173480
- }
173481
- var timeout = runTimeout(cleanUpNextTick);
173482
- draining = true;
173483
- var len2 = queue.length;
173484
- while (len2) {
173485
- currentQueue = queue;
173486
- queue = [];
173487
- while (++queueIndex < len2) {
173488
- if (currentQueue) {
173489
- currentQueue[queueIndex].run();
173490
- }
173491
- }
173492
- queueIndex = -1;
173493
- len2 = queue.length;
173494
- }
173495
- currentQueue = null;
173496
- draining = false;
173497
- runClearTimeout(timeout);
173498
- }
173499
- process.nextTick = function(fun2) {
173500
- var args2 = new Array(arguments.length - 1);
173501
- if (arguments.length > 1) {
173502
- for (var i2 = 1; i2 < arguments.length; i2++) {
173503
- args2[i2 - 1] = arguments[i2];
173504
- }
173505
- }
173506
- queue.push(new Item(fun2, args2));
173507
- if (queue.length === 1 && !draining) {
173508
- runTimeout(drainQueue);
173509
- }
173510
- };
173511
- function Item(fun2, array) {
173512
- this.fun = fun2;
173513
- this.array = array;
173514
- }
173515
- Item.prototype.run = function() {
173516
- this.fun.apply(null, this.array);
173517
- };
173518
- process.title = "browser";
173519
- process.browser = true;
173520
- process.env = {};
173521
- process.argv = [];
173522
- process.version = "";
173523
- process.versions = {};
173524
- function noop$1() {
173525
- }
173526
- process.on = noop$1;
173527
- process.addListener = noop$1;
173528
- process.once = noop$1;
173529
- process.off = noop$1;
173530
- process.removeListener = noop$1;
173531
- process.removeAllListeners = noop$1;
173532
- process.emit = noop$1;
173533
- process.prependListener = noop$1;
173534
- process.prependOnceListener = noop$1;
173535
- process.listeners = function(name2) {
173536
- return [];
173537
- };
173538
- process.binding = function(name2) {
173539
- throw new Error("process.binding is not supported");
173540
- };
173541
- process.cwd = function() {
173542
- return "/";
173543
- };
173544
- process.chdir = function(dir) {
173545
- throw new Error("process.chdir is not supported");
173546
- };
173547
- process.umask = function() {
173548
- return 0;
173549
- };
173550
- var browserExports = browser.exports;
173551
- const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
173552
171915
  var baseGetTag = _baseGetTag, isObjectLike = isObjectLike_1, isPlainObject = isPlainObject_1;
173553
171916
  var domExcTag = "[object DOMException]", errorTag = "[object Error]";
173554
171917
  function isError(value) {
@@ -174057,7 +172420,7 @@ function filterLocallyModifiedFilesOutOfRemoteContext(roots, localFilesByRoot, r
174057
172420
  }
174058
172421
  const relLocalFiles = /* @__PURE__ */ new Set();
174059
172422
  for (const localFile of localFilesByRoot[i2]) {
174060
- relLocalFiles.add(path$1.relative(localRoot.fsPath, localFile));
172423
+ relLocalFiles.add(path.relative(localRoot.fsPath, localFile));
174061
172424
  }
174062
172425
  for (const remoteRepo of remoteRepos) {
174063
172426
  repoNameToLocalFiles.set(remoteRepo.name, relLocalFiles);
@@ -174885,7 +173248,7 @@ __publicField2(_DeepCodyHandler, "observable", combineLatest$1(
174885
173248
  _DeepCodyHandler.isToolboxEnabled = Boolean(_DeepCodyHandler.model);
174886
173249
  Object.assign(_DeepCodyHandler.shellConfig, {
174887
173250
  instance: instanceShellContextFlag,
174888
- client: Boolean(browserExports.env.shell)
173251
+ client: Boolean(env.shell)
174889
173252
  });
174890
173253
  return _DeepCodyHandler.getSettings();
174891
173254
  }
@@ -174917,7 +173280,7 @@ async function getContextFileFromShell(command) {
174917
173280
  return [];
174918
173281
  }
174919
173282
  const cwd = (_e2 = (_d2 = (_c2 = workspace.workspaceFolders) == null ? void 0 : _c2[0]) == null ? void 0 : _d2.uri) == null ? void 0 : _e2.fsPath;
174920
- const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path$1.sep}`);
173283
+ const filteredCommand = command.replaceAll(/(\s~\/)/g, ` ${HOME_DIR}${path.sep}`);
174921
173284
  const allowList = new Set((agenticShellConfig == null ? void 0 : agenticShellConfig.allow) ?? []);
174922
173285
  const blockList = /* @__PURE__ */ new Set([...BASE_DISALLOWED_COMMANDS, ...(agenticShellConfig == null ? void 0 : agenticShellConfig.block) ?? []]);
174923
173286
  try {
@@ -177534,9 +175897,9 @@ class ZodUnion extends ZodType {
177534
175897
  return this._def.options;
177535
175898
  }
177536
175899
  }
177537
- ZodUnion.create = (types2, params) => {
175900
+ ZodUnion.create = (types, params) => {
177538
175901
  return new ZodUnion({
177539
- options: types2,
175902
+ options: types,
177540
175903
  typeName: ZodFirstPartyTypeKind.ZodUnion,
177541
175904
  ...processCreateParams(params)
177542
175905
  });
@@ -179616,8 +177979,8 @@ class McpError extends Error {
179616
177979
  }
179617
177980
  const DEFAULT_REQUEST_TIMEOUT_MSEC = 6e4;
179618
177981
  class Protocol {
179619
- constructor(_options2) {
179620
- this._options = _options2;
177982
+ constructor(_options) {
177983
+ this._options = _options;
179621
177984
  this._requestMessageId = 0;
179622
177985
  this._requestHandlers = /* @__PURE__ */ new Map();
179623
177986
  this._requestHandlerAbortControllers = /* @__PURE__ */ new Map();
@@ -180125,10 +178488,10 @@ class ParseError extends Error {
180125
178488
  super(message), __publicField(this, "type"), __publicField(this, "field"), __publicField(this, "value"), __publicField(this, "line"), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
180126
178489
  }
180127
178490
  }
180128
- function noop(_arg) {
178491
+ function noop$1(_arg) {
180129
178492
  }
180130
178493
  function createParser(callbacks) {
180131
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
178494
+ const { onEvent = noop$1, onError = noop$1, onRetry = noop$1, onComment } = callbacks;
180132
178495
  let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
180133
178496
  function feed2(newChunk) {
180134
178497
  const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
@@ -180929,6 +179292,165 @@ class SSEClientTransport {
180929
179292
  }
180930
179293
  }
180931
179294
  }
179295
+ var browser = { exports: {} };
179296
+ var process = browser.exports = {};
179297
+ var cachedSetTimeout;
179298
+ var cachedClearTimeout;
179299
+ function defaultSetTimout() {
179300
+ throw new Error("setTimeout has not been defined");
179301
+ }
179302
+ function defaultClearTimeout() {
179303
+ throw new Error("clearTimeout has not been defined");
179304
+ }
179305
+ (function() {
179306
+ try {
179307
+ if (typeof setTimeout === "function") {
179308
+ cachedSetTimeout = setTimeout;
179309
+ } else {
179310
+ cachedSetTimeout = defaultSetTimout;
179311
+ }
179312
+ } catch (e) {
179313
+ cachedSetTimeout = defaultSetTimout;
179314
+ }
179315
+ try {
179316
+ if (typeof clearTimeout === "function") {
179317
+ cachedClearTimeout = clearTimeout;
179318
+ } else {
179319
+ cachedClearTimeout = defaultClearTimeout;
179320
+ }
179321
+ } catch (e) {
179322
+ cachedClearTimeout = defaultClearTimeout;
179323
+ }
179324
+ })();
179325
+ function runTimeout(fun2) {
179326
+ if (cachedSetTimeout === setTimeout) {
179327
+ return setTimeout(fun2, 0);
179328
+ }
179329
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
179330
+ cachedSetTimeout = setTimeout;
179331
+ return setTimeout(fun2, 0);
179332
+ }
179333
+ try {
179334
+ return cachedSetTimeout(fun2, 0);
179335
+ } catch (e) {
179336
+ try {
179337
+ return cachedSetTimeout.call(null, fun2, 0);
179338
+ } catch (e2) {
179339
+ return cachedSetTimeout.call(this, fun2, 0);
179340
+ }
179341
+ }
179342
+ }
179343
+ function runClearTimeout(marker2) {
179344
+ if (cachedClearTimeout === clearTimeout) {
179345
+ return clearTimeout(marker2);
179346
+ }
179347
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
179348
+ cachedClearTimeout = clearTimeout;
179349
+ return clearTimeout(marker2);
179350
+ }
179351
+ try {
179352
+ return cachedClearTimeout(marker2);
179353
+ } catch (e) {
179354
+ try {
179355
+ return cachedClearTimeout.call(null, marker2);
179356
+ } catch (e2) {
179357
+ return cachedClearTimeout.call(this, marker2);
179358
+ }
179359
+ }
179360
+ }
179361
+ var queue = [];
179362
+ var draining = false;
179363
+ var currentQueue;
179364
+ var queueIndex = -1;
179365
+ function cleanUpNextTick() {
179366
+ if (!draining || !currentQueue) {
179367
+ return;
179368
+ }
179369
+ draining = false;
179370
+ if (currentQueue.length) {
179371
+ queue = currentQueue.concat(queue);
179372
+ } else {
179373
+ queueIndex = -1;
179374
+ }
179375
+ if (queue.length) {
179376
+ drainQueue();
179377
+ }
179378
+ }
179379
+ function drainQueue() {
179380
+ if (draining) {
179381
+ return;
179382
+ }
179383
+ var timeout = runTimeout(cleanUpNextTick);
179384
+ draining = true;
179385
+ var len2 = queue.length;
179386
+ while (len2) {
179387
+ currentQueue = queue;
179388
+ queue = [];
179389
+ while (++queueIndex < len2) {
179390
+ if (currentQueue) {
179391
+ currentQueue[queueIndex].run();
179392
+ }
179393
+ }
179394
+ queueIndex = -1;
179395
+ len2 = queue.length;
179396
+ }
179397
+ currentQueue = null;
179398
+ draining = false;
179399
+ runClearTimeout(timeout);
179400
+ }
179401
+ process.nextTick = function(fun2) {
179402
+ var args2 = new Array(arguments.length - 1);
179403
+ if (arguments.length > 1) {
179404
+ for (var i2 = 1; i2 < arguments.length; i2++) {
179405
+ args2[i2 - 1] = arguments[i2];
179406
+ }
179407
+ }
179408
+ queue.push(new Item(fun2, args2));
179409
+ if (queue.length === 1 && !draining) {
179410
+ runTimeout(drainQueue);
179411
+ }
179412
+ };
179413
+ function Item(fun2, array) {
179414
+ this.fun = fun2;
179415
+ this.array = array;
179416
+ }
179417
+ Item.prototype.run = function() {
179418
+ this.fun.apply(null, this.array);
179419
+ };
179420
+ process.title = "browser";
179421
+ process.browser = true;
179422
+ process.env = {};
179423
+ process.argv = [];
179424
+ process.version = "";
179425
+ process.versions = {};
179426
+ function noop() {
179427
+ }
179428
+ process.on = noop;
179429
+ process.addListener = noop;
179430
+ process.once = noop;
179431
+ process.off = noop;
179432
+ process.removeListener = noop;
179433
+ process.removeAllListeners = noop;
179434
+ process.emit = noop;
179435
+ process.prependListener = noop;
179436
+ process.prependOnceListener = noop;
179437
+ process.listeners = function(name2) {
179438
+ return [];
179439
+ };
179440
+ process.binding = function(name2) {
179441
+ throw new Error("process.binding is not supported");
179442
+ };
179443
+ process.cwd = function() {
179444
+ return "/";
179445
+ };
179446
+ process.chdir = function(dir) {
179447
+ throw new Error("process.chdir is not supported");
179448
+ };
179449
+ process.umask = function() {
179450
+ return 0;
179451
+ };
179452
+ var browserExports = browser.exports;
179453
+ const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
180932
179454
  class ReadBuffer {
180933
179455
  append(chunk) {
180934
179456
  this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
@@ -184878,17 +183400,17 @@ const getDefaultOptions = (options) => ({
184878
183400
  ...options
184879
183401
  });
184880
183402
  const getRefs = (options) => {
184881
- const _options2 = getDefaultOptions(options);
184882
- const currentPath = _options2.name !== void 0 ? [..._options2.basePath, _options2.definitionPath, _options2.name] : _options2.basePath;
183403
+ const _options = getDefaultOptions(options);
183404
+ const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
184883
183405
  return {
184884
- ..._options2,
183406
+ ..._options,
184885
183407
  currentPath,
184886
183408
  propertyPath: void 0,
184887
- seen: new Map(Object.entries(_options2.definitions).map(([name2, def]) => [
183409
+ seen: new Map(Object.entries(_options.definitions).map(([name2, def]) => [
184888
183410
  def._def,
184889
183411
  {
184890
183412
  def: def._def,
184891
- path: [..._options2.basePath, _options2.definitionPath, name2],
183413
+ path: [..._options.basePath, _options.definitionPath, name2],
184892
183414
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
184893
183415
  jsonSchema: void 0
184894
183416
  }
@@ -185550,15 +184072,15 @@ function parseUnionDef(def, refs) {
185550
184072
  return asAnyOf(def, refs);
185551
184073
  const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
185552
184074
  if (options.every((x) => x._def.typeName in primitiveMappings && (!x._def.checks || !x._def.checks.length))) {
185553
- const types2 = options.reduce((types3, x) => {
184075
+ const types = options.reduce((types2, x) => {
185554
184076
  const type = primitiveMappings[x._def.typeName];
185555
- return type && !types3.includes(type) ? [...types3, type] : types3;
184077
+ return type && !types2.includes(type) ? [...types2, type] : types2;
185556
184078
  }, []);
185557
184079
  return {
185558
- type: types2.length > 1 ? types2 : types2[0]
184080
+ type: types.length > 1 ? types : types[0]
185559
184081
  };
185560
184082
  } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
185561
- const types2 = options.reduce((acc, x) => {
184083
+ const types = options.reduce((acc, x) => {
185562
184084
  const type = typeof x._def.value;
185563
184085
  switch (type) {
185564
184086
  case "string":
@@ -185577,8 +184099,8 @@ function parseUnionDef(def, refs) {
185577
184099
  return acc;
185578
184100
  }
185579
184101
  }, []);
185580
- if (types2.length === options.length) {
185581
- const uniqueTypes = types2.filter((x, i2, a) => a.indexOf(x) === i2);
184102
+ if (types.length === options.length) {
184103
+ const uniqueTypes = types.filter((x, i2, a) => a.indexOf(x) === i2);
185582
184104
  return {
185583
184105
  type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
185584
184106
  enum: options.reduce((acc, x) => {
@@ -190634,8 +189156,8 @@ function parseMentionURI(uri) {
190634
189156
  }
190635
189157
  }
190636
189158
  async function execFileAsync(program2, args2, { cwd }) {
190637
- const { promisify } = await import("./util-DokYc53k.mjs").then((n) => n.u);
190638
- const { execFile } = await import("./vscode-shim-vO7kNcRR.mjs").then((n) => n.fX);
189159
+ const { promisify } = await import("./util-C63afKLY.mjs").then((n) => n.u);
189160
+ const { execFile } = await import("./vscode-shim-DyPeDFnt.mjs").then((n) => n.fR);
190639
189161
  return promisify(execFile)(program2, args2, { cwd });
190640
189162
  }
190641
189163
  var __create = Object.create;
@@ -192471,8 +190993,8 @@ async function getAccessTokenLinearConnect() {
192471
190993
  if (!vscode2) {
192472
190994
  return void 0;
192473
190995
  }
192474
- const ext2 = vscode2.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID);
192475
- if (!ext2) {
190996
+ const ext = vscode2.extensions.getExtension(LINEAR_AUTHENTICATION_EXTENSION_ID);
190997
+ if (!ext) {
192476
190998
  vscode2.window.showWarningMessage(
192477
190999
  "Cody requires the Linear Connect extension to be installed and activated."
192478
191000
  );
@@ -193029,14 +191551,14 @@ async function getViewerSettingsProviders() {
193029
191551
  }
193030
191552
  }
193031
191553
  async function warnIfOpenCtxExtensionConflict() {
193032
- const ext2 = extensions.getExtension("sourcegraph.openctx");
193033
- if (!ext2) {
191554
+ const ext = extensions.getExtension("sourcegraph.openctx");
191555
+ if (!ext) {
193034
191556
  return;
193035
191557
  }
193036
191558
  window$1.showWarningMessage(
193037
191559
  "Cody directly provides OpenCtx support, please disable the Sourcegraph OpenCtx extension."
193038
191560
  );
193039
- await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[ext2.id]]);
191561
+ await commands$1.executeCommand("workbench.extensions.action.showExtensionsWithIds", [[ext.id]]);
193040
191562
  }
193041
191563
  const logger = new Logger();
193042
191564
  const LOG_LABEL = "Guardrails";
@@ -193433,14 +191955,14 @@ he.exports;
193433
191955
  }
193434
191956
  return false;
193435
191957
  };
193436
- var merge2 = function(options, defaults2) {
191958
+ var merge2 = function(options, defaults) {
193437
191959
  if (!options) {
193438
- return defaults2;
191960
+ return defaults;
193439
191961
  }
193440
191962
  var result = {};
193441
191963
  var key3;
193442
- for (key3 in defaults2) {
193443
- result[key3] = has2(options, key3) ? options[key3] : defaults2[key3];
191964
+ for (key3 in defaults) {
191965
+ result[key3] = has2(options, key3) ? options[key3] : defaults[key3];
193444
191966
  }
193445
191967
  return result;
193446
191968
  };
@@ -193775,6 +192297,7 @@ function responseTransformer(text2, task, isMessageInProgress) {
193775
192297
  if (task.mode === "insert") {
193776
192298
  return decodedText.endsWith("\n") || task.selectionRange.isEmpty ? decodedText : decodedText + "\n";
193777
192299
  }
192300
+ decodedText = task.original.endsWith("\n") && !decodedText.endsWith("\n") ? decodedText + "\n" : decodedText;
193778
192301
  return formatToMatchOriginal(decodedText, task.original, task.fixupFile.uri);
193779
192302
  }
193780
192303
  return decodedText;
@@ -196232,7 +194755,7 @@ class FixupTask {
196232
194755
  }
196233
194756
  }
196234
194757
  getDefaultSelectionRange(proposedRange) {
196235
- if (this.intent === "add" || proposedRange.isEmpty) {
194758
+ if (this.intent === "add") {
196236
194759
  return proposedRange;
196237
194760
  }
196238
194761
  const isLastLine = proposedRange.end.line === this.document.lineCount - 1;
@@ -196679,7 +195202,6 @@ class FixupController {
196679
195202
  */
196680
195203
  __publicField2(this, "undoCommandEvent", new AgentEventEmitter());
196681
195204
  __publicField2(this, "_disposables", []);
196682
- this.client = client;
196683
195205
  this.controlApplicator = client.createFixupControlApplicator(this);
196684
195206
  this.files = new FixupFileObserver();
196685
195207
  this._disposables.push(
@@ -197469,10 +195991,9 @@ class FixupController {
197469
195991
  if (task.fixupFile.uri.toString() === newFileUri.toString()) {
197470
195992
  return this.setTaskState(task, CodyTaskState.Working);
197471
195993
  }
197472
- const doc2 = await this.client.openNewDocument(workspace, newFileUri);
197473
- if (!doc2) {
197474
- throw new Error(`Cannot create file for the fixup: ${newFileUri.toString()}`);
197475
- }
195994
+ const unsavedDoc = await workspace.openTextDocument(newFileUri);
195995
+ await unsavedDoc.save();
195996
+ const doc2 = await workspace.openTextDocument(newFileUri.with({ scheme: "file" }));
197476
195997
  this.controlApplicator.removeLensesFor(task);
197477
195998
  const pos2 = new Position(Math.max(doc2.lineCount - 1, 0), 0);
197478
195999
  const range = new Range(pos2, pos2);
@@ -197570,142 +196091,6 @@ class FixupController {
197570
196091
  this._disposables = [];
197571
196092
  }
197572
196093
  }
197573
- const _CodyProExpirationNotifications = class _CodyProExpirationNotifications {
197574
- /**
197575
- * Set up a check (now and when auth status changes) whether to show the user a notification
197576
- * about their Cody Pro subscription having expired (or expiring soon).
197577
- */
197578
- constructor(apiClient, showInformationMessage, openExternal, flagCheckDelayMs = 1e3 * 60 * 30, autoUpdateDelay = 1e3 * 3, checkImmediately = true) {
197579
- /**
197580
- * Current subscription to auth provider status changes that may trigger a check.
197581
- */
197582
- __publicField2(this, "authProviderSubscription");
197583
- /**
197584
- * A timer if there is currently an outstanding timed check.
197585
- */
197586
- __publicField2(this, "nextTimedCheck");
197587
- /**
197588
- * Whether we've been disposed.
197589
- */
197590
- __publicField2(this, "isDisposed", false);
197591
- this.apiClient = apiClient;
197592
- this.showInformationMessage = showInformationMessage;
197593
- this.openExternal = openExternal;
197594
- this.flagCheckDelayMs = flagCheckDelayMs;
197595
- this.autoUpdateDelay = autoUpdateDelay;
197596
- if (checkImmediately) {
197597
- void this.triggerExpirationCheck();
197598
- }
197599
- }
197600
- /**
197601
- * Perform an immediate check and display a notification if appropriate.
197602
- */
197603
- async triggerExpirationCheck() {
197604
- if (this.shouldSuppressNotifications()) return;
197605
- if (!this.authProviderSubscription) {
197606
- this.authProviderSubscription = authStatus.subscribe(
197607
- () => setTimeout(() => this.triggerExpirationCheck(), this.autoUpdateDelay)
197608
- );
197609
- }
197610
- const authStatus_ = currentAuthStatusOrNotReadyYet();
197611
- if (!(authStatus_ == null ? void 0 : authStatus_.authenticated) || !isDotCom(authStatus_)) return;
197612
- const useSscForCodySubscription = await featureFlagProvider.evaluateFeatureFlagEphemerally(
197613
- FeatureFlag.UseSscForCodySubscription
197614
- );
197615
- if (this.shouldSuppressNotifications()) return;
197616
- if (!useSscForCodySubscription) {
197617
- this.scheduleTimedCheck();
197618
- return;
197619
- }
197620
- const res = await this.apiClient.getCurrentUserCodySubscription();
197621
- if (this.shouldSuppressNotifications()) return;
197622
- if (res instanceof Error) {
197623
- console.error(res);
197624
- this.scheduleTimedCheck();
197625
- return;
197626
- }
197627
- if (res === null || res.plan !== "PRO" || res.status !== "PENDING") return;
197628
- await this.showNotification();
197629
- }
197630
- async showNotification() {
197631
- const codyProTrialEnded = await featureFlagProvider.evaluateFeatureFlagEphemerally(
197632
- FeatureFlag.CodyProTrialEnded
197633
- );
197634
- if (this.shouldSuppressNotifications()) return;
197635
- this.dispose();
197636
- let actionUrl;
197637
- let text2;
197638
- if (codyProTrialEnded) {
197639
- actionUrl = _CodyProExpirationNotifications.expiredActionUrl;
197640
- text2 = _CodyProExpirationNotifications.expiredMessageText;
197641
- } else {
197642
- actionUrl = _CodyProExpirationNotifications.nearlyExpiredActionUrl;
197643
- text2 = _CodyProExpirationNotifications.nearlyExpiredMessageText;
197644
- }
197645
- const actionText = _CodyProExpirationNotifications.actionText;
197646
- const noThanksText = _CodyProExpirationNotifications.noThanksText;
197647
- const action = await this.showInformationMessage(text2, actionText, noThanksText);
197648
- this.suppressFutureNotifications();
197649
- if (action === actionText) {
197650
- await this.openExternal(URI.parse(actionUrl));
197651
- }
197652
- }
197653
- /**
197654
- * Checks if it's still valid to show a notification.
197655
- */
197656
- shouldSuppressNotifications() {
197657
- if (this.isDisposed) return true;
197658
- if (localStorage.get(_CodyProExpirationNotifications.localStorageSuppressionKey)) {
197659
- this.dispose();
197660
- return true;
197661
- }
197662
- return false;
197663
- }
197664
- suppressFutureNotifications() {
197665
- this.dispose();
197666
- localStorage.set(_CodyProExpirationNotifications.localStorageSuppressionKey, "true");
197667
- }
197668
- /**
197669
- * Schedules a future check.
197670
- */
197671
- scheduleTimedCheck() {
197672
- var _a3;
197673
- (_a3 = this.nextTimedCheck) == null ? void 0 : _a3.unref();
197674
- this.nextTimedCheck = setTimeout(
197675
- async () => this.triggerExpirationCheck(),
197676
- this.flagCheckDelayMs
197677
- );
197678
- }
197679
- /**
197680
- * Stops checking and cleans up.
197681
- *
197682
- * Safe to call multiple times.
197683
- */
197684
- dispose() {
197685
- var _a3, _b2;
197686
- this.isDisposed = true;
197687
- (_a3 = this.authProviderSubscription) == null ? void 0 : _a3.unsubscribe();
197688
- this.authProviderSubscription = void 0;
197689
- (_b2 = this.nextTimedCheck) == null ? void 0 : _b2.unref();
197690
- this.nextTimedCheck = void 0;
197691
- }
197692
- };
197693
- __publicField2(_CodyProExpirationNotifications, "expiredActionUrl", "https://sourcegraph.com/cody/subscription");
197694
- __publicField2(_CodyProExpirationNotifications, "expiredMessageText", `
197695
- Your Cody Pro trial has ended, and you are now on the Cody Free plan.
197696
-
197697
- If you'd like to upgrade to Cody Pro, please setup your payment information. You can cancel anytime.
197698
- `);
197699
- __publicField2(_CodyProExpirationNotifications, "nearlyExpiredActionUrl", "https://sourcegraph.com/cody/subscription?on-trial=true");
197700
- __publicField2(_CodyProExpirationNotifications, "nearlyExpiredMessageText", `
197701
- Your Cody Pro Trial is ending soon.
197702
-
197703
- Setup your payment information to continue using Cody Pro, you won't be charged until February 21.
197704
- `);
197705
- __publicField2(_CodyProExpirationNotifications, "localStorageSuppressionKey", "extension.codyPro.suppressExpirationNotices");
197706
- __publicField2(_CodyProExpirationNotifications, "actionText", "Setup Payment Info");
197707
- __publicField2(_CodyProExpirationNotifications, "noThanksText", "Don’t Show Again");
197708
- let CodyProExpirationNotifications = _CodyProExpirationNotifications;
197709
196094
  const showActionNotification = async ({
197710
196095
  message,
197711
196096
  options = {},
@@ -197955,6 +196340,23 @@ const showFeedbackSupportQuickPick = async () => {
197955
196340
  const selectedItem = await window$1.showQuickPick(FeedbackOptionItems, FeedbackQuickPickOptions);
197956
196341
  await (selectedItem == null ? void 0 : selectedItem.onSelect());
197957
196342
  };
196343
+ const chatPeriods = /* @__PURE__ */ new Map([
196344
+ // today = 1 day = 6 secs * 60 mins * 24 hours
196345
+ [86400, "Today"],
196346
+ [604800, "This week"],
196347
+ [2592e3, "This month"]
196348
+ ]);
196349
+ function getRelativeChatPeriod(date) {
196350
+ const now = Date.now();
196351
+ const seconds = Math.floor((now - date.getTime()) / 1e3);
196352
+ for (const [unit, period] of chatPeriods.entries()) {
196353
+ if (seconds < unit) {
196354
+ return period;
196355
+ }
196356
+ }
196357
+ const amount = Math.floor(seconds / 2592e3);
196358
+ return `${amount} month${amount !== 1 ? "s" : ""} ago`;
196359
+ }
197958
196360
  function groupCodyChats(authStatus2) {
197959
196361
  var _a3, _b2, _c2, _d2;
197960
196362
  const chatHistoryGroups = /* @__PURE__ */ new Map();
@@ -198946,9 +197348,6 @@ function registerSidebarCommands() {
198946
197348
  logSidebarClick(page, "billable");
198947
197349
  let url;
198948
197350
  switch (page) {
198949
- case "upgrade":
198950
- url = ACCOUNT_UPGRADE_URL;
198951
- break;
198952
197351
  case "usage":
198953
197352
  url = ACCOUNT_USAGE_URL;
198954
197353
  break;
@@ -200369,7 +198768,7 @@ async function start(context2, platform2) {
200369
198768
  setResolvedConfigurationObservable(
200370
198769
  combineLatest$1(
200371
198770
  fromVSCodeEvent(workspace.onDidChangeConfiguration).pipe(
200372
- filter$2(
198771
+ filter$1(
200373
198772
  (event2) => event2.affectsConfiguration("cody") || event2.affectsConfiguration("openctx") || event2.affectsConfiguration("http")
200374
198773
  ),
200375
198774
  startWith$1(void 0),
@@ -200482,7 +198881,7 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
200482
198881
  await registerTestCommands(context2, disposables);
200483
198882
  }
200484
198883
  registerDebugCommands(context2, disposables);
200485
- registerUpgradeHandlers(disposables);
198884
+ registerAuthenticationHandlers(disposables);
200486
198885
  disposables.push(charactersLogger);
200487
198886
  resolvedConfig.pipe(take$2(1)).subscribe(({ auth: auth2 }) => showSetupNotification(auth2));
200488
198887
  disposables.push(
@@ -200509,7 +198908,6 @@ const register = async (context2, platform2, isExtensionModeDevOrTest) => {
200509
198908
  })
200510
198909
  )
200511
198910
  );
200512
- disposables.push(initializeContextFiltersProvider());
200513
198911
  return Disposable.from(...disposables);
200514
198912
  };
200515
198913
  async function initializeSingletons(platform2, disposables) {
@@ -200530,40 +198928,19 @@ async function registerOtherCommands(disposables) {
200530
198928
  // Account links
200531
198929
  commands$1.registerCommand(
200532
198930
  "cody.show-rate-limit-modal",
200533
- async (userMessage, retryMessage, upgradeAvailable) => {
200534
- if (upgradeAvailable) {
200535
- const option2 = await window$1.showInformationMessage(
200536
- "Upgrade to Cody Pro",
200537
- {
200538
- modal: true,
200539
- detail: `${userMessage}
200540
-
200541
- Upgrade to Cody Pro for unlimited autocomplete suggestions, and increased limits for chat messages and commands.
200542
-
200543
- ${retryMessage}`
200544
- },
200545
- "Upgrade",
200546
- "See Plans"
200547
- );
200548
- if (option2) {
200549
- void env.openExternal(Uri.parse(ACCOUNT_UPGRADE_URL.toString()));
200550
- }
200551
- } else {
200552
- const option2 = await window$1.showInformationMessage(
200553
- "Rate Limit Exceeded",
200554
- {
200555
- modal: true,
200556
- detail: `${userMessage}
198931
+ async (userMessage, retryMessage) => {
198932
+ const option2 = await window$1.showInformationMessage(
198933
+ "Rate Limit Exceeded",
198934
+ {
198935
+ modal: true,
198936
+ detail: `${userMessage}
200557
198937
 
200558
198938
  ${retryMessage}`
200559
- },
200560
- "Learn More"
200561
- );
200562
- if (option2) {
200563
- void env.openExternal(
200564
- Uri.parse(ACCOUNT_LIMITS_INFO_URL.toString())
200565
- );
200566
- }
198939
+ },
198940
+ "Learn More"
198941
+ );
198942
+ if (option2) {
198943
+ void env.openExternal(Uri.parse(ACCOUNT_LIMITS_INFO_URL.toString()));
200567
198944
  }
200568
198945
  }
200569
198946
  ),
@@ -200725,41 +199102,7 @@ function registerAuthCommands(disposables) {
200725
199102
  )
200726
199103
  );
200727
199104
  }
200728
- function registerUpgradeHandlers(disposables) {
200729
- disposables.push(
200730
- // Register URI Handler (e.g. vscode://sourcegraph.cody-ai)
200731
- window$1.registerUriHandler({
200732
- handleUri: async (uri) => {
200733
- if (uri.path === "/app-done") ;
200734
- else {
200735
- void tokenCallbackHandler(uri);
200736
- }
200737
- }
200738
- }),
200739
- // Check if user has just moved back from a browser window to upgrade cody pro
200740
- window$1.onDidChangeWindowState(async (ws) => {
200741
- const authStatus2 = currentAuthStatus();
200742
- const sub2 = await currentUserProductSubscription();
200743
- if (ws.focused && isDotCom(authStatus2) && authStatus2.authenticated) {
200744
- const res = await graphqlClient.getCurrentUserCodyProEnabled();
200745
- if (res instanceof Error) {
200746
- logError$1("onDidChangeWindowState", "getCurrentUserCodyProEnabled", res);
200747
- return;
200748
- }
200749
- const isCurrentCodyProUser = sub2 && !sub2.userCanUpgrade;
200750
- if (res && res.codyProEnabled !== isCurrentCodyProUser) {
200751
- authProvider.refresh();
200752
- }
200753
- }
200754
- }),
200755
- new CodyProExpirationNotifications(
200756
- graphqlClient,
200757
- window$1.showInformationMessage,
200758
- env.openExternal
200759
- )
200760
- );
200761
- }
200762
- async function registerTestCommands(_context, disposables) {
199105
+ async function registerTestCommands(context2, disposables) {
200763
199106
  await commands$1.executeCommand("setContext", "cody.devOrTest", true);
200764
199107
  disposables.push(
200765
199108
  commands$1.registerCommand("cody.test.set-context-filters", async () => {
@@ -200880,7 +199223,7 @@ function registerAutocomplete(platform2, statusBar, disposables) {
200880
199223
  if (res === NEVER$1 && !authStatus2.pendingValidation) {
200881
199224
  finishLoading();
200882
199225
  }
200883
- return res.tap((_res) => {
199226
+ return res.tap((res2) => {
200884
199227
  finishLoading();
200885
199228
  });
200886
199229
  }),
@@ -200926,6 +199269,19 @@ function registerChat({ context: context2, platform: platform2, chatClient, guar
200926
199269
  }
200927
199270
  return { chatsController };
200928
199271
  }
199272
+ function registerAuthenticationHandlers(disposables) {
199273
+ disposables.push(
199274
+ // Register URI Handler (e.g. vscode://sourcegraph.cody-ai)
199275
+ window$1.registerUriHandler({
199276
+ handleUri: async (uri) => {
199277
+ if (uri.path === "/app-done") ;
199278
+ else {
199279
+ void tokenCallbackHandler(uri);
199280
+ }
199281
+ }
199282
+ })
199283
+ );
199284
+ }
200929
199285
  async function activate(context2, {
200930
199286
  initializeNetworkAgent,
200931
199287
  initializeNoxideLib,
@@ -201482,7 +199838,7 @@ const extractSafariExtensionDetails = (func2, filename) => {
201482
199838
  const MAX_ALLOWED_STRING_LENGTH = 1024;
201483
199839
  const INTEGRATION_NAME$5 = "Breadcrumbs";
201484
199840
  const _breadcrumbsIntegration = (options = {}) => {
201485
- const _options2 = {
199841
+ const _options = {
201486
199842
  console: true,
201487
199843
  dom: true,
201488
199844
  fetch: true,
@@ -201498,22 +199854,22 @@ const _breadcrumbsIntegration = (options = {}) => {
201498
199854
  },
201499
199855
  // eslint-disable-line @typescript-eslint/no-empty-function
201500
199856
  setup(client) {
201501
- if (_options2.console) {
199857
+ if (_options.console) {
201502
199858
  addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));
201503
199859
  }
201504
- if (_options2.dom) {
201505
- addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options2.dom));
199860
+ if (_options.dom) {
199861
+ addClickKeypressInstrumentationHandler(_getDomBreadcrumbHandler(client, _options.dom));
201506
199862
  }
201507
- if (_options2.xhr) {
199863
+ if (_options.xhr) {
201508
199864
  addXhrInstrumentationHandler(_getXhrBreadcrumbHandler(client));
201509
199865
  }
201510
- if (_options2.fetch) {
199866
+ if (_options.fetch) {
201511
199867
  addFetchInstrumentationHandler(_getFetchBreadcrumbHandler(client));
201512
199868
  }
201513
- if (_options2.history) {
199869
+ if (_options.history) {
201514
199870
  addHistoryInstrumentationHandler(_getHistoryBreadcrumbHandler(client));
201515
199871
  }
201516
- if (_options2.sentry && client.on) {
199872
+ if (_options.sentry && client.on) {
201517
199873
  client.on("beforeSendEvent", _getSentryBreadcrumbHandler(client));
201518
199874
  }
201519
199875
  }
@@ -201856,7 +200212,7 @@ function _getFramesFromEvent(event2) {
201856
200212
  }
201857
200213
  const INTEGRATION_NAME$3 = "GlobalHandlers";
201858
200214
  const _globalHandlersIntegration = (options = {}) => {
201859
- const _options2 = {
200215
+ const _options = {
201860
200216
  onerror: true,
201861
200217
  onunhandledrejection: true,
201862
200218
  ...options
@@ -201867,11 +200223,11 @@ const _globalHandlersIntegration = (options = {}) => {
201867
200223
  Error.stackTraceLimit = 50;
201868
200224
  },
201869
200225
  setup(client) {
201870
- if (_options2.onerror) {
200226
+ if (_options.onerror) {
201871
200227
  _installGlobalOnErrorHandler(client);
201872
200228
  globalHandlerLog("onerror");
201873
200229
  }
201874
- if (_options2.onunhandledrejection) {
200230
+ if (_options.onunhandledrejection) {
201875
200231
  _installGlobalOnUnhandledRejectionHandler(client);
201876
200232
  globalHandlerLog("onunhandledrejection");
201877
200233
  }
@@ -202095,7 +200451,7 @@ const DEFAULT_EVENT_TARGET = [
202095
200451
  ];
202096
200452
  const INTEGRATION_NAME = "TryCatch";
202097
200453
  const _browserApiErrorsIntegration = (options = {}) => {
202098
- const _options2 = {
200454
+ const _options = {
202099
200455
  XMLHttpRequest: true,
202100
200456
  eventTarget: true,
202101
200457
  requestAnimationFrame: true,
@@ -202108,19 +200464,19 @@ const _browserApiErrorsIntegration = (options = {}) => {
202108
200464
  // TODO: This currently only works for the first client this is setup
202109
200465
  // We may want to adjust this to check for client etc.
202110
200466
  setupOnce() {
202111
- if (_options2.setTimeout) {
200467
+ if (_options.setTimeout) {
202112
200468
  fill(WINDOW, "setTimeout", _wrapTimeFunction);
202113
200469
  }
202114
- if (_options2.setInterval) {
200470
+ if (_options.setInterval) {
202115
200471
  fill(WINDOW, "setInterval", _wrapTimeFunction);
202116
200472
  }
202117
- if (_options2.requestAnimationFrame) {
200473
+ if (_options.requestAnimationFrame) {
202118
200474
  fill(WINDOW, "requestAnimationFrame", _wrapRAF);
202119
200475
  }
202120
- if (_options2.XMLHttpRequest && "XMLHttpRequest" in WINDOW) {
200476
+ if (_options.XMLHttpRequest && "XMLHttpRequest" in WINDOW) {
202121
200477
  fill(XMLHttpRequest.prototype, "send", _wrapXHR);
202122
200478
  }
202123
- const eventTargetOption = _options2.eventTarget;
200479
+ const eventTargetOption = _options.eventTarget;
202124
200480
  if (eventTargetOption) {
202125
200481
  const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET;
202126
200482
  eventTarget.forEach(_wrapEventTarget);
@@ -202260,7 +200616,7 @@ const defaultIntegrations = [
202260
200616
  dedupeIntegration(),
202261
200617
  httpContextIntegration()
202262
200618
  ];
202263
- function getDefaultIntegrations(_options2) {
200619
+ function getDefaultIntegrations(_options) {
202264
200620
  return [
202265
200621
  // eslint-disable-next-line deprecation/deprecation
202266
200622
  ...defaultIntegrations