@distri/core 0.2.5 → 0.2.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/README.md +60 -1
- package/dist/index.d.mts +23 -31
- package/dist/index.d.ts +23 -31
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -137,4 +137,63 @@ const part: DistriPart = {
|
|
|
137
137
|
code: 'console.log("Hello");'
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
|
-
```
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Session Store API
|
|
143
|
+
|
|
144
|
+
The `DistriClient` provides a comprehensive session store API for managing thread-scoped key-value storage.
|
|
145
|
+
|
|
146
|
+
### Basic Operations
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { DistriClient } from '@distri/core';
|
|
150
|
+
|
|
151
|
+
const client = DistriClient.create();
|
|
152
|
+
const sessionId = 'thread-123';
|
|
153
|
+
|
|
154
|
+
// Set a session value
|
|
155
|
+
await client.setSessionValue(sessionId, 'key', { data: 'value' });
|
|
156
|
+
|
|
157
|
+
// Get a session value
|
|
158
|
+
const value = await client.getSessionValue(sessionId, 'key');
|
|
159
|
+
|
|
160
|
+
// Get all session values (returns a map)
|
|
161
|
+
const allValues = await client.getSessionValues(sessionId);
|
|
162
|
+
|
|
163
|
+
// Delete a session value
|
|
164
|
+
await client.deleteSessionValue(sessionId, 'key');
|
|
165
|
+
|
|
166
|
+
// Clear all session values
|
|
167
|
+
await client.clearSession(sessionId);
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### API Endpoints
|
|
171
|
+
|
|
172
|
+
All session methods use the following endpoints (mounted at `/v1/sessions/`):
|
|
173
|
+
|
|
174
|
+
- `POST /sessions/{sessionId}/values` - Set a session value
|
|
175
|
+
- `GET /sessions/{sessionId}/values` - Get all session values (returns map)
|
|
176
|
+
- `GET /sessions/{sessionId}/values/{key}` - Get a specific session value
|
|
177
|
+
- `DELETE /sessions/{sessionId}/values/{key}` - Delete a session value
|
|
178
|
+
- `DELETE /sessions/{sessionId}` - Clear all session values
|
|
179
|
+
|
|
180
|
+
### Integration with Agent Definitions
|
|
181
|
+
|
|
182
|
+
Session values can be referenced in agent definitions using `UserMessageOverrides`:
|
|
183
|
+
|
|
184
|
+
```yaml
|
|
185
|
+
# Agent definition
|
|
186
|
+
user_message_overrides:
|
|
187
|
+
parts:
|
|
188
|
+
- type: session_key
|
|
189
|
+
key: "observation" # References session value with key "observation"
|
|
190
|
+
- type: template
|
|
191
|
+
template: "custom_user_template"
|
|
192
|
+
include_artifacts: true
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
When the agent processes a message, it will automatically:
|
|
196
|
+
1. Load all session values as a map
|
|
197
|
+
2. Resolve `PartDefinition::SessionKey` references from the map
|
|
198
|
+
3. Merge override parts with the default message parts
|
|
199
|
+
4. Include the merged message in the LLM prompt
|
package/dist/index.d.mts
CHANGED
|
@@ -257,25 +257,6 @@ declare class DistriClient {
|
|
|
257
257
|
* Session store: clear all keys in a session
|
|
258
258
|
*/
|
|
259
259
|
clearSession(sessionId: string): Promise<void>;
|
|
260
|
-
private static readonly ADDITIONAL_PARTS_KEY;
|
|
261
|
-
/**
|
|
262
|
-
* Set additional user message parts for the next agent iteration.
|
|
263
|
-
* These parts will be appended to the user message in the prompt.
|
|
264
|
-
* @param sessionId - The thread/session ID
|
|
265
|
-
* @param parts - Array of DistriPart objects to append to user message
|
|
266
|
-
*/
|
|
267
|
-
setAdditionalUserParts(sessionId: string, parts: DistriPart[]): Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* Get the current additional user message parts.
|
|
270
|
-
* @param sessionId - The thread/session ID
|
|
271
|
-
* @returns Array of DistriPart objects or null if not set
|
|
272
|
-
*/
|
|
273
|
-
getAdditionalUserParts(sessionId: string): Promise<DistriPart[] | null>;
|
|
274
|
-
/**
|
|
275
|
-
* Clear/delete the additional user message parts.
|
|
276
|
-
* @param sessionId - The thread/session ID
|
|
277
|
-
*/
|
|
278
|
-
clearAdditionalUserParts(sessionId: string): Promise<void>;
|
|
279
260
|
/**
|
|
280
261
|
* Response from the token endpoint
|
|
281
262
|
*/
|
|
@@ -341,7 +322,7 @@ declare class DistriClient {
|
|
|
341
322
|
/**
|
|
342
323
|
* Get specific agent by ID
|
|
343
324
|
*/
|
|
344
|
-
getAgent(agentId: string): Promise<
|
|
325
|
+
getAgent(agentId: string): Promise<AgentConfigWithTools>;
|
|
345
326
|
/**
|
|
346
327
|
* Get or create A2AClient for an agent
|
|
347
328
|
*/
|
|
@@ -405,9 +386,10 @@ declare class DistriClient {
|
|
|
405
386
|
*/
|
|
406
387
|
private fetchAbsolute;
|
|
407
388
|
/**
|
|
408
|
-
* Enhanced fetch with retry logic
|
|
389
|
+
* Enhanced fetch with retry logic and auth headers.
|
|
390
|
+
* Exposed publicly for extensions like DistriHomeClient.
|
|
409
391
|
*/
|
|
410
|
-
|
|
392
|
+
fetch(input: RequestInfo | URL, initialInit?: RequestInit): Promise<Response>;
|
|
411
393
|
/**
|
|
412
394
|
* Delay utility
|
|
413
395
|
*/
|
|
@@ -479,7 +461,7 @@ declare class Agent {
|
|
|
479
461
|
private agentDefinition;
|
|
480
462
|
private hookHandlers;
|
|
481
463
|
private defaultHookHandler;
|
|
482
|
-
constructor(agentDefinition:
|
|
464
|
+
constructor(agentDefinition: AgentConfigWithTools, client: DistriClient);
|
|
483
465
|
/**
|
|
484
466
|
* Get agent information
|
|
485
467
|
*/
|
|
@@ -491,7 +473,7 @@ declare class Agent {
|
|
|
491
473
|
/**
|
|
492
474
|
* Get the full agent definition (including backend tools)
|
|
493
475
|
*/
|
|
494
|
-
getDefinition():
|
|
476
|
+
getDefinition(): AgentConfigWithTools;
|
|
495
477
|
/**
|
|
496
478
|
* Fetch messages for a thread (public method for useChat)
|
|
497
479
|
*/
|
|
@@ -524,7 +506,7 @@ declare class Agent {
|
|
|
524
506
|
/**
|
|
525
507
|
* Create an agent instance from an agent ID
|
|
526
508
|
*/
|
|
527
|
-
static create(agentIdOrDef: string |
|
|
509
|
+
static create(agentIdOrDef: string | AgentConfigWithTools, client: DistriClient): Promise<Agent>;
|
|
528
510
|
/**
|
|
529
511
|
* Complete an external tool call by sending the result back to the server
|
|
530
512
|
*/
|
|
@@ -713,14 +695,18 @@ interface FileUrl {
|
|
|
713
695
|
name?: string;
|
|
714
696
|
}
|
|
715
697
|
type FileType = FileBytes | FileUrl;
|
|
698
|
+
interface ToolDefinition {
|
|
699
|
+
name: string;
|
|
700
|
+
description: string;
|
|
701
|
+
parameters: object;
|
|
702
|
+
examples?: string;
|
|
703
|
+
output_schema?: object;
|
|
704
|
+
}
|
|
716
705
|
/**
|
|
717
706
|
* Tool definition interface following AG-UI pattern
|
|
718
707
|
*/
|
|
719
|
-
interface DistriBaseTool {
|
|
720
|
-
name: string;
|
|
708
|
+
interface DistriBaseTool extends ToolDefinition {
|
|
721
709
|
type: 'function' | 'ui';
|
|
722
|
-
description: string;
|
|
723
|
-
parameters: object;
|
|
724
710
|
is_final?: boolean;
|
|
725
711
|
autoExecute?: boolean;
|
|
726
712
|
isExternal?: boolean;
|
|
@@ -776,6 +762,10 @@ declare function createFailedToolResult(toolCallId: string, toolName: string, er
|
|
|
776
762
|
* Handles both frontend DistriPart format and backend BackendPart format
|
|
777
763
|
*/
|
|
778
764
|
declare function extractToolResultData(toolResult: ToolResult): ToolResultData | null;
|
|
765
|
+
interface AgentConfigWithTools extends AgentDefinition {
|
|
766
|
+
markdown?: string;
|
|
767
|
+
resolved_tools?: ToolDefinition[];
|
|
768
|
+
}
|
|
779
769
|
/**
|
|
780
770
|
* Distri-specific Agent type that wraps A2A AgentCard
|
|
781
771
|
*/
|
|
@@ -795,6 +785,8 @@ interface AgentDefinition {
|
|
|
795
785
|
mcp_servers?: McpDefinition[];
|
|
796
786
|
/** Settings related to the model used by the agent. */
|
|
797
787
|
model_settings?: ModelSettings;
|
|
788
|
+
/** Secondary Model Settings used for analysis */
|
|
789
|
+
analysis_model_settings?: ModelSettings;
|
|
798
790
|
/** The size of the history to maintain for the agent. */
|
|
799
791
|
history_size?: number;
|
|
800
792
|
/** The planning configuration for the agent, if any. */
|
|
@@ -805,8 +797,8 @@ interface AgentDefinition {
|
|
|
805
797
|
skills?: AgentSkill[];
|
|
806
798
|
/** List of sub-agents that this agent can transfer control to */
|
|
807
799
|
sub_agents?: string[];
|
|
808
|
-
agentType?: string;
|
|
809
800
|
agent_type?: string;
|
|
801
|
+
context_size?: number;
|
|
810
802
|
tools?: DistriBaseTool[];
|
|
811
803
|
browser_config?: BrowserAgentConfig;
|
|
812
804
|
}
|
|
@@ -1069,4 +1061,4 @@ declare function extractToolCallsFromDistriMessage(message: DistriMessage): any[
|
|
|
1069
1061
|
*/
|
|
1070
1062
|
declare function extractToolResultsFromDistriMessage(message: DistriMessage): any[];
|
|
1071
1063
|
|
|
1072
|
-
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, 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 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -257,25 +257,6 @@ declare class DistriClient {
|
|
|
257
257
|
* Session store: clear all keys in a session
|
|
258
258
|
*/
|
|
259
259
|
clearSession(sessionId: string): Promise<void>;
|
|
260
|
-
private static readonly ADDITIONAL_PARTS_KEY;
|
|
261
|
-
/**
|
|
262
|
-
* Set additional user message parts for the next agent iteration.
|
|
263
|
-
* These parts will be appended to the user message in the prompt.
|
|
264
|
-
* @param sessionId - The thread/session ID
|
|
265
|
-
* @param parts - Array of DistriPart objects to append to user message
|
|
266
|
-
*/
|
|
267
|
-
setAdditionalUserParts(sessionId: string, parts: DistriPart[]): Promise<void>;
|
|
268
|
-
/**
|
|
269
|
-
* Get the current additional user message parts.
|
|
270
|
-
* @param sessionId - The thread/session ID
|
|
271
|
-
* @returns Array of DistriPart objects or null if not set
|
|
272
|
-
*/
|
|
273
|
-
getAdditionalUserParts(sessionId: string): Promise<DistriPart[] | null>;
|
|
274
|
-
/**
|
|
275
|
-
* Clear/delete the additional user message parts.
|
|
276
|
-
* @param sessionId - The thread/session ID
|
|
277
|
-
*/
|
|
278
|
-
clearAdditionalUserParts(sessionId: string): Promise<void>;
|
|
279
260
|
/**
|
|
280
261
|
* Response from the token endpoint
|
|
281
262
|
*/
|
|
@@ -341,7 +322,7 @@ declare class DistriClient {
|
|
|
341
322
|
/**
|
|
342
323
|
* Get specific agent by ID
|
|
343
324
|
*/
|
|
344
|
-
getAgent(agentId: string): Promise<
|
|
325
|
+
getAgent(agentId: string): Promise<AgentConfigWithTools>;
|
|
345
326
|
/**
|
|
346
327
|
* Get or create A2AClient for an agent
|
|
347
328
|
*/
|
|
@@ -405,9 +386,10 @@ declare class DistriClient {
|
|
|
405
386
|
*/
|
|
406
387
|
private fetchAbsolute;
|
|
407
388
|
/**
|
|
408
|
-
* Enhanced fetch with retry logic
|
|
389
|
+
* Enhanced fetch with retry logic and auth headers.
|
|
390
|
+
* Exposed publicly for extensions like DistriHomeClient.
|
|
409
391
|
*/
|
|
410
|
-
|
|
392
|
+
fetch(input: RequestInfo | URL, initialInit?: RequestInit): Promise<Response>;
|
|
411
393
|
/**
|
|
412
394
|
* Delay utility
|
|
413
395
|
*/
|
|
@@ -479,7 +461,7 @@ declare class Agent {
|
|
|
479
461
|
private agentDefinition;
|
|
480
462
|
private hookHandlers;
|
|
481
463
|
private defaultHookHandler;
|
|
482
|
-
constructor(agentDefinition:
|
|
464
|
+
constructor(agentDefinition: AgentConfigWithTools, client: DistriClient);
|
|
483
465
|
/**
|
|
484
466
|
* Get agent information
|
|
485
467
|
*/
|
|
@@ -491,7 +473,7 @@ declare class Agent {
|
|
|
491
473
|
/**
|
|
492
474
|
* Get the full agent definition (including backend tools)
|
|
493
475
|
*/
|
|
494
|
-
getDefinition():
|
|
476
|
+
getDefinition(): AgentConfigWithTools;
|
|
495
477
|
/**
|
|
496
478
|
* Fetch messages for a thread (public method for useChat)
|
|
497
479
|
*/
|
|
@@ -524,7 +506,7 @@ declare class Agent {
|
|
|
524
506
|
/**
|
|
525
507
|
* Create an agent instance from an agent ID
|
|
526
508
|
*/
|
|
527
|
-
static create(agentIdOrDef: string |
|
|
509
|
+
static create(agentIdOrDef: string | AgentConfigWithTools, client: DistriClient): Promise<Agent>;
|
|
528
510
|
/**
|
|
529
511
|
* Complete an external tool call by sending the result back to the server
|
|
530
512
|
*/
|
|
@@ -713,14 +695,18 @@ interface FileUrl {
|
|
|
713
695
|
name?: string;
|
|
714
696
|
}
|
|
715
697
|
type FileType = FileBytes | FileUrl;
|
|
698
|
+
interface ToolDefinition {
|
|
699
|
+
name: string;
|
|
700
|
+
description: string;
|
|
701
|
+
parameters: object;
|
|
702
|
+
examples?: string;
|
|
703
|
+
output_schema?: object;
|
|
704
|
+
}
|
|
716
705
|
/**
|
|
717
706
|
* Tool definition interface following AG-UI pattern
|
|
718
707
|
*/
|
|
719
|
-
interface DistriBaseTool {
|
|
720
|
-
name: string;
|
|
708
|
+
interface DistriBaseTool extends ToolDefinition {
|
|
721
709
|
type: 'function' | 'ui';
|
|
722
|
-
description: string;
|
|
723
|
-
parameters: object;
|
|
724
710
|
is_final?: boolean;
|
|
725
711
|
autoExecute?: boolean;
|
|
726
712
|
isExternal?: boolean;
|
|
@@ -776,6 +762,10 @@ declare function createFailedToolResult(toolCallId: string, toolName: string, er
|
|
|
776
762
|
* Handles both frontend DistriPart format and backend BackendPart format
|
|
777
763
|
*/
|
|
778
764
|
declare function extractToolResultData(toolResult: ToolResult): ToolResultData | null;
|
|
765
|
+
interface AgentConfigWithTools extends AgentDefinition {
|
|
766
|
+
markdown?: string;
|
|
767
|
+
resolved_tools?: ToolDefinition[];
|
|
768
|
+
}
|
|
779
769
|
/**
|
|
780
770
|
* Distri-specific Agent type that wraps A2A AgentCard
|
|
781
771
|
*/
|
|
@@ -795,6 +785,8 @@ interface AgentDefinition {
|
|
|
795
785
|
mcp_servers?: McpDefinition[];
|
|
796
786
|
/** Settings related to the model used by the agent. */
|
|
797
787
|
model_settings?: ModelSettings;
|
|
788
|
+
/** Secondary Model Settings used for analysis */
|
|
789
|
+
analysis_model_settings?: ModelSettings;
|
|
798
790
|
/** The size of the history to maintain for the agent. */
|
|
799
791
|
history_size?: number;
|
|
800
792
|
/** The planning configuration for the agent, if any. */
|
|
@@ -805,8 +797,8 @@ interface AgentDefinition {
|
|
|
805
797
|
skills?: AgentSkill[];
|
|
806
798
|
/** List of sub-agents that this agent can transfer control to */
|
|
807
799
|
sub_agents?: string[];
|
|
808
|
-
agentType?: string;
|
|
809
800
|
agent_type?: string;
|
|
801
|
+
context_size?: number;
|
|
810
802
|
tools?: DistriBaseTool[];
|
|
811
803
|
browser_config?: BrowserAgentConfig;
|
|
812
804
|
}
|
|
@@ -1069,4 +1061,4 @@ declare function extractToolCallsFromDistriMessage(message: DistriMessage): any[
|
|
|
1069
1061
|
*/
|
|
1070
1062
|
declare function extractToolResultsFromDistriMessage(message: DistriMessage): any[];
|
|
1071
1063
|
|
|
1072
|
-
export { A2AProtocolError, type A2AStreamEventData, type ActionPlanStep, Agent, 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 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -1688,7 +1688,8 @@ var _DistriClient = class _DistriClient {
|
|
|
1688
1688
|
throw lastError;
|
|
1689
1689
|
}
|
|
1690
1690
|
/**
|
|
1691
|
-
* Enhanced fetch with retry logic
|
|
1691
|
+
* Enhanced fetch with retry logic and auth headers.
|
|
1692
|
+
* Exposed publicly for extensions like DistriHomeClient.
|
|
1692
1693
|
*/
|
|
1693
1694
|
async fetch(input, initialInit) {
|
|
1694
1695
|
const url = `${this.config.baseUrl}${input}`;
|
|
@@ -1832,7 +1833,7 @@ var Agent = class _Agent {
|
|
|
1832
1833
|
return this.agentDefinition.description;
|
|
1833
1834
|
}
|
|
1834
1835
|
get agentType() {
|
|
1835
|
-
return this.agentDefinition.agent_type
|
|
1836
|
+
return this.agentDefinition.agent_type;
|
|
1836
1837
|
}
|
|
1837
1838
|
get iconUrl() {
|
|
1838
1839
|
return this.agentDefinition.icon_url;
|
|
@@ -1982,12 +1983,13 @@ var Agent = class _Agent {
|
|
|
1982
1983
|
*/
|
|
1983
1984
|
static async create(agentIdOrDef, client) {
|
|
1984
1985
|
const agentDefinition = typeof agentIdOrDef === "string" ? await client.getAgent(agentIdOrDef) : agentIdOrDef;
|
|
1986
|
+
const tools = agentDefinition?.resolved_tools || [];
|
|
1985
1987
|
console.log("\u{1F916} Agent definition loaded:", {
|
|
1986
1988
|
id: agentDefinition.id,
|
|
1987
1989
|
name: agentDefinition.name,
|
|
1988
|
-
tools:
|
|
1990
|
+
tools: tools.map((t) => ({
|
|
1989
1991
|
name: t.name,
|
|
1990
|
-
type:
|
|
1992
|
+
type: "function"
|
|
1991
1993
|
})) || [],
|
|
1992
1994
|
toolCount: agentDefinition.tools?.length || 0
|
|
1993
1995
|
});
|