art-framework 0.3.2 → 0.3.3
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 +1 -1
- package/dist/index.cjs +18 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +467 -12
- package/dist/index.d.ts +467 -12
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2875,7 +2875,7 @@ interface IToolExecutor {
|
|
|
2875
2875
|
/**
|
|
2876
2876
|
* Interface for managing the registration and retrieval of tools.
|
|
2877
2877
|
*/
|
|
2878
|
-
interface ToolRegistry {
|
|
2878
|
+
interface ToolRegistry$1 {
|
|
2879
2879
|
/**
|
|
2880
2880
|
* Registers a tool executor instance, making it available for use.
|
|
2881
2881
|
* @param executor - The instance of the class implementing `IToolExecutor`.
|
|
@@ -2924,7 +2924,7 @@ interface ToolSystem {
|
|
|
2924
2924
|
/**
|
|
2925
2925
|
* Interface for managing thread-specific configuration and state.
|
|
2926
2926
|
*/
|
|
2927
|
-
interface StateManager {
|
|
2927
|
+
interface StateManager$1 {
|
|
2928
2928
|
/**
|
|
2929
2929
|
* Loads the complete context (`ThreadConfig` and `AgentState`) for a specific thread.
|
|
2930
2930
|
* This is typically called at the beginning of an agent execution cycle.
|
|
@@ -3082,7 +3082,7 @@ interface ITypedSocket<DataType, FilterType = any> {
|
|
|
3082
3082
|
/**
|
|
3083
3083
|
* Interface for the system providing access to UI communication sockets.
|
|
3084
3084
|
*/
|
|
3085
|
-
interface UISystem {
|
|
3085
|
+
interface UISystem$1 {
|
|
3086
3086
|
/** Returns the singleton instance of the ObservationSocket. */
|
|
3087
3087
|
getObservationSocket(): ObservationSocket;
|
|
3088
3088
|
/** Returns the singleton instance of the ConversationSocket. */
|
|
@@ -3240,13 +3240,13 @@ interface ArtInstance {
|
|
|
3240
3240
|
/** The main method to process a user query using the configured Agent Core. */
|
|
3241
3241
|
readonly process: IAgentCore['process'];
|
|
3242
3242
|
/** Accessor for the UI System, used to get sockets for subscriptions. */
|
|
3243
|
-
readonly uiSystem: UISystem;
|
|
3243
|
+
readonly uiSystem: UISystem$1;
|
|
3244
3244
|
/** Accessor for the State Manager, used for managing thread configuration and state. */
|
|
3245
|
-
readonly stateManager: StateManager;
|
|
3245
|
+
readonly stateManager: StateManager$1;
|
|
3246
3246
|
/** Accessor for the Conversation Manager, used for managing message history. */
|
|
3247
3247
|
readonly conversationManager: ConversationManager;
|
|
3248
3248
|
/** Accessor for the Tool Registry, used for managing available tools. */
|
|
3249
|
-
readonly toolRegistry: ToolRegistry;
|
|
3249
|
+
readonly toolRegistry: ToolRegistry$1;
|
|
3250
3250
|
/** Accessor for the Observation Manager, used for recording and retrieving observations. */
|
|
3251
3251
|
readonly observationManager: ObservationManager;
|
|
3252
3252
|
/** Accessor for the Auth Manager, used for handling authentication. */
|
|
@@ -3375,7 +3375,7 @@ declare class McpManager {
|
|
|
3375
3375
|
* @param _stateManager The state manager (not currently used).
|
|
3376
3376
|
* @param authManager The authentication manager.
|
|
3377
3377
|
*/
|
|
3378
|
-
constructor(toolRegistry: ToolRegistry, _stateManager: StateManager, authManager?: AuthManager);
|
|
3378
|
+
constructor(toolRegistry: ToolRegistry$1, _stateManager: StateManager$1, authManager?: AuthManager);
|
|
3379
3379
|
/**
|
|
3380
3380
|
* Initializes the McpManager, discovers and registers tools from configured servers.
|
|
3381
3381
|
*
|
|
@@ -3664,7 +3664,7 @@ declare class TaskDelegationService {
|
|
|
3664
3664
|
|
|
3665
3665
|
interface PESAgentDependencies {
|
|
3666
3666
|
/** Manages thread configuration and state. */
|
|
3667
|
-
stateManager: StateManager;
|
|
3667
|
+
stateManager: StateManager$1;
|
|
3668
3668
|
/**
|
|
3669
3669
|
* Optional default system prompt string provided at the ART instance level.
|
|
3670
3670
|
* This serves as a custom prompt part if no thread-specific or call-specific
|
|
@@ -3673,7 +3673,7 @@ interface PESAgentDependencies {
|
|
|
3673
3673
|
/** Manages conversation history. */
|
|
3674
3674
|
conversationManager: ConversationManager;
|
|
3675
3675
|
/** Registry for available tools. */
|
|
3676
|
-
toolRegistry: ToolRegistry;
|
|
3676
|
+
toolRegistry: ToolRegistry$1;
|
|
3677
3677
|
/** Handles interaction with the LLM provider. */
|
|
3678
3678
|
reasoningEngine: ReasoningEngine;
|
|
3679
3679
|
/** Parses LLM responses. */
|
|
@@ -3683,7 +3683,7 @@ interface PESAgentDependencies {
|
|
|
3683
3683
|
/** Orchestrates tool execution. */
|
|
3684
3684
|
toolSystem: ToolSystem;
|
|
3685
3685
|
/** Provides access to UI communication sockets. */
|
|
3686
|
-
uiSystem: UISystem;
|
|
3686
|
+
uiSystem: UISystem$1;
|
|
3687
3687
|
/** Repository for A2A tasks. */
|
|
3688
3688
|
a2aTaskRepository: IA2ATaskRepository;
|
|
3689
3689
|
/** Service for discovering A2A agents. */
|
|
@@ -4539,6 +4539,44 @@ declare class CalculatorTool implements IToolExecutor {
|
|
|
4539
4539
|
execute(input: any, context: ExecutionContext): Promise<ToolResult>;
|
|
4540
4540
|
}
|
|
4541
4541
|
|
|
4542
|
+
/**
|
|
4543
|
+
* Provides access to the UI communication sockets (Observation, Conversation, LLM Stream, and A2A Task).
|
|
4544
|
+
* Instantiates the sockets with their required dependencies.
|
|
4545
|
+
*/
|
|
4546
|
+
declare class UISystem implements UISystem$1 {
|
|
4547
|
+
private observationSocketInstance;
|
|
4548
|
+
private conversationSocketInstance;
|
|
4549
|
+
private llmStreamSocketInstance;
|
|
4550
|
+
private a2aTaskSocketInstance;
|
|
4551
|
+
/**
|
|
4552
|
+
* Creates an instance of UISystem.
|
|
4553
|
+
* @param observationRepository - Repository for observation data, passed to ObservationSocket.
|
|
4554
|
+
* @param conversationRepository - Repository for conversation data, passed to ConversationSocket.
|
|
4555
|
+
* @param a2aTaskRepository - Optional repository for A2A task data, passed to A2ATaskSocket.
|
|
4556
|
+
*/
|
|
4557
|
+
constructor(observationRepository: IObservationRepository, conversationRepository: IConversationRepository, a2aTaskRepository?: IA2ATaskRepository);
|
|
4558
|
+
/**
|
|
4559
|
+
* Gets the singleton instance of the ObservationSocket.
|
|
4560
|
+
* @returns The ObservationSocket instance.
|
|
4561
|
+
*/
|
|
4562
|
+
getObservationSocket(): ObservationSocket;
|
|
4563
|
+
/**
|
|
4564
|
+
* Gets the singleton instance of the ConversationSocket.
|
|
4565
|
+
* @returns The ConversationSocket instance.
|
|
4566
|
+
*/
|
|
4567
|
+
getConversationSocket(): ConversationSocket;
|
|
4568
|
+
/**
|
|
4569
|
+
* Gets the singleton instance of the LLMStreamSocket.
|
|
4570
|
+
* @returns The LLMStreamSocket instance.
|
|
4571
|
+
*/
|
|
4572
|
+
getLLMStreamSocket(): LLMStreamSocket;
|
|
4573
|
+
/**
|
|
4574
|
+
* Gets the singleton instance of the A2ATaskSocket.
|
|
4575
|
+
* @returns The A2ATaskSocket instance.
|
|
4576
|
+
*/
|
|
4577
|
+
getA2ATaskSocket(): A2ATaskSocket;
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4542
4580
|
/**
|
|
4543
4581
|
* Configuration for the PKCE OAuth 2.0 authentication strategy.
|
|
4544
4582
|
*/
|
|
@@ -4631,6 +4669,234 @@ declare class PKCEOAuthStrategy implements IAuthStrategy {
|
|
|
4631
4669
|
private exchangeCodeForToken;
|
|
4632
4670
|
}
|
|
4633
4671
|
|
|
4672
|
+
/**
|
|
4673
|
+
* Simple API key authentication strategy.
|
|
4674
|
+
* Supports configurable header names for different service requirements.
|
|
4675
|
+
*/
|
|
4676
|
+
declare class ApiKeyStrategy implements IAuthStrategy {
|
|
4677
|
+
private readonly apiKey;
|
|
4678
|
+
private readonly headerName;
|
|
4679
|
+
/**
|
|
4680
|
+
* Creates a new API key authentication strategy.
|
|
4681
|
+
* @param apiKey - The API key to use for authentication
|
|
4682
|
+
* @param headerName - The header name to use (defaults to 'Authorization')
|
|
4683
|
+
*/
|
|
4684
|
+
constructor(apiKey: string, headerName?: string);
|
|
4685
|
+
/**
|
|
4686
|
+
* Generates authentication headers for API key-based authentication.
|
|
4687
|
+
* Uses Bearer token format for Authorization header, plain key for custom headers.
|
|
4688
|
+
* @returns Promise resolving to authentication headers
|
|
4689
|
+
*/
|
|
4690
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
4691
|
+
/**
|
|
4692
|
+
* Gets the configured header name for this strategy.
|
|
4693
|
+
* @returns The header name that will be used
|
|
4694
|
+
*/
|
|
4695
|
+
getHeaderName(): string;
|
|
4696
|
+
/**
|
|
4697
|
+
* Checks if this strategy uses the standard Authorization header.
|
|
4698
|
+
* @returns True if using Authorization header, false for custom headers
|
|
4699
|
+
*/
|
|
4700
|
+
isUsingAuthorizationHeader(): boolean;
|
|
4701
|
+
}
|
|
4702
|
+
|
|
4703
|
+
/**
|
|
4704
|
+
* Configuration for OAuth 2.0 authentication strategy
|
|
4705
|
+
*/
|
|
4706
|
+
interface OAuthConfig {
|
|
4707
|
+
/** Client ID for OAuth authentication */
|
|
4708
|
+
clientId: string;
|
|
4709
|
+
/** Client secret for OAuth authentication */
|
|
4710
|
+
clientSecret: string;
|
|
4711
|
+
/** OAuth token endpoint URL */
|
|
4712
|
+
tokenEndpoint: string;
|
|
4713
|
+
/** OAuth scopes to request (space-separated) */
|
|
4714
|
+
scopes?: string;
|
|
4715
|
+
/** Grant type to use (defaults to 'client_credentials') */
|
|
4716
|
+
grantType?: 'client_credentials' | 'authorization_code' | 'refresh_token';
|
|
4717
|
+
/** Additional headers to send with token requests */
|
|
4718
|
+
tokenRequestHeaders?: Record<string, string>;
|
|
4719
|
+
/** Custom timeout for token requests in milliseconds (default: 30000) */
|
|
4720
|
+
tokenTimeoutMs?: number;
|
|
4721
|
+
/** Buffer time before token expiry to trigger refresh (default: 300000 = 5 minutes) */
|
|
4722
|
+
tokenRefreshBufferMs?: number;
|
|
4723
|
+
}
|
|
4724
|
+
/**
|
|
4725
|
+
* Generic OAuth 2.0 authentication strategy with token caching and refresh capabilities.
|
|
4726
|
+
* Supports client credentials flow and authorization code flow with automatic token refresh.
|
|
4727
|
+
* @deprecated This strategy is not recommended for browser-based applications as it uses the insecure client_credentials grant type. Please use PKCEOAuthStrategy instead.
|
|
4728
|
+
*/
|
|
4729
|
+
declare class GenericOAuthStrategy implements IAuthStrategy {
|
|
4730
|
+
private config;
|
|
4731
|
+
private cachedToken;
|
|
4732
|
+
private refreshPromise;
|
|
4733
|
+
/**
|
|
4734
|
+
* Creates a new OAuth authentication strategy.
|
|
4735
|
+
* @param {OAuthConfig} config - OAuth configuration including endpoints, credentials, and options
|
|
4736
|
+
*/
|
|
4737
|
+
constructor(config: OAuthConfig);
|
|
4738
|
+
/**
|
|
4739
|
+
* Validates the OAuth configuration to ensure required fields are present.
|
|
4740
|
+
* @param {OAuthConfig} config - The OAuth configuration to validate.
|
|
4741
|
+
* @throws {ARTError} If the configuration is invalid.
|
|
4742
|
+
*/
|
|
4743
|
+
private validateConfig;
|
|
4744
|
+
/**
|
|
4745
|
+
* Gets authentication headers, automatically handling token refresh if needed.
|
|
4746
|
+
* @returns {Promise<Record<string, string>>} A promise that resolves to the authentication headers.
|
|
4747
|
+
*/
|
|
4748
|
+
getAuthHeaders(): Promise<Record<string, string>>;
|
|
4749
|
+
/**
|
|
4750
|
+
* Gets a valid access token, refreshing if necessary.
|
|
4751
|
+
* @returns {Promise<CachedToken>} A promise that resolves to a valid cached token.
|
|
4752
|
+
*/
|
|
4753
|
+
private getValidToken;
|
|
4754
|
+
/**
|
|
4755
|
+
* Checks if a token is still valid (not expired with buffer).
|
|
4756
|
+
* @param {CachedToken} token - The token to validate.
|
|
4757
|
+
* @returns {boolean} True if the token is valid, false otherwise.
|
|
4758
|
+
*/
|
|
4759
|
+
private isTokenValid;
|
|
4760
|
+
/**
|
|
4761
|
+
* Acquires a new token from the OAuth provider.
|
|
4762
|
+
* @returns {Promise<CachedToken>} A promise that resolves to a new cached token.
|
|
4763
|
+
*/
|
|
4764
|
+
private acquireNewToken;
|
|
4765
|
+
/**
|
|
4766
|
+
* Builds the token request configuration based on grant type.
|
|
4767
|
+
* @returns {RequestInit} The request initialization object for the token request.
|
|
4768
|
+
*/
|
|
4769
|
+
private buildTokenRequest;
|
|
4770
|
+
/**
|
|
4771
|
+
* Processes the token response and creates a cached token object.
|
|
4772
|
+
* @param {TokenResponse} response - The token response from the provider.
|
|
4773
|
+
* @returns {CachedToken} The processed and cached token.
|
|
4774
|
+
*/
|
|
4775
|
+
private processTokenResponse;
|
|
4776
|
+
/**
|
|
4777
|
+
* Manually refreshes the cached token.
|
|
4778
|
+
* @returns {Promise<Record<string, string>>} A promise that resolves to new authentication headers.
|
|
4779
|
+
*/
|
|
4780
|
+
refreshToken(): Promise<Record<string, string>>;
|
|
4781
|
+
/**
|
|
4782
|
+
* Clears the cached token, forcing a new token request on next use.
|
|
4783
|
+
*/
|
|
4784
|
+
clearTokenCache(): void;
|
|
4785
|
+
/**
|
|
4786
|
+
* Gets information about the current cached token.
|
|
4787
|
+
* @returns {{ expiresAt: Date; scope?: string; hasRefreshToken: boolean } | null} Token information or null if no token is cached.
|
|
4788
|
+
*/
|
|
4789
|
+
getTokenInfo(): {
|
|
4790
|
+
expiresAt: Date;
|
|
4791
|
+
scope?: string;
|
|
4792
|
+
hasRefreshToken: boolean;
|
|
4793
|
+
} | null;
|
|
4794
|
+
/**
|
|
4795
|
+
* Gets the configured OAuth endpoints and settings.
|
|
4796
|
+
* @returns {Omit<OAuthConfig, 'clientSecret'>} Configuration information (excluding sensitive data).
|
|
4797
|
+
*/
|
|
4798
|
+
getConfig(): Omit<OAuthConfig, 'clientSecret'>;
|
|
4799
|
+
}
|
|
4800
|
+
|
|
4801
|
+
/**
|
|
4802
|
+
* Configuration specific to Zyntopia OAuth strategy
|
|
4803
|
+
*/
|
|
4804
|
+
interface ZyntopiaOAuthConfig {
|
|
4805
|
+
/** Client ID for Zyntopia OAuth authentication */
|
|
4806
|
+
clientId: string;
|
|
4807
|
+
/** Client secret for Zyntopia OAuth authentication */
|
|
4808
|
+
clientSecret: string;
|
|
4809
|
+
/** Optional custom token endpoint (defaults to Zyntopia's standard endpoint) */
|
|
4810
|
+
tokenEndpoint?: string;
|
|
4811
|
+
/** Optional custom scopes (defaults to Zyntopia's standard scopes) */
|
|
4812
|
+
scopes?: string;
|
|
4813
|
+
/** Optional environment ('production' | 'staging' | 'development') */
|
|
4814
|
+
environment?: 'production' | 'staging' | 'development';
|
|
4815
|
+
/** Optional custom timeout for token requests in milliseconds */
|
|
4816
|
+
tokenTimeoutMs?: number;
|
|
4817
|
+
/** Optional custom buffer time before token expiry to trigger refresh */
|
|
4818
|
+
tokenRefreshBufferMs?: number;
|
|
4819
|
+
/** Additional custom headers for Zyntopia API requirements */
|
|
4820
|
+
customHeaders?: Record<string, string>;
|
|
4821
|
+
}
|
|
4822
|
+
/**
|
|
4823
|
+
* Zyntopia-specific OAuth 2.0 authentication strategy.
|
|
4824
|
+
* Pre-configured for Zyntopia services with standard endpoints, scopes, and authentication flows.
|
|
4825
|
+
* Extends GenericOAuthStrategy with Zyntopia-specific defaults and configurations.
|
|
4826
|
+
*/
|
|
4827
|
+
declare class ZyntopiaOAuthStrategy extends GenericOAuthStrategy {
|
|
4828
|
+
private static readonly ZYNTOPIA_ENDPOINTS;
|
|
4829
|
+
private static readonly ZYNTOPIA_DEFAULT_SCOPES;
|
|
4830
|
+
private zyntopiaConfig;
|
|
4831
|
+
/**
|
|
4832
|
+
* Creates a new Zyntopia OAuth authentication strategy.
|
|
4833
|
+
* @param {ZyntopiaOAuthConfig} config - Zyntopia-specific OAuth configuration
|
|
4834
|
+
*/
|
|
4835
|
+
constructor(config: ZyntopiaOAuthConfig);
|
|
4836
|
+
/**
|
|
4837
|
+
* Gets the Zyntopia-specific configuration.
|
|
4838
|
+
* @returns {Omit<ZyntopiaOAuthConfig, 'clientSecret'>} Zyntopia configuration (excluding sensitive data).
|
|
4839
|
+
*/
|
|
4840
|
+
getZyntopiaConfig(): Omit<ZyntopiaOAuthConfig, 'clientSecret'>;
|
|
4841
|
+
/**
|
|
4842
|
+
* Gets the current environment this strategy is configured for.
|
|
4843
|
+
* @returns {'production' | 'staging' | 'development'} The environment ('production', 'staging', or 'development').
|
|
4844
|
+
*/
|
|
4845
|
+
getEnvironment(): 'production' | 'staging' | 'development';
|
|
4846
|
+
/**
|
|
4847
|
+
* Checks if this strategy is configured for production environment.
|
|
4848
|
+
* @returns {boolean} True if configured for production, false otherwise.
|
|
4849
|
+
*/
|
|
4850
|
+
isProduction(): boolean;
|
|
4851
|
+
/**
|
|
4852
|
+
* Checks if this strategy is configured for development/testing.
|
|
4853
|
+
* @returns {boolean} True if configured for development or staging, false for production.
|
|
4854
|
+
*/
|
|
4855
|
+
isDevelopment(): boolean;
|
|
4856
|
+
/**
|
|
4857
|
+
* Creates a ZyntopiaOAuthStrategy instance pre-configured for production.
|
|
4858
|
+
* @param {string} clientId - Zyntopia client ID
|
|
4859
|
+
* @param {string} clientSecret - Zyntopia client secret
|
|
4860
|
+
* @param {string} [customScopes] - Optional custom scopes (defaults to production scopes)
|
|
4861
|
+
* @returns {ZyntopiaOAuthStrategy} Configured ZyntopiaOAuthStrategy for production.
|
|
4862
|
+
*/
|
|
4863
|
+
static forProduction(clientId: string, clientSecret: string, customScopes?: string): ZyntopiaOAuthStrategy;
|
|
4864
|
+
/**
|
|
4865
|
+
* Creates a ZyntopiaOAuthStrategy instance pre-configured for staging.
|
|
4866
|
+
* @param {string} clientId - Zyntopia client ID
|
|
4867
|
+
* @param {string} clientSecret - Zyntopia client secret
|
|
4868
|
+
* @param {string} [customScopes] - Optional custom scopes (defaults to staging scopes)
|
|
4869
|
+
* @returns {ZyntopiaOAuthStrategy} Configured ZyntopiaOAuthStrategy for staging.
|
|
4870
|
+
*/
|
|
4871
|
+
static forStaging(clientId: string, clientSecret: string, customScopes?: string): ZyntopiaOAuthStrategy;
|
|
4872
|
+
/**
|
|
4873
|
+
* Creates a ZyntopiaOAuthStrategy instance pre-configured for development.
|
|
4874
|
+
* @param {string} clientId - Zyntopia client ID
|
|
4875
|
+
* @param {string} clientSecret - Zyntopia client secret
|
|
4876
|
+
* @param {string} [customScopes] - Optional custom scopes (defaults to development scopes)
|
|
4877
|
+
* @returns {ZyntopiaOAuthStrategy} Configured ZyntopiaOAuthStrategy for development.
|
|
4878
|
+
*/
|
|
4879
|
+
static forDevelopment(clientId: string, clientSecret: string, customScopes?: string): ZyntopiaOAuthStrategy;
|
|
4880
|
+
/**
|
|
4881
|
+
* Gets the default scopes for a specific environment.
|
|
4882
|
+
* @param {'production' | 'staging' | 'development'} environment - The environment to get scopes for
|
|
4883
|
+
* @returns {string} Default scopes for the specified environment.
|
|
4884
|
+
*/
|
|
4885
|
+
static getDefaultScopes(environment: 'production' | 'staging' | 'development'): string;
|
|
4886
|
+
/**
|
|
4887
|
+
* Gets the token endpoint for a specific environment.
|
|
4888
|
+
* @param {'production' | 'staging' | 'development'} environment - The environment to get endpoint for
|
|
4889
|
+
* @returns {string} Token endpoint URL for the specified environment.
|
|
4890
|
+
*/
|
|
4891
|
+
static getTokenEndpoint(environment: 'production' | 'staging' | 'development'): string;
|
|
4892
|
+
/**
|
|
4893
|
+
* Validates Zyntopia-specific configuration requirements.
|
|
4894
|
+
* @param {ZyntopiaOAuthConfig} config - Configuration to validate
|
|
4895
|
+
* @throws {Error} If configuration is invalid.
|
|
4896
|
+
*/
|
|
4897
|
+
static validateZyntopiaConfig(config: ZyntopiaOAuthConfig): void;
|
|
4898
|
+
}
|
|
4899
|
+
|
|
4634
4900
|
/**
|
|
4635
4901
|
* A proxy tool that wraps an MCP server tool and implements the {@link IToolExecutor} interface.
|
|
4636
4902
|
*
|
|
@@ -4683,6 +4949,195 @@ declare class McpProxyTool implements IToolExecutor {
|
|
|
4683
4949
|
getToolDefinition(): McpToolDefinition;
|
|
4684
4950
|
}
|
|
4685
4951
|
|
|
4952
|
+
/**
|
|
4953
|
+
* Manages thread-specific configuration (ThreadConfig) and state (AgentState)
|
|
4954
|
+
* using an underlying StateRepository. Supports explicit and implicit state saving strategies.
|
|
4955
|
+
*/
|
|
4956
|
+
declare class StateManager implements StateManager$1 {
|
|
4957
|
+
private repository;
|
|
4958
|
+
private strategy;
|
|
4959
|
+
private contextCache;
|
|
4960
|
+
/**
|
|
4961
|
+
* Creates an instance of StateManager.
|
|
4962
|
+
* @param {IStateRepository} stateRepository - The repository for persisting state.
|
|
4963
|
+
* @param {StateSavingStrategy} [strategy='explicit'] - The state saving strategy to use.
|
|
4964
|
+
*/
|
|
4965
|
+
constructor(stateRepository: IStateRepository, strategy?: StateSavingStrategy);
|
|
4966
|
+
/**
|
|
4967
|
+
* Loads the complete context (`ThreadConfig` and `AgentState`) for a specific thread.
|
|
4968
|
+
* If in 'implicit' state saving strategy, it caches the loaded context and a snapshot
|
|
4969
|
+
* of its AgentState for later comparison in `saveStateIfModified`.
|
|
4970
|
+
* @param {string} threadId - The unique identifier for the thread.
|
|
4971
|
+
* @param {string} [_userId] - Optional user identifier (currently unused).
|
|
4972
|
+
* @returns {Promise<ThreadContext>} A promise resolving to the `ThreadContext` object.
|
|
4973
|
+
* @throws {Error} If `threadId` is empty or if the repository fails to find the context.
|
|
4974
|
+
*/
|
|
4975
|
+
loadThreadContext(threadId: string, _userId?: string): Promise<ThreadContext>;
|
|
4976
|
+
/**
|
|
4977
|
+
* Checks if a specific tool is permitted for use within a given thread.
|
|
4978
|
+
* It loads the thread's context and checks the `enabledTools` array in the configuration.
|
|
4979
|
+
* @param {string} threadId - The ID of the thread.
|
|
4980
|
+
* @param {string} toolName - The name of the tool to check.
|
|
4981
|
+
* @returns {Promise<boolean>} A promise resolving to `true` if the tool is listed in the thread's `enabledTools` config, `false` otherwise or if the context/config cannot be loaded.
|
|
4982
|
+
*/
|
|
4983
|
+
isToolEnabled(threadId: string, toolName: string): Promise<boolean>;
|
|
4984
|
+
/**
|
|
4985
|
+
* Retrieves a specific value from the thread's configuration (`ThreadConfig`).
|
|
4986
|
+
* Loads the context first (which might come from cache in implicit mode).
|
|
4987
|
+
* @template T - The expected type of the configuration value.
|
|
4988
|
+
* @param {string} threadId - The ID of the thread.
|
|
4989
|
+
* @param {string} key - The top-level configuration key.
|
|
4990
|
+
* @returns {Promise<T | undefined>} A promise resolving to the configuration value, or `undefined`.
|
|
4991
|
+
*/
|
|
4992
|
+
getThreadConfigValue<T>(threadId: string, key: string): Promise<T | undefined>;
|
|
4993
|
+
/**
|
|
4994
|
+
* Persists the thread's `AgentState` if it has been modified.
|
|
4995
|
+
* Behavior depends on the `stateSavingStrategy`:
|
|
4996
|
+
* - 'explicit': This method is a no-op for `AgentState` persistence and logs a warning.
|
|
4997
|
+
* - 'implicit': Compares the current `AgentState` (from the cached `ThreadContext` modified by the agent)
|
|
4998
|
+
* with the snapshot taken during `loadThreadContext`. If different, saves the state
|
|
4999
|
+
* to the repository and updates the snapshot.
|
|
5000
|
+
* @param {string} threadId - The ID of the thread whose state might need saving.
|
|
5001
|
+
* @returns {Promise<void>} A promise that resolves when the state is saved or the operation is skipped.
|
|
5002
|
+
*/
|
|
5003
|
+
saveStateIfModified(threadId: string): Promise<void>;
|
|
5004
|
+
/**
|
|
5005
|
+
* Sets or completely replaces the configuration (`ThreadConfig`) for a specific thread
|
|
5006
|
+
* by calling the underlying state repository. This also clears any cached context for the thread.
|
|
5007
|
+
* @param {string} threadId - The ID of the thread.
|
|
5008
|
+
* @param {ThreadConfig} config - The complete `ThreadConfig` object.
|
|
5009
|
+
* @returns {Promise<void>} A promise that resolves when the configuration is saved.
|
|
5010
|
+
*/
|
|
5011
|
+
setThreadConfig(threadId: string, config: ThreadConfig): Promise<void>;
|
|
5012
|
+
/**
|
|
5013
|
+
* Explicitly sets or updates the AgentState for a specific thread by calling the underlying state repository.
|
|
5014
|
+
* If in 'implicit' mode, this also updates the cached snapshot to prevent `saveStateIfModified`
|
|
5015
|
+
* from re-saving the same state immediately.
|
|
5016
|
+
* @param {string} threadId - The unique identifier of the thread.
|
|
5017
|
+
* @param {AgentState} state - The AgentState object to save. Must not be undefined or null.
|
|
5018
|
+
* @returns {Promise<void>} A promise that resolves when the state is saved.
|
|
5019
|
+
* @throws {Error} If threadId or state is undefined/null, or if the repository fails.
|
|
5020
|
+
*/
|
|
5021
|
+
setAgentState(threadId: string, state: AgentState): Promise<void>;
|
|
5022
|
+
/**
|
|
5023
|
+
* Enables specific tools for a conversation thread by adding them to the thread's enabled tools list.
|
|
5024
|
+
* This method loads the current thread configuration, updates the enabledTools array,
|
|
5025
|
+
* and persists the changes. Cache is invalidated to ensure fresh data on next load.
|
|
5026
|
+
* @param {string} threadId - The unique identifier of the thread.
|
|
5027
|
+
* @param {string[]} toolNames - Array of tool names to enable for this thread.
|
|
5028
|
+
* @returns {Promise<void>} A promise that resolves when the tools are enabled.
|
|
5029
|
+
* @throws {Error} If threadId is empty, toolNames is empty, or if the repository fails.
|
|
5030
|
+
*/
|
|
5031
|
+
enableToolsForThread(threadId: string, toolNames: string[]): Promise<void>;
|
|
5032
|
+
/**
|
|
5033
|
+
* Disables specific tools for a conversation thread by removing them from the thread's enabled tools list.
|
|
5034
|
+
* This method loads the current thread configuration, updates the enabledTools array,
|
|
5035
|
+
* and persists the changes. Cache is invalidated to ensure fresh data on next load.
|
|
5036
|
+
* @param {string} threadId - The unique identifier of the thread.
|
|
5037
|
+
* @param {string[]} toolNames - Array of tool names to disable for this thread.
|
|
5038
|
+
* @returns {Promise<void>} A promise that resolves when the tools are disabled.
|
|
5039
|
+
* @throws {Error} If threadId is empty, toolNames is empty, or if the repository fails.
|
|
5040
|
+
*/
|
|
5041
|
+
disableToolsForThread(threadId: string, toolNames: string[]): Promise<void>;
|
|
5042
|
+
/**
|
|
5043
|
+
* Gets the list of currently enabled tools for a specific thread.
|
|
5044
|
+
* This is a convenience method that loads the thread context and returns the enabledTools array.
|
|
5045
|
+
* @param {string} threadId - The unique identifier of the thread.
|
|
5046
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of enabled tool names, or empty array if no tools are enabled.
|
|
5047
|
+
* @throws {Error} If the thread context cannot be loaded.
|
|
5048
|
+
*/
|
|
5049
|
+
getEnabledToolsForThread(threadId: string): Promise<string[]>;
|
|
5050
|
+
/**
|
|
5051
|
+
* Clears the internal context cache. Useful if the underlying storage is manipulated externally
|
|
5052
|
+
* during an agent's processing cycle, though this is generally not recommended.
|
|
5053
|
+
* Or for testing purposes.
|
|
5054
|
+
*/
|
|
5055
|
+
clearCache(): void;
|
|
5056
|
+
}
|
|
5057
|
+
|
|
5058
|
+
/**
|
|
5059
|
+
* A simple in-memory implementation of the `ToolRegistry` interface.
|
|
5060
|
+
* Stores tool executors in a Map, keyed by the tool's unique name.
|
|
5061
|
+
*/
|
|
5062
|
+
declare class ToolRegistry implements ToolRegistry$1 {
|
|
5063
|
+
private executors;
|
|
5064
|
+
private stateManager;
|
|
5065
|
+
/**
|
|
5066
|
+
* Creates an instance of ToolRegistry.
|
|
5067
|
+
* @param stateManager - Optional StateManager instance for advanced filtering.
|
|
5068
|
+
*/
|
|
5069
|
+
constructor(stateManager?: StateManager$1);
|
|
5070
|
+
/**
|
|
5071
|
+
* Registers a tool executor instance, making it available for lookup via `getToolExecutor`.
|
|
5072
|
+
* If a tool with the same name (from `executor.schema.name`) already exists, it will be overwritten, and a warning will be logged.
|
|
5073
|
+
* @param executor - The instance of the class implementing `IToolExecutor`. Must have a valid schema with a name.
|
|
5074
|
+
* @returns A promise that resolves when the tool is registered.
|
|
5075
|
+
* @throws {Error} If the provided executor or its schema is invalid.
|
|
5076
|
+
*/
|
|
5077
|
+
registerTool(executor: IToolExecutor): Promise<void>;
|
|
5078
|
+
/**
|
|
5079
|
+
* Retrieves a registered tool executor instance by its unique name.
|
|
5080
|
+
* @param toolName - The `name` property defined in the tool's schema.
|
|
5081
|
+
* @returns A promise resolving to the `IToolExecutor` instance, or `undefined` if no tool with that name is registered.
|
|
5082
|
+
*/
|
|
5083
|
+
getToolExecutor(toolName: string): Promise<IToolExecutor | undefined>;
|
|
5084
|
+
/**
|
|
5085
|
+
* Retrieves the schemas of all currently registered tools.
|
|
5086
|
+
* Retrieves the schemas of available tools, optionally filtering by those enabled for a specific thread.
|
|
5087
|
+
* If `filter.enabledForThreadId` is provided and a `StateManager` was injected, it attempts to load the thread's configuration
|
|
5088
|
+
* and return only the schemas for tools listed in `enabledTools`. Otherwise, it returns all registered tool schemas.
|
|
5089
|
+
* @param filter - Optional filter criteria. `enabledForThreadId` triggers filtering based on thread config.
|
|
5090
|
+
* @returns A promise resolving to an array containing the `ToolSchema` of the available tools based on the filter.
|
|
5091
|
+
*/
|
|
5092
|
+
getAvailableTools(filter?: {
|
|
5093
|
+
enabledForThreadId?: string;
|
|
5094
|
+
}): Promise<ToolSchema[]>;
|
|
5095
|
+
/**
|
|
5096
|
+
* Removes all registered tool executors from the registry.
|
|
5097
|
+
* Primarily useful for resetting state during testing or specific application scenarios.
|
|
5098
|
+
* @returns A promise that resolves when all tools have been cleared.
|
|
5099
|
+
*/
|
|
5100
|
+
clearAllTools(): Promise<void>;
|
|
5101
|
+
/**
|
|
5102
|
+
* Unregister a single tool by name.
|
|
5103
|
+
*/
|
|
5104
|
+
unregisterTool(toolName: string): Promise<void>;
|
|
5105
|
+
/**
|
|
5106
|
+
* Unregister tools matching a predicate; returns count removed.
|
|
5107
|
+
*/
|
|
5108
|
+
unregisterTools(predicate: (schema: ToolSchema) => boolean): Promise<number>;
|
|
5109
|
+
}
|
|
5110
|
+
|
|
5111
|
+
/**
|
|
5112
|
+
* Manages the lifecycle and access to multiple ProviderAdapter implementations.
|
|
5113
|
+
*/
|
|
5114
|
+
declare class ProviderManagerImpl implements IProviderManager {
|
|
5115
|
+
private availableProviders;
|
|
5116
|
+
private maxParallelApiInstancesPerProvider;
|
|
5117
|
+
private apiInstanceIdleTimeoutMs;
|
|
5118
|
+
private managedInstances;
|
|
5119
|
+
private requestQueue;
|
|
5120
|
+
constructor(config: ProviderManagerConfig);
|
|
5121
|
+
/**
|
|
5122
|
+
* Generates a stable configuration signature for caching.
|
|
5123
|
+
* @param config The runtime provider configuration.
|
|
5124
|
+
* @returns A string signature.
|
|
5125
|
+
*/
|
|
5126
|
+
private _getConfigSignature;
|
|
5127
|
+
getAvailableProviders(): string[];
|
|
5128
|
+
getAdapter(config: RuntimeProviderConfig): Promise<ManagedAdapterAccessor>;
|
|
5129
|
+
/**
|
|
5130
|
+
* Internal method to release an adapter instance back to the manager.
|
|
5131
|
+
* @param configSignature The signature of the instance to release.
|
|
5132
|
+
*/
|
|
5133
|
+
private _releaseAdapter;
|
|
5134
|
+
/**
|
|
5135
|
+
* Internal method to evict an instance from the manager.
|
|
5136
|
+
* @param configSignature The signature of the instance to evict.
|
|
5137
|
+
*/
|
|
5138
|
+
private _evictInstance;
|
|
5139
|
+
}
|
|
5140
|
+
|
|
4686
5141
|
/**
|
|
4687
5142
|
* Generates a unique Version 4 UUID (Universally Unique Identifier) string.
|
|
4688
5143
|
*
|
|
@@ -4750,6 +5205,6 @@ declare const generateUUID: () => string;
|
|
|
4750
5205
|
/**
|
|
4751
5206
|
* The current version of the ART Framework package.
|
|
4752
5207
|
*/
|
|
4753
|
-
declare const VERSION = "0.
|
|
5208
|
+
declare const VERSION = "0.3.3";
|
|
4754
5209
|
|
|
4755
|
-
export { type A2AAgentInfo, type A2ATask, type A2ATaskEvent, type A2ATaskFilter, type A2ATaskMetadata, A2ATaskPriority, type A2ATaskResult, A2ATaskSocket, A2ATaskStatus, ARTError, AdapterInstantiationError, type AgentDiscoveryConfig, AgentDiscoveryService, type AgentFinalResponse, type AgentOptions, type AgentPersona, type AgentProps, type AgentState, AnthropicAdapter, type AnthropicAdapterOptions, ApiQueueTimeoutError, type ArtInstance, type ArtInstanceConfig, type ArtStandardMessage, type ArtStandardMessageRole, ArtStandardMessageSchema, type ArtStandardPrompt, ArtStandardPromptSchema, AuthManager, type AvailableProviderEntry, CalculatorTool, type CallOptions, type ConversationManager, type ConversationMessage, ConversationSocket, type CreateA2ATaskRequest, DeepSeekAdapter, type DeepSeekAdapterOptions, ErrorCode, type ExecutionContext, type ExecutionMetadata, type FilterOptions, type FormattedPrompt, GeminiAdapter, type GeminiAdapterOptions, type IA2ATaskRepository, type IAgentCore, type IAuthStrategy, type IConversationRepository, type IObservationRepository, type IProviderManager, type IStateRepository, type IToolExecutor, type ITypedSocket, InMemoryStorageAdapter, IndexedDBStorageAdapter, type JsonObjectSchema, type JsonSchema, type LLMMetadata, LLMStreamSocket, LocalInstanceBusyError, LocalProviderConflictError, LogLevel, Logger, type LoggerConfig, type ManagedAdapterAccessor, McpClientController, McpManager, type McpManagerConfig, McpProxyTool, type McpResource, type McpResourceTemplate, type McpServerConfig, type McpServerStatus, type McpToolDefinition, type MessageOptions, MessageRole, ModelCapability, type Observation, type ObservationFilter, type ObservationManager, ObservationSocket, ObservationType, OllamaAdapter, type OllamaAdapterOptions, OpenAIAdapter, type OpenAIAdapterOptions, OpenRouterAdapter, type OpenRouterAdapterOptions, type OutputParser, PESAgent, type PKCEOAuthConfig, PKCEOAuthStrategy, type ParsedToolCall, type PromptBlueprint, type PromptContext, type PromptManager, type ProviderAdapter, type ProviderManagerConfig, type ReasoningEngine, type RuntimeProviderConfig, type StageSpecificPrompts,
|
|
5210
|
+
export { type A2AAgentInfo, type A2ATask, type A2ATaskEvent, type A2ATaskFilter, type A2ATaskMetadata, A2ATaskPriority, type A2ATaskResult, A2ATaskSocket, A2ATaskStatus, ARTError, AdapterInstantiationError, type AgentDiscoveryConfig, AgentDiscoveryService, type AgentFinalResponse, type AgentOptions, type AgentPersona, type AgentProps, type AgentState, AnthropicAdapter, type AnthropicAdapterOptions, ApiKeyStrategy, ApiQueueTimeoutError, type ArtInstance, type ArtInstanceConfig, type ArtStandardMessage, type ArtStandardMessageRole, ArtStandardMessageSchema, type ArtStandardPrompt, ArtStandardPromptSchema, AuthManager, type AvailableProviderEntry, CalculatorTool, type CallOptions, type ConversationManager, type ConversationMessage, ConversationSocket, type CreateA2ATaskRequest, DeepSeekAdapter, type DeepSeekAdapterOptions, ErrorCode, type ExecutionContext, type ExecutionMetadata, type FilterOptions, type FormattedPrompt, GeminiAdapter, type GeminiAdapterOptions, GenericOAuthStrategy, type IA2ATaskRepository, type IAgentCore, type IAuthStrategy, type IConversationRepository, type IObservationRepository, type IProviderManager, type IStateRepository, type IToolExecutor, type ITypedSocket, InMemoryStorageAdapter, IndexedDBStorageAdapter, type JsonObjectSchema, type JsonSchema, type LLMMetadata, LLMStreamSocket, LocalInstanceBusyError, LocalProviderConflictError, LogLevel, Logger, type LoggerConfig, type ManagedAdapterAccessor, McpClientController, McpManager, type McpManagerConfig, McpProxyTool, type McpResource, type McpResourceTemplate, type McpServerConfig, type McpServerStatus, type McpToolDefinition, type MessageOptions, MessageRole, ModelCapability, type OAuthConfig, type Observation, type ObservationFilter, type ObservationManager, ObservationSocket, ObservationType, OllamaAdapter, type OllamaAdapterOptions, OpenAIAdapter, type OpenAIAdapterOptions, OpenRouterAdapter, type OpenRouterAdapterOptions, type OutputParser, PESAgent, type PKCEOAuthConfig, PKCEOAuthStrategy, type ParsedToolCall, type PromptBlueprint, type PromptContext, type PromptManager, type ProviderAdapter, type ProviderManagerConfig, ProviderManagerImpl, type ReasoningEngine, type RuntimeProviderConfig, type StageSpecificPrompts, StateManager, type StateSavingStrategy, type StorageAdapter, type StreamEvent, type StreamEventTypeFilter, SupabaseStorageAdapter, type SystemPromptMergeStrategy, type SystemPromptOverride, type SystemPromptResolver, type SystemPromptSpec, type SystemPromptsRegistry, type TaskDelegationConfig, TaskDelegationService, type TaskStatusResponse, type ThreadConfig, type ThreadContext, ToolRegistry, type ToolResult, type ToolSchema, type ToolSystem, TypedSocket, UISystem, UnknownProviderError, type UnsubscribeFunction, type UpdateA2ATaskRequest, VERSION, type ZyntopiaOAuthConfig, ZyntopiaOAuthStrategy, createArtInstance, generateUUID };
|