@agentforge/core 0.16.90 → 0.17.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.cjs CHANGED
@@ -2522,17 +2522,19 @@ function withMetrics(node, options) {
2522
2522
  trackDuration = true,
2523
2523
  trackErrors = true,
2524
2524
  trackInvocations = true,
2525
- metrics = createMetrics(name)
2525
+ metrics: providedMetrics
2526
2526
  } = options;
2527
+ const metrics = providedMetrics ?? createMetrics(name);
2528
+ const metricSuffix = (suffix) => providedMetrics ? `${name}.${suffix}` : suffix;
2527
2529
  return async (state) => {
2528
- if (trackInvocations) metrics.increment(`${name}.invocations`);
2529
- const timer = trackDuration ? metrics.startTimer(`${name}.duration`) : null;
2530
+ if (trackInvocations) metrics.increment(metricSuffix("invocations"));
2531
+ const timer = trackDuration ? metrics.startTimer(metricSuffix("duration")) : null;
2530
2532
  try {
2531
2533
  const result = await Promise.resolve(node(state));
2532
- metrics.increment(`${name}.success`);
2534
+ metrics.increment(metricSuffix("success"));
2533
2535
  return result;
2534
2536
  } catch (error) {
2535
- if (trackErrors) metrics.increment(`${name}.errors`);
2537
+ if (trackErrors) metrics.increment(metricSuffix("errors"));
2536
2538
  throw error;
2537
2539
  } finally {
2538
2540
  timer?.end();
package/dist/index.js CHANGED
@@ -2346,17 +2346,19 @@ function withMetrics(node, options) {
2346
2346
  trackDuration = true,
2347
2347
  trackErrors = true,
2348
2348
  trackInvocations = true,
2349
- metrics = createMetrics(name)
2349
+ metrics: providedMetrics
2350
2350
  } = options;
2351
+ const metrics = providedMetrics ?? createMetrics(name);
2352
+ const metricSuffix = (suffix) => providedMetrics ? `${name}.${suffix}` : suffix;
2351
2353
  return async (state) => {
2352
- if (trackInvocations) metrics.increment(`${name}.invocations`);
2353
- const timer = trackDuration ? metrics.startTimer(`${name}.duration`) : null;
2354
+ if (trackInvocations) metrics.increment(metricSuffix("invocations"));
2355
+ const timer = trackDuration ? metrics.startTimer(metricSuffix("duration")) : null;
2354
2356
  try {
2355
2357
  const result = await Promise.resolve(node(state));
2356
- metrics.increment(`${name}.success`);
2358
+ metrics.increment(metricSuffix("success"));
2357
2359
  return result;
2358
2360
  } catch (error) {
2359
- if (trackErrors) metrics.increment(`${name}.errors`);
2361
+ if (trackErrors) metrics.increment(metricSuffix("errors"));
2360
2362
  throw error;
2361
2363
  } finally {
2362
2364
  timer?.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/core",
3
- "version": "0.16.90",
3
+ "version": "0.17.0",
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",