@agentforge/core 0.16.2 → 0.16.4

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.cjs CHANGED
@@ -2803,14 +2803,14 @@ var withLogging = (options) => {
2803
2803
  onComplete,
2804
2804
  onError
2805
2805
  } = options;
2806
- const logger5 = providedLogger || createLogger(name, { level });
2806
+ const logger6 = providedLogger || createLogger(name, { level });
2807
2807
  return (node) => {
2808
2808
  return async (state) => {
2809
2809
  const startTime = Date.now();
2810
2810
  try {
2811
2811
  if (logInput) {
2812
2812
  const data = extractData ? extractData(state) : { state };
2813
- logger5.info("Node execution started", data);
2813
+ logger6.info("Node execution started", data);
2814
2814
  }
2815
2815
  if (onStart) {
2816
2816
  onStart(state);
@@ -2820,9 +2820,9 @@ var withLogging = (options) => {
2820
2820
  if (logOutput) {
2821
2821
  const data = extractData ? extractData(result) : { result };
2822
2822
  if (logDuration) {
2823
- logger5.info(`Node execution completed (${duration}ms)`, data);
2823
+ logger6.info(`Node execution completed (${duration}ms)`, data);
2824
2824
  } else {
2825
- logger5.info("Node execution completed", data);
2825
+ logger6.info("Node execution completed", data);
2826
2826
  }
2827
2827
  }
2828
2828
  if (onComplete) {
@@ -2833,7 +2833,7 @@ var withLogging = (options) => {
2833
2833
  const duration = Date.now() - startTime;
2834
2834
  const err = error instanceof Error ? error : new Error(String(error));
2835
2835
  if (logErrors) {
2836
- logger5.error(`Node execution failed (${duration}ms)`, {
2836
+ logger6.error(`Node execution failed (${duration}ms)`, {
2837
2837
  error: err.message,
2838
2838
  ...err.stack ? { stack: err.stack } : {}
2839
2839
  });
@@ -2869,7 +2869,7 @@ function withLogging2(options) {
2869
2869
  function production(node, options) {
2870
2870
  const {
2871
2871
  nodeName,
2872
- logger: logger5,
2872
+ logger: logger6,
2873
2873
  enableMetrics = true,
2874
2874
  enableTracing = true,
2875
2875
  enableRetry = true,
@@ -2877,7 +2877,7 @@ function production(node, options) {
2877
2877
  retryOptions = {},
2878
2878
  errorOptions = {}
2879
2879
  } = options;
2880
- const actualLogger = logger5 || createLogger(nodeName, { level: "info" /* INFO */ });
2880
+ const actualLogger = logger6 || createLogger(nodeName, { level: "info" /* INFO */ });
2881
2881
  const middleware = [];
2882
2882
  middleware.push(
2883
2883
  withLogging2({
@@ -2941,9 +2941,9 @@ function development(node, options) {
2941
2941
  const {
2942
2942
  nodeName,
2943
2943
  verbose = true,
2944
- logger: logger5
2944
+ logger: logger6
2945
2945
  } = options;
2946
- const actualLogger = logger5 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2946
+ const actualLogger = logger6 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2947
2947
  return withLogging2({
2948
2948
  logger: actualLogger,
2949
2949
  name: nodeName,
@@ -5056,6 +5056,7 @@ function createCircuitBreaker(options) {
5056
5056
  }
5057
5057
 
5058
5058
  // src/monitoring/health.ts
5059
+ var logger4 = createLogger("agentforge:core:monitoring:health", { level: "info" /* INFO */ });
5059
5060
  var HealthChecker = class {
5060
5061
  constructor(options) {
5061
5062
  this.options = options;
@@ -5071,11 +5072,17 @@ var HealthChecker = class {
5071
5072
  this.running = true;
5072
5073
  const interval = this.options.interval || 3e4;
5073
5074
  this.runChecks().catch((error) => {
5074
- console.error("Initial health check failed:", error);
5075
+ logger4.error("Initial health check failed", {
5076
+ error: error instanceof Error ? error.message : String(error),
5077
+ ...error instanceof Error && error.stack ? { stack: error.stack } : {}
5078
+ });
5075
5079
  });
5076
5080
  this.checkTimer = setInterval(() => {
5077
5081
  this.runChecks().catch((error) => {
5078
- console.error("Health check failed:", error);
5082
+ logger4.error("Health check failed", {
5083
+ error: error instanceof Error ? error.message : String(error),
5084
+ ...error instanceof Error && error.stack ? { stack: error.stack } : {}
5085
+ });
5079
5086
  });
5080
5087
  }, interval);
5081
5088
  }
@@ -5282,7 +5289,7 @@ function createProfiler(options) {
5282
5289
  }
5283
5290
 
5284
5291
  // src/monitoring/alerts.ts
5285
- var logger4 = createLogger("agentforge:core:monitoring:alerts", { level: "info" /* INFO */ });
5292
+ var logger5 = createLogger("agentforge:core:monitoring:alerts", { level: "info" /* INFO */ });
5286
5293
  function toAlertSummary(alert) {
5287
5294
  return {
5288
5295
  name: alert.name,
@@ -5334,7 +5341,7 @@ var AlertManager = class {
5334
5341
  const currentMetrics = metrics();
5335
5342
  this.checkRules(currentMetrics);
5336
5343
  } catch (error) {
5337
- logger4.error("Metrics collection failed", toMetricsProviderErrorPayload(error));
5344
+ logger5.error("Metrics collection failed", toMetricsProviderErrorPayload(error));
5338
5345
  }
5339
5346
  }, interval);
5340
5347
  }
@@ -5360,9 +5367,9 @@ var AlertManager = class {
5360
5367
  try {
5361
5368
  await this.options.onAlert?.(fullAlert);
5362
5369
  } catch (error) {
5363
- logger4.error("Alert callback failed", toAlertCallbackErrorPayload(error));
5370
+ logger5.error("Alert callback failed", toAlertCallbackErrorPayload(error));
5364
5371
  }
5365
- logger4.warn("Alert triggered", {
5372
+ logger5.warn("Alert triggered", {
5366
5373
  name: alert.name,
5367
5374
  severity: alert.severity,
5368
5375
  message: alert.message,
@@ -5382,11 +5389,11 @@ var AlertManager = class {
5382
5389
  message: rule.message || `Alert triggered: ${rule.name}`,
5383
5390
  data: { metrics }
5384
5391
  }).catch((error) => {
5385
- logger4.error("Alert dispatch failed", toAlertDispatchErrorPayload(rule.name, error));
5392
+ logger5.error("Alert dispatch failed", toAlertDispatchErrorPayload(rule.name, error));
5386
5393
  });
5387
5394
  }
5388
5395
  } catch (error) {
5389
- logger4.error("Rule check failed", toRuleErrorPayload(rule.name, error));
5396
+ logger5.error("Rule check failed", toRuleErrorPayload(rule.name, error));
5390
5397
  }
5391
5398
  }
5392
5399
  }
@@ -5408,28 +5415,28 @@ var AlertManager = class {
5408
5415
  }
5409
5416
  switch (channel.type) {
5410
5417
  case "email":
5411
- logger4.info("Alert sent to email", {
5418
+ logger5.info("Alert sent to email", {
5412
5419
  channel: channelName,
5413
5420
  to: channel.config.to,
5414
5421
  alert: toAlertSummary(alert)
5415
5422
  });
5416
5423
  break;
5417
5424
  case "slack":
5418
- logger4.info("Alert sent to Slack", {
5425
+ logger5.info("Alert sent to Slack", {
5419
5426
  channel: channelName,
5420
5427
  webhookUrl: channel.config.webhookUrl,
5421
5428
  alert: toAlertSummary(alert)
5422
5429
  });
5423
5430
  break;
5424
5431
  case "webhook":
5425
- logger4.info("Alert sent to webhook", {
5432
+ logger5.info("Alert sent to webhook", {
5426
5433
  channel: channelName,
5427
5434
  url: channel.config.url,
5428
5435
  alert: toAlertSummary(alert)
5429
5436
  });
5430
5437
  break;
5431
5438
  default:
5432
- logger4.info("Alert sent", {
5439
+ logger5.info("Alert sent", {
5433
5440
  channel: channelName,
5434
5441
  channelType: channel.type,
5435
5442
  alert: toAlertSummary(alert)
@@ -5465,7 +5472,7 @@ var AuditLogger = class {
5465
5472
  const fullEntry = {
5466
5473
  ...entry,
5467
5474
  id: this.generateId(),
5468
- timestamp: entry.timestamp || Date.now(),
5475
+ timestamp: entry.timestamp ?? Date.now(),
5469
5476
  success: entry.success ?? true
5470
5477
  };
5471
5478
  const fields = this.options.fields || {};
@@ -5476,10 +5483,10 @@ var AuditLogger = class {
5476
5483
  resource: fields.resource !== false ? fullEntry.resource : "",
5477
5484
  timestamp: fields.timestamp !== false ? fullEntry.timestamp : void 0
5478
5485
  };
5479
- if (fields.input !== false && fullEntry.input) {
5486
+ if (fields.input !== false && fullEntry.input !== void 0) {
5480
5487
  filteredEntry.input = fullEntry.input;
5481
5488
  }
5482
- if (fields.output !== false && fullEntry.output) {
5489
+ if (fields.output !== false && fullEntry.output !== void 0) {
5483
5490
  filteredEntry.output = fullEntry.output;
5484
5491
  }
5485
5492
  if (fullEntry.metadata) {
package/dist/index.d.cts CHANGED
@@ -5241,6 +5241,7 @@ declare function createCircuitBreaker(options: CircuitBreakerOptions): CircuitBr
5241
5241
  /**
5242
5242
  * Health check system for production monitoring
5243
5243
  */
5244
+
5244
5245
  type HealthStatus = 'healthy' | 'unhealthy' | 'degraded';
5245
5246
  interface HealthCheckResult {
5246
5247
  healthy: boolean;
@@ -5249,7 +5250,7 @@ interface HealthCheckResult {
5249
5250
  error?: string;
5250
5251
  timestamp?: number;
5251
5252
  duration?: number;
5252
- metadata?: Record<string, any>;
5253
+ metadata?: JsonObject;
5253
5254
  }
5254
5255
  interface HealthCheck {
5255
5256
  (): Promise<HealthCheckResult>;
@@ -5422,15 +5423,16 @@ declare function createAlertManager<TMetrics extends JsonObject = JsonObject, TC
5422
5423
  /**
5423
5424
  * Audit logging for compliance and tracking
5424
5425
  */
5426
+
5425
5427
  interface AuditLogEntry {
5426
5428
  id?: string;
5427
5429
  userId: string;
5428
5430
  action: string;
5429
5431
  resource: string;
5430
5432
  timestamp?: number;
5431
- input?: any;
5432
- output?: any;
5433
- metadata?: Record<string, any>;
5433
+ input?: JsonValue;
5434
+ output?: JsonValue;
5435
+ metadata?: JsonObject;
5434
5436
  success?: boolean;
5435
5437
  error?: string;
5436
5438
  }
@@ -5446,7 +5448,7 @@ interface AuditLogQuery {
5446
5448
  interface AuditLoggerOptions {
5447
5449
  storage?: {
5448
5450
  type: 'memory' | 'database' | 'file';
5449
- config?: Record<string, any>;
5451
+ config?: JsonObject;
5450
5452
  };
5451
5453
  retention?: {
5452
5454
  days: number;
package/dist/index.d.ts CHANGED
@@ -5241,6 +5241,7 @@ declare function createCircuitBreaker(options: CircuitBreakerOptions): CircuitBr
5241
5241
  /**
5242
5242
  * Health check system for production monitoring
5243
5243
  */
5244
+
5244
5245
  type HealthStatus = 'healthy' | 'unhealthy' | 'degraded';
5245
5246
  interface HealthCheckResult {
5246
5247
  healthy: boolean;
@@ -5249,7 +5250,7 @@ interface HealthCheckResult {
5249
5250
  error?: string;
5250
5251
  timestamp?: number;
5251
5252
  duration?: number;
5252
- metadata?: Record<string, any>;
5253
+ metadata?: JsonObject;
5253
5254
  }
5254
5255
  interface HealthCheck {
5255
5256
  (): Promise<HealthCheckResult>;
@@ -5422,15 +5423,16 @@ declare function createAlertManager<TMetrics extends JsonObject = JsonObject, TC
5422
5423
  /**
5423
5424
  * Audit logging for compliance and tracking
5424
5425
  */
5426
+
5425
5427
  interface AuditLogEntry {
5426
5428
  id?: string;
5427
5429
  userId: string;
5428
5430
  action: string;
5429
5431
  resource: string;
5430
5432
  timestamp?: number;
5431
- input?: any;
5432
- output?: any;
5433
- metadata?: Record<string, any>;
5433
+ input?: JsonValue;
5434
+ output?: JsonValue;
5435
+ metadata?: JsonObject;
5434
5436
  success?: boolean;
5435
5437
  error?: string;
5436
5438
  }
@@ -5446,7 +5448,7 @@ interface AuditLogQuery {
5446
5448
  interface AuditLoggerOptions {
5447
5449
  storage?: {
5448
5450
  type: 'memory' | 'database' | 'file';
5449
- config?: Record<string, any>;
5451
+ config?: JsonObject;
5450
5452
  };
5451
5453
  retention?: {
5452
5454
  days: number;
package/dist/index.js CHANGED
@@ -2628,14 +2628,14 @@ var withLogging = (options) => {
2628
2628
  onComplete,
2629
2629
  onError
2630
2630
  } = options;
2631
- const logger5 = providedLogger || createLogger(name, { level });
2631
+ const logger6 = providedLogger || createLogger(name, { level });
2632
2632
  return (node) => {
2633
2633
  return async (state) => {
2634
2634
  const startTime = Date.now();
2635
2635
  try {
2636
2636
  if (logInput) {
2637
2637
  const data = extractData ? extractData(state) : { state };
2638
- logger5.info("Node execution started", data);
2638
+ logger6.info("Node execution started", data);
2639
2639
  }
2640
2640
  if (onStart) {
2641
2641
  onStart(state);
@@ -2645,9 +2645,9 @@ var withLogging = (options) => {
2645
2645
  if (logOutput) {
2646
2646
  const data = extractData ? extractData(result) : { result };
2647
2647
  if (logDuration) {
2648
- logger5.info(`Node execution completed (${duration}ms)`, data);
2648
+ logger6.info(`Node execution completed (${duration}ms)`, data);
2649
2649
  } else {
2650
- logger5.info("Node execution completed", data);
2650
+ logger6.info("Node execution completed", data);
2651
2651
  }
2652
2652
  }
2653
2653
  if (onComplete) {
@@ -2658,7 +2658,7 @@ var withLogging = (options) => {
2658
2658
  const duration = Date.now() - startTime;
2659
2659
  const err = error instanceof Error ? error : new Error(String(error));
2660
2660
  if (logErrors) {
2661
- logger5.error(`Node execution failed (${duration}ms)`, {
2661
+ logger6.error(`Node execution failed (${duration}ms)`, {
2662
2662
  error: err.message,
2663
2663
  ...err.stack ? { stack: err.stack } : {}
2664
2664
  });
@@ -2694,7 +2694,7 @@ function withLogging2(options) {
2694
2694
  function production(node, options) {
2695
2695
  const {
2696
2696
  nodeName,
2697
- logger: logger5,
2697
+ logger: logger6,
2698
2698
  enableMetrics = true,
2699
2699
  enableTracing = true,
2700
2700
  enableRetry = true,
@@ -2702,7 +2702,7 @@ function production(node, options) {
2702
2702
  retryOptions = {},
2703
2703
  errorOptions = {}
2704
2704
  } = options;
2705
- const actualLogger = logger5 || createLogger(nodeName, { level: "info" /* INFO */ });
2705
+ const actualLogger = logger6 || createLogger(nodeName, { level: "info" /* INFO */ });
2706
2706
  const middleware = [];
2707
2707
  middleware.push(
2708
2708
  withLogging2({
@@ -2766,9 +2766,9 @@ function development(node, options) {
2766
2766
  const {
2767
2767
  nodeName,
2768
2768
  verbose = true,
2769
- logger: logger5
2769
+ logger: logger6
2770
2770
  } = options;
2771
- const actualLogger = logger5 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2771
+ const actualLogger = logger6 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2772
2772
  return withLogging2({
2773
2773
  logger: actualLogger,
2774
2774
  name: nodeName,
@@ -4881,6 +4881,7 @@ function createCircuitBreaker(options) {
4881
4881
  }
4882
4882
 
4883
4883
  // src/monitoring/health.ts
4884
+ var logger4 = createLogger("agentforge:core:monitoring:health", { level: "info" /* INFO */ });
4884
4885
  var HealthChecker = class {
4885
4886
  constructor(options) {
4886
4887
  this.options = options;
@@ -4896,11 +4897,17 @@ var HealthChecker = class {
4896
4897
  this.running = true;
4897
4898
  const interval = this.options.interval || 3e4;
4898
4899
  this.runChecks().catch((error) => {
4899
- console.error("Initial health check failed:", error);
4900
+ logger4.error("Initial health check failed", {
4901
+ error: error instanceof Error ? error.message : String(error),
4902
+ ...error instanceof Error && error.stack ? { stack: error.stack } : {}
4903
+ });
4900
4904
  });
4901
4905
  this.checkTimer = setInterval(() => {
4902
4906
  this.runChecks().catch((error) => {
4903
- console.error("Health check failed:", error);
4907
+ logger4.error("Health check failed", {
4908
+ error: error instanceof Error ? error.message : String(error),
4909
+ ...error instanceof Error && error.stack ? { stack: error.stack } : {}
4910
+ });
4904
4911
  });
4905
4912
  }, interval);
4906
4913
  }
@@ -5107,7 +5114,7 @@ function createProfiler(options) {
5107
5114
  }
5108
5115
 
5109
5116
  // src/monitoring/alerts.ts
5110
- var logger4 = createLogger("agentforge:core:monitoring:alerts", { level: "info" /* INFO */ });
5117
+ var logger5 = createLogger("agentforge:core:monitoring:alerts", { level: "info" /* INFO */ });
5111
5118
  function toAlertSummary(alert) {
5112
5119
  return {
5113
5120
  name: alert.name,
@@ -5159,7 +5166,7 @@ var AlertManager = class {
5159
5166
  const currentMetrics = metrics();
5160
5167
  this.checkRules(currentMetrics);
5161
5168
  } catch (error) {
5162
- logger4.error("Metrics collection failed", toMetricsProviderErrorPayload(error));
5169
+ logger5.error("Metrics collection failed", toMetricsProviderErrorPayload(error));
5163
5170
  }
5164
5171
  }, interval);
5165
5172
  }
@@ -5185,9 +5192,9 @@ var AlertManager = class {
5185
5192
  try {
5186
5193
  await this.options.onAlert?.(fullAlert);
5187
5194
  } catch (error) {
5188
- logger4.error("Alert callback failed", toAlertCallbackErrorPayload(error));
5195
+ logger5.error("Alert callback failed", toAlertCallbackErrorPayload(error));
5189
5196
  }
5190
- logger4.warn("Alert triggered", {
5197
+ logger5.warn("Alert triggered", {
5191
5198
  name: alert.name,
5192
5199
  severity: alert.severity,
5193
5200
  message: alert.message,
@@ -5207,11 +5214,11 @@ var AlertManager = class {
5207
5214
  message: rule.message || `Alert triggered: ${rule.name}`,
5208
5215
  data: { metrics }
5209
5216
  }).catch((error) => {
5210
- logger4.error("Alert dispatch failed", toAlertDispatchErrorPayload(rule.name, error));
5217
+ logger5.error("Alert dispatch failed", toAlertDispatchErrorPayload(rule.name, error));
5211
5218
  });
5212
5219
  }
5213
5220
  } catch (error) {
5214
- logger4.error("Rule check failed", toRuleErrorPayload(rule.name, error));
5221
+ logger5.error("Rule check failed", toRuleErrorPayload(rule.name, error));
5215
5222
  }
5216
5223
  }
5217
5224
  }
@@ -5233,28 +5240,28 @@ var AlertManager = class {
5233
5240
  }
5234
5241
  switch (channel.type) {
5235
5242
  case "email":
5236
- logger4.info("Alert sent to email", {
5243
+ logger5.info("Alert sent to email", {
5237
5244
  channel: channelName,
5238
5245
  to: channel.config.to,
5239
5246
  alert: toAlertSummary(alert)
5240
5247
  });
5241
5248
  break;
5242
5249
  case "slack":
5243
- logger4.info("Alert sent to Slack", {
5250
+ logger5.info("Alert sent to Slack", {
5244
5251
  channel: channelName,
5245
5252
  webhookUrl: channel.config.webhookUrl,
5246
5253
  alert: toAlertSummary(alert)
5247
5254
  });
5248
5255
  break;
5249
5256
  case "webhook":
5250
- logger4.info("Alert sent to webhook", {
5257
+ logger5.info("Alert sent to webhook", {
5251
5258
  channel: channelName,
5252
5259
  url: channel.config.url,
5253
5260
  alert: toAlertSummary(alert)
5254
5261
  });
5255
5262
  break;
5256
5263
  default:
5257
- logger4.info("Alert sent", {
5264
+ logger5.info("Alert sent", {
5258
5265
  channel: channelName,
5259
5266
  channelType: channel.type,
5260
5267
  alert: toAlertSummary(alert)
@@ -5290,7 +5297,7 @@ var AuditLogger = class {
5290
5297
  const fullEntry = {
5291
5298
  ...entry,
5292
5299
  id: this.generateId(),
5293
- timestamp: entry.timestamp || Date.now(),
5300
+ timestamp: entry.timestamp ?? Date.now(),
5294
5301
  success: entry.success ?? true
5295
5302
  };
5296
5303
  const fields = this.options.fields || {};
@@ -5301,10 +5308,10 @@ var AuditLogger = class {
5301
5308
  resource: fields.resource !== false ? fullEntry.resource : "",
5302
5309
  timestamp: fields.timestamp !== false ? fullEntry.timestamp : void 0
5303
5310
  };
5304
- if (fields.input !== false && fullEntry.input) {
5311
+ if (fields.input !== false && fullEntry.input !== void 0) {
5305
5312
  filteredEntry.input = fullEntry.input;
5306
5313
  }
5307
- if (fields.output !== false && fullEntry.output) {
5314
+ if (fields.output !== false && fullEntry.output !== void 0) {
5308
5315
  filteredEntry.output = fullEntry.output;
5309
5316
  }
5310
5317
  if (fullEntry.metadata) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/core",
3
- "version": "0.16.2",
3
+ "version": "0.16.4",
4
4
  "description": "Production-ready TypeScript agent framework built on LangGraph with orchestration, middleware, and typed abstractions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",