@invergent/agent-chat-react 2.13.3 → 2.14.0

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.cjs CHANGED
@@ -22,7 +22,7 @@ var diff = require('diff');
22
22
  var AnsiImport = require('ansi-to-react');
23
23
  var cmdk = require('cmdk');
24
24
  var nanoid = require('nanoid');
25
- var tokenlens = require('tokenlens');
25
+ require('tokenlens');
26
26
  require('pdfjs-dist/web/pdf_viewer.css');
27
27
  var dateFns = require('date-fns');
28
28
 
@@ -1040,39 +1040,6 @@ var ConversationScrollButton = ({
1040
1040
  );
1041
1041
  };
1042
1042
 
1043
- // src/components/ui/button-group.tsx
1044
- init_utils();
1045
- var buttonGroupVariants = classVarianceAuthority.cva(
1046
- "group/button-group flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 *:data-[slot=input]:px-4 has-[>[data-variant=outline]]:*:data-[slot=input-group]:border-border has-[>[data-variant=outline]]:*:data-[slot=input-group]:px-2.5 has-[>[data-variant=outline]]:*:data-[slot=select-trigger]:border-border has-[>[data-variant=outline]]:*:[[role=combobox]]:px-2.5 has-[>[data-variant=outline]]:[&>[data-slot=input-group]:has(:focus-visible)]:border-ring has-[>[data-variant=outline]]:[&>[data-slot=select-trigger]:focus-visible]:border-ring has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-none [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[>[data-variant=outline]]:[&>input]:border-border has-[>[data-variant=outline]]:[&>input:focus-visible]:border-ring",
1047
- {
1048
- variants: {
1049
- orientation: {
1050
- horizontal: "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-none!",
1051
- vertical: "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-none!"
1052
- }
1053
- },
1054
- defaultVariants: {
1055
- orientation: "horizontal"
1056
- }
1057
- }
1058
- );
1059
- function ButtonGroup({
1060
- className,
1061
- orientation,
1062
- ...props
1063
- }) {
1064
- return /* @__PURE__ */ jsxRuntime.jsx(
1065
- "div",
1066
- {
1067
- role: "group",
1068
- "data-slot": "button-group",
1069
- "data-orientation": orientation,
1070
- className: cn(buttonGroupVariants({ orientation }), className),
1071
- ...props
1072
- }
1073
- );
1074
- }
1075
-
1076
1043
  // src/components/ai-elements/message.tsx
1077
1044
  init_utils();
1078
1045
 
@@ -8450,7 +8417,7 @@ var PromptInput = ({
8450
8417
  onSubmit: handleSubmit,
8451
8418
  ref: formRef,
8452
8419
  ...props,
8453
- children: /* @__PURE__ */ jsxRuntime.jsx(BrandBeam, { size: "line", active: beamActive, strength: 0.7, borderRadius: 24, children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup, { className: "overflow-hidden rounded-3xl border border-input bg-white px-4 py-2 shadow-sm dark:bg-card dark:shadow-none dark:ring-1 dark:ring-white/5 has-[textarea]:rounded-3xl has-[>[data-align=block-end]]:rounded-3xl has-[>[data-align=block-start]]:rounded-3xl", children }) })
8420
+ children: /* @__PURE__ */ jsxRuntime.jsx(BrandBeam, { size: "line", active: beamActive, strength: 0.7, children: /* @__PURE__ */ jsxRuntime.jsx(InputGroup, { className: "overflow-hidden rounded-3xl border border-input bg-white px-4 py-2 shadow-sm dark:bg-card dark:shadow-none dark:ring-1 dark:ring-white/5 has-[textarea]:rounded-3xl has-data-[align=block-end]:rounded-3xl has-data-[align=block-start]:rounded-3xl has-[>[data-align=block-end]]:rounded-3xl has-[>[data-align=block-start]]:rounded-3xl", children }) })
8454
8421
  }
8455
8422
  )
8456
8423
  ] });
