@sourcegraph/cody-web 0.31.0 → 0.31.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.
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ 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
4
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
5
- import { i as getDefaultExportFromCjs, L as Ls, k as ke$1, j as ks, F as Fi$1, _ as _s, m as ds, n as bs, o as ii$1, q as qe$1, y as ys, x as xi$1, K as K$2, J as J$2, r as R$3, u as ws, B as B$2, v as g$5, z as h$4, A as _i, S as Ss, E as Br, G as ln, H as bi$1, I as vn, M as xn, N as Nn, O as mn, Q as li$1, V as n$1, W as ns, X as M$4, Y as Ds, Z as le$2, $ as c$3, a0 as oe$2, a1 as z$1, a2 as yi$1, a3 as W$2, a4 as Ue$1, a5 as I$2, a6 as Se$2, a7 as O$2, a8 as F$1, a9 as Ni$1, aa as ee$1, ab as we$2, ac as b$2, ad as T$3, ae as s$2, af as o$4, ag as w$3, ah as i$2, ai as k$3, aj as D$5, ak as p$8, al as m$8, am as S$4, an as v$4, ao as P$2, ap as E$6, aq as Wi$1, ar as L$3, as as d$2, at as a$3, au as l$2, av as f$2, aw as u$6, ax as r$5, ay as t$2, az as FILE_CONTEXT_MENTION_PROVIDER, aA as SYMBOL_CONTEXT_MENTION_PROVIDER, aB as REMOTE_REPOSITORY_PROVIDER_URI, aC as REMOTE_FILE_PROVIDER_URI, aD as REMOTE_DIRECTORY_PROVIDER_URI, aE as WEB_PROVIDER_URI, aF as RULES_PROVIDER_URI, aG as displayPath, aH as displayLineRange, aI as displayPathDirname, aJ as displayPathBasename, aK as IGNORED_FILE_WARNING_LABEL, aL as LARGE_FILE_WARNING_LABEL, aM as Ei$1, aN as xe$2, aO as V$2, aP as Es, aQ as U$2, aR as e, aS as Ns, aT as object, aU as literal, aV as string$2, C as ContextItemSource, aW as URI, aX as is$2, aY as gs, aZ as serializeContextItem, a_ as CONTEXT_ITEM_MENTION_NODE_TYPE, a$ as contextItemMentionNodeDisplayText, b0 as an, b1 as qr, b2 as _$2, b3 as TEMPLATE_INPUT_NODE_TYPE, b4 as N$2, b5 as parseMentionQuery, b6 as NO_SYMBOL_MATCHES_HELP_LABEL, b7 as FILE_RANGE_TOOLTIP_LABEL, b8 as Observable, b9 as createExtensionAPI, ba as createMessageAPIForWebview, bb as debounce, bc as memoizeLastValue, bd as toSerializedPromptEditorValue$1, be as ri$1, bf as isEqual, bg as scanForMentionTriggerInUserTextInput, bh as fs, bi as Ts, bj as ps, bk as getMentionOperations, bl as forceHydration, bm as hydrateAfterPostMessage, bn as isDotCom, bo as isSourcegraphToken, bp as trace, bq as context$1, br as SpanStatusCode, bs as FeatureFlag, h as commonjsGlobal, bt as svg, bu as html$2, bv as whitespace, bw as find, bx as stringify, by as stringify$1, bz as ccount, bA as isCodyProUser, bB as CodyIDE, bC as CodyTaskState, bD as cryptoJsExports, bE as isError, bF as RateLimitError, bG as upperFirst, bH as lodashExports, bI as createContextItem, bJ as isDefined, bK as isCodeSearchContextItem, bL as reformatBotMessageForChat, bM as isAbortErrorOrSocketHangUp, bN as ModelTag, bO as DeepCodyAgentID, bP as serializedPromptEditorStateFromChatMessage, bQ as contextItemsFromPromptEditorValue, bR as filterContextItemsFromPromptEditorValue, bS as CustomCommandType, bT as View, bU as isCodyProModel, bV as ToolCodyModelName, bW as getRelativeChatPeriod, bX as isMacOS, bY as firstResultFromOperation, bZ as ENTERPRISE_STARTER_LEARN_MORE_URL, b_ as CODY_PRO_SUBSCRIPTION_URL, b$ as ACCOUNT_USAGE_URL, c0 as ENTERPRISE_STARTER_PRICING_URL, c1 as textContentFromSerializedLexicalNode, c2 as firstValueFrom, c3 as skipPendingOperation, c4 as FAST_CHAT_INPUT_TOKEN_BUDGET, c5 as webviewOpenURIForContextItem, c6 as pluralize$1, c7 as serializedPromptEditorStateFromText, c8 as deserializeContextItem, c9 as S2_URL, ca as browser, cb as CodyAutoSuggestionMode, cc as isErrorLike, cd as PromptString, ce as setDisplayPathEnvInfo, U as Uri } from "./vscode-shim-DuhCkl0x.mjs";
6
- import { cg, cf } from "./vscode-shim-DuhCkl0x.mjs";
5
+ import { i as getDefaultExportFromCjs, L as Ls, k as ke$1, j as ks, F as Fi$1, _ as _s, m as ds, n as bs, o as ii$1, q as qe$1, y as ys, x as xi$1, K as K$2, J as J$2, r as R$3, u as ws, B as B$2, v as g$5, z as h$4, A as _i, S as Ss, E as Br, G as ln, H as bi$1, I as vn, M as xn, N as Nn, O as mn, Q as li$1, V as n$1, W as ns, X as M$4, Y as Ds, Z as le$2, $ as c$3, a0 as oe$2, a1 as z$1, a2 as yi$1, a3 as W$2, a4 as Ue$1, a5 as I$2, a6 as Se$2, a7 as O$2, a8 as F$1, a9 as Ni$1, aa as ee$1, ab as we$2, ac as b$2, ad as T$3, ae as s$2, af as o$4, ag as w$3, ah as i$2, ai as k$3, aj as D$5, ak as p$8, al as m$8, am as S$4, an as v$4, ao as P$2, ap as E$6, aq as Wi$1, ar as L$3, as as d$2, at as a$3, au as l$2, av as f$2, aw as u$6, ax as r$5, ay as t$2, az as FILE_CONTEXT_MENTION_PROVIDER, aA as SYMBOL_CONTEXT_MENTION_PROVIDER, aB as REMOTE_REPOSITORY_PROVIDER_URI, aC as REMOTE_FILE_PROVIDER_URI, aD as REMOTE_DIRECTORY_PROVIDER_URI, aE as WEB_PROVIDER_URI, aF as RULES_PROVIDER_URI, aG as displayPath, aH as displayLineRange, aI as displayPathDirname, aJ as displayPathBasename, aK as IGNORED_FILE_WARNING_LABEL, aL as LARGE_FILE_WARNING_LABEL, aM as Ei$1, aN as xe$2, aO as V$2, aP as Es, aQ as U$2, aR as e, aS as Ns, aT as object, aU as literal, aV as string$2, C as ContextItemSource, aW as displayPathWithLines, aX as URI, aY as is$2, aZ as gs, a_ as serializeContextItem, a$ as CONTEXT_ITEM_MENTION_NODE_TYPE, b0 as contextItemMentionNodeDisplayText, b1 as an, b2 as qr, b3 as _$2, b4 as TEMPLATE_INPUT_NODE_TYPE, b5 as N$2, b6 as parseMentionQuery, b7 as NO_SYMBOL_MATCHES_HELP_LABEL, b8 as FILE_RANGE_TOOLTIP_LABEL, b9 as Observable, ba as createExtensionAPI, bb as createMessageAPIForWebview, bc as debounce, bd as memoizeLastValue, be as toSerializedPromptEditorValue$1, bf as ri$1, bg as isEqual, bh as scanForMentionTriggerInUserTextInput, bi as fs, bj as Ts, bk as ps, bl as getMentionOperations, bm as forceHydration, bn as hydrateAfterPostMessage, bo as isDotCom, bp as isAuthError, bq as isAvailabilityError, br as isSourcegraphToken, bs as trace, bt as context$1, bu as SpanStatusCode, bv as FeatureFlag, h as commonjsGlobal, bw as svg, bx as html$2, by as whitespace, bz as find, bA as stringify, bB as stringify$1, bC as ccount, bD as isCodyProUser, bE as CodyIDE, bF as CodyTaskState, bG as cryptoJsExports, bH as isError, bI as RateLimitError, bJ as upperFirst, bK as lodashExports, bL as createContextItem, bM as isDefined, bN as isCodeSearchContextItem, bO as reformatBotMessageForChat, bP as isAbortErrorOrSocketHangUp, bQ as ModelTag, bR as DeepCodyAgentID, bS as serializedPromptEditorStateFromChatMessage, bT as contextItemsFromPromptEditorValue, bU as filterContextItemsFromPromptEditorValue, bV as CustomCommandType, bW as View, bX as isCodyProModel, bY as ToolCodyModelName, bZ as getRelativeChatPeriod, b_ as isMacOS, b$ as firstResultFromOperation, c0 as ENTERPRISE_STARTER_LEARN_MORE_URL, c1 as CODY_PRO_SUBSCRIPTION_URL, c2 as ACCOUNT_USAGE_URL, c3 as ENTERPRISE_STARTER_PRICING_URL, c4 as textContentFromSerializedLexicalNode, c5 as firstValueFrom, c6 as skipPendingOperation, c7 as FAST_CHAT_INPUT_TOKEN_BUDGET, c8 as webviewOpenURIForContextItem, c9 as pluralize$1, ca as serializedPromptEditorStateFromText, cb as deserializeContextItem, cc as S2_URL, cd as browser, ce as CodyAutoSuggestionMode, cf as isErrorLike, cg as PromptString, ch as setDisplayPathEnvInfo, U as Uri } from "./vscode-shim-BMQfq1RF.mjs";
6
+ import { cj, ci } from "./vscode-shim-BMQfq1RF.mjs";
7
7
  import * as React$2 from "react";
