@meshagent/meshagent-tailwind 0.43.3 → 0.44.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 +11 -0
- package/dist/cjs/chat/agent-thread-message-status-store.d.ts +107 -0
- package/dist/cjs/chat/agent-thread-message-status-store.js +649 -0
- package/dist/cjs/chat/agent-thread.d.ts +76 -4
- package/dist/cjs/chat/agent-thread.js +1114 -54
- package/dist/cjs/chat/chat-bot-view.d.ts +7 -4
- package/dist/cjs/chat/chat-bot-view.js +33 -525
- package/dist/cjs/chat/chat-hooks.d.ts +6 -5
- package/dist/cjs/chat/chat-hooks.js +21 -466
- package/dist/cjs/chat/chat-typing-indicator.d.ts +15 -1
- package/dist/cjs/chat/chat-typing-indicator.js +35 -5
- package/dist/cjs/chat/file-attachment.d.ts +7 -3
- package/dist/cjs/chat/file-attachment.js +30 -6
- package/dist/cjs/chat/multi-thread-view.d.ts +3 -1
- package/dist/cjs/chat/multi-thread-view.js +4 -2
- package/dist/cjs/chat/new-chat-thread.d.ts +3 -1
- package/dist/cjs/chat/new-chat-thread.js +7 -3
- package/dist/cjs/chat/thread-list-view.d.ts +22 -0
- package/dist/cjs/chat/thread-list-view.js +518 -0
- package/dist/cjs/chat/tool-call-status-accumulator.d.ts +69 -0
- package/dist/cjs/chat/tool-call-status-accumulator.js +268 -0
- package/dist/cjs/components/pane-example.d.ts +1 -1
- package/dist/cjs/components/ui/avatar.d.ts +3 -3
- package/dist/cjs/components/ui/button.d.ts +3 -3
- package/dist/cjs/components/ui/card.d.ts +7 -7
- package/dist/cjs/components/ui/dialog.d.ts +10 -10
- package/dist/cjs/components/ui/form.d.ts +7 -7
- package/dist/cjs/components/ui/input.d.ts +1 -1
- package/dist/cjs/components/ui/label.d.ts +1 -1
- package/dist/cjs/components/ui/progress.d.ts +1 -1
- package/dist/cjs/components/ui/radio-group.d.ts +2 -2
- package/dist/cjs/components/ui/select.d.ts +10 -10
- package/dist/cjs/components/ui/sheet.d.ts +8 -8
- package/dist/cjs/components/ui/skeleton.d.ts +1 -1
- package/dist/cjs/components/ui/sonner.d.ts +1 -1
- package/dist/cjs/components/ui/spinner.d.ts +2 -2
- package/dist/cjs/components/ui/textarea.d.ts +1 -1
- package/dist/cjs/file-preview/file-preview.d.ts +1 -0
- package/dist/cjs/file-preview/file-preview.js +41 -5
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/meetings/camera-grid.d.ts +2 -2
- package/dist/cjs/tools/ask-user-for-file.js +2 -2
- package/dist/cjs/tools/file-dialog.d.ts +2 -1
- package/dist/cjs/tools/form-dialog.d.ts +2 -1
- package/dist/esm/chat/agent-thread-message-status-store.d.ts +107 -0
- package/dist/esm/chat/agent-thread-message-status-store.js +647 -0
- package/dist/esm/chat/agent-thread.d.ts +76 -4
- package/dist/esm/chat/agent-thread.js +1132 -56
- package/dist/esm/chat/chat-bot-view.d.ts +7 -4
- package/dist/esm/chat/chat-bot-view.js +40 -555
- package/dist/esm/chat/chat-hooks.d.ts +6 -5
- package/dist/esm/chat/chat-hooks.js +23 -468
- package/dist/esm/chat/chat-typing-indicator.d.ts +15 -1
- package/dist/esm/chat/chat-typing-indicator.js +35 -5
- package/dist/esm/chat/file-attachment.d.ts +7 -3
- package/dist/esm/chat/file-attachment.js +30 -6
- package/dist/esm/chat/multi-thread-view.d.ts +3 -1
- package/dist/esm/chat/multi-thread-view.js +4 -2
- package/dist/esm/chat/new-chat-thread.d.ts +3 -1
- package/dist/esm/chat/new-chat-thread.js +8 -4
- package/dist/esm/chat/thread-list-view.d.ts +22 -0
- package/dist/esm/chat/thread-list-view.js +514 -0
- package/dist/esm/chat/tool-call-status-accumulator.d.ts +69 -0
- package/dist/esm/chat/tool-call-status-accumulator.js +248 -0
- package/dist/esm/components/pane-example.d.ts +1 -1
- package/dist/esm/components/ui/avatar.d.ts +3 -3
- package/dist/esm/components/ui/button.d.ts +3 -3
- package/dist/esm/components/ui/card.d.ts +7 -7
- package/dist/esm/components/ui/dialog.d.ts +10 -10
- package/dist/esm/components/ui/form.d.ts +7 -7
- package/dist/esm/components/ui/input.d.ts +1 -1
- package/dist/esm/components/ui/label.d.ts +1 -1
- package/dist/esm/components/ui/progress.d.ts +1 -1
- package/dist/esm/components/ui/radio-group.d.ts +2 -2
- package/dist/esm/components/ui/select.d.ts +10 -10
- package/dist/esm/components/ui/sheet.d.ts +8 -8
- package/dist/esm/components/ui/skeleton.d.ts +1 -1
- package/dist/esm/components/ui/sonner.d.ts +1 -1
- package/dist/esm/components/ui/spinner.d.ts +2 -2
- package/dist/esm/components/ui/textarea.d.ts +1 -1
- package/dist/esm/file-preview/file-preview.d.ts +1 -0
- package/dist/esm/file-preview/file-preview.js +29 -3
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +9 -0
- package/dist/esm/meetings/camera-grid.d.ts +2 -2
- package/dist/esm/tools/ask-user-for-file.js +2 -2
- package/dist/esm/tools/file-dialog.d.ts +2 -1
- package/dist/esm/tools/form-dialog.d.ts +2 -1
- package/dist/index.css +1 -1
- package/package.json +4 -4
- package/dist/cjs/chat/chat-bot-view.test.js +0 -325
- package/dist/cjs/chat/live-chat-widgets.test.js +0 -256
- package/dist/esm/chat/chat-bot-view.test.js +0 -336
- package/dist/esm/chat/live-chat-widgets.test.js +0 -262
|
@@ -8,9 +8,13 @@ export declare enum UploadStatus {
|
|
|
8
8
|
export declare abstract class FileAttachment extends EventEmitter<void> {
|
|
9
9
|
protected _status: UploadStatus;
|
|
10
10
|
path: string;
|
|
11
|
-
|
|
11
|
+
readonly mimeType?: string;
|
|
12
|
+
readonly displayName?: string;
|
|
13
|
+
protected constructor({ path, initialStatus, mimeType, displayName, }: {
|
|
12
14
|
path: string;
|
|
13
15
|
initialStatus?: UploadStatus;
|
|
16
|
+
mimeType?: string;
|
|
17
|
+
displayName?: string;
|
|
14
18
|
});
|
|
15
19
|
get status(): UploadStatus;
|
|
16
20
|
protected set status(value: UploadStatus);
|
|
@@ -31,8 +35,8 @@ export declare class MeshagentFileUpload extends FileAttachment {
|
|
|
31
35
|
private _rejectDownloadUrl;
|
|
32
36
|
private _bytesUploaded;
|
|
33
37
|
private _size;
|
|
34
|
-
constructor(room: RoomClient, path: string, dataStream: AsyncIterable<Uint8Array>, size?: number, autoStart?: boolean);
|
|
35
|
-
static deferred(room: RoomClient, path: string, dataStream: AsyncIterable<Uint8Array>, size?: number): MeshagentFileUpload;
|
|
38
|
+
constructor(room: RoomClient, path: string, dataStream: AsyncIterable<Uint8Array>, size?: number, autoStart?: boolean, mimeType?: string, displayName?: string);
|
|
39
|
+
static deferred(room: RoomClient, path: string, dataStream: AsyncIterable<Uint8Array>, size?: number, mimeType?: string, displayName?: string): MeshagentFileUpload;
|
|
36
40
|
get bytesUploaded(): number;
|
|
37
41
|
get size(): number;
|
|
38
42
|
set size(value: number);
|
|
@@ -32,16 +32,36 @@ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
|
|
|
32
32
|
UploadStatus2["Failed"] = "failed";
|
|
33
33
|
return UploadStatus2;
|
|
34
34
|
})(UploadStatus || {});
|
|
35
|
+
function defaultSuggestedFileNameFromPath(path) {
|
|
36
|
+
const trimmed = path.trim();
|
|
37
|
+
if (trimmed === "") {
|
|
38
|
+
return "file";
|
|
39
|
+
}
|
|
40
|
+
if (trimmed.startsWith("data:")) {
|
|
41
|
+
return "attachment";
|
|
42
|
+
}
|
|
43
|
+
const slash = trimmed.lastIndexOf("/");
|
|
44
|
+
if (slash < 0 || slash === trimmed.length - 1) {
|
|
45
|
+
return trimmed === "" ? "file" : trimmed;
|
|
46
|
+
}
|
|
47
|
+
return trimmed.slice(slash + 1);
|
|
48
|
+
}
|
|
35
49
|
class FileAttachment extends import_meshagent.EventEmitter {
|
|
36
50
|
_status;
|
|
37
51
|
path;
|
|
52
|
+
mimeType;
|
|
53
|
+
displayName;
|
|
38
54
|
constructor({
|
|
39
55
|
path,
|
|
40
|
-
initialStatus = "initial" /* Initial
|
|
56
|
+
initialStatus = "initial" /* Initial */,
|
|
57
|
+
mimeType,
|
|
58
|
+
displayName
|
|
41
59
|
}) {
|
|
42
60
|
super();
|
|
43
61
|
this.path = path;
|
|
44
62
|
this._status = initialStatus;
|
|
63
|
+
this.mimeType = mimeType;
|
|
64
|
+
this.displayName = displayName;
|
|
45
65
|
}
|
|
46
66
|
get status() {
|
|
47
67
|
return this._status;
|
|
@@ -56,7 +76,11 @@ class FileAttachment extends import_meshagent.EventEmitter {
|
|
|
56
76
|
this.emit("change", void 0);
|
|
57
77
|
}
|
|
58
78
|
get filename() {
|
|
59
|
-
|
|
79
|
+
const explicitName = this.displayName?.trim();
|
|
80
|
+
if (explicitName) {
|
|
81
|
+
return explicitName;
|
|
82
|
+
}
|
|
83
|
+
return defaultSuggestedFileNameFromPath(this.path);
|
|
60
84
|
}
|
|
61
85
|
get size() {
|
|
62
86
|
return 0;
|
|
@@ -76,8 +100,8 @@ class MeshagentFileUpload extends FileAttachment {
|
|
|
76
100
|
_rejectDownloadUrl;
|
|
77
101
|
_bytesUploaded = 0;
|
|
78
102
|
_size;
|
|
79
|
-
constructor(room, path, dataStream, size = 0, autoStart = true) {
|
|
80
|
-
super({ path });
|
|
103
|
+
constructor(room, path, dataStream, size = 0, autoStart = true, mimeType, displayName) {
|
|
104
|
+
super({ path, mimeType, displayName });
|
|
81
105
|
this.room = room;
|
|
82
106
|
this.dataStream = dataStream;
|
|
83
107
|
this._size = size;
|
|
@@ -93,8 +117,8 @@ class MeshagentFileUpload extends FileAttachment {
|
|
|
93
117
|
this.startUpload();
|
|
94
118
|
}
|
|
95
119
|
}
|
|
96
|
-
static deferred(room, path, dataStream, size = 0) {
|
|
97
|
-
return new MeshagentFileUpload(room, path, dataStream, size, false);
|
|
120
|
+
static deferred(room, path, dataStream, size = 0, mimeType, displayName) {
|
|
121
|
+
return new MeshagentFileUpload(room, path, dataStream, size, false, mimeType, displayName);
|
|
98
122
|
}
|
|
99
123
|
get bytesUploaded() {
|
|
100
124
|
return this._bytesUploaded;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { RoomClient } from "@meshagent/meshagent";
|
|
3
3
|
import type { BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
|
|
4
|
+
import type { AgentToolChoice } from "./agent-thread.js";
|
|
4
5
|
export type MultiThreadContentBuilder = (threadPath: string) => ReactElement;
|
|
5
6
|
export interface MultiThreadViewProps {
|
|
6
7
|
room: RoomClient;
|
|
@@ -18,5 +19,6 @@ export interface MultiThreadViewProps {
|
|
|
18
19
|
emptyStateTitle?: string;
|
|
19
20
|
emptyStateDescription?: string;
|
|
20
21
|
clientToolkits?: ClientToolkitDescription[];
|
|
22
|
+
toolChoice?: AgentToolChoice;
|
|
21
23
|
}
|
|
22
|
-
export declare function MultiThreadView({ room, chatClient, disposeChatClient, agentName, builder, toolkit, tool, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, }: MultiThreadViewProps): ReactElement;
|
|
24
|
+
export declare function MultiThreadView({ room, chatClient, disposeChatClient, agentName, builder, toolkit, tool, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, toolChoice, }: MultiThreadViewProps): ReactElement;
|
|
@@ -43,7 +43,8 @@ function MultiThreadView({
|
|
|
43
43
|
centerComposer = true,
|
|
44
44
|
emptyStateTitle = "Start a new thread",
|
|
45
45
|
emptyStateDescription = "Connect with this agent and your team",
|
|
46
|
-
clientToolkits
|
|
46
|
+
clientToolkits,
|
|
47
|
+
toolChoice
|
|
47
48
|
}) {
|
|
48
49
|
const controlledSelectedThreadPath = selectedThreadPath !== void 0 ? normalizeSelectedThreadPath(selectedThreadPath) : void 0;
|
|
49
50
|
const [internalSelectedThreadPath, setInternalSelectedThreadPath] = (0, import_react.useState)(() => controlledSelectedThreadPath ?? null);
|
|
@@ -92,7 +93,8 @@ function MultiThreadView({
|
|
|
92
93
|
},
|
|
93
94
|
emptyStateTitle,
|
|
94
95
|
emptyStateDescription,
|
|
95
|
-
clientToolkits
|
|
96
|
+
clientToolkits,
|
|
97
|
+
toolChoice
|
|
96
98
|
},
|
|
97
99
|
composerKey
|
|
98
100
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
import { RoomClient } from "@meshagent/meshagent";
|
|
3
3
|
import type { BaseChatClient, ClientToolkitDescription } from "@meshagent/meshagent-agents";
|
|
4
|
+
import type { AgentToolChoice } from "./agent-thread.js";
|
|
4
5
|
export type NewChatThreadBuilder = (threadPath: string) => ReactElement;
|
|
5
6
|
export interface NewChatThreadProps {
|
|
6
7
|
room: RoomClient;
|
|
@@ -17,5 +18,6 @@ export interface NewChatThreadProps {
|
|
|
17
18
|
emptyStateTitle?: string;
|
|
18
19
|
emptyStateDescription?: string;
|
|
19
20
|
clientToolkits?: ClientToolkitDescription[];
|
|
21
|
+
toolChoice?: AgentToolChoice;
|
|
20
22
|
}
|
|
21
|
-
export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, }: NewChatThreadProps): ReactElement;
|
|
23
|
+
export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, toolChoice, }: NewChatThreadProps): ReactElement;
|
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(new_chat_thread_exports);
|
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_react = require("react");
|
|
26
26
|
var import_meshagent_agents = require("@meshagent/meshagent-agents");
|
|
27
|
+
var import_conversation_descriptor = require("./conversation-descriptor.js");
|
|
27
28
|
var import_chat_input = require("./chat-input.js");
|
|
28
29
|
var import_file_attachment = require("./file-attachment.js");
|
|
29
30
|
var import_sonner = require("../components/ui/sonner.js");
|
|
@@ -99,7 +100,8 @@ function NewChatThread({
|
|
|
99
100
|
centerComposer = true,
|
|
100
101
|
emptyStateTitle,
|
|
101
102
|
emptyStateDescription,
|
|
102
|
-
clientToolkits
|
|
103
|
+
clientToolkits,
|
|
104
|
+
toolChoice
|
|
103
105
|
}) {
|
|
104
106
|
const [internalThreadPath, setInternalThreadPath] = (0, import_react.useState)(null);
|
|
105
107
|
const [newThreadDraft, setNewThreadDraft] = (0, import_react.useState)("");
|
|
@@ -195,12 +197,13 @@ function NewChatThread({
|
|
|
195
197
|
message: text,
|
|
196
198
|
attachments: newThreadAttachments.map((attachment) => attachment.path),
|
|
197
199
|
senderName: getParticipantName(room.localParticipant) || void 0,
|
|
198
|
-
clientToolkits
|
|
200
|
+
clientToolkits,
|
|
201
|
+
toolChoice: toolChoice == null ? void 0 : new import_meshagent_agents.ToolChoice({ toolkitName: toolChoice.toolkitName, toolName: toolChoice.toolName })
|
|
199
202
|
});
|
|
200
203
|
ensureOperationActive(operationId, activeOperationRef);
|
|
201
204
|
const threadPath = result.threadPath;
|
|
202
|
-
const displayName = null;
|
|
203
205
|
const normalizedPath = normalizeThreadPath(threadPath);
|
|
206
|
+
const displayName = normalizedPath === null ? null : (0, import_conversation_descriptor.defaultThreadDisplayNameFromPath)(normalizedPath);
|
|
204
207
|
if (controlledThreadPath === void 0) {
|
|
205
208
|
setInternalThreadPath(normalizedPath);
|
|
206
209
|
}
|
|
@@ -228,6 +231,7 @@ function NewChatThread({
|
|
|
228
231
|
newThreadAttachments,
|
|
229
232
|
newThreadDraft,
|
|
230
233
|
clientToolkits,
|
|
234
|
+
toolChoice,
|
|
231
235
|
onThreadPathChanged,
|
|
232
236
|
onThreadResolved,
|
|
233
237
|
room,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import { RoomClient } from "@meshagent/meshagent";
|
|
3
|
+
import type { BaseChatClient } from "@meshagent/meshagent-agents";
|
|
4
|
+
export interface ChatThreadListEntry {
|
|
5
|
+
path: string;
|
|
6
|
+
name: string;
|
|
7
|
+
createdAt: string;
|
|
8
|
+
modifiedAt: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ThreadListViewProps {
|
|
11
|
+
room: RoomClient;
|
|
12
|
+
chatClient?: BaseChatClient | null;
|
|
13
|
+
selectedThreadPath?: string | null;
|
|
14
|
+
selectedThreadDisplayName?: string | null;
|
|
15
|
+
agentName?: string | null;
|
|
16
|
+
showCreateItem?: boolean;
|
|
17
|
+
newThreadResetVersion?: number;
|
|
18
|
+
onSelectedThreadPathChanged: (path: string | null) => void;
|
|
19
|
+
onSelectedThreadResolved?: (path: string | null, displayName: string | null) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare function defaultAgentThreadListPath(agentName?: string | null): string | null;
|
|
22
|
+
export declare function ThreadListView({ room, chatClient, selectedThreadPath, selectedThreadDisplayName, agentName, showCreateItem, newThreadResetVersion, onSelectedThreadPathChanged, onSelectedThreadResolved, }: ThreadListViewProps): ReactElement;
|