@@ -8713,6 +8680,7 @@ function Progress({
8713
8680
  // src/components/ai-elements/context.tsx
8714
8681
  init_utils();
8715
8682
  var PERCENT_MAX = 100;
8683
+ var NEARLY_FULL = 0.9;
8716
8684
  var ICON_RADIUS = 10;
8717
8685
  var ICON_VIEWBOX = 24;
8718
8686
  var ICON_CENTER = 12;
@@ -8805,167 +8773,50 @@ var ContextContentHeader = ({
8805
8773
  const total = new Intl.NumberFormat("en-US", {
8806
8774
  notation: "compact"
8807
8775
  }).format(maxTokens);
8808
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full space-y-2 p-3", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8809
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 text-xs", children: [
8810
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: displayPct }),
8811
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: " text-muted-foreground", children: [
8776
+ const nearlyFull = usedPercent >= NEARLY_FULL;
8777
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full space-y-2 px-3 py-2.5", className), ...props, children: children ?? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
8778
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-baseline justify-between gap-3", children: [
8779
+ /* @__PURE__ */ jsxRuntime.jsx(
8780
+ "p",
8781
+ {
8782
+ className: cn(
8783
+ "text-sm font-medium tabular-nums",
8784
+ nearlyFull && "text-destructive"
8785
+ ),
8786
+ children: displayPct
8787
+ }
8788
+ ),
8789
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground tabular-nums", children: [
8812
8790
  used,
8813
8791
  " / ",
8814
8792
  total
8815
8793
  ] })
8816
8794
  ] }),
8817
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ jsxRuntime.jsx(Progress, { className: "bg-muted", value: usedPercent * PERCENT_MAX }) })
8795
+ /* @__PURE__ */ jsxRuntime.jsx(
8796
+ Progress,
8797
+ {
8798
+ className: cn(
8799
+ // The primitive only clips its x-axis, which leaves the fill's
8800
+ // square end poking out of the pill at both ends.
8801
+ "h-1 overflow-hidden rounded-full bg-muted",
8802
+ // Amber, not `bg-primary`: primary is the host app's colour, and
8803
+ // the two hosts disagree — the agent web app is amber, Studio is
8804
+ // near-black — so the same bar came out black beside a Send
8805
+ // button the composer hardcodes amber. This is the composer's
8806
+ // own accent, so it reads the same wherever it is embedded.
8807
+ "[&>[data-slot=progress-indicator]]:bg-amber-500",
8808
+ nearlyFull && "[&>[data-slot=progress-indicator]]:bg-destructive"
8809
+ ),
8810
+ value: usedPercent * PERCENT_MAX
8811
+ }
8812
+ )
8818
8813
  ] }) });
8819
8814
  };
