@distri/core 0.2.7 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +105 -9
- package/dist/index.d.ts +105 -9
- package/dist/index.js +140 -65
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +140 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -143,6 +143,14 @@ interface BrowserScreenshotEvent {
|
|
|
143
143
|
timestamp_ms?: number;
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
interface BrowserSessionStartedEvent {
|
|
147
|
+
type: 'browser_session_started';
|
|
148
|
+
data: {
|
|
149
|
+
session_id: string;
|
|
150
|
+
viewer_url?: string;
|
|
151
|
+
stream_url?: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
146
154
|
interface InlineHookRequestedEvent {
|
|
147
155
|
type: 'inline_hook_requested';
|
|
148
156
|
data: {
|
|
@@ -161,7 +169,7 @@ interface InlineHookRequestedEvent {
|
|
|
161
169
|
result?: any;
|
|
162
170
|
};
|
|
163
171
|
}
|
|
164
|
-
type DistriEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | PlanStartedEvent | PlanFinishedEvent | PlanPrunedEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolExecutionStartEvent | ToolExecutionEndEvent | ToolRejectedEvent | StepStartedEvent | StepCompletedEvent | AgentHandoverEvent | FeedbackReceivedEvent | ToolCallsEvent | ToolResultsEvent | BrowserScreenshotEvent | InlineHookRequestedEvent;
|
|
172
|
+
type DistriEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | PlanStartedEvent | PlanFinishedEvent | PlanPrunedEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolExecutionStartEvent | ToolExecutionEndEvent | ToolRejectedEvent | StepStartedEvent | StepCompletedEvent | AgentHandoverEvent | FeedbackReceivedEvent | ToolCallsEvent | ToolResultsEvent | BrowserScreenshotEvent | BrowserSessionStartedEvent | InlineHookRequestedEvent;
|
|
165
173
|
|
|
166
174
|
type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
167
175
|
interface ChatCompletionMessage {
|
|
@@ -223,6 +231,14 @@ declare class DistriClient {
|
|
|
223
231
|
private refreshPromise?;
|
|
224
232
|
private agentClients;
|
|
225
233
|
constructor(config: DistriClientConfig);
|
|
234
|
+
/**
|
|
235
|
+
* Get the configured client ID.
|
|
236
|
+
*/
|
|
237
|
+
get clientId(): string | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Set the client ID for embed token issuance.
|
|
240
|
+
*/
|
|
241
|
+
set clientId(value: string | undefined);
|
|
226
242
|
/**
|
|
227
243
|
* Create a client with default cloud configuration.
|
|
228
244
|
*
|
|
@@ -296,6 +312,10 @@ declare class DistriClient {
|
|
|
296
312
|
accessToken?: string;
|
|
297
313
|
refreshToken?: string;
|
|
298
314
|
}): void;
|
|
315
|
+
/**
|
|
316
|
+
* Reset all authentication tokens.
|
|
317
|
+
*/
|
|
318
|
+
resetTokens(): void;
|
|
299
319
|
/**
|
|
300
320
|
* Start streaming speech-to-text transcription via WebSocket
|
|
301
321
|
*/
|
|
@@ -323,6 +343,12 @@ declare class DistriClient {
|
|
|
323
343
|
* Get specific agent by ID
|
|
324
344
|
*/
|
|
325
345
|
getAgent(agentId: string): Promise<AgentConfigWithTools>;
|
|
346
|
+
/**
|
|
347
|
+
* Update an agent's definition (markdown only)
|
|
348
|
+
*/
|
|
349
|
+
updateAgent(agentId: string, update: {
|
|
350
|
+
markdown: string;
|
|
351
|
+
}): Promise<AgentConfigWithTools>;
|
|
326
352
|
/**
|
|
327
353
|
* Get or create A2AClient for an agent
|
|
328
354
|
*/
|
|
@@ -344,9 +370,18 @@ declare class DistriClient {
|
|
|
344
370
|
*/
|
|
345
371
|
cancelTask(agentId: string, taskId: string): Promise<void>;
|
|
346
372
|
/**
|
|
347
|
-
* Get threads from Distri server
|
|
373
|
+
* Get threads from Distri server with filtering and pagination
|
|
348
374
|
*/
|
|
349
|
-
getThreads(): Promise<
|
|
375
|
+
getThreads(params?: ThreadListParams): Promise<ThreadListResponse>;
|
|
376
|
+
/**
|
|
377
|
+
* Get agents sorted by thread count (most active first)
|
|
378
|
+
*/
|
|
379
|
+
getAgentsByUsage(): Promise<AgentUsageInfo[]>;
|
|
380
|
+
/**
|
|
381
|
+
* Create a new browser session
|
|
382
|
+
* Returns session info including viewer_url and stream_url from browsr
|
|
383
|
+
*/
|
|
384
|
+
createBrowserSession(): Promise<BrowserSession>;
|
|
350
385
|
getThread(threadId: string): Promise<DistriThread>;
|
|
351
386
|
/**
|
|
352
387
|
* Get thread messages
|
|
@@ -373,6 +408,9 @@ declare class DistriClient {
|
|
|
373
408
|
*/
|
|
374
409
|
get baseUrl(): string;
|
|
375
410
|
private applyTokens;
|
|
411
|
+
/**
|
|
412
|
+
* Ensure access token is valid, refreshing if necessary
|
|
413
|
+
*/
|
|
376
414
|
private ensureAccessToken;
|
|
377
415
|
private refreshTokens;
|
|
378
416
|
private performTokenRefresh;
|
|
@@ -801,6 +839,16 @@ interface AgentDefinition {
|
|
|
801
839
|
context_size?: number;
|
|
802
840
|
tools?: DistriBaseTool[];
|
|
803
841
|
browser_config?: BrowserAgentConfig;
|
|
842
|
+
/** Agent usage statistics */
|
|
843
|
+
stats?: AgentStats;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Agent usage statistics
|
|
847
|
+
*/
|
|
848
|
+
interface AgentStats {
|
|
849
|
+
thread_count: number;
|
|
850
|
+
sub_agent_usage_count: number;
|
|
851
|
+
last_used_at?: string | null;
|
|
804
852
|
}
|
|
805
853
|
interface BrowserAgentConfig {
|
|
806
854
|
enabled?: boolean;
|
|
@@ -861,6 +909,9 @@ interface DistriThread {
|
|
|
861
909
|
updated_at: string;
|
|
862
910
|
message_count: number;
|
|
863
911
|
last_message?: string;
|
|
912
|
+
user_id?: string;
|
|
913
|
+
external_id?: string;
|
|
914
|
+
tags?: string[];
|
|
864
915
|
}
|
|
865
916
|
interface Thread {
|
|
866
917
|
id: string;
|
|
@@ -870,6 +921,49 @@ interface Thread {
|
|
|
870
921
|
updated_at: string;
|
|
871
922
|
message_count: number;
|
|
872
923
|
last_message?: string;
|
|
924
|
+
user_id?: string;
|
|
925
|
+
external_id?: string;
|
|
926
|
+
tags?: string[];
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Parameters for listing threads with filtering and pagination
|
|
930
|
+
*/
|
|
931
|
+
interface ThreadListParams {
|
|
932
|
+
agent_id?: string;
|
|
933
|
+
external_id?: string;
|
|
934
|
+
search?: string;
|
|
935
|
+
from_date?: string;
|
|
936
|
+
to_date?: string;
|
|
937
|
+
tags?: string[];
|
|
938
|
+
limit?: number;
|
|
939
|
+
offset?: number;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Paginated response for thread listing
|
|
943
|
+
*/
|
|
944
|
+
interface ThreadListResponse {
|
|
945
|
+
threads: DistriThread[];
|
|
946
|
+
total: number;
|
|
947
|
+
page: number;
|
|
948
|
+
page_size: number;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Agent usage information for sorting agents by thread count
|
|
952
|
+
*/
|
|
953
|
+
interface AgentUsageInfo {
|
|
954
|
+
agent_id: string;
|
|
955
|
+
agent_name: string;
|
|
956
|
+
thread_count: number;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Browser session info returned when creating a session
|
|
960
|
+
*/
|
|
961
|
+
interface BrowserSession {
|
|
962
|
+
session_id: string;
|
|
963
|
+
/** SSE stream URL (backend API) for event streaming */
|
|
964
|
+
sse_url?: string;
|
|
965
|
+
/** Frame URL for embedding (frontend app with token) */
|
|
966
|
+
frame_url?: string;
|
|
873
967
|
}
|
|
874
968
|
interface ChatProps {
|
|
875
969
|
thread: Thread;
|
|
@@ -932,6 +1026,11 @@ interface DistriClientConfig {
|
|
|
932
1026
|
* Request interceptor for modifying requests before sending
|
|
933
1027
|
*/
|
|
934
1028
|
interceptor?: (init?: RequestInit) => Promise<RequestInit | undefined>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Hook to refresh the access token when it expires.
|
|
1031
|
+
* Useful for public clients where only an access token is available.
|
|
1032
|
+
*/
|
|
1033
|
+
onTokenRefresh?: () => Promise<string | null>;
|
|
935
1034
|
/**
|
|
936
1035
|
* Access token for bearer auth (optional)
|
|
937
1036
|
*/
|
|
@@ -945,12 +1044,9 @@ interface DistriClientConfig {
|
|
|
945
1044
|
*/
|
|
946
1045
|
tokenRefreshSkewMs?: number;
|
|
947
1046
|
/**
|
|
948
|
-
*
|
|
1047
|
+
* Client ID from Distri Cloud.
|
|
949
1048
|
*/
|
|
950
|
-
|
|
951
|
-
accessToken: string;
|
|
952
|
-
refreshToken: string;
|
|
953
|
-
}) => void;
|
|
1049
|
+
clientId?: string;
|
|
954
1050
|
}
|
|
955
1051
|
interface LLMResponse {
|
|
956
1052
|
finish_reason: string;
|
|
@@ -1061,4 +1157,4 @@ declare function extractToolCallsFromDistriMessage(message: DistriMessage): any[
|
|
|
1061
1157
|
*/
|
|
1062
1158
|
declare function extractToolResultsFromDistriMessage(message: DistriMessage): any[];
|
|
1063
1159
|
|
|
1064
|
-
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, type AgentConfigWithTools, type AgentDefinition, type AgentHandoverEvent, ApiError, type AssistantWithToolCalls, type BasePlanStep, type BatchToolCallsStep, type BrowserAgentConfig, type BrowserScreenshotEvent, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionResponseFormat, type ChatCompletionRole, type ChatProps, type CodePlanStep, type ConfigurationMeta, type ConfigurationResponse, ConnectionError, type ConnectionStatus, DEFAULT_BASE_URL, type DataPart, type DistriBaseTool, type DistriBrowserRuntimeConfig, type DistriChatMessage, DistriClient, type DistriClientConfig, type DistriConfiguration, DistriError, type DistriEvent, type DistriFnTool, type DistriMessage, type DistriPart, type DistriPlan, type DistriStreamEvent, type DistriThread, type ExternalMcpServer, ExternalToolValidationError, type ExternalToolValidationResult, type FeedbackReceivedEvent, type FileBytes, type FileType, type FileUrl, type FinalResultPlanStep, type HookContext, type HookHandler, type HookMutation, type ImagePart, type InlineHookEventData, type InlineHookRequest, type InlineHookRequestedEvent, type InvokeConfig, type InvokeContext, type InvokeResult, type LLMResponse, type LlmExecuteOptions, type LlmPlanStep, type McpDefinition, type McpServerType, type MessageRole, type ModelProviderConfig, type ModelProviderName, type ModelSettings, type PlanAction, type PlanFinishedEvent, type PlanPrunedEvent, type PlanStartedEvent, type PlanStep, type ReactStep, type Role, type RunErrorEvent, type RunFinishedEvent, type RunStartedEvent, type ServerConfig, type SpeechToTextConfig, type StepCompletedEvent, type StepStartedEvent, type StreamingTranscriptionOptions, type TextMessageContentEvent, type TextMessageEndEvent, type TextMessageStartEvent, type TextPart, type ThoughtPlanStep, type ThoughtStep, type Thread, type ToolCall, type ToolCallPart, type ToolCallsEvent, type ToolDefinition, type ToolExecutionEndEvent, type ToolExecutionOptions, type ToolExecutionStartEvent, type ToolHandler, type ToolRejectedEvent, type ToolResult, type ToolResultData, type ToolResultRefPart, type ToolResults, type ToolResultsEvent, type UseToolsOptions, convertA2AMessageToDistri, convertA2APartToDistri, convertA2AStatusUpdateToDistri, convertDistriMessageToA2A, convertDistriPartToA2A, createFailedToolResult, createSuccessfulToolResult, decodeA2AStreamEvent, extractTextFromDistriMessage, extractToolCallsFromDistriMessage, extractToolResultData, extractToolResultsFromDistriMessage, isArrayParts, isDistriEvent, isDistriMessage, processA2AMessagesData, processA2AStreamData, uuidv4 };
|
|
1160
|
+
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, type AgentConfigWithTools, type AgentDefinition, type AgentHandoverEvent, type AgentStats, type AgentUsageInfo, ApiError, type AssistantWithToolCalls, type BasePlanStep, type BatchToolCallsStep, type BrowserAgentConfig, type BrowserScreenshotEvent, type BrowserSession, type BrowserSessionStartedEvent, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionResponseFormat, type ChatCompletionRole, type ChatProps, type CodePlanStep, type ConfigurationMeta, type ConfigurationResponse, ConnectionError, type ConnectionStatus, DEFAULT_BASE_URL, type DataPart, type DistriBaseTool, type DistriBrowserRuntimeConfig, type DistriChatMessage, DistriClient, type DistriClientConfig, type DistriConfiguration, DistriError, type DistriEvent, type DistriFnTool, type DistriMessage, type DistriPart, type DistriPlan, type DistriStreamEvent, type DistriThread, type ExternalMcpServer, ExternalToolValidationError, type ExternalToolValidationResult, type FeedbackReceivedEvent, type FileBytes, type FileType, type FileUrl, type FinalResultPlanStep, type HookContext, type HookHandler, type HookMutation, type ImagePart, type InlineHookEventData, type InlineHookRequest, type InlineHookRequestedEvent, type InvokeConfig, type InvokeContext, type InvokeResult, type LLMResponse, type LlmExecuteOptions, type LlmPlanStep, type McpDefinition, type McpServerType, type MessageRole, type ModelProviderConfig, type ModelProviderName, type ModelSettings, type PlanAction, type PlanFinishedEvent, type PlanPrunedEvent, type PlanStartedEvent, type PlanStep, type ReactStep, type Role, type RunErrorEvent, type RunFinishedEvent, type RunStartedEvent, type ServerConfig, type SpeechToTextConfig, type StepCompletedEvent, type StepStartedEvent, type StreamingTranscriptionOptions, type TextMessageContentEvent, type TextMessageEndEvent, type TextMessageStartEvent, type TextPart, type ThoughtPlanStep, type ThoughtStep, type Thread, type ThreadListParams, type ThreadListResponse, type ToolCall, type ToolCallPart, type ToolCallsEvent, type ToolDefinition, type ToolExecutionEndEvent, type ToolExecutionOptions, type ToolExecutionStartEvent, type ToolHandler, type ToolRejectedEvent, type ToolResult, type ToolResultData, type ToolResultRefPart, type ToolResults, type ToolResultsEvent, type UseToolsOptions, convertA2AMessageToDistri, convertA2APartToDistri, convertA2AStatusUpdateToDistri, convertDistriMessageToA2A, convertDistriPartToA2A, createFailedToolResult, createSuccessfulToolResult, decodeA2AStreamEvent, extractTextFromDistriMessage, extractToolCallsFromDistriMessage, extractToolResultData, extractToolResultsFromDistriMessage, isArrayParts, isDistriEvent, isDistriMessage, processA2AMessagesData, processA2AStreamData, uuidv4 };
|
package/dist/index.d.ts
CHANGED
|
@@ -143,6 +143,14 @@ interface BrowserScreenshotEvent {
|
|
|
143
143
|
timestamp_ms?: number;
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
|
+
interface BrowserSessionStartedEvent {
|
|
147
|
+
type: 'browser_session_started';
|
|
148
|
+
data: {
|
|
149
|
+
session_id: string;
|
|
150
|
+
viewer_url?: string;
|
|
151
|
+
stream_url?: string;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
146
154
|
interface InlineHookRequestedEvent {
|
|
147
155
|
type: 'inline_hook_requested';
|
|
148
156
|
data: {
|
|
@@ -161,7 +169,7 @@ interface InlineHookRequestedEvent {
|
|
|
161
169
|
result?: any;
|
|
162
170
|
};
|
|
163
171
|
}
|
|
164
|
-
type DistriEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | PlanStartedEvent | PlanFinishedEvent | PlanPrunedEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolExecutionStartEvent | ToolExecutionEndEvent | ToolRejectedEvent | StepStartedEvent | StepCompletedEvent | AgentHandoverEvent | FeedbackReceivedEvent | ToolCallsEvent | ToolResultsEvent | BrowserScreenshotEvent | InlineHookRequestedEvent;
|
|
172
|
+
type DistriEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | PlanStartedEvent | PlanFinishedEvent | PlanPrunedEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolExecutionStartEvent | ToolExecutionEndEvent | ToolRejectedEvent | StepStartedEvent | StepCompletedEvent | AgentHandoverEvent | FeedbackReceivedEvent | ToolCallsEvent | ToolResultsEvent | BrowserScreenshotEvent | BrowserSessionStartedEvent | InlineHookRequestedEvent;
|
|
165
173
|
|
|
166
174
|
type ChatCompletionRole = 'system' | 'user' | 'assistant' | 'tool';
|
|
167
175
|
interface ChatCompletionMessage {
|
|
@@ -223,6 +231,14 @@ declare class DistriClient {
|
|
|
223
231
|
private refreshPromise?;
|
|
224
232
|
private agentClients;
|
|
225
233
|
constructor(config: DistriClientConfig);
|
|
234
|
+
/**
|
|
235
|
+
* Get the configured client ID.
|
|
236
|
+
*/
|
|
237
|
+
get clientId(): string | undefined;
|
|
238
|
+
/**
|
|
239
|
+
* Set the client ID for embed token issuance.
|
|
240
|
+
*/
|
|
241
|
+
set clientId(value: string | undefined);
|
|
226
242
|
/**
|
|
227
243
|
* Create a client with default cloud configuration.
|
|
228
244
|
*
|
|
@@ -296,6 +312,10 @@ declare class DistriClient {
|
|
|
296
312
|
accessToken?: string;
|
|
297
313
|
refreshToken?: string;
|
|
298
314
|
}): void;
|
|
315
|
+
/**
|
|
316
|
+
* Reset all authentication tokens.
|
|
317
|
+
*/
|
|
318
|
+
resetTokens(): void;
|
|
299
319
|
/**
|
|
300
320
|
* Start streaming speech-to-text transcription via WebSocket
|
|
301
321
|
*/
|
|
@@ -323,6 +343,12 @@ declare class DistriClient {
|
|
|
323
343
|
* Get specific agent by ID
|
|
324
344
|
*/
|
|
325
345
|
getAgent(agentId: string): Promise<AgentConfigWithTools>;
|
|
346
|
+
/**
|
|
347
|
+
* Update an agent's definition (markdown only)
|
|
348
|
+
*/
|
|
349
|
+
updateAgent(agentId: string, update: {
|
|
350
|
+
markdown: string;
|
|
351
|
+
}): Promise<AgentConfigWithTools>;
|
|
326
352
|
/**
|
|
327
353
|
* Get or create A2AClient for an agent
|
|
328
354
|
*/
|
|
@@ -344,9 +370,18 @@ declare class DistriClient {
|
|
|
344
370
|
*/
|
|
345
371
|
cancelTask(agentId: string, taskId: string): Promise<void>;
|
|
346
372
|
/**
|
|
347
|
-
* Get threads from Distri server
|
|
373
|
+
* Get threads from Distri server with filtering and pagination
|
|
348
374
|
*/
|
|
349
|
-
getThreads(): Promise<
|
|
375
|
+
getThreads(params?: ThreadListParams): Promise<ThreadListResponse>;
|
|
376
|
+
/**
|
|
377
|
+
* Get agents sorted by thread count (most active first)
|
|
378
|
+
*/
|
|
379
|
+
getAgentsByUsage(): Promise<AgentUsageInfo[]>;
|
|
380
|
+
/**
|
|
381
|
+
* Create a new browser session
|
|
382
|
+
* Returns session info including viewer_url and stream_url from browsr
|
|
383
|
+
*/
|
|
384
|
+
createBrowserSession(): Promise<BrowserSession>;
|
|
350
385
|
getThread(threadId: string): Promise<DistriThread>;
|
|
351
386
|
/**
|
|
352
387
|
* Get thread messages
|
|
@@ -373,6 +408,9 @@ declare class DistriClient {
|
|
|
373
408
|
*/
|
|
374
409
|
get baseUrl(): string;
|
|
375
410
|
private applyTokens;
|
|
411
|
+
/**
|
|
412
|
+
* Ensure access token is valid, refreshing if necessary
|
|
413
|
+
*/
|
|
376
414
|
private ensureAccessToken;
|
|
377
415
|
private refreshTokens;
|
|
378
416
|
private performTokenRefresh;
|
|
@@ -801,6 +839,16 @@ interface AgentDefinition {
|
|
|
801
839
|
context_size?: number;
|
|
802
840
|
tools?: DistriBaseTool[];
|
|
803
841
|
browser_config?: BrowserAgentConfig;
|
|
842
|
+
/** Agent usage statistics */
|
|
843
|
+
stats?: AgentStats;
|
|
844
|
+
}
|
|
845
|
+
/**
|
|
846
|
+
* Agent usage statistics
|
|
847
|
+
*/
|
|
848
|
+
interface AgentStats {
|
|
849
|
+
thread_count: number;
|
|
850
|
+
sub_agent_usage_count: number;
|
|
851
|
+
last_used_at?: string | null;
|
|
804
852
|
}
|
|
805
853
|
interface BrowserAgentConfig {
|
|
806
854
|
enabled?: boolean;
|
|
@@ -861,6 +909,9 @@ interface DistriThread {
|
|
|
861
909
|
updated_at: string;
|
|
862
910
|
message_count: number;
|
|
863
911
|
last_message?: string;
|
|
912
|
+
user_id?: string;
|
|
913
|
+
external_id?: string;
|
|
914
|
+
tags?: string[];
|
|
864
915
|
}
|
|
865
916
|
interface Thread {
|
|
866
917
|
id: string;
|
|
@@ -870,6 +921,49 @@ interface Thread {
|
|
|
870
921
|
updated_at: string;
|
|
871
922
|
message_count: number;
|
|
872
923
|
last_message?: string;
|
|
924
|
+
user_id?: string;
|
|
925
|
+
external_id?: string;
|
|
926
|
+
tags?: string[];
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Parameters for listing threads with filtering and pagination
|
|
930
|
+
*/
|
|
931
|
+
interface ThreadListParams {
|
|
932
|
+
agent_id?: string;
|
|
933
|
+
external_id?: string;
|
|
934
|
+
search?: string;
|
|
935
|
+
from_date?: string;
|
|
936
|
+
to_date?: string;
|
|
937
|
+
tags?: string[];
|
|
938
|
+
limit?: number;
|
|
939
|
+
offset?: number;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Paginated response for thread listing
|
|
943
|
+
*/
|
|
944
|
+
interface ThreadListResponse {
|
|
945
|
+
threads: DistriThread[];
|
|
946
|
+
total: number;
|
|
947
|
+
page: number;
|
|
948
|
+
page_size: number;
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Agent usage information for sorting agents by thread count
|
|
952
|
+
*/
|
|
953
|
+
interface AgentUsageInfo {
|
|
954
|
+
agent_id: string;
|
|
955
|
+
agent_name: string;
|
|
956
|
+
thread_count: number;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Browser session info returned when creating a session
|
|
960
|
+
*/
|
|
961
|
+
interface BrowserSession {
|
|
962
|
+
session_id: string;
|
|
963
|
+
/** SSE stream URL (backend API) for event streaming */
|
|
964
|
+
sse_url?: string;
|
|
965
|
+
/** Frame URL for embedding (frontend app with token) */
|
|
966
|
+
frame_url?: string;
|
|
873
967
|
}
|
|
874
968
|
interface ChatProps {
|
|
875
969
|
thread: Thread;
|
|
@@ -932,6 +1026,11 @@ interface DistriClientConfig {
|
|
|
932
1026
|
* Request interceptor for modifying requests before sending
|
|
933
1027
|
*/
|
|
934
1028
|
interceptor?: (init?: RequestInit) => Promise<RequestInit | undefined>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Hook to refresh the access token when it expires.
|
|
1031
|
+
* Useful for public clients where only an access token is available.
|
|
1032
|
+
*/
|
|
1033
|
+
onTokenRefresh?: () => Promise<string | null>;
|
|
935
1034
|
/**
|
|
936
1035
|
* Access token for bearer auth (optional)
|
|
937
1036
|
*/
|
|
@@ -945,12 +1044,9 @@ interface DistriClientConfig {
|
|
|
945
1044
|
*/
|
|
946
1045
|
tokenRefreshSkewMs?: number;
|
|
947
1046
|
/**
|
|
948
|
-
*
|
|
1047
|
+
* Client ID from Distri Cloud.
|
|
949
1048
|
*/
|
|
950
|
-
|
|
951
|
-
accessToken: string;
|
|
952
|
-
refreshToken: string;
|
|
953
|
-
}) => void;
|
|
1049
|
+
clientId?: string;
|
|
954
1050
|
}
|
|
955
1051
|
interface LLMResponse {
|
|
956
1052
|
finish_reason: string;
|
|
@@ -1061,4 +1157,4 @@ declare function extractToolCallsFromDistriMessage(message: DistriMessage): any[
|
|
|
1061
1157
|
*/
|
|
1062
1158
|
declare function extractToolResultsFromDistriMessage(message: DistriMessage): any[];
|
|
1063
1159
|
|
|
1064
|
-
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, type AgentConfigWithTools, type AgentDefinition, type AgentHandoverEvent, ApiError, type AssistantWithToolCalls, type BasePlanStep, type BatchToolCallsStep, type BrowserAgentConfig, type BrowserScreenshotEvent, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionResponseFormat, type ChatCompletionRole, type ChatProps, type CodePlanStep, type ConfigurationMeta, type ConfigurationResponse, ConnectionError, type ConnectionStatus, DEFAULT_BASE_URL, type DataPart, type DistriBaseTool, type DistriBrowserRuntimeConfig, type DistriChatMessage, DistriClient, type DistriClientConfig, type DistriConfiguration, DistriError, type DistriEvent, type DistriFnTool, type DistriMessage, type DistriPart, type DistriPlan, type DistriStreamEvent, type DistriThread, type ExternalMcpServer, ExternalToolValidationError, type ExternalToolValidationResult, type FeedbackReceivedEvent, type FileBytes, type FileType, type FileUrl, type FinalResultPlanStep, type HookContext, type HookHandler, type HookMutation, type ImagePart, type InlineHookEventData, type InlineHookRequest, type InlineHookRequestedEvent, type InvokeConfig, type InvokeContext, type InvokeResult, type LLMResponse, type LlmExecuteOptions, type LlmPlanStep, type McpDefinition, type McpServerType, type MessageRole, type ModelProviderConfig, type ModelProviderName, type ModelSettings, type PlanAction, type PlanFinishedEvent, type PlanPrunedEvent, type PlanStartedEvent, type PlanStep, type ReactStep, type Role, type RunErrorEvent, type RunFinishedEvent, type RunStartedEvent, type ServerConfig, type SpeechToTextConfig, type StepCompletedEvent, type StepStartedEvent, type StreamingTranscriptionOptions, type TextMessageContentEvent, type TextMessageEndEvent, type TextMessageStartEvent, type TextPart, type ThoughtPlanStep, type ThoughtStep, type Thread, type ToolCall, type ToolCallPart, type ToolCallsEvent, type ToolDefinition, type ToolExecutionEndEvent, type ToolExecutionOptions, type ToolExecutionStartEvent, type ToolHandler, type ToolRejectedEvent, type ToolResult, type ToolResultData, type ToolResultRefPart, type ToolResults, type ToolResultsEvent, type UseToolsOptions, convertA2AMessageToDistri, convertA2APartToDistri, convertA2AStatusUpdateToDistri, convertDistriMessageToA2A, convertDistriPartToA2A, createFailedToolResult, createSuccessfulToolResult, decodeA2AStreamEvent, extractTextFromDistriMessage, extractToolCallsFromDistriMessage, extractToolResultData, extractToolResultsFromDistriMessage, isArrayParts, isDistriEvent, isDistriMessage, processA2AMessagesData, processA2AStreamData, uuidv4 };
|
|
1160
|
+
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, type AgentConfigWithTools, type AgentDefinition, type AgentHandoverEvent, type AgentStats, type AgentUsageInfo, ApiError, type AssistantWithToolCalls, type BasePlanStep, type BatchToolCallsStep, type BrowserAgentConfig, type BrowserScreenshotEvent, type BrowserSession, type BrowserSessionStartedEvent, type ChatCompletionChoice, type ChatCompletionMessage, type ChatCompletionRequest, type ChatCompletionResponse, type ChatCompletionResponseFormat, type ChatCompletionRole, type ChatProps, type CodePlanStep, type ConfigurationMeta, type ConfigurationResponse, ConnectionError, type ConnectionStatus, DEFAULT_BASE_URL, type DataPart, type DistriBaseTool, type DistriBrowserRuntimeConfig, type DistriChatMessage, DistriClient, type DistriClientConfig, type DistriConfiguration, DistriError, type DistriEvent, type DistriFnTool, type DistriMessage, type DistriPart, type DistriPlan, type DistriStreamEvent, type DistriThread, type ExternalMcpServer, ExternalToolValidationError, type ExternalToolValidationResult, type FeedbackReceivedEvent, type FileBytes, type FileType, type FileUrl, type FinalResultPlanStep, type HookContext, type HookHandler, type HookMutation, type ImagePart, type InlineHookEventData, type InlineHookRequest, type InlineHookRequestedEvent, type InvokeConfig, type InvokeContext, type InvokeResult, type LLMResponse, type LlmExecuteOptions, type LlmPlanStep, type McpDefinition, type McpServerType, type MessageRole, type ModelProviderConfig, type ModelProviderName, type ModelSettings, type PlanAction, type PlanFinishedEvent, type PlanPrunedEvent, type PlanStartedEvent, type PlanStep, type ReactStep, type Role, type RunErrorEvent, type RunFinishedEvent, type RunStartedEvent, type ServerConfig, type SpeechToTextConfig, type StepCompletedEvent, type StepStartedEvent, type StreamingTranscriptionOptions, type TextMessageContentEvent, type TextMessageEndEvent, type TextMessageStartEvent, type TextPart, type ThoughtPlanStep, type ThoughtStep, type Thread, type ThreadListParams, type ThreadListResponse, type ToolCall, type ToolCallPart, type ToolCallsEvent, type ToolDefinition, type ToolExecutionEndEvent, type ToolExecutionOptions, type ToolExecutionStartEvent, type ToolHandler, type ToolRejectedEvent, type ToolResult, type ToolResultData, type ToolResultRefPart, type ToolResults, type ToolResultsEvent, type UseToolsOptions, convertA2AMessageToDistri, convertA2APartToDistri, convertA2AStatusUpdateToDistri, convertDistriMessageToA2A, convertDistriPartToA2A, createFailedToolResult, createSuccessfulToolResult, decodeA2AStreamEvent, extractTextFromDistriMessage, extractToolCallsFromDistriMessage, extractToolResultData, extractToolResultsFromDistriMessage, isArrayParts, isDistriEvent, isDistriMessage, processA2AMessagesData, processA2AStreamData, uuidv4 };
|