@agents24/chat-react 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,14 +1,47 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, RefObject, UIEvent } 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;
3
42
 
4
43
  type ChatRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed" | string;
5
- type ChatContextWindow = {
6
- stage?: string;
7
- label?: string;
8
- usedTokens?: number;
9
- maxTokens?: number;
10
- [key: string]: unknown;
11
- };
44
+ type ChatContextWindow = ContextWindow;
12
45
  type ChatCitation = {
13
46
  title: string;
14
47
  url: string;
@@ -134,6 +167,12 @@ type ChatMessage = {
134
167
  disliked?: boolean;
135
168
  messageIndex?: number;
136
169
  isVoice?: boolean;
170
+ tokenUsage?: {
171
+ inputTokens?: number | null;
172
+ outputTokens?: number | null;
173
+ totalTokens?: number | null;
174
+ usageSource?: string | null;
175
+ };
137
176
  };
138
177
  type ChatRuntimeEvent = {
139
178
  version?: string;
@@ -185,6 +224,12 @@ type ChatThreadTurn = {
185
224
  response_blocks?: Array<Record<string, unknown>>;
186
225
  run_events?: ChatRuntimeEvent[];
187
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;
188
233
  attachments?: Array<Record<string, unknown>>;
189
234
  created_at?: string | null;
190
235
  completed_at?: string | null;
@@ -197,6 +242,20 @@ type ChatThreadDetail = ChatThreadSummary & {
197
242
  next_before_turn_index?: number | null;
198
243
  };
199
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
+ };
200
259
  type ChatTransport = {
201
260
  listThreads: (input?: {
202
261
  signal?: AbortSignal;
@@ -211,12 +270,7 @@ type ChatTransport = {
211
270
  includeRunEvents?: boolean;
212
271
  signal?: AbortSignal;
213
272
  }) => Promise<ChatThreadDetail>;
214
- streamMessage: (input: {
215
- text: string;
216
- threadId?: string | null;
217
- files?: ChatAttachment[];
218
- signal?: AbortSignal;
219
- }, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
273
+ streamMessage: (input: ChatSubmitInput, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
220
274
  attachRun: (input: {
221
275
  runId: string;
222
276
  signal?: AbortSignal;
@@ -258,6 +312,9 @@ type ChatStorageAdapter = {
258
312
  setActiveThreadId?: (threadId: string | null) => void;
259
313
  };
260
314
  type ChatController = {
315
+ threads: StoredChatThread[];
316
+ activeThreadId: string | null;
317
+ activeThread: StoredChatThread | null;
261
318
  messages: ChatMessage[];
262
319
  streamingContent: string;
263
320
  streamingMessageId: string | null;
@@ -266,16 +323,14 @@ type ChatController = {
266
323
  isLoading: boolean;
267
324
  isLoadingHistory: boolean;
268
325
  isLoadingOlder: boolean;
326
+ isRefreshingThreads: boolean;
269
327
  hasOlderTurns: boolean;
270
328
  liked: Record<string, boolean>;
271
329
  disliked: Record<string, boolean>;
272
330
  copiedMessageId: string | null;
273
331
  lastThinkingDurationMs: number | null;
274
332
  activeRunId: string | null;
275
- handleSubmit: (message: {
276
- text: string;
277
- files?: ChatAttachment[];
278
- }) => Promise<void>;
333
+ handleSubmit: (message: ChatSubmitMessage) => Promise<void>;
279
334
  handleStop: () => void;
280
335
  handleCopy: (content: string, messageId: string) => void;
281
336
  handleLike: (msg: ChatMessage) => Promise<void>;
@@ -289,11 +344,20 @@ type ChatController = {
289
344
  citations?: ChatCitation[];
290
345
  reasoningSteps?: ChatReasoningStep[];
291
346
  }) => void;
347
+ startNewThread: () => void;
348
+ loadThreadById: (threadId: string) => Promise<void>;
292
349
  loadOlderTurns: () => Promise<void>;
293
350
  refresh: () => Promise<void>;
294
351
  textareaRef: RefObject<HTMLTextAreaElement | null>;
295
352
  };
296
353
 
354
+ type ChatRuntimeEventContext = {
355
+ mode: "submit" | "attach";
356
+ assistantMessageId: string;
357
+ threadId: string | null;
358
+ runId: string | null;
359
+ startedAt: number;
360
+ };
297
361
  type UseAgents24ChatControllerOptions = {
298
362
  transport: ChatTransport;
299
363
  storage: ChatStorageAdapter;
@@ -304,8 +368,10 @@ type UseAgents24ChatControllerOptions = {
304
368
  onActiveThreadIdChange?: (threadId: string | null) => void;
305
369
  onSourceClick?: (citations: ChatMessage["citations"]) => void;
306
370
  onStreamErrorMessage?: (error: unknown) => string;
371
+ onRuntimeEvent?: (event: ChatRuntimeEvent, context: ChatRuntimeEventContext) => void | Promise<void>;
372
+ onThreadDetailLoaded?: (detail: unknown) => void | Promise<void>;
307
373
  };
308
- declare function useAgents24ChatController({ transport, storage, activeThreadId: controlledActiveThreadId, pageSize, storageKey, createId, onActiveThreadIdChange, onSourceClick, onStreamErrorMessage, }: UseAgents24ChatControllerOptions): ChatController;
374
+ declare function useAgents24ChatController({ transport, storage, activeThreadId: controlledActiveThreadId, pageSize, storageKey, createId, onActiveThreadIdChange, onSourceClick, onStreamErrorMessage, onRuntimeEvent, onThreadDetailLoaded, }: UseAgents24ChatControllerOptions): ChatController;
309
375
 
310
376
  declare const DEFAULT_THREAD_PAGE_SIZE = 5;
311
377
  declare const isRunningThreadStatus: (status?: string | null) => boolean;
@@ -397,11 +463,7 @@ type FetchChatTransportOptions = {
397
463
  routes: FetchChatTransportRoutes;
398
464
  fetchImpl?: typeof fetch;
399
465
  headers?: () => MaybePromise<HeadersInit>;
400
- streamBody?: (input: {
401
- text: string;
402
- threadId?: string | null;
403
- files?: ChatAttachment[];
404
- }) => unknown;
466
+ streamBody?: (input: ChatSubmitInput) => unknown;
405
467
  };
406
468
  declare const createFetchChatTransport: ({ routes, fetchImpl, headers, streamBody, }: FetchChatTransportOptions) => ChatTransport;
407
469
 
@@ -420,6 +482,8 @@ declare const nextLatestFollowStateOnScroll: ({ atLatest, current, isProgrammati
420
482
  current: LatestFollowState;
421
483
  isProgrammatic: boolean;
422
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;
423
487
  type UseLatestThreadViewportOptions = {
424
488
  itemCount: number;
425
489
  hasOlder: boolean;
@@ -436,7 +500,7 @@ type LatestThreadViewportState = {
436
500
  isTopOrigin: boolean;
437
501
  shouldShowLatestButton: boolean;
438
502
  handleScroll: (event: UIEvent<HTMLDivElement>) => void;
439
- handleUserScrollIntent: () => void;
503
+ handleUserScrollIntent: (intent?: LatestThreadViewportUserScrollIntent) => void;
440
504
  scrollToLatest: (options?: {
441
505
  reattach?: boolean;
442
506
  }) => void;
@@ -463,4 +527,4 @@ type LatestThreadViewportProps<T> = {
463
527
  };
464
528
  declare function LatestThreadViewport<T>({ items, hasOlder, isLoadingOlder, onLoadOlder, activeStreamKey, className, latestSpacer, trailingSpacer, renderItem, }: LatestThreadViewportProps<T>): react.JSX.Element;
465
529
 
466
- 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 ChatStorageAdapter, type ChatStreamResult, type ChatTextPart, type ChatThreadDetail, type ChatThreadSummary, type ChatThreadTurn, type ChatToolPart, type ChatToolState, type ChatTransport, type ChatUiBlocksPart, DEFAULT_THREAD_PAGE_SIZE, DefaultChatPart, DefaultToolPart, type FetchChatTransportOptions, type FetchChatTransportRoutes, type LatestFollowState, LatestThreadViewport, type LatestThreadViewportProps, type LatestThreadViewportRenderContext, type LatestThreadViewportState, type StoredChatThread, type StreamingTextCache, type StreamingTextMode, type ToolPresentation, type ToolRenderer, type UseAgents24ChatControllerOptions, type UseLatestThreadViewportOptions, type UseStreamingTextOptions, type UseStreamingTextResult, activeRunIdFromThread, activeRunIdFromThreadDetail, assistantTextFromParts, assistantTextFromResponseBlocks, consumeSseResponse, createChatId, createFetchChatTransport, getActiveStreamingTextPartId, getLatestScrollTop, hasStaleUnfinishedAssistantCache, hasUnfinishedAssistantMessage, isActiveStreamingTextPart, isAtTimelineLatestEdge, isRunningThreadStatus, isScrollable, latestContextWindowFromThread, mergeReasoningSteps, nextLatestFollowStateOnScroll, parseSseBlock, partsFromResponseBlocks, reasoningStepsFromParts, renderChatPart, shouldPrefetchOlder, shouldUseTopOriginTimeline, textFromFinalOutput, threadActivityDate, threadDetailToMessages, threadPaging, titleFromMessage, toolStateFromStatus, useAgents24ChatController, useLatestThreadViewport, useStreamingText };
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 };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,47 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, RefObject, UIEvent } 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;
3
42
 
4
43
  type ChatRunStatus = "queued" | "running" | "completed" | "cancelled" | "failed" | string;
5
- type ChatContextWindow = {
6
- stage?: string;
7
- label?: string;
8
- usedTokens?: number;
9
- maxTokens?: number;
10
- [key: string]: unknown;
11
- };
44
+ type ChatContextWindow = ContextWindow;
12
45
  type ChatCitation = {
13
46
  title: string;
14
47
  url: string;
@@ -134,6 +167,12 @@ type ChatMessage = {
134
167
  disliked?: boolean;
135
168
  messageIndex?: number;
136
169
  isVoice?: boolean;
170
+ tokenUsage?: {
171
+ inputTokens?: number | null;
172
+ outputTokens?: number | null;
173
+ totalTokens?: number | null;
174
+ usageSource?: string | null;
175
+ };
137
176
  };
138
177
  type ChatRuntimeEvent = {
139
178
  version?: string;
@@ -185,6 +224,12 @@ type ChatThreadTurn = {
185
224
  response_blocks?: Array<Record<string, unknown>>;
186
225
  run_events?: ChatRuntimeEvent[];
187
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;
188
233
  attachments?: Array<Record<string, unknown>>;
189
234
  created_at?: string | null;
190
235
  completed_at?: string | null;
@@ -197,6 +242,20 @@ type ChatThreadDetail = ChatThreadSummary & {
197
242
  next_before_turn_index?: number | null;
198
243
  };
199
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
+ };
200
259
  type ChatTransport = {
201
260
  listThreads: (input?: {
202
261
  signal?: AbortSignal;
@@ -211,12 +270,7 @@ type ChatTransport = {
211
270
  includeRunEvents?: boolean;
212
271
  signal?: AbortSignal;
213
272
  }) => Promise<ChatThreadDetail>;
214
- streamMessage: (input: {
215
- text: string;
216
- threadId?: string | null;
217
- files?: ChatAttachment[];
218
- signal?: AbortSignal;
219
- }, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
273
+ streamMessage: (input: ChatSubmitInput, onEvent: (event: ChatRuntimeEvent) => void | Promise<void>) => Promise<ChatStreamResult>;
220
274
  attachRun: (input: {
221
275
  runId: string;
222
276
  signal?: AbortSignal;
@@ -258,6 +312,9 @@ type ChatStorageAdapter = {
258
312
  setActiveThreadId?: (threadId: string | null) => void;
259
313
  };
260
314
  type ChatController = {
315
+ threads: StoredChatThread[];
316
+ activeThreadId: string | null;
317
+ activeThread: StoredChatThread | null;
261
318
  messages: ChatMessage[];
262
319
  streamingContent: string;
263
320
  streamingMessageId: string | null;
@@ -266,16 +323,14 @@ type ChatController = {
266
323
  isLoading: boolean;
267
324
  isLoadingHistory: boolean;
268
325
  isLoadingOlder: boolean;
326
+ isRefreshingThreads: boolean;
269
327
  hasOlderTurns: boolean;
270
328
  liked: Record<string, boolean>;
271
329
  disliked: Record<string, boolean>;
272
330
  copiedMessageId: string | null;
273
331
  lastThinkingDurationMs: number | null;
274
332
  activeRunId: string | null;
275
- handleSubmit: (message: {
276
- text: string;
277
- files?: ChatAttachment[];
278
- }) => Promise<void>;
333
+ handleSubmit: (message: ChatSubmitMessage) => Promise<void>;
279
334
  handleStop: () => void;
280
335
  handleCopy: (content: string, messageId: string) => void;
281
336
  handleLike: (msg: ChatMessage) => Promise<void>;
@@ -289,11 +344,20 @@ type ChatController = {
289
344
  citations?: ChatCitation[];
290
345
  reasoningSteps?: ChatReasoningStep[];
291
346
  }) => void;
347
+ startNewThread: () => void;
348
+ loadThreadById: (threadId: string) => Promise<void>;
292
349
  loadOlderTurns: () => Promise<void>;
293
350
  refresh: () => Promise<void>;
294
351
  textareaRef: RefObject<HTMLTextAreaElement | null>;
295
352
  };
296
353
 
354
+ type ChatRuntimeEventContext = {
355
+ mode: "submit" | "attach";
356
+ assistantMessageId: string;
357
+ threadId: string | null;
358
+ runId: string | null;
359
+ startedAt: number;
360
+ };
297
361
  type UseAgents24ChatControllerOptions = {
298
362
  transport: ChatTransport;
299
363
  storage: ChatStorageAdapter;
@@ -304,8 +368,10 @@ type UseAgents24ChatControllerOptions = {
304
368
  onActiveThreadIdChange?: (threadId: string | null) => void;
305
369
  onSourceClick?: (citations: ChatMessage["citations"]) => void;
306
370
  onStreamErrorMessage?: (error: unknown) => string;
371
+ onRuntimeEvent?: (event: ChatRuntimeEvent, context: ChatRuntimeEventContext) => void | Promise<void>;
372
+ onThreadDetailLoaded?: (detail: unknown) => void | Promise<void>;
307
373
  };
308
- declare function useAgents24ChatController({ transport, storage, activeThreadId: controlledActiveThreadId, pageSize, storageKey, createId, onActiveThreadIdChange, onSourceClick, onStreamErrorMessage, }: UseAgents24ChatControllerOptions): ChatController;
374
+ declare function useAgents24ChatController({ transport, storage, activeThreadId: controlledActiveThreadId, pageSize, storageKey, createId, onActiveThreadIdChange, onSourceClick, onStreamErrorMessage, onRuntimeEvent, onThreadDetailLoaded, }: UseAgents24ChatControllerOptions): ChatController;
309
375
 
310
376
  declare const DEFAULT_THREAD_PAGE_SIZE = 5;
311
377
  declare const isRunningThreadStatus: (status?: string | null) => boolean;
@@ -397,11 +463,7 @@ type FetchChatTransportOptions = {
397
463
  routes: FetchChatTransportRoutes;
398
464
  fetchImpl?: typeof fetch;
399
465
  headers?: () => MaybePromise<HeadersInit>;
400
- streamBody?: (input: {
401
- text: string;
402
- threadId?: string | null;
403
- files?: ChatAttachment[];
404
- }) => unknown;
466
+ streamBody?: (input: ChatSubmitInput) => unknown;
405
467
  };
406
468
  declare const createFetchChatTransport: ({ routes, fetchImpl, headers, streamBody, }: FetchChatTransportOptions) => ChatTransport;
407
469
 
@@ -420,6 +482,8 @@ declare const nextLatestFollowStateOnScroll: ({ atLatest, current, isProgrammati
420
482
  current: LatestFollowState;
421
483
  isProgrammatic: boolean;
422
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;
423
487
  type UseLatestThreadViewportOptions = {
424
488
  itemCount: number;
425
489
  hasOlder: boolean;
@@ -436,7 +500,7 @@ type LatestThreadViewportState = {
436
500
  isTopOrigin: boolean;
437
501
  shouldShowLatestButton: boolean;
438
502
  handleScroll: (event: UIEvent<HTMLDivElement>) => void;
439
- handleUserScrollIntent: () => void;
503
+ handleUserScrollIntent: (intent?: LatestThreadViewportUserScrollIntent) => void;
440
504
  scrollToLatest: (options?: {
441
505
  reattach?: boolean;
442
506
  }) => void;
@@ -463,4 +527,4 @@ type LatestThreadViewportProps<T> = {
463
527
  };
464
528
  declare function LatestThreadViewport<T>({ items, hasOlder, isLoadingOlder, onLoadOlder, activeStreamKey, className, latestSpacer, trailingSpacer, renderItem, }: LatestThreadViewportProps<T>): react.JSX.Element;
465
529
 
466
- 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 ChatStorageAdapter, type ChatStreamResult, type ChatTextPart, type ChatThreadDetail, type ChatThreadSummary, type ChatThreadTurn, type ChatToolPart, type ChatToolState, type ChatTransport, type ChatUiBlocksPart, DEFAULT_THREAD_PAGE_SIZE, DefaultChatPart, DefaultToolPart, type FetchChatTransportOptions, type FetchChatTransportRoutes, type LatestFollowState, LatestThreadViewport, type LatestThreadViewportProps, type LatestThreadViewportRenderContext, type LatestThreadViewportState, type StoredChatThread, type StreamingTextCache, type StreamingTextMode, type ToolPresentation, type ToolRenderer, type UseAgents24ChatControllerOptions, type UseLatestThreadViewportOptions, type UseStreamingTextOptions, type UseStreamingTextResult, activeRunIdFromThread, activeRunIdFromThreadDetail, assistantTextFromParts, assistantTextFromResponseBlocks, consumeSseResponse, createChatId, createFetchChatTransport, getActiveStreamingTextPartId, getLatestScrollTop, hasStaleUnfinishedAssistantCache, hasUnfinishedAssistantMessage, isActiveStreamingTextPart, isAtTimelineLatestEdge, isRunningThreadStatus, isScrollable, latestContextWindowFromThread, mergeReasoningSteps, nextLatestFollowStateOnScroll, parseSseBlock, partsFromResponseBlocks, reasoningStepsFromParts, renderChatPart, shouldPrefetchOlder, shouldUseTopOriginTimeline, textFromFinalOutput, threadActivityDate, threadDetailToMessages, threadPaging, titleFromMessage, toolStateFromStatus, useAgents24ChatController, useLatestThreadViewport, useStreamingText };
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 };