@agentforge/core 0.11.8 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1559,7 +1559,7 @@ declare function createToolExecutor(config?: ToolExecutorConfig): {
1559
1559
  * Tool Lifecycle Management - Manage tool initialization, cleanup, and resources
1560
1560
  * @module tools/lifecycle
1561
1561
  */
1562
- interface HealthCheckResult {
1562
+ interface ToolHealthCheckResult {
1563
1563
  healthy: boolean;
1564
1564
  error?: string;
1565
1565
  metadata?: Record<string, any>;
@@ -1570,7 +1570,7 @@ interface ManagedToolConfig<TContext = any, TInput = any, TOutput = any> {
1570
1570
  initialize?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<void>;
1571
1571
  execute: (this: ManagedTool<TContext, TInput, TOutput>, input: TInput) => Promise<TOutput>;
1572
1572
  cleanup?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<void>;
1573
- healthCheck?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<HealthCheckResult>;
1573
+ healthCheck?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<ToolHealthCheckResult>;
1574
1574
  context?: TContext;
1575
1575
  autoCleanup?: boolean;
1576
1576
  healthCheckInterval?: number;
@@ -1581,7 +1581,7 @@ interface ManagedToolStats {
1581
1581
  successfulExecutions: number;
1582
1582
  failedExecutions: number;
1583
1583
  lastExecutionTime?: number;
1584
- lastHealthCheck?: HealthCheckResult;
1584
+ lastHealthCheck?: ToolHealthCheckResult;
1585
1585
  lastHealthCheckTime?: number;
1586
1586
  }
1587
1587
  /**
@@ -1628,7 +1628,7 @@ declare class ManagedTool<TContext = any, TInput = any, TOutput = any> {
1628
1628
  /**
1629
1629
  * Run health check
1630
1630
  */
1631
- healthCheck(): Promise<HealthCheckResult>;
1631
+ healthCheck(): Promise<ToolHealthCheckResult>;
1632
1632
  /**
1633
1633
  * Get tool statistics
1634
1634
  */
@@ -5157,6 +5157,219 @@ declare class CircuitBreaker {
5157
5157
  }
5158
5158
  declare function createCircuitBreaker(options: CircuitBreakerOptions): CircuitBreaker;
5159
5159
 
5160
+ /**
5161
+ * Health check system for production monitoring
5162
+ */
5163
+ type HealthStatus = 'healthy' | 'unhealthy' | 'degraded';
5164
+ interface HealthCheckResult {
5165
+ healthy: boolean;
5166
+ status?: HealthStatus;
5167
+ message?: string;
5168
+ error?: string;
5169
+ timestamp?: number;
5170
+ duration?: number;
5171
+ metadata?: Record<string, any>;
5172
+ }
5173
+ interface HealthCheck {
5174
+ (): Promise<HealthCheckResult>;
5175
+ }
5176
+ interface HealthCheckerOptions {
5177
+ checks: Record<string, HealthCheck>;
5178
+ timeout?: number;
5179
+ interval?: number;
5180
+ onHealthChange?: (health: HealthReport) => void;
5181
+ onCheckFail?: (name: string, error: Error) => void;
5182
+ }
5183
+ interface HealthReport {
5184
+ healthy: boolean;
5185
+ status: HealthStatus;
5186
+ timestamp: number;
5187
+ checks: Record<string, HealthCheckResult>;
5188
+ uptime: number;
5189
+ }
5190
+ declare class HealthChecker {
5191
+ private options;
5192
+ private checkTimer?;
5193
+ private lastReport?;
5194
+ private startTime;
5195
+ private running;
5196
+ constructor(options: HealthCheckerOptions);
5197
+ start(): void;
5198
+ stop(): void;
5199
+ getHealth(): Promise<HealthReport>;
5200
+ getLiveness(): Promise<HealthCheckResult>;
5201
+ getReadiness(): Promise<HealthReport>;
5202
+ private runChecks;
5203
+ }
5204
+ declare function createHealthChecker(options: HealthCheckerOptions): HealthChecker;
5205
+
5206
+ /**
5207
+ * Performance profiling for execution monitoring
5208
+ */
5209
+ interface ProfilerOptions {
5210
+ enabled?: boolean;
5211
+ sampleRate?: number;
5212
+ includeMemory?: boolean;
5213
+ includeStack?: boolean;
5214
+ maxSamples?: number;
5215
+ }
5216
+ interface ProfileSample {
5217
+ timestamp: number;
5218
+ duration: number;
5219
+ memory?: {
5220
+ heapUsed: number;
5221
+ heapTotal: number;
5222
+ external: number;
5223
+ };
5224
+ stack?: string;
5225
+ }
5226
+ interface ProfileStats {
5227
+ calls: number;
5228
+ totalTime: number;
5229
+ avgTime: number;
5230
+ minTime: number;
5231
+ maxTime: number;
5232
+ p50: number;
5233
+ p95: number;
5234
+ p99: number;
5235
+ memory?: {
5236
+ avgHeapUsed: number;
5237
+ maxHeapUsed: number;
5238
+ minHeapUsed: number;
5239
+ };
5240
+ samples: ProfileSample[];
5241
+ }
5242
+ interface ProfileReport {
5243
+ [key: string]: ProfileStats;
5244
+ }
5245
+ declare class Profiler {
5246
+ private profiles;
5247
+ private enabled;
5248
+ private sampleRate;
5249
+ private includeMemory;
5250
+ private includeStack;
5251
+ private maxSamples;
5252
+ constructor(options?: ProfilerOptions);
5253
+ profile<TArgs extends any[], TReturn>(name: string, fn: (...args: TArgs) => Promise<TReturn>): (...args: TArgs) => Promise<TReturn>;
5254
+ wrap<T>(name: string, promise: Promise<T>): Promise<T>;
5255
+ private recordSample;
5256
+ getReport(): ProfileReport;
5257
+ private percentile;
5258
+ reset(name?: string): void;
5259
+ export(path: string): void;
5260
+ }
5261
+ declare function createProfiler(options?: ProfilerOptions): Profiler;
5262
+
5263
+ /**
5264
+ * Alert system for production monitoring
5265
+ */
5266
+ type AlertSeverity = 'info' | 'warning' | 'error' | 'critical';
5267
+ interface Alert {
5268
+ name: string;
5269
+ severity: AlertSeverity;
5270
+ message: string;
5271
+ timestamp?: number;
5272
+ data?: Record<string, any>;
5273
+ }
5274
+ interface AlertChannel {
5275
+ type: string;
5276
+ config: Record<string, any>;
5277
+ }
5278
+ interface AlertRule {
5279
+ name: string;
5280
+ condition: (metrics: any) => boolean;
5281
+ severity: AlertSeverity;
5282
+ channels: string[];
5283
+ throttle?: number;
5284
+ message?: string;
5285
+ }
5286
+ interface AlertManagerOptions {
5287
+ channels: Record<string, AlertChannel>;
5288
+ rules?: AlertRule[];
5289
+ onAlert?: (alert: Alert) => void;
5290
+ }
5291
+ declare class AlertManager {
5292
+ private options;
5293
+ private lastAlertTime;
5294
+ private monitorTimer?;
5295
+ private running;
5296
+ constructor(options: AlertManagerOptions);
5297
+ start(metrics?: () => any, interval?: number): void;
5298
+ stop(): void;
5299
+ alert(alert: Alert): Promise<void>;
5300
+ private checkRules;
5301
+ private isThrottled;
5302
+ sendToChannel(channelName: string, alert: Alert): Promise<void>;
5303
+ getAlertHistory(name?: string, limit?: number): Alert[];
5304
+ clearAlertHistory(name?: string): void;
5305
+ }
5306
+ declare function createAlertManager(options: AlertManagerOptions): AlertManager;
5307
+
5308
+ /**
5309
+ * Audit logging for compliance and tracking
5310
+ */
5311
+ interface AuditLogEntry {
5312
+ id?: string;
5313
+ userId: string;
5314
+ action: string;
5315
+ resource: string;
5316
+ timestamp?: number;
5317
+ input?: any;
5318
+ output?: any;
5319
+ metadata?: Record<string, any>;
5320
+ success?: boolean;
5321
+ error?: string;
5322
+ }
5323
+ interface AuditLogQuery {
5324
+ userId?: string;
5325
+ action?: string;
5326
+ resource?: string;
5327
+ startDate?: Date;
5328
+ endDate?: Date;
5329
+ limit?: number;
5330
+ offset?: number;
5331
+ }
5332
+ interface AuditLoggerOptions {
5333
+ storage?: {
5334
+ type: 'memory' | 'database' | 'file';
5335
+ config?: Record<string, any>;
5336
+ };
5337
+ retention?: {
5338
+ days: number;
5339
+ autoCleanup?: boolean;
5340
+ };
5341
+ fields?: {
5342
+ userId?: boolean;
5343
+ action?: boolean;
5344
+ resource?: boolean;
5345
+ timestamp?: boolean;
5346
+ ip?: boolean;
5347
+ userAgent?: boolean;
5348
+ input?: boolean;
5349
+ output?: boolean;
5350
+ };
5351
+ onLog?: (entry: AuditLogEntry) => void;
5352
+ }
5353
+ declare class AuditLogger {
5354
+ private options;
5355
+ private logs;
5356
+ private cleanupTimer?;
5357
+ constructor(options?: AuditLoggerOptions);
5358
+ log(entry: AuditLogEntry): Promise<void>;
5359
+ query(query?: AuditLogQuery): Promise<AuditLogEntry[]>;
5360
+ export(path: string, options?: {
5361
+ format?: 'json' | 'csv';
5362
+ startDate?: Date;
5363
+ endDate?: Date;
5364
+ }): Promise<void>;
5365
+ private convertToCSV;
5366
+ private startCleanup;
5367
+ private cleanup;
5368
+ private generateId;
5369
+ stop(): void;
5370
+ }
5371
+ declare function createAuditLogger(options?: AuditLoggerOptions): AuditLogger;
5372
+
5160
5373
  /**
5161
5374
  * Prompt Template Loader
5162
5375
  *
@@ -5264,4 +5477,4 @@ declare function renderTemplate(template: string, options: RenderTemplateOptions
5264
5477
  */
5265
5478
  declare function loadPrompt(promptName: string, options?: RenderTemplateOptions | Record<string, any>, promptsDir?: string): string;
5266
5479
 
5267
- export { AgentError, type AgentResumedEventData, type AgentWaitingEventData, type AggregateNode, type AnyInterrupt, type ApprovalRequiredInterrupt, type BackoffStrategy, type BatchOptions, BatchProcessor, type BatchProcessorOptions, type BatchStats, type CacheKeyGenerator, type CachingOptions, type CheckInterruptOptions, type CheckpointHistoryOptions, type CheckpointerOptions, type ChunkOptions, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerStats, type CircuitState, type ComposeGraphsOptions, type ComposeOptions, type ComposeToolConfig, type ComposedTool, type ConcurrencyOptions, type ConditionalConfig, type ConditionalRouter, type ConditionalRouterConfig, ConnectionPool, type ConnectionPoolOptions, type ConversationConfig, type CustomInterrupt, type DatabaseConfig, type DatabaseConnection, DatabasePool, type DatabasePoolOptions, type DevelopmentPresetOptions, type ErrorContext, type ErrorHandlerOptions, type ErrorReporter, type ErrorReporterOptions, type EventHandler, type EvictionStrategy, type ExecutionMetrics, type HealthCheckConfig, type HealthCheckResult, type HttpClient, type HttpConfig, HttpPool, type HttpPoolConfig, type HttpPoolOptions, type HttpResponse, type HumanInLoopEventData, type HumanInLoopEventType, type HumanRequest, type HumanRequestEventData, type HumanRequestInterrupt, type HumanRequestPriority, type HumanRequestStatus, type HumanResponseEventData, type InterruptData, type InterruptEventData, type InterruptType, type LangSmithConfig, type LogEntry, LogLevel, type Logger, type LoggerOptions, type LoggingOptions, ManagedTool, type ManagedToolConfig, type ManagedToolStats, MemoryManager, type MemoryManagerOptions, type MemoryStats, type MetricEntry, MetricType, type Metrics, type MetricsNodeOptions, type Middleware, MiddlewareChain, type MiddlewareContext, type MiddlewareFactory, type MiddlewareMetadata, type MiddlewareWithMetadata, MissingDescriptionError, type MockToolConfig, type MockToolResponse, type NodeFunction, type NodeFunctionWithContext, type ParallelNode, type ParallelWorkflowConfig, type ParallelWorkflowOptions, type PoolConfig, type PoolStats, type Priority$1 as Priority, type ProductionPresetOptions, type Progress, type ProgressTracker, type ProgressTrackerOptions, type PromptOptions, type RateLimitOptions, type RateLimitStrategy, type ReducerFunction, RegistryEvent, type RenderTemplateOptions, type RequestConfig, type ResumeCommand, type ResumeEventData, type ResumeOptions, type RetryOptions, type RetryPolicy, type RouteCondition, type RouteMap, type RouteName, type SSEEvent, type SSEFormatter, type SSEFormatterOptions, type SequentialNode, type SequentialWorkflowOptions, type SimpleMiddleware, type SqliteCheckpointerOptions, type StateChannelConfig, type SubgraphBuilder, type TestingPresetOptions, type ThreadConfig, type ThreadInfo, type ThreadStatus, type ThrottleOptions, TimeoutError, type TimeoutOptions, type Timer, type Tool, type BackoffStrategy$1 as ToolBackoffStrategy, ToolBuilder, ToolCategory, ToolCategorySchema, type ToolExample, ToolExampleSchema, type ToolExecution, type ToolExecutorConfig, type ToolInvocation, type ToolMetadata, ToolMetadataSchema, ToolNameSchema, ToolRegistry, type ToolRelations, ToolRelationsSchema, type ToolSimulatorConfig, type TracingOptions, type ValidationErrorHandler, type ValidationMode, type ValidationOptions, type ValidatorFunction, type WebSocketHandlerOptions, type WebSocketMessage, batch, broadcast, cache, chain, chunk, clearThread, collect, compose, composeGraphs, composeTool, composeWithOptions, conditional, configureLangSmith, createApprovalRequiredInterrupt, createBatchProcessor, createBinaryRouter, createCircuitBreaker, createConditionalRouter, createConnectionPool, createConversationConfig, createCustomInterrupt, createDatabasePool, createErrorReporter, createHeartbeat, createHttpPool, createHumanRequestInterrupt, createLogger, createManagedTool, createMemoryCheckpointer, createMemoryManager, createMessage, createMetrics, createMiddlewareContext, createMockTool, createMultiRouter, createParallelWorkflow, createProgressTracker, createSSEFormatter, createSequentialWorkflow, createSharedCache, createSharedConcurrencyController, createSharedRateLimiter, createSqliteCheckpointer, createStateAnnotation, createSubgraph, createThreadConfig, createTool, createToolExecutor, createToolSimulator, createToolUnsafe, createWebSocketHandler, development, filter, formatAgentResumedEvent, formatAgentWaitingEvent, formatHumanRequestEvent, formatHumanResponseEvent, formatInterruptEvent, formatResumeEvent, generateThreadId, getCheckpointHistory, getLangSmithConfig, getLatestCheckpoint, getMissingDescriptions, getThreadStatus, getToolDescription, getToolJsonSchema, isApprovalRequiredInterrupt, isCustomInterrupt, isHumanRequestInterrupt, isMemoryCheckpointer, isTracingEnabled, loadPrompt, map, merge, mergeState, parallel, parseSSEEvent, presets, production, reduce, renderTemplate, retry, safeValidateSchemaDescriptions, sanitizeValue, sendMessage, sequential, sequentialBuilder, take, testing, throttle, timeout, toLangChainTool, toLangChainTools, toolBuilder, validateSchemaDescriptions, validateState, validateTool, validateToolMetadata, validateToolName, withCache, withConcurrency, withErrorHandler, withLogging, withMetrics, withRateLimit, withRetry, withTimeout, withTracing, withValidation };
5480
+ export { AgentError, type AgentResumedEventData, type AgentWaitingEventData, type AggregateNode, type Alert, type AlertChannel, AlertManager, type AlertManagerOptions, type AlertRule, type AlertSeverity, type AnyInterrupt, type ApprovalRequiredInterrupt, type AuditLogEntry, type AuditLogQuery, AuditLogger, type AuditLoggerOptions, type BackoffStrategy, type BatchOptions, BatchProcessor, type BatchProcessorOptions, type BatchStats, type CacheKeyGenerator, type CachingOptions, type CheckInterruptOptions, type CheckpointHistoryOptions, type CheckpointerOptions, type ChunkOptions, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerStats, type CircuitState, type ComposeGraphsOptions, type ComposeOptions, type ComposeToolConfig, type ComposedTool, type ConcurrencyOptions, type ConditionalConfig, type ConditionalRouter, type ConditionalRouterConfig, ConnectionPool, type ConnectionPoolOptions, type ConversationConfig, type CustomInterrupt, type DatabaseConfig, type DatabaseConnection, DatabasePool, type DatabasePoolOptions, type DevelopmentPresetOptions, type ErrorContext, type ErrorHandlerOptions, type ErrorReporter, type ErrorReporterOptions, type EventHandler, type EvictionStrategy, type ExecutionMetrics, type HealthCheck, type HealthCheckConfig, type HealthCheckResult, HealthChecker, type HealthCheckerOptions, type HealthReport, type HealthStatus, type HttpClient, type HttpConfig, HttpPool, type HttpPoolConfig, type HttpPoolOptions, type HttpResponse, type HumanInLoopEventData, type HumanInLoopEventType, type HumanRequest, type HumanRequestEventData, type HumanRequestInterrupt, type HumanRequestPriority, type HumanRequestStatus, type HumanResponseEventData, type InterruptData, type InterruptEventData, type InterruptType, type LangSmithConfig, type LogEntry, LogLevel, type Logger, type LoggerOptions, type LoggingOptions, ManagedTool, type ManagedToolConfig, type ManagedToolStats, MemoryManager, type MemoryManagerOptions, type MemoryStats, type MetricEntry, MetricType, type Metrics, type MetricsNodeOptions, type Middleware, MiddlewareChain, type MiddlewareContext, type MiddlewareFactory, type MiddlewareMetadata, type MiddlewareWithMetadata, MissingDescriptionError, type MockToolConfig, type MockToolResponse, type NodeFunction, type NodeFunctionWithContext, type ParallelNode, type ParallelWorkflowConfig, type ParallelWorkflowOptions, type PoolConfig, type PoolStats, type Priority$1 as Priority, type ProductionPresetOptions, type ProfileReport, type ProfileSample, type ProfileStats, Profiler, type ProfilerOptions, type Progress, type ProgressTracker, type ProgressTrackerOptions, type PromptOptions, type RateLimitOptions, type RateLimitStrategy, type ReducerFunction, RegistryEvent, type RenderTemplateOptions, type RequestConfig, type ResumeCommand, type ResumeEventData, type ResumeOptions, type RetryOptions, type RetryPolicy, type RouteCondition, type RouteMap, type RouteName, type SSEEvent, type SSEFormatter, type SSEFormatterOptions, type SequentialNode, type SequentialWorkflowOptions, type SimpleMiddleware, type SqliteCheckpointerOptions, type StateChannelConfig, type SubgraphBuilder, type TestingPresetOptions, type ThreadConfig, type ThreadInfo, type ThreadStatus, type ThrottleOptions, TimeoutError, type TimeoutOptions, type Timer, type Tool, type BackoffStrategy$1 as ToolBackoffStrategy, ToolBuilder, ToolCategory, ToolCategorySchema, type ToolExample, ToolExampleSchema, type ToolExecution, type ToolExecutorConfig, type ToolHealthCheckResult, type ToolInvocation, type ToolMetadata, ToolMetadataSchema, ToolNameSchema, ToolRegistry, type ToolRelations, ToolRelationsSchema, type ToolSimulatorConfig, type TracingOptions, type ValidationErrorHandler, type ValidationMode, type ValidationOptions, type ValidatorFunction, type WebSocketHandlerOptions, type WebSocketMessage, batch, broadcast, cache, chain, chunk, clearThread, collect, compose, composeGraphs, composeTool, composeWithOptions, conditional, configureLangSmith, createAlertManager, createApprovalRequiredInterrupt, createAuditLogger, createBatchProcessor, createBinaryRouter, createCircuitBreaker, createConditionalRouter, createConnectionPool, createConversationConfig, createCustomInterrupt, createDatabasePool, createErrorReporter, createHealthChecker, createHeartbeat, createHttpPool, createHumanRequestInterrupt, createLogger, createManagedTool, createMemoryCheckpointer, createMemoryManager, createMessage, createMetrics, createMiddlewareContext, createMockTool, createMultiRouter, createParallelWorkflow, createProfiler, createProgressTracker, createSSEFormatter, createSequentialWorkflow, createSharedCache, createSharedConcurrencyController, createSharedRateLimiter, createSqliteCheckpointer, createStateAnnotation, createSubgraph, createThreadConfig, createTool, createToolExecutor, createToolSimulator, createToolUnsafe, createWebSocketHandler, development, filter, formatAgentResumedEvent, formatAgentWaitingEvent, formatHumanRequestEvent, formatHumanResponseEvent, formatInterruptEvent, formatResumeEvent, generateThreadId, getCheckpointHistory, getLangSmithConfig, getLatestCheckpoint, getMissingDescriptions, getThreadStatus, getToolDescription, getToolJsonSchema, isApprovalRequiredInterrupt, isCustomInterrupt, isHumanRequestInterrupt, isMemoryCheckpointer, isTracingEnabled, loadPrompt, map, merge, mergeState, parallel, parseSSEEvent, presets, production, reduce, renderTemplate, retry, safeValidateSchemaDescriptions, sanitizeValue, sendMessage, sequential, sequentialBuilder, take, testing, throttle, timeout, toLangChainTool, toLangChainTools, toolBuilder, validateSchemaDescriptions, validateState, validateTool, validateToolMetadata, validateToolName, withCache, withConcurrency, withErrorHandler, withLogging, withMetrics, withRateLimit, withRetry, withTimeout, withTracing, withValidation };
package/dist/index.d.ts CHANGED
@@ -1559,7 +1559,7 @@ declare function createToolExecutor(config?: ToolExecutorConfig): {
1559
1559
  * Tool Lifecycle Management - Manage tool initialization, cleanup, and resources
1560
1560
  * @module tools/lifecycle
1561
1561
  */
1562
- interface HealthCheckResult {
1562
+ interface ToolHealthCheckResult {
1563
1563
  healthy: boolean;
1564
1564
  error?: string;
1565
1565
  metadata?: Record<string, any>;
@@ -1570,7 +1570,7 @@ interface ManagedToolConfig<TContext = any, TInput = any, TOutput = any> {
1570
1570
  initialize?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<void>;
1571
1571
  execute: (this: ManagedTool<TContext, TInput, TOutput>, input: TInput) => Promise<TOutput>;
1572
1572
  cleanup?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<void>;
1573
- healthCheck?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<HealthCheckResult>;
1573
+ healthCheck?: (this: ManagedTool<TContext, TInput, TOutput>) => Promise<ToolHealthCheckResult>;
1574
1574
  context?: TContext;
1575
1575
  autoCleanup?: boolean;
1576
1576
  healthCheckInterval?: number;
@@ -1581,7 +1581,7 @@ interface ManagedToolStats {
1581
1581
  successfulExecutions: number;
1582
1582
  failedExecutions: number;
1583
1583
  lastExecutionTime?: number;
1584
- lastHealthCheck?: HealthCheckResult;
1584
+ lastHealthCheck?: ToolHealthCheckResult;
1585
1585
  lastHealthCheckTime?: number;
1586
1586
  }
1587
1587
  /**
@@ -1628,7 +1628,7 @@ declare class ManagedTool<TContext = any, TInput = any, TOutput = any> {
1628
1628
  /**
1629
1629
  * Run health check
1630
1630
  */
1631
- healthCheck(): Promise<HealthCheckResult>;
1631
+ healthCheck(): Promise<ToolHealthCheckResult>;
1632
1632
  /**
1633
1633
  * Get tool statistics
1634
1634
  */
@@ -5157,6 +5157,219 @@ declare class CircuitBreaker {
5157
5157
  }
5158
5158
  declare function createCircuitBreaker(options: CircuitBreakerOptions): CircuitBreaker;
5159
5159
 
5160
+ /**
5161
+ * Health check system for production monitoring
5162
+ */
5163
+ type HealthStatus = 'healthy' | 'unhealthy' | 'degraded';
5164
+ interface HealthCheckResult {
5165
+ healthy: boolean;
5166
+ status?: HealthStatus;
5167
+ message?: string;
5168
+ error?: string;
5169
+ timestamp?: number;
5170
+ duration?: number;
5171
+ metadata?: Record<string, any>;
5172
+ }
5173
+ interface HealthCheck {
5174
+ (): Promise<HealthCheckResult>;
5175
+ }
5176
+ interface HealthCheckerOptions {
5177
+ checks: Record<string, HealthCheck>;
5178
+ timeout?: number;
5179
+ interval?: number;
5180
+ onHealthChange?: (health: HealthReport) => void;
5181
+ onCheckFail?: (name: string, error: Error) => void;
5182
+ }
5183
+ interface HealthReport {
5184
+ healthy: boolean;
5185
+ status: HealthStatus;
5186
+ timestamp: number;
5187
+ checks: Record<string, HealthCheckResult>;
5188
+ uptime: number;
5189
+ }
5190
+ declare class HealthChecker {
5191
+ private options;
5192
+ private checkTimer?;
5193
+ private lastReport?;
5194
+ private startTime;
5195
+ private running;
5196
+ constructor(options: HealthCheckerOptions);
5197
+ start(): void;
5198
+ stop(): void;
5199
+ getHealth(): Promise<HealthReport>;
5200
+ getLiveness(): Promise<HealthCheckResult>;
5201
+ getReadiness(): Promise<HealthReport>;
5202
+ private runChecks;
5203
+ }
5204
+ declare function createHealthChecker(options: HealthCheckerOptions): HealthChecker;
5205
+
5206
+ /**
5207
+ * Performance profiling for execution monitoring
5208
+ */
5209
+ interface ProfilerOptions {
5210
+ enabled?: boolean;
5211
+ sampleRate?: number;
5212
+ includeMemory?: boolean;
5213
+ includeStack?: boolean;
5214
+ maxSamples?: number;
5215
+ }
5216
+ interface ProfileSample {
5217
+ timestamp: number;
5218
+ duration: number;
5219
+ memory?: {
5220
+ heapUsed: number;
5221
+ heapTotal: number;
5222
+ external: number;
5223
+ };
5224
+ stack?: string;
5225
+ }
5226
+ interface ProfileStats {
5227
+ calls: number;
5228
+ totalTime: number;
5229
+ avgTime: number;
5230
+ minTime: number;
5231
+ maxTime: number;
5232
+ p50: number;
5233
+ p95: number;
5234
+ p99: number;
5235
+ memory?: {
5236
+ avgHeapUsed: number;
5237
+ maxHeapUsed: number;
5238
+ minHeapUsed: number;
5239
+ };
5240
+ samples: ProfileSample[];
5241
+ }
5242
+ interface ProfileReport {
5243
+ [key: string]: ProfileStats;
5244
+ }
5245
+ declare class Profiler {
5246
+ private profiles;
5247
+ private enabled;
5248
+ private sampleRate;
5249
+ private includeMemory;
5250
+ private includeStack;
5251
+ private maxSamples;
5252
+ constructor(options?: ProfilerOptions);
5253
+ profile<TArgs extends any[], TReturn>(name: string, fn: (...args: TArgs) => Promise<TReturn>): (...args: TArgs) => Promise<TReturn>;
5254
+ wrap<T>(name: string, promise: Promise<T>): Promise<T>;
5255
+ private recordSample;
5256
+ getReport(): ProfileReport;
5257
+ private percentile;
5258
+ reset(name?: string): void;
5259
+ export(path: string): void;
5260
+ }
5261
+ declare function createProfiler(options?: ProfilerOptions): Profiler;
5262
+
5263
+ /**
5264
+ * Alert system for production monitoring
5265
+ */
5266
+ type AlertSeverity = 'info' | 'warning' | 'error' | 'critical';
5267
+ interface Alert {
5268
+ name: string;
5269
+ severity: AlertSeverity;
5270
+ message: string;
5271
+ timestamp?: number;
5272
+ data?: Record<string, any>;
5273
+ }
5274
+ interface AlertChannel {
5275
+ type: string;
5276
+ config: Record<string, any>;
5277
+ }
5278
+ interface AlertRule {
5279
+ name: string;
5280
+ condition: (metrics: any) => boolean;
5281
+ severity: AlertSeverity;
5282
+ channels: string[];
5283
+ throttle?: number;
5284
+ message?: string;
5285
+ }
5286
+ interface AlertManagerOptions {
5287
+ channels: Record<string, AlertChannel>;
5288
+ rules?: AlertRule[];
5289
+ onAlert?: (alert: Alert) => void;
5290
+ }
5291
+ declare class AlertManager {
5292
+ private options;
5293
+ private lastAlertTime;
5294
+ private monitorTimer?;
5295
+ private running;
5296
+ constructor(options: AlertManagerOptions);
5297
+ start(metrics?: () => any, interval?: number): void;
5298
+ stop(): void;
5299
+ alert(alert: Alert): Promise<void>;
5300
+ private checkRules;
5301
+ private isThrottled;
5302
+ sendToChannel(channelName: string, alert: Alert): Promise<void>;
5303
+ getAlertHistory(name?: string, limit?: number): Alert[];
5304
+ clearAlertHistory(name?: string): void;
5305
+ }
5306
+ declare function createAlertManager(options: AlertManagerOptions): AlertManager;
5307
+
5308
+ /**
5309
+ * Audit logging for compliance and tracking
5310
+ */
5311
+ interface AuditLogEntry {
5312
+ id?: string;
5313
+ userId: string;
5314
+ action: string;
5315
+ resource: string;
5316
+ timestamp?: number;
5317
+ input?: any;
5318
+ output?: any;
5319
+ metadata?: Record<string, any>;
5320
+ success?: boolean;
5321
+ error?: string;
5322
+ }
5323
+ interface AuditLogQuery {
5324
+ userId?: string;
5325
+ action?: string;
5326
+ resource?: string;
5327
+ startDate?: Date;
5328
+ endDate?: Date;
5329
+ limit?: number;
5330
+ offset?: number;
5331
+ }
5332
+ interface AuditLoggerOptions {
5333
+ storage?: {
5334
+ type: 'memory' | 'database' | 'file';
5335
+ config?: Record<string, any>;
5336
+ };
5337
+ retention?: {
5338
+ days: number;
5339
+ autoCleanup?: boolean;
5340
+ };
5341
+ fields?: {
5342
+ userId?: boolean;
5343
+ action?: boolean;
5344
+ resource?: boolean;
5345
+ timestamp?: boolean;
5346
+ ip?: boolean;
5347
+ userAgent?: boolean;
5348
+ input?: boolean;
5349
+ output?: boolean;
5350
+ };
5351
+ onLog?: (entry: AuditLogEntry) => void;
5352
+ }
5353
+ declare class AuditLogger {
5354
+ private options;
5355
+ private logs;
5356
+ private cleanupTimer?;
5357
+ constructor(options?: AuditLoggerOptions);
5358
+ log(entry: AuditLogEntry): Promise<void>;
5359
+ query(query?: AuditLogQuery): Promise<AuditLogEntry[]>;
5360
+ export(path: string, options?: {
5361
+ format?: 'json' | 'csv';
5362
+ startDate?: Date;
5363
+ endDate?: Date;
5364
+ }): Promise<void>;
5365
+ private convertToCSV;
5366
+ private startCleanup;
5367
+ private cleanup;
5368
+ private generateId;
5369
+ stop(): void;
5370
+ }
5371
+ declare function createAuditLogger(options?: AuditLoggerOptions): AuditLogger;
5372
+
5160
5373
  /**
5161
5374
  * Prompt Template Loader
5162
5375
  *
@@ -5264,4 +5477,4 @@ declare function renderTemplate(template: string, options: RenderTemplateOptions
5264
5477
  */
5265
5478
  declare function loadPrompt(promptName: string, options?: RenderTemplateOptions | Record<string, any>, promptsDir?: string): string;
5266
5479
 
5267
- export { AgentError, type AgentResumedEventData, type AgentWaitingEventData, type AggregateNode, type AnyInterrupt, type ApprovalRequiredInterrupt, type BackoffStrategy, type BatchOptions, BatchProcessor, type BatchProcessorOptions, type BatchStats, type CacheKeyGenerator, type CachingOptions, type CheckInterruptOptions, type CheckpointHistoryOptions, type CheckpointerOptions, type ChunkOptions, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerStats, type CircuitState, type ComposeGraphsOptions, type ComposeOptions, type ComposeToolConfig, type ComposedTool, type ConcurrencyOptions, type ConditionalConfig, type ConditionalRouter, type ConditionalRouterConfig, ConnectionPool, type ConnectionPoolOptions, type ConversationConfig, type CustomInterrupt, type DatabaseConfig, type DatabaseConnection, DatabasePool, type DatabasePoolOptions, type DevelopmentPresetOptions, type ErrorContext, type ErrorHandlerOptions, type ErrorReporter, type ErrorReporterOptions, type EventHandler, type EvictionStrategy, type ExecutionMetrics, type HealthCheckConfig, type HealthCheckResult, type HttpClient, type HttpConfig, HttpPool, type HttpPoolConfig, type HttpPoolOptions, type HttpResponse, type HumanInLoopEventData, type HumanInLoopEventType, type HumanRequest, type HumanRequestEventData, type HumanRequestInterrupt, type HumanRequestPriority, type HumanRequestStatus, type HumanResponseEventData, type InterruptData, type InterruptEventData, type InterruptType, type LangSmithConfig, type LogEntry, LogLevel, type Logger, type LoggerOptions, type LoggingOptions, ManagedTool, type ManagedToolConfig, type ManagedToolStats, MemoryManager, type MemoryManagerOptions, type MemoryStats, type MetricEntry, MetricType, type Metrics, type MetricsNodeOptions, type Middleware, MiddlewareChain, type MiddlewareContext, type MiddlewareFactory, type MiddlewareMetadata, type MiddlewareWithMetadata, MissingDescriptionError, type MockToolConfig, type MockToolResponse, type NodeFunction, type NodeFunctionWithContext, type ParallelNode, type ParallelWorkflowConfig, type ParallelWorkflowOptions, type PoolConfig, type PoolStats, type Priority$1 as Priority, type ProductionPresetOptions, type Progress, type ProgressTracker, type ProgressTrackerOptions, type PromptOptions, type RateLimitOptions, type RateLimitStrategy, type ReducerFunction, RegistryEvent, type RenderTemplateOptions, type RequestConfig, type ResumeCommand, type ResumeEventData, type ResumeOptions, type RetryOptions, type RetryPolicy, type RouteCondition, type RouteMap, type RouteName, type SSEEvent, type SSEFormatter, type SSEFormatterOptions, type SequentialNode, type SequentialWorkflowOptions, type SimpleMiddleware, type SqliteCheckpointerOptions, type StateChannelConfig, type SubgraphBuilder, type TestingPresetOptions, type ThreadConfig, type ThreadInfo, type ThreadStatus, type ThrottleOptions, TimeoutError, type TimeoutOptions, type Timer, type Tool, type BackoffStrategy$1 as ToolBackoffStrategy, ToolBuilder, ToolCategory, ToolCategorySchema, type ToolExample, ToolExampleSchema, type ToolExecution, type ToolExecutorConfig, type ToolInvocation, type ToolMetadata, ToolMetadataSchema, ToolNameSchema, ToolRegistry, type ToolRelations, ToolRelationsSchema, type ToolSimulatorConfig, type TracingOptions, type ValidationErrorHandler, type ValidationMode, type ValidationOptions, type ValidatorFunction, type WebSocketHandlerOptions, type WebSocketMessage, batch, broadcast, cache, chain, chunk, clearThread, collect, compose, composeGraphs, composeTool, composeWithOptions, conditional, configureLangSmith, createApprovalRequiredInterrupt, createBatchProcessor, createBinaryRouter, createCircuitBreaker, createConditionalRouter, createConnectionPool, createConversationConfig, createCustomInterrupt, createDatabasePool, createErrorReporter, createHeartbeat, createHttpPool, createHumanRequestInterrupt, createLogger, createManagedTool, createMemoryCheckpointer, createMemoryManager, createMessage, createMetrics, createMiddlewareContext, createMockTool, createMultiRouter, createParallelWorkflow, createProgressTracker, createSSEFormatter, createSequentialWorkflow, createSharedCache, createSharedConcurrencyController, createSharedRateLimiter, createSqliteCheckpointer, createStateAnnotation, createSubgraph, createThreadConfig, createTool, createToolExecutor, createToolSimulator, createToolUnsafe, createWebSocketHandler, development, filter, formatAgentResumedEvent, formatAgentWaitingEvent, formatHumanRequestEvent, formatHumanResponseEvent, formatInterruptEvent, formatResumeEvent, generateThreadId, getCheckpointHistory, getLangSmithConfig, getLatestCheckpoint, getMissingDescriptions, getThreadStatus, getToolDescription, getToolJsonSchema, isApprovalRequiredInterrupt, isCustomInterrupt, isHumanRequestInterrupt, isMemoryCheckpointer, isTracingEnabled, loadPrompt, map, merge, mergeState, parallel, parseSSEEvent, presets, production, reduce, renderTemplate, retry, safeValidateSchemaDescriptions, sanitizeValue, sendMessage, sequential, sequentialBuilder, take, testing, throttle, timeout, toLangChainTool, toLangChainTools, toolBuilder, validateSchemaDescriptions, validateState, validateTool, validateToolMetadata, validateToolName, withCache, withConcurrency, withErrorHandler, withLogging, withMetrics, withRateLimit, withRetry, withTimeout, withTracing, withValidation };
5480
+ export { AgentError, type AgentResumedEventData, type AgentWaitingEventData, type AggregateNode, type Alert, type AlertChannel, AlertManager, type AlertManagerOptions, type AlertRule, type AlertSeverity, type AnyInterrupt, type ApprovalRequiredInterrupt, type AuditLogEntry, type AuditLogQuery, AuditLogger, type AuditLoggerOptions, type BackoffStrategy, type BatchOptions, BatchProcessor, type BatchProcessorOptions, type BatchStats, type CacheKeyGenerator, type CachingOptions, type CheckInterruptOptions, type CheckpointHistoryOptions, type CheckpointerOptions, type ChunkOptions, CircuitBreaker, type CircuitBreakerOptions, type CircuitBreakerStats, type CircuitState, type ComposeGraphsOptions, type ComposeOptions, type ComposeToolConfig, type ComposedTool, type ConcurrencyOptions, type ConditionalConfig, type ConditionalRouter, type ConditionalRouterConfig, ConnectionPool, type ConnectionPoolOptions, type ConversationConfig, type CustomInterrupt, type DatabaseConfig, type DatabaseConnection, DatabasePool, type DatabasePoolOptions, type DevelopmentPresetOptions, type ErrorContext, type ErrorHandlerOptions, type ErrorReporter, type ErrorReporterOptions, type EventHandler, type EvictionStrategy, type ExecutionMetrics, type HealthCheck, type HealthCheckConfig, type HealthCheckResult, HealthChecker, type HealthCheckerOptions, type HealthReport, type HealthStatus, type HttpClient, type HttpConfig, HttpPool, type HttpPoolConfig, type HttpPoolOptions, type HttpResponse, type HumanInLoopEventData, type HumanInLoopEventType, type HumanRequest, type HumanRequestEventData, type HumanRequestInterrupt, type HumanRequestPriority, type HumanRequestStatus, type HumanResponseEventData, type InterruptData, type InterruptEventData, type InterruptType, type LangSmithConfig, type LogEntry, LogLevel, type Logger, type LoggerOptions, type LoggingOptions, ManagedTool, type ManagedToolConfig, type ManagedToolStats, MemoryManager, type MemoryManagerOptions, type MemoryStats, type MetricEntry, MetricType, type Metrics, type MetricsNodeOptions, type Middleware, MiddlewareChain, type MiddlewareContext, type MiddlewareFactory, type MiddlewareMetadata, type MiddlewareWithMetadata, MissingDescriptionError, type MockToolConfig, type MockToolResponse, type NodeFunction, type NodeFunctionWithContext, type ParallelNode, type ParallelWorkflowConfig, type ParallelWorkflowOptions, type PoolConfig, type PoolStats, type Priority$1 as Priority, type ProductionPresetOptions, type ProfileReport, type ProfileSample, type ProfileStats, Profiler, type ProfilerOptions, type Progress, type ProgressTracker, type ProgressTrackerOptions, type PromptOptions, type RateLimitOptions, type RateLimitStrategy, type ReducerFunction, RegistryEvent, type RenderTemplateOptions, type RequestConfig, type ResumeCommand, type ResumeEventData, type ResumeOptions, type RetryOptions, type RetryPolicy, type RouteCondition, type RouteMap, type RouteName, type SSEEvent, type SSEFormatter, type SSEFormatterOptions, type SequentialNode, type SequentialWorkflowOptions, type SimpleMiddleware, type SqliteCheckpointerOptions, type StateChannelConfig, type SubgraphBuilder, type TestingPresetOptions, type ThreadConfig, type ThreadInfo, type ThreadStatus, type ThrottleOptions, TimeoutError, type TimeoutOptions, type Timer, type Tool, type BackoffStrategy$1 as ToolBackoffStrategy, ToolBuilder, ToolCategory, ToolCategorySchema, type ToolExample, ToolExampleSchema, type ToolExecution, type ToolExecutorConfig, type ToolHealthCheckResult, type ToolInvocation, type ToolMetadata, ToolMetadataSchema, ToolNameSchema, ToolRegistry, type ToolRelations, ToolRelationsSchema, type ToolSimulatorConfig, type TracingOptions, type ValidationErrorHandler, type ValidationMode, type ValidationOptions, type ValidatorFunction, type WebSocketHandlerOptions, type WebSocketMessage, batch, broadcast, cache, chain, chunk, clearThread, collect, compose, composeGraphs, composeTool, composeWithOptions, conditional, configureLangSmith, createAlertManager, createApprovalRequiredInterrupt, createAuditLogger, createBatchProcessor, createBinaryRouter, createCircuitBreaker, createConditionalRouter, createConnectionPool, createConversationConfig, createCustomInterrupt, createDatabasePool, createErrorReporter, createHealthChecker, createHeartbeat, createHttpPool, createHumanRequestInterrupt, createLogger, createManagedTool, createMemoryCheckpointer, createMemoryManager, createMessage, createMetrics, createMiddlewareContext, createMockTool, createMultiRouter, createParallelWorkflow, createProfiler, createProgressTracker, createSSEFormatter, createSequentialWorkflow, createSharedCache, createSharedConcurrencyController, createSharedRateLimiter, createSqliteCheckpointer, createStateAnnotation, createSubgraph, createThreadConfig, createTool, createToolExecutor, createToolSimulator, createToolUnsafe, createWebSocketHandler, development, filter, formatAgentResumedEvent, formatAgentWaitingEvent, formatHumanRequestEvent, formatHumanResponseEvent, formatInterruptEvent, formatResumeEvent, generateThreadId, getCheckpointHistory, getLangSmithConfig, getLatestCheckpoint, getMissingDescriptions, getThreadStatus, getToolDescription, getToolJsonSchema, isApprovalRequiredInterrupt, isCustomInterrupt, isHumanRequestInterrupt, isMemoryCheckpointer, isTracingEnabled, loadPrompt, map, merge, mergeState, parallel, parseSSEEvent, presets, production, reduce, renderTemplate, retry, safeValidateSchemaDescriptions, sanitizeValue, sendMessage, sequential, sequentialBuilder, take, testing, throttle, timeout, toLangChainTool, toLangChainTools, toolBuilder, validateSchemaDescriptions, validateState, validateTool, validateToolMetadata, validateToolName, withCache, withConcurrency, withErrorHandler, withLogging, withMetrics, withRateLimit, withRetry, withTimeout, withTracing, withValidation };