@meshagent/meshagent-tailwind 0.43.2 → 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.
Files changed (99) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/chat/agent-thread-message-status-store.d.ts +107 -0
  3. package/dist/cjs/chat/agent-thread-message-status-store.js +649 -0
  4. package/dist/cjs/chat/agent-thread.d.ts +87 -0
  5. package/dist/cjs/chat/agent-thread.js +1673 -0
  6. package/dist/cjs/chat/chat-bot-view.d.ts +9 -5
  7. package/dist/cjs/chat/chat-bot-view.js +44 -536
  8. package/dist/cjs/chat/chat-hooks.d.ts +6 -5
  9. package/dist/cjs/chat/chat-hooks.js +21 -466
  10. package/dist/cjs/chat/chat-typing-indicator.d.ts +15 -1
  11. package/dist/cjs/chat/chat-typing-indicator.js +35 -5
  12. package/dist/cjs/chat/file-attachment.d.ts +7 -3
  13. package/dist/cjs/chat/file-attachment.js +30 -6
  14. package/dist/cjs/chat/multi-thread-view.d.ts +5 -2
  15. package/dist/cjs/chat/multi-thread-view.js +6 -2
  16. package/dist/cjs/chat/new-chat-thread.d.ts +5 -2
  17. package/dist/cjs/chat/new-chat-thread.js +10 -3
  18. package/dist/cjs/chat/thread-list-view.d.ts +22 -0
  19. package/dist/cjs/chat/thread-list-view.js +518 -0
  20. package/dist/cjs/chat/tool-call-status-accumulator.d.ts +69 -0
  21. package/dist/cjs/chat/tool-call-status-accumulator.js +268 -0
  22. package/dist/cjs/components/pane-example.d.ts +1 -1
  23. package/dist/cjs/components/ui/avatar.d.ts +3 -3
  24. package/dist/cjs/components/ui/button.d.ts +3 -3
  25. package/dist/cjs/components/ui/card.d.ts +7 -7
  26. package/dist/cjs/components/ui/dialog.d.ts +10 -10
  27. package/dist/cjs/components/ui/form.d.ts +7 -7
  28. package/dist/cjs/components/ui/input.d.ts +1 -1
  29. package/dist/cjs/components/ui/label.d.ts +1 -1
  30. package/dist/cjs/components/ui/progress.d.ts +1 -1
  31. package/dist/cjs/components/ui/radio-group.d.ts +2 -2
  32. package/dist/cjs/components/ui/select.d.ts +10 -10
  33. package/dist/cjs/components/ui/sheet.d.ts +8 -8
  34. package/dist/cjs/components/ui/skeleton.d.ts +1 -1
  35. package/dist/cjs/components/ui/sonner.d.ts +1 -1
  36. package/dist/cjs/components/ui/spinner.d.ts +2 -2
  37. package/dist/cjs/components/ui/textarea.d.ts +1 -1
  38. package/dist/cjs/file-preview/file-preview.d.ts +1 -0
  39. package/dist/cjs/file-preview/file-preview.js +43 -7
  40. package/dist/cjs/index.d.ts +4 -2
  41. package/dist/cjs/index.js +14 -2
  42. package/dist/cjs/meetings/camera-grid.d.ts +2 -2
  43. package/dist/cjs/tools/ask-user-for-file.js +2 -2
  44. package/dist/cjs/tools/file-dialog.d.ts +2 -1
  45. package/dist/cjs/tools/form-dialog.d.ts +2 -1
  46. package/dist/esm/chat/agent-thread-message-status-store.d.ts +107 -0
  47. package/dist/esm/chat/agent-thread-message-status-store.js +647 -0
  48. package/dist/esm/chat/agent-thread.d.ts +87 -0
  49. package/dist/esm/chat/agent-thread.js +1682 -0
  50. package/dist/esm/chat/chat-bot-view.d.ts +9 -5
  51. package/dist/esm/chat/chat-bot-view.js +51 -566
  52. package/dist/esm/chat/chat-hooks.d.ts +6 -5
  53. package/dist/esm/chat/chat-hooks.js +23 -468
  54. package/dist/esm/chat/chat-typing-indicator.d.ts +15 -1
  55. package/dist/esm/chat/chat-typing-indicator.js +35 -5
  56. package/dist/esm/chat/file-attachment.d.ts +7 -3
  57. package/dist/esm/chat/file-attachment.js +30 -6
  58. package/dist/esm/chat/multi-thread-view.d.ts +5 -2
  59. package/dist/esm/chat/multi-thread-view.js +6 -2
  60. package/dist/esm/chat/new-chat-thread.d.ts +5 -2
  61. package/dist/esm/chat/new-chat-thread.js +11 -4
  62. package/dist/esm/chat/thread-list-view.d.ts +22 -0
  63. package/dist/esm/chat/thread-list-view.js +514 -0
  64. package/dist/esm/chat/tool-call-status-accumulator.d.ts +69 -0
  65. package/dist/esm/chat/tool-call-status-accumulator.js +248 -0
  66. package/dist/esm/components/pane-example.d.ts +1 -1
  67. package/dist/esm/components/ui/avatar.d.ts +3 -3
  68. package/dist/esm/components/ui/button.d.ts +3 -3
  69. package/dist/esm/components/ui/card.d.ts +7 -7
  70. package/dist/esm/components/ui/dialog.d.ts +10 -10
  71. package/dist/esm/components/ui/form.d.ts +7 -7
  72. package/dist/esm/components/ui/input.d.ts +1 -1
  73. package/dist/esm/components/ui/label.d.ts +1 -1
  74. package/dist/esm/components/ui/progress.d.ts +1 -1
  75. package/dist/esm/components/ui/radio-group.d.ts +2 -2
  76. package/dist/esm/components/ui/select.d.ts +10 -10
  77. package/dist/esm/components/ui/sheet.d.ts +8 -8
  78. package/dist/esm/components/ui/skeleton.d.ts +1 -1
  79. package/dist/esm/components/ui/sonner.d.ts +1 -1
  80. package/dist/esm/components/ui/spinner.d.ts +2 -2
  81. package/dist/esm/components/ui/textarea.d.ts +1 -1
  82. package/dist/esm/file-preview/file-preview.d.ts +1 -0
  83. package/dist/esm/file-preview/file-preview.js +31 -5
  84. package/dist/esm/index.d.ts +4 -2
  85. package/dist/esm/index.js +10 -2
  86. package/dist/esm/meetings/camera-grid.d.ts +2 -2
  87. package/dist/esm/tools/ask-user-for-file.js +2 -2
  88. package/dist/esm/tools/file-dialog.d.ts +2 -1
  89. package/dist/esm/tools/form-dialog.d.ts +2 -1
  90. package/dist/index.css +1 -1
  91. package/package.json +10 -5
  92. package/dist/cjs/chat/chat-thread.d.ts +0 -12
  93. package/dist/cjs/chat/chat-thread.js +0 -815
  94. package/dist/cjs/chat/dataset-chat-thread.d.ts +0 -16
  95. package/dist/cjs/chat/dataset-chat-thread.js +0 -1813
  96. package/dist/esm/chat/chat-thread.d.ts +0 -12
  97. package/dist/esm/chat/chat-thread.js +0 -785
  98. package/dist/esm/chat/dataset-chat-thread.d.ts +0 -16
  99. package/dist/esm/chat/dataset-chat-thread.js +0 -1811
