@sourcegraph/cody-web 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,7 @@ var __privateWrapper = (obj, member, setter2, getter) => ({
18
18
  }
19
19
  });
20
20
  var _a2, _b, _constructing, _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_fn, moveToTail_fn, _c, _d, _e, _constructing2, _f, _g, _max2, _maxSize2, _dispose2, _disposeAfter2, _fetchMethod2, _size2, _calculatedSize2, _keyMap2, _keyList2, _valList2, _next2, _prev2, _head2, _tail2, _free2, _disposed2, _sizes2, _starts2, _ttls2, _hasDispose2, _hasFetchMethod2, _hasDisposeAfter2, _LRUCache_instances2, initializeTTLTracking_fn2, _updateItemAge2, _statusTTL2, _setItemTTL2, _isStale2, initializeSizeTracking_fn2, _removeItemSize2, _addItemSize2, _requireSize2, indexes_fn2, rindexes_fn2, isValidIndex_fn2, evict_fn2, backgroundFetch_fn2, isBackgroundFetch_fn2, connect_fn2, moveToTail_fn2, _root2, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, partsToRegExp_fn, parseGlob_fn, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
21
- import { by as Observable, bz as unsubscribe, bA as createSubscriber, bB as graphqlClient, bC as logError$2, aV as lodashExports, bD as logDebug$1, bE as isFileURI, w as wrapInActiveSpan, bF as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bG as isDotCom, bH as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bI as isAbortError, b8 as isError$1, bb as isDefined, bJ as onAbort, bK as CHAT_OUTPUT_TOKEN_BUDGET, bk as ModelTag, b3 as CodyIDE, bL as isEnterpriseUser, b2 as isCodyProUser, bt as CHAT_INPUT_TOKEN_BUDGET, bM as getModelInfo, bN as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bO as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, g as getDefaultExportFromCjs, bP as pathFunctionsForURI, bQ as uriBasename, bR as uriHasPrefix, bS as isWindows, aL as URI, bT as Utils$1, p as ps, bU as fromVSCodeEvent, bV as ClientConfigSingleton, bx as PromptString, bW as isCustomModel, bX as recordErrorToSpan, bY as dependentAbortController, bZ as addCustomUserAgent, b_ as addTraceparent, b$ as fetch$2, c0 as verifyResponseCode, b7 as cryptoJsExports, c1 as openCtx, c2 as AsyncSerialScheduler_1, c3 as extensionForLanguage, c4 as isSourcegraphToken, c5 as _, c6 as toRangeData, c7 as DOTCOM_URL, c8 as requireBase64Js, b5 as commonjsGlobal, c9 as NetworkError, ca as isRateLimitError, cb as isAuthError, t as telemetryRecorder, cc as semver, cd as NO_INITIAL_VALUE, ce as distinctUntilChanged$1, cf as SourcegraphGraphQLAPIClient, cg as isNetworkLikeError, ch as NoOpTelemetryRecorderProvider, ci as TimestampTelemetryProcessor_1, cj as updateGlobalTelemetryInstances, ck as TelemetryRecorderProvider, cl as telemetryRecorderProvider, cm as convertGitCloneURLToCodebaseName, cn as subscriptionDisposable, d as dedent$1, co as uriExtname, cp as SUPPORTED_URI_SCHEMAS, cq as require$$1$4, cr as dedupeWith$1, cs as getEditorInsertSpaces, ct as TimeoutError, cu as getActiveTraceAndSpanId, cv as isNetworkError, cw as trace, bj as isCodyProModel, b6 as CodyTaskState, aT as createExtensionAPI, aU as createMessageAPIForWebview, be as isEqual, cx as getAugmentedNamespace, cy as main$1, cz as setUserAgent, cA as TESTING_TELEMETRY_EXPORTER, cB as dist, cC as waitUntilComplete, bl as isMacOS, bw as setDisplayPathEnvInfo, bq as ACCOUNT_USAGE_URL, T as TokenCounterUtils, C as ContextItemSource, cD as _root, cE as _baseGetTag, cF as isObjectLike_1, cG as isObject_1, bv as isErrorLike, au as displayPath, cH as uriParseNameAndExtension, cI as uriDirname, an as FILE_CONTEXT_MENTION_PROVIDER, ao as SYMBOL_CONTEXT_MENTION_PROVIDER, ap as REMOTE_REPOSITORY_PROVIDER_URI, cJ as promiseFactoryToObservable, cK as webMentionProvidersMetadata, cL as allMentionProvidersMetadata, cM as combineLatest$1, cN as expandToLineRange, am as displayPathBasename, av as displayLineRange, cO as truncateTextNearestLine, cP as TokenCounter, bp as View, aQ as parseMentionQuery, cQ as tracer, bd as isAbortErrorOrSocketHangUp, cR as isContextWindowLimitError, cS as truncatePromptString, cT as inputTextWithoutContextChipsFromPromptEditorState, bc as reformatBotMessageForChat, b1 as hydrateAfterPostMessage, cU as addMessageListenersForExtensionAPI, cV as createMessageAPIForExtension, cW as startWith$1, cX as promiseToObservable$1, cY as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, cZ as editorStateFromPromptString, c_ as getEditorTabSize$1, bi as pluralize, c$ as AbortError, d0 as getEditorIndentString, b9 as RateLimitError$1, d1 as logResponseHeadersToSpan, d2 as TracedError, d3 as isNodeResponse, d4 as SpanStatusCode, aq as REMOTE_FILE_PROVIDER_URI, as as CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI, d5 as assertFileURI, ar as REMOTE_DIRECTORY_PROVIDER_URI, at as WEB_PROVIDER_URI, d6 as setOpenCtx, d7 as GIT_OPENCTX_PROVIDER_URI, d8 as ACCOUNT_UPGRADE_URL, aZ as scanForMentionTriggerInUserTextInput, ay as LARGE_FILE_WARNING_LABEL, d9 as GENERAL_HELP_LABEL, da as diffLines, db as psDedent, dc as languageFromFilename, dd as ProgrammingLanguage, de as truncatePromptStringStart, df as posixFilePaths, dg as CODY_DOC_URL, ba as CODY_FEEDBACK_URL, dh as DISCORD_URL, di as CODY_SUPPORT_URL, br as getRelativeChatPeriod, dj as SG_BLOG_URL, dk as ACCOUNT_LIMITS_INFO_URL, dl as setLogger, dm as CODY_OLLAMA_DOCS_URL, bu as browser$3 } from "./browser-5V4RMNo3.mjs";
21
+ import { by as Observable, bz as unsubscribe, bA as createSubscriber, bB as graphqlClient, bC as logError$2, aU as lodashExports, bD as logDebug$1, bE as isFileURI, w as wrapInActiveSpan, bF as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bG as isDotCom, bH as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bI as isAbortError, b7 as isError$1, ba as isDefined, bJ as onAbort, bK as CHAT_OUTPUT_TOKEN_BUDGET, bj as ModelTag, b2 as CodyIDE, bL as isEnterpriseUser, b1 as isCodyProUser, br as CHAT_INPUT_TOKEN_BUDGET, bM as getModelInfo, bN as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bO as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, g as getDefaultExportFromCjs, bP as pathFunctionsForURI, bQ as uriBasename, bR as uriHasPrefix, bS as isWindows, aK as URI, bT as Utils$1, p as ps, bU as fromVSCodeEvent, bV as ClientConfigSingleton, bx as PromptString, bW as isCustomModel, bX as recordErrorToSpan, bY as dependentAbortController, bZ as addCustomUserAgent, b_ as addTraceparent, b$ as fetch$2, c0 as verifyResponseCode, b6 as cryptoJsExports, c1 as openCtx, c2 as AsyncSerialScheduler_1, c3 as extensionForLanguage, c4 as isSourcegraphToken, c5 as _, c6 as toRangeData, c7 as DOTCOM_URL, c8 as base64Js, b4 as commonjsGlobal, c9 as NetworkError, ca as isRateLimitError, cb as isAuthError, t as telemetryRecorder, cc as semver, cd as NO_INITIAL_VALUE, ce as distinctUntilChanged$1, cf as SourcegraphGraphQLAPIClient, cg as isNetworkLikeError, ch as NoOpTelemetryRecorderProvider, ci as TimestampTelemetryProcessor_1, cj as updateGlobalTelemetryInstances, ck as TelemetryRecorderProvider, cl as telemetryRecorderProvider, cm as convertGitCloneURLToCodebaseName, cn as subscriptionDisposable, d as dedent$1, co as uriExtname, cp as SUPPORTED_URI_SCHEMAS, cq as require$$1$4, cr as dedupeWith$1, cs as getEditorInsertSpaces, ct as TimeoutError, cu as getActiveTraceAndSpanId, cv as isNetworkError, cw as trace, bi as isCodyProModel, b5 as CodyTaskState, aS as createExtensionAPI, aT as createMessageAPIForWebview, bd as isEqual, cx as getAugmentedNamespace, cy as main$1, cz as setUserAgent, cA as TESTING_TELEMETRY_EXPORTER, cB as dist, cC as waitUntilComplete, bl as isMacOS, bk as CustomCommandType, bw as setDisplayPathEnvInfo, bs as ACCOUNT_USAGE_URL, T as TokenCounterUtils, C as ContextItemSource, cD as _root, cE as _baseGetTag, cF as isObjectLike_1, cG as isObject_1, bv as isErrorLike, at as displayPath, cH as DefaultChatCommands, cI as uriParseNameAndExtension, cJ as uriDirname, cK as DefaultEditCommands, an as FILE_CONTEXT_MENTION_PROVIDER, ao as SYMBOL_CONTEXT_MENTION_PROVIDER, ap as REMOTE_REPOSITORY_PROVIDER_URI, cL as promiseFactoryToObservable, cM as webMentionProvidersMetadata, cN as allMentionProvidersMetadata, cO as combineLatest$1, cP as expandToLineRange, am as displayPathBasename, au as displayLineRange, cQ as truncateTextNearestLine, cR as TokenCounter, bp as View, aP as parseMentionQuery, cS as tracer, bc as isAbortErrorOrSocketHangUp, cT as isContextWindowLimitError, cU as truncatePromptString, cV as inputTextWithoutContextChipsFromPromptEditorState, bb as reformatBotMessageForChat, b0 as hydrateAfterPostMessage, cW as addMessageListenersForExtensionAPI, cX as createMessageAPIForExtension, cY as startWith$1, cZ as promiseToObservable$1, c_ as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, c$ as editorStateFromPromptString, d0 as getEditorTabSize$1, bh as pluralize, d1 as AbortError, d2 as psDedent, d3 as getEditorIndentString, b8 as RateLimitError$1, d4 as logResponseHeadersToSpan, d5 as TracedError, d6 as isNodeResponse, d7 as SpanStatusCode, d8 as assertFileURI, aq as REMOTE_FILE_PROVIDER_URI, ar as REMOTE_DIRECTORY_PROVIDER_URI, as as WEB_PROVIDER_URI, d9 as setOpenCtx, da as GIT_OPENCTX_PROVIDER_URI, db as ACCOUNT_UPGRADE_URL, aY as scanForMentionTriggerInUserTextInput, ax as LARGE_FILE_WARNING_LABEL, dc as GENERAL_HELP_LABEL, dd as diffLines, de as languageFromFilename, df as ProgrammingLanguage, dg as truncatePromptStringStart, dh as posixFilePaths, di as CODY_DOC_URL, b9 as CODY_FEEDBACK_URL, dj as DISCORD_URL, dk as CODY_SUPPORT_URL, bt as getRelativeChatPeriod, dl as SG_BLOG_URL, dm as ACCOUNT_LIMITS_INFO_URL, dn as setLogger, dp as CODY_OLLAMA_DOCS_URL, bu as browser$3 } from "./browser-hDxNMh5y.mjs";
22
22
  function _mergeNamespaces(n, m) {
23
23
  for (var i = 0; i < m.length; i++) {
24
24
  const e = m[i];
@@ -8405,25 +8405,6 @@ class Typewriter {
8405
8405
  }
8406
8406
  }
8407
8407
  }
