@sourcegraph/cody-web 0.8.0 → 0.8.1

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 { bz as Observable, bA as unsubscribe, bB as AsyncSerialScheduler, bC as fromLateSetSource, bD as shareReplay$1, bE as map$1, bF as firstValueFrom$1, bG as distinctUntilChanged$1, bH as DOTCOM_URL, bI as logError$2, bJ as createSubscriber, bK as isDotCom, bL as graphqlClient, bM as fromVSCodeEvent, aU as lodashExports, bN as logDebug$1, bO as isFileURI, w as wrapInActiveSpan, bP as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bQ as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bR as isAbortError, b7 as isError$1, ba as isDefined, bS as onAbort, bT as CHAT_OUTPUT_TOKEN_BUDGET, bj as ModelTag, bU as getModelInfo, br as CHAT_INPUT_TOKEN_BUDGET, b2 as CodyIDE, bV as MulticastSubject, bW as isEnterpriseUser, b1 as isCodyProUser, bX as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bY as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, p as ps, bZ as ClientConfigSingleton, by as PromptString, b_ as isCustomModel, b$ as recordErrorToSpan, c0 as dependentAbortController, c1 as addCustomUserAgent, c2 as addTraceparent, c3 as fetch$2, c4 as verifyResponseCode, b6 as cryptoJsExports, c5 as openCtx, aK as URI, c6 as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, c7 as Utils$1, c8 as extensionForLanguage, c9 as startWith$1, ca as isSourcegraphToken, cb as _, cc as toRangeData, cd as requireBase64Js, b4 as commonjsGlobal, ce as NetworkError, cf as isRateLimitError, cg as isAuthError, ch as NoOpTelemetryRecorderProvider, ci as TimestampTelemetryProcessor_1, cj as updateGlobalTelemetryInstances, ck as TelemetryRecorderProvider, t as telemetryRecorder, cl as telemetryRecorderProvider, cm as createGitDiff, cn as currentAuthStatus, co as semver, cp as setAuthStatusObservable, cq as SourcegraphGraphQLAPIClient, cr as isNetworkLikeError, cs as authStatus, ct as convertGitCloneURLToCodebaseName, cu as subscriptionDisposable, cv as combineLatest$1, d as dedent$1, cw as uriExtname, cx as uriBasename, cy as SUPPORTED_URI_SCHEMAS, cz as require$$1$4, cA as dedupeWith$1, cB as getEditorInsertSpaces, cC as TimeoutError, cD as getActiveTraceAndSpanId, cE as isNetworkError, cF as currentAuthStatusAuthed, cG as trace, bi as isCodyProModel, cH as http, b5 as CodyTaskState, aS as createExtensionAPI, aT as createMessageAPIForWebview, bd as isEqual, cI as getAugmentedNamespace, cJ as main$1, cK as setUserAgent, cL as TESTING_TELEMETRY_EXPORTER, cM as dist, cN as waitUntilComplete, bl as isMacOS, bk as CustomCommandType, bx as setDisplayPathEnvInfo, cO as isWindows, bs as ACCOUNT_USAGE_URL, T as TokenCounterUtils, C as ContextItemSource, cP as _root, cQ as _baseGetTag, cR as isObjectLike_1, cS as isObject_1, bw as isErrorLike, as as displayPath, cT as DefaultChatCommands, cU as pathFunctionsForURI, cV as uriParseNameAndExtension, cW as uriDirname, cX as DefaultEditCommands, am as FILE_CONTEXT_MENTION_PROVIDER, an as SYMBOL_CONTEXT_MENTION_PROVIDER, ao as REMOTE_REPOSITORY_PROVIDER_URI, cY as promiseFactoryToObservable, cZ as mentionProvidersMetadata, c_ as expandToLineRange, av as displayPathBasename, at as displayLineRange, c$ as truncateTextNearestLine, d0 as TokenCounter, d1 as createDisposables, bp as View, aP as parseMentionQuery, d2 as tracer, bc as isAbortErrorOrSocketHangUp, d3 as isContextWindowLimitError, d4 as truncatePromptString, d5 as inputTextWithoutContextChipsFromPromptEditorState, bb as reformatBotMessageForChat, b0 as hydrateAfterPostMessage, d6 as addMessageListenersForExtensionAPI, d7 as createMessageAPIForExtension, d8 as promiseToObservable$1, d9 as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, da as editorStateFromPromptString, db as getEditorTabSize$1, bh as pluralize, dc as mergeMap$1, dd as AbortError, de as psDedent, df as getEditorIndentString, b8 as RateLimitError$1, dg as logResponseHeadersToSpan, dh as TracedError, di as isNodeResponse, dj as SpanStatusCode, dk as assertFileURI, ap as REMOTE_FILE_PROVIDER_URI, aq as REMOTE_DIRECTORY_PROVIDER_URI, ar as WEB_PROVIDER_URI, dl as setOpenCtx, dm as pluck, dn as GIT_OPENCTX_PROVIDER_URI, bt as ACCOUNT_UPGRADE_URL, aY as scanForMentionTriggerInUserTextInput, ax as LARGE_FILE_WARNING_LABEL, dp as GENERAL_HELP_LABEL, dq as diffLines, dr as languageFromFilename, ds as ProgrammingLanguage, dt as truncatePromptStringStart, du as posixFilePaths, dv as CODY_DOC_URL, b9 as CODY_FEEDBACK_URL, dw as DISCORD_URL, dx as CODY_SUPPORT_URL, bu as getRelativeChatPeriod, dy as SG_CHANGELOG_URL, dz as ACCOUNT_LIMITS_INFO_URL, dA as setLogger, dB as CODY_OLLAMA_DOCS_URL, dC as currentAuthStatusOrNotReadyYet, bv as browser$3 } from "./browser-7p2xtDk0.mjs";
21
+ import { bA as Observable, bB as unsubscribe, bC as AsyncSerialScheduler, bD as fromLateSetSource, bE as shareReplay$1, bF as map$1, bG as firstValueFrom$1, bH as distinctUntilChanged$1, bI as DOTCOM_URL, bJ as logError$2, bK as createSubscriber, bL as isDotCom, bM as graphqlClient, bN as fromVSCodeEvent, aU as lodashExports, bO as logDebug$1, bP as isFileURI, w as wrapInActiveSpan, bQ as INCLUDE_EVERYTHING_CONTEXT_FILTERS, bR as EXCLUDE_EVERYTHING_CONTEXT_FILTERS, bS as isAbortError, b7 as isError$1, ba as isDefined, bT as onAbort, bU as CHAT_OUTPUT_TOKEN_BUDGET, bj as ModelTag, bV as getModelInfo, bs as CHAT_INPUT_TOKEN_BUDGET, b2 as CodyIDE, bW as MulticastSubject, bX as isEnterpriseUser, b1 as isCodyProUser, bY as EXTENDED_CHAT_INPUT_TOKEN_BUDGET, bZ as EXTENDED_USER_CONTEXT_TOKEN_BUDGET, p as ps, b_ as ClientConfigSingleton, bz as PromptString, b$ as isCustomModel, c0 as recordErrorToSpan, c1 as dependentAbortController, c2 as addCustomUserAgent, c3 as addTraceparent, c4 as fetch$2, c5 as verifyResponseCode, b6 as cryptoJsExports, c6 as openCtx, aK as URI, c7 as AsyncSerialScheduler_1, g as getDefaultExportFromCjs, c8 as Utils$1, c9 as extensionForLanguage, ca as startWith$1, cb as isSourcegraphToken, cc as _, cd as toRangeData, ce as requireBase64Js, b4 as commonjsGlobal, cf as NetworkError, cg as isRateLimitError, ch as isAuthError, ci as NoOpTelemetryRecorderProvider, cj as TimestampTelemetryProcessor_1, ck as updateGlobalTelemetryInstances, cl as TelemetryRecorderProvider, t as telemetryRecorder, cm as telemetryRecorderProvider, cn as createGitDiff, co as currentAuthStatus, cp as semver, cq as setAuthStatusObservable, cr as SourcegraphGraphQLAPIClient, cs as isNetworkLikeError, ct as authStatus, cu as convertGitCloneURLToCodebaseName, cv as subscriptionDisposable, cw as combineLatest$1, d as dedent$1, cx as uriExtname, cy as uriBasename, cz as SUPPORTED_URI_SCHEMAS, cA as require$$1$4, cB as dedupeWith$1, cC as getEditorInsertSpaces, cD as TimeoutError, cE as isDotComAuthed, cF as getActiveTraceAndSpanId, cG as isNetworkError, cH as currentAuthStatusAuthed, cI as trace, bi as isCodyProModel, cJ as http, b5 as CodyTaskState, aS as createExtensionAPI, aT as createMessageAPIForWebview, bd as isEqual, cK as getAugmentedNamespace, cL as main$1, cM as setUserAgent, cN as TESTING_TELEMETRY_EXPORTER, cO as dist, cP as waitUntilComplete, bl as isMacOS, bk as CustomCommandType, by as setDisplayPathEnvInfo, cQ as isWindows, bt as ACCOUNT_USAGE_URL, T as TokenCounterUtils, C as ContextItemSource, cR as _root, cS as _baseGetTag, cT as isObjectLike_1, cU as isObject_1, bx as isErrorLike, as as displayPath, cV as DefaultChatCommands, cW as pathFunctionsForURI, cX as uriParseNameAndExtension, cY as uriDirname, cZ as DefaultEditCommands, am as FILE_CONTEXT_MENTION_PROVIDER, an as SYMBOL_CONTEXT_MENTION_PROVIDER, ao as REMOTE_REPOSITORY_PROVIDER_URI, c_ as promiseFactoryToObservable, c$ as mentionProvidersMetadata, d0 as expandToLineRange, av as displayPathBasename, at as displayLineRange, d1 as truncateTextNearestLine, d2 as TokenCounter, d3 as createDisposables, aP as parseMentionQuery, d4 as tracer, bo as inputTextWithoutContextChipsFromPromptEditorState, bc as isAbortErrorOrSocketHangUp, d5 as isContextWindowLimitError, d6 as truncatePromptString, bb as reformatBotMessageForChat, b0 as hydrateAfterPostMessage, d7 as addMessageListenersForExtensionAPI, d8 as createMessageAPIForExtension, bq as View, d9 as promiseToObservable$1, da as CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, db as editorStateFromPromptString, dc as getEditorTabSize$1, bh as pluralize, dd as mergeMap$1, de as AbortError, df as psDedent, dg as getEditorIndentString, b8 as RateLimitError$1, dh as logResponseHeadersToSpan, di as TracedError, dj as isNodeResponse, dk as SpanStatusCode, dl as assertFileURI, ap as REMOTE_FILE_PROVIDER_URI, aq as REMOTE_DIRECTORY_PROVIDER_URI, ar as WEB_PROVIDER_URI, dm as setOpenCtx, dn as pluck, dp as GIT_OPENCTX_PROVIDER_URI, bu as ACCOUNT_UPGRADE_URL, aY as scanForMentionTriggerInUserTextInput, ax as LARGE_FILE_WARNING_LABEL, dq as GENERAL_HELP_LABEL, dr as diffLines, ds as languageFromFilename, dt as ProgrammingLanguage, du as truncatePromptStringStart, dv as posixFilePaths, dw as CODY_DOC_URL, b9 as CODY_FEEDBACK_URL, dx as DISCORD_URL, dy as CODY_SUPPORT_URL, bv as getRelativeChatPeriod, dz as SG_CHANGELOG_URL, dA as ACCOUNT_LIMITS_INFO_URL, dB as setLogger, dC as CODY_OLLAMA_DOCS_URL, dD as currentAuthStatusOrNotReadyYet, bw as browser$3 } from "./browser-D1wtYpbR.mjs";
22
22
  var __awaiter = function(thisArg, _arguments, P, generator) {
23
23
  function adopt(value) {
24
24
  return value instanceof P ? value : new P(function(resolve2) {
@@ -155,7 +155,7 @@ const del = async (fetch2, host, data2) => {
155
155
  await checkOk(response);
156
156
  return response;
157
157
  };
158
- const parseJSON = async function* (itr) {
158
+ const parseJSON$1 = async function* (itr) {
159
159
  const decoder = new TextDecoder("utf-8");
160
160
  let buffer2 = "";
161
161
  const reader = itr.getReader();
@@ -251,7 +251,7 @@ let Ollama$1 = class Ollama {
251
251
  if (!response.body) {
252
252
  throw new Error("Missing body");
253
253
  }
254
- const itr = parseJSON(response.body);
254
+ const itr = parseJSON$1(response.body);
255
255
  if (request.stream) {
256
256
  return async function* () {
257
257
  for await (const message of itr) {
@@ -7830,6 +7830,16 @@ class Typewriter {
7830
7830
  }
7831
7831
  }
7832
7832
  }
7833
+ function parseJSON(data2) {
7834
+ try {
7835
+ return JSON.parse(data2);
7836
+ } catch {
7837
+ return new Error(`invalid JSON: ${data2}`);
7838
+ }
7839
+ }
7840
+ function parseCompletionJSON(jsonData) {
7841
+ return parseJSON(jsonData);
7842
+ }
7833
7843
  var define_process_default$j = { env: {} };
7834
7844
  var FeatureFlag = /* @__PURE__ */ ((FeatureFlag2) => {
7835
7845
  FeatureFlag2["TestFlagDoNotUse"] = "test-flag-do-not-use";
@@ -8347,6 +8357,24 @@ function defaultOnOpen(response) {
8347
8357
  throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
8348
8358
  }
8349
8359
  }
8360
+ class CompletionsResponseBuilder {
8361
+ constructor(apiVersion) {
8362
+ __publicField2(this, "totalCompletion", "");
8363
+ this.apiVersion = apiVersion;
8364
+ }
8365
+ nextCompletion(completion, deltaText) {
8366
+ if (this.apiVersion >= 2) {
8367
+ this.totalCompletion += deltaText ?? "";
8368
+ return this.totalCompletion;
8369
+ }
8370
+ this.totalCompletion = completion ?? "";
8371
+ return this.totalCompletion;
8372
+ }
8373
+ static fromUrl(url) {
8374
+ const apiVersion = Number.parseInt(new URL(url).searchParams.get("api-version") ?? "0", 10);
8375
+ return new CompletionsResponseBuilder(apiVersion);
8376
+ }
8377
+ }
8350
8378
  const VERSION = "0.20.8";
8351
8379
  let auto = false;
8352
8380
  let kind = void 0;
@@ -10381,6 +10409,7 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
10381
10409
  if (trace2) {
10382
10410
  headersInstance.set("X-Sourcegraph-Should-Trace", "true");
10383
10411
  }
10412
+ const builder = new CompletionsResponseBuilder(apiVersion);
10384
10413
  headersInstance.set("Accept-Encoding", "gzip;q=0");
10385
10414
  fetchEventSource(url.toString(), {
10386
10415
  method: "POST",
@@ -10407,8 +10436,22 @@ class SourcegraphBrowserCompletionsClient extends SourcegraphCompletionsClient {
10407
10436
  },
10408
10437
  onmessage: (message) => {
10409
10438
  try {
10410
- const data2 = { ...JSON.parse(message.data), type: message.event };
10411
- this.sendEvents([data2], cb);
10439
+ const events2 = [];
10440
+ if (message.event === "completion") {
10441
+ const data2 = parseCompletionJSON(message.data);
10442
+ if (isError$1(data2)) {
10443
+ throw data2;
10444
+ }
10445
+ events2.push({
10446
+ type: "completion",
10447
+ // concatenate deltas when using api-version>=2
10448
+ completion: builder.nextCompletion(data2.completion, data2.deltaText),
10449
+ stopReason: data2.stopReason
10450
+ });
10451
+ } else {
10452
+ events2.push({ type: message.event, ...JSON.parse(message.data) });
10453
+ }
10454
+ this.sendEvents(events2, cb);
10412
10455
  } catch (error) {
10413
10456
  cb.onError(error.message);
10414
10457
  abort2.abort();
@@ -16277,13 +16320,6 @@ const contributes = {
16277
16320
  group: "Cody",
16278
16321
  enablement: "cody.activated"
16279
16322
  },
16280
- {
16281
- command: "cody.show-rate-limit-modal",
16282
- category: "Cody",
16283
- title: "Show Rate Limit Modal",
16284
- group: "Cody",
16285
- enablement: "cody.activated"
16286
- },
16287
16323
  {
16288
16324
  command: "cody.menu.commands",
16289
16325
  category: "Cody Menu",
@@ -16682,10 +16718,6 @@ const contributes = {
16682
16718
  command: "cody.show-page",
16683
16719
  when: "false"
16684
16720
  },
16685
- {
16686
- command: "cody.show-rate-limit-modal",
16687
- when: "false"
16688
- },
16689
16721
  {
16690
16722
  command: "cody.test.set-context-filters",
16691
16723
  when: "cody.activated && cody.devOrTest"
@@ -33954,13 +33986,14 @@ function newAuthStatus(options) {
33954
33986
  const primaryEmail = typeof options.primaryEmail === "string" ? options.primaryEmail : (_a3 = options.primaryEmail) == null ? void 0 : _a3.email;
33955
33987
  const requiresVerifiedEmail = isDotCom_;
33956
33988
  const hasVerifiedEmail = requiresVerifiedEmail && options.authenticated && options.hasVerifiedEmail;
33989
+ const codyApiVersion = inferCodyApiVersion(siteVersion, isDotCom_);
33957
33990
  return {
33958
33991
  ...options,
33959
33992
  endpoint,
33960
33993
  primaryEmail,
33961
33994
  requiresVerifiedEmail,
33962
33995
  hasVerifiedEmail,
33963
- codyApiVersion: inferCodyApiVersion(siteVersion, isDotCom_),
33996
+ codyApiVersion,
33964
33997
  isFireworksTracingEnabled: isDotCom_ && !!(userOrganizations == null ? void 0 : userOrganizations.nodes.find((org) => org.name === "sourcegraph"))
33965
33998
  };
33966
33999
  }
@@ -33983,22 +34016,43 @@ const countGeneratedCode = (text) => {
33983
34016
  }
33984
34017
  return count;
33985
34018
  };
34019
+ const overriddenApiVersion = workspace.getConfiguration().get("cody.advanced.completions-api-version", void 0);
33986
34020
  function inferCodyApiVersion(version2, isDotCom2) {
34021
+ if (overriddenApiVersion !== void 0) {
34022
+ return overriddenApiVersion;
34023
+ }
33987
34024
  const parsedVersion = semver.valid(version2);
33988
- if (isDotCom2) {
33989
- return 1;
34025
+ const isLocalBuild = parsedVersion === "0.0.0";
34026
+ if (isDotCom2 || isLocalBuild) {
34027
+ return 2;
33990
34028
  }
33991
- if (parsedVersion == null) {
34029
+ const isCloudBuildFromMain = parsedVersion === null;
34030
+ if (isCloudBuildFromMain) {
34031
+ const date = parseDateFromPreReleaseVersion(version2);
34032
+ if (date && date >= /* @__PURE__ */ new Date("2024-09-11")) {
34033
+ return 2;
34034
+ }
33992
34035
  return 1;
33993
34036
  }
33994
- if (semver.gte(parsedVersion, "5.4.0")) {
33995
- return 1;
34037
+ if (semver.gte(parsedVersion, "5.8.0")) {
34038
+ return 2;
33996
34039
  }
33997
- if (parsedVersion === "0.0.0") {
34040
+ if (semver.gte(parsedVersion, "5.4.0")) {
33998
34041
  return 1;
33999
34042
  }
34000
34043
  return 0;
34001
34044
  }
34045
+ function parseDateFromPreReleaseVersion(version2) {
34046
+ try {
34047
+ const dateString = version2.split("_").at(1);
34048
+ if (!dateString) {
34049
+ return void 0;
34050
+ }
34051
+ return new Date(dateString);
34052
+ } catch {
34053
+ return void 0;
34054
+ }
34055
+ }
34002
34056
  function getEnterpriseContextWindow(chatModel, configOverwrites) {
34003
34057
  const { chatModelMaxTokens, smartContextWindow } = configOverwrites;
34004
34058
  let contextWindow = {
@@ -41656,8 +41710,7 @@ async function doGetInlineCompletions(params) {
41656
41710
  numberOfCompletionsToGenerate
41657
41711
  } = params;
41658
41712
  tracer2 == null ? void 0 : tracer2({ params: { document: document2, position, triggerKind, selectedCompletionInfo } });
41659
- const authStatus2 = await currentAuthStatus();
41660
- const isDotComUser = isDotCom(authStatus2.endpoint);
41713
+ const isDotComUser = isDotComAuthed();
41661
41714
  const gitIdentifiersForFile = isDotComUser === true ? gitMetadataForCurrentEditor.getGitIdentifiersForFile() : void 0;
41662
41715
  if (gitIdentifiersForFile == null ? void 0 : gitIdentifiersForFile.gitUrl) {
41663
41716
  const repoMetadataInstance = GitHubDotComRepoMetadata.getInstance();
@@ -41817,7 +41870,7 @@ async function doGetInlineCompletions(params) {
41817
41870
  firstCompletionTimeout,
41818
41871
  completionLogId: logId,
41819
41872
  gitContext,
41820
- authStatus: authStatus2,
41873
+ authStatus: currentAuthStatus(),
41821
41874
  config,
41822
41875
  numberOfCompletionsToGenerate: numberOfCompletionsToGenerate ?? n,
41823
41876
  multiline: !!docContext.multilineTrigger
@@ -43179,8 +43232,19 @@ function getLensesForTask(task) {
43179
43232
  }
43180
43233
  }
43181
43234
  function getErrorLens(codeLensRange, task) {
43235
+ var _a3;
43182
43236
  const lens = new CodeLens(codeLensRange);
43183
- if (isRateLimitError(task.error)) {
43237
+ if ((_a3 = task.error) == null ? void 0 : _a3.message.includes("network error")) {
43238
+ lens.command = {
43239
+ title: "$(warning) Network Disconnected",
43240
+ command: "cody.chat.signIn"
43241
+ };
43242
+ } else if (isAuthError(task.error)) {
43243
+ lens.command = {
43244
+ title: "$(warning) Authentication Failed",
43245
+ command: "cody.chat.signIn"
43246
+ };
43247
+ } else if (isRateLimitError(task.error)) {
43184
43248
  if (task.error.upgradeIsAvailable) {
43185
43249
  lens.command = {
43186
43250
  title: "⚡️ Upgrade to Cody Pro",
@@ -49203,7 +49267,7 @@ class CommandsProvider {
49203
49267
  * Used for retreiving context for the command field in custom command
49204
49268
  */
49205
49269
  async runShell(shell2) {
49206
- const { getContextFileFromShell } = await import("./shell-Ct82N9eV.mjs");
49270
+ const { getContextFileFromShell } = await import("./shell-C59BlM8E.mjs");
49207
49271
  return getContextFileFromShell(shell2);
49208
49272
  }
49209
49273
  /**
@@ -49214,7 +49278,7 @@ class CommandsProvider {
49214
49278
  if (!isFileURI(uri2)) {
49215
49279
  throw new Error("history only supported on local file paths");
49216
49280
  }
49217
- const { getContextFileFromGitLog } = await import("./git-log-C_pMreBK.mjs");
49281
+ const { getContextFileFromGitLog } = await import("./git-log-DzEEgPFA.mjs");
49218
49282
  return getContextFileFromGitLog(uri2, options);
49219
49283
  }
49220
49284
  dispose() {
@@ -52991,7 +53055,6 @@ function startClientStateBroadcaster({
52991
53055
  }
52992
53056
  }
52993
53057
  const corpusItems = getCorpusContextItemsForEditorState(useRemoteSearch);
52994
- logDebug$1("corpusItems", JSON.stringify(await corpusItems, null, 2));
52995
53058
  items.push(...await corpusItems);
52996
53059
  postMessage({ type: "clientState", value: { initialContext: items } });
52997
53060
  }
@@ -54137,7 +54200,7 @@ class ChatController {
54137
54200
  break;
54138
54201
  case "initialized":
54139
54202
  await this.handleInitialized();
54140
- this.setWebviewView(View.Chat);
54203
+ this.setWebviewToChat();
54141
54204
  break;
54142
54205
  case "submit": {
54143
54206
  await this.handleUserMessageSubmission({
@@ -54238,7 +54301,7 @@ class ChatController {
54238
54301
  break;
54239
54302
  case "restoreHistory":
54240
54303
  await this.restoreSession(message.chatID);
54241
- this.setWebviewView(View.Chat);
54304
+ this.setWebviewToChat();
54242
54305
  break;
54243
54306
  case "reset":
54244
54307
  await this.clearAndRestartSession();
@@ -54326,7 +54389,6 @@ class ChatController {
54326
54389
  }
54327
54390
  if (message.authKind === "signout") {
54328
54391
  await showSignOutMenu();
54329
- this.setWebviewView(View.Login);
54330
54392
  break;
54331
54393
  }
54332
54394
  await commands$1.executeCommand(`cody.auth.${message.authKind}`);
@@ -54362,6 +54424,11 @@ class ChatController {
54362
54424
  });
54363
54425
  break;
54364
54426
  }
54427
+ case "log": {
54428
+ const logger2 = message.level === "debug" ? logDebug : logError$2;
54429
+ logger2(message.filterLabel, message.message);
54430
+ break;
54431
+ }
54365
54432
  }
54366
54433
  }
54367
54434
  isSmartApplyEnabled() {
@@ -54516,7 +54583,13 @@ class ChatController {
54516
54583
  (contextItem) => ["repository", "tree"].includes(contextItem.type)
54517
54584
  );
54518
54585
  if (await oneBoxEnabled && repositoryMentioned) {
54519
- const intent = detectedIntent ? detectedIntent : await this.detectChatIntent({ requestID, text: inputText.toString() }).then(async (intent2) => {
54586
+ const inputTextWithoutContextChips = editorState ? PromptString.unsafe_fromUserQuery(
54587
+ inputTextWithoutContextChipsFromPromptEditorState(editorState)
54588
+ ) : inputText;
54589
+ const intent = detectedIntent ? detectedIntent : await this.detectChatIntent({
54590
+ requestID,
54591
+ text: inputTextWithoutContextChips.toString()
54592
+ }).then(async (intent2) => {
54520
54593
  signal2.throwIfAborted();
54521
54594
  this.chatModel.setLastMessageIntent(intent2);
54522
54595
  this.postViewTranscript();
@@ -55233,17 +55306,13 @@ class ChatController {
55233
55306
  );
55234
55307
  return viewOrPanel;
55235
55308
  }
55236
- async setWebviewView(view) {
55237
- if (view !== "chat") {
55238
- await commands$1.executeCommand("setContext", "cody.activated", false);
55239
- return;
55240
- }
55309
+ async setWebviewToChat() {
55241
55310
  const viewOrPanel = this._webviewPanelOrView ?? await this.createWebviewViewOrPanel();
55242
55311
  this._webviewPanelOrView = viewOrPanel;
55243
55312
  revealWebviewViewOrPanel(viewOrPanel);
55244
55313
  await this.postMessage({
55245
55314
  type: "view",
55246
- view
55315
+ view: View.Chat
55247
55316
  });
55248
55317
  }
55249
55318
  // #endregion
@@ -160413,24 +160482,24 @@ class AnthropicProvider extends Provider {
160413
160482
  return zipGenerators(completionsGenerators);
160414
160483
  }
160415
160484
  }
160416
- function getClientModel$2(provider, authStatus2) {
160417
- var _a3;
160418
- if (isDotCom(authStatus2)) {
160485
+ function getClientModel$2(provider) {
160486
+ if (isDotComAuthed()) {
160419
160487
  return DEFAULT_PLG_ANTHROPIC_MODEL;
160420
160488
  }
160421
160489
  if (provider === "google") {
160422
160490
  return "";
160423
160491
  }
160424
- if (((_a3 = authStatus2.configOverwrites) == null ? void 0 : _a3.provider) === "sourcegraph") {
160425
- return authStatus2.configOverwrites.completionModel || "";
160492
+ const { configOverwrites } = currentAuthStatusAuthed();
160493
+ if ((configOverwrites == null ? void 0 : configOverwrites.provider) === "sourcegraph") {
160494
+ return configOverwrites.completionModel || "";
160426
160495
  }
160427
160496
  return "";
160428
160497
  }
160429
160498
  function createProvider$6(params) {
160430
- const { authStatus: authStatus2, provider, anonymousUserID } = params;
160499
+ const { provider, anonymousUserID } = params;
160431
160500
  return new AnthropicProvider({
160432
160501
  id: "anthropic",
160433
- legacyModel: getClientModel$2(provider, authStatus2),
160502
+ legacyModel: getClientModel$2(provider),
160434
160503
  anonymousUserID
160435
160504
  });
160436
160505
  }
@@ -161071,7 +161140,7 @@ class FireworksProvider extends Provider {
161071
161140
  );
161072
161141
  const isNode = typeof define_process_default !== "undefined";
161073
161142
  let fastPathAccessToken = config.accessToken && // Require the upstream to be dotcom
161074
- (isDotCom(authStatus2) || isLocalInstance) && define_process_default.env.CODY_DISABLE_FASTPATH !== "true" && // Used for testing
161143
+ (isDotComAuthed() || isLocalInstance) && define_process_default.env.CODY_DISABLE_FASTPATH !== "true" && // Used for testing
161075
161144
  // The fast path client only supports Node.js style response streams
161076
161145
  isNode ? dotcomTokenToGatewayToken(config.accessToken) : void 0;
161077
161146
  if (fastPathAccessToken) {
@@ -161091,9 +161160,9 @@ class FireworksProvider extends Provider {
161091
161160
  });
161092
161161
  }
161093
161162
  }
161094
- function getClientModel(isDotCom2, model2) {
161163
+ function getClientModel(model2) {
161095
161164
  if (model2 === void 0 || model2 === "") {
161096
- return isDotCom2 ? DEEPSEEK_CODER_V2_LITE_BASE : "starcoder-hybrid";
161165
+ return isDotComAuthed() ? DEEPSEEK_CODER_V2_LITE_BASE : "starcoder-hybrid";
161097
161166
  }
161098
161167
  if (model2 === "starcoder-hybrid" || Object.prototype.hasOwnProperty.call(MODEL_MAP, model2)) {
161099
161168
  return model2;
@@ -161101,8 +161170,8 @@ function getClientModel(isDotCom2, model2) {
161101
161170
  throw new Error(`Unknown model: \`${model2}\``);
161102
161171
  }
161103
161172
  function createProvider$3(params) {
161104
- const { legacyModel, authStatus: authStatus2, anonymousUserID } = params;
161105
- const clientModel = getClientModel(isDotCom(authStatus2), legacyModel);
161173
+ const { legacyModel, anonymousUserID } = params;
161174
+ const clientModel = getClientModel(legacyModel);
161106
161175
  return new FireworksProvider({
161107
161176
  id: "fireworks",
161108
161177
  legacyModel: clientModel,
@@ -161403,17 +161472,15 @@ function createProvider(params) {
161403
161472
  });
161404
161473
  }
161405
161474
  function createProviderHelper(params) {
161406
- const { authStatus: authStatus2, legacyModel, model: model2, provider, config } = params;
161475
+ const { legacyModel, model: model2, provider, config } = params;
161407
161476
  const anonymousUserID = localStorage.anonymousUserID();
161408
161477
  const providerCreator = getProviderCreator({
161409
- provider,
161410
- authStatus: authStatus2
161478
+ provider
161411
161479
  });
161412
161480
  if (providerCreator) {
161413
161481
  return providerCreator({
161414
161482
  model: model2,
161415
161483
  legacyModel,
161416
- authStatus: authStatus2,
161417
161484
  config,
161418
161485
  anonymousUserID,
161419
161486
  provider
@@ -161422,8 +161489,8 @@ function createProviderHelper(params) {
161422
161489
  return null;
161423
161490
  }
161424
161491
  function getProviderCreator(params) {
161425
- var _a3, _b2;
161426
- const { provider, authStatus: authStatus2 } = params;
161492
+ var _a3;
161493
+ const { provider } = params;
161427
161494
  if (provider === AUTOCOMPLETE_PROVIDER_ID.fireworks) {
161428
161495
  return createProvider$3;
161429
161496
  }
@@ -161436,8 +161503,9 @@ function getProviderCreator(params) {
161436
161503
  if (provider === AUTOCOMPLETE_PROVIDER_ID["experimental-openaicompatible"]) {
161437
161504
  return createProvider$4;
161438
161505
  }
161506
+ const { configOverwrites } = currentAuthStatusAuthed();
161439
161507
  if (provider === AUTOCOMPLETE_PROVIDER_ID.anthropic || provider === AUTOCOMPLETE_PROVIDER_ID["aws-bedrock"] || // An exception where we have to check the completion model string in addition to the provider ID.
161440
- provider === AUTOCOMPLETE_PROVIDER_ID.google && ((_b2 = (_a3 = authStatus2.configOverwrites) == null ? void 0 : _a3.completionModel) == null ? void 0 : _b2.includes("claude"))) {
161508
+ provider === AUTOCOMPLETE_PROVIDER_ID.google && ((_a3 = configOverwrites == null ? void 0 : configOverwrites.completionModel) == null ? void 0 : _a3.includes("claude"))) {
161441
161509
  return createProvider$6;
161442
161510
  }
161443
161511
  if (provider === AUTOCOMPLETE_PROVIDER_ID.google || provider === AUTOCOMPLETE_PROVIDER_ID.gemini || provider === AUTOCOMPLETE_PROVIDER_ID["unstable-gemini"]) {
@@ -161621,7 +161689,6 @@ async function createInlineCompletionItemFromMultipleProviders({
161621
161689
  };
161622
161690
  completionProviderConfig.setConfig(newConfig);
161623
161691
  const provider = createProviderHelper({
161624
- authStatus: authStatus2,
161625
161692
  legacyModel: currentProviderConfig.model,
161626
161693
  provider: currentProviderConfig.provider,
161627
161694
  config: newConfig
@@ -161639,7 +161706,7 @@ async function createInlineCompletionItemFromMultipleProviders({
161639
161706
  disableInsideComments: config.autocompleteDisableInsideComments,
161640
161707
  isRunningInsideAgent: config.isRunningInsideAgent,
161641
161708
  createBfgRetriever,
161642
- isDotComUser: isDotCom(authStatus2.endpoint || ""),
161709
+ isDotComUser: isDotCom(authStatus2),
161643
161710
  noInlineAccept: true
161644
161711
  });
161645
161712
  allCompletionsProviders.push({
@@ -161833,7 +161900,7 @@ function parseMentionURI(uri2) {
161833
161900
  }
161834
161901
  }
161835
161902
  async function execFileAsync(program2, args2, { cwd }) {
161836
- const { promisify: promisify2 } = await import("./util-DHv3aBr3.mjs").then((n) => n.u);
161903
+ const { promisify: promisify2 } = await import("./util-xV842Ayw.mjs").then((n) => n.u);
161837
161904
  const { execFile: execFile2 } = await Promise.resolve().then(() => child_process);
161838
161905
  return promisify2(execFile2)(program2, args2, { cwd });
161839
161906
  }
@@ -171429,7 +171496,7 @@ async function registerDebugCommands(context2, disposables) {
171429
171496
  }
171430
171497
  async function tryRegisterTutorial(context2, disposables) {
171431
171498
  if (!isRunningInsideAgent()) {
171432
- const { registerInteractiveTutorial } = await import("./index-BY36TK4z.mjs");
171499
+ const { registerInteractiveTutorial } = await import("./index-BC137051.mjs");
171433
171500
  registerInteractiveTutorial(context2).then((disposable) => disposables.push(...disposable));
171434
171501
  }
171435
171502
  }
@@ -1,2 +1,2 @@
1
- import "./agent.worker-CpzEAjEs.mjs";
2
- import "./browser-7p2xtDk0.mjs";
1
+ import "./agent.worker-BGToM1eX.mjs";
2
+ import "./browser-D1wtYpbR.mjs";