@meshagent/meshagent-tailwind 0.50.0 → 0.51.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.
@@ -1,4 +1,4 @@
1
- import type { ReactElement } from "react";
1
+ 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 } from "./chat-thread-timeline.js";
@@ -13,10 +13,6 @@ export declare class AgentToolChoice {
13
13
  });
14
14
  toJson(): Record<string, string>;
15
15
  }
16
- export interface AgentThreadSuggestion {
17
- label: string;
18
- prompt?: string;
19
- }
20
16
  export interface AgentThreadProps {
21
17
  room?: RoomClient;
22
18
  path: string;
@@ -33,7 +29,6 @@ export interface AgentThreadProps {
33
29
  chatFeedWidgets?: readonly ChatFeedWidget[];
34
30
  toolChoice?: AgentToolChoice;
35
31
  collapseMessages?: boolean;
36
- suggestions?: readonly AgentThreadSuggestion[];
37
32
  enableFileUpload?: boolean;
38
33
  persistedEvents?: readonly AgentMessageEvent[];
39
34
  deferLiveEvents?: boolean;
@@ -49,6 +44,9 @@ export interface AgentThreadProps {
49
44
  onPersistedEventsInjected?: (error: unknown | null) => void;
50
45
  onEventsChanged?: (threadId: string, events: readonly AgentMessageEvent[], latestMessage: AgentMessage | null) => void;
51
46
  }
47
+ export interface AgentThreadProviderProps extends AgentThreadProps {
48
+ children: ReactNode;
49
+ }
52
50
  export declare function formatAgentUsageTokenCount(value: number): string;
53
51
  export declare function formatAgentUsageFooter(usage: AgentUsageSnapshot): string;
54
52
  export declare function formatAgentUsageTooltip(usage: AgentUsageSnapshot): string;
@@ -88,4 +86,7 @@ export interface ChatThreadPreviewProps {
88
86
  className?: string;
89
87
  }
90
88
  export declare function ChatThreadPreview({ room, path, className }: ChatThreadPreviewProps): ReactElement;
91
- export declare function AgentThread({ room, path, chatClient, disposeChatClient, agentName, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, collapseMessages, suggestions, enableFileUpload, persistedEvents, deferLiveEvents, loadThread, injectPersistedEvents, composerDisabled: composerDisabledProp, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, }: AgentThreadProps): ReactElement;
89
+ export declare function AgentThreadProvider({ children, room, path, chatClient, disposeChatClient, agentName, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, collapseMessages, enableFileUpload, persistedEvents, deferLiveEvents, loadThread, injectPersistedEvents, composerDisabled: composerDisabledProp, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, }: AgentThreadProviderProps): ReactElement;
90
+ export declare function AgentThreadFeed(): ReactElement;
91
+ export declare function AgentThreadInput(): ReactElement;
92
+ export declare function AgentThread(props: AgentThreadProps): ReactElement;
@@ -1,5 +1,5 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { ErrorContent } from "@meshagent/meshagent";
4
4
  import {
5
5
  AgentClientToolCallRequested,
@@ -40,6 +40,7 @@ class AgentToolChoice {
40
40
  return { toolkit_name: this.toolkitName, tool_name: this.toolName };
41
41
  }
42
42
  }
43
+ const AgentThreadContext = createContext(null);
43
44
  function stringValue(value) {
44
45
  return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
45
46
  }
@@ -109,47 +110,6 @@ function canRenderAsFinalAnswer(message) {
109
110
  function isChatFeedWidgetCall(message, chatFeedWidgetsByName) {
110
111
  return message.kind === "tool_call" && message.toolkit === "client" && message.tool != null && chatFeedWidgetsByName.has(message.tool);
111
112
  }
112
- function isFollowUpSuggestionCall(message, chatFeedWidgetsByName) {
113
- if (!isChatFeedWidgetCall(message, chatFeedWidgetsByName) || message.tool == null) {
114
- return false;
115
- }
116
- return chatFeedWidgetsByName.get(message.tool)?.getFollowUpSuggestions != null;
117
- }
118
- function latestTurnFollowUpSuggestions(messages, chatFeedWidgetsByName) {
119
- let latestUserIndex = -1;
120
- for (let index = messages.length - 1; index >= 0; index -= 1) {
121
- const message = messages[index];
122
- if (message.kind === "message" && message.role === "user") {
123
- latestUserIndex = index;
124
- break;
125
- }
126
- }
127
- if (latestUserIndex === -1) {
128
- return null;
129
- }
130
- const latestTurnMessages = messages.slice(latestUserIndex + 1);
131
- if (!latestTurnMessages.some(canRenderAsFinalAnswer)) {
132
- return [];
133
- }
134
- for (let index = latestTurnMessages.length - 1; index >= 0; index -= 1) {
135
- const message = latestTurnMessages[index];
136
- if (message.kind !== "tool_call" || message.state !== "completed" || message.tool == null || !isFollowUpSuggestionCall(message, chatFeedWidgetsByName)) {
137
- continue;
138
- }
139
- const widget = chatFeedWidgetsByName.get(message.tool);
140
- try {
141
- return widget?.getFollowUpSuggestions?.({
142
- status: "completed",
143
- input: message.input ?? {},
144
- output: message.output
145
- }) ?? [];
146
- } catch (error) {
147
- console.error("ChatFeedWidget follow-up suggestion extraction failed", error);
148
- return [];
149
- }
150
- }
151
- return [];
152
- }
153
113
  function isIntrinsicDetail(message, chatFeedWidgetsByName) {
154
114
  return message.kind === "reasoning" || message.kind === "event" || message.kind === "tool_call" && message.failed !== true && !isChatFeedWidgetCall(message, chatFeedWidgetsByName) || canCollapseAsCommentary(message) && message.phase === "commentary";
155
115
  }
@@ -762,7 +722,8 @@ function processClientToolRequests({
762
722
  })();
763
723
  }
764
724
  }
765
- function AgentThread({
725
+ function AgentThreadProvider({
726
+ children,
766
727
  room,
767
728
  path,
768
729
  chatClient,
@@ -774,7 +735,6 @@ function AgentThread({
774
735
  clientTools,
775
736
  chatFeedWidgets,
776
737
  collapseMessages = true,
777
- suggestions,
778
738
  enableFileUpload = false,
779
739
  persistedEvents,
780
740
  deferLiveEvents = false,
@@ -1075,13 +1035,9 @@ function AgentThread({
1075
1035
  };
1076
1036
  }), [clientToolCallOverrides, session, timeline]);
1077
1037
  const showThreadLoading = (deferLiveEvents || session === null || session.isLoading) && timelineItems.length === 0;
1078
- const followUpSuggestions = useMemo(
1079
- () => latestTurnFollowUpSuggestions(timelineItems, chatFeedWidgetsByName),
1080
- [chatFeedWidgetsByName, timelineItems]
1081
- );
1082
1038
  const feedTimelineItems = useMemo(
1083
- () => timelineItems.filter((item) => !isFollowUpSuggestionCall(item, chatFeedWidgetsByName) && !(item.kind === "tool_call" && item.toolkit === "client" && item.tool != null && clientToolsByName.has(item.tool))),
1084
- [chatFeedWidgetsByName, clientToolsByName, timelineItems]
1039
+ () => timelineItems.filter((item) => !(item.kind === "tool_call" && item.toolkit === "client" && item.tool != null && clientToolsByName.has(item.tool))),
1040
+ [clientToolsByName, timelineItems]
1085
1041
  );
1086
1042
  const renderedItems = useMemo(() => collapseMessages ? groupThreadItems(feedTimelineItems, chatFeedWidgetsByName) : feedTimelineItems, [chatFeedWidgetsByName, collapseMessages, feedTimelineItems]);
1087
1043
  const status = useMemo(() => {
@@ -1155,21 +1111,7 @@ function AgentThread({
1155
1111
  setSendError(describeError(error));
1156
1112
  }
1157
1113
  }, [agentParticipant, chatClient, resolvedClientToolkits, localParticipantName, status?.mode, turnId]);
1158
- const visibleSuggestions = useMemo(
1159
- () => (followUpSuggestions ?? suggestions ?? []).filter((suggestion) => suggestion.label.trim() !== ""),
1160
- [followUpSuggestions, suggestions]
1161
- );
1162
1114
  const composerDisabled = composerDisabledProp || loadThread && !restorationReadyRef.current || injectPersistedEvents && restoredPathRef.current !== path || agentParticipant == null && chatClient == null;
1163
- const handleSuggestionClick = useCallback((suggestion) => {
1164
- const text = suggestion.prompt?.trim() || suggestion.label.trim();
1165
- if (text === "") {
1166
- return;
1167
- }
1168
- void handleSend(new ChatMessage({
1169
- id: uuidV4(),
1170
- text
1171
- }));
1172
- }, [handleSend]);
1173
1115
  const handleWidgetMessage = useCallback((message) => {
1174
1116
  const text = message.trim();
1175
1117
  if (text === "" || composerDisabled) {
@@ -1187,7 +1129,67 @@ function AgentThread({
1187
1129
  }
1188
1130
  await openSession.interruptTurn(turnId);
1189
1131
  }, [turnId]);
1190
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-1 flex-col", children: [
1132
+ return /* @__PURE__ */ jsx(AgentThreadContext.Provider, { value: {
1133
+ room,
1134
+ agentName,
1135
+ emptyStateTitle,
1136
+ emptyStateDescription,
1137
+ chatFeedWidgetsByName,
1138
+ timelineItems,
1139
+ renderedItemsNewestFirst,
1140
+ firstRenderedItemId,
1141
+ lastRenderedItemId,
1142
+ previousItemById,
1143
+ showThreadLoading,
1144
+ localParticipantName,
1145
+ status,
1146
+ statusText,
1147
+ canInterruptActiveTurn,
1148
+ restorationError,
1149
+ retryRestoration,
1150
+ handleWidgetMessage,
1151
+ cancelTurn,
1152
+ sendError,
1153
+ composerDisabled,
1154
+ handleSend,
1155
+ attachments,
1156
+ setAttachments,
1157
+ selectAttachments,
1158
+ enableFileUpload: enableFileUpload && room != null,
1159
+ inputAvailable: agentParticipant != null || chatClient != null,
1160
+ usage
1161
+ }, children });
1162
+ }
1163
+ function useAgentThreadContext(componentName) {
1164
+ const context = useContext(AgentThreadContext);
1165
+ if (context == null) {
1166
+ throw new Error(`${componentName} must be rendered inside AgentThreadProvider.`);
1167
+ }
1168
+ return context;
1169
+ }
1170
+ function AgentThreadFeed() {
1171
+ const {
1172
+ room,
1173
+ agentName,
1174
+ emptyStateTitle,
1175
+ emptyStateDescription,
1176
+ chatFeedWidgetsByName,
1177
+ timelineItems,
1178
+ renderedItemsNewestFirst,
1179
+ firstRenderedItemId,
1180
+ lastRenderedItemId,
1181
+ previousItemById,
1182
+ showThreadLoading,
1183
+ localParticipantName,
1184
+ status,
1185
+ statusText,
1186
+ canInterruptActiveTurn,
1187
+ restorationError,
1188
+ retryRestoration,
1189
+ handleWidgetMessage,
1190
+ cancelTurn
1191
+ } = useAgentThreadContext("AgentThreadFeed");
1192
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1191
1193
  /* @__PURE__ */ jsxs("div", { className: "relative flex h-full min-h-0 flex-1 flex-col", children: [
1192
1194
  showThreadLoading ? /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(LoadingState, {}) }) : timelineItems.length === 0 ? /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ jsx(EmptyState, { title: emptyStateTitle, description: emptyStateDescription }) }) : /* @__PURE__ */ jsx(
1193
1195
  ChatScroller,
@@ -1238,28 +1240,25 @@ function AgentThread({
1238
1240
  message: restorationError,
1239
1241
  onRetry: retryRestoration
1240
1242
  }
1241
- ) }) : null,
1243
+ ) }) : null
1244
+ ] });
1245
+ }
1246
+ function AgentThreadInput() {
1247
+ const {
1248
+ agentName,
1249
+ sendError,
1250
+ composerDisabled,
1251
+ handleSend,
1252
+ attachments,
1253
+ setAttachments,
1254
+ selectAttachments,
1255
+ enableFileUpload,
1256
+ inputAvailable,
1257
+ usage
1258
+ } = useAgentThreadContext("AgentThreadInput");
1259
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1242
1260
  sendError ? /* @__PURE__ */ jsx("div", { className: "px-4 pb-2", children: /* @__PURE__ */ jsx(ErrorBanner, { message: sendError }) }) : null,
1243
1261
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
1244
- visibleSuggestions.length > 0 ? /* @__PURE__ */ jsx(
1245
- "ul",
1246
- {
1247
- "aria-label": "Follow-up suggestions",
1248
- className: "mx-auto flex w-full max-w-[912px] flex-wrap gap-2 px-4 pt-2 pb-1",
1249
- children: visibleSuggestions.map((suggestion, index) => /* @__PURE__ */ jsx("li", { className: "min-w-0 max-w-full", children: /* @__PURE__ */ jsx(
1250
- Button,
1251
- {
1252
- type: "button",
1253
- variant: "outline",
1254
- className: "h-auto min-h-8 max-w-full overflow-hidden rounded-full px-3 py-1.5 text-left text-sm leading-snug",
1255
- title: suggestion.label,
1256
- disabled: composerDisabled,
1257
- onClick: () => handleSuggestionClick(suggestion),
1258
- children: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: suggestion.label })
1259
- }
1260
- ) }, index))
1261
- }
1262
- ) : null,
1263
1262
  /* @__PURE__ */ jsx(
1264
1263
  ChatInput,
1265
1264
  {
@@ -1267,17 +1266,26 @@ function AgentThread({
1267
1266
  attachments,
1268
1267
  onFilesSelected: selectAttachments,
1269
1268
  setAttachments,
1270
- enableFileUpload: enableFileUpload && room != null,
1269
+ enableFileUpload,
1271
1270
  disabled: composerDisabled,
1272
- placeholder: agentParticipant || chatClient ? "Type a message" : `Waiting for ${displayParticipantName(agentName)}`
1271
+ placeholder: inputAvailable ? "Type a message" : `Waiting for ${displayParticipantName(agentName)}`
1273
1272
  }
1274
1273
  ),
1275
1274
  /* @__PURE__ */ jsx(AgentUsageFooter, { usage, className: "mx-auto w-full max-w-[912px]" })
1276
1275
  ] })
