@smartspace/chat-ui 1.13.1-pr.243.6b4d4ce

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.
@@ -0,0 +1,1286 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import React__default from 'react';
4
+ import * as _jsonforms_core from '@jsonforms/core';
5
+ import { z } from 'zod';
6
+ import { SignalR } from '@smartspace/api-client';
7
+ import * as _tanstack_react_query from '@tanstack/react-query';
8
+ import { QueryClient } from '@tanstack/react-query';
9
+
10
+ declare global {
11
+ interface Window {
12
+ __ssDownloadFile?: (id: string) => Promise<string>;
13
+ }
14
+ }
15
+ type MessageComposerProps = {
16
+ /** Mirrors `MessageList`'s `expandedLayout`. See its docs. */
17
+ expandedLayout?: boolean;
18
+ };
19
+ declare function MessageComposer({ expandedLayout, }?: MessageComposerProps): react_jsx_runtime.JSX.Element;
20
+
21
+ type MessageListProps = {
22
+ /**
23
+ * Apply a solid-base + tag-driven gradient to the message body. Set this
24
+ * when embedding inside a host whose default page background can show
25
+ * through and skew the perceived chat color (e.g. Microsoft Teams web
26
+ * client). Defaults to false — the standard browser app doesn't need it.
27
+ */
28
+ applyHostBackgroundOverride?: boolean;
29
+ /**
30
+ * Use the wider desktop max-width (90% instead of 70%). Set this when the
31
+ * chat is rendered in a layout where horizontal room is constrained by
32
+ * other panels (e.g. a sidebar is open beside it). Standalone fork passes
33
+ * `leftOpen || rightOpen` from `useSidebar()`; the sandbox doesn't have
34
+ * sidebars, so it omits the prop and gets the natural 70% width.
35
+ */
36
+ expandedLayout?: boolean;
37
+ };
38
+ declare function MessageList({ applyHostBackgroundOverride, expandedLayout, }?: MessageListProps): react_jsx_runtime.JSX.Element;
39
+
40
+ /**
41
+ * Skeleton for the message list loading state.
42
+ * Three message-shaped rows; use theme tokens only (no px, no Tailwind).
43
+ */
44
+ declare function MessageListSkeleton(): react_jsx_runtime.JSX.Element;
45
+
46
+ type AccessLevel = 'Read' | 'Write';
47
+ interface VariableConfig {
48
+ access: AccessLevel;
49
+ schema: _jsonforms_core.JsonSchema7;
50
+ }
51
+ interface WorkspaceLike {
52
+ variables?: Record<string, VariableConfig>;
53
+ }
54
+ interface ChatVariablesFormProps {
55
+ workspace: WorkspaceLike;
56
+ threadId: string;
57
+ }
58
+ interface ChatVariablesFormRef {
59
+ hasChanges: () => boolean;
60
+ getChangedVariables: () => Record<string, unknown>;
61
+ getCurrentVariables: () => Record<string, unknown>;
62
+ saveChangedVariables: () => Promise<void>;
63
+ }
64
+
65
+ declare const ChatVariablesForm: React.ForwardRefExoticComponent<ChatVariablesFormProps & {
66
+ setVariables: (variables: Record<string, unknown>) => void;
67
+ } & React.RefAttributes<ChatVariablesFormRef>>;
68
+
69
+ type MentionUserLike = {
70
+ id: string;
71
+ displayName: string;
72
+ };
73
+ type FetchMentionUsers = (workspaceId: string) => Promise<MentionUserLike[]>;
74
+ type MarkdownEditorHandle = {
75
+ addFiles: (files: File[]) => void;
76
+ focus: () => void;
77
+ /** Clears the editor content (useful when host clears `value`, since Milkdown isn't fully controlled here). */
78
+ clear: () => void;
79
+ /**
80
+ * Serializes the current editor doc to markdown synchronously.
81
+ * Needed because the `markdownUpdated` listener is debounced by 200ms inside
82
+ * `@milkdown/plugin-listener`, so React state can lag behind what's in the editor.
83
+ * Callers that need the freshest text (e.g. sending on Enter) should read from here.
84
+ */
85
+ getMarkdown: () => string;
86
+ /**
87
+ * Returns mention users currently present in the editor document.
88
+ * Useful for building API payloads (e.g. comments.mentionedUsers).
89
+ */
90
+ getMentionedUsers?: () => Array<{
91
+ id: string;
92
+ displayName: string;
93
+ }>;
94
+ /**
95
+ * Returns plain text for the current editor content, with mention nodes rendered as "@Display Name".
96
+ * Useful when the host renders content as plain text (not markdown).
97
+ */
98
+ getPlainText?: () => string;
99
+ };
100
+ type MarkdownEditorProps = {
101
+ value?: string;
102
+ onChange?: (md: string) => void;
103
+ onKeyDown?: (e: React__default.KeyboardEvent) => void;
104
+ onImagesPasted?: (files: File[]) => void;
105
+ onFilesAdded?: (files: File[]) => void;
106
+ onUploadFiles?: (files: File[]) => Promise<{
107
+ id: string;
108
+ name: string;
109
+ }[]>;
110
+ /**
111
+ * Controls what happens when the user drops files onto the editor surface.
112
+ * - 'inline' (default): upload + insert `ssImage`/`fileTag` nodes into the editor when possible.
113
+ * - 'attachments': do NOT insert into the editor; instead call `onFilesAdded` so the host can manage attachments UI.
114
+ */
115
+ fileHandlingMode?: 'inline' | 'attachments';
116
+ disabled?: boolean;
117
+ editable?: boolean;
118
+ className?: string;
119
+ minHeight?: number | string;
120
+ maxHeight?: number | string;
121
+ ghostMessage?: string;
122
+ placeholder?: string;
123
+ workspaceId?: string;
124
+ threadId?: string;
125
+ enableMentions?: boolean;
126
+ /**
127
+ * Optional mention users fetcher. Kept as a prop so this shared component does not
128
+ * depend on any domain/service modules.
129
+ */
130
+ fetchMentionUsers?: FetchMentionUsers;
131
+ };
132
+ declare const MarkdownEditor: React__default.ForwardRefExoticComponent<MarkdownEditorProps & React__default.RefAttributes<MarkdownEditorHandle>>;
133
+
134
+ type MessageMarkdownProps = {
135
+ value: string;
136
+ className?: string;
137
+ };
138
+ /** Read-only markdown renderer for chat messages. Uses react-markdown +
139
+ * rehype-raw so mixed markdown/HTML rebalances via parse5, which fixes
140
+ * cases like `<details>` wrapping a fenced code block. Shares the
141
+ * `ss-code-block` CSS scope with the Milkdown editor via the
142
+ * `ss-markdown` wrapper class (see `styles.css`). */
143
+ declare function MessageMarkdown({ value, className }: MessageMarkdownProps): react_jsx_runtime.JSX.Element;
144
+
145
+ type FileInfo$1 = {
146
+ id: string;
147
+ name: string;
148
+ };
149
+ type FileScope = {
150
+ workspaceId?: string;
151
+ threadId?: string;
152
+ };
153
+
154
+ type FlowRunVariables = Record<string, unknown>;
155
+
156
+ declare enum MessageValueType {
157
+ OUTPUT = "Output",
158
+ INPUT = "Input"
159
+ }
160
+
161
+ type FileInfo = {
162
+ id: string;
163
+ name: string;
164
+ };
165
+ type MessageContentItem = {
166
+ text?: string | null;
167
+ image?: FileInfo | null;
168
+ };
169
+ type MessageValue = {
170
+ id: string;
171
+ name: string;
172
+ type: MessageValueType;
173
+ value: unknown;
174
+ channels: Record<string, number>;
175
+ createdAt: Date;
176
+ createdBy: string;
177
+ createdByUserId?: string | null;
178
+ };
179
+ type Message = {
180
+ id?: string | null;
181
+ createdAt: Date;
182
+ createdBy?: string | null;
183
+ hasComments?: boolean;
184
+ createdByUserId?: string | null;
185
+ messageThreadId?: string | null;
186
+ errors?: {
187
+ code: number;
188
+ message?: string | null;
189
+ data?: string | null;
190
+ blockId?: string | null;
191
+ }[] | null;
192
+ values?: MessageValue[] | null;
193
+ optimistic?: boolean;
194
+ };
195
+
196
+ type ModelProperty = {
197
+ name: string;
198
+ type: string;
199
+ defaultValue: number;
200
+ minValue: number;
201
+ maxValue: number;
202
+ step: number;
203
+ };
204
+ type Model = {
205
+ id: string;
206
+ name: string;
207
+ displayName: string;
208
+ deploymentStatus: string;
209
+ modelDeploymentProviderType: string;
210
+ modelPublisher: string | null;
211
+ createdByUserId: string;
212
+ createdAt: Date;
213
+ properties: ModelProperty[];
214
+ virtualMachineUrl: string | null;
215
+ };
216
+
217
+ type MessageThread = {
218
+ id: string;
219
+ createdAt: Date;
220
+ createdBy: string;
221
+ createdByUserId: string;
222
+ isFlowRunning: boolean;
223
+ lastUpdatedAt: Date;
224
+ lastUpdatedByUserId: string;
225
+ name: string;
226
+ totalMessages: number;
227
+ pinned: boolean;
228
+ workSpaceId: string;
229
+ };
230
+ type ThreadsResponse = {
231
+ data: MessageThread[];
232
+ total: number;
233
+ };
234
+
235
+ type VariableAccess = 'Read' | 'Write';
236
+ type Variables = Record<string, {
237
+ schema: Record<string, unknown>;
238
+ access: VariableAccess;
239
+ }>;
240
+ type MentionUser = {
241
+ id: string;
242
+ displayName: string;
243
+ initials: string;
244
+ };
245
+ type Workspace = {
246
+ id: string;
247
+ name: string;
248
+ tags?: string[];
249
+ showSources?: boolean;
250
+ dataSpaces?: unknown[];
251
+ createdByUserId?: string;
252
+ createdAt?: Date;
253
+ modifiedByUserId?: string;
254
+ modifiedAt?: Date;
255
+ favorited: boolean;
256
+ summary?: string;
257
+ firstPrompt?: string;
258
+ outputSchema?: unknown;
259
+ isPromptAndResponseLoggingEnabled?: boolean;
260
+ inputs?: unknown;
261
+ variables: Variables;
262
+ sandBoxThreadId?: string;
263
+ supportsFiles?: boolean;
264
+ avatarName: string;
265
+ };
266
+
267
+ /**
268
+ * Port / adapter interface for everything the chat UI needs from a backend.
269
+ *
270
+ * The production app provides `createDefaultChatService()` which delegates to
271
+ * the `ChatApi`-backed implementations in `src/domains/*\/service.ts`. A
272
+ * separate consumer repo (the sandbox debug harness) will provide its own
273
+ * implementation backed by `ConfigApi.sandBox*` endpoints.
274
+ *
275
+ * This interface MUST remain the single contract between the chat UI and its
276
+ * backend — no component in `src/ui/messages/` or hook in `src/domains/messages/`
277
+ * should reach outside of this boundary.
278
+ */
279
+ interface ChatService {
280
+ /** Fetch messages for a thread (paginated via take/skip). */
281
+ fetchMessages(threadId: string, opts?: {
282
+ take?: number;
283
+ skip?: number;
284
+ }): Promise<Message[]>;
285
+ /**
286
+ * Post a new user message. Returns the server-authoritative initial Message
287
+ * (id, inputs populated). Output deltas arrive via the thread SSE keyed by
288
+ * the returned id — callers should reconcile their optimistic temp-id entry
289
+ * with this response.
290
+ */
291
+ sendMessage(args: {
292
+ workspaceId: string;
293
+ threadId: string;
294
+ contentList?: MessageContentItem[];
295
+ files?: FileInfo$1[];
296
+ variables?: Record<string, unknown>;
297
+ }): Promise<Message>;
298
+ /**
299
+ * Submit a structured input (e.g. form values) to an existing message. The
300
+ * server streams `IAsyncEnumerable<Message>`; the last successfully parsed
301
+ * frame is returned.
302
+ */
303
+ addInputToMessage(args: {
304
+ messageId: string;
305
+ name: string;
306
+ value: unknown;
307
+ channels: Record<string, number> | null;
308
+ }): Promise<Message>;
309
+ uploadFiles(files: File[], scope: FileScope, onFileUploaded?: (file: File, fileInfo: FileInfo$1) => void, onChunkUploaded?: (chunkIndex: number, totalChunks: number, file: File) => void): Promise<FileInfo$1[]>;
310
+ downloadFile(id: string, scope?: FileScope): Promise<Blob>;
311
+ getFileInfo(id: string, scope: FileScope): Promise<FileInfo$1>;
312
+ getFileDownloadUrl(sourceUri: string): Promise<string>;
313
+ fetchThread(workspaceId: string, threadId: string): Promise<MessageThread>;
314
+ fetchWorkspace(workspaceId: string): Promise<Workspace>;
315
+ fetchTaggableUsers(workspaceId: string): Promise<MentionUser[]>;
316
+ /**
317
+ * Read the current flow-run variable set for a thread. Used by the chat
318
+ * variables form to seed initial values.
319
+ */
320
+ fetchFlowRunVariables(flowRunId: string): Promise<FlowRunVariables>;
321
+ /**
322
+ * Patch a single flow-run variable. The chat variables form calls this on
323
+ * each change to keep the running flow's variable state in sync.
324
+ */
325
+ updateFlowRunVariable(args: {
326
+ flowRunId: string;
327
+ name: string;
328
+ value: unknown;
329
+ }): Promise<void>;
330
+ /**
331
+ * List models the user has access to. Drives the model-id renderer in the
332
+ * variables form (a dropdown of selectable models).
333
+ */
334
+ fetchModels(opts?: {
335
+ search?: string;
336
+ take?: number;
337
+ skip?: number;
338
+ }): Promise<{
339
+ data: Model[];
340
+ total: number;
341
+ }>;
342
+ }
343
+
344
+ type ChatIdentity = {
345
+ userId: string;
346
+ displayName: string;
347
+ };
348
+ type ChatContextIds = {
349
+ workspaceId: string;
350
+ /** Empty string when no thread is currently selected (e.g. draft state). */
351
+ threadId: string;
352
+ };
353
+ type ChatProviderProps = {
354
+ service: ChatService;
355
+ workspaceId: string;
356
+ threadId: string;
357
+ identity: ChatIdentity;
358
+ children: React__default.ReactNode;
359
+ };
360
+ /**
361
+ * Single point of injection for the chat UI subtree. Provides:
362
+ * - a `ChatService` implementation (backend port)
363
+ * - the current `{ workspaceId, threadId }` context
364
+ * - user identity used for optimistic message stamping
365
+ *
366
+ * All message UI components and message/file/thread/workspace hooks read
367
+ * from this provider instead of reaching into platform auth or TanStack
368
+ * Router directly — that is what makes the chat UI portable to a package.
369
+ */
370
+ declare function ChatProvider({ service, workspaceId, threadId, identity, children, }: ChatProviderProps): react_jsx_runtime.JSX.Element;
371
+ declare function useChatService(): ChatService;
372
+ declare function useChatContext(): ChatContextIds;
373
+ declare function useChatIdentity(): ChatIdentity;
374
+
375
+ declare function getModelIcon(model: Model | null | undefined): string | null;
376
+
377
+ declare const messagesResponseSchema: z.ZodObject<{
378
+ data: z.ZodArray<z.ZodObject<{
379
+ createdAt: z.ZodISODateTime;
380
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
381
+ createdByUserId: z.ZodString;
382
+ errors: z.ZodArray<z.ZodObject<{
383
+ blockId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
+ code: z.ZodNumber;
385
+ data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
386
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
387
+ }, z.core.$strip>>;
388
+ hasComments: z.ZodBoolean;
389
+ id: z.ZodString;
390
+ messageThreadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
391
+ values: z.ZodArray<z.ZodObject<{
392
+ channels: z.ZodRecord<z.ZodString, z.ZodNumber>;
393
+ createdAt: z.ZodISODateTime;
394
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
395
+ createdByUserId: z.ZodString;
396
+ id: z.ZodString;
397
+ name: z.ZodString;
398
+ type: z.ZodEnum<{
399
+ Input: "Input";
400
+ Output: "Output";
401
+ }>;
402
+ value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
403
+ }, z.core.$strip>>;
404
+ }, z.core.$strip>>;
405
+ total: z.ZodNumber;
406
+ }, z.core.$strip>;
407
+ type MessagesResponseDto = z.infer<typeof messagesResponseSchema>;
408
+ type MessageDto = MessagesResponseDto['data'][number];
409
+ type MessageValueDto = NonNullable<MessageDto['values']>[number];
410
+ type MessageErrorDto = NonNullable<MessageDto['errors']>[number];
411
+ type MessageError = NonNullable<Message['errors']>[number];
412
+ declare function mapMessageValueDtoToModel(dto: MessageValueDto): MessageValue;
413
+ declare function mapMessageErrorDtoToModel(dto: MessageErrorDto): MessageError;
414
+ declare function mapMessageDtoToModel(dto: MessageDto): Message;
415
+ declare function mapMessagesDtoToModels(dto: MessageDto[]): Message[];
416
+ /**
417
+ * Merge a streaming delta into a message. `outputs` is a cumulative snapshot
418
+ * keyed by `(name, type)` per the SSE protocol — when an output streams from
419
+ * "He" → "Hel" → "Hello" we receive three deltas each carrying the full
420
+ * text-so-far, so we replace by key rather than appending. Errors aren't
421
+ * documented as cumulative, so we append them.
422
+ */
423
+ declare function applyDeltaToMessage(target: Message, delta: {
424
+ outputs: MessageValue[];
425
+ errors: MessageError[];
426
+ }): Message;
427
+
428
+ declare const fileInfoResponseSchema: z.ZodObject<{
429
+ createdAt: z.ZodISODateTime;
430
+ createdByUserId: z.ZodString;
431
+ id: z.ZodString;
432
+ modifiedAt: z.ZodISODateTime;
433
+ modifiedByUserId: z.ZodString;
434
+ name: z.ZodString;
435
+ size: z.ZodNumber;
436
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
437
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
438
+ }, z.core.$strip>;
439
+ declare const fileInfoItemSchema: z.ZodObject<{
440
+ createdAt: z.ZodISODateTime;
441
+ createdByUserId: z.ZodString;
442
+ id: z.ZodString;
443
+ modifiedAt: z.ZodISODateTime;
444
+ modifiedByUserId: z.ZodString;
445
+ name: z.ZodString;
446
+ size: z.ZodNumber;
447
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
448
+ workspaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
449
+ }, z.core.$strip>;
450
+ type FileInfoDto = z.infer<typeof fileInfoResponseSchema>;
451
+ type FileInfoItemDto = z.infer<typeof fileInfoItemSchema>;
452
+ declare function mapFileInfoDtoToModel(dto: FileInfoDto | FileInfoItemDto): FileInfo$1;
453
+
454
+ declare const threadsListResponseSchema: z.ZodObject<{
455
+ data: z.ZodArray<z.ZodObject<{
456
+ createdAt: z.ZodISODateTime;
457
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
458
+ createdByUserId: z.ZodString;
459
+ favorited: z.ZodBoolean;
460
+ id: z.ZodString;
461
+ isFlowRunning: z.ZodBoolean;
462
+ lastUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
463
+ lastUpdatedAt: z.ZodISODateTime;
464
+ lastUpdatedByUserId: z.ZodString;
465
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
466
+ totalMessages: z.ZodNumber;
467
+ workSpaceId: z.ZodString;
468
+ }, z.core.$strip>>;
469
+ total: z.ZodNumber;
470
+ }, z.core.$strip>;
471
+ declare const threadResponseSchema: z.ZodObject<{
472
+ createdAt: z.ZodISODateTime;
473
+ createdBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
474
+ createdByUserId: z.ZodString;
475
+ favorited: z.ZodBoolean;
476
+ id: z.ZodString;
477
+ isFlowRunning: z.ZodBoolean;
478
+ lastUpdated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
479
+ lastUpdatedAt: z.ZodISODateTime;
480
+ lastUpdatedByUserId: z.ZodString;
481
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
482
+ totalMessages: z.ZodNumber;
483
+ workSpaceId: z.ZodString;
484
+ }, z.core.$strip>;
485
+ type ThreadsResponseDto = z.infer<typeof threadsListResponseSchema>;
486
+ type ThreadDto = z.infer<typeof threadResponseSchema>;
487
+ declare function mapThreadDtoToModel(dto: ThreadDto): MessageThread;
488
+ declare function mapThreadsResponseDtoToModel(dto: ThreadsResponseDto): ThreadsResponse;
489
+ /**
490
+ * Map the SignalR `receiveThreadUpdate` payload to our thread model so we
491
+ * can write it straight into the query cache without invalidating + refetching.
492
+ */
493
+ declare function mapSignalRThreadSummaryToModel(summary: SignalR.MessageThreadSummary): MessageThread;
494
+
495
+ declare const workspaceResponseSchema: z.ZodObject<{
496
+ createdAt: z.ZodISODateTime;
497
+ createdByUserId: z.ZodString;
498
+ dataSpaces: z.ZodArray<z.ZodObject<{
499
+ createdAt: z.ZodISODateTime;
500
+ createdByUserId: z.ZodString;
501
+ dataSets: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
502
+ createdAt: z.ZodISODateTime;
503
+ createdByUserId: z.ZodString;
504
+ dataSpaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
505
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
506
+ flow: z.ZodOptional<z.ZodObject<{
507
+ activeFlowDefinition: z.ZodOptional<z.ZodObject<{
508
+ blocks: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
509
+ constants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
510
+ target: z.ZodObject<{
511
+ pin: z.ZodString;
512
+ port: z.ZodString;
513
+ }, z.core.$strip>;
514
+ value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
515
+ }, z.core.$strip>>>>;
516
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
517
+ dynamicInputPins: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
518
+ pin: z.ZodString;
519
+ port: z.ZodString;
520
+ }, z.core.$strip>>>>;
521
+ dynamicOutputPins: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
522
+ pin: z.ZodString;
523
+ port: z.ZodString;
524
+ }, z.core.$strip>>>>;
525
+ dynamicPorts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
526
+ name: z.ZodString;
527
+ version: z.ZodString;
528
+ }, z.core.$strip>>>>;
529
+ connections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
530
+ source: z.ZodObject<{
531
+ node: z.ZodString;
532
+ pin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
533
+ port: z.ZodOptional<z.ZodNullable<z.ZodString>>;
534
+ }, z.core.$strip>;
535
+ target: z.ZodObject<{
536
+ node: z.ZodString;
537
+ pin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
538
+ port: z.ZodOptional<z.ZodNullable<z.ZodString>>;
539
+ }, z.core.$strip>;
540
+ }, z.core.$strip>>>>;
541
+ constants: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
542
+ value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
543
+ }, z.core.$strip>>>>;
544
+ inputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
545
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
546
+ }, z.core.$strip>>>>;
547
+ layout: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
548
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
549
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
550
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
551
+ }, z.core.$strip>>>>;
552
+ variables: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
553
+ access: z.ZodEnum<{
554
+ None: "None";
555
+ Read: "Read";
556
+ Write: "Write";
557
+ }>;
558
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
559
+ }, z.core.$strip>>>>;
560
+ }, z.core.$strip>>;
561
+ activeFlowDefinitionId: z.ZodString;
562
+ id: z.ZodString;
563
+ triggers: z.ZodArray<z.ZodObject<{
564
+ dataSourceContainer: z.ZodObject<{
565
+ dataSourceId: z.ZodString;
566
+ id: z.ZodString;
567
+ name: z.ZodString;
568
+ path: z.ZodString;
569
+ }, z.core.$strip>;
570
+ flowId: z.ZodString;
571
+ id: z.ZodString;
572
+ inputName: z.ZodString;
573
+ type: z.ZodEnum<{
574
+ Periodic: "Periodic";
575
+ Container: "Container";
576
+ }>;
577
+ }, z.core.$strip>>;
578
+ }, z.core.$strip>>;
579
+ id: z.ZodString;
580
+ modifiedAt: z.ZodISODateTime;
581
+ modifiedByUserId: z.ZodString;
582
+ name: z.ZodString;
583
+ properties: z.ZodArray<z.ZodObject<{
584
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
585
+ isVector: z.ZodBoolean;
586
+ name: z.ZodString;
587
+ }, z.core.$strip>>;
588
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
589
+ }, z.core.$strip>>>>;
590
+ id: z.ZodString;
591
+ modifiedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
592
+ modifiedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
593
+ name: z.ZodString;
594
+ parentWorkspaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
595
+ workspacesInfo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
596
+ id: z.ZodString;
597
+ name: z.ZodString;
598
+ }, z.core.$strip>>>>;
599
+ }, z.core.$strip>>;
600
+ favorited: z.ZodBoolean;
601
+ firstPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
602
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
603
+ inputs: z.ZodRecord<z.ZodString, z.ZodObject<{
604
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
605
+ }, z.core.$strip>>;
606
+ isPromptAndResponseLoggingEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
607
+ modelConfigurations: z.ZodArray<z.ZodObject<{
608
+ frequencyPenalty: z.ZodNumber;
609
+ model: z.ZodObject<{
610
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
611
+ createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
612
+ deployment: z.ZodOptional<z.ZodObject<{
613
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
614
+ createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
+ detailedMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
+ dockerFile: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
+ id: z.ZodString;
618
+ modelName: z.ZodString;
619
+ providerDeploymentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
620
+ providerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
621
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
622
+ status: z.ZodEnum<{
623
+ Deploying: "Deploying";
624
+ Ready: "Ready";
625
+ Failed: "Failed";
626
+ Deleting: "Deleting";
627
+ Deleted: "Deleted";
628
+ }>;
629
+ statusMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
630
+ statusUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
631
+ steps: z.ZodArray<z.ZodObject<{
632
+ finishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
633
+ id: z.ZodString;
634
+ index: z.ZodNumber;
635
+ message: z.ZodString;
636
+ name: z.ZodEnum<{
637
+ DeployVNet: "DeployVNet";
638
+ DeployVM: "DeployVM";
639
+ InstallDependencies: "InstallDependencies";
640
+ DownloadModel: "DownloadModel";
641
+ TestModel: "TestModel";
642
+ }>;
643
+ progress: z.ZodNumber;
644
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
645
+ }, z.core.$strip>>;
646
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
647
+ virtualMachineServerType: z.ZodOptional<z.ZodEnum<{
648
+ TextGenerationInference: "TextGenerationInference";
649
+ VLlm: "VLlm";
650
+ }>>;
651
+ virtualMachineUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
652
+ vmSize: z.ZodOptional<z.ZodNullable<z.ZodString>>;
653
+ }, z.core.$strip>>;
654
+ displayName: z.ZodString;
655
+ id: z.ZodString;
656
+ modelDeploymentProviderType: z.ZodOptional<z.ZodEnum<{
657
+ OpenAi: "OpenAi";
658
+ AzureOpenAi: "AzureOpenAi";
659
+ HuggingFace: "HuggingFace";
660
+ Cohere: "Cohere";
661
+ Anthropic: "Anthropic";
662
+ Gemini: "Gemini";
663
+ VertexAi: "VertexAi";
664
+ AzureFoundry: "AzureFoundry";
665
+ }>>;
666
+ modelPublisher: z.ZodOptional<z.ZodEnum<{
667
+ OpenAi: "OpenAi";
668
+ HuggingFace: "HuggingFace";
669
+ Cohere: "Cohere";
670
+ Anthropic: "Anthropic";
671
+ Google: "Google";
672
+ Meta: "Meta";
673
+ Mistral: "Mistral";
674
+ Microsoft: "Microsoft";
675
+ DeepSeek: "DeepSeek";
676
+ XAi: "XAi";
677
+ Amazon: "Amazon";
678
+ Qwen: "Qwen";
679
+ Other: "Other";
680
+ }>>;
681
+ name: z.ZodString;
682
+ properties: z.ZodArray<z.ZodObject<{
683
+ name: z.ZodString;
684
+ type: z.ZodEnum<{
685
+ Boolean: "Boolean";
686
+ Number: "Number";
687
+ String: "String";
688
+ }>;
689
+ }, z.core.$strip>>;
690
+ }, z.core.$strip>;
691
+ prePrompt: z.ZodString;
692
+ presencePenalty: z.ZodNumber;
693
+ role: z.ZodEnum<{
694
+ Document: "Document";
695
+ Agent: "Agent";
696
+ Analyzer: "Analyzer";
697
+ }>;
698
+ temperature: z.ZodNumber;
699
+ topP: z.ZodNumber;
700
+ }, z.core.$strip>>;
701
+ modifiedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
702
+ modifiedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
703
+ name: z.ZodString;
704
+ outputSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
705
+ sandBoxThreadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
706
+ showSources: z.ZodBoolean;
707
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
708
+ supportsFiles: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
709
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
710
+ variables: z.ZodRecord<z.ZodString, z.ZodObject<{
711
+ access: z.ZodEnum<{
712
+ None: "None";
713
+ Read: "Read";
714
+ Write: "Write";
715
+ }>;
716
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
717
+ }, z.core.$strip>>;
718
+ }, z.core.$strip>;
719
+ declare const workspaceUsersResponseSchema: z.ZodArray<z.ZodObject<{
720
+ displayName: z.ZodString;
721
+ emailAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
722
+ id: z.ZodString;
723
+ userId: z.ZodString;
724
+ }, z.core.$strip>>;
725
+ declare const workspacesListResponseSchema: z.ZodObject<{
726
+ data: z.ZodArray<z.ZodObject<{
727
+ createdAt: z.ZodISODateTime;
728
+ createdByUserId: z.ZodString;
729
+ dataSpaces: z.ZodArray<z.ZodObject<{
730
+ createdAt: z.ZodISODateTime;
731
+ createdByUserId: z.ZodString;
732
+ dataSets: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
733
+ createdAt: z.ZodISODateTime;
734
+ createdByUserId: z.ZodString;
735
+ dataSpaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
736
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
737
+ flow: z.ZodOptional<z.ZodObject<{
738
+ activeFlowDefinition: z.ZodOptional<z.ZodObject<{
739
+ blocks: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
740
+ constants: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
741
+ target: z.ZodObject<{
742
+ pin: z.ZodString;
743
+ port: z.ZodString;
744
+ }, z.core.$strip>;
745
+ value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
746
+ }, z.core.$strip>>>>;
747
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
748
+ dynamicInputPins: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
749
+ pin: z.ZodString;
750
+ port: z.ZodString;
751
+ }, z.core.$strip>>>>;
752
+ dynamicOutputPins: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
753
+ pin: z.ZodString;
754
+ port: z.ZodString;
755
+ }, z.core.$strip>>>>;
756
+ dynamicPorts: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
757
+ name: z.ZodString;
758
+ version: z.ZodString;
759
+ }, z.core.$strip>>>>;
760
+ connections: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
761
+ source: z.ZodObject<{
762
+ node: z.ZodString;
763
+ pin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
764
+ port: z.ZodOptional<z.ZodNullable<z.ZodString>>;
765
+ }, z.core.$strip>;
766
+ target: z.ZodObject<{
767
+ node: z.ZodString;
768
+ pin: z.ZodOptional<z.ZodNullable<z.ZodString>>;
769
+ port: z.ZodOptional<z.ZodNullable<z.ZodString>>;
770
+ }, z.core.$strip>;
771
+ }, z.core.$strip>>>>;
772
+ constants: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
773
+ value: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
774
+ }, z.core.$strip>>>>;
775
+ inputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
776
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
777
+ }, z.core.$strip>>>>;
778
+ layout: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
779
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
780
+ outputs: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
781
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
782
+ }, z.core.$strip>>>>;
783
+ variables: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodObject<{
784
+ access: z.ZodEnum<{
785
+ None: "None";
786
+ Read: "Read";
787
+ Write: "Write";
788
+ }>;
789
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
790
+ }, z.core.$strip>>>>;
791
+ }, z.core.$strip>>;
792
+ activeFlowDefinitionId: z.ZodString;
793
+ id: z.ZodString;
794
+ triggers: z.ZodArray<z.ZodObject<{
795
+ dataSourceContainer: z.ZodObject<{
796
+ dataSourceId: z.ZodString;
797
+ id: z.ZodString;
798
+ name: z.ZodString;
799
+ path: z.ZodString;
800
+ }, z.core.$strip>;
801
+ flowId: z.ZodString;
802
+ id: z.ZodString;
803
+ inputName: z.ZodString;
804
+ type: z.ZodEnum<{
805
+ Periodic: "Periodic";
806
+ Container: "Container";
807
+ }>;
808
+ }, z.core.$strip>>;
809
+ }, z.core.$strip>>;
810
+ id: z.ZodString;
811
+ modifiedAt: z.ZodISODateTime;
812
+ modifiedByUserId: z.ZodString;
813
+ name: z.ZodString;
814
+ properties: z.ZodArray<z.ZodObject<{
815
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
816
+ isVector: z.ZodBoolean;
817
+ name: z.ZodString;
818
+ }, z.core.$strip>>;
819
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
820
+ }, z.core.$strip>>>>;
821
+ id: z.ZodString;
822
+ modifiedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
823
+ modifiedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
824
+ name: z.ZodString;
825
+ parentWorkspaceId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
826
+ workspacesInfo: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
827
+ id: z.ZodString;
828
+ name: z.ZodString;
829
+ }, z.core.$strip>>>>;
830
+ }, z.core.$strip>>;
831
+ favorited: z.ZodBoolean;
832
+ firstPrompt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
833
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
834
+ inputs: z.ZodRecord<z.ZodString, z.ZodObject<{
835
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
836
+ }, z.core.$strip>>;
837
+ isPromptAndResponseLoggingEnabled: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
838
+ modelConfigurations: z.ZodArray<z.ZodObject<{
839
+ frequencyPenalty: z.ZodNumber;
840
+ model: z.ZodObject<{
841
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
842
+ createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
+ deployment: z.ZodOptional<z.ZodObject<{
844
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
845
+ createdByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
846
+ detailedMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
+ dockerFile: z.ZodOptional<z.ZodNullable<z.ZodString>>;
848
+ id: z.ZodString;
849
+ modelName: z.ZodString;
850
+ providerDeploymentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
851
+ providerId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
852
+ region: z.ZodOptional<z.ZodNullable<z.ZodString>>;
853
+ status: z.ZodEnum<{
854
+ Deploying: "Deploying";
855
+ Ready: "Ready";
856
+ Failed: "Failed";
857
+ Deleting: "Deleting";
858
+ Deleted: "Deleted";
859
+ }>;
860
+ statusMessage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
861
+ statusUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
862
+ steps: z.ZodArray<z.ZodObject<{
863
+ finishedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
864
+ id: z.ZodString;
865
+ index: z.ZodNumber;
866
+ message: z.ZodString;
867
+ name: z.ZodEnum<{
868
+ DeployVNet: "DeployVNet";
869
+ DeployVM: "DeployVM";
870
+ InstallDependencies: "InstallDependencies";
871
+ DownloadModel: "DownloadModel";
872
+ TestModel: "TestModel";
873
+ }>;
874
+ progress: z.ZodNumber;
875
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
876
+ }, z.core.$strip>>;
877
+ url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
878
+ virtualMachineServerType: z.ZodOptional<z.ZodEnum<{
879
+ TextGenerationInference: "TextGenerationInference";
880
+ VLlm: "VLlm";
881
+ }>>;
882
+ virtualMachineUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
+ vmSize: z.ZodOptional<z.ZodNullable<z.ZodString>>;
884
+ }, z.core.$strip>>;
885
+ displayName: z.ZodString;
886
+ id: z.ZodString;
887
+ modelDeploymentProviderType: z.ZodOptional<z.ZodEnum<{
888
+ OpenAi: "OpenAi";
889
+ AzureOpenAi: "AzureOpenAi";
890
+ HuggingFace: "HuggingFace";
891
+ Cohere: "Cohere";
892
+ Anthropic: "Anthropic";
893
+ Gemini: "Gemini";
894
+ VertexAi: "VertexAi";
895
+ AzureFoundry: "AzureFoundry";
896
+ }>>;
897
+ modelPublisher: z.ZodOptional<z.ZodEnum<{
898
+ OpenAi: "OpenAi";
899
+ HuggingFace: "HuggingFace";
900
+ Cohere: "Cohere";
901
+ Anthropic: "Anthropic";
902
+ Google: "Google";
903
+ Meta: "Meta";
904
+ Mistral: "Mistral";
905
+ Microsoft: "Microsoft";
906
+ DeepSeek: "DeepSeek";
907
+ XAi: "XAi";
908
+ Amazon: "Amazon";
909
+ Qwen: "Qwen";
910
+ Other: "Other";
911
+ }>>;
912
+ name: z.ZodString;
913
+ properties: z.ZodArray<z.ZodObject<{
914
+ name: z.ZodString;
915
+ type: z.ZodEnum<{
916
+ Boolean: "Boolean";
917
+ Number: "Number";
918
+ String: "String";
919
+ }>;
920
+ }, z.core.$strip>>;
921
+ }, z.core.$strip>;
922
+ prePrompt: z.ZodString;
923
+ presencePenalty: z.ZodNumber;
924
+ role: z.ZodEnum<{
925
+ Document: "Document";
926
+ Agent: "Agent";
927
+ Analyzer: "Analyzer";
928
+ }>;
929
+ temperature: z.ZodNumber;
930
+ topP: z.ZodNumber;
931
+ }, z.core.$strip>>;
932
+ modifiedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
933
+ modifiedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
934
+ name: z.ZodString;
935
+ outputSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
936
+ sandBoxThreadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
937
+ showSources: z.ZodBoolean;
938
+ summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
939
+ supportsFiles: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
940
+ tags: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
941
+ variables: z.ZodRecord<z.ZodString, z.ZodObject<{
942
+ access: z.ZodEnum<{
943
+ None: "None";
944
+ Read: "Read";
945
+ Write: "Write";
946
+ }>;
947
+ schema: z.ZodRecord<z.ZodString, z.ZodAny>;
948
+ }, z.core.$strip>>;
949
+ }, z.core.$strip>>;
950
+ total: z.ZodNumber;
951
+ }, z.core.$strip>;
952
+ type WorkspaceDto = z.infer<typeof workspaceResponseSchema>;
953
+ type WorkspacesListResponseDto = z.infer<typeof workspacesListResponseSchema>;
954
+ type WorkspacesListItemDto = WorkspacesListResponseDto['data'][number];
955
+ type MentionUserDto = z.infer<typeof workspaceUsersResponseSchema>[number];
956
+ declare function mapMentionUserDtoToModel(dto: MentionUserDto): MentionUser;
957
+ declare function mapWorkspaceDtoToModel(dto: WorkspaceDto): Workspace;
958
+ declare const mapWorkspacesDtoToModels: (arr: WorkspacesListItemDto[]) => Workspace[];
959
+
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
+ declare function applyThreadToCache(qc: QueryClient, thread: MessageThread): boolean;
975
+ /**
976
+ * Invalidate every threads-list cache for a workspace. Use as a fallback when
977
+ * `applyThreadToCache` didn't find the thread in any list (i.e. brand-new
978
+ * thread) so the sidebar refetches and picks it up.
979
+ */
980
+ declare function invalidateWorkspaceThreadLists(qc: QueryClient, workspaceId: string): void;
981
+ /**
982
+ * Client-only flag for "we just hit send for this thread, server hasn't
983
+ * confirmed yet". Stored in its own cache cell (not on `MessageThread`)
984
+ * so the SSE gate — which reads server-confirmed `isFlowRunning` from the
985
+ * detail cache — stays unaffected. The unified UI selector
986
+ * `useThreadIsRunning` ORs this with `thread.isFlowRunning` so the composer,
987
+ * message list typing dots, and sidebar dot all light up at the same instant
988
+ * on send and turn off together when the flow's terminal frame arrives.
989
+ */
990
+ declare function setThreadOptimisticRunning(qc: QueryClient, threadId: string, running: boolean): void;
991
+ /**
992
+ * Optimistically flip a single thread's `isFlowRunning` flag in every list
993
+ * cache for the workspace (finite + infinite shapes). Used by `useSendMessage`
994
+ * so the sidebar dot lights up instantly without waiting for SignalR — the
995
+ * detail cache is intentionally NOT touched here, since that value gates the
996
+ * thread SSE and must stay server-confirmed.
997
+ */
998
+ declare function setThreadRunningInLists(qc: QueryClient, workspaceId: string, threadId: string, running: boolean): void;
999
+
1000
+ declare const messagesKeys: {
1001
+ all: readonly ["messages"];
1002
+ lists: () => readonly ["messages", "list"];
1003
+ list: (threadId: string) => readonly ["messages", "list", {
1004
+ readonly threadId: string;
1005
+ }];
1006
+ details: () => readonly ["messages", "detail"];
1007
+ detail: (messageId: string) => readonly ["messages", "detail", {
1008
+ readonly messageId: string;
1009
+ }];
1010
+ infinite: (threadId: string) => readonly ["messages", "list", "infinite", {
1011
+ readonly threadId: string;
1012
+ }];
1013
+ };
1014
+ declare const messagesMutationsKeys: {
1015
+ all: readonly ["messages", "mutations"];
1016
+ send: () => readonly ["messages", "mutations", "send"];
1017
+ addInput: () => readonly ["messages", "mutations", "addInput"];
1018
+ };
1019
+
1020
+ declare const filesKeys: {
1021
+ all: readonly ["files"];
1022
+ queries: () => readonly ["files", "query"];
1023
+ downloadBlob: (fileId: string) => readonly ["files", "query", "downloadBlob", {
1024
+ readonly fileId: string;
1025
+ }];
1026
+ mutations: () => readonly ["files", "mutation"];
1027
+ mutation: {
1028
+ upload: (scope?: {
1029
+ workspaceId?: string;
1030
+ threadId?: string;
1031
+ }) => readonly ["files", "mutation", "upload", {
1032
+ readonly scope: {
1033
+ workspaceId?: string;
1034
+ threadId?: string;
1035
+ } | undefined;
1036
+ }];
1037
+ download: (fileId: string) => readonly ["files", "mutation", "download", {
1038
+ readonly fileId: string;
1039
+ }];
1040
+ downloadBlob: (fileId: string) => readonly ["files", "mutation", "downloadBlob", {
1041
+ readonly fileId: string;
1042
+ }];
1043
+ downloadByUri: (uri: string) => readonly ["files", "mutation", "downloadByUri", {
1044
+ readonly uri: string;
1045
+ }];
1046
+ };
1047
+ };
1048
+
1049
+ /** Page size used by the sidebar thread list; must match ThreadsList.vm so list cache key is consistent. */
1050
+ declare const THREAD_LIST_PAGE_SIZE = 30;
1051
+ declare const threadsKeys: {
1052
+ all: readonly ["threads"];
1053
+ lists: () => readonly ["threads", "list"];
1054
+ list: (workspaceId: string, opts?: {
1055
+ take?: number;
1056
+ skip?: number;
1057
+ }) => readonly ["threads", "list", {
1058
+ readonly take?: number;
1059
+ readonly skip?: number;
1060
+ readonly workspaceId: string;
1061
+ }];
1062
+ details: () => readonly ["threads", "detail"];
1063
+ detail: (workspaceId: string, threadId: string) => readonly ["threads", "detail", {
1064
+ readonly workspaceId: string;
1065
+ readonly threadId: string;
1066
+ }];
1067
+ optimisticRunning: (threadId: string) => readonly ["threads", "optimisticRunning", string];
1068
+ mutations: () => readonly ["threads", "mutations"];
1069
+ setPin: (threadId: string) => readonly ["threads", "mutations", "setPin", {
1070
+ readonly threadId: string;
1071
+ }];
1072
+ renameThread: (threadId: string) => readonly ["threads", "mutations", "renameThread", {
1073
+ readonly threadId: string;
1074
+ }];
1075
+ deleteThread: (threadId: string) => readonly ["threads", "mutations", "deleteThread", {
1076
+ readonly threadId: string;
1077
+ }];
1078
+ };
1079
+
1080
+ declare const workspaceKeys: {
1081
+ all: readonly ["workspaces"];
1082
+ list: (searchTerm?: string) => readonly ["workspaces", "list", string];
1083
+ byId: (workspaceId: string) => readonly ["workspaces", "byId", string];
1084
+ taggableUsers: (workspaceId: string) => readonly ["workspaces", "taggableUsers", string];
1085
+ };
1086
+
1087
+ declare const flowRunsKeys: {
1088
+ all: readonly ["flowruns"];
1089
+ variables: (flowRunId: string) => readonly ["flowruns", "variables", {
1090
+ readonly flowRunId: string;
1091
+ }];
1092
+ mutations: () => readonly ["flowruns", "mutations"];
1093
+ updateVariable: (flowRunId: string, variableName: string) => readonly ["flowruns", "mutations", "updateVariable", {
1094
+ readonly flowRunId: string;
1095
+ readonly variableName: string;
1096
+ }];
1097
+ };
1098
+
1099
+ declare const modelsKeys: {
1100
+ all: readonly ["models"];
1101
+ lists: () => readonly ["models", "list"];
1102
+ list: (opts?: {
1103
+ search?: string;
1104
+ take?: number;
1105
+ skip?: number;
1106
+ }) => readonly ["models", "list", {
1107
+ readonly search: string | undefined;
1108
+ readonly take: number | undefined;
1109
+ readonly skip: number | undefined;
1110
+ }];
1111
+ details: () => readonly ["models", "detail"];
1112
+ detail: (modelId: string) => readonly ["models", "detail", {
1113
+ readonly modelId: string;
1114
+ }];
1115
+ };
1116
+
1117
+ declare const messagesListOptions: (service: ChatService, threadId: string, opts?: {
1118
+ take?: number;
1119
+ skip?: number;
1120
+ }) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<Message[], Error, Message[], readonly unknown[]>, "queryFn"> & {
1121
+ queryFn?: _tanstack_react_query.QueryFunction<Message[], readonly unknown[], never> | undefined;
1122
+ } & {
1123
+ queryKey: readonly unknown[] & {
1124
+ [dataTagSymbol]: Message[];
1125
+ [dataTagErrorSymbol]: Error;
1126
+ };
1127
+ };
1128
+ declare function useMessages(threadId: string, opts?: {
1129
+ take?: number;
1130
+ skip?: number;
1131
+ skipWhenNewThread?: boolean;
1132
+ }): _tanstack_react_query.UseQueryResult<Message[], Error>;
1133
+
1134
+ declare const useFileMutations: (scope: FileScope) => {
1135
+ uploadFilesMutation: _tanstack_react_query.UseMutationResult<FileInfo$1[], Error, File[], unknown>;
1136
+ downloadFileMutation: _tanstack_react_query.UseMutationResult<void, Error, FileInfo$1, unknown>;
1137
+ downloadFileByUriMutation: _tanstack_react_query.UseMutationResult<Blob, Error, {
1138
+ name: string;
1139
+ sourceUri: string;
1140
+ }, unknown>;
1141
+ getFileBlobUrl: (id: string) => Promise<string>;
1142
+ fileProgress: Record<string, number>;
1143
+ uploadedFiles: FileInfo$1[];
1144
+ clearUploadState: () => void;
1145
+ fileStates: (files: File[]) => {
1146
+ name: string;
1147
+ progress: number;
1148
+ status: "done" | "uploading";
1149
+ }[];
1150
+ };
1151
+
1152
+ declare const downloadFileBlobOptions: (service: ChatService, fileId: string, scope: FileScope) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<Blob, Error, Blob, readonly ["files", "query", "downloadBlob", {
1153
+ readonly fileId: string;
1154
+ }]>, "queryFn"> & {
1155
+ queryFn?: _tanstack_react_query.QueryFunction<Blob, readonly ["files", "query", "downloadBlob", {
1156
+ readonly fileId: string;
1157
+ }], never> | undefined;
1158
+ } & {
1159
+ queryKey: readonly ["files", "query", "downloadBlob", {
1160
+ readonly fileId: string;
1161
+ }] & {
1162
+ [dataTagSymbol]: Blob;
1163
+ [dataTagErrorSymbol]: Error;
1164
+ };
1165
+ };
1166
+ declare const useDownloadFileBlobQuery: (fileId: string, scope: FileScope) => _tanstack_react_query.UseQueryResult<Blob, Error>;
1167
+
1168
+ type SendArgs = {
1169
+ workspaceId: string;
1170
+ threadId: string;
1171
+ contentList?: MessageContentItem[];
1172
+ files?: FileInfo$1[];
1173
+ variables?: Record<string, unknown>;
1174
+ };
1175
+ declare function useSendMessage(): _tanstack_react_query.UseMutationResult<void, Error, SendArgs, unknown>;
1176
+ type AddInputArgs = {
1177
+ workspaceId?: string;
1178
+ threadId: string;
1179
+ messageId: string;
1180
+ name: string;
1181
+ value: unknown;
1182
+ channels: Record<string, number> | null;
1183
+ };
1184
+ declare function useAddInputToMessage(): {
1185
+ addInputToMessageMutation: _tanstack_react_query.UseMutationResult<Message, Error, AddInputArgs, unknown>;
1186
+ };
1187
+
1188
+ declare const threadDetailOptions: ({ service, workspaceId, threadId, }: {
1189
+ service: ChatService;
1190
+ workspaceId: string;
1191
+ threadId: string;
1192
+ }) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<MessageThread, Error, MessageThread, readonly ["threads", "detail", {
1193
+ readonly workspaceId: string;
1194
+ readonly threadId: string;
1195
+ }]>, "queryFn"> & {
1196
+ queryFn?: _tanstack_react_query.QueryFunction<MessageThread, readonly ["threads", "detail", {
1197
+ readonly workspaceId: string;
1198
+ readonly threadId: string;
1199
+ }], never> | undefined;
1200
+ } & {
1201
+ queryKey: readonly ["threads", "detail", {
1202
+ readonly workspaceId: string;
1203
+ readonly threadId: string;
1204
+ }] & {
1205
+ [dataTagSymbol]: MessageThread;
1206
+ [dataTagErrorSymbol]: Error;
1207
+ };
1208
+ };
1209
+ /**
1210
+ * Derive placeholder thread from list cache for instant detail display (e.g. drafts).
1211
+ * Searches all list caches for this workspace (infinite and non-infinite).
1212
+ */
1213
+ declare function getThreadPlaceholderFromListCache(queryClient: QueryClient, workspaceId: string, threadId: string): MessageThread | undefined;
1214
+ declare const useThread: ({ workspaceId, threadId, enabled, }: {
1215
+ workspaceId: string;
1216
+ threadId: string;
1217
+ enabled?: boolean;
1218
+ }) => _tanstack_react_query.UseQueryResult<MessageThread, Error>;
1219
+ /**
1220
+ * Unified "is this thread running?" signal for UI consumers (composer,
1221
+ * message list typing dots, sidebar dot). ORs the client-only optimistic
1222
+ * flag (set the instant the user hits send) with server-confirmed
1223
+ * `isFlowRunning` from the detail cache, so all three indicators start
1224
+ * and stop on the same render. The optimistic cell is cleared by
1225
+ * `useSendMessage` once POST returns and the detail cache holds the
1226
+ * authoritative value.
1227
+ */
1228
+ declare const useThreadIsRunning: (workspaceId: string | undefined, threadId: string | undefined) => boolean;
1229
+
1230
+ declare const workspaceDetailOptions: ({ service, workspaceId, }: {
1231
+ service: ChatService;
1232
+ workspaceId: string;
1233
+ }) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<Workspace, Error, Workspace, readonly unknown[]>, "queryFn"> & {
1234
+ queryFn?: _tanstack_react_query.QueryFunction<Workspace, readonly unknown[], never> | undefined;
1235
+ } & {
1236
+ queryKey: readonly unknown[] & {
1237
+ [dataTagSymbol]: Workspace;
1238
+ [dataTagErrorSymbol]: Error;
1239
+ };
1240
+ };
1241
+ declare function useWorkspace(workspaceId: string): _tanstack_react_query.UseQueryResult<Workspace, Error>;
1242
+ declare const taggableUsersOptions: ({ service, workspaceId, }: {
1243
+ service: ChatService;
1244
+ workspaceId: string;
1245
+ }) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<MentionUser[], Error, MentionUser[], readonly unknown[]>, "queryFn"> & {
1246
+ queryFn?: _tanstack_react_query.QueryFunction<MentionUser[], readonly unknown[], never> | undefined;
1247
+ } & {
1248
+ queryKey: readonly unknown[] & {
1249
+ [dataTagSymbol]: MentionUser[];
1250
+ [dataTagErrorSymbol]: Error;
1251
+ };
1252
+ };
1253
+ declare function useTaggableWorkspaceUsers(workspaceId: string): _tanstack_react_query.UseQueryResult<MentionUser[], Error>;
1254
+
1255
+ /**
1256
+ * Read the current flow-run variable values for a thread. The chat
1257
+ * variables form seeds initial UI state from this and rerenders when
1258
+ * the cache invalidates.
1259
+ */
1260
+ declare function useFlowRunVariables(flowRunId?: string): _tanstack_react_query.UseQueryResult<FlowRunVariables, Error>;
1261
+
1262
+ /**
1263
+ * Patch a single flow-run variable. Called per-change by the chat
1264
+ * variables form. Skips writes for draft threads (no flow-run yet)
1265
+ * and invalidates the matching variables cache on success.
1266
+ */
1267
+ declare function useUpdateFlowRunVariable(): _tanstack_react_query.UseMutationResult<void, Error, {
1268
+ flowRunId: string;
1269
+ variableName: string;
1270
+ value: unknown;
1271
+ }, unknown>;
1272
+
1273
+ /**
1274
+ * List models the user has access to. Drives the model-id renderer in
1275
+ * the chat variables form (a searchable dropdown of models).
1276
+ */
1277
+ declare function useModels({ search, take, skip, }?: {
1278
+ search?: string;
1279
+ take?: number;
1280
+ skip?: number;
1281
+ }): _tanstack_react_query.UseQueryResult<{
1282
+ data: Model[];
1283
+ total: number;
1284
+ }, Error>;
1285
+
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 };