8820
8815
  var ContextContentBody = ({
8821
8816
  children,
8822
8817
  className,
8823
8818
  ...props
8824
- }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full p-3", className), ...props, children });
8825
- var TokensWithCost = ({
8826
- tokens,
8827
- costText
8828
- }) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
8829
- tokens === void 0 ? "\u2014" : new Intl.NumberFormat("en-US", {
8830
- notation: "compact"
8831
- }).format(tokens),
8832
- costText ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-muted-foreground", children: [
8833
- "\u2022 ",
8834
- costText
8835
- ] }) : null
8836
- ] });
8837
- var ContextInputUsage = ({
8838
- className,
8839
- children,
8840
- ...props
8841
- }) => {
8842
- const { usage, modelId } = useContextValue();
8843
- const inputTokens = usage?.inputTokens ?? 0;
8844
- if (children) {
8845
- return children;
8846
- }
8847
- if (!inputTokens) {
8848
- return null;
8849
- }
8850
- const inputCost = modelId ? tokenlens.getUsage({
8851
- modelId,
8852
- usage: { input: inputTokens, output: 0 }
8853
- }).costUSD?.totalUSD : void 0;
8854
- const inputCostText = new Intl.NumberFormat("en-US", {
8855
- currency: "USD",
8856
- style: "currency"
8857
- }).format(inputCost ?? 0);
8858
- return /* @__PURE__ */ jsxRuntime.jsxs(
8859
- "div",
8860
- {
8861
- className: cn("flex items-center justify-between text-xs", className),
8862
- ...props,
8863
- children: [
8864
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Input" }),
8865
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: inputCostText, tokens: inputTokens })
8866
- ]
8867
- }
8868
- );
8869
- };
8870
- var ContextOutputUsage = ({
8871
- className,
8872
- children,
8873
- ...props
8874
- }) => {
8875
- const { usage, modelId } = useContextValue();
8876
- const outputTokens = usage?.outputTokens ?? 0;
8877
- if (children) {
8878
- return children;
8879
- }
8880
- if (!outputTokens) {
8881
- return null;
8882
- }
8883
- const outputCost = modelId ? tokenlens.getUsage({
8884
- modelId,
8885
- usage: { input: 0, output: outputTokens }
8886
- }).costUSD?.totalUSD : void 0;
8887
- const outputCostText = new Intl.NumberFormat("en-US", {
8888
- currency: "USD",
8889
- style: "currency"
8890
- }).format(outputCost ?? 0);
8891
- return /* @__PURE__ */ jsxRuntime.jsxs(
8892
- "div",
8893
- {
8894
- className: cn("flex items-center justify-between text-xs", className),
8895
- ...props,
8896
- children: [
8897
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Output" }),
8898
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: outputCostText, tokens: outputTokens })
8899
- ]
8900
- }
8901
- );
8902
- };
8903
- var ContextReasoningUsage = ({
8904
- className,
8905
- children,
8906
- ...props
8907
- }) => {
8908
- const { usage, modelId } = useContextValue();
8909
- const reasoningTokens = usage?.reasoningTokens ?? 0;
8910
- if (children) {
8911
- return children;
8912
- }
8913
- if (!reasoningTokens) {
8914
- return null;
8915
- }
8916
- const reasoningCost = modelId ? tokenlens.getUsage({
8917
- modelId,
8918
- usage: { reasoningTokens }
8919
- }).costUSD?.totalUSD : void 0;
8920
- const reasoningCostText = new Intl.NumberFormat("en-US", {
8921
- currency: "USD",
8922
- style: "currency"
8923
- }).format(reasoningCost ?? 0);
8924
- return /* @__PURE__ */ jsxRuntime.jsxs(
8925
- "div",
8926
- {
8927
- className: cn("flex items-center justify-between text-xs", className),
8928
- ...props,
8929
- children: [
8930
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Reasoning" }),
8931
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: reasoningCostText, tokens: reasoningTokens })
8932
- ]
8933
- }
8934
- );
8935
- };
8936
- var ContextCacheUsage = ({
8937
- className,
8938
- children,
8939
- ...props
8940
- }) => {
8941
- const { usage, modelId } = useContextValue();
8942
- const cacheTokens = usage?.cachedInputTokens ?? 0;
8943
- if (children) {
8944
- return children;
8945
- }
8946
- if (!cacheTokens) {
8947
- return null;
8948
- }
8949
- const cacheCost = modelId ? tokenlens.getUsage({
8950
- modelId,
8951
- usage: { cacheReads: cacheTokens, input: 0, output: 0 }
8952
- }).costUSD?.totalUSD : void 0;
8953
- const cacheCostText = new Intl.NumberFormat("en-US", {
8954
- currency: "USD",
8955
- style: "currency"
8956
- }).format(cacheCost ?? 0);
8957
- return /* @__PURE__ */ jsxRuntime.jsxs(
8958
- "div",
8959
- {
8960
- className: cn("flex items-center justify-between text-xs", className),
8961
- ...props,
8962
- children: [
8963
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Cache" }),
8964
- /* @__PURE__ */ jsxRuntime.jsx(TokensWithCost, { costText: cacheCostText, tokens: cacheTokens })
8965
- ]
8966
- }
8967
- );
8968
- };
8819
+ }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full space-y-1.5 px-3 py-2.5", className), ...props, children });
8969
8820
 
8970
8821
  // src/components/chat/chat-composer.tsx
8971
8822
  init_utils();
@@ -9380,6 +9231,20 @@ function SkillsEmptyState() {
9380
9231
  ] });
9381
9232
  }
9382
9233
  var TOOLS_ITEM_CLASS = "gap-3 rounded-md px-3 py-2 pointer-coarse:min-h-11 pointer-coarse:text-[15px]";
9234
+ var VIEW_MODE_SEGMENTS = [
9235
+ {
9236
+ mode: "simple",
9237
+ label: "Simple",
9238
+ icon: lucideReact.MessageSquareIcon,
9239
+ tooltip: "Simple \u2014 just the conversation"
9240
+ },
9241
+ {
9242
+ mode: "expert",
9243
+ label: "Advanced",
9244
+ icon: lucideReact.ListTreeIcon,
9245
+ tooltip: "Advanced \u2014 every step the agent took"
9246
+ }
9247
+ ];
9383
9248
  function ChatComposer(props) {
9384
9249
  return /* @__PURE__ */ jsxRuntime.jsx(PromptInputProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ChatComposerInner, { ...props }) });
9385
9250
  }
