decord/source/924_wrapMethodHandler.js

127 lines
4.2 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 924
2026-07-24 07:16:23 +00:00
// Function ID: 10073
2026-07-20 16:05:17 +00:00
// Name: wrapMethodHandler
2026-07-23 10:11:24 +00:00
// Dependencies: [65, 799, 800, 801, 923]
2026-07-20 16:05:17 +00:00
// Exports: wrapAllMCPHandlers
// Module 924 (wrapMethodHandler)
2026-07-23 10:11:24 +00:00
import _toConsumableArray from "_toConsumableArray";
2026-07-20 16:05:17 +00:00
function wrapMethodHandler(arg0, prompt) {
2026-07-23 10:11:24 +00:00
const _require = prompt;
_require(799).fill(arg0, prompt, (arg0) => {
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return function(arg0) {
2026-07-23 10:11:24 +00:00
let self = this;
let length = arguments.length;
2026-07-20 16:05:17 +00:00
let num = 0;
if (length > 1) {
num = length - 1;
}
const arr = new Array(num);
for (let num2 = 1; num2 < length; num2 = num2 + 1) {
arr[num2 - 1] = arguments[num2];
}
if ("function" !== typeof arr[arr.length - 1]) {
2026-07-23 10:11:24 +00:00
const call2 = closure_0.call;
2026-07-20 16:05:17 +00:00
const items = [self, arg0];
2026-07-23 10:11:24 +00:00
return call2.apply(closure_0, items.concat(arr));
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const call = closure_0.call;
2026-07-20 16:05:17 +00:00
const items1 = [self, arg0];
const items2 = [
2026-07-23 10:11:24 +00:00
(function createWrappedHandler(arg0, closure_0, arg2) {
closure_0 = arg0;
let closure_1 = closure_0;
let closure_2 = arg2;
2026-07-20 16:05:17 +00:00
return function() {
const self = this;
const length = arguments.length;
const array = new Array(length);
for (let num = 0; num < length; num = num + 1) {
let tmp3 = array;
tmp2[num] = arguments[num];
}
2026-07-23 10:11:24 +00:00
return outer4_4.call(self, closure_0, closure_1, closure_2, array);
2026-07-20 16:05:17 +00:00
};
2026-07-23 10:11:24 +00:00
})(tmp, closure_0, arg0)
2026-07-20 16:05:17 +00:00
];
2026-07-23 10:11:24 +00:00
return call.apply(closure_0, items1.concat(outer2_2(arr.slice(0, -1)), items2));
2026-07-20 16:05:17 +00:00
}
};
});
}
function createErrorCapturingHandler(apply) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
let closure_1 = arg2;
2026-07-20 16:05:17 +00:00
const applyResult = apply.apply(this, arg3);
if (applyResult) {
if ("object" === typeof promise) {
if ("function" === typeof promise.then) {
const resolved = Promise.resolve(applyResult);
let catchPromise = resolved.catch((arg0) => {
2026-07-23 10:11:24 +00:00
outer1_5(arg0, closure_0, closure_1);
2026-07-20 16:05:17 +00:00
throw arg0;
});
}
return catchPromise;
}
}
catchPromise = applyResult;
}
function captureHandlerError(name, arg1, tool_name) {
const obj = {};
if ("tool" === arg1) {
obj.tool_name = tool_name;
if ("ProtocolValidationError" !== name.name) {
const message4 = name.message;
if (!message4.includes("validation")) {
const message = name.message;
if (!message.includes("protocol")) {
if ("ServerTimeoutError" !== name.name) {
const message2 = name.message;
if (!message2.includes("timed out")) {
const message3 = name.message;
if (!message3.includes("timeout")) {
2026-07-23 10:11:24 +00:00
require(923) /* captureError */.captureError(name, "tool_execution", obj);
const obj3 = require(923) /* captureError */;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-23 10:11:24 +00:00
require(923) /* captureError */.captureError(name, "timeout", obj);
const obj4 = require(923) /* captureError */;
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-23 10:11:24 +00:00
require(923) /* captureError */.captureError(name, "validation", obj);
const obj5 = require(923) /* captureError */;
2026-07-20 16:05:17 +00:00
} else if ("resource" === arg1) {
obj.resource_uri = tool_name;
2026-07-23 10:11:24 +00:00
require(923) /* captureError */.captureError(name, "resource_execution", obj);
const obj2 = require(923) /* captureError */;
2026-07-20 16:05:17 +00:00
} else if ("prompt" === arg1) {
obj.prompt_name = tool_name;
2026-07-23 10:11:24 +00:00
require(923) /* captureError */.captureError(name, "prompt_execution", obj);
const obj6 = require(923) /* captureError */;
2026-07-20 16:05:17 +00:00
}
}
function wrapToolHandlers(arg0) {
wrapMethodHandler(arg0, "tool");
}
function wrapResourceHandlers(arg0) {
wrapMethodHandler(arg0, "resource");
}
function wrapPromptHandlers(arg0) {
wrapMethodHandler(arg0, "prompt");
}
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
export const wrapAllMCPHandlers = function wrapAllMCPHandlers(arg0) {
wrapToolHandlers(arg0);
wrapResourceHandlers(arg0);
wrapPromptHandlers(arg0);
};
export { wrapPromptHandlers };
export { wrapResourceHandlers };
export { wrapToolHandlers };