@agentforge/core 0.11.3 → 0.11.5
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 +12 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1029,6 +1029,7 @@ var ToolRegistry = class {
|
|
|
1029
1029
|
* @param name - The tool name
|
|
1030
1030
|
* @param tool - The new tool definition
|
|
1031
1031
|
* @returns True if updated, false if the tool didn't exist
|
|
1032
|
+
* @throws Error if the tool's metadata.name doesn't match the name parameter
|
|
1032
1033
|
*
|
|
1033
1034
|
* @example
|
|
1034
1035
|
* ```ts
|
|
@@ -1039,6 +1040,11 @@ var ToolRegistry = class {
|
|
|
1039
1040
|
if (!this.tools.has(name)) {
|
|
1040
1041
|
return false;
|
|
1041
1042
|
}
|
|
1043
|
+
if (tool.metadata.name !== name) {
|
|
1044
|
+
throw new Error(
|
|
1045
|
+
`Cannot update tool: metadata.name "${tool.metadata.name}" does not match registry key "${name}". To rename a tool, remove it and register it again with the new name.`
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1042
1048
|
this.tools.set(name, tool);
|
|
1043
1049
|
this.emit("tool:updated" /* TOOL_UPDATED */, { name, tool });
|
|
1044
1050
|
return true;
|
|
@@ -1585,6 +1591,7 @@ function createToolExecutor(config = {}) {
|
|
|
1585
1591
|
metrics.failedExecutions++;
|
|
1586
1592
|
metrics.totalDuration += duration;
|
|
1587
1593
|
metrics.averageDuration = metrics.totalDuration / metrics.totalExecutions;
|
|
1594
|
+
metrics.byPriority[priority]++;
|
|
1588
1595
|
onExecutionError?.(tool, input, error, duration);
|
|
1589
1596
|
throw error;
|
|
1590
1597
|
}
|
|
@@ -2127,6 +2134,11 @@ function createStateAnnotation(config) {
|
|
|
2127
2134
|
reducer: channelConfig.reducer,
|
|
2128
2135
|
default: channelConfig.default
|
|
2129
2136
|
});
|
|
2137
|
+
} else if (channelConfig.default) {
|
|
2138
|
+
stateDefinition[key] = (0, import_langgraph.Annotation)({
|
|
2139
|
+
reducer: (_left, right) => right,
|
|
2140
|
+
default: channelConfig.default
|
|
2141
|
+
});
|
|
2130
2142
|
} else {
|
|
2131
2143
|
stateDefinition[key] = (0, import_langgraph.Annotation)();
|
|
2132
2144
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1294,6 +1294,7 @@ declare class ToolRegistry {
|
|
|
1294
1294
|
* @param name - The tool name
|
|
1295
1295
|
* @param tool - The new tool definition
|
|
1296
1296
|
* @returns True if updated, false if the tool didn't exist
|
|
1297
|
+
* @throws Error if the tool's metadata.name doesn't match the name parameter
|
|
1297
1298
|
*
|
|
1298
1299
|
* @example
|
|
1299
1300
|
* ```ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1294,6 +1294,7 @@ declare class ToolRegistry {
|
|
|
1294
1294
|
* @param name - The tool name
|
|
1295
1295
|
* @param tool - The new tool definition
|
|
1296
1296
|
* @returns True if updated, false if the tool didn't exist
|
|
1297
|
+
* @throws Error if the tool's metadata.name doesn't match the name parameter
|
|
1297
1298
|
*
|
|
1298
1299
|
* @example
|
|
1299
1300
|
* ```ts
|
package/dist/index.js
CHANGED
|
@@ -873,6 +873,7 @@ var ToolRegistry = class {
|
|
|
873
873
|
* @param name - The tool name
|
|
874
874
|
* @param tool - The new tool definition
|
|
875
875
|
* @returns True if updated, false if the tool didn't exist
|
|
876
|
+
* @throws Error if the tool's metadata.name doesn't match the name parameter
|
|
876
877
|
*
|
|
877
878
|
* @example
|
|
878
879
|
* ```ts
|
|
@@ -883,6 +884,11 @@ var ToolRegistry = class {
|
|
|
883
884
|
if (!this.tools.has(name)) {
|
|
884
885
|
return false;
|
|
885
886
|
}
|
|
887
|
+
if (tool.metadata.name !== name) {
|
|
888
|
+
throw new Error(
|
|
889
|
+
`Cannot update tool: metadata.name "${tool.metadata.name}" does not match registry key "${name}". To rename a tool, remove it and register it again with the new name.`
|
|
890
|
+
);
|
|
891
|
+
}
|
|
886
892
|
this.tools.set(name, tool);
|
|
887
893
|
this.emit("tool:updated" /* TOOL_UPDATED */, { name, tool });
|
|
888
894
|
return true;
|
|
@@ -1429,6 +1435,7 @@ function createToolExecutor(config = {}) {
|
|
|
1429
1435
|
metrics.failedExecutions++;
|
|
1430
1436
|
metrics.totalDuration += duration;
|
|
1431
1437
|
metrics.averageDuration = metrics.totalDuration / metrics.totalExecutions;
|
|
1438
|
+
metrics.byPriority[priority]++;
|
|
1432
1439
|
onExecutionError?.(tool, input, error, duration);
|
|
1433
1440
|
throw error;
|
|
1434
1441
|
}
|
|
@@ -1971,6 +1978,11 @@ function createStateAnnotation(config) {
|
|
|
1971
1978
|
reducer: channelConfig.reducer,
|
|
1972
1979
|
default: channelConfig.default
|
|
1973
1980
|
});
|
|
1981
|
+
} else if (channelConfig.default) {
|
|
1982
|
+
stateDefinition[key] = Annotation({
|
|
1983
|
+
reducer: (_left, right) => right,
|
|
1984
|
+
default: channelConfig.default
|
|
1985
|
+
});
|
|
1974
1986
|
} else {
|
|
1975
1987
|
stateDefinition[key] = Annotation();
|
|
1976
1988
|
}
|