@meshagent/meshagent-tailwind 0.57.1 → 0.57.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.
@@ -139,71 +139,62 @@ class LiveToolCallAccumulator {
139
139
  return applyPatchStatusInfo({ arguments: call.arguments, deltaText });
140
140
  }
141
141
  }
142
- const maxArgumentDepth = 64;
143
- const maxArgumentWork = 4096;
144
- function searchToolArguments(value, pathOnly) {
145
- const preferredKeys = pathOnly ? ["operation"] : ["patch", "input", "diff"];
146
- const seen = /* @__PURE__ */ new WeakSet();
147
- let remaining = maxArgumentWork;
148
- let exhausted = false;
149
- const step = () => {
150
- if (exhausted || remaining-- <= 0) {
151
- exhausted = true;
152
- return false;
153
- }
154
- return true;
155
- };
156
- const find = (current, depth) => {
157
- if (!step() || depth > maxArgumentDepth) {
158
- exhausted = true;
159
- return void 0;
160
- }
161
- if (typeof current === "string") {
162
- return !pathOnly && current.trim() !== "" ? current : void 0;
142
+ function applyPatchTextFromArguments(value) {
143
+ if (typeof value === "string") {
144
+ return value.trim() === "" ? void 0 : value;
145
+ }
146
+ if (Array.isArray(value)) {
147
+ for (const nested of value) {
148
+ const text = applyPatchTextFromArguments(nested);
149
+ if (text != null) {
150
+ return text;
151
+ }
163
152
  }
164
- if (!isRecord(current) && !Array.isArray(current)) {
165
- return void 0;
153
+ return void 0;
154
+ }
155
+ if (isRecord(value)) {
156
+ for (const key of ["patch", "input", "diff"]) {
157
+ const text = applyPatchTextFromArguments(value[key]);
158
+ if (text != null) {
159
+ return text;
160
+ }
166
161
  }
167
- if (seen.has(current)) {
168
- return void 0;
162
+ for (const nested of Object.values(value)) {
163
+ const text = applyPatchTextFromArguments(nested);
164
+ if (text != null) {
165
+ return text;
166
+ }
169
167
  }
170
- seen.add(current);
171
- if (Array.isArray(current)) {
172
- for (const child of current) {
173
- const result = find(child, depth + 1);
174
- if (exhausted) return void 0;
175
- if (result != null) return result;
168
+ }
169
+ return void 0;
170
+ }
171
+ function applyPatchPathFromArguments(value) {
172
+ if (Array.isArray(value)) {
173
+ for (const nested of value) {
174
+ const nestedPath = applyPatchPathFromArguments(nested);
175
+ if (nestedPath != null) {
176
+ return nestedPath;
176
177
  }
177
- return void 0;
178
178
  }
179
- if (pathOnly) {
180
- const path = current.path;
181
- if (typeof path === "string" && path.trim() !== "") return path.trim();
179
+ return void 0;
180
+ }
181
+ if (isRecord(value)) {
182
+ const path = value.path;
183
+ if (typeof path === "string" && path.trim() !== "") {
184
+ return path.trim();
182
185
  }
183
- for (const key of preferredKeys) {
184
- if (!step()) return void 0;
185
- const child = current[key];
186
- if (child == null) continue;
187
- const result = find(child, depth + 1);
188
- if (exhausted) return void 0;
189
- if (result != null) return result;
186
+ const operationPath = applyPatchPathFromArguments(value.operation);
187
+ if (operationPath != null) {
188
+ return operationPath;
190
189
  }
191
- for (const key in current) {
192
- if (!step()) return void 0;
193
- if (!Object.prototype.hasOwnProperty.call(current, key) || preferredKeys.includes(key)) continue;
194
- const result = find(current[key], depth + 1);
195
- if (exhausted) return void 0;
196
- if (result != null) return result;
190
+ for (const nested of Object.values(value)) {
191
+ const nestedPath = applyPatchPathFromArguments(nested);
192
+ if (nestedPath != null) {
193
+ return nestedPath;
194
+ }
197
195
  }
198
- return void 0;
199
- };
200
- return find(value, 0);
201
- }
202
- function applyPatchTextFromArguments(value) {
203
- return searchToolArguments(value, false);
204
- }
205
- function applyPatchPathFromArguments(value) {
206
- return searchToolArguments(value, true);
196
+ }
197
+ return void 0;
207
198
  }
208
199
  function applyPatchPathFromText(patch) {
209
200
  const filePattern = /^\*\*\* (?:Update|Add|Delete) File: (.+)$/;
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode } from "react";
2
2
  import type { RoomClient, Tool } from "@meshagent/meshagent";
3
3
  import type { AgentMessage, AgentMessageEvent, BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
4
4
  import type { AgentUsageSnapshot, ChatThreadItem } from "./chat-thread-timeline.js";
5
- export { AgentUsageSnapshot, shouldReplaceAgentUsageSnapshot, } from "./chat-thread-timeline.js";
5
+ export { AgentUsageSnapshot, shouldReplaceAgentUsageSnapshot } from "./chat-thread-timeline.js";
6
6
  export type { ChatThreadItem } from "./chat-thread-timeline.js";
7
7
  import { type ChatInputProps } from "./chat-input.js";
8
8
  import { ChatMessage } from "./chat-message.js";
@@ -104,8 +104,6 @@ export declare function useAgentThreadStatus(): {
104
104
  interrupt: () => Promise<void>;
105
105
  };
106
106
  export interface AgentThreadFeedProps {
107
- /** Presentation-only label for user messages; does not change participant identity. */
108
- userDisplayName?: string;
109
107
  /** Show the built-in progress overlay and reserve its bottom spacing. Defaults to true. */
110
108
  showStatusIndicator?: boolean;
111
109
  /** Renders application-owned content after a visible feed item without sending it to the agent. */
@@ -113,7 +111,7 @@ export interface AgentThreadFeedProps {
113
111
  /** Renders local content before the oldest item, or in place of the empty state. */
114
112
  renderUnanchored?: () => ReactNode;
115
113
  }
116
- export declare function AgentThreadFeed({ renderAfterItem, renderUnanchored, showStatusIndicator, userDisplayName, }?: AgentThreadFeedProps): ReactElement;
114
+ export declare function AgentThreadFeed({ renderAfterItem, renderUnanchored, showStatusIndicator, }?: AgentThreadFeedProps): ReactElement;
117
115
  export interface AgentThreadInputProps extends Pick<ChatInputProps, "className" | "inputRowClassName" | "textareaClassName" | "leadingButton"> {
118
116
  showSubmitButton?: boolean;
119
117
  submitButtonComponent?: ChatInputProps["submitButtonComponent"];
@@ -10,10 +10,7 @@ import {
10
10
  TurnStarted
11
11
  } from "@meshagent/meshagent-agents";
12
12
  import { buildChatThreadTimeline, buildMergedChatThreadTimeline } from "./chat-thread-timeline.js";
13
- import {
14
- AgentUsageSnapshot,
15
- shouldReplaceAgentUsageSnapshot
16
- } from "./chat-thread-timeline.js";
13
+ import { AgentUsageSnapshot, shouldReplaceAgentUsageSnapshot } from "./chat-thread-timeline.js";
17
14
  import { ChevronDown, ChevronRight, Download, FileText, ImageOff, Terminal } from "lucide-react";
18
15
  import ReactMarkdown from "react-markdown";
19
16
  import rehypeHighlight from "rehype-highlight";
@@ -281,10 +278,9 @@ function ChatBubble({ text, mine }) {
281
278
  return /* @__PURE__ */ jsx(
282
279
  "div",
283
280
  {
284
- "data-chat-bubble": mine ? "user" : "assistant",
285
281
  className: cn(
286
- "chat-message__bubble chat-message__markdown w-fit max-w-[85%] rounded-md px-4 py-3 text-sm leading-6 shadow-xs sm:max-w-2xl",
287
- mine ? "chat-message__bubble--user bg-secondary/85 text-foreground" : "chat-message__bubble--assistant bg-muted/70 text-foreground"
282
+ "w-fit max-w-[85%] rounded-md px-4 py-3 text-sm leading-6 shadow-xs sm:max-w-2xl",
283
+ mine ? "bg-secondary/85 text-foreground" : "bg-muted/70 text-foreground"
288
284
  ),
289
285
  children: /* @__PURE__ */ jsx(MarkdownBlock, { text })
290
286
  }
@@ -294,16 +290,7 @@ function ReasoningTrace({ text, className }) {
294
290
  if (text.trim() === "") {
295
291
  return null;
296
292
  }
297
- return /* @__PURE__ */ jsx(
298
- "div",
299
- {
300
- className: cn(
301
- "chat-message__reasoning chat-message__markdown mr-[50px] ml-1.5 px-4 py-1 text-sm leading-6 text-muted-foreground",
302
- className
303
- ),
304
- children: /* @__PURE__ */ jsx(MarkdownBlock, { text })
305
- }
306
- );
293
+ return /* @__PURE__ */ jsx("div", { className: cn("mr-[50px] ml-1.5 px-4 py-1 text-sm leading-6 text-muted-foreground", className), children: /* @__PURE__ */ jsx(MarkdownBlock, { text }) });
307
294
  }
308
295
  function trimShellText(value) {
309
296
  if (value == null) {
@@ -614,8 +601,7 @@ function ThreadMessageView({
614
601
  agentName,
615
602
  chatFeedWidgetsByName,
616
603
  onSendMessage,
617
- forceHideHeader = false,
618
- userDisplayName
604
+ forceHideHeader = false
619
605
  }) {
620
606
  if (message.kind === "error") {
621
607
  return /* @__PURE__ */ jsx("div", { className: "px-6 py-1 text-center text-sm text-destructive", children: message.text });
@@ -663,59 +649,43 @@ function ThreadMessageView({
663
649
  return /* @__PURE__ */ jsx(ToolCallLine, { message });
664
650
  }
665
651
  const mine = message.role === "user";
666
- const authorName = mine ? userDisplayName ?? message.authorName ?? localParticipantName : message.authorName ?? displayParticipantName(agentName);
667
- const previousAuthor = previous?.role === "user" ? userDisplayName ?? previous.authorName ?? localParticipantName : previous?.authorName ?? displayParticipantName(agentName);
652
+ const authorName = message.authorName ?? (mine ? localParticipantName : displayParticipantName(agentName));
653
+ const previousAuthor = previous?.authorName ?? (previous?.role === "user" ? localParticipantName : displayParticipantName(agentName));
668
654
  const shouldShowHeader = !forceHideHeader && (previous?.kind !== "message" || previousAuthor !== authorName);
669
- return /* @__PURE__ */ jsxs(
670
- "div",
671
- {
672
- className: cn("chat-message flex flex-col gap-2", mine ? "chat-message--user" : "chat-message--assistant"),
673
- children: [
674
- shouldShowHeader ? /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx("div", { className: cn("max-w-[85%] px-1 sm:max-w-2xl", mine ? "text-right" : "text-left"), children: /* @__PURE__ */ jsxs(
675
- "div",
676
- {
677
- className: cn(
678
- "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
679
- mine ? "justify-end" : "justify-start"
680
- ),
681
- children: [
682
- authorName.trim() !== "" ? /* @__PURE__ */ jsx(
683
- "span",
684
- {
685
- "data-chat-author": mine ? "user" : "assistant",
686
- className: cn(
687
- "chat-message__author font-semibold text-foreground",
688
- mine ? "chat-message__author--user" : "chat-message__author--assistant"
689
- ),
690
- children: displayParticipantName(authorName)
691
- }
692
- ) : null,
693
- /* @__PURE__ */ jsx("span", { children: timeAgo(message.createdAt) })
694
- ]
695
- }
696
- ) }) }) : null,
697
- message.text.trim() !== "" ? /* @__PURE__ */ jsx("div", { className: cn("chat-message__content flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx(ChatBubble, { text: message.text, mine }) }) : null,
698
- message.attachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx(
699
- "div",
655
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
656
+ shouldShowHeader ? /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx("div", { className: cn("max-w-[85%] px-1 sm:max-w-2xl", mine ? "text-right" : "text-left"), children: /* @__PURE__ */ jsxs(
657
+ "div",
658
+ {
659
+ className: cn(
660
+ "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",
661
+ mine ? "justify-end" : "justify-start"
662
+ ),
663
+ children: [
664
+ authorName.trim() !== "" ? /* @__PURE__ */ jsx("span", { className: "font-semibold text-foreground", children: displayParticipantName(authorName) }) : null,
665
+ /* @__PURE__ */ jsx("span", { children: timeAgo(message.createdAt) })
666
+ ]
667
+ }
668
+ ) }) }) : null,
669
+ message.text.trim() !== "" ? /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx(ChatBubble, { text: message.text, mine }) }) : null,
670
+ message.attachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: cn("flex w-full", mine ? "justify-end" : "justify-start"), children: /* @__PURE__ */ jsx(
671
+ "div",
672
+ {
673
+ className: cn(
674
+ "flex max-w-[85%] flex-wrap gap-3 px-1 sm:max-w-2xl",
675
+ mine ? "justify-end" : "justify-start"
676
+ ),
677
+ children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx(
678
+ AttachmentView,
700
679
  {
701
- className: cn(
702
- "chat-message__attachments flex max-w-[85%] flex-wrap gap-3 px-1 sm:max-w-2xl",
703
- mine ? "justify-end" : "justify-start"
704
- ),
705
- children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx(
706
- AttachmentView,
707
- {
708
- room,
709
- path: attachment
710
- },
711
- `${message.id}:attachment:${attachment}:${index}`
712
- ))
713
- }
714
- ) }) : null,
715
- message.image ? /* @__PURE__ */ jsx("div", { className: "flex w-full justify-start", children: /* @__PURE__ */ jsx(GeneratedImageView, { image: message.image }) }) : null
716
- ]
717
- }
718
- );
680
+ room,
681
+ path: attachment
682
+ },
683
+ `${message.id}:attachment:${attachment}:${index}`
684
+ ))
685
+ }
686
+ ) }) : null,
687
+ message.image ? /* @__PURE__ */ jsx("div", { className: "flex w-full justify-start", children: /* @__PURE__ */ jsx(GeneratedImageView, { image: message.image }) }) : null
688
+ ] });
719
689
  }
720
690
  function EmptyState({ title, description }) {
721
691
  return /* @__PURE__ */ jsxs("div", { className: "mx-auto flex h-full max-w-2xl flex-col items-center justify-center px-6 py-20 text-center", children: [
@@ -801,9 +771,7 @@ function processClientToolRequests({
801
771
  }
802
772
  replayingClientToolSessions.delete(session);
803
773
  const completedRequestIds = new Set(
804
- buildChatThreadTimeline(session.messages).items.filter(
805
- (item) => item.kind === "tool_call" && item.toolkit === "client" && (item.state === "completed" || item.state === "failed")
806
- ).map((item) => item.clientToolRequestId ?? item.id)
774
+ buildChatThreadTimeline(session.messages).items.filter((item) => item.kind === "tool_call" && item.toolkit === "client" && (item.state === "completed" || item.state === "failed")).map((item) => item.clientToolRequestId ?? item.id)
807
775
  );
808
776
  for (const request of requests) {
809
777
  if (completedRequestIds.has(request.requestId)) {
@@ -849,9 +817,7 @@ function processClientToolRequests({
849
817
  });
850
818
  session.finishClientToolCall(request.requestId, { responseSent: true });
851
819
  } catch (error) {
852
- session.finishClientToolCall(request.requestId, {
853
- responseSent: false
854
- });
820
+ session.finishClientToolCall(request.requestId, { responseSent: false });
855
821
  updateCall(clientToolCallKey(session.threadPath, request.requestId), {
856
822
  status: "failed",
857
823
  output: new ErrorContent({ text: describeError(error) })
@@ -1167,9 +1133,7 @@ function AgentThreadProvider({
1167
1133
  }, [deferLiveEvents, persistedEvents, session, version]);
1168
1134
  const timelineItems = useMemo(
1169
1135
  () => (timeline?.items ?? []).map((item) => {
1170
- const override = session == null ? void 0 : clientToolCallOverrides.get(
1171
- clientToolCallKey(session.threadPath, item.clientToolRequestId ?? item.id)
1172
- );
1136
+ const override = session == null ? void 0 : clientToolCallOverrides.get(clientToolCallKey(session.threadPath, item.clientToolRequestId ?? item.id));
1173
1137
  if (override == null || item.kind !== "tool_call" || item.state === "completed" || item.state === "failed") {
1174
1138
  return item;
1175
1139
  }
@@ -1398,8 +1362,7 @@ function useAgentThreadStatus() {
1398
1362
  function AgentThreadFeed({
1399
1363
  renderAfterItem,
1400
1364
  renderUnanchored,
1401
- showStatusIndicator = true,
1402
- userDisplayName
1365
+ showStatusIndicator = true
1403
1366
  } = {}) {
1404
1367
  const {
1405
1368
  room,
@@ -1438,7 +1401,7 @@ function AgentThreadFeed({
1438
1401
  "div",
1439
1402
  {
1440
1403
  className: cn(
1441
- "chat-scroll__message-content mx-auto w-full max-w-[912px] px-1 py-3",
1404
+ "mx-auto w-full max-w-[912px] px-1 py-3",
1442
1405
  item.id === firstRenderedItemId ? "pt-6" : null,
1443
1406
  item.id === lastRenderedItemId ? showStatusIndicator && statusText ? "pb-24" : "pb-6" : null
1444
1407
  ),
@@ -1449,7 +1412,6 @@ function AgentThreadFeed({
1449
1412
  {
1450
1413
  room,
1451
1414
  message: item,
1452
- userDisplayName,
1453
1415
  previous: previousItemById.get(item.id) ?? null,
1454
1416
  localParticipantName,
1455
1417
  agentName,
@@ -59,16 +59,13 @@ function ChatInput({
59
59
  const textareaRef = useRef(null);
60
60
  const value = controlledValue ?? uncontrolledValue;
61
61
  const attachmentStatusVersion = useAttachmentStatusVersion(attachments);
62
- const setValue = useCallback(
63
- (nextValue) => {
64
- if (controlledValue === void 0) {
65
- setUncontrolledValue(nextValue);
66
- }
67
- onValueChange?.(nextValue);
68
- onTextChange?.(nextValue);
69
- },
70
- [controlledValue, onTextChange, onValueChange]
71
- );
62
+ const setValue = useCallback((nextValue) => {
63
+ if (controlledValue === void 0) {
64
+ setUncontrolledValue(nextValue);
65
+ }
66
+ onValueChange?.(nextValue);
67
+ onTextChange?.(nextValue);
68
+ }, [controlledValue, onTextChange, onValueChange]);
72
69
  useAutoResizingTextarea(textareaRef, value);
73
70
  const allAttachmentsUploaded = useMemo(
74
71
  () => attachments.every((attachment) => attachment.status === UploadStatus.Completed),
@@ -81,110 +78,83 @@ function ChatInput({
81
78
  if (!canSend) {
82
79
  return;
83
80
  }
84
- void onSubmit(
85
- new ChatMessage({
86
- id: uuidV4(),
87
- text: trimmed,
88
- attachments: attachments.map((attachment) => attachment.path)
89
- })
90
- );
81
+ void onSubmit(new ChatMessage({
82
+ id: uuidV4(),
83
+ text: trimmed,
84
+ attachments: attachments.map((attachment) => attachment.path)
85
+ }));
91
86
  if (!clearOnSubmit) {
92
87
  return;
93
88
  }
94
89
  setValue("");
95
90
  setAttachments([]);
96
91
  }, [attachments, canSend, clearOnSubmit, onSubmit, setAttachments, setValue, value]);
97
- const handleKeyDown = useCallback(
98
- (event) => {
99
- if (disabled) {
100
- return;
101
- }
102
- if (event.key === "Enter" && !event.shiftKey) {
103
- event.preventDefault();
104
- if (showCancelButton) {
105
- onCancelRequest?.();
106
- return;
107
- }
108
- handleSend();
109
- }
110
- },
111
- [disabled, handleSend, onCancelRequest, showCancelButton]
112
- );
113
- const handleChange = useCallback(
114
- (event) => {
115
- const nextValue = event.currentTarget.value;
116
- resizeTextarea(event.currentTarget);
117
- setValue(nextValue);
118
- },
119
- [setValue]
120
- );
121
- const cancelAttachment = useCallback(
122
- (attachment) => {
123
- if (disabled) {
92
+ const handleKeyDown = useCallback((event) => {
93
+ if (disabled) {
94
+ return;
95
+ }
96
+ if (event.key === "Enter" && !event.shiftKey) {
97
+ event.preventDefault();
98
+ if (showCancelButton) {
99
+ onCancelRequest?.();
124
100
  return;
125
101
  }
126
- setAttachments(attachments.filter((currentAttachment) => currentAttachment !== attachment));
127
- },
128
- [attachments, disabled, setAttachments]
129
- );
102
+ handleSend();
103
+ }
104
+ }, [disabled, handleSend, onCancelRequest, showCancelButton]);
105
+ const handleChange = useCallback((event) => {
106
+ const nextValue = event.currentTarget.value;
107
+ resizeTextarea(event.currentTarget);
108
+ setValue(nextValue);
109
+ }, [setValue]);
110
+ const cancelAttachment = useCallback((attachment) => {
111
+ if (disabled) {
112
+ return;
113
+ }
114
+ setAttachments(attachments.filter((currentAttachment) => currentAttachment !== attachment));
115
+ }, [attachments, disabled, setAttachments]);
130
116
  const trailingButton = showCancelButton ? /* @__PURE__ */ jsx(SubmitButton, { onClick: onCancelRequest, showCancelButton: true, title: "Stop", ariaLabel: "Stop" }) : showSubmitButton ? /* @__PURE__ */ jsx(SubmitButton, { onClick: handleSend, disabled: !canSend, title: "Send", ariaLabel: "Send" }) : null;
131
- return /* @__PURE__ */ jsxs(
132
- "div",
133
- {
134
- className: cn(
135
- "chat-composer flex flex-col mx-auto w-full max-w-4xl gap-2",
136
- "border border-input/70 rounded-md bg-background p-1 shadow-xs",
137
- "focus-within:border-primary focus-within:[outline:1px_solid_var(--color-primary)]",
138
- className
117
+ return /* @__PURE__ */ jsxs("div", { className: cn(
118
+ "flex flex-col mx-auto w-full max-w-4xl gap-2",
119
+ "border border-input/70 rounded-md bg-background p-1 shadow-xs",
120
+ "focus-within:border-primary focus-within:[outline:1px_solid_var(--color-primary)]",
121
+ className
122
+ ), children: [
123
+ attachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex max-w-full flex-wrap gap-2 px-1 pt-1", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx(
124
+ UploadPill,
125
+ {
126
+ attachment,
127
+ onCancel: cancelAttachment
128
+ },
129
+ `${attachment.path}-${index}`
130
+ )) }) : null,
131
+ /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", !enableFileUpload && "pl-1", inputRowClassName), children: [
132
+ leadingButton,
133
+ enableFileUpload ? /* @__PURE__ */ jsx(FileUploader, { onFilesSelected, disabled }) : null,
134
+ /* @__PURE__ */ jsx(
135
+ "textarea",
136
+ {
137
+ ref: textareaRef,
138
+ rows: 1,
139
+ autoFocus,
140
+ placeholder,
141
+ className: cn(
142
+ "min-h-5 max-h-40",
143
+ "flex-1 resize-none border-0 bg-transparent p-0 leading-5",
144
+ "shadow-none outline-none ring-0 focus:ring-0 focus-visible:ring-0",
145
+ "disabled:cursor-not-allowed disabled:opacity-50",
146
+ "md:text-sm",
147
+ textareaClassName
148
+ ),
149
+ readOnly: disabled,
150
+ value,
151
+ onChange: handleChange,
152
+ onKeyDown: handleKeyDown
153
+ }
139
154
  ),
140
- children: [
141
- attachments.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex max-w-full flex-wrap gap-2 px-1 pt-1", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx(
142
- UploadPill,
143
- {
144
- attachment,
145
- onCancel: cancelAttachment
146
- },
147
- `${attachment.path}-${index}`
148
- )) }) : null,
149
- /* @__PURE__ */ jsxs(
150
- "div",
151
- {
152
- className: cn(
153
- "chat-composer__input-row flex items-center gap-2",
154
- !enableFileUpload && "pl-1",
155
- inputRowClassName
156
- ),
157
- children: [
158
- leadingButton,
159
- enableFileUpload ? /* @__PURE__ */ jsx(FileUploader, { onFilesSelected, disabled }) : null,
160
- /* @__PURE__ */ jsx(
161
- "textarea",
162
- {
163
- ref: textareaRef,
164
- rows: 1,
165
- autoFocus,
166
- placeholder,
167
- className: cn(
168
- "chat-composer__input min-h-5 max-h-40",
169
- "flex-1 resize-none border-0 bg-transparent p-0 leading-5",
170
- "shadow-none outline-none ring-0 focus:ring-0 focus-visible:ring-0",
171
- "disabled:cursor-not-allowed disabled:opacity-50",
172
- "md:text-sm",
173
- textareaClassName
174
- ),
175
- readOnly: disabled,
176
- value,
177
- onChange: handleChange,
178
- onKeyDown: handleKeyDown
179
- }
180
- ),
181
- trailingButton
182
- ]
183
- }
184
- )
185
- ]
186
- }
187
- );
155
+ trailingButton
156
+ ] })
157
+ ] });
188
158
  }
189
159
  export {
190
160
  ChatInput,
@@ -646,23 +646,14 @@ class AgentUsageSnapshot {
646
646
  this.usage = Object.freeze({ ...params.usage });
647
647
  }
648
648
  static fromMessage(message) {
649
- if (isTypedMessage(message, AgentUsageUpdated)) {
650
- return AgentUsageSnapshot.fromPayload(message.toJson());
651
- }
652
- return null;
649
+ return isTypedMessage(message, AgentUsageUpdated) ? AgentUsageSnapshot.fromPayload(message.toJson()) : null;
653
650
  }
654
651
  static fromPayload(payload) {
655
- if (payload.type !== "meshagent.agent.usage.updated" || typeof payload.thread_id !== "string" || payload.thread_id.trim() === "") {
656
- return null;
657
- }
658
- if (payload.context_window == null || typeof payload.context_window !== "object") {
659
- return null;
660
- }
652
+ if (payload.type !== "meshagent.agent.usage.updated" || typeof payload.thread_id !== "string" || payload.thread_id.trim() === "") return null;
653
+ if (payload.context_window == null || typeof payload.context_window !== "object") return null;
661
654
  const context = payload.context_window;
662
655
  const usedTokens = integerNumber(context.used_tokens);
663
- if (usedTokens == null) {
664
- return null;
665
- }
656
+ if (usedTokens == null) return null;
666
657
  const rawUsage = payload.usage != null && typeof payload.usage === "object" ? payload.usage : {};
667
658
  return new AgentUsageSnapshot({
668
659
  threadPath: payload.thread_id.trim(),
@@ -18,11 +18,7 @@ function ComposerActionButton({
18
18
  type: "button",
19
19
  size: "icon",
20
20
  variant: "ghost",
21
- className: cn(
22
- "chat-composer__action relative size-9 rounded-full",
23
- disabled ? "opacity-55" : "cursor-pointer",
24
- className
25
- ),
21
+ className: cn("relative size-9 rounded-full", disabled ? "opacity-55" : "cursor-pointer", className),
26
22
  disabled,
27
23
  onClick,
28
24
  title: disabled ? "Cancelling" : "Stop",
@@ -38,11 +34,7 @@ function ComposerActionButton({
38
34
  {
39
35
  type: "button",
40
36
  size: "icon",
41
- className: cn(
42
- "chat-composer__action size-9 rounded-full shadow-xs",
43
- !disabled && "cursor-pointer",
44
- className
45
- ),
37
+ className: cn("size-9 rounded-full shadow-xs", !disabled && "cursor-pointer", className),
46
38
  disabled,
47
39
  onClick,
48
40
  title,