@voltagent/core 1.5.0 → 1.5.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/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +44 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8636,6 +8636,8 @@ declare class UserInputBridge {
|
|
|
8636
8636
|
* @returns The user's response or a cancel action if no handler
|
|
8637
8637
|
*/
|
|
8638
8638
|
processRequest(request: ElicitRequest["params"]): Promise<ElicitResult>;
|
|
8639
|
+
private normalizeRequest;
|
|
8640
|
+
private getFallbackMessage;
|
|
8639
8641
|
}
|
|
8640
8642
|
|
|
8641
8643
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -8636,6 +8636,8 @@ declare class UserInputBridge {
|
|
|
8636
8636
|
* @returns The user's response or a cancel action if no handler
|
|
8637
8637
|
*/
|
|
8638
8638
|
processRequest(request: ElicitRequest["params"]): Promise<ElicitResult>;
|
|
8639
|
+
private normalizeRequest;
|
|
8640
|
+
private getFallbackMessage;
|
|
8639
8641
|
}
|
|
8640
8642
|
|
|
8641
8643
|
/**
|
package/dist/index.js
CHANGED
|
@@ -22924,11 +22924,12 @@ var UserInputBridge = class {
|
|
|
22924
22924
|
this.logger.warn("No user input handler registered, cancelling request");
|
|
22925
22925
|
return { action: "cancel", content: void 0 };
|
|
22926
22926
|
}
|
|
22927
|
+
const normalizedRequest = this.normalizeRequest(request);
|
|
22927
22928
|
try {
|
|
22928
22929
|
this.logger.debug("Processing user input request", {
|
|
22929
|
-
message:
|
|
22930
|
+
message: normalizedRequest.message
|
|
22930
22931
|
});
|
|
22931
|
-
const result = await this.handler(
|
|
22932
|
+
const result = await this.handler(normalizedRequest);
|
|
22932
22933
|
this.logger.debug("User input request processed", {
|
|
22933
22934
|
action: result.action
|
|
22934
22935
|
});
|
|
@@ -22938,6 +22939,47 @@ var UserInputBridge = class {
|
|
|
22938
22939
|
return { action: "cancel", content: void 0 };
|
|
22939
22940
|
}
|
|
22940
22941
|
}
|
|
22942
|
+
normalizeRequest(request) {
|
|
22943
|
+
if (typeof request.message === "string" && request.message.trim() !== "") {
|
|
22944
|
+
return request;
|
|
22945
|
+
}
|
|
22946
|
+
const fallbackMessage = this.getFallbackMessage(request);
|
|
22947
|
+
if (!fallbackMessage) {
|
|
22948
|
+
return request;
|
|
22949
|
+
}
|
|
22950
|
+
return { ...request, message: fallbackMessage };
|
|
22951
|
+
}
|
|
22952
|
+
getFallbackMessage(request) {
|
|
22953
|
+
if (!("requestedSchema" in request)) {
|
|
22954
|
+
return void 0;
|
|
22955
|
+
}
|
|
22956
|
+
const schema = request.requestedSchema;
|
|
22957
|
+
if (!schema || typeof schema !== "object") {
|
|
22958
|
+
return void 0;
|
|
22959
|
+
}
|
|
22960
|
+
const description = schema.description;
|
|
22961
|
+
if (typeof description === "string" && description.trim() !== "") {
|
|
22962
|
+
return description.trim();
|
|
22963
|
+
}
|
|
22964
|
+
const properties = schema.properties;
|
|
22965
|
+
if (!properties || typeof properties !== "object") {
|
|
22966
|
+
return void 0;
|
|
22967
|
+
}
|
|
22968
|
+
for (const property of Object.values(properties)) {
|
|
22969
|
+
if (!property || typeof property !== "object") {
|
|
22970
|
+
continue;
|
|
22971
|
+
}
|
|
22972
|
+
const propertyDescription = property.description;
|
|
22973
|
+
if (typeof propertyDescription === "string" && propertyDescription.trim() !== "") {
|
|
22974
|
+
return propertyDescription.trim();
|
|
22975
|
+
}
|
|
22976
|
+
const propertyTitle = property.title;
|
|
22977
|
+
if (typeof propertyTitle === "string" && propertyTitle.trim() !== "") {
|
|
22978
|
+
return propertyTitle.trim();
|
|
22979
|
+
}
|
|
22980
|
+
}
|
|
22981
|
+
return void 0;
|
|
22982
|
+
}
|
|
22941
22983
|
};
|
|
22942
22984
|
|
|
22943
22985
|
// src/mcp/client/index.ts
|