@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);
@@ -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
- return this.path.split("/").pop() ?? "";
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
- 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;
@@ -42,7 +42,9 @@ function MultiThreadView({
42
42
  newThreadResetVersion = 0,
43
43
  centerComposer = true,
44
44
  emptyStateTitle = "Start a new thread",
45
- emptyStateDescription = "Connect with this agent and your team"
45
+ emptyStateDescription = "Connect with this agent and your team",
46
+ clientToolkits,
47
+ toolChoice
46
48
  }) {
47
49
  const controlledSelectedThreadPath = selectedThreadPath !== void 0 ? normalizeSelectedThreadPath(selectedThreadPath) : void 0;
48
50
  const [internalSelectedThreadPath, setInternalSelectedThreadPath] = (0, import_react.useState)(() => controlledSelectedThreadPath ?? null);
@@ -90,7 +92,9 @@ function MultiThreadView({
90
92
  onSelectedThreadResolved?.(normalizedPath, displayName);
91
93
  },
92
94
  emptyStateTitle,
93
- emptyStateDescription
95
+ emptyStateDescription,
96
+ clientToolkits,
97
+ toolChoice
94
98
  },
95
99
  composerKey
96
100
  );
@@ -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;
@@ -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");
@@ -98,7 +99,9 @@ function NewChatThread({
98
99
  onThreadResolved,
99
100
  centerComposer = true,
100
101
  emptyStateTitle,
101
- emptyStateDescription
102
+ emptyStateDescription,
103
+ clientToolkits,
104
+ toolChoice
102
105
  }) {
103
106
  const [internalThreadPath, setInternalThreadPath] = (0, import_react.useState)(null);
104
107
  const [newThreadDraft, setNewThreadDraft] = (0, import_react.useState)("");
@@ -193,12 +196,14 @@ function NewChatThread({
193
196
  const result = await activeChatClient.startThread({
194
197
  message: text,
195
198
  attachments: newThreadAttachments.map((attachment) => attachment.path),
196
- senderName: getParticipantName(room.localParticipant) || void 0
199
+ senderName: getParticipantName(room.localParticipant) || void 0,
200
+ clientToolkits,
201
+ toolChoice: toolChoice == null ? void 0 : new import_meshagent_agents.ToolChoice({ toolkitName: toolChoice.toolkitName, toolName: toolChoice.toolName })
197
202
  });
198
203
  ensureOperationActive(operationId, activeOperationRef);
199
204
  const threadPath = result.threadPath;
200
- const displayName = null;
201
205
  const normalizedPath = normalizeThreadPath(threadPath);
206
+ const displayName = normalizedPath === null ? null : (0, import_conversation_descriptor.defaultThreadDisplayNameFromPath)(normalizedPath);
202
207
  if (controlledThreadPath === void 0) {
203
208
  setInternalThreadPath(normalizedPath);
204
209
  }
@@ -225,6 +230,8 @@ function NewChatThread({
225
230
  creatingNewThread,
226
231
  newThreadAttachments,
227
232
  newThreadDraft,
233
+ clientToolkits,
234
+ toolChoice,
228
235
  onThreadPathChanged,
229
236
  onThreadResolved,
230
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;