@voltagent/server-core 2.1.0 → 2.1.1
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.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2955,6 +2955,7 @@ async function handleListTools(deps, logger) {
|
|
|
2955
2955
|
__name(handleListTools, "handleListTools");
|
|
2956
2956
|
async function handleExecuteTool(toolName, body, deps, logger) {
|
|
2957
2957
|
const { input, context } = body || {};
|
|
2958
|
+
const contextMap = context instanceof Map ? context : context && typeof context === "object" ? new Map(Object.entries(context)) : /* @__PURE__ */ new Map();
|
|
2958
2959
|
const lookup = findTool(deps, toolName);
|
|
2959
2960
|
if (!lookup) {
|
|
2960
2961
|
return {
|
|
@@ -2986,14 +2987,12 @@ async function handleExecuteTool(toolName, body, deps, logger) {
|
|
|
2986
2987
|
const executionStart = Date.now();
|
|
2987
2988
|
const abortController = new AbortController();
|
|
2988
2989
|
try {
|
|
2989
|
-
const userId = context?.userId ?? body?.userId;
|
|
2990
|
-
const conversationId = context?.conversationId ?? body?.conversationId;
|
|
2990
|
+
const userId = (context instanceof Map ? context.get("userId") : context?.userId) ?? body?.userId;
|
|
2991
|
+
const conversationId = (context instanceof Map ? context.get("conversationId") : context?.conversationId) ?? body?.conversationId;
|
|
2991
2992
|
const result = await tool.execute(parsedInput, {
|
|
2992
2993
|
userId,
|
|
2993
2994
|
conversationId,
|
|
2994
|
-
context:
|
|
2995
|
-
context && typeof context === "object" ? Object.entries(context) : []
|
|
2996
|
-
),
|
|
2995
|
+
context: contextMap,
|
|
2997
2996
|
systemContext: /* @__PURE__ */ new Map(),
|
|
2998
2997
|
abortController,
|
|
2999
2998
|
toolContext: {
|