@smartspace/chat-ui 1.13.1-dev.8b0255f → 1.13.1-dev.90dbac9

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/dist/index.d.ts CHANGED
@@ -34,8 +34,20 @@ type MessageListProps = {
34
34
  * sidebars, so it omits the prop and gets the natural 70% width.
35
35
  */
36
36
  expandedLayout?: boolean;
37
+ /**
38
+ * Set to `true` while the host is mid-redirect from a "no thread selected"
39
+ * route to the first thread of a workspace — the message list shows a
40
+ * loading skeleton instead of the empty-state during that brief window so
41
+ * users don't see a "No messages yet" flash.
42
+ *
43
+ * Standalone web fork passes this from `useMatch('/.../_layout/')` to
44
+ * detect the workspace-index route specifically. The sandbox/admin doesn't
45
+ * have multi-thread navigation, so it omits the prop entirely (defaults
46
+ * `false` — no router coupling).
47
+ */
48
+ isChoosingThread?: boolean;
37
49
  };
38
- declare function MessageList({ applyHostBackgroundOverride, expandedLayout, }?: MessageListProps): react_jsx_runtime.JSX.Element;
50
+ declare function MessageList({ applyHostBackgroundOverride, expandedLayout, isChoosingThread, }?: MessageListProps): react_jsx_runtime.JSX.Element;
39
51
 
40
52
  /**
41
53
  * Skeleton for the message list loading state.
@@ -226,6 +238,14 @@ type MessageThread = {
226
238
  totalMessages: number;
227
239
  pinned: boolean;
228
240
  workSpaceId: string;
241
+ /**
242
+ * Monotonic version of when this summary was emitted (epoch ms). Used by
243
+ * `applyThreadToCache` to reject stale writes — e.g. a SignalR summary
244
+ * landing after a fresher SSE thread frame because the server's DB write
245
+ * lagged Redis. Mappers derive this from `lastUpdatedAt`; client-side
246
+ * writers like `ensureDraftThread` use `Date.now()`.
247
+ */
248
+ summaryEmittedAt: number;
229
249
  };