@@ -9734,6 +9599,12 @@ function ChatComposerInner({
9734
9599
  );
9735
9600
  const [contextOpen, setContextOpen] = react.useState(false);
9736
9601
  const contextPercentLabel = tokenUsage?.contextWindow ? `${Math.min(100, Math.round(tokenUsage.totalTokens / tokenUsage.contextWindow * 100))}%` : "0%";
9602
+ const contextBreakdown = tokenUsage ? [
9603
+ { label: "Input", tokens: tokenUsage.inputTokens },
9604
+ { label: "Output", tokens: tokenUsage.outputTokens },
9605
+ ...tokenUsage.reasoningTokens > 0 ? [{ label: "Reasoning", tokens: tokenUsage.reasoningTokens }] : [],
9606
+ ...tokenUsage.cachedInputTokens > 0 ? [{ label: "Cache", tokens: tokenUsage.cachedInputTokens }] : []
9607
+ ] : [];
9737
9608
  const canAttach = !disabled && !awaitingAnswer;
9738
9609
  const showPaneToggles = Boolean(
9739
9610
  canShowBrowser && onToggleBrowser || canShowWorkspace && onToggleWorkspace
@@ -9742,47 +9613,39 @@ function ChatComposerInner({
9742
9613
  browserProfilesEnabled && onSelectBrowserProfile && adapter.listBrowserProfiles
9743
9614
  );
9744
9615
  const showToolsPanel = canAttach || showPaneToggles || canPickProfile;
9745
- const viewModeToggle = onViewModeChange ? /* @__PURE__ */ jsxRuntime.jsxs(
9746
- ButtonGroup,
9616
+ const viewModeToggle = onViewModeChange ? /* @__PURE__ */ jsxRuntime.jsx(
9617
+ "div",
9747
9618
  {
9619
+ role: "group",
9748
9620
  "aria-label": "Chat view mode",
9749
- className: "overflow-hidden rounded-full border border-border bg-muted/40 p-0.5",
9750
- children: [
9751
- /* @__PURE__ */ jsxRuntime.jsx(
9752
- PromptInputButton,
9753
- {
9754
- "aria-label": "Simple view",
9755
- "aria-pressed": viewMode === "simple",
9756
- tooltip: "Simple \u2014 just the conversation",
9757
- variant: viewMode === "simple" ? "secondary" : "ghost",
9758
- onClick: () => onViewModeChange("simple"),
9759
- className: cn(
9760
- // 32px is a comfortable segment for a cursor and a miss for a
9761
- // thumb, so touch takes both halves to the 44px floor.
9762
- "size-8 rounded-full pointer-coarse:size-11",
9763
- viewMode === "simple" && "shadow-sm"
9764
- ),
9765
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MessageSquareIcon, { className: "size-[18px] pointer-coarse:size-5" })
9766
- }
9767
- ),
9768
- /* @__PURE__ */ jsxRuntime.jsx(
9621
+ className: "flex shrink-0 items-center gap-0.5 rounded-full bg-muted/60 p-0.5",
9622
+ children: VIEW_MODE_SEGMENTS.map(({ mode, label, icon: Icon, tooltip }) => {
9623
+ const selected = viewMode === mode;
9624
+ return /* @__PURE__ */ jsxRuntime.jsxs(
9769
9625
  PromptInputButton,
9770
9626
  {
9771
- "aria-label": "Advanced view",
9772
- "aria-pressed": viewMode === "expert",
9773
- tooltip: "Advanced \u2014 every step the agent took",
9774
- variant: viewMode === "expert" ? "secondary" : "ghost",
9775
- onClick: () => onViewModeChange("expert"),
9627
+ size: "sm",
9628
+ "aria-label": `${label} view`,
9629
+ "aria-pressed": selected,
9630
+ tooltip,
9631
+ variant: "ghost",
9632
+ onClick: () => onViewModeChange(mode),
9776
9633
  className: cn(
9777
- // 32px is a comfortable segment for a cursor and a miss for a
9778
- // thumb, so touch takes both halves to the 44px floor.
9779
- "size-8 rounded-full pointer-coarse:size-11",
9780
- viewMode === "expert" && "shadow-sm"
9634
+ // Icon-width on a phone, word-width with a cursor; the coarse
9635
+ // bump takes the segment to the 44px touch floor either way.
9636
+ // Words, not the shouted uppercase the button base defaults to —
9637
+ // this is a label on a switch, not a call to action.
9638
+ "h-8 gap-1.5 rounded-full border-0 bg-transparent px-3.5 text-xs font-normal capitalize tracking-normal md:px-3 pointer-coarse:h-11 pointer-coarse:px-5",
9639
+ selected ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:bg-background/60 hover:text-foreground"
9781
9640
  ),
9782
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListTreeIcon, { className: "size-[18px] pointer-coarse:size-5" })
9783
- }
9784
- )
9785
- ]
9641
+ children: [
9642
+ /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "size-4 md:hidden" }),
9643
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden md:inline", children: label })
9644
+ ]
9645
+ },
9646
+ mode
9647
+ );
9648
+ })
9786
9649
  }