8
8
  import React__default, { createContext, useContext, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, useEffect as useEffect$2, forwardRef, useState as useState$1, useCallback, useRef as useRef$1, Suspense, createElement, memo as memo$1, useImperativeHandle, Children, isValidElement, cloneElement, Fragment as Fragment$2, useReducer } from "react";
9
9
  var classnames = { exports: {} };
@@ -2321,7 +2321,7 @@ function Ze(a2) {
2321
2321
  for (c2 in b2) if (b2.hasOwnProperty(c2) && c2 in Ye) return Xe[a2] = b2[c2];
2322
2322
  return a2;
2323
2323
  }
2324
- var $e = Ze("animationend"), af = Ze("animationiteration"), bf = Ze("animationstart"), cf2 = Ze("transitionend"), df = /* @__PURE__ */ new Map(), ef = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
2324
+ var $e = Ze("animationend"), af = Ze("animationiteration"), bf = Ze("animationstart"), cf = Ze("transitionend"), df = /* @__PURE__ */ new Map(), ef = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");
2325
2325
  function ff(a2, b2) {
2326
2326
  df.set(a2, b2);
2327
2327
  fa(b2, [a2]);
@@ -2336,7 +2336,7 @@ ff(bf, "onAnimationStart");
2336
2336
  ff("dblclick", "onDoubleClick");
2337
2337
  ff("focusin", "onFocus");
2338
2338
  ff("focusout", "onBlur");
2339
- ff(cf2, "onTransitionEnd");
2339
+ ff(cf, "onTransitionEnd");
2340
2340
  ha("onMouseEnter", ["mouseout", "mouseover"]);
2341
2341
  ha("onMouseLeave", ["mouseout", "mouseover"]);
2342
2342
  ha("onPointerEnter", ["pointerout", "pointerover"]);
@@ -2505,7 +2505,7 @@ function hd(a2, b2, c2, d2, e2) {
2505
2505
  case bf:
2506
2506
  k3 = Hd;
2507
2507
  break;
2508
- case cf2:
2508
+ case cf:
2509
2509
  k3 = Xd;
2510
2510
  break;
2511
2511
  case "scroll":
@@ -2814,7 +2814,7 @@ function bg(a2, b2, c2) {
2814
2814
  for (var e2 in d2) if (!(e2 in b2)) throw Error(p$3(108, Ra(a2) || "Unknown", e2));
2815
2815
  return A$1({}, c2, d2);
2816
2816
  }
2817
- function cg2(a2) {
2817
+ function cg(a2) {
2818
2818
  a2 = (a2 = a2.stateNode) && a2.__reactInternalMemoizedMergedChildContext || Vf;
2819
2819
  Xf = H$1.current;
2820
2820
  G$2(H$1, a2);
@@ -3641,7 +3641,7 @@ function bi() {
3641
3641
  Uh = 0;
3642
3642
  return a2;
3643
3643
  }
3644
- function ci() {
3644
+ function ci2() {
3645
3645
  var a2 = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null };
3646
3646
  null === P$1 ? N$1.memoizedState = P$1 = a2 : P$1 = P$1.next = a2;
3647
3647
  return P$1;
@@ -3779,7 +3779,7 @@ function pi(a2) {
3779
3779
  null !== b2 && mh(b2, a2, 1, -1);
3780
3780
  }
3781
3781
  function qi(a2) {
3782
- var b2 = ci();
3782
+ var b2 = ci2();
3783
3783
  "function" === typeof a2 && (a2 = a2());
3784
3784
  b2.memoizedState = b2.baseState = a2;
3785
3785
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: ei, lastRenderedState: a2 };
@@ -3797,7 +3797,7 @@ function si() {
3797
3797
  return di().memoizedState;
3798
3798
  }
3799
3799
  function ti(a2, b2, c2, d2) {
3800
- var e2 = ci();
3800
+ var e2 = ci2();
3801
3801
  N$1.flags |= a2;
3802
3802
  e2.memoizedState = li(1 | b2, c2, void 0, void 0 === d2 ? null : d2);
3803
3803
  }
@@ -3931,7 +3931,7 @@ function Ji(a2, b2, c2) {
3931
3931
  }
3932
3932
  }
3933
3933
  var ai = { readContext: Vg, useCallback: Q$1, useContext: Q$1, useEffect: Q$1, useImperativeHandle: Q$1, useInsertionEffect: Q$1, useLayoutEffect: Q$1, useMemo: Q$1, useReducer: Q$1, useRef: Q$1, useState: Q$1, useDebugValue: Q$1, useDeferredValue: Q$1, useTransition: Q$1, useMutableSource: Q$1, useSyncExternalStore: Q$1, useId: Q$1, unstable_isNewReconciler: false }, Yh = { readContext: Vg, useCallback: function(a2, b2) {
3934
- ci().memoizedState = [a2, void 0 === b2 ? null : b2];
3934
+ ci2().memoizedState = [a2, void 0 === b2 ? null : b2];
3935
3935
  return a2;
3936
3936
  }, useContext: Vg, useEffect: vi, useImperativeHandle: function(a2, b2, c2) {
3937
3937
  c2 = null !== c2 && void 0 !== c2 ? c2.concat([a2]) : null;
@@ -3946,13 +3946,13 @@ var ai = { readContext: Vg, useCallback: Q$1, useContext: Q$1, useEffect: Q$1, u
3946
3946
  }, useInsertionEffect: function(a2, b2) {
3947
3947
  return ti(4, 2, a2, b2);
3948
3948
  }, useMemo: function(a2, b2) {
3949
- var c2 = ci();
3949
+ var c2 = ci2();
3950
3950
  b2 = void 0 === b2 ? null : b2;
3951
3951
  a2 = a2();
3952
3952
  c2.memoizedState = [a2, b2];
3953
3953
  return a2;
3954
3954
  }, useReducer: function(a2, b2, c2) {
3955
- var d2 = ci();
3955
+ var d2 = ci2();
3956
3956
  b2 = void 0 !== c2 ? c2(b2) : b2;
3957
3957
  d2.memoizedState = d2.baseState = b2;
3958
3958
  a2 = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: a2, lastRenderedState: b2 };
@@ -3960,19 +3960,19 @@ var ai = { readContext: Vg, useCallback: Q$1, useContext: Q$1, useEffect: Q$1, u
3960
3960
  a2 = a2.dispatch = Gi.bind(null, N$1, a2);
3961
3961
  return [d2.memoizedState, a2];
3962
3962
  }, useRef: function(a2) {
3963
- var b2 = ci();
3963
+ var b2 = ci2();
3964
3964
  a2 = { current: a2 };
3965
3965
  return b2.memoizedState = a2;
3966
3966
  }, useState: qi, useDebugValue: Ai, useDeferredValue: function(a2) {
3967
- return ci().memoizedState = a2;
3967
+ return ci2().memoizedState = a2;
3968
3968
  }, useTransition: function() {
3969
3969
  var a2 = qi(false), b2 = a2[0];
3970
3970
  a2 = Ei.bind(null, a2[1]);
3971
- ci().memoizedState = a2;
3971
+ ci2().memoizedState = a2;
3972
3972
  return [b2, a2];
3973
3973
  }, useMutableSource: function() {
3974
3974
  }, useSyncExternalStore: function(a2, b2, c2) {
3975
- var d2 = N$1, e2 = ci();
3975
+ var d2 = N$1, e2 = ci2();
3976
3976
  if (I) {
3977
3977
  if (void 0 === c2) throw Error(p$3(407));
3978
3978
  c2 = c2();
@@ -3994,7 +3994,7 @@ var ai = { readContext: Vg, useCallback: Q$1, useContext: Q$1, useEffect: Q$1, u
3994
3994
  li(9, mi.bind(null, d2, f2, c2, b2), void 0, null);
3995
3995
  return c2;
3996
3996
  }, useId: function() {
3997
- var a2 = ci(), b2 = R$2.identifierPrefix;
3997
+ var a2 = ci2(), b2 = R$2.identifierPrefix;
3998
3998
  if (I) {
3999
3999
  var c2 = sg;
4000
4000
  var d2 = rg;
@@ -4142,7 +4142,7 @@ function Zi(a2, b2, c2, d2, e2) {
4142
4142
  function aj(a2, b2, c2, d2, e2) {
4143
4143
  if (null === a2) {
4144
4144
  var f2 = c2.type;
4145
- if ("function" === typeof f2 && !bj(f2) && void 0 === f2.defaultProps && null === c2.compare && void 0 === c2.defaultProps) return b2.tag = 15, b2.type = f2, cj(a2, b2, f2, d2, e2);
4145
+ if ("function" === typeof f2 && !bj(f2) && void 0 === f2.defaultProps && null === c2.compare && void 0 === c2.defaultProps) return b2.tag = 15, b2.type = f2, cj2(a2, b2, f2, d2, e2);
4146
4146
  a2 = yh(c2.type, null, d2, b2, b2.mode, e2);
4147
4147
  a2.ref = b2.ref;
4148
4148
  a2.return = b2;
@@ -4161,7 +4161,7 @@ function aj(a2, b2, c2, d2, e2) {
4161
4161
  a2.return = b2;
4162
4162
  return b2.child = a2;
4163
4163
  }
4164
- function cj(a2, b2, c2, d2, e2) {
4164
+ function cj2(a2, b2, c2, d2, e2) {
4165
4165
  if (null !== a2) {
4166
4166
  var f2 = a2.memoizedProps;
4167
4167
  if (Ie$1(f2, d2) && a2.ref === b2.ref) if (Ug = false, b2.pendingProps = d2 = f2, 0 !== (a2.lanes & e2)) 0 !== (a2.flags & 131072) && (Ug = true);
@@ -4202,7 +4202,7 @@ function dj(a2, b2, c2, d2, e2) {
4202
4202
  function ij(a2, b2, c2, d2, e2) {
4203
4203
  if (Zf(c2)) {
4204
4204
  var f2 = true;
4205
- cg2(b2);
4205
+ cg(b2);
4206
4206
  } else f2 = false;
4207
4207
  Tg(b2, e2);
4208
4208
  if (null === b2.stateNode) jj(a2, b2), ph(b2, c2, d2), rh(b2, c2, d2, e2), d2 = true;
@@ -4510,7 +4510,7 @@ function zj(a2, b2, c2) {
4510
4510
  Kh(b2);
4511
4511
  break;
4512
4512
  case 1:
4513
- Zf(b2.type) && cg2(b2);
4513
+ Zf(b2.type) && cg(b2);
4514
4514
  break;
4515
4515
  case 4:
4516
4516
  Ih(b2, b2.stateNode.containerInfo);
@@ -6483,7 +6483,7 @@ Wk = function(a2, b2, c2) {
6483
6483
  e2 = Xh(null, b2, d2, a2, e2, c2);
6484
6484
  var f2 = bi();
6485
6485
  b2.flags |= 1;
6486
- "object" === typeof e2 && null !== e2 && "function" === typeof e2.render && void 0 === e2.$$typeof ? (b2.tag = 1, b2.memoizedState = null, b2.updateQueue = null, Zf(d2) ? (f2 = true, cg2(b2)) : f2 = false, b2.memoizedState = null !== e2.state && void 0 !== e2.state ? e2.state : null, ah(b2), e2.updater = nh, b2.stateNode = e2, e2._reactInternals = b2, rh(b2, d2, a2, c2), b2 = kj(null, b2, d2, true, f2, c2)) : (b2.tag = 0, I && f2 && vg(b2), Yi(null, b2, e2, c2), b2 = b2.child);
6486
+ "object" === typeof e2 && null !== e2 && "function" === typeof e2.render && void 0 === e2.$$typeof ? (b2.tag = 1, b2.memoizedState = null, b2.updateQueue = null, Zf(d2) ? (f2 = true, cg(b2)) : f2 = false, b2.memoizedState = null !== e2.state && void 0 !== e2.state ? e2.state : null, ah(b2), e2.updater = nh, b2.stateNode = e2, e2._reactInternals = b2, rh(b2, d2, a2, c2), b2 = kj(null, b2, d2, true, f2, c2)) : (b2.tag = 0, I && f2 && vg(b2), Yi(null, b2, e2, c2), b2 = b2.child);
6487
6487
  return b2;
6488
6488
  case 16:
6489
6489
  d2 = b2.elementType;
@@ -6645,9 +6645,9 @@ Wk = function(a2, b2, c2) {
6645
6645
  case 14:
6646
6646
  return d2 = b2.type, e2 = Lg(d2, b2.pendingProps), e2 = Lg(d2.type, e2), aj(a2, b2, d2, e2, c2);
6647
6647
  case 15:
6648
- return cj(a2, b2, b2.type, b2.pendingProps, c2);
6648
+ return cj2(a2, b2, b2.type, b2.pendingProps, c2);
6649
6649
  case 17:
6650
- return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Lg(d2, e2), jj(a2, b2), b2.tag = 1, Zf(d2) ? (a2 = true, cg2(b2)) : a2 = false, Tg(b2, c2), ph(b2, d2, e2), rh(b2, d2, e2, c2), kj(null, b2, d2, true, a2, c2);
6650
+ return d2 = b2.type, e2 = b2.pendingProps, e2 = b2.elementType === d2 ? e2 : Lg(d2, e2), jj(a2, b2), b2.tag = 1, Zf(d2) ? (a2 = true, cg(b2)) : a2 = false, Tg(b2, c2), ph(b2, d2, e2), rh(b2, d2, e2, c2), kj(null, b2, d2, true, a2, c2);
6651
6651
  case 19:
6652
6652
  return yj(a2, b2, c2);
6653
6653
  case 22:
@@ -7832,6 +7832,20 @@ const BookCheck = createLucideIcon("BookCheck", [
7832
7832
  ["path", { d: "M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20", key: "t4utmx" }],
7833
7833
  ["path", { d: "m9 9.5 2 2 4-4", key: "1dth82" }]
7834
7834
  ]);
7835
+ /**
7836
+ * @license lucide-react v0.378.0 - ISC
7837
+ *
7838
+ * This source code is licensed under the ISC license.
7839
+ * See the LICENSE file in the root directory of this source tree.
7840
+ */
7841
+ const BookOpenText = createLucideIcon("BookOpenText", [
7842
+ ["path", { d: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z", key: "vv98re" }],
7843
+ ["path", { d: "M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z", key: "1cyq3y" }],
7844
+ ["path", { d: "M6 8h2", key: "30oboj" }],
7845
+ ["path", { d: "M6 12h2", key: "32wvfc" }],
7846
+ ["path", { d: "M16 8h2", key: "msurwy" }],
7847
+ ["path", { d: "M16 12h2", key: "7q9ll5" }]
7848
+ ]);
7835
7849
  /**
7836
7850
  * @license lucide-react v0.378.0 - ISC
7837
7851
  *
@@ -7921,6 +7935,31 @@ const Brain = createLucideIcon("Brain", [
7921
7935
  ["path", { d: "M6 18a4 4 0 0 1-1.967-.516", key: "2e4loj" }],
7922
7936
  ["path", { d: "M19.967 17.484A4 4 0 0 1 18 18", key: "159ez6" }]
7923
7937
  ]);
7938
+ /**
7939
+ * @license lucide-react v0.378.0 - ISC
7940
+ *
7941
+ * This source code is licensed under the ISC license.
7942
+ * See the LICENSE file in the root directory of this source tree.
7943
+ */
7944
+ const Bug = createLucideIcon("Bug", [
7945
+ ["path", { d: "m8 2 1.88 1.88", key: "fmnt4t" }],
7946
+ ["path", { d: "M14.12 3.88 16 2", key: "qol33r" }],
7947
+ ["path", { d: "M9 7.13v-1a3.003 3.003 0 1 1 6 0v1", key: "d7y7pr" }],
7948
+ [
7949
+ "path",
7950
+ {
7951
+ d: "M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",
7952
+ key: "xs1cw7"
7953
+ }
7954
+ ],
7955
+ ["path", { d: "M12 20v-9", key: "1qisl0" }],
7956
+ ["path", { d: "M6.53 9C4.6 8.8 3 7.1 3 5", key: "32zzws" }],
7957
+ ["path", { d: "M6 13H2", key: "82j7cp" }],
7958
+ ["path", { d: "M3 21c0-2.1 1.7-3.9 3.8-4", key: "4p0ekp" }],
7959
+ ["path", { d: "M20.97 5c0 2.1-1.6 3.8-3.5 4", key: "18gb23" }],
7960
+ ["path", { d: "M22 13h-4", key: "1jl80f" }],
7961
+ ["path", { d: "M17.2 17c2.1.1 3.8 1.9 3.8 4", key: "k3fwyw" }]
7962
+ ]);
7924
7963
  /**
7925
7964
  * @license lucide-react v0.378.0 - ISC
7926
7965
  *
@@ -8329,6 +8368,22 @@ const ListMinus = createLucideIcon("ListMinus", [
8329
8368
  const LoaderCircle = createLucideIcon("LoaderCircle", [
8330
8369
  ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
8331
8370
  ]);
8371
+ /**
8372
+ * @license lucide-react v0.378.0 - ISC
8373
+ *
8374
+ * This source code is licensed under the ISC license.
8375
+ * See the LICENSE file in the root directory of this source tree.
8376
+ */
8377
+ const Loader = createLucideIcon("Loader", [
8378
+ ["path", { d: "M12 2v4", key: "3427ic" }],
8379
+ ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
8380
+ ["path", { d: "M18 12h4", key: "wj9ykh" }],
8381
+ ["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
8382
+ ["path", { d: "M12 18v4", key: "jadmvz" }],
8383
+ ["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
8384
+ ["path", { d: "M2 12h4", key: "j09sii" }],
8385
+ ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
8386
+ ]);
8332
8387
  /**
8333
8388
  * @license lucide-react v0.378.0 - ISC
8334
8389
  *
@@ -9071,7 +9126,7 @@ function tooltipForContextItem(item2) {
9071
9126
  return item2.title || "Local workspace";
9072
9127
  }
9073
9128
  if (item2.type === "file") {
9074
- return item2.isTooLarge ? item2.source === ContextItemSource.Initial ? "File is too large. Select a smaller range of lines from the file." : "File is too large. Try adding the file again with a smaller range of lines." : displayPath(URI.parse(item2.uri));
9129
+ return item2.isTooLarge ? item2.source === ContextItemSource.Initial ? "File is too large. Select a smaller range of lines from the file." : "File is too large. Try adding the file again with a smaller range of lines." : item2.range ? displayPathWithLines(URI.parse(item2.uri), item2.range) : displayPath(URI.parse(item2.uri));
9075
9130
  }
9076
9131
  if (is$2(OpenCtxItemWithTooltipSchema, item2)) {
9077
9132
  return item2.mention.data.tooltip;
@@ -10759,7 +10814,7 @@ function fromSerializedPromptEditorState(state) {
10759
10814
  }
10760
10815
  function toSerializedPromptEditorValue(doc2) {
10761
10816
  const contextItems = [];
10762
- const direction = (typeof window !== "undefined" ? window.getComputedStyle(window.document.body).direction : null) === "rtl" ? "rtl" : "ltr";
10817
+ const direction = (typeof window !== "undefined" ? window.getComputedStyle(window.document.body).direction : null) === "rtl" ? "rtl" : null;
10763
10818
  doc2.descendants((node2) => {
10764
10819
  if (node2.type.name === "mention") {
10765
10820
  contextItems.push(node2.attrs.item);
@@ -10832,8 +10887,8 @@ function toSerializedPromptEditorValue(doc2) {
10832
10887
  text: doc2.textContent,
10833
10888
  contextItems,
10834
10889
  editorState: {
10835
- v: "lexical-v1",
10836
- minReaderV: "lexical-v1",
10890
+ v: "lexical-v0",
10891
+ minReaderV: "lexical-v0",
10837
10892
  lexicalEditorState: {
10838
10893
  root: serializeRoot(doc2)
10839
10894
  }
@@ -26240,7 +26295,7 @@ function getAtMentionPosition(state) {
26240
26295
  }
26241
26296
  return decoration.from;
26242
26297
  }
26243
- function setMentionValue(state, value) {
26298
+ function setAtMentionValue(state, value) {
26244
26299
  var _a;
26245
26300
  const decoration = (_a = atMentionPluginKey.getState(state)) == null ? void 0 : _a.decoration.find()[0];
26246
26301
  if (!decoration) {
@@ -26359,6 +26414,9 @@ const schema = new Schema({
26359
26414
  }
26360
26415
  }
26361
26416
  });
26417
+ function createMentionNode(attrs) {
26418
+ return schema.nodes.mention.create(attrs, schema.text(contextItemMentionNodeDisplayText(attrs.item)));
26419
+ }
26362
26420
  const prosemirrorActor = fromCallback(
26363
26421
  ({ receive, input: input2 }) => {
26364
26422
  const parent = input2.parent;
@@ -26417,15 +26475,11 @@ const prosemirrorActor = fromCallback(
26417
26475
  }
26418
26476
  }
26419
26477
  });
26420
- function doFocus() {
26421
- editor2.focus();
26422
- editor2.dispatch(editor2.state.tr.scrollIntoView());
26423
- }
26424
26478
  receive((event) => {
26425
26479
  switch (event.type) {
26426
26480
  case "focus":
26427
- doFocus();
26428
- setTimeout(doFocus);
26481
+ editor2.focus();
26482
+ editor2.dispatch(editor2.state.tr.scrollIntoView());
26429
26483
  break;
26430
26484
  case "blur":
26431
26485
  editor2.dom.blur();
@@ -26575,7 +26629,10 @@ const promptInput = setup({
26575
26629
  selectedIndex: 0,
26576
26630
  items: [],
26577
26631
  position: { top: 0, left: 0, bottom: 0, right: 0 }
26578
- }
26632
+ },
26633
+ handleSelectMenuItem: input2.handleSelectMenuItem ?? ((_item, api2) => {
26634
+ api2.deleteAtMention();
26635
+ })
26579
26636
  }),
26580
26637
  type: "parallel",
26581
26638
  states: {
@@ -26659,54 +26716,14 @@ const promptInput = setup({
26659
26716
  }
26660
26717
  })
26661
26718
  },
26662
- "document.set": {
26663
- actions: {
26664
- type: "updateEditorState",
26665
- params: ({ event, context: context2 }) => context2.editorState.tr.replaceWith(
26666
- 0,
26667
- context2.editorState.doc.content.size,
26668
- event.doc
26669
- )
26670
- }
26671
- },
26672
- "document.append": {
26673
- actions: {
26674
- type: "updateEditorState",
26675
- params: ({ context: context2, event }) => {
26676
- const tr = context2.editorState.tr;
26677
- tr.setSelection(Selection.atEnd(tr.doc));
26678
- return insertWhitespaceIfNeeded(tr).insertText(event.text);
26679
- }
26680
- }
26681
- },
26682
- "document.mentions.filter": {
26719
+ "document.update": {
26683
26720
  actions: {
26684
26721
  type: "updateEditorState",
26685
- params: ({ context: context2, event }) => filterMentions(context2.editorState, event.filter)
26686
- }
26687
- },
26688
- "document.mentions.add": {
26689
- actions: {
26690
- type: "updateEditorState",
26691
- params: ({ context: context2, event }) => addMentions(
26692
- context2.editorState,
26693
- event.items,
26694
- event.position,
26695
- event.separator
26696
- )
26697
- }
26698
- },
26699
- "document.mentions.upsert": {
26700
- actions: {
26701
- type: "updateEditorState",
26702
- params: ({ context: context2, event }) => upsertMentions(
26703
- context2.editorState,
26704
- event.items,
26705
- event.position,
26706
- event.separator
26707
- )
26722
+ params: ({ event, context: context2 }) => event.transaction(context2.editorState)
26708
26723
  }
26709
26724
  },
26725
+ // TODO(@fkling): Find a good way to way move the change document logic out of the state machine
26726
+ // while keeping the concept of 'can set initial mentions' in it.
26710
26727
  "document.mentions.setInitial": {
26711
26728
  guard: "canSetInitialMentions",
26712
26729
  actions: [
@@ -26734,59 +26751,39 @@ const promptInput = setup({
26734
26751
  ]
26735
26752
  },
26736
26753
  // This event is raised when a mention item is supposed to be 'applied to the editor'. This can mean
26737
- // different things depending on the item:
26738
- // - If the item is a ContextItem, it will be inserted as a mention node.
26739
- // - If the item is a ContextMentionProviderMetadata, we'll update the mentions menu to show the provider's
26740
- // items.
26741
- // - There are some hardcoded behaviors for specific items, e.g. large files without a range.
26754
+ // different things depending on the item. The decision is delegated to `handleSelectMenuItem`, which
26755
+ // receives a small API object to make changes to the input.
26742
26756
  "atMention.apply": {
26743
26757
  actions: enqueueActions(({ context: context2, enqueue, event }) => {
26744
- var _a, _b, _c, _d;
26745
26758
  const item2 = event.item;
26746
- if ("id" in item2) {
26747
- enqueue({
26748
- type: "updateEditorState",
26749
- params: setMentionValue(context2.editorState, "")
26750
- });
26751
- enqueue.raise({ type: "mentionsMenu.provider.set", provider: item2 });
26752
- return;
26753
- }
26754
- if (item2.provider === "openctx" && "providerUri" in item2) {
26755
- if (item2.providerUri === REMOTE_FILE_PROVIDER_URI && ((_b = (_a = item2.mention) == null ? void 0 : _a.data) == null ? void 0 : _b.repoName) && !item2.mention.data.filePath || item2.providerUri === REMOTE_DIRECTORY_PROVIDER_URI && ((_d = (_c = item2.mention) == null ? void 0 : _c.data) == null ? void 0 : _d.repoName) && !item2.mention.data.directoryPath) {
26759
+ context2.handleSelectMenuItem(item2, {
26760
+ setAtMentionValue(value) {
26756
26761
  enqueue({
26757
26762
  type: "updateEditorState",
26758
- params: setMentionValue(
26763
+ params: setAtMentionValue(context2.editorState, value)
26764
+ });
26765
+ },
26766
+ replaceAtMentionValue(value) {
26767
+ enqueue({
26768
+ type: "updateEditorState",
26769
+ params: replaceAtMention(
26759
26770
  context2.editorState,
26760
- item2.mention.data.repoName + ":"
26771
+ typeof value === "string" ? schema.text(value) : value
26761
26772
  )
26762
26773
  });
26774
+ },
26775
+ deleteAtMention() {
26776
+ enqueue({
26777
+ type: "updateEditorState",
26778
+ params: replaceAtMention(context2.editorState, schema.text(""))
26779
+ });
26780
+ },
26781
+ setProvider(item22) {
26782
+ enqueue.raise({ type: "mentionsMenu.provider.set", provider: item22 });
26783
+ },
26784
+ resetSelectedMenuItem() {
26763
26785
  enqueue({ type: "assignMentionsMenu", params: { selectedIndex: 0 } });
26764
- return;
26765
26786
  }
26766
- }
26767
- if (item2.isTooLarge && !item2.range) {
26768
- enqueue({
26769
- type: "updateEditorState",
26770
- params: setMentionValue(
26771
- context2.editorState,
26772
- contextItemMentionNodeDisplayText(serializeContextItem(item2)) + ":"
26773
- )
26774
- });
26775
- return;
26776
- }
26777
- if (item2.type === "open-link") {
26778
- enqueue({
26779
- type: "updateEditorState",
26780
- params: replaceAtMention(context2.editorState, schema.text(""))
26781
- });
26782
- return;
26783
- }
26784
- enqueue({
26785
- type: "updateEditorState",
26786
- params: replaceAtMention(
26787
- context2.editorState,
26788
- createMentionNode({ item: serializeContextItem(item2) })
26789
- )
26790
26787
  });
26791
26788
  })
26792
26789
  },
@@ -26947,132 +26944,6 @@ const promptInput = setup({
26947
26944
  }
26948
26945
  }
26949
26946
  });
26950
- function insertWhitespaceIfNeeded(tr, pos) {
26951
- pos = pos ?? tr.selection.from;
26952
- if (!/(^|\s)$/.test(tr.doc.textBetween(0, pos))) {
26953
- tr.insertText(" ", pos);
26954
- }
26955
- return tr;
26956
- }
26957
- function filterMentions(state, filter2) {
26958
- const tr = state.tr;
26959
- state.doc.descendants((node2, pos) => {
26960
- if (node2.type === schema.nodes.mention) {
26961
- const item2 = node2.attrs.item;
26962
- if (!filter2(item2)) {
26963
- tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
26964
- }
26965
- }
26966
- });
26967
- return tr;
26968
- }
26969
- function getMentions(doc2) {
26970
- const mentions = [];
26971
- doc2.descendants((node2) => {
26972
- if (node2.type === schema.nodes.mention) {
26973
- mentions.push(node2.attrs.item);
26974
- return false;
26975
- }
26976
- return true;
26977
- });
26978
- return mentions;
26979
- }
26980
- function addMentions(state, items, position2, separator) {
26981
- const existingMentions = getMentions(state.doc);
26982
- const operations = getMentionOperations(existingMentions, items);
26983
- const tr = state.tr;
26984
- if (operations.modify.size + operations.delete.size > 0) {
26985
- state.doc.descendants((node2, pos) => {
26986
- if (node2.type === schema.nodes.mention) {
26987
- const item2 = node2.attrs.item;
26988
- if (operations.delete.has(item2)) {
26989
- tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
26990
- } else if (operations.modify.has(item2)) {
26991
- const newItem = operations.modify.get(item2);
26992
- if (newItem) {
26993
- tr.replaceWith(
26994
- tr.mapping.map(pos),
26995
- tr.mapping.map(pos + node2.nodeSize),
26996
- createMentionNode({ item: newItem })
26997
- );
26998
- }
26999
- }
27000
- }
27001
- });
27002
- }
27003
- if (operations.create.length > 0) {
27004
- const mentionNodes = [];
27005
- const separatorNode = state.schema.text(separator);
27006
- for (const item2 of operations.create) {
27007
- mentionNodes.push(createMentionNode({ item: item2 }));
27008
- mentionNodes.push(separatorNode);
27009
- }
27010
- if (position2 === "before") {
27011
- tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
27012
- } else {
27013
- insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
27014
- tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
27015
- }
27016
- }
27017
- return tr;
27018
- }
27019
- function upsertMentions(state, items, position2, separator) {
27020
- const existingMentions = new Set(getMentions(state.doc).map(getKeyForContextItem));
27021
- const toUpdate = /* @__PURE__ */ new Map();
27022
- for (const item2 of items) {
27023
- const key = getKeyForContextItem(item2);
27024
- if (existingMentions.has(key)) {
27025
- toUpdate.set(key, item2);
27026
- }
27027
- }
27028
- const tr = state.tr;
27029
- if (toUpdate.size > 0) {
27030
- state.doc.descendants((node2, pos) => {
27031
- if (node2.type === schema.nodes.mention) {
27032
- const item2 = node2.attrs.item;
27033
- const key = getKeyForContextItem(item2);
27034
- if (toUpdate.has(key)) {
27035
- const newItem = toUpdate.get(key);
27036
- if (newItem) {
27037
- tr.replaceWith(
27038
- tr.mapping.map(pos),
27039
- tr.mapping.map(pos + node2.nodeSize),
27040
- createMentionNode({ item: newItem })
27041
- );
27042
- }
27043
- }
27044
- }
27045
- });
27046
- }
27047
- return toUpdate.size !== items.length ? insertMentions(
27048
- tr,
27049
- items.filter((item2) => !toUpdate.has(getKeyForContextItem(item2))),
27050
- position2,
27051
- separator
27052
- ) : tr;
27053
- }
27054
- function insertMentions(tr, items, position2, separator) {
27055
- const mentionNodes = [];
27056
- const separatorNode = schema.text(separator);
27057
- for (const item2 of items) {
27058
- mentionNodes.push(createMentionNode({ item: item2 }));
27059
- mentionNodes.push(separatorNode);
27060
- }
27061
- if (position2 === "before") {
27062
- tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
27063
- } else {
27064
- insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
27065
- tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
27066
- }
27067
- return tr;
27068
- }
27069
- function getKeyForContextItem(item2) {
27070
- let key = `${item2.uri.toString()}|${item2.type}`;
27071
- if (item2.type === "openctx") {
27072
- key += `|${item2.providerUri}`;
27073
- }
27074
- return key;
27075
- }
27076
26947
  function isEditorContentOnlyInitialContext(state) {
27077
26948
  let onlyInitialContext = true;
27078
26949
  state.doc.descendants((node2) => {
@@ -27103,9 +26974,6 @@ function isEditorContentOnlyInitialContext(state) {
27103
26974
  });
27104
26975
  return onlyInitialContext;
27105
26976
  }
27106
- function createMentionNode(attrs) {
27107
- return schema.nodes.mention.create(attrs, schema.text(contextItemMentionNodeDisplayText(attrs.item)));
27108
- }
27109
26977
  function hasWindow() {
27110
26978
  return typeof window !== "undefined";
27111
26979
  }
@@ -30188,6 +30056,164 @@ function iconForContextItem(item2) {
30188
30056
  }
30189
30057
  return iconForProvider[providerURI] ?? AtSign;
30190
30058
  }
30059
+ function setDocument(state, newDoc) {
30060
+ return state.tr.replaceWith(0, state.doc.content.size, newDoc);
30061
+ }
30062
+ function appendToDocument(state, text2) {
30063
+ const tr = state.tr;
30064
+ tr.setSelection(Selection.atEnd(tr.doc));
30065
+ return insertWhitespaceIfNeeded(tr).insertText(text2);
30066
+ }
30067
+ function filterMentions(state, filter2) {
30068
+ const tr = state.tr;
30069
+ state.doc.descendants((node2, pos) => {
30070
+ if (node2.type === schema.nodes.mention) {
30071
+ const item2 = node2.attrs.item;
30072
+ if (!filter2(item2)) {
30073
+ tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
30074
+ }
30075
+ }
30076
+ });
30077
+ return tr;
30078
+ }
30079
+ function addMentions(state, items, position2, separator) {
30080
+ const existingMentions = getMentions(state.doc);
30081
+ const operations = getMentionOperations(existingMentions, items);
30082
+ const tr = state.tr;
30083
+ if (operations.modify.size + operations.delete.size > 0) {
30084
+ state.doc.descendants((node2, pos) => {
30085
+ if (node2.type === schema.nodes.mention) {
30086
+ const item2 = node2.attrs.item;
30087
+ if (operations.delete.has(item2)) {
30088
+ tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
30089
+ } else if (operations.modify.has(item2)) {
30090
+ const newItem = operations.modify.get(item2);
30091
+ if (newItem) {
30092
+ tr.replaceWith(
30093
+ tr.mapping.map(pos),
30094
+ tr.mapping.map(pos + node2.nodeSize),
30095
+ createMentionNode({ item: newItem })
30096
+ );
30097
+ }
30098
+ }
30099
+ }
30100
+ });
30101
+ }
30102
+ if (operations.create.length > 0) {
30103
+ const mentionNodes = [];
30104
+ const separatorNode = state.schema.text(separator);
30105
+ for (const item2 of operations.create) {
30106
+ mentionNodes.push(createMentionNode({ item: item2 }));
30107
+ mentionNodes.push(separatorNode);
30108
+ }
30109
+ if (position2 === "before") {
30110
+ tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
30111
+ } else {
30112
+ insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
30113
+ tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
30114
+ }
30115
+ }
30116
+ return tr;
30117
+ }
30118
+ function upsertMentions(state, items, position2, separator) {
30119
+ const existingMentions = new Set(getMentions(state.doc).map(getKeyForContextItem));
30120
+ const toUpdate = /* @__PURE__ */ new Map();
30121
+ for (const item2 of items) {
30122
+ const key = getKeyForContextItem(item2);
30123
+ if (existingMentions.has(key)) {
30124
+ toUpdate.set(key, item2);
30125
+ }
30126
+ }
30127
+ const tr = state.tr;
30128
+ if (toUpdate.size > 0) {
30129
+ state.doc.descendants((node2, pos) => {
30130
+ if (node2.type === schema.nodes.mention) {
30131
+ const item2 = node2.attrs.item;
30132
+ const key = getKeyForContextItem(item2);
30133
+ if (toUpdate.has(key)) {
30134
+ const newItem = toUpdate.get(key);
30135
+ if (newItem) {
30136
+ tr.replaceWith(
30137
+ tr.mapping.map(pos),
30138
+ tr.mapping.map(pos + node2.nodeSize),
30139
+ createMentionNode({ item: newItem })
30140
+ );
30141
+ }
30142
+ }
30143
+ }
30144
+ });
30145
+ }
30146
+ return toUpdate.size !== items.length ? insertMentions(
30147
+ tr,
30148
+ items.filter((item2) => !toUpdate.has(getKeyForContextItem(item2))),
30149
+ position2,
30150
+ separator
30151
+ ) : tr;
30152
+ }
30153
+ function getMentions(doc2) {
30154
+ const mentions = [];
30155
+ doc2.descendants((node2) => {
30156
+ if (node2.type === schema.nodes.mention) {
30157
+ mentions.push(node2.attrs.item);
30158
+ return false;
30159
+ }
30160
+ return true;
30161
+ });
30162
+ return mentions;
30163
+ }
30164
+ function handleSelectMenuItem(item2, api2) {
30165
+ var _a, _b, _c, _d;
30166
+ if ("id" in item2) {
30167
+ api2.setAtMentionValue("");
30168
+ api2.setProvider(item2);
30169
+ return;
30170
+ }
30171
+ if (item2.provider === "openctx" && "providerUri" in item2) {
30172
+ if (item2.providerUri === REMOTE_FILE_PROVIDER_URI && ((_b = (_a = item2.mention) == null ? void 0 : _a.data) == null ? void 0 : _b.repoName) && !item2.mention.data.filePath || item2.providerUri === REMOTE_DIRECTORY_PROVIDER_URI && ((_d = (_c = item2.mention) == null ? void 0 : _c.data) == null ? void 0 : _d.repoName) && !item2.mention.data.directoryPath) {
30173
+ api2.setAtMentionValue(item2.mention.data.repoName + ":");
30174
+ api2.resetSelectedMenuItem();
30175
+ return;
30176
+ }
30177
+ }
30178
+ if (item2.isTooLarge && !item2.range) {
30179
+ api2.setAtMentionValue(contextItemMentionNodeDisplayText(serializeContextItem(item2)) + ":");
30180
+ return;
30181
+ }
30182
+ if (item2.type === "open-link") {
30183
+ api2.deleteAtMention();
30184
+ return;
30185
+ }
30186
+ api2.replaceAtMentionValue(createMentionNode({ item: serializeContextItem(item2) }));
30187
+ }
30188
+ function insertMentions(tr, items, position2, separator) {
30189
+ const mentionNodes = [];
30190
+ const separatorNode = schema.text(separator);
30191
+ for (const item2 of items) {
30192
+ mentionNodes.push(createMentionNode({ item: item2 }));
30193
+ mentionNodes.push(separatorNode);
30194
+ }
30195
+ if (position2 === "before") {
30196
+ tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
30197
+ } else {
30198
+ insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
30199
+ tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
30200
+ }
30201
+ return tr;
30202
+ }
30203
+ function getKeyForContextItem(item2) {
30204
+ let key = `${item2.uri.toString()}|${item2.type}`;
30205
+ if (item2.type === "openctx") {
30206
+ key += `|${item2.providerUri}`;
30207
+ }
30208
+ return key;
30209
+ }
30210
+ function insertWhitespaceIfNeeded(tr, pos) {
30211
+ pos = pos ?? tr.selection.from;
30212
+ if (!/(^|\s)$/.test(tr.doc.textBetween(0, pos))) {
30213
+ tr.insertText(" ", pos);
30214
+ }
30215
+ return tr;
30216
+ }
30191
30217
  function getCurrentEditorState(input2) {
30192
30218
  return input2.getSnapshot().context.editorState;
30193
30219
  }
@@ -30253,6 +30279,7 @@ const usePromptInput = (options) => {
30253
30279
  }
30254
30280
  }
30255
30281
  },
30282
+ handleSelectMenuItem,
30256
30283
  placeholder: options.placeholder,
30257
30284
  initialDocument: options.initialDocument,
30258
30285
  disabled: options.disabled,
@@ -30268,7 +30295,7 @@ const usePromptInput = (options) => {
30268
30295
  );
30269
30296
  },
30270
30297
  setDocument(doc2) {
30271
- editor2.send({ type: "document.set", doc: doc2 });
30298
+ editor2.send({ type: "document.update", transaction: (state) => setDocument(state, doc2) });
30272
30299
  },
30273
30300
  setInitialContextMentions(items) {
30274
30301
  editor2.send({
@@ -30277,29 +30304,31 @@ const usePromptInput = (options) => {
30277
30304
  });
30278
30305
  },
30279
30306
  appendText(text2) {
30280
- editor2.send({ type: "document.append", text: text2 });
30307
+ editor2.send({
30308
+ type: "document.update",
30309
+ transaction: (state) => appendToDocument(state, text2)
30310
+ });
30281
30311
  },
30282
- addMentions(items, position2 = "after", sep = " ") {
30312
+ addMentions(items, position2 = "after", seperator = " ") {
30283
30313
  editor2.send({
30284
- type: "document.mentions.add",
30285
- items: items.map(serializeContextItem),
30286
- position: position2,
30287
- separator: sep
30314
+ type: "document.update",
30315
+ transaction: (state) => addMentions(state, items.map(serializeContextItem), position2, seperator)
30288
30316
  });
30289
30317
  },
30290
- upsertMentions(items, position2 = "after", sep = " ", focusEditor = true) {
30318
+ upsertMentions(items, position2 = "after", seperator = " ", focusEditor = true) {
30291
30319
  editor2.send({
30292
- type: "document.mentions.upsert",
30293
- items: items.map(serializeContextItem),
30294
- position: position2,
30295
- separator: sep
30320
+ type: "document.update",
30321
+ transaction: (state) => upsertMentions(state, items.map(serializeContextItem), position2, seperator)
30296
30322
  });
30297
30323
  if (focusEditor) {
30298
30324
  editor2.send({ type: "focus" });
30299
30325
  }
30300
30326
  },
30301
30327
  filterMentions(filter2) {
30302
- editor2.send({ type: "document.mentions.filter", filter: filter2 });
30328
+ editor2.send({
30329
+ type: "document.update",
30330
+ transaction: (state) => filterMentions(state, filter2)
30331
+ });
30303
30332
  },
30304
30333
  applySuggestion(index2) {
30305
30334
  editor2.send({ type: "mentionsMenu.apply", index: index2 });
@@ -36601,7 +36630,8 @@ const promptEditorConfig = {
36601
36630
  const uri = URI.parse(contextItem2.uri);
36602
36631
  getVSCodeAPI().postMessage({
36603
36632
  command: "openURI",
36604
- uri
36633
+ uri,
36634
+ range: contextItem2.range
36605
36635
  });
36606
36636
  }
36607
36637
  },
@@ -37395,7 +37425,6 @@ function getTraceparentFromSpanContext(spanContext) {
37395
37425
  }
37396
37426
  memo$1(
37397
37427
  ({ className, authStatus, vscodeAPI, telemetryRecorder, allowEndpointChange }) => {
37398
- var _a;
37399
37428
  const [formState, setFormState] = useState$1({
37400
37429
  showAccessTokenField: false,
37401
37430
  isSubmitting: false,
@@ -37434,14 +37463,11 @@ memo$1(
37434
37463
  });
37435
37464
  } finally {
37436
37465
  setTimeout(() => {
37437
- setFormState((prev) => {
37438
- var _a2;
37439
- return {
37440
- ...prev,
37441
- isSubmitting: false,
37442
- showAuthError: !!(authStatus == null ? void 0 : authStatus.authenticated) || ((_a2 = authStatus == null ? void 0 : authStatus.error) == null ? void 0 : _a2.type) === "network-error"
37443
- };
37444
- });
37466
+ setFormState((prev) => ({
37467
+ ...prev,
37468
+ isSubmitting: false,
37469
+ showAuthError: !!(authStatus == null ? void 0 : authStatus.authenticated) || isAuthError(authStatus == null ? void 0 : authStatus.error)
37470
+ }));
37445
37471
  }, 8e3);
37446
37472
  }
37447
37473
  },
@@ -37476,7 +37502,7 @@ memo$1(
37476
37502
  FormField,
37477
37503
  {
37478
37504
  name: "accessToken",
37479
- serverInvalid: authStatus && !authStatus.authenticated && ((_a = authStatus == null ? void 0 : authStatus.error) == null ? void 0 : _a.type) === "network-error",
37505
+ serverInvalid: authStatus && !authStatus.authenticated && isAvailabilityError(authStatus == null ? void 0 : authStatus.error),
37480
37506
  className: "tw-m-2",
37481
37507
  children: [
37482
37508
  /* @__PURE__ */ jsxs(
@@ -67252,7 +67278,8 @@ const ALLOWED_ELEMENTS = [
67252
67278
  "h4",
67253
67279
  "h5",
67254
67280
  "h6",
67255
- "br"
67281
+ "br",
67282
+ "think"
67256
67283
  ];
67257
67284
  function defaultUrlProcessor(url) {
67258
67285
  const processedURL = defaultUrlTransform(url);
@@ -67272,13 +67299,19 @@ function wrapLinksWithCodyOpenCommand(url) {
67272
67299
  const URL_PROCESSORS = {
67273
67300
  [CodyIDE.VSCode]: wrapLinksWithCodyOpenCommand
67274
67301
  };
67275
- const MarkdownFromCody = ({
67276
- className,
67277
- children: children2
67278
- }) => {
67302
+ const childrenTransform = (children2) => {
67303
+ if (children2.indexOf("```markdown") === -1) {
67304
+ return children2;
67305
+ }
67306
+ children2 = children2.replace("```markdown", "````markdown");
67307
+ const lastIdx = children2.lastIndexOf("```");
67308
+ return children2.slice(0, lastIdx) + "````" + children2.slice(lastIdx + 3);
67309
+ };
67310
+ const MarkdownFromCody = ({ className, children: children2 }) => {
67279
67311
  const clientType = useConfig().clientCapabilities.agentIDE;
67280
67312
  const urlTransform = useMemo$1(() => URL_PROCESSORS[clientType] ?? defaultUrlProcessor, [clientType]);
67281
- return /* @__PURE__ */ jsx(Markdown, { className, ...markdownPluginProps(), urlTransform, children: children2 });
67313
+ const chatReplyTransformed = childrenTransform(children2);
67314
+ return /* @__PURE__ */ jsx(Markdown, { className, ...markdownPluginProps(), urlTransform, children: chatReplyTransformed });
67282
67315
  };
67283
67316
  let _markdownPluginProps;
67284
67317
  function markdownPluginProps() {
@@ -67729,6 +67762,29 @@ function getCodeBlockId(contents, fileName) {
67729
67762
  }
67730
67763
  return cryptoJsExports.SHA256(input2).toString();
67731
67764
  }
67765
+ const lengthOfThinkTag = "<think>".length;
67766
+ function extractThinkContent(content2) {
67767
+ const thinkRegex = /^<think>([\s\S]*?)<\/think>/;
67768
+ const match = content2.match(thinkRegex);
67769
+ const startsWithThink = content2.startsWith("<think>");
67770
+ let thinkContent = "";
67771
+ let displayContent = content2;
67772
+ let isThinking = false;
67773
+ if (match) {
67774
+ thinkContent = match[1].trim();
67775
+ displayContent = content2.slice(match[0].length);
67776
+ isThinking = displayContent.trim() === "";
67777
+ } else if (startsWithThink) {
67778
+ thinkContent = content2.slice(lengthOfThinkTag);
67779
+ displayContent = "";
67780
+ isThinking = true;
67781
+ }
67782
+ return {
67783
+ displayContent,
67784
+ thinkContent,
67785
+ isThinking
67786
+ };
67787
+ }
67732
67788
  const ChatMessageContent = ({
67733
67789
  displayMarkdown,
67734
67790
  isMessageLoading,
@@ -67857,7 +67913,39 @@ const ChatMessageContent = ({
67857
67913
  smartApplyInterceptor,
67858
67914
  smartApplyStates
67859
67915
  ]);
67860
- return /* @__PURE__ */ jsx("div", { ref: rootRef, "data-testid": "chat-message-content", children: /* @__PURE__ */ jsx(MarkdownFromCody, { className: clsx$1(styles$s.content, className), children: displayMarkdown }) });
67916
+ const { displayContent, thinkContent, isThinking } = useMemo$1(
67917
+ () => extractThinkContent(displayMarkdown),
67918
+ [displayMarkdown]
67919
+ );
67920
+ return /* @__PURE__ */ jsxs("div", { ref: rootRef, "data-testid": "chat-message-content", children: [
67921
+ thinkContent.length > 0 && /* @__PURE__ */ jsxs(
67922
+ "details",
67923
+ {
67924
+ open: true,
67925
+ className: "tw-container tw-mb-7 tw-border tw-border-gray-500/20 dark:tw-border-gray-600/40 tw-rounded-lg tw-overflow-hidden tw-backdrop-blur-sm hover:tw-bg-gray-200/50 dark:hover:tw-bg-gray-700/50",
67926
+ title: "Thinking & Reasoning Space",
67927
+ children: [
67928
+ /* @__PURE__ */ jsxs(
67929
+ "summary",
67930
+ {
67931
+ className: clsx$1(
67932
+ "tw-flex tw-items-center tw-gap-2 tw-px-3 tw-py-2 tw-bg-gray-100/50 dark:tw-bg-gray-800/80 tw-cursor-pointer tw-select-none tw-transition-colors",
67933
+ {
67934
+ "tw-animate-pulse": isThinking
67935
+ }
67936
+ ),
67937
+ children: [
67938
+ isThinking ? /* @__PURE__ */ jsx(Loader, { size: 16, className: "tw-animate-spin tw-text-muted-foreground" }) : /* @__PURE__ */ jsx(Plus, { size: 16, className: "tw-text-muted-foreground" }),
67939
+ /* @__PURE__ */ jsx("span", { className: "tw-font-medium tw-text-gray-600 dark:tw-text-gray-300", children: isThinking ? "Thinking..." : "Thought Process" })
67940
+ ]
67941
+ }
67942
+ ),
67943
+ /* @__PURE__ */ jsx("div", { className: "tw-px-4 tw-py-3 tw-mx-4 tw-text-sm tw-prose dark:tw-prose-invert tw-max-w-none tw-leading-relaxed tw-text-base/7 tw-text-muted-foreground", children: thinkContent })
67944
+ ]
67945
+ }
67946
+ ),
67947
+ /* @__PURE__ */ jsx(MarkdownFromCody, { className: clsx$1(styles$s.content, className), children: displayContent })
67948
+ ] });
67861
67949
  };
67862
67950
  const errorItem = "_error-item_1sixu_1";
67863
67951
  const icon = "_icon_1sixu_13";
@@ -67957,7 +68045,7 @@ const RateLimitErrorItem = ({ error: error2, userInfo, postMessage }) => {
67957
68045
  /* @__PURE__ */ jsx("h1", { children: canUpgrade ? "Upgrade to Cody Pro" : "Unable to Send Message" }),
67958
68046
  /* @__PURE__ */ jsxs("p", { children: [
67959
68047
  error2.userMessage,
67960
- canUpgrade && " Upgrade to Cody Pro for unlimited autocomplete suggestions, chat messages and commands."
68048
+ canUpgrade && " Upgrade to Cody Pro for unlimited autocomplete suggestions, and increased limits for chat messages and commands."
67961
68049
  ] })
67962
68050
  ] }),
67963
68051
  /* @__PURE__ */ jsxs("div", { className: styles$q.actions, children: [
@@ -70550,7 +70638,8 @@ const PromptList = (props) => {
70550
70638
  onSelect: parentOnSelect,
70551
70639
  promptFilters
70552
70640
  } = props;
70553
- const endpointURL = new URL(useConfig().authStatus.endpoint);
70641
+ const { clientCapabilities, authStatus } = useConfig();
70642
+ const endpointURL = new URL(authStatus.endpoint);
70554
70643
  const telemetryRecorder = useTelemetryRecorder();
70555
70644
  const [lastUsedActions = {}] = useLocalStorage("last-used-actions-v2", {});
70556
70645
  const telemetryPublicMetadata = {
@@ -70635,12 +70724,18 @@ const PromptList = (props) => {
70635
70724
  return actions22.filter((action2) => action2.actionType === "prompt" && action2.builtin);
70636
70725
  }
70637
70726
  const shouldExcludeBuiltinCommands = (promptFilters == null ? void 0 : promptFilters.promoted) || (promptFilters == null ? void 0 : promptFilters.owner) || (promptFilters == null ? void 0 : promptFilters.tags);
70727
+ const isEditEnabled = clientCapabilities.edit === "enabled";
70728
+ if (!isEditEnabled) {
70729
+ actions22 = actions22.filter(
70730
+ (action2) => action2.actionType === "prompt" ? action2.mode === "CHAT" : action2.mode === "ask"
70731
+ );
70732
+ }
70638
70733
  if (shouldExcludeBuiltinCommands) {
70639
70734
  return actions22.filter((action2) => action2.actionType === "prompt" && !action2.builtin);
70640
70735
  }
70641
70736
  return actions22;
70642
70737
  },
70643
- [promptFilters]
70738
+ [promptFilters, clientCapabilities.edit]
70644
70739
  );
70645
70740
  const allActions = showOnlyPromptInsertableCommands ? (result2 == null ? void 0 : result2.actions.filter((action2) => action2.actionType === "prompt" || action2.mode === "ask")) ?? [] : (result2 == null ? void 0 : result2.actions) ?? [];
70646
70741
  const sortedActions = lastUsedSorting ? getSortedActions(filteredActions(allActions), lastUsedActions) : filteredActions(allActions);
@@ -72309,8 +72404,11 @@ const HistoryTabWithData = ({ IDE, webviewType, multipleWebviewsEnabled, setView
72309
72404
  ) }),
72310
72405
  sortedChatsByPeriod.map(([period, chats2]) => /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col", children: [
72311
72406
  /* @__PURE__ */ jsx("h4", { className: "tw-font-semibold tw-text-muted-foreground tw-py-2 tw-my-4", children: period }),
72312
- chats2.map(({ interactions, id: id2 }) => {
72407
+ chats2.map((chat2) => {
72313
72408
  var _a, _b, _c;
72409
+ const id2 = chat2.lastInteractionTimestamp;
72410
+ const interactions = chat2.interactions;
72411
+ const chatTitle = chat2.chatTitle;
72314
72412
  const lastMessage = (_c = (_b = (_a = interactions[interactions.length - 1]) == null ? void 0 : _a.humanMessage) == null ? void 0 : _b.text) == null ? void 0 : _c.trim();
72315
72413
  return /* @__PURE__ */ jsxs("div", { className: `tw-flex tw-flex-row tw-p-1 ${styles$8.historyRow}`, children: [
72316
72414
  /* @__PURE__ */ jsx(
@@ -72322,7 +72420,7 @@ const HistoryTabWithData = ({ IDE, webviewType, multipleWebviewsEnabled, setView
72322
72420
  command: "restoreHistory",
72323
72421
  chatID: id2
72324
72422
  }),
72325
- children: /* @__PURE__ */ jsx("span", { className: "tw-truncate tw-w-full", children: lastMessage })
72423
+ children: /* @__PURE__ */ jsx("span", { className: "tw-truncate tw-w-full", children: chatTitle || lastMessage })
72326
72424
  }
72327
72425
  ),
72328
72426
  /* @__PURE__ */ jsx(
@@ -73255,7 +73353,8 @@ const UserMenu = ({
73255
73353
  onCloseByEscape,
73256
73354
  allowEndpointChange,
73257
73355
  __storybook__open,
73258
- isWorkspacesUpgradeCtaEnabled
73356
+ isWorkspacesUpgradeCtaEnabled,
73357
+ IDE
73259
73358
  }) => {
73260
73359
  const telemetryRecorder = useTelemetryRecorder();
73261
73360
  const { displayName, username, primaryEmail, endpoint } = authStatus;
@@ -73429,6 +73528,92 @@ const UserMenu = ({
73429
73528
  ),
73430
73529
  /* @__PURE__ */ jsx(CommandItem, { onSelect: () => onMenuViewChange("switch"), children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow tw-rounded-md tw-text-center", children: "Cancel" }) })
73431
73530
  ] })
73531
+ ] }) : userMenuView === "debug" ? /* @__PURE__ */ jsxs(CommandList, { children: [
73532
+ /* @__PURE__ */ jsx(CommandGroup, { title: "Debug Menu", children: /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("main"), children: [
73533
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73534
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Back" })
73535
+ ] }) }),
73536
+ /* @__PURE__ */ jsxs(CommandGroup, { children: [
73537
+ /* @__PURE__ */ jsx(
73538
+ CommandItem,
73539
+ {
73540
+ onSelect: () => {
73541
+ getVSCodeAPI().postMessage({
73542
+ command: "command",
73543
+ id: "cody.debug.export.logs"
73544
+ });
73545
+ close2();
73546
+ },
73547
+ children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Export Logs" })
73548
+ }
73549
+ ),
73550
+ /* @__PURE__ */ jsx(
73551
+ CommandItem,
73552
+ {
73553
+ onSelect: () => {
73554
+ getVSCodeAPI().postMessage({
73555
+ command: "command",
73556
+ id: "cody.debug.enable.all"
73557
+ });
73558
+ close2();
73559
+ },
73560
+ children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Enable Debug Mode" })
73561
+ }
73562
+ ),
73563
+ /* @__PURE__ */ jsx(
73564
+ CommandItem,
73565
+ {
73566
+ onSelect: () => {
73567
+ getVSCodeAPI().postMessage({
73568
+ command: "command",
73569
+ id: "cody.debug.outputChannel"
73570
+ });
73571
+ close2();
73572
+ },
73573
+ children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Open Output Channel" })
73574
+ }
73575
+ )
73576
+ ] })
73577
+ ] }) : userMenuView === "help" ? /* @__PURE__ */ jsxs(CommandList, { children: [
73578
+ /* @__PURE__ */ jsx(CommandGroup, { title: "Help Menu", children: /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("main"), children: [
73579
+ /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73580
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Back" })
73581
+ ] }) }),
73582
+ /* @__PURE__ */ jsxs(CommandGroup, { children: [
73583
+ /* @__PURE__ */ jsxs(
73584
+ CommandLink,
73585
+ {
73586
+ href: "https://community.sourcegraph.com/",
73587
+ target: "_blank",
73588
+ rel: "noreferrer",
73589
+ onSelect: () => {
73590
+ telemetryRecorder.recordEvent(
73591
+ "cody.userMenu.helpLink",
73592
+ "open",
73593
+ {}
73594
+ );
73595
+ close2();
73596
+ },
73597
+ children: [
73598
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Sourcegraph Community" }),
73599
+ /* @__PURE__ */ jsx(ExternalLink, { size: 16, strokeWidth: 1.25 })
73600
+ ]
73601
+ }
73602
+ ),
73603
+ IDE === CodyIDE.VSCode && /* @__PURE__ */ jsx(
73604
+ CommandItem,
73605
+ {
73606
+ onSelect: () => {
73607
+ getVSCodeAPI().postMessage({
73608
+ command: "command",
73609
+ id: "cody.debug.reportIssue"
73610
+ });
73611
+ close2();
73612
+ },
73613
+ children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Report Issue" })
73614
+ }
73615
+ )
73616
+ ] })
73432
73617
  ] }) : userMenuView === "switch" ? /* @__PURE__ */ jsxs(CommandList, { children: [
73433
73618
  /* @__PURE__ */ jsx(CommandGroup, { title: "Switch Account Menu", children: /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("main"), children: [
73434
73619
  /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
@@ -73672,6 +73857,34 @@ const UserMenu = ({
73672
73857
  }
73673
73858
  )
73674
73859
  ] }),
73860
+ /* @__PURE__ */ jsxs(CommandGroup, { children: [
73861
+ IDE === CodyIDE.VSCode && /* @__PURE__ */ jsxs(
73862
+ CommandItem,
73863
+ {
73864
+ onSelect: () => {
73865
+ getVSCodeAPI().postMessage({
73866
+ command: "command",
73867
+ id: "cody.welcome"
73868
+ });
73869
+ close2();
73870
+ },
73871
+ children: [
73872
+ /* @__PURE__ */ jsx(BookOpenText, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73873
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Getting Started Guide" })
73874
+ ]
73875
+ }
73876
+ ),
73877
+ IDE === CodyIDE.VSCode && /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("debug"), children: [
73878
+ /* @__PURE__ */ jsx(Bug, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73879
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Debug" }),
73880
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, strokeWidth: 1.25 })
73881
+ ] }),
73882
+ /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("help"), children: [
73883
+ /* @__PURE__ */ jsx(CircleHelp, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73884
+ /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Help" }),
73885
+ /* @__PURE__ */ jsx(ChevronRight, { size: 16, strokeWidth: 1.25 })
73886
+ ] })
73887
+ ] }),
73675
73888
  /* @__PURE__ */ jsxs(CommandGroup, { children: [
73676
73889
  allowEndpointChange && /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("switch"), children: [
73677
73890
  /* @__PURE__ */ jsx(
@@ -73689,28 +73902,7 @@ const UserMenu = ({
73689
73902
  /* @__PURE__ */ jsx(LogOut, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73690
73903
  /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Sign Out" })
73691
73904
  ] })
73692
- ] }),
73693
- /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
73694
- CommandLink,
73695
- {
73696
- href: "https://community.sourcegraph.com/",
73697
- target: "_blank",
73698
- rel: "noreferrer",
73699
- onSelect: () => {
73700
- telemetryRecorder.recordEvent(
73701
- "cody.userMenu.helpLink",
73702
- "open",
73703
- {}
73704
- );
73705
- close2();
73706
- },
73707
- children: [
73708
- /* @__PURE__ */ jsx(CircleHelp, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73709
- /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Help" }),
73710
- /* @__PURE__ */ jsx(ExternalLink, { size: 16, strokeWidth: 1.25 })
73711
- ]
73712
- }
73713
- ) })
73905
+ ] })
73714
73906
  ] })
73715
73907
  }
73716
73908
  ),
@@ -73839,7 +74031,8 @@ const TabsBar = memo$1((props) => {
73839
74031
  endpointHistory,
73840
74032
  allowEndpointChange,
73841
74033
  className: "!tw-opacity-100 tw-h-full",
73842
- isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled
74034
+ isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled,
74035
+ IDE
73843
74036
  }
73844
74037
  )
73845
74038
  ] })
@@ -74472,7 +74665,7 @@ const HumanMessageEditor = ({
74472
74665
  var _a, _b, _c;
74473
74666
  const telemetryRecorder = useTelemetryRecorder();
74474
74667
  const editorRef = useRef$1(null);
74475
- useImperativeHandle(parentEditorRef, () => editorRef.current, []);
74668
+ useImperativeHandle(parentEditorRef, () => editorRef.current);
74476
74669
  const [isEmptyEditorValue, setIsEmptyEditorValue] = useState$1(
74477
74670
  initialEditorState ? textContentFromSerializedLexicalNode(initialEditorState.lexicalEditorState.root) === "" : true
74478
74671
  );
@@ -74485,7 +74678,6 @@ const HumanMessageEditor = ({
74485
74678
  [onChange]
74486
74679
  );
74487
74680
  const submitState = isPendingPriorResponse ? "waitingResponseComplete" : isEmptyEditorValue ? "emptyEditorValue" : "submittable";
74488
- const experimentalPromptEditorEnabled = useFeatureFlag(FeatureFlag.CodyExperimentalPromptEditor);
74489
74681
  const onSubmitClick = useCallback(
74490
74682
  (intent2, forceSubmit) => {
74491
74683
  if (!forceSubmit && submitState === "emptyEditorValue") {
@@ -74517,7 +74709,10 @@ const HumanMessageEditor = ({
74517
74709
  [submitState, parentOnSubmit, onStop, telemetryRecorder.recordEvent, isFirstMessage, isSent]
74518
74710
  );
74519
74711
  const omniBoxEnabled = useOmniBox();
74520
- const { isDotComUser } = useConfig();
74712
+ const {
74713
+ isDotComUser,
74714
+ config: { experimentalPromptEditorEnabled }
74715
+ } = useConfig();
74521
74716
  const onEditorEnterKey = useCallback(
74522
74717
  (event) => {
74523
74718
  if (!event || event.isComposing || isEmptyEditorValue || event.shiftKey) {
@@ -74703,18 +74898,20 @@ const HumanMessageEditor = ({
74703
74898
  const defaultContext = useDefaultContextForChat();
74704
74899
  useEffect$2(() => {
74705
74900
  var _a2;
74706
- let { initialContext } = defaultContext;
74707
- if (!isSent && isFirstMessage) {
74708
- const editor2 = editorRef.current;
74709
- if (editor2) {
74710
- if ((_a2 = currentChatModel == null ? void 0 : currentChatModel.tags) == null ? void 0 : _a2.includes(ModelTag.StreamDisabled)) {
74711
- initialContext = initialContext.filter((item2) => item2.type !== "tree");
74712
- }
74713
- const filteredItems = initialContext.filter((item2) => item2.type !== "open-link");
74714
- void editor2.setInitialContextMentions(filteredItems);
74715
- }
74901
+ if (isSent || !isFirstMessage || !(editorRef == null ? void 0 : editorRef.current)) {
74902
+ return;
74716
74903
  }
74717
- }, [defaultContext, isSent, isFirstMessage, currentChatModel]);
74904
+ const editor2 = editorRef.current;
74905
+ const excludedTypes = /* @__PURE__ */ new Set([
74906
+ "open-link",
74907
+ "current-selection",
74908
+ ...((_a2 = currentChatModel == null ? void 0 : currentChatModel.tags) == null ? void 0 : _a2.includes(ModelTag.StreamDisabled)) ? ["tree"] : []
74909
+ ]);
74910
+ const filteredItems = defaultContext == null ? void 0 : defaultContext.initialContext.filter(
74911
+ (item2) => !excludedTypes.has(item2.type)
74912
+ );
74913
+ void editor2.setInitialContextMentions(filteredItems);
74914
+ }, [defaultContext == null ? void 0 : defaultContext.initialContext, isSent, isFirstMessage, currentChatModel]);
74718
74915
  const focusEditor = useCallback(() => {
74719
74916
  var _a2;
74720
74917
  return (_a2 = editorRef.current) == null ? void 0 : _a2.setFocus(true);
@@ -77789,6 +77986,6 @@ export {
77789
77986
  ChatSkeleton,
77790
77987
  CodyPromptTemplate,
77791
77988
  CodyWebChat,
77792
- cg as deserialize,
77793
- cf as serialize
77989
+ cj as deserialize,
77990
+ ci as serialize
77794
77991
  };