@sourcegraph/cody-web 0.30.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 inputTextWithMappedContextChipsFromPromptEditorState, c8 as serializedPromptEditorStateFromText, c9 as deserializeContextItem, ca as S2_URL, cb as browser, cc as CodyAutoSuggestionMode, cd as isErrorLike, ce as PromptString, cf as setDisplayPathEnvInfo, U as Uri } from "./vscode-shim-D5fSC1mv.mjs";
6
- import { ch, cg } from "./vscode-shim-D5fSC1mv.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: {} };
@@ -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);
@@ -3052,7 +3052,7 @@ function bh(a2, b2) {
3052
3052
  a2 = a2.updateQueue;
3053
3053
  b2.updateQueue === a2 && (b2.updateQueue = { baseState: a2.baseState, firstBaseUpdate: a2.firstBaseUpdate, lastBaseUpdate: a2.lastBaseUpdate, shared: a2.shared, effects: a2.effects });
3054
3054
  }
3055
- function ch2(a2, b2) {
3055
+ function ch(a2, b2) {
3056
3056
  return { eventTime: a2, lane: b2, tag: 0, payload: null, callback: null, next: null };
3057
3057
  }
3058
3058
  function dh(a2, b2, c2) {
@@ -3202,14 +3202,14 @@ var nh = { isMounted: function(a2) {
3202
3202
  return (a2 = a2._reactInternals) ? Vb(a2) === a2 : false;
3203
3203
  }, enqueueSetState: function(a2, b2, c2) {
3204
3204
  a2 = a2._reactInternals;
3205
- var d2 = L$1(), e2 = lh(a2), f2 = ch2(d2, e2);
3205
+ var d2 = L$1(), e2 = lh(a2), f2 = ch(d2, e2);
3206
3206
  f2.payload = b2;
3207
3207
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
3208
3208
  b2 = dh(a2, f2, e2);
3209
3209
  null !== b2 && (mh(b2, a2, e2, d2), eh(b2, a2, e2));
3210
3210
  }, enqueueReplaceState: function(a2, b2, c2) {
3211
3211
  a2 = a2._reactInternals;
3212
- var d2 = L$1(), e2 = lh(a2), f2 = ch2(d2, e2);
3212
+ var d2 = L$1(), e2 = lh(a2), f2 = ch(d2, e2);
3213
3213
  f2.tag = 1;
3214
3214
  f2.payload = b2;
3215
3215
  void 0 !== c2 && null !== c2 && (f2.callback = c2);
@@ -3217,7 +3217,7 @@ var nh = { isMounted: function(a2) {
3217
3217
  null !== b2 && (mh(b2, a2, e2, d2), eh(b2, a2, e2));
3218
3218
  }, enqueueForceUpdate: function(a2, b2) {
3219
3219
  a2 = a2._reactInternals;
3220
- var c2 = L$1(), d2 = lh(a2), e2 = ch2(c2, d2);
3220
+ var c2 = L$1(), d2 = lh(a2), e2 = ch(c2, d2);
3221
3221
  e2.tag = 2;
3222
3222
  void 0 !== b2 && null !== b2 && (e2.callback = b2);
3223
3223
  b2 = dh(a2, e2, d2);
@@ -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;
@@ -4067,7 +4067,7 @@ function Mi(a2, b2) {
4067
4067
  }
4068
4068
  var Ni = "function" === typeof WeakMap ? WeakMap : Map;
4069
4069
  function Oi(a2, b2, c2) {
4070
- c2 = ch2(-1, c2);
4070
+ c2 = ch(-1, c2);
4071
4071
  c2.tag = 3;
4072
4072
  c2.payload = { element: null };
4073
4073
  var d2 = b2.value;
@@ -4078,7 +4078,7 @@ function Oi(a2, b2, c2) {
4078
4078
  return c2;
4079
4079
  }
4080
4080
  function Ri(a2, b2, c2) {
4081
- c2 = ch2(-1, c2);
4081
+ c2 = ch(-1, c2);
4082
4082
  c2.tag = 3;
4083
4083
  var d2 = a2.type.getDerivedStateFromError;
4084
4084
  if ("function" === typeof d2) {
@@ -4118,7 +4118,7 @@ function Vi(a2) {
4118
4118
  return null;
4119
4119
  }
4120
4120
  function Wi(a2, b2, c2, d2, e2) {
4121
- if (0 === (a2.mode & 1)) return a2 === b2 ? a2.flags |= 65536 : (a2.flags |= 128, c2.flags |= 131072, c2.flags &= -52805, 1 === c2.tag && (null === c2.alternate ? c2.tag = 17 : (b2 = ch2(-1, 1), b2.tag = 2, dh(c2, b2, 1))), c2.lanes |= 1), a2;
4121
+ if (0 === (a2.mode & 1)) return a2 === b2 ? a2.flags |= 65536 : (a2.flags |= 128, c2.flags |= 131072, c2.flags &= -52805, 1 === c2.tag && (null === c2.alternate ? c2.tag = 17 : (b2 = ch(-1, 1), b2.tag = 2, dh(c2, b2, 1))), c2.lanes |= 1), a2;
4122
4122
  a2.flags |= 65536;
4123
4123
  a2.lanes = e2;
4124
4124
  return a2;
@@ -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;
@@ -6587,7 +6587,7 @@ Wk = function(a2, b2, c2) {
6587
6587
  for (var k2 = h2.firstContext; null !== k2; ) {
6588
6588
  if (k2.context === d2) {
6589
6589
  if (1 === f2.tag) {
6590
- k2 = ch2(-1, c2 & -c2);
6590
+ k2 = ch(-1, c2 & -c2);
6591
6591
  k2.tag = 2;
6592
6592
  var l2 = f2.updateQueue;
6593
6593
  if (null !== l2) {
@@ -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:
@@ -6837,7 +6837,7 @@ function fl(a2, b2, c2, d2, e2, f2, g2, h2, k2) {
6837
6837
  c2 = a2.current;
6838
6838
  d2 = L$1();
6839
6839
  e2 = lh(c2);
6840
- f2 = ch2(d2, e2);
6840
+ f2 = ch(d2, e2);
6841
6841
  f2.callback = void 0 !== b2 && null !== b2 ? b2 : null;
6842
6842
  dh(c2, f2, e2);
6843
6843
  a2.current.lanes = e2;
@@ -6849,7 +6849,7 @@ function gl(a2, b2, c2, d2) {
6849
6849
  var e2 = b2.current, f2 = L$1(), g2 = lh(e2);
6850
6850
  c2 = el(c2);
6851
6851
  null === b2.context ? b2.context = c2 : b2.pendingContext = c2;
6852
- b2 = ch2(f2, g2);
6852
+ b2 = ch(f2, g2);
6853
6853
  b2.payload = { element: a2 };
6854
6854
  d2 = void 0 === d2 ? null : d2;
6855
6855
  null !== d2 && (b2.callback = d2);
@@ -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
  *
@@ -8505,25 +8560,6 @@ const Smile = createLucideIcon("Smile", [
8505
8560
  ["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
8506
8561
  ["line", { x1: "15", x2: "15.01", y1: "9", y2: "9", key: "1p4y9e" }]
8507
8562
  ]);
8508
- /**
8509
- * @license lucide-react v0.378.0 - ISC
8510
- *
8511
- * This source code is licensed under the ISC license.
8512
- * See the LICENSE file in the root directory of this source tree.
8513
- */
8514
- const Sparkles = createLucideIcon("Sparkles", [
8515
- [
8516
- "path",
8517
- {
8518
- d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",
8519
- key: "4pj2yx"
8520
- }
8521
- ],
8522
- ["path", { d: "M20 3v4", key: "1olli1" }],
8523
- ["path", { d: "M22 5h-4", key: "1gvqau" }],
8524
- ["path", { d: "M4 17v2", key: "vumght" }],
8525
- ["path", { d: "M5 18H3", key: "zchphs" }]
8526
- ]);
8527
8563
  /**
8528
8564
  * @license lucide-react v0.378.0 - ISC
8529
8565
  *
@@ -9090,7 +9126,7 @@ function tooltipForContextItem(item2) {
9090
9126
  return item2.title || "Local workspace";
9091
9127
  }
9092
9128
  if (item2.type === "file") {
9093
- 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));
9094
9130
  }
9095
9131
  if (is$2(OpenCtxItemWithTooltipSchema, item2)) {
9096
9132
  return item2.mention.data.tooltip;
@@ -9521,9 +9557,11 @@ function L({ options: e2, onQueryChange: n2, onSelectOption: o2, onOpen: r2, onC
9521
9557
  };
9522
9558
  }, [v2, g2, n2, x2, I2, T2]), null === x2 || null === v2 ? null : jsx(R, { close: I2, resolution: x2, editor: v2, anchorElementRef: O2, options: e2, menuRenderFn: i, shouldSplitNodeWithQuery: true, onSelectOption: o2, commandPriority: y2 });
9523
9559
  }
9524
- const popoverDimensions$1 = "_popover-dimensions_1uf3m_1";
9525
- const popover$1 = "_popover_1uf3m_1";
9560
+ const popoverContainer = "_popover-container_11l09_1";
9561
+ const popoverDimensions$1 = "_popover-dimensions_11l09_15";
9562
+ const popover$1 = "_popover_11l09_1";
9526
9563
  const styles$A = {
9564
+ popoverContainer,
9527
9565
  popoverDimensions: popoverDimensions$1,
9528
9566
  popover: popover$1
9529
9567
  };
@@ -10146,7 +10184,7 @@ const MentionsPlugin = memo$1(({ contextWindowSizeInTokens, openExternalLink })
10146
10184
  // max height of the visible menu. This ensures that the menu does not
10147
10185
  // flip orientation as the user is typing if it suddenly has less
10148
10186
  // results. It also makes the positioning less glitchy.
10149
- /* @__PURE__ */ jsx("div", { "data-at-mention-menu": "", className: clsx$1(styles$A.popoverDimensions), children: /* @__PURE__ */ jsx("div", { className: styles$A.popover, children: /* @__PURE__ */ jsx(
10187
+ /* @__PURE__ */ jsx("div", { className: styles$A.popoverContainer, children: /* @__PURE__ */ jsx("div", { "data-at-mention-menu": "", className: clsx$1(styles$A.popoverDimensions), children: /* @__PURE__ */ jsx("div", { className: styles$A.popover, children: /* @__PURE__ */ jsx(
10150
10188
  MentionMenu,
10151
10189
  {
10152
10190
  params,
@@ -10155,7 +10193,7 @@ const MentionsPlugin = memo$1(({ contextWindowSizeInTokens, openExternalLink })
10155
10193
  data,
10156
10194
  selectOptionAndCleanUp
10157
10195
  }
10158
- ) }) }),
10196
+ ) }) }) }),
10159
10197
  anchorElementRef.current
10160
10198
  );
10161
10199
  }
@@ -10776,7 +10814,7 @@ function fromSerializedPromptEditorState(state) {
10776
10814
  }
10777
10815
  function toSerializedPromptEditorValue(doc2) {
10778
10816
  const contextItems = [];
10779
- 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;
10780
10818
  doc2.descendants((node2) => {
10781
10819
  if (node2.type.name === "mention") {
10782
10820
  contextItems.push(node2.attrs.item);
@@ -10849,8 +10887,8 @@ function toSerializedPromptEditorValue(doc2) {
10849
10887
  text: doc2.textContent,
10850
10888
  contextItems,
10851
10889
  editorState: {
10852
- v: "lexical-v1",
10853
- minReaderV: "lexical-v1",
10890
+ v: "lexical-v0",
10891
+ minReaderV: "lexical-v0",
10854
10892
  lexicalEditorState: {
10855
10893
  root: serializeRoot(doc2)
10856
10894
  }
@@ -19614,8 +19652,8 @@ class ViewTreeUpdater {
19614
19652
  if (wrapper.contentDOM) {
19615
19653
  wrapper.children = next.children;
19616
19654
  next.children = [];
19617
- for (let ch3 of wrapper.children)
19618
- ch3.parent = wrapper;
19655
+ for (let ch2 of wrapper.children)
19656
+ ch2.parent = wrapper;
19619
19657
  }
19620
19658
  next.destroy();
19621
19659
  return wrapper;
@@ -26257,7 +26295,7 @@ function getAtMentionPosition(state) {
26257
26295
  }
26258
26296
  return decoration.from;
26259
26297
  }
26260
- function setMentionValue(state, value) {
26298
+ function setAtMentionValue(state, value) {
26261
26299
  var _a;
26262
26300
  const decoration = (_a = atMentionPluginKey.getState(state)) == null ? void 0 : _a.decoration.find()[0];
26263
26301
  if (!decoration) {
@@ -26376,6 +26414,9 @@ const schema = new Schema({
26376
26414
  }
26377
26415
  }
26378
26416
  });
26417
+ function createMentionNode(attrs) {
26418
+ return schema.nodes.mention.create(attrs, schema.text(contextItemMentionNodeDisplayText(attrs.item)));
26419
+ }
26379
26420
  const prosemirrorActor = fromCallback(
26380
26421
  ({ receive, input: input2 }) => {
26381
26422
  const parent = input2.parent;
@@ -26434,15 +26475,11 @@ const prosemirrorActor = fromCallback(
26434
26475
  }
26435
26476
  }
26436
26477
  });
26437
- function doFocus() {
26438
- editor2.focus();
26439
- editor2.dispatch(editor2.state.tr.scrollIntoView());
26440
- }
26441
26478
  receive((event) => {
26442
26479
  switch (event.type) {
26443
26480
  case "focus":
26444
- doFocus();
26445
- setTimeout(doFocus);
26481
+ editor2.focus();
26482
+ editor2.dispatch(editor2.state.tr.scrollIntoView());
26446
26483
  break;
26447
26484
  case "blur":
26448
26485
  editor2.dom.blur();
@@ -26592,7 +26629,10 @@ const promptInput = setup({
26592
26629
  selectedIndex: 0,
26593
26630
  items: [],
26594
26631
  position: { top: 0, left: 0, bottom: 0, right: 0 }
26595
- }
26632
+ },
26633
+ handleSelectMenuItem: input2.handleSelectMenuItem ?? ((_item, api2) => {
26634
+ api2.deleteAtMention();
26635
+ })
26596
26636
  }),
26597
26637
  type: "parallel",
26598
26638
  states: {
@@ -26676,54 +26716,14 @@ const promptInput = setup({
26676
26716
  }
26677
26717
  })
26678
26718
  },
26679
- "document.set": {
26680
- actions: {
26681
- type: "updateEditorState",
26682
- params: ({ event, context: context2 }) => context2.editorState.tr.replaceWith(
26683
- 0,
26684
- context2.editorState.doc.content.size,
26685
- event.doc
26686
- )
26687
- }
26688
- },
26689
- "document.append": {
26690
- actions: {
26691
- type: "updateEditorState",
26692
- params: ({ context: context2, event }) => {
26693
- const tr = context2.editorState.tr;
26694
- tr.setSelection(Selection.atEnd(tr.doc));
26695
- return insertWhitespaceIfNeeded(tr).insertText(event.text);
26696
- }
26697
- }
26698
- },
26699
- "document.mentions.filter": {
26700
- actions: {
26701
- type: "updateEditorState",
26702
- params: ({ context: context2, event }) => filterMentions(context2.editorState, event.filter)
26703
- }
26704
- },
26705
- "document.mentions.add": {
26706
- actions: {
26707
- type: "updateEditorState",
26708
- params: ({ context: context2, event }) => addMentions(
26709
- context2.editorState,
26710
- event.items,
26711
- event.position,
26712
- event.separator
26713
- )
26714
- }
26715
- },
26716
- "document.mentions.upsert": {
26719
+ "document.update": {
26717
26720
  actions: {
26718
26721
  type: "updateEditorState",
26719
- params: ({ context: context2, event }) => upsertMentions(
26720
- context2.editorState,
26721
- event.items,
26722
- event.position,
26723
- event.separator
26724
- )
26722
+ params: ({ event, context: context2 }) => event.transaction(context2.editorState)
26725
26723
  }
26726
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.
26727
26727
  "document.mentions.setInitial": {
26728
26728
  guard: "canSetInitialMentions",
26729
26729
  actions: [
@@ -26751,59 +26751,39 @@ const promptInput = setup({
26751
26751
  ]
26752
26752
  },
26753
26753
  // This event is raised when a mention item is supposed to be 'applied to the editor'. This can mean
26754
- // different things depending on the item:
26755
- // - If the item is a ContextItem, it will be inserted as a mention node.
26756
- // - If the item is a ContextMentionProviderMetadata, we'll update the mentions menu to show the provider's
26757
- // items.
26758
- // - 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.
26759
26756
  "atMention.apply": {
26760
26757
  actions: enqueueActions(({ context: context2, enqueue, event }) => {
26761
- var _a, _b, _c, _d;
26762
26758
  const item2 = event.item;
26763
- if ("id" in item2) {
26764
- enqueue({
26765
- type: "updateEditorState",
26766
- params: setMentionValue(context2.editorState, "")
26767
- });
26768
- enqueue.raise({ type: "mentionsMenu.provider.set", provider: item2 });
26769
- return;
26770
- }
26771
- if (item2.provider === "openctx" && "providerUri" in item2) {
26772
- 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) {
26761
+ enqueue({
26762
+ type: "updateEditorState",
26763
+ params: setAtMentionValue(context2.editorState, value)
26764
+ });
26765
+ },
26766
+ replaceAtMentionValue(value) {
26773
26767
  enqueue({
26774
26768
  type: "updateEditorState",
26775
- params: setMentionValue(
26769
+ params: replaceAtMention(
26776
26770
  context2.editorState,
26777
- item2.mention.data.repoName + ":"
26771
+ typeof value === "string" ? schema.text(value) : value
26778
26772
  )
26779
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() {
26780
26785
  enqueue({ type: "assignMentionsMenu", params: { selectedIndex: 0 } });
26781
- return;
26782
26786
  }
26783
- }
26784
- if (item2.isTooLarge && !item2.range) {
26785
- enqueue({
26786
- type: "updateEditorState",
26787
- params: setMentionValue(
26788
- context2.editorState,
26789
- contextItemMentionNodeDisplayText(serializeContextItem(item2)) + ":"
26790
- )
26791
- });
26792
- return;
26793
- }
26794
- if (item2.type === "open-link") {
26795
- enqueue({
26796
- type: "updateEditorState",
26797
- params: replaceAtMention(context2.editorState, schema.text(""))
26798
- });
26799
- return;
26800
- }
26801
- enqueue({
26802
- type: "updateEditorState",
26803
- params: replaceAtMention(
26804
- context2.editorState,
26805
- createMentionNode({ item: serializeContextItem(item2) })
26806
- )
26807
26787
  });
26808
26788
  })
26809
26789
  },
@@ -26964,132 +26944,6 @@ const promptInput = setup({
26964
26944
  }
26965
26945
  }
26966
26946
  });
26967
- function insertWhitespaceIfNeeded(tr, pos) {
26968
- pos = pos ?? tr.selection.from;
26969
- if (!/(^|\s)$/.test(tr.doc.textBetween(0, pos))) {
26970
- tr.insertText(" ", pos);
26971
- }
26972
- return tr;
26973
- }
26974
- function filterMentions(state, filter2) {
26975
- const tr = state.tr;
26976
- state.doc.descendants((node2, pos) => {
26977
- if (node2.type === schema.nodes.mention) {
26978
- const item2 = node2.attrs.item;
26979
- if (!filter2(item2)) {
26980
- tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
26981
- }
26982
- }
26983
- });
26984
- return tr;
26985
- }
26986
- function getMentions(doc2) {
26987
- const mentions = [];
26988
- doc2.descendants((node2) => {
26989
- if (node2.type === schema.nodes.mention) {
26990
- mentions.push(node2.attrs.item);
26991
- return false;
26992
- }
26993
- return true;
26994
- });
26995
- return mentions;
26996
- }
26997
- function addMentions(state, items, position2, separator) {
26998
- const existingMentions = getMentions(state.doc);
26999
- const operations = getMentionOperations(existingMentions, items);
27000
- const tr = state.tr;
27001
- if (operations.modify.size + operations.delete.size > 0) {
27002
- state.doc.descendants((node2, pos) => {
27003
- if (node2.type === schema.nodes.mention) {
27004
- const item2 = node2.attrs.item;
27005
- if (operations.delete.has(item2)) {
27006
- tr.delete(tr.mapping.map(pos), tr.mapping.map(pos + node2.nodeSize));
27007
- } else if (operations.modify.has(item2)) {
27008
- const newItem = operations.modify.get(item2);
27009
- if (newItem) {
27010
- tr.replaceWith(
27011
- tr.mapping.map(pos),
27012
- tr.mapping.map(pos + node2.nodeSize),
27013
- createMentionNode({ item: newItem })
27014
- );
27015
- }
27016
- }
27017
- }
27018
- });
27019
- }
27020
- if (operations.create.length > 0) {
27021
- const mentionNodes = [];
27022
- const separatorNode = state.schema.text(separator);
27023
- for (const item2 of operations.create) {
27024
- mentionNodes.push(createMentionNode({ item: item2 }));
27025
- mentionNodes.push(separatorNode);
27026
- }
27027
- if (position2 === "before") {
27028
- tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
27029
- } else {
27030
- insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
27031
- tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
27032
- }
27033
- }
27034
- return tr;
27035
- }
27036
- function upsertMentions(state, items, position2, separator) {
27037
- const existingMentions = new Set(getMentions(state.doc).map(getKeyForContextItem));
27038
- const toUpdate = /* @__PURE__ */ new Map();
27039
- for (const item2 of items) {
27040
- const key = getKeyForContextItem(item2);
27041
- if (existingMentions.has(key)) {
27042
- toUpdate.set(key, item2);
27043
- }
27044
- }
27045
- const tr = state.tr;
27046
- if (toUpdate.size > 0) {
27047
- state.doc.descendants((node2, pos) => {
27048
- if (node2.type === schema.nodes.mention) {
27049
- const item2 = node2.attrs.item;
27050
- const key = getKeyForContextItem(item2);
27051
- if (toUpdate.has(key)) {
27052
- const newItem = toUpdate.get(key);
27053
- if (newItem) {
27054
- tr.replaceWith(
27055
- tr.mapping.map(pos),
27056
- tr.mapping.map(pos + node2.nodeSize),
27057
- createMentionNode({ item: newItem })
27058
- );
27059
- }
27060
- }
27061
- }
27062
- });
27063
- }
27064
- return toUpdate.size !== items.length ? insertMentions(
27065
- tr,
27066
- items.filter((item2) => !toUpdate.has(getKeyForContextItem(item2))),
27067
- position2,
27068
- separator
27069
- ) : tr;
27070
- }
27071
- function insertMentions(tr, items, position2, separator) {
27072
- const mentionNodes = [];
27073
- const separatorNode = schema.text(separator);
27074
- for (const item2 of items) {
27075
- mentionNodes.push(createMentionNode({ item: item2 }));
27076
- mentionNodes.push(separatorNode);
27077
- }
27078
- if (position2 === "before") {
27079
- tr.insert(Selection.atStart(tr.doc).from, mentionNodes);
27080
- } else {
27081
- insertWhitespaceIfNeeded(tr, Selection.atEnd(tr.doc).from);
27082
- tr.insert(Selection.atEnd(tr.doc).from, mentionNodes);
27083
- }
27084
- return tr;
27085
- }
27086
- function getKeyForContextItem(item2) {
27087
- let key = `${item2.uri.toString()}|${item2.type}`;
27088
- if (item2.type === "openctx") {
27089
- key += `|${item2.providerUri}`;
27090
- }
27091
- return key;
27092
- }
27093
26947
  function isEditorContentOnlyInitialContext(state) {
27094
26948
  let onlyInitialContext = true;
27095
26949
  state.doc.descendants((node2) => {
@@ -27120,9 +26974,6 @@ function isEditorContentOnlyInitialContext(state) {
27120
26974
  });
27121
26975
  return onlyInitialContext;
27122
26976
  }
27123
- function createMentionNode(attrs) {
27124
- return schema.nodes.mention.create(attrs, schema.text(contextItemMentionNodeDisplayText(attrs.item)));
27125
- }
27126
26977
  function hasWindow() {
27127
26978
  return typeof window !== "undefined";
27128
26979
  }
@@ -30205,6 +30056,164 @@ function iconForContextItem(item2) {
30205
30056
  }
30206
30057
  return iconForProvider[providerURI] ?? AtSign;
30207
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
+ }
30208
30217
  function getCurrentEditorState(input2) {
30209
30218
  return input2.getSnapshot().context.editorState;
30210
30219
  }
@@ -30270,6 +30279,7 @@ const usePromptInput = (options) => {
30270
30279
  }
30271
30280
  }
30272
30281
  },
30282
+ handleSelectMenuItem,
30273
30283
  placeholder: options.placeholder,
30274
30284
  initialDocument: options.initialDocument,
30275
30285
  disabled: options.disabled,
@@ -30285,7 +30295,7 @@ const usePromptInput = (options) => {
30285
30295
  );
30286
30296
  },
30287
30297
  setDocument(doc2) {
30288
- editor2.send({ type: "document.set", doc: doc2 });
30298
+ editor2.send({ type: "document.update", transaction: (state) => setDocument(state, doc2) });
30289
30299
  },
30290
30300
  setInitialContextMentions(items) {
30291
30301
  editor2.send({
@@ -30294,29 +30304,31 @@ const usePromptInput = (options) => {
30294
30304
  });
30295
30305
  },
30296
30306
  appendText(text2) {
30297
- editor2.send({ type: "document.append", text: text2 });
30307
+ editor2.send({
30308
+ type: "document.update",
30309
+ transaction: (state) => appendToDocument(state, text2)
30310
+ });
30298
30311
  },
30299
- addMentions(items, position2 = "after", sep = " ") {
30312
+ addMentions(items, position2 = "after", seperator = " ") {
30300
30313
  editor2.send({
30301
- type: "document.mentions.add",
30302
- items: items.map(serializeContextItem),
30303
- position: position2,
30304
- separator: sep
30314
+ type: "document.update",
30315
+ transaction: (state) => addMentions(state, items.map(serializeContextItem), position2, seperator)
30305
30316
  });
30306
30317
  },
30307
- upsertMentions(items, position2 = "after", sep = " ", focusEditor = true) {
30318
+ upsertMentions(items, position2 = "after", seperator = " ", focusEditor = true) {
30308
30319
  editor2.send({
30309
- type: "document.mentions.upsert",
30310
- items: items.map(serializeContextItem),
30311
- position: position2,
30312
- separator: sep
30320
+ type: "document.update",
30321
+ transaction: (state) => upsertMentions(state, items.map(serializeContextItem), position2, seperator)
30313
30322
  });
30314
30323
  if (focusEditor) {
30315
30324
  editor2.send({ type: "focus" });
30316
30325
  }
30317
30326
  },
30318
30327
  filterMentions(filter2) {
30319
- editor2.send({ type: "document.mentions.filter", filter: filter2 });
30328
+ editor2.send({
30329
+ type: "document.update",
30330
+ transaction: (state) => filterMentions(state, filter2)
30331
+ });
30320
30332
  },
30321
30333
  applySuggestion(index2) {
30322
30334
  editor2.send({ type: "mentionsMenu.apply", index: index2 });
@@ -36618,7 +36630,8 @@ const promptEditorConfig = {
36618
36630
  const uri = URI.parse(contextItem2.uri);
36619
36631
  getVSCodeAPI().postMessage({
36620
36632
  command: "openURI",
36621
- uri
36633
+ uri,
36634
+ range: contextItem2.range
36622
36635
  });
36623
36636
  }
36624
36637
  },
@@ -37412,7 +37425,6 @@ function getTraceparentFromSpanContext(spanContext) {
37412
37425
  }
37413
37426
  memo$1(
37414
37427
  ({ className, authStatus, vscodeAPI, telemetryRecorder, allowEndpointChange }) => {
37415
- var _a;
37416
37428
  const [formState, setFormState] = useState$1({
37417
37429
  showAccessTokenField: false,
37418
37430
  isSubmitting: false,
@@ -37451,14 +37463,11 @@ memo$1(
37451
37463
  });
37452
37464
  } finally {
37453
37465
  setTimeout(() => {
37454
- setFormState((prev) => {
37455
- var _a2;
37456
- return {
37457
- ...prev,
37458
- isSubmitting: false,
37459
- showAuthError: !!(authStatus == null ? void 0 : authStatus.authenticated) || ((_a2 = authStatus == null ? void 0 : authStatus.error) == null ? void 0 : _a2.type) === "network-error"
37460
- };
37461
- });
37466
+ setFormState((prev) => ({
37467
+ ...prev,
37468
+ isSubmitting: false,
37469
+ showAuthError: !!(authStatus == null ? void 0 : authStatus.authenticated) || isAuthError(authStatus == null ? void 0 : authStatus.error)
37470
+ }));
37462
37471
  }, 8e3);
37463
37472
  }
37464
37473
  },
@@ -37493,7 +37502,7 @@ memo$1(
37493
37502
  FormField,
37494
37503
  {
37495
37504
  name: "accessToken",
37496
- 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),
37497
37506
  className: "tw-m-2",
37498
37507
  children: [
37499
37508
  /* @__PURE__ */ jsxs(
@@ -67269,7 +67278,8 @@ const ALLOWED_ELEMENTS = [
67269
67278
  "h4",
67270
67279
  "h5",
67271
67280
  "h6",
67272
- "br"
67281
+ "br",
67282
+ "think"
67273
67283
  ];
67274
67284
  function defaultUrlProcessor(url) {
67275
67285
  const processedURL = defaultUrlTransform(url);
@@ -67289,13 +67299,19 @@ function wrapLinksWithCodyOpenCommand(url) {
67289
67299
  const URL_PROCESSORS = {
67290
67300
  [CodyIDE.VSCode]: wrapLinksWithCodyOpenCommand
67291
67301
  };
67292
- const MarkdownFromCody = ({
67293
- className,
67294
- children: children2
67295
- }) => {
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 }) => {
67296
67311
  const clientType = useConfig().clientCapabilities.agentIDE;
67297
67312
  const urlTransform = useMemo$1(() => URL_PROCESSORS[clientType] ?? defaultUrlProcessor, [clientType]);
67298
- return /* @__PURE__ */ jsx(Markdown, { className, ...markdownPluginProps(), urlTransform, children: children2 });
67313
+ const chatReplyTransformed = childrenTransform(children2);
67314
+ return /* @__PURE__ */ jsx(Markdown, { className, ...markdownPluginProps(), urlTransform, children: chatReplyTransformed });
67299
67315
  };
67300
67316
  let _markdownPluginProps;
67301
67317
  function markdownPluginProps() {
@@ -67349,22 +67365,22 @@ function markdownPluginProps() {
67349
67365
  };
67350
67366
  return _markdownPluginProps;
67351
67367
  }
67352
- const buttonsContainer = "_buttons-container_1kf9a_1";
67353
- const buttons = "_buttons_1kf9a_1";
67354
- const button$1 = "_button_1kf9a_1";
67355
- const iconContainer = "_icon-container_1kf9a_36";
67356
- const copyButton = "_copy-button_1kf9a_40";
67357
- const insertButton = "_insert-button_1kf9a_41";
67358
- const attributionIcon = "_attribution-icon_1kf9a_42";
67359
- const status = "_status_1kf9a_43";
67360
- const metadataContainer = "_metadata-container_1kf9a_70";
67361
- const attributionContainer = "_attribution-container_1kf9a_80";
67362
- const attributionIconUnavailable = "_attribution-icon-unavailable_1kf9a_87";
67363
- const attributionIconFound = "_attribution-icon-found_1kf9a_91";
67364
- const codiconLoading = "_codicon-loading_1kf9a_100";
67365
- const spin$1 = "_spin_1kf9a_1";
67366
- const content = "_content_1kf9a_116";
67367
- const fileNameContainer = "_file-name-container_1kf9a_216";
67368
+ const buttonsContainer = "_buttons-container_1ok1a_1";
67369
+ const buttons = "_buttons_1ok1a_1";
67370
+ const button$1 = "_button_1ok1a_1";
67371
+ const iconContainer = "_icon-container_1ok1a_31";
67372
+ const copyButton = "_copy-button_1ok1a_35";
67373
+ const insertButton = "_insert-button_1ok1a_36";
67374
+ const attributionIcon = "_attribution-icon_1ok1a_37";
67375
+ const status = "_status_1ok1a_38";
67376
+ const metadataContainer = "_metadata-container_1ok1a_65";
67377
+ const attributionContainer = "_attribution-container_1ok1a_75";
67378
+ const attributionIconUnavailable = "_attribution-icon-unavailable_1ok1a_82";
67379
+ const attributionIconFound = "_attribution-icon-found_1ok1a_86";
67380
+ const codiconLoading = "_codicon-loading_1ok1a_95";
67381
+ const spin$1 = "_spin_1ok1a_1";
67382
+ const content = "_content_1ok1a_111";
67383
+ const fileNameContainer = "_file-name-container_1ok1a_211";
67368
67384
  const styles$s = {
67369
67385
  buttonsContainer,
67370
67386
  buttons,
@@ -67746,6 +67762,29 @@ function getCodeBlockId(contents, fileName) {
67746
67762
  }
67747
67763
  return cryptoJsExports.SHA256(input2).toString();
67748
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
+ }
67749
67788
  const ChatMessageContent = ({
67750
67789
  displayMarkdown,
67751
67790
  isMessageLoading,
@@ -67874,7 +67913,39 @@ const ChatMessageContent = ({
67874
67913
  smartApplyInterceptor,
67875
67914
  smartApplyStates
67876
67915
  ]);
67877
- 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
+ ] });
67878
67949
  };
67879
67950
  const errorItem = "_error-item_1sixu_1";
67880
67951
  const icon = "_icon_1sixu_13";
@@ -67974,7 +68045,7 @@ const RateLimitErrorItem = ({ error: error2, userInfo, postMessage }) => {
67974
68045
  /* @__PURE__ */ jsx("h1", { children: canUpgrade ? "Upgrade to Cody Pro" : "Unable to Send Message" }),
67975
68046
  /* @__PURE__ */ jsxs("p", { children: [
67976
68047
  error2.userMessage,
67977
- 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."
67978
68049
  ] })
67979
68050
  ] }),
67980
68051
  /* @__PURE__ */ jsxs("div", { className: styles$q.actions, children: [
@@ -70041,7 +70112,7 @@ const SearchResults = ({
70041
70112
  ] })
70042
70113
  ] }),
70043
70114
  /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-items-center tw-gap-6 tw-px-4 md:tw-px-2", children: [
70044
- showFiltersButton && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(
70115
+ showFiltersButton && !showFiltersSidebar && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs(
70045
70116
  Button,
70046
70117
  {
70047
70118
  onClick: () => {
@@ -70236,8 +70307,8 @@ const AssistantMessageCell = memo$1(
70236
70307
  const chatModel = useChatModelByID(message2.model, models);
70237
70308
  const isAborted = isAbortErrorOrSocketHangUp(message2.error);
70238
70309
  const hasLongerResponseTime = (_a = chatModel == null ? void 0 : chatModel.tags) == null ? void 0 : _a.includes(ModelTag.StreamDisabled);
70239
- const experimentalOneBoxEnabled = useOmniBox();
70240
- const isSearchIntent = experimentalOneBoxEnabled && (humanMessage == null ? void 0 : humanMessage.intent) === "search";
70310
+ const omniboxEnabled = useOmniBox();
70311
+ const isSearchIntent = omniboxEnabled && (humanMessage == null ? void 0 : humanMessage.intent) === "search";
70241
70312
  return /* @__PURE__ */ jsx(
70242
70313
  BaseMessageCell,
70243
70314
  {
@@ -70251,7 +70322,7 @@ const AssistantMessageCell = memo$1(
70251
70322
  humanMessage
70252
70323
  }
70253
70324
  ) : null,
70254
- experimentalOneBoxEnabled && !isLoading && message2.search && /* @__PURE__ */ jsx(
70325
+ omniboxEnabled && !isLoading && message2.search && /* @__PURE__ */ jsx(
70255
70326
  SearchResults,
70256
70327
  {
70257
70328
  message: message2,
@@ -70315,8 +70386,7 @@ function makeHumanMessageInfo({ humanMessage, assistantMessage }, humanEditorRef
70315
70386
  );
70316
70387
  editHumanMessage({
70317
70388
  messageIndexInTranscript: assistantMessage.index - 1,
70318
- editorValue: newEditorValue,
70319
- preDetectedIntent: humanMessage.intent
70389
+ editorValue: newEditorValue
70320
70390
  });
70321
70391
  }
70322
70392
  },
@@ -70568,7 +70638,8 @@ const PromptList = (props) => {
70568
70638
  onSelect: parentOnSelect,
70569
70639
  promptFilters
70570
70640
  } = props;
70571
- const endpointURL = new URL(useConfig().authStatus.endpoint);
70641
+ const { clientCapabilities, authStatus } = useConfig();
70642
+ const endpointURL = new URL(authStatus.endpoint);
70572
70643
  const telemetryRecorder = useTelemetryRecorder();
70573
70644
  const [lastUsedActions = {}] = useLocalStorage("last-used-actions-v2", {});
70574
70645
  const telemetryPublicMetadata = {
@@ -70653,12 +70724,18 @@ const PromptList = (props) => {
70653
70724
  return actions22.filter((action2) => action2.actionType === "prompt" && action2.builtin);
70654
70725
  }
70655
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
+ }
70656
70733
  if (shouldExcludeBuiltinCommands) {
70657
70734
  return actions22.filter((action2) => action2.actionType === "prompt" && !action2.builtin);
70658
70735
  }
70659
70736
  return actions22;
70660
70737
  },
70661
- [promptFilters]
70738
+ [promptFilters, clientCapabilities.edit]
70662
70739
  );
70663
70740
  const allActions = showOnlyPromptInsertableCommands ? (result2 == null ? void 0 : result2.actions.filter((action2) => action2.actionType === "prompt" || action2.mode === "ask")) ?? [] : (result2 == null ? void 0 : result2.actions) ?? [];
70664
70741
  const sortedActions = lastUsedSorting ? getSortedActions(filteredActions(allActions), lastUsedActions) : filteredActions(allActions);
@@ -72327,8 +72404,11 @@ const HistoryTabWithData = ({ IDE, webviewType, multipleWebviewsEnabled, setView
72327
72404
  ) }),
72328
72405
  sortedChatsByPeriod.map(([period, chats2]) => /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col", children: [
72329
72406
  /* @__PURE__ */ jsx("h4", { className: "tw-font-semibold tw-text-muted-foreground tw-py-2 tw-my-4", children: period }),
72330
- chats2.map(({ interactions, id: id2 }) => {
72407
+ chats2.map((chat2) => {
72331
72408
  var _a, _b, _c;
72409
+ const id2 = chat2.lastInteractionTimestamp;
72410
+ const interactions = chat2.interactions;
72411
+ const chatTitle = chat2.chatTitle;
72332
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();
72333
72413
  return /* @__PURE__ */ jsxs("div", { className: `tw-flex tw-flex-row tw-p-1 ${styles$8.historyRow}`, children: [
72334
72414
  /* @__PURE__ */ jsx(
@@ -72340,7 +72420,7 @@ const HistoryTabWithData = ({ IDE, webviewType, multipleWebviewsEnabled, setView
72340
72420
  command: "restoreHistory",
72341
72421
  chatID: id2
72342
72422
  }),
72343
- 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 })
72344
72424
  }
72345
72425
  ),
72346
72426
  /* @__PURE__ */ jsx(
@@ -73273,7 +73353,8 @@ const UserMenu = ({
73273
73353
  onCloseByEscape,
73274
73354
  allowEndpointChange,
73275
73355
  __storybook__open,
73276
- isWorkspacesUpgradeCtaEnabled
73356
+ isWorkspacesUpgradeCtaEnabled,
73357
+ IDE
73277
73358
  }) => {
73278
73359
  const telemetryRecorder = useTelemetryRecorder();
73279
73360
  const { displayName, username, primaryEmail, endpoint } = authStatus;
@@ -73447,6 +73528,92 @@ const UserMenu = ({
73447
73528
  ),
73448
73529
  /* @__PURE__ */ jsx(CommandItem, { onSelect: () => onMenuViewChange("switch"), children: /* @__PURE__ */ jsx("span", { className: "tw-flex-grow tw-rounded-md tw-text-center", children: "Cancel" }) })
73449
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
+ ] })
73450
73617
  ] }) : userMenuView === "switch" ? /* @__PURE__ */ jsxs(CommandList, { children: [
73451
73618
  /* @__PURE__ */ jsx(CommandGroup, { title: "Switch Account Menu", children: /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("main"), children: [
73452
73619
  /* @__PURE__ */ jsx(ChevronLeft, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
@@ -73690,6 +73857,34 @@ const UserMenu = ({
73690
73857
  }
73691
73858
  )
73692
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
+ ] }),
73693
73888
  /* @__PURE__ */ jsxs(CommandGroup, { children: [
73694
73889
  allowEndpointChange && /* @__PURE__ */ jsxs(CommandItem, { onSelect: () => onMenuViewChange("switch"), children: [
73695
73890
  /* @__PURE__ */ jsx(
@@ -73707,28 +73902,7 @@ const UserMenu = ({
73707
73902
  /* @__PURE__ */ jsx(LogOut, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73708
73903
  /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Sign Out" })
73709
73904
  ] })
73710
- ] }),
73711
- /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
73712
- CommandLink,
73713
- {
73714
- href: "https://community.sourcegraph.com/",
73715
- target: "_blank",
73716
- rel: "noreferrer",
73717
- onSelect: () => {
73718
- telemetryRecorder.recordEvent(
73719
- "cody.userMenu.helpLink",
73720
- "open",
73721
- {}
73722
- );
73723
- close2();
73724
- },
73725
- children: [
73726
- /* @__PURE__ */ jsx(CircleHelp, { size: 16, strokeWidth: 1.25, className: "tw-mr-2" }),
73727
- /* @__PURE__ */ jsx("span", { className: "tw-flex-grow", children: "Help" }),
73728
- /* @__PURE__ */ jsx(ExternalLink, { size: 16, strokeWidth: 1.25 })
73729
- ]
73730
- }
73731
- ) })
73905
+ ] })
73732
73906
  ] })
73733
73907
  }
73734
73908
  ),
@@ -73857,7 +74031,8 @@ const TabsBar = memo$1((props) => {
73857
74031
  endpointHistory,
73858
74032
  allowEndpointChange,
73859
74033
  className: "!tw-opacity-100 tw-h-full",
73860
- isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled
74034
+ isWorkspacesUpgradeCtaEnabled: props.isWorkspacesUpgradeCtaEnabled,
74035
+ IDE
73861
74036
  }
73862
74037
  )
73863
74038
  ] })
@@ -74127,56 +74302,21 @@ const AddContextButton = ({ onClick, className }) => /* @__PURE__ */ jsxs(Toolti
74127
74302
  /* @__PURE__ */ jsx(Kbd, { macOS: "@", linuxAndWindows: "@" })
74128
74303
  ] })
74129
74304
  ] });
74130
- const intentDetectionConfigConext = createContext({
74131
- intentDetectionDisabled: false,
74132
- doIntentDetection: true
74133
- });
74134
- const IntentDetectionConfigProvider = ({ children: children2 }) => {
74135
- const config = useClientConfig();
74136
- const intentDetection = useMemo$1(
74137
- () => ({
74138
- intentDetectionDisabled: !(config == null ? void 0 : config.omniBoxEnabled) || (config == null ? void 0 : config.intentDetection) === "disabled",
74139
- doIntentDetection: !!(config == null ? void 0 : config.omniBoxEnabled) && (config == null ? void 0 : config.intentDetection) !== "disabled"
74140
- }),
74141
- [config]
74142
- );
74143
- return /* @__PURE__ */ jsx(intentDetectionConfigConext.Provider, { value: intentDetection, children: children2 });
74144
- };
74145
- const useIntentDetectionConfig = () => {
74146
- return useContext(intentDetectionConfigConext);
74147
- };
74148
74305
  function getIntentOptions({
74149
74306
  ide,
74150
74307
  isDotComUser,
74151
- detectedIntent,
74152
- intentDetectionDisabled
74308
+ omniBoxEnabled
74153
74309
  }) {
74154
- const intentDetectionAvailable = !isDotComUser && !intentDetectionDisabled;
74155
74310
  const standardOneBoxIntents = [
74156
- {
74157
- title: /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col tw-self-start", children: [
74158
- /* @__PURE__ */ jsx("p", { children: "Run detected intent" }),
74159
- detectedIntent && /* @__PURE__ */ jsx("p", { className: "tw-text-sm tw-text-muted-foreground tw-min-h-10", children: isDotComUser ? "Detects intent and runs appropriately" : `Currently: ${detectedIntent === "search" ? "Search" : "Chat"}` })
74160
- ] }),
74161
- icon: Sparkles,
74162
- intent: void 0,
74163
- hidden: !intentDetectionAvailable,
74164
- disabled: isDotComUser,
74165
- shortcut: isDotComUser ? /* @__PURE__ */ jsxs(Badge, { children: [
74166
- "Enterprise ",
74167
- /* @__PURE__ */ jsx(Info, { className: "tw-size-4 tw-ml-1" })
74168
- ] }) : /* @__PURE__ */ jsx(Kbd, { macOS: "return", linuxAndWindows: "return" })
74169
- },
74170
74311
  {
74171
74312
  title: "Run as chat",
74172
74313
  icon: MessageSquare,
74173
74314
  intent: "chat",
74174
- shortcut: /* @__PURE__ */ jsxs(Fragment$1, { children: [
74175
- intentDetectionAvailable && /* @__PURE__ */ jsx(Kbd, { macOS: "cmd", linuxAndWindows: "ctrl" }),
74176
- /* @__PURE__ */ jsx(Kbd, { macOS: "return", linuxAndWindows: "return" })
74177
- ] })
74178
- },
74179
- {
74315
+ shortcut: /* @__PURE__ */ jsx(Kbd, { macOS: "return", linuxAndWindows: "return" })
74316
+ }
74317
+ ];
74318
+ if (omniBoxEnabled) {
74319
+ standardOneBoxIntents.push({
74180
74320
  title: /* @__PURE__ */ jsxs("span", { className: "tw-inline-flex tw-items-center tw-gap-4", children: [
74181
74321
  /* @__PURE__ */ jsx("span", { children: "Run as search" }),
74182
74322
  /* @__PURE__ */ jsx(Badge, { children: "Beta" })
@@ -74192,8 +74332,8 @@ function getIntentOptions({
74192
74332
  /* @__PURE__ */ jsx(Kbd, { macOS: "opt", linuxAndWindows: "alt" }),
74193
74333
  /* @__PURE__ */ jsx(Kbd, { macOS: "return", linuxAndWindows: "return" })
74194
74334
  ] })
74195
- }
74196
- ];
74335
+ });
74336
+ }
74197
74337
  if (ide === CodyIDE.Web) {
74198
74338
  return standardOneBoxIntents;
74199
74339
  }
@@ -74214,30 +74354,28 @@ function getIntentOptions({
74214
74354
  ];
74215
74355
  }
74216
74356
  const SubmitButton = ({ onClick, state = "submittable", detectedIntent, manuallySelectIntent }) => {
74217
- const experimentalOneBoxEnabled = useOmniBox();
74218
74357
  const {
74219
74358
  clientCapabilities: { agentIDE },
74220
74359
  isDotComUser
74221
74360
  } = useConfig();
74222
- const { intentDetectionDisabled } = useIntentDetectionConfig();
74361
+ const omniBoxEnabled = useOmniBox();
74223
74362
  const { intentOptions, availableIntentOptions, disabledIntentOptions } = useMemo$1(() => {
74224
74363
  const intentOptions2 = getIntentOptions({
74225
74364
  ide: agentIDE,
74226
- detectedIntent,
74227
- intentDetectionDisabled,
74228
- isDotComUser
74365
+ isDotComUser,
74366
+ omniBoxEnabled
74229
74367
  }).filter((option) => !option.hidden);
74230
74368
  return {
74231
74369
  intentOptions: intentOptions2,
74232
74370
  availableIntentOptions: intentOptions2.filter((option) => !option.disabled),
74233
74371
  disabledIntentOptions: intentOptions2.filter((option) => option.disabled)
74234
74372
  };
74235
- }, [agentIDE, detectedIntent, intentDetectionDisabled, isDotComUser]);
74373
+ }, [agentIDE, isDotComUser, omniBoxEnabled]);
74236
74374
  const inProgress = state === "waitingResponseComplete";
74237
74375
  const detectedIntentOption = intentOptions.find((option) => option.intent === detectedIntent);
74238
74376
  const Icon2 = (detectedIntentOption == null ? void 0 : detectedIntentOption.intent) ? detectedIntentOption.icon : Play;
74239
74377
  const iconClassName = `tw-size-6 ${(detectedIntentOption == null ? void 0 : detectedIntentOption.intent) === "search" ? "" : "tw-fill-current"}`;
74240
- if (!experimentalOneBoxEnabled || inProgress) {
74378
+ if (!omniBoxEnabled || inProgress) {
74241
74379
  return /* @__PURE__ */ jsx("div", { className: "tw-flex", children: /* @__PURE__ */ jsx(
74242
74380
  "button",
74243
74381
  {
@@ -74293,7 +74431,6 @@ const SubmitButton = ({ onClick, state = "submittable", detectedIntent, manually
74293
74431
  },
74294
74432
  option.intent || "auto"
74295
74433
  )),
74296
- disabledIntentOptions.length > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}),
74297
74434
  disabledIntentOptions.map((option) => /* @__PURE__ */ jsxs(
74298
74435
  CommandItem,
74299
74436
  {
@@ -74344,8 +74481,7 @@ const PopoverItem = ({
74344
74481
  onCloseByEscape,
74345
74482
  popoverRootProps,
74346
74483
  popoverContentProps,
74347
- children: children2,
74348
- ...props
74484
+ children: children2
74349
74485
  }) => {
74350
74486
  const [isOpen, setIsOpen] = useState$1(defaultOpen);
74351
74487
  const anchorRef = useRef$1(null);
@@ -74529,7 +74665,7 @@ const HumanMessageEditor = ({
74529
74665
  var _a, _b, _c;
74530
74666
  const telemetryRecorder = useTelemetryRecorder();
74531
74667
  const editorRef = useRef$1(null);
74532
- useImperativeHandle(parentEditorRef, () => editorRef.current, []);
74668
+ useImperativeHandle(parentEditorRef, () => editorRef.current);
74533
74669
  const [isEmptyEditorValue, setIsEmptyEditorValue] = useState$1(
74534
74670
  initialEditorState ? textContentFromSerializedLexicalNode(initialEditorState.lexicalEditorState.root) === "" : true
74535
74671
  );
@@ -74542,7 +74678,6 @@ const HumanMessageEditor = ({
74542
74678
  [onChange]
74543
74679
  );
74544
74680
  const submitState = isPendingPriorResponse ? "waitingResponseComplete" : isEmptyEditorValue ? "emptyEditorValue" : "submittable";
74545
- const experimentalPromptEditorEnabled = useFeatureFlag(FeatureFlag.CodyExperimentalPromptEditor);
74546
74681
  const onSubmitClick = useCallback(
74547
74682
  (intent2, forceSubmit) => {
74548
74683
  if (!forceSubmit && submitState === "emptyEditorValue") {
@@ -74573,25 +74708,29 @@ const HumanMessageEditor = ({
74573
74708
  },
74574
74709
  [submitState, parentOnSubmit, onStop, telemetryRecorder.recordEvent, isFirstMessage, isSent]
74575
74710
  );
74711
+ const omniBoxEnabled = useOmniBox();
74712
+ const {
74713
+ isDotComUser,
74714
+ config: { experimentalPromptEditorEnabled }
74715
+ } = useConfig();
74576
74716
  const onEditorEnterKey = useCallback(
74577
74717
  (event) => {
74578
74718
  if (!event || event.isComposing || isEmptyEditorValue || event.shiftKey) {
74579
74719
  return;
74580
74720
  }
74581
74721
  event.preventDefault();
74722
+ if (!omniBoxEnabled || isDotComUser) {
74723
+ onSubmitClick("chat");
74724
+ return;
74725
+ }
74582
74726
  if ((event.metaKey || event.ctrlKey) && event.altKey) {
74583
74727
  manuallySelectIntent("search");
74584
74728
  onSubmitClick("search");
74585
74729
  return;
74586
74730
  }
74587
- if (event.metaKey || event.ctrlKey) {
74588
- manuallySelectIntent("chat");
74589
- onSubmitClick("chat");
74590
- return;
74591
- }
74592
- onSubmitClick();
74731
+ onSubmitClick("chat");
74593
74732
  },
74594
- [isEmptyEditorValue, onSubmitClick, manuallySelectIntent]
74733
+ [isEmptyEditorValue, onSubmitClick, manuallySelectIntent, omniBoxEnabled, isDotComUser]
74595
74734
  );
74596
74735
  const [isEditorFocused, setIsEditorFocused] = useState$1(false);
74597
74736
  const onEditorFocusChange = useCallback(
@@ -74759,18 +74898,20 @@ const HumanMessageEditor = ({
74759
74898
  const defaultContext = useDefaultContextForChat();
74760
74899
  useEffect$2(() => {
74761
74900
  var _a2;
74762
- let { initialContext } = defaultContext;
74763
- if (!isSent && isFirstMessage) {
74764
- const editor2 = editorRef.current;
74765
- if (editor2) {
74766
- if ((_a2 = currentChatModel == null ? void 0 : currentChatModel.tags) == null ? void 0 : _a2.includes(ModelTag.StreamDisabled)) {
74767
- initialContext = initialContext.filter((item2) => item2.type !== "tree");
74768
- }
74769
- const filteredItems = initialContext.filter((item2) => item2.type !== "open-link");
74770
- void editor2.setInitialContextMentions(filteredItems);
74771
- }
74901
+ if (isSent || !isFirstMessage || !(editorRef == null ? void 0 : editorRef.current)) {
74902
+ return;
74772
74903
  }
74773
- }, [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]);
74774
74915
  const focusEditor = useCallback(() => {
74775
74916
  var _a2;
74776
74917
  return (_a2 = editorRef.current) == null ? void 0 : _a2.setFocus(true);
@@ -75652,8 +75793,6 @@ const ContextCell = memo$1(
75652
75793
  className,
75653
75794
  defaultOpen,
75654
75795
  isContextLoading,
75655
- intent,
75656
- experimentalOneBoxEnabled,
75657
75796
  agent: agent2
75658
75797
  }) => {
75659
75798
  var _a;
@@ -75709,8 +75848,8 @@ const ContextCell = memo$1(
75709
75848
  const telemetryRecorder = useTelemetryRecorder();
75710
75849
  const isAgenticChat = (model == null ? void 0 : model.includes(DeepCodyAgentID)) || agent2 === DeepCodyAgentID;
75711
75850
  const headerText = {
75712
- main: experimentalOneBoxEnabled && !intent ? "Reviewing query" : isAgenticChat ? "Agentic context" : isContextLoading ? "Fetching context" : "Context",
75713
- sub: experimentalOneBoxEnabled && !intent ? "Figuring out query intent..." : isContextLoading ? isAgenticChat ? "Thinking…" : "Retrieving codebase files…" : contextItems === void 0 ? "none requested" : contextItems.length === 0 ? isAgenticChat ? "none" : "none fetched" : itemCountLabel
75851
+ main: isAgenticChat ? "Agentic context" : isContextLoading ? "Fetching context" : "Context",
75852
+ sub: isContextLoading ? isAgenticChat ? "Thinking…" : "Retrieving codebase files…" : contextItems === void 0 ? "none requested" : contextItems.length === 0 ? isAgenticChat ? "none" : "none fetched" : itemCountLabel
75714
75853
  };
75715
75854
  const hasContent = isContextLoading || contextItemsToDisplay && contextItemsToDisplay.length > 0 || !isForFirstMessage || isAgenticChat;
75716
75855
  return /* @__PURE__ */ jsxs("div", { className: "tw-flex tw-flex-col tw-justify-center tw-w-full tw-gap-2 tw-py-1", children: [
@@ -76035,7 +76174,6 @@ const TranscriptInteraction = memo$1((props) => {
76035
76174
  smartApplyEnabled,
76036
76175
  editorRef: parentEditorRef
76037
76176
  } = props;
76038
- const [intentResults, setIntentResults] = useState$1();
76039
76177
  const [manuallySelectedIntent, setManuallySelectedIntent] = useState$1(void 0);
76040
76178
  useEffect$2(() => {
76041
76179
  setManuallySelectedIntent(void 0);
@@ -76045,7 +76183,6 @@ const TranscriptInteraction = memo$1((props) => {
76045
76183
  const lastEditorRef = useContext(LastEditorContext);
76046
76184
  useImperativeHandle(parentEditorRef, () => humanEditorRef.current);
76047
76185
  const usingToolCody = (_a = assistantMessage == null ? void 0 : assistantMessage.model) == null ? void 0 : _a.includes(ToolCodyModelName);
76048
- const doIntentDetection = useIntentDetectionConfig().doIntentDetection && !usingToolCody;
76049
76186
  const onUserAction = useCallback(
76050
76187
  (action2, intentFromSubmit) => {
76051
76188
  var _a2, _b;
@@ -76070,19 +76207,9 @@ const TranscriptInteraction = memo$1((props) => {
76070
76207
  console.error("Failed to serialize editor value");
76071
76208
  return;
76072
76209
  }
76073
- const query = inputTextWithMappedContextChipsFromPromptEditorState(editorValue.editorState);
76074
- const {
76075
- intent,
76076
- intentScores
76077
- } = query === (intentResults == null ? void 0 : intentResults.query) ? {
76078
- intent: intentResults.intent,
76079
- intentScores: intentResults.allScores
76080
- } : { intent: void 0, intentScores: [] };
76081
76210
  const commonProps = {
76082
76211
  editorValue,
76083
- preDetectedIntent: intent,
76084
- preDetectedIntentScores: intentScores,
76085
- manuallySelectedIntent: intentFromSubmit || manuallySelectedIntent || (doIntentDetection ? void 0 : "chat"),
76212
+ manuallySelectedIntent: intentFromSubmit || manuallySelectedIntent || "chat",
76086
76213
  traceparent
76087
76214
  };
76088
76215
  if (action2 === "edit") {
@@ -76104,9 +76231,7 @@ const TranscriptInteraction = memo$1((props) => {
76104
76231
  setActiveChatContext,
76105
76232
  isLastSentInteraction,
76106
76233
  lastEditorRef,
76107
- intentResults,
76108
- manuallySelectedIntent,
76109
- doIntentDetection
76234
+ manuallySelectedIntent
76110
76235
  ]
76111
76236
  );
76112
76237
  const onEditSubmit = useCallback(
@@ -76121,67 +76246,14 @@ const TranscriptInteraction = memo$1((props) => {
76121
76246
  },
76122
76247
  [onUserAction]
76123
76248
  );
76124
- const extensionAPI = useExtensionAPI();
76125
- const experimentalOneBoxEnabled = useOmniBox() && !usingToolCody;
76126
- const prefetchIntent = useMemo$1(() => {
76127
- const handler = async (editorValue) => {
76128
- if (!experimentalOneBoxEnabled || !doIntentDetection) {
76129
- return;
76130
- }
76131
- const query = inputTextWithMappedContextChipsFromPromptEditorState(
76132
- editorValue.editorState
76133
- ).trim();
76134
- if (query.length < 2) {
76135
- setIntentResults(null);
76136
- return;
76137
- }
76138
- if (query === (intentResults == null ? void 0 : intentResults.query)) {
76139
- return;
76140
- }
76141
- const subscription = extensionAPI.detectIntent(query).subscribe({
76142
- next: (value) => {
76143
- var _a2;
76144
- const currentEditorValue = (_a2 = humanEditorRef.current) == null ? void 0 : _a2.getSerializedValue();
76145
- if (currentEditorValue) {
76146
- const currentQuery = inputTextWithMappedContextChipsFromPromptEditorState(
76147
- currentEditorValue == null ? void 0 : currentEditorValue.editorState
76148
- ).trim();
76149
- if (query !== currentQuery) {
76150
- return;
76151
- }
76152
- }
76153
- setIntentResults(value && { ...value, query });
76154
- },
76155
- error: (error2) => {
76156
- console.error("Error detecting intent:", error2);
76157
- }
76158
- });
76159
- return () => subscription.unsubscribe();
76160
- };
76161
- return debounce(handler, 300);
76162
- }, [experimentalOneBoxEnabled, extensionAPI, intentResults == null ? void 0 : intentResults.query, doIntentDetection]);
76163
- useEffect$2(() => {
76164
- if (!(intentResults == null ? void 0 : intentResults.intent)) {
76165
- return;
76166
- }
76167
- if (!doIntentDetection) {
76168
- setIntentResults({ intent: void 0, query: "" });
76169
- }
76170
- }, [doIntentDetection, intentResults == null ? void 0 : intentResults.intent]);
76171
- useEffect$2(() => {
76172
- if (doIntentDetection) {
76173
- if (humanEditorRef.current) {
76174
- prefetchIntent(humanEditorRef.current.getSerializedValue());
76175
- }
76176
- }
76177
- }, [doIntentDetection, prefetchIntent]);
76249
+ const omniboxEnabled = useOmniBox() && !usingToolCody;
76178
76250
  const vscodeAPI = getVSCodeAPI();
76179
76251
  const onStop = useCallback(() => {
76180
76252
  vscodeAPI.postMessage({
76181
76253
  command: "abort"
76182
76254
  });
76183
76255
  }, [vscodeAPI]);
76184
- const isSearchIntent = experimentalOneBoxEnabled && humanMessage.intent === "search";
76256
+ const isSearchIntent = omniboxEnabled && humanMessage.intent === "search";
76185
76257
  const isContextLoading = Boolean(
76186
76258
  !isSearchIntent && humanMessage.contextFiles === void 0 && isLastSentInteraction && (assistantMessage == null ? void 0 : assistantMessage.text) === void 0 && (assistantMessage == null ? void 0 : assistantMessage.subMessages) === void 0
76187
76259
  );
@@ -76299,7 +76371,6 @@ const TranscriptInteraction = memo$1((props) => {
76299
76371
  contextItems: [],
76300
76372
  editorState: serializedPromptEditorStateFromText(text2)
76301
76373
  },
76302
- preDetectedIntent: "search",
76303
76374
  manuallySelectedIntent: "search"
76304
76375
  }),
76305
76376
  [humanMessage]
@@ -76315,7 +76386,6 @@ const TranscriptInteraction = memo$1((props) => {
76315
76386
  isFirstMessage: humanMessage.index === 0,
76316
76387
  isSent: !humanMessage.isUnsentFollowup,
76317
76388
  isPendingPriorResponse: priorAssistantMessageIsLoading,
76318
- onChange: prefetchIntent,
76319
76389
  onSubmit: onHumanMessageSubmit,
76320
76390
  onStop,
76321
76391
  isFirstInteraction,
@@ -76323,12 +76393,12 @@ const TranscriptInteraction = memo$1((props) => {
76323
76393
  isEditorInitiallyFocused: isLastInteraction,
76324
76394
  editorRef: humanEditorRef,
76325
76395
  className: !isFirstInteraction && isLastInteraction ? "tw-mt-auto" : "",
76326
- intent: manuallySelectedIntent || (intentResults == null ? void 0 : intentResults.intent),
76396
+ intent: manuallySelectedIntent,
76327
76397
  manuallySelectIntent: setManuallySelectedIntent
76328
76398
  },
76329
76399
  humanMessage.index
76330
76400
  ),
76331
- experimentalOneBoxEnabled && (assistantMessage == null ? void 0 : assistantMessage.didYouMeanQuery) && /* @__PURE__ */ jsx(
76401
+ omniboxEnabled && (assistantMessage == null ? void 0 : assistantMessage.didYouMeanQuery) && /* @__PURE__ */ jsx(
76332
76402
  DidYouMeanNotice,
76333
76403
  {
76334
76404
  query: assistantMessage == null ? void 0 : assistantMessage.didYouMeanQuery,
@@ -76348,8 +76418,6 @@ const TranscriptInteraction = memo$1((props) => {
76348
76418
  !usingToolCody && !(humanMessage.agent && isContextLoading) && (humanMessage.contextFiles || assistantMessage || isContextLoading) && !isSearchIntent && /* @__PURE__ */ jsx(
76349
76419
  ContextCell,
76350
76420
  {
76351
- experimentalOneBoxEnabled,
76352
- intent: humanMessage.intent,
76353
76421
  contextItems: humanMessage.contextFiles,
76354
76422
  contextAlternatives: humanMessage.contextAlternatives,
76355
76423
  model: assistantMessage == null ? void 0 : assistantMessage.model,
@@ -76398,8 +76466,6 @@ function focusLastHumanMessageEditor() {
76398
76466
  function editHumanMessage({
76399
76467
  messageIndexInTranscript,
76400
76468
  editorValue,
76401
- preDetectedIntent,
76402
- preDetectedIntentScores,
76403
76469
  manuallySelectedIntent
76404
76470
  }) {
76405
76471
  getVSCodeAPI().postMessage({
@@ -76408,16 +76474,12 @@ function editHumanMessage({
76408
76474
  text: editorValue.text,
76409
76475
  editorState: editorValue.editorState,
76410
76476
  contextItems: editorValue.contextItems.map(deserializeContextItem),
76411
- preDetectedIntent,
76412
- preDetectedIntentScores,
76413
76477
  manuallySelectedIntent
76414
76478
  });
76415
76479
  focusLastHumanMessageEditor();
76416
76480
  }
76417
76481
  function submitHumanMessage({
76418
76482
  editorValue,
76419
- preDetectedIntent,
76420
- preDetectedIntentScores,
76421
76483
  manuallySelectedIntent,
76422
76484
  traceparent
76423
76485
  }) {
@@ -76426,8 +76488,6 @@ function submitHumanMessage({
76426
76488
  text: editorValue.text,
76427
76489
  editorState: editorValue.editorState,
76428
76490
  contextItems: editorValue.contextItems.map(deserializeContextItem),
76429
- preDetectedIntent,
76430
- preDetectedIntentScores,
76431
76491
  manuallySelectedIntent,
76432
76492
  traceparent
76433
76493
  });
@@ -77201,9 +77261,6 @@ function getAppWrappers({
77201
77261
  staticDefaultContext
77202
77262
  }) {
77203
77263
  return [
77204
- {
77205
- component: IntentDetectionConfigProvider
77206
- },
77207
77264
  {
77208
77265
  provider: TelemetryRecorderContext.Provider,
77209
77266
  value: telemetryRecorder
@@ -77929,6 +77986,6 @@ export {
77929
77986
  ChatSkeleton,
77930
77987
  CodyPromptTemplate,
77931
77988
  CodyWebChat,
77932
- ch as deserialize,
77933
- cg as serialize
77989
+ cj as deserialize,
77990
+ ci as serialize
77934
77991
  };