9787
9650
  ) : null;
9788
9651
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -9999,37 +9862,44 @@ function ChatComposerInner({
9999
9862
  ),
10000
9863
  children: [
10001
9864
  /* @__PURE__ */ jsxRuntime.jsx(ContextContentHeader, {}),
10002
- /* @__PURE__ */ jsxRuntime.jsx(ContextContentBody, { children: tokenUsage.totalTokens > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10003
- /* @__PURE__ */ jsxRuntime.jsx(ContextInputUsage, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
10004
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Input" }),
10005
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tokenUsage.inputTokens.toLocaleString() })
10006
- ] }) }),
10007
- /* @__PURE__ */ jsxRuntime.jsx(ContextOutputUsage, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
10008
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Output" }),
10009
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tokenUsage.outputTokens.toLocaleString() })
10010
- ] }) }),
10011
- tokenUsage.reasoningTokens > 0 && /* @__PURE__ */ jsxRuntime.jsx(ContextReasoningUsage, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
10012
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Reasoning" }),
10013
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tokenUsage.reasoningTokens.toLocaleString() })
10014
- ] }) }),
10015
- tokenUsage.cachedInputTokens > 0 && /* @__PURE__ */ jsxRuntime.jsx(ContextCacheUsage, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-xs", children: [
10016
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Cache" }),
10017
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: tokenUsage.cachedInputTokens.toLocaleString() })
10018
- ] }) })
10019
- ] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground text-center py-1", children: "Empty" }) }),
10020
- tokenUsage.totalTokens > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full items-center justify-end gap-3 bg-secondary p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
10021
- Button,
9865
+ /* @__PURE__ */ jsxRuntime.jsx(ContextContentBody, { children: tokenUsage.totalTokens > 0 ? contextBreakdown.map(({ label, tokens }) => /* @__PURE__ */ jsxRuntime.jsxs(
9866
+ "div",
10022
9867
  {
10023
- type: "button",
10024
- size: "xs",
10025
- className: "pointer-coarse:h-11 pointer-coarse:px-4 pointer-coarse:text-sm",
10026
- onClick: () => {
10027
- setContextOpen(false);
10028
- onSend("/compress");
10029
- },
10030
- children: "Compress"
10031
- }
10032
- ) })
9868
+ className: "flex items-center justify-between gap-4 text-xs",
9869
+ children: [
9870
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: label }),
9871
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tabular-nums", children: tokens.toLocaleString() })
9872
+ ]
9873
+ },
9874
+ label
9875
+ )) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground text-center py-1", children: "Empty" }) }),
9876
+ tokenUsage.totalTokens > 0 && // The action the panel exists for, so it gets the panel's
9877
+ // width rather than a filled block shoved into the corner
9878
+ // of a grey bar — that bar was a second surface inside a
9879
+ // small popover, squaring its own corners off against the
9880
+ // rounded ones around it. It keeps a rule of its own
9881
+ // because the sheet form has no divide-y, and the one
9882
+ // division worth drawing is between reading and acting.
9883
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5 border-t border-border px-3 py-2.5", children: [
9884
+ /* @__PURE__ */ jsxRuntime.jsxs(
9885
+ Button,
9886
+ {
9887
+ type: "button",
9888
+ size: "sm",
9889
+ variant: "outline",
9890
+ className: "w-full",
9891
+ onClick: () => {
9892
+ setContextOpen(false);
9893
+ onSend("/compress");
9894
+ },
9895
+ children: [
9896
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShrinkIcon, {}),
9897
+ "Compress"
9898
+ ]
9899
+ }
9900
+ ),
9901
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-center text-[11px] leading-snug text-muted-foreground", children: "Sums up the thread to free the window" })
9902
+ ] })
10033
9903
  ]
10034
9904
  }
10035
9905
  )