@sourcegraph/cody-web 0.32.1 → 0.32.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
4
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
5
- import { i as getDefaultExportFromCjs, L as Ls, k as ke$1, j as ks, F as Fi$1, _ as _s, m as ds, n as bs, o as ii$1, q as qe$1, y as ys, x as xi$1, K as K$2, J as J$2, r as R$3, u as ws, B as B$2, v as g$5, z as h$4, A as _i, S as Ss, E as Br, G as ln, H as bi$1, I as vn, M as xn, N as Nn, O as mn, Q as li$1, V as 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";
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 cryptoJsExports, bG as isError, bH as CodyTaskState, bI as LRUCache, 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-CIaiKx3C.mjs";
6
+ import { ck, cj } from "./vscode-shim-CIaiKx3C.mjs";
7
7
  import * as React$2 from "react";
8
8
  import React__default, { createContext, useContext, useMemo as useMemo$1, useLayoutEffect as useLayoutEffect$1, useEffect as useEffect$2, forwardRef, useState as useState$1, useCallback, useRef as useRef$1, Suspense, createElement, memo as memo$1, useImperativeHandle, Fragment as Fragment$2, Children, isValidElement, cloneElement, useReducer } from "react";
9
9
  var classnames = { exports: {} };
@@ -19669,15 +19669,15 @@ class ViewTreeUpdater {
19669
19669
  recreateWrapper(next, node2, outerDeco, innerDeco, view, pos) {
19670
19670
  if (next.dirty || node2.isAtom || !next.children.length || !next.node.content.eq(node2.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco))
19671
19671
  return null;
19672
- let wrapper2 = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos);
19673
- if (wrapper2.contentDOM) {
19674
- wrapper2.children = next.children;
19672
+ let wrapper = NodeViewDesc.create(this.top, node2, outerDeco, innerDeco, view, pos);
19673
+ if (wrapper.contentDOM) {
19674
+ wrapper.children = next.children;
19675
19675
  next.children = [];
19676
- for (let ch2 of wrapper2.children)
19677
- ch2.parent = wrapper2;
19676
+ for (let ch2 of wrapper.children)
19677
+ ch2.parent = wrapper;
19678
19678
  }
19679
19679
  next.destroy();
19680
- return wrapper2;
19680
+ return wrapper;
19681
19681
  }
19682
19682
  // Insert the node as a newly created node desc.
19683
19683
  addNode(node2, outerDeco, innerDeco, view, pos) {
@@ -20430,10 +20430,10 @@ function serializeForClipboard(view, slice2) {
20430
20430
  let firstChild = wrap2.firstChild, needsWrap, wrappers = 0;
20431
20431
  while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
20432
20432
  for (let i = needsWrap.length - 1; i >= 0; i--) {
20433
- let wrapper2 = doc2.createElement(needsWrap[i]);
20433
+ let wrapper = doc2.createElement(needsWrap[i]);
20434
20434
  while (wrap2.firstChild)
20435
- wrapper2.appendChild(wrap2.firstChild);
20436
- wrap2.appendChild(wrapper2);
20435
+ wrapper.appendChild(wrap2.firstChild);
20436
+ wrap2.appendChild(wrapper);
20437
20437
  wrappers++;
20438
20438
  }
20439
20439
  firstChild = wrap2.firstChild;
@@ -36824,11 +36824,11 @@ const ComposedWrappers = ({
36824
36824
  return composeWrappers(wrappers, children2);
36825
36825
  };
36826
36826
  function composeWrappers(wrappers, children2) {
36827
- return wrappers.reduce((acc, wrapper2) => {
36828
- if ("provider" in wrapper2) {
36829
- return /* @__PURE__ */ jsx(wrapper2.provider, { value: wrapper2.value, children: acc });
36827
+ return wrappers.reduce((acc, wrapper) => {
36828
+ if ("provider" in wrapper) {
36829
+ return /* @__PURE__ */ jsx(wrapper.provider, { value: wrapper.value, children: acc });
36830
36830
  }
36831
- return /* @__PURE__ */ jsx(wrapper2.component, { ...wrapper2.props, children: acc });
36831
+ return /* @__PURE__ */ jsx(wrapper.component, { ...wrapper.props, children: acc });
36832
36832
  }, children2);
36833
36833
  }
36834
36834
  const AppWrapper = ({ children: children2 }) => /* @__PURE__ */ jsx(ComposedWrappers, { wrappers: COMMON_WRAPPERS, children: children2 });
@@ -67526,32 +67526,31 @@ function markdownPluginProps() {
67526
67526
  };
67527
67527
  return _markdownPluginProps;
67528
67528
  }
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";
67529
+ const buttonsContainer = "_buttons-container_hscxh_7";
67530
+ const buttonsContainerTransparent = "_buttons-container-transparent_hscxh_17 _buttons-container_hscxh_7";
67531
+ const stats = "_stats_hscxh_30";
67532
+ const buttons = "_buttons_hscxh_7";
67533
+ const actionButtons = "_actionButtons_hscxh_41";
67534
+ const button$1 = "_button_hscxh_7";
67535
+ const iconContainer = "_icon-container_hscxh_65";
67536
+ const addition = "_addition_hscxh_69";
67537
+ const deletion = "_deletion_hscxh_74";
67538
+ const copyButton = "_copy-button_hscxh_79";
67539
+ const insertButton = "_insert-button_hscxh_80";
67540
+ const status = "_status_hscxh_82";
67541
+ const metadataContainer = "_metadata-container_hscxh_109";
67542
+ const fileNameContainer = "_file-name-container_hscxh_262";
67543
+ const attributionContainer = "_attribution-container_hscxh_126";
67544
+ const attributionIconUnavailable = "_attribution-icon-unavailable_hscxh_133";
67545
+ const attributionIconFound = "_attribution-icon-found_hscxh_137";
67546
+ const codiconLoading = "_codicon-loading_hscxh_146";
67547
+ const content = "_content_hscxh_162";
67548
67548
  const styles$s = {
67549
- wrapper,
67550
67549
  buttonsContainer,
67551
67550
  buttonsContainerTransparent,
67552
- leftInfo,
67553
67551
  stats,
67554
67552
  buttons,
67553
+ actionButtons,
67555
67554
  button: button$1,
67556
67555
  iconContainer,
67557
67556
  addition,
@@ -67560,12 +67559,27 @@ const styles$s = {
67560
67559
  insertButton,
67561
67560
  status,
67562
67561
  metadataContainer,
67562
+ fileNameContainer,
67563
67563
  attributionContainer,
67564
67564
  attributionIconUnavailable,
67565
67565
  attributionIconFound,
67566
67566
  codiconLoading,
67567
67567
  content
67568
67568
  };
67569
+ const spin = "_spin_56lwz_7";
67570
+ const styles$r = {
67571
+ spin
67572
+ };
67573
+ const SaveCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z"/></svg>';
67574
+ const CopyCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M4 4l1-1h5.414L14 6.586V14l-1 1H5l-1-1V4zm9 3l-3-3H5v10h8V7z"/><path fillRule="evenodd" clipRule="evenodd" d="M3 1L2 2v10l1 1V2h6.414l-1-1H3z"/></svg>';
67575
+ const InsertCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M14 1L15 2V6L14 7L6 7L5 6L5 2L6 1L14 1ZM14 2L6 2L6 6L14 6L14 2Z"/><path fillRule="evenodd" clipRule="evenodd" d="M14 9L15 10V14L14 15L6 15L5 14L5 10L6 9L14 9ZM14 10L6 10L6 14L14 14L14 10Z"/><path d="M1 6.39268L2.61414 8.00682L1 9.62096L1.69352 10.3141L4 8.00682L1.69352 5.69995L1 6.39268Z"/></svg>';
67576
+ const CheckCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path d="M3,1L2,2v10l1,1V2h6.4l-1-1H3z"/><path d="M7.8,14.7c-0.2-0.2-0.3-0.5-0.4-0.7H5V4h5l3,3v0.1c0.3,0.1,0.7,0.2,1,0.3V6.6L10.4,3H5L4,4v10l1,1h3C8,14.9,7.9,14.8,7.8,14.7z"/><path fileRule="evenodd" clipRule="evenodd" d="M9.8,8.7c1.8-1.2,4.3-0.8,5.6,1.1s0.8,4.3-1.1,5.6c0,0,0,0,0,0c-1.8,1.2-4.3,0.7-5.5-1.1C7.5,12.4,8,9.9,9.8,8.7z M11.9,13.7l2.4-3.2l-0.8-0.6l-2.1,2.8l-1.3-1l-0.6,0.8l1.7,1.4L11.9,13.7L11.9,13.7z"/></svg>';
67577
+ const SparkleIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M5.39804 10.8069C5.57428 10.9312 5.78476 10.9977 6.00043 10.9973C6.21633 10.9975 6.42686 10.93 6.60243 10.8043C6.77993 10.6739 6.91464 10.4936 6.98943 10.2863L7.43643 8.91335C7.55086 8.56906 7.74391 8.25615 8.00028 7.99943C8.25665 7.74272 8.56929 7.54924 8.91343 7.43435L10.3044 6.98335C10.4564 6.92899 10.5936 6.84019 10.7055 6.7239C10.8174 6.60762 10.9008 6.467 10.9492 6.31308C10.9977 6.15916 11.0098 5.99611 10.9847 5.83672C10.9596 5.67732 10.8979 5.52591 10.8044 5.39435C10.6703 5.20842 10.4794 5.07118 10.2604 5.00335L8.88543 4.55635C8.54091 4.44212 8.22777 4.24915 7.97087 3.99277C7.71396 3.73638 7.52035 3.42363 7.40543 3.07935L6.95343 1.69135C6.88113 1.48904 6.74761 1.31428 6.57143 1.19135C6.43877 1.09762 6.28607 1.03614 6.12548 1.01179C5.96489 0.987448 5.80083 1.00091 5.64636 1.05111C5.49188 1.1013 5.35125 1.18685 5.23564 1.30095C5.12004 1.41505 5.03265 1.55454 4.98043 1.70835L4.52343 3.10835C4.40884 3.44317 4.21967 3.74758 3.97022 3.9986C3.72076 4.24962 3.41753 4.44067 3.08343 4.55735L1.69243 5.00535C1.54065 5.05974 1.40352 5.14852 1.29177 5.26474C1.18001 5.38095 1.09666 5.52145 1.04824 5.67523C0.999819 5.82902 0.987639 5.99192 1.01265 6.1512C1.03767 6.31048 1.0992 6.46181 1.19243 6.59335C1.32027 6.7728 1.50105 6.90777 1.70943 6.97935L3.08343 7.42435C3.52354 7.57083 3.90999 7.84518 4.19343 8.21235C4.35585 8.42298 4.4813 8.65968 4.56443 8.91235L5.01643 10.3033C5.08846 10.5066 5.22179 10.6826 5.39804 10.8069ZM5.48343 3.39235L6.01043 2.01535L6.44943 3.39235C6.61312 3.8855 6.88991 4.33351 7.25767 4.70058C7.62544 5.06765 8.07397 5.34359 8.56743 5.50635L9.97343 6.03535L8.59143 6.48335C8.09866 6.64764 7.65095 6.92451 7.28382 7.29198C6.9167 7.65945 6.64026 8.10742 6.47643 8.60035L5.95343 9.97835L5.50443 8.59935C5.34335 8.10608 5.06943 7.65718 4.70443 7.28835C4.3356 6.92031 3.88653 6.64272 3.39243 6.47735L2.01443 5.95535L3.40043 5.50535C3.88672 5.33672 4.32775 5.05855 4.68943 4.69235C5.04901 4.32464 5.32049 3.88016 5.48343 3.39235ZM11.5353 14.8494C11.6713 14.9456 11.8337 14.9973 12.0003 14.9974C12.1654 14.9974 12.3264 14.9464 12.4613 14.8514C12.6008 14.7529 12.7058 14.6129 12.7613 14.4514L13.0093 13.6894C13.0625 13.5309 13.1515 13.3869 13.2693 13.2684C13.3867 13.1498 13.5307 13.0611 13.6893 13.0094L14.4613 12.7574C14.619 12.7029 14.7557 12.6004 14.8523 12.4644C14.9257 12.3614 14.9736 12.2424 14.9921 12.1173C15.0106 11.9922 14.9992 11.8645 14.9588 11.7447C14.9184 11.6249 14.8501 11.5163 14.7597 11.428C14.6692 11.3396 14.5591 11.2739 14.4383 11.2364L13.6743 10.9874C13.5162 10.9348 13.3724 10.8462 13.2544 10.7285C13.1364 10.6109 13.0473 10.4674 12.9943 10.3094L12.7423 9.53638C12.6886 9.37853 12.586 9.24191 12.4493 9.14638C12.3473 9.07343 12.2295 9.02549 12.1056 9.00642C11.9816 8.98736 11.8549 8.99772 11.7357 9.03665C11.6164 9.07558 11.508 9.142 11.4192 9.23054C11.3304 9.31909 11.2636 9.42727 11.2243 9.54638L10.9773 10.3084C10.925 10.466 10.8375 10.6097 10.7213 10.7284C10.6066 10.8449 10.4667 10.9335 10.3123 10.9874L9.53931 11.2394C9.38025 11.2933 9.2422 11.3959 9.1447 11.5326C9.04721 11.6694 8.99522 11.8333 8.99611 12.0013C8.99699 12.1692 9.0507 12.3326 9.14963 12.4683C9.24856 12.604 9.38769 12.7051 9.54731 12.7574L10.3103 13.0044C10.4692 13.0578 10.6136 13.1471 10.7323 13.2654C10.8505 13.3836 10.939 13.5283 10.9903 13.6874L11.2433 14.4614C11.2981 14.6178 11.4001 14.7534 11.5353 14.8494ZM10.6223 12.0564L10.4433 11.9974L10.6273 11.9334C10.9291 11.8284 11.2027 11.6556 11.4273 11.4284C11.6537 11.1994 11.8248 10.9216 11.9273 10.6164L11.9853 10.4384L12.0443 10.6194C12.1463 10.9261 12.3185 11.2047 12.5471 11.4332C12.7757 11.6617 13.0545 11.8336 13.3613 11.9354L13.5563 11.9984L13.3763 12.0574C13.0689 12.1596 12.7898 12.3322 12.5611 12.5616C12.3324 12.791 12.1606 13.0707 12.0593 13.3784L12.0003 13.5594L11.9423 13.3784C11.8409 13.0702 11.6687 12.7901 11.4394 12.5605C11.2102 12.3309 10.9303 12.1583 10.6223 12.0564Z"/></svg>';
67578
+ const EllipsisIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/></svg>';
67579
+ const SyncSpinIcon = `<svg class="${styles$r.spin}" role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.006 8.267L.78 9.5 0 8.73l2.09-2.07.76.01 2.09 2.12-.76.76-1.167-1.18a5 5 0 0 0 9.4 1.983l.813.597a6 6 0 0 1-11.22-2.683zm10.99-.466L11.76 6.55l-.76.76 2.09 2.11.76.01 2.09-2.07-.75-.76-1.194 1.18a6 6 0 0 0-11.11-2.92l.81.594a5 5 0 0 1 9.3 2.346z"/></svg>`;
67580
+ const TickIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.431 3.323l-8.47 10-.79-.036-3.35-4.77.818-.574 2.978 4.24 8.051-9.506.764.646z"/></svg>';
67581
+ const CloseIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z"/></svg>';
67582
+ const RefreshIcon = '<i class="codicon codicon-refresh tw-align-middle"></i>';
67569
67583
  class GuardrailsStatusController {
67570
67584
  constructor(container2) {
67571
67585
  __publicField(this, "statusSpinning", `<i class="codicon codicon-loading ${styles$s.codiconLoading}"></i>`);
@@ -67632,26 +67646,48 @@ class GuardrailsStatusController {
67632
67646
  return limitHit ? `${tooltip} or more...` : `${tooltip}.`;
67633
67647
  }
67634
67648
  }
67635
- const spin = "_spin_56lwz_7";
67636
- const styles$r = {
67637
- spin
67638
- };
67639
- const SaveCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M9.5 1.1l3.4 3.5.1.4v2h-1V6H8V2H3v11h4v1H2.5l-.5-.5v-12l.5-.5h6.7l.3.1zM9 2v3h2.9L9 2zm4 14h-1v-3H9v-1h3V9h1v3h3v1h-3v3z"/></svg>';
67640
- const CopyCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M4 4l1-1h5.414L14 6.586V14l-1 1H5l-1-1V4zm9 3l-3-3H5v10h8V7z"/><path fillRule="evenodd" clipRule="evenodd" d="M3 1L2 2v10l1 1V2h6.414l-1-1H3z"/></svg>';
67641
- const InsertCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path fillRule="evenodd" clipRule="evenodd" d="M14 1L15 2V6L14 7L6 7L5 6L5 2L6 1L14 1ZM14 2L6 2L6 6L14 6L14 2Z"/><path fillRule="evenodd" clipRule="evenodd" d="M14 9L15 10V14L14 15L6 15L5 14L5 10L6 9L14 9ZM14 10L6 10L6 14L14 14L14 10Z"/><path d="M1 6.39268L2.61414 8.00682L1 9.62096L1.69352 10.3141L4 8.00682L1.69352 5.69995L1 6.39268Z"/></svg>';
67642
- const CheckCodeBlockIcon = '<svg role="img" height=16 width=16 viewBox="0 0 16 16" fill="currentColor"><path d="M3,1L2,2v10l1,1V2h6.4l-1-1H3z"/><path d="M7.8,14.7c-0.2-0.2-0.3-0.5-0.4-0.7H5V4h5l3,3v0.1c0.3,0.1,0.7,0.2,1,0.3V6.6L10.4,3H5L4,4v10l1,1h3C8,14.9,7.9,14.8,7.8,14.7z"/><path fileRule="evenodd" clipRule="evenodd" d="M9.8,8.7c1.8-1.2,4.3-0.8,5.6,1.1s0.8,4.3-1.1,5.6c0,0,0,0,0,0c-1.8,1.2-4.3,0.7-5.5-1.1C7.5,12.4,8,9.9,9.8,8.7z M11.9,13.7l2.4-3.2l-0.8-0.6l-2.1,2.8l-1.3-1l-0.6,0.8l1.7,1.4L11.9,13.7L11.9,13.7z"/></svg>';
67643
- const SparkleIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M5.39804 10.8069C5.57428 10.9312 5.78476 10.9977 6.00043 10.9973C6.21633 10.9975 6.42686 10.93 6.60243 10.8043C6.77993 10.6739 6.91464 10.4936 6.98943 10.2863L7.43643 8.91335C7.55086 8.56906 7.74391 8.25615 8.00028 7.99943C8.25665 7.74272 8.56929 7.54924 8.91343 7.43435L10.3044 6.98335C10.4564 6.92899 10.5936 6.84019 10.7055 6.7239C10.8174 6.60762 10.9008 6.467 10.9492 6.31308C10.9977 6.15916 11.0098 5.99611 10.9847 5.83672C10.9596 5.67732 10.8979 5.52591 10.8044 5.39435C10.6703 5.20842 10.4794 5.07118 10.2604 5.00335L8.88543 4.55635C8.54091 4.44212 8.22777 4.24915 7.97087 3.99277C7.71396 3.73638 7.52035 3.42363 7.40543 3.07935L6.95343 1.69135C6.88113 1.48904 6.74761 1.31428 6.57143 1.19135C6.43877 1.09762 6.28607 1.03614 6.12548 1.01179C5.96489 0.987448 5.80083 1.00091 5.64636 1.05111C5.49188 1.1013 5.35125 1.18685 5.23564 1.30095C5.12004 1.41505 5.03265 1.55454 4.98043 1.70835L4.52343 3.10835C4.40884 3.44317 4.21967 3.74758 3.97022 3.9986C3.72076 4.24962 3.41753 4.44067 3.08343 4.55735L1.69243 5.00535C1.54065 5.05974 1.40352 5.14852 1.29177 5.26474C1.18001 5.38095 1.09666 5.52145 1.04824 5.67523C0.999819 5.82902 0.987639 5.99192 1.01265 6.1512C1.03767 6.31048 1.0992 6.46181 1.19243 6.59335C1.32027 6.7728 1.50105 6.90777 1.70943 6.97935L3.08343 7.42435C3.52354 7.57083 3.90999 7.84518 4.19343 8.21235C4.35585 8.42298 4.4813 8.65968 4.56443 8.91235L5.01643 10.3033C5.08846 10.5066 5.22179 10.6826 5.39804 10.8069ZM5.48343 3.39235L6.01043 2.01535L6.44943 3.39235C6.61312 3.8855 6.88991 4.33351 7.25767 4.70058C7.62544 5.06765 8.07397 5.34359 8.56743 5.50635L9.97343 6.03535L8.59143 6.48335C8.09866 6.64764 7.65095 6.92451 7.28382 7.29198C6.9167 7.65945 6.64026 8.10742 6.47643 8.60035L5.95343 9.97835L5.50443 8.59935C5.34335 8.10608 5.06943 7.65718 4.70443 7.28835C4.3356 6.92031 3.88653 6.64272 3.39243 6.47735L2.01443 5.95535L3.40043 5.50535C3.88672 5.33672 4.32775 5.05855 4.68943 4.69235C5.04901 4.32464 5.32049 3.88016 5.48343 3.39235ZM11.5353 14.8494C11.6713 14.9456 11.8337 14.9973 12.0003 14.9974C12.1654 14.9974 12.3264 14.9464 12.4613 14.8514C12.6008 14.7529 12.7058 14.6129 12.7613 14.4514L13.0093 13.6894C13.0625 13.5309 13.1515 13.3869 13.2693 13.2684C13.3867 13.1498 13.5307 13.0611 13.6893 13.0094L14.4613 12.7574C14.619 12.7029 14.7557 12.6004 14.8523 12.4644C14.9257 12.3614 14.9736 12.2424 14.9921 12.1173C15.0106 11.9922 14.9992 11.8645 14.9588 11.7447C14.9184 11.6249 14.8501 11.5163 14.7597 11.428C14.6692 11.3396 14.5591 11.2739 14.4383 11.2364L13.6743 10.9874C13.5162 10.9348 13.3724 10.8462 13.2544 10.7285C13.1364 10.6109 13.0473 10.4674 12.9943 10.3094L12.7423 9.53638C12.6886 9.37853 12.586 9.24191 12.4493 9.14638C12.3473 9.07343 12.2295 9.02549 12.1056 9.00642C11.9816 8.98736 11.8549 8.99772 11.7357 9.03665C11.6164 9.07558 11.508 9.142 11.4192 9.23054C11.3304 9.31909 11.2636 9.42727 11.2243 9.54638L10.9773 10.3084C10.925 10.466 10.8375 10.6097 10.7213 10.7284C10.6066 10.8449 10.4667 10.9335 10.3123 10.9874L9.53931 11.2394C9.38025 11.2933 9.2422 11.3959 9.1447 11.5326C9.04721 11.6694 8.99522 11.8333 8.99611 12.0013C8.99699 12.1692 9.0507 12.3326 9.14963 12.4683C9.24856 12.604 9.38769 12.7051 9.54731 12.7574L10.3103 13.0044C10.4692 13.0578 10.6136 13.1471 10.7323 13.2654C10.8505 13.3836 10.939 13.5283 10.9903 13.6874L11.2433 14.4614C11.2981 14.6178 11.4001 14.7534 11.5353 14.8494ZM10.6223 12.0564L10.4433 11.9974L10.6273 11.9334C10.9291 11.8284 11.2027 11.6556 11.4273 11.4284C11.6537 11.1994 11.8248 10.9216 11.9273 10.6164L11.9853 10.4384L12.0443 10.6194C12.1463 10.9261 12.3185 11.2047 12.5471 11.4332C12.7757 11.6617 13.0545 11.8336 13.3613 11.9354L13.5563 11.9984L13.3763 12.0574C13.0689 12.1596 12.7898 12.3322 12.5611 12.5616C12.3324 12.791 12.1606 13.0707 12.0593 13.3784L12.0003 13.5594L11.9423 13.3784C11.8409 13.0702 11.6687 12.7901 11.4394 12.5605C11.2102 12.3309 10.9303 12.1583 10.6223 12.0564Z"/></svg>';
67644
- const EllipsisIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M4 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm5 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"/></svg>';
67645
- const SyncSpinIcon = `<svg class="${styles$r.spin}" role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.006 8.267L.78 9.5 0 8.73l2.09-2.07.76.01 2.09 2.12-.76.76-1.167-1.18a5 5 0 0 0 9.4 1.983l.813.597a6 6 0 0 1-11.22-2.683zm10.99-.466L11.76 6.55l-.76.76 2.09 2.11.76.01 2.09-2.07-.75-.76-1.194 1.18a6 6 0 0 0-11.11-2.92l.81.594a5 5 0 0 1 9.3 2.346z"/></svg>`;
67646
- const TickIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M14.431 3.323l-8.47 10-.79-.036-3.35-4.77.818-.574 2.978 4.24 8.051-9.506.764.646z"/></svg>';
67647
- const CloseIcon = '<svg role="img" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 8.707l3.646 3.647.708-.707L8.707 8l3.647-3.646-.707-.708L8 7.293 4.354 3.646l-.707.708L7.293 8l-3.646 3.646.707.708L8 8.707z"/></svg>';
67648
- const RefreshIcon = '<i class="codicon codicon-refresh tw-align-middle"></i>';
67649
+ function getFileName(filePath) {
67650
+ return filePath.split("/").pop() || filePath;
67651
+ }
67652
+ function getCodeBlockId(contents, fileName) {
67653
+ let input2 = contents.trim();
67654
+ if (fileName) {
67655
+ input2 = `${fileName}:${input2}`;
67656
+ }
67657
+ return cryptoJsExports.SHA256(input2).toString();
67658
+ }
67659
+ const lengthOfThinkTag = "<think>".length;
67660
+ function extractThinkContent(content2) {
67661
+ const thinkRegex = /^<think>([\s\S]*?)<\/think>/;
67662
+ const match = content2.match(thinkRegex);
67663
+ const startsWithThink = content2.startsWith("<think>");
67664
+ let thinkContent = "";
67665
+ let displayContent = content2;
67666
+ let isThinking = false;
67667
+ if (match) {
67668
+ thinkContent = match[1].trim();
67669
+ displayContent = content2.slice(match[0].length);
67670
+ isThinking = displayContent.trim() === "";
67671
+ } else if (startsWithThink) {
67672
+ thinkContent = content2.slice(lengthOfThinkTag);
67673
+ displayContent = "";
67674
+ isThinking = true;
67675
+ }
67676
+ return {
67677
+ displayContent,
67678
+ thinkContent,
67679
+ isThinking
67680
+ };
67681
+ }
67649
67682
  function createButtons(preText, copyButtonOnSubmit, insertButtonOnSubmit) {
67650
- const container2 = document.createElement("div");
67651
- container2.className = styles$s.buttonsContainer;
67652
67683
  if (!copyButtonOnSubmit) {
67653
- return container2;
67684
+ const emptyContainer = document.createElement("div");
67685
+ emptyContainer.dataset.containerType = "buttons";
67686
+ return emptyContainer;
67654
67687
  }
67688
+ const buttonContainer = document.createElement("div");
67689
+ buttonContainer.className = styles$s.buttonsContainerTransparent;
67690
+ buttonContainer.dataset.containerType = "actions";
67655
67691
  const buttons2 = document.createElement("div");
67656
67692
  buttons2.className = styles$s.buttons;
67657
67693
  const codeBlockActions = {
@@ -67686,7 +67722,10 @@ function createButtons(preText, copyButtonOnSubmit, insertButtonOnSubmit) {
67686
67722
  )
67687
67723
  );
67688
67724
  }
67689
- container2.append(buttons2);
67725
+ buttonContainer.appendChild(buttons2);
67726
+ const container2 = document.createElement("div");
67727
+ container2.dataset.containerType = "buttons";
67728
+ container2.appendChild(buttonContainer);
67690
67729
  return container2;
67691
67730
  }
67692
67731
  function getLineChanges(text2) {
@@ -67699,49 +67738,83 @@ function getLineChanges(text2) {
67699
67738
  }
67700
67739
  return { additions, deletions };
67701
67740
  }
67702
- function createButtonsExperimentalUI(preText, humanMessage, config, codeBlockName, copyButtonOnSubmit, insertButtonOnSubmit, smartApply, smartApplyId, smartApplyState) {
67703
- const wrapper2 = document.createElement("div");
67704
- wrapper2.className = styles$s.wrapper;
67741
+ function createButtonsExperimentalUI(preText, humanMessage, config, codeBlockName, copyButtonOnSubmit, insertButtonOnSubmit, smartApply, smartApplyId, smartApplyState, guardrails, isMessageLoading) {
67705
67742
  const buttonContainer1 = document.createElement("div");
67706
67743
  buttonContainer1.className = styles$s.buttonsContainerTransparent;
67707
67744
  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
- }
67745
+ let hasPreviewContent = false;
67746
+ let previewElement = null;
67747
+ const leftInfo = document.createElement("div");
67715
67748
  if ((humanMessage == null ? void 0 : humanMessage.intent) === "edit") {
67716
67749
  const { additions, deletions } = getLineChanges(preText);
67717
67750
  if (additions >= 0 || deletions >= 0) {
67718
67751
  const stats2 = document.createElement("span");
67719
67752
  stats2.innerHTML = `<span class="${styles$s.addition}">+${additions}</span>, <span class="${styles$s.deletion}">-${deletions}</span>`;
67720
67753
  stats2.className = styles$s.stats;
67721
- leftInfo2.appendChild(stats2);
67754
+ leftInfo.appendChild(stats2);
67755
+ previewElement = buttonContainer1;
67756
+ hasPreviewContent = true;
67722
67757
  }
67723
67758
  }
67724
- buttonContainer1.appendChild(leftInfo2);
67725
- wrapper2.appendChild(buttonContainer1);
67759
+ buttonContainer1.appendChild(leftInfo);
67726
67760
  const buttonContainer2 = document.createElement("div");
67727
67761
  buttonContainer2.className = styles$s.buttonsContainerTransparent;
67728
67762
  buttonContainer2.dataset.containerType = "actions";
67729
67763
  if (!copyButtonOnSubmit) {
67730
- wrapper2.appendChild(buttonContainer2);
67731
- return wrapper2;
67764
+ const buttonsContainer22 = document.createElement("div");
67765
+ buttonsContainer22.dataset.containerType = "buttons";
67766
+ buttonsContainer22.append(buttonContainer1, buttonContainer2);
67767
+ if (hasPreviewContent && previewElement) {
67768
+ buttonsContainer22.prepend(buttonContainer1);
67769
+ }
67770
+ return buttonsContainer22;
67732
67771
  }
67733
67772
  const buttons2 = document.createElement("div");
67734
67773
  buttons2.className = styles$s.buttons;
67774
+ const actionButtons2 = document.createElement("div");
67775
+ actionButtons2.className = styles$s.actionButtons;
67776
+ buttons2.appendChild(actionButtons2);
67735
67777
  const metadataContainer2 = document.createElement("div");
67736
67778
  metadataContainer2.className = styles$s.metadataContainer;
67779
+ if (codeBlockName && codeBlockName !== "command") {
67780
+ const fileNameContainer2 = document.createElement("div");
67781
+ fileNameContainer2.className = styles$s.fileNameContainer;
67782
+ fileNameContainer2.textContent = getFileName(codeBlockName);
67783
+ fileNameContainer2.title = codeBlockName;
67784
+ metadataContainer2.append(fileNameContainer2);
67785
+ }
67786
+ if (guardrails) {
67787
+ const container2 = document.createElement("div");
67788
+ container2.classList.add(styles$s.attributionContainer);
67789
+ metadataContainer2.append(container2);
67790
+ if (!isMessageLoading) {
67791
+ const g2 = new GuardrailsStatusController(container2);
67792
+ g2.setPending();
67793
+ guardrails.searchAttribution(preText).then((attribution) => {
67794
+ if (isError(attribution)) {
67795
+ g2.setUnavailable(attribution);
67796
+ } else if (attribution.repositories.length === 0) {
67797
+ g2.setSuccess();
67798
+ } else {
67799
+ g2.setFailure(
67800
+ attribution.repositories.map((r2) => r2.name),
67801
+ attribution.limitHit
67802
+ );
67803
+ }
67804
+ }).catch((error2) => {
67805
+ g2.setUnavailable(error2);
67806
+ return;
67807
+ });
67808
+ }
67809
+ }
67737
67810
  buttons2.appendChild(metadataContainer2);
67738
67811
  if (smartApply && smartApplyState === CodyTaskState.Applied && smartApplyId) {
67739
67812
  const acceptButton = createAcceptButton(smartApplyId, smartApply);
67740
67813
  const rejectButton = createRejectButton(smartApplyId, smartApply);
67741
- buttons2.append(acceptButton, rejectButton);
67814
+ actionButtons2.append(acceptButton, rejectButton);
67742
67815
  } else {
67743
67816
  const copyButton2 = createCopyButton(preText, copyButtonOnSubmit);
67744
- buttons2.append(copyButton2);
67817
+ actionButtons2.append(copyButton2);
67745
67818
  if (smartApply && smartApplyId) {
67746
67819
  const isExecutable = codeBlockName === "command";
67747
67820
  const smartButton = isExecutable && config.clientCapabilities.isVSCode ? createExecuteButton(preText) : createApplyButton(
@@ -67753,20 +67826,22 @@ function createButtonsExperimentalUI(preText, humanMessage, config, codeBlockNam
67753
67826
  codeBlockName
67754
67827
  );
67755
67828
  smartButton.title = isExecutable ? "Execute in Terminal" : "Apply in Editor";
67756
- buttons2.append(smartButton);
67829
+ actionButtons2.append(smartButton);
67757
67830
  }
67758
67831
  if (config.clientCapabilities.isVSCode) {
67759
67832
  const actionsDropdown = createActionsDropdown(preText);
67760
- buttons2.append(actionsDropdown);
67833
+ actionButtons2.append(actionsDropdown);
67761
67834
  } else {
67762
67835
  const insertButton2 = createInsertButton(preText, insertButtonOnSubmit);
67763
67836
  const saveButton = createSaveButton(preText, insertButtonOnSubmit);
67764
- buttons2.append(insertButton2, saveButton);
67837
+ actionButtons2.append(insertButton2, saveButton);
67765
67838
  }
67766
67839
  }
67767
67840
  buttonContainer2.appendChild(buttons2);
67768
- wrapper2.appendChild(buttonContainer2);
67769
- return wrapper2;
67841
+ const buttonsContainer2 = document.createElement("div");
67842
+ buttonsContainer2.dataset.containerType = "buttons";
67843
+ buttonsContainer2.append(buttonContainer1, buttonContainer2);
67844
+ return buttonsContainer2;
67770
67845
  }
67771
67846
  function createInsertButton(preText, insertButtonOnSubmit) {
67772
67847
  const button2 = document.createElement("button");
@@ -67968,36 +68043,6 @@ function createActionsDropdown(preText) {
67968
68043
  });
67969
68044
  return button2;
67970
68045
  }
67971
- function getCodeBlockId(contents, fileName) {
67972
- let input2 = contents.trim();
67973
- if (fileName) {
67974
- input2 = `${fileName}:${input2}`;
67975
- }
67976
- return cryptoJsExports.SHA256(input2).toString();
67977
- }
67978
- const lengthOfThinkTag = "<think>".length;
67979
- function extractThinkContent(content2) {
67980
- const thinkRegex = /^<think>([\s\S]*?)<\/think>/;
67981
- const match = content2.match(thinkRegex);
67982
- const startsWithThink = content2.startsWith("<think>");
67983
- let thinkContent = "";
67984
- let displayContent = content2;
67985
- let isThinking = false;
67986
- if (match) {
67987
- thinkContent = match[1].trim();
67988
- displayContent = content2.slice(match[0].length);
67989
- isThinking = displayContent.trim() === "";
67990
- } else if (startsWithThink) {
67991
- thinkContent = content2.slice(lengthOfThinkTag);
67992
- displayContent = "";
67993
- isThinking = true;
67994
- }
67995
- return {
67996
- displayContent,
67997
- thinkContent,
67998
- isThinking
67999
- };
68000
- }
68001
68046
  const prefetchedEdits = new LRUCache({ max: 100 });
68002
68047
  const ChatMessageContent = ({
68003
68048
  displayMarkdown,
@@ -68082,7 +68127,9 @@ const ChatMessageContent = ({
68082
68127
  config.config.hasEditCapability ? insertButtonOnSubmit : void 0,
68083
68128
  smartApplyInterceptor,
68084
68129
  smartApplyId,
68085
- smartApplyState
68130
+ smartApplyState,
68131
+ guardrails,
68132
+ isMessageLoading
68086
68133
  );
68087
68134
  } else {
68088
68135
  buttons2 = createButtons(
@@ -68091,40 +68138,17 @@ const ChatMessageContent = ({
68091
68138
  config.config.hasEditCapability ? insertButtonOnSubmit : void 0
68092
68139
  );
68093
68140
  }
68094
- const metadataContainer2 = buttons2.querySelector(`.${styles$s.metadataContainer}`);
68095
- if (metadataContainer2 && guardrails) {
68096
- const container2 = document.createElement("div");
68097
- container2.classList.add(styles$s.attributionContainer);
68098
- metadataContainer2.append(container2);
68099
- if (!isMessageLoading) {
68100
- const g2 = new GuardrailsStatusController(container2);
68101
- g2.setPending();
68102
- guardrails.searchAttribution(preText).then((attribution) => {
68103
- if (isError(attribution)) {
68104
- g2.setUnavailable(attribution);
68105
- } else if (attribution.repositories.length === 0) {
68106
- g2.setSuccess();
68107
- } else {
68108
- g2.setFailure(
68109
- attribution.repositories.map((r2) => r2.name),
68110
- attribution.limitHit
68111
- );
68112
- }
68113
- }).catch((error2) => {
68114
- g2.setUnavailable(error2);
68115
- return;
68116
- });
68117
- }
68118
- }
68119
68141
  const parent = preElement.parentNode;
68120
68142
  if (!parent) return;
68121
68143
  const previewContainer = buttons2.querySelector(`[data-container-type="preview"]`);
68122
68144
  const actionsContainer = buttons2.querySelector(`[data-container-type="actions"]`);
68123
68145
  if (!previewContainer || !actionsContainer) return;
68124
68146
  parent.insertBefore(previewContainer, preElement);
68125
- parent.removeChild(preElement);
68126
- parent.insertBefore(preElement, null);
68127
- parent.appendChild(actionsContainer);
68147
+ if (preElement.nextSibling) {
68148
+ parent.insertBefore(actionsContainer, preElement.nextSibling);
68149
+ } else {
68150
+ parent.appendChild(actionsContainer);
68151
+ }
68128
68152
  }
68129
68153
  }
68130
68154
  }, [
@@ -78011,6 +78035,11 @@ const CodyPromptTemplate = ({
78011
78035
  onEditorApiReady
78012
78036
  }) => {
78013
78037
  const agent2 = useCodyWebAgent(agentConfig);
78038
+ useEffect$2(() => {
78039
+ if (agent2 && !isErrorLike(agent2)) {
78040
+ agent2.createNewChat();
78041
+ }
78042
+ }, [agent2]);
78014
78043
  if (isErrorLike(agent2)) {
78015
78044
  return /* @__PURE__ */ jsxs("p", { children: [
78016
78045
  "Cody Web client agent error: ",
@@ -1 +1 @@
1
- {"version":3,"file":"CodyPromptTemplate.d.ts","sourceRoot":"","sources":["../../../lib/components/CodyPromptTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,iBAAiB,EAMzB,MAAM,OAAO,CAAA;AAEd,OAAO,EASH,KAAK,2BAA2B,EAGnC,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAIH,KAAK,kBAAkB,EAC1B,MAAM,4BAA4B,CAAA;AAMnC,OAAO,EAAE,KAAK,oBAAoB,EAAmB,MAAM,kBAAkB,CAAA;AAG7E,OAAO,6BAA6B,CAAA;AAYpC,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,oBAAoB,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,kBAAkB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAA;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AACD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,CAgCzE,CAAA"}
1
+ {"version":3,"file":"CodyPromptTemplate.d.ts","sourceRoot":"","sources":["../../../lib/components/CodyPromptTemplate.tsx"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,iBAAiB,EAMzB,MAAM,OAAO,CAAA;AAEd,OAAO,EASH,KAAK,2BAA2B,EAGnC,MAAM,0BAA0B,CAAA;AAIjC,OAAO,EAIH,KAAK,kBAAkB,EAC1B,MAAM,4BAA4B,CAAA;AAMnC,OAAO,EAAE,KAAK,oBAAoB,EAAmB,MAAM,kBAAkB,CAAA;AAG7E,OAAO,6BAA6B,CAAA;AAYpC,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,oBAAoB,CAAA;IACjC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,kBAAkB,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAA;IAC5D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAA;CACvD;AACD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,CAyCzE,CAAA"}