@sourcegraph/cody-web 0.31.1 → 0.32.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,10 +2,10 @@ 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 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";
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 M$4, W as Ds, X as n$1, Y as ns, Z as le$2, $ as c$3, a0 as t$2, a1 as oe$2, a2 as z$1, a3 as yi$1, a4 as W$2, a5 as Ue$1, a6 as I$2, a7 as Se$2, a8 as O$2, a9 as F$1, aa as Ni$1, ab as ee$1, ac as we$2, ad as b$2, ae as T$3, af as s$2, ag as o$4, ah as w$3, ai as i$2, aj as k$3, ak as D$5, al as p$8, am as m$8, an as S$4, ao as v$4, ap as P$2, aq as E$6, ar as Wi$1, as as L$3, at as d$2, au as a$3, av as l$2, aw as f$2, ax as u$6, ay as r$5, az as RULES_PROVIDER_URI, aA as WEB_PROVIDER_URI, aB as REMOTE_DIRECTORY_PROVIDER_URI, aC as REMOTE_FILE_PROVIDER_URI, aD as REMOTE_REPOSITORY_PROVIDER_URI, aE as SYMBOL_CONTEXT_MENTION_PROVIDER, aF as FILE_CONTEXT_MENTION_PROVIDER, aG as displayPathBasename, aH as displayPath, aI as displayLineRange, aJ as displayPathDirname, aK as IGNORED_FILE_WARNING_LABEL, aL as LARGE_FILE_WARNING_LABEL, aM as xe$2, aN as Ei$1, aO as V$2, aP as Es, aQ as U$2, aR as e, aS as Ns, aT as displayPathWithLines, C as ContextItemSource, aU as URI, aV as is$2, aW as object, aX as literal, aY as string$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 FILE_RANGE_TOOLTIP_LABEL, b8 as NO_SYMBOL_MATCHES_HELP_LABEL, b9 as createExtensionAPI, ba as createMessageAPIForWebview, bb as Observable, 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 LRUCache, bI as isError, bJ as RateLimitError, bK as upperFirst, bL as lodashExports, bM as createContextItem, bN as isDefined, bO as isCodeSearchContextItem, bP as reformatBotMessageForChat, bQ as isAbortErrorOrSocketHangUp, bR as ModelTag, bS as DeepCodyAgentID, bT as serializedPromptEditorStateFromChatMessage, bU as contextItemsFromPromptEditorValue, bV as filterContextItemsFromPromptEditorValue, bW as CustomCommandType, bX as View, bY as isCodyProModel, bZ as ToolCodyModelName, b_ as getRelativeChatPeriod, b$ as isMacOS, c0 as firstResultFromOperation, c1 as ENTERPRISE_STARTER_LEARN_MORE_URL, c2 as CODY_PRO_SUBSCRIPTION_URL, c3 as ACCOUNT_USAGE_URL, c4 as ENTERPRISE_STARTER_PRICING_URL, c5 as textContentFromSerializedLexicalNode, c6 as firstValueFrom, c7 as skipPendingOperation, c8 as FAST_CHAT_INPUT_TOKEN_BUDGET, c9 as webviewOpenURIForContextItem, ca as pluralize$1, cb as deserializeContextItem, cc as serializedPromptEditorStateFromText, cd as S2_URL, ce as browser, cf as CodyAutoSuggestionMode, cg as isErrorLike, ch as PromptString, ci as setDisplayPathEnvInfo, U as Uri } from "./vscode-shim-BmcAncjv.mjs";
6
+ import { ck, cj } from "./vscode-shim-BmcAncjv.mjs";
7
7
  import * as React$2 from "react";
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";
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, Fragment as Fragment$2, Children, isValidElement, cloneElement, useReducer } from "react";
9
9
  var classnames = { exports: {} };
10
10
  /*!
11
11
  Copyright (c) 2018 Jed Watson.
@@ -3641,7 +3641,7 @@ function bi() {
3641
3641
  Uh = 0;
3642
3642
  return a2;
3643
3643
  }
3644
- function ci2() {
3644
+ function ci() {
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 = ci2();
3782
+ var b2 = ci();
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 = ci2();
3800
+ var e2 = ci();
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
- ci2().memoizedState = [a2, void 0 === b2 ? null : b2];
3934
+ ci().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 = ci2();
3949
+ var c2 = ci();
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 = ci2();
3955
+ var d2 = ci();
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 = ci2();
3963
+ var b2 = ci();
3964
3964
  a2 = { current: a2 };
3965
3965
  return b2.memoizedState = a2;
3966
3966
  }, useState: qi, useDebugValue: Ai, useDeferredValue: function(a2) {
3967
- return ci2().memoizedState = a2;
3967
+ return ci().memoizedState = a2;
3968
3968
  }, useTransition: function() {
3969
3969
  var a2 = qi(false), b2 = a2[0];
3970
3970
  a2 = Ei.bind(null, a2[1]);
3971
- ci2().memoizedState = a2;
3971
+ ci().memoizedState = a2;
3972
3972
  return [b2, a2];
3973
3973
  }, useMutableSource: function() {
3974
3974
  }, useSyncExternalStore: function(a2, b2, c2) {
3975
- var d2 = N$1, e2 = ci2();
3975
+ var d2 = N$1, e2 = ci();
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 = ci2(), b2 = R$2.identifierPrefix;
3997
+ var a2 = ci(), b2 = R$2.identifierPrefix;
3998
3998
  if (I) {
3999
3999
  var c2 = sg;
4000
4000
  var d2 = rg;
@@ -5269,7 +5269,7 @@ function bk(a2) {
5269
5269
  var c2 = a2.stateNode;
5270
5270
  null === c2 && (c2 = a2.stateNode = new Lj());
5271
5271
  b2.forEach(function(b3) {
5272
- var d2 = ck.bind(null, a2, b3);
5272
+ var d2 = ck2.bind(null, a2, b3);
5273
5273
  c2.has(b3) || (c2.add(b3), b3.then(d2, d2));
5274
5274
  });
5275
5275
  }
@@ -6447,7 +6447,7 @@ function vj(a2) {
6447
6447
  null !== b2 && (c2 = b2.retryLane);
6448
6448
  Zk(a2, c2);
6449
6449
  }
6450
- function ck(a2, b2) {
6450
+ function ck2(a2, b2) {
6451
6451
  var c2 = 0;
6452
6452
  switch (a2.tag) {
6453
6453
  case 13:
@@ -8425,6 +8425,13 @@ const MessagesSquare = createLucideIcon("MessagesSquare", [
8425
8425
  ["path", { d: "M14 9a2 2 0 0 1-2 2H6l-4 4V4c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2z", key: "jj09z8" }],
8426
8426
  ["path", { d: "M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1", key: "1cx29u" }]
8427
8427
  ]);
8428
+ /**
8429
+ * @license lucide-react v0.378.0 - ISC
8430
+ *
8431
+ * This source code is licensed under the ISC license.
8432
+ * See the LICENSE file in the root directory of this source tree.
8433
+ */
8434
+ const Minus = createLucideIcon("Minus", [["path", { d: "M5 12h14", key: "1ays0h" }]]);
8428
8435
  /**
8429
8436
  * @license lucide-react v0.378.0 - ISC
8430
8437
  *
@@ -8739,12 +8746,12 @@ const SvgNotion = (props) => /* @__PURE__ */ React$2.createElement("svg", { widt
8739
8746
  const SvgSentry = (props) => /* @__PURE__ */ React$2.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React$2.createElement("path", { d: "M1.99994 11.999C1.99563 12.253 2.06662 12.5026 2.20394 12.7164C2.31807 12.8958 2.47348 13.0454 2.65718 13.1525C2.84088 13.2597 3.04755 13.3214 3.25994 13.3324C3.69061 13.3544 2.90194 13.3324 3.33327 13.3324H5.33327C5.33335 12.6045 5.09473 11.8968 4.65401 11.3176C4.21328 10.7384 3.59476 10.3197 2.89327 10.1257C3.26616 9.47726 3.7195 8.69259 4.25327 7.7717C5.36037 8.22032 6.30836 8.98918 6.97585 9.97983C7.64333 10.9705 7.99991 12.1378 7.99994 13.3324H12.6666C12.8841 13.3308 13.098 13.2761 13.2895 13.173C13.4811 13.0698 13.6444 12.9213 13.7654 12.7405C13.8864 12.5597 13.9613 12.3521 13.9836 12.1357C14.0059 11.9193 13.9749 11.7007 13.8933 11.499L9.15994 3.33237C9.04464 3.12397 8.87561 2.95025 8.67044 2.82929C8.46527 2.70833 8.23145 2.64453 7.99327 2.64453C7.7551 2.64453 7.52128 2.70833 7.31611 2.82929C7.11094 2.95025 6.94191 3.12397 6.82661 3.33237L5.59994 5.4497C8.58794 6.81637 10.6666 9.83037 10.6666 13.3324", stroke: "currentColor", strokeWidth: 1.25, strokeLinecap: "round", strokeLinejoin: "round" }));
8740
8747
  const SvgSlack = (props) => /* @__PURE__ */ React$2.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React$2.createElement("path", { d: "M3.99992 10C3.99992 10.3536 3.85944 10.6928 3.60939 10.9428C3.35935 11.1929 3.02021 11.3333 2.66659 11.3333C2.31296 11.3333 1.97382 11.1929 1.72378 10.9428C1.47373 10.6928 1.33325 10.3536 1.33325 10C1.33325 9.64638 1.47373 9.30724 1.72378 9.05719C1.97382 8.80714 2.31296 8.66667 2.66659 8.66667H3.99992V10ZM4.66659 10C4.66659 9.64638 4.80706 9.30724 5.05711 9.05719C5.30716 8.80714 5.6463 8.66667 5.99992 8.66667C6.35354 8.66667 6.69268 8.80714 6.94273 9.05719C7.19278 9.30724 7.33325 9.64638 7.33325 10V13.3333C7.33325 13.687 7.19278 14.0261 6.94273 14.2761C6.69268 14.5262 6.35354 14.6667 5.99992 14.6667C5.6463 14.6667 5.30716 14.5262 5.05711 14.2761C4.80706 14.0261 4.66659 13.687 4.66659 13.3333V10ZM5.99992 4.66667C5.6463 4.66667 5.30716 4.52619 5.05711 4.27614C4.80706 4.02609 4.66659 3.68696 4.66659 3.33333C4.66659 2.97971 4.80706 2.64057 5.05711 2.39052C5.30716 2.14048 5.6463 2 5.99992 2C6.35354 2 6.69268 2.14048 6.94273 2.39052C7.19278 2.64057 7.33325 2.97971 7.33325 3.33333V4.66667H5.99992ZM5.99992 5.33333C6.35354 5.33333 6.69268 5.47381 6.94273 5.72386C7.19278 5.97391 7.33325 6.31305 7.33325 6.66667C7.33325 7.02029 7.19278 7.35943 6.94273 7.60948C6.69268 7.85952 6.35354 8 5.99992 8H2.66659C2.31296 8 1.97382 7.85952 1.72378 7.60948C1.47373 7.35943 1.33325 7.02029 1.33325 6.66667C1.33325 6.31305 1.47373 5.97391 1.72378 5.72386C1.97382 5.47381 2.31296 5.33333 2.66659 5.33333H5.99992ZM11.3333 6.66667C11.3333 6.31305 11.4737 5.97391 11.7238 5.72386C11.9738 5.47381 12.313 5.33333 12.6666 5.33333C13.0202 5.33333 13.3593 5.47381 13.6094 5.72386C13.8594 5.97391 13.9999 6.31305 13.9999 6.66667C13.9999 7.02029 13.8594 7.35943 13.6094 7.60948C13.3593 7.85952 13.0202 8 12.6666 8H11.3333V6.66667ZM10.6666 6.66667C10.6666 7.02029 10.5261 7.35943 10.2761 7.60948C10.026 7.85952 9.68687 8 9.33325 8C8.97963 8 8.64049 7.85952 8.39044 7.60948C8.14039 7.35943 7.99992 7.02029 7.99992 6.66667V3.33333C7.99992 2.97971 8.14039 2.64057 8.39044 2.39052C8.64049 2.14048 8.97963 2 9.33325 2C9.68687 2 10.026 2.14048 10.2761 2.39052C10.5261 2.64057 10.6666 2.97971 10.6666 3.33333V6.66667ZM9.33325 12C9.68687 12 10.026 12.1405 10.2761 12.3905C10.5261 12.6406 10.6666 12.9797 10.6666 13.3333C10.6666 13.687 10.5261 14.0261 10.2761 14.2761C10.026 14.5262 9.68687 14.6667 9.33325 14.6667C8.97963 14.6667 8.64049 14.5262 8.39044 14.2761C8.14039 14.0261 7.99992 13.687 7.99992 13.3333V12H9.33325ZM9.33325 11.3333C8.97963 11.3333 8.64049 11.1929 8.39044 10.9428C8.14039 10.6928 7.99992 10.3536 7.99992 10C7.99992 9.64638 8.14039 9.30724 8.39044 9.05719C8.64049 8.80714 8.97963 8.66667 9.33325 8.66667H12.6666C13.0202 8.66667 13.3593 8.80714 13.6094 9.05719C13.8594 9.30724 13.9999 9.64638 13.9999 10C13.9999 10.3536 13.8594 10.6928 13.6094 10.9428C13.3593 11.1929 13.0202 11.3333 12.6666 11.3333H9.33325Z" }));