1277
1276
  ] });
1278
1277
  }
1278
+ function AgentThread(props) {
1279
+ return /* @__PURE__ */ jsx(AgentThreadProvider, { ...props, children: /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-1 flex-col", children: [
1280
+ /* @__PURE__ */ jsx(AgentThreadFeed, {}),
1281
+ /* @__PURE__ */ jsx(AgentThreadInput, {})
1282
+ ] }) });
1283
+ }
1279
1284
  export {
1280
1285
  AgentThread,
1286
+ AgentThreadFeed,
1287
+ AgentThreadInput,
1288
+ AgentThreadProvider,
1281
1289
  AgentToolChoice,
1282
1290
  AgentUsageFooter,
1283
1291
  AgentUsageSnapshot,
@@ -2,7 +2,6 @@ import type { ReactElement } from "react";
2
2
  import { Tool } from "@meshagent/meshagent";
3
3
  import type { Content } from "@meshagent/meshagent";
4
4
  import { ClientToolkitDescription } from "@meshagent/meshagent-agents";
5
- import type { AgentThreadSuggestion } from "./agent-thread.js";
6
5
  export type ToolCallStatus = "queued" | "in_progress" | "completed" | "failed";
7
6
  export interface ToolCall {
8
7
  status: ToolCallStatus;
@@ -12,6 +11,5 @@ export interface ToolCall {
12
11
  }
13
12
  export declare abstract class ChatFeedWidget extends Tool {
14
13
  abstract render(toolCall: ToolCall): ReactElement | null;
15
- getFollowUpSuggestions?(toolCall: ToolCall): readonly AgentThreadSuggestion[];
16
14
  }
17
15
  export declare function resolveClientToolkitDescriptions(clientToolkits: readonly ClientToolkitDescription[] | undefined, chatFeedWidgets: readonly ChatFeedWidget[] | undefined, clientTools?: readonly Tool[]): ClientToolkitDescription[] | undefined;
@@ -2,7 +2,7 @@ import type { ReactElement } from "react";
2
2
  import type { RoomClient, Tool } from "@meshagent/meshagent";
3
3
  import { AgentMessageEvent, BaseChatClient } from "@meshagent/meshagent-agents";
4
4
  import type { AgentMessage as AgentMessageType, AgentMessageEvent as AgentMessageEventType, ClientToolkitDescription } from "@meshagent/meshagent-agents";
5
- import { type AgentThreadSuggestion, type AgentToolChoice } from "./agent-thread.js";
5
+ import { type AgentToolChoice } from "./agent-thread.js";
6
6
  import type { ChatFeedWidget } from "./chat-feed-widget.js";
7
7
  export type DatasetThreadRow = Record<string, unknown>;
8
8
  export type DatasetThreadRows = Iterable<DatasetThreadRow>;
@@ -30,7 +30,6 @@ export interface DatasetAgentThreadProps {
30
30
  chatFeedWidgets?: readonly ChatFeedWidget[];
31
31
  toolChoice?: AgentToolChoice;
32
32
  collapseMessages?: boolean;
33
- suggestions?: readonly AgentThreadSuggestion[];
34
33
  enableFileUpload?: boolean;
35
34
  retryMissingTableMs?: number;
36
35
  loadThread?: boolean;
@@ -44,7 +43,7 @@ export interface DatasetAgentThreadProps {
44
43
  export type RoomDatasetAgentThreadProps = Omit<DatasetAgentThreadProps, "room" | "rowsLoader"> & {
45
44
  room: RoomClient;
46
45
  };
47
- export declare function DatasetAgentThread({ room, path, chatClient, disposeChatClient, agentName, rowsLoader, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, collapseMessages, suggestions, enableFileUpload, retryMissingTableMs, loadThread, injectPersistedEvents, composerDisabled, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, }: DatasetAgentThreadProps): ReactElement;
46
+ export declare function DatasetAgentThread({ room, path, chatClient, disposeChatClient, agentName, rowsLoader, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, collapseMessages, enableFileUpload, retryMissingTableMs, loadThread, injectPersistedEvents, composerDisabled, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, }: DatasetAgentThreadProps): ReactElement;
48
47
  export declare function RoomDatasetAgentThread(props: RoomDatasetAgentThreadProps): ReactElement;
49
48
  export declare function parseDatasetThreadRef(path: string): DatasetThreadRef;
50
49
  export declare function loadDatasetThreadEvents(loader: DatasetThreadRowsLoader, args: DatasetThreadRowsLoaderArgs): Promise<AgentMessageEvent[]>;
@@ -20,7 +20,6 @@ function DatasetAgentThread({
20
20
  chatFeedWidgets,
21
21
  toolChoice,
22
22
  collapseMessages,
23
- suggestions,
24
23
  enableFileUpload = false,
25
24
  retryMissingTableMs = 500,
26
25
  loadThread = true,
@@ -105,7 +104,6 @@ function DatasetAgentThread({
105
104
  chatFeedWidgets,
106
105
  toolChoice,
107
106
  collapseMessages,
108
- suggestions,
109
107
  enableFileUpload: enableFileUpload && room != null,
110
108
  persistedEvents: persistedEvents ?? [],
111
109
  deferLiveEvents: persistedEvents == null,
@@ -1,7 +1,7 @@
1
1
  import type { ReactElement } from "react";
2
2
  import type { RoomClient, Tool } from "@meshagent/meshagent";
3
3
  import type { AgentMessageEvent, BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
4
- import type { AgentThreadSuggestion, AgentToolChoice } from "./agent-thread.js";
4
+ import type { AgentToolChoice } from "./agent-thread.js";
5
5
  import type { ChatFeedWidget } from "./chat-feed-widget.js";
6
6
  export type MultiThreadContentBuilder = (threadPath: string) => ReactElement;
7
7
  export interface MultiThreadViewProps {
@@ -23,8 +23,7 @@ export interface MultiThreadViewProps {
23
23
  clientTools?: readonly Tool[];
24
24
  chatFeedWidgets?: readonly ChatFeedWidget[];
25
25
  toolChoice?: AgentToolChoice;
26
- suggestions?: readonly AgentThreadSuggestion[];
27
26
  enableFileUpload?: boolean;
28
27
  onThreadStarted?: (threadId: string, events: readonly AgentMessageEvent[]) => Promise<void> | void;
29
28
  }
30
- export declare function MultiThreadView({ room, chatClient, disposeChatClient, agentName, builder, toolkit, tool, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, suggestions, enableFileUpload, onThreadStarted, }: MultiThreadViewProps): ReactElement;
29
+ export declare function MultiThreadView({ room, chatClient, disposeChatClient, agentName, builder, toolkit, tool, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, enableFileUpload, onThreadStarted, }: MultiThreadViewProps): ReactElement;
@@ -24,7 +24,6 @@ function MultiThreadView({
24
24
  clientTools,
25
25
  chatFeedWidgets,
26
26
  toolChoice,
27
- suggestions,
28
27
  enableFileUpload = false,
29
28
  onThreadStarted
30
29
  }) {
@@ -79,7 +78,6 @@ function MultiThreadView({
79
78
  clientTools,
80
79
  chatFeedWidgets,
81
80
  toolChoice,
82
- suggestions,
83
81
  enableFileUpload,
84
82
  onThreadStarted
85
83
  },
@@ -2,7 +2,7 @@ import type { ReactElement } from "react";
2
2
  import { RoomClient } from "@meshagent/meshagent";
3
3
  import type { Tool } from "@meshagent/meshagent";
4
4
  import type { AgentMessageEvent, BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
5
- import type { AgentThreadSuggestion, AgentToolChoice } from "./agent-thread.js";
5
+ import type { AgentToolChoice } from "./agent-thread.js";
6
6
  import type { ChatFeedWidget } from "./chat-feed-widget.js";
7
7
  export type NewChatThreadBuilder = (threadPath: string) => ReactElement;
8
8
  export interface NewChatThreadProps {
@@ -23,8 +23,7 @@ export interface NewChatThreadProps {
23
23
  clientTools?: readonly Tool[];
24
24
  chatFeedWidgets?: readonly ChatFeedWidget[];
25
25
  toolChoice?: AgentToolChoice;
26
- suggestions?: readonly AgentThreadSuggestion[];
27
26
  enableFileUpload?: boolean;
28
27
  onThreadStarted?: (threadId: string, events: readonly AgentMessageEvent[]) => Promise<void> | void;
29
28
  }
30
- export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, suggestions, enableFileUpload, onThreadStarted, }: NewChatThreadProps): ReactElement;
29
+ export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, enableFileUpload, onThreadStarted, }: NewChatThreadProps): ReactElement;
@@ -4,7 +4,6 @@ import { AgentFileContent, MessagingChatClient } from "@meshagent/meshagent-agen
4
4
  import { resolveClientToolkitDescriptions } from "./chat-feed-widget.js";
5
5
  import { defaultThreadDisplayNameFromPath } from "./conversation-descriptor.js";
6
6
  import { ChatInput } from "./chat-input.js";
7
- import { Button } from "../components/ui/button.js";
8
7
  import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment.js";
9
8
  import { Toaster } from "../components/ui/sonner.js";
10
9
  class NewThreadCancelledError extends Error {
@@ -83,7 +82,6 @@ function NewChatThread({
83
82
  clientTools,
84
83
  chatFeedWidgets,
85
84
  toolChoice,
86
- suggestions,
87
85
  enableFileUpload = false,
88
86
  onThreadStarted
89
87
  }) {
@@ -240,54 +238,26 @@ function NewChatThread({
240
238
  return displayParticipantName(targetAgent ? getParticipantName(targetAgent) : null);
241
239
  }, [activeChatClient, agentName, clientVersion, room]);
242
240
  const pendingStatusText = waitingForAgent ? `Waiting for ${targetAgentLabel} to be ready.` : creatingNewThread ? `Starting a thread with ${targetAgentLabel}.` : null;
243
- const visibleSuggestions = useMemo(
244
- () => (suggestions ?? []).filter((suggestion) => suggestion.label.trim() !== ""),
245
- [suggestions]
246
- );
247
241
  if (activePath !== null) {
248
242
  return builder(activePath);
249
243
  }
250
- const composer = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
251
- visibleSuggestions.length > 0 ? /* @__PURE__ */ jsx(
252
- "ul",
253
- {
254
- "aria-label": "Starter suggestions",
255
- className: "mx-auto flex w-full max-w-[912px] flex-wrap gap-2 px-4 pt-2 pb-1",
256
- children: visibleSuggestions.map((suggestion, index) => {
257
- const text = suggestion.prompt?.trim() || suggestion.label.trim();
258
- return /* @__PURE__ */ jsx("li", { className: "min-w-0 max-w-full", children: /* @__PURE__ */ jsx(
259
- Button,
260
- {
261
- type: "button",
262
- variant: "outline",
263
- className: "h-auto min-h-8 max-w-full overflow-hidden rounded-full px-3 py-1.5 text-left text-sm leading-snug",
264
- title: suggestion.label,
265
- disabled: creatingNewThread || waitingForAgent,
266
- onClick: () => void handleCreateThread({ text }),
267
- children: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: suggestion.label })
268
- }
269
- ) }, index);
270
- })
271
- }
272
- ) : null,
273
- /* @__PURE__ */ jsx(
274
- ChatInput,
275
- {
276
- onSubmit: handleCreateThread,
277
- attachments: newThreadAttachments,
278
- onFilesSelected: selectNewThreadAttachments,
279
- setAttachments: setNewThreadAttachments,
280
- enableFileUpload: enableFileUpload && room != null,
281
- value: newThreadDraft,
282
- onValueChange: setNewThreadDraft,
283
- clearOnSubmit: false,
284
- showCancelButton: creatingNewThread || waitingForAgent,
285
- onCancelRequest: cancelPendingNewThread,
286
- disabled: creatingNewThread || waitingForAgent,
287
- placeholder: agentName.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
288
- }
289
- )
290
- ] });
244
+ const composer = /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx(
245
+ ChatInput,
246
+ {
247
+ onSubmit: handleCreateThread,
248
+ attachments: newThreadAttachments,
249
+ onFilesSelected: selectNewThreadAttachments,
250
+ setAttachments: setNewThreadAttachments,
251
+ enableFileUpload: enableFileUpload && room != null,
252
+ value: newThreadDraft,
253
+ onValueChange: setNewThreadDraft,
254
+ clearOnSubmit: false,
255
+ showCancelButton: creatingNewThread || waitingForAgent,
256
+ onCancelRequest: cancelPendingNewThread,
257
+ disabled: creatingNewThread || waitingForAgent,
258
+ placeholder: agentName.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
259
+ }
260
+ ) });
291
261
  return /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-1 flex-col", children: [
292
262
  centerComposer ? /* @__PURE__ */ jsx("div", { className: "flex min-h-0 flex-1 items-center justify-center px-4 py-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-[912px] space-y-5", children: [
293
263
  /* @__PURE__ */ jsxs("div", { className: "space-y-2 text-center", children: [
@@ -1,7 +1,7 @@
1
1
  import type { ReactElement } from "react";
2
2
  import type { RoomClient, Tool } from "@meshagent/meshagent";
3
3
  import type { AgentMessage, AgentMessageEvent, BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
4
- import type { AgentThreadSuggestion, AgentToolChoice } from "./agent-thread.js";
4
+ import type { AgentToolChoice } from "./agent-thread.js";
5
5
  import { ChatThreadDisplayMode } from "./conversation-descriptor.js";
6
6
  import type { DatasetThreadRowsLoader } from "./dataset-agent-thread.js";
7
7
  import type { ChatFeedWidget } from "./chat-feed-widget.js";
@@ -29,7 +29,6 @@ export interface ThreadViewProps {
29
29
  chatFeedWidgets?: readonly ChatFeedWidget[];
30
30
  toolChoice?: AgentToolChoice;
31
31
  collapseMessages?: boolean;
32
- suggestions?: readonly AgentThreadSuggestion[];
33
32
  enableFileUpload?: boolean;
34
33
  threadSource?: "session" | "dataset";
35
34
  rowsLoader?: DatasetThreadRowsLoader;
@@ -43,4 +42,4 @@ export interface ThreadViewProps {
43
42
  onEventsChanged?: (threadId: string, events: readonly AgentMessageEvent[], latestMessage: AgentMessage | null) => void;
44
43
  onThreadStarted?: (threadId: string, events: readonly AgentMessageEvent[]) => Promise<void> | void;
45
44
  }
46
- export declare function ThreadView({ room, chatClient, path, documentPath, agentName, threadDisplayMode, threadDir, toolkit, tool, centerComposer, emptyStateTitle, emptyStateDescription, startNewThreadTitle, startNewThreadDescription, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, clientToolkits, clientTools, chatFeedWidgets, toolChoice, collapseMessages, suggestions, enableFileUpload, threadSource, rowsLoader, persistedEvents, loadThread, injectPersistedEvents, composerDisabled, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, onThreadStarted, }: ThreadViewProps): ReactElement;
45
+ export declare function ThreadView({ room, chatClient, path, documentPath, agentName, threadDisplayMode, threadDir, toolkit, tool, centerComposer, emptyStateTitle, emptyStateDescription, startNewThreadTitle, startNewThreadDescription, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, clientToolkits, clientTools, chatFeedWidgets, toolChoice, collapseMessages, enableFileUpload, threadSource, rowsLoader, persistedEvents, loadThread, injectPersistedEvents, composerDisabled, closeThreadOnUnmount, onPersistedEventsInjectionStarted, onPersistedEventsInjected, onEventsChanged, onThreadStarted, }: ThreadViewProps): ReactElement;
@@ -50,7 +50,6 @@ function ThreadView({
50
50
  chatFeedWidgets,
51
51
  toolChoice,
52
52
  collapseMessages = true,
53
- suggestions,
54
53
  enableFileUpload = false,
55
54
  threadSource = "session",
56
55
  rowsLoader,
@@ -91,7 +90,6 @@ function ThreadView({
91
90
  chatFeedWidgets,
92
91
  toolChoice,
93
92
  collapseMessages,
94
- suggestions,
95
93
  enableFileUpload,
96
94
  loadThread,
97
95
  injectPersistedEvents,
@@ -118,7 +116,6 @@ function ThreadView({
118
116
  chatFeedWidgets,
119
117
  toolChoice,
120
118
  collapseMessages,
121
- suggestions,
122
119
  enableFileUpload,
123
120
  persistedEvents,
124
121
  loadThread,
@@ -152,7 +149,6 @@ function ThreadView({
152
149
  clientTools,
153
150
  chatFeedWidgets,
154
151
  toolChoice,
155
- suggestions,
156
152
  enableFileUpload,
157
153
  onThreadStarted,
158
154
  builder: (threadPath) => threadSource === "dataset" ? /* @__PURE__ */ jsx(
@@ -171,7 +167,6 @@ function ThreadView({
171
167
  chatFeedWidgets,
172
168
  toolChoice,
173
169
  collapseMessages,
174
- suggestions,
175
170
  enableFileUpload,
176
171
  loadThread,
177
172
  injectPersistedEvents,
@@ -196,7 +191,6 @@ function ThreadView({
196
191
  chatFeedWidgets,
197
192
  toolChoice,
198
193
  collapseMessages,
199
- suggestions,
200
194
  enableFileUpload,
201
195
  persistedEvents,
202
196
  loadThread,
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import * as LabelPrimitive from "@radix-ui/react-label";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
4
  import { type ControllerProps, type FieldPath, type FieldValues } from "react-hook-form";
5
- declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
5
+ declare const Form: <TFieldValues extends FieldValues, TContext = any, TTransformedValues = TFieldValues>({ children, watch, getValues, getErrors, getFieldState, setError, clearErrors, setValue, setValues, trigger, formState, resetField, reset, resetDefaultValues, handleSubmit, unregister, control, register, setFocus, subscribe, }: import("react-hook-form").FormProviderProps<TFieldValues, TContext, TTransformedValues>) => React.JSX.Element;
6
6
  declare const FormField: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ ...props }: ControllerProps<TFieldValues, TName>) => React.JSX.Element;
7
7
  declare const useFormField: () => {
8
8
  invalid: boolean;