@meshagent/meshagent-tailwind 0.39.9 → 0.40.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/dist/cjs/{ChatBotView.js → chat/chat-bot-view.js} +37 -22
  3. package/dist/cjs/{chat-hooks.d.ts → chat/chat-hooks.d.ts} +5 -1
  4. package/dist/cjs/{chat-hooks.js → chat/chat-hooks.js} +12 -2
  5. package/dist/cjs/{ChatInput.js → chat/chat-input.js} +9 -9
  6. package/dist/cjs/chat/chat-thread.d.ts +12 -0
  7. package/dist/cjs/{ChatThread.js → chat/chat-thread.js} +75 -28
  8. package/dist/cjs/{ChatTypingIndicator.js → chat/chat-typing-indicator.js} +4 -4
  9. package/dist/cjs/chat/dataset-chat-thread.d.ts +13 -0
  10. package/dist/cjs/chat/dataset-chat-thread.js +1840 -0
  11. package/dist/cjs/{FileUploader.js → chat/file-uploader.js} +4 -4
  12. package/dist/cjs/{multi-thread-view.js → chat/multi-thread-view.js} +8 -3
  13. package/dist/cjs/chat/new-chat-thread.d.ts +17 -0
  14. package/dist/cjs/{Chat.js → chat/new-chat-thread.js} +43 -168
  15. package/dist/cjs/{UploadPill.js → chat/upload-pill.js} +5 -5
  16. package/dist/cjs/file-preview/file-preview.d.ts +34 -0
  17. package/dist/cjs/file-preview/file-preview.js +329 -0
  18. package/dist/cjs/forms/email-address.d.ts +10 -0
  19. package/dist/cjs/forms/email-address.js +105 -0
  20. package/dist/cjs/forms/form.d.ts +27 -0
  21. package/dist/cjs/forms/form.js +200 -0
  22. package/dist/cjs/forms/multi-select-autocomplete.d.ts +35 -0
  23. package/dist/cjs/forms/multi-select-autocomplete.js +294 -0
  24. package/dist/cjs/forms/select-users-dialog.d.ts +20 -0
  25. package/dist/cjs/forms/select-users-dialog.js +145 -0
  26. package/dist/cjs/forms/select-users.d.ts +16 -0
  27. package/dist/cjs/forms/select-users.js +117 -0
  28. package/dist/cjs/index.d.ts +19 -11
  29. package/dist/cjs/index.js +19 -11
  30. package/dist/cjs/meetings/audio-visualization.d.ts +7 -0
  31. package/dist/cjs/meetings/audio-visualization.js +74 -0
  32. package/dist/cjs/meetings/controls.d.ts +19 -0
  33. package/dist/cjs/meetings/controls.js +300 -0
  34. package/dist/cjs/meetings/meeting-scope.d.ts +83 -0
  35. package/dist/cjs/meetings/meeting-scope.js +309 -0
  36. package/dist/cjs/meetings/meetings.d.ts +5 -0
  37. package/dist/cjs/meetings/meetings.js +22 -0
  38. package/dist/cjs/meetings/participants.d.ts +13 -0
  39. package/dist/cjs/meetings/participants.js +154 -0
  40. package/dist/cjs/meetings/wake-lock.d.ts +4 -0
  41. package/dist/cjs/meetings/wake-lock.js +55 -0
  42. package/dist/esm/{ChatBotView.js → chat/chat-bot-view.js} +34 -19
  43. package/dist/esm/{chat-hooks.d.ts → chat/chat-hooks.d.ts} +5 -1
  44. package/dist/esm/{chat-hooks.js → chat/chat-hooks.js} +12 -2
  45. package/dist/esm/{ChatInput.js → chat/chat-input.js} +4 -4
  46. package/dist/esm/chat/chat-thread.d.ts +12 -0
  47. package/dist/esm/{ChatThread.js → chat/chat-thread.js} +70 -23
  48. package/dist/esm/{ChatTypingIndicator.js → chat/chat-typing-indicator.js} +1 -1
  49. package/dist/esm/chat/dataset-chat-thread.d.ts +13 -0
  50. package/dist/esm/chat/dataset-chat-thread.js +1815 -0
  51. package/dist/esm/{FileUploader.js → chat/file-uploader.js} +1 -1
  52. package/dist/esm/{multi-thread-view.js → chat/multi-thread-view.js} +8 -3
  53. package/dist/esm/chat/new-chat-thread.d.ts +17 -0
  54. package/dist/esm/{Chat.js → chat/new-chat-thread.js} +40 -165
  55. package/dist/esm/{UploadPill.js → chat/upload-pill.js} +2 -2
  56. package/dist/esm/file-preview/file-preview.d.ts +34 -0
  57. package/dist/esm/file-preview/file-preview.js +316 -0
  58. package/dist/esm/forms/email-address.d.ts +10 -0
  59. package/dist/esm/forms/email-address.js +85 -0
  60. package/dist/esm/forms/form.d.ts +27 -0
  61. package/dist/esm/forms/form.js +193 -0
  62. package/dist/esm/forms/multi-select-autocomplete.d.ts +35 -0
  63. package/dist/esm/forms/multi-select-autocomplete.js +274 -0
  64. package/dist/esm/forms/select-users-dialog.d.ts +20 -0
  65. package/dist/esm/forms/select-users-dialog.js +132 -0
  66. package/dist/esm/forms/select-users.d.ts +16 -0
  67. package/dist/esm/forms/select-users.js +97 -0
  68. package/dist/esm/index.d.ts +19 -11
  69. package/dist/esm/index.js +19 -11
  70. package/dist/esm/meetings/audio-visualization.d.ts +7 -0
  71. package/dist/esm/meetings/audio-visualization.js +54 -0
  72. package/dist/esm/meetings/controls.d.ts +19 -0
  73. package/dist/esm/meetings/controls.js +294 -0
  74. package/dist/esm/meetings/meeting-scope.d.ts +83 -0
  75. package/dist/esm/meetings/meeting-scope.js +294 -0
  76. package/dist/esm/meetings/meetings.d.ts +5 -0
  77. package/dist/esm/meetings/meetings.js +5 -0
  78. package/dist/esm/meetings/participants.d.ts +13 -0
  79. package/dist/esm/meetings/participants.js +137 -0
  80. package/dist/esm/meetings/wake-lock.d.ts +4 -0
  81. package/dist/esm/meetings/wake-lock.js +35 -0
  82. package/dist/index.css +2 -2
  83. package/package.json +7 -4
  84. package/dist/cjs/Chat.d.ts +0 -15
  85. package/dist/cjs/ChatThread.d.ts +0 -21
  86. package/dist/esm/Chat.d.ts +0 -15
  87. package/dist/esm/ChatThread.d.ts +0 -21
  88. /package/dist/cjs/{ChatBotView.d.ts → chat/chat-bot-view.d.ts} +0 -0
  89. /package/dist/cjs/{ChatInput.d.ts → chat/chat-input.d.ts} +0 -0
  90. /package/dist/cjs/{chat-message.d.ts → chat/chat-message.d.ts} +0 -0
  91. /package/dist/cjs/{chat-message.js → chat/chat-message.js} +0 -0
  92. /package/dist/cjs/{ChatTypingIndicator.d.ts → chat/chat-typing-indicator.d.ts} +0 -0
  93. /package/dist/cjs/{conversation-descriptor.d.ts → chat/conversation-descriptor.d.ts} +0 -0
  94. /package/dist/cjs/{conversation-descriptor.js → chat/conversation-descriptor.js} +0 -0
  95. /package/dist/cjs/{file-attachment.d.ts → chat/file-attachment.d.ts} +0 -0
  96. /package/dist/cjs/{file-attachment.js → chat/file-attachment.js} +0 -0
  97. /package/dist/cjs/{FileUploader.d.ts → chat/file-uploader.d.ts} +0 -0
  98. /package/dist/cjs/{multi-thread-view.d.ts → chat/multi-thread-view.d.ts} +0 -0
  99. /package/dist/cjs/{UploadPill.d.ts → chat/upload-pill.d.ts} +0 -0
  100. /package/dist/esm/{ChatBotView.d.ts → chat/chat-bot-view.d.ts} +0 -0
  101. /package/dist/esm/{ChatInput.d.ts → chat/chat-input.d.ts} +0 -0
  102. /package/dist/esm/{chat-message.d.ts → chat/chat-message.d.ts} +0 -0
  103. /package/dist/esm/{chat-message.js → chat/chat-message.js} +0 -0
  104. /package/dist/esm/{ChatTypingIndicator.d.ts → chat/chat-typing-indicator.d.ts} +0 -0
  105. /package/dist/esm/{conversation-descriptor.d.ts → chat/conversation-descriptor.d.ts} +0 -0
  106. /package/dist/esm/{conversation-descriptor.js → chat/conversation-descriptor.js} +0 -0
  107. /package/dist/esm/{file-attachment.d.ts → chat/file-attachment.d.ts} +0 -0
  108. /package/dist/esm/{file-attachment.js → chat/file-attachment.js} +0 -0
  109. /package/dist/esm/{FileUploader.d.ts → chat/file-uploader.d.ts} +0 -0
  110. /package/dist/esm/{multi-thread-view.d.ts → chat/multi-thread-view.d.ts} +0 -0
  111. /package/dist/esm/{UploadPill.d.ts → chat/upload-pill.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { Paperclip } from "lucide-react";
4
- import { Button } from "./components/ui/button";
4
+ import { Button } from "../components/ui/button";
5
5
  function FileUploader({
6
6
  onFilesSelected,
7
7
  accept = "",
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useEffect, useMemo, useState } from "react";
3
- import { Chat } from "./Chat";
3
+ import { NewChatThread } from "./new-chat-thread";
4
4
  function normalizeSelectedThreadPath(path) {
5
5
  const normalized = path?.trim();
6
6
  return normalized ? normalized : null;
@@ -42,19 +42,24 @@ function MultiThreadView({
42
42
  return builder(activeSelectedThreadPath);
43
43
  }
44
44
  return /* @__PURE__ */ jsx(
45
- Chat,
45
+ NewChatThread,
46
46
  {
47
47
  room,
48
48
  agentName,
49
+ builder,
49
50
  toolkit,
50
51
  tool,
52
+ selectedThreadPath: activeSelectedThreadPath,
51
53
  centerComposer,
52
- onThreadResolved: (path, displayName) => {
54
+ onThreadPathChanged: (path) => {
53
55
  const normalizedPath = normalizeSelectedThreadPath(path);
54
56
  if (controlledSelectedThreadPath === void 0) {
55
57
  setInternalSelectedThreadPath(normalizedPath);
56
58
  }
57
59
  onSelectedThreadPathChanged?.(normalizedPath);
60
+ },
61
+ onThreadResolved: (path, displayName) => {
62
+ const normalizedPath = normalizeSelectedThreadPath(path);
58
63
  onSelectedThreadResolved?.(normalizedPath, displayName);
59
64
  },
60
65
  emptyStateTitle,
@@ -0,0 +1,17 @@
1
+ import type { ReactElement } from "react";
2
+ import { RoomClient } from "@meshagent/meshagent";
3
+ export type NewChatThreadBuilder = (threadPath: string) => ReactElement;
4
+ export interface NewChatThreadProps {
5
+ room: RoomClient;
6
+ agentName: string;
7
+ builder: NewChatThreadBuilder;
8
+ toolkit?: string;
9
+ tool?: string;
10
+ selectedThreadPath?: string | null;
11
+ onThreadPathChanged?: (path: string | null) => void;
12
+ onThreadResolved?: (path: string | null, displayName: string | null) => void;
13
+ centerComposer?: boolean;
14
+ emptyStateTitle?: string;
15
+ emptyStateDescription?: string;
16
+ }
17
+ export declare function NewChatThread({ room, agentName, builder, toolkit, tool, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, }: NewChatThreadProps): ReactElement;
@@ -1,14 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useRef, useMemo, useEffect, useCallback } from "react";
2
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
3
  import { JsonContent } from "@meshagent/meshagent";
4
- import { useRoomIndicators } from "@meshagent/meshagent-react";
5
- import { Plus } from "lucide-react";
6
- import { ChatInput } from "./ChatInput";
7
- import { ChatThread } from "./ChatThread";
8
- import { Button } from "./components/ui/button";
9
- import { Toaster } from "./components/ui/sonner";
4
+ import { ChatInput } from "./chat-input";
10
5
  import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment";
11
- import { useChatThread, useThreadStatus } from "./chat-hooks";
6
+ import { Toaster } from "../components/ui/sonner";
12
7
  class NewThreadCancelledError extends Error {
13
8
  constructor() {
14
9
  super("new thread creation cancelled");
@@ -96,10 +91,7 @@ function parseThreadToolResult(toolkit, tool, content) {
96
91
  if (!path) {
97
92
  throw new Error(`${toolkit}.${tool} response missing path`);
98
93
  }
99
- return {
100
- path,
101
- displayName: getStringField(content.json, "name")
102
- };
94
+ return [path, getStringField(content.json, "name")];
103
95
  }
104
96
  function describeError(error) {
105
97
  if (error instanceof Error && error.message.trim() !== "") {
@@ -111,115 +103,26 @@ function EmptyState({
111
103
  title,
112
104
  description
113
105
  }) {
114
- return /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-col items-center justify-center px-6 py-20 text-center", children: [
115
- /* @__PURE__ */ jsx("h2", { className: "text-4xl font-bold tracking-tight text-foreground", children: title }),
106
+ return /* @__PURE__ */ jsxs("div", { className: "h-full mx-auto flex max-w-2xl flex-col items-center justify-center px-6 py-20 text-center", children: [
107
+ /* @__PURE__ */ jsx("h2", { className: "text-4xl font-semibold tracking-tight text-foreground sm:text-5xl", children: title }),
116
108
  description?.trim() ? /* @__PURE__ */ jsx("p", { className: "mt-3 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base", children: description }) : null
117
109
  ] });
118
110
  }
119
111
  function ErrorBanner({ message }) {
120
- return /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[912px] whitespace-pre-wrap rounded-3xl border border-destructive/30 bg-destructive/5 px-6 py-5 text-sm text-destructive", children: message });
112
+ return /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-[912px] whitespace-pre-wrap rounded-md border border-destructive/30 bg-destructive/5 px-6 py-5 text-sm text-destructive", children: message });
121
113
  }
122
- function ResolvedChatView({
114
+ function NewChatThread({
123
115
  room,
124
- path,
125
- participants,
126
- agentName,
127
- emptyStateTitle,
128
- emptyStateDescription,
129
- showNewThreadButton = false,
130
- onStartNewThread
131
- }) {
132
- const threadStatus = useThreadStatus({ room, path, agentName });
133
- const useAgentMessages = threadStatus.supportsAgentMessages;
134
- const messageType = useAgentMessages && threadStatus.mode === "steerable" && threadStatus.turnId ? "steer" : "chat";
135
- const {
136
- document,
137
- messages,
138
- sendMessage,
139
- selectAttachments,
140
- attachments,
141
- setAttachments,
142
- onlineParticipants,
143
- localParticipantName,
144
- cancelRequest
145
- } = useChatThread({
146
- room,
147
- path,
148
- participants,
149
- agentName,
150
- useAgentMessages,
151
- messageType,
152
- turnId: threadStatus.turnId
153
- });
154
- const { typing, thinking } = useRoomIndicators({ room, path });
155
- const [showCompletedToolCalls, setShowCompletedToolCalls] = useState(false);
156
- const onTextChange = useCallback(() => {
157
- for (const participant of onlineParticipants) {
158
- room.messaging.sendMessage({
159
- to: participant,
160
- type: "typing",
161
- message: { path }
162
- });
163
- }
164
- }, [onlineParticipants, path, room]);
165
- return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
166
- showNewThreadButton && onStartNewThread ? /* @__PURE__ */ jsx("div", { className: "px-4 pt-3", children: /* @__PURE__ */ jsx("div", { className: "mx-auto flex w-full max-w-[912px] justify-end", children: /* @__PURE__ */ jsxs(
167
- Button,
168
- {
169
- type: "button",
170
- variant: "outline",
171
- size: "sm",
172
- className: "rounded-full shadow-xs",
173
- onClick: onStartNewThread,
174
- children: [
175
- /* @__PURE__ */ jsx(Plus, { className: "mr-2 h-4 w-4" }),
176
- "New thread"
177
- ]
178
- }
179
- ) }) }) : null,
180
- /* @__PURE__ */ jsx(
181
- ChatThread,
182
- {
183
- room,
184
- path,
185
- messages,
186
- isLoading: document === null,
187
- localParticipantName,
188
- showCompletedToolCalls,
189
- onShowCompletedToolCallsChanged: setShowCompletedToolCalls,
190
- typing,
191
- thinking,
192
- threadStatusText: threadStatus.text,
193
- threadStatusStartedAt: threadStatus.startedAt,
194
- threadStatusMode: threadStatus.mode,
195
- onCancelRequest: cancelRequest,
196
- emptyStateTitle,
197
- emptyStateDescription
198
- }
199
- ),
200
- /* @__PURE__ */ jsx(
201
- ChatInput,
202
- {
203
- onSubmit: sendMessage,
204
- attachments,
205
- onFilesSelected: selectAttachments,
206
- setAttachments,
207
- onTextChange
208
- }
209
- )
210
- ] });
211
- }
212
- function Chat({
213
- room,
214
- path,
215
- participants,
216
116
  agentName,
117
+ builder,
217
118
  toolkit = "chat",
218
119
  tool = "new_thread",
120
+ selectedThreadPath,
121
+ onThreadPathChanged,
122
+ onThreadResolved,
219
123
  centerComposer = true,
220
124
  emptyStateTitle,
221
- emptyStateDescription,
222
- onThreadResolved
125
+ emptyStateDescription
223
126
  }) {
224
127
  const [internalThreadPath, setInternalThreadPath] = useState(null);
225
128
  const [newThreadDraft, setNewThreadDraft] = useState("");
@@ -228,20 +131,23 @@ function Chat({
228
131
  const [creatingNewThread, setCreatingNewThread] = useState(false);
229
132
  const [waitingForAgent, setWaitingForAgent] = useState(false);
230
133
  const activeOperationRef = useRef(0);
231
- const controlledPath = useMemo(() => normalizeThreadPath(path), [path]);
232
- const managesOwnThread = controlledPath === null;
233
- const activePath = controlledPath ?? internalThreadPath;
134
+ const controlledThreadPath = selectedThreadPath !== void 0 ? normalizeThreadPath(selectedThreadPath) : void 0;
135
+ const activePath = controlledThreadPath ?? internalThreadPath;
234
136
  useEffect(() => {
235
137
  return () => {
236
138
  activeOperationRef.current += 1;
237
139
  };
238
140
  }, []);
239
141
  useEffect(() => {
240
- if (controlledPath !== null) {
241
- setInternalThreadPath(null);
142
+ if (controlledThreadPath === void 0) {
143
+ return;
242
144
  }
243
- }, [controlledPath]);
145
+ setInternalThreadPath(controlledThreadPath);
146
+ }, [controlledThreadPath]);
244
147
  useEffect(() => {
148
+ if (controlledThreadPath !== void 0) {
149
+ return;
150
+ }
245
151
  activeOperationRef.current += 1;
246
152
  setInternalThreadPath(null);
247
153
  setNewThreadDraft("");
@@ -249,7 +155,7 @@ function Chat({
249
155
  setNewThreadError(null);
250
156
  setCreatingNewThread(false);
251
157
  setWaitingForAgent(false);
252
- }, [agentName, managesOwnThread, room]);
158
+ }, [agentName, controlledThreadPath, room]);
253
159
  const selectNewThreadAttachments = useCallback((files) => {
254
160
  const nextAttachments = files.map((file) => new MeshagentFileUpload(
255
161
  room,
@@ -265,15 +171,6 @@ function Chat({
265
171
  setWaitingForAgent(false);
266
172
  setNewThreadError(null);
267
173
  }, []);
268
- const openNewThreadComposer = useCallback(() => {
269
- activeOperationRef.current += 1;
270
- setInternalThreadPath(null);
271
- setNewThreadDraft("");
272
- setNewThreadAttachments([]);
273
- setNewThreadError(null);
274
- setCreatingNewThread(false);
275
- setWaitingForAgent(false);
276
- }, []);
277
174
  const handleCreateThread = useCallback(async () => {
278
175
  const text = newThreadDraft.trim();
279
176
  const hasDraft = text !== "" || newThreadAttachments.length > 0;
@@ -306,7 +203,8 @@ function Chat({
306
203
  activeOperationRef
307
204
  });
308
205
  ensureOperationActive(operationId, activeOperationRef);
309
- const response = await room.agents.invokeTool({
206
+ const response = await room.invoke({
207
+ participantId: targetAgent.id,
310
208
  toolkit,
311
209
  tool,
312
210
  arguments: {
@@ -320,16 +218,18 @@ function Chat({
320
218
  if (!(response instanceof JsonContent)) {
321
219
  throw new Error(`${toolkit}.${tool} returned non-JSON content`);
322
220
  }
323
- const result = parseThreadToolResult(toolkit, tool, response);
324
- if (controlledPath === null) {
325
- setInternalThreadPath(result.path);
221
+ const [threadPath, displayName] = parseThreadToolResult(toolkit, tool, response);
222
+ const normalizedPath = normalizeThreadPath(threadPath);
223
+ if (controlledThreadPath === void 0) {
224
+ setInternalThreadPath(normalizedPath);
326
225
  }
327
226
  setNewThreadDraft("");
328
227
  setNewThreadAttachments([]);
329
228
  setNewThreadError(null);
330
229
  setCreatingNewThread(false);
331
230
  setWaitingForAgent(false);
332
- onThreadResolved?.(result.path, result.displayName);
231
+ onThreadPathChanged?.(normalizedPath);
232
+ onThreadResolved?.(normalizedPath, displayName);
333
233
  } catch (error) {
334
234
  if (error instanceof NewThreadCancelledError) {
335
235
  return;
@@ -340,34 +240,19 @@ function Chat({
340
240
  }
341
241
  }, [
342
242
  agentName,
343
- controlledPath,
243
+ controlledThreadPath,
344
244
  creatingNewThread,
345
245
  newThreadAttachments,
346
246
  newThreadDraft,
247
+ onThreadPathChanged,
347
248
  onThreadResolved,
348
249
  room,
349
250
  toolkit,
350
251
  tool,
351
252
  waitingForAgent
352
253
  ]);
353
- useEffect(() => {
354
- if (!managesOwnThread) {
355
- return;
356
- }
357
- const handleKeyDown = (event) => {
358
- if (!(event.ctrlKey || event.metaKey) || event.key.toLowerCase() !== "n") {
359
- return;
360
- }
361
- event.preventDefault();
362
- openNewThreadComposer();
363
- };
364
- window.addEventListener("keydown", handleKeyDown);
365
- return () => {
366
- window.removeEventListener("keydown", handleKeyDown);
367
- };
368
- }, [managesOwnThread, openNewThreadComposer]);
369
254
  const targetAgentLabel = useMemo(() => {
370
- const knownAgentName = agentName?.trim();
255
+ const knownAgentName = agentName.trim();
371
256
  if (knownAgentName) {
372
257
  return displayParticipantName(knownAgentName);
373
258
  }
@@ -375,6 +260,9 @@ function Chat({
375
260
  return displayParticipantName(targetAgent ? getParticipantName(targetAgent) : null);
376
261
  }, [agentName, room]);
377
262
  const pendingStatusText = waitingForAgent ? `Waiting for ${targetAgentLabel} to be ready.` : creatingNewThread ? `Starting a thread with ${targetAgentLabel}.` : null;
263
+ if (activePath !== null) {
264
+ return builder(activePath);
265
+ }
378
266
  const composer = /* @__PURE__ */ jsx(
379
267
  ChatInput,
380
268
  {
@@ -388,24 +276,11 @@ function Chat({
388
276
  showCancelButton: creatingNewThread || waitingForAgent,
389
277
  onCancelRequest: cancelPendingNewThread,
390
278
  disabled: creatingNewThread || waitingForAgent,
391
- placeholder: agentName?.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
279
+ placeholder: agentName.trim() ? `Type a message or @${displayParticipantName(agentName)}` : "Type a message"
392
280
  }
393
281
  );
394
282
  return /* @__PURE__ */ jsxs("div", { className: "h-full flex flex-1 flex-col", children: [
395
- activePath ? /* @__PURE__ */ jsx(
396
- ResolvedChatView,
397
- {
398
- room,
399
- path: activePath,
400
- participants,
401
- agentName,
402
- emptyStateTitle,
403
- emptyStateDescription,
404
- showNewThreadButton: managesOwnThread,
405
- onStartNewThread: openNewThreadComposer
406
- },
407
- activePath
408
- ) : 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: [
283
+ 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: [
409
284
  /* @__PURE__ */ jsxs("div", { className: "space-y-2 text-center", children: [
410
285
  /* @__PURE__ */ jsx("h2", { className: "text-4xl font-semibold tracking-tight text-foreground sm:text-5xl", children: "Start a new thread" }),
411
286
  pendingStatusText ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground sm:text-base", children: pendingStatusText }) : null
@@ -422,5 +297,5 @@ function Chat({
422
297
  ] });
423
298
  }
424
299
  export {
425
- Chat
300
+ NewChatThread
426
301
  };
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { FileUp, LoaderCircle, TriangleAlert, X } from "lucide-react";
4
- import { Progress } from "./components/ui/progress";
4
+ import { Progress } from "../components/ui/progress";
5
5
  import { UploadStatus } from "./file-attachment";
6
- import { cn } from "./lib/utils";
6
+ import { cn } from "../lib/utils";
7
7
  function measureUploadProgress(attachment) {
8
8
  if (attachment.size <= 0) {
9
9
  return attachment.status === UploadStatus.Completed ? 100 : 0;
@@ -0,0 +1,34 @@
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import { RoomClient } from "@meshagent/meshagent";
3
+ export declare enum FileKind {
4
+ Image = "image",
5
+ Video = "video",
6
+ Pdf = "pdf",
7
+ Unknown = "unknown"
8
+ }
9
+ export declare function filePreviewName(path: string): string;
10
+ export declare function classifyFile(path: string): FileKind;
11
+ export declare function isImagePath(path: string): boolean;
12
+ export declare function ImagePreview({ room, path, alt, }: {
13
+ room: RoomClient;
14
+ path: string;
15
+ alt?: string;
16
+ }): ReactElement;
17
+ export declare function VideoPreview({ room, path }: {
18
+ room: RoomClient;
19
+ path: string;
20
+ }): ReactElement;
21
+ export declare function PdfPreview({ room, path }: {
22
+ room: RoomClient;
23
+ path: string;
24
+ }): ReactElement;
25
+ export declare function FilePreview({ room, path }: {
26
+ room: RoomClient;
27
+ path: string;
28
+ }): ReactElement;
29
+ export declare function FilePreviewDialog({ room, path, children, className, }: {
30
+ room: RoomClient;
31
+ path: string;
32
+ children: ReactNode;
33
+ className?: string;
34
+ }): ReactElement;