@robota-sdk/agent-core 3.0.0-beta.64 → 3.0.0-beta.66
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 +4 -0
- package/dist/browser/index.d.ts +738 -525
- package/dist/browser/index.d.ts.map +1 -1
- package/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +5 -5
- package/dist/node/index.d.ts +738 -525
- package/dist/node/index.d.ts.map +1 -1
- package/dist/node/index.js +5 -5
- package/dist/node/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -210,6 +210,71 @@ declare const TypeUtils: {
|
|
|
210
210
|
isUniversalValue: (value: TUniversalValue) => value is TUniversalValue;
|
|
211
211
|
};
|
|
212
212
|
//#endregion
|
|
213
|
+
//#region src/interfaces/cache.d.ts
|
|
214
|
+
/**
|
|
215
|
+
* Cache key identifying a unique LLM execution request
|
|
216
|
+
*/
|
|
217
|
+
interface ICacheKey {
|
|
218
|
+
/** SHA-256 hash of the serialized request */
|
|
219
|
+
hash: string;
|
|
220
|
+
/** Model identifier */
|
|
221
|
+
model: string;
|
|
222
|
+
/** Provider name */
|
|
223
|
+
provider: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Cached LLM response entry
|
|
227
|
+
*/
|
|
228
|
+
interface ICacheEntry {
|
|
229
|
+
/** Cache key that produced this entry */
|
|
230
|
+
key: ICacheKey;
|
|
231
|
+
/** Cached response content */
|
|
232
|
+
response: string;
|
|
233
|
+
/** When the entry was cached */
|
|
234
|
+
timestamp: number;
|
|
235
|
+
/** SHA-256 integrity hash of the response */
|
|
236
|
+
integrityHash: string;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Cache storage interface for pluggable backends
|
|
240
|
+
*/
|
|
241
|
+
interface ICacheStorage {
|
|
242
|
+
/** Retrieve a cached entry by key hash */
|
|
243
|
+
get(hash: string): ICacheEntry | undefined;
|
|
244
|
+
/** Store a cache entry */
|
|
245
|
+
set(entry: ICacheEntry): void;
|
|
246
|
+
/** Delete a cached entry by key hash */
|
|
247
|
+
delete(hash: string): boolean;
|
|
248
|
+
/** Clear all cached entries */
|
|
249
|
+
clear(): void;
|
|
250
|
+
/** Get cache statistics */
|
|
251
|
+
getStats(): ICacheStats;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Cache performance statistics
|
|
255
|
+
*/
|
|
256
|
+
interface ICacheStats {
|
|
257
|
+
/** Number of cache hits */
|
|
258
|
+
hits: number;
|
|
259
|
+
/** Number of cache misses */
|
|
260
|
+
misses: number;
|
|
261
|
+
/** Current number of cached entries */
|
|
262
|
+
entries: number;
|
|
263
|
+
/** Hit rate (hits / (hits + misses)), 0 if no lookups */
|
|
264
|
+
hitRate: number;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Configuration options for execution caching
|
|
268
|
+
*/
|
|
269
|
+
interface ICacheOptions {
|
|
270
|
+
/** Whether caching is enabled */
|
|
271
|
+
enabled: boolean;
|
|
272
|
+
/** Maximum number of cached entries */
|
|
273
|
+
maxEntries: number;
|
|
274
|
+
/** Time-to-live in milliseconds */
|
|
275
|
+
ttlMs: number;
|
|
276
|
+
}
|
|
277
|
+
//#endregion
|
|
213
278
|
//#region src/interfaces/provider-capabilities.d.ts
|
|
214
279
|
interface IProviderFunctionCallingCapability {
|
|
215
280
|
supported: boolean;
|
|
@@ -492,99 +557,370 @@ type TProviderOptionValueBase = string | number | boolean | undefined | null | T
|
|
|
492
557
|
[key: string]: TProviderOptionValueBase;
|
|
493
558
|
};
|
|
494
559
|
//#endregion
|
|
495
|
-
//#region src/event-
|
|
560
|
+
//#region src/plugins/event-emitter/types.d.ts
|
|
561
|
+
declare const EXECUTION_EVENT_NAMES: {
|
|
562
|
+
readonly START: "execution.start";
|
|
563
|
+
readonly COMPLETE: "execution.complete";
|
|
564
|
+
readonly ERROR: "execution.error";
|
|
565
|
+
};
|
|
566
|
+
declare const TOOL_EVENT_NAMES: {
|
|
567
|
+
readonly CALL_START: "tool.call_start";
|
|
568
|
+
readonly CALL_COMPLETE: "tool.call_complete";
|
|
569
|
+
readonly CALL_ERROR: "tool.call_error";
|
|
570
|
+
};
|
|
571
|
+
declare const AGENT_EVENT_NAMES: {
|
|
572
|
+
readonly EXECUTION_START: "agent.execution_start";
|
|
573
|
+
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
574
|
+
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
575
|
+
readonly CREATED: "agent.created";
|
|
576
|
+
};
|
|
577
|
+
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
578
|
+
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
579
|
+
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
496
580
|
/**
|
|
497
|
-
*
|
|
581
|
+
* Event types that can be emitted.
|
|
498
582
|
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
583
|
+
* IMPORTANT:
|
|
584
|
+
* - Do not use string literals for event names outside this module.
|
|
585
|
+
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
501
586
|
*/
|
|
587
|
+
declare const EVENT_EMITTER_EVENTS: {
|
|
588
|
+
readonly EXECUTION_START: "execution.start";
|
|
589
|
+
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
590
|
+
readonly EXECUTION_ERROR: "execution.error";
|
|
591
|
+
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
592
|
+
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
593
|
+
readonly TOOL_SUCCESS: "tool.success";
|
|
594
|
+
readonly TOOL_ERROR: "tool.call_error";
|
|
595
|
+
readonly CONVERSATION_START: "conversation.start";
|
|
596
|
+
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
597
|
+
readonly CONVERSATION_ERROR: "conversation.error";
|
|
598
|
+
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
599
|
+
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
600
|
+
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
601
|
+
readonly AGENT_CREATED: "agent.created";
|
|
602
|
+
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
603
|
+
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
604
|
+
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
605
|
+
readonly PLUGIN_ERROR: "plugin.error";
|
|
606
|
+
readonly ERROR_OCCURRED: "error.occurred";
|
|
607
|
+
readonly WARNING_OCCURRED: "warning.occurred";
|
|
608
|
+
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
609
|
+
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
610
|
+
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
611
|
+
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
612
|
+
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
613
|
+
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
614
|
+
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
615
|
+
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
616
|
+
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
617
|
+
readonly MODULE_REGISTERED: "module.registered";
|
|
618
|
+
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
619
|
+
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
620
|
+
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
621
|
+
readonly TOOL_REALTIME: "tool.realtime";
|
|
622
|
+
readonly CUSTOM: "custom";
|
|
623
|
+
};
|
|
624
|
+
type TEventName = TExecutionEventName | TToolEventName | TAgentEventName | 'tool.beforeExecute' | 'tool.afterExecute' | 'tool.success' | 'conversation.start' | 'conversation.complete' | 'conversation.error' | 'agent.destroyed' | 'plugin.loaded' | 'plugin.unloaded' | 'plugin.error' | 'error.occurred' | 'warning.occurred' | 'module.initialize.start' | 'module.initialize.complete' | 'module.initialize.error' | 'module.execution.start' | 'module.execution.complete' | 'module.execution.error' | 'module.dispose.start' | 'module.dispose.complete' | 'module.dispose.error' | 'module.registered' | 'module.unregistered' | 'execution.hierarchy' | 'execution.realtime' | 'tool.realtime' | 'custom';
|
|
502
625
|
/**
|
|
503
|
-
*
|
|
626
|
+
* Valid event data value types
|
|
504
627
|
*/
|
|
505
|
-
type
|
|
628
|
+
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
629
|
+
[key: string]: TEventDataValue;
|
|
630
|
+
};
|
|
506
631
|
/**
|
|
507
|
-
*
|
|
632
|
+
* Event data structure
|
|
508
633
|
*/
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
634
|
+
interface IEventEmitterEventData {
|
|
635
|
+
type: TEventName;
|
|
636
|
+
timestamp: Date;
|
|
637
|
+
executionId?: string;
|
|
638
|
+
sessionId?: string;
|
|
639
|
+
userId?: string;
|
|
640
|
+
data?: Record<string, TEventDataValue>;
|
|
641
|
+
error?: Error;
|
|
642
|
+
metadata?: Record<string, TEventDataValue>;
|
|
512
643
|
}
|
|
513
644
|
/**
|
|
514
|
-
*
|
|
645
|
+
* Event listener function
|
|
515
646
|
*/
|
|
516
|
-
type
|
|
647
|
+
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
517
648
|
/**
|
|
518
|
-
*
|
|
649
|
+
* Console-like interface for the EventEmitterPlugin.
|
|
519
650
|
*
|
|
520
|
-
*
|
|
521
|
-
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
651
|
+
* Use this interface for typing instead of the concrete EventEmitterPlugin class.
|
|
522
652
|
*/
|
|
523
|
-
interface
|
|
524
|
-
|
|
525
|
-
|
|
653
|
+
interface IEventEmitterPlugin {
|
|
654
|
+
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
655
|
+
once?: boolean;
|
|
656
|
+
filter?: (event: IEventEmitterEventData) => boolean;
|
|
657
|
+
}): string;
|
|
658
|
+
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
659
|
+
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
660
|
+
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
526
661
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
/** Unique span identifier for distributed tracing correlation */
|
|
538
|
-
spanId?: string;
|
|
539
|
-
/** Optional structured metadata for debugging/observability */
|
|
540
|
-
metadata?: TEventLoggerData;
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/abstracts/abstract-module-types.d.ts
|
|
664
|
+
/** Module execution context */
|
|
665
|
+
interface IModuleExecutionContext {
|
|
666
|
+
executionId?: string;
|
|
667
|
+
sessionId?: string;
|
|
668
|
+
userId?: string;
|
|
669
|
+
agentName?: string;
|
|
670
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
671
|
+
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
541
672
|
}
|
|
542
|
-
/**
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
*/
|
|
550
|
-
interface IBaseEventData {
|
|
551
|
-
/** Timestamp when the event was emitted. This is required for deterministic ordering. */
|
|
552
|
-
timestamp: Date;
|
|
553
|
-
/** Optional structured metadata */
|
|
554
|
-
metadata?: TEventLoggerData;
|
|
555
|
-
/** Extensible fields for event-specific payloads */
|
|
556
|
-
[key: string]: TEventExtensionValue | undefined;
|
|
673
|
+
/** Module execution result */
|
|
674
|
+
interface IModuleExecutionResult {
|
|
675
|
+
success: boolean;
|
|
676
|
+
data?: IModuleResultData;
|
|
677
|
+
error?: Error;
|
|
678
|
+
duration?: number;
|
|
679
|
+
metadata?: Record<string, string | number | boolean | Date>;
|
|
557
680
|
}
|
|
558
|
-
/**
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
interface IExecutionEventData extends IBaseEventData {}
|
|
562
|
-
/**
|
|
563
|
-
* Tool-related event payload.
|
|
564
|
-
*/
|
|
565
|
-
interface IToolEventData extends IBaseEventData {
|
|
566
|
-
toolName?: string;
|
|
567
|
-
parameters?: Record<string, TEventUniversalValue>;
|
|
681
|
+
/** Module result data */
|
|
682
|
+
interface IModuleResultData {
|
|
683
|
+
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
568
684
|
}
|
|
569
|
-
/**
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
agentId?: string;
|
|
685
|
+
/** Base module options */
|
|
686
|
+
interface IBaseModuleOptions {
|
|
687
|
+
enabled?: boolean;
|
|
688
|
+
config?: Record<string, string | number | boolean>;
|
|
574
689
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
581
|
-
subscribe(listener: TEventListener): void;
|
|
582
|
-
unsubscribe(listener: TEventListener): void;
|
|
690
|
+
/** Module capabilities */
|
|
691
|
+
interface IModuleCapabilities {
|
|
692
|
+
capabilities: string[];
|
|
693
|
+
dependencies?: string[];
|
|
694
|
+
optionalDependencies?: string[];
|
|
583
695
|
}
|
|
584
|
-
/**
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
696
|
+
/** Module type descriptor */
|
|
697
|
+
interface IModuleDescriptor {
|
|
698
|
+
type: string;
|
|
699
|
+
category: ModuleCategory;
|
|
700
|
+
layer: ModuleLayer;
|
|
701
|
+
dependencies?: string[];
|
|
702
|
+
capabilities?: string[];
|
|
703
|
+
}
|
|
704
|
+
/** Module categories */
|
|
705
|
+
declare enum ModuleCategory {
|
|
706
|
+
CORE = "core",
|
|
707
|
+
STORAGE = "storage",
|
|
708
|
+
PROCESSING = "processing",
|
|
709
|
+
INTEGRATION = "integration",
|
|
710
|
+
INTERFACE = "interface",
|
|
711
|
+
CAPABILITY = "capability"
|
|
712
|
+
}
|
|
713
|
+
/** Module layers */
|
|
714
|
+
declare enum ModuleLayer {
|
|
715
|
+
INFRASTRUCTURE = "infrastructure",
|
|
716
|
+
CORE = "core",
|
|
717
|
+
APPLICATION = "application",
|
|
718
|
+
DOMAIN = "domain",
|
|
719
|
+
PRESENTATION = "presentation"
|
|
720
|
+
}
|
|
721
|
+
/** Module data for introspection */
|
|
722
|
+
interface IModuleData {
|
|
723
|
+
name: string;
|
|
724
|
+
version: string;
|
|
725
|
+
type: string;
|
|
726
|
+
enabled: boolean;
|
|
727
|
+
initialized: boolean;
|
|
728
|
+
capabilities: IModuleCapabilities;
|
|
729
|
+
metadata?: Record<string, string | number | boolean>;
|
|
730
|
+
}
|
|
731
|
+
/** Module statistics */
|
|
732
|
+
interface IModuleStats {
|
|
733
|
+
enabled: boolean;
|
|
734
|
+
initialized: boolean;
|
|
735
|
+
executionCount: number;
|
|
736
|
+
errorCount: number;
|
|
737
|
+
lastActivity?: Date;
|
|
738
|
+
averageExecutionTime?: number;
|
|
739
|
+
[key: string]: string | number | boolean | Date | undefined;
|
|
740
|
+
}
|
|
741
|
+
/** Type-safe module interface */
|
|
742
|
+
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
743
|
+
name: string;
|
|
744
|
+
version: string;
|
|
745
|
+
enabled: boolean;
|
|
746
|
+
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
747
|
+
dispose?(): Promise<void>;
|
|
748
|
+
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
749
|
+
getModuleType(): IModuleDescriptor;
|
|
750
|
+
getCapabilities(): IModuleCapabilities;
|
|
751
|
+
getData?(): IModuleData;
|
|
752
|
+
getStats?(): TStats;
|
|
753
|
+
isEnabled(): boolean;
|
|
754
|
+
isInitialized(): boolean;
|
|
755
|
+
}
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region src/utils/logger.d.ts
|
|
758
|
+
/**
|
|
759
|
+
* Reusable type definitions for logger utility
|
|
760
|
+
*/
|
|
761
|
+
/**
|
|
762
|
+
* Log levels for the logger
|
|
763
|
+
*/
|
|
764
|
+
type TUtilLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
765
|
+
/**
|
|
766
|
+
* Log entry structure
|
|
767
|
+
*/
|
|
768
|
+
interface IUtilLogEntry {
|
|
769
|
+
timestamp: string;
|
|
770
|
+
level: TUtilLogLevel;
|
|
771
|
+
message: string;
|
|
772
|
+
context?: TLoggerData;
|
|
773
|
+
packageName?: string;
|
|
774
|
+
}
|
|
775
|
+
/**
|
|
776
|
+
* Logger interface
|
|
777
|
+
*/
|
|
778
|
+
interface ILogger {
|
|
779
|
+
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
780
|
+
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
781
|
+
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
782
|
+
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
783
|
+
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
784
|
+
group?(label?: string): void;
|
|
785
|
+
groupEnd?(): void;
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Silent logger that does nothing (Null Object Pattern)
|
|
789
|
+
*
|
|
790
|
+
* IMPORTANT:
|
|
791
|
+
* - This library must not write to stdio by default.
|
|
792
|
+
* - Inject a real logger explicitly if you want output.
|
|
793
|
+
*/
|
|
794
|
+
declare const SilentLogger: ILogger;
|
|
795
|
+
/**
|
|
796
|
+
* Console logger implementation
|
|
797
|
+
* @internal
|
|
798
|
+
*/
|
|
799
|
+
declare class ConsoleLogger implements ILogger {
|
|
800
|
+
private level?;
|
|
801
|
+
private packageName;
|
|
802
|
+
private sinkLogger;
|
|
803
|
+
constructor(packageName: string, logger?: ILogger);
|
|
804
|
+
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
805
|
+
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
806
|
+
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
807
|
+
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
808
|
+
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
809
|
+
private getLevel;
|
|
810
|
+
private shouldLog;
|
|
811
|
+
private forward;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* Create a named logger instance for a package or module.
|
|
815
|
+
* Use this to create loggers with a specific name prefix for easy log filtering.
|
|
816
|
+
*/
|
|
817
|
+
declare function createLogger(packageName: string, logger?: ILogger): ILogger;
|
|
818
|
+
/**
|
|
819
|
+
* Set global log level for all loggers
|
|
820
|
+
*/
|
|
821
|
+
declare function setGlobalLogLevel(level: TUtilLogLevel): void;
|
|
822
|
+
/**
|
|
823
|
+
* Get global log level
|
|
824
|
+
*/
|
|
825
|
+
declare function getGlobalLogLevel(): TUtilLogLevel;
|
|
826
|
+
/**
|
|
827
|
+
* Default logger for the agents package
|
|
828
|
+
*/
|
|
829
|
+
declare const logger: ILogger;
|
|
830
|
+
//#endregion
|
|
831
|
+
//#region src/event-service/interfaces.d.ts
|
|
832
|
+
/**
|
|
833
|
+
* @fileoverview Event service interface definitions.
|
|
834
|
+
*
|
|
835
|
+
* These interfaces are the single source of truth for event-related contracts
|
|
836
|
+
* within @robota-sdk/agent-core.
|
|
837
|
+
*/
|
|
838
|
+
/**
|
|
839
|
+
* Primitive value types for event payloads.
|
|
840
|
+
*/
|
|
841
|
+
type TEventPrimitiveValue = string | number | boolean | null | undefined;
|
|
842
|
+
/**
|
|
843
|
+
* Recursive universal value type for event payloads (JSON-like + Date).
|
|
844
|
+
*/
|
|
845
|
+
type TEventUniversalValue = TEventPrimitiveValue | Date | TEventUniversalValue[] | IEventObjectValue;
|
|
846
|
+
interface IEventObjectValue {
|
|
847
|
+
[key: string]: TEventUniversalValue;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Logger data type for event metadata.
|
|
851
|
+
*/
|
|
852
|
+
type TEventLoggerData = Record<string, TEventUniversalValue | Date | Error>;
|
|
853
|
+
/**
|
|
854
|
+
* A single segment in an explicit ownerPath.
|
|
855
|
+
*
|
|
856
|
+
* Path-only rule:
|
|
857
|
+
* - Relationships must be derived from these explicit segments, not from parsing IDs.
|
|
858
|
+
*/
|
|
859
|
+
interface IOwnerPathSegment {
|
|
860
|
+
type: string;
|
|
861
|
+
id: string;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Event context that accompanies an emitted event.
|
|
865
|
+
* This is the single source of truth for deterministic linking in subscribers.
|
|
866
|
+
*/
|
|
867
|
+
interface IEventContext {
|
|
868
|
+
ownerType: string;
|
|
869
|
+
ownerId: string;
|
|
870
|
+
ownerPath: IOwnerPathSegment[];
|
|
871
|
+
/** Depth of the current execution in the hierarchy (0 = root) */
|
|
872
|
+
depth?: number;
|
|
873
|
+
/** Unique span identifier for distributed tracing correlation */
|
|
874
|
+
spanId?: string;
|
|
875
|
+
/** Optional structured metadata for debugging/observability */
|
|
876
|
+
metadata?: TEventLoggerData;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Allowed extension values for event payloads.
|
|
880
|
+
*/
|
|
881
|
+
type TEventExtensionValue = TEventUniversalValue | TEventLoggerData | Error | IEventContext | IOwnerPathSegment[];
|
|
882
|
+
/**
|
|
883
|
+
* Base event payload shape.
|
|
884
|
+
* Emitters may add additional fields, but MUST keep linkage information explicit.
|
|
885
|
+
*/
|
|
886
|
+
interface IBaseEventData {
|
|
887
|
+
/** Timestamp when the event was emitted. This is required for deterministic ordering. */
|
|
888
|
+
timestamp: Date;
|
|
889
|
+
/** Optional structured metadata */
|
|
890
|
+
metadata?: TEventLoggerData;
|
|
891
|
+
/** Extensible fields for event-specific payloads */
|
|
892
|
+
[key: string]: TEventExtensionValue | undefined;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Execution-related event payload.
|
|
896
|
+
*/
|
|
897
|
+
interface IExecutionEventData extends IBaseEventData {}
|
|
898
|
+
/**
|
|
899
|
+
* Tool-related event payload.
|
|
900
|
+
*/
|
|
901
|
+
interface IToolEventData extends IBaseEventData {
|
|
902
|
+
toolName?: string;
|
|
903
|
+
parameters?: Record<string, TEventUniversalValue>;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Agent-related event payload.
|
|
907
|
+
*/
|
|
908
|
+
interface IAgentEventData extends IBaseEventData {
|
|
909
|
+
agentId?: string;
|
|
910
|
+
}
|
|
911
|
+
type TEventListener = (eventType: string, data: IBaseEventData, context?: IEventContext) => void;
|
|
912
|
+
/**
|
|
913
|
+
* Minimal EventService contract for emitting events.
|
|
914
|
+
*/
|
|
915
|
+
interface IEventService {
|
|
916
|
+
emit(eventType: string, data: IBaseEventData, context?: IEventContext): void;
|
|
917
|
+
subscribe(listener: TEventListener): void;
|
|
918
|
+
unsubscribe(listener: TEventListener): void;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Explicit owner binding information used for scoped event emission.
|
|
922
|
+
*/
|
|
923
|
+
interface IEventServiceOwnerBinding {
|
|
588
924
|
ownerType: string;
|
|
589
925
|
ownerId: string;
|
|
590
926
|
ownerPath: IOwnerPathSegment[];
|
|
@@ -839,183 +1175,6 @@ interface IToolRegistry {
|
|
|
839
1175
|
clear(): void;
|
|
840
1176
|
}
|
|
841
1177
|
//#endregion
|
|
842
|
-
//#region src/plugins/event-emitter/types.d.ts
|
|
843
|
-
declare const EXECUTION_EVENT_NAMES: {
|
|
844
|
-
readonly START: "execution.start";
|
|
845
|
-
readonly COMPLETE: "execution.complete";
|
|
846
|
-
readonly ERROR: "execution.error";
|
|
847
|
-
};
|
|
848
|
-
declare const TOOL_EVENT_NAMES: {
|
|
849
|
-
readonly CALL_START: "tool.call_start";
|
|
850
|
-
readonly CALL_COMPLETE: "tool.call_complete";
|
|
851
|
-
readonly CALL_ERROR: "tool.call_error";
|
|
852
|
-
};
|
|
853
|
-
declare const AGENT_EVENT_NAMES: {
|
|
854
|
-
readonly EXECUTION_START: "agent.execution_start";
|
|
855
|
-
readonly EXECUTION_COMPLETE: "agent.execution_complete";
|
|
856
|
-
readonly EXECUTION_ERROR: "agent.execution_error";
|
|
857
|
-
readonly CREATED: "agent.created";
|
|
858
|
-
};
|
|
859
|
-
type TExecutionEventName = (typeof EXECUTION_EVENT_NAMES)[keyof typeof EXECUTION_EVENT_NAMES];
|
|
860
|
-
type TToolEventName = (typeof TOOL_EVENT_NAMES)[keyof typeof TOOL_EVENT_NAMES];
|
|
861
|
-
type TAgentEventName = (typeof AGENT_EVENT_NAMES)[keyof typeof AGENT_EVENT_NAMES];
|
|
862
|
-
/**
|
|
863
|
-
* Event types that can be emitted.
|
|
864
|
-
*
|
|
865
|
-
* IMPORTANT:
|
|
866
|
-
* - Do not use string literals for event names outside this module.
|
|
867
|
-
* - Import and use EVENT_EMITTER_EVENTS instead.
|
|
868
|
-
*/
|
|
869
|
-
declare const EVENT_EMITTER_EVENTS: {
|
|
870
|
-
readonly EXECUTION_START: "execution.start";
|
|
871
|
-
readonly EXECUTION_COMPLETE: "execution.complete";
|
|
872
|
-
readonly EXECUTION_ERROR: "execution.error";
|
|
873
|
-
readonly TOOL_BEFORE_EXECUTE: "tool.beforeExecute";
|
|
874
|
-
readonly TOOL_AFTER_EXECUTE: "tool.afterExecute";
|
|
875
|
-
readonly TOOL_SUCCESS: "tool.success";
|
|
876
|
-
readonly TOOL_ERROR: "tool.call_error";
|
|
877
|
-
readonly CONVERSATION_START: "conversation.start";
|
|
878
|
-
readonly CONVERSATION_COMPLETE: "conversation.complete";
|
|
879
|
-
readonly CONVERSATION_ERROR: "conversation.error";
|
|
880
|
-
readonly AGENT_EXECUTION_START: "agent.execution_start";
|
|
881
|
-
readonly AGENT_EXECUTION_COMPLETE: "agent.execution_complete";
|
|
882
|
-
readonly AGENT_EXECUTION_ERROR: "agent.execution_error";
|
|
883
|
-
readonly AGENT_CREATED: "agent.created";
|
|
884
|
-
readonly AGENT_DESTROYED: "agent.destroyed";
|
|
885
|
-
readonly PLUGIN_LOADED: "plugin.loaded";
|
|
886
|
-
readonly PLUGIN_UNLOADED: "plugin.unloaded";
|
|
887
|
-
readonly PLUGIN_ERROR: "plugin.error";
|
|
888
|
-
readonly ERROR_OCCURRED: "error.occurred";
|
|
889
|
-
readonly WARNING_OCCURRED: "warning.occurred";
|
|
890
|
-
readonly MODULE_INITIALIZE_START: "module.initialize.start";
|
|
891
|
-
readonly MODULE_INITIALIZE_COMPLETE: "module.initialize.complete";
|
|
892
|
-
readonly MODULE_INITIALIZE_ERROR: "module.initialize.error";
|
|
893
|
-
readonly MODULE_EXECUTION_START: "module.execution.start";
|
|
894
|
-
readonly MODULE_EXECUTION_COMPLETE: "module.execution.complete";
|
|
895
|
-
readonly MODULE_EXECUTION_ERROR: "module.execution.error";
|
|
896
|
-
readonly MODULE_DISPOSE_START: "module.dispose.start";
|
|
897
|
-
readonly MODULE_DISPOSE_COMPLETE: "module.dispose.complete";
|
|
898
|
-
readonly MODULE_DISPOSE_ERROR: "module.dispose.error";
|
|
899
|
-
readonly MODULE_REGISTERED: "module.registered";
|
|
900
|
-
readonly MODULE_UNREGISTERED: "module.unregistered";
|
|
901
|
-
readonly EXECUTION_HIERARCHY: "execution.hierarchy";
|
|
902
|
-
readonly EXECUTION_REALTIME: "execution.realtime";
|
|
903
|
-
readonly TOOL_REALTIME: "tool.realtime";
|
|
904
|
-
readonly CUSTOM: "custom";
|
|
905
|
-
};
|
|
906
|
-
type TEventName = TExecutionEventName | TToolEventName | TAgentEventName | 'tool.beforeExecute' | 'tool.afterExecute' | 'tool.success' | 'conversation.start' | 'conversation.complete' | 'conversation.error' | 'agent.destroyed' | 'plugin.loaded' | 'plugin.unloaded' | 'plugin.error' | 'error.occurred' | 'warning.occurred' | 'module.initialize.start' | 'module.initialize.complete' | 'module.initialize.error' | 'module.execution.start' | 'module.execution.complete' | 'module.execution.error' | 'module.dispose.start' | 'module.dispose.complete' | 'module.dispose.error' | 'module.registered' | 'module.unregistered' | 'execution.hierarchy' | 'execution.realtime' | 'tool.realtime' | 'custom';
|
|
907
|
-
/**
|
|
908
|
-
* Valid event data value types
|
|
909
|
-
*/
|
|
910
|
-
type TEventDataValue = string | number | boolean | Date | null | undefined | TEventDataValue[] | {
|
|
911
|
-
[key: string]: TEventDataValue;
|
|
912
|
-
};
|
|
913
|
-
/**
|
|
914
|
-
* Event data structure
|
|
915
|
-
*/
|
|
916
|
-
interface IEventEmitterEventData {
|
|
917
|
-
type: TEventName;
|
|
918
|
-
timestamp: Date;
|
|
919
|
-
executionId?: string;
|
|
920
|
-
sessionId?: string;
|
|
921
|
-
userId?: string;
|
|
922
|
-
data?: Record<string, TEventDataValue>;
|
|
923
|
-
error?: Error;
|
|
924
|
-
metadata?: Record<string, TEventDataValue>;
|
|
925
|
-
}
|
|
926
|
-
/**
|
|
927
|
-
* Event listener function
|
|
928
|
-
*/
|
|
929
|
-
type TEventEmitterListener = (event: IEventEmitterEventData) => void | Promise<void>;
|
|
930
|
-
/**
|
|
931
|
-
* Console-like interface for the EventEmitterPlugin.
|
|
932
|
-
*
|
|
933
|
-
* Use this interface for typing instead of the concrete EventEmitterPlugin class.
|
|
934
|
-
*/
|
|
935
|
-
interface IEventEmitterPlugin {
|
|
936
|
-
on(eventType: TEventName, listener: TEventEmitterListener, options?: {
|
|
937
|
-
once?: boolean;
|
|
938
|
-
filter?: (event: IEventEmitterEventData) => boolean;
|
|
939
|
-
}): string;
|
|
940
|
-
once(eventType: TEventName, listener: TEventEmitterListener, filter?: (event: IEventEmitterEventData) => boolean): string;
|
|
941
|
-
off(eventType: TEventName, handlerIdOrListener: string | TEventEmitterListener): boolean;
|
|
942
|
-
emit(eventType: TEventName, eventData?: Partial<IEventEmitterEventData>): Promise<void>;
|
|
943
|
-
}
|
|
944
|
-
//#endregion
|
|
945
|
-
//#region src/utils/logger.d.ts
|
|
946
|
-
/**
|
|
947
|
-
* Reusable type definitions for logger utility
|
|
948
|
-
*/
|
|
949
|
-
/**
|
|
950
|
-
* Log levels for the logger
|
|
951
|
-
*/
|
|
952
|
-
type TUtilLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
953
|
-
/**
|
|
954
|
-
* Log entry structure
|
|
955
|
-
*/
|
|
956
|
-
interface IUtilLogEntry {
|
|
957
|
-
timestamp: string;
|
|
958
|
-
level: TUtilLogLevel;
|
|
959
|
-
message: string;
|
|
960
|
-
context?: TLoggerData;
|
|
961
|
-
packageName?: string;
|
|
962
|
-
}
|
|
963
|
-
/**
|
|
964
|
-
* Logger interface
|
|
965
|
-
*/
|
|
966
|
-
interface ILogger {
|
|
967
|
-
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
968
|
-
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
969
|
-
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
970
|
-
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
971
|
-
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
972
|
-
group?(label?: string): void;
|
|
973
|
-
groupEnd?(): void;
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Silent logger that does nothing (Null Object Pattern)
|
|
977
|
-
*
|
|
978
|
-
* IMPORTANT:
|
|
979
|
-
* - This library must not write to stdio by default.
|
|
980
|
-
* - Inject a real logger explicitly if you want output.
|
|
981
|
-
*/
|
|
982
|
-
declare const SilentLogger: ILogger;
|
|
983
|
-
/**
|
|
984
|
-
* Console logger implementation
|
|
985
|
-
* @internal
|
|
986
|
-
*/
|
|
987
|
-
declare class ConsoleLogger implements ILogger {
|
|
988
|
-
private level?;
|
|
989
|
-
private packageName;
|
|
990
|
-
private sinkLogger;
|
|
991
|
-
constructor(packageName: string, logger?: ILogger);
|
|
992
|
-
debug(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
993
|
-
info(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
994
|
-
warn(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
995
|
-
error(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
996
|
-
log(...args: Array<TUniversalValue | TLoggerData | Error>): void;
|
|
997
|
-
private getLevel;
|
|
998
|
-
private shouldLog;
|
|
999
|
-
private forward;
|
|
1000
|
-
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Create a named logger instance for a package or module.
|
|
1003
|
-
* Use this to create loggers with a specific name prefix for easy log filtering.
|
|
1004
|
-
*/
|
|
1005
|
-
declare function createLogger(packageName: string, logger?: ILogger): ILogger;
|
|
1006
|
-
/**
|
|
1007
|
-
* Set global log level for all loggers
|
|
1008
|
-
*/
|
|
1009
|
-
declare function setGlobalLogLevel(level: TUtilLogLevel): void;
|
|
1010
|
-
/**
|
|
1011
|
-
* Get global log level
|
|
1012
|
-
*/
|
|
1013
|
-
declare function getGlobalLogLevel(): TUtilLogLevel;
|
|
1014
|
-
/**
|
|
1015
|
-
* Default logger for the agents package
|
|
1016
|
-
*/
|
|
1017
|
-
declare const logger: ILogger;
|
|
1018
|
-
//#endregion
|
|
1019
1178
|
//#region src/abstracts/abstract-plugin-types.d.ts
|
|
1020
1179
|
/** Plugin categories for classification */
|
|
1021
1180
|
declare enum PluginCategory {
|
|
@@ -1225,100 +1384,6 @@ declare abstract class AbstractPlugin<TOptions extends IPluginOptions = IPluginO
|
|
|
1225
1384
|
onModuleEvent?(eventName: TEventName, eventData: IEventEmitterEventData): Promise<void>;
|
|
1226
1385
|
}
|
|
1227
1386
|
//#endregion
|
|
1228
|
-
//#region src/abstracts/abstract-module-types.d.ts
|
|
1229
|
-
/** Module execution context */
|
|
1230
|
-
interface IModuleExecutionContext {
|
|
1231
|
-
executionId?: string;
|
|
1232
|
-
sessionId?: string;
|
|
1233
|
-
userId?: string;
|
|
1234
|
-
agentName?: string;
|
|
1235
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1236
|
-
[key: string]: string | number | boolean | Date | Record<string, string | number | boolean | Date> | undefined;
|
|
1237
|
-
}
|
|
1238
|
-
/** Module execution result */
|
|
1239
|
-
interface IModuleExecutionResult {
|
|
1240
|
-
success: boolean;
|
|
1241
|
-
data?: IModuleResultData;
|
|
1242
|
-
error?: Error;
|
|
1243
|
-
duration?: number;
|
|
1244
|
-
metadata?: Record<string, string | number | boolean | Date>;
|
|
1245
|
-
}
|
|
1246
|
-
/** Module result data */
|
|
1247
|
-
interface IModuleResultData {
|
|
1248
|
-
[key: string]: string | number | boolean | Record<string, string | number | boolean> | undefined;
|
|
1249
|
-
}
|
|
1250
|
-
/** Base module options */
|
|
1251
|
-
interface IBaseModuleOptions {
|
|
1252
|
-
enabled?: boolean;
|
|
1253
|
-
config?: Record<string, string | number | boolean>;
|
|
1254
|
-
}
|
|
1255
|
-
/** Module capabilities */
|
|
1256
|
-
interface IModuleCapabilities {
|
|
1257
|
-
capabilities: string[];
|
|
1258
|
-
dependencies?: string[];
|
|
1259
|
-
optionalDependencies?: string[];
|
|
1260
|
-
}
|
|
1261
|
-
/** Module type descriptor */
|
|
1262
|
-
interface IModuleDescriptor {
|
|
1263
|
-
type: string;
|
|
1264
|
-
category: ModuleCategory;
|
|
1265
|
-
layer: ModuleLayer;
|
|
1266
|
-
dependencies?: string[];
|
|
1267
|
-
capabilities?: string[];
|
|
1268
|
-
}
|
|
1269
|
-
/** Module categories */
|
|
1270
|
-
declare enum ModuleCategory {
|
|
1271
|
-
CORE = "core",
|
|
1272
|
-
STORAGE = "storage",
|
|
1273
|
-
PROCESSING = "processing",
|
|
1274
|
-
INTEGRATION = "integration",
|
|
1275
|
-
INTERFACE = "interface",
|
|
1276
|
-
CAPABILITY = "capability"
|
|
1277
|
-
}
|
|
1278
|
-
/** Module layers */
|
|
1279
|
-
declare enum ModuleLayer {
|
|
1280
|
-
INFRASTRUCTURE = "infrastructure",
|
|
1281
|
-
CORE = "core",
|
|
1282
|
-
APPLICATION = "application",
|
|
1283
|
-
DOMAIN = "domain",
|
|
1284
|
-
PRESENTATION = "presentation"
|
|
1285
|
-
}
|
|
1286
|
-
/** Module data for introspection */
|
|
1287
|
-
interface IModuleData {
|
|
1288
|
-
name: string;
|
|
1289
|
-
version: string;
|
|
1290
|
-
type: string;
|
|
1291
|
-
enabled: boolean;
|
|
1292
|
-
initialized: boolean;
|
|
1293
|
-
capabilities: IModuleCapabilities;
|
|
1294
|
-
metadata?: Record<string, string | number | boolean>;
|
|
1295
|
-
}
|
|
1296
|
-
/** Module statistics */
|
|
1297
|
-
interface IModuleStats {
|
|
1298
|
-
enabled: boolean;
|
|
1299
|
-
initialized: boolean;
|
|
1300
|
-
executionCount: number;
|
|
1301
|
-
errorCount: number;
|
|
1302
|
-
lastActivity?: Date;
|
|
1303
|
-
averageExecutionTime?: number;
|
|
1304
|
-
[key: string]: string | number | boolean | Date | undefined;
|
|
1305
|
-
}
|
|
1306
|
-
/** Type-safe module interface */
|
|
1307
|
-
interface IModule<TOptions extends IBaseModuleOptions = IBaseModuleOptions, TStats = IModuleStats> {
|
|
1308
|
-
name: string;
|
|
1309
|
-
version: string;
|
|
1310
|
-
enabled: boolean;
|
|
1311
|
-
initialize(options?: TOptions, eventEmitter?: IEventEmitterPlugin): Promise<void>;
|
|
1312
|
-
dispose?(): Promise<void>;
|
|
1313
|
-
execute?(context: IModuleExecutionContext): Promise<IModuleExecutionResult>;
|
|
1314
|
-
getModuleType(): IModuleDescriptor;
|
|
1315
|
-
getCapabilities(): IModuleCapabilities;
|
|
1316
|
-
getData?(): IModuleData;
|
|
1317
|
-
getStats?(): TStats;
|
|
1318
|
-
isEnabled(): boolean;
|
|
1319
|
-
isInitialized(): boolean;
|
|
1320
|
-
}
|
|
1321
|
-
//#endregion
|
|
1322
1387
|
//#region src/abstracts/abstract-tool.d.ts
|
|
1323
1388
|
/**
|
|
1324
1389
|
* Options for AbstractTool construction
|
|
@@ -1460,80 +1525,15 @@ declare abstract class AbstractTool<TParameters = TToolParameters, TResult = ITo
|
|
|
1460
1525
|
getName(): string;
|
|
1461
1526
|
}
|
|
1462
1527
|
//#endregion
|
|
1463
|
-
//#region src/interfaces/
|
|
1528
|
+
//#region src/interfaces/agent.d.ts
|
|
1464
1529
|
/**
|
|
1465
|
-
*
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
/** Provider name */
|
|
1473
|
-
provider: string;
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* Cached LLM response entry
|
|
1477
|
-
*/
|
|
1478
|
-
interface ICacheEntry {
|
|
1479
|
-
/** Cache key that produced this entry */
|
|
1480
|
-
key: ICacheKey;
|
|
1481
|
-
/** Cached response content */
|
|
1482
|
-
response: string;
|
|
1483
|
-
/** When the entry was cached */
|
|
1484
|
-
timestamp: number;
|
|
1485
|
-
/** SHA-256 integrity hash of the response */
|
|
1486
|
-
integrityHash: string;
|
|
1487
|
-
}
|
|
1488
|
-
/**
|
|
1489
|
-
* Cache storage interface for pluggable backends
|
|
1490
|
-
*/
|
|
1491
|
-
interface ICacheStorage {
|
|
1492
|
-
/** Retrieve a cached entry by key hash */
|
|
1493
|
-
get(hash: string): ICacheEntry | undefined;
|
|
1494
|
-
/** Store a cache entry */
|
|
1495
|
-
set(entry: ICacheEntry): void;
|
|
1496
|
-
/** Delete a cached entry by key hash */
|
|
1497
|
-
delete(hash: string): boolean;
|
|
1498
|
-
/** Clear all cached entries */
|
|
1499
|
-
clear(): void;
|
|
1500
|
-
/** Get cache statistics */
|
|
1501
|
-
getStats(): ICacheStats;
|
|
1502
|
-
}
|
|
1503
|
-
/**
|
|
1504
|
-
* Cache performance statistics
|
|
1505
|
-
*/
|
|
1506
|
-
interface ICacheStats {
|
|
1507
|
-
/** Number of cache hits */
|
|
1508
|
-
hits: number;
|
|
1509
|
-
/** Number of cache misses */
|
|
1510
|
-
misses: number;
|
|
1511
|
-
/** Current number of cached entries */
|
|
1512
|
-
entries: number;
|
|
1513
|
-
/** Hit rate (hits / (hits + misses)), 0 if no lookups */
|
|
1514
|
-
hitRate: number;
|
|
1515
|
-
}
|
|
1516
|
-
/**
|
|
1517
|
-
* Configuration options for execution caching
|
|
1518
|
-
*/
|
|
1519
|
-
interface ICacheOptions {
|
|
1520
|
-
/** Whether caching is enabled */
|
|
1521
|
-
enabled: boolean;
|
|
1522
|
-
/** Maximum number of cached entries */
|
|
1523
|
-
maxEntries: number;
|
|
1524
|
-
/** Time-to-live in milliseconds */
|
|
1525
|
-
ttlMs: number;
|
|
1526
|
-
}
|
|
1527
|
-
//#endregion
|
|
1528
|
-
//#region src/interfaces/agent.d.ts
|
|
1529
|
-
/**
|
|
1530
|
-
* IExecutionContextInjection
|
|
1531
|
-
*
|
|
1532
|
-
* Minimal context payload used to inject an existing ownerPath into a new agent instance
|
|
1533
|
-
* (e.g., when a tool creates an agent and must preserve absolute ownerPath semantics).
|
|
1534
|
-
*
|
|
1535
|
-
* NOTE: This is intentionally NOT ToolExecutionContext. ToolExecutionContext is for tool calls
|
|
1536
|
-
* and requires toolName/parameters; agent creation only needs ownerPath and execution linkage.
|
|
1530
|
+
* IExecutionContextInjection
|
|
1531
|
+
*
|
|
1532
|
+
* Minimal context payload used to inject an existing ownerPath into a new agent instance
|
|
1533
|
+
* (e.g., when a tool creates an agent and must preserve absolute ownerPath semantics).
|
|
1534
|
+
*
|
|
1535
|
+
* NOTE: This is intentionally NOT ToolExecutionContext. ToolExecutionContext is for tool calls
|
|
1536
|
+
* and requires toolName/parameters; agent creation only needs ownerPath and execution linkage.
|
|
1537
1537
|
*/
|
|
1538
1538
|
interface IExecutionContextInjection {
|
|
1539
1539
|
ownerPath?: IOwnerPathSegment[];
|
|
@@ -3181,34 +3181,6 @@ declare function stopPeriodicTask(timer: TTimerId | undefined): void;
|
|
|
3181
3181
|
*/
|
|
3182
3182
|
type TTimerId = ReturnType<typeof setTimeout>;
|
|
3183
3183
|
//#endregion
|
|
3184
|
-
//#region src/managers/conversation-message-factory.d.ts
|
|
3185
|
-
/** Create a user message. */
|
|
3186
|
-
declare function createUserMessage(content: string, options?: {
|
|
3187
|
-
name?: string;
|
|
3188
|
-
metadata?: TUniversalMessageMetadata;
|
|
3189
|
-
parts?: TUniversalMessagePart[];
|
|
3190
|
-
}): IUserMessage;
|
|
3191
|
-
/** Create an assistant message. */
|
|
3192
|
-
declare function createAssistantMessage(content: string | null, options?: {
|
|
3193
|
-
toolCalls?: IToolCall[];
|
|
3194
|
-
metadata?: TUniversalMessageMetadata;
|
|
3195
|
-
parts?: TUniversalMessagePart[];
|
|
3196
|
-
state?: TMessageState;
|
|
3197
|
-
}): IAssistantMessage;
|
|
3198
|
-
/** Create a system message. */
|
|
3199
|
-
declare function createSystemMessage(content: string, options?: {
|
|
3200
|
-
name?: string;
|
|
3201
|
-
metadata?: TUniversalMessageMetadata;
|
|
3202
|
-
parts?: TUniversalMessagePart[];
|
|
3203
|
-
}): ISystemMessage;
|
|
3204
|
-
/** Create a tool message. */
|
|
3205
|
-
declare function createToolMessage(content: string, options: {
|
|
3206
|
-
toolCallId: string;
|
|
3207
|
-
name?: string;
|
|
3208
|
-
metadata?: TUniversalMessageMetadata;
|
|
3209
|
-
parts?: TUniversalMessagePart[];
|
|
3210
|
-
}): IToolMessage;
|
|
3211
|
-
//#endregion
|
|
3212
3184
|
//#region src/managers/conversation-store.d.ts
|
|
3213
3185
|
/** API message format for provider consumption */
|
|
3214
3186
|
interface IProviderApiMessage {
|
|
@@ -3269,6 +3241,34 @@ declare class ConversationStore implements IConversationHistory {
|
|
|
3269
3241
|
clear(): void;
|
|
3270
3242
|
}
|
|
3271
3243
|
//#endregion
|
|
3244
|
+
//#region src/managers/conversation-message-factory.d.ts
|
|
3245
|
+
/** Create a user message. */
|
|
3246
|
+
declare function createUserMessage(content: string, options?: {
|
|
3247
|
+
name?: string;
|
|
3248
|
+
metadata?: TUniversalMessageMetadata;
|
|
3249
|
+
parts?: TUniversalMessagePart[];
|
|
3250
|
+
}): IUserMessage;
|
|
3251
|
+
/** Create an assistant message. */
|
|
3252
|
+
declare function createAssistantMessage(content: string | null, options?: {
|
|
3253
|
+
toolCalls?: IToolCall[];
|
|
3254
|
+
metadata?: TUniversalMessageMetadata;
|
|
3255
|
+
parts?: TUniversalMessagePart[];
|
|
3256
|
+
state?: TMessageState;
|
|
3257
|
+
}): IAssistantMessage;
|
|
3258
|
+
/** Create a system message. */
|
|
3259
|
+
declare function createSystemMessage(content: string, options?: {
|
|
3260
|
+
name?: string;
|
|
3261
|
+
metadata?: TUniversalMessageMetadata;
|
|
3262
|
+
parts?: TUniversalMessagePart[];
|
|
3263
|
+
}): ISystemMessage;
|
|
3264
|
+
/** Create a tool message. */
|
|
3265
|
+
declare function createToolMessage(content: string, options: {
|
|
3266
|
+
toolCallId: string;
|
|
3267
|
+
name?: string;
|
|
3268
|
+
metadata?: TUniversalMessageMetadata;
|
|
3269
|
+
parts?: TUniversalMessagePart[];
|
|
3270
|
+
}): IToolMessage;
|
|
3271
|
+
//#endregion
|
|
3272
3272
|
//#region src/managers/conversation-history-manager.d.ts
|
|
3273
3273
|
/** Interface for managing conversation history. @public */
|
|
3274
3274
|
interface IConversationHistory {
|
|
@@ -3500,10 +3500,6 @@ declare class EventEmitterPlugin extends AbstractPlugin<IEventEmitterPluginOptio
|
|
|
3500
3500
|
destroy(): Promise<void>;
|
|
3501
3501
|
}
|
|
3502
3502
|
//#endregion
|
|
3503
|
-
//#region src/core/robota-config-manager.d.ts
|
|
3504
|
-
/** Agent statistics metadata type */
|
|
3505
|
-
type TAgentStatsMetadata = Record<string, string | number | boolean | Date | string[]>;
|
|
3506
|
-
//#endregion
|
|
3507
3503
|
//#region src/core/robota-types.d.ts
|
|
3508
3504
|
/** Shared model configuration shape used in setModel / getModel. */
|
|
3509
3505
|
interface IModelConfig {
|
|
@@ -3587,6 +3583,252 @@ declare abstract class RobotaBase extends AbstractAgent<IAgentConfig, IRunOption
|
|
|
3587
3583
|
getModuleStats(moduleName: string): TModuleStats;
|
|
3588
3584
|
}
|
|
3589
3585
|
//#endregion
|
|
3586
|
+
//#region src/managers/ai-provider-manager.d.ts
|
|
3587
|
+
/**
|
|
3588
|
+
* AI Provider Manager - manages AI provider instances
|
|
3589
|
+
* Manages registration, selection, and state of AI providers
|
|
3590
|
+
* Instance-based for isolated provider management
|
|
3591
|
+
* @internal
|
|
3592
|
+
*/
|
|
3593
|
+
declare class AIProviders extends AbstractManager implements IAIProviderManager {
|
|
3594
|
+
private providers;
|
|
3595
|
+
private currentProvider;
|
|
3596
|
+
private currentModel;
|
|
3597
|
+
constructor();
|
|
3598
|
+
/**
|
|
3599
|
+
* Initialize the manager
|
|
3600
|
+
*/
|
|
3601
|
+
protected doInitialize(): Promise<void>;
|
|
3602
|
+
/**
|
|
3603
|
+
* Cleanup manager resources
|
|
3604
|
+
*/
|
|
3605
|
+
protected doDispose(): Promise<void>;
|
|
3606
|
+
/**
|
|
3607
|
+
* Register an AI provider
|
|
3608
|
+
*/
|
|
3609
|
+
addProvider(name: string, provider: IAIProvider): void;
|
|
3610
|
+
/**
|
|
3611
|
+
* Remove an AI provider
|
|
3612
|
+
*/
|
|
3613
|
+
removeProvider(name: string): void;
|
|
3614
|
+
/**
|
|
3615
|
+
* Get registered provider by name
|
|
3616
|
+
*/
|
|
3617
|
+
getProvider(name: string): IAIProvider | undefined;
|
|
3618
|
+
/**
|
|
3619
|
+
* Get all registered providers
|
|
3620
|
+
*/
|
|
3621
|
+
getProviders(): Record<string, IAIProvider>;
|
|
3622
|
+
/**
|
|
3623
|
+
* Set current provider and model
|
|
3624
|
+
*/
|
|
3625
|
+
setCurrentProvider(name: string, model: string): void;
|
|
3626
|
+
/**
|
|
3627
|
+
* Get current provider and model
|
|
3628
|
+
*/
|
|
3629
|
+
getCurrentProvider(): {
|
|
3630
|
+
provider: string;
|
|
3631
|
+
model: string;
|
|
3632
|
+
} | undefined;
|
|
3633
|
+
/**
|
|
3634
|
+
* Check if provider is configured
|
|
3635
|
+
*/
|
|
3636
|
+
isConfigured(): boolean;
|
|
3637
|
+
/**
|
|
3638
|
+
* Get available models for a provider
|
|
3639
|
+
* Note: In the new architecture, models are handled by each provider internally
|
|
3640
|
+
*/
|
|
3641
|
+
getAvailableModels(providerName: string): string[];
|
|
3642
|
+
/**
|
|
3643
|
+
* Get current provider instance
|
|
3644
|
+
*/
|
|
3645
|
+
getCurrentProviderInstance(): IAIProvider | undefined;
|
|
3646
|
+
/**
|
|
3647
|
+
* Get provider names
|
|
3648
|
+
*/
|
|
3649
|
+
getProviderNames(): string[];
|
|
3650
|
+
/**
|
|
3651
|
+
* Get providers by pattern
|
|
3652
|
+
*/
|
|
3653
|
+
getProvidersByPattern(pattern: string | RegExp): Record<string, IAIProvider>;
|
|
3654
|
+
/**
|
|
3655
|
+
* Check if provider supports streaming
|
|
3656
|
+
*/
|
|
3657
|
+
supportsStreaming(providerName?: string): boolean;
|
|
3658
|
+
/**
|
|
3659
|
+
* Get provider count
|
|
3660
|
+
*/
|
|
3661
|
+
getProviderCount(): number;
|
|
3662
|
+
}
|
|
3663
|
+
//#endregion
|
|
3664
|
+
//#region src/tool-registry/tool-registry.d.ts
|
|
3665
|
+
/**
|
|
3666
|
+
* Tool registry implementation
|
|
3667
|
+
* Manages tool registration, validation, and retrieval
|
|
3668
|
+
*/
|
|
3669
|
+
declare class ToolRegistry implements IToolRegistry {
|
|
3670
|
+
private tools;
|
|
3671
|
+
/**
|
|
3672
|
+
* Register a tool
|
|
3673
|
+
*/
|
|
3674
|
+
register(tool: ITool): void;
|
|
3675
|
+
/**
|
|
3676
|
+
* Unregister a tool
|
|
3677
|
+
*/
|
|
3678
|
+
unregister(name: string): void;
|
|
3679
|
+
/**
|
|
3680
|
+
* Get tool by name
|
|
3681
|
+
*/
|
|
3682
|
+
get(name: string): ITool | undefined;
|
|
3683
|
+
/**
|
|
3684
|
+
* Get all registered tools
|
|
3685
|
+
*/
|
|
3686
|
+
getAll(): ITool[];
|
|
3687
|
+
/**
|
|
3688
|
+
* Get tool schemas
|
|
3689
|
+
*/
|
|
3690
|
+
getSchemas(): IToolSchema[];
|
|
3691
|
+
/**
|
|
3692
|
+
* Check if tool exists
|
|
3693
|
+
*/
|
|
3694
|
+
has(name: string): boolean;
|
|
3695
|
+
/**
|
|
3696
|
+
* Clear all tools
|
|
3697
|
+
*/
|
|
3698
|
+
clear(): void;
|
|
3699
|
+
/**
|
|
3700
|
+
* Get tool names
|
|
3701
|
+
*/
|
|
3702
|
+
getToolNames(): string[];
|
|
3703
|
+
/**
|
|
3704
|
+
* Get tools by pattern
|
|
3705
|
+
*/
|
|
3706
|
+
getToolsByPattern(pattern: string | RegExp): ITool[];
|
|
3707
|
+
/**
|
|
3708
|
+
* Get tool count
|
|
3709
|
+
*/
|
|
3710
|
+
size(): number;
|
|
3711
|
+
/**
|
|
3712
|
+
* Validate tool schema
|
|
3713
|
+
*/
|
|
3714
|
+
private validateToolSchema;
|
|
3715
|
+
}
|
|
3716
|
+
//#endregion
|
|
3717
|
+
//#region src/managers/tool-manager.d.ts
|
|
3718
|
+
/**
|
|
3719
|
+
* Tool Manager - manages tool registration and execution
|
|
3720
|
+
* Manages tool registration and execution using Tool Registry
|
|
3721
|
+
* Instance-based for isolated tool management
|
|
3722
|
+
* @internal
|
|
3723
|
+
*/
|
|
3724
|
+
declare class Tools extends AbstractManager implements IToolManager {
|
|
3725
|
+
private registry;
|
|
3726
|
+
private allowedTools?;
|
|
3727
|
+
constructor();
|
|
3728
|
+
/**
|
|
3729
|
+
* Initialize the manager
|
|
3730
|
+
*/
|
|
3731
|
+
protected doInitialize(): Promise<void>;
|
|
3732
|
+
/**
|
|
3733
|
+
* Cleanup manager resources
|
|
3734
|
+
*/
|
|
3735
|
+
protected doDispose(): Promise<void>;
|
|
3736
|
+
/**
|
|
3737
|
+
* Register a tool with schema and executor function
|
|
3738
|
+
*/
|
|
3739
|
+
addTool(schema: IToolSchema, executor: TToolExecutor): void;
|
|
3740
|
+
/**
|
|
3741
|
+
* Remove a tool by name
|
|
3742
|
+
*/
|
|
3743
|
+
removeTool(name: string): void;
|
|
3744
|
+
/**
|
|
3745
|
+
* Get tool interface by name
|
|
3746
|
+
*/
|
|
3747
|
+
getTool(name: string): ITool | undefined;
|
|
3748
|
+
/**
|
|
3749
|
+
* Get tool schema by name
|
|
3750
|
+
*/
|
|
3751
|
+
getToolSchema(name: string): IToolSchema | undefined;
|
|
3752
|
+
/**
|
|
3753
|
+
* Get all registered tool schemas
|
|
3754
|
+
*/
|
|
3755
|
+
getTools(): IToolSchema[];
|
|
3756
|
+
/**
|
|
3757
|
+
* Execute a tool with parameters
|
|
3758
|
+
*/
|
|
3759
|
+
executeTool(name: string, parameters: TToolParameters, context?: IToolExecutionContext): Promise<TUniversalValue>;
|
|
3760
|
+
/**
|
|
3761
|
+
* Check if tool exists
|
|
3762
|
+
*/
|
|
3763
|
+
hasTool(name: string): boolean;
|
|
3764
|
+
/**
|
|
3765
|
+
* Set allowed tools for filtering
|
|
3766
|
+
*/
|
|
3767
|
+
setAllowedTools(tools: string[]): void;
|
|
3768
|
+
/**
|
|
3769
|
+
* Get allowed tools
|
|
3770
|
+
*/
|
|
3771
|
+
getAllowedTools(): string[] | undefined;
|
|
3772
|
+
/**
|
|
3773
|
+
* Get tool registry instance (for advanced operations)
|
|
3774
|
+
*/
|
|
3775
|
+
getRegistry(): ToolRegistry;
|
|
3776
|
+
/**
|
|
3777
|
+
* Get tool count
|
|
3778
|
+
*/
|
|
3779
|
+
getToolCount(): number;
|
|
3780
|
+
}
|
|
3781
|
+
//#endregion
|
|
3782
|
+
//#region src/core/robota-config-manager.d.ts
|
|
3783
|
+
/** Agent statistics metadata type */
|
|
3784
|
+
type TAgentStatsMetadata = Record<string, string | number | boolean | Date | string[]>;
|
|
3785
|
+
//#endregion
|
|
3786
|
+
//#region src/services/execution-constants.d.ts
|
|
3787
|
+
/**
|
|
3788
|
+
* ExecutionService owned events.
|
|
3789
|
+
* Local event names only (no dots). Full names are composed at emit time.
|
|
3790
|
+
*/
|
|
3791
|
+
declare const EXECUTION_EVENTS: {
|
|
3792
|
+
readonly START: "start";
|
|
3793
|
+
readonly COMPLETE: "complete";
|
|
3794
|
+
readonly ERROR: "error";
|
|
3795
|
+
readonly ASSISTANT_MESSAGE_START: "assistant_message_start";
|
|
3796
|
+
readonly ASSISTANT_MESSAGE_COMPLETE: "assistant_message_complete";
|
|
3797
|
+
readonly USER_MESSAGE: "user_message";
|
|
3798
|
+
readonly TOOL_RESULTS_TO_LLM: "tool_results_to_llm";
|
|
3799
|
+
readonly TOOL_RESULTS_READY: "tool_results_ready";
|
|
3800
|
+
};
|
|
3801
|
+
declare const EXECUTION_EVENT_PREFIX: "execution";
|
|
3802
|
+
//#endregion
|
|
3803
|
+
//#region src/core/robota-lifecycle.d.ts
|
|
3804
|
+
/** Dependencies required by getStats. @internal */
|
|
3805
|
+
interface IRobotaStatsDeps {
|
|
3806
|
+
readonly name: string;
|
|
3807
|
+
readonly version: string;
|
|
3808
|
+
readonly conversationId: string;
|
|
3809
|
+
readonly startTime: number;
|
|
3810
|
+
readonly isFullyInitialized: boolean;
|
|
3811
|
+
aiProviders: AIProviders;
|
|
3812
|
+
tools: Tools;
|
|
3813
|
+
getPluginNames(): string[];
|
|
3814
|
+
getModuleNames(): string[];
|
|
3815
|
+
getHistory(): TUniversalMessage[];
|
|
3816
|
+
}
|
|
3817
|
+
/** Build comprehensive agent statistics. @internal */
|
|
3818
|
+
declare function buildAgentStats(deps: IRobotaStatsDeps): {
|
|
3819
|
+
name: string;
|
|
3820
|
+
version: string;
|
|
3821
|
+
conversationId: string;
|
|
3822
|
+
providers: string[];
|
|
3823
|
+
currentProvider: string | null;
|
|
3824
|
+
tools: string[];
|
|
3825
|
+
plugins: string[];
|
|
3826
|
+
modules: string[];
|
|
3827
|
+
historyLength: number;
|
|
3828
|
+
historyStats: TAgentStatsMetadata;
|
|
3829
|
+
uptime: number;
|
|
3830
|
+
};
|
|
3831
|
+
//#endregion
|
|
3590
3832
|
//#region src/core/robota.d.ts
|
|
3591
3833
|
/** @public */
|
|
3592
3834
|
declare class Robota extends RobotaBase implements IAgent<IAgentConfig, IRunOptions, TUniversalMessage> {
|
|
@@ -3634,19 +3876,7 @@ declare class Robota extends RobotaBase implements IAgent<IAgentConfig, IRunOpti
|
|
|
3634
3876
|
registerTool(tool: AbstractTool): void;
|
|
3635
3877
|
unregisterTool(toolName: string): void;
|
|
3636
3878
|
getConfig(): IAgentConfig;
|
|
3637
|
-
getStats():
|
|
3638
|
-
name: string;
|
|
3639
|
-
version: string;
|
|
3640
|
-
conversationId: string;
|
|
3641
|
-
providers: string[];
|
|
3642
|
-
currentProvider: string | null;
|
|
3643
|
-
tools: string[];
|
|
3644
|
-
plugins: string[];
|
|
3645
|
-
modules: string[];
|
|
3646
|
-
historyLength: number;
|
|
3647
|
-
historyStats: TAgentStatsMetadata;
|
|
3648
|
-
uptime: number;
|
|
3649
|
-
};
|
|
3879
|
+
getStats(): ReturnType<typeof buildAgentStats>;
|
|
3650
3880
|
destroy(): Promise<void>;
|
|
3651
3881
|
protected initialize(): Promise<void>;
|
|
3652
3882
|
private ensureFullyInitialized;
|
|
@@ -3654,6 +3884,51 @@ declare class Robota extends RobotaBase implements IAgent<IAgentConfig, IRunOpti
|
|
|
3654
3884
|
private emitAgentEvent;
|
|
3655
3885
|
}
|
|
3656
3886
|
//#endregion
|
|
3887
|
+
//#region src/managers/agent-factory-helpers.d.ts
|
|
3888
|
+
/**
|
|
3889
|
+
* Configuration options for AgentFactory
|
|
3890
|
+
*/
|
|
3891
|
+
interface IAgentFactoryOptions {
|
|
3892
|
+
/** Default model to use if not specified in config */
|
|
3893
|
+
defaultModel?: string;
|
|
3894
|
+
/** Default provider to use if not specified in config */
|
|
3895
|
+
defaultProvider?: string;
|
|
3896
|
+
/** Maximum number of concurrent agents */
|
|
3897
|
+
maxConcurrentAgents?: number;
|
|
3898
|
+
/** Default system message for agents */
|
|
3899
|
+
defaultSystemMessage?: string;
|
|
3900
|
+
/** Enable strict configuration validation */
|
|
3901
|
+
strictValidation?: boolean;
|
|
3902
|
+
}
|
|
3903
|
+
/**
|
|
3904
|
+
* Agent creation statistics
|
|
3905
|
+
*/
|
|
3906
|
+
interface IAgentCreationStats {
|
|
3907
|
+
/** Total number of agents created */
|
|
3908
|
+
totalCreated: number;
|
|
3909
|
+
/** Number of currently active agents */
|
|
3910
|
+
activeCount: number;
|
|
3911
|
+
/** Number of agents created from templates */
|
|
3912
|
+
fromTemplates: number;
|
|
3913
|
+
/** Number of custom configured agents */
|
|
3914
|
+
customConfigured: number;
|
|
3915
|
+
/** Template vs custom creation ratio (fromTemplates / totalCreated) */
|
|
3916
|
+
templateUsageRatio: number;
|
|
3917
|
+
}
|
|
3918
|
+
/**
|
|
3919
|
+
* Agent lifecycle events
|
|
3920
|
+
*/
|
|
3921
|
+
interface IAgentLifecycleEvents {
|
|
3922
|
+
/** Called before agent creation */
|
|
3923
|
+
beforeCreate?: (config: IAgentConfig) => Promise<void> | void;
|
|
3924
|
+
/** Called after successful agent creation */
|
|
3925
|
+
afterCreate?: (agent: IAgent<IAgentConfig>, config: IAgentConfig) => Promise<void> | void;
|
|
3926
|
+
/** Called when agent creation fails */
|
|
3927
|
+
onCreateError?: (error: Error, config: IAgentConfig) => Promise<void> | void;
|
|
3928
|
+
/** Called when agent is destroyed */
|
|
3929
|
+
onDestroy?: (agentId: string) => Promise<void> | void;
|
|
3930
|
+
}
|
|
3931
|
+
//#endregion
|
|
3657
3932
|
//#region src/managers/agent-templates.d.ts
|
|
3658
3933
|
/**
|
|
3659
3934
|
* Template application result
|
|
@@ -3730,51 +4005,6 @@ declare class AgentTemplates {
|
|
|
3730
4005
|
};
|
|
3731
4006
|
}
|
|
3732
4007
|
//#endregion
|
|
3733
|
-
//#region src/managers/agent-factory-helpers.d.ts
|
|
3734
|
-
/**
|
|
3735
|
-
* Configuration options for AgentFactory
|
|
3736
|
-
*/
|
|
3737
|
-
interface IAgentFactoryOptions {
|
|
3738
|
-
/** Default model to use if not specified in config */
|
|
3739
|
-
defaultModel?: string;
|
|
3740
|
-
/** Default provider to use if not specified in config */
|
|
3741
|
-
defaultProvider?: string;
|
|
3742
|
-
/** Maximum number of concurrent agents */
|
|
3743
|
-
maxConcurrentAgents?: number;
|
|
3744
|
-
/** Default system message for agents */
|
|
3745
|
-
defaultSystemMessage?: string;
|
|
3746
|
-
/** Enable strict configuration validation */
|
|
3747
|
-
strictValidation?: boolean;
|
|
3748
|
-
}
|
|
3749
|
-
/**
|
|
3750
|
-
* Agent creation statistics
|
|
3751
|
-
*/
|
|
3752
|
-
interface IAgentCreationStats {
|
|
3753
|
-
/** Total number of agents created */
|
|
3754
|
-
totalCreated: number;
|
|
3755
|
-
/** Number of currently active agents */
|
|
3756
|
-
activeCount: number;
|
|
3757
|
-
/** Number of agents created from templates */
|
|
3758
|
-
fromTemplates: number;
|
|
3759
|
-
/** Number of custom configured agents */
|
|
3760
|
-
customConfigured: number;
|
|
3761
|
-
/** Template vs custom creation ratio (fromTemplates / totalCreated) */
|
|
3762
|
-
templateUsageRatio: number;
|
|
3763
|
-
}
|
|
3764
|
-
/**
|
|
3765
|
-
* Agent lifecycle events
|
|
3766
|
-
*/
|
|
3767
|
-
interface IAgentLifecycleEvents {
|
|
3768
|
-
/** Called before agent creation */
|
|
3769
|
-
beforeCreate?: (config: IAgentConfig) => Promise<void> | void;
|
|
3770
|
-
/** Called after successful agent creation */
|
|
3771
|
-
afterCreate?: (agent: IAgent<IAgentConfig>, config: IAgentConfig) => Promise<void> | void;
|
|
3772
|
-
/** Called when agent creation fails */
|
|
3773
|
-
onCreateError?: (error: Error, config: IAgentConfig) => Promise<void> | void;
|
|
3774
|
-
/** Called when agent is destroyed */
|
|
3775
|
-
onDestroy?: (agentId: string) => Promise<void> | void;
|
|
3776
|
-
}
|
|
3777
|
-
//#endregion
|
|
3778
4008
|
//#region src/managers/agent-factory.d.ts
|
|
3779
4009
|
/**
|
|
3780
4010
|
* Agent Factory for creating and managing agents
|
|
@@ -3877,23 +4107,6 @@ declare class EventHistoryModule implements IEventHistoryModule {
|
|
|
3877
4107
|
private nextSequenceId;
|
|
3878
4108
|
}
|
|
3879
4109
|
//#endregion
|
|
3880
|
-
//#region src/services/execution-constants.d.ts
|
|
3881
|
-
/**
|
|
3882
|
-
* ExecutionService owned events.
|
|
3883
|
-
* Local event names only (no dots). Full names are composed at emit time.
|
|
3884
|
-
*/
|
|
3885
|
-
declare const EXECUTION_EVENTS: {
|
|
3886
|
-
readonly START: "start";
|
|
3887
|
-
readonly COMPLETE: "complete";
|
|
3888
|
-
readonly ERROR: "error";
|
|
3889
|
-
readonly ASSISTANT_MESSAGE_START: "assistant_message_start";
|
|
3890
|
-
readonly ASSISTANT_MESSAGE_COMPLETE: "assistant_message_complete";
|
|
3891
|
-
readonly USER_MESSAGE: "user_message";
|
|
3892
|
-
readonly TOOL_RESULTS_TO_LLM: "tool_results_to_llm";
|
|
3893
|
-
readonly TOOL_RESULTS_READY: "tool_results_ready";
|
|
3894
|
-
};
|
|
3895
|
-
declare const EXECUTION_EVENT_PREFIX: "execution";
|
|
3896
|
-
//#endregion
|
|
3897
4110
|
//#region src/services/tool-execution-service.d.ts
|
|
3898
4111
|
/**
|
|
3899
4112
|
* ToolExecutionService owned events
|