@robota-sdk/agent-core 3.0.0-beta.52 → 3.0.0-beta.54
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/CHANGELOG.md +13 -0
- package/dist/browser/index.d.ts +161 -216
- package/dist/browser/index.js +7 -7
- package/dist/node/index.cjs +7 -7
- package/dist/node/index.d.cts +161 -216
- package/dist/node/index.d.ts +161 -216
- package/dist/node/index.js +7 -7
- package/package.json +3 -1
package/dist/node/index.d.ts
CHANGED
|
@@ -202,6 +202,16 @@ interface IPluginContext {
|
|
|
202
202
|
error?: Error;
|
|
203
203
|
executionContext?: TContextData;
|
|
204
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* Type utility functions for safe type checking and validation
|
|
207
|
+
* @internal
|
|
208
|
+
*/
|
|
209
|
+
declare const TypeUtils: {
|
|
210
|
+
isPrimitive: (value: TUniversalValue) => value is TPrimitiveValue;
|
|
211
|
+
isArray: (value: TUniversalValue) => value is TUniversalArrayValue;
|
|
212
|
+
isObject: (value: TUniversalValue) => value is IUniversalObjectValue;
|
|
213
|
+
isUniversalValue: (value: TUniversalValue) => value is TUniversalValue;
|
|
214
|
+
};
|
|
205
215
|
|
|
206
216
|
/**
|
|
207
217
|
* Reusable type definitions for provider layer
|
|
@@ -714,57 +724,6 @@ interface IParameterValidationResult {
|
|
|
714
724
|
* Generic tool executor function
|
|
715
725
|
*/
|
|
716
726
|
type TToolExecutor<TParams = TToolParameters, TResult = TUniversalValue> = (parameters: TParams, context?: IToolExecutionContext) => Promise<TResult>;
|
|
717
|
-
/**
|
|
718
|
-
* OpenAPI specification configuration
|
|
719
|
-
*/
|
|
720
|
-
interface IOpenAPIToolConfig {
|
|
721
|
-
/** OpenAPI 3.0 specification */
|
|
722
|
-
spec: {
|
|
723
|
-
openapi: string;
|
|
724
|
-
info: {
|
|
725
|
-
title: string;
|
|
726
|
-
version: string;
|
|
727
|
-
description?: string;
|
|
728
|
-
};
|
|
729
|
-
servers?: Array<{
|
|
730
|
-
url: string;
|
|
731
|
-
description?: string;
|
|
732
|
-
}>;
|
|
733
|
-
paths: Record<string, Record<string, string | number | boolean | Record<string, string | number | boolean>>>;
|
|
734
|
-
components?: Record<string, Record<string, string | number | boolean>>;
|
|
735
|
-
};
|
|
736
|
-
/** Operation ID from the OpenAPI spec */
|
|
737
|
-
operationId: string;
|
|
738
|
-
/** Base URL for API calls */
|
|
739
|
-
baseURL: string;
|
|
740
|
-
/** Authentication configuration */
|
|
741
|
-
auth?: {
|
|
742
|
-
type: 'bearer' | 'apiKey' | 'basic';
|
|
743
|
-
token?: string;
|
|
744
|
-
apiKey?: string;
|
|
745
|
-
header?: string;
|
|
746
|
-
username?: string;
|
|
747
|
-
password?: string;
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* MCP (Model Context Protocol) configuration
|
|
752
|
-
*/
|
|
753
|
-
interface IMCPToolConfig {
|
|
754
|
-
/** MCP server endpoint */
|
|
755
|
-
endpoint: string;
|
|
756
|
-
/** Protocol version */
|
|
757
|
-
version?: string;
|
|
758
|
-
/** Authentication configuration */
|
|
759
|
-
auth?: {
|
|
760
|
-
type: 'bearer' | 'apiKey';
|
|
761
|
-
token: string;
|
|
762
|
-
};
|
|
763
|
-
/** Tool-specific configuration */
|
|
764
|
-
toolConfig?: Record<string, string | number | boolean>;
|
|
765
|
-
/** Timeout in milliseconds */
|
|
766
|
-
timeout?: number;
|
|
767
|
-
}
|
|
768
727
|
/**
|
|
769
728
|
* Base tool interface
|
|
770
729
|
*/
|
|
@@ -828,23 +787,6 @@ interface IToolRegistry {
|
|
|
828
787
|
*/
|
|
829
788
|
clear(): void;
|
|
830
789
|
}
|
|
831
|
-
/**
|
|
832
|
-
* Tool factory interface
|
|
833
|
-
*/
|
|
834
|
-
interface IToolFactory {
|
|
835
|
-
/**
|
|
836
|
-
* Create function tool from schema and function
|
|
837
|
-
*/
|
|
838
|
-
createFunctionTool(schema: IToolSchema, fn: TToolExecutor): IFunctionTool;
|
|
839
|
-
/**
|
|
840
|
-
* Create tool from OpenAPI specification
|
|
841
|
-
*/
|
|
842
|
-
createOpenAPITool(config: IOpenAPIToolConfig): ITool;
|
|
843
|
-
/**
|
|
844
|
-
* Create MCP tool
|
|
845
|
-
*/
|
|
846
|
-
createMCPTool(config: IMCPToolConfig): ITool;
|
|
847
|
-
}
|
|
848
790
|
|
|
849
791
|
declare const EXECUTION_EVENT_NAMES: {
|
|
850
792
|
readonly START: "execution.start";
|
|
@@ -985,6 +927,24 @@ interface ILogger {
|
|
|
985
927
|
* - Inject a real logger explicitly if you want output.
|
|
986
928
|
*/
|
|
987
929
|
declare const SilentLogger: ILogger;
|
|
930
|
+
/**
|
|
931
|
+
* Console logger implementation
|
|
932
|
+
* @internal
|
|
933
|
+
*/
|
|
934
|
+
declare class ConsoleLogger implements ILogger {
|
|
935
|
+
private level?;
|
|
936
|
+
private packageName;
|
|
937
|
+
private sinkLogger;
|
|
938
|
+
constructor(packageName: string, logger?: ILogger);
|
|
939
|
+
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
940
|
+
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
941
|
+
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
942
|
+
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
943
|
+
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
944
|
+
private getLevel;
|
|
945
|
+
private shouldLog;
|
|
946
|
+
private forward;
|
|
947
|
+
}
|
|
988
948
|
/**
|
|
989
949
|
* Create a named logger instance for a package or module.
|
|
990
950
|
* Use this to create loggers with a specific name prefix for easy log filtering.
|
|
@@ -1941,6 +1901,75 @@ interface IAgentFactory {
|
|
|
1941
1901
|
mergeConfig(base: IAgentConfig, override: Partial<IAgentConfig>): IAgentConfig;
|
|
1942
1902
|
}
|
|
1943
1903
|
|
|
1904
|
+
/**
|
|
1905
|
+
* OpenAPI specification configuration
|
|
1906
|
+
*/
|
|
1907
|
+
interface IOpenAPIToolConfig {
|
|
1908
|
+
/** OpenAPI 3.0 specification */
|
|
1909
|
+
spec: {
|
|
1910
|
+
openapi: string;
|
|
1911
|
+
info: {
|
|
1912
|
+
title: string;
|
|
1913
|
+
version: string;
|
|
1914
|
+
description?: string;
|
|
1915
|
+
};
|
|
1916
|
+
servers?: Array<{
|
|
1917
|
+
url: string;
|
|
1918
|
+
description?: string;
|
|
1919
|
+
}>;
|
|
1920
|
+
paths: Record<string, Record<string, string | number | boolean | Record<string, string | number | boolean>>>;
|
|
1921
|
+
components?: Record<string, Record<string, string | number | boolean>>;
|
|
1922
|
+
};
|
|
1923
|
+
/** Operation ID from the OpenAPI spec */
|
|
1924
|
+
operationId: string;
|
|
1925
|
+
/** Base URL for API calls */
|
|
1926
|
+
baseURL: string;
|
|
1927
|
+
/** Authentication configuration */
|
|
1928
|
+
auth?: {
|
|
1929
|
+
type: 'bearer' | 'apiKey' | 'basic';
|
|
1930
|
+
token?: string;
|
|
1931
|
+
apiKey?: string;
|
|
1932
|
+
header?: string;
|
|
1933
|
+
username?: string;
|
|
1934
|
+
password?: string;
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
/**
|
|
1938
|
+
* MCP (Model Context Protocol) configuration
|
|
1939
|
+
*/
|
|
1940
|
+
interface IMCPToolConfig {
|
|
1941
|
+
/** MCP server endpoint */
|
|
1942
|
+
endpoint: string;
|
|
1943
|
+
/** Protocol version */
|
|
1944
|
+
version?: string;
|
|
1945
|
+
/** Authentication configuration */
|
|
1946
|
+
auth?: {
|
|
1947
|
+
type: 'bearer' | 'apiKey';
|
|
1948
|
+
token: string;
|
|
1949
|
+
};
|
|
1950
|
+
/** Tool-specific configuration */
|
|
1951
|
+
toolConfig?: Record<string, string | number | boolean>;
|
|
1952
|
+
/** Timeout in milliseconds */
|
|
1953
|
+
timeout?: number;
|
|
1954
|
+
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Tool factory interface
|
|
1957
|
+
*/
|
|
1958
|
+
interface IToolFactory {
|
|
1959
|
+
/**
|
|
1960
|
+
* Create function tool from schema and function
|
|
1961
|
+
*/
|
|
1962
|
+
createFunctionTool(schema: IToolSchema, fn: TToolExecutor): IFunctionTool;
|
|
1963
|
+
/**
|
|
1964
|
+
* Create tool from OpenAPI specification
|
|
1965
|
+
*/
|
|
1966
|
+
createOpenAPITool(config: IOpenAPIToolConfig): ITool;
|
|
1967
|
+
/**
|
|
1968
|
+
* Create MCP tool
|
|
1969
|
+
*/
|
|
1970
|
+
createMCPTool(config: IMCPToolConfig): ITool;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1944
1973
|
/**
|
|
1945
1974
|
* Execution step definition for tools that support step-by-step progress reporting
|
|
1946
1975
|
*/
|
|
@@ -2507,72 +2536,13 @@ interface IExecutorAwareProviderConfig {
|
|
|
2507
2536
|
[key: string]: string | number | boolean | IExecutor | undefined;
|
|
2508
2537
|
}
|
|
2509
2538
|
/**
|
|
2510
|
-
* Base AI provider implementation with proper type constraints
|
|
2511
|
-
* All AI providers should extend this class
|
|
2512
|
-
*
|
|
2513
|
-
* ========================================
|
|
2514
|
-
* CRITICAL IMPLEMENTATION GUIDELINES
|
|
2515
|
-
* ========================================
|
|
2516
|
-
*
|
|
2517
|
-
* ALL AI PROVIDER IMPLEMENTATIONS (OpenAI, Anthropic, Google, etc.) MUST:
|
|
2539
|
+
* Base AI provider implementation with proper type constraints.
|
|
2540
|
+
* All AI providers should extend this class.
|
|
2518
2541
|
*
|
|
2519
|
-
*
|
|
2520
|
-
*
|
|
2521
|
-
* export class OpenAIProvider extends AbstractAIProvider {
|
|
2522
|
-
* override readonly name = 'openai';
|
|
2523
|
-
* override readonly version = '1.0.0';
|
|
2524
|
-
* ```
|
|
2542
|
+
* Subclasses MUST: extend this class, use override keyword, call super() in constructor,
|
|
2543
|
+
* not redefine types that exist in agent-core, handle null message content correctly.
|
|
2525
2544
|
*
|
|
2526
|
-
*
|
|
2527
|
-
* ```typescript
|
|
2528
|
-
* import { AbstractAIProvider } from '@robota-sdk/agent-core';
|
|
2529
|
-
* import type {
|
|
2530
|
-
* TUniversalMessage,
|
|
2531
|
-
* ChatOptions,
|
|
2532
|
-
* IToolCall,
|
|
2533
|
-
* ToolSchema,
|
|
2534
|
-
* AssistantMessage
|
|
2535
|
-
* } from '@robota-sdk/agent-core';
|
|
2536
|
-
* ```
|
|
2537
|
-
*
|
|
2538
|
-
* 3. USE OVERRIDE KEYWORD FOR ALL INHERITED METHODS:
|
|
2539
|
-
* - override async chat(...)
|
|
2540
|
-
* - override async *chatStream(...)
|
|
2541
|
-
* - override supportsTools()
|
|
2542
|
-
* - override validateConfig()
|
|
2543
|
-
* - override async dispose()
|
|
2544
|
-
*
|
|
2545
|
-
* 4. DO NOT REDEFINE TYPES THAT EXIST IN @robota-sdk/agent-core:
|
|
2546
|
-
* - TUniversalMessage
|
|
2547
|
-
* - ChatOptions
|
|
2548
|
-
* - IToolCall
|
|
2549
|
-
* - ToolSchema
|
|
2550
|
-
* - AssistantMessage
|
|
2551
|
-
* - SystemMessage
|
|
2552
|
-
* - UserMessage
|
|
2553
|
-
* - ToolMessage
|
|
2554
|
-
*
|
|
2555
|
-
* 5. HANDLE MESSAGE CONTENT PROPERLY:
|
|
2556
|
-
* - For tool calls: content should be null (not empty string)
|
|
2557
|
-
* - For regular messages: content can be string or null
|
|
2558
|
-
* - Always preserve null values from API responses
|
|
2559
|
-
*
|
|
2560
|
-
* 6. CALL SUPER() IN CONSTRUCTOR:
|
|
2561
|
-
* ```typescript
|
|
2562
|
-
* constructor(options: IProviderOptions) {
|
|
2563
|
-
* super();
|
|
2564
|
-
* // provider-specific initialization
|
|
2565
|
-
* }
|
|
2566
|
-
* ```
|
|
2567
|
-
*
|
|
2568
|
-
* This ensures ExecutionService can properly identify providers
|
|
2569
|
-
* and prevents type conflicts across the codebase.
|
|
2570
|
-
*
|
|
2571
|
-
* ========================================
|
|
2572
|
-
*
|
|
2573
|
-
* @template TConfig - Provider configuration type (defaults to IProviderConfig for type safety)
|
|
2574
|
-
* @template TUniversalMessage - Message type (defaults to TUniversalMessage for backward compatibility)
|
|
2575
|
-
* @template TResponse - Response type (defaults to TUniversalMessage for backward compatibility)
|
|
2545
|
+
* @template TConfig - Provider configuration type
|
|
2576
2546
|
*/
|
|
2577
2547
|
declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements IAIProvider {
|
|
2578
2548
|
abstract readonly name: string;
|
|
@@ -2633,25 +2603,17 @@ declare abstract class AbstractAIProvider<TConfig = IProviderConfig> implements
|
|
|
2633
2603
|
* @returns true if configuration is valid
|
|
2634
2604
|
*/
|
|
2635
2605
|
validateConfig(): boolean;
|
|
2636
|
-
/**
|
|
2637
|
-
* Utility method for validating TUniversalMessage array
|
|
2638
|
-
* @param messages - Messages to validate
|
|
2639
|
-
*/
|
|
2606
|
+
/** Validate that messages is a non-empty array with valid roles. */
|
|
2640
2607
|
protected validateMessages(messages: TUniversalMessage[]): void;
|
|
2641
|
-
/**
|
|
2642
|
-
* Utility method for validating tool schemas
|
|
2643
|
-
* @param tools - Tool schemas to validate
|
|
2644
|
-
*/
|
|
2608
|
+
/** Validate tool schemas. No-ops if tools is undefined. */
|
|
2645
2609
|
protected validateTools(tools?: IToolSchema[]): void;
|
|
2646
2610
|
/**
|
|
2647
2611
|
* Execute chat via executor.
|
|
2648
|
-
*
|
|
2649
2612
|
* Subclasses should call this only when an executor is configured.
|
|
2650
2613
|
*/
|
|
2651
2614
|
protected executeViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): Promise<TUniversalMessage>;
|
|
2652
2615
|
/**
|
|
2653
2616
|
* Execute streaming chat via executor.
|
|
2654
|
-
*
|
|
2655
2617
|
* Subclasses should call this only when an executor is configured.
|
|
2656
2618
|
*/
|
|
2657
2619
|
protected executeStreamViaExecutorOrDirect(messages: TUniversalMessage[], options?: IChatOptions): AsyncIterable<TUniversalMessage>;
|
|
@@ -3174,6 +3136,8 @@ declare class ConversationHistory {
|
|
|
3174
3136
|
conversationIds: string[];
|
|
3175
3137
|
totalMessages: number;
|
|
3176
3138
|
};
|
|
3139
|
+
/** @internal */
|
|
3140
|
+
private cleanupOldConversations;
|
|
3177
3141
|
}
|
|
3178
3142
|
|
|
3179
3143
|
/**
|
|
@@ -3304,7 +3268,6 @@ interface IEventEmitterHierarchicalEventData extends IEventEmitterEventData {
|
|
|
3304
3268
|
actualResult?: IToolResult;
|
|
3305
3269
|
};
|
|
3306
3270
|
}
|
|
3307
|
-
|
|
3308
3271
|
/** Event emitter configuration */
|
|
3309
3272
|
interface IEventEmitterPluginOptions extends IPluginOptions {
|
|
3310
3273
|
events?: TEventName[];
|
|
@@ -3361,17 +3324,49 @@ declare class EventEmitterPlugin extends AbstractPlugin<IEventEmitterPluginOptio
|
|
|
3361
3324
|
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
3362
3325
|
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
3363
3326
|
private processEvent;
|
|
3364
|
-
private executeHandler;
|
|
3365
3327
|
flushBuffer(): Promise<void>;
|
|
3366
3328
|
getStats(): IEventEmitterPluginStats;
|
|
3367
3329
|
clearAllListeners(): void;
|
|
3368
3330
|
destroy(): Promise<void>;
|
|
3369
|
-
private validateOptions;
|
|
3370
3331
|
}
|
|
3371
3332
|
|
|
3333
|
+
/**
|
|
3334
|
+
* Configuration and tool management delegate for the Robota agent.
|
|
3335
|
+
*
|
|
3336
|
+
* Extracted from robota.ts to keep the main class under 300 lines.
|
|
3337
|
+
*/
|
|
3338
|
+
|
|
3372
3339
|
/** Agent statistics metadata type */
|
|
3373
3340
|
type TAgentStatsMetadata = Record<string, string | number | boolean | Date | string[]>;
|
|
3374
3341
|
|
|
3342
|
+
/** Shared model configuration shape used in setModel / getModel. */
|
|
3343
|
+
type TModelConfig = {
|
|
3344
|
+
provider: string;
|
|
3345
|
+
model: string;
|
|
3346
|
+
temperature?: number;
|
|
3347
|
+
maxTokens?: number;
|
|
3348
|
+
topP?: number;
|
|
3349
|
+
systemMessage?: string;
|
|
3350
|
+
};
|
|
3351
|
+
/** Return shape of getConfiguration(). */
|
|
3352
|
+
type TConfigurationSnapshot = {
|
|
3353
|
+
version: number;
|
|
3354
|
+
tools: Array<{
|
|
3355
|
+
name: string;
|
|
3356
|
+
parameters?: string[];
|
|
3357
|
+
}>;
|
|
3358
|
+
updatedAt: number;
|
|
3359
|
+
};
|
|
3360
|
+
/** Return shape of getModuleStats(). */
|
|
3361
|
+
type TModuleStats = {
|
|
3362
|
+
totalExecutions: number;
|
|
3363
|
+
successfulExecutions: number;
|
|
3364
|
+
failedExecutions: number;
|
|
3365
|
+
averageExecutionTime: number;
|
|
3366
|
+
lastExecutionTime?: Date;
|
|
3367
|
+
} | undefined;
|
|
3368
|
+
/** Shorthand for the plugin contract type used throughout this class. */
|
|
3369
|
+
type TPlugin = IPluginContract<IPluginOptions, IPluginStats> & IPluginHooks;
|
|
3375
3370
|
/**
|
|
3376
3371
|
* Core AI agent integrating multiple AI providers, tools, and plugins
|
|
3377
3372
|
* into a unified conversational interface.
|
|
@@ -3401,68 +3396,33 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3401
3396
|
private pluginManager;
|
|
3402
3397
|
private configManager;
|
|
3403
3398
|
constructor(config: IAgentConfig);
|
|
3404
|
-
private initDelegates;
|
|
3405
|
-
private emitCreatedEvent;
|
|
3406
3399
|
run(input: string, options?: IRunOptions): Promise<string>;
|
|
3407
3400
|
runStream(input: string, options?: IRunOptions): AsyncGenerator<string, void, undefined>;
|
|
3408
3401
|
private executionDeps;
|
|
3409
3402
|
getHistory(): TUniversalMessage[];
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
id: string;
|
|
3413
|
-
timestamp: Date;
|
|
3414
|
-
category: string;
|
|
3415
|
-
type: string;
|
|
3416
|
-
data?: unknown;
|
|
3417
|
-
}>;
|
|
3418
|
-
/** Add an event entry to history */
|
|
3419
|
-
addHistoryEntry(entry: {
|
|
3420
|
-
id: string;
|
|
3421
|
-
timestamp: Date;
|
|
3422
|
-
category: string;
|
|
3423
|
-
type: string;
|
|
3424
|
-
data?: unknown;
|
|
3425
|
-
}): void;
|
|
3403
|
+
getFullHistory(): IHistoryEntry[];
|
|
3404
|
+
addHistoryEntry(entry: IHistoryEntry): void;
|
|
3426
3405
|
clearHistory(): void;
|
|
3427
|
-
|
|
3428
|
-
|
|
3406
|
+
injectMessage(role: 'user' | 'assistant' | 'system' | 'tool', content: string, options?: {
|
|
3407
|
+
toolCallId?: string;
|
|
3408
|
+
name?: string;
|
|
3409
|
+
}): void;
|
|
3429
3410
|
updateTools(next: Array<IToolWithEventService>): Promise<{
|
|
3430
3411
|
version: number;
|
|
3431
3412
|
}>;
|
|
3432
3413
|
updateConfiguration(patch: Partial<IAgentConfig>): Promise<{
|
|
3433
3414
|
version: number;
|
|
3434
3415
|
}>;
|
|
3435
|
-
getConfiguration(): Promise<
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
name: string;
|
|
3439
|
-
parameters?: string[];
|
|
3440
|
-
}>;
|
|
3441
|
-
updatedAt: number;
|
|
3442
|
-
}>;
|
|
3443
|
-
setModel(mc: {
|
|
3444
|
-
provider: string;
|
|
3445
|
-
model: string;
|
|
3446
|
-
temperature?: number;
|
|
3447
|
-
maxTokens?: number;
|
|
3448
|
-
topP?: number;
|
|
3449
|
-
systemMessage?: string;
|
|
3450
|
-
}): void;
|
|
3451
|
-
getModel(): {
|
|
3452
|
-
provider: string;
|
|
3453
|
-
model: string;
|
|
3454
|
-
temperature?: number;
|
|
3455
|
-
maxTokens?: number;
|
|
3456
|
-
topP?: number;
|
|
3457
|
-
systemMessage?: string;
|
|
3458
|
-
};
|
|
3416
|
+
getConfiguration(): Promise<TConfigurationSnapshot>;
|
|
3417
|
+
setModel(mc: TModelConfig): void;
|
|
3418
|
+
getModel(): TModelConfig;
|
|
3459
3419
|
registerTool(tool: AbstractTool): void;
|
|
3460
3420
|
unregisterTool(toolName: string): void;
|
|
3461
3421
|
getConfig(): IAgentConfig;
|
|
3462
|
-
addPlugin(plugin:
|
|
3422
|
+
addPlugin(plugin: TPlugin): void;
|
|
3463
3423
|
removePlugin(pluginName: string): boolean;
|
|
3464
|
-
getPlugin(pluginName: string):
|
|
3465
|
-
getPlugins():
|
|
3424
|
+
getPlugin(pluginName: string): TPlugin | undefined;
|
|
3425
|
+
getPlugins(): TPlugin[];
|
|
3466
3426
|
getPluginNames(): string[];
|
|
3467
3427
|
registerModule(module: IModule, options?: {
|
|
3468
3428
|
autoInitialize?: boolean;
|
|
@@ -3485,13 +3445,7 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3485
3445
|
error?: Error;
|
|
3486
3446
|
duration?: number;
|
|
3487
3447
|
}>;
|
|
3488
|
-
getModuleStats(moduleName: string):
|
|
3489
|
-
totalExecutions: number;
|
|
3490
|
-
successfulExecutions: number;
|
|
3491
|
-
failedExecutions: number;
|
|
3492
|
-
averageExecutionTime: number;
|
|
3493
|
-
lastExecutionTime?: Date;
|
|
3494
|
-
} | undefined;
|
|
3448
|
+
getModuleStats(moduleName: string): TModuleStats;
|
|
3495
3449
|
getStats(): {
|
|
3496
3450
|
name: string;
|
|
3497
3451
|
version: string;
|
|
@@ -3510,7 +3464,6 @@ declare class Robota extends AbstractAgent<IAgentConfig, IRunOptions, TUniversal
|
|
|
3510
3464
|
private ensureFullyInitialized;
|
|
3511
3465
|
private doAsyncInit;
|
|
3512
3466
|
private emitAgentEvent;
|
|
3513
|
-
private buildOwnerPath;
|
|
3514
3467
|
}
|
|
3515
3468
|
|
|
3516
3469
|
/**
|
|
@@ -3631,6 +3584,7 @@ interface IAgentLifecycleEvents {
|
|
|
3631
3584
|
/** Called when agent is destroyed */
|
|
3632
3585
|
onDestroy?: (agentId: string) => Promise<void> | void;
|
|
3633
3586
|
}
|
|
3587
|
+
|
|
3634
3588
|
/**
|
|
3635
3589
|
* Agent Factory for creating and managing agents
|
|
3636
3590
|
* Instance-based for isolated agent factory management
|
|
@@ -3704,18 +3658,6 @@ declare class AgentFactory {
|
|
|
3704
3658
|
isValid: boolean;
|
|
3705
3659
|
errors: string[];
|
|
3706
3660
|
};
|
|
3707
|
-
/**
|
|
3708
|
-
* Apply default configuration values
|
|
3709
|
-
*/
|
|
3710
|
-
private applyDefaults;
|
|
3711
|
-
/**
|
|
3712
|
-
* Generate unique agent ID
|
|
3713
|
-
*/
|
|
3714
|
-
private generateAgentId;
|
|
3715
|
-
/**
|
|
3716
|
-
* Update creation statistics
|
|
3717
|
-
*/
|
|
3718
|
-
private updateCreationStats;
|
|
3719
3661
|
}
|
|
3720
3662
|
|
|
3721
3663
|
declare class EventHistoryModule implements IEventHistoryModule {
|
|
@@ -4194,11 +4136,13 @@ interface IExecutionProxyConfig {
|
|
|
4194
4136
|
task?: boolean;
|
|
4195
4137
|
};
|
|
4196
4138
|
}
|
|
4139
|
+
/** Internal target shape for proxy interception */
|
|
4140
|
+
type TExecutionProxyTarget = Record<string, TUniversalValue>;
|
|
4141
|
+
/** Internal args shape for proxy interception */
|
|
4142
|
+
type TExecutionProxyArgs = TUniversalValue[];
|
|
4197
4143
|
/**
|
|
4198
4144
|
* Metadata extractor function type
|
|
4199
4145
|
*/
|
|
4200
|
-
type TExecutionProxyTarget = Record<string, TUniversalValue>;
|
|
4201
|
-
type TExecutionProxyArgs = TUniversalValue[];
|
|
4202
4146
|
type TMetadataExtractor = (target: TExecutionProxyTarget, methodName: string, args: TExecutionProxyArgs) => Record<string, TUniversalValue>;
|
|
4203
4147
|
/**
|
|
4204
4148
|
* Method configuration for proxy
|
|
@@ -4210,6 +4154,7 @@ interface IMethodConfig {
|
|
|
4210
4154
|
extractMetadata?: TMetadataExtractor;
|
|
4211
4155
|
extractResult?: (result: TUniversalValue) => Record<string, TUniversalValue>;
|
|
4212
4156
|
}
|
|
4157
|
+
|
|
4213
4158
|
/**
|
|
4214
4159
|
* ExecutionProxy - Automatic event emission using Proxy pattern
|
|
4215
4160
|
*
|
|
@@ -4406,7 +4351,7 @@ declare function formatTokenCount(tokens: number): string;
|
|
|
4406
4351
|
* Hook system types — Claude Code compatible event/hook model.
|
|
4407
4352
|
*/
|
|
4408
4353
|
/** Hook lifecycle events */
|
|
4409
|
-
type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit'
|
|
4354
|
+
type THookEvent = 'PreToolUse' | 'PostToolUse' | 'SessionStart' | 'Stop' | 'PreCompact' | 'PostCompact' | 'UserPromptSubmit';
|
|
4410
4355
|
/** Command hook — executes a shell command */
|
|
4411
4356
|
interface ICommandHookDefinition {
|
|
4412
4357
|
type: 'command';
|
|
@@ -4513,4 +4458,4 @@ interface IRunHooksResult {
|
|
|
4513
4458
|
}
|
|
4514
4459
|
declare function runHooks(config: THooksConfig | undefined, event: THookEvent, input: IHookInput, executors?: IHookTypeExecutor[]): Promise<IRunHooksResult>;
|
|
4515
4460
|
|
|
4516
|
-
export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig, type IProviderMediaError, type IProviderOptions, type IProviderRequest, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderOptionValueBase, TRUST_TO_MODE, type TResponseMetadata, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
|
|
4461
|
+
export { AGENT_EVENTS, AGENT_EVENT_PREFIX, AbstractAIProvider, AbstractAgent, AbstractEventService, AbstractExecutor, AbstractManager, AbstractPlugin, AbstractTool, AgentFactory, AgentTemplates, AuthenticationError, CLAUDE_MODELS, CacheIntegrityError, CircuitBreakerOpenError, ConfigurationError, ConsoleLogger, ConversationHistory, ConversationStore, DEFAULT_ABSTRACT_EVENT_SERVICE, DEFAULT_CONTEXT_WINDOW, DEFAULT_MAX_OUTPUT, DefaultEventService, EVENT_EMITTER_EVENTS, EXECUTION_EVENTS, EXECUTION_EVENT_PREFIX, ErrorUtils, EventEmitterPlugin, EventHistoryModule, ExecutionProxy, type IAIProvider, type IAIProviderInstance, type IAIProviderManager, type IAbstractTool, type IAbstractToolOptions, type IAgent, type IAgentConfig, type IAgentCreationOptions, type IAgentCreationStats, type IAgentEventData, type IAgentFactory, type IAgentFactoryOptions, type IAgentHookDefinition, type IAgentLifecycleEvents, type IAgentTemplate, type IAssistantMessage, type IBaseEventData, type IBaseMessage, type ICacheEntry, type ICacheKey, type ICacheOptions, type ICacheStats, type ICacheStorage, type IChatExecutionRequest, type IChatOptions, type ICommandHookDefinition, type IConfigValidationResult, type IContextOptions, type IContextTokenUsage, type IContextWindowState, type IConversationContext, type IConversationResponse, type IConversationService, type IConversationServiceOptions, type IEventContext, type IEventEmitterEventData, type IEventEmitterHierarchicalEventData, type IEventEmitterMetrics, type IEventEmitterMetricsSnapshot, type IEventEmitterPlugin, type IEventEmitterPluginOptions, type IEventHistoryModule, type IEventHistoryRecord, type IEventHistorySnapshot, type IEventObjectValue, type IEventService, type IEventServiceOwnerBinding, type IExecutionEventData, type IExecutionService, type IExecutionServiceOptions, type IExecutor, type IExecutorAwareProviderConfig, type IFunctionTool, type IHistoryEntry, type IHookDefinition, type IHookGroup, type IHookInput, type IHookResult, type IHookTypeExecutor, type IHttpHookDefinition, type IImageComposeRequest, type IImageEditRequest, type IImageGenerationProvider, type IImageGenerationRequest, type IImageGenerationResult, type IInlineImageInputSource, type IInlineImageMessagePart, type ILocalExecutorConfig, type ILogger, type IMCPToolConfig, type IMediaOutputRef, type IModelDefinition, type IOpenAPIToolConfig, type IOwnerPathSegment, type IParameterSchema, type IParameterValidationResult, type IPermissionLists, type IPlugin, type IPluginConfig, type IPluginContext, type IPluginContract, type IPluginData, type IPluginErrorContext, type IPluginExecutionContext, type IPluginExecutionResult, type IPluginHooks, type IPluginOptions, type IPluginStats, type IProgressReportingTool, type IPromptHookDefinition, type IProviderConfig, type IProviderMediaError, type IProviderOptions, type IProviderRequest, type IProviderSpecificOptions, type IRawProviderResponse, type IRemoteExecutorConfig, type IRunOptions, type ISimpleValidationResult, type IStreamExecutionRequest, type IStreamingChunk, type ISystemMessage, type ITemplateApplicationResult, type ITextMessagePart, type ITokenUsage, type ITool, type IToolCall, type IToolContract, type IToolEventData, type IToolExecutionContext, type IToolExecutionRequest, type IToolExecutionResult, type IToolExecutionService, type IToolExecutionStep, type IToolFactory, type IToolManager, type IToolMessage, type IToolRegistry, type IToolResult, type IToolSchema, type IToolWithEventService, type IUniversalObjectValue, type IUriImageInputSource, type IUriImageMessagePart, type IUserMessage, type IUtilLogEntry, type IValidationIssue, type IValidationOptions, type IValidationResult, type IVideoGenerationProvider, type IVideoGenerationRequest, type IVideoJobAccepted, type IVideoJobSnapshot, type IWorkflowConfig, type IWorkflowConversionOptions, type IWorkflowConversionResult, type IWorkflowConverter, type IWorkflowData, type IWorkflowMetadata, type IWorkflowValidator, InMemoryEventEmitterMetrics, LocalExecutor, MODE_POLICY, MessageConverter, ModelNotAvailableError, NetworkError, ObservableEventService, PluginCategory, PluginError, PluginPriority, ProviderError, RateLimitError, Robota, RobotaError, SilentLogger, StorageError, StructuredEventService, TASK_EVENTS, TASK_EVENT_PREFIX, type TAgentCreationMetadata, type TComplexConfigValue, type TConfigData, type TConfigValue, type TContextData, type TConversationContextMetadata, type TErrorContextData, type TErrorExternalInput, type TEventEmitterListener, type TEventExtensionValue, type TEventListener, type TEventLoggerData, type TEventName, type TEventUniversalValue, type TExecutionEventName, type TExecutionMetadata, type THookEvent, type THooksConfig, type TImageInputSource, type TJSONSchemaEnum, type TJSONSchemaKind, type TKnownToolName, type TLoggerData, type TManagerToolParameters, type TMessageState, type TMetadata, type TMetadataValue, TOOL_EVENTS, TOOL_EVENT_PREFIX, type TParameterDefaultValue, type TPermissionDecision, type TPermissionMode, type TPrimitiveValue, type TProviderConfigValue, type TProviderLoggingData, type TProviderMediaResult, type TProviderOptionValueBase, TRUST_TO_MODE, type TResponseMetadata, type TTextDeltaCallback, type TTimerId, type TToolArgs, type TToolExecutionFunction, type TToolExecutionParameters, type TToolExecutor, type TToolMetadata, type TToolParameters, type TToolProgressCallback, type TTrustLevel, type TUniversalArrayValue, type TUniversalMessage, type TUniversalMessageMetadata, type TUniversalMessagePart, type TUniversalMessageRole, type TUniversalValue, type TUserEvent, type TUtilLogLevel, ToolExecutionError, TypeUtils, UNKNOWN_TOOL_FALLBACK, USER_EVENTS, USER_EVENT_PREFIX, ValidationError, ValidationSeverity, Validator, bindEventServiceOwner, bindWithOwnerPath, chatEntryToMessage, composeEventName, createAssistantMessage, createExecutionProxy, createLogger, createSystemMessage, createToolMessage, createUserMessage, evaluatePermission, formatTokenCount, getGlobalLogLevel, getMessagesForAPI, getModelContextWindow, getModelMaxOutput, getModelName, getToolEstimatedDuration, getToolExecutionSteps, isAssistantMessage, isChatEntry, isDefaultEventService, isImageGenerationProvider, isProgressReportingTool, isSystemMessage, isToolMessage, isUserMessage, isVideoGenerationProvider, logger, messageToHistoryEntry, runHooks, setGlobalLogLevel, setToolProgressCallback, startPeriodicTask, stopPeriodicTask, validateAgentConfig, validateApiKey, validateModelName, validateProviderName, validateUserInput, withEventEmission };
|