@meshagent/meshagent-tailwind 0.42.0 → 0.43.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 +14 -0
- package/dist/cjs/chat/chat-bot-view.d.ts +6 -3
- package/dist/cjs/chat/chat-bot-view.js +159 -32
- package/dist/cjs/chat/chat-hooks.d.ts +2 -2
- package/dist/cjs/chat/chat-hooks.js +1 -1
- package/dist/cjs/chat/chat-input.d.ts +2 -2
- package/dist/cjs/chat/chat-input.js +6 -6
- package/dist/cjs/chat/chat-thread.js +7 -7
- package/dist/cjs/chat/chat-typing-indicator.js +2 -2
- package/dist/cjs/chat/conversation-descriptor.js +6 -0
- package/dist/cjs/chat/dataset-chat-thread.js +8 -8
- package/dist/cjs/chat/file-uploader.js +1 -1
- package/dist/cjs/chat/multi-thread-view.js +1 -1
- package/dist/cjs/chat/new-chat-thread.js +3 -3
- package/dist/cjs/chat/upload-pill.d.ts +1 -1
- package/dist/cjs/chat/upload-pill.js +3 -3
- package/dist/cjs/components/pane-example.js +3 -3
- package/dist/cjs/components/ui/avatar.js +1 -1
- package/dist/cjs/components/ui/button.d.ts +1 -1
- package/dist/cjs/components/ui/button.js +1 -1
- package/dist/cjs/components/ui/card.js +1 -1
- package/dist/cjs/components/ui/dialog.js +1 -1
- package/dist/cjs/components/ui/form.js +2 -2
- package/dist/cjs/components/ui/input.js +1 -1
- package/dist/cjs/components/ui/label.js +1 -1
- package/dist/cjs/components/ui/progress.js +1 -1
- package/dist/cjs/components/ui/radio-group.js +1 -1
- package/dist/cjs/components/ui/select.js +1 -1
- package/dist/cjs/components/ui/sheet.js +1 -1
- package/dist/cjs/components/ui/skeleton.js +1 -1
- package/dist/cjs/components/ui/spinner.js +1 -1
- package/dist/cjs/components/ui/textarea.js +1 -1
- package/dist/cjs/file-preview/file-preview.js +5 -5
- package/dist/cjs/forms/form.js +6 -6
- package/dist/cjs/forms/multi-select-autocomplete.js +1 -1
- package/dist/cjs/forms/select-users-dialog.js +3 -3
- package/dist/cjs/forms/select-users.d.ts +1 -1
- package/dist/cjs/forms/select-users.js +2 -2
- package/dist/cjs/index.d.ts +19 -19
- package/dist/cjs/index.js +19 -19
- package/dist/cjs/meetings/controls.d.ts +1 -1
- package/dist/cjs/meetings/controls.js +7 -7
- package/dist/cjs/meetings/lobby.d.ts +1 -1
- package/dist/cjs/meetings/lobby.js +7 -7
- package/dist/cjs/meetings/meeting-scope.js +1 -1
- package/dist/cjs/meetings/meeting-view.d.ts +1 -1
- package/dist/cjs/meetings/meeting-view.js +66 -9
- package/dist/cjs/meetings/meetings.d.ts +8 -8
- package/dist/cjs/meetings/meetings.js +8 -8
- package/dist/cjs/meetings/participants.d.ts +1 -1
- package/dist/cjs/meetings/participants.js +3 -3
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/tools/ask-user-for-file.js +1 -1
- package/dist/cjs/tools/ask-user.js +1 -1
- package/dist/cjs/tools/file-dialog.js +2 -2
- package/dist/cjs/tools/form-dialog.d.ts +1 -1
- package/dist/cjs/tools/form-dialog.js +3 -3
- package/dist/cjs/tools/form.d.ts +1 -1
- package/dist/cjs/tools/form.js +1 -1
- package/dist/cjs/tools/ui-toolkit.js +4 -4
- package/dist/esm/chat/chat-bot-view.d.ts +6 -3
- package/dist/esm/chat/chat-bot-view.js +163 -32
- package/dist/esm/chat/chat-hooks.d.ts +2 -2
- package/dist/esm/chat/chat-hooks.js +1 -1
- package/dist/esm/chat/chat-input.d.ts +2 -2
- package/dist/esm/chat/chat-input.js +6 -6
- package/dist/esm/chat/chat-thread.js +7 -7
- package/dist/esm/chat/chat-typing-indicator.js +2 -2
- package/dist/esm/chat/conversation-descriptor.js +6 -0
- package/dist/esm/chat/dataset-chat-thread.js +8 -8
- package/dist/esm/chat/file-uploader.js +1 -1
- package/dist/esm/chat/multi-thread-view.js +1 -1
- package/dist/esm/chat/new-chat-thread.js +3 -3
- package/dist/esm/chat/upload-pill.d.ts +1 -1
- package/dist/esm/chat/upload-pill.js +3 -3
- package/dist/esm/components/pane-example.js +3 -3
- package/dist/esm/components/ui/avatar.js +1 -1
- package/dist/esm/components/ui/button.js +1 -1
- package/dist/esm/components/ui/card.js +1 -1
- package/dist/esm/components/ui/dialog.js +1 -1
- package/dist/esm/components/ui/form.js +2 -2
- package/dist/esm/components/ui/input.js +1 -1
- package/dist/esm/components/ui/label.js +1 -1
- package/dist/esm/components/ui/progress.js +1 -1
- package/dist/esm/components/ui/radio-group.js +1 -1
- package/dist/esm/components/ui/select.js +1 -1
- package/dist/esm/components/ui/sheet.js +1 -1
- package/dist/esm/components/ui/skeleton.js +1 -1
- package/dist/esm/components/ui/spinner.js +1 -1
- package/dist/esm/components/ui/textarea.js +1 -1
- package/dist/esm/file-preview/file-preview.js +5 -5
- package/dist/esm/forms/form.js +6 -6
- package/dist/esm/forms/multi-select-autocomplete.js +1 -1
- package/dist/esm/forms/select-users-dialog.js +3 -3
- package/dist/esm/forms/select-users.d.ts +1 -1
- package/dist/esm/forms/select-users.js +2 -2
- package/dist/esm/index.d.ts +19 -19
- package/dist/esm/index.js +19 -19
- package/dist/esm/meetings/controls.d.ts +1 -1
- package/dist/esm/meetings/controls.js +8 -8
- package/dist/esm/meetings/lobby.d.ts +1 -1
- package/dist/esm/meetings/lobby.js +7 -7
- package/dist/esm/meetings/meeting-scope.js +1 -1
- package/dist/esm/meetings/meeting-view.d.ts +1 -1
- package/dist/esm/meetings/meeting-view.js +66 -9
- package/dist/esm/meetings/meetings.d.ts +8 -8
- package/dist/esm/meetings/meetings.js +8 -8
- package/dist/esm/meetings/participants.d.ts +1 -1
- package/dist/esm/meetings/participants.js +3 -3
- package/dist/esm/tools/ask-user-for-file.js +1 -1
- package/dist/esm/tools/ask-user.js +1 -1
- package/dist/esm/tools/file-dialog.js +2 -2
- package/dist/esm/tools/form-dialog.d.ts +1 -1
- package/dist/esm/tools/form-dialog.js +3 -3
- package/dist/esm/tools/form.d.ts +1 -1
- package/dist/esm/tools/form.js +1 -1
- package/dist/esm/tools/ui-toolkit.js +4 -4
- package/package.json +6 -6
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { useDocumentChanged } from "@meshagent/meshagent-react";
|
|
4
|
+
import {
|
|
5
|
+
AgentThreadStorageRepository,
|
|
6
|
+
DatasetThreadStorage,
|
|
7
|
+
MessagingChatClient
|
|
8
|
+
} from "@meshagent/meshagent-agents";
|
|
4
9
|
import {
|
|
5
10
|
AlertTriangle,
|
|
6
11
|
Check,
|
|
@@ -8,10 +13,10 @@ import {
|
|
|
8
13
|
MessageSquarePlus,
|
|
9
14
|
Pencil
|
|
10
15
|
} from "lucide-react";
|
|
11
|
-
import { useThreadStatus } from "./chat-hooks";
|
|
12
|
-
import { ChatThread } from "./chat-thread";
|
|
13
|
-
import { DatasetChatThread } from "./dataset-chat-thread";
|
|
14
|
-
import { Button } from "../components/ui/button";
|
|
16
|
+
import { useThreadStatus } from "./chat-hooks.js";
|
|
17
|
+
import { ChatThread } from "./chat-thread.js";
|
|
18
|
+
import { DatasetChatThread } from "./dataset-chat-thread.js";
|
|
19
|
+
import { Button } from "../components/ui/button.js";
|
|
15
20
|
import {
|
|
16
21
|
Dialog,
|
|
17
22
|
DialogClose,
|
|
@@ -20,24 +25,24 @@ import {
|
|
|
20
25
|
DialogFooter,
|
|
21
26
|
DialogHeader,
|
|
22
27
|
DialogTitle
|
|
23
|
-
} from "../components/ui/dialog";
|
|
24
|
-
import { Input } from "../components/ui/input";
|
|
25
|
-
import { Label } from "../components/ui/label";
|
|
26
|
-
import { Spinner } from "../components/ui/spinner";
|
|
28
|
+
} from "../components/ui/dialog.js";
|
|
29
|
+
import { Input } from "../components/ui/input.js";
|
|
30
|
+
import { Label } from "../components/ui/label.js";
|
|
31
|
+
import { Spinner } from "../components/ui/spinner.js";
|
|
27
32
|
import {
|
|
28
33
|
ChatThreadDisplayMode,
|
|
29
34
|
chatDocumentPath,
|
|
30
35
|
defaultThreadDisplayNameFromPath,
|
|
31
36
|
resolvedThreadListPath
|
|
32
|
-
} from "./conversation-descriptor";
|
|
33
|
-
import { cn } from "../lib/utils";
|
|
34
|
-
import { MultiThreadView } from "./multi-thread-view";
|
|
37
|
+
} from "./conversation-descriptor.js";
|
|
38
|
+
import { cn } from "../lib/utils.js";
|
|
39
|
+
import { MultiThreadView } from "./multi-thread-view.js";
|
|
35
40
|
const multiThreadLayoutBreakpointPx = 920;
|
|
36
41
|
import {
|
|
37
42
|
ChatThreadDisplayMode as ChatThreadDisplayMode2,
|
|
38
43
|
chatDocumentPath as chatDocumentPath2,
|
|
39
44
|
resolvedThreadListPath as resolvedThreadListPath2
|
|
40
|
-
} from "./conversation-descriptor";
|
|
45
|
+
} from "./conversation-descriptor.js";
|
|
41
46
|
function normalizePath(path) {
|
|
42
47
|
const normalized = path?.trim();
|
|
43
48
|
return normalized ? normalized : null;
|
|
@@ -107,6 +112,72 @@ async function closeDocument(room, path) {
|
|
|
107
112
|
} catch {
|
|
108
113
|
}
|
|
109
114
|
}
|
|
115
|
+
function threadListEntryFromAgentEntry(entry) {
|
|
116
|
+
return {
|
|
117
|
+
path: entry.path,
|
|
118
|
+
name: entry.name,
|
|
119
|
+
createdAt: entry.createdAt,
|
|
120
|
+
modifiedAt: entry.modifiedAt
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
class MeshDocumentChatThreadListStore {
|
|
124
|
+
constructor(room, path) {
|
|
125
|
+
this.room = room;
|
|
126
|
+
this.path = path;
|
|
127
|
+
}
|
|
128
|
+
room;
|
|
129
|
+
path;
|
|
130
|
+
document = null;
|
|
131
|
+
async open() {
|
|
132
|
+
this.document = await this.room.sync.open(this.path);
|
|
133
|
+
}
|
|
134
|
+
async close() {
|
|
135
|
+
this.document = null;
|
|
136
|
+
await closeDocument(this.room, this.path);
|
|
137
|
+
}
|
|
138
|
+
entries() {
|
|
139
|
+
return this.document === null ? [] : parseThreadListEntries(this.document);
|
|
140
|
+
}
|
|
141
|
+
async renameThread(entry, name) {
|
|
142
|
+
if (entry.element == null) {
|
|
143
|
+
throw new Error("Thread list entry is not backed by a mesh document element.");
|
|
144
|
+
}
|
|
145
|
+
entry.element.setAttribute("name", name);
|
|
146
|
+
}
|
|
147
|
+
async deleteThread(entry) {
|
|
148
|
+
if (entry.element == null) {
|
|
149
|
+
throw new Error("Thread list entry is not backed by a mesh document element.");
|
|
150
|
+
}
|
|
151
|
+
await this.room.storage.delete(entry.path);
|
|
152
|
+
entry.element.delete();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
class RepositoryChatThreadListStore {
|
|
156
|
+
constructor(repository, onChanged) {
|
|
157
|
+
this.repository = repository;
|
|
158
|
+
this.onChanged = onChanged;
|
|
159
|
+
}
|
|
160
|
+
repository;
|
|
161
|
+
onChanged;
|
|
162
|
+
document = null;
|
|
163
|
+
async open() {
|
|
164
|
+
this.repository.addListener(this.onChanged);
|
|
165
|
+
await this.repository.open();
|
|
166
|
+
}
|
|
167
|
+
async close() {
|
|
168
|
+
this.repository.removeListener(this.onChanged);
|
|
169
|
+
await this.repository.close();
|
|
170
|
+
}
|
|
171
|
+
entries() {
|
|
172
|
+
return this.repository.entries().map(threadListEntryFromAgentEntry);
|
|
173
|
+
}
|
|
174
|
+
async renameThread(entry, name) {
|
|
175
|
+
await this.repository.renameThread(entry.path, name);
|
|
176
|
+
}
|
|
177
|
+
async deleteThread(entry) {
|
|
178
|
+
await this.repository.deleteThread(entry.path);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
110
181
|
function useIsWideLayout(minWidth) {
|
|
111
182
|
const [matches, setMatches] = useState(false);
|
|
112
183
|
useEffect(() => {
|
|
@@ -125,19 +196,44 @@ function useIsWideLayout(minWidth) {
|
|
|
125
196
|
}, [minWidth]);
|
|
126
197
|
return matches;
|
|
127
198
|
}
|
|
128
|
-
function useThreadListDocument({ room, path }) {
|
|
199
|
+
function useThreadListDocument({ room, chatClient, path }) {
|
|
129
200
|
const [document, setDocument] = useState(null);
|
|
130
201
|
const [entries, setEntries] = useState([]);
|
|
131
202
|
const [loading, setLoading] = useState(path !== null);
|
|
132
203
|
const [error, setError] = useState(null);
|
|
133
|
-
const
|
|
134
|
-
|
|
204
|
+
const storeRef = useRef(null);
|
|
205
|
+
const syncEntries = useCallback((store = storeRef.current) => {
|
|
206
|
+
if (store === null) {
|
|
207
|
+
setEntries([]);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const nextEntries = [...store.entries()].sort(compareThreadEntries);
|
|
135
211
|
setEntries((currentEntries) => threadEntriesEqual(currentEntries, nextEntries) ? currentEntries : nextEntries);
|
|
136
212
|
}, []);
|
|
213
|
+
const createStore = useCallback((nextPath) => {
|
|
214
|
+
if (nextPath.startsWith("agent://")) {
|
|
215
|
+
if (chatClient === null) {
|
|
216
|
+
throw new Error("Agent thread lists require a chat client.");
|
|
217
|
+
}
|
|
218
|
+
return new RepositoryChatThreadListStore(
|
|
219
|
+
new AgentThreadStorageRepository({ chatClient }),
|
|
220
|
+
() => syncEntries()
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
if (nextPath.startsWith("dataset://")) {
|
|
224
|
+
return new RepositoryChatThreadListStore(
|
|
225
|
+
new DatasetThreadStorage({ room, path: nextPath }),
|
|
226
|
+
() => syncEntries()
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
return new MeshDocumentChatThreadListStore(room, nextPath);
|
|
230
|
+
}, [chatClient, room, syncEntries]);
|
|
137
231
|
useEffect(() => {
|
|
138
232
|
let cancelled = false;
|
|
139
|
-
let opened = false;
|
|
140
233
|
if (path === null) {
|
|
234
|
+
const previousStore = storeRef.current;
|
|
235
|
+
storeRef.current = null;
|
|
236
|
+
void previousStore?.close();
|
|
141
237
|
setDocument(null);
|
|
142
238
|
setEntries([]);
|
|
143
239
|
setLoading(false);
|
|
@@ -148,14 +244,15 @@ function useThreadListDocument({ room, path }) {
|
|
|
148
244
|
setEntries([]);
|
|
149
245
|
setLoading(true);
|
|
150
246
|
setError(null);
|
|
151
|
-
|
|
247
|
+
const store = createStore(path);
|
|
248
|
+
storeRef.current = store;
|
|
249
|
+
void store.open().then(() => {
|
|
152
250
|
if (cancelled) {
|
|
153
|
-
void
|
|
251
|
+
void store.close();
|
|
154
252
|
return;
|
|
155
253
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
syncDocumentState(nextDocument);
|
|
254
|
+
setDocument(store.document);
|
|
255
|
+
syncEntries(store);
|
|
159
256
|
setLoading(false);
|
|
160
257
|
setError(null);
|
|
161
258
|
}).catch((nextError) => {
|
|
@@ -169,20 +266,29 @@ function useThreadListDocument({ room, path }) {
|
|
|
169
266
|
});
|
|
170
267
|
return () => {
|
|
171
268
|
cancelled = true;
|
|
172
|
-
if (
|
|
173
|
-
|
|
269
|
+
if (storeRef.current === store) {
|
|
270
|
+
storeRef.current = null;
|
|
174
271
|
}
|
|
272
|
+
void store.close();
|
|
175
273
|
};
|
|
176
|
-
}, [
|
|
274
|
+
}, [createStore, path, syncEntries]);
|
|
177
275
|
useDocumentChanged({
|
|
178
276
|
document,
|
|
179
|
-
onChanged:
|
|
277
|
+
onChanged: () => syncEntries()
|
|
180
278
|
});
|
|
181
279
|
return {
|
|
182
280
|
document,
|
|
183
281
|
entries,
|
|
184
282
|
loading,
|
|
185
|
-
error
|
|
283
|
+
error,
|
|
284
|
+
renameThread: async (entry, name) => {
|
|
285
|
+
await storeRef.current?.renameThread(entry, name);
|
|
286
|
+
syncEntries();
|
|
287
|
+
},
|
|
288
|
+
deleteThread: async (entry) => {
|
|
289
|
+
await storeRef.current?.deleteThread(entry);
|
|
290
|
+
syncEntries();
|
|
291
|
+
}
|
|
186
292
|
};
|
|
187
293
|
}
|
|
188
294
|
function ThreadListRow({
|
|
@@ -352,6 +458,8 @@ function MultiThreadUnavailable() {
|
|
|
352
458
|
}
|
|
353
459
|
function ChatBotView({
|
|
354
460
|
room,
|
|
461
|
+
chatClient,
|
|
462
|
+
disposeChatClient = false,
|
|
355
463
|
path,
|
|
356
464
|
documentPath,
|
|
357
465
|
participants,
|
|
@@ -384,6 +492,12 @@ function ChatBotView({
|
|
|
384
492
|
() => resolvedDocumentPath ?? chatDocumentPath(agentName, { threadDir }),
|
|
385
493
|
[agentName, resolvedDocumentPath, threadDir]
|
|
386
494
|
);
|
|
495
|
+
const needsChatClient = chatClient != null || threadDisplayMode === ChatThreadDisplayMode.MultiThreadComposer || isDatasetBackedThreadPath(resolvedSingleThreadPath);
|
|
496
|
+
const ownsChatClient = chatClient == null && needsChatClient;
|
|
497
|
+
const activeChatClient = useMemo(
|
|
498
|
+
() => needsChatClient ? chatClient ?? new MessagingChatClient({ room, agentName }) : null,
|
|
499
|
+
[agentName, chatClient, needsChatClient, room]
|
|
500
|
+
);
|
|
387
501
|
const explicitSelectedThreadPath = selectedThreadPath !== void 0 ? normalizePath(selectedThreadPath) : void 0;
|
|
388
502
|
const legacySelectedThreadPath = threadDisplayMode === ChatThreadDisplayMode.MultiThreadComposer ? resolvedDocumentPath : null;
|
|
389
503
|
const [internalSelectedThreadPath, setInternalSelectedThreadPath] = useState(() => explicitSelectedThreadPath ?? legacySelectedThreadPath ?? null);
|
|
@@ -397,8 +511,16 @@ function ChatBotView({
|
|
|
397
511
|
);
|
|
398
512
|
const threadList = useThreadListDocument({
|
|
399
513
|
room,
|
|
514
|
+
chatClient: activeChatClient,
|
|
400
515
|
path: threadDisplayMode === ChatThreadDisplayMode.MultiThreadComposer && showThreadList && resolvedThreadListDocumentPath !== null ? resolvedThreadListDocumentPath : null
|
|
401
516
|
});
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
return () => {
|
|
519
|
+
if (activeChatClient !== null && (ownsChatClient || disposeChatClient)) {
|
|
520
|
+
void activeChatClient.stop();
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
}, [activeChatClient, disposeChatClient, ownsChatClient]);
|
|
402
524
|
useEffect(() => {
|
|
403
525
|
if (explicitSelectedThreadPath === void 0) {
|
|
404
526
|
return;
|
|
@@ -476,18 +598,24 @@ function ChatBotView({
|
|
|
476
598
|
if (trimmedName === "" || trimmedName === renameThreadDialog.entry.name) {
|
|
477
599
|
return;
|
|
478
600
|
}
|
|
479
|
-
renameThreadDialog.entry
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
601
|
+
void threadList.renameThread(renameThreadDialog.entry, trimmedName).then(() => {
|
|
602
|
+
if (renameThreadDialog.entry.path === activeSelectedThreadPath) {
|
|
603
|
+
emitResolvedThread(renameThreadDialog.entry.path, trimmedName);
|
|
604
|
+
}
|
|
605
|
+
closeRenameThreadDialog();
|
|
606
|
+
}).catch((renameError) => {
|
|
607
|
+
setTimeout(() => {
|
|
608
|
+
throw renameError;
|
|
609
|
+
}, 0);
|
|
610
|
+
});
|
|
611
|
+
}, [activeSelectedThreadPath, closeRenameThreadDialog, emitResolvedThread, renameThreadDialog, threadList]);
|
|
485
612
|
if (threadDisplayMode !== ChatThreadDisplayMode.MultiThreadComposer) {
|
|
486
613
|
return isDatasetBackedThreadPath(resolvedSingleThreadPath) ? /* @__PURE__ */ jsx(
|
|
487
614
|
DatasetChatThread,
|
|
488
615
|
{
|
|
489
616
|
room,
|
|
490
617
|
path: resolvedSingleThreadPath,
|
|
618
|
+
chatClient: activeChatClient ?? void 0,
|
|
491
619
|
agentName,
|
|
492
620
|
emptyStateTitle,
|
|
493
621
|
emptyStateDescription
|
|
@@ -511,6 +639,8 @@ function ChatBotView({
|
|
|
511
639
|
MultiThreadView,
|
|
512
640
|
{
|
|
513
641
|
room,
|
|
642
|
+
chatClient: activeChatClient ?? void 0,
|
|
643
|
+
disposeChatClient: false,
|
|
514
644
|
agentName,
|
|
515
645
|
toolkit,
|
|
516
646
|
tool,
|
|
@@ -524,6 +654,7 @@ function ChatBotView({
|
|
|
524
654
|
{
|
|
525
655
|
room,
|
|
526
656
|
path: threadPath,
|
|
657
|
+
chatClient: activeChatClient ?? void 0,
|
|
527
658
|
agentName,
|
|
528
659
|
emptyStateTitle: startNewThreadTitle,
|
|
529
660
|
emptyStateDescription: startNewThreadDescription
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Element, MeshDocument, Participant, RemoteParticipant, RoomClient } from "@meshagent/meshagent";
|
|
2
|
-
import { ChatMessage } from "./chat-message";
|
|
3
|
-
import { type FileUpload } from "./file-attachment";
|
|
2
|
+
import { ChatMessage } from "./chat-message.js";
|
|
3
|
+
import { type FileUpload } from "./file-attachment.js";
|
|
4
4
|
export interface UseChatThreadProps {
|
|
5
5
|
room: RoomClient;
|
|
6
6
|
path: string;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
RoomMessageEvent
|
|
4
4
|
} from "@meshagent/meshagent";
|
|
5
5
|
import { subscribe, useDocumentChanged, useRoomParticipants } from "@meshagent/meshagent-react";
|
|
6
|
-
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment";
|
|
6
|
+
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment.js";
|
|
7
7
|
const agentRoomMessageType = "agent-message";
|
|
8
8
|
const agentTurnStartType = "meshagent.agent.turn.start";
|
|
9
9
|
const agentTurnSteerType = "meshagent.agent.turn.steer";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import { ChatMessage } from "./chat-message";
|
|
3
|
-
import { type FileUpload } from "./file-attachment";
|
|
2
|
+
import { ChatMessage } from "./chat-message.js";
|
|
3
|
+
import { type FileUpload } from "./file-attachment.js";
|
|
4
4
|
interface ChatInputProps {
|
|
5
5
|
onSubmit: (message: ChatMessage) => void | Promise<void>;
|
|
6
6
|
onFilesSelected: (files: File[]) => void;
|
|
@@ -2,12 +2,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useRef, useState, useEffect, useMemo, useCallback } from "react";
|
|
3
3
|
import { ArrowUp, LoaderCircle, X } from "lucide-react";
|
|
4
4
|
import { v4 as uuidV4 } from "uuid";
|
|
5
|
-
import { ChatMessage } from "./chat-message";
|
|
6
|
-
import { Button } from "../components/ui/button";
|
|
7
|
-
import { FileUploader } from "./file-uploader";
|
|
8
|
-
import { UploadPill } from "./upload-pill";
|
|
9
|
-
import { UploadStatus } from "./file-attachment";
|
|
10
|
-
import { cn } from "../lib/utils";
|
|
5
|
+
import { ChatMessage } from "./chat-message.js";
|
|
6
|
+
import { Button } from "../components/ui/button.js";
|
|
7
|
+
import { FileUploader } from "./file-uploader.js";
|
|
8
|
+
import { UploadPill } from "./upload-pill.js";
|
|
9
|
+
import { UploadStatus } from "./file-attachment.js";
|
|
10
|
+
import { cn } from "../lib/utils.js";
|
|
11
11
|
const MIN_TEXTAREA_HEIGHT = 20;
|
|
12
12
|
const MAX_TEXTAREA_HEIGHT = 160;
|
|
13
13
|
function useAttachmentStatusVersion(attachments) {
|
|
@@ -5,13 +5,13 @@ import ReactMarkdown from "react-markdown";
|
|
|
5
5
|
import rehypeHighlight from "rehype-highlight";
|
|
6
6
|
import rehypeSanitize from "rehype-sanitize";
|
|
7
7
|
import remarkGfm from "remark-gfm";
|
|
8
|
-
import { Button } from "../components/ui/button";
|
|
9
|
-
import { Spinner } from "../components/ui/spinner";
|
|
10
|
-
import { ChatTypingIndicator } from "./chat-typing-indicator";
|
|
11
|
-
import { ChatInput } from "./chat-input";
|
|
12
|
-
import { useChatThread, useThreadStatus } from "./chat-hooks";
|
|
13
|
-
import { FilePreviewDialog, isImagePath } from "../file-preview/file-preview";
|
|
14
|
-
import { cn } from "../lib/utils";
|
|
8
|
+
import { Button } from "../components/ui/button.js";
|
|
9
|
+
import { Spinner } from "../components/ui/spinner.js";
|
|
10
|
+
import { ChatTypingIndicator } from "./chat-typing-indicator.js";
|
|
11
|
+
import { ChatInput } from "./chat-input.js";
|
|
12
|
+
import { useChatThread, useThreadStatus } from "./chat-hooks.js";
|
|
13
|
+
import { FilePreviewDialog, isImagePath } from "../file-preview/file-preview.js";
|
|
14
|
+
import { cn } from "../lib/utils.js";
|
|
15
15
|
const supportedEventKinds = /* @__PURE__ */ new Set([
|
|
16
16
|
"exec",
|
|
17
17
|
"tool",
|
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { useRoomIndicators } from "@meshagent/meshagent-react";
|
|
4
4
|
import { LoaderCircle, X } from "lucide-react";
|
|
5
|
-
import { formatThreadStatusText } from "./chat-hooks";
|
|
6
|
-
import { cn } from "../lib/utils";
|
|
5
|
+
import { formatThreadStatusText } from "./chat-hooks.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
7
|
function useStatusLabel(text, startedAt) {
|
|
8
8
|
const normalizedText = text?.trim() ?? "";
|
|
9
9
|
const [tick, setTick] = React.useState(0);
|
|
@@ -83,6 +83,9 @@ function threadListPathFromThreadDir(threadDir) {
|
|
|
83
83
|
if (normalized === null) {
|
|
84
84
|
return null;
|
|
85
85
|
}
|
|
86
|
+
if (normalized.startsWith("dataset://")) {
|
|
87
|
+
return `${normalized}/index`;
|
|
88
|
+
}
|
|
86
89
|
return `${normalized}/index.threadl`;
|
|
87
90
|
}
|
|
88
91
|
function basename(path) {
|
|
@@ -252,6 +255,9 @@ function resolvedThreadListPath(threadListPath, {
|
|
|
252
255
|
}
|
|
253
256
|
const normalizedDir = normalizedThreadDir(threadDir);
|
|
254
257
|
if (normalizedDir !== null) {
|
|
258
|
+
if (normalizedDir.startsWith("dataset://")) {
|
|
259
|
+
return `${normalizedDir}/index`;
|
|
260
|
+
}
|
|
255
261
|
return `${normalizedDir}/index.threadl`;
|
|
256
262
|
}
|
|
257
263
|
const defaultThreadDir = defaultThreadDocumentDir(agentName);
|
|
@@ -35,14 +35,14 @@ import ReactMarkdown from "react-markdown";
|
|
|
35
35
|
import rehypeHighlight from "rehype-highlight";
|
|
36
36
|
import rehypeSanitize from "rehype-sanitize";
|
|
37
37
|
import remarkGfm from "remark-gfm";
|
|
38
|
-
import { ChatInput } from "./chat-input";
|
|
39
|
-
import { ChatTypingIndicator } from "./chat-typing-indicator";
|
|
40
|
-
import { Button } from "../components/ui/button";
|
|
41
|
-
import { Spinner } from "../components/ui/spinner";
|
|
42
|
-
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment";
|
|
43
|
-
import { PendingAgentMessage, useThreadStatus } from "./chat-hooks";
|
|
44
|
-
import { cn } from "../lib/utils";
|
|
45
|
-
import { timeAgo } from "./chat-thread";
|
|
38
|
+
import { ChatInput } from "./chat-input.js";
|
|
39
|
+
import { ChatTypingIndicator } from "./chat-typing-indicator.js";
|
|
40
|
+
import { Button } from "../components/ui/button.js";
|
|
41
|
+
import { Spinner } from "../components/ui/spinner.js";
|
|
42
|
+
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment.js";
|
|
43
|
+
import { PendingAgentMessage, useThreadStatus } from "./chat-hooks.js";
|
|
44
|
+
import { cn } from "../lib/utils.js";
|
|
45
|
+
import { timeAgo } from "./chat-thread.js";
|
|
46
46
|
const stickyBottomThresholdPx = 24;
|
|
47
47
|
const maxPreviewEdgePx = 312.5;
|
|
48
48
|
function createDatasetThreadModel() {
|
|
@@ -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.js";
|
|
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 { NewChatThread } from "./new-chat-thread";
|
|
3
|
+
import { NewChatThread } from "./new-chat-thread.js";
|
|
4
4
|
function normalizeSelectedThreadPath(path) {
|
|
5
5
|
const normalized = path?.trim();
|
|
6
6
|
return normalized ? normalized : null;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { MessagingChatClient } from "@meshagent/meshagent-agents";
|
|
4
|
-
import { ChatInput } from "./chat-input";
|
|
5
|
-
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment";
|
|
6
|
-
import { Toaster } from "../components/ui/sonner";
|
|
4
|
+
import { ChatInput } from "./chat-input.js";
|
|
5
|
+
import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment.js";
|
|
6
|
+
import { Toaster } from "../components/ui/sonner.js";
|
|
7
7
|
class NewThreadCancelledError extends Error {
|
|
8
8
|
constructor() {
|
|
9
9
|
super("new thread creation cancelled");
|
|
@@ -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";
|
|
5
|
-
import { UploadStatus } from "./file-attachment";
|
|
6
|
-
import { cn } from "../lib/utils";
|
|
4
|
+
import { Progress } from "../components/ui/progress.js";
|
|
5
|
+
import { UploadStatus } from "./file-attachment.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
7
|
function measureUploadProgress(attachment) {
|
|
8
8
|
if (attachment.size <= 0) {
|
|
9
9
|
return attachment.status === UploadStatus.Completed ? 100 : 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useEffect } from "react";
|
|
4
|
-
import { Button } from "./ui/button";
|
|
4
|
+
import { Button } from "./ui/button.js";
|
|
5
5
|
import {
|
|
6
6
|
Sheet,
|
|
7
7
|
SheetContent,
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
SheetTitle,
|
|
10
10
|
SheetDescription,
|
|
11
11
|
SheetFooter
|
|
12
|
-
} from "./ui/sheet";
|
|
13
|
-
import { registerPane, closePane } from "../lib/pane-service";
|
|
12
|
+
} from "./ui/sheet.js";
|
|
13
|
+
import { registerPane, closePane } from "../lib/pane-service.js";
|
|
14
14
|
function PaneExample() {
|
|
15
15
|
const [open, setOpen] = useState(false);
|
|
16
16
|
useEffect(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
5
|
const buttonVariants = cva(
|
|
6
6
|
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
7
7
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
3
|
import { XIcon } from "lucide-react";
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
5
|
function Dialog({
|
|
6
6
|
...props
|
|
7
7
|
}) {
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
useFormContext,
|
|
8
8
|
useFormState
|
|
9
9
|
} from "react-hook-form";
|
|
10
|
-
import { cn } from "../../lib/utils";
|
|
11
|
-
import { Label } from "../../components/ui/label";
|
|
10
|
+
import { cn } from "../../lib/utils.js";
|
|
11
|
+
import { Label } from "../../components/ui/label.js";
|
|
12
12
|
const Form = FormProvider;
|
|
13
13
|
const FormFieldContext = React.createContext(
|
|
14
14
|
{}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3
|
-
import { cn } from "../../lib/utils";
|
|
3
|
+
import { cn } from "../../lib/utils.js";
|
|
4
4
|
function Progress({ className, value, ...props }) {
|
|
5
5
|
return /* @__PURE__ */ jsx(
|
|
6
6
|
ProgressPrimitive.Root,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
4
4
|
import { CircleIcon } from "lucide-react";
|
|
5
|
-
import { cn } from "../../lib/utils";
|
|
5
|
+
import { cn } from "../../lib/utils.js";
|
|
6
6
|
function RadioGroup({
|
|
7
7
|
className,
|
|
8
8
|
...props
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
3
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
5
|
function Select({
|
|
6
6
|
...props
|
|
7
7
|
}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
3
3
|
import { XIcon } from "lucide-react";
|
|
4
|
-
import { cn } from "../../lib/utils";
|
|
4
|
+
import { cn } from "../../lib/utils.js";
|
|
5
5
|
function Sheet({ ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
7
7
|
}
|