@@ -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
- protected constructor({ path, initialStatus, }: {
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);
@@ -6,16 +6,36 @@ var UploadStatus = /* @__PURE__ */ ((UploadStatus2) => {
6
6
  UploadStatus2["Failed"] = "failed";
7
7
  return UploadStatus2;
8
8
  })(UploadStatus || {});
9
+ function defaultSuggestedFileNameFromPath(path) {
10
+ const trimmed = path.trim();
11
+ if (trimmed === "") {
12
+ return "file";
13
+ }
14
+ if (trimmed.startsWith("data:")) {
15
+ return "attachment";
16
+ }
17
+ const slash = trimmed.lastIndexOf("/");
18
+ if (slash < 0 || slash === trimmed.length - 1) {
19
+ return trimmed === "" ? "file" : trimmed;
20
+ }
21
+ return trimmed.slice(slash + 1);
22
+ }
9
23
  class FileAttachment extends EventEmitter {
10
24
  _status;
11
25
  path;
26
+ mimeType;
27
+ displayName;
12
28
  constructor({
13
29
  path,
14
- initialStatus = "initial" /* Initial */
30
+ initialStatus = "initial" /* Initial */,
31
+ mimeType,
32
+ displayName
15
33
  }) {
16
34
  super();
17
35
  this.path = path;
18
36
  this._status = initialStatus;
37
+ this.mimeType = mimeType;
38
+ this.displayName = displayName;
19
39
  }
20
40
  get status() {
21
41
  return this._status;
@@ -30,7 +50,11 @@ class FileAttachment extends EventEmitter {
30
50
  this.emit("change", void 0);
31
51
  }
32
52
  get filename() {
33
- return this.path.split("/").pop() ?? "";
53
+ const explicitName = this.displayName?.trim();
54
+ if (explicitName) {
55
+ return explicitName;
56
+ }
57
+ return defaultSuggestedFileNameFromPath(this.path);
34
58
  }
35
59
  get size() {
36
60
  return 0;
@@ -50,8 +74,8 @@ class MeshagentFileUpload extends FileAttachment {
50
74
  _rejectDownloadUrl;
51
75
  _bytesUploaded = 0;
52
76
  _size;
53
- constructor(room, path, dataStream, size = 0, autoStart = true) {
54
- super({ path });
77
+ constructor(room, path, dataStream, size = 0, autoStart = true, mimeType, displayName) {
78
+ super({ path, mimeType, displayName });
55
79
  this.room = room;
56
80
  this.dataStream = dataStream;
57
81
  this._size = size;
@@ -67,8 +91,8 @@ class MeshagentFileUpload extends FileAttachment {
67
91
  this.startUpload();
68
92
  }
69
93
  }
70
- static deferred(room, path, dataStream, size = 0) {
71
- return new MeshagentFileUpload(room, path, dataStream, size, false);
94
+ static deferred(room, path, dataStream, size = 0, mimeType, displayName) {
95
+ return new MeshagentFileUpload(room, path, dataStream, size, false, mimeType, displayName);
72
96
  }
73
97
  get bytesUploaded() {
74
98
  return this._bytesUploaded;
@@ -1,6 +1,7 @@
1
1
  import type { ReactElement } from "react";
2
2
  import { RoomClient } from "@meshagent/meshagent";
3
- import type { BaseChatClient } from "@meshagent/meshagent-agents";
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;
@@ -17,5 +18,7 @@ export interface MultiThreadViewProps {
17
18
  centerComposer?: boolean;
18
19
  emptyStateTitle?: string;
19
20
  emptyStateDescription?: string;
21
+ clientToolkits?: ClientToolkitDescription[];
22
+ toolChoice?: AgentToolChoice;
20
23
  }
21
- export declare function MultiThreadView({ room, chatClient, disposeChatClient, agentName, builder, toolkit, tool, selectedThreadPath, onSelectedThreadPathChanged, onSelectedThreadResolved, newThreadResetVersion, centerComposer, emptyStateTitle, emptyStateDescription, }: 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;
@@ -19,7 +19,9 @@ function MultiThreadView({
19
19
  newThreadResetVersion = 0,
20
20
  centerComposer = true,
21
21
  emptyStateTitle = "Start a new thread",
22
- emptyStateDescription = "Connect with this agent and your team"
22
+ emptyStateDescription = "Connect with this agent and your team",
23
+ clientToolkits,
24
+ toolChoice
23
25
  }) {
24
26
  const controlledSelectedThreadPath = selectedThreadPath !== void 0 ? normalizeSelectedThreadPath(selectedThreadPath) : void 0;
25
27
  const [internalSelectedThreadPath, setInternalSelectedThreadPath] = useState(() => controlledSelectedThreadPath ?? null);
@@ -67,7 +69,9 @@ function MultiThreadView({
67
69
  onSelectedThreadResolved?.(normalizedPath, displayName);
68
70
  },
69
71
  emptyStateTitle,
70
- emptyStateDescription
72
+ emptyStateDescription,
73
+ clientToolkits,
74
+ toolChoice
71
75
  },
72
76
  composerKey
73
77
  );
@@ -1,6 +1,7 @@
1
1
  import type { ReactElement } from "react";
2
2
  import { RoomClient } from "@meshagent/meshagent";
3
- import type { BaseChatClient } from "@meshagent/meshagent-agents";
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;
@@ -16,5 +17,7 @@ export interface NewChatThreadProps {
16
17
  centerComposer?: boolean;
17
18
  emptyStateTitle?: string;
18
19
  emptyStateDescription?: string;
20
+ clientToolkits?: ClientToolkitDescription[];
21
+ toolChoice?: AgentToolChoice;
19
22
  }
20
- export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, }: NewChatThreadProps): ReactElement;
23
+ export declare function NewChatThread({ room, chatClient, disposeChatClient, agentName, builder, selectedThreadPath, onThreadPathChanged, onThreadResolved, centerComposer, emptyStateTitle, emptyStateDescription, clientToolkits, toolChoice, }: NewChatThreadProps): ReactElement;
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
3
- import { MessagingChatClient } from "@meshagent/meshagent-agents";
3
+ import { MessagingChatClient, ToolChoice } from "@meshagent/meshagent-agents";
4
+ import { defaultThreadDisplayNameFromPath } from "./conversation-descriptor.js";
4
5
  import { ChatInput } from "./chat-input.js";
5
6
  import { MeshagentFileUpload, fileToAsyncIterable } from "./file-attachment.js";
6
7
  import { Toaster } from "../components/ui/sonner.js";
@@ -75,7 +76,9 @@ function NewChatThread({
75
76
  onThreadResolved,
76
77
  centerComposer = true,
77
78
  emptyStateTitle,
78
- emptyStateDescription
79
+ emptyStateDescription,
80
+ clientToolkits,
81
+ toolChoice
79
82
  }) {
80
83
  const [internalThreadPath, setInternalThreadPath] = useState(null);
81
84
  const [newThreadDraft, setNewThreadDraft] = useState("");
@@ -170,12 +173,14 @@ function NewChatThread({
170
173
  const result = await activeChatClient.startThread({
171
174
  message: text,
172
175
  attachments: newThreadAttachments.map((attachment) => attachment.path),
173
- senderName: getParticipantName(room.localParticipant) || void 0
176
+ senderName: getParticipantName(room.localParticipant) || void 0,
177
+ clientToolkits,
178
+ toolChoice: toolChoice == null ? void 0 : new ToolChoice({ toolkitName: toolChoice.toolkitName, toolName: toolChoice.toolName })
174
179
  });
175
180
  ensureOperationActive(operationId, activeOperationRef);
176
181
  const threadPath = result.threadPath;
177
- const displayName = null;
178
182
  const normalizedPath = normalizeThreadPath(threadPath);
183
+ const displayName = normalizedPath === null ? null : defaultThreadDisplayNameFromPath(normalizedPath);
179
184
  if (controlledThreadPath === void 0) {
180
185
  setInternalThreadPath(normalizedPath);
181
186
  }
@@ -202,6 +207,8 @@ function NewChatThread({
202
207
  creatingNewThread,
203
208
  newThreadAttachments,
204
209
  newThreadDraft,
210
+ clientToolkits,
211
+ toolChoice,
205
212
  onThreadPathChanged,
206
213
  onThreadResolved,
207
214
  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;