@agentforge/core 0.11.0 → 0.11.2

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/README.md CHANGED
@@ -151,6 +151,13 @@ pnpm test
151
151
  pnpm typecheck
152
152
  ```
153
153
 
154
+ ## 🔗 Links
155
+
156
+ - [GitHub Repository](https://github.com/TVScoundrel/agentforge)
157
+ - [npm Package](https://www.npmjs.com/package/@agentforge/core)
158
+ - [Changelog](https://tvscoundrel.github.io/agentforge/changelog.html) - See what's new before upgrading
159
+ - [Report Issues](https://github.com/TVScoundrel/agentforge/issues)
160
+
154
161
  ## License
155
162
 
156
163
  MIT © 2026 Tom Van Schoor
package/dist/index.cjs CHANGED
@@ -1122,6 +1122,21 @@ var ToolRegistry = class {
1122
1122
  * ```
1123
1123
  */
1124
1124
  registerMany(tools) {
1125
+ const inputNames = /* @__PURE__ */ new Set();
1126
+ const duplicatesInInput = [];
1127
+ for (const tool of tools) {
1128
+ const name = tool.metadata.name;
1129
+ if (inputNames.has(name)) {
1130
+ duplicatesInInput.push(name);
1131
+ } else {
1132
+ inputNames.add(name);
1133
+ }
1134
+ }
1135
+ if (duplicatesInInput.length > 0) {
1136
+ throw new Error(
1137
+ `Cannot register tools: duplicate names in input list: ${duplicatesInInput.join(", ")}`
1138
+ );
1139
+ }
1125
1140
  const conflicts = [];
1126
1141
  for (const tool of tools) {
1127
1142
  if (this.tools.has(tool.metadata.name)) {
@@ -1465,6 +1480,7 @@ var ToolRegistry = class {
1465
1480
  };
1466
1481
 
1467
1482
  // src/tools/executor.ts
1483
+ var logger2 = createLogger("agentforge:tools:executor");
1468
1484
  var PRIORITY_ORDER = {
1469
1485
  critical: 0,
1470
1486
  high: 1,
@@ -1511,7 +1527,14 @@ function createToolExecutor(config = {}) {
1511
1527
  async function executeWithRetry(tool, input, policy) {
1512
1528
  const executeFn = tool.invoke || tool.execute;
1513
1529
  if (!executeFn) {
1514
- throw new Error("Tool must implement either invoke() or execute() method");
1530
+ throw new Error(
1531
+ "Tool must implement invoke() method. Tools created with createTool() or toolBuilder automatically have this method. If you are manually constructing a tool, ensure it has an invoke() method."
1532
+ );
1533
+ }
1534
+ if (!tool.invoke && tool.execute) {
1535
+ logger2.warn(
1536
+ `Tool "${tool.metadata?.name || "unknown"}" only implements execute() which is deprecated. Please update to implement invoke() as the primary method. execute() will be removed in v1.0.0.`
1537
+ );
1515
1538
  }
1516
1539
  if (!policy) {
1517
1540
  return await executeFn.call(tool, input);
@@ -1635,7 +1658,7 @@ function createToolExecutor(config = {}) {
1635
1658
  }
1636
1659
 
1637
1660
  // src/tools/lifecycle.ts
1638
- var logger2 = createLogger("agentforge:core:tools:lifecycle", { level: "info" /* INFO */ });
1661
+ var logger3 = createLogger("agentforge:core:tools:lifecycle", { level: "info" /* INFO */ });
1639
1662
  var ManagedTool = class {
1640
1663
  name;
1641
1664
  description;
@@ -1667,7 +1690,7 @@ var ManagedTool = class {
1667
1690
  if (this.autoCleanup) {
1668
1691
  process.on("beforeExit", () => {
1669
1692
  this.cleanup().catch(
1670
- (err) => logger2.error("Cleanup failed", {
1693
+ (err) => logger3.error("Cleanup failed", {
1671
1694
  toolName: this.name,
1672
1695
  error: err instanceof Error ? err.message : String(err),
1673
1696
  stack: err instanceof Error ? err.stack : void 0
@@ -2636,14 +2659,14 @@ var withLogging = (options) => {
2636
2659
  onComplete,
2637
2660
  onError
2638
2661
  } = options;
2639
- const logger3 = providedLogger || createLogger(name, { level });
2662
+ const logger4 = providedLogger || createLogger(name, { level });
2640
2663
  return (node) => {
2641
2664
  return async (state) => {
2642
2665
  const startTime = Date.now();
2643
2666
  try {
2644
2667
  if (logInput) {
2645
2668
  const data = extractData ? extractData(state) : { state };
2646
- logger3.info("Node execution started", data);
2669
+ logger4.info("Node execution started", data);
2647
2670
  }
2648
2671
  if (onStart) {
2649
2672
  onStart(state);
@@ -2653,9 +2676,9 @@ var withLogging = (options) => {
2653
2676
  if (logOutput) {
2654
2677
  const data = extractData ? extractData(result) : { result };
2655
2678
  if (logDuration) {
2656
- logger3.info(`Node execution completed (${duration}ms)`, data);
2679
+ logger4.info(`Node execution completed (${duration}ms)`, data);
2657
2680
  } else {
2658
- logger3.info("Node execution completed", data);
2681
+ logger4.info("Node execution completed", data);
2659
2682
  }
2660
2683
  }
2661
2684
  if (onComplete) {
@@ -2666,7 +2689,7 @@ var withLogging = (options) => {
2666
2689
  const duration = Date.now() - startTime;
2667
2690
  const err = error instanceof Error ? error : new Error(String(error));
2668
2691
  if (logErrors) {
2669
- logger3.error(`Node execution failed (${duration}ms)`, {
2692
+ logger4.error(`Node execution failed (${duration}ms)`, {
2670
2693
  error: err.message,
2671
2694
  stack: err.stack
2672
2695
  });
@@ -2702,7 +2725,7 @@ function withLogging2(options) {
2702
2725
  function production(node, options) {
2703
2726
  const {
2704
2727
  nodeName,
2705
- logger: logger3,
2728
+ logger: logger4,
2706
2729
  enableMetrics = true,
2707
2730
  enableTracing = true,
2708
2731
  enableRetry = true,
@@ -2710,7 +2733,7 @@ function production(node, options) {
2710
2733
  retryOptions = {},
2711
2734
  errorOptions = {}
2712
2735
  } = options;
2713
- const actualLogger = logger3 || createLogger(nodeName, { level: "info" /* INFO */ });
2736
+ const actualLogger = logger4 || createLogger(nodeName, { level: "info" /* INFO */ });
2714
2737
  const middleware = [];
2715
2738
  middleware.push(
2716
2739
  withLogging2({
@@ -2774,9 +2797,9 @@ function development(node, options) {
2774
2797
  const {
2775
2798
  nodeName,
2776
2799
  verbose = true,
2777
- logger: logger3
2800
+ logger: logger4
2778
2801
  } = options;
2779
- const actualLogger = logger3 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2802
+ const actualLogger = logger4 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2780
2803
  return withLogging2({
2781
2804
  logger: actualLogger,
2782
2805
  name: nodeName,
package/dist/index.js CHANGED
@@ -966,6 +966,21 @@ var ToolRegistry = class {
966
966
  * ```
967
967
  */
968
968
  registerMany(tools) {
969
+ const inputNames = /* @__PURE__ */ new Set();
970
+ const duplicatesInInput = [];
971
+ for (const tool of tools) {
972
+ const name = tool.metadata.name;
973
+ if (inputNames.has(name)) {
974
+ duplicatesInInput.push(name);
975
+ } else {
976
+ inputNames.add(name);
977
+ }
978
+ }
979
+ if (duplicatesInInput.length > 0) {
980
+ throw new Error(
981
+ `Cannot register tools: duplicate names in input list: ${duplicatesInInput.join(", ")}`
982
+ );
983
+ }
969
984
  const conflicts = [];
970
985
  for (const tool of tools) {
971
986
  if (this.tools.has(tool.metadata.name)) {
@@ -1309,6 +1324,7 @@ var ToolRegistry = class {
1309
1324
  };
1310
1325
 
1311
1326
  // src/tools/executor.ts
1327
+ var logger2 = createLogger("agentforge:tools:executor");
1312
1328
  var PRIORITY_ORDER = {
1313
1329
  critical: 0,
1314
1330
  high: 1,
@@ -1355,7 +1371,14 @@ function createToolExecutor(config = {}) {
1355
1371
  async function executeWithRetry(tool, input, policy) {
1356
1372
  const executeFn = tool.invoke || tool.execute;
1357
1373
  if (!executeFn) {
1358
- throw new Error("Tool must implement either invoke() or execute() method");
1374
+ throw new Error(
1375
+ "Tool must implement invoke() method. Tools created with createTool() or toolBuilder automatically have this method. If you are manually constructing a tool, ensure it has an invoke() method."
1376
+ );
1377
+ }
1378
+ if (!tool.invoke && tool.execute) {
1379
+ logger2.warn(
1380
+ `Tool "${tool.metadata?.name || "unknown"}" only implements execute() which is deprecated. Please update to implement invoke() as the primary method. execute() will be removed in v1.0.0.`
1381
+ );
1359
1382
  }
1360
1383
  if (!policy) {
1361
1384
  return await executeFn.call(tool, input);
@@ -1479,7 +1502,7 @@ function createToolExecutor(config = {}) {
1479
1502
  }
1480
1503
 
1481
1504
  // src/tools/lifecycle.ts
1482
- var logger2 = createLogger("agentforge:core:tools:lifecycle", { level: "info" /* INFO */ });
1505
+ var logger3 = createLogger("agentforge:core:tools:lifecycle", { level: "info" /* INFO */ });
1483
1506
  var ManagedTool = class {
1484
1507
  name;
1485
1508
  description;
@@ -1511,7 +1534,7 @@ var ManagedTool = class {
1511
1534
  if (this.autoCleanup) {
1512
1535
  process.on("beforeExit", () => {
1513
1536
  this.cleanup().catch(
1514
- (err) => logger2.error("Cleanup failed", {
1537
+ (err) => logger3.error("Cleanup failed", {
1515
1538
  toolName: this.name,
1516
1539
  error: err instanceof Error ? err.message : String(err),
1517
1540
  stack: err instanceof Error ? err.stack : void 0
@@ -2480,14 +2503,14 @@ var withLogging = (options) => {
2480
2503
  onComplete,
2481
2504
  onError
2482
2505
  } = options;
2483
- const logger3 = providedLogger || createLogger(name, { level });
2506
+ const logger4 = providedLogger || createLogger(name, { level });
2484
2507
  return (node) => {
2485
2508
  return async (state) => {
2486
2509
  const startTime = Date.now();
2487
2510
  try {
2488
2511
  if (logInput) {
2489
2512
  const data = extractData ? extractData(state) : { state };
2490
- logger3.info("Node execution started", data);
2513
+ logger4.info("Node execution started", data);
2491
2514
  }
2492
2515
  if (onStart) {
2493
2516
  onStart(state);
@@ -2497,9 +2520,9 @@ var withLogging = (options) => {
2497
2520
  if (logOutput) {
2498
2521
  const data = extractData ? extractData(result) : { result };
2499
2522
  if (logDuration) {
2500
- logger3.info(`Node execution completed (${duration}ms)`, data);
2523
+ logger4.info(`Node execution completed (${duration}ms)`, data);
2501
2524
  } else {
2502
- logger3.info("Node execution completed", data);
2525
+ logger4.info("Node execution completed", data);
2503
2526
  }
2504
2527
  }
2505
2528
  if (onComplete) {
@@ -2510,7 +2533,7 @@ var withLogging = (options) => {
2510
2533
  const duration = Date.now() - startTime;
2511
2534
  const err = error instanceof Error ? error : new Error(String(error));
2512
2535
  if (logErrors) {
2513
- logger3.error(`Node execution failed (${duration}ms)`, {
2536
+ logger4.error(`Node execution failed (${duration}ms)`, {
2514
2537
  error: err.message,
2515
2538
  stack: err.stack
2516
2539
  });
@@ -2546,7 +2569,7 @@ function withLogging2(options) {
2546
2569
  function production(node, options) {
2547
2570
  const {
2548
2571
  nodeName,
2549
- logger: logger3,
2572
+ logger: logger4,
2550
2573
  enableMetrics = true,
2551
2574
  enableTracing = true,
2552
2575
  enableRetry = true,
@@ -2554,7 +2577,7 @@ function production(node, options) {
2554
2577
  retryOptions = {},
2555
2578
  errorOptions = {}
2556
2579
  } = options;
2557
- const actualLogger = logger3 || createLogger(nodeName, { level: "info" /* INFO */ });
2580
+ const actualLogger = logger4 || createLogger(nodeName, { level: "info" /* INFO */ });
2558
2581
  const middleware = [];
2559
2582
  middleware.push(
2560
2583
  withLogging2({
@@ -2618,9 +2641,9 @@ function development(node, options) {
2618
2641
  const {
2619
2642
  nodeName,
2620
2643
  verbose = true,
2621
- logger: logger3
2644
+ logger: logger4
2622
2645
  } = options;
2623
- const actualLogger = logger3 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2646
+ const actualLogger = logger4 || createLogger(nodeName, { level: "debug" /* DEBUG */ });
2624
2647
  return withLogging2({
2625
2648
  logger: actualLogger,
2626
2649
  name: nodeName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentforge/core",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Core abstractions for AgentForge - production-ready deep agents framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",