230
250
  type ThreadsResponse = {
231
251
  data: MessageThread[];
@@ -239,28 +259,29 @@ type Variables = Record<string, {
239
259
  }>;
240
260
  type MentionUser = {
241
261
  id: string;
262
+ /** AppUser id (the principal id used by thread-membership endpoints). */
263
+ userId: string;
242
264
  displayName: string;
243
265
  initials: string;
244
266
  };
245
267
  type Workspace = {
246
268
  id: string;
247
269
  name: string;
248
- tags?: string[];
249
- showSources?: boolean;
250
- dataSpaces?: unknown[];
270
+ tags: string[];
271
+ showSources: boolean;
272
+ dataSpaces: unknown[];
251
273
  createdByUserId?: string;
252
274
  createdAt?: Date;
253
275
  modifiedByUserId?: string;
254
276
  modifiedAt?: Date;
255
277
  favorited: boolean;
256
- summary?: string;
257
- firstPrompt?: string;
278
+ summary: string;
279
+ firstPrompt: string;
258
280
  outputSchema?: unknown;
259
- isPromptAndResponseLoggingEnabled?: boolean;
260
281
  inputs?: unknown;
261
282
  variables: Variables;
262
283
  sandBoxThreadId?: string;
263
- supportsFiles?: boolean;
284
+ supportsFiles: boolean;
264
285
  avatarName: string;
265
286
  };
266
287
 
@@ -383,6 +404,7 @@ declare const messagesResponseSchema: z.ZodObject<{
383
404
  blockId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
405
  code: z.ZodNumber;
385
406
  data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
407
+ errorCode: z.ZodOptional<z.ZodNullable<z.ZodString>>;
386
408
  message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
387
409
  }, z.core.$strip>>;
388
410
  hasComments: z.ZodBoolean;
@@ -493,6 +515,11 @@ declare function mapThreadsResponseDtoToModel(dto: ThreadsResponseDto): ThreadsR
493
515
  declare function mapSignalRThreadSummaryToModel(summary: SignalR.MessageThreadSummary): MessageThread;
494
516
 
495
517
  declare const workspaceResponseSchema: z.ZodObject<{
518
+ connectors: z.ZodArray<z.ZodObject<{
519
+ id: z.ZodString;
520
+ kind: z.ZodString;
521
+ name: z.ZodString;
522
+ }, z.core.$strip>>;
496
523
  createdAt: z.ZodISODateTime;
497
524
  createdByUserId: z.ZodString;
498
525
  dataSpaces: z.ZodArray<z.ZodObject<{
@@ -539,6 +566,7 @@ declare const workspaceResponseSchema: z.ZodObject<{
539
566
  }, z.core.$strip>;
540
567
  }, z.core.$strip>>>>;
541
568
  constants: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
569
+ secret: z.ZodBoolean;
542
570
  value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
543
571
  }, z.core.$strip>>>>;
544
572
  inputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -563,6 +591,11 @@ declare const workspaceResponseSchema: z.ZodObject<{
563
591
  triggers: z.ZodArray<z.ZodObject<{
564
592
  dataSourceContainer: z.ZodObject<{
565
593
  dataSourceId: z.ZodString;
594
+ filters: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
595
+ operator: z.ZodString;
596
+ propertyName: z.ZodString;
597
+ value: z.ZodString;
598
+ }, z.core.$strip>>>>;
566
599
  id: z.ZodString;
567
600
  name: z.ZodString;
568
601
  path: z.ZodString;
@@ -603,7 +636,6 @@ declare const workspaceResponseSchema: z.ZodObject<{
603
636
  inputs: z.ZodRecord<z.ZodString, z.ZodObject<{
604
637
  schema: z.ZodRecord<z.ZodString, z.ZodAny>;
605
638
  }, z.core.$strip>>;
606
- isPromptAndResponseLoggingEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
607
639
  modelConfigurations: z.ZodArray<z.ZodObject<{
608
640
  frequencyPenalty: z.ZodNumber;
609
641
  model: z.ZodObject<{
@@ -724,6 +756,11 @@ declare const workspaceUsersResponseSchema: z.ZodArray<z.ZodObject<{
724
756
  }, z.core.$strip>>;
725
757
  declare const workspacesListResponseSchema: z.ZodObject<{
726
758
  data: z.ZodArray<z.ZodObject<{
759
+ connectors: z.ZodArray<z.ZodObject<{
760
+ id: z.ZodString;
761
+ kind: z.ZodString;
762
+ name: z.ZodString;
763
+ }, z.core.$strip>>;
727
764
  createdAt: z.ZodISODateTime;
728
765
  createdByUserId: z.ZodString;
729
766
  dataSpaces: z.ZodArray<z.ZodObject<{
@@ -770,6 +807,7 @@ declare const workspacesListResponseSchema: z.ZodObject<{
770
807
  }, z.core.$strip>;
771
808
  }, z.core.$strip>>>>;
772
809
  constants: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
810
+ secret: z.ZodBoolean;
773
811
  value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
774
812
  }, z.core.$strip>>>>;
775
813
  inputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -794,6 +832,11 @@ declare const workspacesListResponseSchema: z.ZodObject<{
794
832
  triggers: z.ZodArray<z.ZodObject<{
795
833
  dataSourceContainer: z.ZodObject<{
796
834
  dataSourceId: z.ZodString;
835
+ filters: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
836
+ operator: z.ZodString;
837
+ propertyName: z.ZodString;
838
+ value: z.ZodString;
839
+ }, z.core.$strip>>>>;
797
840
  id: z.ZodString;
798
841
  name: z.ZodString;
799
842
  path: z.ZodString;
@@ -834,7 +877,6 @@ declare const workspacesListResponseSchema: z.ZodObject<{
834
877
  inputs: z.ZodRecord<z.ZodString, z.ZodObject<{
835
878
  schema: z.ZodRecord<z.ZodString, z.ZodAny>;
836
879
  }, z.core.$strip>>;
837
- isPromptAndResponseLoggingEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
838
880
  modelConfigurations: z.ZodArray<z.ZodObject<{
839
881
  frequencyPenalty: z.ZodNumber;
840
882
  model: z.ZodObject<{
@@ -957,20 +999,6 @@ declare function mapMentionUserDtoToModel(dto: MentionUserDto): MentionUser;
957
999
  declare function mapWorkspaceDtoToModel(dto: WorkspaceDto): Workspace;
958
1000
  declare const mapWorkspacesDtoToModels: (arr: WorkspacesListItemDto[]) => Workspace[];
959
1001
 
960
- /**
961
- * Write a freshly-observed thread (from SignalR or an SSE thread frame)
962
- * directly into the relevant query caches so subscribers paint without a
963
- * refetch roundtrip.
964
- *
965
- * - Merges into `threadsKeys.detail(workspaceId, thread.id)`.
966
- * - Splices into every threads-list cache for the workspace, handling both
967
- * finite `ThreadsResponse` and infinite `{ pages, pageParams }` shapes.
968
- *
969
- * Returns `true` when the thread was found in at least one list cache.
970
- * Callers that need to surface brand-new threads (e.g. another user just
971
- * created one) can fall back to invalidating the list queries when this
972
- * returns `false`.
973
- */
974
1002
  declare function applyThreadToCache(qc: QueryClient, thread: MessageThread): boolean;
975
1003
  /**
976
1004
  * Invalidate every threads-list cache for a workspace. Use as a fallback when
@@ -997,6 +1025,46 @@ declare function setThreadOptimisticRunning(qc: QueryClient, threadId: string, r
997
1025
  */
998
1026
  declare function setThreadRunningInLists(qc: QueryClient, workspaceId: string, threadId: string, running: boolean): void;
999
1027
 
1028
+ /** Synthetic id for the "New Thread" row in the thread list; links to thread/new route. */
1029
+ declare const NEW_THREAD_ID = "__new__";
1030
+ /** Generate a GUID for a new thread (e.g. when sending first message from thread/new). */
1031
+ declare function createThreadId(): string;
1032
+ declare const DRAFT_THREAD_PREFIX = "draft-";
1033
+ declare function markDraftThreadId(threadId: string): void;
1034
+ declare function unmarkDraftThreadId(threadId: string): void;
1035
+ declare function isDraftThreadId(threadId?: string | null): boolean;
1036
+ declare function createDraftThreadId(): string;
1037
+
1038
+ /**
1039
+ * Safe wrapper around `crypto.randomUUID()` with a timestamp-based fallback
1040
+ * for environments that don't expose the Web Crypto API (e.g. non-secure
1041
+ * contexts, old Node test runners, JSDOM without the flag).
1042
+ *
1043
+ * The fallback is intentionally detectable: IDs start with the current
1044
+ * millisecond timestamp, making it trivially obvious in logs/tests when the
1045
+ * real API is unavailable. It is not cryptographically strong — use it only
1046
+ * for transient optimistic-UI identifiers that are discarded once the server
1047
+ * responds.
1048
+ */
1049
+ declare function randomUUID(): string;
1050
+
1051
+ /**
1052
+ * Treat an API date string as UTC even when it lacks a trailing "Z".
1053
+ * If already a Date, returns it as-is (Date stores UTC internally).
1054
+ */
1055
+ declare function utcDate(value: string | Date): Date;
1056
+ /**
1057
+ * Zod schema that coerces a Date, ISO string, or numeric timestamp
1058
+ * from the API into a Date object, ensuring timezone-less strings
1059
+ * are treated as UTC.
1060
+ */
1061
+ declare const DateFromApi: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodCoercedDate<unknown>>;
1062
+
1063
+ declare function parseDateTime(date: Date | string, customFormat?: string): string;
1064
+ declare function parseDateTimeHuman(date: Date | string): string;
1065
+
1066
+ declare function getUserPhotoUrl(userId: string | null | undefined): string | undefined;
1067
+
1000
1068
  declare const messagesKeys: {
1001
1069
  all: readonly ["messages"];
1002
1070
  lists: () => readonly ["messages", "list"];
@@ -1125,11 +1193,7 @@ declare const messagesListOptions: (service: ChatService, threadId: string, opts
1125
1193
  [dataTagErrorSymbol]: Error;
1126
1194
  };
1127
1195
  };
1128
- declare function useMessages(threadId: string, opts?: {
1129
- take?: number;
1130
- skip?: number;
1131
- skipWhenNewThread?: boolean;
1132
- }): _tanstack_react_query.UseQueryResult<Message[], Error>;
1196
+ declare function useMessages(threadId: string): _tanstack_react_query.UseQueryResult<Message[], Error>;
1133
1197
 
1134
1198
  declare const useFileMutations: (scope: FileScope) => {
1135
1199
  uploadFilesMutation: _tanstack_react_query.UseMutationResult<FileInfo$1[], Error, File[], unknown>;
@@ -1182,7 +1246,9 @@ type AddInputArgs = {
1182
1246
  channels: Record<string, number> | null;
1183
1247
  };
1184
1248
  declare function useAddInputToMessage(): {
1185
- addInputToMessageMutation: _tanstack_react_query.UseMutationResult<Message, Error, AddInputArgs, unknown>;
1249
+ addInputToMessageMutation: _tanstack_react_query.UseMutationResult<Message, Error, AddInputArgs, {
1250
+ previousMessages: Message[];
1251
+ }>;
1186
1252
  };
1187
1253
 
1188
1254
  declare const threadDetailOptions: ({ service, workspaceId, threadId, }: {
@@ -1283,4 +1349,4 @@ declare function useModels({ search, take, skip, }?: {
1283
1349
  total: number;
1284
1350
  }, Error>;
1285
1351
 
1286
- export { type ChatContextIds, type ChatIdentity, ChatProvider, type ChatProviderProps, type ChatService, ChatVariablesForm, type FileInfo$1 as FileInfo, type FileScope, type FlowRunVariables, MarkdownEditor, type MarkdownEditorHandle, type MentionUser, type Message, MessageComposer, type MessageComposerProps, type MessageContentItem, type MessageError, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, downloadFileBlobOptions, filesKeys, flowRunsKeys, getModelIcon, getThreadPlaceholderFromListCache, invalidateWorkspaceThreadLists, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, workspaceDetailOptions, workspaceKeys };
1352
+ export { type ChatContextIds, type ChatIdentity, ChatProvider, type ChatProviderProps, type ChatService, ChatVariablesForm, DRAFT_THREAD_PREFIX, DateFromApi, type FileInfo$1 as FileInfo, type FileScope, type FlowRunVariables, MarkdownEditor, type MarkdownEditorHandle, type MentionUser, type Message, MessageComposer, type MessageComposerProps, type MessageContentItem, type MessageError, MessageList, type MessageListProps, MessageListSkeleton, MessageMarkdown, type MessageThread, type MessageValue, MessageValueType, type Model, type ModelProperty, NEW_THREAD_ID, THREAD_LIST_PAGE_SIZE, type ThreadsResponse, type Variables, type Workspace, applyDeltaToMessage, applyThreadToCache, createDraftThreadId, createThreadId, downloadFileBlobOptions, filesKeys, flowRunsKeys, getModelIcon, getThreadPlaceholderFromListCache, getUserPhotoUrl, invalidateWorkspaceThreadLists, isDraftThreadId, mapFileInfoDtoToModel, mapMentionUserDtoToModel, mapMessageDtoToModel, mapMessageErrorDtoToModel, mapMessageValueDtoToModel, mapMessagesDtoToModels, mapSignalRThreadSummaryToModel, mapThreadDtoToModel, mapThreadsResponseDtoToModel, mapWorkspaceDtoToModel, mapWorkspacesDtoToModels, markDraftThreadId, messagesKeys, messagesListOptions, messagesMutationsKeys, modelsKeys, parseDateTime, parseDateTimeHuman, randomUUID, setThreadOptimisticRunning, setThreadRunningInLists, taggableUsersOptions, threadDetailOptions, threadsKeys, unmarkDraftThreadId, useAddInputToMessage, useChatContext, useChatIdentity, useChatService, useDownloadFileBlobQuery, useFileMutations, useFlowRunVariables, useMessages, useModels, useSendMessage, useTaggableWorkspaceUsers, useThread, useThreadIsRunning, useUpdateFlowRunVariable, useWorkspace, utcDate, workspaceDetailOptions, workspaceKeys };