@aiquants/chat 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +222 -0
- package/LICENSE +21 -0
- package/README.md +975 -2
- package/dist/ChatAnswerHtml-NBI6KBTM.js +1 -0
- package/dist/authz.cjs +1 -0
- package/dist/authz.d.cts +21 -0
- package/dist/authz.d.ts +21 -0
- package/dist/authz.js +1 -0
- package/dist/chunk-4NR4KSV6.js +1 -0
- package/dist/chunk-7KWWXSGA.js +1 -0
- package/dist/chunk-EEUIBWBF.js +1 -0
- package/dist/chunk-NKHHXW42.js +1 -0
- package/dist/chunk-PLNRET3Z.js +1 -0
- package/dist/chunk-WGNEBS4H.js +1 -0
- package/dist/client.cjs +2 -0
- package/dist/client.d.cts +10 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +2 -0
- package/dist/httpTransport-BAaKwioS.d.ts +11 -0
- package/dist/httpTransport-D_JJABMq.d.cts +11 -0
- package/dist/index-iHWm67aF.d.cts +19214 -0
- package/dist/index-iHWm67aF.d.ts +19214 -0
- package/dist/protocol.cjs +1 -0
- package/dist/protocol.d.cts +12 -0
- package/dist/protocol.d.ts +12 -0
- package/dist/protocol.js +1 -0
- package/dist/react.cjs +8 -0
- package/dist/react.d.cts +602 -0
- package/dist/react.d.ts +602 -0
- package/dist/react.js +8 -0
- package/dist/runStream-7KHfaNOq.d.ts +92 -0
- package/dist/runStream-CKisFztQ.d.cts +92 -0
- package/dist/testing.cjs +7 -0
- package/dist/testing.d.cts +50 -0
- package/dist/testing.d.ts +50 -0
- package/dist/testing.js +7 -0
- package/dist/transport-5ExGY_ti.d.cts +128 -0
- package/dist/transport-Clvkp7mW.d.ts +128 -0
- package/package.json +160 -3
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import { D as ChatBusinessError, U as ChatHostRefusalRole, I as ChatErrorBody, W as ChatLimitKey, T as ChatFailureCode, aB as chatFailureDetailSchemas, K as ChatEventData, ad as chatAttachmentFragments, u as ChatAttachment, x as ChatAttachmentKind, a9 as ChatVocabulary, F as ChatConversation, Z as ChatModelList, a3 as ChatSettings, a8 as ChatUserSettingsUpdate } from "./index-iHWm67aF.cjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
import { ReactNode, RefObject } from "react";
|
|
5
|
+
import { MermaidDrawer } from "@aiquants/markdown";
|
|
6
|
+
import { MarkdownConverter } from "@aiquants/markdown/converter";
|
|
7
|
+
import { C as ChatStreamNotice, n as ChatStreamNoticeAction, e as ChatRunStreams } from "./runStream-CKisFztQ.cjs";
|
|
8
|
+
import { e as ChatTransport } from "./transport-5ExGY_ti.cjs";
|
|
9
|
+
import { PagedState } from "@aiquants/console-ui";
|
|
10
|
+
import "@aiquants/sse";
|
|
11
|
+
import "@aiquants/sse/client";
|
|
12
|
+
declare const CHAT_LAYOUT: Readonly<{
|
|
13
|
+
latticePx: 4;
|
|
14
|
+
fontPx: number;
|
|
15
|
+
linePx: number;
|
|
16
|
+
rubyLinePx: number;
|
|
17
|
+
paragraphGapPx: number;
|
|
18
|
+
rubyParagraphGapPx: number;
|
|
19
|
+
targetPx: number;
|
|
20
|
+
measurePx: number;
|
|
21
|
+
gutterPx: number;
|
|
22
|
+
minGutterPx: number;
|
|
23
|
+
conversationPx: number;
|
|
24
|
+
sidePx: number;
|
|
25
|
+
messageGapPx: number;
|
|
26
|
+
controlGapPx: number;
|
|
27
|
+
twoColumnsFromPx: number;
|
|
28
|
+
threeColumnsFromPx: number;
|
|
29
|
+
composerPaddingBlockPx: number;
|
|
30
|
+
composerMaxLines: 10;
|
|
31
|
+
composerMaxBlockPx: number;
|
|
32
|
+
composerInputMinInlinePx: number;
|
|
33
|
+
composerGapPx: 4;
|
|
34
|
+
scrollBarPx: number;
|
|
35
|
+
latestGapPx: 4;
|
|
36
|
+
scrollRegionMinPx: number;
|
|
37
|
+
}>;
|
|
38
|
+
type ChatLayoutColumns = 1 | 2 | 3;
|
|
39
|
+
type ChatLayoutColumn = "conversations" | "talk" | "process";
|
|
40
|
+
type ChatPinnedSide = Exclude<ChatLayoutColumn, "talk">;
|
|
41
|
+
type ChatLayoutPlan = {
|
|
42
|
+
readonly columns: ChatLayoutColumns;
|
|
43
|
+
readonly gutterPx: number;
|
|
44
|
+
readonly talkMeasurePx: number;
|
|
45
|
+
readonly outerMarginPx: number;
|
|
46
|
+
};
|
|
47
|
+
type ChatLayoutRule = {
|
|
48
|
+
readonly key: string;
|
|
49
|
+
readonly css: string;
|
|
50
|
+
};
|
|
51
|
+
declare const chatLayoutPlan: (containerPx: number) => ChatLayoutPlan;
|
|
52
|
+
declare const chatFrameBlockSizePx: (visiblePx: number, topPx: number) => number;
|
|
53
|
+
declare const chatLayoutRule: () => ChatLayoutRule;
|
|
54
|
+
type ChatMicrophoneProblem = "denied" | "missing" | "unavailable";
|
|
55
|
+
type ChatRecordingRequest = {
|
|
56
|
+
readonly mediaType: string;
|
|
57
|
+
readonly bitsPerSecond: number;
|
|
58
|
+
readonly sliceMs: number;
|
|
59
|
+
};
|
|
60
|
+
type ChatRecordingListener = {
|
|
61
|
+
readonly onPiece: (piece: Blob, elapsedMs: number) => void;
|
|
62
|
+
readonly onEnd: () => void;
|
|
63
|
+
};
|
|
64
|
+
type ChatRecording = {
|
|
65
|
+
readonly stop: () => void;
|
|
66
|
+
readonly discard: () => void;
|
|
67
|
+
};
|
|
68
|
+
type ChatRecordingStart = {
|
|
69
|
+
readonly outcome: "recording";
|
|
70
|
+
readonly recording: ChatRecording;
|
|
71
|
+
} | {
|
|
72
|
+
readonly outcome: "refused";
|
|
73
|
+
readonly problem: ChatMicrophoneProblem;
|
|
74
|
+
};
|
|
75
|
+
type ChatMicrophone = {
|
|
76
|
+
readonly canRecord: (mediaType: string) => boolean;
|
|
77
|
+
readonly record: (request: ChatRecordingRequest, listener: ChatRecordingListener) => Promise<ChatRecordingStart>;
|
|
78
|
+
};
|
|
79
|
+
type ChatMediaStreamLike = {
|
|
80
|
+
getTracks(): readonly {
|
|
81
|
+
stop(): void;
|
|
82
|
+
}[];
|
|
83
|
+
};
|
|
84
|
+
type ChatMediaRecorderLike = {
|
|
85
|
+
readonly state: "inactive" | "recording" | "paused";
|
|
86
|
+
start(timeslice: number): void;
|
|
87
|
+
stop(): void;
|
|
88
|
+
addEventListener(type: "dataavailable", listener: (event: {
|
|
89
|
+
readonly data: Blob;
|
|
90
|
+
}) => void): void;
|
|
91
|
+
addEventListener(type: "stop", listener: () => void): void;
|
|
92
|
+
};
|
|
93
|
+
type ChatMicrophoneScope<Stream extends ChatMediaStreamLike> = {
|
|
94
|
+
readonly navigator?: {
|
|
95
|
+
readonly mediaDevices?: {
|
|
96
|
+
getUserMedia(constraints: {
|
|
97
|
+
readonly audio: true;
|
|
98
|
+
}): Promise<Stream>;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly MediaRecorder?: {
|
|
102
|
+
isTypeSupported(mediaType: string): boolean;
|
|
103
|
+
new (stream: Stream, options: {
|
|
104
|
+
readonly mimeType: string;
|
|
105
|
+
readonly audioBitsPerSecond: number;
|
|
106
|
+
}): ChatMediaRecorderLike;
|
|
107
|
+
};
|
|
108
|
+
readonly performance: {
|
|
109
|
+
now(): number;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
declare const chatBrowserMicrophone: <Stream extends ChatMediaStreamLike>(scope: ChatMicrophoneScope<Stream>) => ChatMicrophone;
|
|
113
|
+
type ChatRefusalStatusClass = "unauthenticated" | "unavailable" | "not-accepted";
|
|
114
|
+
type ChatHostRefusalCodes = Readonly<Record<ChatHostRefusalRole, number>>;
|
|
115
|
+
type ChatRefusal = ({
|
|
116
|
+
readonly requestId: string;
|
|
117
|
+
readonly errorCode: number;
|
|
118
|
+
} & ({
|
|
119
|
+
readonly kind: "business";
|
|
120
|
+
readonly business: ChatBusinessError;
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: "host-role";
|
|
123
|
+
readonly role: ChatHostRefusalRole;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: ChatRefusalStatusClass;
|
|
126
|
+
})) | {
|
|
127
|
+
readonly requestId: null;
|
|
128
|
+
readonly errorCode: null;
|
|
129
|
+
readonly kind: BodilessRefusalKind;
|
|
130
|
+
};
|
|
131
|
+
type BodilessRefusalKind = Exclude<ChatRefusalStatusClass, "not-accepted">;
|
|
132
|
+
declare const assertValidChatHostRefusalCodes: (hostRefusalCodes: ChatHostRefusalCodes) => void;
|
|
133
|
+
declare const chatRefusal: (status: number, body: ChatErrorBody | null, hostRefusalCodes: ChatHostRefusalCodes) => ChatRefusal;
|
|
134
|
+
type ChatConverterTimeouts = {
|
|
135
|
+
readonly timeoutMs: number;
|
|
136
|
+
readonly loadTimeoutMs: number;
|
|
137
|
+
};
|
|
138
|
+
type ChatMarkdownConverterFactory = (timeouts: ChatConverterTimeouts) => MarkdownConverter;
|
|
139
|
+
type ChatConversionLimits = Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_RENDER_HTML_MAX_BYTES" | "CHAT_RENDER_HTML_CACHE_MAX_CHARS" | "CHAT_RENDER_CONVERT_TIMEOUT_MS" | "CHAT_RENDER_LOAD_TIMEOUT_MS" | "CHAT_RENDER_SMOOTH_HALF_LIFE_MS">>;
|
|
140
|
+
type ChatMessageText = {
|
|
141
|
+
readonly text: string;
|
|
142
|
+
readonly growing: boolean;
|
|
143
|
+
readonly replaced: boolean;
|
|
144
|
+
};
|
|
145
|
+
type ChatRunFailure = {
|
|
146
|
+
readonly [Code in ChatFailureCode]: {
|
|
147
|
+
readonly error_code: Code;
|
|
148
|
+
readonly detail: z.infer<(typeof chatFailureDetailSchemas)[Code]>;
|
|
149
|
+
};
|
|
150
|
+
}[ChatFailureCode];
|
|
151
|
+
type ChatRunStopper = ChatEventData<"run.cancelled">["cancelled_by"];
|
|
152
|
+
type ChatAnswerStatus = {
|
|
153
|
+
readonly kind: "writing";
|
|
154
|
+
} | {
|
|
155
|
+
readonly kind: "completed";
|
|
156
|
+
readonly finish_reason: ChatEventData<"run.completed">["finish_reason"];
|
|
157
|
+
} | {
|
|
158
|
+
readonly kind: "failed";
|
|
159
|
+
readonly failure: ChatRunFailure;
|
|
160
|
+
} | {
|
|
161
|
+
readonly kind: "cancelled";
|
|
162
|
+
readonly cancelled_by: ChatRunStopper;
|
|
163
|
+
};
|
|
164
|
+
type ChatModelAttachmentFlags = {
|
|
165
|
+
readonly [Field in keyof typeof chatAttachmentFragments.model]: z.infer<(typeof chatAttachmentFragments.model)[Field]>;
|
|
166
|
+
};
|
|
167
|
+
type ChatAttachmentLimits = Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_ATTACHMENT_MAX_COUNT" | "CHAT_ATTACHMENT_IMAGE_MAX_BYTES" | "CHAT_ATTACHMENT_PDF_MAX_BYTES" | "CHAT_ATTACHMENT_AUDIO_MAX_BYTES" | "CHAT_ATTACHMENT_AUDIO_MAX_SECONDS">>;
|
|
168
|
+
type ChatAttachmentPrecheckRefusal = "attachment_count_exceeded" | "attachment_unsupported_by_model" | "attachment_too_large";
|
|
169
|
+
declare const chatModelTakesKind: (model: ChatModelAttachmentFlags, kind: ChatAttachmentKind) => boolean;
|
|
170
|
+
declare const chatModelAttachmentKinds: (model: ChatModelAttachmentFlags) => readonly ChatAttachmentKind[];
|
|
171
|
+
declare const chatFilePickerAccept: (model: ChatModelAttachmentFlags) => string;
|
|
172
|
+
declare const chatDeclaredAttachmentKind: (mediaType: string) => ChatAttachmentKind | null;
|
|
173
|
+
declare const precheckChatAttachment: (file: {
|
|
174
|
+
readonly type: string;
|
|
175
|
+
readonly size: number;
|
|
176
|
+
}, model: ChatModelAttachmentFlags, limits: ChatAttachmentLimits, pendingCount: number) => ChatAttachmentPrecheckRefusal | null;
|
|
177
|
+
declare const chatAttachmentsRefusedByModel: <Pending extends {
|
|
178
|
+
readonly kind: ChatAttachmentKind;
|
|
179
|
+
}>(pending: readonly Pending[], model: ChatModelAttachmentFlags) => readonly Pending[];
|
|
180
|
+
declare const chatAttachmentHasUnreadText: (attachment: ChatAttachment) => boolean;
|
|
181
|
+
type ChatAnswerRenderLimits = ChatConversionLimits & Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_RENDER_DIAGRAM_CACHE_MAX_CHARS" | "CHAT_RENDER_DIAGRAM_MAX_CHARS" | "CHAT_RENDER_DIAGRAM_MAX_EDGES" | "CHAT_RENDER_MAX_DIAGRAMS_PER_MESSAGE">>;
|
|
182
|
+
type ChatAnswerRenderingProps = {
|
|
183
|
+
readonly converterFactory: ChatMarkdownConverterFactory;
|
|
184
|
+
readonly mermaidDrawer: MermaidDrawer;
|
|
185
|
+
readonly limits: ChatAnswerRenderLimits | null;
|
|
186
|
+
readonly theme: "light" | "dark";
|
|
187
|
+
readonly streamDisplay: ChatVocabulary<"stream_displays">;
|
|
188
|
+
readonly reduceMotion: boolean;
|
|
189
|
+
readonly children: ReactNode;
|
|
190
|
+
};
|
|
191
|
+
declare const ChatAnswerRendering: ({ converterFactory, mermaidDrawer, limits, theme, streamDisplay, reduceMotion, children }: ChatAnswerRenderingProps) => react.JSX.Element;
|
|
192
|
+
type ChatComposerAttachment = {
|
|
193
|
+
readonly key: string;
|
|
194
|
+
readonly stage: "uploading";
|
|
195
|
+
readonly file: File;
|
|
196
|
+
} | {
|
|
197
|
+
readonly key: string;
|
|
198
|
+
readonly stage: "unreached";
|
|
199
|
+
readonly file: File;
|
|
200
|
+
} | {
|
|
201
|
+
readonly key: string;
|
|
202
|
+
readonly stage: "stopped";
|
|
203
|
+
readonly file: File;
|
|
204
|
+
readonly rule: ChatAttachmentPrecheckRefusal;
|
|
205
|
+
} | {
|
|
206
|
+
readonly key: string;
|
|
207
|
+
readonly stage: "refused";
|
|
208
|
+
readonly file: File;
|
|
209
|
+
readonly refusal: ChatRefusal;
|
|
210
|
+
} | {
|
|
211
|
+
readonly key: string;
|
|
212
|
+
readonly stage: "incompatible";
|
|
213
|
+
readonly file: File;
|
|
214
|
+
readonly attachment: null;
|
|
215
|
+
} | {
|
|
216
|
+
readonly key: string;
|
|
217
|
+
readonly stage: "incompatible";
|
|
218
|
+
readonly file: File | null;
|
|
219
|
+
readonly attachment: ChatAttachment;
|
|
220
|
+
} | {
|
|
221
|
+
readonly key: string;
|
|
222
|
+
readonly stage: "uploaded";
|
|
223
|
+
readonly file: File | null;
|
|
224
|
+
readonly attachment: ChatAttachment;
|
|
225
|
+
} | {
|
|
226
|
+
readonly key: string;
|
|
227
|
+
readonly stage: "expired";
|
|
228
|
+
readonly file: File | null;
|
|
229
|
+
readonly attachment: ChatAttachment;
|
|
230
|
+
};
|
|
231
|
+
type ChatComposerAltTextOutcome = {
|
|
232
|
+
readonly outcome: "saved";
|
|
233
|
+
} | {
|
|
234
|
+
readonly outcome: "unreached";
|
|
235
|
+
} | {
|
|
236
|
+
readonly outcome: "refused";
|
|
237
|
+
readonly refusal: ChatRefusal;
|
|
238
|
+
} | {
|
|
239
|
+
readonly outcome: "incompatible";
|
|
240
|
+
};
|
|
241
|
+
type ChatComposerSaveAltText = (key: string, altText: string | null) => Promise<ChatComposerAltTextOutcome>;
|
|
242
|
+
type ChatComposerProblem = {
|
|
243
|
+
readonly occurrence: number;
|
|
244
|
+
} & ({
|
|
245
|
+
readonly cause: "unreached";
|
|
246
|
+
} | {
|
|
247
|
+
readonly cause: "refused";
|
|
248
|
+
readonly refusal: ChatRefusal;
|
|
249
|
+
} | {
|
|
250
|
+
readonly cause: "incompatible";
|
|
251
|
+
});
|
|
252
|
+
type ChatComposerPhase = "ready" | "sending" | "running" | "stopping";
|
|
253
|
+
type ChatComposerRestore = {
|
|
254
|
+
readonly modelName: string;
|
|
255
|
+
readonly onRestore: () => void;
|
|
256
|
+
};
|
|
257
|
+
type ChatComposerLimits = ChatAttachmentLimits & Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_USER_MESSAGE_MAX_CHARS">>;
|
|
258
|
+
type ChatComposerAttachments = {
|
|
259
|
+
readonly items: readonly ChatComposerAttachment[];
|
|
260
|
+
readonly model: ChatModelAttachmentFlags | null;
|
|
261
|
+
readonly onAdd: (files: readonly File[]) => void;
|
|
262
|
+
readonly onRemove: (key: string) => void;
|
|
263
|
+
readonly onRetry: (key: string) => void;
|
|
264
|
+
readonly onSaveAltText: ChatComposerSaveAltText;
|
|
265
|
+
readonly restore: ChatComposerRestore | null;
|
|
266
|
+
readonly microphone: ChatMicrophone | null;
|
|
267
|
+
};
|
|
268
|
+
type ChatComposerProps = {
|
|
269
|
+
readonly value: string;
|
|
270
|
+
readonly onValueChange: (value: string) => void;
|
|
271
|
+
readonly phase: ChatComposerPhase;
|
|
272
|
+
readonly onSend: (text: string) => void;
|
|
273
|
+
readonly onStop: () => void;
|
|
274
|
+
readonly notice: ChatStreamNotice | null;
|
|
275
|
+
readonly onNoticeAction: (action: ChatStreamNoticeAction) => void;
|
|
276
|
+
readonly problem: ChatComposerProblem | null;
|
|
277
|
+
readonly attachments: ChatComposerAttachments;
|
|
278
|
+
readonly limits: ChatComposerLimits;
|
|
279
|
+
readonly sendKey: ChatVocabulary<"send_keys">;
|
|
280
|
+
readonly contentBaseUrl: string;
|
|
281
|
+
readonly testId: string;
|
|
282
|
+
};
|
|
283
|
+
declare const ChatComposer: (props: ChatComposerProps) => react.JSX.Element;
|
|
284
|
+
type ChatTextLanguage = "ja" | "en" | "screen";
|
|
285
|
+
type ChatMessageAuthor = {
|
|
286
|
+
readonly role: "user";
|
|
287
|
+
} | {
|
|
288
|
+
readonly role: "assistant";
|
|
289
|
+
readonly model: string | null;
|
|
290
|
+
readonly status: ChatAnswerStatus;
|
|
291
|
+
};
|
|
292
|
+
type ChatListMessage = {
|
|
293
|
+
readonly messageUid: string;
|
|
294
|
+
readonly author: ChatMessageAuthor;
|
|
295
|
+
readonly createdAt: string;
|
|
296
|
+
readonly text: ChatMessageText;
|
|
297
|
+
readonly marks: number;
|
|
298
|
+
readonly language: ChatTextLanguage;
|
|
299
|
+
readonly contextCutBefore: boolean;
|
|
300
|
+
};
|
|
301
|
+
type ChatMessageListLimits = Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_RENDER_LIST_OVERSCAN_ROWS">>;
|
|
302
|
+
type ChatMessageListProps = {
|
|
303
|
+
readonly messages: readonly ChatListMessage[];
|
|
304
|
+
readonly notificationLevel: ChatVocabulary<"notification_levels">;
|
|
305
|
+
readonly followScroll: boolean;
|
|
306
|
+
readonly reduceMotion: boolean;
|
|
307
|
+
readonly sentMessageUid: string | null;
|
|
308
|
+
readonly labelledBy: string;
|
|
309
|
+
readonly headingLevel: number;
|
|
310
|
+
readonly limits: ChatMessageListLimits;
|
|
311
|
+
readonly older: boolean;
|
|
312
|
+
readonly onLoadOlder: () => void;
|
|
313
|
+
readonly olderReading: boolean;
|
|
314
|
+
readonly olderFailure: ChatOlderFailure | null;
|
|
315
|
+
readonly testId: string;
|
|
316
|
+
};
|
|
317
|
+
declare const ChatMessageList: ({ messages, notificationLevel, followScroll, reduceMotion, sentMessageUid, labelledBy, headingLevel, limits, older, onLoadOlder, olderReading, olderFailure, testId }: ChatMessageListProps) => react.JSX.Element;
|
|
318
|
+
type ChatConversationOptions = {
|
|
319
|
+
readonly transport: ChatTransport;
|
|
320
|
+
readonly streams: ChatRunStreams;
|
|
321
|
+
readonly conversationUid: string;
|
|
322
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
323
|
+
readonly limits: ChatConversationLimits;
|
|
324
|
+
};
|
|
325
|
+
type ChatConversationLimits = Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_RUN_POLL_INTERVAL_MS">>;
|
|
326
|
+
type ChatConversationState = {
|
|
327
|
+
readonly kind: "loading";
|
|
328
|
+
} | {
|
|
329
|
+
readonly kind: "open";
|
|
330
|
+
readonly conversation: ChatConversation;
|
|
331
|
+
} | {
|
|
332
|
+
readonly kind: "refused";
|
|
333
|
+
readonly refusal: ChatRefusal;
|
|
334
|
+
} | {
|
|
335
|
+
readonly kind: "failed";
|
|
336
|
+
readonly cause: "unreached" | "incompatible";
|
|
337
|
+
readonly retry: () => void;
|
|
338
|
+
};
|
|
339
|
+
type ChatConversationWindow = {
|
|
340
|
+
readonly state: ChatConversationState;
|
|
341
|
+
readonly messages: readonly ChatListMessage[];
|
|
342
|
+
readonly notice: ChatStreamNotice | null;
|
|
343
|
+
readonly onNoticeAction: (action: ChatStreamNoticeAction) => void;
|
|
344
|
+
readonly reread: () => Promise<boolean>;
|
|
345
|
+
readonly older: boolean;
|
|
346
|
+
readonly loadOlder: () => void;
|
|
347
|
+
readonly olderReading: boolean;
|
|
348
|
+
readonly olderFailure: ChatOlderFailure | null;
|
|
349
|
+
};
|
|
350
|
+
type ChatOlderFailure = {
|
|
351
|
+
readonly cause: "unreached" | "incompatible";
|
|
352
|
+
readonly occurrence: number;
|
|
353
|
+
};
|
|
354
|
+
declare const useChatConversation: (options: ChatConversationOptions) => ChatConversationWindow;
|
|
355
|
+
type ChatConversationGateProps = {
|
|
356
|
+
readonly conversation: ChatConversationWindow;
|
|
357
|
+
readonly onReopen: () => void;
|
|
358
|
+
readonly focusAfterOpen: RefObject<HTMLElement | null>;
|
|
359
|
+
readonly children: (conversation: ChatConversation) => ReactNode;
|
|
360
|
+
readonly testId: string;
|
|
361
|
+
};
|
|
362
|
+
declare const ChatConversationGate: ({ conversation, onReopen, focusAfterOpen, children, testId }: ChatConversationGateProps) => ReactNode;
|
|
363
|
+
type ChatConversationListLimits = {
|
|
364
|
+
readonly CHAT_TITLE_SEARCH_PAUSE_MS: number;
|
|
365
|
+
};
|
|
366
|
+
type ChatConversationListOptions = {
|
|
367
|
+
readonly transport: ChatTransport;
|
|
368
|
+
readonly limits: ChatConversationListLimits;
|
|
369
|
+
};
|
|
370
|
+
type ChatConversationSection = {
|
|
371
|
+
readonly state: PagedState<ChatConversation, string, null>;
|
|
372
|
+
readonly reload: () => void;
|
|
373
|
+
readonly loadMore: () => void;
|
|
374
|
+
};
|
|
375
|
+
type ChatConversationListState = {
|
|
376
|
+
readonly typed: string;
|
|
377
|
+
readonly query: string | null;
|
|
378
|
+
readonly type: (text: string) => void;
|
|
379
|
+
readonly search: (text: string) => void;
|
|
380
|
+
readonly pinned: ChatConversationSection;
|
|
381
|
+
readonly recent: ChatConversationSection;
|
|
382
|
+
};
|
|
383
|
+
declare const useChatConversationList: (options: ChatConversationListOptions) => ChatConversationListState;
|
|
384
|
+
type ChatConversationListViewLimits = {
|
|
385
|
+
readonly CHAT_CONVERSATION_PAGE_SIZE: number;
|
|
386
|
+
};
|
|
387
|
+
type ChatConversationListProps = {
|
|
388
|
+
readonly list: ChatConversationListState;
|
|
389
|
+
readonly currentConversationUid: string | null;
|
|
390
|
+
readonly hrefOf: (conversationUid: string) => string;
|
|
391
|
+
readonly onNavigate: (href: string) => void;
|
|
392
|
+
readonly onNewConversation: () => void;
|
|
393
|
+
readonly headingLevel: 2 | 3;
|
|
394
|
+
readonly limits: ChatConversationListViewLimits;
|
|
395
|
+
readonly testId: string;
|
|
396
|
+
};
|
|
397
|
+
declare const ChatConversationList: ({ list, currentConversationUid, hrefOf, onNavigate, onNewConversation, headingLevel, limits, testId }: ChatConversationListProps) => react.JSX.Element;
|
|
398
|
+
type ChatFrameProps = {
|
|
399
|
+
readonly conversations: ReactNode;
|
|
400
|
+
readonly process: ReactNode;
|
|
401
|
+
readonly talkHeading: ReactNode;
|
|
402
|
+
readonly talk: ReactNode;
|
|
403
|
+
readonly pinnedSide: ChatPinnedSide;
|
|
404
|
+
readonly headingLevel: 1 | 2 | 3;
|
|
405
|
+
readonly testId: string;
|
|
406
|
+
};
|
|
407
|
+
declare const ChatFrame: ({ conversations, process, talkHeading, talk, pinnedSide, headingLevel, testId }: ChatFrameProps) => react.JSX.Element;
|
|
408
|
+
type ChatNewConversationOptions = {
|
|
409
|
+
readonly transport: ChatTransport;
|
|
410
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
411
|
+
};
|
|
412
|
+
type ChatNewConversationMessage = {
|
|
413
|
+
readonly text: string;
|
|
414
|
+
readonly attachmentIds: readonly string[];
|
|
415
|
+
readonly modelUid: string;
|
|
416
|
+
readonly reasoningLevel: ChatVocabulary<"reasoning_levels">;
|
|
417
|
+
readonly declaredLevel: ChatVocabulary<"confidentiality_levels">;
|
|
418
|
+
};
|
|
419
|
+
type ChatNewConversationOutcome = {
|
|
420
|
+
readonly kind: "accepted";
|
|
421
|
+
readonly conversationUid: string;
|
|
422
|
+
} | {
|
|
423
|
+
readonly kind: "not-sent";
|
|
424
|
+
};
|
|
425
|
+
type ChatNewConversation = {
|
|
426
|
+
readonly phase: Extract<ChatComposerPhase, "ready" | "sending">;
|
|
427
|
+
readonly problem: ChatComposerProblem | null;
|
|
428
|
+
readonly send: (message: ChatNewConversationMessage) => Promise<ChatNewConversationOutcome>;
|
|
429
|
+
};
|
|
430
|
+
declare const useChatNewConversation: (options: ChatNewConversationOptions) => ChatNewConversation;
|
|
431
|
+
type ChatModelsOptions = {
|
|
432
|
+
readonly transport: ChatTransport;
|
|
433
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
434
|
+
readonly query: ChatModelsQuery | null;
|
|
435
|
+
};
|
|
436
|
+
type ChatModelsQuery = {
|
|
437
|
+
readonly conversationUid: string;
|
|
438
|
+
} | {
|
|
439
|
+
readonly declaredLevel: ChatVocabulary<"confidentiality_levels">;
|
|
440
|
+
};
|
|
441
|
+
type ChatModelsState = {
|
|
442
|
+
readonly kind: "reading";
|
|
443
|
+
} | {
|
|
444
|
+
readonly kind: "open";
|
|
445
|
+
readonly models: ChatModelList["items"];
|
|
446
|
+
} | {
|
|
447
|
+
readonly kind: "refused";
|
|
448
|
+
readonly refusal: ChatRefusal;
|
|
449
|
+
readonly retry: (() => void) | null;
|
|
450
|
+
} | {
|
|
451
|
+
readonly kind: "failed";
|
|
452
|
+
readonly cause: "unreached" | "incompatible";
|
|
453
|
+
readonly retry: () => void;
|
|
454
|
+
};
|
|
455
|
+
type ChatModels = {
|
|
456
|
+
readonly state: ChatModelsState;
|
|
457
|
+
readonly reread: () => void;
|
|
458
|
+
};
|
|
459
|
+
declare const useChatModels: (options: ChatModelsOptions) => ChatModels;
|
|
460
|
+
type ConfidentialityLevel = ChatVocabulary<"confidentiality_levels">;
|
|
461
|
+
type ReasoningLevel = ChatVocabulary<"reasoning_levels">;
|
|
462
|
+
type ModelListRow = ChatModelList["items"][number];
|
|
463
|
+
type ChatChoosableModel = Extract<ModelListRow, {
|
|
464
|
+
readonly display_name: string;
|
|
465
|
+
}>;
|
|
466
|
+
type ChatNewConversationChoiceOptions = {
|
|
467
|
+
readonly transport: ChatTransport;
|
|
468
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
469
|
+
readonly defaults: ChatSettings["conversation_defaults"];
|
|
470
|
+
};
|
|
471
|
+
type ChatNewConversationChoice = {
|
|
472
|
+
readonly declaredLevel: ConfidentialityLevel;
|
|
473
|
+
readonly declaredLevels: readonly ConfidentialityLevel[];
|
|
474
|
+
readonly models: ChatModels;
|
|
475
|
+
readonly model: ChatChoosableModel | null;
|
|
476
|
+
readonly reasoningLevel: ReasoningLevel | null;
|
|
477
|
+
readonly flags: ChatModelAttachmentFlags | null;
|
|
478
|
+
readonly previousModel: ChatChoosableModel | null;
|
|
479
|
+
readonly chooseDeclaredLevel: (level: ConfidentialityLevel) => void;
|
|
480
|
+
readonly chooseModel: (modelUid: string) => void;
|
|
481
|
+
readonly chooseReasoningLevel: (level: ReasoningLevel) => void;
|
|
482
|
+
};
|
|
483
|
+
declare const useChatNewConversationChoice: (options: ChatNewConversationChoiceOptions) => ChatNewConversationChoice;
|
|
484
|
+
type ChatNewConversationChoicesProps = {
|
|
485
|
+
readonly choice: ChatNewConversationChoice;
|
|
486
|
+
readonly phase: ChatNewConversation["phase"];
|
|
487
|
+
readonly testId: string;
|
|
488
|
+
};
|
|
489
|
+
declare const ChatNewConversationChoices: ({ choice, phase, testId }: ChatNewConversationChoicesProps) => react.JSX.Element;
|
|
490
|
+
type ChatSettingsOptions = {
|
|
491
|
+
readonly transport: ChatTransport;
|
|
492
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
493
|
+
};
|
|
494
|
+
type ChatSettingsState = {
|
|
495
|
+
readonly kind: "reading";
|
|
496
|
+
} | {
|
|
497
|
+
readonly kind: "open";
|
|
498
|
+
readonly settings: ChatSettings;
|
|
499
|
+
} | {
|
|
500
|
+
readonly kind: "refused";
|
|
501
|
+
readonly refusal: ChatRefusal;
|
|
502
|
+
readonly retry: (() => void) | null;
|
|
503
|
+
} | {
|
|
504
|
+
readonly kind: "failed";
|
|
505
|
+
readonly cause: "unreached" | "incompatible";
|
|
506
|
+
readonly retry: () => void;
|
|
507
|
+
};
|
|
508
|
+
type ChatSettingsProblem = {
|
|
509
|
+
readonly occurrence: number;
|
|
510
|
+
} & ({
|
|
511
|
+
readonly cause: "unreached";
|
|
512
|
+
} | {
|
|
513
|
+
readonly cause: "refused";
|
|
514
|
+
readonly refusal: ChatRefusal;
|
|
515
|
+
} | {
|
|
516
|
+
readonly cause: "incompatible";
|
|
517
|
+
});
|
|
518
|
+
type ChatSettingsSaveOutcome = "saved" | "not-saved";
|
|
519
|
+
type ChatSettingsAccess = {
|
|
520
|
+
readonly state: ChatSettingsState;
|
|
521
|
+
readonly saving: boolean;
|
|
522
|
+
readonly problem: ChatSettingsProblem | null;
|
|
523
|
+
readonly save: (update: ChatUserSettingsUpdate) => Promise<ChatSettingsSaveOutcome>;
|
|
524
|
+
};
|
|
525
|
+
declare const useChatSettings: (options: ChatSettingsOptions) => ChatSettingsAccess;
|
|
526
|
+
type ChatSettingsFormProps = {
|
|
527
|
+
readonly settings: ChatSettingsAccess;
|
|
528
|
+
readonly models: ChatModels;
|
|
529
|
+
readonly labelledBy: string;
|
|
530
|
+
readonly testId: string;
|
|
531
|
+
};
|
|
532
|
+
declare const ChatSettingsForm: ({ settings, models, labelledBy, testId }: ChatSettingsFormProps) => react.JSX.Element;
|
|
533
|
+
type ChatSettingsGateProps = {
|
|
534
|
+
readonly settings: ChatSettingsAccess;
|
|
535
|
+
readonly focusAfterOpen: RefObject<HTMLElement | null>;
|
|
536
|
+
readonly children: (settings: ChatSettings) => ReactNode;
|
|
537
|
+
readonly testId: string;
|
|
538
|
+
};
|
|
539
|
+
declare const ChatSettingsGate: ({ settings, focusAfterOpen, children, testId }: ChatSettingsGateProps) => ReactNode;
|
|
540
|
+
type ChatTalkFlowProps = {
|
|
541
|
+
readonly children: ReactNode;
|
|
542
|
+
readonly testId: string;
|
|
543
|
+
};
|
|
544
|
+
declare const ChatTalkFlow: ({ children, testId }: ChatTalkFlowProps) => react.JSX.Element;
|
|
545
|
+
type ChatTalkHeadingProps = {
|
|
546
|
+
readonly conversation: {
|
|
547
|
+
readonly title: string | null;
|
|
548
|
+
} | null;
|
|
549
|
+
readonly level: 1 | 2 | 3;
|
|
550
|
+
readonly labelId: string;
|
|
551
|
+
readonly testId: string;
|
|
552
|
+
};
|
|
553
|
+
declare const ChatTalkHeading: ({ conversation, level, labelId, testId }: ChatTalkHeadingProps) => react.JSX.Element;
|
|
554
|
+
type ChatDiagramFormat = "svg" | "png";
|
|
555
|
+
type ChatDiagramFileContext = {
|
|
556
|
+
readonly conversationUid: string;
|
|
557
|
+
readonly messageUid: string;
|
|
558
|
+
readonly index: number;
|
|
559
|
+
readonly accTitle: string | null;
|
|
560
|
+
readonly format: ChatDiagramFormat;
|
|
561
|
+
readonly savedAt: Date;
|
|
562
|
+
readonly timeZone: string;
|
|
563
|
+
};
|
|
564
|
+
declare const diagramFileName: (context: ChatDiagramFileContext) => string;
|
|
565
|
+
type ChatComposerAttachmentsLimits = ChatAttachmentLimits & Readonly<Pick<Record<ChatLimitKey, number>, "CHAT_ATTACHMENT_POLL_INTERVAL_MS">>;
|
|
566
|
+
type ChatComposerAttachmentsOptions = {
|
|
567
|
+
readonly transport: ChatTransport;
|
|
568
|
+
readonly modelUid: string | null;
|
|
569
|
+
readonly model: ChatModelAttachmentFlags | null;
|
|
570
|
+
readonly limits: ChatComposerAttachmentsLimits;
|
|
571
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
572
|
+
};
|
|
573
|
+
type ChatComposerAttachmentsState = {
|
|
574
|
+
readonly items: readonly ChatComposerAttachment[];
|
|
575
|
+
readonly onAdd: (files: readonly File[]) => void;
|
|
576
|
+
readonly onRemove: (key: string) => void;
|
|
577
|
+
readonly onRetry: (key: string) => void;
|
|
578
|
+
readonly onSaveAltText: (key: string, altText: string | null) => Promise<ChatComposerAltTextOutcome>;
|
|
579
|
+
readonly readyIds: readonly string[];
|
|
580
|
+
readonly clear: () => void;
|
|
581
|
+
};
|
|
582
|
+
declare const useChatComposerAttachments: (options: ChatComposerAttachmentsOptions) => ChatComposerAttachmentsState;
|
|
583
|
+
declare const useChatConversationCreatedAnnouncer: () => (() => void);
|
|
584
|
+
type ChatSendOptions = {
|
|
585
|
+
readonly transport: ChatTransport;
|
|
586
|
+
readonly window: ChatConversationWindow;
|
|
587
|
+
readonly hostRefusalCodes: ChatHostRefusalCodes;
|
|
588
|
+
};
|
|
589
|
+
type ChatSendMessage = {
|
|
590
|
+
readonly text: string;
|
|
591
|
+
readonly attachmentIds: readonly string[];
|
|
592
|
+
};
|
|
593
|
+
type ChatSendOutcome = "accepted" | "not-sent";
|
|
594
|
+
type ChatSend = {
|
|
595
|
+
readonly phase: ChatComposerPhase;
|
|
596
|
+
readonly problem: ChatComposerProblem | null;
|
|
597
|
+
readonly sentMessageUid: string | null;
|
|
598
|
+
readonly send: (message: ChatSendMessage) => Promise<ChatSendOutcome>;
|
|
599
|
+
readonly stop: () => void;
|
|
600
|
+
};
|
|
601
|
+
declare const useChatSend: (options: ChatSendOptions) => ChatSend;
|
|
602
|
+
export { CHAT_LAYOUT, type ChatAnswerRenderLimits, ChatAnswerRendering, type ChatAnswerRenderingProps, type ChatAnswerStatus, type ChatAttachmentLimits, type ChatAttachmentPrecheckRefusal, type ChatChoosableModel, ChatComposer, type ChatComposerAltTextOutcome, type ChatComposerAttachment, type ChatComposerAttachments, type ChatComposerAttachmentsLimits, type ChatComposerAttachmentsOptions, type ChatComposerAttachmentsState, type ChatComposerLimits, type ChatComposerPhase, type ChatComposerProblem, type ChatComposerProps, type ChatComposerRestore, type ChatComposerSaveAltText, ChatConversationGate, type ChatConversationGateProps, type ChatConversationLimits, ChatConversationList, type ChatConversationListLimits, type ChatConversationListOptions, type ChatConversationListProps, type ChatConversationListState, type ChatConversationListViewLimits, type ChatConversationOptions, type ChatConversationSection, type ChatConversationState, type ChatConversationWindow, type ChatConversionLimits, type ChatConverterTimeouts, type ChatDiagramFileContext, type ChatDiagramFormat, ChatFrame, type ChatFrameProps, type ChatHostRefusalCodes, type ChatLayoutColumn, type ChatLayoutColumns, type ChatLayoutPlan, type ChatLayoutRule, type ChatListMessage, type ChatMarkdownConverterFactory, type ChatMediaRecorderLike, type ChatMediaStreamLike, type ChatMessageAuthor, ChatMessageList, type ChatMessageListLimits, type ChatMessageListProps, type ChatMessageText, type ChatMicrophone, type ChatMicrophoneProblem, type ChatMicrophoneScope, type ChatModelAttachmentFlags, type ChatModels, type ChatModelsOptions, type ChatModelsQuery, type ChatModelsState, type ChatNewConversation, type ChatNewConversationChoice, type ChatNewConversationChoiceOptions, ChatNewConversationChoices, type ChatNewConversationChoicesProps, type ChatNewConversationMessage, type ChatNewConversationOptions, type ChatNewConversationOutcome, type ChatOlderFailure, type ChatPinnedSide, type ChatRecording, type ChatRecordingListener, type ChatRecordingRequest, type ChatRecordingStart, type ChatRefusal, type ChatRefusalStatusClass, type ChatSend, type ChatSendMessage, type ChatSendOptions, type ChatSendOutcome, type ChatSettingsAccess, ChatSettingsForm, type ChatSettingsFormProps, ChatSettingsGate, type ChatSettingsGateProps, type ChatSettingsOptions, type ChatSettingsProblem, type ChatSettingsSaveOutcome, type ChatSettingsState, ChatTalkFlow, type ChatTalkFlowProps, ChatTalkHeading, type ChatTalkHeadingProps, assertValidChatHostRefusalCodes, chatAttachmentHasUnreadText, chatAttachmentsRefusedByModel, chatBrowserMicrophone, chatDeclaredAttachmentKind, chatFilePickerAccept, chatFrameBlockSizePx, chatLayoutPlan, chatLayoutRule, chatModelAttachmentKinds, chatModelTakesKind, chatRefusal, diagramFileName, precheckChatAttachment, useChatComposerAttachments, useChatConversation, useChatConversationCreatedAnnouncer, useChatConversationList, useChatModels, useChatNewConversation, useChatNewConversationChoice, useChatSend, useChatSettings };
|