@agents24/chat-react 0.1.7 → 0.1.9
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/README.md +25 -12
- package/dist/chunk-E3TJ3I6G.js +358 -0
- package/dist/chunk-E3TJ3I6G.js.map +1 -0
- package/dist/chunk-EWZO4QJI.js +140 -0
- package/dist/chunk-EWZO4QJI.js.map +1 -0
- package/dist/chunk-UU7OXHL3.js +11 -0
- package/dist/chunk-UU7OXHL3.js.map +1 -0
- package/dist/context-window.d.ts +38 -0
- package/dist/controller.d.ts +22 -0
- package/dist/index.cjs +392 -314
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -530
- package/dist/index.js +41 -439
- package/dist/index.js.map +1 -1
- package/dist/latest-thread-scroller.d.ts +54 -0
- package/dist/model.d.ts +29 -0
- package/dist/renderers.d.ts +10 -0
- package/dist/sse.d.ts +3 -0
- package/dist/streaming-text.d.ts +24 -0
- package/dist/templates/agent-chat-shell.d.ts +25 -0
- package/dist/templates/index.cjs +523 -0
- package/dist/templates/index.cjs.map +1 -0
- package/dist/templates/index.d.ts +1 -0
- package/dist/templates/index.js +140 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/transport.d.ts +29 -0
- package/dist/types.d.ts +312 -0
- package/dist/ui/adapters.d.ts +36 -0
- package/dist/ui/attachment.d.ts +23 -0
- package/dist/ui/bubble.d.ts +17 -0
- package/dist/ui/index.cjs +943 -0
- package/dist/ui/index.cjs.map +1 -0
- package/dist/ui/index.d.ts +7 -0
- package/dist/ui/index.js +734 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/marker.d.ts +11 -0
- package/dist/ui/message-response.d.ts +7 -0
- package/dist/ui/message.d.ts +10 -0
- package/dist/ui/utils.d.ts +2 -0
- package/dist/viewport.d.ts +2 -0
- package/package.json +22 -4
- package/dist/index.d.cts +0 -530
package/dist/index.d.cts
DELETED
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
|
-
import { ReactNode, RefObject, UIEvent, WheelEvent, KeyboardEvent, TouchEvent } from 'react';
|
|
3
|
-
|
|
4
|
-
type ContextWindowSource = "exact" | "estimated" | "provider_count_api" | "provider_usage" | "runtime_tokenizer" | "hf_tokenizer" | "multimodal_estimate" | "text_estimate" | "tokenizer_estimate" | "heuristic_estimate" | "unknown";
|
|
5
|
-
type ContextWindowStage = "preflight" | "sent_prompt" | "final_usage";
|
|
6
|
-
type ContextWindowConfidence = "exact" | "high" | "medium" | "low" | "unknown";
|
|
7
|
-
type ContextCompressionStatus = {
|
|
8
|
-
active: boolean;
|
|
9
|
-
reason?: string | null;
|
|
10
|
-
input_tokens?: number | null;
|
|
11
|
-
max_tokens?: number | null;
|
|
12
|
-
usage_ratio?: number | null;
|
|
13
|
-
full_frame_count?: number | null;
|
|
14
|
-
compact_frame_count?: number | null;
|
|
15
|
-
dropped_frame_count?: number | null;
|
|
16
|
-
artifact_ref_count?: number | null;
|
|
17
|
-
compression_trigger_budget?: number | null;
|
|
18
|
-
compression_target_budget?: number | null;
|
|
19
|
-
compression_target_ratio?: number | null;
|
|
20
|
-
threshold_used?: number | null;
|
|
21
|
-
};
|
|
22
|
-
type ContextWindow = {
|
|
23
|
-
source: ContextWindowSource;
|
|
24
|
-
run_id?: string | null;
|
|
25
|
-
stage?: ContextWindowStage | null;
|
|
26
|
-
confidence?: ContextWindowConfidence | null;
|
|
27
|
-
counter?: string | null;
|
|
28
|
-
model_id?: string | null;
|
|
29
|
-
max_tokens?: number | null;
|
|
30
|
-
max_tokens_source?: string | null;
|
|
31
|
-
input_tokens?: number | null;
|
|
32
|
-
remaining_tokens?: number | null;
|
|
33
|
-
usage_ratio?: number | null;
|
|
34
|
-
assembly?: Record<string, unknown> | null;
|
|
35
|
-
context_compression?: ContextCompressionStatus | null;
|
|
36
|
-
};
|
|
37
|
-
declare function normalizeContextCompression(value: unknown): ContextCompressionStatus | null;
|
|
38
|
-
declare function normalizeContextWindow(value: unknown): ContextWindow | null;
|
|
39
|
-
declare function mergeContextWindow(current: ContextWindow | null | undefined, incoming: ContextWindow | null | undefined): ContextWindow | null;
|
|
40
|
-
declare function mergeContextWindowUpdate(current: ContextWindow | null | undefined, incoming: unknown): ContextWindow | null;
|
|
41
|
-
declare function compressionFromContextWindow(contextWindow: ContextWindow | null | undefined): ContextCompressionStatus | null;
|
|
42
|
-
|
|
43
|
-
type ChatRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed" | string;
|
|
44
|
-
type ChatContextWindow = ContextWindow;
|
|
45
|
-
type ChatCitation = {
|
|
46
|
-
title: string;
|
|
47
|
-
url: string;
|
|
48
|
-
description: string;
|
|
49
|
-
sourceRef?: string;
|
|
50
|
-
ref?: string;
|
|
51
|
-
firstRef?: string;
|
|
52
|
-
totalSegments?: number;
|
|
53
|
-
rangeRef?: string;
|
|
54
|
-
};
|
|
55
|
-
type ChatAttachment = {
|
|
56
|
-
url?: string;
|
|
57
|
-
filename?: string;
|
|
58
|
-
mediaType?: string;
|
|
59
|
-
contentType?: string;
|
|
60
|
-
[key: string]: unknown;
|
|
61
|
-
};
|
|
62
|
-
type ChatReasoningStep = {
|
|
63
|
-
label: string;
|
|
64
|
-
status: "active" | "complete" | "pending";
|
|
65
|
-
icon?: unknown;
|
|
66
|
-
description?: string;
|
|
67
|
-
citations?: ChatCitation[];
|
|
68
|
-
query?: string;
|
|
69
|
-
sources?: Array<Record<string, unknown>>;
|
|
70
|
-
};
|
|
71
|
-
type ChatToolState = "input-streaming" | "input-available" | "output-available" | "output-error" | "cancelled";
|
|
72
|
-
type ToolPresentation = {
|
|
73
|
-
title?: string | null;
|
|
74
|
-
activity?: string | null;
|
|
75
|
-
detail?: string | null;
|
|
76
|
-
category?: string | null;
|
|
77
|
-
groupKey?: string | null;
|
|
78
|
-
groupLabel?: string | null;
|
|
79
|
-
showOutput?: boolean;
|
|
80
|
-
outputView?: Record<string, unknown> | null;
|
|
81
|
-
[key: string]: unknown;
|
|
82
|
-
};
|
|
83
|
-
type ChatTextPart = {
|
|
84
|
-
id: string;
|
|
85
|
-
type: "text";
|
|
86
|
-
kind: "text";
|
|
87
|
-
text: string;
|
|
88
|
-
raw?: Record<string, unknown>;
|
|
89
|
-
};
|
|
90
|
-
type ChatToolPart = {
|
|
91
|
-
id: string;
|
|
92
|
-
type: `tool-${string}`;
|
|
93
|
-
kind: "tool";
|
|
94
|
-
toolName: string;
|
|
95
|
-
toolCallId?: string | null;
|
|
96
|
-
state: ChatToolState;
|
|
97
|
-
input?: unknown;
|
|
98
|
-
output?: unknown;
|
|
99
|
-
errorText?: string | null;
|
|
100
|
-
presentation?: ToolPresentation | null;
|
|
101
|
-
raw: Record<string, unknown>;
|
|
102
|
-
};
|
|
103
|
-
type ChatReasoningPart = {
|
|
104
|
-
id: string;
|
|
105
|
-
type: "reasoning";
|
|
106
|
-
kind: "reasoning";
|
|
107
|
-
label?: string | null;
|
|
108
|
-
text?: string | null;
|
|
109
|
-
status?: string | null;
|
|
110
|
-
raw: Record<string, unknown>;
|
|
111
|
-
};
|
|
112
|
-
type ChatUiBlocksPart = {
|
|
113
|
-
id: string;
|
|
114
|
-
type: "ui-blocks";
|
|
115
|
-
kind: "ui-blocks";
|
|
116
|
-
state: ChatToolState;
|
|
117
|
-
toolCallId?: string | null;
|
|
118
|
-
contractVersion?: string | null;
|
|
119
|
-
bundle?: Record<string, unknown> | null;
|
|
120
|
-
errorText?: string | null;
|
|
121
|
-
raw: Record<string, unknown>;
|
|
122
|
-
};
|
|
123
|
-
type ChatApprovalPart = {
|
|
124
|
-
id: string;
|
|
125
|
-
type: "approval";
|
|
126
|
-
kind: "approval";
|
|
127
|
-
raw: Record<string, unknown>;
|
|
128
|
-
};
|
|
129
|
-
type ChatErrorPart = {
|
|
130
|
-
id: string;
|
|
131
|
-
type: "error";
|
|
132
|
-
kind: "error";
|
|
133
|
-
errorText: string;
|
|
134
|
-
raw: Record<string, unknown>;
|
|
135
|
-
};
|
|
136
|
-
type ChatDataPart = {
|
|
137
|
-
id: string;
|
|
138
|
-
type: "data";
|
|
139
|
-
kind: "data";
|
|
140
|
-
name: string;
|
|
141
|
-
data: Record<string, unknown>;
|
|
142
|
-
raw: Record<string, unknown>;
|
|
143
|
-
};
|
|
144
|
-
type ChatPart = ChatTextPart | ChatToolPart | ChatReasoningPart | ChatUiBlocksPart | ChatApprovalPart | ChatErrorPart | ChatDataPart;
|
|
145
|
-
type ToolRenderer = (props: {
|
|
146
|
-
part: ChatToolPart;
|
|
147
|
-
message: ChatMessage;
|
|
148
|
-
}) => ReactNode;
|
|
149
|
-
type Agents24ChatRenderOptions = {
|
|
150
|
-
renderPart?: (part: ChatPart, message: ChatMessage) => ReactNode;
|
|
151
|
-
toolRenderers?: Partial<Record<`tool-${string}`, ToolRenderer>>;
|
|
152
|
-
fallbackToolRenderer?: ToolRenderer;
|
|
153
|
-
};
|
|
154
|
-
type ChatMessage = {
|
|
155
|
-
id: string;
|
|
156
|
-
role: "user" | "assistant";
|
|
157
|
-
runId?: string | null;
|
|
158
|
-
content: string;
|
|
159
|
-
createdAt: Date;
|
|
160
|
-
isFinal?: boolean;
|
|
161
|
-
parts: ChatPart[];
|
|
162
|
-
attachments?: ChatAttachment[];
|
|
163
|
-
citations?: ChatCitation[];
|
|
164
|
-
reasoningSteps?: ChatReasoningStep[];
|
|
165
|
-
thinkingDurationMs?: number;
|
|
166
|
-
liked?: boolean;
|
|
167
|
-
disliked?: boolean;
|
|
168
|
-
messageIndex?: number;
|
|
169
|
-
isVoice?: boolean;
|
|
170
|
-
tokenUsage?: {
|
|
171
|
-
inputTokens?: number | null;
|
|
172
|
-
outputTokens?: number | null;
|
|
173
|
-
totalTokens?: number | null;
|
|
174
|
-
usageSource?: string | null;
|
|
175
|
-
};
|
|
176
|
-
};
|
|
177
|
-
type ChatRuntimeEvent = {
|
|
178
|
-
version?: string;
|
|
179
|
-
seq?: number;
|
|
180
|
-
ts?: string;
|
|
181
|
-
event: string;
|
|
182
|
-
run_id?: string;
|
|
183
|
-
stage?: string;
|
|
184
|
-
payload?: Record<string, unknown>;
|
|
185
|
-
diagnostics?: Array<Record<string, unknown>>;
|
|
186
|
-
};
|
|
187
|
-
type ChatActiveRun = {
|
|
188
|
-
run_id?: string | null;
|
|
189
|
-
status?: string | null;
|
|
190
|
-
started_at?: string | null;
|
|
191
|
-
created_at?: string | null;
|
|
192
|
-
};
|
|
193
|
-
type ChatThreadSummary = {
|
|
194
|
-
id: string;
|
|
195
|
-
title?: string | null;
|
|
196
|
-
status?: string | null;
|
|
197
|
-
surface?: string | null;
|
|
198
|
-
agent_id?: string | null;
|
|
199
|
-
last_run_id?: string | null;
|
|
200
|
-
last_run_status?: string | null;
|
|
201
|
-
active_run?: ChatActiveRun | null;
|
|
202
|
-
activeRun?: ChatActiveRun | null;
|
|
203
|
-
updated_at?: string | null;
|
|
204
|
-
last_activity_at?: string | null;
|
|
205
|
-
created_at?: string | null;
|
|
206
|
-
messages?: ChatMessage[];
|
|
207
|
-
isHydrated?: boolean;
|
|
208
|
-
hasOlderTurns?: boolean;
|
|
209
|
-
nextBeforeTurnIndex?: number | null;
|
|
210
|
-
lastRunId?: string | null;
|
|
211
|
-
lastRunStatus?: string | null;
|
|
212
|
-
lastEventSeq?: number | null;
|
|
213
|
-
isRunning?: boolean;
|
|
214
|
-
[key: string]: unknown;
|
|
215
|
-
};
|
|
216
|
-
type ChatThreadTurn = {
|
|
217
|
-
id?: string;
|
|
218
|
-
run_id?: string;
|
|
219
|
-
turn_index?: number;
|
|
220
|
-
status?: string | null;
|
|
221
|
-
user_input_text?: string | null;
|
|
222
|
-
assistant_output_text?: string | null;
|
|
223
|
-
final_output?: unknown;
|
|
224
|
-
response_blocks?: Array<Record<string, unknown>>;
|
|
225
|
-
run_events?: ChatRuntimeEvent[];
|
|
226
|
-
context_window?: unknown;
|
|
227
|
-
run_usage?: {
|
|
228
|
-
source?: string | null;
|
|
229
|
-
input_tokens?: number | null;
|
|
230
|
-
output_tokens?: number | null;
|
|
231
|
-
total_tokens?: number | null;
|
|
232
|
-
} | null;
|
|
233
|
-
attachments?: Array<Record<string, unknown>>;
|
|
234
|
-
created_at?: string | null;
|
|
235
|
-
completed_at?: string | null;
|
|
236
|
-
};
|
|
237
|
-
type ChatThreadDetail = ChatThreadSummary & {
|
|
238
|
-
turns?: ChatThreadTurn[];
|
|
239
|
-
context_window?: unknown;
|
|
240
|
-
paging?: {
|
|
241
|
-
has_more?: boolean;
|
|
242
|
-
next_before_turn_index?: number | null;
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
type ChatSubmitInput = {
|
|
246
|
-
text: string;
|
|
247
|
-
threadId?: string | null;
|
|
248
|
-
files?: ChatAttachment[];
|
|
249
|
-
signal?: AbortSignal;
|
|
250
|
-
state?: Record<string, unknown>;
|
|
251
|
-
[key: string]: unknown;
|
|
252
|
-
};
|
|
253
|
-
type ChatSubmitMessage = {
|
|
254
|
-
text: string;
|
|
255
|
-
files?: ChatAttachment[];
|
|
256
|
-
state?: Record<string, unknown>;
|
|
257
|
-
[key: string]: unknown;
|
|
258
|
-
};
|
|
259
|
-
type ChatTransport = {
|
|
260
|
-
listThreads: (input?: {
|
|
261
|
-
signal?: AbortSignal;
|
|
262
|
-
}) => Promise<{
|
|
263
|
-
items: ChatThreadSummary[];
|
|
264
|
-
total?: number;
|
|
265
|
-
}>;
|
|
266
|
-
getThread: (input: {
|
|
267
|
-
threadId: string;
|
|
268
|
-
limit?: number;
|
|
269
|
-
beforeTurnIndex?: number | null;
|
|
270
|
-
includeRunEvents?: boolean;
|
|
271
|
-
signal?: AbortSignal;
|
|
272
|
-
}) => Promise<ChatThreadDetail>;
|
|
273
|
-
streamMessage: (input: ChatSubmitInput, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
|
|
274
|
-
attachRun: (input: {
|
|
275
|
-
runId: string;
|
|
276
|
-
signal?: AbortSignal;
|
|
277
|
-
}, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
|
|
278
|
-
cancelRun: (input: {
|
|
279
|
-
runId: string;
|
|
280
|
-
assistantOutputText?: string;
|
|
281
|
-
}) => Promise<{
|
|
282
|
-
run_id?: string;
|
|
283
|
-
status?: string;
|
|
284
|
-
}>;
|
|
285
|
-
deleteThread?: (input: {
|
|
286
|
-
threadId: string;
|
|
287
|
-
}) => Promise<{
|
|
288
|
-
deleted?: boolean;
|
|
289
|
-
}>;
|
|
290
|
-
uploadAttachment?: (input: {
|
|
291
|
-
file: File;
|
|
292
|
-
signal?: AbortSignal;
|
|
293
|
-
}) => Promise<ChatAttachment>;
|
|
294
|
-
};
|
|
295
|
-
type ChatStreamResult = {
|
|
296
|
-
threadId?: string | null;
|
|
297
|
-
runId?: string | null;
|
|
298
|
-
};
|
|
299
|
-
type StoredChatThread = ChatThreadSummary & {
|
|
300
|
-
messages: ChatMessage[];
|
|
301
|
-
isHydrated?: boolean;
|
|
302
|
-
hasOlderTurns?: boolean;
|
|
303
|
-
nextBeforeTurnIndex?: number | null;
|
|
304
|
-
};
|
|
305
|
-
type ChatStorageAdapter = {
|
|
306
|
-
listThreads: () => StoredChatThread[];
|
|
307
|
-
setThreads: (threads: StoredChatThread[]) => void;
|
|
308
|
-
getThread: (threadId: string) => StoredChatThread | undefined;
|
|
309
|
-
upsertThread: (thread: StoredChatThread) => void;
|
|
310
|
-
deleteThread?: (threadId: string) => void;
|
|
311
|
-
getActiveThreadId?: () => string | null;
|
|
312
|
-
setActiveThreadId?: (threadId: string | null) => void;
|
|
313
|
-
};
|
|
314
|
-
type ChatController = {
|
|
315
|
-
threads: StoredChatThread[];
|
|
316
|
-
activeThreadId: string | null;
|
|
317
|
-
activeThread: StoredChatThread | null;
|
|
318
|
-
messages: ChatMessage[];
|
|
319
|
-
streamingContent: string;
|
|
320
|
-
streamingMessageId: string | null;
|
|
321
|
-
contextStatus: ChatContextWindow | null;
|
|
322
|
-
currentReasoning: ChatReasoningStep[];
|
|
323
|
-
isLoading: boolean;
|
|
324
|
-
isLoadingHistory: boolean;
|
|
325
|
-
isLoadingOlder: boolean;
|
|
326
|
-
isRefreshingThreads: boolean;
|
|
327
|
-
hasOlderTurns: boolean;
|
|
328
|
-
liked: Record<string, boolean>;
|
|
329
|
-
disliked: Record<string, boolean>;
|
|
330
|
-
copiedMessageId: string | null;
|
|
331
|
-
lastThinkingDurationMs: number | null;
|
|
332
|
-
activeRunId: string | null;
|
|
333
|
-
handleSubmit: (message: ChatSubmitMessage) => Promise<void>;
|
|
334
|
-
handleStop: () => void;
|
|
335
|
-
handleCopy: (content: string, messageId: string) => void;
|
|
336
|
-
handleLike: (msg: ChatMessage) => Promise<void>;
|
|
337
|
-
handleDislike: (msg: ChatMessage) => Promise<void>;
|
|
338
|
-
handleRetry: (msg: ChatMessage) => Promise<void>;
|
|
339
|
-
handleSourceClick: (citations: ChatMessage["citations"]) => void;
|
|
340
|
-
upsertLiveVoiceMessage: (input: {
|
|
341
|
-
role: "user" | "assistant";
|
|
342
|
-
content: string;
|
|
343
|
-
isFinal?: boolean;
|
|
344
|
-
citations?: ChatCitation[];
|
|
345
|
-
reasoningSteps?: ChatReasoningStep[];
|
|
346
|
-
}) => void;
|
|
347
|
-
startNewThread: () => void;
|
|
348
|
-
loadThreadById: (threadId: string) => Promise<void>;
|
|
349
|
-
loadOlderTurns: () => Promise<void>;
|
|
350
|
-
refresh: () => Promise<void>;
|
|
351
|
-
textareaRef: RefObject<HTMLTextAreaElement | null>;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
type ChatRuntimeEventContext = {
|
|
355
|
-
mode: "submit" | "attach";
|
|
356
|
-
assistantMessageId: string;
|
|
357
|
-
threadId: string | null;
|
|
358
|
-
runId: string | null;
|
|
359
|
-
startedAt: number;
|
|
360
|
-
};
|
|
361
|
-
type UseAgents24ChatControllerOptions = {
|
|
362
|
-
transport: ChatTransport;
|
|
363
|
-
storage: ChatStorageAdapter;
|
|
364
|
-
activeThreadId?: string | null;
|
|
365
|
-
pageSize?: number;
|
|
366
|
-
storageKey?: unknown;
|
|
367
|
-
createId?: () => string;
|
|
368
|
-
onActiveThreadIdChange?: (threadId: string | null) => void;
|
|
369
|
-
onSourceClick?: (citations: ChatMessage["citations"]) => void;
|
|
370
|
-
onStreamErrorMessage?: (error: unknown) => string;
|
|
371
|
-
onRuntimeEvent?: (event: ChatRuntimeEvent, context: ChatRuntimeEventContext) => void | Promise<void>;
|
|
372
|
-
onThreadDetailLoaded?: (detail: unknown) => void | Promise<void>;
|
|
373
|
-
};
|
|
374
|
-
declare function useAgents24ChatController({ transport, storage, activeThreadId: controlledActiveThreadId, pageSize, storageKey, createId, onActiveThreadIdChange, onSourceClick, onStreamErrorMessage, onRuntimeEvent, onThreadDetailLoaded, }: UseAgents24ChatControllerOptions): ChatController;
|
|
375
|
-
|
|
376
|
-
declare const DEFAULT_THREAD_PAGE_SIZE = 5;
|
|
377
|
-
declare const isRunningThreadStatus: (status?: string | null) => boolean;
|
|
378
|
-
declare const createChatId: () => string;
|
|
379
|
-
declare const titleFromMessage: (text: string, files?: Array<{
|
|
380
|
-
filename?: string;
|
|
381
|
-
}>) => string;
|
|
382
|
-
declare const threadActivityDate: (thread: ChatThreadSummary) => string;
|
|
383
|
-
declare const assistantTextFromResponseBlocks: (blocks?: Array<Record<string, unknown>>) => string;
|
|
384
|
-
declare const assistantTextFromParts: (parts?: ChatPart[]) => string;
|
|
385
|
-
declare const textFromFinalOutput: (value: unknown) => string;
|
|
386
|
-
declare const toolStateFromStatus: (status?: unknown) => ChatToolState;
|
|
387
|
-
declare const partsFromResponseBlocks: (blocks?: Array<Record<string, unknown>>, fallbackText?: string) => ChatPart[];
|
|
388
|
-
declare const mergeReasoningSteps: (steps?: ChatReasoningStep[], options?: {
|
|
389
|
-
finalize?: boolean;
|
|
390
|
-
}) => ChatReasoningStep[];
|
|
391
|
-
declare const reasoningStepsFromParts: (parts?: ChatPart[]) => ChatReasoningStep[];
|
|
392
|
-
declare const threadDetailToMessages: (thread: ChatThreadDetail) => ChatMessage[];
|
|
393
|
-
declare const threadPaging: (thread: ChatThreadDetail) => {
|
|
394
|
-
hasOlderTurns: boolean;
|
|
395
|
-
nextBeforeTurnIndex: number | null;
|
|
396
|
-
};
|
|
397
|
-
declare const latestContextWindowFromThread: (thread: ChatThreadDetail) => ChatContextWindow | null;
|
|
398
|
-
declare const activeRunIdFromThread: (thread?: Partial<ChatThreadSummary> | null) => string | null;
|
|
399
|
-
declare const hasUnfinishedAssistantMessage: (messages?: ChatMessage[]) => boolean;
|
|
400
|
-
declare const hasStaleUnfinishedAssistantCache: (thread?: (Partial<ChatThreadSummary> & {
|
|
401
|
-
messages?: ChatMessage[];
|
|
402
|
-
}) | null) => boolean;
|
|
403
|
-
declare const activeRunIdFromThreadDetail: (thread?: ChatThreadDetail | null) => string | null;
|
|
404
|
-
|
|
405
|
-
declare const DefaultToolPart: ({ part }: {
|
|
406
|
-
part: ChatToolPart;
|
|
407
|
-
}) => react.JSX.Element;
|
|
408
|
-
declare const DefaultChatPart: ({ part, message, renderOptions, }: {
|
|
409
|
-
part: ChatPart;
|
|
410
|
-
message: ChatMessage;
|
|
411
|
-
renderOptions?: Agents24ChatRenderOptions;
|
|
412
|
-
}) => react.JSX.Element;
|
|
413
|
-
declare const renderChatPart: (part: ChatPart, message: ChatMessage, renderOptions?: Agents24ChatRenderOptions) => react.JSX.Element;
|
|
414
|
-
|
|
415
|
-
declare const parseSseBlock: (block: string) => ChatRuntimeEvent | null;
|
|
416
|
-
declare const consumeSseResponse: (response: Response, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
|
|
417
|
-
|
|
418
|
-
type StreamingTextMode = "streaming" | "static";
|
|
419
|
-
type StreamingTextCache = {
|
|
420
|
-
get: (id: string) => string | undefined;
|
|
421
|
-
set: (id: string, text: string) => void;
|
|
422
|
-
};
|
|
423
|
-
type UseStreamingTextOptions = {
|
|
424
|
-
id: string;
|
|
425
|
-
isStreaming: boolean;
|
|
426
|
-
text: string;
|
|
427
|
-
cache?: StreamingTextCache | false;
|
|
428
|
-
charsPerSecond?: number;
|
|
429
|
-
catchupThreshold?: number;
|
|
430
|
-
maxCatchupChars?: number;
|
|
431
|
-
};
|
|
432
|
-
type UseStreamingTextResult = {
|
|
433
|
-
displayedText: string;
|
|
434
|
-
isAnimating: boolean;
|
|
435
|
-
mode: StreamingTextMode;
|
|
436
|
-
parseIncompleteMarkdown: boolean;
|
|
437
|
-
};
|
|
438
|
-
declare const getActiveStreamingTextPartId: (message: ChatMessage, streamingMessageId: string | null) => string | null;
|
|
439
|
-
declare const isActiveStreamingTextPart: (message: ChatMessage, part: ChatPart, streamingMessageId: string | null) => boolean;
|
|
440
|
-
declare function useStreamingText({ id, isStreaming, text, cache, charsPerSecond, catchupThreshold, maxCatchupChars, }: UseStreamingTextOptions): UseStreamingTextResult;
|
|
441
|
-
|
|
442
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
443
|
-
type FetchChatTransportRoutes = {
|
|
444
|
-
listThreads: () => string;
|
|
445
|
-
getThread: (input: {
|
|
446
|
-
threadId: string;
|
|
447
|
-
limit?: number;
|
|
448
|
-
beforeTurnIndex?: number | null;
|
|
449
|
-
includeRunEvents?: boolean;
|
|
450
|
-
}) => string;
|
|
451
|
-
streamMessage: () => string;
|
|
452
|
-
attachRun: (input: {
|
|
453
|
-
runId: string;
|
|
454
|
-
}) => string;
|
|
455
|
-
cancelRun: (input: {
|
|
456
|
-
runId: string;
|
|
457
|
-
}) => string;
|
|
458
|
-
deleteThread?: (input: {
|
|
459
|
-
threadId: string;
|
|
460
|
-
}) => string;
|
|
461
|
-
};
|
|
462
|
-
type FetchChatTransportOptions = {
|
|
463
|
-
routes: FetchChatTransportRoutes;
|
|
464
|
-
fetchImpl?: typeof fetch;
|
|
465
|
-
headers?: () => MaybePromise<HeadersInit>;
|
|
466
|
-
streamBody?: (input: ChatSubmitInput) => unknown;
|
|
467
|
-
};
|
|
468
|
-
declare const createFetchChatTransport: ({ routes, fetchImpl, headers, streamBody, }: FetchChatTransportOptions) => ChatTransport;
|
|
469
|
-
|
|
470
|
-
type LatestFollowState = "following" | "detached";
|
|
471
|
-
declare const isScrollable: (element: Pick<HTMLDivElement, "scrollHeight" | "clientHeight">) => boolean;
|
|
472
|
-
declare const isAtTimelineLatestEdge: (element: Pick<HTMLDivElement, "scrollHeight" | "clientHeight" | "scrollTop">, isTopOrigin: boolean) => boolean;
|
|
473
|
-
declare const shouldPrefetchOlder: (element: Pick<HTMLDivElement, "scrollHeight" | "clientHeight" | "scrollTop">) => boolean;
|
|
474
|
-
declare const getLatestScrollTop: (element: Pick<HTMLDivElement, "scrollHeight" | "clientHeight">, isTopOrigin: boolean) => number;
|
|
475
|
-
declare const shouldUseTopOriginTimeline: ({ hasOlder, itemCount, topOriginMaxItems, }: {
|
|
476
|
-
hasOlder: boolean;
|
|
477
|
-
itemCount: number;
|
|
478
|
-
topOriginMaxItems?: number;
|
|
479
|
-
}) => boolean;
|
|
480
|
-
declare const nextLatestFollowStateOnScroll: ({ atLatest, current, isProgrammatic, }: {
|
|
481
|
-
atLatest: boolean;
|
|
482
|
-
current: LatestFollowState;
|
|
483
|
-
isProgrammatic: boolean;
|
|
484
|
-
}) => LatestFollowState;
|
|
485
|
-
type LatestThreadViewportUserScrollIntent = Pick<WheelEvent<HTMLDivElement>, "deltaY"> | Pick<KeyboardEvent<HTMLDivElement>, "key" | "shiftKey"> | Pick<TouchEvent<HTMLDivElement>, "touches"> | null | undefined;
|
|
486
|
-
declare const isUserScrollIntentAwayFromLatest: (intent?: LatestThreadViewportUserScrollIntent) => boolean;
|
|
487
|
-
type UseLatestThreadViewportOptions = {
|
|
488
|
-
itemCount: number;
|
|
489
|
-
hasOlder: boolean;
|
|
490
|
-
isLoadingOlder: boolean;
|
|
491
|
-
onLoadOlder: () => Promise<void> | void;
|
|
492
|
-
activeStreamKey?: string | null;
|
|
493
|
-
shouldAutoFollow?: boolean;
|
|
494
|
-
topOriginMaxItems?: number;
|
|
495
|
-
};
|
|
496
|
-
type LatestThreadViewportState = {
|
|
497
|
-
scrollContainerRef: RefObject<HTMLDivElement | null>;
|
|
498
|
-
isAtLatest: boolean;
|
|
499
|
-
isFollowingLatest: boolean;
|
|
500
|
-
isTopOrigin: boolean;
|
|
501
|
-
shouldShowLatestButton: boolean;
|
|
502
|
-
handleScroll: (event: UIEvent<HTMLDivElement>) => void;
|
|
503
|
-
handleUserScrollIntent: (intent?: LatestThreadViewportUserScrollIntent) => void;
|
|
504
|
-
scrollToLatest: (options?: {
|
|
505
|
-
reattach?: boolean;
|
|
506
|
-
}) => void;
|
|
507
|
-
detachFromLatest: () => void;
|
|
508
|
-
reattachToLatest: () => void;
|
|
509
|
-
preserveIntrinsicResize: () => void;
|
|
510
|
-
};
|
|
511
|
-
declare function useLatestThreadViewport({ itemCount, hasOlder, isLoadingOlder, onLoadOlder, activeStreamKey, shouldAutoFollow, topOriginMaxItems, }: UseLatestThreadViewportOptions): LatestThreadViewportState;
|
|
512
|
-
type LatestThreadViewportRenderContext = {
|
|
513
|
-
preserveIntrinsicResize: () => void;
|
|
514
|
-
isFollowingLatest: boolean;
|
|
515
|
-
isTopOrigin: boolean;
|
|
516
|
-
};
|
|
517
|
-
type LatestThreadViewportProps<T> = {
|
|
518
|
-
items: T[];
|
|
519
|
-
hasOlder: boolean;
|
|
520
|
-
isLoadingOlder: boolean;
|
|
521
|
-
onLoadOlder: () => Promise<void> | void;
|
|
522
|
-
activeStreamKey?: string | null;
|
|
523
|
-
className?: string;
|
|
524
|
-
latestSpacer?: ReactNode;
|
|
525
|
-
trailingSpacer?: ReactNode;
|
|
526
|
-
renderItem: (item: T, context: LatestThreadViewportRenderContext) => ReactNode;
|
|
527
|
-
};
|
|
528
|
-
declare function LatestThreadViewport<T>({ items, hasOlder, isLoadingOlder, onLoadOlder, activeStreamKey, className, latestSpacer, trailingSpacer, renderItem, }: LatestThreadViewportProps<T>): react.JSX.Element;
|
|
529
|
-
|
|
530
|
-
export { type Agents24ChatRenderOptions, type ChatActiveRun, type ChatApprovalPart, type ChatAttachment, type ChatCitation, type ChatContextWindow, type ChatController, type ChatDataPart, type ChatErrorPart, type ChatMessage, type ChatPart, type ChatReasoningPart, type ChatReasoningStep, type ChatRunStatus, type ChatRuntimeEvent, type ChatRuntimeEventContext, type ChatStorageAdapter, type ChatStreamResult, type ChatSubmitInput, type ChatSubmitMessage, type ChatTextPart, type ChatThreadDetail, type ChatThreadSummary, type ChatThreadTurn, type ChatToolPart, type ChatToolState, type ChatTransport, type ChatUiBlocksPart, type ContextCompressionStatus, type ContextWindow, type ContextWindowConfidence, type ContextWindowSource, type ContextWindowStage, DEFAULT_THREAD_PAGE_SIZE, DefaultChatPart, DefaultToolPart, type FetchChatTransportOptions, type FetchChatTransportRoutes, type LatestFollowState, LatestThreadViewport, type LatestThreadViewportProps, type LatestThreadViewportRenderContext, type LatestThreadViewportState, type LatestThreadViewportUserScrollIntent, type StoredChatThread, type StreamingTextCache, type StreamingTextMode, type ToolPresentation, type ToolRenderer, type UseAgents24ChatControllerOptions, type UseLatestThreadViewportOptions, type UseStreamingTextOptions, type UseStreamingTextResult, activeRunIdFromThread, activeRunIdFromThreadDetail, assistantTextFromParts, assistantTextFromResponseBlocks, compressionFromContextWindow, consumeSseResponse, createChatId, createFetchChatTransport, getActiveStreamingTextPartId, getLatestScrollTop, hasStaleUnfinishedAssistantCache, hasUnfinishedAssistantMessage, isActiveStreamingTextPart, isAtTimelineLatestEdge, isRunningThreadStatus, isScrollable, isUserScrollIntentAwayFromLatest, latestContextWindowFromThread, mergeContextWindow, mergeContextWindowUpdate, mergeReasoningSteps, nextLatestFollowStateOnScroll, normalizeContextCompression, normalizeContextWindow, parseSseBlock, partsFromResponseBlocks, reasoningStepsFromParts, renderChatPart, shouldPrefetchOlder, shouldUseTopOriginTimeline, textFromFinalOutput, threadActivityDate, threadDetailToMessages, threadPaging, titleFromMessage, toolStateFromStatus, useAgents24ChatController, useLatestThreadViewport, useStreamingText };
|