@meshagent/meshagent-tailwind 0.50.0 → 0.51.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/CHANGELOG.md +8 -0
- package/README.md +30 -0
- package/dist/cjs/chat/agent-thread.d.ts +8 -7
- package/dist/cjs/chat/agent-thread.js +94 -86
- package/dist/cjs/chat/chat-feed-widget.d.ts +0 -2
- package/dist/cjs/chat/dataset-agent-thread.d.ts +2 -3
- package/dist/cjs/chat/dataset-agent-thread.js +0 -2
- package/dist/cjs/chat/multi-thread-view.d.ts +2 -3
- package/dist/cjs/chat/multi-thread-view.js +0 -2
- package/dist/cjs/chat/new-chat-thread.d.ts +2 -3
- package/dist/cjs/chat/new-chat-thread.js +17 -47
- package/dist/cjs/chat/thread-view.d.ts +2 -3
- package/dist/cjs/chat/thread-view.js +0 -6
- package/dist/cjs/components/ui/form.d.ts +1 -1
- package/dist/esm/chat/agent-thread.d.ts +8 -7
- package/dist/esm/chat/agent-thread.js +96 -88
- package/dist/esm/chat/chat-feed-widget.d.ts +0 -2
- package/dist/esm/chat/dataset-agent-thread.d.ts +2 -3
- package/dist/esm/chat/dataset-agent-thread.js +0 -2
- package/dist/esm/chat/multi-thread-view.d.ts +2 -3
- package/dist/esm/chat/multi-thread-view.js +0 -2
- package/dist/esm/chat/new-chat-thread.d.ts +2 -3
- package/dist/esm/chat/new-chat-thread.js +17 -47
- package/dist/esm/chat/thread-view.d.ts +2 -3
- package/dist/esm/chat/thread-view.js +0 -6
- package/dist/esm/components/ui/form.d.ts +1 -1
- package/dist/index.css +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [0.51.0]
|
|
2
|
+
- Refactored the chat UI to split input from feed, simplifying thread and dataset views and removing suggestion-driven behavior.
|
|
3
|
+
- Updated the JavaScript entrypoint and related tests to match the slimmer chat experience.
|
|
4
|
+
|
|
5
|
+
## [0.50.1]
|
|
6
|
+
- Stability
|
|
7
|
+
|
|
1
8
|
## [0.50.0]
|
|
2
9
|
- Chat clients now support per-turn LLM authorization providers, and websocket chat tokens are optional for `auth=none` deployments.
|
|
3
10
|
- The typed client gained `connectLlm`, optional access-subject IDs, service-account principals, room and service enabled flags, `llm_quota_manager`, and the `router` project settings document.
|
|
@@ -14,6 +21,7 @@
|
|
|
14
21
|
|
|
15
22
|
## [0.48.1]
|
|
16
23
|
- Stability
|
|
24
|
+
- Added composable `AgentThreadProvider`, `AgentThreadFeed`, and `AgentThreadInput` components for layouts that place the conversation feed and composer separately while sharing one thread session.
|
|
17
25
|
|
|
18
26
|
## [0.48.0]
|
|
19
27
|
- Reworked the TS/JS agent chat stack to preserve ordered threaded messages and support injected-message threads across chat clients and process handling.
|
package/README.md
CHANGED
|
@@ -85,6 +85,36 @@ export function AgentChat({
|
|
|
85
85
|
|
|
86
86
|
`ThreadListView` loads and manages the available agent threads. `ThreadView` renders the active thread and can start a new thread when `threadDisplayMode` is `ChatThreadDisplayMode.MultiThreadComposer`.
|
|
87
87
|
|
|
88
|
+
For a known thread, use `AgentThreadProvider` when the feed and composer need to live in separate parts of your layout. The provider owns one shared thread session; `AgentThreadFeed` and `AgentThreadInput` consume that session without opening their own connections:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import {
|
|
92
|
+
AgentThreadFeed,
|
|
93
|
+
AgentThreadInput,
|
|
94
|
+
AgentThreadProvider,
|
|
95
|
+
} from "@meshagent/meshagent-tailwind";
|
|
96
|
+
|
|
97
|
+
export function SeparatedAgentThread({ roomClient, chatClient, threadPath }) {
|
|
98
|
+
return (
|
|
99
|
+
<AgentThreadProvider
|
|
100
|
+
room={roomClient}
|
|
101
|
+
chatClient={chatClient}
|
|
102
|
+
path={threadPath}
|
|
103
|
+
agentName="support-agent"
|
|
104
|
+
>
|
|
105
|
+
<main className="min-h-0 flex-1">
|
|
106
|
+
<AgentThreadFeed />
|
|
107
|
+
</main>
|
|
108
|
+
<footer>
|
|
109
|
+
<AgentThreadInput />
|
|
110
|
+
</footer>
|
|
111
|
+
</AgentThreadProvider>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Keep both connected components beneath the same provider. Use `AgentThread` when the standard combined feed-and-composer layout is sufficient.
|
|
117
|
+
|
|
88
118
|
## Meetings
|
|
89
119
|
|
|
90
120
|
The meeting components use a connected `RoomClient` to request LiveKit credentials before joining a meeting. Wrap `MeetingView` in `MeetingScope` and pass the same room client used by the rest of your app:
|
|
@@ -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
|
|
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;
|
|
@@ -29,6 +29,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var agent_thread_exports = {};
|
|
30
30
|
__export(agent_thread_exports, {
|
|
31
31
|
AgentThread: () => AgentThread,
|
|
32
|
+
AgentThreadFeed: () => AgentThreadFeed,
|
|
33
|
+
AgentThreadInput: () => AgentThreadInput,
|
|
34
|
+
AgentThreadProvider: () => AgentThreadProvider,
|
|
32
35
|
AgentToolChoice: () => AgentToolChoice,
|
|
33
36
|
AgentUsageFooter: () => AgentUsageFooter,
|
|
34
37
|
AgentUsageSnapshot: () => import_chat_thread_timeline2.AgentUsageSnapshot,
|
|
@@ -76,6 +79,7 @@ class AgentToolChoice {
|
|
|
76
79
|
return { toolkit_name: this.toolkitName, tool_name: this.toolName };
|
|
77
80
|
}
|
|
78
81
|
}
|
|
82
|
+
const AgentThreadContext = (0, import_react.createContext)(null);
|
|
79
83
|
function stringValue(value) {
|
|
80
84
|
return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
|
|
81
85
|
}
|
|
@@ -145,47 +149,6 @@ function canRenderAsFinalAnswer(message) {
|
|
|
145
149
|
function isChatFeedWidgetCall(message, chatFeedWidgetsByName) {
|
|
146
150
|
return message.kind === "tool_call" && message.toolkit === "client" && message.tool != null && chatFeedWidgetsByName.has(message.tool);
|
|
147
151
|
}
|
|
148
|
-
function isFollowUpSuggestionCall(message, chatFeedWidgetsByName) {
|
|
149
|
-
if (!isChatFeedWidgetCall(message, chatFeedWidgetsByName) || message.tool == null) {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
return chatFeedWidgetsByName.get(message.tool)?.getFollowUpSuggestions != null;
|
|
153
|
-
}
|
|
154
|
-
function latestTurnFollowUpSuggestions(messages, chatFeedWidgetsByName) {
|
|
155
|
-
let latestUserIndex = -1;
|
|
156
|
-
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
157
|
-
const message = messages[index];
|
|
158
|
-
if (message.kind === "message" && message.role === "user") {
|
|
159
|
-
latestUserIndex = index;
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (latestUserIndex === -1) {
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
166
|
-
const latestTurnMessages = messages.slice(latestUserIndex + 1);
|
|
167
|
-
if (!latestTurnMessages.some(canRenderAsFinalAnswer)) {
|
|
168
|
-
return [];
|
|
169
|
-
}
|
|
170
|
-
for (let index = latestTurnMessages.length - 1; index >= 0; index -= 1) {
|
|
171
|
-
const message = latestTurnMessages[index];
|
|
172
|
-
if (message.kind !== "tool_call" || message.state !== "completed" || message.tool == null || !isFollowUpSuggestionCall(message, chatFeedWidgetsByName)) {
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
const widget = chatFeedWidgetsByName.get(message.tool);
|
|
176
|
-
try {
|
|
177
|
-
return widget?.getFollowUpSuggestions?.({
|
|
178
|
-
status: "completed",
|
|
179
|
-
input: message.input ?? {},
|
|
180
|
-
output: message.output
|
|
181
|
-
}) ?? [];
|
|
182
|
-
} catch (error) {
|
|
183
|
-
console.error("ChatFeedWidget follow-up suggestion extraction failed", error);
|
|
184
|
-
return [];
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return [];
|
|
188
|
-
}
|
|
189
152
|
function isIntrinsicDetail(message, chatFeedWidgetsByName) {
|
|
190
153
|
return message.kind === "reasoning" || message.kind === "event" || message.kind === "tool_call" && message.failed !== true && !isChatFeedWidgetCall(message, chatFeedWidgetsByName) || canCollapseAsCommentary(message) && message.phase === "commentary";
|
|
191
154
|
}
|
|
@@ -798,7 +761,8 @@ function processClientToolRequests({
|
|
|
798
761
|
})();
|
|
799
762
|
}
|
|
800
763
|
}
|
|
801
|
-
function
|
|
764
|
+
function AgentThreadProvider({
|
|
765
|
+
children,
|
|
802
766
|
room,
|
|
803
767
|
path,
|
|
804
768
|
chatClient,
|
|
@@ -810,7 +774,6 @@ function AgentThread({
|
|
|
810
774
|
clientTools,
|
|
811
775
|
chatFeedWidgets,
|
|
812
776
|
collapseMessages = true,
|
|
813
|
-
suggestions,
|
|
814
777
|
enableFileUpload = false,
|
|
815
778
|
persistedEvents,
|
|
816
779
|
deferLiveEvents = false,
|
|
@@ -1111,13 +1074,9 @@ function AgentThread({
|
|
|
1111
1074
|
};
|
|
1112
1075
|
}), [clientToolCallOverrides, session, timeline]);
|
|
1113
1076
|
const showThreadLoading = (deferLiveEvents || session === null || session.isLoading) && timelineItems.length === 0;
|
|
1114
|
-
const followUpSuggestions = (0, import_react.useMemo)(
|
|
1115
|
-
() => latestTurnFollowUpSuggestions(timelineItems, chatFeedWidgetsByName),
|
|
1116
|
-
[chatFeedWidgetsByName, timelineItems]
|
|
1117
|
-
);
|
|
1118
1077
|
const feedTimelineItems = (0, import_react.useMemo)(
|
|
1119
|
-
() => timelineItems.filter((item) => !
|
|
1120
|
-
[
|
|
1078
|
+
() => timelineItems.filter((item) => !(item.kind === "tool_call" && item.toolkit === "client" && item.tool != null && clientToolsByName.has(item.tool))),
|
|
1079
|
+
[clientToolsByName, timelineItems]
|
|
1121
1080
|
);
|
|
1122
1081
|
const renderedItems = (0, import_react.useMemo)(() => collapseMessages ? groupThreadItems(feedTimelineItems, chatFeedWidgetsByName) : feedTimelineItems, [chatFeedWidgetsByName, collapseMessages, feedTimelineItems]);
|
|
1123
1082
|
const status = (0, import_react.useMemo)(() => {
|
|
@@ -1191,21 +1150,7 @@ function AgentThread({
|
|
|
1191
1150
|
setSendError(describeError(error));
|
|
1192
1151
|
}
|
|
1193
1152
|
}, [agentParticipant, chatClient, resolvedClientToolkits, localParticipantName, status?.mode, turnId]);
|
|
1194
|
-
const visibleSuggestions = (0, import_react.useMemo)(
|
|
1195
|
-
() => (followUpSuggestions ?? suggestions ?? []).filter((suggestion) => suggestion.label.trim() !== ""),
|
|
1196
|
-
[followUpSuggestions, suggestions]
|
|
1197
|
-
);
|
|
1198
1153
|
const composerDisabled = composerDisabledProp || loadThread && !restorationReadyRef.current || injectPersistedEvents && restoredPathRef.current !== path || agentParticipant == null && chatClient == null;
|
|
1199
|
-
const handleSuggestionClick = (0, import_react.useCallback)((suggestion) => {
|
|
1200
|
-
const text = suggestion.prompt?.trim() || suggestion.label.trim();
|
|
1201
|
-
if (text === "") {
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
void handleSend(new import_chat_message.ChatMessage({
|
|
1205
|
-
id: (0, import_uuid.v4)(),
|
|
1206
|
-
text
|
|
1207
|
-
}));
|
|
1208
|
-
}, [handleSend]);
|
|
1209
1154
|
const handleWidgetMessage = (0, import_react.useCallback)((message) => {
|
|
1210
1155
|
const text = message.trim();
|
|
1211
1156
|
if (text === "" || composerDisabled) {
|
|
@@ -1223,7 +1168,67 @@ function AgentThread({
|
|
|
1223
1168
|
}
|
|
1224
1169
|
await openSession.interruptTurn(turnId);
|
|
1225
1170
|
}, [turnId]);
|
|
1226
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentThreadContext.Provider, { value: {
|
|
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
|
+
sendError,
|
|
1192
|
+
composerDisabled,
|
|
1193
|
+
handleSend,
|
|
1194
|
+
attachments,
|
|
1195
|
+
setAttachments,
|
|
1196
|
+
selectAttachments,
|
|
1197
|
+
enableFileUpload: enableFileUpload && room != null,
|
|
1198
|
+
inputAvailable: agentParticipant != null || chatClient != null,
|
|
1199
|
+
usage
|
|
1200
|
+
}, children });
|
|
1201
|
+
}
|
|
1202
|
+
function useAgentThreadContext(componentName) {
|
|
1203
|
+
const context = (0, import_react.useContext)(AgentThreadContext);
|
|
1204
|
+
if (context == null) {
|
|
1205
|
+
throw new Error(`${componentName} must be rendered inside AgentThreadProvider.`);
|
|
1206
|
+
}
|
|
1207
|
+
return context;
|
|
1208
|
+
}
|
|
1209
|
+
function AgentThreadFeed() {
|
|
1210
|
+
const {
|
|
1211
|
+
room,
|
|
1212
|
+
agentName,
|
|
1213
|
+
emptyStateTitle,
|
|
1214
|
+
emptyStateDescription,
|
|
1215
|
+
chatFeedWidgetsByName,
|
|
1216
|
+
timelineItems,
|
|
1217
|
+
renderedItemsNewestFirst,
|
|
1218
|
+
firstRenderedItemId,
|
|
1219
|
+
lastRenderedItemId,
|
|
1220
|
+
previousItemById,
|
|
1221
|
+
showThreadLoading,
|
|
1222
|
+
localParticipantName,
|
|
1223
|
+
status,
|
|
1224
|
+
statusText,
|
|
1225
|
+
canInterruptActiveTurn,
|
|
1226
|
+
restorationError,
|
|
1227
|
+
retryRestoration,
|
|
1228
|
+
handleWidgetMessage,
|
|
1229
|
+
cancelTurn
|
|
1230
|
+
} = useAgentThreadContext("AgentThreadFeed");
|
|
1231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1227
1232
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative flex h-full min-h-0 flex-1 flex-col", children: [
|
|
1228
1233
|
showThreadLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadingState, {}) }) : timelineItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "min-h-0 flex-1 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { title: emptyStateTitle, description: emptyStateDescription }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1229
1234
|
import_chat_scroller.ChatScroller,
|
|
@@ -1274,28 +1279,25 @@ function AgentThread({
|
|
|
1274
1279
|
message: restorationError,
|
|
1275
1280
|
onRetry: retryRestoration
|
|
1276
1281
|
}
|
|
1277
|
-
) }) : null
|
|
1282
|
+
) }) : null
|
|
1283
|
+
] });
|
|
1284
|
+
}
|
|
1285
|
+
function AgentThreadInput() {
|
|
1286
|
+
const {
|
|
1287
|
+
agentName,
|
|
1288
|
+
sendError,
|
|
1289
|
+
composerDisabled,
|
|
1290
|
+
handleSend,
|
|
1291
|
+
attachments,
|
|
1292
|
+
setAttachments,
|
|
1293
|
+
selectAttachments,
|
|
1294
|
+
enableFileUpload,
|
|
1295
|
+
inputAvailable,
|
|
1296
|
+
usage
|
|
1297
|
+
} = useAgentThreadContext("AgentThreadInput");
|
|
1298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1278
1299
|
sendError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-4 pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBanner, { message: sendError }) }) : null,
|
|
1279
1300
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1280
|
-
visibleSuggestions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1281
|
-
"ul",
|
|
1282
|
-
{
|
|
1283
|
-
"aria-label": "Follow-up suggestions",
|
|
1284
|
-
className: "mx-auto flex w-full max-w-[912px] flex-wrap gap-2 px-4 pt-2 pb-1",
|
|
1285
|
-
children: visibleSuggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { className: "min-w-0 max-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1286
|
-
import_button.Button,
|
|
1287
|
-
{
|
|
1288
|
-
type: "button",
|
|
1289
|
-
variant: "outline",
|
|
1290
|
-
className: "h-auto min-h-8 max-w-full overflow-hidden rounded-full px-3 py-1.5 text-left text-sm leading-snug",
|
|
1291
|
-
title: suggestion.label,
|
|
1292
|
-
disabled: composerDisabled,
|
|
1293
|
-
onClick: () => handleSuggestionClick(suggestion),
|
|
1294
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "min-w-0 truncate", children: suggestion.label })
|
|
1295
|
-
}
|
|
1296
|
-
) }, index))
|
|
1297
|
-
}
|
|
1298
|
-
) : null,
|
|
1299
1301
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1300
1302
|
import_chat_input.ChatInput,
|
|
1301
1303
|
{
|
|
@@ -1303,12 +1305,18 @@ function AgentThread({
|
|
|
1303
1305
|
attachments,
|
|
1304
1306
|
onFilesSelected: selectAttachments,
|
|
1305
1307
|
setAttachments,
|
|
1306
|
-
enableFileUpload
|
|
1308
|
+
enableFileUpload,
|
|
1307
1309
|
disabled: composerDisabled,
|
|
1308
|
-
placeholder:
|
|
1310
|
+
placeholder: inputAvailable ? "Type a message" : `Waiting for ${displayParticipantName(agentName)}`
|
|
1309
1311
|
}
|
|
1310
1312
|
),
|
|
1311
1313
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentUsageFooter, { usage, className: "mx-auto w-full max-w-[912px]" })
|
|
1312
1314
|
] })
|
|
1313
1315
|
] });
|
|
1314
1316
|
}
|
|
1317
|
+
function AgentThread(props) {
|
|
1318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentThreadProvider, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex h-full min-h-0 flex-1 flex-col", children: [
|
|
1319
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentThreadFeed, {}),
|
|
1320
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AgentThreadInput, {})
|
|
1321
|
+
] }) });
|
|
1322
|
+
}
|
|
@@ -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
|
|
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,
|
|
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[]>;
|
|
@@ -42,7 +42,6 @@ function DatasetAgentThread({
|
|
|
42
42
|
chatFeedWidgets,
|
|
43
43
|
toolChoice,
|
|
44
44
|
collapseMessages,
|
|
45
|
-
suggestions,
|
|
46
45
|
enableFileUpload = false,
|
|
47
46
|
retryMissingTableMs = 500,
|
|
48
47
|
loadThread = true,
|
|
@@ -127,7 +126,6 @@ function DatasetAgentThread({
|
|
|
127
126
|
chatFeedWidgets,
|
|
128
127
|
toolChoice,
|
|
129
128
|
collapseMessages,
|
|
130
|
-
suggestions,
|
|
131
129
|
enableFileUpload: enableFileUpload && room != null,
|
|
132
130
|
persistedEvents: persistedEvents ?? [],
|
|
133
131
|
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 {
|
|
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,
|
|
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;
|
|
@@ -47,7 +47,6 @@ function MultiThreadView({
|
|
|
47
47
|
clientTools,
|
|
48
48
|
chatFeedWidgets,
|
|
49
49
|
toolChoice,
|
|
50
|
-
suggestions,
|
|
51
50
|
enableFileUpload = false,
|
|
52
51
|
onThreadStarted
|
|
53
52
|
}) {
|
|
@@ -102,7 +101,6 @@ function MultiThreadView({
|
|
|
102
101
|
clientTools,
|
|
103
102
|
chatFeedWidgets,
|
|
104
103
|
toolChoice,
|
|
105
|
-
suggestions,
|
|
106
104
|
enableFileUpload,
|
|
107
105
|
onThreadStarted
|
|
108
106
|
},
|
|
@@ -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 {
|
|
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,
|
|
29
|
+
export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, clientTools, chatFeedWidgets, toolChoice, enableFileUpload, onThreadStarted, }: NewChatThreadProps): ReactElement;
|
|
@@ -27,7 +27,6 @@ var import_meshagent_agents = require("@meshagent/meshagent-agents");
|
|
|
27
27
|
var import_chat_feed_widget = require("./chat-feed-widget.js");
|
|
28
28
|
var import_conversation_descriptor = require("./conversation-descriptor.js");
|
|
29
29
|
var import_chat_input = require("./chat-input.js");
|
|
30
|
-
var import_button = require("../components/ui/button.js");
|
|
31
30
|
var import_file_attachment = require("./file-attachment.js");
|
|
32
31
|
var import_sonner = require("../components/ui/sonner.js");
|
|
33
32
|
class NewThreadCancelledError extends Error {
|
|
@@ -106,7 +105,6 @@ function NewChatThread({
|
|
|
106
105
|
clientTools,
|
|
107
106
|
chatFeedWidgets,
|
|
108
107
|
toolChoice,
|
|
109
|
-
suggestions,
|
|
110
108
|
enableFileUpload = false,
|
|
111
109
|
onThreadStarted
|
|
112
110
|
}) {
|
|
@@ -263,54 +261,26 @@ function NewChatThread({
|
|
|
263
261
|
return displayParticipantName(targetAgent ? getParticipantName(targetAgent) : null);
|
|
264
262
|
}, [activeChatClient, agentName, clientVersion, room]);
|
|
265
263
|
const pendingStatusText = waitingForAgent ? `Waiting for ${targetAgentLabel} to be ready.` : creatingNewThread ? `Starting a thread with ${targetAgentLabel}.` : null;
|
|
266
|
-
const visibleSuggestions = (0, import_react.useMemo)(
|
|
267
|
-
() => (suggestions ?? []).filter((suggestion) => suggestion.label.trim() !== ""),
|
|
268
|
-
[suggestions]
|
|
269
|
-
);
|
|
270
264
|
if (activePath !== null) {
|
|
271
265
|
return builder(activePath);
|
|
272
266
|
}
|
|
273
|
-
const composer = /* @__PURE__ */ (0, import_jsx_runtime.
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "min-w-0 truncate", children: suggestion.label })
|
|
291
|
-
}
|
|
292
|
-
) }, index);
|
|
293
|
-
})
|
|
294
|
-
}
|
|
295
|
-
) : null,
|
|
296
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
297
|
-
import_chat_input.ChatInput,
|
|
298
|
-
{
|
|
299
|
-
onSubmit: handleCreateThread,
|
|
300
|
-
attachments: newThreadAttachments,
|
|
301
|
-
onFilesSelected: selectNewThreadAttachments,
|
|
302
|
-
setAttachments: setNewThreadAttachments,
|
|
303
|
-
enableFileUpload: enableFileUpload && room != null,
|
|
304
|
-
value: newThreadDraft,
|
|
305
|
-
onValueChange: setNewThreadDraft,
|
|
306
|
-
clearOnSubmit: false,
|
|
307
|
-
showCancelButton: creatingNewThread || waitingForAgent,
|
|
308
|
-
onCancelRequest: cancelPendingNewThread,
|
|
309
|
-
disabled: creatingNewThread || waitingForAgent,
|
|
310
|
-
placeholder: agentName.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
|
|
311
|
-
}
|
|
312
|
-
)
|
|
313
|
-
] });
|
|
267
|
+
const composer = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
268
|
+
import_chat_input.ChatInput,
|
|
269
|
+
{
|
|
270
|
+
onSubmit: handleCreateThread,
|
|
271
|
+
attachments: newThreadAttachments,
|
|
272
|
+
onFilesSelected: selectNewThreadAttachments,
|
|
273
|
+
setAttachments: setNewThreadAttachments,
|
|
274
|
+
enableFileUpload: enableFileUpload && room != null,
|
|
275
|
+
value: newThreadDraft,
|
|
276
|
+
onValueChange: setNewThreadDraft,
|
|
277
|
+
clearOnSubmit: false,
|
|
278
|
+
showCancelButton: creatingNewThread || waitingForAgent,
|
|
279
|
+
onCancelRequest: cancelPendingNewThread,
|
|
280
|
+
disabled: creatingNewThread || waitingForAgent,
|
|
281
|
+
placeholder: agentName.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
|
|
282
|
+
}
|
|
283
|
+
) });
|
|
314
284
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "h-full flex flex-1 flex-col", children: [
|
|
315
285
|
centerComposer ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex min-h-0 flex-1 items-center justify-center px-4 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "w-full max-w-[912px] space-y-5", children: [
|
|
316
286
|
/* @__PURE__ */ (0, import_jsx_runtime.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 {
|
|
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,
|
|
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;
|
|
@@ -73,7 +73,6 @@ function ThreadView({
|
|
|
73
73
|
chatFeedWidgets,
|
|
74
74
|
toolChoice,
|
|
75
75
|
collapseMessages = true,
|
|
76
|
-
suggestions,
|
|
77
76
|
enableFileUpload = false,
|
|
78
77
|
threadSource = "session",
|
|
79
78
|
rowsLoader,
|
|
@@ -114,7 +113,6 @@ function ThreadView({
|
|
|
114
113
|
chatFeedWidgets,
|
|
115
114
|
toolChoice,
|
|
116
115
|
collapseMessages,
|
|
117
|
-
suggestions,
|
|
118
116
|
enableFileUpload,
|
|
119
117
|
loadThread,
|
|
120
118
|
injectPersistedEvents,
|
|
@@ -141,7 +139,6 @@ function ThreadView({
|
|
|
141
139
|
chatFeedWidgets,
|
|
142
140
|
toolChoice,
|
|
143
141
|
collapseMessages,
|
|
144
|
-
suggestions,
|
|
145
142
|
enableFileUpload,
|
|
146
143
|
persistedEvents,
|
|
147
144
|
loadThread,
|
|
@@ -175,7 +172,6 @@ function ThreadView({
|
|
|
175
172
|
clientTools,
|
|
176
173
|
chatFeedWidgets,
|
|
177
174
|
toolChoice,
|
|
178
|
-
suggestions,
|
|
179
175
|
enableFileUpload,
|
|
180
176
|
onThreadStarted,
|
|
181
177
|
builder: (threadPath) => threadSource === "dataset" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -194,7 +190,6 @@ function ThreadView({
|
|
|
194
190
|
chatFeedWidgets,
|
|
195
191
|
toolChoice,
|
|
196
192
|
collapseMessages,
|
|
197
|
-
suggestions,
|
|
198
193
|
enableFileUpload,
|
|
199
194
|
loadThread,
|
|
200
195
|
injectPersistedEvents,
|
|
@@ -219,7 +214,6 @@ function ThreadView({
|
|
|
219
214
|
chatFeedWidgets,
|
|
220
215
|
toolChoice,
|
|
221
216
|
collapseMessages,
|
|
222
|
-
suggestions,
|
|
223
217
|
enableFileUpload,
|
|
224
218
|
persistedEvents,
|
|
225
219
|
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;
|