@distri/react 0.3.5 → 0.3.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/globals.css +2 -2946
- package/dist/index.cjs +66 -27126
- package/dist/index.d.cts +705 -64
- package/dist/index.d.ts +705 -64
- package/dist/index.js +66 -26971
- package/package.json +22 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent as Agent$1, DistriChatMessage, DistriBaseTool, ToolExecutionOptions, DistriMessage, DistriPart, AgentDefinition,
|
|
1
|
+
import { Agent as Agent$1, DistriChatMessage, DistriBaseTool, ToolExecutionOptions, DistriMessage, DistriPart, AgentDefinition, AgentUsageInfo, ThreadListParams, DistriThread, ProviderModelsStatus, DistriFnTool, ToolCall, ToolResult, PlanStep, TodoItem, TtsSpeechRequest, TtsSpeechResponse, DistriConfiguration, ContextHealth, DistriClient, DistriClientConfig, SpeechToTextConfig, ConfigurationMeta, ConfigurationResponse, MessageReadStatus, MessageVoteSummary, MessageVote, ContextCompactionEvent, WorkflowDefinition, StepResult, StepStatus, WorkflowRunnerOptions, WorkflowStep, ExecutionContext, WorkflowEvent, WorkflowStatus, DistriEvent, ImagePart } from '@distri/core';
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import * as zustand from 'zustand';
|
|
@@ -103,6 +103,17 @@ interface UseThreadMessagesOptions {
|
|
|
103
103
|
threadId: string | null;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
interface UseModelsResult {
|
|
107
|
+
providers: ProviderModelsStatus[];
|
|
108
|
+
loading: boolean;
|
|
109
|
+
error: Error | null;
|
|
110
|
+
refetch: () => Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Hook to fetch available models grouped by provider with configuration status.
|
|
114
|
+
*/
|
|
115
|
+
declare function useModels(): UseModelsResult;
|
|
116
|
+
|
|
106
117
|
type LoadingAnimationPreset = 'typing-dots' | 'pulse-ring' | 'teacher-typing' | 'spinner' | 'wave';
|
|
107
118
|
interface LoadingAnimationConfig {
|
|
108
119
|
/** Preset animation style */
|
|
@@ -119,6 +130,8 @@ interface LoadingAnimationConfig {
|
|
|
119
130
|
label?: string;
|
|
120
131
|
/** Size variant */
|
|
121
132
|
size?: 'sm' | 'md' | 'lg';
|
|
133
|
+
/** Words to cycle through during loading. Pass [] for dots only. */
|
|
134
|
+
cycleWords?: string[];
|
|
122
135
|
}
|
|
123
136
|
interface LoadingAnimationProps {
|
|
124
137
|
config?: LoadingAnimationConfig;
|
|
@@ -158,6 +171,63 @@ type ToolRendererProps = {
|
|
|
158
171
|
};
|
|
159
172
|
type ToolRendererMap = Record<string, (props: ToolRendererProps) => React__default.ReactNode>;
|
|
160
173
|
type ChatCustomRenderers = never;
|
|
174
|
+
type RenderingMode = 'minimal' | 'rich';
|
|
175
|
+
interface ToolSummary {
|
|
176
|
+
verb: string;
|
|
177
|
+
subject?: string;
|
|
178
|
+
detail?: string;
|
|
179
|
+
}
|
|
180
|
+
type SummaryFn = (input: Record<string, unknown>, result?: ToolResult) => ToolSummary;
|
|
181
|
+
interface RendererConfig {
|
|
182
|
+
rendering?: RenderingMode;
|
|
183
|
+
toolSummaryOverrides?: Record<string, SummaryFn>;
|
|
184
|
+
}
|
|
185
|
+
interface DeveloperTraceConfig {
|
|
186
|
+
/** Host app callback used by the built-in traces controls to open a trace surface. */
|
|
187
|
+
open: (threadId: string) => void;
|
|
188
|
+
}
|
|
189
|
+
interface DeveloperDiagnoseConfig {
|
|
190
|
+
/** Agent to receive diagnose requests. Defaults to `distri`. */
|
|
191
|
+
agentId?: string;
|
|
192
|
+
/** Optional fixed diagnose thread id or thread id builder. */
|
|
193
|
+
threadId?: string | ((threadId: string) => string);
|
|
194
|
+
/** Builds the diagnose prompt. Defaults to a prompt that targets the current thread. */
|
|
195
|
+
promptBuilder?: (threadId: string) => string;
|
|
196
|
+
/** Optional label shown on locally injected diagnose user messages. */
|
|
197
|
+
label?: string;
|
|
198
|
+
}
|
|
199
|
+
interface DeveloperMode {
|
|
200
|
+
/** Enable built-in traces controls and route them through the configured trace opener. */
|
|
201
|
+
traces?: boolean | DeveloperTraceConfig;
|
|
202
|
+
/** @deprecated Use `traces={{ open }}` instead. */
|
|
203
|
+
onShowTrace?: (threadId: string) => void;
|
|
204
|
+
/** Show verbose toggle button in developer toolbar */
|
|
205
|
+
verbosity?: boolean;
|
|
206
|
+
/** Show tools panel listing all agent tools */
|
|
207
|
+
tools?: boolean;
|
|
208
|
+
/** Enable diagnose mode, which sends a parallel diagnose request on a separate thread. */
|
|
209
|
+
diagnose?: boolean | DeveloperDiagnoseConfig;
|
|
210
|
+
}
|
|
211
|
+
interface ChatSessionSettings {
|
|
212
|
+
verbose: boolean;
|
|
213
|
+
rendering: RenderingMode;
|
|
214
|
+
audioEnabled: boolean;
|
|
215
|
+
}
|
|
216
|
+
type ChatCommandId = 'verbose' | 'audio' | 'reset';
|
|
217
|
+
interface ChatCommand {
|
|
218
|
+
id: ChatCommandId;
|
|
219
|
+
label: string;
|
|
220
|
+
description: string;
|
|
221
|
+
/** Emoji or display character for the command, e.g. '📊' */
|
|
222
|
+
icon: string;
|
|
223
|
+
type: 'toggle' | 'action';
|
|
224
|
+
currentValue?: boolean;
|
|
225
|
+
}
|
|
226
|
+
interface ChatCommandEvent {
|
|
227
|
+
command: ChatCommandId;
|
|
228
|
+
value?: boolean;
|
|
229
|
+
timestamp: number;
|
|
230
|
+
}
|
|
161
231
|
|
|
162
232
|
type StreamingIndicator = 'typing' | 'thinking' | 'generating';
|
|
163
233
|
interface ThinkingRendererProps {
|
|
@@ -167,9 +237,10 @@ interface ThinkingRendererProps {
|
|
|
167
237
|
name?: string;
|
|
168
238
|
thoughtText?: string;
|
|
169
239
|
}
|
|
170
|
-
declare const LoadingShimmer: ({ text, className }: {
|
|
240
|
+
declare const LoadingShimmer: ({ text, className, showIcon }: {
|
|
171
241
|
text: string;
|
|
172
242
|
className?: string;
|
|
243
|
+
showIcon?: boolean;
|
|
173
244
|
}) => react_jsx_runtime.JSX.Element;
|
|
174
245
|
declare const ThinkingRenderer: React__default.FC<ThinkingRendererProps>;
|
|
175
246
|
|
|
@@ -224,6 +295,9 @@ interface ChatState {
|
|
|
224
295
|
isLoading: boolean;
|
|
225
296
|
error: Error | null;
|
|
226
297
|
debug: boolean;
|
|
298
|
+
verbose: boolean;
|
|
299
|
+
audioEnabled: boolean;
|
|
300
|
+
rendering: RenderingMode;
|
|
227
301
|
tasks: Map<string, TaskState>;
|
|
228
302
|
plans: Map<string, PlanState>;
|
|
229
303
|
steps: Map<string, StepState>;
|
|
@@ -231,6 +305,7 @@ interface ChatState {
|
|
|
231
305
|
currentRunId?: string;
|
|
232
306
|
currentTaskId?: string;
|
|
233
307
|
currentPlanId?: string;
|
|
308
|
+
currentAgentId?: string;
|
|
234
309
|
messages: DistriChatMessage[];
|
|
235
310
|
streamingIndicator: StreamingIndicator | undefined;
|
|
236
311
|
currentThought?: string;
|
|
@@ -252,6 +327,8 @@ interface ChatStateStore extends ChatState {
|
|
|
252
327
|
setLoading: (isLoading: boolean) => void;
|
|
253
328
|
setError: (error: Error | null) => void;
|
|
254
329
|
setDebug: (debug: boolean) => void;
|
|
330
|
+
setVerbose: (verbose: boolean) => void;
|
|
331
|
+
setSessionSettings: (settings: Partial<ChatSessionSettings>) => void;
|
|
255
332
|
setStreamingIndicator: (indicator: StreamingIndicator | undefined) => void;
|
|
256
333
|
setCurrentThought: (thought: string | undefined) => void;
|
|
257
334
|
setBrowserSession: (sessionId: string, viewerUrl?: string, streamUrl?: string) => void;
|
|
@@ -291,6 +368,40 @@ interface ChatStateStore extends ChatState {
|
|
|
291
368
|
}
|
|
292
369
|
declare const useChatStateStore: zustand.UseBoundStore<zustand.StoreApi<ChatStateStore>>;
|
|
293
370
|
|
|
371
|
+
type TtsMode = 'distri' | 'browser';
|
|
372
|
+
interface TtsConfig {
|
|
373
|
+
/** Use Distri server-side TTS ('distri') or browser SpeechSynthesis ('browser'). Defaults to 'distri'. */
|
|
374
|
+
mode?: TtsMode;
|
|
375
|
+
/** Default voice to use when not specified per-request. */
|
|
376
|
+
defaultVoice?: string;
|
|
377
|
+
/** Default speed multiplier (0.25–4.0 for Distri, 0.1–10 for browser). */
|
|
378
|
+
defaultSpeed?: number;
|
|
379
|
+
/** Default provider (only used in 'distri' mode). */
|
|
380
|
+
defaultProvider?: string;
|
|
381
|
+
/** Default model (only used in 'distri' mode). */
|
|
382
|
+
defaultModel?: string;
|
|
383
|
+
}
|
|
384
|
+
declare const useTts: (config?: TtsConfig) => {
|
|
385
|
+
/** Current TTS mode ('distri' or 'browser'). */
|
|
386
|
+
mode: TtsMode;
|
|
387
|
+
/** Whether speech is currently being synthesized or played. */
|
|
388
|
+
isSynthesizing: boolean;
|
|
389
|
+
/** Synthesize speech. Returns TtsSpeechResponse in distri mode, void in browser mode. */
|
|
390
|
+
synthesize: (input: string | TtsSpeechRequest) => Promise<TtsSpeechResponse | void>;
|
|
391
|
+
/** Synthesize and immediately play. Works in both modes. */
|
|
392
|
+
speak: (input: string | TtsSpeechRequest) => Promise<void>;
|
|
393
|
+
/** Play audio from a TtsSpeechResponse or Blob. */
|
|
394
|
+
playAudio: (audio: TtsSpeechResponse | Blob) => Promise<void>;
|
|
395
|
+
/** Stop any active TTS (browser or server). */
|
|
396
|
+
stop: () => void;
|
|
397
|
+
/** Fetch available TTS models (distri mode only). */
|
|
398
|
+
fetchModels: () => Promise<any[]>;
|
|
399
|
+
/** Fetch TTS provider definitions (distri mode only). */
|
|
400
|
+
fetchProviders: () => Promise<any[]>;
|
|
401
|
+
/** Get browser SpeechSynthesis voices. */
|
|
402
|
+
getBrowserVoices: () => SpeechSynthesisVoice[];
|
|
403
|
+
};
|
|
404
|
+
|
|
294
405
|
interface ChatEmptyStateStarter {
|
|
295
406
|
id?: string;
|
|
296
407
|
/** Display label for the starter button */
|
|
@@ -339,10 +450,6 @@ interface ChatInstance {
|
|
|
339
450
|
triggerTool: (toolName: string, input: any) => Promise<void>;
|
|
340
451
|
isStreaming: boolean;
|
|
341
452
|
isLoading: boolean;
|
|
342
|
-
startStreamingVoice?: () => void;
|
|
343
|
-
stopStreamingVoice?: () => void;
|
|
344
|
-
isStreamingVoice?: boolean;
|
|
345
|
-
streamingTranscript?: string;
|
|
346
453
|
}
|
|
347
454
|
interface ChatEmptyStateController {
|
|
348
455
|
input: string;
|
|
@@ -390,27 +497,28 @@ interface ChatProps {
|
|
|
390
497
|
renderLoadingAnimation?: () => React__default.ReactNode;
|
|
391
498
|
voiceEnabled?: boolean;
|
|
392
499
|
useSpeechRecognition?: boolean;
|
|
393
|
-
ttsConfig?:
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
speed?: number;
|
|
397
|
-
};
|
|
500
|
+
ttsConfig?: TtsConfig;
|
|
501
|
+
/** Handsfree mode: auto-send after transcription and auto-play TTS responses. */
|
|
502
|
+
handsfree?: boolean;
|
|
398
503
|
initialInput?: string;
|
|
399
504
|
allowBrowserPreview?: boolean;
|
|
400
505
|
maxWidth?: string;
|
|
401
506
|
className?: string;
|
|
402
507
|
agentId?: string;
|
|
403
508
|
enableHistory?: boolean;
|
|
404
|
-
/**
|
|
405
|
-
* Enable debug mode to show developer messages in the chat.
|
|
406
|
-
* Developer messages are hidden by default.
|
|
407
|
-
*/
|
|
408
|
-
debug?: boolean;
|
|
409
509
|
/**
|
|
410
510
|
* Enable message feedback (voting) UI on assistant messages.
|
|
411
511
|
* Shows thumbs up/down buttons for rating responses.
|
|
412
512
|
*/
|
|
413
513
|
enableFeedback?: boolean;
|
|
514
|
+
/** Enable slash-command palette in the input */
|
|
515
|
+
allowCommands?: boolean;
|
|
516
|
+
/** Initial session settings applied on mount */
|
|
517
|
+
sessionSettings?: Partial<ChatSessionSettings>;
|
|
518
|
+
/** Callback fired when a slash command is selected */
|
|
519
|
+
onCommand?: (event: ChatCommandEvent) => void;
|
|
520
|
+
/** Developer mode options: traces, verbosity, tools panel, and parallel diagnose mode */
|
|
521
|
+
developerMode?: DeveloperMode;
|
|
414
522
|
}
|
|
415
523
|
declare const ChatInner: React__default.ForwardRefExoticComponent<ChatProps & React__default.RefAttributes<ChatInstance>>;
|
|
416
524
|
interface ChatContainerProps extends ChatProps {
|
|
@@ -421,14 +529,13 @@ interface ChatContainerProps extends ChatProps {
|
|
|
421
529
|
declare const Chat: React__default.ForwardRefExoticComponent<ChatProps & React__default.RefAttributes<ChatInstance>>;
|
|
422
530
|
|
|
423
531
|
interface Agent {
|
|
424
|
-
id: string;
|
|
425
532
|
name: string;
|
|
426
533
|
description?: string;
|
|
427
534
|
}
|
|
428
535
|
interface AgentSelectProps {
|
|
429
536
|
agents: Agent[];
|
|
430
537
|
selectedAgentId?: string;
|
|
431
|
-
onAgentSelect: (
|
|
538
|
+
onAgentSelect: (agentName: string) => void;
|
|
432
539
|
className?: string;
|
|
433
540
|
placeholder?: string;
|
|
434
541
|
disabled?: boolean;
|
|
@@ -458,12 +565,19 @@ interface ChatInputProps {
|
|
|
458
565
|
onAddImages?: (files: FileList | File[]) => void;
|
|
459
566
|
voiceEnabled?: boolean;
|
|
460
567
|
onVoiceRecord?: (audioBlob: Blob) => void;
|
|
461
|
-
onStartStreamingVoice?: () => void;
|
|
462
|
-
isStreamingVoice?: boolean;
|
|
463
568
|
useSpeechRecognition?: boolean;
|
|
464
569
|
onSpeechTranscript?: (text: string) => void;
|
|
570
|
+
handsfree?: boolean;
|
|
571
|
+
onToggleHandsfree?: () => void;
|
|
572
|
+
verbose?: boolean;
|
|
573
|
+
onToggleVerbose?: () => void;
|
|
574
|
+
developerModeControl?: React__default.ReactNode;
|
|
575
|
+
developerModeStatus?: React__default.ReactNode;
|
|
465
576
|
variant?: 'default' | 'hero';
|
|
466
577
|
theme?: 'light' | 'dark' | 'auto';
|
|
578
|
+
allowCommands?: boolean;
|
|
579
|
+
commands?: ChatCommand[];
|
|
580
|
+
onCommand?: (event: ChatCommandEvent) => void;
|
|
467
581
|
}
|
|
468
582
|
declare const ChatInput: React__default.FC<ChatInputProps>;
|
|
469
583
|
|
|
@@ -554,6 +668,25 @@ interface AskFollowUpOutput {
|
|
|
554
668
|
declare const ASK_FOLLOW_UP_TOOL_NAME = "ask_follow_up";
|
|
555
669
|
declare function createAskFollowUpTool(): DistriUiTool;
|
|
556
670
|
|
|
671
|
+
interface ContextIndicatorProps {
|
|
672
|
+
contextHealth: ContextHealth | null;
|
|
673
|
+
isCompacting?: boolean;
|
|
674
|
+
className?: string;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Visual indicator for context window health.
|
|
678
|
+
*
|
|
679
|
+
* Shows a progress bar representing context usage and compaction status.
|
|
680
|
+
* Can be placed in a chat header, sidebar, or status bar.
|
|
681
|
+
*
|
|
682
|
+
* Usage:
|
|
683
|
+
* ```tsx
|
|
684
|
+
* const { contextHealth, isCompacting } = useContextHealth();
|
|
685
|
+
* <ContextIndicator contextHealth={contextHealth} isCompacting={isCompacting} />
|
|
686
|
+
* ```
|
|
687
|
+
*/
|
|
688
|
+
declare function ContextIndicator({ contextHealth, isCompacting, className, }: ContextIndicatorProps): react_jsx_runtime.JSX.Element | null;
|
|
689
|
+
|
|
557
690
|
interface DistriContextValue {
|
|
558
691
|
client: DistriClient | null;
|
|
559
692
|
error: Error | null;
|
|
@@ -650,51 +783,9 @@ interface UseChatMessagesReturn {
|
|
|
650
783
|
}
|
|
651
784
|
declare function useChatMessages({ initialMessages, threadId, onError, enabled, }?: UseChatMessagesOptions): UseChatMessagesReturn;
|
|
652
785
|
|
|
653
|
-
interface TtsRequest {
|
|
654
|
-
text: string;
|
|
655
|
-
model: 'openai' | 'gemini';
|
|
656
|
-
voice?: string;
|
|
657
|
-
speed?: number;
|
|
658
|
-
}
|
|
659
|
-
interface TtsConfig {
|
|
660
|
-
baseUrl?: string;
|
|
661
|
-
accessToken?: string;
|
|
662
|
-
}
|
|
663
|
-
interface StreamingTtsOptions {
|
|
664
|
-
onAudioChunk?: (audioData: Uint8Array) => void;
|
|
665
|
-
onTextChunk?: (text: string, isFinal: boolean) => void;
|
|
666
|
-
onError?: (error: Error) => void;
|
|
667
|
-
onStart?: () => void;
|
|
668
|
-
onEnd?: () => void;
|
|
669
|
-
voice?: string;
|
|
670
|
-
speed?: number;
|
|
671
|
-
}
|
|
672
|
-
declare const useTts: (config?: TtsConfig) => {
|
|
673
|
-
synthesize: (request: TtsRequest) => Promise<Blob>;
|
|
674
|
-
getAvailableVoices: () => Promise<any>;
|
|
675
|
-
playAudio: (audioBlob: Blob) => Promise<void>;
|
|
676
|
-
streamingPlayAudio: (audioChunks: Uint8Array[]) => Promise<void>;
|
|
677
|
-
startStreamingTts: (options?: StreamingTtsOptions) => {
|
|
678
|
-
sendText: (text: string) => void;
|
|
679
|
-
stop: () => void;
|
|
680
|
-
};
|
|
681
|
-
stopStreamingTts: () => void;
|
|
682
|
-
isSynthesizing: boolean;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
786
|
declare const useSpeechToText: () => {
|
|
686
787
|
transcribe: (audioBlob: Blob, config?: SpeechToTextConfig) => Promise<string>;
|
|
687
788
|
isTranscribing: boolean;
|
|
688
|
-
startStreamingTranscription: (options?: StreamingTranscriptionOptions) => Promise<{
|
|
689
|
-
sendAudio: (audioData: ArrayBuffer) => void;
|
|
690
|
-
sendText: (text: string) => void;
|
|
691
|
-
stop: () => void;
|
|
692
|
-
close: () => void;
|
|
693
|
-
}>;
|
|
694
|
-
stopStreamingTranscription: () => void;
|
|
695
|
-
sendAudio: (audioData: ArrayBuffer) => void;
|
|
696
|
-
sendText: (text: string) => void;
|
|
697
|
-
isStreaming: boolean;
|
|
698
789
|
};
|
|
699
790
|
|
|
700
791
|
type UseConfigurationResult = {
|
|
@@ -808,6 +899,31 @@ interface UseMessageVotesResult {
|
|
|
808
899
|
*/
|
|
809
900
|
declare function useMessageVotes(options: UseMessageVotesOptions): UseMessageVotesResult;
|
|
810
901
|
|
|
902
|
+
/**
|
|
903
|
+
* Hook that tracks context health by listening for ContextCompaction events
|
|
904
|
+
* in the agent event stream.
|
|
905
|
+
*
|
|
906
|
+
* Usage:
|
|
907
|
+
* ```tsx
|
|
908
|
+
* const { contextHealth, lastCompaction, isCompacting } = useContextHealth();
|
|
909
|
+
* ```
|
|
910
|
+
*
|
|
911
|
+
* This hook maintains a running picture of context usage. It updates whenever
|
|
912
|
+
* a `context_compaction` event is received from the server event stream.
|
|
913
|
+
*/
|
|
914
|
+
declare function useContextHealth(): {
|
|
915
|
+
/** Current context health snapshot, or null if no compaction has occurred yet */
|
|
916
|
+
contextHealth: ContextHealth | null;
|
|
917
|
+
/** The most recent compaction event */
|
|
918
|
+
lastCompaction: ContextCompactionEvent | null;
|
|
919
|
+
/** Whether a compaction just occurred (true for ~1.5s after event) */
|
|
920
|
+
isCompacting: boolean;
|
|
921
|
+
/** Call with raw event objects from the stream to update health */
|
|
922
|
+
handleEvent: (event: Record<string, unknown>) => void;
|
|
923
|
+
/** Reset state (e.g., when switching threads) */
|
|
924
|
+
reset: () => void;
|
|
925
|
+
};
|
|
926
|
+
|
|
811
927
|
/**
|
|
812
928
|
* Wraps a DistriFnTool as a DistriUiTool with DefaultToolActions component
|
|
813
929
|
*/
|
|
@@ -817,6 +933,431 @@ declare function wrapFnToolAsUiTool(fnTool: DistriFnTool, options?: ToolExecutio
|
|
|
817
933
|
*/
|
|
818
934
|
declare function wrapTools(tools: (DistriFnTool | DistriUiTool)[], options?: ToolExecutionOptions): DistriUiTool[];
|
|
819
935
|
|
|
936
|
+
interface PathConfig {
|
|
937
|
+
/** URL pattern with optional `:param` wildcards, e.g. `/api/users/:id` */
|
|
938
|
+
pattern: string;
|
|
939
|
+
/** Human-readable label shown in the card header, e.g. "Get User" */
|
|
940
|
+
label?: string;
|
|
941
|
+
}
|
|
942
|
+
interface HttpToolCardProps {
|
|
943
|
+
toolCall: ToolCall;
|
|
944
|
+
state?: ToolCallState;
|
|
945
|
+
/** Registered path configs for label matching */
|
|
946
|
+
paths?: PathConfig[];
|
|
947
|
+
}
|
|
948
|
+
declare const HttpToolCard: React__default.FC<HttpToolCardProps>;
|
|
949
|
+
|
|
950
|
+
/**
|
|
951
|
+
* Options for creating HTTP tool renderers.
|
|
952
|
+
*/
|
|
953
|
+
interface HttpToolRendererOptions {
|
|
954
|
+
/**
|
|
955
|
+
* Tool names to handle (e.g. `['distri_request', 'api_request']`).
|
|
956
|
+
* Each name gets an entry in the returned `ToolRendererMap`.
|
|
957
|
+
*/
|
|
958
|
+
toolNames: string[];
|
|
959
|
+
/**
|
|
960
|
+
* Registered path patterns with optional display labels.
|
|
961
|
+
*
|
|
962
|
+
* Patterns support `:param` wildcards:
|
|
963
|
+
* ```
|
|
964
|
+
* { pattern: '/api/users/:id', label: 'Get User' }
|
|
965
|
+
* ```
|
|
966
|
+
*/
|
|
967
|
+
paths?: PathConfig[];
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Creates a `ToolRendererMap` that renders HTTP tool calls with an
|
|
971
|
+
* improved UI — color-coded method badges, request body display,
|
|
972
|
+
* formatted JSON responses, and status code indicators.
|
|
973
|
+
*
|
|
974
|
+
* Registered `paths` let you attach human-readable labels that appear
|
|
975
|
+
* in the card header when the request URL matches a pattern.
|
|
976
|
+
*
|
|
977
|
+
* @example
|
|
978
|
+
* ```tsx
|
|
979
|
+
* import { createHttpToolRenderer } from '@distri/react';
|
|
980
|
+
*
|
|
981
|
+
* const httpRenderers = createHttpToolRenderer({
|
|
982
|
+
* toolNames: ['distri_request', 'api_request'],
|
|
983
|
+
* paths: [
|
|
984
|
+
* { pattern: '/api/users', label: 'List Users' },
|
|
985
|
+
* { pattern: '/api/users/:id', label: 'Get User' },
|
|
986
|
+
* ],
|
|
987
|
+
* });
|
|
988
|
+
*
|
|
989
|
+
* <Chat toolRenderers={{ ...httpRenderers }} />
|
|
990
|
+
* ```
|
|
991
|
+
*/
|
|
992
|
+
declare function createHttpToolRenderer(options: HttpToolRendererOptions): ToolRendererMap;
|
|
993
|
+
|
|
994
|
+
type EntryType = 'file' | 'directory';
|
|
995
|
+
interface FileRecord {
|
|
996
|
+
path: string;
|
|
997
|
+
type: EntryType;
|
|
998
|
+
content?: string;
|
|
999
|
+
createdAt: number;
|
|
1000
|
+
updatedAt: number;
|
|
1001
|
+
}
|
|
1002
|
+
interface FileInfo {
|
|
1003
|
+
path: string;
|
|
1004
|
+
size: number;
|
|
1005
|
+
is_file: boolean;
|
|
1006
|
+
is_dir: boolean;
|
|
1007
|
+
modified: number;
|
|
1008
|
+
created: number;
|
|
1009
|
+
}
|
|
1010
|
+
interface DirectoryTreeNode {
|
|
1011
|
+
name: string;
|
|
1012
|
+
path: string;
|
|
1013
|
+
type: EntryType;
|
|
1014
|
+
children?: DirectoryTreeNode[];
|
|
1015
|
+
}
|
|
1016
|
+
interface SearchMatch {
|
|
1017
|
+
path: string;
|
|
1018
|
+
matches: Array<{
|
|
1019
|
+
line_number: number;
|
|
1020
|
+
line_content: string;
|
|
1021
|
+
}>;
|
|
1022
|
+
}
|
|
1023
|
+
type FilesystemChangeType = 'write' | 'edit' | 'delete' | 'create_directory';
|
|
1024
|
+
interface FilesystemChangeEvent {
|
|
1025
|
+
type: FilesystemChangeType;
|
|
1026
|
+
path: string;
|
|
1027
|
+
metadata?: Record<string, unknown>;
|
|
1028
|
+
}
|
|
1029
|
+
interface BrowserToolsOptions {
|
|
1030
|
+
onChange?: (event: FilesystemChangeEvent) => void;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* IndexedDB-backed filesystem for browser-tools.
|
|
1035
|
+
*
|
|
1036
|
+
* Provides the storage layer for Read/Write/Edit/Grep/Glob tools running
|
|
1037
|
+
* in the browser. Each projectId maps to its own IndexedDB database.
|
|
1038
|
+
*/
|
|
1039
|
+
|
|
1040
|
+
declare class IndexedDbFilesystem {
|
|
1041
|
+
private static instances;
|
|
1042
|
+
static forProject(projectId: string): IndexedDbFilesystem;
|
|
1043
|
+
readonly projectId: string;
|
|
1044
|
+
private readonly hasIndexedDb;
|
|
1045
|
+
private readonly memory;
|
|
1046
|
+
private dbPromise?;
|
|
1047
|
+
private constructor();
|
|
1048
|
+
private openDatabase;
|
|
1049
|
+
private withStore;
|
|
1050
|
+
private getRecord;
|
|
1051
|
+
private putRecord;
|
|
1052
|
+
private deleteRecord;
|
|
1053
|
+
private getAllRecords;
|
|
1054
|
+
private ensureParents;
|
|
1055
|
+
writeFile(path: string, content: string): Promise<{
|
|
1056
|
+
path: string;
|
|
1057
|
+
bytes_written: number;
|
|
1058
|
+
}>;
|
|
1059
|
+
readFile(path: string): Promise<{
|
|
1060
|
+
path: string;
|
|
1061
|
+
content: string;
|
|
1062
|
+
}>;
|
|
1063
|
+
readFileWithLines(path: string, offset?: number, limit?: number): Promise<{
|
|
1064
|
+
content: string;
|
|
1065
|
+
total_lines: number;
|
|
1066
|
+
lines_read: number;
|
|
1067
|
+
truncated: boolean;
|
|
1068
|
+
}>;
|
|
1069
|
+
editFile(path: string, oldString: string, newString: string, replaceAll?: boolean): Promise<{
|
|
1070
|
+
path: string;
|
|
1071
|
+
replacements: number;
|
|
1072
|
+
}>;
|
|
1073
|
+
deleteEntry(path: string, recursive?: boolean): Promise<void>;
|
|
1074
|
+
createDirectory(path: string): Promise<void>;
|
|
1075
|
+
listDirectory(path: string, recursive?: boolean): Promise<string[]>;
|
|
1076
|
+
getFileInfo(path: string): Promise<FileInfo>;
|
|
1077
|
+
glob(pattern: string, basePath?: string): Promise<string[]>;
|
|
1078
|
+
grep(pattern: string, options?: {
|
|
1079
|
+
path?: string;
|
|
1080
|
+
glob?: string;
|
|
1081
|
+
caseInsensitive?: boolean;
|
|
1082
|
+
outputMode?: 'content' | 'files_with_matches' | 'count';
|
|
1083
|
+
beforeContext?: number;
|
|
1084
|
+
afterContext?: number;
|
|
1085
|
+
headLimit?: number;
|
|
1086
|
+
}): Promise<{
|
|
1087
|
+
matches: SearchMatch[];
|
|
1088
|
+
output: string;
|
|
1089
|
+
total_matches: number;
|
|
1090
|
+
}>;
|
|
1091
|
+
tree(path?: string): Promise<DirectoryTreeNode>;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
declare const READ_TOOL_DEF: {
|
|
1095
|
+
readonly name: "Read";
|
|
1096
|
+
readonly description: "Read a file from the local filesystem.";
|
|
1097
|
+
readonly prompt: string;
|
|
1098
|
+
readonly parameters: {
|
|
1099
|
+
readonly type: "object";
|
|
1100
|
+
readonly required: readonly ["file_path"];
|
|
1101
|
+
readonly properties: {
|
|
1102
|
+
readonly file_path: {
|
|
1103
|
+
readonly type: "string";
|
|
1104
|
+
readonly description: "The path to the file to read";
|
|
1105
|
+
};
|
|
1106
|
+
readonly offset: {
|
|
1107
|
+
readonly type: "number";
|
|
1108
|
+
readonly description: "The line number to start reading from (0-based)";
|
|
1109
|
+
};
|
|
1110
|
+
readonly limit: {
|
|
1111
|
+
readonly type: "number";
|
|
1112
|
+
readonly description: "The number of lines to read";
|
|
1113
|
+
};
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
declare const WRITE_TOOL_DEF: {
|
|
1119
|
+
readonly name: "Write";
|
|
1120
|
+
readonly description: "Write a file to the local filesystem.";
|
|
1121
|
+
readonly prompt: string;
|
|
1122
|
+
readonly parameters: {
|
|
1123
|
+
readonly type: "object";
|
|
1124
|
+
readonly required: readonly ["file_path", "content"];
|
|
1125
|
+
readonly properties: {
|
|
1126
|
+
readonly file_path: {
|
|
1127
|
+
readonly type: "string";
|
|
1128
|
+
readonly description: "The path to the file to write";
|
|
1129
|
+
};
|
|
1130
|
+
readonly content: {
|
|
1131
|
+
readonly type: "string";
|
|
1132
|
+
readonly description: "The content to write to the file";
|
|
1133
|
+
};
|
|
1134
|
+
};
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
|
|
1138
|
+
declare const EDIT_TOOL_DEF: {
|
|
1139
|
+
readonly name: "Edit";
|
|
1140
|
+
readonly description: "Perform exact string replacements in files.";
|
|
1141
|
+
readonly prompt: string;
|
|
1142
|
+
readonly parameters: {
|
|
1143
|
+
readonly type: "object";
|
|
1144
|
+
readonly required: readonly ["file_path", "old_string", "new_string"];
|
|
1145
|
+
readonly properties: {
|
|
1146
|
+
readonly file_path: {
|
|
1147
|
+
readonly type: "string";
|
|
1148
|
+
readonly description: "The path to the file to edit";
|
|
1149
|
+
};
|
|
1150
|
+
readonly old_string: {
|
|
1151
|
+
readonly type: "string";
|
|
1152
|
+
readonly description: "The text to replace";
|
|
1153
|
+
};
|
|
1154
|
+
readonly new_string: {
|
|
1155
|
+
readonly type: "string";
|
|
1156
|
+
readonly description: "The replacement text";
|
|
1157
|
+
};
|
|
1158
|
+
readonly replace_all: {
|
|
1159
|
+
readonly type: "boolean";
|
|
1160
|
+
readonly description: "Replace all occurrences (default false)";
|
|
1161
|
+
readonly default: false;
|
|
1162
|
+
};
|
|
1163
|
+
};
|
|
1164
|
+
};
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1167
|
+
declare const GREP_TOOL_DEF: {
|
|
1168
|
+
readonly name: "Grep";
|
|
1169
|
+
readonly description: "Search file contents with regex.";
|
|
1170
|
+
readonly prompt: string;
|
|
1171
|
+
readonly parameters: {
|
|
1172
|
+
readonly type: "object";
|
|
1173
|
+
readonly required: readonly ["pattern"];
|
|
1174
|
+
readonly properties: {
|
|
1175
|
+
readonly pattern: {
|
|
1176
|
+
readonly type: "string";
|
|
1177
|
+
readonly description: "The regex pattern to search for";
|
|
1178
|
+
};
|
|
1179
|
+
readonly path: {
|
|
1180
|
+
readonly type: "string";
|
|
1181
|
+
readonly description: "File or directory to search in";
|
|
1182
|
+
};
|
|
1183
|
+
readonly glob: {
|
|
1184
|
+
readonly type: "string";
|
|
1185
|
+
readonly description: "Glob pattern to filter files";
|
|
1186
|
+
};
|
|
1187
|
+
readonly output_mode: {
|
|
1188
|
+
readonly type: "string";
|
|
1189
|
+
readonly enum: readonly ["content", "files_with_matches", "count"];
|
|
1190
|
+
readonly description: "Output mode (default: files_with_matches)";
|
|
1191
|
+
};
|
|
1192
|
+
readonly '-A': {
|
|
1193
|
+
readonly type: "number";
|
|
1194
|
+
readonly description: "Lines after match";
|
|
1195
|
+
};
|
|
1196
|
+
readonly '-B': {
|
|
1197
|
+
readonly type: "number";
|
|
1198
|
+
readonly description: "Lines before match";
|
|
1199
|
+
};
|
|
1200
|
+
readonly '-C': {
|
|
1201
|
+
readonly type: "number";
|
|
1202
|
+
readonly description: "Context lines";
|
|
1203
|
+
};
|
|
1204
|
+
readonly '-i': {
|
|
1205
|
+
readonly type: "boolean";
|
|
1206
|
+
readonly description: "Case insensitive";
|
|
1207
|
+
};
|
|
1208
|
+
readonly '-n': {
|
|
1209
|
+
readonly type: "boolean";
|
|
1210
|
+
readonly description: "Show line numbers";
|
|
1211
|
+
};
|
|
1212
|
+
readonly head_limit: {
|
|
1213
|
+
readonly type: "number";
|
|
1214
|
+
readonly description: "Limit output lines (default 250)";
|
|
1215
|
+
};
|
|
1216
|
+
};
|
|
1217
|
+
};
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
declare const GLOB_TOOL_DEF: {
|
|
1221
|
+
readonly name: "Glob";
|
|
1222
|
+
readonly description: "Fast file pattern matching tool.";
|
|
1223
|
+
readonly prompt: string;
|
|
1224
|
+
readonly parameters: {
|
|
1225
|
+
readonly type: "object";
|
|
1226
|
+
readonly required: readonly ["pattern"];
|
|
1227
|
+
readonly properties: {
|
|
1228
|
+
readonly pattern: {
|
|
1229
|
+
readonly type: "string";
|
|
1230
|
+
readonly description: "The glob pattern to match files against";
|
|
1231
|
+
};
|
|
1232
|
+
readonly path: {
|
|
1233
|
+
readonly type: "string";
|
|
1234
|
+
readonly description: "The directory to search in (defaults to project root)";
|
|
1235
|
+
};
|
|
1236
|
+
};
|
|
1237
|
+
};
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
declare const EXEC_JS_TOOL_DEF: {
|
|
1241
|
+
readonly name: "ExecJs";
|
|
1242
|
+
readonly description: "Execute JavaScript code in the browser sandbox.";
|
|
1243
|
+
readonly prompt: string;
|
|
1244
|
+
readonly parameters: {
|
|
1245
|
+
readonly type: "object";
|
|
1246
|
+
readonly required: readonly ["code"];
|
|
1247
|
+
readonly properties: {
|
|
1248
|
+
readonly code: {
|
|
1249
|
+
readonly type: "string";
|
|
1250
|
+
readonly description: "JavaScript code to execute";
|
|
1251
|
+
};
|
|
1252
|
+
readonly timeout: {
|
|
1253
|
+
readonly type: "number";
|
|
1254
|
+
readonly description: "Timeout in milliseconds (default 5000, max 30000)";
|
|
1255
|
+
};
|
|
1256
|
+
};
|
|
1257
|
+
};
|
|
1258
|
+
};
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* createBrowserTools — factory that returns DistriFnTool[] backed by IndexedDB.
|
|
1262
|
+
*
|
|
1263
|
+
* Tool names and schemas match distri-cli (Read, Write, Edit, Grep, Glob)
|
|
1264
|
+
* so the same agent prompt works in both browser and CLI environments.
|
|
1265
|
+
* ExecJs is browser-specific (replaces CLI's Bash tool).
|
|
1266
|
+
*/
|
|
1267
|
+
|
|
1268
|
+
declare function createBrowserTools(projectId: string, options?: BrowserToolsOptions): DistriFnTool[];
|
|
1269
|
+
|
|
1270
|
+
/**
|
|
1271
|
+
* useWorkflow — React hook for tracking and running workflows.
|
|
1272
|
+
*
|
|
1273
|
+
* Provides:
|
|
1274
|
+
* - workflow state (steps, status, progress)
|
|
1275
|
+
* - runNextStep() to advance the workflow
|
|
1276
|
+
* - runAll() to run all remaining steps
|
|
1277
|
+
* - isRunning flag
|
|
1278
|
+
*/
|
|
1279
|
+
|
|
1280
|
+
interface UseWorkflowOptions {
|
|
1281
|
+
/** Initial workflow definition */
|
|
1282
|
+
workflow: WorkflowDefinition;
|
|
1283
|
+
/** Optional entry point ID to start from (skips earlier steps) */
|
|
1284
|
+
entryPointId?: string;
|
|
1285
|
+
/** Called when a step needs to be executed. Returns the step result. */
|
|
1286
|
+
onExecuteStep: (stepId: string, step: WorkflowDefinition['steps'][0], context: Record<string, unknown>) => Promise<StepResult>;
|
|
1287
|
+
/** Called when workflow state changes (for persistence) */
|
|
1288
|
+
onStateChange?: (workflow: WorkflowDefinition) => void;
|
|
1289
|
+
}
|
|
1290
|
+
interface UseWorkflowReturn {
|
|
1291
|
+
/** Current workflow state */
|
|
1292
|
+
workflow: WorkflowDefinition;
|
|
1293
|
+
/** Whether any step is currently running */
|
|
1294
|
+
isRunning: boolean;
|
|
1295
|
+
/** Whether workflow is paused waiting for human input */
|
|
1296
|
+
isPaused: boolean;
|
|
1297
|
+
/** The step currently waiting for input, if any */
|
|
1298
|
+
waitingStep: WorkflowDefinition['steps'][0] | null;
|
|
1299
|
+
/** Progress percentage (0-100) */
|
|
1300
|
+
progress: number;
|
|
1301
|
+
/** Step counts by status */
|
|
1302
|
+
counts: Record<StepStatus, number>;
|
|
1303
|
+
/** Run the next pending step */
|
|
1304
|
+
runNextStep: () => Promise<void>;
|
|
1305
|
+
/** Run all remaining steps */
|
|
1306
|
+
runAll: () => Promise<void>;
|
|
1307
|
+
/** Resume a paused workflow by providing input for the waiting step */
|
|
1308
|
+
resume: (stepId: string, input: unknown) => Promise<void>;
|
|
1309
|
+
/** Update workflow state directly (e.g., from SSE events) */
|
|
1310
|
+
updateWorkflow: (workflow: WorkflowDefinition) => void;
|
|
1311
|
+
}
|
|
1312
|
+
declare function useWorkflow({ workflow: initial, entryPointId, onExecuteStep, onStateChange }: UseWorkflowOptions): UseWorkflowReturn;
|
|
1313
|
+
|
|
1314
|
+
/**
|
|
1315
|
+
* useWorkflowRunner — React hook that runs workflows using DistriClient.
|
|
1316
|
+
*
|
|
1317
|
+
* Combines WorkflowRunner (from @distri/core) with React state management.
|
|
1318
|
+
* Steps execute against distri-cloud APIs. Events update state in real-time.
|
|
1319
|
+
*
|
|
1320
|
+
* Usage:
|
|
1321
|
+
* const { run, status, events, steps, isRunning } = useWorkflowRunner()
|
|
1322
|
+
* await run(workflowDef, { doc_id: 'abc' })
|
|
1323
|
+
*/
|
|
1324
|
+
|
|
1325
|
+
interface UseWorkflowRunnerOptions {
|
|
1326
|
+
/** Hook to customize HTTP requests (add auth headers, base URL, etc.) */
|
|
1327
|
+
buildRequest?: WorkflowRunnerOptions['buildRequest'];
|
|
1328
|
+
/** Environment variables for {env.X} namespace */
|
|
1329
|
+
env?: Record<string, unknown>;
|
|
1330
|
+
/** Custom step executor override */
|
|
1331
|
+
executeStep?: (step: WorkflowStep, resolvedInput: unknown, context: ExecutionContext) => Promise<StepResult>;
|
|
1332
|
+
/** Called on each event */
|
|
1333
|
+
onEvent?: (event: WorkflowEvent) => void;
|
|
1334
|
+
}
|
|
1335
|
+
interface UseWorkflowRunnerReturn {
|
|
1336
|
+
/** Run a workflow with the given input. Optionally specify an entry point to start from. */
|
|
1337
|
+
run: (workflow: WorkflowDefinition, input?: Record<string, unknown>, entryPointId?: string) => Promise<WorkflowStatus>;
|
|
1338
|
+
/** Resume a paused workflow by providing input for the waiting step. */
|
|
1339
|
+
resume: (stepId: string, input: unknown) => Promise<WorkflowStatus>;
|
|
1340
|
+
/** Whether a workflow is currently running. */
|
|
1341
|
+
isRunning: boolean;
|
|
1342
|
+
/** Whether the workflow is paused waiting for human input. */
|
|
1343
|
+
isPaused: boolean;
|
|
1344
|
+
/** Current status (null if not started). */
|
|
1345
|
+
status: WorkflowStatus | null;
|
|
1346
|
+
/** All events emitted so far. */
|
|
1347
|
+
events: WorkflowEvent[];
|
|
1348
|
+
/** Stop the running workflow. */
|
|
1349
|
+
stop: () => void;
|
|
1350
|
+
}
|
|
1351
|
+
declare function useWorkflowRunner(options?: UseWorkflowRunnerOptions): UseWorkflowRunnerReturn;
|
|
1352
|
+
|
|
1353
|
+
interface WorkflowProgressProps {
|
|
1354
|
+
workflow: WorkflowDefinition;
|
|
1355
|
+
className?: string;
|
|
1356
|
+
/** Show step details (kind, result preview) */
|
|
1357
|
+
detailed?: boolean;
|
|
1358
|
+
}
|
|
1359
|
+
declare function WorkflowProgress({ workflow, className, detailed }: WorkflowProgressProps): react_jsx_runtime.JSX.Element;
|
|
1360
|
+
|
|
820
1361
|
declare const buttonVariants: {
|
|
821
1362
|
variant: {
|
|
822
1363
|
default: string;
|
|
@@ -1005,6 +1546,19 @@ interface AssistantMessageRendererProps {
|
|
|
1005
1546
|
}
|
|
1006
1547
|
declare const AssistantMessageRenderer: React__default.FC<AssistantMessageRendererProps>;
|
|
1007
1548
|
|
|
1549
|
+
interface ToolExecutionRendererProps {
|
|
1550
|
+
event: any;
|
|
1551
|
+
toolCallStates: Map<string, ToolCallState>;
|
|
1552
|
+
toolRenderers?: ToolRendererMap;
|
|
1553
|
+
debug?: boolean;
|
|
1554
|
+
verbose?: boolean;
|
|
1555
|
+
rendering?: RenderingMode;
|
|
1556
|
+
onToolComplete?: (result: ToolResult) => void;
|
|
1557
|
+
}
|
|
1558
|
+
/** Generate human-readable status text for a tool call */
|
|
1559
|
+
declare const formatStatusText: (toolName: string, input: any) => string;
|
|
1560
|
+
declare const ToolExecutionRenderer: React__default.FC<ToolExecutionRendererProps>;
|
|
1561
|
+
|
|
1008
1562
|
interface ImageRendererProps {
|
|
1009
1563
|
imageParts: ImagePart[];
|
|
1010
1564
|
className?: string;
|
|
@@ -1018,8 +1572,12 @@ interface MessageFeedbackProps {
|
|
|
1018
1572
|
compact?: boolean;
|
|
1019
1573
|
/** CSS class name */
|
|
1020
1574
|
className?: string;
|
|
1575
|
+
/** Show thumbs up/down feedback controls (default: true) */
|
|
1576
|
+
enableFeedback?: boolean;
|
|
1021
1577
|
/** Called when a vote is submitted */
|
|
1022
1578
|
onVote?: (voteType: 'upvote' | 'downvote', comment?: string) => void;
|
|
1579
|
+
/** Omit to hide the traces button */
|
|
1580
|
+
onShowTrace?: (threadId: string) => void;
|
|
1023
1581
|
}
|
|
1024
1582
|
/**
|
|
1025
1583
|
* Message feedback component with thumbs up/down voting.
|
|
@@ -1079,12 +1637,17 @@ interface MessageRendererProps {
|
|
|
1079
1637
|
toolRenderers?: ToolRendererMap;
|
|
1080
1638
|
/** Enable debug mode to show developer messages */
|
|
1081
1639
|
debug?: boolean;
|
|
1640
|
+
/** Show all tool calls (detailed mode) vs collapsed summary (normal mode) */
|
|
1641
|
+
verbose?: boolean;
|
|
1082
1642
|
/** Thread ID for feedback functionality */
|
|
1083
1643
|
threadId?: string;
|
|
1084
1644
|
/** Enable message feedback (voting) UI */
|
|
1085
1645
|
enableFeedback?: boolean;
|
|
1646
|
+
rendering?: RenderingMode;
|
|
1647
|
+
toolSummaryOverrides?: Record<string, SummaryFn>;
|
|
1648
|
+
onShowTrace?: (threadId: string) => void;
|
|
1086
1649
|
}
|
|
1087
|
-
declare function MessageRenderer({ message, index, toolRenderers, debug, threadId, enableFeedback, }: MessageRendererProps): React__default.ReactNode;
|
|
1650
|
+
declare function MessageRenderer({ message, index, toolRenderers, debug, verbose, threadId, enableFeedback, rendering, toolSummaryOverrides, onShowTrace, }: MessageRendererProps): React__default.ReactNode;
|
|
1088
1651
|
|
|
1089
1652
|
interface StepBasedRendererProps {
|
|
1090
1653
|
message: DistriMessage;
|
|
@@ -1129,4 +1692,82 @@ interface UserMessageRendererProps {
|
|
|
1129
1692
|
}
|
|
1130
1693
|
declare const UserMessageRenderer: React__default.FC<UserMessageRendererProps>;
|
|
1131
1694
|
|
|
1132
|
-
|
|
1695
|
+
interface LoadingStripProps {
|
|
1696
|
+
words?: string[];
|
|
1697
|
+
className?: string;
|
|
1698
|
+
}
|
|
1699
|
+
declare const LoadingStrip: React__default.FC<LoadingStripProps>;
|
|
1700
|
+
|
|
1701
|
+
interface TodosCompactProps {
|
|
1702
|
+
todos: TodoItem[];
|
|
1703
|
+
className?: string;
|
|
1704
|
+
}
|
|
1705
|
+
declare const TodosCompact: React__default.FC<TodosCompactProps>;
|
|
1706
|
+
|
|
1707
|
+
interface DiffViewProps {
|
|
1708
|
+
diff: string;
|
|
1709
|
+
}
|
|
1710
|
+
declare function looksLikeDiff(text: string): boolean;
|
|
1711
|
+
declare const DiffView: React__default.FC<DiffViewProps>;
|
|
1712
|
+
|
|
1713
|
+
declare function getToolSummary(toolName: string, input: Record<string, unknown>, result?: ToolResult, overrides?: Record<string, SummaryFn>): ToolSummary;
|
|
1714
|
+
|
|
1715
|
+
interface MinimalToolRowProps {
|
|
1716
|
+
summary: ToolSummary;
|
|
1717
|
+
state: ToolCallState;
|
|
1718
|
+
debug?: boolean;
|
|
1719
|
+
}
|
|
1720
|
+
declare const MinimalToolRow: React__default.FC<MinimalToolRowProps>;
|
|
1721
|
+
|
|
1722
|
+
interface RichToolCardProps {
|
|
1723
|
+
summary: ToolSummary;
|
|
1724
|
+
state: ToolCallState;
|
|
1725
|
+
}
|
|
1726
|
+
declare const RichToolCard: React__default.FC<RichToolCardProps>;
|
|
1727
|
+
|
|
1728
|
+
interface InteractiveToolCardProps {
|
|
1729
|
+
toolCall: ToolCall;
|
|
1730
|
+
state: ToolCallState;
|
|
1731
|
+
rendering: RenderingMode;
|
|
1732
|
+
onComplete: (result: ToolResult) => void;
|
|
1733
|
+
}
|
|
1734
|
+
declare const InteractiveToolCard: React__default.FC<InteractiveToolCardProps>;
|
|
1735
|
+
|
|
1736
|
+
interface RendererContextValue {
|
|
1737
|
+
rendering: RenderingMode;
|
|
1738
|
+
toolSummaryOverrides: Record<string, SummaryFn>;
|
|
1739
|
+
onShowTrace?: (threadId: string) => void;
|
|
1740
|
+
threadId?: string;
|
|
1741
|
+
}
|
|
1742
|
+
declare const RendererContext: React$1.Context<RendererContextValue>;
|
|
1743
|
+
declare const useRendererContext: () => RendererContextValue;
|
|
1744
|
+
|
|
1745
|
+
interface CommandPaletteProps {
|
|
1746
|
+
commands: ChatCommand[];
|
|
1747
|
+
filter: string;
|
|
1748
|
+
onSelect: (event: ChatCommandEvent) => void;
|
|
1749
|
+
onClose: () => void;
|
|
1750
|
+
}
|
|
1751
|
+
declare const CommandPalette: React__default.FC<CommandPaletteProps>;
|
|
1752
|
+
|
|
1753
|
+
interface CommandPillProps {
|
|
1754
|
+
event: ChatCommandEvent;
|
|
1755
|
+
}
|
|
1756
|
+
declare const CommandPill: React__default.FC<CommandPillProps>;
|
|
1757
|
+
|
|
1758
|
+
interface DeveloperModeComponentProps {
|
|
1759
|
+
developerMode: DeveloperMode;
|
|
1760
|
+
threadId: string;
|
|
1761
|
+
verbose: boolean;
|
|
1762
|
+
onToggleVerbose: () => void;
|
|
1763
|
+
diagnoseEnabled: boolean;
|
|
1764
|
+
onToggleDiagnose: () => void;
|
|
1765
|
+
onOpenTrace?: (threadId: string) => void;
|
|
1766
|
+
agentDefinition?: AgentDefinition | null;
|
|
1767
|
+
disabled?: boolean;
|
|
1768
|
+
triggerClassName?: string;
|
|
1769
|
+
triggerIconClassName?: string;
|
|
1770
|
+
}
|
|
1771
|
+
declare function DeveloperModeComponent({ developerMode, threadId, verbose, onToggleVerbose, diagnoseEnabled, onToggleDiagnose, onOpenTrace, agentDefinition, disabled, triggerClassName, triggerIconClassName, }: DeveloperModeComponentProps): react_jsx_runtime.JSX.Element;
|
|
1772
|
+
|
|
1773
|
+
export { ASK_FOLLOW_UP_TOOL_NAME, AgentSelect, type AskFollowUpInput, type AskFollowUpOutput, AssistantMessageRenderer, type AssistantMessageRendererProps, type AttachedImage, AuthLoading, type AuthStatus, Badge, BrowserPreviewPanel, type BrowserToolsOptions, BrowserViewport, type BrowserViewportProps, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Chat, type ChatCommand, type ChatCommandEvent, type ChatCommandId, type ChatContainerProps, type ChatCustomRenderers, type ChatEmptyStateCategory, type ChatEmptyStateController, type ChatEmptyStateOptions, type ChatEmptyStateStarter, ChatInner, ChatInput, type ChatInputProps, type ChatInstance, type ChatProps, type ChatSessionSettings, type ChatState, type ChatStateStore, CommandPalette, CommandPill, ConfigurationPanel, ContextIndicator, type DeveloperDiagnoseConfig, type DeveloperMode, DeveloperModeComponent, type DeveloperTraceConfig, DialogRoot as Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DiffView, type DirectoryTreeNode, type DistriAnyTool, DistriAuthProvider, DistriContext, DistriProvider, type DistriUiTool, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EDIT_TOOL_DEF, EXEC_JS_TOOL_DEF, type EntryType, type ExtractedContent, type FileInfo, type FileRecord, type FilesystemChangeEvent, type FilesystemChangeType, type FollowUpQuestion, GLOB_TOOL_DEF, GREP_TOOL_DEF, HttpToolCard, type HttpToolCardProps, type HttpToolRendererOptions, ImageRenderer, type ImageRendererProps, IndexedDbFilesystem, Input, InteractiveToolCard, LoadingAnimation, type LoadingAnimationConfig, type LoadingAnimationPreset, type LoadingAnimationProps, LoadingShimmer, LoadingStrip, MessageFeedback, type MessageFeedbackProps, MessageReadProvider, type MessageReadProviderProps, MessageReadTracker, type MessageReadTrackerProps, MessageRenderer, type MessageRendererProps, MinimalToolRow, type ModelOption, type PathConfig, type PlanState, READ_TOOL_DEF, type RendererConfig, RendererContext, type RenderingMode, RichToolCard, type SearchMatch, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, StepBasedRenderer, type StepBasedRendererProps, type StepState, type StreamingIndicator, StreamingTextRenderer, type SummaryFn, type TaskState, Textarea, ThemeProvider, ThemeToggle, ThinkingRenderer, type ThinkingRendererProps, TodosCompact, TodosDisplay, type TodosDisplayProps, type ToolCallState, type ToolCallStatus, ToolExecutionRenderer, type ToolRendererMap, type ToolRendererProps, type ToolSummary, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TtsConfig, type TtsMode, TypingIndicator, type UiToolProps, type UseAgentOptions, type UseAgentResult, type UseAgentsByUsageOptions, type UseAgentsByUsageResult, type UseAgentsResult, type UseChatMessagesOptions, type UseChatMessagesReturn, type UseChatOptions, type UseChatReturn, type UseConfigurationResult, type UseMessageReadStatusOptions, type UseMessageReadStatusResult, type UseMessageVoteOptions, type UseMessageVoteResult, type UseMessageVotesOptions, type UseMessageVotesResult, type UseModelsResult, type UseThreadMessagesOptions, type UseThreadReadStatusOptions, type UseThreadReadStatusResult, type UseThreadsOptions, type UseThreadsResult, type UseWorkflowOptions, type UseWorkflowReturn, type UseWorkflowRunnerOptions, type UseWorkflowRunnerReturn, UserMessageRenderer, type UserMessageRendererProps, VoiceInput, type VoiceInputProps, WRITE_TOOL_DEF, WorkflowProgress, type WorkflowProgressProps, createAskFollowUpTool, createBrowserTools, createHttpToolRenderer, extractContent, formatStatusText, getToolSummary, looksLikeDiff, useAgent, useAgentDefinitions, useAgentsByUsage, useChat, useChatMessages, useChatStateStore, useConfiguration, useContextHealth, useDistri, useDistriAuth, useDistriToken, useMessageReadContext, useMessageReadStatus, useMessageVote, useMessageVotes, useModels, useRendererContext, useSidebar, useSpeechToText, useTheme, useThreadReadStatus, useThreads, useTts, useWorkflow, useWorkflowRunner, useWorkspace, wrapFnToolAsUiTool, wrapTools };
|