8408
- var DefaultChatCommands = /* @__PURE__ */ ((DefaultChatCommands2) => {
8409
- DefaultChatCommands2["Explain"] = "explain";
8410
- DefaultChatCommands2["Unit"] = "unit";
8411
- DefaultChatCommands2["Smell"] = "smell";
8412
- DefaultChatCommands2["Custom"] = "custom-chat";
8413
- return DefaultChatCommands2;
8414
- })(DefaultChatCommands || {});
8415
- var DefaultEditCommands = /* @__PURE__ */ ((DefaultEditCommands2) => {
8416
- DefaultEditCommands2["Test"] = "test";
8417
- DefaultEditCommands2["Doc"] = "doc";
8418
- DefaultEditCommands2["Edit"] = "edit";
8419
- DefaultEditCommands2["Custom"] = "custom-edit";
8420
- return DefaultEditCommands2;
8421
- })(DefaultEditCommands || {});
8422
- var CustomCommandType = /* @__PURE__ */ ((CustomCommandType2) => {
8423
- CustomCommandType2["Workspace"] = "workspace";
8424
- CustomCommandType2["User"] = "user";
8425
- return CustomCommandType2;
8426
- })(CustomCommandType || {});
8427
8408
  var define_process_default$j = { env: {} };
8428
8409
  var FeatureFlag = /* @__PURE__ */ ((FeatureFlag2) => {
8429
8410
  FeatureFlag2["TestFlagDoNotUse"] = "test-flag-do-not-use";
@@ -8439,12 +8420,17 @@ var FeatureFlag = /* @__PURE__ */ ((FeatureFlag2) => {
8439
8420
  FeatureFlag2["CodyAutocompleteFIMModelExperimentVariant3"] = "cody-autocomplete-fim-model-experiment-variant-3-v2";
8440
8421
  FeatureFlag2["CodyAutocompleteFIMModelExperimentVariant4"] = "cody-autocomplete-fim-model-experiment-variant-4-v2";
8441
8422
  FeatureFlag2["CodyAutocompleteClaude3"] = "cody-autocomplete-claude-3";
8442
- FeatureFlag2["CodyAutocompleteContextBfgMixed"] = "cody-autocomplete-context-bfg-mixed";
8443
8423
  FeatureFlag2["CodyAutocompleteUserLatency"] = "cody-autocomplete-user-latency";
8444
8424
  FeatureFlag2["CodyAutocompletePreloadingExperimentBaseFeatureFlag"] = "cody-autocomplete-preloading-experiment-flag";
8445
8425
  FeatureFlag2["CodyAutocompletePreloadingExperimentVariant1"] = "cody-autocomplete-preloading-experiment-variant-1";
8446
8426
  FeatureFlag2["CodyAutocompletePreloadingExperimentVariant2"] = "cody-autocomplete-preloading-experiment-variant-2";
8447
8427
  FeatureFlag2["CodyAutocompletePreloadingExperimentVariant3"] = "cody-autocomplete-preloading-experiment-variant-3";
8428
+ FeatureFlag2["CodyAutocompleteContextExperimentBaseFeatureFlag"] = "cody-autocomplete-context-experiment-flag";
8429
+ FeatureFlag2["CodyAutocompleteContextExperimentVariant1"] = "cody-autocomplete-context-experiment-variant-1";
8430
+ FeatureFlag2["CodyAutocompleteContextExperimentVariant2"] = "cody-autocomplete-context-experiment-variant-2";
8431
+ FeatureFlag2["CodyAutocompleteContextExperimentVariant3"] = "cody-autocomplete-context-experiment-variant-3";
8432
+ FeatureFlag2["CodyAutocompleteContextExperimentVariant4"] = "cody-autocomplete-context-experiment-variant-4";
8433
+ FeatureFlag2["CodyAutocompleteContextExperimentControl"] = "cody-autocomplete-context-experiment-control";
8448
8434
  FeatureFlag2["CodyAutocompleteContextExtendLanguagePool"] = "cody-autocomplete-context-extend-language-pool";
8449
8435
  FeatureFlag2["UseSscForCodySubscription"] = "use-ssc-for-cody-subscription";
8450
8436
  FeatureFlag2["CodyProTrialEnded"] = "cody-pro-trial-ended";
@@ -22780,7 +22766,7 @@ function requireBuffer() {
22780
22766
  if (hasRequiredBuffer) return buffer;
22781
22767
  hasRequiredBuffer = 1;
22782
22768
  (function(exports2) {
22783
- const base64 = requireBase64Js();
22769
+ const base64 = base64Js;
22784
22770
  const ieee7542 = requireIeee754();
22785
22771
  const customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
22786
22772
  exports2.Buffer = Buffer2;
@@ -38369,18 +38355,30 @@ const languages = {
38369
38355
  ...cQueries,
38370
38356
  ...cppQueries
38371
38357
  };
38358
+ let cached;
38359
+ function isRunningInsideAgent() {
38360
+ if (cached === void 0) {
38361
+ cached = workspace.getConfiguration().get("cody.advanced.agent.running", false);
38362
+ }
38363
+ return cached;
38364
+ }
38372
38365
  class CompletionProviderConfig {
38373
38366
  constructor() {
38374
38367
  __publicField2(this, "_config");
38375
38368
  __publicField2(this, "flagsToResolve", [
38376
- FeatureFlag.CodyAutocompleteContextBfgMixed,
38377
38369
  FeatureFlag.CodyAutocompleteUserLatency,
38378
38370
  FeatureFlag.CodyAutocompleteTracing,
38379
38371
  FeatureFlag.CodyAutocompleteContextExtendLanguagePool,
38380
38372
  FeatureFlag.CodyAutocompletePreloadingExperimentBaseFeatureFlag,
38381
38373
  FeatureFlag.CodyAutocompletePreloadingExperimentVariant1,
38382
38374
  FeatureFlag.CodyAutocompletePreloadingExperimentVariant2,
38383
- FeatureFlag.CodyAutocompletePreloadingExperimentVariant3
38375
+ FeatureFlag.CodyAutocompletePreloadingExperimentVariant3,
38376
+ FeatureFlag.CodyAutocompleteContextExperimentBaseFeatureFlag,
38377
+ FeatureFlag.CodyAutocompleteContextExperimentVariant1,
38378
+ FeatureFlag.CodyAutocompleteContextExperimentVariant2,
38379
+ FeatureFlag.CodyAutocompleteContextExperimentVariant3,
38380
+ FeatureFlag.CodyAutocompleteContextExperimentVariant4,
38381
+ FeatureFlag.CodyAutocompleteContextExperimentControl
38384
38382
  ]);
38385
38383
  }
38386
38384
  get config() {
@@ -38421,10 +38419,50 @@ class CompletionProviderConfig {
38421
38419
  return "jaccard-similarity";
38422
38420
  case "new-jaccard-similarity":
38423
38421
  return "new-jaccard-similarity";
38422
+ case "recent-edits":
38423
+ return "recent-edits";
38424
+ case "recent-edits-1m":
38425
+ return "recent-edits-1m";
38426
+ case "recent-edits-5m":
38427
+ return "recent-edits-5m";
38428
+ case "recent-edits-mixed":
38429
+ return "recent-edits-mixed";
38424
38430
  default:
38425
- return this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextBfgMixed) ? "bfg-mixed" : "jaccard-similarity";
38431
+ return this.experimentBasedContextStrategy();
38426
38432
  }
38427
38433
  }
38434
+ experimentBasedContextStrategy() {
38435
+ const defaultContextStrategy = "jaccard-similarity";
38436
+ const isContextExperimentFlagEnabled = this.getPrefetchedFlag(
38437
+ FeatureFlag.CodyAutocompleteContextExperimentBaseFeatureFlag
38438
+ );
38439
+ if (isRunningInsideAgent() || !isContextExperimentFlagEnabled) {
38440
+ return defaultContextStrategy;
38441
+ }
38442
+ const [variant1, variant2, variant3, variant4, control2] = [
38443
+ this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextExperimentVariant1),
38444
+ this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextExperimentVariant2),
38445
+ this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextExperimentVariant3),
38446
+ this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextExperimentVariant4),
38447
+ this.getPrefetchedFlag(FeatureFlag.CodyAutocompleteContextExperimentControl)
38448
+ ];
38449
+ if (variant1) {
38450
+ return "recent-edits-1m";
38451
+ }
38452
+ if (variant2) {
38453
+ return "recent-edits-5m";
38454
+ }
38455
+ if (variant3) {
38456
+ return "recent-edits-mixed";
38457
+ }
38458
+ if (variant4) {
38459
+ return "none";
38460
+ }
38461
+ if (control2) {
38462
+ return defaultContextStrategy;
38463
+ }
38464
+ return defaultContextStrategy;
38465
+ }
38428
38466
  getPreloadingExperimentGroup() {
38429
38467
  if (this.getPrefetchedFlag(FeatureFlag.CodyAutocompletePreloadingExperimentBaseFeatureFlag)) {
38430
38468
  if (this.getPrefetchedFlag(FeatureFlag.CodyAutocompletePreloadingExperimentVariant1)) {
@@ -43204,13 +43242,6 @@ function getEditDefaultProvidedRange(document2, selection) {
43204
43242
  }
43205
43243
  return;
43206
43244
  }
43207
- let cached;
43208
- function isRunningInsideAgent() {
43209
- if (cached === void 0) {
43210
- cached = workspace.getConfiguration().get("cody.advanced.agent.running", false);
43211
- }
43212
- return cached;
43213
- }
43214
43245
  class ContentProvider {
43215
43246
  constructor() {
43216
43247
  // This stores the content of the document for each task ID
@@ -44785,6 +44816,8 @@ class AgentTextEditor {
44785
44816
  );
44786
44817
  return selection;
44787
44818
  }
44819
+ set selection(newSelection) {
44820
+ }
44788
44821
  get selections() {
44789
44822
  return [this.selection];
44790
44823
  }
@@ -49431,7 +49464,7 @@ class CommandsProvider {
49431
49464
  * Used for retreiving context for the command field in custom command
49432
49465
  */
49433
49466
  async runShell(shell2) {
49434
- const { getContextFileFromShell } = await import("./shell-w-Sycwnw.mjs");
49467
+ const { getContextFileFromShell } = await import("./shell-CWTEC0Ll.mjs");
49435
49468
  return getContextFileFromShell(shell2);
49436
49469
  }
49437
49470
  /**
@@ -49442,7 +49475,7 @@ class CommandsProvider {
49442
49475
  if (!isFileURI(uri2)) {
49443
49476
  throw new Error("history only supported on local file paths");
49444
49477
  }
49445
- const { getContextFileFromGitLog } = await import("./git-log-DUAthDkb.mjs");
49478
+ const { getContextFileFromGitLog } = await import("./git-log-PGCFF8k9.mjs");
49446
49479
  return getContextFileFromGitLog(uri2, options);
49447
49480
  }
49448
49481
  dispose() {
@@ -52929,7 +52962,16 @@ async function getRepositoryMentions(query2, providerId) {
52929
52962
  }
52930
52963
  const repositories = dataOrError.search.results.repositories;
52931
52964
  const fzf = new Fzf(repositories, REPO_FZF_OPTIONS);
52932
- return fzf.find(cleanRegex(query2)).map((repository2) => createRepositoryMention(repository2.item, providerId));
52965
+ const localRepos = await (workspaceReposMonitor == null ? void 0 : workspaceReposMonitor.getRepoMetadata()) || [];
52966
+ return fzf.find(cleanRegex(query2)).map(
52967
+ (repository2) => createRepositoryMention(
52968
+ {
52969
+ ...repository2.item,
52970
+ current: !!localRepos.find(({ repoName }) => repoName === repository2.item.name)
52971
+ },
52972
+ providerId
52973
+ )
52974
+ );
52933
52975
  }
52934
52976
  function createRepositoryMention(repo, providerId) {
52935
52977
  return {
@@ -52939,7 +52981,7 @@ function createRepositoryMention(repo, providerId) {
52939
52981
  // By default, we show <title> <uri> in the mentions' menu.
52940
52982
  // As repo.url and repo.name are almost same, we do not want to show the uri.
52941
52983
  // So that is why we are setting the description to " " string.
52942
- description: " ",
52984
+ description: repo.current ? "Current" : " ",
52943
52985
  data: {
52944
52986
  repoId: repo.id,
52945
52987
  repoName: repo.name,
@@ -53457,7 +53499,7 @@ async function retrieveContextGracefully(promise, strategy) {
53457
53499
  logError$1("ChatController", `resolveContext > ${strategy}' (aborted)`);
53458
53500
  throw error;
53459
53501
  }
53460
- logError$1("ChatController", `resolveContext > ${strategy}' (error)`, error);
53502
+ logError$1("ChatController", `resolveContext > ${strategy} (error)`, error);
53461
53503
  return [];
53462
53504
  } finally {
53463
53505
  logDebug("ChatController", `resolveContext > ${strategy} (end)`);
@@ -54704,7 +54746,7 @@ class ChatController {
54704
54746
  ]);
54705
54747
  const resolvedExplicitMentionsPromise = resolveContextItems(
54706
54748
  this.editor,
54707
- [structuredMentions.symbols, structuredMentions.files].flat(),
54749
+ [structuredMentions.symbols, structuredMentions.files, structuredMentions.openCtx].flat(),
54708
54750
  text,
54709
54751
  signal2
54710
54752
  );
@@ -56450,8 +56492,9 @@ async function getContextFilesFromGitDiff(gitRepo) {
56450
56492
  continue;
56451
56493
  }
56452
56494
  const uri2 = (_a3 = diffFiles.find((p) => {
56453
- const diffPath = diff2.split("\n")[0];
56454
- return diffPath.split("").reverse().join("").startsWith(displayPath(p.uri).split("").reverse().join(""));
56495
+ var _a4;
56496
+ const diffPath = (_a4 = diff2.split("\n")) == null ? void 0 : _a4[0];
56497
+ return diffPath ? diffPath.split("").reverse().join("").startsWith(displayPath(p.uri).split("").reverse().join("")) : p.uri;
56455
56498
  })) == null ? void 0 : _a3.uri;
56456
56499
  if (!uri2 || !await doesFileExist(uri2)) {
56457
56500
  continue;
@@ -56585,7 +56628,7 @@ class CodySourceControl {
56585
56628
  async generate(scm) {
56586
56629
  var _a3, _b2;
56587
56630
  telemetryRecorder.recordEvent("cody.command.generate-commit", "executed");
56588
- const currentWorkspaceUri = (_b2 = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.uri;
56631
+ const currentWorkspaceUri = (scm == null ? void 0 : scm.rootUri) ?? ((_b2 = (_a3 = workspace.workspaceFolders) == null ? void 0 : _a3[0]) == null ? void 0 : _b2.uri);
56589
56632
  if (!this.gitAPI || !currentWorkspaceUri) {
56590
56633
  window$1.showInformationMessage("Git is not available in the current workspace.");
56591
56634
  return;
@@ -56875,6 +56918,75 @@ function fuseResults(retrievedSets, rankingIdentities) {
56875
56918
  }
56876
56919
  return fusedResults;
56877
56920
  }
56921
+ class DefaultCompletionsContextRanker {
56922
+ rankAndFuseContext(results) {
56923
+ if (this.containsRecentEditsBasedContext(results)) {
56924
+ return this.getRecentEditsBasedContextFusion(results);
56925
+ }
56926
+ return this.getRRFBasedContextFusion(results);
56927
+ }
56928
+ containsRecentEditsBasedContext(results) {
56929
+ return results.some((result) => result.identifier.includes("recent-edits"));
56930
+ }
56931
+ getRecentEditsBasedContextFusion(results) {
56932
+ const priorityBasedContextSnippets = this.splitPriorityBasedContextFusion(results, [
56933
+ "recent-edits"
56934
+ ]);
56935
+ const priorityContextSnippets = this.getLinearContextFusion(
56936
+ priorityBasedContextSnippets.priorityContext
56937
+ );
56938
+ const nonPriorityContextSnippets = this.getRRFBasedContextFusion(
56939
+ priorityBasedContextSnippets.nonPriorityContext
56940
+ );
56941
+ return /* @__PURE__ */ new Set([...priorityContextSnippets, ...nonPriorityContextSnippets]);
56942
+ }
56943
+ /**
56944
+ * Performs a split based on priority based retrievers and orders the the priority based retrievers based on the order of the retrieverPriority array.
56945
+ *
56946
+ * @param results - An array of RetrievedContextResults to be split.
56947
+ * @param retrieverPriority - An ordered array of strings representing priority retrievers. Rest of the retrievers are ranked using RRF.
56948
+ * @returns A seperate set of priority based and non-priority based context snippets.
56949
+ */
56950
+ splitPriorityBasedContextFusion(results, retrieverPriority) {
56951
+ const priorityBasedRetrievedContext = results.filter(
56952
+ (result) => retrieverPriority.includes(result.identifier)
56953
+ );
56954
+ const nonPriorityBasedRetrievedContext = results.filter(
56955
+ (result) => !retrieverPriority.includes(result.identifier)
56956
+ );
56957
+ const priorityMap = new Map(retrieverPriority.map((priority, index2) => [priority, index2]));
56958
+ const orderedPriorityBasedRetrievedContext = priorityBasedRetrievedContext.sort(
56959
+ (a, b) => priorityMap.get(a.identifier) - priorityMap.get(b.identifier)
56960
+ );
56961
+ return {
56962
+ priorityContext: orderedPriorityBasedRetrievedContext,
56963
+ nonPriorityContext: nonPriorityBasedRetrievedContext
56964
+ };
56965
+ }
56966
+ getRRFBasedContextFusion(results) {
56967
+ const fusedResults = fuseResults(
56968
+ results.map((r2) => r2.snippets),
56969
+ (result) => {
56970
+ if (typeof result.startLine === "undefined" || typeof result.endLine === "undefined") {
56971
+ return [result.uri.toString()];
56972
+ }
56973
+ const lineIds = [];
56974
+ for (let i = result.startLine; i <= result.endLine; i++) {
56975
+ lineIds.push(`${result.uri.toString()}:${i}`);
56976
+ }
56977
+ return lineIds;
56978
+ }
56979
+ );
56980
+ return fusedResults;
56981
+ }
56982
+ getLinearContextFusion(results) {
56983
+ const linearResults = [];
56984
+ for (const result of results) {
56985
+ linearResults.push(...Array.from(result.snippets));
56986
+ }
56987
+ return new Set(linearResults);
56988
+ }
56989
+ }
56878
56990
  class ContextMixer {
56879
56991
  constructor(strategyFactory) {
56880
56992
  this.strategyFactory = strategyFactory;
@@ -56917,19 +57029,8 @@ class ContextMixer {
56917
57029
  };
56918
57030
  })
56919
57031
  );
56920
- const fusedResults = fuseResults(
56921
- results.map((r2) => r2.snippets),
56922
- (result) => {
56923
- if (typeof result.startLine === "undefined" || typeof result.endLine === "undefined") {
56924
- return [result.uri.toString()];
56925
- }
56926
- const lineIds = [];
56927
- for (let i = result.startLine; i <= result.endLine; i++) {
56928
- lineIds.push(`${result.uri.toString()}:${i}`);
56929
- }
56930
- return lineIds;
56931
- }
56932
- );
57032
+ const contextRanker = new DefaultCompletionsContextRanker();
57033
+ const fusedResults = contextRanker.rankAndFuseContext(results);
56933
57034
  let totalChars = options.docContext.prefix.length + options.docContext.suffix.length;
56934
57035
  const mixedContext = [];
56935
57036
  const retrieverStats = {};
@@ -57004,7 +57105,11 @@ const htmlFamily = /* @__PURE__ */ new Set([
57004
57105
  // This omits vue and svelte as these languages usually do not
57005
57106
  // import CSS modules but define them in the same file instead.
57006
57107
  ]);
57007
- function shouldBeUsedAsContext(enableExtendedLanguagePool, baseLanguageId, languageId) {
57108
+ function shouldBeUsedAsContext({
57109
+ enableExtendedLanguagePool,
57110
+ baseLanguageId,
57111
+ languageId
57112
+ }) {
57008
57113
  if (baseLanguageId === languageId) {
57009
57114
  return true;
57010
57115
  }
@@ -57077,13 +57182,14 @@ class VSCodeDocumentHistory {
57077
57182
  if (ignoreSet.has(item.document.uri)) {
57078
57183
  continue;
57079
57184
  }
57080
- if (shouldBeUsedAsContext(
57081
- completionProviderConfig.getPrefetchedFlag(
57185
+ const params = {
57186
+ enableExtendedLanguagePool: completionProviderConfig.getPrefetchedFlag(
57082
57187
  FeatureFlag.CodyAutocompleteContextExtendLanguagePool
57083
57188
  ),
57084
57189
  baseLanguageId,
57085
- item.document.languageId
57086
- )) {
57190
+ languageId: item.document.languageId
57191
+ };
57192
+ if (shouldBeUsedAsContext(params)) {
57087
57193
  continue;
57088
57194
  }
57089
57195
  ret2.push(item);
@@ -156354,13 +156460,14 @@ class JaccardSimilarityRetriever extends CachedRetriever {
156354
156460
  if (!["file", "vscode-userdata"].includes(document2.uri.scheme)) {
156355
156461
  return;
156356
156462
  }
156357
- if (!shouldBeUsedAsContext(
156358
- completionProviderConfig.getPrefetchedFlag(
156463
+ const params = {
156464
+ enableExtendedLanguagePool: completionProviderConfig.getPrefetchedFlag(
156359
156465
  FeatureFlag.CodyAutocompleteContextExtendLanguagePool
156360
156466
  ),
156361
- curLang,
156362
- document2.languageId
156363
- )) {
156467
+ baseLanguageId: curLang,
156468
+ languageId: document2.languageId
156469
+ };
156470
+ if (!shouldBeUsedAsContext(params)) {
156364
156471
  return;
156365
156472
  }
156366
156473
  const endLine = Math.min(document2.lineCount, 1e4);
@@ -157362,6 +157469,165 @@ class LspLightRetriever {
157362
157469
  invalidateDocumentCache(event.document);
157363
157470
  }
157364
157471
  }
157472
+ class RecentEditsRetriever {
157473
+ constructor(maxAgeMs, workspace$1 = workspace) {
157474
+ // We use a map from the document URI to the set of tracked completions inside that document to
157475
+ // improve performance of the `onDidChangeTextDocument` event handler.
157476
+ __publicField2(this, "trackedDocuments", /* @__PURE__ */ new Map());
157477
+ __publicField2(this, "identifier", "recent-edits");
157478
+ __publicField2(this, "disposables", []);
157479
+ this.maxAgeMs = maxAgeMs;
157480
+ this.workspace = workspace$1;
157481
+ this.disposables.push(workspace$1.onDidChangeTextDocument(this.onDidChangeTextDocument.bind(this)));
157482
+ this.disposables.push(workspace$1.onDidRenameFiles(this.onDidRenameFiles.bind(this)));
157483
+ this.disposables.push(workspace$1.onDidDeleteFiles(this.onDidDeleteFiles.bind(this)));
157484
+ }
157485
+ async retrieve(options) {
157486
+ const rawDiffs = await this.getDiffAcrossDocuments();
157487
+ const diffs = this.filterCandidateDiffs(rawDiffs, options.document);
157488
+ diffs.sort((a, b) => b.latestChangeTimestamp - a.latestChangeTimestamp);
157489
+ const autocompleteContextSnippets = [];
157490
+ for (const diff2 of diffs) {
157491
+ const content = this.getCommentedPromptForCompletions(
157492
+ diff2.languageId,
157493
+ diff2.uri,
157494
+ diff2.diff
157495
+ ).toString();
157496
+ const autocompleteSnippet = {
157497
+ uri: diff2.uri,
157498
+ content
157499
+ };
157500
+ autocompleteContextSnippets.push(autocompleteSnippet);
157501
+ }
157502
+ return autocompleteContextSnippets;
157503
+ }
157504
+ async getDiffAcrossDocuments() {
157505
+ const diffs = [];
157506
+ const diffPromises = Array.from(this.trackedDocuments.entries()).map(
157507
+ async ([uri2, trackedDocument]) => {
157508
+ const diff2 = await this.getDiff(Uri.parse(uri2));
157509
+ if (diff2) {
157510
+ return {
157511
+ diff: diff2,
157512
+ uri: trackedDocument.uri,
157513
+ languageId: trackedDocument.languageId,
157514
+ latestChangeTimestamp: Math.max(
157515
+ ...trackedDocument.changes.map((c) => c.timestamp)
157516
+ )
157517
+ };
157518
+ }
157519
+ return null;
157520
+ }
157521
+ );
157522
+ const results = await Promise.all(diffPromises);
157523
+ diffs.push(...results.filter((result) => result !== null));
157524
+ return diffs;
157525
+ }
157526
+ getCommentedPromptForCompletions(languageId, filename, diff2) {
157527
+ const filePath = PromptString.fromDisplayPath(filename);
157528
+ const languageConfig = getLanguageConfig(languageId);
157529
+ const commentStart = languageConfig ? languageConfig.commentStart : ps`// `;
157530
+ const prompt = psDedent`${commentStart} Here is git diff of the recent change made to the file ${filePath} which is used to provide context for the completion:\n${diff2}`;
157531
+ return prompt;
157532
+ }
157533
+ filterCandidateDiffs(allDiffs, document2) {
157534
+ const filterCandidateDiffs = [];
157535
+ for (const diff2 of allDiffs) {
157536
+ const currentDocumentLanguageId = document2.languageId;
157537
+ const params = {
157538
+ enableExtendedLanguagePool: false,
157539
+ baseLanguageId: currentDocumentLanguageId,
157540
+ languageId: diff2.languageId
157541
+ };
157542
+ if (shouldBeUsedAsContext(params)) {
157543
+ filterCandidateDiffs.push(diff2);
157544
+ }
157545
+ }
157546
+ return filterCandidateDiffs;
157547
+ }
157548
+ isSupportedForLanguageId() {
157549
+ return true;
157550
+ }
157551
+ async getDiff(uri2) {
157552
+ if (await contextFiltersProvider.instance.isUriIgnored(uri2)) {
157553
+ return null;
157554
+ }
157555
+ const trackedDocument = this.trackedDocuments.get(uri2.toString());
157556
+ if (!trackedDocument) {
157557
+ return null;
157558
+ }
157559
+ const oldContent = trackedDocument.content;
157560
+ const newContent = applyChanges(
157561
+ oldContent,
157562
+ trackedDocument.changes.map((c) => c.change)
157563
+ );
157564
+ return PromptString.fromGitDiff(uri2, oldContent, newContent);
157565
+ }
157566
+ onDidChangeTextDocument(event) {
157567
+ let trackedDocument = this.trackedDocuments.get(event.document.uri.toString());
157568
+ if (!trackedDocument) {
157569
+ trackedDocument = this.trackDocument(event.document);
157570
+ }
157571
+ const now2 = Date.now();
157572
+ for (const change of event.contentChanges) {
157573
+ trackedDocument.changes.push({
157574
+ timestamp: now2,
157575
+ change
157576
+ });
157577
+ }
157578
+ this.reconcileOutdatedChanges();
157579
+ }
157580
+ onDidRenameFiles(event) {
157581
+ for (const file of event.files) {
157582
+ const trackedDocument = this.trackedDocuments.get(file.oldUri.toString());
157583
+ if (trackedDocument) {
157584
+ this.trackedDocuments.set(file.newUri.toString(), trackedDocument);
157585
+ this.trackedDocuments.delete(file.oldUri.toString());
157586
+ }
157587
+ }
157588
+ }
157589
+ onDidDeleteFiles(event) {
157590
+ for (const uri2 of event.files) {
157591
+ this.trackedDocuments.delete(uri2.toString());
157592
+ }
157593
+ }
157594
+ dispose() {
157595
+ this.trackedDocuments.clear();
157596
+ for (const disposable of this.disposables) {
157597
+ disposable.dispose();
157598
+ }
157599
+ }
157600
+ trackDocument(document2) {
157601
+ const trackedDocument = {
157602
+ content: document2.getText(),
157603
+ languageId: document2.languageId,
157604
+ uri: document2.uri,
157605
+ changes: []
157606
+ };
157607
+ this.trackedDocuments.set(document2.uri.toString(), trackedDocument);
157608
+ return trackedDocument;
157609
+ }
157610
+ reconcileOutdatedChanges() {
157611
+ const now2 = Date.now();
157612
+ for (const [, trackedDocument] of this.trackedDocuments) {
157613
+ const firstNonOutdatedChangeIndex = trackedDocument.changes.findIndex(
157614
+ (c) => now2 - c.timestamp < this.maxAgeMs
157615
+ );
157616
+ const outdatedChanges = trackedDocument.changes.slice(0, firstNonOutdatedChangeIndex);
157617
+ trackedDocument.content = applyChanges(
157618
+ trackedDocument.content,
157619
+ outdatedChanges.map((c) => c.change)
157620
+ );
157621
+ trackedDocument.changes = trackedDocument.changes.slice(firstNonOutdatedChangeIndex);
157622
+ }
157623
+ }
157624
+ }
157625
+ function applyChanges(content, changes) {
157626
+ for (const change of changes) {
157627
+ content = content.slice(0, change.rangeOffset) + change.text + content.slice(change.rangeOffset + change.rangeLength);
157628
+ }
157629
+ return content;
157630
+ }
157365
157631
  class DefaultContextStrategyFactory {
157366
157632
  constructor(contextStrategy, createBfgRetriever) {
157367
157633
  __publicField2(this, "disposables", []);
@@ -157371,6 +157637,24 @@ class DefaultContextStrategyFactory {
157371
157637
  switch (contextStrategy) {
157372
157638
  case "none":
157373
157639
  break;
157640
+ case "recent-edits":
157641
+ this.localRetriever = new RecentEditsRetriever(60 * 1e3);
157642
+ this.disposables.push(this.localRetriever);
157643
+ break;
157644
+ case "recent-edits-1m":
157645
+ this.localRetriever = new RecentEditsRetriever(60 * 1e3);
157646
+ this.disposables.push(this.localRetriever);
157647
+ break;
157648
+ case "recent-edits-5m":
157649
+ this.localRetriever = new RecentEditsRetriever(60 * 5 * 1e3);
157650
+ this.disposables.push(this.localRetriever);
157651
+ break;
157652
+ case "recent-edits-mixed":
157653
+ this.localRetriever = new RecentEditsRetriever(60 * 1e3);
157654
+ this.graphRetriever = new JaccardSimilarityRetriever();
157655
+ this.disposables.push(this.localRetriever);
157656
+ this.disposables.push(this.graphRetriever);
157657
+ break;
157374
157658
  case "tsc-mixed":
157375
157659
  this.localRetriever = new JaccardSimilarityRetriever();
157376
157660
  this.disposables.push(this.localRetriever);
@@ -157401,7 +157685,7 @@ class DefaultContextStrategyFactory {
157401
157685
  }
157402
157686
  }
157403
157687
  getStrategy(document2) {
157404
- var _a3, _b2, _c2;
157688
+ var _a3, _b2, _c2, _d2;
157405
157689
  const retrievers = [];
157406
157690
  switch (this.contextStrategy) {
157407
157691
  case "none": {
@@ -157433,12 +157717,24 @@ class DefaultContextStrategyFactory {
157433
157717
  retrievers.push(this.localRetriever);
157434
157718
  }
157435
157719
  break;
157436
- case "jaccard-similarity": {
157720
+ case "jaccard-similarity":
157721
+ case "recent-edits":
157722
+ case "recent-edits-1m":
157723
+ case "recent-edits-5m": {
157437
157724
  if (this.localRetriever) {
157438
157725
  retrievers.push(this.localRetriever);
157439
157726
  }
157440
157727
  break;
157441
157728
  }
157729
+ case "recent-edits-mixed": {
157730
+ if (this.localRetriever) {
157731
+ retrievers.push(this.localRetriever);
157732
+ }
157733
+ if ((_d2 = this.graphRetriever) == null ? void 0 : _d2.isSupportedForLanguageId(document2.languageId)) {
157734
+ retrievers.push(this.graphRetriever);
157735
+ }
157736
+ break;
157737
+ }
157442
157738
  }
157443
157739
  return { name: this.contextStrategy, retrievers };
157444
157740
  }
@@ -161126,20 +161422,19 @@ async function createProviderConfigHelper(params) {
161126
161422
  return null;
161127
161423
  }
161128
161424
  }
161129
- async function manuallyGetCompletionItemsForProvider(completionsProviderConfig, document2, position, context2) {
161425
+ async function manuallyGetCompletionItemsForProvider(config, document2, position, context2) {
161130
161426
  var _a3;
161131
- const result = await completionsProviderConfig.completionsProvider.provideInlineCompletionItems(
161427
+ const result = await config.completionsProvider.provideInlineCompletionItems(
161132
161428
  document2,
161133
161429
  position,
161134
161430
  context2,
161135
161431
  new CancellationTokenSource().token
161136
161432
  );
161137
- const model2 = completionsProviderConfig.modelName;
161138
- const provider = completionsProviderConfig.providerName;
161139
161433
  const completion = ((_a3 = result == null ? void 0 : result.items[0].insertText) == null ? void 0 : _a3.toString()) || "";
161140
161434
  return {
161141
- provider,
161142
- model: model2,
161435
+ provider: config.providerName,
161436
+ model: config.modelName,
161437
+ contextStrategy: config.contextStrategy,
161143
161438
  completion
161144
161439
  };
161145
161440
  }
@@ -161163,7 +161458,7 @@ async function triggerMultiModelAutocompletionsForComparison(allCompletionsProvi
161163
161458
  const completions = await Promise.all(allPromises);
161164
161459
  let completionsOutput = "";
161165
161460
  for (const result of completions) {
161166
- completionsOutput += `Model: ${result.model}
161461
+ completionsOutput += `Model: ${result.model} Context: ${result.contextStrategy}
161167
161462
  ${result.completion}
161168
161463
 
161169
161464
  `;
@@ -161190,7 +161485,8 @@ async function createInlineCompletionItemFromMultipleProviders({
161190
161485
  multiModelConfigsList.push({
161191
161486
  provider: currentProviderConfig.provider,
161192
161487
  model: currentProviderConfig.model,
161193
- enableExperimentalFireworksOverrides: currentProviderConfig.enableExperimentalFireworksOverrides ?? false
161488
+ enableExperimentalFireworksOverrides: currentProviderConfig.enableExperimentalFireworksOverrides ?? false,
161489
+ context: currentProviderConfig.context
161194
161490
  });
161195
161491
  }
161196
161492
  }
@@ -161200,7 +161496,8 @@ async function createInlineCompletionItemFromMultipleProviders({
161200
161496
  }
161201
161497
  };
161202
161498
  }
161203
- const allPromises = multiModelConfigsList.map(async (currentProviderConfig) => {
161499
+ const allCompletionsProviders = [];
161500
+ for (const currentProviderConfig of multiModelConfigsList) {
161204
161501
  const newConfig = {
161205
161502
  ...lodashExports.cloneDeep(config),
161206
161503
  // Override some config to ensure we are not logging extra events.
@@ -161208,8 +161505,10 @@ async function createInlineCompletionItemFromMultipleProviders({
161208
161505
  // We should only override the fireworks "cody.autocomplete.experimental.fireworksOptions" when added in the config.
161209
161506
  autocompleteExperimentalFireworksOptions: currentProviderConfig.enableExperimentalFireworksOverrides ? config.autocompleteExperimentalFireworksOptions : void 0,
161210
161507
  // Don't use the advanced provider config to get the model
161211
- autocompleteAdvancedModel: null
161508
+ autocompleteAdvancedModel: null,
161509
+ autocompleteExperimentalGraphContext: currentProviderConfig.context
161212
161510
  };
161511
+ completionProviderConfig.setConfig(newConfig);
161213
161512
  const providerConfig = await createProviderConfigHelper({
161214
161513
  client,
161215
161514
  authStatus,
@@ -161232,21 +161531,15 @@ async function createInlineCompletionItemFromMultipleProviders({
161232
161531
  isDotComUser: isDotCom(authStatus2.endpoint || ""),
161233
161532
  noInlineAccept: true
161234
161533
  });
161235
- return {
161534
+ allCompletionsProviders.push({
161236
161535
  providerName: currentProviderConfig.provider,
161237
161536
  modelName: currentProviderConfig.model,
161238
- completionsProvider
161239
- };
161240
- }
161241
- return void 0;
161242
- });
161243
- const allProviders = await Promise.all(allPromises);
161244
- const allCompletionsProviders = [];
161245
- for (const provider of allProviders) {
161246
- if (provider) {
161247
- allCompletionsProviders.push(provider);
161537
+ completionsProvider,
161538
+ contextStrategy: currentProviderConfig.context
161539
+ });
161248
161540
  }
161249
161541
  }
161542
+ completionProviderConfig.setConfig(config);
161250
161543
  disposables.push(
161251
161544
  commands$1.registerCommand(
161252
161545
  "cody.multi-model-autocomplete.manual-trigger",
@@ -161811,172 +162104,6 @@ class EnterpriseContextFactory {
161811
162104
  return this.workspaceRepoMapper;
161812
162105
  }
161813
162106
  }
161814
- const RemoteFileProvider = createRemoteFileProvider();
161815
- function createRemoteFileProvider(customTitle) {
161816
- return {
161817
- providerUri: REMOTE_FILE_PROVIDER_URI,
161818
- meta() {
161819
- return {
161820
- name: customTitle ?? "Remote Files",
161821
- mentions: {}
161822
- };
161823
- },
161824
- async mentions({ query: query2 }) {
161825
- const [repoName, filePath] = (query2 == null ? void 0 : query2.split(":")) || [];
161826
- if (!(query2 == null ? void 0 : query2.includes(":")) || !repoName.trim()) {
161827
- return await getRepositoryMentions((query2 == null ? void 0 : query2.trim()) ?? "", REMOTE_FILE_PROVIDER_URI);
161828
- }
161829
- return await getFileMentions(repoName, filePath.trim());
161830
- },
161831
- async items({ mention }) {
161832
- var _a3, _b2;
161833
- if (!((_a3 = mention == null ? void 0 : mention.data) == null ? void 0 : _a3.repoName) || !((_b2 = mention == null ? void 0 : mention.data) == null ? void 0 : _b2.filePath)) {
161834
- return [];
161835
- }
161836
- return await getFileItem(
161837
- mention.data.repoName,
161838
- mention.data.filePath,
161839
- mention.data.rev
161840
- );
161841
- }
161842
- };
161843
- }
161844
- async function getFileMentions(repoName, filePath) {
161845
- const repoRe = `^${escapeRegExp(repoName)}$`;
161846
- const fileRe = filePath ? escapeRegExp(filePath) : "^.*$";
161847
- const query2 = `repo:${repoRe} file:${fileRe} type:file count:10`;
161848
- const dataOrError = await graphqlClient.searchFileMatches(query2);
161849
- if (isError$1(dataOrError) || dataOrError === null) {
161850
- return [];
161851
- }
161852
- return dataOrError.search.results.results.map((result) => {
161853
- if (result.__typename !== "FileMatch") {
161854
- return null;
161855
- }
161856
- const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${result.file.url}`;
161857
- const basename2 = displayPathBasename(URI.parse(result.file.path));
161858
- return {
161859
- uri: url,
161860
- title: basename2,
161861
- description: result.file.path,
161862
- data: {
161863
- repoName: result.repository.name,
161864
- rev: result.file.commit.oid,
161865
- filePath: result.file.path
161866
- }
161867
- };
161868
- }).filter(isDefined);
161869
- }
161870
- async function getFileItem(repoName, filePath, rev2 = "HEAD") {
161871
- var _a3, _b2;
161872
- const dataOrError = await graphqlClient.getFileContents(repoName, filePath, rev2);
161873
- if (isError$1(dataOrError)) {
161874
- return [];
161875
- }
161876
- const file = (_b2 = (_a3 = dataOrError == null ? void 0 : dataOrError.repository) == null ? void 0 : _a3.commit) == null ? void 0 : _b2.file;
161877
- if (!file) {
161878
- return [];
161879
- }
161880
- const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${file.url}`;
161881
- return [
161882
- {
161883
- url,
161884
- title: `${repoName}/${file.path}`,
161885
- ai: {
161886
- content: file.content
161887
- }
161888
- }
161889
- ];
161890
- }
161891
- function escapeRegExp(str) {
161892
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
161893
- }
161894
- const CurrentRepositoryDirectoryProvider = createCurrentRepositoryDirectoryProvider();
161895
- function createCurrentRepositoryDirectoryProvider(customTitle) {
161896
- return {
161897
- providerUri: CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI,
161898
- meta() {
161899
- return {
161900
- name: "Directories",
161901
- mentions: {}
161902
- };
161903
- },
161904
- async mentions({ query: query2 }) {
161905
- var _a3, _b2;
161906
- const currentFile = (_a3 = getEditor().active) == null ? void 0 : _a3.document.uri;
161907
- const workspace$1 = (_b2 = workspace.workspaceFolders) == null ? void 0 : _b2[0].uri;
161908
- if (currentFile || workspace$1) {
161909
- const remote = (await repoNameResolver.getRepoNamesFromWorkspaceUri(
161910
- currentFile || workspace$1
161911
- ))[0];
161912
- if (remote) {
161913
- const workspaceRepoMapper = new WorkspaceRepoMapper();
161914
- const currentRepo = await workspaceRepoMapper.repoForCodebase(remote);
161915
- if (currentRepo) {
161916
- return await getDirectoryMentions(currentRepo.name, query2 == null ? void 0 : query2.trim());
161917
- }
161918
- }
161919
- }
161920
- return [];
161921
- },
161922
- async items({ mention, message }) {
161923
- var _a3, _b2;
161924
- if (!((_a3 = mention == null ? void 0 : mention.data) == null ? void 0 : _a3.repoID) || !((_b2 = mention == null ? void 0 : mention.data) == null ? void 0 : _b2.directoryPath) || !message) {
161925
- return [];
161926
- }
161927
- return await getDirectoryItem(
161928
- message,
161929
- mention.data.repoID,
161930
- mention.data.directoryPath
161931
- );
161932
- }
161933
- };
161934
- }
161935
- async function getDirectoryMentions(repoName, directoryPath) {
161936
- const repoRe = `^${escapeRegExp(repoName)}$`;
161937
- const directoryRe = directoryPath ? escapeRegExp(directoryPath) : "";
161938
- const query2 = `repo:${repoRe} file:${directoryRe}.*/.* select:file.directory count:10`;
161939
- const dataOrError = await graphqlClient.searchFileMatches(query2);
161940
- if (isError$1(dataOrError) || dataOrError === null) {
161941
- return [];
161942
- }
161943
- return dataOrError.search.results.results.map((result) => {
161944
- if (result.__typename !== "FileMatch") {
161945
- return null;
161946
- }
161947
- const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${result.file.url}`;
161948
- return {
161949
- uri: url,
161950
- title: result.file.path,
161951
- description: "",
161952
- data: {
161953
- repoName: result.repository.name,
161954
- repoID: result.repository.id,
161955
- rev: result.file.commit.oid,
161956
- directoryPath: result.file.path
161957
- }
161958
- };
161959
- }).filter(isDefined);
161960
- }
161961
- async function getDirectoryItem(query2, repoID, directoryPath) {
161962
- const dataOrError = await graphqlClient.contextSearch({
161963
- repoIDs: [repoID],
161964
- query: query2,
161965
- filePatterns: [directoryPath]
161966
- });
161967
- if (isError$1(dataOrError) || dataOrError === null) {
161968
- return [];
161969
- }
161970
- return dataOrError.map(
161971
- (node) => ({
161972
- url: node.uri.toString(),
161973
- title: node.path,
161974
- ai: {
161975
- content: node.content
161976
- }
161977
- })
161978
- );
161979
- }
161980
162107
  const gitMentionsProvider = {
161981
162108
  meta() {
161982
162109
  return { name: "Git", mentions: {} };
@@ -164080,6 +164207,86 @@ const LinearIssuesProvider = {
164080
164207
  providerUri: "internal-linear-issues",
164081
164208
  ...linear_issues_default
164082
164209
  };
164210
+ const RemoteFileProvider = createRemoteFileProvider();
164211
+ function createRemoteFileProvider(customTitle) {
164212
+ return {
164213
+ providerUri: REMOTE_FILE_PROVIDER_URI,
164214
+ meta() {
164215
+ return {
164216
+ name: customTitle ?? "Remote Files",
164217
+ mentions: {}
164218
+ };
164219
+ },
164220
+ async mentions({ query: query2 }) {
164221
+ const [repoName, filePath] = (query2 == null ? void 0 : query2.split(":")) || [];
164222
+ if (!(query2 == null ? void 0 : query2.includes(":")) || !repoName.trim()) {
164223
+ return await getRepositoryMentions((query2 == null ? void 0 : query2.trim()) ?? "", REMOTE_FILE_PROVIDER_URI);
164224
+ }
164225
+ return await getFileMentions(repoName, filePath.trim());
164226
+ },
164227
+ async items({ mention }) {
164228
+ var _a3, _b2;
164229
+ if (!((_a3 = mention == null ? void 0 : mention.data) == null ? void 0 : _a3.repoName) || !((_b2 = mention == null ? void 0 : mention.data) == null ? void 0 : _b2.filePath)) {
164230
+ return [];
164231
+ }
164232
+ return await getFileItem(
164233
+ mention.data.repoName,
164234
+ mention.data.filePath,
164235
+ mention.data.rev
164236
+ );
164237
+ }
164238
+ };
164239
+ }
164240
+ async function getFileMentions(repoName, filePath) {
164241
+ const repoRe = `^${escapeRegExp(repoName)}$`;
164242
+ const fileRe = filePath ? escapeRegExp(filePath) : "^.*$";
164243
+ const query2 = `repo:${repoRe} file:${fileRe} type:file count:10`;
164244
+ const dataOrError = await graphqlClient.searchFileMatches(query2);
164245
+ if (isError$1(dataOrError) || dataOrError === null) {
164246
+ return [];
164247
+ }
164248
+ return dataOrError.search.results.results.map((result) => {
164249
+ if (result.__typename !== "FileMatch") {
164250
+ return null;
164251
+ }
164252
+ const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${result.file.url}`;
164253
+ const basename2 = displayPathBasename(URI.parse(result.file.path));
164254
+ return {
164255
+ uri: url,
164256
+ title: basename2,
164257
+ description: result.file.path,
164258
+ data: {
164259
+ repoName: result.repository.name,
164260
+ rev: result.file.commit.oid,
164261
+ filePath: result.file.path
164262
+ }
164263
+ };
164264
+ }).filter(isDefined);
164265
+ }
164266
+ async function getFileItem(repoName, filePath, rev2 = "HEAD") {
164267
+ var _a3, _b2;
164268
+ const dataOrError = await graphqlClient.getFileContents(repoName, filePath, rev2);
164269
+ if (isError$1(dataOrError)) {
164270
+ return [];
164271
+ }
164272
+ const file = (_b2 = (_a3 = dataOrError == null ? void 0 : dataOrError.repository) == null ? void 0 : _a3.commit) == null ? void 0 : _b2.file;
164273
+ if (!file) {
164274
+ return [];
164275
+ }
164276
+ const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${file.url}`;
164277
+ return [
164278
+ {
164279
+ url,
164280
+ title: `${repoName}/${file.path}`,
164281
+ ai: {
164282
+ content: file.content
164283
+ }
164284
+ }
164285
+ ];
164286
+ }
164287
+ function escapeRegExp(str) {
164288
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
164289
+ }
164083
164290
  const RemoteDirectoryProvider = createRemoteDirectoryProvider();
164084
164291
  function createRemoteDirectoryProvider(customTitle) {
164085
164292
  return {
@@ -164110,6 +164317,51 @@ function createRemoteDirectoryProvider(customTitle) {
164110
164317
  }
164111
164318
  };
164112
164319
  }
164320
+ async function getDirectoryMentions(repoName, directoryPath) {
164321
+ const repoRe = `^${escapeRegExp(repoName)}$`;
164322
+ const directoryRe = directoryPath ? escapeRegExp(directoryPath) : "";
164323
+ const query2 = `repo:${repoRe} file:${directoryRe}.*/.* select:file.directory count:10`;
164324
+ const dataOrError = await graphqlClient.searchFileMatches(query2);
164325
+ if (isError$1(dataOrError) || dataOrError === null) {
164326
+ return [];
164327
+ }
164328
+ return dataOrError.search.results.results.map((result) => {
164329
+ if (result.__typename !== "FileMatch") {
164330
+ return null;
164331
+ }
164332
+ const url = `${graphqlClient.endpoint.replace(/\/$/, "")}${result.file.url}`;
164333
+ return {
164334
+ uri: url,
164335
+ title: result.file.path,
164336
+ description: " ",
164337
+ data: {
164338
+ repoName: result.repository.name,
164339
+ repoID: result.repository.id,
164340
+ rev: result.file.commit.oid,
164341
+ directoryPath: result.file.path
164342
+ }
164343
+ };
164344
+ }).filter(isDefined);
164345
+ }
164346
+ async function getDirectoryItem(query2, repoID, directoryPath) {
164347
+ const dataOrError = await graphqlClient.contextSearch({
164348
+ repoIDs: [repoID],
164349
+ query: query2,
164350
+ filePatterns: [`^${directoryPath}.*`]
164351
+ });
164352
+ if (isError$1(dataOrError) || dataOrError === null) {
164353
+ return [];
164354
+ }
164355
+ return dataOrError.map(
164356
+ (node) => ({
164357
+ url: node.uri.toString(),
164358
+ title: node.path,
164359
+ ai: {
164360
+ content: node.content
164361
+ }
164362
+ })
164363
+ );
164364
+ }
164113
164365
  const RemoteRepositorySearch = createRemoteRepositoryProvider();
164114
164366
  function createRemoteRepositoryProvider(customTitle) {
164115
164367
  return {
@@ -164299,11 +164551,6 @@ function getOpenCtxProviders(configChanges, authStatusChanges, isValidSiteVersio
164299
164551
  provider: RemoteDirectoryProvider,
164300
164552
  providerUri: RemoteDirectoryProvider.providerUri
164301
164553
  });
164302
- providers.push({
164303
- settings: true,
164304
- provider: CurrentRepositoryDirectoryProvider,
164305
- providerUri: CURRENT_REPOSITORY_DIRECTORY_PROVIDER_URI
164306
- });
164307
164554
  }
164308
164555
  providers.push({
164309
164556
  settings: true,
@@ -167897,6 +168144,14 @@ class EditManager {
167897
168144
  model: task.model
167898
168145
  }
167899
168146
  });
168147
+ if (editor.active && (intent === "doc" || intent === "test")) {
168148
+ const newPosition = proposedRange.start;
168149
+ editor.active.selection = new Selection(newPosition, newPosition);
168150
+ editor.active.revealRange(
168151
+ new Range(newPosition, newPosition),
168152
+ TextEditorRevealType.InCenter
168153
+ );
168154
+ }
167900
168155
  const provider = this.getProviderForTask(task);
167901
168156
  await provider.startEdit();
167902
168157
  return task;
@@ -170962,96 +171217,6 @@ function removeContextRows(document2, supercompletion) {
170962
171217
  updated: newUpdated
170963
171218
  };
170964
171219
  }
170965
- class RecentEditsRetriever {
170966
- constructor(maxAgeMs, workspace$1 = workspace) {
170967
- __publicField2(this, "disposables", []);
170968
- // We use a map from the document URI to the set of tracked completions inside that document to
170969
- // improve performance of the `onDidChangeTextDocument` event handler.
170970
- __publicField2(this, "trackedDocuments", /* @__PURE__ */ new Map());
170971
- this.maxAgeMs = maxAgeMs;
170972
- this.workspace = workspace$1;
170973
- this.disposables.push(workspace$1.onDidChangeTextDocument(this.onDidChangeTextDocument.bind(this)));
170974
- this.disposables.push(workspace$1.onDidRenameFiles(this.onDidRenameFiles.bind(this)));
170975
- this.disposables.push(workspace$1.onDidDeleteFiles(this.onDidDeleteFiles.bind(this)));
170976
- }
170977
- async getDiff(uri2) {
170978
- if (await contextFiltersProvider.instance.isUriIgnored(uri2)) {
170979
- return null;
170980
- }
170981
- const trackedDocument = this.trackedDocuments.get(uri2.toString());
170982
- if (!trackedDocument) {
170983
- return null;
170984
- }
170985
- const oldContent = trackedDocument.content;
170986
- const newContent = applyChanges(
170987
- oldContent,
170988
- trackedDocument.changes.map((c) => c.change)
170989
- );
170990
- return PromptString.fromGitDiff(uri2, oldContent, newContent);
170991
- }
170992
- onDidChangeTextDocument(event) {
170993
- let trackedDocument = this.trackedDocuments.get(event.document.uri.toString());
170994
- if (!trackedDocument) {
170995
- trackedDocument = this.trackDocument(event.document);
170996
- }
170997
- const now2 = Date.now();
170998
- for (const change of event.contentChanges) {
170999
- trackedDocument.changes.push({
171000
- timestamp: now2,
171001
- change
171002
- });
171003
- }
171004
- this.reconcileOutdatedChanges();
171005
- }
171006
- onDidRenameFiles(event) {
171007
- for (const file of event.files) {
171008
- const trackedDocument = this.trackedDocuments.get(file.oldUri.toString());
171009
- if (trackedDocument) {
171010
- this.trackedDocuments.set(file.newUri.toString(), trackedDocument);
171011
- this.trackedDocuments.delete(file.oldUri.toString());
171012
- }
171013
- }
171014
- }
171015
- onDidDeleteFiles(event) {
171016
- for (const uri2 of event.files) {
171017
- this.trackedDocuments.delete(uri2.toString());
171018
- }
171019
- }
171020
- dispose() {
171021
- this.trackedDocuments.clear();
171022
- for (const disposable of this.disposables) {
171023
- disposable.dispose();
171024
- }
171025
- }
171026
- trackDocument(document2) {
171027
- const trackedDocument = {
171028
- content: document2.getText(),
171029
- changes: []
171030
- };
171031
- this.trackedDocuments.set(document2.uri.toString(), trackedDocument);
171032
- return trackedDocument;
171033
- }
171034
- reconcileOutdatedChanges() {
171035
- const now2 = Date.now();
171036
- for (const [, trackedDocument] of this.trackedDocuments) {
171037
- const firstNonOutdatedChangeIndex = trackedDocument.changes.findIndex(
171038
- (c) => now2 - c.timestamp < this.maxAgeMs
171039
- );
171040
- const outdatedChanges = trackedDocument.changes.slice(0, firstNonOutdatedChangeIndex);
171041
- trackedDocument.content = applyChanges(
171042
- trackedDocument.content,
171043
- outdatedChanges.map((c) => c.change)
171044
- );
171045
- trackedDocument.changes = trackedDocument.changes.slice(firstNonOutdatedChangeIndex);
171046
- }
171047
- }
171048
- }
171049
- function applyChanges(content, changes) {
171050
- for (const change of changes) {
171051
- content = content.slice(0, change.rangeOffset) + change.text + content.slice(change.rangeOffset + change.rangeLength);
171052
- }
171053
- return content;
171054
- }
171055
171220
  const GHOST_TEXT_COLOR = new ThemeColor("editorGhostText.foreground");
171056
171221
  const reviewHintDecorationType = window$1.createTextEditorDecorationType({
171057
171222
  after: {
@@ -171792,7 +171957,7 @@ async function registerDebugCommands(context2, disposables) {
171792
171957
  }
171793
171958
  async function tryRegisterTutorial(context2, disposables) {
171794
171959
  if (!isRunningInsideAgent()) {
171795
- const { registerInteractiveTutorial } = await import("./index-2bvntcGe.mjs");
171960
+ const { registerInteractiveTutorial } = await import("./index-CoR5ltqq.mjs");
171796
171961
  registerInteractiveTutorial(context2).then((disposable) => disposables.push(...disposable));
171797
171962
  }
171798
171963
  }