8741
8748
  const SvgSourcegraph = (props) => /* @__PURE__ */ React$2.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React$2.createElement("path", { d: "M10.7733 3.92081C10.9385 3.77931 11.1317 3.69348 11.3295 3.65636C11.7344 3.58213 12.1696 3.71899 12.4559 4.05536C12.8841 4.55642 12.8236 5.30802 12.3232 5.73485L10.5545 7.23805L9.25589 6.77874L8.77182 6.60708L7.95728 6.31943L8.61589 5.76037L9.00687 5.42865L10.7756 3.92545L10.7733 3.92081Z" }), /* @__PURE__ */ React$2.createElement("path", { d: "M4.85498 12.0829C4.68975 12.2244 4.49658 12.3102 4.29877 12.3473C3.89382 12.4215 3.45862 12.2847 3.17237 11.9483C2.74415 11.4473 2.80466 10.6957 3.30502 10.2688L5.07375 8.76562L6.37236 9.22493L6.85643 9.3966L7.67097 9.68424L7.01236 10.2433L6.62138 10.575L4.85266 12.0782L4.85498 12.0829Z" }), /* @__PURE__ */ React$2.createElement("path", { d: "M5.74876 3.4069C5.63007 2.7597 6.05829 2.14032 6.70527 2.0197C7.35458 1.90139 7.97596 2.32822 8.09697 2.97311L8.51821 5.2511L7.46861 6.1442L6.17 5.68489L5.74876 3.4069Z" }), /* @__PURE__ */ React$2.createElement("path", { d: "M9.87955 12.5928C9.99824 13.24 9.57003 13.8594 8.92305 13.98C8.27374 14.0983 7.65236 13.6715 7.53134 13.0266L7.11011 10.7486L8.1597 9.85547L9.45832 10.3148L9.87955 12.5928Z" }), /* @__PURE__ */ React$2.createElement("path", { d: "M13.5636 10.0308C13.4147 10.446 13.0609 10.729 12.6537 10.8033C12.4535 10.8404 12.2441 10.8265 12.0393 10.7545L9.84932 9.97975L9.36525 9.80809L8.5507 9.52044L8.06663 9.34878L6.76802 8.88947L6.28395 8.71781L5.4694 8.43016L4.98533 8.2585L2.79538 7.48371C2.17399 7.26333 1.84818 6.58364 2.06927 5.96427C2.21821 5.54904 2.57196 5.26603 2.97923 5.1918C3.17937 5.15468 3.38883 5.1686 3.59363 5.24051L5.78358 6.01531L6.26766 6.18697L7.0822 6.47462L7.56627 6.64628L8.86488 7.10559L9.34896 7.27725L10.1635 7.5649L10.6476 7.73656L12.8375 8.51135C13.4589 8.73173 13.7847 9.41142 13.5636 10.0308Z" }));
8742
- const title$1 = "_title_1ibg5_5";
8749
+ const title = "_title_1ibg5_5";
8743
8750
  const description = "_description_1ibg5_5";
8744
8751
  const warning = "_warning_1ibg5_5";
8745
8752
  const row$1 = "_row_1ibg5_11";
