@sourcegraph/cody-web 0.7.0 → 0.7.3

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.
@@ -1,2 +1,2 @@
1
- import "./agent.worker-Cjx_iNtn.mjs";
2
- import "./browser-BpZhCiRU.mjs";
1
+ import "./agent.worker-7dUx4v7q.mjs";
2
+ import "./browser-0yJ2hV_u.mjs";
@@ -381,9 +381,6 @@ const defaultAuthStatus = {
381
381
  siteVersion: "",
382
382
  userCanUpgrade: false,
383
383
  username: "",
384
- primaryEmail: "",
385
- displayName: "",
386
- avatarURL: "",
387
384
  codyApiVersion: 0
388
385
  };
389
386
  const unauthenticatedStatus = {
@@ -399,9 +396,6 @@ const unauthenticatedStatus = {
399
396
  siteVersion: "",
400
397
  userCanUpgrade: false,
401
398
  username: "",
402
- primaryEmail: "",
403
- displayName: "",
404
- avatarURL: "",
405
399
  codyApiVersion: 0
406
400
  };
407
401
  const networkErrorAuthStatus = {
@@ -417,9 +411,6 @@ const networkErrorAuthStatus = {
417
411
  siteVersion: "",
418
412
  userCanUpgrade: false,
419
413
  username: "",
420
- primaryEmail: "",
421
- displayName: "",
422
- avatarURL: "",
423
414
  codyApiVersion: 0
424
415
  };
425
416
  const offlineModeAuthStatus = {
@@ -436,9 +427,6 @@ const offlineModeAuthStatus = {
436
427
  siteVersion: "",
437
428
  userCanUpgrade: false,
438
429
  username: "offline",
439
- primaryEmail: "",
440
- displayName: "",
441
- avatarURL: "",
442
430
  codyApiVersion: 0
443
431
  };
444
432
  function isCodyProUser(authStatus) {
@@ -12529,10 +12517,7 @@ class SourcegraphGraphQLAPIClient {
12529
12517
  CURRENT_USER_ID_QUERY,
12530
12518
  {}
12531
12519
  ).then(
12532
- (response) => extractDataOrError(
12533
- response,
12534
- (data) => data.currentUser ? data.currentUser.id : new Error("current user not found")
12535
- )
12520
+ (response) => extractDataOrError(response, (data) => data.currentUser ? data.currentUser.id : null)
12536
12521
  );
12537
12522
  }
12538
12523
  async getCurrentUserCodyProEnabled() {
@@ -12540,10 +12525,7 @@ class SourcegraphGraphQLAPIClient {
12540
12525
  CURRENT_USER_CODY_PRO_ENABLED_QUERY,
12541
12526
  {}
12542
12527
  ).then(
12543
- (response) => extractDataOrError(
12544
- response,
12545
- (data) => data.currentUser ? { ...data.currentUser } : new Error("current user not found")
12546
- )
12528
+ (response) => extractDataOrError(response, (data) => data.currentUser ? { ...data.currentUser } : null)
12547
12529
  );
12548
12530
  }
12549
12531
  async getCurrentUserCodySubscription() {
@@ -12551,13 +12533,10 @@ class SourcegraphGraphQLAPIClient {
12551
12533
  CURRENT_USER_CODY_SUBSCRIPTION_QUERY,
12552
12534
  {}
12553
12535
  ).then(
12554
- (response) => extractDataOrError(
12555
- response,
12556
- (data) => {
12557
- var _a3;
12558
- return ((_a3 = data.currentUser) == null ? void 0 : _a3.codySubscription) ? data.currentUser.codySubscription : new Error("current user subscription data not found");
12559
- }
12560
- )
12536
+ (response) => extractDataOrError(response, (data) => {
12537
+ var _a3;
12538
+ return ((_a3 = data.currentUser) == null ? void 0 : _a3.codySubscription) ?? null;
12539
+ })
12561
12540
  );
12562
12541
  }
12563
12542
  async getCurrentUserInfo() {
@@ -12565,10 +12544,7 @@ class SourcegraphGraphQLAPIClient {
12565
12544
  CURRENT_USER_INFO_QUERY,
12566
12545
  {}
12567
12546
  ).then(
12568
- (response) => extractDataOrError(
12569
- response,
12570
- (data) => data.currentUser ? { ...data.currentUser } : new Error("current user not found")
12571
- )
12547
+ (response) => extractDataOrError(response, (data) => data.currentUser ? { ...data.currentUser } : null)
12572
12548
  );
12573
12549
  }
12574
12550
  /**
@@ -14297,13 +14273,12 @@ class TimestampTelemetryProcessor {
14297
14273
  }
14298
14274
  TimestampTelemetryProcessor_1 = timestamp.TimestampTelemetryProcessor = TimestampTelemetryProcessor;
14299
14275
  class GraphQLTelemetryExporter {
14300
- constructor(client, anonymousUserID, legacyBackcompatLogEventMode) {
14276
+ constructor(anonymousUserID, legacyBackcompatLogEventMode) {
14301
14277
  __publicField(this, "exportMode");
14302
14278
  __publicField(this, "legacySiteIdentification");
14303
- this.client = client;
14304
14279
  this.anonymousUserID = anonymousUserID;
14305
14280
  this.legacyBackcompatLogEventMode = legacyBackcompatLogEventMode;
14306
- this.client.setAnonymousUserID(anonymousUserID);
14281
+ graphqlClient.setAnonymousUserID(anonymousUserID);
14307
14282
  }
14308
14283
  /**
14309
14284
  * Checks if the connected server supports the new GraphQL mutations
@@ -14314,7 +14289,7 @@ class GraphQLTelemetryExporter {
14314
14289
  */
14315
14290
  async setLegacyEventsStateOnce() {
14316
14291
  if (this.exportMode === void 0) {
14317
- const siteVersion = await this.client.getSiteVersion();
14292
+ const siteVersion = await graphqlClient.getSiteVersion();
14318
14293
  if (isError(siteVersion)) {
14319
14294
  logError(
14320
14295
  "GraphQLTelemetryExporter",
@@ -14340,7 +14315,7 @@ class GraphQLTelemetryExporter {
14340
14315
  logDebug("GraphQLTelemetryExporter", "evaluated export mode:", this.exportMode);
14341
14316
  }
14342
14317
  if (this.exportMode === "legacy" && this.legacySiteIdentification === void 0) {
14343
- const siteIdentification = await this.client.getSiteIdentification();
14318
+ const siteIdentification = await graphqlClient.getSiteIdentification();
14344
14319
  if (isError(siteIdentification)) {
14345
14320
  this.legacySiteIdentification = null;
14346
14321
  return;
@@ -14361,7 +14336,7 @@ class GraphQLTelemetryExporter {
14361
14336
  events2.map(
14362
14337
  (event) => {
14363
14338
  var _a3, _b, _c;
14364
- return this.client.logEvent(
14339
+ return graphqlClient.logEvent(
14365
14340
  {
14366
14341
  client: event.source.client,
14367
14342
  event: `${event.feature}.${event.action}`,
@@ -14401,7 +14376,7 @@ class GraphQLTelemetryExporter {
14401
14376
  if (this.exportMode) {
14402
14377
  handleExportModeTransforms(this.exportMode, events2);
14403
14378
  }
14404
- const resultOrError = await this.client.recordTelemetryEvents(events2);
14379
+ const resultOrError = await graphqlClient.recordTelemetryEvents(events2);
14405
14380
  if (isError(resultOrError)) {
14406
14381
  logError("GraphQLTelemetryExporter", "Error exporting telemetry events:", resultOrError);
14407
14382
  }
@@ -14441,14 +14416,14 @@ function getTier(authStatus) {
14441
14416
  }
14442
14417
  class TelemetryRecorderProvider extends dist.TelemetryRecorderProvider {
14443
14418
  constructor(extensionDetails, config, authStatusProvider, anonymousUserID, legacyBackcompatLogEventMode) {
14444
- const client = new SourcegraphGraphQLAPIClient(config);
14419
+ graphqlClient.setConfig(config);
14445
14420
  const clientName = extensionDetails.telemetryClientName ? extensionDetails.telemetryClientName : `${extensionDetails.ide || "unknown"}.Cody`;
14446
14421
  super(
14447
14422
  {
14448
14423
  client: clientName,
14449
14424
  clientVersion: extensionDetails.version
14450
14425
  },
14451
- new GraphQLTelemetryExporter(client, anonymousUserID, legacyBackcompatLogEventMode),
14426
+ new GraphQLTelemetryExporter(anonymousUserID, legacyBackcompatLogEventMode),
14452
14427
  [
14453
14428
  new ConfigurationMetadataProcessor(config, authStatusProvider),
14454
14429
  // Generate timestamps when recording events, instead of serverside
@@ -14784,7 +14759,7 @@ class PromptString {
14784
14759
  static fromContextItem(contextItem) {
14785
14760
  const ref = [contextItem.uri];
14786
14761
  return {
14787
- content: contextItem.content ? internal_createPromptString(contextItem.content, ref) : void 0,
14762
+ content: typeof contextItem.content === "string" ? internal_createPromptString(contextItem.content, ref) : void 0,
14788
14763
  repoName: contextItem.repoName ? internal_createPromptString(contextItem.repoName, ref) : void 0,
14789
14764
  title: contextItem.title ? internal_createPromptString(contextItem.title, ref) : void 0
14790
14765
  };
@@ -31275,72 +31250,72 @@ export {
31275
31250
  PromptString as by,
31276
31251
  createSubscriber as bz,
31277
31252
  bs as c,
31278
- SpanStatusCode as c$,
31253
+ isNodeResponse as c$,
31279
31254
  openCtx as c0,
31280
31255
  extensionForLanguage as c1,
31281
31256
  isSourcegraphToken as c2,
31282
- toRangeData as c3,
31283
- DOTCOM_URL as c4,
31284
- base64Js as c5,
31285
- isDotCom as c6,
31286
- NetworkError as c7,
31287
- isRateLimitError as c8,
31288
- isAuthError as c9,
31289
- uriDirname as cA,
31290
- DefaultEditCommands as cB,
31291
- promiseFactoryToObservable as cC,
31292
- webMentionProvidersMetadata as cD,
31293
- allMentionProvidersMetadata as cE,
31294
- combineLatest as cF,
31295
- expandToLineRange as cG,
31296
- offlineModeAuthStatus as cH,
31297
- unauthenticatedStatus as cI,
31298
- semver$1 as cJ,
31299
- truncateTextNearestLine as cK,
31300
- TokenCounter as cL,
31301
- tracer as cM,
31302
- isContextWindowLimitError as cN,
31303
- inputTextWithoutContextChipsFromPromptEditorState as cO,
31304
- truncatePromptString as cP,
31305
- addMessageListenersForExtensionAPI as cQ,
31306
- createMessageAPIForExtension as cR,
31307
- subscriptionDisposable as cS,
31308
- CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID as cT,
31309
- editorStateFromPromptString as cU,
31310
- getEditorTabSize as cV,
31311
- AbortError as cW,
31312
- getEditorIndentString as cX,
31313
- logResponseHeadersToSpan as cY,
31314
- TracedError as cZ,
31315
- isNodeResponse as c_,
31316
- NoOpTelemetryRecorderProvider as ca,
31317
- TimestampTelemetryProcessor_1 as cb,
31318
- updateGlobalTelemetryInstances as cc,
31319
- TelemetryRecorderProvider as cd,
31320
- telemetryRecorderProvider as ce,
31321
- uriExtname as cf,
31322
- SUPPORTED_URI_SCHEMAS as cg,
31323
- convertGitCloneURLToCodebaseName as ch,
31324
- require$$1 as ci,
31325
- dedupeWith as cj,
31326
- getEditorInsertSpaces as ck,
31327
- TimeoutError as cl,
31328
- getActiveTraceAndSpanId as cm,
31329
- isNetworkError as cn,
31330
- trace as co,
31331
- getAugmentedNamespace as cp,
31332
- main as cq,
31333
- setUserAgent as cr,
31334
- TESTING_TELEMETRY_EXPORTER as cs,
31335
- dist as ct,
31336
- _root as cu,
31337
- _baseGetTag as cv,
31338
- isObjectLike_1 as cw,
31339
- isObject_1 as cx,
31340
- DefaultChatCommands as cy,
31341
- uriParseNameAndExtension as cz,
31257
+ _$1 as c3,
31258
+ toRangeData as c4,
31259
+ DOTCOM_URL as c5,
31260
+ base64Js as c6,
31261
+ isDotCom as c7,
31262
+ NetworkError as c8,
31263
+ isRateLimitError as c9,
31264
+ uriParseNameAndExtension as cA,
31265
+ uriDirname as cB,
31266
+ DefaultEditCommands as cC,
31267
+ promiseFactoryToObservable as cD,
31268
+ webMentionProvidersMetadata as cE,
31269
+ allMentionProvidersMetadata as cF,
31270
+ combineLatest as cG,
31271
+ subscriptionDisposable as cH,
31272
+ expandToLineRange as cI,
31273
+ offlineModeAuthStatus as cJ,
31274
+ unauthenticatedStatus as cK,
31275
+ semver$1 as cL,
31276
+ truncateTextNearestLine as cM,
31277
+ TokenCounter as cN,
31278
+ tracer as cO,
31279
+ isContextWindowLimitError as cP,
31280
+ truncatePromptString as cQ,
31281
+ inputTextWithoutContextChipsFromPromptEditorState as cR,
31282
+ addMessageListenersForExtensionAPI as cS,
31283
+ createMessageAPIForExtension as cT,
31284
+ CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID as cU,
31285
+ editorStateFromPromptString as cV,
31286
+ getEditorTabSize as cW,
31287
+ AbortError as cX,
31288
+ getEditorIndentString as cY,
31289
+ logResponseHeadersToSpan as cZ,
31290
+ TracedError as c_,
31291
+ isAuthError as ca,
31292
+ NoOpTelemetryRecorderProvider as cb,
31293
+ TimestampTelemetryProcessor_1 as cc,
31294
+ updateGlobalTelemetryInstances as cd,
31295
+ TelemetryRecorderProvider as ce,
31296
+ telemetryRecorderProvider as cf,
31297
+ convertGitCloneURLToCodebaseName as cg,
31298
+ uriExtname as ch,
31299
+ SUPPORTED_URI_SCHEMAS as ci,
31300
+ require$$1 as cj,
31301
+ dedupeWith as ck,
31302
+ getEditorInsertSpaces as cl,
31303
+ TimeoutError as cm,
31304
+ getActiveTraceAndSpanId as cn,
31305
+ isNetworkError as co,
31306
+ trace as cp,
31307
+ getAugmentedNamespace as cq,
31308
+ main as cr,
31309
+ setUserAgent as cs,
31310
+ TESTING_TELEMETRY_EXPORTER as ct,
31311
+ dist as cu,
31312
+ _root as cv,
31313
+ _baseGetTag as cw,
31314
+ isObjectLike_1 as cx,
31315
+ isObject_1 as cy,
31316
+ DefaultChatCommands as cz,
31342
31317
  dedent as d,
31343
- _$1 as d0,
31318
+ SpanStatusCode as d0,
31344
31319
  assertFileURI as d1,
31345
31320
  setOpenCtx as d2,
31346
31321
  GIT_OPENCTX_PROVIDER_URI as d3,
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../demo/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAW/B,OAAO,2CAA2C,CAAA;AA+BlD,eAAO,MAAM,GAAG,EAAE,EAWjB,CAAA"}
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../demo/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAW/B,OAAO,2CAA2C,CAAA;AA+BlD,eAAO,MAAM,GAAG,EAAE,EAYjB,CAAA"}
@@ -1,5 +1,5 @@
1
- import { p as path, U as Uri, s as spawn } from "./agent.worker-Cjx_iNtn.mjs";
2
- import { w as wrapInActiveSpan, C as ContextItemSource } from "./browser-BpZhCiRU.mjs";
1
+ import { p as path, U as Uri, s as spawn } from "./agent.worker-7dUx4v7q.mjs";
2
+ import { w as wrapInActiveSpan, C as ContextItemSource } from "./browser-0yJ2hV_u.mjs";
3
3
  async function getContextFileFromGitLog(file, options) {
4
4
  return wrapInActiveSpan("commands.context.git-log", async (span) => {
5
5
  const cwd = path.dirname(file.fsPath);
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { U as Uri, P as Position, R as Range, w as window, D as DiagnosticSeverity, b as workspace, c as updateRangeMultipleChanges, d as commands, f as executeEdit, T as TERMINAL_EDIT_STATES, g as ThemeColor, h as languages, C as CodeLens, i as setTutorialUri, j as logSidebarClick, k as Disposable } from "./agent.worker-Cjx_iNtn.mjs";
5
- import { t as telemetryRecorder, p as ps, d as dedent } from "./browser-BpZhCiRU.mjs";
4
+ import { U as Uri, P as Position, R as Range, w as window, D as DiagnosticSeverity, b as workspace, c as updateRangeMultipleChanges, d as commands, f as executeEdit, T as TERMINAL_EDIT_STATES, g as ThemeColor, h as languages, C as CodeLens, i as setTutorialUri, j as logSidebarClick, k as Disposable } from "./agent.worker-7dUx4v7q.mjs";
5
+ import { t as telemetryRecorder, p as ps, d as dedent } from "./browser-0yJ2hV_u.mjs";
6
6
  const EMOJI_SVG_TEMPLATE = `<svg width="32" height="32" xmlns="http://www.w3.org/2000/svg">
7
7
  <text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle" font-family="Arial" font-size="24px">{emoji}</text>
8
8
  </svg>`;