8746
8753
  const styles$D = {
8747
- title: title$1,
8754
+ title,
8748
8755
  description,
8749
8756
  warning,
8750
8757
  row: row$1
@@ -8862,12 +8869,12 @@ const iconForItem = {
8862
8869
  const contextItemMentionNode = "_context-item-mention-node_1eamp_1";
8863
8870
  const icon$1 = "_icon_1eamp_14";
8864
8871
  const contextItemMentionChipNodeFocused = "_context-item-mention-chip-node--focused_1eamp_28";
8865
- const isTooLargeOrIgnored$1 = "_is-too-large-or-ignored_1eamp_33";
8872
+ const isTooLargeOrIgnored = "_is-too-large-or-ignored_1eamp_33";
8866
8873
  const styles$C = {
8867
8874
  contextItemMentionNode,
8868
8875
  icon: icon$1,
8869
8876
  contextItemMentionChipNodeFocused,
8870
- isTooLargeOrIgnored: isTooLargeOrIgnored$1
8877
+ isTooLargeOrIgnored
8871
8878
  };
8872
8879
  function d(e2, t2) {
8873
8880
  return e2.getEditorState().read(() => {
@@ -10533,51 +10540,26 @@ const PromptEditor$1 = ({
10533
10540
  return toSerializedPromptEditorValue$1(editorRef.current);
10534
10541
  },
10535
10542
  setFocus(focus, { moveCursorToEnd } = {}) {
10536
- return new Promise((resolve) => {
10537
- const editor2 = editorRef.current;
10538
- if (editor2) {
10539
- if (focus) {
10540
- editor2.update(
10541
- () => {
10542
- const selection = Fi$1();
10543
- const root2 = ke$1();
10544
- if (selection !== null) {
10545
- selection.dirty = true;
10546
- } else if (root2.getChildrenSize() !== 0) {
10547
- root2.selectEnd();
10548
- }
10549
- if (moveCursorToEnd) {
10550
- root2.selectEnd();
10551
- }
10552
- const doFocus = () => {
10553
- var _a;
10554
- return (_a = editor2.getRootElement()) == null ? void 0 : _a.focus({ preventScroll: false });
10555
- };
10556
- doFocus();
10557
- setTimeout(doFocus);
10558
- },
10559
- { tag: "skip-scroll-into-view", onUpdate: resolve }
10560
- );
10561
- } else {
10562
- editor2.blur();
10563
- resolve == null ? void 0 : resolve();
10564
- }
10565
- } else {
10566
- resolve == null ? void 0 : resolve();
10567
- }
10568
- });
10543
+ if (!editorRef.current) {
10544
+ return Promise.resolve();
10545
+ }
10546
+ return setFocus(editorRef.current, { focus, moveCursorToEnd });
10569
10547
  },
10570
10548
  appendText(text2) {
10571
10549
  if (!editorRef.current) {
10572
10550
  return Promise.resolve();
10573
10551
  }
10574
- return update(editorRef.current, () => {
10575
- const root2 = ke$1();
10576
- root2.selectEnd();
10577
- Wi$1([ri$1(`${getWhitespace(root2)}${text2}`)]);
10578
- root2.selectEnd();
10579
- return true;
10580
- });
10552
+ return appendText(editorRef.current, text2);
10553
+ },
10554
+ openAtMentionMenu() {
10555
+ const editor2 = editorRef.current;
10556
+ if (!editor2) {
10557
+ return Promise.resolve();
10558
+ }
10559
+ if (toSerializedPromptEditorValue$1(editor2).text.trim().endsWith("@")) {
10560
+ return setFocus(editor2, { focus: true, moveCursorToEnd: true });
10561
+ }
10562
+ return appendText(editorRef.current, "@");
10581
10563
  },
10582
10564
  filterMentions(filter2) {
10583
10565
  if (!editorRef.current) {
@@ -10747,6 +10729,45 @@ const PromptEditor$1 = ({
10747
10729
  }
10748
10730
  );
10749
10731
  };
10732
+ function appendText(editor2, text2) {
10733
+ return update(editor2, () => {
10734
+ const root2 = ke$1();
10735
+ root2.selectEnd();
10736
+ Wi$1([ri$1(`${getWhitespace(root2)}${text2}`)]);
10737
+ root2.selectEnd();
10738
+ return true;
10739
+ });
10740
+ }
10741
+ function setFocus(editor2, { focus, moveCursorToEnd }) {
10742
+ return new Promise((resolve) => {
10743
+ if (focus) {
10744
+ editor2.update(
10745
+ () => {
10746
+ const selection = Fi$1();
10747
+ const root2 = ke$1();
10748
+ if (selection !== null) {
10749
+ selection.dirty = true;
10750
+ } else if (root2.getChildrenSize() !== 0) {
10751
+ root2.selectEnd();
10752
+ }
10753
+ if (moveCursorToEnd) {
10754
+ root2.selectEnd();
10755
+ }
10756
+ const doFocus = () => {
10757
+ var _a;
10758
+ return (_a = editor2.getRootElement()) == null ? void 0 : _a.focus({ preventScroll: false });
10759
+ };
10760
+ doFocus();
10761
+ setTimeout(doFocus);
10762
+ },
10763
+ { tag: "skip-scroll-into-view", onUpdate: resolve }
10764
+ );
10765
+ } else {
10766
+ editor2.blur();
10767
+ resolve == null ? void 0 : resolve();
10768
+ }
10769
+ });
10770
+ }
10750
10771
  function normalizeEditorStateJSON$1(value) {
10751
10772
  return JSON.parse(JSON.stringify(value));
10752
10773
  }
@@ -13511,7 +13532,7 @@ const OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
13511
13532
  function wsOptionsFor(type, preserveWhitespace, base2) {
13512
13533
  if (preserveWhitespace != null)
13513
13534
  return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
13514
- return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
13535
+ return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & -5;
13515
13536
  }
13516
13537
  class NodeContext {
13517
13538
  constructor(type, attrs, marks, solid, match, options) {
@@ -16405,7 +16426,7 @@ class Transaction extends Transform {
16405
16426
  throw new RangeError("Selection passed to setSelection must point at the current document");
16406
16427
  this.curSelection = selection;
16407
16428
  this.curSelectionFor = this.steps.length;
16408
- this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
16429
+ this.updated = (this.updated | UPDATED_SEL) & -3;
16409
16430
  this.storedMarks = null;
16410
16431
  return this;
16411
16432
  }
@@ -16456,7 +16477,7 @@ class Transaction extends Transform {
16456
16477
  */
16457
16478
  addStep(step, doc2) {
16458
16479
  super.addStep(step, doc2);
16459
- this.updated = this.updated & ~UPDATED_MARKS;
16480
+ this.updated = this.updated & -3;
16460
16481
  this.storedMarks = null;
16461
16482
  }
16462
16483
  /**
@@ -19648,15 +19669,15 @@ class ViewTreeUpdater {
19648
19669
  recreateWrapper(next, node2, outerDeco, innerDeco, view, pos) {
19649
19670
  if (next.dirty || node2.isAtom || !next.children.length || !next.node.content.eq(node2.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))
19650
19671
  return null;
19651
- let wrapper = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos);
19652
- if (wrapper.contentDOM) {
19653
- wrapper.children = next.children;
19672
+ let wrapper2 = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos);
19673
+ if (wrapper2.contentDOM) {
19674
+ wrapper2.children = next.children;
19654
19675
  next.children = [];
19655
- for (let ch2 of wrapper.children)
19656
- ch2.parent = wrapper;
19676
+ for (let ch2 of wrapper2.children)
19677
+ ch2.parent = wrapper2;
19657
19678
  }
19658
19679
  next.destroy();
19659
- return wrapper;
19680
+ return wrapper2;
19660
19681
  }
19661
19682
  // Insert the node as a newly created node desc.
19662
19683
  addNode(node2, outerDeco, innerDeco, view, pos) {
@@ -20409,10 +20430,10 @@ function serializeForClipboard(view, slice2) {
20409
20430
  let firstChild = wrap2.firstChild, needsWrap, wrappers = 0;
20410
20431
  while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
20411
20432
  for (let i = needsWrap.length - 1; i >= 0; i--) {
20412
- let wrapper = doc2.createElement(needsWrap[i]);
20433
+ let wrapper2 = doc2.createElement(needsWrap[i]);
20413
20434
  while (wrap2.firstChild)
20414
- wrapper.appendChild(wrap2.firstChild);
20415
- wrap2.appendChild(wrapper);
20435
+ wrapper2.appendChild(wrap2.firstChild);
20436
+ wrap2.appendChild(wrapper2);
20416
20437
  wrappers++;
20417
20438
  }
20418
20439
  firstChild = wrap2.firstChild;
@@ -26166,6 +26187,7 @@ const atMention = "_atMention_1krkf_1";
26166
26187
  const styles$w = {
26167
26188
  atMention
26168
26189
  };
26190
+ const AT_MENTION_TRIGGER_CHARACTER = "@";
26169
26191
  const emptyState = {
26170
26192
  type: "inactive",
26171
26193
  decoration: DecorationSet.empty
@@ -26246,7 +26268,7 @@ function createAtMentionPlugin() {
26246
26268
  rules: [
26247
26269
  new InputRule(
26248
26270
  // Trigger on @, at beginning or after space
26249
- /(^|\s)@$/,
26271
+ new RegExp(`(^|\\s)${AT_MENTION_TRIGGER_CHARACTER}$`),
26250
26272
  (state, match, start, end) => {
26251
26273
  return enableAtMention(state.tr.insertText(match[0], start, end));
26252
26274
  }
@@ -26304,7 +26326,7 @@ function setAtMentionValue(state, value) {
26304
26326
  if (value.length === 0) {
26305
26327
  return state.tr.delete(decoration.from + 1, decoration.to);
26306
26328
  }
26307
- if (value.startsWith("@")) {
26329
+ if (value.startsWith(AT_MENTION_TRIGGER_CHARACTER)) {
26308
26330
  value = value.slice(1);
26309
26331
  }
26310
26332
  return state.tr.replaceWith(decoration.from + 1, decoration.to, state.schema.text(value));
@@ -26493,11 +26515,6 @@ const prosemirrorActor = fromCallback(
26493
26515
  }
26494
26516
  );
26495
26517
  const promptInput = setup({
26496
- types: {
26497
- events: {},
26498
- input: {},
26499
- context: {}
26500
- },
26501
26518
  actors: {
26502
26519
  editor: prosemirrorActor,
26503
26520
  /**
@@ -26865,7 +26882,9 @@ const promptInput = setup({
26865
26882
  "mentionsMenu.provider.set": {
26866
26883
  actions: {
26867
26884
  type: "assignMentionsMenu",
26868
- params: ({ event }) => ({ parent: event.provider })
26885
+ // Reset items to an empty list so that we do not show previous/old items when a new provider
26886
+ // is selected.
26887
+ params: ({ event }) => ({ parent: event.provider, items: [] })
26869
26888
  },
26870
26889
  target: ".loading"
26871
26890
  },
@@ -27170,6 +27189,8 @@ function getTarget(event) {
27170
27189
  return event.target;
27171
27190
  }
27172
27191
  const sides = ["top", "right", "bottom", "left"];
27192
+ const alignments = ["start", "end"];
27193
+ const placements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
27173
27194
  const min = Math.min;
27174
27195
  const max = Math.max;
27175
27196
  const round = Math.round;
@@ -27554,6 +27575,102 @@ const arrow$2 = (options) => ({
27554
27575
  };
27555
27576
  }
27556
27577
  });
27578
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
27579
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
27580
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
27581
+ if (alignment) {
27582
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
27583
+ }
27584
+ return true;
27585
+ });
27586
+ }
27587
+ const autoPlacement$2 = function(options) {
27588
+ if (options === void 0) {
27589
+ options = {};
27590
+ }
27591
+ return {
27592
+ name: "autoPlacement",
27593
+ options,
27594
+ async fn(state) {
27595
+ var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
27596
+ const {
27597
+ rects,
27598
+ middlewareData,
27599
+ placement,
27600
+ platform: platform2,
27601
+ elements
27602
+ } = state;
27603
+ const {
27604
+ crossAxis = false,
27605
+ alignment,
27606
+ allowedPlacements = placements,
27607
+ autoAlignment = true,
27608
+ ...detectOverflowOptions
27609
+ } = evaluate(options, state);
27610
+ const placements$1 = alignment !== void 0 || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
27611
+ const overflow = await detectOverflow(state, detectOverflowOptions);
27612
+ const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
27613
+ const currentPlacement = placements$1[currentIndex];
27614
+ if (currentPlacement == null) {
27615
+ return {};
27616
+ }
27617
+ const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
27618
+ if (placement !== currentPlacement) {
27619
+ return {
27620
+ reset: {
27621
+ placement: placements$1[0]
27622
+ }
27623
+ };
27624
+ }
27625
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
27626
+ const allOverflows = [...((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || [], {
27627
+ placement: currentPlacement,
27628
+ overflows: currentOverflows
27629
+ }];
27630
+ const nextPlacement = placements$1[currentIndex + 1];
27631
+ if (nextPlacement) {
27632
+ return {
27633
+ data: {
27634
+ index: currentIndex + 1,
27635
+ overflows: allOverflows
27636
+ },
27637
+ reset: {
27638
+ placement: nextPlacement
27639
+ }
27640
+ };
27641
+ }
27642
+ const placementsSortedByMostSpace = allOverflows.map((d2) => {
27643
+ const alignment2 = getAlignment(d2.placement);
27644
+ return [d2.placement, alignment2 && crossAxis ? (
27645
+ // Check along the mainAxis and main crossAxis side.
27646
+ d2.overflows.slice(0, 2).reduce((acc, v2) => acc + v2, 0)
27647
+ ) : (
27648
+ // Check only the mainAxis.
27649
+ d2.overflows[0]
27650
+ ), d2.overflows];
27651
+ }).sort((a2, b2) => a2[1] - b2[1]);
27652
+ const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter((d2) => d2[2].slice(
27653
+ 0,
27654
+ // Aligned placements should not check their opposite crossAxis
27655
+ // side.
27656
+ getAlignment(d2[0]) ? 2 : 3
27657
+ ).every((v2) => v2 <= 0));
27658
+ const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
27659
+ if (resetPlacement !== placement) {
27660
+ return {
27661
+ data: {
27662
+ index: currentIndex + 1,
27663
+ overflows: allOverflows
27664
+ },
27665
+ reset: {
27666
+ placement: resetPlacement
27667
+ }
27668
+ };
27669
+ }
27670
+ return {};
27671
+ }
27672
+ };
27673
+ };
27557
27674
  const flip$1 = function(options) {
27558
27675
  if (options === void 0) {
27559
27676
  options = {};
@@ -27590,7 +27707,7 @@ const flip$1 = function(options) {
27590
27707
  if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") {
27591
27708
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
27592
27709
  }
27593
- const placements = [initialPlacement, ...fallbackPlacements];
27710
+ const placements2 = [initialPlacement, ...fallbackPlacements];
27594
27711
  const overflow = await detectOverflow(state, detectOverflowOptions);
27595
27712
  const overflows = [];
27596
27713
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
@@ -27608,7 +27725,7 @@ const flip$1 = function(options) {
27608
27725
  if (!overflows.every((side2) => side2 <= 0)) {
27609
27726
  var _middlewareData$flip2, _overflowsData$filter;
27610
27727
  const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
27611
- const nextPlacement = placements[nextIndex];
27728
+ const nextPlacement = placements2[nextIndex];
27612
27729
  if (nextPlacement) {
27613
27730
  return {
27614
27731
  data: {
@@ -28522,6 +28639,7 @@ function autoUpdate(reference, floating, update2, options) {
28522
28639
  };
28523
28640
  }
28524
28641
  const offset$1 = offset$2;
28642
+ const autoPlacement$1 = autoPlacement$2;
28525
28643
  const shift$1 = shift$2;
28526
28644
  const flip = flip$1;
28527
28645
  const size$1 = size$2;
@@ -28772,6 +28890,10 @@ const size = (options, deps) => ({
28772
28890
  ...size$1(options),
28773
28891
  options: [options, deps]
28774
28892
  });
28893
+ const autoPlacement = (options, deps) => ({
28894
+ ...autoPlacement$1(options),
28895
+ options: [options, deps]
28896
+ });
28775
28897
  const SafeReact = {
28776
28898
  ...React$2
28777
28899
  };
@@ -29633,8 +29755,8 @@ function useInteractions(propsList) {
29633
29755
  getItemProps
29634
29756
  }), [getReferenceProps, getFloatingProps, getItemProps]);
29635
29757
  }
29636
- const popoverDimensions = "_popover-dimensions_p6bj9_1";
29637
- const menu = "_menu_p6bj9_5";
29758
+ const popoverDimensions = "_popover-dimensions_17xxk_1";
29759
+ const menu = "_menu_17xxk_5";
29638
29760
  const styles$v = {
29639
29761
  popoverDimensions,
29640
29762
  menu
@@ -29649,10 +29771,14 @@ const MentionsMenu = ({
29649
29771
  renderItem
29650
29772
  }) => {
29651
29773
  const container2 = useRef$1(null);
29652
- const { refs, floatingStyles } = useFloating$1({
29774
+ const { refs, floatingStyles, update: update2 } = useFloating$1({
29653
29775
  open: true,
29654
29776
  placement: "bottom-start",
29777
+ whileElementsMounted: autoUpdate,
29655
29778
  middleware: [
29779
+ autoPlacement({
29780
+ allowedPlacements: ["bottom-start", "top-start"]
29781
+ }),
29656
29782
  shift({
29657
29783
  padding: 8
29658
29784
  }),
@@ -29673,17 +29799,20 @@ const MentionsMenu = ({
29673
29799
  getBoundingClientRect() {
29674
29800
  return {
29675
29801
  width: 0,
29676
- height: 0,
29677
- y: menuPosition.y,
29678
- x: menuPosition.x,
29679
- top: menuPosition.y,
29680
- bottom: menuPosition.y,
29681
- left: menuPosition.x,
29682
- right: menuPosition.x
29802
+ height: menuPosition.bottom - menuPosition.top,
29803
+ y: menuPosition.top,
29804
+ x: menuPosition.left,
29805
+ top: menuPosition.top,
29806
+ bottom: menuPosition.bottom,
29807
+ left: menuPosition.left,
29808
+ right: menuPosition.right
29683
29809
  };
29684
29810
  }
29685
29811
  });
29686
29812
  }, [menuPosition, refs]);
29813
+ useLayoutEffect$1(() => {
29814
+ update2();
29815
+ }, [items, update2]);
29687
29816
  useEffect$2(() => {
29688
29817
  var _a, _b;
29689
29818
  (_b = (_a = container2.current) == null ? void 0 : _a.querySelector('[aria-selected="true"]')) == null ? void 0 : _b.scrollIntoView({ block: "nearest" });
@@ -29739,7 +29868,7 @@ const MentionsMenu = ({
29739
29868
  };
29740
29869
  const headerClass = "!tw-p-0 !tw-border-b-0 !tw-p-3 !tw-text-md !tw-leading-[1.2] !tw-h-[30px] tw-opacity-50";
29741
29870
  const menuClass = "tw-overflow-hidden tw-overflow-y-auto tw-rounded-md tw-bg-popover tw-text-popover-foreground";
29742
- const itemClass = "w-relative tw-cursor-pointer tw-select-none tw-items-center tw-py-3 tw-px-2 tw-text-md tw-outline-none aria-selected:tw-bg-accent aria-selected:tw-text-accent-foreground hover:tw-bg-accent hover:tw-text-accent-foreground data-[disabled=true]:tw-pointer-events-none data-[disabled=true]:tw-opacity-50 !tw-p-3 !tw-text-md !tw-leading-[1.2] !tw-h-[30px] !tw-rounded-none";
29871
+ const itemClass = "w-relative tw-cursor-pointer tw-select-none tw-items-center tw-py-3 tw-px-2 tw-text-md tw-outline-none aria-selected:tw-bg-accent aria-selected:tw-text-accent-foreground hover:tw-bg-accent hover:tw-text-accent-foreground data-[disabled=true]:tw-pointer-events-none data-[disabled=true]:tw-opacity-50 !tw-p-3 !tw-text-md !tw-leading-[1.2] !tw-min-h-[30px] !tw-rounded-none";
29743
29872
  var index$2 = useLayoutEffect$1;
29744
29873
  var withSelector = { exports: {} };
29745
29874
  var withSelector_production = {};
@@ -29958,11 +30087,9 @@ var m$1 = reactDomExports;
29958
30087
  }
29959
30088
  const mention = "_mention_1l0qj_1";
29960
30089
  const mentionFocused = "_mention--focused_1l0qj_1";
29961
- const isTooLargeOrIgnored = "_is-too-large-or-ignored_1l0qj_30";
29962
30090
  const styles$u = {
29963
30091
  mention,
29964
- mentionFocused,
29965
- isTooLargeOrIgnored
30092
+ mentionFocused
29966
30093
  };
29967
30094
  class MentionView {
29968
30095
  constructor(node2) {
@@ -30309,6 +30436,12 @@ const usePromptInput = (options) => {
30309
30436
  transaction: (state) => appendToDocument(state, text2)
30310
30437
  });
30311
30438
  },
30439
+ openAtMentionMenu() {
30440
+ editor2.send({
30441
+ type: "document.update",
30442
+ transaction: (state) => enableAtMention(appendToDocument(state, AT_MENTION_TRIGGER_CHARACTER))
30443
+ });
30444
+ },
30312
30445
  addMentions(items, position2 = "after", seperator = " ") {
30313
30446
  editor2.send({
30314
30447
  type: "document.update",
@@ -30400,24 +30533,22 @@ const PromptEditor = ({
30400
30533
  return queryLower ? ((_a = item2.title) == null ? void 0 : _a.toLowerCase().includes(queryLower)) || item2.uri.toString().toLowerCase().includes(queryLower) || ((_b = item2.description) == null ? void 0 : _b.toString().toLowerCase().includes(queryLower)) : true;
30401
30534
  }
30402
30535
  );
30403
- return Observable.of(filteredInitialContextItems).concat(
30404
- mentionMenuData({
30405
- ...parseMentionQuery(query2, provider ?? null),
30406
- interactionID: interactionID.current,
30407
- contextRemoteRepositoriesNames: mentionSettings.remoteRepositoriesNames
30408
- }).map((result2) => {
30409
- var _a;
30410
- return [
30411
- ...result2.providers,
30412
- ...filteredInitialContextItems,
30413
- ...((_a = result2.items) == null ? void 0 : _a.filter(
30414
- (item2) => !filteredInitialContextItems.some(
30415
- (initialItem) => areContextItemsEqual(item2, initialItem)
30416
- )
30417
- ).slice(0, SUGGESTION_LIST_LENGTH_LIMIT).map((item2) => ({ ...item2, source: ContextItemSource.User }))) ?? []
30418
- ];
30419
- })
30420
- );
30536
+ return mentionMenuData({
30537
+ ...parseMentionQuery(query2, provider ?? null),
30538
+ interactionID: interactionID.current,
30539
+ contextRemoteRepositoriesNames: mentionSettings.remoteRepositoriesNames
30540
+ }).map((result2) => {
30541
+ var _a;
30542
+ return [
30543
+ ...result2.providers,
30544
+ ...filteredInitialContextItems,
30545
+ ...((_a = result2.items) == null ? void 0 : _a.filter(
30546
+ (item2) => !filteredInitialContextItems.some(
30547
+ (initialItem) => areContextItemsEqual(item2, initialItem)
30548
+ )
30549
+ ).slice(0, SUGGESTION_LIST_LENGTH_LIMIT).map((item2) => ({ ...item2, source: ContextItemSource.User }))) ?? []
30550
+ ];
30551
+ });
30421
30552
  },
30422
30553
  [mentionMenuData, mentionSettings, defaultContext]
30423
30554
  );
@@ -30433,8 +30564,7 @@ const PromptEditor = ({
30433
30564
  onEnterKey,
30434
30565
  fetchMenuData
30435
30566
  });
30436
- const { show, items, selectedIndex, query, position: position2, parent } = useMentionsMenu(input2);
30437
- const menuPosition = useMemo$1(() => ({ x: position2.left, y: position2.bottom }), [position2]);
30567
+ const { show, items, selectedIndex, query, position: menuPosition, parent } = useMentionsMenu(input2);
30438
30568
  useLayoutEffect$1(() => {
30439
30569
  if (!show) {
30440
30570
  interactionID.current++;
@@ -30458,14 +30588,18 @@ const PromptEditor = ({
30458
30588
  async filterMentions(filter2) {
30459
30589
  api2.filterMentions(filter2);
30460
30590
  },
30461
- async addMentions(items2, position22 = "after", sep = " ") {
30462
- api2.addMentions(items2, position22, sep);
30591
+ async addMentions(items2, position2 = "after", sep = " ") {
30592
+ api2.addMentions(items2, position2, sep);
30463
30593
  },
30464
- async upsertMentions(items2, position22 = "after", sep = " ", focusEditor = true) {
30465
- api2.upsertMentions(items2, position22, sep, focusEditor);
30594
+ async upsertMentions(items2, position2 = "after", sep = " ", focusEditor = true) {
30595
+ api2.upsertMentions(items2, position2, sep, focusEditor);
30466
30596
  },
30467
30597
  async setInitialContextMentions(items2) {
30468
30598
  api2.setInitialContextMentions(items2);
30599
+ },
30600
+ async openAtMentionMenu() {
30601
+ api2.openAtMentionMenu();
30602
+ api2.setFocus(true);
30469
30603
  }
30470
30604
  }),
30471
30605
  [api2]
@@ -30657,9 +30791,33 @@ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
30657
30791
  function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
30658
30792
  return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
30659
30793
  }
30794
+ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
30795
+ const Context = /* @__PURE__ */ createContext(defaultContext);
30796
+ function Provider(props) {
30797
+ const { children: children2, ...context2 } = props;
30798
+ const value = useMemo$1(
30799
+ () => context2,
30800
+ Object.values(context2)
30801
+ );
30802
+ return /* @__PURE__ */ createElement(Context.Provider, {
30803
+ value
30804
+ }, children2);
30805
+ }
30806
+ function useContext$1(consumerName) {
30807
+ const context2 = useContext(Context);
30808
+ if (context2) return context2;
30809
+ if (defaultContext !== void 0) return defaultContext;
30810
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
30811
+ }
30812
+ Provider.displayName = rootComponentName + "Provider";
30813
+ return [
30814
+ Provider,
30815
+ useContext$1
30816
+ ];
30817
+ }
30660
30818
  function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
30661
30819
  let defaultContexts = [];
30662
- function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
30820
+ function $c512c27ab02ef895$export$fd42f52fd3ae11092(rootComponentName, defaultContext) {
30663
30821
  const BaseContext = /* @__PURE__ */ createContext(defaultContext);
30664
30822
  const index2 = defaultContexts.length;
30665
30823
  defaultContexts = [
@@ -30712,7 +30870,7 @@ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeD
30712
30870
  };
30713
30871
  createScope.scopeName = scopeName;
30714
30872
  return [
30715
- $c512c27ab02ef895$export$fd42f52fd3ae1109,
30873
+ $c512c27ab02ef895$export$fd42f52fd3ae11092,
30716
30874
  $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
30717
30875
  ];
30718
30876
  }
@@ -31088,7 +31246,7 @@ let $1746a345f3d73bb7$var$count = 0;
31088
31246
  function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
31089
31247
  const [id2, setId] = React$2.useState($1746a345f3d73bb7$var$useReactId());
31090
31248
  $9f79659886946c16$export$e5c5a5f917a5871c(() => {
31091
- if (!deterministicId) setId(
31249
+ setId(
31092
31250
  (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
31093
31251
  );
31094
31252
  }, [
@@ -35646,9 +35804,9 @@ var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
35646
35804
  !targetInLock && target !== document.body || // self content
35647
35805
  targetInLock && (endTarget.contains(target) || endTarget === target)
35648
35806
  );
35649
- if (isDeltaPositive && (availableScroll === 0 || !noOverscroll)) {
35807
+ if (isDeltaPositive && (availableScroll === 0 || false)) {
35650
35808
  shouldCancelScroll = true;
35651
- } else if (!isDeltaPositive && (availableScrollTop === 0 || !noOverscroll)) {
35809
+ } else if (!isDeltaPositive && (availableScrollTop === 0 || false)) {
35652
35810
  shouldCancelScroll = true;
35653
35811
  }
35654
35812
  return shouldCancelScroll;
@@ -35732,7 +35890,7 @@ function RemoveScrollSideCar(props) {
35732
35890
  return true;
35733
35891
  }
35734
35892
  var cancelingAxis = activeAxis.current || currentAxis;
35735
- return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY, true);
35893
+ return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
35736
35894
  }, []);
35737
35895
  var shouldPrevent = React$2.useCallback(function(_event) {
35738
35896
  var event = _event;
@@ -36164,6 +36322,12 @@ const $5d3850c4d0b4e6c7$export$fba2fb7cd781b7ac = /* @__PURE__ */ forwardRef((pr
36164
36322
  function $5d3850c4d0b4e6c7$var$getState(open) {
36165
36323
  return open ? "open" : "closed";
36166
36324
  }
36325
+ const $5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME = "DialogTitleWarning";
36326
+ $c512c27ab02ef895$export$fd42f52fd3ae1109($5d3850c4d0b4e6c7$var$TITLE_WARNING_NAME, {
36327
+ contentName: $5d3850c4d0b4e6c7$var$CONTENT_NAME,
36328
+ titleName: $5d3850c4d0b4e6c7$var$TITLE_NAME,
36329
+ docsSlug: "dialog"
36330
+ });
36167
36331
  const $5d3850c4d0b4e6c7$export$be92b6f5f03c0fe9 = $5d3850c4d0b4e6c7$export$3ddf2d174ce01153;
36168
36332
  const $5d3850c4d0b4e6c7$export$602eac185826482c = $5d3850c4d0b4e6c7$export$dad7c95542bacce0;
36169
36333
  const $5d3850c4d0b4e6c7$export$c6fdb837b070b4ff = $5d3850c4d0b4e6c7$export$bd1d06c79be19e17;
@@ -36660,11 +36824,11 @@ const ComposedWrappers = ({
36660
36824
  return composeWrappers(wrappers, children2);
36661
36825
  };
36662
36826
  function composeWrappers(wrappers, children2) {
36663
- return wrappers.reduce((acc, wrapper) => {
36664
- if ("provider" in wrapper) {
36665
- return /* @__PURE__ */ jsx(wrapper.provider, { value: wrapper.value, children: acc });
36827
+ return wrappers.reduce((acc, wrapper2) => {
36828
+ if ("provider" in wrapper2) {
36829
+ return /* @__PURE__ */ jsx(wrapper2.provider, { value: wrapper2.value, children: acc });
36666
36830
  }
36667
- return /* @__PURE__ */ jsx(wrapper.component, { ...wrapper.props, children: acc });
36831
+ return /* @__PURE__ */ jsx(wrapper2.component, { ...wrapper2.props, children: acc });
36668
36832
  }, children2);
36669
36833
  }
36670
36834
  const AppWrapper = ({ children: children2 }) => /* @__PURE__ */ jsx(ComposedWrappers, { wrappers: COMMON_WRAPPERS, children: children2 });
@@ -38097,7 +38261,7 @@ function one$1(state, node2, key) {
38097
38261
  return mdxEsm(state, node2);
38098
38262
  }
38099
38263
  if (node2.type === "root") {
38100
- return root$9(state, node2, key);
38264
+ return root$8(state, node2, key);
38101
38265
  }
38102
38266
  if (node2.type === "text") {
38103
38267
  return text$6(state, node2);
@@ -38163,7 +38327,7 @@ function mdxJsxElement(state, node2, key) {
38163
38327
  state.schema = parentSchema;
38164
38328
  return state.create(node2, type, props, key);
38165
38329
  }
38166
- function root$9(state, node2, key) {
38330
+ function root$8(state, node2, key) {
38167
38331
  const props = {};
38168
38332
  addChildren(props, createChildren(state, node2));
38169
38333
  return state.create(node2, state.Fragment, props, key);
@@ -43483,7 +43647,7 @@ function paragraph$1(state, node2) {
43483
43647
  state.patch(node2, result2);
43484
43648
  return state.applyData(node2, result2);
43485
43649
  }
43486
- function root$8(state, node2) {
43650
+ function root$7(state, node2) {
43487
43651
  const result2 = { type: "root", children: state.wrap(state.all(node2)) };
43488
43652
  state.patch(node2, result2);
43489
43653
  return state.applyData(node2, result2);
@@ -43647,7 +43811,7 @@ const handlers = {
43647
43811
  list: list$2,
43648
43812
  paragraph: paragraph$1,
43649
43813
  // @ts-expect-error: root is different, but hard to type.
43650
- root: root$8,
43814
+ root: root$7,
43651
43815
  strong: strong$1,
43652
43816
  table,
43653
43817
  tableCell,
@@ -60373,15 +60537,12 @@ function toText(tree, options = {}) {
60373
60537
  const children2 = "children" in tree ? tree.children : [];
60374
60538
  const block = blockOrCaption(tree);
60375
60539
  const whitespace2 = inferWhitespace(tree, {
60376
- whitespace: options.whitespace || "normal",
60377
- breakBefore: false,
60378
- breakAfter: false
60540
+ whitespace: options.whitespace || "normal"
60379
60541
  });
60380
60542
  const results = [];
60381
60543
  if (tree.type === "text" || tree.type === "comment") {
60382
60544
  results.push(
60383
60545
  ...collectText(tree, {
60384
- whitespace: whitespace2,
60385
60546
  breakBefore: true,
60386
60547
  breakAfter: true
60387
60548
  })
@@ -60970,7 +61131,7 @@ function transform(state, node2) {
60970
61131
  return element(state, unsafe);
60971
61132
  }
60972
61133
  case "root": {
60973
- return root$7(state, unsafe);
61134
+ return root$6(state, unsafe);
60974
61135
  }
60975
61136
  case "text": {
60976
61137
  return text$2(state, unsafe);
@@ -61030,7 +61191,7 @@ function element(state, unsafe) {
61030
61191
  patch(node2, unsafe);
61031
61192
  return node2;
61032
61193
  }
61033
- function root$7(state, unsafe) {
61194
+ function root$6(state, unsafe) {
61034
61195
  const content2 = (
61035
61196
  /** @type {Array<RootContent>} */
61036
61197
  children(state, unsafe.children)
@@ -61625,7 +61786,7 @@ function peekDelete() {
61625
61786
  function markdownTable(table2, options = {}) {
61626
61787
  const align = (options.align || []).concat();
61627
61788
  const stringLength = options.stringLength || defaultStringLength;
61628
- const alignments = [];
61789
+ const alignments2 = [];
61629
61790
  const cellMatrix = [];
61630
61791
  const sizeMatrix = [];
61631
61792
  const longestCellByColumn = [];
@@ -61655,19 +61816,19 @@ function markdownTable(table2, options = {}) {
61655
61816
  let columnIndex = -1;
61656
61817
  if (typeof align === "object" && "length" in align) {
61657
61818
  while (++columnIndex < mostCellsPerRow) {
61658
- alignments[columnIndex] = toAlignment(align[columnIndex]);
61819
+ alignments2[columnIndex] = toAlignment(align[columnIndex]);
61659
61820
  }
61660
61821
  } else {
61661
61822
  const code2 = toAlignment(align);
61662
61823
  while (++columnIndex < mostCellsPerRow) {
61663
- alignments[columnIndex] = code2;
61824
+ alignments2[columnIndex] = code2;
61664
61825
  }
61665
61826
  }
61666
61827
  columnIndex = -1;
61667
61828
  const row2 = [];
61668
61829
  const sizes = [];
61669
61830
  while (++columnIndex < mostCellsPerRow) {
61670
- const code2 = alignments[columnIndex];
61831
+ const code2 = alignments2[columnIndex];
61671
61832
  let before = "";
61672
61833
  let after = "";
61673
61834
  if (code2 === 99) {
@@ -61707,7 +61868,7 @@ function markdownTable(table2, options = {}) {
61707
61868
  let after = "";
61708
61869
  if (options.alignDelimiters !== false) {
61709
61870
  const size2 = longestCellByColumn[columnIndex] - (sizes2[columnIndex] || 0);
61710
- const code2 = alignments[columnIndex];
61871
+ const code2 = alignments2[columnIndex];
61711
61872
  if (code2 === 114) {
61712
61873
  before = " ".repeat(size2);
61713
61874
  } else if (code2 === 99) {
@@ -62444,7 +62605,7 @@ const phrasing = (
62444
62605
  "textDirective"
62445
62606
  ])
62446
62607
  );
62447
- function root$6(node2, _2, state, info) {
62608
+ function root$5(node2, _2, state, info) {
62448
62609
  const hasPhrasing = node2.children.some(function(d2) {
62449
62610
  return phrasing(d2);
62450
62611
  });
@@ -62513,7 +62674,7 @@ const handle = {
62513
62674
  list: list$1,
62514
62675
  listItem: listItem$1,
62515
62676
  paragraph,
62516
- root: root$6,
62677
+ root: root$5,
62517
62678
  strong,
62518
62679
  text: text$1,
62519
62680
  thematicBreak
@@ -67365,39 +67526,45 @@ function markdownPluginProps() {
67365
67526
  };
67366
67527
  return _markdownPluginProps;
67367
67528
  }
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";
67529
+ const wrapper = "_wrapper_g0yr4_1";
67530
+ const buttonsContainer = "_buttons-container_g0yr4_7";
67531
+ const buttonsContainerTransparent = "_buttons-container-transparent_g0yr4_17 _buttons-container_g0yr4_7";
67532
+ const leftInfo = "_leftInfo_g0yr4_23";
67533
+ const stats = "_stats_g0yr4_30";
67534
+ const buttons = "_buttons_g0yr4_7";
67535
+ const button$1 = "_button_g0yr4_7";
67536
+ const iconContainer = "_icon-container_g0yr4_57";
67537
+ const addition = "_addition_g0yr4_61";
67538
+ const deletion = "_deletion_g0yr4_66";
67539
+ const copyButton = "_copy-button_g0yr4_71";
67540
+ const insertButton = "_insert-button_g0yr4_72";
67541
+ const status = "_status_g0yr4_74";
67542
+ const metadataContainer = "_metadata-container_g0yr4_101";
67543
+ const attributionContainer = "_attribution-container_g0yr4_111";
67544
+ const attributionIconUnavailable = "_attribution-icon-unavailable_g0yr4_118";
67545
+ const attributionIconFound = "_attribution-icon-found_g0yr4_122";
67546
+ const codiconLoading = "_codicon-loading_g0yr4_131";
67547
+ const content = "_content_g0yr4_147";
67384
67548
  const styles$s = {
67549
+ wrapper,
67385
67550
  buttonsContainer,
67551
+ buttonsContainerTransparent,
67552
+ leftInfo,
67553
+ stats,
67386
67554
  buttons,
67387
67555
  button: button$1,
67388
67556
  iconContainer,
67557
+ addition,
67558
+ deletion,
67389
67559
  copyButton,
67390
67560
  insertButton,
67391
- attributionIcon,
67392
67561
  status,
67393
67562
  metadataContainer,
67394
67563
  attributionContainer,
67395
67564
  attributionIconUnavailable,
67396
67565
  attributionIconFound,
67397
67566
  codiconLoading,
67398
- spin: spin$1,
67399
- content,
67400
- fileNameContainer
67567
+ content
67401
67568
  };
67402
67569
  class GuardrailsStatusController {
67403
67570
  constructor(container2) {
@@ -67522,14 +67689,52 @@ function createButtons(preText, copyButtonOnSubmit, insertButtonOnSubmit) {
67522
67689
  container2.append(buttons2);
67523
67690
  return container2;
67524
67691
  }
67692
+ function getLineChanges(text2) {
67693
+ const lines = (text2 == null ? void 0 : text2.split("\n")) ?? [];
67694
+ let additions = 0;
67695
+ let deletions = 0;
67696
+ for (const line2 of lines) {
67697
+ if (line2 == null ? void 0 : line2.startsWith("+")) additions++;
67698
+ if (line2 == null ? void 0 : line2.startsWith("-")) deletions++;
67699
+ }
67700
+ return { additions, deletions };
67701
+ }
67525
67702
  function createButtonsExperimentalUI(preText, humanMessage, config, codeBlockName, copyButtonOnSubmit, insertButtonOnSubmit, smartApply, smartApplyId, smartApplyState) {
67526
- const container2 = document.createElement("div");
67527
- container2.className = styles$s.buttonsContainer;
67703
+ const wrapper2 = document.createElement("div");
67704
+ wrapper2.className = styles$s.wrapper;
67705
+ const buttonContainer1 = document.createElement("div");
67706
+ buttonContainer1.className = styles$s.buttonsContainerTransparent;
67707
+ buttonContainer1.dataset.containerType = "preview";
67708
+ const leftInfo2 = document.createElement("div");
67709
+ leftInfo2.className = styles$s.leftInfo;
67710
+ if (codeBlockName && codeBlockName !== "command") {
67711
+ const fileNameText = document.createElement("span");
67712
+ fileNameText.textContent = codeBlockName;
67713
+ leftInfo2.appendChild(fileNameText);
67714
+ }
67715
+ if ((humanMessage == null ? void 0 : humanMessage.intent) === "edit") {
67716
+ const { additions, deletions } = getLineChanges(preText);
67717
+ if (additions >= 0 || deletions >= 0) {
67718
+ const stats2 = document.createElement("span");
67719
+ stats2.innerHTML = `<span class="${styles$s.addition}">+${additions}</span>, <span class="${styles$s.deletion}">-${deletions}</span>`;
67720
+ stats2.className = styles$s.stats;
67721
+ leftInfo2.appendChild(stats2);
67722
+ }
67723
+ }
67724
+ buttonContainer1.appendChild(leftInfo2);
67725
+ wrapper2.appendChild(buttonContainer1);
67726
+ const buttonContainer2 = document.createElement("div");
67727
+ buttonContainer2.className = styles$s.buttonsContainerTransparent;
67728
+ buttonContainer2.dataset.containerType = "actions";
67528
67729
  if (!copyButtonOnSubmit) {
67529
- return container2;
67730
+ wrapper2.appendChild(buttonContainer2);
67731
+ return wrapper2;
67530
67732
  }
67531
67733
  const buttons2 = document.createElement("div");
67532
67734
  buttons2.className = styles$s.buttons;
67735
+ const metadataContainer2 = document.createElement("div");
67736
+ metadataContainer2.className = styles$s.metadataContainer;
67737
+ buttons2.appendChild(metadataContainer2);
67533
67738
  if (smartApply && smartApplyState === CodyTaskState.Applied && smartApplyId) {
67534
67739
  const acceptButton = createAcceptButton(smartApplyId, smartApply);
67535
67740
  const rejectButton = createRejectButton(smartApplyId, smartApply);
@@ -67559,8 +67764,9 @@ function createButtonsExperimentalUI(preText, humanMessage, config, codeBlockNam
67559
67764
  buttons2.append(insertButton2, saveButton);
67560
67765
  }
67561
67766
  }
67562
- container2.append(buttons2);
67563
- return container2;
67767
+ buttonContainer2.appendChild(buttons2);
67768
+ wrapper2.appendChild(buttonContainer2);
67769
+ return wrapper2;
67564
67770
  }
67565
67771
  function createInsertButton(preText, insertButtonOnSubmit) {
67566
67772
  const button2 = document.createElement("button");
@@ -67665,7 +67871,12 @@ function createApplyButton(preText, humanMessage, smartApply, smartApplyId, smar
67665
67871
  button2.prepend(iconContainer2);
67666
67872
  button2.addEventListener(
67667
67873
  "click",
67668
- () => smartApply.onSubmit(smartApplyId, preText, humanMessage == null ? void 0 : humanMessage.text, fileName)
67874
+ () => smartApply.onSubmit({
67875
+ id: smartApplyId,
67876
+ text: preText,
67877
+ instruction: humanMessage == null ? void 0 : humanMessage.text,
67878
+ fileName
67879
+ })
67669
67880
  );
67670
67881
  break;
67671
67882
  }
@@ -67677,7 +67888,12 @@ function createApplyButton(preText, humanMessage, smartApply, smartApplyId, smar
67677
67888
  button2.prepend(iconContainer2);
67678
67889
  button2.addEventListener(
67679
67890
  "click",
67680
- () => smartApply.onSubmit(smartApplyId, preText, humanMessage == null ? void 0 : humanMessage.text, fileName)
67891
+ () => smartApply.onSubmit({
67892
+ id: smartApplyId,
67893
+ text: preText,
67894
+ instruction: humanMessage == null ? void 0 : humanMessage.text,
67895
+ fileName
67896
+ })
67681
67897
  );
67682
67898
  }
67683
67899
  }
@@ -67752,9 +67968,6 @@ function createActionsDropdown(preText) {
67752
67968
  });
67753
67969
  return button2;
67754
67970
  }
67755
- function getFileName(filePath) {
67756
- return filePath.split("/").pop() || filePath;
67757
- }
67758
67971
  function getCodeBlockId(contents, fileName) {
67759
67972
  let input2 = contents.trim();
67760
67973
  if (fileName) {
@@ -67785,6 +67998,7 @@ function extractThinkContent(content2) {
67785
67998
  isThinking
67786
67999
  };
67787
68000
  }
68001
+ const prefetchedEdits = new LRUCache({ max: 100 });
67788
68002
  const ChatMessageContent = ({
67789
68003
  displayMarkdown,
67790
68004
  isMessageLoading,
@@ -67805,9 +68019,9 @@ const ChatMessageContent = ({
67805
68019
  }
67806
68020
  return {
67807
68021
  ...smartApply,
67808
- onSubmit(id2, text2, instruction, fileName) {
67809
- setSmartApplyStates((prev) => ({ ...prev, [id2]: CodyTaskState.Working }));
67810
- return smartApply.onSubmit(id2, text2, instruction, fileName);
68022
+ onSubmit(params) {
68023
+ setSmartApplyStates((prev) => ({ ...prev, [params.id]: CodyTaskState.Working }));
68024
+ return smartApply.onSubmit(params);
67811
68025
  }
67812
68026
  };
67813
68027
  }, [smartApply]);
@@ -67847,6 +68061,18 @@ const ChatMessageContent = ({
67847
68061
  if (smartApplyEnabled) {
67848
68062
  const smartApplyId = getCodeBlockId(preText, fileName);
67849
68063
  const smartApplyState = smartApplyStates[smartApplyId];
68064
+ const areWeAlreadyOutsideTheCodeBlock = !displayMarkdown.endsWith("```");
68065
+ if ((!isMessageLoading || areWeAlreadyOutsideTheCodeBlock) && // Ensure that we prefetch once per each suggested code block.
68066
+ !prefetchedEdits.has(smartApplyId)) {
68067
+ prefetchedEdits.set(smartApplyId, true);
68068
+ smartApply == null ? void 0 : smartApply.onSubmit({
68069
+ id: smartApplyId,
68070
+ text: preText,
68071
+ isPrefetch: true,
68072
+ instruction: humanMessage == null ? void 0 : humanMessage.text,
68073
+ fileName: codeBlockName
68074
+ });
68075
+ }
67850
68076
  buttons2 = createButtonsExperimentalUI(
67851
68077
  preText,
67852
68078
  humanMessage,
@@ -67865,10 +68091,8 @@ const ChatMessageContent = ({
67865
68091
  config.config.hasEditCapability ? insertButtonOnSubmit : void 0
67866
68092
  );
67867
68093
  }
67868
- const metadataContainer2 = document.createElement("div");
67869
- metadataContainer2.classList.add(styles$s.metadataContainer);
67870
- buttons2.append(metadataContainer2);
67871
- if (guardrails) {
68094
+ const metadataContainer2 = buttons2.querySelector(`.${styles$s.metadataContainer}`);
68095
+ if (metadataContainer2 && guardrails) {
67872
68096
  const container2 = document.createElement("div");
67873
68097
  container2.classList.add(styles$s.attributionContainer);
67874
68098
  metadataContainer2.append(container2);
@@ -67892,14 +68116,15 @@ const ChatMessageContent = ({
67892
68116
  });
67893
68117
  }
67894
68118
  }
67895
- if (fileName) {
67896
- const fileNameContainer2 = document.createElement("div");
67897
- fileNameContainer2.className = styles$s.fileNameContainer;
67898
- fileNameContainer2.textContent = getFileName(fileName);
67899
- fileNameContainer2.title = fileName;
67900
- metadataContainer2.append(fileNameContainer2);
67901
- }
67902
- preElement.parentNode.insertBefore(buttons2, preElement.nextSibling);
68119
+ const parent = preElement.parentNode;
68120
+ if (!parent) return;
68121
+ const previewContainer = buttons2.querySelector(`[data-container-type="preview"]`);
68122
+ const actionsContainer = buttons2.querySelector(`[data-container-type="actions"]`);
68123
+ if (!previewContainer || !actionsContainer) return;
68124
+ parent.insertBefore(previewContainer, preElement);
68125
+ parent.removeChild(preElement);
68126
+ parent.insertBefore(preElement, null);
68127
+ parent.appendChild(actionsContainer);
67903
68128
  }
67904
68129
  }
67905
68130
  }, [
@@ -67917,30 +68142,32 @@ const ChatMessageContent = ({
67917
68142
  () => extractThinkContent(displayMarkdown),
67918
68143
  [displayMarkdown]
67919
68144
  );
68145
+ const [isOpen, setIsOpen] = useState$1(true);
67920
68146
  return /* @__PURE__ */ jsxs("div", { ref: rootRef, "data-testid": "chat-message-content", children: [
67921
68147
  thinkContent.length > 0 && /* @__PURE__ */ jsxs(
67922
68148
  "details",
67923
68149
  {
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",
68150
+ open: isOpen,
68151
+ onToggle: (e2) => setIsOpen(e2.target.open),
68152
+ className: "tw-container tw-mb-4 tw-border tw-border-gray-500/20 dark:tw-border-gray-600/40 tw-rounded-lg tw-overflow-hidden tw-backdrop-blur-sm",
67926
68153
  title: "Thinking & Reasoning Space",
67927
68154
  children: [
67928
68155
  /* @__PURE__ */ jsxs(
67929
68156
  "summary",
67930
68157
  {
67931
68158
  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",
68159
+ "tw-flex tw-items-center tw-gap-2 tw-px-3 tw-py-2 tw-bg-transparent dark:tw-bg-transparent tw-cursor-pointer tw-select-none tw-transition-colors",
67933
68160
  {
67934
68161
  "tw-animate-pulse": isThinking
67935
68162
  }
67936
68163
  ),
67937
68164
  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" })
68165
+ isThinking ? /* @__PURE__ */ jsx(Loader, { size: 16, className: "tw-animate-spin tw-text-foreground/80" }) : /* @__PURE__ */ jsx(Fragment$1, { children: isOpen ? /* @__PURE__ */ jsx(Minus, { size: 16, className: "tw-text-foreground/80" }) : /* @__PURE__ */ jsx(Plus, { size: 16, className: "tw-text-foreground/80" }) }),
68166
+ /* @__PURE__ */ jsx("span", { className: "tw-font-semibold tw-text-foreground/80", children: isThinking ? "Thinking..." : "Thought Process" })
67940
68167
  ]
67941
68168
  }
67942
68169
  ),
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 })
68170
+ /* @__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", children: /* @__PURE__ */ jsx(MarkdownFromCody, { className: clsx$1(styles$s.content, className), children: thinkContent }) })
67944
68171
  ]
67945
68172
  }
67946
68173
  ),
@@ -68077,11 +68304,9 @@ const RateLimitErrorItem = ({ error: error2, userInfo, postMessage }) => {
68077
68304
  };
68078
68305
  const dotsHolder = "_dots-holder_10c80_1";
68079
68306
  const dot = "_dot_10c80_1";
68080
- const flash = "_flash_10c80_1";
68081
68307
  const styles$p = {
68082
68308
  dotsHolder,
68083
- dot,
68084
- flash
68309
+ dot
68085
68310
  };
68086
68311
  const LoadingDots = () => /* @__PURE__ */ jsxs("div", { className: styles$p.dotsHolder, role: "status", "aria-busy": true, children: [
68087
68312
  /* @__PURE__ */ jsx("div", { className: styles$p.dot }),
@@ -68629,12 +68854,8 @@ const Code = forwardRef(function Code2({ children: children2, as: Component = "c
68629
68854
  );
68630
68855
  });
68631
68856
  const codeExcerpt = "_code-excerpt_1taji_1";
68632
- const codeExcerptError = "_code-excerpt-error_1taji_1";
68633
- const codeExcerptAlert = "_code-excerpt-alert_1taji_1";
68634
68857
  const styles$n = {
68635
- codeExcerpt,
68636
- codeExcerptError,
68637
- codeExcerptAlert
68858
+ codeExcerpt
68638
68859
  };
68639
68860
  const CodeExcerpt = (props) => {
68640
68861
  const {
@@ -68718,40 +68939,28 @@ const CodeExcerpt = (props) => {
68718
68939
  );
68719
68940
  };
68720
68941
  const resultContainer = "_result-container_1qba3_12";
68721
- const header$2 = "_header_1qba3_32";
68942
+ const header$1 = "_header_1qba3_32";
68722
68943
  const headerTitle = "_header-title_1qba3_1";
68723
68944
  const result = "_result_1qba3_12";
68724
- const searchResultMatch = "_search-result-match_1qba3_57";
68725
68945
  const horizontalDividerBetween = "_horizontal-divider-between_1qba3_67";
68726
68946
  const focusableBlock = "_focusable-block_1qba3_73";
68727
68947
  const clickable = "_clickable_1qba3_79";
68728
- const dividerBetween = "_divider-between_1qba3_86";
68729
- const dividerVertical = "_divider-vertical_1qba3_96";
68730
- const divider = "_divider_1qba3_86";
68731
- const title = "_title_1qba3_108";
68732
68948
  const titleInner = "_title-inner_1qba3_116";
68733
68949
  const toggleMatchesButton = "_toggle-matches-button_1qba3_120";
68734
68950
  const toggleMatchesButtonExpanded = "_toggle-matches-button--expanded_1qba3_1";
68735
68951
  const toggleMatchesButtonText = "_toggle-matches-button-text_1qba3_1";
68736
- const addToContextLabel = "_addToContextLabel_1qba3_143";
68737
68952
  const styles$m = {
68738
68953
  resultContainer,
68739
- header: header$2,
68954
+ header: header$1,
68740
68955
  headerTitle,
68741
68956
  result,
68742
- searchResultMatch,
68743
68957
  horizontalDividerBetween,
68744
68958
  focusableBlock,
68745
68959
  clickable,
68746
- dividerBetween,
68747
- dividerVertical,
68748
- divider,
68749
- title,
68750
68960
  titleInner,
68751
68961
  toggleMatchesButton,
68752
68962
  toggleMatchesButtonExpanded,
68753
- toggleMatchesButtonText,
68754
- addToContextLabel
68963
+ toggleMatchesButtonText
68755
68964
  };
68756
68965
  const chunk = "_chunk_qvvv3_1";
68757
68966
  const styles$l = {
@@ -69911,18 +70120,16 @@ const SearchFiltersModal = ({
69911
70120
  ] });
69912
70121
  };
69913
70122
  const filtersSidebar = "_filters-sidebar_1qmjt_2";
69914
- const root$5 = "_root_1qmjt_12";
70123
+ const root$4 = "_root_1qmjt_12";
69915
70124
  const resultsContainer = "_results-container_1qmjt_18";
69916
- const filtersSidebarHidden = "_filters-sidebar-hidden_1qmjt_21";
69917
70125
  const filtersSidebarToggle = "_filters-sidebar-toggle_1qmjt_28";
69918
70126
  const filtersModalTrigger = "_filters-modal-trigger_1qmjt_34";
69919
70127
  const searchResultsHeader = "_search-results-header_1qmjt_44";
69920
70128
  const searchResultsHeaderLabel = "_search-results-header-label_1qmjt_53";
69921
70129
  const styles$i = {
69922
70130
  filtersSidebar,
69923
- root: root$5,
70131
+ root: root$4,
69924
70132
  resultsContainer,
69925
- filtersSidebarHidden,
69926
70133
  filtersSidebarToggle,
69927
70134
  filtersModalTrigger,
69928
70135
  searchResultsHeader,
@@ -70501,7 +70708,6 @@ function commandRowValue(row2) {
70501
70708
  return row2.actionType === "prompt" ? `prompt-${row2.id}` : `command-${row2.key}`;
70502
70709
  }
70503
70710
  const item = "_item_1lclp_2";
70504
- const itemIndicator = "_item--indicator_1lclp_13";
70505
70711
  const promptAvatar = "_prompt--avatar_1lclp_18";
70506
70712
  const promptDescription = "_prompt--description_1lclp_18";
70507
70713
  const promptIcon = "_prompt--icon_1lclp_18";
@@ -70511,7 +70717,6 @@ const promptTitle = "_prompt--title_1lclp_1";
70511
70717
  const promptName = "_prompt--name_1lclp_1";
70512
70718
  const styles$f = {
70513
70719
  item,
70514
- itemIndicator,
70515
70720
  promptAvatar,
70516
70721
  promptDescription,
70517
70722
  promptIcon,
@@ -71306,7 +71511,7 @@ Defaulting to \`null\`.`;
71306
71511
  }
71307
71512
  var Root$2 = Progress;
71308
71513
  var Indicator = ProgressIndicator;
71309
- const root$4 = "_root_oxlxy_2";
71514
+ const root$3 = "_root_oxlxy_2";
71310
71515
  const iconsHeader = "_icons-header_oxlxy_11";
71311
71516
  const heading = "_heading_oxlxy_17";
71312
71517
  const descriptionText = "_description-text_oxlxy_24";
@@ -71319,7 +71524,7 @@ const loaderIndicator = "_loader-indicator_oxlxy_1";
71319
71524
  const error = "_error_oxlxy_73";
71320
71525
  const close = "_close_oxlxy_83";
71321
71526
  const styles$c = {
71322
- root: root$4,
71527
+ root: root$3,
71323
71528
  iconsHeader,
71324
71529
  heading,
71325
71530
  descriptionText,
@@ -71589,14 +71794,14 @@ function useLinkOpener() {
71589
71794
  }
71590
71795
  const container$2 = "_container_1eiqs_6";
71591
71796
  const editor$1 = "_editor_1eiqs_17";
71592
- const toolbar$1 = "_toolbar_1eiqs_23";
71593
- const focused$1 = "_focused_1eiqs_28";
71797
+ const toolbar = "_toolbar_1eiqs_23";
71798
+ const focused = "_focused_1eiqs_28";
71594
71799
  const editorContentEditable$1 = "_editor-content-editable_1eiqs_30";
71595
71800
  const styles$a = {
71596
71801
  container: container$2,
71597
71802
  editor: editor$1,
71598
- toolbar: toolbar$1,
71599
- focused: focused$1,
71803
+ toolbar,
71804
+ focused,
71600
71805
  editorContentEditable: editorContentEditable$1
71601
71806
  };
71602
71807
  const CodyLogo = ({ size: size2, ...props }) => /* @__PURE__ */ jsxs(
@@ -71838,7 +72043,6 @@ function chatModelIconComponent(model) {
71838
72043
  return CodyLogoBW;
71839
72044
  }
71840
72045
  const button = "_button_1wufw_5";
71841
- const buttonIconEndChevron = "_button--icon-end-chevron_1wufw_37";
71842
72046
  const buttonSmallIcon = "_button--small-icon_1wufw_41";
71843
72047
  const buttonPrimary = "_button--primary_1wufw_47";
71844
72048
  const buttonNoIconStart = "_button--no-icon-start_1wufw_51";
@@ -71846,7 +72050,6 @@ const buttonNoIconEnd = "_button--no-icon-end_1wufw_55";
71846
72050
  const buttonSecondary = "_button--secondary_1wufw_60";
71847
72051
  const toolbarStyles = {
71848
72052
  button,
71849
- buttonIconEndChevron,
71850
72053
  buttonSmallIcon,
71851
72054
  buttonPrimary,
71852
72055
  buttonNoIconStart,
@@ -71974,7 +72177,6 @@ const ToolbarPopoverItem = ({
71974
72177
  const chatModelPopover = "_chat-model-popover_k71kd_1";
71975
72178
  const modelTitleWithIcon = "_model-title-with-icon_k71kd_5";
71976
72179
  const modelName = "_model-name_k71kd_17";
71977
- const modelProvider = "_model-provider_k71kd_21";
71978
72180
  const disabled = "_disabled_k71kd_27";
71979
72181
  const modelIcon = "_model-icon_k71kd_31";
71980
72182
  const rightIcon = "_right-icon_k71kd_35";
@@ -71983,7 +72185,6 @@ const styles$9 = {
71983
72185
  chatModelPopover,
71984
72186
  modelTitleWithIcon,
71985
72187
  modelName,
71986
- modelProvider,
71987
72188
  disabled,
71988
72189
  modelIcon,
71989
72190
  rightIcon,
@@ -74780,27 +74981,22 @@ const HumanMessageEditor = ({
74780
74981
  [onGapClick]
74781
74982
  );
74782
74983
  const onMentionClick = useCallback(() => {
74783
- if (!editorRef.current) {
74784
- throw new Error("No editorRef");
74785
- }
74786
- if (editorRef.current.getSerializedValue().text.trim().endsWith("@")) {
74787
- editorRef.current.setFocus(true, { moveCursorToEnd: true });
74788
- } else {
74789
- editorRef.current.appendText("@");
74984
+ if (editorRef.current) {
74985
+ editorRef.current.openAtMentionMenu();
74986
+ const value = editorRef.current.getSerializedValue();
74987
+ telemetryRecorder.recordEvent("cody.humanMessageEditor.toolbar.mention", "click", {
74988
+ metadata: {
74989
+ isFirstMessage: isFirstMessage ? 1 : 0,
74990
+ isEdit: isSent ? 1 : 0,
74991
+ messageLength: value.text.length,
74992
+ contextItems: value.contextItems.length
74993
+ },
74994
+ billingMetadata: {
74995
+ product: "cody",
74996
+ category: "billable"
74997
+ }
74998
+ });
74790
74999
  }
74791
- const value = editorRef.current.getSerializedValue();
74792
- telemetryRecorder.recordEvent("cody.humanMessageEditor.toolbar.mention", "click", {
74793
- metadata: {
74794
- isFirstMessage: isFirstMessage ? 1 : 0,
74795
- isEdit: isSent ? 1 : 0,
74796
- messageLength: value.text.length,
74797
- contextItems: value.contextItems.length
74798
- },
74799
- billingMetadata: {
74800
- product: "cody",
74801
- category: "billable"
74802
- }
74803
- });
74804
75000
  }, [telemetryRecorder.recordEvent, isFirstMessage, isSent]);
74805
75001
  const extensionAPI = useExtensionAPI();
74806
75002
  useClientActionListener(
@@ -75763,25 +75959,13 @@ const PrettyPrintedContextItem = ({ path: path2, range: range2, repoShortName: r
75763
75959
  };
75764
75960
  const contextItem = "_context-item_h7t04_1";
75765
75961
  const contextItemMetadata = "_context-item-metadata_h7t04_5";
75766
- const contextItemEditButton = "_context-item-edit-button_h7t04_11";
75767
- const contextItemEditButtonIcon = "_context-item-edit-button-icon_h7t04_18";
75768
- const contextSuggestedActions = "_context-suggested-actions_h7t04_23";
75769
- const root$3 = "_root_h7t04_29";
75770
75962
  const linkContainer = "_link-container_h7t04_35";
75771
- const header$1 = "_header_h7t04_40";
75772
75963
  const contextItemLink = "_context-item-link_h7t04_46";
75773
- const codeBlock = "_code-block_h7t04_67";
75774
75964
  const styles$4 = {
75775
75965
  contextItem,
75776
75966
  contextItemMetadata,
75777
- contextItemEditButton,
75778
- contextItemEditButtonIcon,
75779
- contextSuggestedActions,
75780
- root: root$3,
75781
75967
  linkContainer,
75782
- header: header$1,
75783
- contextItemLink,
75784
- codeBlock
75968
+ contextItemLink
75785
75969
  };
75786
75970
  const __ContextCellStorybookContext = createContext(null);
75787
75971
  const ContextCell = memo$1(
@@ -76503,10 +76687,6 @@ function reevaluateSearchWithSelectedFilters({
76503
76687
  selectedFilters
76504
76688
  });
76505
76689
  }
76506
- const chatDisabled = "_chat-disabled_rc7no_1";
76507
- const styles$3 = {
76508
- chatDisabled
76509
- };
76510
76690
  const localStorageKey = "chat.welcome-message-dismissed";
76511
76691
  const WelcomeMessage = ({
76512
76692
  setView,
@@ -76628,6 +76808,10 @@ const ScrollDown = (props) => {
76628
76808
  }
76629
76809
  ) }) : null;
76630
76810
  };
76811
+ const chatDisabled = "_chat-disabled_rc7no_1";
76812
+ const styles$3 = {
76813
+ chatDisabled
76814
+ };
76631
76815
  const Chat = ({
76632
76816
  messageInProgress,
76633
76817
  transcript,
@@ -76675,27 +76859,35 @@ const Chat = ({
76675
76859
  if (!showIDESnippetActions) {
76676
76860
  return;
76677
76861
  }
76862
+ function onSubmit({
76863
+ id: id2,
76864
+ text: text2,
76865
+ instruction,
76866
+ fileName,
76867
+ isPrefetch
76868
+ }) {
76869
+ const command = isPrefetch ? "smartApplyPrefetch" : "smartApplySubmit";
76870
+ const spanManager = new SpanManager("cody-webview");
76871
+ const span = spanManager.startSpan(command, {
76872
+ attributes: {
76873
+ sampled: true,
76874
+ "smartApply.id": id2
76875
+ }
76876
+ });
76877
+ const traceparent = getTraceparentFromSpanContext(span.spanContext());
76878
+ vscodeAPI.postMessage({
76879
+ command,
76880
+ id: id2,
76881
+ instruction: instruction == null ? void 0 : instruction.toString(),
76882
+ // remove the additional /n added by the text area at the end of the text
76883
+ code: text2.replace(/\n$/, ""),
76884
+ fileName,
76885
+ traceparent
76886
+ });
76887
+ span.end();
76888
+ }
76678
76889
  return {
76679
- onSubmit: (id2, text2, instruction, fileName) => {
76680
- const spanManager = new SpanManager("cody-webview");
76681
- const span = spanManager.startSpan("smartApplySubmit", {
76682
- attributes: {
76683
- sampled: true,
76684
- "smartApply.id": id2
76685
- }
76686
- });
76687
- const traceparent = getTraceparentFromSpanContext(span.spanContext());
76688
- vscodeAPI.postMessage({
76689
- command: "smartApplySubmit",
76690
- id: id2,
76691
- instruction: instruction == null ? void 0 : instruction.toString(),
76692
- // remove the additional /n added by the text area at the end of the text
76693
- code: text2.replace(/\n$/, ""),
76694
- fileName,
76695
- traceparent
76696
- });
76697
- span.end();
76698
- },
76890
+ onSubmit,
76699
76891
  onAccept: (id2) => {
76700
76892
  vscodeAPI.postMessage({
76701
76893
  command: "smartApplyAccept",
@@ -77288,7 +77480,6 @@ async function createAgentClient({
77288
77480
  accessToken,
77289
77481
  createAgentWorker,
77290
77482
  customHeaders,
77291
- repository,
77292
77483
  telemetryClientName,
77293
77484
  debug = true,
77294
77485
  trace: trace2 = false
@@ -77319,9 +77510,9 @@ async function createAgentClient({
77319
77510
  const serverInfo = await rpc.sendRequest("initialize", {
77320
77511
  name: "web",
77321
77512
  version: "0.0.1",
77322
- // Empty root URI leads to openctx configuration resolution failure, any non-empty
77323
- // mock value (Cody Web doesn't really use any workspace related features)
77324
- workspaceRootUri: `repo:${repository ?? ""}`,
77513
+ // This is not used in cody web. Instead we trigger `workspaceFolder/didChange` to notify
77514
+ // the agent about the current workspace.
77515
+ workspaceRootUri: "",
77325
77516
  capabilities: {
77326
77517
  edit: "none",
77327
77518
  completions: "none",
@@ -77357,118 +77548,107 @@ async function createAgentClient({
77357
77548
  };
77358
77549
  }
77359
77550
  const GLOBAL_MESSAGE_TYPES = ["rpc/response"];
77551
+ const GLOBAL_AGENT_SHUTDOWN_TIMER = 10 * 60 * 1e3;
77552
+ let globalAgentRefCounter = 0;
77553
+ let globalAgentShutdownTimer;
77554
+ let globalAgent;
77555
+ function retainGlobalAgent() {
77556
+ window.clearTimeout(globalAgentShutdownTimer);
77557
+ globalAgentRefCounter += 1;
77558
+ }
77559
+ function releaseGlobalAgent() {
77560
+ if (globalAgentRefCounter > 0) {
77561
+ globalAgentRefCounter -= 1;
77562
+ }
77563
+ if (globalAgentRefCounter === 0) {
77564
+ globalAgentShutdownTimer = window.setTimeout(() => {
77565
+ if (globalAgentRefCounter === 0) {
77566
+ globalAgent == null ? void 0 : globalAgent.then((agent2) => agent2.client.dispose());
77567
+ globalAgent = void 0;
77568
+ }
77569
+ }, GLOBAL_AGENT_SHUTDOWN_TIMER);
77570
+ }
77571
+ }
77360
77572
  function useCodyWebAgent(input2) {
77361
- const {
77362
- serverEndpoint,
77363
- accessToken,
77364
- telemetryClientName,
77365
- customHeaders,
77366
- repository,
77367
- createAgentWorker
77368
- } = input2;
77369
- const activeWebviewPanelIDRef = useRef$1("");
77370
- const [client, setClient] = useState$1(null);
77371
- useEffectOnce(() => {
77372
- createAgentClient({
77573
+ const [agent2, setAgent] = useState$1(null);
77574
+ if (!globalAgent) {
77575
+ globalAgent = createCodyAgent(input2);
77576
+ }
77577
+ useEffect$2(() => {
77578
+ globalAgent == null ? void 0 : globalAgent.then(setAgent, setAgent);
77579
+ retainGlobalAgent();
77580
+ return releaseGlobalAgent;
77581
+ }, []);
77582
+ return agent2;
77583
+ }
77584
+ async function createCodyAgent(input2) {
77585
+ const { serverEndpoint, accessToken, telemetryClientName, customHeaders, createAgentWorker } = input2;
77586
+ const activeWebviewPanelIDRef = { current: "" };
77587
+ try {
77588
+ const client = await createAgentClient({
77373
77589
  customHeaders,
77374
77590
  telemetryClientName,
77375
- createAgentWorker,
77376
77591
  serverEndpoint,
77377
77592
  accessToken: accessToken ?? "",
77378
- repository
77379
- }).then(setClient).catch((error2) => {
77380
- console.error("Cody Web Agent creation failed", error2);
77381
- setClient(() => error2);
77382
- });
77383
- }, [accessToken, serverEndpoint, createAgentWorker, customHeaders, telemetryClientName]);
77384
- const createNewChat = useCallback(async (agent2) => {
77385
- if (!agent2 || isErrorLike(agent2)) {
77386
- return;
77387
- }
77388
- const { panelId, chatId } = await agent2.rpc.sendRequest("chat/web/new", null);
77389
- activeWebviewPanelIDRef.current = panelId;
77390
- await agent2.rpc.sendRequest("webview/receiveMessage", {
77391
- id: activeWebviewPanelIDRef.current,
77392
- message: { chatID: chatId, command: "restoreHistory" }
77593
+ createAgentWorker
77393
77594
  });
77394
- }, []);
77395
- const isInitRef = useRef$1(false);
77396
- const vscodeAPI = useVSCodeAPI({ activeWebviewPanelIDRef, createNewChat, client });
77397
- useEffect$2(() => {
77398
- if (isInitRef.current || !client || isErrorLike(client)) {
77399
- return;
77400
- }
77401
- void createNewChat(client);
77402
- isInitRef.current = true;
77403
- }, [client, createNewChat]);
77404
- return { client, vscodeAPI };
77595
+ const createNewChat = async () => {
77596
+ const { panelId, chatId } = await client.rpc.sendRequest("chat/web/new", null);
77597
+ activeWebviewPanelIDRef.current = panelId;
77598
+ await client.rpc.sendRequest("webview/receiveMessage", {
77599
+ id: activeWebviewPanelIDRef.current,
77600
+ message: { chatID: chatId, command: "restoreHistory" }
77601
+ });
77602
+ };
77603
+ const vscodeAPI = createVSCodeAPI({ activeWebviewPanelIDRef, createNewChat, client });
77604
+ setVSCodeWrapper(vscodeAPI);
77605
+ return { vscodeAPI, createNewChat, client };
77606
+ } catch (error2) {
77607
+ console.error("Cody Web Agent creation failed", error2);
77608
+ throw error2;
77609
+ }
77405
77610
  }
77406
- function useVSCodeAPI(input2) {
77611
+ function createVSCodeAPI(input2) {
77407
77612
  const { client, activeWebviewPanelIDRef, createNewChat } = input2;
77408
- const onMessageCallbacksRef = useRef$1([]);
77409
- return useMemo$1(() => {
77410
- if (!client) {
77411
- return null;
77412
- }
77413
- if (!isErrorLike(client)) {
77414
- client.rpc.onNotification(
77415
- "webview/postMessage",
77416
- ({ id: id2, message: message2 }) => {
77417
- if (activeWebviewPanelIDRef.current === id2 || GLOBAL_MESSAGE_TYPES.includes(message2.type)) {
77418
- for (const callback of onMessageCallbacksRef.current) {
77419
- callback(hydrateAfterPostMessage(message2, (uri) => URI.from(uri)));
77420
- }
77421
- }
77613
+ const onMessageCallbacks = [];
77614
+ client.rpc.onNotification(
77615
+ "webview/postMessage",
77616
+ ({ id: id2, message: message2 }) => {
77617
+ if (activeWebviewPanelIDRef.current === id2 || GLOBAL_MESSAGE_TYPES.includes(message2.type)) {
77618
+ for (const callback of onMessageCallbacks) {
77619
+ callback(hydrateAfterPostMessage(message2, (uri) => URI.from(uri)));
77422
77620
  }
77423
- );
77621
+ }
77424
77622
  }
77425
- const vscodeAPI = {
77426
- postMessage: (message2) => {
77427
- if (!isErrorLike(client)) {
77428
- if (message2.command === "command" && message2.id === "cody.chat.new") {
77429
- void createNewChat(client);
77430
- return;
77431
- }
77432
- void client.rpc.sendRequest("webview/receiveMessage", {
77433
- id: activeWebviewPanelIDRef.current,
77434
- message: forceHydration(message2)
77435
- });
77436
- }
77437
- },
77438
- onMessage: (callback) => {
77439
- if (!isErrorLike(client)) {
77440
- onMessageCallbacksRef.current.push(callback);
77441
- return () => {
77442
- const index2 = onMessageCallbacksRef.current.indexOf(callback);
77443
- if (index2 >= 0) {
77444
- onMessageCallbacksRef.current.splice(index2, 1);
77445
- }
77446
- };
77447
- }
77448
- return () => {
77449
- };
77450
- },
77451
- getState: () => {
77452
- throw new Error("not implemented");
77453
- },
77454
- setState: () => {
77455
- throw new Error("not implemented");
77623
+ );
77624
+ const vscodeAPI = {
77625
+ postMessage: (message2) => {
77626
+ if (message2.command === "command" && message2.id === "cody.chat.new") {
77627
+ void createNewChat();
77628
+ return;
77456
77629
  }
77457
- };
77458
- setVSCodeWrapper(vscodeAPI);
77459
- return vscodeAPI;
77460
- }, [client, createNewChat, activeWebviewPanelIDRef]);
77461
- }
77462
- function useEffectOnce(effect, deps) {
77463
- const isInitRef = useRef$1(false);
77464
- useEffect$2(() => {
77465
- if (isInitRef.current) {
77466
- return;
77630
+ void client.rpc.sendRequest("webview/receiveMessage", {
77631
+ id: activeWebviewPanelIDRef.current,
77632
+ message: forceHydration(message2)
77633
+ });
77634
+ },
77635
+ onMessage: (callback) => {
77636
+ onMessageCallbacks.push(callback);
77637
+ return () => {
77638
+ const index2 = onMessageCallbacks.indexOf(callback);
77639
+ if (index2 >= 0) {
77640
+ onMessageCallbacks.splice(index2, 1);
77641
+ }
77642
+ };
77643
+ },
77644
+ getState: () => {
77645
+ throw new Error("not implemented");
77646
+ },
77647
+ setState: () => {
77648
+ throw new Error("not implemented");
77467
77649
  }
77468
- const result2 = effect();
77469
- isInitRef.current = true;
77470
- return result2;
77471
- }, deps);
77650
+ };
77651
+ return vscodeAPI;
77472
77652
  }
77473
77653
  const root$2 = "_root_maej5_2";
77474
77654
  const container$1 = "_container_maej5_10";
@@ -77485,7 +77665,6 @@ const chatSubmitButton = "_chat-submit-button_1yqw7_1";
77485
77665
  const message = "_message_1yqw7_48";
77486
77666
  const messageContent = "_message-content_1yqw7_1";
77487
77667
  const line = "_line_1yqw7_61";
77488
- const shineLines = "_shine-lines_1yqw7_1";
77489
77668
  const lineCircle = "_line-circle_1yqw7_1";
77490
77669
  const lineCircleSmall = "_line-circle-small_1yqw7_1";
77491
77670
  const lineSmall = "_line-small_1yqw7_1";
@@ -77502,7 +77681,6 @@ const styles$1 = {
77502
77681
  message,
77503
77682
  messageContent,
77504
77683
  line,
77505
- shineLines,
77506
77684
  lineCircle,
77507
77685
  lineCircleSmall,
77508
77686
  lineSmall,
@@ -77585,39 +77763,35 @@ setDisplayPathEnvInfo({
77585
77763
  workspaceFolders: []
77586
77764
  });
77587
77765
  const CodyWebChat = ({
77588
- serverEndpoint,
77589
- accessToken,
77590
- createAgentWorker,
77766
+ agentConfig,
77591
77767
  initialContext,
77592
- telemetryClientName,
77593
- customHeaders,
77594
77768
  className,
77595
77769
  onExternalApiReady,
77596
77770
  controller,
77597
77771
  viewType
77598
77772
  }) => {
77599
- const { client, vscodeAPI } = useCodyWebAgent({
77600
- serverEndpoint,
77601
- accessToken,
77602
- createAgentWorker,
77603
- initialContext,
77604
- telemetryClientName,
77605
- customHeaders,
77606
- repository: initialContext == null ? void 0 : initialContext.repository.name
77607
- });
77608
- if (isErrorLike(client)) {
77773
+ const agent2 = useCodyWebAgent(agentConfig);
77774
+ useEffect$2(() => {
77775
+ if (agent2 && !isErrorLike(agent2)) {
77776
+ agent2.client.rpc.sendNotification("workspaceFolder/didChange", {
77777
+ uris: (initialContext == null ? void 0 : initialContext.repository.name) ? [`repo:${initialContext.repository.name}`] : []
77778
+ });
77779
+ agent2.createNewChat();
77780
+ }
77781
+ }, [initialContext == null ? void 0 : initialContext.repository, agent2]);
77782
+ if (isErrorLike(agent2)) {
77609
77783
  return /* @__PURE__ */ jsxs("p", { children: [
77610
77784
  "Cody Web client agent error: ",
77611
- client.message
77785
+ agent2.message
77612
77786
  ] });
77613
77787
  }
77614
- if (client === null || vscodeAPI === null) {
77788
+ if (agent2 === null) {
77615
77789
  return /* @__PURE__ */ jsx(ChatSkeleton, { className: classNames(className, styles$2.root) });
77616
77790
  }
77617
77791
  return /* @__PURE__ */ jsx(AppWrapper, { children: /* @__PURE__ */ jsx("div", { className: classNames(className, styles$2.root), children: /* @__PURE__ */ jsx(
77618
77792
  CodyWebPanel,
77619
77793
  {
77620
- vscodeAPI,
77794
+ vscodeAPI: agent2.vscodeAPI,
77621
77795
  initialContext,
77622
77796
  className: styles$2.container,
77623
77797
  onExternalApiReady,
@@ -77817,15 +77991,11 @@ const CodyWebPanel = (props) => {
77817
77991
  const root = "_root_n2nil_6";
77818
77992
  const container = "_container_n2nil_14";
77819
77993
  const editor = "_editor_n2nil_28";
77820
- const toolbar = "_toolbar_n2nil_34";
77821
- const focused = "_focused_n2nil_39";
77822
77994
  const editorContentEditable = "_editor-content-editable_n2nil_41";
77823
77995
  const styles = {
77824
77996
  root,
77825
77997
  container,
77826
77998
  editor,
77827
- toolbar,
77828
- focused,
77829
77999
  editorContentEditable
77830
78000
  };
77831
78001
  setDisplayPathEnvInfo({
@@ -77833,37 +78003,27 @@ setDisplayPathEnvInfo({
77833
78003
  workspaceFolders: []
77834
78004
  });
77835
78005
  const CodyPromptTemplate = ({
77836
- serverEndpoint,
77837
- accessToken,
77838
- createAgentWorker,
77839
- telemetryClientName,
77840
- customHeaders,
78006
+ agentConfig,
77841
78007
  className,
77842
78008
  disabled: disabled2,
77843
78009
  initialEditorState,
77844
78010
  placeholder: placeholder2,
77845
78011
  onEditorApiReady
77846
78012
  }) => {
77847
- const { client, vscodeAPI } = useCodyWebAgent({
77848
- serverEndpoint,
77849
- accessToken,
77850
- createAgentWorker,
77851
- telemetryClientName,
77852
- customHeaders
77853
- });
77854
- if (isErrorLike(client)) {
78013
+ const agent2 = useCodyWebAgent(agentConfig);
78014
+ if (isErrorLike(agent2)) {
77855
78015
  return /* @__PURE__ */ jsxs("p", { children: [
77856
78016
  "Cody Web client agent error: ",
77857
- client.message
78017
+ agent2.message
77858
78018
  ] });
77859
78019
  }
77860
- if (client === null || vscodeAPI === null) {
78020
+ if (agent2 === null) {
77861
78021
  return /* @__PURE__ */ jsx(PromptTemplateSkeleton, { className: classNames(className, styles.root) });
77862
78022
  }
77863
78023
  return /* @__PURE__ */ jsx(AppWrapper, { children: /* @__PURE__ */ jsx("div", { className: classNames(className, styles.root), children: /* @__PURE__ */ jsx(
77864
78024
  CodyPromptTemplatePanel,
77865
78025
  {
77866
- vscodeAPI,
78026
+ vscodeAPI: agent2.vscodeAPI,
77867
78027
  className: styles.container,
77868
78028
  disabled: disabled2,
77869
78029
  initialEditorState,
@@ -77986,6 +78146,6 @@ export {
77986
78146
  ChatSkeleton,
77987
78147
  CodyPromptTemplate,
77988
78148
  CodyWebChat,
77989
- cj as deserialize,
77990
- ci as serialize
78149
+ ck as deserialize,
78150
+ cj as serialize
77991
78151
  };